@ng-formworks/core 16.3.0 → 17.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/esm2022/lib/framework-library/framework-library.service.mjs +174 -174
  2. package/esm2022/lib/framework-library/framework.mjs +14 -14
  3. package/esm2022/lib/framework-library/no-framework.component.mjs +17 -17
  4. package/esm2022/lib/framework-library/no-framework.module.mjs +26 -26
  5. package/esm2022/lib/framework-library/no.framework.mjs +18 -18
  6. package/esm2022/lib/json-schema-form.component.mjs +765 -765
  7. package/esm2022/lib/json-schema-form.module.mjs +25 -25
  8. package/esm2022/lib/json-schema-form.service.mjs +675 -675
  9. package/esm2022/lib/locale/de-validation-messages.mjs +59 -59
  10. package/esm2022/lib/locale/en-validation-messages.mjs +59 -59
  11. package/esm2022/lib/locale/es-validation-messages.mjs +56 -56
  12. package/esm2022/lib/locale/fr-validation-messages.mjs +59 -59
  13. package/esm2022/lib/locale/index.mjs +7 -7
  14. package/esm2022/lib/locale/it-validation-messages.mjs +59 -59
  15. package/esm2022/lib/locale/pt-validation-messages.mjs +59 -59
  16. package/esm2022/lib/locale/zh-validation-messages.mjs +59 -59
  17. package/esm2022/lib/shared/convert-schema-to-draft6.function.mjs +299 -299
  18. package/esm2022/lib/shared/form-group.functions.mjs +441 -441
  19. package/esm2022/lib/shared/format-regex.constants.mjs +53 -53
  20. package/esm2022/lib/shared/index.mjs +11 -11
  21. package/esm2022/lib/shared/json-schema.functions.mjs +783 -783
  22. package/esm2022/lib/shared/json.validators.mjs +883 -883
  23. package/esm2022/lib/shared/jsonpointer.functions.mjs +1025 -1025
  24. package/esm2022/lib/shared/layout.functions.mjs +1153 -1153
  25. package/esm2022/lib/shared/merge-schemas.function.mjs +344 -344
  26. package/esm2022/lib/shared/utility.functions.mjs +379 -379
  27. package/esm2022/lib/shared/validator.functions.mjs +583 -583
  28. package/esm2022/lib/widget-library/add-reference.component.mjs +48 -48
  29. package/esm2022/lib/widget-library/button.component.mjs +41 -41
  30. package/esm2022/lib/widget-library/checkbox.component.mjs +46 -46
  31. package/esm2022/lib/widget-library/checkboxes.component.mjs +52 -52
  32. package/esm2022/lib/widget-library/file.component.mjs +35 -35
  33. package/esm2022/lib/widget-library/hidden.component.mjs +33 -33
  34. package/esm2022/lib/widget-library/index.mjs +54 -54
  35. package/esm2022/lib/widget-library/input.component.mjs +38 -38
  36. package/esm2022/lib/widget-library/message.component.mjs +33 -33
  37. package/esm2022/lib/widget-library/none.component.mjs +20 -20
  38. package/esm2022/lib/widget-library/number.component.mjs +44 -44
  39. package/esm2022/lib/widget-library/one-of.component.mjs +35 -35
  40. package/esm2022/lib/widget-library/orderable.directive.mjs +123 -123
  41. package/esm2022/lib/widget-library/radios.component.mjs +44 -44
  42. package/esm2022/lib/widget-library/root.component.mjs +44 -44
  43. package/esm2022/lib/widget-library/section.component.mjs +78 -78
  44. package/esm2022/lib/widget-library/select-framework.component.mjs +51 -51
  45. package/esm2022/lib/widget-library/select-widget.component.mjs +46 -46
  46. package/esm2022/lib/widget-library/select.component.mjs +41 -41
  47. package/esm2022/lib/widget-library/submit.component.mjs +55 -55
  48. package/esm2022/lib/widget-library/tab.component.mjs +30 -30
  49. package/esm2022/lib/widget-library/tabs.component.mjs +53 -53
  50. package/esm2022/lib/widget-library/template.component.mjs +46 -46
  51. package/esm2022/lib/widget-library/textarea.component.mjs +37 -37
  52. package/esm2022/lib/widget-library/widget-library.module.mjs +41 -41
  53. package/esm2022/lib/widget-library/widget-library.service.mjs +225 -225
  54. package/esm2022/ng-formworks-core.mjs +4 -4
  55. package/esm2022/public_api.mjs +12 -12
  56. package/fesm2022/ng-formworks-core.mjs +9103 -9103
  57. package/fesm2022/ng-formworks-core.mjs.map +1 -1
  58. package/index.d.ts +5 -5
  59. package/lib/framework-library/framework-library.service.d.ts +55 -55
  60. package/lib/framework-library/framework.d.ts +13 -13
  61. package/lib/framework-library/no-framework.component.d.ts +8 -8
  62. package/lib/framework-library/no-framework.module.d.ts +9 -9
  63. package/lib/framework-library/no.framework.d.ts +10 -10
  64. package/lib/json-schema-form.component.d.ts +218 -218
  65. package/lib/json-schema-form.module.d.ts +11 -11
  66. package/lib/json-schema-form.service.d.ts +115 -115
  67. package/lib/locale/de-validation-messages.d.ts +1 -1
  68. package/lib/locale/en-validation-messages.d.ts +1 -1
  69. package/lib/locale/es-validation-messages.d.ts +1 -1
  70. package/lib/locale/fr-validation-messages.d.ts +1 -1
  71. package/lib/locale/index.d.ts +7 -7
  72. package/lib/locale/it-validation-messages.d.ts +1 -1
  73. package/lib/locale/pt-validation-messages.d.ts +1 -1
  74. package/lib/locale/zh-validation-messages.d.ts +1 -1
  75. package/lib/shared/convert-schema-to-draft6.function.d.ts +21 -21
  76. package/lib/shared/form-group.functions.d.ts +100 -100
  77. package/lib/shared/format-regex.constants.d.ts +19 -19
  78. package/lib/shared/index.d.ts +9 -9
  79. package/lib/shared/json-schema.functions.d.ts +193 -193
  80. package/lib/shared/json.validators.d.ts +441 -441
  81. package/lib/shared/jsonpointer.functions.d.ts +416 -416
  82. package/lib/shared/layout.functions.d.ts +83 -83
  83. package/lib/shared/merge-schemas.function.d.ts +19 -19
  84. package/lib/shared/utility.functions.d.ts +165 -165
  85. package/lib/shared/validator.functions.d.ts +364 -364
  86. package/lib/widget-library/add-reference.component.d.ts +20 -20
  87. package/lib/widget-library/button.component.d.ts +21 -21
  88. package/lib/widget-library/checkbox.component.d.ts +24 -24
  89. package/lib/widget-library/checkboxes.component.d.ts +24 -24
  90. package/lib/widget-library/file.component.d.ts +21 -21
  91. package/lib/widget-library/hidden.component.d.ts +19 -19
  92. package/lib/widget-library/index.d.ts +47 -47
  93. package/lib/widget-library/input.component.d.ts +22 -22
  94. package/lib/widget-library/message.component.d.ts +15 -15
  95. package/lib/widget-library/none.component.d.ts +8 -8
  96. package/lib/widget-library/number.component.d.ts +25 -25
  97. package/lib/widget-library/one-of.component.d.ts +21 -21
  98. package/lib/widget-library/orderable.directive.d.ts +41 -41
  99. package/lib/widget-library/radios.component.d.ts +23 -23
  100. package/lib/widget-library/root.component.d.ts +17 -17
  101. package/lib/widget-library/section.component.d.ts +19 -19
  102. package/lib/widget-library/select-framework.component.d.ts +18 -18
  103. package/lib/widget-library/select-widget.component.d.ts +18 -18
  104. package/lib/widget-library/select.component.d.ts +24 -24
  105. package/lib/widget-library/submit.component.d.ts +24 -24
  106. package/lib/widget-library/tab.component.d.ts +14 -14
  107. package/lib/widget-library/tabs.component.d.ts +20 -20
  108. package/lib/widget-library/template.component.d.ts +18 -18
  109. package/lib/widget-library/textarea.component.d.ts +21 -21
  110. package/lib/widget-library/widget-library.module.d.ts +31 -31
  111. package/lib/widget-library/widget-library.service.d.ts +22 -22
  112. package/package.json +5 -5
  113. package/public_api.d.ts +9 -9
