@ng-formworks/core 19.6.3 → 20.6.4

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 (61) hide show
  1. package/README.md +2 -1
  2. package/fesm2022/ng-formworks-core.mjs +209 -209
  3. package/fesm2022/ng-formworks-core.mjs.map +1 -1
  4. package/index.d.ts +2772 -3
  5. package/package.json +11 -6
  6. package/lib/framework-library/framework-library.service.d.ts +0 -53
  7. package/lib/framework-library/framework.d.ts +0 -13
  8. package/lib/framework-library/no-framework.component.d.ts +0 -8
  9. package/lib/framework-library/no-framework.module.d.ts +0 -9
  10. package/lib/framework-library/no.framework.d.ts +0 -10
  11. package/lib/json-schema-form.component.d.ts +0 -225
  12. package/lib/json-schema-form.module.d.ts +0 -11
  13. package/lib/json-schema-form.service.d.ts +0 -150
  14. package/lib/locale/de-validation-messages.d.ts +0 -1
  15. package/lib/locale/en-validation-messages.d.ts +0 -1
  16. package/lib/locale/es-validation-messages.d.ts +0 -1
  17. package/lib/locale/fr-validation-messages.d.ts +0 -1
  18. package/lib/locale/index.d.ts +0 -7
  19. package/lib/locale/it-validation-messages.d.ts +0 -1
  20. package/lib/locale/pt-validation-messages.d.ts +0 -1
  21. package/lib/locale/zh-validation-messages.d.ts +0 -1
  22. package/lib/shared/convert-schema-to-draft6.function.d.ts +0 -21
  23. package/lib/shared/form-group.functions.d.ts +0 -128
  24. package/lib/shared/format-regex.constants.d.ts +0 -20
  25. package/lib/shared/index.d.ts +0 -9
  26. package/lib/shared/json-schema.functions.d.ts +0 -214
  27. package/lib/shared/json.validators.d.ts +0 -441
  28. package/lib/shared/jsonpointer.functions.d.ts +0 -416
  29. package/lib/shared/layout.functions.d.ts +0 -83
  30. package/lib/shared/merge-schemas.function.d.ts +0 -19
  31. package/lib/shared/utility.functions.d.ts +0 -180
  32. package/lib/shared/validator.functions.d.ts +0 -364
  33. package/lib/widget-library/add-reference.component.d.ts +0 -18
  34. package/lib/widget-library/button.component.d.ts +0 -20
  35. package/lib/widget-library/checkbox.component.d.ts +0 -23
  36. package/lib/widget-library/checkboxes.component.d.ts +0 -24
  37. package/lib/widget-library/element-attribute.directive.d.ts +0 -13
  38. package/lib/widget-library/file.component.d.ts +0 -20
  39. package/lib/widget-library/hidden.component.d.ts +0 -18
  40. package/lib/widget-library/index.d.ts +0 -29
  41. package/lib/widget-library/input.component.d.ts +0 -22
  42. package/lib/widget-library/message.component.d.ts +0 -13
  43. package/lib/widget-library/none.component.d.ts +0 -8
  44. package/lib/widget-library/number.component.d.ts +0 -27
  45. package/lib/widget-library/one-of.component.d.ts +0 -21
  46. package/lib/widget-library/orderable.directive.d.ts +0 -41
  47. package/lib/widget-library/radios.component.d.ts +0 -22
  48. package/lib/widget-library/root.component.d.ts +0 -23
  49. package/lib/widget-library/section.component.d.ts +0 -17
  50. package/lib/widget-library/select-framework.component.d.ts +0 -15
  51. package/lib/widget-library/select-widget.component.d.ts +0 -15
  52. package/lib/widget-library/select.component.d.ts +0 -25
  53. package/lib/widget-library/selectcheckbox.component.d.ts +0 -55
  54. package/lib/widget-library/submit.component.d.ts +0 -22
  55. package/lib/widget-library/tab.component.d.ts +0 -12
  56. package/lib/widget-library/tabs.component.d.ts +0 -18
  57. package/lib/widget-library/template.component.d.ts +0 -15
  58. package/lib/widget-library/textarea.component.d.ts +0 -20
  59. package/lib/widget-library/widget-library.module.d.ts +0 -34
  60. package/lib/widget-library/widget-library.service.d.ts +0 -22
  61. package/public_api.d.ts +0 -9
