@rxap/data-grid 19.1.0 → 21.0.1-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/compodoc/changelog.html +39 -0
- package/compodoc/components/DataGridComponent.html +621 -667
- package/compodoc/dependencies.html +11 -11
- package/compodoc/directives/DataGridCellDefDirective.html +9 -79
- package/compodoc/directives/DataGridEditCellDefDirective.html +7 -77
- package/compodoc/directives/DataGridHeaderCellDefDirective.html +7 -77
- package/compodoc/directives/DataGridRowDefDirective.html +139 -179
- package/compodoc/graph/dependencies.svg +15 -153
- package/compodoc/interfaces/DataGridCellDefDirectiveContext.html +3 -11
- package/compodoc/interfaces/DataGridEditCellDefDirectiveContext.html +3 -11
- package/compodoc/interfaces/DataGridHeaderCellDefDirectiveContext.html +3 -11
- package/compodoc/js/menu-wc.js +0 -52
- package/compodoc/js/menu-wc_es5.js +1 -1
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/miscellaneous/functions.html +85 -25
- package/compodoc/modules.html +0 -17
- package/compodoc/overview.html +1 -185
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +1018 -1145
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/DataGridCellDefDirective.html +2 -2
- package/docs/html/classes/DataGridComponent.html +11 -14
- package/docs/html/classes/DataGridEditCellDefDirective.html +2 -2
- package/docs/html/classes/DataGridHeaderCellDefDirective.html +2 -2
- package/docs/html/classes/DataGridRowDefDirective.html +7 -7
- package/docs/html/classes/DataGridValuePipe.html +2 -2
- package/docs/html/classes/IsEmptyPipe.html +2 -2
- package/docs/html/enums/DataGridMode.html +3 -3
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/DataGridCellDefDirectiveContext.html +2 -2
- package/docs/html/interfaces/DataGridEditCellDefDirectiveContext.html +2 -2
- package/docs/html/interfaces/DataGridHeaderCellDefDirectiveContext.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/DataGridCellDefDirective.md +7 -15
- package/docs/markdown/classes/DataGridComponent.md +64 -104
- package/docs/markdown/classes/DataGridEditCellDefDirective.md +5 -13
- package/docs/markdown/classes/DataGridHeaderCellDefDirective.md +5 -13
- package/docs/markdown/classes/DataGridRowDefDirective.md +19 -19
- package/docs/markdown/classes/DataGridValuePipe.md +3 -3
- package/docs/markdown/classes/IsEmptyPipe.md +3 -3
- package/docs/markdown/enumerations/DataGridMode.md +4 -4
- package/docs/markdown/globals.md +2 -3
- package/docs/markdown/interfaces/DataGridCellDefDirectiveContext.md +4 -4
- package/docs/markdown/interfaces/DataGridEditCellDefDirectiveContext.md +4 -4
- package/docs/markdown/interfaces/DataGridHeaderCellDefDirectiveContext.md +3 -3
- package/docs/wiki/Class.DataGridCellDefDirective.md +6 -14
- package/docs/wiki/Class.DataGridComponent.md +63 -103
- package/docs/wiki/Class.DataGridEditCellDefDirective.md +4 -12
- package/docs/wiki/Class.DataGridHeaderCellDefDirective.md +4 -12
- package/docs/wiki/Class.DataGridRowDefDirective.md +18 -18
- package/docs/wiki/Class.DataGridValuePipe.md +2 -2
- package/docs/wiki/Class.IsEmptyPipe.md +2 -2
- package/docs/wiki/Enumeration.DataGridMode.md +3 -3
- package/docs/wiki/Interface.DataGridCellDefDirectiveContext.md +3 -3
- package/docs/wiki/Interface.DataGridEditCellDefDirectiveContext.md +3 -3
- package/docs/wiki/Interface.DataGridHeaderCellDefDirectiveContext.md +2 -2
- package/docs/wiki/_Sidebar.md +0 -1
- package/docs/wiki/globals.md +1 -2
- package/fesm2022/rxap-data-grid.mjs +115 -188
- package/fesm2022/rxap-data-grid.mjs.map +1 -1
- package/package.json +33 -32
- package/types/rxap-data-grid.d.ts +147 -0
- package/docs/html/classes/DataGridModule.html +0 -2
- package/docs/markdown/classes/DataGridModule.md +0 -19
- package/docs/wiki/Class.DataGridModule.md +0 -15
- package/index.d.ts +0 -8
- package/lib/data-grid-cell-def.directive.d.ts +0 -15
- package/lib/data-grid-edit-cell-def.directive.d.ts +0 -13
- package/lib/data-grid-header-cell-def.directive.d.ts +0 -12
- package/lib/data-grid-row-def.directive.d.ts +0 -31
- package/lib/data-grid-value.pipe.d.ts +0 -8
- package/lib/data-grid.component.d.ts +0 -72
- package/lib/data-grid.module.d.ts +0 -11
- package/lib/is-empty.pipe.d.ts +0 -8
|
@@ -1,91 +1,82 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { TemplateRef, Directive,
|
|
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
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { NgTemplateOutlet, NgClass, AsyncPipe } from '@angular/common';
|
|
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
|
|
9
|
+
import * as i3 from '@angular/material/divider';
|
|
9
10
|
import { MatDividerModule } from '@angular/material/divider';
|
|
10
|
-
import * as
|
|
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
|
|
14
|
+
import * as i2 from '@angular/material/progress-spinner';
|
|
14
15
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
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 {
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DataGridCellDefDirective, deps: [{ token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
31
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.16", type: DataGridCellDefDirective, isStandalone: true, selector: "[rxapDataGridCellDef]", ngImport: i0 }); }
|
|
29
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridCellDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridCellDefDirective, decorators: [{
|
|
34
33
|
type: Directive,
|
|
35
34
|
args: [{
|
|
36
35
|
selector: '[rxapDataGridCellDef]',
|
|
37
36
|
standalone: true,
|
|
38
37
|
}]
|
|
39
|
-
}]
|
|
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
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DataGridEditCellDefDirective, deps: [{ token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
52
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.16", type: DataGridEditCellDefDirective, isStandalone: true, selector: "[rxapDataGridEditCellDef]", ngImport: i0 }); }
|
|
47
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridEditCellDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridEditCellDefDirective, decorators: [{
|
|
55
51
|
type: Directive,
|
|
56
52
|
args: [{
|
|
57
53
|
selector: '[rxapDataGridEditCellDef]',
|
|
58
54
|
standalone: true,
|
|
59
55
|
}]
|
|
60
|
-
}]
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DataGridHeaderCellDefDirective, deps: [{ token: TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
73
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.16", type: DataGridHeaderCellDefDirective, isStandalone: true, selector: "[rxapDataGridHeaderCellDef]", ngImport: i0 }); }
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridHeaderCellDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridHeaderCellDefDirective, decorators: [{
|
|
76
69
|
type: Directive,
|
|
77
70
|
args: [{
|
|
78
71
|
selector: '[rxapDataGridHeaderCellDef]',
|
|
79
72
|
standalone: true,
|
|
80
73
|
}]
|
|
81
|
-
}]
|
|
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,37 +93,24 @@ 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
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
111
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
104
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridRowDefDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridRowDefDirective, decorators: [{
|
|
114
108
|
type: Directive,
|
|
115
109
|
args: [{
|
|
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) {
|
|
@@ -141,10 +119,10 @@ class DataGridValuePipe {
|
|
|
141
119
|
}
|
|
142
120
|
return data.pipe(map(source => getFromObject(source, path)));
|
|
143
121
|
}
|
|
144
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
145
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
122
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
123
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DataGridValuePipe, isStandalone: true, name: "dataGridValue" }); }
|
|
146
124
|
}
|
|
147
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridValuePipe, decorators: [{
|
|
148
126
|
type: Pipe,
|
|
149
127
|
args: [{
|
|
150
128
|
name: 'dataGridValue',
|
|
@@ -159,10 +137,10 @@ class IsEmptyPipe {
|
|
|
159
137
|
}
|
|
160
138
|
return data.pipe(map(source => getFromObject(source, path)), map(value => value === null || value === undefined || value === ''));
|
|
161
139
|
}
|
|
162
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
163
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
140
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IsEmptyPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
141
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: IsEmptyPipe, isStandalone: true, name: "isEmpty" }); }
|
|
164
142
|
}
|
|
165
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: IsEmptyPipe, decorators: [{
|
|
166
144
|
type: Pipe,
|
|
167
145
|
args: [{
|
|
168
146
|
name: 'isEmpty',
|
|
@@ -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(
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
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.
|
|
195
|
-
this.
|
|
196
|
-
this.
|
|
197
|
-
|
|
198
|
-
|
|
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.
|
|
203
|
-
this.
|
|
204
|
-
this.
|
|
205
|
-
this.
|
|
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.
|
|
201
|
+
return this.mode() === DataGridMode.FORM || this.hasAnyEditCells;
|
|
220
202
|
}
|
|
221
203
|
get isFormMode() {
|
|
222
|
-
return this.
|
|
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
|
|
210
|
+
return this._editMode();
|
|
229
211
|
}
|
|
230
212
|
set editMode(value) {
|
|
231
|
-
this._editMode
|
|
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
|
-
|
|
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 (
|
|
254
|
-
data$ =
|
|
234
|
+
if (dataSource) {
|
|
235
|
+
data$ = dataSource.connect(this.viewer());
|
|
255
236
|
}
|
|
256
|
-
if (
|
|
257
|
-
data$ = of(
|
|
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
|
|
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 (
|
|
274
|
-
this.hasError$ =
|
|
275
|
-
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.
|
|
280
|
-
this.
|
|
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
|
-
|
|
303
|
-
|
|
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.
|
|
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
|
|
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
|
-
|
|
360
|
-
|
|
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
|
-
|
|
368
|
-
|
|
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,84 +361,28 @@ class DataGridComponent {
|
|
|
378
361
|
retry() {
|
|
379
362
|
this.refresh();
|
|
380
363
|
}
|
|
381
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
382
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
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
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DataGridComponent, decorators: [{
|
|
385
368
|
type: Component,
|
|
386
369
|
args: [{ selector: 'rxap-data-grid', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
387
370
|
AsyncPipe,
|
|
388
|
-
NgIf,
|
|
389
|
-
NgFor,
|
|
390
371
|
MatButtonModule,
|
|
391
372
|
MatIconModule,
|
|
392
373
|
GetFromObjectPipe,
|
|
393
374
|
ReplacePipe,
|
|
394
375
|
EscapeQuotationMarkPipe,
|
|
395
|
-
|
|
376
|
+
FormSubmitFailedDirective, FormSubmitSuccessfulDirective, FormSubmitInvalidDirective,
|
|
396
377
|
DataGridValuePipe,
|
|
397
378
|
MatProgressSpinnerModule,
|
|
398
379
|
MatDividerModule,
|
|
399
380
|
NgTemplateOutlet,
|
|
400
381
|
MatFormFieldModule,
|
|
401
382
|
NgClass,
|
|
402
|
-
IsEmptyPipe
|
|
403
|
-
], template: "
|
|
404
|
-
}],
|
|
405
|
-
type: Optional
|
|
406
|
-
}] }], propDecorators: { header: [{
|
|
407
|
-
type: Input
|
|
408
|
-
}], dataSource: [{
|
|
409
|
-
type: Input
|
|
410
|
-
}], viewer: [{
|
|
411
|
-
type: Input
|
|
412
|
-
}], data: [{
|
|
413
|
-
type: Input
|
|
414
|
-
}], displayProperties: [{
|
|
415
|
-
type: Input
|
|
416
|
-
}], hideEmptyProperties: [{
|
|
417
|
-
type: Input
|
|
418
|
-
}], rows: [{
|
|
419
|
-
type: ContentChildren,
|
|
420
|
-
args: [DataGridRowDefDirective]
|
|
421
|
-
}], editModeChange: [{
|
|
422
|
-
type: Output
|
|
423
|
-
}], mode: [{
|
|
424
|
-
type: Input
|
|
425
|
-
}] } });
|
|
426
|
-
|
|
427
|
-
class DataGridModule {
|
|
428
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DataGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
429
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: DataGridModule, imports: [DataGridComponent,
|
|
430
|
-
DataGridRowDefDirective,
|
|
431
|
-
DataGridHeaderCellDefDirective,
|
|
432
|
-
DataGridCellDefDirective,
|
|
433
|
-
DataGridEditCellDefDirective], exports: [DataGridComponent,
|
|
434
|
-
DataGridRowDefDirective,
|
|
435
|
-
DataGridHeaderCellDefDirective,
|
|
436
|
-
DataGridCellDefDirective,
|
|
437
|
-
DataGridEditCellDefDirective] }); }
|
|
438
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DataGridModule, imports: [DataGridComponent] }); }
|
|
439
|
-
}
|
|
440
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DataGridModule, decorators: [{
|
|
441
|
-
type: NgModule,
|
|
442
|
-
args: [{
|
|
443
|
-
imports: [
|
|
444
|
-
DataGridComponent,
|
|
445
|
-
DataGridRowDefDirective,
|
|
446
|
-
DataGridHeaderCellDefDirective,
|
|
447
|
-
DataGridCellDefDirective,
|
|
448
|
-
DataGridEditCellDefDirective,
|
|
449
|
-
],
|
|
450
|
-
exports: [
|
|
451
|
-
DataGridComponent,
|
|
452
|
-
DataGridRowDefDirective,
|
|
453
|
-
DataGridHeaderCellDefDirective,
|
|
454
|
-
DataGridCellDefDirective,
|
|
455
|
-
DataGridEditCellDefDirective,
|
|
456
|
-
],
|
|
457
|
-
}]
|
|
458
|
-
}] });
|
|
383
|
+
IsEmptyPipe
|
|
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 }] }] } });
|
|
459
386
|
|
|
460
387
|
// region
|
|
461
388
|
// endregion
|
|
@@ -464,5 +391,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImpo
|
|
|
464
391
|
* Generated bundle index. Do not edit.
|
|
465
392
|
*/
|
|
466
393
|
|
|
467
|
-
export { DataGridCellDefDirective, DataGridComponent, DataGridEditCellDefDirective, DataGridHeaderCellDefDirective, DataGridMode,
|
|
394
|
+
export { DataGridCellDefDirective, DataGridComponent, DataGridEditCellDefDirective, DataGridHeaderCellDefDirective, DataGridMode, DataGridRowDefDirective, DataGridValuePipe, IsEmptyPipe };
|
|
468
395
|
//# sourceMappingURL=rxap-data-grid.mjs.map
|