@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,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const h = {
|
|
2
2
|
expand: "▶",
|
|
3
3
|
collapse: "▼",
|
|
4
4
|
sortAsc: "▲",
|
|
@@ -7,11 +7,11 @@ const g = {
|
|
|
7
7
|
submenuArrow: "▶",
|
|
8
8
|
dragHandle: "⋮⋮",
|
|
9
9
|
toolPanel: "☰"
|
|
10
|
-
},
|
|
10
|
+
}, g = {
|
|
11
11
|
/** Ask if a column can be moved. Context: ColumnConfig. Response: boolean | undefined */
|
|
12
12
|
CAN_MOVE_COLUMN: "canMoveColumn"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class y {
|
|
15
15
|
/**
|
|
16
16
|
* Plugin dependencies - declare other plugins this one requires.
|
|
17
17
|
*
|
|
@@ -28,8 +28,11 @@ class k {
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
static dependencies;
|
|
31
|
-
/**
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Plugin version - defaults to grid version for built-in plugins.
|
|
33
|
+
* Third-party plugins can override with their own semver.
|
|
34
|
+
*/
|
|
35
|
+
version = typeof __GRID_VERSION__ < "u" ? __GRID_VERSION__ : "dev";
|
|
33
36
|
/** CSS styles to inject into the grid's shadow DOM */
|
|
34
37
|
styles;
|
|
35
38
|
/** Custom cell renderers keyed by type name */
|
|
@@ -113,8 +116,16 @@ class k {
|
|
|
113
116
|
/**
|
|
114
117
|
* Emit a custom event from the grid.
|
|
115
118
|
*/
|
|
116
|
-
emit(t,
|
|
117
|
-
this.grid?.dispatchEvent?.(new CustomEvent(t, { detail:
|
|
119
|
+
emit(t, e) {
|
|
120
|
+
this.grid?.dispatchEvent?.(new CustomEvent(t, { detail: e, bubbles: !0 }));
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Emit a cancelable custom event from the grid.
|
|
124
|
+
* @returns `true` if the event was cancelled (preventDefault called), `false` otherwise
|
|
125
|
+
*/
|
|
126
|
+
emitCancelable(t, e) {
|
|
127
|
+
const s = new CustomEvent(t, { detail: e, bubbles: !0, cancelable: !0 });
|
|
128
|
+
return this.grid?.dispatchEvent?.(s), s.defaultPrevented;
|
|
118
129
|
}
|
|
119
130
|
/**
|
|
120
131
|
* Request a re-render of the grid.
|
|
@@ -122,6 +133,14 @@ class k {
|
|
|
122
133
|
requestRender() {
|
|
123
134
|
this.grid?.requestRender?.();
|
|
124
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Request a re-render and restore focus styling afterward.
|
|
138
|
+
* Use this when a plugin action (like expand/collapse) triggers a render
|
|
139
|
+
* but needs to maintain keyboard navigation focus.
|
|
140
|
+
*/
|
|
141
|
+
requestRenderWithFocus() {
|
|
142
|
+
this.grid?.requestRenderWithFocus?.();
|
|
143
|
+
}
|
|
125
144
|
/**
|
|
126
145
|
* Request a lightweight style update without rebuilding DOM.
|
|
127
146
|
* Use this instead of requestRender() when only CSS classes need updating.
|
|
@@ -156,10 +175,34 @@ class k {
|
|
|
156
175
|
return this.grid?._visibleColumns ?? [];
|
|
157
176
|
}
|
|
158
177
|
/**
|
|
159
|
-
* Get the
|
|
178
|
+
* Get the grid as an HTMLElement for direct DOM operations.
|
|
179
|
+
* Use sparingly - prefer the typed GridElementRef API when possible.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* const width = this.gridElement.clientWidth;
|
|
184
|
+
* this.gridElement.classList.add('my-plugin-active');
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
get gridElement() {
|
|
188
|
+
return this.grid;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Get the render root of the grid for DOM queries.
|
|
192
|
+
* @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
|
|
193
|
+
*
|
|
194
|
+
* With Shadow DOM removed, the grid element itself is the render root.
|
|
195
|
+
* All new code should use `this.gridElement` for DOM queries.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* // OLD (deprecated)
|
|
199
|
+
* const rows = this.shadowRoot?.querySelector('.rows');
|
|
200
|
+
*
|
|
201
|
+
* // NEW (preferred)
|
|
202
|
+
* const rows = this.gridElement.querySelector('.rows');
|
|
160
203
|
*/
|
|
161
204
|
get shadowRoot() {
|
|
162
|
-
return this.
|
|
205
|
+
return this.gridElement;
|
|
163
206
|
}
|
|
164
207
|
/**
|
|
165
208
|
* Get the disconnect signal for event listener cleanup.
|
|
@@ -187,8 +230,53 @@ class k {
|
|
|
187
230
|
*/
|
|
188
231
|
get gridIcons() {
|
|
189
232
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
190
|
-
return { ...
|
|
233
|
+
return { ...h, ...t };
|
|
234
|
+
}
|
|
235
|
+
// #region Animation Helpers
|
|
236
|
+
/**
|
|
237
|
+
* Check if animations are enabled at the grid level.
|
|
238
|
+
* Respects gridConfig.animation.mode and the CSS variable set by the grid.
|
|
239
|
+
*
|
|
240
|
+
* Plugins should use this to skip animations when:
|
|
241
|
+
* - Animation mode is 'off' or `false`
|
|
242
|
+
* - User prefers reduced motion and mode is 'reduced-motion' (default)
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* private get animationStyle(): 'slide' | 'fade' | false {
|
|
247
|
+
* if (!this.isAnimationEnabled) return false;
|
|
248
|
+
* return this.config.animation ?? 'slide';
|
|
249
|
+
* }
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
get isAnimationEnabled() {
|
|
253
|
+
const t = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
254
|
+
if (t === !1 || t === "off") return !1;
|
|
255
|
+
if (t === !0 || t === "on") return !0;
|
|
256
|
+
const e = this.gridElement;
|
|
257
|
+
return e ? getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
|
|
191
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Get the animation duration in milliseconds from CSS variable.
|
|
261
|
+
* Falls back to 200ms if not set.
|
|
262
|
+
*
|
|
263
|
+
* Plugins can use this for their animation timing to stay consistent
|
|
264
|
+
* with the grid-level animation.duration setting.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```ts
|
|
268
|
+
* element.animate(keyframes, { duration: this.animationDuration });
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
get animationDuration() {
|
|
272
|
+
const t = this.gridElement;
|
|
273
|
+
if (t) {
|
|
274
|
+
const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), s = parseInt(e, 10);
|
|
275
|
+
if (!isNaN(s)) return s;
|
|
276
|
+
}
|
|
277
|
+
return 200;
|
|
278
|
+
}
|
|
279
|
+
// #endregion
|
|
192
280
|
/**
|
|
193
281
|
* Resolve an icon value to string or HTMLElement.
|
|
194
282
|
* Checks plugin config first, then grid-level icons, then defaults.
|
|
@@ -197,8 +285,8 @@ class k {
|
|
|
197
285
|
* @param pluginOverride - Optional plugin-level override
|
|
198
286
|
* @returns The resolved icon value
|
|
199
287
|
*/
|
|
200
|
-
resolveIcon(t,
|
|
201
|
-
return
|
|
288
|
+
resolveIcon(t, e) {
|
|
289
|
+
return e !== void 0 ? e : this.gridIcons[t];
|
|
202
290
|
}
|
|
203
291
|
/**
|
|
204
292
|
* Set an icon value on an element.
|
|
@@ -207,8 +295,8 @@ class k {
|
|
|
207
295
|
* @param element - The element to set the icon on
|
|
208
296
|
* @param icon - The icon value (string or HTMLElement)
|
|
209
297
|
*/
|
|
210
|
-
setIcon(t,
|
|
211
|
-
typeof
|
|
298
|
+
setIcon(t, e) {
|
|
299
|
+
typeof e == "string" ? t.innerHTML = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
212
300
|
}
|
|
213
301
|
/**
|
|
214
302
|
* Log a warning message.
|
|
@@ -218,51 +306,46 @@ class k {
|
|
|
218
306
|
}
|
|
219
307
|
// #endregion
|
|
220
308
|
}
|
|
221
|
-
function
|
|
222
|
-
return
|
|
309
|
+
function m(r) {
|
|
310
|
+
return r.filter((t) => t.sticky === "left");
|
|
223
311
|
}
|
|
224
|
-
function
|
|
225
|
-
return
|
|
312
|
+
function p(r) {
|
|
313
|
+
return r.filter((t) => t.sticky === "right");
|
|
226
314
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
315
|
+
function d(r) {
|
|
316
|
+
return r.some((t) => t.sticky === "left" || t.sticky === "right");
|
|
229
317
|
}
|
|
230
|
-
function
|
|
231
|
-
const
|
|
232
|
-
if (!s) return;
|
|
233
|
-
const e = Array.from(s.querySelectorAll(".header-row .cell"));
|
|
318
|
+
function a(r, t) {
|
|
319
|
+
const e = Array.from(r.querySelectorAll(".header-row .cell"));
|
|
234
320
|
if (!e.length) return;
|
|
235
|
-
const
|
|
236
|
-
t.forEach((
|
|
237
|
-
|
|
321
|
+
const s = /* @__PURE__ */ new Map();
|
|
322
|
+
t.forEach((n, c) => {
|
|
323
|
+
n.field && s.set(n.field, c);
|
|
238
324
|
});
|
|
239
|
-
let
|
|
240
|
-
for (const
|
|
241
|
-
if (
|
|
242
|
-
const
|
|
243
|
-
i && (i.classList.add("sticky-left"), i.style.position = "sticky", i.style.left =
|
|
244
|
-
|
|
245
|
-
}),
|
|
325
|
+
let l = 0;
|
|
326
|
+
for (const n of t)
|
|
327
|
+
if (n.sticky === "left") {
|
|
328
|
+
const c = s.get(n.field), i = e.find((o) => o.getAttribute("data-field") === n.field);
|
|
329
|
+
i && (i.classList.add("sticky-left"), i.style.position = "sticky", i.style.left = l + "px", c !== void 0 && r.querySelectorAll(`.data-grid-row .cell[data-col="${c}"]`).forEach((o) => {
|
|
330
|
+
o.classList.add("sticky-left"), o.style.position = "sticky", o.style.left = l + "px";
|
|
331
|
+
}), l += i.offsetWidth);
|
|
246
332
|
}
|
|
247
333
|
let f = 0;
|
|
248
|
-
for (const
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
i && (i.classList.add("sticky-right"), i.style.position = "sticky", i.style.right = f + "px",
|
|
252
|
-
|
|
334
|
+
for (const n of [...t].reverse())
|
|
335
|
+
if (n.sticky === "right") {
|
|
336
|
+
const c = s.get(n.field), i = e.find((o) => o.getAttribute("data-field") === n.field);
|
|
337
|
+
i && (i.classList.add("sticky-right"), i.style.position = "sticky", i.style.right = f + "px", c !== void 0 && r.querySelectorAll(`.data-grid-row .cell[data-col="${c}"]`).forEach((o) => {
|
|
338
|
+
o.classList.add("sticky-right"), o.style.position = "sticky", o.style.right = f + "px";
|
|
253
339
|
}), f += i.offsetWidth);
|
|
254
340
|
}
|
|
255
341
|
}
|
|
256
|
-
function u(
|
|
257
|
-
|
|
258
|
-
if (!t) return;
|
|
259
|
-
t.querySelectorAll(".sticky-left, .sticky-right").forEach((e) => {
|
|
342
|
+
function u(r) {
|
|
343
|
+
r.querySelectorAll(".sticky-left, .sticky-right").forEach((e) => {
|
|
260
344
|
e.classList.remove("sticky-left", "sticky-right"), e.style.position = "", e.style.left = "", e.style.right = "";
|
|
261
345
|
});
|
|
262
346
|
}
|
|
263
|
-
class
|
|
347
|
+
class k extends y {
|
|
264
348
|
name = "pinnedColumns";
|
|
265
|
-
version = "1.0.0";
|
|
266
349
|
get defaultConfig() {
|
|
267
350
|
return {};
|
|
268
351
|
}
|
|
@@ -280,25 +363,25 @@ class m extends k {
|
|
|
280
363
|
/**
|
|
281
364
|
* Auto-detect sticky columns from column configuration.
|
|
282
365
|
*/
|
|
283
|
-
static detect(t,
|
|
284
|
-
const
|
|
285
|
-
return Array.isArray(
|
|
366
|
+
static detect(t, e) {
|
|
367
|
+
const s = e?.columns;
|
|
368
|
+
return Array.isArray(s) ? d(s) : !1;
|
|
286
369
|
}
|
|
287
370
|
// #endregion
|
|
288
371
|
// #region Hooks
|
|
289
372
|
processColumns(t) {
|
|
290
|
-
return this.isApplied =
|
|
373
|
+
return this.isApplied = d([...t]), [...t];
|
|
291
374
|
}
|
|
292
375
|
afterRender() {
|
|
293
376
|
if (!this.isApplied)
|
|
294
377
|
return;
|
|
295
|
-
const t = this.grid,
|
|
296
|
-
if (!
|
|
378
|
+
const t = this.grid, e = [...this.columns];
|
|
379
|
+
if (!d(e)) {
|
|
297
380
|
u(t), this.isApplied = !1;
|
|
298
381
|
return;
|
|
299
382
|
}
|
|
300
383
|
queueMicrotask(() => {
|
|
301
|
-
|
|
384
|
+
a(t, e);
|
|
302
385
|
});
|
|
303
386
|
}
|
|
304
387
|
/**
|
|
@@ -306,12 +389,12 @@ class m extends k {
|
|
|
306
389
|
*/
|
|
307
390
|
onPluginQuery(t) {
|
|
308
391
|
switch (t.type) {
|
|
309
|
-
case
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
392
|
+
case g.CAN_MOVE_COLUMN: {
|
|
393
|
+
const e = t.context, s = e.sticky;
|
|
394
|
+
if (s === "left" || s === "right")
|
|
312
395
|
return !1;
|
|
313
|
-
const
|
|
314
|
-
return
|
|
396
|
+
const l = e.meta?.sticky;
|
|
397
|
+
return l === "left" || l === "right" ? !1 : void 0;
|
|
315
398
|
}
|
|
316
399
|
default:
|
|
317
400
|
return;
|
|
@@ -324,21 +407,21 @@ class m extends k {
|
|
|
324
407
|
*/
|
|
325
408
|
refreshStickyOffsets() {
|
|
326
409
|
const t = [...this.columns];
|
|
327
|
-
|
|
410
|
+
a(this.grid, t);
|
|
328
411
|
}
|
|
329
412
|
/**
|
|
330
413
|
* Get columns pinned to the left.
|
|
331
414
|
*/
|
|
332
415
|
getLeftPinnedColumns() {
|
|
333
416
|
const t = [...this.columns];
|
|
334
|
-
return
|
|
417
|
+
return m(t);
|
|
335
418
|
}
|
|
336
419
|
/**
|
|
337
420
|
* Get columns pinned to the right.
|
|
338
421
|
*/
|
|
339
422
|
getRightPinnedColumns() {
|
|
340
423
|
const t = [...this.columns];
|
|
341
|
-
return
|
|
424
|
+
return p(t);
|
|
342
425
|
}
|
|
343
426
|
/**
|
|
344
427
|
* Clear all sticky positioning.
|
|
@@ -350,29 +433,27 @@ class m extends k {
|
|
|
350
433
|
* Report horizontal scroll boundary offsets for pinned columns.
|
|
351
434
|
* Used by keyboard navigation to ensure focused cells aren't hidden behind sticky columns.
|
|
352
435
|
*/
|
|
353
|
-
getHorizontalScrollOffsets(t,
|
|
436
|
+
getHorizontalScrollOffsets(t, e) {
|
|
354
437
|
if (!this.isApplied)
|
|
355
438
|
return;
|
|
356
|
-
let
|
|
439
|
+
let s = 0, l = 0;
|
|
357
440
|
if (t) {
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}),
|
|
362
|
-
|
|
441
|
+
const n = t.querySelectorAll(".sticky-left"), c = t.querySelectorAll(".sticky-right");
|
|
442
|
+
n.forEach((i) => {
|
|
443
|
+
s += i.offsetWidth;
|
|
444
|
+
}), c.forEach((i) => {
|
|
445
|
+
l += i.offsetWidth;
|
|
363
446
|
});
|
|
364
|
-
} else
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
i.classList.contains("sticky-left") ? e += i.offsetWidth : i.classList.contains("sticky-right") && (c += i.offsetWidth);
|
|
447
|
+
} else
|
|
448
|
+
this.grid.querySelectorAll(".header-row .cell").forEach((i) => {
|
|
449
|
+
i.classList.contains("sticky-left") ? s += i.offsetWidth : i.classList.contains("sticky-right") && (l += i.offsetWidth);
|
|
368
450
|
});
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
return { left: e, right: c, skipScroll: d };
|
|
451
|
+
const f = e?.classList.contains("sticky-left") || e?.classList.contains("sticky-right");
|
|
452
|
+
return { left: s, right: l, skipScroll: f };
|
|
372
453
|
}
|
|
373
454
|
// #endregion
|
|
374
455
|
}
|
|
375
456
|
export {
|
|
376
|
-
|
|
457
|
+
k as PinnedColumnsPlugin
|
|
377
458
|
};
|
|
378
459
|
//# sourceMappingURL=index.js.map
|