@omegagrid/editor 0.10.1 → 0.10.2
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/package.json +10 -10
- package/dist/commands/index.d.ts +0 -3
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -34
- package/dist/commands/index.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/options.d.ts +0 -12
- package/dist/options.d.ts.map +0 -1
- package/dist/options.js +0 -14
- package/dist/options.js.map +0 -1
- package/dist/ui/editor.d.ts +0 -76
- package/dist/ui/editor.d.ts.map +0 -1
- package/dist/ui/editor.js +0 -338
- package/dist/ui/editor.js.map +0 -1
- package/dist/ui/editor.style.d.ts +0 -2
- package/dist/ui/editor.style.d.ts.map +0 -1
- package/dist/ui/editor.style.js +0 -38
- package/dist/ui/editor.style.js.map +0 -1
- package/dist/ui/editorZoom.d.ts +0 -16
- package/dist/ui/editorZoom.d.ts.map +0 -1
- package/dist/ui/editorZoom.js +0 -82
- package/dist/ui/editorZoom.js.map +0 -1
- package/dist/ui/editors/hyperlinkEditor.d.ts +0 -10
- package/dist/ui/editors/hyperlinkEditor.d.ts.map +0 -1
- package/dist/ui/editors/hyperlinkEditor.js +0 -70
- package/dist/ui/editors/hyperlinkEditor.js.map +0 -1
- package/dist/ui/editors/index.d.ts +0 -6
- package/dist/ui/editors/index.d.ts.map +0 -1
- package/dist/ui/editors/index.js +0 -6
- package/dist/ui/editors/index.js.map +0 -1
- package/dist/ui/editors/ruleEditor.d.ts +0 -27
- package/dist/ui/editors/ruleEditor.d.ts.map +0 -1
- package/dist/ui/editors/ruleEditor.js +0 -251
- package/dist/ui/editors/ruleEditor.js.map +0 -1
- package/dist/ui/editors/styleEditor.d.ts +0 -14
- package/dist/ui/editors/styleEditor.d.ts.map +0 -1
- package/dist/ui/editors/styleEditor.js +0 -160
- package/dist/ui/editors/styleEditor.js.map +0 -1
- package/dist/ui/editors/themeEditor.d.ts +0 -24
- package/dist/ui/editors/themeEditor.d.ts.map +0 -1
- package/dist/ui/editors/themeEditor.js +0 -138
- package/dist/ui/editors/themeEditor.js.map +0 -1
- package/dist/ui/editors/themeItemEditor.d.ts +0 -22
- package/dist/ui/editors/themeItemEditor.d.ts.map +0 -1
- package/dist/ui/editors/themeItemEditor.js +0 -181
- package/dist/ui/editors/themeItemEditor.js.map +0 -1
- package/dist/ui/forms/configForm.d.ts +0 -12
- package/dist/ui/forms/configForm.d.ts.map +0 -1
- package/dist/ui/forms/configForm.js +0 -101
- package/dist/ui/forms/configForm.js.map +0 -1
- package/dist/ui/forms/headerForm.d.ts +0 -18
- package/dist/ui/forms/headerForm.d.ts.map +0 -1
- package/dist/ui/forms/headerForm.js +0 -144
- package/dist/ui/forms/headerForm.js.map +0 -1
- package/dist/ui/forms/index.d.ts +0 -9
- package/dist/ui/forms/index.d.ts.map +0 -1
- package/dist/ui/forms/index.js +0 -9
- package/dist/ui/forms/index.js.map +0 -1
- package/dist/ui/forms/namesForm.d.ts +0 -21
- package/dist/ui/forms/namesForm.d.ts.map +0 -1
- package/dist/ui/forms/namesForm.js +0 -124
- package/dist/ui/forms/namesForm.js.map +0 -1
- package/dist/ui/forms/ruleForm.d.ts +0 -13
- package/dist/ui/forms/ruleForm.d.ts.map +0 -1
- package/dist/ui/forms/ruleForm.js +0 -56
- package/dist/ui/forms/ruleForm.js.map +0 -1
- package/dist/ui/forms/ruleForm.style.d.ts +0 -2
- package/dist/ui/forms/ruleForm.style.d.ts.map +0 -1
- package/dist/ui/forms/ruleForm.style.js +0 -50
- package/dist/ui/forms/ruleForm.style.js.map +0 -1
- package/dist/ui/forms/ruleFormThreshold.d.ts +0 -19
- package/dist/ui/forms/ruleFormThreshold.d.ts.map +0 -1
- package/dist/ui/forms/ruleFormThreshold.js +0 -97
- package/dist/ui/forms/ruleFormThreshold.js.map +0 -1
- package/dist/ui/forms/ruleList.d.ts +0 -25
- package/dist/ui/forms/ruleList.d.ts.map +0 -1
- package/dist/ui/forms/ruleList.js +0 -169
- package/dist/ui/forms/ruleList.js.map +0 -1
- package/dist/ui/forms/ruleList.style.d.ts +0 -3
- package/dist/ui/forms/ruleList.style.d.ts.map +0 -1
- package/dist/ui/forms/ruleList.style.js +0 -69
- package/dist/ui/forms/ruleList.style.js.map +0 -1
- package/dist/ui/forms/sparklineForm.d.ts +0 -22
- package/dist/ui/forms/sparklineForm.d.ts.map +0 -1
- package/dist/ui/forms/sparklineForm.js +0 -199
- package/dist/ui/forms/sparklineForm.js.map +0 -1
- package/dist/ui/forms/sparklineForm.style.d.ts +0 -3
- package/dist/ui/forms/sparklineForm.style.d.ts.map +0 -1
- package/dist/ui/forms/sparklineForm.style.js +0 -94
- package/dist/ui/forms/sparklineForm.style.js.map +0 -1
- package/dist/ui/forms/styleForm.d.ts +0 -14
- package/dist/ui/forms/styleForm.d.ts.map +0 -1
- package/dist/ui/forms/styleForm.js +0 -151
- package/dist/ui/forms/styleForm.js.map +0 -1
- package/dist/ui/formulabar.d.ts +0 -23
- package/dist/ui/formulabar.d.ts.map +0 -1
- package/dist/ui/formulabar.js +0 -155
- package/dist/ui/formulabar.js.map +0 -1
- package/dist/ui/formulabar.style.d.ts +0 -2
- package/dist/ui/formulabar.style.d.ts.map +0 -1
- package/dist/ui/formulabar.style.js +0 -48
- package/dist/ui/formulabar.style.js.map +0 -1
- package/dist/ui/gridStats.d.ts +0 -11
- package/dist/ui/gridStats.d.ts.map +0 -1
- package/dist/ui/gridStats.js +0 -71
- package/dist/ui/gridStats.js.map +0 -1
- package/dist/ui/index.d.ts +0 -11
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/index.js +0 -11
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/sidebars/baseSidebar.d.ts +0 -10
- package/dist/ui/sidebars/baseSidebar.d.ts.map +0 -1
- package/dist/ui/sidebars/baseSidebar.js +0 -24
- package/dist/ui/sidebars/baseSidebar.js.map +0 -1
- package/dist/ui/sidebars/index.d.ts +0 -2
- package/dist/ui/sidebars/index.d.ts.map +0 -1
- package/dist/ui/sidebars/index.js +0 -2
- package/dist/ui/sidebars/index.js.map +0 -1
- package/dist/ui/sidebars/themeEditorSidebar.d.ts +0 -14
- package/dist/ui/sidebars/themeEditorSidebar.d.ts.map +0 -1
- package/dist/ui/sidebars/themeEditorSidebar.js +0 -110
- package/dist/ui/sidebars/themeEditorSidebar.js.map +0 -1
- package/dist/ui/statusbar.d.ts +0 -19
- package/dist/ui/statusbar.d.ts.map +0 -1
- package/dist/ui/statusbar.js +0 -69
- package/dist/ui/statusbar.js.map +0 -1
- package/dist/ui/toolbar.config.d.ts +0 -7
- package/dist/ui/toolbar.config.d.ts.map +0 -1
- package/dist/ui/toolbar.config.js +0 -166
- package/dist/ui/toolbar.config.js.map +0 -1
- package/dist/ui/toolbar.d.ts +0 -42
- package/dist/ui/toolbar.d.ts.map +0 -1
- package/dist/ui/toolbar.js +0 -356
- package/dist/ui/toolbar.js.map +0 -1
- package/dist/ui/toolbar.style.d.ts +0 -2
- package/dist/ui/toolbar.style.d.ts.map +0 -1
- package/dist/ui/toolbar.style.js +0 -22
- package/dist/ui/toolbar.style.js.map +0 -1
|
@@ -1,199 +0,0 @@
|
|
|
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 { CellRange } from '@omegagrid/grid';
|
|
9
|
-
import { html, LitElement } from 'lit';
|
|
10
|
-
import { itemStyle, style } from './sparklineForm.style';
|
|
11
|
-
import { msg } from '@omegagrid/localize';
|
|
12
|
-
const minMaxItems = [
|
|
13
|
-
{ k: 'auto', v: 'auto' },
|
|
14
|
-
{ k: 'common', v: 'common' }
|
|
15
|
-
];
|
|
16
|
-
const optionToolbarItems = [
|
|
17
|
-
{ type: 'dropdown', id: 'chartType', width: 80, items: [
|
|
18
|
-
{ k: 'column', v: 'column', icon: 'chart-column' },
|
|
19
|
-
{ k: 'line', v: 'line', icon: 'chart-line' }
|
|
20
|
-
] },
|
|
21
|
-
{ type: 'color', id: 'color', icon: { icon: 'fill' } },
|
|
22
|
-
{ type: 'text', id: 'min', width: 80, items: minMaxItems, placeholder: '<min>' },
|
|
23
|
-
{ type: 'text', id: 'max', width: 80, items: minMaxItems, placeholder: '<max>' }
|
|
24
|
-
];
|
|
25
|
-
function stringToSparklineExtrme(v) {
|
|
26
|
-
if (v === '' || v == null)
|
|
27
|
-
return 'auto';
|
|
28
|
-
if (v == 'auto' || v == 'common')
|
|
29
|
-
return v;
|
|
30
|
-
return parseFloat(v);
|
|
31
|
-
}
|
|
32
|
-
let SparklineForm = class SparklineForm extends LitElement {
|
|
33
|
-
constructor() {
|
|
34
|
-
super(...arguments);
|
|
35
|
-
this.updateList = () => {
|
|
36
|
-
this._groupIndexMap = null;
|
|
37
|
-
this.list.size = this.model.sparklines.groups.size;
|
|
38
|
-
this.list.renderItems(true);
|
|
39
|
-
};
|
|
40
|
-
this._onApplyClick = () => {
|
|
41
|
-
this.grid.model.refreshSparklines();
|
|
42
|
-
this.grid.rendering.render(true);
|
|
43
|
-
};
|
|
44
|
-
this._onOptionsToolbarAction = (e, groupIndex) => {
|
|
45
|
-
const a = e.action;
|
|
46
|
-
const group = this.model.sparklines.groups.get(groupIndex);
|
|
47
|
-
if (/^preview/.test(a.type))
|
|
48
|
-
return;
|
|
49
|
-
switch (a.key) {
|
|
50
|
-
case 'chartType':
|
|
51
|
-
group.type = a.value;
|
|
52
|
-
break;
|
|
53
|
-
case 'color':
|
|
54
|
-
group.style.color = a.value.substring(1);
|
|
55
|
-
break;
|
|
56
|
-
case 'min':
|
|
57
|
-
group.minValue = stringToSparklineExtrme(a.value);
|
|
58
|
-
break;
|
|
59
|
-
case 'max':
|
|
60
|
-
group.maxValue = stringToSparklineExtrme(a.value);
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
this._itemRenderer = (_div, index) => {
|
|
65
|
-
const groupIndex = this.groupIndexMap.get(index);
|
|
66
|
-
const group = this.model.sparklines.groups.get(groupIndex);
|
|
67
|
-
return html `
|
|
68
|
-
<div class="item-content p">
|
|
69
|
-
<div class="item-form">
|
|
70
|
-
<div class="row item-header">
|
|
71
|
-
<div class="item-header-title">Definition #${index + 1}</div>
|
|
72
|
-
<div class="item-header-controls">
|
|
73
|
-
<og-button
|
|
74
|
-
icon="trash"
|
|
75
|
-
color="red"
|
|
76
|
-
@click="${() => this.deleteGroup(groupIndex)}">
|
|
77
|
-
</og-button>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
<div class="row">Location range</div>
|
|
82
|
-
<div class="row">
|
|
83
|
-
<og-input
|
|
84
|
-
data-id="locRange"
|
|
85
|
-
.value="${group.locRange?.A1 || ''}"
|
|
86
|
-
style="width: 100%"
|
|
87
|
-
@change="${(e) => this._onInputChange(e, groupIndex)}">
|
|
88
|
-
</og-input>
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
<div class="row">Data range</div>
|
|
92
|
-
<div class="row">
|
|
93
|
-
<og-input
|
|
94
|
-
data-id="dataRange"
|
|
95
|
-
.value="${(group.dataRanges ? CellRange.toA1s(group.dataRanges.map(item => item[0])) : null) || ''}"
|
|
96
|
-
style="width: 100%"
|
|
97
|
-
@change="${(e) => this._onInputChange(e, groupIndex)}">
|
|
98
|
-
</og-input>
|
|
99
|
-
</div>
|
|
100
|
-
|
|
101
|
-
<div class="row">Options</div>
|
|
102
|
-
<div class="row">
|
|
103
|
-
<og-toolbar
|
|
104
|
-
.items="${optionToolbarItems}"
|
|
105
|
-
.values="${this.getToolbarValues(group)}"
|
|
106
|
-
@toolbar.action="${(e) => this._onOptionsToolbarAction(e, groupIndex)}">
|
|
107
|
-
</og-toolbar>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
`;
|
|
112
|
-
};
|
|
113
|
-
this.render = () => this.model ? html `
|
|
114
|
-
<div class="controls p">
|
|
115
|
-
<og-button text="+" @click="${() => this.addGroup()}"></og-button>
|
|
116
|
-
<og-button @click="${this._onApplyClick}">
|
|
117
|
-
<div slot="content"><og-icon icon="refresh"></og-icon> ${msg('Apply')}</div>
|
|
118
|
-
</og-button>
|
|
119
|
-
</div>
|
|
120
|
-
<div class="body">
|
|
121
|
-
<og-list ?nativeHeight="${true}"
|
|
122
|
-
itemHeight="170"
|
|
123
|
-
.customStyle=${itemStyle}
|
|
124
|
-
.itemRenderer="${this._itemRenderer}"
|
|
125
|
-
.size="${this.model.sparklines.groups.size}">
|
|
126
|
-
</og-list>
|
|
127
|
-
</div>
|
|
128
|
-
` : '';
|
|
129
|
-
}
|
|
130
|
-
get groupIndexMap() {
|
|
131
|
-
if (!this._groupIndexMap) {
|
|
132
|
-
this._groupIndexMap = new Map();
|
|
133
|
-
let i = 0;
|
|
134
|
-
this.model.sparklines.groups.forEach((_group, index) => this._groupIndexMap.set(i++, index));
|
|
135
|
-
}
|
|
136
|
-
return this._groupIndexMap;
|
|
137
|
-
}
|
|
138
|
-
connectedCallback() {
|
|
139
|
-
super.connectedCallback();
|
|
140
|
-
}
|
|
141
|
-
// moveRuleUp(index: number) {
|
|
142
|
-
// if (index == 0) return;
|
|
143
|
-
// const formats = this.model.conditionalFormats.formats;
|
|
144
|
-
// formats.splice(index - 1, 0, formats.splice(index, 1)[0]);
|
|
145
|
-
// this.updateList();
|
|
146
|
-
// }
|
|
147
|
-
// moveRuleDown(index: number) {
|
|
148
|
-
// const formats = this.model.conditionalFormats.formats;
|
|
149
|
-
// if (index >= formats.length) return;
|
|
150
|
-
// formats.splice(index + 1, 0, formats.splice(index, 1)[0]);
|
|
151
|
-
// this.updateList();
|
|
152
|
-
// }
|
|
153
|
-
deleteGroup(index) {
|
|
154
|
-
this.model.sparklines.delete(index);
|
|
155
|
-
this.updateList();
|
|
156
|
-
}
|
|
157
|
-
addGroup() {
|
|
158
|
-
this.model.sparklines.add(null, null);
|
|
159
|
-
this.updateList();
|
|
160
|
-
}
|
|
161
|
-
_onInputChange(e, groupIndex) {
|
|
162
|
-
const sparklines = this.model.sparklines;
|
|
163
|
-
const group = sparklines.groups.get(groupIndex);
|
|
164
|
-
const input = e.target;
|
|
165
|
-
switch (input.dataset.id) {
|
|
166
|
-
case 'locRange':
|
|
167
|
-
sparklines.update(groupIndex, input.value ? CellRange.fromA1(input.value) : null, group.dataRanges);
|
|
168
|
-
break;
|
|
169
|
-
case 'dataRange':
|
|
170
|
-
sparklines.update(groupIndex, group.locRange, input.value
|
|
171
|
-
? CellRange.fromA1s(input.value).map(r => ([r, null]))
|
|
172
|
-
: null);
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
getToolbarValues(options) {
|
|
177
|
-
return {
|
|
178
|
-
chartType: options.type,
|
|
179
|
-
color: `#${options.style.color}`,
|
|
180
|
-
min: options.minValue,
|
|
181
|
-
max: options.maxValue,
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
SparklineForm.styles = [style];
|
|
186
|
-
__decorate([
|
|
187
|
-
property({ type: Object })
|
|
188
|
-
], SparklineForm.prototype, "grid", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
property({ type: Object })
|
|
191
|
-
], SparklineForm.prototype, "model", void 0);
|
|
192
|
-
__decorate([
|
|
193
|
-
query('og-list')
|
|
194
|
-
], SparklineForm.prototype, "list", void 0);
|
|
195
|
-
SparklineForm = __decorate([
|
|
196
|
-
customElement('og-editor-form-sparklines')
|
|
197
|
-
], SparklineForm);
|
|
198
|
-
export { SparklineForm };
|
|
199
|
-
//# sourceMappingURL=sparklineForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sparklineForm.js","sourceRoot":"","sources":["../../../src/ui/forms/sparklineForm.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAA2E,MAAM,iBAAiB,CAAC;AACrH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,WAAW,GAAG;IACnB,EAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAC;IACtB,EAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAC;CAC1B,CAAC;AAEF,MAAM,kBAAkB,GAAkB;IACzC,EAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE;YACrD,EAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAC;YAChD,EAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAC;SAC1C,EAAC;IACF,EAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC,EAAC;IAClD,EAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK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B;QACzC,OAAO;YACN,SAAS,EAAE,OAAO,CAAC,IAAI;YACvB,KAAK,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE;YAChC,GAAG,EAAE,OAAO,CAAC,QAAQ;YACrB,GAAG,EAAE,OAAO,CAAC,QAAQ;SACrB,CAAC;IACH,CAAC;;AA7FM,oBAAM,GAAG,CAAC,KAAK,CAAC,AAAV,CAAW;AAGxB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;2CACd;AAGX;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;4CACR;AAGjB;IADC,KAAK,CAAC,SAAS,CAAC;2CACN;AAXC,aAAa;IADzB,aAAa,CAAC,2BAA2B,CAAC;GAC9B,aAAa,CAmKzB","sourcesContent":["import { actions, Input, List } from '@omegagrid/core';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { CellRange, Grid, GridModel, SparklineExtremeValue, SparklineOptions, SparklineType } from '@omegagrid/grid';\nimport { html, LitElement } from 'lit';\nimport { itemStyle, style } from './sparklineForm.style';\nimport { ToolbarItem } from '@omegagrid/toolbar';\nimport { msg } from '@omegagrid/localize';\n\nconst minMaxItems = [\n\t{k: 'auto', v: 'auto'},\n\t{k: 'common', v: 'common'}\n];\n\nconst optionToolbarItems: ToolbarItem[] = [\n\t{type: 'dropdown', id: 'chartType', width: 80, items: [\n\t\t{k: 'column', v: 'column', icon: 'chart-column'},\n\t\t{k: 'line', v: 'line', icon: 'chart-line'}\n\t]},\n\t{type: 'color', id: 'color', icon: {icon: 'fill'}},\n\t{type: 'text', id: 'min', width: 80, items: minMaxItems, placeholder: '<min>'},\n\t{type: 'text', id: 'max', width: 80, items: minMaxItems, placeholder: '<max>'}\n];\n\nfunction stringToSparklineExtrme(v: string): SparklineExtremeValue {\n\tif (v === '' || v == null) return 'auto';\n\tif (v == 'auto' || v == 'common') return v;\n\treturn parseFloat(v);\n}\n\n@customElement('og-editor-form-sparklines')\nexport class SparklineForm 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\t_groupIndexMap: Map<number, number>;\n\tget groupIndexMap() {\n\t\tif (!this._groupIndexMap) {\n\t\t\tthis._groupIndexMap = new Map();\n\t\t\tlet i = 0;\n\t\t\tthis.model.sparklines.groups.forEach((_group, index) => this._groupIndexMap.set(i++, index));\n\t\t}\n\t\treturn this._groupIndexMap;\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t}\n\n\tupdateList = () => {\n\t\tthis._groupIndexMap = null;\n\t\tthis.list.size = this.model.sparklines.groups.size;\n\t\tthis.list.renderItems(true);\n\t}\n\n\t// moveRuleUp(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\t\n\t// moveRuleDown(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\tdeleteGroup(index: number) {\n\t\tthis.model.sparklines.delete(index);\n\t\tthis.updateList();\n\t}\n\n\taddGroup() {\n\t\tthis.model.sparklines.add(null, null);\n\t\tthis.updateList();\n\t}\n\n\t_onApplyClick = () => {\n\t\tthis.grid.model.refreshSparklines();\n\t\tthis.grid.rendering.render(true);\n\t}\n\n\t_onInputChange(e: Event, groupIndex: number) {\n\t\tconst sparklines = this.model.sparklines;\n\t\tconst group = sparklines.groups.get(groupIndex);\n\t\tconst input = e.target as Input;\n\t\tswitch (input.dataset.id) {\n\t\t\tcase 'locRange': sparklines.update(groupIndex, input.value ? CellRange.fromA1(input.value) : null, group.dataRanges); break;\n\t\t\tcase 'dataRange': \n\t\t\t\tsparklines.update(groupIndex, group.locRange, input.value \n\t\t\t\t\t? CellRange.fromA1s(input.value).map(r => ([r, null as string])) \n\t\t\t\t\t: null);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t_onOptionsToolbarAction = (e: actions.ActionEvent, groupIndex: number) => {\n\t\tconst a = e.action;\n\t\tconst group = this.model.sparklines.groups.get(groupIndex);\n\t\tif (/^preview/.test(a.type)) return;\n\t\tswitch (a.key) {\n\t\t\tcase 'chartType': group.type = a.value as SparklineType; break;\n\t\t\tcase 'color': group.style.color = (a.value as string).substring(1); break;\n\t\t\tcase 'min': group.minValue = stringToSparklineExtrme(a.value as string); break;\n\t\t\tcase 'max': group.maxValue = stringToSparklineExtrme(a.value as string); break;\n\t\t}\n\t}\n\n\tgetToolbarValues(options: SparklineOptions): Record<string, unknown> {\n\t\treturn {\n\t\t\tchartType: options.type,\n\t\t\tcolor: `#${options.style.color}`,\n\t\t\tmin: options.minValue,\n\t\t\tmax: options.maxValue,\n\t\t};\n\t}\n\n\t_itemRenderer = (_div: HTMLDivElement, index: number) => {\n\t\tconst groupIndex = this.groupIndexMap.get(index);\n\t\tconst group = this.model.sparklines.groups.get(groupIndex);\n\t\treturn html`\n\t\t\t<div class=\"item-content p\">\n\t\t\t\t<div class=\"item-form\">\n\t\t\t\t\t<div class=\"row item-header\">\n\t\t\t\t\t\t<div class=\"item-header-title\">Definition #${index + 1}</div>\n\t\t\t\t\t\t<div class=\"item-header-controls\">\n\t\t\t\t\t\t\t<og-button\n\t\t\t\t\t\t\t\ticon=\"trash\"\n\t\t\t\t\t\t\t\tcolor=\"red\"\n\t\t\t\t\t\t\t\t@click=\"${() => this.deleteGroup(groupIndex)}\">\n\t\t\t\t\t\t\t</og-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class=\"row\">Location range</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<og-input\n\t\t\t\t\t\t\tdata-id=\"locRange\"\n\t\t\t\t\t\t\t.value=\"${group.locRange?.A1 || ''}\"\n\t\t\t\t\t\t\tstyle=\"width: 100%\"\n\t\t\t\t\t\t\t@change=\"${(e: Event) => this._onInputChange(e, groupIndex)}\">\n\t\t\t\t\t\t</og-input>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"row\">Data range</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<og-input\n\t\t\t\t\t\t\tdata-id=\"dataRange\"\n\t\t\t\t\t\t\t.value=\"${(group.dataRanges ? CellRange.toA1s(group.dataRanges.map(item => item[0])) : null) || ''}\"\n\t\t\t\t\t\t\tstyle=\"width: 100%\"\n\t\t\t\t\t\t\t@change=\"${(e: Event) => this._onInputChange(e, groupIndex)}\">\n\t\t\t\t\t\t</og-input>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class=\"row\">Options</div>\n\t\t\t\t\t<div class=\"row\">\n\t\t\t\t\t\t<og-toolbar \n\t\t\t\t\t\t\t.items=\"${optionToolbarItems}\"\n\t\t\t\t\t\t\t.values=\"${this.getToolbarValues(group)}\"\n\t\t\t\t\t\t\t@toolbar.action=\"${(e: actions.ActionEvent) => this._onOptionsToolbarAction(e, groupIndex)}\">\n\t\t\t\t\t\t</og-toolbar>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`;\n\t}\n\n\trender = () => this.model ? html`\n\t\t<div class=\"controls p\">\n\t\t\t<og-button text=\"+\" @click=\"${() => this.addGroup()}\"></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 ?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.sparklines.groups.size}\">\n\t\t\t</og-list>\n\t\t</div>\n\t` : '';\n}"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sparklineForm.style.d.ts","sourceRoot":"","sources":["../../../src/ui/forms/sparklineForm.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAgCjB,CAAC;AAEF,eAAO,MAAM,SAAS,yBA0DrB,CAAC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
export const style = css `
|
|
3
|
-
* {
|
|
4
|
-
box-sizing: border-box;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
:host {
|
|
8
|
-
font-size: var(--og-font-size);
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.controls {
|
|
14
|
-
flex: 0;
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: row;
|
|
17
|
-
gap: 2px;
|
|
18
|
-
padding: 2px;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.controls > * {
|
|
22
|
-
flex: 1;
|
|
23
|
-
text-align: center
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.body {
|
|
27
|
-
flex: 1;
|
|
28
|
-
overflow: hidden;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
og-list {
|
|
32
|
-
height: 100%;
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
export const itemStyle = css `
|
|
36
|
-
.p {
|
|
37
|
-
padding: 5px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.row {
|
|
41
|
-
line-height: 22px;
|
|
42
|
-
max-height: 22px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
og-input {
|
|
46
|
-
display: block;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.item-header {
|
|
50
|
-
padding-left: 4px;
|
|
51
|
-
background-color: var(--og-accent-color);
|
|
52
|
-
color: var(--og-colortype-accent-text-color);
|
|
53
|
-
display: flex;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.item-header-controls {
|
|
57
|
-
flex: 1;
|
|
58
|
-
display: flex;
|
|
59
|
-
flex-direction: row;
|
|
60
|
-
justify-content: flex-end;
|
|
61
|
-
align-items: center;
|
|
62
|
-
padding-right: 2px;
|
|
63
|
-
gap: 2px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.item-header-controls og-button {
|
|
67
|
-
min-width: 20px;
|
|
68
|
-
height: 20px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.item-content {
|
|
72
|
-
height: 100%;
|
|
73
|
-
display: flex;
|
|
74
|
-
flex-direction: row;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.item-form {
|
|
78
|
-
flex: 1;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.item-controls {
|
|
82
|
-
flex: 0;
|
|
83
|
-
padding: 0 2px;
|
|
84
|
-
display: flex;
|
|
85
|
-
flex-direction: column;
|
|
86
|
-
gap: 2px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.item-controls og-button {
|
|
90
|
-
width: 24px;
|
|
91
|
-
display: block;
|
|
92
|
-
}
|
|
93
|
-
`;
|
|
94
|
-
//# sourceMappingURL=sparklineForm.style.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sparklineForm.style.js","sourceRoot":"","sources":["../../../src/ui/forms/sparklineForm.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCvB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0D3B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\n\t:host {\n\t\tfont-size: var(--og-font-size);\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t}\n\n\t.controls {\n\t\tflex: 0;\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\tgap: 2px;\n\t\tpadding: 2px;\n\t}\n\n\t.controls > * {\n\t\tflex: 1;\n\t\ttext-align: center\n\t}\n\n\t.body {\n\t\tflex: 1;\n\t\toverflow: hidden;\n\t}\n\n\tog-list {\n\t\theight: 100%;\n\t}\n`;\n\nexport const itemStyle = css`\n\t.p {\n\t\tpadding: 5px;\n\t}\n\n\t.row {\n\t\tline-height: 22px;\n\t\tmax-height: 22px;\n\t}\n\n\tog-input {\n\t\tdisplay: block;\n\t}\n\n\t.item-header {\n\t\tpadding-left: 4px;\n\t\tbackground-color: var(--og-accent-color);\n\t\tcolor: var(--og-colortype-accent-text-color);\n\t\tdisplay: flex;\n\t}\n\n\t.item-header-controls {\n\t\tflex: 1;\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\tjustify-content: flex-end;\n\t\talign-items: center;\n\t\tpadding-right: 2px;\n\t\tgap: 2px;\n\t}\n\n\t.item-header-controls og-button {\n\t\tmin-width: 20px;\n\t\theight: 20px;\n\t}\n\n\t.item-content {\n\t\theight: 100%;\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t}\n\n\t.item-form {\n\t\tflex: 1;\n\t}\n\n\t.item-controls {\n\t\tflex: 0;\n\t\tpadding: 0 2px;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 2px;\n\t}\n\t\n\t.item-controls og-button {\n\t\twidth: 24px;\n\t\tdisplay: block;\n\t}\n`;"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { actions } from '@omegagrid/core';
|
|
2
|
-
import { Style } from '@omegagrid/grid';
|
|
3
|
-
import { LitElement } from 'lit';
|
|
4
|
-
import { Toolbar } from '@omegagrid/toolbar';
|
|
5
|
-
export declare class StyleForm extends LitElement {
|
|
6
|
-
static styles: import("lit").CSSResult[];
|
|
7
|
-
data: Style;
|
|
8
|
-
toolbar: Toolbar;
|
|
9
|
-
styleToToolbarValues(s: Style): Record<string, unknown>;
|
|
10
|
-
connectedCallback(): void;
|
|
11
|
-
_onAction: (e: actions.ActionEvent) => void;
|
|
12
|
-
render: () => import("lit-html").TemplateResult<1>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=styleForm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styleForm.d.ts","sourceRoot":"","sources":["../../../src/ui/forms/styleForm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAa,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAe,MAAM,oBAAoB,CAAC;AAyC1D,qBACa,SAAU,SAAQ,UAAU;IAExC,MAAM,CAAC,MAAM,4BAcV;IAGH,IAAI,EAAE,KAAK,CAAM;IAGjB,OAAO,EAAE,OAAO,CAAC;IAEjB,oBAAoB,CAAC,CAAC,EAAE,KAAK;IAU7B,iBAAiB;IAIjB,SAAS,GAAI,GAAG,OAAO,CAAC,WAAW,UA0BlC;IAED,MAAM,6CAMJ;CAEF"}
|
|
@@ -1,151 +0,0 @@
|
|
|
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 items = [
|
|
12
|
-
{ type: 'togglebutton', id: 'bold', icon: { icon: 'bold' } },
|
|
13
|
-
{ type: 'togglebutton', id: 'italic', icon: { icon: 'italic' } },
|
|
14
|
-
{ type: 'togglebutton', id: 'underline', icon: { icon: 'underline' } },
|
|
15
|
-
{ type: 'dropdown-button', id: 'alignment', icon: { icon: 'align-center' }, items: [[
|
|
16
|
-
{ type: 'button', id: 'alignTopLeft', icon: { icon: 'align-left' } },
|
|
17
|
-
{ type: 'button', id: 'alignTopCenter', icon: { icon: 'align-center' } },
|
|
18
|
-
{ type: 'button', id: 'alignTopRight', icon: { icon: 'align-right' } },
|
|
19
|
-
], [
|
|
20
|
-
{ type: 'button', id: 'alignCenterLeft', icon: { icon: 'align-left' } },
|
|
21
|
-
{ type: 'button', id: 'alignCenterCenter', icon: { icon: 'align-center' } },
|
|
22
|
-
{ type: 'button', id: 'alignCenterRight', icon: { icon: 'align-right' } },
|
|
23
|
-
], [
|
|
24
|
-
{ type: 'button', id: 'alignBottomLeft', icon: { icon: 'align-left' } },
|
|
25
|
-
{ type: 'button', id: 'alignBottomCenter', icon: { icon: 'align-center' } },
|
|
26
|
-
{ type: 'button', id: 'alignBottomRight', icon: { icon: 'align-right' } },
|
|
27
|
-
]] },
|
|
28
|
-
{ type: 'color', id: 'color', icon: { icon: 'font' } },
|
|
29
|
-
{ type: 'color', id: 'fgColor', icon: { icon: 'fill' } },
|
|
30
|
-
{ type: 'dropdown-button', id: 'border', icon: { icon: 'align-center' }, items: [[
|
|
31
|
-
{ type: 'button', id: 'borderLeft', value: { left: { style: 'thin' } }, content: createBorderIcon('left') },
|
|
32
|
-
{ type: 'button', id: 'borderRight', value: { right: { style: 'thin' } }, content: createBorderIcon('right') },
|
|
33
|
-
{ type: 'button', id: 'borderTop', value: { top: { style: 'thin' } }, content: createBorderIcon('top') },
|
|
34
|
-
{ type: 'button', id: 'borderBottom', value: { bottom: { style: 'thin' } }, content: createBorderIcon('bottom') },
|
|
35
|
-
], [
|
|
36
|
-
{ type: 'button', id: 'borderNone', value: { left: null, top: null, right: null, bottom: null }, content: createBorderIcon('none') },
|
|
37
|
-
{ type: 'button', id: 'borderAll', value: { left: { style: 'thin' }, top: { style: 'thin' }, right: { style: 'thin' }, bottom: { style: 'thin' } }, content: createBorderIcon('all') },
|
|
38
|
-
{ type: 'button', id: 'borderOutside', value: { left: { style: 'thin' }, top: { style: 'thin' }, right: { style: 'thin' }, bottom: { style: 'thin' } }, content: createBorderIcon('outside') },
|
|
39
|
-
{ type: 'button', id: 'borderOutsideThick', value: { left: { style: 'thick' }, top: { style: 'thick' }, right: { style: 'thick' }, bottom: { style: 'thick' } }, content: createBorderIcon('outside-thick') },
|
|
40
|
-
], [
|
|
41
|
-
{ type: 'button', id: 'borderBottomDouble', value: { bottom: { style: 'double' } }, content: createBorderIcon('bottom-double') },
|
|
42
|
-
{ type: 'button', id: 'borderBottomThick', value: { bottom: { style: 'thick' } }, content: createBorderIcon('bottom-thick') },
|
|
43
|
-
{ type: 'button', id: 'borderTopBottom', value: { top: { style: 'thin' }, bottom: { style: 'thin' } }, content: createBorderIcon('top-bottom') },
|
|
44
|
-
{ type: 'button', id: 'borderTopBottomThick', value: { top: { style: 'thin' }, bottom: { style: 'thick' } }, content: createBorderIcon('top-bottom-thick') },
|
|
45
|
-
], [{ type: 'color', id: 'borderColor', colspan: 4, icon: { icon: 'fill' } }]] },
|
|
46
|
-
];
|
|
47
|
-
let StyleForm = class StyleForm extends LitElement {
|
|
48
|
-
constructor() {
|
|
49
|
-
super(...arguments);
|
|
50
|
-
this.data = {};
|
|
51
|
-
this._onAction = (e) => {
|
|
52
|
-
const a = e.action;
|
|
53
|
-
if (/^preview/.test(a.type))
|
|
54
|
-
return;
|
|
55
|
-
const data = utils.cloneDeep(this.data);
|
|
56
|
-
delete data.id;
|
|
57
|
-
delete data.hash;
|
|
58
|
-
switch (a.key) {
|
|
59
|
-
case 'bold':
|
|
60
|
-
data.bold = a.value ? true : false;
|
|
61
|
-
break;
|
|
62
|
-
case 'italic':
|
|
63
|
-
data.italic = a.value ? true : false;
|
|
64
|
-
break;
|
|
65
|
-
case 'underline':
|
|
66
|
-
data.underline = a.value ? true : false;
|
|
67
|
-
break;
|
|
68
|
-
case 'color':
|
|
69
|
-
data.color = a.value.substring(1);
|
|
70
|
-
break;
|
|
71
|
-
case 'fgColor':
|
|
72
|
-
data.fgColor = a.value.substring(1);
|
|
73
|
-
break;
|
|
74
|
-
case 'alignCenterCenter':
|
|
75
|
-
data.alignment = { vertical: 'center', horizontal: 'center' };
|
|
76
|
-
break;
|
|
77
|
-
case 'alignTopLeft':
|
|
78
|
-
data.alignment = { vertical: 'top', horizontal: 'left' };
|
|
79
|
-
break;
|
|
80
|
-
case 'alignTopCenter':
|
|
81
|
-
data.alignment = { vertical: 'top', horizontal: 'center' };
|
|
82
|
-
break;
|
|
83
|
-
case 'alignTopRight':
|
|
84
|
-
data.alignment = { vertical: 'top', horizontal: 'right' };
|
|
85
|
-
break;
|
|
86
|
-
case 'alignCenterLeft':
|
|
87
|
-
data.alignment = { vertical: 'center', horizontal: 'left' };
|
|
88
|
-
break;
|
|
89
|
-
case 'alignCenterRight':
|
|
90
|
-
data.alignment = { vertical: 'center', horizontal: 'right' };
|
|
91
|
-
break;
|
|
92
|
-
case 'alignBottomLeft':
|
|
93
|
-
data.alignment = { vertical: 'bottom', horizontal: 'left' };
|
|
94
|
-
break;
|
|
95
|
-
case 'alignBottomCenter':
|
|
96
|
-
data.alignment = { vertical: 'bottom', horizontal: 'center' };
|
|
97
|
-
break;
|
|
98
|
-
case 'alignBottomRight':
|
|
99
|
-
data.alignment = { vertical: 'bottom', horizontal: 'right' };
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
this.data = data;
|
|
103
|
-
this.dispatchEvent(new events.ChangeEvent({ value: data }));
|
|
104
|
-
};
|
|
105
|
-
this.render = () => html `
|
|
106
|
-
<og-toolbar
|
|
107
|
-
.items="${items}"
|
|
108
|
-
.values="${this.styleToToolbarValues(this.data)}"
|
|
109
|
-
@toolbar.action="${this._onAction}">
|
|
110
|
-
</og-toolbar>
|
|
111
|
-
`;
|
|
112
|
-
}
|
|
113
|
-
styleToToolbarValues(s) {
|
|
114
|
-
const values = {};
|
|
115
|
-
values.bold = s.bold;
|
|
116
|
-
values.italic = s.italic;
|
|
117
|
-
values.underline = s.underline;
|
|
118
|
-
values.color = `#${s.color}`;
|
|
119
|
-
values.fgColor = `#${s.fgColor || s.bgColor}`;
|
|
120
|
-
return values;
|
|
121
|
-
}
|
|
122
|
-
connectedCallback() {
|
|
123
|
-
super.connectedCallback();
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
StyleForm.styles = [css `
|
|
127
|
-
.row {
|
|
128
|
-
height: 30px;
|
|
129
|
-
line-height: 30px;
|
|
130
|
-
display: flex;
|
|
131
|
-
flex-direction: row;
|
|
132
|
-
gap: 3px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.row > og-button {
|
|
136
|
-
min-width: 24px;
|
|
137
|
-
height: 24px;
|
|
138
|
-
padding: 0;
|
|
139
|
-
}
|
|
140
|
-
`];
|
|
141
|
-
__decorate([
|
|
142
|
-
property({ type: Object })
|
|
143
|
-
], StyleForm.prototype, "data", void 0);
|
|
144
|
-
__decorate([
|
|
145
|
-
query('og-toolbar')
|
|
146
|
-
], StyleForm.prototype, "toolbar", void 0);
|
|
147
|
-
StyleForm = __decorate([
|
|
148
|
-
customElement('og-editor-form-style')
|
|
149
|
-
], StyleForm);
|
|
150
|
-
export { StyleForm };
|
|
151
|
-
//# sourceMappingURL=styleForm.js.map
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ators.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 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: 'dropdown-button', id: 'alignment', icon: {icon: 'align-center'}, items: [[\n\t\t{type: 'button', id: 'alignTopLeft', icon: {icon: 'align-left'}},\n\t\t{type: 'button', id: 'alignTopCenter', icon: {icon: 'align-center'}},\n\t\t{type: 'button', id: 'alignTopRight', icon: {icon: 'align-right'}},\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-form-style')\nexport class StyleForm 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\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 '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}"]}
|
package/dist/ui/formulabar.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ElementModel, Grid, FormulaInput, FormulaInputEvent, SelectorEvent, GridEvent } from '@omegagrid/grid';
|
|
2
|
-
import { LitElement } from 'lit';
|
|
3
|
-
export declare class EditorFormula extends LitElement {
|
|
4
|
-
static styles: import("lit").CSSResult[];
|
|
5
|
-
grid: Grid;
|
|
6
|
-
gridElement: ElementModel;
|
|
7
|
-
addressInput: HTMLInputElement;
|
|
8
|
-
formulaInput: FormulaInput;
|
|
9
|
-
private isInputActive;
|
|
10
|
-
get gridElementValue(): string;
|
|
11
|
-
_onGridSelectorUpdate: (e: SelectorEvent) => void;
|
|
12
|
-
_onGridSelect: (e: GridEvent) => void;
|
|
13
|
-
willUpdate(props: Map<PropertyKey, unknown>): void;
|
|
14
|
-
_onInputPreview: (e: FormulaInputEvent) => void;
|
|
15
|
-
commit(): void;
|
|
16
|
-
_onInputCommit: () => void;
|
|
17
|
-
_onInputDiscard: () => void;
|
|
18
|
-
_onAddressFocus: () => void;
|
|
19
|
-
_onInputFocus: () => void;
|
|
20
|
-
_onInput: () => void;
|
|
21
|
-
render: () => import("lit-html").TemplateResult<1>;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=formulabar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formulabar.d.ts","sourceRoot":"","sources":["../../src/ui/formulabar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACtI,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAIvC,qBACa,aAAc,SAAQ,UAAU;IAE5C,MAAM,CAAC,MAAM,4BAAW;IAExB,IAAI,EAAE,IAAI,CAAC;IAGX,WAAW,EAAE,YAAY,CAAC;IAG1B,YAAY,EAAE,gBAAgB,CAAC;IAG/B,YAAY,EAAE,YAAY,CAAC;IAE3B,OAAO,CAAC,aAAa,CAAS;IAE9B,IAAI,gBAAgB,WAAyD;IAE7E,qBAAqB,GAAI,GAAG,aAAa,UAMxC;IAED,aAAa,GAAI,GAAG,SAAS,UAiB5B;IAED,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IAY3C,eAAe,GAAI,GAAG,iBAAiB,UAGtC;IAED,MAAM;IAsBN,cAAc,aAEb;IAED,eAAe,aAMd;IAED,eAAe,aAKd;IAED,aAAa,aAGZ;IAED,QAAQ,aAEP;IAED,MAAM,6CAqBJ;CAEF"}
|