@trebco/treb 27.9.0 → 27.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/treb-spreadsheet.mjs +9 -9
- package/dist/treb.d.ts +8 -6
- package/package.json +1 -1
- package/{treb-grid/src/util/dom_utilities.ts → treb-base-types/src/dom-utilities.ts} +29 -20
- package/treb-base-types/src/index.ts +1 -0
- package/treb-base-types/src/theme.ts +3 -5
- package/treb-embed/src/custom-element/global.d.ts +3 -1
- package/treb-embed/src/custom-element/spreadsheet-constructor.ts +13 -19
- package/treb-embed/src/embedded-spreadsheet.ts +27 -92
- package/treb-embed/src/spinner.ts +3 -3
- package/treb-embed/style/layout.scss +1 -1
- package/treb-export/src/drawing2/chart2.ts +11 -2
- package/treb-export/src/export2.ts +14 -4
- package/treb-export/src/workbook-style2.ts +3 -2
- package/treb-grid/src/editors/autocomplete.ts +28 -24
- package/treb-grid/src/editors/editor.ts +3 -4
- package/treb-grid/src/editors/formula_bar.ts +1 -1
- package/treb-grid/src/layout/base_layout.ts +11 -16
- package/treb-grid/src/layout/grid_layout.ts +17 -28
- package/treb-grid/src/render/selection-renderer.ts +2 -3
- package/treb-grid/src/render/svg_header_overlay.ts +4 -11
- package/treb-grid/src/render/svg_selection_block.ts +27 -34
- package/treb-grid/src/render/tile_renderer.ts +6 -5
- package/treb-grid/src/types/grid.ts +32 -41
- package/treb-grid/src/types/grid_base.ts +2 -0
- package/treb-grid/src/types/scale-control.ts +2 -2
- package/treb-grid/src/types/sheet.ts +2 -2
- package/treb-grid/src/types/tab_bar.ts +4 -8
- package/treb-utils/src/index.ts +0 -1
- package/treb-utils/src/resizable.ts +26 -27
- package/treb-utils/src/template.ts +0 -70
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of TREB.
|
|
3
|
+
*
|
|
4
|
+
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
+
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
+
* later version.
|
|
8
|
+
*
|
|
9
|
+
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
+
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
+
* details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU General Public License along
|
|
15
|
+
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*
|
|
17
|
+
* Copyright 2022-2023 trebco, llc.
|
|
18
|
+
* info@treb.app
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { DOMUtilities } from 'treb-base-types';
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* support for resizable node, drag handle, drag rect, mask
|
|
24
26
|
* FIXME: make this composable (decorator?)
|
|
@@ -56,16 +58,14 @@ export class Resizable {
|
|
|
56
58
|
layout_reference?: HTMLElement;
|
|
57
59
|
}): void {
|
|
58
60
|
|
|
59
|
-
const resize_handle =
|
|
60
|
-
resize_handle.classList.add('treb-embed-resize-handle');
|
|
61
|
+
const resize_handle = DOMUtilities.Div('treb-embed-resize-handle');
|
|
61
62
|
|
|
62
63
|
(options.layout_reference || options.container).appendChild(resize_handle);
|
|
63
64
|
|
|
64
65
|
if (!Resizable.resize_mask) {
|
|
65
66
|
let mask = document.querySelector('.treb-embed-mouse-mask');
|
|
66
67
|
if (!mask) {
|
|
67
|
-
mask =
|
|
68
|
-
mask.classList.add('treb-embed-mouse-mask');
|
|
68
|
+
mask = DOMUtilities.Div('treb-embed-mouse-mask');
|
|
69
69
|
document.body.appendChild(mask);
|
|
70
70
|
}
|
|
71
71
|
Resizable.resize_mask = mask as HTMLElement;
|
|
@@ -74,8 +74,7 @@ export class Resizable {
|
|
|
74
74
|
if (!Resizable.resize_rect) {
|
|
75
75
|
let rect = document.querySelector('.treb-embed-resize-rect');
|
|
76
76
|
if (!rect) {
|
|
77
|
-
rect =
|
|
78
|
-
rect.classList.add('treb-embed-resize-rect');
|
|
77
|
+
rect = DOMUtilities.Div('treb-embed-resize-rect');
|
|
79
78
|
Resizable.resize_mask.appendChild(rect);
|
|
80
79
|
}
|
|
81
80
|
Resizable.resize_rect = rect as HTMLElement;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file is part of TREB.
|
|
3
|
-
*
|
|
4
|
-
* TREB is free software: you can redistribute it and/or modify it under the
|
|
5
|
-
* terms of the GNU General Public License as published by the Free Software
|
|
6
|
-
* Foundation, either version 3 of the License, or (at your option) any
|
|
7
|
-
* later version.
|
|
8
|
-
*
|
|
9
|
-
* TREB is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
10
|
-
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
11
|
-
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
12
|
-
* details.
|
|
13
|
-
*
|
|
14
|
-
* You should have received a copy of the GNU General Public License along
|
|
15
|
-
* with TREB. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
-
*
|
|
17
|
-
* Copyright 2022-2023 trebco, llc.
|
|
18
|
-
* info@treb.app
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
export interface NodeModel {[index: string]: HTMLElement}
|
|
23
|
-
|
|
24
|
-
const ParseTail = (node: HTMLElement, scope: string, model: NodeModel): void => {
|
|
25
|
-
[].forEach.call(node.children, (child: HTMLElement) => {
|
|
26
|
-
if (child.id) {
|
|
27
|
-
model[child.id] = child;
|
|
28
|
-
child.id = `${scope}-${child.id}`;
|
|
29
|
-
}
|
|
30
|
-
if (child.children && child.children.length) {
|
|
31
|
-
ParseTail(child, scope, model);
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const ParseTemplate = (template: string, container?: HTMLElement|string) => {
|
|
37
|
-
|
|
38
|
-
const scope = Math.random().toString(36).substring(2, 15);
|
|
39
|
-
const temp = document.createElement('div');
|
|
40
|
-
temp.innerHTML = template;
|
|
41
|
-
|
|
42
|
-
const model: NodeModel = {};
|
|
43
|
-
ParseTail(temp, scope, model);
|
|
44
|
-
|
|
45
|
-
if (typeof container === 'string') {
|
|
46
|
-
container = document.querySelector(container) as HTMLElement;
|
|
47
|
-
}
|
|
48
|
-
if (container) {
|
|
49
|
-
const nodes = [].map.call(temp.childNodes, child => child);
|
|
50
|
-
for (const child of nodes) { container.appendChild(child as Node); }
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return model;
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const composite = (strings: TemplateStringsArray, ...args: any[]): string => {
|
|
58
|
-
const output: string[] = [];
|
|
59
|
-
for (let i = 0; i < strings.length; i++) {
|
|
60
|
-
output.push(strings[i]);
|
|
61
|
-
if (args[i]) { output.push(args[i].toString()); }
|
|
62
|
-
}
|
|
63
|
-
return output.join('');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export const tmpl = (strings: TemplateStringsArray, ...args: any[]): NodeModel => {
|
|
67
|
-
return ParseTemplate(composite(strings, ...args));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export const css = composite;
|