@rxap/data-grid 21.0.1-dev.0 → 21.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/compodoc/changelog.html +44 -0
  3. package/compodoc/components/DataGridComponent.html +517 -564
  4. package/compodoc/dependencies.html +5 -5
  5. package/compodoc/directives/DataGridCellDefDirective.html +9 -79
  6. package/compodoc/directives/DataGridEditCellDefDirective.html +7 -77
  7. package/compodoc/directives/DataGridHeaderCellDefDirective.html +7 -77
  8. package/compodoc/directives/DataGridRowDefDirective.html +139 -179
  9. package/compodoc/graph/dependencies.svg +15 -153
  10. package/compodoc/interfaces/DataGridCellDefDirectiveContext.html +3 -11
  11. package/compodoc/interfaces/DataGridEditCellDefDirectiveContext.html +3 -11
  12. package/compodoc/interfaces/DataGridHeaderCellDefDirectiveContext.html +3 -11
  13. package/compodoc/js/menu-wc.js +0 -52
  14. package/compodoc/js/menu-wc_es5.js +1 -1
  15. package/compodoc/js/search/search_index.js +2 -2
  16. package/compodoc/miscellaneous/functions.html +85 -25
  17. package/compodoc/modules.html +0 -17
  18. package/compodoc/overview.html +1 -185
  19. package/compodoc/properties.html +1 -1
  20. package/docs/documentation.json +1009 -1136
  21. package/docs/html/assets/navigation.js +1 -1
  22. package/docs/html/assets/search.js +1 -1
  23. package/docs/html/classes/DataGridCellDefDirective.html +2 -2
  24. package/docs/html/classes/DataGridComponent.html +11 -14
  25. package/docs/html/classes/DataGridEditCellDefDirective.html +2 -2
  26. package/docs/html/classes/DataGridHeaderCellDefDirective.html +2 -2
  27. package/docs/html/classes/DataGridRowDefDirective.html +7 -7
  28. package/docs/html/classes/DataGridValuePipe.html +2 -2
  29. package/docs/html/classes/IsEmptyPipe.html +2 -2
  30. package/docs/html/enums/DataGridMode.html +3 -3
  31. package/docs/html/index.html +2 -2
  32. package/docs/html/interfaces/DataGridCellDefDirectiveContext.html +2 -2
  33. package/docs/html/interfaces/DataGridEditCellDefDirectiveContext.html +2 -2
  34. package/docs/html/interfaces/DataGridHeaderCellDefDirectiveContext.html +2 -2
  35. package/docs/html/modules.html +1 -1
  36. package/docs/markdown/README.md +1 -1
  37. package/docs/markdown/classes/DataGridCellDefDirective.md +7 -15
  38. package/docs/markdown/classes/DataGridComponent.md +64 -104
  39. package/docs/markdown/classes/DataGridEditCellDefDirective.md +5 -13
  40. package/docs/markdown/classes/DataGridHeaderCellDefDirective.md +5 -13
  41. package/docs/markdown/classes/DataGridRowDefDirective.md +19 -19
  42. package/docs/markdown/classes/DataGridValuePipe.md +3 -3
  43. package/docs/markdown/classes/IsEmptyPipe.md +3 -3
  44. package/docs/markdown/enumerations/DataGridMode.md +4 -4
  45. package/docs/markdown/globals.md +2 -3
  46. package/docs/markdown/interfaces/DataGridCellDefDirectiveContext.md +4 -4
  47. package/docs/markdown/interfaces/DataGridEditCellDefDirectiveContext.md +4 -4
  48. package/docs/markdown/interfaces/DataGridHeaderCellDefDirectiveContext.md +3 -3
  49. package/docs/wiki/Class.DataGridCellDefDirective.md +6 -14
  50. package/docs/wiki/Class.DataGridComponent.md +63 -103
  51. package/docs/wiki/Class.DataGridEditCellDefDirective.md +4 -12
  52. package/docs/wiki/Class.DataGridHeaderCellDefDirective.md +4 -12
  53. package/docs/wiki/Class.DataGridRowDefDirective.md +18 -18
  54. package/docs/wiki/Class.DataGridValuePipe.md +2 -2
  55. package/docs/wiki/Class.IsEmptyPipe.md +2 -2
  56. package/docs/wiki/Enumeration.DataGridMode.md +3 -3
  57. package/docs/wiki/Interface.DataGridCellDefDirectiveContext.md +3 -3
  58. package/docs/wiki/Interface.DataGridEditCellDefDirectiveContext.md +3 -3
  59. package/docs/wiki/Interface.DataGridHeaderCellDefDirectiveContext.md +2 -2
  60. package/docs/wiki/_Sidebar.md +0 -1
  61. package/docs/wiki/globals.md +1 -2
  62. package/fesm2022/rxap-data-grid.mjs +98 -169
  63. package/fesm2022/rxap-data-grid.mjs.map +1 -1
  64. package/package.json +16 -16
  65. package/types/rxap-data-grid.d.ts +40 -51
  66. package/docs/html/classes/DataGridModule.html +0 -2
  67. package/docs/markdown/classes/DataGridModule.md +0 -19
  68. package/docs/wiki/Class.DataGridModule.md +0 -15
@@ -1,33 +1,32 @@
1
1
  import * as i0 from '@angular/core';
2
- import { TemplateRef, Inject, Directive, ContentChild, Input, Pipe, isDevMode, EventEmitter, Output, ContentChildren, Optional, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
- import { getFromObject, clone } from '@rxap/utilities';
2
+ import { inject, TemplateRef, Directive, input, contentChild, Pipe, isDevMode, linkedSignal, contentChildren, output, signal, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { coerceBoolean, getFromObject, clone } from '@rxap/utilities';
4
4
  import { map, filter, tap, shareReplay, take } from 'rxjs/operators';
5
5
  import { NgTemplateOutlet, NgClass, AsyncPipe } from '@angular/common';
6
- import * as i3 from '@angular/material/button';
6
+ import { toObservable, outputToObservable } from '@angular/core/rxjs-interop';
7
+ import * as i1 from '@angular/material/button';
7
8
  import { MatButtonModule } from '@angular/material/button';
8
- import * as i5 from '@angular/material/divider';
9
+ import * as i3 from '@angular/material/divider';
9
10
  import { MatDividerModule } from '@angular/material/divider';
10
- import * as i6 from '@angular/material/form-field';
11
+ import * as i4 from '@angular/material/form-field';
11
12
  import { MatFormFieldModule } from '@angular/material/form-field';
12
13
  import { MatIconModule } from '@angular/material/icon';
13
- import * as i4 from '@angular/material/progress-spinner';
14
+ import * as i2 from '@angular/material/progress-spinner';
14
15
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
15
- import * as i1 from '@angular/router';
16
- import { ActivationEnd } from '@angular/router';
17
- import * as i2 from '@rxap/forms';
18
- import { RxapFormsModule } from '@rxap/forms';
16
+ import { Router, ActivationEnd } from '@angular/router';
17
+ import { FormDirective, FormSubmitFailedDirective, FormSubmitSuccessfulDirective, FormSubmitInvalidDirective } from '@rxap/forms';
19
18
  import { GetFromObjectPipe, ReplacePipe, EscapeQuotationMarkPipe } from '@rxap/pipes';
20
19
  import { ToggleSubject } from '@rxap/rxjs';
21
- import { EMPTY, of, BehaviorSubject, merge, debounceTime, combineLatest } from 'rxjs';
20
+ import { of, EMPTY, debounceTime, combineLatest } from 'rxjs';
22
21
 
23
22
  class DataGridCellDefDirective {
23
+ constructor() {
24
+ this.template = inject(TemplateRef);
25
+ }
24
26
  static ngTemplateContextGuard(dir, ctx) {
25
27
  return true;
26
28
  }
27
- constructor(template) {
28
- this.template = template;
29
- }
30
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridCellDefDirective, deps: [{ token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
29
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridCellDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
31
30
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: DataGridCellDefDirective, isStandalone: true, selector: "[rxapDataGridCellDef]", ngImport: i0 }); }
32
31
  }
33
32
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridCellDefDirective, decorators: [{
@@ -36,19 +35,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
36
35
  selector: '[rxapDataGridCellDef]',
37
36
  standalone: true,
38
37
  }]
39
- }], ctorParameters: () => [{ type: i0.TemplateRef, decorators: [{
40
- type: Inject,
41
- args: [TemplateRef]
42
- }] }] });
38
+ }] });
43
39
 
