@jsonforms/angular 3.0.0-beta.2 → 3.0.0-beta.5

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.
@@ -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