@omegagrid/editor 0.10.91 → 0.10.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/editors/ruleEditor.d.ts.map +1 -1
- package/dist/ui/editors/ruleEditor.js +2 -1
- package/dist/ui/editors/ruleEditor.js.map +1 -1
- package/dist/ui/editors/themeEditor.d.ts +5 -0
- package/dist/ui/editors/themeEditor.d.ts.map +1 -1
- package/dist/ui/editors/themeEditor.js +10 -0
- package/dist/ui/editors/themeEditor.js.map +1 -1
- package/dist/ui/editors/themeItemEditor.d.ts +15 -1
- package/dist/ui/editors/themeItemEditor.d.ts.map +1 -1
- package/dist/ui/editors/themeItemEditor.js +113 -11
- package/dist/ui/editors/themeItemEditor.js.map +1 -1
- package/dist/ui/sidebars/themeEditorSidebar.d.ts.map +1 -1
- package/dist/ui/sidebars/themeEditorSidebar.js +6 -1
- package/dist/ui/sidebars/themeEditorSidebar.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruleEditor.d.ts","sourceRoot":"","sources":["../../../src/ui/editors/ruleEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAuC,MAAM,iBAAiB,CAAC;AAEzF,OAAO,EAAU,mBAAmB,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"ruleEditor.d.ts","sourceRoot":"","sources":["../../../src/ui/editors/ruleEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAuC,MAAM,iBAAiB,CAAC;AAEzF,OAAO,EAAU,mBAAmB,EAAE,YAAY,EAAU,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAErH,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIpD,qBACa,UAAW,SAAQ,cAAc;IAE7C,MAAM,CAAC,MAAM,iCAEV;IAGH,MAAM,EAAE,iBAAiB,CAAC;IAG1B,WAAW,EAAE,KAAK,CAAC;IAGnB,cAAc,EAAE,KAAK,CAAC;IAGtB,cAAc,EAAE,mBAAmB,CAAC;IAGpC,cAAc,EAAE,mBAAmB,CAAC;IAGpC,cAAc,EAAE,mBAAmB,CAAC;IAGpC,UAAU,EAAE,mBAAmB,CAAC;IAGhC,QAAQ,EAAE,YAAY,CAAC;IAGvB,SAAS,EAAE,SAAS,CAAC;IAGrB,UAAU,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;IAGtC,IAAI,EAAE,aAAa,CAAC;IAGpB,IAAI,EAAE,aAAa,CAAC;IAGpB,IAAI,EAAE,aAAa,CAAC;IAEpB,YAAY;IAkDZ,iBAAiB,6CAqBf;IAEF,eAAe,6CAwBb;IAEF,aAAa,6CAgCX;IAEF,gBAAgB,GAAI,KAAK,cAAc,EAAE,OAAO,MAAM,EAAE,MAAM,QAAQ,0CAMpE;IAEF,cAAc,6CA8BZ;IAEF,MAAM,6CAKJ;CACF"}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { customElement, property, query, queryAll } from 'lit/decorators.js';
|
|
8
8
|
import { iconSets } from '@omegagrid/grid';
|
|
9
9
|
import { css, html } from 'lit';
|
|
10
|
-
import { colors, OmegaComponent } from '@omegagrid/core';
|
|
10
|
+
import { colors, events, OmegaComponent } from '@omegagrid/core';
|
|
11
11
|
import { msg } from '@omegagrid/localize';
|
|
12
12
|
import { map } from 'lit-html/directives/map.js';
|
|
13
13
|
import { choose } from 'lit-html/directives/choose.js';
|
|
@@ -191,6 +191,7 @@ let RuleEditor = class RuleEditor extends OmegaComponent {
|
|
|
191
191
|
this.format.cmax = this.cmax.value;
|
|
192
192
|
if (update)
|
|
193
193
|
this.requestUpdate();
|
|
194
|
+
this.dispatchEvent(new events.ChangeEvent(this.format));
|
|
194
195
|
}
|
|
195
196
|
};
|
|
196
197
|
RuleEditor.styles = [OmegaComponent.styles, css `
|
|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AM;YAAE,IAAI,CAAC,aAAa,EAAE,CAAC;IAClC,CAAC;;AA1FM,iBAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAA;;EAE1C,CAAC,AAFW,CAEV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0CACC;AAG1B;IADC,KAAK,CAAC,iBAAiB,CAAC;+CACN;AAGnB;IADC,KAAK,CAAC,oBAAoB,CAAC;kDACN;AAGtB;IADC,KAAK,CAAC,mCAAmC,CAAC;kDACP;AAGpC;IADC,KAAK,CAAC,mCAAmC,CAAC;kDACP;AAGpC;IADC,KAAK,CAAC,mCAAmC,CAAC;kDACP;AAGpC;IADC,KAAK,CAAC,+BAA+B,CAAC;8CACP;AAGhC;IADC,KAAK,CAAC,wBAAwB,CAAC;4CACT;AAGvB;IADC,KAAK,CAAC,6BAA6B,CAAC;6CAChB;AAGrB;IADC,QAAQ,CAAC,oCAAoC,CAAC;8CACT;AAGtC;IADC,KAAK,CAAC,+BAA+B,CAAC;wCACnB;AAGpB;IADC,KAAK,CAAC,+BAA+B,CAAC;wCACnB;AAGpB;IADC,KAAK,CAAC,+BAA+B,CAAC;wCACnB;AA3CR,UAAU;IADtB,aAAa,CAAC,sBAAsB,CAAC;GACzB,UAAU,CA+NtB","sourcesContent":["import { customElement, property, query, queryAll } from 'lit/decorators.js';\nimport { ConditionalFormat, ConditionalFormatIconType, iconSets } from '@omegagrid/grid';\nimport { css, html } from 'lit';\nimport { colors, DropdownColorPicker, DropdownList, Input, MenuItem, OmegaComponent } from '@omegagrid/core';\nimport { msg } from '@omegagrid/localize';\nimport { RuleThreshold, StyleForm } from '../forms';\nimport { map } from 'lit-html/directives/map.js';\nimport { choose } from 'lit-html/directives/choose.js';\n\n@customElement('og-editor-ruleeditor')\nexport class RuleEditor extends OmegaComponent {\n\n\tstatic styles = [OmegaComponent.styles, css`\n\n\t`];\n\n\t@property({type: Object})\n\tformat: ConditionalFormat;\n\n\t@query('og-input#ranges')\n\trangesInput: Input;\n\n\t@query('og-input#condition')\n\tconditionInput: Input;\n\n\t@query('og-dropdown-colorpicker#cminColor')\n\tcminColorInput: DropdownColorPicker;\n\n\t@query('og-dropdown-colorpicker#cmidColor')\n\tcmidColorInput: DropdownColorPicker;\n\n\t@query('og-dropdown-colorpicker#cmaxColor')\n\tcmaxColorInput: DropdownColorPicker;\n\n\t@query('og-dropdown-colorpicker#color')\n\tcolorInput: DropdownColorPicker;\n\n\t@query('og-dropdown-list#icons')\n\ticonList: DropdownList;\n\n\t@query('og-editor-styleeditor#style')\n\tstyleForm: StyleForm;\n\n\t@queryAll('og-editor-rule-threshold.threshold')\n\tthresholds: NodeListOf<RuleThreshold>;\n\n\t@query('og-editor-rule-threshold#cmin')\n\tcmin: RuleThreshold;\n\n\t@query('og-editor-rule-threshold#cmid')\n\tcmid: RuleThreshold;\n\n\t@query('og-editor-rule-threshold#cmax')\n\tcmax: RuleThreshold;\n\n\tupdateFormat() {\n\t\tif (!this.format) return;\n\t\tlet update = false;\n\n\t\tthis.format.cmin = null\n\t\tthis.format.cmid = null\n\t\tthis.format.cmax = null\n\n\t\tif (this.conditionInput) this.format.condition = this.conditionInput.value;\n\t\telse this.format.condition = null;\n\n\t\tif (this.styleForm) this.format.style = this.styleForm.data;\n\t\telse this.format.style = null;\n\n\t\tif (this.cminColorInput) {\n\t\t\tthis.format.cmin = this.format.cmin ?? {};\n\t\t\tthis.format.cmin.t = 'min';\n\t\t\tthis.format.cmin.color = colors.plainHex(this.cminColorInput.value);\n\t\t}\n\n\t\tif (this.cmidColorInput) {\n\t\t\tthis.format.cmid = this.format.cmid ?? {};\n\t\t\tthis.format.cmid.color = colors.plainHex(this.cmidColorInput.value);\n\t\t}\n\n\t\tif (this.cmaxColorInput) {\n\t\t\tthis.format.cmax = this.format.cmax ?? {};\n\t\t\tthis.format.cmax.t = 'max';\n\t\t\tthis.format.cmax.color = colors.plainHex(this.cmaxColorInput.value);\n\t\t}\n\n\t\tif (this.colorInput) this.format.color = colors.plainHex(this.colorInput.value);\n\t\telse this.format.color = null;\n\n\t\tif (this.iconList) {\n\t\t\tif (this.format.v != this.iconList.value) update = true;\n\t\t\tthis.format.v = this.iconList.value;\n\t\t} else this.format.v = null;\n\n\t\tif (this.thresholds) this.format.thresh = Array.from(this.thresholds).map(t => t.value);\n\t\telse this.format.thresh = null;\n\n\t\tif (this.cmin) this.format.cmin = this.cmin.value;\n\t\tif (this.cmid) this.format.cmid = this.cmid.value;\n\t\tif (this.cmax) this.format.cmax = this.cmax.value;\n\n\t\tif (update) this.requestUpdate();\n\t}\n\n\trenderFormulaForm = () => html`\n\t\t<div class=\"row\">${msg('Condition')}</div>\n\n\t\t<div class=\"row\">\n\t\t\t<og-input\n\t\t\t\tid=\"condition\"\n\t\t\t\t.value=\"${this.format.condition || ''}\"\n\t\t\t\tstyle=\"width: 100%\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-input>\n\t\t</div>\n\n\t\t<div class=\"row\">${msg('Style')}</div>\n\n\t\t<div class=\"row\">\n\t\t\t<og-editor-styleeditor\n\t\t\t\tid=\"style\"\n\t\t\t\t.data=\"${this.format.style || {}}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-editor-styleeditor>\n\t\t</div>\n\t`;\n\n\trenderScaleForm = () => html`\n\t\t<div class=\"row\">${msg('Colors')}</div>\n\t\t<div class=\"row\" style=\"display: flex; gap: 4px;\">\n\t\t\t<og-dropdown-colorpicker\n\t\t\t\tid=\"cminColor\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.value=\"${colors.css(this.format.cmin?.color)}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-colorpicker>\n\n\t\t\t<og-dropdown-colorpicker\n\t\t\t\tid=\"cmidColor\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.value=\"${colors.css(this.format.cmid?.color)}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-colorpicker>\n\n\t\t\t<og-dropdown-colorpicker\n\t\t\t\tid=\"cmaxColor\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.value=\"${colors.css(this.format.cmax?.color)}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-colorpicker>\n\t\t</div>\n\t`;\n\n\trenderBarForm = () => html`\n\t\t<div class=\"row\">${msg('Minimum')}</div>\n\t\t<div class=\"row\">\n\t\t\t<og-editor-rule-threshold\n\t\t\t\tid=\"cmin\"\n\t\t\t\t.value=\"${this.format?.cmin}\"\n\t\t\t\t.allowedTypes=\"${['auto', 'num', 'percent']}\"\n\t\t\t\t?first=\"${false}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-editor-rule-threshold>\n\t\t</div>\n\n\t\t<div class=\"row\">${msg('Maximum')}</div>\n\t\t<div class=\"row\">\n\t\t\t<og-editor-rule-threshold\n\t\t\t\tid=\"cmax\"\n\t\t\t\t.value=\"${this.format?.cmax}\"\n\t\t\t\t.allowedTypes=\"${['auto', 'num', 'percent']}\"\n\t\t\t\t?first=\"${false}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-editor-rule-threshold>\n\t\t</div>\n\n\t\t<div class=\"row\">${msg('Color')}</div>\n\t\t<div class=\"row\" style=\"display: flex; gap: 4px;\">\n\t\t\t<og-dropdown-colorpicker\n\t\t\t\tid=\"color\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.value=\"${colors.css(this.format.color)}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-colorpicker>\n\t\t</div>\n\t`;\n\n\ticonItemRenderer = (div: HTMLDivElement, index: number, item: MenuItem) => html`\n\t\t<div style=\"padding-left: 5px\">\n\t\t\t${map(iconSets.get(item.key as ConditionalFormatIconType), icon => html`\n\t\t\t\t<og-icon .icon=\"${icon}\"></og-icon>\n\t\t\t`)} (${item.key})\n\t\t</div>\n\t`;\n\n\trenderIconForm = () => html`\n\t\t<div class=\"row\">${msg('Icons')}</div>\n\t\t<div class=\"row\" style=\"display: flex; gap: 4px;\">\n\t\t\t<og-dropdown-list\n\t\t\t\tid=\"icons\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.items=\"${Array.from(iconSets.entries()).map(item => ({\n\t\t\t\t\tkey: item[0],\n\t\t\t\t\tvalue: item[0],\n\t\t\t\t\trenderer: this.iconItemRenderer\n\t\t\t\t}))}\"\n\t\t\t\t.value=\"${this.format.v as string}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-list>\n\t\t</div>\n\n\t\t${this.format.v && iconSets.has(this.format.v as ConditionalFormatIconType) ? html`\n\t\t\t<div class=\"row\">${msg('Thresholds')}</div>\n\t\t\t<div style=\"display: flex; flex-direction: column; gap: 2px; margin-top: 2px\">\n\t\t\t\t${map(iconSets.get(this.format.v as ConditionalFormatIconType), (_icon, i) => html`\n\t\t\t\t\t<og-editor-rule-threshold\n\t\t\t\t\t\tclass=\"threshold\"\n\t\t\t\t\t\t.allowedTypes=\"${['num', 'percent']}\"\n\t\t\t\t\t\t.value=\"${this.format?.thresh[i]}\"\n\t\t\t\t\t\t?first=\"${i == 0}\"\n\t\t\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t\t\t</og-editor-rule-threshold>\n\t\t\t\t`)}\n\t\t\t</div>\n\t\t` : ''}\n\t`;\n\n\trender = () => choose(this.format?.type, [\n\t\t['formula', this.renderFormulaForm],\n\t\t['scale', this.renderScaleForm],\n\t\t['bar', this.renderBarForm],\n\t\t['icon', this.renderIconForm],\n\t])\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ruleEditor.js","sourceRoot":"","sources":["../../../src/ui/editors/ruleEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QA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AM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAA;;EAE1C,CAAC,AAFW,CAEV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0CACC;AAG1B;IADC,KAAK,CAAC,iBAAiB,CAAC;+CACN;AAGnB;IADC,KAAK,CAAC,oBAAoB,CAAC;kDACN;AAGtB;IADC,KAAK,CAAC,mCAAmC,CAAC;kDACP;AAGpC;IADC,KAAK,CAAC,mCAAmC,CAAC;kDACP;AAGpC;IADC,KAAK,CAAC,mCAAmC,CAAC;kDACP;AAGpC;IADC,KAAK,CAAC,+BAA+B,CAAC;8CACP;AAGhC;IADC,KAAK,CAAC,wBAAwB,CAAC;4CACT;AAGvB;IADC,KAAK,CAAC,6BAA6B,CAAC;6CAChB;AAGrB;IADC,QAAQ,CAAC,oCAAoC,CAAC;8CACT;AAGtC;IADC,KAAK,CAAC,+BAA+B,CAAC;wCACnB;AAGpB;IADC,KAAK,CAAC,+BAA+B,CAAC;wCACnB;AAGpB;IADC,KAAK,CAAC,+BAA+B,CAAC;wCACnB;AA3CR,UAAU;IADtB,aAAa,CAAC,sBAAsB,CAAC;GACzB,UAAU,CAgOtB","sourcesContent":["import { customElement, property, query, queryAll } from 'lit/decorators.js';\nimport { ConditionalFormat, ConditionalFormatIconType, iconSets } from '@omegagrid/grid';\nimport { css, html } from 'lit';\nimport { colors, DropdownColorPicker, DropdownList, events, Input, MenuItem, OmegaComponent } from '@omegagrid/core';\nimport { msg } from '@omegagrid/localize';\nimport { RuleThreshold, StyleForm } from '../forms';\nimport { map } from 'lit-html/directives/map.js';\nimport { choose } from 'lit-html/directives/choose.js';\n\n@customElement('og-editor-ruleeditor')\nexport class RuleEditor extends OmegaComponent {\n\n\tstatic styles = [OmegaComponent.styles, css`\n\n\t`];\n\n\t@property({type: Object})\n\tformat: ConditionalFormat;\n\n\t@query('og-input#ranges')\n\trangesInput: Input;\n\n\t@query('og-input#condition')\n\tconditionInput: Input;\n\n\t@query('og-dropdown-colorpicker#cminColor')\n\tcminColorInput: DropdownColorPicker;\n\n\t@query('og-dropdown-colorpicker#cmidColor')\n\tcmidColorInput: DropdownColorPicker;\n\n\t@query('og-dropdown-colorpicker#cmaxColor')\n\tcmaxColorInput: DropdownColorPicker;\n\n\t@query('og-dropdown-colorpicker#color')\n\tcolorInput: DropdownColorPicker;\n\n\t@query('og-dropdown-list#icons')\n\ticonList: DropdownList;\n\n\t@query('og-editor-styleeditor#style')\n\tstyleForm: StyleForm;\n\n\t@queryAll('og-editor-rule-threshold.threshold')\n\tthresholds: NodeListOf<RuleThreshold>;\n\n\t@query('og-editor-rule-threshold#cmin')\n\tcmin: RuleThreshold;\n\n\t@query('og-editor-rule-threshold#cmid')\n\tcmid: RuleThreshold;\n\n\t@query('og-editor-rule-threshold#cmax')\n\tcmax: RuleThreshold;\n\n\tupdateFormat() {\n\t\tif (!this.format) return;\n\t\tlet update = false;\n\n\t\tthis.format.cmin = null\n\t\tthis.format.cmid = null\n\t\tthis.format.cmax = null\n\n\t\tif (this.conditionInput) this.format.condition = this.conditionInput.value;\n\t\telse this.format.condition = null;\n\n\t\tif (this.styleForm) this.format.style = this.styleForm.data;\n\t\telse this.format.style = null;\n\n\t\tif (this.cminColorInput) {\n\t\t\tthis.format.cmin = this.format.cmin ?? {};\n\t\t\tthis.format.cmin.t = 'min';\n\t\t\tthis.format.cmin.color = colors.plainHex(this.cminColorInput.value);\n\t\t}\n\n\t\tif (this.cmidColorInput) {\n\t\t\tthis.format.cmid = this.format.cmid ?? {};\n\t\t\tthis.format.cmid.color = colors.plainHex(this.cmidColorInput.value);\n\t\t}\n\n\t\tif (this.cmaxColorInput) {\n\t\t\tthis.format.cmax = this.format.cmax ?? {};\n\t\t\tthis.format.cmax.t = 'max';\n\t\t\tthis.format.cmax.color = colors.plainHex(this.cmaxColorInput.value);\n\t\t}\n\n\t\tif (this.colorInput) this.format.color = colors.plainHex(this.colorInput.value);\n\t\telse this.format.color = null;\n\n\t\tif (this.iconList) {\n\t\t\tif (this.format.v != this.iconList.value) update = true;\n\t\t\tthis.format.v = this.iconList.value;\n\t\t} else this.format.v = null;\n\n\t\tif (this.thresholds) this.format.thresh = Array.from(this.thresholds).map(t => t.value);\n\t\telse this.format.thresh = null;\n\n\t\tif (this.cmin) this.format.cmin = this.cmin.value;\n\t\tif (this.cmid) this.format.cmid = this.cmid.value;\n\t\tif (this.cmax) this.format.cmax = this.cmax.value;\n\n\t\tif (update) this.requestUpdate();\n\t\tthis.dispatchEvent(new events.ChangeEvent(this.format));\n\t}\n\n\trenderFormulaForm = () => html`\n\t\t<div class=\"row\">${msg('Condition')}</div>\n\n\t\t<div class=\"row\">\n\t\t\t<og-input\n\t\t\t\tid=\"condition\"\n\t\t\t\t.value=\"${this.format.condition || ''}\"\n\t\t\t\tstyle=\"width: 100%\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-input>\n\t\t</div>\n\n\t\t<div class=\"row\">${msg('Style')}</div>\n\n\t\t<div class=\"row\">\n\t\t\t<og-editor-styleeditor\n\t\t\t\tid=\"style\"\n\t\t\t\t.data=\"${this.format.style || {}}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-editor-styleeditor>\n\t\t</div>\n\t`;\n\n\trenderScaleForm = () => html`\n\t\t<div class=\"row\">${msg('Colors')}</div>\n\t\t<div class=\"row\" style=\"display: flex; gap: 4px;\">\n\t\t\t<og-dropdown-colorpicker\n\t\t\t\tid=\"cminColor\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.value=\"${colors.css(this.format.cmin?.color)}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-colorpicker>\n\n\t\t\t<og-dropdown-colorpicker\n\t\t\t\tid=\"cmidColor\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.value=\"${colors.css(this.format.cmid?.color)}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-colorpicker>\n\n\t\t\t<og-dropdown-colorpicker\n\t\t\t\tid=\"cmaxColor\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.value=\"${colors.css(this.format.cmax?.color)}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-colorpicker>\n\t\t</div>\n\t`;\n\n\trenderBarForm = () => html`\n\t\t<div class=\"row\">${msg('Minimum')}</div>\n\t\t<div class=\"row\">\n\t\t\t<og-editor-rule-threshold\n\t\t\t\tid=\"cmin\"\n\t\t\t\t.value=\"${this.format?.cmin}\"\n\t\t\t\t.allowedTypes=\"${['auto', 'num', 'percent']}\"\n\t\t\t\t?first=\"${false}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-editor-rule-threshold>\n\t\t</div>\n\n\t\t<div class=\"row\">${msg('Maximum')}</div>\n\t\t<div class=\"row\">\n\t\t\t<og-editor-rule-threshold\n\t\t\t\tid=\"cmax\"\n\t\t\t\t.value=\"${this.format?.cmax}\"\n\t\t\t\t.allowedTypes=\"${['auto', 'num', 'percent']}\"\n\t\t\t\t?first=\"${false}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-editor-rule-threshold>\n\t\t</div>\n\n\t\t<div class=\"row\">${msg('Color')}</div>\n\t\t<div class=\"row\" style=\"display: flex; gap: 4px;\">\n\t\t\t<og-dropdown-colorpicker\n\t\t\t\tid=\"color\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.value=\"${colors.css(this.format.color)}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-colorpicker>\n\t\t</div>\n\t`;\n\n\ticonItemRenderer = (div: HTMLDivElement, index: number, item: MenuItem) => html`\n\t\t<div style=\"padding-left: 5px\">\n\t\t\t${map(iconSets.get(item.key as ConditionalFormatIconType), icon => html`\n\t\t\t\t<og-icon .icon=\"${icon}\"></og-icon>\n\t\t\t`)} (${item.key})\n\t\t</div>\n\t`;\n\n\trenderIconForm = () => html`\n\t\t<div class=\"row\">${msg('Icons')}</div>\n\t\t<div class=\"row\" style=\"display: flex; gap: 4px;\">\n\t\t\t<og-dropdown-list\n\t\t\t\tid=\"icons\"\n\t\t\t\tstyle=\"flex: 1\"\n\t\t\t\t.items=\"${Array.from(iconSets.entries()).map(item => ({\n\t\t\t\t\tkey: item[0],\n\t\t\t\t\tvalue: item[0],\n\t\t\t\t\trenderer: this.iconItemRenderer\n\t\t\t\t}))}\"\n\t\t\t\t.value=\"${this.format.v as string}\"\n\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t</og-dropdown-list>\n\t\t</div>\n\n\t\t${this.format.v && iconSets.has(this.format.v as ConditionalFormatIconType) ? html`\n\t\t\t<div class=\"row\">${msg('Thresholds')}</div>\n\t\t\t<div style=\"display: flex; flex-direction: column; gap: 2px; margin-top: 2px\">\n\t\t\t\t${map(iconSets.get(this.format.v as ConditionalFormatIconType), (_icon, i) => html`\n\t\t\t\t\t<og-editor-rule-threshold\n\t\t\t\t\t\tclass=\"threshold\"\n\t\t\t\t\t\t.allowedTypes=\"${['num', 'percent']}\"\n\t\t\t\t\t\t.value=\"${this.format?.thresh[i]}\"\n\t\t\t\t\t\t?first=\"${i == 0}\"\n\t\t\t\t\t\t@change=\"${() => this.updateFormat()}\">\n\t\t\t\t\t</og-editor-rule-threshold>\n\t\t\t\t`)}\n\t\t\t</div>\n\t\t` : ''}\n\t`;\n\n\trender = () => choose(this.format?.type, [\n\t\t['formula', this.renderFormulaForm],\n\t\t['scale', this.renderScaleForm],\n\t\t['bar', this.renderBarForm],\n\t\t['icon', this.renderIconForm],\n\t])\n}\n"]}
|
|
@@ -14,6 +14,11 @@ export declare class ThemeEditor extends OmegaComponent {
|
|
|
14
14
|
updateList(type: ThemeItemType): void;
|
|
15
15
|
moveItemUp(index: number, type: ThemeItemType): void;
|
|
16
16
|
moveItemDown(index: number, type: ThemeItemType): void;
|
|
17
|
+
/**
|
|
18
|
+
* Notifies the host about any edit of the theme object. The theme is
|
|
19
|
+
* mutated in place, so this event is the only change signal the host gets.
|
|
20
|
+
*/
|
|
21
|
+
dispatchThemeChange(): void;
|
|
17
22
|
moveItem(fromIndex: number, toIndex: number, type: ThemeItemType): void;
|
|
18
23
|
deleteItem(index: number, type: ThemeItemType): void;
|
|
19
24
|
addItem(type: ThemeItemType): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeEditor.d.ts","sourceRoot":"","sources":["../../../src/ui/editors/themeEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAsB,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGnF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,aAAa,GAAG,MAAM,GAAC,SAAS,GAAC,OAAO,CAAC;AAE9C,qBACa,WAAY,SAAQ,cAAc;IAE9C,MAAM,CAAC,MAAM,iCAIV;IAGH,KAAK,EAAE,UAAU,CAAC;IAGlB,YAAY,EAAE,YAAY,CAAC;IAE3B,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,SAAS,CAAoD;IAErE,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAQtC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAInC,gBAAgB,GAAI,MAAM,aAAa,MAAM,KAAK,cAAc,EAAE,OAAO,MAAM,UAe9E;IAED,UAAU,CAAC,IAAI,EAAE,aAAa;IAM9B,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAK7C,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAK/C,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;
|
|
1
|
+
{"version":3,"file":"themeEditor.d.ts","sourceRoot":"","sources":["../../../src/ui/editors/themeEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAsB,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGnF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,KAAK,aAAa,GAAG,MAAM,GAAC,SAAS,GAAC,OAAO,CAAC;AAE9C,qBACa,WAAY,SAAQ,cAAc;IAE9C,MAAM,CAAC,MAAM,iCAIV;IAGH,KAAK,EAAE,UAAU,CAAC;IAGlB,YAAY,EAAE,YAAY,CAAC;IAE3B,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,SAAS,CAAoD;IAErE,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAQtC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAInC,gBAAgB,GAAI,MAAM,aAAa,MAAM,KAAK,cAAc,EAAE,OAAO,MAAM,UAe9E;IAED,UAAU,CAAC,IAAI,EAAE,aAAa;IAM9B,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAK7C,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAK/C;;;OAGG;IACH,mBAAmB;IAInB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAShE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAS7C,OAAO,CAAC,IAAI,EAAE,aAAa;IAS3B,eAAe,GAAI,IAAI,aAAa,kBAgBnC;IAED,MAAM,6CAuBJ;CAEF"}
|
|
@@ -96,6 +96,13 @@ let ThemeEditor = class ThemeEditor extends OmegaComponent {
|
|
|
96
96
|
return;
|
|
97
97
|
this.moveItem(index, index + 1, type);
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Notifies the host about any edit of the theme object. The theme is
|
|
101
|
+
* mutated in place, so this event is the only change signal the host gets.
|
|
102
|
+
*/
|
|
103
|
+
dispatchThemeChange() {
|
|
104
|
+
this.dispatchEvent(new CustomEvent('theme.change', { detail: { theme: this.theme }, bubbles: true, composed: true }));
|
|
105
|
+
}
|
|
99
106
|
moveItem(fromIndex, toIndex, type) {
|
|
100
107
|
const items = this.theme[type];
|
|
101
108
|
if (!this.theme[type])
|
|
@@ -103,6 +110,7 @@ let ThemeEditor = class ThemeEditor extends OmegaComponent {
|
|
|
103
110
|
const item = items.splice(fromIndex, 1)[0];
|
|
104
111
|
items.splice(toIndex, 0, item);
|
|
105
112
|
this.updateList(type);
|
|
113
|
+
this.dispatchThemeChange();
|
|
106
114
|
}
|
|
107
115
|
deleteItem(index, type) {
|
|
108
116
|
const items = this.theme[type];
|
|
@@ -111,6 +119,7 @@ let ThemeEditor = class ThemeEditor extends OmegaComponent {
|
|
|
111
119
|
items.splice(index, 1);
|
|
112
120
|
this.theme[type] = items;
|
|
113
121
|
this.updateList(type);
|
|
122
|
+
this.dispatchThemeChange();
|
|
114
123
|
}
|
|
115
124
|
addItem(type) {
|
|
116
125
|
const items = this.theme[type] ?? [];
|
|
@@ -118,6 +127,7 @@ let ThemeEditor = class ThemeEditor extends OmegaComponent {
|
|
|
118
127
|
this.theme[type] = items;
|
|
119
128
|
this.updateList(type);
|
|
120
129
|
this.lists[type].scrollToIndex(items.length - 1);
|
|
130
|
+
this.dispatchThemeChange();
|
|
121
131
|
}
|
|
122
132
|
};
|
|
123
133
|
ThemeEditor.styles = [OmegaComponent.styles, css `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeEditor.js","sourceRoot":"","sources":["../../../src/ui/editors/themeEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,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KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC5B,CAAC;IAED,OAAO,CAAC,IAAmB;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC5B,CAAC;;AA7FM,kBAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAA;;;;EAI1C,CAAC,AAJW,CAIV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0CACP;AAGlB;IADC,KAAK,CAAC,iBAAiB,CAAC;iDACE;AAZf,WAAW;IADvB,aAAa,CAAC,iBAAiB,CAAC;GACpB,WAAW,CA4IvB","sourcesContent":["import { customElement, property, query } from 'lit/decorators.js';\nimport { TableTheme } from '@omegagrid/grid';\nimport { css, html } from 'lit';\nimport { dom, ListSortEvent, OmegaComponent, SortableList } from '@omegagrid/core';\nimport { msg } from '@omegagrid/localize';\nimport { ThemeItemEditor } from './themeItemEditor';\nimport { TabContainer } from '@omegagrid/tabs';\n\ntype ThemeItemType = 'rows'|'columns'|'cells';\n\n@customElement('og-editor-theme')\nexport class ThemeEditor extends OmegaComponent {\n\n\tstatic styles = [OmegaComponent.styles, css`\n\t\t:host {\n\t\t\toverflow: hidden;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\ttheme: TableTheme;\n\n\t@query('og-tabcontainer')\n\ttabContainer: TabContainer;\n\n\tprivate lists: Partial<Record<ThemeItemType, SortableList>>;\n\tprivate listItems: Partial<Record<ThemeItemType, ThemeItemEditor[]>>;\n\n\twillUpdate(props: Map<string, unknown>) {\n\t\tthis.theme = this.theme || {name: ''};\n\t\tif (props.has('theme')) {\n\t\t\tthis.listItems = {};\n\t\t\tthis.lists = {};\n\t\t}\n\t}\n\n\tupdated(props: Map<string, unknown>) {\n\t\tif (props.has('theme')) this.tabContainer?.refresh();\n\t}\n\n\tcreateItemEditor = (type: ThemeItemType) => (div: HTMLDivElement, index: number) => {\n\t\tthis.listItems = this.listItems || {};\n\t\tthis.listItems[type] = this.listItems[type] || [];\n\t\tlet editor = this.listItems[type][index] ? this.listItems[type][index] : null;\n\t\tif (!editor) {\n\t\t\teditor = dom.createElement<ThemeItemEditor>('og-editor-themeitem', {\n\t\t\t\tindex: index,\n\t\t\t\tthemeItem: this.theme[type][index],\n\t\t\t\titemType: type,\n\t\t\t\teditor: this\n\t\t\t});\n\t\t\tthis.listItems[type][index] = editor;\n\t\t}\n\t\tdom.empty(div);\n\t\tdiv.appendChild(editor);\n\t}\n\n\tupdateList(type: ThemeItemType) {\n\t\tthis.listItems[type] = [];\n\t\tthis.lists[type].size = this.theme[type].length;\n\t\tthis.lists[type].renderItems(true);\n\t}\n\n\tmoveItemUp(index: number, type: ThemeItemType) {\n\t\tif (index === 0) return;\n\t\tthis.moveItem(index, index - 1, type);\n\t}\n\n\tmoveItemDown(index: number, type: ThemeItemType) {\n\t\tif (index >= this.listItems[type].length - 1) return;\n\t\tthis.moveItem(index, index + 1, type);\n\t}\n\n\t/**\n\t * Notifies the host about any edit of the theme object. The theme is\n\t * mutated in place, so this event is the only change signal the host gets.\n\t */\n\tdispatchThemeChange() {\n\t\tthis.dispatchEvent(new CustomEvent('theme.change', {detail: {theme: this.theme}, bubbles: true, composed: true}));\n\t}\n\n\tmoveItem(fromIndex: number, toIndex: number, type: ThemeItemType) {\n\t\tconst items = this.theme[type];\n\t\tif (!this.theme[type]) return;\n\t\tconst item = items.splice(fromIndex, 1)[0];\n\t\titems.splice(toIndex, 0, item);\n\t\tthis.updateList(type);\n\t\tthis.dispatchThemeChange();\n\t}\n\n\tdeleteItem(index: number, type: ThemeItemType) {\n\t\tconst items = this.theme[type];\n\t\tif (!this.theme[type]) return;\n\t\titems.splice(index, 1);\n\t\tthis.theme[type] = items;\n\t\tthis.updateList(type);\n\t\tthis.dispatchThemeChange();\n\t}\n\n\taddItem(type: ThemeItemType) {\n\t\tconst items = this.theme[type] ?? [];\n\t\titems.push({});\n\t\tthis.theme[type] = items;\n\t\tthis.updateList(type);\n\t\tthis.lists[type].scrollToIndex(items.length - 1);\n\t\tthis.dispatchThemeChange();\n\t}\n\n\tcreateComponent = (id: ThemeItemType) => {\n\t\tthis.lists = this.lists || {};\n\t\tif (this.lists[id]) return this.lists[id];\n\t\tconst list = dom.createElement<SortableList>('og-sortablelist');\n\t\tlist.style.height = '100%';\n\t\tlist.style.overflow = 'hidden';\n\t\tlist.scrollbarPadding = true;\n\t\tlist.disabledSelect = true;\n\t\tlist.customHandle = true;\n\t\tlist.dynamicItemHeight = true;\n\t\tlist.nativeHeight = true;\n\t\tlist.size = this.theme && this.theme[id] ? this.theme[id].length : 0;\n\t\tlist.itemRenderer = this.createItemEditor(id);\n\t\tlist.addEventListener('list.sort', (e: ListSortEvent) => this.moveItem(e.fromIndex, e.toIndex, id));\n\t\tthis.lists[id] = list;\n\t\treturn list;\n\t}\n\n\trender = () => html`\n\t\t<div style=\"display: flex; flex-direction: column; height: 100%\">\n\t\t\t<div style=\"flex: 1; overflow: hidden\">\n\t\t\t\t<og-tabcontainer \n\t\t\t\t\tfixed\n\t\t\t\t\tstyle=\"height: 100%\"\n\t\t\t\t\t.createComponent=\"${this.createComponent}\"\n\t\t\t\t\t.items=\"${[\n\t\t\t\t\t\t{id: 'rows', title: msg('Rows')},\n\t\t\t\t\t\t{id: 'columns', title: msg('Columns')},\n\t\t\t\t\t\t{id: 'cells', title: msg('Cells')}\n\t\t\t\t\t]}\">\n\t\t\t\t</og-tabcontainer>\n\t\t\t</div>\n\t\t\t\n\t\t\t<div style=\"flex: 0; padding-top: 5px\">\n\t\t\t\t<og-button\n\t\t\t\t\t@click=\"${() => this.addItem(this.tabContainer.selectedId as ThemeItemType)}\"\n\t\t\t\t\ticon=\"plus\"\n\t\t\t\t\tstyle=\"width: 100%\">\n\t\t\t\t</og-button>\n\t\t\t</div>\n\t\t</div>\n\t`;\n\n}"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConditionalFormatType, Style, ThemeColumnItem, ThemeRowItem } from '@omegagrid/grid';
|
|
1
|
+
import { ConditionalFormatType, MatchItem, Style, ThemeColumnItem, ThemeRowItem } from '@omegagrid/grid';
|
|
2
2
|
import { events, OmegaComponent } from '@omegagrid/core';
|
|
3
3
|
import { RuleEditor } from './ruleEditor';
|
|
4
4
|
import { StyleEditor } from './styleEditor';
|
|
@@ -16,6 +16,20 @@ export declare class ThemeItemEditor extends OmegaComponent {
|
|
|
16
16
|
willUpdate(): void;
|
|
17
17
|
updateRuleType(type: ConditionalFormatType): void;
|
|
18
18
|
_onStyleChange: (e: events.ChangeEvent<Style>) => void;
|
|
19
|
+
_dispatchChange: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Conditions of the item as a list of match items. The legacy root matchers
|
|
22
|
+
* are shown converted with their original semantics (index wins over level,
|
|
23
|
+
* the name filters on top) and become themeItem.matches on the first edit.
|
|
24
|
+
*/
|
|
25
|
+
getMatchItems(): MatchItem[];
|
|
26
|
+
private commitMatchItems;
|
|
27
|
+
addCondition(property: string): void;
|
|
28
|
+
removeCondition(index: number): void;
|
|
29
|
+
/** comma-separated input = OR of the values; an empty input removes the condition */
|
|
30
|
+
_onConditionChange(index: number, raw: string): void;
|
|
31
|
+
private formatConditionValue;
|
|
32
|
+
_onSizeChange: (e: events.ChangeEvent<number>) => void;
|
|
19
33
|
render: () => import("lit-html").TemplateResult<1>;
|
|
20
34
|
}
|
|
21
35
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeItemEditor.d.ts","sourceRoot":"","sources":["../../../src/ui/editors/themeItemEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,eAAe,EAAa,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"themeItemEditor.d.ts","sourceRoot":"","sources":["../../../src/ui/editors/themeItemEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAc,KAAK,EAAE,eAAe,EAAa,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhI,OAAO,EAAE,MAAM,EAAY,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGnE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,KAAK,aAAa,GAAG,MAAM,GAAC,SAAS,GAAC,OAAO,CAAC;AAa9C,qBACa,eAAgB,SAAQ,cAAc;IAGlD,KAAK,EAAE,MAAM,CAAC;IAGd,SAAS,EAAE,eAAe,GAAG,YAAY,CAAC;IAG1C,QAAQ,EAAE,aAAa,CAAC;IAGxB,MAAM,EAAE,WAAW,CAAC;IAGpB,UAAU,EAAE,WAAW,CAAC;IAGxB,UAAU,EAAE,UAAU,CAAC;IAGvB,WAAW,EAAE,WAAW,CAAC;IAEzB,MAAM,CAAC,MAAM,iCAuDV;IAEH,UAAU;IAKV,cAAc,CAAC,IAAI,EAAE,qBAAqB;IAS1C,cAAc,GAAI,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,UAG7C;IAED,eAAe,aAEd;IAED;;;;OAIG;IACH,aAAa,IAAI,SAAS,EAAE;IAW5B,OAAO,CAAC,gBAAgB;IASxB,YAAY,CAAC,QAAQ,EAAE,MAAM;IAI7B,eAAe,CAAC,KAAK,EAAE,MAAM;IAI7B,qFAAqF;IACrF,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAe7C,OAAO,CAAC,oBAAoB;IAK5B,aAAa,GAAI,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,UAK7C;IAED,MAAM,6CAkGJ;CACF"}
|
|
@@ -8,6 +8,7 @@ import { customElement, property, query } from 'lit/decorators.js';
|
|
|
8
8
|
import { css, html } from 'lit';
|
|
9
9
|
import { OmegaComponent } from '@omegagrid/core';
|
|
10
10
|
import { msg } from '@omegagrid/localize';
|
|
11
|
+
import { map } from 'lit-html/directives/map.js';
|
|
11
12
|
const ruleTypes = [
|
|
12
13
|
{ key: null, value: 'Static style' },
|
|
13
14
|
{ key: 'formula', value: 'Formula' },
|
|
@@ -15,11 +16,25 @@ const ruleTypes = [
|
|
|
15
16
|
{ key: 'bar', value: 'Data Bar' },
|
|
16
17
|
{ key: 'icon', value: 'Icon Set' },
|
|
17
18
|
];
|
|
19
|
+
/** node properties offered by the add-condition dropdown */
|
|
20
|
+
const matchProperties = ['name', 'level', 'index'];
|
|
18
21
|
let ThemeItemEditor = class ThemeItemEditor extends OmegaComponent {
|
|
19
22
|
constructor() {
|
|
20
23
|
super(...arguments);
|
|
21
24
|
this._onStyleChange = (e) => {
|
|
22
25
|
this.themeItem.style = e.value;
|
|
26
|
+
this._dispatchChange();
|
|
27
|
+
};
|
|
28
|
+
this._dispatchChange = () => {
|
|
29
|
+
this.editor?.dispatchThemeChange();
|
|
30
|
+
};
|
|
31
|
+
this._onSizeChange = (e) => {
|
|
32
|
+
const key = this.itemType == 'rows' ? 'height' : 'width';
|
|
33
|
+
if (e.value == null || e.value === '')
|
|
34
|
+
delete this.themeItem[key];
|
|
35
|
+
else
|
|
36
|
+
this.themeItem[key] = Number(e.value);
|
|
37
|
+
this._dispatchChange();
|
|
23
38
|
};
|
|
24
39
|
this.render = () => html `
|
|
25
40
|
<div class="header">
|
|
@@ -54,18 +69,45 @@ let ThemeItemEditor = class ThemeItemEditor extends OmegaComponent {
|
|
|
54
69
|
</div>
|
|
55
70
|
|
|
56
71
|
${this.itemType != 'cells' ? html `
|
|
57
|
-
<div class="row"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
<div class="row section">
|
|
73
|
+
<div>${msg('Conditions')}</div>
|
|
74
|
+
<og-dropdown-menu
|
|
75
|
+
noCaret
|
|
76
|
+
dynamicWidth
|
|
77
|
+
alignment="right"
|
|
78
|
+
color="transparent"
|
|
79
|
+
.items="${matchProperties.map(property => ({
|
|
80
|
+
key: property,
|
|
81
|
+
value: msg(property.charAt(0).toUpperCase() + property.slice(1)),
|
|
82
|
+
exec: () => this.addCondition(property)
|
|
83
|
+
}))}">
|
|
84
|
+
<div slot="label"><og-icon icon="plus"></og-icon></div>
|
|
85
|
+
</og-dropdown-menu>
|
|
64
86
|
</div>
|
|
65
87
|
|
|
88
|
+
${map(this.getMatchItems(), (match, i) => html `
|
|
89
|
+
<div class="row">
|
|
90
|
+
<label>${msg(match.property.charAt(0).toUpperCase() + match.property.slice(1))}</label>
|
|
91
|
+
<og-input
|
|
92
|
+
style="text-align: left"
|
|
93
|
+
.value="${this.formatConditionValue(match.value)}"
|
|
94
|
+
@change="${(e) => this._onConditionChange(i, e.value)}">
|
|
95
|
+
</og-input>
|
|
96
|
+
<og-button
|
|
97
|
+
icon="trash"
|
|
98
|
+
color="transparent"
|
|
99
|
+
style="flex: 0 0 20px; color: red"
|
|
100
|
+
@click="${() => this.removeCondition(i)}">
|
|
101
|
+
</og-button>
|
|
102
|
+
</div>
|
|
103
|
+
`)}
|
|
104
|
+
|
|
66
105
|
<div class="row">
|
|
67
|
-
<label>${msg('
|
|
68
|
-
<og-
|
|
106
|
+
<label>${msg(this.itemType == 'rows' ? 'Height' : 'Width')}</label>
|
|
107
|
+
<og-numericinput buttons min="0"
|
|
108
|
+
.value="${this.itemType == 'rows' ? this.themeItem?.height : this.themeItem?.width}"
|
|
109
|
+
@change="${this._onSizeChange}">
|
|
110
|
+
</og-numericinput>
|
|
69
111
|
</div>
|
|
70
112
|
` : ''}
|
|
71
113
|
|
|
@@ -75,14 +117,15 @@ let ThemeItemEditor = class ThemeItemEditor extends OmegaComponent {
|
|
|
75
117
|
<og-dropdown-list
|
|
76
118
|
.value = "${this.themeItem?.type ?? null}"
|
|
77
119
|
.items="${ruleTypes}"
|
|
78
|
-
@change="${(e) => this.updateRuleType(e.value)}">
|
|
120
|
+
@change="${(e) => { this.updateRuleType(e.value); this._dispatchChange(); }}">
|
|
79
121
|
</og-dropdown-list>
|
|
80
122
|
</div>
|
|
81
123
|
|
|
82
124
|
<div>
|
|
83
125
|
${this.themeItem?.type ? html `
|
|
84
126
|
<og-editor-ruleeditor
|
|
85
|
-
.format="${this.themeItem}"
|
|
127
|
+
.format="${this.themeItem}"
|
|
128
|
+
@change="${this._dispatchChange}">
|
|
86
129
|
</og-editor-ruleeditor>
|
|
87
130
|
` : html `
|
|
88
131
|
<og-editor-styleeditor
|
|
@@ -106,6 +149,55 @@ let ThemeItemEditor = class ThemeItemEditor extends OmegaComponent {
|
|
|
106
149
|
this.requestUpdate();
|
|
107
150
|
this.ruleEditor?.requestUpdate();
|
|
108
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Conditions of the item as a list of match items. The legacy root matchers
|
|
154
|
+
* are shown converted with their original semantics (index wins over level,
|
|
155
|
+
* the name filters on top) and become themeItem.matches on the first edit.
|
|
156
|
+
*/
|
|
157
|
+
getMatchItems() {
|
|
158
|
+
const item = this.themeItem;
|
|
159
|
+
if (item.matches)
|
|
160
|
+
return Array.isArray(item.matches) ? item.matches : [item.matches];
|
|
161
|
+
const items = [];
|
|
162
|
+
if (item.index > -1)
|
|
163
|
+
items.push({ property: 'index', value: item.index });
|
|
164
|
+
else if (item.level > -1)
|
|
165
|
+
items.push({ property: 'level', value: item.level });
|
|
166
|
+
if (item.name)
|
|
167
|
+
items.push({ property: 'name', value: item.name });
|
|
168
|
+
return items;
|
|
169
|
+
}
|
|
170
|
+
commitMatchItems(items) {
|
|
171
|
+
this.themeItem.matches = items;
|
|
172
|
+
delete this.themeItem.name;
|
|
173
|
+
delete this.themeItem.level;
|
|
174
|
+
delete this.themeItem.index;
|
|
175
|
+
this._dispatchChange();
|
|
176
|
+
this.requestUpdate();
|
|
177
|
+
}
|
|
178
|
+
addCondition(property) {
|
|
179
|
+
this.commitMatchItems([...this.getMatchItems(), { property, value: property == 'name' ? '' : 0 }]);
|
|
180
|
+
}
|
|
181
|
+
removeCondition(index) {
|
|
182
|
+
this.commitMatchItems(this.getMatchItems().filter((_, i) => i != index));
|
|
183
|
+
}
|
|
184
|
+
/** comma-separated input = OR of the values; an empty input removes the condition */
|
|
185
|
+
_onConditionChange(index, raw) {
|
|
186
|
+
const items = [...this.getMatchItems()];
|
|
187
|
+
const property = items[index].property;
|
|
188
|
+
const parts = String(raw ?? '').split(',').map(part => part.trim()).filter(part => part !== '');
|
|
189
|
+
const values = property == 'name' ? parts : parts.map(Number).filter(value => !isNaN(value));
|
|
190
|
+
if (!values.length) {
|
|
191
|
+
this.removeCondition(index);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
items[index] = { property, value: values.length == 1 ? values[0] : values };
|
|
195
|
+
this.commitMatchItems(items);
|
|
196
|
+
}
|
|
197
|
+
formatConditionValue(value) {
|
|
198
|
+
const format = (item) => item instanceof RegExp ? `/${item.source}/` : String(item ?? '');
|
|
199
|
+
return Array.isArray(value) ? value.map(format).join(', ') : format(value);
|
|
200
|
+
}
|
|
109
201
|
};
|
|
110
202
|
ThemeItemEditor.styles = [OmegaComponent.styles, css `
|
|
111
203
|
:host {
|
|
@@ -152,6 +244,16 @@ ThemeItemEditor.styles = [OmegaComponent.styles, css `
|
|
|
152
244
|
display: flex;
|
|
153
245
|
flex-direction: row;
|
|
154
246
|
}
|
|
247
|
+
|
|
248
|
+
.section {
|
|
249
|
+
display: flex;
|
|
250
|
+
flex-direction: row;
|
|
251
|
+
align-items: center;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.section > div {
|
|
255
|
+
flex: 1;
|
|
256
|
+
}
|
|
155
257
|
`];
|
|
156
258
|
__decorate([
|
|
157
259
|
property({ type: Number })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeItemEditor.js","sourceRoot":"","sources":["../../../src/ui/editors/themeItemEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAoB,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAO1C,MAAM,SAAS,GAAe;IAC7B,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAC;IAClC,EAAC,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAC;IAClC,EAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;IAC9B,EAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAC;IAC/B,EAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC;CAChC,CAAC;AAGK,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,cAAc;IAA5C;;QAoFN,mBAAc,GAAG,CAAC,CAA4B,EAAE,EAAE;YACjD,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;QAChC,CAAC,CAAA;QAED,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;;8CAE0B,GAAG,CAAC,MAAM,CAAC,KAA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AAK,CAAC,sBAAsB,CAAC;mDACP;AAGvB;IADC,KAAK,CAAC,uBAAuB,CAAC;oDACN;AArBb,eAAe;IAD3B,aAAa,CAAC,qBAAqB,CAAC;GACxB,eAAe,CA+J3B","sourcesContent":["import { customElement, property, query } from 'lit/decorators.js';\nimport { ConditionalFormatType, Style, ThemeColumnItem, ThemeItem, ThemeRowItem } from '@omegagrid/grid';\nimport { css, html } from 'lit';\nimport { events, MenuItem, OmegaComponent } from '@omegagrid/core';\nimport { msg } from '@omegagrid/localize';\nimport { RuleEditor } from './ruleEditor';\nimport { StyleEditor } from './styleEditor';\nimport { ThemeEditor } from './themeEditor';\n\ntype ThemeItemType = 'rows'|'columns'|'cells';\n\nconst ruleTypes: MenuItem[] = [\n\t{key: null, value: 'Static style'},\n\t{key: 'formula', value: 'Formula'},\n\t{key: 'scale', value: 'Scale'},\n\t{key: 'bar', value: 'Data Bar'},\n\t{key: 'icon', value: 'Icon Set'},\n];\n\n@customElement('og-editor-themeitem')\nexport class ThemeItemEditor extends OmegaComponent {\n\t\n\t@property({type: Number})\n\tindex: number;\n\n\t@property({type: Object})\n\tthemeItem: ThemeColumnItem & ThemeRowItem;\n\n\t@property({type: String})\n\titemType: ThemeItemType;\n\n\t@property({type: Object})\n\teditor: ThemeEditor;\n\n\t@query('.move-handle')\n\tmoveHandle: HTMLElement;\n\n\t@query('og-editor-ruleeditor')\n\truleEditor: RuleEditor;\n\n\t@query('og-editor-styleeditor')\n\tstyleEditor: StyleEditor;\n\n\tstatic styles = [OmegaComponent.styles, css`\n\t\t:host {\n\t\t\tline-height: 22px;\n\t\t}\n\n\t\t.row {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\tmargin: 2px 0;\n\t\t\talign-items: center;\n\t\t}\n\n\t\tlabel {\n\t\t\tflex: 0 60px;\n\t\t\ttext-align: right;\n\t\t\tmargin-right: 10px;\n\t\t}\n\n\t\tog-dropdown-list, og-dropdown-menu, og-editor-ruleeditor {\n\t\t\tline-height: 16px;\n\t\t}\n\n\t\tog-numericinput, og-input {\n\t\t\tflex: 1;\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tline-height: 20px;\n\t\t\ttext-align: center;\n\t\t}\n\n\t\t.move-handle {\n\t\t\tcursor: move;\n\t\t}\n\n\t\tog-dropdown-list {\n\t\t\tflex: 1;\n\t\t}\n\n\t\t.header {\n\t\t\tpadding-left: 5px;\n\t\t\tborder-top: 1px solid var(--og-border-color);\n\t\t\tborder-bottom: 1px solid var(--og-border-color);\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t}\n\t`];\n\n\twillUpdate() {\n\t\tthis.themeItem = this.themeItem || {} as ThemeItem;\n\t\tthis.updateRuleType(this.themeItem.type);\n\t}\n\n\tupdateRuleType(type: ConditionalFormatType) {\n\t\tthis.themeItem.type = type;\n\t\tif (type) delete this.themeItem.style;\n\t\telse this.themeItem.style = this.themeItem.style || {} as Style;\n\n\t\tthis.requestUpdate();\n\t\tthis.ruleEditor?.requestUpdate();\n\t}\n\n\t_onStyleChange = (e: events.ChangeEvent<Style>) => {\n\t\tthis.themeItem.style = e.value;\n\t}\n\n\trender = () => html`\n\t\t<div class=\"header\">\n\t\t\t<div style=\"flex: 1\" class=\"move-handle\">${msg('Rule')} #${this.index + 1}</div>\n\n\t\t\t<div>\n\t\t\t\t<og-dropdown-menu\n\t\t\t\t\tnoCaret\n\t\t\t\t\tdynamicWidth\n\t\t\t\t\talignment=\"right\"\n\t\t\t\t\tcolor=\"transparent\"\n\t\t\t\t\t.items=\"${[{\n\t\t\t\t\t\tkey: 'moveUp',\n\t\t\t\t\t\tvalue: msg('Move up'),\n\t\t\t\t\t\ticon: 'arrow-up',\n\t\t\t\t\t\texec: () => this.editor.moveItemUp(this.index, this.itemType)\n\t\t\t\t\t}, {\n\t\t\t\t\t\tkey: 'moveDown',\n\t\t\t\t\t\tvalue: msg('Move down'),\n\t\t\t\t\t\ticon: 'arrow-down',\n\t\t\t\t\t\texec: () => this.editor.moveItemDown(this.index, this.itemType)\n\t\t\t\t\t}, {\n\t\t\t\t\t\tkey: 'delete',\n\t\t\t\t\t\tvalue: msg('Delete'),\n\t\t\t\t\t\ticon: 'trash',\n\t\t\t\t\t\tcolor: 'red',\n\t\t\t\t\t\texec: () => this.editor.deleteItem(this.index, this.itemType)\n\t\t\t\t\t}]}\">\n\t\t\t\t\t<div slot=\"label\"><og-icon icon=\"ellipsis\"></og-icon></div>\n\t\t\t\t</og-dropdown-menu>\n\t\t\t</div>\n\t\t</div>\n\n\t\t${this.itemType != 'cells' ? html`\n\t\t\t<div class=\"row\">${msg('Conditions')}</div>\n\n\t\t\t<div class=\"row\">\n\t\t\t\t<label>${msg('Level')}</label>\n\t\t\t\t<og-numericinput buttons min=\"0\" .value=\"${this.themeItem?.level}\"></og-numericinput>\n\t\t\t\t<label>${msg('Index')}</label>\n\t\t\t\t<og-numericinput buttons min=\"0\" .value=\"${this.themeItem?.index}\"></og-numericinput>\n\t\t\t</div>\n\n\t\t\t<div class=\"row\">\n\t\t\t\t<label>${msg('Name')}</label>\n\t\t\t\t<og-input></og-input>\n\t\t\t</div>\n\t\t` : ''}\n\n\t\t<div class=\"row\">${msg('Style definition')}</div>\n\n\t\t<div class=\"row\">\n\t\t\t<og-dropdown-list\n\t\t\t\t.value = \"${this.themeItem?.type ?? null}\"\n\t\t\t\t.items=\"${ruleTypes}\"\n\t\t\t\t@change=\"${(e: events.ChangeEvent<ConditionalFormatType>) => this.updateRuleType(e.value)}\">\n\t\t\t</og-dropdown-list>\n\t\t</div>\n\n\t\t<div>\n\t\t\t${this.themeItem?.type ? html`\n\t\t\t\t<og-editor-ruleeditor \n\t\t\t\t\t.format=\"${this.themeItem}\">\n\t\t\t\t</og-editor-ruleeditor>\n\t\t\t`: html`\n\t\t\t\t<og-editor-styleeditor \n\t\t\t\t\t@change=\"${this._onStyleChange}\"\n\t\t\t\t\t.data=\"${this.themeItem.style}\">\n\t\t\t\t</og-editor-styleeditor>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,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QACtG,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC;;AApIM,sBAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuD1C,CAAC,AAvDW,CAuDV;AA3EH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;8CACX;AAGd;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDACiB;AAG1C;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;iDACD;AAGxB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;+CACL;AAGpB;IADC,KAAK,CAAC,cAAc,CAAC;mDACE;AAGxB;IADC,KAAK,CAAC,sBAAsB,CAAC;mDACP;AAGvB;IADC,KAAK,CAAC,uBAAuB,CAAC;oDACN;AArBb,eAAe;IAD3B,aAAa,CAAC,qBAAqB,CAAC;GACxB,eAAe,CAuQ3B","sourcesContent":["import { customElement, property, query } from 'lit/decorators.js';\nimport { ConditionalFormatType, MatchItem, MatchValue, Style, ThemeColumnItem, ThemeItem, ThemeRowItem } from '@omegagrid/grid';\nimport { css, html } from 'lit';\nimport { events, MenuItem, OmegaComponent } from '@omegagrid/core';\nimport { msg } from '@omegagrid/localize';\nimport { map } from 'lit-html/directives/map.js';\nimport { RuleEditor } from './ruleEditor';\nimport { StyleEditor } from './styleEditor';\nimport { ThemeEditor } from './themeEditor';\n\ntype ThemeItemType = 'rows'|'columns'|'cells';\n\nconst ruleTypes: MenuItem[] = [\n\t{key: null, value: 'Static style'},\n\t{key: 'formula', value: 'Formula'},\n\t{key: 'scale', value: 'Scale'},\n\t{key: 'bar', value: 'Data Bar'},\n\t{key: 'icon', value: 'Icon Set'},\n];\n\n/** node properties offered by the add-condition dropdown */\nconst matchProperties = ['name', 'level', 'index'];\n\n@customElement('og-editor-themeitem')\nexport class ThemeItemEditor extends OmegaComponent {\n\t\n\t@property({type: Number})\n\tindex: number;\n\n\t@property({type: Object})\n\tthemeItem: ThemeColumnItem & ThemeRowItem;\n\n\t@property({type: String})\n\titemType: ThemeItemType;\n\n\t@property({type: Object})\n\teditor: ThemeEditor;\n\n\t@query('.move-handle')\n\tmoveHandle: HTMLElement;\n\n\t@query('og-editor-ruleeditor')\n\truleEditor: RuleEditor;\n\n\t@query('og-editor-styleeditor')\n\tstyleEditor: StyleEditor;\n\n\tstatic styles = [OmegaComponent.styles, css`\n\t\t:host {\n\t\t\tline-height: 22px;\n\t\t}\n\n\t\t.row {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\tmargin: 2px 0;\n\t\t\talign-items: center;\n\t\t}\n\n\t\tlabel {\n\t\t\tflex: 0 60px;\n\t\t\ttext-align: right;\n\t\t\tmargin-right: 10px;\n\t\t}\n\n\t\tog-dropdown-list, og-dropdown-menu, og-editor-ruleeditor {\n\t\t\tline-height: 16px;\n\t\t}\n\n\t\tog-numericinput, og-input {\n\t\t\tflex: 1;\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tline-height: 20px;\n\t\t\ttext-align: center;\n\t\t}\n\n\t\t.move-handle {\n\t\t\tcursor: move;\n\t\t}\n\n\t\tog-dropdown-list {\n\t\t\tflex: 1;\n\t\t}\n\n\t\t.header {\n\t\t\tpadding-left: 5px;\n\t\t\tborder-top: 1px solid var(--og-border-color);\n\t\t\tborder-bottom: 1px solid var(--og-border-color);\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t}\n\n\t\t.section {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\talign-items: center;\n\t\t}\n\n\t\t.section > div {\n\t\t\tflex: 1;\n\t\t}\n\t`];\n\n\twillUpdate() {\n\t\tthis.themeItem = this.themeItem || {} as ThemeItem;\n\t\tthis.updateRuleType(this.themeItem.type);\n\t}\n\n\tupdateRuleType(type: ConditionalFormatType) {\n\t\tthis.themeItem.type = type;\n\t\tif (type) delete this.themeItem.style;\n\t\telse this.themeItem.style = this.themeItem.style || {} as Style;\n\n\t\tthis.requestUpdate();\n\t\tthis.ruleEditor?.requestUpdate();\n\t}\n\n\t_onStyleChange = (e: events.ChangeEvent<Style>) => {\n\t\tthis.themeItem.style = e.value;\n\t\tthis._dispatchChange();\n\t}\n\n\t_dispatchChange = () => {\n\t\tthis.editor?.dispatchThemeChange();\n\t}\n\n\t/**\n\t * Conditions of the item as a list of match items. The legacy root matchers\n\t * are shown converted with their original semantics (index wins over level,\n\t * the name filters on top) and become themeItem.matches on the first edit.\n\t */\n\tgetMatchItems(): MatchItem[] {\n\t\tconst item = this.themeItem;\n\t\tif (item.matches) return Array.isArray(item.matches) ? item.matches : [item.matches];\n\n\t\tconst items: MatchItem[] = [];\n\t\tif (item.index > -1) items.push({property: 'index', value: item.index});\n\t\telse if (item.level > -1) items.push({property: 'level', value: item.level});\n\t\tif (item.name) items.push({property: 'name', value: item.name as MatchValue});\n\t\treturn items;\n\t}\n\n\tprivate commitMatchItems(items: MatchItem[]) {\n\t\tthis.themeItem.matches = items;\n\t\tdelete this.themeItem.name;\n\t\tdelete this.themeItem.level;\n\t\tdelete this.themeItem.index;\n\t\tthis._dispatchChange();\n\t\tthis.requestUpdate();\n\t}\n\n\taddCondition(property: string) {\n\t\tthis.commitMatchItems([...this.getMatchItems(), {property, value: property == 'name' ? '' : 0}]);\n\t}\n\n\tremoveCondition(index: number) {\n\t\tthis.commitMatchItems(this.getMatchItems().filter((_, i) => i != index));\n\t}\n\n\t/** comma-separated input = OR of the values; an empty input removes the condition */\n\t_onConditionChange(index: number, raw: string) {\n\t\tconst items = [...this.getMatchItems()];\n\t\tconst property = items[index].property;\n\t\tconst parts = String(raw ?? '').split(',').map(part => part.trim()).filter(part => part !== '');\n\t\tconst values = property == 'name' ? parts : parts.map(Number).filter(value => !isNaN(value));\n\n\t\tif (!values.length) {\n\t\t\tthis.removeCondition(index);\n\t\t\treturn;\n\t\t}\n\n\t\titems[index] = {property, value: values.length == 1 ? values[0] : values};\n\t\tthis.commitMatchItems(items);\n\t}\n\n\tprivate formatConditionValue(value: MatchValue|MatchValue[]): string {\n\t\tconst format = (item: MatchValue) => item instanceof RegExp ? `/${item.source}/` : String(item ?? '');\n\t\treturn Array.isArray(value) ? value.map(format).join(', ') : format(value);\n\t}\n\n\t_onSizeChange = (e: events.ChangeEvent<number>) => {\n\t\tconst key = this.itemType == 'rows' ? 'height' : 'width';\n\t\tif (e.value == null || e.value as unknown === '') delete this.themeItem[key];\n\t\telse this.themeItem[key] = Number(e.value);\n\t\tthis._dispatchChange();\n\t}\n\n\trender = () => html`\n\t\t<div class=\"header\">\n\t\t\t<div style=\"flex: 1\" class=\"move-handle\">${msg('Rule')} #${this.index + 1}</div>\n\n\t\t\t<div>\n\t\t\t\t<og-dropdown-menu\n\t\t\t\t\tnoCaret\n\t\t\t\t\tdynamicWidth\n\t\t\t\t\talignment=\"right\"\n\t\t\t\t\tcolor=\"transparent\"\n\t\t\t\t\t.items=\"${[{\n\t\t\t\t\t\tkey: 'moveUp',\n\t\t\t\t\t\tvalue: msg('Move up'),\n\t\t\t\t\t\ticon: 'arrow-up',\n\t\t\t\t\t\texec: () => this.editor.moveItemUp(this.index, this.itemType)\n\t\t\t\t\t}, {\n\t\t\t\t\t\tkey: 'moveDown',\n\t\t\t\t\t\tvalue: msg('Move down'),\n\t\t\t\t\t\ticon: 'arrow-down',\n\t\t\t\t\t\texec: () => this.editor.moveItemDown(this.index, this.itemType)\n\t\t\t\t\t}, {\n\t\t\t\t\t\tkey: 'delete',\n\t\t\t\t\t\tvalue: msg('Delete'),\n\t\t\t\t\t\ticon: 'trash',\n\t\t\t\t\t\tcolor: 'red',\n\t\t\t\t\t\texec: () => this.editor.deleteItem(this.index, this.itemType)\n\t\t\t\t\t}]}\">\n\t\t\t\t\t<div slot=\"label\"><og-icon icon=\"ellipsis\"></og-icon></div>\n\t\t\t\t</og-dropdown-menu>\n\t\t\t</div>\n\t\t</div>\n\n\t\t${this.itemType != 'cells' ? html`\n\t\t\t<div class=\"row section\">\n\t\t\t\t<div>${msg('Conditions')}</div>\n\t\t\t\t<og-dropdown-menu\n\t\t\t\t\tnoCaret\n\t\t\t\t\tdynamicWidth\n\t\t\t\t\talignment=\"right\"\n\t\t\t\t\tcolor=\"transparent\"\n\t\t\t\t\t.items=\"${matchProperties.map(property => ({\n\t\t\t\t\t\tkey: property,\n\t\t\t\t\t\tvalue: msg(property.charAt(0).toUpperCase() + property.slice(1)),\n\t\t\t\t\t\texec: () => this.addCondition(property)\n\t\t\t\t\t}))}\">\n\t\t\t\t\t<div slot=\"label\"><og-icon icon=\"plus\"></og-icon></div>\n\t\t\t\t</og-dropdown-menu>\n\t\t\t</div>\n\n\t\t\t${map(this.getMatchItems(), (match, i) => html`\n\t\t\t\t<div class=\"row\">\n\t\t\t\t\t<label>${msg(match.property.charAt(0).toUpperCase() + match.property.slice(1))}</label>\n\t\t\t\t\t<og-input\n\t\t\t\t\t\tstyle=\"text-align: left\"\n\t\t\t\t\t\t.value=\"${this.formatConditionValue(match.value)}\"\n\t\t\t\t\t\t@change=\"${(e: events.ChangeEvent<string>) => this._onConditionChange(i, e.value)}\">\n\t\t\t\t\t</og-input>\n\t\t\t\t\t<og-button\n\t\t\t\t\t\ticon=\"trash\"\n\t\t\t\t\t\tcolor=\"transparent\"\n\t\t\t\t\t\tstyle=\"flex: 0 0 20px; color: red\"\n\t\t\t\t\t\t@click=\"${() => this.removeCondition(i)}\">\n\t\t\t\t\t</og-button>\n\t\t\t\t</div>\n\t\t\t`)}\n\n\t\t\t<div class=\"row\">\n\t\t\t\t<label>${msg(this.itemType == 'rows' ? 'Height' : 'Width')}</label>\n\t\t\t\t<og-numericinput buttons min=\"0\"\n\t\t\t\t\t.value=\"${this.itemType == 'rows' ? this.themeItem?.height : this.themeItem?.width}\"\n\t\t\t\t\t@change=\"${this._onSizeChange}\">\n\t\t\t\t</og-numericinput>\n\t\t\t</div>\n\t\t` : ''}\n\n\t\t<div class=\"row\">${msg('Style definition')}</div>\n\n\t\t<div class=\"row\">\n\t\t\t<og-dropdown-list\n\t\t\t\t.value = \"${this.themeItem?.type ?? null}\"\n\t\t\t\t.items=\"${ruleTypes}\"\n\t\t\t\t@change=\"${(e: events.ChangeEvent<ConditionalFormatType>) => { this.updateRuleType(e.value); this._dispatchChange(); }}\">\n\t\t\t</og-dropdown-list>\n\t\t</div>\n\n\t\t<div>\n\t\t\t${this.themeItem?.type ? html`\n\t\t\t\t<og-editor-ruleeditor \n\t\t\t\t\t.format=\"${this.themeItem}\"\n\t\t\t\t\t@change=\"${this._dispatchChange}\">\n\t\t\t\t</og-editor-ruleeditor>\n\t\t\t`: html`\n\t\t\t\t<og-editor-styleeditor \n\t\t\t\t\t@change=\"${this._onStyleChange}\"\n\t\t\t\t\t.data=\"${this.themeItem.style}\">\n\t\t\t\t</og-editor-styleeditor>\n\t\t\t`}\n\t\t</div>\n\t`;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeEditorSidebar.d.ts","sourceRoot":"","sources":["../../../src/ui/sidebars/themeEditorSidebar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,qBACa,kBAAmB,SAAQ,WAAW;IAElD,MAAM,CAAC,MAAM,+DA6BV;IAGH,SAAS,EAAE,YAAY,CAAC;IAGxB,KAAK,EAAE,UAAU,CAAC;IAElB,UAAU;IAMV,OAAO;IAaP,QAAQ;IAUR,aAAa,aAGZ;IAED,MAAM,
|
|
1
|
+
{"version":3,"file":"themeEditorSidebar.d.ts","sourceRoot":"","sources":["../../../src/ui/sidebars/themeEditorSidebar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAa,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,qBACa,kBAAmB,SAAQ,WAAW;IAElD,MAAM,CAAC,MAAM,+DA6BV;IAGH,SAAS,EAAE,YAAY,CAAC;IAGxB,KAAK,EAAE,UAAU,CAAC;IAElB,UAAU;IAMV,OAAO;IAaP,QAAQ;IAUR,aAAa,aAGZ;IAED,MAAM,6CAyBJ;CAEF"}
|
|
@@ -33,7 +33,12 @@ let ThemeEditorSidebar = class ThemeEditorSidebar extends BaseSidebar {
|
|
|
33
33
|
</div>
|
|
34
34
|
|
|
35
35
|
<div class="body">
|
|
36
|
-
<og-input
|
|
36
|
+
<og-input
|
|
37
|
+
.value="${this.theme?.name}"
|
|
38
|
+
style="flex: 0 20px"
|
|
39
|
+
@change="${(e) => { if (this.theme)
|
|
40
|
+
this.theme.name = e.value; }}">
|
|
41
|
+
</og-input>
|
|
37
42
|
<og-editor-theme .theme="${this.theme}" style="flex: 1"></og-editor-theme>
|
|
38
43
|
</div>
|
|
39
44
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeEditorSidebar.js","sourceRoot":"","sources":["../../../src/ui/sidebars/themeEditorSidebar.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC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C,IAAI,EAAE,MAAM,EAAC,CAAC;iDACP;AArCN,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CAoG9B","sourcesContent":["import { customElement, property, query } from 'lit/decorators.js';\nimport { html, css } from 'lit';\nimport { BaseSidebar } from './baseSidebar';\nimport { TreeDropdown, TreeEvent } from '@omegagrid/tree';\nimport { TableTheme } from '@omegagrid/grid';\nimport { msg } from '@omegagrid/localize';\n\n@customElement('og-editor-themesidebar')\nexport class ThemeEditorSidebar extends BaseSidebar {\n\n\tstatic styles = [BaseSidebar.styles, css`\n\t\t:host {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t}\n\n\t\t.header {\n\t\t\tflex: 0;\n\t\t\tpadding: 0 4px 4px;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\tgap: 4px;\n\t\t}\n\n\t\t.body {\n\t\t\tflex: 1;\n\t\t\tpadding: 0 4px 4px;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\tog-editor-theme {\n\t\t\tmargin-top: 4px;\n\t\t}\n\n\t\tog-input {\n\t\t\tdisplay: block;\n\t\t}\n\t`];\n\n\t@query('og-tree-dropdown')\n\tthemeList: TreeDropdown;\n\n\t@property({type: Object})\n\ttheme: TableTheme;\n\n\twillUpdate() {\n\t\tif (this.theme == null && this.group?.model?.themes?.size) {\n\t\t\tthis.theme = [...this.group.model.themes.values()][0];\n\t\t}\n\t}\n\n\tupdated() {\n\t\tif (this.group?.model?.themes) {\n\t\t\tthis.themeList.setSourceData([...this.group.model.themes.values()].map((theme) => ({\n\t\t\t\tk: theme.name, \n\t\t\t\tv: theme.name\n\t\t\t})), {\n\t\t\t\tcheckboxes: false,\n\t\t\t\tselectMode: 'single',\n\t\t\t\tautoClose: true,\n\t\t\t});\n\t\t}\n\t}\n\n\taddTheme() {\n\t\tconst model = this.group?.model;\n\t\tif (!model) return;\n\t\tlet i = model.themes.size + 1;\n\t\twhile (model.themes.has(`Theme ${i}`)) ++i;\n\t\tconst theme = {name: `Theme ${i}`} as TableTheme;\n\t\tmodel.themes.set(theme.name, theme);\n\t\tthis.theme = theme;\n\t}\n\n\t_onApplyClick = () => {\n\t\tthis.grid?.model.applyTheme(this.theme, true);\n\t\tthis.grid.refresh();\n\t}\n\n\trender = () => html`\n\t\t<div class=\"header\">\n\t\t\t<og-tree-dropdown\n\t\t\t\t@change=\"${(e: TreeEvent) => {\n\t\t\t\t\tthis.theme = e.node ? this.group.model.themes.get(e.node.key) : null;\n\t\t\t\t}}\"\n\t\t\t\tstyle=\"flex: 1\" \n\t\t\t\t.value=\"${this.theme == null ? null : [[this.theme.name, 0, 1]]}\">\n\t\t\t</og-tree-dropdown>\n\n\t\t\t<og-button @click=\"${this._onApplyClick}\">\n\t\t\t\t<div slot=\"content\"><og-icon icon=\"refresh\"></og-icon> ${msg('Apply')}</div>\n\t\t\t</og-button>\n\t\t\t\n\t\t\t<og-button icon=\"plus\" style=\"flex: 0 0 20px\" @click=\"${() => this.addTheme()}\"></og-button>\n\t\t</div>\n\n\t\t<div class=\"body\">\n\t\t\t<og-input\n\t\t\t\t.value=\"${this.theme?.name}\"\n\t\t\t\tstyle=\"flex: 0 20px\"\n\t\t\t\t@change=\"${(e: {value?: string}) => { if (this.theme) this.theme.name = e.value; }}\">\n\t\t\t</og-input>\n\t\t\t<og-editor-theme .theme=\"${this.theme}\" style=\"flex: 1\"></og-editor-theme>\n\t\t</div>\n\t`;\n\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omegagrid/editor",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.93",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Spreadsheet editor",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"_prepublish": "yarn test && yarn lint"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@omegagrid/commands": "^0.10.
|
|
31
|
-
"@omegagrid/core": "^0.10.
|
|
32
|
-
"@omegagrid/form": "^0.10.
|
|
33
|
-
"@omegagrid/grid": "^0.10.
|
|
34
|
-
"@omegagrid/localize": "^0.10.
|
|
35
|
-
"@omegagrid/statusbar": "^0.10.
|
|
36
|
-
"@omegagrid/tabs": "^0.10.
|
|
37
|
-
"@omegagrid/toolbar": "^0.10.
|
|
38
|
-
"@omegagrid/tree": "^0.10.
|
|
30
|
+
"@omegagrid/commands": "^0.10.93",
|
|
31
|
+
"@omegagrid/core": "^0.10.93",
|
|
32
|
+
"@omegagrid/form": "^0.10.93",
|
|
33
|
+
"@omegagrid/grid": "^0.10.93",
|
|
34
|
+
"@omegagrid/localize": "^0.10.93",
|
|
35
|
+
"@omegagrid/statusbar": "^0.10.93",
|
|
36
|
+
"@omegagrid/tabs": "^0.10.93",
|
|
37
|
+
"@omegagrid/toolbar": "^0.10.93",
|
|
38
|
+
"@omegagrid/tree": "^0.10.93",
|
|
39
39
|
"lit": "^3.1.1",
|
|
40
40
|
"lit-html": "^3.1.1",
|
|
41
41
|
"ts-debounce": "^4.0.0"
|