@unshape/grid-angular 0.0.708

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,1563 @@
1
+ import * as i0 from '@angular/core';
2
+ import { effect, Directive, Injectable, inject, signal, Injector, input, runInInjectionContext, ContentChild, ChangeDetectionStrategy, Component, ContentChildren, ViewChild, HostBinding, NgModule } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import { Grid } from '@unshape/grid';
5
+
6
+ function effectSkipFirst(fn) {
7
+ let first = true;
8
+ return effect(() => {
9
+ // Always execute fn, so it reads signals and establishes tracking
10
+ fn(first);
11
+ first = false;
12
+ });
13
+ }
14
+
15
+ function gridIdInputEffect(value, grid) {
16
+ return effectSkipFirst((isInitial) => {
17
+ const id = value();
18
+ if (isInitial)
19
+ return;
20
+ if (grid)
21
+ grid.api.setGridId(id);
22
+ });
23
+ }
24
+
25
+ function dataInputEffect(value, grid) {
26
+ return effectSkipFirst((isInitial) => {
27
+ const data = value();
28
+ if (isInitial)
29
+ return;
30
+ if (grid)
31
+ grid.api.setData(data);
32
+ });
33
+ }
34
+
35
+ function columnInputEffect(value, grid) {
36
+ return effectSkipFirst((isInitial) => {
37
+ const columns = value();
38
+ if (isInitial)
39
+ return;
40
+ if (grid)
41
+ grid.api.setColumns(columns);
42
+ });
43
+ }
44
+
45
+ function loadingInputEffect(value, grid) {
46
+ return effect(() => {
47
+ grid.api.setLoading(value());
48
+ });
49
+ }
50
+
51
+ function resizableInputEffect(value, grid) {
52
+ return effectSkipFirst((isInitial) => {
53
+ const resizable = value();
54
+ if (isInitial)
55
+ return;
56
+ if (grid)
57
+ grid.api.setResizable(resizable);
58
+ });
59
+ }
60
+
61
+ function resizeModeInputEffect(value, grid) {
62
+ return effectSkipFirst((isInitial) => {
63
+ const resizeMode = value();
64
+ if (isInitial)
65
+ return;
66
+ if (grid)
67
+ grid.api.setResizeMode(resizeMode);
68
+ });
69
+ }
70
+
71
+ function toggleVisibilityInputEffect(key, value, columnService) {
72
+ return effectSkipFirst((isInitial) => {
73
+ const visible = value();
74
+ if (isInitial)
75
+ return;
76
+ const grid = columnService.grid();
77
+ if (!grid)
78
+ return;
79
+ const { enableAnimations } = grid._store.getState().view;
80
+ if (enableAnimations) {
81
+ visible
82
+ ? grid.api.showColumnAnimated(key)
83
+ : grid.api.hideColumnAnimated(key);
84
+ }
85
+ else {
86
+ grid.api.setColumnVisible(key, visible);
87
+ }
88
+ });
89
+ }
90
+
91
+ function enableAnimationsInputEffect(value, grid) {
92
+ return effectSkipFirst((isInitial) => {
93
+ const enableAnimations = value();
94
+ if (isInitial)
95
+ return;
96
+ if (grid)
97
+ grid.api.setEnableAnimations(enableAnimations);
98
+ });
99
+ }
100
+
101
+ function filterableInputEffect(value, grid) {
102
+ return effectSkipFirst((isInitial) => {
103
+ const filterable = value();
104
+ if (isInitial)
105
+ return;
106
+ if (grid)
107
+ grid.api.setFilterable(filterable);
108
+ });
109
+ }
110
+
111
+ function sortSettingsInputEffect(value, grid) {
112
+ return effectSkipFirst((isInitial) => {
113
+ const sortSettings = value();
114
+ if (isInitial)
115
+ return;
116
+ if (grid)
117
+ grid.api.setSortSettings(sortSettings);
118
+ });
119
+ }
120
+
121
+ function showFooterInputEffect(value, grid) {
122
+ return effectSkipFirst((isInitial) => {
123
+ const showFooter = value();
124
+ if (isInitial)
125
+ return;
126
+ if (grid)
127
+ grid.api.setShowFooter(showFooter);
128
+ });
129
+ }
130
+
131
+ function localeInputEffect(value, grid) {
132
+ return effectSkipFirst((isInitial) => {
133
+ const locale = value();
134
+ if (isInitial)
135
+ return;
136
+ if (grid)
137
+ grid.api.setLocale(locale);
138
+ });
139
+ }
140
+
141
+ function groupableInputEffect(value, grid) {
142
+ return effectSkipFirst((isInitial) => {
143
+ const groupable = value();
144
+ if (isInitial)
145
+ return;
146
+ if (grid)
147
+ grid.api.setGroupable(groupable);
148
+ });
149
+ }
150
+
151
+ function animationOptionsInputEffect(value, grid) {
152
+ return effectSkipFirst((isInitial) => {
153
+ const animOptions = value();
154
+ if (isInitial)
155
+ return;
156
+ if (grid)
157
+ grid.api.setAnimationOptions(animOptions);
158
+ });
159
+ }
160
+
161
+ function pageableInputEffect(value, grid) {
162
+ return effectSkipFirst((isInitial) => {
163
+ const pageable = value();
164
+ if (isInitial)
165
+ return;
166
+ if (grid)
167
+ grid.api.setPageable(pageable);
168
+ });
169
+ }
170
+
171
+ function selectableInputEffect(value, grid) {
172
+ return effectSkipFirst((isInitial) => {
173
+ const selectable = value();
174
+ if (isInitial)
175
+ return;
176
+ if (grid)
177
+ grid.api.setSelectable(selectable);
178
+ });
179
+ }
180
+
181
+ function showStatusBarInputEffect(value, grid) {
182
+ return effectSkipFirst((isInitial) => {
183
+ const showStatusBar = value();
184
+ if (isInitial)
185
+ return;
186
+ if (grid)
187
+ grid.api.setShowStatusBar(showStatusBar);
188
+ });
189
+ }
190
+
191
+ function columnMenuInputEffect(value, grid) {
192
+ return effectSkipFirst((isInitial) => {
193
+ const columnMenu = value();
194
+ if (isInitial)
195
+ return;
196
+ if (grid)
197
+ grid.api.setColumnMenu(columnMenu);
198
+ });
199
+ }
200
+
201
+ function allowColumnReorderInputEffect(value, grid) {
202
+ return effectSkipFirst((isInitial) => {
203
+ const allowColumnReorder = value();
204
+ if (isInitial)
205
+ return;
206
+ if (grid)
207
+ grid.api.setAllowColumnReorder(allowColumnReorder);
208
+ });
209
+ }
210
+
211
+ function showToolBarInputEffect(value, grid) {
212
+ return effectSkipFirst((isInitial) => {
213
+ const showToolBar = value();
214
+ if (isInitial)
215
+ return;
216
+ if (grid)
217
+ grid.api.setShowToolBar(showToolBar);
218
+ });
219
+ }
220
+
221
+ function toolBarRendererInputEffect(value, grid) {
222
+ return effectSkipFirst((isInitial) => {
223
+ const toolBarRenderer = value();
224
+ if (isInitial)
225
+ return;
226
+ if (grid)
227
+ grid.api.setToolBarRenderer(toolBarRenderer);
228
+ });
229
+ }
230
+
231
+ function editableInputEffect(value, grid) {
232
+ return effectSkipFirst((isInitial) => {
233
+ const editable = value();
234
+ if (isInitial)
235
+ return;
236
+ if (grid)
237
+ grid.api.setEditable(editable);
238
+ });
239
+ }
240
+
241
+ function editingEventsInputEffect(value, grid) {
242
+ return effectSkipFirst((isInitial) => {
243
+ const editingEvents = value();
244
+ if (isInitial)
245
+ return;
246
+ if (grid)
247
+ grid.api.setEditingEvents(editingEvents);
248
+ });
249
+ }
250
+
251
+ function schemaInputEffect(value, grid) {
252
+ return effectSkipFirst((isInitial) => {
253
+ const schema = value();
254
+ if (isInitial)
255
+ return;
256
+ if (grid)
257
+ grid.api.setSchema(schema);
258
+ });
259
+ }
260
+
261
+ function rowEditingEventsInputEffect(value, grid) {
262
+ return effectSkipFirst((isInitial) => {
263
+ const rowEditingEvents = value();
264
+ if (isInitial)
265
+ return;
266
+ if (grid)
267
+ grid.api.setRowEditingEvents(rowEditingEvents);
268
+ });
269
+ }
270
+
271
+ function rowEventsInputEffect(value, grid) {
272
+ return effectSkipFirst((isInitial) => {
273
+ const rowEvents = value();
274
+ if (isInitial)
275
+ return;
276
+ if (grid)
277
+ grid.api.setRowEvents(rowEvents);
278
+ });
279
+ }
280
+
281
+ function newRowEventsInputEffect(value, grid) {
282
+ return effectSkipFirst((isInitial) => {
283
+ const newRowEvents = value();
284
+ if (isInitial)
285
+ return;
286
+ if (grid)
287
+ grid.api.setNewRowEvents(newRowEvents);
288
+ });
289
+ }
290
+
291
+ function rowFormatInputEffect(value, grid) {
292
+ return effectSkipFirst((isInitial) => {
293
+ const rowFormat = value();
294
+ if (isInitial)
295
+ return;
296
+ if (grid)
297
+ grid.api.setRowFormat(rowFormat);
298
+ });
299
+ }
300
+
301
+ function copyInputEffect(value, grid) {
302
+ return effectSkipFirst((isInitial) => {
303
+ const copy = value();
304
+ if (isInitial)
305
+ return;
306
+ if (grid)
307
+ grid.api.setCopySettings(copy);
308
+ });
309
+ }
310
+
311
+ function pasteInputEffect(value, grid) {
312
+ return effectSkipFirst((isInitial) => {
313
+ const paste = value();
314
+ if (isInitial)
315
+ return;
316
+ if (grid)
317
+ grid.api.setPasteSettings(paste);
318
+ });
319
+ }
320
+
321
+ function clipboardEventsInputEffect(value, grid) {
322
+ return effectSkipFirst((isInitial) => {
323
+ const clipboardEvents = value();
324
+ if (isInitial)
325
+ return;
326
+ if (grid)
327
+ grid.api.setClipboardEvents(clipboardEvents);
328
+ });
329
+ }
330
+
331
+ class UnshapeGridNoDataTemplateDirective {
332
+ template;
333
+ constructor(template) {
334
+ this.template = template;
335
+ }
336
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridNoDataTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
337
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridNoDataTemplateDirective, isStandalone: true, selector: "[unshapeGridNoDataTemplate]", ngImport: i0 });
338
+ }
339
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridNoDataTemplateDirective, decorators: [{
340
+ type: Directive,
341
+ args: [{
342
+ selector: "[unshapeGridNoDataTemplate]",
343
+ }]
344
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
345
+
346
+ class UnshapeGridLoadingTemplateDirective {
347
+ template;
348
+ constructor(template) {
349
+ this.template = template;
350
+ }
351
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridLoadingTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
352
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridLoadingTemplateDirective, isStandalone: true, selector: "[unshapeGridLoadingTemplate]", ngImport: i0 });
353
+ }
354
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridLoadingTemplateDirective, decorators: [{
355
+ type: Directive,
356
+ args: [{
357
+ selector: "[unshapeGridLoadingTemplate]",
358
+ }]
359
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
360
+
361
+ class UnshapeGridGroupColumnTemplateDirective {
362
+ template;
363
+ constructor(template) {
364
+ this.template = template;
365
+ }
366
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridGroupColumnTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
367
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridGroupColumnTemplateDirective, isStandalone: true, selector: "[unshapeGridGroupColumnTemplate]", ngImport: i0 });
368
+ }
369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridGroupColumnTemplateDirective, decorators: [{
370
+ type: Directive,
371
+ args: [{
372
+ selector: "[unshapeGridGroupColumnTemplate]",
373
+ }]
374
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
375
+
376
+ class UnshapeGridGroupHeaderTemplateDirective {
377
+ template;
378
+ constructor(template) {
379
+ this.template = template;
380
+ }
381
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridGroupHeaderTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
382
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridGroupHeaderTemplateDirective, isStandalone: true, selector: "[unshapeGridGroupHeaderTemplate]", ngImport: i0 });
383
+ }
384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridGroupHeaderTemplateDirective, decorators: [{
385
+ type: Directive,
386
+ args: [{
387
+ selector: "[unshapeGridGroupHeaderTemplate]",
388
+ }]
389
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
390
+
391
+ class UnshapeGridStatusBarTemplateDirective {
392
+ template;
393
+ constructor(template) {
394
+ this.template = template;
395
+ }
396
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridStatusBarTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
397
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridStatusBarTemplateDirective, isStandalone: true, selector: "[unshapeGridStatusBarTemplate]", ngImport: i0 });
398
+ }
399
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridStatusBarTemplateDirective, decorators: [{
400
+ type: Directive,
401
+ args: [{
402
+ selector: "[unshapeGridStatusBarTemplate]",
403
+ }]
404
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
405
+
406
+ class UnshapeGridToolBarTemplateDirective {
407
+ template;
408
+ constructor(template) {
409
+ this.template = template;
410
+ }
411
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridToolBarTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
412
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridToolBarTemplateDirective, isStandalone: true, selector: "[unshapeGridToolBarTemplate]", ngImport: i0 });
413
+ }
414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridToolBarTemplateDirective, decorators: [{
415
+ type: Directive,
416
+ args: [{
417
+ selector: "[unshapeGridToolBarTemplate]",
418
+ }]
419
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
420
+
421
+ class UnshapeGridErrorTemplateDirective {
422
+ template;
423
+ constructor(template) {
424
+ this.template = template;
425
+ }
426
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridErrorTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
427
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridErrorTemplateDirective, isStandalone: true, selector: "[unshapeGridErrorTemplate]", ngImport: i0 });
428
+ }
429
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridErrorTemplateDirective, decorators: [{
430
+ type: Directive,
431
+ args: [{
432
+ selector: "[unshapeGridErrorTemplate]",
433
+ }]
434
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
435
+
436
+ class TemplateMountService {
437
+ appRef;
438
+ constructor(appRef) {
439
+ this.appRef = appRef;
440
+ }
441
+ mount(template, container, context) {
442
+ const viewRef = template.createEmbeddedView(context);
443
+ this.appRef.attachView(viewRef);
444
+ viewRef.detectChanges();
445
+ const frag = document.createDocumentFragment();
446
+ for (const node of viewRef.rootNodes)
447
+ frag.appendChild(node);
448
+ container.appendChild(frag);
449
+ return {
450
+ update: (partial) => {
451
+ Object.assign(viewRef.context, partial);
452
+ viewRef.detectChanges();
453
+ },
454
+ destroy: () => {
455
+ this.appRef.detachView(viewRef);
456
+ viewRef.destroy();
457
+ },
458
+ viewRef,
459
+ };
460
+ }
461
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TemplateMountService, deps: [{ token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable });
462
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TemplateMountService, providedIn: "root" });
463
+ }
464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TemplateMountService, decorators: [{
465
+ type: Injectable,
466
+ args: [{ providedIn: "root" }]
467
+ }], ctorParameters: () => [{ type: i0.ApplicationRef }] });
468
+
469
+ function renderNoDataTemplate(req, template, templateMountService) {
470
+ if (!template)
471
+ return null;
472
+ const ctx = {
473
+ $implicit: req.context,
474
+ context: req.context,
475
+ };
476
+ return templateMountService.mount(template, req.container, ctx);
477
+ }
478
+
479
+ function renderLoadingTemplate(req, template, templateMountService) {
480
+ if (!template)
481
+ return null;
482
+ const ctx = {
483
+ $implicit: req.context,
484
+ context: req.context,
485
+ };
486
+ return templateMountService.mount(template, req.container, ctx);
487
+ }
488
+
489
+ function renderErrorTemplate(req, template, templateMountService) {
490
+ if (!template)
491
+ return null;
492
+ const ctx = {
493
+ $implicit: req.context,
494
+ title: req.context.title,
495
+ message: req.context.message,
496
+ };
497
+ return templateMountService.mount(template, req.container, ctx);
498
+ }
499
+
500
+ function renderColumnHeaderTemplate(req, template, templateMountService) {
501
+ if (!template)
502
+ return null;
503
+ const ctx = {
504
+ $implicit: req.context,
505
+ field: req.context.field,
506
+ header: req.context.header,
507
+ columnKey: req.context.columnKey,
508
+ columnId: req.context.columnId,
509
+ };
510
+ return templateMountService.mount(template, req.container, ctx);
511
+ }
512
+
513
+ function renderColumnFooterTemplate(req, template, templateMountService) {
514
+ if (!template)
515
+ return null;
516
+ const ctx = {
517
+ $implicit: req.context,
518
+ field: req.context.field,
519
+ header: req.context.header,
520
+ columnKey: req.context.columnKey,
521
+ columnId: req.context.columnId,
522
+ values: req.context.values,
523
+ rows: req.context.rows,
524
+ };
525
+ return templateMountService.mount(template, req.container, ctx);
526
+ }
527
+
528
+ function renderColumnCellTemplate(req, template, templateMountService) {
529
+ if (!template)
530
+ return null;
531
+ const ctx = {
532
+ $implicit: req.context,
533
+ row: req.context.row,
534
+ value: req.context.value,
535
+ field: req.context.field,
536
+ header: req.context.header,
537
+ columnKey: req.context.columnKey,
538
+ columnId: req.context.columnId,
539
+ rowIndex: req.context.rowIndex,
540
+ };
541
+ return templateMountService.mount(template, req.container, ctx);
542
+ }
543
+
544
+ function renderGroupColumnTemplate(req, template, templateMountService) {
545
+ if (!template)
546
+ return null;
547
+ const ctx = {
548
+ $implicit: req.context,
549
+ column: req.context.column,
550
+ group: req.context.group,
551
+ aggregate: req.context.aggregate,
552
+ };
553
+ return templateMountService.mount(template, req.container, ctx);
554
+ }
555
+
556
+ function renderGroupHeaderCellTemplate(req, template, templateMountService) {
557
+ if (!template)
558
+ return null;
559
+ const ctx = {
560
+ $implicit: req.context,
561
+ column: req.context.column,
562
+ group: req.context.group,
563
+ aggregate: req.context.aggregate,
564
+ };
565
+ return templateMountService.mount(template, req.container, ctx);
566
+ }
567
+
568
+ function renderGroupHeaderTemplate(req, template, templateMountService) {
569
+ if (!template)
570
+ return null;
571
+ const ctx = {
572
+ $implicit: req.context,
573
+ column: req.context.column,
574
+ group: req.context.group,
575
+ aggregate: req.context.aggregate,
576
+ };
577
+ return templateMountService.mount(template, req.container, ctx);
578
+ }
579
+
580
+ function renderGroupFooterCellTemplate(req, template, templateMountService) {
581
+ if (!template)
582
+ return null;
583
+ const ctx = {
584
+ $implicit: req.context,
585
+ column: req.context.column,
586
+ group: req.context.group,
587
+ aggregate: req.context.aggregate,
588
+ };
589
+ return templateMountService.mount(template, req.container, ctx);
590
+ }
591
+
592
+ function renderStatusBarTemplate(req, template, templateMountService) {
593
+ if (!template)
594
+ return null;
595
+ const ctx = {
596
+ $implicit: req.context,
597
+ statusBar: req.context,
598
+ };
599
+ return templateMountService.mount(template, req.container, ctx);
600
+ }
601
+
602
+ function renderToolBarTemplate(req, template, templateMountService) {
603
+ if (!template)
604
+ return null;
605
+ const ctx = {
606
+ $implicit: req.context,
607
+ context: req.context,
608
+ };
609
+ return templateMountService.mount(template, req.container, ctx);
610
+ }
611
+
612
+ class RendererAdapterFactory {
613
+ templateMountService = inject(TemplateMountService);
614
+ buildAdapter(templates) {
615
+ const headerTemplates = new Map();
616
+ const footerTemplates = new Map();
617
+ const cellTemplates = new Map();
618
+ const groupHeaderCellTemplates = new Map();
619
+ const groupFooterCellTemplates = new Map();
620
+ return {
621
+ renderNoDataTemplate: (req) => renderNoDataTemplate(req, templates.noData, this.templateMountService),
622
+ renderLoadingTemplate: (req) => renderLoadingTemplate(req, templates.loading, this.templateMountService),
623
+ renderErrorTemplate: (req) => renderErrorTemplate(req, templates.error, this.templateMountService),
624
+ renderGroupColumnTemplate: (req) => renderGroupColumnTemplate(req, templates.groupColumn, this.templateMountService),
625
+ renderGroupHeaderTemplate: (req) => renderGroupHeaderTemplate(req, templates.groupHeader, this.templateMountService),
626
+ renderColumnHeaderTemplate: (req) => {
627
+ const tpl = headerTemplates.get(req.context.columnKey);
628
+ return renderColumnHeaderTemplate(req, tpl, this.templateMountService);
629
+ },
630
+ registerColumnHeaderTemplate: (key, tpl) => {
631
+ headerTemplates.set(key, tpl);
632
+ },
633
+ renderColumnFooterTemplate: (req) => {
634
+ const tpl = footerTemplates.get(req.context.columnKey);
635
+ return renderColumnFooterTemplate(req, tpl, this.templateMountService);
636
+ },
637
+ registerColumnFooterTemplate: (key, tpl) => {
638
+ footerTemplates.set(key, tpl);
639
+ },
640
+ renderColumnCellTemplate: (req) => {
641
+ const tpl = cellTemplates.get(req.context.columnKey);
642
+ return renderColumnCellTemplate(req, tpl, this.templateMountService);
643
+ },
644
+ registerColumnCellTemplate: (key, tpl) => {
645
+ cellTemplates.set(key, tpl);
646
+ },
647
+ renderGroupHeaderCellTemplate: (req) => {
648
+ const tpl = groupHeaderCellTemplates.get(req.context.columnKey);
649
+ return renderGroupHeaderCellTemplate(req, tpl, this.templateMountService);
650
+ },
651
+ registerGroupHeaderCellTemplate: (key, tpl) => {
652
+ groupHeaderCellTemplates.set(key, tpl);
653
+ },
654
+ renderGroupFooterCellTemplate: (req) => {
655
+ const tpl = groupFooterCellTemplates.get(req.context.columnKey);
656
+ return renderGroupFooterCellTemplate(req, tpl, this.templateMountService);
657
+ },
658
+ registerGroupFooterCellTemplate: (key, tpl) => {
659
+ groupFooterCellTemplates.set(key, tpl);
660
+ },
661
+ renderStatusBarTemplate: (req) => renderStatusBarTemplate(req, templates.statusBar, this.templateMountService),
662
+ renderToolBarTemplate: (req) => renderToolBarTemplate(req, templates.toolBar, this.templateMountService),
663
+ };
664
+ }
665
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: RendererAdapterFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
666
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: RendererAdapterFactory, providedIn: "root" });
667
+ }
668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: RendererAdapterFactory, decorators: [{
669
+ type: Injectable,
670
+ args: [{ providedIn: "root" }]
671
+ }] });
672
+
673
+ function extractNoDataTemplate(dir) {
674
+ return dir?.template;
675
+ }
676
+
677
+ function extractLoadingTemplate(dir) {
678
+ return dir?.template;
679
+ }
680
+
681
+ function extractErrorTemplate(dir) {
682
+ return dir?.template;
683
+ }
684
+
685
+ function extractGroupColumnTemplate(dir) {
686
+ return dir?.template;
687
+ }
688
+
689
+ function extractGroupHeaderTemplate(dir) {
690
+ return dir?.template;
691
+ }
692
+
693
+ function extractStatusBarTemplate(dir) {
694
+ return dir?.template;
695
+ }
696
+
697
+ function extractToolBarTemplate(dir) {
698
+ return dir?.template;
699
+ }
700
+
701
+ class TemplateCollectorService {
702
+ collect(noDataTplDir, loadingTplDir, errorTplDir, groupColumnTplDir, groupHeaderTplDir, statusBarTplDir, toolBarTplDir) {
703
+ return {
704
+ noData: extractNoDataTemplate(noDataTplDir),
705
+ loading: extractLoadingTemplate(loadingTplDir),
706
+ error: extractErrorTemplate(errorTplDir),
707
+ groupColumn: extractGroupColumnTemplate(groupColumnTplDir),
708
+ groupHeader: extractGroupHeaderTemplate(groupHeaderTplDir),
709
+ statusBar: extractStatusBarTemplate(statusBarTplDir),
710
+ toolBar: extractToolBarTemplate(toolBarTplDir),
711
+ };
712
+ }
713
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TemplateCollectorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
714
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TemplateCollectorService, providedIn: "root" });
715
+ }
716
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: TemplateCollectorService, decorators: [{
717
+ type: Injectable,
718
+ args: [{ providedIn: "root" }]
719
+ }] });
720
+
721
+ function collectProjectedColumns(projectedColumns) {
722
+ const columns = [];
723
+ for (const projCol of projectedColumns) {
724
+ const col = {
725
+ header: projCol.header(),
726
+ field: projCol.field(),
727
+ width: projCol.width(),
728
+ minWidth: projCol.minWidth(),
729
+ maxWidth: projCol.maxWidth() ?? Infinity,
730
+ visible: projCol.visible(),
731
+ sortable: projCol.sortable(),
732
+ filterEditor: projCol.filterEditor() ?? projCol.filterEditorFromTemplate,
733
+ pinned: projCol.pinned(),
734
+ columnMenu: projCol.columnMenu(),
735
+ cellEditor: projCol.cellEditor() ?? projCol.cellEditorFromTemplate,
736
+ filterable: projCol.filterable(),
737
+ isNonData: projCol.isNonData(),
738
+ align: projCol.align(),
739
+ numberFormatOptions: projCol.numberFormatOptions(),
740
+ dateFormatOptions: projCol.dateFormatOptions(),
741
+ booleanFormatOptions: projCol.booleanFormatOptions(),
742
+ formatter: projCol.formatter(),
743
+ cellFormat: projCol.cellFormat?.() ?? undefined,
744
+ columnStyle: projCol.columnStyle(),
745
+ copyCellRenderer: projCol.copyCellRenderer(),
746
+ copyGroupHeaderCellRenderer: projCol.copyGroupHeaderCellRenderer(),
747
+ copyGroupFooterCellRenderer: projCol.copyGroupFooterCellRenderer(),
748
+ };
749
+ columns.push(col);
750
+ }
751
+ return columns;
752
+ }
753
+
754
+ class ColumnService {
755
+ _grid = signal(null, ...(ngDevMode ? [{ debugName: "_grid" }] : /* istanbul ignore next */ []));
756
+ grid = this._grid.asReadonly();
757
+ adapter;
758
+ pendingHeaderTemplates = new Map();
759
+ pendingFooterTemplates = new Map();
760
+ pendingCellTemplates = new Map();
761
+ pendingGroupHeaderCellTemplates = new Map();
762
+ pendingGroupFooterCellTemplates = new Map();
763
+ setGrid(grid) {
764
+ this._grid.set(grid);
765
+ }
766
+ setAdapter(adapter) {
767
+ this.adapter = adapter;
768
+ // flush pending templates into the adapter
769
+ this.pendingHeaderTemplates.forEach((tpl, key) => {
770
+ this.adapter.registerColumnHeaderTemplate?.(key, tpl);
771
+ });
772
+ this.pendingHeaderTemplates.clear();
773
+ this.pendingFooterTemplates.forEach((tpl, key) => {
774
+ this.adapter.registerColumnFooterTemplate?.(key, tpl);
775
+ });
776
+ this.pendingFooterTemplates.clear();
777
+ this.pendingCellTemplates.forEach((tpl, key) => {
778
+ this.adapter.registerColumnCellTemplate?.(key, tpl);
779
+ });
780
+ this.pendingCellTemplates.clear();
781
+ this.pendingGroupHeaderCellTemplates.forEach((tpl, key) => {
782
+ this.adapter.registerGroupHeaderCellTemplate?.(key, tpl);
783
+ });
784
+ this.pendingGroupHeaderCellTemplates.clear();
785
+ this.pendingGroupFooterCellTemplates.forEach((tpl, key) => {
786
+ this.adapter.registerGroupFooterCellTemplate?.(key, tpl);
787
+ });
788
+ this.pendingGroupFooterCellTemplates.clear();
789
+ }
790
+ registerHeaderTemplate(key, tpl) {
791
+ if (this.adapter) {
792
+ this.adapter.registerColumnHeaderTemplate?.(key, tpl);
793
+ }
794
+ else {
795
+ this.pendingHeaderTemplates.set(key, tpl);
796
+ }
797
+ }
798
+ registerFooterTemplate(key, tpl) {
799
+ if (this.adapter) {
800
+ this.adapter.registerColumnFooterTemplate?.(key, tpl);
801
+ }
802
+ else {
803
+ this.pendingFooterTemplates.set(key, tpl);
804
+ }
805
+ }
806
+ registerCellTemplate(key, tpl) {
807
+ if (this.adapter) {
808
+ this.adapter.registerColumnCellTemplate?.(key, tpl);
809
+ }
810
+ else {
811
+ this.pendingCellTemplates.set(key, tpl);
812
+ }
813
+ }
814
+ registerGroupHeaderCellTemplate(key, tpl) {
815
+ if (this.adapter) {
816
+ this.adapter.registerGroupHeaderCellTemplate?.(key, tpl);
817
+ }
818
+ else {
819
+ this.pendingGroupHeaderCellTemplates.set(key, tpl);
820
+ }
821
+ }
822
+ registerGroupFooterCellTemplate(key, tpl) {
823
+ if (this.adapter) {
824
+ this.adapter.registerGroupFooterCellTemplate?.(key, tpl);
825
+ }
826
+ else {
827
+ this.pendingGroupFooterCellTemplates.set(key, tpl);
828
+ }
829
+ }
830
+ collectProjectedColumns = collectProjectedColumns;
831
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: ColumnService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
832
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: ColumnService, providedIn: "root" });
833
+ }
834
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: ColumnService, decorators: [{
835
+ type: Injectable,
836
+ args: [{ providedIn: "root" }]
837
+ }] });
838
+
839
+ class UnshapeGridColumnHeaderTemplateDirective {
840
+ template;
841
+ constructor(template) {
842
+ this.template = template;
843
+ }
844
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridColumnHeaderTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
845
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridColumnHeaderTemplateDirective, isStandalone: true, selector: "[unshapeGridColumnHeaderTemplate]", ngImport: i0 });
846
+ }
847
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridColumnHeaderTemplateDirective, decorators: [{
848
+ type: Directive,
849
+ args: [{
850
+ selector: "[unshapeGridColumnHeaderTemplate]",
851
+ }]
852
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
853
+
854
+ class UnshapeGridColumnFooterTemplateDirective {
855
+ template;
856
+ constructor(template) {
857
+ this.template = template;
858
+ }
859
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridColumnFooterTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
860
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridColumnFooterTemplateDirective, isStandalone: true, selector: "[unshapeGridColumnFooterTemplate]", ngImport: i0 });
861
+ }
862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridColumnFooterTemplateDirective, decorators: [{
863
+ type: Directive,
864
+ args: [{
865
+ selector: "[unshapeGridColumnFooterTemplate]",
866
+ }]
867
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
868
+
869
+ class UnshapeGridColumnCellTemplateDirective {
870
+ template;
871
+ constructor(template) {
872
+ this.template = template;
873
+ }
874
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridColumnCellTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
875
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridColumnCellTemplateDirective, isStandalone: true, selector: "[unshapeGridColumnCellTemplate]", ngImport: i0 });
876
+ }
877
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridColumnCellTemplateDirective, decorators: [{
878
+ type: Directive,
879
+ args: [{
880
+ selector: "[unshapeGridColumnCellTemplate]",
881
+ }]
882
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
883
+
884
+ class UnshapeGridFilterCellTemplateDirective {
885
+ template;
886
+ constructor(template) {
887
+ this.template = template;
888
+ }
889
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridFilterCellTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
890
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridFilterCellTemplateDirective, isStandalone: true, selector: "[unshapeGridFilterCellTemplate]", ngImport: i0 });
891
+ }
892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridFilterCellTemplateDirective, decorators: [{
893
+ type: Directive,
894
+ args: [{
895
+ selector: "[unshapeGridFilterCellTemplate]",
896
+ }]
897
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
898
+
899
+ class UnshapeGridGroupHeaderCellTemplateDirective {
900
+ template;
901
+ constructor(template) {
902
+ this.template = template;
903
+ }
904
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridGroupHeaderCellTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
905
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridGroupHeaderCellTemplateDirective, isStandalone: true, selector: "[unshapeGridGroupHeaderCellTemplate]", ngImport: i0 });
906
+ }
907
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridGroupHeaderCellTemplateDirective, decorators: [{
908
+ type: Directive,
909
+ args: [{
910
+ selector: "[unshapeGridGroupHeaderCellTemplate]",
911
+ }]
912
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
913
+
914
+ class UnshapeGridGroupFooterCellTemplateDirective {
915
+ template;
916
+ constructor(template) {
917
+ this.template = template;
918
+ }
919
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridGroupFooterCellTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
920
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridGroupFooterCellTemplateDirective, isStandalone: true, selector: "[unshapeGridGroupFooterCellTemplate]", ngImport: i0 });
921
+ }
922
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridGroupFooterCellTemplateDirective, decorators: [{
923
+ type: Directive,
924
+ args: [{
925
+ selector: "[unshapeGridGroupFooterCellTemplate]",
926
+ }]
927
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
928
+
929
+ class UnshapeGridEditorCellTemplateDirective {
930
+ template;
931
+ constructor(template) {
932
+ this.template = template;
933
+ }
934
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridEditorCellTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
935
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.23", type: UnshapeGridEditorCellTemplateDirective, isStandalone: true, selector: "[unshapeGridEditorCellTemplate]", ngImport: i0 });
936
+ }
937
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridEditorCellTemplateDirective, decorators: [{
938
+ type: Directive,
939
+ args: [{
940
+ selector: "[unshapeGridEditorCellTemplate]",
941
+ }]
942
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
943
+
944
+ class TemplateFilterEditorWrapper {
945
+ template;
946
+ mountService;
947
+ element;
948
+ controlElement;
949
+ onChangeCb = null;
950
+ onClearCb = null;
951
+ viewRef;
952
+ constructor(template, mountService) {
953
+ this.template = template;
954
+ this.mountService = mountService;
955
+ }
956
+ mount(mount) {
957
+ const ctx = {
958
+ // static
959
+ field: mount.context.field,
960
+ header: mount.context.header,
961
+ columnKey: mount.context.columnKey,
962
+ columnId: mount.context.columnId,
963
+ // dynamic
964
+ value: signal(mount.context.value),
965
+ disabled: signal(mount.context.disabled),
966
+ operator: signal(mount.context.operator),
967
+ // callbacks
968
+ update: (v) => this.onChangeCb?.(v),
969
+ clear: () => this.onClearCb?.(),
970
+ };
971
+ const handle = this.mountService.mount(this.template, mount.container, ctx);
972
+ this.viewRef = handle.viewRef;
973
+ const host = this.viewRef.rootNodes.find((n) => n instanceof HTMLElement);
974
+ // The container is the root element
975
+ this.element = host;
976
+ // Find the actual editor element inside the template
977
+ this.controlElement = host.querySelector("[data-editor]");
978
+ if (!this.controlElement) {
979
+ // fallback: assume the container itself is the control
980
+ this.controlElement = this.element;
981
+ }
982
+ }
983
+ // Grid → template
984
+ setValue(value) {
985
+ if (!this.viewRef)
986
+ return;
987
+ this.viewRef.context.value.set(value);
988
+ this.viewRef.detectChanges();
989
+ }
990
+ setDisabled(disabled) {
991
+ if (!this.viewRef)
992
+ return;
993
+ this.viewRef.context.disabled.set(disabled);
994
+ this.viewRef.detectChanges();
995
+ }
996
+ onValueChange(cb) {
997
+ this.onChangeCb = cb;
998
+ }
999
+ onClear(cb) {
1000
+ this.onClearCb = cb;
1001
+ }
1002
+ destroy() {
1003
+ this.viewRef?.destroy();
1004
+ }
1005
+ }
1006
+
1007
+ function templateFilterEditorFactory(template, mountService) {
1008
+ return (column, grid) => {
1009
+ // we don’t have FilterCellMount here yet
1010
+ // we just create an editor that knows how to mount itself later
1011
+ return new TemplateFilterEditorWrapper(template, mountService);
1012
+ };
1013
+ }
1014
+
1015
+ class TemplateCellEditorWrapper {
1016
+ template;
1017
+ mountService;
1018
+ element;
1019
+ controlElement;
1020
+ onChangeCb = null;
1021
+ onCommitCb = null;
1022
+ onCancelCb = null;
1023
+ viewRef;
1024
+ constructor(template, mountService) {
1025
+ this.template = template;
1026
+ this.mountService = mountService;
1027
+ }
1028
+ mount(mount) {
1029
+ const ctx = {
1030
+ // static
1031
+ field: mount.context.field,
1032
+ header: mount.context.header,
1033
+ columnKey: mount.context.columnKey,
1034
+ columnId: mount.context.columnId,
1035
+ rowId: mount.context.rowId,
1036
+ // dynamic
1037
+ value: signal(mount.context.value),
1038
+ disabled: signal(mount.context.disabled),
1039
+ // callbacks
1040
+ update: (v) => this.onChangeCb?.(v),
1041
+ commit: (v) => this.onCommitCb?.(v),
1042
+ cancel: () => this.onCancelCb?.(),
1043
+ onKeydown: (event) => this.onKeydown(event, ctx),
1044
+ };
1045
+ const handle = this.mountService.mount(this.template, mount.container, ctx);
1046
+ this.viewRef = handle.viewRef;
1047
+ const host = this.viewRef.rootNodes.find((n) => n instanceof HTMLElement);
1048
+ // The container is the root element
1049
+ this.element = host;
1050
+ // Find the actual editor element inside the template
1051
+ this.controlElement = host.querySelector("[data-editor]");
1052
+ if (!this.controlElement) {
1053
+ // fallback: assume the container itself is the control
1054
+ this.controlElement = this.element;
1055
+ }
1056
+ }
1057
+ // Grid → template
1058
+ setValue(value) {
1059
+ if (!this.viewRef)
1060
+ return;
1061
+ this.viewRef.context.value.set(value);
1062
+ this.viewRef.detectChanges();
1063
+ }
1064
+ setDisabled(disabled) {
1065
+ if (!this.viewRef)
1066
+ return;
1067
+ this.viewRef.context.disabled.set(disabled);
1068
+ this.viewRef.detectChanges();
1069
+ }
1070
+ onValueChange(cb) {
1071
+ this.onChangeCb = cb;
1072
+ }
1073
+ onCommit(cb) {
1074
+ this.onCommitCb = cb;
1075
+ }
1076
+ onCancel(cb) {
1077
+ this.onCancelCb = cb;
1078
+ }
1079
+ onKeydown(event, ctx) {
1080
+ if (event.key === "Enter") {
1081
+ event.preventDefault();
1082
+ ctx.commit(ctx.value());
1083
+ }
1084
+ if (event.key === "Escape") {
1085
+ event.preventDefault();
1086
+ ctx.cancel();
1087
+ }
1088
+ }
1089
+ destroy() {
1090
+ this.viewRef?.destroy();
1091
+ }
1092
+ }
1093
+
1094
+ function templateCellEditorFactory(template, mountService) {
1095
+ return (column, rowId, grid, initialValue) => {
1096
+ // we don’t have EditorCellMount here yet
1097
+ // we just create an editor that knows how to mount itself later
1098
+ return new TemplateCellEditorWrapper(template, mountService);
1099
+ };
1100
+ }
1101
+
1102
+ class UnshapeGridColumnComponent {
1103
+ injector = inject(Injector);
1104
+ columnService = inject(ColumnService);
1105
+ templateMountService = inject(TemplateMountService);
1106
+ filterEditorFromTemplate;
1107
+ cellEditorFromTemplate;
1108
+ header = input.required(...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
1109
+ field = input.required(...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
1110
+ width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
1111
+ visible = input(true, ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
1112
+ minWidth = input(...(ngDevMode ? [undefined, { debugName: "minWidth" }] : /* istanbul ignore next */ []));
1113
+ maxWidth = input(...(ngDevMode ? [undefined, { debugName: "maxWidth" }] : /* istanbul ignore next */ []));
1114
+ sortable = input(false, ...(ngDevMode ? [{ debugName: "sortable" }] : /* istanbul ignore next */ []));
1115
+ filterEditor = input(...(ngDevMode ? [undefined, { debugName: "filterEditor" }] : /* istanbul ignore next */ []));
1116
+ pinned = input(...(ngDevMode ? [undefined, { debugName: "pinned" }] : /* istanbul ignore next */ []));
1117
+ columnMenu = input(true, ...(ngDevMode ? [{ debugName: "columnMenu" }] : /* istanbul ignore next */ []));
1118
+ cellEditor = input(...(ngDevMode ? [undefined, { debugName: "cellEditor" }] : /* istanbul ignore next */ []));
1119
+ filterable = input(true, ...(ngDevMode ? [{ debugName: "filterable" }] : /* istanbul ignore next */ []));
1120
+ isNonData = input(false, ...(ngDevMode ? [{ debugName: "isNonData" }] : /* istanbul ignore next */ []));
1121
+ align = input(...(ngDevMode ? [undefined, { debugName: "align" }] : /* istanbul ignore next */ []));
1122
+ numberFormatOptions = input(...(ngDevMode ? [undefined, { debugName: "numberFormatOptions" }] : /* istanbul ignore next */ []));
1123
+ dateFormatOptions = input(...(ngDevMode ? [undefined, { debugName: "dateFormatOptions" }] : /* istanbul ignore next */ []));
1124
+ booleanFormatOptions = input(...(ngDevMode ? [undefined, { debugName: "booleanFormatOptions" }] : /* istanbul ignore next */ []));
1125
+ formatter = input(...(ngDevMode ? [undefined, { debugName: "formatter" }] : /* istanbul ignore next */ []));
1126
+ cellFormat = input(...(ngDevMode ? [undefined, { debugName: "cellFormat" }] : /* istanbul ignore next */ []));
1127
+ columnStyle = input(...(ngDevMode ? [undefined, { debugName: "columnStyle" }] : /* istanbul ignore next */ []));
1128
+ copyCellRenderer = input(...(ngDevMode ? [undefined, { debugName: "copyCellRenderer" }] : /* istanbul ignore next */ []));
1129
+ copyGroupHeaderCellRenderer = input(...(ngDevMode ? [undefined, { debugName: "copyGroupHeaderCellRenderer" }] : /* istanbul ignore next */ []));
1130
+ copyGroupFooterCellRenderer = input(...(ngDevMode ? [undefined, { debugName: "copyGroupFooterCellRenderer" }] : /* istanbul ignore next */ []));
1131
+ toggleVisibilityEffect;
1132
+ headerTemplateDir;
1133
+ footerTemplateDir;
1134
+ cellTemplateDir;
1135
+ filterCellTemplateDir;
1136
+ groupHeaderCellTemplateDir;
1137
+ groupFooterCellTemplateDir;
1138
+ editorCellTemplateDir;
1139
+ ngAfterViewInit() {
1140
+ runInInjectionContext(this.injector, () => {
1141
+ this.toggleVisibilityEffect = toggleVisibilityInputEffect(`${this.field()}::${this.header()}`, this.visible, this.columnService);
1142
+ });
1143
+ }
1144
+ ngAfterContentInit() {
1145
+ if (this.headerTemplateDir) {
1146
+ this.columnService.registerHeaderTemplate(`${this.field()}::${this.header()}`, this.headerTemplateDir.template);
1147
+ }
1148
+ if (this.footerTemplateDir) {
1149
+ this.columnService.registerFooterTemplate(`${this.field()}::${this.header()}`, this.footerTemplateDir.template);
1150
+ }
1151
+ if (this.cellTemplateDir) {
1152
+ this.columnService.registerCellTemplate(`${this.field()}::${this.header()}`, this.cellTemplateDir.template);
1153
+ }
1154
+ if (this.filterCellTemplateDir) {
1155
+ this.filterEditorFromTemplate = templateFilterEditorFactory(this.filterCellTemplateDir.template, this.templateMountService);
1156
+ }
1157
+ if (this.groupHeaderCellTemplateDir) {
1158
+ this.columnService.registerGroupHeaderCellTemplate(`${this.field()}::${this.header()}`, this.groupHeaderCellTemplateDir.template);
1159
+ }
1160
+ if (this.groupFooterCellTemplateDir) {
1161
+ this.columnService.registerGroupFooterCellTemplate(`${this.field()}::${this.header()}`, this.groupFooterCellTemplateDir.template);
1162
+ }
1163
+ if (this.editorCellTemplateDir) {
1164
+ this.cellEditorFromTemplate = templateCellEditorFactory(this.editorCellTemplateDir.template, this.templateMountService);
1165
+ }
1166
+ }
1167
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1168
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.23", type: UnshapeGridColumnComponent, isStandalone: true, selector: "ush-grid-column", inputs: { header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: true, transformFunction: null }, field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", 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 }, sortable: { classPropertyName: "sortable", publicName: "sortable", isSignal: true, isRequired: false, transformFunction: null }, filterEditor: { classPropertyName: "filterEditor", publicName: "filterEditor", isSignal: true, isRequired: false, transformFunction: null }, pinned: { classPropertyName: "pinned", publicName: "pinned", isSignal: true, isRequired: false, transformFunction: null }, columnMenu: { classPropertyName: "columnMenu", publicName: "columnMenu", isSignal: true, isRequired: false, transformFunction: null }, cellEditor: { classPropertyName: "cellEditor", publicName: "cellEditor", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, isNonData: { classPropertyName: "isNonData", publicName: "isNonData", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, numberFormatOptions: { classPropertyName: "numberFormatOptions", publicName: "numberFormatOptions", isSignal: true, isRequired: false, transformFunction: null }, dateFormatOptions: { classPropertyName: "dateFormatOptions", publicName: "dateFormatOptions", isSignal: true, isRequired: false, transformFunction: null }, booleanFormatOptions: { classPropertyName: "booleanFormatOptions", publicName: "booleanFormatOptions", isSignal: true, isRequired: false, transformFunction: null }, formatter: { classPropertyName: "formatter", publicName: "formatter", isSignal: true, isRequired: false, transformFunction: null }, cellFormat: { classPropertyName: "cellFormat", publicName: "cellFormat", isSignal: true, isRequired: false, transformFunction: null }, columnStyle: { classPropertyName: "columnStyle", publicName: "columnStyle", isSignal: true, isRequired: false, transformFunction: null }, copyCellRenderer: { classPropertyName: "copyCellRenderer", publicName: "copyCellRenderer", isSignal: true, isRequired: false, transformFunction: null }, copyGroupHeaderCellRenderer: { classPropertyName: "copyGroupHeaderCellRenderer", publicName: "copyGroupHeaderCellRenderer", isSignal: true, isRequired: false, transformFunction: null }, copyGroupFooterCellRenderer: { classPropertyName: "copyGroupFooterCellRenderer", publicName: "copyGroupFooterCellRenderer", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "headerTemplateDir", first: true, predicate: UnshapeGridColumnHeaderTemplateDirective, descendants: true }, { propertyName: "footerTemplateDir", first: true, predicate: UnshapeGridColumnFooterTemplateDirective, descendants: true }, { propertyName: "cellTemplateDir", first: true, predicate: UnshapeGridColumnCellTemplateDirective, descendants: true }, { propertyName: "filterCellTemplateDir", first: true, predicate: UnshapeGridFilterCellTemplateDirective, descendants: true }, { propertyName: "groupHeaderCellTemplateDir", first: true, predicate: UnshapeGridGroupHeaderCellTemplateDirective, descendants: true }, { propertyName: "groupFooterCellTemplateDir", first: true, predicate: UnshapeGridGroupFooterCellTemplateDirective, descendants: true }, { propertyName: "editorCellTemplateDir", first: true, predicate: UnshapeGridEditorCellTemplateDirective, descendants: true }], ngImport: i0, template: "", isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1169
+ }
1170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridColumnComponent, decorators: [{
1171
+ type: Component,
1172
+ args: [{
1173
+ selector: "ush-grid-column",
1174
+ imports: [CommonModule],
1175
+ template: "",
1176
+ changeDetection: ChangeDetectionStrategy.OnPush,
1177
+ }]
1178
+ }], propDecorators: { header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: true }] }], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }], sortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortable", required: false }] }], filterEditor: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterEditor", required: false }] }], pinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "pinned", required: false }] }], columnMenu: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnMenu", required: false }] }], cellEditor: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellEditor", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], isNonData: [{ type: i0.Input, args: [{ isSignal: true, alias: "isNonData", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], numberFormatOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "numberFormatOptions", required: false }] }], dateFormatOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormatOptions", required: false }] }], booleanFormatOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "booleanFormatOptions", required: false }] }], formatter: [{ type: i0.Input, args: [{ isSignal: true, alias: "formatter", required: false }] }], cellFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "cellFormat", required: false }] }], columnStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnStyle", required: false }] }], copyCellRenderer: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyCellRenderer", required: false }] }], copyGroupHeaderCellRenderer: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyGroupHeaderCellRenderer", required: false }] }], copyGroupFooterCellRenderer: [{ type: i0.Input, args: [{ isSignal: true, alias: "copyGroupFooterCellRenderer", required: false }] }], headerTemplateDir: [{
1179
+ type: ContentChild,
1180
+ args: [UnshapeGridColumnHeaderTemplateDirective]
1181
+ }], footerTemplateDir: [{
1182
+ type: ContentChild,
1183
+ args: [UnshapeGridColumnFooterTemplateDirective]
1184
+ }], cellTemplateDir: [{
1185
+ type: ContentChild,
1186
+ args: [UnshapeGridColumnCellTemplateDirective]
1187
+ }], filterCellTemplateDir: [{
1188
+ type: ContentChild,
1189
+ args: [UnshapeGridFilterCellTemplateDirective]
1190
+ }], groupHeaderCellTemplateDir: [{
1191
+ type: ContentChild,
1192
+ args: [UnshapeGridGroupHeaderCellTemplateDirective]
1193
+ }], groupFooterCellTemplateDir: [{
1194
+ type: ContentChild,
1195
+ args: [UnshapeGridGroupFooterCellTemplateDirective]
1196
+ }], editorCellTemplateDir: [{
1197
+ type: ContentChild,
1198
+ args: [UnshapeGridEditorCellTemplateDirective]
1199
+ }] } });
1200
+
1201
+ class UnshapeGridComponent {
1202
+ grid = null;
1203
+ injector = inject(Injector);
1204
+ adapterFactory = inject(RendererAdapterFactory);
1205
+ templateCollector = inject(TemplateCollectorService);
1206
+ errorType;
1207
+ columnService = inject(ColumnService);
1208
+ hostRef;
1209
+ noDataTemplateDir;
1210
+ loadingTemplateDir;
1211
+ errorTemplateDir;
1212
+ groupColumnTemplateDir;
1213
+ groupHeaderTemplateDir;
1214
+ statusBarTemplateDir;
1215
+ toolBarTemplateDir;
1216
+ projectedColumns;
1217
+ // inputs
1218
+ id = input.required(...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
1219
+ columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
1220
+ data = input([], ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
1221
+ loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
1222
+ resizable = input(false, ...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
1223
+ resizeMode = input("unconstrained", ...(ngDevMode ? [{ debugName: "resizeMode" }] : /* istanbul ignore next */ []));
1224
+ enableAnimations = input(false, ...(ngDevMode ? [{ debugName: "enableAnimations" }] : /* istanbul ignore next */ []));
1225
+ animationOptions = input({
1226
+ sort: false,
1227
+ filter: false,
1228
+ group: true,
1229
+ paging: false,
1230
+ }, ...(ngDevMode ? [{ debugName: "animationOptions" }] : /* istanbul ignore next */ []));
1231
+ filterable = input(false, ...(ngDevMode ? [{ debugName: "filterable" }] : /* istanbul ignore next */ []));
1232
+ sortSettings = input({}, ...(ngDevMode ? [{ debugName: "sortSettings" }] : /* istanbul ignore next */ []));
1233
+ showFooter = input(true, ...(ngDevMode ? [{ debugName: "showFooter" }] : /* istanbul ignore next */ []));
1234
+ locale = input(navigator.language, ...(ngDevMode ? [{ debugName: "locale" }] : /* istanbul ignore next */ []));
1235
+ groupable = input(false, ...(ngDevMode ? [{ debugName: "groupable" }] : /* istanbul ignore next */ []));
1236
+ pageable = input(false, ...(ngDevMode ? [{ debugName: "pageable" }] : /* istanbul ignore next */ []));
1237
+ selectable = input(false, ...(ngDevMode ? [{ debugName: "selectable" }] : /* istanbul ignore next */ []));
1238
+ showStatusBar = input(false, ...(ngDevMode ? [{ debugName: "showStatusBar" }] : /* istanbul ignore next */ []));
1239
+ columnMenu = input(false, ...(ngDevMode ? [{ debugName: "columnMenu" }] : /* istanbul ignore next */ []));
1240
+ allowColumnReorder = input(false, ...(ngDevMode ? [{ debugName: "allowColumnReorder" }] : /* istanbul ignore next */ []));
1241
+ showToolBar = input(false, ...(ngDevMode ? [{ debugName: "showToolBar" }] : /* istanbul ignore next */ []));
1242
+ toolBarRenderer = input(null, ...(ngDevMode ? [{ debugName: "toolBarRenderer" }] : /* istanbul ignore next */ []));
1243
+ editable = input(false, ...(ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []));
1244
+ editingEvents = input({}, ...(ngDevMode ? [{ debugName: "editingEvents" }] : /* istanbul ignore next */ []));
1245
+ schema = input({ fields: [] }, ...(ngDevMode ? [{ debugName: "schema" }] : /* istanbul ignore next */ []));
1246
+ rowEditingEvents = input({}, ...(ngDevMode ? [{ debugName: "rowEditingEvents" }] : /* istanbul ignore next */ []));
1247
+ rowEvents = input({}, ...(ngDevMode ? [{ debugName: "rowEvents" }] : /* istanbul ignore next */ []));
1248
+ newRowEvents = input({}, ...(ngDevMode ? [{ debugName: "newRowEvents" }] : /* istanbul ignore next */ []));
1249
+ rowFormat = input(null, ...(ngDevMode ? [{ debugName: "rowFormat" }] : /* istanbul ignore next */ []));
1250
+ copy = input(false, ...(ngDevMode ? [{ debugName: "copy" }] : /* istanbul ignore next */ []));
1251
+ paste = input(false, ...(ngDevMode ? [{ debugName: "paste" }] : /* istanbul ignore next */ []));
1252
+ clipboardEvents = input({}, ...(ngDevMode ? [{ debugName: "clipboardEvents" }] : /* istanbul ignore next */ []));
1253
+ // reactive effects
1254
+ gridIdEffect;
1255
+ dataEffect;
1256
+ columnEffect;
1257
+ loadingEffect;
1258
+ resizableEffect;
1259
+ resizeModeEffect;
1260
+ enableAnimationsEffect;
1261
+ animationOptionsEffect;
1262
+ filterableEffect;
1263
+ sortSettingsEffect;
1264
+ showFooterEffect;
1265
+ localeEffect;
1266
+ groupableEffect;
1267
+ pageableEffect;
1268
+ selectableEffect;
1269
+ showStatusBarEffect;
1270
+ columnMenuEffect;
1271
+ allowColumnReorderEffect;
1272
+ showToolBarEffect;
1273
+ toolBarRendererEffect;
1274
+ editableEffect;
1275
+ editingEventsEffect;
1276
+ schemaEffect;
1277
+ rowEditingEventsEffect;
1278
+ rowEventsEffect;
1279
+ newRowEventsEffect;
1280
+ rowFormatEffect;
1281
+ copyEffect;
1282
+ pasteEffect;
1283
+ clipboardEventsEffect;
1284
+ ngAfterViewInit() {
1285
+ const host = this.hostRef.nativeElement;
1286
+ const registry = this.templateCollector.collect(this.noDataTemplateDir, this.loadingTemplateDir, this.errorTemplateDir, this.groupColumnTemplateDir, this.groupHeaderTemplateDir, this.statusBarTemplateDir, this.toolBarTemplateDir);
1287
+ const adapter = this.adapterFactory.buildAdapter(registry);
1288
+ this.columnService.setAdapter(adapter);
1289
+ const projected = this.columnService.collectProjectedColumns(this.projectedColumns);
1290
+ const inputCols = this.columns();
1291
+ const finalColumns = inputCols !== undefined && inputCols !== null && inputCols.length > 0
1292
+ ? inputCols
1293
+ : projected;
1294
+ if (finalColumns.length === 0)
1295
+ this.errorType = "no-columns";
1296
+ const options = {
1297
+ id: this.id(),
1298
+ columns: finalColumns,
1299
+ data: this.data(),
1300
+ resizable: this.resizable(),
1301
+ resizeMode: this.resizeMode(),
1302
+ enableAnimations: this.enableAnimations(),
1303
+ animationOptions: this.animationOptions(),
1304
+ filterable: this.filterable(),
1305
+ sortSettings: this.sortSettings(),
1306
+ rendererAdapter: adapter,
1307
+ showFooter: this.showFooter(),
1308
+ locale: this.locale(),
1309
+ groupable: this.groupable(),
1310
+ pageable: this.pageable(),
1311
+ selectable: this.selectable(),
1312
+ showStatusBar: this.showStatusBar(),
1313
+ columnMenu: this.columnMenu(),
1314
+ allowColumnReorder: this.allowColumnReorder(),
1315
+ showToolBar: this.showToolBar(),
1316
+ toolBarRenderer: this.toolBarRenderer(),
1317
+ editable: this.editable(),
1318
+ editingEvents: this.editingEvents(),
1319
+ schema: this.schema(),
1320
+ rowEditingEvents: this.rowEditingEvents(),
1321
+ rowEvents: this.rowEvents(),
1322
+ newRowEvents: this.newRowEvents(),
1323
+ rowFormat: this.rowFormat(),
1324
+ copy: this.copy(),
1325
+ paste: this.paste(),
1326
+ clipboardEvents: this.clipboardEvents(),
1327
+ };
1328
+ this.grid = new Grid(host, options);
1329
+ this.columnService.setGrid(this.grid);
1330
+ runInInjectionContext(this.injector, () => {
1331
+ this.gridIdEffect = gridIdInputEffect(this.id, this.grid);
1332
+ this.dataEffect = dataInputEffect(this.data, this.grid);
1333
+ this.columnEffect = columnInputEffect(this.columns, this.grid);
1334
+ this.loadingEffect = loadingInputEffect(this.loading, this.grid);
1335
+ this.resizableEffect = resizableInputEffect(this.resizable, this.grid);
1336
+ this.resizeModeEffect = resizeModeInputEffect(this.resizeMode, this.grid);
1337
+ this.enableAnimationsEffect = enableAnimationsInputEffect(this.enableAnimations, this.grid);
1338
+ this.animationOptionsEffect = animationOptionsInputEffect(this.animationOptions, this.grid);
1339
+ this.filterableEffect = filterableInputEffect(this.filterable, this.grid);
1340
+ this.sortSettingsEffect = sortSettingsInputEffect(this.sortSettings, this.grid);
1341
+ this.showFooterEffect = showFooterInputEffect(this.showFooter, this.grid);
1342
+ this.localeEffect = localeInputEffect(this.locale, this.grid);
1343
+ this.groupableEffect = groupableInputEffect(this.groupable, this.grid);
1344
+ this.pageableEffect = pageableInputEffect(this.pageable, this.grid);
1345
+ this.selectableEffect = selectableInputEffect(this.selectable, this.grid);
1346
+ this.showStatusBarEffect = showStatusBarInputEffect(this.showStatusBar, this.grid);
1347
+ this.columnMenuEffect = columnMenuInputEffect(this.columnMenu, this.grid);
1348
+ this.allowColumnReorderEffect = allowColumnReorderInputEffect(this.allowColumnReorder, this.grid);
1349
+ this.showToolBarEffect = showToolBarInputEffect(this.showToolBar, this.grid);
1350
+ this.toolBarRendererEffect = toolBarRendererInputEffect(this.toolBarRenderer, this.grid);
1351
+ this.editableEffect = editableInputEffect(this.editable, this.grid);
1352
+ this.editingEventsEffect = editingEventsInputEffect(this.editingEvents, this.grid);
1353
+ this.schemaEffect = schemaInputEffect(this.schema, this.grid);
1354
+ this.rowEditingEventsEffect = rowEditingEventsInputEffect(this.rowEditingEvents, this.grid);
1355
+ this.rowEventsEffect = rowEventsInputEffect(this.rowEvents, this.grid);
1356
+ this.newRowEventsEffect = newRowEventsInputEffect(this.newRowEvents, this.grid);
1357
+ this.rowFormatEffect = rowFormatInputEffect(this.rowFormat, this.grid);
1358
+ this.copyEffect = copyInputEffect(this.copy, this.grid);
1359
+ this.pasteEffect = pasteInputEffect(this.paste, this.grid);
1360
+ this.clipboardEventsEffect = clipboardEventsInputEffect(this.clipboardEvents, this.grid);
1361
+ });
1362
+ if (this.errorType)
1363
+ this.grid.api.setError(true, this.errorType);
1364
+ }
1365
+ ngAfterContentInit() {
1366
+ if (this.columns().length > 0 && this.projectedColumns.length > 0)
1367
+ this.errorType = "ambiguous-column-definition";
1368
+ }
1369
+ ngOnDestroy() {
1370
+ this.grid?.destroy();
1371
+ this.grid = null;
1372
+ }
1373
+ collapseAllGroups() {
1374
+ this.grid.api.collapseAllGroups();
1375
+ }
1376
+ expandAllGroups() {
1377
+ this.grid.api.expandAllGroups();
1378
+ }
1379
+ getValidation(rowId, fieldName) {
1380
+ return this.grid.api.getValidation(rowId, fieldName);
1381
+ }
1382
+ getRowValidation(rowId) {
1383
+ return this.grid.api.getRowValidation(rowId);
1384
+ }
1385
+ getAllValidation() {
1386
+ return this.grid.api.getAllValidation();
1387
+ }
1388
+ hasErrors() {
1389
+ return this.grid.api.hasErrors();
1390
+ }
1391
+ startRowEdit(rowId) {
1392
+ this.grid.api.startRowEdit(rowId);
1393
+ }
1394
+ cancelRowEdit() {
1395
+ this.grid.api.cancelRowEdit();
1396
+ }
1397
+ commitRowEdit() {
1398
+ this.grid.api.commitRowEdit();
1399
+ }
1400
+ deleteRow(rowId) {
1401
+ this.grid.api.deleteRow(rowId);
1402
+ }
1403
+ toggleAddNewRow(show) {
1404
+ this.grid.api.setShowAddNewRow(show);
1405
+ }
1406
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1407
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.23", type: UnshapeGridComponent, isStandalone: true, selector: "ush-grid", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, resizeMode: { classPropertyName: "resizeMode", publicName: "resizeMode", isSignal: true, isRequired: false, transformFunction: null }, enableAnimations: { classPropertyName: "enableAnimations", publicName: "enableAnimations", isSignal: true, isRequired: false, transformFunction: null }, animationOptions: { classPropertyName: "animationOptions", publicName: "animationOptions", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, sortSettings: { classPropertyName: "sortSettings", publicName: "sortSettings", isSignal: true, isRequired: false, transformFunction: null }, showFooter: { classPropertyName: "showFooter", publicName: "showFooter", isSignal: true, isRequired: false, transformFunction: null }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, groupable: { classPropertyName: "groupable", publicName: "groupable", isSignal: true, isRequired: false, transformFunction: null }, pageable: { classPropertyName: "pageable", publicName: "pageable", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null }, showStatusBar: { classPropertyName: "showStatusBar", publicName: "showStatusBar", isSignal: true, isRequired: false, transformFunction: null }, columnMenu: { classPropertyName: "columnMenu", publicName: "columnMenu", isSignal: true, isRequired: false, transformFunction: null }, allowColumnReorder: { classPropertyName: "allowColumnReorder", publicName: "allowColumnReorder", isSignal: true, isRequired: false, transformFunction: null }, showToolBar: { classPropertyName: "showToolBar", publicName: "showToolBar", isSignal: true, isRequired: false, transformFunction: null }, toolBarRenderer: { classPropertyName: "toolBarRenderer", publicName: "toolBarRenderer", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, editingEvents: { classPropertyName: "editingEvents", publicName: "editingEvents", isSignal: true, isRequired: false, transformFunction: null }, schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, rowEditingEvents: { classPropertyName: "rowEditingEvents", publicName: "rowEditingEvents", isSignal: true, isRequired: false, transformFunction: null }, rowEvents: { classPropertyName: "rowEvents", publicName: "rowEvents", isSignal: true, isRequired: false, transformFunction: null }, newRowEvents: { classPropertyName: "newRowEvents", publicName: "newRowEvents", isSignal: true, isRequired: false, transformFunction: null }, rowFormat: { classPropertyName: "rowFormat", publicName: "rowFormat", isSignal: true, isRequired: false, transformFunction: null }, copy: { classPropertyName: "copy", publicName: "copy", isSignal: true, isRequired: false, transformFunction: null }, paste: { classPropertyName: "paste", publicName: "paste", isSignal: true, isRequired: false, transformFunction: null }, clipboardEvents: { classPropertyName: "clipboardEvents", publicName: "clipboardEvents", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "noDataTemplateDir", first: true, predicate: UnshapeGridNoDataTemplateDirective, descendants: true }, { propertyName: "loadingTemplateDir", first: true, predicate: UnshapeGridLoadingTemplateDirective, descendants: true }, { propertyName: "errorTemplateDir", first: true, predicate: UnshapeGridErrorTemplateDirective, descendants: true }, { propertyName: "groupColumnTemplateDir", first: true, predicate: UnshapeGridGroupColumnTemplateDirective, descendants: true }, { propertyName: "groupHeaderTemplateDir", first: true, predicate: UnshapeGridGroupHeaderTemplateDirective, descendants: true }, { propertyName: "statusBarTemplateDir", first: true, predicate: UnshapeGridStatusBarTemplateDirective, descendants: true }, { propertyName: "toolBarTemplateDir", first: true, predicate: UnshapeGridToolBarTemplateDirective, descendants: true }, { propertyName: "projectedColumns", predicate: UnshapeGridColumnComponent }], viewQueries: [{ propertyName: "hostRef", first: true, predicate: ["host"], descendants: true, static: true }], ngImport: i0, template: "<div #host class=\"ush-grid-host\"></div>\r\n", styles: [":host{display:block;width:100%;height:100%}.ush-grid-host{width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1408
+ }
1409
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UnshapeGridComponent, decorators: [{
1410
+ type: Component,
1411
+ args: [{ selector: "ush-grid", imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #host class=\"ush-grid-host\"></div>\r\n", styles: [":host{display:block;width:100%;height:100%}.ush-grid-host{width:100%;height:100%}\n"] }]
1412
+ }], propDecorators: { hostRef: [{
1413
+ type: ViewChild,
1414
+ args: ["host", { static: true }]
1415
+ }], noDataTemplateDir: [{
1416
+ type: ContentChild,
1417
+ args: [UnshapeGridNoDataTemplateDirective]
1418
+ }], loadingTemplateDir: [{
1419
+ type: ContentChild,
1420
+ args: [UnshapeGridLoadingTemplateDirective]
1421
+ }], errorTemplateDir: [{
1422
+ type: ContentChild,
1423
+ args: [UnshapeGridErrorTemplateDirective]
1424
+ }], groupColumnTemplateDir: [{
1425
+ type: ContentChild,
1426
+ args: [UnshapeGridGroupColumnTemplateDirective]
1427
+ }], groupHeaderTemplateDir: [{
1428
+ type: ContentChild,
1429
+ args: [UnshapeGridGroupHeaderTemplateDirective]
1430
+ }], statusBarTemplateDir: [{
1431
+ type: ContentChild,
1432
+ args: [UnshapeGridStatusBarTemplateDirective]
1433
+ }], toolBarTemplateDir: [{
1434
+ type: ContentChild,
1435
+ args: [UnshapeGridToolBarTemplateDirective]
1436
+ }], projectedColumns: [{
1437
+ type: ContentChildren,
1438
+ args: [UnshapeGridColumnComponent]
1439
+ }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: true }] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], resizeMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizeMode", required: false }] }], enableAnimations: [{ type: i0.Input, args: [{ isSignal: true, alias: "enableAnimations", required: false }] }], animationOptions: [{ type: i0.Input, args: [{ isSignal: true, alias: "animationOptions", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], sortSettings: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortSettings", required: false }] }], showFooter: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooter", required: false }] }], locale: [{ type: i0.Input, args: [{ isSignal: true, alias: "locale", required: false }] }], groupable: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupable", required: false }] }], pageable: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageable", required: false }] }], selectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectable", required: false }] }], showStatusBar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showStatusBar", required: false }] }], columnMenu: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnMenu", required: false }] }], allowColumnReorder: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowColumnReorder", required: false }] }], showToolBar: [{ type: i0.Input, args: [{ isSignal: true, alias: "showToolBar", required: false }] }], toolBarRenderer: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolBarRenderer", required: false }] }], editable: [{ type: i0.Input, args: [{ isSignal: true, alias: "editable", required: false }] }], editingEvents: [{ type: i0.Input, args: [{ isSignal: true, alias: "editingEvents", required: false }] }], schema: [{ type: i0.Input, args: [{ isSignal: true, alias: "schema", required: false }] }], rowEditingEvents: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowEditingEvents", required: false }] }], rowEvents: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowEvents", required: false }] }], newRowEvents: [{ type: i0.Input, args: [{ isSignal: true, alias: "newRowEvents", required: false }] }], rowFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowFormat", required: false }] }], copy: [{ type: i0.Input, args: [{ isSignal: true, alias: "copy", required: false }] }], paste: [{ type: i0.Input, args: [{ isSignal: true, alias: "paste", required: false }] }], clipboardEvents: [{ type: i0.Input, args: [{ isSignal: true, alias: "clipboardEvents", required: false }] }] } });
1440
+
1441
+ class SpacerComponent {
1442
+ width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : /* istanbul ignore next */ []));
1443
+ get styleWidth() {
1444
+ return this.width();
1445
+ }
1446
+ get hasWidthClass() {
1447
+ return !!this.width();
1448
+ }
1449
+ get defaultClass() {
1450
+ return true;
1451
+ }
1452
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SpacerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1453
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.23", type: SpacerComponent, isStandalone: true, selector: "ush-spacer", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.width": "this.styleWidth", "class.ush-spacer-sized": "this.hasWidthClass", "class.ush-spacer": "this.defaultClass" } }, ngImport: i0, template: "", isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1454
+ }
1455
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: SpacerComponent, decorators: [{
1456
+ type: Component,
1457
+ args: [{
1458
+ selector: "ush-spacer",
1459
+ imports: [CommonModule],
1460
+ template: "",
1461
+ changeDetection: ChangeDetectionStrategy.OnPush,
1462
+ }]
1463
+ }], propDecorators: { width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], styleWidth: [{
1464
+ type: HostBinding,
1465
+ args: ["style.width"]
1466
+ }], hasWidthClass: [{
1467
+ type: HostBinding,
1468
+ args: ["class.ush-spacer-sized"]
1469
+ }], defaultClass: [{
1470
+ type: HostBinding,
1471
+ args: ["class.ush-spacer"]
1472
+ }] } });
1473
+
1474
+ class UNSHAPE_GRID {
1475
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UNSHAPE_GRID, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1476
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.23", ngImport: i0, type: UNSHAPE_GRID, imports: [UnshapeGridComponent,
1477
+ UnshapeGridColumnComponent,
1478
+ UnshapeGridNoDataTemplateDirective,
1479
+ UnshapeGridLoadingTemplateDirective,
1480
+ UnshapeGridErrorTemplateDirective,
1481
+ UnshapeGridColumnHeaderTemplateDirective,
1482
+ UnshapeGridColumnFooterTemplateDirective,
1483
+ UnshapeGridColumnCellTemplateDirective,
1484
+ UnshapeGridFilterCellTemplateDirective,
1485
+ UnshapeGridGroupColumnTemplateDirective,
1486
+ UnshapeGridGroupHeaderCellTemplateDirective,
1487
+ UnshapeGridGroupHeaderTemplateDirective,
1488
+ UnshapeGridGroupFooterCellTemplateDirective,
1489
+ UnshapeGridStatusBarTemplateDirective,
1490
+ UnshapeGridToolBarTemplateDirective,
1491
+ SpacerComponent,
1492
+ UnshapeGridEditorCellTemplateDirective], exports: [UnshapeGridComponent,
1493
+ UnshapeGridColumnComponent,
1494
+ UnshapeGridNoDataTemplateDirective,
1495
+ UnshapeGridLoadingTemplateDirective,
1496
+ UnshapeGridErrorTemplateDirective,
1497
+ UnshapeGridColumnHeaderTemplateDirective,
1498
+ UnshapeGridColumnFooterTemplateDirective,
1499
+ UnshapeGridColumnCellTemplateDirective,
1500
+ UnshapeGridFilterCellTemplateDirective,
1501
+ UnshapeGridGroupColumnTemplateDirective,
1502
+ UnshapeGridGroupHeaderCellTemplateDirective,
1503
+ UnshapeGridGroupHeaderTemplateDirective,
1504
+ UnshapeGridGroupFooterCellTemplateDirective,
1505
+ UnshapeGridStatusBarTemplateDirective,
1506
+ UnshapeGridToolBarTemplateDirective,
1507
+ SpacerComponent,
1508
+ UnshapeGridEditorCellTemplateDirective] });
1509
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UNSHAPE_GRID, imports: [UnshapeGridComponent,
1510
+ UnshapeGridColumnComponent,
1511
+ SpacerComponent] });
1512
+ }
1513
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: UNSHAPE_GRID, decorators: [{
1514
+ type: NgModule,
1515
+ args: [{
1516
+ imports: [
1517
+ UnshapeGridComponent,
1518
+ UnshapeGridColumnComponent,
1519
+ UnshapeGridNoDataTemplateDirective,
1520
+ UnshapeGridLoadingTemplateDirective,
1521
+ UnshapeGridErrorTemplateDirective,
1522
+ UnshapeGridColumnHeaderTemplateDirective,
1523
+ UnshapeGridColumnFooterTemplateDirective,
1524
+ UnshapeGridColumnCellTemplateDirective,
1525
+ UnshapeGridFilterCellTemplateDirective,
1526
+ UnshapeGridGroupColumnTemplateDirective,
1527
+ UnshapeGridGroupHeaderCellTemplateDirective,
1528
+ UnshapeGridGroupHeaderTemplateDirective,
1529
+ UnshapeGridGroupFooterCellTemplateDirective,
1530
+ UnshapeGridStatusBarTemplateDirective,
1531
+ UnshapeGridToolBarTemplateDirective,
1532
+ SpacerComponent,
1533
+ UnshapeGridEditorCellTemplateDirective,
1534
+ ],
1535
+ exports: [
1536
+ UnshapeGridComponent,
1537
+ UnshapeGridColumnComponent,
1538
+ UnshapeGridNoDataTemplateDirective,
1539
+ UnshapeGridLoadingTemplateDirective,
1540
+ UnshapeGridErrorTemplateDirective,
1541
+ UnshapeGridColumnHeaderTemplateDirective,
1542
+ UnshapeGridColumnFooterTemplateDirective,
1543
+ UnshapeGridColumnCellTemplateDirective,
1544
+ UnshapeGridFilterCellTemplateDirective,
1545
+ UnshapeGridGroupColumnTemplateDirective,
1546
+ UnshapeGridGroupHeaderCellTemplateDirective,
1547
+ UnshapeGridGroupHeaderTemplateDirective,
1548
+ UnshapeGridGroupFooterCellTemplateDirective,
1549
+ UnshapeGridStatusBarTemplateDirective,
1550
+ UnshapeGridToolBarTemplateDirective,
1551
+ SpacerComponent,
1552
+ UnshapeGridEditorCellTemplateDirective,
1553
+ ],
1554
+ providers: [],
1555
+ }]
1556
+ }] });
1557
+
1558
+ /**
1559
+ * Generated bundle index. Do not edit.
1560
+ */
1561
+
1562
+ export { SpacerComponent, UNSHAPE_GRID, UnshapeGridColumnCellTemplateDirective, UnshapeGridColumnComponent, UnshapeGridColumnFooterTemplateDirective, UnshapeGridColumnHeaderTemplateDirective, UnshapeGridComponent, UnshapeGridEditorCellTemplateDirective, UnshapeGridErrorTemplateDirective, UnshapeGridFilterCellTemplateDirective, UnshapeGridGroupColumnTemplateDirective, UnshapeGridGroupFooterCellTemplateDirective, UnshapeGridGroupHeaderCellTemplateDirective, UnshapeGridGroupHeaderTemplateDirective, UnshapeGridLoadingTemplateDirective, UnshapeGridNoDataTemplateDirective, UnshapeGridStatusBarTemplateDirective, UnshapeGridToolBarTemplateDirective };
1563
+ //# sourceMappingURL=unshape-grid-angular.mjs.map