@jsonforms/angular 3.0.0-alpha.0 → 3.0.0-beta.0
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 +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/classes/jsonforms.html +54 -33
- package/docs/classes/jsonformsabstractcontrol.html +30 -30
- package/docs/classes/jsonformsangularservice.html +33 -33
- package/docs/classes/jsonformsarraycontrol.html +30 -30
- package/docs/classes/jsonformsbaserenderer.html +4 -4
- package/docs/classes/jsonformscontrol.html +30 -30
- package/docs/classes/jsonformscontrolwithdetail.html +30 -30
- package/docs/classes/jsonformsoutlet.html +14 -14
- package/docs/globals.html +2 -2
- package/docs/index.html +1 -1
- package/lib/{abstract-control.d.ts → cjs/abstract-control.d.ts} +0 -0
- package/lib/{abstract-control.js → cjs/abstract-control.js} +16 -13
- package/lib/cjs/abstract-control.js.map +1 -0
- package/lib/cjs/abstract-control.metadata.json +1 -0
- package/lib/{array-control.d.ts → cjs/array-control.d.ts} +0 -0
- package/lib/{array-control.js → cjs/array-control.js} +1 -0
- package/lib/cjs/array-control.js.map +1 -0
- package/lib/{array-control.metadata.json → cjs/array-control.metadata.json} +0 -0
- package/lib/{base.renderer.d.ts → cjs/base.renderer.d.ts} +0 -0
- package/lib/{base.renderer.js → cjs/base.renderer.js} +9 -13
- package/lib/cjs/base.renderer.js.map +1 -0
- package/lib/cjs/base.renderer.metadata.json +1 -0
- package/lib/{control.d.ts → cjs/control.d.ts} +0 -0
- package/lib/{control.js → cjs/control.js} +1 -0
- package/lib/cjs/control.js.map +1 -0
- package/lib/{control.metadata.json → cjs/control.metadata.json} +0 -0
- package/lib/{index.d.ts → cjs/index.d.ts} +1 -0
- package/lib/{index.js → cjs/index.js} +1 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/{index.metadata.json → cjs/index.metadata.json} +1 -1
- package/lib/{jsonforms-root.component.d.ts → cjs/jsonforms-root.component.d.ts} +5 -4
- package/lib/{jsonforms-root.component.js → cjs/jsonforms-root.component.js} +37 -60
- package/lib/cjs/jsonforms-root.component.js.map +1 -0
- package/lib/cjs/jsonforms-root.component.metadata.json +1 -0
- package/lib/{jsonforms.component.d.ts → cjs/jsonforms.component.d.ts} +0 -0
- package/lib/{jsonforms.component.js → cjs/jsonforms.component.js} +15 -14
- package/lib/cjs/jsonforms.component.js.map +1 -0
- package/lib/{jsonforms.component.metadata.json → cjs/jsonforms.component.metadata.json} +0 -0
- package/lib/{jsonforms.module.d.ts → cjs/jsonforms.module.d.ts} +0 -0
- package/lib/{jsonforms.module.js → cjs/jsonforms.module.js} +8 -8
- package/lib/cjs/jsonforms.module.js.map +1 -0
- package/lib/{jsonforms.module.metadata.json → cjs/jsonforms.module.metadata.json} +0 -0
- package/lib/{jsonforms.service.d.ts → cjs/jsonforms.service.d.ts} +3 -3
- package/lib/{jsonforms.service.js → cjs/jsonforms.service.js} +14 -10
- package/lib/cjs/jsonforms.service.js.map +1 -0
- package/lib/{jsonforms.service.metadata.json → cjs/jsonforms.service.metadata.json} +1 -1
- package/lib/{unknown.component.d.ts → cjs/unknown.component.d.ts} +0 -0
- package/lib/{unknown.component.js → cjs/unknown.component.js} +7 -7
- package/lib/cjs/unknown.component.js.map +1 -0
- package/lib/{unknown.component.metadata.json → cjs/unknown.component.metadata.json} +0 -0
- package/lib/esm/abstract-control.d.ts +35 -0
- package/lib/esm/abstract-control.js +133 -0
- package/lib/esm/abstract-control.js.map +1 -0
- package/lib/esm/abstract-control.metadata.json +1 -0
- package/lib/esm/array-control.d.ts +6 -0
- package/lib/esm/array-control.js +40 -0
- package/lib/esm/array-control.js.map +1 -0
- package/lib/esm/array-control.metadata.json +1 -0
- package/lib/esm/base.renderer.d.ts +7 -0
- package/lib/esm/base.renderer.js +47 -0
- package/lib/esm/base.renderer.js.map +1 -0
- package/lib/esm/base.renderer.metadata.json +1 -0
- package/lib/esm/control.d.ts +9 -0
- package/lib/esm/control.js +52 -0
- package/lib/esm/control.js.map +1 -0
- package/lib/esm/control.metadata.json +1 -0
- package/lib/esm/index.d.ts +9 -0
- package/lib/esm/index.js +34 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/index.metadata.json +1 -0
- package/lib/esm/jsonforms-root.component.d.ts +29 -0
- package/lib/esm/jsonforms-root.component.js +135 -0
- package/lib/esm/jsonforms-root.component.js.map +1 -0
- package/lib/esm/jsonforms-root.component.metadata.json +1 -0
- package/lib/esm/jsonforms.component.d.ts +16 -0
- package/lib/esm/jsonforms.component.js +129 -0
- package/lib/esm/jsonforms.component.js.map +1 -0
- package/lib/esm/jsonforms.component.metadata.json +1 -0
- package/lib/esm/jsonforms.module.d.ts +2 -0
- package/lib/esm/jsonforms.module.js +42 -0
- package/lib/esm/jsonforms.module.js.map +1 -0
- package/lib/esm/jsonforms.module.metadata.json +1 -0
- package/lib/esm/jsonforms.service.d.ts +47 -0
- package/lib/esm/jsonforms.service.js +179 -0
- package/lib/esm/jsonforms.service.js.map +1 -0
- package/lib/esm/jsonforms.service.metadata.json +1 -0
- package/lib/esm/unknown.component.d.ts +2 -0
- package/lib/esm/unknown.component.js +38 -0
- package/lib/esm/unknown.component.js.map +1 -0
- package/lib/esm/unknown.component.metadata.json +1 -0
- package/package.json +19 -21
- package/src/abstract-control.ts +5 -4
- package/src/base.renderer.ts +2 -1
- package/src/index.ts +1 -0
- package/src/jsonforms-root.component.ts +18 -9
- package/src/jsonforms.service.ts +14 -10
- package/tsconfig.cjs.json +9 -0
- package/tsconfig.json +3 -2
- package/lib/abstract-control.js.map +0 -1
- package/lib/abstract-control.metadata.json +0 -1
- package/lib/array-control.js.map +0 -1
- package/lib/base.renderer.js.map +0 -1
- package/lib/base.renderer.metadata.json +0 -1
- package/lib/control.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/jsonforms-angular.js +0 -1511
- package/lib/jsonforms-angular.js.map +0 -1
- package/lib/jsonforms-root.component.js.map +0 -1
- package/lib/jsonforms-root.component.metadata.json +0 -1
- package/lib/jsonforms.component.js.map +0 -1
- package/lib/jsonforms.module.js.map +0 -1
- package/lib/jsonforms.service.js.map +0 -1
- package/lib/unknown.component.js.map +0 -1
- package/webpack.build.js +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"USE_STATE_VALUE":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"Symbol"},"arguments":["Marker to use state value"]},"JsonFormsAngularService":{"__symbolic":"class","members":{"init":[{"__symbolic":"method"}],"registerRenderer":[{"__symbolic":"method"}],"addRenderer":[{"__symbolic":"method"}],"registerRenderers":[{"__symbolic":"method"}],"setRenderers":[{"__symbolic":"method"}],"unregisterRenderer":[{"__symbolic":"method"}],"removeRenderer":[{"__symbolic":"method"}],"updateValidationMode":[{"__symbolic":"method"}],"updateI18n":[{"__symbolic":"method"}],"updateCore":[{"__symbolic":"method"}],"updateUiSchema":[{"__symbolic":"method"}],"setUiSchemas":[{"__symbolic":"method"}],"updateConfig":[{"__symbolic":"method"}],"setUiSchema":[{"__symbolic":"method"}],"setSchema":[{"__symbolic":"method"}],"setData":[{"__symbolic":"method"}],"setLocale":[{"__symbolic":"method"}],"setReadonly":[{"__symbolic":"method"}],"getState":[{"__symbolic":"method"}],"refresh":[{"__symbolic":"method"}],"updateCoreState":[{"__symbolic":"method"}],"updateSubject":[{"__symbolic":"method"}]}}}}]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import { Component } from '@angular/core';
|
|
26
|
+
var UnknownRenderer = /** @class */ (function () {
|
|
27
|
+
function UnknownRenderer() {
|
|
28
|
+
}
|
|
29
|
+
UnknownRenderer.decorators = [
|
|
30
|
+
{ type: Component, args: [{
|
|
31
|
+
selector: 'unknown.renderer',
|
|
32
|
+
template: 'No applicable renderer found!'
|
|
33
|
+
},] }
|
|
34
|
+
];
|
|
35
|
+
return UnknownRenderer;
|
|
36
|
+
}());
|
|
37
|
+
export { UnknownRenderer };
|
|
38
|
+
//# sourceMappingURL=unknown.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unknown.component.js","sourceRoot":"","sources":["../../src/unknown.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C;IAAA;IAI8B,CAAC;;gBAJ9B,SAAS,SAAC;oBACT,QAAQ,EAAE,kBAAkB;oBAC5B,QAAQ,EAAE,+BAA+B;iBAC1C;;IAC6B,sBAAC;CAAA,AAJ/B,IAI+B;SAAlB,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"UnknownRenderer":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":25,"character":1},"arguments":[{"selector":"unknown.renderer","template":"No applicable renderer found!"}]}]}}}]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/angular",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
4
4
|
"description": "Angular module of JSON Forms",
|
|
5
5
|
"repository": "https://github.com/eclipsesource/jsonforms",
|
|
6
6
|
"bugs": "https://github.com/eclipsesource/jsonforms/issues",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"layout",
|
|
30
30
|
"customization"
|
|
31
31
|
],
|
|
32
|
-
"main": "./lib/index.js",
|
|
33
|
-
"
|
|
32
|
+
"main": "./lib/cjs/index.js",
|
|
33
|
+
"esm": "./lib/esm/index.js",
|
|
34
|
+
"typings": "./lib/esm/index.d.ts",
|
|
34
35
|
"scripts": {
|
|
35
|
-
"
|
|
36
|
-
"build": "ngc",
|
|
36
|
+
"build": "ngc && ngc -p tsconfig.cjs.json",
|
|
37
37
|
"clean": "rimraf lib coverage dist .nyc_output 2> /dev/null",
|
|
38
38
|
"lint": "tslint --project tsconfig.json --exclude src/models/jsonSchema.ts",
|
|
39
39
|
"report": "nyc report --reporter=html",
|
|
40
|
-
"test": "ava",
|
|
41
|
-
"test-cov": "nyc ava",
|
|
40
|
+
"test": "cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\"} ava",
|
|
41
|
+
"test-cov": "cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\"} nyc ava",
|
|
42
42
|
"doc": "typedoc --name 'JSON Forms Angular Core' --mode file --out docs src"
|
|
43
43
|
},
|
|
44
44
|
"nyc": {
|
|
@@ -61,27 +61,25 @@
|
|
|
61
61
|
]
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@angular/core": "^
|
|
65
|
-
"@angular/forms": "^
|
|
66
|
-
"@jsonforms/core": "^3.0.0-
|
|
64
|
+
"@angular/core": "^12.0.0",
|
|
65
|
+
"@angular/forms": "^12.0.0",
|
|
66
|
+
"@jsonforms/core": "^3.0.0-beta.0",
|
|
67
67
|
"rxjs": "^6.4.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@angular/compiler": "^
|
|
71
|
-
"@angular/compiler-cli": "^
|
|
72
|
-
"@angular/core": "^
|
|
73
|
-
"@angular/forms": "^
|
|
74
|
-
"@jsonforms/core": "^3.0.0-
|
|
70
|
+
"@angular/compiler": "^12.0.0",
|
|
71
|
+
"@angular/compiler-cli": "^12.0.0",
|
|
72
|
+
"@angular/core": "^12.0.0",
|
|
73
|
+
"@angular/forms": "^12.0.0",
|
|
74
|
+
"@jsonforms/core": "^3.0.0-beta.0",
|
|
75
75
|
"ava": "~2.4.0",
|
|
76
76
|
"copy-webpack-plugin": "^5.0.5",
|
|
77
|
-
"
|
|
77
|
+
"cross-env": "^7.0.2",
|
|
78
|
+
"nyc": "^15.1.0",
|
|
78
79
|
"rimraf": "^3.0.2",
|
|
79
80
|
"rxjs": "^6.4.0",
|
|
80
81
|
"tslint": "^5.20.1",
|
|
81
|
-
"typedoc": "^0.19.2"
|
|
82
|
-
"webpack": "^4.41.2",
|
|
83
|
-
"webpack-cli": "^3.2.1",
|
|
84
|
-
"webpack-dev-server": "^3.9.0"
|
|
82
|
+
"typedoc": "^0.19.2"
|
|
85
83
|
},
|
|
86
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "8540d2f63abe25ee079192bc7d45e7ba4be00eac"
|
|
87
85
|
}
|
package/src/abstract-control.ts
CHANGED
|
@@ -26,13 +26,12 @@ import {
|
|
|
26
26
|
Actions,
|
|
27
27
|
computeLabel,
|
|
28
28
|
ControlElement,
|
|
29
|
-
isPlainLabel,
|
|
30
29
|
JsonFormsState,
|
|
31
30
|
JsonSchema,
|
|
32
31
|
OwnPropsOfControl,
|
|
33
32
|
StatePropsOfControl
|
|
34
33
|
} from '@jsonforms/core';
|
|
35
|
-
import { Input, OnDestroy, OnInit } from '@angular/core';
|
|
34
|
+
import { Component, Input, OnDestroy, OnInit } from '@angular/core';
|
|
36
35
|
import {
|
|
37
36
|
AbstractControl,
|
|
38
37
|
FormControl,
|
|
@@ -44,7 +43,9 @@ import { Subscription } from 'rxjs';
|
|
|
44
43
|
import { JsonFormsBaseRenderer } from './base.renderer';
|
|
45
44
|
import { JsonFormsAngularService } from './jsonforms.service';
|
|
46
45
|
import merge from 'lodash/merge';
|
|
47
|
-
|
|
46
|
+
@Component({
|
|
47
|
+
template: ''
|
|
48
|
+
})
|
|
48
49
|
export abstract class JsonFormsAbstractControl<
|
|
49
50
|
Props extends StatePropsOfControl
|
|
50
51
|
> extends JsonFormsBaseRenderer<ControlElement> implements OnInit, OnDestroy {
|
|
@@ -110,7 +111,7 @@ export abstract class JsonFormsAbstractControl<
|
|
|
110
111
|
config
|
|
111
112
|
} = props;
|
|
112
113
|
this.label = computeLabel(
|
|
113
|
-
|
|
114
|
+
label,
|
|
114
115
|
required,
|
|
115
116
|
config ? config.hideRequiredAsterisk : false
|
|
116
117
|
);
|
package/src/base.renderer.ts
CHANGED
|
@@ -22,13 +22,14 @@
|
|
|
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 { Input } from '@angular/core';
|
|
25
|
+
import { Directive, Input } from '@angular/core';
|
|
26
26
|
import {
|
|
27
27
|
JsonSchema,
|
|
28
28
|
OwnPropsOfRenderer,
|
|
29
29
|
UISchemaElement
|
|
30
30
|
} from '@jsonforms/core';
|
|
31
31
|
|
|
32
|
+
@Directive()
|
|
32
33
|
export class JsonFormsBaseRenderer<T extends UISchemaElement> {
|
|
33
34
|
@Input() uischema: T;
|
|
34
35
|
@Input() schema: JsonSchema;
|
package/src/index.ts
CHANGED
|
@@ -23,11 +23,10 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import {
|
|
26
|
-
Component,
|
|
27
|
-
EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges
|
|
26
|
+
Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges
|
|
28
27
|
} from '@angular/core';
|
|
29
|
-
import { Actions, JsonFormsRendererRegistryEntry, JsonSchema, UISchemaElement, UISchemaTester, ValidationMode } from '@jsonforms/core';
|
|
30
|
-
import
|
|
28
|
+
import { Actions, JsonFormsI18nState, JsonFormsRendererRegistryEntry, JsonSchema, UISchemaElement, UISchemaTester, ValidationMode } from '@jsonforms/core';
|
|
29
|
+
import Ajv, { ErrorObject } from 'ajv';
|
|
31
30
|
import { JsonFormsAngularService, USE_STATE_VALUE } from './jsonforms.service';
|
|
32
31
|
@Component({
|
|
33
32
|
selector: 'jsonforms',
|
|
@@ -42,11 +41,11 @@ export class JsonForms implements OnChanges, OnInit {
|
|
|
42
41
|
@Input() renderers: JsonFormsRendererRegistryEntry[];
|
|
43
42
|
@Input() uischemas: { tester: UISchemaTester; uischema: UISchemaElement; }[];
|
|
44
43
|
@Output() dataChange = new EventEmitter<any>();
|
|
45
|
-
@Input() locale: string;
|
|
46
44
|
@Input() readonly: boolean;
|
|
47
45
|
@Input() validationMode: ValidationMode;
|
|
48
46
|
@Input() ajv: Ajv;
|
|
49
47
|
@Input() config: any;
|
|
48
|
+
@Input() i18n: JsonFormsI18nState;
|
|
50
49
|
@Output() errors = new EventEmitter<ErrorObject[]>();
|
|
51
50
|
|
|
52
51
|
private previousData:any;
|
|
@@ -67,7 +66,7 @@ export class JsonForms implements OnChanges, OnInit {
|
|
|
67
66
|
validationMode: this.validationMode
|
|
68
67
|
},
|
|
69
68
|
uischemas: this.uischemas,
|
|
70
|
-
i18n:
|
|
69
|
+
i18n: this.i18n,
|
|
71
70
|
renderers: this.renderers,
|
|
72
71
|
config: this.config,
|
|
73
72
|
readonly: this.readonly
|
|
@@ -87,6 +86,14 @@ export class JsonForms implements OnChanges, OnInit {
|
|
|
87
86
|
this.initialized = true;
|
|
88
87
|
}
|
|
89
88
|
|
|
89
|
+
ngDoCheck(): void {
|
|
90
|
+
// we can't use ngOnChanges as then nested i18n changes will not be detected
|
|
91
|
+
// the update will result in a no-op when the parameters did not change
|
|
92
|
+
this.jsonformsService.updateI18n(
|
|
93
|
+
Actions.updateI18n(this.i18n?.locale, this.i18n?.translate, this.i18n?.translateError)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
90
97
|
// tslint:disable-next-line: cyclomatic-complexity
|
|
91
98
|
ngOnChanges(changes: SimpleChanges): void {
|
|
92
99
|
if (!this.initialized) {
|
|
@@ -97,7 +104,7 @@ export class JsonForms implements OnChanges, OnInit {
|
|
|
97
104
|
const newUiSchema = changes.uischema;
|
|
98
105
|
const newRenderers = changes.renderers;
|
|
99
106
|
const newUischemas = changes.uischemas;
|
|
100
|
-
const
|
|
107
|
+
const newI18n = changes.i18n;
|
|
101
108
|
const newReadonly = changes.readonly;
|
|
102
109
|
const newValidationMode = changes.validationMode;
|
|
103
110
|
const newAjv = changes.ajv;
|
|
@@ -121,8 +128,10 @@ export class JsonForms implements OnChanges, OnInit {
|
|
|
121
128
|
this.jsonformsService.setUiSchemas(newUischemas.currentValue);
|
|
122
129
|
}
|
|
123
130
|
|
|
124
|
-
if (
|
|
125
|
-
this.jsonformsService.
|
|
131
|
+
if (newI18n && !newI18n.isFirstChange()) {
|
|
132
|
+
this.jsonformsService.updateI18n(
|
|
133
|
+
Actions.updateI18n(newI18n.currentValue?.locale, newI18n.currentValue?.translate, newI18n.currentValue?.translateError)
|
|
134
|
+
);
|
|
126
135
|
}
|
|
127
136
|
|
|
128
137
|
if (newReadonly && !newReadonly.isFirstChange()) {
|
package/src/jsonforms.service.ts
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
JsonFormsState,
|
|
35
35
|
JsonFormsSubStates,
|
|
36
36
|
JsonSchema,
|
|
37
|
-
|
|
37
|
+
I18nActions,
|
|
38
38
|
RankedTester,
|
|
39
39
|
setConfig,
|
|
40
40
|
SetConfigAction,
|
|
@@ -42,13 +42,14 @@ import {
|
|
|
42
42
|
UISchemaElement,
|
|
43
43
|
uischemaRegistryReducer,
|
|
44
44
|
UISchemaTester,
|
|
45
|
-
ValidationMode
|
|
45
|
+
ValidationMode,
|
|
46
|
+
updateI18n
|
|
46
47
|
} from '@jsonforms/core';
|
|
47
48
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
48
49
|
import { JsonFormsBaseRenderer } from './base.renderer';
|
|
49
50
|
|
|
50
51
|
import { cloneDeep } from 'lodash';
|
|
51
|
-
import
|
|
52
|
+
import Ajv from 'ajv';
|
|
52
53
|
|
|
53
54
|
export const USE_STATE_VALUE = Symbol('Marker to use state value');
|
|
54
55
|
export class JsonFormsAngularService {
|
|
@@ -56,9 +57,10 @@ export class JsonFormsAngularService {
|
|
|
56
57
|
private _state: JsonFormsSubStates;
|
|
57
58
|
private state: BehaviorSubject<JsonFormsState>;
|
|
58
59
|
|
|
59
|
-
init(initialState: JsonFormsSubStates = { core: { data: undefined, schema: undefined, uischema: undefined } }) {
|
|
60
|
+
init(initialState: JsonFormsSubStates = { core: { data: undefined, schema: undefined, uischema: undefined, validationMode: 'ValidateAndShow' } }) {
|
|
60
61
|
this._state = initialState;
|
|
61
62
|
this._state.config = configReducer(undefined, setConfig(this._state.config));
|
|
63
|
+
this._state.i18n = i18nReducer(this._state.i18n, updateI18n(this._state.i18n?.locale, this._state.i18n?.translate, this._state.i18n?.translateError));
|
|
62
64
|
this.state = new BehaviorSubject({ jsonforms: this._state });
|
|
63
65
|
const data = initialState.core.data;
|
|
64
66
|
const schema = initialState.core.schema ?? generateJsonSchema(data);
|
|
@@ -117,16 +119,18 @@ export class JsonFormsAngularService {
|
|
|
117
119
|
this.updateSubject();
|
|
118
120
|
}
|
|
119
121
|
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
this._state.i18n
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
updateI18n<T extends I18nActions>(i18nAction: T): T {
|
|
123
|
+
const i18nState = i18nReducer(this._state.i18n, i18nAction);
|
|
124
|
+
if (i18nState !== this._state.i18n) {
|
|
125
|
+
this._state.i18n = i18nState;
|
|
126
|
+
this.updateSubject();
|
|
127
|
+
}
|
|
128
|
+
return i18nAction;
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
updateCore<T extends CoreActions>(coreAction: T): T {
|
|
128
132
|
const coreState = coreReducer(this._state.core, coreAction);
|
|
129
|
-
if(coreState !== this._state.core) {
|
|
133
|
+
if (coreState !== this._state.core) {
|
|
130
134
|
this._state.core = coreState;
|
|
131
135
|
this.updateSubject();
|
|
132
136
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"abstract-control.js","sourceRoot":"","sources":["../src/abstract-control.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,wCASyB;AACzB,sCAAyD;AACzD,wCAKwB;AAGxB,iDAAwD;AAExD,+DAAiC;AAEjC;IAEU,oDAAqC;IAiB7C,kCAAsB,gBAAyC;QAA/D,YACE,iBAAO,SAWR;QAZqB,sBAAgB,GAAhB,gBAAgB,CAAyB;QAc/D,mBAAa,GAAG,UAAC,KAAU,IAAK,OAAA,KAAK,CAAC,KAAK,EAAX,CAAW,CAAC;QAsD5C,eAAS,GAAgB,UAAC,EAAmB;YAC3C,OAAO,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAI,CAAC,KAAK,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IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAES,8CAAW,GAArB;QACE,IAAM,KAAK,GAAsB;YAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,EAAE,EAAE,IAAI,CAAC,EAAE;SACZ,CAAC;QACF,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;YAC/B,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;SAChC;QACD,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC9B,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;SAC9B;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAIS,oDAAiB,GAA3B;QACE,qEAAqE;QACrE,oCAAoC;QACpC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;IACrC,CAAC;IA9HQ;QAAR,YAAK,EAAE;;wDAAY;IACX;QAAR,YAAK,EAAE;;8DAAmB;IAClB;QAAR,YAAK,EAAE;;6DAAkB;IA6H5B,+BAAC;CAAA,AAlID,CAEU,qCAAqB,GAgI9B;AAlIqB,4DAAwB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"JsonFormsAbstractControl":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./base.renderer","name":"JsonFormsBaseRenderer","line":49,"character":10},"arity":1,"members":{"id":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":50,"character":3}}]}],"disabled":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":51,"character":3}}]}],"visible":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":52,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./jsonforms.service","name":"JsonFormsAngularService","line":66,"character":42}]}],"onChange":[{"__symbolic":"method"}],"shouldShowUnfocusedDescription":[{"__symbolic":"method"}],"ngOnInit":[{"__symbolic":"method"}],"mapAdditionalProps":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}],"isEnabled":[{"__symbolic":"method"}],"getOwnProps":[{"__symbolic":"method"}],"mapToProps":[{"__symbolic":"method"}],"triggerValidation":[{"__symbolic":"method"}]}}}}]
|
package/lib/array-control.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"array-control.js","sourceRoot":"","sources":["../src/array-control.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,wCAIyB;AAEzB,uDAA8D;AAE9D;IACU,iDAAkD;IAD5D;;IAOA,CAAC;IAJW,0CAAU,GAApB,UAAqB,KAAqB;QACxC,IAAM,KAAK,GAAG,kCAA2B,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACrE,4BAAY,KAAK,EAAG;IACtB,CAAC;IACH,4BAAC;AAAD,CAAC,AAPD,CACU,2CAAwB,GAMjC;AAPY,sDAAqB"}
|
package/lib/base.renderer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.renderer.js","sourceRoot":"","sources":["../src/base.renderer.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,sCAAsC;AAOtC;IAAA;IAYA,CAAC;IAPW,2CAAW,GAArB;QACE,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;IAVQ;QAAR,YAAK,EAAE;;2DAAa;IACZ;QAAR,YAAK,EAAE;;yDAAoB;IACnB;QAAR,YAAK,EAAE;;uDAAc;IASxB,4BAAC;CAAA,AAZD,IAYC;AAZY,sDAAqB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"JsonFormsBaseRenderer":{"__symbolic":"class","arity":1,"members":{"uischema":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":32,"character":3}}]}],"schema":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"path":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"getOwnProps":[{"__symbolic":"method"}]}}}}]
|
package/lib/control.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"control.js","sourceRoot":"","sources":["../src/control.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,wCAMyB;AAEzB,uDAA8D;AAE9D;IACU,4CAA6C;IADvD;;IAOA,CAAC;IAJW,qCAAU,GAApB,UAAqB,KAAqB;QACxC,IAAM,KAAK,GAAG,6BAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAChE,4BAAY,KAAK,EAAG;IACtB,CAAC;IACH,uBAAC;AAAD,CAAC,AAPD,CACU,2CAAwB,GAMjC;AAPY,4CAAgB;AAS7B;IACU,sDAAuD;IADjE;;IAOA,CAAC;IAJW,+CAAU,GAApB,UAAqB,KAAqB;QACxC,IAAM,KAAK,GAAG,uCAAgC,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC1E,4BAAY,KAAK,EAAG;IACtB,CAAC;IACH,iCAAC;AAAD,CAAC,AAPD,CACU,2CAAwB,GAMjC;AAPY,gEAA0B"}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,0DAAgC;AAChC,oDAA0B;AAC1B,0DAAgC;AAChC,gEAAsC;AACtC,6DAAmC;AACnC,8DAAoC;AACpC,8DAAoC;AACpC,qEAA2C"}
|