@toolbox-web/grid 1.18.0 → 1.19.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/all.js +64 -42
- package/all.js.map +1 -1
- package/index.js +2 -2
- package/lib/plugins/selection/SelectionPlugin.d.ts +18 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +110 -71
- package/lib/plugins/selection/index.js.map +1 -1
- package/package.json +1 -1
- package/umd/grid.all.umd.js +2 -2
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
package/all.js
CHANGED
|
@@ -69,7 +69,7 @@ function _t(a, e) {
|
|
|
69
69
|
}
|
|
70
70
|
}), e.rows = d;
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class In extends F {
|
|
73
73
|
static dependencies = [
|
|
74
74
|
{ name: "selection", required: !1, reason: "Enables copy/paste of selected cells instead of entire grid" }
|
|
75
75
|
];
|
|
@@ -210,10 +210,10 @@ function ye(a) {
|
|
|
210
210
|
const e = parseFloat(a);
|
|
211
211
|
return isNaN(e) ? Le : e;
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Ie(a) {
|
|
214
214
|
return a.map((e) => ye(e.width));
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function Te(a) {
|
|
217
217
|
const e = [];
|
|
218
218
|
let t = 0;
|
|
219
219
|
for (const i of a)
|
|
@@ -227,7 +227,7 @@ function Lt(a, e, t, i, n) {
|
|
|
227
227
|
const r = t.length;
|
|
228
228
|
if (r === 0)
|
|
229
229
|
return { startCol: 0, endCol: 0, visibleColumns: [] };
|
|
230
|
-
let o =
|
|
230
|
+
let o = It(a, t, i);
|
|
231
231
|
o = Math.max(0, o - n);
|
|
232
232
|
const s = a + e;
|
|
233
233
|
let l = o;
|
|
@@ -244,7 +244,7 @@ function Lt(a, e, t, i, n) {
|
|
|
244
244
|
d.push(c);
|
|
245
245
|
return { startCol: o, endCol: l, visibleColumns: d };
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function It(a, e, t) {
|
|
248
248
|
let i = 0, n = e.length - 1;
|
|
249
249
|
for (; i < n; ) {
|
|
250
250
|
const r = Math.floor((i + n) / 2);
|
|
@@ -252,10 +252,10 @@ function Tt(a, e, t) {
|
|
|
252
252
|
}
|
|
253
253
|
return i;
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function Tt(a, e, t) {
|
|
256
256
|
return t ? a > e : !1;
|
|
257
257
|
}
|
|
258
|
-
class
|
|
258
|
+
class Tn extends F {
|
|
259
259
|
name = "columnVirtualization";
|
|
260
260
|
get defaultConfig() {
|
|
261
261
|
return {
|
|
@@ -275,7 +275,7 @@ class In extends F {
|
|
|
275
275
|
attach(e) {
|
|
276
276
|
super.attach(e);
|
|
277
277
|
const t = this.columns;
|
|
278
|
-
this.columnWidths =
|
|
278
|
+
this.columnWidths = Ie(t), this.columnOffsets = Te(t), this.totalWidth = Fe(t), this.endCol = t.length - 1;
|
|
279
279
|
}
|
|
280
280
|
detach() {
|
|
281
281
|
this.#t(), this.columnWidths = [], this.columnOffsets = [], this.originalColumns = [], this.isVirtualized = !1, this.startCol = 0, this.endCol = 0, this.scrollLeft = 0, this.totalWidth = 0;
|
|
@@ -293,8 +293,8 @@ class In extends F {
|
|
|
293
293
|
r && (r.style.minWidth = "");
|
|
294
294
|
}
|
|
295
295
|
processColumns(e) {
|
|
296
|
-
(this.originalColumns.length === 0 || e.length >= this.originalColumns.length) && (this.originalColumns = e, this.columnWidths =
|
|
297
|
-
const i = this.originalColumns, n =
|
|
296
|
+
(this.originalColumns.length === 0 || e.length >= this.originalColumns.length) && (this.originalColumns = e, this.columnWidths = Ie(e), this.columnOffsets = Te(e), this.totalWidth = Fe(e));
|
|
297
|
+
const i = this.originalColumns, n = Tt(
|
|
298
298
|
i.length,
|
|
299
299
|
this.config.threshold ?? 30,
|
|
300
300
|
this.config.autoEnable ?? !0
|
|
@@ -1335,12 +1335,12 @@ class Fn extends F {
|
|
|
1335
1335
|
let u = !1;
|
|
1336
1336
|
const h = (b) => {
|
|
1337
1337
|
if (u || !this.#t && this.#e === -1) return;
|
|
1338
|
-
const w = this.grid,
|
|
1339
|
-
this.#E(
|
|
1338
|
+
const w = this.grid, I = s ? w._getRowEntry(s) : void 0, R = I?.row ?? e, T = I?.index ?? t;
|
|
1339
|
+
this.#E(T, i, b, R);
|
|
1340
1340
|
}, f = () => {
|
|
1341
1341
|
if (u = !0, Z(i.field)) {
|
|
1342
|
-
const b = this.grid,
|
|
1343
|
-
|
|
1342
|
+
const b = this.grid, I = (s ? b._getRowEntry(s) : void 0)?.row ?? e;
|
|
1343
|
+
I[i.field] = d;
|
|
1344
1344
|
}
|
|
1345
1345
|
}, g = document.createElement("div");
|
|
1346
1346
|
g.className = "tbw-editor-host", r.innerHTML = "", r.appendChild(g), g.addEventListener("keydown", (b) => {
|
|
@@ -1398,11 +1398,11 @@ class Fn extends F {
|
|
|
1398
1398
|
updateRow: l,
|
|
1399
1399
|
onValueChange: _
|
|
1400
1400
|
}, w = x(b);
|
|
1401
|
-
typeof w == "string" ? (g.innerHTML = w, Vt(g, i, h, d), _((
|
|
1401
|
+
typeof w == "string" ? (g.innerHTML = w, Vt(g, i, h, d), _((I) => {
|
|
1402
1402
|
const R = g.querySelector(
|
|
1403
1403
|
"input,textarea,select"
|
|
1404
1404
|
);
|
|
1405
|
-
R && (R instanceof HTMLInputElement && R.type === "checkbox" ? R.checked = !!
|
|
1405
|
+
R && (R instanceof HTMLInputElement && R.type === "checkbox" ? R.checked = !!I : R.value = String(I ?? ""));
|
|
1406
1406
|
})) : w instanceof Node && (g.appendChild(w), w instanceof HTMLInputElement || w instanceof HTMLSelectElement || w instanceof HTMLTextAreaElement ? _((R) => {
|
|
1407
1407
|
w instanceof HTMLInputElement && w.type === "checkbox" ? w.checked = !!R : w.value = String(R ?? "");
|
|
1408
1408
|
}) : r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
|
|
@@ -1425,8 +1425,8 @@ class Fn extends F {
|
|
|
1425
1425
|
if (x.mount)
|
|
1426
1426
|
try {
|
|
1427
1427
|
x.mount({ placeholder: b, context: w, spec: x });
|
|
1428
|
-
} catch (
|
|
1429
|
-
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`,
|
|
1428
|
+
} catch (I) {
|
|
1429
|
+
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, I);
|
|
1430
1430
|
}
|
|
1431
1431
|
else
|
|
1432
1432
|
this.grid.dispatchEvent(
|
|
@@ -2216,16 +2216,16 @@ class z extends F {
|
|
|
2216
2216
|
},
|
|
2217
2217
|
{ passive: !0 }
|
|
2218
2218
|
), w(c.value), e.appendChild(m);
|
|
2219
|
-
let
|
|
2219
|
+
let I;
|
|
2220
2220
|
c.addEventListener("input", () => {
|
|
2221
|
-
clearTimeout(
|
|
2221
|
+
clearTimeout(I), I = setTimeout(() => {
|
|
2222
2222
|
this.searchText.set(r, c.value), w(c.value);
|
|
2223
2223
|
}, this.config.debounceMs ?? 150);
|
|
2224
2224
|
});
|
|
2225
2225
|
const R = document.createElement("div");
|
|
2226
2226
|
R.className = "tbw-filter-buttons";
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2227
|
+
const T = document.createElement("button");
|
|
2228
|
+
T.className = "tbw-filter-apply-btn", T.textContent = "Apply", T.addEventListener("click", () => {
|
|
2229
2229
|
const v = [];
|
|
2230
2230
|
for (const [C, L] of P)
|
|
2231
2231
|
if (!L)
|
|
@@ -2236,7 +2236,7 @@ class z extends F {
|
|
|
2236
2236
|
v.push(S !== void 0 ? S : C);
|
|
2237
2237
|
}
|
|
2238
2238
|
t.applySetFilter(v);
|
|
2239
|
-
}), R.appendChild(
|
|
2239
|
+
}), R.appendChild(T);
|
|
2240
2240
|
const N = document.createElement("button");
|
|
2241
2241
|
N.className = "tbw-filter-clear-btn", N.textContent = "Clear Filter", N.addEventListener("click", () => {
|
|
2242
2242
|
t.clearFilter();
|
|
@@ -2265,12 +2265,12 @@ class z extends F {
|
|
|
2265
2265
|
b.className = "tbw-filter-range-separator", b.textContent = "–", E.appendChild(b);
|
|
2266
2266
|
const w = document.createElement("div");
|
|
2267
2267
|
w.className = "tbw-filter-range-group";
|
|
2268
|
-
const
|
|
2269
|
-
|
|
2268
|
+
const I = document.createElement("label");
|
|
2269
|
+
I.textContent = "Max", I.className = "tbw-filter-range-label";
|
|
2270
2270
|
const R = document.createElement("input");
|
|
2271
|
-
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(f), R.step = String(g), R.value = String(x), w.appendChild(
|
|
2272
|
-
const
|
|
2273
|
-
|
|
2271
|
+
R.type = "number", R.className = "tbw-filter-range-input", R.min = String(h), R.max = String(f), R.step = String(g), R.value = String(x), w.appendChild(I), w.appendChild(R), E.appendChild(w), e.appendChild(E);
|
|
2272
|
+
const T = document.createElement("div");
|
|
2273
|
+
T.className = "tbw-filter-range-slider";
|
|
2274
2274
|
const N = document.createElement("div");
|
|
2275
2275
|
N.className = "tbw-filter-range-track";
|
|
2276
2276
|
const v = document.createElement("div");
|
|
@@ -2278,7 +2278,7 @@ class z extends F {
|
|
|
2278
2278
|
const C = document.createElement("input");
|
|
2279
2279
|
C.type = "range", C.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", C.min = String(h), C.max = String(f), C.step = String(g), C.value = String(m);
|
|
2280
2280
|
const L = document.createElement("input");
|
|
2281
|
-
L.type = "range", L.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", L.min = String(h), L.max = String(f), L.step = String(g), L.value = String(x),
|
|
2281
|
+
L.type = "range", L.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", L.min = String(h), L.max = String(f), L.step = String(g), L.value = String(x), T.appendChild(N), T.appendChild(v), T.appendChild(C), T.appendChild(L), e.appendChild(T);
|
|
2282
2282
|
const S = () => {
|
|
2283
2283
|
const A = parseFloat(C.value), B = parseFloat(L.value), Q = f - h, Re = (A - h) / Q * 100, vt = (B - h) / Q * 100;
|
|
2284
2284
|
v.style.left = `${Re}%`, v.style.width = `${vt - Re}%`;
|
|
@@ -2323,12 +2323,12 @@ class z extends F {
|
|
|
2323
2323
|
b.type = "date", b.className = "tbw-filter-date-input", f && (b.min = f), g && (b.max = g), b.value = m, D.appendChild(_), D.appendChild(b), P.appendChild(D);
|
|
2324
2324
|
const w = document.createElement("span");
|
|
2325
2325
|
w.className = "tbw-filter-range-separator", w.textContent = "–", P.appendChild(w);
|
|
2326
|
-
const
|
|
2327
|
-
|
|
2326
|
+
const I = document.createElement("div");
|
|
2327
|
+
I.className = "tbw-filter-date-group";
|
|
2328
2328
|
const R = document.createElement("label");
|
|
2329
2329
|
R.textContent = "To", R.className = "tbw-filter-range-label";
|
|
2330
|
-
const
|
|
2331
|
-
|
|
2330
|
+
const T = document.createElement("input");
|
|
2331
|
+
T.type = "date", T.className = "tbw-filter-date-input", f && (T.min = f), g && (T.max = g), T.value = x, I.appendChild(R), I.appendChild(T), P.appendChild(I), e.appendChild(P);
|
|
2332
2332
|
const N = document.createElement("label");
|
|
2333
2333
|
N.className = "tbw-filter-blank-option";
|
|
2334
2334
|
const v = document.createElement("input");
|
|
@@ -2336,7 +2336,7 @@ class z extends F {
|
|
|
2336
2336
|
const C = document.createTextNode("Show only blank");
|
|
2337
2337
|
N.appendChild(v), N.appendChild(C);
|
|
2338
2338
|
const L = (y) => {
|
|
2339
|
-
b.disabled = y,
|
|
2339
|
+
b.disabled = y, T.disabled = y, P.classList.toggle("tbw-filter-disabled", y);
|
|
2340
2340
|
};
|
|
2341
2341
|
L(E), v.addEventListener("change", () => {
|
|
2342
2342
|
L(v.checked);
|
|
@@ -2349,7 +2349,7 @@ class z extends F {
|
|
|
2349
2349
|
t.applyTextFilter("blank", "");
|
|
2350
2350
|
return;
|
|
2351
2351
|
}
|
|
2352
|
-
const y = b.value, A =
|
|
2352
|
+
const y = b.value, A = T.value;
|
|
2353
2353
|
y && A ? t.applyTextFilter("between", y, A) : y ? t.applyTextFilter("greaterThanOrEqual", y) : A ? t.applyTextFilter("lessThanOrEqual", A) : t.clearFilter();
|
|
2354
2354
|
}), S.appendChild(k);
|
|
2355
2355
|
const M = document.createElement("button");
|
|
@@ -3694,7 +3694,7 @@ function he(a, e) {
|
|
|
3694
3694
|
}
|
|
3695
3695
|
if (a.customPanels)
|
|
3696
3696
|
for (const o of a.customPanels) {
|
|
3697
|
-
const s =
|
|
3697
|
+
const s = Ti(o, e);
|
|
3698
3698
|
switch (o.position) {
|
|
3699
3699
|
case "left":
|
|
3700
3700
|
i.appendChild(s);
|
|
@@ -3728,7 +3728,7 @@ function _i(a, e, t, i) {
|
|
|
3728
3728
|
const s = document.createElement("span");
|
|
3729
3729
|
s.className = "tbw-aggregation-label", s.textContent = r, n.appendChild(s);
|
|
3730
3730
|
}
|
|
3731
|
-
const o =
|
|
3731
|
+
const o = Ii(e, t, i);
|
|
3732
3732
|
o && n.appendChild(o), a.appendChild(n);
|
|
3733
3733
|
}
|
|
3734
3734
|
function Li(a, e, t, i) {
|
|
@@ -3756,7 +3756,7 @@ function gt(a, e, t) {
|
|
|
3756
3756
|
}
|
|
3757
3757
|
return { value: i, formatter: n };
|
|
3758
3758
|
}
|
|
3759
|
-
function
|
|
3759
|
+
function Ii(a, e, t) {
|
|
3760
3760
|
const i = a.aggregators && Object.keys(a.aggregators).length > 0, n = a.cells && Object.keys(a.cells).length > 0;
|
|
3761
3761
|
if (!i && !n) return null;
|
|
3762
3762
|
const r = document.createElement("span");
|
|
@@ -3772,7 +3772,7 @@ function Ti(a, e, t) {
|
|
|
3772
3772
|
}
|
|
3773
3773
|
return r.children.length > 0 ? r : null;
|
|
3774
3774
|
}
|
|
3775
|
-
function
|
|
3775
|
+
function Ti(a, e) {
|
|
3776
3776
|
const t = document.createElement("div");
|
|
3777
3777
|
t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${a.id}`;
|
|
3778
3778
|
const i = a.render(e);
|
|
@@ -5575,7 +5575,8 @@ class Bn extends F {
|
|
|
5575
5575
|
queries: [
|
|
5576
5576
|
{ type: "getSelection", description: "Get the current selection state" },
|
|
5577
5577
|
{ type: "selectRows", description: "Select specific rows by index (row mode only)" },
|
|
5578
|
-
{ type: "getSelectedRowIndices", description: "Get sorted array of selected row indices" }
|
|
5578
|
+
{ type: "getSelectedRowIndices", description: "Get sorted array of selected row indices" },
|
|
5579
|
+
{ type: "getSelectedRows", description: "Get actual row objects for the current selection (works in all modes)" }
|
|
5579
5580
|
],
|
|
5580
5581
|
configRules: [
|
|
5581
5582
|
{
|
|
@@ -5634,6 +5635,8 @@ class Bn extends F {
|
|
|
5634
5635
|
return this.getSelection();
|
|
5635
5636
|
if (e.type === "getSelectedRowIndices")
|
|
5636
5637
|
return this.getSelectedRowIndices();
|
|
5638
|
+
if (e.type === "getSelectedRows")
|
|
5639
|
+
return this.getSelectedRows();
|
|
5637
5640
|
if (e.type === "selectRows")
|
|
5638
5641
|
return this.selectRows(e.context), !0;
|
|
5639
5642
|
}
|
|
@@ -5947,6 +5950,25 @@ class Bn extends F {
|
|
|
5947
5950
|
getSelectedRowIndices() {
|
|
5948
5951
|
return [...this.selected].sort((e, t) => e - t);
|
|
5949
5952
|
}
|
|
5953
|
+
getSelectedRows() {
|
|
5954
|
+
const { mode: e } = this.config, t = this.rows;
|
|
5955
|
+
if (e === "row")
|
|
5956
|
+
return this.getSelectedRowIndices().filter((i) => i >= 0 && i < t.length).map((i) => t[i]);
|
|
5957
|
+
if (e === "cell" && this.selectedCell) {
|
|
5958
|
+
const { row: i } = this.selectedCell;
|
|
5959
|
+
return i >= 0 && i < t.length ? [t[i]] : [];
|
|
5960
|
+
}
|
|
5961
|
+
if (e === "range" && this.ranges.length > 0) {
|
|
5962
|
+
const i = /* @__PURE__ */ new Set();
|
|
5963
|
+
for (const n of this.ranges) {
|
|
5964
|
+
const r = Math.max(0, Math.min(n.startRow, n.endRow)), o = Math.min(t.length - 1, Math.max(n.startRow, n.endRow));
|
|
5965
|
+
for (let s = r; s <= o; s++)
|
|
5966
|
+
i.add(s);
|
|
5967
|
+
}
|
|
5968
|
+
return [...i].sort((n, r) => n - r).map((n) => t[n]);
|
|
5969
|
+
}
|
|
5970
|
+
return [];
|
|
5971
|
+
}
|
|
5950
5972
|
clearSelection() {
|
|
5951
5973
|
this.selectedCell = null, this.selected.clear(), this.anchor = null, this.ranges = [], this.activeRange = null, this.cellAnchor = null, this.emit("selection-change", { mode: this.config.mode, ranges: [] }), this.requestAfterRender();
|
|
5952
5974
|
}
|
|
@@ -6766,8 +6788,8 @@ class U extends F {
|
|
|
6766
6788
|
export {
|
|
6767
6789
|
re as BLANK_FILTER_VALUE,
|
|
6768
6790
|
F as BaseGridPlugin,
|
|
6769
|
-
|
|
6770
|
-
|
|
6791
|
+
In as ClipboardPlugin,
|
|
6792
|
+
Tn as ColumnVirtualizationPlugin,
|
|
6771
6793
|
dt as ContextMenuPlugin,
|
|
6772
6794
|
Yn as DEFAULT_ANIMATION_CONFIG,
|
|
6773
6795
|
yt as DEFAULT_GRID_ICONS,
|