@trebco/treb 25.0.0-rc2 → 25.0.0-rc3
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/build/treb-spreadsheet.mjs +9 -9
- package/build/treb.d.ts +1 -1
- package/esbuild-custom-element.mjs +9 -3
- package/package.json +2 -1
- package/treb-base-types/src/area.ts +12 -8
- package/treb-base-types/src/theme.ts +11 -1
- package/treb-embed/markup/layout.html +3 -1
- package/treb-embed/markup/toolbar.html +10 -10
- package/treb-embed/src/custom-element/spreadsheet-constructor.ts +67 -10
- package/treb-embed/src/embedded-spreadsheet.ts +30 -34
- package/treb-embed/style/autocomplete.scss +1 -1
- package/treb-embed/style/dialog.scss +4 -4
- package/treb-embed/style/dropdown-select.scss +1 -1
- package/treb-embed/style/formula-bar.scss +1 -1
- package/treb-embed/style/grid.scss +1 -1
- package/treb-embed/style/layout.scss +34 -63
- package/treb-embed/style/mouse-mask.scss +1 -1
- package/treb-embed/style/note.scss +1 -1
- package/treb-embed/style/overlay-editor.scss +1 -1
- package/treb-embed/style/spinner.scss +1 -1
- package/treb-embed/style/tab-bar.scss +1 -1
- package/treb-embed/style/table.scss +1 -1
- package/treb-embed/style/theme-defaults.scss +124 -82
- package/treb-embed/style/toolbar.scss +26 -25
- package/treb-embed/style/tooltip.scss +1 -1
- package/treb-grid/src/types/grid.ts +2 -25
package/build/treb.d.ts
CHANGED
|
@@ -55,7 +55,13 @@ const NotifyPlugin = (label) => {
|
|
|
55
55
|
});
|
|
56
56
|
build.onEnd(result => {
|
|
57
57
|
if (!result.errors.length) {
|
|
58
|
-
|
|
58
|
+
|
|
59
|
+
const keys = Object.keys(result.metafile?.outputs||{});
|
|
60
|
+
const bytes = keys.length ? result.metafile?.outputs[keys[0]]?.bytes : 0;
|
|
61
|
+
const size = bytes ? `; build size: ${FormatSize(bytes)}` : '';
|
|
62
|
+
|
|
63
|
+
console.info(`${label ? `${label} ` : ''}build complete @ ${new Date().toLocaleTimeString()}${size}`);
|
|
64
|
+
// console.info(result.metafile);
|
|
59
65
|
}
|
|
60
66
|
if (!label) {
|
|
61
67
|
console.info('');
|
|
@@ -70,7 +76,7 @@ const NotifyPlugin = (label) => {
|
|
|
70
76
|
* @param {number} size - size in bytes
|
|
71
77
|
* @returns {string} - size as a human readable string
|
|
72
78
|
*/
|
|
73
|
-
const FormatSize = (size) => {
|
|
79
|
+
const FormatSize = (size, precision = 1) => {
|
|
74
80
|
|
|
75
81
|
const units = ['B', 'KB', 'MB'];
|
|
76
82
|
let index = 0;
|
|
@@ -82,7 +88,7 @@ const FormatSize = (size) => {
|
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
|
|
85
|
-
return `${size.toFixed(
|
|
91
|
+
return `${size.toFixed(2)} ${units[index]}`;
|
|
86
92
|
|
|
87
93
|
};
|
|
88
94
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trebco/treb",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-rc3",
|
|
4
4
|
"license": "LGPL-3.0-or-later",
|
|
5
5
|
"homepage": "https://treb.app",
|
|
6
6
|
"repository": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"dev": "node esbuild-custom-element.mjs --dev",
|
|
40
40
|
"clean": "rm -fr build dist declaration",
|
|
41
41
|
"watch": "node --watch esbuild-custom-element.mjs --watch --dev",
|
|
42
|
+
"watch-production": "node --watch esbuild-custom-element.mjs --watch",
|
|
42
43
|
"tsc": "tsc -b treb-embed/modern.tsconfig.json",
|
|
43
44
|
"rebuild-tsc": "tsc -b --force treb-embed/modern.tsconfig.json",
|
|
44
45
|
"watch-tsc": "tsc -b treb-embed/modern.tsconfig.json -w",
|
|
@@ -61,19 +61,23 @@ export interface IArea {
|
|
|
61
61
|
*
|
|
62
62
|
* @internal
|
|
63
63
|
*/
|
|
64
|
-
export const IsCellAddress = (obj:
|
|
64
|
+
export const IsCellAddress = (obj: unknown): obj is ICellAddress => {
|
|
65
65
|
return (
|
|
66
|
-
|
|
67
|
-
typeof obj
|
|
68
|
-
|
|
66
|
+
obj !== null
|
|
67
|
+
&& typeof obj === 'object'
|
|
68
|
+
&& 'row' in obj
|
|
69
|
+
&& 'column' in obj);
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
/** @internal */
|
|
72
|
-
export const IsArea = (obj:
|
|
73
|
+
export const IsArea = (obj: unknown): obj is IArea => {
|
|
73
74
|
return (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
obj !== null
|
|
76
|
+
&& typeof obj === 'object'
|
|
77
|
+
&& 'start' in obj
|
|
78
|
+
&& IsCellAddress(obj.start)
|
|
79
|
+
&& 'end' in obj
|
|
80
|
+
&& IsCellAddress(obj.end));
|
|
77
81
|
};
|
|
78
82
|
|
|
79
83
|
export interface Dimensions {
|
|
@@ -480,10 +480,17 @@ export const ThemeColorTable = (theme_color: number, tint = .7): TableTheme => {
|
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
/**
|
|
483
|
+
* for stuff that's painted, we wamt to get the corresponding CSS value.
|
|
484
|
+
* we now set everything via CSS variables, but using the node structure
|
|
485
|
+
* allows us to read calculated values, especially when there are cascades.
|
|
486
|
+
*
|
|
487
|
+
* I keep trying to change this to just read CSS variables, but that does
|
|
488
|
+
* not do the same thing.
|
|
489
|
+
*
|
|
483
490
|
* @internal
|
|
484
491
|
*/
|
|
485
492
|
export const LoadThemeProperties = (container: HTMLElement): Theme => {
|
|
486
|
-
|
|
493
|
+
|
|
487
494
|
const theme: Theme = JSON.parse(JSON.stringify(DefaultTheme));
|
|
488
495
|
|
|
489
496
|
const Append = (parent: HTMLElement, classes: string): HTMLDivElement => {
|
|
@@ -602,6 +609,9 @@ export const LoadThemeProperties = (container: HTMLElement): Theme => {
|
|
|
602
609
|
// this is a little odd, since we have the check above for "existing element";
|
|
603
610
|
// should we switch on that? or is that never used, and we can drop it? (...)
|
|
604
611
|
|
|
612
|
+
// console.info(node);
|
|
613
|
+
// console.info(theme);
|
|
614
|
+
|
|
605
615
|
(node.parentElement as Element)?.removeChild(node);
|
|
606
616
|
|
|
607
617
|
return theme;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
<div class="treb-
|
|
2
|
+
<div class="treb-main treb-theme">
|
|
3
3
|
|
|
4
4
|
<div class="treb-layout-header treb-animate">
|
|
5
5
|
<div class="treb-toolbar">
|
|
@@ -67,6 +67,8 @@
|
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
69
69
|
|
|
70
|
+
<div class="treb-spreadsheet-backdrop"></div>
|
|
71
|
+
|
|
70
72
|
<!-- shouldn't grid be on the next one? which has a tabindex? -->
|
|
71
73
|
<div class="treb-spreadsheet-body" role="grid">
|
|
72
74
|
<div class="treb-grid" tabindex="-1">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
<div class="treb-menu" title="File menu" file-menu>
|
|
3
|
+
<button data-icon="file-menu" menu-target></button>
|
|
3
4
|
<div>
|
|
4
5
|
<button data-command="reset">New document</button>
|
|
5
6
|
<div separator></div>
|
|
@@ -8,30 +9,29 @@
|
|
|
8
9
|
<div separator></div>
|
|
9
10
|
<button data-command="export-xlsx">Export XLSX</button>
|
|
10
11
|
</div>
|
|
11
|
-
<button data-icon="file-menu"></button>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
14
|
<div composite narrow>
|
|
15
15
|
<button data-command="justify-left" data-target="justify" title="Left-align text"></button>
|
|
16
16
|
<div class="treb-menu">
|
|
17
|
+
<button dropdown></button>
|
|
17
18
|
<div class="treb-icon-buttons" data-replace="justify">
|
|
18
19
|
<button data-command="justify-left" title="Left-align text"></button>
|
|
19
20
|
<button data-command="justify-center" title="Center-align text"></button>
|
|
20
21
|
<button data-command="justify-right" title="Right-align text"></button>
|
|
21
22
|
</div>
|
|
22
|
-
<button dropdown></button>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
|
|
26
26
|
<div composite narrow>
|
|
27
27
|
<button data-command="align-top" data-target="align" title="Align to top"></button>
|
|
28
28
|
<div class="treb-menu">
|
|
29
|
+
<button dropdown></button>
|
|
29
30
|
<div class="treb-icon-buttons" data-replace="align">
|
|
30
31
|
<button data-command="align-top" title="Align to top"></button>
|
|
31
32
|
<button data-command="align-middle" title="Align to middle"></button>
|
|
32
33
|
<button data-command="align-bottom" title="Align to bottom"></button>
|
|
33
34
|
</div>
|
|
34
|
-
<button dropdown></button>
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
<button data-command="freeze-panes" data-title="Freeze panes" data-active-title="Unfreeze panes" freeze-button></button>
|
|
55
55
|
<button data-command="insert-table" data-icon="table" data-title="Insert table" data-active-title="Remove table" table-button></button>
|
|
56
56
|
<div class="treb-menu">
|
|
57
|
+
<button data-icon="comment" data-title="Comment" data-active-title="Update comment"></button>
|
|
57
58
|
<div class="treb-comment-box">
|
|
58
59
|
<textarea></textarea>
|
|
59
60
|
<div>
|
|
@@ -61,13 +62,13 @@
|
|
|
61
62
|
<button data-command="update-comment">Save</button>
|
|
62
63
|
</div>
|
|
63
64
|
</div>
|
|
64
|
-
<button data-icon="comment" data-title="Comment" data-active-title="Update comment"></button>
|
|
65
65
|
</div>
|
|
66
66
|
</div>
|
|
67
67
|
|
|
68
68
|
<div composite>
|
|
69
69
|
<button data-command="fill-color" data-color-bar="fill" data-color="{}" title="Fill color"></button>
|
|
70
70
|
<div class="treb-menu treb-color-menu" data-color-command="fill-color" data-replace-color="fill" data-default-color-text="No fill">
|
|
71
|
+
<button dropdown></button>
|
|
71
72
|
<div class="treb-color-chooser">
|
|
72
73
|
<div class="treb-caption">Theme colors</div>
|
|
73
74
|
<div class="treb-swatches"></div>
|
|
@@ -83,7 +84,6 @@
|
|
|
83
84
|
</button>
|
|
84
85
|
</div>
|
|
85
86
|
</div>
|
|
86
|
-
<button dropdown></button>
|
|
87
87
|
</div>
|
|
88
88
|
</div>
|
|
89
89
|
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
<div composite>
|
|
98
98
|
<button data-command="border-bottom" data-target="border" title="Bottom border"></button>
|
|
99
99
|
<div class="treb-menu">
|
|
100
|
+
<button dropdown></button>
|
|
100
101
|
<div class="treb-icon-buttons" data-replace="border">
|
|
101
102
|
<button data-command="border-top" title="Top border"></button>
|
|
102
103
|
<button data-command="border-left" title="Left border"></button>
|
|
@@ -111,13 +112,13 @@
|
|
|
111
112
|
<button data-icon="palette" data-color-bar="border" data-color="{}"></button>
|
|
112
113
|
</div>
|
|
113
114
|
</div>
|
|
114
|
-
<button dropdown></button>
|
|
115
115
|
</div>
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
118
|
<div composite font-scale>
|
|
119
119
|
<input class="treb-font-scale" title="Font scale">
|
|
120
120
|
<div class="treb-menu">
|
|
121
|
+
<button dropdown></button>
|
|
121
122
|
<div>
|
|
122
123
|
<button data-command="font-scale" data-scale="0.8">0.80</button>
|
|
123
124
|
<button data-command="font-scale" data-scale="0.9">0.90</button>
|
|
@@ -127,11 +128,11 @@
|
|
|
127
128
|
<button data-command="font-scale" data-scale="1.5">1.50</button>
|
|
128
129
|
<button data-command="font-scale" data-scale="2.0">2.00</button>
|
|
129
130
|
</div>
|
|
130
|
-
<button dropdown></button>
|
|
131
131
|
</div>
|
|
132
132
|
</div>
|
|
133
133
|
|
|
134
134
|
<div class="treb-menu">
|
|
135
|
+
<button data-icon="layout" title="Rows & columns"></button>
|
|
135
136
|
<div>
|
|
136
137
|
<button data-command="insert-row">Insert row</button>
|
|
137
138
|
<button data-command="insert-column">Insert column</button>
|
|
@@ -141,14 +142,13 @@
|
|
|
141
142
|
<button data-command="insert-sheet" add-remove-sheet>Add sheet</button>
|
|
142
143
|
<button data-command="delete-sheet" add-remove-sheet>Delete sheet</button>
|
|
143
144
|
</div>
|
|
144
|
-
<button data-icon="layout" title="Rows & columns"></button>
|
|
145
145
|
</div>
|
|
146
146
|
|
|
147
147
|
<div composite>
|
|
148
148
|
<input class="treb-number-format" title="Number format">
|
|
149
149
|
<div class="treb-menu">
|
|
150
|
-
<div class="treb-number-format-menu"></div>
|
|
151
150
|
<button dropdown></button>
|
|
151
|
+
<div class="treb-number-format-menu"></div>
|
|
152
152
|
</div>
|
|
153
153
|
</div>
|
|
154
154
|
|
|
@@ -160,6 +160,7 @@
|
|
|
160
160
|
<div composite chart-menu>
|
|
161
161
|
<button data-command="insert-column-chart" data-target="annotation" title="Insert column chart"></button>
|
|
162
162
|
<div class="treb-menu">
|
|
163
|
+
<button dropdown></button>
|
|
163
164
|
<div class="treb-icon-buttons" data-replace="annotation">
|
|
164
165
|
<button data-command="insert-column-chart" title="Insert column chart"></button>
|
|
165
166
|
<button data-command="insert-donut-chart" title="Insert donut chart"></button>
|
|
@@ -168,7 +169,6 @@
|
|
|
168
169
|
<div separator></div>
|
|
169
170
|
<button data-command="insert-image" title="Insert image"></button>
|
|
170
171
|
</div>
|
|
171
|
-
<button dropdown></button>
|
|
172
172
|
</div>
|
|
173
173
|
</div>
|
|
174
174
|
|
|
@@ -291,7 +291,7 @@ export class SpreadsheetConstructor {
|
|
|
291
291
|
|
|
292
292
|
// handle sidebar collapse
|
|
293
293
|
|
|
294
|
-
this.layout_element = root.querySelector('.treb-
|
|
294
|
+
this.layout_element = root.querySelector('.treb-main') as HTMLElement;
|
|
295
295
|
const button = root.querySelector('.treb-toggle-sidebar-button');
|
|
296
296
|
|
|
297
297
|
if (button && this.layout_element) {
|
|
@@ -909,7 +909,6 @@ export class SpreadsheetConstructor {
|
|
|
909
909
|
};
|
|
910
910
|
|
|
911
911
|
let command = target?.dataset.command;
|
|
912
|
-
// console.info(command);
|
|
913
912
|
|
|
914
913
|
if (command) {
|
|
915
914
|
|
|
@@ -1083,7 +1082,19 @@ export class SpreadsheetConstructor {
|
|
|
1083
1082
|
// if you scroll the toolbar. we could track scrolling, but it makes
|
|
1084
1083
|
// as much sense to just close any open menu.
|
|
1085
1084
|
|
|
1086
|
-
|
|
1085
|
+
// firefox thinks this is a "scroll linked posiitoning effect". that's
|
|
1086
|
+
// not 100% wrong but it's an absurd thing to flag for that warning.
|
|
1087
|
+
|
|
1088
|
+
if (/firefox/i.test(navigator.userAgent)) {
|
|
1089
|
+
scroller.addEventListener('scroll', () => {
|
|
1090
|
+
if (document.activeElement instanceof HTMLElement ) {
|
|
1091
|
+
document.activeElement.blur();
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
else {
|
|
1096
|
+
scroller.addEventListener('scroll', () => sheet.Focus());
|
|
1097
|
+
}
|
|
1087
1098
|
|
|
1088
1099
|
// we set up a key listener for the escape key when menus are open, we
|
|
1089
1100
|
// need to remove it if focus goes out of the toolbar
|
|
@@ -1109,14 +1120,32 @@ export class SpreadsheetConstructor {
|
|
|
1109
1120
|
}
|
|
1110
1121
|
};
|
|
1111
1122
|
|
|
1112
|
-
|
|
1123
|
+
const PositionMenu = (event: FocusEvent|MouseEvent) => {
|
|
1113
1124
|
|
|
1114
|
-
|
|
1125
|
+
// FIXME: because these are situational, move the
|
|
1126
|
+
// lookups/checks outside of this function into the
|
|
1127
|
+
// event handlers
|
|
1115
1128
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1129
|
+
let target = event.target as HTMLElement;
|
|
1130
|
+
let parent = target?.parentElement;
|
|
1118
1131
|
|
|
1119
|
-
if (
|
|
1132
|
+
if (target?.classList.contains('treb-menu')) {
|
|
1133
|
+
parent = target;
|
|
1134
|
+
for (const child of Array.from(parent.children)) {
|
|
1135
|
+
if (child.tagName === 'BUTTON') {
|
|
1136
|
+
target = child as HTMLElement;
|
|
1137
|
+
break;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
else if (!parent?.classList.contains('treb-menu')) {
|
|
1142
|
+
return;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
// if (parent?.classList.contains('treb-menu'))
|
|
1146
|
+
if (target && parent) {
|
|
1147
|
+
|
|
1148
|
+
// console.info('positioning');
|
|
1120
1149
|
|
|
1121
1150
|
if (!handlers_attached) {
|
|
1122
1151
|
toolbar.addEventListener('focusout', focusout_handler);
|
|
@@ -1181,14 +1210,15 @@ export class SpreadsheetConstructor {
|
|
|
1181
1210
|
|
|
1182
1211
|
}
|
|
1183
1212
|
|
|
1184
|
-
const focus = menu.querySelector('textarea, input') as HTMLElement;
|
|
1213
|
+
// const focus = menu.querySelector('textarea, input') as HTMLElement;
|
|
1214
|
+
const focus = menu.querySelector('textarea') as HTMLElement;
|
|
1185
1215
|
if (focus) {
|
|
1186
1216
|
requestAnimationFrame(() => focus.focus());
|
|
1187
1217
|
}
|
|
1188
1218
|
|
|
1189
1219
|
}
|
|
1190
1220
|
|
|
1191
|
-
}
|
|
1221
|
+
};
|
|
1192
1222
|
|
|
1193
1223
|
const format_menu = this.root?.querySelector('.treb-number-format-menu') as HTMLElement;
|
|
1194
1224
|
if (format_menu) {
|
|
@@ -1222,6 +1252,33 @@ export class SpreadsheetConstructor {
|
|
|
1222
1252
|
|
|
1223
1253
|
}
|
|
1224
1254
|
|
|
1255
|
+
const safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
1256
|
+
|
|
1257
|
+
// positioning on focusin will catch keyboard and mouse navigation
|
|
1258
|
+
// ...but this won't work on safari. ...
|
|
1259
|
+
|
|
1260
|
+
toolbar.addEventListener('focusin', event => {
|
|
1261
|
+
PositionMenu(event);
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1264
|
+
// safari disables focus on buttons for some reason. you can override
|
|
1265
|
+
// that, but does anyone do that? also, what about osx?
|
|
1266
|
+
//
|
|
1267
|
+
// for safari, we'll position on mousedown. this will result in some
|
|
1268
|
+
// extra calls to the position routine but that shouldn't be too
|
|
1269
|
+
// bad. we also need to remove focus on the menu elements we're adding
|
|
1270
|
+
// tab indexes to.
|
|
1271
|
+
|
|
1272
|
+
if(safari) {
|
|
1273
|
+
const elements = Array.from(toolbar.querySelectorAll('.treb-menu') as NodeListOf<HTMLElement>);
|
|
1274
|
+
for (const element of elements) {
|
|
1275
|
+
element.tabIndex = 0;
|
|
1276
|
+
}
|
|
1277
|
+
toolbar.addEventListener('mousedown', event => {
|
|
1278
|
+
PositionMenu(event);
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1225
1282
|
}
|
|
1226
1283
|
|
|
1227
1284
|
}
|
|
@@ -487,7 +487,7 @@ export class EmbeddedSpreadsheet {
|
|
|
487
487
|
// consolidate options w/ defaults. note that this does not
|
|
488
488
|
// support nested options, for that you need a proper merge
|
|
489
489
|
|
|
490
|
-
this.options = { ...DefaultOptions, ...options, storage_key: this.ResolveStorageKey(options.storage_key) };
|
|
490
|
+
this.options = { ...DefaultOptions, ...options, storage_key: this.ResolveStorageKey(options.storage_key, 'document') };
|
|
491
491
|
|
|
492
492
|
if (typeof this.options.imaginary_value === 'string') {
|
|
493
493
|
NumberFormat.imaginary_character = this.options.imaginary_value;
|
|
@@ -572,35 +572,32 @@ export class EmbeddedSpreadsheet {
|
|
|
572
572
|
grid_options.tab_bar = true; // implied
|
|
573
573
|
|
|
574
574
|
if (this.options.persist_scale) {
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
catch (e) {
|
|
600
|
-
console.warn('parsing persisted scale failed');
|
|
575
|
+
grid_options.persist_scale_key = this.ResolveStorageKey(this.options.persist_scale, 'scale');
|
|
576
|
+
if (grid_options.persist_scale_key) {
|
|
577
|
+
|
|
578
|
+
// persisted scale should _not_ override parameter/option... only
|
|
579
|
+
// set here if option is blank... actually, no, that's not right.
|
|
580
|
+
// persisted scale should override parameter, because if you do NOT
|
|
581
|
+
// want that behavior you can just disable persisting. so there are
|
|
582
|
+
// clear ways to accomplish any of
|
|
583
|
+
|
|
584
|
+
// (1) no initial scale, persist
|
|
585
|
+
// (2) initial scale, don't persist (revert to parameter)
|
|
586
|
+
// (3) initial scale but persist and use persisted value if available
|
|
587
|
+
|
|
588
|
+
// if (!this.options.scale_control) {
|
|
589
|
+
const json = localStorage.getItem(grid_options.persist_scale_key);
|
|
590
|
+
if (json) {
|
|
591
|
+
try {
|
|
592
|
+
const obj = JSON.parse(json);
|
|
593
|
+
grid_options.initial_scale = obj.scale || 1;
|
|
594
|
+
}
|
|
595
|
+
catch (e) {
|
|
596
|
+
console.warn('parsing persisted scale failed');
|
|
597
|
+
}
|
|
601
598
|
}
|
|
602
|
-
}
|
|
603
599
|
|
|
600
|
+
}
|
|
604
601
|
}
|
|
605
602
|
|
|
606
603
|
}
|
|
@@ -4703,9 +4700,10 @@ export class EmbeddedSpreadsheet {
|
|
|
4703
4700
|
|
|
4704
4701
|
/**
|
|
4705
4702
|
* if we have a boolean for a storage key, generate a (weak) hash
|
|
4706
|
-
* based on document URI.
|
|
4703
|
+
* based on document URI. use the prefix to create separate keys
|
|
4704
|
+
* when using the autogenerated key (uri hash)
|
|
4707
4705
|
*/
|
|
4708
|
-
protected ResolveStorageKey(key?: string|boolean): string|undefined {
|
|
4706
|
+
protected ResolveStorageKey(key?: string|boolean, prefix = ''): string|undefined {
|
|
4709
4707
|
|
|
4710
4708
|
if (!key) {
|
|
4711
4709
|
return undefined;
|
|
@@ -4718,10 +4716,8 @@ export class EmbeddedSpreadsheet {
|
|
|
4718
4716
|
hash = (hash << 5) - hash + data.charCodeAt(i);
|
|
4719
4717
|
hash |= 0;
|
|
4720
4718
|
}
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
return Math.abs(hash).toString(16);
|
|
4719
|
+
const generated = Math.abs(hash).toString(16);
|
|
4720
|
+
return prefix ? prefix + '-' + generated : generated;
|
|
4725
4721
|
}
|
|
4726
4722
|
|
|
4727
4723
|
return key;
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
.treb-
|
|
22
|
+
.treb-main {
|
|
23
23
|
|
|
24
24
|
--treb-icon-svg: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='153.073px' height='133.742px' viewBox='0.673 4.629 153.073 133.742' enable-background='new 0.673 4.629 153.073 133.742' xml:space='preserve'%3E%3ClinearGradient id='SVGID_1_' gradientUnits='userSpaceOnUse' x1='0.6729' y1='71.5' x2='153.7461' y2='71.5'%3E%3Cstop offset='0' style='stop-color:%235CB5FF'/%3E%3Cstop offset='1' style='stop-color:%230059B9'/%3E%3C/linearGradient%3E%3Cpath fill='url(%23SVGID_1_)' d='M91.656,28.313c-4.989,0-17.266,6.249-21.305,8.504c-2.344-2.473-2.603-6.162-3.036-10.933 c-2.344,2.429-0.824,9.806,0,12.496c-10.238,7.635-18.83,15.531-27.597,24.471c-2.992-4.729-5.031-8.593-5.726-17.183 c-3.038,6.509,0.867,15.057,3.121,19.784c-9.674,12.193-19.263,25.297-27.03,37.834C-25.405,28.313,82.936-16.248,153.746,14.431 C109.879,43.63,98.554,135.784,21.498,111.274c-5.423,7.809-9.069,18.006-13.538,27.072c-3.73,0.263-6.334-1.646-7.288-3.12 c7.506-18.181,17.183-34.192,27.075-49.984c10.718,0.306,21.346,0.478,30.198-1.04c-7.681-2.038-16.877-0.78-26.032-3.123 c5.597-10.718,13.754-18.876,21.867-27.075c8.808,0.782,17.746,3.21,27.074,1.041c-8.111-1.431-15.966-1.952-22.909-4.165 C65.539,42.502,80.722,33.389,91.656,28.313z'/%3E%3C/svg%3E%0A");
|
|
25
25
|
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
align-items: center;
|
|
66
66
|
position: relative;
|
|
67
67
|
|
|
68
|
-
padding:
|
|
68
|
+
padding: 1rem;
|
|
69
69
|
background: var(--treb-dialog-background, #fff);
|
|
70
70
|
color: var(--treb-dialog-color, #000);
|
|
71
71
|
|
|
@@ -164,8 +164,8 @@
|
|
|
164
164
|
height: 6px;
|
|
165
165
|
border: 1px solid #ddd;
|
|
166
166
|
margin: auto;
|
|
167
|
-
margin-top:
|
|
168
|
-
margin-bottom: .
|
|
167
|
+
margin-top: 1rem;
|
|
168
|
+
margin-bottom: .5rem;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
.treb-embed-progress-bar {
|