@@ -1,11 +1,11 @@
1
- import * as i0 from "@angular/core";
2
- import * as i1 from "./json-schema-form.component";
3
- import * as i2 from "@angular/common";
4
- import * as i3 from "@angular/forms";
5
- import * as i4 from "./widget-library/widget-library.module";
6
- import * as i5 from "./framework-library/no-framework.module";
7
- export declare class JsonSchemaFormModule {
8
- static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormModule, never>;
9
- static ɵmod: i0.ɵɵNgModuleDeclaration<JsonSchemaFormModule, [typeof i1.JsonSchemaFormComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.WidgetLibraryModule, typeof i5.NoFrameworkModule], [typeof i1.JsonSchemaFormComponent, typeof i4.WidgetLibraryModule]>;
10
- static ɵinj: i0.ɵɵInjectorDeclaration<JsonSchemaFormModule>;
11
- }
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./json-schema-form.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@angular/forms";
5
+ import * as i4 from "./widget-library/widget-library.module";
6
+ import * as i5 from "./framework-library/no-framework.module";
7
+ export declare class JsonSchemaFormModule {
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormModule, never>;
9
+ static ɵmod: i0.ɵɵNgModuleDeclaration<JsonSchemaFormModule, [typeof i1.JsonSchemaFormComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.WidgetLibraryModule, typeof i5.NoFrameworkModule], [typeof i1.JsonSchemaFormComponent, typeof i4.WidgetLibraryModule]>;
10
+ static ɵinj: i0.ɵɵInjectorDeclaration<JsonSchemaFormModule>;
11
+ }
@@ -1,115 +1,115 @@
1
- import { OnDestroy } from '@angular/core';
2
- import { AbstractControl, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
3
- import { ErrorObject, Options } from 'ajv';
4
- import { Subject, Subscription } from 'rxjs';
5
- import * as i0 from "@angular/core";
6
- export interface TitleMapItem {
7
- name?: string;
8
- value?: any;
9
- checked?: boolean;
10
- group?: string;
11
- items?: TitleMapItem[];
12
- }
13
- export interface ErrorMessages {
14
- [control_name: string]: {
15
- message: string | Function | Object;
16
- code: string;
17
- }[];
18
- }
19
- export declare class JsonSchemaFormService implements OnDestroy {
20
- JsonFormCompatibility: boolean;
21
- ReactJsonSchemaFormCompatibility: boolean;
22
- AngularSchemaFormCompatibility: boolean;
23
- tpldata: any;
24
- ajvOptions: Options;
25
- ajv: any;
26
- validateFormData: any;
27
- formValues: any;
28
- data: any;
29
- schema: any;
30
- layout: any[];
31
- formGroupTemplate: any;
32
- formGroup: any;
33
- framework: any;
34
- formOptions: any;
35
- validData: any;
36
- isValid: boolean;
37
- ajvErrors: ErrorObject[];
38
- validationErrors: any;
39
- dataErrors: any;
40
- formValueSubscription: any;
41
- dataChanges: Subject<any>;
42
- isValidChanges: Subject<any>;
43
- validationErrorChanges: Subject<any>;
44
- arrayMap: Map<string, number>;
45
- dataMap: Map<string, any>;
46
- dataRecursiveRefMap: Map<string, string>;
47
- schemaRecursiveRefMap: Map<string, string>;
48
- schemaRefLibrary: any;
49
- layoutRefLibrary: any;
50
- templateRefLibrary: any;
51
- hasRootReference: boolean;
52
- language: string;
53
- defaultFormOptions: any;
54
- fcValueChangesSubs: Subscription;
55
- fcStatusChangesSubs: Subscription;
56
- constructor();
57
- ngOnDestroy(): void;
58
- setLanguage(language?: string): void;
59
- getData(): any;
60
- getSchema(): any;
61
- getLayout(): any[];
62
- resetAllValues(): void;
63
- /**
64
- * 'buildRemoteError' function
65
- *
66
- * Example errors:
67
- * {
68
- * last_name: [ {
69
- * message: 'Last name must by start with capital letter.',
70
- * code: 'capital_letter'
71
- * } ],
72
- * email: [ {
73
- * message: 'Email must be from example.com domain.',
74
- * code: 'special_domain'
75
- * }, {
76
- * message: 'Email must contain an @ symbol.',
77
- * code: 'at_symbol'
78
- * } ]
79
- * }
80
- * //{ErrorMessages} errors
81
- */
82
- buildRemoteError(errors: ErrorMessages): void;
83
- validateData(newValue: any, updateSubscriptions?: boolean): void;
84
- buildFormGroupTemplate(formValues?: any, setValues?: boolean): void;
85
- buildFormGroup(): void;
86
- buildLayout(widgetLibrary: any): void;
87
- setOptions(newOptions: any): void;
88
- compileAjvSchema(): void;
89
- buildSchemaFromData(data?: any, requireAllFields?: boolean): any;
90
- buildSchemaFromLayout(layout?: any): any;
91
- setTpldata(newTpldata?: any): void;
92
- parseText(text?: string, value?: any, values?: any, key?: number | string): string;
93
- parseExpression(expression?: string, value?: any, values?: any, key?: number | string, tpldata?: any): any;
94
- setArrayItemTitle(parentCtx?: any, childNode?: any, index?: number): string;
95
- setItemTitle(ctx: any): string;
96
- evaluateCondition(layoutNode: any, dataIndex: number[]): boolean;
97
- initializeControl(ctx: any, bind?: boolean): boolean;
98
- formatErrors(errors: any, validationMessages?: any): string;
99
- updateValue(ctx: any, value: any): void;
100
- updateArrayCheckboxList(ctx: any, checkboxList: TitleMapItem[]): void;
101
- getFormControl(ctx: any): AbstractControl;
102
- getFormControlValue(ctx: any): AbstractControl;
103
- getFormControlGroup(ctx: any): UntypedFormArray | UntypedFormGroup;
104
- getFormControlName(ctx: any): string;
105
- getLayoutArray(ctx: any): any[];
106
- getParentNode(ctx: any): any;
107
- getDataPointer(ctx: any): string;
108
- getLayoutPointer(ctx: any): string;
109
- isControlBound(ctx: any): boolean;
110
- addItem(ctx: any, name?: string): boolean;
111
- moveArrayItem(ctx: any, oldIndex: number, newIndex: number): boolean;
112
- removeItem(ctx: any): boolean;
113
- static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormService, never>;
114
- static ɵprov: i0.ɵɵInjectableDeclaration<JsonSchemaFormService>;
115
- }
1
+ import { OnDestroy } from '@angular/core';
2
+ import { AbstractControl, UntypedFormArray, UntypedFormGroup } from '@angular/forms';
3
+ import { ErrorObject, Options } from 'ajv';
4
+ import { Subject, Subscription } from 'rxjs';
5
+ import * as i0 from "@angular/core";
6
+ export interface TitleMapItem {
7
+ name?: string;
8
+ value?: any;
9
+ checked?: boolean;
10
+ group?: string;
11
+ items?: TitleMapItem[];
12
+ }
13
+ export interface ErrorMessages {
14
+ [control_name: string]: {
15
+ message: string | Function | Object;
16
+ code: string;
17
+ }[];
18
+ }
19
+ export declare class JsonSchemaFormService implements OnDestroy {
20
+ JsonFormCompatibility: boolean;
21
+ ReactJsonSchemaFormCompatibility: boolean;
22
+ AngularSchemaFormCompatibility: boolean;
23
+ tpldata: any;
24
+ ajvOptions: Options;
25
+ ajv: any;
26
+ validateFormData: any;
27
+ formValues: any;
28
+ data: any;
29
+ schema: any;
30
+ layout: any[];
31
+ formGroupTemplate: any;
32
+ formGroup: any;
33
+ framework: any;
34
+ formOptions: any;
35
+ validData: any;
36
+ isValid: boolean;
37
+ ajvErrors: ErrorObject[];
38
+ validationErrors: any;
39
+ dataErrors: any;
40
+ formValueSubscription: any;
41
+ dataChanges: Subject<any>;
42
+ isValidChanges: Subject<any>;
43
+ validationErrorChanges: Subject<any>;
44
+ arrayMap: Map<string, number>;
45
+ dataMap: Map<string, any>;
46
+ dataRecursiveRefMap: Map<string, string>;
47
+ schemaRecursiveRefMap: Map<string, string>;
48
+ schemaRefLibrary: any;
49
+ layoutRefLibrary: any;
50
+ templateRefLibrary: any;
51
+ hasRootReference: boolean;
52
+ language: string;
53
+ defaultFormOptions: any;
54
+ fcValueChangesSubs: Subscription;
55
+ fcStatusChangesSubs: Subscription;
56
+ constructor();
57
+ ngOnDestroy(): void;
58
+ setLanguage(language?: string): void;
59
+ getData(): any;
60
+ getSchema(): any;
61
+ getLayout(): any[];
62
+ resetAllValues(): void;
63
+ /**
64
+ * 'buildRemoteError' function
65
+ *
66
+ * Example errors:
67
+ * {
68
+ * last_name: [ {
69
+ * message: 'Last name must by start with capital letter.',
70
+ * code: 'capital_letter'
71
+ * } ],
72
+ * email: [ {
73
+ * message: 'Email must be from example.com domain.',
74
+ * code: 'special_domain'
75
+ * }, {
76
+ * message: 'Email must contain an @ symbol.',
77
+ * code: 'at_symbol'
78
+ * } ]
79
+ * }
80
+ * //{ErrorMessages} errors
81
+ */
82
+ buildRemoteError(errors: ErrorMessages): void;
83
+ validateData(newValue: any, updateSubscriptions?: boolean): void;
84
+ buildFormGroupTemplate(formValues?: any, setValues?: boolean): void;
85
+ buildFormGroup(): void;
86
+ buildLayout(widgetLibrary: any): void;
87
+ setOptions(newOptions: any): void;
88
+ compileAjvSchema(): void;
89
+ buildSchemaFromData(data?: any, requireAllFields?: boolean): any;
90
+ buildSchemaFromLayout(layout?: any): any;
91
+ setTpldata(newTpldata?: any): void;
92
+ parseText(text?: string, value?: any, values?: any, key?: number | string): string;
93
+ parseExpression(expression?: string, value?: any, values?: any, key?: number | string, tpldata?: any): any;
94
+ setArrayItemTitle(parentCtx?: any, childNode?: any, index?: number): string;
95
+ setItemTitle(ctx: any): string;
96
+ evaluateCondition(layoutNode: any, dataIndex: number[]): boolean;
97
+ initializeControl(ctx: any, bind?: boolean): boolean;
98
+ formatErrors(errors: any, validationMessages?: any): string;
99
+ updateValue(ctx: any, value: any): void;
100
+ updateArrayCheckboxList(ctx: any, checkboxList: TitleMapItem[]): void;
101
+ getFormControl(ctx: any): AbstractControl;
102
+ getFormControlValue(ctx: any): AbstractControl;
103
+ getFormControlGroup(ctx: any): UntypedFormArray | UntypedFormGroup;
104
+ getFormControlName(ctx: any): string;
105
+ getLayoutArray(ctx: any): any[];
106
+ getParentNode(ctx: any): any;
107
+ getDataPointer(ctx: any): string;
108
+ getLayoutPointer(ctx: any): string;
109
+ isControlBound(ctx: any): boolean;
110
+ addItem(ctx: any, name?: string): boolean;
111
+ moveArrayItem(ctx: any, oldIndex: number, newIndex: number): boolean;
112
+ removeItem(ctx: any): boolean;
113
+ static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormService, never>;
114
+ static ɵprov: i0.ɵɵInjectableDeclaration<JsonSchemaFormService>;
115
+ }
@@ -1 +1 @@
1
- export declare const deValidationMessages: any;
1
+ export declare const deValidationMessages: any;
@@ -1 +1 @@
1
- export declare const enValidationMessages: any;
1
+ export declare const enValidationMessages: any;
@@ -1 +1 @@
1
- export declare const esValidationMessages: any;
1
+ export declare const esValidationMessages: any;
@@ -1 +1 @@
1
- export declare const frValidationMessages: any;
1
+ export declare const frValidationMessages: any;
@@ -1,7 +1,7 @@
1
- export { deValidationMessages } from './de-validation-messages';
2
- export { enValidationMessages } from './en-validation-messages';
3
- export { esValidationMessages } from './es-validation-messages';
4
- export { frValidationMessages } from './fr-validation-messages';
5
- export { itValidationMessages } from './it-validation-messages';
6
- export { ptValidationMessages } from './pt-validation-messages';
7
- export { zhValidationMessages } from './zh-validation-messages';
1
+ export { deValidationMessages } from './de-validation-messages';
2
+ export { enValidationMessages } from './en-validation-messages';
3
+ export { esValidationMessages } from './es-validation-messages';
4
+ export { frValidationMessages } from './fr-validation-messages';
5
+ export { itValidationMessages } from './it-validation-messages';
6
+ export { ptValidationMessages } from './pt-validation-messages';
7
+ export { zhValidationMessages } from './zh-validation-messages';
@@ -1 +1 @@
1
- export declare const itValidationMessages: any;
1
+ export declare const itValidationMessages: any;
@@ -1 +1 @@
1
- export declare const ptValidationMessages: any;
1
+ export declare const ptValidationMessages: any;
@@ -1 +1 @@
1
- export declare const zhValidationMessages: any;
1
+ export declare const zhValidationMessages: any;
@@ -1,21 +1,21 @@
1
- /**
2
- * 'convertSchemaToDraft6' function
3
- *
4
- * Converts a JSON Schema from draft 1 through 4 format to draft 6 format
5
- *
6
- * Inspired by on geraintluff's JSON Schema 3 to 4 compatibility function:
7
- * https://github.com/geraintluff/json-schema-compatibility
8
- * Also uses suggestions from AJV's JSON Schema 4 to 6 migration guide:
9
- * https://github.com/epoberezkin/ajv/releases/tag/5.0.0
10
- * And additional details from the official JSON Schema documentation:
11
- * http://json-schema.org
12
- *
13
- * // { object } originalSchema - JSON schema (draft 1, 2, 3, 4, or 6)
14
- * // { OptionObject = {} } options - options: parent schema changed?, schema draft number?
15
- * // { object } - JSON schema (draft 6)
16
- */
17
- export interface OptionObject {
18
- changed?: boolean;
19
- draft?: number;
20
- }
21
- export declare function convertSchemaToDraft6(schema: any, options?: OptionObject): any;
1
+ /**
2
+ * 'convertSchemaToDraft6' function
3
+ *
4
+ * Converts a JSON Schema from draft 1 through 4 format to draft 6 format
5
+ *
6
+ * Inspired by on geraintluff's JSON Schema 3 to 4 compatibility function:
7
+ * https://github.com/geraintluff/json-schema-compatibility
8
+ * Also uses suggestions from AJV's JSON Schema 4 to 6 migration guide:
9
+ * https://github.com/epoberezkin/ajv/releases/tag/5.0.0
10
+ * And additional details from the official JSON Schema documentation:
11
+ * http://json-schema.org
12
+ *
13
+ * // { object } originalSchema - JSON schema (draft 1, 2, 3, 4, or 6)
14
+ * // { OptionObject = {} } options - options: parent schema changed?, schema draft number?
15
+ * // { object } - JSON schema (draft 6)
16
+ */
17
+ export interface OptionObject {
18
+ changed?: boolean;
19
+ draft?: number;
20
+ }
21
+ export declare function convertSchemaToDraft6(schema: any, options?: OptionObject): any;
@@ -1,100 +1,100 @@
1
- import { AbstractControl } from '@angular/forms';
2
- import { Pointer } from './jsonpointer.functions';
3
- /**
4
- * FormGroup function library:
5
- *
6
- * buildFormGroupTemplate: Builds a FormGroupTemplate from schema
7
- *
8
- * buildFormGroup: Builds an Angular FormGroup from a FormGroupTemplate
9
- *
10
- * mergeValues:
11
- *
12
- * setRequiredFields:
13
- *
14
- * formatFormData:
15
- *
16
- * getControl:
17
- *
18
- * ---- TODO: ----
19
- * TODO: add buildFormGroupTemplateFromLayout function
20
- * buildFormGroupTemplateFromLayout: Builds a FormGroupTemplate from a form layout
21
- */
22
- /**
23
- * 'buildFormGroupTemplate' function
24
- *
25
- * Builds a template for an Angular FormGroup from a JSON Schema.
26
- *
27
- * TODO: add support for pattern properties
28
- * https://spacetelescope.github.io/understanding-json-schema/reference/object.html
29
- *
30
- * // {any} jsf -
31
- * // {any = null} nodeValue -
32
- * // {boolean = true} mapArrays -
33
- * // {string = ''} schemaPointer -
34
- * // {string = ''} dataPointer -
35
- * // {any = ''} templatePointer -
36
- * // {any} -
37
- */
38
- export declare function buildFormGroupTemplate(jsf: any, nodeValue?: any, setValues?: boolean, schemaPointer?: string, dataPointer?: string, templatePointer?: string): {
39
- controlType: string;
40
- controls: any;
41
- validators: any;
42
- value?: undefined;
43
- } | {
44
- controlType: string;
45
- value: {
46
- value: any;
47
- disabled: any;
48
- };
49
- validators: any;
50
- controls?: undefined;
51
- };
52
- /**
53
- * 'buildFormGroup' function
54
- *
55
- * // {any} template -
56
- * // {AbstractControl}
57
- */
58
- export declare function buildFormGroup(template: any): AbstractControl;
59
- /**
60
- * 'mergeValues' function
61
- *
62
- * // {any[]} ...valuesToMerge - Multiple values to merge
63
- * // {any} - Merged values
64
- */
65
- export declare function mergeValues(...valuesToMerge: any[]): any;
66
- /**
67
- * 'setRequiredFields' function
68
- *
69
- * // {schema} schema - JSON Schema
70
- * // {object} formControlTemplate - Form Control Template object
71
- * // {boolean} - true if any fields have been set to required, false if not
72
- */
73
- export declare function setRequiredFields(schema: any, formControlTemplate: any): boolean;
74
- /**
75
- * 'formatFormData' function
76
- *
77
- * // {any} formData - Angular FormGroup data object
78
- * // {Map<string, any>} dataMap -
79
- * // {Map<string, string>} recursiveRefMap -
80
- * // {Map<string, number>} arrayMap -
81
- * // {boolean = false} fixErrors - if TRUE, tries to fix data
82
- * // {any} - formatted data object
83
- */
84
- export declare function formatFormData(formData: any, dataMap: Map<string, any>, recursiveRefMap: Map<string, string>, arrayMap: Map<string, number>, returnEmptyFields?: boolean, fixErrors?: boolean): any;
85
- /**
86
- * 'getControl' function
87
- *
88
- * Uses a JSON Pointer for a data object to retrieve a control from
89
- * an Angular formGroup or formGroup template. (Note: though a formGroup
90
- * template is much simpler, its basic structure is idential to a formGroup).
91
- *
92
- * If the optional third parameter 'returnGroup' is set to TRUE, the group
93
- * containing the control is returned, rather than the control itself.
94
- *
95
- * // {FormGroup} formGroup - Angular FormGroup to get value from
96
- * // {Pointer} dataPointer - JSON Pointer (string or array)
97
- * // {boolean = false} returnGroup - If true, return group containing control
98
- * // {group} - Located value (or null, if no control found)
99
- */
100
- export declare function getControl(formGroup: any, dataPointer: Pointer, returnGroup?: boolean): any;
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { Pointer } from './jsonpointer.functions';
3
+ /**
4
+ * FormGroup function library:
5
+ *
6
+ * buildFormGroupTemplate: Builds a FormGroupTemplate from schema
7
+ *
8
+ * buildFormGroup: Builds an Angular FormGroup from a FormGroupTemplate
9
+ *
10
+ * mergeValues:
11
+ *
12
+ * setRequiredFields:
13
+ *
14
+ * formatFormData:
15
+ *
16
+ * getControl:
17
+ *
18
+ * ---- TODO: ----
19
+ * TODO: add buildFormGroupTemplateFromLayout function
20
+ * buildFormGroupTemplateFromLayout: Builds a FormGroupTemplate from a form layout
21
+ */
22
+ /**
23
+ * 'buildFormGroupTemplate' function
24
+ *
25
+ * Builds a template for an Angular FormGroup from a JSON Schema.
26
+ *
27
+ * TODO: add support for pattern properties
28
+ * https://spacetelescope.github.io/understanding-json-schema/reference/object.html
29
+ *
30
+ * // {any} jsf -
31
+ * // {any = null} nodeValue -
32
+ * // {boolean = true} mapArrays -
33
+ * // {string = ''} schemaPointer -
34
+ * // {string = ''} dataPointer -
35
+ * // {any = ''} templatePointer -
36
+ * // {any} -
37
+ */
38
+ export declare function buildFormGroupTemplate(jsf: any, nodeValue?: any, setValues?: boolean, schemaPointer?: string, dataPointer?: string, templatePointer?: string): {
39
+ controlType: string;
40
+ controls: any;
41
+ validators: any;
42
+ value?: undefined;
43
+ } | {
44
+ controlType: string;
45
+ value: {
46
+ value: any;
47
+ disabled: any;
48
+ };
49
+ validators: any;
50
+ controls?: undefined;
51
+ };
52
+ /**
53
+ * 'buildFormGroup' function
54
+ *
55
+ * // {any} template -
56
+ * // {AbstractControl}
57
+ */
58
+ export declare function buildFormGroup(template: any): AbstractControl;
59
+ /**
60
+ * 'mergeValues' function
61
+ *
62
+ * // {any[]} ...valuesToMerge - Multiple values to merge
63
+ * // {any} - Merged values
64
+ */
65
+ export declare function mergeValues(...valuesToMerge: any[]): any;
66
+ /**
67
+ * 'setRequiredFields' function
68
+ *
69
+ * // {schema} schema - JSON Schema
70
+ * // {object} formControlTemplate - Form Control Template object
71
+ * // {boolean} - true if any fields have been set to required, false if not
72
+ */
73
+ export declare function setRequiredFields(schema: any, formControlTemplate: any): boolean;
74
+ /**
75
+ * 'formatFormData' function
76
+ *
77
+ * // {any} formData - Angular FormGroup data object
78
+ * // {Map<string, any>} dataMap -
79
+ * // {Map<string, string>} recursiveRefMap -
80
+ * // {Map<string, number>} arrayMap -
81
+ * // {boolean = false} fixErrors - if TRUE, tries to fix data
82
+ * // {any} - formatted data object
83
+ */
84
+ export declare function formatFormData(formData: any, dataMap: Map<string, any>, recursiveRefMap: Map<string, string>, arrayMap: Map<string, number>, returnEmptyFields?: boolean, fixErrors?: boolean): any;
85
+ /**
86
+ * 'getControl' function
87
+ *
88
+ * Uses a JSON Pointer for a data object to retrieve a control from
89
+ * an Angular formGroup or formGroup template. (Note: though a formGroup
90
+ * template is much simpler, its basic structure is idential to a formGroup).
91
+ *
92
+ * If the optional third parameter 'returnGroup' is set to TRUE, the group
93
+ * containing the control is returned, rather than the control itself.
94
+ *
95
+ * // {FormGroup} formGroup - Angular FormGroup to get value from
96
+ * // {Pointer} dataPointer - JSON Pointer (string or array)
97
+ * // {boolean = false} returnGroup - If true, return group containing control
98
+ * // {group} - Located value (or null, if no control found)
99
+ */
100
+ export declare function getControl(formGroup: any, dataPointer: Pointer, returnGroup?: boolean): any;
@@ -1,19 +1,19 @@
1
- export declare const jsonSchemaFormatTests: {
2
- date: RegExp;
3
- time: RegExp;
4
- 'date-time': RegExp;
5
- email: RegExp;
6
- hostname: RegExp;
7
- ipv4: RegExp;
8
- ipv6: RegExp;
9
- uri: RegExp;
10
- 'uri-reference': RegExp;
11
- 'uri-template': RegExp;
12
- url: RegExp;
13
- uuid: RegExp;
14
- color: RegExp;
15
- 'json-pointer': RegExp;
16
- 'relative-json-pointer': RegExp;
17
- regex: (str: any) => boolean;
18
- };
19
- export type JsonSchemaFormatNames = 'date' | 'time' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'uri-template' | 'url' | 'uuid' | 'color' | 'json-pointer' | 'relative-json-pointer' | 'regex';
1
+ export declare const jsonSchemaFormatTests: {
2
+ date: RegExp;
3
+ time: RegExp;
4
+ 'date-time': RegExp;
5
+ email: RegExp;
6
+ hostname: RegExp;
7
+ ipv4: RegExp;
8
+ ipv6: RegExp;
9
+ uri: RegExp;
10
+ 'uri-reference': RegExp;
11
+ 'uri-template': RegExp;
12
+ url: RegExp;
13
+ uuid: RegExp;
14
+ color: RegExp;
15
+ 'json-pointer': RegExp;
16
+ 'relative-json-pointer': RegExp;
17
+ regex: (str: any) => boolean;
18
+ };
19
+ export type JsonSchemaFormatNames = 'date' | 'time' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'uri-template' | 'url' | 'uuid' | 'color' | 'json-pointer' | 'relative-json-pointer' | 'regex';
@@ -1,9 +1,9 @@
1
- export { _executeValidators, _executeAsyncValidators, _mergeObjects, _mergeErrors, isDefined, hasValue, isEmpty, isString, isNumber, isInteger, isBoolean, isFunction, isObject, isArray, isDate, isMap, isSet, isPromise, isObservable, getType, isType, isPrimitive, toJavaScriptType, toSchemaType, _toPromise, toObservable, inArray, xor, SchemaPrimitiveType, SchemaType, JavaScriptPrimitiveType, JavaScriptType, PrimitiveValue, PlainObject, IValidatorFn, AsyncIValidatorFn } from './validator.functions';
2
- export { addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject, uniqueItems, commonItems, fixTitle, toTitleCase } from './utility.functions';
3
- export { Pointer, JsonPointer } from './jsonpointer.functions';
4
- export { JsonValidators } from './json.validators';
5
- export { buildSchemaFromLayout, buildSchemaFromData, getFromSchema, removeRecursiveReferences, getInputType, checkInlineType, isInputRequired, updateInputOptions, getTitleMapFromOneOf, getControlValidators, resolveSchemaReferences, getSubSchema, combineAllOf, fixRequiredArrayProperties } from './json-schema.functions';
6
- export { convertSchemaToDraft6 } from './convert-schema-to-draft6.function';
7
- export { mergeSchemas } from './merge-schemas.function';
8
- export { buildFormGroupTemplate, buildFormGroup, formatFormData, getControl, setRequiredFields } from './form-group.functions';
9
- export { buildLayout, buildLayoutFromSchema, mapLayout, getLayoutNode, buildTitleMap } from './layout.functions';
1
+ export { _executeValidators, _executeAsyncValidators, _mergeObjects, _mergeErrors, isDefined, hasValue, isEmpty, isString, isNumber, isInteger, isBoolean, isFunction, isObject, isArray, isDate, isMap, isSet, isPromise, isObservable, getType, isType, isPrimitive, toJavaScriptType, toSchemaType, _toPromise, toObservable, inArray, xor, SchemaPrimitiveType, SchemaType, JavaScriptPrimitiveType, JavaScriptType, PrimitiveValue, PlainObject, IValidatorFn, AsyncIValidatorFn } from './validator.functions';
2
+ export { addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject, uniqueItems, commonItems, fixTitle, toTitleCase } from './utility.functions';
3
+ export { Pointer, JsonPointer } from './jsonpointer.functions';
4
+ export { JsonValidators } from './json.validators';
5
+ export { buildSchemaFromLayout, buildSchemaFromData, getFromSchema, removeRecursiveReferences, getInputType, checkInlineType, isInputRequired, updateInputOptions, getTitleMapFromOneOf, getControlValidators, resolveSchemaReferences, getSubSchema, combineAllOf, fixRequiredArrayProperties } from './json-schema.functions';
6
+ export { convertSchemaToDraft6 } from './convert-schema-to-draft6.function';
7
+ export { mergeSchemas } from './merge-schemas.function';
8
+ export { buildFormGroupTemplate, buildFormGroup, formatFormData, getControl, setRequiredFields } from './form-group.functions';
9
+ export { buildLayout, buildLayoutFromSchema, mapLayout, getLayoutNode, buildTitleMap } from './layout.functions';