@zengrid/angular 1.2.0 → 1.2.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.
@@ -0,0 +1,1441 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, TemplateRef, Directive, input, contentChild, Component, ApplicationRef, Injector, EnvironmentInjector, createComponent, Injectable, InjectionToken, PLATFORM_ID, ChangeDetectorRef, NgZone, DestroyRef, viewChild, contentChildren, model, output, afterNextRender, effect, ChangeDetectionStrategy, forwardRef, signal } from '@angular/core';
3
+ import { isPlatformBrowser } from '@angular/common';
4
+ import { Grid } from '@zengrid/core';
5
+ export { ARIAManager, AdvancedCellRenderer, AutoFitCalculator, ButtonRenderer, CSVExporter, CheckboxEditor, CheckboxHeaderRenderer, CheckboxRenderer, ChipRenderer, ClipboardManager, ColumnDragCommand, ColumnDragManager, ColumnGroupManager, ColumnGroupModel, ColumnGroupRenderer, ColumnModel, ColumnPinPlugin, ColumnReorderPlugin, ColumnResizeManager, ColumnStore, ColumnVisibilityPlugin, GridStore as CoreGridStore, DateEditor, DatePickerRenderer, DateRangeEditor, DateRangeRenderer, DateRenderer, DateTimeEditor, DateTimePickerRenderer, DateTimeRenderer, DependencyGraph, DragKeyboardHandler, DragTouchHandler, DragVisualFeedback, DropdownEditor, DropdownRenderer, EditorManager, EventEmitter, FilterableHeaderRenderer, FocusManager, GridApiImpl, IconHeaderRenderer, ImageRenderer, KeyboardNavigator, LinkRenderer, MultiColumnSorter, NumberRenderer, PipelineRegistry, PluginHost, ProgressBarRenderer, RendererRegistry, ResizeHandleRenderer, ResizePreview, ScrollModel, SelectRenderer, SingleColumnSorter, SortStateManager, SortableHeaderRenderer, SparseMatrix, TextEditor, TextHeaderRenderer, TextRenderer, ThemeBuilder, TimeEditor, TimePickerRenderer, TimeRenderer, ViewportModel, alpha, applyTheme, containsCell, createAsyncFilterPlugin, createAsyncSortPlugin, createColumnGroupRenderer, createCorePlugin, createDatePickerRenderer, createDateTimePickerRenderer, createDateTimeRenderer, createDevToolsConnector, createEditingPlugin, createFilterPlugin, createHitTester, createIdentityIndexMap, createIndexMap, createLifecyclePlugin, createSelectionPlugin, createSortPlugin, createTheme, createTimePickerRenderer, createTimeRenderer, createUndoRedoPlugin, darkTheme, darken, draculaTheme, formatDate, formatDateForDisplay, formatDateRange, formatDateTime, formatTime, getAllThemes, getTheme, githubTheme, hasTheme, isDateInRange, isValidDate, lightTheme, lighten, listThemes, materialTheme, mergeRanges, nordTheme, normalizeRange, oneDarkTheme, parseDate, parseDateTime, parseTime, rangesIntersect, registerTheme, removeTheme, setDatetimeTheme, setDatetimeThemeConfig, solarizedTheme, themeToCSSVariables, unregisterTheme } from '@zengrid/core';
6
+ import { resolveOperationMode } from '@zengrid/shared';
7
+ import { NG_VALUE_ACCESSOR } from '@angular/forms';
8
+
9
+ const EVENT_MAP = {
10
+ // Cell events
11
+ 'cell:click': 'cellClick',
12
+ 'cell:doubleClick': 'cellDoubleClick',
13
+ 'cell:contextMenu': 'cellContextMenu',
14
+ 'cell:change': 'cellChange',
15
+ 'cell:beforeChange': 'cellBeforeChange',
16
+ 'cell:afterChange': 'cellAfterChange',
17
+ // Selection events
18
+ 'selection:change': 'selectionChange',
19
+ 'selection:start': 'selectionStart',
20
+ 'selection:end': 'selectionEnd',
21
+ // Editing events
22
+ 'edit:start': 'editStart',
23
+ 'edit:end': 'editEnd',
24
+ 'edit:commit': 'editCommit',
25
+ 'edit:cancel': 'editCancel',
26
+ // Scroll events
27
+ 'scroll': 'scroll',
28
+ 'scroll:start': 'scrollStart',
29
+ 'scroll:end': 'scrollEnd',
30
+ // Sort events
31
+ 'sort:change': 'sortChange',
32
+ 'sort:beforeSort': 'sortBeforeSort',
33
+ 'sort:afterSort': 'sortAfterSort',
34
+ // Filter events
35
+ 'filter:change': 'filterChange',
36
+ 'filter:beforeFilter': 'filterBeforeFilter',
37
+ 'filter:afterFilter': 'filterAfterFilter',
38
+ 'filter:export': 'filterExport',
39
+ 'filter:start': 'filterStart',
40
+ 'filter:end': 'filterEnd',
41
+ 'filter:error': 'filterError',
42
+ 'filter:clear': 'filterClear',
43
+ // Focus events
44
+ 'focus:change': 'focusChange',
45
+ 'focus:in': 'focusIn',
46
+ 'focus:out': 'focusOut',
47
+ // Keyboard events
48
+ 'key:down': 'keyDown',
49
+ 'key:up': 'keyUp',
50
+ 'key:press': 'keyPress',
51
+ // Column events
52
+ 'column:resize': 'columnResize',
53
+ 'column:move': 'columnMove',
54
+ 'column:hide': 'columnHide',
55
+ 'column:show': 'columnShow',
56
+ 'column:dragStart': 'columnDragStart',
57
+ 'column:drag': 'columnDrag',
58
+ 'column:dragEnd': 'columnDragEnd',
59
+ 'column:dragCancel': 'columnDragCancel',
60
+ // Header events
61
+ 'header:click': 'headerClick',
62
+ 'header:doubleClick': 'headerDoubleClick',
63
+ 'header:contextMenu': 'headerContextMenu',
64
+ 'header:hover': 'headerHover',
65
+ 'header:sort:click': 'headerSortClick',
66
+ 'header:filter:click': 'headerFilterClick',
67
+ 'header:checkbox:change': 'headerCheckboxChange',
68
+ // Lifecycle events
69
+ 'render:start': 'renderStart',
70
+ 'render:end': 'renderEnd',
71
+ 'data:load': 'dataLoad',
72
+ 'data:change': 'dataChange',
73
+ 'loading:start': 'loadingStart',
74
+ 'loading:end': 'loadingEnd',
75
+ 'loading:progress': 'loadingProgress',
76
+ // Undo/Redo events
77
+ 'undo-redo:change': 'undoRedoChange',
78
+ // Destroy
79
+ 'destroy': 'gridDestroy',
80
+ // Error events
81
+ 'error': 'gridError',
82
+ 'warning': 'gridWarning',
83
+ // Row events
84
+ 'row:insert': 'rowInsert',
85
+ 'row:delete': 'rowDelete',
86
+ 'row:move': 'rowMove',
87
+ // Clipboard events
88
+ 'copy': 'copy',
89
+ 'cut': 'cut',
90
+ 'paste': 'paste',
91
+ };
92
+
93
+ class ZenCellTemplateDirective {
94
+ templateRef = inject((TemplateRef));
95
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenCellTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
96
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.5", type: ZenCellTemplateDirective, isStandalone: true, selector: "[zenCellTemplate]", ngImport: i0 });
97
+ }
98
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenCellTemplateDirective, decorators: [{
99
+ type: Directive,
100
+ args: [{
101
+ selector: '[zenCellTemplate]',
102
+ standalone: true,
103
+ }]
104
+ }] });
105
+
106
+ class ZenEditorTemplateDirective {
107
+ templateRef = inject((TemplateRef));
108
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenEditorTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
109
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.5", type: ZenEditorTemplateDirective, isStandalone: true, selector: "[zenEditorTemplate]", ngImport: i0 });
110
+ }
111
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenEditorTemplateDirective, decorators: [{
112
+ type: Directive,
113
+ args: [{
114
+ selector: '[zenEditorTemplate]',
115
+ standalone: true,
116
+ }]
117
+ }] });
118
+
119
+ class ZenHeaderTemplateDirective {
120
+ templateRef = inject((TemplateRef));
121
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenHeaderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
122
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.5", type: ZenHeaderTemplateDirective, isStandalone: true, selector: "[zenHeaderTemplate]", ngImport: i0 });
123
+ }
124
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenHeaderTemplateDirective, decorators: [{
125
+ type: Directive,
126
+ args: [{
127
+ selector: '[zenHeaderTemplate]',
128
+ standalone: true,
129
+ }]
130
+ }] });
131
+
132
+ class ZenColumnComponent {
133
+ field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
134
+ header = input.required(...(ngDevMode ? [{ debugName: "header" }] : []));
135
+ width = input(undefined, ...(ngDevMode ? [{ debugName: "width" }] : []));
136
+ renderer = input(undefined, ...(ngDevMode ? [{ debugName: "renderer" }] : []));
137
+ sortable = input(undefined, ...(ngDevMode ? [{ debugName: "sortable" }] : []));
138
+ editable = input(undefined, ...(ngDevMode ? [{ debugName: "editable" }] : []));
139
+ editor = input(undefined, ...(ngDevMode ? [{ debugName: "editor" }] : []));
140
+ editorOptions = input(undefined, ...(ngDevMode ? [{ debugName: "editorOptions" }] : []));
141
+ filterable = input(undefined, ...(ngDevMode ? [{ debugName: "filterable" }] : []));
142
+ resizable = input(undefined, ...(ngDevMode ? [{ debugName: "resizable" }] : []));
143
+ reorderable = input(undefined, ...(ngDevMode ? [{ debugName: "reorderable" }] : []));
144
+ minWidth = input(undefined, ...(ngDevMode ? [{ debugName: "minWidth" }] : []));
145
+ maxWidth = input(undefined, ...(ngDevMode ? [{ debugName: "maxWidth" }] : []));
146
+ overflow = input(undefined, ...(ngDevMode ? [{ debugName: "overflow" }] : []));
147
+ autoHeight = input(undefined, ...(ngDevMode ? [{ debugName: "autoHeight" }] : []));
148
+ id = input(undefined, ...(ngDevMode ? [{ debugName: "id" }] : []));
149
+ cellTemplate = contentChild(ZenCellTemplateDirective, ...(ngDevMode ? [{ debugName: "cellTemplate" }] : []));
150
+ editorTemplate = contentChild(ZenEditorTemplateDirective, ...(ngDevMode ? [{ debugName: "editorTemplate" }] : []));
151
+ headerTemplate = contentChild(ZenHeaderTemplateDirective, ...(ngDevMode ? [{ debugName: "headerTemplate" }] : []));
152
+ toColumnDef(bridge) {
153
+ const def = {
154
+ field: this.field(),
155
+ header: this.header(),
156
+ };
157
+ const colId = this.id();
158
+ const w = this.width();
159
+ const sort = this.sortable();
160
+ const edit = this.editable();
161
+ const edOpts = this.editorOptions();
162
+ const filter = this.filterable();
163
+ const resize = this.resizable();
164
+ const reorder = this.reorderable();
165
+ const minW = this.minWidth();
166
+ const maxW = this.maxWidth();
167
+ const ov = this.overflow();
168
+ const autoH = this.autoHeight();
169
+ if (colId !== undefined)
170
+ def.id = colId;
171
+ if (w !== undefined)
172
+ def.width = w;
173
+ if (sort !== undefined)
174
+ def.sortable = sort;
175
+ if (edit !== undefined)
176
+ def.editable = edit;
177
+ if (edOpts !== undefined)
178
+ def.editorOptions = edOpts;
179
+ if (filter !== undefined)
180
+ def.filterable = filter;
181
+ if (resize !== undefined)
182
+ def.resizable = resize;
183
+ if (reorder !== undefined)
184
+ def.reorderable = reorder;
185
+ if (minW !== undefined)
186
+ def.minWidth = minW;
187
+ if (maxW !== undefined)
188
+ def.maxWidth = maxW;
189
+ if (ov !== undefined)
190
+ def.overflow = ov;
191
+ if (autoH !== undefined)
192
+ def.autoHeight = autoH;
193
+ // Resolve renderer: template > component/renderer input > none
194
+ const cellTpl = this.cellTemplate();
195
+ const rendererInput = this.renderer();
196
+ if (cellTpl) {
197
+ def.renderer = bridge.createTemplateRenderer(cellTpl.templateRef);
198
+ }
199
+ else if (rendererInput !== undefined) {
200
+ if (typeof rendererInput === 'string') {
201
+ def.renderer = rendererInput;
202
+ }
203
+ else if ('render' in rendererInput && typeof rendererInput.render === 'function') {
204
+ def.renderer = rendererInput;
205
+ }
206
+ else {
207
+ // It's a Component type
208
+ def.renderer = bridge.createComponentRenderer(rendererInput);
209
+ }
210
+ }
211
+ // Resolve editor: template > component/editor input > none
212
+ const edTpl = this.editorTemplate();
213
+ const editorInput = this.editor();
214
+ if (edTpl) {
215
+ def.editor = bridge.createTemplateEditor(edTpl.templateRef);
216
+ }
217
+ else if (editorInput !== undefined) {
218
+ if (typeof editorInput === 'string') {
219
+ def.editor = editorInput;
220
+ }
221
+ else if ('init' in editorInput && typeof editorInput.init === 'function') {
222
+ def.editor = editorInput;
223
+ }
224
+ else {
225
+ def.editor = bridge.createComponentEditor(editorInput);
226
+ }
227
+ }
228
+ return def;
229
+ }
230
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
231
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.5", type: ZenColumnComponent, isStandalone: true, selector: "zen-column", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, renderer: { classPropertyName: "renderer", publicName: "renderer", isSignal: true, isRequired: false, transformFunction: null }, sortable: { classPropertyName: "sortable", publicName: "sortable", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, editor: { classPropertyName: "editor", publicName: "editor", isSignal: true, isRequired: false, transformFunction: null }, editorOptions: { classPropertyName: "editorOptions", publicName: "editorOptions", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, reorderable: { classPropertyName: "reorderable", publicName: "reorderable", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, overflow: { classPropertyName: "overflow", publicName: "overflow", isSignal: true, isRequired: false, transformFunction: null }, autoHeight: { classPropertyName: "autoHeight", publicName: "autoHeight", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "cellTemplate", first: true, predicate: ZenCellTemplateDirective, descendants: true, isSignal: true }, { propertyName: "editorTemplate", first: true, predicate: ZenEditorTemplateDirective, descendants: true, isSignal: true }, { propertyName: "headerTemplate", first: true, predicate: ZenHeaderTemplateDirective, descendants: true, isSignal: true }], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
232
+ }
233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenColumnComponent, decorators: [{
234
+ type: Component,
235
+ args: [{
236
+ selector: 'zen-column',
237
+ standalone: true,
238
+ template: `<ng-content></ng-content>`,
239
+ }]
240
+ }], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], renderer: [{ type: i0.Input, args: [{ isSignal: true, alias: "renderer", required: false }] }], sortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortable", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], editor: [{ type: i0.Input, args: [{ isSignal: true, alias: "editor", required: false }] }], editorOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "editorOptions", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], reorderable: [{ type: i0.Input, args: [{ isSignal: true, alias: "reorderable", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], overflow: [{ type: i0.Input, args: [{ isSignal: true, alias: "overflow", required: false }] }], autoHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoHeight", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], cellTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ZenCellTemplateDirective), { isSignal: true }] }], editorTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ZenEditorTemplateDirective), { isSignal: true }] }], headerTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ZenHeaderTemplateDirective), { isSignal: true }] }] } });
241
+
242
+ const MAX_POOL_SIZE = 100;
243
+ class TemplateBridgeService {
244
+ appRef = inject(ApplicationRef);
245
+ injector = inject(Injector);
246
+ envInjector = inject(EnvironmentInjector);
247
+ templatePools = new Map();
248
+ componentPools = new Map();
249
+ createTemplateRenderer(templateRef) {
250
+ return new TemplateRendererBridge(this, templateRef);
251
+ }
252
+ createComponentRenderer(componentType) {
253
+ return new ComponentRendererBridge(this, componentType);
254
+ }
255
+ createTemplateEditor(templateRef) {
256
+ return new TemplateEditorBridge(this, templateRef);
257
+ }
258
+ createComponentEditor(componentType) {
259
+ return new ComponentEditorBridge(this, componentType);
260
+ }
261
+ acquireView(templateRef, context) {
262
+ let pool = this.templatePools.get(templateRef);
263
+ if (!pool) {
264
+ pool = [];
265
+ this.templatePools.set(templateRef, pool);
266
+ }
267
+ // Find a pooled view not in use
268
+ const pooled = pool.find(p => !p.inUse);
269
+ if (pooled) {
270
+ pooled.inUse = true;
271
+ // Update context
272
+ Object.assign(pooled.viewRef.context, context);
273
+ pooled.viewRef.detectChanges();
274
+ return pooled.viewRef;
275
+ }
276
+ // Create new
277
+ const viewRef = templateRef.createEmbeddedView(context);
278
+ this.appRef.attachView(viewRef);
279
+ if (pool.length < MAX_POOL_SIZE) {
280
+ pool.push({ viewRef, inUse: true });
281
+ }
282
+ return viewRef;
283
+ }
284
+ releaseView(templateRef, viewRef) {
285
+ const pool = this.templatePools.get(templateRef);
286
+ if (!pool)
287
+ return;
288
+ const pooled = pool.find(p => p.viewRef === viewRef);
289
+ if (pooled) {
290
+ pooled.inUse = false;
291
+ // Detach root nodes from DOM
292
+ for (const node of viewRef.rootNodes) {
293
+ node.remove?.();
294
+ }
295
+ }
296
+ else {
297
+ this.appRef.detachView(viewRef);
298
+ viewRef.destroy();
299
+ }
300
+ }
301
+ acquireComponent(componentType, hostElement) {
302
+ let pool = this.componentPools.get(componentType);
303
+ if (!pool) {
304
+ pool = [];
305
+ this.componentPools.set(componentType, pool);
306
+ }
307
+ const pooled = pool.find(p => !p.inUse);
308
+ if (pooled) {
309
+ pooled.inUse = true;
310
+ hostElement.appendChild(pooled.componentRef.hostView.rootNodes[0]);
311
+ return pooled.componentRef;
312
+ }
313
+ const componentRef = createComponent(componentType, {
314
+ environmentInjector: this.envInjector,
315
+ elementInjector: this.injector,
316
+ hostElement,
317
+ });
318
+ this.appRef.attachView(componentRef.hostView);
319
+ if (pool.length < MAX_POOL_SIZE) {
320
+ pool.push({ componentRef, inUse: true });
321
+ }
322
+ return componentRef;
323
+ }
324
+ releaseComponent(componentType, componentRef) {
325
+ const pool = this.componentPools.get(componentType);
326
+ if (!pool)
327
+ return;
328
+ const pooled = pool.find(p => p.componentRef === componentRef);
329
+ if (pooled) {
330
+ pooled.inUse = false;
331
+ const rootNode = componentRef.hostView.rootNodes[0];
332
+ rootNode?.remove?.();
333
+ }
334
+ else {
335
+ componentRef.destroy();
336
+ }
337
+ }
338
+ destroyAll() {
339
+ for (const pool of this.templatePools.values()) {
340
+ for (const { viewRef } of pool) {
341
+ this.appRef.detachView(viewRef);
342
+ viewRef.destroy();
343
+ }
344
+ }
345
+ this.templatePools.clear();
346
+ for (const pool of this.componentPools.values()) {
347
+ for (const { componentRef } of pool) {
348
+ componentRef.destroy();
349
+ }
350
+ }
351
+ this.componentPools.clear();
352
+ }
353
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TemplateBridgeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
354
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TemplateBridgeService, providedIn: 'root' });
355
+ }
356
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: TemplateBridgeService, decorators: [{
357
+ type: Injectable,
358
+ args: [{ providedIn: 'root' }]
359
+ }] });
360
+ class TemplateRendererBridge {
361
+ bridge;
362
+ templateRef;
363
+ activeViews = new Map();
364
+ constructor(bridge, templateRef) {
365
+ this.bridge = bridge;
366
+ this.templateRef = templateRef;
367
+ }
368
+ render(element, params) {
369
+ const context = {
370
+ $implicit: params.value,
371
+ value: params.value,
372
+ cell: params.cell,
373
+ row: params.rowData,
374
+ column: params.column,
375
+ isSelected: params.isSelected,
376
+ };
377
+ const viewRef = this.bridge.acquireView(this.templateRef, context);
378
+ for (const node of viewRef.rootNodes) {
379
+ element.appendChild(node);
380
+ }
381
+ this.activeViews.set(element, viewRef);
382
+ }
383
+ update(element, params) {
384
+ const viewRef = this.activeViews.get(element);
385
+ if (!viewRef) {
386
+ this.render(element, params);
387
+ return;
388
+ }
389
+ const ctx = viewRef.context;
390
+ ctx.$implicit = params.value;
391
+ ctx.value = params.value;
392
+ ctx.cell = params.cell;
393
+ ctx.row = params.rowData;
394
+ ctx.column = params.column;
395
+ ctx.isSelected = params.isSelected;
396
+ viewRef.detectChanges();
397
+ }
398
+ destroy(element) {
399
+ const viewRef = this.activeViews.get(element);
400
+ if (viewRef) {
401
+ this.bridge.releaseView(this.templateRef, viewRef);
402
+ this.activeViews.delete(element);
403
+ }
404
+ }
405
+ }
406
+ class ComponentRendererBridge {
407
+ bridge;
408
+ componentType;
409
+ activeComponents = new Map();
410
+ constructor(bridge, componentType) {
411
+ this.bridge = bridge;
412
+ this.componentType = componentType;
413
+ }
414
+ render(element, params) {
415
+ const componentRef = this.bridge.acquireComponent(this.componentType, element);
416
+ componentRef.setInput('params', params);
417
+ componentRef.changeDetectorRef.detectChanges();
418
+ this.activeComponents.set(element, componentRef);
419
+ }
420
+ update(element, params) {
421
+ const componentRef = this.activeComponents.get(element);
422
+ if (!componentRef) {
423
+ this.render(element, params);
424
+ return;
425
+ }
426
+ componentRef.setInput('params', params);
427
+ componentRef.changeDetectorRef.detectChanges();
428
+ }
429
+ destroy(element) {
430
+ const componentRef = this.activeComponents.get(element);
431
+ if (componentRef) {
432
+ this.bridge.releaseComponent(this.componentType, componentRef);
433
+ this.activeComponents.delete(element);
434
+ }
435
+ }
436
+ }
437
+ class TemplateEditorBridge {
438
+ bridge;
439
+ templateRef;
440
+ viewRef = null;
441
+ currentValue = null;
442
+ onCompleteFn = null;
443
+ constructor(bridge, templateRef) {
444
+ this.bridge = bridge;
445
+ this.templateRef = templateRef;
446
+ }
447
+ init(container, value, params) {
448
+ this.currentValue = value;
449
+ this.onCompleteFn = params.onComplete ?? null;
450
+ const context = {
451
+ $implicit: value,
452
+ value,
453
+ cell: params.cell,
454
+ onComplete: (v) => {
455
+ this.currentValue = v;
456
+ this.onCompleteFn?.(v, false);
457
+ },
458
+ onChange: (v) => {
459
+ this.currentValue = v;
460
+ params.onChange?.(v);
461
+ },
462
+ };
463
+ this.viewRef = this.bridge.acquireView(this.templateRef, context);
464
+ for (const node of this.viewRef.rootNodes) {
465
+ container.appendChild(node);
466
+ }
467
+ }
468
+ getValue() {
469
+ return this.currentValue;
470
+ }
471
+ focus() {
472
+ if (!this.viewRef)
473
+ return;
474
+ const firstInput = this.viewRef.rootNodes
475
+ .find((n) => n.querySelector?.('input,select,textarea'));
476
+ firstInput?.querySelector?.('input,select,textarea')?.focus();
477
+ }
478
+ destroy() {
479
+ if (this.viewRef) {
480
+ this.bridge.releaseView(this.templateRef, this.viewRef);
481
+ this.viewRef = null;
482
+ }
483
+ }
484
+ }
485
+ class ComponentEditorBridge {
486
+ bridge;
487
+ componentType;
488
+ componentRef = null;
489
+ currentValue = null;
490
+ constructor(bridge, componentType) {
491
+ this.bridge = bridge;
492
+ this.componentType = componentType;
493
+ }
494
+ init(container, value, params) {
495
+ this.currentValue = value;
496
+ this.componentRef = this.bridge.acquireComponent(this.componentType, container);
497
+ this.componentRef.setInput('value', value);
498
+ this.componentRef.setInput('params', params);
499
+ this.componentRef.setInput('onComplete', (v) => {
500
+ this.currentValue = v;
501
+ params.onComplete?.(v, false);
502
+ });
503
+ this.componentRef.setInput('onChange', (v) => {
504
+ this.currentValue = v;
505
+ params.onChange?.(v);
506
+ });
507
+ this.componentRef.changeDetectorRef.detectChanges();
508
+ }
509
+ getValue() {
510
+ return this.currentValue;
511
+ }
512
+ focus() {
513
+ const hostEl = this.componentRef?.location?.nativeElement;
514
+ hostEl?.querySelector?.('input,select,textarea')?.focus();
515
+ }
516
+ destroy() {
517
+ if (this.componentRef) {
518
+ this.bridge.releaseComponent(this.componentType, this.componentRef);
519
+ this.componentRef = null;
520
+ }
521
+ }
522
+ }
523
+
524
+ const ZEN_GRID_CONFIG = new InjectionToken('ZenGridConfig');
525
+ function provideZenGrid(config) {
526
+ return {
527
+ provide: ZEN_GRID_CONFIG,
528
+ useValue: config,
529
+ };
530
+ }
531
+
532
+ class ZenGridComponent {
533
+ platformId = inject(PLATFORM_ID);
534
+ cdr = inject(ChangeDetectorRef);
535
+ ngZone = inject(NgZone);
536
+ destroyRef = inject(DestroyRef);
537
+ templateBridge = inject(TemplateBridgeService);
538
+ globalConfig = inject(ZEN_GRID_CONFIG, { optional: true });
539
+ _isBrowser = isPlatformBrowser(this.platformId);
540
+ get placeholderHeight() {
541
+ const rowHeight = this.getResolvedRowHeight();
542
+ const height = typeof rowHeight === 'number' ? rowHeight : 30;
543
+ return this.rowCount() * height;
544
+ }
545
+ gridContainerRef = viewChild('gridContainer', ...(ngDevMode ? [{ debugName: "gridContainerRef" }] : []));
546
+ columnChildren = contentChildren(ZenColumnComponent, ...(ngDevMode ? [{ debugName: "columnChildren" }] : []));
547
+ grid = null;
548
+ gridReady = false;
549
+ warnedOnLegacyBackendCallbacks = false;
550
+ explicitInputs = new Set();
551
+ pendingModelDataSync = null;
552
+ // Legacy sort/filter backend callbacks are kept as wrapper inputs for
553
+ // template compatibility, but the unified core contract only supports
554
+ // onDataRequest.
555
+ static legacyBackendCallbackWarning = '[zen-grid] onSortRequest/onFilterRequest are deprecated. Use onDataRequest with the unified query contract instead.';
556
+ // --- Core Inputs ---
557
+ rowCount = input.required(...(ngDevMode ? [{ debugName: "rowCount" }] : []));
558
+ colCount = input.required(...(ngDevMode ? [{ debugName: "colCount" }] : []));
559
+ rowHeight = input(30, { ...(ngDevMode ? { debugName: "rowHeight" } : {}), transform: (value) => this.markExplicitInput('rowHeight', value) });
560
+ colWidth = input(100, { ...(ngDevMode ? { debugName: "colWidth" } : {}), transform: (value) => this.markExplicitInput('colWidth', value) });
561
+ columns = input([], { ...(ngDevMode ? { debugName: "columns" } : {}), transform: (value) => this.markExplicitInput('columns', value) });
562
+ // --- Feature Inputs ---
563
+ enableSelection = input(undefined, ...(ngDevMode ? [{ debugName: "enableSelection" }] : []));
564
+ enableMultiSelection = input(undefined, ...(ngDevMode ? [{ debugName: "enableMultiSelection" }] : []));
565
+ selectionType = input(undefined, ...(ngDevMode ? [{ debugName: "selectionType" }] : []));
566
+ enableColumnResize = input(undefined, ...(ngDevMode ? [{ debugName: "enableColumnResize" }] : []));
567
+ enableColumnDrag = input(undefined, ...(ngDevMode ? [{ debugName: "enableColumnDrag" }] : []));
568
+ enableKeyboardNavigation = input(undefined, ...(ngDevMode ? [{ debugName: "enableKeyboardNavigation" }] : []));
569
+ enableA11y = input(undefined, ...(ngDevMode ? [{ debugName: "enableA11y" }] : []));
570
+ enableCellPooling = input(undefined, ...(ngDevMode ? [{ debugName: "enableCellPooling" }] : []));
571
+ // --- Mode Inputs ---
572
+ dataMode = input(undefined, ...(ngDevMode ? [{ debugName: "dataMode" }] : []));
573
+ sortMode = input(undefined, ...(ngDevMode ? [{ debugName: "sortMode" }] : []));
574
+ filterMode = input(undefined, ...(ngDevMode ? [{ debugName: "filterMode" }] : []));
575
+ // --- Backend Callback Inputs ---
576
+ onDataRequest = input(undefined, ...(ngDevMode ? [{ debugName: "onDataRequest" }] : []));
577
+ onSortRequest = input(undefined, ...(ngDevMode ? [{ debugName: "onSortRequest" }] : []));
578
+ onFilterRequest = input(undefined, ...(ngDevMode ? [{ debugName: "onFilterRequest" }] : []));
579
+ onLoadMoreRows = input(undefined, ...(ngDevMode ? [{ debugName: "onLoadMoreRows" }] : []));
580
+ // --- Config Object Inputs ---
581
+ pagination = input(undefined, ...(ngDevMode ? [{ debugName: "pagination" }] : []));
582
+ loading = input(undefined, ...(ngDevMode ? [{ debugName: "loading" }] : []));
583
+ infiniteScrolling = input(undefined, ...(ngDevMode ? [{ debugName: "infiniteScrolling" }] : []));
584
+ rowHeightMode = input(undefined, ...(ngDevMode ? [{ debugName: "rowHeightMode" }] : []));
585
+ rowHeightConfig = input(undefined, ...(ngDevMode ? [{ debugName: "rowHeightConfig" }] : []));
586
+ columnResize = input(undefined, ...(ngDevMode ? [{ debugName: "columnResize" }] : []));
587
+ columnDrag = input(undefined, ...(ngDevMode ? [{ debugName: "columnDrag" }] : []));
588
+ cellOverflow = input(undefined, ...(ngDevMode ? [{ debugName: "cellOverflow" }] : []));
589
+ autoResize = input(undefined, ...(ngDevMode ? [{ debugName: "autoResize" }] : []));
590
+ overscanRows = input(undefined, ...(ngDevMode ? [{ debugName: "overscanRows" }] : []));
591
+ overscanCols = input(undefined, ...(ngDevMode ? [{ debugName: "overscanCols" }] : []));
592
+ sortIcons = input(undefined, ...(ngDevMode ? [{ debugName: "sortIcons" }] : []));
593
+ rendererCache = input(undefined, ...(ngDevMode ? [{ debugName: "rendererCache" }] : []));
594
+ // --- Callback Inputs (GridOptions event callbacks) ---
595
+ onScrollCallback = input(undefined, ...(ngDevMode ? [{ debugName: "onScrollCallback" }] : []));
596
+ onCellClickCallback = input(undefined, ...(ngDevMode ? [{ debugName: "onCellClickCallback" }] : []));
597
+ onCellDoubleClickCallback = input(undefined, ...(ngDevMode ? [{ debugName: "onCellDoubleClickCallback" }] : []));
598
+ onCellContextMenuCallback = input(undefined, ...(ngDevMode ? [{ debugName: "onCellContextMenuCallback" }] : []));
599
+ onSelectionChangeCallback = input(undefined, ...(ngDevMode ? [{ debugName: "onSelectionChangeCallback" }] : []));
600
+ onPageChangeCallback = input(undefined, ...(ngDevMode ? [{ debugName: "onPageChangeCallback" }] : []));
601
+ onColumnWidthsChangeCallback = input(undefined, ...(ngDevMode ? [{ debugName: "onColumnWidthsChangeCallback" }] : []));
602
+ // --- Plugin Input ---
603
+ plugins = input([], ...(ngDevMode ? [{ debugName: "plugins" }] : []));
604
+ // --- Two-way Model Signals ---
605
+ data = model([], ...(ngDevMode ? [{ debugName: "data" }] : []));
606
+ selection = model([], ...(ngDevMode ? [{ debugName: "selection" }] : []));
607
+ sortState = model([], ...(ngDevMode ? [{ debugName: "sortState" }] : []));
608
+ filterState = model([], ...(ngDevMode ? [{ debugName: "filterState" }] : []));
609
+ currentPage = model(1, ...(ngDevMode ? [{ debugName: "currentPage" }] : []));
610
+ // --- Cell Events ---
611
+ cellClick = output();
612
+ cellDoubleClick = output();
613
+ cellContextMenu = output();
614
+ cellChange = output();
615
+ cellBeforeChange = output();
616
+ cellAfterChange = output();
617
+ // --- Selection Events ---
618
+ selectionChangeEvent = output({ alias: 'selectionChanged' });
619
+ selectionStart = output();
620
+ selectionEnd = output();
621
+ // --- Editing Events ---
622
+ editStart = output();
623
+ editEnd = output();
624
+ editCommit = output();
625
+ editCancel = output();
626
+ // --- Scroll Events ---
627
+ scroll = output();
628
+ scrollStart = output();
629
+ scrollEnd = output();
630
+ // --- Sort Events ---
631
+ sortChange = output();
632
+ sortBeforeSort = output();
633
+ sortAfterSort = output();
634
+ // --- Filter Events ---
635
+ filterChange = output();
636
+ filterBeforeFilter = output();
637
+ filterAfterFilter = output();
638
+ filterExport = output();
639
+ filterStart = output();
640
+ filterEnd = output();
641
+ filterError = output();
642
+ filterClear = output();
643
+ // --- Focus Events ---
644
+ focusChange = output();
645
+ focusIn = output();
646
+ focusOut = output();
647
+ // --- Keyboard Events ---
648
+ keyDown = output();
649
+ keyUp = output();
650
+ keyPress = output();
651
+ // --- Column Events ---
652
+ columnResizeEvent = output({ alias: 'columnResize' });
653
+ columnMove = output();
654
+ columnHide = output();
655
+ columnShow = output();
656
+ columnDragStart = output();
657
+ columnDragEvent = output({ alias: 'columnDrag' });
658
+ columnDragEnd = output();
659
+ columnDragCancel = output();
660
+ // --- Header Events ---
661
+ headerClick = output();
662
+ headerDoubleClick = output();
663
+ headerContextMenu = output();
664
+ headerHover = output();
665
+ headerSortClick = output();
666
+ headerFilterClick = output();
667
+ headerCheckboxChange = output();
668
+ // --- Lifecycle Events ---
669
+ renderStart = output();
670
+ renderEnd = output();
671
+ dataLoad = output();
672
+ dataChange = output();
673
+ loadingStart = output();
674
+ loadingEnd = output();
675
+ loadingProgress = output();
676
+ undoRedoChange = output();
677
+ gridDestroy = output();
678
+ gridError = output();
679
+ gridWarning = output();
680
+ // --- Row Events ---
681
+ rowInsert = output();
682
+ rowDelete = output();
683
+ rowMove = output();
684
+ // --- Clipboard Events ---
685
+ copy = output();
686
+ cut = output();
687
+ paste = output();
688
+ outputMap = {};
689
+ eventHandlers = [];
690
+ constructor() {
691
+ this.buildOutputMap();
692
+ this.destroyRef.onDestroy(() => {
693
+ if (this.grid) {
694
+ for (const { event, handler } of this.eventHandlers) {
695
+ this.grid.off(event, handler);
696
+ }
697
+ this.grid.destroy();
698
+ this.grid = null;
699
+ }
700
+ this.eventHandlers = [];
701
+ this.gridReady = false;
702
+ this.templateBridge.destroyAll();
703
+ });
704
+ afterNextRender(() => {
705
+ this.ngZone.runOutsideAngular(() => {
706
+ this.initGrid();
707
+ });
708
+ });
709
+ // Sync data input → grid (skip first run, initGrid handles initial data)
710
+ effect(() => {
711
+ const data = this.data();
712
+ if (!this.gridReady || this.getResolvedDataMode() !== 'frontend')
713
+ return;
714
+ if (!Array.isArray(data))
715
+ return;
716
+ if (this.pendingModelDataSync === data) {
717
+ this.pendingModelDataSync = null;
718
+ return;
719
+ }
720
+ this.grid.setData(data);
721
+ });
722
+ // Sync columns from content children or input (skip first run)
723
+ effect(() => {
724
+ this.columnChildren();
725
+ this.columns();
726
+ if (!this.gridReady)
727
+ return;
728
+ const resolvedColumns = this.getComponentColumns();
729
+ if (resolvedColumns !== undefined) {
730
+ this.grid.updateOptions({ columns: resolvedColumns });
731
+ }
732
+ });
733
+ // Sync option changes with previous-value diffing (only sends changed values)
734
+ const prevOptions = {};
735
+ effect(() => {
736
+ const current = [
737
+ ['rowHeight', this.getResolvedRowHeight()],
738
+ ['colWidth', this.getResolvedColWidth()],
739
+ ['selectionType', this.selectionType()],
740
+ ['enableSelection', this.enableSelection()],
741
+ ['enableMultiSelection', this.enableMultiSelection()],
742
+ ['enableKeyboardNavigation', this.enableKeyboardNavigation()],
743
+ ['enableA11y', this.enableA11y()],
744
+ ['enableColumnResize', this.enableColumnResize()],
745
+ ['enableColumnDrag', this.enableColumnDrag()],
746
+ ['dataMode', this.getRequestedDataMode()],
747
+ ['pagination', this.pagination()],
748
+ ['loading', this.loading()],
749
+ ['infiniteScrolling', this.infiniteScrolling()],
750
+ ['rowHeightMode', this.rowHeightMode()],
751
+ ['rowHeightConfig', this.rowHeightConfig()],
752
+ ['columnResize', this.columnResize()],
753
+ ['columnDrag', this.columnDrag()],
754
+ ['cellOverflow', this.cellOverflow()],
755
+ ['autoResize', this.autoResize()],
756
+ ['overscanRows', this.overscanRows()],
757
+ ['overscanCols', this.overscanCols()],
758
+ ];
759
+ if (!this.gridReady) {
760
+ // Store initial values for diffing on next run
761
+ for (const [key, val] of current) {
762
+ prevOptions[key] = val;
763
+ }
764
+ return;
765
+ }
766
+ const changed = {};
767
+ let hasChanges = false;
768
+ for (const [key, val] of current) {
769
+ if (val !== undefined && val !== prevOptions[key]) {
770
+ changed[key] = val;
771
+ hasChanges = true;
772
+ }
773
+ prevOptions[key] = val;
774
+ }
775
+ if (hasChanges) {
776
+ this.grid.updateOptions(changed);
777
+ }
778
+ });
779
+ }
780
+ markExplicitInput(name, value) {
781
+ this.explicitInputs.add(name);
782
+ return value;
783
+ }
784
+ hasExplicitInput(name) {
785
+ return this.explicitInputs.has(name);
786
+ }
787
+ getResolvedDataMode() {
788
+ return resolveOperationMode({
789
+ mode: this.getRequestedDataMode(),
790
+ callback: this.onDataRequest() ??
791
+ this.globalConfig?.['onDataRequest'],
792
+ }, { rowCount: this.rowCount() });
793
+ }
794
+ getRequestedDataMode() {
795
+ const configuredDataMode = this.dataMode() ?? this.globalConfig?.['dataMode'];
796
+ if (configuredDataMode !== undefined) {
797
+ return configuredDataMode;
798
+ }
799
+ const legacyModes = [
800
+ this.sortMode(),
801
+ this.filterMode(),
802
+ this.globalConfig?.['sortMode'],
803
+ this.globalConfig?.['filterMode'],
804
+ ].filter((mode) => mode !== undefined);
805
+ if (legacyModes.includes('backend'))
806
+ return 'backend';
807
+ if (legacyModes.includes('auto'))
808
+ return 'auto';
809
+ if (legacyModes.includes('frontend'))
810
+ return 'frontend';
811
+ return undefined;
812
+ }
813
+ warnOnLegacyBackendCallbacks() {
814
+ if (this.warnedOnLegacyBackendCallbacks)
815
+ return;
816
+ const hasLegacyCallback = this.onSortRequest() !== undefined ||
817
+ this.onFilterRequest() !== undefined ||
818
+ this.globalConfig?.['onSortRequest'] !== undefined ||
819
+ this.globalConfig?.['onFilterRequest'] !== undefined;
820
+ if (!hasLegacyCallback)
821
+ return;
822
+ this.warnedOnLegacyBackendCallbacks = true;
823
+ console.warn(ZenGridComponent.legacyBackendCallbackWarning);
824
+ }
825
+ getResolvedRowHeight() {
826
+ const configured = this.globalConfig?.['rowHeight'];
827
+ return this.hasExplicitInput('rowHeight') || configured === undefined ? this.rowHeight() : configured;
828
+ }
829
+ getResolvedColWidth() {
830
+ const configured = this.globalConfig?.['colWidth'];
831
+ return this.hasExplicitInput('colWidth') || configured === undefined ? this.colWidth() : configured;
832
+ }
833
+ getComponentColumns() {
834
+ const columnChildren = this.columnChildren();
835
+ if (columnChildren.length > 0) {
836
+ return columnChildren.map(c => c.toColumnDef(this.templateBridge));
837
+ }
838
+ const inputColumns = this.columns();
839
+ if (this.hasExplicitInput('columns') || inputColumns.length > 0) {
840
+ return inputColumns;
841
+ }
842
+ return undefined;
843
+ }
844
+ buildOutputMap() {
845
+ this.outputMap = {
846
+ cellClick: this.cellClick,
847
+ cellDoubleClick: this.cellDoubleClick,
848
+ cellContextMenu: this.cellContextMenu,
849
+ cellChange: this.cellChange,
850
+ cellBeforeChange: this.cellBeforeChange,
851
+ cellAfterChange: this.cellAfterChange,
852
+ selectionChange: this.selectionChangeEvent,
853
+ selectionStart: this.selectionStart,
854
+ selectionEnd: this.selectionEnd,
855
+ editStart: this.editStart,
856
+ editEnd: this.editEnd,
857
+ editCommit: this.editCommit,
858
+ editCancel: this.editCancel,
859
+ scroll: this.scroll,
860
+ scrollStart: this.scrollStart,
861
+ scrollEnd: this.scrollEnd,
862
+ sortChange: this.sortChange,
863
+ sortBeforeSort: this.sortBeforeSort,
864
+ sortAfterSort: this.sortAfterSort,
865
+ filterChange: this.filterChange,
866
+ filterBeforeFilter: this.filterBeforeFilter,
867
+ filterAfterFilter: this.filterAfterFilter,
868
+ filterExport: this.filterExport,
869
+ filterStart: this.filterStart,
870
+ filterEnd: this.filterEnd,
871
+ filterError: this.filterError,
872
+ filterClear: this.filterClear,
873
+ focusChange: this.focusChange,
874
+ focusIn: this.focusIn,
875
+ focusOut: this.focusOut,
876
+ keyDown: this.keyDown,
877
+ keyUp: this.keyUp,
878
+ keyPress: this.keyPress,
879
+ columnResize: this.columnResizeEvent,
880
+ columnMove: this.columnMove,
881
+ columnHide: this.columnHide,
882
+ columnShow: this.columnShow,
883
+ columnDragStart: this.columnDragStart,
884
+ columnDrag: this.columnDragEvent,
885
+ columnDragEnd: this.columnDragEnd,
886
+ columnDragCancel: this.columnDragCancel,
887
+ headerClick: this.headerClick,
888
+ headerDoubleClick: this.headerDoubleClick,
889
+ headerContextMenu: this.headerContextMenu,
890
+ headerHover: this.headerHover,
891
+ headerSortClick: this.headerSortClick,
892
+ headerFilterClick: this.headerFilterClick,
893
+ headerCheckboxChange: this.headerCheckboxChange,
894
+ renderStart: this.renderStart,
895
+ renderEnd: this.renderEnd,
896
+ dataLoad: this.dataLoad,
897
+ dataChange: this.dataChange,
898
+ loadingStart: this.loadingStart,
899
+ loadingEnd: this.loadingEnd,
900
+ loadingProgress: this.loadingProgress,
901
+ undoRedoChange: this.undoRedoChange,
902
+ gridDestroy: this.gridDestroy,
903
+ gridError: this.gridError,
904
+ gridWarning: this.gridWarning,
905
+ rowInsert: this.rowInsert,
906
+ rowDelete: this.rowDelete,
907
+ rowMove: this.rowMove,
908
+ copy: this.copy,
909
+ cut: this.cut,
910
+ paste: this.paste,
911
+ };
912
+ }
913
+ initGrid() {
914
+ const containerRef = this.gridContainerRef();
915
+ if (!containerRef)
916
+ return;
917
+ const container = containerRef.nativeElement;
918
+ const dataValue = this.data();
919
+ const componentColumns = this.getComponentColumns();
920
+ const resolvedDataMode = this.getResolvedDataMode();
921
+ this.warnOnLegacyBackendCallbacks();
922
+ const options = {
923
+ ...(this.globalConfig ?? {}),
924
+ rowCount: this.rowCount(),
925
+ colCount: this.colCount(),
926
+ ...this.getOptionalOptions(),
927
+ rowHeight: this.getResolvedRowHeight(),
928
+ colWidth: this.getResolvedColWidth(),
929
+ ...(componentColumns !== undefined ? { columns: componentColumns } : {}),
930
+ };
931
+ this.grid = new Grid(container, options);
932
+ // Wire up events
933
+ this.wireEvents();
934
+ // Frontend mode owns the in-memory dataset, including an explicit empty array.
935
+ if (resolvedDataMode === 'frontend' && Array.isArray(dataValue)) {
936
+ this.grid.setData(dataValue);
937
+ }
938
+ // Install plugins
939
+ const pluginList = this.plugins();
940
+ for (const plugin of pluginList) {
941
+ this.grid.usePlugin(plugin);
942
+ }
943
+ this.grid.render();
944
+ this.gridReady = true;
945
+ }
946
+ getOptionalOptions() {
947
+ const opts = {};
948
+ const enSel = this.enableSelection();
949
+ const enMulti = this.enableMultiSelection();
950
+ const selType = this.selectionType();
951
+ const enKb = this.enableKeyboardNavigation();
952
+ const enA11y = this.enableA11y();
953
+ const enPool = this.enableCellPooling();
954
+ const enResize = this.enableColumnResize();
955
+ const enDrag = this.enableColumnDrag();
956
+ const dMode = this.getRequestedDataMode();
957
+ const dReq = this.onDataRequest();
958
+ const loadMore = this.onLoadMoreRows();
959
+ const pag = this.pagination();
960
+ const load = this.loading();
961
+ const infScroll = this.infiniteScrolling();
962
+ const rhMode = this.rowHeightMode();
963
+ const rhConfig = this.rowHeightConfig();
964
+ const colResizeConf = this.columnResize();
965
+ const colDragConf = this.columnDrag();
966
+ const overflow = this.cellOverflow();
967
+ const autoRes = this.autoResize();
968
+ const oRows = this.overscanRows();
969
+ const oCols = this.overscanCols();
970
+ const sIcons = this.sortIcons();
971
+ const rCache = this.rendererCache();
972
+ const onScrollCb = this.onScrollCallback();
973
+ const onCellClickCb = this.onCellClickCallback();
974
+ const onCellDblClickCb = this.onCellDoubleClickCallback();
975
+ const onCellCtxCb = this.onCellContextMenuCallback();
976
+ const onSelChangeCb = this.onSelectionChangeCallback();
977
+ const onPageChangeCb = this.onPageChangeCallback();
978
+ const onColWidthsCb = this.onColumnWidthsChangeCallback();
979
+ if (enSel !== undefined)
980
+ opts.enableSelection = enSel;
981
+ if (enMulti !== undefined)
982
+ opts.enableMultiSelection = enMulti;
983
+ if (selType !== undefined)
984
+ opts.selectionType = selType;
985
+ if (enKb !== undefined)
986
+ opts.enableKeyboardNavigation = enKb;
987
+ if (enA11y !== undefined)
988
+ opts.enableA11y = enA11y;
989
+ if (enPool !== undefined)
990
+ opts.enableCellPooling = enPool;
991
+ if (enResize !== undefined)
992
+ opts.enableColumnResize = enResize;
993
+ if (enDrag !== undefined)
994
+ opts.enableColumnDrag = enDrag;
995
+ if (dMode !== undefined)
996
+ opts.dataMode = dMode;
997
+ if (dReq !== undefined)
998
+ opts.onDataRequest = dReq;
999
+ if (loadMore !== undefined)
1000
+ opts.onLoadMoreRows = loadMore;
1001
+ if (pag !== undefined)
1002
+ opts.pagination = pag;
1003
+ if (load !== undefined)
1004
+ opts.loading = load;
1005
+ if (infScroll !== undefined)
1006
+ opts.infiniteScrolling = infScroll;
1007
+ if (rhMode !== undefined)
1008
+ opts.rowHeightMode = rhMode;
1009
+ if (rhConfig !== undefined)
1010
+ opts.rowHeightConfig = rhConfig;
1011
+ if (colResizeConf !== undefined)
1012
+ opts.columnResize = colResizeConf;
1013
+ if (colDragConf !== undefined)
1014
+ opts.columnDrag = colDragConf;
1015
+ if (overflow !== undefined)
1016
+ opts.cellOverflow = overflow;
1017
+ if (autoRes !== undefined)
1018
+ opts.autoResize = autoRes;
1019
+ if (oRows !== undefined)
1020
+ opts.overscanRows = oRows;
1021
+ if (oCols !== undefined)
1022
+ opts.overscanCols = oCols;
1023
+ if (sIcons !== undefined)
1024
+ opts.sortIcons = sIcons;
1025
+ if (rCache !== undefined)
1026
+ opts.rendererCache = rCache;
1027
+ if (onScrollCb !== undefined)
1028
+ opts.onScroll = onScrollCb;
1029
+ if (onCellClickCb !== undefined)
1030
+ opts.onCellClick = onCellClickCb;
1031
+ if (onCellDblClickCb !== undefined)
1032
+ opts.onCellDoubleClick = onCellDblClickCb;
1033
+ if (onCellCtxCb !== undefined)
1034
+ opts.onCellContextMenu = onCellCtxCb;
1035
+ if (onSelChangeCb !== undefined)
1036
+ opts.onSelectionChange = onSelChangeCb;
1037
+ if (onPageChangeCb !== undefined)
1038
+ opts.onPageChange = onPageChangeCb;
1039
+ if (onColWidthsCb !== undefined)
1040
+ opts.onColumnWidthsChange = onColWidthsCb;
1041
+ return opts;
1042
+ }
1043
+ wireEvents() {
1044
+ if (!this.grid)
1045
+ return;
1046
+ for (const [gridEvent, outputName] of Object.entries(EVENT_MAP)) {
1047
+ const outputRef = this.outputMap[outputName];
1048
+ if (!outputRef)
1049
+ continue;
1050
+ const handler = (payload) => {
1051
+ this.ngZone.run(() => {
1052
+ outputRef.emit(payload);
1053
+ // Update two-way model signals for specific events
1054
+ if (gridEvent === 'selection:change' && payload?.ranges) {
1055
+ this.selection.set(payload.ranges);
1056
+ }
1057
+ else if (gridEvent === 'sort:change' && payload?.sortState) {
1058
+ this.sortState.set(payload.sortState);
1059
+ }
1060
+ else if (gridEvent === 'filter:change' && payload?.filterState) {
1061
+ this.filterState.set(payload.filterState);
1062
+ }
1063
+ else if (gridEvent === 'data:change') {
1064
+ // data:change doesn't carry full data, skip model update
1065
+ }
1066
+ this.cdr.markForCheck();
1067
+ });
1068
+ };
1069
+ this.grid.on(gridEvent, handler);
1070
+ this.eventHandlers.push({ event: gridEvent, handler });
1071
+ }
1072
+ }
1073
+ // --- Public API Methods ---
1074
+ get gridInstance() {
1075
+ return this.grid;
1076
+ }
1077
+ render() {
1078
+ this.grid?.render();
1079
+ }
1080
+ refresh() {
1081
+ this.grid?.refresh();
1082
+ }
1083
+ clearCache() {
1084
+ this.grid?.clearCache();
1085
+ }
1086
+ updateCells(cells) {
1087
+ this.grid?.updateCells(cells);
1088
+ }
1089
+ setData(data) {
1090
+ if (this.getResolvedDataMode() === 'frontend') {
1091
+ if (this.grid) {
1092
+ this.pendingModelDataSync = data;
1093
+ this.grid.setData(data);
1094
+ }
1095
+ }
1096
+ this.data.set(data);
1097
+ }
1098
+ getData(row, col) {
1099
+ return this.grid?.getData(row, col);
1100
+ }
1101
+ // --- Sort API ---
1102
+ sortColumn(column, direction = 'asc') {
1103
+ if (direction === null)
1104
+ this.grid?.sort.clear();
1105
+ else
1106
+ this.grid?.sort.apply([{ column, direction }]);
1107
+ }
1108
+ toggleSort(column) {
1109
+ this.grid?.sort.toggle(column);
1110
+ }
1111
+ getSortState() {
1112
+ return this.grid?.sort.getState() ?? [];
1113
+ }
1114
+ clearSort() {
1115
+ this.grid?.sort.clear();
1116
+ }
1117
+ setSortState(sortState) {
1118
+ this.grid?.sort.setState(sortState);
1119
+ }
1120
+ // --- Filter API ---
1121
+ setFilter(column, operator, value) {
1122
+ this.grid?.filter.set(column, operator, value);
1123
+ }
1124
+ setColumnFilter(column, conditions, logic = 'AND') {
1125
+ this.grid?.filter.setColumn(column, conditions, logic);
1126
+ }
1127
+ getFilterState() {
1128
+ return this.grid?.filter.getState() ?? [];
1129
+ }
1130
+ setFilterState(models) {
1131
+ this.grid?.filter.setState(models);
1132
+ }
1133
+ clearFilters() {
1134
+ this.grid?.filter.clear();
1135
+ }
1136
+ clearColumnFilter(column) {
1137
+ this.grid?.filter.clearColumn(column);
1138
+ }
1139
+ setQuickFilter(query, columns) {
1140
+ this.grid?.filter.setQuick(query, columns);
1141
+ }
1142
+ clearQuickFilter() {
1143
+ this.grid?.filter.clearQuick();
1144
+ }
1145
+ // --- Export API ---
1146
+ exportCSV(options = {}) {
1147
+ return this.grid?.export.csv(options) ?? '';
1148
+ }
1149
+ exportTSV(options = {}) {
1150
+ return this.grid?.export.tsv(options) ?? '';
1151
+ }
1152
+ // --- Pagination API ---
1153
+ goToPage(page) {
1154
+ this.grid?.pagination.goTo(page);
1155
+ this.currentPage.set(page);
1156
+ }
1157
+ nextPage() {
1158
+ this.grid?.pagination.next();
1159
+ this.currentPage.set(this.grid?.pagination.getCurrentPage() ?? 1);
1160
+ }
1161
+ previousPage() {
1162
+ this.grid?.pagination.previous();
1163
+ this.currentPage.set(this.grid?.pagination.getCurrentPage() ?? 1);
1164
+ }
1165
+ setPageSize(pageSize) {
1166
+ this.grid?.pagination.setPageSize(pageSize);
1167
+ }
1168
+ getCurrentPage() {
1169
+ return this.grid?.pagination.getCurrentPage() ?? 1;
1170
+ }
1171
+ getPageSize() {
1172
+ return this.grid?.pagination.getPageSize() ?? 0;
1173
+ }
1174
+ getTotalPages() {
1175
+ return this.grid?.pagination.getTotalPages() ?? 0;
1176
+ }
1177
+ // --- Column API ---
1178
+ resizeColumn(col, width) {
1179
+ this.grid?.resizeColumn(col, width);
1180
+ }
1181
+ autoFitColumn(col) {
1182
+ this.grid?.autoFitColumn(col);
1183
+ }
1184
+ autoFitAllColumns() {
1185
+ this.grid?.autoFitAllColumns();
1186
+ }
1187
+ setColumnConstraints(col, constraints) {
1188
+ this.grid?.setColumnConstraints(col, constraints);
1189
+ }
1190
+ // --- State Persistence API ---
1191
+ getColumnState() {
1192
+ return this.grid?.getColumnState() ?? [];
1193
+ }
1194
+ applyColumnState(state, options) {
1195
+ this.grid?.applyColumnState(state, options);
1196
+ }
1197
+ getStateSnapshot() {
1198
+ return this.grid?.getStateSnapshot() ?? null;
1199
+ }
1200
+ applyStateSnapshot(snapshot) {
1201
+ this.grid?.applyStateSnapshot(snapshot);
1202
+ }
1203
+ // --- Scroll API ---
1204
+ scrollToCell(row, col) {
1205
+ this.grid?.scrollToCell(row, col);
1206
+ }
1207
+ getScrollPosition() {
1208
+ return this.grid?.getScrollPosition() ?? { top: 0, left: 0 };
1209
+ }
1210
+ getVisibleRange() {
1211
+ return this.grid?.getVisibleRange() ?? null;
1212
+ }
1213
+ // --- Header API ---
1214
+ registerHeaderRenderer(name, renderer) {
1215
+ this.grid?.registerHeaderRenderer(name, renderer);
1216
+ }
1217
+ updateHeader(columnIndex) {
1218
+ this.grid?.updateHeader(columnIndex);
1219
+ }
1220
+ updateAllHeaders() {
1221
+ this.grid?.updateAllHeaders();
1222
+ }
1223
+ // --- Plugin API ---
1224
+ usePlugin(plugin) {
1225
+ this.grid?.usePlugin(plugin);
1226
+ }
1227
+ // --- Stats ---
1228
+ getStats() {
1229
+ return this.grid?.getStats();
1230
+ }
1231
+ getDimensions() {
1232
+ return this.grid?.getDimensions() ?? { width: 0, height: 0 };
1233
+ }
1234
+ getColumnPosition(col) {
1235
+ return this.grid?.getColumnPosition(col) ?? { x: 0, width: 0 };
1236
+ }
1237
+ // --- Data Mode ---
1238
+ getDataMode() {
1239
+ return this.grid?.getDataMode() ?? 'frontend';
1240
+ }
1241
+ // --- Sort (missing methods) ---
1242
+ getColumnSort(column) {
1243
+ return this.grid?.getColumnSort(column);
1244
+ }
1245
+ getSortIcons() {
1246
+ return this.grid?.getSortIcons() ?? { asc: '▲', desc: '▼' };
1247
+ }
1248
+ getSortMode() {
1249
+ return this.grid?.getSortMode() ?? 'frontend';
1250
+ }
1251
+ // --- Filter (missing methods) ---
1252
+ getFieldFilterState() {
1253
+ return this.grid?.getFieldFilterState();
1254
+ }
1255
+ getFilterExports() {
1256
+ return this.grid?.getFilterExports();
1257
+ }
1258
+ getFilterMode() {
1259
+ return this.grid?.getFilterMode() ?? 'frontend';
1260
+ }
1261
+ getQuickFilter() {
1262
+ return this.grid?.getQuickFilter() ?? { query: '', columns: null };
1263
+ }
1264
+ // --- Pagination (missing methods) ---
1265
+ firstPage() {
1266
+ this.grid?.firstPage();
1267
+ this.currentPage.set(this.grid?.getCurrentPage() ?? 1);
1268
+ }
1269
+ lastPage() {
1270
+ this.grid?.lastPage();
1271
+ this.currentPage.set(this.grid?.getCurrentPage() ?? 1);
1272
+ }
1273
+ // --- Scroll (missing methods) ---
1274
+ scrollThroughCells(cells, options) {
1275
+ return this.grid?.scrollThroughCells(cells, options) ?? {
1276
+ promise: Promise.resolve(),
1277
+ abort: () => { },
1278
+ };
1279
+ }
1280
+ // --- Column Resize/Drag (missing methods) ---
1281
+ attachColumnResize(headerElement) {
1282
+ this.grid?.attachColumnResize(headerElement);
1283
+ }
1284
+ detachColumnResize() {
1285
+ this.grid?.detachColumnResize();
1286
+ }
1287
+ updateColumnResizeHandles() {
1288
+ this.grid?.updateColumnResizeHandles();
1289
+ }
1290
+ attachColumnDrag(headerElement) {
1291
+ this.grid?.attachColumnDrag(headerElement);
1292
+ }
1293
+ detachColumnDrag() {
1294
+ this.grid?.detachColumnDrag();
1295
+ }
1296
+ isDragging() {
1297
+ return this.grid?.isDragging() ?? false;
1298
+ }
1299
+ // --- Renderer Registration ---
1300
+ registerRenderer(name, renderer) {
1301
+ this.grid?.registerRenderer(name, renderer);
1302
+ }
1303
+ // --- Options Update ---
1304
+ updateOptions(options) {
1305
+ this.grid?.updateOptions(options);
1306
+ }
1307
+ // --- Header (missing methods) ---
1308
+ refreshHeaders() {
1309
+ this.grid?.refreshHeaders();
1310
+ }
1311
+ // --- Infinite Scroll ---
1312
+ resetInfiniteScrolling() {
1313
+ this.grid?.resetInfiniteScrolling();
1314
+ }
1315
+ getSlidingWindowStats() {
1316
+ return this.grid?.getSlidingWindowStats();
1317
+ }
1318
+ // --- Plugin System (advanced) ---
1319
+ getStore() {
1320
+ return this.grid?.getStore();
1321
+ }
1322
+ getPluginHost() {
1323
+ return this.grid?.getPluginHost() ?? null;
1324
+ }
1325
+ getGridApi() {
1326
+ return this.grid?.getGridApi() ?? null;
1327
+ }
1328
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1329
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.5", type: ZenGridComponent, isStandalone: true, selector: "zen-grid", inputs: { rowCount: { classPropertyName: "rowCount", publicName: "rowCount", isSignal: true, isRequired: true, transformFunction: null }, colCount: { classPropertyName: "colCount", publicName: "colCount", isSignal: true, isRequired: true, transformFunction: null }, rowHeight: { classPropertyName: "rowHeight", publicName: "rowHeight", isSignal: true, isRequired: false, transformFunction: null }, colWidth: { classPropertyName: "colWidth", publicName: "colWidth", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, enableSelection: { classPropertyName: "enableSelection", publicName: "enableSelection", isSignal: true, isRequired: false, transformFunction: null }, enableMultiSelection: { classPropertyName: "enableMultiSelection", publicName: "enableMultiSelection", isSignal: true, isRequired: false, transformFunction: null }, selectionType: { classPropertyName: "selectionType", publicName: "selectionType", isSignal: true, isRequired: false, transformFunction: null }, enableColumnResize: { classPropertyName: "enableColumnResize", publicName: "enableColumnResize", isSignal: true, isRequired: false, transformFunction: null }, enableColumnDrag: { classPropertyName: "enableColumnDrag", publicName: "enableColumnDrag", isSignal: true, isRequired: false, transformFunction: null }, enableKeyboardNavigation: { classPropertyName: "enableKeyboardNavigation", publicName: "enableKeyboardNavigation", isSignal: true, isRequired: false, transformFunction: null }, enableA11y: { classPropertyName: "enableA11y", publicName: "enableA11y", isSignal: true, isRequired: false, transformFunction: null }, enableCellPooling: { classPropertyName: "enableCellPooling", publicName: "enableCellPooling", isSignal: true, isRequired: false, transformFunction: null }, dataMode: { classPropertyName: "dataMode", publicName: "dataMode", isSignal: true, isRequired: false, transformFunction: null }, sortMode: { classPropertyName: "sortMode", publicName: "sortMode", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, onDataRequest: { classPropertyName: "onDataRequest", publicName: "onDataRequest", isSignal: true, isRequired: false, transformFunction: null }, onSortRequest: { classPropertyName: "onSortRequest", publicName: "onSortRequest", isSignal: true, isRequired: false, transformFunction: null }, onFilterRequest: { classPropertyName: "onFilterRequest", publicName: "onFilterRequest", isSignal: true, isRequired: false, transformFunction: null }, onLoadMoreRows: { classPropertyName: "onLoadMoreRows", publicName: "onLoadMoreRows", isSignal: true, isRequired: false, transformFunction: null }, pagination: { classPropertyName: "pagination", publicName: "pagination", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, infiniteScrolling: { classPropertyName: "infiniteScrolling", publicName: "infiniteScrolling", isSignal: true, isRequired: false, transformFunction: null }, rowHeightMode: { classPropertyName: "rowHeightMode", publicName: "rowHeightMode", isSignal: true, isRequired: false, transformFunction: null }, rowHeightConfig: { classPropertyName: "rowHeightConfig", publicName: "rowHeightConfig", isSignal: true, isRequired: false, transformFunction: null }, columnResize: { classPropertyName: "columnResize", publicName: "columnResize", isSignal: true, isRequired: false, transformFunction: null }, columnDrag: { classPropertyName: "columnDrag", publicName: "columnDrag", isSignal: true, isRequired: false, transformFunction: null }, cellOverflow: { classPropertyName: "cellOverflow", publicName: "cellOverflow", isSignal: true, isRequired: false, transformFunction: null }, autoResize: { classPropertyName: "autoResize", publicName: "autoResize", isSignal: true, isRequired: false, transformFunction: null }, overscanRows: { classPropertyName: "overscanRows", publicName: "overscanRows", isSignal: true, isRequired: false, transformFunction: null }, overscanCols: { classPropertyName: "overscanCols", publicName: "overscanCols", isSignal: true, isRequired: false, transformFunction: null }, sortIcons: { classPropertyName: "sortIcons", publicName: "sortIcons", isSignal: true, isRequired: false, transformFunction: null }, rendererCache: { classPropertyName: "rendererCache", publicName: "rendererCache", isSignal: true, isRequired: false, transformFunction: null }, onScrollCallback: { classPropertyName: "onScrollCallback", publicName: "onScrollCallback", isSignal: true, isRequired: false, transformFunction: null }, onCellClickCallback: { classPropertyName: "onCellClickCallback", publicName: "onCellClickCallback", isSignal: true, isRequired: false, transformFunction: null }, onCellDoubleClickCallback: { classPropertyName: "onCellDoubleClickCallback", publicName: "onCellDoubleClickCallback", isSignal: true, isRequired: false, transformFunction: null }, onCellContextMenuCallback: { classPropertyName: "onCellContextMenuCallback", publicName: "onCellContextMenuCallback", isSignal: true, isRequired: false, transformFunction: null }, onSelectionChangeCallback: { classPropertyName: "onSelectionChangeCallback", publicName: "onSelectionChangeCallback", isSignal: true, isRequired: false, transformFunction: null }, onPageChangeCallback: { classPropertyName: "onPageChangeCallback", publicName: "onPageChangeCallback", isSignal: true, isRequired: false, transformFunction: null }, onColumnWidthsChangeCallback: { classPropertyName: "onColumnWidthsChangeCallback", publicName: "onColumnWidthsChangeCallback", isSignal: true, isRequired: false, transformFunction: null }, plugins: { classPropertyName: "plugins", publicName: "plugins", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, sortState: { classPropertyName: "sortState", publicName: "sortState", isSignal: true, isRequired: false, transformFunction: null }, filterState: { classPropertyName: "filterState", publicName: "filterState", isSignal: true, isRequired: false, transformFunction: null }, currentPage: { classPropertyName: "currentPage", publicName: "currentPage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { data: "dataChange", selection: "selectionChange", sortState: "sortStateChange", filterState: "filterStateChange", currentPage: "currentPageChange", cellClick: "cellClick", cellDoubleClick: "cellDoubleClick", cellContextMenu: "cellContextMenu", cellChange: "cellChange", cellBeforeChange: "cellBeforeChange", cellAfterChange: "cellAfterChange", selectionChangeEvent: "selectionChanged", selectionStart: "selectionStart", selectionEnd: "selectionEnd", editStart: "editStart", editEnd: "editEnd", editCommit: "editCommit", editCancel: "editCancel", scroll: "scroll", scrollStart: "scrollStart", scrollEnd: "scrollEnd", sortChange: "sortChange", sortBeforeSort: "sortBeforeSort", sortAfterSort: "sortAfterSort", filterChange: "filterChange", filterBeforeFilter: "filterBeforeFilter", filterAfterFilter: "filterAfterFilter", filterExport: "filterExport", filterStart: "filterStart", filterEnd: "filterEnd", filterError: "filterError", filterClear: "filterClear", focusChange: "focusChange", focusIn: "focusIn", focusOut: "focusOut", keyDown: "keyDown", keyUp: "keyUp", keyPress: "keyPress", columnResizeEvent: "columnResize", columnMove: "columnMove", columnHide: "columnHide", columnShow: "columnShow", columnDragStart: "columnDragStart", columnDragEvent: "columnDrag", columnDragEnd: "columnDragEnd", columnDragCancel: "columnDragCancel", headerClick: "headerClick", headerDoubleClick: "headerDoubleClick", headerContextMenu: "headerContextMenu", headerHover: "headerHover", headerSortClick: "headerSortClick", headerFilterClick: "headerFilterClick", headerCheckboxChange: "headerCheckboxChange", renderStart: "renderStart", renderEnd: "renderEnd", dataLoad: "dataLoad", dataChange: "dataChange", loadingStart: "loadingStart", loadingEnd: "loadingEnd", loadingProgress: "loadingProgress", undoRedoChange: "undoRedoChange", gridDestroy: "gridDestroy", gridError: "gridError", gridWarning: "gridWarning", rowInsert: "rowInsert", rowDelete: "rowDelete", rowMove: "rowMove", copy: "copy", cut: "cut", paste: "paste" }, queries: [{ propertyName: "columnChildren", predicate: ZenColumnComponent, isSignal: true }], viewQueries: [{ propertyName: "gridContainerRef", first: true, predicate: ["gridContainer"], descendants: true, isSignal: true }], ngImport: i0, template: `
1330
+ @if (_isBrowser) {
1331
+ <div #gridContainer class="zen-grid-container"></div>
1332
+ } @else {
1333
+ <div class="zen-grid-placeholder" [style.height.px]="placeholderHeight"></div>
1334
+ }
1335
+ <div style="display:none">
1336
+ <ng-content></ng-content>
1337
+ </div>
1338
+ `, isInline: true, styles: [":host{display:block;position:relative;height:100%}.zen-grid-container{width:100%;height:100%}.zen-grid-placeholder{width:100%;background:#f5f5f5}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1339
+ }
1340
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenGridComponent, decorators: [{
1341
+ type: Component,
1342
+ args: [{ selector: 'zen-grid', standalone: true, template: `
1343
+ @if (_isBrowser) {
1344
+ <div #gridContainer class="zen-grid-container"></div>
1345
+ } @else {
1346
+ <div class="zen-grid-placeholder" [style.height.px]="placeholderHeight"></div>
1347
+ }
1348
+ <div style="display:none">
1349
+ <ng-content></ng-content>
1350
+ </div>
1351
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;position:relative;height:100%}.zen-grid-container{width:100%;height:100%}.zen-grid-placeholder{width:100%;background:#f5f5f5}\n"] }]
1352
+ }], ctorParameters: () => [], propDecorators: { gridContainerRef: [{ type: i0.ViewChild, args: ['gridContainer', { isSignal: true }] }], columnChildren: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ZenColumnComponent), { isSignal: true }] }], rowCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowCount", required: true }] }], colCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "colCount", required: true }] }], rowHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeight", required: false }] }], colWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "colWidth", required: false }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], enableSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableSelection", required: false }] }], enableMultiSelection: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableMultiSelection", required: false }] }], selectionType: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectionType", required: false }] }], enableColumnResize: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableColumnResize", required: false }] }], enableColumnDrag: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableColumnDrag", required: false }] }], enableKeyboardNavigation: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableKeyboardNavigation", required: false }] }], enableA11y: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableA11y", required: false }] }], enableCellPooling: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableCellPooling", required: false }] }], dataMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataMode", required: false }] }], sortMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortMode", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], onDataRequest: [{ type: i0.Input, args: [{ isSignal: true, alias: "onDataRequest", required: false }] }], onSortRequest: [{ type: i0.Input, args: [{ isSignal: true, alias: "onSortRequest", required: false }] }], onFilterRequest: [{ type: i0.Input, args: [{ isSignal: true, alias: "onFilterRequest", required: false }] }], onLoadMoreRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "onLoadMoreRows", required: false }] }], pagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "pagination", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], infiniteScrolling: [{ type: i0.Input, args: [{ isSignal: true, alias: "infiniteScrolling", required: false }] }], rowHeightMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeightMode", required: false }] }], rowHeightConfig: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowHeightConfig", required: false }] }], columnResize: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnResize", required: false }] }], columnDrag: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnDrag", required: false }] }], cellOverflow: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellOverflow", required: false }] }], autoResize: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoResize", required: false }] }], overscanRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "overscanRows", required: false }] }], overscanCols: [{ type: i0.Input, args: [{ isSignal: true, alias: "overscanCols", required: false }] }], sortIcons: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortIcons", required: false }] }], rendererCache: [{ type: i0.Input, args: [{ isSignal: true, alias: "rendererCache", required: false }] }], onScrollCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "onScrollCallback", required: false }] }], onCellClickCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "onCellClickCallback", required: false }] }], onCellDoubleClickCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "onCellDoubleClickCallback", required: false }] }], onCellContextMenuCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "onCellContextMenuCallback", required: false }] }], onSelectionChangeCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "onSelectionChangeCallback", required: false }] }], onPageChangeCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "onPageChangeCallback", required: false }] }], onColumnWidthsChangeCallback: [{ type: i0.Input, args: [{ isSignal: true, alias: "onColumnWidthsChangeCallback", required: false }] }], plugins: [{ type: i0.Input, args: [{ isSignal: true, alias: "plugins", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }, { type: i0.Output, args: ["dataChange"] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }, { type: i0.Output, args: ["selectionChange"] }], sortState: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortState", required: false }] }, { type: i0.Output, args: ["sortStateChange"] }], filterState: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterState", required: false }] }, { type: i0.Output, args: ["filterStateChange"] }], currentPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "currentPage", required: false }] }, { type: i0.Output, args: ["currentPageChange"] }], cellClick: [{ type: i0.Output, args: ["cellClick"] }], cellDoubleClick: [{ type: i0.Output, args: ["cellDoubleClick"] }], cellContextMenu: [{ type: i0.Output, args: ["cellContextMenu"] }], cellChange: [{ type: i0.Output, args: ["cellChange"] }], cellBeforeChange: [{ type: i0.Output, args: ["cellBeforeChange"] }], cellAfterChange: [{ type: i0.Output, args: ["cellAfterChange"] }], selectionChangeEvent: [{ type: i0.Output, args: ["selectionChanged"] }], selectionStart: [{ type: i0.Output, args: ["selectionStart"] }], selectionEnd: [{ type: i0.Output, args: ["selectionEnd"] }], editStart: [{ type: i0.Output, args: ["editStart"] }], editEnd: [{ type: i0.Output, args: ["editEnd"] }], editCommit: [{ type: i0.Output, args: ["editCommit"] }], editCancel: [{ type: i0.Output, args: ["editCancel"] }], scroll: [{ type: i0.Output, args: ["scroll"] }], scrollStart: [{ type: i0.Output, args: ["scrollStart"] }], scrollEnd: [{ type: i0.Output, args: ["scrollEnd"] }], sortChange: [{ type: i0.Output, args: ["sortChange"] }], sortBeforeSort: [{ type: i0.Output, args: ["sortBeforeSort"] }], sortAfterSort: [{ type: i0.Output, args: ["sortAfterSort"] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], filterBeforeFilter: [{ type: i0.Output, args: ["filterBeforeFilter"] }], filterAfterFilter: [{ type: i0.Output, args: ["filterAfterFilter"] }], filterExport: [{ type: i0.Output, args: ["filterExport"] }], filterStart: [{ type: i0.Output, args: ["filterStart"] }], filterEnd: [{ type: i0.Output, args: ["filterEnd"] }], filterError: [{ type: i0.Output, args: ["filterError"] }], filterClear: [{ type: i0.Output, args: ["filterClear"] }], focusChange: [{ type: i0.Output, args: ["focusChange"] }], focusIn: [{ type: i0.Output, args: ["focusIn"] }], focusOut: [{ type: i0.Output, args: ["focusOut"] }], keyDown: [{ type: i0.Output, args: ["keyDown"] }], keyUp: [{ type: i0.Output, args: ["keyUp"] }], keyPress: [{ type: i0.Output, args: ["keyPress"] }], columnResizeEvent: [{ type: i0.Output, args: ["columnResize"] }], columnMove: [{ type: i0.Output, args: ["columnMove"] }], columnHide: [{ type: i0.Output, args: ["columnHide"] }], columnShow: [{ type: i0.Output, args: ["columnShow"] }], columnDragStart: [{ type: i0.Output, args: ["columnDragStart"] }], columnDragEvent: [{ type: i0.Output, args: ["columnDrag"] }], columnDragEnd: [{ type: i0.Output, args: ["columnDragEnd"] }], columnDragCancel: [{ type: i0.Output, args: ["columnDragCancel"] }], headerClick: [{ type: i0.Output, args: ["headerClick"] }], headerDoubleClick: [{ type: i0.Output, args: ["headerDoubleClick"] }], headerContextMenu: [{ type: i0.Output, args: ["headerContextMenu"] }], headerHover: [{ type: i0.Output, args: ["headerHover"] }], headerSortClick: [{ type: i0.Output, args: ["headerSortClick"] }], headerFilterClick: [{ type: i0.Output, args: ["headerFilterClick"] }], headerCheckboxChange: [{ type: i0.Output, args: ["headerCheckboxChange"] }], renderStart: [{ type: i0.Output, args: ["renderStart"] }], renderEnd: [{ type: i0.Output, args: ["renderEnd"] }], dataLoad: [{ type: i0.Output, args: ["dataLoad"] }], dataChange: [{ type: i0.Output, args: ["dataChange"] }], loadingStart: [{ type: i0.Output, args: ["loadingStart"] }], loadingEnd: [{ type: i0.Output, args: ["loadingEnd"] }], loadingProgress: [{ type: i0.Output, args: ["loadingProgress"] }], undoRedoChange: [{ type: i0.Output, args: ["undoRedoChange"] }], gridDestroy: [{ type: i0.Output, args: ["gridDestroy"] }], gridError: [{ type: i0.Output, args: ["gridError"] }], gridWarning: [{ type: i0.Output, args: ["gridWarning"] }], rowInsert: [{ type: i0.Output, args: ["rowInsert"] }], rowDelete: [{ type: i0.Output, args: ["rowDelete"] }], rowMove: [{ type: i0.Output, args: ["rowMove"] }], copy: [{ type: i0.Output, args: ["copy"] }], cut: [{ type: i0.Output, args: ["cut"] }], paste: [{ type: i0.Output, args: ["paste"] }] } });
1353
+
1354
+ class ZenGridValueAccessorDirective {
1355
+ grid = inject(ZenGridComponent);
1356
+ onChange = () => { };
1357
+ onTouched = () => { };
1358
+ constructor() {
1359
+ this.grid.dataChange.subscribe(() => {
1360
+ this.onChange(this.grid.data());
1361
+ this.onTouched();
1362
+ });
1363
+ }
1364
+ writeValue(value) {
1365
+ if (value) {
1366
+ this.grid.setData(value);
1367
+ }
1368
+ }
1369
+ registerOnChange(fn) {
1370
+ this.onChange = fn;
1371
+ }
1372
+ registerOnTouched(fn) {
1373
+ this.onTouched = fn;
1374
+ }
1375
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenGridValueAccessorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1376
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.5", type: ZenGridValueAccessorDirective, isStandalone: true, selector: "zen-grid[formControl],zen-grid[formControlName],zen-grid[ngModel]", providers: [
1377
+ {
1378
+ provide: NG_VALUE_ACCESSOR,
1379
+ useExisting: forwardRef(() => ZenGridValueAccessorDirective),
1380
+ multi: true,
1381
+ },
1382
+ ], ngImport: i0 });
1383
+ }
1384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ZenGridValueAccessorDirective, decorators: [{
1385
+ type: Directive,
1386
+ args: [{
1387
+ selector: 'zen-grid[formControl],zen-grid[formControlName],zen-grid[ngModel]',
1388
+ standalone: true,
1389
+ providers: [
1390
+ {
1391
+ provide: NG_VALUE_ACCESSOR,
1392
+ useExisting: forwardRef(() => ZenGridValueAccessorDirective),
1393
+ multi: true,
1394
+ },
1395
+ ],
1396
+ }]
1397
+ }], ctorParameters: () => [] });
1398
+
1399
+ class AngularPluginWrapper {
1400
+ injector;
1401
+ pluginFactory;
1402
+ name;
1403
+ phase;
1404
+ dependencies;
1405
+ constructor(injector, pluginFactory) {
1406
+ this.injector = injector;
1407
+ this.pluginFactory = pluginFactory;
1408
+ const plugin = this.pluginFactory(this.injector);
1409
+ this.name = plugin.name;
1410
+ this.phase = plugin.phase;
1411
+ this.dependencies = plugin.dependencies;
1412
+ }
1413
+ setup(store, api) {
1414
+ const plugin = this.pluginFactory(this.injector);
1415
+ return plugin.setup(store, api);
1416
+ }
1417
+ dispose() {
1418
+ // Plugin cleanup handled by PluginHost
1419
+ }
1420
+ }
1421
+ function createAngularPlugin(injector, factory) {
1422
+ return new AngularPluginWrapper(injector, factory);
1423
+ }
1424
+
1425
+ function bridgeStoreSignal(store, key) {
1426
+ const angularSignal = signal(store.get(key), ...(ngDevMode ? [{ debugName: "angularSignal" }] : []));
1427
+ store.effect(`angular-bridge:${key}`, () => {
1428
+ const value = store.get(key);
1429
+ angularSignal.set(value);
1430
+ }, 'angular-bridge');
1431
+ return angularSignal.asReadonly();
1432
+ }
1433
+
1434
+ // Components
1435
+
1436
+ /**
1437
+ * Generated bundle index. Do not edit.
1438
+ */
1439
+
1440
+ export { AngularPluginWrapper, EVENT_MAP, TemplateBridgeService, ZEN_GRID_CONFIG, ZenCellTemplateDirective, ZenColumnComponent, ZenEditorTemplateDirective, ZenGridComponent, ZenGridValueAccessorDirective, ZenHeaderTemplateDirective, bridgeStoreSignal, createAngularPlugin, provideZenGrid };
1441
+ //# sourceMappingURL=zengrid-angular.mjs.map