UNPKG

@jsonforms/angular

Version:

Angular module of JSON Forms

1 lines 59.5 kB
{"version":3,"file":"jsonforms-angular.mjs","sources":["../../src/library/base.renderer.ts","../../src/library/jsonforms.service.ts","../../src/library/abstract-control.ts","../../src/library/control.ts","../../src/library/array-control.ts","../../src/library/unknown.component.ts","../../src/library/jsonforms.component.ts","../../src/library/jsonforms-root.component.ts","../../src/library/jsonforms.module.ts","../../src/library/index.ts","../../src/jsonforms-angular.ts"],"sourcesContent":["/*\n The MIT License\n \n Copyright (c) 2017-2019 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport { Directive, Input, OnDestroy } from '@angular/core';\nimport {\n JsonSchema,\n OwnPropsOfRenderer,\n UISchemaElement,\n} from '@jsonforms/core';\nimport { Subscription } from 'rxjs';\n\n@Directive()\nexport class JsonFormsBaseRenderer<T extends UISchemaElement>\n implements OnDestroy\n{\n @Input() uischema: T;\n @Input() schema: JsonSchema;\n @Input() path: string;\n protected subscriptions: Subscription = new Subscription();\n\n protected addSubscription(subscription: Subscription | Subscription[]) {\n if (Array.isArray(subscription)) {\n subscription.forEach((sub) => this.subscriptions.add(sub));\n } else {\n this.subscriptions.add(subscription);\n }\n }\n\n protected getOwnProps(): OwnPropsOfRenderer {\n return {\n uischema: this.uischema,\n schema: this.schema,\n path: this.path,\n };\n }\n\n ngOnDestroy(): void {\n this.subscriptions.unsubscribe();\n }\n}\n","/*\n The MIT License\n \n Copyright (c) 2017-2020 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport {\n Actions,\n configReducer,\n CoreActions,\n coreReducer,\n generateDefaultUISchema,\n generateJsonSchema,\n i18nReducer,\n JsonFormsRendererRegistryEntry,\n JsonFormsState,\n JsonFormsSubStates,\n JsonSchema,\n I18nActions,\n RankedTester,\n setConfig,\n SetConfigAction,\n UISchemaActions,\n UISchemaElement,\n uischemaRegistryReducer,\n UISchemaTester,\n ValidationMode,\n updateI18n,\n Middleware,\n defaultMiddleware,\n} from '@jsonforms/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport type { JsonFormsBaseRenderer } from './base.renderer';\n\nimport cloneDeep from 'lodash/cloneDeep';\nimport type Ajv from 'ajv';\nimport type { ErrorObject } from 'ajv';\n\nexport const USE_STATE_VALUE = Symbol('Marker to use state value');\nexport class JsonFormsAngularService {\n private _state: JsonFormsSubStates;\n private state: BehaviorSubject<JsonFormsState>;\n private middleware: Middleware;\n\n init(\n initialState: JsonFormsSubStates = {\n core: {\n data: undefined,\n schema: undefined,\n uischema: undefined,\n validationMode: 'ValidateAndShow',\n additionalErrors: undefined,\n },\n },\n middleware: Middleware = defaultMiddleware\n ) {\n this.middleware = middleware;\n this._state = initialState;\n this._state.config = configReducer(\n undefined,\n setConfig(this._state.config)\n );\n this._state.i18n = i18nReducer(\n this._state.i18n,\n updateI18n(\n this._state.i18n?.locale,\n this._state.i18n?.translate,\n this._state.i18n?.translateError\n )\n );\n this.state = new BehaviorSubject({ jsonforms: this._state });\n const data = initialState.core.data;\n const schema = initialState.core.schema ?? generateJsonSchema(data);\n const uischema =\n initialState.core.uischema ?? generateDefaultUISchema(schema);\n this.updateCore(Actions.init(data, schema, uischema));\n }\n\n get $state(): Observable<JsonFormsState> {\n if (!this.state) {\n throw new Error('Please call init first!');\n }\n return this.state.asObservable();\n }\n\n /**\n * @deprecated use {@link JsonFormsAngularService.addRenderer}\n */\n registerRenderer(\n renderer: JsonFormsBaseRenderer<UISchemaElement>,\n tester: RankedTester\n ): void {\n this.addRenderer(renderer, tester);\n }\n addRenderer(\n renderer: JsonFormsBaseRenderer<UISchemaElement>,\n tester: RankedTester\n ): void {\n this._state.renderers.push({ renderer, tester });\n this.updateSubject();\n }\n\n /**\n * @deprecated use {@link JsonFormsAngularService.setRenderer}\n */\n registerRenderers(renderers: JsonFormsRendererRegistryEntry[]): void {\n this.setRenderers(renderers);\n }\n setRenderers(renderers: JsonFormsRendererRegistryEntry[]): void {\n this._state.renderers = renderers;\n this.updateSubject();\n }\n\n /**\n * @deprecated use {@link JsonFormsAngularService.removeRenderer}\n */\n unregisterRenderer(tester: RankedTester): void {\n this.removeRenderer(tester);\n }\n removeRenderer(tester: RankedTester): void {\n const findIndex = this._state.renderers.findIndex(\n (v) => v.tester === tester\n );\n if (findIndex === -1) {\n return;\n }\n const renderers = this._state.renderers.filter((v) => v.tester !== tester);\n this._state.renderers = renderers;\n this.updateSubject();\n }\n\n updateValidationMode(validationMode: ValidationMode): void {\n const coreState = this.middleware(\n this._state.core,\n Actions.setValidationMode(validationMode),\n coreReducer\n );\n this._state.core = coreState;\n this.updateSubject();\n }\n\n updateI18n<T extends I18nActions>(i18nAction: T): T {\n const i18nState = i18nReducer(this._state.i18n, i18nAction);\n if (i18nState !== this._state.i18n) {\n this._state.i18n = i18nState;\n this.updateSubject();\n }\n return i18nAction;\n }\n\n updateCore<T extends CoreActions>(coreAction: T): T {\n const coreState = this.middleware(\n this._state.core,\n coreAction,\n coreReducer\n );\n if (coreState !== this._state.core) {\n this._state.core = coreState;\n this.updateSubject();\n }\n return coreAction;\n }\n\n /**\n * @deprecated use {@link JsonFormsAngularService.setUiSchemas}\n */\n updateUiSchema<T extends UISchemaActions>(uischemaAction: T): T {\n const uischemaState = uischemaRegistryReducer(\n this._state.uischemas,\n uischemaAction\n );\n this._state.uischemas = uischemaState;\n this.updateSubject();\n return uischemaAction;\n }\n\n setUiSchemas(\n uischemas: { tester: UISchemaTester; uischema: UISchemaElement }[]\n ): void {\n this._state.uischemas = uischemas;\n this.updateSubject();\n }\n\n updateConfig<T extends SetConfigAction>(setConfigAction: T): T {\n const configState = configReducer(this._state.config, setConfigAction);\n this._state.config = configState;\n this.updateSubject();\n return setConfigAction;\n }\n\n setUiSchema(uischema: UISchemaElement | undefined): void {\n const newUiSchema =\n uischema ?? generateDefaultUISchema(this._state.core.schema);\n const coreState = this.middleware(\n this._state.core,\n Actions.updateCore(\n this._state.core.data,\n this._state.core.schema,\n newUiSchema\n ),\n coreReducer\n );\n if (coreState !== this._state.core) {\n this._state.core = coreState;\n this.updateSubject();\n }\n }\n\n setSchema(schema: JsonSchema | undefined): void {\n const coreState = this.middleware(\n this._state.core,\n Actions.updateCore(\n this._state.core.data,\n schema ?? generateJsonSchema(this._state.core.data),\n this._state.core.uischema\n ),\n coreReducer\n );\n if (coreState !== this._state.core) {\n this._state.core = coreState;\n this.updateSubject();\n }\n }\n\n setData(data: any): void {\n const coreState = this.middleware(\n this._state.core,\n Actions.updateCore(\n data,\n this._state.core.schema,\n this._state.core.uischema\n ),\n coreReducer\n );\n if (coreState !== this._state.core) {\n this._state.core = coreState;\n this.updateSubject();\n }\n }\n\n getLocale(): string | undefined {\n return this._state.i18n?.locale;\n }\n\n setLocale(locale: string): void {\n this._state.i18n.locale = locale;\n this.updateSubject();\n }\n\n setReadonly(readonly: boolean): void {\n this._state.readonly = readonly;\n this.updateSubject();\n }\n\n setMiddleware(middleware: Middleware): void {\n this._state.middleware = middleware;\n this.updateSubject();\n }\n\n getState(): JsonFormsState {\n return cloneDeep({ jsonforms: this._state });\n }\n\n getConfig(): any {\n return cloneDeep(this._state.config);\n }\n\n refresh(): void {\n this.updateSubject();\n }\n\n updateCoreState(\n data: any | typeof USE_STATE_VALUE,\n schema: JsonSchema | typeof USE_STATE_VALUE,\n uischema: UISchemaElement | typeof USE_STATE_VALUE,\n ajv: Ajv | typeof USE_STATE_VALUE,\n validationMode: ValidationMode | typeof USE_STATE_VALUE,\n additionalErrors: ErrorObject[] | typeof USE_STATE_VALUE\n ): void {\n const newData = data === USE_STATE_VALUE ? this._state.core.data : data;\n const newSchema =\n schema === USE_STATE_VALUE\n ? this._state.core.schema\n : schema ?? generateJsonSchema(newData);\n const newUischema =\n uischema === USE_STATE_VALUE\n ? this._state.core.uischema\n : uischema ?? generateDefaultUISchema(newSchema);\n const newAjv = ajv === USE_STATE_VALUE ? this._state.core.ajv : ajv;\n const newValidationMode =\n validationMode === USE_STATE_VALUE\n ? this._state.core.validationMode\n : validationMode;\n const newAdditionalErrors =\n additionalErrors === USE_STATE_VALUE\n ? this._state.core.additionalErrors\n : additionalErrors;\n this.updateCore(\n Actions.updateCore(newData, newSchema, newUischema, {\n ajv: newAjv,\n validationMode: newValidationMode,\n additionalErrors: newAdditionalErrors,\n })\n );\n }\n\n private updateSubject(): void {\n this.state.next({ jsonforms: this._state });\n }\n}\n","/*\n The MIT License\n\n Copyright (c) 2017-2019 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport {\n Actions,\n computeLabel,\n ControlElement,\n JsonFormsState,\n JsonSchema,\n OwnPropsOfControl,\n removeId,\n StatePropsOfControl,\n} from '@jsonforms/core';\nimport { Component, Input, OnDestroy, OnInit } from '@angular/core';\nimport {\n AbstractControl,\n FormControl,\n ValidationErrors,\n ValidatorFn,\n} from '@angular/forms';\n\nimport { JsonFormsBaseRenderer } from './base.renderer';\nimport { JsonFormsAngularService } from './jsonforms.service';\nimport merge from 'lodash/merge';\n@Component({\n template: '',\n})\nexport abstract class JsonFormsAbstractControl<\n Props extends StatePropsOfControl\n >\n extends JsonFormsBaseRenderer<ControlElement>\n implements OnInit, OnDestroy\n{\n @Input() id: string;\n @Input() disabled: boolean;\n @Input() visible: boolean;\n\n form: FormControl;\n data: any;\n label: string;\n description: string;\n error: string | null;\n scopedSchema: JsonSchema;\n rootSchema: JsonSchema;\n enabled: boolean;\n hidden: boolean;\n propsPath: string;\n\n constructor(protected jsonFormsService: JsonFormsAngularService) {\n super();\n this.form = new FormControl(\n {\n value: '',\n disabled: true,\n },\n {\n updateOn: 'change',\n validators: this.validator.bind(this),\n }\n );\n }\n\n getEventValue = (event: any) => event.value;\n\n onChange(ev: any) {\n this.jsonFormsService.updateCore(\n Actions.update(this.propsPath, () => this.getEventValue(ev))\n );\n this.triggerValidation();\n }\n\n shouldShowUnfocusedDescription(): boolean {\n const config = this.jsonFormsService.getConfig();\n const appliedUiSchemaOptions = merge({}, config, this.uischema.options);\n return !!appliedUiSchemaOptions.showUnfocusedDescription;\n }\n\n ngOnInit() {\n this.addSubscription(\n this.jsonFormsService.$state.subscribe({\n next: (state: JsonFormsState) => {\n const props = this.mapToProps(state);\n const {\n data,\n enabled,\n errors,\n label,\n required,\n schema,\n rootSchema,\n visible,\n path,\n config,\n } = props;\n this.label = computeLabel(\n label,\n required,\n config ? config.hideRequiredAsterisk : false\n );\n this.data = data;\n this.error = errors;\n this.enabled = enabled;\n this.isEnabled() ? this.form.enable() : this.form.disable();\n this.hidden = !visible;\n this.scopedSchema = schema;\n this.rootSchema = rootSchema;\n this.description = props.description ?? '';\n this.id = props.id;\n this.form.setValue(data);\n this.propsPath = path;\n this.mapAdditionalProps(props);\n },\n })\n );\n this.triggerValidation();\n }\n\n validator: ValidatorFn = (_c: AbstractControl): ValidationErrors | null => {\n return this.error ? { error: this.error } : null;\n };\n\n mapAdditionalProps(_props: Props) {\n // do nothing by default\n }\n\n ngOnDestroy() {\n super.ngOnDestroy();\n removeId(this.id);\n }\n\n isEnabled(): boolean {\n return this.enabled;\n }\n\n protected getOwnProps(): OwnPropsOfControl {\n const props: OwnPropsOfControl = {\n uischema: this.uischema,\n schema: this.schema,\n path: this.path,\n id: this.id,\n };\n if (this.disabled !== undefined) {\n props.enabled = !this.disabled;\n }\n if (this.visible !== undefined) {\n props.visible = this.visible;\n }\n return props;\n }\n\n protected abstract mapToProps(state: JsonFormsState): Props;\n\n protected triggerValidation() {\n // these cause the correct update of the error underline, seems to be\n // related to ionic-team/ionic#11640\n this.form.markAsTouched();\n this.form.updateValueAndValidity();\n }\n}\n","/*\n The MIT License\n\n Copyright (c) 2017-2019 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport {\n JsonFormsState,\n mapStateToControlProps,\n mapStateToControlWithDetailProps,\n StatePropsOfControl,\n StatePropsOfControlWithDetail,\n} from '@jsonforms/core';\nimport type { OnDestroy, OnInit } from '@angular/core';\nimport { JsonFormsAbstractControl } from './abstract-control';\n\nexport class JsonFormsControl\n extends JsonFormsAbstractControl<StatePropsOfControl>\n implements OnInit, OnDestroy\n{\n protected mapToProps(state: JsonFormsState): StatePropsOfControl {\n const props = mapStateToControlProps(state, this.getOwnProps());\n return { ...props };\n }\n}\n\nexport class JsonFormsControlWithDetail\n extends JsonFormsAbstractControl<StatePropsOfControlWithDetail>\n implements OnInit, OnDestroy\n{\n protected mapToProps(state: JsonFormsState): StatePropsOfControlWithDetail {\n const props = mapStateToControlWithDetailProps(state, this.getOwnProps());\n return { ...props };\n }\n}\n","/*\n The MIT License\n\n Copyright (c) 2017-2019 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport {\n arrayDefaultTranslations,\n ArrayTranslations,\n defaultJsonFormsI18nState,\n getArrayTranslations,\n JsonFormsState,\n mapStateToArrayControlProps,\n StatePropsOfArrayControl,\n} from '@jsonforms/core';\nimport type { OnDestroy, OnInit } from '@angular/core';\nimport { JsonFormsAbstractControl } from './abstract-control';\n\nexport class JsonFormsArrayControl\n extends JsonFormsAbstractControl<StatePropsOfArrayControl>\n implements OnInit, OnDestroy\n{\n protected mapToProps(\n state: JsonFormsState\n ): StatePropsOfArrayControl & { translations: ArrayTranslations } {\n const props = mapStateToArrayControlProps(state, this.getOwnProps());\n const t =\n state.jsonforms.i18n?.translate ?? defaultJsonFormsI18nState.translate;\n const translations = getArrayTranslations(\n t,\n arrayDefaultTranslations,\n props.i18nKeyPrefix,\n props.label\n );\n return { ...props, translations };\n }\n}\n","/*\n The MIT License\n \n Copyright (c) 2017-2019 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport { Component } from '@angular/core';\n@Component({\n selector: 'unknown.renderer',\n template: 'No applicable renderer found!',\n})\nexport class UnknownRenderer {}\n","/*\n The MIT License\n\n Copyright (c) 2017-2019 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport maxBy from 'lodash/maxBy';\nimport {\n ComponentFactoryResolver,\n Directive,\n Input,\n OnInit,\n Type,\n ViewContainerRef,\n} from '@angular/core';\nimport {\n createId,\n isControl,\n getConfig,\n JsonFormsProps,\n JsonFormsState,\n JsonSchema,\n mapStateToJsonFormsRendererProps,\n OwnPropsOfRenderer,\n StatePropsOfJsonFormsRenderer,\n UISchemaElement,\n} from '@jsonforms/core';\nimport { UnknownRenderer } from './unknown.component';\nimport { JsonFormsBaseRenderer } from './base.renderer';\nimport { JsonFormsControl } from './control';\nimport { JsonFormsAngularService } from './jsonforms.service';\n\nimport isEqual from 'lodash/isEqual';\nimport get from 'lodash/get';\n\nconst areEqual = (\n prevProps: StatePropsOfJsonFormsRenderer,\n nextProps: StatePropsOfJsonFormsRenderer\n) => {\n return (\n get(prevProps, 'renderers.length') === get(nextProps, 'renderers.length') &&\n get(prevProps, 'cells.length') === get(nextProps, 'cells.length') &&\n get(prevProps, 'uischemas.length') === get(nextProps, 'uischemas.length') &&\n get(prevProps, 'schema') === get(nextProps, 'schema') &&\n isEqual(get(prevProps, 'uischema'), get(nextProps, 'uischema')) &&\n get(prevProps, 'path') === get(nextProps, 'path')\n );\n};\n\n@Directive({\n selector: 'jsonforms-outlet',\n})\nexport class JsonFormsOutlet\n extends JsonFormsBaseRenderer<UISchemaElement>\n implements OnInit\n{\n private previousProps: StatePropsOfJsonFormsRenderer;\n\n constructor(\n private viewContainerRef: ViewContainerRef,\n private componentFactoryResolver: ComponentFactoryResolver,\n private jsonformsService: JsonFormsAngularService\n ) {\n super();\n }\n\n @Input()\n set renderProps(renderProps: OwnPropsOfRenderer) {\n this.path = renderProps.path;\n this.schema = renderProps.schema;\n this.uischema = renderProps.uischema;\n this.update(this.jsonformsService.getState());\n }\n\n ngOnInit(): void {\n this.addSubscription(\n this.jsonformsService.$state.subscribe({\n next: (state: JsonFormsState) => this.update(state),\n })\n );\n }\n\n update(state: JsonFormsState) {\n const props = mapStateToJsonFormsRendererProps(state, {\n schema: this.schema,\n uischema: this.uischema,\n path: this.path,\n });\n if (areEqual(this.previousProps, props)) {\n return;\n } else {\n this.previousProps = props;\n }\n const { renderers } = props as JsonFormsProps;\n const schema: JsonSchema = this.schema || props.schema;\n const uischema = this.uischema || props.uischema;\n const testerContext = {\n rootSchema: props.rootSchema,\n config: getConfig(state),\n };\n\n const renderer = maxBy(renderers, (r) =>\n r.tester(uischema, schema, testerContext)\n );\n let bestComponent: Type<any> = UnknownRenderer;\n if (\n renderer !== undefined &&\n renderer.tester(uischema, schema, testerContext) !== -1\n ) {\n bestComponent = renderer.renderer;\n }\n\n const componentFactory =\n this.componentFactoryResolver.resolveComponentFactory(bestComponent);\n this.viewContainerRef.clear();\n const currentComponentRef =\n this.viewContainerRef.createComponent(componentFactory);\n\n if (currentComponentRef.instance instanceof JsonFormsBaseRenderer) {\n const instance =\n currentComponentRef.instance as JsonFormsBaseRenderer<UISchemaElement>;\n instance.uischema = uischema;\n instance.schema = schema;\n instance.path = this.path;\n if (instance instanceof JsonFormsControl) {\n const controlInstance = instance as JsonFormsControl;\n if (controlInstance.id === undefined) {\n const id = isControl(props.uischema)\n ? createId(props.uischema.scope)\n : undefined;\n (instance as JsonFormsControl).id = id;\n }\n }\n }\n }\n}\n","/*\n The MIT License\n\n Copyright (c) 2017-2020 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport {\n Component,\n DoCheck,\n EventEmitter,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n SimpleChanges,\n} from '@angular/core';\nimport {\n Actions,\n JsonFormsI18nState,\n JsonFormsRendererRegistryEntry,\n JsonSchema,\n Middleware,\n UISchemaElement,\n UISchemaTester,\n ValidationMode,\n defaultMiddleware,\n} from '@jsonforms/core';\nimport type Ajv from 'ajv';\nimport type { ErrorObject } from 'ajv';\nimport { JsonFormsAngularService, USE_STATE_VALUE } from './jsonforms.service';\nimport { Subscription } from 'rxjs';\nimport { JsonFormsOutlet } from './jsonforms.component';\n\n// TODO Can this be rewritten to not use DoCheck and OnChanges?\n/* eslint-disable @angular-eslint/no-conflicting-lifecycle */\n@Component({\n selector: 'jsonforms',\n template: '<jsonforms-outlet></jsonforms-outlet>',\n providers: [JsonFormsAngularService],\n imports: [JsonFormsOutlet],\n})\nexport class JsonForms implements DoCheck, OnChanges, OnInit, OnDestroy {\n @Input() uischema: UISchemaElement;\n @Input() schema: JsonSchema;\n @Input() data: any;\n @Input() renderers: JsonFormsRendererRegistryEntry[];\n @Input() uischemas: { tester: UISchemaTester; uischema: UISchemaElement }[];\n @Output() dataChange = new EventEmitter<any>();\n @Input() readonly: boolean;\n @Input() validationMode: ValidationMode;\n @Input() ajv: Ajv;\n @Input() config: any;\n @Input() i18n: JsonFormsI18nState;\n @Input() additionalErrors: ErrorObject[];\n @Input() middleware: Middleware = defaultMiddleware;\n @Output() errors = new EventEmitter<ErrorObject[]>();\n\n private previousData: any;\n private previousErrors: ErrorObject[];\n subscription: Subscription;\n\n private initialized = false;\n oldI18N: JsonFormsI18nState;\n\n constructor(private jsonformsService: JsonFormsAngularService) {}\n\n ngOnInit(): void {\n this.jsonformsService.init(\n {\n core: {\n data: this.data,\n uischema: this.uischema,\n schema: this.schema,\n ajv: this.ajv,\n validationMode: this.validationMode,\n additionalErrors: this.additionalErrors,\n },\n uischemas: this.uischemas,\n i18n: this.i18n,\n renderers: this.renderers,\n config: this.config,\n readonly: this.readonly,\n },\n this.middleware\n );\n this.subscription = this.jsonformsService.$state.subscribe((state) => {\n const data = state?.jsonforms?.core?.data;\n const errors = state?.jsonforms?.core?.errors;\n if (this.previousData !== data) {\n this.previousData = data;\n this.dataChange.emit(data);\n }\n if (this.previousErrors !== errors) {\n this.previousErrors = errors;\n this.errors.emit(errors);\n }\n });\n this.oldI18N = this.i18n;\n this.initialized = true;\n }\n\n ngDoCheck(): void {\n // we can't use ngOnChanges as then nested i18n changes will not be detected\n // the update will result in a no-op when the parameters did not change\n if (\n this.oldI18N?.locale !== this.i18n?.locale ||\n this.oldI18N?.translate !== this.i18n?.translate ||\n this.oldI18N?.translateError !== this.i18n?.translateError\n ) {\n this.jsonformsService.updateI18n(\n Actions.updateI18n(\n this.oldI18N?.locale === this.i18n?.locale\n ? this.jsonformsService.getState().jsonforms.i18n.locale\n : this.i18n?.locale,\n this.oldI18N?.translate === this.i18n?.translate\n ? this.jsonformsService.getState().jsonforms.i18n.translate\n : this.i18n?.translate,\n this.oldI18N?.translateError === this.i18n?.translateError\n ? this.jsonformsService.getState().jsonforms.i18n.translateError\n : this.i18n?.translateError\n )\n );\n this.oldI18N = this.i18n;\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.initialized) {\n return;\n }\n const newData = changes.data;\n const newSchema = changes.schema;\n const newUiSchema = changes.uischema;\n const newRenderers = changes.renderers;\n const newUischemas = changes.uischemas;\n const newI18n = changes.i18n;\n const newReadonly = changes.readonly;\n const newValidationMode = changes.validationMode;\n const newAjv = changes.ajv;\n const newConfig = changes.config;\n const newAdditionalErrors = changes.additionalErrors;\n\n if (\n newData ||\n newSchema ||\n newUiSchema ||\n newValidationMode ||\n newAjv ||\n newAdditionalErrors\n ) {\n this.jsonformsService.updateCoreState(\n newData ? newData.currentValue : USE_STATE_VALUE,\n newSchema ? newSchema.currentValue : USE_STATE_VALUE,\n newUiSchema ? newUiSchema.currentValue : USE_STATE_VALUE,\n newAjv ? newAjv.currentValue : USE_STATE_VALUE,\n newValidationMode ? newValidationMode.currentValue : USE_STATE_VALUE,\n newAdditionalErrors ? newAdditionalErrors.currentValue : USE_STATE_VALUE\n );\n }\n\n if (newRenderers && !newRenderers.isFirstChange()) {\n this.jsonformsService.setRenderers(newRenderers.currentValue);\n }\n\n if (newUischemas && !newUischemas.isFirstChange()) {\n this.jsonformsService.setUiSchemas(newUischemas.currentValue);\n }\n\n if (newI18n && !newI18n.isFirstChange()) {\n this.jsonformsService.updateI18n(\n Actions.updateI18n(\n newI18n.currentValue?.locale,\n newI18n.currentValue?.translate,\n newI18n.currentValue?.translateError\n )\n );\n }\n\n if (newReadonly && !newReadonly.isFirstChange()) {\n this.jsonformsService.setReadonly(newReadonly.currentValue);\n }\n\n if (newConfig && !newConfig.isFirstChange()) {\n this.jsonformsService.updateConfig(\n Actions.setConfig(newConfig.currentValue)\n );\n }\n }\n\n ngOnDestroy(): void {\n this.subscription.unsubscribe();\n }\n}\n","/*\n The MIT License\n \n Copyright (c) 2017-2020 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nimport { NgModule } from '@angular/core';\n\nimport { JsonForms } from './jsonforms-root.component';\nimport { JsonFormsOutlet } from './jsonforms.component';\nimport { UnknownRenderer } from './unknown.component';\n@NgModule({\n imports: [JsonFormsOutlet, UnknownRenderer, JsonForms],\n exports: [JsonFormsOutlet, JsonForms],\n})\nexport class JsonFormsModule {}\n","/*\n The MIT License\n \n Copyright (c) 2017-2020 EclipseSource Munich\n https://github.com/eclipsesource/jsonforms\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\nexport * from './base.renderer';\nexport * from './control';\nexport * from './array-control';\nexport * from './jsonforms.component';\nexport * from './jsonforms.module';\nexport * from './unknown.component';\nexport * from './jsonforms.service';\nexport * from './jsonforms-root.component';\nexport * from './abstract-control';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1.JsonFormsAngularService"],"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;AAuBE;MAUW,qBAAqB,CAAA;AAGvB,IAAA,QAAQ;AACR,IAAA,MAAM;AACN,IAAA,IAAI;AACH,IAAA,aAAa,GAAiB,IAAI,YAAY,EAAE;AAEhD,IAAA,eAAe,CAAC,YAA2C,EAAA;AACnE,QAAA,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AAC/B,YAAA,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5D;aAAO;AACL,YAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC;QACtC;IACF;IAEU,WAAW,GAAA;QACnB,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,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