@jsonforms/angular-material 3.8.0-alpha.0 → 3.8.0-alpha.2
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/lib/fesm2022/jsonforms-angular-material.mjs +335 -431
- package/lib/fesm2022/jsonforms-angular-material.mjs.map +1 -1
- package/lib/index.d.ts +353 -4
- package/lib/index.d.ts.map +1 -0
- package/package.json +36 -37
- package/src/library/controls/boolean.renderer.ts +3 -7
- package/src/library/controls/date.renderer.ts +4 -9
- package/src/library/controls/{autocomplete.renderer.ts → enum.renderer.ts} +92 -70
- package/src/library/controls/index.ts +1 -1
- package/src/library/controls/number.renderer.ts +1 -5
- package/src/library/controls/range.renderer.ts +4 -8
- package/src/library/controls/text.renderer.ts +1 -4
- package/src/library/controls/textarea.renderer.ts +1 -4
- package/src/library/controls/toggle.renderer.ts +4 -8
- package/src/library/index.ts +6 -4
- package/src/library/layouts/array-layout.renderer.ts +1 -8
- package/src/library/layouts/categorization-layout.renderer.ts +2 -4
- package/src/library/layouts/group-layout.renderer.ts +3 -14
- package/src/library/layouts/horizontal-layout.renderer.ts +3 -14
- package/src/library/layouts/layout.renderer.ts +3 -6
- package/src/library/layouts/vertical-layout.renderer.ts +3 -14
- package/src/library/module.ts +8 -3
- package/src/library/other/label.renderer.ts +2 -4
- package/src/library/other/master-detail/master.ts +4 -11
- package/src/library/other/object.renderer.ts +0 -4
- package/src/library/other/table.renderer.ts +1 -8
- package/lib/jsonforms-angular-material.d.ts.map +0 -1
- package/lib/library/controls/autocomplete.renderer.d.ts +0 -32
- package/lib/library/controls/autocomplete.renderer.d.ts.map +0 -1
- package/lib/library/controls/boolean.renderer.d.ts +0 -15
- package/lib/library/controls/boolean.renderer.d.ts.map +0 -1
- package/lib/library/controls/date.renderer.d.ts +0 -24
- package/lib/library/controls/date.renderer.d.ts.map +0 -1
- package/lib/library/controls/index.d.ts +0 -9
- package/lib/library/controls/index.d.ts.map +0 -1
- package/lib/library/controls/number.renderer.d.ts +0 -24
- package/lib/library/controls/number.renderer.d.ts.map +0 -1
- package/lib/library/controls/range.renderer.d.ts +0 -18
- package/lib/library/controls/range.renderer.d.ts.map +0 -1
- package/lib/library/controls/text.renderer.d.ts +0 -13
- package/lib/library/controls/text.renderer.d.ts.map +0 -1
- package/lib/library/controls/textarea.renderer.d.ts +0 -12
- package/lib/library/controls/textarea.renderer.d.ts.map +0 -1
- package/lib/library/controls/toggle.renderer.d.ts +0 -15
- package/lib/library/controls/toggle.renderer.d.ts.map +0 -1
- package/lib/library/index.d.ts +0 -11
- package/lib/library/index.d.ts.map +0 -1
- package/lib/library/layouts/array-layout.renderer.d.ts +0 -34
- package/lib/library/layouts/array-layout.renderer.d.ts.map +0 -1
- package/lib/library/layouts/categorization-layout.renderer.d.ts +0 -16
- package/lib/library/layouts/categorization-layout.renderer.d.ts.map +0 -1
- package/lib/library/layouts/group-layout.renderer.d.ts +0 -12
- package/lib/library/layouts/group-layout.renderer.d.ts.map +0 -1
- package/lib/library/layouts/horizontal-layout.renderer.d.ts +0 -12
- package/lib/library/layouts/horizontal-layout.renderer.d.ts.map +0 -1
- package/lib/library/layouts/index.d.ts +0 -7
- package/lib/library/layouts/index.d.ts.map +0 -1
- package/lib/library/layouts/layout.renderer.d.ts +0 -21
- package/lib/library/layouts/layout.renderer.d.ts.map +0 -1
- package/lib/library/layouts/vertical-layout.renderer.d.ts +0 -12
- package/lib/library/layouts/vertical-layout.renderer.d.ts.map +0 -1
- package/lib/library/module.d.ts +0 -48
- package/lib/library/module.d.ts.map +0 -1
- package/lib/library/other/index.d.ts +0 -5
- package/lib/library/other/index.d.ts.map +0 -1
- package/lib/library/other/label.renderer.d.ts +0 -15
- package/lib/library/other/label.renderer.d.ts.map +0 -1
- package/lib/library/other/master-detail/detail.d.ts +0 -10
- package/lib/library/other/master-detail/detail.d.ts.map +0 -1
- package/lib/library/other/master-detail/index.d.ts +0 -3
- package/lib/library/other/master-detail/index.d.ts.map +0 -1
- package/lib/library/other/master-detail/master.d.ts +0 -32
- package/lib/library/other/master-detail/master.d.ts.map +0 -1
- package/lib/library/other/object.renderer.d.ts +0 -12
- package/lib/library/other/object.renderer.d.ts.map +0 -1
- package/lib/library/other/table.renderer.d.ts +0 -47
- package/lib/library/other/table.renderer.d.ts.map +0 -1
- package/lib/library/util/date-format.d.ts +0 -17
- package/lib/library/util/date-format.d.ts.map +0 -1
- package/lib/library/util/dayjs-date-adapter.d.ts +0 -28
- package/lib/library/util/dayjs-date-adapter.d.ts.map +0 -1
- package/lib/public_api.d.ts +0 -2
- package/lib/public_api.d.ts.map +0 -1
|
@@ -29,15 +29,17 @@ import {
|
|
|
29
29
|
OnInit,
|
|
30
30
|
} from '@angular/core';
|
|
31
31
|
import type { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
|
32
|
-
import {
|
|
32
|
+
import { JsonFormsControl } from '@jsonforms/angular';
|
|
33
33
|
import {
|
|
34
34
|
Actions,
|
|
35
35
|
composeWithUi,
|
|
36
36
|
ControlElement,
|
|
37
37
|
EnumOption,
|
|
38
38
|
isEnumControl,
|
|
39
|
+
isOneOfEnumControl,
|
|
39
40
|
JsonFormsState,
|
|
40
41
|
mapStateToEnumControlProps,
|
|
42
|
+
mapStateToOneOfEnumControlProps,
|
|
41
43
|
OwnPropsOfControl,
|
|
42
44
|
OwnPropsOfEnum,
|
|
43
45
|
RankedTester,
|
|
@@ -52,51 +54,53 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|
|
52
54
|
import { MatInputModule } from '@angular/material/input';
|
|
53
55
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{{ option.label }}
|
|
80
|
-
</mat-option>
|
|
81
|
-
}
|
|
82
|
-
</mat-autocomplete>
|
|
83
|
-
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
84
|
-
description
|
|
85
|
-
}}</mat-hint>
|
|
86
|
-
<mat-error>{{ error }}</mat-error>
|
|
87
|
-
</mat-form-field>
|
|
88
|
-
`,
|
|
89
|
-
styles: [
|
|
90
|
-
`
|
|
91
|
-
:host {
|
|
92
|
-
display: flex;
|
|
93
|
-
flex-direction: row;
|
|
94
|
-
}
|
|
95
|
-
mat-form-field {
|
|
96
|
-
flex: 1 1 auto;
|
|
57
|
+
const template = `
|
|
58
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
59
|
+
<mat-label>{{ label }}</mat-label>
|
|
60
|
+
<input
|
|
61
|
+
matInput
|
|
62
|
+
type="text"
|
|
63
|
+
(change)="onChange($event)"
|
|
64
|
+
[id]="id"
|
|
65
|
+
[formControl]="form"
|
|
66
|
+
[matAutocomplete]="auto"
|
|
67
|
+
(keydown)="updateFilter($event)"
|
|
68
|
+
(focus)="focused = true"
|
|
69
|
+
(focusout)="focused = false"
|
|
70
|
+
/>
|
|
71
|
+
<mat-autocomplete
|
|
72
|
+
autoActiveFirstOption
|
|
73
|
+
#auto="matAutocomplete"
|
|
74
|
+
(optionSelected)="onSelect($event)"
|
|
75
|
+
[displayWith]="displayFn"
|
|
76
|
+
>
|
|
77
|
+
@for (option of filteredOptions | async; track option.value) {
|
|
78
|
+
<mat-option [value]="option">
|
|
79
|
+
{{ option.label }}
|
|
80
|
+
</mat-option>
|
|
97
81
|
}
|
|
98
|
-
|
|
99
|
-
|
|
82
|
+
</mat-autocomplete>
|
|
83
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
84
|
+
description
|
|
85
|
+
}}</mat-hint>
|
|
86
|
+
<mat-error>{{ error }}</mat-error>
|
|
87
|
+
</mat-form-field>
|
|
88
|
+
`;
|
|
89
|
+
|
|
90
|
+
const style = `
|
|
91
|
+
:host {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: row;
|
|
94
|
+
}
|
|
95
|
+
mat-form-field {
|
|
96
|
+
flex: 1 1 auto;
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
|
|
100
|
+
@Component({
|
|
101
|
+
selector: 'OneOfEnumControlRenderer',
|
|
102
|
+
template,
|
|
103
|
+
styles: [style],
|
|
100
104
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
101
105
|
imports: [
|
|
102
106
|
CommonModule,
|
|
@@ -106,24 +110,20 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
|
106
110
|
MatAutocompleteModule,
|
|
107
111
|
],
|
|
108
112
|
})
|
|
109
|
-
export class
|
|
113
|
+
export class OneOfEnumControlRenderer
|
|
110
114
|
extends JsonFormsControl
|
|
111
115
|
implements OnInit
|
|
112
116
|
{
|
|
113
|
-
@Input() options?: EnumOption[]
|
|
117
|
+
@Input() options?: EnumOption[];
|
|
114
118
|
valuesToTranslatedOptions?: Map<string, EnumOption>;
|
|
115
119
|
filteredOptions: Observable<EnumOption[]>;
|
|
116
120
|
shouldFilter: boolean;
|
|
117
121
|
focused = false;
|
|
118
122
|
|
|
119
|
-
constructor(jsonformsService: JsonFormsAngularService) {
|
|
120
|
-
super(jsonformsService);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
123
|
protected override mapToProps(
|
|
124
124
|
state: JsonFormsState
|
|
125
125
|
): StatePropsOfControl & OwnPropsOfEnum {
|
|
126
|
-
return
|
|
126
|
+
return mapStateToOneOfEnumControlProps(state, this.getOwnProps());
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
getEventValue = (event: any) => event.target.value;
|
|
@@ -209,29 +209,51 @@ export class AutocompleteControlRenderer
|
|
|
209
209
|
protected getOwnProps(): OwnPropsOfControl & OwnPropsOfEnum {
|
|
210
210
|
return {
|
|
211
211
|
...super.getOwnProps(),
|
|
212
|
-
options: this.
|
|
212
|
+
options: this.options,
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
+
}
|
|
215
216
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
217
|
+
export const oneOfEnumControlTester: RankedTester = rankWith(
|
|
218
|
+
5,
|
|
219
|
+
isOneOfEnumControl
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
@Component({
|
|
223
|
+
selector: 'EnumControlRenderer, AutocompleteControlRenderer',
|
|
224
|
+
template,
|
|
225
|
+
styles: [style],
|
|
226
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
227
|
+
imports: [
|
|
228
|
+
CommonModule,
|
|
229
|
+
ReactiveFormsModule,
|
|
230
|
+
MatFormFieldModule,
|
|
231
|
+
MatInputModule,
|
|
232
|
+
MatAutocompleteModule,
|
|
233
|
+
],
|
|
234
|
+
})
|
|
235
|
+
export class EnumControlRenderer extends OneOfEnumControlRenderer {
|
|
236
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
237
|
+
@Input('options')
|
|
238
|
+
set stringOptions(strOptions: string[]) {
|
|
239
|
+
this.options = strOptions.map((str) => {
|
|
240
|
+
return {
|
|
241
|
+
label: str,
|
|
242
|
+
value: str,
|
|
243
|
+
};
|
|
244
|
+
});
|
|
245
|
+
}
|
|
225
246
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
value: str,
|
|
231
|
-
} satisfies EnumOption;
|
|
232
|
-
})
|
|
233
|
-
: options;
|
|
247
|
+
protected override mapToProps(
|
|
248
|
+
state: JsonFormsState
|
|
249
|
+
): StatePropsOfControl & OwnPropsOfEnum {
|
|
250
|
+
return mapStateToEnumControlProps(state, this.getOwnProps());
|
|
234
251
|
}
|
|
235
252
|
}
|
|
236
253
|
|
|
254
|
+
/**
|
|
255
|
+
* For {@link AutocompleteControlRenderer} class name backwards compatibility
|
|
256
|
+
*/
|
|
257
|
+
export { EnumControlRenderer as AutocompleteControlRenderer };
|
|
258
|
+
|
|
237
259
|
export const enumControlTester: RankedTester = rankWith(2, isEnumControl);
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
26
|
-
import {
|
|
26
|
+
import { JsonFormsControl } from '@jsonforms/angular';
|
|
27
27
|
import {
|
|
28
28
|
isIntegerControl,
|
|
29
29
|
isNumberControl,
|
|
@@ -92,10 +92,6 @@ export class NumberControlRenderer extends JsonFormsControl {
|
|
|
92
92
|
decimalSeparator: string;
|
|
93
93
|
focused = false;
|
|
94
94
|
|
|
95
|
-
constructor(jsonformsService: JsonFormsAngularService) {
|
|
96
|
-
super(jsonformsService);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
95
|
onChange(ev: any) {
|
|
100
96
|
const data = this.oldValue
|
|
101
97
|
? ev.target.value.replace(this.oldValue, '')
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import {
|
|
26
26
|
ChangeDetectionStrategy,
|
|
27
|
-
Component,
|
|
28
27
|
ChangeDetectorRef,
|
|
28
|
+
Component,
|
|
29
|
+
inject,
|
|
29
30
|
} from '@angular/core';
|
|
30
|
-
import {
|
|
31
|
+
import { JsonFormsControl } from '@jsonforms/angular';
|
|
31
32
|
import { isRangeControl, RankedTester, rankWith } from '@jsonforms/core';
|
|
32
33
|
import { CommonModule } from '@angular/common';
|
|
33
34
|
import { MatSliderModule } from '@angular/material/slider';
|
|
@@ -80,12 +81,7 @@ export class RangeControlRenderer extends JsonFormsControl {
|
|
|
80
81
|
multipleOf: number;
|
|
81
82
|
focused = false;
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
jsonformsService: JsonFormsAngularService,
|
|
85
|
-
private changeDetectorRef: ChangeDetectorRef
|
|
86
|
-
) {
|
|
87
|
-
super(jsonformsService);
|
|
88
|
-
}
|
|
84
|
+
private changeDetectorRef = inject(ChangeDetectorRef);
|
|
89
85
|
getEventValue = (event: number) => Number(event);
|
|
90
86
|
mapAdditionalProps() {
|
|
91
87
|
if (this.scopedSchema) {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
26
|
-
import {
|
|
26
|
+
import { JsonFormsControl } from '@jsonforms/angular';
|
|
27
27
|
import { isStringControl, RankedTester, rankWith } from '@jsonforms/core';
|
|
28
28
|
import { CommonModule } from '@angular/common';
|
|
29
29
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
@@ -71,9 +71,6 @@ import { MatInputModule } from '@angular/material/input';
|
|
|
71
71
|
})
|
|
72
72
|
export class TextControlRenderer extends JsonFormsControl {
|
|
73
73
|
focused = false;
|
|
74
|
-
constructor(jsonformsService: JsonFormsAngularService) {
|
|
75
|
-
super(jsonformsService);
|
|
76
|
-
}
|
|
77
74
|
getEventValue = (event: any) => event.target.value || undefined;
|
|
78
75
|
getType = (): string => {
|
|
79
76
|
if (this.uischema.options && this.uischema.options.format) {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
26
|
-
import {
|
|
26
|
+
import { JsonFormsControl } from '@jsonforms/angular';
|
|
27
27
|
import { isMultiLineControl, RankedTester, rankWith } from '@jsonforms/core';
|
|
28
28
|
import { CommonModule } from '@angular/common';
|
|
29
29
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
@@ -70,9 +70,6 @@ import { MatInputModule } from '@angular/material/input';
|
|
|
70
70
|
})
|
|
71
71
|
export class TextAreaRenderer extends JsonFormsControl {
|
|
72
72
|
focused = false;
|
|
73
|
-
constructor(jsonformsService: JsonFormsAngularService) {
|
|
74
|
-
super(jsonformsService);
|
|
75
|
-
}
|
|
76
73
|
getEventValue = (event: any) => event.target.value || undefined;
|
|
77
74
|
}
|
|
78
75
|
export const TextAreaRendererTester: RankedTester = rankWith(
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import {
|
|
26
26
|
ChangeDetectionStrategy,
|
|
27
|
-
Component,
|
|
28
27
|
ChangeDetectorRef,
|
|
28
|
+
Component,
|
|
29
|
+
inject,
|
|
29
30
|
} from '@angular/core';
|
|
30
|
-
import {
|
|
31
|
+
import { JsonFormsControl } from '@jsonforms/angular';
|
|
31
32
|
import {
|
|
32
33
|
and,
|
|
33
34
|
isBooleanControl,
|
|
@@ -61,12 +62,7 @@ import { MatFormFieldModule } from '@angular/material/form-field';
|
|
|
61
62
|
imports: [CommonModule, MatSlideToggleModule, MatFormFieldModule],
|
|
62
63
|
})
|
|
63
64
|
export class ToggleControlRenderer extends JsonFormsControl {
|
|
64
|
-
|
|
65
|
-
jsonformsService: JsonFormsAngularService,
|
|
66
|
-
private changeDetectorRef: ChangeDetectorRef
|
|
67
|
-
) {
|
|
68
|
-
super(jsonformsService);
|
|
69
|
-
}
|
|
65
|
+
private changeDetectorRef = inject(ChangeDetectorRef);
|
|
70
66
|
isChecked = () => this.data || false;
|
|
71
67
|
getEventValue = (event: any) => event.checked;
|
|
72
68
|
mapAdditionalProps() {
|
package/src/library/index.ts
CHANGED
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
import 'hammerjs';
|
|
26
25
|
import { RankedTester } from '@jsonforms/core';
|
|
27
26
|
export * from './module';
|
|
28
27
|
import {
|
|
@@ -54,9 +53,11 @@ import {
|
|
|
54
53
|
ToggleControlRendererTester,
|
|
55
54
|
} from './controls/toggle.renderer';
|
|
56
55
|
import {
|
|
57
|
-
|
|
56
|
+
EnumControlRenderer,
|
|
58
57
|
enumControlTester,
|
|
59
|
-
|
|
58
|
+
OneOfEnumControlRenderer,
|
|
59
|
+
oneOfEnumControlTester,
|
|
60
|
+
} from './controls/enum.renderer';
|
|
60
61
|
import {
|
|
61
62
|
ObjectControlRenderer,
|
|
62
63
|
ObjectControlRendererTester,
|
|
@@ -106,7 +107,8 @@ export const angularMaterialRenderers: {
|
|
|
106
107
|
{ tester: RangeControlRendererTester, renderer: RangeControlRenderer },
|
|
107
108
|
{ tester: DateControlRendererTester, renderer: DateControlRenderer },
|
|
108
109
|
{ tester: ToggleControlRendererTester, renderer: ToggleControlRenderer },
|
|
109
|
-
{ tester: enumControlTester, renderer:
|
|
110
|
+
{ tester: enumControlTester, renderer: EnumControlRenderer },
|
|
111
|
+
{ tester: oneOfEnumControlTester, renderer: OneOfEnumControlRenderer },
|
|
110
112
|
{ tester: ObjectControlRendererTester, renderer: ObjectControlRenderer },
|
|
111
113
|
// layouts
|
|
112
114
|
{ tester: verticalLayoutTester, renderer: VerticalLayoutRenderer },
|
|
@@ -29,11 +29,7 @@ import { MatButtonModule } from '@angular/material/button';
|
|
|
29
29
|
import { MatIconModule } from '@angular/material/icon';
|
|
30
30
|
import { MatBadgeModule } from '@angular/material/badge';
|
|
31
31
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
32
|
-
import {
|
|
33
|
-
JsonFormsAngularService,
|
|
34
|
-
JsonFormsAbstractControl,
|
|
35
|
-
JsonFormsModule,
|
|
36
|
-
} from '@jsonforms/angular';
|
|
32
|
+
import { JsonFormsAbstractControl, JsonFormsModule } from '@jsonforms/angular';
|
|
37
33
|
import {
|
|
38
34
|
arrayDefaultTranslations,
|
|
39
35
|
ArrayLayoutProps,
|
|
@@ -192,9 +188,6 @@ export class ArrayLayoutRenderer
|
|
|
192
188
|
tester: UISchemaTester;
|
|
193
189
|
uischema: UISchemaElement;
|
|
194
190
|
}[];
|
|
195
|
-
constructor(jsonFormsService: JsonFormsAngularService) {
|
|
196
|
-
super(jsonFormsService);
|
|
197
|
-
}
|
|
198
191
|
mapToProps(
|
|
199
192
|
state: JsonFormsState
|
|
200
193
|
): StatePropsOfArrayLayout & { translations: ArrayTranslations } {
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
rankWith,
|
|
40
40
|
uiTypeIs,
|
|
41
41
|
} from '@jsonforms/core';
|
|
42
|
-
import { Component, OnInit } from '@angular/core';
|
|
42
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
43
43
|
import {
|
|
44
44
|
JsonFormsAngularService,
|
|
45
45
|
JsonFormsBaseRenderer,
|
|
@@ -79,9 +79,7 @@ export class CategorizationTabLayoutRenderer
|
|
|
79
79
|
visibleCategories: (Category | Categorization)[];
|
|
80
80
|
categoryLabels: string[];
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
super();
|
|
84
|
-
}
|
|
82
|
+
private jsonFormsService = inject(JsonFormsAngularService);
|
|
85
83
|
|
|
86
84
|
ngOnInit() {
|
|
87
85
|
this.addSubscription(
|
|
@@ -22,17 +22,13 @@
|
|
|
22
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
ChangeDetectionStrategy,
|
|
27
|
-
ChangeDetectorRef,
|
|
28
|
-
Component,
|
|
29
|
-
} from '@angular/core';
|
|
25
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
30
26
|
import { GroupLayout, RankedTester, rankWith, uiTypeIs } from '@jsonforms/core';
|
|
31
27
|
import {
|
|
32
28
|
LayoutRenderer,
|
|
33
29
|
LayoutChildrenRenderPropsPipe,
|
|
34
30
|
} from './layout.renderer';
|
|
35
|
-
import {
|
|
31
|
+
import { JsonFormsModule } from '@jsonforms/angular';
|
|
36
32
|
import { CommonModule } from '@angular/common';
|
|
37
33
|
import { MatCardModule } from '@angular/material/card';
|
|
38
34
|
|
|
@@ -76,12 +72,5 @@ import { MatCardModule } from '@angular/material/card';
|
|
|
76
72
|
MatCardModule,
|
|
77
73
|
],
|
|
78
74
|
})
|
|
79
|
-
export class GroupLayoutRenderer extends LayoutRenderer<GroupLayout> {
|
|
80
|
-
constructor(
|
|
81
|
-
jsonFormsService: JsonFormsAngularService,
|
|
82
|
-
changeDetectionRef: ChangeDetectorRef
|
|
83
|
-
) {
|
|
84
|
-
super(jsonFormsService, changeDetectionRef);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
75
|
+
export class GroupLayoutRenderer extends LayoutRenderer<GroupLayout> {}
|
|
87
76
|
export const groupLayoutTester: RankedTester = rankWith(1, uiTypeIs('Group'));
|
|
@@ -22,11 +22,7 @@
|
|
|
22
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
ChangeDetectionStrategy,
|
|
27
|
-
ChangeDetectorRef,
|
|
28
|
-
Component,
|
|
29
|
-
} from '@angular/core';
|
|
25
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
30
26
|
import {
|
|
31
27
|
HorizontalLayout,
|
|
32
28
|
RankedTester,
|
|
@@ -37,7 +33,7 @@ import {
|
|
|
37
33
|
LayoutRenderer,
|
|
38
34
|
LayoutChildrenRenderPropsPipe,
|
|
39
35
|
} from './layout.renderer';
|
|
40
|
-
import {
|
|
36
|
+
import { JsonFormsModule } from '@jsonforms/angular';
|
|
41
37
|
import { CommonModule } from '@angular/common';
|
|
42
38
|
|
|
43
39
|
@Component({
|
|
@@ -74,14 +70,7 @@ import { CommonModule } from '@angular/common';
|
|
|
74
70
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
75
71
|
imports: [CommonModule, JsonFormsModule, LayoutChildrenRenderPropsPipe],
|
|
76
72
|
})
|
|
77
|
-
export class HorizontalLayoutRenderer extends LayoutRenderer<HorizontalLayout> {
|
|
78
|
-
constructor(
|
|
79
|
-
jsonFormsService: JsonFormsAngularService,
|
|
80
|
-
changeDetectionRef: ChangeDetectorRef
|
|
81
|
-
) {
|
|
82
|
-
super(jsonFormsService, changeDetectionRef);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
73
|
+
export class HorizontalLayoutRenderer extends LayoutRenderer<HorizontalLayout> {}
|
|
85
74
|
export const horizontalLayoutTester: RankedTester = rankWith(
|
|
86
75
|
1,
|
|
87
76
|
uiTypeIs('HorizontalLayout')
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
Component,
|
|
29
29
|
PipeTransform,
|
|
30
30
|
Pipe,
|
|
31
|
+
inject,
|
|
31
32
|
} from '@angular/core';
|
|
32
33
|
import {
|
|
33
34
|
JsonFormsAngularService,
|
|
@@ -52,12 +53,8 @@ export class LayoutRenderer<T extends Layout>
|
|
|
52
53
|
hidden: boolean;
|
|
53
54
|
label: string | undefined;
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
protected changeDetectionRef: ChangeDetectorRef
|
|
58
|
-
) {
|
|
59
|
-
super();
|
|
60
|
-
}
|
|
56
|
+
private jsonFormsService = inject(JsonFormsAngularService);
|
|
57
|
+
protected changeDetectionRef = inject(ChangeDetectorRef);
|
|
61
58
|
|
|
62
59
|
ngOnInit() {
|
|
63
60
|
this.addSubscription(
|
|
@@ -22,11 +22,7 @@
|
|
|
22
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
import {
|
|
26
|
-
ChangeDetectionStrategy,
|
|
27
|
-
ChangeDetectorRef,
|
|
28
|
-
Component,
|
|
29
|
-
} from '@angular/core';
|
|
25
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
30
26
|
import {
|
|
31
27
|
RankedTester,
|
|
32
28
|
rankWith,
|
|
@@ -37,7 +33,7 @@ import {
|
|
|
37
33
|
LayoutRenderer,
|
|
38
34
|
LayoutChildrenRenderPropsPipe,
|
|
39
35
|
} from './layout.renderer';
|
|
40
|
-
import {
|
|
36
|
+
import { JsonFormsModule } from '@jsonforms/angular';
|
|
41
37
|
import { CommonModule } from '@angular/common';
|
|
42
38
|
|
|
43
39
|
@Component({
|
|
@@ -69,14 +65,7 @@ import { CommonModule } from '@angular/common';
|
|
|
69
65
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
70
66
|
imports: [CommonModule, JsonFormsModule, LayoutChildrenRenderPropsPipe],
|
|
71
67
|
})
|
|
72
|
-
export class VerticalLayoutRenderer extends LayoutRenderer<VerticalLayout> {
|
|
73
|
-
constructor(
|
|
74
|
-
jsonFormsService: JsonFormsAngularService,
|
|
75
|
-
changeDetectionRef: ChangeDetectorRef
|
|
76
|
-
) {
|
|
77
|
-
super(jsonFormsService, changeDetectionRef);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
68
|
+
export class VerticalLayoutRenderer extends LayoutRenderer<VerticalLayout> {}
|
|
80
69
|
export const verticalLayoutTester: RankedTester = rankWith(
|
|
81
70
|
1,
|
|
82
71
|
uiTypeIs('VerticalLayout')
|
package/src/library/module.ts
CHANGED
|
@@ -45,9 +45,12 @@ import { MatTabsModule } from '@angular/material/tabs';
|
|
|
45
45
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
46
46
|
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
|
47
47
|
import { JsonFormsModule } from '@jsonforms/angular';
|
|
48
|
-
import { AutocompleteControlRenderer } from './controls/autocomplete.renderer';
|
|
49
48
|
import { BooleanControlRenderer } from './controls/boolean.renderer';
|
|
50
49
|
import { DateControlRenderer } from './controls/date.renderer';
|
|
50
|
+
import {
|
|
51
|
+
EnumControlRenderer,
|
|
52
|
+
OneOfEnumControlRenderer,
|
|
53
|
+
} from './controls/enum.renderer';
|
|
51
54
|
import { NumberControlRenderer } from './controls/number.renderer';
|
|
52
55
|
import { RangeControlRenderer } from './controls/range.renderer';
|
|
53
56
|
import { TextAreaRenderer } from './controls/textarea.renderer';
|
|
@@ -104,7 +107,8 @@ import { LayoutChildrenRenderPropsPipe } from './layouts';
|
|
|
104
107
|
MasterListComponent,
|
|
105
108
|
JsonFormsDetailComponent,
|
|
106
109
|
ObjectControlRenderer,
|
|
107
|
-
|
|
110
|
+
EnumControlRenderer,
|
|
111
|
+
OneOfEnumControlRenderer,
|
|
108
112
|
TableRenderer,
|
|
109
113
|
ArrayLayoutRenderer,
|
|
110
114
|
LayoutChildrenRenderPropsPipe,
|
|
@@ -144,7 +148,8 @@ import { LayoutChildrenRenderPropsPipe } from './layouts';
|
|
|
144
148
|
MasterListComponent,
|
|
145
149
|
JsonFormsDetailComponent,
|
|
146
150
|
ObjectControlRenderer,
|
|
147
|
-
|
|
151
|
+
EnumControlRenderer,
|
|
152
|
+
OneOfEnumControlRenderer,
|
|
148
153
|
TableRenderer,
|
|
149
154
|
ArrayLayoutRenderer,
|
|
150
155
|
LayoutChildrenRenderPropsPipe,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
import { Component, OnInit } from '@angular/core';
|
|
25
|
+
import { Component, inject, OnInit } from '@angular/core';
|
|
26
26
|
import {
|
|
27
27
|
JsonFormsAngularService,
|
|
28
28
|
JsonFormsBaseRenderer,
|
|
@@ -55,9 +55,7 @@ export class LabelRenderer
|
|
|
55
55
|
label: string;
|
|
56
56
|
visible: boolean;
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
super();
|
|
60
|
-
}
|
|
58
|
+
private jsonFormsService = inject(JsonFormsAngularService);
|
|
61
59
|
ngOnInit() {
|
|
62
60
|
this.addSubscription(
|
|
63
61
|
this.jsonFormsService.$state.subscribe({
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
ChangeDetectionStrategy,
|
|
29
29
|
ChangeDetectorRef,
|
|
30
30
|
Component,
|
|
31
|
+
inject,
|
|
31
32
|
OnInit,
|
|
32
33
|
} from '@angular/core';
|
|
33
34
|
import { CommonModule } from '@angular/common';
|
|
@@ -35,10 +36,7 @@ import { MatSidenavModule } from '@angular/material/sidenav';
|
|
|
35
36
|
import { MatListModule } from '@angular/material/list';
|
|
36
37
|
import { MatButtonModule } from '@angular/material/button';
|
|
37
38
|
import { MatIconModule } from '@angular/material/icon';
|
|
38
|
-
import {
|
|
39
|
-
JsonFormsAngularService,
|
|
40
|
-
JsonFormsArrayControl,
|
|
41
|
-
} from '@jsonforms/angular';
|
|
39
|
+
import { JsonFormsArrayControl } from '@jsonforms/angular';
|
|
42
40
|
import {
|
|
43
41
|
ArrayControlProps,
|
|
44
42
|
arrayDefaultTranslations,
|
|
@@ -101,7 +99,7 @@ export const removeSchemaKeywords = (path: string) => {
|
|
|
101
99
|
mat-icon-button
|
|
102
100
|
class="button item-button hide"
|
|
103
101
|
(click)="onDeleteClick(i)"
|
|
104
|
-
[ngClass]="{ show: highlightedIdx
|
|
102
|
+
[ngClass]="{ show: highlightedIdx === i }"
|
|
105
103
|
*ngIf="isEnabled()"
|
|
106
104
|
>
|
|
107
105
|
<mat-icon mat-list-icon>delete</mat-icon>
|
|
@@ -186,12 +184,7 @@ export class MasterListComponent
|
|
|
186
184
|
highlightedIdx: number;
|
|
187
185
|
translations: ArrayTranslations;
|
|
188
186
|
|
|
189
|
-
|
|
190
|
-
jsonformsService: JsonFormsAngularService,
|
|
191
|
-
private changeDetectorRef: ChangeDetectorRef
|
|
192
|
-
) {
|
|
193
|
-
super(jsonformsService);
|
|
194
|
-
}
|
|
187
|
+
private changeDetectorRef = inject(ChangeDetectorRef);
|
|
195
188
|
|
|
196
189
|
onListItemHover(idx: number) {
|
|
197
190
|
this.highlightedIdx = idx;
|
|
@@ -26,7 +26,6 @@ import isEmpty from 'lodash/isEmpty';
|
|
|
26
26
|
import startCase from 'lodash/startCase';
|
|
27
27
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
28
28
|
import {
|
|
29
|
-
JsonFormsAngularService,
|
|
30
29
|
JsonFormsControlWithDetail,
|
|
31
30
|
JsonFormsModule,
|
|
32
31
|
} from '@jsonforms/angular';
|
|
@@ -68,9 +67,6 @@ import cloneDeep from 'lodash/cloneDeep';
|
|
|
68
67
|
})
|
|
69
68
|
export class ObjectControlRenderer extends JsonFormsControlWithDetail {
|
|
70
69
|
detailUiSchema: UISchemaElement;
|
|
71
|
-
constructor(jsonformsService: JsonFormsAngularService) {
|
|
72
|
-
super(jsonformsService);
|
|
73
|
-
}
|
|
74
70
|
mapAdditionalProps(props: ControlWithDetailProps) {
|
|
75
71
|
this.detailUiSchema = findUISchema(
|
|
76
72
|
props.uischemas,
|