@toolbox-web/grid 0.5.0 → 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 +1 -1
- package/all.js +27 -25
- package/index.js +926 -846
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +17 -0
- package/lib/core/grid.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/rows.d.ts +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/types.d.ts +35 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- 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/umd/grid.all.umd.js +18 -18
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +12 -12
- package/umd/grid.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ document.body.appendChild(grid);
|
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
> [!TIP]
|
|
30
|
-
> For complete examples, see the [Storybook documentation](https://
|
|
30
|
+
> For complete examples, see the [Storybook documentation](https://toolboxjs.com/).
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
package/all.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseGridPlugin as x, DEFAULT_GRID_ICONS as $e, runAggregator as ae, e as je, s as Ue, PLUGIN_QUERIES as He, getAggregator as de, getValueAggregator as Ye, a as Xe, c as ce, g as Ze } from "./index.js";
|
|
2
|
-
import { DEFAULT_ANIMATION_CONFIG as oi, DGEvents as si, DataGridElement as li, FitModeEnum as ai, GridCSSVars as di, GridClasses as ci, GridDataAttrs as ui, DataGridElement as hi, GridSelectors as fi, PluginEvents as gi, PluginManager as pi, RenderPhase as mi, builtInSort as wi,
|
|
2
|
+
import { DEFAULT_ANIMATION_CONFIG as oi, DGEvents as si, DataGridElement as li, FitModeEnum as ai, GridCSSVars as di, GridClasses as ci, GridDataAttrs as ui, DataGridElement as hi, GridSelectors as fi, PluginEvents as gi, PluginManager as pi, RenderPhase as mi, builtInSort as wi, createGrid as bi, defaultComparator as vi, queryGrid as yi } from "./index.js";
|
|
3
3
|
const ze = "__tbw_expander", Je = 32;
|
|
4
4
|
function ne(s) {
|
|
5
5
|
return s.field === ze;
|
|
@@ -710,7 +710,7 @@ const j = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[
|
|
|
710
710
|
function P(s) {
|
|
711
711
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Gn(s) {
|
|
714
714
|
return (s.__editingCellCount ?? 0) > 0;
|
|
715
715
|
}
|
|
716
716
|
function dt(s) {
|
|
@@ -729,7 +729,7 @@ function ut(s, e, t) {
|
|
|
729
729
|
t(K(n, e));
|
|
730
730
|
}), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(K(n, e))));
|
|
731
731
|
}
|
|
732
|
-
class
|
|
732
|
+
class On extends x {
|
|
733
733
|
name = "editing";
|
|
734
734
|
styles = lt;
|
|
735
735
|
get defaultConfig() {
|
|
@@ -2427,7 +2427,7 @@ function Kt(s, e, t, n) {
|
|
|
2427
2427
|
return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), i.appendChild(r), i;
|
|
2428
2428
|
}
|
|
2429
2429
|
const qt = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
|
|
2430
|
-
class
|
|
2430
|
+
class Ge extends x {
|
|
2431
2431
|
name = "masterDetail";
|
|
2432
2432
|
styles = qt;
|
|
2433
2433
|
get defaultConfig() {
|
|
@@ -2537,7 +2537,7 @@ class Oe extends x {
|
|
|
2537
2537
|
*/
|
|
2538
2538
|
getDetailHeight(e) {
|
|
2539
2539
|
const t = this.detailElements.get(e);
|
|
2540
|
-
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight :
|
|
2540
|
+
return t ? t.offsetHeight : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : Ge.DEFAULT_DETAIL_HEIGHT;
|
|
2541
2541
|
}
|
|
2542
2542
|
/**
|
|
2543
2543
|
* Toggle a row's detail and emit event.
|
|
@@ -2778,10 +2778,10 @@ function xe(s, e) {
|
|
|
2778
2778
|
function Re(s, e) {
|
|
2779
2779
|
return s.find((t) => t.field === e)?.direction;
|
|
2780
2780
|
}
|
|
2781
|
-
const
|
|
2781
|
+
const Gt = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:4px;opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:4px;opacity:.8}.sort-indicator{margin-left:4px;opacity:.8}.sort-index{font-size:10px;background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center;margin-left:2px;font-weight:600}}';
|
|
2782
2782
|
class $n extends x {
|
|
2783
2783
|
name = "multiSort";
|
|
2784
|
-
styles =
|
|
2784
|
+
styles = Gt;
|
|
2785
2785
|
get defaultConfig() {
|
|
2786
2786
|
return {
|
|
2787
2787
|
maxSortColumns: 3,
|
|
@@ -2895,7 +2895,7 @@ class $n extends x {
|
|
|
2895
2895
|
}
|
|
2896
2896
|
// #endregion
|
|
2897
2897
|
}
|
|
2898
|
-
function
|
|
2898
|
+
function Ot(s) {
|
|
2899
2899
|
return s.filter((e) => e.sticky === "left");
|
|
2900
2900
|
}
|
|
2901
2901
|
function Bt(s) {
|
|
@@ -3003,7 +3003,7 @@ class jn extends x {
|
|
|
3003
3003
|
*/
|
|
3004
3004
|
getLeftPinnedColumns() {
|
|
3005
3005
|
const e = [...this.columns];
|
|
3006
|
-
return
|
|
3006
|
+
return Ot(e);
|
|
3007
3007
|
}
|
|
3008
3008
|
/**
|
|
3009
3009
|
* Get columns pinned to the right.
|
|
@@ -3281,7 +3281,7 @@ function oe(s, e) {
|
|
|
3281
3281
|
return [...s, e].join("|");
|
|
3282
3282
|
}
|
|
3283
3283
|
function Yt(s, e) {
|
|
3284
|
-
const t = e.rowGroupFields ?? [], n = e.columnGroupFields ?? [], i = e.valueFields ?? [], r = Xt(s, n), o =
|
|
3284
|
+
const t = e.rowGroupFields ?? [], n = e.columnGroupFields ?? [], i = e.valueFields ?? [], r = Xt(s, n), o = Oe(
|
|
3285
3285
|
s,
|
|
3286
3286
|
t,
|
|
3287
3287
|
n,
|
|
@@ -3316,7 +3316,7 @@ function Zt(s, e) {
|
|
|
3316
3316
|
}
|
|
3317
3317
|
return t;
|
|
3318
3318
|
}
|
|
3319
|
-
function
|
|
3319
|
+
function Oe(s, e, t, n, i, r, o) {
|
|
3320
3320
|
const l = [];
|
|
3321
3321
|
if (e.length === 0) {
|
|
3322
3322
|
const h = Le(s, t, n, i), f = Te(h);
|
|
@@ -3334,7 +3334,7 @@ function Ge(s, e, t, n, i, r, o) {
|
|
|
3334
3334
|
for (const [h, f] of u) {
|
|
3335
3335
|
const g = o ? `${o}|${h}` : h, p = Le(f, t, n, i), w = Te(p);
|
|
3336
3336
|
let m;
|
|
3337
|
-
c && (m =
|
|
3337
|
+
c && (m = Oe(
|
|
3338
3338
|
f,
|
|
3339
3339
|
d,
|
|
3340
3340
|
t,
|
|
@@ -4295,7 +4295,7 @@ function Jn(s, e) {
|
|
|
4295
4295
|
e.has(i) || n.push(i);
|
|
4296
4296
|
return { added: t, removed: n };
|
|
4297
4297
|
}
|
|
4298
|
-
function
|
|
4298
|
+
function O(s) {
|
|
4299
4299
|
return {
|
|
4300
4300
|
startRow: Math.min(s.startRow, s.endRow),
|
|
4301
4301
|
startCol: Math.min(s.startCol, s.endCol),
|
|
@@ -4304,7 +4304,7 @@ function G(s) {
|
|
|
4304
4304
|
};
|
|
4305
4305
|
}
|
|
4306
4306
|
function pn(s) {
|
|
4307
|
-
const e =
|
|
4307
|
+
const e = O(s);
|
|
4308
4308
|
return {
|
|
4309
4309
|
from: { row: e.startRow, col: e.startCol },
|
|
4310
4310
|
to: { row: e.endRow, col: e.endCol }
|
|
@@ -4314,14 +4314,14 @@ function Be(s) {
|
|
|
4314
4314
|
return s.map(pn);
|
|
4315
4315
|
}
|
|
4316
4316
|
function mn(s, e, t) {
|
|
4317
|
-
const n =
|
|
4317
|
+
const n = O(t);
|
|
4318
4318
|
return s >= n.startRow && s <= n.endRow && e >= n.startCol && e <= n.endCol;
|
|
4319
4319
|
}
|
|
4320
4320
|
function Me(s, e, t) {
|
|
4321
4321
|
return t.some((n) => mn(s, e, n));
|
|
4322
4322
|
}
|
|
4323
4323
|
function wn(s) {
|
|
4324
|
-
const e = [], t =
|
|
4324
|
+
const e = [], t = O(s);
|
|
4325
4325
|
for (let n = t.startRow; n <= t.endRow; n++)
|
|
4326
4326
|
for (let i = t.startCol; i <= t.endCol; i++)
|
|
4327
4327
|
e.push({ row: n, col: i });
|
|
@@ -4506,7 +4506,7 @@ class Qn extends x {
|
|
|
4506
4506
|
l >= 0 && this.selected.has(l) && r.classList.add("selected", "row-focus");
|
|
4507
4507
|
})), t === "range" && this.ranges.length > 0) {
|
|
4508
4508
|
ce(e);
|
|
4509
|
-
const r = this.activeRange ?
|
|
4509
|
+
const r = this.activeRange ? O(this.activeRange) : null, o = this.columns.findIndex((a) => !_(a));
|
|
4510
4510
|
this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
|
|
4511
4511
|
const d = parseInt(a.getAttribute("data-row") ?? "-1", 10), c = parseInt(a.getAttribute("data-col") ?? "-1", 10);
|
|
4512
4512
|
if (d >= 0 && c >= 0) {
|
|
@@ -4639,7 +4639,7 @@ class Qn extends x {
|
|
|
4639
4639
|
}
|
|
4640
4640
|
// #endregion
|
|
4641
4641
|
}
|
|
4642
|
-
function
|
|
4642
|
+
function G(s, e) {
|
|
4643
4643
|
return Math.floor(s / e);
|
|
4644
4644
|
}
|
|
4645
4645
|
function Cn(s, e) {
|
|
@@ -4649,7 +4649,7 @@ function Cn(s, e) {
|
|
|
4649
4649
|
};
|
|
4650
4650
|
}
|
|
4651
4651
|
function xn(s, e, t) {
|
|
4652
|
-
const n =
|
|
4652
|
+
const n = G(s, t), i = G(e - 1, t), r = [];
|
|
4653
4653
|
for (let o = n; o <= i; o++)
|
|
4654
4654
|
r.push(o);
|
|
4655
4655
|
return r;
|
|
@@ -4664,7 +4664,7 @@ async function Pe(s, e, t, n) {
|
|
|
4664
4664
|
});
|
|
4665
4665
|
}
|
|
4666
4666
|
function Rn(s, e, t) {
|
|
4667
|
-
const n =
|
|
4667
|
+
const n = G(s, e), i = t.get(n);
|
|
4668
4668
|
if (!i) return;
|
|
4669
4669
|
const r = s % e;
|
|
4670
4670
|
return i[r];
|
|
@@ -4762,7 +4762,7 @@ class ei extends x {
|
|
|
4762
4762
|
* @param rowIndex - Row index to check
|
|
4763
4763
|
*/
|
|
4764
4764
|
isRowLoaded(e) {
|
|
4765
|
-
const t = this.config.cacheBlockSize ?? 100, n =
|
|
4765
|
+
const t = this.config.cacheBlockSize ?? 100, n = G(e, t);
|
|
4766
4766
|
return this.loadedBlocks.has(n);
|
|
4767
4767
|
}
|
|
4768
4768
|
/**
|
|
@@ -5504,7 +5504,7 @@ export {
|
|
|
5504
5504
|
$e as DEFAULT_GRID_ICONS,
|
|
5505
5505
|
si as DGEvents,
|
|
5506
5506
|
li as DataGridElement,
|
|
5507
|
-
|
|
5507
|
+
On as EditingPlugin,
|
|
5508
5508
|
Bn as ExportPlugin,
|
|
5509
5509
|
j as FOCUSABLE_EDITOR_SELECTOR,
|
|
5510
5510
|
S as FilteringPlugin,
|
|
@@ -5516,7 +5516,7 @@ export {
|
|
|
5516
5516
|
fi as GridSelectors,
|
|
5517
5517
|
Vn as GroupingColumnsPlugin,
|
|
5518
5518
|
Wn as GroupingRowsPlugin,
|
|
5519
|
-
|
|
5519
|
+
Ge as MasterDetailPlugin,
|
|
5520
5520
|
$n as MultiSortPlugin,
|
|
5521
5521
|
He as PLUGIN_QUERIES,
|
|
5522
5522
|
jn as PinnedColumnsPlugin,
|
|
@@ -5535,14 +5535,16 @@ export {
|
|
|
5535
5535
|
ct as clearEditingState,
|
|
5536
5536
|
Jn as computeSelectionDiff,
|
|
5537
5537
|
Ln as countNodes,
|
|
5538
|
-
bi as
|
|
5538
|
+
bi as createGrid,
|
|
5539
|
+
vi as defaultComparator,
|
|
5539
5540
|
at as defaultEditorFor,
|
|
5540
5541
|
nt as defaultPasteHandler,
|
|
5541
5542
|
De as detectTreeStructure,
|
|
5542
5543
|
_n as getMaxDepth,
|
|
5543
5544
|
Xn as handleRowClick,
|
|
5544
|
-
|
|
5545
|
+
Gn as hasEditingCells,
|
|
5545
5546
|
An as inferChildrenField,
|
|
5547
|
+
yi as queryGrid,
|
|
5546
5548
|
Zn as selectAll
|
|
5547
5549
|
};
|
|
5548
5550
|
//# sourceMappingURL=all.js.map
|