@jsonforms/angular 3.0.0-beta.1 → 3.0.0-beta.4
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 +5 -0
- package/docs/assets/js/search.json +1 -1
- package/docs/classes/jsonforms.html +35 -21
- package/docs/classes/jsonformsabstractcontrol.html +30 -30
- package/docs/classes/jsonformsangularservice.html +30 -27
- 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 +6 -0
- package/lib/cjs/jsonforms-root.component.d.ts +1 -0
- package/lib/cjs/jsonforms-root.component.js +6 -3
- package/lib/cjs/jsonforms-root.component.js.map +1 -1
- package/lib/cjs/jsonforms-root.component.metadata.json +1 -1
- package/lib/cjs/jsonforms.component.js +3 -2
- package/lib/cjs/jsonforms.component.js.map +1 -1
- package/lib/cjs/jsonforms.service.d.ts +2 -2
- package/lib/cjs/jsonforms.service.js +4 -3
- package/lib/cjs/jsonforms.service.js.map +1 -1
- package/lib/esm/jsonforms-root.component.d.ts +1 -0
- package/lib/esm/jsonforms-root.component.js +6 -3
- package/lib/esm/jsonforms-root.component.js.map +1 -1
- package/lib/esm/jsonforms-root.component.metadata.json +1 -1
- package/lib/esm/jsonforms.component.js +3 -2
- package/lib/esm/jsonforms.component.js.map +1 -1
- package/lib/esm/jsonforms.service.d.ts +2 -2
- package/lib/esm/jsonforms.service.js +4 -3
- package/lib/esm/jsonforms.service.js.map +1 -1
- package/package.json +4 -4
- package/src/jsonforms-root.component.ts +7 -3
- package/src/jsonforms.component.ts +3 -2
- package/src/jsonforms.service.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/angular",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
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",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@angular/core": "^12.0.0 || ^13.0.0",
|
|
65
65
|
"@angular/forms": "^12.0.0 || ^13.0.0",
|
|
66
|
-
"@jsonforms/core": "
|
|
66
|
+
"@jsonforms/core": "3.0.0-beta.4",
|
|
67
67
|
"rxjs": "^6.4.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@angular/compiler-cli": "^12.0.0",
|
|
72
72
|
"@angular/core": "^12.0.0",
|
|
73
73
|
"@angular/forms": "^12.0.0",
|
|
74
|
-
"@jsonforms/core": "^3.0.0-beta.
|
|
74
|
+
"@jsonforms/core": "^3.0.0-beta.4",
|
|
75
75
|
"ava": "~2.4.0",
|
|
76
76
|
"copy-webpack-plugin": "^5.0.5",
|
|
77
77
|
"cross-env": "^7.0.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"tslint": "^5.20.1",
|
|
82
82
|
"typedoc": "^0.19.2"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "413b9767ea8e2c0b6adb3919f5e6b76263d4be31"
|
|
85
85
|
}
|
|
@@ -46,6 +46,7 @@ export class JsonForms implements OnChanges, OnInit {
|
|
|
46
46
|
@Input() ajv: Ajv;
|
|
47
47
|
@Input() config: any;
|
|
48
48
|
@Input() i18n: JsonFormsI18nState;
|
|
49
|
+
@Input() additionalErrors: ErrorObject[];
|
|
49
50
|
@Output() errors = new EventEmitter<ErrorObject[]>();
|
|
50
51
|
|
|
51
52
|
private previousData:any;
|
|
@@ -64,7 +65,8 @@ export class JsonForms implements OnChanges, OnInit {
|
|
|
64
65
|
uischema: this.uischema,
|
|
65
66
|
schema: this.schema,
|
|
66
67
|
ajv: this.ajv,
|
|
67
|
-
validationMode: this.validationMode
|
|
68
|
+
validationMode: this.validationMode,
|
|
69
|
+
additionalErrors: this.additionalErrors
|
|
68
70
|
},
|
|
69
71
|
uischemas: this.uischemas,
|
|
70
72
|
i18n: this.i18n,
|
|
@@ -128,14 +130,16 @@ export class JsonForms implements OnChanges, OnInit {
|
|
|
128
130
|
const newValidationMode = changes.validationMode;
|
|
129
131
|
const newAjv = changes.ajv;
|
|
130
132
|
const newConfig = changes.config;
|
|
133
|
+
const newAdditionalErrors = changes.additionalErrors;
|
|
131
134
|
|
|
132
|
-
if (newData || newSchema || newUiSchema || newValidationMode || newAjv) {
|
|
135
|
+
if (newData || newSchema || newUiSchema || newValidationMode || newAjv || newAdditionalErrors) {
|
|
133
136
|
this.jsonformsService.updateCoreState(
|
|
134
137
|
newData ? newData.currentValue : USE_STATE_VALUE,
|
|
135
138
|
newSchema ? newSchema.currentValue : USE_STATE_VALUE,
|
|
136
139
|
newUiSchema ? newUiSchema.currentValue : USE_STATE_VALUE,
|
|
137
140
|
newAjv ? newAjv.currentValue : USE_STATE_VALUE,
|
|
138
|
-
newValidationMode ? newValidationMode.currentValue : USE_STATE_VALUE
|
|
141
|
+
newValidationMode ? newValidationMode.currentValue : USE_STATE_VALUE,
|
|
142
|
+
newAdditionalErrors ? newAdditionalErrors.currentValue : USE_STATE_VALUE
|
|
139
143
|
);
|
|
140
144
|
}
|
|
141
145
|
|
|
@@ -104,10 +104,11 @@ export class JsonFormsOutlet extends JsonFormsBaseRenderer<UISchemaElement>
|
|
|
104
104
|
const { renderers } = props as JsonFormsProps;
|
|
105
105
|
const schema: JsonSchema = this.schema || props.schema;
|
|
106
106
|
const uischema = this.uischema || props.uischema;
|
|
107
|
+
const rootSchema = props.rootSchema;
|
|
107
108
|
|
|
108
|
-
const renderer = maxBy(renderers, r => r.tester(uischema, schema));
|
|
109
|
+
const renderer = maxBy(renderers, r => r.tester(uischema, schema, rootSchema));
|
|
109
110
|
let bestComponent: Type<any> = UnknownRenderer;
|
|
110
|
-
if (renderer !== undefined && renderer.tester(uischema, schema) !== -1) {
|
|
111
|
+
if (renderer !== undefined && renderer.tester(uischema, schema, rootSchema) !== -1) {
|
|
111
112
|
bestComponent = renderer.renderer;
|
|
112
113
|
}
|
|
113
114
|
|
package/src/jsonforms.service.ts
CHANGED
|
@@ -49,7 +49,7 @@ import { BehaviorSubject, Observable } from 'rxjs';
|
|
|
49
49
|
import { JsonFormsBaseRenderer } from './base.renderer';
|
|
50
50
|
|
|
51
51
|
import { cloneDeep } from 'lodash';
|
|
52
|
-
import Ajv from 'ajv';
|
|
52
|
+
import Ajv, { ErrorObject } from 'ajv';
|
|
53
53
|
|
|
54
54
|
export const USE_STATE_VALUE = Symbol('Marker to use state value');
|
|
55
55
|
export class JsonFormsAngularService {
|
|
@@ -57,7 +57,7 @@ export class JsonFormsAngularService {
|
|
|
57
57
|
private _state: JsonFormsSubStates;
|
|
58
58
|
private state: BehaviorSubject<JsonFormsState>;
|
|
59
59
|
|
|
60
|
-
init(initialState: JsonFormsSubStates = { core: { data: undefined, schema: undefined, uischema: undefined, validationMode: 'ValidateAndShow' } }) {
|
|
60
|
+
init(initialState: JsonFormsSubStates = { core: { data: undefined, schema: undefined, uischema: undefined, validationMode: 'ValidateAndShow', additionalErrors: undefined } }) {
|
|
61
61
|
this._state = initialState;
|
|
62
62
|
this._state.config = configReducer(undefined, setConfig(this._state.config));
|
|
63
63
|
this._state.i18n = i18nReducer(this._state.i18n, updateI18n(this._state.i18n?.locale, this._state.i18n?.translate, this._state.i18n?.translateError));
|
|
@@ -209,15 +209,17 @@ export class JsonFormsAngularService {
|
|
|
209
209
|
schema: JsonSchema | typeof USE_STATE_VALUE,
|
|
210
210
|
uischema: UISchemaElement | typeof USE_STATE_VALUE,
|
|
211
211
|
ajv: Ajv | typeof USE_STATE_VALUE,
|
|
212
|
-
validationMode: ValidationMode | typeof USE_STATE_VALUE
|
|
212
|
+
validationMode: ValidationMode | typeof USE_STATE_VALUE,
|
|
213
|
+
additionalErrors: ErrorObject[] | typeof USE_STATE_VALUE,
|
|
213
214
|
): void {
|
|
214
215
|
const newData = data === USE_STATE_VALUE ? this._state.core.data : data;
|
|
215
216
|
const newSchema = schema === USE_STATE_VALUE ? this._state.core.schema : schema ?? generateJsonSchema(newData);
|
|
216
217
|
const newUischema = uischema === USE_STATE_VALUE ? this._state.core.uischema : uischema ?? generateDefaultUISchema(newSchema);
|
|
217
218
|
const newAjv = ajv === USE_STATE_VALUE ? this._state.core.ajv : ajv;
|
|
218
219
|
const newValidationMode = validationMode === USE_STATE_VALUE ? this._state.core.validationMode : validationMode;
|
|
220
|
+
const newAdditionalErrors = additionalErrors === USE_STATE_VALUE ? this._state.core.additionalErrors : additionalErrors;
|
|
219
221
|
this.updateCore(
|
|
220
|
-
Actions.updateCore(newData, newSchema, newUischema, {ajv: newAjv, validationMode: newValidationMode})
|
|
222
|
+
Actions.updateCore(newData, newSchema, newUischema, {ajv: newAjv, validationMode: newValidationMode, additionalErrors: newAdditionalErrors})
|
|
221
223
|
);
|
|
222
224
|
}
|
|
223
225
|
|