@toolbox-web/grid-angular 0.3.1 → 0.5.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/index.d.ts +5 -0
- package/index.d.ts.map +1 -1
- package/index.js +544 -196
- package/lib/angular-grid-adapter.d.ts +8 -0
- 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-form-array.directive.d.ts +141 -0
- package/lib/directives/grid-form-array.directive.d.ts.map +1 -0
- package/lib/directives/grid-responsive-card.directive.d.ts +92 -0
- package/lib/directives/grid-responsive-card.directive.d.ts.map +1 -0
- package/lib/directives/grid.directive.d.ts +6 -0
- package/lib/directives/grid.directive.d.ts.map +1 -1
- package/lib/directives/index.d.ts +3 -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/package.json +2 -2
package/index.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
1
|
+
var qe = Object.create;
|
|
2
|
+
var j = Object.defineProperty;
|
|
3
|
+
var $e = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var ue = (n, e) => (e = Symbol[n]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + n), I = (n) => {
|
|
5
5
|
throw TypeError(n);
|
|
6
6
|
};
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var h = (n) => [, , ,
|
|
10
|
-
for (var r = 0,
|
|
7
|
+
var Ue = (n, e, t) => e in n ? j(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
8
|
+
var ce = (n, e) => j(n, "name", { value: e, configurable: !0 });
|
|
9
|
+
var h = (n) => [, , , qe(n?.[ue("metadata")] ?? null)], de = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], O = (n) => n !== void 0 && typeof n != "function" ? I("Function expected") : n, We = (n, e, t, i, r) => ({ kind: de[n], name: e, metadata: i, addInitializer: (o) => t._ ? I("Already initialized") : r.push(O(o || null)) }), He = (n, e) => Ue(e, ue("metadata"), n[3]), g = (n, e, t, i) => {
|
|
10
|
+
for (var r = 0, o = n[e >> 1], s = o && o.length; r < s; r++) e & 1 ? o[r].call(t) : i = o[r].call(t, i);
|
|
11
11
|
return i;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
return
|
|
15
|
-
}, set [t](
|
|
16
|
-
return
|
|
12
|
+
}, v = (n, e, t, i, r, o) => {
|
|
13
|
+
var s, l, m, d, T, c = e & 7, C = !!(e & 8), a = !!(e & 16), b = c > 3 ? n.length + 1 : c ? C ? 1 : 2 : 0, D = de[c + 5], le = c > 3 && (n[b - 1] = []), Ge = n[b] || (n[b] = []), w = c && (!a && !C && (r = r.prototype), c < 5 && (c > 3 || !a) && $e(c < 4 ? r : { get [t]() {
|
|
14
|
+
return ae(this, o);
|
|
15
|
+
}, set [t](p) {
|
|
16
|
+
return me(this, o, p);
|
|
17
17
|
} }, t));
|
|
18
|
-
|
|
19
|
-
for (var
|
|
20
|
-
|
|
21
|
-
return
|
|
18
|
+
c ? a && c < 4 && ce(o, (c > 2 ? "set " : c > 1 ? "get " : "") + t) : ce(r, t);
|
|
19
|
+
for (var P = i.length - 1; P >= 0; P--)
|
|
20
|
+
d = We(c, t, m = {}, n[3], Ge), c && (d.static = C, d.private = a, T = d.access = { has: a ? (p) => Ye(r, p) : (p) => t in p }, c ^ 3 && (T.get = a ? (p) => (c ^ 1 ? ae : Xe)(p, r, c ^ 4 ? o : w.get) : (p) => p[t]), c > 2 && (T.set = a ? (p, F) => me(p, r, F, c ^ 4 ? o : w.set) : (p, F) => p[t] = F)), l = (0, i[P])(c ? c < 4 ? a ? o : w[D] : c > 4 ? void 0 : { get: w.get, set: w.set } : r, d), m._ = 1, c ^ 4 || l === void 0 ? O(l) && (c > 4 ? le.unshift(l) : c ? a ? o = l : w[D] = l : r = l) : typeof l != "object" || l === null ? I("Object expected") : (O(s = l.get) && (w.get = s), O(s = l.set) && (w.set = s), O(s = l.init) && le.unshift(s));
|
|
21
|
+
return c || He(n, r), w && j(r, t, w), a ? c ^ 4 ? o : w : r;
|
|
22
22
|
};
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
import { inject as
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
23
|
+
var k = (n, e, t) => e.has(n) || I("Cannot " + t), Ye = (n, e) => Object(e) !== e ? I('Cannot use the "in" operator on this value') : n.has(e), ae = (n, e, t) => (k(n, e, "read from private field"), t ? t.call(n) : e.get(n));
|
|
24
|
+
var me = (n, e, t, i) => (k(n, e, "write to private field"), i ? i.call(n, t) : e.set(n, t), t), Xe = (n, e, t) => (k(n, e, "access private method"), t);
|
|
25
|
+
import { inject as u, ElementRef as R, contentChild as x, TemplateRef as L, effect as y, Directive as E, input as f, InjectionToken as ze, Injectable as Be, makeEnvironmentProviders as Je, EventEmitter as fe, createComponent as pe, output as S, computed as A, EnvironmentInjector as Ke, ApplicationRef as Qe, ViewContainerRef as Ze } from "@angular/core";
|
|
26
|
+
import { FormGroup as he } from "@angular/forms";
|
|
27
|
+
import { DataGridElement as et } from "@toolbox-web/grid";
|
|
28
|
+
import { MasterDetailPlugin as ge, ResponsivePlugin as tt } from "@toolbox-web/grid/all";
|
|
29
|
+
function ve(n) {
|
|
29
30
|
if (typeof n != "function" || n.prototype === void 0)
|
|
30
31
|
return !1;
|
|
31
32
|
if (Object.prototype.hasOwnProperty.call(n, "ɵcmp") || Object.prototype.hasOwnProperty.call(n, "ɵfac"))
|
|
@@ -33,22 +34,22 @@ function le(n) {
|
|
|
33
34
|
const e = Function.prototype.toString.call(n);
|
|
34
35
|
return e.startsWith("class ") || e.startsWith("class{");
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
-
function
|
|
38
|
-
return
|
|
37
|
+
const Se = /* @__PURE__ */ new Map();
|
|
38
|
+
function Pe(n) {
|
|
39
|
+
return Se.get(n);
|
|
39
40
|
}
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
class
|
|
43
|
-
elementRef =
|
|
41
|
+
var Ce, X;
|
|
42
|
+
Ce = [E({ selector: "tbw-grid-column-editor" })];
|
|
43
|
+
class V {
|
|
44
|
+
elementRef = u(R);
|
|
44
45
|
/**
|
|
45
46
|
* Query for the ng-template content child.
|
|
46
47
|
*/
|
|
47
|
-
template =
|
|
48
|
+
template = x(L);
|
|
48
49
|
/** Effect that triggers when the template is available */
|
|
49
|
-
onTemplateReceived =
|
|
50
|
+
onTemplateReceived = y(() => {
|
|
50
51
|
const e = this.template();
|
|
51
|
-
e &&
|
|
52
|
+
e && Se.set(this.elementRef.nativeElement, e);
|
|
52
53
|
});
|
|
53
54
|
/**
|
|
54
55
|
* Static type guard for template context.
|
|
@@ -58,23 +59,23 @@ class M {
|
|
|
58
59
|
return !0;
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
function
|
|
64
|
-
return
|
|
62
|
+
X = h(null), V = v(X, 0, "GridColumnEditor", Ce, V), g(X, 1, V);
|
|
63
|
+
const Fe = /* @__PURE__ */ new Map();
|
|
64
|
+
function je(n) {
|
|
65
|
+
return Fe.get(n);
|
|
65
66
|
}
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
class
|
|
69
|
-
elementRef =
|
|
67
|
+
var ye, z;
|
|
68
|
+
ye = [E({ selector: "tbw-grid-column-view" })];
|
|
69
|
+
class N {
|
|
70
|
+
elementRef = u(R);
|
|
70
71
|
/**
|
|
71
72
|
* Query for the ng-template content child.
|
|
72
73
|
*/
|
|
73
|
-
template =
|
|
74
|
+
template = x(L);
|
|
74
75
|
/** Effect that triggers when the template is available */
|
|
75
|
-
onTemplateReceived =
|
|
76
|
+
onTemplateReceived = y(() => {
|
|
76
77
|
const e = this.template();
|
|
77
|
-
e &&
|
|
78
|
+
e && Fe.set(this.elementRef.nativeElement, e);
|
|
78
79
|
});
|
|
79
80
|
/**
|
|
80
81
|
* Static type guard for template context.
|
|
@@ -84,29 +85,29 @@ class V {
|
|
|
84
85
|
return !0;
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
function
|
|
88
|
+
z = h(null), N = v(z, 0, "GridColumnView", ye, N), g(z, 1, N);
|
|
89
|
+
const ke = /* @__PURE__ */ new Map();
|
|
90
|
+
function we(n) {
|
|
90
91
|
const e = n.querySelector("tbw-grid-detail");
|
|
91
92
|
if (e)
|
|
92
|
-
return
|
|
93
|
+
return ke.get(e);
|
|
93
94
|
}
|
|
94
|
-
var
|
|
95
|
-
|
|
95
|
+
var be, B;
|
|
96
|
+
be = [E({ selector: "tbw-grid-detail" })];
|
|
96
97
|
class _ {
|
|
97
|
-
elementRef =
|
|
98
|
+
elementRef = u(R);
|
|
98
99
|
/** Whether to show the expand/collapse column. Default: true */
|
|
99
|
-
showExpandColumn =
|
|
100
|
+
showExpandColumn = f(!0);
|
|
100
101
|
/** Animation style for expand/collapse. Default: 'slide' */
|
|
101
|
-
animation =
|
|
102
|
+
animation = f("slide");
|
|
102
103
|
/**
|
|
103
104
|
* Query for the ng-template content child.
|
|
104
105
|
*/
|
|
105
|
-
template =
|
|
106
|
+
template = x(L);
|
|
106
107
|
/** Effect that triggers when the template is available */
|
|
107
|
-
onTemplateReceived =
|
|
108
|
+
onTemplateReceived = y(() => {
|
|
108
109
|
const e = this.template();
|
|
109
|
-
e &&
|
|
110
|
+
e && ke.set(this.elementRef.nativeElement, e);
|
|
110
111
|
});
|
|
111
112
|
/**
|
|
112
113
|
* Static type guard for template context.
|
|
@@ -116,38 +117,189 @@ class _ {
|
|
|
116
117
|
return !0;
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
function
|
|
122
|
-
return
|
|
120
|
+
B = h(null), _ = v(B, 0, "GridDetailView", be, _), g(B, 1, _);
|
|
121
|
+
const ie = /* @__PURE__ */ Symbol("formArrayContext");
|
|
122
|
+
function rt(n) {
|
|
123
|
+
return n[ie];
|
|
124
|
+
}
|
|
125
|
+
var Te, J;
|
|
126
|
+
Te = [E({
|
|
127
|
+
selector: "tbw-grid[formArray]"
|
|
128
|
+
})];
|
|
129
|
+
class G {
|
|
130
|
+
elementRef = u(R);
|
|
131
|
+
cellCommitListener = null;
|
|
132
|
+
touchListener = null;
|
|
133
|
+
/**
|
|
134
|
+
* The FormArray to bind to the grid.
|
|
135
|
+
*/
|
|
136
|
+
formArray = f.required();
|
|
137
|
+
/**
|
|
138
|
+
* Effect that syncs the FormArray value to the grid rows.
|
|
139
|
+
*/
|
|
140
|
+
syncFormArrayToGrid = y(() => {
|
|
141
|
+
const e = this.formArray(), t = this.elementRef.nativeElement;
|
|
142
|
+
t && e && (t.rows = e.getRawValue());
|
|
143
|
+
});
|
|
144
|
+
ngOnInit() {
|
|
145
|
+
const e = this.elementRef.nativeElement;
|
|
146
|
+
e && (this.#r(e), this.cellCommitListener = (t) => {
|
|
147
|
+
const i = t.detail;
|
|
148
|
+
this.#i(i);
|
|
149
|
+
}, e.addEventListener("cell-commit", this.cellCommitListener), this.touchListener = () => {
|
|
150
|
+
this.formArray().markAsTouched(), this.touchListener && (e.removeEventListener("click", this.touchListener), this.touchListener = null);
|
|
151
|
+
}, e.addEventListener("click", this.touchListener));
|
|
152
|
+
}
|
|
153
|
+
ngOnDestroy() {
|
|
154
|
+
const e = this.elementRef.nativeElement;
|
|
155
|
+
e && (this.cellCommitListener && e.removeEventListener("cell-commit", this.cellCommitListener), this.touchListener && e.removeEventListener("click", this.touchListener), this.#n(e));
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Checks if the FormArray contains FormGroups.
|
|
159
|
+
*/
|
|
160
|
+
#t() {
|
|
161
|
+
const e = this.formArray();
|
|
162
|
+
return e.length === 0 ? !1 : e.at(0) instanceof he;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Gets the FormGroup at a specific row index.
|
|
166
|
+
*/
|
|
167
|
+
#e(e) {
|
|
168
|
+
const i = this.formArray().at(e);
|
|
169
|
+
return i instanceof he ? i : void 0;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Stores the FormArrayContext on the grid element.
|
|
173
|
+
*/
|
|
174
|
+
#r(e) {
|
|
175
|
+
const t = (r) => this.#e(r), i = {
|
|
176
|
+
getRow: (r) => {
|
|
177
|
+
const s = this.formArray().at(r);
|
|
178
|
+
return s ? s.value : null;
|
|
179
|
+
},
|
|
180
|
+
updateField: (r, o, s) => {
|
|
181
|
+
const l = t(r);
|
|
182
|
+
if (l) {
|
|
183
|
+
const m = l.get(o);
|
|
184
|
+
m && (m.setValue(s), m.markAsDirty());
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
getValue: () => this.formArray().getRawValue(),
|
|
188
|
+
hasFormGroups: this.#t(),
|
|
189
|
+
getControl: (r, o) => {
|
|
190
|
+
const s = t(r);
|
|
191
|
+
if (s)
|
|
192
|
+
return s.get(o) ?? void 0;
|
|
193
|
+
},
|
|
194
|
+
getRowFormGroup: t,
|
|
195
|
+
isRowValid: (r) => {
|
|
196
|
+
const o = t(r);
|
|
197
|
+
return o ? o.valid : !0;
|
|
198
|
+
},
|
|
199
|
+
isRowTouched: (r) => {
|
|
200
|
+
const o = t(r);
|
|
201
|
+
return o ? o.touched : !1;
|
|
202
|
+
},
|
|
203
|
+
isRowDirty: (r) => {
|
|
204
|
+
const o = t(r);
|
|
205
|
+
return o ? o.dirty : !1;
|
|
206
|
+
},
|
|
207
|
+
getRowErrors: (r) => {
|
|
208
|
+
const o = t(r);
|
|
209
|
+
if (!o) return null;
|
|
210
|
+
const s = {};
|
|
211
|
+
let l = !1;
|
|
212
|
+
return Object.keys(o.controls).forEach((m) => {
|
|
213
|
+
const d = o.get(m);
|
|
214
|
+
d?.errors && (s[m] = d.errors, l = !0);
|
|
215
|
+
}), o.errors && (s._group = o.errors, l = !0), l ? s : null;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
e[ie] = i;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Clears the FormArrayContext from the grid element.
|
|
222
|
+
*/
|
|
223
|
+
#n(e) {
|
|
224
|
+
delete e[ie];
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Handles cell-commit events by updating the FormControl in the FormGroup.
|
|
228
|
+
*/
|
|
229
|
+
#i(e) {
|
|
230
|
+
const { rowIndex: t, field: i, value: r } = e, o = this.#e(t);
|
|
231
|
+
if (o) {
|
|
232
|
+
const s = o.get(i);
|
|
233
|
+
s && (s.setValue(r), s.markAsDirty(), s.markAsTouched());
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
J = h(null), G = v(J, 0, "GridFormArray", Te, G), g(J, 1, G);
|
|
238
|
+
const Ve = /* @__PURE__ */ new Map();
|
|
239
|
+
function nt(n) {
|
|
240
|
+
const e = n.querySelector("tbw-grid-responsive-card");
|
|
241
|
+
if (e)
|
|
242
|
+
return Ve.get(e);
|
|
123
243
|
}
|
|
124
|
-
var
|
|
125
|
-
|
|
244
|
+
var Ae, K;
|
|
245
|
+
Ae = [E({
|
|
246
|
+
selector: "tbw-grid-responsive-card"
|
|
247
|
+
})];
|
|
126
248
|
class q {
|
|
127
|
-
elementRef =
|
|
249
|
+
elementRef = u(R);
|
|
250
|
+
/**
|
|
251
|
+
* The ng-template containing the card content.
|
|
252
|
+
*/
|
|
253
|
+
template = x(L);
|
|
254
|
+
/**
|
|
255
|
+
* Effect that registers the template when it becomes available.
|
|
256
|
+
*/
|
|
257
|
+
onTemplateReceived = y(() => {
|
|
258
|
+
const e = this.template();
|
|
259
|
+
e && Ve.set(
|
|
260
|
+
this.elementRef.nativeElement,
|
|
261
|
+
e
|
|
262
|
+
);
|
|
263
|
+
});
|
|
264
|
+
/**
|
|
265
|
+
* Type guard for template context inference.
|
|
266
|
+
*/
|
|
267
|
+
static ngTemplateContextGuard(e, t) {
|
|
268
|
+
return !0;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
K = h(null), q = v(K, 0, "GridResponsiveCard", Ae, q), g(K, 1, q);
|
|
272
|
+
const Ne = /* @__PURE__ */ new Map();
|
|
273
|
+
function it(n) {
|
|
274
|
+
return Ne.get(n);
|
|
275
|
+
}
|
|
276
|
+
var Le, Q;
|
|
277
|
+
Le = [E({ selector: "tbw-grid-tool-panel" })];
|
|
278
|
+
class $ {
|
|
279
|
+
elementRef = u(R);
|
|
128
280
|
/** Unique panel identifier (required) */
|
|
129
|
-
id =
|
|
281
|
+
id = f.required({ alias: "id" });
|
|
130
282
|
/** Panel title shown in accordion header (required) */
|
|
131
|
-
title =
|
|
283
|
+
title = f.required({ alias: "title" });
|
|
132
284
|
/** Icon for accordion section header (emoji or text) */
|
|
133
|
-
icon =
|
|
285
|
+
icon = f();
|
|
134
286
|
/** Tooltip for accordion section header */
|
|
135
|
-
tooltip =
|
|
287
|
+
tooltip = f();
|
|
136
288
|
/** Panel order priority (lower = first, default: 100) */
|
|
137
|
-
order =
|
|
289
|
+
order = f(100);
|
|
138
290
|
/**
|
|
139
291
|
* Query for the ng-template content child.
|
|
140
292
|
*/
|
|
141
|
-
template =
|
|
293
|
+
template = x(L);
|
|
142
294
|
/** Effect that triggers when the template is available */
|
|
143
|
-
onTemplateReceived =
|
|
295
|
+
onTemplateReceived = y(() => {
|
|
144
296
|
const e = this.template(), t = this.elementRef.nativeElement;
|
|
145
297
|
if (e) {
|
|
146
298
|
t.setAttribute("id", this.id()), t.setAttribute("title", this.title());
|
|
147
299
|
const i = this.icon();
|
|
148
300
|
i && t.setAttribute("icon", i);
|
|
149
301
|
const r = this.tooltip();
|
|
150
|
-
r && t.setAttribute("tooltip", r), t.setAttribute("order", String(this.order())),
|
|
302
|
+
r && t.setAttribute("tooltip", r), t.setAttribute("order", String(this.order())), Ne.set(t, e);
|
|
151
303
|
}
|
|
152
304
|
});
|
|
153
305
|
/**
|
|
@@ -158,30 +310,30 @@ class q {
|
|
|
158
310
|
return !0;
|
|
159
311
|
}
|
|
160
312
|
}
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
function
|
|
164
|
-
const e =
|
|
313
|
+
Q = h(null), $ = v(Q, 0, "GridToolPanel", Le, $), g(Q, 1, $);
|
|
314
|
+
const oe = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Map();
|
|
315
|
+
function ot(n) {
|
|
316
|
+
const e = oe.get(n);
|
|
165
317
|
if (e) return e;
|
|
166
318
|
const t = n.querySelector("tbw-grid-column-view");
|
|
167
319
|
if (t)
|
|
168
|
-
return
|
|
320
|
+
return je(t);
|
|
169
321
|
}
|
|
170
|
-
function
|
|
171
|
-
const e =
|
|
322
|
+
function st(n) {
|
|
323
|
+
const e = se.get(n);
|
|
172
324
|
if (e) return e;
|
|
173
325
|
const t = n.querySelector("tbw-grid-column-editor");
|
|
174
326
|
if (t)
|
|
175
|
-
return
|
|
327
|
+
return Pe(t);
|
|
176
328
|
}
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
class
|
|
180
|
-
template =
|
|
181
|
-
elementRef =
|
|
329
|
+
var De, Z;
|
|
330
|
+
De = [E({ selector: "[tbwRenderer]" })];
|
|
331
|
+
class U {
|
|
332
|
+
template = u(L);
|
|
333
|
+
elementRef = u(R);
|
|
182
334
|
columnElement = null;
|
|
183
335
|
constructor() {
|
|
184
|
-
|
|
336
|
+
y(() => {
|
|
185
337
|
this.registerTemplate();
|
|
186
338
|
});
|
|
187
339
|
}
|
|
@@ -189,10 +341,10 @@ class G {
|
|
|
189
341
|
let e = this.elementRef.nativeElement?.parentElement;
|
|
190
342
|
for (; e && e.tagName !== "TBW-GRID-COLUMN"; )
|
|
191
343
|
e = e.parentElement;
|
|
192
|
-
e && (this.columnElement = e,
|
|
344
|
+
e && (this.columnElement = e, oe.set(e, this.template));
|
|
193
345
|
}
|
|
194
346
|
ngOnDestroy() {
|
|
195
|
-
this.columnElement &&
|
|
347
|
+
this.columnElement && oe.delete(this.columnElement);
|
|
196
348
|
}
|
|
197
349
|
/**
|
|
198
350
|
* Static type guard for template context.
|
|
@@ -202,15 +354,15 @@ class G {
|
|
|
202
354
|
return !0;
|
|
203
355
|
}
|
|
204
356
|
}
|
|
205
|
-
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
class
|
|
209
|
-
template =
|
|
210
|
-
elementRef =
|
|
357
|
+
Z = h(null), U = v(Z, 0, "TbwRenderer", De, U), g(Z, 1, U);
|
|
358
|
+
var Oe, ee;
|
|
359
|
+
Oe = [E({ selector: "[tbwEditor]" })];
|
|
360
|
+
class W {
|
|
361
|
+
template = u(L);
|
|
362
|
+
elementRef = u(R);
|
|
211
363
|
columnElement = null;
|
|
212
364
|
constructor() {
|
|
213
|
-
|
|
365
|
+
y(() => {
|
|
214
366
|
this.registerTemplate();
|
|
215
367
|
});
|
|
216
368
|
}
|
|
@@ -218,10 +370,10 @@ class k {
|
|
|
218
370
|
let e = this.elementRef.nativeElement?.parentElement;
|
|
219
371
|
for (; e && e.tagName !== "TBW-GRID-COLUMN"; )
|
|
220
372
|
e = e.parentElement;
|
|
221
|
-
e && (this.columnElement = e,
|
|
373
|
+
e && (this.columnElement = e, se.set(e, this.template));
|
|
222
374
|
}
|
|
223
375
|
ngOnDestroy() {
|
|
224
|
-
this.columnElement &&
|
|
376
|
+
this.columnElement && se.delete(this.columnElement);
|
|
225
377
|
}
|
|
226
378
|
/**
|
|
227
379
|
* Static type guard for template context.
|
|
@@ -231,14 +383,14 @@ class k {
|
|
|
231
383
|
return !0;
|
|
232
384
|
}
|
|
233
385
|
}
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
var
|
|
237
|
-
|
|
238
|
-
class
|
|
386
|
+
ee = h(null), W = v(ee, 0, "TbwEditor", Oe, W), g(ee, 1, W);
|
|
387
|
+
const _e = new ze("GRID_TYPE_DEFAULTS");
|
|
388
|
+
var Ie, te;
|
|
389
|
+
Ie = [Be({ providedIn: "root" })];
|
|
390
|
+
class M {
|
|
239
391
|
defaults = /* @__PURE__ */ new Map();
|
|
240
392
|
constructor() {
|
|
241
|
-
const e =
|
|
393
|
+
const e = u(_e, { optional: !0 });
|
|
242
394
|
if (e)
|
|
243
395
|
for (const [t, i] of Object.entries(e))
|
|
244
396
|
this.defaults.set(t, i);
|
|
@@ -292,23 +444,23 @@ class L {
|
|
|
292
444
|
};
|
|
293
445
|
}
|
|
294
446
|
}
|
|
295
|
-
|
|
296
|
-
function
|
|
297
|
-
return
|
|
447
|
+
te = h(null), M = v(te, 0, "GridTypeRegistry", Ie, M), g(te, 1, M);
|
|
448
|
+
function ft(n) {
|
|
449
|
+
return Je([{ provide: _e, useValue: n }]);
|
|
298
450
|
}
|
|
299
|
-
function
|
|
300
|
-
const e =
|
|
301
|
-
return e ||
|
|
451
|
+
function Re(n) {
|
|
452
|
+
const e = ot(n);
|
|
453
|
+
return e || je(n);
|
|
302
454
|
}
|
|
303
|
-
function
|
|
304
|
-
const e =
|
|
305
|
-
return e ||
|
|
455
|
+
function Ee(n) {
|
|
456
|
+
const e = st(n);
|
|
457
|
+
return e || Pe(n);
|
|
306
458
|
}
|
|
307
|
-
class
|
|
459
|
+
class lt {
|
|
308
460
|
constructor(e, t, i) {
|
|
309
461
|
this.injector = e, this.appRef = t, this.viewContainerRef = i, window.__ANGULAR_GRID_ADAPTER__ = this;
|
|
310
462
|
try {
|
|
311
|
-
this.typeRegistry = this.injector.get(
|
|
463
|
+
this.typeRegistry = this.injector.get(M, null);
|
|
312
464
|
} catch {
|
|
313
465
|
}
|
|
314
466
|
}
|
|
@@ -359,14 +511,14 @@ class He {
|
|
|
359
511
|
*/
|
|
360
512
|
processColumn(e) {
|
|
361
513
|
const t = { ...e };
|
|
362
|
-
return e.renderer &&
|
|
514
|
+
return e.renderer && ve(e.renderer) && (t.renderer = this.createComponentRenderer(e.renderer)), e.editor && ve(e.editor) && (t.editor = this.createComponentEditor(e.editor)), t;
|
|
363
515
|
}
|
|
364
516
|
/**
|
|
365
517
|
* Determines if this adapter can handle the given element.
|
|
366
518
|
* Checks if a template is registered for this element (structural or nested).
|
|
367
519
|
*/
|
|
368
520
|
canHandle(e) {
|
|
369
|
-
return
|
|
521
|
+
return Re(e) !== void 0 || Ee(e) !== void 0;
|
|
370
522
|
}
|
|
371
523
|
/**
|
|
372
524
|
* Creates a view renderer function that creates an embedded view
|
|
@@ -376,7 +528,7 @@ class He {
|
|
|
376
528
|
* allowing the grid to use its default rendering.
|
|
377
529
|
*/
|
|
378
530
|
createRenderer(e) {
|
|
379
|
-
const t =
|
|
531
|
+
const t = Re(e);
|
|
380
532
|
if (t)
|
|
381
533
|
return (i) => {
|
|
382
534
|
const r = {
|
|
@@ -384,8 +536,8 @@ class He {
|
|
|
384
536
|
value: i.value,
|
|
385
537
|
row: i.row,
|
|
386
538
|
column: i.column
|
|
387
|
-
},
|
|
388
|
-
return this.viewRefs.push(
|
|
539
|
+
}, o = this.viewContainerRef.createEmbeddedView(t, r);
|
|
540
|
+
return this.viewRefs.push(o), o.detectChanges(), o.rootNodes[0];
|
|
389
541
|
};
|
|
390
542
|
}
|
|
391
543
|
/**
|
|
@@ -407,30 +559,43 @@ class He {
|
|
|
407
559
|
* As long as the component emits `(commit)` with the new value.
|
|
408
560
|
*/
|
|
409
561
|
createEditor(e) {
|
|
410
|
-
const t =
|
|
411
|
-
return t ? (
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
562
|
+
const t = Ee(e), i = e.closest("tbw-grid");
|
|
563
|
+
return t ? (r) => {
|
|
564
|
+
const o = (a) => r.commit(a), s = () => r.cancel(), l = new fe(), m = new fe();
|
|
565
|
+
l.subscribe((a) => r.commit(a)), m.subscribe(() => r.cancel());
|
|
566
|
+
let d;
|
|
567
|
+
if (i) {
|
|
568
|
+
const a = rt(i);
|
|
569
|
+
if (a?.hasFormGroups) {
|
|
570
|
+
const b = i.rows;
|
|
571
|
+
if (b) {
|
|
572
|
+
const D = b.indexOf(r.row);
|
|
573
|
+
D >= 0 && (d = a.getControl(D, r.field));
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
const T = {
|
|
578
|
+
$implicit: r.value,
|
|
579
|
+
value: r.value,
|
|
580
|
+
row: r.row,
|
|
581
|
+
column: r.column,
|
|
419
582
|
// Preferred: simple callback functions
|
|
420
|
-
onCommit:
|
|
583
|
+
onCommit: o,
|
|
421
584
|
onCancel: s,
|
|
585
|
+
// FormControl from FormArray (if available)
|
|
586
|
+
control: d,
|
|
422
587
|
// Deprecated: EventEmitters (for backwards compatibility)
|
|
423
|
-
commit:
|
|
424
|
-
cancel:
|
|
425
|
-
},
|
|
426
|
-
this.viewRefs.push(
|
|
427
|
-
const
|
|
428
|
-
return
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
}),
|
|
432
|
-
|
|
433
|
-
})),
|
|
588
|
+
commit: l,
|
|
589
|
+
cancel: m
|
|
590
|
+
}, c = this.viewContainerRef.createEmbeddedView(t, T);
|
|
591
|
+
this.viewRefs.push(c), c.detectChanges();
|
|
592
|
+
const C = c.rootNodes[0];
|
|
593
|
+
return C && C.addEventListener && (C.addEventListener("commit", (a) => {
|
|
594
|
+
const b = a;
|
|
595
|
+
r.commit(b.detail);
|
|
596
|
+
}), C.addEventListener("cancel", () => {
|
|
597
|
+
r.cancel();
|
|
598
|
+
})), C;
|
|
434
599
|
} : (console.warn("[AngularGridAdapter] No editor template registered for element"), () => document.createElement("div"));
|
|
435
600
|
}
|
|
436
601
|
/**
|
|
@@ -438,16 +603,16 @@ class He {
|
|
|
438
603
|
* Renders Angular templates for expandable detail rows.
|
|
439
604
|
*/
|
|
440
605
|
createDetailRenderer(e) {
|
|
441
|
-
const t =
|
|
606
|
+
const t = we(e);
|
|
442
607
|
if (t)
|
|
443
608
|
return (i) => {
|
|
444
609
|
const r = {
|
|
445
610
|
$implicit: i,
|
|
446
611
|
row: i
|
|
447
|
-
},
|
|
448
|
-
this.viewRefs.push(
|
|
449
|
-
const
|
|
450
|
-
return
|
|
612
|
+
}, o = this.viewContainerRef.createEmbeddedView(t, r);
|
|
613
|
+
this.viewRefs.push(o), o.detectChanges();
|
|
614
|
+
const s = document.createElement("div");
|
|
615
|
+
return o.rootNodes.forEach((l) => s.appendChild(l)), s;
|
|
451
616
|
};
|
|
452
617
|
}
|
|
453
618
|
/**
|
|
@@ -458,16 +623,37 @@ class He {
|
|
|
458
623
|
* without manual configuration in the Grid directive.
|
|
459
624
|
*/
|
|
460
625
|
parseDetailElement(e) {
|
|
461
|
-
const t =
|
|
626
|
+
const t = we(e.closest("tbw-grid"));
|
|
462
627
|
if (t)
|
|
463
628
|
return (i) => {
|
|
464
629
|
const r = {
|
|
465
630
|
$implicit: i,
|
|
466
631
|
row: i
|
|
467
|
-
},
|
|
632
|
+
}, o = this.viewContainerRef.createEmbeddedView(t, r);
|
|
633
|
+
this.viewRefs.push(o), o.detectChanges();
|
|
634
|
+
const s = document.createElement("div");
|
|
635
|
+
return o.rootNodes.forEach((l) => s.appendChild(l)), s;
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Creates a responsive card renderer function for ResponsivePlugin.
|
|
640
|
+
* Renders Angular templates for card layout in responsive mode.
|
|
641
|
+
*
|
|
642
|
+
* @param gridElement - The grid element to look up the template for
|
|
643
|
+
* @returns A card renderer function or undefined if no template is found
|
|
644
|
+
*/
|
|
645
|
+
createResponsiveCardRenderer(e) {
|
|
646
|
+
const t = nt(e);
|
|
647
|
+
if (t)
|
|
648
|
+
return (i, r) => {
|
|
649
|
+
const o = {
|
|
650
|
+
$implicit: i,
|
|
651
|
+
row: i,
|
|
652
|
+
index: r
|
|
653
|
+
}, s = this.viewContainerRef.createEmbeddedView(t, o);
|
|
468
654
|
this.viewRefs.push(s), s.detectChanges();
|
|
469
|
-
const
|
|
470
|
-
return s.rootNodes.forEach((
|
|
655
|
+
const l = document.createElement("div");
|
|
656
|
+
return s.rootNodes.forEach((m) => l.appendChild(m)), l;
|
|
471
657
|
};
|
|
472
658
|
}
|
|
473
659
|
/**
|
|
@@ -475,18 +661,18 @@ class He {
|
|
|
475
661
|
* The renderer creates an Angular template-based panel content.
|
|
476
662
|
*/
|
|
477
663
|
createToolPanelRenderer(e) {
|
|
478
|
-
const t =
|
|
664
|
+
const t = it(e);
|
|
479
665
|
if (!t)
|
|
480
666
|
return;
|
|
481
667
|
const i = e.closest("tbw-grid");
|
|
482
668
|
return (r) => {
|
|
483
|
-
const
|
|
669
|
+
const o = {
|
|
484
670
|
$implicit: i ?? r,
|
|
485
671
|
grid: i ?? r
|
|
486
|
-
},
|
|
487
|
-
return this.viewRefs.push(
|
|
488
|
-
const l = this.viewRefs.indexOf(
|
|
489
|
-
l > -1 && this.viewRefs.splice(l, 1),
|
|
672
|
+
}, s = this.viewContainerRef.createEmbeddedView(t, o);
|
|
673
|
+
return this.viewRefs.push(s), s.detectChanges(), s.rootNodes.forEach((l) => r.appendChild(l)), () => {
|
|
674
|
+
const l = this.viewRefs.indexOf(s);
|
|
675
|
+
l > -1 && this.viewRefs.splice(l, 1), s.destroy();
|
|
490
676
|
};
|
|
491
677
|
};
|
|
492
678
|
}
|
|
@@ -536,7 +722,7 @@ class He {
|
|
|
536
722
|
return (t) => {
|
|
537
723
|
const i = document.createElement("span");
|
|
538
724
|
i.style.display = "contents";
|
|
539
|
-
const r =
|
|
725
|
+
const r = pe(e, {
|
|
540
726
|
environmentInjector: this.injector,
|
|
541
727
|
hostElement: i
|
|
542
728
|
});
|
|
@@ -555,7 +741,7 @@ class He {
|
|
|
555
741
|
return (t) => {
|
|
556
742
|
const i = document.createElement("span");
|
|
557
743
|
i.style.display = "contents";
|
|
558
|
-
const r =
|
|
744
|
+
const r = pe(e, {
|
|
559
745
|
environmentInjector: this.injector,
|
|
560
746
|
hostElement: i
|
|
561
747
|
});
|
|
@@ -564,9 +750,9 @@ class He {
|
|
|
564
750
|
row: t.row,
|
|
565
751
|
column: t.column
|
|
566
752
|
}), this.appRef.attachView(r.hostView), this.componentRefs.push(r), r.changeDetectorRef.detectChanges();
|
|
567
|
-
const
|
|
568
|
-
return this.subscribeToOutput(
|
|
569
|
-
const l =
|
|
753
|
+
const o = r.instance;
|
|
754
|
+
return this.subscribeToOutput(o, "commit", (s) => t.commit(s)), this.subscribeToOutput(o, "cancel", () => t.cancel()), i.addEventListener("commit", (s) => {
|
|
755
|
+
const l = s;
|
|
570
756
|
t.commit(l.detail);
|
|
571
757
|
}), i.addEventListener("cancel", () => {
|
|
572
758
|
t.cancel();
|
|
@@ -601,17 +787,151 @@ class He {
|
|
|
601
787
|
this.viewRefs.forEach((e) => e.destroy()), this.viewRefs = [], this.componentRefs.forEach((e) => e.destroy()), this.componentRefs = [];
|
|
602
788
|
}
|
|
603
789
|
}
|
|
604
|
-
var
|
|
605
|
-
|
|
606
|
-
class
|
|
607
|
-
elementRef =
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
790
|
+
var xe, re;
|
|
791
|
+
xe = [E()];
|
|
792
|
+
class H {
|
|
793
|
+
elementRef = u(R);
|
|
794
|
+
// ============================================================================
|
|
795
|
+
// Inputs
|
|
796
|
+
// ============================================================================
|
|
797
|
+
/**
|
|
798
|
+
* The cell value. Used when FormControl is not available.
|
|
799
|
+
* When a FormControl is provided, value is derived from control.value instead.
|
|
800
|
+
*/
|
|
801
|
+
value = f();
|
|
802
|
+
/**
|
|
803
|
+
* The full row data object.
|
|
804
|
+
*/
|
|
805
|
+
row = f();
|
|
806
|
+
/**
|
|
807
|
+
* The column configuration.
|
|
808
|
+
*/
|
|
809
|
+
column = f();
|
|
810
|
+
/**
|
|
811
|
+
* The FormControl for this cell, if the grid is bound to a FormArray.
|
|
812
|
+
* When provided, the editor uses control.value instead of the value input.
|
|
813
|
+
*/
|
|
814
|
+
control = f();
|
|
815
|
+
// ============================================================================
|
|
816
|
+
// Outputs
|
|
817
|
+
// ============================================================================
|
|
818
|
+
/**
|
|
819
|
+
* Emits when the user commits a new value.
|
|
820
|
+
*/
|
|
821
|
+
commit = S();
|
|
822
|
+
/**
|
|
823
|
+
* Emits when the user cancels editing.
|
|
824
|
+
*/
|
|
825
|
+
cancel = S();
|
|
826
|
+
// ============================================================================
|
|
827
|
+
// Computed State
|
|
828
|
+
// ============================================================================
|
|
829
|
+
/**
|
|
830
|
+
* The current value, derived from FormControl if available, otherwise from value input.
|
|
831
|
+
* This is the recommended way to get the current value in your editor template.
|
|
832
|
+
*/
|
|
833
|
+
currentValue = A(() => {
|
|
834
|
+
const e = this.control();
|
|
835
|
+
return e ? e.value : this.value();
|
|
836
|
+
});
|
|
837
|
+
/**
|
|
838
|
+
* Whether the control is invalid (has validation errors).
|
|
839
|
+
* Returns false if no FormControl is available.
|
|
840
|
+
*/
|
|
841
|
+
isInvalid = A(() => this.control()?.invalid ?? !1);
|
|
842
|
+
/**
|
|
843
|
+
* Whether the control is dirty (has been modified).
|
|
844
|
+
* Returns false if no FormControl is available.
|
|
845
|
+
*/
|
|
846
|
+
isDirty = A(() => this.control()?.dirty ?? !1);
|
|
847
|
+
/**
|
|
848
|
+
* Whether the control has been touched.
|
|
849
|
+
* Returns false if no FormControl is available.
|
|
850
|
+
*/
|
|
851
|
+
isTouched = A(() => this.control()?.touched ?? !1);
|
|
852
|
+
/**
|
|
853
|
+
* Whether the control has any validation errors.
|
|
854
|
+
*/
|
|
855
|
+
hasErrors = A(() => {
|
|
856
|
+
const e = this.control();
|
|
857
|
+
return e?.errors != null && Object.keys(e.errors).length > 0;
|
|
858
|
+
});
|
|
859
|
+
/**
|
|
860
|
+
* The first error message from the control's validation errors.
|
|
861
|
+
* Returns an empty string if no errors.
|
|
862
|
+
*/
|
|
863
|
+
firstErrorMessage = A(() => {
|
|
864
|
+
const e = this.control();
|
|
865
|
+
if (!e?.errors) return "";
|
|
866
|
+
const t = Object.keys(e.errors)[0];
|
|
867
|
+
return this.getErrorMessage(t, e.errors[t]);
|
|
868
|
+
});
|
|
869
|
+
/**
|
|
870
|
+
* All error messages from the control's validation errors.
|
|
871
|
+
*/
|
|
872
|
+
allErrorMessages = A(() => {
|
|
873
|
+
const e = this.control();
|
|
874
|
+
return e?.errors ? Object.entries(e.errors).map(([t, i]) => this.getErrorMessage(t, i)) : [];
|
|
875
|
+
});
|
|
876
|
+
// ============================================================================
|
|
877
|
+
// Methods
|
|
878
|
+
// ============================================================================
|
|
879
|
+
/**
|
|
880
|
+
* Commit a new value. Emits the commit output AND dispatches a DOM event.
|
|
881
|
+
* The DOM event enables the grid's auto-wiring to catch the commit.
|
|
882
|
+
* Call this when the user confirms their edit.
|
|
883
|
+
*/
|
|
884
|
+
commitValue(e) {
|
|
885
|
+
this.commit.emit(e), this.elementRef.nativeElement.dispatchEvent(new CustomEvent("commit", { detail: e, bubbles: !0 }));
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Cancel editing. Emits the cancel output AND dispatches a DOM event.
|
|
889
|
+
* Call this when the user cancels (e.g., presses Escape).
|
|
890
|
+
*/
|
|
891
|
+
cancelEdit() {
|
|
892
|
+
this.cancel.emit(), this.elementRef.nativeElement.dispatchEvent(new CustomEvent("cancel", { bubbles: !0 }));
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Get a human-readable error message for a validation error.
|
|
896
|
+
* Override this method to customize error messages for your editor.
|
|
897
|
+
*
|
|
898
|
+
* @param errorKey - The validation error key (e.g., 'required', 'minlength')
|
|
899
|
+
* @param errorValue - The error value (e.g., { requiredLength: 5, actualLength: 3 })
|
|
900
|
+
* @returns A human-readable error message
|
|
901
|
+
*/
|
|
902
|
+
getErrorMessage(e, t) {
|
|
903
|
+
switch (e) {
|
|
904
|
+
case "required":
|
|
905
|
+
return "This field is required";
|
|
906
|
+
case "minlength":
|
|
907
|
+
return `Minimum length is ${t?.requiredLength ?? "unknown"}`;
|
|
908
|
+
case "maxlength":
|
|
909
|
+
return `Maximum length is ${t?.requiredLength ?? "unknown"}`;
|
|
910
|
+
case "min":
|
|
911
|
+
return `Minimum value is ${t?.min ?? "unknown"}`;
|
|
912
|
+
case "max":
|
|
913
|
+
return `Maximum value is ${t?.max ?? "unknown"}`;
|
|
914
|
+
case "email":
|
|
915
|
+
return "Invalid email address";
|
|
916
|
+
case "pattern":
|
|
917
|
+
return "Invalid format";
|
|
918
|
+
default:
|
|
919
|
+
return `Invalid value (${e})`;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
re = h(null), H = v(re, 0, "BaseGridEditor", xe, H), g(re, 1, H);
|
|
924
|
+
var Me, ne;
|
|
925
|
+
Me = [E({ selector: "tbw-grid" })];
|
|
926
|
+
class Y {
|
|
927
|
+
elementRef = u(R);
|
|
928
|
+
injector = u(Ke);
|
|
929
|
+
appRef = u(Qe);
|
|
930
|
+
viewContainerRef = u(Ze);
|
|
611
931
|
adapter = null;
|
|
612
932
|
cellCommitListener = null;
|
|
613
933
|
constructor() {
|
|
614
|
-
|
|
934
|
+
y(() => {
|
|
615
935
|
const e = this.angularConfig();
|
|
616
936
|
if (!e || !this.adapter) return;
|
|
617
937
|
const t = this.adapter.processGridConfig(e), i = this.elementRef.nativeElement;
|
|
@@ -636,7 +956,7 @@ class x {
|
|
|
636
956
|
* <tbw-grid [customStyles]="customStyles">...</tbw-grid>
|
|
637
957
|
* ```
|
|
638
958
|
*/
|
|
639
|
-
customStyles =
|
|
959
|
+
customStyles = f();
|
|
640
960
|
/**
|
|
641
961
|
* Angular-specific grid configuration that supports component classes for renderers/editors.
|
|
642
962
|
*
|
|
@@ -673,7 +993,7 @@ class x {
|
|
|
673
993
|
* ```
|
|
674
994
|
*/
|
|
675
995
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
676
|
-
angularConfig =
|
|
996
|
+
angularConfig = f();
|
|
677
997
|
/**
|
|
678
998
|
* Emitted when a cell value is committed (inline editing).
|
|
679
999
|
* Provides the row, field, new value, and change tracking information.
|
|
@@ -689,7 +1009,7 @@ class x {
|
|
|
689
1009
|
* }
|
|
690
1010
|
* ```
|
|
691
1011
|
*/
|
|
692
|
-
cellCommit =
|
|
1012
|
+
cellCommit = S();
|
|
693
1013
|
/**
|
|
694
1014
|
* Emitted when a row's values are committed (bulk/row editing).
|
|
695
1015
|
* Provides the row data and change tracking information.
|
|
@@ -699,9 +1019,9 @@ class x {
|
|
|
699
1019
|
* <tbw-grid (rowCommit)="onRowCommit($event)">...</tbw-grid>
|
|
700
1020
|
* ```
|
|
701
1021
|
*/
|
|
702
|
-
rowCommit =
|
|
1022
|
+
rowCommit = S();
|
|
703
1023
|
ngOnInit() {
|
|
704
|
-
this.adapter = new
|
|
1024
|
+
this.adapter = new lt(this.injector, this.appRef, this.viewContainerRef), et.registerAdapter(this.adapter);
|
|
705
1025
|
const e = this.elementRef.nativeElement;
|
|
706
1026
|
this.cellCommitListener = (t) => {
|
|
707
1027
|
const i = t.detail;
|
|
@@ -714,7 +1034,7 @@ class x {
|
|
|
714
1034
|
ngAfterContentInit() {
|
|
715
1035
|
const e = this.elementRef.nativeElement;
|
|
716
1036
|
e && typeof e.refreshColumns == "function" && setTimeout(() => {
|
|
717
|
-
e.refreshColumns(), this.configureMasterDetail(e), typeof e.refreshShellHeader == "function" && e.refreshShellHeader(), this.registerCustomStyles(e);
|
|
1037
|
+
e.refreshColumns(), this.configureMasterDetail(e), this.configureResponsiveCard(e), typeof e.refreshShellHeader == "function" && e.refreshShellHeader(), this.registerCustomStyles(e);
|
|
718
1038
|
}, 0);
|
|
719
1039
|
}
|
|
720
1040
|
/**
|
|
@@ -734,7 +1054,7 @@ class x {
|
|
|
734
1054
|
*/
|
|
735
1055
|
configureMasterDetail(e) {
|
|
736
1056
|
if (!this.adapter) return;
|
|
737
|
-
const t = e.getPlugin?.(
|
|
1057
|
+
const t = e.getPlugin?.(ge);
|
|
738
1058
|
if (t && typeof t.refreshDetailRenderer == "function") {
|
|
739
1059
|
t.refreshDetailRenderer();
|
|
740
1060
|
return;
|
|
@@ -743,38 +1063,66 @@ class x {
|
|
|
743
1063
|
if (!i) return;
|
|
744
1064
|
const r = this.adapter.createDetailRenderer(e);
|
|
745
1065
|
if (!r) return;
|
|
746
|
-
const
|
|
747
|
-
let
|
|
748
|
-
|
|
749
|
-
const l = i.getAttribute("showExpandColumn") !== "false",
|
|
1066
|
+
const o = i.getAttribute("animation");
|
|
1067
|
+
let s = "slide";
|
|
1068
|
+
o === "false" ? s = !1 : o === "fade" && (s = "fade");
|
|
1069
|
+
const l = i.getAttribute("showExpandColumn") !== "false", m = new ge({
|
|
750
1070
|
detailRenderer: r,
|
|
751
1071
|
showExpandColumn: l,
|
|
752
|
-
animation:
|
|
753
|
-
}),
|
|
1072
|
+
animation: s
|
|
1073
|
+
}), d = e.gridConfig || {}, T = d.plugins || [];
|
|
754
1074
|
e.gridConfig = {
|
|
755
|
-
...
|
|
756
|
-
plugins: [...
|
|
1075
|
+
...d,
|
|
1076
|
+
plugins: [...T, m]
|
|
757
1077
|
};
|
|
758
1078
|
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Configures the ResponsivePlugin with Angular template-based card renderer.
|
|
1081
|
+
* - If plugin exists: updates its cardRenderer configuration
|
|
1082
|
+
* - If plugin doesn't exist but <tbw-grid-responsive-card> is present: logs a warning
|
|
1083
|
+
*/
|
|
1084
|
+
configureResponsiveCard(e) {
|
|
1085
|
+
if (!this.adapter || !e.querySelector("tbw-grid-responsive-card")) return;
|
|
1086
|
+
const i = this.adapter.createResponsiveCardRenderer(e);
|
|
1087
|
+
if (!i) return;
|
|
1088
|
+
const r = e.getPlugin?.(tt);
|
|
1089
|
+
if (r) {
|
|
1090
|
+
r.setCardRenderer(i);
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
console.warn(
|
|
1094
|
+
`[tbw-grid-angular] <tbw-grid-responsive-card> found but ResponsivePlugin is not configured.
|
|
1095
|
+
Add ResponsivePlugin to your gridConfig.plugins array:
|
|
1096
|
+
|
|
1097
|
+
import { ResponsivePlugin } from "@toolbox-web/grid/all";
|
|
1098
|
+
gridConfig = {
|
|
1099
|
+
plugins: [new ResponsivePlugin({ breakpoint: 600 })]
|
|
1100
|
+
};`
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
759
1103
|
ngOnDestroy() {
|
|
760
1104
|
const e = this.elementRef.nativeElement;
|
|
761
1105
|
e && (this.cellCommitListener && (e.removeEventListener("cell-commit", this.cellCommitListener), this.cellCommitListener = null), this.rowCommitListener && (e.removeEventListener("row-commit", this.rowCommitListener), this.rowCommitListener = null)), e && this.customStyles() && e.unregisterStyles?.("angular-custom-styles"), this.adapter && (this.adapter.destroy?.(), this.adapter = null);
|
|
762
1106
|
}
|
|
763
1107
|
}
|
|
764
|
-
|
|
1108
|
+
ne = h(null), Y = v(ne, 0, "Grid", Me, Y), g(ne, 1, Y);
|
|
765
1109
|
export {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
V as
|
|
1110
|
+
lt as AngularGridAdapter,
|
|
1111
|
+
H as BaseGridEditor,
|
|
1112
|
+
_e as GRID_TYPE_DEFAULTS,
|
|
1113
|
+
Y as Grid,
|
|
1114
|
+
V as GridColumnEditor,
|
|
1115
|
+
N as GridColumnView,
|
|
771
1116
|
_ as GridDetailView,
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
1117
|
+
G as GridFormArray,
|
|
1118
|
+
q as GridResponsiveCard,
|
|
1119
|
+
$ as GridToolPanel,
|
|
1120
|
+
M as GridTypeRegistry,
|
|
1121
|
+
W as TbwCellEditor,
|
|
1122
|
+
U as TbwCellView,
|
|
1123
|
+
W as TbwEditor,
|
|
1124
|
+
U as TbwRenderer,
|
|
1125
|
+
rt as getFormArrayContext,
|
|
1126
|
+
ve as isComponentClass,
|
|
1127
|
+
ft as provideGridTypeDefaults
|
|
780
1128
|
};
|