iss-ctrl 0.0.13 → 0.0.15
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/fesm2022/{iss-ctrl-iss-ctrl-BN9rcLt2.mjs → iss-ctrl-iss-ctrl-BpcynMId.mjs} +733 -169
- package/fesm2022/iss-ctrl-iss-ctrl-BpcynMId.mjs.map +1 -0
- package/fesm2022/{iss-ctrl-load-event-AgBohfHa.mjs → iss-ctrl-load-event-r4xUfn0F.mjs} +3 -3
- package/fesm2022/{iss-ctrl-load-event-AgBohfHa.mjs.map → iss-ctrl-load-event-r4xUfn0F.mjs.map} +1 -1
- package/fesm2022/{iss-ctrl-load-options-event-ClQPHNBO.mjs → iss-ctrl-load-options-event-BCHN0tAM.mjs} +3 -3
- package/fesm2022/{iss-ctrl-load-options-event-CBejHpME.mjs.map → iss-ctrl-load-options-event-BCHN0tAM.mjs.map} +1 -1
- package/fesm2022/{iss-ctrl-load-value-event-CDAKsE_O.mjs → iss-ctrl-load-value-event-CilsqNpU.mjs} +3 -3
- package/fesm2022/{iss-ctrl-load-value-event-CDAKsE_O.mjs.map → iss-ctrl-load-value-event-CilsqNpU.mjs.map} +1 -1
- package/fesm2022/{iss-ctrl-note.field-C9cVaAz0.mjs → iss-ctrl-note.field-C5zBFWV-.mjs} +2 -2
- package/fesm2022/{iss-ctrl-note.field-C9cVaAz0.mjs.map → iss-ctrl-note.field-C5zBFWV-.mjs.map} +1 -1
- package/fesm2022/{iss-ctrl-replace-api-keys-Chwe42Nu.mjs → iss-ctrl-replace-api-keys-uUZLoWuP.mjs} +2 -2
- package/fesm2022/{iss-ctrl-replace-api-keys-CLP4wBYu.mjs.map → iss-ctrl-replace-api-keys-uUZLoWuP.mjs.map} +1 -1
- package/fesm2022/{iss-ctrl-set-value-event-CrpzRR6X.mjs → iss-ctrl-set-value-event-DHF2LsSf.mjs} +2 -2
- package/fesm2022/{iss-ctrl-set-value-event-C7YYwHZV.mjs.map → iss-ctrl-set-value-event-DHF2LsSf.mjs.map} +1 -1
- package/fesm2022/{iss-ctrl-table.field-BP-HMKO3.mjs → iss-ctrl-table.field-CjCWmdqf.mjs} +2 -2
- package/fesm2022/{iss-ctrl-table.field-BP-HMKO3.mjs.map → iss-ctrl-table.field-CjCWmdqf.mjs.map} +1 -1
- package/fesm2022/{iss-ctrl-trigger-based-on-json-value-DS4TR38v.mjs → iss-ctrl-trigger-based-on-json-value-BwxH6MLn.mjs} +2 -2
- package/fesm2022/{iss-ctrl-trigger-based-on-json-value-CprcFCWi.mjs.map → iss-ctrl-trigger-based-on-json-value-BwxH6MLn.mjs.map} +1 -1
- package/fesm2022/{iss-ctrl-user-picker.field-8Jb1325c.mjs → iss-ctrl-user-picker.field-Bc_yX1v9.mjs} +2 -2
- package/fesm2022/{iss-ctrl-user-picker.field-8Jb1325c.mjs.map → iss-ctrl-user-picker.field-Bc_yX1v9.mjs.map} +1 -1
- package/fesm2022/iss-ctrl.mjs +1 -1
- package/package.json +1 -1
- package/types/iss-ctrl.d.ts +213 -12
- package/upgrade.scss +8 -17
- package/fesm2022/iss-ctrl-iss-ctrl-BN9rcLt2.mjs.map +0 -1
- package/fesm2022/iss-ctrl-iss-ctrl-DOmgkxUv.mjs +0 -8924
- package/fesm2022/iss-ctrl-iss-ctrl-DOmgkxUv.mjs.map +0 -1
- package/fesm2022/iss-ctrl-iss-ctrl-WfIqBEcL.mjs +0 -8913
- package/fesm2022/iss-ctrl-iss-ctrl-WfIqBEcL.mjs.map +0 -1
- package/fesm2022/iss-ctrl-load-event-D70VZuyD.mjs +0 -60
- package/fesm2022/iss-ctrl-load-event-D70VZuyD.mjs.map +0 -1
- package/fesm2022/iss-ctrl-load-event-SlQmVmyf.mjs +0 -60
- package/fesm2022/iss-ctrl-load-event-SlQmVmyf.mjs.map +0 -1
- package/fesm2022/iss-ctrl-load-options-event-CBejHpME.mjs +0 -50
- package/fesm2022/iss-ctrl-load-options-event-ClQPHNBO.mjs.map +0 -1
- package/fesm2022/iss-ctrl-load-options-event-DHmaMAOb.mjs +0 -50
- package/fesm2022/iss-ctrl-load-options-event-DHmaMAOb.mjs.map +0 -1
- package/fesm2022/iss-ctrl-load-value-event-Bu9-rZ6T.mjs +0 -52
- package/fesm2022/iss-ctrl-load-value-event-Bu9-rZ6T.mjs.map +0 -1
- package/fesm2022/iss-ctrl-load-value-event-Cpuy1og1.mjs +0 -52
- package/fesm2022/iss-ctrl-load-value-event-Cpuy1og1.mjs.map +0 -1
- package/fesm2022/iss-ctrl-note.field-IM4x1O3b.mjs +0 -65
- package/fesm2022/iss-ctrl-note.field-IM4x1O3b.mjs.map +0 -1
- package/fesm2022/iss-ctrl-note.field-onDjqI_X.mjs +0 -65
- package/fesm2022/iss-ctrl-note.field-onDjqI_X.mjs.map +0 -1
- package/fesm2022/iss-ctrl-replace-api-keys-CLP4wBYu.mjs +0 -57
- package/fesm2022/iss-ctrl-replace-api-keys-Chwe42Nu.mjs.map +0 -1
- package/fesm2022/iss-ctrl-replace-api-keys-CvhCKvNB.mjs +0 -57
- package/fesm2022/iss-ctrl-replace-api-keys-CvhCKvNB.mjs.map +0 -1
- package/fesm2022/iss-ctrl-set-value-event-C7YYwHZV.mjs +0 -61
- package/fesm2022/iss-ctrl-set-value-event-CrpzRR6X.mjs.map +0 -1
- package/fesm2022/iss-ctrl-set-value-event-DiHESiPT.mjs +0 -61
- package/fesm2022/iss-ctrl-set-value-event-DiHESiPT.mjs.map +0 -1
- package/fesm2022/iss-ctrl-table.field-CDSVakji.mjs +0 -592
- package/fesm2022/iss-ctrl-table.field-CDSVakji.mjs.map +0 -1
- package/fesm2022/iss-ctrl-table.field-DxwfNXNc.mjs +0 -592
- package/fesm2022/iss-ctrl-table.field-DxwfNXNc.mjs.map +0 -1
- package/fesm2022/iss-ctrl-trigger-based-on-json-value-CprcFCWi.mjs +0 -24
- package/fesm2022/iss-ctrl-trigger-based-on-json-value-DS4TR38v.mjs.map +0 -1
- package/fesm2022/iss-ctrl-trigger-based-on-json-value-Dp0EhVLA.mjs +0 -24
- package/fesm2022/iss-ctrl-trigger-based-on-json-value-Dp0EhVLA.mjs.map +0 -1
- package/fesm2022/iss-ctrl-user-picker.field-Mqi37i7D.mjs +0 -225
- package/fesm2022/iss-ctrl-user-picker.field-Mqi37i7D.mjs.map +0 -1
- package/fesm2022/iss-ctrl-user-picker.field-PxT_dZ_O.mjs +0 -225
- package/fesm2022/iss-ctrl-user-picker.field-PxT_dZ_O.mjs.map +0 -1
|
@@ -1,592 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { viewChild, ViewContainerRef, inject, DestroyRef, effect, Component, input, signal, computed, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
|
-
import * as i1$1 from '@angular/forms';
|
|
4
|
-
import { FormGroup, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
-
import { b as ViewerBase, L as Loader, C as ControlBase, c as FormEngine, I as IssField, O as Outlet, F as FieldBase, V as VIEW_PROVIDER, a as ValidationMessageComponent } from './iss-ctrl-iss-ctrl-DOmgkxUv.mjs';
|
|
6
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
8
|
-
import * as i1 from '@angular/material/input';
|
|
9
|
-
import { MatInputModule } from '@angular/material/input';
|
|
10
|
-
import * as i4 from '@angular/material/paginator';
|
|
11
|
-
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
12
|
-
import * as i5 from '@angular/material/sidenav';
|
|
13
|
-
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
14
|
-
import * as i3 from '@angular/material/sort';
|
|
15
|
-
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
16
|
-
import * as i2 from '@angular/material/table';
|
|
17
|
-
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
18
|
-
import { take } from 'rxjs';
|
|
19
|
-
|
|
20
|
-
class FieldViewer extends ViewerBase {
|
|
21
|
-
containerRef = viewChild("container", { ...(ngDevMode ? { debugName: "containerRef" } : /* istanbul ignore next */ {}), read: ViewContainerRef });
|
|
22
|
-
#loader = inject(Loader);
|
|
23
|
-
#destroyRef = inject(DestroyRef);
|
|
24
|
-
#fieldEffectRef = effect(() => {
|
|
25
|
-
const container = this.containerRef();
|
|
26
|
-
const field = this.field();
|
|
27
|
-
if (!container || !field) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
this.#loader.loadViewer(field.type)
|
|
31
|
-
.pipe(take(1), takeUntilDestroyed(this.#destroyRef))
|
|
32
|
-
.subscribe((viewer) => {
|
|
33
|
-
// the effect re-runs whenever the field changes, so the previously rendered
|
|
34
|
-
// viewer has to go before a new one takes its place
|
|
35
|
-
container.clear();
|
|
36
|
-
if (!viewer) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const componentRef = container.createComponent(viewer);
|
|
40
|
-
componentRef.setInput("field", field);
|
|
41
|
-
});
|
|
42
|
-
}, ...(ngDevMode ? [{ debugName: "#fieldEffectRef" }] : /* istanbul ignore next */ []));
|
|
43
|
-
ngOnDestroy() {
|
|
44
|
-
this.#fieldEffectRef.destroy();
|
|
45
|
-
}
|
|
46
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FieldViewer, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
47
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.9", type: FieldViewer, isStandalone: true, selector: "iss-viewer-field", viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
48
|
-
<ng-container #container></ng-container>
|
|
49
|
-
`, isInline: true });
|
|
50
|
-
}
|
|
51
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: FieldViewer, decorators: [{
|
|
52
|
-
type: Component,
|
|
53
|
-
args: [{
|
|
54
|
-
selector: "iss-viewer-field",
|
|
55
|
-
template: `
|
|
56
|
-
<ng-container #container></ng-container>
|
|
57
|
-
`,
|
|
58
|
-
}]
|
|
59
|
-
}], propDecorators: { containerRef: [{ type: i0.ViewChild, args: ["container", { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* `<iss-ctrl-table>` — repeatable rows, where each row is itself a small form.
|
|
63
|
-
*
|
|
64
|
-
* `columns` are field definitions: the control renders them as the row editor and as the
|
|
65
|
-
* table columns. The form value holds the raw row values, while `jsonValue` carries the
|
|
66
|
-
* resolved payload of each row in and out.
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```html
|
|
70
|
-
* <iss-ctrl-table
|
|
71
|
-
* formControlName="items"
|
|
72
|
-
* [columns]="columns"
|
|
73
|
-
* [withFilter]="true"
|
|
74
|
-
* [withSort]="true"
|
|
75
|
-
* [withPagination]="true"
|
|
76
|
-
* />
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* ### Own inputs
|
|
80
|
-
* | Property | Type | Default | Description |
|
|
81
|
-
* | --- | --- | --- | --- |
|
|
82
|
-
* | `columns` | `any[]` | **required** | Field definitions rendered as columns and as the row editor. |
|
|
83
|
-
* | `jsonValue` | `any` | `null` | Resolved row payload pushed in from outside. |
|
|
84
|
-
* | `withFilter` | `boolean` | `false` | Shows the filter row. |
|
|
85
|
-
* | `withSort` | `boolean` | `false` | Enables column sorting. |
|
|
86
|
-
* | `withPagination` | `boolean` | `false` | Shows the paginator. |
|
|
87
|
-
*
|
|
88
|
-
* ### Inherited from {@link ControlBase}
|
|
89
|
-
* `formControlName` · `readonly` · `className` · `(onChange)`
|
|
90
|
-
*
|
|
91
|
-
* Does not project a label — the field label is rendered by the wrapping `iss-field-*`.
|
|
92
|
-
*/
|
|
93
|
-
class TableControl extends ControlBase {
|
|
94
|
-
// raw child field configs (the same json shape IssField takes), not IssField/host-field
|
|
95
|
-
// instances: this is what lets the control be dropped into a consumer's own wrapper
|
|
96
|
-
// without depending on the outlet/form-engine machinery a host IssField carries
|
|
97
|
-
/**
|
|
98
|
-
* Field definitions rendered both as table columns and as the row editor. Required.
|
|
99
|
-
*/
|
|
100
|
-
columns = input.required(...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
101
|
-
/**
|
|
102
|
-
* Shows the filter row above the table.
|
|
103
|
-
*/
|
|
104
|
-
withFilter = input(false, ...(ngDevMode ? [{ debugName: "withFilter" }] : /* istanbul ignore next */ []));
|
|
105
|
-
/**
|
|
106
|
-
* Enables sorting by clicking a column header.
|
|
107
|
-
*/
|
|
108
|
-
withSort = input(false, ...(ngDevMode ? [{ debugName: "withSort" }] : /* istanbul ignore next */ []));
|
|
109
|
-
/**
|
|
110
|
-
* Shows the paginator under the table.
|
|
111
|
-
*/
|
|
112
|
-
withPagination = input(false, ...(ngDevMode ? [{ debugName: "withPagination" }] : /* istanbul ignore next */ []));
|
|
113
|
-
// the control value stays the "*"/null sentinel (see #emitRows); the row data itself is
|
|
114
|
-
// carried separately here so a wrapper can push a value in on top of a plain ctrl.setValue,
|
|
115
|
-
// e.g. `field.ctrl.setValue("*"); field.ctrlJsonValue.set(rows);`
|
|
116
|
-
/**
|
|
117
|
-
* Resolved row payload pushed in from outside; the control ignores payloads it emitted itself.
|
|
118
|
-
*/
|
|
119
|
-
jsonValue = input(null, ...(ngDevMode ? [{ debugName: "jsonValue" }] : /* istanbul ignore next */ []));
|
|
120
|
-
loader = inject(Loader);
|
|
121
|
-
drawer = viewChild("drawer", ...(ngDevMode ? [{ debugName: "drawer" }] : /* istanbul ignore next */ []));
|
|
122
|
-
tableOutletForm = new FormGroup({});
|
|
123
|
-
fields = signal([], ...(ngDevMode ? [{ debugName: "fields" }] : /* istanbul ignore next */ []));
|
|
124
|
-
columnLabels = computed(() => {
|
|
125
|
-
const labels = this.fields().map((f) => f.label());
|
|
126
|
-
labels.push("");
|
|
127
|
-
return labels;
|
|
128
|
-
}, ...(ngDevMode ? [{ debugName: "columnLabels" }] : /* istanbul ignore next */ []));
|
|
129
|
-
fieldNames = computed(() => {
|
|
130
|
-
const names = this.fields().map((f) => f.name);
|
|
131
|
-
names.push("actions");
|
|
132
|
-
return names;
|
|
133
|
-
}, ...(ngDevMode ? [{ debugName: "fieldNames" }] : /* istanbul ignore next */ []));
|
|
134
|
-
fieldsMap = computed(() => {
|
|
135
|
-
const m = new Map();
|
|
136
|
-
this.fields().forEach((f) => {
|
|
137
|
-
m.set(f.name, f);
|
|
138
|
-
});
|
|
139
|
-
return m;
|
|
140
|
-
}, ...(ngDevMode ? [{ debugName: "fieldsMap" }] : /* istanbul ignore next */ []));
|
|
141
|
-
dataSource = this.#newDataSource([]);
|
|
142
|
-
clickedRows = new Set();
|
|
143
|
-
paginator = viewChild(MatPaginator, ...(ngDevMode ? [{ debugName: "paginator" }] : /* istanbul ignore next */ []));
|
|
144
|
-
sort = viewChild(MatSort, ...(ngDevMode ? [{ debugName: "sort" }] : /* istanbul ignore next */ []));
|
|
145
|
-
#formEngine = inject(FormEngine);
|
|
146
|
-
#destroyRef = inject(DestroyRef);
|
|
147
|
-
// view-mode cells are keyed by the row object itself, not by position: sorting and
|
|
148
|
-
// paging reorder dataSource.data while keeping the row references, so an array indexed
|
|
149
|
-
// by the rendered row index would show another row's values
|
|
150
|
-
#rowViewFields = new WeakMap();
|
|
151
|
-
// the values the row editor's fields were built with; viewRow overwrites them to show a
|
|
152
|
-
// stored row, so they have to be put back before the editor is used to add a new one
|
|
153
|
-
#pristineFieldValues = new Map();
|
|
154
|
-
#fieldValuesOverridden = false;
|
|
155
|
-
// the last payload this control itself emitted; without this, feeding jsonValue() back
|
|
156
|
-
// into the wrapper's ctrlJsonValue would echo straight back in as a hydration and rebuild
|
|
157
|
-
// dataSource (and the WeakMap-cached view fields) on every single row edit
|
|
158
|
-
#lastEmitted = null;
|
|
159
|
-
#hydrateEffectRef = effect(() => {
|
|
160
|
-
const incoming = this.jsonValue();
|
|
161
|
-
if (incoming === null || incoming === undefined || incoming === this.#lastEmitted) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
this.#hydrateRows(incoming);
|
|
165
|
-
}, ...(ngDevMode ? [{ debugName: "#hydrateEffectRef" }] : /* istanbul ignore next */ []));
|
|
166
|
-
// columns() is an input, so it is only guaranteed to be set once Angular runs ngOnInit,
|
|
167
|
-
// not while this class' field initializers run
|
|
168
|
-
ngOnInit() {
|
|
169
|
-
const built = this.constructFieldChildren(this.columns());
|
|
170
|
-
this.fields.set(built);
|
|
171
|
-
this.#pristineFieldValues = new Map(built.map((f) => [f.name, f.value]));
|
|
172
|
-
}
|
|
173
|
-
// the drawer is a viewChild, so it only exists once the view is initialised
|
|
174
|
-
ngAfterViewInit() {
|
|
175
|
-
this.dataSource.paginator = this.paginator() ?? null;
|
|
176
|
-
this.dataSource.sort = this.sort() ?? null;
|
|
177
|
-
this.drawer()?.closedStart
|
|
178
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
179
|
-
.subscribe(() => {
|
|
180
|
-
this.tableOutletForm.reset();
|
|
181
|
-
this.tableOutletForm.enable();
|
|
182
|
-
this.#restoreFieldValues();
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
ngOnDestroy() {
|
|
186
|
-
this.#hydrateEffectRef.destroy();
|
|
187
|
-
}
|
|
188
|
-
applyFilter(event) {
|
|
189
|
-
const filterValue = event.target.value;
|
|
190
|
-
this.dataSource.filter = filterValue.trim().toLowerCase();
|
|
191
|
-
if (this.dataSource.paginator) {
|
|
192
|
-
this.dataSource.paginator.firstPage();
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
onRowClick(row) {
|
|
196
|
-
this.clickedRows.add(row);
|
|
197
|
-
}
|
|
198
|
-
// the cell of a row rendered in view mode; the row's view fields are built once and cached
|
|
199
|
-
// against the row itself, so they follow it through sorting, filtering and paging
|
|
200
|
-
viewFieldOf(row, index) {
|
|
201
|
-
let viewFields = this.#rowViewFields.get(row);
|
|
202
|
-
if (!viewFields) {
|
|
203
|
-
viewFields = this.#fieldValuesMapper(row);
|
|
204
|
-
this.#rowViewFields.set(row, viewFields);
|
|
205
|
-
}
|
|
206
|
-
return viewFields[index];
|
|
207
|
-
}
|
|
208
|
-
// rows carry a stable id (see #buildRow) but sorting/filtering/paging only ever hand back
|
|
209
|
-
// the same row references, so lookup by reference is simplest
|
|
210
|
-
removeRow(row) {
|
|
211
|
-
if (!this.#canModify()) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const index = this.dataSource.data.indexOf(row);
|
|
215
|
-
if (index === -1) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const newData = this.dataSource.data.filter((_, i) => i !== index);
|
|
219
|
-
this.renderRows(newData);
|
|
220
|
-
}
|
|
221
|
-
addRow(values, jsonValues) {
|
|
222
|
-
if (!this.#canModify()) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const row = this.#buildRow(values, jsonValues);
|
|
226
|
-
this.#rowViewFields.set(row, this.#fieldValuesMapper(row));
|
|
227
|
-
this.renderRows([...this.dataSource.data, row]);
|
|
228
|
-
}
|
|
229
|
-
renderRows(rows) {
|
|
230
|
-
this.dataSource = this.#newDataSource(rows);
|
|
231
|
-
this.dataSource.paginator = this.paginator() ?? null;
|
|
232
|
-
this.dataSource.sort = this.sort() ?? null;
|
|
233
|
-
this.#emitRows(rows);
|
|
234
|
-
}
|
|
235
|
-
viewRow(row) {
|
|
236
|
-
this.#applyFieldValues((field) => this.#cellValue(row, field.name), (field) => this.#cellJsonValue(row, field.name));
|
|
237
|
-
this.#fieldValuesOverridden = true;
|
|
238
|
-
this.tableOutletForm.patchValue(this.#toFlatValue(row));
|
|
239
|
-
this.tableOutletForm.disable();
|
|
240
|
-
this.drawer()?.open();
|
|
241
|
-
}
|
|
242
|
-
editRow(row) {
|
|
243
|
-
if (!this.#canModify()) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
this.tableOutletForm.enable();
|
|
247
|
-
this.tableOutletForm.patchValue(this.#toFlatValue(row));
|
|
248
|
-
this.drawer()?.open();
|
|
249
|
-
}
|
|
250
|
-
openNewRow() {
|
|
251
|
-
if (!this.#canModify()) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
this.drawer()?.toggle();
|
|
255
|
-
}
|
|
256
|
-
saveRow(closeDrawer) {
|
|
257
|
-
if (!this.#canModify()) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
const jsonValues = new Map(this.fields().map((f) => [f.name, f.ctrlJsonValue()]));
|
|
261
|
-
this.addRow(this.tableOutletForm.getRawValue(), jsonValues);
|
|
262
|
-
this.tableOutletForm.reset();
|
|
263
|
-
if (closeDrawer) {
|
|
264
|
-
this.drawer()?.close();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
constructFieldChildren(fields) {
|
|
268
|
-
return fields.map((f) => new IssField(f, this.loader));
|
|
269
|
-
}
|
|
270
|
-
#restoreFieldValues() {
|
|
271
|
-
if (!this.#fieldValuesOverridden) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
this.#applyFieldValues((field) => this.#pristineFieldValues.get(field.name), () => null);
|
|
275
|
-
this.#fieldValuesOverridden = false;
|
|
276
|
-
}
|
|
277
|
-
#applyFieldValues(valueOf, jsonValueOf) {
|
|
278
|
-
this.fields.update((fields) => fields.map((field) => {
|
|
279
|
-
field.value = valueOf(field);
|
|
280
|
-
field.ctrlJsonValue.set(jsonValueOf(field));
|
|
281
|
-
return field;
|
|
282
|
-
}));
|
|
283
|
-
}
|
|
284
|
-
// builds the view-mode fields for a row directly from its stored cells, so the value and
|
|
285
|
-
// jsonValue shown always match what was captured when the row was saved
|
|
286
|
-
#fieldValuesMapper(row) {
|
|
287
|
-
return this.fields().map((field) => {
|
|
288
|
-
const fieldWithJsonValue = this.#formEngine.getField(this.tableOutletForm, field.name) ?? field;
|
|
289
|
-
return {
|
|
290
|
-
name: fieldWithJsonValue.name,
|
|
291
|
-
type: fieldWithJsonValue.type,
|
|
292
|
-
ctrlValue: signal(this.#cellValue(row, field.name)),
|
|
293
|
-
ctrlJsonValue: signal(this.#cellJsonValue(row, field.name)),
|
|
294
|
-
config: fieldWithJsonValue.config,
|
|
295
|
-
};
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
#canModify() {
|
|
299
|
-
return !this.ctrl.disabled && !this.readonly();
|
|
300
|
-
}
|
|
301
|
-
// sets the CVA-bound control value to the "*" sentinel (or null when the table is empty)
|
|
302
|
-
// and emits the full {rows} payload through the onChange output for a wrapper to consume
|
|
303
|
-
#emitRows(rows) {
|
|
304
|
-
const submission = this.#toSubmission(rows);
|
|
305
|
-
this.#lastEmitted = submission;
|
|
306
|
-
this.ctrl.setValue(rows.length ? "*" : null);
|
|
307
|
-
this.propagateValue();
|
|
308
|
-
this.emitOnChangeEvent(submission);
|
|
309
|
-
}
|
|
310
|
-
// rebuilds dataSource from a jsonValue payload pushed in from outside (see the `jsonValue`
|
|
311
|
-
// input); accepts either our own {rows: TableRow[]} shape or a plain array of flat
|
|
312
|
-
// {fieldName: value} row objects
|
|
313
|
-
#hydrateRows(payload) {
|
|
314
|
-
const incomingRows = Array.isArray(payload?.rows) ? payload.rows : Array.isArray(payload) ? payload : [];
|
|
315
|
-
const rows = incomingRows.map((row) => this.#normalizeRow(row));
|
|
316
|
-
rows.forEach((row) => this.#rowViewFields.set(row, this.#fieldValuesMapper(row)));
|
|
317
|
-
this.dataSource = this.#newDataSource(rows);
|
|
318
|
-
this.dataSource.paginator = this.paginator() ?? null;
|
|
319
|
-
this.dataSource.sort = this.sort() ?? null;
|
|
320
|
-
this.ctrl.setValue(rows.length ? "*" : null, { emitEvent: false });
|
|
321
|
-
}
|
|
322
|
-
#normalizeRow(row) {
|
|
323
|
-
if (Array.isArray(row?.cells)) {
|
|
324
|
-
return { id: row.id ?? crypto.randomUUID(), index: row.index ?? 0, cells: row.cells };
|
|
325
|
-
}
|
|
326
|
-
return this.#buildRow(row);
|
|
327
|
-
}
|
|
328
|
-
// the canonical row shape (see TableRow) is used for dataSource.data itself, so the
|
|
329
|
-
// submission is just that shape with the current, post-sort/filter position stamped in
|
|
330
|
-
#toSubmission(rows) {
|
|
331
|
-
return { rows: rows.map((row, index) => ({ ...row, index })) };
|
|
332
|
-
}
|
|
333
|
-
#buildRow(values, jsonValues) {
|
|
334
|
-
return {
|
|
335
|
-
id: crypto.randomUUID(),
|
|
336
|
-
index: this.dataSource.data.length,
|
|
337
|
-
cells: this.fields().map((field) => ({
|
|
338
|
-
fieldName: field.name,
|
|
339
|
-
value: values[field.name],
|
|
340
|
-
jsonValue: jsonValues?.get(field.name) ?? null,
|
|
341
|
-
})),
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
#cellValue(row, fieldName) {
|
|
345
|
-
return row.cells.find((cell) => cell.fieldName === fieldName)?.value;
|
|
346
|
-
}
|
|
347
|
-
#cellJsonValue(row, fieldName) {
|
|
348
|
-
return row.cells.find((cell) => cell.fieldName === fieldName)?.jsonValue ?? null;
|
|
349
|
-
}
|
|
350
|
-
#toFlatValue(row) {
|
|
351
|
-
return Object.fromEntries(row.cells.map((cell) => [cell.fieldName, cell.value]));
|
|
352
|
-
}
|
|
353
|
-
#newDataSource(rows) {
|
|
354
|
-
const dataSource = new MatTableDataSource(rows);
|
|
355
|
-
dataSource.filterPredicate = (row, filter) => row.cells.some((cell) => `${cell.value ?? ""}`.toLowerCase().includes(filter));
|
|
356
|
-
dataSource.sortingDataAccessor = (row, sortHeaderId) => this.#cellValue(row, sortHeaderId) ?? "";
|
|
357
|
-
return dataSource;
|
|
358
|
-
}
|
|
359
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TableControl, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
360
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: TableControl, isStandalone: true, selector: "iss-ctrl-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: true, transformFunction: null }, withFilter: { classPropertyName: "withFilter", publicName: "withFilter", isSignal: true, isRequired: false, transformFunction: null }, withSort: { classPropertyName: "withSort", publicName: "withSort", isSignal: true, isRequired: false, transformFunction: null }, withPagination: { classPropertyName: "withPagination", publicName: "withPagination", isSignal: true, isRequired: false, transformFunction: null }, jsonValue: { classPropertyName: "jsonValue", publicName: "jsonValue", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
|
361
|
-
{ provide: NG_VALUE_ACCESSOR, useExisting: TableControl, multi: true },
|
|
362
|
-
], viewQueries: [{ propertyName: "drawer", first: true, predicate: ["drawer"], descendants: true, isSignal: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true, isSignal: true }, { propertyName: "sort", first: true, predicate: MatSort, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
363
|
-
<mat-sidenav-container [hasBackdrop]="true">
|
|
364
|
-
<mat-sidenav #drawer [mode]="'over'" [position]="'start'" [autoFocus]="false">
|
|
365
|
-
<form [formGroup]="tableOutletForm">
|
|
366
|
-
<iss-form-outlet [fields]="fields()"/>
|
|
367
|
-
</form>
|
|
368
|
-
<ds-button (click)="saveRow(true)">save
|
|
369
|
-
</ds-button>
|
|
370
|
-
<ds-button (click)="saveRow(false)">save and add more</ds-button>
|
|
371
|
-
</mat-sidenav>
|
|
372
|
-
<mat-sidenav-content>
|
|
373
|
-
<div>
|
|
374
|
-
<ds-button icon="true" (click)="openNewRow()">
|
|
375
|
-
<ds-icon icon="plus"></ds-icon>
|
|
376
|
-
</ds-button>
|
|
377
|
-
<!--<button mat-raised-button (click)="removeRow()" class="demo-button">Remove data</button>-->
|
|
378
|
-
</div>
|
|
379
|
-
@if (withFilter()) {
|
|
380
|
-
<mat-form-field>
|
|
381
|
-
<mat-label>Filter</mat-label>
|
|
382
|
-
<input matInput (keyup)="applyFilter($event)" placeholder="Search in table" #input>
|
|
383
|
-
</mat-form-field>
|
|
384
|
-
}
|
|
385
|
-
<div class="mat-elevation-z8">
|
|
386
|
-
<table mat-table [dataSource]="dataSource" matSort>
|
|
387
|
-
<tr mat-header-row *matHeaderRowDef="fieldNames()"></tr>
|
|
388
|
-
<tr mat-row *matRowDef="let row; columns: fieldNames();" (click)="onRowClick(row)"></tr>
|
|
389
|
-
|
|
390
|
-
@for (col of fieldNames(); track col) {
|
|
391
|
-
@if (col !== "actions") {
|
|
392
|
-
<ng-container [matColumnDef]="col">
|
|
393
|
-
<th mat-header-cell *matHeaderCellDef mat-sort-header [disabled]="!fieldsMap().get(col)?.config?.tableWithSort()">
|
|
394
|
-
{{ columnLabels()[$index] }}
|
|
395
|
-
</th>
|
|
396
|
-
<td mat-cell *matCellDef="let row">
|
|
397
|
-
@if (viewFieldOf(row, $index); as viewField) {
|
|
398
|
-
<iss-viewer-field [field]="viewField"/>
|
|
399
|
-
}
|
|
400
|
-
</td>
|
|
401
|
-
</ng-container>
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
<!-- Actions -->
|
|
406
|
-
<ng-container matColumnDef="actions">
|
|
407
|
-
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
|
408
|
-
<td mat-cell *matCellDef="let row">
|
|
409
|
-
<ds-icon icon="eye" class="cursor-pointer" (click)="viewRow(row)"></ds-icon>
|
|
410
|
-
<ds-icon icon="pen" class="cursor-pointer" (click)="editRow(row)"></ds-icon>
|
|
411
|
-
<ds-icon icon="trash" class="cursor-pointer fc-red" (click)="removeRow(row)"></ds-icon>
|
|
412
|
-
</td>
|
|
413
|
-
</ng-container>
|
|
414
|
-
|
|
415
|
-
<tr class="mat-row" *matNoDataRow>
|
|
416
|
-
<td class="mat-cell" colspan="4">
|
|
417
|
-
<ds-message type="emptyCard"></ds-message>
|
|
418
|
-
</td>
|
|
419
|
-
</tr>
|
|
420
|
-
</table>
|
|
421
|
-
|
|
422
|
-
@if (withPagination()) {
|
|
423
|
-
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]" aria-label="Select page number"></mat-paginator>
|
|
424
|
-
}
|
|
425
|
-
</div>
|
|
426
|
-
</mat-sidenav-content>
|
|
427
|
-
</mat-sidenav-container>
|
|
428
|
-
`, isInline: true, styles: [".mat-drawer{position:fixed;left:0}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i2.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i2.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i2.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i2.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i2.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i2.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i2.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i2.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i2.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i2.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i2.MatNoDataRow, selector: "ng-template[matNoDataRow]" }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i3.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i3.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i4.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: MatSidenavModule }, { kind: "component", type: i5.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i5.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i5.MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: Outlet, selector: "iss-form-outlet", inputs: ["fields"], outputs: ["ready"] }, { kind: "component", type: FieldViewer, selector: "iss-viewer-field" }] });
|
|
429
|
-
}
|
|
430
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TableControl, decorators: [{
|
|
431
|
-
type: Component,
|
|
432
|
-
args: [{ selector: "iss-ctrl-table", imports: [
|
|
433
|
-
MatFormFieldModule,
|
|
434
|
-
MatInputModule,
|
|
435
|
-
MatTableModule,
|
|
436
|
-
MatSortModule,
|
|
437
|
-
MatPaginatorModule,
|
|
438
|
-
MatSidenavModule,
|
|
439
|
-
ReactiveFormsModule,
|
|
440
|
-
Outlet,
|
|
441
|
-
FieldViewer,
|
|
442
|
-
], providers: [
|
|
443
|
-
{ provide: NG_VALUE_ACCESSOR, useExisting: TableControl, multi: true },
|
|
444
|
-
], schemas: [CUSTOM_ELEMENTS_SCHEMA], template: `
|
|
445
|
-
<mat-sidenav-container [hasBackdrop]="true">
|
|
446
|
-
<mat-sidenav #drawer [mode]="'over'" [position]="'start'" [autoFocus]="false">
|
|
447
|
-
<form [formGroup]="tableOutletForm">
|
|
448
|
-
<iss-form-outlet [fields]="fields()"/>
|
|
449
|
-
</form>
|
|
450
|
-
<ds-button (click)="saveRow(true)">save
|
|
451
|
-
</ds-button>
|
|
452
|
-
<ds-button (click)="saveRow(false)">save and add more</ds-button>
|
|
453
|
-
</mat-sidenav>
|
|
454
|
-
<mat-sidenav-content>
|
|
455
|
-
<div>
|
|
456
|
-
<ds-button icon="true" (click)="openNewRow()">
|
|
457
|
-
<ds-icon icon="plus"></ds-icon>
|
|
458
|
-
</ds-button>
|
|
459
|
-
<!--<button mat-raised-button (click)="removeRow()" class="demo-button">Remove data</button>-->
|
|
460
|
-
</div>
|
|
461
|
-
@if (withFilter()) {
|
|
462
|
-
<mat-form-field>
|
|
463
|
-
<mat-label>Filter</mat-label>
|
|
464
|
-
<input matInput (keyup)="applyFilter($event)" placeholder="Search in table" #input>
|
|
465
|
-
</mat-form-field>
|
|
466
|
-
}
|
|
467
|
-
<div class="mat-elevation-z8">
|
|
468
|
-
<table mat-table [dataSource]="dataSource" matSort>
|
|
469
|
-
<tr mat-header-row *matHeaderRowDef="fieldNames()"></tr>
|
|
470
|
-
<tr mat-row *matRowDef="let row; columns: fieldNames();" (click)="onRowClick(row)"></tr>
|
|
471
|
-
|
|
472
|
-
@for (col of fieldNames(); track col) {
|
|
473
|
-
@if (col !== "actions") {
|
|
474
|
-
<ng-container [matColumnDef]="col">
|
|
475
|
-
<th mat-header-cell *matHeaderCellDef mat-sort-header [disabled]="!fieldsMap().get(col)?.config?.tableWithSort()">
|
|
476
|
-
{{ columnLabels()[$index] }}
|
|
477
|
-
</th>
|
|
478
|
-
<td mat-cell *matCellDef="let row">
|
|
479
|
-
@if (viewFieldOf(row, $index); as viewField) {
|
|
480
|
-
<iss-viewer-field [field]="viewField"/>
|
|
481
|
-
}
|
|
482
|
-
</td>
|
|
483
|
-
</ng-container>
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
<!-- Actions -->
|
|
488
|
-
<ng-container matColumnDef="actions">
|
|
489
|
-
<th mat-header-cell *matHeaderCellDef mat-sort-header></th>
|
|
490
|
-
<td mat-cell *matCellDef="let row">
|
|
491
|
-
<ds-icon icon="eye" class="cursor-pointer" (click)="viewRow(row)"></ds-icon>
|
|
492
|
-
<ds-icon icon="pen" class="cursor-pointer" (click)="editRow(row)"></ds-icon>
|
|
493
|
-
<ds-icon icon="trash" class="cursor-pointer fc-red" (click)="removeRow(row)"></ds-icon>
|
|
494
|
-
</td>
|
|
495
|
-
</ng-container>
|
|
496
|
-
|
|
497
|
-
<tr class="mat-row" *matNoDataRow>
|
|
498
|
-
<td class="mat-cell" colspan="4">
|
|
499
|
-
<ds-message type="emptyCard"></ds-message>
|
|
500
|
-
</td>
|
|
501
|
-
</tr>
|
|
502
|
-
</table>
|
|
503
|
-
|
|
504
|
-
@if (withPagination()) {
|
|
505
|
-
<mat-paginator [pageSizeOptions]="[5, 10, 25, 100]" aria-label="Select page number"></mat-paginator>
|
|
506
|
-
}
|
|
507
|
-
</div>
|
|
508
|
-
</mat-sidenav-content>
|
|
509
|
-
</mat-sidenav-container>
|
|
510
|
-
`, styles: [".mat-drawer{position:fixed;left:0}\n"] }]
|
|
511
|
-
}], propDecorators: { columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: true }] }], withFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "withFilter", required: false }] }], withSort: [{ type: i0.Input, args: [{ isSignal: true, alias: "withSort", required: false }] }], withPagination: [{ type: i0.Input, args: [{ isSignal: true, alias: "withPagination", required: false }] }], jsonValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "jsonValue", required: false }] }], drawer: [{ type: i0.ViewChild, args: ["drawer", { isSignal: true }] }], paginator: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatPaginator), { isSignal: true }] }], sort: [{ type: i0.ViewChild, args: [i0.forwardRef(() => MatSort), { isSignal: true }] }] } });
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* `<iss-field-table>` — repeatable rows, each row being a small form built from the child fields.
|
|
515
|
-
*
|
|
516
|
-
* Rendered by the outlet for fields of type `table`. It renders {@link TableControl} plus the
|
|
517
|
-
* validation message in `edit` mode; there is no `view` mode template, so the field renders
|
|
518
|
-
* nothing outside edit mode.
|
|
519
|
-
*
|
|
520
|
-
* ### Supported `config` keys
|
|
521
|
-
* | Key | Type | Description |
|
|
522
|
-
* | --- | --- | --- |
|
|
523
|
-
* | `tableWithFilter` | `boolean` | Shows the filter row. |
|
|
524
|
-
* | `tableWithSort` | `boolean` | Enables column sorting. |
|
|
525
|
-
* | `tableWithPagination` | `boolean` | Shows the paginator. |
|
|
526
|
-
* | `readonly` | `boolean` | Shows the value but blocks interaction. |
|
|
527
|
-
*
|
|
528
|
-
* ### Other field members used
|
|
529
|
-
* `children` · `ctrlJsonValue()`
|
|
530
|
-
*
|
|
531
|
-
* Every field also honours `visible`, `mode`, `validation`, `asyncValidation` and
|
|
532
|
-
* `events` — see {@link IssField} for the full model and {@link FieldConfig} for all keys.
|
|
533
|
-
*
|
|
534
|
-
* Columns come from `field.children`: every child is both a column and an editor input.
|
|
535
|
-
*
|
|
536
|
-
* @example
|
|
537
|
-
* ```json
|
|
538
|
-
* { "name": "items", "type": "table", "children": [{ "name": "qty", "type": "text_input", "label": "Qty" }] }
|
|
539
|
-
* ```
|
|
540
|
-
*/
|
|
541
|
-
class TableField extends FieldBase {
|
|
542
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TableField, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
543
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: TableField, isStandalone: true, selector: "iss-field-table", usesInheritance: true, ngImport: i0, template: `
|
|
544
|
-
@if (field.visible()) {
|
|
545
|
-
@if (field.mode() === "edit") {
|
|
546
|
-
<iss-ctrl-table
|
|
547
|
-
[formControlName]="field.name"
|
|
548
|
-
[columns]="field.children"
|
|
549
|
-
[withFilter]="field.config.tableWithFilter() ?? false"
|
|
550
|
-
[withSort]="field.config.tableWithSort() ?? false"
|
|
551
|
-
[withPagination]="field.config.tableWithPagination() ?? false"
|
|
552
|
-
[readonly]="field.config.readonly() ?? false"
|
|
553
|
-
[jsonValue]="field.ctrlJsonValue()"
|
|
554
|
-
(onChange)="field.ctrlJsonValue.set($event)"
|
|
555
|
-
/>
|
|
556
|
-
<iss-validation-message-viewer [errors]="ctrl.errors" [showMessage]="!ctrl.untouched"/>
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: TableControl, selector: "iss-ctrl-table", inputs: ["columns", "withFilter", "withSort", "withPagination", "jsonValue"] }, { kind: "component", type: ValidationMessageComponent, selector: "iss-validation-message-viewer", inputs: ["errors", "showMessage"] }], viewProviders: [VIEW_PROVIDER] });
|
|
560
|
-
}
|
|
561
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: TableField, decorators: [{
|
|
562
|
-
type: Component,
|
|
563
|
-
args: [{
|
|
564
|
-
selector: "iss-field-table",
|
|
565
|
-
viewProviders: [VIEW_PROVIDER],
|
|
566
|
-
imports: [
|
|
567
|
-
ReactiveFormsModule,
|
|
568
|
-
TableControl,
|
|
569
|
-
ValidationMessageComponent,
|
|
570
|
-
],
|
|
571
|
-
template: `
|
|
572
|
-
@if (field.visible()) {
|
|
573
|
-
@if (field.mode() === "edit") {
|
|
574
|
-
<iss-ctrl-table
|
|
575
|
-
[formControlName]="field.name"
|
|
576
|
-
[columns]="field.children"
|
|
577
|
-
[withFilter]="field.config.tableWithFilter() ?? false"
|
|
578
|
-
[withSort]="field.config.tableWithSort() ?? false"
|
|
579
|
-
[withPagination]="field.config.tableWithPagination() ?? false"
|
|
580
|
-
[readonly]="field.config.readonly() ?? false"
|
|
581
|
-
[jsonValue]="field.ctrlJsonValue()"
|
|
582
|
-
(onChange)="field.ctrlJsonValue.set($event)"
|
|
583
|
-
/>
|
|
584
|
-
<iss-validation-message-viewer [errors]="ctrl.errors" [showMessage]="!ctrl.untouched"/>
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
`
|
|
588
|
-
}]
|
|
589
|
-
}] });
|
|
590
|
-
|
|
591
|
-
export { TableField };
|
|
592
|
-
//# sourceMappingURL=iss-ctrl-table.field-CDSVakji.mjs.map
|