@toolbox-web/grid 0.4.2 → 0.6.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 +2 -3
- package/all.js +1063 -1024
- package/all.js.map +1 -1
- package/index.js +1078 -912
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +28 -0
- package/lib/core/grid.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/event-delegation.d.ts +21 -0
- package/lib/core/internal/event-delegation.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/internal/resize.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts +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/plugin/base-plugin.d.ts +13 -2
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/expander-column.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +6 -2
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/types.d.ts +41 -3
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +22 -11
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +59 -48
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +71 -60
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +1 -0
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +93 -80
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +29 -18
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +9 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +199 -165
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +1 -0
- package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-columns/index.js +79 -49
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +98 -87
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +70 -57
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +48 -37
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +71 -66
- 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.map +1 -1
- package/lib/plugins/pinned-rows/index.js +63 -52
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/PivotPlugin.d.ts.map +1 -1
- package/lib/plugins/pivot/index.js +310 -299
- package/lib/plugins/pivot/index.js.map +1 -1
- 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 +79 -68
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +115 -105
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +15 -4
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +41 -30
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +29 -18
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/VisibilityPlugin.d.ts.map +1 -1
- package/lib/plugins/visibility/index.js +59 -47
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +6 -6
- package/public.d.ts +42 -0
- package/public.d.ts.map +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 -22
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +15 -14
- package/umd/grid.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/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/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/visibility.umd.js +1 -1
- package/umd/plugins/visibility.umd.js.map +1 -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
|
*
|
|
@@ -188,10 +188,21 @@ class m {
|
|
|
188
188
|
return this.grid;
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
|
-
* Get the
|
|
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');
|
|
192
203
|
*/
|
|
193
204
|
get shadowRoot() {
|
|
194
|
-
return this.
|
|
205
|
+
return this.gridElement;
|
|
195
206
|
}
|
|
196
207
|
/**
|
|
197
208
|
* Get the disconnect signal for event listener cleanup.
|
|
@@ -219,7 +230,7 @@ class m {
|
|
|
219
230
|
*/
|
|
220
231
|
get gridIcons() {
|
|
221
232
|
const t = this.grid?.gridConfig?.icons ?? {};
|
|
222
|
-
return { ...
|
|
233
|
+
return { ...h, ...t };
|
|
223
234
|
}
|
|
224
235
|
// #region Animation Helpers
|
|
225
236
|
/**
|
|
@@ -242,7 +253,7 @@ class m {
|
|
|
242
253
|
const t = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
243
254
|
if (t === !1 || t === "off") return !1;
|
|
244
255
|
if (t === !0 || t === "on") return !0;
|
|
245
|
-
const e = this.
|
|
256
|
+
const e = this.gridElement;
|
|
246
257
|
return e ? getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
|
|
247
258
|
}
|
|
248
259
|
/**
|
|
@@ -258,7 +269,7 @@ class m {
|
|
|
258
269
|
* ```
|
|
259
270
|
*/
|
|
260
271
|
get animationDuration() {
|
|
261
|
-
const t = this.
|
|
272
|
+
const t = this.gridElement;
|
|
262
273
|
if (t) {
|
|
263
274
|
const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), s = parseInt(e, 10);
|
|
264
275
|
if (!isNaN(s)) return s;
|
|
@@ -295,49 +306,45 @@ class m {
|
|
|
295
306
|
}
|
|
296
307
|
// #endregion
|
|
297
308
|
}
|
|
298
|
-
function
|
|
299
|
-
return
|
|
309
|
+
function m(r) {
|
|
310
|
+
return r.filter((t) => t.sticky === "left");
|
|
300
311
|
}
|
|
301
|
-
function
|
|
302
|
-
return
|
|
312
|
+
function p(r) {
|
|
313
|
+
return r.filter((t) => t.sticky === "right");
|
|
303
314
|
}
|
|
304
|
-
function
|
|
305
|
-
return
|
|
315
|
+
function d(r) {
|
|
316
|
+
return r.some((t) => t.sticky === "left" || t.sticky === "right");
|
|
306
317
|
}
|
|
307
|
-
function
|
|
308
|
-
const e =
|
|
309
|
-
if (!e) return;
|
|
310
|
-
const s =
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
t.forEach((r, o) => {
|
|
314
|
-
r.field && c.set(r.field, o);
|
|
318
|
+
function a(r, t) {
|
|
319
|
+
const e = Array.from(r.querySelectorAll(".header-row .cell"));
|
|
320
|
+
if (!e.length) return;
|
|
321
|
+
const s = /* @__PURE__ */ new Map();
|
|
322
|
+
t.forEach((n, c) => {
|
|
323
|
+
n.field && s.set(n.field, c);
|
|
315
324
|
});
|
|
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);
|
|
332
|
+
}
|
|
316
333
|
let f = 0;
|
|
317
|
-
for (const
|
|
318
|
-
if (
|
|
319
|
-
const
|
|
320
|
-
i && (i.classList.add("sticky-
|
|
321
|
-
|
|
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";
|
|
322
339
|
}), f += i.offsetWidth);
|
|
323
340
|
}
|
|
324
|
-
let d = 0;
|
|
325
|
-
for (const r of [...t].reverse())
|
|
326
|
-
if (r.sticky === "right") {
|
|
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);
|
|
331
|
-
}
|
|
332
341
|
}
|
|
333
|
-
function
|
|
334
|
-
|
|
335
|
-
|
|
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 = "";
|
|
342
|
+
function u(r) {
|
|
343
|
+
r.querySelectorAll(".sticky-left, .sticky-right").forEach((e) => {
|
|
344
|
+
e.classList.remove("sticky-left", "sticky-right"), e.style.position = "", e.style.left = "", e.style.right = "";
|
|
338
345
|
});
|
|
339
346
|
}
|
|
340
|
-
class
|
|
347
|
+
class k extends y {
|
|
341
348
|
name = "pinnedColumns";
|
|
342
349
|
get defaultConfig() {
|
|
343
350
|
return {};
|
|
@@ -358,23 +365,23 @@ class C extends m {
|
|
|
358
365
|
*/
|
|
359
366
|
static detect(t, e) {
|
|
360
367
|
const s = e?.columns;
|
|
361
|
-
return Array.isArray(s) ?
|
|
368
|
+
return Array.isArray(s) ? d(s) : !1;
|
|
362
369
|
}
|
|
363
370
|
// #endregion
|
|
364
371
|
// #region Hooks
|
|
365
372
|
processColumns(t) {
|
|
366
|
-
return this.isApplied =
|
|
373
|
+
return this.isApplied = d([...t]), [...t];
|
|
367
374
|
}
|
|
368
375
|
afterRender() {
|
|
369
376
|
if (!this.isApplied)
|
|
370
377
|
return;
|
|
371
378
|
const t = this.grid, e = [...this.columns];
|
|
372
|
-
if (!
|
|
373
|
-
|
|
379
|
+
if (!d(e)) {
|
|
380
|
+
u(t), this.isApplied = !1;
|
|
374
381
|
return;
|
|
375
382
|
}
|
|
376
383
|
queueMicrotask(() => {
|
|
377
|
-
|
|
384
|
+
a(t, e);
|
|
378
385
|
});
|
|
379
386
|
}
|
|
380
387
|
/**
|
|
@@ -382,12 +389,12 @@ class C extends m {
|
|
|
382
389
|
*/
|
|
383
390
|
onPluginQuery(t) {
|
|
384
391
|
switch (t.type) {
|
|
385
|
-
case
|
|
392
|
+
case g.CAN_MOVE_COLUMN: {
|
|
386
393
|
const e = t.context, s = e.sticky;
|
|
387
394
|
if (s === "left" || s === "right")
|
|
388
395
|
return !1;
|
|
389
|
-
const
|
|
390
|
-
return
|
|
396
|
+
const l = e.meta?.sticky;
|
|
397
|
+
return l === "left" || l === "right" ? !1 : void 0;
|
|
391
398
|
}
|
|
392
399
|
default:
|
|
393
400
|
return;
|
|
@@ -400,27 +407,27 @@ class C extends m {
|
|
|
400
407
|
*/
|
|
401
408
|
refreshStickyOffsets() {
|
|
402
409
|
const t = [...this.columns];
|
|
403
|
-
|
|
410
|
+
a(this.grid, t);
|
|
404
411
|
}
|
|
405
412
|
/**
|
|
406
413
|
* Get columns pinned to the left.
|
|
407
414
|
*/
|
|
408
415
|
getLeftPinnedColumns() {
|
|
409
416
|
const t = [...this.columns];
|
|
410
|
-
return
|
|
417
|
+
return m(t);
|
|
411
418
|
}
|
|
412
419
|
/**
|
|
413
420
|
* Get columns pinned to the right.
|
|
414
421
|
*/
|
|
415
422
|
getRightPinnedColumns() {
|
|
416
423
|
const t = [...this.columns];
|
|
417
|
-
return
|
|
424
|
+
return p(t);
|
|
418
425
|
}
|
|
419
426
|
/**
|
|
420
427
|
* Clear all sticky positioning.
|
|
421
428
|
*/
|
|
422
429
|
clearStickyPositions() {
|
|
423
|
-
|
|
430
|
+
u(this.grid);
|
|
424
431
|
}
|
|
425
432
|
/**
|
|
426
433
|
* Report horizontal scroll boundary offsets for pinned columns.
|
|
@@ -429,26 +436,24 @@ class C extends m {
|
|
|
429
436
|
getHorizontalScrollOffsets(t, e) {
|
|
430
437
|
if (!this.isApplied)
|
|
431
438
|
return;
|
|
432
|
-
let s = 0,
|
|
439
|
+
let s = 0, l = 0;
|
|
433
440
|
if (t) {
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
s +=
|
|
437
|
-
}),
|
|
438
|
-
|
|
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;
|
|
439
446
|
});
|
|
440
|
-
} else
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
i.classList.contains("sticky-left") ? s += 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);
|
|
444
450
|
});
|
|
445
|
-
}
|
|
446
451
|
const f = e?.classList.contains("sticky-left") || e?.classList.contains("sticky-right");
|
|
447
|
-
return { left: s, right:
|
|
452
|
+
return { left: s, right: l, skipScroll: f };
|
|
448
453
|
}
|
|
449
454
|
// #endregion
|
|
450
455
|
}
|
|
451
456
|
export {
|
|
452
|
-
|
|
457
|
+
k as PinnedColumnsPlugin
|
|
453
458
|
};
|
|
454
459
|
//# sourceMappingURL=index.js.map
|