@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingRowsPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-rows/GroupingRowsPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"GroupingRowsPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-rows/GroupingRowsPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAW/E,OAAO,KAAK,EAEV,kBAAkB,EAGlB,SAAS,EACV,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,QAAQ,EAAE,OAA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AM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAOzB;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAS3B;;;OAGG;IACH,aAAa,IAAI,UAAU;IAU3B;;;OAGG;IACH,WAAW,IAAI,MAAM;IAIrB;;;OAGG;IACH,aAAa,IAAI,IAAI;IAIrB;;;OAGG;IACH,iBAAiB,IAAI,MAAM,EAAE;IAI7B;;;OAGG;IACH,gBAAgB,IAAI,SAAS,EAAE;IAI/B;;;OAGG;IACH,gBAAgB,IAAI,OAAO;IAI3B;;;OAGG;IACH,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,SAAS,GAAG,IAAI;IAQ5E,SAAkB,MAAM,SAAU;CAEnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grouping-rows.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-rows/grouping-rows.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"grouping-rows.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/grouping-rows/grouping-rows.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAqB,SAAS,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG/E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAWpH,UAAU,iBAAiB;IACzB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,GAAG,SAAS,EAAE,CA+D/F;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAQxF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAQ9D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CAAC,MAAM,CAAC,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,GAAG,MAAM,CAG5D"}
|
|
@@ -25,6 +25,12 @@ class R {
|
|
|
25
25
|
config;
|
|
26
26
|
/** User-provided configuration from constructor */
|
|
27
27
|
userConfig;
|
|
28
|
+
/**
|
|
29
|
+
* Plugin-level AbortController for event listener cleanup.
|
|
30
|
+
* Created fresh in attach(), aborted in detach().
|
|
31
|
+
* This ensures event listeners are properly cleaned up when plugins are re-attached.
|
|
32
|
+
*/
|
|
33
|
+
#e;
|
|
28
34
|
/**
|
|
29
35
|
* Default configuration - subclasses should override this getter.
|
|
30
36
|
* Note: This must be a getter (not property initializer) for proper inheritance
|
|
@@ -39,19 +45,48 @@ class R {
|
|
|
39
45
|
/**
|
|
40
46
|
* Called when the plugin is attached to a grid.
|
|
41
47
|
* Override to set up event listeners, initialize state, etc.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* attach(grid: GridElement): void {
|
|
52
|
+
* super.attach(grid);
|
|
53
|
+
* // Set up document-level listeners with auto-cleanup
|
|
54
|
+
* document.addEventListener('keydown', this.handleEscape, {
|
|
55
|
+
* signal: this.disconnectSignal
|
|
56
|
+
* });
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
42
59
|
*/
|
|
43
60
|
attach(e) {
|
|
44
|
-
this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
|
|
61
|
+
this.#e?.abort(), this.#e = new AbortController(), this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
|
|
45
62
|
}
|
|
46
63
|
/**
|
|
47
64
|
* Called when the plugin is detached from a grid.
|
|
48
65
|
* Override to clean up event listeners, timers, etc.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* detach(): void {
|
|
70
|
+
* // Clean up any state not handled by disconnectSignal
|
|
71
|
+
* this.selectedRows.clear();
|
|
72
|
+
* this.cache = null;
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
49
75
|
*/
|
|
50
76
|
detach() {
|
|
77
|
+
this.#e?.abort(), this.#e = void 0;
|
|
51
78
|
}
|
|
52
79
|
/**
|
|
53
80
|
* Get another plugin instance from the same grid.
|
|
54
81
|
* Use for inter-plugin communication.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const selection = this.getPlugin(SelectionPlugin);
|
|
86
|
+
* if (selection) {
|
|
87
|
+
* const selectedRows = selection.getSelectedRows();
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
55
90
|
*/
|
|
56
91
|
getPlugin(e) {
|
|
57
92
|
return this.grid?.getPlugin(e);
|
|
@@ -125,7 +160,7 @@ class R {
|
|
|
125
160
|
* document.addEventListener('keydown', handler, { signal: this.disconnectSignal });
|
|
126
161
|
*/
|
|
127
162
|
get disconnectSignal() {
|
|
128
|
-
return this.grid?.disconnectSignal;
|
|
163
|
+
return this.#e?.signal ?? this.grid?.disconnectSignal;
|
|
129
164
|
}
|
|
130
165
|
/**
|
|
131
166
|
* Get the grid-level icons configuration.
|
|
@@ -164,7 +199,7 @@ class R {
|
|
|
164
199
|
}
|
|
165
200
|
// #endregion
|
|
166
201
|
}
|
|
167
|
-
const
|
|
202
|
+
const m = {
|
|
168
203
|
sum: (n, e) => n.reduce((t, i) => t + (Number(i[e]) || 0), 0),
|
|
169
204
|
avg: (n, e) => {
|
|
170
205
|
const t = n.reduce((i, r) => i + (Number(r[e]) || 0), 0);
|
|
@@ -193,7 +228,7 @@ const b = {
|
|
|
193
228
|
*/
|
|
194
229
|
get(n) {
|
|
195
230
|
if (n !== void 0)
|
|
196
|
-
return typeof n == "function" ? n : _.get(n) ??
|
|
231
|
+
return typeof n == "function" ? n : _.get(n) ?? m[n];
|
|
197
232
|
},
|
|
198
233
|
/**
|
|
199
234
|
* Run an aggregator on a set of rows.
|
|
@@ -206,13 +241,13 @@ const b = {
|
|
|
206
241
|
* Check if an aggregator exists.
|
|
207
242
|
*/
|
|
208
243
|
has(n) {
|
|
209
|
-
return _.has(n) || n in
|
|
244
|
+
return _.has(n) || n in m;
|
|
210
245
|
},
|
|
211
246
|
/**
|
|
212
247
|
* List all available aggregator names.
|
|
213
248
|
*/
|
|
214
249
|
list() {
|
|
215
|
-
return [...Object.keys(
|
|
250
|
+
return [...Object.keys(m), ..._.keys()];
|
|
216
251
|
}
|
|
217
252
|
};
|
|
218
253
|
f.register.bind(f);
|
|
@@ -229,10 +264,10 @@ function v({ rows: n, config: e, expanded: t }) {
|
|
|
229
264
|
let d = i(s);
|
|
230
265
|
d == null || d === !1 ? d = ["__ungrouped__"] : Array.isArray(d) || (d = [d]);
|
|
231
266
|
let a = r;
|
|
232
|
-
d.forEach((c,
|
|
267
|
+
d.forEach((c, b) => {
|
|
233
268
|
const l = c == null ? "∅" : String(c), g = a.key === "__root__" ? l : a.key + "||" + l;
|
|
234
269
|
let p = a.children.get(l);
|
|
235
|
-
p || (p = { key: g, value: c, depth:
|
|
270
|
+
p || (p = { key: g, value: c, depth: b, rows: [], children: /* @__PURE__ */ new Map(), parent: a }, a.children.set(l, p)), a = p;
|
|
236
271
|
}), a.rows.push(s);
|
|
237
272
|
}), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === n.length)
|
|
238
273
|
return [];
|
|
@@ -319,7 +354,7 @@ class E extends R {
|
|
|
319
354
|
if (typeof t.groupOn != "function")
|
|
320
355
|
return this.isActive = !1, this.flattenedRows = [], [...e];
|
|
321
356
|
const i = v({
|
|
322
|
-
rows: e,
|
|
357
|
+
rows: [...e],
|
|
323
358
|
config: t,
|
|
324
359
|
expanded: this.expandedKeys
|
|
325
360
|
});
|
|
@@ -405,9 +440,9 @@ class E extends R {
|
|
|
405
440
|
}
|
|
406
441
|
renderPerColumnGroupRow(e, t, i) {
|
|
407
442
|
const r = this.config, o = r.aggregators ?? {}, u = this.columns, s = e.__groupRows ?? [], a = this.shadowRoot?.querySelector(".body")?.style.gridTemplateColumns || "";
|
|
408
|
-
a && (t.style.display = "grid", t.style.gridTemplateColumns = a), u.forEach((c,
|
|
443
|
+
a && (t.style.display = "grid", t.style.gridTemplateColumns = a), u.forEach((c, b) => {
|
|
409
444
|
const l = document.createElement("div");
|
|
410
|
-
if (l.className = "cell group-cell", l.setAttribute("data-col", String(
|
|
445
|
+
if (l.className = "cell group-cell", l.setAttribute("data-col", String(b)), l.setAttribute("role", "gridcell"), b === 0) {
|
|
411
446
|
const g = document.createElement("button");
|
|
412
447
|
g.type = "button", g.className = `group-toggle${e.__groupExpanded ? " expanded" : ""}`, g.setAttribute("aria-label", e.__groupExpanded ? "Collapse group" : "Expand group"), this.setIcon(g, this.resolveIcon(e.__groupExpanded ? "collapse" : "expand")), g.addEventListener("click", (h) => {
|
|
413
448
|
h.stopPropagation(), i();
|