@toolbox-web/grid 0.3.3 → 0.4.0
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/all.d.ts +19 -19
- package/all.d.ts.map +1 -1
- package/all.js +1775 -1202
- package/all.js.map +1 -1
- package/index.js +2152 -2028
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +22 -12
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/columns.d.ts +0 -9
- package/lib/core/internal/columns.d.ts.map +1 -1
- package/lib/core/internal/config-manager.d.ts +236 -0
- package/lib/core/internal/config-manager.d.ts.map +1 -0
- package/lib/core/internal/event-delegation.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/render-scheduler.d.ts +123 -0
- package/lib/core/internal/render-scheduler.d.ts.map +1 -0
- package/lib/core/internal/rows.d.ts +8 -3
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/sanitize.d.ts +2 -2
- package/lib/core/internal/sanitize.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +40 -2
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts +11 -0
- package/lib/core/internal/validate-config.d.ts.map +1 -0
- package/lib/core/plugin/base-plugin.d.ts +70 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +13 -2
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +17 -3
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +112 -12
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +50 -18
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +60 -25
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +51 -16
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +117 -0
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -0
- package/lib/{core/internal → plugins/editing}/editors.d.ts +1 -1
- package/lib/plugins/editing/editors.d.ts.map +1 -0
- package/lib/plugins/editing/index.d.ts +8 -0
- package/lib/plugins/editing/index.d.ts.map +1 -0
- package/lib/plugins/editing/index.js +705 -0
- package/lib/plugins/editing/index.js.map +1 -0
- package/lib/plugins/editing/types.d.ts +45 -0
- package/lib/plugins/editing/types.d.ts.map +1 -0
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
- package/lib/plugins/export/index.js +74 -39
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +87 -50
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/grouping-columns.d.ts +4 -4
- package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +59 -24
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/grouping-rows.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +46 -11
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +2 -2
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +140 -102
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/master-detail/types.d.ts +12 -2
- package/lib/plugins/master-detail/types.d.ts.map +1 -1
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.js +59 -22
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +41 -6
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +45 -9
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +42 -7
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js +59 -19
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +41 -6
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +48 -13
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +3 -3
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +165 -126
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/tree/tree-data.d.ts +6 -6
- package/lib/plugins/tree/tree-data.d.ts.map +1 -1
- package/lib/plugins/tree/tree-detect.d.ts +5 -9
- package/lib/plugins/tree/tree-detect.d.ts.map +1 -1
- package/lib/plugins/tree/types.d.ts +16 -4
- package/lib/plugins/tree/types.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +46 -11
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +37 -2
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +104 -13
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +31 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +18 -6
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +1 -1
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +2 -0
- package/umd/plugins/editing.umd.js.map +1 -0
- package/umd/plugins/export.umd.js +2 -2
- package/umd/plugins/export.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/reorder.umd.js +1 -1
- package/umd/plugins/reorder.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/lib/core/internal/column-state.d.ts +0 -124
- package/lib/core/internal/column-state.d.ts.map +0 -1
- package/lib/core/internal/editing.d.ts +0 -76
- package/lib/core/internal/editing.d.ts.map +0 -1
- package/lib/core/internal/editors.d.ts.map +0 -1
- package/lib/core/internal/grid-internals.d.ts +0 -83
- package/lib/core/internal/grid-internals.d.ts.map +0 -1
|
@@ -33,6 +33,12 @@ class C {
|
|
|
33
33
|
config;
|
|
34
34
|
/** User-provided configuration from constructor */
|
|
35
35
|
userConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Plugin-level AbortController for event listener cleanup.
|
|
38
|
+
* Created fresh in attach(), aborted in detach().
|
|
39
|
+
* This ensures event listeners are properly cleaned up when plugins are re-attached.
|
|
40
|
+
*/
|
|
41
|
+
#t;
|
|
36
42
|
/**
|
|
37
43
|
* Default configuration - subclasses should override this getter.
|
|
38
44
|
* Note: This must be a getter (not property initializer) for proper inheritance
|
|
@@ -47,19 +53,48 @@ class C {
|
|
|
47
53
|
/**
|
|
48
54
|
* Called when the plugin is attached to a grid.
|
|
49
55
|
* Override to set up event listeners, initialize state, etc.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* attach(grid: GridElement): void {
|
|
60
|
+
* super.attach(grid);
|
|
61
|
+
* // Set up document-level listeners with auto-cleanup
|
|
62
|
+
* document.addEventListener('keydown', this.handleEscape, {
|
|
63
|
+
* signal: this.disconnectSignal
|
|
64
|
+
* });
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
50
67
|
*/
|
|
51
68
|
attach(e) {
|
|
52
|
-
this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
|
|
69
|
+
this.#t?.abort(), this.#t = new AbortController(), this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
|
|
53
70
|
}
|
|
54
71
|
/**
|
|
55
72
|
* Called when the plugin is detached from a grid.
|
|
56
73
|
* Override to clean up event listeners, timers, etc.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* detach(): void {
|
|
78
|
+
* // Clean up any state not handled by disconnectSignal
|
|
79
|
+
* this.selectedRows.clear();
|
|
80
|
+
* this.cache = null;
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
57
83
|
*/
|
|
58
84
|
detach() {
|
|
85
|
+
this.#t?.abort(), this.#t = void 0;
|
|
59
86
|
}
|
|
60
87
|
/**
|
|
61
88
|
* Get another plugin instance from the same grid.
|
|
62
89
|
* Use for inter-plugin communication.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const selection = this.getPlugin(SelectionPlugin);
|
|
94
|
+
* if (selection) {
|
|
95
|
+
* const selectedRows = selection.getSelectedRows();
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
63
98
|
*/
|
|
64
99
|
getPlugin(e) {
|
|
65
100
|
return this.grid?.getPlugin(e);
|
|
@@ -133,7 +168,7 @@ class C {
|
|
|
133
168
|
* document.addEventListener('keydown', handler, { signal: this.disconnectSignal });
|
|
134
169
|
*/
|
|
135
170
|
get disconnectSignal() {
|
|
136
|
-
return this.grid?.disconnectSignal;
|
|
171
|
+
return this.#t?.signal ?? this.grid?.disconnectSignal;
|
|
137
172
|
}
|
|
138
173
|
/**
|
|
139
174
|
* Get the grid-level icons configuration.
|
|
@@ -190,14 +225,14 @@ function m(s) {
|
|
|
190
225
|
function u(s) {
|
|
191
226
|
return s.map(m);
|
|
192
227
|
}
|
|
193
|
-
function
|
|
228
|
+
function b(s, e, t) {
|
|
194
229
|
const r = h(t);
|
|
195
230
|
return s >= r.startRow && s <= r.endRow && e >= r.startCol && e <= r.endCol;
|
|
196
231
|
}
|
|
197
232
|
function f(s, e, t) {
|
|
198
|
-
return t.some((r) =>
|
|
233
|
+
return t.some((r) => b(s, e, r));
|
|
199
234
|
}
|
|
200
|
-
function
|
|
235
|
+
function p(s) {
|
|
201
236
|
const e = [], t = h(s);
|
|
202
237
|
for (let r = t.startRow; r <= t.endRow; r++)
|
|
203
238
|
for (let n = t.startCol; n <= t.endCol; n++)
|
|
@@ -207,7 +242,7 @@ function b(s) {
|
|
|
207
242
|
function A(s) {
|
|
208
243
|
const e = /* @__PURE__ */ new Map();
|
|
209
244
|
for (const t of s)
|
|
210
|
-
for (const r of
|
|
245
|
+
for (const r of p(t))
|
|
211
246
|
e.set(`${r.row},${r.col}`, r);
|
|
212
247
|
return [...e.values()];
|
|
213
248
|
}
|