44
40
  class DataGridEditCellDefDirective {
41
+ constructor() {
42
+ this.template = inject(TemplateRef);
43
+ }
45
44
  static ngTemplateContextGuard(dir, ctx) {
46
45
  return true;
47
46
  }
48
- constructor(template) {
49
- this.template = template;
50
- }
51
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridEditCellDefDirective, deps: [{ token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
47
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridEditCellDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
52
48
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: DataGridEditCellDefDirective, isStandalone: true, selector: "[rxapDataGridEditCellDef]", ngImport: i0 }); }
53
49
  }
54
50
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridEditCellDefDirective, decorators: [{
@@ -57,19 +53,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
57
53
  selector: '[rxapDataGridEditCellDef]',
58
54
  standalone: true,
59
55
  }]
60
- }], ctorParameters: () => [{ type: i0.TemplateRef, decorators: [{
61
- type: Inject,
62
- args: [TemplateRef]
63
- }] }] });
56
+ }] });
64
57
 
65
58
  class DataGridHeaderCellDefDirective {
59
+ constructor() {
60
+ this.template = inject(TemplateRef);
61
+ }
66
62
  static ngTemplateContextGuard(dir, ctx) {
67
63
  return true;
68
64
  }
69
- constructor(template) {
70
- this.template = template;
71
- }
72
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridHeaderCellDefDirective, deps: [{ token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
65
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridHeaderCellDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
73
66
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: DataGridHeaderCellDefDirective, isStandalone: true, selector: "[rxapDataGridHeaderCellDef]", ngImport: i0 }); }
74
67
  }
75
68
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridHeaderCellDefDirective, decorators: [{
@@ -78,14 +71,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
78
71
  selector: '[rxapDataGridHeaderCellDef]',
79
72
  standalone: true,
80
73
  }]
81
- }], ctorParameters: () => [{ type: i0.TemplateRef, decorators: [{
82
- type: Inject,
83
- args: [TemplateRef]
84
- }] }] });
74
+ }] });
85
75
 
86
76
  class DataGridRowDefDirective {
87
77
  constructor() {
88
- this.data = null;
78
+ this.data = input(null, ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
79
+ this.name = input(undefined, { ...(ngDevMode ? { debugName: "name" } : /* istanbul ignore next */ {}), alias: "rxapDataGridRowDef" });
89
80
  /**
90
81
  * true - the header and content cell are "rotated" by 90°. The header is above the content cell and both have a
91
82
  * colspan
@@ -102,13 +93,16 @@ class DataGridRowDefDirective {
102
93
  * Content (colspan 2)
103
94
  *
104
95
  */
105
- this.flip = false;
96
+ this.flip = input(false, { ...(ngDevMode ? { debugName: "flip" } : /* istanbul ignore next */ {}), transform: coerceBoolean });
97
+ this.cell = contentChild(DataGridCellDefDirective, ...(ngDevMode ? [{ debugName: "cell" }] : /* istanbul ignore next */ []));
98
+ this.headerCell = contentChild(DataGridHeaderCellDefDirective, ...(ngDevMode ? [{ debugName: "headerCell" }] : /* istanbul ignore next */ []));
99
+ this.editCell = contentChild(DataGridEditCellDefDirective, ...(ngDevMode ? [{ debugName: "editCell" }] : /* istanbul ignore next */ []));
106
100
  }
107
101
  get isSubHeader() {
108
- return !this.name;
102
+ return !this.name();
109
103
  }
110
104
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridRowDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
111
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: DataGridRowDefDirective, isStandalone: true, selector: "[rxapDataGridRowDef]", inputs: { data: "data", name: ["rxapDataGridRowDef", "name"], flip: "flip" }, queries: [{ propertyName: "cell", first: true, predicate: DataGridCellDefDirective, descendants: true }, { propertyName: "headerCell", first: true, predicate: DataGridHeaderCellDefDirective, descendants: true }, { propertyName: "editCell", first: true, predicate: DataGridEditCellDefDirective, descendants: true }], ngImport: i0 }); }
105
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.9", type: DataGridRowDefDirective, isStandalone: true, selector: "[rxapDataGridRowDef]", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "rxapDataGridRowDef", isSignal: true, isRequired: false, transformFunction: null }, flip: { classPropertyName: "flip", publicName: "flip", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "cell", first: true, predicate: DataGridCellDefDirective, descendants: true, isSignal: true }, { propertyName: "headerCell", first: true, predicate: DataGridHeaderCellDefDirective, descendants: true, isSignal: true }, { propertyName: "editCell", first: true, predicate: DataGridEditCellDefDirective, descendants: true, isSignal: true }], ngImport: i0 }); }
112
106
  }
113
107
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridRowDefDirective, decorators: [{
114
108
  type: Directive,
@@ -116,23 +110,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
116
110
  selector: '[rxapDataGridRowDef]',
117
111
  standalone: true,
118
112
  }]
119
- }], propDecorators: { data: [{
120
- type: Input
121
- }], name: [{
122
- type: Input,
123
- args: ['rxapDataGridRowDef']
124
- }], flip: [{
125
- type: Input
126
- }], cell: [{
127
- type: ContentChild,
128
- args: [DataGridCellDefDirective]
129
- }], headerCell: [{
130
- type: ContentChild,
131
- args: [DataGridHeaderCellDefDirective]
132
- }], editCell: [{
133
- type: ContentChild,
134
- args: [DataGridEditCellDefDirective]
135
- }] } });
113
+ }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapDataGridRowDef", required: false }] }], flip: [{ type: i0.Input, args: [{ isSignal: true, alias: "flip", required: false }] }], cell: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DataGridCellDefDirective), { isSignal: true }] }], headerCell: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DataGridHeaderCellDefDirective), { isSignal: true }] }], editCell: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DataGridEditCellDefDirective), { isSignal: true }] }] } });
136
114
 
