@jsonforms/angular-material 3.0.0 → 3.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/controls/autocomplete.renderer.d.ts +2 -2
- package/lib/cjs/controls/autocomplete.renderer.js +1 -1
- package/lib/cjs/controls/autocomplete.renderer.js.map +1 -1
- package/lib/cjs/controls/autocomplete.renderer.metadata.json +1 -1
- package/lib/cjs/controls/date.renderer.js +1 -1
- 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 +2 -2
- package/lib/cjs/controls/number.renderer.js.map +1 -1
- package/lib/cjs/controls/number.renderer.metadata.json +1 -1
- package/lib/cjs/controls/text.renderer.js +1 -1
- 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 +1 -1
- package/lib/cjs/controls/textarea.renderer.js.map +1 -1
- package/lib/cjs/controls/textarea.renderer.metadata.json +1 -1
- package/lib/cjs/layouts/array-layout.renderer.d.ts +8 -0
- package/lib/cjs/layouts/array-layout.renderer.js +12 -2
- 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.d.ts +2 -1
- package/lib/cjs/layouts/categorization-layout.renderer.js +5 -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 +1 -1
- 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 +1 -1
- 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.d.ts +5 -3
- package/lib/cjs/layouts/layout.renderer.js +18 -14
- 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 +1 -1
- 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 +3 -1
- package/lib/cjs/module.js.map +1 -1
- package/lib/cjs/module.metadata.json +1 -1
- package/lib/cjs/other/master-detail/master.js +3 -0
- 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/table.renderer.d.ts +9 -0
- package/lib/cjs/other/table.renderer.js +28 -2
- 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 +2 -2
- package/lib/esm/controls/autocomplete.renderer.js +1 -1
- package/lib/esm/controls/autocomplete.renderer.js.map +1 -1
- package/lib/esm/controls/autocomplete.renderer.metadata.json +1 -1
- package/lib/esm/controls/date.renderer.js +1 -1
- 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 +3 -3
- package/lib/esm/controls/number.renderer.js.map +1 -1
- package/lib/esm/controls/number.renderer.metadata.json +1 -1
- package/lib/esm/controls/text.renderer.js +1 -1
- 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 +1 -1
- package/lib/esm/controls/textarea.renderer.js.map +1 -1
- package/lib/esm/controls/textarea.renderer.metadata.json +1 -1
- package/lib/esm/layouts/array-layout.renderer.d.ts +8 -0
- package/lib/esm/layouts/array-layout.renderer.js +12 -2
- 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.d.ts +2 -1
- package/lib/esm/layouts/categorization-layout.renderer.js +6 -3
- 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 +1 -1
- 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 +1 -1
- 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.d.ts +5 -3
- package/lib/esm/layouts/layout.renderer.js +18 -14
- 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 +1 -1
- 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 +3 -1
- package/lib/esm/module.js.map +1 -1
- package/lib/esm/module.metadata.json +1 -1
- package/lib/esm/other/master-detail/master.js +4 -1
- 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/table.renderer.d.ts +9 -0
- package/lib/esm/other/table.renderer.js +29 -3
- package/lib/esm/other/table.renderer.js.map +1 -1
- package/lib/esm/other/table.renderer.metadata.json +1 -1
- package/package.json +23 -8
- package/src/controls/autocomplete.renderer.ts +5 -3
- package/src/controls/date.renderer.ts +3 -1
- package/src/controls/number.renderer.ts +4 -3
- package/src/controls/text.renderer.ts +3 -1
- package/src/controls/textarea.renderer.ts +3 -1
- package/src/layouts/array-layout.renderer.ts +43 -2
- package/src/layouts/categorization-layout.renderer.ts +8 -2
- package/src/layouts/group-layout.renderer.ts +1 -1
- package/src/layouts/horizontal-layout.renderer.ts +1 -1
- package/src/layouts/layout.renderer.ts +17 -12
- package/src/layouts/vertical-layout.renderer.ts +1 -1
- package/src/module.ts +3 -1
- package/src/other/master-detail/master.ts +5 -0
- package/src/other/table.renderer.ts +80 -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 -1046
- package/docs/classes/autocompletecontrolrenderer.html +0 -887
- package/docs/classes/booleancontrolrenderer.html +0 -771
- package/docs/classes/categorizationtablayoutrenderer.html +0 -370
- package/docs/classes/datecontrolrenderer.html +0 -739
- package/docs/classes/grouplayoutrenderer.html +0 -426
- package/docs/classes/horizontallayoutrenderer.html +0 -426
- package/docs/classes/jsonformsangularmaterialmodule.html +0 -133
- package/docs/classes/jsonformsdetailcomponent.html +0 -227
- package/docs/classes/labelrenderer.html +0 -363
- package/docs/classes/layoutrenderer.html +0 -465
- 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 -920
- 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 -426
- package/docs/globals.html +0 -606
- package/docs/index.html +0 -375
- 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 -331
- package/test/date-control.spec.ts +0 -280
- package/test/group-layout.spec.ts +0 -104
- package/test/horizontal-layout.spec.ts +0 -94
- 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 -245
- package/test/range-control.spec.ts +0 -104
- package/test/table-control.spec.ts +0 -253
- 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 -113
- 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,7 +26,7 @@ import { __extends } from "tslib";
|
|
|
26
26
|
import startCase from 'lodash/startCase';
|
|
27
27
|
import { Component } from '@angular/core';
|
|
28
28
|
import { JsonFormsAngularService, JsonFormsArrayControl } from '@jsonforms/angular';
|
|
29
|
-
import { deriveTypes, encode, isObjectArrayControl, isPrimitiveArrayControl, or, Paths, rankWith, setReadonly } from '@jsonforms/core';
|
|
29
|
+
import { createDefaultValue, deriveTypes, encode, isObjectArrayControl, isPrimitiveArrayControl, mapDispatchToArrayControlProps, or, Paths, rankWith, setReadonly } from '@jsonforms/core';
|
|
30
30
|
var TableRenderer = /** @class */ (function (_super) {
|
|
31
31
|
__extends(TableRenderer, _super);
|
|
32
32
|
function TableRenderer(jsonformsService) {
|
|
@@ -85,6 +85,9 @@ var TableRenderer = /** @class */ (function (_super) {
|
|
|
85
85
|
TableRenderer.prototype.mapAdditionalProps = function (props) {
|
|
86
86
|
this.items = this.generateCells(props.schema, props.path);
|
|
87
87
|
this.displayedColumns = this.items.map(function (item) { return item.property; });
|
|
88
|
+
if (this.isEnabled()) {
|
|
89
|
+
this.displayedColumns.push('action');
|
|
90
|
+
}
|
|
88
91
|
};
|
|
89
92
|
TableRenderer.prototype.getProps = function (index, props) {
|
|
90
93
|
var rowPath = Paths.compose(props.path, "" + index);
|
|
@@ -94,11 +97,34 @@ var TableRenderer = /** @class */ (function (_super) {
|
|
|
94
97
|
path: rowPath
|
|
95
98
|
};
|
|
96
99
|
};
|
|
100
|
+
TableRenderer.prototype.remove = function (index) {
|
|
101
|
+
this.removeItems(this.propsPath, [index])();
|
|
102
|
+
};
|
|
103
|
+
TableRenderer.prototype.add = function () {
|
|
104
|
+
this.addItem(this.propsPath, createDefaultValue(this.scopedSchema))();
|
|
105
|
+
};
|
|
106
|
+
TableRenderer.prototype.up = function (index) {
|
|
107
|
+
this.moveItemUp(this.propsPath, index)();
|
|
108
|
+
};
|
|
109
|
+
TableRenderer.prototype.down = function (index) {
|
|
110
|
+
this.moveItemDown(this.propsPath, index)();
|
|
111
|
+
};
|
|
112
|
+
TableRenderer.prototype.ngOnInit = function () {
|
|
113
|
+
_super.prototype.ngOnInit.call(this);
|
|
114
|
+
var _a = mapDispatchToArrayControlProps(this.jsonFormsService.updateCore.bind(this.jsonFormsService)), addItem = _a.addItem, removeItems = _a.removeItems, moveUp = _a.moveUp, moveDown = _a.moveDown;
|
|
115
|
+
this.addItem = addItem;
|
|
116
|
+
this.moveItemUp = moveUp;
|
|
117
|
+
this.moveItemDown = moveDown;
|
|
118
|
+
this.removeItems = removeItems;
|
|
119
|
+
};
|
|
97
120
|
TableRenderer.decorators = [
|
|
98
121
|
{ type: Component, args: [{
|
|
99
122
|
selector: 'TableRenderer',
|
|
100
|
-
template: "\n <table\n mat-table\n [dataSource]=\"data\"\n class=\"mat-elevation-z8\"\n [trackBy]=\"trackElement\"\n >\n <ng-container\n *ngFor=\"let item of items\"\n matColumnDef=\"{{ item.property }}\"\n >\n <th mat-header-cell *matHeaderCellDef>{{ item.header }}</th>\n <td mat-cell *matCellDef=\"let index = index\">\n <jsonforms-outlet\n [renderProps]=\"getProps(index, item.props)\"\n ></jsonforms-outlet>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n ",
|
|
101
|
-
styles: [
|
|
123
|
+
template: "\n <table\n mat-table\n [dataSource]=\"data\"\n class=\"mat-elevation-z8\"\n [trackBy]=\"trackElement\"\n >\n <ng-container matColumnDef=\"action\">\n <tr>\n <th mat-header-cell *matHeaderCellDef>\n <button mat-button color=\"primary\" (click)=\"add()\" [disabled]=\"!isEnabled()\" matTooltip=\"Add\"><mat-icon>add</mat-icon></button>\n </th>\n </tr>\n <tr>\n <td mat-cell *matCellDef=\"let row; let i = index; let first = first; let last = last;\">\n <button\n *ngIf=\"uischema?.options?.showSortButtons\"\n class=\"item-up\"\n mat-button\n [disabled]=\"first\"\n (click)=\"up(i)\"\n matTooltip=\"Move item up\"\n matTooltipPosition=\"right\"\n >\n <mat-icon>arrow_upward</mat-icon>\n </button>\n <button\n *ngIf=\"uischema?.options?.showSortButtons\"\n class=\"item-down\"\n mat-button\n [disabled]=\"last\"\n (click)=\"down(i)\"\n matTooltip=\"Move item down\"\n matTooltipPosition=\"right\"\n >\n <mat-icon>arrow_downward</mat-icon>\n </button>\n <button\n mat-button\n color=\"warn\"\n (click)=\"remove(i)\"\n [disabled]=\"!isEnabled()\"\n matTooltipPosition=\"right\"\n matTooltip=\"Delete\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n </td>\n <tr>\n </ng-container>\n <ng-container\n *ngFor=\"let item of items\"\n matColumnDef=\"{{ item.property }}\"\n >\n <th mat-header-cell *matHeaderCellDef>{{ item.header }}</th>\n <td mat-cell *matCellDef=\"let index = index\">\n <jsonforms-outlet\n [renderProps]=\"getProps(index, item.props)\"\n ></jsonforms-outlet>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n ",
|
|
124
|
+
styles: [
|
|
125
|
+
'table {width: 100%;}',
|
|
126
|
+
'.cdk-column-action { width: 15%}'
|
|
127
|
+
]
|
|
102
128
|
},] }
|
|
103
129
|
];
|
|
104
130
|
TableRenderer.ctorParameters = function () { return [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.renderer.js","sourceRoot":"","sources":["../../../src/other/table.renderer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"table.renderer.js","sourceRoot":"","sources":["../../../src/other/table.renderer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEW,kBAAkB,EAClC,WAAW,EACX,MAAM,EACN,oBAAoB,EACpB,uBAAuB,EACX,8BAA8B,EAC1C,EAAE,EAEF,KAAK,EAEL,QAAQ,EACR,WAAW,EAEZ,MAAM,iBAAiB,CAAC;AAEzB;IAwEmC,iCAAqB;IAUtD,uBAAY,gBAAyC;QAArD,YACE,kBAAM,gBAAgB,CAAC,SACxB;QARQ,qBAAe,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAoD/C,mBAAa,GAAG,UACd,MAAkB,EAClB,OAAe;YAEf,IAAI,MAAM,CAAC,IAAI,KAA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ends":{"__symbolic":"reference","module":"@jsonforms/angular","name":"JsonFormsArrayControl","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"TableRenderer":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@jsonforms/angular","name":"JsonFormsArrayControl","line":119,"character":35},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":47,"character":1},"arguments":[{"selector":"TableRenderer","template":"\n <table\n mat-table\n [dataSource]=\"data\"\n class=\"mat-elevation-z8\"\n [trackBy]=\"trackElement\"\n >\n <ng-container matColumnDef=\"action\">\n <tr>\n <th mat-header-cell *matHeaderCellDef>\n <button mat-button color=\"primary\" (click)=\"add()\" [disabled]=\"!isEnabled()\" matTooltip=\"Add\"><mat-icon>add</mat-icon></button>\n </th>\n </tr>\n <tr>\n <td mat-cell *matCellDef=\"let row; let i = index; let first = first; let last = last;\">\n <button\n *ngIf=\"uischema?.options?.showSortButtons\"\n class=\"item-up\"\n mat-button\n [disabled]=\"first\"\n (click)=\"up(i)\"\n matTooltip=\"Move item up\"\n matTooltipPosition=\"right\"\n >\n <mat-icon>arrow_upward</mat-icon>\n </button>\n <button\n *ngIf=\"uischema?.options?.showSortButtons\"\n class=\"item-down\"\n mat-button\n [disabled]=\"last\"\n (click)=\"down(i)\"\n matTooltip=\"Move item down\"\n matTooltipPosition=\"right\"\n >\n <mat-icon>arrow_downward</mat-icon>\n </button>\n <button\n mat-button\n color=\"warn\"\n (click)=\"remove(i)\"\n [disabled]=\"!isEnabled()\"\n matTooltipPosition=\"right\"\n matTooltip=\"Delete\"\n >\n <mat-icon>delete</mat-icon>\n </button>\n </td>\n <tr>\n </ng-container>\n <ng-container\n *ngFor=\"let item of items\"\n matColumnDef=\"{{ item.property }}\"\n >\n <th mat-header-cell *matHeaderCellDef>{{ item.header }}</th>\n <td mat-cell *matCellDef=\"let index = index\">\n <jsonforms-outlet\n [renderProps]=\"getProps(index, item.props)\"\n ></jsonforms-outlet>\n </td>\n </ng-container>\n\n <tr mat-header-row *matHeaderRowDef=\"displayedColumns\"></tr>\n <tr mat-row *matRowDef=\"let row; columns: displayedColumns\"></tr>\n </table>\n ","styles":["table {width: 100%;}",".cdk-column-action { width: 15%}"]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@jsonforms/angular","name":"JsonFormsAngularService","line":129,"character":32}]}],"trackElement":[{"__symbolic":"method"}],"mapAdditionalProps":[{"__symbolic":"method"}],"getProps":[{"__symbolic":"method"}],"remove":[{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"up":[{"__symbolic":"method"}],"down":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}]}},"TableRendererTester":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@jsonforms/core","name":"rankWith","line":225,"character":49},"arguments":[3,{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@jsonforms/core","name":"or","line":227,"character":2},"arguments":[{"__symbolic":"reference","module":"@jsonforms/core","name":"isObjectArrayControl","line":227,"character":5},{"__symbolic":"reference","module":"@jsonforms/core","name":"isPrimitiveArrayControl","line":227,"character":27}]}]},"controlWithoutLabel":{"__symbolic":"error","message":"Lambda not supported","line":236,"character":35}}}]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/angular-material",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.1.0-alpha.1",
|
|
4
4
|
"description": "Material Renderer Set for Angular module of JSON Forms",
|
|
5
5
|
"repository": "https://github.com/eclipsesource/jsonforms",
|
|
6
6
|
"bugs": "https://github.com/eclipsesource/jsonforms/issues",
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"src": "src",
|
|
14
14
|
"test": "test"
|
|
15
15
|
},
|
|
16
|
+
"files": [
|
|
17
|
+
"lib",
|
|
18
|
+
"src"
|
|
19
|
+
],
|
|
16
20
|
"keywords": [
|
|
17
21
|
"angular",
|
|
18
22
|
"material",
|
|
@@ -35,6 +39,7 @@
|
|
|
35
39
|
"typings": "./lib/esm/index.d.ts",
|
|
36
40
|
"scripts": {
|
|
37
41
|
"build": "ngc && ngc -p tsconfig.cjs.json",
|
|
42
|
+
"build:examples-app": "rollup -c rollup.example.config.js",
|
|
38
43
|
"dev": "webpack --config webpack/webpack.dev.js && webpack-dev-server --config webpack/webpack.dev.js --env=dev --inline",
|
|
39
44
|
"clean": "rimraf lib coverage dist .nyc_output 2> /dev/null",
|
|
40
45
|
"lint": "tslint --project tsconfig.json --exclude src/models/jsonSchema.ts",
|
|
@@ -63,8 +68,8 @@
|
|
|
63
68
|
"@angular/material": "^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
64
69
|
"@angular/platform-browser": "^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
65
70
|
"@angular/router": "^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
66
|
-
"@jsonforms/angular": "3.0.
|
|
67
|
-
"@jsonforms/core": "3.0.
|
|
71
|
+
"@jsonforms/angular": "3.1.0-alpha.1",
|
|
72
|
+
"@jsonforms/core": "3.1.0-alpha.1",
|
|
68
73
|
"core-js": "^2.5.3",
|
|
69
74
|
"rxjs": "^6.5.3 || ^7.4.0"
|
|
70
75
|
},
|
|
@@ -84,10 +89,14 @@
|
|
|
84
89
|
"@angular/platform-browser": "^12.0.0",
|
|
85
90
|
"@angular/platform-browser-dynamic": "^12.0.0",
|
|
86
91
|
"@angular/router": "^12.0.0",
|
|
87
|
-
"@jsonforms/angular": "^3.0.
|
|
88
|
-
"@jsonforms/angular-test": "^3.0.
|
|
89
|
-
"@jsonforms/core": "^3.0.
|
|
90
|
-
"@jsonforms/examples": "^3.0.
|
|
92
|
+
"@jsonforms/angular": "^3.1.0-alpha.1",
|
|
93
|
+
"@jsonforms/angular-test": "^3.1.0-alpha.1",
|
|
94
|
+
"@jsonforms/core": "^3.1.0-alpha.1",
|
|
95
|
+
"@jsonforms/examples": "^3.1.0-alpha.1",
|
|
96
|
+
"@rollup/plugin-commonjs": "^23.0.3",
|
|
97
|
+
"@rollup/plugin-json": "^5.0.2",
|
|
98
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
99
|
+
"@rollup/plugin-replace": "^5.0.1",
|
|
91
100
|
"@types/node": "^10.10.0",
|
|
92
101
|
"angular2-template-loader": "^0.6.2",
|
|
93
102
|
"copy-webpack-plugin": "^5.0.5",
|
|
@@ -108,6 +117,12 @@
|
|
|
108
117
|
"protractor": "^5.4.1",
|
|
109
118
|
"request": "^2.88.0",
|
|
110
119
|
"rimraf": "^3.0.2",
|
|
120
|
+
"rollup": "^2.78.0",
|
|
121
|
+
"rollup-plugin-cleanup": "^3.2.1",
|
|
122
|
+
"rollup-plugin-copy": "^3.4.0",
|
|
123
|
+
"rollup-plugin-import-css": "^3.1.0",
|
|
124
|
+
"rollup-plugin-typescript2": "^0.31.1",
|
|
125
|
+
"rollup-plugin-visualizer": "^5.4.1",
|
|
111
126
|
"rxjs": "^6.5.3",
|
|
112
127
|
"ts-loader": "^6.2.1",
|
|
113
128
|
"tslint": "^5.20.1",
|
|
@@ -117,5 +132,5 @@
|
|
|
117
132
|
"webpack-dev-server": "^3.9.0",
|
|
118
133
|
"zone.js": "^0.11.4"
|
|
119
134
|
},
|
|
120
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "386174994eabc41758450b8d551e1c859498a468"
|
|
121
136
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
26
|
-
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
|
26
|
+
import type { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
|
27
27
|
import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
|
|
28
28
|
import {
|
|
29
29
|
Actions,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
RankedTester,
|
|
35
35
|
rankWith
|
|
36
36
|
} from '@jsonforms/core';
|
|
37
|
-
import { Observable } from 'rxjs';
|
|
37
|
+
import type { Observable } from 'rxjs';
|
|
38
38
|
import { map } from 'rxjs/operators';
|
|
39
39
|
import { startWith } from 'rxjs/operators';
|
|
40
40
|
|
|
@@ -74,6 +74,8 @@ import { startWith } from 'rxjs/operators';
|
|
|
74
74
|
[formControl]="form"
|
|
75
75
|
[matAutocomplete]="auto"
|
|
76
76
|
(keydown)="updateFilter($event)"
|
|
77
|
+
(focus)="focused = true"
|
|
78
|
+
(focusout)="focused = false"
|
|
77
79
|
/>
|
|
78
80
|
<mat-autocomplete
|
|
79
81
|
autoActiveFirstOption
|
|
@@ -87,7 +89,7 @@ import { startWith } from 'rxjs/operators';
|
|
|
87
89
|
{{ option }}
|
|
88
90
|
</mat-option>
|
|
89
91
|
</mat-autocomplete>
|
|
90
|
-
<mat-hint *ngIf="shouldShowUnfocusedDescription()">{{ description }}</mat-hint>
|
|
92
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{ description }}</mat-hint>
|
|
91
93
|
<mat-error>{{ error }}</mat-error>
|
|
92
94
|
</mat-form-field>
|
|
93
95
|
`,
|
|
@@ -41,13 +41,15 @@ import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
|
|
|
41
41
|
[id]="id"
|
|
42
42
|
[formControl]="form"
|
|
43
43
|
[matDatepicker]="datepicker"
|
|
44
|
+
(focus)="focused = true"
|
|
45
|
+
(focusout)="focused = false"
|
|
44
46
|
/>
|
|
45
47
|
<mat-datepicker-toggle
|
|
46
48
|
matSuffix
|
|
47
49
|
[for]="datepicker"
|
|
48
50
|
></mat-datepicker-toggle>
|
|
49
51
|
<mat-datepicker #datepicker></mat-datepicker>
|
|
50
|
-
<mat-hint *ngIf="shouldShowUnfocusedDescription()">{{ description }}</mat-hint>
|
|
52
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{ description }}</mat-hint>
|
|
51
53
|
<mat-error>{{ error }}</mat-error>
|
|
52
54
|
</mat-form-field>
|
|
53
55
|
`,
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
26
26
|
import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
|
|
27
27
|
import {
|
|
28
|
-
getLocale,
|
|
29
28
|
isIntegerControl,
|
|
30
29
|
isNumberControl,
|
|
31
30
|
or,
|
|
@@ -49,8 +48,10 @@ import merge from 'lodash/merge';
|
|
|
49
48
|
[min]="min"
|
|
50
49
|
[max]="max"
|
|
51
50
|
[step]="multipleOf"
|
|
51
|
+
(focus)="focused = true"
|
|
52
|
+
(focusout)="focused = false"
|
|
52
53
|
/>
|
|
53
|
-
<mat-hint *ngIf="shouldShowUnfocusedDescription()">{{ description }}</mat-hint>
|
|
54
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription()" || focused>{{ description }}</mat-hint>
|
|
54
55
|
<mat-error>{{ error }}</mat-error>
|
|
55
56
|
</mat-form-field>
|
|
56
57
|
`,
|
|
@@ -138,7 +139,7 @@ export class NumberControlRenderer extends JsonFormsControl {
|
|
|
138
139
|
this.max = this.scopedSchema.maximum;
|
|
139
140
|
this.multipleOf = this.scopedSchema.multipleOf || defaultStep;
|
|
140
141
|
const appliedUiSchemaOptions = merge({}, props.config, this.uischema.options);
|
|
141
|
-
const currentLocale =
|
|
142
|
+
const currentLocale = this.jsonFormsService.getLocale();
|
|
142
143
|
if (this.locale === undefined || this.locale !== currentLocale) {
|
|
143
144
|
this.locale = currentLocale;
|
|
144
145
|
this.numberFormat = new Intl.NumberFormat(this.locale, {
|
|
@@ -37,8 +37,10 @@ import { isStringControl, RankedTester, rankWith } from '@jsonforms/core';
|
|
|
37
37
|
(input)="onChange($event)"
|
|
38
38
|
[id]="id"
|
|
39
39
|
[formControl]="form"
|
|
40
|
+
(focus)="focused = true"
|
|
41
|
+
(focusout)="focused = false"
|
|
40
42
|
/>
|
|
41
|
-
<mat-hint *ngIf="shouldShowUnfocusedDescription()">{{ description }}</mat-hint>
|
|
43
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{ description }}</mat-hint>
|
|
42
44
|
<mat-error>{{ error }}</mat-error>
|
|
43
45
|
</mat-form-field>
|
|
44
46
|
`,
|
|
@@ -36,8 +36,10 @@ import { isMultiLineControl, RankedTester, rankWith } from '@jsonforms/core';
|
|
|
36
36
|
(input)="onChange($event)"
|
|
37
37
|
[id]="id"
|
|
38
38
|
[formControl]="form"
|
|
39
|
+
(focus)="focused = true"
|
|
40
|
+
(focusout)="focused = false"
|
|
39
41
|
></textarea>
|
|
40
|
-
<mat-hint *ngIf="shouldShowUnfocusedDescription()">{{ description }}</mat-hint>
|
|
42
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{ description }}</mat-hint>
|
|
41
43
|
<mat-error>{{ error }}</mat-error>
|
|
42
44
|
</mat-form-field>
|
|
43
45
|
`,
|
|
@@ -82,7 +82,8 @@ import {
|
|
|
82
82
|
let item of [].constructor(data);
|
|
83
83
|
let idx = index;
|
|
84
84
|
trackBy: trackByFn;
|
|
85
|
-
last as last
|
|
85
|
+
last as last;
|
|
86
|
+
first as first
|
|
86
87
|
"
|
|
87
88
|
>
|
|
88
89
|
<mat-card>
|
|
@@ -90,6 +91,30 @@ import {
|
|
|
90
91
|
<jsonforms-outlet [renderProps]="getProps(idx)"></jsonforms-outlet>
|
|
91
92
|
</mat-card-content>
|
|
92
93
|
<mat-card-actions *ngIf="isEnabled()">
|
|
94
|
+
<button
|
|
95
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
96
|
+
class="item-up"
|
|
97
|
+
mat-button
|
|
98
|
+
[disabled]="first"
|
|
99
|
+
(click)="up(idx)"
|
|
100
|
+
attr.aria-label="{{ this.upAriaLabel }}"
|
|
101
|
+
matTooltip="{{ this.upTooltip }}"
|
|
102
|
+
matTooltipPosition="right"
|
|
103
|
+
>
|
|
104
|
+
<mat-icon>arrow_upward</mat-icon>
|
|
105
|
+
</button>
|
|
106
|
+
<button
|
|
107
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
108
|
+
class="item-down"
|
|
109
|
+
mat-button
|
|
110
|
+
[disabled]="last"
|
|
111
|
+
(click)="down(idx)"
|
|
112
|
+
attr.aria-label="{{ this.downAriaLabel }}"
|
|
113
|
+
matTooltip="{{ this.downTooltip }}"
|
|
114
|
+
matTooltipPosition="right"
|
|
115
|
+
>
|
|
116
|
+
<mat-icon>arrow_downward</mat-icon>
|
|
117
|
+
</button>
|
|
93
118
|
<button
|
|
94
119
|
mat-button
|
|
95
120
|
color="warn"
|
|
@@ -128,8 +153,14 @@ export class ArrayLayoutRenderer
|
|
|
128
153
|
noDataMessage: string;
|
|
129
154
|
removeTooltip: string;
|
|
130
155
|
removeAriaLabel: string;
|
|
156
|
+
upTooltip: string;
|
|
157
|
+
upAriaLabel: string;
|
|
158
|
+
downTooltip: string;
|
|
159
|
+
downAriaLabel:string;
|
|
131
160
|
noData: boolean;
|
|
132
161
|
addItem: (path: string, value: any) => () => void;
|
|
162
|
+
moveItemUp: (path: string, index: number) => () => void;
|
|
163
|
+
moveItemDown: (path: string, index: number) => () => void;
|
|
133
164
|
removeItems: (path: string, toDelete: number[]) => () => void;
|
|
134
165
|
uischemas: {
|
|
135
166
|
tester: UISchemaTester;
|
|
@@ -148,12 +179,20 @@ export class ArrayLayoutRenderer
|
|
|
148
179
|
add(): void {
|
|
149
180
|
this.addItem(this.propsPath, createDefaultValue(this.scopedSchema))();
|
|
150
181
|
}
|
|
182
|
+
up(index: number): void {
|
|
183
|
+
this.moveItemUp(this.propsPath, index)();
|
|
184
|
+
}
|
|
185
|
+
down(index: number): void {
|
|
186
|
+
this.moveItemDown(this.propsPath, index)();
|
|
187
|
+
}
|
|
151
188
|
ngOnInit() {
|
|
152
189
|
super.ngOnInit();
|
|
153
|
-
const { addItem, removeItems } = mapDispatchToArrayControlProps(
|
|
190
|
+
const { addItem, removeItems, moveUp, moveDown } = mapDispatchToArrayControlProps(
|
|
154
191
|
this.jsonFormsService.updateCore.bind(this.jsonFormsService)
|
|
155
192
|
);
|
|
156
193
|
this.addItem = addItem;
|
|
194
|
+
this.moveItemUp = moveUp;
|
|
195
|
+
this.moveItemDown = moveDown;
|
|
157
196
|
this.removeItems = removeItems;
|
|
158
197
|
}
|
|
159
198
|
mapAdditionalProps(props: ArrayLayoutProps) {
|
|
@@ -161,6 +200,8 @@ export class ArrayLayoutRenderer
|
|
|
161
200
|
this.uischemas = props.uischemas;
|
|
162
201
|
this.addTooltip = `Add to ${this.label}`;
|
|
163
202
|
this.addAriaLabel = `Add to ${this.label} button`;
|
|
203
|
+
this.upAriaLabel = `Move ${this.label} up`;
|
|
204
|
+
this.downAriaLabel = `Move ${this.label} down`;
|
|
164
205
|
this.removeTooltip = `Delete`;
|
|
165
206
|
this.removeAriaLabel = `Delete button`;
|
|
166
207
|
this.noDataMessage = `No data`;
|
|
@@ -26,8 +26,11 @@ import {
|
|
|
26
26
|
and,
|
|
27
27
|
Categorization,
|
|
28
28
|
categorizationHasCategory,
|
|
29
|
+
Category,
|
|
29
30
|
defaultJsonFormsI18nState,
|
|
30
31
|
deriveLabelForUISchemaElement,
|
|
32
|
+
getAjv,
|
|
33
|
+
isVisible,
|
|
31
34
|
JsonFormsState,
|
|
32
35
|
Labelable,
|
|
33
36
|
mapStateToLayoutProps,
|
|
@@ -47,7 +50,7 @@ import { Subscription } from 'rxjs';
|
|
|
47
50
|
template: `
|
|
48
51
|
<mat-tab-group dynamicHeight="true" [fxHide]="hidden">
|
|
49
52
|
<mat-tab
|
|
50
|
-
*ngFor="let category of
|
|
53
|
+
*ngFor="let category of visibleCategories; let i = index"
|
|
51
54
|
[label]="categoryLabels[i]"
|
|
52
55
|
>
|
|
53
56
|
<div *ngFor="let element of category.elements">
|
|
@@ -61,6 +64,7 @@ export class CategorizationTabLayoutRenderer
|
|
|
61
64
|
extends JsonFormsBaseRenderer<Categorization>
|
|
62
65
|
implements OnInit, OnDestroy {
|
|
63
66
|
hidden: boolean;
|
|
67
|
+
visibleCategories: (Category | Categorization)[];
|
|
64
68
|
private subscription: Subscription;
|
|
65
69
|
categoryLabels: string[];
|
|
66
70
|
|
|
@@ -73,7 +77,9 @@ export class CategorizationTabLayoutRenderer
|
|
|
73
77
|
next: (state: JsonFormsState) => {
|
|
74
78
|
const props = mapStateToLayoutProps(state, this.getOwnProps());
|
|
75
79
|
this.hidden = !props.visible;
|
|
76
|
-
this.
|
|
80
|
+
this.visibleCategories = this.uischema.elements.filter((category: Category | Categorization) =>
|
|
81
|
+
isVisible(category, props.data, undefined, getAjv(state)));
|
|
82
|
+
this.categoryLabels = this.visibleCategories.map(
|
|
77
83
|
element => deriveLabelForUISchemaElement(element as Labelable<boolean>,
|
|
78
84
|
state.jsonforms.i18n?.translate ?? defaultJsonFormsI18nState.translate));
|
|
79
85
|
}
|
|
@@ -32,7 +32,7 @@ import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
|
32
32
|
template: `
|
|
33
33
|
<mat-card fxLayout="column" [fxHide]="hidden">
|
|
34
34
|
<mat-card-title class="mat-title">{{ label }}</mat-card-title>
|
|
35
|
-
<div *ngFor="let props of
|
|
35
|
+
<div *ngFor="let props of uischema | layoutChildrenRenderProps: schema: path; trackBy: trackElement" fxFlex>
|
|
36
36
|
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
37
37
|
</div>
|
|
38
38
|
</mat-card>
|
|
@@ -41,7 +41,7 @@ import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
|
41
41
|
[fxHide]="hidden"
|
|
42
42
|
fxLayoutAlign="center start"
|
|
43
43
|
>
|
|
44
|
-
<div *ngFor="let props of
|
|
44
|
+
<div *ngFor="let props of uischema | layoutChildrenRenderProps: schema: path; trackBy: trackElement" fxFlex>
|
|
45
45
|
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
@@ -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 { OnDestroy, OnInit, ChangeDetectorRef, Component } from '@angular/core';
|
|
25
|
+
import { OnDestroy, OnInit, ChangeDetectorRef, Component, PipeTransform, Pipe } from '@angular/core';
|
|
26
26
|
import {
|
|
27
27
|
JsonFormsAngularService,
|
|
28
28
|
JsonFormsBaseRenderer
|
|
@@ -32,9 +32,10 @@ import {
|
|
|
32
32
|
Layout,
|
|
33
33
|
mapStateToLayoutProps,
|
|
34
34
|
OwnPropsOfRenderer,
|
|
35
|
-
UISchemaElement
|
|
35
|
+
UISchemaElement,
|
|
36
|
+
JsonSchema
|
|
36
37
|
} from '@jsonforms/core';
|
|
37
|
-
import { Subscription } from 'rxjs';
|
|
38
|
+
import type { Subscription } from 'rxjs';
|
|
38
39
|
|
|
39
40
|
@Component({
|
|
40
41
|
template: ''
|
|
@@ -66,20 +67,24 @@ export class LayoutRenderer<T extends Layout> extends JsonFormsBaseRenderer<T>
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
trackElement(_index: number, renderProp: OwnPropsOfRenderer): string {
|
|
71
|
+
return renderProp
|
|
72
|
+
? renderProp.path + JSON.stringify(renderProp.uischema)
|
|
73
|
+
: null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@Pipe({ name: 'layoutChildrenRenderProps' })
|
|
78
|
+
export class LayoutChildrenRenderPropsPipe implements PipeTransform {
|
|
79
|
+
transform(uischema: Layout, schema: JsonSchema, path: string): OwnPropsOfRenderer[] {
|
|
80
|
+
const elements = (uischema.elements || []).map(
|
|
71
81
|
(el: UISchemaElement) => ({
|
|
72
82
|
uischema: el,
|
|
73
|
-
schema:
|
|
74
|
-
path:
|
|
83
|
+
schema: schema,
|
|
84
|
+
path: path
|
|
75
85
|
})
|
|
76
86
|
);
|
|
77
87
|
return elements;
|
|
78
88
|
}
|
|
79
89
|
|
|
80
|
-
trackElement(_index: number, renderProp: OwnPropsOfRenderer): string {
|
|
81
|
-
return renderProp
|
|
82
|
-
? renderProp.path + JSON.stringify(renderProp.uischema)
|
|
83
|
-
: null;
|
|
84
|
-
}
|
|
85
90
|
}
|
|
@@ -36,7 +36,7 @@ import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
|
36
36
|
selector: 'VerticalLayoutRenderer',
|
|
37
37
|
template: `
|
|
38
38
|
<div fxLayout="column" fxLayoutGap="16px" [fxHide]="hidden">
|
|
39
|
-
<div *ngFor="let props of
|
|
39
|
+
<div *ngFor="let props of uischema | layoutChildrenRenderProps: schema: path; trackBy: trackElement" fxFlex>
|
|
40
40
|
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
package/src/module.ts
CHANGED
|
@@ -66,6 +66,7 @@ import { GroupLayoutRenderer } from './layouts/group-layout.renderer';
|
|
|
66
66
|
import { HorizontalLayoutRenderer } from './layouts/horizontal-layout.renderer';
|
|
67
67
|
import { VerticalLayoutRenderer } from './layouts/vertical-layout.renderer';
|
|
68
68
|
import { ArrayLayoutRenderer } from './layouts/array-layout.renderer';
|
|
69
|
+
import { LayoutChildrenRenderPropsPipe } from './layouts';
|
|
69
70
|
|
|
70
71
|
@NgModule({
|
|
71
72
|
imports: [
|
|
@@ -111,7 +112,8 @@ import { ArrayLayoutRenderer } from './layouts/array-layout.renderer';
|
|
|
111
112
|
ObjectControlRenderer,
|
|
112
113
|
AutocompleteControlRenderer,
|
|
113
114
|
TableRenderer,
|
|
114
|
-
ArrayLayoutRenderer
|
|
115
|
+
ArrayLayoutRenderer,
|
|
116
|
+
LayoutChildrenRenderPropsPipe
|
|
115
117
|
],
|
|
116
118
|
entryComponents: [
|
|
117
119
|
BooleanControlRenderer,
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
mapStateToArrayControlProps,
|
|
42
42
|
RankedTester,
|
|
43
43
|
rankWith,
|
|
44
|
+
setReadonly,
|
|
44
45
|
StatePropsOfArrayControl,
|
|
45
46
|
uiTypeIs
|
|
46
47
|
} from '@jsonforms/core';
|
|
@@ -183,6 +184,10 @@ export class MasterListComponent extends JsonFormsArrayControl {
|
|
|
183
184
|
props.rootSchema
|
|
184
185
|
);
|
|
185
186
|
|
|
187
|
+
if (!this.isEnabled()) {
|
|
188
|
+
setReadonly(detailUISchema);
|
|
189
|
+
}
|
|
190
|
+
|
|
186
191
|
const masterItems = (data || []).map((d: any, index: number) => {
|
|
187
192
|
const labelRefInstancePath = controlElement.options?.labelRef && removeSchemaKeywords(
|
|
188
193
|
controlElement.options.labelRef
|