@toolbox-web/grid 0.4.0 → 0.4.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 +46 -22
- package/all.js.map +1 -1
- package/index.js +516 -451
- package/index.js.map +1 -1
- package/lib/core/internal/editing.d.ts +76 -0
- package/lib/core/internal/editing.d.ts.map +1 -0
- package/lib/core/internal/validate-config.d.ts +14 -0
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +48 -0
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/index.d.ts +1 -0
- package/lib/core/plugin/index.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +1 -1
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +7 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +28 -4
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +20 -4
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +30 -14
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js +24 -8
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +44 -28
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js +16 -0
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +22 -6
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +16 -0
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +16 -0
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +16 -0
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +16 -0
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +16 -0
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +16 -0
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js +16 -0
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js +16 -0
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +20 -4
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +16 -0
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +7 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +29 -5
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +7 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +24 -0
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +23 -17
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +14 -8
- 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 +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/undo-redo.umd.js +1 -1
- package/umd/plugins/undo-redo.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -61,6 +61,14 @@ async function fe() {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
class Tn extends x {
|
|
64
|
+
/**
|
|
65
|
+
* Plugin dependencies - ClipboardPlugin requires SelectionPlugin to know what to copy.
|
|
66
|
+
*
|
|
67
|
+
* The SelectionPlugin must be loaded BEFORE this plugin in the plugins array.
|
|
68
|
+
*/
|
|
69
|
+
static dependencies = [
|
|
70
|
+
{ name: "selection", required: !0, reason: "ClipboardPlugin needs selection to determine what cells to copy" }
|
|
71
|
+
];
|
|
64
72
|
name = "clipboard";
|
|
65
73
|
version = "1.0.0";
|
|
66
74
|
get defaultConfig() {
|
|
@@ -1004,7 +1012,7 @@ class Pn extends x {
|
|
|
1004
1012
|
}, h = () => {
|
|
1005
1013
|
d = !0, I(n.field) && (e[n.field] = l);
|
|
1006
1014
|
}, u = document.createElement("div");
|
|
1007
|
-
u.
|
|
1015
|
+
u.className = "tbw-editor-host", o.innerHTML = "", o.appendChild(u), u.addEventListener("keydown", (m) => {
|
|
1008
1016
|
m.key === "Enter" && (m.stopPropagation(), m.preventDefault(), d = !0, this.#o(t, !1)), m.key === "Escape" && (m.stopPropagation(), m.preventDefault(), h(), this.#o(t, !0));
|
|
1009
1017
|
});
|
|
1010
1018
|
const f = n, g = f.__editorTemplate, p = f.editor || (g ? "template" : tt(n)), w = l;
|
|
@@ -1706,10 +1714,10 @@ class _ extends x {
|
|
|
1706
1714
|
this.searchText.set(o, l.value), q(l.value);
|
|
1707
1715
|
}, this.config.debounceMs ?? 150);
|
|
1708
1716
|
});
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1717
|
+
const N = document.createElement("div");
|
|
1718
|
+
N.className = "tbw-filter-buttons";
|
|
1719
|
+
const K = document.createElement("button");
|
|
1720
|
+
K.className = "tbw-filter-apply-btn", K.textContent = "Apply", K.addEventListener("click", () => {
|
|
1713
1721
|
const b = [];
|
|
1714
1722
|
for (const [R, E] of w)
|
|
1715
1723
|
if (!E)
|
|
@@ -1720,11 +1728,11 @@ class _ extends x {
|
|
|
1720
1728
|
b.push(C !== void 0 ? C : R);
|
|
1721
1729
|
}
|
|
1722
1730
|
t.applySetFilter(b);
|
|
1723
|
-
}),
|
|
1731
|
+
}), N.appendChild(K);
|
|
1724
1732
|
const D = document.createElement("button");
|
|
1725
1733
|
D.className = "tbw-filter-clear-btn", D.textContent = "Clear Filter", D.addEventListener("click", () => {
|
|
1726
1734
|
t.clearFilter();
|
|
1727
|
-
}),
|
|
1735
|
+
}), N.appendChild(D), e.appendChild(N);
|
|
1728
1736
|
}
|
|
1729
1737
|
/**
|
|
1730
1738
|
* Apply a set filter (exclude values)
|
|
@@ -1876,7 +1884,7 @@ function vt(s) {
|
|
|
1876
1884
|
return s.some((e) => e.group != null);
|
|
1877
1885
|
}
|
|
1878
1886
|
const yt = ".header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:4px 8px;font-weight:600;font-size:.9em;text-transform:uppercase;letter-spacing:.5px;border-right:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong))}.header-row .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}";
|
|
1879
|
-
class
|
|
1887
|
+
class Nn extends x {
|
|
1880
1888
|
name = "groupingColumns";
|
|
1881
1889
|
version = "1.0.0";
|
|
1882
1890
|
get defaultConfig() {
|
|
@@ -2028,7 +2036,7 @@ function St(s) {
|
|
|
2028
2036
|
return s.kind !== "group" ? 0 : s.rows.length;
|
|
2029
2037
|
}
|
|
2030
2038
|
const kt = '.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, 2px 8px)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;margin-right:4px;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:2px}.group-label{display:inline-flex;align-items:center;gap:8px}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:.85em;font-weight:400}[data-group-depth="0"] .group-label{padding-left:0}[data-group-depth="1"] .group-label{padding-left:20px}[data-group-depth="2"] .group-label{padding-left:40px}[data-group-depth="3"] .group-label{padding-left:60px}[data-group-depth="4"] .group-label{padding-left:80px}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}';
|
|
2031
|
-
class
|
|
2039
|
+
class Kn extends x {
|
|
2032
2040
|
name = "groupingRows";
|
|
2033
2041
|
version = "1.0.0";
|
|
2034
2042
|
get defaultConfig() {
|
|
@@ -2834,10 +2842,10 @@ class Hn extends x {
|
|
|
2834
2842
|
styles = qt;
|
|
2835
2843
|
// #endregion
|
|
2836
2844
|
}
|
|
2837
|
-
function
|
|
2845
|
+
function Nt(s) {
|
|
2838
2846
|
return s.filter((e) => e.sticky === "left");
|
|
2839
2847
|
}
|
|
2840
|
-
function
|
|
2848
|
+
function Kt(s) {
|
|
2841
2849
|
return s.filter((e) => e.sticky === "right");
|
|
2842
2850
|
}
|
|
2843
2851
|
function X(s) {
|
|
@@ -2947,14 +2955,14 @@ class On extends x {
|
|
|
2947
2955
|
*/
|
|
2948
2956
|
getLeftPinnedColumns() {
|
|
2949
2957
|
const e = [...this.columns];
|
|
2950
|
-
return
|
|
2958
|
+
return Nt(e);
|
|
2951
2959
|
}
|
|
2952
2960
|
/**
|
|
2953
2961
|
* Get columns pinned to the right.
|
|
2954
2962
|
*/
|
|
2955
2963
|
getRightPinnedColumns() {
|
|
2956
2964
|
const e = [...this.columns];
|
|
2957
|
-
return
|
|
2965
|
+
return Kt(e);
|
|
2958
2966
|
}
|
|
2959
2967
|
/**
|
|
2960
2968
|
* Clear all sticky positioning.
|
|
@@ -4689,7 +4697,7 @@ class jn extends x {
|
|
|
4689
4697
|
function Ve(s, e, t) {
|
|
4690
4698
|
return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
|
|
4691
4699
|
}
|
|
4692
|
-
function
|
|
4700
|
+
function Ne(s, e) {
|
|
4693
4701
|
const t = new Set(s);
|
|
4694
4702
|
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
4695
4703
|
}
|
|
@@ -4731,7 +4739,7 @@ function bn(s, e, t, n) {
|
|
|
4731
4739
|
o.add(i[r]);
|
|
4732
4740
|
return o;
|
|
4733
4741
|
}
|
|
4734
|
-
function
|
|
4742
|
+
function Ke(s, e = "children") {
|
|
4735
4743
|
if (!Array.isArray(s) || s.length === 0) return !1;
|
|
4736
4744
|
for (const t of s) {
|
|
4737
4745
|
if (!t) continue;
|
|
@@ -4820,13 +4828,13 @@ class Un extends x {
|
|
|
4820
4828
|
detect(e) {
|
|
4821
4829
|
if (!this.config.autoDetect) return !1;
|
|
4822
4830
|
const t = e, n = this.config.childrenField ?? vn(t) ?? "children";
|
|
4823
|
-
return
|
|
4831
|
+
return Ke(t, n);
|
|
4824
4832
|
}
|
|
4825
4833
|
// #endregion
|
|
4826
4834
|
// #region Data Processing
|
|
4827
4835
|
processRows(e) {
|
|
4828
4836
|
const t = this.config.childrenField ?? "children", n = e;
|
|
4829
|
-
if (!
|
|
4837
|
+
if (!Ke(n, t))
|
|
4830
4838
|
return this.flattenedRows = [], this.rowKeyMap.clear(), this.previousVisibleKeys.clear(), [...e];
|
|
4831
4839
|
let i = this.withStableKeys(n);
|
|
4832
4840
|
this.sortState && (i = this.sortTree(i, this.sortState.field, this.sortState.direction)), this.config.defaultExpanded && !this.initialExpansionDone && (this.expandedKeys = oe(i, this.config), this.initialExpansionDone = !0), this.flattenedRows = this.flattenTree(i, this.expandedKeys), this.rowKeyMap.clear(), this.keysToAnimate.clear();
|
|
@@ -4911,7 +4919,7 @@ class Un extends x {
|
|
|
4911
4919
|
const t = e.originalEvent?.target;
|
|
4912
4920
|
if (!t?.classList.contains("tree-toggle")) return !1;
|
|
4913
4921
|
const n = t.getAttribute("data-tree-key"), i = n ? this.rowKeyMap.get(n) : null;
|
|
4914
|
-
return i ? (this.expandedKeys =
|
|
4922
|
+
return i ? (this.expandedKeys = Ne(this.expandedKeys, n), this.emit("tree-expand", {
|
|
4915
4923
|
key: n,
|
|
4916
4924
|
row: i.data,
|
|
4917
4925
|
expanded: this.expandedKeys.has(n),
|
|
@@ -4946,7 +4954,7 @@ class Un extends x {
|
|
|
4946
4954
|
this.expandedKeys.delete(e), this.requestRender();
|
|
4947
4955
|
}
|
|
4948
4956
|
toggle(e) {
|
|
4949
|
-
this.expandedKeys =
|
|
4957
|
+
this.expandedKeys = Ne(this.expandedKeys, e), this.requestRender();
|
|
4950
4958
|
}
|
|
4951
4959
|
expandAll() {
|
|
4952
4960
|
this.expandedKeys = oe(this.rows, this.config), this.requestRender();
|
|
@@ -5025,6 +5033,14 @@ function An(s, e, t, n) {
|
|
|
5025
5033
|
};
|
|
5026
5034
|
}
|
|
5027
5035
|
class Zn extends x {
|
|
5036
|
+
/**
|
|
5037
|
+
* Plugin dependencies - UndoRedoPlugin requires EditingPlugin to track edits.
|
|
5038
|
+
*
|
|
5039
|
+
* The EditingPlugin must be loaded BEFORE this plugin in the plugins array.
|
|
5040
|
+
*/
|
|
5041
|
+
static dependencies = [
|
|
5042
|
+
{ name: "editing", required: !0, reason: "UndoRedoPlugin tracks cell edit history" }
|
|
5043
|
+
];
|
|
5028
5044
|
name = "undoRedo";
|
|
5029
5045
|
version = "1.0.0";
|
|
5030
5046
|
get defaultConfig() {
|
|
@@ -5155,6 +5171,14 @@ function Oe(s) {
|
|
|
5155
5171
|
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
5156
5172
|
}
|
|
5157
5173
|
class P extends x {
|
|
5174
|
+
/**
|
|
5175
|
+
* Plugin dependencies - VisibilityPlugin optionally uses ReorderPlugin for drag-drop reordering.
|
|
5176
|
+
*
|
|
5177
|
+
* When ReorderPlugin is present, columns in the visibility panel become draggable.
|
|
5178
|
+
*/
|
|
5179
|
+
static dependencies = [
|
|
5180
|
+
{ name: "reorder", required: !1, reason: "Enables drag-to-reorder columns in visibility panel" }
|
|
5181
|
+
];
|
|
5158
5182
|
name = "visibility";
|
|
5159
5183
|
version = "1.0.0";
|
|
5160
5184
|
/** Tool panel ID for shell integration */
|
|
@@ -5401,8 +5425,8 @@ export {
|
|
|
5401
5425
|
oi as GridDataAttrs,
|
|
5402
5426
|
ri as GridElement,
|
|
5403
5427
|
si as GridSelectors,
|
|
5404
|
-
|
|
5405
|
-
|
|
5428
|
+
Nn as GroupingColumnsPlugin,
|
|
5429
|
+
Kn as GroupingRowsPlugin,
|
|
5406
5430
|
Dn as MasterDetailPlugin,
|
|
5407
5431
|
Hn as MultiSortPlugin,
|
|
5408
5432
|
H as PLUGIN_QUERIES,
|
|
@@ -5424,7 +5448,7 @@ export {
|
|
|
5424
5448
|
xn as countNodes,
|
|
5425
5449
|
ui as defaultComparator,
|
|
5426
5450
|
tt as defaultEditorFor,
|
|
5427
|
-
|
|
5451
|
+
Ke as detectTreeStructure,
|
|
5428
5452
|
yn as getMaxDepth,
|
|
5429
5453
|
zn as handleRowClick,
|
|
5430
5454
|
Mn as hasEditingCells,
|