137
115
  class DataGridValuePipe {
138
116
  transform(data, path) {
@@ -184,51 +162,55 @@ var DataGridMode;
184
162
  function IsDataGridMode(value) {
185
163
  return [DataGridMode.PLAIN, DataGridMode.FORM].includes(value);
186
164
  }
165
+ function coerceDataGridMode(value) {
166
+ if (IsDataGridMode(value)) {
167
+ return value;
168
+ }
169
+ throw new Error(`The data grid mode only support 'plain' and 'form' - given '${value}'`);
170
+ }
187
171
  class DataGridComponent {
188
- constructor(cdr, router, formDirective) {
189
- this.cdr = cdr;
190
- this.router = router;
191
- this.formDirective = formDirective;
172
+ constructor() {
173
+ this.router = inject(Router);
174
+ this.formDirective = inject(FormDirective, { optional: true });
192
175
  this.isDevMode = isDevMode();
193
- this.header = false;
194
- this.viewer = this;
195
- this.displayProperties = null;
196
- this.hideEmptyProperties = false;
197
- this.editModeChange = new EventEmitter();
198
- this.rows$ = EMPTY;
176
+ this.header = input(false, { ...(ngDevMode ? { debugName: "header" } : /* istanbul ignore next */ {}), transform: coerceBoolean });
177
+ this.dataSource = input(...(ngDevMode ? [undefined, { debugName: "dataSource" }] : /* istanbul ignore next */ []));
178
+ this.viewer = input(this, ...(ngDevMode ? [{ debugName: "viewer" }] : /* istanbul ignore next */ []));
179
+ this.data = input(...(ngDevMode ? [undefined, { debugName: "data" }] : /* istanbul ignore next */ []));
180
+ /**
181
+ * The current data. Initialized from the data input and updated with the values emitted by the data source
182
+ */
183
+ this.currentData = linkedSignal(() => this.data(), ...(ngDevMode ? [{ debugName: "currentData" }] : /* istanbul ignore next */ []));
184
+ this.displayProperties = input(null, ...(ngDevMode ? [{ debugName: "displayProperties" }] : /* istanbul ignore next */ []));
185
+ this.hideEmptyProperties = input(false, { ...(ngDevMode ? { debugName: "hideEmptyProperties" } : /* istanbul ignore next */ {}), transform: coerceBoolean });
186
+ this.rows = contentChildren(DataGridRowDefDirective, ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
187
+ this.editModeChange = output();
188
+ this.rows$ = toObservable(this.rows);
199
189
  this.hasError$ = of(false);
200
190
  this.dataLoading$ = of(false);
201
191
  this.loading$ = new ToggleSubject();
202
- this._editMode$ = new BehaviorSubject(false);
203
- this._mode$ = new BehaviorSubject(DataGridMode.PLAIN);
204
- this._routerEventSubscription = null;
205
- this.isEditMode$ = this._editMode$.asObservable();
206
- this.mode$ = this._mode$.asObservable();
192
+ this.mode = input(DataGridMode.PLAIN, { ...(ngDevMode ? { debugName: "mode" } : /* istanbul ignore next */ {}), transform: coerceDataGridMode });
193
+ this._editMode = signal(false, ...(ngDevMode ? [{ debugName: "_editMode" }] : /* istanbul ignore next */ []));
194
+ this.isEditMode$ = toObservable(this._editMode);
195
+ this.mode$ = toObservable(this.mode);
207
196
  this.isFormMode$ = this.mode$.pipe(map(mode => mode === DataGridMode.FORM));
208
197
  this.isPlainMode$ = this.mode$.pipe(map(mode => mode === DataGridMode.PLAIN));
209
- }
210
- set mode(value) {
211
- if (IsDataGridMode(value)) {
212
- this._mode$.next(value);
213
- }
214
- else {
215
- throw new Error(`The data grid mode only support 'plain' and 'form' - given '${value}'`);
216
- }
198
+ this._routerEventSubscription = null;
217
199
  }
218
200
  get isFormModeOrHasAnyEditCells() {
219
- return this._mode$.value === DataGridMode.FORM || this.hasAnyEditCells;
201
+ return this.mode() === DataGridMode.FORM || this.hasAnyEditCells;
220
202
  }
221
203
  get isFormMode() {
222
- return this._mode$.value === DataGridMode.FORM;
204
+ return this.mode() === DataGridMode.FORM;
223
205
  }
224
206
  get hasAnyEditCells() {
225
- return this.rows?.some(row => !!row.editCell) ?? false;
207
+ return this.rows()?.some(row => !!row.editCell()) ?? false;
226
208
  }
227
209
  get isEditMode() {
228
- return this._editMode$.value;
210
+ return this._editMode();
229
211
  }
230
212
  set editMode(value) {
231
- this._editMode$.next(value);
213
+ this._editMode.set(value);
232
214
  }
233
215
  /**
234
216
  * @deprecated use the loading$ property instead
@@ -236,9 +218,6 @@ class DataGridComponent {
236
218
  get loading() {
237
219
  return this.loading$.value;
238
220
  }
239
- ngAfterContentInit() {
240
- this.rows$ = merge(of(this.rows), this.rows.changes);
241
- }
242
221
  logCurrentFormState() {
243
222
  console.log(clone(this.formDirective?.form.value));
244
223
  }
@@ -246,20 +225,22 @@ class DataGridComponent {
246
225
  // resets the edit mode if this component is used in a sibling router path
247
226
  // if not reset the edit mode is president after the route changes
248
227
  this._routerEventSubscription = this.router.events.pipe(filter(event => event instanceof ActivationEnd), tap(() => this.disableEditMode())).subscribe();
249
- if (this.dataSource && this.data) {
228
+ const dataSource = this.dataSource();
229
+ const dataValue = this.currentData();
230
+ if (dataSource && dataValue) {
250
231
  throw new Error('You can not use both dataSource and data input');
251
232
  }
252
233
  let data$ = EMPTY;
253
- if (this.dataSource) {
254
- data$ = this.dataSource.connect(this.viewer);
234
+ if (dataSource) {
235
+ data$ = dataSource.connect(this.viewer());
255
236
  }
256
- if (this.data) {
257
- data$ = of(this.data);
237
+ if (dataValue) {
238
+ data$ = of(dataValue);
258
239
  }
259
240
  if (data$ === EMPTY && isDevMode()) {
260
241
  console.warn('No data source or data input provided');
261
242
  }
262
- this.data$ = data$.pipe(debounceTime(100), tap(data => this.data = data), tap(data => {
243
+ this.data$ = data$.pipe(debounceTime(100), tap(data => this.currentData.set(data)), tap(data => {
263
244
  if (this.formDirective && this.isFormMode) {
264
245
  this.formDirective.form.patchValue(data, {
265
246
  coerce: true,
@@ -270,19 +251,19 @@ class DataGridComponent {
270
251
  }
271
252
  }
272
253
  }), shareReplay(1));
273
- if (this.dataSource) {
274
- this.hasError$ = this.dataSource.hasError$ ?? this.hasError$;
275
- this.dataLoading$ = this.dataSource.loading$ ?? this.dataLoading$;
254
+ if (dataSource) {
255
+ this.hasError$ = dataSource.hasError$ ?? this.hasError$;
256
+ this.dataLoading$ = dataSource.loading$ ?? this.dataLoading$;
276
257
  }
277
258
  if (this.formDirective && this.isFormMode) {
278
259
  this.formDirective.form.disabledWhile(combineLatest([
279
- this._editMode$,
280
- this._mode$,
260
+ this.isEditMode$,
261
+ this.mode$,
281
262
  ]).pipe(map(([editMode, mode]) => !editMode && mode === 'form')), { onlySelf: false });
282
263
  }
283
264
  }
284
265
  ngOnDestroy() {
285
- this.dataSource?.disconnect(this.viewer);
266
+ this.dataSource()?.disconnect(this.viewer());
286
267
  this._routerEventSubscription?.unsubscribe();
287
268
  }
288
269
  enableEditMode(skipPatchValue = false) {
@@ -299,8 +280,9 @@ class DataGridComponent {
299
280
  return;
300
281
  }
301
282
  this.editMode = true;
302
- if (!skipPatchValue && this.data) {
303
- this.formDirective.form.patchValue(this.data, {
283
+ const data = this.currentData();
284
+ if (!skipPatchValue && data) {
285
+ this.formDirective.form.patchValue(data, {
304
286
  coerce: true,
305
287
  strict: true,
306
288
  });
@@ -337,11 +319,10 @@ class DataGridComponent {
337
319
  this.loading$.enable();
338
320
  this.formDirective.form.markAllAsDirty();
339
321
  this.formDirective.form.markAllAsTouched();
340
- this.formDirective.cdr.markForCheck();
341
- this.formDirective.rxapSubmit.pipe(take(1), tap(() => {
322
+ outputToObservable(this.formDirective.rxapSubmit).pipe(take(1), tap(() => {
342
323
  this.disableEditMode();
343
324
  })).subscribe();
344
- this.formDirective.invalidSubmit.pipe(take(1), tap(() => {
325
+ outputToObservable(this.formDirective.invalidSubmit).pipe(take(1), tap(() => {
345
326
  this.loading$.disable();
346
327
  })).subscribe();
347
328
  this.formDirective.submitError$.pipe(filter(Boolean), // if the error is undefined we do not want to disable the loading
@@ -349,23 +330,25 @@ class DataGridComponent {
349
330
  this.loading$.disable();
350
331
  this.enableEditMode(true);
351
332
  })).subscribe();
352
- this.formDirective.submitSuccessful$.pipe(take(1), tap(() => {
333
+ outputToObservable(this.formDirective.submitSuccessful$).pipe(take(1), tap(() => {
353
334
  this.loading$.disable();
354
335
  this.refresh();
355
336
  })).subscribe();
356
337
  this.formDirective.onSubmit(new Event('submit'));
357
338
  }
358
339
  reset() {
359
- if (this.formDirective && this.data && this.isFormModeOrHasAnyEditCells) {
360
- this.formDirective.form.patchValue(this.data, {
340
+ const data = this.currentData();
341
+ if (this.formDirective && data && this.isFormModeOrHasAnyEditCells) {
342
+ this.formDirective.form.patchValue(data, {
361
343
  coerce: true,
362
344
  strict: true,
363
345
  });
364
346
  }
365
347
  }
366
348
  refresh() {
367
- if (this.dataSource) {
368
- this.dataSource.refresh();
349
+ const dataSource = this.dataSource();
350
+ if (dataSource) {
351
+ dataSource.refresh();
369
352
  }
370
353
  else if (isDevMode()) {
371
354
  console.warn('can not refresh the data. data source is not defined');
@@ -378,8 +361,8 @@ class DataGridComponent {
378
361
  retry() {
379
362
  this.refresh();
380
363
  }
381
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.Router }, { token: i2.FormDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
382
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DataGridComponent, isStandalone: true, selector: "rxap-data-grid", inputs: { header: "header", dataSource: "dataSource", viewer: "viewer", data: "data", displayProperties: "displayProperties", hideEmptyProperties: "hideEmptyProperties", mode: "mode" }, outputs: { editModeChange: "editModeChange" }, queries: [{ propertyName: "rows", predicate: DataGridRowDefDirective }], ngImport: i0, template: "@if ((hasError$ | async)) {\n <div class=\"flex flex-col items-center justify-center gap-y-8\">\n <span i18n>Something has gone wrong!</span>\n <button (click)=\"retry()\" i18n mat-stroked-button type=\"button\">Retry</button>\n </div>\n}\n@if ((dataLoading$ | async)) {\n <div class=\"flex flex-col items-center justify-center gap-y-8\">\n <mat-spinner></mat-spinner>\n </div>\n}\n<!-- if the dataSource input is used. It is possible the the hasError$ or loading$ property is === EMPTY. this would\nresults in an null as output. If the === false check is used this can result into the behavior that the data grid is\nnever shown. -->\n<!-- eslint-disable-next-line @angular-eslint/template/no-negated-async -->\n@if (!(hasError$ | async) && !(dataLoading$ | async)) {\n <table class=\"w-full table-auto\">\n @if (header) {\n <thead>\n <tr>\n <th class=\"py-2\" i18n>Label</th>\n <th class=\"py-2\" i18n>Value</th>\n </tr>\n </thead>\n }\n <tbody>\n @for (row of rows$ | async; track row; let first = $first) {\n @if ((!displayProperties || row.isSubHeader || (row.name && displayProperties.includes(row.name))) && (!hideEmptyProperties || false === (data$ | isEmpty: row.name | async))) {\n <!-- region horizontal view -->\n @if (row.flip) {\n <tr>\n <td class=\"py-2\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n <tr [attr.data-name]=\"row.name + '-header'\">\n <ng-container\n *ngTemplateOutlet=\"row.headerCell?.template ?? defaultHeaderCell; context: { $implicit: row.name }\"></ng-container>\n </tr>\n <tr [attr.data-name]=\"row.name + '-value'\">\n <ng-template [ngIfThen]=\"content\" [ngIf]=\"row.name\"></ng-template>\n </tr>\n <tr>\n <td class=\"py-4\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n } @else {\n @if (!first && row.isSubHeader) {\n <tr>\n <td class=\"py-4\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n }\n <tr [attr.data-name]=\"row.name\" [ngClass]=\"{ 'sub-header text-2xl': row.isSubHeader }\">\n <ng-container\n *ngTemplateOutlet=\"row.headerCell?.template ?? defaultHeaderCell; context: { $implicit: row.name }\"></ng-container>\n <ng-template [ngIfThen]=\"content\" [ngIf]=\"row.name\"></ng-template>\n </tr>\n }\n <!-- endregion -->\n <!-- region normal view -->\n <!-- endregion -->\n }\n <ng-template #content>\n <td [attr.colspan]=\"row.flip ? 2 : 1\" [ngClass]=\"{\n 'h-20': row.editCell?.template && (isEditMode || isFormMode) && false,\n }\" class=\"pl-8 pr-4 w-full py-2\">\n <ng-template [ngIfThen]=\"editMode\" [ngIf]=\"row.editCell?.template && (isEditMode || isFormMode)\"></ng-template>\n <ng-template [ngIfThen]=\"viewMode\"\n [ngIf]=\"!row.editCell?.template || (!isEditMode && !isFormMode)\"></ng-template>\n </td>\n <ng-template #viewMode>\n <ng-container\n *ngTemplateOutlet=\"row.cell?.template ?? defaultCell;context: { $implicit: data$ | dataGridValue: row.name | async, data: data$ | async }\"></ng-container>\n </ng-template>\n <ng-template #editMode>\n <ng-container\n *ngTemplateOutlet=\"row.editCell?.template ?? row.cell?.template ?? defaultCell;context: { $implicit: data$ | dataGridValue: row.name | async, data: data$ | async }\"></ng-container>\n </ng-template>\n </ng-template>\n }\n </tbody>\n @if (hasAnyEditCells) {\n <tfoot>\n <tr>\n <td class=\"py-2\" colspan=\"2\">\n @if (isEditMode) {\n <div class=\"pt-8 flex flex-col gap-y-6\">\n <div class=\"flex flex-row gap-x-6 items-center justify-start\">\n <button (click)=\"submit()\" [disabled]=\"loading$ | async\" color=\"primary\" mat-raised-button type=\"button\">\n <span class=\"flex flex-row gap-x-6 items-center justify-center\">\n <span i18n>Save</span>\n @if (loading$ | async) {\n <mat-spinner color=\"accent\" diameter=\"15\"></mat-spinner>\n }\n </span>\n </button>\n <button (click)=\"reset()\" [disabled]=\"loading$ | async\" mat-stroked-button type=\"button\">\n <ng-container i18n>Reset</ng-container>\n </button>\n <button (click)=\"cancel()\" [disabled]=\"loading$ | async\" color=\"warn\" mat-stroked-button type=\"button\">\n <ng-container i18n>Cancel</ng-container>\n </button>\n @if (isDevMode) {\n <button (click)=\"logCurrentFormState()\" mat-button type=\"button\">\n <ng-container i18n>Current Form State</ng-container>\n </button>\n }\n </div>\n <ng-template rxapFormSubmitInvalid>\n <mat-error i18n>Ensure all formula fields are valid.</mat-error>\n </ng-template>\n <ng-template let-error rxapFormSubmitFailed>\n <mat-error>{{ error.error?.message ?? error.message }}</mat-error>\n </ng-template>\n <ng-template rxapFormSubmitSuccessful>\n <span i18n>Submit successfully.</span>\n </ng-template>\n </div>\n } @else {\n <div class=\"pt-8\">\n <button (click)=\"enableEditMode()\" color=\"primary\" mat-raised-button type=\"button\">\n <span class=\"flex flex-row gap-x-6 items-center justify-center\">\n <span i18n>Edit</span>\n @if (loading$ | async) {\n <mat-spinner color=\"accent\" diameter=\"15\"></mat-spinner>\n }\n </span>\n </button>\n </div>\n }\n </td>\n </tr>\n </tfoot>\n }\n </table>\n}\n\n<ng-template #defaultCell let-value>\n <span>{{ value }}</span>\n</ng-template>\n<ng-template #defaultHeaderCell let-name>\n <th class=\"py-2 whitespace-nowrap\">{{ name }}</th>\n</ng-template>\n", styles: [":host ::ng-deep th{text-align:right;width:auto}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "ngmodule", type: RxapFormsModule }, { kind: "directive", type: i2.FormSubmitFailedDirective, selector: "[rxapFormSubmitFailed]" }, { kind: "directive", type: i2.FormSubmitSuccessfulDirective, selector: "[rxapFormSubmitSuccessful]" }, { kind: "directive", type: i2.FormSubmitInvalidDirective, selector: "[rxapFormSubmitInvalid]" }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i5.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i6.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: DataGridValuePipe, name: "dataGridValue" }, { kind: "pipe", type: IsEmptyPipe, name: "isEmpty" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
364
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
365
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: DataGridComponent, isStandalone: true, selector: "rxap-data-grid", inputs: { header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, dataSource: { classPropertyName: "dataSource", publicName: "dataSource", isSignal: true, isRequired: false, transformFunction: null }, viewer: { classPropertyName: "viewer", publicName: "viewer", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, displayProperties: { classPropertyName: "displayProperties", publicName: "displayProperties", isSignal: true, isRequired: false, transformFunction: null }, hideEmptyProperties: { classPropertyName: "hideEmptyProperties", publicName: "hideEmptyProperties", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { editModeChange: "editModeChange" }, queries: [{ propertyName: "rows", predicate: DataGridRowDefDirective, isSignal: true }], ngImport: i0, template: "@if ((hasError$ | async)) {\n <div class=\"flex flex-col items-center justify-center gap-y-8\">\n <span i18n>Something has gone wrong!</span>\n <button (click)=\"retry()\" i18n mat-stroked-button type=\"button\">Retry</button>\n </div>\n}\n@if ((dataLoading$ | async)) {\n <div class=\"flex flex-col items-center justify-center gap-y-8\">\n <mat-spinner></mat-spinner>\n </div>\n}\n<!-- if the dataSource input is used. It is possible the the hasError$ or loading$ property is === EMPTY. this would\nresults in an null as output. If the === false check is used this can result into the behavior that the data grid is\nnever shown. -->\n<!-- eslint-disable-next-line @angular-eslint/template/no-negated-async -->\n@if (!(hasError$ | async) && !(dataLoading$ | async)) {\n <table class=\"w-full table-auto\">\n @if (header()) {\n <thead>\n <tr>\n <th class=\"py-2\" i18n>Label</th>\n <th class=\"py-2\" i18n>Value</th>\n </tr>\n </thead>\n }\n <tbody>\n @for (row of rows$ | async; track row; let first = $first) {\n @if ((!displayProperties() || row.isSubHeader || (row.name() && displayProperties()?.includes(row.name()!))) && (!hideEmptyProperties() || row.isSubHeader || false === (data$ | isEmpty: row.name() | async))) {\n <!-- region horizontal view -->\n @if (row.flip()) {\n <tr>\n <td class=\"py-2\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n <tr [attr.data-name]=\"row.name() + '-header'\">\n <ng-container\n *ngTemplateOutlet=\"row.headerCell()?.template ?? defaultHeaderCell; context: { $implicit: row.name() }\"></ng-container>\n </tr>\n <tr [attr.data-name]=\"row.name() + '-value'\">\n @if (row.name()) {\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n }\n </tr>\n <tr>\n <td class=\"py-4\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n } @else {\n @if (!first && row.isSubHeader) {\n <tr>\n <td class=\"py-4\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n }\n <tr [attr.data-name]=\"row.name()\" [ngClass]=\"{ 'sub-header text-2xl': row.isSubHeader }\">\n <ng-container\n *ngTemplateOutlet=\"row.headerCell()?.template ?? defaultHeaderCell; context: { $implicit: row.name() }\"></ng-container>\n @if (row.name()) {\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n }\n </tr>\n }\n <!-- endregion -->\n <!-- region normal view -->\n <!-- endregion -->\n }\n <ng-template #content>\n <td [attr.colspan]=\"row.flip() ? 2 : 1\" [ngClass]=\"{\n 'h-20': row.editCell()?.template && (isEditMode || isFormMode) && false,\n }\" class=\"pl-8 pr-4 w-full py-2\">\n @if (row.editCell()?.template && (isEditMode || isFormMode)) {\n <ng-container *ngTemplateOutlet=\"editMode\"></ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"viewMode\"></ng-container>\n }\n </td>\n <ng-template #viewMode>\n <ng-container\n *ngTemplateOutlet=\"row.cell()?.template ?? defaultCell;context: { $implicit: data$ | dataGridValue: row.name() | async, data: data$ | async }\"></ng-container>\n </ng-template>\n <ng-template #editMode>\n <ng-container\n *ngTemplateOutlet=\"row.editCell()?.template ?? row.cell()?.template ?? defaultCell;context: { $implicit: data$ | dataGridValue: row.name() | async, data: data$ | async }\"></ng-container>\n </ng-template>\n </ng-template>\n }\n </tbody>\n @if (hasAnyEditCells) {\n <tfoot>\n <tr>\n <td class=\"py-2\" colspan=\"2\">\n @if (isEditMode) {\n <div class=\"pt-8 flex flex-col gap-y-6\">\n <div class=\"flex flex-row gap-x-6 items-center justify-start\">\n <button (click)=\"submit()\" [disabled]=\"loading$ | async\" color=\"primary\" mat-raised-button type=\"button\">\n <span class=\"flex flex-row gap-x-6 items-center justify-center\">\n <span i18n>Save</span>\n @if (loading$ | async) {\n <mat-spinner color=\"accent\" diameter=\"15\"></mat-spinner>\n }\n </span>\n </button>\n <button (click)=\"reset()\" [disabled]=\"loading$ | async\" mat-stroked-button type=\"button\">\n <ng-container i18n>Reset</ng-container>\n </button>\n <button (click)=\"cancel()\" [disabled]=\"loading$ | async\" color=\"warn\" mat-stroked-button type=\"button\">\n <ng-container i18n>Cancel</ng-container>\n </button>\n @if (isDevMode) {\n <button (click)=\"logCurrentFormState()\" mat-button type=\"button\">\n <ng-container i18n>Current Form State</ng-container>\n </button>\n }\n </div>\n <ng-template rxapFormSubmitInvalid>\n <mat-error i18n>Ensure all formula fields are valid.</mat-error>\n </ng-template>\n <ng-template let-error rxapFormSubmitFailed>\n <mat-error>{{ error.error?.message ?? error.message }}</mat-error>\n </ng-template>\n <ng-template rxapFormSubmitSuccessful>\n <span i18n>Submit successfully.</span>\n </ng-template>\n </div>\n } @else {\n <div class=\"pt-8\">\n <button (click)=\"enableEditMode()\" color=\"primary\" mat-raised-button type=\"button\">\n <span class=\"flex flex-row gap-x-6 items-center justify-center\">\n <span i18n>Edit</span>\n @if (loading$ | async) {\n <mat-spinner color=\"accent\" diameter=\"15\"></mat-spinner>\n }\n </span>\n </button>\n </div>\n }\n </td>\n </tr>\n </tfoot>\n }\n </table>\n}\n\n<ng-template #defaultCell let-value>\n <span>{{ value }}</span>\n</ng-template>\n<ng-template #defaultHeaderCell let-name>\n <th class=\"py-2 whitespace-nowrap\">{{ name }}</th>\n</ng-template>\n", styles: [":host ::ng-deep th{text-align:right;width:auto}\n"], dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "directive", type: FormSubmitFailedDirective, selector: "[rxapFormSubmitFailed]" }, { kind: "directive", type: FormSubmitSuccessfulDirective, selector: "[rxapFormSubmitSuccessful]" }, { kind: "directive", type: FormSubmitInvalidDirective, selector: "[rxapFormSubmitInvalid]" }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i2.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i3.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: DataGridValuePipe, name: "dataGridValue" }, { kind: "pipe", type: IsEmptyPipe, name: "isEmpty" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
383
366
  }
384
367
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridComponent, decorators: [{
385
368
  type: Component,
@@ -390,7 +373,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
390
373
  GetFromObjectPipe,
391
374
  ReplacePipe,
392
375
  EscapeQuotationMarkPipe,
393
- RxapFormsModule,
376
+ FormSubmitFailedDirective, FormSubmitSuccessfulDirective, FormSubmitInvalidDirective,
394
377
  DataGridValuePipe,
395
378
  MatProgressSpinnerModule,
396
379
  MatDividerModule,
@@ -398,62 +381,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
398
381
  MatFormFieldModule,
399
382
  NgClass,
400
383
  IsEmptyPipe
401
- ], template: "@if ((hasError$ | async)) {\n <div class=\"flex flex-col items-center justify-center gap-y-8\">\n <span i18n>Something has gone wrong!</span>\n <button (click)=\"retry()\" i18n mat-stroked-button type=\"button\">Retry</button>\n </div>\n}\n@if ((dataLoading$ | async)) {\n <div class=\"flex flex-col items-center justify-center gap-y-8\">\n <mat-spinner></mat-spinner>\n </div>\n}\n<!-- if the dataSource input is used. It is possible the the hasError$ or loading$ property is === EMPTY. this would\nresults in an null as output. If the === false check is used this can result into the behavior that the data grid is\nnever shown. -->\n<!-- eslint-disable-next-line @angular-eslint/template/no-negated-async -->\n@if (!(hasError$ | async) && !(dataLoading$ | async)) {\n <table class=\"w-full table-auto\">\n @if (header) {\n <thead>\n <tr>\n <th class=\"py-2\" i18n>Label</th>\n <th class=\"py-2\" i18n>Value</th>\n </tr>\n </thead>\n }\n <tbody>\n @for (row of rows$ | async; track row; let first = $first) {\n @if ((!displayProperties || row.isSubHeader || (row.name && displayProperties.includes(row.name))) && (!hideEmptyProperties || false === (data$ | isEmpty: row.name | async))) {\n <!-- region horizontal view -->\n @if (row.flip) {\n <tr>\n <td class=\"py-2\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n <tr [attr.data-name]=\"row.name + '-header'\">\n <ng-container\n *ngTemplateOutlet=\"row.headerCell?.template ?? defaultHeaderCell; context: { $implicit: row.name }\"></ng-container>\n </tr>\n <tr [attr.data-name]=\"row.name + '-value'\">\n <ng-template [ngIfThen]=\"content\" [ngIf]=\"row.name\"></ng-template>\n </tr>\n <tr>\n <td class=\"py-4\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n } @else {\n @if (!first && row.isSubHeader) {\n <tr>\n <td class=\"py-4\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n }\n <tr [attr.data-name]=\"row.name\" [ngClass]=\"{ 'sub-header text-2xl': row.isSubHeader }\">\n <ng-container\n *ngTemplateOutlet=\"row.headerCell?.template ?? defaultHeaderCell; context: { $implicit: row.name }\"></ng-container>\n <ng-template [ngIfThen]=\"content\" [ngIf]=\"row.name\"></ng-template>\n </tr>\n }\n <!-- endregion -->\n <!-- region normal view -->\n <!-- endregion -->\n }\n <ng-template #content>\n <td [attr.colspan]=\"row.flip ? 2 : 1\" [ngClass]=\"{\n 'h-20': row.editCell?.template && (isEditMode || isFormMode) && false,\n }\" class=\"pl-8 pr-4 w-full py-2\">\n <ng-template [ngIfThen]=\"editMode\" [ngIf]=\"row.editCell?.template && (isEditMode || isFormMode)\"></ng-template>\n <ng-template [ngIfThen]=\"viewMode\"\n [ngIf]=\"!row.editCell?.template || (!isEditMode && !isFormMode)\"></ng-template>\n </td>\n <ng-template #viewMode>\n <ng-container\n *ngTemplateOutlet=\"row.cell?.template ?? defaultCell;context: { $implicit: data$ | dataGridValue: row.name | async, data: data$ | async }\"></ng-container>\n </ng-template>\n <ng-template #editMode>\n <ng-container\n *ngTemplateOutlet=\"row.editCell?.template ?? row.cell?.template ?? defaultCell;context: { $implicit: data$ | dataGridValue: row.name | async, data: data$ | async }\"></ng-container>\n </ng-template>\n </ng-template>\n }\n </tbody>\n @if (hasAnyEditCells) {\n <tfoot>\n <tr>\n <td class=\"py-2\" colspan=\"2\">\n @if (isEditMode) {\n <div class=\"pt-8 flex flex-col gap-y-6\">\n <div class=\"flex flex-row gap-x-6 items-center justify-start\">\n <button (click)=\"submit()\" [disabled]=\"loading$ | async\" color=\"primary\" mat-raised-button type=\"button\">\n <span class=\"flex flex-row gap-x-6 items-center justify-center\">\n <span i18n>Save</span>\n @if (loading$ | async) {\n <mat-spinner color=\"accent\" diameter=\"15\"></mat-spinner>\n }\n </span>\n </button>\n <button (click)=\"reset()\" [disabled]=\"loading$ | async\" mat-stroked-button type=\"button\">\n <ng-container i18n>Reset</ng-container>\n </button>\n <button (click)=\"cancel()\" [disabled]=\"loading$ | async\" color=\"warn\" mat-stroked-button type=\"button\">\n <ng-container i18n>Cancel</ng-container>\n </button>\n @if (isDevMode) {\n <button (click)=\"logCurrentFormState()\" mat-button type=\"button\">\n <ng-container i18n>Current Form State</ng-container>\n </button>\n }\n </div>\n <ng-template rxapFormSubmitInvalid>\n <mat-error i18n>Ensure all formula fields are valid.</mat-error>\n </ng-template>\n <ng-template let-error rxapFormSubmitFailed>\n <mat-error>{{ error.error?.message ?? error.message }}</mat-error>\n </ng-template>\n <ng-template rxapFormSubmitSuccessful>\n <span i18n>Submit successfully.</span>\n </ng-template>\n </div>\n } @else {\n <div class=\"pt-8\">\n <button (click)=\"enableEditMode()\" color=\"primary\" mat-raised-button type=\"button\">\n <span class=\"flex flex-row gap-x-6 items-center justify-center\">\n <span i18n>Edit</span>\n @if (loading$ | async) {\n <mat-spinner color=\"accent\" diameter=\"15\"></mat-spinner>\n }\n </span>\n </button>\n </div>\n }\n </td>\n </tr>\n </tfoot>\n }\n </table>\n}\n\n<ng-template #defaultCell let-value>\n <span>{{ value }}</span>\n</ng-template>\n<ng-template #defaultHeaderCell let-name>\n <th class=\"py-2 whitespace-nowrap\">{{ name }}</th>\n</ng-template>\n", styles: [":host ::ng-deep th{text-align:right;width:auto}\n"] }]
402
- }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.Router }, { type: i2.FormDirective, decorators: [{
403
- type: Optional
404
- }] }], propDecorators: { header: [{
405
- type: Input
406
- }], dataSource: [{
407
- type: Input
408
- }], viewer: [{
409
- type: Input
410
- }], data: [{
411
- type: Input
412
- }], displayProperties: [{
413
- type: Input
414
- }], hideEmptyProperties: [{
415
- type: Input
416
- }], rows: [{
417
- type: ContentChildren,
418
- args: [DataGridRowDefDirective]
419
- }], editModeChange: [{
420
- type: Output
421
- }], mode: [{
422
- type: Input
423
- }] } });
424
-
425
- class DataGridModule {
426
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
427
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DataGridModule, imports: [DataGridComponent,
428
- DataGridRowDefDirective,
429
- DataGridHeaderCellDefDirective,
430
- DataGridCellDefDirective,
431
- DataGridEditCellDefDirective], exports: [DataGridComponent,
432
- DataGridRowDefDirective,
433
- DataGridHeaderCellDefDirective,
434
- DataGridCellDefDirective,
435
- DataGridEditCellDefDirective] }); }
436
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridModule, imports: [DataGridComponent] }); }
437
- }
438
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridModule, decorators: [{
439
- type: NgModule,
440
- args: [{
441
- imports: [
442
- DataGridComponent,
443
- DataGridRowDefDirective,
444
- DataGridHeaderCellDefDirective,
445
- DataGridCellDefDirective,
446
- DataGridEditCellDefDirective,
447
- ],
448
- exports: [
449
- DataGridComponent,
450
- DataGridRowDefDirective,
451
- DataGridHeaderCellDefDirective,
452
- DataGridCellDefDirective,
453
- DataGridEditCellDefDirective,
454
- ],
455
- }]
456
- }] });
384
+ ], template: "@if ((hasError$ | async)) {\n <div class=\"flex flex-col items-center justify-center gap-y-8\">\n <span i18n>Something has gone wrong!</span>\n <button (click)=\"retry()\" i18n mat-stroked-button type=\"button\">Retry</button>\n </div>\n}\n@if ((dataLoading$ | async)) {\n <div class=\"flex flex-col items-center justify-center gap-y-8\">\n <mat-spinner></mat-spinner>\n </div>\n}\n<!-- if the dataSource input is used. It is possible the the hasError$ or loading$ property is === EMPTY. this would\nresults in an null as output. If the === false check is used this can result into the behavior that the data grid is\nnever shown. -->\n<!-- eslint-disable-next-line @angular-eslint/template/no-negated-async -->\n@if (!(hasError$ | async) && !(dataLoading$ | async)) {\n <table class=\"w-full table-auto\">\n @if (header()) {\n <thead>\n <tr>\n <th class=\"py-2\" i18n>Label</th>\n <th class=\"py-2\" i18n>Value</th>\n </tr>\n </thead>\n }\n <tbody>\n @for (row of rows$ | async; track row; let first = $first) {\n @if ((!displayProperties() || row.isSubHeader || (row.name() && displayProperties()?.includes(row.name()!))) && (!hideEmptyProperties() || row.isSubHeader || false === (data$ | isEmpty: row.name() | async))) {\n <!-- region horizontal view -->\n @if (row.flip()) {\n <tr>\n <td class=\"py-2\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n <tr [attr.data-name]=\"row.name() + '-header'\">\n <ng-container\n *ngTemplateOutlet=\"row.headerCell()?.template ?? defaultHeaderCell; context: { $implicit: row.name() }\"></ng-container>\n </tr>\n <tr [attr.data-name]=\"row.name() + '-value'\">\n @if (row.name()) {\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n }\n </tr>\n <tr>\n <td class=\"py-4\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n } @else {\n @if (!first && row.isSubHeader) {\n <tr>\n <td class=\"py-4\" colspan=\"2\">\n <mat-divider></mat-divider>\n </td>\n </tr>\n }\n <tr [attr.data-name]=\"row.name()\" [ngClass]=\"{ 'sub-header text-2xl': row.isSubHeader }\">\n <ng-container\n *ngTemplateOutlet=\"row.headerCell()?.template ?? defaultHeaderCell; context: { $implicit: row.name() }\"></ng-container>\n @if (row.name()) {\n <ng-container *ngTemplateOutlet=\"content\"></ng-container>\n }\n </tr>\n }\n <!-- endregion -->\n <!-- region normal view -->\n <!-- endregion -->\n }\n <ng-template #content>\n <td [attr.colspan]=\"row.flip() ? 2 : 1\" [ngClass]=\"{\n 'h-20': row.editCell()?.template && (isEditMode || isFormMode) && false,\n }\" class=\"pl-8 pr-4 w-full py-2\">\n @if (row.editCell()?.template && (isEditMode || isFormMode)) {\n <ng-container *ngTemplateOutlet=\"editMode\"></ng-container>\n } @else {\n <ng-container *ngTemplateOutlet=\"viewMode\"></ng-container>\n }\n </td>\n <ng-template #viewMode>\n <ng-container\n *ngTemplateOutlet=\"row.cell()?.template ?? defaultCell;context: { $implicit: data$ | dataGridValue: row.name() | async, data: data$ | async }\"></ng-container>\n </ng-template>\n <ng-template #editMode>\n <ng-container\n *ngTemplateOutlet=\"row.editCell()?.template ?? row.cell()?.template ?? defaultCell;context: { $implicit: data$ | dataGridValue: row.name() | async, data: data$ | async }\"></ng-container>\n </ng-template>\n </ng-template>\n }\n </tbody>\n @if (hasAnyEditCells) {\n <tfoot>\n <tr>\n <td class=\"py-2\" colspan=\"2\">\n @if (isEditMode) {\n <div class=\"pt-8 flex flex-col gap-y-6\">\n <div class=\"flex flex-row gap-x-6 items-center justify-start\">\n <button (click)=\"submit()\" [disabled]=\"loading$ | async\" color=\"primary\" mat-raised-button type=\"button\">\n <span class=\"flex flex-row gap-x-6 items-center justify-center\">\n <span i18n>Save</span>\n @if (loading$ | async) {\n <mat-spinner color=\"accent\" diameter=\"15\"></mat-spinner>\n }\n </span>\n </button>\n <button (click)=\"reset()\" [disabled]=\"loading$ | async\" mat-stroked-button type=\"button\">\n <ng-container i18n>Reset</ng-container>\n </button>\n <button (click)=\"cancel()\" [disabled]=\"loading$ | async\" color=\"warn\" mat-stroked-button type=\"button\">\n <ng-container i18n>Cancel</ng-container>\n </button>\n @if (isDevMode) {\n <button (click)=\"logCurrentFormState()\" mat-button type=\"button\">\n <ng-container i18n>Current Form State</ng-container>\n </button>\n }\n </div>\n <ng-template rxapFormSubmitInvalid>\n <mat-error i18n>Ensure all formula fields are valid.</mat-error>\n </ng-template>\n <ng-template let-error rxapFormSubmitFailed>\n <mat-error>{{ error.error?.message ?? error.message }}</mat-error>\n </ng-template>\n <ng-template rxapFormSubmitSuccessful>\n <span i18n>Submit successfully.</span>\n </ng-template>\n </div>\n } @else {\n <div class=\"pt-8\">\n <button (click)=\"enableEditMode()\" color=\"primary\" mat-raised-button type=\"button\">\n <span class=\"flex flex-row gap-x-6 items-center justify-center\">\n <span i18n>Edit</span>\n @if (loading$ | async) {\n <mat-spinner color=\"accent\" diameter=\"15\"></mat-spinner>\n }\n </span>\n </button>\n </div>\n }\n </td>\n </tr>\n </tfoot>\n }\n </table>\n}\n\n<ng-template #defaultCell let-value>\n <span>{{ value }}</span>\n</ng-template>\n<ng-template #defaultHeaderCell let-name>\n <th class=\"py-2 whitespace-nowrap\">{{ name }}</th>\n</ng-template>\n", styles: [":host ::ng-deep th{text-align:right;width:auto}\n"] }]
385
+ }], propDecorators: { header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], dataSource: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataSource", required: false }] }], viewer: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewer", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], displayProperties: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayProperties", required: false }] }], hideEmptyProperties: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideEmptyProperties", required: false }] }], rows: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => DataGridRowDefDirective), { isSignal: true }] }], editModeChange: [{ type: i0.Output, args: ["editModeChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }] } });
457
386
 
458
387
  // region
459
388
  // endregion
@@ -462,5 +391,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
462
391
  * Generated bundle index. Do not edit.
463
392
  */
464
393
 
465
- export { DataGridCellDefDirective, DataGridComponent, DataGridEditCellDefDirective, DataGridHeaderCellDefDirective, DataGridMode, DataGridModule, DataGridRowDefDirective, DataGridValuePipe, IsEmptyPipe };
394
+ export { DataGridCellDefDirective, DataGridComponent, DataGridEditCellDefDirective, DataGridHeaderCellDefDirective, DataGridMode, DataGridRowDefDirective, DataGridValuePipe, IsEmptyPipe };
466
395
  //# sourceMappingURL=rxap-data-grid.mjs.map