@toolbox-web/grid 1.3.0 → 1.4.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.d.ts +1 -0
- package/all.d.ts.map +1 -1
- package/all.js +997 -710
- package/all.js.map +1 -1
- package/index.js +642 -599
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts +7 -0
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/types.d.ts +151 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +19 -16
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +42 -39
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +25 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +53 -48
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +23 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +186 -150
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +21 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +67 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +52 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +18 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +25 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +26 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +50 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts +98 -0
- package/lib/plugins/print/PrintPlugin.d.ts.map +1 -0
- package/lib/plugins/print/index.d.ts +10 -0
- package/lib/plugins/print/index.d.ts.map +1 -0
- package/lib/plugins/print/index.js +626 -0
- package/lib/plugins/print/index.js.map +1 -0
- package/lib/plugins/print/print-isolated.d.ts +26 -0
- package/lib/plugins/print/print-isolated.d.ts.map +1 -0
- package/lib/plugins/print/types.d.ts +147 -0
- package/lib/plugins/print/types.d.ts.map +1 -0
- package/lib/plugins/reorder/index.js +25 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +20 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +39 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +115 -101
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +35 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +26 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +23 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +22 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +98 -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/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/print.umd.js +76 -0
- package/umd/plugins/print.umd.js.map +1 -0
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditingPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/editing/EditingPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACtG,OAAO,KAAK,EACV,YAAY,EAIZ,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAA4C,aAAa,EAAkC,MAAM,SAAS,CAAC;AAMvH;;GAEG;AACH,eAAO,MAAM,yBAAyB,8GACiE,CAAC;AAwDxG;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAElE;AAWD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAGjE;AA4DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,qBAAa,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,cAAc,CAAC,aAAa,CAAC;;IAC3E;;;OAGG;IACH,gBAAyB,QAAQ,EAAE,cAAc,CAmB/C;IAEF,gBAAgB;IAChB,QAAQ,CAAC,IAAI,aAAa;IAC1B,gBAAgB;IAChB,SAAkB,MAAM,SAAU;IAElC,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,CAI7D;IA0BD,gBAAgB;IACP,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"EditingPlugin.d.ts","sourceRoot":"","sources":["../../../../../../libs/grid/src/lib/plugins/editing/EditingPlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACtG,OAAO,KAAK,EACV,YAAY,EAIZ,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAA4C,aAAa,EAAkC,MAAM,SAAS,CAAC;AAMvH;;GAEG;AACH,eAAO,MAAM,yBAAyB,8GACiE,CAAC;AAwDxG;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAElE;AAWD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAGjE;AA4DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AACH,qBAAa,aAAa,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,cAAc,CAAC,aAAa,CAAC;;IAC3E;;;OAGG;IACH,gBAAyB,QAAQ,EAAE,cAAc,CAmB/C;IAEF,gBAAgB;IAChB,QAAQ,CAAC,IAAI,aAAa;IAC1B,gBAAgB;IAChB,SAAkB,MAAM,SAAU;IAElC,gBAAgB;IAChB,cAAuB,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,CAI7D;IA0BD,gBAAgB;IACP,MAAM,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAmExC,gBAAgB;IACP,MAAM,IAAI,IAAI;IAavB;;;;;OAKG;IACM,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,GAAG,IAAI;IA2B3D;;;OAGG;IACM,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,IAAI;IA0GxD;;;;OAIG;IACM,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,EAAE;IAsCtE;;;;;OAKG;IACM,WAAW,IAAI,IAAI;IAgC5B;;;OAGG;IACM,cAAc,IAAI,IAAI;IAQ/B;;;OAGG;IACH,IAAI,WAAW,IAAI,CAAC,EAAE,CAOrB;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,EAAE,CAE5B;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIvC;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI1D;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAYvC;;;OAGG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;OAIG;IACH,gBAAgB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAexC;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAepD;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IA2CrC;;;OAGG;IACH,mBAAmB,IAAI,IAAI;IAM3B;;OAEG;IACH,mBAAmB,IAAI,IAAI;CAqd5B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const R = "data-animating",
|
|
1
|
+
const R = "data-animating", A = {
|
|
2
2
|
change: "--tbw-row-change-duration",
|
|
3
3
|
insert: "--tbw-row-insert-duration",
|
|
4
4
|
remove: "--tbw-row-remove-duration"
|
|
5
|
-
},
|
|
5
|
+
}, T = {
|
|
6
6
|
change: 500,
|
|
7
7
|
insert: 300,
|
|
8
8
|
remove: 200
|
|
@@ -11,23 +11,23 @@ function P(s) {
|
|
|
11
11
|
const e = s.trim().toLowerCase();
|
|
12
12
|
return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const i =
|
|
14
|
+
function I(s, e) {
|
|
15
|
+
const i = A[e], t = getComputedStyle(s).getPropertyValue(i);
|
|
16
16
|
if (t) {
|
|
17
17
|
const r = P(t);
|
|
18
18
|
if (!isNaN(r) && r > 0)
|
|
19
19
|
return r;
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return T[e];
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function D(s, e, i) {
|
|
24
24
|
s.removeAttribute(R), s.offsetWidth, s.setAttribute(R, e);
|
|
25
|
-
const t =
|
|
25
|
+
const t = I(s, e);
|
|
26
26
|
setTimeout(() => {
|
|
27
27
|
s.removeAttribute(R);
|
|
28
28
|
}, t);
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const L = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', q = {
|
|
31
31
|
expand: "▶",
|
|
32
32
|
collapse: "▼",
|
|
33
33
|
sortAsc: "▲",
|
|
@@ -35,9 +35,12 @@ const D = {
|
|
|
35
35
|
sortNone: "⇅",
|
|
36
36
|
submenuArrow: "▶",
|
|
37
37
|
dragHandle: "⋮⋮",
|
|
38
|
-
toolPanel: "☰"
|
|
38
|
+
toolPanel: "☰",
|
|
39
|
+
filter: L,
|
|
40
|
+
filterActive: L,
|
|
41
|
+
print: "🖨️"
|
|
39
42
|
};
|
|
40
|
-
class
|
|
43
|
+
class O {
|
|
41
44
|
/**
|
|
42
45
|
* Plugin dependencies - declare other plugins this one requires.
|
|
43
46
|
*
|
|
@@ -261,7 +264,7 @@ class q {
|
|
|
261
264
|
*/
|
|
262
265
|
get gridIcons() {
|
|
263
266
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
264
|
-
return { ...
|
|
267
|
+
return { ...q, ...e };
|
|
265
268
|
}
|
|
266
269
|
// #region Animation Helpers
|
|
267
270
|
/**
|
|
@@ -337,8 +340,8 @@ class q {
|
|
|
337
340
|
}
|
|
338
341
|
// #endregion
|
|
339
342
|
}
|
|
340
|
-
const
|
|
341
|
-
function
|
|
343
|
+
const N = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px}tbw-grid .data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}tbw-grid .data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}tbw-grid .data-grid-row>.cell.editing input:not([type=checkbox]),tbw-grid .data-grid-row>.cell.editing select,tbw-grid .data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}tbw-grid .tbw-editor-host{display:contents}}";
|
|
344
|
+
function M(s) {
|
|
342
345
|
const e = s.options;
|
|
343
346
|
return e ? typeof e == "function" ? e() : e : [];
|
|
344
347
|
}
|
|
@@ -352,7 +355,7 @@ function H(s) {
|
|
|
352
355
|
}), t;
|
|
353
356
|
};
|
|
354
357
|
}
|
|
355
|
-
function
|
|
358
|
+
function x() {
|
|
356
359
|
return (s) => {
|
|
357
360
|
const e = document.createElement("input");
|
|
358
361
|
return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
|
|
@@ -366,14 +369,14 @@ function G(s) {
|
|
|
366
369
|
}), t;
|
|
367
370
|
};
|
|
368
371
|
}
|
|
369
|
-
function
|
|
372
|
+
function $(s) {
|
|
370
373
|
return (e) => {
|
|
371
374
|
const i = s.editorParams, t = document.createElement("select");
|
|
372
375
|
if (s.multi && (t.multiple = !0), i?.includeEmpty) {
|
|
373
376
|
const o = document.createElement("option");
|
|
374
377
|
o.value = "", o.textContent = i.emptyLabel ?? "", t.appendChild(o);
|
|
375
378
|
}
|
|
376
|
-
|
|
379
|
+
M(s).forEach((o) => {
|
|
377
380
|
const a = document.createElement("option");
|
|
378
381
|
a.value = String(o.value), a.textContent = o.label, (s.multi && Array.isArray(e.value) && e.value.includes(o.value) || !s.multi && e.value === o.value) && (a.selected = !0), t.appendChild(a);
|
|
379
382
|
});
|
|
@@ -389,7 +392,7 @@ function x(s) {
|
|
|
389
392
|
}), t;
|
|
390
393
|
};
|
|
391
394
|
}
|
|
392
|
-
function
|
|
395
|
+
function F(s) {
|
|
393
396
|
return (e) => {
|
|
394
397
|
const i = s.editorParams, t = document.createElement("input");
|
|
395
398
|
return t.type = "text", t.value = e.value != null ? String(e.value) : "", i?.maxLength !== void 0 && (t.maxLength = i.maxLength), i?.pattern && (t.pattern = i.pattern), i?.placeholder && (t.placeholder = i.placeholder), t.addEventListener("blur", () => e.commit(t.value)), t.addEventListener("keydown", (r) => {
|
|
@@ -397,18 +400,18 @@ function $(s) {
|
|
|
397
400
|
}), t;
|
|
398
401
|
};
|
|
399
402
|
}
|
|
400
|
-
function
|
|
403
|
+
function z(s) {
|
|
401
404
|
switch (s.type) {
|
|
402
405
|
case "number":
|
|
403
406
|
return H(s);
|
|
404
407
|
case "boolean":
|
|
405
|
-
return
|
|
408
|
+
return x();
|
|
406
409
|
case "date":
|
|
407
410
|
return G(s);
|
|
408
411
|
case "select":
|
|
409
|
-
return x(s);
|
|
410
|
-
default:
|
|
411
412
|
return $(s);
|
|
413
|
+
default:
|
|
414
|
+
return F(s);
|
|
412
415
|
}
|
|
413
416
|
}
|
|
414
417
|
const _ = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
@@ -426,28 +429,28 @@ function B(s, e) {
|
|
|
426
429
|
return n.editor;
|
|
427
430
|
}
|
|
428
431
|
}
|
|
429
|
-
function
|
|
432
|
+
function v(s) {
|
|
430
433
|
return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
|
|
431
434
|
}
|
|
432
|
-
function
|
|
435
|
+
function U(s) {
|
|
433
436
|
const e = (s.__editingCellCount ?? 0) + 1;
|
|
434
437
|
s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
|
|
435
438
|
}
|
|
436
|
-
function
|
|
439
|
+
function j(s) {
|
|
437
440
|
s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
|
|
438
441
|
}
|
|
439
|
-
function
|
|
442
|
+
function E(s, e) {
|
|
440
443
|
return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? s.valueAsDate : s.value : e?.type === "number" && s.value !== "" ? Number(s.value) : s.value;
|
|
441
444
|
}
|
|
442
|
-
function
|
|
445
|
+
function k(s) {
|
|
443
446
|
}
|
|
444
|
-
function
|
|
447
|
+
function V(s, e, i) {
|
|
445
448
|
const t = s.querySelector("input,textarea,select");
|
|
446
449
|
t && (t.addEventListener("blur", () => {
|
|
447
|
-
i(
|
|
448
|
-
}), t instanceof HTMLInputElement && t.type === "checkbox" ? t.addEventListener("change", () => i(t.checked)) : t instanceof HTMLSelectElement && t.addEventListener("change", () => i(
|
|
450
|
+
i(E(t, e));
|
|
451
|
+
}), t instanceof HTMLInputElement && t.type === "checkbox" ? t.addEventListener("change", () => i(t.checked)) : t instanceof HTMLSelectElement && t.addEventListener("change", () => i(E(t, e))));
|
|
449
452
|
}
|
|
450
|
-
class
|
|
453
|
+
class W extends O {
|
|
451
454
|
/**
|
|
452
455
|
* Plugin manifest - declares owned properties for configuration validation.
|
|
453
456
|
* @internal
|
|
@@ -475,7 +478,7 @@ class V extends q {
|
|
|
475
478
|
/** @internal */
|
|
476
479
|
name = "editing";
|
|
477
480
|
/** @internal */
|
|
478
|
-
styles =
|
|
481
|
+
styles = N;
|
|
479
482
|
/** @internal */
|
|
480
483
|
get defaultConfig() {
|
|
481
484
|
return {
|
|
@@ -520,7 +523,9 @@ class V extends q {
|
|
|
520
523
|
(r) => {
|
|
521
524
|
if (this.#e === -1) return;
|
|
522
525
|
const n = t.findRenderedRowElement?.(this.#e);
|
|
523
|
-
!n || (r.composedPath && r.composedPath() || []).includes(n) ||
|
|
526
|
+
!n || (r.composedPath && r.composedPath() || []).includes(n) || queueMicrotask(() => {
|
|
527
|
+
this.#e !== -1 && this.#i(this.#e, !1);
|
|
528
|
+
});
|
|
524
529
|
},
|
|
525
530
|
{ signal: i }
|
|
526
531
|
);
|
|
@@ -559,7 +564,7 @@ class V extends q {
|
|
|
559
564
|
const n = i._visibleColumns[r], o = i._rows[t];
|
|
560
565
|
if (n?.editable && n.type === "boolean" && o) {
|
|
561
566
|
const a = n.field;
|
|
562
|
-
if (
|
|
567
|
+
if (v(a)) {
|
|
563
568
|
const c = !o[a];
|
|
564
569
|
return this.#l(t, n, c, o), e.preventDefault(), this.requestRender(), !0;
|
|
565
570
|
}
|
|
@@ -816,7 +821,7 @@ class V extends q {
|
|
|
816
821
|
if (!g) return;
|
|
817
822
|
const d = c.querySelector("input,textarea,select");
|
|
818
823
|
if (d) {
|
|
819
|
-
const h =
|
|
824
|
+
const h = E(d, g);
|
|
820
825
|
n[g.field] !== h && this.#l(e, g, h, n);
|
|
821
826
|
}
|
|
822
827
|
}), i && r && n)
|
|
@@ -838,7 +843,7 @@ class V extends q {
|
|
|
838
843
|
for (const l of this.#n)
|
|
839
844
|
l.startsWith(`${e}:`) && this.#n.delete(l);
|
|
840
845
|
o && (o.querySelectorAll(".cell.editing").forEach((l) => {
|
|
841
|
-
l.classList.remove("editing"),
|
|
846
|
+
l.classList.remove("editing"), j(l.parentElement);
|
|
842
847
|
}), this.requestRender()), this.#o = !0, o || (this.#u(t), this.#o = !1);
|
|
843
848
|
}
|
|
844
849
|
/**
|
|
@@ -847,7 +852,7 @@ class V extends q {
|
|
|
847
852
|
*/
|
|
848
853
|
#l(e, i, t, r) {
|
|
849
854
|
const n = i.field;
|
|
850
|
-
if (!
|
|
855
|
+
if (!v(n)) return;
|
|
851
856
|
const o = r[n];
|
|
852
857
|
if (o === t) return;
|
|
853
858
|
const a = this.grid;
|
|
@@ -856,7 +861,7 @@ class V extends q {
|
|
|
856
861
|
l = this.grid.getRowId(r);
|
|
857
862
|
} catch {
|
|
858
863
|
}
|
|
859
|
-
const c = l ? !this.#t.has(l) : !0, f = l ? (h) => this.grid.updateRow(l, h, "cascade") :
|
|
864
|
+
const c = l ? !this.#t.has(l) : !0, f = l ? (h) => this.grid.updateRow(l, h, "cascade") : k;
|
|
860
865
|
if (this.emitCancelable("cell-commit", {
|
|
861
866
|
row: r,
|
|
862
867
|
rowId: l ?? "",
|
|
@@ -871,7 +876,7 @@ class V extends q {
|
|
|
871
876
|
})) return;
|
|
872
877
|
r[n] = t, l && this.#t.add(l), this.#a();
|
|
873
878
|
const d = a.findRenderedRowElement?.(e);
|
|
874
|
-
d && (d.classList.add("changed"),
|
|
879
|
+
d && (d.classList.add("changed"), D(d, "change"));
|
|
875
880
|
}
|
|
876
881
|
/**
|
|
877
882
|
* Inject an editor into a cell.
|
|
@@ -883,20 +888,20 @@ class V extends q {
|
|
|
883
888
|
a = this.grid.getRowId(e);
|
|
884
889
|
} catch {
|
|
885
890
|
}
|
|
886
|
-
const l = a ? (u) => this.grid.updateRow(a, u, "cascade") :
|
|
891
|
+
const l = a ? (u) => this.grid.updateRow(a, u, "cascade") : k, c = v(t.field) ? e[t.field] : void 0;
|
|
887
892
|
n.classList.add("editing"), this.#n.add(`${i}:${r}`);
|
|
888
893
|
const f = n.parentElement;
|
|
889
|
-
f &&
|
|
894
|
+
f && U(f);
|
|
890
895
|
let g = !1;
|
|
891
896
|
const d = (u) => {
|
|
892
897
|
g || this.#e === -1 || this.#l(i, t, u, e);
|
|
893
898
|
}, h = () => {
|
|
894
|
-
g = !0,
|
|
899
|
+
g = !0, v(t.field) && (e[t.field] = c);
|
|
895
900
|
}, p = document.createElement("div");
|
|
896
901
|
p.className = "tbw-editor-host", n.innerHTML = "", n.appendChild(p), p.addEventListener("keydown", (u) => {
|
|
897
902
|
u.key === "Enter" && (u.stopPropagation(), u.preventDefault(), g = !0, this.#i(i, !1)), u.key === "Escape" && (u.stopPropagation(), u.preventDefault(), h(), this.#i(i, !0));
|
|
898
903
|
});
|
|
899
|
-
const m = t, y = m.__editorTemplate, b = B(this.grid, m) ??
|
|
904
|
+
const m = t, y = m.__editorTemplate, b = B(this.grid, m) ?? z(t), C = c;
|
|
900
905
|
if (b === "template" && y)
|
|
901
906
|
this.#h(p, m, e, c, d, h, o, i);
|
|
902
907
|
else if (typeof b == "string") {
|
|
@@ -915,7 +920,7 @@ class V extends q {
|
|
|
915
920
|
cancel: h,
|
|
916
921
|
updateRow: l
|
|
917
922
|
}, w = b(u);
|
|
918
|
-
typeof w == "string" ? (p.innerHTML = w,
|
|
923
|
+
typeof w == "string" ? (p.innerHTML = w, V(p, t, d)) : w instanceof Node && p.appendChild(w), o || queueMicrotask(() => {
|
|
919
924
|
p.querySelector(_)?.focus({ preventScroll: !0 });
|
|
920
925
|
});
|
|
921
926
|
} else if (b && typeof b == "object") {
|
|
@@ -959,7 +964,7 @@ class V extends q {
|
|
|
959
964
|
cancel: o
|
|
960
965
|
}) : f.querySelectorAll("*").forEach((h) => {
|
|
961
966
|
h.childNodes.length === 1 && h.firstChild?.nodeType === Node.TEXT_NODE && (h.textContent = h.textContent?.replace(/{{\s*value\s*}}/g, r == null ? "" : String(r)).replace(/{{\s*row\.([a-zA-Z0-9_]+)\s*}}/g, (p, m) => {
|
|
962
|
-
if (!
|
|
967
|
+
if (!v(m)) return "";
|
|
963
968
|
const y = t[m];
|
|
964
969
|
return y == null ? "" : String(y);
|
|
965
970
|
}) || "");
|
|
@@ -971,10 +976,10 @@ class V extends q {
|
|
|
971
976
|
d instanceof HTMLInputElement && d.type === "checkbox" ? d.checked = !!r : d.value = String(r ?? "");
|
|
972
977
|
let h = !1;
|
|
973
978
|
d.addEventListener("blur", () => {
|
|
974
|
-
h || n(
|
|
979
|
+
h || n(E(d, i));
|
|
975
980
|
}), d.addEventListener("keydown", (p) => {
|
|
976
981
|
const m = p;
|
|
977
|
-
m.key === "Enter" && (m.stopPropagation(), m.preventDefault(), h = !0, n(
|
|
982
|
+
m.key === "Enter" && (m.stopPropagation(), m.preventDefault(), h = !0, n(E(d, i)), this.#i(l, !1)), m.key === "Escape" && (m.stopPropagation(), m.preventDefault(), o(), this.#i(l, !0));
|
|
978
983
|
}), d instanceof HTMLInputElement && d.type === "checkbox" && d.addEventListener("change", () => n(d.checked)), a || setTimeout(() => d.focus({ preventScroll: !0 }), 0);
|
|
979
984
|
}
|
|
980
985
|
e.appendChild(f);
|
|
@@ -1000,7 +1005,7 @@ class V extends q {
|
|
|
1000
1005
|
// #endregion
|
|
1001
1006
|
}
|
|
1002
1007
|
export {
|
|
1003
|
-
|
|
1004
|
-
|
|
1008
|
+
W as EditingPlugin,
|
|
1009
|
+
z as defaultEditorFor
|
|
1005
1010
|
};
|
|
1006
1011
|
//# sourceMappingURL=index.js.map
|