@toolbox-web/grid 0.4.1 → 0.5.0
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 +9 -13
- package/all.js +1678 -1588
- package/all.js.map +1 -1
- package/index.js +762 -568
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +21 -0
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/config-manager.d.ts +1 -0
- package/lib/core/internal/config-manager.d.ts.map +1 -1
- package/lib/core/internal/dom-builder.d.ts +2 -0
- package/lib/core/internal/dom-builder.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/keyboard.d.ts.map +1 -1
- package/lib/core/internal/resize.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts +19 -13
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/internal/utils.d.ts +1 -0
- package/lib/core/internal/utils.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +70 -3
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/expander-column.d.ts +51 -0
- package/lib/core/plugin/expander-column.d.ts.map +1 -0
- package/lib/core/plugin/plugin-manager.d.ts +6 -2
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +117 -1
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +10 -5
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +5 -4
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.d.ts +1 -1
- package/lib/plugins/clipboard/index.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +295 -190
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +72 -2
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts +0 -1
- package/lib/plugins/column-virtualization/ColumnVirtualizationPlugin.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js +143 -56
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +0 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +189 -102
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +2 -7
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +227 -150
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/ExportPlugin.d.ts +0 -1
- package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
- package/lib/plugins/export/index.js +184 -97
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +14 -3
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +296 -176
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +2 -2
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/grouping-columns.d.ts +1 -1
- package/lib/plugins/grouping-columns/grouping-columns.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +169 -61
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +14 -2
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +243 -140
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +13 -11
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +278 -196
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/master-detail/types.d.ts +0 -10
- package/lib/plugins/master-detail/types.d.ts.map +1 -1
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts +1 -2
- package/lib/plugins/multi-sort/MultiSortPlugin.d.ts.map +1 -1
- package/lib/plugins/multi-sort/index.js +125 -40
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +0 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +156 -75
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-columns/pinned-columns.d.ts +2 -2
- package/lib/plugins/pinned-columns/pinned-columns.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -2
- package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-rows/index.js +202 -117
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts +26 -4
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +413 -314
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/pivot/pivot-rows.d.ts +2 -1
- package/lib/plugins/pivot/pivot-rows.d.ts.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts +13 -10
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/index.d.ts +1 -1
- package/lib/plugins/reorder/index.d.ts.map +1 -1
- package/lib/plugins/reorder/index.js +296 -223
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +21 -3
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +2 -2
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +282 -141
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +24 -0
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts +0 -1
- package/lib/plugins/server-side/ServerSidePlugin.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js +96 -9
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +5 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +209 -113
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/tree/types.d.ts +0 -10
- package/lib/plugins/tree/types.d.ts.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +0 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +98 -11
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +7 -4
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +155 -64
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/themes/dg-theme-bootstrap.css +55 -53
- package/themes/dg-theme-contrast.css +42 -40
- package/themes/dg-theme-large.css +38 -37
- package/themes/dg-theme-material.css +54 -52
- package/themes/dg-theme-standard.css +19 -17
- package/themes/dg-theme-vibrant.css +16 -14
- package/umd/grid.all.umd.js +23 -24
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +12 -11
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -7
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/column-virtualization.umd.js +1 -1
- package/umd/plugins/column-virtualization.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.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/export.umd.js +1 -1
- package/umd/plugins/export.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/grouping-columns.umd.js +1 -1
- package/umd/plugins/grouping-columns.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/multi-sort.umd.js +1 -1
- package/umd/plugins/multi-sort.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/pinned-rows.umd.js +1 -1
- package/umd/plugins/pinned-rows.umd.js.map +1 -1
- package/umd/plugins/pivot.umd.js +1 -1
- package/umd/plugins/pivot.umd.js.map +1 -1
- package/umd/plugins/reorder.umd.js +1 -1
- package/umd/plugins/reorder.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +1 -1
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/server-side.umd.js +1 -1
- package/umd/plugins/server-side.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.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/lib/core/internal/editing.d.ts +0 -76
- package/lib/core/internal/editing.d.ts.map +0 -1
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
1
|
+
function b(l) {
|
|
2
|
+
l && l.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
3
3
|
}
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
if (
|
|
10
|
-
const { rowHeight: a, container:
|
|
11
|
-
if (
|
|
12
|
-
const
|
|
13
|
-
|
|
4
|
+
const v = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])', C = document.createElement("template");
|
|
5
|
+
C.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
6
|
+
const E = document.createElement("template");
|
|
7
|
+
E.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
8
|
+
function w(l, e) {
|
|
9
|
+
if (l._virtualization?.enabled) {
|
|
10
|
+
const { rowHeight: a, container: r, viewportEl: s } = l._virtualization, o = r, c = s?.clientHeight ?? o?.clientHeight ?? 0;
|
|
11
|
+
if (o && c > 0) {
|
|
12
|
+
const u = l._focusRow * a;
|
|
13
|
+
u < o.scrollTop ? o.scrollTop = u : u + a > o.scrollTop + c && (o.scrollTop = u - c + a);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const t = l._activeEditRows !== void 0 && l._activeEditRows !== -1;
|
|
17
|
+
t || l.refreshVirtualWindow(!1), b(l._bodyEl), Array.from(l._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((a) => {
|
|
18
18
|
a.setAttribute("aria-selected", "false");
|
|
19
19
|
});
|
|
20
|
-
const i =
|
|
21
|
-
if (i >=
|
|
22
|
-
const a =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
const i = l._focusRow, n = l._virtualization.start ?? 0, d = l._virtualization.end ?? l._rows.length;
|
|
21
|
+
if (i >= n && i < d) {
|
|
22
|
+
const a = l._bodyEl.querySelectorAll(".data-grid-row")[i - n];
|
|
23
|
+
let r = a?.children[l._focusCol];
|
|
24
|
+
if ((!r || !r.classList?.contains("cell")) && (r = a?.querySelector(`.cell[data-col="${l._focusCol}"]`) ?? a?.querySelector(".cell[data-col]")), r) {
|
|
25
|
+
r.classList.add("cell-focus"), r.setAttribute("aria-selected", "true");
|
|
26
|
+
const s = l.querySelector(".tbw-scroll-area");
|
|
27
|
+
if (s && r && !t) {
|
|
28
|
+
const o = l._getHorizontalScrollOffsets?.(a ?? void 0, r) ?? { left: 0, right: 0 };
|
|
29
|
+
if (!o.skipScroll) {
|
|
30
|
+
const c = r.getBoundingClientRect(), u = s.getBoundingClientRect(), f = c.left - u.left + s.scrollLeft, g = f + c.width, h = s.scrollLeft + o.left, m = s.scrollLeft + s.clientWidth - o.right;
|
|
31
|
+
f < h ? s.scrollLeft = f - o.left : g > m && (s.scrollLeft = g - s.clientWidth + o.right);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
34
|
+
if (l._activeEditRows !== void 0 && l._activeEditRows !== -1 && r.classList.contains("editing")) {
|
|
35
|
+
const o = r.querySelector(v);
|
|
36
|
+
if (o && document.activeElement !== o)
|
|
36
37
|
try {
|
|
37
|
-
|
|
38
|
+
o.focus({ preventScroll: !0 });
|
|
38
39
|
} catch {
|
|
39
40
|
}
|
|
40
|
-
} else if (!
|
|
41
|
-
|
|
41
|
+
} else if (!r.contains(document.activeElement)) {
|
|
42
|
+
r.hasAttribute("tabindex") || r.setAttribute("tabindex", "-1");
|
|
42
43
|
try {
|
|
43
|
-
|
|
44
|
+
r.focus({ preventScroll: !0 });
|
|
44
45
|
} catch {
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
|
-
const
|
|
51
|
+
const y = {
|
|
51
52
|
expand: "▶",
|
|
52
53
|
collapse: "▼",
|
|
53
54
|
sortAsc: "▲",
|
|
@@ -56,11 +57,11 @@ const O = {
|
|
|
56
57
|
submenuArrow: "▶",
|
|
57
58
|
dragHandle: "⋮⋮",
|
|
58
59
|
toolPanel: "☰"
|
|
59
|
-
},
|
|
60
|
+
}, L = {
|
|
60
61
|
/** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
|
|
61
62
|
CAN_MOVE_COLUMN: "canMoveColumn"
|
|
62
63
|
};
|
|
63
|
-
class
|
|
64
|
+
class A {
|
|
64
65
|
/**
|
|
65
66
|
* Plugin dependencies - declare other plugins this one requires.
|
|
66
67
|
*
|
|
@@ -77,8 +78,11 @@ class x {
|
|
|
77
78
|
* ```
|
|
78
79
|
*/
|
|
79
80
|
static dependencies;
|
|
80
|
-
/**
|
|
81
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Plugin version - defaults to grid version for built-in plugins.
|
|
83
|
+
* Third-party plugins can override with their own semver.
|
|
84
|
+
*/
|
|
85
|
+
version = typeof __GRID_VERSION__ < "u" ? __GRID_VERSION__ : "dev";
|
|
82
86
|
/** CSS styles to inject into the grid's shadow DOM */
|
|
83
87
|
styles;
|
|
84
88
|
/** Custom cell renderers keyed by type name */
|
|
@@ -98,7 +102,7 @@ class x {
|
|
|
98
102
|
* Created fresh in attach(), aborted in detach().
|
|
99
103
|
* This ensures event listeners are properly cleaned up when plugins are re-attached.
|
|
100
104
|
*/
|
|
101
|
-
#
|
|
105
|
+
#e;
|
|
102
106
|
/**
|
|
103
107
|
* Default configuration - subclasses should override this getter.
|
|
104
108
|
* Note: This must be a getter (not property initializer) for proper inheritance
|
|
@@ -107,8 +111,8 @@ class x {
|
|
|
107
111
|
get defaultConfig() {
|
|
108
112
|
return {};
|
|
109
113
|
}
|
|
110
|
-
constructor(
|
|
111
|
-
this.userConfig =
|
|
114
|
+
constructor(e = {}) {
|
|
115
|
+
this.userConfig = e;
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
114
118
|
* Called when the plugin is attached to a grid.
|
|
@@ -125,8 +129,8 @@ class x {
|
|
|
125
129
|
* }
|
|
126
130
|
* ```
|
|
127
131
|
*/
|
|
128
|
-
attach(
|
|
129
|
-
this.#
|
|
132
|
+
attach(e) {
|
|
133
|
+
this.#e?.abort(), this.#e = new AbortController(), this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
|
|
130
134
|
}
|
|
131
135
|
/**
|
|
132
136
|
* Called when the plugin is detached from a grid.
|
|
@@ -142,7 +146,7 @@ class x {
|
|
|
142
146
|
* ```
|
|
143
147
|
*/
|
|
144
148
|
detach() {
|
|
145
|
-
this.#
|
|
149
|
+
this.#e?.abort(), this.#e = void 0;
|
|
146
150
|
}
|
|
147
151
|
/**
|
|
148
152
|
* Get another plugin instance from the same grid.
|
|
@@ -156,14 +160,22 @@ class x {
|
|
|
156
160
|
* }
|
|
157
161
|
* ```
|
|
158
162
|
*/
|
|
159
|
-
getPlugin(
|
|
160
|
-
return this.grid?.getPlugin(
|
|
163
|
+
getPlugin(e) {
|
|
164
|
+
return this.grid?.getPlugin(e);
|
|
161
165
|
}
|
|
162
166
|
/**
|
|
163
167
|
* Emit a custom event from the grid.
|
|
164
168
|
*/
|
|
165
|
-
emit(
|
|
166
|
-
this.grid?.dispatchEvent?.(new CustomEvent(
|
|
169
|
+
emit(e, t) {
|
|
170
|
+
this.grid?.dispatchEvent?.(new CustomEvent(e, { detail: t, bubbles: !0 }));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Emit a cancelable custom event from the grid.
|
|
174
|
+
* @returns `true` if the event was cancelled (preventDefault called), `false` otherwise
|
|
175
|
+
*/
|
|
176
|
+
emitCancelable(e, t) {
|
|
177
|
+
const i = new CustomEvent(e, { detail: t, bubbles: !0, cancelable: !0 });
|
|
178
|
+
return this.grid?.dispatchEvent?.(i), i.defaultPrevented;
|
|
167
179
|
}
|
|
168
180
|
/**
|
|
169
181
|
* Request a re-render of the grid.
|
|
@@ -171,6 +183,14 @@ class x {
|
|
|
171
183
|
requestRender() {
|
|
172
184
|
this.grid?.requestRender?.();
|
|
173
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Request a re-render and restore focus styling afterward.
|
|
188
|
+
* Use this when a plugin action (like expand/collapse) triggers a render
|
|
189
|
+
* but needs to maintain keyboard navigation focus.
|
|
190
|
+
*/
|
|
191
|
+
requestRenderWithFocus() {
|
|
192
|
+
this.grid?.requestRenderWithFocus?.();
|
|
193
|
+
}
|
|
174
194
|
/**
|
|
175
195
|
* Request a lightweight style update without rebuilding DOM.
|
|
176
196
|
* Use this instead of requestRender() when only CSS classes need updating.
|
|
@@ -205,10 +225,34 @@ class x {
|
|
|
205
225
|
return this.grid?._visibleColumns ?? [];
|
|
206
226
|
}
|
|
207
227
|
/**
|
|
208
|
-
* Get the
|
|
228
|
+
* Get the grid as an HTMLElement for direct DOM operations.
|
|
229
|
+
* Use sparingly - prefer the typed GridElementRef API when possible.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* const width = this.gridElement.clientWidth;
|
|
234
|
+
* this.gridElement.classList.add('my-plugin-active');
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
get gridElement() {
|
|
238
|
+
return this.grid;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Get the render root of the grid for DOM queries.
|
|
242
|
+
* @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
|
|
243
|
+
*
|
|
244
|
+
* With Shadow DOM removed, the grid element itself is the render root.
|
|
245
|
+
* All new code should use `this.gridElement` for DOM queries.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* // OLD (deprecated)
|
|
249
|
+
* const rows = this.shadowRoot?.querySelector('.rows');
|
|
250
|
+
*
|
|
251
|
+
* // NEW (preferred)
|
|
252
|
+
* const rows = this.gridElement.querySelector('.rows');
|
|
209
253
|
*/
|
|
210
254
|
get shadowRoot() {
|
|
211
|
-
return this.
|
|
255
|
+
return this.gridElement;
|
|
212
256
|
}
|
|
213
257
|
/**
|
|
214
258
|
* Get the disconnect signal for event listener cleanup.
|
|
@@ -228,16 +272,61 @@ class x {
|
|
|
228
272
|
* document.addEventListener('keydown', handler, { signal: this.disconnectSignal });
|
|
229
273
|
*/
|
|
230
274
|
get disconnectSignal() {
|
|
231
|
-
return this.#
|
|
275
|
+
return this.#e?.signal ?? this.grid?.disconnectSignal;
|
|
232
276
|
}
|
|
233
277
|
/**
|
|
234
278
|
* Get the grid-level icons configuration.
|
|
235
279
|
* Returns merged icons (user config + defaults).
|
|
236
280
|
*/
|
|
237
281
|
get gridIcons() {
|
|
238
|
-
const
|
|
239
|
-
return { ...
|
|
282
|
+
const e = this.grid?.gridConfig?.icons ?? {};
|
|
283
|
+
return { ...y, ...e };
|
|
284
|
+
}
|
|
285
|
+
// #region Animation Helpers
|
|
286
|
+
/**
|
|
287
|
+
* Check if animations are enabled at the grid level.
|
|
288
|
+
* Respects gridConfig.animation.mode and the CSS variable set by the grid.
|
|
289
|
+
*
|
|
290
|
+
* Plugins should use this to skip animations when:
|
|
291
|
+
* - Animation mode is 'off' or `false`
|
|
292
|
+
* - User prefers reduced motion and mode is 'reduced-motion' (default)
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```ts
|
|
296
|
+
* private get animationStyle(): 'slide' | 'fade' | false {
|
|
297
|
+
* if (!this.isAnimationEnabled) return false;
|
|
298
|
+
* return this.config.animation ?? 'slide';
|
|
299
|
+
* }
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
get isAnimationEnabled() {
|
|
303
|
+
const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
304
|
+
if (e === !1 || e === "off") return !1;
|
|
305
|
+
if (e === !0 || e === "on") return !0;
|
|
306
|
+
const t = this.gridElement;
|
|
307
|
+
return t ? getComputedStyle(t).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
|
|
240
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Get the animation duration in milliseconds from CSS variable.
|
|
311
|
+
* Falls back to 200ms if not set.
|
|
312
|
+
*
|
|
313
|
+
* Plugins can use this for their animation timing to stay consistent
|
|
314
|
+
* with the grid-level animation.duration setting.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ```ts
|
|
318
|
+
* element.animate(keyframes, { duration: this.animationDuration });
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
get animationDuration() {
|
|
322
|
+
const e = this.gridElement;
|
|
323
|
+
if (e) {
|
|
324
|
+
const t = getComputedStyle(e).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(t, 10);
|
|
325
|
+
if (!isNaN(i)) return i;
|
|
326
|
+
}
|
|
327
|
+
return 200;
|
|
328
|
+
}
|
|
329
|
+
// #endregion
|
|
241
330
|
/**
|
|
242
331
|
* Resolve an icon value to string or HTMLElement.
|
|
243
332
|
* Checks plugin config first, then grid-level icons, then defaults.
|
|
@@ -246,8 +335,8 @@ class x {
|
|
|
246
335
|
* @param pluginOverride - Optional plugin-level override
|
|
247
336
|
* @returns The resolved icon value
|
|
248
337
|
*/
|
|
249
|
-
resolveIcon(
|
|
250
|
-
return
|
|
338
|
+
resolveIcon(e, t) {
|
|
339
|
+
return t !== void 0 ? t : this.gridIcons[e];
|
|
251
340
|
}
|
|
252
341
|
/**
|
|
253
342
|
* Set an icon value on an element.
|
|
@@ -256,30 +345,30 @@ class x {
|
|
|
256
345
|
* @param element - The element to set the icon on
|
|
257
346
|
* @param icon - The icon value (string or HTMLElement)
|
|
258
347
|
*/
|
|
259
|
-
setIcon(
|
|
260
|
-
typeof
|
|
348
|
+
setIcon(e, t) {
|
|
349
|
+
typeof t == "string" ? e.innerHTML = t : t instanceof HTMLElement && (e.innerHTML = "", e.appendChild(t.cloneNode(!0)));
|
|
261
350
|
}
|
|
262
351
|
/**
|
|
263
352
|
* Log a warning message.
|
|
264
353
|
*/
|
|
265
|
-
warn(
|
|
266
|
-
console.warn(`[tbw-grid:${this.name}] ${
|
|
354
|
+
warn(e) {
|
|
355
|
+
console.warn(`[tbw-grid:${this.name}] ${e}`);
|
|
267
356
|
}
|
|
268
357
|
// #endregion
|
|
269
358
|
}
|
|
270
|
-
function
|
|
271
|
-
const
|
|
272
|
-
return
|
|
359
|
+
function O(l) {
|
|
360
|
+
const e = l.meta ?? {};
|
|
361
|
+
return e.lockPosition !== !0 && e.suppressMovable !== !0;
|
|
273
362
|
}
|
|
274
|
-
function
|
|
275
|
-
if (
|
|
276
|
-
const i = [...
|
|
277
|
-
return i.splice(
|
|
363
|
+
function p(l, e, t) {
|
|
364
|
+
if (e === t || e < 0 || e >= l.length || t < 0 || t > l.length) return l;
|
|
365
|
+
const i = [...l], [n] = i.splice(e, 1);
|
|
366
|
+
return i.splice(t, 0, n), i;
|
|
278
367
|
}
|
|
279
|
-
const _ = '.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}';
|
|
280
|
-
class
|
|
368
|
+
const _ = '@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}}';
|
|
369
|
+
class R extends A {
|
|
281
370
|
name = "reorder";
|
|
282
|
-
|
|
371
|
+
styles = _;
|
|
283
372
|
get defaultConfig() {
|
|
284
373
|
return {
|
|
285
374
|
animation: "flip"
|
|
@@ -288,47 +377,47 @@ class I extends x {
|
|
|
288
377
|
}
|
|
289
378
|
/**
|
|
290
379
|
* Resolve animation type from plugin config.
|
|
291
|
-
*
|
|
380
|
+
* Uses base class isAnimationEnabled to respect grid-level settings.
|
|
292
381
|
*/
|
|
293
382
|
get animationType() {
|
|
294
383
|
return this.isAnimationEnabled ? this.config.animation !== void 0 ? this.config.animation : this.config.viewTransition === !1 ? !1 : (this.config.viewTransition === !0, "flip") : !1;
|
|
295
384
|
}
|
|
296
385
|
/**
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*/
|
|
300
|
-
get isAnimationEnabled() {
|
|
301
|
-
const e = this.grid.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
302
|
-
if (e === !1 || e === "off") return !1;
|
|
303
|
-
if (e === !0 || e === "on") return !0;
|
|
304
|
-
const i = this.shadowRoot?.host;
|
|
305
|
-
return i ? getComputedStyle(i).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Get animation duration from CSS variable (set by grid config).
|
|
386
|
+
* Get animation duration, allowing plugin config override.
|
|
387
|
+
* Uses base class animationDuration for default.
|
|
309
388
|
*/
|
|
310
389
|
get animationDuration() {
|
|
311
|
-
|
|
312
|
-
return this.config.animationDuration;
|
|
313
|
-
const t = this.shadowRoot?.host;
|
|
314
|
-
if (t) {
|
|
315
|
-
const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(e, 10);
|
|
316
|
-
if (!isNaN(i)) return i;
|
|
317
|
-
}
|
|
318
|
-
return 200;
|
|
390
|
+
return this.config.animationDuration !== void 0 ? this.config.animationDuration : super.animationDuration;
|
|
319
391
|
}
|
|
320
392
|
// #region Internal State
|
|
321
393
|
isDragging = !1;
|
|
322
394
|
draggedField = null;
|
|
323
395
|
draggedIndex = null;
|
|
324
396
|
dropIndex = null;
|
|
397
|
+
/**
|
|
398
|
+
* Check if a column can be moved, considering both column config and plugin queries.
|
|
399
|
+
*/
|
|
400
|
+
canMoveColumnWithPlugins(e) {
|
|
401
|
+
return !e || !O(e) ? !1 : !this.grid.queryPlugins({
|
|
402
|
+
type: L.CAN_MOVE_COLUMN,
|
|
403
|
+
context: e
|
|
404
|
+
}).includes(!1);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Clear all drag-related classes from header cells.
|
|
408
|
+
*/
|
|
409
|
+
clearDragClasses() {
|
|
410
|
+
this.gridElement?.querySelectorAll(".header-row > .cell").forEach((e) => {
|
|
411
|
+
e.classList.remove("dragging", "drop-target", "drop-before", "drop-after");
|
|
412
|
+
});
|
|
413
|
+
}
|
|
325
414
|
// #endregion
|
|
326
415
|
// #region Lifecycle
|
|
327
|
-
attach(
|
|
328
|
-
super.attach(
|
|
416
|
+
attach(e) {
|
|
417
|
+
super.attach(e), e.addEventListener(
|
|
329
418
|
"column-reorder-request",
|
|
330
|
-
(
|
|
331
|
-
const i =
|
|
419
|
+
(t) => {
|
|
420
|
+
const i = t.detail;
|
|
332
421
|
i?.field && typeof i.toIndex == "number" && this.moveColumn(i.field, i.toIndex);
|
|
333
422
|
},
|
|
334
423
|
{ signal: this.disconnectSignal }
|
|
@@ -340,72 +429,59 @@ class I extends x {
|
|
|
340
429
|
// #endregion
|
|
341
430
|
// #region Hooks
|
|
342
431
|
afterRender() {
|
|
343
|
-
const
|
|
344
|
-
if (!
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
if (!
|
|
348
|
-
const a = this.columns.find((
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}).includes(!1);
|
|
352
|
-
if (!a || !b(a) || !s) {
|
|
353
|
-
r.draggable = !1;
|
|
432
|
+
const e = this.gridElement;
|
|
433
|
+
if (!e) return;
|
|
434
|
+
e.querySelectorAll(".header-row > .cell").forEach((i) => {
|
|
435
|
+
const n = i, d = n.getAttribute("data-field");
|
|
436
|
+
if (!d) return;
|
|
437
|
+
const a = this.columns.find((r) => r.field === d);
|
|
438
|
+
if (!this.canMoveColumnWithPlugins(a)) {
|
|
439
|
+
n.draggable = !1;
|
|
354
440
|
return;
|
|
355
441
|
}
|
|
356
|
-
|
|
357
|
-
const
|
|
358
|
-
this.isDragging = !0, this.draggedField =
|
|
359
|
-
}),
|
|
360
|
-
this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}),
|
|
368
|
-
r.
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
const f = this.draggedField, u = this.draggedIndex, g = this.dropIndex;
|
|
372
|
-
if (!this.isDragging || f === null || u === null || g === null)
|
|
442
|
+
n.draggable = !0, !n.getAttribute("data-dragstart-bound") && (n.setAttribute("data-dragstart-bound", "true"), n.addEventListener("dragstart", (r) => {
|
|
443
|
+
const o = this.getColumnOrder().indexOf(d);
|
|
444
|
+
this.isDragging = !0, this.draggedField = d, this.draggedIndex = o, r.dataTransfer && (r.dataTransfer.effectAllowed = "move", r.dataTransfer.setData("text/plain", d)), n.classList.add("dragging");
|
|
445
|
+
}), n.addEventListener("dragend", () => {
|
|
446
|
+
this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null, this.clearDragClasses();
|
|
447
|
+
}), n.addEventListener("dragover", (r) => {
|
|
448
|
+
if (r.preventDefault(), !this.isDragging || this.draggedField === d) return;
|
|
449
|
+
const s = n.getBoundingClientRect(), o = s.left + s.width / 2, u = this.getColumnOrder().indexOf(d);
|
|
450
|
+
this.dropIndex = r.clientX < o ? u : u + 1, n.classList.add("drop-target"), n.classList.toggle("drop-before", r.clientX < o), n.classList.toggle("drop-after", r.clientX >= o);
|
|
451
|
+
}), n.addEventListener("dragleave", () => {
|
|
452
|
+
n.classList.remove("drop-target", "drop-before", "drop-after");
|
|
453
|
+
}), n.addEventListener("drop", (r) => {
|
|
454
|
+
r.preventDefault();
|
|
455
|
+
const s = this.draggedField, o = this.draggedIndex, c = this.dropIndex;
|
|
456
|
+
if (!this.isDragging || s === null || o === null || c === null)
|
|
373
457
|
return;
|
|
374
|
-
const
|
|
375
|
-
field:
|
|
376
|
-
fromIndex:
|
|
377
|
-
toIndex:
|
|
378
|
-
columnOrder:
|
|
458
|
+
const u = c > o ? c - 1 : c, f = this.getColumnOrder(), g = p(f, o, u), h = {
|
|
459
|
+
field: s,
|
|
460
|
+
fromIndex: o,
|
|
461
|
+
toIndex: u,
|
|
462
|
+
columnOrder: g
|
|
379
463
|
};
|
|
380
|
-
this.
|
|
464
|
+
this.emitCancelable("column-move", h) || this.updateColumnOrder(g);
|
|
381
465
|
}));
|
|
382
466
|
});
|
|
383
467
|
}
|
|
384
468
|
/**
|
|
385
469
|
* Handle Alt+Arrow keyboard shortcuts for column reordering.
|
|
386
470
|
*/
|
|
387
|
-
onKeyDown(
|
|
388
|
-
if (!
|
|
471
|
+
onKeyDown(e) {
|
|
472
|
+
if (!e.altKey || e.key !== "ArrowLeft" && e.key !== "ArrowRight")
|
|
389
473
|
return;
|
|
390
|
-
const
|
|
391
|
-
if (i < 0 || i >=
|
|
392
|
-
const
|
|
393
|
-
if (!
|
|
394
|
-
const a = this.
|
|
395
|
-
if (
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
const d = t.key === "ArrowLeft" ? s - 1 : s + 1;
|
|
402
|
-
if (d < 0 || d >= l.length) return;
|
|
403
|
-
const f = r.find((u) => u.field === l[d]);
|
|
404
|
-
if (!(f && a.queryPlugins({
|
|
405
|
-
type: p.CAN_MOVE_COLUMN,
|
|
406
|
-
context: f
|
|
407
|
-
}).includes(!1)))
|
|
408
|
-
return this.moveColumn(c.field, d), e._focusCol = d, A(this.grid), t.preventDefault(), t.stopPropagation(), !0;
|
|
474
|
+
const t = this.grid, i = t._focusCol, n = t._visibleColumns;
|
|
475
|
+
if (i < 0 || i >= n.length) return;
|
|
476
|
+
const d = n[i];
|
|
477
|
+
if (!this.canMoveColumnWithPlugins(d)) return;
|
|
478
|
+
const a = this.getColumnOrder(), r = a.indexOf(d.field);
|
|
479
|
+
if (r === -1) return;
|
|
480
|
+
const s = e.key === "ArrowLeft" ? r - 1 : r + 1;
|
|
481
|
+
if (s < 0 || s >= a.length) return;
|
|
482
|
+
const o = n.find((c) => c.field === a[s]);
|
|
483
|
+
if (this.canMoveColumnWithPlugins(o))
|
|
484
|
+
return this.moveColumn(d.field, s), t._focusCol = s, w(this.grid), e.preventDefault(), e.stopPropagation(), !0;
|
|
409
485
|
}
|
|
410
486
|
// #endregion
|
|
411
487
|
// #region Public API
|
|
@@ -421,30 +497,30 @@ class I extends x {
|
|
|
421
497
|
* @param field - The field name of the column to move
|
|
422
498
|
* @param toIndex - The target index
|
|
423
499
|
*/
|
|
424
|
-
moveColumn(
|
|
425
|
-
const i = this.getColumnOrder(),
|
|
426
|
-
if (
|
|
427
|
-
const
|
|
428
|
-
this.
|
|
429
|
-
field:
|
|
430
|
-
fromIndex:
|
|
431
|
-
toIndex:
|
|
432
|
-
columnOrder:
|
|
433
|
-
});
|
|
500
|
+
moveColumn(e, t) {
|
|
501
|
+
const i = this.getColumnOrder(), n = i.indexOf(e);
|
|
502
|
+
if (n === -1) return;
|
|
503
|
+
const d = p(i, n, t);
|
|
504
|
+
this.emitCancelable("column-move", {
|
|
505
|
+
field: e,
|
|
506
|
+
fromIndex: n,
|
|
507
|
+
toIndex: t,
|
|
508
|
+
columnOrder: d
|
|
509
|
+
}) || this.updateColumnOrder(d);
|
|
434
510
|
}
|
|
435
511
|
/**
|
|
436
512
|
* Set a specific column order.
|
|
437
513
|
* @param order - Array of field names in desired order
|
|
438
514
|
*/
|
|
439
|
-
setColumnOrder(
|
|
440
|
-
this.updateColumnOrder(
|
|
515
|
+
setColumnOrder(e) {
|
|
516
|
+
this.updateColumnOrder(e);
|
|
441
517
|
}
|
|
442
518
|
/**
|
|
443
519
|
* Reset column order to the original configuration order.
|
|
444
520
|
*/
|
|
445
521
|
resetColumnOrder() {
|
|
446
|
-
const
|
|
447
|
-
this.updateColumnOrder(
|
|
522
|
+
const e = this.columns.map((t) => t.field);
|
|
523
|
+
this.updateColumnOrder(e);
|
|
448
524
|
}
|
|
449
525
|
// #endregion
|
|
450
526
|
// #region View Transition
|
|
@@ -452,102 +528,99 @@ class I extends x {
|
|
|
452
528
|
* Capture header cell positions before reorder.
|
|
453
529
|
*/
|
|
454
530
|
captureHeaderPositions() {
|
|
455
|
-
const
|
|
456
|
-
return this.
|
|
457
|
-
const i =
|
|
458
|
-
i &&
|
|
459
|
-
}),
|
|
531
|
+
const e = /* @__PURE__ */ new Map();
|
|
532
|
+
return this.gridElement?.querySelectorAll(".header-row > .cell[data-field]").forEach((t) => {
|
|
533
|
+
const i = t.getAttribute("data-field");
|
|
534
|
+
i && e.set(i, t.getBoundingClientRect().left);
|
|
535
|
+
}), e;
|
|
460
536
|
}
|
|
461
537
|
/**
|
|
462
538
|
* Apply FLIP animation for column reorder.
|
|
463
539
|
* Uses CSS transitions - JS sets initial transform and toggles class.
|
|
464
540
|
* @param oldPositions - Header positions captured before DOM change
|
|
465
541
|
*/
|
|
466
|
-
animateFLIP(
|
|
467
|
-
const
|
|
468
|
-
if (!
|
|
542
|
+
animateFLIP(e) {
|
|
543
|
+
const t = this.gridElement;
|
|
544
|
+
if (!t || e.size === 0) return;
|
|
469
545
|
const i = /* @__PURE__ */ new Map();
|
|
470
|
-
if (
|
|
471
|
-
const
|
|
472
|
-
if (!
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
475
|
-
const
|
|
476
|
-
Math.abs(
|
|
546
|
+
if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((a) => {
|
|
547
|
+
const r = a.getAttribute("data-field");
|
|
548
|
+
if (!r) return;
|
|
549
|
+
const s = e.get(r);
|
|
550
|
+
if (s === void 0) return;
|
|
551
|
+
const o = s - a.getBoundingClientRect().left;
|
|
552
|
+
Math.abs(o) > 1 && i.set(r, o);
|
|
477
553
|
}), i.size === 0) return;
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
480
|
-
const
|
|
481
|
-
if (
|
|
482
|
-
const
|
|
483
|
-
|
|
554
|
+
const n = [];
|
|
555
|
+
if (t.querySelectorAll(".cell[data-field]").forEach((a) => {
|
|
556
|
+
const r = i.get(a.getAttribute("data-field") ?? "");
|
|
557
|
+
if (r !== void 0) {
|
|
558
|
+
const s = a;
|
|
559
|
+
s.style.transform = `translateX(${r}px)`, n.push(s);
|
|
484
560
|
}
|
|
485
|
-
}),
|
|
486
|
-
|
|
487
|
-
const
|
|
561
|
+
}), n.length === 0) return;
|
|
562
|
+
this.gridElement.offsetHeight;
|
|
563
|
+
const d = this.animationDuration;
|
|
488
564
|
requestAnimationFrame(() => {
|
|
489
|
-
|
|
565
|
+
n.forEach((a) => {
|
|
490
566
|
a.classList.add("flip-animating"), a.style.transform = "";
|
|
491
567
|
}), setTimeout(() => {
|
|
492
|
-
|
|
568
|
+
n.forEach((a) => {
|
|
493
569
|
a.style.transform = "", a.classList.remove("flip-animating");
|
|
494
570
|
});
|
|
495
|
-
},
|
|
571
|
+
}, d + 50);
|
|
496
572
|
});
|
|
497
573
|
}
|
|
498
574
|
/**
|
|
499
575
|
* Apply crossfade animation for moved columns.
|
|
500
576
|
* Uses CSS keyframes - JS just toggles classes.
|
|
501
577
|
*/
|
|
502
|
-
animateFade(
|
|
503
|
-
const
|
|
504
|
-
if (!
|
|
505
|
-
|
|
578
|
+
animateFade(e) {
|
|
579
|
+
const t = this.gridElement;
|
|
580
|
+
if (!t) {
|
|
581
|
+
e();
|
|
506
582
|
return;
|
|
507
583
|
}
|
|
508
584
|
const i = this.captureHeaderPositions();
|
|
509
|
-
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
512
|
-
const
|
|
513
|
-
if (!
|
|
514
|
-
const
|
|
515
|
-
if (
|
|
516
|
-
const
|
|
517
|
-
Math.abs(
|
|
518
|
-
}),
|
|
519
|
-
const
|
|
520
|
-
if (
|
|
521
|
-
const
|
|
522
|
-
if (
|
|
523
|
-
const
|
|
524
|
-
|
|
585
|
+
e();
|
|
586
|
+
const n = /* @__PURE__ */ new Set();
|
|
587
|
+
if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((r) => {
|
|
588
|
+
const s = r.getAttribute("data-field");
|
|
589
|
+
if (!s) return;
|
|
590
|
+
const o = i.get(s);
|
|
591
|
+
if (o === void 0) return;
|
|
592
|
+
const c = r.getBoundingClientRect().left;
|
|
593
|
+
Math.abs(o - c) > 1 && n.add(s);
|
|
594
|
+
}), n.size === 0) return;
|
|
595
|
+
const d = [];
|
|
596
|
+
if (t.querySelectorAll(".cell[data-field]").forEach((r) => {
|
|
597
|
+
const s = r.getAttribute("data-field");
|
|
598
|
+
if (s && n.has(s)) {
|
|
599
|
+
const o = r;
|
|
600
|
+
o.classList.add("fade-animating"), d.push(o);
|
|
525
601
|
}
|
|
526
|
-
}),
|
|
602
|
+
}), d.length === 0) return;
|
|
527
603
|
const a = this.animationDuration;
|
|
528
604
|
setTimeout(() => {
|
|
529
|
-
|
|
605
|
+
d.forEach((r) => r.classList.remove("fade-animating"));
|
|
530
606
|
}, a + 50);
|
|
531
607
|
}
|
|
532
608
|
/**
|
|
533
609
|
* Update column order with configured animation.
|
|
534
610
|
*/
|
|
535
|
-
updateColumnOrder(
|
|
536
|
-
const
|
|
537
|
-
if (
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
this.
|
|
611
|
+
updateColumnOrder(e) {
|
|
612
|
+
const t = this.animationType;
|
|
613
|
+
if (t === "flip" && this.gridElement) {
|
|
614
|
+
const i = this.captureHeaderPositions();
|
|
615
|
+
this.grid.setColumnOrder(e), requestAnimationFrame(() => {
|
|
616
|
+
this.gridElement.offsetHeight, this.animateFLIP(i);
|
|
541
617
|
});
|
|
542
|
-
} else
|
|
543
|
-
|
|
618
|
+
} else t === "fade" ? this.animateFade(() => this.grid.setColumnOrder(e)) : this.grid.setColumnOrder(e);
|
|
619
|
+
this.grid.requestStateChange?.();
|
|
544
620
|
}
|
|
545
621
|
// #endregion
|
|
546
|
-
// #region Styles
|
|
547
|
-
styles = _;
|
|
548
|
-
// #endregion
|
|
549
622
|
}
|
|
550
623
|
export {
|
|
551
|
-
|
|
624
|
+
R as ReorderPlugin
|
|
552
625
|
};
|
|
553
626
|
//# sourceMappingURL=index.js.map
|