@toolbox-web/grid-angular 0.0.1 → 0.1.1

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/index.js CHANGED
@@ -1,46 +1,46 @@
1
- var me = Object.create;
1
+ var ye = Object.create;
2
2
  var M = Object.defineProperty;
3
- var ue = Object.getOwnPropertyDescriptor;
4
- var K = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), C = (i) => {
3
+ var Te = Object.getOwnPropertyDescriptor;
4
+ var ee = (i, e) => (e = Symbol[i]) ? e : /* @__PURE__ */ Symbol.for("Symbol." + i), L = (i) => {
5
5
  throw TypeError(i);
6
6
  };
7
- var fe = (i, e, t) => e in i ? M(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
8
- var F = (i, e) => M(i, "name", { value: e, configurable: !0 });
9
- var h = (i) => [, , , me(i?.[K("metadata")] ?? null)], Q = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], E = (i) => i !== void 0 && typeof i != "function" ? C("Function expected") : i, pe = (i, e, t, n, r) => ({ kind: Q[i], name: e, metadata: n, addInitializer: (s) => t._ ? C("Already initialized") : r.push(E(s || null)) }), he = (i, e) => fe(e, K("metadata"), i[3]), g = (i, e, t, n) => {
10
- for (var r = 0, s = i[e >> 1], o = s && s.length; r < o; r++) e & 1 ? s[r].call(t) : n = s[r].call(t, n);
7
+ var be = (i, e, t) => e in i ? M(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
8
+ var X = (i, e) => M(i, "name", { value: e, configurable: !0 });
9
+ var h = (i) => [, , , ye(i?.[ee("metadata")] ?? null)], te = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], A = (i) => i !== void 0 && typeof i != "function" ? L("Function expected") : i, Ae = (i, e, t, n, r) => ({ kind: te[i], name: e, metadata: n, addInitializer: (s) => t._ ? L("Already initialized") : r.push(A(s || null)) }), Le = (i, e) => be(e, ee("metadata"), i[3]), g = (i, e, t, n) => {
10
+ for (var r = 0, s = i[e >> 1], l = s && s.length; r < l; r++) e & 1 ? s[r].call(t) : n = s[r].call(t, n);
11
11
  return n;
12
- }, R = (i, e, t, n, r, s) => {
13
- var o, a, w, m, v, l = e & 7, D = !!(e & 8), u = !!(e & 16), N = l > 3 ? i.length + 1 : l ? D ? 1 : 2 : 0, z = Q[l + 5], B = l > 3 && (i[N - 1] = []), de = i[N] || (i[N] = []), d = l && (!u && !D && (r = r.prototype), l < 5 && (l > 3 || !u) && ue(l < 4 ? r : { get [t]() {
14
- return G(this, s);
12
+ }, w = (i, e, t, n, r, s) => {
13
+ var l, a, C, m, d, o = e & 7, b = !!(e & 8), p = !!(e & 16), S = o > 3 ? i.length + 1 : o ? b ? 1 : 2 : 0, K = te[o + 5], Q = o > 3 && (i[S - 1] = []), Ce = i[S] || (i[S] = []), f = o && (!p && !b && (r = r.prototype), o < 5 && (o > 3 || !p) && Te(o < 4 ? r : { get [t]() {
14
+ return Y(this, s);
15
15
  }, set [t](c) {
16
- return J(this, s, c);
16
+ return Z(this, s, c);
17
17
  } }, t));
18
- l ? u && l < 4 && F(s, (l > 2 ? "set " : l > 1 ? "get " : "") + t) : F(r, t);
19
- for (var S = n.length - 1; S >= 0; S--)
20
- m = pe(l, t, w = {}, i[3], de), l && (m.static = D, m.private = u, v = m.access = { has: u ? (c) => ge(r, c) : (c) => t in c }, l ^ 3 && (v.get = u ? (c) => (l ^ 1 ? G : Re)(c, r, l ^ 4 ? s : d.get) : (c) => c[t]), l > 2 && (v.set = u ? (c, _) => J(c, r, _, l ^ 4 ? s : d.set) : (c, _) => c[t] = _)), a = (0, n[S])(l ? l < 4 ? u ? s : d[z] : l > 4 ? void 0 : { get: d.get, set: d.set } : r, m), w._ = 1, l ^ 4 || a === void 0 ? E(a) && (l > 4 ? B.unshift(a) : l ? u ? s = a : d[z] = a : r = a) : typeof a != "object" || a === null ? C("Object expected") : (E(o = a.get) && (d.get = o), E(o = a.set) && (d.set = o), E(o = a.init) && B.unshift(o));
21
- return l || he(i, r), d && M(r, t, d), u ? l ^ 4 ? s : d : r;
18
+ o ? p && o < 4 && X(s, (o > 2 ? "set " : o > 1 ? "get " : "") + t) : X(r, t);
19
+ for (var N = n.length - 1; N >= 0; N--)
20
+ m = Ae(o, t, C = {}, i[3], Ce), o && (m.static = b, m.private = p, d = m.access = { has: p ? (c) => De(r, c) : (c) => t in c }, o ^ 3 && (d.get = p ? (c) => (o ^ 1 ? Y : Se)(c, r, o ^ 4 ? s : f.get) : (c) => c[t]), o > 2 && (d.set = p ? (c, x) => Z(c, r, x, o ^ 4 ? s : f.set) : (c, x) => c[t] = x)), a = (0, n[N])(o ? o < 4 ? p ? s : f[K] : o > 4 ? void 0 : { get: f.get, set: f.set } : r, m), C._ = 1, o ^ 4 || a === void 0 ? A(a) && (o > 4 ? Q.unshift(a) : o ? p ? s = a : f[K] = a : r = a) : typeof a != "object" || a === null ? L("Object expected") : (A(l = a.get) && (f.get = l), A(l = a.set) && (f.set = l), A(l = a.init) && Q.unshift(l));
21
+ return o || Le(i, r), f && M(r, t, f), p ? o ^ 4 ? s : f : r;
22
22
  };
23
- var P = (i, e, t) => e.has(i) || C("Cannot " + t), ge = (i, e) => Object(e) !== e ? C('Cannot use the "in" operator on this value') : i.has(e), G = (i, e, t) => (P(i, e, "read from private field"), t ? t.call(i) : e.get(i));
24
- var J = (i, e, t, n) => (P(i, e, "write to private field"), n ? n.call(i, t) : e.set(i, t), t), Re = (i, e, t) => (P(i, e, "access private method"), t);
25
- import { inject as p, ElementRef as b, contentChild as A, TemplateRef as T, effect as x, Directive as y, input as f, EventEmitter as W, EnvironmentInjector as we, ApplicationRef as ve, ViewContainerRef as Ee } from "@angular/core";
26
- import { DataGridElement as Ce } from "@toolbox-web/grid";
27
- import { MasterDetailPlugin as X } from "@toolbox-web/grid/all";
28
- const oe = /* @__PURE__ */ new Map();
29
- function Y(i) {
30
- return oe.get(i);
23
+ var _ = (i, e, t) => e.has(i) || L("Cannot " + t), De = (i, e) => Object(e) !== e ? L('Cannot use the "in" operator on this value') : i.has(e), Y = (i, e, t) => (_(i, e, "read from private field"), t ? t.call(i) : e.get(i));
24
+ var Z = (i, e, t, n) => (_(i, e, "write to private field"), n ? n.call(i, t) : e.set(i, t), t), Se = (i, e, t) => (_(i, e, "access private method"), t);
25
+ import { inject as u, ElementRef as R, contentChild as D, TemplateRef as y, effect as T, Directive as E, input as v, EventEmitter as ie, EnvironmentInjector as Ne, ApplicationRef as xe, ViewContainerRef as Me, output as ne } from "@angular/core";
26
+ import { DataGridElement as _e } from "@toolbox-web/grid";
27
+ import { MasterDetailPlugin as re } from "@toolbox-web/grid/all";
28
+ const he = /* @__PURE__ */ new Map();
29
+ function ge(i) {
30
+ return he.get(i);
31
31
  }
32
- var te, O;
33
- te = [y({ selector: "tbw-grid-column-editor" })];
34
- class j {
35
- elementRef = p(b);
32
+ var ae, G;
33
+ ae = [E({ selector: "tbw-grid-column-editor" })];
34
+ class O {
35
+ elementRef = u(R);
36
36
  /**
37
37
  * Query for the ng-template content child.
38
38
  */
39
- template = A(T);
39
+ template = D(y);
40
40
  /** Effect that triggers when the template is available */
41
- onTemplateReceived = x(() => {
41
+ onTemplateReceived = T(() => {
42
42
  const e = this.template();
43
- e && oe.set(this.elementRef.nativeElement, e);
43
+ e && he.set(this.elementRef.nativeElement, e);
44
44
  });
45
45
  /**
46
46
  * Static type guard for template context.
@@ -50,23 +50,23 @@ class j {
50
50
  return !0;
51
51
  }
52
52
  }
53
- O = h(null), j = R(O, 0, "GridColumnEditor", te, j), g(O, 1, j);
54
- const ae = /* @__PURE__ */ new Map();
55
- function Z(i) {
56
- return ae.get(i);
53
+ G = h(null), O = w(G, 0, "GridColumnEditor", ae, O), g(G, 1, O);
54
+ const we = /* @__PURE__ */ new Map();
55
+ function ve(i) {
56
+ return we.get(i);
57
57
  }
58
- var ie, V;
59
- ie = [y({ selector: "tbw-grid-column-view" })];
60
- class $ {
61
- elementRef = p(b);
58
+ var ce, H;
59
+ ce = [E({ selector: "tbw-grid-column-view" })];
60
+ class V {
61
+ elementRef = u(R);
62
62
  /**
63
63
  * Query for the ng-template content child.
64
64
  */
65
- template = A(T);
65
+ template = D(y);
66
66
  /** Effect that triggers when the template is available */
67
- onTemplateReceived = x(() => {
67
+ onTemplateReceived = T(() => {
68
68
  const e = this.template();
69
- e && ae.set(this.elementRef.nativeElement, e);
69
+ e && we.set(this.elementRef.nativeElement, e);
70
70
  });
71
71
  /**
72
72
  * Static type guard for template context.
@@ -76,29 +76,29 @@ class $ {
76
76
  return !0;
77
77
  }
78
78
  }
79
- V = h(null), $ = R(V, 0, "GridColumnView", ie, $), g(V, 1, $);
80
- const le = /* @__PURE__ */ new Map();
81
- function ee(i) {
79
+ H = h(null), V = w(H, 0, "GridColumnView", ce, V), g(H, 1, V);
80
+ const Re = /* @__PURE__ */ new Map();
81
+ function se(i) {
82
82
  const e = i.querySelector("tbw-grid-detail");
83
83
  if (e)
84
- return le.get(e);
84
+ return Re.get(e);
85
85
  }
86
- var ne, k;
87
- ne = [y({ selector: "tbw-grid-detail" })];
86
+ var me, U;
87
+ me = [E({ selector: "tbw-grid-detail" })];
88
88
  class q {
89
- elementRef = p(b);
89
+ elementRef = u(R);
90
90
  /** Whether to show the expand/collapse column. Default: true */
91
- showExpandColumn = f(!0);
91
+ showExpandColumn = v(!0);
92
92
  /** Animation style for expand/collapse. Default: 'slide' */
93
- animation = f("slide");
93
+ animation = v("slide");
94
94
  /**
95
95
  * Query for the ng-template content child.
96
96
  */
97
- template = A(T);
97
+ template = D(y);
98
98
  /** Effect that triggers when the template is available */
99
- onTemplateReceived = x(() => {
99
+ onTemplateReceived = T(() => {
100
100
  const e = this.template();
101
- e && le.set(this.elementRef.nativeElement, e);
101
+ e && Re.set(this.elementRef.nativeElement, e);
102
102
  });
103
103
  /**
104
104
  * Static type guard for template context.
@@ -108,38 +108,38 @@ class q {
108
108
  return !0;
109
109
  }
110
110
  }
111
- k = h(null), q = R(k, 0, "GridDetailView", ne, q), g(k, 1, q);
112
- const ce = /* @__PURE__ */ new Map();
113
- function be(i) {
114
- return ce.get(i);
111
+ U = h(null), q = w(U, 0, "GridDetailView", me, q), g(U, 1, q);
112
+ const Ee = /* @__PURE__ */ new Map();
113
+ function Oe(i) {
114
+ return Ee.get(i);
115
115
  }
116
- var re, L;
117
- re = [y({ selector: "tbw-grid-tool-panel" })];
116
+ var ue, B;
117
+ ue = [E({ selector: "tbw-grid-tool-panel" })];
118
118
  class I {
119
- elementRef = p(b);
119
+ elementRef = u(R);
120
120
  /** Unique panel identifier (required) */
121
- id = f.required({ alias: "id" });
121
+ id = v.required({ alias: "id" });
122
122
  /** Panel title shown in accordion header (required) */
123
- title = f.required({ alias: "title" });
123
+ title = v.required({ alias: "title" });
124
124
  /** Icon for accordion section header (emoji or text) */
125
- icon = f();
125
+ icon = v();
126
126
  /** Tooltip for accordion section header */
127
- tooltip = f();
127
+ tooltip = v();
128
128
  /** Panel order priority (lower = first, default: 100) */
129
- order = f(100);
129
+ order = v(100);
130
130
  /**
131
131
  * Query for the ng-template content child.
132
132
  */
133
- template = A(T);
133
+ template = D(y);
134
134
  /** Effect that triggers when the template is available */
135
- onTemplateReceived = x(() => {
135
+ onTemplateReceived = T(() => {
136
136
  const e = this.template(), t = this.elementRef.nativeElement;
137
137
  if (e) {
138
138
  t.setAttribute("id", this.id()), t.setAttribute("title", this.title());
139
139
  const n = this.icon();
140
140
  n && t.setAttribute("icon", n);
141
141
  const r = this.tooltip();
142
- r && t.setAttribute("tooltip", r), t.setAttribute("order", String(this.order())), ce.set(t, e);
142
+ r && t.setAttribute("tooltip", r), t.setAttribute("order", String(this.order())), Ee.set(t, e);
143
143
  }
144
144
  });
145
145
  /**
@@ -150,53 +150,163 @@ class I {
150
150
  return !0;
151
151
  }
152
152
  }
153
- L = h(null), I = R(L, 0, "GridToolPanel", re, I), g(L, 1, I);
154
- class ye {
153
+ B = h(null), I = w(B, 0, "GridToolPanel", ue, I), g(B, 1, I);
154
+ const F = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map();
155
+ function Ve(i) {
156
+ const e = F.get(i);
157
+ if (e) return e;
158
+ const t = i.querySelector("tbw-grid-column-view");
159
+ if (t)
160
+ return ve(t);
161
+ }
162
+ function qe(i) {
163
+ const e = J.get(i);
164
+ if (e) return e;
165
+ const t = i.querySelector("tbw-grid-column-editor");
166
+ if (t)
167
+ return ge(t);
168
+ }
169
+ var de, W;
170
+ de = [E({ selector: "[tbwRenderer]" })];
171
+ class P {
172
+ template = u(y);
173
+ elementRef = u(R);
174
+ columnElement = null;
175
+ constructor() {
176
+ T(() => {
177
+ this.registerTemplate();
178
+ });
179
+ }
180
+ registerTemplate() {
181
+ let e = this.elementRef.nativeElement?.parentElement;
182
+ for (; e && e.tagName !== "TBW-GRID-COLUMN"; )
183
+ e = e.parentElement;
184
+ e && (this.columnElement = e, F.set(e, this.template));
185
+ }
186
+ ngOnDestroy() {
187
+ this.columnElement && F.delete(this.columnElement);
188
+ }
189
+ /**
190
+ * Static type guard for template context.
191
+ * Uses `any` defaults for ergonomic template usage.
192
+ */
193
+ static ngTemplateContextGuard(e, t) {
194
+ return !0;
195
+ }
196
+ }
197
+ W = h(null), P = w(W, 0, "TbwRenderer", de, P), g(W, 1, P);
198
+ var fe, k;
199
+ fe = [E({ selector: "[tbwEditor]" })];
200
+ class j {
201
+ template = u(y);
202
+ elementRef = u(R);
203
+ columnElement = null;
204
+ constructor() {
205
+ T(() => {
206
+ this.registerTemplate();
207
+ });
208
+ }
209
+ registerTemplate() {
210
+ let e = this.elementRef.nativeElement?.parentElement;
211
+ for (; e && e.tagName !== "TBW-GRID-COLUMN"; )
212
+ e = e.parentElement;
213
+ e && (this.columnElement = e, J.set(e, this.template));
214
+ }
215
+ ngOnDestroy() {
216
+ this.columnElement && J.delete(this.columnElement);
217
+ }
218
+ /**
219
+ * Static type guard for template context.
220
+ * Uses `any` defaults for ergonomic template usage.
221
+ */
222
+ static ngTemplateContextGuard(e, t) {
223
+ return !0;
224
+ }
225
+ }
226
+ k = h(null), j = w(k, 0, "TbwEditor", fe, j), g(k, 1, j);
227
+ function oe(i) {
228
+ const e = Ve(i);
229
+ return e || ve(i);
230
+ }
231
+ function le(i) {
232
+ const e = qe(i);
233
+ return e || ge(i);
234
+ }
235
+ class Ie {
155
236
  constructor(e, t, n) {
156
237
  this.injector = e, this.appRef = t, this.viewContainerRef = n, window.__ANGULAR_GRID_ADAPTER__ = this;
157
238
  }
158
239
  viewRefs = [];
159
240
  /**
160
241
  * Determines if this adapter can handle the given element.
161
- * Checks if a template is registered for this element.
242
+ * Checks if a template is registered for this element (structural or nested).
162
243
  */
163
244
  canHandle(e) {
164
- return Z(e) !== void 0 || Y(e) !== void 0;
245
+ return oe(e) !== void 0 || le(e) !== void 0;
165
246
  }
166
247
  /**
167
248
  * Creates a view renderer function that creates an embedded view
168
249
  * from the registered template and returns its DOM element.
250
+ *
251
+ * Returns undefined if no template is registered for this element,
252
+ * allowing the grid to use its default rendering.
169
253
  */
170
254
  createRenderer(e) {
171
- const t = Z(e);
172
- return t ? (n) => {
173
- const r = {
174
- $implicit: n.value,
175
- value: n.value,
176
- row: n.row,
177
- column: n.column
178
- }, s = this.viewContainerRef.createEmbeddedView(t, r);
179
- return this.viewRefs.push(s), s.detectChanges(), s.rootNodes[0];
180
- } : (console.warn("[AngularGridAdapter] No template registered for element"), () => "");
255
+ const t = oe(e);
256
+ if (t)
257
+ return (n) => {
258
+ const r = {
259
+ $implicit: n.value,
260
+ value: n.value,
261
+ row: n.row,
262
+ column: n.column
263
+ }, s = this.viewContainerRef.createEmbeddedView(t, r);
264
+ return this.viewRefs.push(s), s.detectChanges(), s.rootNodes[0];
265
+ };
181
266
  }
182
267
  /**
183
- * Creates an editor spec that creates an embedded view
184
- * with commit/cancel EventEmitters in the context.
268
+ * Creates an editor spec that creates an embedded view.
269
+ *
270
+ * **Auto-wiring**: The adapter automatically listens for `commit` and `cancel`
271
+ * CustomEvents on the rendered component. If the component emits these events,
272
+ * the adapter will call the grid's commit/cancel functions automatically.
273
+ *
274
+ * This means templates can be simplified from:
275
+ * ```html
276
+ * <app-editor *tbwEditor="let value; onCommit as onCommit"
277
+ * [value]="value" (commit)="onCommit($event)" />
278
+ * ```
279
+ * To just:
280
+ * ```html
281
+ * <app-editor *tbwEditor="let value" [value]="value" />
282
+ * ```
283
+ * As long as the component emits `(commit)` with the new value.
185
284
  */
186
285
  createEditor(e) {
187
- const t = Y(e);
286
+ const t = le(e);
188
287
  return t ? (n) => {
189
- const r = new W(), s = new W();
190
- r.subscribe((m) => n.commit(m)), s.subscribe(() => n.cancel());
191
- const o = {
288
+ const r = (o) => n.commit(o), s = () => n.cancel(), l = new ie(), a = new ie();
289
+ l.subscribe((o) => n.commit(o)), a.subscribe(() => n.cancel());
290
+ const C = {
192
291
  $implicit: n.value,
193
292
  value: n.value,
194
293
  row: n.row,
195
294
  column: n.column,
196
- commit: r,
197
- cancel: s
198
- }, a = this.viewContainerRef.createEmbeddedView(t, o);
199
- return this.viewRefs.push(a), a.detectChanges(), a.rootNodes[0];
295
+ // Preferred: simple callback functions
296
+ onCommit: r,
297
+ onCancel: s,
298
+ // Deprecated: EventEmitters (for backwards compatibility)
299
+ commit: l,
300
+ cancel: a
301
+ }, m = this.viewContainerRef.createEmbeddedView(t, C);
302
+ this.viewRefs.push(m), m.detectChanges();
303
+ const d = m.rootNodes[0];
304
+ return d && d.addEventListener && (d.addEventListener("commit", (o) => {
305
+ const b = o;
306
+ n.commit(b.detail);
307
+ }), d.addEventListener("cancel", () => {
308
+ n.cancel();
309
+ })), d;
200
310
  } : (console.warn("[AngularGridAdapter] No editor template registered for element"), () => document.createElement("div"));
201
311
  }
202
312
  /**
@@ -204,7 +314,7 @@ class ye {
204
314
  * Renders Angular templates for expandable detail rows.
205
315
  */
206
316
  createDetailRenderer(e) {
207
- const t = ee(e);
317
+ const t = se(e);
208
318
  if (t)
209
319
  return (n) => {
210
320
  const r = {
@@ -212,8 +322,8 @@ class ye {
212
322
  row: n
213
323
  }, s = this.viewContainerRef.createEmbeddedView(t, r);
214
324
  this.viewRefs.push(s), s.detectChanges();
215
- const o = document.createElement("div");
216
- return s.rootNodes.forEach((a) => o.appendChild(a)), o;
325
+ const l = document.createElement("div");
326
+ return s.rootNodes.forEach((a) => l.appendChild(a)), l;
217
327
  };
218
328
  }
219
329
  /**
@@ -224,7 +334,7 @@ class ye {
224
334
  * without manual configuration in the Grid directive.
225
335
  */
226
336
  parseDetailElement(e) {
227
- const t = ee(e.closest("tbw-grid"));
337
+ const t = se(e.closest("tbw-grid"));
228
338
  if (t)
229
339
  return (n) => {
230
340
  const r = {
@@ -232,8 +342,8 @@ class ye {
232
342
  row: n
233
343
  }, s = this.viewContainerRef.createEmbeddedView(t, r);
234
344
  this.viewRefs.push(s), s.detectChanges();
235
- const o = document.createElement("div");
236
- return s.rootNodes.forEach((a) => o.appendChild(a)), o;
345
+ const l = document.createElement("div");
346
+ return s.rootNodes.forEach((a) => l.appendChild(a)), l;
237
347
  };
238
348
  }
239
349
  /**
@@ -241,7 +351,7 @@ class ye {
241
351
  * The renderer creates an Angular template-based panel content.
242
352
  */
243
353
  createToolPanelRenderer(e) {
244
- const t = be(e);
354
+ const t = Oe(e);
245
355
  if (!t)
246
356
  return;
247
357
  const n = e.closest("tbw-grid");
@@ -249,10 +359,10 @@ class ye {
249
359
  const s = {
250
360
  $implicit: n ?? r,
251
361
  grid: n ?? r
252
- }, o = this.viewContainerRef.createEmbeddedView(t, s);
253
- return this.viewRefs.push(o), o.detectChanges(), o.rootNodes.forEach((a) => r.appendChild(a)), () => {
254
- const a = this.viewRefs.indexOf(o);
255
- a > -1 && this.viewRefs.splice(a, 1), o.destroy();
362
+ }, l = this.viewContainerRef.createEmbeddedView(t, s);
363
+ return this.viewRefs.push(l), l.detectChanges(), l.rootNodes.forEach((a) => r.appendChild(a)), () => {
364
+ const a = this.viewRefs.indexOf(l);
365
+ a > -1 && this.viewRefs.splice(a, 1), l.destroy();
256
366
  };
257
367
  };
258
368
  }
@@ -264,14 +374,16 @@ class ye {
264
374
  this.viewRefs.forEach((e) => e.destroy()), this.viewRefs = [];
265
375
  }
266
376
  }
267
- var se, U;
268
- se = [y({ selector: "tbw-grid" })];
269
- class H {
270
- elementRef = p(b);
271
- injector = p(we);
272
- appRef = p(ve);
273
- viewContainerRef = p(Ee);
377
+ var pe, z;
378
+ pe = [E({ selector: "tbw-grid" })];
379
+ class $ {
380
+ elementRef = u(R);
381
+ injector = u(Ne);
382
+ appRef = u(xe);
383
+ viewContainerRef = u(Me);
274
384
  adapter = null;
385
+ cellCommitListener = null;
386
+ rowCommitListener = null;
275
387
  /**
276
388
  * Custom CSS styles to inject into the grid's shadow DOM.
277
389
  * Use this to style custom cell renderers, editors, or detail panels.
@@ -289,11 +401,43 @@ class H {
289
401
  * <tbw-grid [customStyles]="customStyles">...</tbw-grid>
290
402
  * ```
291
403
  */
292
- customStyles = f();
404
+ customStyles = v();
405
+ /**
406
+ * Emitted when a cell value is committed (inline editing).
407
+ * Provides the row, field, new value, and change tracking information.
408
+ *
409
+ * @example
410
+ * ```html
411
+ * <tbw-grid (cellCommit)="onCellCommit($event)">...</tbw-grid>
412
+ * ```
413
+ *
414
+ * ```typescript
415
+ * onCellCommit(event: CellCommitEvent) {
416
+ * console.log(`Changed ${event.field} to ${event.value} in row ${event.rowIndex}`);
417
+ * }
418
+ * ```
419
+ */
420
+ cellCommit = ne();
421
+ /**
422
+ * Emitted when a row's values are committed (bulk/row editing).
423
+ * Provides the row data and change tracking information.
424
+ *
425
+ * @example
426
+ * ```html
427
+ * <tbw-grid (rowCommit)="onRowCommit($event)">...</tbw-grid>
428
+ * ```
429
+ */
430
+ rowCommit = ne();
293
431
  ngOnInit() {
294
- this.adapter = new ye(this.injector, this.appRef, this.viewContainerRef), Ce.registerAdapter(this.adapter);
432
+ this.adapter = new Ie(this.injector, this.appRef, this.viewContainerRef), _e.registerAdapter(this.adapter);
295
433
  const e = this.elementRef.nativeElement;
296
- e.__frameworkAdapter = this.adapter;
434
+ this.cellCommitListener = (t) => {
435
+ const n = t.detail;
436
+ this.cellCommit.emit(n);
437
+ }, e.addEventListener("cell-commit", this.cellCommitListener), this.rowCommitListener = (t) => {
438
+ const n = t.detail;
439
+ this.rowCommit.emit(n);
440
+ }, e.addEventListener("row-commit", this.rowCommitListener), e.__frameworkAdapter = this.adapter;
297
441
  }
298
442
  ngAfterContentInit() {
299
443
  const e = this.elementRef.nativeElement;
@@ -318,7 +462,7 @@ class H {
318
462
  */
319
463
  configureMasterDetail(e) {
320
464
  if (!this.adapter) return;
321
- const t = e.getPlugin?.(X);
465
+ const t = e.getPlugin?.(re);
322
466
  if (t && typeof t.refreshDetailRenderer == "function") {
323
467
  t.refreshDetailRenderer();
324
468
  return;
@@ -328,29 +472,33 @@ class H {
328
472
  const r = this.adapter.createDetailRenderer(e);
329
473
  if (!r) return;
330
474
  const s = n.getAttribute("animation");
331
- let o = "slide";
332
- s === "false" ? o = !1 : s === "fade" && (o = "fade");
333
- const a = n.getAttribute("showExpandColumn") !== "false", w = new X({
475
+ let l = "slide";
476
+ s === "false" ? l = !1 : s === "fade" && (l = "fade");
477
+ const a = n.getAttribute("showExpandColumn") !== "false", C = new re({
334
478
  detailRenderer: r,
335
479
  showExpandColumn: a,
336
- animation: o
337
- }), m = e.gridConfig || {}, v = m.plugins || [];
480
+ animation: l
481
+ }), m = e.gridConfig || {}, d = m.plugins || [];
338
482
  e.gridConfig = {
339
483
  ...m,
340
- plugins: [...v, w]
484
+ plugins: [...d, C]
341
485
  };
342
486
  }
343
487
  ngOnDestroy() {
344
488
  const e = this.elementRef.nativeElement;
345
- e && this.customStyles() && e.unregisterStyles?.("angular-custom-styles"), this.adapter && (this.adapter.destroy?.(), this.adapter = null);
489
+ 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);
346
490
  }
347
491
  }
348
- U = h(null), H = R(U, 0, "Grid", se, H), g(U, 1, H);
492
+ z = h(null), $ = w(z, 0, "Grid", pe, $), g(z, 1, $);
349
493
  export {
350
- ye as AngularGridAdapter,
351
- H as Grid,
352
- j as GridColumnEditor,
353
- $ as GridColumnView,
494
+ Ie as AngularGridAdapter,
495
+ $ as Grid,
496
+ O as GridColumnEditor,
497
+ V as GridColumnView,
354
498
  q as GridDetailView,
355
- I as GridToolPanel
499
+ I as GridToolPanel,
500
+ j as TbwCellEditor,
501
+ P as TbwCellView,
502
+ j as TbwEditor,
503
+ P as TbwRenderer
356
504
  };
@@ -26,7 +26,17 @@ import { ColumnEditorSpec, ColumnViewRenderer, FrameworkAdapter } from '../../..
26
26
  * }
27
27
  * ```
28
28
  *
29
- * **Declarative configuration in templates:**
29
+ * **Declarative configuration in templates (structural directive - recommended):**
30
+ * ```html
31
+ * <tbw-grid>
32
+ * <tbw-grid-column field="status">
33
+ * <app-status-badge *tbwRenderer="let value; row as row" [value]="value" />
34
+ * <app-status-editor *tbwEditor="let value" [value]="value" />
35
+ * </tbw-grid-column>
36
+ * </tbw-grid>
37
+ * ```
38
+ *
39
+ * **Declarative configuration in templates (nested directive - legacy):**
30
40
  * ```html
31
41
  * <tbw-grid>
32
42
  * <tbw-grid-column field="status">
@@ -36,8 +46,8 @@ import { ColumnEditorSpec, ColumnViewRenderer, FrameworkAdapter } from '../../..
36
46
  * </ng-template>
37
47
  * </tbw-grid-column-view>
38
48
  * <tbw-grid-column-editor>
39
- * <ng-template let-value let-commit="commit" let-cancel="cancel">
40
- * <app-status-select [value]="value" (commit)="commit.emit($event)" (cancel)="cancel.emit()" />
49
+ * <ng-template let-value let-onCommit="onCommit" let-onCancel="onCancel">
50
+ * <app-status-select [value]="value" (commit)="onCommit($event)" (cancel)="onCancel()" />
41
51
  * </ng-template>
42
52
  * </tbw-grid-column-editor>
43
53
  * </tbw-grid-column>
@@ -45,9 +55,9 @@ import { ColumnEditorSpec, ColumnViewRenderer, FrameworkAdapter } from '../../..
45
55
  * ```
46
56
  *
47
57
  * The adapter automatically:
48
- * - Detects Angular templates registered by directives
58
+ * - Detects Angular templates registered by directives (both structural and nested)
49
59
  * - Creates embedded views with cell context (value, row, column)
50
- * - Handles editor outputs (commit/cancel) via EventEmitters
60
+ * - Handles editor callbacks (onCommit/onCancel)
51
61
  * - Manages view lifecycle and change detection
52
62
  */
53
63
  export declare class AngularGridAdapter implements FrameworkAdapter {
@@ -58,17 +68,34 @@ export declare class AngularGridAdapter implements FrameworkAdapter {
58
68
  constructor(injector: EnvironmentInjector, appRef: ApplicationRef, viewContainerRef: ViewContainerRef);
59
69
  /**
60
70
  * Determines if this adapter can handle the given element.
61
- * Checks if a template is registered for this element.
71
+ * Checks if a template is registered for this element (structural or nested).
62
72
  */
63
73
  canHandle(element: HTMLElement): boolean;
64
74
  /**
65
75
  * Creates a view renderer function that creates an embedded view
66
76
  * from the registered template and returns its DOM element.
77
+ *
78
+ * Returns undefined if no template is registered for this element,
79
+ * allowing the grid to use its default rendering.
67
80
  */
68
81
  createRenderer<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnViewRenderer<TRow, TValue>;
69
82
  /**
70
- * Creates an editor spec that creates an embedded view
71
- * with commit/cancel EventEmitters in the context.
83
+ * Creates an editor spec that creates an embedded view.
84
+ *
85
+ * **Auto-wiring**: The adapter automatically listens for `commit` and `cancel`
86
+ * CustomEvents on the rendered component. If the component emits these events,
87
+ * the adapter will call the grid's commit/cancel functions automatically.
88
+ *
89
+ * This means templates can be simplified from:
90
+ * ```html
91
+ * <app-editor *tbwEditor="let value; onCommit as onCommit"
92
+ * [value]="value" (commit)="onCommit($event)" />
93
+ * ```
94
+ * To just:
95
+ * ```html
96
+ * <app-editor *tbwEditor="let value" [value]="value" />
97
+ * ```
98
+ * As long as the component emits `(commit)` with the new value.
72
99
  */
73
100
  createEditor<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnEditorSpec<TRow, TValue>;
74
101
  /**