@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,38 +1,38 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function v(a) {
|
|
2
|
+
a && a.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
3
3
|
}
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function h(
|
|
9
|
-
if (
|
|
10
|
-
const { rowHeight: o, container: s, viewportEl:
|
|
4
|
+
const R = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', m = document.createElement("template");
|
|
5
|
+
m.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
6
|
+
const _ = document.createElement("template");
|
|
7
|
+
_.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
8
|
+
function h(a, e) {
|
|
9
|
+
if (a._virtualization?.enabled) {
|
|
10
|
+
const { rowHeight: o, container: s, viewportEl: l } = a._virtualization, c = s, d = l?.clientHeight ?? c?.clientHeight ?? 0;
|
|
11
11
|
if (c && d > 0) {
|
|
12
|
-
const u =
|
|
12
|
+
const u = a._focusRow * o;
|
|
13
13
|
u < c.scrollTop ? c.scrollTop = u : u + o > c.scrollTop + d && (c.scrollTop = u - d + o);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
const r =
|
|
17
|
-
r ||
|
|
16
|
+
const r = a._activeEditRows !== void 0 && a._activeEditRows !== -1;
|
|
17
|
+
r || a.refreshVirtualWindow(!1), v(a._bodyEl), Array.from(a._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((o) => {
|
|
18
18
|
o.setAttribute("aria-selected", "false");
|
|
19
19
|
});
|
|
20
|
-
const t =
|
|
20
|
+
const t = a._focusRow, i = a._virtualization.start ?? 0, n = a._virtualization.end ?? a._rows.length;
|
|
21
21
|
if (t >= i && t < n) {
|
|
22
|
-
const o =
|
|
23
|
-
let s = o?.children[
|
|
24
|
-
if ((!s || !s.classList?.contains("cell")) && (s = o?.querySelector(`.cell[data-col="${
|
|
22
|
+
const o = a._bodyEl.querySelectorAll(".data-grid-row")[t - i];
|
|
23
|
+
let s = o?.children[a._focusCol];
|
|
24
|
+
if ((!s || !s.classList?.contains("cell")) && (s = o?.querySelector(`.cell[data-col="${a._focusCol}"]`) ?? o?.querySelector(".cell[data-col]")), s) {
|
|
25
25
|
s.classList.add("cell-focus"), s.setAttribute("aria-selected", "true");
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
28
|
-
const c =
|
|
26
|
+
const l = a.querySelector(".tbw-scroll-area");
|
|
27
|
+
if (l && s && !r) {
|
|
28
|
+
const c = a._getHorizontalScrollOffsets?.(o ?? void 0, s) ?? { left: 0, right: 0 };
|
|
29
29
|
if (!c.skipScroll) {
|
|
30
|
-
const d = s.getBoundingClientRect(), u =
|
|
31
|
-
g <
|
|
30
|
+
const d = s.getBoundingClientRect(), u = l.getBoundingClientRect(), g = d.left - u.left + l.scrollLeft, f = g + d.width, b = l.scrollLeft + c.left, p = l.scrollLeft + l.clientWidth - c.right;
|
|
31
|
+
g < b ? l.scrollLeft = g - c.left : f > p && (l.scrollLeft = f - l.clientWidth + c.right);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
35
|
-
const c = s.querySelector(
|
|
34
|
+
if (a._activeEditRows !== void 0 && a._activeEditRows !== -1 && s.classList.contains("editing")) {
|
|
35
|
+
const c = s.querySelector(R);
|
|
36
36
|
if (c && document.activeElement !== c)
|
|
37
37
|
try {
|
|
38
38
|
c.focus({ preventScroll: !0 });
|
|
@@ -48,7 +48,7 @@ function h(l, e) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
const
|
|
51
|
+
const w = '<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>', E = {
|
|
52
52
|
expand: "▶",
|
|
53
53
|
collapse: "▼",
|
|
54
54
|
sortAsc: "▲",
|
|
@@ -56,7 +56,9 @@ const _ = {
|
|
|
56
56
|
sortNone: "⇅",
|
|
57
57
|
submenuArrow: "▶",
|
|
58
58
|
dragHandle: "⋮⋮",
|
|
59
|
-
toolPanel: "☰"
|
|
59
|
+
toolPanel: "☰",
|
|
60
|
+
filter: w,
|
|
61
|
+
filterActive: w
|
|
60
62
|
};
|
|
61
63
|
class y {
|
|
62
64
|
/**
|
|
@@ -282,7 +284,7 @@ class y {
|
|
|
282
284
|
*/
|
|
283
285
|
get gridIcons() {
|
|
284
286
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
285
|
-
return { ...
|
|
287
|
+
return { ...E, ...e };
|
|
286
288
|
}
|
|
287
289
|
// #region Animation Helpers
|
|
288
290
|
/**
|
|
@@ -358,12 +360,12 @@ class y {
|
|
|
358
360
|
}
|
|
359
361
|
// #endregion
|
|
360
362
|
}
|
|
361
|
-
const
|
|
362
|
-
class
|
|
363
|
+
const C = '.dg-row-drag-handle{display:flex;align-items:center;justify-content:center;cursor:grab;-webkit-user-select:none;user-select:none;color:var(--tbw-color-fg-muted, #999);transition:color .15s ease;font-size:14px;letter-spacing:-2px}.dg-row-drag-handle:hover{color:var(--tbw-color-fg, #333)}.dg-row-drag-handle:active{cursor:grabbing}.data-grid-row.dragging{opacity:.6}.data-grid-row.drop-target{position:relative}.data-grid-row.drop-target.drop-before:before{content:"";position:absolute;top:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}.data-grid-row.drop-target.drop-after:after{content:"";position:absolute;bottom:0;left:0;right:0;height:2px;background-color:var(--tbw-color-accent, #1976d2);z-index:10}.data-grid-row.keyboard-moving{background-color:var(--tbw-color-bg-selected, #e3f2fd);box-shadow:0 0 0 1px var(--tbw-color-accent, #1976d2) inset}.data-grid-row.animate-flip{transition:transform var(--tbw-animation-duration, .2s) ease-out}', L = "__tbw_row_drag";
|
|
364
|
+
class A extends y {
|
|
363
365
|
/** @internal */
|
|
364
366
|
name = "rowReorder";
|
|
365
367
|
/** @internal */
|
|
366
|
-
styles =
|
|
368
|
+
styles = C;
|
|
367
369
|
/** @internal */
|
|
368
370
|
get defaultConfig() {
|
|
369
371
|
return {
|
|
@@ -396,7 +398,7 @@ class D extends y {
|
|
|
396
398
|
if (!this.config.showDragHandle)
|
|
397
399
|
return [...e];
|
|
398
400
|
const r = {
|
|
399
|
-
field:
|
|
401
|
+
field: L,
|
|
400
402
|
header: "",
|
|
401
403
|
width: this.config.dragHandleWidth ?? 40,
|
|
402
404
|
resizable: !1,
|
|
@@ -524,8 +526,8 @@ class D extends y {
|
|
|
524
526
|
currentIndex: t,
|
|
525
527
|
row: e
|
|
526
528
|
}, this.lastFocusCol = n;
|
|
527
|
-
const o = this.grid, s = [...o._rows ?? this.sourceRows], [
|
|
528
|
-
s.splice(t, 0,
|
|
529
|
+
const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(r, 1);
|
|
530
|
+
s.splice(t, 0, l), o._rows = s, o._focusRow = t, o._focusCol = n, o.refreshVirtualWindow(!0), h(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
|
|
529
531
|
this.flushPendingMove();
|
|
530
532
|
}, this.config.debounceMs ?? 300);
|
|
531
533
|
}
|
|
@@ -547,8 +549,8 @@ class D extends y {
|
|
|
547
549
|
if (this.emitCancelable("row-move", i)) {
|
|
548
550
|
const o = [...this.sourceRows], [s] = o.splice(r, 1);
|
|
549
551
|
o.splice(e, 0, s);
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
+
const l = this.grid;
|
|
553
|
+
l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), h(l);
|
|
552
554
|
}
|
|
553
555
|
}
|
|
554
556
|
/**
|
|
@@ -591,7 +593,7 @@ class D extends y {
|
|
|
591
593
|
// #endregion
|
|
592
594
|
}
|
|
593
595
|
export {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
+
L as ROW_DRAG_HANDLE_FIELD,
|
|
597
|
+
A as RowReorderPlugin
|
|
596
598
|
};
|
|
597
599
|
//# sourceMappingURL=index.js.map
|