Skip to content

Commit

Permalink
Fix hideGroupCheckbox
Browse files Browse the repository at this point in the history
  • Loading branch information
nboisteault committed Feb 8, 2024
1 parent 09bb90a commit 07ab45d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion assets/src/components/Treeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export default class Treeview extends HTMLElement {
? html`<div class="loading ${item.loadStatus === MapLayerLoadStatus.Loading ? 'spinner' : ''}"></div>`
: ''
}
<input type="checkbox" class="${layerTreeGroupState.mutuallyExclusive ? 'rounded-checkbox' : ''}" id="node-${item.name}" .checked=${item.checked} @click=${() => item.checked = !item.checked} >
${item.type === 'group' && mainLizmap.initialConfig.options.hideGroupCheckbox
? ''
: html`<input type="checkbox" class="${layerTreeGroupState.mutuallyExclusive ? 'rounded-checkbox' : ''}" id="node-${item.name}" .checked=${item.checked} @click=${() => item.checked = !item.checked} >`
}
<div class="node ${item.isFiltered ? 'filtered' : ''}">
${item.type === 'layer'
? html`<img class="legend" src="${item.icon}">`
Expand Down
10 changes: 10 additions & 0 deletions assets/src/modules/config/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const optionalProperties = {
'fixed_scale_overview_map': {type: 'boolean', default: true},
'use_native_zoom_levels': {type: 'boolean', nullable: true, default: null},
'hide_numeric_scale_value': {type: 'boolean', default: false},
'hideGroupCheckbox': { type: 'boolean', nullable: true, default: null },
};

/**
Expand Down Expand Up @@ -58,6 +59,7 @@ export class OptionsConfig extends BaseObjectConfig {
* @param {Boolean} [cfg.fixed_scale_overview_map=true] - does the Overview map have fixed scale ?
* @param {Boolean} [cfg.use_native_zoom_levels=false] - does the map use native zoom levels ?
* @param {Boolean} [cfg.hide_numeric_scale_value=false] - does the scale line hide numeric scale value ?
* @param {Boolean} [cfg.hideGroupCheckbox=false] - are groups checkbox hidden ?
*/
constructor(cfg) {
if (!cfg || typeof cfg !== "object") {
Expand Down Expand Up @@ -222,4 +224,12 @@ export class OptionsConfig extends BaseObjectConfig {
get hide_numeric_scale_value() {
return this._hide_numeric_scale_value;
}

/**
* Hide groups checkbox
* @type {boolean}
*/
get hideGroupCheckbox() {
return this._hideGroupCheckbox;
}
}

0 comments on commit 07ab45d

Please sign in to comment.