@toolbox-web/grid 1.2.0 → 1.3.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/README.md +80 -22
- package/all.js +619 -571
- package/all.js.map +1 -1
- package/index.js +362 -302
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +64 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts +37 -0
- package/lib/core/internal/row-animation.d.ts.map +1 -0
- package/lib/core/types.d.ts +17 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +82 -76
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +1 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +43 -41
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +24 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +83 -52
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +22 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +160 -125
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +20 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +66 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +51 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +17 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +24 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +25 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +49 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +24 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +19 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +38 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +13 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +1 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +118 -85
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +50 -6
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +34 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +25 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +22 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +21 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +21 -4
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +19 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +9 -9
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.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/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const m = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', v = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -6,9 +6,11 @@ const _ = {
|
|
|
6
6
|
sortNone: "⇅",
|
|
7
7
|
submenuArrow: "▶",
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
|
-
toolPanel: "☰"
|
|
9
|
+
toolPanel: "☰",
|
|
10
|
+
filter: m,
|
|
11
|
+
filterActive: m
|
|
10
12
|
};
|
|
11
|
-
class
|
|
13
|
+
class A {
|
|
12
14
|
/**
|
|
13
15
|
* Plugin dependencies - declare other plugins this one requires.
|
|
14
16
|
*
|
|
@@ -232,7 +234,7 @@ class v {
|
|
|
232
234
|
*/
|
|
233
235
|
get gridIcons() {
|
|
234
236
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
235
|
-
return { ...
|
|
237
|
+
return { ...v, ...e };
|
|
236
238
|
}
|
|
237
239
|
// #region Animation Helpers
|
|
238
240
|
/**
|
|
@@ -308,7 +310,7 @@ class v {
|
|
|
308
310
|
}
|
|
309
311
|
// #endregion
|
|
310
312
|
}
|
|
311
|
-
function
|
|
313
|
+
function R(o, e, t) {
|
|
312
314
|
return o.id !== void 0 ? String(o.id) : t ? `${t}-${e}` : String(e);
|
|
313
315
|
}
|
|
314
316
|
function y(o, e) {
|
|
@@ -318,7 +320,7 @@ function y(o, e) {
|
|
|
318
320
|
function w(o, e, t = null, n = 0) {
|
|
319
321
|
const i = e.childrenField ?? "children", s = /* @__PURE__ */ new Set();
|
|
320
322
|
for (let r = 0; r < o.length; r++) {
|
|
321
|
-
const l = o[r], a =
|
|
323
|
+
const l = o[r], a = R(l, r, t), d = l[i];
|
|
322
324
|
if (Array.isArray(d) && d.length > 0) {
|
|
323
325
|
s.add(a);
|
|
324
326
|
const h = w(d, e, a, n + 1);
|
|
@@ -327,33 +329,33 @@ function w(o, e, t = null, n = 0) {
|
|
|
327
329
|
}
|
|
328
330
|
return s;
|
|
329
331
|
}
|
|
330
|
-
function
|
|
332
|
+
function E() {
|
|
331
333
|
return /* @__PURE__ */ new Set();
|
|
332
334
|
}
|
|
333
|
-
function
|
|
335
|
+
function _(o, e, t, n = null, i = 0) {
|
|
334
336
|
const s = t.childrenField ?? "children";
|
|
335
337
|
for (let r = 0; r < o.length; r++) {
|
|
336
|
-
const l = o[r], a =
|
|
338
|
+
const l = o[r], a = R(l, r, n);
|
|
337
339
|
if (a === e)
|
|
338
340
|
return [a];
|
|
339
341
|
const d = l[s];
|
|
340
342
|
if (Array.isArray(d) && d.length > 0) {
|
|
341
|
-
const h =
|
|
343
|
+
const h = _(d, e, t, a, i + 1);
|
|
342
344
|
if (h)
|
|
343
345
|
return [a, ...h];
|
|
344
346
|
}
|
|
345
347
|
}
|
|
346
348
|
return null;
|
|
347
349
|
}
|
|
348
|
-
function
|
|
349
|
-
const i =
|
|
350
|
+
function C(o, e, t, n) {
|
|
351
|
+
const i = _(o, e, t);
|
|
350
352
|
if (!i) return n;
|
|
351
353
|
const s = new Set(n);
|
|
352
354
|
for (let r = 0; r < i.length - 1; r++)
|
|
353
355
|
s.add(i[r]);
|
|
354
356
|
return s;
|
|
355
357
|
}
|
|
356
|
-
function
|
|
358
|
+
function x(o, e = "children") {
|
|
357
359
|
if (!Array.isArray(o) || o.length === 0) return !1;
|
|
358
360
|
for (const t of o) {
|
|
359
361
|
if (!t) continue;
|
|
@@ -363,7 +365,7 @@ function m(o, e = "children") {
|
|
|
363
365
|
}
|
|
364
366
|
return !1;
|
|
365
367
|
}
|
|
366
|
-
function
|
|
368
|
+
function k(o) {
|
|
367
369
|
if (!Array.isArray(o) || o.length === 0) return null;
|
|
368
370
|
const e = ["children", "items", "nodes", "subRows", "nested"];
|
|
369
371
|
for (const t of o)
|
|
@@ -375,12 +377,12 @@ function C(o) {
|
|
|
375
377
|
}
|
|
376
378
|
return null;
|
|
377
379
|
}
|
|
378
|
-
const
|
|
379
|
-
class
|
|
380
|
+
const T = "@layer tbw-plugins{tbw-grid .cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}tbw-grid .header-row .cell[data-field=__tbw_expander]{display:none}tbw-grid .header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}tbw-grid .tree-cell-wrapper{display:inline-flex;align-items:center;padding-left:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}tbw-grid .tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}tbw-grid .tree-toggle{cursor:pointer;-webkit-user-select:none;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}tbw-grid .tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}tbw-grid .tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}tbw-grid .data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}tbw-grid .data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
|
|
381
|
+
class F extends A {
|
|
380
382
|
/** @internal */
|
|
381
383
|
name = "tree";
|
|
382
384
|
/** @internal */
|
|
383
|
-
styles =
|
|
385
|
+
styles = T;
|
|
384
386
|
/** @internal */
|
|
385
387
|
get defaultConfig() {
|
|
386
388
|
return {
|
|
@@ -417,15 +419,15 @@ class T extends v {
|
|
|
417
419
|
// #region Auto-Detection
|
|
418
420
|
detect(e) {
|
|
419
421
|
if (!this.config.autoDetect) return !1;
|
|
420
|
-
const t = e, n = this.config.childrenField ??
|
|
421
|
-
return
|
|
422
|
+
const t = e, n = this.config.childrenField ?? k(t) ?? "children";
|
|
423
|
+
return x(t, n);
|
|
422
424
|
}
|
|
423
425
|
// #endregion
|
|
424
426
|
// #region Data Processing
|
|
425
427
|
/** @internal */
|
|
426
428
|
processRows(e) {
|
|
427
429
|
const t = this.config.childrenField ?? "children", n = e;
|
|
428
|
-
if (!
|
|
430
|
+
if (!x(n, t))
|
|
429
431
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
430
432
|
let i = this.withStableKeys(n);
|
|
431
433
|
this.sortState && (i = this.sortTree(i, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = w(i, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(i, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
@@ -568,7 +570,7 @@ class T extends v {
|
|
|
568
570
|
this.expandedKeys = w(this.rows, this.config), this.requestRender();
|
|
569
571
|
}
|
|
570
572
|
collapseAll() {
|
|
571
|
-
this.expandedKeys =
|
|
573
|
+
this.expandedKeys = E(), this.requestRender();
|
|
572
574
|
}
|
|
573
575
|
isExpanded(e) {
|
|
574
576
|
return this.expandedKeys.has(e);
|
|
@@ -583,11 +585,11 @@ class T extends v {
|
|
|
583
585
|
return this.rowKeyMap.get(e)?.data;
|
|
584
586
|
}
|
|
585
587
|
expandToKey(e) {
|
|
586
|
-
this.expandedKeys =
|
|
588
|
+
this.expandedKeys = C(this.rows, e, this.config, this.expandedKeys), this.requestRender();
|
|
587
589
|
}
|
|
588
590
|
// #endregion
|
|
589
591
|
}
|
|
590
592
|
export {
|
|
591
|
-
|
|
593
|
+
F as TreePlugin
|
|
592
594
|
};
|
|
593
595
|
//# sourceMappingURL=index.js.map
|