@toolbox-web/grid-angular 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +296 -16
- package/feature-registry-C-cKloXB.js +45 -0
- package/features/clipboard.d.ts +18 -0
- package/features/clipboard.d.ts.map +1 -0
- package/features/clipboard.js +3 -0
- package/features/column-virtualization.d.ts +16 -0
- package/features/column-virtualization.d.ts.map +1 -0
- package/features/column-virtualization.js +3 -0
- package/features/context-menu.d.ts +16 -0
- package/features/context-menu.d.ts.map +1 -0
- package/features/context-menu.js +3 -0
- package/features/editing.d.ts +16 -0
- package/features/editing.d.ts.map +1 -0
- package/features/editing.js +3 -0
- package/features/export.d.ts +17 -0
- package/features/export.d.ts.map +1 -0
- package/features/export.js +3 -0
- package/features/filtering.d.ts +17 -0
- package/features/filtering.d.ts.map +1 -0
- package/features/filtering.js +3 -0
- package/features/grouping-columns.d.ts +16 -0
- package/features/grouping-columns.d.ts.map +1 -0
- package/features/grouping-columns.js +3 -0
- package/features/grouping-rows.d.ts +16 -0
- package/features/grouping-rows.d.ts.map +1 -0
- package/features/grouping-rows.js +3 -0
- package/features/index.d.ts +1 -0
- package/features/index.d.ts.map +1 -0
- package/features/index.js +22 -0
- package/features/master-detail.d.ts +16 -0
- package/features/master-detail.d.ts.map +1 -0
- package/features/master-detail.js +3 -0
- package/features/pinned-columns.d.ts +19 -0
- package/features/pinned-columns.d.ts.map +1 -0
- package/features/pinned-columns.js +3 -0
- package/features/pinned-rows.d.ts +16 -0
- package/features/pinned-rows.d.ts.map +1 -0
- package/features/pinned-rows.js +3 -0
- package/features/pivot.d.ts +16 -0
- package/features/pivot.d.ts.map +1 -0
- package/features/pivot.js +3 -0
- package/features/print.d.ts +16 -0
- package/features/print.d.ts.map +1 -0
- package/features/print.js +3 -0
- package/features/reorder.d.ts +16 -0
- package/features/reorder.d.ts.map +1 -0
- package/features/reorder.js +3 -0
- package/features/responsive.d.ts +16 -0
- package/features/responsive.d.ts.map +1 -0
- package/features/responsive.js +3 -0
- package/features/row-reorder.d.ts +16 -0
- package/features/row-reorder.d.ts.map +1 -0
- package/features/row-reorder.js +3 -0
- package/features/selection.d.ts +16 -0
- package/features/selection.d.ts.map +1 -0
- package/features/selection.js +3 -0
- package/features/server-side.d.ts +16 -0
- package/features/server-side.d.ts.map +1 -0
- package/features/server-side.js +3 -0
- package/features/sorting.d.ts +16 -0
- package/features/sorting.d.ts.map +1 -0
- package/features/sorting.js +3 -0
- package/features/tree.d.ts +16 -0
- package/features/tree.d.ts.map +1 -0
- package/features/tree.js +3 -0
- package/features/undo-redo.d.ts +18 -0
- package/features/undo-redo.d.ts.map +1 -0
- package/features/undo-redo.js +3 -0
- package/features/visibility.d.ts +16 -0
- package/features/visibility.d.ts.map +1 -0
- package/features/visibility.js +3 -0
- package/index.d.ts +7 -0
- package/index.d.ts.map +1 -1
- package/index.js +1272 -294
- package/lib/angular-column-config.d.ts +1 -1
- package/lib/angular-grid-adapter.d.ts +1 -1
- package/lib/angular-grid-adapter.d.ts.map +1 -1
- package/lib/base-grid-editor.d.ts +145 -0
- package/lib/base-grid-editor.d.ts.map +1 -0
- package/lib/directives/grid-column-editor.directive.d.ts +17 -0
- package/lib/directives/grid-column-editor.directive.d.ts.map +1 -1
- package/lib/directives/grid-detail-view.directive.d.ts +1 -1
- package/lib/directives/grid-form-array.directive.d.ts +141 -0
- package/lib/directives/grid-form-array.directive.d.ts.map +1 -0
- package/lib/directives/grid.directive.d.ts +554 -3
- package/lib/directives/grid.directive.d.ts.map +1 -1
- package/lib/directives/index.d.ts +2 -0
- package/lib/directives/index.d.ts.map +1 -1
- package/lib/directives/structural-directives.d.ts +10 -0
- package/lib/directives/structural-directives.d.ts.map +1 -1
- package/lib/feature-registry.d.ts +72 -0
- package/lib/feature-registry.d.ts.map +1 -0
- package/lib/grid-type-registry.d.ts +1 -1
- package/lib/inject-grid.d.ts +109 -0
- package/lib/inject-grid.d.ts.map +1 -0
- package/package.json +12 -2
package/index.js
CHANGED
|
@@ -1,54 +1,56 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
throw TypeError(
|
|
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
6
|
};
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
for (var
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
return
|
|
15
|
-
}, set [t](
|
|
16
|
-
return
|
|
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 E = (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]), y = (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
|
+
}, b = (i, e, t, n, r, o) => {
|
|
13
|
+
var s, l, g, w, A, a = e & 7, R = !!(e & 8), f = !!(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 && (!f && !R && (r = r.prototype), a < 5 && (a > 3 || !f) && $e(a < 4 ? r : { get [t]() {
|
|
14
|
+
return me(this, o);
|
|
15
|
+
}, set [t](h) {
|
|
16
|
+
return de(this, o, h);
|
|
17
17
|
} }, t));
|
|
18
|
-
a ? f && a < 4 &&
|
|
19
|
-
for (var
|
|
20
|
-
|
|
21
|
-
return a ||
|
|
18
|
+
a ? f && 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
|
+
w = Be(a, t, g = {}, i[3], m), a && (w.static = R, w.private = f, A = w.access = { has: f ? (h) => Je(r, h) : (h) => t in h }, a ^ 3 && (A.get = f ? (h) => (a ^ 1 ? me : We)(h, r, a ^ 4 ? o : d.get) : (h) => h[t]), a > 2 && (A.set = f ? (h, L) => de(h, r, L, a ^ 4 ? o : d.set) : (h, L) => h[t] = L)), l = (0, n[C])(a ? a < 4 ? f ? o : d[M] : a > 4 ? void 0 : { get: d.get, set: d.set } : r, w), g._ = 1, a ^ 4 || l === void 0 ? O(l) && (a > 4 ? u.unshift(l) : a ? f ? 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), f ? a ^ 4 ? o : d : r;
|
|
22
22
|
};
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
import { inject as
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
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 v, ElementRef as T, 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)
|
|
30
32
|
return !1;
|
|
31
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
33
|
+
if (Object.prototype.hasOwnProperty.call(i, "ɵcmp") || Object.prototype.hasOwnProperty.call(i, "ɵfac"))
|
|
32
34
|
return !0;
|
|
33
|
-
const e = Function.prototype.toString.call(
|
|
35
|
+
const e = Function.prototype.toString.call(i);
|
|
34
36
|
return e.startsWith("class ") || e.startsWith("class{");
|
|
35
37
|
}
|
|
36
|
-
const
|
|
37
|
-
function
|
|
38
|
-
return
|
|
38
|
+
const Oe = /* @__PURE__ */ new Map();
|
|
39
|
+
function je(i) {
|
|
40
|
+
return Oe.get(i);
|
|
39
41
|
}
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
class
|
|
43
|
-
elementRef =
|
|
42
|
+
var ye, X;
|
|
43
|
+
ye = [x({ selector: "tbw-grid-column-editor" })];
|
|
44
|
+
class q {
|
|
45
|
+
elementRef = v(T);
|
|
44
46
|
/**
|
|
45
47
|
* Query for the ng-template content child.
|
|
46
48
|
*/
|
|
47
|
-
template =
|
|
49
|
+
template = k(F);
|
|
48
50
|
/** Effect that triggers when the template is available */
|
|
49
|
-
onTemplateReceived =
|
|
51
|
+
onTemplateReceived = D(() => {
|
|
50
52
|
const e = this.template();
|
|
51
|
-
e &&
|
|
53
|
+
e && Oe.set(this.elementRef.nativeElement, e);
|
|
52
54
|
});
|
|
53
55
|
/**
|
|
54
56
|
* Static type guard for template context.
|
|
@@ -58,23 +60,23 @@ class M {
|
|
|
58
60
|
return !0;
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
function
|
|
64
|
-
return
|
|
63
|
+
X = E(null), q = b(X, 0, "GridColumnEditor", ye, q), y(X, 1, q);
|
|
64
|
+
const ke = /* @__PURE__ */ new Map();
|
|
65
|
+
function Ie(i) {
|
|
66
|
+
return ke.get(i);
|
|
65
67
|
}
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
class
|
|
69
|
-
elementRef =
|
|
68
|
+
var be, K;
|
|
69
|
+
be = [x({ selector: "tbw-grid-column-view" })];
|
|
70
|
+
class _ {
|
|
71
|
+
elementRef = v(T);
|
|
70
72
|
/**
|
|
71
73
|
* Query for the ng-template content child.
|
|
72
74
|
*/
|
|
73
|
-
template =
|
|
75
|
+
template = k(F);
|
|
74
76
|
/** Effect that triggers when the template is available */
|
|
75
|
-
onTemplateReceived =
|
|
77
|
+
onTemplateReceived = D(() => {
|
|
76
78
|
const e = this.template();
|
|
77
|
-
e &&
|
|
79
|
+
e && ke.set(this.elementRef.nativeElement, e);
|
|
78
80
|
});
|
|
79
81
|
/**
|
|
80
82
|
* Static type guard for template context.
|
|
@@ -84,29 +86,29 @@ class V {
|
|
|
84
86
|
return !0;
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
function
|
|
90
|
-
const e =
|
|
89
|
+
K = E(null), _ = b(K, 0, "GridColumnView", be, _), y(K, 1, _);
|
|
90
|
+
const Ne = /* @__PURE__ */ new Map();
|
|
91
|
+
function Re(i) {
|
|
92
|
+
const e = i.querySelector("tbw-grid-detail");
|
|
91
93
|
if (e)
|
|
92
|
-
return
|
|
94
|
+
return Ne.get(e);
|
|
93
95
|
}
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
class
|
|
97
|
-
elementRef =
|
|
96
|
+
var Te, Q;
|
|
97
|
+
Te = [x({ selector: "tbw-grid-detail" })];
|
|
98
|
+
class $ {
|
|
99
|
+
elementRef = v(T);
|
|
98
100
|
/** Whether to show the expand/collapse column. Default: true */
|
|
99
|
-
showExpandColumn =
|
|
101
|
+
showExpandColumn = c(!0);
|
|
100
102
|
/** Animation style for expand/collapse. Default: 'slide' */
|
|
101
|
-
animation =
|
|
103
|
+
animation = c("slide");
|
|
102
104
|
/**
|
|
103
105
|
* Query for the ng-template content child.
|
|
104
106
|
*/
|
|
105
|
-
template =
|
|
107
|
+
template = k(F);
|
|
106
108
|
/** Effect that triggers when the template is available */
|
|
107
|
-
onTemplateReceived =
|
|
109
|
+
onTemplateReceived = D(() => {
|
|
108
110
|
const e = this.template();
|
|
109
|
-
e &&
|
|
111
|
+
e && Ne.set(this.elementRef.nativeElement, e);
|
|
110
112
|
});
|
|
111
113
|
/**
|
|
112
114
|
* Static type guard for template context.
|
|
@@ -116,29 +118,146 @@ class _ {
|
|
|
116
118
|
return !0;
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
function
|
|
122
|
-
|
|
121
|
+
Q = E(null), $ = b(Q, 0, "GridDetailView", Te, $), y(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 = v(T);
|
|
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 g = l.get(o);
|
|
185
|
+
g && (g.setValue(s), g.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((g) => {
|
|
214
|
+
const w = o.get(g);
|
|
215
|
+
w?.errors && (s[g] = w.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 = E(null), z = b(Z, 0, "GridFormArray", Ae, z), y(Z, 1, z);
|
|
239
|
+
const Ve = /* @__PURE__ */ new Map();
|
|
240
|
+
function it(i) {
|
|
241
|
+
const e = i.querySelector("tbw-grid-responsive-card");
|
|
123
242
|
if (e)
|
|
124
|
-
return
|
|
243
|
+
return Ve.get(e);
|
|
125
244
|
}
|
|
126
|
-
var
|
|
127
|
-
|
|
245
|
+
var xe, ee;
|
|
246
|
+
xe = [x({
|
|
128
247
|
selector: "tbw-grid-responsive-card"
|
|
129
248
|
})];
|
|
130
|
-
class
|
|
131
|
-
elementRef =
|
|
249
|
+
class B {
|
|
250
|
+
elementRef = v(T);
|
|
132
251
|
/**
|
|
133
252
|
* The ng-template containing the card content.
|
|
134
253
|
*/
|
|
135
|
-
template =
|
|
254
|
+
template = k(F);
|
|
136
255
|
/**
|
|
137
256
|
* Effect that registers the template when it becomes available.
|
|
138
257
|
*/
|
|
139
|
-
onTemplateReceived =
|
|
258
|
+
onTemplateReceived = D(() => {
|
|
140
259
|
const e = this.template();
|
|
141
|
-
e &&
|
|
260
|
+
e && Ve.set(
|
|
142
261
|
this.elementRef.nativeElement,
|
|
143
262
|
e
|
|
144
263
|
);
|
|
@@ -150,38 +269,38 @@ class x {
|
|
|
150
269
|
return !0;
|
|
151
270
|
}
|
|
152
271
|
}
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
function
|
|
156
|
-
return
|
|
272
|
+
ee = E(null), B = b(ee, 0, "GridResponsiveCard", xe, B), y(ee, 1, B);
|
|
273
|
+
const Ge = /* @__PURE__ */ new Map();
|
|
274
|
+
function ot(i) {
|
|
275
|
+
return Ge.get(i);
|
|
157
276
|
}
|
|
158
|
-
var
|
|
159
|
-
|
|
160
|
-
class
|
|
161
|
-
elementRef =
|
|
277
|
+
var Se, te;
|
|
278
|
+
Se = [x({ selector: "tbw-grid-tool-panel" })];
|
|
279
|
+
class U {
|
|
280
|
+
elementRef = v(T);
|
|
162
281
|
/** Unique panel identifier (required) */
|
|
163
|
-
id =
|
|
282
|
+
id = c.required({ alias: "id" });
|
|
164
283
|
/** Panel title shown in accordion header (required) */
|
|
165
|
-
title =
|
|
284
|
+
title = c.required({ alias: "title" });
|
|
166
285
|
/** Icon for accordion section header (emoji or text) */
|
|
167
|
-
icon =
|
|
286
|
+
icon = c();
|
|
168
287
|
/** Tooltip for accordion section header */
|
|
169
|
-
tooltip =
|
|
288
|
+
tooltip = c();
|
|
170
289
|
/** Panel order priority (lower = first, default: 100) */
|
|
171
|
-
order =
|
|
290
|
+
order = c(100);
|
|
172
291
|
/**
|
|
173
292
|
* Query for the ng-template content child.
|
|
174
293
|
*/
|
|
175
|
-
template =
|
|
294
|
+
template = k(F);
|
|
176
295
|
/** Effect that triggers when the template is available */
|
|
177
|
-
onTemplateReceived =
|
|
296
|
+
onTemplateReceived = D(() => {
|
|
178
297
|
const e = this.template(), t = this.elementRef.nativeElement;
|
|
179
298
|
if (e) {
|
|
180
299
|
t.setAttribute("id", this.id()), t.setAttribute("title", this.title());
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
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);
|
|
185
304
|
}
|
|
186
305
|
});
|
|
187
306
|
/**
|
|
@@ -192,30 +311,30 @@ class q {
|
|
|
192
311
|
return !0;
|
|
193
312
|
}
|
|
194
313
|
}
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
function
|
|
198
|
-
const e =
|
|
314
|
+
te = E(null), U = b(te, 0, "GridToolPanel", Se, U), y(te, 1, U);
|
|
315
|
+
const ce = /* @__PURE__ */ new Map(), ae = /* @__PURE__ */ new Map();
|
|
316
|
+
function st(i) {
|
|
317
|
+
const e = ce.get(i);
|
|
199
318
|
if (e) return e;
|
|
200
|
-
const t =
|
|
319
|
+
const t = i.querySelector("tbw-grid-column-view");
|
|
201
320
|
if (t)
|
|
202
|
-
return
|
|
321
|
+
return Ie(t);
|
|
203
322
|
}
|
|
204
|
-
function
|
|
205
|
-
const e =
|
|
323
|
+
function lt(i) {
|
|
324
|
+
const e = ae.get(i);
|
|
206
325
|
if (e) return e;
|
|
207
|
-
const t =
|
|
326
|
+
const t = i.querySelector("tbw-grid-column-editor");
|
|
208
327
|
if (t)
|
|
209
|
-
return
|
|
328
|
+
return je(t);
|
|
210
329
|
}
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
class
|
|
214
|
-
template =
|
|
215
|
-
elementRef =
|
|
330
|
+
var Le, ne;
|
|
331
|
+
Le = [x({ selector: "[tbwRenderer]" })];
|
|
332
|
+
class J {
|
|
333
|
+
template = v(F);
|
|
334
|
+
elementRef = v(T);
|
|
216
335
|
columnElement = null;
|
|
217
336
|
constructor() {
|
|
218
|
-
|
|
337
|
+
D(() => {
|
|
219
338
|
this.registerTemplate();
|
|
220
339
|
});
|
|
221
340
|
}
|
|
@@ -223,10 +342,10 @@ class k {
|
|
|
223
342
|
let e = this.elementRef.nativeElement?.parentElement;
|
|
224
343
|
for (; e && e.tagName !== "TBW-GRID-COLUMN"; )
|
|
225
344
|
e = e.parentElement;
|
|
226
|
-
e && (this.columnElement = e,
|
|
345
|
+
e && (this.columnElement = e, ce.set(e, this.template));
|
|
227
346
|
}
|
|
228
347
|
ngOnDestroy() {
|
|
229
|
-
this.columnElement &&
|
|
348
|
+
this.columnElement && ce.delete(this.columnElement);
|
|
230
349
|
}
|
|
231
350
|
/**
|
|
232
351
|
* Static type guard for template context.
|
|
@@ -236,15 +355,15 @@ class k {
|
|
|
236
355
|
return !0;
|
|
237
356
|
}
|
|
238
357
|
}
|
|
239
|
-
|
|
240
|
-
var
|
|
241
|
-
|
|
242
|
-
class
|
|
243
|
-
template =
|
|
244
|
-
elementRef =
|
|
358
|
+
ne = E(null), J = b(ne, 0, "TbwRenderer", Le, J), y(ne, 1, J);
|
|
359
|
+
var De, re;
|
|
360
|
+
De = [x({ selector: "[tbwEditor]" })];
|
|
361
|
+
class W {
|
|
362
|
+
template = v(F);
|
|
363
|
+
elementRef = v(T);
|
|
245
364
|
columnElement = null;
|
|
246
365
|
constructor() {
|
|
247
|
-
|
|
366
|
+
D(() => {
|
|
248
367
|
this.registerTemplate();
|
|
249
368
|
});
|
|
250
369
|
}
|
|
@@ -252,10 +371,10 @@ class $ {
|
|
|
252
371
|
let e = this.elementRef.nativeElement?.parentElement;
|
|
253
372
|
for (; e && e.tagName !== "TBW-GRID-COLUMN"; )
|
|
254
373
|
e = e.parentElement;
|
|
255
|
-
e && (this.columnElement = e,
|
|
374
|
+
e && (this.columnElement = e, ae.set(e, this.template));
|
|
256
375
|
}
|
|
257
376
|
ngOnDestroy() {
|
|
258
|
-
this.columnElement &&
|
|
377
|
+
this.columnElement && ae.delete(this.columnElement);
|
|
259
378
|
}
|
|
260
379
|
/**
|
|
261
380
|
* Static type guard for template context.
|
|
@@ -265,17 +384,17 @@ class $ {
|
|
|
265
384
|
return !0;
|
|
266
385
|
}
|
|
267
386
|
}
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
var
|
|
271
|
-
|
|
272
|
-
class
|
|
387
|
+
re = E(null), W = b(re, 0, "TbwEditor", De, W), y(re, 1, W);
|
|
388
|
+
const qe = new He("GRID_TYPE_DEFAULTS");
|
|
389
|
+
var Pe, ie;
|
|
390
|
+
Pe = [Ye({ providedIn: "root" })];
|
|
391
|
+
class I {
|
|
273
392
|
defaults = /* @__PURE__ */ new Map();
|
|
274
393
|
constructor() {
|
|
275
|
-
const e =
|
|
394
|
+
const e = v(qe, { optional: !0 });
|
|
276
395
|
if (e)
|
|
277
|
-
for (const [t,
|
|
278
|
-
this.defaults.set(t,
|
|
396
|
+
for (const [t, n] of Object.entries(e))
|
|
397
|
+
this.defaults.set(t, n);
|
|
279
398
|
}
|
|
280
399
|
/**
|
|
281
400
|
* Register type-level defaults for a custom type.
|
|
@@ -326,23 +445,23 @@ class P {
|
|
|
326
445
|
};
|
|
327
446
|
}
|
|
328
447
|
}
|
|
329
|
-
|
|
330
|
-
function
|
|
331
|
-
return
|
|
448
|
+
ie = E(null), I = b(ie, 0, "GridTypeRegistry", Pe, I), y(ie, 1, I);
|
|
449
|
+
function ft(i) {
|
|
450
|
+
return Xe([{ provide: qe, useValue: i }]);
|
|
332
451
|
}
|
|
333
|
-
function
|
|
334
|
-
const e =
|
|
335
|
-
return e ||
|
|
452
|
+
function Ce(i) {
|
|
453
|
+
const e = st(i);
|
|
454
|
+
return e || Ie(i);
|
|
336
455
|
}
|
|
337
|
-
function
|
|
338
|
-
const e =
|
|
339
|
-
return e ||
|
|
456
|
+
function Ee(i) {
|
|
457
|
+
const e = lt(i);
|
|
458
|
+
return e || je(i);
|
|
340
459
|
}
|
|
341
|
-
class
|
|
342
|
-
constructor(e, t,
|
|
343
|
-
this.injector = e, this.appRef = t, this.viewContainerRef =
|
|
460
|
+
class ct {
|
|
461
|
+
constructor(e, t, n) {
|
|
462
|
+
this.injector = e, this.appRef = t, this.viewContainerRef = n, window.__ANGULAR_GRID_ADAPTER__ = this;
|
|
344
463
|
try {
|
|
345
|
-
this.typeRegistry = this.injector.get(
|
|
464
|
+
this.typeRegistry = this.injector.get(I, null);
|
|
346
465
|
} catch {
|
|
347
466
|
}
|
|
348
467
|
}
|
|
@@ -378,7 +497,7 @@ class Qe {
|
|
|
378
497
|
processGridConfig(e) {
|
|
379
498
|
if (!e.columns)
|
|
380
499
|
return e;
|
|
381
|
-
const t = e.columns.map((
|
|
500
|
+
const t = e.columns.map((n) => this.processColumn(n));
|
|
382
501
|
return {
|
|
383
502
|
...e,
|
|
384
503
|
columns: t
|
|
@@ -393,14 +512,14 @@ class Qe {
|
|
|
393
512
|
*/
|
|
394
513
|
processColumn(e) {
|
|
395
514
|
const t = { ...e };
|
|
396
|
-
return e.renderer &&
|
|
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;
|
|
397
516
|
}
|
|
398
517
|
/**
|
|
399
518
|
* Determines if this adapter can handle the given element.
|
|
400
519
|
* Checks if a template is registered for this element (structural or nested).
|
|
401
520
|
*/
|
|
402
521
|
canHandle(e) {
|
|
403
|
-
return
|
|
522
|
+
return Ce(e) !== void 0 || Ee(e) !== void 0;
|
|
404
523
|
}
|
|
405
524
|
/**
|
|
406
525
|
* Creates a view renderer function that creates an embedded view
|
|
@@ -410,16 +529,16 @@ class Qe {
|
|
|
410
529
|
* allowing the grid to use its default rendering.
|
|
411
530
|
*/
|
|
412
531
|
createRenderer(e) {
|
|
413
|
-
const t =
|
|
532
|
+
const t = Ce(e);
|
|
414
533
|
if (t)
|
|
415
|
-
return (
|
|
416
|
-
const
|
|
417
|
-
$implicit:
|
|
418
|
-
value:
|
|
419
|
-
row:
|
|
420
|
-
column:
|
|
421
|
-
},
|
|
422
|
-
return this.viewRefs.push(
|
|
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];
|
|
423
542
|
};
|
|
424
543
|
}
|
|
425
544
|
/**
|
|
@@ -441,47 +560,60 @@ class Qe {
|
|
|
441
560
|
* As long as the component emits `(commit)` with the new value.
|
|
442
561
|
*/
|
|
443
562
|
createEditor(e) {
|
|
444
|
-
const t =
|
|
563
|
+
const t = Ee(e), n = e.closest("tbw-grid");
|
|
445
564
|
return t ? (r) => {
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
|
|
565
|
+
const o = (f) => r.commit(f), s = () => r.cancel(), l = new ge(), g = new ge();
|
|
566
|
+
l.subscribe((f) => r.commit(f)), g.subscribe(() => r.cancel());
|
|
567
|
+
let w;
|
|
568
|
+
if (n) {
|
|
569
|
+
const f = rt(n);
|
|
570
|
+
if (f?.hasFormGroups) {
|
|
571
|
+
const S = n.rows;
|
|
572
|
+
if (S) {
|
|
573
|
+
const M = S.indexOf(r.row);
|
|
574
|
+
M >= 0 && (w = f.getControl(M, r.field));
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
const A = {
|
|
449
579
|
$implicit: r.value,
|
|
450
580
|
value: r.value,
|
|
451
581
|
row: r.row,
|
|
452
582
|
column: r.column,
|
|
453
583
|
// Preferred: simple callback functions
|
|
454
|
-
onCommit:
|
|
584
|
+
onCommit: o,
|
|
455
585
|
onCancel: s,
|
|
586
|
+
// FormControl from FormArray (if available)
|
|
587
|
+
control: w,
|
|
456
588
|
// Deprecated: EventEmitters (for backwards compatibility)
|
|
457
|
-
commit:
|
|
458
|
-
cancel:
|
|
459
|
-
},
|
|
460
|
-
this.viewRefs.push(
|
|
461
|
-
const
|
|
462
|
-
return
|
|
463
|
-
const
|
|
464
|
-
r.commit(
|
|
465
|
-
}),
|
|
589
|
+
commit: l,
|
|
590
|
+
cancel: g
|
|
591
|
+
}, a = this.viewContainerRef.createEmbeddedView(t, A);
|
|
592
|
+
this.viewRefs.push(a), a.detectChanges();
|
|
593
|
+
const R = a.rootNodes[0];
|
|
594
|
+
return R && R.addEventListener && (R.addEventListener("commit", (f) => {
|
|
595
|
+
const S = f;
|
|
596
|
+
r.commit(S.detail);
|
|
597
|
+
}), R.addEventListener("cancel", () => {
|
|
466
598
|
r.cancel();
|
|
467
|
-
})),
|
|
468
|
-
} : (
|
|
599
|
+
})), R;
|
|
600
|
+
} : () => document.createElement("div");
|
|
469
601
|
}
|
|
470
602
|
/**
|
|
471
603
|
* Creates a detail renderer function for MasterDetailPlugin.
|
|
472
604
|
* Renders Angular templates for expandable detail rows.
|
|
473
605
|
*/
|
|
474
606
|
createDetailRenderer(e) {
|
|
475
|
-
const t =
|
|
607
|
+
const t = Re(e);
|
|
476
608
|
if (t)
|
|
477
|
-
return (
|
|
478
|
-
const
|
|
479
|
-
$implicit:
|
|
480
|
-
row:
|
|
481
|
-
},
|
|
482
|
-
this.viewRefs.push(
|
|
483
|
-
const
|
|
484
|
-
return
|
|
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;
|
|
485
617
|
};
|
|
486
618
|
}
|
|
487
619
|
/**
|
|
@@ -492,16 +624,16 @@ class Qe {
|
|
|
492
624
|
* without manual configuration in the Grid directive.
|
|
493
625
|
*/
|
|
494
626
|
parseDetailElement(e) {
|
|
495
|
-
const t =
|
|
627
|
+
const t = Re(e.closest("tbw-grid"));
|
|
496
628
|
if (t)
|
|
497
|
-
return (
|
|
498
|
-
const
|
|
499
|
-
$implicit:
|
|
500
|
-
row:
|
|
501
|
-
},
|
|
502
|
-
this.viewRefs.push(
|
|
503
|
-
const
|
|
504
|
-
return
|
|
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;
|
|
505
637
|
};
|
|
506
638
|
}
|
|
507
639
|
/**
|
|
@@ -512,17 +644,17 @@ class Qe {
|
|
|
512
644
|
* @returns A card renderer function or undefined if no template is found
|
|
513
645
|
*/
|
|
514
646
|
createResponsiveCardRenderer(e) {
|
|
515
|
-
const t =
|
|
647
|
+
const t = it(e);
|
|
516
648
|
if (t)
|
|
517
|
-
return (
|
|
518
|
-
const
|
|
519
|
-
$implicit:
|
|
520
|
-
row:
|
|
521
|
-
index:
|
|
522
|
-
},
|
|
523
|
-
this.viewRefs.push(
|
|
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();
|
|
524
656
|
const l = document.createElement("div");
|
|
525
|
-
return
|
|
657
|
+
return s.rootNodes.forEach((g) => l.appendChild(g)), l;
|
|
526
658
|
};
|
|
527
659
|
}
|
|
528
660
|
/**
|
|
@@ -530,18 +662,18 @@ class Qe {
|
|
|
530
662
|
* The renderer creates an Angular template-based panel content.
|
|
531
663
|
*/
|
|
532
664
|
createToolPanelRenderer(e) {
|
|
533
|
-
const t =
|
|
665
|
+
const t = ot(e);
|
|
534
666
|
if (!t)
|
|
535
667
|
return;
|
|
536
|
-
const
|
|
537
|
-
return (
|
|
538
|
-
const
|
|
539
|
-
$implicit:
|
|
540
|
-
grid:
|
|
541
|
-
},
|
|
542
|
-
return this.viewRefs.push(
|
|
543
|
-
const l = this.viewRefs.indexOf(
|
|
544
|
-
l > -1 && this.viewRefs.splice(l, 1),
|
|
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();
|
|
545
677
|
};
|
|
546
678
|
};
|
|
547
679
|
}
|
|
@@ -578,10 +710,10 @@ class Qe {
|
|
|
578
710
|
const t = this.typeRegistry.get(e);
|
|
579
711
|
if (!t)
|
|
580
712
|
return;
|
|
581
|
-
const
|
|
713
|
+
const n = {
|
|
582
714
|
editorParams: t.editorParams
|
|
583
715
|
};
|
|
584
|
-
return t.renderer && (
|
|
716
|
+
return t.renderer && (n.renderer = this.createComponentRenderer(t.renderer)), t.editor && (n.editor = this.createComponentEditor(t.editor)), n;
|
|
585
717
|
}
|
|
586
718
|
/**
|
|
587
719
|
* Creates a renderer function from an Angular component class.
|
|
@@ -589,17 +721,17 @@ class Qe {
|
|
|
589
721
|
*/
|
|
590
722
|
createComponentRenderer(e) {
|
|
591
723
|
return (t) => {
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
const
|
|
724
|
+
const n = document.createElement("span");
|
|
725
|
+
n.style.display = "contents";
|
|
726
|
+
const r = he(e, {
|
|
595
727
|
environmentInjector: this.injector,
|
|
596
|
-
hostElement:
|
|
728
|
+
hostElement: n
|
|
597
729
|
});
|
|
598
|
-
return this.setComponentInputs(
|
|
730
|
+
return this.setComponentInputs(r, {
|
|
599
731
|
value: t.value,
|
|
600
732
|
row: t.row,
|
|
601
733
|
column: t.column
|
|
602
|
-
}), this.appRef.attachView(
|
|
734
|
+
}), this.appRef.attachView(r.hostView), this.componentRefs.push(r), r.changeDetectorRef.detectChanges(), n;
|
|
603
735
|
};
|
|
604
736
|
}
|
|
605
737
|
/**
|
|
@@ -608,24 +740,24 @@ class Qe {
|
|
|
608
740
|
*/
|
|
609
741
|
createComponentEditor(e) {
|
|
610
742
|
return (t) => {
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
const
|
|
743
|
+
const n = document.createElement("span");
|
|
744
|
+
n.style.display = "contents";
|
|
745
|
+
const r = he(e, {
|
|
614
746
|
environmentInjector: this.injector,
|
|
615
|
-
hostElement:
|
|
747
|
+
hostElement: n
|
|
616
748
|
});
|
|
617
|
-
this.setComponentInputs(
|
|
749
|
+
this.setComponentInputs(r, {
|
|
618
750
|
value: t.value,
|
|
619
751
|
row: t.row,
|
|
620
752
|
column: t.column
|
|
621
|
-
}), this.appRef.attachView(
|
|
622
|
-
const
|
|
623
|
-
return this.subscribeToOutput(
|
|
624
|
-
const l =
|
|
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;
|
|
625
757
|
t.commit(l.detail);
|
|
626
|
-
}),
|
|
758
|
+
}), n.addEventListener("cancel", () => {
|
|
627
759
|
t.cancel();
|
|
628
|
-
}),
|
|
760
|
+
}), n;
|
|
629
761
|
};
|
|
630
762
|
}
|
|
631
763
|
/**
|
|
@@ -633,18 +765,18 @@ class Qe {
|
|
|
633
765
|
* Works with both EventEmitter and OutputEmitterRef (signal outputs).
|
|
634
766
|
* @internal
|
|
635
767
|
*/
|
|
636
|
-
subscribeToOutput(e, t,
|
|
637
|
-
const
|
|
638
|
-
|
|
768
|
+
subscribeToOutput(e, t, n) {
|
|
769
|
+
const r = e[t];
|
|
770
|
+
r && typeof r.subscribe == "function" && r.subscribe(n);
|
|
639
771
|
}
|
|
640
772
|
/**
|
|
641
773
|
* Sets component inputs using Angular's setInput API.
|
|
642
774
|
* @internal
|
|
643
775
|
*/
|
|
644
776
|
setComponentInputs(e, t) {
|
|
645
|
-
for (const [
|
|
777
|
+
for (const [n, r] of Object.entries(t))
|
|
646
778
|
try {
|
|
647
|
-
e.setInput(
|
|
779
|
+
e.setInput(n, r);
|
|
648
780
|
} catch {
|
|
649
781
|
}
|
|
650
782
|
}
|
|
@@ -656,24 +788,252 @@ class Qe {
|
|
|
656
788
|
this.viewRefs.forEach((e) => e.destroy()), this.viewRefs = [], this.componentRefs.forEach((e) => e.destroy()), this.componentRefs = [];
|
|
657
789
|
}
|
|
658
790
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
791
|
+
function gt() {
|
|
792
|
+
const i = v(T), 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
|
+
}, g = (u, m) => {
|
|
818
|
+
n()?.registerStyles?.(u, m);
|
|
819
|
+
}, w = (u) => {
|
|
820
|
+
n()?.unregisterStyles?.(u);
|
|
821
|
+
}, A = () => {
|
|
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((h, 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 h of d)
|
|
843
|
+
for (let L = h.startRow; L <= h.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: g,
|
|
856
|
+
unregisterStyles: w,
|
|
857
|
+
selectAll: A,
|
|
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 = v(T);
|
|
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 = E(null), H = b(oe, 0, "BaseGridEditor", Fe, H), y(oe, 1, H);
|
|
1018
|
+
var Me, se;
|
|
1019
|
+
Me = [x({ selector: "tbw-grid" })];
|
|
1020
|
+
class Y {
|
|
1021
|
+
elementRef = v(T);
|
|
1022
|
+
injector = v(Qe);
|
|
1023
|
+
appRef = v(Ze);
|
|
1024
|
+
viewContainerRef = v(et);
|
|
666
1025
|
adapter = null;
|
|
667
|
-
cellCommitListener = null;
|
|
668
1026
|
constructor() {
|
|
669
|
-
|
|
1027
|
+
D(() => {
|
|
670
1028
|
const e = this.angularConfig();
|
|
671
|
-
if (!
|
|
672
|
-
const t = this.adapter.processGridConfig(e), r = this.elementRef.nativeElement;
|
|
673
|
-
|
|
1029
|
+
if (!this.adapter) return;
|
|
1030
|
+
const t = e ? this.adapter.processGridConfig(e) : {}, n = this.createFeaturePlugins(), r = t.plugins || [], o = [...n, ...r], s = this.elementRef.nativeElement;
|
|
1031
|
+
s.gridConfig = {
|
|
1032
|
+
...t,
|
|
1033
|
+
plugins: o.length > 0 ? o : void 0
|
|
1034
|
+
};
|
|
674
1035
|
});
|
|
675
1036
|
}
|
|
676
|
-
rowCommitListener = null;
|
|
677
1037
|
/**
|
|
678
1038
|
* Custom CSS styles to inject into the grid.
|
|
679
1039
|
* Use this to style custom cell renderers, editors, or detail panels.
|
|
@@ -691,7 +1051,7 @@ class G {
|
|
|
691
1051
|
* <tbw-grid [customStyles]="customStyles">...</tbw-grid>
|
|
692
1052
|
* ```
|
|
693
1053
|
*/
|
|
694
|
-
customStyles =
|
|
1054
|
+
customStyles = c();
|
|
695
1055
|
/**
|
|
696
1056
|
* Angular-specific grid configuration that supports component classes for renderers/editors.
|
|
697
1057
|
*
|
|
@@ -728,7 +1088,387 @@ class G {
|
|
|
728
1088
|
* ```
|
|
729
1089
|
*/
|
|
730
1090
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
731
|
-
angularConfig =
|
|
1091
|
+
angularConfig = c();
|
|
1092
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1093
|
+
// FEATURE INPUTS - Declarative plugin configuration
|
|
1094
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1095
|
+
/**
|
|
1096
|
+
* Enable cell/row/range selection.
|
|
1097
|
+
*
|
|
1098
|
+
* **Requires feature import:**
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* import '@toolbox-web/grid-angular/features/selection';
|
|
1101
|
+
* ```
|
|
1102
|
+
*
|
|
1103
|
+
* @example
|
|
1104
|
+
* ```html
|
|
1105
|
+
* <!-- Shorthand - just the mode -->
|
|
1106
|
+
* <tbw-grid [selection]="'range'" />
|
|
1107
|
+
*
|
|
1108
|
+
* <!-- Full config object -->
|
|
1109
|
+
* <tbw-grid [selection]="{ mode: 'range', checkbox: true }" />
|
|
1110
|
+
* ```
|
|
1111
|
+
*/
|
|
1112
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1113
|
+
selection = c();
|
|
1114
|
+
/**
|
|
1115
|
+
* Enable inline cell editing.
|
|
1116
|
+
*
|
|
1117
|
+
* **Requires feature import:**
|
|
1118
|
+
* ```typescript
|
|
1119
|
+
* import '@toolbox-web/grid-angular/features/editing';
|
|
1120
|
+
* ```
|
|
1121
|
+
*
|
|
1122
|
+
* @example
|
|
1123
|
+
* ```html
|
|
1124
|
+
* <!-- Enable with default trigger (dblclick) -->
|
|
1125
|
+
* <tbw-grid [editing]="true" />
|
|
1126
|
+
*
|
|
1127
|
+
* <!-- Specify trigger -->
|
|
1128
|
+
* <tbw-grid [editing]="'click'" />
|
|
1129
|
+
* <tbw-grid [editing]="'dblclick'" />
|
|
1130
|
+
* <tbw-grid [editing]="'manual'" />
|
|
1131
|
+
* ```
|
|
1132
|
+
*/
|
|
1133
|
+
editing = c();
|
|
1134
|
+
/**
|
|
1135
|
+
* Enable clipboard copy/paste. Requires selection to be enabled.
|
|
1136
|
+
*
|
|
1137
|
+
* **Requires feature import:**
|
|
1138
|
+
* ```typescript
|
|
1139
|
+
* import '@toolbox-web/grid-angular/features/clipboard';
|
|
1140
|
+
* ```
|
|
1141
|
+
*
|
|
1142
|
+
* @example
|
|
1143
|
+
* ```html
|
|
1144
|
+
* <tbw-grid [selection]="'range'" [clipboard]="true" />
|
|
1145
|
+
* ```
|
|
1146
|
+
*/
|
|
1147
|
+
clipboard = c();
|
|
1148
|
+
/**
|
|
1149
|
+
* Enable right-click context menu.
|
|
1150
|
+
*
|
|
1151
|
+
* **Requires feature import:**
|
|
1152
|
+
* ```typescript
|
|
1153
|
+
* import '@toolbox-web/grid-angular/features/context-menu';
|
|
1154
|
+
* ```
|
|
1155
|
+
*
|
|
1156
|
+
* @example
|
|
1157
|
+
* ```html
|
|
1158
|
+
* <tbw-grid [contextMenu]="true" />
|
|
1159
|
+
* ```
|
|
1160
|
+
*/
|
|
1161
|
+
contextMenu = c();
|
|
1162
|
+
/**
|
|
1163
|
+
* Enable column sorting.
|
|
1164
|
+
*
|
|
1165
|
+
* **Requires feature import:**
|
|
1166
|
+
* ```typescript
|
|
1167
|
+
* import '@toolbox-web/grid-angular/features/sorting';
|
|
1168
|
+
* ```
|
|
1169
|
+
*
|
|
1170
|
+
* @example
|
|
1171
|
+
* ```html
|
|
1172
|
+
* <!-- Enable with default (multi-sort) -->
|
|
1173
|
+
* <tbw-grid [sorting]="true" />
|
|
1174
|
+
*
|
|
1175
|
+
* <!-- Single column sort only -->
|
|
1176
|
+
* <tbw-grid [sorting]="'single'" />
|
|
1177
|
+
*
|
|
1178
|
+
* <!-- Multi-column sort -->
|
|
1179
|
+
* <tbw-grid [sorting]="'multi'" />
|
|
1180
|
+
* ```
|
|
1181
|
+
*/
|
|
1182
|
+
sorting = c();
|
|
1183
|
+
/**
|
|
1184
|
+
* Enable column filtering.
|
|
1185
|
+
*
|
|
1186
|
+
* **Requires feature import:**
|
|
1187
|
+
* ```typescript
|
|
1188
|
+
* import '@toolbox-web/grid-angular/features/filtering';
|
|
1189
|
+
* ```
|
|
1190
|
+
*
|
|
1191
|
+
* @example
|
|
1192
|
+
* ```html
|
|
1193
|
+
* <tbw-grid [filtering]="true" />
|
|
1194
|
+
* <tbw-grid [filtering]="{ debounceMs: 200 }" />
|
|
1195
|
+
* ```
|
|
1196
|
+
*/
|
|
1197
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1198
|
+
filtering = c();
|
|
1199
|
+
/**
|
|
1200
|
+
* Enable column drag-to-reorder.
|
|
1201
|
+
*
|
|
1202
|
+
* **Requires feature import:**
|
|
1203
|
+
* ```typescript
|
|
1204
|
+
* import '@toolbox-web/grid-angular/features/reorder';
|
|
1205
|
+
* ```
|
|
1206
|
+
*
|
|
1207
|
+
* @example
|
|
1208
|
+
* ```html
|
|
1209
|
+
* <tbw-grid [reorder]="true" />
|
|
1210
|
+
* ```
|
|
1211
|
+
*/
|
|
1212
|
+
reorder = c();
|
|
1213
|
+
/**
|
|
1214
|
+
* Enable column visibility toggle panel.
|
|
1215
|
+
*
|
|
1216
|
+
* **Requires feature import:**
|
|
1217
|
+
* ```typescript
|
|
1218
|
+
* import '@toolbox-web/grid-angular/features/visibility';
|
|
1219
|
+
* ```
|
|
1220
|
+
*
|
|
1221
|
+
* @example
|
|
1222
|
+
* ```html
|
|
1223
|
+
* <tbw-grid [visibility]="true" />
|
|
1224
|
+
* ```
|
|
1225
|
+
*/
|
|
1226
|
+
visibility = c();
|
|
1227
|
+
/**
|
|
1228
|
+
* Enable pinned/sticky columns.
|
|
1229
|
+
* Columns are pinned via the `sticky` column property.
|
|
1230
|
+
*
|
|
1231
|
+
* **Requires feature import:**
|
|
1232
|
+
* ```typescript
|
|
1233
|
+
* import '@toolbox-web/grid-angular/features/pinned-columns';
|
|
1234
|
+
* ```
|
|
1235
|
+
*
|
|
1236
|
+
* @example
|
|
1237
|
+
* ```html
|
|
1238
|
+
* <tbw-grid [pinnedColumns]="true" [columns]="[
|
|
1239
|
+
* { field: 'id', sticky: 'left' },
|
|
1240
|
+
* { field: 'name' },
|
|
1241
|
+
* { field: 'actions', sticky: 'right' }
|
|
1242
|
+
* ]" />
|
|
1243
|
+
* ```
|
|
1244
|
+
*/
|
|
1245
|
+
pinnedColumns = c();
|
|
1246
|
+
/**
|
|
1247
|
+
* Enable multi-level column headers (column groups).
|
|
1248
|
+
*
|
|
1249
|
+
* **Requires feature import:**
|
|
1250
|
+
* ```typescript
|
|
1251
|
+
* import '@toolbox-web/grid-angular/features/grouping-columns';
|
|
1252
|
+
* ```
|
|
1253
|
+
*
|
|
1254
|
+
* @example
|
|
1255
|
+
* ```html
|
|
1256
|
+
* <tbw-grid [groupingColumns]="{ columnGroups: [...] }" />
|
|
1257
|
+
* ```
|
|
1258
|
+
*/
|
|
1259
|
+
groupingColumns = c();
|
|
1260
|
+
/**
|
|
1261
|
+
* Enable horizontal column virtualization for wide grids.
|
|
1262
|
+
*
|
|
1263
|
+
* **Requires feature import:**
|
|
1264
|
+
* ```typescript
|
|
1265
|
+
* import '@toolbox-web/grid-angular/features/column-virtualization';
|
|
1266
|
+
* ```
|
|
1267
|
+
*
|
|
1268
|
+
* @example
|
|
1269
|
+
* ```html
|
|
1270
|
+
* <tbw-grid [columnVirtualization]="true" />
|
|
1271
|
+
* ```
|
|
1272
|
+
*/
|
|
1273
|
+
columnVirtualization = c();
|
|
1274
|
+
/**
|
|
1275
|
+
* Enable row drag-to-reorder.
|
|
1276
|
+
*
|
|
1277
|
+
* **Requires feature import:**
|
|
1278
|
+
* ```typescript
|
|
1279
|
+
* import '@toolbox-web/grid-angular/features/row-reorder';
|
|
1280
|
+
* ```
|
|
1281
|
+
*
|
|
1282
|
+
* @example
|
|
1283
|
+
* ```html
|
|
1284
|
+
* <tbw-grid [rowReorder]="true" />
|
|
1285
|
+
* ```
|
|
1286
|
+
*/
|
|
1287
|
+
rowReorder = c();
|
|
1288
|
+
/**
|
|
1289
|
+
* Enable row grouping by field values.
|
|
1290
|
+
*
|
|
1291
|
+
* **Requires feature import:**
|
|
1292
|
+
* ```typescript
|
|
1293
|
+
* import '@toolbox-web/grid-angular/features/grouping-rows';
|
|
1294
|
+
* ```
|
|
1295
|
+
*
|
|
1296
|
+
* @example
|
|
1297
|
+
* ```html
|
|
1298
|
+
* <tbw-grid [groupingRows]="{ groupBy: ['department'] }" />
|
|
1299
|
+
* ```
|
|
1300
|
+
*/
|
|
1301
|
+
groupingRows = c();
|
|
1302
|
+
/**
|
|
1303
|
+
* Enable pinned rows (aggregation/status bar).
|
|
1304
|
+
*
|
|
1305
|
+
* **Requires feature import:**
|
|
1306
|
+
* ```typescript
|
|
1307
|
+
* import '@toolbox-web/grid-angular/features/pinned-rows';
|
|
1308
|
+
* ```
|
|
1309
|
+
*
|
|
1310
|
+
* @example
|
|
1311
|
+
* ```html
|
|
1312
|
+
* <tbw-grid [pinnedRows]="{ bottom: [{ type: 'aggregation' }] }" />
|
|
1313
|
+
* ```
|
|
1314
|
+
*/
|
|
1315
|
+
pinnedRows = c();
|
|
1316
|
+
/**
|
|
1317
|
+
* Enable hierarchical tree view.
|
|
1318
|
+
*
|
|
1319
|
+
* **Requires feature import:**
|
|
1320
|
+
* ```typescript
|
|
1321
|
+
* import '@toolbox-web/grid-angular/features/tree';
|
|
1322
|
+
* ```
|
|
1323
|
+
*
|
|
1324
|
+
* @example
|
|
1325
|
+
* ```html
|
|
1326
|
+
* <tbw-grid [tree]="{ childrenField: 'children' }" />
|
|
1327
|
+
* ```
|
|
1328
|
+
*/
|
|
1329
|
+
tree = c();
|
|
1330
|
+
/**
|
|
1331
|
+
* Enable master-detail expandable rows.
|
|
1332
|
+
*
|
|
1333
|
+
* **Requires feature import:**
|
|
1334
|
+
* ```typescript
|
|
1335
|
+
* import '@toolbox-web/grid-angular/features/master-detail';
|
|
1336
|
+
* ```
|
|
1337
|
+
*
|
|
1338
|
+
* @example
|
|
1339
|
+
* ```html
|
|
1340
|
+
* <tbw-grid [masterDetail]="{ detailRenderer: detailFn }" />
|
|
1341
|
+
* ```
|
|
1342
|
+
*/
|
|
1343
|
+
masterDetail = c();
|
|
1344
|
+
/**
|
|
1345
|
+
* Enable responsive card layout for narrow viewports.
|
|
1346
|
+
*
|
|
1347
|
+
* **Requires feature import:**
|
|
1348
|
+
* ```typescript
|
|
1349
|
+
* import '@toolbox-web/grid-angular/features/responsive';
|
|
1350
|
+
* ```
|
|
1351
|
+
*
|
|
1352
|
+
* @example
|
|
1353
|
+
* ```html
|
|
1354
|
+
* <tbw-grid [responsive]="{ breakpoint: 768 }" />
|
|
1355
|
+
* ```
|
|
1356
|
+
*/
|
|
1357
|
+
responsive = c();
|
|
1358
|
+
/**
|
|
1359
|
+
* Enable undo/redo for cell edits. Requires editing to be enabled.
|
|
1360
|
+
*
|
|
1361
|
+
* **Requires feature import:**
|
|
1362
|
+
* ```typescript
|
|
1363
|
+
* import '@toolbox-web/grid-angular/features/undo-redo';
|
|
1364
|
+
* ```
|
|
1365
|
+
*
|
|
1366
|
+
* @example
|
|
1367
|
+
* ```html
|
|
1368
|
+
* <tbw-grid [editing]="'dblclick'" [undoRedo]="true" />
|
|
1369
|
+
* ```
|
|
1370
|
+
*/
|
|
1371
|
+
undoRedo = c();
|
|
1372
|
+
/**
|
|
1373
|
+
* Enable CSV/JSON export functionality.
|
|
1374
|
+
*
|
|
1375
|
+
* **Requires feature import:**
|
|
1376
|
+
* ```typescript
|
|
1377
|
+
* import '@toolbox-web/grid-angular/features/export';
|
|
1378
|
+
* ```
|
|
1379
|
+
*
|
|
1380
|
+
* @example
|
|
1381
|
+
* ```html
|
|
1382
|
+
* <tbw-grid [export]="true" />
|
|
1383
|
+
* <tbw-grid [export]="{ filename: 'data.csv' }" />
|
|
1384
|
+
* ```
|
|
1385
|
+
*/
|
|
1386
|
+
exportFeature = c();
|
|
1387
|
+
/**
|
|
1388
|
+
* Enable print functionality.
|
|
1389
|
+
*
|
|
1390
|
+
* **Requires feature import:**
|
|
1391
|
+
* ```typescript
|
|
1392
|
+
* import '@toolbox-web/grid-angular/features/print';
|
|
1393
|
+
* ```
|
|
1394
|
+
*
|
|
1395
|
+
* @example
|
|
1396
|
+
* ```html
|
|
1397
|
+
* <tbw-grid [print]="true" />
|
|
1398
|
+
* ```
|
|
1399
|
+
*/
|
|
1400
|
+
print = c();
|
|
1401
|
+
/**
|
|
1402
|
+
* Enable pivot table functionality.
|
|
1403
|
+
*
|
|
1404
|
+
* **Requires feature import:**
|
|
1405
|
+
* ```typescript
|
|
1406
|
+
* import '@toolbox-web/grid-angular/features/pivot';
|
|
1407
|
+
* ```
|
|
1408
|
+
*
|
|
1409
|
+
* @example
|
|
1410
|
+
* ```html
|
|
1411
|
+
* <tbw-grid [pivot]="{ rowFields: ['category'], valueField: 'sales' }" />
|
|
1412
|
+
* ```
|
|
1413
|
+
*/
|
|
1414
|
+
pivot = c();
|
|
1415
|
+
/**
|
|
1416
|
+
* Enable server-side data operations.
|
|
1417
|
+
*
|
|
1418
|
+
* **Requires feature import:**
|
|
1419
|
+
* ```typescript
|
|
1420
|
+
* import '@toolbox-web/grid-angular/features/server-side';
|
|
1421
|
+
* ```
|
|
1422
|
+
*
|
|
1423
|
+
* @example
|
|
1424
|
+
* ```html
|
|
1425
|
+
* <tbw-grid [serverSide]="{ dataSource: fetchDataFn }" />
|
|
1426
|
+
* ```
|
|
1427
|
+
*/
|
|
1428
|
+
serverSide = c();
|
|
1429
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1430
|
+
// EVENT OUTPUTS - All grid events
|
|
1431
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
1432
|
+
/**
|
|
1433
|
+
* Emitted when a cell is clicked.
|
|
1434
|
+
*
|
|
1435
|
+
* @example
|
|
1436
|
+
* ```html
|
|
1437
|
+
* <tbw-grid (cellClick)="onCellClick($event)">...</tbw-grid>
|
|
1438
|
+
* ```
|
|
1439
|
+
*/
|
|
1440
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1441
|
+
cellClick = p();
|
|
1442
|
+
/**
|
|
1443
|
+
* Emitted when a row is clicked.
|
|
1444
|
+
*
|
|
1445
|
+
* @example
|
|
1446
|
+
* ```html
|
|
1447
|
+
* <tbw-grid (rowClick)="onRowClick($event)">...</tbw-grid>
|
|
1448
|
+
* ```
|
|
1449
|
+
*/
|
|
1450
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1451
|
+
rowClick = p();
|
|
1452
|
+
/**
|
|
1453
|
+
* Emitted when a cell is activated (Enter key or double-click).
|
|
1454
|
+
*
|
|
1455
|
+
* @example
|
|
1456
|
+
* ```html
|
|
1457
|
+
* <tbw-grid (cellActivate)="onCellActivate($event)">...</tbw-grid>
|
|
1458
|
+
* ```
|
|
1459
|
+
*/
|
|
1460
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1461
|
+
cellActivate = p();
|
|
1462
|
+
/**
|
|
1463
|
+
* Emitted when a cell value changes (before commit).
|
|
1464
|
+
*
|
|
1465
|
+
* @example
|
|
1466
|
+
* ```html
|
|
1467
|
+
* <tbw-grid (cellChange)="onCellChange($event)">...</tbw-grid>
|
|
1468
|
+
* ```
|
|
1469
|
+
*/
|
|
1470
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1471
|
+
cellChange = p();
|
|
732
1472
|
/**
|
|
733
1473
|
* Emitted when a cell value is committed (inline editing).
|
|
734
1474
|
* Provides the row, field, new value, and change tracking information.
|
|
@@ -744,7 +1484,7 @@ class G {
|
|
|
744
1484
|
* }
|
|
745
1485
|
* ```
|
|
746
1486
|
*/
|
|
747
|
-
cellCommit =
|
|
1487
|
+
cellCommit = p();
|
|
748
1488
|
/**
|
|
749
1489
|
* Emitted when a row's values are committed (bulk/row editing).
|
|
750
1490
|
* Provides the row data and change tracking information.
|
|
@@ -754,17 +1494,240 @@ class G {
|
|
|
754
1494
|
* <tbw-grid (rowCommit)="onRowCommit($event)">...</tbw-grid>
|
|
755
1495
|
* ```
|
|
756
1496
|
*/
|
|
757
|
-
rowCommit =
|
|
1497
|
+
rowCommit = p();
|
|
1498
|
+
/**
|
|
1499
|
+
* Emitted when the changed rows are reset.
|
|
1500
|
+
*
|
|
1501
|
+
* @example
|
|
1502
|
+
* ```html
|
|
1503
|
+
* <tbw-grid (changedRowsReset)="onChangedRowsReset($event)">...</tbw-grid>
|
|
1504
|
+
* ```
|
|
1505
|
+
*/
|
|
1506
|
+
changedRowsReset = p();
|
|
1507
|
+
/**
|
|
1508
|
+
* Emitted when sort state changes.
|
|
1509
|
+
*
|
|
1510
|
+
* @example
|
|
1511
|
+
* ```html
|
|
1512
|
+
* <tbw-grid (sortChange)="onSortChange($event)">...</tbw-grid>
|
|
1513
|
+
* ```
|
|
1514
|
+
*/
|
|
1515
|
+
sortChange = p();
|
|
1516
|
+
/**
|
|
1517
|
+
* Emitted when filter values change.
|
|
1518
|
+
*
|
|
1519
|
+
* @example
|
|
1520
|
+
* ```html
|
|
1521
|
+
* <tbw-grid (filterChange)="onFilterChange($event)">...</tbw-grid>
|
|
1522
|
+
* ```
|
|
1523
|
+
*/
|
|
1524
|
+
filterChange = p();
|
|
1525
|
+
/**
|
|
1526
|
+
* Emitted when a column is resized.
|
|
1527
|
+
*
|
|
1528
|
+
* @example
|
|
1529
|
+
* ```html
|
|
1530
|
+
* <tbw-grid (columnResize)="onColumnResize($event)">...</tbw-grid>
|
|
1531
|
+
* ```
|
|
1532
|
+
*/
|
|
1533
|
+
columnResize = p();
|
|
1534
|
+
/**
|
|
1535
|
+
* Emitted when a column is moved via drag-and-drop.
|
|
1536
|
+
*
|
|
1537
|
+
* @example
|
|
1538
|
+
* ```html
|
|
1539
|
+
* <tbw-grid (columnMove)="onColumnMove($event)">...</tbw-grid>
|
|
1540
|
+
* ```
|
|
1541
|
+
*/
|
|
1542
|
+
columnMove = p();
|
|
1543
|
+
/**
|
|
1544
|
+
* Emitted when column visibility changes.
|
|
1545
|
+
*
|
|
1546
|
+
* @example
|
|
1547
|
+
* ```html
|
|
1548
|
+
* <tbw-grid (columnVisibility)="onColumnVisibility($event)">...</tbw-grid>
|
|
1549
|
+
* ```
|
|
1550
|
+
*/
|
|
1551
|
+
columnVisibility = p();
|
|
1552
|
+
/**
|
|
1553
|
+
* Emitted when column state changes (resize, reorder, visibility).
|
|
1554
|
+
*
|
|
1555
|
+
* @example
|
|
1556
|
+
* ```html
|
|
1557
|
+
* <tbw-grid (columnStateChange)="onColumnStateChange($event)">...</tbw-grid>
|
|
1558
|
+
* ```
|
|
1559
|
+
*/
|
|
1560
|
+
columnStateChange = p();
|
|
1561
|
+
/**
|
|
1562
|
+
* Emitted when selection changes.
|
|
1563
|
+
*
|
|
1564
|
+
* @example
|
|
1565
|
+
* ```html
|
|
1566
|
+
* <tbw-grid (selectionChange)="onSelectionChange($event)">...</tbw-grid>
|
|
1567
|
+
* ```
|
|
1568
|
+
*/
|
|
1569
|
+
selectionChange = p();
|
|
1570
|
+
/**
|
|
1571
|
+
* Emitted when a row is moved via drag-and-drop.
|
|
1572
|
+
*
|
|
1573
|
+
* @example
|
|
1574
|
+
* ```html
|
|
1575
|
+
* <tbw-grid (rowMove)="onRowMove($event)">...</tbw-grid>
|
|
1576
|
+
* ```
|
|
1577
|
+
*/
|
|
1578
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1579
|
+
rowMove = p();
|
|
1580
|
+
/**
|
|
1581
|
+
* Emitted when a group is expanded or collapsed.
|
|
1582
|
+
*
|
|
1583
|
+
* @example
|
|
1584
|
+
* ```html
|
|
1585
|
+
* <tbw-grid (groupToggle)="onGroupToggle($event)">...</tbw-grid>
|
|
1586
|
+
* ```
|
|
1587
|
+
*/
|
|
1588
|
+
groupToggle = p();
|
|
1589
|
+
/**
|
|
1590
|
+
* Emitted when a tree node is expanded.
|
|
1591
|
+
*
|
|
1592
|
+
* @example
|
|
1593
|
+
* ```html
|
|
1594
|
+
* <tbw-grid (treeExpand)="onTreeExpand($event)">...</tbw-grid>
|
|
1595
|
+
* ```
|
|
1596
|
+
*/
|
|
1597
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1598
|
+
treeExpand = p();
|
|
1599
|
+
/**
|
|
1600
|
+
* Emitted when a detail panel is expanded or collapsed.
|
|
1601
|
+
*
|
|
1602
|
+
* @example
|
|
1603
|
+
* ```html
|
|
1604
|
+
* <tbw-grid (detailExpand)="onDetailExpand($event)">...</tbw-grid>
|
|
1605
|
+
* ```
|
|
1606
|
+
*/
|
|
1607
|
+
detailExpand = p();
|
|
1608
|
+
/**
|
|
1609
|
+
* Emitted when responsive mode changes (table ↔ card).
|
|
1610
|
+
*
|
|
1611
|
+
* @example
|
|
1612
|
+
* ```html
|
|
1613
|
+
* <tbw-grid (responsiveChange)="onResponsiveChange($event)">...</tbw-grid>
|
|
1614
|
+
* ```
|
|
1615
|
+
*/
|
|
1616
|
+
responsiveChange = p();
|
|
1617
|
+
/**
|
|
1618
|
+
* Emitted when cells are copied to clipboard.
|
|
1619
|
+
*
|
|
1620
|
+
* @example
|
|
1621
|
+
* ```html
|
|
1622
|
+
* <tbw-grid (copy)="onCopy($event)">...</tbw-grid>
|
|
1623
|
+
* ```
|
|
1624
|
+
*/
|
|
1625
|
+
copy = p();
|
|
1626
|
+
/**
|
|
1627
|
+
* Emitted when cells are pasted from clipboard.
|
|
1628
|
+
*
|
|
1629
|
+
* @example
|
|
1630
|
+
* ```html
|
|
1631
|
+
* <tbw-grid (paste)="onPaste($event)">...</tbw-grid>
|
|
1632
|
+
* ```
|
|
1633
|
+
*/
|
|
1634
|
+
paste = p();
|
|
1635
|
+
/**
|
|
1636
|
+
* Emitted when undo/redo is performed.
|
|
1637
|
+
*
|
|
1638
|
+
* @example
|
|
1639
|
+
* ```html
|
|
1640
|
+
* <tbw-grid (undoRedoAction)="onUndoRedo($event)">...</tbw-grid>
|
|
1641
|
+
* ```
|
|
1642
|
+
*/
|
|
1643
|
+
undoRedoAction = p();
|
|
1644
|
+
/**
|
|
1645
|
+
* Emitted when export completes.
|
|
1646
|
+
*
|
|
1647
|
+
* @example
|
|
1648
|
+
* ```html
|
|
1649
|
+
* <tbw-grid (exportComplete)="onExportComplete($event)">...</tbw-grid>
|
|
1650
|
+
* ```
|
|
1651
|
+
*/
|
|
1652
|
+
exportComplete = p();
|
|
1653
|
+
/**
|
|
1654
|
+
* Emitted when print starts.
|
|
1655
|
+
*
|
|
1656
|
+
* @example
|
|
1657
|
+
* ```html
|
|
1658
|
+
* <tbw-grid (printStart)="onPrintStart($event)">...</tbw-grid>
|
|
1659
|
+
* ```
|
|
1660
|
+
*/
|
|
1661
|
+
printStart = p();
|
|
1662
|
+
/**
|
|
1663
|
+
* Emitted when print completes.
|
|
1664
|
+
*
|
|
1665
|
+
* @example
|
|
1666
|
+
* ```html
|
|
1667
|
+
* <tbw-grid (printComplete)="onPrintComplete($event)">...</tbw-grid>
|
|
1668
|
+
* ```
|
|
1669
|
+
*/
|
|
1670
|
+
printComplete = p();
|
|
1671
|
+
// Map of output names to event names for automatic wiring
|
|
1672
|
+
eventOutputMap = {
|
|
1673
|
+
cellClick: "cell-click",
|
|
1674
|
+
rowClick: "row-click",
|
|
1675
|
+
cellActivate: "cell-activate",
|
|
1676
|
+
cellChange: "cell-change",
|
|
1677
|
+
cellCommit: "cell-commit",
|
|
1678
|
+
rowCommit: "row-commit",
|
|
1679
|
+
changedRowsReset: "changed-rows-reset",
|
|
1680
|
+
sortChange: "sort-change",
|
|
1681
|
+
filterChange: "filter-change",
|
|
1682
|
+
columnResize: "column-resize",
|
|
1683
|
+
columnMove: "column-move",
|
|
1684
|
+
columnVisibility: "column-visibility",
|
|
1685
|
+
columnStateChange: "column-state-change",
|
|
1686
|
+
selectionChange: "selection-change",
|
|
1687
|
+
rowMove: "row-move",
|
|
1688
|
+
groupToggle: "group-toggle",
|
|
1689
|
+
treeExpand: "tree-expand",
|
|
1690
|
+
detailExpand: "detail-expand",
|
|
1691
|
+
responsiveChange: "responsive-change",
|
|
1692
|
+
copy: "copy",
|
|
1693
|
+
paste: "paste",
|
|
1694
|
+
undoRedoAction: "undo-redo",
|
|
1695
|
+
exportComplete: "export-complete",
|
|
1696
|
+
printStart: "print-start",
|
|
1697
|
+
printComplete: "print-complete"
|
|
1698
|
+
};
|
|
1699
|
+
// Store event listeners for cleanup
|
|
1700
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1701
|
+
eventListeners = /* @__PURE__ */ new Map();
|
|
758
1702
|
ngOnInit() {
|
|
759
|
-
this.adapter = new
|
|
1703
|
+
this.adapter = new ct(this.injector, this.appRef, this.viewContainerRef), nt.registerAdapter(this.adapter);
|
|
760
1704
|
const e = this.elementRef.nativeElement;
|
|
761
|
-
this.
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
1705
|
+
this.setupEventListeners(e), e.__frameworkAdapter = this.adapter;
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Sets up event listeners for all outputs using the eventOutputMap.
|
|
1709
|
+
*/
|
|
1710
|
+
setupEventListeners(e) {
|
|
1711
|
+
for (const [t, n] of Object.entries(this.eventOutputMap)) {
|
|
1712
|
+
const r = (o) => {
|
|
1713
|
+
const s = o.detail;
|
|
1714
|
+
this[t].emit(s);
|
|
1715
|
+
};
|
|
1716
|
+
e.addEventListener(n, r), this.eventListeners.set(n, r);
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Creates plugins from feature inputs.
|
|
1721
|
+
* Uses the feature registry to allow tree-shaking - only imported features are bundled.
|
|
1722
|
+
* Returns the array of created plugins (doesn't modify grid).
|
|
1723
|
+
*/
|
|
1724
|
+
createFeaturePlugins() {
|
|
1725
|
+
const e = [], t = (n, r) => {
|
|
1726
|
+
if (r == null || r === !1) return;
|
|
1727
|
+
const o = tt(n, r);
|
|
1728
|
+
o && e.push(o);
|
|
1729
|
+
};
|
|
1730
|
+
return t("selection", this.selection()), t("editing", this.editing()), t("clipboard", this.clipboard()), t("contextMenu", this.contextMenu()), t("sorting", 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;
|
|
768
1731
|
}
|
|
769
1732
|
ngAfterContentInit() {
|
|
770
1733
|
const e = this.elementRef.nativeElement;
|
|
@@ -785,30 +1748,30 @@ class G {
|
|
|
785
1748
|
/**
|
|
786
1749
|
* Configures the MasterDetailPlugin after Angular templates are registered.
|
|
787
1750
|
* - If plugin exists: refresh its detail renderer
|
|
788
|
-
* - If plugin doesn't exist but <tbw-grid-detail> is present:
|
|
1751
|
+
* - If plugin doesn't exist but <tbw-grid-detail> is present: dynamically import and add the plugin
|
|
789
1752
|
*/
|
|
790
|
-
configureMasterDetail(e) {
|
|
1753
|
+
async configureMasterDetail(e) {
|
|
791
1754
|
if (!this.adapter) return;
|
|
792
|
-
const t = e.
|
|
1755
|
+
const t = e.gridConfig?.plugins?.find((R) => R.name === "masterDetail");
|
|
793
1756
|
if (t && typeof t.refreshDetailRenderer == "function") {
|
|
794
1757
|
t.refreshDetailRenderer();
|
|
795
1758
|
return;
|
|
796
1759
|
}
|
|
797
|
-
const
|
|
1760
|
+
const n = e.querySelector("tbw-grid-detail");
|
|
1761
|
+
if (!n) return;
|
|
1762
|
+
const r = this.adapter.createDetailRenderer(e);
|
|
798
1763
|
if (!r) return;
|
|
799
|
-
const
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
const l = r.getAttribute("showExpandColumn") !== "false", w = new ce({
|
|
805
|
-
detailRenderer: i,
|
|
1764
|
+
const o = n.getAttribute("animation");
|
|
1765
|
+
let s = "slide";
|
|
1766
|
+
o === "false" ? s = !1 : o === "fade" && (s = "fade");
|
|
1767
|
+
const l = n.getAttribute("showExpandColumn") !== "false", { MasterDetailPlugin: g } = await import("@toolbox-web/grid/plugins/master-detail"), w = new g({
|
|
1768
|
+
detailRenderer: r,
|
|
806
1769
|
showExpandColumn: l,
|
|
807
|
-
animation:
|
|
808
|
-
}),
|
|
1770
|
+
animation: s
|
|
1771
|
+
}), A = e.gridConfig || {}, a = A.plugins || [];
|
|
809
1772
|
e.gridConfig = {
|
|
810
|
-
...
|
|
811
|
-
plugins: [...
|
|
1773
|
+
...A,
|
|
1774
|
+
plugins: [...a, w]
|
|
812
1775
|
};
|
|
813
1776
|
}
|
|
814
1777
|
/**
|
|
@@ -818,18 +1781,18 @@ class G {
|
|
|
818
1781
|
*/
|
|
819
1782
|
configureResponsiveCard(e) {
|
|
820
1783
|
if (!this.adapter || !e.querySelector("tbw-grid-responsive-card")) return;
|
|
821
|
-
const
|
|
822
|
-
if (!
|
|
823
|
-
const
|
|
824
|
-
if (
|
|
825
|
-
|
|
1784
|
+
const n = this.adapter.createResponsiveCardRenderer(e);
|
|
1785
|
+
if (!n) return;
|
|
1786
|
+
const r = e.gridConfig?.plugins?.find((o) => o.name === "responsive");
|
|
1787
|
+
if (r && typeof r.setCardRenderer == "function") {
|
|
1788
|
+
r.setCardRenderer(n);
|
|
826
1789
|
return;
|
|
827
1790
|
}
|
|
828
1791
|
console.warn(
|
|
829
1792
|
`[tbw-grid-angular] <tbw-grid-responsive-card> found but ResponsivePlugin is not configured.
|
|
830
1793
|
Add ResponsivePlugin to your gridConfig.plugins array:
|
|
831
1794
|
|
|
832
|
-
import { ResponsivePlugin } from "@toolbox-web/grid/
|
|
1795
|
+
import { ResponsivePlugin } from "@toolbox-web/grid/plugins/responsive";
|
|
833
1796
|
gridConfig = {
|
|
834
1797
|
plugins: [new ResponsivePlugin({ breakpoint: 600 })]
|
|
835
1798
|
};`
|
|
@@ -837,24 +1800,39 @@ Add ResponsivePlugin to your gridConfig.plugins array:
|
|
|
837
1800
|
}
|
|
838
1801
|
ngOnDestroy() {
|
|
839
1802
|
const e = this.elementRef.nativeElement;
|
|
840
|
-
|
|
1803
|
+
if (e) {
|
|
1804
|
+
for (const [t, n] of this.eventListeners)
|
|
1805
|
+
e.removeEventListener(t, n);
|
|
1806
|
+
this.eventListeners.clear();
|
|
1807
|
+
}
|
|
1808
|
+
e && this.customStyles() && e.unregisterStyles?.("angular-custom-styles"), this.adapter && (this.adapter.destroy?.(), this.adapter = null);
|
|
841
1809
|
}
|
|
842
1810
|
}
|
|
843
|
-
|
|
1811
|
+
se = E(null), Y = b(se, 0, "Grid", Me, Y), y(se, 1, Y);
|
|
844
1812
|
export {
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
_ as
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
1813
|
+
ct as AngularGridAdapter,
|
|
1814
|
+
H as BaseGridEditor,
|
|
1815
|
+
qe as GRID_TYPE_DEFAULTS,
|
|
1816
|
+
Y as Grid,
|
|
1817
|
+
q as GridColumnEditor,
|
|
1818
|
+
_ as GridColumnView,
|
|
1819
|
+
$ as GridDetailView,
|
|
1820
|
+
z as GridFormArray,
|
|
1821
|
+
B as GridResponsiveCard,
|
|
1822
|
+
U as GridToolPanel,
|
|
1823
|
+
I as GridTypeRegistry,
|
|
1824
|
+
W as TbwCellEditor,
|
|
1825
|
+
J as TbwCellView,
|
|
1826
|
+
W as TbwEditor,
|
|
1827
|
+
J as TbwRenderer,
|
|
1828
|
+
wt as clearFeatureRegistry,
|
|
1829
|
+
tt as createPluginFromFeature,
|
|
1830
|
+
Rt as getFeatureFactory,
|
|
1831
|
+
rt as getFormArrayContext,
|
|
1832
|
+
Ct as getRegisteredFeatures,
|
|
1833
|
+
gt as injectGrid,
|
|
1834
|
+
we as isComponentClass,
|
|
1835
|
+
Et as isFeatureRegistered,
|
|
1836
|
+
ft as provideGridTypeDefaults,
|
|
1837
|
+
yt as registerFeature
|
|
860
1838
|
};
|