@toolbox-web/grid-angular 0.7.0 → 0.7.2
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/fesm2022/toolbox-web-grid-angular-features-clipboard.mjs +30 -0
- package/fesm2022/toolbox-web-grid-angular-features-clipboard.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-column-virtualization.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-column-virtualization.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-context-menu.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-context-menu.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-editing.mjs +33 -0
- package/fesm2022/toolbox-web-grid-angular-features-editing.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-export.mjs +29 -0
- package/fesm2022/toolbox-web-grid-angular-features-export.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs +29 -0
- package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-grouping-columns.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-grouping-columns.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-grouping-rows.mjs +25 -0
- package/fesm2022/toolbox-web-grid-angular-features-grouping-rows.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-master-detail.mjs +25 -0
- package/fesm2022/toolbox-web-grid-angular-features-master-detail.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-multi-sort.mjs +40 -0
- package/fesm2022/toolbox-web-grid-angular-features-multi-sort.mjs.map +1 -0
- package/{features/pinned-columns.d.ts → fesm2022/toolbox-web-grid-angular-features-pinned-columns.mjs} +11 -2
- package/fesm2022/toolbox-web-grid-angular-features-pinned-columns.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-pinned-rows.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-pinned-rows.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-pivot.mjs +25 -0
- package/fesm2022/toolbox-web-grid-angular-features-pivot.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-print.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-print.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-reorder.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-reorder.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-responsive.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-responsive.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-row-reorder.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-row-reorder.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-selection.mjs +30 -0
- package/fesm2022/toolbox-web-grid-angular-features-selection.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-server-side.mjs +25 -0
- package/fesm2022/toolbox-web-grid-angular-features-server-side.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-sorting.mjs +25 -0
- package/fesm2022/toolbox-web-grid-angular-features-sorting.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-tree.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-tree.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs +30 -0
- package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular-features-visibility.mjs +28 -0
- package/fesm2022/toolbox-web-grid-angular-features-visibility.mjs.map +1 -0
- package/fesm2022/toolbox-web-grid-angular.mjs +3189 -0
- package/fesm2022/toolbox-web-grid-angular.mjs.map +1 -0
- package/package.json +109 -35
- package/types/toolbox-web-grid-angular-features-clipboard.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-clipboard.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-column-virtualization.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-column-virtualization.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-context-menu.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-context-menu.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-editing.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-editing.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-export.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-export.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-filtering.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-filtering.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-grouping-columns.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-grouping-columns.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-grouping-rows.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-grouping-rows.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-master-detail.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-master-detail.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-multi-sort.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-multi-sort.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-pinned-columns.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-pinned-columns.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-pinned-rows.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-pinned-rows.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-pivot.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-pivot.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-print.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-print.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-reorder.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-reorder.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-responsive.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-responsive.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-row-reorder.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-row-reorder.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-selection.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-selection.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-server-side.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-server-side.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-sorting.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-sorting.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-tree.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-tree.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-undo-redo.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-undo-redo.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular-features-visibility.d.ts +3 -0
- package/types/toolbox-web-grid-angular-features-visibility.d.ts.map +1 -0
- package/types/toolbox-web-grid-angular.d.ts +2325 -0
- package/types/toolbox-web-grid-angular.d.ts.map +1 -0
- package/feature-registry-C-cKloXB.js +0 -45
- package/features/clipboard.d.ts +0 -18
- package/features/clipboard.d.ts.map +0 -1
- package/features/clipboard.js +0 -3
- package/features/column-virtualization.d.ts +0 -16
- package/features/column-virtualization.d.ts.map +0 -1
- package/features/column-virtualization.js +0 -3
- package/features/context-menu.d.ts +0 -16
- package/features/context-menu.d.ts.map +0 -1
- package/features/context-menu.js +0 -3
- package/features/editing.d.ts +0 -16
- package/features/editing.d.ts.map +0 -1
- package/features/editing.js +0 -3
- package/features/export.d.ts +0 -17
- package/features/export.d.ts.map +0 -1
- package/features/export.js +0 -3
- package/features/filtering.d.ts +0 -17
- package/features/filtering.d.ts.map +0 -1
- package/features/filtering.js +0 -3
- package/features/grouping-columns.d.ts +0 -16
- package/features/grouping-columns.d.ts.map +0 -1
- package/features/grouping-columns.js +0 -3
- package/features/grouping-rows.d.ts +0 -16
- package/features/grouping-rows.d.ts.map +0 -1
- package/features/grouping-rows.js +0 -3
- package/features/index.d.ts +0 -1
- package/features/index.d.ts.map +0 -1
- package/features/index.js +0 -22
- package/features/master-detail.d.ts +0 -16
- package/features/master-detail.d.ts.map +0 -1
- package/features/master-detail.js +0 -3
- package/features/multi-sort.d.ts +0 -22
- package/features/multi-sort.d.ts.map +0 -1
- package/features/pinned-columns.d.ts.map +0 -1
- package/features/pinned-columns.js +0 -3
- package/features/pinned-rows.d.ts +0 -16
- package/features/pinned-rows.d.ts.map +0 -1
- package/features/pinned-rows.js +0 -3
- package/features/pivot.d.ts +0 -16
- package/features/pivot.d.ts.map +0 -1
- package/features/pivot.js +0 -3
- package/features/print.d.ts +0 -16
- package/features/print.d.ts.map +0 -1
- package/features/print.js +0 -3
- package/features/reorder.d.ts +0 -16
- package/features/reorder.d.ts.map +0 -1
- package/features/reorder.js +0 -3
- package/features/responsive.d.ts +0 -16
- package/features/responsive.d.ts.map +0 -1
- package/features/responsive.js +0 -3
- package/features/row-reorder.d.ts +0 -16
- package/features/row-reorder.d.ts.map +0 -1
- package/features/row-reorder.js +0 -3
- package/features/selection.d.ts +0 -16
- package/features/selection.d.ts.map +0 -1
- package/features/selection.js +0 -3
- package/features/server-side.d.ts +0 -16
- package/features/server-side.d.ts.map +0 -1
- package/features/server-side.js +0 -3
- package/features/sorting.d.ts +0 -1
- package/features/sorting.d.ts.map +0 -1
- package/features/sorting.js +0 -1
- package/features/tree.d.ts +0 -16
- package/features/tree.d.ts.map +0 -1
- package/features/tree.js +0 -3
- package/features/undo-redo.d.ts +0 -18
- package/features/undo-redo.d.ts.map +0 -1
- package/features/undo-redo.js +0 -3
- package/features/visibility.d.ts +0 -16
- package/features/visibility.d.ts.map +0 -1
- package/features/visibility.js +0 -3
- package/index.d.ts +0 -34
- package/index.d.ts.map +0 -1
- package/index.js +0 -1916
- package/lib/angular-column-config.d.ts +0 -140
- package/lib/angular-column-config.d.ts.map +0 -1
- package/lib/angular-grid-adapter.d.ts +0 -220
- package/lib/angular-grid-adapter.d.ts.map +0 -1
- package/lib/base-grid-editor.d.ts +0 -145
- package/lib/base-grid-editor.d.ts.map +0 -1
- package/lib/component-registry.d.ts +0 -63
- package/lib/component-registry.d.ts.map +0 -1
- package/lib/directives/grid-column-editor.directive.d.ts +0 -113
- package/lib/directives/grid-column-editor.directive.d.ts.map +0 -1
- package/lib/directives/grid-column-view.directive.d.ts +0 -69
- package/lib/directives/grid-column-view.directive.d.ts.map +0 -1
- package/lib/directives/grid-detail-view.directive.d.ts +0 -75
- package/lib/directives/grid-detail-view.directive.d.ts.map +0 -1
- package/lib/directives/grid-form-array.directive.d.ts +0 -141
- package/lib/directives/grid-form-array.directive.d.ts.map +0 -1
- package/lib/directives/grid-responsive-card.directive.d.ts +0 -92
- package/lib/directives/grid-responsive-card.directive.d.ts.map +0 -1
- package/lib/directives/grid-tool-panel.directive.d.ts +0 -91
- package/lib/directives/grid-tool-panel.directive.d.ts.map +0 -1
- package/lib/directives/grid.directive.d.ts +0 -808
- package/lib/directives/grid.directive.d.ts.map +0 -1
- package/lib/directives/index.d.ts +0 -9
- package/lib/directives/index.d.ts.map +0 -1
- package/lib/directives/structural-directives.d.ts +0 -174
- package/lib/directives/structural-directives.d.ts.map +0 -1
- package/lib/feature-registry.d.ts +0 -72
- package/lib/feature-registry.d.ts.map +0 -1
- package/lib/grid-type-registry.d.ts +0 -110
- package/lib/grid-type-registry.d.ts.map +0 -1
- package/lib/inject-grid.d.ts +0 -109
- package/lib/inject-grid.d.ts.map +0 -1
- package/lib/interfaces/grid-cell-editor.d.ts +0 -85
- package/lib/interfaces/grid-cell-editor.d.ts.map +0 -1
- package/lib/interfaces/grid-cell-renderer.d.ts +0 -63
- package/lib/interfaces/grid-cell-renderer.d.ts.map +0 -1
- package/lib/interfaces/index.d.ts +0 -5
- package/lib/interfaces/index.d.ts.map +0 -1
- package/multi-sort-DPbW58yz.js +0 -3
package/index.js
DELETED
|
@@ -1,1916 +0,0 @@
|
|
|
1
|
-
var _e = Object.create;
|
|
2
|
-
var N = Object.defineProperty;
|
|
3
|
-
var $e = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var pe = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), j = (i) => {
|
|
5
|
-
throw TypeError(i);
|
|
6
|
-
};
|
|
7
|
-
var ze = (i, e, t) => e in i ? N(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
8
|
-
var ue = (i, e) => N(i, "name", { value: e, configurable: !0 });
|
|
9
|
-
var y = (i) => [, , , _e(i?.[pe("metadata")] ?? null)], fe = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], O = (i) => i !== void 0 && typeof i != "function" ? j("Function expected") : i, Be = (i, e, t, n, r) => ({ kind: fe[i], name: e, metadata: n, addInitializer: (o) => t._ ? j("Already initialized") : r.push(O(o || null)) }), Ue = (i, e) => ze(e, pe("metadata"), i[3]), b = (i, e, t, n) => {
|
|
10
|
-
for (var r = 0, o = i[e >> 1], s = o && o.length; r < s; r++) e & 1 ? o[r].call(t) : n = o[r].call(t, n);
|
|
11
|
-
return n;
|
|
12
|
-
}, T = (i, e, t, n, r, o) => {
|
|
13
|
-
var s, l, f, g, E, a = e & 7, R = !!(e & 8), h = !!(e & 16), S = a > 3 ? i.length + 1 : a ? R ? 1 : 2 : 0, M = fe[a + 5], u = a > 3 && (i[S - 1] = []), m = i[S] || (i[S] = []), d = a && (!h && !R && (r = r.prototype), a < 5 && (a > 3 || !h) && $e(a < 4 ? r : { get [t]() {
|
|
14
|
-
return me(this, o);
|
|
15
|
-
}, set [t](v) {
|
|
16
|
-
return de(this, o, v);
|
|
17
|
-
} }, t));
|
|
18
|
-
a ? h && a < 4 && ue(o, (a > 2 ? "set " : a > 1 ? "get " : "") + t) : ue(r, t);
|
|
19
|
-
for (var C = n.length - 1; C >= 0; C--)
|
|
20
|
-
g = Be(a, t, f = {}, i[3], m), a && (g.static = R, g.private = h, E = g.access = { has: h ? (v) => Je(r, v) : (v) => t in v }, a ^ 3 && (E.get = h ? (v) => (a ^ 1 ? me : We)(v, r, a ^ 4 ? o : d.get) : (v) => v[t]), a > 2 && (E.set = h ? (v, L) => de(v, r, L, a ^ 4 ? o : d.set) : (v, L) => v[t] = L)), l = (0, n[C])(a ? a < 4 ? h ? o : d[M] : a > 4 ? void 0 : { get: d.get, set: d.set } : r, g), f._ = 1, a ^ 4 || l === void 0 ? O(l) && (a > 4 ? u.unshift(l) : a ? h ? o = l : d[M] = l : r = l) : typeof l != "object" || l === null ? j("Object expected") : (O(s = l.get) && (d.get = s), O(s = l.set) && (d.set = s), O(s = l.init) && u.unshift(s));
|
|
21
|
-
return a || Ue(i, r), d && N(r, t, d), h ? a ^ 4 ? o : d : r;
|
|
22
|
-
};
|
|
23
|
-
var V = (i, e, t) => e.has(i) || j("Cannot " + t), Je = (i, e) => Object(e) !== e ? j('Cannot use the "in" operator on this value') : i.has(e), me = (i, e, t) => (V(i, e, "read from private field"), t ? t.call(i) : e.get(i));
|
|
24
|
-
var de = (i, e, t, n) => (V(i, e, "write to private field"), n ? n.call(i, t) : e.set(i, t), t), We = (i, e, t) => (V(i, e, "access private method"), t);
|
|
25
|
-
import { inject as w, ElementRef as A, contentChild as k, TemplateRef as F, effect as D, Directive as x, input as c, InjectionToken as He, Injectable as Ye, makeEnvironmentProviders as Xe, EventEmitter as ge, createComponent as he, signal as G, afterNextRender as Ke, computed as P, output as p, EnvironmentInjector as Qe, ApplicationRef as Ze, ViewContainerRef as et } from "@angular/core";
|
|
26
|
-
import { FormGroup as ve } from "@angular/forms";
|
|
27
|
-
import { c as tt } from "./feature-registry-C-cKloXB.js";
|
|
28
|
-
import { a as wt, g as Rt, b as Ct, i as Et, r as yt } from "./feature-registry-C-cKloXB.js";
|
|
29
|
-
import { DataGridElement as nt } from "@toolbox-web/grid";
|
|
30
|
-
function we(i) {
|
|
31
|
-
if (typeof i != "function" || i.prototype === void 0)
|
|
32
|
-
return !1;
|
|
33
|
-
if (Object.prototype.hasOwnProperty.call(i, "ɵcmp") || Object.prototype.hasOwnProperty.call(i, "ɵfac"))
|
|
34
|
-
return !0;
|
|
35
|
-
const e = Function.prototype.toString.call(i);
|
|
36
|
-
return e.startsWith("class ") || e.startsWith("class{");
|
|
37
|
-
}
|
|
38
|
-
const Oe = /* @__PURE__ */ new Map();
|
|
39
|
-
function je(i) {
|
|
40
|
-
return Oe.get(i);
|
|
41
|
-
}
|
|
42
|
-
var ye, X;
|
|
43
|
-
ye = [x({ selector: "tbw-grid-column-editor" })];
|
|
44
|
-
class q {
|
|
45
|
-
elementRef = w(A);
|
|
46
|
-
/**
|
|
47
|
-
* Query for the ng-template content child.
|
|
48
|
-
*/
|
|
49
|
-
template = k(F);
|
|
50
|
-
/** Effect that triggers when the template is available */
|
|
51
|
-
onTemplateReceived = D(() => {
|
|
52
|
-
const e = this.template();
|
|
53
|
-
e && Oe.set(this.elementRef.nativeElement, e);
|
|
54
|
-
});
|
|
55
|
-
/**
|
|
56
|
-
* Static type guard for template context.
|
|
57
|
-
* Enables type inference in templates.
|
|
58
|
-
*/
|
|
59
|
-
static ngTemplateContextGuard(e, t) {
|
|
60
|
-
return !0;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
X = y(null), q = T(X, 0, "GridColumnEditor", ye, q), b(X, 1, q);
|
|
64
|
-
const ke = /* @__PURE__ */ new Map();
|
|
65
|
-
function Ie(i) {
|
|
66
|
-
return ke.get(i);
|
|
67
|
-
}
|
|
68
|
-
var be, K;
|
|
69
|
-
be = [x({ selector: "tbw-grid-column-view" })];
|
|
70
|
-
class _ {
|
|
71
|
-
elementRef = w(A);
|
|
72
|
-
/**
|
|
73
|
-
* Query for the ng-template content child.
|
|
74
|
-
*/
|
|
75
|
-
template = k(F);
|
|
76
|
-
/** Effect that triggers when the template is available */
|
|
77
|
-
onTemplateReceived = D(() => {
|
|
78
|
-
const e = this.template();
|
|
79
|
-
e && ke.set(this.elementRef.nativeElement, e);
|
|
80
|
-
});
|
|
81
|
-
/**
|
|
82
|
-
* Static type guard for template context.
|
|
83
|
-
* Enables type inference in templates.
|
|
84
|
-
*/
|
|
85
|
-
static ngTemplateContextGuard(e, t) {
|
|
86
|
-
return !0;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
K = y(null), _ = T(K, 0, "GridColumnView", be, _), b(K, 1, _);
|
|
90
|
-
const Ne = /* @__PURE__ */ new Map();
|
|
91
|
-
function Re(i) {
|
|
92
|
-
const e = i.querySelector("tbw-grid-detail");
|
|
93
|
-
if (e)
|
|
94
|
-
return Ne.get(e);
|
|
95
|
-
}
|
|
96
|
-
var Te, Q;
|
|
97
|
-
Te = [x({ selector: "tbw-grid-detail" })];
|
|
98
|
-
class $ {
|
|
99
|
-
elementRef = w(A);
|
|
100
|
-
/** Whether to show the expand/collapse column. Default: true */
|
|
101
|
-
showExpandColumn = c(!0);
|
|
102
|
-
/** Animation style for expand/collapse. Default: 'slide' */
|
|
103
|
-
animation = c("slide");
|
|
104
|
-
/**
|
|
105
|
-
* Query for the ng-template content child.
|
|
106
|
-
*/
|
|
107
|
-
template = k(F);
|
|
108
|
-
/** Effect that triggers when the template is available */
|
|
109
|
-
onTemplateReceived = D(() => {
|
|
110
|
-
const e = this.template();
|
|
111
|
-
e && Ne.set(this.elementRef.nativeElement, e);
|
|
112
|
-
});
|
|
113
|
-
/**
|
|
114
|
-
* Static type guard for template context.
|
|
115
|
-
* Enables type inference in templates.
|
|
116
|
-
*/
|
|
117
|
-
static ngTemplateContextGuard(e, t) {
|
|
118
|
-
return !0;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
Q = y(null), $ = T(Q, 0, "GridDetailView", Te, $), b(Q, 1, $);
|
|
122
|
-
const le = /* @__PURE__ */ Symbol("formArrayContext");
|
|
123
|
-
function rt(i) {
|
|
124
|
-
return i[le];
|
|
125
|
-
}
|
|
126
|
-
var Ae, Z;
|
|
127
|
-
Ae = [x({
|
|
128
|
-
selector: "tbw-grid[formArray]"
|
|
129
|
-
})];
|
|
130
|
-
class z {
|
|
131
|
-
elementRef = w(A);
|
|
132
|
-
cellCommitListener = null;
|
|
133
|
-
touchListener = null;
|
|
134
|
-
/**
|
|
135
|
-
* The FormArray to bind to the grid.
|
|
136
|
-
*/
|
|
137
|
-
formArray = c.required();
|
|
138
|
-
/**
|
|
139
|
-
* Effect that syncs the FormArray value to the grid rows.
|
|
140
|
-
*/
|
|
141
|
-
syncFormArrayToGrid = D(() => {
|
|
142
|
-
const e = this.formArray(), t = this.elementRef.nativeElement;
|
|
143
|
-
t && e && (t.rows = e.getRawValue());
|
|
144
|
-
});
|
|
145
|
-
ngOnInit() {
|
|
146
|
-
const e = this.elementRef.nativeElement;
|
|
147
|
-
e && (this.#n(e), this.cellCommitListener = (t) => {
|
|
148
|
-
const n = t.detail;
|
|
149
|
-
this.#i(n);
|
|
150
|
-
}, e.addEventListener("cell-commit", this.cellCommitListener), this.touchListener = () => {
|
|
151
|
-
this.formArray().markAsTouched(), this.touchListener && (e.removeEventListener("click", this.touchListener), this.touchListener = null);
|
|
152
|
-
}, e.addEventListener("click", this.touchListener));
|
|
153
|
-
}
|
|
154
|
-
ngOnDestroy() {
|
|
155
|
-
const e = this.elementRef.nativeElement;
|
|
156
|
-
e && (this.cellCommitListener && e.removeEventListener("cell-commit", this.cellCommitListener), this.touchListener && e.removeEventListener("click", this.touchListener), this.#r(e));
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Checks if the FormArray contains FormGroups.
|
|
160
|
-
*/
|
|
161
|
-
#t() {
|
|
162
|
-
const e = this.formArray();
|
|
163
|
-
return e.length === 0 ? !1 : e.at(0) instanceof ve;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Gets the FormGroup at a specific row index.
|
|
167
|
-
*/
|
|
168
|
-
#e(e) {
|
|
169
|
-
const n = this.formArray().at(e);
|
|
170
|
-
return n instanceof ve ? n : void 0;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Stores the FormArrayContext on the grid element.
|
|
174
|
-
*/
|
|
175
|
-
#n(e) {
|
|
176
|
-
const t = (r) => this.#e(r), n = {
|
|
177
|
-
getRow: (r) => {
|
|
178
|
-
const s = this.formArray().at(r);
|
|
179
|
-
return s ? s.value : null;
|
|
180
|
-
},
|
|
181
|
-
updateField: (r, o, s) => {
|
|
182
|
-
const l = t(r);
|
|
183
|
-
if (l) {
|
|
184
|
-
const f = l.get(o);
|
|
185
|
-
f && (f.setValue(s), f.markAsDirty());
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
getValue: () => this.formArray().getRawValue(),
|
|
189
|
-
hasFormGroups: this.#t(),
|
|
190
|
-
getControl: (r, o) => {
|
|
191
|
-
const s = t(r);
|
|
192
|
-
if (s)
|
|
193
|
-
return s.get(o) ?? void 0;
|
|
194
|
-
},
|
|
195
|
-
getRowFormGroup: t,
|
|
196
|
-
isRowValid: (r) => {
|
|
197
|
-
const o = t(r);
|
|
198
|
-
return o ? o.valid : !0;
|
|
199
|
-
},
|
|
200
|
-
isRowTouched: (r) => {
|
|
201
|
-
const o = t(r);
|
|
202
|
-
return o ? o.touched : !1;
|
|
203
|
-
},
|
|
204
|
-
isRowDirty: (r) => {
|
|
205
|
-
const o = t(r);
|
|
206
|
-
return o ? o.dirty : !1;
|
|
207
|
-
},
|
|
208
|
-
getRowErrors: (r) => {
|
|
209
|
-
const o = t(r);
|
|
210
|
-
if (!o) return null;
|
|
211
|
-
const s = {};
|
|
212
|
-
let l = !1;
|
|
213
|
-
return Object.keys(o.controls).forEach((f) => {
|
|
214
|
-
const g = o.get(f);
|
|
215
|
-
g?.errors && (s[f] = g.errors, l = !0);
|
|
216
|
-
}), o.errors && (s._group = o.errors, l = !0), l ? s : null;
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
e[le] = n;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Clears the FormArrayContext from the grid element.
|
|
223
|
-
*/
|
|
224
|
-
#r(e) {
|
|
225
|
-
delete e[le];
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Handles cell-commit events by updating the FormControl in the FormGroup.
|
|
229
|
-
*/
|
|
230
|
-
#i(e) {
|
|
231
|
-
const { rowIndex: t, field: n, value: r } = e, o = this.#e(t);
|
|
232
|
-
if (o) {
|
|
233
|
-
const s = o.get(n);
|
|
234
|
-
s && (s.setValue(r), s.markAsDirty(), s.markAsTouched());
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
Z = y(null), z = T(Z, 0, "GridFormArray", Ae, z), b(Z, 1, z);
|
|
239
|
-
const Ve = /* @__PURE__ */ new Map();
|
|
240
|
-
function it(i) {
|
|
241
|
-
const e = i.querySelector("tbw-grid-responsive-card");
|
|
242
|
-
if (e)
|
|
243
|
-
return Ve.get(e);
|
|
244
|
-
}
|
|
245
|
-
var xe, ee;
|
|
246
|
-
xe = [x({
|
|
247
|
-
selector: "tbw-grid-responsive-card"
|
|
248
|
-
})];
|
|
249
|
-
class B {
|
|
250
|
-
elementRef = w(A);
|
|
251
|
-
/**
|
|
252
|
-
* The ng-template containing the card content.
|
|
253
|
-
*/
|
|
254
|
-
template = k(F);
|
|
255
|
-
/**
|
|
256
|
-
* Effect that registers the template when it becomes available.
|
|
257
|
-
*/
|
|
258
|
-
onTemplateReceived = D(() => {
|
|
259
|
-
const e = this.template();
|
|
260
|
-
e && Ve.set(
|
|
261
|
-
this.elementRef.nativeElement,
|
|
262
|
-
e
|
|
263
|
-
);
|
|
264
|
-
});
|
|
265
|
-
/**
|
|
266
|
-
* Type guard for template context inference.
|
|
267
|
-
*/
|
|
268
|
-
static ngTemplateContextGuard(e, t) {
|
|
269
|
-
return !0;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
ee = y(null), B = T(ee, 0, "GridResponsiveCard", xe, B), b(ee, 1, B);
|
|
273
|
-
const Ge = /* @__PURE__ */ new Map();
|
|
274
|
-
function ot(i) {
|
|
275
|
-
return Ge.get(i);
|
|
276
|
-
}
|
|
277
|
-
var Se, te;
|
|
278
|
-
Se = [x({ selector: "tbw-grid-tool-panel" })];
|
|
279
|
-
class U {
|
|
280
|
-
elementRef = w(A);
|
|
281
|
-
/** Unique panel identifier (required) */
|
|
282
|
-
id = c.required({ alias: "id" });
|
|
283
|
-
/** Panel title shown in accordion header (required) */
|
|
284
|
-
title = c.required({ alias: "title" });
|
|
285
|
-
/** Icon for accordion section header (emoji or text) */
|
|
286
|
-
icon = c();
|
|
287
|
-
/** Tooltip for accordion section header */
|
|
288
|
-
tooltip = c();
|
|
289
|
-
/** Panel order priority (lower = first, default: 100) */
|
|
290
|
-
order = c(100);
|
|
291
|
-
/**
|
|
292
|
-
* Query for the ng-template content child.
|
|
293
|
-
*/
|
|
294
|
-
template = k(F);
|
|
295
|
-
/** Effect that triggers when the template is available */
|
|
296
|
-
onTemplateReceived = D(() => {
|
|
297
|
-
const e = this.template(), t = this.elementRef.nativeElement;
|
|
298
|
-
if (e) {
|
|
299
|
-
t.setAttribute("id", this.id()), t.setAttribute("title", this.title());
|
|
300
|
-
const n = this.icon();
|
|
301
|
-
n && t.setAttribute("icon", n);
|
|
302
|
-
const r = this.tooltip();
|
|
303
|
-
r && t.setAttribute("tooltip", r), t.setAttribute("order", String(this.order())), Ge.set(t, e);
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
/**
|
|
307
|
-
* Static type guard for template context.
|
|
308
|
-
* Enables type inference in templates.
|
|
309
|
-
*/
|
|
310
|
-
static ngTemplateContextGuard(e, t) {
|
|
311
|
-
return !0;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
te = y(null), U = T(te, 0, "GridToolPanel", Se, U), b(te, 1, U);
|
|
315
|
-
const ce = /* @__PURE__ */ new Map(), ae = /* @__PURE__ */ new Map();
|
|
316
|
-
function st(i) {
|
|
317
|
-
const e = ce.get(i);
|
|
318
|
-
if (e) return e;
|
|
319
|
-
const t = i.querySelector("tbw-grid-column-view");
|
|
320
|
-
if (t)
|
|
321
|
-
return Ie(t);
|
|
322
|
-
}
|
|
323
|
-
function lt(i) {
|
|
324
|
-
const e = ae.get(i);
|
|
325
|
-
if (e) return e;
|
|
326
|
-
const t = i.querySelector("tbw-grid-column-editor");
|
|
327
|
-
if (t)
|
|
328
|
-
return je(t);
|
|
329
|
-
}
|
|
330
|
-
var Le, ne;
|
|
331
|
-
Le = [x({ selector: "[tbwRenderer]" })];
|
|
332
|
-
class J {
|
|
333
|
-
template = w(F);
|
|
334
|
-
elementRef = w(A);
|
|
335
|
-
columnElement = null;
|
|
336
|
-
constructor() {
|
|
337
|
-
D(() => {
|
|
338
|
-
this.registerTemplate();
|
|
339
|
-
});
|
|
340
|
-
}
|
|
341
|
-
registerTemplate() {
|
|
342
|
-
let e = this.elementRef.nativeElement?.parentElement;
|
|
343
|
-
for (; e && e.tagName !== "TBW-GRID-COLUMN"; )
|
|
344
|
-
e = e.parentElement;
|
|
345
|
-
e && (this.columnElement = e, ce.set(e, this.template));
|
|
346
|
-
}
|
|
347
|
-
ngOnDestroy() {
|
|
348
|
-
this.columnElement && ce.delete(this.columnElement);
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Static type guard for template context.
|
|
352
|
-
* Uses `any` defaults for ergonomic template usage.
|
|
353
|
-
*/
|
|
354
|
-
static ngTemplateContextGuard(e, t) {
|
|
355
|
-
return !0;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
ne = y(null), J = T(ne, 0, "TbwRenderer", Le, J), b(ne, 1, J);
|
|
359
|
-
var De, re;
|
|
360
|
-
De = [x({ selector: "[tbwEditor]" })];
|
|
361
|
-
class W {
|
|
362
|
-
template = w(F);
|
|
363
|
-
elementRef = w(A);
|
|
364
|
-
columnElement = null;
|
|
365
|
-
constructor() {
|
|
366
|
-
D(() => {
|
|
367
|
-
this.registerTemplate();
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
registerTemplate() {
|
|
371
|
-
let e = this.elementRef.nativeElement?.parentElement;
|
|
372
|
-
for (; e && e.tagName !== "TBW-GRID-COLUMN"; )
|
|
373
|
-
e = e.parentElement;
|
|
374
|
-
e && (this.columnElement = e, ae.set(e, this.template));
|
|
375
|
-
}
|
|
376
|
-
ngOnDestroy() {
|
|
377
|
-
this.columnElement && ae.delete(this.columnElement);
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Static type guard for template context.
|
|
381
|
-
* Uses `any` defaults for ergonomic template usage.
|
|
382
|
-
*/
|
|
383
|
-
static ngTemplateContextGuard(e, t) {
|
|
384
|
-
return !0;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
re = y(null), W = T(re, 0, "TbwEditor", De, W), b(re, 1, W);
|
|
388
|
-
const qe = new He("GRID_TYPE_DEFAULTS");
|
|
389
|
-
var Pe, ie;
|
|
390
|
-
Pe = [Ye({ providedIn: "root" })];
|
|
391
|
-
class I {
|
|
392
|
-
defaults = /* @__PURE__ */ new Map();
|
|
393
|
-
constructor() {
|
|
394
|
-
const e = w(qe, { optional: !0 });
|
|
395
|
-
if (e)
|
|
396
|
-
for (const [t, n] of Object.entries(e))
|
|
397
|
-
this.defaults.set(t, n);
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Register type-level defaults for a custom type.
|
|
401
|
-
*
|
|
402
|
-
* @param type - The type name (e.g., 'country', 'currency')
|
|
403
|
-
* @param defaults - Renderer/editor configuration
|
|
404
|
-
*/
|
|
405
|
-
register(e, t) {
|
|
406
|
-
this.defaults.set(e, t);
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Get type defaults for a given type.
|
|
410
|
-
*/
|
|
411
|
-
get(e) {
|
|
412
|
-
return this.defaults.get(e);
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Remove type defaults for a type.
|
|
416
|
-
*/
|
|
417
|
-
unregister(e) {
|
|
418
|
-
this.defaults.delete(e);
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Check if a type has registered defaults.
|
|
422
|
-
*/
|
|
423
|
-
has(e) {
|
|
424
|
-
return this.defaults.has(e);
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Get all registered type names.
|
|
428
|
-
*/
|
|
429
|
-
getRegisteredTypes() {
|
|
430
|
-
return Array.from(this.defaults.keys());
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
433
|
-
* Convert to TypeDefault for use with grid's typeDefaults.
|
|
434
|
-
* This is used internally by the adapter.
|
|
435
|
-
*
|
|
436
|
-
* @internal
|
|
437
|
-
*/
|
|
438
|
-
getAsTypeDefault(e) {
|
|
439
|
-
const t = this.defaults.get(e);
|
|
440
|
-
if (t)
|
|
441
|
-
return {
|
|
442
|
-
editorParams: t.editorParams
|
|
443
|
-
// renderer and editor are handled by the adapter which creates
|
|
444
|
-
// the actual functions that instantiate Angular components
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
ie = y(null), I = T(ie, 0, "GridTypeRegistry", Pe, I), b(ie, 1, I);
|
|
449
|
-
function ft(i) {
|
|
450
|
-
return Xe([{ provide: qe, useValue: i }]);
|
|
451
|
-
}
|
|
452
|
-
function Ce(i) {
|
|
453
|
-
const e = st(i);
|
|
454
|
-
return e || Ie(i);
|
|
455
|
-
}
|
|
456
|
-
function Ee(i) {
|
|
457
|
-
const e = lt(i);
|
|
458
|
-
return e || je(i);
|
|
459
|
-
}
|
|
460
|
-
class ct {
|
|
461
|
-
constructor(e, t, n) {
|
|
462
|
-
this.injector = e, this.appRef = t, this.viewContainerRef = n, window.__ANGULAR_GRID_ADAPTER__ = this;
|
|
463
|
-
try {
|
|
464
|
-
this.typeRegistry = this.injector.get(I, null);
|
|
465
|
-
} catch {
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
viewRefs = [];
|
|
469
|
-
componentRefs = [];
|
|
470
|
-
typeRegistry = null;
|
|
471
|
-
/**
|
|
472
|
-
* Processes an Angular grid configuration, converting component class references
|
|
473
|
-
* to actual renderer/editor functions.
|
|
474
|
-
*
|
|
475
|
-
* Call this method on your gridConfig before passing it to the grid.
|
|
476
|
-
*
|
|
477
|
-
* @example
|
|
478
|
-
* ```typescript
|
|
479
|
-
* import { AngularGridAdapter, type AngularGridConfig } from '@toolbox-web/grid-angular';
|
|
480
|
-
*
|
|
481
|
-
* const config: AngularGridConfig<Employee> = {
|
|
482
|
-
* columns: [
|
|
483
|
-
* { field: 'status', renderer: StatusBadgeComponent, editor: StatusEditorComponent },
|
|
484
|
-
* ],
|
|
485
|
-
* };
|
|
486
|
-
*
|
|
487
|
-
* // In component
|
|
488
|
-
* constructor() {
|
|
489
|
-
* const adapter = inject(AngularGridAdapter); // or create new instance
|
|
490
|
-
* this.processedConfig = adapter.processGridConfig(config);
|
|
491
|
-
* }
|
|
492
|
-
* ```
|
|
493
|
-
*
|
|
494
|
-
* @param config - Angular grid configuration with possible component class references
|
|
495
|
-
* @returns Processed GridConfig with actual renderer/editor functions
|
|
496
|
-
*/
|
|
497
|
-
processGridConfig(e) {
|
|
498
|
-
if (!e.columns)
|
|
499
|
-
return e;
|
|
500
|
-
const t = e.columns.map((n) => this.processColumn(n));
|
|
501
|
-
return {
|
|
502
|
-
...e,
|
|
503
|
-
columns: t
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Processes a single column configuration, converting component class references
|
|
508
|
-
* to actual renderer/editor functions.
|
|
509
|
-
*
|
|
510
|
-
* @param column - Angular column configuration
|
|
511
|
-
* @returns Processed ColumnConfig
|
|
512
|
-
*/
|
|
513
|
-
processColumn(e) {
|
|
514
|
-
const t = { ...e };
|
|
515
|
-
return e.renderer && we(e.renderer) && (t.renderer = this.createComponentRenderer(e.renderer)), e.editor && we(e.editor) && (t.editor = this.createComponentEditor(e.editor)), t;
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Determines if this adapter can handle the given element.
|
|
519
|
-
* Checks if a template is registered for this element (structural or nested).
|
|
520
|
-
*/
|
|
521
|
-
canHandle(e) {
|
|
522
|
-
return Ce(e) !== void 0 || Ee(e) !== void 0;
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Creates a view renderer function that creates an embedded view
|
|
526
|
-
* from the registered template and returns its DOM element.
|
|
527
|
-
*
|
|
528
|
-
* Returns undefined if no template is registered for this element,
|
|
529
|
-
* allowing the grid to use its default rendering.
|
|
530
|
-
*/
|
|
531
|
-
createRenderer(e) {
|
|
532
|
-
const t = Ce(e);
|
|
533
|
-
if (t)
|
|
534
|
-
return (n) => {
|
|
535
|
-
const r = {
|
|
536
|
-
$implicit: n.value,
|
|
537
|
-
value: n.value,
|
|
538
|
-
row: n.row,
|
|
539
|
-
column: n.column
|
|
540
|
-
}, o = this.viewContainerRef.createEmbeddedView(t, r);
|
|
541
|
-
return this.viewRefs.push(o), o.detectChanges(), o.rootNodes[0];
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* Creates an editor spec that creates an embedded view.
|
|
546
|
-
*
|
|
547
|
-
* **Auto-wiring**: The adapter automatically listens for `commit` and `cancel`
|
|
548
|
-
* CustomEvents on the rendered component. If the component emits these events,
|
|
549
|
-
* the adapter will call the grid's commit/cancel functions automatically.
|
|
550
|
-
*
|
|
551
|
-
* This means templates can be simplified from:
|
|
552
|
-
* ```html
|
|
553
|
-
* <app-editor *tbwEditor="let value; onCommit as onCommit"
|
|
554
|
-
* [value]="value" (commit)="onCommit($event)" />
|
|
555
|
-
* ```
|
|
556
|
-
* To just:
|
|
557
|
-
* ```html
|
|
558
|
-
* <app-editor *tbwEditor="let value" [value]="value" />
|
|
559
|
-
* ```
|
|
560
|
-
* As long as the component emits `(commit)` with the new value.
|
|
561
|
-
*/
|
|
562
|
-
createEditor(e) {
|
|
563
|
-
const t = Ee(e), n = e.closest("tbw-grid");
|
|
564
|
-
return t ? (r) => {
|
|
565
|
-
const o = (h) => r.commit(h), s = () => r.cancel(), l = new ge(), f = new ge();
|
|
566
|
-
l.subscribe((h) => r.commit(h)), f.subscribe(() => r.cancel());
|
|
567
|
-
let g;
|
|
568
|
-
if (n) {
|
|
569
|
-
const h = rt(n);
|
|
570
|
-
if (h?.hasFormGroups) {
|
|
571
|
-
const S = n.rows;
|
|
572
|
-
if (S) {
|
|
573
|
-
const M = S.indexOf(r.row);
|
|
574
|
-
M >= 0 && (g = h.getControl(M, r.field));
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
const E = {
|
|
579
|
-
$implicit: r.value,
|
|
580
|
-
value: r.value,
|
|
581
|
-
row: r.row,
|
|
582
|
-
column: r.column,
|
|
583
|
-
// Preferred: simple callback functions
|
|
584
|
-
onCommit: o,
|
|
585
|
-
onCancel: s,
|
|
586
|
-
// FormControl from FormArray (if available)
|
|
587
|
-
control: g,
|
|
588
|
-
// Deprecated: EventEmitters (for backwards compatibility)
|
|
589
|
-
commit: l,
|
|
590
|
-
cancel: f
|
|
591
|
-
}, a = this.viewContainerRef.createEmbeddedView(t, E);
|
|
592
|
-
this.viewRefs.push(a), a.detectChanges();
|
|
593
|
-
const R = a.rootNodes[0];
|
|
594
|
-
return R && R.addEventListener && (R.addEventListener("commit", (h) => {
|
|
595
|
-
const S = h;
|
|
596
|
-
r.commit(S.detail);
|
|
597
|
-
}), R.addEventListener("cancel", () => {
|
|
598
|
-
r.cancel();
|
|
599
|
-
})), R;
|
|
600
|
-
} : () => document.createElement("div");
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Creates a detail renderer function for MasterDetailPlugin.
|
|
604
|
-
* Renders Angular templates for expandable detail rows.
|
|
605
|
-
*/
|
|
606
|
-
createDetailRenderer(e) {
|
|
607
|
-
const t = Re(e);
|
|
608
|
-
if (t)
|
|
609
|
-
return (n) => {
|
|
610
|
-
const r = {
|
|
611
|
-
$implicit: n,
|
|
612
|
-
row: n
|
|
613
|
-
}, o = this.viewContainerRef.createEmbeddedView(t, r);
|
|
614
|
-
this.viewRefs.push(o), o.detectChanges();
|
|
615
|
-
const s = document.createElement("div");
|
|
616
|
-
return o.rootNodes.forEach((l) => s.appendChild(l)), s;
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
621
|
-
* Parses the <tbw-grid-detail> element and returns an Angular template-based renderer.
|
|
622
|
-
*
|
|
623
|
-
* This enables MasterDetailPlugin to automatically use Angular templates
|
|
624
|
-
* without manual configuration in the Grid directive.
|
|
625
|
-
*/
|
|
626
|
-
parseDetailElement(e) {
|
|
627
|
-
const t = Re(e.closest("tbw-grid"));
|
|
628
|
-
if (t)
|
|
629
|
-
return (n) => {
|
|
630
|
-
const r = {
|
|
631
|
-
$implicit: n,
|
|
632
|
-
row: n
|
|
633
|
-
}, o = this.viewContainerRef.createEmbeddedView(t, r);
|
|
634
|
-
this.viewRefs.push(o), o.detectChanges();
|
|
635
|
-
const s = document.createElement("div");
|
|
636
|
-
return o.rootNodes.forEach((l) => s.appendChild(l)), s;
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Creates a responsive card renderer function for ResponsivePlugin.
|
|
641
|
-
* Renders Angular templates for card layout in responsive mode.
|
|
642
|
-
*
|
|
643
|
-
* @param gridElement - The grid element to look up the template for
|
|
644
|
-
* @returns A card renderer function or undefined if no template is found
|
|
645
|
-
*/
|
|
646
|
-
createResponsiveCardRenderer(e) {
|
|
647
|
-
const t = it(e);
|
|
648
|
-
if (t)
|
|
649
|
-
return (n, r) => {
|
|
650
|
-
const o = {
|
|
651
|
-
$implicit: n,
|
|
652
|
-
row: n,
|
|
653
|
-
index: r
|
|
654
|
-
}, s = this.viewContainerRef.createEmbeddedView(t, o);
|
|
655
|
-
this.viewRefs.push(s), s.detectChanges();
|
|
656
|
-
const l = document.createElement("div");
|
|
657
|
-
return s.rootNodes.forEach((f) => l.appendChild(f)), l;
|
|
658
|
-
};
|
|
659
|
-
}
|
|
660
|
-
/**
|
|
661
|
-
* Creates a tool panel renderer from a light DOM element.
|
|
662
|
-
* The renderer creates an Angular template-based panel content.
|
|
663
|
-
*/
|
|
664
|
-
createToolPanelRenderer(e) {
|
|
665
|
-
const t = ot(e);
|
|
666
|
-
if (!t)
|
|
667
|
-
return;
|
|
668
|
-
const n = e.closest("tbw-grid");
|
|
669
|
-
return (r) => {
|
|
670
|
-
const o = {
|
|
671
|
-
$implicit: n ?? r,
|
|
672
|
-
grid: n ?? r
|
|
673
|
-
}, s = this.viewContainerRef.createEmbeddedView(t, o);
|
|
674
|
-
return this.viewRefs.push(s), s.detectChanges(), s.rootNodes.forEach((l) => r.appendChild(l)), () => {
|
|
675
|
-
const l = this.viewRefs.indexOf(s);
|
|
676
|
-
l > -1 && this.viewRefs.splice(l, 1), s.destroy();
|
|
677
|
-
};
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Gets type-level defaults from the application's GridTypeRegistry.
|
|
682
|
-
*
|
|
683
|
-
* This enables application-wide type defaults configured via `provideGridTypeDefaults()`.
|
|
684
|
-
* The returned TypeDefault contains renderer/editor functions that instantiate
|
|
685
|
-
* Angular components dynamically.
|
|
686
|
-
*
|
|
687
|
-
* @example
|
|
688
|
-
* ```typescript
|
|
689
|
-
* // app.config.ts
|
|
690
|
-
* export const appConfig: ApplicationConfig = {
|
|
691
|
-
* providers: [
|
|
692
|
-
* provideGridTypeDefaults({
|
|
693
|
-
* country: {
|
|
694
|
-
* renderer: CountryCellComponent,
|
|
695
|
-
* editor: CountryEditorComponent
|
|
696
|
-
* }
|
|
697
|
-
* })
|
|
698
|
-
* ]
|
|
699
|
-
* };
|
|
700
|
-
*
|
|
701
|
-
* // Any grid with type: 'country' columns will use these components
|
|
702
|
-
* gridConfig = {
|
|
703
|
-
* columns: [{ field: 'country', type: 'country' }]
|
|
704
|
-
* };
|
|
705
|
-
* ```
|
|
706
|
-
*/
|
|
707
|
-
getTypeDefault(e) {
|
|
708
|
-
if (!this.typeRegistry)
|
|
709
|
-
return;
|
|
710
|
-
const t = this.typeRegistry.get(e);
|
|
711
|
-
if (!t)
|
|
712
|
-
return;
|
|
713
|
-
const n = {
|
|
714
|
-
editorParams: t.editorParams
|
|
715
|
-
};
|
|
716
|
-
return t.renderer && (n.renderer = this.createComponentRenderer(t.renderer)), t.editor && (n.editor = this.createComponentEditor(t.editor)), n;
|
|
717
|
-
}
|
|
718
|
-
/**
|
|
719
|
-
* Creates a renderer function from an Angular component class.
|
|
720
|
-
* @internal
|
|
721
|
-
*/
|
|
722
|
-
createComponentRenderer(e) {
|
|
723
|
-
return (t) => {
|
|
724
|
-
const n = document.createElement("span");
|
|
725
|
-
n.style.display = "contents";
|
|
726
|
-
const r = he(e, {
|
|
727
|
-
environmentInjector: this.injector,
|
|
728
|
-
hostElement: n
|
|
729
|
-
});
|
|
730
|
-
return this.setComponentInputs(r, {
|
|
731
|
-
value: t.value,
|
|
732
|
-
row: t.row,
|
|
733
|
-
column: t.column
|
|
734
|
-
}), this.appRef.attachView(r.hostView), this.componentRefs.push(r), r.changeDetectorRef.detectChanges(), n;
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
/**
|
|
738
|
-
* Creates an editor function from an Angular component class.
|
|
739
|
-
* @internal
|
|
740
|
-
*/
|
|
741
|
-
createComponentEditor(e) {
|
|
742
|
-
return (t) => {
|
|
743
|
-
const n = document.createElement("span");
|
|
744
|
-
n.style.display = "contents";
|
|
745
|
-
const r = he(e, {
|
|
746
|
-
environmentInjector: this.injector,
|
|
747
|
-
hostElement: n
|
|
748
|
-
});
|
|
749
|
-
this.setComponentInputs(r, {
|
|
750
|
-
value: t.value,
|
|
751
|
-
row: t.row,
|
|
752
|
-
column: t.column
|
|
753
|
-
}), this.appRef.attachView(r.hostView), this.componentRefs.push(r), r.changeDetectorRef.detectChanges();
|
|
754
|
-
const o = r.instance;
|
|
755
|
-
return this.subscribeToOutput(o, "commit", (s) => t.commit(s)), this.subscribeToOutput(o, "cancel", () => t.cancel()), n.addEventListener("commit", (s) => {
|
|
756
|
-
const l = s;
|
|
757
|
-
t.commit(l.detail);
|
|
758
|
-
}), n.addEventListener("cancel", () => {
|
|
759
|
-
t.cancel();
|
|
760
|
-
}), n;
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Subscribes to an Angular output on a component instance.
|
|
765
|
-
* Works with both EventEmitter and OutputEmitterRef (signal outputs).
|
|
766
|
-
* @internal
|
|
767
|
-
*/
|
|
768
|
-
subscribeToOutput(e, t, n) {
|
|
769
|
-
const r = e[t];
|
|
770
|
-
r && typeof r.subscribe == "function" && r.subscribe(n);
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* Sets component inputs using Angular's setInput API.
|
|
774
|
-
* @internal
|
|
775
|
-
*/
|
|
776
|
-
setComponentInputs(e, t) {
|
|
777
|
-
for (const [n, r] of Object.entries(t))
|
|
778
|
-
try {
|
|
779
|
-
e.setInput(n, r);
|
|
780
|
-
} catch {
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
/**
|
|
784
|
-
* Clean up all view references and component references.
|
|
785
|
-
* Call this when your app/component is destroyed.
|
|
786
|
-
*/
|
|
787
|
-
destroy() {
|
|
788
|
-
this.viewRefs.forEach((e) => e.destroy()), this.viewRefs = [], this.componentRefs.forEach((e) => e.destroy()), this.componentRefs = [];
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
function gt() {
|
|
792
|
-
const i = w(A), e = G(!1), t = G(null), n = G(null);
|
|
793
|
-
Ke(() => {
|
|
794
|
-
const u = i.nativeElement.querySelector("tbw-grid");
|
|
795
|
-
if (!u) {
|
|
796
|
-
console.warn("[injectGrid] No tbw-grid element found in component");
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
n.set(u), u.ready?.().then(async () => {
|
|
800
|
-
e.set(!0);
|
|
801
|
-
const m = u.getConfig?.();
|
|
802
|
-
m && t.set(m);
|
|
803
|
-
});
|
|
804
|
-
});
|
|
805
|
-
const r = P(() => {
|
|
806
|
-
const u = t();
|
|
807
|
-
return u?.columns ? u.columns.filter((m) => !m.hidden) : [];
|
|
808
|
-
}), o = async () => {
|
|
809
|
-
const u = n();
|
|
810
|
-
return u ? u.getConfig?.() ?? null : null;
|
|
811
|
-
}, s = async () => {
|
|
812
|
-
const u = n();
|
|
813
|
-
u && await u.forceLayout?.();
|
|
814
|
-
}, l = async (u) => {
|
|
815
|
-
const m = n();
|
|
816
|
-
m && await m.toggleGroup?.(u);
|
|
817
|
-
}, f = (u, m) => {
|
|
818
|
-
n()?.registerStyles?.(u, m);
|
|
819
|
-
}, g = (u) => {
|
|
820
|
-
n()?.unregisterStyles?.(u);
|
|
821
|
-
}, E = () => {
|
|
822
|
-
const u = n(), m = u?.getPluginByName?.("selection");
|
|
823
|
-
if (!m) {
|
|
824
|
-
console.warn("[injectGrid] selectAll requires SelectionPlugin");
|
|
825
|
-
return;
|
|
826
|
-
}
|
|
827
|
-
if (m.config?.mode === "row") {
|
|
828
|
-
const d = u?.rows ?? [], C = new Set(d.map((v, L) => L));
|
|
829
|
-
m.selected = C, m.requestAfterRender?.();
|
|
830
|
-
}
|
|
831
|
-
}, a = () => {
|
|
832
|
-
const m = n()?.getPluginByName?.("selection");
|
|
833
|
-
if (!m) return;
|
|
834
|
-
const d = m.config?.mode;
|
|
835
|
-
d === "row" ? m.selected = /* @__PURE__ */ new Set() : (d === "range" || d === "cell") && (m.ranges = []), m.requestAfterRender?.();
|
|
836
|
-
}, R = () => {
|
|
837
|
-
const m = n()?.getPluginByName?.("selection");
|
|
838
|
-
if (!m) return /* @__PURE__ */ new Set();
|
|
839
|
-
if (m.config?.mode === "row")
|
|
840
|
-
return new Set(m.selected ?? []);
|
|
841
|
-
const d = m.ranges ?? [], C = /* @__PURE__ */ new Set();
|
|
842
|
-
for (const v of d)
|
|
843
|
-
for (let L = v.startRow; L <= v.endRow; L++)
|
|
844
|
-
C.add(L);
|
|
845
|
-
return C;
|
|
846
|
-
};
|
|
847
|
-
return {
|
|
848
|
-
element: n,
|
|
849
|
-
isReady: e,
|
|
850
|
-
config: t,
|
|
851
|
-
visibleColumns: r,
|
|
852
|
-
getConfig: o,
|
|
853
|
-
forceLayout: s,
|
|
854
|
-
toggleGroup: l,
|
|
855
|
-
registerStyles: f,
|
|
856
|
-
unregisterStyles: g,
|
|
857
|
-
selectAll: E,
|
|
858
|
-
clearSelection: a,
|
|
859
|
-
getSelectedIndices: R,
|
|
860
|
-
getSelectedRows: () => {
|
|
861
|
-
const u = n();
|
|
862
|
-
if (!u) return [];
|
|
863
|
-
const m = u.rows ?? [], d = R();
|
|
864
|
-
return Array.from(d).filter((C) => C >= 0 && C < m.length).map((C) => m[C]);
|
|
865
|
-
},
|
|
866
|
-
exportToCsv: (u) => {
|
|
867
|
-
const d = n()?.getPluginByName?.("export");
|
|
868
|
-
if (!d) {
|
|
869
|
-
console.warn("[injectGrid] exportToCsv requires ExportPlugin");
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
d.exportToCsv?.(u);
|
|
873
|
-
},
|
|
874
|
-
exportToJson: (u) => {
|
|
875
|
-
const d = n()?.getPluginByName?.("export");
|
|
876
|
-
if (!d) {
|
|
877
|
-
console.warn("[injectGrid] exportToJson requires ExportPlugin");
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
d.exportToJson?.(u);
|
|
881
|
-
}
|
|
882
|
-
};
|
|
883
|
-
}
|
|
884
|
-
var Fe, oe;
|
|
885
|
-
Fe = [x()];
|
|
886
|
-
class H {
|
|
887
|
-
elementRef = w(A);
|
|
888
|
-
// ============================================================================
|
|
889
|
-
// Inputs
|
|
890
|
-
// ============================================================================
|
|
891
|
-
/**
|
|
892
|
-
* The cell value. Used when FormControl is not available.
|
|
893
|
-
* When a FormControl is provided, value is derived from control.value instead.
|
|
894
|
-
*/
|
|
895
|
-
value = c();
|
|
896
|
-
/**
|
|
897
|
-
* The full row data object.
|
|
898
|
-
*/
|
|
899
|
-
row = c();
|
|
900
|
-
/**
|
|
901
|
-
* The column configuration.
|
|
902
|
-
*/
|
|
903
|
-
column = c();
|
|
904
|
-
/**
|
|
905
|
-
* The FormControl for this cell, if the grid is bound to a FormArray.
|
|
906
|
-
* When provided, the editor uses control.value instead of the value input.
|
|
907
|
-
*/
|
|
908
|
-
control = c();
|
|
909
|
-
// ============================================================================
|
|
910
|
-
// Outputs
|
|
911
|
-
// ============================================================================
|
|
912
|
-
/**
|
|
913
|
-
* Emits when the user commits a new value.
|
|
914
|
-
*/
|
|
915
|
-
commit = p();
|
|
916
|
-
/**
|
|
917
|
-
* Emits when the user cancels editing.
|
|
918
|
-
*/
|
|
919
|
-
cancel = p();
|
|
920
|
-
// ============================================================================
|
|
921
|
-
// Computed State
|
|
922
|
-
// ============================================================================
|
|
923
|
-
/**
|
|
924
|
-
* The current value, derived from FormControl if available, otherwise from value input.
|
|
925
|
-
* This is the recommended way to get the current value in your editor template.
|
|
926
|
-
*/
|
|
927
|
-
currentValue = P(() => {
|
|
928
|
-
const e = this.control();
|
|
929
|
-
return e ? e.value : this.value();
|
|
930
|
-
});
|
|
931
|
-
/**
|
|
932
|
-
* Whether the control is invalid (has validation errors).
|
|
933
|
-
* Returns false if no FormControl is available.
|
|
934
|
-
*/
|
|
935
|
-
isInvalid = P(() => this.control()?.invalid ?? !1);
|
|
936
|
-
/**
|
|
937
|
-
* Whether the control is dirty (has been modified).
|
|
938
|
-
* Returns false if no FormControl is available.
|
|
939
|
-
*/
|
|
940
|
-
isDirty = P(() => this.control()?.dirty ?? !1);
|
|
941
|
-
/**
|
|
942
|
-
* Whether the control has been touched.
|
|
943
|
-
* Returns false if no FormControl is available.
|
|
944
|
-
*/
|
|
945
|
-
isTouched = P(() => this.control()?.touched ?? !1);
|
|
946
|
-
/**
|
|
947
|
-
* Whether the control has any validation errors.
|
|
948
|
-
*/
|
|
949
|
-
hasErrors = P(() => {
|
|
950
|
-
const e = this.control();
|
|
951
|
-
return e?.errors != null && Object.keys(e.errors).length > 0;
|
|
952
|
-
});
|
|
953
|
-
/**
|
|
954
|
-
* The first error message from the control's validation errors.
|
|
955
|
-
* Returns an empty string if no errors.
|
|
956
|
-
*/
|
|
957
|
-
firstErrorMessage = P(() => {
|
|
958
|
-
const e = this.control();
|
|
959
|
-
if (!e?.errors) return "";
|
|
960
|
-
const t = Object.keys(e.errors)[0];
|
|
961
|
-
return this.getErrorMessage(t, e.errors[t]);
|
|
962
|
-
});
|
|
963
|
-
/**
|
|
964
|
-
* All error messages from the control's validation errors.
|
|
965
|
-
*/
|
|
966
|
-
allErrorMessages = P(() => {
|
|
967
|
-
const e = this.control();
|
|
968
|
-
return e?.errors ? Object.entries(e.errors).map(([t, n]) => this.getErrorMessage(t, n)) : [];
|
|
969
|
-
});
|
|
970
|
-
// ============================================================================
|
|
971
|
-
// Methods
|
|
972
|
-
// ============================================================================
|
|
973
|
-
/**
|
|
974
|
-
* Commit a new value. Emits the commit output AND dispatches a DOM event.
|
|
975
|
-
* The DOM event enables the grid's auto-wiring to catch the commit.
|
|
976
|
-
* Call this when the user confirms their edit.
|
|
977
|
-
*/
|
|
978
|
-
commitValue(e) {
|
|
979
|
-
this.commit.emit(e), this.elementRef.nativeElement.dispatchEvent(new CustomEvent("commit", { detail: e, bubbles: !0 }));
|
|
980
|
-
}
|
|
981
|
-
/**
|
|
982
|
-
* Cancel editing. Emits the cancel output AND dispatches a DOM event.
|
|
983
|
-
* Call this when the user cancels (e.g., presses Escape).
|
|
984
|
-
*/
|
|
985
|
-
cancelEdit() {
|
|
986
|
-
this.cancel.emit(), this.elementRef.nativeElement.dispatchEvent(new CustomEvent("cancel", { bubbles: !0 }));
|
|
987
|
-
}
|
|
988
|
-
/**
|
|
989
|
-
* Get a human-readable error message for a validation error.
|
|
990
|
-
* Override this method to customize error messages for your editor.
|
|
991
|
-
*
|
|
992
|
-
* @param errorKey - The validation error key (e.g., 'required', 'minlength')
|
|
993
|
-
* @param errorValue - The error value (e.g., { requiredLength: 5, actualLength: 3 })
|
|
994
|
-
* @returns A human-readable error message
|
|
995
|
-
*/
|
|
996
|
-
getErrorMessage(e, t) {
|
|
997
|
-
switch (e) {
|
|
998
|
-
case "required":
|
|
999
|
-
return "This field is required";
|
|
1000
|
-
case "minlength":
|
|
1001
|
-
return `Minimum length is ${t?.requiredLength ?? "unknown"}`;
|
|
1002
|
-
case "maxlength":
|
|
1003
|
-
return `Maximum length is ${t?.requiredLength ?? "unknown"}`;
|
|
1004
|
-
case "min":
|
|
1005
|
-
return `Minimum value is ${t?.min ?? "unknown"}`;
|
|
1006
|
-
case "max":
|
|
1007
|
-
return `Maximum value is ${t?.max ?? "unknown"}`;
|
|
1008
|
-
case "email":
|
|
1009
|
-
return "Invalid email address";
|
|
1010
|
-
case "pattern":
|
|
1011
|
-
return "Invalid format";
|
|
1012
|
-
default:
|
|
1013
|
-
return `Invalid value (${e})`;
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
oe = y(null), H = T(oe, 0, "BaseGridEditor", Fe, H), b(oe, 1, H);
|
|
1018
|
-
var Me, se;
|
|
1019
|
-
Me = [x({ selector: "tbw-grid" })];
|
|
1020
|
-
class Y {
|
|
1021
|
-
elementRef = w(A);
|
|
1022
|
-
injector = w(Qe);
|
|
1023
|
-
appRef = w(Ze);
|
|
1024
|
-
viewContainerRef = w(et);
|
|
1025
|
-
adapter = null;
|
|
1026
|
-
constructor() {
|
|
1027
|
-
D(() => {
|
|
1028
|
-
const e = this.angularConfig();
|
|
1029
|
-
if (!this.adapter) return;
|
|
1030
|
-
const t = e ? this.adapter.processGridConfig(e) : {}, n = this.createFeaturePlugins(), r = t.plugins || [], o = [...n, ...r], s = this.sortable(), l = this.filterable(), f = this.selectable(), g = {};
|
|
1031
|
-
s !== void 0 && (g.sortable = s), l !== void 0 && (g.filterable = l), f !== void 0 && (g.selectable = f);
|
|
1032
|
-
const E = this.elementRef.nativeElement;
|
|
1033
|
-
E.gridConfig = {
|
|
1034
|
-
...t,
|
|
1035
|
-
...g,
|
|
1036
|
-
plugins: o.length > 0 ? o : void 0
|
|
1037
|
-
};
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Custom CSS styles to inject into the grid.
|
|
1042
|
-
* Use this to style custom cell renderers, editors, or detail panels.
|
|
1043
|
-
*
|
|
1044
|
-
* @example
|
|
1045
|
-
* ```typescript
|
|
1046
|
-
* // In your component
|
|
1047
|
-
* customStyles = `
|
|
1048
|
-
* .my-detail-panel { padding: 16px; }
|
|
1049
|
-
* .my-status-badge { border-radius: 4px; }
|
|
1050
|
-
* `;
|
|
1051
|
-
* ```
|
|
1052
|
-
*
|
|
1053
|
-
* ```html
|
|
1054
|
-
* <tbw-grid [customStyles]="customStyles">...</tbw-grid>
|
|
1055
|
-
* ```
|
|
1056
|
-
*/
|
|
1057
|
-
customStyles = c();
|
|
1058
|
-
/**
|
|
1059
|
-
* Grid-wide sorting toggle.
|
|
1060
|
-
* When false, disables sorting for all columns regardless of their individual `sortable` setting.
|
|
1061
|
-
* When true (default), columns with `sortable: true` can be sorted.
|
|
1062
|
-
*
|
|
1063
|
-
* This is a core grid config property, not a plugin feature.
|
|
1064
|
-
* For multi-column sorting, also add the `[multiSort]` feature.
|
|
1065
|
-
*
|
|
1066
|
-
* @default true
|
|
1067
|
-
*
|
|
1068
|
-
* @example
|
|
1069
|
-
* ```html
|
|
1070
|
-
* <!-- Disable all sorting -->
|
|
1071
|
-
* <tbw-grid [sortable]="false" />
|
|
1072
|
-
*
|
|
1073
|
-
* <!-- Enable sorting (default) - columns still need sortable: true -->
|
|
1074
|
-
* <tbw-grid [sortable]="true" />
|
|
1075
|
-
*
|
|
1076
|
-
* <!-- Enable multi-column sorting -->
|
|
1077
|
-
* <tbw-grid [sortable]="true" [multiSort]="true" />
|
|
1078
|
-
* ```
|
|
1079
|
-
*/
|
|
1080
|
-
sortable = c();
|
|
1081
|
-
/**
|
|
1082
|
-
* Grid-wide filtering toggle.
|
|
1083
|
-
* When false, disables filtering for all columns regardless of their individual `filterable` setting.
|
|
1084
|
-
* When true (default), columns with `filterable: true` can be filtered.
|
|
1085
|
-
*
|
|
1086
|
-
* Requires the FilteringPlugin to be loaded.
|
|
1087
|
-
*
|
|
1088
|
-
* @default true
|
|
1089
|
-
*
|
|
1090
|
-
* @example
|
|
1091
|
-
* ```html
|
|
1092
|
-
* <!-- Disable all filtering -->
|
|
1093
|
-
* <tbw-grid [filterable]="false" [filtering]="true" />
|
|
1094
|
-
*
|
|
1095
|
-
* <!-- Enable filtering (default) -->
|
|
1096
|
-
* <tbw-grid [filterable]="true" [filtering]="true" />
|
|
1097
|
-
* ```
|
|
1098
|
-
*/
|
|
1099
|
-
filterable = c();
|
|
1100
|
-
/**
|
|
1101
|
-
* Grid-wide selection toggle.
|
|
1102
|
-
* When false, disables selection for all rows/cells.
|
|
1103
|
-
* When true (default), selection is enabled based on plugin mode.
|
|
1104
|
-
*
|
|
1105
|
-
* Requires the SelectionPlugin to be loaded.
|
|
1106
|
-
*
|
|
1107
|
-
* @default true
|
|
1108
|
-
*
|
|
1109
|
-
* @example
|
|
1110
|
-
* ```html
|
|
1111
|
-
* <!-- Disable all selection -->
|
|
1112
|
-
* <tbw-grid [selectable]="false" [selection]="'range'" />
|
|
1113
|
-
*
|
|
1114
|
-
* <!-- Enable selection (default) -->
|
|
1115
|
-
* <tbw-grid [selectable]="true" [selection]="'range'" />
|
|
1116
|
-
* ```
|
|
1117
|
-
*/
|
|
1118
|
-
selectable = c();
|
|
1119
|
-
/**
|
|
1120
|
-
* Angular-specific grid configuration that supports component classes for renderers/editors.
|
|
1121
|
-
*
|
|
1122
|
-
* Use this input when you want to specify Angular component classes directly in column configs.
|
|
1123
|
-
* Components must implement the appropriate interfaces:
|
|
1124
|
-
* - Renderers: `AngularCellRenderer<TRow, TValue>` - requires `value()` and `row()` signal inputs
|
|
1125
|
-
* - Editors: `AngularCellEditor<TRow, TValue>` - adds `commit` and `cancel` outputs
|
|
1126
|
-
*
|
|
1127
|
-
* The directive automatically processes component classes and converts them to grid-compatible
|
|
1128
|
-
* renderer/editor functions before applying to the grid.
|
|
1129
|
-
*
|
|
1130
|
-
* @example
|
|
1131
|
-
* ```typescript
|
|
1132
|
-
* // Component that implements AngularCellEditor
|
|
1133
|
-
* @Component({...})
|
|
1134
|
-
* export class BonusEditorComponent implements AngularCellEditor<Employee, number> {
|
|
1135
|
-
* value = input.required<number>();
|
|
1136
|
-
* row = input.required<Employee>();
|
|
1137
|
-
* commit = output<number>();
|
|
1138
|
-
* cancel = output<void>();
|
|
1139
|
-
* }
|
|
1140
|
-
*
|
|
1141
|
-
* // In your grid config
|
|
1142
|
-
* config: AngularGridConfig<Employee> = {
|
|
1143
|
-
* columns: [
|
|
1144
|
-
* { field: 'name', header: 'Name' },
|
|
1145
|
-
* { field: 'bonus', header: 'Bonus', editable: true, editor: BonusEditorComponent }
|
|
1146
|
-
* ]
|
|
1147
|
-
* };
|
|
1148
|
-
* ```
|
|
1149
|
-
*
|
|
1150
|
-
* ```html
|
|
1151
|
-
* <tbw-grid [angularConfig]="config" [rows]="employees"></tbw-grid>
|
|
1152
|
-
* ```
|
|
1153
|
-
*/
|
|
1154
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1155
|
-
angularConfig = c();
|
|
1156
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
1157
|
-
// FEATURE INPUTS - Declarative plugin configuration
|
|
1158
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
1159
|
-
/**
|
|
1160
|
-
* Enable cell/row/range selection.
|
|
1161
|
-
*
|
|
1162
|
-
* **Requires feature import:**
|
|
1163
|
-
* ```typescript
|
|
1164
|
-
* import '@toolbox-web/grid-angular/features/selection';
|
|
1165
|
-
* ```
|
|
1166
|
-
*
|
|
1167
|
-
* @example
|
|
1168
|
-
* ```html
|
|
1169
|
-
* <!-- Shorthand - just the mode -->
|
|
1170
|
-
* <tbw-grid [selection]="'range'" />
|
|
1171
|
-
*
|
|
1172
|
-
* <!-- Full config object -->
|
|
1173
|
-
* <tbw-grid [selection]="{ mode: 'range', checkbox: true }" />
|
|
1174
|
-
* ```
|
|
1175
|
-
*/
|
|
1176
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1177
|
-
selection = c();
|
|
1178
|
-
/**
|
|
1179
|
-
* Enable inline cell editing.
|
|
1180
|
-
*
|
|
1181
|
-
* **Requires feature import:**
|
|
1182
|
-
* ```typescript
|
|
1183
|
-
* import '@toolbox-web/grid-angular/features/editing';
|
|
1184
|
-
* ```
|
|
1185
|
-
*
|
|
1186
|
-
* @example
|
|
1187
|
-
* ```html
|
|
1188
|
-
* <!-- Enable with default trigger (dblclick) -->
|
|
1189
|
-
* <tbw-grid [editing]="true" />
|
|
1190
|
-
*
|
|
1191
|
-
* <!-- Specify trigger -->
|
|
1192
|
-
* <tbw-grid [editing]="'click'" />
|
|
1193
|
-
* <tbw-grid [editing]="'dblclick'" />
|
|
1194
|
-
* <tbw-grid [editing]="'manual'" />
|
|
1195
|
-
* ```
|
|
1196
|
-
*/
|
|
1197
|
-
editing = c();
|
|
1198
|
-
/**
|
|
1199
|
-
* Enable clipboard copy/paste. Requires selection to be enabled.
|
|
1200
|
-
*
|
|
1201
|
-
* **Requires feature import:**
|
|
1202
|
-
* ```typescript
|
|
1203
|
-
* import '@toolbox-web/grid-angular/features/clipboard';
|
|
1204
|
-
* ```
|
|
1205
|
-
*
|
|
1206
|
-
* @example
|
|
1207
|
-
* ```html
|
|
1208
|
-
* <tbw-grid [selection]="'range'" [clipboard]="true" />
|
|
1209
|
-
* ```
|
|
1210
|
-
*/
|
|
1211
|
-
clipboard = c();
|
|
1212
|
-
/**
|
|
1213
|
-
* Enable right-click context menu.
|
|
1214
|
-
*
|
|
1215
|
-
* **Requires feature import:**
|
|
1216
|
-
* ```typescript
|
|
1217
|
-
* import '@toolbox-web/grid-angular/features/context-menu';
|
|
1218
|
-
* ```
|
|
1219
|
-
*
|
|
1220
|
-
* @example
|
|
1221
|
-
* ```html
|
|
1222
|
-
* <tbw-grid [contextMenu]="true" />
|
|
1223
|
-
* ```
|
|
1224
|
-
*/
|
|
1225
|
-
contextMenu = c();
|
|
1226
|
-
/**
|
|
1227
|
-
* Enable multi-column sorting.
|
|
1228
|
-
*
|
|
1229
|
-
* Multi-sort allows users to sort by multiple columns simultaneously.
|
|
1230
|
-
* For basic single-column sorting, columns with `sortable: true` work without this plugin.
|
|
1231
|
-
*
|
|
1232
|
-
* **Requires feature import:**
|
|
1233
|
-
* ```typescript
|
|
1234
|
-
* import '@toolbox-web/grid-angular/features/multi-sort';
|
|
1235
|
-
* ```
|
|
1236
|
-
*
|
|
1237
|
-
* @example
|
|
1238
|
-
* ```html
|
|
1239
|
-
* <!-- Enable multi-column sorting -->
|
|
1240
|
-
* <tbw-grid [multiSort]="true" />
|
|
1241
|
-
*
|
|
1242
|
-
* <!-- Limit to single column (uses plugin but restricts to 1 column) -->
|
|
1243
|
-
* <tbw-grid [multiSort]="'single'" />
|
|
1244
|
-
*
|
|
1245
|
-
* <!-- Full config -->
|
|
1246
|
-
* <tbw-grid [multiSort]="{ maxSortColumns: 3 }" />
|
|
1247
|
-
* ```
|
|
1248
|
-
*/
|
|
1249
|
-
multiSort = c();
|
|
1250
|
-
/**
|
|
1251
|
-
* @deprecated Use `[multiSort]` instead. Will be removed in a future version.
|
|
1252
|
-
*
|
|
1253
|
-
* Enable column sorting. This is an alias for `[multiSort]`.
|
|
1254
|
-
*
|
|
1255
|
-
* **Requires feature import:**
|
|
1256
|
-
* ```typescript
|
|
1257
|
-
* import '@toolbox-web/grid-angular/features/multi-sort';
|
|
1258
|
-
* ```
|
|
1259
|
-
*/
|
|
1260
|
-
sorting = c();
|
|
1261
|
-
/**
|
|
1262
|
-
* Enable column filtering.
|
|
1263
|
-
*
|
|
1264
|
-
* **Requires feature import:**
|
|
1265
|
-
* ```typescript
|
|
1266
|
-
* import '@toolbox-web/grid-angular/features/filtering';
|
|
1267
|
-
* ```
|
|
1268
|
-
*
|
|
1269
|
-
* @example
|
|
1270
|
-
* ```html
|
|
1271
|
-
* <tbw-grid [filtering]="true" />
|
|
1272
|
-
* <tbw-grid [filtering]="{ debounceMs: 200 }" />
|
|
1273
|
-
* ```
|
|
1274
|
-
*/
|
|
1275
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1276
|
-
filtering = c();
|
|
1277
|
-
/**
|
|
1278
|
-
* Enable column drag-to-reorder.
|
|
1279
|
-
*
|
|
1280
|
-
* **Requires feature import:**
|
|
1281
|
-
* ```typescript
|
|
1282
|
-
* import '@toolbox-web/grid-angular/features/reorder';
|
|
1283
|
-
* ```
|
|
1284
|
-
*
|
|
1285
|
-
* @example
|
|
1286
|
-
* ```html
|
|
1287
|
-
* <tbw-grid [reorder]="true" />
|
|
1288
|
-
* ```
|
|
1289
|
-
*/
|
|
1290
|
-
reorder = c();
|
|
1291
|
-
/**
|
|
1292
|
-
* Enable column visibility toggle panel.
|
|
1293
|
-
*
|
|
1294
|
-
* **Requires feature import:**
|
|
1295
|
-
* ```typescript
|
|
1296
|
-
* import '@toolbox-web/grid-angular/features/visibility';
|
|
1297
|
-
* ```
|
|
1298
|
-
*
|
|
1299
|
-
* @example
|
|
1300
|
-
* ```html
|
|
1301
|
-
* <tbw-grid [visibility]="true" />
|
|
1302
|
-
* ```
|
|
1303
|
-
*/
|
|
1304
|
-
visibility = c();
|
|
1305
|
-
/**
|
|
1306
|
-
* Enable pinned/sticky columns.
|
|
1307
|
-
* Columns are pinned via the `sticky` column property.
|
|
1308
|
-
*
|
|
1309
|
-
* **Requires feature import:**
|
|
1310
|
-
* ```typescript
|
|
1311
|
-
* import '@toolbox-web/grid-angular/features/pinned-columns';
|
|
1312
|
-
* ```
|
|
1313
|
-
*
|
|
1314
|
-
* @example
|
|
1315
|
-
* ```html
|
|
1316
|
-
* <tbw-grid [pinnedColumns]="true" [columns]="[
|
|
1317
|
-
* { field: 'id', sticky: 'left' },
|
|
1318
|
-
* { field: 'name' },
|
|
1319
|
-
* { field: 'actions', sticky: 'right' }
|
|
1320
|
-
* ]" />
|
|
1321
|
-
* ```
|
|
1322
|
-
*/
|
|
1323
|
-
pinnedColumns = c();
|
|
1324
|
-
/**
|
|
1325
|
-
* Enable multi-level column headers (column groups).
|
|
1326
|
-
*
|
|
1327
|
-
* **Requires feature import:**
|
|
1328
|
-
* ```typescript
|
|
1329
|
-
* import '@toolbox-web/grid-angular/features/grouping-columns';
|
|
1330
|
-
* ```
|
|
1331
|
-
*
|
|
1332
|
-
* @example
|
|
1333
|
-
* ```html
|
|
1334
|
-
* <tbw-grid [groupingColumns]="{ columnGroups: [...] }" />
|
|
1335
|
-
* ```
|
|
1336
|
-
*/
|
|
1337
|
-
groupingColumns = c();
|
|
1338
|
-
/**
|
|
1339
|
-
* Enable horizontal column virtualization for wide grids.
|
|
1340
|
-
*
|
|
1341
|
-
* **Requires feature import:**
|
|
1342
|
-
* ```typescript
|
|
1343
|
-
* import '@toolbox-web/grid-angular/features/column-virtualization';
|
|
1344
|
-
* ```
|
|
1345
|
-
*
|
|
1346
|
-
* @example
|
|
1347
|
-
* ```html
|
|
1348
|
-
* <tbw-grid [columnVirtualization]="true" />
|
|
1349
|
-
* ```
|
|
1350
|
-
*/
|
|
1351
|
-
columnVirtualization = c();
|
|
1352
|
-
/**
|
|
1353
|
-
* Enable row drag-to-reorder.
|
|
1354
|
-
*
|
|
1355
|
-
* **Requires feature import:**
|
|
1356
|
-
* ```typescript
|
|
1357
|
-
* import '@toolbox-web/grid-angular/features/row-reorder';
|
|
1358
|
-
* ```
|
|
1359
|
-
*
|
|
1360
|
-
* @example
|
|
1361
|
-
* ```html
|
|
1362
|
-
* <tbw-grid [rowReorder]="true" />
|
|
1363
|
-
* ```
|
|
1364
|
-
*/
|
|
1365
|
-
rowReorder = c();
|
|
1366
|
-
/**
|
|
1367
|
-
* Enable row grouping by field values.
|
|
1368
|
-
*
|
|
1369
|
-
* **Requires feature import:**
|
|
1370
|
-
* ```typescript
|
|
1371
|
-
* import '@toolbox-web/grid-angular/features/grouping-rows';
|
|
1372
|
-
* ```
|
|
1373
|
-
*
|
|
1374
|
-
* @example
|
|
1375
|
-
* ```html
|
|
1376
|
-
* <tbw-grid [groupingRows]="{ groupBy: ['department'] }" />
|
|
1377
|
-
* ```
|
|
1378
|
-
*/
|
|
1379
|
-
groupingRows = c();
|
|
1380
|
-
/**
|
|
1381
|
-
* Enable pinned rows (aggregation/status bar).
|
|
1382
|
-
*
|
|
1383
|
-
* **Requires feature import:**
|
|
1384
|
-
* ```typescript
|
|
1385
|
-
* import '@toolbox-web/grid-angular/features/pinned-rows';
|
|
1386
|
-
* ```
|
|
1387
|
-
*
|
|
1388
|
-
* @example
|
|
1389
|
-
* ```html
|
|
1390
|
-
* <tbw-grid [pinnedRows]="{ bottom: [{ type: 'aggregation' }] }" />
|
|
1391
|
-
* ```
|
|
1392
|
-
*/
|
|
1393
|
-
pinnedRows = c();
|
|
1394
|
-
/**
|
|
1395
|
-
* Enable hierarchical tree view.
|
|
1396
|
-
*
|
|
1397
|
-
* **Requires feature import:**
|
|
1398
|
-
* ```typescript
|
|
1399
|
-
* import '@toolbox-web/grid-angular/features/tree';
|
|
1400
|
-
* ```
|
|
1401
|
-
*
|
|
1402
|
-
* @example
|
|
1403
|
-
* ```html
|
|
1404
|
-
* <tbw-grid [tree]="{ childrenField: 'children' }" />
|
|
1405
|
-
* ```
|
|
1406
|
-
*/
|
|
1407
|
-
tree = c();
|
|
1408
|
-
/**
|
|
1409
|
-
* Enable master-detail expandable rows.
|
|
1410
|
-
*
|
|
1411
|
-
* **Requires feature import:**
|
|
1412
|
-
* ```typescript
|
|
1413
|
-
* import '@toolbox-web/grid-angular/features/master-detail';
|
|
1414
|
-
* ```
|
|
1415
|
-
*
|
|
1416
|
-
* @example
|
|
1417
|
-
* ```html
|
|
1418
|
-
* <tbw-grid [masterDetail]="{ detailRenderer: detailFn }" />
|
|
1419
|
-
* ```
|
|
1420
|
-
*/
|
|
1421
|
-
masterDetail = c();
|
|
1422
|
-
/**
|
|
1423
|
-
* Enable responsive card layout for narrow viewports.
|
|
1424
|
-
*
|
|
1425
|
-
* **Requires feature import:**
|
|
1426
|
-
* ```typescript
|
|
1427
|
-
* import '@toolbox-web/grid-angular/features/responsive';
|
|
1428
|
-
* ```
|
|
1429
|
-
*
|
|
1430
|
-
* @example
|
|
1431
|
-
* ```html
|
|
1432
|
-
* <tbw-grid [responsive]="{ breakpoint: 768 }" />
|
|
1433
|
-
* ```
|
|
1434
|
-
*/
|
|
1435
|
-
responsive = c();
|
|
1436
|
-
/**
|
|
1437
|
-
* Enable undo/redo for cell edits. Requires editing to be enabled.
|
|
1438
|
-
*
|
|
1439
|
-
* **Requires feature import:**
|
|
1440
|
-
* ```typescript
|
|
1441
|
-
* import '@toolbox-web/grid-angular/features/undo-redo';
|
|
1442
|
-
* ```
|
|
1443
|
-
*
|
|
1444
|
-
* @example
|
|
1445
|
-
* ```html
|
|
1446
|
-
* <tbw-grid [editing]="'dblclick'" [undoRedo]="true" />
|
|
1447
|
-
* ```
|
|
1448
|
-
*/
|
|
1449
|
-
undoRedo = c();
|
|
1450
|
-
/**
|
|
1451
|
-
* Enable CSV/JSON export functionality.
|
|
1452
|
-
*
|
|
1453
|
-
* **Requires feature import:**
|
|
1454
|
-
* ```typescript
|
|
1455
|
-
* import '@toolbox-web/grid-angular/features/export';
|
|
1456
|
-
* ```
|
|
1457
|
-
*
|
|
1458
|
-
* @example
|
|
1459
|
-
* ```html
|
|
1460
|
-
* <tbw-grid [export]="true" />
|
|
1461
|
-
* <tbw-grid [export]="{ filename: 'data.csv' }" />
|
|
1462
|
-
* ```
|
|
1463
|
-
*/
|
|
1464
|
-
exportFeature = c();
|
|
1465
|
-
/**
|
|
1466
|
-
* Enable print functionality.
|
|
1467
|
-
*
|
|
1468
|
-
* **Requires feature import:**
|
|
1469
|
-
* ```typescript
|
|
1470
|
-
* import '@toolbox-web/grid-angular/features/print';
|
|
1471
|
-
* ```
|
|
1472
|
-
*
|
|
1473
|
-
* @example
|
|
1474
|
-
* ```html
|
|
1475
|
-
* <tbw-grid [print]="true" />
|
|
1476
|
-
* ```
|
|
1477
|
-
*/
|
|
1478
|
-
print = c();
|
|
1479
|
-
/**
|
|
1480
|
-
* Enable pivot table functionality.
|
|
1481
|
-
*
|
|
1482
|
-
* **Requires feature import:**
|
|
1483
|
-
* ```typescript
|
|
1484
|
-
* import '@toolbox-web/grid-angular/features/pivot';
|
|
1485
|
-
* ```
|
|
1486
|
-
*
|
|
1487
|
-
* @example
|
|
1488
|
-
* ```html
|
|
1489
|
-
* <tbw-grid [pivot]="{ rowFields: ['category'], valueField: 'sales' }" />
|
|
1490
|
-
* ```
|
|
1491
|
-
*/
|
|
1492
|
-
pivot = c();
|
|
1493
|
-
/**
|
|
1494
|
-
* Enable server-side data operations.
|
|
1495
|
-
*
|
|
1496
|
-
* **Requires feature import:**
|
|
1497
|
-
* ```typescript
|
|
1498
|
-
* import '@toolbox-web/grid-angular/features/server-side';
|
|
1499
|
-
* ```
|
|
1500
|
-
*
|
|
1501
|
-
* @example
|
|
1502
|
-
* ```html
|
|
1503
|
-
* <tbw-grid [serverSide]="{ dataSource: fetchDataFn }" />
|
|
1504
|
-
* ```
|
|
1505
|
-
*/
|
|
1506
|
-
serverSide = c();
|
|
1507
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
1508
|
-
// EVENT OUTPUTS - All grid events
|
|
1509
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
1510
|
-
/**
|
|
1511
|
-
* Emitted when a cell is clicked.
|
|
1512
|
-
*
|
|
1513
|
-
* @example
|
|
1514
|
-
* ```html
|
|
1515
|
-
* <tbw-grid (cellClick)="onCellClick($event)">...</tbw-grid>
|
|
1516
|
-
* ```
|
|
1517
|
-
*/
|
|
1518
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1519
|
-
cellClick = p();
|
|
1520
|
-
/**
|
|
1521
|
-
* Emitted when a row is clicked.
|
|
1522
|
-
*
|
|
1523
|
-
* @example
|
|
1524
|
-
* ```html
|
|
1525
|
-
* <tbw-grid (rowClick)="onRowClick($event)">...</tbw-grid>
|
|
1526
|
-
* ```
|
|
1527
|
-
*/
|
|
1528
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1529
|
-
rowClick = p();
|
|
1530
|
-
/**
|
|
1531
|
-
* Emitted when a cell is activated (Enter key or double-click).
|
|
1532
|
-
*
|
|
1533
|
-
* @example
|
|
1534
|
-
* ```html
|
|
1535
|
-
* <tbw-grid (cellActivate)="onCellActivate($event)">...</tbw-grid>
|
|
1536
|
-
* ```
|
|
1537
|
-
*/
|
|
1538
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1539
|
-
cellActivate = p();
|
|
1540
|
-
/**
|
|
1541
|
-
* Emitted when a cell value changes (before commit).
|
|
1542
|
-
*
|
|
1543
|
-
* @example
|
|
1544
|
-
* ```html
|
|
1545
|
-
* <tbw-grid (cellChange)="onCellChange($event)">...</tbw-grid>
|
|
1546
|
-
* ```
|
|
1547
|
-
*/
|
|
1548
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1549
|
-
cellChange = p();
|
|
1550
|
-
/**
|
|
1551
|
-
* Emitted when a cell value is committed (inline editing).
|
|
1552
|
-
* Provides the row, field, new value, and change tracking information.
|
|
1553
|
-
*
|
|
1554
|
-
* @example
|
|
1555
|
-
* ```html
|
|
1556
|
-
* <tbw-grid (cellCommit)="onCellCommit($event)">...</tbw-grid>
|
|
1557
|
-
* ```
|
|
1558
|
-
*
|
|
1559
|
-
* ```typescript
|
|
1560
|
-
* onCellCommit(event: CellCommitEvent) {
|
|
1561
|
-
* console.log(`Changed ${event.field} to ${event.value} in row ${event.rowIndex}`);
|
|
1562
|
-
* }
|
|
1563
|
-
* ```
|
|
1564
|
-
*/
|
|
1565
|
-
cellCommit = p();
|
|
1566
|
-
/**
|
|
1567
|
-
* Emitted when a row's values are committed (bulk/row editing).
|
|
1568
|
-
* Provides the row data and change tracking information.
|
|
1569
|
-
*
|
|
1570
|
-
* @example
|
|
1571
|
-
* ```html
|
|
1572
|
-
* <tbw-grid (rowCommit)="onRowCommit($event)">...</tbw-grid>
|
|
1573
|
-
* ```
|
|
1574
|
-
*/
|
|
1575
|
-
rowCommit = p();
|
|
1576
|
-
/**
|
|
1577
|
-
* Emitted when the changed rows are reset.
|
|
1578
|
-
*
|
|
1579
|
-
* @example
|
|
1580
|
-
* ```html
|
|
1581
|
-
* <tbw-grid (changedRowsReset)="onChangedRowsReset($event)">...</tbw-grid>
|
|
1582
|
-
* ```
|
|
1583
|
-
*/
|
|
1584
|
-
changedRowsReset = p();
|
|
1585
|
-
/**
|
|
1586
|
-
* Emitted when sort state changes.
|
|
1587
|
-
*
|
|
1588
|
-
* @example
|
|
1589
|
-
* ```html
|
|
1590
|
-
* <tbw-grid (sortChange)="onSortChange($event)">...</tbw-grid>
|
|
1591
|
-
* ```
|
|
1592
|
-
*/
|
|
1593
|
-
sortChange = p();
|
|
1594
|
-
/**
|
|
1595
|
-
* Emitted when filter values change.
|
|
1596
|
-
*
|
|
1597
|
-
* @example
|
|
1598
|
-
* ```html
|
|
1599
|
-
* <tbw-grid (filterChange)="onFilterChange($event)">...</tbw-grid>
|
|
1600
|
-
* ```
|
|
1601
|
-
*/
|
|
1602
|
-
filterChange = p();
|
|
1603
|
-
/**
|
|
1604
|
-
* Emitted when a column is resized.
|
|
1605
|
-
*
|
|
1606
|
-
* @example
|
|
1607
|
-
* ```html
|
|
1608
|
-
* <tbw-grid (columnResize)="onColumnResize($event)">...</tbw-grid>
|
|
1609
|
-
* ```
|
|
1610
|
-
*/
|
|
1611
|
-
columnResize = p();
|
|
1612
|
-
/**
|
|
1613
|
-
* Emitted when a column is moved via drag-and-drop.
|
|
1614
|
-
*
|
|
1615
|
-
* @example
|
|
1616
|
-
* ```html
|
|
1617
|
-
* <tbw-grid (columnMove)="onColumnMove($event)">...</tbw-grid>
|
|
1618
|
-
* ```
|
|
1619
|
-
*/
|
|
1620
|
-
columnMove = p();
|
|
1621
|
-
/**
|
|
1622
|
-
* Emitted when column visibility changes.
|
|
1623
|
-
*
|
|
1624
|
-
* @example
|
|
1625
|
-
* ```html
|
|
1626
|
-
* <tbw-grid (columnVisibility)="onColumnVisibility($event)">...</tbw-grid>
|
|
1627
|
-
* ```
|
|
1628
|
-
*/
|
|
1629
|
-
columnVisibility = p();
|
|
1630
|
-
/**
|
|
1631
|
-
* Emitted when column state changes (resize, reorder, visibility).
|
|
1632
|
-
*
|
|
1633
|
-
* @example
|
|
1634
|
-
* ```html
|
|
1635
|
-
* <tbw-grid (columnStateChange)="onColumnStateChange($event)">...</tbw-grid>
|
|
1636
|
-
* ```
|
|
1637
|
-
*/
|
|
1638
|
-
columnStateChange = p();
|
|
1639
|
-
/**
|
|
1640
|
-
* Emitted when selection changes.
|
|
1641
|
-
*
|
|
1642
|
-
* @example
|
|
1643
|
-
* ```html
|
|
1644
|
-
* <tbw-grid (selectionChange)="onSelectionChange($event)">...</tbw-grid>
|
|
1645
|
-
* ```
|
|
1646
|
-
*/
|
|
1647
|
-
selectionChange = p();
|
|
1648
|
-
/**
|
|
1649
|
-
* Emitted when a row is moved via drag-and-drop.
|
|
1650
|
-
*
|
|
1651
|
-
* @example
|
|
1652
|
-
* ```html
|
|
1653
|
-
* <tbw-grid (rowMove)="onRowMove($event)">...</tbw-grid>
|
|
1654
|
-
* ```
|
|
1655
|
-
*/
|
|
1656
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1657
|
-
rowMove = p();
|
|
1658
|
-
/**
|
|
1659
|
-
* Emitted when a group is expanded or collapsed.
|
|
1660
|
-
*
|
|
1661
|
-
* @example
|
|
1662
|
-
* ```html
|
|
1663
|
-
* <tbw-grid (groupToggle)="onGroupToggle($event)">...</tbw-grid>
|
|
1664
|
-
* ```
|
|
1665
|
-
*/
|
|
1666
|
-
groupToggle = p();
|
|
1667
|
-
/**
|
|
1668
|
-
* Emitted when a tree node is expanded.
|
|
1669
|
-
*
|
|
1670
|
-
* @example
|
|
1671
|
-
* ```html
|
|
1672
|
-
* <tbw-grid (treeExpand)="onTreeExpand($event)">...</tbw-grid>
|
|
1673
|
-
* ```
|
|
1674
|
-
*/
|
|
1675
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1676
|
-
treeExpand = p();
|
|
1677
|
-
/**
|
|
1678
|
-
* Emitted when a detail panel is expanded or collapsed.
|
|
1679
|
-
*
|
|
1680
|
-
* @example
|
|
1681
|
-
* ```html
|
|
1682
|
-
* <tbw-grid (detailExpand)="onDetailExpand($event)">...</tbw-grid>
|
|
1683
|
-
* ```
|
|
1684
|
-
*/
|
|
1685
|
-
detailExpand = p();
|
|
1686
|
-
/**
|
|
1687
|
-
* Emitted when responsive mode changes (table ↔ card).
|
|
1688
|
-
*
|
|
1689
|
-
* @example
|
|
1690
|
-
* ```html
|
|
1691
|
-
* <tbw-grid (responsiveChange)="onResponsiveChange($event)">...</tbw-grid>
|
|
1692
|
-
* ```
|
|
1693
|
-
*/
|
|
1694
|
-
responsiveChange = p();
|
|
1695
|
-
/**
|
|
1696
|
-
* Emitted when cells are copied to clipboard.
|
|
1697
|
-
*
|
|
1698
|
-
* @example
|
|
1699
|
-
* ```html
|
|
1700
|
-
* <tbw-grid (copy)="onCopy($event)">...</tbw-grid>
|
|
1701
|
-
* ```
|
|
1702
|
-
*/
|
|
1703
|
-
copy = p();
|
|
1704
|
-
/**
|
|
1705
|
-
* Emitted when cells are pasted from clipboard.
|
|
1706
|
-
*
|
|
1707
|
-
* @example
|
|
1708
|
-
* ```html
|
|
1709
|
-
* <tbw-grid (paste)="onPaste($event)">...</tbw-grid>
|
|
1710
|
-
* ```
|
|
1711
|
-
*/
|
|
1712
|
-
paste = p();
|
|
1713
|
-
/**
|
|
1714
|
-
* Emitted when undo/redo is performed.
|
|
1715
|
-
*
|
|
1716
|
-
* @example
|
|
1717
|
-
* ```html
|
|
1718
|
-
* <tbw-grid (undoRedoAction)="onUndoRedo($event)">...</tbw-grid>
|
|
1719
|
-
* ```
|
|
1720
|
-
*/
|
|
1721
|
-
undoRedoAction = p();
|
|
1722
|
-
/**
|
|
1723
|
-
* Emitted when export completes.
|
|
1724
|
-
*
|
|
1725
|
-
* @example
|
|
1726
|
-
* ```html
|
|
1727
|
-
* <tbw-grid (exportComplete)="onExportComplete($event)">...</tbw-grid>
|
|
1728
|
-
* ```
|
|
1729
|
-
*/
|
|
1730
|
-
exportComplete = p();
|
|
1731
|
-
/**
|
|
1732
|
-
* Emitted when print starts.
|
|
1733
|
-
*
|
|
1734
|
-
* @example
|
|
1735
|
-
* ```html
|
|
1736
|
-
* <tbw-grid (printStart)="onPrintStart($event)">...</tbw-grid>
|
|
1737
|
-
* ```
|
|
1738
|
-
*/
|
|
1739
|
-
printStart = p();
|
|
1740
|
-
/**
|
|
1741
|
-
* Emitted when print completes.
|
|
1742
|
-
*
|
|
1743
|
-
* @example
|
|
1744
|
-
* ```html
|
|
1745
|
-
* <tbw-grid (printComplete)="onPrintComplete($event)">...</tbw-grid>
|
|
1746
|
-
* ```
|
|
1747
|
-
*/
|
|
1748
|
-
printComplete = p();
|
|
1749
|
-
// Map of output names to event names for automatic wiring
|
|
1750
|
-
eventOutputMap = {
|
|
1751
|
-
cellClick: "cell-click",
|
|
1752
|
-
rowClick: "row-click",
|
|
1753
|
-
cellActivate: "cell-activate",
|
|
1754
|
-
cellChange: "cell-change",
|
|
1755
|
-
cellCommit: "cell-commit",
|
|
1756
|
-
rowCommit: "row-commit",
|
|
1757
|
-
changedRowsReset: "changed-rows-reset",
|
|
1758
|
-
sortChange: "sort-change",
|
|
1759
|
-
filterChange: "filter-change",
|
|
1760
|
-
columnResize: "column-resize",
|
|
1761
|
-
columnMove: "column-move",
|
|
1762
|
-
columnVisibility: "column-visibility",
|
|
1763
|
-
columnStateChange: "column-state-change",
|
|
1764
|
-
selectionChange: "selection-change",
|
|
1765
|
-
rowMove: "row-move",
|
|
1766
|
-
groupToggle: "group-toggle",
|
|
1767
|
-
treeExpand: "tree-expand",
|
|
1768
|
-
detailExpand: "detail-expand",
|
|
1769
|
-
responsiveChange: "responsive-change",
|
|
1770
|
-
copy: "copy",
|
|
1771
|
-
paste: "paste",
|
|
1772
|
-
undoRedoAction: "undo-redo",
|
|
1773
|
-
exportComplete: "export-complete",
|
|
1774
|
-
printStart: "print-start",
|
|
1775
|
-
printComplete: "print-complete"
|
|
1776
|
-
};
|
|
1777
|
-
// Store event listeners for cleanup
|
|
1778
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1779
|
-
eventListeners = /* @__PURE__ */ new Map();
|
|
1780
|
-
ngOnInit() {
|
|
1781
|
-
this.adapter = new ct(this.injector, this.appRef, this.viewContainerRef), nt.registerAdapter(this.adapter);
|
|
1782
|
-
const e = this.elementRef.nativeElement;
|
|
1783
|
-
this.setupEventListeners(e), e.__frameworkAdapter = this.adapter;
|
|
1784
|
-
}
|
|
1785
|
-
/**
|
|
1786
|
-
* Sets up event listeners for all outputs using the eventOutputMap.
|
|
1787
|
-
*/
|
|
1788
|
-
setupEventListeners(e) {
|
|
1789
|
-
for (const [t, n] of Object.entries(this.eventOutputMap)) {
|
|
1790
|
-
const r = (o) => {
|
|
1791
|
-
const s = o.detail;
|
|
1792
|
-
this[t].emit(s);
|
|
1793
|
-
};
|
|
1794
|
-
e.addEventListener(n, r), this.eventListeners.set(n, r);
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
/**
|
|
1798
|
-
* Creates plugins from feature inputs.
|
|
1799
|
-
* Uses the feature registry to allow tree-shaking - only imported features are bundled.
|
|
1800
|
-
* Returns the array of created plugins (doesn't modify grid).
|
|
1801
|
-
*/
|
|
1802
|
-
createFeaturePlugins() {
|
|
1803
|
-
const e = [], t = (n, r) => {
|
|
1804
|
-
if (r == null || r === !1) return;
|
|
1805
|
-
const o = tt(n, r);
|
|
1806
|
-
o && e.push(o);
|
|
1807
|
-
};
|
|
1808
|
-
return t("selection", this.selection()), t("editing", this.editing()), t("clipboard", this.clipboard()), t("contextMenu", this.contextMenu()), t("multiSort", this.multiSort() ?? this.sorting()), t("filtering", this.filtering()), t("reorder", this.reorder()), t("visibility", this.visibility()), t("pinnedColumns", this.pinnedColumns()), t("groupingColumns", this.groupingColumns()), t("columnVirtualization", this.columnVirtualization()), t("rowReorder", this.rowReorder()), t("groupingRows", this.groupingRows()), t("pinnedRows", this.pinnedRows()), t("tree", this.tree()), t("masterDetail", this.masterDetail()), t("responsive", this.responsive()), t("undoRedo", this.undoRedo()), t("export", this.exportFeature()), t("print", this.print()), t("pivot", this.pivot()), t("serverSide", this.serverSide()), e;
|
|
1809
|
-
}
|
|
1810
|
-
ngAfterContentInit() {
|
|
1811
|
-
const e = this.elementRef.nativeElement;
|
|
1812
|
-
e && typeof e.refreshColumns == "function" && setTimeout(() => {
|
|
1813
|
-
e.refreshColumns(), this.configureMasterDetail(e), this.configureResponsiveCard(e), typeof e.refreshShellHeader == "function" && e.refreshShellHeader(), this.registerCustomStyles(e);
|
|
1814
|
-
}, 0);
|
|
1815
|
-
}
|
|
1816
|
-
/**
|
|
1817
|
-
* Registers custom styles into the grid.
|
|
1818
|
-
* Uses the grid's registerStyles() API for clean encapsulation.
|
|
1819
|
-
*/
|
|
1820
|
-
registerCustomStyles(e) {
|
|
1821
|
-
const t = this.customStyles();
|
|
1822
|
-
t && e.ready?.().then(() => {
|
|
1823
|
-
e.registerStyles?.("angular-custom-styles", t);
|
|
1824
|
-
});
|
|
1825
|
-
}
|
|
1826
|
-
/**
|
|
1827
|
-
* Configures the MasterDetailPlugin after Angular templates are registered.
|
|
1828
|
-
* - If plugin exists: refresh its detail renderer
|
|
1829
|
-
* - If plugin doesn't exist but <tbw-grid-detail> is present: dynamically import and add the plugin
|
|
1830
|
-
*/
|
|
1831
|
-
async configureMasterDetail(e) {
|
|
1832
|
-
if (!this.adapter) return;
|
|
1833
|
-
const t = e.gridConfig?.plugins?.find((R) => R.name === "masterDetail");
|
|
1834
|
-
if (t && typeof t.refreshDetailRenderer == "function") {
|
|
1835
|
-
t.refreshDetailRenderer();
|
|
1836
|
-
return;
|
|
1837
|
-
}
|
|
1838
|
-
const n = e.querySelector("tbw-grid-detail");
|
|
1839
|
-
if (!n) return;
|
|
1840
|
-
const r = this.adapter.createDetailRenderer(e);
|
|
1841
|
-
if (!r) return;
|
|
1842
|
-
const o = n.getAttribute("animation");
|
|
1843
|
-
let s = "slide";
|
|
1844
|
-
o === "false" ? s = !1 : o === "fade" && (s = "fade");
|
|
1845
|
-
const l = n.getAttribute("showExpandColumn") !== "false", { MasterDetailPlugin: f } = await import("@toolbox-web/grid/plugins/master-detail"), g = new f({
|
|
1846
|
-
detailRenderer: r,
|
|
1847
|
-
showExpandColumn: l,
|
|
1848
|
-
animation: s
|
|
1849
|
-
}), E = e.gridConfig || {}, a = E.plugins || [];
|
|
1850
|
-
e.gridConfig = {
|
|
1851
|
-
...E,
|
|
1852
|
-
plugins: [...a, g]
|
|
1853
|
-
};
|
|
1854
|
-
}
|
|
1855
|
-
/**
|
|
1856
|
-
* Configures the ResponsivePlugin with Angular template-based card renderer.
|
|
1857
|
-
* - If plugin exists: updates its cardRenderer configuration
|
|
1858
|
-
* - If plugin doesn't exist but <tbw-grid-responsive-card> is present: logs a warning
|
|
1859
|
-
*/
|
|
1860
|
-
configureResponsiveCard(e) {
|
|
1861
|
-
if (!this.adapter || !e.querySelector("tbw-grid-responsive-card")) return;
|
|
1862
|
-
const n = this.adapter.createResponsiveCardRenderer(e);
|
|
1863
|
-
if (!n) return;
|
|
1864
|
-
const r = e.gridConfig?.plugins?.find((o) => o.name === "responsive");
|
|
1865
|
-
if (r && typeof r.setCardRenderer == "function") {
|
|
1866
|
-
r.setCardRenderer(n);
|
|
1867
|
-
return;
|
|
1868
|
-
}
|
|
1869
|
-
console.warn(
|
|
1870
|
-
`[tbw-grid-angular] <tbw-grid-responsive-card> found but ResponsivePlugin is not configured.
|
|
1871
|
-
Add ResponsivePlugin to your gridConfig.plugins array:
|
|
1872
|
-
|
|
1873
|
-
import { ResponsivePlugin } from "@toolbox-web/grid/plugins/responsive";
|
|
1874
|
-
gridConfig = {
|
|
1875
|
-
plugins: [new ResponsivePlugin({ breakpoint: 600 })]
|
|
1876
|
-
};`
|
|
1877
|
-
);
|
|
1878
|
-
}
|
|
1879
|
-
ngOnDestroy() {
|
|
1880
|
-
const e = this.elementRef.nativeElement;
|
|
1881
|
-
if (e) {
|
|
1882
|
-
for (const [t, n] of this.eventListeners)
|
|
1883
|
-
e.removeEventListener(t, n);
|
|
1884
|
-
this.eventListeners.clear();
|
|
1885
|
-
}
|
|
1886
|
-
e && this.customStyles() && e.unregisterStyles?.("angular-custom-styles"), this.adapter && (this.adapter.destroy?.(), this.adapter = null);
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
se = y(null), Y = T(se, 0, "Grid", Me, Y), b(se, 1, Y);
|
|
1890
|
-
export {
|
|
1891
|
-
ct as AngularGridAdapter,
|
|
1892
|
-
H as BaseGridEditor,
|
|
1893
|
-
qe as GRID_TYPE_DEFAULTS,
|
|
1894
|
-
Y as Grid,
|
|
1895
|
-
q as GridColumnEditor,
|
|
1896
|
-
_ as GridColumnView,
|
|
1897
|
-
$ as GridDetailView,
|
|
1898
|
-
z as GridFormArray,
|
|
1899
|
-
B as GridResponsiveCard,
|
|
1900
|
-
U as GridToolPanel,
|
|
1901
|
-
I as GridTypeRegistry,
|
|
1902
|
-
W as TbwCellEditor,
|
|
1903
|
-
J as TbwCellView,
|
|
1904
|
-
W as TbwEditor,
|
|
1905
|
-
J as TbwRenderer,
|
|
1906
|
-
wt as clearFeatureRegistry,
|
|
1907
|
-
tt as createPluginFromFeature,
|
|
1908
|
-
Rt as getFeatureFactory,
|
|
1909
|
-
rt as getFormArrayContext,
|
|
1910
|
-
Ct as getRegisteredFeatures,
|
|
1911
|
-
gt as injectGrid,
|
|
1912
|
-
we as isComponentClass,
|
|
1913
|
-
Et as isFeatureRegistered,
|
|
1914
|
-
ft as provideGridTypeDefaults,
|
|
1915
|
-
yt as registerFeature
|
|
1916
|
-
};
|