@ng-formworks/core 19.5.3 → 19.5.7
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.
- package/fesm2022/ng-formworks-core.mjs +1781 -1606
- package/fesm2022/ng-formworks-core.mjs.map +1 -1
- package/lib/json-schema-form.service.d.ts +7 -1
- package/lib/shared/validator.functions.d.ts +1 -1
- package/lib/widget-library/element-attribute.directive.d.ts +13 -0
- package/lib/widget-library/index.d.ts +3 -2
- package/lib/widget-library/input.component.d.ts +2 -1
- package/lib/widget-library/number.component.d.ts +4 -1
- package/lib/widget-library/orderable.directive.d.ts +4 -2
- package/lib/widget-library/root.component.d.ts +8 -1
- package/lib/widget-library/select-framework.component.d.ts +0 -1
- package/lib/widget-library/select-widget.component.d.ts +0 -1
- package/lib/widget-library/template.component.d.ts +0 -1
- package/lib/widget-library/widget-library.module.d.ts +5 -3
- package/package.json +4 -2
|
@@ -1,1401 +1,1416 @@
|
|
|
1
1
|
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import * as i2 from '@angular/forms';
|
|
4
|
-
import { UntypedFormControl, UntypedFormArray, UntypedFormGroup, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
3
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { Injectable, inject, input, Component,
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { from, Observable, forkJoin, Subject, lastValueFrom } from 'rxjs';
|
|
10
|
-
import { map, takeUntil } from 'rxjs/operators';
|
|
11
|
-
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
import { Injectable, inject, input, viewChild, ViewContainerRef, Component, Input, Directive, ChangeDetectionStrategy, ViewChild, ElementRef, NgZone, signal, NgModule, Inject, forwardRef, ChangeDetectorRef, output } from '@angular/core';
|
|
5
|
+
import * as i2 from '@angular/forms';
|
|
6
|
+
import { UntypedFormControl, UntypedFormArray, UntypedFormGroup, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
12
7
|
import Ajv2019 from 'ajv/dist/2019';
|
|
13
8
|
import jsonDraft6 from 'ajv/lib/refs/json-schema-draft-06.json';
|
|
14
9
|
import jsonDraft7 from 'ajv/lib/refs/json-schema-draft-07.json';
|
|
10
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
11
|
+
import { from, Observable, forkJoin, Subject, BehaviorSubject, lastValueFrom } from 'rxjs';
|
|
12
|
+
import isEqual$1 from 'lodash/isEqual';
|
|
13
|
+
import { map, takeUntil } from 'rxjs/operators';
|
|
15
14
|
import filter from 'lodash/filter';
|
|
16
15
|
import map$1 from 'lodash/map';
|
|
17
16
|
import _isArray from 'lodash/isArray';
|
|
18
17
|
import _isPlainObject from 'lodash/isPlainObject';
|
|
19
18
|
import uniqueId from 'lodash/uniqueId';
|
|
19
|
+
import * as i2$1 from 'nxt-sortablejs';
|
|
20
|
+
import { SortablejsModule } from 'nxt-sortablejs';
|
|
21
|
+
import { HttpClient } from '@angular/common/http';
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* (from invalid validators) and null values (from valid validators)
|
|
27
|
-
*
|
|
28
|
-
* // { AbstractControl } control - control to validate
|
|
29
|
-
* // { IValidatorFn[] } validators - array of validators
|
|
30
|
-
* // { boolean } invert - invert?
|
|
31
|
-
* // { PlainObject[] } - array of nulls and error message
|
|
32
|
-
*/
|
|
33
|
-
function _executeValidators(control, validators, invert = false) {
|
|
34
|
-
return validators.map(validator => validator(control, invert));
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* '_executeAsyncValidators' utility function
|
|
38
|
-
*
|
|
39
|
-
* Validates a control against an array of async validators, and returns
|
|
40
|
-
* an array of observabe results of the same length containing a combination of
|
|
41
|
-
* error messages (from invalid validators) and null values (from valid ones)
|
|
42
|
-
*
|
|
43
|
-
* // { AbstractControl } control - control to validate
|
|
44
|
-
* // { AsyncIValidatorFn[] } validators - array of async validators
|
|
45
|
-
* // { boolean } invert - invert?
|
|
46
|
-
* // - array of observable nulls and error message
|
|
47
|
-
*/
|
|
48
|
-
function _executeAsyncValidators(control, validators, invert = false) {
|
|
49
|
-
return validators.map(validator => validator(control, invert));
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* '_mergeObjects' utility function
|
|
53
|
-
*
|
|
54
|
-
* Recursively Merges one or more objects into a single object with combined keys.
|
|
55
|
-
* Automatically detects and ignores null and undefined inputs.
|
|
56
|
-
* Also detects duplicated boolean 'not' keys and XORs their values.
|
|
57
|
-
*
|
|
58
|
-
* // { PlainObject[] } objects - one or more objects to merge
|
|
59
|
-
* // { PlainObject } - merged object
|
|
60
|
-
*/
|
|
61
|
-
function _mergeObjects(...objects) {
|
|
62
|
-
const mergedObject = {};
|
|
63
|
-
for (const currentObject of objects) {
|
|
64
|
-
if (isObject(currentObject)) {
|
|
65
|
-
for (const key of Object.keys(currentObject)) {
|
|
66
|
-
const currentValue = currentObject[key];
|
|
67
|
-
const mergedValue = mergedObject[key];
|
|
68
|
-
mergedObject[key] = !isDefined(mergedValue) ? currentValue :
|
|
69
|
-
key === 'not' && isBoolean(mergedValue, 'strict') &&
|
|
70
|
-
isBoolean(currentValue, 'strict') ? xor(mergedValue, currentValue) :
|
|
71
|
-
getType(mergedValue) === 'object' && getType(currentValue) === 'object' ?
|
|
72
|
-
_mergeObjects(mergedValue, currentValue) :
|
|
73
|
-
currentValue;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return mergedObject;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* '_mergeErrors' utility function
|
|
81
|
-
*
|
|
82
|
-
* Merges an array of objects.
|
|
83
|
-
* Used for combining the validator errors returned from 'executeValidators'
|
|
84
|
-
*
|
|
85
|
-
* // { PlainObject[] } arrayOfErrors - array of objects
|
|
86
|
-
* // { PlainObject } - merged object, or null if no usable input objectcs
|
|
87
|
-
*/
|
|
88
|
-
function _mergeErrors(arrayOfErrors) {
|
|
89
|
-
const mergedErrors = _mergeObjects(...arrayOfErrors);
|
|
90
|
-
return isEmpty(mergedErrors) ? null : mergedErrors;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* 'isDefined' utility function
|
|
94
|
-
*
|
|
95
|
-
* Checks if a variable contains a value of any type.
|
|
96
|
-
* Returns true even for otherwise 'falsey' values of 0, '', and false.
|
|
97
|
-
*
|
|
98
|
-
* // value - the value to check
|
|
99
|
-
* // { boolean } - false if undefined or null, otherwise true
|
|
100
|
-
*/
|
|
101
|
-
function isDefined(value) {
|
|
102
|
-
return value !== undefined && value !== null;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* 'hasValue' utility function
|
|
106
|
-
*
|
|
107
|
-
* Checks if a variable contains a value.
|
|
108
|
-
* Returs false for null, undefined, or a zero-length strng, '',
|
|
109
|
-
* otherwise returns true.
|
|
110
|
-
* (Stricter than 'isDefined' because it also returns false for '',
|
|
111
|
-
* though it stil returns true for otherwise 'falsey' values 0 and false.)
|
|
112
|
-
*
|
|
113
|
-
* // value - the value to check
|
|
114
|
-
* // { boolean } - false if undefined, null, or '', otherwise true
|
|
115
|
-
*/
|
|
116
|
-
function hasValue(value) {
|
|
117
|
-
return value !== undefined && value !== null && value !== '';
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* 'isEmpty' utility function
|
|
121
|
-
*
|
|
122
|
-
* Similar to !hasValue, but also returns true for empty arrays and objects.
|
|
123
|
-
*
|
|
124
|
-
* // value - the value to check
|
|
125
|
-
* // { boolean } - false if undefined, null, or '', otherwise true
|
|
126
|
-
*/
|
|
127
|
-
function isEmpty(value) {
|
|
128
|
-
if (isArray(value)) {
|
|
129
|
-
return !value.length;
|
|
130
|
-
}
|
|
131
|
-
if (isObject(value)) {
|
|
132
|
-
return !Object.keys(value).length;
|
|
133
|
-
}
|
|
134
|
-
return value === undefined || value === null || value === '';
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* 'isString' utility function
|
|
138
|
-
*
|
|
139
|
-
* Checks if a value is a string.
|
|
140
|
-
*
|
|
141
|
-
* // value - the value to check
|
|
142
|
-
* // { boolean } - true if string, false if not
|
|
143
|
-
*/
|
|
144
|
-
function isString(value) {
|
|
145
|
-
return typeof value === 'string';
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* 'isNumber' utility function
|
|
149
|
-
*
|
|
150
|
-
* Checks if a value is a regular number, numeric string, or JavaScript Date.
|
|
151
|
-
*
|
|
152
|
-
* // value - the value to check
|
|
153
|
-
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
154
|
-
* // { boolean } - true if number, false if not
|
|
155
|
-
*/
|
|
156
|
-
function isNumber(value, strict = false) {
|
|
157
|
-
if (strict && typeof value !== 'number') {
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
return !isNaN(value) && value !== value / 0;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* 'isInteger' utility function
|
|
164
|
-
*
|
|
165
|
-
* Checks if a value is an integer.
|
|
166
|
-
*
|
|
167
|
-
* // value - the value to check
|
|
168
|
-
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
169
|
-
* // {boolean } - true if number, false if not
|
|
170
|
-
*/
|
|
171
|
-
function isInteger(value, strict = false) {
|
|
172
|
-
if (strict && typeof value !== 'number') {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
return !isNaN(value) && value !== value / 0 && value % 1 === 0;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* 'isBoolean' utility function
|
|
179
|
-
*
|
|
180
|
-
* Checks if a value is a boolean.
|
|
181
|
-
*
|
|
182
|
-
* // value - the value to check
|
|
183
|
-
* // { any = null } option - if 'strict', also checks JavaScript type
|
|
184
|
-
* if TRUE or FALSE, checks only for that value
|
|
185
|
-
* // { boolean } - true if boolean, false if not
|
|
186
|
-
*/
|
|
187
|
-
function isBoolean(value, option = null) {
|
|
188
|
-
if (option === 'strict') {
|
|
189
|
-
return value === true || value === false;
|
|
190
|
-
}
|
|
191
|
-
if (option === true) {
|
|
192
|
-
return value === true || value === 1 || value === 'true' || value === '1';
|
|
193
|
-
}
|
|
194
|
-
if (option === false) {
|
|
195
|
-
return value === false || value === 0 || value === 'false' || value === '0';
|
|
23
|
+
class Framework {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.widgets = {};
|
|
26
|
+
this.stylesheets = [];
|
|
27
|
+
this.scripts = [];
|
|
196
28
|
}
|
|
197
|
-
|
|
198
|
-
|
|
29
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: Framework, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
30
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: Framework }); }
|
|
199
31
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
* getType({ }) = 'object'
|
|
242
|
-
* getType([]) = 'array'
|
|
243
|
-
*
|
|
244
|
-
* getType('10.5', 'strict') = 'string'
|
|
245
|
-
* getType(10.5, 'strict') = 'number'
|
|
246
|
-
* getType('10', 'strict') = 'string'
|
|
247
|
-
* getType(10, 'strict') = 'integer'
|
|
248
|
-
* getType('true', 'strict') = 'string'
|
|
249
|
-
* getType(true, 'strict') = 'boolean'
|
|
250
|
-
*
|
|
251
|
-
* // value - value to check
|
|
252
|
-
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
253
|
-
* // { SchemaType }
|
|
254
|
-
*/
|
|
255
|
-
function getType(value, strict = false) {
|
|
256
|
-
if (!isDefined(value)) {
|
|
257
|
-
return 'null';
|
|
258
|
-
}
|
|
259
|
-
if (isArray(value)) {
|
|
260
|
-
return 'array';
|
|
261
|
-
}
|
|
262
|
-
if (isObject(value)) {
|
|
263
|
-
return 'object';
|
|
264
|
-
}
|
|
265
|
-
if (isBoolean(value, 'strict')) {
|
|
266
|
-
return 'boolean';
|
|
267
|
-
}
|
|
268
|
-
if (isInteger(value, strict)) {
|
|
269
|
-
return 'integer';
|
|
270
|
-
}
|
|
271
|
-
if (isNumber(value, strict)) {
|
|
272
|
-
return 'number';
|
|
273
|
-
}
|
|
274
|
-
if (isString(value) || (!strict && isDate(value))) {
|
|
275
|
-
return 'string';
|
|
276
|
-
}
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* 'isType' function
|
|
281
|
-
*
|
|
282
|
-
* Checks wether an input (probably string) value contains data of
|
|
283
|
-
* a specified JSON Schema type
|
|
284
|
-
*
|
|
285
|
-
* // { PrimitiveValue } value - value to check
|
|
286
|
-
* // { SchemaPrimitiveType } type - type to check
|
|
287
|
-
* // { boolean }
|
|
288
|
-
*/
|
|
289
|
-
function isType(value, type) {
|
|
290
|
-
switch (type) {
|
|
291
|
-
case 'string':
|
|
292
|
-
return isString(value) || isDate(value);
|
|
293
|
-
case 'number':
|
|
294
|
-
return isNumber(value);
|
|
295
|
-
case 'integer':
|
|
296
|
-
return isInteger(value);
|
|
297
|
-
case 'boolean':
|
|
298
|
-
return isBoolean(value);
|
|
299
|
-
case 'null':
|
|
300
|
-
return !hasValue(value);
|
|
301
|
-
default:
|
|
302
|
-
console.error(`isType error: "${type}" is not a recognized type.`);
|
|
303
|
-
return null;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* 'isPrimitive' function
|
|
308
|
-
*
|
|
309
|
-
* Checks wether an input value is a JavaScript primitive type:
|
|
310
|
-
* string, number, boolean, or null.
|
|
311
|
-
*
|
|
312
|
-
* // value - value to check
|
|
313
|
-
* // { boolean }
|
|
314
|
-
*/
|
|
315
|
-
function isPrimitive(value) {
|
|
316
|
-
return (isString(value) || isNumber(value) ||
|
|
317
|
-
isBoolean(value, 'strict') || value === null);
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
*
|
|
321
|
-
* @param date
|
|
322
|
-
* @returns {string}
|
|
323
|
-
* exmaple:
|
|
324
|
-
* toDateString('2018-01-01') = '2018-01-01'
|
|
325
|
-
* toDateString('2018-01-30T00:00:00.000Z') = '2018-01-30'
|
|
326
|
-
*/
|
|
327
|
-
const toIsoString = (date) => {
|
|
328
|
-
const day = date.getDate();
|
|
329
|
-
const month = date.getMonth() + 1;
|
|
330
|
-
const year = date.getFullYear();
|
|
331
|
-
return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
|
|
332
|
-
};
|
|
333
|
-
/**
|
|
334
|
-
* 'toJavaScriptType' function
|
|
335
|
-
*
|
|
336
|
-
* Converts an input (probably string) value to a JavaScript primitive type -
|
|
337
|
-
* 'string', 'number', 'boolean', or 'null' - before storing in a JSON object.
|
|
338
|
-
*
|
|
339
|
-
* Does not coerce values (other than null), and only converts the types
|
|
340
|
-
* of values that would otherwise be valid.
|
|
341
|
-
*
|
|
342
|
-
* If the optional third parameter 'strictIntegers' is TRUE, and the
|
|
343
|
-
* JSON Schema type 'integer' is specified, it also verifies the input value
|
|
344
|
-
* is an integer and, if it is, returns it as a JaveScript number.
|
|
345
|
-
* If 'strictIntegers' is FALSE (or not set) the type 'integer' is treated
|
|
346
|
-
* exactly the same as 'number', and allows decimals.
|
|
347
|
-
*
|
|
348
|
-
* Valid Examples:
|
|
349
|
-
* toJavaScriptType('10', 'number' ) = 10 // '10' is a number
|
|
350
|
-
* toJavaScriptType('10', 'integer') = 10 // '10' is also an integer
|
|
351
|
-
* toJavaScriptType( 10, 'integer') = 10 // 10 is still an integer
|
|
352
|
-
* toJavaScriptType( 10, 'string' ) = '10' // 10 can be made into a string
|
|
353
|
-
* toJavaScriptType('10.5', 'number' ) = 10.5 // '10.5' is a number
|
|
354
|
-
*
|
|
355
|
-
* Invalid Examples:
|
|
356
|
-
* toJavaScriptType('10.5', 'integer') = null // '10.5' is not an integer
|
|
357
|
-
* toJavaScriptType( 10.5, 'integer') = null // 10.5 is still not an integer
|
|
358
|
-
*
|
|
359
|
-
* // { PrimitiveValue } value - value to convert
|
|
360
|
-
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - types to convert to
|
|
361
|
-
* // { boolean = false } strictIntegers - if FALSE, treat integers as numbers
|
|
362
|
-
* // { PrimitiveValue }
|
|
363
|
-
*/
|
|
364
|
-
function toJavaScriptType(value, types, strictIntegers = true) {
|
|
365
|
-
if (!isDefined(value)) {
|
|
366
|
-
return null;
|
|
367
|
-
}
|
|
368
|
-
if (isString(types)) {
|
|
369
|
-
types = [types];
|
|
370
|
-
}
|
|
371
|
-
if (strictIntegers && inArray('integer', types)) {
|
|
372
|
-
if (isInteger(value, 'strict')) {
|
|
373
|
-
return value;
|
|
374
|
-
}
|
|
375
|
-
if (isInteger(value)) {
|
|
376
|
-
return parseInt(value, 10);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
if (inArray('number', types) || (!strictIntegers && inArray('integer', types))) {
|
|
380
|
-
if (isNumber(value, 'strict')) {
|
|
381
|
-
return value;
|
|
382
|
-
}
|
|
383
|
-
if (isNumber(value)) {
|
|
384
|
-
return parseFloat(value);
|
|
32
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: Framework, decorators: [{
|
|
33
|
+
type: Injectable
|
|
34
|
+
}] });
|
|
35
|
+
|
|
36
|
+
const deValidationMessages = {
|
|
37
|
+
required: 'Darf nicht leer sein',
|
|
38
|
+
minLength: 'Mindestens {{minimumLength}} Zeichen benötigt (aktuell: {{currentLength}})',
|
|
39
|
+
maxLength: 'Maximal {{maximumLength}} Zeichen erlaubt (aktuell: {{currentLength}})',
|
|
40
|
+
pattern: 'Entspricht nicht diesem regulären Ausdruck: {{requiredPattern}}',
|
|
41
|
+
format: function (error) {
|
|
42
|
+
switch (error.requiredFormat) {
|
|
43
|
+
case 'date':
|
|
44
|
+
return 'Muss ein Datum sein, z. B. "2000-12-31"';
|
|
45
|
+
case 'time':
|
|
46
|
+
return 'Muss eine Zeitangabe sein, z. B. "16:20" oder "03:14:15.9265"';
|
|
47
|
+
case 'date-time':
|
|
48
|
+
return 'Muss Datum mit Zeit beinhalten, z. B. "2000-03-14T01:59" oder "2000-03-14T01:59:26.535Z"';
|
|
49
|
+
case 'email':
|
|
50
|
+
return 'Keine gültige E-Mail-Adresse (z. B. "name@example.com")';
|
|
51
|
+
case 'hostname':
|
|
52
|
+
return 'Kein gültiger Hostname (z. B. "example.com")';
|
|
53
|
+
case 'ipv4':
|
|
54
|
+
return 'Keine gültige IPv4-Adresse (z. B. "127.0.0.1")';
|
|
55
|
+
case 'ipv6':
|
|
56
|
+
return 'Keine gültige IPv6-Adresse (z. B. "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0")';
|
|
57
|
+
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
58
|
+
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
59
|
+
case 'url':
|
|
60
|
+
return 'Keine gültige URL (z. B. "http://www.example.com/page.html")';
|
|
61
|
+
case 'uuid':
|
|
62
|
+
return 'Keine gültige UUID (z. B. "12345678-9ABC-DEF0-1234-56789ABCDEF0")';
|
|
63
|
+
case 'color':
|
|
64
|
+
return 'Kein gültiger Farbwert (z. B. "#FFFFFF" oder "rgb(255, 255, 255)")';
|
|
65
|
+
case 'json-pointer':
|
|
66
|
+
return 'Kein gültiger JSON-Pointer (z. B. "/pointer/to/something")';
|
|
67
|
+
case 'relative-json-pointer':
|
|
68
|
+
return 'Kein gültiger relativer JSON-Pointer (z. B. "2/pointer/to/something")';
|
|
69
|
+
case 'regex':
|
|
70
|
+
return 'Kein gültiger regulärer Ausdruck (z. B. "(1-)?\\d{3}-\\d{3}-\\d{4}")';
|
|
71
|
+
default:
|
|
72
|
+
return 'Muss diesem Format entsprechen: ' + error.requiredFormat;
|
|
385
73
|
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
74
|
+
},
|
|
75
|
+
minimum: 'Muss mindestens {{minimumValue}} sein',
|
|
76
|
+
exclusiveMinimum: 'Muss größer als {{exclusiveMinimumValue}} sein',
|
|
77
|
+
maximum: 'Darf maximal {{maximumValue}} sein',
|
|
78
|
+
exclusiveMaximum: 'Muss kleiner als {{exclusiveMaximumValue}} sein',
|
|
79
|
+
multipleOf: function (error) {
|
|
80
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
81
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
82
|
+
return `Maximal ${decimals} Dezimalstellen erlaubt`;
|
|
390
83
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (isDate(value)) {
|
|
394
|
-
return toIsoString(value);
|
|
84
|
+
else {
|
|
85
|
+
return `Muss ein Vielfaches von ${error.multipleOfValue} sein`;
|
|
395
86
|
}
|
|
396
|
-
|
|
397
|
-
|
|
87
|
+
},
|
|
88
|
+
minProperties: 'Mindestens {{minimumProperties}} Attribute erforderlich (aktuell: {{currentProperties}})',
|
|
89
|
+
maxProperties: 'Maximal {{maximumProperties}} Attribute erlaubt (aktuell: {{currentProperties}})',
|
|
90
|
+
minItems: 'Mindestens {{minimumItems}} Werte erforderlich (aktuell: {{currentItems}})',
|
|
91
|
+
maxItems: 'Maximal {{maximumItems}} Werte erlaubt (aktuell: {{currentItems}})',
|
|
92
|
+
uniqueItems: 'Alle Werte müssen eindeutig sein',
|
|
93
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const enValidationMessages = {
|
|
97
|
+
required: 'This field is required.',
|
|
98
|
+
minLength: 'Must be {{minimumLength}} characters or longer (current length: {{currentLength}})',
|
|
99
|
+
maxLength: 'Must be {{maximumLength}} characters or shorter (current length: {{currentLength}})',
|
|
100
|
+
pattern: 'Must match pattern: {{requiredPattern}}',
|
|
101
|
+
format: function (error) {
|
|
102
|
+
switch (error.requiredFormat) {
|
|
103
|
+
case 'date':
|
|
104
|
+
return 'Must be a date, like "2000-12-31"';
|
|
105
|
+
case 'time':
|
|
106
|
+
return 'Must be a time, like "16:20" or "03:14:15.9265"';
|
|
107
|
+
case 'date-time':
|
|
108
|
+
return 'Must be a date-time, like "2000-03-14T01:59" or "2000-03-14T01:59:26.535Z"';
|
|
109
|
+
case 'email':
|
|
110
|
+
return 'Must be an email address, like "name@example.com"';
|
|
111
|
+
case 'hostname':
|
|
112
|
+
return 'Must be a hostname, like "example.com"';
|
|
113
|
+
case 'ipv4':
|
|
114
|
+
return 'Must be an IPv4 address, like "127.0.0.1"';
|
|
115
|
+
case 'ipv6':
|
|
116
|
+
return 'Must be an IPv6 address, like "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
117
|
+
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
118
|
+
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
119
|
+
case 'url':
|
|
120
|
+
return 'Must be a url, like "http://www.example.com/page.html"';
|
|
121
|
+
case 'uuid':
|
|
122
|
+
return 'Must be a uuid, like "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
123
|
+
case 'color':
|
|
124
|
+
return 'Must be a color, like "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
125
|
+
case 'json-pointer':
|
|
126
|
+
return 'Must be a JSON Pointer, like "/pointer/to/something"';
|
|
127
|
+
case 'relative-json-pointer':
|
|
128
|
+
return 'Must be a relative JSON Pointer, like "2/pointer/to/something"';
|
|
129
|
+
case 'regex':
|
|
130
|
+
return 'Must be a regular expression, like "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
131
|
+
default:
|
|
132
|
+
return 'Must be a correctly formatted ' + error.requiredFormat;
|
|
398
133
|
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
return
|
|
134
|
+
},
|
|
135
|
+
minimum: 'Must be {{minimumValue}} or more',
|
|
136
|
+
exclusiveMinimum: 'Must be more than {{exclusiveMinimumValue}}',
|
|
137
|
+
maximum: 'Must be {{maximumValue}} or less',
|
|
138
|
+
exclusiveMaximum: 'Must be less than {{exclusiveMaximumValue}}',
|
|
139
|
+
multipleOf: function (error) {
|
|
140
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
141
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
142
|
+
return `Must have ${decimals} or fewer decimal places.`;
|
|
408
143
|
}
|
|
409
|
-
|
|
410
|
-
return
|
|
144
|
+
else {
|
|
145
|
+
return `Must be a multiple of ${error.multipleOfValue}.`;
|
|
411
146
|
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - allowed types to convert to
|
|
457
|
-
* // { PrimitiveValue }
|
|
458
|
-
*/
|
|
459
|
-
function toSchemaType(value, types) {
|
|
460
|
-
if (!isArray(types)) {
|
|
461
|
-
types = [types];
|
|
462
|
-
}
|
|
463
|
-
if (types.includes('null') && !hasValue(value)) {
|
|
464
|
-
return null;
|
|
465
|
-
}
|
|
466
|
-
if (types.includes('boolean') && !isBoolean(value, 'strict')) {
|
|
467
|
-
return value;
|
|
468
|
-
}
|
|
469
|
-
if (types.includes('integer')) {
|
|
470
|
-
const testValue = toJavaScriptType(value, 'integer');
|
|
471
|
-
if (testValue !== null) {
|
|
472
|
-
return +testValue;
|
|
147
|
+
},
|
|
148
|
+
minProperties: 'Must have {{minimumProperties}} or more items (current items: {{currentProperties}})',
|
|
149
|
+
maxProperties: 'Must have {{maximumProperties}} or fewer items (current items: {{currentProperties}})',
|
|
150
|
+
minItems: 'Must have {{minimumItems}} or more items (current items: {{currentItems}})',
|
|
151
|
+
maxItems: 'Must have {{maximumItems}} or fewer items (current items: {{currentItems}})',
|
|
152
|
+
uniqueItems: 'All items must be unique',
|
|
153
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const esValidationMessages = {
|
|
157
|
+
required: 'Este campo está requerido.',
|
|
158
|
+
minLength: 'Debe tener {{minimumLength}} caracteres o más longitud (longitud actual: {{currentLength}})',
|
|
159
|
+
maxLength: 'Debe tener {{maximumLength}} caracteres o menos longitud (longitud actual: {{currentLength}})',
|
|
160
|
+
pattern: 'Must match pattern: {{requiredPattern}}',
|
|
161
|
+
format: function (error) {
|
|
162
|
+
switch (error.requiredFormat) {
|
|
163
|
+
case 'date':
|
|
164
|
+
return 'Debe tener una fecha, ej "2000-12-31"';
|
|
165
|
+
case 'time':
|
|
166
|
+
return 'Debe tener una hora, ej "16:20" o "03:14:15.9265"';
|
|
167
|
+
case 'date-time':
|
|
168
|
+
return 'Debe tener fecha y hora, ej "2000-03-14T01:59" o "2000-03-14T01:59:26.535Z"';
|
|
169
|
+
case 'email':
|
|
170
|
+
return 'No hay dirección de correo electrónico válida, ej "name@example.com"';
|
|
171
|
+
case 'hostname':
|
|
172
|
+
return 'Debe ser un nombre de host válido, ej "example.com"';
|
|
173
|
+
case 'ipv4':
|
|
174
|
+
return 'Debe ser una dirección de IPv4, ej "127.0.0.1"';
|
|
175
|
+
case 'ipv6':
|
|
176
|
+
return 'Debe ser una dirección de IPv6, ej "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
177
|
+
case 'url':
|
|
178
|
+
return 'Debe ser una URL, ej "http://www.example.com/page.html"';
|
|
179
|
+
case 'uuid':
|
|
180
|
+
return 'Debe ser un UUID, ej "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
181
|
+
case 'color':
|
|
182
|
+
return 'Debe ser un color, ej "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
183
|
+
case 'json-pointer':
|
|
184
|
+
return 'Debe ser un JSON Pointer, ej "/pointer/to/something"';
|
|
185
|
+
case 'relative-json-pointer':
|
|
186
|
+
return 'Debe ser un JSON Pointer relativo, ej "2/pointer/to/something"';
|
|
187
|
+
case 'regex':
|
|
188
|
+
return 'Debe ser una expresión regular, ej "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
189
|
+
default:
|
|
190
|
+
return 'Debe tener el formato correcto ' + error.requiredFormat;
|
|
473
191
|
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
192
|
+
},
|
|
193
|
+
minimum: 'Debe ser {{minimumValue}} o más',
|
|
194
|
+
exclusiveMinimum: 'Debe ser superior a {{exclusiveMinimumValue}}',
|
|
195
|
+
maximum: 'Debe ser {{maximumValue}} o menos',
|
|
196
|
+
exclusiveMaximum: 'Debe ser menor que {{exclusiveMaximumValue}}',
|
|
197
|
+
multipleOf: function (error) {
|
|
198
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
199
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
200
|
+
return `Se permite un máximo de ${decimals} decimales`;
|
|
479
201
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
types.includes('string')) { // Convert number to string
|
|
483
|
-
return toJavaScriptType(value, 'string');
|
|
484
|
-
}
|
|
485
|
-
if (types.includes('boolean') && isBoolean(value)) {
|
|
486
|
-
return toJavaScriptType(value, 'boolean');
|
|
487
|
-
}
|
|
488
|
-
if (types.includes('string')) { // Convert null & boolean to string
|
|
489
|
-
if (value === null) {
|
|
490
|
-
return '';
|
|
202
|
+
else {
|
|
203
|
+
return `Debe ser múltiplo de ${error.multipleOfValue}.`;
|
|
491
204
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
205
|
+
},
|
|
206
|
+
minProperties: 'Debe tener {{minimumProperties}} o más elementos (elementos actuales: {{currentProperties}})',
|
|
207
|
+
maxProperties: 'Debe tener {{maximumProperties}} o menos elementos (elementos actuales: {{currentProperties}})',
|
|
208
|
+
minItems: 'Debe tener {{minimumItems}} o más elementos (elementos actuales: {{currentItems}})',
|
|
209
|
+
maxItems: 'Debe tener {{maximumItems}} o menos elementos (elementos actuales: {{currentItems}})',
|
|
210
|
+
uniqueItems: 'Todos los elementos deben ser únicos',
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const frValidationMessages = {
|
|
214
|
+
required: 'Est obligatoire.',
|
|
215
|
+
minLength: 'Doit avoir minimum {{minimumLength}} caractères (actuellement: {{currentLength}})',
|
|
216
|
+
maxLength: 'Doit avoir maximum {{maximumLength}} caractères (actuellement: {{currentLength}})',
|
|
217
|
+
pattern: 'Doit respecter: {{requiredPattern}}',
|
|
218
|
+
format: function (error) {
|
|
219
|
+
switch (error.requiredFormat) {
|
|
220
|
+
case 'date':
|
|
221
|
+
return 'Doit être une date, tel que "2000-12-31"';
|
|
222
|
+
case 'time':
|
|
223
|
+
return 'Doit être une heure, tel que "16:20" ou "03:14:15.9265"';
|
|
224
|
+
case 'date-time':
|
|
225
|
+
return 'Doit être une date et une heure, tel que "2000-03-14T01:59" ou "2000-03-14T01:59:26.535Z"';
|
|
226
|
+
case 'email':
|
|
227
|
+
return 'Doit être une adresse e-mail, tel que "name@example.com"';
|
|
228
|
+
case 'hostname':
|
|
229
|
+
return 'Doit être un nom de domaine, tel que "example.com"';
|
|
230
|
+
case 'ipv4':
|
|
231
|
+
return 'Doit être une adresse IPv4, tel que "127.0.0.1"';
|
|
232
|
+
case 'ipv6':
|
|
233
|
+
return 'Doit être une adresse IPv6, tel que "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
234
|
+
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
235
|
+
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
236
|
+
case 'url':
|
|
237
|
+
return 'Doit être une URL, tel que "http://www.example.com/page.html"';
|
|
238
|
+
case 'uuid':
|
|
239
|
+
return 'Doit être un UUID, tel que "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
240
|
+
case 'color':
|
|
241
|
+
return 'Doit être une couleur, tel que "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
242
|
+
case 'json-pointer':
|
|
243
|
+
return 'Doit être un JSON Pointer, tel que "/pointer/to/something"';
|
|
244
|
+
case 'relative-json-pointer':
|
|
245
|
+
return 'Doit être un relative JSON Pointer, tel que "2/pointer/to/something"';
|
|
246
|
+
case 'regex':
|
|
247
|
+
return 'Doit être une expression régulière, tel que "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
248
|
+
default:
|
|
249
|
+
return 'Doit être avoir le format correct: ' + error.requiredFormat;
|
|
495
250
|
}
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
if (
|
|
503
|
-
|
|
251
|
+
},
|
|
252
|
+
minimum: 'Doit être supérieur à {{minimumValue}}',
|
|
253
|
+
exclusiveMinimum: 'Doit avoir minimum {{exclusiveMinimumValue}} charactères',
|
|
254
|
+
maximum: 'Doit être inférieur à {{maximumValue}}',
|
|
255
|
+
exclusiveMaximum: 'Doit avoir maximum {{exclusiveMaximumValue}} charactères',
|
|
256
|
+
multipleOf: function (error) {
|
|
257
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
258
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
259
|
+
return `Doit comporter ${decimals} ou moins de decimales.`;
|
|
504
260
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
const testValue = parseFloat(value);
|
|
508
|
-
if (!!testValue) {
|
|
509
|
-
return testValue;
|
|
261
|
+
else {
|
|
262
|
+
return `Doit être un multiple de ${error.multipleOfValue}.`;
|
|
510
263
|
}
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
264
|
+
},
|
|
265
|
+
minProperties: 'Doit comporter au minimum {{minimumProperties}} éléments',
|
|
266
|
+
maxProperties: 'Doit comporter au maximum {{maximumProperties}} éléments',
|
|
267
|
+
minItems: 'Doit comporter au minimum {{minimumItems}} éléments',
|
|
268
|
+
maxItems: 'Doit comporter au maximum {{minimumItems}} éléments',
|
|
269
|
+
uniqueItems: 'Tous les éléments doivent être uniques',
|
|
270
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
const itValidationMessages = {
|
|
274
|
+
required: 'Il campo è obbligatorio',
|
|
275
|
+
minLength: 'Deve inserire almeno {{minimumLength}} caratteri (lunghezza corrente: {{currentLength}})',
|
|
276
|
+
maxLength: 'Il numero massimo di caratteri consentito è {{maximumLength}} (lunghezza corrente: {{currentLength}})',
|
|
277
|
+
pattern: 'Devi rispettare il pattern : {{requiredPattern}}',
|
|
278
|
+
format: function (error) {
|
|
279
|
+
switch (error.requiredFormat) {
|
|
280
|
+
case 'date':
|
|
281
|
+
return 'Deve essere una data, come "31-12-2000"';
|
|
282
|
+
case 'time':
|
|
283
|
+
return 'Deve essere un orario, come "16:20" o "03:14:15.9265"';
|
|
284
|
+
case 'date-time':
|
|
285
|
+
return 'Deve essere data-orario, come "14-03-2000T01:59" or "14-03-2000T01:59:26.535Z"';
|
|
286
|
+
case 'email':
|
|
287
|
+
return 'Deve essere un indirzzo email, come "name@example.com"';
|
|
288
|
+
case 'hostname':
|
|
289
|
+
return 'Deve essere un hostname, come "example.com"';
|
|
290
|
+
case 'ipv4':
|
|
291
|
+
return 'Deve essere un indirizzo IPv4, come "127.0.0.1"';
|
|
292
|
+
case 'ipv6':
|
|
293
|
+
return 'Deve essere un indirizzo IPv6, come "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
294
|
+
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
295
|
+
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
296
|
+
case 'url':
|
|
297
|
+
return 'Deve essere un url, come "http://www.example.com/page.html"';
|
|
298
|
+
case 'uuid':
|
|
299
|
+
return 'Deve essere un uuid, come "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
300
|
+
case 'color':
|
|
301
|
+
return 'Deve essere un colore, come "#FFFFFF" o "rgb(255, 255, 255)"';
|
|
302
|
+
case 'json-pointer':
|
|
303
|
+
return 'Deve essere un JSON Pointer, come "/pointer/to/something"';
|
|
304
|
+
case 'relative-json-pointer':
|
|
305
|
+
return 'Deve essere un JSON Pointer relativo, come "2/pointer/to/something"';
|
|
306
|
+
case 'regex':
|
|
307
|
+
return 'Deve essere una regular expression, come "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
308
|
+
default:
|
|
309
|
+
return 'Deve essere formattato correttamente ' + error.requiredFormat;
|
|
516
310
|
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
}
|
|
311
|
+
},
|
|
312
|
+
minimum: 'Deve essere {{minimumValue}} o più',
|
|
313
|
+
exclusiveMinimum: 'Deve essere più di {{exclusiveMinimumValue}}',
|
|
314
|
+
maximum: 'Deve essere {{maximumValue}} o meno',
|
|
315
|
+
exclusiveMaximum: 'Deve essere minore di {{exclusiveMaximumValue}}',
|
|
316
|
+
multipleOf: function (error) {
|
|
317
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
318
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
319
|
+
return `Deve avere ${decimals} o meno decimali.`;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
return `Deve essere multiplo di ${error.multipleOfValue}.`;
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
minProperties: 'Deve avere {{minimumProperties}} o più elementi (elementi correnti: {{currentProperties}})',
|
|
326
|
+
maxProperties: 'Deve avere {{maximumProperties}} o meno elementi (elementi correnti: {{currentProperties}})',
|
|
327
|
+
minItems: 'Deve avere {{minimumItems}} o più elementi (elementi correnti: {{currentItems}})',
|
|
328
|
+
maxItems: 'Deve avere {{maximumItems}} o meno elementi (elementi correnti: {{currentItems}})',
|
|
329
|
+
uniqueItems: 'Tutti gli elementi devono essere unici',
|
|
330
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
const ptValidationMessages = {
|
|
334
|
+
required: 'Este campo é obrigatório.',
|
|
335
|
+
minLength: 'É preciso no mínimo {{minimumLength}} caracteres ou mais (tamanho atual: {{currentLength}})',
|
|
336
|
+
maxLength: 'É preciso no máximo {{maximumLength}} caracteres ou menos (tamanho atual: {{currentLength}})',
|
|
337
|
+
pattern: 'Tem que ajustar ao formato: {{requiredPattern}}',
|
|
338
|
+
format: function (error) {
|
|
339
|
+
switch (error.requiredFormat) {
|
|
340
|
+
case 'date':
|
|
341
|
+
return 'Tem que ser uma data, por exemplo "2000-12-31"';
|
|
342
|
+
case 'time':
|
|
343
|
+
return 'Tem que ser horário, por exemplo "16:20" ou "03:14:15.9265"';
|
|
344
|
+
case 'date-time':
|
|
345
|
+
return 'Tem que ser data e hora, por exemplo "2000-03-14T01:59" ou "2000-03-14T01:59:26.535Z"';
|
|
346
|
+
case 'email':
|
|
347
|
+
return 'Tem que ser um email, por exemplo "fulano@exemplo.com.br"';
|
|
348
|
+
case 'hostname':
|
|
349
|
+
return 'Tem que ser uma nome de domínio, por exemplo "exemplo.com.br"';
|
|
350
|
+
case 'ipv4':
|
|
351
|
+
return 'Tem que ser um endereço IPv4, por exemplo "127.0.0.1"';
|
|
352
|
+
case 'ipv6':
|
|
353
|
+
return 'Tem que ser um endereço IPv6, por exemplo "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
354
|
+
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
355
|
+
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
356
|
+
case 'url':
|
|
357
|
+
return 'Tem que ser uma URL, por exemplo "http://www.exemplo.com.br/pagina.html"';
|
|
358
|
+
case 'uuid':
|
|
359
|
+
return 'Tem que ser um uuid, por exemplo "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
360
|
+
case 'color':
|
|
361
|
+
return 'Tem que ser uma cor, por exemplo "#FFFFFF" ou "rgb(255, 255, 255)"';
|
|
362
|
+
case 'json-pointer':
|
|
363
|
+
return 'Tem que ser um JSON Pointer, por exemplo "/referencia/para/algo"';
|
|
364
|
+
case 'relative-json-pointer':
|
|
365
|
+
return 'Tem que ser um JSON Pointer relativo, por exemplo "2/referencia/para/algo"';
|
|
366
|
+
case 'regex':
|
|
367
|
+
return 'Tem que ser uma expressão regular, por exemplo "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
368
|
+
default:
|
|
369
|
+
return 'Tem que ser no formato: ' + error.requiredFormat;
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
minimum: 'Tem que ser {{minimumValue}} ou mais',
|
|
373
|
+
exclusiveMinimum: 'Tem que ser mais que {{exclusiveMinimumValue}}',
|
|
374
|
+
maximum: 'Tem que ser {{maximumValue}} ou menos',
|
|
375
|
+
exclusiveMaximum: 'Tem que ser menor que {{exclusiveMaximumValue}}',
|
|
376
|
+
multipleOf: function (error) {
|
|
377
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
378
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
379
|
+
return `Tem que ter ${decimals} ou menos casas decimais.`;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
return `Tem que ser um múltiplo de ${error.multipleOfValue}.`;
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
minProperties: 'Deve ter {{minimumProperties}} ou mais itens (itens até o momento: {{currentProperties}})',
|
|
386
|
+
maxProperties: 'Deve ter {{maximumProperties}} ou menos intens (itens até o momento: {{currentProperties}})',
|
|
387
|
+
minItems: 'Deve ter {{minimumItems}} ou mais itens (itens até o momento: {{currentItems}})',
|
|
388
|
+
maxItems: 'Deve ter {{maximumItems}} ou menos itens (itens até o momento: {{currentItems}})',
|
|
389
|
+
uniqueItems: 'Todos os itens devem ser únicos',
|
|
390
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const zhValidationMessages = {
|
|
394
|
+
required: '必填字段.',
|
|
395
|
+
minLength: '字符长度必须大于或者等于 {{minimumLength}} (当前长度: {{currentLength}})',
|
|
396
|
+
maxLength: '字符长度必须小于或者等于 {{maximumLength}} (当前长度: {{currentLength}})',
|
|
397
|
+
pattern: '必须匹配正则表达式: {{requiredPattern}}',
|
|
398
|
+
format: function (error) {
|
|
399
|
+
switch (error.requiredFormat) {
|
|
400
|
+
case 'date':
|
|
401
|
+
return '必须为日期格式, 比如 "2000-12-31"';
|
|
402
|
+
case 'time':
|
|
403
|
+
return '必须为时间格式, 比如 "16:20" 或者 "03:14:15.9265"';
|
|
404
|
+
case 'date-time':
|
|
405
|
+
return '必须为日期时间格式, 比如 "2000-03-14T01:59" 或者 "2000-03-14T01:59:26.535Z"';
|
|
406
|
+
case 'email':
|
|
407
|
+
return '必须为邮箱地址, 比如 "name@example.com"';
|
|
408
|
+
case 'hostname':
|
|
409
|
+
return '必须为主机名, 比如 "example.com"';
|
|
410
|
+
case 'ipv4':
|
|
411
|
+
return '必须为 IPv4 地址, 比如 "127.0.0.1"';
|
|
412
|
+
case 'ipv6':
|
|
413
|
+
return '必须为 IPv6 地址, 比如 "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
414
|
+
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
415
|
+
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
416
|
+
case 'url':
|
|
417
|
+
return '必须为 url, 比如 "http://www.example.com/page.html"';
|
|
418
|
+
case 'uuid':
|
|
419
|
+
return '必须为 uuid, 比如 "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
420
|
+
case 'color':
|
|
421
|
+
return '必须为颜色值, 比如 "#FFFFFF" 或者 "rgb(255, 255, 255)"';
|
|
422
|
+
case 'json-pointer':
|
|
423
|
+
return '必须为 JSON Pointer, 比如 "/pointer/to/something"';
|
|
424
|
+
case 'relative-json-pointer':
|
|
425
|
+
return '必须为相对的 JSON Pointer, 比如 "2/pointer/to/something"';
|
|
426
|
+
case 'regex':
|
|
427
|
+
return '必须为正则表达式, 比如 "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
428
|
+
default:
|
|
429
|
+
return '必须为格式正确的 ' + error.requiredFormat;
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
minimum: '必须大于或者等于最小值: {{minimumValue}}',
|
|
433
|
+
exclusiveMinimum: '必须大于最小值: {{exclusiveMinimumValue}}',
|
|
434
|
+
maximum: '必须小于或者等于最大值: {{maximumValue}}',
|
|
435
|
+
exclusiveMaximum: '必须小于最大值: {{exclusiveMaximumValue}}',
|
|
436
|
+
multipleOf: function (error) {
|
|
437
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
438
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
439
|
+
return `必须有 ${decimals} 位或更少的小数位`;
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
return `必须为 ${error.multipleOfValue} 的倍数`;
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
minProperties: '项目数必须大于或者等于 {{minimumProperties}} (当前项目数: {{currentProperties}})',
|
|
446
|
+
maxProperties: '项目数必须小于或者等于 {{maximumProperties}} (当前项目数: {{currentProperties}})',
|
|
447
|
+
minItems: '项目数必须大于或者等于 {{minimumItems}} (当前项目数: {{currentItems}})',
|
|
448
|
+
maxItems: '项目数必须小于或者等于 {{maximumItems}} (当前项目数: {{currentItems}})',
|
|
449
|
+
uniqueItems: '所有项目必须是唯一的',
|
|
450
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
451
|
+
};
|
|
452
|
+
|
|
526
453
|
/**
|
|
527
|
-
* '
|
|
454
|
+
* '_executeValidators' utility function
|
|
528
455
|
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
531
|
-
|
|
532
|
-
function isPromise(object) {
|
|
533
|
-
return !!object && typeof object.then === 'function';
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* 'isObservable' function
|
|
456
|
+
* Validates a control against an array of validators, and returns
|
|
457
|
+
* an array of the same length containing a combination of error messages
|
|
458
|
+
* (from invalid validators) and null values (from valid validators)
|
|
537
459
|
*
|
|
538
|
-
* //
|
|
539
|
-
* //
|
|
460
|
+
* // { AbstractControl } control - control to validate
|
|
461
|
+
* // { IValidatorFn[] } validators - array of validators
|
|
462
|
+
* // { boolean } invert - invert?
|
|
463
|
+
* // { PlainObject[] } - array of nulls and error message
|
|
540
464
|
*/
|
|
541
|
-
function
|
|
542
|
-
return
|
|
465
|
+
function _executeValidators(control, validators, invert = false) {
|
|
466
|
+
return validators.map(validator => validator(control, invert));
|
|
543
467
|
}
|
|
544
468
|
/**
|
|
545
|
-
* '
|
|
469
|
+
* '_executeAsyncValidators' utility function
|
|
546
470
|
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
471
|
+
* Validates a control against an array of async validators, and returns
|
|
472
|
+
* an array of observabe results of the same length containing a combination of
|
|
473
|
+
* error messages (from invalid validators) and null values (from valid ones)
|
|
474
|
+
*
|
|
475
|
+
* // { AbstractControl } control - control to validate
|
|
476
|
+
* // { AsyncIValidatorFn[] } validators - array of async validators
|
|
477
|
+
* // { boolean } invert - invert?
|
|
478
|
+
* // - array of observable nulls and error message
|
|
549
479
|
*/
|
|
550
|
-
function
|
|
551
|
-
return
|
|
480
|
+
function _executeAsyncValidators(control, validators, invert = false) {
|
|
481
|
+
return validators.map(validator => validator(control, invert));
|
|
552
482
|
}
|
|
553
483
|
/**
|
|
554
|
-
* '
|
|
484
|
+
* '_mergeObjects' utility function
|
|
555
485
|
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
486
|
+
* Recursively Merges one or more objects into a single object with combined keys.
|
|
487
|
+
* Automatically detects and ignores null and undefined inputs.
|
|
488
|
+
* Also detects duplicated boolean 'not' keys and XORs their values.
|
|
489
|
+
*
|
|
490
|
+
* // { PlainObject[] } objects - one or more objects to merge
|
|
491
|
+
* // { PlainObject } - merged object
|
|
558
492
|
*/
|
|
559
|
-
function
|
|
560
|
-
const
|
|
561
|
-
|
|
562
|
-
|
|
493
|
+
function _mergeObjects(...objects) {
|
|
494
|
+
const mergedObject = {};
|
|
495
|
+
for (const currentObject of objects) {
|
|
496
|
+
if (isObject(currentObject)) {
|
|
497
|
+
for (const key of Object.keys(currentObject)) {
|
|
498
|
+
const currentValue = currentObject[key];
|
|
499
|
+
const mergedValue = mergedObject[key];
|
|
500
|
+
mergedObject[key] = !isDefined(mergedValue) ? currentValue :
|
|
501
|
+
key === 'not' && isBoolean(mergedValue, 'strict') &&
|
|
502
|
+
isBoolean(currentValue, 'strict') ? xor(mergedValue, currentValue) :
|
|
503
|
+
getType(mergedValue) === 'object' && getType(currentValue) === 'object' ?
|
|
504
|
+
_mergeObjects(mergedValue, currentValue) :
|
|
505
|
+
currentValue;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
563
508
|
}
|
|
564
|
-
|
|
565
|
-
return new Observable();
|
|
509
|
+
return mergedObject;
|
|
566
510
|
}
|
|
567
511
|
/**
|
|
568
|
-
* '
|
|
569
|
-
*
|
|
570
|
-
* Searches an array for an item, or one of a list of items, and returns true
|
|
571
|
-
* as soon as a match is found, or false if no match.
|
|
512
|
+
* '_mergeErrors' utility function
|
|
572
513
|
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
* are found in the array list, and false if any element is not found. If the
|
|
576
|
-
* item to find is not an array, setting allIn to TRUE has no effect.
|
|
514
|
+
* Merges an array of objects.
|
|
515
|
+
* Used for combining the validator errors returned from 'executeValidators'
|
|
577
516
|
*
|
|
578
|
-
* // {
|
|
579
|
-
* //
|
|
580
|
-
* // { boolean = false } allIn - if TRUE, all items must be in array
|
|
581
|
-
* // { boolean } - true if item(s) in array, false otherwise
|
|
517
|
+
* // { PlainObject[] } arrayOfErrors - array of objects
|
|
518
|
+
* // { PlainObject } - merged object, or null if no usable input objectcs
|
|
582
519
|
*/
|
|
583
|
-
function
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
return isArray(item) ?
|
|
588
|
-
item[allIn ? 'every' : 'some'](subItem => array.includes(subItem)) :
|
|
589
|
-
array.includes(item);
|
|
520
|
+
function _mergeErrors(arrayOfErrors) {
|
|
521
|
+
const mergedErrors = _mergeObjects(...arrayOfErrors);
|
|
522
|
+
return isEmpty(mergedErrors) ? null : mergedErrors;
|
|
590
523
|
}
|
|
591
524
|
/**
|
|
592
|
-
* '
|
|
525
|
+
* 'isDefined' utility function
|
|
593
526
|
*
|
|
594
|
-
*
|
|
527
|
+
* Checks if a variable contains a value of any type.
|
|
528
|
+
* Returns true even for otherwise 'falsey' values of 0, '', and false.
|
|
595
529
|
*
|
|
596
|
-
* //
|
|
597
|
-
* //
|
|
598
|
-
* // { boolean } - true if exactly one input value is truthy, false if not
|
|
530
|
+
* // value - the value to check
|
|
531
|
+
* // { boolean } - false if undefined or null, otherwise true
|
|
599
532
|
*/
|
|
600
|
-
function
|
|
601
|
-
return
|
|
533
|
+
function isDefined(value) {
|
|
534
|
+
return value !== undefined && value !== null;
|
|
602
535
|
}
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* Utility function library:
|
|
606
|
-
*
|
|
607
|
-
* addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject,
|
|
608
|
-
* uniqueItems, commonItems, fixTitle, toTitleCase
|
|
609
|
-
*/
|
|
610
536
|
/**
|
|
611
|
-
* '
|
|
537
|
+
* 'hasValue' utility function
|
|
612
538
|
*
|
|
613
|
-
*
|
|
539
|
+
* Checks if a variable contains a value.
|
|
540
|
+
* Returs false for null, undefined, or a zero-length strng, '',
|
|
541
|
+
* otherwise returns true.
|
|
542
|
+
* (Stricter than 'isDefined' because it also returns false for '',
|
|
543
|
+
* though it stil returns true for otherwise 'falsey' values 0 and false.)
|
|
614
544
|
*
|
|
615
|
-
* //
|
|
616
|
-
* // {
|
|
617
|
-
* // {string | string[] | Set<string>} - Combined classes
|
|
545
|
+
* // value - the value to check
|
|
546
|
+
* // { boolean } - false if undefined, null, or '', otherwise true
|
|
618
547
|
*/
|
|
619
|
-
function
|
|
620
|
-
|
|
621
|
-
if (badType(newClasses)) {
|
|
622
|
-
return oldClasses;
|
|
623
|
-
}
|
|
624
|
-
if (badType(oldClasses)) {
|
|
625
|
-
oldClasses = '';
|
|
626
|
-
}
|
|
627
|
-
const toSet = i => isSet(i) ? i : isArray(i) ? new Set(i) : new Set(i.split(' '));
|
|
628
|
-
const combinedSet = toSet(oldClasses);
|
|
629
|
-
const newSet = toSet(newClasses);
|
|
630
|
-
newSet.forEach(c => combinedSet.add(c));
|
|
631
|
-
if (isSet(oldClasses)) {
|
|
632
|
-
return combinedSet;
|
|
633
|
-
}
|
|
634
|
-
if (isArray(oldClasses)) {
|
|
635
|
-
return Array.from(combinedSet);
|
|
636
|
-
}
|
|
637
|
-
return Array.from(combinedSet).join(' ');
|
|
548
|
+
function hasValue(value) {
|
|
549
|
+
return value !== undefined && value !== null && value !== '';
|
|
638
550
|
}
|
|
639
551
|
/**
|
|
640
|
-
* '
|
|
552
|
+
* 'isEmpty' utility function
|
|
641
553
|
*
|
|
642
|
-
*
|
|
643
|
-
* If passed a JavaScript primitive value (string, number, boolean, or null),
|
|
644
|
-
* it returns the value.
|
|
554
|
+
* Similar to !hasValue, but also returns true for empty arrays and objects.
|
|
645
555
|
*
|
|
646
|
-
* //
|
|
647
|
-
* // {boolean
|
|
648
|
-
* // {Object|Array|string|number|boolean|null} - The copied object
|
|
556
|
+
* // value - the value to check
|
|
557
|
+
* // { boolean } - false if undefined, null, or '', otherwise true
|
|
649
558
|
*/
|
|
650
|
-
function
|
|
651
|
-
if (
|
|
652
|
-
return
|
|
653
|
-
}
|
|
654
|
-
if (isMap(object)) {
|
|
655
|
-
return new Map(object);
|
|
656
|
-
}
|
|
657
|
-
if (isSet(object)) {
|
|
658
|
-
return new Set(object);
|
|
659
|
-
}
|
|
660
|
-
if (isArray(object)) {
|
|
661
|
-
return [...object];
|
|
662
|
-
}
|
|
663
|
-
if (isObject(object)) {
|
|
664
|
-
return { ...object };
|
|
559
|
+
function isEmpty(value) {
|
|
560
|
+
if (isArray(value)) {
|
|
561
|
+
return !value.length;
|
|
665
562
|
}
|
|
666
|
-
if (
|
|
667
|
-
|
|
563
|
+
if (isObject(value)) {
|
|
564
|
+
return !Object.keys(value).length;
|
|
668
565
|
}
|
|
669
|
-
return
|
|
566
|
+
return value === undefined || value === null || value === '';
|
|
670
567
|
}
|
|
671
568
|
/**
|
|
672
|
-
* '
|
|
673
|
-
*
|
|
674
|
-
* Iterates over all items in the first level of an object or array
|
|
675
|
-
* and calls an iterator funciton on each item.
|
|
676
|
-
*
|
|
677
|
-
* The iterator function is called with four values:
|
|
678
|
-
* 1. The current item's value
|
|
679
|
-
* 2. The current item's key
|
|
680
|
-
* 3. The parent object, which contains the current item
|
|
681
|
-
* 4. The root object
|
|
569
|
+
* 'isString' utility function
|
|
682
570
|
*
|
|
683
|
-
*
|
|
684
|
-
* it to also recursively iterate over items in sub-objects or sub-arrays in the
|
|
685
|
-
* specified direction.
|
|
571
|
+
* Checks if a value is a string.
|
|
686
572
|
*
|
|
687
|
-
* //
|
|
688
|
-
* // {
|
|
689
|
-
* // {boolean = false} errors - Show errors?
|
|
690
|
-
* // {void}
|
|
573
|
+
* // value - the value to check
|
|
574
|
+
* // { boolean } - true if string, false if not
|
|
691
575
|
*/
|
|
692
|
-
function
|
|
693
|
-
|
|
694
|
-
return;
|
|
695
|
-
}
|
|
696
|
-
if ((isObject(object) || isArray(object)) && typeof fn === 'function') {
|
|
697
|
-
for (const key of Object.keys(object)) {
|
|
698
|
-
const value = object[key];
|
|
699
|
-
if (recurse === 'bottom-up' && (isObject(value) || isArray(value))) {
|
|
700
|
-
forEach(value, fn, recurse, rootObject);
|
|
701
|
-
}
|
|
702
|
-
fn(value, key, object, rootObject);
|
|
703
|
-
if (recurse === 'top-down' && (isObject(value) || isArray(value))) {
|
|
704
|
-
forEach(value, fn, recurse, rootObject);
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
if (errors) {
|
|
709
|
-
if (typeof fn !== 'function') {
|
|
710
|
-
console.error('forEach error: Iterator must be a function.');
|
|
711
|
-
console.error('function', fn);
|
|
712
|
-
}
|
|
713
|
-
if (!isObject(object) && !isArray(object)) {
|
|
714
|
-
console.error('forEach error: Input object must be an object or array.');
|
|
715
|
-
console.error('object', object);
|
|
716
|
-
}
|
|
717
|
-
}
|
|
576
|
+
function isString(value) {
|
|
577
|
+
return typeof value === 'string';
|
|
718
578
|
}
|
|
719
579
|
/**
|
|
720
|
-
* '
|
|
721
|
-
*
|
|
722
|
-
* Iterates over all items in the first level of an object or array
|
|
723
|
-
* and calls an iterator function on each item. Returns a new object or array
|
|
724
|
-
* with the same keys or indexes as the original, and values set to the results
|
|
725
|
-
* of the iterator function.
|
|
580
|
+
* 'isNumber' utility function
|
|
726
581
|
*
|
|
727
|
-
*
|
|
582
|
+
* Checks if a value is a regular number, numeric string, or JavaScript Date.
|
|
728
583
|
*
|
|
729
|
-
* //
|
|
730
|
-
* //
|
|
731
|
-
* // {boolean
|
|
732
|
-
* // {Object | Array} - The resulting object or array
|
|
584
|
+
* // value - the value to check
|
|
585
|
+
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
586
|
+
* // { boolean } - true if number, false if not
|
|
733
587
|
*/
|
|
734
|
-
function
|
|
735
|
-
if (
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
if ((isObject(object) || isArray(object)) && typeof object !== 'function') {
|
|
739
|
-
const newObject = isArray(object) ? [] : {};
|
|
740
|
-
for (const key of Object.keys(object)) {
|
|
741
|
-
newObject[key] = fn(object[key], key, object);
|
|
742
|
-
}
|
|
743
|
-
return newObject;
|
|
744
|
-
}
|
|
745
|
-
if (errors) {
|
|
746
|
-
if (typeof fn !== 'function') {
|
|
747
|
-
console.error('forEachCopy error: Iterator must be a function.');
|
|
748
|
-
console.error('function', fn);
|
|
749
|
-
}
|
|
750
|
-
if (!isObject(object) && !isArray(object)) {
|
|
751
|
-
console.error('forEachCopy error: Input object must be an object or array.');
|
|
752
|
-
console.error('object', object);
|
|
753
|
-
}
|
|
588
|
+
function isNumber(value, strict = false) {
|
|
589
|
+
if (strict && typeof value !== 'number') {
|
|
590
|
+
return false;
|
|
754
591
|
}
|
|
592
|
+
return !isNaN(value) && value !== value / 0;
|
|
755
593
|
}
|
|
756
594
|
/**
|
|
757
|
-
* '
|
|
595
|
+
* 'isInteger' utility function
|
|
758
596
|
*
|
|
759
|
-
* Checks
|
|
597
|
+
* Checks if a value is an integer.
|
|
760
598
|
*
|
|
761
|
-
* //
|
|
762
|
-
* //
|
|
763
|
-
* // {boolean} - true if
|
|
599
|
+
* // value - the value to check
|
|
600
|
+
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
601
|
+
* // {boolean } - true if number, false if not
|
|
764
602
|
*/
|
|
765
|
-
function
|
|
766
|
-
if (
|
|
767
|
-
(!isObject(object) && !isArray(object) && !isMap(object) && !isSet(object))) {
|
|
603
|
+
function isInteger(value, strict = false) {
|
|
604
|
+
if (strict && typeof value !== 'number') {
|
|
768
605
|
return false;
|
|
769
606
|
}
|
|
770
|
-
|
|
771
|
-
return object.has(property);
|
|
772
|
-
}
|
|
773
|
-
if (typeof property === 'number') {
|
|
774
|
-
if (isArray(object)) {
|
|
775
|
-
return object[property];
|
|
776
|
-
}
|
|
777
|
-
property = property + '';
|
|
778
|
-
}
|
|
779
|
-
return object.hasOwnProperty(property);
|
|
607
|
+
return !isNaN(value) && value !== value / 0 && value % 1 === 0;
|
|
780
608
|
}
|
|
781
609
|
/**
|
|
782
|
-
*
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* Detects the type of expression from the given candidate. `==` for equals,
|
|
792
|
-
* `!=` for not equals. If none of these are contained in the candidate, the candidate
|
|
793
|
-
* is not considered to be an expression at all and thus `NOT_AN_EXPRESSION` is returned.
|
|
794
|
-
* // {expressionCandidate} expressionCandidate - potential expression
|
|
610
|
+
* 'isBoolean' utility function
|
|
611
|
+
*
|
|
612
|
+
* Checks if a value is a boolean.
|
|
613
|
+
*
|
|
614
|
+
* // value - the value to check
|
|
615
|
+
* // { any = null } option - if 'strict', also checks JavaScript type
|
|
616
|
+
* if TRUE or FALSE, checks only for that value
|
|
617
|
+
* // { boolean } - true if boolean, false if not
|
|
795
618
|
*/
|
|
796
|
-
function
|
|
797
|
-
if (
|
|
798
|
-
return
|
|
619
|
+
function isBoolean(value, option = null) {
|
|
620
|
+
if (option === 'strict') {
|
|
621
|
+
return value === true || value === false;
|
|
799
622
|
}
|
|
800
|
-
if (
|
|
801
|
-
return
|
|
623
|
+
if (option === true) {
|
|
624
|
+
return value === true || value === 1 || value === 'true' || value === '1';
|
|
802
625
|
}
|
|
803
|
-
|
|
626
|
+
if (option === false) {
|
|
627
|
+
return value === false || value === 0 || value === 'false' || value === '0';
|
|
628
|
+
}
|
|
629
|
+
return value === true || value === 1 || value === 'true' || value === '1' ||
|
|
630
|
+
value === false || value === 0 || value === 'false' || value === '0';
|
|
804
631
|
}
|
|
805
|
-
function
|
|
806
|
-
return
|
|
632
|
+
function isFunction(item) {
|
|
633
|
+
return typeof item === 'function';
|
|
807
634
|
}
|
|
808
|
-
function
|
|
809
|
-
return
|
|
635
|
+
function isObject(item) {
|
|
636
|
+
return item !== null && typeof item === 'object';
|
|
810
637
|
}
|
|
811
|
-
function
|
|
812
|
-
return
|
|
638
|
+
function isArray(item) {
|
|
639
|
+
return Array.isArray(item);
|
|
813
640
|
}
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
* before and after the equals or nor equals sign.
|
|
817
|
-
* // {expressionType} enum of an expression type
|
|
818
|
-
* // {key} the given key from a for loop iver all conditions
|
|
819
|
-
*/
|
|
820
|
-
function getKeyAndValueByExpressionType(expressionType, key) {
|
|
821
|
-
if (isEqual(expressionType)) {
|
|
822
|
-
return key.split('==', 2);
|
|
823
|
-
}
|
|
824
|
-
if (isNotEqual(expressionType)) {
|
|
825
|
-
return key.split('!=', 2);
|
|
826
|
-
}
|
|
827
|
-
return null;
|
|
641
|
+
function isDate(item) {
|
|
642
|
+
return !!item && Object.prototype.toString.call(item) === '[object Date]';
|
|
828
643
|
}
|
|
829
|
-
function
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
return
|
|
644
|
+
function isMap(item) {
|
|
645
|
+
return !!item && Object.prototype.toString.call(item) === '[object Map]';
|
|
646
|
+
}
|
|
647
|
+
function isSet(item) {
|
|
648
|
+
return !!item && Object.prototype.toString.call(item) === '[object Set]';
|
|
649
|
+
}
|
|
650
|
+
function isSymbol(item) {
|
|
651
|
+
return typeof item === 'symbol';
|
|
834
652
|
}
|
|
835
653
|
/**
|
|
836
|
-
* '
|
|
654
|
+
* 'getType' function
|
|
837
655
|
*
|
|
838
|
-
*
|
|
839
|
-
*
|
|
656
|
+
* Detects the JSON Schema Type of a value.
|
|
657
|
+
* By default, detects numbers and integers even if formatted as strings.
|
|
658
|
+
* (So all integers are also numbers, and any number may also be a string.)
|
|
659
|
+
* However, it only detects true boolean values (to detect boolean values
|
|
660
|
+
* in non-boolean formats, use isBoolean() instead).
|
|
840
661
|
*
|
|
841
|
-
*
|
|
842
|
-
*
|
|
662
|
+
* If passed a second optional parameter of 'strict', it will only detect
|
|
663
|
+
* numbers and integers if they are formatted as JavaScript numbers.
|
|
843
664
|
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
*
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
*
|
|
665
|
+
* Examples:
|
|
666
|
+
* getType('10.5') = 'number'
|
|
667
|
+
* getType(10.5) = 'number'
|
|
668
|
+
* getType('10') = 'integer'
|
|
669
|
+
* getType(10) = 'integer'
|
|
670
|
+
* getType('true') = 'string'
|
|
671
|
+
* getType(true) = 'boolean'
|
|
672
|
+
* getType(null) = 'null'
|
|
673
|
+
* getType({ }) = 'object'
|
|
674
|
+
* getType([]) = 'array'
|
|
675
|
+
*
|
|
676
|
+
* getType('10.5', 'strict') = 'string'
|
|
677
|
+
* getType(10.5, 'strict') = 'number'
|
|
678
|
+
* getType('10', 'strict') = 'string'
|
|
679
|
+
* getType(10, 'strict') = 'integer'
|
|
680
|
+
* getType('true', 'strict') = 'string'
|
|
681
|
+
* getType(true, 'strict') = 'boolean'
|
|
682
|
+
*
|
|
683
|
+
* // value - value to check
|
|
684
|
+
* // { any = false } strict - if truthy, also checks JavaScript tyoe
|
|
685
|
+
* // { SchemaType }
|
|
850
686
|
*/
|
|
851
|
-
function
|
|
852
|
-
if (!
|
|
853
|
-
return
|
|
687
|
+
function getType(value, strict = false) {
|
|
688
|
+
if (!isDefined(value)) {
|
|
689
|
+
return 'null';
|
|
854
690
|
}
|
|
855
|
-
if (
|
|
856
|
-
|
|
691
|
+
if (isArray(value)) {
|
|
692
|
+
return 'array';
|
|
857
693
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
targetObject[keyFn(key)] = valFn(sourceObject[key]);
|
|
861
|
-
}
|
|
694
|
+
if (isObject(value)) {
|
|
695
|
+
return 'object';
|
|
862
696
|
}
|
|
863
|
-
|
|
697
|
+
if (isBoolean(value, 'strict')) {
|
|
698
|
+
return 'boolean';
|
|
699
|
+
}
|
|
700
|
+
if (isInteger(value, strict)) {
|
|
701
|
+
return 'integer';
|
|
702
|
+
}
|
|
703
|
+
if (isNumber(value, strict)) {
|
|
704
|
+
return 'number';
|
|
705
|
+
}
|
|
706
|
+
if (isString(value) || (!strict && isDate(value))) {
|
|
707
|
+
return 'string';
|
|
708
|
+
}
|
|
709
|
+
return null;
|
|
864
710
|
}
|
|
865
711
|
/**
|
|
866
|
-
* '
|
|
712
|
+
* 'isType' function
|
|
867
713
|
*
|
|
868
|
-
*
|
|
869
|
-
*
|
|
714
|
+
* Checks wether an input (probably string) value contains data of
|
|
715
|
+
* a specified JSON Schema type
|
|
870
716
|
*
|
|
871
|
-
* //
|
|
872
|
-
* //
|
|
717
|
+
* // { PrimitiveValue } value - value to check
|
|
718
|
+
* // { SchemaPrimitiveType } type - type to check
|
|
719
|
+
* // { boolean }
|
|
873
720
|
*/
|
|
874
|
-
function
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
721
|
+
function isType(value, type) {
|
|
722
|
+
switch (type) {
|
|
723
|
+
case 'string':
|
|
724
|
+
return isString(value) || isDate(value);
|
|
725
|
+
case 'number':
|
|
726
|
+
return isNumber(value);
|
|
727
|
+
case 'integer':
|
|
728
|
+
return isInteger(value);
|
|
729
|
+
case 'boolean':
|
|
730
|
+
return isBoolean(value);
|
|
731
|
+
case 'null':
|
|
732
|
+
return !hasValue(value);
|
|
733
|
+
default:
|
|
734
|
+
console.error(`isType error: "${type}" is not a recognized type.`);
|
|
735
|
+
return null;
|
|
880
736
|
}
|
|
881
|
-
return returnItems;
|
|
882
737
|
}
|
|
883
738
|
/**
|
|
884
|
-
* '
|
|
739
|
+
* 'isPrimitive' function
|
|
885
740
|
*
|
|
886
|
-
*
|
|
887
|
-
*
|
|
741
|
+
* Checks wether an input value is a JavaScript primitive type:
|
|
742
|
+
* string, number, boolean, or null.
|
|
888
743
|
*
|
|
889
|
-
* //
|
|
890
|
-
* // {
|
|
744
|
+
* // value - value to check
|
|
745
|
+
* // { boolean }
|
|
891
746
|
*/
|
|
892
|
-
function
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
if (isString(array)) {
|
|
896
|
-
array = [array];
|
|
897
|
-
}
|
|
898
|
-
returnItems = returnItems === null ? [...array] :
|
|
899
|
-
returnItems.filter(item => array.includes(item));
|
|
900
|
-
if (!returnItems.length) {
|
|
901
|
-
return [];
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
return returnItems;
|
|
747
|
+
function isPrimitive(value) {
|
|
748
|
+
return (isString(value) || isNumber(value) ||
|
|
749
|
+
isBoolean(value, 'strict') || value === null);
|
|
905
750
|
}
|
|
906
751
|
/**
|
|
907
|
-
* 'fixTitle' function
|
|
908
|
-
*
|
|
909
752
|
*
|
|
910
|
-
*
|
|
911
|
-
*
|
|
753
|
+
* @param date
|
|
754
|
+
* @returns {string}
|
|
755
|
+
* exmaple:
|
|
756
|
+
* toDateString('2018-01-01') = '2018-01-01'
|
|
757
|
+
* toDateString('2018-01-30T00:00:00.000Z') = '2018-01-30'
|
|
912
758
|
*/
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
759
|
+
const toIsoString = (date) => {
|
|
760
|
+
const day = date.getDate();
|
|
761
|
+
const month = date.getMonth() + 1;
|
|
762
|
+
const year = date.getFullYear();
|
|
763
|
+
return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
|
|
764
|
+
};
|
|
916
765
|
/**
|
|
917
|
-
* '
|
|
766
|
+
* 'toJavaScriptType' function
|
|
918
767
|
*
|
|
919
|
-
*
|
|
768
|
+
* Converts an input (probably string) value to a JavaScript primitive type -
|
|
769
|
+
* 'string', 'number', 'boolean', or 'null' - before storing in a JSON object.
|
|
920
770
|
*
|
|
921
|
-
*
|
|
922
|
-
*
|
|
771
|
+
* Does not coerce values (other than null), and only converts the types
|
|
772
|
+
* of values that would otherwise be valid.
|
|
923
773
|
*
|
|
924
|
-
*
|
|
925
|
-
*
|
|
926
|
-
*
|
|
774
|
+
* If the optional third parameter 'strictIntegers' is TRUE, and the
|
|
775
|
+
* JSON Schema type 'integer' is specified, it also verifies the input value
|
|
776
|
+
* is an integer and, if it is, returns it as a JaveScript number.
|
|
777
|
+
* If 'strictIntegers' is FALSE (or not set) the type 'integer' is treated
|
|
778
|
+
* exactly the same as 'number', and allows decimals.
|
|
927
779
|
*
|
|
928
|
-
*
|
|
929
|
-
* //
|
|
930
|
-
* //
|
|
780
|
+
* Valid Examples:
|
|
781
|
+
* toJavaScriptType('10', 'number' ) = 10 // '10' is a number
|
|
782
|
+
* toJavaScriptType('10', 'integer') = 10 // '10' is also an integer
|
|
783
|
+
* toJavaScriptType( 10, 'integer') = 10 // 10 is still an integer
|
|
784
|
+
* toJavaScriptType( 10, 'string' ) = '10' // 10 can be made into a string
|
|
785
|
+
* toJavaScriptType('10.5', 'number' ) = 10.5 // '10.5' is a number
|
|
786
|
+
*
|
|
787
|
+
* Invalid Examples:
|
|
788
|
+
* toJavaScriptType('10.5', 'integer') = null // '10.5' is not an integer
|
|
789
|
+
* toJavaScriptType( 10.5, 'integer') = null // 10.5 is still not an integer
|
|
790
|
+
*
|
|
791
|
+
* // { PrimitiveValue } value - value to convert
|
|
792
|
+
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - types to convert to
|
|
793
|
+
* // { boolean = false } strictIntegers - if FALSE, treat integers as numbers
|
|
794
|
+
* // { PrimitiveValue }
|
|
931
795
|
*/
|
|
932
|
-
function
|
|
933
|
-
if (!
|
|
934
|
-
return
|
|
796
|
+
function toJavaScriptType(value, types, strictIntegers = true) {
|
|
797
|
+
if (!isDefined(value)) {
|
|
798
|
+
return null;
|
|
935
799
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
'vs', 'vs.', 'via'];
|
|
939
|
-
if (isString(forceWords)) {
|
|
940
|
-
forceWords = forceWords.split('|');
|
|
800
|
+
if (isString(types)) {
|
|
801
|
+
types = [types];
|
|
941
802
|
}
|
|
942
|
-
if (
|
|
943
|
-
|
|
803
|
+
if (strictIntegers && inArray('integer', types)) {
|
|
804
|
+
if (isInteger(value, 'strict')) {
|
|
805
|
+
return value;
|
|
806
|
+
}
|
|
807
|
+
if (isInteger(value)) {
|
|
808
|
+
return parseInt(value, 10);
|
|
809
|
+
}
|
|
944
810
|
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
input = input.trim();
|
|
949
|
-
return input.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, (word, idx) => {
|
|
950
|
-
if (!noInitialCase && word.slice(1).search(/[A-Z]|\../) !== -1) {
|
|
951
|
-
return word;
|
|
811
|
+
if (inArray('number', types) || (!strictIntegers && inArray('integer', types))) {
|
|
812
|
+
if (isNumber(value, 'strict')) {
|
|
813
|
+
return value;
|
|
952
814
|
}
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
const forceWord = forceArray[forceArrayLower.indexOf(word.toLowerCase())];
|
|
956
|
-
if (!forceWord) {
|
|
957
|
-
if (noInitialCase) {
|
|
958
|
-
if (word.slice(1).search(/\../) !== -1) {
|
|
959
|
-
newWord = word.toLowerCase();
|
|
960
|
-
}
|
|
961
|
-
else {
|
|
962
|
-
newWord = word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
else {
|
|
966
|
-
newWord = word[0].toUpperCase() + word.slice(1);
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
else if (forceWord === forceWord.toLowerCase() && (idx === 0 || idx + word.length === input.length ||
|
|
970
|
-
prevLastChar === ':' || input[idx - 1].search(/[^\s-]/) !== -1 ||
|
|
971
|
-
(input[idx - 1] !== '-' && input[idx + word.length] === '-'))) {
|
|
972
|
-
newWord = forceWord[0].toUpperCase() + forceWord.slice(1);
|
|
973
|
-
}
|
|
974
|
-
else {
|
|
975
|
-
newWord = forceWord;
|
|
976
|
-
}
|
|
977
|
-
prevLastChar = word.slice(-1);
|
|
978
|
-
return newWord;
|
|
815
|
+
if (isNumber(value)) {
|
|
816
|
+
return parseFloat(value);
|
|
979
817
|
}
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
required: 'Darf nicht leer sein',
|
|
985
|
-
minLength: 'Mindestens {{minimumLength}} Zeichen benötigt (aktuell: {{currentLength}})',
|
|
986
|
-
maxLength: 'Maximal {{maximumLength}} Zeichen erlaubt (aktuell: {{currentLength}})',
|
|
987
|
-
pattern: 'Entspricht nicht diesem regulären Ausdruck: {{requiredPattern}}',
|
|
988
|
-
format: function (error) {
|
|
989
|
-
switch (error.requiredFormat) {
|
|
990
|
-
case 'date':
|
|
991
|
-
return 'Muss ein Datum sein, z. B. "2000-12-31"';
|
|
992
|
-
case 'time':
|
|
993
|
-
return 'Muss eine Zeitangabe sein, z. B. "16:20" oder "03:14:15.9265"';
|
|
994
|
-
case 'date-time':
|
|
995
|
-
return 'Muss Datum mit Zeit beinhalten, z. B. "2000-03-14T01:59" oder "2000-03-14T01:59:26.535Z"';
|
|
996
|
-
case 'email':
|
|
997
|
-
return 'Keine gültige E-Mail-Adresse (z. B. "name@example.com")';
|
|
998
|
-
case 'hostname':
|
|
999
|
-
return 'Kein gültiger Hostname (z. B. "example.com")';
|
|
1000
|
-
case 'ipv4':
|
|
1001
|
-
return 'Keine gültige IPv4-Adresse (z. B. "127.0.0.1")';
|
|
1002
|
-
case 'ipv6':
|
|
1003
|
-
return 'Keine gültige IPv6-Adresse (z. B. "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0")';
|
|
1004
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
1005
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
1006
|
-
case 'url':
|
|
1007
|
-
return 'Keine gültige URL (z. B. "http://www.example.com/page.html")';
|
|
1008
|
-
case 'uuid':
|
|
1009
|
-
return 'Keine gültige UUID (z. B. "12345678-9ABC-DEF0-1234-56789ABCDEF0")';
|
|
1010
|
-
case 'color':
|
|
1011
|
-
return 'Kein gültiger Farbwert (z. B. "#FFFFFF" oder "rgb(255, 255, 255)")';
|
|
1012
|
-
case 'json-pointer':
|
|
1013
|
-
return 'Kein gültiger JSON-Pointer (z. B. "/pointer/to/something")';
|
|
1014
|
-
case 'relative-json-pointer':
|
|
1015
|
-
return 'Kein gültiger relativer JSON-Pointer (z. B. "2/pointer/to/something")';
|
|
1016
|
-
case 'regex':
|
|
1017
|
-
return 'Kein gültiger regulärer Ausdruck (z. B. "(1-)?\\d{3}-\\d{3}-\\d{4}")';
|
|
1018
|
-
default:
|
|
1019
|
-
return 'Muss diesem Format entsprechen: ' + error.requiredFormat;
|
|
1020
|
-
}
|
|
1021
|
-
},
|
|
1022
|
-
minimum: 'Muss mindestens {{minimumValue}} sein',
|
|
1023
|
-
exclusiveMinimum: 'Muss größer als {{exclusiveMinimumValue}} sein',
|
|
1024
|
-
maximum: 'Darf maximal {{maximumValue}} sein',
|
|
1025
|
-
exclusiveMaximum: 'Muss kleiner als {{exclusiveMaximumValue}} sein',
|
|
1026
|
-
multipleOf: function (error) {
|
|
1027
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
1028
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
1029
|
-
return `Maximal ${decimals} Dezimalstellen erlaubt`;
|
|
1030
|
-
}
|
|
1031
|
-
else {
|
|
1032
|
-
return `Muss ein Vielfaches von ${error.multipleOfValue} sein`;
|
|
818
|
+
}
|
|
819
|
+
if (inArray('string', types)) {
|
|
820
|
+
if (isString(value)) {
|
|
821
|
+
return value;
|
|
1033
822
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
maxItems: 'Maximal {{maximumItems}} Werte erlaubt (aktuell: {{currentItems}})',
|
|
1039
|
-
uniqueItems: 'Alle Werte müssen eindeutig sein',
|
|
1040
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
1041
|
-
};
|
|
1042
|
-
|
|
1043
|
-
const enValidationMessages = {
|
|
1044
|
-
required: 'This field is required.',
|
|
1045
|
-
minLength: 'Must be {{minimumLength}} characters or longer (current length: {{currentLength}})',
|
|
1046
|
-
maxLength: 'Must be {{maximumLength}} characters or shorter (current length: {{currentLength}})',
|
|
1047
|
-
pattern: 'Must match pattern: {{requiredPattern}}',
|
|
1048
|
-
format: function (error) {
|
|
1049
|
-
switch (error.requiredFormat) {
|
|
1050
|
-
case 'date':
|
|
1051
|
-
return 'Must be a date, like "2000-12-31"';
|
|
1052
|
-
case 'time':
|
|
1053
|
-
return 'Must be a time, like "16:20" or "03:14:15.9265"';
|
|
1054
|
-
case 'date-time':
|
|
1055
|
-
return 'Must be a date-time, like "2000-03-14T01:59" or "2000-03-14T01:59:26.535Z"';
|
|
1056
|
-
case 'email':
|
|
1057
|
-
return 'Must be an email address, like "name@example.com"';
|
|
1058
|
-
case 'hostname':
|
|
1059
|
-
return 'Must be a hostname, like "example.com"';
|
|
1060
|
-
case 'ipv4':
|
|
1061
|
-
return 'Must be an IPv4 address, like "127.0.0.1"';
|
|
1062
|
-
case 'ipv6':
|
|
1063
|
-
return 'Must be an IPv6 address, like "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
1064
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
1065
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
1066
|
-
case 'url':
|
|
1067
|
-
return 'Must be a url, like "http://www.example.com/page.html"';
|
|
1068
|
-
case 'uuid':
|
|
1069
|
-
return 'Must be a uuid, like "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
1070
|
-
case 'color':
|
|
1071
|
-
return 'Must be a color, like "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
1072
|
-
case 'json-pointer':
|
|
1073
|
-
return 'Must be a JSON Pointer, like "/pointer/to/something"';
|
|
1074
|
-
case 'relative-json-pointer':
|
|
1075
|
-
return 'Must be a relative JSON Pointer, like "2/pointer/to/something"';
|
|
1076
|
-
case 'regex':
|
|
1077
|
-
return 'Must be a regular expression, like "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
1078
|
-
default:
|
|
1079
|
-
return 'Must be a correctly formatted ' + error.requiredFormat;
|
|
823
|
+
// If value is a date, and types includes 'string',
|
|
824
|
+
// convert the date to a string
|
|
825
|
+
if (isDate(value)) {
|
|
826
|
+
return toIsoString(value);
|
|
1080
827
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
exclusiveMinimum: 'Must be more than {{exclusiveMinimumValue}}',
|
|
1084
|
-
maximum: 'Must be {{maximumValue}} or less',
|
|
1085
|
-
exclusiveMaximum: 'Must be less than {{exclusiveMaximumValue}}',
|
|
1086
|
-
multipleOf: function (error) {
|
|
1087
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
1088
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
1089
|
-
return `Must have ${decimals} or fewer decimal places.`;
|
|
828
|
+
if (isNumber(value)) {
|
|
829
|
+
return value.toString();
|
|
1090
830
|
}
|
|
1091
|
-
|
|
1092
|
-
|
|
831
|
+
}
|
|
832
|
+
// If value is a date, and types includes 'integer' or 'number',
|
|
833
|
+
// but not 'string', convert the date to a number
|
|
834
|
+
if (isDate(value) && (inArray('integer', types) || inArray('number', types))) {
|
|
835
|
+
return value.getTime();
|
|
836
|
+
}
|
|
837
|
+
if (inArray('boolean', types)) {
|
|
838
|
+
if (isBoolean(value, true)) {
|
|
839
|
+
return true;
|
|
1093
840
|
}
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
maxProperties: 'Must have {{maximumProperties}} or fewer items (current items: {{currentProperties}})',
|
|
1097
|
-
minItems: 'Must have {{minimumItems}} or more items (current items: {{currentItems}})',
|
|
1098
|
-
maxItems: 'Must have {{maximumItems}} or fewer items (current items: {{currentItems}})',
|
|
1099
|
-
uniqueItems: 'All items must be unique',
|
|
1100
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
1101
|
-
};
|
|
1102
|
-
|
|
1103
|
-
const esValidationMessages = {
|
|
1104
|
-
required: 'Este campo está requerido.',
|
|
1105
|
-
minLength: 'Debe tener {{minimumLength}} caracteres o más longitud (longitud actual: {{currentLength}})',
|
|
1106
|
-
maxLength: 'Debe tener {{maximumLength}} caracteres o menos longitud (longitud actual: {{currentLength}})',
|
|
1107
|
-
pattern: 'Must match pattern: {{requiredPattern}}',
|
|
1108
|
-
format: function (error) {
|
|
1109
|
-
switch (error.requiredFormat) {
|
|
1110
|
-
case 'date':
|
|
1111
|
-
return 'Debe tener una fecha, ej "2000-12-31"';
|
|
1112
|
-
case 'time':
|
|
1113
|
-
return 'Debe tener una hora, ej "16:20" o "03:14:15.9265"';
|
|
1114
|
-
case 'date-time':
|
|
1115
|
-
return 'Debe tener fecha y hora, ej "2000-03-14T01:59" o "2000-03-14T01:59:26.535Z"';
|
|
1116
|
-
case 'email':
|
|
1117
|
-
return 'No hay dirección de correo electrónico válida, ej "name@example.com"';
|
|
1118
|
-
case 'hostname':
|
|
1119
|
-
return 'Debe ser un nombre de host válido, ej "example.com"';
|
|
1120
|
-
case 'ipv4':
|
|
1121
|
-
return 'Debe ser una dirección de IPv4, ej "127.0.0.1"';
|
|
1122
|
-
case 'ipv6':
|
|
1123
|
-
return 'Debe ser una dirección de IPv6, ej "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
1124
|
-
case 'url':
|
|
1125
|
-
return 'Debe ser una URL, ej "http://www.example.com/page.html"';
|
|
1126
|
-
case 'uuid':
|
|
1127
|
-
return 'Debe ser un UUID, ej "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
1128
|
-
case 'color':
|
|
1129
|
-
return 'Debe ser un color, ej "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
1130
|
-
case 'json-pointer':
|
|
1131
|
-
return 'Debe ser un JSON Pointer, ej "/pointer/to/something"';
|
|
1132
|
-
case 'relative-json-pointer':
|
|
1133
|
-
return 'Debe ser un JSON Pointer relativo, ej "2/pointer/to/something"';
|
|
1134
|
-
case 'regex':
|
|
1135
|
-
return 'Debe ser una expresión regular, ej "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
1136
|
-
default:
|
|
1137
|
-
return 'Debe tener el formato correcto ' + error.requiredFormat;
|
|
841
|
+
if (isBoolean(value, false)) {
|
|
842
|
+
return false;
|
|
1138
843
|
}
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
844
|
+
}
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* 'toSchemaType' function
|
|
849
|
+
*
|
|
850
|
+
* Converts an input (probably string) value to the "best" JavaScript
|
|
851
|
+
* equivalent available from an allowed list of JSON Schema types, which may
|
|
852
|
+
* contain 'string', 'number', 'integer', 'boolean', and/or 'null'.
|
|
853
|
+
* If necssary, it does progressively agressive type coersion.
|
|
854
|
+
* It will not return null unless null is in the list of allowed types.
|
|
855
|
+
*
|
|
856
|
+
* Number conversion examples:
|
|
857
|
+
* toSchemaType('10', ['number','integer','string']) = 10 // integer
|
|
858
|
+
* toSchemaType('10', ['number','string']) = 10 // number
|
|
859
|
+
* toSchemaType('10', ['string']) = '10' // string
|
|
860
|
+
* toSchemaType('10.5', ['number','integer','string']) = 10.5 // number
|
|
861
|
+
* toSchemaType('10.5', ['integer','string']) = '10.5' // string
|
|
862
|
+
* toSchemaType('10.5', ['integer']) = 10 // integer
|
|
863
|
+
* toSchemaType(10.5, ['null','boolean','string']) = '10.5' // string
|
|
864
|
+
* toSchemaType(10.5, ['null','boolean']) = true // boolean
|
|
865
|
+
*
|
|
866
|
+
* String conversion examples:
|
|
867
|
+
* toSchemaType('1.5x', ['boolean','number','integer','string']) = '1.5x' // string
|
|
868
|
+
* toSchemaType('1.5x', ['boolean','number','integer']) = '1.5' // number
|
|
869
|
+
* toSchemaType('1.5x', ['boolean','integer']) = '1' // integer
|
|
870
|
+
* toSchemaType('1.5x', ['boolean']) = true // boolean
|
|
871
|
+
* toSchemaType('xyz', ['number','integer','boolean','null']) = true // boolean
|
|
872
|
+
* toSchemaType('xyz', ['number','integer','null']) = null // null
|
|
873
|
+
* toSchemaType('xyz', ['number','integer']) = 0 // number
|
|
874
|
+
*
|
|
875
|
+
* Boolean conversion examples:
|
|
876
|
+
* toSchemaType('1', ['integer','number','string','boolean']) = 1 // integer
|
|
877
|
+
* toSchemaType('1', ['number','string','boolean']) = 1 // number
|
|
878
|
+
* toSchemaType('1', ['string','boolean']) = '1' // string
|
|
879
|
+
* toSchemaType('1', ['boolean']) = true // boolean
|
|
880
|
+
* toSchemaType('true', ['number','string','boolean']) = 'true' // string
|
|
881
|
+
* toSchemaType('true', ['boolean']) = true // boolean
|
|
882
|
+
* toSchemaType('true', ['number']) = 0 // number
|
|
883
|
+
* toSchemaType(true, ['number','string','boolean']) = true // boolean
|
|
884
|
+
* toSchemaType(true, ['number','string']) = 'true' // string
|
|
885
|
+
* toSchemaType(true, ['number']) = 1 // number
|
|
886
|
+
*
|
|
887
|
+
* // { PrimitiveValue } value - value to convert
|
|
888
|
+
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - allowed types to convert to
|
|
889
|
+
* // { PrimitiveValue }
|
|
890
|
+
*/
|
|
891
|
+
function toSchemaType(value, types) {
|
|
892
|
+
if (!isArray(types)) {
|
|
893
|
+
types = [types];
|
|
894
|
+
}
|
|
895
|
+
if (types.includes('null') && !hasValue(value)) {
|
|
896
|
+
return null;
|
|
897
|
+
}
|
|
898
|
+
if (types.includes('boolean') && !isBoolean(value, 'strict')) {
|
|
899
|
+
return value;
|
|
900
|
+
}
|
|
901
|
+
if (types.includes('integer')) {
|
|
902
|
+
const testValue = toJavaScriptType(value, 'integer');
|
|
903
|
+
if (testValue !== null) {
|
|
904
|
+
return +testValue;
|
|
1148
905
|
}
|
|
1149
|
-
|
|
1150
|
-
|
|
906
|
+
}
|
|
907
|
+
if (types.includes('number')) {
|
|
908
|
+
const testValue = toJavaScriptType(value, 'number');
|
|
909
|
+
if (testValue !== null) {
|
|
910
|
+
return +testValue;
|
|
1151
911
|
}
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
maxLength: 'Doit avoir maximum {{maximumLength}} caractères (actuellement: {{currentLength}})',
|
|
1164
|
-
pattern: 'Doit respecter: {{requiredPattern}}',
|
|
1165
|
-
format: function (error) {
|
|
1166
|
-
switch (error.requiredFormat) {
|
|
1167
|
-
case 'date':
|
|
1168
|
-
return 'Doit être une date, tel que "2000-12-31"';
|
|
1169
|
-
case 'time':
|
|
1170
|
-
return 'Doit être une heure, tel que "16:20" ou "03:14:15.9265"';
|
|
1171
|
-
case 'date-time':
|
|
1172
|
-
return 'Doit être une date et une heure, tel que "2000-03-14T01:59" ou "2000-03-14T01:59:26.535Z"';
|
|
1173
|
-
case 'email':
|
|
1174
|
-
return 'Doit être une adresse e-mail, tel que "name@example.com"';
|
|
1175
|
-
case 'hostname':
|
|
1176
|
-
return 'Doit être un nom de domaine, tel que "example.com"';
|
|
1177
|
-
case 'ipv4':
|
|
1178
|
-
return 'Doit être une adresse IPv4, tel que "127.0.0.1"';
|
|
1179
|
-
case 'ipv6':
|
|
1180
|
-
return 'Doit être une adresse IPv6, tel que "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
1181
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
1182
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
1183
|
-
case 'url':
|
|
1184
|
-
return 'Doit être une URL, tel que "http://www.example.com/page.html"';
|
|
1185
|
-
case 'uuid':
|
|
1186
|
-
return 'Doit être un UUID, tel que "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
1187
|
-
case 'color':
|
|
1188
|
-
return 'Doit être une couleur, tel que "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
1189
|
-
case 'json-pointer':
|
|
1190
|
-
return 'Doit être un JSON Pointer, tel que "/pointer/to/something"';
|
|
1191
|
-
case 'relative-json-pointer':
|
|
1192
|
-
return 'Doit être un relative JSON Pointer, tel que "2/pointer/to/something"';
|
|
1193
|
-
case 'regex':
|
|
1194
|
-
return 'Doit être une expression régulière, tel que "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
1195
|
-
default:
|
|
1196
|
-
return 'Doit être avoir le format correct: ' + error.requiredFormat;
|
|
1197
|
-
}
|
|
1198
|
-
},
|
|
1199
|
-
minimum: 'Doit être supérieur à {{minimumValue}}',
|
|
1200
|
-
exclusiveMinimum: 'Doit avoir minimum {{exclusiveMinimumValue}} charactères',
|
|
1201
|
-
maximum: 'Doit être inférieur à {{maximumValue}}',
|
|
1202
|
-
exclusiveMaximum: 'Doit avoir maximum {{exclusiveMaximumValue}} charactères',
|
|
1203
|
-
multipleOf: function (error) {
|
|
1204
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
1205
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
1206
|
-
return `Doit comporter ${decimals} ou moins de decimales.`;
|
|
912
|
+
}
|
|
913
|
+
if ((isString(value) || isNumber(value, 'strict')) &&
|
|
914
|
+
types.includes('string')) { // Convert number to string
|
|
915
|
+
return toJavaScriptType(value, 'string');
|
|
916
|
+
}
|
|
917
|
+
if (types.includes('boolean') && isBoolean(value)) {
|
|
918
|
+
return toJavaScriptType(value, 'boolean');
|
|
919
|
+
}
|
|
920
|
+
if (types.includes('string')) { // Convert null & boolean to string
|
|
921
|
+
if (value === null) {
|
|
922
|
+
return '';
|
|
1207
923
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
924
|
+
const testValue = toJavaScriptType(value, 'string');
|
|
925
|
+
if (testValue !== null) {
|
|
926
|
+
return testValue;
|
|
1210
927
|
}
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
const itValidationMessages = {
|
|
1221
|
-
required: 'Il campo è obbligatorio',
|
|
1222
|
-
minLength: 'Deve inserire almeno {{minimumLength}} caratteri (lunghezza corrente: {{currentLength}})',
|
|
1223
|
-
maxLength: 'Il numero massimo di caratteri consentito è {{maximumLength}} (lunghezza corrente: {{currentLength}})',
|
|
1224
|
-
pattern: 'Devi rispettare il pattern : {{requiredPattern}}',
|
|
1225
|
-
format: function (error) {
|
|
1226
|
-
switch (error.requiredFormat) {
|
|
1227
|
-
case 'date':
|
|
1228
|
-
return 'Deve essere una data, come "31-12-2000"';
|
|
1229
|
-
case 'time':
|
|
1230
|
-
return 'Deve essere un orario, come "16:20" o "03:14:15.9265"';
|
|
1231
|
-
case 'date-time':
|
|
1232
|
-
return 'Deve essere data-orario, come "14-03-2000T01:59" or "14-03-2000T01:59:26.535Z"';
|
|
1233
|
-
case 'email':
|
|
1234
|
-
return 'Deve essere un indirzzo email, come "name@example.com"';
|
|
1235
|
-
case 'hostname':
|
|
1236
|
-
return 'Deve essere un hostname, come "example.com"';
|
|
1237
|
-
case 'ipv4':
|
|
1238
|
-
return 'Deve essere un indirizzo IPv4, come "127.0.0.1"';
|
|
1239
|
-
case 'ipv6':
|
|
1240
|
-
return 'Deve essere un indirizzo IPv6, come "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
1241
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
1242
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
1243
|
-
case 'url':
|
|
1244
|
-
return 'Deve essere un url, come "http://www.example.com/page.html"';
|
|
1245
|
-
case 'uuid':
|
|
1246
|
-
return 'Deve essere un uuid, come "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
1247
|
-
case 'color':
|
|
1248
|
-
return 'Deve essere un colore, come "#FFFFFF" o "rgb(255, 255, 255)"';
|
|
1249
|
-
case 'json-pointer':
|
|
1250
|
-
return 'Deve essere un JSON Pointer, come "/pointer/to/something"';
|
|
1251
|
-
case 'relative-json-pointer':
|
|
1252
|
-
return 'Deve essere un JSON Pointer relativo, come "2/pointer/to/something"';
|
|
1253
|
-
case 'regex':
|
|
1254
|
-
return 'Deve essere una regular expression, come "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
1255
|
-
default:
|
|
1256
|
-
return 'Deve essere formattato correttamente ' + error.requiredFormat;
|
|
928
|
+
}
|
|
929
|
+
if ((types.includes('number') ||
|
|
930
|
+
types.includes('integer'))) {
|
|
931
|
+
if (value === true) {
|
|
932
|
+
return 1;
|
|
933
|
+
} // Convert boolean & null to number
|
|
934
|
+
if (value === false || value === null || value === '') {
|
|
935
|
+
return 0;
|
|
1257
936
|
}
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
multipleOf: function (error) {
|
|
1264
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
1265
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
1266
|
-
return `Deve avere ${decimals} o meno decimali.`;
|
|
937
|
+
}
|
|
938
|
+
if (types.includes('number')) { // Convert mixed string to number
|
|
939
|
+
const testValue = parseFloat(value);
|
|
940
|
+
if (!!testValue) {
|
|
941
|
+
return testValue;
|
|
1267
942
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
943
|
+
}
|
|
944
|
+
if (types.includes('integer')) { // Convert string or number to integer
|
|
945
|
+
const testValue = parseInt(value, 10);
|
|
946
|
+
if (!!testValue) {
|
|
947
|
+
return testValue;
|
|
1270
948
|
}
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
}
|
|
949
|
+
}
|
|
950
|
+
if (types.includes('boolean')) { // Convert anything to boolean
|
|
951
|
+
return !!value;
|
|
952
|
+
}
|
|
953
|
+
if ((types.includes('number') ||
|
|
954
|
+
types.includes('integer')) && !types.includes('null')) {
|
|
955
|
+
return 0; // If null not allowed, return 0 for non-convertable values
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* 'isPromise' function
|
|
960
|
+
*
|
|
961
|
+
* // object
|
|
962
|
+
* // { boolean }
|
|
963
|
+
*/
|
|
964
|
+
function isPromise(object) {
|
|
965
|
+
return !!object && typeof object.then === 'function';
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* 'isObservable' function
|
|
969
|
+
*
|
|
970
|
+
* // object
|
|
971
|
+
* // { boolean }
|
|
972
|
+
*/
|
|
973
|
+
function isObservable(object) {
|
|
974
|
+
return !!object && typeof object.subscribe === 'function';
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* '_toPromise' function
|
|
978
|
+
*
|
|
979
|
+
* // { object } object
|
|
980
|
+
* // { Promise<any> }
|
|
981
|
+
*/
|
|
982
|
+
function _toPromise(object) {
|
|
983
|
+
return isPromise(object) ? object : object.toPromise();
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* 'toObservable' function
|
|
987
|
+
*
|
|
988
|
+
* // { object } object
|
|
989
|
+
* // { Observable<any> }
|
|
990
|
+
*/
|
|
991
|
+
function toObservable(object) {
|
|
992
|
+
const observable = isPromise(object) ? from(object) : object;
|
|
993
|
+
if (isObservable(observable)) {
|
|
994
|
+
return observable;
|
|
995
|
+
}
|
|
996
|
+
console.error('toObservable error: Expected validator to return Promise or Observable.');
|
|
997
|
+
return new Observable();
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* 'inArray' function
|
|
1001
|
+
*
|
|
1002
|
+
* Searches an array for an item, or one of a list of items, and returns true
|
|
1003
|
+
* as soon as a match is found, or false if no match.
|
|
1004
|
+
*
|
|
1005
|
+
* If the optional third parameter allIn is set to TRUE, and the item to find
|
|
1006
|
+
* is an array, then the function returns true only if all elements from item
|
|
1007
|
+
* are found in the array list, and false if any element is not found. If the
|
|
1008
|
+
* item to find is not an array, setting allIn to TRUE has no effect.
|
|
1009
|
+
*
|
|
1010
|
+
* // { any|any[] } item - the item to search for
|
|
1011
|
+
* // array - the array to search
|
|
1012
|
+
* // { boolean = false } allIn - if TRUE, all items must be in array
|
|
1013
|
+
* // { boolean } - true if item(s) in array, false otherwise
|
|
1014
|
+
*/
|
|
1015
|
+
function inArray(item, array, allIn = false) {
|
|
1016
|
+
if (!isDefined(item) || !isArray(array)) {
|
|
1017
|
+
return false;
|
|
1018
|
+
}
|
|
1019
|
+
return isArray(item) ?
|
|
1020
|
+
item[allIn ? 'every' : 'some'](subItem => array.includes(subItem)) :
|
|
1021
|
+
array.includes(item);
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* 'xor' utility function - exclusive or
|
|
1025
|
+
*
|
|
1026
|
+
* Returns true if exactly one of two values is truthy.
|
|
1027
|
+
*
|
|
1028
|
+
* // value1 - first value to check
|
|
1029
|
+
* // value2 - second value to check
|
|
1030
|
+
* // { boolean } - true if exactly one input value is truthy, false if not
|
|
1031
|
+
*/
|
|
1032
|
+
function xor(value1, value2) {
|
|
1033
|
+
return (!!value1 && !value2) || (!value1 && !!value2);
|
|
1034
|
+
}
|
|
1279
1035
|
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1036
|
+
/**
|
|
1037
|
+
* Utility function library:
|
|
1038
|
+
*
|
|
1039
|
+
* addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject,
|
|
1040
|
+
* uniqueItems, commonItems, fixTitle, toTitleCase
|
|
1041
|
+
*/
|
|
1042
|
+
/**
|
|
1043
|
+
* 'addClasses' function
|
|
1044
|
+
*
|
|
1045
|
+
* Merges two space-delimited lists of CSS classes and removes duplicates.
|
|
1046
|
+
*
|
|
1047
|
+
* // {string | string[] | Set<string>} oldClasses
|
|
1048
|
+
* // {string | string[] | Set<string>} newClasses
|
|
1049
|
+
* // {string | string[] | Set<string>} - Combined classes
|
|
1050
|
+
*/
|
|
1051
|
+
function addClasses(oldClasses, newClasses) {
|
|
1052
|
+
const badType = i => !isSet(i) && !isArray(i) && !isString(i);
|
|
1053
|
+
if (badType(newClasses)) {
|
|
1054
|
+
return oldClasses;
|
|
1055
|
+
}
|
|
1056
|
+
if (badType(oldClasses)) {
|
|
1057
|
+
oldClasses = '';
|
|
1058
|
+
}
|
|
1059
|
+
const toSet = i => isSet(i) ? i : isArray(i) ? new Set(i) : new Set(i.split(' '));
|
|
1060
|
+
const combinedSet = toSet(oldClasses);
|
|
1061
|
+
const newSet = toSet(newClasses);
|
|
1062
|
+
newSet.forEach(c => combinedSet.add(c));
|
|
1063
|
+
if (isSet(oldClasses)) {
|
|
1064
|
+
return combinedSet;
|
|
1065
|
+
}
|
|
1066
|
+
if (isArray(oldClasses)) {
|
|
1067
|
+
return Array.from(combinedSet);
|
|
1068
|
+
}
|
|
1069
|
+
return Array.from(combinedSet).join(' ');
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* 'copy' function
|
|
1073
|
+
*
|
|
1074
|
+
* Makes a shallow copy of a JavaScript object, array, Map, or Set.
|
|
1075
|
+
* If passed a JavaScript primitive value (string, number, boolean, or null),
|
|
1076
|
+
* it returns the value.
|
|
1077
|
+
*
|
|
1078
|
+
* // {Object|Array|string|number|boolean|null} object - The object to copy
|
|
1079
|
+
* // {boolean = false} errors - Show errors?
|
|
1080
|
+
* // {Object|Array|string|number|boolean|null} - The copied object
|
|
1081
|
+
*/
|
|
1082
|
+
function copy(object, errors = false) {
|
|
1083
|
+
if (typeof object !== 'object' || object === null) {
|
|
1084
|
+
return object;
|
|
1085
|
+
}
|
|
1086
|
+
if (isMap(object)) {
|
|
1087
|
+
return new Map(object);
|
|
1088
|
+
}
|
|
1089
|
+
if (isSet(object)) {
|
|
1090
|
+
return new Set(object);
|
|
1091
|
+
}
|
|
1092
|
+
if (isArray(object)) {
|
|
1093
|
+
return [...object];
|
|
1094
|
+
}
|
|
1095
|
+
if (isObject(object)) {
|
|
1096
|
+
return { ...object };
|
|
1097
|
+
}
|
|
1098
|
+
if (errors) {
|
|
1099
|
+
console.error('copy error: Object to copy must be a JavaScript object or value.');
|
|
1100
|
+
}
|
|
1101
|
+
return object;
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* 'forEach' function
|
|
1105
|
+
*
|
|
1106
|
+
* Iterates over all items in the first level of an object or array
|
|
1107
|
+
* and calls an iterator funciton on each item.
|
|
1108
|
+
*
|
|
1109
|
+
* The iterator function is called with four values:
|
|
1110
|
+
* 1. The current item's value
|
|
1111
|
+
* 2. The current item's key
|
|
1112
|
+
* 3. The parent object, which contains the current item
|
|
1113
|
+
* 4. The root object
|
|
1114
|
+
*
|
|
1115
|
+
* Setting the optional third parameter to 'top-down' or 'bottom-up' will cause
|
|
1116
|
+
* it to also recursively iterate over items in sub-objects or sub-arrays in the
|
|
1117
|
+
* specified direction.
|
|
1118
|
+
*
|
|
1119
|
+
* // {Object|Array} object - The object or array to iterate over
|
|
1120
|
+
* // {function} fn - the iterator funciton to call on each item
|
|
1121
|
+
* // {boolean = false} errors - Show errors?
|
|
1122
|
+
* // {void}
|
|
1123
|
+
*/
|
|
1124
|
+
function forEach(object, fn, recurse = false, rootObject = object, errors = false) {
|
|
1125
|
+
if (isEmpty(object)) {
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
if ((isObject(object) || isArray(object)) && typeof fn === 'function') {
|
|
1129
|
+
for (const key of Object.keys(object)) {
|
|
1130
|
+
const value = object[key];
|
|
1131
|
+
if (recurse === 'bottom-up' && (isObject(value) || isArray(value))) {
|
|
1132
|
+
forEach(value, fn, recurse, rootObject);
|
|
1133
|
+
}
|
|
1134
|
+
fn(value, key, object, rootObject);
|
|
1135
|
+
if (recurse === 'top-down' && (isObject(value) || isArray(value))) {
|
|
1136
|
+
forEach(value, fn, recurse, rootObject);
|
|
1137
|
+
}
|
|
1317
1138
|
}
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
multipleOf: function (error) {
|
|
1324
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
1325
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
1326
|
-
return `Tem que ter ${decimals} ou menos casas decimais.`;
|
|
1139
|
+
}
|
|
1140
|
+
if (errors) {
|
|
1141
|
+
if (typeof fn !== 'function') {
|
|
1142
|
+
console.error('forEach error: Iterator must be a function.');
|
|
1143
|
+
console.error('function', fn);
|
|
1327
1144
|
}
|
|
1328
|
-
|
|
1329
|
-
|
|
1145
|
+
if (!isObject(object) && !isArray(object)) {
|
|
1146
|
+
console.error('forEach error: Input object must be an object or array.');
|
|
1147
|
+
console.error('object', object);
|
|
1330
1148
|
}
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
/**
|
|
1152
|
+
* 'forEachCopy' function
|
|
1153
|
+
*
|
|
1154
|
+
* Iterates over all items in the first level of an object or array
|
|
1155
|
+
* and calls an iterator function on each item. Returns a new object or array
|
|
1156
|
+
* with the same keys or indexes as the original, and values set to the results
|
|
1157
|
+
* of the iterator function.
|
|
1158
|
+
*
|
|
1159
|
+
* Does NOT recursively iterate over items in sub-objects or sub-arrays.
|
|
1160
|
+
*
|
|
1161
|
+
* // {Object | Array} object - The object or array to iterate over
|
|
1162
|
+
* // {function} fn - The iterator funciton to call on each item
|
|
1163
|
+
* // {boolean = false} errors - Show errors?
|
|
1164
|
+
* // {Object | Array} - The resulting object or array
|
|
1165
|
+
*/
|
|
1166
|
+
function forEachCopy(object, fn, errors = false) {
|
|
1167
|
+
if (!hasValue(object)) {
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
if ((isObject(object) || isArray(object)) && typeof object !== 'function') {
|
|
1171
|
+
const newObject = isArray(object) ? [] : {};
|
|
1172
|
+
for (const key of Object.keys(object)) {
|
|
1173
|
+
newObject[key] = fn(object[key], key, object);
|
|
1174
|
+
}
|
|
1175
|
+
return newObject;
|
|
1176
|
+
}
|
|
1177
|
+
if (errors) {
|
|
1178
|
+
if (typeof fn !== 'function') {
|
|
1179
|
+
console.error('forEachCopy error: Iterator must be a function.');
|
|
1180
|
+
console.error('function', fn);
|
|
1181
|
+
}
|
|
1182
|
+
if (!isObject(object) && !isArray(object)) {
|
|
1183
|
+
console.error('forEachCopy error: Input object must be an object or array.');
|
|
1184
|
+
console.error('object', object);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* 'hasOwn' utility function
|
|
1190
|
+
*
|
|
1191
|
+
* Checks whether an object or array has a particular property.
|
|
1192
|
+
*
|
|
1193
|
+
* // {any} object - the object to check
|
|
1194
|
+
* // {string} property - the property to look for
|
|
1195
|
+
* // {boolean} - true if object has property, false if not
|
|
1196
|
+
*/
|
|
1197
|
+
function hasOwn(object, property) {
|
|
1198
|
+
if (!object || !['number', 'string', 'symbol'].includes(typeof property) ||
|
|
1199
|
+
(!isObject(object) && !isArray(object) && !isMap(object) && !isSet(object))) {
|
|
1200
|
+
return false;
|
|
1201
|
+
}
|
|
1202
|
+
if (isMap(object) || isSet(object)) {
|
|
1203
|
+
return object.has(property);
|
|
1204
|
+
}
|
|
1205
|
+
if (typeof property === 'number') {
|
|
1206
|
+
if (isArray(object)) {
|
|
1207
|
+
return object[property];
|
|
1208
|
+
}
|
|
1209
|
+
property = property + '';
|
|
1210
|
+
}
|
|
1211
|
+
return object.hasOwnProperty(property);
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Types of possible expressions which the app is able to evaluate.
|
|
1215
|
+
*/
|
|
1216
|
+
var ExpressionType;
|
|
1217
|
+
(function (ExpressionType) {
|
|
1218
|
+
ExpressionType[ExpressionType["EQUALS"] = 0] = "EQUALS";
|
|
1219
|
+
ExpressionType[ExpressionType["NOT_EQUALS"] = 1] = "NOT_EQUALS";
|
|
1220
|
+
ExpressionType[ExpressionType["NOT_AN_EXPRESSION"] = 2] = "NOT_AN_EXPRESSION";
|
|
1221
|
+
})(ExpressionType || (ExpressionType = {}));
|
|
1222
|
+
/**
|
|
1223
|
+
* Detects the type of expression from the given candidate. `==` for equals,
|
|
1224
|
+
* `!=` for not equals. If none of these are contained in the candidate, the candidate
|
|
1225
|
+
* is not considered to be an expression at all and thus `NOT_AN_EXPRESSION` is returned.
|
|
1226
|
+
* // {expressionCandidate} expressionCandidate - potential expression
|
|
1227
|
+
*/
|
|
1228
|
+
function getExpressionType(expressionCandidate) {
|
|
1229
|
+
if (expressionCandidate.indexOf('==') !== -1) {
|
|
1230
|
+
return ExpressionType.EQUALS;
|
|
1231
|
+
}
|
|
1232
|
+
if (expressionCandidate.toString().indexOf('!=') !== -1) {
|
|
1233
|
+
return ExpressionType.NOT_EQUALS;
|
|
1234
|
+
}
|
|
1235
|
+
return ExpressionType.NOT_AN_EXPRESSION;
|
|
1236
|
+
}
|
|
1237
|
+
function isEqual(expressionType) {
|
|
1238
|
+
return expressionType === ExpressionType.EQUALS;
|
|
1239
|
+
}
|
|
1240
|
+
function isNotEqual(expressionType) {
|
|
1241
|
+
return expressionType === ExpressionType.NOT_EQUALS;
|
|
1242
|
+
}
|
|
1243
|
+
function isNotExpression(expressionType) {
|
|
1244
|
+
return expressionType === ExpressionType.NOT_AN_EXPRESSION;
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Splits the expression key by the expressionType on a pair of values
|
|
1248
|
+
* before and after the equals or nor equals sign.
|
|
1249
|
+
* // {expressionType} enum of an expression type
|
|
1250
|
+
* // {key} the given key from a for loop iver all conditions
|
|
1251
|
+
*/
|
|
1252
|
+
function getKeyAndValueByExpressionType(expressionType, key) {
|
|
1253
|
+
if (isEqual(expressionType)) {
|
|
1254
|
+
return key.split('==', 2);
|
|
1255
|
+
}
|
|
1256
|
+
if (isNotEqual(expressionType)) {
|
|
1257
|
+
return key.split('!=', 2);
|
|
1258
|
+
}
|
|
1259
|
+
return null;
|
|
1260
|
+
}
|
|
1261
|
+
function cleanValueOfQuotes(keyAndValue) {
|
|
1262
|
+
if (keyAndValue.charAt(0) === '\'' && keyAndValue.charAt(keyAndValue.length - 1) === '\'') {
|
|
1263
|
+
return keyAndValue.replace('\'', '').replace('\'', '');
|
|
1264
|
+
}
|
|
1265
|
+
return keyAndValue;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* 'mergeFilteredObject' utility function
|
|
1269
|
+
*
|
|
1270
|
+
* Shallowly merges two objects, setting key and values from source object
|
|
1271
|
+
* in target object, excluding specified keys.
|
|
1272
|
+
*
|
|
1273
|
+
* Optionally, it can also use functions to transform the key names and/or
|
|
1274
|
+
* the values of the merging object.
|
|
1275
|
+
*
|
|
1276
|
+
* // {PlainObject} targetObject - Target object to add keys and values to
|
|
1277
|
+
* // {PlainObject} sourceObject - Source object to copy keys and values from
|
|
1278
|
+
* // {string[]} excludeKeys - Array of keys to exclude
|
|
1279
|
+
* // {(string: string) => string = (k) => k} keyFn - Function to apply to keys
|
|
1280
|
+
* // {(any: any) => any = (v) => v} valueFn - Function to apply to values
|
|
1281
|
+
* // {PlainObject} - Returns targetObject
|
|
1282
|
+
*/
|
|
1283
|
+
function mergeFilteredObject(targetObject, sourceObject, excludeKeys = [], keyFn = (key) => key, valFn = (val) => val) {
|
|
1284
|
+
if (!isObject(sourceObject)) {
|
|
1285
|
+
return targetObject;
|
|
1286
|
+
}
|
|
1287
|
+
if (!isObject(targetObject)) {
|
|
1288
|
+
targetObject = {};
|
|
1289
|
+
}
|
|
1290
|
+
for (const key of Object.keys(sourceObject)) {
|
|
1291
|
+
if (!inArray(key, excludeKeys) && isDefined(sourceObject[key])) {
|
|
1292
|
+
targetObject[keyFn(key)] = valFn(sourceObject[key]);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
return targetObject;
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* 'uniqueItems' function
|
|
1299
|
+
*
|
|
1300
|
+
* Accepts any number of string value inputs,
|
|
1301
|
+
* and returns an array of all input vaues, excluding duplicates.
|
|
1302
|
+
*
|
|
1303
|
+
* // {...string} ...items -
|
|
1304
|
+
* // {string[]} -
|
|
1305
|
+
*/
|
|
1306
|
+
function uniqueItems(...items) {
|
|
1307
|
+
const returnItems = [];
|
|
1308
|
+
for (const item of items) {
|
|
1309
|
+
if (!returnItems.includes(item)) {
|
|
1310
|
+
returnItems.push(item);
|
|
1377
1311
|
}
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1312
|
+
}
|
|
1313
|
+
return returnItems;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* 'commonItems' function
|
|
1317
|
+
*
|
|
1318
|
+
* Accepts any number of strings or arrays of string values,
|
|
1319
|
+
* and returns a single array containing only values present in all inputs.
|
|
1320
|
+
*
|
|
1321
|
+
* // {...string|string[]} ...arrays -
|
|
1322
|
+
* // {string[]} -
|
|
1323
|
+
*/
|
|
1324
|
+
function commonItems(...arrays) {
|
|
1325
|
+
let returnItems = null;
|
|
1326
|
+
for (let array of arrays) {
|
|
1327
|
+
if (isString(array)) {
|
|
1328
|
+
array = [array];
|
|
1329
|
+
}
|
|
1330
|
+
returnItems = returnItems === null ? [...array] :
|
|
1331
|
+
returnItems.filter(item => array.includes(item));
|
|
1332
|
+
if (!returnItems.length) {
|
|
1333
|
+
return [];
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
return returnItems;
|
|
1337
|
+
}
|
|
1338
|
+
/**
|
|
1339
|
+
* 'fixTitle' function
|
|
1340
|
+
*
|
|
1341
|
+
*
|
|
1342
|
+
* // {string} input -
|
|
1343
|
+
* // {string} -
|
|
1344
|
+
*/
|
|
1345
|
+
function fixTitle(name) {
|
|
1346
|
+
return name && toTitleCase(name.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/_/g, ' '));
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* 'toTitleCase' function
|
|
1350
|
+
*
|
|
1351
|
+
* Intelligently converts an input string to Title Case.
|
|
1352
|
+
*
|
|
1353
|
+
* Accepts an optional second parameter with a list of additional
|
|
1354
|
+
* words and abbreviations to force into a particular case.
|
|
1355
|
+
*
|
|
1356
|
+
* This function is built on prior work by John Gruber and David Gouch:
|
|
1357
|
+
* http://daringfireball.net/2008/08/title_case_update
|
|
1358
|
+
* https://github.com/gouch/to-title-case
|
|
1359
|
+
*
|
|
1360
|
+
* // {string} input -
|
|
1361
|
+
* // {string|string[]} forceWords? -
|
|
1362
|
+
* // {string} -
|
|
1363
|
+
*/
|
|
1364
|
+
function toTitleCase(input, forceWords) {
|
|
1365
|
+
if (!isString(input)) {
|
|
1366
|
+
return input;
|
|
1367
|
+
}
|
|
1368
|
+
let forceArray = ['a', 'an', 'and', 'as', 'at', 'but', 'by', 'en',
|
|
1369
|
+
'for', 'if', 'in', 'nor', 'of', 'on', 'or', 'per', 'the', 'to', 'v', 'v.',
|
|
1370
|
+
'vs', 'vs.', 'via'];
|
|
1371
|
+
if (isString(forceWords)) {
|
|
1372
|
+
forceWords = forceWords.split('|');
|
|
1373
|
+
}
|
|
1374
|
+
if (isArray(forceWords)) {
|
|
1375
|
+
forceArray = forceArray.concat(forceWords);
|
|
1376
|
+
}
|
|
1377
|
+
const forceArrayLower = forceArray.map(w => w.toLowerCase());
|
|
1378
|
+
const noInitialCase = input === input.toUpperCase() || input === input.toLowerCase();
|
|
1379
|
+
let prevLastChar = '';
|
|
1380
|
+
input = input.trim();
|
|
1381
|
+
return input.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, (word, idx) => {
|
|
1382
|
+
if (!noInitialCase && word.slice(1).search(/[A-Z]|\../) !== -1) {
|
|
1383
|
+
return word;
|
|
1387
1384
|
}
|
|
1388
1385
|
else {
|
|
1389
|
-
|
|
1386
|
+
let newWord;
|
|
1387
|
+
const forceWord = forceArray[forceArrayLower.indexOf(word.toLowerCase())];
|
|
1388
|
+
if (!forceWord) {
|
|
1389
|
+
if (noInitialCase) {
|
|
1390
|
+
if (word.slice(1).search(/\../) !== -1) {
|
|
1391
|
+
newWord = word.toLowerCase();
|
|
1392
|
+
}
|
|
1393
|
+
else {
|
|
1394
|
+
newWord = word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
else {
|
|
1398
|
+
newWord = word[0].toUpperCase() + word.slice(1);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
else if (forceWord === forceWord.toLowerCase() && (idx === 0 || idx + word.length === input.length ||
|
|
1402
|
+
prevLastChar === ':' || input[idx - 1].search(/[^\s-]/) !== -1 ||
|
|
1403
|
+
(input[idx - 1] !== '-' && input[idx + word.length] === '-'))) {
|
|
1404
|
+
newWord = forceWord[0].toUpperCase() + forceWord.slice(1);
|
|
1405
|
+
}
|
|
1406
|
+
else {
|
|
1407
|
+
newWord = forceWord;
|
|
1408
|
+
}
|
|
1409
|
+
prevLastChar = word.slice(-1);
|
|
1410
|
+
return newWord;
|
|
1390
1411
|
}
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
maxProperties: '项目数必须小于或者等于 {{maximumProperties}} (当前项目数: {{currentProperties}})',
|
|
1394
|
-
minItems: '项目数必须大于或者等于 {{minimumItems}} (当前项目数: {{currentItems}})',
|
|
1395
|
-
maxItems: '项目数必须小于或者等于 {{maximumItems}} (当前项目数: {{currentItems}})',
|
|
1396
|
-
uniqueItems: '所有项目必须是唯一的',
|
|
1397
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
1398
|
-
};
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1399
1414
|
|
|
1400
1415
|
class JsonPointer {
|
|
1401
1416
|
/**
|
|
@@ -2412,10 +2427,10 @@ class JsonPointer {
|
|
|
2412
2427
|
}
|
|
2413
2428
|
console.error('parseObjectPath error: Input object path must be a string.');
|
|
2414
2429
|
}
|
|
2415
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
2416
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
2430
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonPointer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2431
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonPointer }); }
|
|
2417
2432
|
}
|
|
2418
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
2433
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonPointer, decorators: [{
|
|
2419
2434
|
type: Injectable
|
|
2420
2435
|
}] });
|
|
2421
2436
|
|
|
@@ -6361,6 +6376,12 @@ function buildTitleMap(titleMap, enumList, fieldRequired = true, flatList = true
|
|
|
6361
6376
|
// causes a library to be imported before another library it depends on.
|
|
6362
6377
|
|
|
6363
6378
|
class JsonSchemaFormService {
|
|
6379
|
+
setDraggableState(value) {
|
|
6380
|
+
this.draggableStateSubject.next(value); // Update the draggable value
|
|
6381
|
+
}
|
|
6382
|
+
setSortableOptions(value) {
|
|
6383
|
+
this.sortableOptionsSubject.next(value); // Update the sortable options value
|
|
6384
|
+
}
|
|
6364
6385
|
constructor() {
|
|
6365
6386
|
this.JsonFormCompatibility = false;
|
|
6366
6387
|
this.ReactJsonSchemaFormCompatibility = false;
|
|
@@ -6445,6 +6466,18 @@ class JsonSchemaFormService {
|
|
|
6445
6466
|
validationMessages: {} // set by setLanguage()
|
|
6446
6467
|
}
|
|
6447
6468
|
};
|
|
6469
|
+
//this has been added to enable or disable the dragabble state of a component
|
|
6470
|
+
//using the OrderableDirective, mainly when an <input type="range">
|
|
6471
|
+
//elements are present, as the draggable attribute makes it difficult to
|
|
6472
|
+
//slide the range sliders and end up dragging
|
|
6473
|
+
//NB this will be set globally for all OrderableDirective instances
|
|
6474
|
+
//and will only be enabled when/if the caller sets the value back to true
|
|
6475
|
+
this.draggableStateSubject = new BehaviorSubject(true); // Default value true
|
|
6476
|
+
this.draggableState$ = this.draggableStateSubject.asObservable();
|
|
6477
|
+
//this is introduced to look at replacing the orderable directive with
|
|
6478
|
+
//nxt-sortablejs and sortablejs
|
|
6479
|
+
this.sortableOptionsSubject = new BehaviorSubject({ disabled: false }); // Default value true
|
|
6480
|
+
this.sortableOptions$ = this.sortableOptionsSubject.asObservable();
|
|
6448
6481
|
this.setLanguage(this.language);
|
|
6449
6482
|
this.ajv.addMetaSchema(jsonDraft6);
|
|
6450
6483
|
this.ajv.addMetaSchema(jsonDraft7);
|
|
@@ -6996,7 +7029,7 @@ class JsonSchemaFormService {
|
|
|
6996
7029
|
JsonPointer.insert(this.layout, this.getLayoutPointer(ctx), newLayoutNode);
|
|
6997
7030
|
return true;
|
|
6998
7031
|
}
|
|
6999
|
-
moveArrayItem(ctx, oldIndex, newIndex) {
|
|
7032
|
+
moveArrayItem(ctx, oldIndex, newIndex, moveLayout = true) {
|
|
7000
7033
|
if (!ctx || !ctx.layoutNode ||
|
|
7001
7034
|
!isDefined(ctx.layoutNode().dataPointer) ||
|
|
7002
7035
|
!hasValue(ctx.dataIndex()) ||
|
|
@@ -7013,8 +7046,10 @@ class JsonSchemaFormService {
|
|
|
7013
7046
|
formArray.insert(newIndex, arrayItem);
|
|
7014
7047
|
formArray.updateValueAndValidity();
|
|
7015
7048
|
// Move layout item
|
|
7016
|
-
|
|
7017
|
-
|
|
7049
|
+
if (moveLayout) {
|
|
7050
|
+
const layoutArray = this.getLayoutArray(ctx);
|
|
7051
|
+
layoutArray.splice(newIndex, 0, layoutArray.splice(oldIndex, 1)[0]);
|
|
7052
|
+
}
|
|
7018
7053
|
return true;
|
|
7019
7054
|
}
|
|
7020
7055
|
removeItem(ctx) {
|
|
@@ -7037,13 +7072,112 @@ class JsonSchemaFormService {
|
|
|
7037
7072
|
JsonPointer.remove(this.layout, this.getLayoutPointer(ctx));
|
|
7038
7073
|
return true;
|
|
7039
7074
|
}
|
|
7040
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7041
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
7075
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7076
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormService }); }
|
|
7042
7077
|
}
|
|
7043
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormService, decorators: [{
|
|
7044
7079
|
type: Injectable
|
|
7045
7080
|
}], ctorParameters: () => [] });
|
|
7046
7081
|
|
|
7082
|
+
class SelectWidgetComponent {
|
|
7083
|
+
constructor() {
|
|
7084
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7085
|
+
this.newComponent = null;
|
|
7086
|
+
this.layoutNode = input(undefined);
|
|
7087
|
+
this.layoutIndex = input(undefined);
|
|
7088
|
+
this.dataIndex = input(undefined);
|
|
7089
|
+
this.widgetContainer = viewChild('widgetContainer', { read: ViewContainerRef });
|
|
7090
|
+
}
|
|
7091
|
+
ngOnInit() {
|
|
7092
|
+
this.updateComponent();
|
|
7093
|
+
}
|
|
7094
|
+
ngOnChanges() {
|
|
7095
|
+
this.updateComponent();
|
|
7096
|
+
}
|
|
7097
|
+
updateComponent() {
|
|
7098
|
+
const widgetContainer = this.widgetContainer();
|
|
7099
|
+
if (widgetContainer && !this.newComponent && (this.layoutNode() || {}).widget) {
|
|
7100
|
+
this.newComponent = widgetContainer.createComponent((this.layoutNode().widget));
|
|
7101
|
+
}
|
|
7102
|
+
if (this.newComponent) {
|
|
7103
|
+
for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
|
|
7104
|
+
this.newComponent.instance[input] = this[input];
|
|
7105
|
+
}
|
|
7106
|
+
}
|
|
7107
|
+
}
|
|
7108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7109
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.6", type: SelectWidgetComponent, isStandalone: false, selector: "select-widget-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
|
|
7110
|
+
}
|
|
7111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectWidgetComponent, decorators: [{
|
|
7112
|
+
type: Component,
|
|
7113
|
+
args: [{
|
|
7114
|
+
// tslint:disable-next-line:component-selector
|
|
7115
|
+
selector: 'select-widget-widget',
|
|
7116
|
+
template: `<div #widgetContainer></div>`,
|
|
7117
|
+
standalone: false
|
|
7118
|
+
}]
|
|
7119
|
+
}] });
|
|
7120
|
+
|
|
7121
|
+
class NoFrameworkComponent {
|
|
7122
|
+
constructor() {
|
|
7123
|
+
this.layoutNode = input(undefined);
|
|
7124
|
+
this.layoutIndex = input(undefined);
|
|
7125
|
+
this.dataIndex = input(undefined);
|
|
7126
|
+
}
|
|
7127
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7128
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: NoFrameworkComponent, isStandalone: false, selector: "no-framework", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>", dependencies: [{ kind: "component", type: SelectWidgetComponent, selector: "select-widget-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
|
|
7129
|
+
}
|
|
7130
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkComponent, decorators: [{
|
|
7131
|
+
type: Component,
|
|
7132
|
+
args: [{ selector: 'no-framework', standalone: false, template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>" }]
|
|
7133
|
+
}] });
|
|
7134
|
+
|
|
7135
|
+
// No framework - plain HTML controls (styles from form layout only)
|
|
7136
|
+
class NoFramework extends Framework {
|
|
7137
|
+
constructor() {
|
|
7138
|
+
super(...arguments);
|
|
7139
|
+
this.name = 'no-framework';
|
|
7140
|
+
this.text = 'None (plain HTML)';
|
|
7141
|
+
this.framework = NoFrameworkComponent;
|
|
7142
|
+
}
|
|
7143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFramework, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
7144
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFramework }); }
|
|
7145
|
+
}
|
|
7146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFramework, decorators: [{
|
|
7147
|
+
type: Injectable
|
|
7148
|
+
}] });
|
|
7149
|
+
|
|
7150
|
+
class ElementAttributeDirective {
|
|
7151
|
+
constructor(renderer, elementRef) {
|
|
7152
|
+
this.renderer = renderer;
|
|
7153
|
+
this.elementRef = elementRef;
|
|
7154
|
+
}
|
|
7155
|
+
ngOnChanges(changes) {
|
|
7156
|
+
if (changes.attributes) {
|
|
7157
|
+
for (let attributeName in this.attributes) {
|
|
7158
|
+
const attributeValue = this.attributes[attributeName];
|
|
7159
|
+
if (attributeValue) {
|
|
7160
|
+
this.renderer.setAttribute(this.elementRef.nativeElement, attributeName, attributeValue);
|
|
7161
|
+
}
|
|
7162
|
+
else {
|
|
7163
|
+
this.renderer.removeAttribute(this.elementRef.nativeElement, attributeName);
|
|
7164
|
+
}
|
|
7165
|
+
}
|
|
7166
|
+
}
|
|
7167
|
+
}
|
|
7168
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ElementAttributeDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
7169
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.6", type: ElementAttributeDirective, isStandalone: false, selector: "[attributes]", inputs: { attributes: "attributes" }, usesOnChanges: true, ngImport: i0 }); }
|
|
7170
|
+
}
|
|
7171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ElementAttributeDirective, decorators: [{
|
|
7172
|
+
type: Directive,
|
|
7173
|
+
args: [{
|
|
7174
|
+
selector: '[attributes]',
|
|
7175
|
+
standalone: false
|
|
7176
|
+
}]
|
|
7177
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }], propDecorators: { attributes: [{
|
|
7178
|
+
type: Input
|
|
7179
|
+
}] } });
|
|
7180
|
+
|
|
7047
7181
|
class AddReferenceComponent {
|
|
7048
7182
|
constructor() {
|
|
7049
7183
|
this.jsf = inject(JsonSchemaFormService);
|
|
@@ -7071,8 +7205,8 @@ class AddReferenceComponent {
|
|
|
7071
7205
|
return parent.layoutNode.add ||
|
|
7072
7206
|
this.jsf.setArrayItemTitle(parent, this.layoutNode(), this.itemCount);
|
|
7073
7207
|
}
|
|
7074
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7075
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7208
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: AddReferenceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7209
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: AddReferenceComponent, isStandalone: false, selector: "add-reference-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7076
7210
|
<button *ngIf="showAddButton"
|
|
7077
7211
|
[class]="options?.fieldHtmlClass || ''"
|
|
7078
7212
|
[disabled]="options?.readonly"
|
|
@@ -7081,7 +7215,7 @@ class AddReferenceComponent {
|
|
|
7081
7215
|
<span *ngIf="options?.title" [innerHTML]="buttonText"></span>
|
|
7082
7216
|
</button>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
7083
7217
|
}
|
|
7084
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: AddReferenceComponent, decorators: [{
|
|
7085
7219
|
type: Component,
|
|
7086
7220
|
args: [{
|
|
7087
7221
|
// tslint:disable-next-line:component-selector
|
|
@@ -7120,8 +7254,8 @@ class ButtonComponent {
|
|
|
7120
7254
|
this.jsf.updateValue(this, event.target.value);
|
|
7121
7255
|
}
|
|
7122
7256
|
}
|
|
7123
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7124
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7257
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7258
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: ButtonComponent, isStandalone: false, selector: "button-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7125
7259
|
<div
|
|
7126
7260
|
[class]="options?.htmlClass || ''">
|
|
7127
7261
|
<button
|
|
@@ -7139,7 +7273,7 @@ class ButtonComponent {
|
|
|
7139
7273
|
</button>
|
|
7140
7274
|
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
7141
7275
|
}
|
|
7142
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
7143
7277
|
type: Component,
|
|
7144
7278
|
args: [{
|
|
7145
7279
|
// tslint:disable-next-line:component-selector
|
|
@@ -7190,8 +7324,8 @@ class CheckboxComponent {
|
|
|
7190
7324
|
get isChecked() {
|
|
7191
7325
|
return this.jsf.getFormControlValue(this) === this.trueValue;
|
|
7192
7326
|
}
|
|
7193
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7194
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7327
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7328
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: CheckboxComponent, isStandalone: false, selector: "checkbox-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7195
7329
|
<label
|
|
7196
7330
|
[attr.for]="'control' + layoutNode()?._id"
|
|
7197
7331
|
[class]="options?.itemLabelHtmlClass || ''">
|
|
@@ -7223,7 +7357,7 @@ class CheckboxComponent {
|
|
|
7223
7357
|
[innerHTML]="options?.title"></span>
|
|
7224
7358
|
</label>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
7225
7359
|
}
|
|
7226
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7360
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
7227
7361
|
type: Component,
|
|
7228
7362
|
args: [{
|
|
7229
7363
|
// tslint:disable-next-line:component-selector
|
|
@@ -7295,8 +7429,8 @@ class CheckboxesComponent {
|
|
|
7295
7429
|
this.jsf.updateArrayCheckboxList(this, this.checkboxList);
|
|
7296
7430
|
}
|
|
7297
7431
|
}
|
|
7298
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7299
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7432
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7433
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: CheckboxesComponent, isStandalone: false, selector: "checkboxes-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7300
7434
|
<label *ngIf="options?.title"
|
|
7301
7435
|
[class]="options?.labelHtmlClass || ''"
|
|
7302
7436
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
@@ -7346,7 +7480,7 @@ class CheckboxesComponent {
|
|
|
7346
7480
|
</div>
|
|
7347
7481
|
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
7348
7482
|
}
|
|
7349
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7483
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: CheckboxesComponent, decorators: [{
|
|
7350
7484
|
type: Component,
|
|
7351
7485
|
args: [{
|
|
7352
7486
|
// tslint:disable-next-line:component-selector
|
|
@@ -7421,10 +7555,10 @@ class FileComponent {
|
|
|
7421
7555
|
updateValue(event) {
|
|
7422
7556
|
this.jsf.updateValue(this, event.target.value);
|
|
7423
7557
|
}
|
|
7424
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7425
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7558
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7559
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: FileComponent, isStandalone: false, selector: "file-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
|
|
7426
7560
|
}
|
|
7427
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7561
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FileComponent, decorators: [{
|
|
7428
7562
|
type: Component,
|
|
7429
7563
|
args: [{
|
|
7430
7564
|
// tslint:disable-next-line:component-selector
|
|
@@ -7434,6 +7568,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
7434
7568
|
}]
|
|
7435
7569
|
}] });
|
|
7436
7570
|
|
|
7571
|
+
class HiddenComponent {
|
|
7572
|
+
constructor() {
|
|
7573
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7574
|
+
this.controlDisabled = false;
|
|
7575
|
+
this.boundControl = false;
|
|
7576
|
+
this.layoutNode = input(undefined);
|
|
7577
|
+
this.layoutIndex = input(undefined);
|
|
7578
|
+
this.dataIndex = input(undefined);
|
|
7579
|
+
}
|
|
7580
|
+
ngOnInit() {
|
|
7581
|
+
this.jsf.initializeControl(this);
|
|
7582
|
+
}
|
|
7583
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: HiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7584
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: HiddenComponent, isStandalone: false, selector: "hidden-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7585
|
+
<input *ngIf="boundControl"
|
|
7586
|
+
[formControl]="formControl"
|
|
7587
|
+
[id]="'control' + layoutNode()?._id"
|
|
7588
|
+
[name]="controlName"
|
|
7589
|
+
type="hidden">
|
|
7590
|
+
<input *ngIf="!boundControl"
|
|
7591
|
+
[disabled]="controlDisabled"
|
|
7592
|
+
[name]="controlName"
|
|
7593
|
+
[id]="'control' + layoutNode()?._id"
|
|
7594
|
+
type="hidden"
|
|
7595
|
+
[value]="controlValue">`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
7596
|
+
}
|
|
7597
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: HiddenComponent, decorators: [{
|
|
7598
|
+
type: Component,
|
|
7599
|
+
args: [{
|
|
7600
|
+
// tslint:disable-next-line:component-selector
|
|
7601
|
+
selector: 'hidden-widget',
|
|
7602
|
+
template: `
|
|
7603
|
+
<input *ngIf="boundControl"
|
|
7604
|
+
[formControl]="formControl"
|
|
7605
|
+
[id]="'control' + layoutNode()?._id"
|
|
7606
|
+
[name]="controlName"
|
|
7607
|
+
type="hidden">
|
|
7608
|
+
<input *ngIf="!boundControl"
|
|
7609
|
+
[disabled]="controlDisabled"
|
|
7610
|
+
[name]="controlName"
|
|
7611
|
+
[id]="'control' + layoutNode()?._id"
|
|
7612
|
+
type="hidden"
|
|
7613
|
+
[value]="controlValue">`,
|
|
7614
|
+
standalone: false
|
|
7615
|
+
}]
|
|
7616
|
+
}] });
|
|
7617
|
+
|
|
7437
7618
|
class InputComponent {
|
|
7438
7619
|
constructor() {
|
|
7439
7620
|
this.jsf = inject(JsonSchemaFormService);
|
|
@@ -7444,6 +7625,10 @@ class InputComponent {
|
|
|
7444
7625
|
this.layoutIndex = input(undefined);
|
|
7445
7626
|
this.dataIndex = input(undefined);
|
|
7446
7627
|
}
|
|
7628
|
+
//needed as templates don't accept something like [attributes]="options?.['x-inputAttributes']"
|
|
7629
|
+
get inputAttributes() {
|
|
7630
|
+
return this.options?.['x-inputAttributes'];
|
|
7631
|
+
}
|
|
7447
7632
|
ngOnInit() {
|
|
7448
7633
|
this.options = this.layoutNode().options || {};
|
|
7449
7634
|
this.jsf.initializeControl(this);
|
|
@@ -7451,9 +7636,9 @@ class InputComponent {
|
|
|
7451
7636
|
updateValue(event) {
|
|
7452
7637
|
this.jsf.updateValue(this, event.target.value);
|
|
7453
7638
|
}
|
|
7454
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7455
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7456
|
-
<div [class]="options?.htmlClass || ''">
|
|
7639
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7640
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: InputComponent, isStandalone: false, selector: "input-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7641
|
+
<div [class]="options?.htmlClass || ''" class="sortable-filter" >
|
|
7457
7642
|
<label *ngIf="options?.title"
|
|
7458
7643
|
[attr.for]="'control' + layoutNode()?._id"
|
|
7459
7644
|
[class]="options?.labelHtmlClass || ''"
|
|
@@ -7472,7 +7657,9 @@ class InputComponent {
|
|
|
7472
7657
|
[id]="'control' + layoutNode()?._id"
|
|
7473
7658
|
[name]="controlName"
|
|
7474
7659
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7475
|
-
[type]="layoutNode()?.type"
|
|
7660
|
+
[type]="layoutNode()?.type"
|
|
7661
|
+
[attributes]="inputAttributes"
|
|
7662
|
+
>
|
|
7476
7663
|
<input *ngIf="!boundControl"
|
|
7477
7664
|
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7478
7665
|
[attr.list]="'control' + layoutNode()?._id + 'Autocomplete'"
|
|
@@ -7488,20 +7675,22 @@ class InputComponent {
|
|
|
7488
7675
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7489
7676
|
[type]="layoutNode()?.type"
|
|
7490
7677
|
[value]="controlValue"
|
|
7491
|
-
(input)="updateValue($event)"
|
|
7678
|
+
(input)="updateValue($event)"
|
|
7679
|
+
[attributes]="inputAttributes"
|
|
7680
|
+
>
|
|
7492
7681
|
<datalist *ngIf="options?.typeahead?.source"
|
|
7493
7682
|
[id]="'control' + layoutNode()?._id + 'Autocomplete'">
|
|
7494
7683
|
<option *ngFor="let word of options?.typeahead?.source" [value]="word">
|
|
7495
7684
|
</datalist>
|
|
7496
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
7685
|
+
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
|
|
7497
7686
|
}
|
|
7498
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7687
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: InputComponent, decorators: [{
|
|
7499
7688
|
type: Component,
|
|
7500
7689
|
args: [{
|
|
7501
7690
|
// tslint:disable-next-line:component-selector
|
|
7502
7691
|
selector: 'input-widget',
|
|
7503
7692
|
template: `
|
|
7504
|
-
<div [class]="options?.htmlClass || ''">
|
|
7693
|
+
<div [class]="options?.htmlClass || ''" class="sortable-filter" >
|
|
7505
7694
|
<label *ngIf="options?.title"
|
|
7506
7695
|
[attr.for]="'control' + layoutNode()?._id"
|
|
7507
7696
|
[class]="options?.labelHtmlClass || ''"
|
|
@@ -7520,7 +7709,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
7520
7709
|
[id]="'control' + layoutNode()?._id"
|
|
7521
7710
|
[name]="controlName"
|
|
7522
7711
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7523
|
-
[type]="layoutNode()?.type"
|
|
7712
|
+
[type]="layoutNode()?.type"
|
|
7713
|
+
[attributes]="inputAttributes"
|
|
7714
|
+
>
|
|
7524
7715
|
<input *ngIf="!boundControl"
|
|
7525
7716
|
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7526
7717
|
[attr.list]="'control' + layoutNode()?._id + 'Autocomplete'"
|
|
@@ -7536,7 +7727,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
7536
7727
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7537
7728
|
[type]="layoutNode()?.type"
|
|
7538
7729
|
[value]="controlValue"
|
|
7539
|
-
(input)="updateValue($event)"
|
|
7730
|
+
(input)="updateValue($event)"
|
|
7731
|
+
[attributes]="inputAttributes"
|
|
7732
|
+
>
|
|
7540
7733
|
<datalist *ngIf="options?.typeahead?.source"
|
|
7541
7734
|
[id]="'control' + layoutNode()?._id + 'Autocomplete'">
|
|
7542
7735
|
<option *ngFor="let word of options?.typeahead?.source" [value]="word">
|
|
@@ -7559,13 +7752,13 @@ class MessageComponent {
|
|
|
7559
7752
|
this.message = this.options.help || this.options.helpvalue ||
|
|
7560
7753
|
this.options.msg || this.options.message;
|
|
7561
7754
|
}
|
|
7562
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7563
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7755
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7756
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: MessageComponent, isStandalone: false, selector: "message-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7564
7757
|
<span *ngIf="message"
|
|
7565
7758
|
[class]="options?.labelHtmlClass || ''"
|
|
7566
7759
|
[innerHTML]="message"></span>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
7567
7760
|
}
|
|
7568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7761
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: MessageComponent, decorators: [{
|
|
7569
7762
|
type: Component,
|
|
7570
7763
|
args: [{
|
|
7571
7764
|
// tslint:disable-next-line:component-selector
|
|
@@ -7584,10 +7777,10 @@ class NoneComponent {
|
|
|
7584
7777
|
this.layoutIndex = input(undefined);
|
|
7585
7778
|
this.dataIndex = input(undefined);
|
|
7586
7779
|
}
|
|
7587
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7588
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7780
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7781
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: NoneComponent, isStandalone: false, selector: "none-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
|
|
7589
7782
|
}
|
|
7590
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7783
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoneComponent, decorators: [{
|
|
7591
7784
|
type: Component,
|
|
7592
7785
|
args: [{
|
|
7593
7786
|
// tslint:disable-next-line:component-selector
|
|
@@ -7597,6 +7790,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
7597
7790
|
}]
|
|
7598
7791
|
}] });
|
|
7599
7792
|
|
|
7793
|
+
//TODO look at reusing InputComponent
|
|
7600
7794
|
class NumberComponent {
|
|
7601
7795
|
constructor() {
|
|
7602
7796
|
this.jsf = inject(JsonSchemaFormService);
|
|
@@ -7610,6 +7804,10 @@ class NumberComponent {
|
|
|
7610
7804
|
this.layoutIndex = input(undefined);
|
|
7611
7805
|
this.dataIndex = input(undefined);
|
|
7612
7806
|
}
|
|
7807
|
+
//needed as templates don't accept something like [attributes]="options?.['x-inputAttributes']"
|
|
7808
|
+
get inputAttributes() {
|
|
7809
|
+
return this.options?.['x-inputAttributes'];
|
|
7810
|
+
}
|
|
7613
7811
|
ngOnInit() {
|
|
7614
7812
|
this.options = this.layoutNode().options || {};
|
|
7615
7813
|
this.jsf.initializeControl(this);
|
|
@@ -7620,15 +7818,15 @@ class NumberComponent {
|
|
|
7620
7818
|
updateValue(event) {
|
|
7621
7819
|
this.jsf.updateValue(this, event.target.value);
|
|
7622
7820
|
}
|
|
7623
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7624
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7625
|
-
<div [class]="options?.htmlClass || ''">
|
|
7821
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7822
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: NumberComponent, isStandalone: false, selector: "number-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "inputControl", first: true, predicate: ["inputControl"], descendants: true }, { propertyName: "div", first: true, predicate: ["divElt"], descendants: true }], ngImport: i0, template: `
|
|
7823
|
+
<div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
|
|
7626
7824
|
<label *ngIf="options?.title"
|
|
7627
7825
|
[attr.for]="'control' + layoutNode()?._id"
|
|
7628
7826
|
[class]="options?.labelHtmlClass || ''"
|
|
7629
7827
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7630
7828
|
[innerHTML]="options?.title"></label>
|
|
7631
|
-
<input *ngIf="boundControl"
|
|
7829
|
+
<input #inputControl *ngIf="boundControl"
|
|
7632
7830
|
[formControl]="formControl"
|
|
7633
7831
|
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7634
7832
|
[attr.max]="options?.maximum"
|
|
@@ -7642,8 +7840,11 @@ class NumberComponent {
|
|
|
7642
7840
|
[name]="controlName"
|
|
7643
7841
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7644
7842
|
[title]="lastValidNumber"
|
|
7645
|
-
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
|
|
7646
|
-
|
|
7843
|
+
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
|
|
7844
|
+
[attributes]="inputAttributes"
|
|
7845
|
+
|
|
7846
|
+
>
|
|
7847
|
+
<input #inputControl *ngIf="!boundControl"
|
|
7647
7848
|
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7648
7849
|
[attr.max]="options?.maximum"
|
|
7649
7850
|
[attr.min]="options?.minimum"
|
|
@@ -7659,23 +7860,25 @@ class NumberComponent {
|
|
|
7659
7860
|
[title]="lastValidNumber"
|
|
7660
7861
|
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
|
|
7661
7862
|
[value]="controlValue"
|
|
7662
|
-
(input)="updateValue($event)"
|
|
7863
|
+
(input)="updateValue($event)"
|
|
7864
|
+
[attributes]="inputAttributes"
|
|
7865
|
+
>
|
|
7663
7866
|
<span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
|
|
7664
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
7867
|
+
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: ElementAttributeDirective, selector: "[attributes]", inputs: ["attributes"] }] }); }
|
|
7665
7868
|
}
|
|
7666
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7869
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NumberComponent, decorators: [{
|
|
7667
7870
|
type: Component,
|
|
7668
7871
|
args: [{
|
|
7669
7872
|
// tslint:disable-next-line:component-selector
|
|
7670
7873
|
selector: 'number-widget',
|
|
7671
7874
|
template: `
|
|
7672
|
-
<div [class]="options?.htmlClass || ''">
|
|
7875
|
+
<div #divElt [class]="options?.htmlClass || ''" class="sortable-filter" >
|
|
7673
7876
|
<label *ngIf="options?.title"
|
|
7674
7877
|
[attr.for]="'control' + layoutNode()?._id"
|
|
7675
7878
|
[class]="options?.labelHtmlClass || ''"
|
|
7676
7879
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7677
7880
|
[innerHTML]="options?.title"></label>
|
|
7678
|
-
<input *ngIf="boundControl"
|
|
7881
|
+
<input #inputControl *ngIf="boundControl"
|
|
7679
7882
|
[formControl]="formControl"
|
|
7680
7883
|
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7681
7884
|
[attr.max]="options?.maximum"
|
|
@@ -7689,8 +7892,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
7689
7892
|
[name]="controlName"
|
|
7690
7893
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7691
7894
|
[title]="lastValidNumber"
|
|
7692
|
-
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
|
|
7693
|
-
|
|
7895
|
+
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
|
|
7896
|
+
[attributes]="inputAttributes"
|
|
7897
|
+
|
|
7898
|
+
>
|
|
7899
|
+
<input #inputControl *ngIf="!boundControl"
|
|
7694
7900
|
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7695
7901
|
[attr.max]="options?.maximum"
|
|
7696
7902
|
[attr.min]="options?.minimum"
|
|
@@ -7706,12 +7912,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
7706
7912
|
[title]="lastValidNumber"
|
|
7707
7913
|
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
|
|
7708
7914
|
[value]="controlValue"
|
|
7709
|
-
(input)="updateValue($event)"
|
|
7915
|
+
(input)="updateValue($event)"
|
|
7916
|
+
[attributes]="inputAttributes"
|
|
7917
|
+
>
|
|
7710
7918
|
<span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
|
|
7711
7919
|
</div>`,
|
|
7712
7920
|
standalone: false
|
|
7713
7921
|
}]
|
|
7714
|
-
}]
|
|
7922
|
+
}], propDecorators: { inputControl: [{
|
|
7923
|
+
type: ViewChild,
|
|
7924
|
+
args: ['inputControl', {}]
|
|
7925
|
+
}], div: [{
|
|
7926
|
+
type: ViewChild,
|
|
7927
|
+
args: ['divElt', {}]
|
|
7928
|
+
}] } });
|
|
7715
7929
|
|
|
7716
7930
|
// TODO: Add this control
|
|
7717
7931
|
class OneOfComponent {
|
|
@@ -7730,10 +7944,10 @@ class OneOfComponent {
|
|
|
7730
7944
|
updateValue(event) {
|
|
7731
7945
|
this.jsf.updateValue(this, event.target.value);
|
|
7732
7946
|
}
|
|
7733
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7734
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7947
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OneOfComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7948
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: OneOfComponent, isStandalone: false, selector: "one-of-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: ``, isInline: true }); }
|
|
7735
7949
|
}
|
|
7736
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
7950
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OneOfComponent, decorators: [{
|
|
7737
7951
|
type: Component,
|
|
7738
7952
|
args: [{
|
|
7739
7953
|
// tslint:disable-next-line:component-selector
|
|
@@ -7767,8 +7981,8 @@ class RadiosComponent {
|
|
|
7767
7981
|
updateValue(event) {
|
|
7768
7982
|
this.jsf.updateValue(this, event.target.value);
|
|
7769
7983
|
}
|
|
7770
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7771
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
7984
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RadiosComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7985
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: RadiosComponent, isStandalone: false, selector: "radios-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
7772
7986
|
<label *ngIf="options?.title"
|
|
7773
7987
|
[attr.for]="'control' + layoutNode()?._id"
|
|
7774
7988
|
[class]="options?.labelHtmlClass || ''"
|
|
@@ -7825,7 +8039,7 @@ class RadiosComponent {
|
|
|
7825
8039
|
</div>
|
|
7826
8040
|
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
7827
8041
|
}
|
|
7828
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8042
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RadiosComponent, decorators: [{
|
|
7829
8043
|
type: Component,
|
|
7830
8044
|
args: [{
|
|
7831
8045
|
// tslint:disable-next-line:component-selector
|
|
@@ -7892,7 +8106,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
7892
8106
|
|
|
7893
8107
|
class SelectFrameworkComponent {
|
|
7894
8108
|
constructor() {
|
|
7895
|
-
this.componentFactory = inject(ComponentFactoryResolver);
|
|
7896
8109
|
this.jsf = inject(JsonSchemaFormService);
|
|
7897
8110
|
this.newComponent = null;
|
|
7898
8111
|
this.layoutNode = input(undefined);
|
|
@@ -7909,7 +8122,7 @@ class SelectFrameworkComponent {
|
|
|
7909
8122
|
updateComponent() {
|
|
7910
8123
|
const widgetContainer = this.widgetContainer();
|
|
7911
8124
|
if (widgetContainer && !this.newComponent && this.jsf.framework) {
|
|
7912
|
-
this.newComponent = widgetContainer.createComponent(
|
|
8125
|
+
this.newComponent = widgetContainer.createComponent((this.jsf.framework));
|
|
7913
8126
|
//TODO fix all deprecated calls and test
|
|
7914
8127
|
//this.widgetContainer.createComponent<any>(this.jsf.framework)
|
|
7915
8128
|
}
|
|
@@ -7919,10 +8132,10 @@ class SelectFrameworkComponent {
|
|
|
7919
8132
|
}
|
|
7920
8133
|
}
|
|
7921
8134
|
}
|
|
7922
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
7923
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.
|
|
8135
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8136
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.6", type: SelectFrameworkComponent, isStandalone: false, selector: "select-framework-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
|
|
7924
8137
|
}
|
|
7925
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectFrameworkComponent, decorators: [{
|
|
7926
8139
|
type: Component,
|
|
7927
8140
|
args: [{
|
|
7928
8141
|
// tslint:disable-next-line:component-selector
|
|
@@ -8036,12 +8249,21 @@ class OrderableDirective {
|
|
|
8036
8249
|
return false;
|
|
8037
8250
|
});
|
|
8038
8251
|
});
|
|
8252
|
+
// Subscribe to the draggable state
|
|
8253
|
+
this.draggableStateSubscription = this.jsf.draggableState$.subscribe((value) => {
|
|
8254
|
+
this.element.draggable = value;
|
|
8255
|
+
});
|
|
8256
|
+
}
|
|
8257
|
+
}
|
|
8258
|
+
ngOnDestroy() {
|
|
8259
|
+
if (this.draggableStateSubscription) {
|
|
8260
|
+
this.draggableStateSubscription.unsubscribe();
|
|
8039
8261
|
}
|
|
8040
8262
|
}
|
|
8041
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
8042
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.
|
|
8263
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
8264
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.6", type: OrderableDirective, isStandalone: false, selector: "[orderable]", inputs: { orderable: { classPropertyName: "orderable", publicName: "orderable", isSignal: true, isRequired: false, transformFunction: null }, layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
8043
8265
|
}
|
|
8044
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: OrderableDirective, decorators: [{
|
|
8045
8267
|
type: Directive,
|
|
8046
8268
|
args: [{
|
|
8047
8269
|
// tslint:disable-next-line:directive-selector
|
|
@@ -8058,10 +8280,42 @@ class RootComponent {
|
|
|
8058
8280
|
this.layout = input(undefined);
|
|
8059
8281
|
this.isOrderable = input(undefined);
|
|
8060
8282
|
this.isFlexItem = input(false);
|
|
8283
|
+
this.sortableConfig = {
|
|
8284
|
+
filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
|
|
8285
|
+
preventOnFilter: false, //needed for input range elements slider do still work
|
|
8286
|
+
delay: 1000,
|
|
8287
|
+
delayOnTouchOnly: true,
|
|
8288
|
+
onEnd: (/**Event*/ evt) => {
|
|
8289
|
+
evt.newIndex; // most likely why this event is used is to get the dragging element's current index
|
|
8290
|
+
// same properties as onEnd
|
|
8291
|
+
//console.log(`sortablejs event:${evt}`);
|
|
8292
|
+
let srcInd = evt.oldIndex;
|
|
8293
|
+
let trgInd = evt.newIndex;
|
|
8294
|
+
let layoutItem = this.layout()[trgInd];
|
|
8295
|
+
let dataInd = layoutItem?.arrayItem ? (this.dataIndex() || []).concat(trgInd) : (this.dataIndex() || []);
|
|
8296
|
+
let layoutInd = (this.layoutIndex() || []).concat(trgInd);
|
|
8297
|
+
let itemCtx = {
|
|
8298
|
+
dataIndex: () => { return dataInd; },
|
|
8299
|
+
layoutIndex: () => { return layoutInd; },
|
|
8300
|
+
layoutNode: () => { return layoutItem; },
|
|
8301
|
+
};
|
|
8302
|
+
//must set moveLayout to false as nxtSortable already moves it
|
|
8303
|
+
this.jsf.moveArrayItem(itemCtx, evt.oldIndex, evt.newIndex, false);
|
|
8304
|
+
}
|
|
8305
|
+
};
|
|
8306
|
+
}
|
|
8307
|
+
sortableInit(sortable) {
|
|
8308
|
+
this.sortableObj = sortable;
|
|
8061
8309
|
}
|
|
8062
8310
|
isDraggable(node) {
|
|
8063
|
-
|
|
8311
|
+
let result = node.arrayItem && node.type !== '$ref' &&
|
|
8064
8312
|
node.arrayItemType === 'list' && this.isOrderable() !== false;
|
|
8313
|
+
if (this.sortableObj) {
|
|
8314
|
+
//this.sortableObj.option("disabled",true);
|
|
8315
|
+
//this.sortableObj.option("sort",false);
|
|
8316
|
+
//this.sortableObj.option("disabled",!result);
|
|
8317
|
+
}
|
|
8318
|
+
return result;
|
|
8065
8319
|
}
|
|
8066
8320
|
// Set attributes for flexbox child
|
|
8067
8321
|
// (container attributes are set in section.component)
|
|
@@ -8073,48 +8327,86 @@ class RootComponent {
|
|
|
8073
8327
|
showWidget(layoutNode) {
|
|
8074
8328
|
return this.jsf.evaluateCondition(layoutNode, this.dataIndex());
|
|
8075
8329
|
}
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8330
|
+
ngOnInit() {
|
|
8331
|
+
// Subscribe to the draggable state
|
|
8332
|
+
this.sortableOptionsSubscription = this.jsf.sortableOptions$.subscribe((optsValue) => {
|
|
8333
|
+
if (this.sortableObj) {
|
|
8334
|
+
Object.keys(optsValue).forEach(opt => {
|
|
8335
|
+
let optVal = optsValue[opt];
|
|
8336
|
+
this.sortableObj.option(opt, optVal);
|
|
8337
|
+
});
|
|
8338
|
+
//this.sortableObj.option("disabled",true);
|
|
8339
|
+
//this.sortableObj.option("sort",false);
|
|
8340
|
+
}
|
|
8341
|
+
});
|
|
8342
|
+
}
|
|
8343
|
+
ngOnDestroy() {
|
|
8344
|
+
if (this.sortableOptionsSubscription) {
|
|
8345
|
+
this.sortableOptionsSubscription.unsubscribe();
|
|
8346
|
+
}
|
|
8347
|
+
}
|
|
8348
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8349
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: RootComponent, isStandalone: false, selector: "root-widget", inputs: { dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, isOrderable: { classPropertyName: "isOrderable", publicName: "isOrderable", isSignal: true, isRequired: false, transformFunction: null }, isFlexItem: { classPropertyName: "isFlexItem", publicName: "isFlexItem", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
8350
|
+
<div #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
|
|
8351
|
+
<div *ngFor="let layoutItem of layout(); let i = index"
|
|
8352
|
+
[class.form-flex-item]="isFlexItem()"
|
|
8353
|
+
[style.align-self]="(layoutItem.options || {})['align-self']"
|
|
8354
|
+
[style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
|
|
8355
|
+
[style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
|
|
8356
|
+
[style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
|
|
8357
|
+
[style.order]="(layoutItem.options || {}).order"
|
|
8358
|
+
[class.sortable-filter]="!isDraggable(layoutItem)"
|
|
8359
|
+
>
|
|
8360
|
+
<!--NB orderable directive is not used but has been left in for now and set to false
|
|
8361
|
+
otherwise the compiler won't recognize dataIndex and other dependent attributes
|
|
8362
|
+
-->
|
|
8363
|
+
<div
|
|
8091
8364
|
[dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
|
|
8092
8365
|
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8093
|
-
[layoutNode]="layoutItem"
|
|
8366
|
+
[layoutNode]="layoutItem"
|
|
8367
|
+
[orderable]="false"
|
|
8368
|
+
[class.sortable-filter]="!isDraggable(layoutItem)"
|
|
8369
|
+
>
|
|
8370
|
+
<select-framework-widget *ngIf="showWidget(layoutItem)"
|
|
8371
|
+
[dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
|
|
8372
|
+
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8373
|
+
[layoutNode]="layoutItem"></select-framework-widget>
|
|
8374
|
+
</div>
|
|
8094
8375
|
</div>
|
|
8095
|
-
</div
|
|
8376
|
+
</div>
|
|
8377
|
+
`, isInline: true, styles: ["[draggable=true]{transition:all .15s cubic-bezier(.4,0,.2,1)}[draggable=true]:hover{cursor:move;box-shadow:2px 2px 4px #0003;position:relative;z-index:10;margin:-1px 1px 1px -1px}[draggable=true].drag-target-top{box-shadow:0 -2px #000;position:relative;z-index:20}[draggable=true].drag-target-bottom{box-shadow:0 2px #000;position:relative;z-index:20}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.SortablejsDirective, selector: "[nxtSortablejs]", inputs: ["nxtSortablejs", "sortablejsContainer", "config", "cloneFunction"], outputs: ["init"] }, { kind: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }, { kind: "directive", type: OrderableDirective, selector: "[orderable]", inputs: ["orderable", "layoutNode", "layoutIndex", "dataIndex"] }] }); }
|
|
8096
8378
|
}
|
|
8097
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: RootComponent, decorators: [{
|
|
8098
8380
|
type: Component,
|
|
8099
8381
|
args: [{ selector: 'root-widget', template: `
|
|
8100
|
-
<div
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
[
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8382
|
+
<div #sortableContainter [nxtSortablejs]="layout()" [config]="sortableConfig" (init)="sortableInit($event)">
|
|
8383
|
+
<div *ngFor="let layoutItem of layout(); let i = index"
|
|
8384
|
+
[class.form-flex-item]="isFlexItem()"
|
|
8385
|
+
[style.align-self]="(layoutItem.options || {})['align-self']"
|
|
8386
|
+
[style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
|
|
8387
|
+
[style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
|
|
8388
|
+
[style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
|
|
8389
|
+
[style.order]="(layoutItem.options || {}).order"
|
|
8390
|
+
[class.sortable-filter]="!isDraggable(layoutItem)"
|
|
8391
|
+
>
|
|
8392
|
+
<!--NB orderable directive is not used but has been left in for now and set to false
|
|
8393
|
+
otherwise the compiler won't recognize dataIndex and other dependent attributes
|
|
8394
|
+
-->
|
|
8395
|
+
<div
|
|
8113
8396
|
[dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
|
|
8114
8397
|
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8115
|
-
[layoutNode]="layoutItem"
|
|
8398
|
+
[layoutNode]="layoutItem"
|
|
8399
|
+
[orderable]="false"
|
|
8400
|
+
[class.sortable-filter]="!isDraggable(layoutItem)"
|
|
8401
|
+
>
|
|
8402
|
+
<select-framework-widget *ngIf="showWidget(layoutItem)"
|
|
8403
|
+
[dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
|
|
8404
|
+
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8405
|
+
[layoutNode]="layoutItem"></select-framework-widget>
|
|
8406
|
+
</div>
|
|
8116
8407
|
</div>
|
|
8117
|
-
</div
|
|
8408
|
+
</div>
|
|
8409
|
+
`, standalone: false, styles: ["[draggable=true]{transition:all .15s cubic-bezier(.4,0,.2,1)}[draggable=true]:hover{cursor:move;box-shadow:2px 2px 4px #0003;position:relative;z-index:10;margin:-1px 1px 1px -1px}[draggable=true].drag-target-top{box-shadow:0 -2px #000;position:relative;z-index:20}[draggable=true].drag-target-bottom{box-shadow:0 2px #000;position:relative;z-index:20}\n"] }]
|
|
8118
8410
|
}] });
|
|
8119
8411
|
|
|
8120
8412
|
class SectionComponent {
|
|
@@ -8178,8 +8470,8 @@ class SectionComponent {
|
|
|
8178
8470
|
return this.options[attribute];
|
|
8179
8471
|
}
|
|
8180
8472
|
}
|
|
8181
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
8182
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
8473
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8474
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: SectionComponent, isStandalone: false, selector: "section-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
8183
8475
|
<div *ngIf="containerType === 'div'"
|
|
8184
8476
|
[class]="options?.htmlClass || ''"
|
|
8185
8477
|
[class.expandable]="options?.expandable && !expanded"
|
|
@@ -8189,7 +8481,7 @@ class SectionComponent {
|
|
|
8189
8481
|
[class]="options?.labelHtmlClass || ''"
|
|
8190
8482
|
[innerHTML]="sectionTitle"
|
|
8191
8483
|
(click)="toggleExpanded()"></label>
|
|
8192
|
-
<root-widget
|
|
8484
|
+
<root-widget
|
|
8193
8485
|
[dataIndex]="dataIndex()"
|
|
8194
8486
|
[layout]="layoutNode().items"
|
|
8195
8487
|
[layoutIndex]="layoutIndex()"
|
|
@@ -8199,7 +8491,7 @@ class SectionComponent {
|
|
|
8199
8491
|
[class.form-flex-row]="getFlexAttribute('flex-direction') === 'row'"
|
|
8200
8492
|
[style.align-content]="getFlexAttribute('align-content')"
|
|
8201
8493
|
[style.align-items]="getFlexAttribute('align-items')"
|
|
8202
|
-
[style.display]="getFlexAttribute('display')"
|
|
8494
|
+
[style.display]="!expanded?'none':getFlexAttribute('display')"
|
|
8203
8495
|
[style.flex-direction]="getFlexAttribute('flex-direction')"
|
|
8204
8496
|
[style.flex-wrap]="getFlexAttribute('flex-wrap')"
|
|
8205
8497
|
[style.justify-content]="getFlexAttribute('justify-content')"></root-widget>
|
|
@@ -8220,7 +8512,7 @@ class SectionComponent {
|
|
|
8220
8512
|
[class]="options?.labelHelpBlockClass || ''"
|
|
8221
8513
|
[innerHTML]="options?.description"></p>
|
|
8222
8514
|
</div>
|
|
8223
|
-
<root-widget
|
|
8515
|
+
<root-widget
|
|
8224
8516
|
[dataIndex]="dataIndex()"
|
|
8225
8517
|
[layout]="layoutNode().items"
|
|
8226
8518
|
[layoutIndex]="layoutIndex()"
|
|
@@ -8230,7 +8522,7 @@ class SectionComponent {
|
|
|
8230
8522
|
[class.form-flex-row]="getFlexAttribute('flex-direction') === 'row'"
|
|
8231
8523
|
[style.align-content]="getFlexAttribute('align-content')"
|
|
8232
8524
|
[style.align-items]="getFlexAttribute('align-items')"
|
|
8233
|
-
[style.display]="getFlexAttribute('display')"
|
|
8525
|
+
[style.display]="!expanded?'none':getFlexAttribute('display')"
|
|
8234
8526
|
[style.flex-direction]="getFlexAttribute('flex-direction')"
|
|
8235
8527
|
[style.flex-wrap]="getFlexAttribute('flex-wrap')"
|
|
8236
8528
|
[style.justify-content]="getFlexAttribute('justify-content')"></root-widget>
|
|
@@ -8242,7 +8534,7 @@ class SectionComponent {
|
|
|
8242
8534
|
</div>
|
|
8243
8535
|
</fieldset>`, isInline: true, styles: [".legend{font-weight:700}.expandable>legend:before,.expandable>label:before{content:\"\\25b6\";padding-right:.3em;font-family:auto}.expanded>legend:before,.expanded>label:before{content:\"\\25bc\";padding-right:.2em}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
|
|
8244
8536
|
}
|
|
8245
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8537
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SectionComponent, decorators: [{
|
|
8246
8538
|
type: Component,
|
|
8247
8539
|
args: [{ selector: 'section-widget', template: `
|
|
8248
8540
|
<div *ngIf="containerType === 'div'"
|
|
@@ -8254,7 +8546,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
8254
8546
|
[class]="options?.labelHtmlClass || ''"
|
|
8255
8547
|
[innerHTML]="sectionTitle"
|
|
8256
8548
|
(click)="toggleExpanded()"></label>
|
|
8257
|
-
<root-widget
|
|
8549
|
+
<root-widget
|
|
8258
8550
|
[dataIndex]="dataIndex()"
|
|
8259
8551
|
[layout]="layoutNode().items"
|
|
8260
8552
|
[layoutIndex]="layoutIndex()"
|
|
@@ -8264,7 +8556,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
8264
8556
|
[class.form-flex-row]="getFlexAttribute('flex-direction') === 'row'"
|
|
8265
8557
|
[style.align-content]="getFlexAttribute('align-content')"
|
|
8266
8558
|
[style.align-items]="getFlexAttribute('align-items')"
|
|
8267
|
-
[style.display]="getFlexAttribute('display')"
|
|
8559
|
+
[style.display]="!expanded?'none':getFlexAttribute('display')"
|
|
8268
8560
|
[style.flex-direction]="getFlexAttribute('flex-direction')"
|
|
8269
8561
|
[style.flex-wrap]="getFlexAttribute('flex-wrap')"
|
|
8270
8562
|
[style.justify-content]="getFlexAttribute('justify-content')"></root-widget>
|
|
@@ -8285,7 +8577,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
8285
8577
|
[class]="options?.labelHelpBlockClass || ''"
|
|
8286
8578
|
[innerHTML]="options?.description"></p>
|
|
8287
8579
|
</div>
|
|
8288
|
-
<root-widget
|
|
8580
|
+
<root-widget
|
|
8289
8581
|
[dataIndex]="dataIndex()"
|
|
8290
8582
|
[layout]="layoutNode().items"
|
|
8291
8583
|
[layoutIndex]="layoutIndex()"
|
|
@@ -8295,7 +8587,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
8295
8587
|
[class.form-flex-row]="getFlexAttribute('flex-direction') === 'row'"
|
|
8296
8588
|
[style.align-content]="getFlexAttribute('align-content')"
|
|
8297
8589
|
[style.align-items]="getFlexAttribute('align-items')"
|
|
8298
|
-
[style.display]="getFlexAttribute('display')"
|
|
8590
|
+
[style.display]="!expanded?'none':getFlexAttribute('display')"
|
|
8299
8591
|
[style.flex-direction]="getFlexAttribute('flex-direction')"
|
|
8300
8592
|
[style.flex-wrap]="getFlexAttribute('flex-wrap')"
|
|
8301
8593
|
[style.justify-content]="getFlexAttribute('justify-content')"></root-widget>
|
|
@@ -8327,8 +8619,8 @@ class SelectComponent {
|
|
|
8327
8619
|
updateValue(event) {
|
|
8328
8620
|
this.jsf.updateValue(this, event.target.value);
|
|
8329
8621
|
}
|
|
8330
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
8331
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
8622
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8623
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: SelectComponent, isStandalone: false, selector: "select-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
8332
8624
|
<div
|
|
8333
8625
|
[class]="options?.htmlClass || ''">
|
|
8334
8626
|
<label *ngIf="options?.title"
|
|
@@ -8385,7 +8677,7 @@ class SelectComponent {
|
|
|
8385
8677
|
</select>
|
|
8386
8678
|
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
8387
8679
|
}
|
|
8388
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8680
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SelectComponent, decorators: [{
|
|
8389
8681
|
type: Component,
|
|
8390
8682
|
args: [{
|
|
8391
8683
|
// tslint:disable-next-line:component-selector
|
|
@@ -8450,46 +8742,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
8450
8742
|
}]
|
|
8451
8743
|
}] });
|
|
8452
8744
|
|
|
8453
|
-
class SelectWidgetComponent {
|
|
8454
|
-
constructor() {
|
|
8455
|
-
this.componentFactory = inject(ComponentFactoryResolver);
|
|
8456
|
-
this.jsf = inject(JsonSchemaFormService);
|
|
8457
|
-
this.newComponent = null;
|
|
8458
|
-
this.layoutNode = input(undefined);
|
|
8459
|
-
this.layoutIndex = input(undefined);
|
|
8460
|
-
this.dataIndex = input(undefined);
|
|
8461
|
-
this.widgetContainer = viewChild('widgetContainer', { read: ViewContainerRef });
|
|
8462
|
-
}
|
|
8463
|
-
ngOnInit() {
|
|
8464
|
-
this.updateComponent();
|
|
8465
|
-
}
|
|
8466
|
-
ngOnChanges() {
|
|
8467
|
-
this.updateComponent();
|
|
8468
|
-
}
|
|
8469
|
-
updateComponent() {
|
|
8470
|
-
const widgetContainer = this.widgetContainer();
|
|
8471
|
-
if (widgetContainer && !this.newComponent && (this.layoutNode() || {}).widget) {
|
|
8472
|
-
this.newComponent = widgetContainer.createComponent(this.componentFactory.resolveComponentFactory(this.layoutNode().widget));
|
|
8473
|
-
}
|
|
8474
|
-
if (this.newComponent) {
|
|
8475
|
-
for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
|
|
8476
|
-
this.newComponent.instance[input] = this[input];
|
|
8477
|
-
}
|
|
8478
|
-
}
|
|
8479
|
-
}
|
|
8480
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SelectWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8481
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.1.4", type: SelectWidgetComponent, isStandalone: false, selector: "select-widget-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
|
|
8482
|
-
}
|
|
8483
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: SelectWidgetComponent, decorators: [{
|
|
8484
|
-
type: Component,
|
|
8485
|
-
args: [{
|
|
8486
|
-
// tslint:disable-next-line:component-selector
|
|
8487
|
-
selector: 'select-widget-widget',
|
|
8488
|
-
template: `<div #widgetContainer></div>`,
|
|
8489
|
-
standalone: false
|
|
8490
|
-
}]
|
|
8491
|
-
}] });
|
|
8492
|
-
|
|
8493
8745
|
class SubmitComponent {
|
|
8494
8746
|
constructor() {
|
|
8495
8747
|
this.jsf = inject(JsonSchemaFormService);
|
|
@@ -8525,8 +8777,8 @@ class SubmitComponent {
|
|
|
8525
8777
|
this.jsf.updateValue(this, event.target.value);
|
|
8526
8778
|
}
|
|
8527
8779
|
}
|
|
8528
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
8529
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
8780
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SubmitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8781
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: SubmitComponent, isStandalone: false, selector: "submit-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
8530
8782
|
<div
|
|
8531
8783
|
[class]="options?.htmlClass || ''">
|
|
8532
8784
|
<input
|
|
@@ -8542,7 +8794,7 @@ class SubmitComponent {
|
|
|
8542
8794
|
(click)="updateValue($event)">
|
|
8543
8795
|
</div>`, isInline: true }); }
|
|
8544
8796
|
}
|
|
8545
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8797
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: SubmitComponent, decorators: [{
|
|
8546
8798
|
type: Component,
|
|
8547
8799
|
args: [{
|
|
8548
8800
|
// tslint:disable-next-line:component-selector
|
|
@@ -8566,6 +8818,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
8566
8818
|
}]
|
|
8567
8819
|
}] });
|
|
8568
8820
|
|
|
8821
|
+
class TabComponent {
|
|
8822
|
+
constructor() {
|
|
8823
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8824
|
+
this.layoutNode = input(undefined);
|
|
8825
|
+
this.layoutIndex = input(undefined);
|
|
8826
|
+
this.dataIndex = input(undefined);
|
|
8827
|
+
}
|
|
8828
|
+
ngOnInit() {
|
|
8829
|
+
this.options = this.layoutNode().options || {};
|
|
8830
|
+
}
|
|
8831
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8832
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: TabComponent, isStandalone: false, selector: "tab-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
8833
|
+
<div [class]="options?.htmlClass || ''">
|
|
8834
|
+
<root-widget
|
|
8835
|
+
[dataIndex]="dataIndex()"
|
|
8836
|
+
[layoutIndex]="layoutIndex()"
|
|
8837
|
+
[layout]="layoutNode().items"></root-widget>
|
|
8838
|
+
</div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
|
|
8839
|
+
}
|
|
8840
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabComponent, decorators: [{
|
|
8841
|
+
type: Component,
|
|
8842
|
+
args: [{
|
|
8843
|
+
// tslint:disable-next-line:component-selector
|
|
8844
|
+
selector: 'tab-widget',
|
|
8845
|
+
template: `
|
|
8846
|
+
<div [class]="options?.htmlClass || ''">
|
|
8847
|
+
<root-widget
|
|
8848
|
+
[dataIndex]="dataIndex()"
|
|
8849
|
+
[layoutIndex]="layoutIndex()"
|
|
8850
|
+
[layout]="layoutNode().items"></root-widget>
|
|
8851
|
+
</div>`,
|
|
8852
|
+
standalone: false
|
|
8853
|
+
}]
|
|
8854
|
+
}] });
|
|
8855
|
+
|
|
8569
8856
|
class TabsComponent {
|
|
8570
8857
|
constructor() {
|
|
8571
8858
|
this.jsf = inject(JsonSchemaFormService);
|
|
@@ -8603,8 +8890,8 @@ class TabsComponent {
|
|
|
8603
8890
|
setTabTitle(item, index) {
|
|
8604
8891
|
return this.jsf.setArrayItemTitle(this, item, index);
|
|
8605
8892
|
}
|
|
8606
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
8607
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
8893
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8894
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: TabsComponent, isStandalone: false, selector: "tabs-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
8608
8895
|
<ul
|
|
8609
8896
|
[class]="options?.labelHtmlClass || ''">
|
|
8610
8897
|
<li *ngFor="let item of layoutNode()?.items; let i = index"
|
|
@@ -8634,7 +8921,7 @@ class TabsComponent {
|
|
|
8634
8921
|
|
|
8635
8922
|
</div>`, isInline: true, styles: ["a{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
|
|
8636
8923
|
}
|
|
8637
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8924
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TabsComponent, decorators: [{
|
|
8638
8925
|
type: Component,
|
|
8639
8926
|
args: [{ selector: 'tabs-widget', template: `
|
|
8640
8927
|
<ul
|
|
@@ -8669,7 +8956,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
8669
8956
|
|
|
8670
8957
|
class TemplateComponent {
|
|
8671
8958
|
constructor() {
|
|
8672
|
-
this.componentFactory = inject(ComponentFactoryResolver);
|
|
8673
8959
|
this.jsf = inject(JsonSchemaFormService);
|
|
8674
8960
|
this.newComponent = null;
|
|
8675
8961
|
this.layoutNode = input(undefined);
|
|
@@ -8687,7 +8973,7 @@ class TemplateComponent {
|
|
|
8687
8973
|
const layoutNode = this.layoutNode();
|
|
8688
8974
|
const widgetContainer = this.widgetContainer();
|
|
8689
8975
|
if (widgetContainer && !this.newComponent && layoutNode.options.template) {
|
|
8690
|
-
this.newComponent = widgetContainer.createComponent(
|
|
8976
|
+
this.newComponent = widgetContainer.createComponent((layoutNode.options.template));
|
|
8691
8977
|
}
|
|
8692
8978
|
if (this.newComponent) {
|
|
8693
8979
|
for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
|
|
@@ -8695,10 +8981,10 @@ class TemplateComponent {
|
|
|
8695
8981
|
}
|
|
8696
8982
|
}
|
|
8697
8983
|
}
|
|
8698
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
8699
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.
|
|
8984
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8985
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.6", type: TemplateComponent, isStandalone: false, selector: "template-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "widgetContainer", first: true, predicate: ["widgetContainer"], descendants: true, read: ViewContainerRef, isSignal: true }], usesOnChanges: true, ngImport: i0, template: `<div #widgetContainer></div>`, isInline: true }); }
|
|
8700
8986
|
}
|
|
8701
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
8987
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TemplateComponent, decorators: [{
|
|
8702
8988
|
type: Component,
|
|
8703
8989
|
args: [{
|
|
8704
8990
|
// tslint:disable-next-line:component-selector
|
|
@@ -8724,8 +9010,8 @@ class TextareaComponent {
|
|
|
8724
9010
|
updateValue(event) {
|
|
8725
9011
|
this.jsf.updateValue(this, event.target.value);
|
|
8726
9012
|
}
|
|
8727
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
8728
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
9013
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9014
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: TextareaComponent, isStandalone: false, selector: "textarea-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
8729
9015
|
<div
|
|
8730
9016
|
[class]="options?.htmlClass || ''">
|
|
8731
9017
|
<label *ngIf="options?.title"
|
|
@@ -8761,7 +9047,7 @@ class TextareaComponent {
|
|
|
8761
9047
|
(input)="updateValue($event)">{{controlValue}}</textarea>
|
|
8762
9048
|
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
8763
9049
|
}
|
|
8764
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
9050
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
8765
9051
|
type: Component,
|
|
8766
9052
|
args: [{
|
|
8767
9053
|
// tslint:disable-next-line:component-selector
|
|
@@ -8998,27 +9284,69 @@ class WidgetLibraryService {
|
|
|
8998
9284
|
activeWidgets: this.activeWidgets,
|
|
8999
9285
|
};
|
|
9000
9286
|
}
|
|
9001
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
9002
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
9287
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9288
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryService, providedIn: 'root' }); }
|
|
9003
9289
|
}
|
|
9004
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
9290
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryService, decorators: [{
|
|
9005
9291
|
type: Injectable,
|
|
9006
9292
|
args: [{
|
|
9007
9293
|
providedIn: 'root',
|
|
9008
9294
|
}]
|
|
9009
9295
|
}], ctorParameters: () => [] });
|
|
9010
9296
|
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9297
|
+
const BASIC_WIDGETS = [
|
|
9298
|
+
AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
|
|
9299
|
+
CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
|
|
9300
|
+
MessageComponent, NoneComponent, NumberComponent, RadiosComponent,
|
|
9301
|
+
RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent,
|
|
9302
|
+
SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent,
|
|
9303
|
+
TemplateComponent, TextareaComponent
|
|
9304
|
+
];
|
|
9305
|
+
|
|
9306
|
+
class WidgetLibraryModule {
|
|
9307
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
9308
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective, ElementAttributeDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule, i2$1.SortablejsModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective, ElementAttributeDirective] }); }
|
|
9309
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
|
|
9310
|
+
SortablejsModule.forRoot({
|
|
9311
|
+
//disabled:false,
|
|
9312
|
+
//draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
|
|
9313
|
+
filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
|
|
9314
|
+
preventOnFilter: false //needed for input range elements slider do still work
|
|
9315
|
+
})] }); }
|
|
9019
9316
|
}
|
|
9020
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
9021
|
-
type:
|
|
9317
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: WidgetLibraryModule, decorators: [{
|
|
9318
|
+
type: NgModule,
|
|
9319
|
+
args: [{
|
|
9320
|
+
imports: [CommonModule, FormsModule, ReactiveFormsModule,
|
|
9321
|
+
SortablejsModule.forRoot({
|
|
9322
|
+
//disabled:false,
|
|
9323
|
+
//draggable:".draggableitem",//">:not(.nonsort)",//">.draggable-item",//":not(.nonsort)",//">*",//":not(.nonsort)",//":not(.non-draggable)",
|
|
9324
|
+
filter: ".sortable-filter", //needed to disable dragging on input range elements, class needs to be added to the element or its parent
|
|
9325
|
+
preventOnFilter: false //needed for input range elements slider do still work
|
|
9326
|
+
})],
|
|
9327
|
+
declarations: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective],
|
|
9328
|
+
exports: [...BASIC_WIDGETS, OrderableDirective, ElementAttributeDirective]
|
|
9329
|
+
}]
|
|
9330
|
+
}] });
|
|
9331
|
+
|
|
9332
|
+
// No framework - plain HTML controls (styles from form layout only)
|
|
9333
|
+
class NoFrameworkModule {
|
|
9334
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
9335
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, declarations: [NoFrameworkComponent], imports: [CommonModule, WidgetLibraryModule], exports: [NoFrameworkComponent] }); }
|
|
9336
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, providers: [
|
|
9337
|
+
{ provide: Framework, useClass: NoFramework, multi: true }
|
|
9338
|
+
], imports: [CommonModule, WidgetLibraryModule] }); }
|
|
9339
|
+
}
|
|
9340
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: NoFrameworkModule, decorators: [{
|
|
9341
|
+
type: NgModule,
|
|
9342
|
+
args: [{
|
|
9343
|
+
imports: [CommonModule, WidgetLibraryModule],
|
|
9344
|
+
declarations: [NoFrameworkComponent],
|
|
9345
|
+
exports: [NoFrameworkComponent],
|
|
9346
|
+
providers: [
|
|
9347
|
+
{ provide: Framework, useClass: NoFramework, multi: true }
|
|
9348
|
+
]
|
|
9349
|
+
}]
|
|
9022
9350
|
}] });
|
|
9023
9351
|
|
|
9024
9352
|
// Possible future frameworks:
|
|
@@ -9173,10 +9501,10 @@ class FrameworkLibraryService {
|
|
|
9173
9501
|
return actFramework.unregisterTheme(name);
|
|
9174
9502
|
}
|
|
9175
9503
|
}
|
|
9176
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
9177
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
9504
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FrameworkLibraryService, deps: [{ token: Framework }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9505
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FrameworkLibraryService, providedIn: 'root' }); }
|
|
9178
9506
|
}
|
|
9179
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
9507
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: FrameworkLibraryService, decorators: [{
|
|
9180
9508
|
type: Injectable,
|
|
9181
9509
|
args: [{
|
|
9182
9510
|
providedIn: 'root',
|
|
@@ -9385,7 +9713,7 @@ class JsonSchemaFormComponent {
|
|
|
9385
9713
|
}
|
|
9386
9714
|
// Get names of changed inputs
|
|
9387
9715
|
let changedInput = Object.keys(this.previousInputs)
|
|
9388
|
-
.filter(input => this.previousInputs[input] !== this
|
|
9716
|
+
.filter(input => this.previousInputs[input] !== this.getInputValue(input));
|
|
9389
9717
|
let resetFirst = true;
|
|
9390
9718
|
if (changedInput.length === 1 && changedInput[0] === 'form' &&
|
|
9391
9719
|
this.formValuesInput.startsWith('form.')) {
|
|
@@ -9398,12 +9726,13 @@ class JsonSchemaFormComponent {
|
|
|
9398
9726
|
// If only input values have changed, update the form values
|
|
9399
9727
|
if (changedInput.length === 1 && changedInput[0] === this.formValuesInput) {
|
|
9400
9728
|
if (this.formValuesInput.indexOf('.') === -1) {
|
|
9401
|
-
changedData = this
|
|
9729
|
+
changedData = this.getInputValue(this.formValuesInput);
|
|
9730
|
+
//this[this.formValuesInput];
|
|
9402
9731
|
this.setFormValues(changedData, resetFirst);
|
|
9403
9732
|
}
|
|
9404
9733
|
else {
|
|
9405
9734
|
const [input, key] = this.formValuesInput.split('.');
|
|
9406
|
-
changedData = this
|
|
9735
|
+
changedData = this.getInputValue(input)[key];
|
|
9407
9736
|
this.setFormValues(changedData, resetFirst);
|
|
9408
9737
|
}
|
|
9409
9738
|
// If anything else has changed, re-render the entire form
|
|
@@ -9424,7 +9753,7 @@ class JsonSchemaFormComponent {
|
|
|
9424
9753
|
}
|
|
9425
9754
|
// Update previous inputs
|
|
9426
9755
|
Object.keys(this.previousInputs)
|
|
9427
|
-
.filter(input => this.previousInputs[input] !== this
|
|
9756
|
+
.filter(input => this.previousInputs[input] !== this.getInputValue(input))
|
|
9428
9757
|
.forEach(input => this.previousInputs[input] = this.getInputValue(input));
|
|
9429
9758
|
}
|
|
9430
9759
|
}
|
|
@@ -9917,178 +10246,24 @@ class JsonSchemaFormComponent {
|
|
|
9917
10246
|
}
|
|
9918
10247
|
}
|
|
9919
10248
|
}
|
|
9920
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
9921
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.
|
|
10249
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
10250
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: JsonSchemaFormComponent, isStandalone: false, selector: "json-schema-form", inputs: { schema: { classPropertyName: "schema", publicName: "schema", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, framework: { classPropertyName: "framework", publicName: "framework", isSignal: true, isRequired: false, transformFunction: null }, widgets: { classPropertyName: "widgets", publicName: "widgets", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, JSONSchema: { classPropertyName: "JSONSchema", publicName: "JSONSchema", isSignal: true, isRequired: false, transformFunction: null }, UISchema: { classPropertyName: "UISchema", publicName: "UISchema", isSignal: true, isRequired: false, transformFunction: null }, formData: { classPropertyName: "formData", publicName: "formData", isSignal: true, isRequired: false, transformFunction: null }, ngModel: { classPropertyName: "ngModel", publicName: "ngModel", isSignal: true, isRequired: false, transformFunction: null }, language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, loadExternalAssets: { classPropertyName: "loadExternalAssets", publicName: "loadExternalAssets", isSignal: true, isRequired: false, transformFunction: null }, debug: { classPropertyName: "debug", publicName: "debug", isSignal: true, isRequired: false, transformFunction: null }, theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onChanges: "onChanges", onSubmit: "onSubmit", isValid: "isValid", validationErrors: "validationErrors", formSchema: "formSchema", formLayout: "formLayout", dataChange: "dataChange", modelChange: "modelChange", formDataChange: "formDataChange", ngModelChange: "ngModelChange" }, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], usesOnChanges: true, ngImport: i0, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
9922
10251
|
}
|
|
9923
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
10252
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
|
|
9924
10253
|
type: Component,
|
|
9925
10254
|
args: [{ selector: 'json-schema-form', changeDetection: ChangeDetectionStrategy.OnPush, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], standalone: false, template: "<form [autocomplete]=\"jsf?.formOptions?.autocomplete ? 'on' : 'off'\" class=\"json-schema-form\" (ngSubmit)=\"submitForm()\">\r\n <root-widget [layout]=\"jsf?.layout\"></root-widget>\r\n</form>\r\n<div *ngIf=\"debug() || jsf?.formOptions?.debug\">\r\n Debug output:\r\n <pre>{{debugOutput}}</pre>\r\n</div>" }]
|
|
9926
10255
|
}], propDecorators: { value: [{
|
|
9927
10256
|
type: Input
|
|
9928
10257
|
}] } });
|
|
9929
10258
|
|
|
9930
|
-
class NoFrameworkComponent {
|
|
9931
|
-
constructor() {
|
|
9932
|
-
this.layoutNode = input(undefined);
|
|
9933
|
-
this.layoutIndex = input(undefined);
|
|
9934
|
-
this.dataIndex = input(undefined);
|
|
9935
|
-
}
|
|
9936
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: NoFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9937
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.4", type: NoFrameworkComponent, isStandalone: false, selector: "no-framework", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>", dependencies: [{ kind: "component", type: SelectWidgetComponent, selector: "select-widget-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }] }); }
|
|
9938
|
-
}
|
|
9939
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: NoFrameworkComponent, decorators: [{
|
|
9940
|
-
type: Component,
|
|
9941
|
-
args: [{ selector: 'no-framework', standalone: false, template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>" }]
|
|
9942
|
-
}] });
|
|
9943
|
-
|
|
9944
|
-
// No framework - plain HTML controls (styles from form layout only)
|
|
9945
|
-
class NoFramework extends Framework {
|
|
9946
|
-
constructor() {
|
|
9947
|
-
super(...arguments);
|
|
9948
|
-
this.name = 'no-framework';
|
|
9949
|
-
this.text = 'None (plain HTML)';
|
|
9950
|
-
this.framework = NoFrameworkComponent;
|
|
9951
|
-
}
|
|
9952
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: NoFramework, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9953
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: NoFramework }); }
|
|
9954
|
-
}
|
|
9955
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: NoFramework, decorators: [{
|
|
9956
|
-
type: Injectable
|
|
9957
|
-
}] });
|
|
9958
|
-
|
|
9959
|
-
class HiddenComponent {
|
|
9960
|
-
constructor() {
|
|
9961
|
-
this.jsf = inject(JsonSchemaFormService);
|
|
9962
|
-
this.controlDisabled = false;
|
|
9963
|
-
this.boundControl = false;
|
|
9964
|
-
this.layoutNode = input(undefined);
|
|
9965
|
-
this.layoutIndex = input(undefined);
|
|
9966
|
-
this.dataIndex = input(undefined);
|
|
9967
|
-
}
|
|
9968
|
-
ngOnInit() {
|
|
9969
|
-
this.jsf.initializeControl(this);
|
|
9970
|
-
}
|
|
9971
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: HiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9972
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.4", type: HiddenComponent, isStandalone: false, selector: "hidden-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
9973
|
-
<input *ngIf="boundControl"
|
|
9974
|
-
[formControl]="formControl"
|
|
9975
|
-
[id]="'control' + layoutNode()?._id"
|
|
9976
|
-
[name]="controlName"
|
|
9977
|
-
type="hidden">
|
|
9978
|
-
<input *ngIf="!boundControl"
|
|
9979
|
-
[disabled]="controlDisabled"
|
|
9980
|
-
[name]="controlName"
|
|
9981
|
-
[id]="'control' + layoutNode()?._id"
|
|
9982
|
-
type="hidden"
|
|
9983
|
-
[value]="controlValue">`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] }); }
|
|
9984
|
-
}
|
|
9985
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: HiddenComponent, decorators: [{
|
|
9986
|
-
type: Component,
|
|
9987
|
-
args: [{
|
|
9988
|
-
// tslint:disable-next-line:component-selector
|
|
9989
|
-
selector: 'hidden-widget',
|
|
9990
|
-
template: `
|
|
9991
|
-
<input *ngIf="boundControl"
|
|
9992
|
-
[formControl]="formControl"
|
|
9993
|
-
[id]="'control' + layoutNode()?._id"
|
|
9994
|
-
[name]="controlName"
|
|
9995
|
-
type="hidden">
|
|
9996
|
-
<input *ngIf="!boundControl"
|
|
9997
|
-
[disabled]="controlDisabled"
|
|
9998
|
-
[name]="controlName"
|
|
9999
|
-
[id]="'control' + layoutNode()?._id"
|
|
10000
|
-
type="hidden"
|
|
10001
|
-
[value]="controlValue">`,
|
|
10002
|
-
standalone: false
|
|
10003
|
-
}]
|
|
10004
|
-
}] });
|
|
10005
|
-
|
|
10006
|
-
class TabComponent {
|
|
10007
|
-
constructor() {
|
|
10008
|
-
this.jsf = inject(JsonSchemaFormService);
|
|
10009
|
-
this.layoutNode = input(undefined);
|
|
10010
|
-
this.layoutIndex = input(undefined);
|
|
10011
|
-
this.dataIndex = input(undefined);
|
|
10012
|
-
}
|
|
10013
|
-
ngOnInit() {
|
|
10014
|
-
this.options = this.layoutNode().options || {};
|
|
10015
|
-
}
|
|
10016
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
10017
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.4", type: TabComponent, isStandalone: false, selector: "tab-widget", inputs: { layoutNode: { classPropertyName: "layoutNode", publicName: "layoutNode", isSignal: true, isRequired: false, transformFunction: null }, layoutIndex: { classPropertyName: "layoutIndex", publicName: "layoutIndex", isSignal: true, isRequired: false, transformFunction: null }, dataIndex: { classPropertyName: "dataIndex", publicName: "dataIndex", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
10018
|
-
<div [class]="options?.htmlClass || ''">
|
|
10019
|
-
<root-widget
|
|
10020
|
-
[dataIndex]="dataIndex()"
|
|
10021
|
-
[layoutIndex]="layoutIndex()"
|
|
10022
|
-
[layout]="layoutNode().items"></root-widget>
|
|
10023
|
-
</div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
|
|
10024
|
-
}
|
|
10025
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: TabComponent, decorators: [{
|
|
10026
|
-
type: Component,
|
|
10027
|
-
args: [{
|
|
10028
|
-
// tslint:disable-next-line:component-selector
|
|
10029
|
-
selector: 'tab-widget',
|
|
10030
|
-
template: `
|
|
10031
|
-
<div [class]="options?.htmlClass || ''">
|
|
10032
|
-
<root-widget
|
|
10033
|
-
[dataIndex]="dataIndex()"
|
|
10034
|
-
[layoutIndex]="layoutIndex()"
|
|
10035
|
-
[layout]="layoutNode().items"></root-widget>
|
|
10036
|
-
</div>`,
|
|
10037
|
-
standalone: false
|
|
10038
|
-
}]
|
|
10039
|
-
}] });
|
|
10040
|
-
|
|
10041
|
-
const BASIC_WIDGETS = [
|
|
10042
|
-
AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
|
|
10043
|
-
CheckboxesComponent, FileComponent, HiddenComponent, InputComponent,
|
|
10044
|
-
MessageComponent, NoneComponent, NumberComponent, RadiosComponent,
|
|
10045
|
-
RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent,
|
|
10046
|
-
SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent,
|
|
10047
|
-
TemplateComponent, TextareaComponent
|
|
10048
|
-
];
|
|
10049
|
-
|
|
10050
|
-
class WidgetLibraryModule {
|
|
10051
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WidgetLibraryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
10052
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.4", ngImport: i0, type: WidgetLibraryModule, declarations: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective], imports: [CommonModule, FormsModule, ReactiveFormsModule], exports: [AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, HiddenComponent, InputComponent, MessageComponent, NoneComponent, NumberComponent, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, OrderableDirective] }); }
|
|
10053
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WidgetLibraryModule, imports: [CommonModule, FormsModule, ReactiveFormsModule] }); }
|
|
10054
|
-
}
|
|
10055
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: WidgetLibraryModule, decorators: [{
|
|
10056
|
-
type: NgModule,
|
|
10057
|
-
args: [{
|
|
10058
|
-
imports: [CommonModule, FormsModule, ReactiveFormsModule],
|
|
10059
|
-
declarations: [...BASIC_WIDGETS, OrderableDirective],
|
|
10060
|
-
exports: [...BASIC_WIDGETS, OrderableDirective]
|
|
10061
|
-
}]
|
|
10062
|
-
}] });
|
|
10063
|
-
|
|
10064
|
-
// No framework - plain HTML controls (styles from form layout only)
|
|
10065
|
-
class NoFrameworkModule {
|
|
10066
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: NoFrameworkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
10067
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.4", ngImport: i0, type: NoFrameworkModule, declarations: [NoFrameworkComponent], imports: [CommonModule, WidgetLibraryModule], exports: [NoFrameworkComponent] }); }
|
|
10068
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: NoFrameworkModule, providers: [
|
|
10069
|
-
{ provide: Framework, useClass: NoFramework, multi: true }
|
|
10070
|
-
], imports: [CommonModule, WidgetLibraryModule] }); }
|
|
10071
|
-
}
|
|
10072
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImport: i0, type: NoFrameworkModule, decorators: [{
|
|
10073
|
-
type: NgModule,
|
|
10074
|
-
args: [{
|
|
10075
|
-
imports: [CommonModule, WidgetLibraryModule],
|
|
10076
|
-
declarations: [NoFrameworkComponent],
|
|
10077
|
-
exports: [NoFrameworkComponent],
|
|
10078
|
-
providers: [
|
|
10079
|
-
{ provide: Framework, useClass: NoFramework, multi: true }
|
|
10080
|
-
]
|
|
10081
|
-
}]
|
|
10082
|
-
}] });
|
|
10083
|
-
|
|
10084
10259
|
class JsonSchemaFormModule {
|
|
10085
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
10086
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
|
10260
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
10261
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, declarations: [JsonSchemaFormComponent], imports: [CommonModule, FormsModule, ReactiveFormsModule,
|
|
10087
10262
|
WidgetLibraryModule, NoFrameworkModule], exports: [JsonSchemaFormComponent, WidgetLibraryModule] }); }
|
|
10088
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
|
10263
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, imports: [CommonModule, FormsModule, ReactiveFormsModule,
|
|
10089
10264
|
WidgetLibraryModule, NoFrameworkModule, WidgetLibraryModule] }); }
|
|
10090
10265
|
}
|
|
10091
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
10266
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: JsonSchemaFormModule, decorators: [{
|
|
10092
10267
|
type: NgModule,
|
|
10093
10268
|
args: [{
|
|
10094
10269
|
imports: [
|
|
@@ -10108,5 +10283,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.4", ngImpor
|
|
|
10108
10283
|
* Generated bundle index. Do not edit.
|
|
10109
10284
|
*/
|
|
10110
10285
|
|
|
10111
|
-
export { AddReferenceComponent, BASIC_WIDGETS, ButtonComponent, CheckboxComponent, CheckboxesComponent, FileComponent, Framework, FrameworkLibraryService, HiddenComponent, InputComponent, JsonPointer, JsonSchemaFormComponent, JsonSchemaFormModule, JsonSchemaFormService, JsonValidators, MessageComponent, NoneComponent, NumberComponent, OneOfComponent, OrderableDirective, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, WidgetLibraryModule, WidgetLibraryService, _executeAsyncValidators, _executeValidators, _mergeErrors, _mergeObjects, _toPromise, addClasses, buildFormGroup, buildFormGroupTemplate, buildLayout, buildLayoutFromSchema, buildSchemaFromData, buildSchemaFromLayout, buildTitleMap, checkInlineType, combineAllOf, commonItems, convertSchemaToDraft6, copy, deValidationMessages, enValidationMessages, esValidationMessages, fixRequiredArrayProperties, fixTitle, forEach, forEachCopy, formatFormData, frValidationMessages, getControl, getControlValidators, getFromSchema, getInputType, getLayoutNode, getSubSchema, getTitleMapFromOneOf, getType, hasOwn, hasValue, inArray, isArray, isBoolean, isDate, isDefined, isEmpty, isFunction, isInputRequired, isInteger, isMap, isNumber, isObject, isObservable, isPrimitive, isPromise, isSet, isString, isType, itValidationMessages, mapLayout, mergeFilteredObject, mergeSchemas, ptValidationMessages, removeRecursiveReferences, resolveSchemaReferences, setRequiredFields, toJavaScriptType, toObservable, toSchemaType, toTitleCase, uniqueItems, updateInputOptions, xor, zhValidationMessages };
|
|
10286
|
+
export { AddReferenceComponent, BASIC_WIDGETS, ButtonComponent, CheckboxComponent, CheckboxesComponent, ElementAttributeDirective, FileComponent, Framework, FrameworkLibraryService, HiddenComponent, InputComponent, JsonPointer, JsonSchemaFormComponent, JsonSchemaFormModule, JsonSchemaFormService, JsonValidators, MessageComponent, NoneComponent, NumberComponent, OneOfComponent, OrderableDirective, RadiosComponent, RootComponent, SectionComponent, SelectComponent, SelectFrameworkComponent, SelectWidgetComponent, SubmitComponent, TabComponent, TabsComponent, TemplateComponent, TextareaComponent, WidgetLibraryModule, WidgetLibraryService, _executeAsyncValidators, _executeValidators, _mergeErrors, _mergeObjects, _toPromise, addClasses, buildFormGroup, buildFormGroupTemplate, buildLayout, buildLayoutFromSchema, buildSchemaFromData, buildSchemaFromLayout, buildTitleMap, checkInlineType, combineAllOf, commonItems, convertSchemaToDraft6, copy, deValidationMessages, enValidationMessages, esValidationMessages, fixRequiredArrayProperties, fixTitle, forEach, forEachCopy, formatFormData, frValidationMessages, getControl, getControlValidators, getFromSchema, getInputType, getLayoutNode, getSubSchema, getTitleMapFromOneOf, getType, hasOwn, hasValue, inArray, isArray, isBoolean, isDate, isDefined, isEmpty, isFunction, isInputRequired, isInteger, isMap, isNumber, isObject, isObservable, isPrimitive, isPromise, isSet, isString, isType, itValidationMessages, mapLayout, mergeFilteredObject, mergeSchemas, ptValidationMessages, removeRecursiveReferences, resolveSchemaReferences, setRequiredFields, toJavaScriptType, toObservable, toSchemaType, toTitleCase, uniqueItems, updateInputOptions, xor, zhValidationMessages };
|
|
10112
10287
|
//# sourceMappingURL=ng-formworks-core.mjs.map
|