Style: Allow a layer to open the popup-view in a floatover

This commit is contained in:
Pieter Vander Vennet 2023-05-05 01:00:15 +02:00
parent 377c411143
commit 65a4303dd6
4 changed files with 16 additions and 1 deletions

View file

@ -399,4 +399,9 @@ export interface LayerConfigJson {
* no-question-hint-check: disables a check in MiscTagRenderingChecks which complains about 'div', 'span' or 'class=subtle'-HTML elements in the tagRendering * no-question-hint-check: disables a check in MiscTagRenderingChecks which complains about 'div', 'span' or 'class=subtle'-HTML elements in the tagRendering
*/ */
"#"?: string | "no-question-hint-check" "#"?: string | "no-question-hint-check"
/**
* If set, open the selectedElementView in a floatOver instead of on the right
*/
popupInFloatover?: boolean
} }

View file

@ -69,6 +69,7 @@ export default class LayerConfig extends WithContextLoader {
public readonly syncSelection: typeof LayerConfig.syncSelectionAllowed[number] // this is a trick to conver a constant array of strings into a type union of these values public readonly syncSelection: typeof LayerConfig.syncSelectionAllowed[number] // this is a trick to conver a constant array of strings into a type union of these values
public readonly _needsFullNodeDatabase = false public readonly _needsFullNodeDatabase = false
public readonly popupInFloatover
constructor(json: LayerConfigJson, context?: string, official: boolean = true) { constructor(json: LayerConfigJson, context?: string, official: boolean = true) {
context = context + "." + json.id context = context + "." + json.id
@ -414,6 +415,8 @@ export default class LayerConfig extends WithContextLoader {
": showIf. Did you mean 'isShown' instead?" ": showIf. Did you mean 'isShown' instead?"
) )
} }
this.popupInFloatover = json.popupInFloatover ?? false
} }
public defaultIcon(): BaseUIElement | undefined { public defaultIcon(): BaseUIElement | undefined {

View file

@ -121,12 +121,18 @@
</If> </If>
</div> </div>
<If condition={selectedViewElement.map(v => v !== undefined && selectedLayer.data !== undefined,[ selectedLayer] )}> <If condition={selectedViewElement.map(v => v !== undefined && selectedLayer.data !== undefined && !selectedLayer.data.popupInFloatover,[ selectedLayer] )}>
<ModalRight on:close={() => {selectedElement.setData(undefined)}}> <ModalRight on:close={() => {selectedElement.setData(undefined)}}>
<ToSvelte construct={new VariableUiElement(selectedViewElement)}></ToSvelte> <ToSvelte construct={new VariableUiElement(selectedViewElement)}></ToSvelte>
</ModalRight> </ModalRight>
</If> </If>
<If condition={selectedViewElement.map(v => v !== undefined && selectedLayer.data !== undefined && selectedLayer.data.popupInFloatover,[ selectedLayer] )}>
<FloatOver on:close={() => {selectedElement.setData(undefined)}}>
<ToSvelte construct={new VariableUiElement(selectedViewElement)}></ToSvelte>
</FloatOver>
</If>
<If condition={state.guistate.themeIsOpened}> <If condition={state.guistate.themeIsOpened}>
<!-- Theme page --> <!-- Theme page -->
<FloatOver on:close={() => state.guistate.themeIsOpened.setData(false)}> <FloatOver on:close={() => state.guistate.themeIsOpened.setData(false)}>

View file

@ -10,6 +10,7 @@
}, },
"name": null, "name": null,
"titleIcons": [], "titleIcons": [],
"popupInFloatover": true,
"title": { "title": {
"mappings": [ "mappings": [
{ {