@omegagrid/editor 0.10.2 → 0.10.5

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.
Files changed (141) hide show
  1. package/dist/commands/index.d.ts +3 -0
  2. package/dist/commands/index.d.ts.map +1 -0
  3. package/dist/commands/index.js +34 -0
  4. package/dist/commands/index.js.map +1 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +2 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/options.d.ts +12 -0
  10. package/dist/options.d.ts.map +1 -0
  11. package/dist/options.js +14 -0
  12. package/dist/options.js.map +1 -0
  13. package/dist/ui/editor.d.ts +76 -0
  14. package/dist/ui/editor.d.ts.map +1 -0
  15. package/dist/ui/editor.js +338 -0
  16. package/dist/ui/editor.js.map +1 -0
  17. package/dist/ui/editor.style.d.ts +2 -0
  18. package/dist/ui/editor.style.d.ts.map +1 -0
  19. package/dist/ui/editor.style.js +38 -0
  20. package/dist/ui/editor.style.js.map +1 -0
  21. package/dist/ui/editorZoom.d.ts +16 -0
  22. package/dist/ui/editorZoom.d.ts.map +1 -0
  23. package/dist/ui/editorZoom.js +82 -0
  24. package/dist/ui/editorZoom.js.map +1 -0
  25. package/dist/ui/editors/hyperlinkEditor.d.ts +10 -0
  26. package/dist/ui/editors/hyperlinkEditor.d.ts.map +1 -0
  27. package/dist/ui/editors/hyperlinkEditor.js +70 -0
  28. package/dist/ui/editors/hyperlinkEditor.js.map +1 -0
  29. package/dist/ui/editors/index.d.ts +6 -0
  30. package/dist/ui/editors/index.d.ts.map +1 -0
  31. package/dist/ui/editors/index.js +6 -0
  32. package/dist/ui/editors/index.js.map +1 -0
  33. package/dist/ui/editors/ruleEditor.d.ts +27 -0
  34. package/dist/ui/editors/ruleEditor.d.ts.map +1 -0
  35. package/dist/ui/editors/ruleEditor.js +251 -0
  36. package/dist/ui/editors/ruleEditor.js.map +1 -0
  37. package/dist/ui/editors/styleEditor.d.ts +14 -0
  38. package/dist/ui/editors/styleEditor.d.ts.map +1 -0
  39. package/dist/ui/editors/styleEditor.js +160 -0
  40. package/dist/ui/editors/styleEditor.js.map +1 -0
  41. package/dist/ui/editors/themeEditor.d.ts +24 -0
  42. package/dist/ui/editors/themeEditor.d.ts.map +1 -0
  43. package/dist/ui/editors/themeEditor.js +138 -0
  44. package/dist/ui/editors/themeEditor.js.map +1 -0
  45. package/dist/ui/editors/themeItemEditor.d.ts +22 -0
  46. package/dist/ui/editors/themeItemEditor.d.ts.map +1 -0
  47. package/dist/ui/editors/themeItemEditor.js +181 -0
  48. package/dist/ui/editors/themeItemEditor.js.map +1 -0
  49. package/dist/ui/forms/configForm.d.ts +12 -0
  50. package/dist/ui/forms/configForm.d.ts.map +1 -0
  51. package/dist/ui/forms/configForm.js +101 -0
  52. package/dist/ui/forms/configForm.js.map +1 -0
  53. package/dist/ui/forms/headerForm.d.ts +18 -0
  54. package/dist/ui/forms/headerForm.d.ts.map +1 -0
  55. package/dist/ui/forms/headerForm.js +144 -0
  56. package/dist/ui/forms/headerForm.js.map +1 -0
  57. package/dist/ui/forms/index.d.ts +9 -0
  58. package/dist/ui/forms/index.d.ts.map +1 -0
  59. package/dist/ui/forms/index.js +9 -0
  60. package/dist/ui/forms/index.js.map +1 -0
  61. package/dist/ui/forms/namesForm.d.ts +21 -0
  62. package/dist/ui/forms/namesForm.d.ts.map +1 -0
  63. package/dist/ui/forms/namesForm.js +124 -0
  64. package/dist/ui/forms/namesForm.js.map +1 -0
  65. package/dist/ui/forms/ruleForm.d.ts +13 -0
  66. package/dist/ui/forms/ruleForm.d.ts.map +1 -0
  67. package/dist/ui/forms/ruleForm.js +56 -0
  68. package/dist/ui/forms/ruleForm.js.map +1 -0
  69. package/dist/ui/forms/ruleForm.style.d.ts +2 -0
  70. package/dist/ui/forms/ruleForm.style.d.ts.map +1 -0
  71. package/dist/ui/forms/ruleForm.style.js +50 -0
  72. package/dist/ui/forms/ruleForm.style.js.map +1 -0
  73. package/dist/ui/forms/ruleFormThreshold.d.ts +19 -0
  74. package/dist/ui/forms/ruleFormThreshold.d.ts.map +1 -0
  75. package/dist/ui/forms/ruleFormThreshold.js +97 -0
  76. package/dist/ui/forms/ruleFormThreshold.js.map +1 -0
  77. package/dist/ui/forms/ruleList.d.ts +25 -0
  78. package/dist/ui/forms/ruleList.d.ts.map +1 -0
  79. package/dist/ui/forms/ruleList.js +169 -0
  80. package/dist/ui/forms/ruleList.js.map +1 -0
  81. package/dist/ui/forms/ruleList.style.d.ts +3 -0
  82. package/dist/ui/forms/ruleList.style.d.ts.map +1 -0
  83. package/dist/ui/forms/ruleList.style.js +69 -0
  84. package/dist/ui/forms/ruleList.style.js.map +1 -0
  85. package/dist/ui/forms/sparklineForm.d.ts +22 -0
  86. package/dist/ui/forms/sparklineForm.d.ts.map +1 -0
  87. package/dist/ui/forms/sparklineForm.js +199 -0
  88. package/dist/ui/forms/sparklineForm.js.map +1 -0
  89. package/dist/ui/forms/sparklineForm.style.d.ts +3 -0
  90. package/dist/ui/forms/sparklineForm.style.d.ts.map +1 -0
  91. package/dist/ui/forms/sparklineForm.style.js +94 -0
  92. package/dist/ui/forms/sparklineForm.style.js.map +1 -0
  93. package/dist/ui/forms/styleForm.d.ts +14 -0
  94. package/dist/ui/forms/styleForm.d.ts.map +1 -0
  95. package/dist/ui/forms/styleForm.js +151 -0
  96. package/dist/ui/forms/styleForm.js.map +1 -0
  97. package/dist/ui/formulabar.d.ts +23 -0
  98. package/dist/ui/formulabar.d.ts.map +1 -0
  99. package/dist/ui/formulabar.js +155 -0
  100. package/dist/ui/formulabar.js.map +1 -0
  101. package/dist/ui/formulabar.style.d.ts +2 -0
  102. package/dist/ui/formulabar.style.d.ts.map +1 -0
  103. package/dist/ui/formulabar.style.js +48 -0
  104. package/dist/ui/formulabar.style.js.map +1 -0
  105. package/dist/ui/gridStats.d.ts +11 -0
  106. package/dist/ui/gridStats.d.ts.map +1 -0
  107. package/dist/ui/gridStats.js +71 -0
  108. package/dist/ui/gridStats.js.map +1 -0
  109. package/dist/ui/index.d.ts +11 -0
  110. package/dist/ui/index.d.ts.map +1 -0
  111. package/dist/ui/index.js +11 -0
  112. package/dist/ui/index.js.map +1 -0
  113. package/dist/ui/sidebars/baseSidebar.d.ts +10 -0
  114. package/dist/ui/sidebars/baseSidebar.d.ts.map +1 -0
  115. package/dist/ui/sidebars/baseSidebar.js +24 -0
  116. package/dist/ui/sidebars/baseSidebar.js.map +1 -0
  117. package/dist/ui/sidebars/index.d.ts +2 -0
  118. package/dist/ui/sidebars/index.d.ts.map +1 -0
  119. package/dist/ui/sidebars/index.js +2 -0
  120. package/dist/ui/sidebars/index.js.map +1 -0
  121. package/dist/ui/sidebars/themeEditorSidebar.d.ts +14 -0
  122. package/dist/ui/sidebars/themeEditorSidebar.d.ts.map +1 -0
  123. package/dist/ui/sidebars/themeEditorSidebar.js +110 -0
  124. package/dist/ui/sidebars/themeEditorSidebar.js.map +1 -0
  125. package/dist/ui/statusbar.d.ts +19 -0
  126. package/dist/ui/statusbar.d.ts.map +1 -0
  127. package/dist/ui/statusbar.js +69 -0
  128. package/dist/ui/statusbar.js.map +1 -0
  129. package/dist/ui/toolbar.config.d.ts +7 -0
  130. package/dist/ui/toolbar.config.d.ts.map +1 -0
  131. package/dist/ui/toolbar.config.js +166 -0
  132. package/dist/ui/toolbar.config.js.map +1 -0
  133. package/dist/ui/toolbar.d.ts +42 -0
  134. package/dist/ui/toolbar.d.ts.map +1 -0
  135. package/dist/ui/toolbar.js +356 -0
  136. package/dist/ui/toolbar.js.map +1 -0
  137. package/dist/ui/toolbar.style.d.ts +2 -0
  138. package/dist/ui/toolbar.style.d.ts.map +1 -0
  139. package/dist/ui/toolbar.style.js +22 -0
  140. package/dist/ui/toolbar.style.js.map +1 -0
  141. package/package.json +10 -10
