@omegagrid/editor 0.10.2 → 0.10.4
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/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +34 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +12 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +14 -0
- package/dist/options.js.map +1 -0
- package/dist/ui/editor.d.ts +76 -0
- package/dist/ui/editor.d.ts.map +1 -0
- package/dist/ui/editor.js +338 -0
- package/dist/ui/editor.js.map +1 -0
- package/dist/ui/editor.style.d.ts +2 -0
- package/dist/ui/editor.style.d.ts.map +1 -0
- package/dist/ui/editor.style.js +38 -0
- package/dist/ui/editor.style.js.map +1 -0
- package/dist/ui/editorZoom.d.ts +16 -0
- package/dist/ui/editorZoom.d.ts.map +1 -0
- package/dist/ui/editorZoom.js +82 -0
- package/dist/ui/editorZoom.js.map +1 -0
- package/dist/ui/editors/hyperlinkEditor.d.ts +10 -0
- package/dist/ui/editors/hyperlinkEditor.d.ts.map +1 -0
- package/dist/ui/editors/hyperlinkEditor.js +70 -0
- package/dist/ui/editors/hyperlinkEditor.js.map +1 -0
- package/dist/ui/editors/index.d.ts +6 -0
- package/dist/ui/editors/index.d.ts.map +1 -0
- package/dist/ui/editors/index.js +6 -0
- package/dist/ui/editors/index.js.map +1 -0
- package/dist/ui/editors/ruleEditor.d.ts +27 -0
- package/dist/ui/editors/ruleEditor.d.ts.map +1 -0
- package/dist/ui/editors/ruleEditor.js +251 -0
- package/dist/ui/editors/ruleEditor.js.map +1 -0
- package/dist/ui/editors/styleEditor.d.ts +14 -0
- package/dist/ui/editors/styleEditor.d.ts.map +1 -0
- package/dist/ui/editors/styleEditor.js +160 -0
- package/dist/ui/editors/styleEditor.js.map +1 -0
- package/dist/ui/editors/themeEditor.d.ts +24 -0
- package/dist/ui/editors/themeEditor.d.ts.map +1 -0
- package/dist/ui/editors/themeEditor.js +138 -0
- package/dist/ui/editors/themeEditor.js.map +1 -0
- package/dist/ui/editors/themeItemEditor.d.ts +22 -0
- package/dist/ui/editors/themeItemEditor.d.ts.map +1 -0
- package/dist/ui/editors/themeItemEditor.js +181 -0
- package/dist/ui/editors/themeItemEditor.js.map +1 -0
- package/dist/ui/forms/configForm.d.ts +12 -0
- package/dist/ui/forms/configForm.d.ts.map +1 -0
- package/dist/ui/forms/configForm.js +101 -0
- package/dist/ui/forms/configForm.js.map +1 -0
- package/dist/ui/forms/headerForm.d.ts +18 -0
- package/dist/ui/forms/headerForm.d.ts.map +1 -0
- package/dist/ui/forms/headerForm.js +144 -0
- package/dist/ui/forms/headerForm.js.map +1 -0
- package/dist/ui/forms/index.d.ts +9 -0
- package/dist/ui/forms/index.d.ts.map +1 -0
- package/dist/ui/forms/index.js +9 -0
- package/dist/ui/forms/index.js.map +1 -0
- package/dist/ui/forms/namesForm.d.ts +21 -0
- package/dist/ui/forms/namesForm.d.ts.map +1 -0
- package/dist/ui/forms/namesForm.js +124 -0
- package/dist/ui/forms/namesForm.js.map +1 -0
- package/dist/ui/forms/ruleForm.d.ts +13 -0
- package/dist/ui/forms/ruleForm.d.ts.map +1 -0
- package/dist/ui/forms/ruleForm.js +56 -0
- package/dist/ui/forms/ruleForm.js.map +1 -0
- package/dist/ui/forms/ruleForm.style.d.ts +2 -0
- package/dist/ui/forms/ruleForm.style.d.ts.map +1 -0
- package/dist/ui/forms/ruleForm.style.js +50 -0
- package/dist/ui/forms/ruleForm.style.js.map +1 -0
- package/dist/ui/forms/ruleFormThreshold.d.ts +19 -0
- package/dist/ui/forms/ruleFormThreshold.d.ts.map +1 -0
- package/dist/ui/forms/ruleFormThreshold.js +97 -0
- package/dist/ui/forms/ruleFormThreshold.js.map +1 -0
- package/dist/ui/forms/ruleList.d.ts +25 -0
- package/dist/ui/forms/ruleList.d.ts.map +1 -0
- package/dist/ui/forms/ruleList.js +169 -0
- package/dist/ui/forms/ruleList.js.map +1 -0
- package/dist/ui/forms/ruleList.style.d.ts +3 -0
- package/dist/ui/forms/ruleList.style.d.ts.map +1 -0
- package/dist/ui/forms/ruleList.style.js +69 -0
- package/dist/ui/forms/ruleList.style.js.map +1 -0
- package/dist/ui/forms/sparklineForm.d.ts +22 -0
- package/dist/ui/forms/sparklineForm.d.ts.map +1 -0
- package/dist/ui/forms/sparklineForm.js +199 -0
- package/dist/ui/forms/sparklineForm.js.map +1 -0
- package/dist/ui/forms/sparklineForm.style.d.ts +3 -0
- package/dist/ui/forms/sparklineForm.style.d.ts.map +1 -0
- package/dist/ui/forms/sparklineForm.style.js +94 -0
- package/dist/ui/forms/sparklineForm.style.js.map +1 -0
- package/dist/ui/forms/styleForm.d.ts +14 -0
- package/dist/ui/forms/styleForm.d.ts.map +1 -0
- package/dist/ui/forms/styleForm.js +151 -0
- package/dist/ui/forms/styleForm.js.map +1 -0
- package/dist/ui/formulabar.d.ts +23 -0
- package/dist/ui/formulabar.d.ts.map +1 -0
- package/dist/ui/formulabar.js +155 -0
- package/dist/ui/formulabar.js.map +1 -0
- package/dist/ui/formulabar.style.d.ts +2 -0
- package/dist/ui/formulabar.style.d.ts.map +1 -0
- package/dist/ui/formulabar.style.js +48 -0
- package/dist/ui/formulabar.style.js.map +1 -0
- package/dist/ui/gridStats.d.ts +11 -0
- package/dist/ui/gridStats.d.ts.map +1 -0
- package/dist/ui/gridStats.js +71 -0
- package/dist/ui/gridStats.js.map +1 -0
- package/dist/ui/index.d.ts +11 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +11 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/sidebars/baseSidebar.d.ts +10 -0
- package/dist/ui/sidebars/baseSidebar.d.ts.map +1 -0
- package/dist/ui/sidebars/baseSidebar.js +24 -0
- package/dist/ui/sidebars/baseSidebar.js.map +1 -0
- package/dist/ui/sidebars/index.d.ts +2 -0
- package/dist/ui/sidebars/index.d.ts.map +1 -0
- package/dist/ui/sidebars/index.js +2 -0
- package/dist/ui/sidebars/index.js.map +1 -0
- package/dist/ui/sidebars/themeEditorSidebar.d.ts +14 -0
- package/dist/ui/sidebars/themeEditorSidebar.d.ts.map +1 -0
- package/dist/ui/sidebars/themeEditorSidebar.js +110 -0
- package/dist/ui/sidebars/themeEditorSidebar.js.map +1 -0
- package/dist/ui/statusbar.d.ts +19 -0
- package/dist/ui/statusbar.d.ts.map +1 -0
- package/dist/ui/statusbar.js +69 -0
- package/dist/ui/statusbar.js.map +1 -0
- package/dist/ui/toolbar.config.d.ts +7 -0
- package/dist/ui/toolbar.config.d.ts.map +1 -0
- package/dist/ui/toolbar.config.js +166 -0
- package/dist/ui/toolbar.config.js.map +1 -0
- package/dist/ui/toolbar.d.ts +42 -0
- package/dist/ui/toolbar.d.ts.map +1 -0
- package/dist/ui/toolbar.js +356 -0
- package/dist/ui/toolbar.js.map +1 -0
- package/dist/ui/toolbar.style.d.ts +2 -0
- package/dist/ui/toolbar.style.d.ts.map +1 -0
- package/dist/ui/toolbar.style.js +22 -0
- package/dist/ui/toolbar.style.js.map +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { events, utils } from '@omegagrid/core';
|
|
8
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
9
|
+
import { css, html, LitElement } from 'lit';
|
|
10
|
+
import { createBorderIcon } from '../toolbar.config';
|
|
11
|
+
const fontSizes = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26].map(sz => ({
|
|
12
|
+
k: sz.toString(),
|
|
13
|
+
v: sz.toString(),
|
|
14
|
+
}));
|
|
15
|
+
const items = [
|
|
16
|
+
{ type: 'togglebutton', id: 'bold', icon: { icon: 'bold' } },
|
|
17
|
+
{ type: 'togglebutton', id: 'italic', icon: { icon: 'italic' } },
|
|
18
|
+
{ type: 'togglebutton', id: 'underline', icon: { icon: 'underline' } },
|
|
19
|
+
{ type: 'text', id: 'sz', width: 40, items: fontSizes, placeholder: '' },
|
|
20
|
+
{ type: 'dropdown-button', id: 'alignment', icon: { icon: 'align-center' }, items: [[
|
|
21
|
+
{ type: 'button', id: 'alignTopLeft', icon: { icon: 'align-right', rotation: 180 } },
|
|
22
|
+
{ type: 'button', id: 'alignTopCenter', icon: { icon: 'align-center' } },
|
|
23
|
+
{ type: 'button', id: 'alignTopRight', icon: { icon: 'align-left', rotation: 180 } },
|
|
24
|
+
], [
|
|
25
|
+
{ type: 'button', id: 'alignCenterLeft', icon: { icon: 'align-left' } },
|
|
26
|
+
{ type: 'button', id: 'alignCenterCenter', icon: { icon: 'align-center' } },
|
|
27
|
+
{ type: 'button', id: 'alignCenterRight', icon: { icon: 'align-right' } },
|
|
28
|
+
], [
|
|
29
|
+
{ type: 'button', id: 'alignBottomLeft', icon: { icon: 'align-left' } },
|
|
30
|
+
{ type: 'button', id: 'alignBottomCenter', icon: { icon: 'align-center' } },
|
|
31
|
+
{ type: 'button', id: 'alignBottomRight', icon: { icon: 'align-right' } },
|
|
32
|
+
]] },
|
|
33
|
+
{ type: 'color', id: 'color', icon: { icon: 'font' } },
|
|
34
|
+
{ type: 'color', id: 'fgColor', icon: { icon: 'fill' } },
|
|
35
|
+
{ type: 'dropdown-button', id: 'border', icon: { icon: 'align-center' }, items: [[
|
|
36
|
+
{ type: 'button', id: 'borderLeft', value: { left: { style: 'thin' } }, content: createBorderIcon('left') },
|
|
37
|
+
{ type: 'button', id: 'borderRight', value: { right: { style: 'thin' } }, content: createBorderIcon('right') },
|
|
38
|
+
{ type: 'button', id: 'borderTop', value: { top: { style: 'thin' } }, content: createBorderIcon('top') },
|
|
39
|
+
{ type: 'button', id: 'borderBottom', value: { bottom: { style: 'thin' } }, content: createBorderIcon('bottom') },
|
|
40
|
+
], [
|
|
41
|
+
{ type: 'button', id: 'borderNone', value: { left: null, top: null, right: null, bottom: null }, content: createBorderIcon('none') },
|
|
42
|
+
{ type: 'button', id: 'borderAll', value: { left: { style: 'thin' }, top: { style: 'thin' }, right: { style: 'thin' }, bottom: { style: 'thin' } }, content: createBorderIcon('all') },
|
|
43
|
+
{ type: 'button', id: 'borderOutside', value: { left: { style: 'thin' }, top: { style: 'thin' }, right: { style: 'thin' }, bottom: { style: 'thin' } }, content: createBorderIcon('outside') },
|
|
44
|
+
{ type: 'button', id: 'borderOutsideThick', value: { left: { style: 'thick' }, top: { style: 'thick' }, right: { style: 'thick' }, bottom: { style: 'thick' } }, content: createBorderIcon('outside-thick') },
|
|
45
|
+
], [
|
|
46
|
+
{ type: 'button', id: 'borderBottomDouble', value: { bottom: { style: 'double' } }, content: createBorderIcon('bottom-double') },
|
|
47
|
+
{ type: 'button', id: 'borderBottomThick', value: { bottom: { style: 'thick' } }, content: createBorderIcon('bottom-thick') },
|
|
48
|
+
{ type: 'button', id: 'borderTopBottom', value: { top: { style: 'thin' }, bottom: { style: 'thin' } }, content: createBorderIcon('top-bottom') },
|
|
49
|
+
{ type: 'button', id: 'borderTopBottomThick', value: { top: { style: 'thin' }, bottom: { style: 'thick' } }, content: createBorderIcon('top-bottom-thick') },
|
|
50
|
+
], [{ type: 'color', id: 'borderColor', colspan: 4, icon: { icon: 'fill' } }]] },
|
|
51
|
+
];
|
|
52
|
+
let StyleEditor = class StyleEditor extends LitElement {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
this.data = {};
|
|
56
|
+
this._onAction = (e) => {
|
|
57
|
+
const a = e.action;
|
|
58
|
+
if (/^preview/.test(a.type))
|
|
59
|
+
return;
|
|
60
|
+
const data = utils.cloneDeep(this.data);
|
|
61
|
+
delete data.id;
|
|
62
|
+
delete data.hash;
|
|
63
|
+
switch (a.key) {
|
|
64
|
+
case 'bold':
|
|
65
|
+
data.bold = a.value ? true : false;
|
|
66
|
+
break;
|
|
67
|
+
case 'italic':
|
|
68
|
+
data.italic = a.value ? true : false;
|
|
69
|
+
break;
|
|
70
|
+
case 'underline':
|
|
71
|
+
data.underline = a.value ? true : false;
|
|
72
|
+
break;
|
|
73
|
+
case 'sz':
|
|
74
|
+
data.sz = a.value ? parseInt(a.value) : null;
|
|
75
|
+
break;
|
|
76
|
+
case 'color':
|
|
77
|
+
data.color = a.value.substring(1);
|
|
78
|
+
break;
|
|
79
|
+
case 'fgColor':
|
|
80
|
+
data.fgColor = a.value.substring(1);
|
|
81
|
+
break;
|
|
82
|
+
case 'alignCenterCenter':
|
|
83
|
+
data.alignment = { vertical: 'center', horizontal: 'center' };
|
|
84
|
+
break;
|
|
85
|
+
case 'alignTopLeft':
|
|
86
|
+
data.alignment = { vertical: 'top', horizontal: 'left' };
|
|
87
|
+
break;
|
|
88
|
+
case 'alignTopCenter':
|
|
89
|
+
data.alignment = { vertical: 'top', horizontal: 'center' };
|
|
90
|
+
break;
|
|
91
|
+
case 'alignTopRight':
|
|
92
|
+
data.alignment = { vertical: 'top', horizontal: 'right' };
|
|
93
|
+
break;
|
|
94
|
+
case 'alignCenterLeft':
|
|
95
|
+
data.alignment = { vertical: 'center', horizontal: 'left' };
|
|
96
|
+
break;
|
|
97
|
+
case 'alignCenterRight':
|
|
98
|
+
data.alignment = { vertical: 'center', horizontal: 'right' };
|
|
99
|
+
break;
|
|
100
|
+
case 'alignBottomLeft':
|
|
101
|
+
data.alignment = { vertical: 'bottom', horizontal: 'left' };
|
|
102
|
+
break;
|
|
103
|
+
case 'alignBottomCenter':
|
|
104
|
+
data.alignment = { vertical: 'bottom', horizontal: 'center' };
|
|
105
|
+
break;
|
|
106
|
+
case 'alignBottomRight':
|
|
107
|
+
data.alignment = { vertical: 'bottom', horizontal: 'right' };
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
this.data = data;
|
|
111
|
+
this.dispatchEvent(new events.ChangeEvent({ value: data }));
|
|
112
|
+
};
|
|
113
|
+
this.render = () => html `
|
|
114
|
+
<og-toolbar
|
|
115
|
+
.items="${items}"
|
|
116
|
+
.values="${this.styleToToolbarValues(this.data)}"
|
|
117
|
+
@toolbar.action="${this._onAction}">
|
|
118
|
+
</og-toolbar>
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
styleToToolbarValues(s) {
|
|
122
|
+
const values = {};
|
|
123
|
+
values.bold = s.bold;
|
|
124
|
+
values.italic = s.italic;
|
|
125
|
+
values.underline = s.underline;
|
|
126
|
+
values.color = `#${s.color}`;
|
|
127
|
+
values.fgColor = `#${s.fgColor || s.bgColor}`;
|
|
128
|
+
values.sz = s.sz ? s.sz.toString() : null;
|
|
129
|
+
return values;
|
|
130
|
+
}
|
|
131
|
+
connectedCallback() {
|
|
132
|
+
super.connectedCallback();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
StyleEditor.styles = [css `
|
|
136
|
+
.row {
|
|
137
|
+
height: 30px;
|
|
138
|
+
line-height: 30px;
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: row;
|
|
141
|
+
gap: 3px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.row > og-button {
|
|
145
|
+
min-width: 24px;
|
|
146
|
+
height: 24px;
|
|
147
|
+
padding: 0;
|
|
148
|
+
}
|
|
149
|
+
`];
|
|
150
|
+
__decorate([
|
|
151
|
+
property({ type: Object })
|
|
152
|
+
], StyleEditor.prototype, "data", void 0);
|
|
153
|
+
__decorate([
|
|
154
|
+
query('og-toolbar')
|
|
155
|
+
], StyleEditor.prototype, "toolbar", void 0);
|
|
156
|
+
StyleEditor = __decorate([
|
|
157
|
+
customElement('og-editor-styleeditor')
|
|
158
|
+
], StyleEditor);
|
|
159
|
+
export { StyleEditor };
|
|
160
|
+
//# sourceMappingURL=styleEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styleEditor.js","sourceRoot":"","sources":["../../../src/ui/editors/styleEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAW,MAAM,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE;IAChB,CAAC,EAAE,EAAE,CAAC,QAAQ,EAAE;CAChB,CAAC,CAAC,CAAC;AAEJ,MAAM,KAAK,GAAkB;IAC5B,EAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC,EAAC;IACxD,EAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC;IAC5D,EAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,WAAW,EAAE,I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AoB,CAAC,IAAI,CAAC,IAAI,CAAC;sBAC5B,IAAI,CAAC,SAAS;;EAElC,CAAC;IAEH,CAAC;IApDA,oBAAoB,CAAC,CAAQ;QAC5B,MAAM,MAAM,GAA4B,EAAE,CAAC;QAC3C,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;QACrB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;QACzB,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;QAC/B,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QAC7B,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QAC9C,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1C,OAAO,MAAM,CAAC;IACf,CAAC;IAED,iBAAiB;QAChB,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;;AAnCM,kBAAM,GAAG,CAAC,GAAG,CAAA;;;;;;;;;;;;;;EAcnB,CAAC,AAdW,CAcV;AAGH;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;yCACR;AAGjB;IADC,KAAK,CAAC,YAAY,CAAC;4CACH;AAtBL,WAAW;IADvB,aAAa,CAAC,uBAAuB,CAAC;GAC1B,WAAW,CA4EvB","sourcesContent":["import { actions, events, utils } from '@omegagrid/core';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { Style } from '@omegagrid/grid';\nimport { css, html, LitElement } from 'lit';\nimport { Toolbar, ToolbarItem } from '@omegagrid/toolbar';\nimport { createBorderIcon } from '../toolbar.config';\n\nconst fontSizes = [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26].map(sz => ({\n\tk: sz.toString(),\n\tv: sz.toString(),\n}));\n\nconst items: ToolbarItem[] = [\n\t{type: 'togglebutton', id: 'bold', icon: {icon: 'bold'}},\n\t{type: 'togglebutton', id: 'italic', icon: {icon: 'italic'}},\n\t{type: 'togglebutton', id: 'underline', icon: {icon: 'underline'}},\n\t{type: 'text', id: 'sz', width: 40, items: fontSizes, placeholder: ''},\n\t{type: 'dropdown-button', id: 'alignment', icon: {icon: 'align-center'}, items: [[\n\t\t{type: 'button', id: 'alignTopLeft', icon: {icon: 'align-right', rotation: 180}},\n\t\t{type: 'button', id: 'alignTopCenter', icon: {icon: 'align-center'}},\n\t\t{type: 'button', id: 'alignTopRight', icon: {icon: 'align-left', rotation: 180}},\n\t], [\n\t\t{type: 'button', id: 'alignCenterLeft', icon: {icon: 'align-left'}},\n\t\t{type: 'button', id: 'alignCenterCenter', icon: {icon: 'align-center'}},\n\t\t{type: 'button', id: 'alignCenterRight', icon: {icon: 'align-right'}},\n\t], [\n\t\t{type: 'button', id: 'alignBottomLeft', icon: {icon: 'align-left'}},\n\t\t{type: 'button', id: 'alignBottomCenter', icon: {icon: 'align-center'}},\n\t\t{type: 'button', id: 'alignBottomRight', icon: {icon: 'align-right'}},\n\t]]},\n\t{type: 'color', id: 'color', icon: {icon: 'font'}},\n\t{type: 'color', id: 'fgColor', icon: {icon: 'fill'}},\n\t{type: 'dropdown-button', id: 'border', icon: {icon: 'align-center'}, items: [[\n\t\t{type: 'button', id: 'borderLeft', value: {left: {style: 'thin'}}, content: createBorderIcon('left')},\n\t\t{type: 'button', id: 'borderRight', value: {right: {style: 'thin'}}, content: createBorderIcon('right')},\n\t\t{type: 'button', id: 'borderTop', value: {top: {style: 'thin'}}, content: createBorderIcon('top')},\n\t\t{type: 'button', id: 'borderBottom', value: {bottom: {style: 'thin'}}, content: createBorderIcon('bottom')},\n\t], [\n\t\t{type: 'button', id: 'borderNone', value: {left: null, top: null, right: null, bottom: null}, content: createBorderIcon('none')},\n\t\t{type: 'button', id: 'borderAll', value: {left: {style: 'thin'}, top: {style: 'thin'}, right: {style: 'thin'}, bottom: {style: 'thin'}}, content: createBorderIcon('all')},\n\t\t{type: 'button', id: 'borderOutside', value: {left: {style: 'thin'}, top: {style: 'thin'}, right: {style: 'thin'}, bottom: {style: 'thin'}}, content: createBorderIcon('outside')},\n\t\t{type: 'button', id: 'borderOutsideThick', value: {left: {style: 'thick'}, top: {style: 'thick'}, right: {style: 'thick'}, bottom: {style: 'thick'}}, content: createBorderIcon('outside-thick')},\n\t], [\n\t\t{type: 'button', id: 'borderBottomDouble', value: {bottom: {style: 'double'}}, content: createBorderIcon('bottom-double')},\n\t\t{type: 'button', id: 'borderBottomThick', value: {bottom: {style: 'thick'}}, content: createBorderIcon('bottom-thick')},\n\t\t{type: 'button', id: 'borderTopBottom', value: {top: {style: 'thin'}, bottom: {style: 'thin'}}, content: createBorderIcon('top-bottom')},\n\t\t{type: 'button', id: 'borderTopBottomThick', value: {top: {style: 'thin'}, bottom: {style: 'thick'}}, content: createBorderIcon('top-bottom-thick')},\n\t], [{type: 'color', id: 'borderColor', colspan: 4, icon: {icon: 'fill'}}]]},\n\t\n];\n\n@customElement('og-editor-styleeditor')\nexport class StyleEditor extends LitElement {\n\n\tstatic styles = [css`\n\t\t.row {\n\t\t\theight: 30px;\n\t\t\tline-height: 30px;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\tgap: 3px;\n\t\t}\n\n\t\t.row > og-button {\n\t\t\tmin-width: 24px;\n\t\t\theight: 24px;\n\t\t\tpadding: 0;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\tdata: Style = {};\n\n\t@query('og-toolbar')\n\ttoolbar: Toolbar;\n\n\tstyleToToolbarValues(s: Style) {\n\t\tconst values: Record<string, unknown> = {};\n\t\tvalues.bold = s.bold;\n\t\tvalues.italic = s.italic;\n\t\tvalues.underline = s.underline;\n\t\tvalues.color = `#${s.color}`;\n\t\tvalues.fgColor = `#${s.fgColor || s.bgColor}`;\n\t\tvalues.sz = s.sz ? s.sz.toString() : null;\n\t\treturn values;\n\t}\n\t\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t}\n\n\t_onAction = (e: actions.ActionEvent) => {\n\t\tconst a = e.action;\n\t\tif (/^preview/.test(a.type)) return;\n\n\t\tconst data: Style = utils.cloneDeep(this.data);\n\t\tdelete data.id;\n\t\tdelete data.hash;\n\t\tswitch (a.key) {\n\t\t\tcase 'bold': data.bold = a.value ? true : false; break;\n\t\t\tcase 'italic': data.italic = a.value ? true : false; break;\n\t\t\tcase 'underline': data.underline = a.value ? true : false; break;\n\t\t\tcase 'sz': data.sz = a.value ? parseInt(a.value as string) : null; break;\n\t\t\tcase 'color': data.color = (a.value as string).substring(1); break;\n\t\t\tcase 'fgColor': data.fgColor = (a.value as string).substring(1); break;\n\t\t\tcase 'alignCenterCenter': data.alignment = {vertical: 'center', horizontal: 'center'}; break;\n\t\t\tcase 'alignTopLeft': data.alignment = {vertical: 'top', horizontal: 'left'}; break;\n\t\t\tcase 'alignTopCenter': data.alignment = {vertical: 'top', horizontal: 'center'}; break;\n\t\t\tcase 'alignTopRight': data.alignment = {vertical: 'top', horizontal: 'right'}; break;\n\t\t\tcase 'alignCenterLeft': data.alignment = {vertical: 'center', horizontal: 'left'}; break;\n\t\t\tcase 'alignCenterRight': data.alignment = {vertical: 'center', horizontal: 'right'}; break;\n\t\t\tcase 'alignBottomLeft': data.alignment = {vertical: 'bottom', horizontal: 'left'}; break;\n\t\t\tcase 'alignBottomCenter': data.alignment = {vertical: 'bottom', horizontal: 'center'}; break;\n\t\t\tcase 'alignBottomRight': data.alignment = {vertical: 'bottom', horizontal: 'right'}; break;\n\t\t}\n\n\t\tthis.data = data;\n\t\tthis.dispatchEvent(new events.ChangeEvent({value: data}));\n\t}\n\n\trender = () => html`\n\t\t<og-toolbar \n\t\t\t.items=\"${items}\"\n\t\t\t.values=\"${this.styleToToolbarValues(this.data)}\"\n\t\t\t@toolbar.action=\"${this._onAction}\">\n\t\t</og-toolbar>\n\t`;\n\n}"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TableTheme } from '@omegagrid/grid';
|
|
2
|
+
import { OmegaComponent, SortableList } from '@omegagrid/core';
|
|
3
|
+
import { TabContainer } from '@omegagrid/tabs';
|
|
4
|
+
type ThemeItemType = 'rows' | 'columns' | 'cells';
|
|
5
|
+
export declare class ThemeEditor extends OmegaComponent {
|
|
6
|
+
static styles: import("lit").CSSResultGroup[];
|
|
7
|
+
theme: TableTheme;
|
|
8
|
+
tabContainer: TabContainer;
|
|
9
|
+
private lists;
|
|
10
|
+
private listItems;
|
|
11
|
+
willUpdate(props: Map<string, unknown>): void;
|
|
12
|
+
updated(props: Map<string, unknown>): void;
|
|
13
|
+
createItemEditor: (type: ThemeItemType) => (div: HTMLDivElement, index: number) => void;
|
|
14
|
+
updateList(type: ThemeItemType): void;
|
|
15
|
+
moveItemUp(index: number, type: ThemeItemType): void;
|
|
16
|
+
moveItemDown(index: number, type: ThemeItemType): void;
|
|
17
|
+
moveItem(fromIndex: number, toIndex: number, type: ThemeItemType): void;
|
|
18
|
+
deleteItem(index: number, type: ThemeItemType): void;
|
|
19
|
+
addItem(type: ThemeItemType): void;
|
|
20
|
+
createComponent: (id: ThemeItemType) => SortableList;
|
|
21
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=themeEditor.d.ts.map
|
|
@@ -0,0 +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;IAQhE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa;IAQ7C,OAAO,CAAC,IAAI,EAAE,aAAa;IAQ3B,eAAe,GAAI,IAAI,aAAa,kBAgBnC;IAED,MAAM,6CAuBJ;CAEF"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
8
|
+
import { css, html } from 'lit';
|
|
9
|
+
import { dom, OmegaComponent } from '@omegagrid/core';
|
|
10
|
+
import { msg } from '@omegagrid/localize';
|
|
11
|
+
let ThemeEditor = class ThemeEditor extends OmegaComponent {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.createItemEditor = (type) => (div, index) => {
|
|
15
|
+
this.listItems = this.listItems || {};
|
|
16
|
+
this.listItems[type] = this.listItems[type] || [];
|
|
17
|
+
let editor = this.listItems[type][index] ? this.listItems[type][index] : null;
|
|
18
|
+
if (!editor) {
|
|
19
|
+
editor = dom.createElement('og-editor-themeitem', {
|
|
20
|
+
index: index,
|
|
21
|
+
themeItem: this.theme[type][index],
|
|
22
|
+
itemType: type,
|
|
23
|
+
editor: this
|
|
24
|
+
});
|
|
25
|
+
this.listItems[type][index] = editor;
|
|
26
|
+
}
|
|
27
|
+
dom.empty(div);
|
|
28
|
+
div.appendChild(editor);
|
|
29
|
+
};
|
|
30
|
+
this.createComponent = (id) => {
|
|
31
|
+
this.lists = this.lists || {};
|
|
32
|
+
if (this.lists[id])
|
|
33
|
+
return this.lists[id];
|
|
34
|
+
const list = dom.createElement('og-sortablelist');
|
|
35
|
+
list.style.height = '100%';
|
|
36
|
+
list.style.overflow = 'hidden';
|
|
37
|
+
list.scrollbarPadding = true;
|
|
38
|
+
list.disabledSelect = true;
|
|
39
|
+
list.customHandle = true;
|
|
40
|
+
list.dynamicItemHeight = true;
|
|
41
|
+
list.nativeHeight = true;
|
|
42
|
+
list.size = this.theme && this.theme[id] ? this.theme[id].length : 0;
|
|
43
|
+
list.itemRenderer = this.createItemEditor(id);
|
|
44
|
+
list.addEventListener('list.sort', (e) => this.moveItem(e.fromIndex, e.toIndex, id));
|
|
45
|
+
this.lists[id] = list;
|
|
46
|
+
return list;
|
|
47
|
+
};
|
|
48
|
+
this.render = () => html `
|
|
49
|
+
<div style="display: flex; flex-direction: column; height: 100%">
|
|
50
|
+
<div style="flex: 1; overflow: hidden">
|
|
51
|
+
<og-tabcontainer
|
|
52
|
+
fixed
|
|
53
|
+
style="height: 100%"
|
|
54
|
+
.createComponent="${this.createComponent}"
|
|
55
|
+
.items="${[
|
|
56
|
+
{ id: 'rows', title: msg('Rows') },
|
|
57
|
+
{ id: 'columns', title: msg('Columns') },
|
|
58
|
+
{ id: 'cells', title: msg('Cells') }
|
|
59
|
+
]}">
|
|
60
|
+
</og-tabcontainer>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div style="flex: 0; padding-top: 5px">
|
|
64
|
+
<og-button
|
|
65
|
+
@click="${() => this.addItem(this.tabContainer.selectedId)}"
|
|
66
|
+
icon="plus"
|
|
67
|
+
style="width: 100%">
|
|
68
|
+
</og-button>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
willUpdate(props) {
|
|
74
|
+
this.theme = this.theme || { name: '' };
|
|
75
|
+
if (props.has('theme')) {
|
|
76
|
+
this.listItems = {};
|
|
77
|
+
this.lists = {};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
updated(props) {
|
|
81
|
+
if (props.has('theme'))
|
|
82
|
+
this.tabContainer?.refresh();
|
|
83
|
+
}
|
|
84
|
+
updateList(type) {
|
|
85
|
+
this.listItems[type] = [];
|
|
86
|
+
this.lists[type].size = this.theme[type].length;
|
|
87
|
+
this.lists[type].renderItems(true);
|
|
88
|
+
}
|
|
89
|
+
moveItemUp(index, type) {
|
|
90
|
+
if (index === 0)
|
|
91
|
+
return;
|
|
92
|
+
this.moveItem(index, index - 1, type);
|
|
93
|
+
}
|
|
94
|
+
moveItemDown(index, type) {
|
|
95
|
+
if (index >= this.listItems[type].length - 1)
|
|
96
|
+
return;
|
|
97
|
+
this.moveItem(index, index + 1, type);
|
|
98
|
+
}
|
|
99
|
+
moveItem(fromIndex, toIndex, type) {
|
|
100
|
+
const items = this.theme[type];
|
|
101
|
+
if (!this.theme[type])
|
|
102
|
+
return;
|
|
103
|
+
const item = items.splice(fromIndex, 1)[0];
|
|
104
|
+
items.splice(toIndex, 0, item);
|
|
105
|
+
this.updateList(type);
|
|
106
|
+
}
|
|
107
|
+
deleteItem(index, type) {
|
|
108
|
+
const items = this.theme[type];
|
|
109
|
+
if (!this.theme[type])
|
|
110
|
+
return;
|
|
111
|
+
items.splice(index, 1);
|
|
112
|
+
this.theme[type] = items;
|
|
113
|
+
this.updateList(type);
|
|
114
|
+
}
|
|
115
|
+
addItem(type) {
|
|
116
|
+
const items = this.theme[type] ?? [];
|
|
117
|
+
items.push({});
|
|
118
|
+
this.theme[type] = items;
|
|
119
|
+
this.updateList(type);
|
|
120
|
+
this.lists[type].scrollToIndex(items.length - 1);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
ThemeEditor.styles = [OmegaComponent.styles, css `
|
|
124
|
+
:host {
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
}
|
|
127
|
+
`];
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: Object })
|
|
130
|
+
], ThemeEditor.prototype, "theme", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
query('og-tabcontainer')
|
|
133
|
+
], ThemeEditor.prototype, "tabContainer", void 0);
|
|
134
|
+
ThemeEditor = __decorate([
|
|
135
|
+
customElement('og-editor-theme')
|
|
136
|
+
], ThemeEditor);
|
|
137
|
+
export { ThemeEditor };
|
|
138
|
+
//# sourceMappingURL=themeEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeEditor.js","sourceRoot":"","sources":["../../../src/ui/editors/themeEditor.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,EAAE,GAAG,EAAiB,cAAc,EAA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C,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,CAiIvB","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\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}\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}\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}\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}"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConditionalFormatType, Style, ThemeColumnItem, ThemeRowItem } from '@omegagrid/grid';
|
|
2
|
+
import { events, OmegaComponent } from '@omegagrid/core';
|
|
3
|
+
import { RuleEditor } from './ruleEditor';
|
|
4
|
+
import { StyleEditor } from './styleEditor';
|
|
5
|
+
import { ThemeEditor } from './themeEditor';
|
|
6
|
+
type ThemeItemType = 'rows' | 'columns' | 'cells';
|
|
7
|
+
export declare class ThemeItemEditor extends OmegaComponent {
|
|
8
|
+
index: number;
|
|
9
|
+
themeItem: ThemeColumnItem & ThemeRowItem;
|
|
10
|
+
itemType: ThemeItemType;
|
|
11
|
+
editor: ThemeEditor;
|
|
12
|
+
moveHandle: HTMLElement;
|
|
13
|
+
ruleEditor: RuleEditor;
|
|
14
|
+
styleEditor: StyleEditor;
|
|
15
|
+
static styles: import("lit").CSSResultGroup[];
|
|
16
|
+
willUpdate(): void;
|
|
17
|
+
updateRuleType(type: ConditionalFormatType): void;
|
|
18
|
+
_onStyleChange: (e: events.ChangeEvent<Style>) => void;
|
|
19
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=themeItemEditor.d.ts.map
|
|
@@ -0,0 +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;AAEzG,OAAO,EAAE,MAAM,EAAY,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEnE,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;AAU9C,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,iCA6CV;IAEH,UAAU;IAKV,cAAc,CAAC,IAAI,EAAE,qBAAqB;IAS1C,cAAc,GAAI,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,UAE7C;IAED,MAAM,6CAsEJ;CACF"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
8
|
+
import { css, html } from 'lit';
|
|
9
|
+
import { OmegaComponent } from '@omegagrid/core';
|
|
10
|
+
import { msg } from '@omegagrid/localize';
|
|
11
|
+
const ruleTypes = [
|
|
12
|
+
{ key: null, value: 'Static style' },
|
|
13
|
+
{ key: 'formula', value: 'Formula' },
|
|
14
|
+
{ key: 'scale', value: 'Scale' },
|
|
15
|
+
{ key: 'bar', value: 'Data Bar' },
|
|
16
|
+
{ key: 'icon', value: 'Icon Set' },
|
|
17
|
+
];
|
|
18
|
+
let ThemeItemEditor = class ThemeItemEditor extends OmegaComponent {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this._onStyleChange = (e) => {
|
|
22
|
+
this.themeItem.style = e.value;
|
|
23
|
+
};
|
|
24
|
+
this.render = () => html `
|
|
25
|
+
<div class="header">
|
|
26
|
+
<div style="flex: 1" class="move-handle">${msg('Rule')} #${this.index + 1}</div>
|
|
27
|
+
|
|
28
|
+
<div>
|
|
29
|
+
<og-dropdown-menu
|
|
30
|
+
noCaret
|
|
31
|
+
dynamicWidth
|
|
32
|
+
alignment="right"
|
|
33
|
+
color="transparent"
|
|
34
|
+
.items="${[{
|
|
35
|
+
key: 'moveUp',
|
|
36
|
+
value: msg('Move up'),
|
|
37
|
+
icon: 'arrow-up',
|
|
38
|
+
exec: () => this.editor.moveItemUp(this.index, this.itemType)
|
|
39
|
+
}, {
|
|
40
|
+
key: 'moveDown',
|
|
41
|
+
value: msg('Move down'),
|
|
42
|
+
icon: 'arrow-down',
|
|
43
|
+
exec: () => this.editor.moveItemDown(this.index, this.itemType)
|
|
44
|
+
}, {
|
|
45
|
+
key: 'delete',
|
|
46
|
+
value: msg('Delete'),
|
|
47
|
+
icon: 'trash',
|
|
48
|
+
color: 'red',
|
|
49
|
+
exec: () => this.editor.deleteItem(this.index, this.itemType)
|
|
50
|
+
}]}">
|
|
51
|
+
<div slot="label"><og-icon icon="ellipsis"></og-icon></div>
|
|
52
|
+
</og-dropdown-menu>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
${this.itemType != 'cells' ? html `
|
|
57
|
+
<div class="row">${msg('Conditions')}</div>
|
|
58
|
+
|
|
59
|
+
<div class="row">
|
|
60
|
+
<label>${msg('Level')}</label>
|
|
61
|
+
<og-numericinput buttons min="0" .value="${this.themeItem?.level}"></og-numericinput>
|
|
62
|
+
<label>${msg('Index')}</label>
|
|
63
|
+
<og-numericinput buttons min="0" .value="${this.themeItem?.index}"></og-numericinput>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div class="row">
|
|
67
|
+
<label>${msg('Name')}</label>
|
|
68
|
+
<og-input></og-input>
|
|
69
|
+
</div>
|
|
70
|
+
` : ''}
|
|
71
|
+
|
|
72
|
+
<div class="row">${msg('Style definition')}</div>
|
|
73
|
+
|
|
74
|
+
<div class="row">
|
|
75
|
+
<og-dropdown-list
|
|
76
|
+
.value = "${this.themeItem?.type ?? null}"
|
|
77
|
+
.items="${ruleTypes}"
|
|
78
|
+
@change="${(e) => this.updateRuleType(e.value)}">
|
|
79
|
+
</og-dropdown-list>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
<div>
|
|
83
|
+
${this.themeItem?.type ? html `
|
|
84
|
+
<og-editor-ruleeditor
|
|
85
|
+
.format="${this.themeItem}">
|
|
86
|
+
</og-editor-ruleeditor>
|
|
87
|
+
` : html `
|
|
88
|
+
<og-editor-styleeditor
|
|
89
|
+
@change="${this._onStyleChange}"
|
|
90
|
+
.data="${this.themeItem.style}">
|
|
91
|
+
</og-editor-styleeditor>
|
|
92
|
+
`}
|
|
93
|
+
</div>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
willUpdate() {
|
|
97
|
+
this.themeItem = this.themeItem || {};
|
|
98
|
+
this.updateRuleType(this.themeItem.type);
|
|
99
|
+
}
|
|
100
|
+
updateRuleType(type) {
|
|
101
|
+
this.themeItem.type = type;
|
|
102
|
+
if (type)
|
|
103
|
+
delete this.themeItem.style;
|
|
104
|
+
else
|
|
105
|
+
this.themeItem.style = this.themeItem.style || {};
|
|
106
|
+
this.requestUpdate();
|
|
107
|
+
this.ruleEditor?.requestUpdate();
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
ThemeItemEditor.styles = [OmegaComponent.styles, css `
|
|
111
|
+
:host {
|
|
112
|
+
line-height: 22px;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.row {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: row;
|
|
118
|
+
margin: 2px 0;
|
|
119
|
+
align-items: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
label {
|
|
123
|
+
flex: 0 60px;
|
|
124
|
+
text-align: right;
|
|
125
|
+
margin-right: 10px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
og-dropdown-list, og-dropdown-menu, og-editor-ruleeditor {
|
|
129
|
+
line-height: 16px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
og-numericinput, og-input {
|
|
133
|
+
flex: 1;
|
|
134
|
+
display: block;
|
|
135
|
+
width: 100%;
|
|
136
|
+
line-height: 20px;
|
|
137
|
+
text-align: center;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.move-handle {
|
|
141
|
+
cursor: move;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
og-dropdown-list {
|
|
145
|
+
flex: 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.header {
|
|
149
|
+
padding-left: 5px;
|
|
150
|
+
border-top: 1px solid var(--og-border-color);
|
|
151
|
+
border-bottom: 1px solid var(--og-border-color);
|
|
152
|
+
display: flex;
|
|
153
|
+
flex-direction: row;
|
|
154
|
+
}
|
|
155
|
+
`];
|
|
156
|
+
__decorate([
|
|
157
|
+
property({ type: Number })
|
|
158
|
+
], ThemeItemEditor.prototype, "index", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
property({ type: Object })
|
|
161
|
+
], ThemeItemEditor.prototype, "themeItem", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
property({ type: String })
|
|
164
|
+
], ThemeItemEditor.prototype, "itemType", void 0);
|
|
165
|
+
__decorate([
|
|
166
|
+
property({ type: Object })
|
|
167
|
+
], ThemeItemEditor.prototype, "editor", void 0);
|
|
168
|
+
__decorate([
|
|
169
|
+
query('.move-handle')
|
|
170
|
+
], ThemeItemEditor.prototype, "moveHandle", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
query('og-editor-ruleeditor')
|
|
173
|
+
], ThemeItemEditor.prototype, "ruleEditor", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
query('og-editor-styleeditor')
|
|
176
|
+
], ThemeItemEditor.prototype, "styleEditor", void 0);
|
|
177
|
+
ThemeItemEditor = __decorate([
|
|
178
|
+
customElement('og-editor-themeitem')
|
|
179
|
+
], ThemeItemEditor);
|
|
180
|
+
export { ThemeItemEditor };
|
|
181
|
+
//# sourceMappingURL=themeItemEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeItemEditor.js","sourceRoot":"","sources":["../../../src/ui/editors/themeItemEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAA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C;IAED,cAAc,CAAC,IAA2B;QACzC,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;QAC3B,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;;YACjC,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAW,CAAC;QAEhE,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,UAAU,EAAE,aAAa,EAAE,CAAC;IAClC,CAAC;;AA3DM,sBAAM,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6C1C,CAAC,AA7CW,CA6CV;AAjEH;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,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>\n\t\t\t`}\n\t\t</div>\n\t`;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FormContainer } from "@omegagrid/form";
|
|
2
|
+
import { Grid, GridGroup, GridModel } from '@omegagrid/grid';
|
|
3
|
+
export declare class ConfigForm extends FormContainer {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
model: GridModel;
|
|
6
|
+
grid: Grid;
|
|
7
|
+
group: GridGroup;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
firstUpdated(): void;
|
|
10
|
+
updated(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=configForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configForm.d.ts","sourceRoot":"","sources":["../../../src/ui/forms/configForm.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAqD,MAAM,iBAAiB,CAAC;AACnG,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAgCpE,qBACa,UAAW,SAAQ,aAAa;IAE5C,MAAM,CAAC,MAAM,4BAA6B;IAG1C,KAAK,EAAE,SAAS,CAAC;IAGjB,IAAI,EAAE,IAAI,CAAC;IAGX,KAAK,EAAE,SAAS,CAAC;IAEjB,iBAAiB;IAKjB,YAAY;IAgCN,OAAO;CAmBb"}
|