@toolbox-web/grid 1.3.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/all.js +469 -444
- package/all.js.map +1 -1
- package/index.js +242 -240
- package/index.js.map +1 -1
- package/lib/core/types.d.ts +4 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +18 -16
- package/lib/plugins/clipboard/index.js.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/index.js +48 -46
- 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/index.js +41 -39
- package/lib/plugins/selection/index.js.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 +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/filtering.umd.js +1 -1
- package/umd/plugins/filtering.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>', w = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -6,9 +6,11 @@ const v = {
|
|
|
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 C {
|
|
12
14
|
/**
|
|
13
15
|
* Plugin dependencies - declare other plugins this one requires.
|
|
14
16
|
*
|
|
@@ -232,7 +234,7 @@ class w {
|
|
|
232
234
|
*/
|
|
233
235
|
get gridIcons() {
|
|
234
236
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
235
|
-
return { ...
|
|
237
|
+
return { ...w, ...e };
|
|
236
238
|
}
|
|
237
239
|
// #region Animation Helpers
|
|
238
240
|
/**
|
|
@@ -308,12 +310,12 @@ class w {
|
|
|
308
310
|
}
|
|
309
311
|
// #endregion
|
|
310
312
|
}
|
|
311
|
-
const
|
|
312
|
-
function
|
|
313
|
+
const y = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted, #888)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted, #888);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;-webkit-user-select:none;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg, #1f2937)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent, #3b82f6))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border, #e5e7eb));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg, #f9fafb));color:var(--tbw-color-fg, #1f2937);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover, #f3f4f6))}}';
|
|
314
|
+
function f(b) {
|
|
313
315
|
const e = b.meta ?? {};
|
|
314
316
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
315
317
|
}
|
|
316
|
-
class g extends
|
|
318
|
+
class g extends C {
|
|
317
319
|
/**
|
|
318
320
|
* Plugin dependencies - VisibilityPlugin optionally uses ReorderPlugin for drag-drop reordering.
|
|
319
321
|
*
|
|
@@ -328,7 +330,7 @@ class g extends w {
|
|
|
328
330
|
/** Tool panel ID for shell integration */
|
|
329
331
|
static PANEL_ID = "columns";
|
|
330
332
|
/** @internal */
|
|
331
|
-
styles =
|
|
333
|
+
styles = y;
|
|
332
334
|
/** @internal */
|
|
333
335
|
get defaultConfig() {
|
|
334
336
|
return {
|
|
@@ -504,16 +506,16 @@ class g extends w {
|
|
|
504
506
|
e.innerHTML = "";
|
|
505
507
|
const r = this.grid.getAllColumns().filter((s) => !s.utility);
|
|
506
508
|
for (let s = 0; s < r.length; s++) {
|
|
507
|
-
const i = r[s],
|
|
508
|
-
n.className = i.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", n.setAttribute("data-field", i.field), n.setAttribute("data-index", String(s)), t &&
|
|
509
|
+
const i = r[s], a = i.header || i.field, n = document.createElement("div");
|
|
510
|
+
n.className = i.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", n.setAttribute("data-field", i.field), n.setAttribute("data-index", String(s)), t && f(i) && (n.draggable = !0, n.classList.add("reorderable"), this.setupDragListeners(n, i.field, s, e));
|
|
509
511
|
const l = document.createElement("label");
|
|
510
512
|
l.className = "tbw-visibility-label";
|
|
511
513
|
const o = document.createElement("input");
|
|
512
514
|
o.type = "checkbox", o.checked = i.visible, o.disabled = i.lockVisible ?? !1, o.addEventListener("change", () => {
|
|
513
515
|
this.grid.toggleColumnVisibility(i.field), setTimeout(() => this.rebuildToggles(e), 0);
|
|
514
516
|
});
|
|
515
|
-
const
|
|
516
|
-
if (
|
|
517
|
+
const d = document.createElement("span");
|
|
518
|
+
if (d.textContent = a, l.appendChild(o), l.appendChild(d), t && f(i)) {
|
|
517
519
|
const c = document.createElement("span");
|
|
518
520
|
c.className = "tbw-visibility-handle", this.setIcon(c, this.resolveIcon("dragHandle")), c.title = "Drag to reorder", n.appendChild(c);
|
|
519
521
|
}
|
|
@@ -531,7 +533,7 @@ class g extends w {
|
|
|
531
533
|
this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null, this.clearDragClasses(s);
|
|
532
534
|
}), e.addEventListener("dragover", (i) => {
|
|
533
535
|
if (i.preventDefault(), !this.isDragging || this.draggedField === t) return;
|
|
534
|
-
const
|
|
536
|
+
const a = e.getBoundingClientRect(), n = a.top + a.height / 2;
|
|
535
537
|
this.dropIndex = i.clientY < n ? r : r + 1, s.querySelectorAll(".tbw-visibility-row").forEach((l) => {
|
|
536
538
|
l !== e && l.classList.remove("drop-target", "drop-before", "drop-after");
|
|
537
539
|
}), e.classList.add("drop-target"), e.classList.toggle("drop-before", i.clientY < n), e.classList.toggle("drop-after", i.clientY >= n);
|
|
@@ -539,18 +541,18 @@ class g extends w {
|
|
|
539
541
|
e.classList.remove("drop-target", "drop-before", "drop-after");
|
|
540
542
|
}), e.addEventListener("drop", (i) => {
|
|
541
543
|
i.preventDefault();
|
|
542
|
-
const
|
|
543
|
-
if (!this.isDragging ||
|
|
544
|
+
const a = this.draggedField, n = this.draggedIndex, l = this.dropIndex;
|
|
545
|
+
if (!this.isDragging || a === null || n === null || l === null)
|
|
544
546
|
return;
|
|
545
547
|
const o = l > n ? l - 1 : l;
|
|
546
548
|
if (o !== n) {
|
|
547
|
-
const
|
|
548
|
-
field:
|
|
549
|
+
const d = this.grid.getAllColumns(), h = d.filter((u) => !u.utility)[o]?.field, p = h ? d.findIndex((u) => u.field === h) : d.length, v = {
|
|
550
|
+
field: a,
|
|
549
551
|
fromIndex: n,
|
|
550
552
|
// Not used by ReorderPlugin, just for info
|
|
551
|
-
toIndex:
|
|
553
|
+
toIndex: p
|
|
552
554
|
};
|
|
553
|
-
this.emit("column-reorder-request",
|
|
555
|
+
this.emit("column-reorder-request", v), setTimeout(() => {
|
|
554
556
|
this.rebuildToggles(s);
|
|
555
557
|
}, 0);
|
|
556
558
|
}
|