@toolbox-web/grid 1.19.1 → 1.19.3
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 +49 -42
- package/all.js.map +1 -1
- package/index.js +367 -341
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/utils.d.ts +2 -2
- package/lib/core/internal/utils.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +0 -2
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +11 -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/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +62 -55
- 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/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-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 +11 -1
- package/umd/grid.all.umd.js +24 -24
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +11 -11
- package/umd/grid.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/all.js
CHANGED
|
@@ -113,8 +113,8 @@ class In extends F {
|
|
|
113
113
|
e.preventDefault();
|
|
114
114
|
const i = _e(t, this.config), n = this.#s(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
|
|
115
115
|
for (let m = 0; m < g && s + m <= c; m++) {
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
const y = this.columns[s + m];
|
|
117
|
+
y && !y.hidden && f.push(y.field);
|
|
118
118
|
}
|
|
119
119
|
const p = { rows: i, text: t, target: h, fields: f };
|
|
120
120
|
this.emit("paste", p), this.#o(p);
|
|
@@ -1365,28 +1365,28 @@ class Fn extends F {
|
|
|
1365
1365
|
b.stopPropagation(), b.preventDefault(), f(), this.#h(t, !0);
|
|
1366
1366
|
}
|
|
1367
1367
|
});
|
|
1368
|
-
const p = i, m = p.__editorTemplate,
|
|
1368
|
+
const p = i, m = p.__editorTemplate, y = zt(this.grid, p) ?? Kt(i), E = d, P = `${t}:${i.field}`, D = [];
|
|
1369
1369
|
this.#f.set(P, (b) => {
|
|
1370
1370
|
for (const w of D) w(b);
|
|
1371
1371
|
});
|
|
1372
1372
|
const _ = (b) => {
|
|
1373
1373
|
D.push(b);
|
|
1374
1374
|
};
|
|
1375
|
-
if (
|
|
1375
|
+
if (y === "template" && m)
|
|
1376
1376
|
this.#R(g, p, e, d, h, f, o, t), _((b) => {
|
|
1377
1377
|
const w = g.querySelector(
|
|
1378
1378
|
"input,textarea,select"
|
|
1379
1379
|
);
|
|
1380
1380
|
w && (w instanceof HTMLInputElement && w.type === "checkbox" ? w.checked = !!b : w.value = String(b ?? ""));
|
|
1381
1381
|
});
|
|
1382
|
-
else if (typeof
|
|
1383
|
-
const b = document.createElement(
|
|
1382
|
+
else if (typeof y == "string") {
|
|
1383
|
+
const b = document.createElement(y);
|
|
1384
1384
|
b.value = E, b.addEventListener("change", () => h(b.value)), _((w) => {
|
|
1385
1385
|
b.value = w;
|
|
1386
1386
|
}), g.appendChild(b), o || queueMicrotask(() => {
|
|
1387
1387
|
g.querySelector(G)?.focus({ preventScroll: !0 });
|
|
1388
1388
|
});
|
|
1389
|
-
} else if (typeof
|
|
1389
|
+
} else if (typeof y == "function") {
|
|
1390
1390
|
const b = {
|
|
1391
1391
|
row: e,
|
|
1392
1392
|
rowId: s ?? "",
|
|
@@ -1397,7 +1397,7 @@ class Fn extends F {
|
|
|
1397
1397
|
cancel: f,
|
|
1398
1398
|
updateRow: l,
|
|
1399
1399
|
onValueChange: _
|
|
1400
|
-
}, w =
|
|
1400
|
+
}, w = y(b);
|
|
1401
1401
|
typeof w == "string" ? (g.innerHTML = w, Vt(g, i, h, d), _((I) => {
|
|
1402
1402
|
const R = g.querySelector(
|
|
1403
1403
|
"input,textarea,select"
|
|
@@ -1408,7 +1408,7 @@ class Fn extends F {
|
|
|
1408
1408
|
}) : r.setAttribute("data-editor-managed", "")), o || queueMicrotask(() => {
|
|
1409
1409
|
g.querySelector(G)?.focus({ preventScroll: !0 });
|
|
1410
1410
|
});
|
|
1411
|
-
} else if (
|
|
1411
|
+
} else if (y && typeof y == "object") {
|
|
1412
1412
|
const b = document.createElement("div");
|
|
1413
1413
|
b.setAttribute("data-external-editor", ""), b.setAttribute("data-field", i.field), g.appendChild(b), r.setAttribute("data-editor-managed", "");
|
|
1414
1414
|
const w = {
|
|
@@ -1422,15 +1422,15 @@ class Fn extends F {
|
|
|
1422
1422
|
updateRow: l,
|
|
1423
1423
|
onValueChange: _
|
|
1424
1424
|
};
|
|
1425
|
-
if (
|
|
1425
|
+
if (y.mount)
|
|
1426
1426
|
try {
|
|
1427
|
-
|
|
1427
|
+
y.mount({ placeholder: b, context: w, spec: y });
|
|
1428
1428
|
} catch (I) {
|
|
1429
1429
|
console.warn(`[tbw-grid] External editor mount error for column '${i.field}':`, I);
|
|
1430
1430
|
}
|
|
1431
1431
|
else
|
|
1432
1432
|
this.grid.dispatchEvent(
|
|
1433
|
-
new CustomEvent("mount-external-editor", { detail: { placeholder: b, spec:
|
|
1433
|
+
new CustomEvent("mount-external-editor", { detail: { placeholder: b, spec: y, context: w } })
|
|
1434
1434
|
);
|
|
1435
1435
|
}
|
|
1436
1436
|
}
|
|
@@ -2159,8 +2159,8 @@ class z extends F {
|
|
|
2159
2159
|
}), e.appendChild(u);
|
|
2160
2160
|
const m = document.createElement("div");
|
|
2161
2161
|
m.className = "tbw-filter-values";
|
|
2162
|
-
const
|
|
2163
|
-
|
|
2162
|
+
const y = document.createElement("div");
|
|
2163
|
+
y.className = "tbw-filter-values-spacer", m.appendChild(y);
|
|
2164
2164
|
const E = document.createElement("div");
|
|
2165
2165
|
E.className = "tbw-filter-values-content", m.appendChild(E);
|
|
2166
2166
|
const P = /* @__PURE__ */ new Map();
|
|
@@ -2176,11 +2176,11 @@ class z extends F {
|
|
|
2176
2176
|
M.type = "checkbox", M.className = "tbw-filter-checkbox", M.checked = P.get(S) ?? !0, M.dataset.value = S, M.addEventListener("change", () => {
|
|
2177
2177
|
P.set(S, M.checked), p();
|
|
2178
2178
|
});
|
|
2179
|
-
const
|
|
2180
|
-
return
|
|
2179
|
+
const x = document.createElement("span");
|
|
2180
|
+
return x.textContent = L, k.appendChild(M), k.appendChild(x), k;
|
|
2181
2181
|
}, b = () => {
|
|
2182
2182
|
const v = D.length, C = m.clientHeight, L = m.scrollTop;
|
|
2183
|
-
if (
|
|
2183
|
+
if (y.style.height = `${v * s}px`, xt(v, z.LIST_BYPASS_THRESHOLD / 3)) {
|
|
2184
2184
|
E.innerHTML = "", E.style.transform = "translateY(0px)", D.forEach((k, M) => {
|
|
2185
2185
|
E.appendChild(_(k, M));
|
|
2186
2186
|
});
|
|
@@ -2202,7 +2202,7 @@ class z extends F {
|
|
|
2202
2202
|
const k = l(S), M = C ? k : k.toLowerCase();
|
|
2203
2203
|
return !v || M.includes(L);
|
|
2204
2204
|
}), D.length === 0) {
|
|
2205
|
-
|
|
2205
|
+
y.style.height = "0px", E.innerHTML = "";
|
|
2206
2206
|
const S = document.createElement("div");
|
|
2207
2207
|
S.className = "tbw-filter-no-match", S.textContent = "No matching values", E.appendChild(S);
|
|
2208
2208
|
return;
|
|
@@ -2251,8 +2251,8 @@ class z extends F {
|
|
|
2251
2251
|
}
|
|
2252
2252
|
return B;
|
|
2253
2253
|
}, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? s?.min, c), f = l(o?.max ?? s?.max, u), g = o?.step ?? s?.step ?? 1, p = this.filters.get(n);
|
|
2254
|
-
let m = h,
|
|
2255
|
-
p?.operator === "between" ? (m = l(p.value, h),
|
|
2254
|
+
let m = h, y = f;
|
|
2255
|
+
p?.operator === "between" ? (m = l(p.value, h), y = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? m = l(p.value, h) : p?.operator === "lessThanOrEqual" && (y = l(p.value, f));
|
|
2256
2256
|
const E = document.createElement("div");
|
|
2257
2257
|
E.className = "tbw-filter-range-inputs";
|
|
2258
2258
|
const P = document.createElement("div");
|
|
@@ -2268,7 +2268,7 @@ class z extends F {
|
|
|
2268
2268
|
const I = document.createElement("label");
|
|
2269
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(
|
|
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(y), w.appendChild(I), w.appendChild(R), E.appendChild(w), e.appendChild(E);
|
|
2272
2272
|
const T = document.createElement("div");
|
|
2273
2273
|
T.className = "tbw-filter-range-slider";
|
|
2274
2274
|
const N = 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(
|
|
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(y), 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}%`;
|
|
@@ -2303,16 +2303,16 @@ class z extends F {
|
|
|
2303
2303
|
const A = parseFloat(_.value), B = parseFloat(R.value);
|
|
2304
2304
|
t.applyTextFilter("between", A, B);
|
|
2305
2305
|
}), k.appendChild(M);
|
|
2306
|
-
const
|
|
2307
|
-
|
|
2306
|
+
const x = document.createElement("button");
|
|
2307
|
+
x.className = "tbw-filter-clear-btn", x.textContent = "Clear Filter", x.addEventListener("click", () => {
|
|
2308
2308
|
t.clearFilter();
|
|
2309
|
-
}), k.appendChild(
|
|
2309
|
+
}), k.appendChild(x), e.appendChild(k);
|
|
2310
2310
|
}
|
|
2311
2311
|
renderDateFilterPanel(e, t, i) {
|
|
2312
|
-
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((
|
|
2313
|
-
let m = "",
|
|
2312
|
+
const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((x) => x instanceof Date || typeof x == "string" && !isNaN(Date.parse(x))).map((x) => x instanceof Date ? x : new Date(x)).filter((x) => !isNaN(x.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((x) => x.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((x) => x.getTime()))) : null, u = (x) => x ? x.toISOString().split("T")[0] : "", h = (x) => x ? typeof x == "string" ? x : typeof x == "number" ? u(new Date(x)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
|
|
2313
|
+
let m = "", y = "";
|
|
2314
2314
|
const E = p?.operator === "blank";
|
|
2315
|
-
p?.operator === "between" ? (m = h(p.value) || "",
|
|
2315
|
+
p?.operator === "between" ? (m = h(p.value) || "", y = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? m = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (y = h(p.value) || "");
|
|
2316
2316
|
const P = document.createElement("div");
|
|
2317
2317
|
P.className = "tbw-filter-date-range";
|
|
2318
2318
|
const D = document.createElement("div");
|
|
@@ -2328,15 +2328,15 @@ class z extends F {
|
|
|
2328
2328
|
const R = document.createElement("label");
|
|
2329
2329
|
R.textContent = "To", R.className = "tbw-filter-range-label";
|
|
2330
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 =
|
|
2331
|
+
T.type = "date", T.className = "tbw-filter-date-input", f && (T.min = f), g && (T.max = g), T.value = y, 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");
|
|
2335
2335
|
v.type = "checkbox", v.className = "tbw-filter-blank-checkbox", v.checked = E;
|
|
2336
2336
|
const C = document.createTextNode("Show only blank");
|
|
2337
2337
|
N.appendChild(v), N.appendChild(C);
|
|
2338
|
-
const L = (
|
|
2339
|
-
b.disabled =
|
|
2338
|
+
const L = (x) => {
|
|
2339
|
+
b.disabled = x, T.disabled = x, P.classList.toggle("tbw-filter-disabled", x);
|
|
2340
2340
|
};
|
|
2341
2341
|
L(E), v.addEventListener("change", () => {
|
|
2342
2342
|
L(v.checked);
|
|
@@ -2349,8 +2349,8 @@ class z extends F {
|
|
|
2349
2349
|
t.applyTextFilter("blank", "");
|
|
2350
2350
|
return;
|
|
2351
2351
|
}
|
|
2352
|
-
const
|
|
2353
|
-
|
|
2352
|
+
const x = b.value, A = T.value;
|
|
2353
|
+
x && A ? t.applyTextFilter("between", x, A) : x ? t.applyTextFilter("greaterThanOrEqual", x) : A ? t.applyTextFilter("lessThanOrEqual", A) : t.clearFilter();
|
|
2354
2354
|
}), S.appendChild(k);
|
|
2355
2355
|
const M = document.createElement("button");
|
|
2356
2356
|
M.className = "tbw-filter-clear-btn", M.textContent = "Clear Filter", M.addEventListener("click", () => {
|
|
@@ -3214,7 +3214,14 @@ class ut extends F {
|
|
|
3214
3214
|
}
|
|
3215
3215
|
for (const [c, u] of this.detailElements) {
|
|
3216
3216
|
const h = this.rows.indexOf(c), f = this.expandedRows.has(c), g = h >= 0 && d.has(h);
|
|
3217
|
-
(!f || !g)
|
|
3217
|
+
if (!f || !g) {
|
|
3218
|
+
const p = this.grid.__frameworkAdapter;
|
|
3219
|
+
if (p?.unmount) {
|
|
3220
|
+
const y = u.querySelector(".master-detail-cell")?.firstElementChild;
|
|
3221
|
+
y && p.unmount(y);
|
|
3222
|
+
}
|
|
3223
|
+
u.parentNode && u.remove(), this.detailElements.delete(c);
|
|
3224
|
+
}
|
|
3218
3225
|
}
|
|
3219
3226
|
for (const [c, u] of d) {
|
|
3220
3227
|
const h = this.rows[c];
|
|
@@ -3956,8 +3963,8 @@ function pt(a, e, t, i, n, r, o) {
|
|
|
3956
3963
|
const l = e[0], d = e.slice(1), c = d.length > 0, u = Ni(a, l);
|
|
3957
3964
|
for (const [h, f] of u) {
|
|
3958
3965
|
const g = o ? `${o}|${h}` : h, p = Qe(f, t, i, n), m = Ze(p);
|
|
3959
|
-
let
|
|
3960
|
-
c && (
|
|
3966
|
+
let y;
|
|
3967
|
+
c && (y = pt(
|
|
3961
3968
|
f,
|
|
3962
3969
|
d,
|
|
3963
3970
|
t,
|
|
@@ -3972,7 +3979,7 @@ function pt(a, e, t, i, n, r, o) {
|
|
|
3972
3979
|
values: p,
|
|
3973
3980
|
total: m,
|
|
3974
3981
|
isGroup: c,
|
|
3975
|
-
children:
|
|
3982
|
+
children: y,
|
|
3976
3983
|
rowCount: f.length
|
|
3977
3984
|
});
|
|
3978
3985
|
}
|
|
@@ -6287,13 +6294,13 @@ class $n extends F {
|
|
|
6287
6294
|
const E = document.createElement("span");
|
|
6288
6295
|
E.className = "tree-spacer", m.appendChild(E);
|
|
6289
6296
|
}
|
|
6290
|
-
const
|
|
6291
|
-
if (
|
|
6297
|
+
const y = document.createElement("span");
|
|
6298
|
+
if (y.className = "tree-content", n) {
|
|
6292
6299
|
const E = n(d);
|
|
6293
|
-
E instanceof Node ?
|
|
6300
|
+
E instanceof Node ? y.appendChild(E) : typeof E == "string" && (y.innerHTML = E);
|
|
6294
6301
|
} else
|
|
6295
|
-
|
|
6296
|
-
return m.appendChild(
|
|
6302
|
+
y.textContent = u != null ? String(u) : "";
|
|
6303
|
+
return m.appendChild(y), m;
|
|
6297
6304
|
};
|
|
6298
6305
|
return t[0] = { ...i, viewRenderer: l }, t;
|
|
6299
6306
|
}
|