@ng-formworks/core 16.2.7 → 16.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 (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +833 -0
  3. package/esm2022/lib/framework-library/framework-library.service.mjs +175 -0
  4. package/esm2022/lib/framework-library/framework.mjs +15 -0
  5. package/esm2022/lib/framework-library/no-framework.component.mjs +18 -0
  6. package/esm2022/lib/framework-library/no-framework.module.mjs +27 -0
  7. package/esm2022/lib/framework-library/no.framework.mjs +19 -0
  8. package/esm2022/lib/json-schema-form.component.mjs +765 -0
  9. package/esm2022/lib/json-schema-form.module.mjs +26 -0
  10. package/esm2022/lib/json-schema-form.service.mjs +676 -0
  11. package/esm2022/lib/locale/de-validation-messages.mjs +60 -0
  12. package/esm2022/lib/locale/en-validation-messages.mjs +60 -0
  13. package/esm2022/lib/locale/es-validation-messages.mjs +57 -0
  14. package/esm2022/lib/locale/fr-validation-messages.mjs +60 -0
  15. package/esm2022/lib/locale/index.mjs +8 -0
  16. package/esm2022/lib/locale/it-validation-messages.mjs +60 -0
  17. package/esm2022/lib/locale/pt-validation-messages.mjs +60 -0
  18. package/esm2022/lib/locale/zh-validation-messages.mjs +60 -0
  19. package/esm2022/lib/shared/convert-schema-to-draft6.function.mjs +300 -0
  20. package/esm2022/lib/shared/form-group.functions.mjs +442 -0
  21. package/esm2022/lib/shared/format-regex.constants.mjs +54 -0
  22. package/esm2022/lib/shared/index.mjs +12 -0
  23. package/esm2022/lib/shared/json-schema.functions.mjs +784 -0
  24. package/esm2022/lib/shared/json.validators.mjs +884 -0
  25. package/esm2022/lib/shared/jsonpointer.functions.mjs +1026 -0
  26. package/esm2022/lib/shared/layout.functions.mjs +1154 -0
  27. package/esm2022/lib/shared/merge-schemas.function.mjs +345 -0
  28. package/esm2022/lib/shared/utility.functions.mjs +380 -0
  29. package/esm2022/lib/shared/validator.functions.mjs +584 -0
  30. package/esm2022/lib/widget-library/add-reference.component.mjs +61 -0
  31. package/esm2022/lib/widget-library/button.component.mjs +72 -0
  32. package/esm2022/lib/widget-library/checkbox.component.mjs +105 -0
  33. package/esm2022/lib/widget-library/checkboxes.component.mjs +147 -0
  34. package/esm2022/lib/widget-library/file.component.mjs +35 -0
  35. package/esm2022/lib/widget-library/hidden.component.mjs +54 -0
  36. package/esm2022/lib/widget-library/index.mjs +55 -0
  37. package/esm2022/lib/widget-library/input.component.mjs +119 -0
  38. package/esm2022/lib/widget-library/message.component.mjs +38 -0
  39. package/esm2022/lib/widget-library/none.component.mjs +21 -0
  40. package/esm2022/lib/widget-library/number.component.mjs +123 -0
  41. package/esm2022/lib/widget-library/one-of.component.mjs +35 -0
  42. package/esm2022/lib/widget-library/orderable.directive.mjs +123 -0
  43. package/esm2022/lib/widget-library/radios.component.mjs +153 -0
  44. package/esm2022/lib/widget-library/root.component.mjs +79 -0
  45. package/esm2022/lib/widget-library/section.component.mjs +199 -0
  46. package/esm2022/lib/widget-library/select-framework.component.mjs +51 -0
  47. package/esm2022/lib/widget-library/select-widget.component.mjs +46 -0
  48. package/esm2022/lib/widget-library/select.component.mjs +150 -0
  49. package/esm2022/lib/widget-library/submit.component.mjs +82 -0
  50. package/esm2022/lib/widget-library/tab.component.mjs +41 -0
  51. package/esm2022/lib/widget-library/tabs.component.mjs +108 -0
  52. package/esm2022/lib/widget-library/template.component.mjs +46 -0
  53. package/esm2022/lib/widget-library/textarea.component.mjs +104 -0
  54. package/esm2022/lib/widget-library/widget-library.module.mjs +42 -0
  55. package/esm2022/lib/widget-library/widget-library.service.mjs +226 -0
  56. package/esm2022/ng-formworks-core.mjs +5 -0
  57. package/esm2022/public_api.mjs +13 -0
  58. package/fesm2022/ng-formworks-core.mjs +10147 -0
  59. package/fesm2022/ng-formworks-core.mjs.map +1 -0
  60. package/index.d.ts +5 -0
  61. package/lib/framework-library/framework-library.service.d.ts +55 -0
  62. package/lib/framework-library/framework.d.ts +13 -0
  63. package/lib/framework-library/no-framework.component.d.ts +8 -0
  64. package/lib/framework-library/no-framework.module.d.ts +9 -0
  65. package/lib/framework-library/no.framework.d.ts +10 -0
  66. package/lib/json-schema-form.component.d.ts +218 -0
  67. package/lib/json-schema-form.module.d.ts +11 -0
  68. package/lib/json-schema-form.service.d.ts +115 -0
  69. package/lib/locale/de-validation-messages.d.ts +1 -0
  70. package/lib/locale/en-validation-messages.d.ts +1 -0
  71. package/lib/locale/es-validation-messages.d.ts +1 -0
  72. package/lib/locale/fr-validation-messages.d.ts +1 -0
  73. package/lib/locale/it-validation-messages.d.ts +1 -0
  74. package/lib/locale/pt-validation-messages.d.ts +1 -0
  75. package/lib/locale/zh-validation-messages.d.ts +1 -0
  76. package/lib/shared/convert-schema-to-draft6.function.d.ts +21 -0
  77. package/lib/shared/form-group.functions.d.ts +100 -0
  78. package/lib/shared/format-regex.constants.d.ts +19 -0
  79. package/lib/shared/index.d.ts +9 -0
  80. package/lib/shared/json-schema.functions.d.ts +193 -0
  81. package/lib/shared/json.validators.d.ts +441 -0
  82. package/lib/shared/jsonpointer.functions.d.ts +416 -0
  83. package/lib/shared/layout.functions.d.ts +83 -0
  84. package/lib/shared/merge-schemas.function.d.ts +19 -0
  85. package/lib/shared/utility.functions.d.ts +165 -0
  86. package/{src/lib/shared/validator.functions.ts → lib/shared/validator.functions.d.ts} +40 -277
  87. package/lib/widget-library/add-reference.component.d.ts +20 -0
  88. package/lib/widget-library/button.component.d.ts +21 -0
  89. package/lib/widget-library/checkbox.component.d.ts +24 -0
  90. package/lib/widget-library/checkboxes.component.d.ts +24 -0
  91. package/lib/widget-library/file.component.d.ts +21 -0
  92. package/lib/widget-library/hidden.component.d.ts +19 -0
  93. package/{src/lib/widget-library/index.ts → lib/widget-library/index.d.ts} +1 -10
  94. package/lib/widget-library/input.component.d.ts +22 -0
  95. package/lib/widget-library/message.component.d.ts +15 -0
  96. package/lib/widget-library/none.component.d.ts +8 -0
  97. package/lib/widget-library/number.component.d.ts +25 -0
  98. package/lib/widget-library/one-of.component.d.ts +21 -0
  99. package/lib/widget-library/orderable.directive.d.ts +41 -0
  100. package/lib/widget-library/radios.component.d.ts +23 -0
  101. package/lib/widget-library/root.component.d.ts +17 -0
  102. package/lib/widget-library/section.component.d.ts +19 -0
  103. package/lib/widget-library/select-framework.component.d.ts +18 -0
  104. package/lib/widget-library/select-widget.component.d.ts +18 -0
  105. package/lib/widget-library/select.component.d.ts +24 -0
  106. package/lib/widget-library/submit.component.d.ts +24 -0
  107. package/lib/widget-library/tab.component.d.ts +14 -0
  108. package/lib/widget-library/tabs.component.d.ts +20 -0
  109. package/lib/widget-library/template.component.d.ts +18 -0
  110. package/lib/widget-library/textarea.component.d.ts +21 -0
  111. package/lib/widget-library/widget-library.module.d.ts +31 -0
  112. package/lib/widget-library/widget-library.service.d.ts +22 -0
  113. package/package.json +64 -53
  114. package/{src/public_api.ts → public_api.d.ts} +1 -13
  115. package/karma.conf.js +0 -46
  116. package/ng-package.json +0 -11
  117. package/src/lib/framework-library/framework-library.service.ts +0 -195
  118. package/src/lib/framework-library/framework.ts +0 -11
  119. package/src/lib/framework-library/no-framework.component.html +0 -2
  120. package/src/lib/framework-library/no-framework.component.ts +0 -11
  121. package/src/lib/framework-library/no-framework.module.ts +0 -18
  122. package/src/lib/framework-library/no.framework.ts +0 -11
  123. package/src/lib/json-schema-form.component.html +0 -7
  124. package/src/lib/json-schema-form.component.ts +0 -809
  125. package/src/lib/json-schema-form.module.ts +0 -17
  126. package/src/lib/json-schema-form.service.ts +0 -907
  127. package/src/lib/locale/de-validation-messages.ts +0 -58
  128. package/src/lib/locale/en-validation-messages.ts +0 -58
  129. package/src/lib/locale/es-validation-messages.ts +0 -55
  130. package/src/lib/locale/fr-validation-messages.ts +0 -58
  131. package/src/lib/locale/it-validation-messages.ts +0 -58
  132. package/src/lib/locale/pt-validation-messages.ts +0 -58
  133. package/src/lib/locale/zh-validation-messages.ts +0 -58
  134. package/src/lib/locale-dates/en-US.ts +0 -5
  135. package/src/lib/shared/convert-schema-to-draft6.function.ts +0 -321
  136. package/src/lib/shared/form-group.functions.ts +0 -522
  137. package/src/lib/shared/format-regex.constants.ts +0 -73
  138. package/src/lib/shared/index.ts +0 -40
  139. package/src/lib/shared/json-schema.functions.ts +0 -788
  140. package/src/lib/shared/json.validators.ts +0 -878
  141. package/src/lib/shared/jsonpointer.functions.ts +0 -1012
  142. package/src/lib/shared/jspointer.functions.json.spec.ts +0 -103
  143. package/src/lib/shared/layout.functions.ts +0 -1233
  144. package/src/lib/shared/merge-schemas.function.ts +0 -329
  145. package/src/lib/shared/utility.functions.ts +0 -373
  146. package/src/lib/shared/validator.functions.spec.ts +0 -55
  147. package/src/lib/widget-library/add-reference.component.ts +0 -59
  148. package/src/lib/widget-library/button.component.ts +0 -54
  149. package/src/lib/widget-library/checkbox.component.ts +0 -74
  150. package/src/lib/widget-library/checkboxes.component.ts +0 -104
  151. package/src/lib/widget-library/file.component.ts +0 -36
  152. package/src/lib/widget-library/hidden.component.ts +0 -39
  153. package/src/lib/widget-library/input.component.ts +0 -76
  154. package/src/lib/widget-library/message.component.ts +0 -29
  155. package/src/lib/widget-library/none.component.ts +0 -12
  156. package/src/lib/widget-library/number.component.ts +0 -79
  157. package/src/lib/widget-library/one-of.component.ts +0 -36
  158. package/src/lib/widget-library/orderable.directive.ts +0 -130
  159. package/src/lib/widget-library/radios.component.ts +0 -101
  160. package/src/lib/widget-library/root.component.ts +0 -78
  161. package/src/lib/widget-library/section.component.ts +0 -133
  162. package/src/lib/widget-library/select-framework.component.ts +0 -50
  163. package/src/lib/widget-library/select-widget.component.ts +0 -46
  164. package/src/lib/widget-library/select.component.ts +0 -96
  165. package/src/lib/widget-library/submit.component.ts +0 -68
  166. package/src/lib/widget-library/tab.component.ts +0 -29
  167. package/src/lib/widget-library/tabs.component.ts +0 -83
  168. package/src/lib/widget-library/template.component.ts +0 -52
  169. package/src/lib/widget-library/textarea.component.ts +0 -68
  170. package/src/lib/widget-library/widget-library.module.ts +0 -13
  171. package/src/lib/widget-library/widget-library.service.ts +0 -234
  172. package/src/test.ts +0 -18
  173. package/tsconfig.lib.json +0 -25
  174. package/tsconfig.lib.prod.json +0 -9
  175. package/tsconfig.spec.json +0 -17
  176. package/tslint.json +0 -11
  177. /package/{src/lib/locale/index.ts → lib/locale/index.d.ts} +0 -0
@@ -1,6 +1,5 @@
1
1
  import { AbstractControl } from '@angular/forms';
2
- import { from, Observable } from 'rxjs';
3
-
2
+ import { Observable } from 'rxjs';
4
3
  /**
5
4
  * Validator utility function library:
6
5
  *
@@ -30,23 +29,16 @@ import { from, Observable } from 'rxjs';
30
29
  * argument which, if set to TRUE, causes the validator to perform
31
30
  * the opposite of its original function.
32
31
  */
33
-
34
- export type SchemaPrimitiveType =
35
- 'string' | 'number' | 'integer' | 'boolean' | 'null';
36
- export type SchemaType =
37
- 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'object' | 'array';
38
- export type JavaScriptPrimitiveType =
39
- 'string' | 'number' | 'boolean' | 'null' | 'undefined';
40
- export type JavaScriptType =
41
- 'string' | 'number' | 'boolean' | 'null' | 'undefined' | 'object' | 'array' |
42
- 'map' | 'set' | 'arguments' | 'date' | 'error' | 'function' | 'json' |
43
- 'math' | 'regexp'; // Note: this list is incomplete
32
+ export type SchemaPrimitiveType = 'string' | 'number' | 'integer' | 'boolean' | 'null';
33
+ export type SchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'object' | 'array';
34
+ export type JavaScriptPrimitiveType = 'string' | 'number' | 'boolean' | 'null' | 'undefined';
35
+ export type JavaScriptType = 'string' | 'number' | 'boolean' | 'null' | 'undefined' | 'object' | 'array' | 'map' | 'set' | 'arguments' | 'date' | 'error' | 'function' | 'json' | 'math' | 'regexp';
44
36
  export type PrimitiveValue = string | number | boolean | null | undefined;
45
- export interface PlainObject { [k: string]: any; }
46
-
37
+ export interface PlainObject {
38
+ [k: string]: any;
39
+ }
47
40
  export type IValidatorFn = (c: AbstractControl, i?: boolean) => PlainObject;
48
41
  export type AsyncIValidatorFn = (c: AbstractControl, i?: boolean) => any;
49
-
50
42
  /**
51
43
  * '_executeValidators' utility function
52
44
  *
@@ -59,10 +51,7 @@ export type AsyncIValidatorFn = (c: AbstractControl, i?: boolean) => any;
59
51
  * // { boolean } invert - invert?
60
52
  * // { PlainObject[] } - array of nulls and error message
61
53
  */
62
- export function _executeValidators(control, validators, invert = false) {
63
- return validators.map(validator => validator(control, invert));
64
- }
65
-
54
+ export declare function _executeValidators(control: any, validators: any, invert?: boolean): any;
66
55
  /**
67
56
  * '_executeAsyncValidators' utility function
68
57
  *
@@ -75,10 +64,7 @@ export function _executeValidators(control, validators, invert = false) {
75
64
  * // { boolean } invert - invert?
76
65
  * // - array of observable nulls and error message
77
66
  */
78
- export function _executeAsyncValidators(control, validators, invert = false) {
79
- return validators.map(validator => validator(control, invert));
80
- }
81
-
67
+ export declare function _executeAsyncValidators(control: any, validators: any, invert?: boolean): any;
82
68
  /**
83
69
  * '_mergeObjects' utility function
84
70
  *
@@ -89,25 +75,7 @@ export function _executeAsyncValidators(control, validators, invert = false) {
89
75
  * // { PlainObject[] } objects - one or more objects to merge
90
76
  * // { PlainObject } - merged object
91
77
  */
92
- export function _mergeObjects(...objects) {
93
- const mergedObject: PlainObject = { };
94
- for (const currentObject of objects) {
95
- if (isObject(currentObject)) {
96
- for (const key of Object.keys(currentObject)) {
97
- const currentValue = currentObject[key];
98
- const mergedValue = mergedObject[key];
99
- mergedObject[key] = !isDefined(mergedValue) ? currentValue :
100
- key === 'not' && isBoolean(mergedValue, 'strict') &&
101
- isBoolean(currentValue, 'strict') ? xor(mergedValue, currentValue) :
102
- getType(mergedValue) === 'object' && getType(currentValue) === 'object' ?
103
- _mergeObjects(mergedValue, currentValue) :
104
- currentValue;
105
- }
106
- }
107
- }
108
- return mergedObject;
109
- }
110
-
78
+ export declare function _mergeObjects(...objects: any[]): PlainObject;
111
79
  /**
112
80
  * '_mergeErrors' utility function
113
81
  *
@@ -117,11 +85,7 @@ export function _mergeObjects(...objects) {
117
85
  * // { PlainObject[] } arrayOfErrors - array of objects
118
86
  * // { PlainObject } - merged object, or null if no usable input objectcs
119
87
  */
120
- export function _mergeErrors(arrayOfErrors) {
121
- const mergedErrors = _mergeObjects(...arrayOfErrors);
122
- return isEmpty(mergedErrors) ? null : mergedErrors;
123
- }
124
-
88
+ export declare function _mergeErrors(arrayOfErrors: any): PlainObject;
125
89
  /**
126
90
  * 'isDefined' utility function
127
91
  *
@@ -131,10 +95,7 @@ export function _mergeErrors(arrayOfErrors) {
131
95
  * // value - the value to check
132
96
  * // { boolean } - false if undefined or null, otherwise true
133
97
  */
134
- export function isDefined(value) {
135
- return value !== undefined && value !== null;
136
- }
137
-
98
+ export declare function isDefined(value: any): boolean;
138
99
  /**
139
100
  * 'hasValue' utility function
140
101
  *
@@ -147,10 +108,7 @@ export function isDefined(value) {
147
108
  * // value - the value to check
148
109
  * // { boolean } - false if undefined, null, or '', otherwise true
149
110
  */
150
- export function hasValue(value) {
151
- return value !== undefined && value !== null && value !== '';
152
- }
153
-
111
+ export declare function hasValue(value: any): boolean;
154
112
  /**
155
113
  * 'isEmpty' utility function
156
114
  *
@@ -159,12 +117,7 @@ export function hasValue(value) {
159
117
  * // value - the value to check
160
118
  * // { boolean } - false if undefined, null, or '', otherwise true
161
119
  */
162
- export function isEmpty(value) {
163
- if (isArray(value)) { return !value.length; }
164
- if (isObject(value)) { return !Object.keys(value).length; }
165
- return value === undefined || value === null || value === '';
166
- }
167
-
120
+ export declare function isEmpty(value: any): boolean;
168
121
  /**
169
122
  * 'isString' utility function
170
123
  *
@@ -173,10 +126,7 @@ export function isEmpty(value) {
173
126
  * // value - the value to check
174
127
  * // { boolean } - true if string, false if not
175
128
  */
176
- export function isString(value) {
177
- return typeof value === 'string';
178
- }
179
-
129
+ export declare function isString(value: any): boolean;
180
130
  /**
181
131
  * 'isNumber' utility function
182
132
  *
@@ -186,11 +136,7 @@ export function isString(value) {
186
136
  * // { any = false } strict - if truthy, also checks JavaScript tyoe
187
137
  * // { boolean } - true if number, false if not
188
138
  */
189
- export function isNumber(value, strict: any = false) {
190
- if (strict && typeof value !== 'number') { return false; }
191
- return !isNaN(value) && value !== value / 0;
192
- }
193
-
139
+ export declare function isNumber(value: any, strict?: any): boolean;
194
140
  /**
195
141
  * 'isInteger' utility function
196
142
  *
@@ -200,11 +146,7 @@ export function isNumber(value, strict: any = false) {
200
146
  * // { any = false } strict - if truthy, also checks JavaScript tyoe
201
147
  * // {boolean } - true if number, false if not
202
148
  */
203
- export function isInteger(value, strict: any = false) {
204
- if (strict && typeof value !== 'number') { return false; }
205
- return !isNaN(value) && value !== value / 0 && value % 1 === 0;
206
- }
207
-
149
+ export declare function isInteger(value: any, strict?: any): boolean;
208
150
  /**
209
151
  * 'isBoolean' utility function
210
152
  *
@@ -215,46 +157,14 @@ export function isInteger(value, strict: any = false) {
215
157
  * if TRUE or FALSE, checks only for that value
216
158
  * // { boolean } - true if boolean, false if not
217
159
  */
218
- export function isBoolean(value, option: any = null) {
219
- if (option === 'strict') { return value === true || value === false; }
220
- if (option === true) {
221
- return value === true || value === 1 || value === 'true' || value === '1';
222
- }
223
- if (option === false) {
224
- return value === false || value === 0 || value === 'false' || value === '0';
225
- }
226
- return value === true || value === 1 || value === 'true' || value === '1' ||
227
- value === false || value === 0 || value === 'false' || value === '0';
228
- }
229
-
230
- export function isFunction(item: any): boolean {
231
- return typeof item === 'function';
232
- }
233
-
234
- export function isObject(item: any): boolean {
235
- return item !== null && typeof item === 'object';
236
- }
237
-
238
- export function isArray(item: any): boolean {
239
- return Array.isArray(item);
240
- }
241
-
242
- export function isDate(item: any): boolean {
243
- return !!item && Object.prototype.toString.call(item) === '[object Date]';
244
- }
245
-
246
- export function isMap(item: any): boolean {
247
- return !!item && Object.prototype.toString.call(item) === '[object Map]';
248
- }
249
-
250
- export function isSet(item: any): boolean {
251
- return !!item && Object.prototype.toString.call(item) === '[object Set]';
252
- }
253
-
254
- export function isSymbol(item: any): boolean {
255
- return typeof item === 'symbol';
256
- }
257
-
160
+ export declare function isBoolean(value: any, option?: any): boolean;
161
+ export declare function isFunction(item: any): boolean;
162
+ export declare function isObject(item: any): boolean;
163
+ export declare function isArray(item: any): boolean;
164
+ export declare function isDate(item: any): boolean;
165
+ export declare function isMap(item: any): boolean;
166
+ export declare function isSet(item: any): boolean;
167
+ export declare function isSymbol(item: any): boolean;
258
168
  /**
259
169
  * 'getType' function
260
170
  *
@@ -289,17 +199,7 @@ export function isSymbol(item: any): boolean {
289
199
  * // { any = false } strict - if truthy, also checks JavaScript tyoe
290
200
  * // { SchemaType }
291
201
  */
292
- export function getType(value, strict: any = false) {
293
- if (!isDefined(value)) { return 'null'; }
294
- if (isArray(value)) { return 'array'; }
295
- if (isObject(value)) { return 'object'; }
296
- if (isBoolean(value, 'strict')) { return 'boolean'; }
297
- if (isInteger(value, strict)) { return 'integer'; }
298
- if (isNumber(value, strict)) { return 'number'; }
299
- if (isString(value) || (!strict && isDate(value))) { return 'string'; }
300
- return null;
301
- }
302
-
202
+ export declare function getType(value: any, strict?: any): "string" | "number" | "integer" | "boolean" | "null" | "object" | "array";
303
203
  /**
304
204
  * 'isType' function
305
205
  *
@@ -310,24 +210,7 @@ export function getType(value, strict: any = false) {
310
210
  * // { SchemaPrimitiveType } type - type to check
311
211
  * // { boolean }
312
212
  */
313
- export function isType(value, type) {
314
- switch (type) {
315
- case 'string':
316
- return isString(value) || isDate(value);
317
- case 'number':
318
- return isNumber(value);
319
- case 'integer':
320
- return isInteger(value);
321
- case 'boolean':
322
- return isBoolean(value);
323
- case 'null':
324
- return !hasValue(value);
325
- default:
326
- console.error(`isType error: "${type}" is not a recognized type.`);
327
- return null;
328
- }
329
- }
330
-
213
+ export declare function isType(value: any, type: any): boolean;
331
214
  /**
332
215
  * 'isPrimitive' function
333
216
  *
@@ -337,26 +220,16 @@ export function isType(value, type) {
337
220
  * // value - value to check
338
221
  * // { boolean }
339
222
  */
340
- export function isPrimitive(value) {
341
- return (isString(value) || isNumber(value) ||
342
- isBoolean(value, 'strict') || value === null);
343
- }
344
-
223
+ export declare function isPrimitive(value: any): boolean;
345
224
  /**
346
- *
347
- * @param date
225
+ *
226
+ * @param date
348
227
  * @returns {string}
349
228
  * exmaple:
350
229
  * toDateString('2018-01-01') = '2018-01-01'
351
230
  * toDateString('2018-01-30T00:00:00.000Z') = '2018-01-30'
352
231
  */
353
- export const toIsoString = (date: Date) => {
354
- const day = date.getDate();
355
- const month = date.getMonth() + 1;
356
- const year = date.getFullYear();
357
- return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
358
- }
359
-
232
+ export declare const toIsoString: (date: Date) => string;
360
233
  /**
361
234
  * 'toJavaScriptType' function
362
235
  *
@@ -388,36 +261,7 @@ export const toIsoString = (date: Date) => {
388
261
  * // { boolean = false } strictIntegers - if FALSE, treat integers as numbers
389
262
  * // { PrimitiveValue }
390
263
  */
391
- export function toJavaScriptType(value, types, strictIntegers = true) {
392
- if (!isDefined(value)) { return null; }
393
- if (isString(types)) { types = [types]; }
394
- if (strictIntegers && inArray('integer', types)) {
395
- if (isInteger(value, 'strict')) { return value; }
396
- if (isInteger(value)) { return parseInt(value, 10); }
397
- }
398
- if (inArray('number', types) || (!strictIntegers && inArray('integer', types))) {
399
- if (isNumber(value, 'strict')) { return value; }
400
- if (isNumber(value)) { return parseFloat(value); }
401
- }
402
- if (inArray('string', types)) {
403
- if (isString(value)) { return value; }
404
- // If value is a date, and types includes 'string',
405
- // convert the date to a string
406
- if (isDate(value)) { return toIsoString(value); }
407
- if (isNumber(value)) { return value.toString(); }
408
- }
409
- // If value is a date, and types includes 'integer' or 'number',
410
- // but not 'string', convert the date to a number
411
- if (isDate(value) && (inArray('integer', types) || inArray('number', types))) {
412
- return value.getTime();
413
- }
414
- if (inArray('boolean', types)) {
415
- if (isBoolean(value, true)) { return true; }
416
- if (isBoolean(value, false)) { return false; }
417
- }
418
- return null;
419
- }
420
-
264
+ export declare function toJavaScriptType(value: any, types: any, strictIntegers?: boolean): any;
421
265
  /**
422
266
  * 'toSchemaType' function
423
267
  *
@@ -462,108 +306,35 @@ export function toJavaScriptType(value, types, strictIntegers = true) {
462
306
  * // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - allowed types to convert to
463
307
  * // { PrimitiveValue }
464
308
  */
465
- export function toSchemaType(value, types) {
466
- if (!isArray(<SchemaPrimitiveType>types)) {
467
- types = <SchemaPrimitiveType[]>[types];
468
- }
469
- if ((<SchemaPrimitiveType[]>types).includes('null') && !hasValue(value)) {
470
- return null;
471
- }
472
- if ((<SchemaPrimitiveType[]>types).includes('boolean') && !isBoolean(value, 'strict')) {
473
- return value;
474
- }
475
- if ((<SchemaPrimitiveType[]>types).includes('integer')) {
476
- const testValue = toJavaScriptType(value, 'integer');
477
- if (testValue !== null) { return +testValue; }
478
- }
479
- if ((<SchemaPrimitiveType[]>types).includes('number')) {
480
- const testValue = toJavaScriptType(value, 'number');
481
- if (testValue !== null) { return +testValue; }
482
- }
483
- if (
484
- (isString(value) || isNumber(value, 'strict')) &&
485
- (<SchemaPrimitiveType[]>types).includes('string')
486
- ) { // Convert number to string
487
- return toJavaScriptType(value, 'string');
488
- }
489
- if ((<SchemaPrimitiveType[]>types).includes('boolean') && isBoolean(value)) {
490
- return toJavaScriptType(value, 'boolean');
491
- }
492
- if ((<SchemaPrimitiveType[]>types).includes('string')) { // Convert null & boolean to string
493
- if (value === null) { return ''; }
494
- const testValue = toJavaScriptType(value, 'string');
495
- if (testValue !== null) { return testValue; }
496
- }
497
- if ((
498
- (<SchemaPrimitiveType[]>types).includes('number') ||
499
- (<SchemaPrimitiveType[]>types).includes('integer'))
500
- ) {
501
- if (value === true) { return 1; } // Convert boolean & null to number
502
- if (value === false || value === null || value === '') { return 0; }
503
- }
504
- if ((<SchemaPrimitiveType[]>types).includes('number')) { // Convert mixed string to number
505
- const testValue = parseFloat(<string>value);
506
- if (!!testValue) { return testValue; }
507
- }
508
- if ((<SchemaPrimitiveType[]>types).includes('integer')) { // Convert string or number to integer
509
- const testValue = parseInt(<string>value, 10);
510
- if (!!testValue) { return testValue; }
511
- }
512
- if ((<SchemaPrimitiveType[]>types).includes('boolean')) { // Convert anything to boolean
513
- return !!value;
514
- }
515
- if ((
516
- (<SchemaPrimitiveType[]>types).includes('number') ||
517
- (<SchemaPrimitiveType[]>types).includes('integer')
518
- ) && !(<SchemaPrimitiveType[]>types).includes('null')
519
- ) {
520
- return 0; // If null not allowed, return 0 for non-convertable values
521
- }
522
- }
523
-
309
+ export declare function toSchemaType(value: any, types: any): any;
524
310
  /**
525
311
  * 'isPromise' function
526
312
  *
527
313
  * // object
528
314
  * // { boolean }
529
315
  */
530
- export function isPromise(object): object is Promise<any> {
531
- return !!object && typeof object.then === 'function';
532
- }
533
-
316
+ export declare function isPromise(object: any): object is Promise<any>;
534
317
  /**
535
318
  * 'isObservable' function
536
319
  *
537
320
  * // object
538
321
  * // { boolean }
539
322
  */
540
- export function isObservable(object): object is Observable<any> {
541
- return !!object && typeof object.subscribe === 'function';
542
- }
543
-
323
+ export declare function isObservable(object: any): object is Observable<any>;
544
324
  /**
545
325
  * '_toPromise' function
546
326
  *
547
327
  * // { object } object
548
328
  * // { Promise<any> }
549
329
  */
550
- export function _toPromise(object): Promise<any> {
551
- return isPromise(object) ? object : object.toPromise();
552
- }
553
-
330
+ export declare function _toPromise(object: any): Promise<any>;
554
331
  /**
555
332
  * 'toObservable' function
556
333
  *
557
334
  * // { object } object
558
335
  * // { Observable<any> }
559
336
  */
560
- export function toObservable(object): Observable<any> {
561
- const observable = isPromise(object) ? from(object) : object;
562
- if (isObservable(observable)) { return observable; }
563
- console.error('toObservable error: Expected validator to return Promise or Observable.');
564
- return new Observable();
565
- }
566
-
337
+ export declare function toObservable(object: any): Observable<any>;
567
338
  /**
568
339
  * 'inArray' function
569
340
  *
@@ -580,13 +351,7 @@ export function toObservable(object): Observable<any> {
580
351
  * // { boolean = false } allIn - if TRUE, all items must be in array
581
352
  * // { boolean } - true if item(s) in array, false otherwise
582
353
  */
583
- export function inArray(item, array, allIn = false) {
584
- if (!isDefined(item) || !isArray(array)) { return false; }
585
- return isArray(item) ?
586
- item[allIn ? 'every' : 'some'](subItem => array.includes(subItem)) :
587
- array.includes(item);
588
- }
589
-
354
+ export declare function inArray(item: any, array: any, allIn?: boolean): any;
590
355
  /**
591
356
  * 'xor' utility function - exclusive or
592
357
  *
@@ -596,6 +361,4 @@ export function inArray(item, array, allIn = false) {
596
361
  * // value2 - second value to check
597
362
  * // { boolean } - true if exactly one input value is truthy, false if not
598
363
  */
599
- export function xor(value1, value2) {
600
- return (!!value1 && !value2) || (!value1 && !!value2);
601
- }
364
+ export declare function xor(value1: any, value2: any): boolean;
@@ -0,0 +1,20 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { JsonSchemaFormService } from '../json-schema-form.service';
3
+ import * as i0 from "@angular/core";
4
+ export declare class AddReferenceComponent implements OnInit {
5
+ private jsf;
6
+ options: any;
7
+ itemCount: number;
8
+ previousLayoutIndex: number[];
9
+ previousDataIndex: number[];
10
+ layoutNode: any;
11
+ layoutIndex: number[];
12
+ dataIndex: number[];
13
+ constructor(jsf: JsonSchemaFormService);
14
+ ngOnInit(): void;
15
+ get showAddButton(): boolean;
16
+ addItem(event: any): void;
17
+ get buttonText(): string;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<AddReferenceComponent, never>;
19
+ static ɵcmp: i0.ɵɵComponentDeclaration<AddReferenceComponent, "add-reference-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; }; "dataIndex": { "alias": "dataIndex"; "required": false; }; }, {}, never, never, false, never>;
20
+ }
@@ -0,0 +1,21 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { OnInit } from '@angular/core';
3
+ import { JsonSchemaFormService } from '../json-schema-form.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class ButtonComponent implements OnInit {
6
+ private jsf;
7
+ formControl: AbstractControl;
8
+ controlName: string;
9
+ controlValue: any;
10
+ controlDisabled: boolean;
11
+ boundControl: boolean;
12
+ options: any;
13
+ layoutNode: any;
14
+ layoutIndex: number[];
15
+ dataIndex: number[];
16
+ constructor(jsf: JsonSchemaFormService);
17
+ ngOnInit(): void;
18
+ updateValue(event: any): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<ButtonComponent, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<ButtonComponent, "button-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; }; "dataIndex": { "alias": "dataIndex"; "required": false; }; }, {}, never, never, false, never>;
21
+ }
@@ -0,0 +1,24 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { OnInit } from '@angular/core';
3
+ import { JsonSchemaFormService } from '../json-schema-form.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class CheckboxComponent implements OnInit {
6
+ private jsf;
7
+ formControl: AbstractControl;
8
+ controlName: string;
9
+ controlValue: any;
10
+ controlDisabled: boolean;
11
+ boundControl: boolean;
12
+ options: any;
13
+ trueValue: any;
14
+ falseValue: any;
15
+ layoutNode: any;
16
+ layoutIndex: number[];
17
+ dataIndex: number[];
18
+ constructor(jsf: JsonSchemaFormService);
19
+ ngOnInit(): void;
20
+ updateValue(event: any): void;
21
+ get isChecked(): boolean;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxComponent, never>;
23
+ static ɵcmp: i0.ɵɵComponentDeclaration<CheckboxComponent, "checkbox-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; }; "dataIndex": { "alias": "dataIndex"; "required": false; }; }, {}, never, never, false, never>;
24
+ }
@@ -0,0 +1,24 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { OnInit } from '@angular/core';
3
+ import { JsonSchemaFormService, TitleMapItem } from '../json-schema-form.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class CheckboxesComponent implements OnInit {
6
+ private jsf;
7
+ formControl: AbstractControl;
8
+ controlName: string;
9
+ controlValue: any;
10
+ controlDisabled: boolean;
11
+ boundControl: boolean;
12
+ options: any;
13
+ layoutOrientation: string;
14
+ formArray: AbstractControl;
15
+ checkboxList: TitleMapItem[];
16
+ layoutNode: any;
17
+ layoutIndex: number[];
18
+ dataIndex: number[];
19
+ constructor(jsf: JsonSchemaFormService);
20
+ ngOnInit(): void;
21
+ updateValue(event: any): void;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxesComponent, never>;
23
+ static ɵcmp: i0.ɵɵComponentDeclaration<CheckboxesComponent, "checkboxes-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; }; "dataIndex": { "alias": "dataIndex"; "required": false; }; }, {}, never, never, false, never>;
24
+ }
@@ -0,0 +1,21 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { OnInit } from '@angular/core';
3
+ import { JsonSchemaFormService } from '../json-schema-form.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class FileComponent implements OnInit {
6
+ private jsf;
7
+ formControl: AbstractControl;
8
+ controlName: string;
9
+ controlValue: any;
10
+ controlDisabled: boolean;
11
+ boundControl: boolean;
12
+ options: any;
13
+ layoutNode: any;
14
+ layoutIndex: number[];
15
+ dataIndex: number[];
16
+ constructor(jsf: JsonSchemaFormService);
17
+ ngOnInit(): void;
18
+ updateValue(event: any): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<FileComponent, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<FileComponent, "file-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; }; "dataIndex": { "alias": "dataIndex"; "required": false; }; }, {}, never, never, false, never>;
21
+ }
@@ -0,0 +1,19 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { OnInit } from '@angular/core';
3
+ import { JsonSchemaFormService } from '../json-schema-form.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class HiddenComponent implements OnInit {
6
+ private jsf;
7
+ formControl: AbstractControl;
8
+ controlName: string;
9
+ controlValue: any;
10
+ controlDisabled: boolean;
11
+ boundControl: boolean;
12
+ layoutNode: any;
13
+ layoutIndex: number[];
14
+ dataIndex: number[];
15
+ constructor(jsf: JsonSchemaFormService);
16
+ ngOnInit(): void;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<HiddenComponent, never>;
18
+ static ɵcmp: i0.ɵɵComponentDeclaration<HiddenComponent, "hidden-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; }; "dataIndex": { "alias": "dataIndex"; "required": false; }; }, {}, never, never, false, never>;
19
+ }
@@ -20,16 +20,7 @@ import { TabComponent } from './tab.component';
20
20
  import { TabsComponent } from './tabs.component';
