@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,11 +1,11 @@
|
|
|
1
1
|
function b(l) {
|
|
2
2
|
l && l.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
3
3
|
}
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function
|
|
4
|
+
const C = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', E = document.createElement("template");
|
|
5
|
+
E.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
6
|
+
const w = document.createElement("template");
|
|
7
|
+
w.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
8
|
+
function y(l, e) {
|
|
9
9
|
if (l._virtualization?.enabled) {
|
|
10
10
|
const { rowHeight: a, container: r, viewportEl: s } = l._virtualization, o = r, c = s?.clientHeight ?? o?.clientHeight ?? 0;
|
|
11
11
|
if (o && c > 0) {
|
|
@@ -32,7 +32,7 @@ function w(l, e) {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
if (l._activeEditRows !== void 0 && l._activeEditRows !== -1 && r.classList.contains("editing")) {
|
|
35
|
-
const o = r.querySelector(
|
|
35
|
+
const o = r.querySelector(C);
|
|
36
36
|
if (o && document.activeElement !== o)
|
|
37
37
|
try {
|
|
38
38
|
o.focus({ preventScroll: !0 });
|
|
@@ -48,7 +48,7 @@ function w(l, e) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
const
|
|
51
|
+
const p = '<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>', L = {
|
|
52
52
|
expand: "▶",
|
|
53
53
|
collapse: "▼",
|
|
54
54
|
sortAsc: "▲",
|
|
@@ -56,12 +56,14 @@ const y = {
|
|
|
56
56
|
sortNone: "⇅",
|
|
57
57
|
submenuArrow: "▶",
|
|
58
58
|
dragHandle: "⋮⋮",
|
|
59
|
-
toolPanel: "☰"
|
|
60
|
-
|
|
59
|
+
toolPanel: "☰",
|
|
60
|
+
filter: p,
|
|
61
|
+
filterActive: p
|
|
62
|
+
}, A = {
|
|
61
63
|
/** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
|
|
62
64
|
CAN_MOVE_COLUMN: "canMoveColumn"
|
|
63
65
|
};
|
|
64
|
-
class
|
|
66
|
+
class O {
|
|
65
67
|
/**
|
|
66
68
|
* Plugin dependencies - declare other plugins this one requires.
|
|
67
69
|
*
|
|
@@ -285,7 +287,7 @@ class A {
|
|
|
285
287
|
*/
|
|
286
288
|
get gridIcons() {
|
|
287
289
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
288
|
-
return { ...
|
|
290
|
+
return { ...L, ...e };
|
|
289
291
|
}
|
|
290
292
|
// #region Animation Helpers
|
|
291
293
|
/**
|
|
@@ -361,21 +363,21 @@ class A {
|
|
|
361
363
|
}
|
|
362
364
|
// #endregion
|
|
363
365
|
}
|
|
364
|
-
function
|
|
366
|
+
function _(l) {
|
|
365
367
|
const e = l.meta ?? {};
|
|
366
368
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
367
369
|
}
|
|
368
|
-
function
|
|
370
|
+
function v(l, e, t) {
|
|
369
371
|
if (e === t || e < 0 || e >= l.length || t < 0 || t > l.length) return l;
|
|
370
372
|
const i = [...l], [n] = i.splice(e, 1);
|
|
371
373
|
return i.splice(t, 0, n), i;
|
|
372
374
|
}
|
|
373
|
-
const
|
|
374
|
-
class
|
|
375
|
+
const R = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
|
|
376
|
+
class x extends O {
|
|
375
377
|
/** @internal */
|
|
376
378
|
name = "reorder";
|
|
377
379
|
/** @internal */
|
|
378
|
-
styles =
|
|
380
|
+
styles = R;
|
|
379
381
|
/** @internal */
|
|
380
382
|
get defaultConfig() {
|
|
381
383
|
return {
|
|
@@ -406,8 +408,8 @@ class R extends A {
|
|
|
406
408
|
* Check if a column can be moved, considering both column config and plugin queries.
|
|
407
409
|
*/
|
|
408
410
|
canMoveColumnWithPlugins(e) {
|
|
409
|
-
return !e || !
|
|
410
|
-
type:
|
|
411
|
+
return !e || !_(e) ? !1 : !this.grid.queryPlugins({
|
|
412
|
+
type: A.CAN_MOVE_COLUMN,
|
|
411
413
|
context: e
|
|
412
414
|
}).includes(!1);
|
|
413
415
|
}
|
|
@@ -466,7 +468,7 @@ class R extends A {
|
|
|
466
468
|
const s = this.draggedField, o = this.draggedIndex, c = this.dropIndex;
|
|
467
469
|
if (!this.isDragging || s === null || o === null || c === null)
|
|
468
470
|
return;
|
|
469
|
-
const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g =
|
|
471
|
+
const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g = v(f, o, u), h = {
|
|
470
472
|
field: s,
|
|
471
473
|
fromIndex: o,
|
|
472
474
|
toIndex: u,
|
|
@@ -493,7 +495,7 @@ class R extends A {
|
|
|
493
495
|
if (s < 0 || s >= a.length) return;
|
|
494
496
|
const o = n.find((c) => c.field === a[s]);
|
|
495
497
|
if (this.canMoveColumnWithPlugins(o))
|
|
496
|
-
return this.moveColumn(d.field, s), t._focusCol = s,
|
|
498
|
+
return this.moveColumn(d.field, s), t._focusCol = s, y(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
497
499
|
}
|
|
498
500
|
// #endregion
|
|
499
501
|
// #region Public API
|
|
@@ -512,7 +514,7 @@ class R extends A {
|
|
|
512
514
|
moveColumn(e, t) {
|
|
513
515
|
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
514
516
|
if (n === -1) return;
|
|
515
|
-
const d =
|
|
517
|
+
const d = v(i, n, t);
|
|
516
518
|
this.emitCancelable("column-move", {
|
|
517
519
|
field: e,
|
|
518
520
|
fromIndex: n,
|
|
@@ -633,6 +635,6 @@ class R extends A {
|
|
|
633
635
|
// #endregion
|
|
634
636
|
}
|
|
635
637
|
export {
|
|
636
|
-
|
|
638
|
+
x as ReorderPlugin
|
|
637
639
|
};
|
|
638
640
|
//# sourceMappingURL=index.js.map
|