@jsonforms/angular 3.0.0-alpha.3 → 3.0.0-beta.2

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.
Files changed (108) hide show
  1. package/docs/assets/js/search.json +1 -1
  2. package/docs/classes/jsonforms.html +34 -20
  3. package/docs/classes/jsonformsabstractcontrol.html +30 -30
  4. package/docs/classes/jsonformsangularservice.html +25 -25
  5. package/docs/classes/jsonformsarraycontrol.html +30 -30
  6. package/docs/classes/jsonformsbaserenderer.html +4 -4
  7. package/docs/classes/jsonformscontrol.html +30 -30
  8. package/docs/classes/jsonformscontrolwithdetail.html +30 -30
  9. package/docs/classes/jsonformsoutlet.html +14 -14
  10. package/docs/globals.html +2 -2
  11. package/lib/{abstract-control.d.ts → cjs/abstract-control.d.ts} +0 -0
  12. package/lib/{abstract-control.js → cjs/abstract-control.js} +0 -0
  13. package/lib/cjs/abstract-control.js.map +1 -0
  14. package/lib/{abstract-control.metadata.json → cjs/abstract-control.metadata.json} +0 -0
  15. package/lib/{array-control.d.ts → cjs/array-control.d.ts} +0 -0
  16. package/lib/{array-control.js → cjs/array-control.js} +0 -0
  17. package/lib/cjs/array-control.js.map +1 -0
  18. package/lib/{array-control.metadata.json → cjs/array-control.metadata.json} +0 -0
  19. package/lib/{base.renderer.d.ts → cjs/base.renderer.d.ts} +0 -0
  20. package/lib/{base.renderer.js → cjs/base.renderer.js} +0 -0
  21. package/lib/cjs/base.renderer.js.map +1 -0
  22. package/lib/{base.renderer.metadata.json → cjs/base.renderer.metadata.json} +0 -0
  23. package/lib/{control.d.ts → cjs/control.d.ts} +0 -0
  24. package/lib/{control.js → cjs/control.js} +0 -0
  25. package/lib/cjs/control.js.map +1 -0
  26. package/lib/{control.metadata.json → cjs/control.metadata.json} +0 -0
  27. package/lib/{index.d.ts → cjs/index.d.ts} +0 -0
  28. package/lib/{index.js → cjs/index.js} +0 -0
  29. package/lib/cjs/index.js.map +1 -0
  30. package/lib/{index.metadata.json → cjs/index.metadata.json} +0 -0
  31. package/lib/{jsonforms-root.component.d.ts → cjs/jsonforms-root.component.d.ts} +1 -0
  32. package/lib/{jsonforms-root.component.js → cjs/jsonforms-root.component.js} +14 -2
  33. package/lib/cjs/jsonforms-root.component.js.map +1 -0
  34. package/lib/{jsonforms-root.component.metadata.json → cjs/jsonforms-root.component.metadata.json} +1 -1
  35. package/lib/{jsonforms.component.d.ts → cjs/jsonforms.component.d.ts} +0 -0
  36. package/lib/{jsonforms.component.js → cjs/jsonforms.component.js} +3 -2
  37. package/lib/cjs/jsonforms.component.js.map +1 -0
  38. package/lib/{jsonforms.component.metadata.json → cjs/jsonforms.component.metadata.json} +0 -0
  39. package/lib/{jsonforms.module.d.ts → cjs/jsonforms.module.d.ts} +0 -0
  40. package/lib/{jsonforms.module.js → cjs/jsonforms.module.js} +0 -0
  41. package/lib/cjs/jsonforms.module.js.map +1 -0
  42. package/lib/{jsonforms.module.metadata.json → cjs/jsonforms.module.metadata.json} +0 -0
  43. package/lib/{jsonforms.service.d.ts → cjs/jsonforms.service.d.ts} +0 -0
  44. package/lib/{jsonforms.service.js → cjs/jsonforms.service.js} +0 -0
  45. package/lib/cjs/jsonforms.service.js.map +1 -0
  46. package/lib/{jsonforms.service.metadata.json → cjs/jsonforms.service.metadata.json} +0 -0
  47. package/lib/{unknown.component.d.ts → cjs/unknown.component.d.ts} +0 -0
  48. package/lib/{unknown.component.js → cjs/unknown.component.js} +0 -0
  49. package/lib/cjs/unknown.component.js.map +1 -0
  50. package/lib/{unknown.component.metadata.json → cjs/unknown.component.metadata.json} +0 -0
  51. package/lib/esm/abstract-control.d.ts +35 -0
  52. package/lib/esm/abstract-control.js +133 -0
  53. package/lib/esm/abstract-control.js.map +1 -0
  54. package/lib/esm/abstract-control.metadata.json +1 -0
  55. package/lib/esm/array-control.d.ts +6 -0
  56. package/lib/esm/array-control.js +40 -0
  57. package/lib/esm/array-control.js.map +1 -0
  58. package/lib/esm/array-control.metadata.json +1 -0
  59. package/lib/esm/base.renderer.d.ts +7 -0
  60. package/lib/esm/base.renderer.js +47 -0
  61. package/lib/esm/base.renderer.js.map +1 -0
  62. package/lib/esm/base.renderer.metadata.json +1 -0
  63. package/lib/esm/control.d.ts +9 -0
  64. package/lib/esm/control.js +52 -0
  65. package/lib/esm/control.js.map +1 -0
  66. package/lib/esm/control.metadata.json +1 -0
  67. package/lib/esm/index.d.ts +9 -0
  68. package/lib/esm/index.js +34 -0
  69. package/lib/esm/index.js.map +1 -0
  70. package/lib/esm/index.metadata.json +1 -0
  71. package/lib/esm/jsonforms-root.component.d.ts +30 -0
  72. package/lib/esm/jsonforms-root.component.js +147 -0
  73. package/lib/esm/jsonforms-root.component.js.map +1 -0
  74. package/lib/esm/jsonforms-root.component.metadata.json +1 -0
  75. package/lib/esm/jsonforms.component.d.ts +16 -0
  76. package/lib/esm/jsonforms.component.js +130 -0
  77. package/lib/esm/jsonforms.component.js.map +1 -0
  78. package/lib/esm/jsonforms.component.metadata.json +1 -0
  79. package/lib/esm/jsonforms.module.d.ts +2 -0
  80. package/lib/esm/jsonforms.module.js +42 -0
  81. package/lib/esm/jsonforms.module.js.map +1 -0
  82. package/lib/esm/jsonforms.module.metadata.json +1 -0
  83. package/lib/esm/jsonforms.service.d.ts +47 -0
  84. package/lib/esm/jsonforms.service.js +179 -0
  85. package/lib/esm/jsonforms.service.js.map +1 -0
  86. package/lib/esm/jsonforms.service.metadata.json +1 -0
  87. package/lib/esm/unknown.component.d.ts +2 -0
  88. package/lib/esm/unknown.component.js +38 -0
  89. package/lib/esm/unknown.component.js.map +1 -0
  90. package/lib/esm/unknown.component.metadata.json +1 -0
  91. package/package.json +15 -17
  92. package/src/jsonforms-root.component.ts +22 -3
  93. package/src/jsonforms.component.ts +3 -2
  94. package/tsconfig.cjs.json +9 -0
  95. package/tsconfig.json +3 -2
  96. package/lib/abstract-control.js.map +0 -1
  97. package/lib/array-control.js.map +0 -1
  98. package/lib/base.renderer.js.map +0 -1
  99. package/lib/control.js.map +0 -1
  100. package/lib/index.js.map +0 -1
  101. package/lib/jsonforms-angular.js +0 -2162
  102. package/lib/jsonforms-angular.js.map +0 -1
  103. package/lib/jsonforms-root.component.js.map +0 -1
  104. package/lib/jsonforms.component.js.map +0 -1
  105. package/lib/jsonforms.module.js.map +0 -1
  106. package/lib/jsonforms.service.js.map +0 -1
  107. package/lib/unknown.component.js.map +0 -1
  108. package/webpack.build.js +0 -12
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"JsonFormsArrayControl":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./abstract-control","name":"JsonFormsAbstractControl","line":33,"character":10},"members":{"mapToProps":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1,7 @@
1
+ import { JsonSchema, OwnPropsOfRenderer, UISchemaElement } from '@jsonforms/core';
2
+ export declare class JsonFormsBaseRenderer<T extends UISchemaElement> {
3
+ uischema: T;
4
+ schema: JsonSchema;
5
+ path: string;
6
+ protected getOwnProps(): OwnPropsOfRenderer;
7
+ }
@@ -0,0 +1,47 @@
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 { Directive, Input } from '@angular/core';
26
+ var JsonFormsBaseRenderer = /** @class */ (function () {
27
+ function JsonFormsBaseRenderer() {
28
+ }
29
+ JsonFormsBaseRenderer.prototype.getOwnProps = function () {
30
+ return {
31
+ uischema: this.uischema,
32
+ schema: this.schema,
33
+ path: this.path
34
+ };
35
+ };
36
+ JsonFormsBaseRenderer.decorators = [
37
+ { type: Directive }
38
+ ];
39
+ JsonFormsBaseRenderer.propDecorators = {
40
+ uischema: [{ type: Input }],
41
+ schema: [{ type: Input }],
42
+ path: [{ type: Input }]
43
+ };
44
+ return JsonFormsBaseRenderer;
45
+ }());
46
+ export { JsonFormsBaseRenderer };
47
+ //# sourceMappingURL=base.renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.renderer.js","sourceRoot":"","sources":["../../src/base.renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,EAAG,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAOlD;IAAA;IAaA,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;;gBAZF,SAAS;;;2BAEP,KAAK;yBACL,KAAK;uBACL,KAAK;;IASR,4BAAC;CAAA,AAbD,IAaC;SAZY,qBAAqB"}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"JsonFormsBaseRenderer":{"__symbolic":"class","arity":1,"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":31,"character":1}}],"members":{"uischema":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":33,"character":3}}]}],"schema":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"path":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":35,"character":3}}]}],"getOwnProps":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1,9 @@
1
+ import { JsonFormsState, StatePropsOfControl, StatePropsOfControlWithDetail } from '@jsonforms/core';
2
+ import { OnDestroy, OnInit } from '@angular/core';
3
+ import { JsonFormsAbstractControl } from './abstract-control';
4
+ export declare class JsonFormsControl extends JsonFormsAbstractControl<StatePropsOfControl> implements OnInit, OnDestroy {
5
+ protected mapToProps(state: JsonFormsState): StatePropsOfControl;
6
+ }
7
+ export declare class JsonFormsControlWithDetail extends JsonFormsAbstractControl<StatePropsOfControlWithDetail> implements OnInit, OnDestroy {
8
+ protected mapToProps(state: JsonFormsState): StatePropsOfControlWithDetail;
9
+ }
@@ -0,0 +1,52 @@
1
+ import { __assign, __extends } from "tslib";
2
+ /*
3
+ The MIT License
4
+
5
+ Copyright (c) 2017-2019 EclipseSource Munich
6
+ https://github.com/eclipsesource/jsonforms
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+ */
26
+ import { mapStateToControlProps, mapStateToControlWithDetailProps } from '@jsonforms/core';
27
+ import { JsonFormsAbstractControl } from './abstract-control';
28
+ var JsonFormsControl = /** @class */ (function (_super) {
29
+ __extends(JsonFormsControl, _super);
30
+ function JsonFormsControl() {
31
+ return _super !== null && _super.apply(this, arguments) || this;
32
+ }
33
+ JsonFormsControl.prototype.mapToProps = function (state) {
34
+ var props = mapStateToControlProps(state, this.getOwnProps());
35
+ return __assign({}, props);
36
+ };
37
+ return JsonFormsControl;
38
+ }(JsonFormsAbstractControl));
39
+ export { JsonFormsControl };
40
+ var JsonFormsControlWithDetail = /** @class */ (function (_super) {
41
+ __extends(JsonFormsControlWithDetail, _super);
42
+ function JsonFormsControlWithDetail() {
43
+ return _super !== null && _super.apply(this, arguments) || this;
44
+ }
45
+ JsonFormsControlWithDetail.prototype.mapToProps = function (state) {
46
+ var props = mapStateToControlWithDetailProps(state, this.getOwnProps());
47
+ return __assign({}, props);
48
+ };
49
+ return JsonFormsControlWithDetail;
50
+ }(JsonFormsAbstractControl));
51
+ export { JsonFormsControlWithDetail };
52
+ //# sourceMappingURL=control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control.js","sourceRoot":"","sources":["../../src/control.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,EAEL,sBAAsB,EACtB,gCAAgC,EAGjC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D;IACU,oCAA6C;IADvD;;IAOA,CAAC;IAJW,qCAAU,GAApB,UAAqB,KAAqB;QACxC,IAAM,KAAK,GAAG,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAChE,oBAAY,KAAK,EAAG;IACtB,CAAC;IACH,uBAAC;AAAD,CAAC,AAPD,CACU,wBAAwB,GAMjC;;AAED;IACU,8CAAuD;IADjE;;IAOA,CAAC;IAJW,+CAAU,GAApB,UAAqB,KAAqB;QACxC,IAAM,KAAK,GAAG,gCAAgC,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC1E,oBAAY,KAAK,EAAG;IACtB,CAAC;IACH,iCAAC;AAAD,CAAC,AAPD,CACU,wBAAwB,GAMjC"}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"JsonFormsControl":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./abstract-control","name":"JsonFormsAbstractControl","line":35,"character":10},"members":{"mapToProps":[{"__symbolic":"method"}]}},"JsonFormsControlWithDetail":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./abstract-control","name":"JsonFormsAbstractControl","line":44,"character":10},"members":{"mapToProps":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1,9 @@
1
+ export * from './base.renderer';
2
+ export * from './control';
3
+ export * from './array-control';
4
+ export * from './jsonforms.component';
5
+ export * from './jsonforms.module';
6
+ export * from './unknown.component';
7
+ export * from './jsonforms.service';
8
+ export * from './jsonforms-root.component';
9
+ export * from './abstract-control';
@@ -0,0 +1,34 @@
1
+ /*
2
+ The MIT License
3
+
4
+ Copyright (c) 2017-2020 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
+ export * from './base.renderer';
26
+ export * from './control';
27
+ export * from './array-control';
28
+ export * from './jsonforms.component';
29
+ export * from './jsonforms.module';
30
+ export * from './unknown.component';
31
+ export * from './jsonforms.service';
32
+ export * from './jsonforms-root.component';
33
+ export * from './abstract-control';
34
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./base.renderer"},{"from":"./control"},{"from":"./array-control"},{"from":"./jsonforms.component"},{"from":"./jsonforms.module"},{"from":"./unknown.component"},{"from":"./jsonforms.service"},{"from":"./jsonforms-root.component"},{"from":"./abstract-control"}]}]
@@ -0,0 +1,30 @@
1
+ import { EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
+ import { JsonFormsI18nState, JsonFormsRendererRegistryEntry, JsonSchema, UISchemaElement, UISchemaTester, ValidationMode } from '@jsonforms/core';
3
+ import Ajv, { ErrorObject } from 'ajv';
4
+ import { JsonFormsAngularService } from './jsonforms.service';
5
+ export declare class JsonForms implements OnChanges, OnInit {
6
+ private jsonformsService;
7
+ uischema: UISchemaElement;
8
+ schema: JsonSchema;
9
+ data: any;
10
+ renderers: JsonFormsRendererRegistryEntry[];
11
+ uischemas: {
12
+ tester: UISchemaTester;
13
+ uischema: UISchemaElement;
14
+ }[];
15
+ dataChange: EventEmitter<any>;
16
+ readonly: boolean;
17
+ validationMode: ValidationMode;
18
+ ajv: Ajv;
19
+ config: any;
20
+ i18n: JsonFormsI18nState;
21
+ errors: EventEmitter<ErrorObject<string, Record<string, any>, unknown>[]>;
22
+ private previousData;
23
+ private previousErrors;
24
+ private initialized;
25
+ oldI18N: JsonFormsI18nState;
26
+ constructor(jsonformsService: JsonFormsAngularService);
27
+ ngOnInit(): void;
28
+ ngDoCheck(): void;
29
+ ngOnChanges(changes: SimpleChanges): void;
30
+ }
@@ -0,0 +1,147 @@
1
+ /*
2
+ The MIT License
3
+
4
+ Copyright (c) 2017-2020 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, EventEmitter, Input, Output } from '@angular/core';
26
+ import { Actions } from '@jsonforms/core';
27
+ import Ajv from 'ajv';
28
+ import { JsonFormsAngularService, USE_STATE_VALUE } from './jsonforms.service';
29
+ var JsonForms = /** @class */ (function () {
30
+ function JsonForms(jsonformsService) {
31
+ this.jsonformsService = jsonformsService;
32
+ this.dataChange = new EventEmitter();
33
+ this.errors = new EventEmitter();
34
+ this.initialized = false;
35
+ }
36
+ JsonForms.prototype.ngOnInit = function () {
37
+ var _this = this;
38
+ this.jsonformsService.init({
39
+ core: {
40
+ data: this.data,
41
+ uischema: this.uischema,
42
+ schema: this.schema,
43
+ ajv: this.ajv,
44
+ validationMode: this.validationMode
45
+ },
46
+ uischemas: this.uischemas,
47
+ i18n: this.i18n,
48
+ renderers: this.renderers,
49
+ config: this.config,
50
+ readonly: this.readonly
51
+ });
52
+ this.jsonformsService.$state.subscribe(function (state) {
53
+ var _a, _b, _c, _d;
54
+ var data = (_b = (_a = state === null || state === void 0 ? void 0 : state.jsonforms) === null || _a === void 0 ? void 0 : _a.core) === null || _b === void 0 ? void 0 : _b.data;
55
+ var errors = (_d = (_c = state === null || state === void 0 ? void 0 : state.jsonforms) === null || _c === void 0 ? void 0 : _c.core) === null || _d === void 0 ? void 0 : _d.errors;
56
+ if (_this.previousData !== data) {
57
+ _this.previousData = data;
58
+ _this.dataChange.emit(data);
59
+ }
60
+ if (_this.previousErrors !== errors) {
61
+ _this.previousErrors = errors;
62
+ _this.errors.emit(errors);
63
+ }
64
+ });
65
+ this.oldI18N = this.i18n;
66
+ this.initialized = true;
67
+ };
68
+ JsonForms.prototype.ngDoCheck = function () {
69
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
70
+ // we can't use ngOnChanges as then nested i18n changes will not be detected
71
+ // the update will result in a no-op when the parameters did not change
72
+ if (((_a = this.oldI18N) === null || _a === void 0 ? void 0 : _a.locale) !== ((_b = this.i18n) === null || _b === void 0 ? void 0 : _b.locale) ||
73
+ ((_c = this.oldI18N) === null || _c === void 0 ? void 0 : _c.translate) !== ((_d = this.i18n) === null || _d === void 0 ? void 0 : _d.translate) ||
74
+ ((_e = this.oldI18N) === null || _e === void 0 ? void 0 : _e.translateError) !== ((_f = this.i18n) === null || _f === void 0 ? void 0 : _f.translateError)) {
75
+ this.jsonformsService.updateI18n(Actions.updateI18n(((_g = this.oldI18N) === null || _g === void 0 ? void 0 : _g.locale) === ((_h = this.i18n) === null || _h === void 0 ? void 0 : _h.locale)
76
+ ? this.jsonformsService.getState().jsonforms.i18n.locale
77
+ : (_j = this.i18n) === null || _j === void 0 ? void 0 : _j.locale, ((_k = this.oldI18N) === null || _k === void 0 ? void 0 : _k.translate) === ((_l = this.i18n) === null || _l === void 0 ? void 0 : _l.translate)
78
+ ? this.jsonformsService.getState().jsonforms.i18n.translate
79
+ : (_m = this.i18n) === null || _m === void 0 ? void 0 : _m.translate, ((_o = this.oldI18N) === null || _o === void 0 ? void 0 : _o.translateError) === ((_p = this.i18n) === null || _p === void 0 ? void 0 : _p.translateError)
80
+ ? this.jsonformsService.getState().jsonforms.i18n.translateError
81
+ : (_q = this.i18n) === null || _q === void 0 ? void 0 : _q.translateError));
82
+ this.oldI18N = this.i18n;
83
+ }
84
+ };
85
+ // tslint:disable-next-line: cyclomatic-complexity
86
+ JsonForms.prototype.ngOnChanges = function (changes) {
87
+ var _a, _b, _c;
88
+ if (!this.initialized) {
89
+ return;
90
+ }
91
+ var newData = changes.data;
92
+ var newSchema = changes.schema;
93
+ var newUiSchema = changes.uischema;
94
+ var newRenderers = changes.renderers;
95
+ var newUischemas = changes.uischemas;
96
+ var newI18n = changes.i18n;
97
+ var newReadonly = changes.readonly;
98
+ var newValidationMode = changes.validationMode;
99
+ var newAjv = changes.ajv;
100
+ var newConfig = changes.config;
101
+ if (newData || newSchema || newUiSchema || newValidationMode || newAjv) {
102
+ this.jsonformsService.updateCoreState(newData ? newData.currentValue : USE_STATE_VALUE, newSchema ? newSchema.currentValue : USE_STATE_VALUE, newUiSchema ? newUiSchema.currentValue : USE_STATE_VALUE, newAjv ? newAjv.currentValue : USE_STATE_VALUE, newValidationMode ? newValidationMode.currentValue : USE_STATE_VALUE);
103
+ }
104
+ if (newRenderers && !newRenderers.isFirstChange()) {
105
+ this.jsonformsService.setRenderers(newRenderers.currentValue);
106
+ }
107
+ if (newUischemas && !newUischemas.isFirstChange()) {
108
+ this.jsonformsService.setUiSchemas(newUischemas.currentValue);
109
+ }
110
+ if (newI18n && !newI18n.isFirstChange()) {
111
+ this.jsonformsService.updateI18n(Actions.updateI18n((_a = newI18n.currentValue) === null || _a === void 0 ? void 0 : _a.locale, (_b = newI18n.currentValue) === null || _b === void 0 ? void 0 : _b.translate, (_c = newI18n.currentValue) === null || _c === void 0 ? void 0 : _c.translateError));
112
+ }
113
+ if (newReadonly && !newReadonly.isFirstChange()) {
114
+ this.jsonformsService.setReadonly(newReadonly.currentValue);
115
+ }
116
+ if (newConfig && !newConfig.isFirstChange()) {
117
+ this.jsonformsService.updateConfig(Actions.setConfig(newConfig.currentValue));
118
+ }
119
+ };
120
+ JsonForms.decorators = [
121
+ { type: Component, args: [{
122
+ selector: 'jsonforms',
123
+ template: '<jsonforms-outlet></jsonforms-outlet>',
124
+ providers: [JsonFormsAngularService]
125
+ },] }
126
+ ];
127
+ JsonForms.ctorParameters = function () { return [
128
+ { type: JsonFormsAngularService }
129
+ ]; };
130
+ JsonForms.propDecorators = {
131
+ uischema: [{ type: Input }],
132
+ schema: [{ type: Input }],
133
+ data: [{ type: Input }],
134
+ renderers: [{ type: Input }],
135
+ uischemas: [{ type: Input }],
136
+ dataChange: [{ type: Output }],
137
+ readonly: [{ type: Input }],
138
+ validationMode: [{ type: Input }],
139
+ ajv: [{ type: Input }],
140
+ config: [{ type: Input }],
141
+ i18n: [{ type: Input }],
142
+ errors: [{ type: Output }]
143
+ };
144
+ return JsonForms;
145
+ }());
146
+ export { JsonForms };
147
+ //# sourceMappingURL=jsonforms-root.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonforms-root.component.js","sourceRoot":"","sources":["../../src/jsonforms-root.component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,EACH,SAAS,EAAE,YAAY,EAAE,KAAK,EAAqB,MAAM,EAC5D,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAmH,MAAM,iBAAiB,CAAC;AAC3J,OAAO,GAAoB,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC/E;IA0BI,mBAAoB,gBAAyC;QAAzC,qBAAgB,GAAhB,gBAAgB,CAAyB;QAdnD,eAAU,GAAG,IAAI,YAAY,EAAO,CAAC;QAMrC,WAAM,GAAG,IAAI,YAAY,EAAiB,CAAC;QAK7C,gBAAW,GAAG,KAAK,CAAC;IAI5B,CAAC;IAED,4BAAQ,GAAR;QAAA,iBA6BC;QA5BG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;YACvB,IAAI,EAAE;gBACF,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,GAAG,EAAE,IAAI,CAAC,GAAG;gBACb,cAAc,EA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B,CAAC,UAAU,CAC5B,OAAO,CAAC,UAAU,CAAC,MAAA,OAAO,CAAC,YAAY,0CAAE,MAAM,EAAE,MAAA,OAAO,CAAC,YAAY,0CAAE,SAAS,EAAE,MAAA,OAAO,CAAC,YAAY,0CAAE,cAAc,CAAC,CAC1H,CAAC;SACL;QAED,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,EAAE;YAC7C,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;SAC/D;QAED,IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,EAAE;YACzC,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;SACjF;IACL,CAAC;;gBApIJ,SAAS,SAAC;oBACP,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE,uCAAuC;oBACjD,SAAS,EAAE,CAAC,uBAAuB,CAAC;iBACvC;;;gBALQ,uBAAuB;;;2BAQ3B,KAAK;yBACL,KAAK;uBACL,KAAK;4BACL,KAAK;4BACL,KAAK;6BACL,MAAM;2BACN,KAAK;iCACL,KAAK;sBACL,KAAK;yBACL,KAAK;uBACL,KAAK;yBACL,MAAM;;IAmHX,gBAAC;CAAA,AArID,IAqIC;SAhIY,SAAS"}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"JsonForms":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":30,"character":1},"arguments":[{"selector":"jsonforms","template":"<jsonforms-outlet></jsonforms-outlet>","providers":[{"__symbolic":"reference","module":"./jsonforms.service","name":"JsonFormsAngularService","line":33,"character":16}]}]}],"members":{"uischema":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":37,"character":5}}]}],"schema":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":38,"character":5}}]}],"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":5}}]}],"renderers":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":40,"character":5}}]}],"uischemas":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":41,"character":5}}]}],"dataChange":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":42,"character":5}}]}],"readonly":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":43,"character":5}}]}],"validationMode":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":44,"character":5}}]}],"ajv":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":45,"character":5}}]}],"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":46,"character":5}}]}],"i18n":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":47,"character":5}}]}],"errors":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":48,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./jsonforms.service","name":"JsonFormsAngularService","line":56,"character":42}]}],"ngOnInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"ngOnChanges":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1,16 @@
1
+ import { ComponentFactoryResolver, OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
2
+ import { JsonFormsState, OwnPropsOfRenderer, UISchemaElement } from '@jsonforms/core';
3
+ import { JsonFormsBaseRenderer } from './base.renderer';
4
+ import { JsonFormsAngularService } from './jsonforms.service';
5
+ export declare class JsonFormsOutlet extends JsonFormsBaseRenderer<UISchemaElement> implements OnInit, OnDestroy {
6
+ private viewContainerRef;
7
+ private componentFactoryResolver;
8
+ private jsonformsService;
9
+ private subscription;
10
+ private previousProps;
11
+ constructor(viewContainerRef: ViewContainerRef, componentFactoryResolver: ComponentFactoryResolver, jsonformsService: JsonFormsAngularService);
12
+ set renderProps(renderProps: OwnPropsOfRenderer);
13
+ ngOnInit(): void;
14
+ update(state: JsonFormsState): void;
15
+ ngOnDestroy(): void;
16
+ }
@@ -0,0 +1,130 @@
1
+ import { __extends } from "tslib";
2
+ /*
3
+ The MIT License
4
+
5
+ Copyright (c) 2017-2019 EclipseSource Munich
6
+ https://github.com/eclipsesource/jsonforms
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+ */
26
+ import maxBy from 'lodash/maxBy';
27
+ import { ComponentFactoryResolver, Directive, Input, ViewContainerRef } from '@angular/core';
28
+ import { createId, isControl, mapStateToJsonFormsRendererProps } from '@jsonforms/core';
29
+ import { UnknownRenderer } from './unknown.component';
30
+ import { JsonFormsBaseRenderer } from './base.renderer';
31
+ import { JsonFormsControl } from './control';
32
+ import { JsonFormsAngularService } from './jsonforms.service';
33
+ import { get, isEqual } from 'lodash';
34
+ var areEqual = function (prevProps, nextProps) {
35
+ return get(prevProps, 'renderers.length') === get(nextProps, 'renderers.length')
36
+ && get(prevProps, 'cells.length') === get(nextProps, 'cells.length')
37
+ && get(prevProps, 'uischemas.length') === get(nextProps, 'uischemas.length')
38
+ && get(prevProps, 'schema') === get(nextProps, 'schema')
39
+ && isEqual(get(prevProps, 'uischema'), get(nextProps, 'uischema'))
40
+ && get(prevProps, 'path') === get(nextProps, 'path');
41
+ };
42
+ var ɵ0 = areEqual;
43
+ var JsonFormsOutlet = /** @class */ (function (_super) {
44
+ __extends(JsonFormsOutlet, _super);
45
+ function JsonFormsOutlet(viewContainerRef, componentFactoryResolver, jsonformsService) {
46
+ var _this = _super.call(this) || this;
47
+ _this.viewContainerRef = viewContainerRef;
48
+ _this.componentFactoryResolver = componentFactoryResolver;
49
+ _this.jsonformsService = jsonformsService;
50
+ return _this;
51
+ }
52
+ Object.defineProperty(JsonFormsOutlet.prototype, "renderProps", {
53
+ set: function (renderProps) {
54
+ this.path = renderProps.path;
55
+ this.schema = renderProps.schema;
56
+ this.uischema = renderProps.uischema;
57
+ this.update(this.jsonformsService.getState());
58
+ },
59
+ enumerable: false,
60
+ configurable: true
61
+ });
62
+ JsonFormsOutlet.prototype.ngOnInit = function () {
63
+ var _this = this;
64
+ this.subscription = this.jsonformsService.$state.subscribe({
65
+ next: function (state) { return _this.update(state); }
66
+ });
67
+ };
68
+ JsonFormsOutlet.prototype.update = function (state) {
69
+ var props = mapStateToJsonFormsRendererProps(state, {
70
+ schema: this.schema,
71
+ uischema: this.uischema,
72
+ path: this.path
73
+ });
74
+ if (areEqual(this.previousProps, props)) {
75
+ return;
76
+ }
77
+ else {
78
+ this.previousProps = props;
79
+ }
80
+ var renderers = props.renderers;
81
+ var schema = this.schema || props.schema;
82
+ var uischema = this.uischema || props.uischema;
83
+ var rootSchema = props.rootSchema;
84
+ var renderer = maxBy(renderers, function (r) { return r.tester(uischema, schema, rootSchema); });
85
+ var bestComponent = UnknownRenderer;
86
+ if (renderer !== undefined && renderer.tester(uischema, schema, rootSchema) !== -1) {
87
+ bestComponent = renderer.renderer;
88
+ }
89
+ var componentFactory = this.componentFactoryResolver.resolveComponentFactory(bestComponent);
90
+ this.viewContainerRef.clear();
91
+ var currentComponentRef = this.viewContainerRef.createComponent(componentFactory);
92
+ if (currentComponentRef.instance instanceof JsonFormsBaseRenderer) {
93
+ var instance = currentComponentRef.instance;
94
+ instance.uischema = uischema;
95
+ instance.schema = schema;
96
+ instance.path = this.path;
97
+ if (instance instanceof JsonFormsControl) {
98
+ var controlInstance = instance;
99
+ if (controlInstance.id === undefined) {
100
+ var id = isControl(props.uischema)
101
+ ? createId(props.uischema.scope)
102
+ : undefined;
103
+ instance.id = id;
104
+ }
105
+ }
106
+ }
107
+ };
108
+ JsonFormsOutlet.prototype.ngOnDestroy = function () {
109
+ if (this.subscription) {
110
+ this.subscription.unsubscribe();
111
+ }
112
+ };
113
+ JsonFormsOutlet.decorators = [
114
+ { type: Directive, args: [{
115
+ selector: 'jsonforms-outlet'
116
+ },] }
117
+ ];
118
+ JsonFormsOutlet.ctorParameters = function () { return [
119
+ { type: ViewContainerRef },
120
+ { type: ComponentFactoryResolver },
121
+ { type: JsonFormsAngularService }
122
+ ]; };
123
+ JsonFormsOutlet.propDecorators = {
124
+ renderProps: [{ type: Input }]
125
+ };
126
+ return JsonFormsOutlet;
127
+ }(JsonFormsBaseRenderer));
128
+ export { JsonFormsOutlet };
129
+ export { ɵ0 };
130
+ //# sourceMappingURL=jsonforms.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonforms.component.js","sourceRoot":"","sources":["../../src/jsonforms.component.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,KAAK,MAAM,cAAc,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,SAAS,EACT,KAAK,EAIL,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,QAAQ,EACR,SAAS,EAIT,gCAAgC,EAIjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEtC,IAAM,QAAQ,GAAG,UAAC,SAAwC,EAAE,SAAwC;IAClG,OAAO,GAAG,CAAC,SAAS,EAAE,kBAAkB,CAAC,KAAK,GAAG,CAAC,SAAS,EAAE,kBAAkB,CAAC;WAC3E,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC,KAAK,GAAG,CAAC,SAAS,EAAE,cAAc,CAAC;WACjE,GAAG,CAAC,SAAS,EAAE,kBAAkB,CAAC,KAAK,GAAG,CAAC,SAAS,EAAE,kBAAkB,CAAC;WACzE,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC;WACrD,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;WAC/D,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,KAAK,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACz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,CAAC,KAAK,CAAC;wBAChC,CAAC,CAAC,SAAS,CAAC;oBACb,QAA6B,CAAC,EAAE,GAAG,EAAE,CAAC;iBACxC;aACF;SACF;IACH,CAAC;IAED,qCAAW,GAAX;QACE,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACjC;IACH,CAAC;;gBA7EF,SAAS,SAAC;oBACT,QAAQ,EAAE,kBAAkB;iBAC7B;;;gBAhCC,gBAAgB;gBANhB,wBAAwB;gBAuBjB,uBAAuB;;;8BA6B7B,KAAK;;IA8DR,sBAAC;CAAA,AA9ED,CAGqC,qBAAqB,GA2EzD;SA3EY,eAAe"}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"ɵ0":{"__symbolic":"error","message":"Lambda not supported","line":53,"character":17},"JsonFormsOutlet":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./base.renderer","name":"JsonFormsBaseRenderer","line":65,"character":37},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":62,"character":1},"arguments":[{"selector":"jsonforms-outlet"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":71,"character":30},{"__symbolic":"reference","module":"@angular/core","name":"ComponentFactoryResolver","line":72,"character":38},{"__symbolic":"reference","module":"./jsonforms.service","name":"JsonFormsAngularService","line":73,"character":30}]}],"renderProps":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":78,"character":3}}]}],"ngOnInit":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"ngOnDestroy":[{"__symbolic":"method"}]}}}}]
@@ -0,0 +1,2 @@
1
+ export declare class JsonFormsModule {
2
+ }
@@ -0,0 +1,42 @@
1
+ /*
2
+ The MIT License
3
+
4
+ Copyright (c) 2017-2020 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 { NgModule } from '@angular/core';
26
+ import { JsonForms } from './jsonforms-root.component';
27
+ import { JsonFormsOutlet } from './jsonforms.component';
28
+ import { UnknownRenderer } from './unknown.component';
29
+ var JsonFormsModule = /** @class */ (function () {
30
+ function JsonFormsModule() {
31
+ }
32
+ JsonFormsModule.decorators = [
33
+ { type: NgModule, args: [{
34
+ declarations: [JsonFormsOutlet, UnknownRenderer, JsonForms],
35
+ entryComponents: [UnknownRenderer],
36
+ exports: [JsonFormsOutlet, JsonForms]
37
+ },] }
38
+ ];
39
+ return JsonFormsModule;
40
+ }());
41
+ export { JsonFormsModule };
42
+ //# sourceMappingURL=jsonforms.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonforms.module.js","sourceRoot":"","sources":["../../src/jsonforms.module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD;IAAA;IAK8B,CAAC;;gBAL9B,QAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,SAAS,CAAC;oBAC3D,eAAe,EAAE,CAAC,eAAe,CAAC;oBAClC,OAAO,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC;iBACtC;;IAC6B,sBAAC;CAAA,AAL/B,IAK+B;SAAlB,eAAe"}
@@ -0,0 +1 @@
1
+ [{"__symbolic":"module","version":4,"metadata":{"JsonFormsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":29,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./jsonforms.component","name":"JsonFormsOutlet","line":30,"character":17},{"__symbolic":"reference","module":"./unknown.component","name":"UnknownRenderer","line":30,"character":34},{"__symbolic":"reference","module":"./jsonforms-root.component","name":"JsonForms","line":30,"character":51}],"entryComponents":[{"__symbolic":"reference","module":"./unknown.component","name":"UnknownRenderer","line":31,"character":20}],"exports":[{"__symbolic":"reference","module":"./jsonforms.component","name":"JsonFormsOutlet","line":32,"character":12},{"__symbolic":"reference","module":"./jsonforms-root.component","name":"JsonForms","line":32,"character":29}]}]}]}}}]