Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions umap/static/umap/js/modules/data/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,23 +1004,6 @@ export class DataLayer {
body.appendChild(fieldsContainer)
this.fields.edit(fieldsContainer)
}

const template = `
<fieldset class="formbox" id="fields-and-keys">
<legend>${translate('Keys management')}</legend>
<div data-ref=keyContainer></div>
</fieldset>
`
const [root, { keyContainer }] = Utils.loadTemplateWithRefs(template)
const optionsFields = [
'properties.labelKey',
'properties.sortKey',
// 'properties.filterKey',
]
body.appendChild(root)

const builder = new MutatingForm(this, optionsFields, { umap: this })
keyContainer.appendChild(builder.build())
this.filters.edit(body)
}

Expand Down
4 changes: 1 addition & 3 deletions umap/static/umap/js/modules/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,7 @@ export default class Filters {
<fieldset class="formbox" id="filters">
<legend data-help=filters>${translate('Filters')}</legend>
<ul data-ref=ul></ul>
<button class="umap-add" type="button" data-ref=add>
<i class="icon icon-16 icon-add"></i> ${translate('Add filter')}
</button>
<button class="umap-add" type="button" data-ref=add>${translate('Add filter')}</button>
</fieldset>
`
const [body, { ul, add }] = Utils.loadTemplateWithRefs(template)
Expand Down
2 changes: 1 addition & 1 deletion umap/static/umap/js/modules/managers.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class FieldManager extends Map {
edit(container) {
const ul = Utils.loadTemplate('<ul></ul>')
const add = Utils.loadTemplate(
`<button type="button" data-ref=add><i class="icon icon-16 icon-add"></i>${translate('Add a new field')}</button>`
`<button type="button" data-ref=add>${translate('Add a new field')}</button>`
)
add.addEventListener('click', () => {
this.editField().then(() => {
Expand Down
38 changes: 19 additions & 19 deletions umap/static/umap/js/modules/umap.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,6 @@ export default class Umap {
'properties.captionBar',
'properties.captionMenus',
'properties.layerSwitcher',
'properties.zoomTo',
'properties.easing',
])
const builder = new MutatingForm(this, UIFields, { umap: this })
const controlsOptions = DomUtil.createFieldset(
Expand Down Expand Up @@ -879,6 +877,24 @@ export default class Umap {
defaultShapeProperties.appendChild(builder.build())
}

_editDefaultKeys(container) {
const shapeOptions = [
'properties.zoomTo',
'properties.easing',
'properties.labelKey',
'properties.sortKey',
'properties.filterKey',
'properties.slugKey',
]

const builder = new MutatingForm(this, shapeOptions, { umap: this })
const defaultShapeProperties = DomUtil.createFieldset(
container,
translate('Default properties')
)
defaultShapeProperties.appendChild(builder.build())
}

_editFieldsAndKeys(parent) {
const body = Utils.loadTemplate(`
<details id="fields-management">
Expand All @@ -897,23 +913,6 @@ export default class Umap {

body.appendChild(fieldsContainer)
this.fields.edit(fieldsContainer)
const template = `
<fieldset class="formbox" id="fields-and-keys">
<legend>${translate('Keys management')}</legend>
<div data-ref=keyContainer></div>
</fieldset>
`
const [root, { keyContainer }] = Utils.loadTemplateWithRefs(template)
const optionsFields = [
'properties.labelKey',
'properties.sortKey',
'properties.filterKey',
'properties.slugKey',
]
body.appendChild(root)

const builder = new MutatingForm(this, optionsFields, { umap: this })
keyContainer.appendChild(builder.build())
this.filters.edit(body)
}

Expand Down Expand Up @@ -1189,6 +1188,7 @@ export default class Umap {
)
this._editControls(container)
this._editShapeProperties(container)
this._editDefaultKeys(container)
this._editFieldsAndKeys(container)
this._editInteractionsProperties(container)
this.rules.edit(container)
Expand Down
2 changes: 1 addition & 1 deletion umap/tests/integration/test_edit_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_sortkey_impacts_datalayerindex(map, live_server, page):
# Change the default sortkey to be "key"
page.get_by_role("button", name="Edit").click()
page.get_by_role("button", name="Map advanced properties").click()
page.get_by_text("Fields, filters and keys").click()
page.get_by_text("Default properties").click()

# Click "define"
page.locator(".panel .umap-field-sortKey .define").click()
Expand Down