@toolbox-web/grid 0.4.0 → 0.4.2
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 +10 -13
- package/all.js +1124 -1047
- package/all.js.map +1 -1
- package/index.js +688 -515
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +10 -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/keyboard.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/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 +105 -1
- 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/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/core/plugin/types.d.ts +117 -1
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +4 -2
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts +9 -2
- 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 +303 -185
- 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 +116 -24
- 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 +164 -72
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +1 -7
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +213 -133
- 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 +195 -103
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +5 -2
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +145 -43
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -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 +162 -68
- 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 +246 -138
- 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 +281 -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 +121 -31
- 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 +144 -52
- package/lib/plugins/pinned-columns/index.js.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 +178 -88
- 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 +414 -310
- 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.js +304 -226
- 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 +292 -145
- 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 +95 -3
- 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 +213 -112
- 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 +7 -2
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +112 -12
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts +14 -5
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +168 -65
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +21 -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 +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
|
@@ -11,9 +11,28 @@ const 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
|
|
15
|
-
/**
|
|
16
|
-
|
|
14
|
+
class m {
|
|
15
|
+
/**
|
|
16
|
+
* Plugin dependencies - declare other plugins this one requires.
|
|
17
|
+
*
|
|
18
|
+
* Dependencies are validated when the plugin is attached.
|
|
19
|
+
* Required dependencies throw an error if missing.
|
|
20
|
+
* Optional dependencies log an info message if missing.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* static readonly dependencies: PluginDependency[] = [
|
|
25
|
+
* { name: 'editing', required: true, reason: 'Tracks cell edits for undo/redo' },
|
|
26
|
+
* { name: 'selection', required: false, reason: 'Enables selection-based undo' },
|
|
27
|
+
* ];
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
static dependencies;
|
|
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";
|
|
17
36
|
/** CSS styles to inject into the grid's shadow DOM */
|
|
18
37
|
styles;
|
|
19
38
|
/** Custom cell renderers keyed by type name */
|
|
@@ -97,8 +116,16 @@ class k {
|
|
|
97
116
|
/**
|
|
98
117
|
* Emit a custom event from the grid.
|
|
99
118
|
*/
|
|
100
|
-
emit(t,
|
|
101
|
-
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;
|
|
102
129
|
}
|
|
103
130
|
/**
|
|
104
131
|
* Request a re-render of the grid.
|
|
@@ -106,6 +133,14 @@ class k {
|
|
|
106
133
|
requestRender() {
|
|
107
134
|
this.grid?.requestRender?.();
|
|
108
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
|
+
}
|
|
109
144
|
/**
|
|
110
145
|
* Request a lightweight style update without rebuilding DOM.
|
|
111
146
|
* Use this instead of requestRender() when only CSS classes need updating.
|
|
@@ -139,6 +174,19 @@ class k {
|
|
|
139
174
|
get visibleColumns() {
|
|
140
175
|
return this.grid?._visibleColumns ?? [];
|
|
141
176
|
}
|
|
177
|
+
/**
|
|
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
|
+
}
|
|
142
190
|
/**
|
|
143
191
|
* Get the shadow root of the grid.
|
|
144
192
|
*/
|
|
@@ -173,6 +221,51 @@ class k {
|
|
|
173
221
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
174
222
|
return { ...g, ...t };
|
|
175
223
|
}
|
|
224
|
+
// #region Animation Helpers
|
|
225
|
+
/**
|
|
226
|
+
* Check if animations are enabled at the grid level.
|
|
227
|
+
* Respects gridConfig.animation.mode and the CSS variable set by the grid.
|
|
228
|
+
*
|
|
229
|
+
* Plugins should use this to skip animations when:
|
|
230
|
+
* - Animation mode is 'off' or `false`
|
|
231
|
+
* - User prefers reduced motion and mode is 'reduced-motion' (default)
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* private get animationStyle(): 'slide' | 'fade' | false {
|
|
236
|
+
* if (!this.isAnimationEnabled) return false;
|
|
237
|
+
* return this.config.animation ?? 'slide';
|
|
238
|
+
* }
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
get isAnimationEnabled() {
|
|
242
|
+
const t = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
243
|
+
if (t === !1 || t === "off") return !1;
|
|
244
|
+
if (t === !0 || t === "on") return !0;
|
|
245
|
+
const e = this.shadowRoot?.host;
|
|
246
|
+
return e ? getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get the animation duration in milliseconds from CSS variable.
|
|
250
|
+
* Falls back to 200ms if not set.
|
|
251
|
+
*
|
|
252
|
+
* Plugins can use this for their animation timing to stay consistent
|
|
253
|
+
* with the grid-level animation.duration setting.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```ts
|
|
257
|
+
* element.animate(keyframes, { duration: this.animationDuration });
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
get animationDuration() {
|
|
261
|
+
const t = this.shadowRoot?.host;
|
|
262
|
+
if (t) {
|
|
263
|
+
const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), s = parseInt(e, 10);
|
|
264
|
+
if (!isNaN(s)) return s;
|
|
265
|
+
}
|
|
266
|
+
return 200;
|
|
267
|
+
}
|
|
268
|
+
// #endregion
|
|
176
269
|
/**
|
|
177
270
|
* Resolve an icon value to string or HTMLElement.
|
|
178
271
|
* Checks plugin config first, then grid-level icons, then defaults.
|
|
@@ -181,8 +274,8 @@ class k {
|
|
|
181
274
|
* @param pluginOverride - Optional plugin-level override
|
|
182
275
|
* @returns The resolved icon value
|
|
183
276
|
*/
|
|
184
|
-
resolveIcon(t,
|
|
185
|
-
return
|
|
277
|
+
resolveIcon(t, e) {
|
|
278
|
+
return e !== void 0 ? e : this.gridIcons[t];
|
|
186
279
|
}
|
|
187
280
|
/**
|
|
188
281
|
* Set an icon value on an element.
|
|
@@ -191,8 +284,8 @@ class k {
|
|
|
191
284
|
* @param element - The element to set the icon on
|
|
192
285
|
* @param icon - The icon value (string or HTMLElement)
|
|
193
286
|
*/
|
|
194
|
-
setIcon(t,
|
|
195
|
-
typeof
|
|
287
|
+
setIcon(t, e) {
|
|
288
|
+
typeof e == "string" ? t.innerHTML = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
196
289
|
}
|
|
197
290
|
/**
|
|
198
291
|
* Log a warning message.
|
|
@@ -205,48 +298,47 @@ class k {
|
|
|
205
298
|
function p(n) {
|
|
206
299
|
return n.filter((t) => t.sticky === "left");
|
|
207
300
|
}
|
|
208
|
-
function
|
|
301
|
+
function k(n) {
|
|
209
302
|
return n.filter((t) => t.sticky === "right");
|
|
210
303
|
}
|
|
211
304
|
function a(n) {
|
|
212
305
|
return n.some((t) => t.sticky === "left" || t.sticky === "right");
|
|
213
306
|
}
|
|
214
|
-
function
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
217
|
-
const
|
|
218
|
-
if (!
|
|
307
|
+
function u(n, t) {
|
|
308
|
+
const e = n.shadowRoot;
|
|
309
|
+
if (!e) return;
|
|
310
|
+
const s = Array.from(e.querySelectorAll(".header-row .cell"));
|
|
311
|
+
if (!s.length) return;
|
|
219
312
|
const c = /* @__PURE__ */ new Map();
|
|
220
313
|
t.forEach((r, o) => {
|
|
221
314
|
r.field && c.set(r.field, o);
|
|
222
315
|
});
|
|
223
|
-
let
|
|
316
|
+
let f = 0;
|
|
224
317
|
for (const r of t)
|
|
225
318
|
if (r.sticky === "left") {
|
|
226
|
-
const o = c.get(r.field), i =
|
|
227
|
-
i && (i.classList.add("sticky-left"), i.style.position = "sticky", i.style.left =
|
|
228
|
-
l.classList.add("sticky-left"), l.style.position = "sticky", l.style.left =
|
|
229
|
-
}),
|
|
319
|
+
const o = c.get(r.field), i = s.find((l) => l.getAttribute("data-field") === r.field);
|
|
320
|
+
i && (i.classList.add("sticky-left"), i.style.position = "sticky", i.style.left = f + "px", o !== void 0 && e.querySelectorAll(`.data-grid-row .cell[data-col="${o}"]`).forEach((l) => {
|
|
321
|
+
l.classList.add("sticky-left"), l.style.position = "sticky", l.style.left = f + "px";
|
|
322
|
+
}), f += i.offsetWidth);
|
|
230
323
|
}
|
|
231
|
-
let
|
|
324
|
+
let d = 0;
|
|
232
325
|
for (const r of [...t].reverse())
|
|
233
326
|
if (r.sticky === "right") {
|
|
234
|
-
const o = c.get(r.field), i =
|
|
235
|
-
i && (i.classList.add("sticky-right"), i.style.position = "sticky", i.style.right =
|
|
236
|
-
l.classList.add("sticky-right"), l.style.position = "sticky", l.style.right =
|
|
237
|
-
}),
|
|
327
|
+
const o = c.get(r.field), i = s.find((l) => l.getAttribute("data-field") === r.field);
|
|
328
|
+
i && (i.classList.add("sticky-right"), i.style.position = "sticky", i.style.right = d + "px", o !== void 0 && e.querySelectorAll(`.data-grid-row .cell[data-col="${o}"]`).forEach((l) => {
|
|
329
|
+
l.classList.add("sticky-right"), l.style.position = "sticky", l.style.right = d + "px";
|
|
330
|
+
}), d += i.offsetWidth);
|
|
238
331
|
}
|
|
239
332
|
}
|
|
240
|
-
function
|
|
333
|
+
function h(n) {
|
|
241
334
|
const t = n.shadowRoot;
|
|
242
335
|
if (!t) return;
|
|
243
|
-
t.querySelectorAll(".sticky-left, .sticky-right").forEach((
|
|
244
|
-
|
|
336
|
+
t.querySelectorAll(".sticky-left, .sticky-right").forEach((s) => {
|
|
337
|
+
s.classList.remove("sticky-left", "sticky-right"), s.style.position = "", s.style.left = "", s.style.right = "";
|
|
245
338
|
});
|
|
246
339
|
}
|
|
247
|
-
class
|
|
340
|
+
class C extends m {
|
|
248
341
|
name = "pinnedColumns";
|
|
249
|
-
version = "1.0.0";
|
|
250
342
|
get defaultConfig() {
|
|
251
343
|
return {};
|
|
252
344
|
}
|
|
@@ -264,9 +356,9 @@ class m extends k {
|
|
|
264
356
|
/**
|
|
265
357
|
* Auto-detect sticky columns from column configuration.
|
|
266
358
|
*/
|
|
267
|
-
static detect(t,
|
|
268
|
-
const
|
|
269
|
-
return Array.isArray(
|
|
359
|
+
static detect(t, e) {
|
|
360
|
+
const s = e?.columns;
|
|
361
|
+
return Array.isArray(s) ? a(s) : !1;
|
|
270
362
|
}
|
|
271
363
|
// #endregion
|
|
272
364
|
// #region Hooks
|
|
@@ -276,13 +368,13 @@ class m extends k {
|
|
|
276
368
|
afterRender() {
|
|
277
369
|
if (!this.isApplied)
|
|
278
370
|
return;
|
|
279
|
-
const t = this.grid,
|
|
280
|
-
if (!a(
|
|
281
|
-
|
|
371
|
+
const t = this.grid, e = [...this.columns];
|
|
372
|
+
if (!a(e)) {
|
|
373
|
+
h(t), this.isApplied = !1;
|
|
282
374
|
return;
|
|
283
375
|
}
|
|
284
376
|
queueMicrotask(() => {
|
|
285
|
-
|
|
377
|
+
u(t, e);
|
|
286
378
|
});
|
|
287
379
|
}
|
|
288
380
|
/**
|
|
@@ -291,10 +383,10 @@ class m extends k {
|
|
|
291
383
|
onPluginQuery(t) {
|
|
292
384
|
switch (t.type) {
|
|
293
385
|
case y.CAN_MOVE_COLUMN: {
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
386
|
+
const e = t.context, s = e.sticky;
|
|
387
|
+
if (s === "left" || s === "right")
|
|
296
388
|
return !1;
|
|
297
|
-
const c =
|
|
389
|
+
const c = e.meta?.sticky;
|
|
298
390
|
return c === "left" || c === "right" ? !1 : void 0;
|
|
299
391
|
}
|
|
300
392
|
default:
|
|
@@ -308,7 +400,7 @@ class m extends k {
|
|
|
308
400
|
*/
|
|
309
401
|
refreshStickyOffsets() {
|
|
310
402
|
const t = [...this.columns];
|
|
311
|
-
|
|
403
|
+
u(this.grid, t);
|
|
312
404
|
}
|
|
313
405
|
/**
|
|
314
406
|
* Get columns pinned to the left.
|
|
@@ -322,41 +414,41 @@ class m extends k {
|
|
|
322
414
|
*/
|
|
323
415
|
getRightPinnedColumns() {
|
|
324
416
|
const t = [...this.columns];
|
|
325
|
-
return
|
|
417
|
+
return k(t);
|
|
326
418
|
}
|
|
327
419
|
/**
|
|
328
420
|
* Clear all sticky positioning.
|
|
329
421
|
*/
|
|
330
422
|
clearStickyPositions() {
|
|
331
|
-
|
|
423
|
+
h(this.grid);
|
|
332
424
|
}
|
|
333
425
|
/**
|
|
334
426
|
* Report horizontal scroll boundary offsets for pinned columns.
|
|
335
427
|
* Used by keyboard navigation to ensure focused cells aren't hidden behind sticky columns.
|
|
336
428
|
*/
|
|
337
|
-
getHorizontalScrollOffsets(t,
|
|
429
|
+
getHorizontalScrollOffsets(t, e) {
|
|
338
430
|
if (!this.isApplied)
|
|
339
431
|
return;
|
|
340
|
-
let
|
|
432
|
+
let s = 0, c = 0;
|
|
341
433
|
if (t) {
|
|
342
|
-
const
|
|
343
|
-
|
|
344
|
-
|
|
434
|
+
const d = t.querySelectorAll(".sticky-left"), r = t.querySelectorAll(".sticky-right");
|
|
435
|
+
d.forEach((o) => {
|
|
436
|
+
s += o.offsetWidth;
|
|
345
437
|
}), r.forEach((o) => {
|
|
346
438
|
c += o.offsetWidth;
|
|
347
439
|
});
|
|
348
440
|
} else {
|
|
349
441
|
const r = this.grid.shadowRoot;
|
|
350
442
|
r && r.querySelectorAll(".header-row .cell").forEach((i) => {
|
|
351
|
-
i.classList.contains("sticky-left") ?
|
|
443
|
+
i.classList.contains("sticky-left") ? s += i.offsetWidth : i.classList.contains("sticky-right") && (c += i.offsetWidth);
|
|
352
444
|
});
|
|
353
445
|
}
|
|
354
|
-
const
|
|
355
|
-
return { left:
|
|
446
|
+
const f = e?.classList.contains("sticky-left") || e?.classList.contains("sticky-right");
|
|
447
|
+
return { left: s, right: c, skipScroll: f };
|
|
356
448
|
}
|
|
357
449
|
// #endregion
|
|
358
450
|
}
|
|
359
451
|
export {
|
|
360
|
-
|
|
452
|
+
C as PinnedColumnsPlugin
|
|
361
453
|
};
|
|
362
454
|
//# sourceMappingURL=index.js.map
|