@omegagrid/editor 0.10.8 → 0.10.10
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.
|
@@ -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,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE7G,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;
|
|
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,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE7G,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;IAiDZ,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"}
|
|
@@ -77,13 +77,13 @@ let RuleEditor = class RuleEditor extends OmegaComponent {
|
|
|
77
77
|
<div class="row">
|
|
78
78
|
<og-editor-rule-threshold
|
|
79
79
|
id="cmax"
|
|
80
|
-
.value="${this.format?.cmax}"
|
|
80
|
+
.value="${this.format?.cmax}"
|
|
81
81
|
.allowedTypes="${['auto', 'num', 'percent']}"
|
|
82
82
|
?first="${false}"
|
|
83
83
|
@change="${() => this.updateFormat()}">
|
|
84
84
|
</og-editor-rule-threshold>
|
|
85
85
|
</div>
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
<div class="row">${msg('Color')}</div>
|
|
88
88
|
<div class="row" style="display: flex; gap: 4px;">
|
|
89
89
|
<og-dropdown-colorpicker
|
|
@@ -124,7 +124,7 @@ let RuleEditor = class RuleEditor extends OmegaComponent {
|
|
|
124
124
|
<og-editor-rule-threshold
|
|
125
125
|
class="threshold"
|
|
126
126
|
.allowedTypes="${['num', 'percent']}"
|
|
127
|
-
.value="${this.format?.thresh[i]}"
|
|
127
|
+
.value="${this.format?.thresh[i]}"
|
|
128
128
|
?first="${i == 0}"
|
|
129
129
|
@change="${() => this.updateFormat()}">
|
|
130
130
|
</og-editor-rule-threshold>
|
|
@@ -143,6 +143,9 @@ let RuleEditor = class RuleEditor extends OmegaComponent {
|
|
|
143
143
|
if (!this.format)
|
|
144
144
|
return;
|
|
145
145
|
let update = false;
|
|
146
|
+
this.format.cmin = null;
|
|
147
|
+
this.format.cmid = null;
|
|
148
|
+
this.format.cmax = null;
|
|
146
149
|
if (this.conditionInput)
|
|
147
150
|
this.format.condition = this.conditionInput.value;
|
|
148
151
|
else
|
|
@@ -156,21 +159,15 @@ let RuleEditor = class RuleEditor extends OmegaComponent {
|
|
|
156
159
|
this.format.cmin.t = 'min';
|
|
157
160
|
this.format.cmin.color = colors.plainHex(this.cminColorInput.value);
|
|
158
161
|
}
|
|
159
|
-
else
|
|
160
|
-
this.format.cmin = null;
|
|
161
162
|
if (this.cmidColorInput) {
|
|
162
163
|
this.format.cmid = this.format.cmid ?? {};
|
|
163
164
|
this.format.cmid.color = colors.plainHex(this.cmidColorInput.value);
|
|
164
165
|
}
|
|
165
|
-
else
|
|
166
|
-
this.format.cmid = null;
|
|
167
166
|
if (this.cmaxColorInput) {
|
|
168
167
|
this.format.cmax = this.format.cmax ?? {};
|
|
169
168
|
this.format.cmax.t = 'max';
|
|
170
169
|
this.format.cmax.color = colors.plainHex(this.cmaxColorInput.value);
|
|
171
170
|
}
|
|
172
|
-
else
|
|
173
|
-
this.format.cmax = null;
|
|
174
171
|
if (this.colorInput)
|
|
175
172
|
this.format.color = colors.plainHex(this.colorInput.value);
|
|
176
173
|
else
|
|
@@ -188,22 +185,16 @@ let RuleEditor = class RuleEditor extends OmegaComponent {
|
|
|
188
185
|
this.format.thresh = null;
|
|
189
186
|
if (this.cmin)
|
|
190
187
|
this.format.cmin = this.cmin.value;
|
|
191
|
-
else
|
|
192
|
-
this.format.cmin = null;
|
|
193
188
|
if (this.cmid)
|
|
194
189
|
this.format.cmid = this.cmid.value;
|
|
195
|
-
else
|
|
196
|
-
this.format.cmid = null;
|
|
197
190
|
if (this.cmax)
|
|
198
191
|
this.format.cmax = this.cmax.value;
|
|
199
|
-
else
|
|
200
|
-
this.format.cmax = null;
|
|
201
192
|
if (update)
|
|
202
193
|
this.requestUpdate();
|
|
203
194
|
}
|
|
204
195
|
};
|
|
205
196
|
RuleEditor.styles = [OmegaComponent.styles, css `
|
|
206
|
-
|
|
197
|
+
|
|
207
198
|
`];
|
|
208
199
|
__decorate([
|
|
209
200
|
property({ type: Object })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruleEditor.js","sourceRoot":"","sources":["../../../src/ui/editors/ruleEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAgD,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,MAAM,EAAsD,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7G,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGhD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,cAAc;IAAvC;;QA+FN,sBAAiB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;qBACV,GAAG,CAAC,WAAW,CAAC;;;;;cAKvB,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,EA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BAA6B,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, 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\t\t\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\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} else this.format.cmin = null;\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} else this.format.cmid = null;\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} else this.format.cmax = null;\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;\t\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\telse this.format.cmin = null;\n\n\t\tif (this.cmid) this.format.cmid = this.cmid.value;\n\t\telse this.format.cmid = null;\n\n\t\tif (this.cmax) this.format.cmax = this.cmax.value;\n\t\telse this.format.cmax = null;\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\t\t\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}"]}
|
|
1
|
+
{"version":3,"file":"ruleEditor.js","sourceRoot":"","sources":["../../../src/ui/editors/ruleEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAgD,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,MAAM,EAAsD,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7G,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGhD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,cAAc;IAAvC;;QA8FN,sBAAiB,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;qBACV,GAAG,CA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B;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"]}
|
|
@@ -30,7 +30,7 @@ let RuleList = class RuleList extends LitElement {
|
|
|
30
30
|
this._itemRenderer = (_div, index) => html `
|
|
31
31
|
<div class="header" style="padding-right: ${constants.SLIDER_SIZE}px">
|
|
32
32
|
<div>Rule #${index + 1}</div>
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
<div>
|
|
35
35
|
<og-dropdown-list
|
|
36
36
|
.value = "${this.getFormatByIndex(index).type}"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ruleList.js","sourceRoot":"","sources":["../../../src/ui/forms/ruleList.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAoE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAG1C,MAAM,SAAS,GAA2B;IACzC,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,OAAO;IAChB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yB;QACjD,MAAM,KAAK,GAAG,CAAC,CAAC,MAAe,CAAC;QAChC,QAAQ,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;YAC1B,KAAK,QAAQ;gBAAE,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAAC,MAAM;YACrE,KAAK,WAAW;gBAAE,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;gBAAC,MAAM;QACzD,CAAC;IACF,CAAC;IAED,cAAc,CAAC,CAAqB,EAAE,MAAyB;QAC9D,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAc,CAAC,CAAC;IACxD,CAAC;IAED,gBAAgB,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IAED,UAAU,CAAC,KAAa,EAAE,IAA2B;QACpD,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;;AA7EM,eAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAGxB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;sCACd;AAGX;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;uCACR;AAGjB;IADC,KAAK,CAAC,SAAS,CAAC;sCACN;AAXC,QAAQ;IADpB,aAAa,CAAC,iBAAiB,CAAC;GACpB,QAAQ,CAuJpB","sourcesContent":["import { Input, List, constants } from '@omegagrid/core';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { CellRange, ConditionalFormat, ConditionalFormatType, Grid, GridModel, Style } from '@omegagrid/grid';\nimport { html, LitElement } from 'lit';\nimport { itemStyle, style } from './ruleList.style';\nimport { msg } from '@omegagrid/localize';\nimport { events } from '@omegagrid/core';\n\nconst ruleTypes: Record<string, string> = {\n\t'formula': 'Formula',\n\t'scale': 'Scale',\n\t'bar': 'Data Bar',\n\t'icon': 'Icon Set',\n};\n\n@customElement('og-editor-rules')\nexport class RuleList extends LitElement {\n\n\tstatic styles = [style];\n\n\t@property({type: Object})\n\tgrid: Grid;\n\n\t@property({type: Object})\n\tmodel: GridModel;\n\n\t@query('og-list')\n\tlist: List;\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t}\n\n\tupdateList = () => {\n\t\tthis.list.size = this.model.conditionalFormats.formats.length;\n\t\tthis.list.renderItems(true);\n\t}\n\n\tmoveRuleUp(index: number) {\n\t\tif (index == 0) return;\n\t\tconst formats = this.model.conditionalFormats.formats;\n\t\tformats.splice(index - 1, 0, formats.splice(index, 1)[0]);\n\t\tthis.updateList();\n\t}\n\
|
|
1
|
+
{"version":3,"file":"ruleList.js","sourceRoot":"","sources":["../../../src/ui/forms/ruleList.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAoE,MAAM,iBAAiB,CAAC;AAC9G,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAG1C,MAAM,SAAS,GAA2B;IACzC,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;CAClB,CAAC;AAGK,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ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AE,CAAC;YAC1B,KAAK,QAAQ;gBAAE,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAAC,MAAM;YACrE,KAAK,WAAW;gBAAE,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;gBAAC,MAAM;QACzD,CAAC;IACF,CAAC;IAED,cAAc,CAAC,CAAqB,EAAE,MAAyB;QAC9D,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,KAAc,CAAC,CAAC;IACxD,CAAC;IAED,gBAAgB,CAAC,KAAa;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACrD,CAAC;IAED,UAAU,CAAC,KAAa,EAAE,IAA2B;QACpD,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;;AA7EM,eAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAGxB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;sCACd;AAGX;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;uCACR;AAGjB;IADC,KAAK,CAAC,SAAS,CAAC;sCACN;AAXC,QAAQ;IADpB,aAAa,CAAC,iBAAiB,CAAC;GACpB,QAAQ,CAuJpB","sourcesContent":["import { Input, List, constants } from '@omegagrid/core';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { CellRange, ConditionalFormat, ConditionalFormatType, Grid, GridModel, Style } from '@omegagrid/grid';\nimport { html, LitElement } from 'lit';\nimport { itemStyle, style } from './ruleList.style';\nimport { msg } from '@omegagrid/localize';\nimport { events } from '@omegagrid/core';\n\nconst ruleTypes: Record<string, string> = {\n\t'formula': 'Formula',\n\t'scale': 'Scale',\n\t'bar': 'Data Bar',\n\t'icon': 'Icon Set',\n};\n\n@customElement('og-editor-rules')\nexport class RuleList extends LitElement {\n\n\tstatic styles = [style];\n\n\t@property({type: Object})\n\tgrid: Grid;\n\n\t@property({type: Object})\n\tmodel: GridModel;\n\n\t@query('og-list')\n\tlist: List;\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t}\n\n\tupdateList = () => {\n\t\tthis.list.size = this.model.conditionalFormats.formats.length;\n\t\tthis.list.renderItems(true);\n\t}\n\n\tmoveRuleUp(index: number) {\n\t\tif (index == 0) return;\n\t\tconst formats = this.model.conditionalFormats.formats;\n\t\tformats.splice(index - 1, 0, formats.splice(index, 1)[0]);\n\t\tthis.updateList();\n\t}\n\n\tmoveRuleDown(index: number) {\n\t\tconst formats = this.model.conditionalFormats.formats;\n\t\tif (index >= formats.length) return;\n\t\tformats.splice(index + 1, 0, formats.splice(index, 1)[0]);\n\t\tthis.updateList();\n\t}\n\n\tdeleteRule(index: number) {\n\t\tconst formats = this.model.conditionalFormats.formats;\n\t\tformats.splice(index, 1);\n\t\tthis.updateList();\n\t}\n\n\ttoggleRuleStop(index: number) {\n\t\tconst format = this.getFormatByIndex(index);\n\t\tformat.stop = !format.stop;\n\t\tthis.updateList();\n\t}\n\n\taddRule() {\n\t\tconst formats = this.model.conditionalFormats.formats;\n\t\tformats.push({} as ConditionalFormat);\n\t\tthis.updateList();\n\t}\n\n\t_onApplyClick = () => {\n\t\tthis.model.clearCalculatedStyles();\n\t\tthis.grid.rendering.render(false);\n\t}\n\n\t_onInputChange(e: Event, format: ConditionalFormat) {\n\t\tconst input = e.target as Input;\n\t\tswitch (input.dataset.id) {\n\t\t\tcase 'ranges': format.ranges = CellRange.fromA1s(input.value); break;\n\t\t\tcase 'condition': format.condition = input.value; break;\n\t\t}\n\t}\n\n\t_onStyleChange(e: events.ChangeEvent, format: ConditionalFormat) {\n\t\tformat.style = this.model.styles.add(e.value as Style);\n\t}\n\n\tgetFormatByIndex(index: number) {\n\t\treturn this.model.conditionalFormats.formats[index];\n\t}\n\n\tchangeType(index: number, type: ConditionalFormatType) {\n\t\tconst format = this.getFormatByIndex(index);\n\t\tformat.type = type;\n\t\tthis.updateList();\n\t}\n\n\t_itemRenderer = (_div: HTMLDivElement, index: number) => html`\n\t\t<div class=\"header\" style=\"padding-right: ${constants.SLIDER_SIZE}px\">\n\t\t\t<div>Rule #${index + 1}</div>\n\n\t\t\t<div>\n\t\t\t\t<og-dropdown-list\n\t\t\t\t\t.value = \"${this.getFormatByIndex(index).type}\"\n\t\t\t\t\t.items=\"${Object.entries(ruleTypes).map(e => ({key: e[0], value: e[1]}))}\"\n\t\t\t\t\t@change=\"${(e: events.ChangeEvent) => this.changeType(index, e.value as ConditionalFormatType)}\">\n\t\t\t\t</og-dropdown-list>\n\t\t\t</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\ticon=\"bars\"\n\t\t\t\t\t.items=\"${[{\n\t\t\t\t\t\tkey: 'stop',\n\t\t\t\t\t\tvalue: msg('Stop if true'),\n\t\t\t\t\t\ticon: this.getFormatByIndex(index).stop ? 'square-check' : 'square',\n\t\t\t\t\t\texec: () => this.toggleRuleStop(index)\n\t\t\t\t\t}, {\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.moveRuleUp(index)\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.moveRuleDown(index)\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.deleteRule(index)\n\t\t\t\t\t}]}\">\n\t\t\t\t</og-dropdown-menu>\n\t\t\t</div>\n\t\t</div>\n\t\t<div style=\"padding-right: ${constants.SLIDER_SIZE}px\">\n\t\t\t<og-editor-form-rule\n\t\t\t\t.format=\"${this.getFormatByIndex(index)}\"\n\t\t\t\t.model=\"${this.model}\">\n\t\t\t</og-editor-form-rule>\n\t\t</div>\n\t`;\n\n\trender = () => this.model ? html`\n\t\t<div class=\"controls p\">\n\t\t\t<og-button text=\"+\" @click=\"${() => this.addRule()}\"></og-button>\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</div>\n\t\t<div class=\"body\">\n\t\t\t<og-list\n\t\t\t\tdisabledSelect\n\t\t\t\tdynamicItemHeight\n\t\t\t\t?nativeHeight=\"${true}\"\n\t\t\t\titemHeight=\"170\"\n\t\t\t\t.customStyle=${itemStyle}\n\t\t\t\t.itemRenderer=\"${this._itemRenderer}\"\n\t\t\t\t.size=\"${this.model.conditionalFormats.formats.length}\">\n\t\t\t</og-list>\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.10",
|
|
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.10",
|
|
31
|
+
"@omegagrid/core": "^0.10.10",
|
|
32
|
+
"@omegagrid/form": "^0.10.10",
|
|
33
|
+
"@omegagrid/grid": "^0.10.10",
|
|
34
|
+
"@omegagrid/localize": "^0.10.10",
|
|
35
|
+
"@omegagrid/statusbar": "^0.10.10",
|
|
36
|
+
"@omegagrid/tabs": "^0.10.10",
|
|
37
|
+
"@omegagrid/toolbar": "^0.10.10",
|
|
38
|
+
"@omegagrid/tree": "^0.10.10",
|
|
39
39
|
"lit": "^3.1.1",
|
|
40
40
|
"lit-html": "^3.1.1",
|
|
41
41
|
"ts-debounce": "^4.0.0"
|