@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
|
@@ -185,10 +185,21 @@ class b {
|
|
|
185
185
|
return this.grid;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
* Get the
|
|
188
|
+
* Get the render root of the grid for DOM queries.
|
|
189
|
+
* @deprecated Use `gridElement` instead. This getter exists only for backward compatibility.
|
|
190
|
+
*
|
|
191
|
+
* With Shadow DOM removed, the grid element itself is the render root.
|
|
192
|
+
* All new code should use `this.gridElement` for DOM queries.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* // OLD (deprecated)
|
|
196
|
+
* const rows = this.shadowRoot?.querySelector('.rows');
|
|
197
|
+
*
|
|
198
|
+
* // NEW (preferred)
|
|
199
|
+
* const rows = this.gridElement.querySelector('.rows');
|
|
189
200
|
*/
|
|
190
201
|
get shadowRoot() {
|
|
191
|
-
return this.
|
|
202
|
+
return this.gridElement;
|
|
192
203
|
}
|
|
193
204
|
/**
|
|
194
205
|
* Get the disconnect signal for event listener cleanup.
|
|
@@ -239,7 +250,7 @@ class b {
|
|
|
239
250
|
const t = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
240
251
|
if (t === !1 || t === "off") return !1;
|
|
241
252
|
if (t === !0 || t === "on") return !0;
|
|
242
|
-
const e = this.
|
|
253
|
+
const e = this.gridElement;
|
|
243
254
|
return e ? getComputedStyle(e).getPropertyValue("--tbw-animation-enabled").trim() !== "0" : !0;
|
|
244
255
|
}
|
|
245
256
|
/**
|
|
@@ -255,7 +266,7 @@ class b {
|
|
|
255
266
|
* ```
|
|
256
267
|
*/
|
|
257
268
|
get animationDuration() {
|
|
258
|
-
const t = this.
|
|
269
|
+
const t = this.gridElement;
|
|
259
270
|
if (t) {
|
|
260
271
|
const e = getComputedStyle(t).getPropertyValue("--tbw-animation-duration").trim(), i = parseInt(e, 10);
|
|
261
272
|
if (!isNaN(i)) return i;
|
|
@@ -292,61 +303,61 @@ class b {
|
|
|
292
303
|
}
|
|
293
304
|
// #endregion
|
|
294
305
|
}
|
|
295
|
-
const
|
|
296
|
-
function a(
|
|
297
|
-
if (
|
|
298
|
-
return
|
|
299
|
-
if (typeof
|
|
300
|
-
return
|
|
301
|
-
const t = parseFloat(
|
|
302
|
-
return isNaN(t) ?
|
|
306
|
+
const h = 100;
|
|
307
|
+
function a(r) {
|
|
308
|
+
if (r == null)
|
|
309
|
+
return h;
|
|
310
|
+
if (typeof r == "number")
|
|
311
|
+
return r;
|
|
312
|
+
const t = parseFloat(r);
|
|
313
|
+
return isNaN(t) ? h : t;
|
|
303
314
|
}
|
|
304
|
-
function c(
|
|
305
|
-
return
|
|
315
|
+
function c(r) {
|
|
316
|
+
return r.map((t) => a(t.width));
|
|
306
317
|
}
|
|
307
|
-
function f(
|
|
318
|
+
function f(r) {
|
|
308
319
|
const t = [];
|
|
309
320
|
let e = 0;
|
|
310
|
-
for (const i of
|
|
321
|
+
for (const i of r)
|
|
311
322
|
t.push(e), e += a(i.width);
|
|
312
323
|
return t;
|
|
313
324
|
}
|
|
314
|
-
function g(
|
|
315
|
-
return
|
|
325
|
+
function g(r) {
|
|
326
|
+
return r.reduce((t, e) => t + a(e.width), 0);
|
|
316
327
|
}
|
|
317
|
-
function p(
|
|
318
|
-
const
|
|
319
|
-
if (
|
|
328
|
+
function p(r, t, e, i, n) {
|
|
329
|
+
const s = e.length;
|
|
330
|
+
if (s === 0)
|
|
320
331
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
321
|
-
let
|
|
322
|
-
|
|
323
|
-
const m =
|
|
324
|
-
let u =
|
|
325
|
-
for (let l =
|
|
332
|
+
let o = w(r, e, i);
|
|
333
|
+
o = Math.max(0, o - n);
|
|
334
|
+
const m = r + t;
|
|
335
|
+
let u = o;
|
|
336
|
+
for (let l = o; l < s; l++) {
|
|
326
337
|
if (e[l] >= m) {
|
|
327
338
|
u = l - 1;
|
|
328
339
|
break;
|
|
329
340
|
}
|
|
330
341
|
u = l;
|
|
331
342
|
}
|
|
332
|
-
u = Math.min(
|
|
333
|
-
const
|
|
334
|
-
for (let l =
|
|
335
|
-
|
|
336
|
-
return { startCol:
|
|
343
|
+
u = Math.min(s - 1, u + n);
|
|
344
|
+
const d = [];
|
|
345
|
+
for (let l = o; l <= u; l++)
|
|
346
|
+
d.push(l);
|
|
347
|
+
return { startCol: o, endCol: u, visibleColumns: d };
|
|
337
348
|
}
|
|
338
|
-
function w(
|
|
339
|
-
let i = 0,
|
|
340
|
-
for (; i <
|
|
341
|
-
const
|
|
342
|
-
t[
|
|
349
|
+
function w(r, t, e) {
|
|
350
|
+
let i = 0, n = t.length - 1;
|
|
351
|
+
for (; i < n; ) {
|
|
352
|
+
const s = Math.floor((i + n) / 2);
|
|
353
|
+
t[s] + e[s] <= r ? i = s + 1 : n = s;
|
|
343
354
|
}
|
|
344
355
|
return i;
|
|
345
356
|
}
|
|
346
|
-
function R(
|
|
347
|
-
return e ?
|
|
357
|
+
function R(r, t, e) {
|
|
358
|
+
return e ? r > t : !1;
|
|
348
359
|
}
|
|
349
|
-
class
|
|
360
|
+
class E extends b {
|
|
350
361
|
name = "columnVirtualization";
|
|
351
362
|
get defaultConfig() {
|
|
352
363
|
return {
|
|
@@ -379,25 +390,25 @@ class v extends b {
|
|
|
379
390
|
const e = R(t.length, this.config.threshold ?? 30, this.config.autoEnable ?? !0);
|
|
380
391
|
if (this.isVirtualized = e ?? !1, this.columnWidths = c(t), this.columnOffsets = f(t), this.totalWidth = g(t), !e)
|
|
381
392
|
return this.startCol = 0, this.endCol = t.length - 1, [...t];
|
|
382
|
-
const i = this.grid.clientWidth || 800,
|
|
393
|
+
const i = this.grid.clientWidth || 800, n = p(
|
|
383
394
|
this.scrollLeft,
|
|
384
395
|
i,
|
|
385
396
|
this.columnOffsets,
|
|
386
397
|
this.columnWidths,
|
|
387
398
|
this.config.overscan ?? 3
|
|
388
399
|
);
|
|
389
|
-
return this.startCol =
|
|
400
|
+
return this.startCol = n.startCol, this.endCol = n.endCol, n.visibleColumns.map((s) => t[s]);
|
|
390
401
|
}
|
|
391
402
|
afterRender() {
|
|
392
403
|
if (!this.isVirtualized) return;
|
|
393
|
-
const t = this.
|
|
404
|
+
const t = this.gridElement;
|
|
394
405
|
if (!t) return;
|
|
395
|
-
const e = this.columnOffsets[this.startCol] ?? 0, i = t.querySelector(".header-row"),
|
|
396
|
-
i && (i.style.paddingLeft = `${e}px`),
|
|
397
|
-
|
|
406
|
+
const e = this.columnOffsets[this.startCol] ?? 0, i = t.querySelector(".header-row"), n = t.querySelectorAll(".data-grid-row");
|
|
407
|
+
i && (i.style.paddingLeft = `${e}px`), n.forEach((o) => {
|
|
408
|
+
o.style.paddingLeft = `${e}px`;
|
|
398
409
|
});
|
|
399
|
-
const
|
|
400
|
-
|
|
410
|
+
const s = t.querySelector(".rows-viewport .rows");
|
|
411
|
+
s && (s.style.width = `${this.totalWidth}px`);
|
|
401
412
|
}
|
|
402
413
|
onScroll(t) {
|
|
403
414
|
!this.isVirtualized || Math.abs(t.scrollLeft - this.scrollLeft) < 1 || (this.scrollLeft = t.scrollLeft, this.requestRender());
|
|
@@ -440,6 +451,6 @@ class v extends b {
|
|
|
440
451
|
// #endregion
|
|
441
452
|
}
|
|
442
453
|
export {
|
|
443
|
-
|
|
454
|
+
E as ColumnVirtualizationPlugin
|
|
444
455
|
};
|
|
445
456
|
//# sourceMappingURL=index.js.map
|