@@ -0,0 +1,356 @@
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 { actions } from '@omegagrid/core';
8
+ import { CellModel } from '@omegagrid/grid';
9
+ import { LitElement, html } from 'lit';
10
+ import { customElement, property, query } from 'lit/decorators.js';
11
+ import { toolbar1Config, toolbar2Config, toolbar3Config, toolbar4Config } from './toolbar.config';
12
+ import { style } from './toolbar.style';
13
+ import { EditorEvent } from './editor';
14
+ let EditorToolbar = class EditorToolbar extends LitElement {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.toolbar1Config = toolbar1Config;
18
+ this.toolbar2Config = toolbar2Config;
19
+ this.toolbar3Config = toolbar3Config;
20
+ this.toolbar4Config = toolbar4Config;
21
+ this._borderColor = 'ff0000';
22
+ this._onGridEdit = (_e) => {
23
+ this.updateToolbar();
24
+ };
25
+ this._onToolbarAction = (e) => {
26
+ if (!this.grid)
27
+ return;
28
+ let { key, value } = e.action;
29
+ key = key ?? '';
30
+ let hideSelector = false;
31
+ let isStyleProperty = false;
32
+ const isPreview = e.action.type == 'preview';
33
+ const isPreviewEnd = e.action.type == 'previewEnd';
34
+ if (key == 'theme') {
35
+ this.grid.model.applyTheme(this.editor.gridContainer.model.themes.get(value), true);
36
+ this.grid.refresh();
37
+ return;
38
+ }
39
+ else if (key == 'undo') {
40
+ this.grid.editing.undo();
41
+ this.updateToolbar();
42
+ return;
43
+ }
44
+ else if (key == 'redo') {
45
+ this.grid.editing.redo();
46
+ this.updateToolbar();
47
+ return;
48
+ }
49
+ else if (key == 'merge') {
50
+ if (value) {
51
+ this.grid.editing.merge();
52
+ }
53
+ else {
54
+ this.grid.editing.unmerge();
55
+ }
56
+ }
57
+ else if (key == 'wrap') {
58
+ isStyleProperty = true;
59
+ }
60
+ else if (['color', 'fgColor', 'bgColor'].indexOf(key) > -1) {
61
+ value = value ? value.substring(1) : '';
62
+ hideSelector = true;
63
+ isStyleProperty = true;
64
+ }
65
+ else if (['bold', 'italic', 'underline'].indexOf(key) > -1) {
66
+ isStyleProperty = true;
67
+ }
68
+ else if (key.startsWith('borderColor')) {
69
+ this._borderColor = value;
70
+ }
71
+ else if (key.startsWith('align')) {
72
+ isStyleProperty = true;
73
+ }
74
+ else if (key.startsWith('border')) {
75
+ isStyleProperty = true;
76
+ hideSelector = true;
77
+ }
78
+ else if (key == 'sz') {
79
+ isStyleProperty = true;
80
+ }
81
+ if (isPreview || isPreviewEnd) {
82
+ for (const cell of this.grid.model.getRangeIterator(this.grid.selection.range, isPreview)) {
83
+ this.applyProperty(cell, e.action, value, isStyleProperty);
84
+ }
85
+ }
86
+ else {
87
+ this.gridElements?.forEach(elm => this.applyProperty(elm, e.action, value, isStyleProperty));
88
+ }
89
+ if (isPreview && hideSelector) {
90
+ this.grid.selecting.hideSelector();
91
+ }
92
+ else if (isPreviewEnd) {
93
+ this.grid.selecting.showSelector();
94
+ }
95
+ else {
96
+ this.updateToolbar();
97
+ }
98
+ this.grid.rendering.updateCellSelectionRange();
99
+ this.grid.focus();
100
+ if (key == 'config') {
101
+ this.editor.rightSidebarComponent = value ? 'config' : null;
102
+ this.updateToolbar();
103
+ }
104
+ else if (key == 'headers') {
105
+ this.editor.rightSidebarComponent = value ? 'headers' : null;
106
+ this.updateToolbar();
107
+ }
108
+ else if (key == 'rules') {
109
+ this.editor.rightSidebarComponent = value ? 'rules' : null;
110
+ this.updateToolbar();
111
+ }
112
+ else if (key == 'sparklines') {
113
+ this.editor.rightSidebarComponent = value ? 'sparklines' : null;
114
+ this.updateToolbar();
115
+ }
116
+ else if (key == 'names') {
117
+ this.editor.rightSidebarComponent = value ? 'names' : null;
118
+ this.updateToolbar();
119
+ }
120
+ else if (key == 'themes') {
121
+ this.editor.rightSidebarComponent = value ? 'themes' : null;
122
+ this.updateToolbar();
123
+ }
124
+ this.dispatchEvent(new actions.ActionEvent('editor.toolbar', e.action));
125
+ };
126
+ this.render = () => {
127
+ const toolbar1Config = this.getToolbar1Config();
128
+ const toolbar2Config = this.getToolbar2Config();
129
+ const toolbar3Config = this.getToolbar3Config();
130
+ const toolbar4Config = this.getToolbar4Config();
131
+ return html `
132
+ ${toolbar1Config.length > 0 ? html `
133
+ <og-toolbar
134
+ id="toolbar1"
135
+ .items="${toolbar1Config}"
136
+ .values="${this.getToolbarValues()}"
137
+ @toolbar.action="${this._onToolbarAction}">
138
+ </og-toolbar>
139
+
140
+ <div class="spacer">&nbsp;</div>
141
+ ` : ''}
142
+
143
+ ${toolbar2Config.length > 0 ? html `
144
+ <og-toolbar
145
+ id="toolbar2"
146
+ .items="${toolbar2Config}"
147
+ .values="${this.getToolbarValues()}"
148
+ @toolbar.action="${this._onToolbarAction}">
149
+ </og-toolbar>
150
+
151
+ <div class="spacer">&nbsp;</div>
152
+ ` : ''}
153
+
154
+ ${toolbar3Config.length > 0 ? html `
155
+ <og-toolbar
156
+ id="toolbar3"
157
+ .items="${toolbar3Config}"
158
+ .values="${this.getToolbarValues()}"
159
+ @toolbar.action="${this._onToolbarAction}">
160
+ </og-toolbar>
161
+
162
+ <div class="spacer">&nbsp;</div>
163
+ ` : ''}
164
+
165
+ ${toolbar4Config.length > 0 ? html `
166
+ <og-toolbar
167
+ id="toolbar4"
168
+ .items="${toolbar4Config}"
169
+ .values="${this.getToolbarValues()}"
170
+ @toolbar.action="${this._onToolbarAction}">
171
+ </og-toolbar>
172
+ ` : ''}
173
+ `;
174
+ };
175
+ }
176
+ get gridElement() { return this.gridElements?.length > 0 ? this.gridElements[0] : null; }
177
+ filterToolbarItems(items) {
178
+ return items.filter(item => {
179
+ switch (item.id) {
180
+ case 'undo':
181
+ case 'redo':
182
+ return this.grid?.history;
183
+ case 'headers':
184
+ return this.editor?.options.editing.headers;
185
+ case 'rules':
186
+ return this.editor?.options.editing.conditionalStyles;
187
+ case 'sparklines':
188
+ return this.editor?.options.editing.sparklines;
189
+ case 'names':
190
+ return this.editor?.options.editing.names;
191
+ case 'theme':
192
+ case 'themes':
193
+ return this.editor?.gridContainer?.model?.themes.size > 0;
194
+ default:
195
+ return true;
196
+ }
197
+ });
198
+ }
199
+ getToolbar1Config() {
200
+ toolbar1Config[0].disabled = !this.grid?.history || this.grid.history.stack.length == 0;
201
+ toolbar1Config[1].disabled = !this.grid?.history || this.grid.history.restack.length == 0;
202
+ return this.filterToolbarItems(this.toolbar1Config);
203
+ }
204
+ getToolbar2Config() {
205
+ const items = this.filterToolbarItems(this.toolbar2Config);
206
+ if (items.length > 0) {
207
+ const themes = this.editor.gridContainer.model.themes;
208
+ items[0].items = Array.from(themes.values()).map(t => ({ k: t.name, v: t.name }));
209
+ }
210
+ return items;
211
+ }
212
+ getToolbar3Config() {
213
+ return this.filterToolbarItems(this.toolbar3Config);
214
+ }
215
+ getToolbar4Config() {
216
+ return this.filterToolbarItems(this.toolbar4Config);
217
+ }
218
+ willUpdate(props) {
219
+ if (props.has('editor')) {
220
+ props.get('editor')?.removeEventListener('grid.edit', this._onGridEdit);
221
+ this.editor?.addEventListener('grid.edit', this._onGridEdit);
222
+ }
223
+ }
224
+ firstUpdated() {
225
+ this.dispatchEvent(new EditorEvent('toolbar.init', { editor: this.editor }));
226
+ }
227
+ getToolbarValues() {
228
+ const values = Object.assign({}, this.gridElement?.composedStyle);
229
+ if (values.color)
230
+ values.color = '#' + values.color;
231
+ if (values.fgColor)
232
+ values.fgColor = '#' + values.fgColor;
233
+ if (values.bgColor)
234
+ values.bgColor = '#' + values.bgColor;
235
+ if (values.alignment && values.alignment.wrapText)
236
+ values.wrap = true;
237
+ if (this.gridElement) {
238
+ values.type = this.gridElement.type;
239
+ values.merge = this.gridElement instanceof CellModel ? this.gridElement.merge : false;
240
+ values.format = this.gridElement.format;
241
+ values.hyperlink = this.gridElement instanceof CellModel ? this.gridElement.hyperlink : null;
242
+ }
243
+ values.config = this.editor?.rightSidebarComponent == 'config';
244
+ values.headers = this.editor?.rightSidebarComponent == 'headers';
245
+ values.rules = this.editor?.rightSidebarComponent == 'rules';
246
+ values.sparklines = this.editor?.rightSidebarComponent == 'sparklines';
247
+ values.names = this.editor?.rightSidebarComponent == 'names';
248
+ values.themes = this.editor?.rightSidebarComponent == 'themes';
249
+ return values;
250
+ }
251
+ getCellBorderStyles(element, range, value, borderType) {
252
+ const color = this._borderColor.length > 6 ? this._borderColor.substring(1) : this._borderColor;
253
+ const styles = {};
254
+ if (value.top)
255
+ value.top.color = color;
256
+ if (value.right)
257
+ value.right.color = color;
258
+ if (value.bottom)
259
+ value.bottom.color = color;
260
+ if (value.left)
261
+ value.left.color = color;
262
+ styles.bottom = value.bottom && ((element instanceof CellModel && element.r == range.r2) || borderType == 'borderAll') ? value.bottom : null;
263
+ styles.top = value.top && ((element instanceof CellModel && element.r == range.r1) || borderType == 'borderAll') ? value.top : null;
264
+ styles.left = value.left && ((element instanceof CellModel && element.c == range.c1) || borderType == 'borderAll') ? value.left : null;
265
+ styles.right = value.right && ((element instanceof CellModel && element.c == range.c2) || borderType == 'borderAll') ? value.right : null;
266
+ return styles;
267
+ }
268
+ applyProperty(target, action, value, isStyleProperty) {
269
+ let { key } = action;
270
+ const isPreview = action.type == 'preview';
271
+ if (isPreview && target instanceof CellModel)
272
+ target.invalidateStyle();
273
+ if (key.startsWith('align')) {
274
+ value = Object.assign(this.gridElement?.composedStyle?.alignment ?? {}, value);
275
+ key = 'alignment';
276
+ }
277
+ else if (key == 'type') {
278
+ target.type = value;
279
+ }
280
+ else if (key == 'format') {
281
+ target.format = value;
282
+ }
283
+ else if (key == 'hyperlink') {
284
+ target.hyperlink = value;
285
+ }
286
+ else if (key == 'wrap') {
287
+ value = Object.assign(this.gridElement?.composedStyle?.alignment ?? {}, { wrapText: !!value });
288
+ key = 'alignment';
289
+ }
290
+ if (isStyleProperty) {
291
+ if (action.type == 'previewEnd') {
292
+ if (target instanceof CellModel)
293
+ target.invalidateStyle();
294
+ }
295
+ else if (key.startsWith('border')) {
296
+ const borderStyles = this.getCellBorderStyles(target, this.grid.selection.range, value, key);
297
+ if (isPreview) {
298
+ if (target instanceof CellModel)
299
+ target.previewStyleProperties(borderStyles);
300
+ }
301
+ else {
302
+ target.setStyleProperties(borderStyles);
303
+ }
304
+ }
305
+ else if (isPreview) {
306
+ if (target instanceof CellModel)
307
+ target.previewStyleProperties({ [key]: value });
308
+ }
309
+ else {
310
+ target.setStyleProperties({ [key]: value });
311
+ }
312
+ }
313
+ }
314
+ async updateToolbar() {
315
+ this.requestUpdate();
316
+ }
317
+ };
318
+ EditorToolbar.styles = [style];
319
+ __decorate([
320
+ query('#toolbar1')
321
+ ], EditorToolbar.prototype, "toolbar1", void 0);
322
+ __decorate([
323
+ query('#toolbar2')
324
+ ], EditorToolbar.prototype, "toolbar2", void 0);
325
+ __decorate([
326
+ query('#toolbar3')
327
+ ], EditorToolbar.prototype, "toolbar3", void 0);
328
+ __decorate([
329
+ query('#toolbar4')
330
+ ], EditorToolbar.prototype, "toolbar4", void 0);
331
+ __decorate([
332
+ property({ type: Object })
333
+ ], EditorToolbar.prototype, "grid", void 0);
334
+ __decorate([
335
+ property({ type: Object })
336
+ ], EditorToolbar.prototype, "editor", void 0);
337
+ __decorate([
338
+ property({ type: Array })
339
+ ], EditorToolbar.prototype, "gridElements", void 0);
340
+ __decorate([
341
+ property({ type: Array })
342
+ ], EditorToolbar.prototype, "toolbar1Config", void 0);
343
+ __decorate([
344
+ property({ type: Array })
345
+ ], EditorToolbar.prototype, "toolbar2Config", void 0);
346
+ __decorate([
347
+ property({ type: Array })
348
+ ], EditorToolbar.prototype, "toolbar3Config", void 0);
349
+ __decorate([
350
+ property({ type: Array })
351
+ ], EditorToolbar.prototype, "toolbar4Config", void 0);
352
+ EditorToolbar = __decorate([
353
+ customElement('og-editor-toolbar')
354
+ ], EditorToolbar);
355
+ export {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aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAsUzB","sourcesContent":["import { actions, UIValueType } from '@omegagrid/core';\nimport { Alignment, Border, CellModel, ElementModel, Grid, GridEditEvent, Style } from '@omegagrid/grid';\nimport { LitElement, html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { Toolbar, ToolbarItem } from '@omegagrid/toolbar';\nimport { CellRange } from '@omegagrid/grid';\nimport { toolbar1Config, toolbar2Config, toolbar3Config, toolbar4Config } from './toolbar.config';\nimport { style } from './toolbar.style';\nimport { Editor, EditorEvent } from './editor';\n\n@customElement('og-editor-toolbar')\nexport class EditorToolbar extends LitElement {\n\n\tstatic styles = [style];\n\n\t@query('#toolbar1')\n\ttoolbar1: Toolbar;\n\n\t@query('#toolbar2')\n\ttoolbar2: Toolbar;\n\n\t@query('#toolbar3')\n\ttoolbar3: Toolbar;\n\n\t@query('#toolbar4')\n\ttoolbar4: Toolbar;\n\n\t@property({type: Object})\n\tgrid: Grid;\n\n\t@property({type: Object})\n\teditor: Editor;\n\n\t@property({type: Array})\n\tgridElements: ElementModel[];\n\n\t@property({type: Array})\n\ttoolbar1Config = toolbar1Config;\n\n\t@property({type: Array})\n\ttoolbar2Config = toolbar2Config;\n\n\t@property({type: Array})\n\ttoolbar3Config = toolbar3Config;\n\n\t@property({type: Array})\n\ttoolbar4Config = toolbar4Config;\n\n\tget gridElement() { return this.gridElements?.length > 0 ? this.gridElements[0] : null}\n\n\t_borderColor = 'ff0000';\n\n\tfilterToolbarItems(items: ToolbarItem[]) {\n\t\treturn items.filter(item => {\n\t\t\tswitch (item.id) {\n\t\t\t\tcase 'undo':\n\t\t\t\tcase 'redo':\n\t\t\t\t\treturn this.grid?.history;\n\t\t\t\tcase 'headers':\n\t\t\t\t\treturn this.editor?.options.editing.headers;\n\t\t\t\tcase 'rules':\n\t\t\t\t\treturn this.editor?.options.editing.conditionalStyles;\n\t\t\t\tcase 'sparklines':\n\t\t\t\t\treturn this.editor?.options.editing.sparklines;\n\t\t\t\tcase 'names':\n\t\t\t\t\treturn this.editor?.options.editing.names;\n\t\t\t\tcase 'theme':\n\t\t\t\tcase 'themes':\n\t\t\t\t\treturn this.editor?.gridContainer?.model?.themes.size > 0;\n\t\t\t\tdefault:\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t});\n\t}\n\n\tgetToolbar1Config() {\n\t\ttoolbar1Config[0].disabled = !this.grid?.history || this.grid.history.stack.length == 0;\n\t\ttoolbar1Config[1].disabled = !this.grid?.history || this.grid.history.restack.length == 0;\n\t\treturn this.filterToolbarItems(this.toolbar1Config);\n\t}\n\n\tgetToolbar2Config() {\n\t\tconst items = this.filterToolbarItems(this.toolbar2Config);\n\t\tif (items.length > 0) {\n\t\t\tconst themes = this.editor.gridContainer.model.themes; \n\t\t\titems[0].items = Array.from(themes.values()).map(t => ({k: t.name, v: t.name}));\n\t\t}\n\t\treturn items;\n\t}\n\n\tgetToolbar3Config() {\n\t\treturn this.filterToolbarItems(this.toolbar3Config);\n\t}\n\n\tgetToolbar4Config() {\n\t\treturn this.filterToolbarItems(this.toolbar4Config);\n\t}\n\n\t_onGridEdit = (_e: GridEditEvent) => {\n\t\tthis.updateToolbar();\n\t}\n\n\twillUpdate(props: Map<PropertyKey, unknown>) {\n\t\tif (props.has('editor')) {\n\t\t\t(props.get('editor') as Editor)?.removeEventListener('grid.edit', this._onGridEdit);\n\t\t\tthis.editor?.addEventListener('grid.edit', this._onGridEdit);\n\t\t}\n\t}\n\n\tfirstUpdated() {\n\t\tthis.dispatchEvent(new EditorEvent('toolbar.init', {editor: this.editor}));\n\t}\n\n\tgetToolbarValues() {\n\t\tconst values: Record<string, unknown> = Object.assign({}, this.gridElement?.composedStyle);\n\t\tif (values.color) values.color = '#' + values.color;\n\t\tif (values.fgColor) values.fgColor = '#' + values.fgColor;\n\t\tif (values.bgColor) values.bgColor = '#' + values.bgColor;\n\t\tif (values.alignment && (values.alignment as Alignment).wrapText) values.wrap = true;\n\t\t\n\t\tif (this.gridElement) {\n\t\t\tvalues.type = this.gridElement.type;\n\t\t\tvalues.merge = this.gridElement instanceof CellModel ? this.gridElement.merge : false;\n\t\t\tvalues.format = this.gridElement.format;\n\t\t\tvalues.hyperlink = this.gridElement instanceof CellModel ? (this.gridElement as CellModel).hyperlink : null;\n\t\t}\n\n\t\tvalues.config = this.editor?.rightSidebarComponent == 'config';\n\t\tvalues.headers = this.editor?.rightSidebarComponent == 'headers';\n\t\tvalues.rules = this.editor?.rightSidebarComponent == 'rules';\n\t\tvalues.sparklines = this.editor?.rightSidebarComponent == 'sparklines';\n\t\tvalues.names = this.editor?.rightSidebarComponent == 'names';\n\t\tvalues.themes = this.editor?.rightSidebarComponent == 'themes';\n\t\treturn values;\n\t}\n\n\tgetCellBorderStyles(\n\t\telement: ElementModel,\n\t\trange: CellRange,\n\t\tvalue: {top?: Border, right?: Border, bottom?: Border, left?: Border},\n\t\tborderType: string,\n\t) {\n\t\tconst color = this._borderColor.length > 6 ? this._borderColor.substring(1) : this._borderColor;\n\t\tconst styles: Record<keyof Style, unknown> = {};\n\t\t\n\t\tif (value.top) value.top.color = color;\n\t\tif (value.right) value.right.color = color;\n\t\tif (value.bottom) value.bottom.color = color;\n\t\tif (value.left) value.left.color = color;\n\n\t\tstyles.bottom = value.bottom && ((element instanceof CellModel && element.r == range.r2) || borderType == 'borderAll') ? value.bottom : null\n\t\tstyles.top = value.top && ((element instanceof CellModel && element.r == range.r1) || borderType == 'borderAll') ? value.top : null;\n\t\tstyles.left = value.left && ((element instanceof CellModel && element.c == range.c1) || borderType == 'borderAll') ? value.left : null;\n\t\tstyles.right = value.right && ((element instanceof CellModel && element.c == range.c2) || borderType == 'borderAll') ? value.right : null;\n\t\treturn styles;\n\t}\n\n\tapplyProperty(target: ElementModel, action: actions.Action, value: unknown, isStyleProperty: boolean) {\n\t\tlet { key } = action;\n\t\tconst isPreview = action.type == 'preview';\n\t\tif (isPreview && target instanceof CellModel) target.invalidateStyle();\n\n\t\tif (key.startsWith('align')) {\n\t\t\tvalue = Object.assign(this.gridElement?.composedStyle?.alignment ?? {}, value);\n\t\t\tkey = 'alignment';\n\t\t} else if (key == 'type') {\n\t\t\ttarget.type = value as UIValueType;\n\t\t} else if (key == 'format') {\n\t\t\ttarget.format = value as string;\n\t\t} else if (key == 'hyperlink') {\n\t\t\t(target as CellModel).hyperlink = value as string;\n\t\t} else if (key == 'wrap') {\n\t\t\tvalue = Object.assign(this.gridElement?.composedStyle?.alignment ?? {}, {wrapText: !!value});\n\t\t\tkey = 'alignment';\n\t\t}\n\n\t\tif (isStyleProperty) {\n\t\t\tif (action.type == 'previewEnd') {\n\t\t\t\tif (target instanceof CellModel) target.invalidateStyle();\n\t\t\t} else if (key.startsWith('border')) {\n\t\t\t\tconst borderStyles = this.getCellBorderStyles(target, this.grid.selection.range, value, key);\n\t\t\t\tif (isPreview) {\n\t\t\t\t\tif (target instanceof CellModel) target.previewStyleProperties(borderStyles);\n\t\t\t\t} else {\n\t\t\t\t\ttarget.setStyleProperties(borderStyles);\n\t\t\t\t}\n\t\t\t} else if (isPreview) {\n\t\t\t\tif (target instanceof CellModel) target.previewStyleProperties({[key]: value});\n\t\t\t} else {\n\t\t\t\ttarget.setStyleProperties({[key]: value});\n\t\t\t}\n\t\t}\n\t}\n\n\tasync updateToolbar() {\n\t\tthis.requestUpdate();\n\t}\n\n\t_onToolbarAction = (e: actions.ActionEvent) => {\n\t\tif (!this.grid) return;\n\n\t\tlet { key, value } = e.action;\n\t\tkey = key ?? '';\n\t\tlet hideSelector = false;\n\t\tlet isStyleProperty = false;\n\t\tconst isPreview = e.action.type == 'preview';\n\t\tconst isPreviewEnd = e.action.type == 'previewEnd';\n\n\t\tif (key == 'theme') {\n\t\t\tthis.grid.model.applyTheme(this.editor.gridContainer.model.themes.get(value as string), true);\n\t\t\tthis.grid.refresh();\n\t\t\treturn;\n\t\t} else if (key == 'undo') {\n\t\t\tthis.grid.editing.undo();\n\t\t\tthis.updateToolbar();\n\t\t\treturn;\n\t\t} else if (key == 'redo') {\n\t\t\tthis.grid.editing.redo();\n\t\t\tthis.updateToolbar();\n\t\t\treturn;\n\t\t} else if (key == 'merge') {\n\t\t\tif (value) {\n\t\t\t\tthis.grid.editing.merge();\n\t\t\t} else {\n\t\t\t\tthis.grid.editing.unmerge();\n\t\t\t}\n\t\t} else if (key == 'wrap') {\n\t\t\tisStyleProperty = true;\n\t\t} else if (['color', 'fgColor', 'bgColor'].indexOf(key) > -1) {\n\t\t\tvalue = value ? (value as string).substring(1) : '';\n\t\t\thideSelector = true;\n\t\t\tisStyleProperty = true;\n\t\t} else if (['bold', 'italic', 'underline'].indexOf(key) > -1) {\n\t\t\tisStyleProperty = true;\n\t\t} else if (key.startsWith('borderColor')) {\n\t\t\tthis._borderColor = value as string;\n\t\t} else if (key.startsWith('align')) {\n\t\t\tisStyleProperty = true;\n\t\t} else if (key.startsWith('border')) {\n\t\t\tisStyleProperty = true;\n\t\t\thideSelector = true;\n\t\t} else if (key == 'sz') {\n\t\t\tisStyleProperty = true;\n\t\t}\n\n\t\tif (isPreview || isPreviewEnd) {\n\t\t\tfor (const cell of this.grid.model.getRangeIterator(this.grid.selection.range, isPreview)) {\n\t\t\t\tthis.applyProperty(cell, e.action, value, isStyleProperty);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.gridElements?.forEach(elm => this.applyProperty(elm, e.action, value, isStyleProperty));\n\t\t}\n\n\t\tif (isPreview && hideSelector) {\n\t\t\tthis.grid.selecting.hideSelector();\n\t\t} else if (isPreviewEnd) {\n\t\t\tthis.grid.selecting.showSelector();\n\t\t} else {\n\t\t\tthis.updateToolbar();\n\t\t}\n\t\t\n\t\tthis.grid.rendering.updateCellSelectionRange();\n\t\tthis.grid.focus();\n\n\t\tif (key == 'config') {\n\t\t\tthis.editor.rightSidebarComponent = value ? 'config' : null;\n\t\t\tthis.updateToolbar();\n\t\t} else if (key == 'headers') {\n\t\t\tthis.editor.rightSidebarComponent = value ? 'headers' : null;\n\t\t\tthis.updateToolbar();\n\t\t} else if (key == 'rules') {\n\t\t\tthis.editor.rightSidebarComponent = value ? 'rules' : null;\n\t\t\tthis.updateToolbar();\n\t\t} else if (key == 'sparklines') {\n\t\t\tthis.editor.rightSidebarComponent = value ? 'sparklines' : null;\n\t\t\tthis.updateToolbar();\n\t\t} else if (key == 'names') {\n\t\t\tthis.editor.rightSidebarComponent = value ? 'names' : null;\n\t\t\tthis.updateToolbar();\n\t\t} else if (key == 'themes') {\n\t\t\tthis.editor.rightSidebarComponent = value ? 'themes' : null;\n\t\t\tthis.updateToolbar();\n\t\t}\n\n\t\tthis.dispatchEvent(new actions.ActionEvent('editor.toolbar', e.action));\n\t}\n\n\trender = () => {\n\t\tconst toolbar1Config = this.getToolbar1Config();\n\t\tconst toolbar2Config = this.getToolbar2Config();\n\t\tconst toolbar3Config = this.getToolbar3Config();\n\t\tconst toolbar4Config = this.getToolbar4Config();\n\t\treturn html`\n\t\t\t${toolbar1Config.length > 0 ? html`\n\t\t\t\t<og-toolbar\n\t\t\t\t\tid=\"toolbar1\"\n\t\t\t\t\t.items=\"${toolbar1Config}\"\n\t\t\t\t\t.values=\"${this.getToolbarValues()}\"\n\t\t\t\t\t@toolbar.action=\"${this._onToolbarAction}\">\n\t\t\t\t</og-toolbar>\n\t\n\t\t\t\t<div class=\"spacer\">&nbsp;</div>\n\t\t\t` : ''}\n\n\t\t\t${toolbar2Config.length > 0 ? html`\n\t\t\t\t<og-toolbar\n\t\t\t\t\tid=\"toolbar2\"\n\t\t\t\t\t.items=\"${toolbar2Config}\"\n\t\t\t\t\t.values=\"${this.getToolbarValues()}\"\n\t\t\t\t\t@toolbar.action=\"${this._onToolbarAction}\">\n\t\t\t\t</og-toolbar>\n\t\t\t\t\n\t\t\t\t<div class=\"spacer\">&nbsp;</div>\n\t\t\t` : ''}\n\n\t\t\t${toolbar3Config.length > 0 ? html`\n\t\t\t\t<og-toolbar\n\t\t\t\t\tid=\"toolbar3\"\n\t\t\t\t\t.items=\"${toolbar3Config}\"\n\t\t\t\t\t.values=\"${this.getToolbarValues()}\"\n\t\t\t\t\t@toolbar.action=\"${this._onToolbarAction}\">\n\t\t\t\t</og-toolbar>\n\n\t\t\t\t<div class=\"spacer\">&nbsp;</div>\n\t\t\t` : ''}\n\n\t\t\t${toolbar4Config.length > 0 ? html`\n\t\t\t\t<og-toolbar\n\t\t\t\t\tid=\"toolbar4\"\n\t\t\t\t\t.items=\"${toolbar4Config}\"\n\t\t\t\t\t.values=\"${this.getToolbarValues()}\"\n\t\t\t\t\t@toolbar.action=\"${this._onToolbarAction}\">\n\t\t\t\t</og-toolbar>\n\t\t\t` : ''}\n\t\t`;\n\t}\n\n}"]}
@@ -0,0 +1,2 @@
1
+ export declare const style: import("lit").CSSResult;
2
+ //# sourceMappingURL=toolbar.style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar.style.d.ts","sourceRoot":"","sources":["../../src/ui/toolbar.style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,yBAmBjB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { css } from "lit";
2
+ export const style = css `
3
+ * {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ :host {
8
+ display: flex;
9
+ flex-direction: row;
10
+ }
11
+
12
+ og-toolbar {
13
+ flex: 0;
14
+ }
15
+
16
+ .spacer {
17
+ flex: 1;
18
+ width: 10px;
19
+ background-color: var(--og-background-color-2);
20
+ }
21
+ `;
22
+ //# sourceMappingURL=toolbar.style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar.style.js","sourceRoot":"","sources":["../../src/ui/toolbar.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;CAmBvB,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\tdisplay: flex;\n\t\tflex-direction: row;\n\t}\n\n\tog-toolbar {\n\t\tflex: 0;\n\t}\n\n\t.spacer {\n\t\tflex: 1;\n\t\twidth: 10px;\n\t\tbackground-color: var(--og-background-color-2);\n\t}\n`;"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omegagrid/editor",
3
- "version": "0.10.2",
3
+ "version": "0.10.5",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Spreadsheet editor",
6
6
  "main": "./dist/index.js",
@@ -27,15 +27,15 @@
27
27
  "_prepublish": "yarn test && yarn lint"
28
28
  },
29
29
  "dependencies": {
30
- "@omegagrid/commands": "^0.10.2",
31
- "@omegagrid/core": "^0.10.2",
32
- "@omegagrid/form": "^0.10.2",
33
- "@omegagrid/grid": "^0.10.2",
34
- "@omegagrid/localize": "^0.10.2",
35
- "@omegagrid/statusbar": "^0.10.2",
36
- "@omegagrid/tabs": "^0.10.2",
37
- "@omegagrid/toolbar": "^0.10.2",
38
- "@omegagrid/tree": "^0.10.2",
30
+ "@omegagrid/commands": "^0.10.5",
31
+ "@omegagrid/core": "^0.10.5",
32
+ "@omegagrid/form": "^0.10.5",
33
+ "@omegagrid/grid": "^0.10.5",
34
+ "@omegagrid/localize": "^0.10.5",
35
+ "@omegagrid/statusbar": "^0.10.5",
36
+ "@omegagrid/tabs": "^0.10.5",
37
+ "@omegagrid/toolbar": "^0.10.5",
38
+ "@omegagrid/tree": "^0.10.5",
39
39
  "lit": "^3.1.1",
40
40
  "lit-html": "^3.1.1",
41
41
  "ts-debounce": "^4.0.0"