21
21
  import { TemplateComponent } from './template.component';
22
22
  import { TextareaComponent } from './textarea.component';
23
-
24
- export const BASIC_WIDGETS = [
25
- AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
26
- CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
27
- MessageComponent, NoneComponent, NumberComponent, RadiosComponent,
28
- RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent,
29
- SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent,
30
- TemplateComponent, TextareaComponent
31
- ];
32
-
23
+ export declare const BASIC_WIDGETS: (typeof AddReferenceComponent | typeof ButtonComponent | typeof CheckboxComponent | typeof CheckboxesComponent | typeof FileComponent | typeof InputComponent | typeof MessageComponent | typeof NoneComponent | typeof NumberComponent | typeof OneOfComponent | typeof RadiosComponent | typeof RootComponent | typeof SectionComponent | typeof SelectComponent | typeof SelectFrameworkComponent | typeof SelectWidgetComponent | typeof SubmitComponent | typeof TabsComponent | typeof TemplateComponent | typeof TextareaComponent | typeof HiddenComponent | typeof TabComponent)[];
33
24
  export { AddReferenceComponent } from './add-reference.component';
34
25
  export { OneOfComponent } from './one-of.component';
35
26
  export { ButtonComponent } from './button.component';
@@ -0,0 +1,22 @@
1
+ import { AbstractControl } from '@angular/forms';
2
+ import { OnInit } from '@angular/core';
3
+ import { JsonSchemaFormService } from '../json-schema-form.service';
4
+ import * as i0 from "@angular/core";
5
+ export declare class InputComponent implements OnInit {
6
+ private jsf;
7
+ formControl: AbstractControl;
8
+ controlName: string;
9
+ controlValue: string;
10
+ controlDisabled: boolean;
11
+ boundControl: boolean;
12
+ options: any;
13
+ autoCompleteList: string[];
14
+ layoutNode: any;
15
+ layoutIndex: number[];
16
+ dataIndex: number[];
17
+ constructor(jsf: JsonSchemaFormService);
18
+ ngOnInit(): void;
19
+ updateValue(event: any): void;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<InputComponent, never>;
21
+ static ɵcmp: i0.ɵɵComponentDeclaration<InputComponent, "input-widget", never, { "layoutNode": { "alias": "layoutNode"; "required": false; }; "layoutIndex": { "alias": "layoutIndex"; "required": false; }; "dataIndex": { "alias": "dataIndex"; "required": false; }; }, {}, never, never, false, never>;
22
+ }