@jsonforms/angular-material 3.1.0-alpha.0 → 3.1.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/README.md +30 -30
- package/lib/cjs/controls/autocomplete.renderer.d.ts +4 -3
- package/lib/cjs/controls/autocomplete.renderer.js +3 -4
- package/lib/cjs/controls/autocomplete.renderer.js.map +1 -1
- package/lib/cjs/controls/autocomplete.renderer.metadata.json +1 -1
- package/lib/cjs/controls/boolean.renderer.js +2 -2
- package/lib/cjs/controls/boolean.renderer.js.map +1 -1
- package/lib/cjs/controls/boolean.renderer.metadata.json +1 -1
- package/lib/cjs/controls/date.renderer.js +2 -2
- package/lib/cjs/controls/date.renderer.js.map +1 -1
- package/lib/cjs/controls/date.renderer.metadata.json +1 -1
- package/lib/cjs/controls/number.renderer.js +4 -4
- package/lib/cjs/controls/number.renderer.js.map +1 -1
- package/lib/cjs/controls/number.renderer.metadata.json +1 -1
- package/lib/cjs/controls/range.renderer.js +2 -2
- package/lib/cjs/controls/range.renderer.js.map +1 -1
- package/lib/cjs/controls/range.renderer.metadata.json +1 -1
- package/lib/cjs/controls/text.renderer.js +2 -2
- package/lib/cjs/controls/text.renderer.js.map +1 -1
- package/lib/cjs/controls/text.renderer.metadata.json +1 -1
- package/lib/cjs/controls/textarea.renderer.js +2 -2
- package/lib/cjs/controls/textarea.renderer.js.map +1 -1
- package/lib/cjs/controls/textarea.renderer.metadata.json +1 -1
- package/lib/cjs/controls/toggle.renderer.js +2 -2
- package/lib/cjs/controls/toggle.renderer.js.map +1 -1
- package/lib/cjs/controls/toggle.renderer.metadata.json +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/layouts/array-layout.renderer.d.ts +2 -10
- package/lib/cjs/layouts/array-layout.renderer.js +5 -11
- package/lib/cjs/layouts/array-layout.renderer.js.map +1 -1
- package/lib/cjs/layouts/array-layout.renderer.metadata.json +1 -1
- package/lib/cjs/layouts/categorization-layout.renderer.js +2 -2
- package/lib/cjs/layouts/categorization-layout.renderer.js.map +1 -1
- package/lib/cjs/layouts/categorization-layout.renderer.metadata.json +1 -1
- package/lib/cjs/layouts/group-layout.renderer.js +2 -2
- package/lib/cjs/layouts/group-layout.renderer.js.map +1 -1
- package/lib/cjs/layouts/group-layout.renderer.metadata.json +1 -1
- package/lib/cjs/layouts/horizontal-layout.renderer.js +2 -2
- package/lib/cjs/layouts/horizontal-layout.renderer.js.map +1 -1
- package/lib/cjs/layouts/horizontal-layout.renderer.metadata.json +1 -1
- package/lib/cjs/layouts/layout.renderer.js +3 -3
- package/lib/cjs/layouts/layout.renderer.js.map +1 -1
- package/lib/cjs/layouts/layout.renderer.metadata.json +1 -1
- package/lib/cjs/layouts/vertical-layout.renderer.js +2 -2
- package/lib/cjs/layouts/vertical-layout.renderer.js.map +1 -1
- package/lib/cjs/layouts/vertical-layout.renderer.metadata.json +1 -1
- package/lib/cjs/module.js +5 -5
- package/lib/cjs/module.js.map +1 -1
- package/lib/cjs/module.metadata.json +1 -1
- package/lib/cjs/other/label.renderer.d.ts +2 -1
- package/lib/cjs/other/label.renderer.js +2 -2
- package/lib/cjs/other/label.renderer.js.map +1 -1
- package/lib/cjs/other/label.renderer.metadata.json +1 -1
- package/lib/cjs/other/master-detail/detail.js +2 -2
- package/lib/cjs/other/master-detail/detail.js.map +1 -1
- package/lib/cjs/other/master-detail/detail.metadata.json +1 -1
- package/lib/cjs/other/master-detail/master.d.ts +4 -3
- package/lib/cjs/other/master-detail/master.js +13 -6
- package/lib/cjs/other/master-detail/master.js.map +1 -1
- package/lib/cjs/other/master-detail/master.metadata.json +1 -1
- package/lib/cjs/other/object.renderer.js +1 -1
- package/lib/cjs/other/table.renderer.d.ts +4 -2
- package/lib/cjs/other/table.renderer.js +10 -12
- package/lib/cjs/other/table.renderer.js.map +1 -1
- package/lib/cjs/other/table.renderer.metadata.json +1 -1
- package/lib/esm/controls/autocomplete.renderer.d.ts +4 -3
- package/lib/esm/controls/autocomplete.renderer.js +5 -6
- package/lib/esm/controls/autocomplete.renderer.js.map +1 -1
- package/lib/esm/controls/autocomplete.renderer.metadata.json +1 -1
- package/lib/esm/controls/boolean.renderer.js +3 -3
- package/lib/esm/controls/boolean.renderer.js.map +1 -1
- package/lib/esm/controls/boolean.renderer.metadata.json +1 -1
- package/lib/esm/controls/date.renderer.js +2 -2
- package/lib/esm/controls/date.renderer.js.map +1 -1
- package/lib/esm/controls/date.renderer.metadata.json +1 -1
- package/lib/esm/controls/number.renderer.js +5 -5
- package/lib/esm/controls/number.renderer.js.map +1 -1
- package/lib/esm/controls/number.renderer.metadata.json +1 -1
- package/lib/esm/controls/range.renderer.js +3 -3
- package/lib/esm/controls/range.renderer.js.map +1 -1
- package/lib/esm/controls/range.renderer.metadata.json +1 -1
- package/lib/esm/controls/text.renderer.js +2 -2
- package/lib/esm/controls/text.renderer.js.map +1 -1
- package/lib/esm/controls/text.renderer.metadata.json +1 -1
- package/lib/esm/controls/textarea.renderer.js +2 -2
- package/lib/esm/controls/textarea.renderer.js.map +1 -1
- package/lib/esm/controls/textarea.renderer.metadata.json +1 -1
- package/lib/esm/controls/toggle.renderer.js +4 -4
- package/lib/esm/controls/toggle.renderer.js.map +1 -1
- package/lib/esm/controls/toggle.renderer.metadata.json +1 -1
- package/lib/esm/index.js +16 -16
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/layouts/array-layout.renderer.d.ts +2 -10
- package/lib/esm/layouts/array-layout.renderer.js +8 -14
- package/lib/esm/layouts/array-layout.renderer.js.map +1 -1
- package/lib/esm/layouts/array-layout.renderer.metadata.json +1 -1
- package/lib/esm/layouts/categorization-layout.renderer.js +4 -4
- package/lib/esm/layouts/categorization-layout.renderer.js.map +1 -1
- package/lib/esm/layouts/categorization-layout.renderer.metadata.json +1 -1
- package/lib/esm/layouts/group-layout.renderer.js +3 -3
- package/lib/esm/layouts/group-layout.renderer.js.map +1 -1
- package/lib/esm/layouts/group-layout.renderer.metadata.json +1 -1
- package/lib/esm/layouts/horizontal-layout.renderer.js +4 -4
- package/lib/esm/layouts/horizontal-layout.renderer.js.map +1 -1
- package/lib/esm/layouts/horizontal-layout.renderer.metadata.json +1 -1
- package/lib/esm/layouts/layout.renderer.js +6 -6
- package/lib/esm/layouts/layout.renderer.js.map +1 -1
- package/lib/esm/layouts/layout.renderer.metadata.json +1 -1
- package/lib/esm/layouts/vertical-layout.renderer.js +4 -4
- package/lib/esm/layouts/vertical-layout.renderer.js.map +1 -1
- package/lib/esm/layouts/vertical-layout.renderer.metadata.json +1 -1
- package/lib/esm/module.js +5 -5
- package/lib/esm/module.js.map +1 -1
- package/lib/esm/module.metadata.json +1 -1
- package/lib/esm/other/label.renderer.d.ts +2 -1
- package/lib/esm/other/label.renderer.js +3 -3
- package/lib/esm/other/label.renderer.js.map +1 -1
- package/lib/esm/other/label.renderer.metadata.json +1 -1
- package/lib/esm/other/master-detail/detail.js +2 -2
- package/lib/esm/other/master-detail/detail.js.map +1 -1
- package/lib/esm/other/master-detail/detail.metadata.json +1 -1
- package/lib/esm/other/master-detail/master.d.ts +4 -3
- package/lib/esm/other/master-detail/master.js +16 -9
- package/lib/esm/other/master-detail/master.js.map +1 -1
- package/lib/esm/other/master-detail/master.metadata.json +1 -1
- package/lib/esm/other/object.renderer.js +3 -3
- package/lib/esm/other/object.renderer.js.map +1 -1
- package/lib/esm/other/table.renderer.d.ts +4 -2
- package/lib/esm/other/table.renderer.js +12 -14
- package/lib/esm/other/table.renderer.js.map +1 -1
- package/lib/esm/other/table.renderer.metadata.json +1 -1
- package/package.json +36 -10
- package/src/controls/autocomplete.renderer.ts +25 -14
- package/src/controls/boolean.renderer.ts +14 -4
- package/src/controls/date.renderer.ts +7 -11
- package/src/controls/number.renderer.ts +20 -10
- package/src/controls/range.renderer.ts +13 -4
- package/src/controls/text.renderer.ts +5 -3
- package/src/controls/textarea.renderer.ts +5 -3
- package/src/controls/toggle.renderer.ts +14 -5
- package/src/index.ts +16 -16
- package/src/layouts/array-layout.renderer.ts +40 -42
- package/src/layouts/categorization-layout.renderer.ts +22 -11
- package/src/layouts/group-layout.renderer.ts +17 -4
- package/src/layouts/horizontal-layout.renderer.ts +18 -5
- package/src/layouts/layout.renderer.ts +32 -19
- package/src/layouts/vertical-layout.renderer.ts +18 -5
- package/src/module.ts +7 -9
- package/src/other/label.renderer.ts +13 -9
- package/src/other/master-detail/detail.ts +2 -2
- package/src/other/master-detail/master.ts +50 -26
- package/src/other/object.renderer.ts +3 -3
- package/src/other/table.renderer.ts +58 -35
- package/src/other/util.ts +10 -3
- package/docs/assets/css/main.css +0 -1
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -51
- package/docs/assets/js/search.json +0 -1
- package/docs/classes/arraylayoutrenderer.html +0 -1256
- package/docs/classes/autocompletecontrolrenderer.html +0 -887
- package/docs/classes/booleancontrolrenderer.html +0 -771
- package/docs/classes/categorizationtablayoutrenderer.html +0 -384
- package/docs/classes/datecontrolrenderer.html +0 -739
- package/docs/classes/grouplayoutrenderer.html +0 -396
- package/docs/classes/horizontallayoutrenderer.html +0 -396
- package/docs/classes/jsonformsangularmaterialmodule.html +0 -133
- package/docs/classes/jsonformsdetailcomponent.html +0 -227
- package/docs/classes/labelrenderer.html +0 -363
- package/docs/classes/layoutchildrenrenderpropspipe.html +0 -189
- package/docs/classes/layoutrenderer.html +0 -436
- package/docs/classes/masterlistcomponent.html +0 -1054
- package/docs/classes/numbercontrolrenderer.html +0 -893
- package/docs/classes/objectcontrolrenderer.html +0 -761
- package/docs/classes/rangecontrolrenderer.html +0 -792
- package/docs/classes/tablerenderer.html +0 -1222
- package/docs/classes/textarearenderer.html +0 -739
- package/docs/classes/textcontrolrenderer.html +0 -760
- package/docs/classes/togglecontrolrenderer.html +0 -771
- package/docs/classes/verticallayoutrenderer.html +0 -396
- package/docs/globals.html +0 -610
- package/docs/index.html +0 -378
- package/docs/interfaces/columndescription.html +0 -192
- package/docs/interfaces/ownpropsofautocomplete.html +0 -327
- package/example/app/app.component.ts +0 -122
- package/example/app/app.module.ts +0 -42
- package/example/index.html +0 -25
- package/example/main.ts +0 -37
- package/test/autocomplete-control.spec.ts +0 -322
- package/test/boolean-control.spec.ts +0 -76
- package/test/categorization-tab-layout.spec.ts +0 -330
- package/test/date-control.spec.ts +0 -280
- package/test/group-layout.spec.ts +0 -105
- package/test/horizontal-layout.spec.ts +0 -96
- package/test/label-renderer.spec.ts +0 -78
- package/test/master-detail.spec.ts +0 -408
- package/test/number-control.spec.ts +0 -208
- package/test/object-control.spec.ts +0 -247
- package/test/range-control.spec.ts +0 -104
- package/test/table-control.spec.ts +0 -369
- package/test/text-area.spec.ts +0 -108
- package/test/text-control.spec.ts +0 -89
- package/test/toggle-control.spec.ts +0 -77
- package/test/tsconfig.test.json +0 -18
- package/test/util.ts +0 -28
- package/test/vertical-layout.spec.ts +0 -115
- package/test-config/karma-test-shim.js +0 -21
- package/test-config/karma.conf.js +0 -58
- package/test-config/protractor.conf.js +0 -28
- package/test-config/webpack.test.js +0 -65
- package/tsconfig.cjs.json +0 -9
- package/tsconfig.json +0 -16
- package/webpack/webpack.build.js +0 -13
- package/webpack/webpack.dev.js +0 -37
|
@@ -26,11 +26,15 @@ import {
|
|
|
26
26
|
ChangeDetectionStrategy,
|
|
27
27
|
Component,
|
|
28
28
|
OnDestroy,
|
|
29
|
-
OnInit
|
|
29
|
+
OnInit,
|
|
30
30
|
} from '@angular/core';
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
JsonFormsAngularService,
|
|
33
|
+
JsonFormsAbstractControl,
|
|
34
|
+
} from '@jsonforms/angular';
|
|
32
35
|
import {
|
|
33
36
|
ArrayLayoutProps,
|
|
37
|
+
ArrayTranslations,
|
|
34
38
|
createDefaultValue,
|
|
35
39
|
findUISchema,
|
|
36
40
|
isObjectArrayWithNesting,
|
|
@@ -45,7 +49,7 @@ import {
|
|
|
45
49
|
StatePropsOfArrayLayout,
|
|
46
50
|
UISchemaElement,
|
|
47
51
|
UISchemaTester,
|
|
48
|
-
unsetReadonly
|
|
52
|
+
unsetReadonly,
|
|
49
53
|
} from '@jsonforms/core';
|
|
50
54
|
|
|
51
55
|
@Component({
|
|
@@ -58,25 +62,30 @@ import {
|
|
|
58
62
|
<mat-icon
|
|
59
63
|
*ngIf="this.error?.length"
|
|
60
64
|
color="warn"
|
|
61
|
-
matBadge="{{
|
|
65
|
+
matBadge="{{
|
|
66
|
+
this.error.split(
|
|
67
|
+
'
|
|
68
|
+
'
|
|
69
|
+
).length
|
|
70
|
+
}}"
|
|
62
71
|
matBadgeColor="warn"
|
|
63
72
|
matTooltip="{{ this.error }}"
|
|
64
73
|
matTooltipClass="error-message-tooltip"
|
|
65
|
-
|
|
66
|
-
|
|
74
|
+
>
|
|
75
|
+
error_outline
|
|
67
76
|
</mat-icon>
|
|
68
77
|
<span fxFlex></span>
|
|
69
78
|
<button
|
|
70
79
|
mat-button
|
|
71
|
-
matTooltip="{{
|
|
80
|
+
matTooltip="{{ translations.addTooltip }}"
|
|
72
81
|
[disabled]="!isEnabled()"
|
|
73
82
|
(click)="add()"
|
|
74
|
-
attr.aria-label="{{
|
|
83
|
+
attr.aria-label="{{ translations.addAriaLabel }}"
|
|
75
84
|
>
|
|
76
85
|
<mat-icon>add</mat-icon>
|
|
77
86
|
</button>
|
|
78
87
|
</div>
|
|
79
|
-
<p *ngIf="noData">{{
|
|
88
|
+
<p *ngIf="noData">{{ translations.noDataMessage }}</p>
|
|
80
89
|
<div
|
|
81
90
|
*ngFor="
|
|
82
91
|
let item of [].constructor(data);
|
|
@@ -91,14 +100,14 @@ import {
|
|
|
91
100
|
<jsonforms-outlet [renderProps]="getProps(idx)"></jsonforms-outlet>
|
|
92
101
|
</mat-card-content>
|
|
93
102
|
<mat-card-actions *ngIf="isEnabled()">
|
|
94
|
-
|
|
103
|
+
<button
|
|
95
104
|
*ngIf="uischema?.options?.showSortButtons"
|
|
96
105
|
class="item-up"
|
|
97
106
|
mat-button
|
|
98
107
|
[disabled]="first"
|
|
99
108
|
(click)="up(idx)"
|
|
100
|
-
attr.aria-label="{{
|
|
101
|
-
matTooltip="{{
|
|
109
|
+
attr.aria-label="{{ translations.upAriaLabel }}"
|
|
110
|
+
matTooltip="{{ translations.up }}"
|
|
102
111
|
matTooltipPosition="right"
|
|
103
112
|
>
|
|
104
113
|
<mat-icon>arrow_upward</mat-icon>
|
|
@@ -109,8 +118,8 @@ import {
|
|
|
109
118
|
mat-button
|
|
110
119
|
[disabled]="last"
|
|
111
120
|
(click)="down(idx)"
|
|
112
|
-
attr.aria-label="{{
|
|
113
|
-
matTooltip="{{
|
|
121
|
+
attr.aria-label="{{ translations.downAriaLabel }}"
|
|
122
|
+
matTooltip="{{ translations.down }}"
|
|
114
123
|
matTooltipPosition="right"
|
|
115
124
|
>
|
|
116
125
|
<mat-icon>arrow_downward</mat-icon>
|
|
@@ -119,8 +128,8 @@ import {
|
|
|
119
128
|
mat-button
|
|
120
129
|
color="warn"
|
|
121
130
|
(click)="remove(idx)"
|
|
122
|
-
attr.aria-label="{{
|
|
123
|
-
matTooltip="{{
|
|
131
|
+
attr.aria-label="{{ translations.removeAriaLabel }}"
|
|
132
|
+
matTooltip="{{ translations.removeTooltip }}"
|
|
124
133
|
matTooltipPosition="right"
|
|
125
134
|
>
|
|
126
135
|
<mat-icon>delete</mat-icon>
|
|
@@ -131,9 +140,10 @@ import {
|
|
|
131
140
|
</div>
|
|
132
141
|
`,
|
|
133
142
|
styles: [
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
143
|
+
`
|
|
144
|
+
.array-layout-toolbar {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
137
147
|
}
|
|
138
148
|
.array-layout-title {
|
|
139
149
|
margin: 0;
|
|
@@ -141,23 +151,16 @@ import {
|
|
|
141
151
|
::ng-deep .error-message-tooltip {
|
|
142
152
|
white-space: pre-line;
|
|
143
153
|
}
|
|
144
|
-
|
|
154
|
+
`,
|
|
145
155
|
],
|
|
146
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
156
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
147
157
|
})
|
|
148
158
|
export class ArrayLayoutRenderer
|
|
149
159
|
extends JsonFormsAbstractControl<StatePropsOfArrayLayout>
|
|
150
|
-
implements OnInit, OnDestroy
|
|
151
|
-
|
|
152
|
-
addAriaLabel: string;
|
|
153
|
-
noDataMessage: string;
|
|
154
|
-
removeTooltip: string;
|
|
155
|
-
removeAriaLabel: string;
|
|
156
|
-
upTooltip: string;
|
|
157
|
-
upAriaLabel: string;
|
|
158
|
-
downTooltip: string;
|
|
159
|
-
downAriaLabel:string;
|
|
160
|
+
implements OnInit, OnDestroy
|
|
161
|
+
{
|
|
160
162
|
noData: boolean;
|
|
163
|
+
translations: ArrayTranslations;
|
|
161
164
|
addItem: (path: string, value: any) => () => void;
|
|
162
165
|
moveItemUp: (path: string, index: number) => () => void;
|
|
163
166
|
moveItemDown: (path: string, index: number) => () => void;
|
|
@@ -187,24 +190,19 @@ export class ArrayLayoutRenderer
|
|
|
187
190
|
}
|
|
188
191
|
ngOnInit() {
|
|
189
192
|
super.ngOnInit();
|
|
190
|
-
const { addItem, removeItems, moveUp, moveDown } =
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
const { addItem, removeItems, moveUp, moveDown } =
|
|
194
|
+
mapDispatchToArrayControlProps(
|
|
195
|
+
this.jsonFormsService.updateCore.bind(this.jsonFormsService)
|
|
196
|
+
);
|
|
193
197
|
this.addItem = addItem;
|
|
194
198
|
this.moveItemUp = moveUp;
|
|
195
199
|
this.moveItemDown = moveDown;
|
|
196
200
|
this.removeItems = removeItems;
|
|
197
201
|
}
|
|
198
202
|
mapAdditionalProps(props: ArrayLayoutProps) {
|
|
203
|
+
this.translations = props.translations;
|
|
199
204
|
this.noData = !props.data || props.data === 0;
|
|
200
205
|
this.uischemas = props.uischemas;
|
|
201
|
-
this.addTooltip = `Add to ${this.label}`;
|
|
202
|
-
this.addAriaLabel = `Add to ${this.label} button`;
|
|
203
|
-
this.upAriaLabel = `Move ${this.label} up`;
|
|
204
|
-
this.downAriaLabel = `Move ${this.label} down`;
|
|
205
|
-
this.removeTooltip = `Delete`;
|
|
206
|
-
this.removeAriaLabel = `Delete button`;
|
|
207
|
-
this.noDataMessage = `No data`;
|
|
208
206
|
}
|
|
209
207
|
getProps(index: number): OwnPropsOfRenderer {
|
|
210
208
|
const uischema = findUISchema(
|
|
@@ -224,7 +222,7 @@ export class ArrayLayoutRenderer
|
|
|
224
222
|
return {
|
|
225
223
|
schema: this.scopedSchema,
|
|
226
224
|
path: Paths.compose(this.propsPath, `${index}`),
|
|
227
|
-
uischema
|
|
225
|
+
uischema,
|
|
228
226
|
};
|
|
229
227
|
}
|
|
230
228
|
trackByFn(index: number) {
|
|
@@ -36,12 +36,12 @@ import {
|
|
|
36
36
|
mapStateToLayoutProps,
|
|
37
37
|
RankedTester,
|
|
38
38
|
rankWith,
|
|
39
|
-
uiTypeIs
|
|
39
|
+
uiTypeIs,
|
|
40
40
|
} from '@jsonforms/core';
|
|
41
41
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
|
42
42
|
import {
|
|
43
43
|
JsonFormsAngularService,
|
|
44
|
-
JsonFormsBaseRenderer
|
|
44
|
+
JsonFormsBaseRenderer,
|
|
45
45
|
} from '@jsonforms/angular';
|
|
46
46
|
import { Subscription } from 'rxjs';
|
|
47
47
|
|
|
@@ -54,15 +54,20 @@ import { Subscription } from 'rxjs';
|
|
|
54
54
|
[label]="categoryLabels[i]"
|
|
55
55
|
>
|
|
56
56
|
<div *ngFor="let element of category.elements">
|
|
57
|
-
<jsonforms-outlet
|
|
57
|
+
<jsonforms-outlet
|
|
58
|
+
[uischema]="element"
|
|
59
|
+
[path]="path"
|
|
60
|
+
[schema]="schema"
|
|
61
|
+
></jsonforms-outlet>
|
|
58
62
|
</div>
|
|
59
63
|
</mat-tab>
|
|
60
64
|
</mat-tab-group>
|
|
61
|
-
|
|
65
|
+
`,
|
|
62
66
|
})
|
|
63
67
|
export class CategorizationTabLayoutRenderer
|
|
64
68
|
extends JsonFormsBaseRenderer<Categorization>
|
|
65
|
-
implements OnInit, OnDestroy
|
|
69
|
+
implements OnInit, OnDestroy
|
|
70
|
+
{
|
|
66
71
|
hidden: boolean;
|
|
67
72
|
visibleCategories: (Category | Categorization)[];
|
|
68
73
|
private subscription: Subscription;
|
|
@@ -77,12 +82,18 @@ export class CategorizationTabLayoutRenderer
|
|
|
77
82
|
next: (state: JsonFormsState) => {
|
|
78
83
|
const props = mapStateToLayoutProps(state, this.getOwnProps());
|
|
79
84
|
this.hidden = !props.visible;
|
|
80
|
-
this.visibleCategories =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
this.visibleCategories = this.uischema.elements.filter(
|
|
86
|
+
(category: Category | Categorization) =>
|
|
87
|
+
isVisible(category, props.data, undefined, getAjv(state))
|
|
88
|
+
);
|
|
89
|
+
this.categoryLabels = this.visibleCategories.map((element) =>
|
|
90
|
+
deriveLabelForUISchemaElement(
|
|
91
|
+
element as Labelable<boolean>,
|
|
92
|
+
state.jsonforms.i18n?.translate ??
|
|
93
|
+
defaultJsonFormsI18nState.translate
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
},
|
|
86
97
|
});
|
|
87
98
|
}
|
|
88
99
|
|
|
@@ -22,7 +22,11 @@
|
|
|
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 {
|
|
25
|
+
import {
|
|
26
|
+
ChangeDetectionStrategy,
|
|
27
|
+
ChangeDetectorRef,
|
|
28
|
+
Component,
|
|
29
|
+
} from '@angular/core';
|
|
26
30
|
import { GroupLayout, RankedTester, rankWith, uiTypeIs } from '@jsonforms/core';
|
|
27
31
|
import { LayoutRenderer } from './layout.renderer';
|
|
28
32
|
import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
@@ -32,15 +36,24 @@ import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
|
32
36
|
template: `
|
|
33
37
|
<mat-card fxLayout="column" [fxHide]="hidden">
|
|
34
38
|
<mat-card-title class="mat-title">{{ label }}</mat-card-title>
|
|
35
|
-
<div
|
|
39
|
+
<div
|
|
40
|
+
*ngFor="
|
|
41
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
42
|
+
trackBy: trackElement
|
|
43
|
+
"
|
|
44
|
+
fxFlex
|
|
45
|
+
>
|
|
36
46
|
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
37
47
|
</div>
|
|
38
48
|
</mat-card>
|
|
39
49
|
`,
|
|
40
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
50
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
41
51
|
})
|
|
42
52
|
export class GroupLayoutRenderer extends LayoutRenderer<GroupLayout> {
|
|
43
|
-
constructor(
|
|
53
|
+
constructor(
|
|
54
|
+
jsonFormsService: JsonFormsAngularService,
|
|
55
|
+
changeDetectionRef: ChangeDetectorRef
|
|
56
|
+
) {
|
|
44
57
|
super(jsonFormsService, changeDetectionRef);
|
|
45
58
|
}
|
|
46
59
|
}
|
|
@@ -22,12 +22,16 @@
|
|
|
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 {
|
|
25
|
+
import {
|
|
26
|
+
ChangeDetectionStrategy,
|
|
27
|
+
ChangeDetectorRef,
|
|
28
|
+
Component,
|
|
29
|
+
} from '@angular/core';
|
|
26
30
|
import {
|
|
27
31
|
HorizontalLayout,
|
|
28
32
|
RankedTester,
|
|
29
33
|
rankWith,
|
|
30
|
-
uiTypeIs
|
|
34
|
+
uiTypeIs,
|
|
31
35
|
} from '@jsonforms/core';
|
|
32
36
|
import { LayoutRenderer } from './layout.renderer';
|
|
33
37
|
import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
@@ -41,15 +45,24 @@ import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
|
41
45
|
[fxHide]="hidden"
|
|
42
46
|
fxLayoutAlign="center start"
|
|
43
47
|
>
|
|
44
|
-
<div
|
|
48
|
+
<div
|
|
49
|
+
*ngFor="
|
|
50
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
51
|
+
trackBy: trackElement
|
|
52
|
+
"
|
|
53
|
+
fxFlex
|
|
54
|
+
>
|
|
45
55
|
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
46
56
|
</div>
|
|
47
57
|
</div>
|
|
48
58
|
`,
|
|
49
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
59
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
50
60
|
})
|
|
51
61
|
export class HorizontalLayoutRenderer extends LayoutRenderer<HorizontalLayout> {
|
|
52
|
-
constructor(
|
|
62
|
+
constructor(
|
|
63
|
+
jsonFormsService: JsonFormsAngularService,
|
|
64
|
+
changeDetectionRef: ChangeDetectorRef
|
|
65
|
+
) {
|
|
53
66
|
super(jsonFormsService, changeDetectionRef);
|
|
54
67
|
}
|
|
55
68
|
}
|
|
@@ -22,10 +22,17 @@
|
|
|
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 {
|
|
25
|
+
import {
|
|
26
|
+
OnDestroy,
|
|
27
|
+
OnInit,
|
|
28
|
+
ChangeDetectorRef,
|
|
29
|
+
Component,
|
|
30
|
+
PipeTransform,
|
|
31
|
+
Pipe,
|
|
32
|
+
} from '@angular/core';
|
|
26
33
|
import {
|
|
27
34
|
JsonFormsAngularService,
|
|
28
|
-
JsonFormsBaseRenderer
|
|
35
|
+
JsonFormsBaseRenderer,
|
|
29
36
|
} from '@jsonforms/angular';
|
|
30
37
|
import {
|
|
31
38
|
JsonFormsState,
|
|
@@ -33,20 +40,25 @@ import {
|
|
|
33
40
|
mapStateToLayoutProps,
|
|
34
41
|
OwnPropsOfRenderer,
|
|
35
42
|
UISchemaElement,
|
|
36
|
-
JsonSchema
|
|
43
|
+
JsonSchema,
|
|
37
44
|
} from '@jsonforms/core';
|
|
38
|
-
import { Subscription } from 'rxjs';
|
|
45
|
+
import type { Subscription } from 'rxjs';
|
|
39
46
|
|
|
40
47
|
@Component({
|
|
41
|
-
template: ''
|
|
48
|
+
template: '',
|
|
42
49
|
})
|
|
43
|
-
export class LayoutRenderer<T extends Layout>
|
|
44
|
-
|
|
50
|
+
export class LayoutRenderer<T extends Layout>
|
|
51
|
+
extends JsonFormsBaseRenderer<T>
|
|
52
|
+
implements OnInit, OnDestroy
|
|
53
|
+
{
|
|
45
54
|
hidden: boolean;
|
|
46
55
|
label: string | undefined;
|
|
47
56
|
private subscription: Subscription;
|
|
48
57
|
|
|
49
|
-
constructor(
|
|
58
|
+
constructor(
|
|
59
|
+
private jsonFormsService: JsonFormsAngularService,
|
|
60
|
+
protected changeDetectionRef: ChangeDetectorRef
|
|
61
|
+
) {
|
|
50
62
|
super();
|
|
51
63
|
}
|
|
52
64
|
|
|
@@ -57,7 +69,7 @@ export class LayoutRenderer<T extends Layout> extends JsonFormsBaseRenderer<T>
|
|
|
57
69
|
this.label = props.label;
|
|
58
70
|
this.hidden = !props.visible;
|
|
59
71
|
this.changeDetectionRef.markForCheck();
|
|
60
|
-
}
|
|
72
|
+
},
|
|
61
73
|
});
|
|
62
74
|
}
|
|
63
75
|
|
|
@@ -76,15 +88,16 @@ export class LayoutRenderer<T extends Layout> extends JsonFormsBaseRenderer<T>
|
|
|
76
88
|
|
|
77
89
|
@Pipe({ name: 'layoutChildrenRenderProps' })
|
|
78
90
|
export class LayoutChildrenRenderPropsPipe implements PipeTransform {
|
|
79
|
-
transform(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
transform(
|
|
92
|
+
uischema: Layout,
|
|
93
|
+
schema: JsonSchema,
|
|
94
|
+
path: string
|
|
95
|
+
): OwnPropsOfRenderer[] {
|
|
96
|
+
const elements = (uischema.elements || []).map((el: UISchemaElement) => ({
|
|
97
|
+
uischema: el,
|
|
98
|
+
schema: schema,
|
|
99
|
+
path: path,
|
|
100
|
+
}));
|
|
87
101
|
return elements;
|
|
88
102
|
}
|
|
89
|
-
|
|
90
|
-
}
|
|
103
|
+
}
|
|
@@ -22,12 +22,16 @@
|
|
|
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 {
|
|
25
|
+
import {
|
|
26
|
+
ChangeDetectionStrategy,
|
|
27
|
+
ChangeDetectorRef,
|
|
28
|
+
Component,
|
|
29
|
+
} from '@angular/core';
|
|
26
30
|
import {
|
|
27
31
|
RankedTester,
|
|
28
32
|
rankWith,
|
|
29
33
|
uiTypeIs,
|
|
30
|
-
VerticalLayout
|
|
34
|
+
VerticalLayout,
|
|
31
35
|
} from '@jsonforms/core';
|
|
32
36
|
import { LayoutRenderer } from './layout.renderer';
|
|
33
37
|
import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
@@ -36,15 +40,24 @@ import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
|
36
40
|
selector: 'VerticalLayoutRenderer',
|
|
37
41
|
template: `
|
|
38
42
|
<div fxLayout="column" fxLayoutGap="16px" [fxHide]="hidden">
|
|
39
|
-
<div
|
|
43
|
+
<div
|
|
44
|
+
*ngFor="
|
|
45
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
46
|
+
trackBy: trackElement
|
|
47
|
+
"
|
|
48
|
+
fxFlex
|
|
49
|
+
>
|
|
40
50
|
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
41
51
|
</div>
|
|
42
52
|
</div>
|
|
43
53
|
`,
|
|
44
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
54
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
45
55
|
})
|
|
46
56
|
export class VerticalLayoutRenderer extends LayoutRenderer<VerticalLayout> {
|
|
47
|
-
constructor(
|
|
57
|
+
constructor(
|
|
58
|
+
jsonFormsService: JsonFormsAngularService,
|
|
59
|
+
changeDetectionRef: ChangeDetectorRef
|
|
60
|
+
) {
|
|
48
61
|
super(jsonFormsService, changeDetectionRef);
|
|
49
62
|
}
|
|
50
63
|
}
|
package/src/module.ts
CHANGED
|
@@ -25,9 +25,7 @@
|
|
|
25
25
|
import { CommonModule } from '@angular/common';
|
|
26
26
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
27
27
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
28
|
-
import {
|
|
29
|
-
MatAutocompleteModule
|
|
30
|
-
} from '@angular/material/autocomplete';
|
|
28
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
31
29
|
import { MatButtonModule } from '@angular/material/button';
|
|
32
30
|
import { MatBadgeModule } from '@angular/material/badge';
|
|
33
31
|
import { MatCardModule } from '@angular/material/card';
|
|
@@ -92,7 +90,7 @@ import { LayoutChildrenRenderPropsPipe } from './layouts';
|
|
|
92
90
|
MatTableModule,
|
|
93
91
|
MatToolbarModule,
|
|
94
92
|
MatTooltipModule,
|
|
95
|
-
MatBadgeModule
|
|
93
|
+
MatBadgeModule,
|
|
96
94
|
],
|
|
97
95
|
declarations: [
|
|
98
96
|
BooleanControlRenderer,
|
|
@@ -113,7 +111,7 @@ import { LayoutChildrenRenderPropsPipe } from './layouts';
|
|
|
113
111
|
AutocompleteControlRenderer,
|
|
114
112
|
TableRenderer,
|
|
115
113
|
ArrayLayoutRenderer,
|
|
116
|
-
LayoutChildrenRenderPropsPipe
|
|
114
|
+
LayoutChildrenRenderPropsPipe,
|
|
117
115
|
],
|
|
118
116
|
entryComponents: [
|
|
119
117
|
BooleanControlRenderer,
|
|
@@ -133,7 +131,7 @@ import { LayoutChildrenRenderPropsPipe } from './layouts';
|
|
|
133
131
|
ObjectControlRenderer,
|
|
134
132
|
AutocompleteControlRenderer,
|
|
135
133
|
TableRenderer,
|
|
136
|
-
ArrayLayoutRenderer
|
|
134
|
+
ArrayLayoutRenderer,
|
|
137
135
|
],
|
|
138
136
|
exports: [
|
|
139
137
|
CommonModule,
|
|
@@ -154,9 +152,9 @@ import { LayoutChildrenRenderPropsPipe } from './layouts';
|
|
|
154
152
|
MatSelectModule,
|
|
155
153
|
MatButtonModule,
|
|
156
154
|
MatIconModule,
|
|
157
|
-
MatAutocompleteModule
|
|
155
|
+
MatAutocompleteModule,
|
|
158
156
|
],
|
|
159
157
|
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
160
|
-
providers: []
|
|
158
|
+
providers: [],
|
|
161
159
|
})
|
|
162
|
-
export class JsonFormsAngularMaterialModule {
|
|
160
|
+
export class JsonFormsAngularMaterialModule {}
|
|
@@ -22,10 +22,10 @@
|
|
|
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 } from '@angular/core';
|
|
25
|
+
import { Component, OnDestroy, OnInit } from '@angular/core';
|
|
26
26
|
import {
|
|
27
27
|
JsonFormsAngularService,
|
|
28
|
-
JsonFormsBaseRenderer
|
|
28
|
+
JsonFormsBaseRenderer,
|
|
29
29
|
} from '@jsonforms/angular';
|
|
30
30
|
import {
|
|
31
31
|
JsonFormsState,
|
|
@@ -40,11 +40,12 @@ import { Subscription } from 'rxjs';
|
|
|
40
40
|
|
|
41
41
|
@Component({
|
|
42
42
|
selector: 'LabelRenderer',
|
|
43
|
-
template: `
|
|
44
|
-
<label class="mat-title" fxFlex> {{ label }} </label>
|
|
45
|
-
`
|
|
43
|
+
template: ` <label class="mat-title" fxFlex> {{ label }} </label> `,
|
|
46
44
|
})
|
|
47
|
-
export class LabelRenderer
|
|
45
|
+
export class LabelRenderer
|
|
46
|
+
extends JsonFormsBaseRenderer<LabelElement>
|
|
47
|
+
implements OnDestroy, OnInit
|
|
48
|
+
{
|
|
48
49
|
label: string;
|
|
49
50
|
visible: boolean;
|
|
50
51
|
|
|
@@ -56,10 +57,13 @@ export class LabelRenderer extends JsonFormsBaseRenderer<LabelElement> {
|
|
|
56
57
|
ngOnInit() {
|
|
57
58
|
this.subscription = this.jsonFormsService.$state.subscribe({
|
|
58
59
|
next: (state: JsonFormsState) => {
|
|
59
|
-
const props = mapStateToLabelProps(
|
|
60
|
+
const props = mapStateToLabelProps(
|
|
61
|
+
state,
|
|
62
|
+
this.getOwnProps() as OwnPropsOfLabel
|
|
63
|
+
);
|
|
60
64
|
this.visible = props.visible;
|
|
61
|
-
this.label = props.text
|
|
62
|
-
}
|
|
65
|
+
this.label = props.text;
|
|
66
|
+
},
|
|
63
67
|
});
|
|
64
68
|
}
|
|
65
69
|
|
|
@@ -30,14 +30,14 @@ import { Component, Input } from '@angular/core';
|
|
|
30
30
|
<div *ngIf="initialized">
|
|
31
31
|
<jsonforms-outlet [renderProps]="_item"></jsonforms-outlet>
|
|
32
32
|
</div>
|
|
33
|
-
|
|
33
|
+
`,
|
|
34
34
|
})
|
|
35
35
|
export class JsonFormsDetailComponent {
|
|
36
36
|
_item: any;
|
|
37
37
|
_schema: any;
|
|
38
38
|
initialized = false;
|
|
39
39
|
|
|
40
|
-
@Input(
|
|
40
|
+
@Input()
|
|
41
41
|
set item(item: any) {
|
|
42
42
|
if (item) {
|
|
43
43
|
this._item = item;
|