@toolbox-web/grid-angular 0.0.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.d.ts +11 -0
- package/index.d.ts.map +1 -0
- package/index.js +356 -0
- package/lib/angular-grid-adapter.d.ts +98 -0
- package/lib/angular-grid-adapter.d.ts.map +1 -0
- package/lib/component-registry.d.ts +63 -0
- package/lib/component-registry.d.ts.map +1 -0
- package/lib/directives/grid-column-editor.directive.d.ts +80 -0
- package/lib/directives/grid-column-editor.directive.d.ts.map +1 -0
- package/lib/directives/grid-column-view.directive.d.ts +69 -0
- package/lib/directives/grid-column-view.directive.d.ts.map +1 -0
- package/lib/directives/grid-detail-view.directive.d.ts +75 -0
- package/lib/directives/grid-detail-view.directive.d.ts.map +1 -0
- package/lib/directives/grid-tool-panel.directive.d.ts +91 -0
- package/lib/directives/grid-tool-panel.directive.d.ts.map +1 -0
- package/lib/directives/grid.directive.d.ts +76 -0
- package/lib/directives/grid.directive.d.ts.map +1 -0
- package/lib/directives/index.d.ts +6 -0
- package/lib/directives/index.d.ts.map +1 -0
- package/lib/grid-angular.d.ts +2 -0
- package/lib/grid-angular.d.ts.map +1 -0
- package/lib/interfaces/grid-cell-editor.d.ts +85 -0
- package/lib/interfaces/grid-cell-editor.d.ts.map +1 -0
- package/lib/interfaces/grid-cell-renderer.d.ts +63 -0
- package/lib/interfaces/grid-cell-renderer.d.ts.map +1 -0
- package/lib/interfaces/index.d.ts +5 -0
- package/lib/interfaces/index.d.ts.map +1 -0
- package/package.json +53 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { AngularGridAdapter } from './lib/angular-grid-adapter';
|
|
2
|
+
export { GridColumnEditor } from './lib/directives/grid-column-editor.directive';
|
|
3
|
+
export type { GridEditorContext } from './lib/directives/grid-column-editor.directive';
|
|
4
|
+
export { GridColumnView } from './lib/directives/grid-column-view.directive';
|
|
5
|
+
export type { GridCellContext } from './lib/directives/grid-column-view.directive';
|
|
6
|
+
export { GridDetailView } from './lib/directives/grid-detail-view.directive';
|
|
7
|
+
export type { GridDetailContext } from './lib/directives/grid-detail-view.directive';
|
|
8
|
+
export { GridToolPanel } from './lib/directives/grid-tool-panel.directive';
|
|
9
|
+
export type { GridToolPanelContext } from './lib/directives/grid-tool-panel.directive';
|
|
10
|
+
export { Grid } from './lib/directives/grid.directive';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../libs/grid-angular/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACjF,YAAY,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,YAAY,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,YAAY,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAC3E,YAAY,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
var me = Object.create;
|
|
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) => {
|
|
5
|
+
throw TypeError(i);
|
|
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);
|
|
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);
|
|
15
|
+
}, set [t](c) {
|
|
16
|
+
return J(this, s, c);
|
|
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;
|
|
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);
|
|
31
|
+
}
|
|
32
|
+
var te, O;
|
|
33
|
+
te = [y({ selector: "tbw-grid-column-editor" })];
|
|
34
|
+
class j {
|
|
35
|
+
elementRef = p(b);
|
|
36
|
+
/**
|
|
37
|
+
* Query for the ng-template content child.
|
|
38
|
+
*/
|
|
39
|
+
template = A(T);
|
|
40
|
+
/** Effect that triggers when the template is available */
|
|
41
|
+
onTemplateReceived = x(() => {
|
|
42
|
+
const e = this.template();
|
|
43
|
+
e && oe.set(this.elementRef.nativeElement, e);
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Static type guard for template context.
|
|
47
|
+
* Enables type inference in templates.
|
|
48
|
+
*/
|
|
49
|
+
static ngTemplateContextGuard(e, t) {
|
|
50
|
+
return !0;
|
|
51
|
+
}
|
|
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);
|
|
57
|
+
}
|
|
58
|
+
var ie, V;
|
|
59
|
+
ie = [y({ selector: "tbw-grid-column-view" })];
|
|
60
|
+
class $ {
|
|
61
|
+
elementRef = p(b);
|
|
62
|
+
/**
|
|
63
|
+
* Query for the ng-template content child.
|
|
64
|
+
*/
|
|
65
|
+
template = A(T);
|
|
66
|
+
/** Effect that triggers when the template is available */
|
|
67
|
+
onTemplateReceived = x(() => {
|
|
68
|
+
const e = this.template();
|
|
69
|
+
e && ae.set(this.elementRef.nativeElement, e);
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Static type guard for template context.
|
|
73
|
+
* Enables type inference in templates.
|
|
74
|
+
*/
|
|
75
|
+
static ngTemplateContextGuard(e, t) {
|
|
76
|
+
return !0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
V = h(null), $ = R(V, 0, "GridColumnView", ie, $), g(V, 1, $);
|
|
80
|
+
const le = /* @__PURE__ */ new Map();
|
|
81
|
+
function ee(i) {
|
|
82
|
+
const e = i.querySelector("tbw-grid-detail");
|
|
83
|
+
if (e)
|
|
84
|
+
return le.get(e);
|
|
85
|
+
}
|
|
86
|
+
var ne, k;
|
|
87
|
+
ne = [y({ selector: "tbw-grid-detail" })];
|
|
88
|
+
class q {
|
|
89
|
+
elementRef = p(b);
|
|
90
|
+
/** Whether to show the expand/collapse column. Default: true */
|
|
91
|
+
showExpandColumn = f(!0);
|
|
92
|
+
/** Animation style for expand/collapse. Default: 'slide' */
|
|
93
|
+
animation = f("slide");
|
|
94
|
+
/**
|
|
95
|
+
* Query for the ng-template content child.
|
|
96
|
+
*/
|
|
97
|
+
template = A(T);
|
|
98
|
+
/** Effect that triggers when the template is available */
|
|
99
|
+
onTemplateReceived = x(() => {
|
|
100
|
+
const e = this.template();
|
|
101
|
+
e && le.set(this.elementRef.nativeElement, e);
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* Static type guard for template context.
|
|
105
|
+
* Enables type inference in templates.
|
|
106
|
+
*/
|
|
107
|
+
static ngTemplateContextGuard(e, t) {
|
|
108
|
+
return !0;
|
|
109
|
+
}
|
|
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);
|
|
115
|
+
}
|
|
116
|
+
var re, L;
|
|
117
|
+
re = [y({ selector: "tbw-grid-tool-panel" })];
|
|
118
|
+
class I {
|
|
119
|
+
elementRef = p(b);
|
|
120
|
+
/** Unique panel identifier (required) */
|
|
121
|
+
id = f.required({ alias: "id" });
|
|
122
|
+
/** Panel title shown in accordion header (required) */
|
|
123
|
+
title = f.required({ alias: "title" });
|
|
124
|
+
/** Icon for accordion section header (emoji or text) */
|
|
125
|
+
icon = f();
|
|
126
|
+
/** Tooltip for accordion section header */
|
|
127
|
+
tooltip = f();
|
|
128
|
+
/** Panel order priority (lower = first, default: 100) */
|
|
129
|
+
order = f(100);
|
|
130
|
+
/**
|
|
131
|
+
* Query for the ng-template content child.
|
|
132
|
+
*/
|
|
133
|
+
template = A(T);
|
|
134
|
+
/** Effect that triggers when the template is available */
|
|
135
|
+
onTemplateReceived = x(() => {
|
|
136
|
+
const e = this.template(), t = this.elementRef.nativeElement;
|
|
137
|
+
if (e) {
|
|
138
|
+
t.setAttribute("id", this.id()), t.setAttribute("title", this.title());
|
|
139
|
+
const n = this.icon();
|
|
140
|
+
n && t.setAttribute("icon", n);
|
|
141
|
+
const r = this.tooltip();
|
|
142
|
+
r && t.setAttribute("tooltip", r), t.setAttribute("order", String(this.order())), ce.set(t, e);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
/**
|
|
146
|
+
* Static type guard for template context.
|
|
147
|
+
* Enables type inference in templates.
|
|
148
|
+
*/
|
|
149
|
+
static ngTemplateContextGuard(e, t) {
|
|
150
|
+
return !0;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
L = h(null), I = R(L, 0, "GridToolPanel", re, I), g(L, 1, I);
|
|
154
|
+
class ye {
|
|
155
|
+
constructor(e, t, n) {
|
|
156
|
+
this.injector = e, this.appRef = t, this.viewContainerRef = n, window.__ANGULAR_GRID_ADAPTER__ = this;
|
|
157
|
+
}
|
|
158
|
+
viewRefs = [];
|
|
159
|
+
/**
|
|
160
|
+
* Determines if this adapter can handle the given element.
|
|
161
|
+
* Checks if a template is registered for this element.
|
|
162
|
+
*/
|
|
163
|
+
canHandle(e) {
|
|
164
|
+
return Z(e) !== void 0 || Y(e) !== void 0;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Creates a view renderer function that creates an embedded view
|
|
168
|
+
* from the registered template and returns its DOM element.
|
|
169
|
+
*/
|
|
170
|
+
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"), () => "");
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Creates an editor spec that creates an embedded view
|
|
184
|
+
* with commit/cancel EventEmitters in the context.
|
|
185
|
+
*/
|
|
186
|
+
createEditor(e) {
|
|
187
|
+
const t = Y(e);
|
|
188
|
+
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 = {
|
|
192
|
+
$implicit: n.value,
|
|
193
|
+
value: n.value,
|
|
194
|
+
row: n.row,
|
|
195
|
+
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];
|
|
200
|
+
} : (console.warn("[AngularGridAdapter] No editor template registered for element"), () => document.createElement("div"));
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Creates a detail renderer function for MasterDetailPlugin.
|
|
204
|
+
* Renders Angular templates for expandable detail rows.
|
|
205
|
+
*/
|
|
206
|
+
createDetailRenderer(e) {
|
|
207
|
+
const t = ee(e);
|
|
208
|
+
if (t)
|
|
209
|
+
return (n) => {
|
|
210
|
+
const r = {
|
|
211
|
+
$implicit: n,
|
|
212
|
+
row: n
|
|
213
|
+
}, s = this.viewContainerRef.createEmbeddedView(t, r);
|
|
214
|
+
this.viewRefs.push(s), s.detectChanges();
|
|
215
|
+
const o = document.createElement("div");
|
|
216
|
+
return s.rootNodes.forEach((a) => o.appendChild(a)), o;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
221
|
+
* Parses the <tbw-grid-detail> element and returns an Angular template-based renderer.
|
|
222
|
+
*
|
|
223
|
+
* This enables MasterDetailPlugin to automatically use Angular templates
|
|
224
|
+
* without manual configuration in the Grid directive.
|
|
225
|
+
*/
|
|
226
|
+
parseDetailElement(e) {
|
|
227
|
+
const t = ee(e.closest("tbw-grid"));
|
|
228
|
+
if (t)
|
|
229
|
+
return (n) => {
|
|
230
|
+
const r = {
|
|
231
|
+
$implicit: n,
|
|
232
|
+
row: n
|
|
233
|
+
}, s = this.viewContainerRef.createEmbeddedView(t, r);
|
|
234
|
+
this.viewRefs.push(s), s.detectChanges();
|
|
235
|
+
const o = document.createElement("div");
|
|
236
|
+
return s.rootNodes.forEach((a) => o.appendChild(a)), o;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Creates a tool panel renderer from a light DOM element.
|
|
241
|
+
* The renderer creates an Angular template-based panel content.
|
|
242
|
+
*/
|
|
243
|
+
createToolPanelRenderer(e) {
|
|
244
|
+
const t = be(e);
|
|
245
|
+
if (!t)
|
|
246
|
+
return;
|
|
247
|
+
const n = e.closest("tbw-grid");
|
|
248
|
+
return (r) => {
|
|
249
|
+
const s = {
|
|
250
|
+
$implicit: n ?? r,
|
|
251
|
+
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();
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Clean up all view references.
|
|
261
|
+
* Call this when your app/component is destroyed.
|
|
262
|
+
*/
|
|
263
|
+
destroy() {
|
|
264
|
+
this.viewRefs.forEach((e) => e.destroy()), this.viewRefs = [];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
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);
|
|
274
|
+
adapter = null;
|
|
275
|
+
/**
|
|
276
|
+
* Custom CSS styles to inject into the grid's shadow DOM.
|
|
277
|
+
* Use this to style custom cell renderers, editors, or detail panels.
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* // In your component
|
|
282
|
+
* customStyles = `
|
|
283
|
+
* .my-detail-panel { padding: 16px; }
|
|
284
|
+
* .my-status-badge { border-radius: 4px; }
|
|
285
|
+
* `;
|
|
286
|
+
* ```
|
|
287
|
+
*
|
|
288
|
+
* ```html
|
|
289
|
+
* <tbw-grid [customStyles]="customStyles">...</tbw-grid>
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
customStyles = f();
|
|
293
|
+
ngOnInit() {
|
|
294
|
+
this.adapter = new ye(this.injector, this.appRef, this.viewContainerRef), Ce.registerAdapter(this.adapter);
|
|
295
|
+
const e = this.elementRef.nativeElement;
|
|
296
|
+
e.__frameworkAdapter = this.adapter;
|
|
297
|
+
}
|
|
298
|
+
ngAfterContentInit() {
|
|
299
|
+
const e = this.elementRef.nativeElement;
|
|
300
|
+
e && typeof e.refreshColumns == "function" && setTimeout(() => {
|
|
301
|
+
e.refreshColumns(), this.configureMasterDetail(e), typeof e.refreshShellHeader == "function" && e.refreshShellHeader(), this.registerCustomStyles(e);
|
|
302
|
+
}, 0);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Registers custom styles into the grid's shadow DOM.
|
|
306
|
+
* Uses the grid's registerStyles() API for clean encapsulation.
|
|
307
|
+
*/
|
|
308
|
+
registerCustomStyles(e) {
|
|
309
|
+
const t = this.customStyles();
|
|
310
|
+
t && e.ready?.().then(() => {
|
|
311
|
+
e.registerStyles?.("angular-custom-styles", t);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Configures the MasterDetailPlugin after Angular templates are registered.
|
|
316
|
+
* - If plugin exists: refresh its detail renderer
|
|
317
|
+
* - If plugin doesn't exist but <tbw-grid-detail> is present: create and add the plugin
|
|
318
|
+
*/
|
|
319
|
+
configureMasterDetail(e) {
|
|
320
|
+
if (!this.adapter) return;
|
|
321
|
+
const t = e.getPlugin?.(X);
|
|
322
|
+
if (t && typeof t.refreshDetailRenderer == "function") {
|
|
323
|
+
t.refreshDetailRenderer();
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const n = e.querySelector("tbw-grid-detail");
|
|
327
|
+
if (!n) return;
|
|
328
|
+
const r = this.adapter.createDetailRenderer(e);
|
|
329
|
+
if (!r) return;
|
|
330
|
+
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({
|
|
334
|
+
detailRenderer: r,
|
|
335
|
+
showExpandColumn: a,
|
|
336
|
+
animation: o
|
|
337
|
+
}), m = e.gridConfig || {}, v = m.plugins || [];
|
|
338
|
+
e.gridConfig = {
|
|
339
|
+
...m,
|
|
340
|
+
plugins: [...v, w]
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
ngOnDestroy() {
|
|
344
|
+
const e = this.elementRef.nativeElement;
|
|
345
|
+
e && this.customStyles() && e.unregisterStyles?.("angular-custom-styles"), this.adapter && (this.adapter.destroy?.(), this.adapter = null);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
U = h(null), H = R(U, 0, "Grid", se, H), g(U, 1, H);
|
|
349
|
+
export {
|
|
350
|
+
ye as AngularGridAdapter,
|
|
351
|
+
H as Grid,
|
|
352
|
+
j as GridColumnEditor,
|
|
353
|
+
$ as GridColumnView,
|
|
354
|
+
q as GridDetailView,
|
|
355
|
+
I as GridToolPanel
|
|
356
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ApplicationRef, EnvironmentInjector, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { ColumnEditorSpec, ColumnViewRenderer, FrameworkAdapter } from '../../../../dist/libs/grid/index.d.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Framework adapter that enables zero-boilerplate integration of Angular components
|
|
5
|
+
* with the grid's light DOM configuration API.
|
|
6
|
+
*
|
|
7
|
+
* ## Usage
|
|
8
|
+
*
|
|
9
|
+
* **One-time setup in your app:**
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { Component, inject, EnvironmentInjector, ApplicationRef, ViewContainerRef } from '@angular/core';
|
|
12
|
+
* import { GridElement } from '@toolbox-web/grid';
|
|
13
|
+
* import { AngularGridAdapter } from '@toolbox-web/grid-angular';
|
|
14
|
+
*
|
|
15
|
+
* @Component({
|
|
16
|
+
* selector: 'app-root',
|
|
17
|
+
* // ...
|
|
18
|
+
* })
|
|
19
|
+
* export class AppComponent {
|
|
20
|
+
* constructor() {
|
|
21
|
+
* const injector = inject(EnvironmentInjector);
|
|
22
|
+
* const appRef = inject(ApplicationRef);
|
|
23
|
+
* const viewContainerRef = inject(ViewContainerRef);
|
|
24
|
+
* GridElement.registerAdapter(new AngularGridAdapter(injector, appRef, viewContainerRef));
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* **Declarative configuration in templates:**
|
|
30
|
+
* ```html
|
|
31
|
+
* <tbw-grid>
|
|
32
|
+
* <tbw-grid-column field="status">
|
|
33
|
+
* <tbw-grid-column-view>
|
|
34
|
+
* <ng-template let-value let-row="row">
|
|
35
|
+
* <app-status-badge [value]="value" [row]="row" />
|
|
36
|
+
* </ng-template>
|
|
37
|
+
* </tbw-grid-column-view>
|
|
38
|
+
* <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()" />
|
|
41
|
+
* </ng-template>
|
|
42
|
+
* </tbw-grid-column-editor>
|
|
43
|
+
* </tbw-grid-column>
|
|
44
|
+
* </tbw-grid>
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* The adapter automatically:
|
|
48
|
+
* - Detects Angular templates registered by directives
|
|
49
|
+
* - Creates embedded views with cell context (value, row, column)
|
|
50
|
+
* - Handles editor outputs (commit/cancel) via EventEmitters
|
|
51
|
+
* - Manages view lifecycle and change detection
|
|
52
|
+
*/
|
|
53
|
+
export declare class AngularGridAdapter implements FrameworkAdapter {
|
|
54
|
+
private injector;
|
|
55
|
+
private appRef;
|
|
56
|
+
private viewContainerRef;
|
|
57
|
+
private viewRefs;
|
|
58
|
+
constructor(injector: EnvironmentInjector, appRef: ApplicationRef, viewContainerRef: ViewContainerRef);
|
|
59
|
+
/**
|
|
60
|
+
* Determines if this adapter can handle the given element.
|
|
61
|
+
* Checks if a template is registered for this element.
|
|
62
|
+
*/
|
|
63
|
+
canHandle(element: HTMLElement): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a view renderer function that creates an embedded view
|
|
66
|
+
* from the registered template and returns its DOM element.
|
|
67
|
+
*/
|
|
68
|
+
createRenderer<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnViewRenderer<TRow, TValue>;
|
|
69
|
+
/**
|
|
70
|
+
* Creates an editor spec that creates an embedded view
|
|
71
|
+
* with commit/cancel EventEmitters in the context.
|
|
72
|
+
*/
|
|
73
|
+
createEditor<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnEditorSpec<TRow, TValue>;
|
|
74
|
+
/**
|
|
75
|
+
* Creates a detail renderer function for MasterDetailPlugin.
|
|
76
|
+
* Renders Angular templates for expandable detail rows.
|
|
77
|
+
*/
|
|
78
|
+
createDetailRenderer<TRow = unknown>(gridElement: HTMLElement): ((row: TRow) => HTMLElement) | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Framework adapter hook called by MasterDetailPlugin during attach().
|
|
81
|
+
* Parses the <tbw-grid-detail> element and returns an Angular template-based renderer.
|
|
82
|
+
*
|
|
83
|
+
* This enables MasterDetailPlugin to automatically use Angular templates
|
|
84
|
+
* without manual configuration in the Grid directive.
|
|
85
|
+
*/
|
|
86
|
+
parseDetailElement<TRow = unknown>(detailElement: Element): ((row: TRow, rowIndex: number) => HTMLElement | string) | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Creates a tool panel renderer from a light DOM element.
|
|
89
|
+
* The renderer creates an Angular template-based panel content.
|
|
90
|
+
*/
|
|
91
|
+
createToolPanelRenderer(element: HTMLElement): ((container: HTMLElement) => void | (() => void)) | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Clean up all view references.
|
|
94
|
+
* Call this when your app/component is destroyed.
|
|
95
|
+
*/
|
|
96
|
+
destroy(): void;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=angular-grid-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-angular/src/lib/angular-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EAEd,mBAAmB,EAGnB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAGV,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAM3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,qBAAa,kBAAmB,YAAW,gBAAgB;IAIvD,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,gBAAgB;IAL1B,OAAO,CAAC,QAAQ,CAAkC;gBAGxC,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,cAAc,EACtB,gBAAgB,EAAE,gBAAgB;IAM5C;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAIxC;;;OAGG;IACH,cAAc,CAAC,IAAI,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;IA8BxG;;;OAGG;IACH,YAAY,CAAC,IAAI,GAAG,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC;IAwCpG;;;OAGG;IACH,oBAAoB,CAAC,IAAI,GAAG,OAAO,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,WAAW,CAAC,GAAG,SAAS;IA4BxG;;;;;;OAMG;IACH,kBAAkB,CAAC,IAAI,GAAG,OAAO,EAC/B,aAAa,EAAE,OAAO,GACrB,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC,GAAG,SAAS;IA4BtE;;;OAGG;IACH,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,CAAC,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS;IAsC5G;;;OAGG;IACH,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Type } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Register an Angular component as a grid cell renderer.
|
|
4
|
+
* Call this at module level (outside the class) to register on import.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { Component, input } from '@angular/core';
|
|
9
|
+
* import { registerGridRenderer, GridCellRenderer } from '@toolbox-web/grid-angular';
|
|
10
|
+
*
|
|
11
|
+
* @Component({
|
|
12
|
+
* selector: 'app-status-badge',
|
|
13
|
+
* template: `<span [class]="'status-' + value()">{{ value() }}</span>`,
|
|
14
|
+
* })
|
|
15
|
+
* export class StatusBadgeComponent implements GridCellRenderer<string> {
|
|
16
|
+
* value = input.required<string>();
|
|
17
|
+
* row = input<unknown>();
|
|
18
|
+
* }
|
|
19
|
+
*
|
|
20
|
+
* // Register at module level - runs when file is imported
|
|
21
|
+
* registerGridRenderer('app-status-badge', StatusBadgeComponent);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function registerGridRenderer(tagName: string, componentType: Type<unknown>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Register an Angular component as a grid cell editor.
|
|
27
|
+
* Call this at module level (outside the class) to register on import.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* import { Component, input, output } from '@angular/core';
|
|
32
|
+
* import { registerGridEditor, GridCellEditor } from '@toolbox-web/grid-angular';
|
|
33
|
+
*
|
|
34
|
+
* @Component({
|
|
35
|
+
* selector: 'app-status-select',
|
|
36
|
+
* template: `<select [value]="value()" (change)="onChange($event)">...</select>`,
|
|
37
|
+
* })
|
|
38
|
+
* export class StatusSelectComponent implements GridCellEditor<string> {
|
|
39
|
+
* value = input.required<string>();
|
|
40
|
+
* commit = output<string>();
|
|
41
|
+
* cancel = output<void>();
|
|
42
|
+
*
|
|
43
|
+
* onChange(e: Event) {
|
|
44
|
+
* this.commit.emit((e.target as HTMLSelectElement).value);
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* // Register at module level - runs when file is imported
|
|
49
|
+
* registerGridEditor('app-status-select', StatusSelectComponent);
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function registerGridEditor(tagName: string, componentType: Type<unknown>): void;
|
|
53
|
+
/**
|
|
54
|
+
* Get a registered component by tag name.
|
|
55
|
+
* Used internally by AngularGridAdapter.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getRegisteredComponent(tagName: string): Type<unknown> | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Get all registered components.
|
|
60
|
+
* Used internally by AngularGridAdapter.
|
|
61
|
+
*/
|
|
62
|
+
export declare function getAllRegisteredComponents(): Map<string, Type<unknown>>;
|
|
63
|
+
//# sourceMappingURL=component-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../../../libs/grid-angular/src/lib/component-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAmCrC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAExF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAEtF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,SAAS,CAEjF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAEvE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { EventEmitter, TemplateRef } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Context object passed to the cell editor template.
|
|
4
|
+
* Contains the cell value, row data, column configuration, and commit/cancel functions.
|
|
5
|
+
*/
|
|
6
|
+
export interface GridEditorContext<TValue = unknown, TRow = unknown> {
|
|
7
|
+
/** The cell value for this column */
|
|
8
|
+
$implicit: TValue;
|
|
9
|
+
/** The cell value (explicit binding) */
|
|
10
|
+
value: TValue;
|
|
11
|
+
/** The full row data object */
|
|
12
|
+
row: TRow;
|
|
13
|
+
/** The column configuration */
|
|
14
|
+
column: unknown;
|
|
15
|
+
/** Event emitter to commit the edited value */
|
|
16
|
+
commit: EventEmitter<TValue>;
|
|
17
|
+
/** Event emitter to cancel editing */
|
|
18
|
+
cancel: EventEmitter<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gets the editor template registered for a given element.
|
|
22
|
+
* Used by AngularGridAdapter to retrieve templates at render time.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getEditorTemplate(element: HTMLElement): TemplateRef<GridEditorContext> | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Directive that captures an `<ng-template>` for use as a cell editor.
|
|
27
|
+
*
|
|
28
|
+
* This enables declarative Angular component usage with proper input bindings
|
|
29
|
+
* that satisfy Angular's AOT compiler.
|
|
30
|
+
*
|
|
31
|
+
* ## Usage
|
|
32
|
+
*
|
|
33
|
+
* ```html
|
|
34
|
+
* <tbw-grid-column field="status" editable>
|
|
35
|
+
* <tbw-grid-column-editor>
|
|
36
|
+
* <ng-template let-value let-row="row" let-commit="commit" let-cancel="cancel">
|
|
37
|
+
* <app-status-select
|
|
38
|
+
* [value]="value"
|
|
39
|
+
* [row]="row"
|
|
40
|
+
* (commit)="commit.emit($event)"
|
|
41
|
+
* (cancel)="cancel.emit()"
|
|
42
|
+
* />
|
|
43
|
+
* </ng-template>
|
|
44
|
+
* </tbw-grid-column-editor>
|
|
45
|
+
* </tbw-grid-column>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* The template context provides:
|
|
49
|
+
* - `$implicit` / `value`: The cell value
|
|
50
|
+
* - `row`: The full row data object
|
|
51
|
+
* - `column`: The column configuration
|
|
52
|
+
* - `commit`: EventEmitter to commit the new value
|
|
53
|
+
* - `cancel`: EventEmitter to cancel editing
|
|
54
|
+
*
|
|
55
|
+
* Import the directive in your component:
|
|
56
|
+
*
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { GridColumnEditor } from '@toolbox-web/grid-angular';
|
|
59
|
+
*
|
|
60
|
+
* @Component({
|
|
61
|
+
* imports: [GridColumnEditor],
|
|
62
|
+
* // ...
|
|
63
|
+
* })
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare class GridColumnEditor {
|
|
67
|
+
private elementRef;
|
|
68
|
+
/**
|
|
69
|
+
* Query for the ng-template content child.
|
|
70
|
+
*/
|
|
71
|
+
template: import('@angular/core').Signal<TemplateRef<any> | undefined>;
|
|
72
|
+
/** Effect that triggers when the template is available */
|
|
73
|
+
private onTemplateReceived;
|
|
74
|
+
/**
|
|
75
|
+
* Static type guard for template context.
|
|
76
|
+
* Enables type inference in templates.
|
|
77
|
+
*/
|
|
78
|
+
static ngTemplateContextGuard(dir: GridColumnEditor, ctx: unknown): ctx is GridEditorContext;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=grid-column-editor.directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-column-editor.directive.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/directives/grid-column-editor.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,YAAY,EAAU,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/G;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAAC,MAAM,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO;IACjE,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,GAAG,EAAE,IAAI,CAAC;IACV,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,sCAAsC;IACtC,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC5B;AAKD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAElG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qBACa,gBAAgB;IAC3B,OAAO,CAAC,UAAU,CAAmC;IAErD;;OAEG;IACH,QAAQ,+DAAgD;IAExD,0DAA0D;IAC1D,OAAO,CAAC,kBAAkB,CAMvB;IAEH;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB;CAG7F"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Context object passed to the cell renderer template.
|
|
4
|
+
* Contains the cell value, row data, and column configuration.
|
|
5
|
+
*/
|
|
6
|
+
export interface GridCellContext<TValue = unknown, TRow = unknown> {
|
|
7
|
+
/** The cell value for this column */
|
|
8
|
+
$implicit: TValue;
|
|
9
|
+
/** The cell value (explicit binding) */
|
|
10
|
+
value: TValue;
|
|
11
|
+
/** The full row data object */
|
|
12
|
+
row: TRow;
|
|
13
|
+
/** The column configuration */
|
|
14
|
+
column: unknown;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gets the template registered for a given element.
|
|
18
|
+
* Used by AngularGridAdapter to retrieve templates at render time.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getViewTemplate(element: HTMLElement): TemplateRef<GridCellContext> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Directive that captures an `<ng-template>` for use as a cell renderer.
|
|
23
|
+
*
|
|
24
|
+
* This enables declarative Angular component usage with proper input bindings
|
|
25
|
+
* that satisfy Angular's AOT compiler.
|
|
26
|
+
*
|
|
27
|
+
* ## Usage
|
|
28
|
+
*
|
|
29
|
+
* ```html
|
|
30
|
+
* <tbw-grid-column field="status">
|
|
31
|
+
* <tbw-grid-column-view>
|
|
32
|
+
* <ng-template let-value let-row="row">
|
|
33
|
+
* <app-status-badge [value]="value" [row]="row" />
|
|
34
|
+
* </ng-template>
|
|
35
|
+
* </tbw-grid-column-view>
|
|
36
|
+
* </tbw-grid-column>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* The template context provides:
|
|
40
|
+
* - `$implicit` / `value`: The cell value
|
|
41
|
+
* - `row`: The full row data object
|
|
42
|
+
* - `column`: The column configuration
|
|
43
|
+
*
|
|
44
|
+
* Import the directive in your component:
|
|
45
|
+
*
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { GridColumnView } from '@toolbox-web/grid-angular';
|
|
48
|
+
*
|
|
49
|
+
* @Component({
|
|
50
|
+
* imports: [GridColumnView],
|
|
51
|
+
* // ...
|
|
52
|
+
* })
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare class GridColumnView {
|
|
56
|
+
private elementRef;
|
|
57
|
+
/**
|
|
58
|
+
* Query for the ng-template content child.
|
|
59
|
+
*/
|
|
60
|
+
template: import('@angular/core').Signal<TemplateRef<any> | undefined>;
|
|
61
|
+
/** Effect that triggers when the template is available */
|
|
62
|
+
private onTemplateReceived;
|
|
63
|
+
/**
|
|
64
|
+
* Static type guard for template context.
|
|
65
|
+
* Enables type inference in templates.
|
|
66
|
+
*/
|
|
67
|
+
static ngTemplateContextGuard(dir: GridColumnView, ctx: unknown): ctx is GridCellContext;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=grid-column-view.directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-column-view.directive.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/directives/grid-column-view.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuD,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjG;;;GAGG;AACH,MAAM,WAAW,eAAe,CAAC,MAAM,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO;IAC/D,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,GAAG,EAAE,IAAI,CAAC;IACV,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;CACjB;AAKD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC,eAAe,CAAC,GAAG,SAAS,CAE9F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBACa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAmC;IAErD;;OAEG;IACH,QAAQ,+DAA8C;IAEtD,0DAA0D;IAC1D,OAAO,CAAC,kBAAkB,CAMvB;IAEH;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,eAAe;CAGzF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
import { ExpandCollapseAnimation } from '../../../../../dist/libs/grid/index.d.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Context object passed to the detail renderer template.
|
|
5
|
+
* Contains the row data for the expanded detail view.
|
|
6
|
+
*/
|
|
7
|
+
export interface GridDetailContext<TRow = unknown> {
|
|
8
|
+
/** The row data (implicit binding for let-row) */
|
|
9
|
+
$implicit: TRow;
|
|
10
|
+
/** The row data (explicit binding) */
|
|
11
|
+
row: TRow;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Gets the detail template registered for a given grid element.
|
|
15
|
+
* Used by AngularGridAdapter to retrieve templates at render time.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getDetailTemplate(gridElement: HTMLElement): TemplateRef<GridDetailContext> | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Gets the configuration for the detail view.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getDetailConfig(gridElement: HTMLElement): {
|
|
22
|
+
showExpandColumn?: boolean;
|
|
23
|
+
animation?: ExpandCollapseAnimation;
|
|
24
|
+
} | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Directive that captures an `<ng-template>` for use as a master-detail row renderer.
|
|
27
|
+
*
|
|
28
|
+
* This enables declarative Angular component usage for expandable detail rows
|
|
29
|
+
* that appear below the main row when expanded.
|
|
30
|
+
*
|
|
31
|
+
* ## Usage
|
|
32
|
+
*
|
|
33
|
+
* ```html
|
|
34
|
+
* <tbw-grid [rows]="rows" [gridConfig]="config">
|
|
35
|
+
* <tbw-grid-detail [showExpandColumn]="true" animation="slide">
|
|
36
|
+
* <ng-template let-row>
|
|
37
|
+
* <app-detail-panel [employee]="row" />
|
|
38
|
+
* </ng-template>
|
|
39
|
+
* </tbw-grid-detail>
|
|
40
|
+
* </tbw-grid>
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* The template context provides:
|
|
44
|
+
* - `$implicit` / `row`: The full row data object
|
|
45
|
+
*
|
|
46
|
+
* Import the directive in your component:
|
|
47
|
+
*
|
|
48
|
+
* ```typescript
|
|
49
|
+
* import { GridDetailView } from '@toolbox-web/grid-angular';
|
|
50
|
+
*
|
|
51
|
+
* @Component({
|
|
52
|
+
* imports: [GridDetailView],
|
|
53
|
+
* // ...
|
|
54
|
+
* })
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class GridDetailView {
|
|
58
|
+
private elementRef;
|
|
59
|
+
/** Whether to show the expand/collapse column. Default: true */
|
|
60
|
+
showExpandColumn: import('@angular/core').InputSignal<boolean>;
|
|
61
|
+
/** Animation style for expand/collapse. Default: 'slide' */
|
|
62
|
+
animation: import('@angular/core').InputSignal<ExpandCollapseAnimation>;
|
|
63
|
+
/**
|
|
64
|
+
* Query for the ng-template content child.
|
|
65
|
+
*/
|
|
66
|
+
template: import('@angular/core').Signal<TemplateRef<any> | undefined>;
|
|
67
|
+
/** Effect that triggers when the template is available */
|
|
68
|
+
private onTemplateReceived;
|
|
69
|
+
/**
|
|
70
|
+
* Static type guard for template context.
|
|
71
|
+
* Enables type inference in templates.
|
|
72
|
+
*/
|
|
73
|
+
static ngTemplateContextGuard(dir: GridDetailView, ctx: unknown): ctx is GridDetailContext;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=grid-detail-view.directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-detail-view.directive.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/directives/grid-detail-view.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,WAAW,EAAE,MAAM,eAAe,CAAC;AACxG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAAC,IAAI,GAAG,OAAO;IAC/C,kDAAkD;IAClD,SAAS,EAAE,IAAI,CAAC;IAChB,sCAAsC;IACtC,GAAG,EAAE,IAAI,CAAC;CACX;AAKD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAOtG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,WAAW,GACvB;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,uBAAuB,CAAA;CAAE,GAAG,SAAS,CAgBjF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBACa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAmC;IAErD,gEAAgE;IAChE,gBAAgB,+CAAwB;IAExC,4DAA4D;IAC5D,SAAS,+DAA2C;IAEpD;;OAEG;IACH,QAAQ,+DAAgD;IAExD,0DAA0D;IAC1D,OAAO,CAAC,kBAAkB,CAMvB;IAEH;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB;CAG3F"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { TemplateRef } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Context object passed to the tool panel template.
|
|
4
|
+
* Provides access to grid-related information for the panel content.
|
|
5
|
+
*/
|
|
6
|
+
export interface GridToolPanelContext {
|
|
7
|
+
/** The grid element (implicit binding) */
|
|
8
|
+
$implicit: HTMLElement;
|
|
9
|
+
/** The grid element */
|
|
10
|
+
grid: HTMLElement;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Gets the tool panel template registered for a given tool panel element.
|
|
14
|
+
* Used by AngularGridAdapter to retrieve templates at render time.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getToolPanelTemplate(panelElement: HTMLElement): TemplateRef<GridToolPanelContext> | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Gets all tool panel elements with registered templates within a grid element.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getToolPanelElements(gridElement: HTMLElement): HTMLElement[];
|
|
21
|
+
/**
|
|
22
|
+
* Directive that captures an `<ng-template>` for use as a custom tool panel.
|
|
23
|
+
*
|
|
24
|
+
* This enables declarative Angular component usage for tool panels
|
|
25
|
+
* that appear in the grid's side panel.
|
|
26
|
+
*
|
|
27
|
+
* ## Usage
|
|
28
|
+
*
|
|
29
|
+
* ```html
|
|
30
|
+
* <tbw-grid [rows]="rows" [gridConfig]="config">
|
|
31
|
+
* <tbw-grid-tool-panel
|
|
32
|
+
* id="quick-filters"
|
|
33
|
+
* title="Quick Filters"
|
|
34
|
+
* icon="🔍"
|
|
35
|
+
* tooltip="Apply quick filters"
|
|
36
|
+
* [order]="10"
|
|
37
|
+
* >
|
|
38
|
+
* <ng-template let-grid>
|
|
39
|
+
* <app-quick-filters [grid]="grid" />
|
|
40
|
+
* </ng-template>
|
|
41
|
+
* </tbw-grid-tool-panel>
|
|
42
|
+
* </tbw-grid>
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* The template context provides:
|
|
46
|
+
* - `$implicit` / `grid`: The grid element reference
|
|
47
|
+
*
|
|
48
|
+
* ### Attributes
|
|
49
|
+
*
|
|
50
|
+
* - `id` (required): Unique identifier for the panel
|
|
51
|
+
* - `title` (required): Panel title shown in accordion header
|
|
52
|
+
* - `icon`: Icon for accordion section header (emoji or text)
|
|
53
|
+
* - `tooltip`: Tooltip for accordion section header
|
|
54
|
+
* - `order`: Panel order priority (lower = first, default: 100)
|
|
55
|
+
*
|
|
56
|
+
* Import the directive in your component:
|
|
57
|
+
*
|
|
58
|
+
* ```typescript
|
|
59
|
+
* import { GridToolPanel } from '@toolbox-web/grid-angular';
|
|
60
|
+
*
|
|
61
|
+
* @Component({
|
|
62
|
+
* imports: [GridToolPanel],
|
|
63
|
+
* // ...
|
|
64
|
+
* })
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare class GridToolPanel {
|
|
68
|
+
private elementRef;
|
|
69
|
+
/** Unique panel identifier (required) */
|
|
70
|
+
id: import('@angular/core').InputSignal<string>;
|
|
71
|
+
/** Panel title shown in accordion header (required) */
|
|
72
|
+
title: import('@angular/core').InputSignal<string>;
|
|
73
|
+
/** Icon for accordion section header (emoji or text) */
|
|
74
|
+
icon: import('@angular/core').InputSignal<string | undefined>;
|
|
75
|
+
/** Tooltip for accordion section header */
|
|
76
|
+
tooltip: import('@angular/core').InputSignal<string | undefined>;
|
|
77
|
+
/** Panel order priority (lower = first, default: 100) */
|
|
78
|
+
order: import('@angular/core').InputSignal<number>;
|
|
79
|
+
/**
|
|
80
|
+
* Query for the ng-template content child.
|
|
81
|
+
*/
|
|
82
|
+
template: import('@angular/core').Signal<TemplateRef<any> | undefined>;
|
|
83
|
+
/** Effect that triggers when the template is available */
|
|
84
|
+
private onTemplateReceived;
|
|
85
|
+
/**
|
|
86
|
+
* Static type guard for template context.
|
|
87
|
+
* Enables type inference in templates.
|
|
88
|
+
*/
|
|
89
|
+
static ngTemplateContextGuard(dir: GridToolPanel, ctx: unknown): ctx is GridToolPanelContext;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=grid-tool-panel.directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-tool-panel.directive.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/directives/grid-tool-panel.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,WAAW,EAAE,MAAM,eAAe,CAAC;AAExG;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,0CAA0C;IAC1C,SAAS,EAAE,WAAW,CAAC;IACvB,uBAAuB;IACvB,IAAI,EAAE,WAAW,CAAC;CACnB;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,CAAC,oBAAoB,CAAC,GAAG,SAAS,CAE7G;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,EAAE,CAG5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBACa,aAAa;IACxB,OAAO,CAAC,UAAU,CAAmC;IAErD,yCAAyC;IACzC,EAAE,8CAA2C;IAE7C,uDAAuD;IACvD,KAAK,8CAA8C;IAEnD,wDAAwD;IACxD,IAAI,0DAAmB;IAEvB,2CAA2C;IAC3C,OAAO,0DAAmB;IAE1B,yDAAyD;IACzD,KAAK,8CAAsB;IAE3B;;OAEG;IACH,QAAQ,+DAAmD;IAE3D,0DAA0D;IAC1D,OAAO,CAAC,kBAAkB,CAoBvB;IAEH;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,oBAAoB;CAG7F"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { AfterContentInit, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Directive that automatically registers the Angular adapter with tbw-grid elements.
|
|
4
|
+
*
|
|
5
|
+
* This directive eliminates the need to manually register the adapter in your component
|
|
6
|
+
* constructor. Simply import this directive and it will handle adapter registration.
|
|
7
|
+
*
|
|
8
|
+
* ## Usage
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
12
|
+
* import { Grid } from '@toolbox-web/grid-angular';
|
|
13
|
+
*
|
|
14
|
+
* @Component({
|
|
15
|
+
* selector: 'app-root',
|
|
16
|
+
* imports: [Grid],
|
|
17
|
+
* schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
18
|
+
* template: `
|
|
19
|
+
* <tbw-grid [rows]="rows" [gridConfig]="config" [customStyles]="myStyles">
|
|
20
|
+
* <!-- column templates -->
|
|
21
|
+
* </tbw-grid>
|
|
22
|
+
* `
|
|
23
|
+
* })
|
|
24
|
+
* export class AppComponent {
|
|
25
|
+
* rows = [...];
|
|
26
|
+
* config = {...};
|
|
27
|
+
* myStyles = `.my-class { color: red; }`;
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The directive automatically:
|
|
32
|
+
* - Creates an AngularGridAdapter instance
|
|
33
|
+
* - Registers it with the GridElement
|
|
34
|
+
* - Injects custom styles into the grid's shadow DOM
|
|
35
|
+
* - Handles cleanup on destruction
|
|
36
|
+
*/
|
|
37
|
+
export declare class Grid implements OnInit, AfterContentInit, OnDestroy {
|
|
38
|
+
private elementRef;
|
|
39
|
+
private injector;
|
|
40
|
+
private appRef;
|
|
41
|
+
private viewContainerRef;
|
|
42
|
+
private adapter;
|
|
43
|
+
/**
|
|
44
|
+
* Custom CSS styles to inject into the grid's shadow DOM.
|
|
45
|
+
* Use this to style custom cell renderers, editors, or detail panels.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // In your component
|
|
50
|
+
* customStyles = `
|
|
51
|
+
* .my-detail-panel { padding: 16px; }
|
|
52
|
+
* .my-status-badge { border-radius: 4px; }
|
|
53
|
+
* `;
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* ```html
|
|
57
|
+
* <tbw-grid [customStyles]="customStyles">...</tbw-grid>
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
customStyles: import('@angular/core').InputSignal<string | undefined>;
|
|
61
|
+
ngOnInit(): void;
|
|
62
|
+
ngAfterContentInit(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Registers custom styles into the grid's shadow DOM.
|
|
65
|
+
* Uses the grid's registerStyles() API for clean encapsulation.
|
|
66
|
+
*/
|
|
67
|
+
private registerCustomStyles;
|
|
68
|
+
/**
|
|
69
|
+
* Configures the MasterDetailPlugin after Angular templates are registered.
|
|
70
|
+
* - If plugin exists: refresh its detail renderer
|
|
71
|
+
* - If plugin doesn't exist but <tbw-grid-detail> is present: create and add the plugin
|
|
72
|
+
*/
|
|
73
|
+
private configureMasterDetail;
|
|
74
|
+
ngOnDestroy(): void;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=grid.directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.directive.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/directives/grid.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAOhB,SAAS,EACT,MAAM,EAEP,MAAM,eAAe,CAAC;AAKvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBACa,IAAK,YAAW,MAAM,EAAE,gBAAgB,EAAE,SAAS;IAC9D,OAAO,CAAC,UAAU,CAAmC;IACrD,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,gBAAgB,CAA4B;IAEpD,OAAO,CAAC,OAAO,CAAmC;IAElD;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,0DAAmB;IAE/B,QAAQ,IAAI,IAAI;IAWhB,kBAAkB,IAAI,IAAI;IAwB1B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA4C7B,WAAW,IAAI,IAAI;CAapB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { GridColumnEditor } from './grid-column-editor.directive';
|
|
2
|
+
export { GridColumnView } from './grid-column-view.directive';
|
|
3
|
+
export { GridDetailView } from './grid-detail-view.directive';
|
|
4
|
+
export { GridToolPanel } from './grid-tool-panel.directive';
|
|
5
|
+
export { Grid } from './grid.directive';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/directives/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-angular.d.ts","sourceRoot":"","sources":["../../../../libs/grid-angular/src/lib/grid-angular.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { InjectionToken, InputSignal, OutputEmitterRef } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for Angular components used as cell editors in the grid.
|
|
4
|
+
*
|
|
5
|
+
* Components implementing this interface can be used inside `<tbw-grid-column-editor>`
|
|
6
|
+
* and will automatically receive cell data via inputs and emit changes via outputs.
|
|
7
|
+
*
|
|
8
|
+
* ## Usage
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { Component, input, output } from '@angular/core';
|
|
12
|
+
* import { GridCellEditor, GRID_CELL_EDITOR } from '@toolbox-web/grid-angular';
|
|
13
|
+
*
|
|
14
|
+
* @Component({
|
|
15
|
+
* selector: 'app-status-select',
|
|
16
|
+
* template: `
|
|
17
|
+
* <select [value]="value()" (change)="onChange($event)">
|
|
18
|
+
* <option value="active">Active</option>
|
|
19
|
+
* <option value="inactive">Inactive</option>
|
|
20
|
+
* </select>
|
|
21
|
+
* `,
|
|
22
|
+
* providers: [{ provide: GRID_CELL_EDITOR, useExisting: StatusSelectComponent }]
|
|
23
|
+
* })
|
|
24
|
+
* export class StatusSelectComponent implements GridCellEditor<string> {
|
|
25
|
+
* value = input.required<string>();
|
|
26
|
+
* row = input<unknown>();
|
|
27
|
+
* column = input<unknown>();
|
|
28
|
+
*
|
|
29
|
+
* commit = output<string>();
|
|
30
|
+
* cancel = output<void>();
|
|
31
|
+
*
|
|
32
|
+
* onChange(event: Event) {
|
|
33
|
+
* this.commit.emit((event.target as HTMLSelectElement).value);
|
|
34
|
+
* }
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Then use in your template:
|
|
39
|
+
* ```html
|
|
40
|
+
* <tbw-grid-column field="status" editable>
|
|
41
|
+
* <tbw-grid-column-editor>
|
|
42
|
+
* <app-status-select />
|
|
43
|
+
* </tbw-grid-column-editor>
|
|
44
|
+
* </tbw-grid-column>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export interface GridCellEditor<TValue = unknown, TRow = unknown> {
|
|
48
|
+
/**
|
|
49
|
+
* The current cell value for editing.
|
|
50
|
+
* This is automatically set by the grid adapter.
|
|
51
|
+
*/
|
|
52
|
+
value: InputSignal<TValue>;
|
|
53
|
+
/**
|
|
54
|
+
* The full row data object.
|
|
55
|
+
* Optional - only needed if your editor needs access to other columns.
|
|
56
|
+
*/
|
|
57
|
+
row?: InputSignal<TRow>;
|
|
58
|
+
/**
|
|
59
|
+
* The column configuration object.
|
|
60
|
+
* Optional - only needed if your editor needs column metadata.
|
|
61
|
+
*/
|
|
62
|
+
column?: InputSignal<unknown>;
|
|
63
|
+
/**
|
|
64
|
+
* Emit when the user commits the edited value.
|
|
65
|
+
* The grid will update the cell with this value.
|
|
66
|
+
*/
|
|
67
|
+
commit: OutputEmitterRef<TValue>;
|
|
68
|
+
/**
|
|
69
|
+
* Emit when the user cancels editing.
|
|
70
|
+
* The grid will revert to the original value.
|
|
71
|
+
*/
|
|
72
|
+
cancel: OutputEmitterRef<void>;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Injection token for cell editor components.
|
|
76
|
+
*
|
|
77
|
+
* Components must provide themselves with this token to be auto-discovered:
|
|
78
|
+
* ```typescript
|
|
79
|
+
* @Component({
|
|
80
|
+
* providers: [{ provide: GRID_CELL_EDITOR, useExisting: MyEditorComponent }]
|
|
81
|
+
* })
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare const GRID_CELL_EDITOR: InjectionToken<GridCellEditor<unknown, unknown>>;
|
|
85
|
+
//# sourceMappingURL=grid-cell-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-cell-editor.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/interfaces/grid-cell-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,WAAW,cAAc,CAAC,MAAM,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO;IAC9D;;;OAGG;IACH,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAE3B;;;OAGG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAE9B;;;OAGG;IACH,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAEjC;;;OAGG;IACH,MAAM,EAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,kDAAuD,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { InjectionToken, InputSignal } from '@angular/core';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for Angular components used as cell renderers in the grid.
|
|
4
|
+
*
|
|
5
|
+
* Components implementing this interface can be used inside `<tbw-grid-column-view>`
|
|
6
|
+
* and will automatically receive cell data via inputs.
|
|
7
|
+
*
|
|
8
|
+
* ## Usage
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { Component, input } from '@angular/core';
|
|
12
|
+
* import { GridCellRenderer, GRID_CELL_RENDERER } from '@toolbox-web/grid-angular';
|
|
13
|
+
*
|
|
14
|
+
* @Component({
|
|
15
|
+
* selector: 'app-status-badge',
|
|
16
|
+
* template: `<span [class]="value()">{{ value() }}</span>`,
|
|
17
|
+
* providers: [{ provide: GRID_CELL_RENDERER, useExisting: StatusBadgeComponent }]
|
|
18
|
+
* })
|
|
19
|
+
* export class StatusBadgeComponent implements GridCellRenderer {
|
|
20
|
+
* value = input.required<string>();
|
|
21
|
+
* row = input<unknown>();
|
|
22
|
+
* column = input<unknown>();
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Then use in your template:
|
|
27
|
+
* ```html
|
|
28
|
+
* <tbw-grid-column field="status">
|
|
29
|
+
* <tbw-grid-column-view>
|
|
30
|
+
* <app-status-badge />
|
|
31
|
+
* </tbw-grid-column-view>
|
|
32
|
+
* </tbw-grid-column>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export interface GridCellRenderer<TValue = unknown, TRow = unknown> {
|
|
36
|
+
/**
|
|
37
|
+
* The cell value for this column.
|
|
38
|
+
* This is automatically set by the grid adapter.
|
|
39
|
+
*/
|
|
40
|
+
value: InputSignal<TValue>;
|
|
41
|
+
/**
|
|
42
|
+
* The full row data object.
|
|
43
|
+
* Optional - only needed if your renderer needs access to other columns.
|
|
44
|
+
*/
|
|
45
|
+
row?: InputSignal<TRow>;
|
|
46
|
+
/**
|
|
47
|
+
* The column configuration object.
|
|
48
|
+
* Optional - only needed if your renderer needs column metadata.
|
|
49
|
+
*/
|
|
50
|
+
column?: InputSignal<unknown>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Injection token for cell renderer components.
|
|
54
|
+
*
|
|
55
|
+
* Components must provide themselves with this token to be auto-discovered:
|
|
56
|
+
* ```typescript
|
|
57
|
+
* @Component({
|
|
58
|
+
* providers: [{ provide: GRID_CELL_RENDERER, useExisting: MyRendererComponent }]
|
|
59
|
+
* })
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare const GRID_CELL_RENDERER: InjectionToken<GridCellRenderer<unknown, unknown>>;
|
|
63
|
+
//# sourceMappingURL=grid-cell-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-cell-renderer.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/interfaces/grid-cell-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,gBAAgB,CAAC,MAAM,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO;IAChE;;;OAGG;IACH,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAE3B;;;OAGG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,oDAA2D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { GRID_CELL_EDITOR } from './grid-cell-editor';
|
|
2
|
+
export type { GridCellEditor } from './grid-cell-editor';
|
|
3
|
+
export { GRID_CELL_RENDERER } from './grid-cell-renderer';
|
|
4
|
+
export type { GridCellRenderer } from './grid-cell-renderer';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../libs/grid-angular/src/lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@toolbox-web/grid-angular",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Angular adapter for @toolbox-web/grid data grid component",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"angular",
|
|
19
|
+
"data-grid",
|
|
20
|
+
"web-component",
|
|
21
|
+
"toolbox-web"
|
|
22
|
+
],
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "Oystein Amundsen",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/OysteinAmundsen/toolbox.git",
|
|
28
|
+
"directory": "libs/grid-angular"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/OysteinAmundsen/toolbox/tree/main/libs/grid-angular#readme",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/OysteinAmundsen/toolbox/issues"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@angular/common": "^21.0.0",
|
|
40
|
+
"@angular/compiler": "^21.0.0",
|
|
41
|
+
"@angular/core": "^21.0.0",
|
|
42
|
+
"@angular/forms": "^21.0.0",
|
|
43
|
+
"@angular/platform-browser": "^21.0.0",
|
|
44
|
+
"@angular/build": "^21.0.4",
|
|
45
|
+
"@angular/cli": "^21.0.4",
|
|
46
|
+
"@angular/compiler-cli": "^21.0.0",
|
|
47
|
+
"@toolbox-web/grid": ">=0.2.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@angular/core": ">=17.0.0",
|
|
51
|
+
"@toolbox-web/grid": ">=0.2.0"
|
|
52
|
+
}
|
|
53
|
+
}
|