@@ -1,441 +0,0 @@
1
- import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
2
- import { JsonSchemaFormatNames } from './format-regex.constants';
3
- import { AsyncIValidatorFn, IValidatorFn, SchemaPrimitiveType } from './validator.functions';
4
- /**
5
- * 'JsonValidators' class
6
- *
7
- * Provides an extended set of validators to be used by form controls,
8
- * compatible with standard JSON Schema validation options.
9
- * http://json-schema.org/latest/json-schema-validation.html
10
- *
11
- * Note: This library is designed as a drop-in replacement for the Angular
12
- * Validators library, and except for one small breaking change to the 'pattern'
13
- * validator (described below) it can even be imported as a substitute, like so:
14
- *
15
- * import { JsonValidators as Validators } from 'json-validators';
16
- *
17
- * and it should work with existing code as a complete replacement.
18
- *
19
- * The one exception is the 'pattern' validator, which has been changed to
20
- * matche partial values by default (the standard 'pattern' validator wrapped
21
- * all patterns in '^' and '$', forcing them to always match an entire value).
22
- * However, the old behavior can be restored by simply adding '^' and '$'
23
- * around your patterns, or by passing an optional second parameter of TRUE.
24
- * This change is to make the 'pattern' validator match the behavior of a
25
- * JSON Schema pattern, which allows partial matches, rather than the behavior
26
- * of an HTML input control pattern, which does not.
27
- *
28
- * This library replaces Angular's validators and combination functions
29
- * with the following validators and transformation functions:
30
- *
31
- * Validators:
32
- * For all formControls: required (*), type, enum, const
33
- * For text formControls: minLength (*), maxLength (*), pattern (*), format
34
- * For numeric formControls: maximum, exclusiveMaximum,
35
- * minimum, exclusiveMinimum, multipleOf
36
- * For formGroup objects: minProperties, maxProperties, dependencies
37
- * For formArray arrays: minItems, maxItems, uniqueItems, contains
38
- * Not used by JSON Schema: min (*), max (*), requiredTrue (*), email (*)
39
- * (Validators originally included with Angular are maked with (*).)
40
- *
41
- * NOTE / TODO: The dependencies validator is not complete.
42
- * NOTE / TODO: The contains validator is not complete.
43
- *
44
- * Validators not used by JSON Schema (but included for compatibility)
45
- * and their JSON Schema equivalents:
46
- *
47
- * Angular validator | JSON Schema equivalent
48
- * ------------------|-----------------------
49
- * min(number) | minimum(number)
50
- * max(number) | maximum(number)
51
- * requiredTrue() | const(true)
52
- * email() | format('email')
53
- *
54
- * Validator transformation functions:
55
- * composeAnyOf, composeOneOf, composeAllOf, composeNot
56
- * (Angular's original combination funciton, 'compose', is also included for
57
- * backward compatibility, though it is functionally equivalent to composeAllOf,
58
- * asside from its more generic error message.)
59
- *
60
- * All validators have also been extended to accept an optional second argument
61
- * which, if passed a TRUE value, causes the validator to perform the opposite
62
- * of its original finction. (This is used internally to enable 'not' and
63
- * 'composeOneOf' to function and return useful error messages.)
64
- *
65
- * The 'required' validator has also been overloaded so that if called with
66
- * a boolean parameter (or no parameters) it returns the original validator
67
- * function (rather than executing it). However, if it is called with an
68
- * AbstractControl parameter (as was previously required), it behaves
69
- * exactly as before.
70
- *
71
- * This enables all validators (including 'required') to be constructed in
72
- * exactly the same way, so they can be automatically applied using the
73
- * equivalent key names and values taken directly from a JSON Schema.
74
- *
75
- * This source code is partially derived from Angular,
76
- * which is Copyright (c) 2014-2017 Google, Inc.
77
- * Use of this source code is therefore governed by the same MIT-style license
78
- * that can be found in the LICENSE file at https://angular.io/license
79
- *
80
- * Original Angular Validators:
81
- * https://github.com/angular/angular/blob/master/packages/forms/src/validators.ts
82
- */
83
- export declare class JsonValidators {
84
- /**
85
- * Validator functions:
86
- *
87
- * For all formControls: required, type, enum, const
88
- * For text formControls: minLength, maxLength, pattern, format
89
- * For numeric formControls: maximum, exclusiveMaximum,
90
- * minimum, exclusiveMinimum, multipleOf
91
- * For formGroup objects: minProperties, maxProperties, dependencies
92
- * For formArray arrays: minItems, maxItems, uniqueItems, contains
93
- *
94
- * TODO: finish dependencies validator
95
- */
96
- /**
97
- * 'required' validator
98
- *
99
- * This validator is overloaded, compared to the default required validator.
100
- * If called with no parameters, or TRUE, this validator returns the
101
- * 'required' validator function (rather than executing it). This matches
102
- * the behavior of all other validators in this library.
103
- *
104
- * If this validator is called with an AbstractControl parameter
105
- * (as was previously required) it behaves the same as Angular's default
106
- * required validator, and returns an error if the control is empty.
107
- *
108
- * Old behavior: (if input type = AbstractControl)
109
- * // {AbstractControl} control - required control
110
- * // {{[key: string]: boolean}} - returns error message if no input
111
- *
112
- * New behavior: (if no input, or input type = boolean)
113
- * // {boolean = true} required? - true to validate, false to disable
114
- * // {IValidatorFn} - returns the 'required' validator function itself
115
- */
116
- static required(input: AbstractControl): ValidationErrors | null;
117
- static required(input?: boolean): IValidatorFn;
118
- /**
119
- * 'type' validator
120
- *
121
- * Requires a control to only accept values of a specified type,
122
- * or one of an array of types.
123
- *
124
- * Note: SchemaPrimitiveType = 'string'|'number'|'integer'|'boolean'|'null'
125
- *
126
- * // {SchemaPrimitiveType|SchemaPrimitiveType[]} type - type(s) to accept
127
- * // {IValidatorFn}
128
- */
129
- static type(requiredType: SchemaPrimitiveType | SchemaPrimitiveType[]): IValidatorFn;
130
- /**
131
- * 'enum' validator
132
- *
133
- * Requires a control to have a value from an enumerated list of values.
134
- *
135
- * Converts types as needed to allow string inputs to still correctly
136
- * match number, boolean, and null enum values.
137
- *
138
- * // {any[]} allowedValues - array of acceptable values
139
- * // {IValidatorFn}
140
- */
141
- static enum(allowedValues: any[]): IValidatorFn;
142
- /**
143
- * 'const' validator
144
- *
145
- * Requires a control to have a specific value.
146
- *
147
- * Converts types as needed to allow string inputs to still correctly
148
- * match number, boolean, and null values.
149
- *
150
- * TODO: modify to work with objects
151
- *
152
- * // {any[]} requiredValue - required value
153
- * // {IValidatorFn}
154
- */
155
- static const(requiredValue: any): IValidatorFn;
156
- /**
157
- * 'minLength' validator
158
- *
159
- * Requires a control's text value to be greater than a specified length.
160
- *
161
- * // {number} minimumLength - minimum allowed string length
162
- * // {boolean = false} invert - instead return error object only if valid
163
- * // {IValidatorFn}
164
- */
165
- static minLength(minimumLength: number): IValidatorFn;
166
- /**
167
- * 'maxLength' validator
168
- *
169
- * Requires a control's text value to be less than a specified length.
170
- *
171
- * // {number} maximumLength - maximum allowed string length
172
- * // {boolean = false} invert - instead return error object only if valid
173
- * // {IValidatorFn}
174
- */
175
- static maxLength(maximumLength: number): IValidatorFn;
176
- /**
177
- * 'pattern' validator
178
- *
179
- * Note: NOT the same as Angular's default pattern validator.
180
- *
181
- * Requires a control's value to match a specified regular expression pattern.
182
- *
183
- * This validator changes the behavior of default pattern validator
184
- * by replacing RegExp(`^${pattern}$`) with RegExp(`${pattern}`),
185
- * which allows for partial matches.
186
- *
187
- * To return to the default funcitonality, and match the entire string,
188
- * pass TRUE as the optional second parameter.
189
- *
190
- * // {string} pattern - regular expression pattern
191
- * // {boolean = false} wholeString - match whole value string?
192
- * // {IValidatorFn}
193
- */
194
- static pattern(pattern: string | RegExp, wholeString?: boolean): IValidatorFn;
195
- /**
196
- * 'format' validator
197
- *
198
- * Requires a control to have a value of a certain format.
199
- *
200
- * This validator currently checks the following formsts:
201
- * date, time, date-time, email, hostname, ipv4, ipv6,
202
- * uri, uri-reference, uri-template, url, uuid, color,
203
- * json-pointer, relative-json-pointer,duration, regex
204
- *
205
- * Fast format regular expressions copied from AJV:
206
- * https://github.com/epoberezkin/ajv/blob/master/lib/compile/formats.js
207
- *
208
- * // {JsonSchemaFormatNames} requiredFormat - format to check
209
- * // {IValidatorFn}
210
- */
211
- static format(requiredFormat: JsonSchemaFormatNames): IValidatorFn;
212
- /**
213
- * 'minimum' validator
214
- *
215
- * Requires a control's numeric value to be greater than or equal to
216
- * a minimum amount.
217
- *
218
- * Any non-numeric value is also valid (according to the HTML forms spec,
219
- * a non-numeric value doesn't have a minimum).
220
- * https://www.w3.org/TR/html5/forms.html#attr-input-max
221
- *
222
- * // {number} minimum - minimum allowed value
223
- * // {IValidatorFn}
224
- */
225
- static minimum(minimumValue: number): IValidatorFn;
226
- /**
227
- * 'exclusiveMinimum' validator
228
- *
229
- * Requires a control's numeric value to be less than a maximum amount.
230
- *
231
- * Any non-numeric value is also valid (according to the HTML forms spec,
232
- * a non-numeric value doesn't have a maximum).
233
- * https://www.w3.org/TR/html5/forms.html#attr-input-max
234
- *
235
- * // {number} exclusiveMinimumValue - maximum allowed value
236
- * // {IValidatorFn}
237
- */
238
- static exclusiveMinimum(exclusiveMinimumValue: number): IValidatorFn;
239
- /**
240
- * 'maximum' validator
241
- *
242
- * Requires a control's numeric value to be less than or equal to
243
- * a maximum amount.
244
- *
245
- * Any non-numeric value is also valid (according to the HTML forms spec,
246
- * a non-numeric value doesn't have a maximum).
247
- * https://www.w3.org/TR/html5/forms.html#attr-input-max
248
- *
249
- * // {number} maximumValue - maximum allowed value
250
- * // {IValidatorFn}
251
- */
252
- static maximum(maximumValue: number): IValidatorFn;
253
- /**
254
- * 'exclusiveMaximum' validator
255
- *
256
- * Requires a control's numeric value to be less than a maximum amount.
257
- *
258
- * Any non-numeric value is also valid (according to the HTML forms spec,
259
- * a non-numeric value doesn't have a maximum).
260
- * https://www.w3.org/TR/html5/forms.html#attr-input-max
261
- *
262
- * // {number} exclusiveMaximumValue - maximum allowed value
263
- * // {IValidatorFn}
264
- */
265
- static exclusiveMaximum(exclusiveMaximumValue: number): IValidatorFn;
266
- /**
267
- * 'multipleOf' validator
268
- *
269
- * Requires a control to have a numeric value that is a multiple
270
- * of a specified number.
271
- *
272
- * // {number} multipleOfValue - number value must be a multiple of
273
- * // {IValidatorFn}
274
- */
275
- static multipleOf(multipleOfValue: number): IValidatorFn;
276
- /**
277
- * 'minProperties' validator
278
- *
279
- * Requires a form group to have a minimum number of properties (i.e. have
280
- * values entered in a minimum number of controls within the group).
281
- *
282
- * // {number} minimumProperties - minimum number of properties allowed
283
- * // {IValidatorFn}
284
- */
285
- static minProperties(minimumProperties: number): IValidatorFn;
286
- /**
287
- * 'maxProperties' validator
288
- *
289
- * Requires a form group to have a maximum number of properties (i.e. have
290
- * values entered in a maximum number of controls within the group).
291
- *
292
- * Note: Has no effect if the form group does not contain more than the
293
- * maximum number of controls.
294
- *
295
- * // {number} maximumProperties - maximum number of properties allowed
296
- * // {IValidatorFn}
297
- */
298
- static maxProperties(maximumProperties: number): IValidatorFn;
299
- /**
300
- * 'dependencies' validator
301
- *
302
- * Requires the controls in a form group to meet additional validation
303
- * criteria, depending on the values of other controls in the group.
304
- *
305
- * Examples:
306
- * https://spacetelescope.github.io/understanding-json-schema/reference/object.html#dependencies
307
- *
308
- * // {any} dependencies - required dependencies
309
- * // {IValidatorFn}
310
- */
311
- static dependencies(dependencies: any): IValidatorFn;
312
- /**
313
- * 'minItems' validator
314
- *
315
- * Requires a form array to have a minimum number of values.
316
- *
317
- * // {number} minimumItems - minimum number of items allowed
318
- * // {IValidatorFn}
319
- */
320
- static minItems(minimumItems: number): IValidatorFn;
321
- /**
322
- * 'maxItems' validator
323
- *
324
- * Requires a form array to have a maximum number of values.
325
- *
326
- * // {number} maximumItems - maximum number of items allowed
327
- * // {IValidatorFn}
328
- */
329
- static maxItems(maximumItems: number): IValidatorFn;
330
- /**
331
- * 'uniqueItems' validator
332
- *
333
- * Requires values in a form array to be unique.
334
- *
335
- * // {boolean = true} unique? - true to validate, false to disable
336
- * // {IValidatorFn}
337
- */
338
- static uniqueItems(unique?: boolean): IValidatorFn;
339
- /**
340
- * 'contains' validator
341
- *
342
- * TODO: Complete this validator
343
- *
344
- * Requires values in a form array to be unique.
345
- *
346
- * // {boolean = true} unique? - true to validate, false to disable
347
- * // {IValidatorFn}
348
- */
349
- static contains(requiredItem?: boolean): IValidatorFn;
350
- /**
351
- * No-op validator. Included for backward compatibility.
352
- */
353
- static nullValidator(control: AbstractControl): ValidationErrors | null;
354
- /**
355
- * Validator transformation functions:
356
- * composeAnyOf, composeOneOf, composeAllOf, composeNot,
357
- * compose, composeAsync
358
- *
359
- * TODO: Add composeAnyOfAsync, composeOneOfAsync,
360
- * composeAllOfAsync, composeNotAsync
361
- */
362
- /**
363
- * 'composeAnyOf' validator combination function
364
- *
365
- * Accepts an array of validators and returns a single validator that
366
- * evaluates to valid if any one or more of the submitted validators are
367
- * valid. If every validator is invalid, it returns combined errors from
368
- * all validators.
369
- *
370
- * // {IValidatorFn[]} validators - array of validators to combine
371
- * // {IValidatorFn} - single combined validator function
372
- */
373
- static composeAnyOf(validators: IValidatorFn[]): IValidatorFn;
374
- /**
375
- * 'composeOneOf' validator combination function
376
- *
377
- * Accepts an array of validators and returns a single validator that
378
- * evaluates to valid only if exactly one of the submitted validators
379
- * is valid. Otherwise returns combined information from all validators,
380
- * both valid and invalid.
381
- *
382
- * // {IValidatorFn[]} validators - array of validators to combine
383
- * // {IValidatorFn} - single combined validator function
384
- */
385
- static composeOneOf(validators: IValidatorFn[]): IValidatorFn;
386
- /**
387
- * 'composeAllOf' validator combination function
388
- *
389
- * Accepts an array of validators and returns a single validator that
390
- * evaluates to valid only if all the submitted validators are individually
391
- * valid. Otherwise it returns combined errors from all invalid validators.
392
- *
393
- * // {IValidatorFn[]} validators - array of validators to combine
394
- * // {IValidatorFn} - single combined validator function
395
- */
396
- static composeAllOf(validators: IValidatorFn[]): IValidatorFn;
397
- /**
398
- * 'composeNot' validator inversion function
399
- *
400
- * Accepts a single validator function and inverts its result.
401
- * Returns valid if the submitted validator is invalid, and
402
- * returns invalid if the submitted validator is valid.
403
- * (Note: this function can itself be inverted
404
- * - e.g. composeNot(composeNot(validator)) -
405
- * but this can be confusing and is therefore not recommended.)
406
- *
407
- * // {IValidatorFn[]} validators - validator(s) to invert
408
- * // {IValidatorFn} - new validator function that returns opposite result
409
- */
410
- static composeNot(validator: IValidatorFn): IValidatorFn;
411
- /**
412
- * 'compose' validator combination function
413
- *
414
- * // {IValidatorFn[]} validators - array of validators to combine
415
- * // {IValidatorFn} - single combined validator function
416
- */
417
- static compose(validators: IValidatorFn[]): IValidatorFn;
418
- /**
419
- * 'composeAsync' async validator combination function
420
- *
421
- * // {AsyncIValidatorFn[]} async validators - array of async validators
422
- * // {AsyncIValidatorFn} - single combined async validator function
423
- */
424
- static composeAsync(validators: AsyncIValidatorFn[]): AsyncIValidatorFn;
425
- /**
426
- * Validator that requires controls to have a value greater than a number.
427
- */
428
- static min(min: number): ValidatorFn;
429
- /**
430
- * Validator that requires controls to have a value less than a number.
431
- */
432
- static max(max: number): ValidatorFn;
433
- /**
434
- * Validator that requires control value to be true.
435
- */
436
- static requiredTrue(control: AbstractControl): ValidationErrors | null;
437
- /**
438
- * Validator that performs email validation.
439
- */
440
- static email(control: AbstractControl): ValidationErrors | null;
441
- }