@ng-formworks/core 17.4.0 → 17.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/framework-library/framework-library.service.mjs +9 -12
- package/esm2022/lib/framework-library/no-framework.component.mjs +10 -11
- package/esm2022/lib/json-schema-form.component.mjs +151 -157
- package/esm2022/lib/json-schema-form.service.mjs +66 -50
- package/esm2022/lib/shared/form-group.functions.mjs +22 -19
- package/esm2022/lib/widget-library/add-reference.component.mjs +19 -22
- package/esm2022/lib/widget-library/button.component.mjs +18 -21
- package/esm2022/lib/widget-library/checkbox.component.mjs +25 -28
- package/esm2022/lib/widget-library/checkboxes.component.mjs +23 -25
- package/esm2022/lib/widget-library/file.component.mjs +12 -15
- package/esm2022/lib/widget-library/hidden.component.mjs +18 -21
- package/esm2022/lib/widget-library/input.component.mjs +35 -38
- package/esm2022/lib/widget-library/message.component.mjs +14 -17
- package/esm2022/lib/widget-library/none.component.mjs +9 -10
- package/esm2022/lib/widget-library/number.component.mjs +32 -35
- package/esm2022/lib/widget-library/one-of.component.mjs +12 -15
- package/esm2022/lib/widget-library/orderable.directive.mjs +21 -24
- package/esm2022/lib/widget-library/radios.component.mjs +31 -33
- package/esm2022/lib/widget-library/root.component.mjs +31 -37
- package/esm2022/lib/widget-library/section.component.mjs +30 -33
- package/esm2022/lib/widget-library/select-framework.component.mjs +16 -23
- package/esm2022/lib/widget-library/select-widget.component.mjs +16 -20
- package/esm2022/lib/widget-library/select.component.mjs +25 -28
- package/esm2022/lib/widget-library/submit.component.mjs +18 -21
- package/esm2022/lib/widget-library/tab.component.mjs +20 -23
- package/esm2022/lib/widget-library/tabs.component.mjs +31 -33
- package/esm2022/lib/widget-library/template.component.mjs +17 -20
- package/esm2022/lib/widget-library/textarea.component.mjs +25 -28
- package/fesm2022/ng-formworks-core.mjs +1517 -1578
- package/fesm2022/ng-formworks-core.mjs.map +1 -1
- package/lib/framework-library/framework-library.service.d.ts +1 -3
- package/lib/framework-library/no-framework.component.d.ts +4 -4
- package/lib/json-schema-form.component.d.ts +29 -31
- package/lib/json-schema-form.service.d.ts +28 -17
- package/lib/widget-library/add-reference.component.d.ts +4 -6
- package/lib/widget-library/button.component.d.ts +4 -6
- package/lib/widget-library/checkbox.component.d.ts +4 -6
- package/lib/widget-library/checkboxes.component.d.ts +5 -6
- package/lib/widget-library/file.component.d.ts +4 -6
- package/lib/widget-library/hidden.component.d.ts +4 -6
- package/lib/widget-library/index.d.ts +1 -21
- package/lib/widget-library/input.component.d.ts +4 -6
- package/lib/widget-library/message.component.d.ts +4 -6
- package/lib/widget-library/none.component.d.ts +4 -4
- package/lib/widget-library/number.component.d.ts +4 -6
- package/lib/widget-library/one-of.component.d.ts +4 -6
- package/lib/widget-library/orderable.directive.d.ts +6 -8
- package/lib/widget-library/radios.component.d.ts +4 -6
- package/lib/widget-library/root.component.d.ts +6 -8
- package/lib/widget-library/section.component.d.ts +4 -6
- package/lib/widget-library/select-framework.component.d.ts +6 -8
- package/lib/widget-library/select-widget.component.d.ts +6 -8
- package/lib/widget-library/select.component.d.ts +4 -6
- package/lib/widget-library/submit.component.d.ts +4 -6
- package/lib/widget-library/tab.component.d.ts +4 -6
- package/lib/widget-library/tabs.component.d.ts +4 -6
- package/lib/widget-library/template.component.d.ts +6 -8
- package/lib/widget-library/textarea.component.d.ts +4 -6
- package/package.json +1 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as i1 from '@angular/common';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import * as
|
|
3
|
+
import * as i2 from '@angular/forms';
|
|
4
4
|
import { UntypedFormControl, UntypedFormArray, UntypedFormGroup, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { Injectable,
|
|
6
|
+
import { Injectable, inject, input, ChangeDetectionStrategy, Component, ComponentFactoryResolver, viewChild, ViewContainerRef, ElementRef, NgZone, Directive, signal, Inject, forwardRef, ChangeDetectorRef, output, Input, NgModule } from '@angular/core';
|
|
7
7
|
import cloneDeep from 'lodash/cloneDeep';
|
|
8
8
|
import isEqual$1 from 'lodash/isEqual';
|
|
9
9
|
import { from, Observable, forkJoin, Subject, lastValueFrom } from 'rxjs';
|
|
10
10
|
import { map, takeUntil } from 'rxjs/operators';
|
|
11
|
+
import { HttpClient } from '@angular/common/http';
|
|
11
12
|
import Ajv2019 from 'ajv/dist/2019';
|
|
12
13
|
import jsonDraft6 from 'ajv/lib/refs/json-schema-draft-06.json';
|
|
13
14
|
import jsonDraft7 from 'ajv/lib/refs/json-schema-draft-07.json';
|
|
@@ -16,424 +17,6 @@ import map$1 from 'lodash/map';
|
|
|
16
17
|
import _isArray from 'lodash/isArray';
|
|
17
18
|
import _isPlainObject from 'lodash/isPlainObject';
|
|
18
19
|
import uniqueId from 'lodash/uniqueId';
|
|
19
|
-
import * as i1 from '@angular/common/http';
|
|
20
|
-
|
|
21
|
-
const deValidationMessages = {
|
|
22
|
-
required: 'Darf nicht leer sein',
|
|
23
|
-
minLength: 'Mindestens {{minimumLength}} Zeichen benötigt (aktuell: {{currentLength}})',
|
|
24
|
-
maxLength: 'Maximal {{maximumLength}} Zeichen erlaubt (aktuell: {{currentLength}})',
|
|
25
|
-
pattern: 'Entspricht nicht diesem regulären Ausdruck: {{requiredPattern}}',
|
|
26
|
-
format: function (error) {
|
|
27
|
-
switch (error.requiredFormat) {
|
|
28
|
-
case 'date':
|
|
29
|
-
return 'Muss ein Datum sein, z. B. "2000-12-31"';
|
|
30
|
-
case 'time':
|
|
31
|
-
return 'Muss eine Zeitangabe sein, z. B. "16:20" oder "03:14:15.9265"';
|
|
32
|
-
case 'date-time':
|
|
33
|
-
return 'Muss Datum mit Zeit beinhalten, z. B. "2000-03-14T01:59" oder "2000-03-14T01:59:26.535Z"';
|
|
34
|
-
case 'email':
|
|
35
|
-
return 'Keine gültige E-Mail-Adresse (z. B. "name@example.com")';
|
|
36
|
-
case 'hostname':
|
|
37
|
-
return 'Kein gültiger Hostname (z. B. "example.com")';
|
|
38
|
-
case 'ipv4':
|
|
39
|
-
return 'Keine gültige IPv4-Adresse (z. B. "127.0.0.1")';
|
|
40
|
-
case 'ipv6':
|
|
41
|
-
return 'Keine gültige IPv6-Adresse (z. B. "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0")';
|
|
42
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
43
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
44
|
-
case 'url':
|
|
45
|
-
return 'Keine gültige URL (z. B. "http://www.example.com/page.html")';
|
|
46
|
-
case 'uuid':
|
|
47
|
-
return 'Keine gültige UUID (z. B. "12345678-9ABC-DEF0-1234-56789ABCDEF0")';
|
|
48
|
-
case 'color':
|
|
49
|
-
return 'Kein gültiger Farbwert (z. B. "#FFFFFF" oder "rgb(255, 255, 255)")';
|
|
50
|
-
case 'json-pointer':
|
|
51
|
-
return 'Kein gültiger JSON-Pointer (z. B. "/pointer/to/something")';
|
|
52
|
-
case 'relative-json-pointer':
|
|
53
|
-
return 'Kein gültiger relativer JSON-Pointer (z. B. "2/pointer/to/something")';
|
|
54
|
-
case 'regex':
|
|
55
|
-
return 'Kein gültiger regulärer Ausdruck (z. B. "(1-)?\\d{3}-\\d{3}-\\d{4}")';
|
|
56
|
-
default:
|
|
57
|
-
return 'Muss diesem Format entsprechen: ' + error.requiredFormat;
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
minimum: 'Muss mindestens {{minimumValue}} sein',
|
|
61
|
-
exclusiveMinimum: 'Muss größer als {{exclusiveMinimumValue}} sein',
|
|
62
|
-
maximum: 'Darf maximal {{maximumValue}} sein',
|
|
63
|
-
exclusiveMaximum: 'Muss kleiner als {{exclusiveMaximumValue}} sein',
|
|
64
|
-
multipleOf: function (error) {
|
|
65
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
66
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
67
|
-
return `Maximal ${decimals} Dezimalstellen erlaubt`;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return `Muss ein Vielfaches von ${error.multipleOfValue} sein`;
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
minProperties: 'Mindestens {{minimumProperties}} Attribute erforderlich (aktuell: {{currentProperties}})',
|
|
74
|
-
maxProperties: 'Maximal {{maximumProperties}} Attribute erlaubt (aktuell: {{currentProperties}})',
|
|
75
|
-
minItems: 'Mindestens {{minimumItems}} Werte erforderlich (aktuell: {{currentItems}})',
|
|
76
|
-
maxItems: 'Maximal {{maximumItems}} Werte erlaubt (aktuell: {{currentItems}})',
|
|
77
|
-
uniqueItems: 'Alle Werte müssen eindeutig sein',
|
|
78
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const enValidationMessages = {
|
|
82
|
-
required: 'This field is required.',
|
|
83
|
-
minLength: 'Must be {{minimumLength}} characters or longer (current length: {{currentLength}})',
|
|
84
|
-
maxLength: 'Must be {{maximumLength}} characters or shorter (current length: {{currentLength}})',
|
|
85
|
-
pattern: 'Must match pattern: {{requiredPattern}}',
|
|
86
|
-
format: function (error) {
|
|
87
|
-
switch (error.requiredFormat) {
|
|
88
|
-
case 'date':
|
|
89
|
-
return 'Must be a date, like "2000-12-31"';
|
|
90
|
-
case 'time':
|
|
91
|
-
return 'Must be a time, like "16:20" or "03:14:15.9265"';
|
|
92
|
-
case 'date-time':
|
|
93
|
-
return 'Must be a date-time, like "2000-03-14T01:59" or "2000-03-14T01:59:26.535Z"';
|
|
94
|
-
case 'email':
|
|
95
|
-
return 'Must be an email address, like "name@example.com"';
|
|
96
|
-
case 'hostname':
|
|
97
|
-
return 'Must be a hostname, like "example.com"';
|
|
98
|
-
case 'ipv4':
|
|
99
|
-
return 'Must be an IPv4 address, like "127.0.0.1"';
|
|
100
|
-
case 'ipv6':
|
|
101
|
-
return 'Must be an IPv6 address, like "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
102
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
103
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
104
|
-
case 'url':
|
|
105
|
-
return 'Must be a url, like "http://www.example.com/page.html"';
|
|
106
|
-
case 'uuid':
|
|
107
|
-
return 'Must be a uuid, like "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
108
|
-
case 'color':
|
|
109
|
-
return 'Must be a color, like "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
110
|
-
case 'json-pointer':
|
|
111
|
-
return 'Must be a JSON Pointer, like "/pointer/to/something"';
|
|
112
|
-
case 'relative-json-pointer':
|
|
113
|
-
return 'Must be a relative JSON Pointer, like "2/pointer/to/something"';
|
|
114
|
-
case 'regex':
|
|
115
|
-
return 'Must be a regular expression, like "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
116
|
-
default:
|
|
117
|
-
return 'Must be a correctly formatted ' + error.requiredFormat;
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
minimum: 'Must be {{minimumValue}} or more',
|
|
121
|
-
exclusiveMinimum: 'Must be more than {{exclusiveMinimumValue}}',
|
|
122
|
-
maximum: 'Must be {{maximumValue}} or less',
|
|
123
|
-
exclusiveMaximum: 'Must be less than {{exclusiveMaximumValue}}',
|
|
124
|
-
multipleOf: function (error) {
|
|
125
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
126
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
127
|
-
return `Must have ${decimals} or fewer decimal places.`;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
return `Must be a multiple of ${error.multipleOfValue}.`;
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
minProperties: 'Must have {{minimumProperties}} or more items (current items: {{currentProperties}})',
|
|
134
|
-
maxProperties: 'Must have {{maximumProperties}} or fewer items (current items: {{currentProperties}})',
|
|
135
|
-
minItems: 'Must have {{minimumItems}} or more items (current items: {{currentItems}})',
|
|
136
|
-
maxItems: 'Must have {{maximumItems}} or fewer items (current items: {{currentItems}})',
|
|
137
|
-
uniqueItems: 'All items must be unique',
|
|
138
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const esValidationMessages = {
|
|
142
|
-
required: 'Este campo está requerido.',
|
|
143
|
-
minLength: 'Debe tener {{minimumLength}} caracteres o más longitud (longitud actual: {{currentLength}})',
|
|
144
|
-
maxLength: 'Debe tener {{maximumLength}} caracteres o menos longitud (longitud actual: {{currentLength}})',
|
|
145
|
-
pattern: 'Must match pattern: {{requiredPattern}}',
|
|
146
|
-
format: function (error) {
|
|
147
|
-
switch (error.requiredFormat) {
|
|
148
|
-
case 'date':
|
|
149
|
-
return 'Debe tener una fecha, ej "2000-12-31"';
|
|
150
|
-
case 'time':
|
|
151
|
-
return 'Debe tener una hora, ej "16:20" o "03:14:15.9265"';
|
|
152
|
-
case 'date-time':
|
|
153
|
-
return 'Debe tener fecha y hora, ej "2000-03-14T01:59" o "2000-03-14T01:59:26.535Z"';
|
|
154
|
-
case 'email':
|
|
155
|
-
return 'No hay dirección de correo electrónico válida, ej "name@example.com"';
|
|
156
|
-
case 'hostname':
|
|
157
|
-
return 'Debe ser un nombre de host válido, ej "example.com"';
|
|
158
|
-
case 'ipv4':
|
|
159
|
-
return 'Debe ser una dirección de IPv4, ej "127.0.0.1"';
|
|
160
|
-
case 'ipv6':
|
|
161
|
-
return 'Debe ser una dirección de IPv6, ej "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
162
|
-
case 'url':
|
|
163
|
-
return 'Debe ser una URL, ej "http://www.example.com/page.html"';
|
|
164
|
-
case 'uuid':
|
|
165
|
-
return 'Debe ser un UUID, ej "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
166
|
-
case 'color':
|
|
167
|
-
return 'Debe ser un color, ej "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
168
|
-
case 'json-pointer':
|
|
169
|
-
return 'Debe ser un JSON Pointer, ej "/pointer/to/something"';
|
|
170
|
-
case 'relative-json-pointer':
|
|
171
|
-
return 'Debe ser un JSON Pointer relativo, ej "2/pointer/to/something"';
|
|
172
|
-
case 'regex':
|
|
173
|
-
return 'Debe ser una expresión regular, ej "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
174
|
-
default:
|
|
175
|
-
return 'Debe tener el formato correcto ' + error.requiredFormat;
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
minimum: 'Debe ser {{minimumValue}} o más',
|
|
179
|
-
exclusiveMinimum: 'Debe ser superior a {{exclusiveMinimumValue}}',
|
|
180
|
-
maximum: 'Debe ser {{maximumValue}} o menos',
|
|
181
|
-
exclusiveMaximum: 'Debe ser menor que {{exclusiveMaximumValue}}',
|
|
182
|
-
multipleOf: function (error) {
|
|
183
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
184
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
185
|
-
return `Se permite un máximo de ${decimals} decimales`;
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
return `Debe ser múltiplo de ${error.multipleOfValue}.`;
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
minProperties: 'Debe tener {{minimumProperties}} o más elementos (elementos actuales: {{currentProperties}})',
|
|
192
|
-
maxProperties: 'Debe tener {{maximumProperties}} o menos elementos (elementos actuales: {{currentProperties}})',
|
|
193
|
-
minItems: 'Debe tener {{minimumItems}} o más elementos (elementos actuales: {{currentItems}})',
|
|
194
|
-
maxItems: 'Debe tener {{maximumItems}} o menos elementos (elementos actuales: {{currentItems}})',
|
|
195
|
-
uniqueItems: 'Todos los elementos deben ser únicos',
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const frValidationMessages = {
|
|
199
|
-
required: 'Est obligatoire.',
|
|
200
|
-
minLength: 'Doit avoir minimum {{minimumLength}} caractères (actuellement: {{currentLength}})',
|
|
201
|
-
maxLength: 'Doit avoir maximum {{maximumLength}} caractères (actuellement: {{currentLength}})',
|
|
202
|
-
pattern: 'Doit respecter: {{requiredPattern}}',
|
|
203
|
-
format: function (error) {
|
|
204
|
-
switch (error.requiredFormat) {
|
|
205
|
-
case 'date':
|
|
206
|
-
return 'Doit être une date, tel que "2000-12-31"';
|
|
207
|
-
case 'time':
|
|
208
|
-
return 'Doit être une heure, tel que "16:20" ou "03:14:15.9265"';
|
|
209
|
-
case 'date-time':
|
|
210
|
-
return 'Doit être une date et une heure, tel que "2000-03-14T01:59" ou "2000-03-14T01:59:26.535Z"';
|
|
211
|
-
case 'email':
|
|
212
|
-
return 'Doit être une adresse e-mail, tel que "name@example.com"';
|
|
213
|
-
case 'hostname':
|
|
214
|
-
return 'Doit être un nom de domaine, tel que "example.com"';
|
|
215
|
-
case 'ipv4':
|
|
216
|
-
return 'Doit être une adresse IPv4, tel que "127.0.0.1"';
|
|
217
|
-
case 'ipv6':
|
|
218
|
-
return 'Doit être une adresse IPv6, tel que "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
219
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
220
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
221
|
-
case 'url':
|
|
222
|
-
return 'Doit être une URL, tel que "http://www.example.com/page.html"';
|
|
223
|
-
case 'uuid':
|
|
224
|
-
return 'Doit être un UUID, tel que "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
225
|
-
case 'color':
|
|
226
|
-
return 'Doit être une couleur, tel que "#FFFFFF" or "rgb(255, 255, 255)"';
|
|
227
|
-
case 'json-pointer':
|
|
228
|
-
return 'Doit être un JSON Pointer, tel que "/pointer/to/something"';
|
|
229
|
-
case 'relative-json-pointer':
|
|
230
|
-
return 'Doit être un relative JSON Pointer, tel que "2/pointer/to/something"';
|
|
231
|
-
case 'regex':
|
|
232
|
-
return 'Doit être une expression régulière, tel que "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
233
|
-
default:
|
|
234
|
-
return 'Doit être avoir le format correct: ' + error.requiredFormat;
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
minimum: 'Doit être supérieur à {{minimumValue}}',
|
|
238
|
-
exclusiveMinimum: 'Doit avoir minimum {{exclusiveMinimumValue}} charactères',
|
|
239
|
-
maximum: 'Doit être inférieur à {{maximumValue}}',
|
|
240
|
-
exclusiveMaximum: 'Doit avoir maximum {{exclusiveMaximumValue}} charactères',
|
|
241
|
-
multipleOf: function (error) {
|
|
242
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
243
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
244
|
-
return `Doit comporter ${decimals} ou moins de decimales.`;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
return `Doit être un multiple de ${error.multipleOfValue}.`;
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
minProperties: 'Doit comporter au minimum {{minimumProperties}} éléments',
|
|
251
|
-
maxProperties: 'Doit comporter au maximum {{maximumProperties}} éléments',
|
|
252
|
-
minItems: 'Doit comporter au minimum {{minimumItems}} éléments',
|
|
253
|
-
maxItems: 'Doit comporter au maximum {{minimumItems}} éléments',
|
|
254
|
-
uniqueItems: 'Tous les éléments doivent être uniques',
|
|
255
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
const itValidationMessages = {
|
|
259
|
-
required: 'Il campo è obbligatorio',
|
|
260
|
-
minLength: 'Deve inserire almeno {{minimumLength}} caratteri (lunghezza corrente: {{currentLength}})',
|
|
261
|
-
maxLength: 'Il numero massimo di caratteri consentito è {{maximumLength}} (lunghezza corrente: {{currentLength}})',
|
|
262
|
-
pattern: 'Devi rispettare il pattern : {{requiredPattern}}',
|
|
263
|
-
format: function (error) {
|
|
264
|
-
switch (error.requiredFormat) {
|
|
265
|
-
case 'date':
|
|
266
|
-
return 'Deve essere una data, come "31-12-2000"';
|
|
267
|
-
case 'time':
|
|
268
|
-
return 'Deve essere un orario, come "16:20" o "03:14:15.9265"';
|
|
269
|
-
case 'date-time':
|
|
270
|
-
return 'Deve essere data-orario, come "14-03-2000T01:59" or "14-03-2000T01:59:26.535Z"';
|
|
271
|
-
case 'email':
|
|
272
|
-
return 'Deve essere un indirzzo email, come "name@example.com"';
|
|
273
|
-
case 'hostname':
|
|
274
|
-
return 'Deve essere un hostname, come "example.com"';
|
|
275
|
-
case 'ipv4':
|
|
276
|
-
return 'Deve essere un indirizzo IPv4, come "127.0.0.1"';
|
|
277
|
-
case 'ipv6':
|
|
278
|
-
return 'Deve essere un indirizzo IPv6, come "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
279
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
280
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
281
|
-
case 'url':
|
|
282
|
-
return 'Deve essere un url, come "http://www.example.com/page.html"';
|
|
283
|
-
case 'uuid':
|
|
284
|
-
return 'Deve essere un uuid, come "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
285
|
-
case 'color':
|
|
286
|
-
return 'Deve essere un colore, come "#FFFFFF" o "rgb(255, 255, 255)"';
|
|
287
|
-
case 'json-pointer':
|
|
288
|
-
return 'Deve essere un JSON Pointer, come "/pointer/to/something"';
|
|
289
|
-
case 'relative-json-pointer':
|
|
290
|
-
return 'Deve essere un JSON Pointer relativo, come "2/pointer/to/something"';
|
|
291
|
-
case 'regex':
|
|
292
|
-
return 'Deve essere una regular expression, come "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
293
|
-
default:
|
|
294
|
-
return 'Deve essere formattato correttamente ' + error.requiredFormat;
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
minimum: 'Deve essere {{minimumValue}} o più',
|
|
298
|
-
exclusiveMinimum: 'Deve essere più di {{exclusiveMinimumValue}}',
|
|
299
|
-
maximum: 'Deve essere {{maximumValue}} o meno',
|
|
300
|
-
exclusiveMaximum: 'Deve essere minore di {{exclusiveMaximumValue}}',
|
|
301
|
-
multipleOf: function (error) {
|
|
302
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
303
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
304
|
-
return `Deve avere ${decimals} o meno decimali.`;
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
return `Deve essere multiplo di ${error.multipleOfValue}.`;
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
minProperties: 'Deve avere {{minimumProperties}} o più elementi (elementi correnti: {{currentProperties}})',
|
|
311
|
-
maxProperties: 'Deve avere {{maximumProperties}} o meno elementi (elementi correnti: {{currentProperties}})',
|
|
312
|
-
minItems: 'Deve avere {{minimumItems}} o più elementi (elementi correnti: {{currentItems}})',
|
|
313
|
-
maxItems: 'Deve avere {{maximumItems}} o meno elementi (elementi correnti: {{currentItems}})',
|
|
314
|
-
uniqueItems: 'Tutti gli elementi devono essere unici',
|
|
315
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
const ptValidationMessages = {
|
|
319
|
-
required: 'Este campo é obrigatório.',
|
|
320
|
-
minLength: 'É preciso no mínimo {{minimumLength}} caracteres ou mais (tamanho atual: {{currentLength}})',
|
|
321
|
-
maxLength: 'É preciso no máximo {{maximumLength}} caracteres ou menos (tamanho atual: {{currentLength}})',
|
|
322
|
-
pattern: 'Tem que ajustar ao formato: {{requiredPattern}}',
|
|
323
|
-
format: function (error) {
|
|
324
|
-
switch (error.requiredFormat) {
|
|
325
|
-
case 'date':
|
|
326
|
-
return 'Tem que ser uma data, por exemplo "2000-12-31"';
|
|
327
|
-
case 'time':
|
|
328
|
-
return 'Tem que ser horário, por exemplo "16:20" ou "03:14:15.9265"';
|
|
329
|
-
case 'date-time':
|
|
330
|
-
return 'Tem que ser data e hora, por exemplo "2000-03-14T01:59" ou "2000-03-14T01:59:26.535Z"';
|
|
331
|
-
case 'email':
|
|
332
|
-
return 'Tem que ser um email, por exemplo "fulano@exemplo.com.br"';
|
|
333
|
-
case 'hostname':
|
|
334
|
-
return 'Tem que ser uma nome de domínio, por exemplo "exemplo.com.br"';
|
|
335
|
-
case 'ipv4':
|
|
336
|
-
return 'Tem que ser um endereço IPv4, por exemplo "127.0.0.1"';
|
|
337
|
-
case 'ipv6':
|
|
338
|
-
return 'Tem que ser um endereço IPv6, por exemplo "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
339
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
340
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
341
|
-
case 'url':
|
|
342
|
-
return 'Tem que ser uma URL, por exemplo "http://www.exemplo.com.br/pagina.html"';
|
|
343
|
-
case 'uuid':
|
|
344
|
-
return 'Tem que ser um uuid, por exemplo "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
345
|
-
case 'color':
|
|
346
|
-
return 'Tem que ser uma cor, por exemplo "#FFFFFF" ou "rgb(255, 255, 255)"';
|
|
347
|
-
case 'json-pointer':
|
|
348
|
-
return 'Tem que ser um JSON Pointer, por exemplo "/referencia/para/algo"';
|
|
349
|
-
case 'relative-json-pointer':
|
|
350
|
-
return 'Tem que ser um JSON Pointer relativo, por exemplo "2/referencia/para/algo"';
|
|
351
|
-
case 'regex':
|
|
352
|
-
return 'Tem que ser uma expressão regular, por exemplo "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
353
|
-
default:
|
|
354
|
-
return 'Tem que ser no formato: ' + error.requiredFormat;
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
minimum: 'Tem que ser {{minimumValue}} ou mais',
|
|
358
|
-
exclusiveMinimum: 'Tem que ser mais que {{exclusiveMinimumValue}}',
|
|
359
|
-
maximum: 'Tem que ser {{maximumValue}} ou menos',
|
|
360
|
-
exclusiveMaximum: 'Tem que ser menor que {{exclusiveMaximumValue}}',
|
|
361
|
-
multipleOf: function (error) {
|
|
362
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
363
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
364
|
-
return `Tem que ter ${decimals} ou menos casas decimais.`;
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
return `Tem que ser um múltiplo de ${error.multipleOfValue}.`;
|
|
368
|
-
}
|
|
369
|
-
},
|
|
370
|
-
minProperties: 'Deve ter {{minimumProperties}} ou mais itens (itens até o momento: {{currentProperties}})',
|
|
371
|
-
maxProperties: 'Deve ter {{maximumProperties}} ou menos intens (itens até o momento: {{currentProperties}})',
|
|
372
|
-
minItems: 'Deve ter {{minimumItems}} ou mais itens (itens até o momento: {{currentItems}})',
|
|
373
|
-
maxItems: 'Deve ter {{maximumItems}} ou menos itens (itens até o momento: {{currentItems}})',
|
|
374
|
-
uniqueItems: 'Todos os itens devem ser únicos',
|
|
375
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
const zhValidationMessages = {
|
|
379
|
-
required: '必填字段.',
|
|
380
|
-
minLength: '字符长度必须大于或者等于 {{minimumLength}} (当前长度: {{currentLength}})',
|
|
381
|
-
maxLength: '字符长度必须小于或者等于 {{maximumLength}} (当前长度: {{currentLength}})',
|
|
382
|
-
pattern: '必须匹配正则表达式: {{requiredPattern}}',
|
|
383
|
-
format: function (error) {
|
|
384
|
-
switch (error.requiredFormat) {
|
|
385
|
-
case 'date':
|
|
386
|
-
return '必须为日期格式, 比如 "2000-12-31"';
|
|
387
|
-
case 'time':
|
|
388
|
-
return '必须为时间格式, 比如 "16:20" 或者 "03:14:15.9265"';
|
|
389
|
-
case 'date-time':
|
|
390
|
-
return '必须为日期时间格式, 比如 "2000-03-14T01:59" 或者 "2000-03-14T01:59:26.535Z"';
|
|
391
|
-
case 'email':
|
|
392
|
-
return '必须为邮箱地址, 比如 "name@example.com"';
|
|
393
|
-
case 'hostname':
|
|
394
|
-
return '必须为主机名, 比如 "example.com"';
|
|
395
|
-
case 'ipv4':
|
|
396
|
-
return '必须为 IPv4 地址, 比如 "127.0.0.1"';
|
|
397
|
-
case 'ipv6':
|
|
398
|
-
return '必须为 IPv6 地址, 比如 "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
399
|
-
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
400
|
-
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
401
|
-
case 'url':
|
|
402
|
-
return '必须为 url, 比如 "http://www.example.com/page.html"';
|
|
403
|
-
case 'uuid':
|
|
404
|
-
return '必须为 uuid, 比如 "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
405
|
-
case 'color':
|
|
406
|
-
return '必须为颜色值, 比如 "#FFFFFF" 或者 "rgb(255, 255, 255)"';
|
|
407
|
-
case 'json-pointer':
|
|
408
|
-
return '必须为 JSON Pointer, 比如 "/pointer/to/something"';
|
|
409
|
-
case 'relative-json-pointer':
|
|
410
|
-
return '必须为相对的 JSON Pointer, 比如 "2/pointer/to/something"';
|
|
411
|
-
case 'regex':
|
|
412
|
-
return '必须为正则表达式, 比如 "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
413
|
-
default:
|
|
414
|
-
return '必须为格式正确的 ' + error.requiredFormat;
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
minimum: '必须大于或者等于最小值: {{minimumValue}}',
|
|
418
|
-
exclusiveMinimum: '必须大于最小值: {{exclusiveMinimumValue}}',
|
|
419
|
-
maximum: '必须小于或者等于最大值: {{maximumValue}}',
|
|
420
|
-
exclusiveMaximum: '必须小于最大值: {{exclusiveMaximumValue}}',
|
|
421
|
-
multipleOf: function (error) {
|
|
422
|
-
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
423
|
-
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
424
|
-
return `必须有 ${decimals} 位或更少的小数位`;
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
return `必须为 ${error.multipleOfValue} 的倍数`;
|
|
428
|
-
}
|
|
429
|
-
},
|
|
430
|
-
minProperties: '项目数必须大于或者等于 {{minimumProperties}} (当前项目数: {{currentProperties}})',
|
|
431
|
-
maxProperties: '项目数必须小于或者等于 {{maximumProperties}} (当前项目数: {{currentProperties}})',
|
|
432
|
-
minItems: '项目数必须大于或者等于 {{minimumItems}} (当前项目数: {{currentItems}})',
|
|
433
|
-
maxItems: '项目数必须小于或者等于 {{maximumItems}} (当前项目数: {{currentItems}})',
|
|
434
|
-
uniqueItems: '所有项目必须是唯一的',
|
|
435
|
-
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
436
|
-
};
|
|
437
20
|
|
|
438
21
|
/**
|
|
439
22
|
* '_executeValidators' utility function
|
|
@@ -873,529 +456,946 @@ function toJavaScriptType(value, types, strictIntegers = true) {
|
|
|
873
456
|
* // { SchemaPrimitiveType | SchemaPrimitiveType[] } types - allowed types to convert to
|
|
874
457
|
* // { PrimitiveValue }
|
|
875
458
|
*/
|
|
876
|
-
function toSchemaType(value, types) {
|
|
877
|
-
if (!isArray(types)) {
|
|
878
|
-
types = [types];
|
|
879
|
-
}
|
|
880
|
-
if (types.includes('null') && !hasValue(value)) {
|
|
881
|
-
return null;
|
|
882
|
-
}
|
|
883
|
-
if (types.includes('boolean') && !isBoolean(value, 'strict')) {
|
|
884
|
-
return value;
|
|
885
|
-
}
|
|
886
|
-
if (types.includes('integer')) {
|
|
887
|
-
const testValue = toJavaScriptType(value, 'integer');
|
|
888
|
-
if (testValue !== null) {
|
|
889
|
-
return +testValue;
|
|
890
|
-
}
|
|
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;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
if (types.includes('number')) {
|
|
476
|
+
const testValue = toJavaScriptType(value, 'number');
|
|
477
|
+
if (testValue !== null) {
|
|
478
|
+
return +testValue;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
if ((isString(value) || isNumber(value, 'strict')) &&
|
|
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 '';
|
|
491
|
+
}
|
|
492
|
+
const testValue = toJavaScriptType(value, 'string');
|
|
493
|
+
if (testValue !== null) {
|
|
494
|
+
return testValue;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if ((types.includes('number') ||
|
|
498
|
+
types.includes('integer'))) {
|
|
499
|
+
if (value === true) {
|
|
500
|
+
return 1;
|
|
501
|
+
} // Convert boolean & null to number
|
|
502
|
+
if (value === false || value === null || value === '') {
|
|
503
|
+
return 0;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
if (types.includes('number')) { // Convert mixed string to number
|
|
507
|
+
const testValue = parseFloat(value);
|
|
508
|
+
if (!!testValue) {
|
|
509
|
+
return testValue;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (types.includes('integer')) { // Convert string or number to integer
|
|
513
|
+
const testValue = parseInt(value, 10);
|
|
514
|
+
if (!!testValue) {
|
|
515
|
+
return testValue;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (types.includes('boolean')) { // Convert anything to boolean
|
|
519
|
+
return !!value;
|
|
520
|
+
}
|
|
521
|
+
if ((types.includes('number') ||
|
|
522
|
+
types.includes('integer')) && !types.includes('null')) {
|
|
523
|
+
return 0; // If null not allowed, return 0 for non-convertable values
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* 'isPromise' function
|
|
528
|
+
*
|
|
529
|
+
* // object
|
|
530
|
+
* // { boolean }
|
|
531
|
+
*/
|
|
532
|
+
function isPromise(object) {
|
|
533
|
+
return !!object && typeof object.then === 'function';
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* 'isObservable' function
|
|
537
|
+
*
|
|
538
|
+
* // object
|
|
539
|
+
* // { boolean }
|
|
540
|
+
*/
|
|
541
|
+
function isObservable(object) {
|
|
542
|
+
return !!object && typeof object.subscribe === 'function';
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* '_toPromise' function
|
|
546
|
+
*
|
|
547
|
+
* // { object } object
|
|
548
|
+
* // { Promise<any> }
|
|
549
|
+
*/
|
|
550
|
+
function _toPromise(object) {
|
|
551
|
+
return isPromise(object) ? object : object.toPromise();
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* 'toObservable' function
|
|
555
|
+
*
|
|
556
|
+
* // { object } object
|
|
557
|
+
* // { Observable<any> }
|
|
558
|
+
*/
|
|
559
|
+
function toObservable(object) {
|
|
560
|
+
const observable = isPromise(object) ? from(object) : object;
|
|
561
|
+
if (isObservable(observable)) {
|
|
562
|
+
return observable;
|
|
563
|
+
}
|
|
564
|
+
console.error('toObservable error: Expected validator to return Promise or Observable.');
|
|
565
|
+
return new Observable();
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* 'inArray' function
|
|
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.
|
|
572
|
+
*
|
|
573
|
+
* If the optional third parameter allIn is set to TRUE, and the item to find
|
|
574
|
+
* is an array, then the function returns true only if all elements from item
|
|
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.
|
|
577
|
+
*
|
|
578
|
+
* // { any|any[] } item - the item to search for
|
|
579
|
+
* // array - the array to search
|
|
580
|
+
* // { boolean = false } allIn - if TRUE, all items must be in array
|
|
581
|
+
* // { boolean } - true if item(s) in array, false otherwise
|
|
582
|
+
*/
|
|
583
|
+
function inArray(item, array, allIn = false) {
|
|
584
|
+
if (!isDefined(item) || !isArray(array)) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
return isArray(item) ?
|
|
588
|
+
item[allIn ? 'every' : 'some'](subItem => array.includes(subItem)) :
|
|
589
|
+
array.includes(item);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* 'xor' utility function - exclusive or
|
|
593
|
+
*
|
|
594
|
+
* Returns true if exactly one of two values is truthy.
|
|
595
|
+
*
|
|
596
|
+
* // value1 - first value to check
|
|
597
|
+
* // value2 - second value to check
|
|
598
|
+
* // { boolean } - true if exactly one input value is truthy, false if not
|
|
599
|
+
*/
|
|
600
|
+
function xor(value1, value2) {
|
|
601
|
+
return (!!value1 && !value2) || (!value1 && !!value2);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Utility function library:
|
|
606
|
+
*
|
|
607
|
+
* addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject,
|
|
608
|
+
* uniqueItems, commonItems, fixTitle, toTitleCase
|
|
609
|
+
*/
|
|
610
|
+
/**
|
|
611
|
+
* 'addClasses' function
|
|
612
|
+
*
|
|
613
|
+
* Merges two space-delimited lists of CSS classes and removes duplicates.
|
|
614
|
+
*
|
|
615
|
+
* // {string | string[] | Set<string>} oldClasses
|
|
616
|
+
* // {string | string[] | Set<string>} newClasses
|
|
617
|
+
* // {string | string[] | Set<string>} - Combined classes
|
|
618
|
+
*/
|
|
619
|
+
function addClasses(oldClasses, newClasses) {
|
|
620
|
+
const badType = i => !isSet(i) && !isArray(i) && !isString(i);
|
|
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(' ');
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* 'copy' function
|
|
641
|
+
*
|
|
642
|
+
* Makes a shallow copy of a JavaScript object, array, Map, or Set.
|
|
643
|
+
* If passed a JavaScript primitive value (string, number, boolean, or null),
|
|
644
|
+
* it returns the value.
|
|
645
|
+
*
|
|
646
|
+
* // {Object|Array|string|number|boolean|null} object - The object to copy
|
|
647
|
+
* // {boolean = false} errors - Show errors?
|
|
648
|
+
* // {Object|Array|string|number|boolean|null} - The copied object
|
|
649
|
+
*/
|
|
650
|
+
function copy(object, errors = false) {
|
|
651
|
+
if (typeof object !== 'object' || object === null) {
|
|
652
|
+
return object;
|
|
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 };
|
|
665
|
+
}
|
|
666
|
+
if (errors) {
|
|
667
|
+
console.error('copy error: Object to copy must be a JavaScript object or value.');
|
|
668
|
+
}
|
|
669
|
+
return object;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* 'forEach' function
|
|
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
|
|
682
|
+
*
|
|
683
|
+
* Setting the optional third parameter to 'top-down' or 'bottom-up' will cause
|
|
684
|
+
* it to also recursively iterate over items in sub-objects or sub-arrays in the
|
|
685
|
+
* specified direction.
|
|
686
|
+
*
|
|
687
|
+
* // {Object|Array} object - The object or array to iterate over
|
|
688
|
+
* // {function} fn - the iterator funciton to call on each item
|
|
689
|
+
* // {boolean = false} errors - Show errors?
|
|
690
|
+
* // {void}
|
|
691
|
+
*/
|
|
692
|
+
function forEach(object, fn, recurse = false, rootObject = object, errors = false) {
|
|
693
|
+
if (isEmpty(object)) {
|
|
694
|
+
return;
|
|
891
695
|
}
|
|
892
|
-
if (
|
|
893
|
-
const
|
|
894
|
-
|
|
895
|
-
|
|
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
|
+
}
|
|
896
706
|
}
|
|
897
707
|
}
|
|
898
|
-
if (
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
if (types.includes('boolean') && isBoolean(value)) {
|
|
903
|
-
return toJavaScriptType(value, 'boolean');
|
|
904
|
-
}
|
|
905
|
-
if (types.includes('string')) { // Convert null & boolean to string
|
|
906
|
-
if (value === null) {
|
|
907
|
-
return '';
|
|
708
|
+
if (errors) {
|
|
709
|
+
if (typeof fn !== 'function') {
|
|
710
|
+
console.error('forEach error: Iterator must be a function.');
|
|
711
|
+
console.error('function', fn);
|
|
908
712
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
713
|
+
if (!isObject(object) && !isArray(object)) {
|
|
714
|
+
console.error('forEach error: Input object must be an object or array.');
|
|
715
|
+
console.error('object', object);
|
|
912
716
|
}
|
|
913
717
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* 'forEachCopy' function
|
|
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.
|
|
726
|
+
*
|
|
727
|
+
* Does NOT recursively iterate over items in sub-objects or sub-arrays.
|
|
728
|
+
*
|
|
729
|
+
* // {Object | Array} object - The object or array to iterate over
|
|
730
|
+
* // {function} fn - The iterator funciton to call on each item
|
|
731
|
+
* // {boolean = false} errors - Show errors?
|
|
732
|
+
* // {Object | Array} - The resulting object or array
|
|
733
|
+
*/
|
|
734
|
+
function forEachCopy(object, fn, errors = false) {
|
|
735
|
+
if (!hasValue(object)) {
|
|
736
|
+
return;
|
|
922
737
|
}
|
|
923
|
-
if (
|
|
924
|
-
const
|
|
925
|
-
|
|
926
|
-
|
|
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);
|
|
927
742
|
}
|
|
743
|
+
return newObject;
|
|
928
744
|
}
|
|
929
|
-
if (
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
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);
|
|
933
753
|
}
|
|
934
|
-
}
|
|
935
|
-
if (types.includes('boolean')) { // Convert anything to boolean
|
|
936
|
-
return !!value;
|
|
937
|
-
}
|
|
938
|
-
if ((types.includes('number') ||
|
|
939
|
-
types.includes('integer')) && !types.includes('null')) {
|
|
940
|
-
return 0; // If null not allowed, return 0 for non-convertable values
|
|
941
754
|
}
|
|
942
755
|
}
|
|
943
756
|
/**
|
|
944
|
-
* '
|
|
757
|
+
* 'hasOwn' utility function
|
|
945
758
|
*
|
|
946
|
-
*
|
|
947
|
-
*
|
|
759
|
+
* Checks whether an object or array has a particular property.
|
|
760
|
+
*
|
|
761
|
+
* // {any} object - the object to check
|
|
762
|
+
* // {string} property - the property to look for
|
|
763
|
+
* // {boolean} - true if object has property, false if not
|
|
948
764
|
*/
|
|
949
|
-
function
|
|
950
|
-
|
|
765
|
+
function hasOwn(object, property) {
|
|
766
|
+
if (!object || !['number', 'string', 'symbol'].includes(typeof property) ||
|
|
767
|
+
(!isObject(object) && !isArray(object) && !isMap(object) && !isSet(object))) {
|
|
768
|
+
return false;
|
|
769
|
+
}
|
|
770
|
+
if (isMap(object) || isSet(object)) {
|
|
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);
|
|
951
780
|
}
|
|
952
781
|
/**
|
|
953
|
-
*
|
|
954
|
-
*
|
|
955
|
-
* // object
|
|
956
|
-
* // { boolean }
|
|
782
|
+
* Types of possible expressions which the app is able to evaluate.
|
|
957
783
|
*/
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
784
|
+
var ExpressionType;
|
|
785
|
+
(function (ExpressionType) {
|
|
786
|
+
ExpressionType[ExpressionType["EQUALS"] = 0] = "EQUALS";
|
|
787
|
+
ExpressionType[ExpressionType["NOT_EQUALS"] = 1] = "NOT_EQUALS";
|
|
788
|
+
ExpressionType[ExpressionType["NOT_AN_EXPRESSION"] = 2] = "NOT_AN_EXPRESSION";
|
|
789
|
+
})(ExpressionType || (ExpressionType = {}));
|
|
961
790
|
/**
|
|
962
|
-
*
|
|
963
|
-
*
|
|
964
|
-
*
|
|
965
|
-
* // {
|
|
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
|
|
966
795
|
*/
|
|
967
|
-
function
|
|
968
|
-
|
|
796
|
+
function getExpressionType(expressionCandidate) {
|
|
797
|
+
if (expressionCandidate.indexOf('==') !== -1) {
|
|
798
|
+
return ExpressionType.EQUALS;
|
|
799
|
+
}
|
|
800
|
+
if (expressionCandidate.toString().indexOf('!=') !== -1) {
|
|
801
|
+
return ExpressionType.NOT_EQUALS;
|
|
802
|
+
}
|
|
803
|
+
return ExpressionType.NOT_AN_EXPRESSION;
|
|
804
|
+
}
|
|
805
|
+
function isEqual(expressionType) {
|
|
806
|
+
return expressionType === ExpressionType.EQUALS;
|
|
807
|
+
}
|
|
808
|
+
function isNotEqual(expressionType) {
|
|
809
|
+
return expressionType === ExpressionType.NOT_EQUALS;
|
|
810
|
+
}
|
|
811
|
+
function isNotExpression(expressionType) {
|
|
812
|
+
return expressionType === ExpressionType.NOT_AN_EXPRESSION;
|
|
969
813
|
}
|
|
970
814
|
/**
|
|
971
|
-
*
|
|
972
|
-
*
|
|
973
|
-
* //
|
|
974
|
-
* // {
|
|
815
|
+
* Splits the expression key by the expressionType on a pair of values
|
|
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
|
|
975
819
|
*/
|
|
976
|
-
function
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
return observable;
|
|
820
|
+
function getKeyAndValueByExpressionType(expressionType, key) {
|
|
821
|
+
if (isEqual(expressionType)) {
|
|
822
|
+
return key.split('==', 2);
|
|
980
823
|
}
|
|
981
|
-
|
|
982
|
-
|
|
824
|
+
if (isNotEqual(expressionType)) {
|
|
825
|
+
return key.split('!=', 2);
|
|
826
|
+
}
|
|
827
|
+
return null;
|
|
828
|
+
}
|
|
829
|
+
function cleanValueOfQuotes(keyAndValue) {
|
|
830
|
+
if (keyAndValue.charAt(0) === '\'' && keyAndValue.charAt(keyAndValue.length - 1) === '\'') {
|
|
831
|
+
return keyAndValue.replace('\'', '').replace('\'', '');
|
|
832
|
+
}
|
|
833
|
+
return keyAndValue;
|
|
983
834
|
}
|
|
984
835
|
/**
|
|
985
|
-
* '
|
|
836
|
+
* 'mergeFilteredObject' utility function
|
|
986
837
|
*
|
|
987
|
-
*
|
|
988
|
-
*
|
|
838
|
+
* Shallowly merges two objects, setting key and values from source object
|
|
839
|
+
* in target object, excluding specified keys.
|
|
989
840
|
*
|
|
990
|
-
*
|
|
991
|
-
*
|
|
992
|
-
* are found in the array list, and false if any element is not found. If the
|
|
993
|
-
* item to find is not an array, setting allIn to TRUE has no effect.
|
|
841
|
+
* Optionally, it can also use functions to transform the key names and/or
|
|
842
|
+
* the values of the merging object.
|
|
994
843
|
*
|
|
995
|
-
* //
|
|
996
|
-
* //
|
|
997
|
-
* //
|
|
998
|
-
* // {
|
|
844
|
+
* // {PlainObject} targetObject - Target object to add keys and values to
|
|
845
|
+
* // {PlainObject} sourceObject - Source object to copy keys and values from
|
|
846
|
+
* // {string[]} excludeKeys - Array of keys to exclude
|
|
847
|
+
* // {(string: string) => string = (k) => k} keyFn - Function to apply to keys
|
|
848
|
+
* // {(any: any) => any = (v) => v} valueFn - Function to apply to values
|
|
849
|
+
* // {PlainObject} - Returns targetObject
|
|
999
850
|
*/
|
|
1000
|
-
function
|
|
1001
|
-
if (!
|
|
1002
|
-
return
|
|
851
|
+
function mergeFilteredObject(targetObject, sourceObject, excludeKeys = [], keyFn = (key) => key, valFn = (val) => val) {
|
|
852
|
+
if (!isObject(sourceObject)) {
|
|
853
|
+
return targetObject;
|
|
1003
854
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
855
|
+
if (!isObject(targetObject)) {
|
|
856
|
+
targetObject = {};
|
|
857
|
+
}
|
|
858
|
+
for (const key of Object.keys(sourceObject)) {
|
|
859
|
+
if (!inArray(key, excludeKeys) && isDefined(sourceObject[key])) {
|
|
860
|
+
targetObject[keyFn(key)] = valFn(sourceObject[key]);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
return targetObject;
|
|
1007
864
|
}
|
|
1008
865
|
/**
|
|
1009
|
-
* '
|
|
866
|
+
* 'uniqueItems' function
|
|
1010
867
|
*
|
|
1011
|
-
*
|
|
868
|
+
* Accepts any number of string value inputs,
|
|
869
|
+
* and returns an array of all input vaues, excluding duplicates.
|
|
1012
870
|
*
|
|
1013
|
-
* //
|
|
1014
|
-
* //
|
|
1015
|
-
* // { boolean } - true if exactly one input value is truthy, false if not
|
|
871
|
+
* // {...string} ...items -
|
|
872
|
+
* // {string[]} -
|
|
1016
873
|
*/
|
|
1017
|
-
function
|
|
1018
|
-
|
|
874
|
+
function uniqueItems(...items) {
|
|
875
|
+
const returnItems = [];
|
|
876
|
+
for (const item of items) {
|
|
877
|
+
if (!returnItems.includes(item)) {
|
|
878
|
+
returnItems.push(item);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
return returnItems;
|
|
1019
882
|
}
|
|
1020
|
-
|
|
1021
|
-
/**
|
|
1022
|
-
* Utility function library:
|
|
1023
|
-
*
|
|
1024
|
-
* addClasses, copy, forEach, forEachCopy, hasOwn, mergeFilteredObject,
|
|
1025
|
-
* uniqueItems, commonItems, fixTitle, toTitleCase
|
|
1026
|
-
*/
|
|
1027
883
|
/**
|
|
1028
|
-
* '
|
|
884
|
+
* 'commonItems' function
|
|
1029
885
|
*
|
|
1030
|
-
*
|
|
886
|
+
* Accepts any number of strings or arrays of string values,
|
|
887
|
+
* and returns a single array containing only values present in all inputs.
|
|
1031
888
|
*
|
|
1032
|
-
* // {string
|
|
1033
|
-
* // {string
|
|
1034
|
-
* // {string | string[] | Set<string>} - Combined classes
|
|
889
|
+
* // {...string|string[]} ...arrays -
|
|
890
|
+
* // {string[]} -
|
|
1035
891
|
*/
|
|
1036
|
-
function
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
newSet.forEach(c => combinedSet.add(c));
|
|
1048
|
-
if (isSet(oldClasses)) {
|
|
1049
|
-
return combinedSet;
|
|
1050
|
-
}
|
|
1051
|
-
if (isArray(oldClasses)) {
|
|
1052
|
-
return Array.from(combinedSet);
|
|
892
|
+
function commonItems(...arrays) {
|
|
893
|
+
let returnItems = null;
|
|
894
|
+
for (let array of arrays) {
|
|
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
|
+
}
|
|
1053
903
|
}
|
|
1054
|
-
return
|
|
904
|
+
return returnItems;
|
|
1055
905
|
}
|
|
1056
906
|
/**
|
|
1057
|
-
* '
|
|
907
|
+
* 'fixTitle' function
|
|
1058
908
|
*
|
|
1059
|
-
* Makes a shallow copy of a JavaScript object, array, Map, or Set.
|
|
1060
|
-
* If passed a JavaScript primitive value (string, number, boolean, or null),
|
|
1061
|
-
* it returns the value.
|
|
1062
909
|
*
|
|
1063
|
-
* // {
|
|
1064
|
-
* // {
|
|
1065
|
-
* // {Object|Array|string|number|boolean|null} - The copied object
|
|
910
|
+
* // {string} input -
|
|
911
|
+
* // {string} -
|
|
1066
912
|
*/
|
|
1067
|
-
function
|
|
1068
|
-
|
|
1069
|
-
return object;
|
|
1070
|
-
}
|
|
1071
|
-
if (isMap(object)) {
|
|
1072
|
-
return new Map(object);
|
|
1073
|
-
}
|
|
1074
|
-
if (isSet(object)) {
|
|
1075
|
-
return new Set(object);
|
|
1076
|
-
}
|
|
1077
|
-
if (isArray(object)) {
|
|
1078
|
-
return [...object];
|
|
1079
|
-
}
|
|
1080
|
-
if (isObject(object)) {
|
|
1081
|
-
return { ...object };
|
|
1082
|
-
}
|
|
1083
|
-
if (errors) {
|
|
1084
|
-
console.error('copy error: Object to copy must be a JavaScript object or value.');
|
|
1085
|
-
}
|
|
1086
|
-
return object;
|
|
913
|
+
function fixTitle(name) {
|
|
914
|
+
return name && toTitleCase(name.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/_/g, ' '));
|
|
1087
915
|
}
|
|
1088
916
|
/**
|
|
1089
|
-
* '
|
|
917
|
+
* 'toTitleCase' function
|
|
1090
918
|
*
|
|
1091
|
-
*
|
|
1092
|
-
* and calls an iterator funciton on each item.
|
|
919
|
+
* Intelligently converts an input string to Title Case.
|
|
1093
920
|
*
|
|
1094
|
-
*
|
|
1095
|
-
*
|
|
1096
|
-
* 2. The current item's key
|
|
1097
|
-
* 3. The parent object, which contains the current item
|
|
1098
|
-
* 4. The root object
|
|
921
|
+
* Accepts an optional second parameter with a list of additional
|
|
922
|
+
* words and abbreviations to force into a particular case.
|
|
1099
923
|
*
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1102
|
-
*
|
|
924
|
+
* This function is built on prior work by John Gruber and David Gouch:
|
|
925
|
+
* http://daringfireball.net/2008/08/title_case_update
|
|
926
|
+
* https://github.com/gouch/to-title-case
|
|
1103
927
|
*
|
|
1104
|
-
* // {
|
|
1105
|
-
* // {
|
|
1106
|
-
* // {
|
|
1107
|
-
* // {void}
|
|
928
|
+
* // {string} input -
|
|
929
|
+
* // {string|string[]} forceWords? -
|
|
930
|
+
* // {string} -
|
|
1108
931
|
*/
|
|
1109
|
-
function
|
|
1110
|
-
if (
|
|
1111
|
-
return;
|
|
932
|
+
function toTitleCase(input, forceWords) {
|
|
933
|
+
if (!isString(input)) {
|
|
934
|
+
return input;
|
|
1112
935
|
}
|
|
1113
|
-
|
|
1114
|
-
for
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
936
|
+
let forceArray = ['a', 'an', 'and', 'as', 'at', 'but', 'by', 'en',
|
|
937
|
+
'for', 'if', 'in', 'nor', 'of', 'on', 'or', 'per', 'the', 'to', 'v', 'v.',
|
|
938
|
+
'vs', 'vs.', 'via'];
|
|
939
|
+
if (isString(forceWords)) {
|
|
940
|
+
forceWords = forceWords.split('|');
|
|
941
|
+
}
|
|
942
|
+
if (isArray(forceWords)) {
|
|
943
|
+
forceArray = forceArray.concat(forceWords);
|
|
944
|
+
}
|
|
945
|
+
const forceArrayLower = forceArray.map(w => w.toLowerCase());
|
|
946
|
+
const noInitialCase = input === input.toUpperCase() || input === input.toLowerCase();
|
|
947
|
+
let prevLastChar = '';
|
|
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;
|
|
952
|
+
}
|
|
953
|
+
else {
|
|
954
|
+
let newWord;
|
|
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
|
+
}
|
|
1118
968
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
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;
|
|
1122
976
|
}
|
|
977
|
+
prevLastChar = word.slice(-1);
|
|
978
|
+
return newWord;
|
|
1123
979
|
}
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const deValidationMessages = {
|
|
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`;
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
minProperties: 'Mindestens {{minimumProperties}} Attribute erforderlich (aktuell: {{currentProperties}})',
|
|
1036
|
+
maxProperties: 'Maximal {{maximumProperties}} Attribute erlaubt (aktuell: {{currentProperties}})',
|
|
1037
|
+
minItems: 'Mindestens {{minimumItems}} Werte erforderlich (aktuell: {{currentItems}})',
|
|
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;
|
|
1129
1080
|
}
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1081
|
+
},
|
|
1082
|
+
minimum: 'Must be {{minimumValue}} or more',
|
|
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.`;
|
|
1133
1090
|
}
|
|
1134
|
-
|
|
1135
|
-
}
|
|
1136
|
-
/**
|
|
1137
|
-
* 'forEachCopy' function
|
|
1138
|
-
*
|
|
1139
|
-
* Iterates over all items in the first level of an object or array
|
|
1140
|
-
* and calls an iterator function on each item. Returns a new object or array
|
|
1141
|
-
* with the same keys or indexes as the original, and values set to the results
|
|
1142
|
-
* of the iterator function.
|
|
1143
|
-
*
|
|
1144
|
-
* Does NOT recursively iterate over items in sub-objects or sub-arrays.
|
|
1145
|
-
*
|
|
1146
|
-
* // {Object | Array} object - The object or array to iterate over
|
|
1147
|
-
* // {function} fn - The iterator funciton to call on each item
|
|
1148
|
-
* // {boolean = false} errors - Show errors?
|
|
1149
|
-
* // {Object | Array} - The resulting object or array
|
|
1150
|
-
*/
|
|
1151
|
-
function forEachCopy(object, fn, errors = false) {
|
|
1152
|
-
if (!hasValue(object)) {
|
|
1153
|
-
return;
|
|
1154
|
-
}
|
|
1155
|
-
if ((isObject(object) || isArray(object)) && typeof object !== 'function') {
|
|
1156
|
-
const newObject = isArray(object) ? [] : {};
|
|
1157
|
-
for (const key of Object.keys(object)) {
|
|
1158
|
-
newObject[key] = fn(object[key], key, object);
|
|
1091
|
+
else {
|
|
1092
|
+
return `Must be a multiple of ${error.multipleOfValue}.`;
|
|
1159
1093
|
}
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1094
|
+
},
|
|
1095
|
+
minProperties: 'Must have {{minimumProperties}} or more items (current items: {{currentProperties}})',
|
|
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;
|
|
1166
1138
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1139
|
+
},
|
|
1140
|
+
minimum: 'Debe ser {{minimumValue}} o más',
|
|
1141
|
+
exclusiveMinimum: 'Debe ser superior a {{exclusiveMinimumValue}}',
|
|
1142
|
+
maximum: 'Debe ser {{maximumValue}} o menos',
|
|
1143
|
+
exclusiveMaximum: 'Debe ser menor que {{exclusiveMaximumValue}}',
|
|
1144
|
+
multipleOf: function (error) {
|
|
1145
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
1146
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
1147
|
+
return `Se permite un máximo de ${decimals} decimales`;
|
|
1170
1148
|
}
|
|
1171
|
-
|
|
1172
|
-
}
|
|
1173
|
-
/**
|
|
1174
|
-
* 'hasOwn' utility function
|
|
1175
|
-
*
|
|
1176
|
-
* Checks whether an object or array has a particular property.
|
|
1177
|
-
*
|
|
1178
|
-
* // {any} object - the object to check
|
|
1179
|
-
* // {string} property - the property to look for
|
|
1180
|
-
* // {boolean} - true if object has property, false if not
|
|
1181
|
-
*/
|
|
1182
|
-
function hasOwn(object, property) {
|
|
1183
|
-
if (!object || !['number', 'string', 'symbol'].includes(typeof property) ||
|
|
1184
|
-
(!isObject(object) && !isArray(object) && !isMap(object) && !isSet(object))) {
|
|
1185
|
-
return false;
|
|
1186
|
-
}
|
|
1187
|
-
if (isMap(object) || isSet(object)) {
|
|
1188
|
-
return object.has(property);
|
|
1189
|
-
}
|
|
1190
|
-
if (typeof property === 'number') {
|
|
1191
|
-
if (isArray(object)) {
|
|
1192
|
-
return object[property];
|
|
1149
|
+
else {
|
|
1150
|
+
return `Debe ser múltiplo de ${error.multipleOfValue}.`;
|
|
1193
1151
|
}
|
|
1194
|
-
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
return key.split('==', 2);
|
|
1240
|
-
}
|
|
1241
|
-
if (isNotEqual(expressionType)) {
|
|
1242
|
-
return key.split('!=', 2);
|
|
1243
|
-
}
|
|
1244
|
-
return null;
|
|
1245
|
-
}
|
|
1246
|
-
function cleanValueOfQuotes(keyAndValue) {
|
|
1247
|
-
if (keyAndValue.charAt(0) === '\'' && keyAndValue.charAt(keyAndValue.length - 1) === '\'') {
|
|
1248
|
-
return keyAndValue.replace('\'', '').replace('\'', '');
|
|
1249
|
-
}
|
|
1250
|
-
return keyAndValue;
|
|
1251
|
-
}
|
|
1252
|
-
/**
|
|
1253
|
-
* 'mergeFilteredObject' utility function
|
|
1254
|
-
*
|
|
1255
|
-
* Shallowly merges two objects, setting key and values from source object
|
|
1256
|
-
* in target object, excluding specified keys.
|
|
1257
|
-
*
|
|
1258
|
-
* Optionally, it can also use functions to transform the key names and/or
|
|
1259
|
-
* the values of the merging object.
|
|
1260
|
-
*
|
|
1261
|
-
* // {PlainObject} targetObject - Target object to add keys and values to
|
|
1262
|
-
* // {PlainObject} sourceObject - Source object to copy keys and values from
|
|
1263
|
-
* // {string[]} excludeKeys - Array of keys to exclude
|
|
1264
|
-
* // {(string: string) => string = (k) => k} keyFn - Function to apply to keys
|
|
1265
|
-
* // {(any: any) => any = (v) => v} valueFn - Function to apply to values
|
|
1266
|
-
* // {PlainObject} - Returns targetObject
|
|
1267
|
-
*/
|
|
1268
|
-
function mergeFilteredObject(targetObject, sourceObject, excludeKeys = [], keyFn = (key) => key, valFn = (val) => val) {
|
|
1269
|
-
if (!isObject(sourceObject)) {
|
|
1270
|
-
return targetObject;
|
|
1271
|
-
}
|
|
1272
|
-
if (!isObject(targetObject)) {
|
|
1273
|
-
targetObject = {};
|
|
1274
|
-
}
|
|
1275
|
-
for (const key of Object.keys(sourceObject)) {
|
|
1276
|
-
if (!inArray(key, excludeKeys) && isDefined(sourceObject[key])) {
|
|
1277
|
-
targetObject[keyFn(key)] = valFn(sourceObject[key]);
|
|
1152
|
+
},
|
|
1153
|
+
minProperties: 'Debe tener {{minimumProperties}} o más elementos (elementos actuales: {{currentProperties}})',
|
|
1154
|
+
maxProperties: 'Debe tener {{maximumProperties}} o menos elementos (elementos actuales: {{currentProperties}})',
|
|
1155
|
+
minItems: 'Debe tener {{minimumItems}} o más elementos (elementos actuales: {{currentItems}})',
|
|
1156
|
+
maxItems: 'Debe tener {{maximumItems}} o menos elementos (elementos actuales: {{currentItems}})',
|
|
1157
|
+
uniqueItems: 'Todos los elementos deben ser únicos',
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1160
|
+
const frValidationMessages = {
|
|
1161
|
+
required: 'Est obligatoire.',
|
|
1162
|
+
minLength: 'Doit avoir minimum {{minimumLength}} caractères (actuellement: {{currentLength}})',
|
|
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;
|
|
1278
1197
|
}
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
* // {...string} ...items -
|
|
1289
|
-
* // {string[]} -
|
|
1290
|
-
*/
|
|
1291
|
-
function uniqueItems(...items) {
|
|
1292
|
-
const returnItems = [];
|
|
1293
|
-
for (const item of items) {
|
|
1294
|
-
if (!returnItems.includes(item)) {
|
|
1295
|
-
returnItems.push(item);
|
|
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.`;
|
|
1296
1207
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
}
|
|
1300
|
-
/**
|
|
1301
|
-
* 'commonItems' function
|
|
1302
|
-
*
|
|
1303
|
-
* Accepts any number of strings or arrays of string values,
|
|
1304
|
-
* and returns a single array containing only values present in all inputs.
|
|
1305
|
-
*
|
|
1306
|
-
* // {...string|string[]} ...arrays -
|
|
1307
|
-
* // {string[]} -
|
|
1308
|
-
*/
|
|
1309
|
-
function commonItems(...arrays) {
|
|
1310
|
-
let returnItems = null;
|
|
1311
|
-
for (let array of arrays) {
|
|
1312
|
-
if (isString(array)) {
|
|
1313
|
-
array = [array];
|
|
1208
|
+
else {
|
|
1209
|
+
return `Doit être un multiple de ${error.multipleOfValue}.`;
|
|
1314
1210
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1211
|
+
},
|
|
1212
|
+
minProperties: 'Doit comporter au minimum {{minimumProperties}} éléments',
|
|
1213
|
+
maxProperties: 'Doit comporter au maximum {{maximumProperties}} éléments',
|
|
1214
|
+
minItems: 'Doit comporter au minimum {{minimumItems}} éléments',
|
|
1215
|
+
maxItems: 'Doit comporter au maximum {{minimumItems}} éléments',
|
|
1216
|
+
uniqueItems: 'Tous les éléments doivent être uniques',
|
|
1217
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
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;
|
|
1319
1257
|
}
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
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
|
-
|
|
1258
|
+
},
|
|
1259
|
+
minimum: 'Deve essere {{minimumValue}} o più',
|
|
1260
|
+
exclusiveMinimum: 'Deve essere più di {{exclusiveMinimumValue}}',
|
|
1261
|
+
maximum: 'Deve essere {{maximumValue}} o meno',
|
|
1262
|
+
exclusiveMaximum: 'Deve essere minore di {{exclusiveMaximumValue}}',
|
|
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.`;
|
|
1267
|
+
}
|
|
1268
|
+
else {
|
|
1269
|
+
return `Deve essere multiplo di ${error.multipleOfValue}.`;
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1272
|
+
minProperties: 'Deve avere {{minimumProperties}} o più elementi (elementi correnti: {{currentProperties}})',
|
|
1273
|
+
maxProperties: 'Deve avere {{maximumProperties}} o meno elementi (elementi correnti: {{currentProperties}})',
|
|
1274
|
+
minItems: 'Deve avere {{minimumItems}} o più elementi (elementi correnti: {{currentItems}})',
|
|
1275
|
+
maxItems: 'Deve avere {{maximumItems}} o meno elementi (elementi correnti: {{currentItems}})',
|
|
1276
|
+
uniqueItems: 'Tutti gli elementi devono essere unici',
|
|
1277
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
const ptValidationMessages = {
|
|
1281
|
+
required: 'Este campo é obrigatório.',
|
|
1282
|
+
minLength: 'É preciso no mínimo {{minimumLength}} caracteres ou mais (tamanho atual: {{currentLength}})',
|
|
1283
|
+
maxLength: 'É preciso no máximo {{maximumLength}} caracteres ou menos (tamanho atual: {{currentLength}})',
|
|
1284
|
+
pattern: 'Tem que ajustar ao formato: {{requiredPattern}}',
|
|
1285
|
+
format: function (error) {
|
|
1286
|
+
switch (error.requiredFormat) {
|
|
1287
|
+
case 'date':
|
|
1288
|
+
return 'Tem que ser uma data, por exemplo "2000-12-31"';
|
|
1289
|
+
case 'time':
|
|
1290
|
+
return 'Tem que ser horário, por exemplo "16:20" ou "03:14:15.9265"';
|
|
1291
|
+
case 'date-time':
|
|
1292
|
+
return 'Tem que ser data e hora, por exemplo "2000-03-14T01:59" ou "2000-03-14T01:59:26.535Z"';
|
|
1293
|
+
case 'email':
|
|
1294
|
+
return 'Tem que ser um email, por exemplo "fulano@exemplo.com.br"';
|
|
1295
|
+
case 'hostname':
|
|
1296
|
+
return 'Tem que ser uma nome de domínio, por exemplo "exemplo.com.br"';
|
|
1297
|
+
case 'ipv4':
|
|
1298
|
+
return 'Tem que ser um endereço IPv4, por exemplo "127.0.0.1"';
|
|
1299
|
+
case 'ipv6':
|
|
1300
|
+
return 'Tem que ser um endereço IPv6, por exemplo "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
1301
|
+
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
1302
|
+
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
1303
|
+
case 'url':
|
|
1304
|
+
return 'Tem que ser uma URL, por exemplo "http://www.exemplo.com.br/pagina.html"';
|
|
1305
|
+
case 'uuid':
|
|
1306
|
+
return 'Tem que ser um uuid, por exemplo "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
1307
|
+
case 'color':
|
|
1308
|
+
return 'Tem que ser uma cor, por exemplo "#FFFFFF" ou "rgb(255, 255, 255)"';
|
|
1309
|
+
case 'json-pointer':
|
|
1310
|
+
return 'Tem que ser um JSON Pointer, por exemplo "/referencia/para/algo"';
|
|
1311
|
+
case 'relative-json-pointer':
|
|
1312
|
+
return 'Tem que ser um JSON Pointer relativo, por exemplo "2/referencia/para/algo"';
|
|
1313
|
+
case 'regex':
|
|
1314
|
+
return 'Tem que ser uma expressão regular, por exemplo "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
1315
|
+
default:
|
|
1316
|
+
return 'Tem que ser no formato: ' + error.requiredFormat;
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
|
+
minimum: 'Tem que ser {{minimumValue}} ou mais',
|
|
1320
|
+
exclusiveMinimum: 'Tem que ser mais que {{exclusiveMinimumValue}}',
|
|
1321
|
+
maximum: 'Tem que ser {{maximumValue}} ou menos',
|
|
1322
|
+
exclusiveMaximum: 'Tem que ser menor que {{exclusiveMaximumValue}}',
|
|
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.`;
|
|
1327
|
+
}
|
|
1328
|
+
else {
|
|
1329
|
+
return `Tem que ser um múltiplo de ${error.multipleOfValue}.`;
|
|
1330
|
+
}
|
|
1331
|
+
},
|
|
1332
|
+
minProperties: 'Deve ter {{minimumProperties}} ou mais itens (itens até o momento: {{currentProperties}})',
|
|
1333
|
+
maxProperties: 'Deve ter {{maximumProperties}} ou menos intens (itens até o momento: {{currentProperties}})',
|
|
1334
|
+
minItems: 'Deve ter {{minimumItems}} ou mais itens (itens até o momento: {{currentItems}})',
|
|
1335
|
+
maxItems: 'Deve ter {{maximumItems}} ou menos itens (itens até o momento: {{currentItems}})',
|
|
1336
|
+
uniqueItems: 'Todos os itens devem ser únicos',
|
|
1337
|
+
// Note: No default error messages for 'type', 'const', 'enum', or 'dependencies'
|
|
1338
|
+
};
|
|
1339
|
+
|
|
1340
|
+
const zhValidationMessages = {
|
|
1341
|
+
required: '必填字段.',
|
|
1342
|
+
minLength: '字符长度必须大于或者等于 {{minimumLength}} (当前长度: {{currentLength}})',
|
|
1343
|
+
maxLength: '字符长度必须小于或者等于 {{maximumLength}} (当前长度: {{currentLength}})',
|
|
1344
|
+
pattern: '必须匹配正则表达式: {{requiredPattern}}',
|
|
1345
|
+
format: function (error) {
|
|
1346
|
+
switch (error.requiredFormat) {
|
|
1347
|
+
case 'date':
|
|
1348
|
+
return '必须为日期格式, 比如 "2000-12-31"';
|
|
1349
|
+
case 'time':
|
|
1350
|
+
return '必须为时间格式, 比如 "16:20" 或者 "03:14:15.9265"';
|
|
1351
|
+
case 'date-time':
|
|
1352
|
+
return '必须为日期时间格式, 比如 "2000-03-14T01:59" 或者 "2000-03-14T01:59:26.535Z"';
|
|
1353
|
+
case 'email':
|
|
1354
|
+
return '必须为邮箱地址, 比如 "name@example.com"';
|
|
1355
|
+
case 'hostname':
|
|
1356
|
+
return '必须为主机名, 比如 "example.com"';
|
|
1357
|
+
case 'ipv4':
|
|
1358
|
+
return '必须为 IPv4 地址, 比如 "127.0.0.1"';
|
|
1359
|
+
case 'ipv6':
|
|
1360
|
+
return '必须为 IPv6 地址, 比如 "1234:5678:9ABC:DEF0:1234:5678:9ABC:DEF0"';
|
|
1361
|
+
// TODO: add examples for 'uri', 'uri-reference', and 'uri-template'
|
|
1362
|
+
// case 'uri': case 'uri-reference': case 'uri-template':
|
|
1363
|
+
case 'url':
|
|
1364
|
+
return '必须为 url, 比如 "http://www.example.com/page.html"';
|
|
1365
|
+
case 'uuid':
|
|
1366
|
+
return '必须为 uuid, 比如 "12345678-9ABC-DEF0-1234-56789ABCDEF0"';
|
|
1367
|
+
case 'color':
|
|
1368
|
+
return '必须为颜色值, 比如 "#FFFFFF" 或者 "rgb(255, 255, 255)"';
|
|
1369
|
+
case 'json-pointer':
|
|
1370
|
+
return '必须为 JSON Pointer, 比如 "/pointer/to/something"';
|
|
1371
|
+
case 'relative-json-pointer':
|
|
1372
|
+
return '必须为相对的 JSON Pointer, 比如 "2/pointer/to/something"';
|
|
1373
|
+
case 'regex':
|
|
1374
|
+
return '必须为正则表达式, 比如 "(1-)?\\d{3}-\\d{3}-\\d{4}"';
|
|
1375
|
+
default:
|
|
1376
|
+
return '必须为格式正确的 ' + error.requiredFormat;
|
|
1377
|
+
}
|
|
1378
|
+
},
|
|
1379
|
+
minimum: '必须大于或者等于最小值: {{minimumValue}}',
|
|
1380
|
+
exclusiveMinimum: '必须大于最小值: {{exclusiveMinimumValue}}',
|
|
1381
|
+
maximum: '必须小于或者等于最大值: {{maximumValue}}',
|
|
1382
|
+
exclusiveMaximum: '必须小于最大值: {{exclusiveMaximumValue}}',
|
|
1383
|
+
multipleOf: function (error) {
|
|
1384
|
+
if ((1 / error.multipleOfValue) % 10 === 0) {
|
|
1385
|
+
const decimals = Math.log10(1 / error.multipleOfValue);
|
|
1386
|
+
return `必须有 ${decimals} 位或更少的小数位`;
|
|
1369
1387
|
}
|
|
1370
1388
|
else {
|
|
1371
|
-
|
|
1372
|
-
const forceWord = forceArray[forceArrayLower.indexOf(word.toLowerCase())];
|
|
1373
|
-
if (!forceWord) {
|
|
1374
|
-
if (noInitialCase) {
|
|
1375
|
-
if (word.slice(1).search(/\../) !== -1) {
|
|
1376
|
-
newWord = word.toLowerCase();
|
|
1377
|
-
}
|
|
1378
|
-
else {
|
|
1379
|
-
newWord = word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
else {
|
|
1383
|
-
newWord = word[0].toUpperCase() + word.slice(1);
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
else if (forceWord === forceWord.toLowerCase() && (idx === 0 || idx + word.length === input.length ||
|
|
1387
|
-
prevLastChar === ':' || input[idx - 1].search(/[^\s-]/) !== -1 ||
|
|
1388
|
-
(input[idx - 1] !== '-' && input[idx + word.length] === '-'))) {
|
|
1389
|
-
newWord = forceWord[0].toUpperCase() + forceWord.slice(1);
|
|
1390
|
-
}
|
|
1391
|
-
else {
|
|
1392
|
-
newWord = forceWord;
|
|
1393
|
-
}
|
|
1394
|
-
prevLastChar = word.slice(-1);
|
|
1395
|
-
return newWord;
|
|
1389
|
+
return `必须为 ${error.multipleOfValue} 的倍数`;
|
|
1396
1390
|
}
|
|
1397
|
-
}
|
|
1398
|
-
}
|
|
1391
|
+
},
|
|
1392
|
+
minProperties: '项目数必须大于或者等于 {{minimumProperties}} (当前项目数: {{currentProperties}})',
|
|
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
|
+
};
|
|
1399
1399
|
|
|
1400
1400
|
class JsonPointer {
|
|
1401
1401
|
/**
|
|
@@ -5106,21 +5106,24 @@ function formatFormData(formData, dataMap, recursiveRefMap, arrayMap, returnEmpt
|
|
|
5106
5106
|
JsonPointer.set(formattedData, dataPointer, newValue);
|
|
5107
5107
|
}
|
|
5108
5108
|
}
|
|
5109
|
+
// commented out completely as value can be 'null' if not entered
|
|
5109
5110
|
// Finish incomplete 'date-time' entries
|
|
5110
|
-
if (dataMap.get(genericPointer).get('schemaFormat') === 'date-time') {
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5111
|
+
// if (dataMap.get(genericPointer).get('schemaFormat') === 'date-time') {
|
|
5112
|
+
// /* commented out-should use same format as datetime-local input
|
|
5113
|
+
// for initial data to bind back to the input
|
|
5114
|
+
// // "2000-03-14T01:59:26.535" -> "2000-03-14T01:59:26.535Z" (add "Z")
|
|
5115
|
+
// if (/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?$/i.test(value)) {
|
|
5116
|
+
// JsonPointer.set(formattedData, dataPointer, `${value}Z`);
|
|
5117
|
+
// // "2000-03-14T01:59" -> "2000-03-14T01:59:00Z" (add ":00Z")
|
|
5118
|
+
// } else if (/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d$/i.test(value)) {
|
|
5119
|
+
// JsonPointer.set(formattedData, dataPointer, `${value}:00Z`);
|
|
5120
|
+
// // "2000-03-14" -> "2000-03-14T00:00:00Z" (add "T00:00:00Z")
|
|
5121
|
+
// } else if (fixErrors && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(value)) {
|
|
5122
|
+
// JsonPointer.set(formattedData, dataPointer, `${value}:00:00:00Z`);
|
|
5123
|
+
// }
|
|
5124
|
+
// */
|
|
5125
|
+
// JsonPointer.set(formattedData, dataPointer, `${value}`);
|
|
5126
|
+
// }
|
|
5124
5127
|
}
|
|
5125
5128
|
else if (typeof value !== 'object' || isDate(value) ||
|
|
5126
5129
|
(value === null && returnEmptyFields)) {
|
|
@@ -6685,8 +6688,24 @@ class JsonSchemaFormService {
|
|
|
6685
6688
|
return '';
|
|
6686
6689
|
}
|
|
6687
6690
|
setArrayItemTitle(parentCtx = {}, childNode = null, index = null) {
|
|
6688
|
-
|
|
6689
|
-
|
|
6691
|
+
//for legacy compatibility, parentCtx.layoutNode could either be a value
|
|
6692
|
+
//or have been converted to use Signals
|
|
6693
|
+
let parentCtxAsSignals = {
|
|
6694
|
+
layoutNode: () => {
|
|
6695
|
+
if (isObject(parentCtx.layoutNode)) {
|
|
6696
|
+
return parentCtx.layoutNode;
|
|
6697
|
+
}
|
|
6698
|
+
return parentCtx.layoutNode();
|
|
6699
|
+
},
|
|
6700
|
+
dataIndex: () => {
|
|
6701
|
+
if (isObject(parentCtx.dataIndex)) {
|
|
6702
|
+
return parentCtx.dataIndex;
|
|
6703
|
+
}
|
|
6704
|
+
return parentCtx.dataIndex();
|
|
6705
|
+
}
|
|
6706
|
+
};
|
|
6707
|
+
const parentNode = parentCtxAsSignals.layoutNode();
|
|
6708
|
+
const parentValues = this.getFormControlValue(parentCtxAsSignals);
|
|
6690
6709
|
const isArrayItem = (parentNode.type || '').slice(-5) === 'array' && isArray(parentValues);
|
|
6691
6710
|
const text = JsonPointer.getFirst(isArrayItem && childNode.type !== '$ref'
|
|
6692
6711
|
? [
|
|
@@ -6710,9 +6729,9 @@ class JsonSchemaFormService {
|
|
|
6710
6729
|
return this.parseText(text, childValue, parentValues, index);
|
|
6711
6730
|
}
|
|
6712
6731
|
setItemTitle(ctx) {
|
|
6713
|
-
return !ctx.options.title && /^(\d+|-)$/.test(ctx.layoutNode.name)
|
|
6732
|
+
return !ctx.options.title && /^(\d+|-)$/.test(ctx.layoutNode().name)
|
|
6714
6733
|
? null
|
|
6715
|
-
: this.parseText(ctx.options.title || toTitleCase(ctx.layoutNode.name), this.getFormControlValue(
|
|
6734
|
+
: this.parseText(ctx.options.title || toTitleCase(ctx.layoutNode().name), this.getFormControlValue(ctx), (this.getFormControlGroup(ctx) || {}).value, ctx.dataIndex()[ctx.dataIndex().length - 1]);
|
|
6716
6735
|
}
|
|
6717
6736
|
evaluateCondition(layoutNode, dataIndex) {
|
|
6718
6737
|
const arrayIndex = dataIndex && dataIndex[dataIndex.length - 1];
|
|
@@ -6751,8 +6770,8 @@ class JsonSchemaFormService {
|
|
|
6751
6770
|
return false;
|
|
6752
6771
|
}
|
|
6753
6772
|
if (isEmpty(ctx.options)) {
|
|
6754
|
-
ctx.options = !isEmpty((ctx.layoutNode || {}).options)
|
|
6755
|
-
? ctx.layoutNode.options
|
|
6773
|
+
ctx.options = !isEmpty((ctx.layoutNode() || {}).options)
|
|
6774
|
+
? ctx.layoutNode().options
|
|
6756
6775
|
: cloneDeep(this.formOptions);
|
|
6757
6776
|
}
|
|
6758
6777
|
ctx.formControl = this.getFormControl(ctx);
|
|
@@ -6788,8 +6807,8 @@ class JsonSchemaFormService {
|
|
|
6788
6807
|
});
|
|
6789
6808
|
}
|
|
6790
6809
|
else {
|
|
6791
|
-
ctx.controlName = ctx.layoutNode.name;
|
|
6792
|
-
ctx.controlValue = ctx.layoutNode.value || null;
|
|
6810
|
+
ctx.controlName = ctx.layoutNode().name;
|
|
6811
|
+
ctx.controlValue = ctx.layoutNode().value || null;
|
|
6793
6812
|
const dataPointer = this.getDataPointer(ctx);
|
|
6794
6813
|
if (bind && dataPointer) {
|
|
6795
6814
|
console.error(`warning: control "${dataPointer}" is not bound to the Angular FormGroup.`);
|
|
@@ -6846,7 +6865,7 @@ class JsonSchemaFormService {
|
|
|
6846
6865
|
ctx.formControl.setValue(value);
|
|
6847
6866
|
ctx.formControl.markAsDirty();
|
|
6848
6867
|
}
|
|
6849
|
-
ctx.layoutNode.value = value;
|
|
6868
|
+
ctx.layoutNode().value = value;
|
|
6850
6869
|
// Set values of any related controls in copyValueTo array
|
|
6851
6870
|
if (isArray(ctx.options.copyValueTo)) {
|
|
6852
6871
|
for (const item of ctx.options.copyValueTo) {
|
|
@@ -6866,7 +6885,7 @@ class JsonSchemaFormService {
|
|
|
6866
6885
|
formArray.removeAt(0);
|
|
6867
6886
|
}
|
|
6868
6887
|
// Re-add an item for each checked box
|
|
6869
|
-
const refPointer = removeRecursiveReferences(ctx.layoutNode.dataPointer + '/-', this.dataRecursiveRefMap, this.arrayMap);
|
|
6888
|
+
const refPointer = removeRecursiveReferences(ctx.layoutNode().dataPointer + '/-', this.dataRecursiveRefMap, this.arrayMap);
|
|
6870
6889
|
for (const checkboxItem of checkboxList) {
|
|
6871
6890
|
if (checkboxItem.checked) {
|
|
6872
6891
|
const newFormControl = buildFormGroup(this.templateRefLibrary[refPointer]);
|
|
@@ -6877,32 +6896,32 @@ class JsonSchemaFormService {
|
|
|
6877
6896
|
formArray.markAsDirty();
|
|
6878
6897
|
}
|
|
6879
6898
|
getFormControl(ctx) {
|
|
6880
|
-
if (!ctx.layoutNode ||
|
|
6881
|
-
!isDefined(ctx.layoutNode.dataPointer) ||
|
|
6882
|
-
ctx.layoutNode.type === '$ref') {
|
|
6899
|
+
if (!ctx || !ctx.layoutNode ||
|
|
6900
|
+
!isDefined(ctx.layoutNode().dataPointer) ||
|
|
6901
|
+
ctx.layoutNode().type === '$ref') {
|
|
6883
6902
|
return null;
|
|
6884
6903
|
}
|
|
6885
6904
|
return getControl(this.formGroup, this.getDataPointer(ctx));
|
|
6886
6905
|
}
|
|
6887
6906
|
getFormControlValue(ctx) {
|
|
6888
|
-
if (!ctx.layoutNode ||
|
|
6889
|
-
!isDefined(ctx.layoutNode.dataPointer) ||
|
|
6890
|
-
ctx.layoutNode.type === '$ref') {
|
|
6907
|
+
if (!ctx || !ctx.layoutNode ||
|
|
6908
|
+
!isDefined(ctx.layoutNode().dataPointer) ||
|
|
6909
|
+
ctx.layoutNode().type === '$ref') {
|
|
6891
6910
|
return null;
|
|
6892
6911
|
}
|
|
6893
6912
|
const control = getControl(this.formGroup, this.getDataPointer(ctx));
|
|
6894
6913
|
return control ? control.value : null;
|
|
6895
6914
|
}
|
|
6896
6915
|
getFormControlGroup(ctx) {
|
|
6897
|
-
if (!ctx.layoutNode || !isDefined(ctx.layoutNode.dataPointer)) {
|
|
6916
|
+
if (!ctx || !ctx.layoutNode || !isDefined(ctx.layoutNode().dataPointer)) {
|
|
6898
6917
|
return null;
|
|
6899
6918
|
}
|
|
6900
6919
|
return getControl(this.formGroup, this.getDataPointer(ctx), true);
|
|
6901
6920
|
}
|
|
6902
6921
|
getFormControlName(ctx) {
|
|
6903
|
-
if (!ctx.layoutNode ||
|
|
6904
|
-
!isDefined(ctx.layoutNode.dataPointer) ||
|
|
6905
|
-
!hasValue(ctx.dataIndex)) {
|
|
6922
|
+
if (!ctx || !ctx.layoutNode ||
|
|
6923
|
+
!isDefined(ctx.layoutNode().dataPointer) ||
|
|
6924
|
+
!hasValue(ctx.dataIndex())) {
|
|
6906
6925
|
return null;
|
|
6907
6926
|
}
|
|
6908
6927
|
return JsonPointer.toKey(this.getDataPointer(ctx));
|
|
@@ -6914,23 +6933,23 @@ class JsonSchemaFormService {
|
|
|
6914
6933
|
return JsonPointer.get(this.layout, this.getLayoutPointer(ctx), 0, -2);
|
|
6915
6934
|
}
|
|
6916
6935
|
getDataPointer(ctx) {
|
|
6917
|
-
if (!ctx.layoutNode ||
|
|
6918
|
-
!isDefined(ctx.layoutNode.dataPointer) ||
|
|
6919
|
-
!hasValue(ctx.dataIndex)) {
|
|
6936
|
+
if (!ctx || !ctx.layoutNode ||
|
|
6937
|
+
!isDefined(ctx.layoutNode().dataPointer) ||
|
|
6938
|
+
!hasValue(ctx.dataIndex())) {
|
|
6920
6939
|
return null;
|
|
6921
6940
|
}
|
|
6922
|
-
return JsonPointer.toIndexedPointer(ctx.layoutNode.dataPointer, ctx.dataIndex, this.arrayMap);
|
|
6941
|
+
return JsonPointer.toIndexedPointer(ctx.layoutNode().dataPointer, ctx.dataIndex(), this.arrayMap);
|
|
6923
6942
|
}
|
|
6924
6943
|
getLayoutPointer(ctx) {
|
|
6925
|
-
if (!hasValue(ctx.layoutIndex)) {
|
|
6944
|
+
if (!hasValue(ctx.layoutIndex())) {
|
|
6926
6945
|
return null;
|
|
6927
6946
|
}
|
|
6928
|
-
return '/' + ctx.layoutIndex.join('/items/');
|
|
6947
|
+
return '/' + ctx.layoutIndex().join('/items/');
|
|
6929
6948
|
}
|
|
6930
6949
|
isControlBound(ctx) {
|
|
6931
|
-
if (!ctx.layoutNode ||
|
|
6932
|
-
!isDefined(ctx.layoutNode.dataPointer) ||
|
|
6933
|
-
!hasValue(ctx.dataIndex)) {
|
|
6950
|
+
if (!ctx || !ctx.layoutNode ||
|
|
6951
|
+
!isDefined(ctx.layoutNode().dataPointer) ||
|
|
6952
|
+
!hasValue(ctx.dataIndex())) {
|
|
6934
6953
|
return false;
|
|
6935
6954
|
}
|
|
6936
6955
|
const controlGroup = this.getFormControlGroup(ctx);
|
|
@@ -6938,16 +6957,16 @@ class JsonSchemaFormService {
|
|
|
6938
6957
|
return controlGroup ? hasOwn(controlGroup.controls, name) : false;
|
|
6939
6958
|
}
|
|
6940
6959
|
addItem(ctx, name) {
|
|
6941
|
-
if (!ctx.layoutNode ||
|
|
6942
|
-
!isDefined(ctx.layoutNode.$ref) ||
|
|
6943
|
-
!hasValue(ctx.dataIndex) ||
|
|
6944
|
-
!hasValue(ctx.layoutIndex)) {
|
|
6960
|
+
if (!ctx || !ctx.layoutNode ||
|
|
6961
|
+
!isDefined(ctx.layoutNode().$ref) ||
|
|
6962
|
+
!hasValue(ctx.dataIndex()) ||
|
|
6963
|
+
!hasValue(ctx.layoutIndex())) {
|
|
6945
6964
|
return false;
|
|
6946
6965
|
}
|
|
6947
6966
|
// Create a new Angular form control from a template in templateRefLibrary
|
|
6948
|
-
const newFormGroup = buildFormGroup(this.templateRefLibrary[ctx.layoutNode.$ref]);
|
|
6967
|
+
const newFormGroup = buildFormGroup(this.templateRefLibrary[ctx.layoutNode().$ref]);
|
|
6949
6968
|
// Add the new form control to the parent formArray or formGroup
|
|
6950
|
-
if (ctx.layoutNode.arrayItem) {
|
|
6969
|
+
if (ctx.layoutNode().arrayItem) {
|
|
6951
6970
|
// Add new array item to formArray
|
|
6952
6971
|
this.getFormControlGroup(ctx).push(newFormGroup);
|
|
6953
6972
|
}
|
|
@@ -6956,10 +6975,10 @@ class JsonSchemaFormService {
|
|
|
6956
6975
|
this.getFormControlGroup(ctx).addControl(name || this.getFormControlName(ctx), newFormGroup);
|
|
6957
6976
|
}
|
|
6958
6977
|
// Copy a new layoutNode from layoutRefLibrary
|
|
6959
|
-
const newLayoutNode = getLayoutNode(ctx.layoutNode, this);
|
|
6960
|
-
newLayoutNode.arrayItem = ctx.layoutNode.arrayItem;
|
|
6961
|
-
if (ctx.layoutNode.arrayItemType) {
|
|
6962
|
-
newLayoutNode.arrayItemType = ctx.layoutNode.arrayItemType;
|
|
6978
|
+
const newLayoutNode = getLayoutNode(ctx.layoutNode(), this);
|
|
6979
|
+
newLayoutNode.arrayItem = ctx.layoutNode().arrayItem;
|
|
6980
|
+
if (ctx.layoutNode().arrayItemType) {
|
|
6981
|
+
newLayoutNode.arrayItemType = ctx.layoutNode().arrayItemType;
|
|
6963
6982
|
}
|
|
6964
6983
|
else {
|
|
6965
6984
|
delete newLayoutNode.arrayItemType;
|
|
@@ -6974,10 +6993,10 @@ class JsonSchemaFormService {
|
|
|
6974
6993
|
return true;
|
|
6975
6994
|
}
|
|
6976
6995
|
moveArrayItem(ctx, oldIndex, newIndex) {
|
|
6977
|
-
if (!ctx.layoutNode ||
|
|
6978
|
-
!isDefined(ctx.layoutNode.dataPointer) ||
|
|
6979
|
-
!hasValue(ctx.dataIndex) ||
|
|
6980
|
-
!hasValue(ctx.layoutIndex) ||
|
|
6996
|
+
if (!ctx || !ctx.layoutNode ||
|
|
6997
|
+
!isDefined(ctx.layoutNode().dataPointer) ||
|
|
6998
|
+
!hasValue(ctx.dataIndex()) ||
|
|
6999
|
+
!hasValue(ctx.layoutIndex()) ||
|
|
6981
7000
|
!isDefined(oldIndex) ||
|
|
6982
7001
|
!isDefined(newIndex) ||
|
|
6983
7002
|
oldIndex === newIndex) {
|
|
@@ -6995,16 +7014,16 @@ class JsonSchemaFormService {
|
|
|
6995
7014
|
return true;
|
|
6996
7015
|
}
|
|
6997
7016
|
removeItem(ctx) {
|
|
6998
|
-
if (!ctx.layoutNode ||
|
|
6999
|
-
!isDefined(ctx.layoutNode.dataPointer) ||
|
|
7000
|
-
!hasValue(ctx.dataIndex) ||
|
|
7001
|
-
!hasValue(ctx.layoutIndex)) {
|
|
7017
|
+
if (!ctx || !ctx.layoutNode ||
|
|
7018
|
+
!isDefined(ctx.layoutNode().dataPointer) ||
|
|
7019
|
+
!hasValue(ctx.dataIndex()) ||
|
|
7020
|
+
!hasValue(ctx.layoutIndex())) {
|
|
7002
7021
|
return false;
|
|
7003
7022
|
}
|
|
7004
7023
|
// Remove the Angular form control from the parent formArray or formGroup
|
|
7005
|
-
if (ctx.layoutNode.arrayItem) {
|
|
7024
|
+
if (ctx.layoutNode().arrayItem) {
|
|
7006
7025
|
// Remove array item from formArray
|
|
7007
|
-
this.getFormControlGroup(ctx).removeAt(ctx.dataIndex[ctx.dataIndex.length - 1]);
|
|
7026
|
+
this.getFormControlGroup(ctx).removeAt(ctx.dataIndex()[ctx.dataIndex().length - 1]);
|
|
7008
7027
|
}
|
|
7009
7028
|
else {
|
|
7010
7029
|
// Remove $ref item from formGroup
|
|
@@ -7022,15 +7041,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7022
7041
|
}], ctorParameters: () => [] });
|
|
7023
7042
|
|
|
7024
7043
|
class AddReferenceComponent {
|
|
7025
|
-
constructor(
|
|
7026
|
-
this.jsf =
|
|
7044
|
+
constructor() {
|
|
7045
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7046
|
+
this.layoutNode = input(undefined);
|
|
7047
|
+
this.layoutIndex = input(undefined);
|
|
7048
|
+
this.dataIndex = input(undefined);
|
|
7027
7049
|
}
|
|
7028
7050
|
ngOnInit() {
|
|
7029
|
-
this.options = this.layoutNode.options || {};
|
|
7051
|
+
this.options = this.layoutNode().options || {};
|
|
7030
7052
|
}
|
|
7031
7053
|
get showAddButton() {
|
|
7032
|
-
return !this.layoutNode.arrayItem ||
|
|
7033
|
-
this.layoutIndex[this.layoutIndex.length - 1] < this.options.maxItems;
|
|
7054
|
+
return !this.layoutNode().arrayItem ||
|
|
7055
|
+
this.layoutIndex()[this.layoutIndex().length - 1] < this.options.maxItems;
|
|
7034
7056
|
}
|
|
7035
7057
|
addItem(event) {
|
|
7036
7058
|
event.preventDefault();
|
|
@@ -7038,22 +7060,22 @@ class AddReferenceComponent {
|
|
|
7038
7060
|
}
|
|
7039
7061
|
get buttonText() {
|
|
7040
7062
|
const parent = {
|
|
7041
|
-
dataIndex: this.dataIndex.slice(0, -1),
|
|
7042
|
-
layoutIndex: this.layoutIndex.slice(0, -1),
|
|
7063
|
+
dataIndex: this.dataIndex().slice(0, -1),
|
|
7064
|
+
layoutIndex: this.layoutIndex().slice(0, -1),
|
|
7043
7065
|
layoutNode: this.jsf.getParentNode(this)
|
|
7044
7066
|
};
|
|
7045
7067
|
return parent.layoutNode.add ||
|
|
7046
|
-
this.jsf.setArrayItemTitle(parent, this.layoutNode, this.itemCount);
|
|
7068
|
+
this.jsf.setArrayItemTitle(parent, this.layoutNode(), this.itemCount);
|
|
7047
7069
|
}
|
|
7048
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddReferenceComponent, deps: [
|
|
7049
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7070
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddReferenceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7071
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: AddReferenceComponent, 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: `
|
|
7050
7072
|
<button *ngIf="showAddButton"
|
|
7051
7073
|
[class]="options?.fieldHtmlClass || ''"
|
|
7052
7074
|
[disabled]="options?.readonly"
|
|
7053
7075
|
(click)="addItem($event)">
|
|
7054
7076
|
<span *ngIf="options?.icon" [class]="options?.icon"></span>
|
|
7055
7077
|
<span *ngIf="options?.title" [innerHTML]="buttonText"></span>
|
|
7056
|
-
</button>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
7078
|
+
</button>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
7057
7079
|
}
|
|
7058
7080
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AddReferenceComponent, decorators: [{
|
|
7059
7081
|
type: Component,
|
|
@@ -7070,22 +7092,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7070
7092
|
</button>`,
|
|
7071
7093
|
changeDetection: ChangeDetectionStrategy.Default,
|
|
7072
7094
|
}]
|
|
7073
|
-
}]
|
|
7074
|
-
type: Input
|
|
7075
|
-
}], layoutIndex: [{
|
|
7076
|
-
type: Input
|
|
7077
|
-
}], dataIndex: [{
|
|
7078
|
-
type: Input
|
|
7079
|
-
}] } });
|
|
7095
|
+
}] });
|
|
7080
7096
|
|
|
7081
7097
|
class ButtonComponent {
|
|
7082
|
-
constructor(
|
|
7083
|
-
this.jsf =
|
|
7098
|
+
constructor() {
|
|
7099
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7084
7100
|
this.controlDisabled = false;
|
|
7085
7101
|
this.boundControl = false;
|
|
7102
|
+
this.layoutNode = input(undefined);
|
|
7103
|
+
this.layoutIndex = input(undefined);
|
|
7104
|
+
this.dataIndex = input(undefined);
|
|
7086
7105
|
}
|
|
7087
7106
|
ngOnInit() {
|
|
7088
|
-
this.options = this.layoutNode.options || {};
|
|
7107
|
+
this.options = this.layoutNode().options || {};
|
|
7089
7108
|
this.jsf.initializeControl(this);
|
|
7090
7109
|
}
|
|
7091
7110
|
updateValue(event) {
|
|
@@ -7096,24 +7115,24 @@ class ButtonComponent {
|
|
|
7096
7115
|
this.jsf.updateValue(this, event.target.value);
|
|
7097
7116
|
}
|
|
7098
7117
|
}
|
|
7099
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ButtonComponent, deps: [
|
|
7100
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7118
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7119
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: ButtonComponent, 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: `
|
|
7101
7120
|
<div
|
|
7102
7121
|
[class]="options?.htmlClass || ''">
|
|
7103
7122
|
<button
|
|
7104
7123
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
7105
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7124
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7106
7125
|
[class]="options?.fieldHtmlClass || ''"
|
|
7107
7126
|
[disabled]="controlDisabled"
|
|
7108
7127
|
[name]="controlName"
|
|
7109
|
-
[type]="layoutNode?.type"
|
|
7128
|
+
[type]="layoutNode()?.type"
|
|
7110
7129
|
[value]="controlValue"
|
|
7111
7130
|
(click)="updateValue($event)">
|
|
7112
7131
|
<span *ngIf="options?.icon || options?.title"
|
|
7113
7132
|
[class]="options?.icon"
|
|
7114
7133
|
[innerHTML]="options?.title"></span>
|
|
7115
7134
|
</button>
|
|
7116
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
7135
|
+
</div>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
7117
7136
|
}
|
|
7118
7137
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
7119
7138
|
type: Component,
|
|
@@ -7125,11 +7144,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7125
7144
|
[class]="options?.htmlClass || ''">
|
|
7126
7145
|
<button
|
|
7127
7146
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
7128
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7147
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7129
7148
|
[class]="options?.fieldHtmlClass || ''"
|
|
7130
7149
|
[disabled]="controlDisabled"
|
|
7131
7150
|
[name]="controlName"
|
|
7132
|
-
[type]="layoutNode?.type"
|
|
7151
|
+
[type]="layoutNode()?.type"
|
|
7133
7152
|
[value]="controlValue"
|
|
7134
7153
|
(click)="updateValue($event)">
|
|
7135
7154
|
<span *ngIf="options?.icon || options?.title"
|
|
@@ -7138,24 +7157,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7138
7157
|
</button>
|
|
7139
7158
|
</div>`,
|
|
7140
7159
|
}]
|
|
7141
|
-
}]
|
|
7142
|
-
type: Input
|
|
7143
|
-
}], layoutIndex: [{
|
|
7144
|
-
type: Input
|
|
7145
|
-
}], dataIndex: [{
|
|
7146
|
-
type: Input
|
|
7147
|
-
}] } });
|
|
7160
|
+
}] });
|
|
7148
7161
|
|
|
7149
7162
|
class CheckboxComponent {
|
|
7150
|
-
constructor(
|
|
7151
|
-
this.jsf =
|
|
7163
|
+
constructor() {
|
|
7164
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7152
7165
|
this.controlDisabled = false;
|
|
7153
7166
|
this.boundControl = false;
|
|
7154
7167
|
this.trueValue = true;
|
|
7155
7168
|
this.falseValue = false;
|
|
7169
|
+
this.layoutNode = input(undefined);
|
|
7170
|
+
this.layoutIndex = input(undefined);
|
|
7171
|
+
this.dataIndex = input(undefined);
|
|
7156
7172
|
}
|
|
7157
7173
|
ngOnInit() {
|
|
7158
|
-
this.options = this.layoutNode.options || {};
|
|
7174
|
+
this.options = this.layoutNode().options || {};
|
|
7159
7175
|
this.jsf.initializeControl(this);
|
|
7160
7176
|
if (this.controlValue === null || this.controlValue === undefined) {
|
|
7161
7177
|
this.controlValue = this.options.title;
|
|
@@ -7168,29 +7184,29 @@ class CheckboxComponent {
|
|
|
7168
7184
|
get isChecked() {
|
|
7169
7185
|
return this.jsf.getFormControlValue(this) === this.trueValue;
|
|
7170
7186
|
}
|
|
7171
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxComponent, deps: [
|
|
7172
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7187
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7188
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: CheckboxComponent, 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: `
|
|
7173
7189
|
<label
|
|
7174
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
7190
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
7175
7191
|
[class]="options?.itemLabelHtmlClass || ''">
|
|
7176
7192
|
<input *ngIf="boundControl"
|
|
7177
7193
|
[formControl]="formControl"
|
|
7178
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7194
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7179
7195
|
[class]="(options?.fieldHtmlClass || '') + (isChecked ?
|
|
7180
7196
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7181
7197
|
(' ' + (options?.style?.unselected || '')))"
|
|
7182
|
-
[id]="'control' + layoutNode?._id"
|
|
7198
|
+
[id]="'control' + layoutNode()?._id"
|
|
7183
7199
|
[name]="controlName"
|
|
7184
7200
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7185
7201
|
type="checkbox">
|
|
7186
7202
|
<input *ngIf="!boundControl"
|
|
7187
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7203
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7188
7204
|
[checked]="isChecked ? 'checked' : null"
|
|
7189
7205
|
[class]="(options?.fieldHtmlClass || '') + (isChecked ?
|
|
7190
7206
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7191
7207
|
(' ' + (options?.style?.unselected || '')))"
|
|
7192
7208
|
[disabled]="controlDisabled"
|
|
7193
|
-
[id]="'control' + layoutNode?._id"
|
|
7209
|
+
[id]="'control' + layoutNode()?._id"
|
|
7194
7210
|
[name]="controlName"
|
|
7195
7211
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7196
7212
|
[value]="controlValue"
|
|
@@ -7199,7 +7215,7 @@ class CheckboxComponent {
|
|
|
7199
7215
|
<span *ngIf="options?.title"
|
|
7200
7216
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7201
7217
|
[innerHTML]="options?.title"></span>
|
|
7202
|
-
</label>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
7218
|
+
</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"] }] }); }
|
|
7203
7219
|
}
|
|
7204
7220
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
7205
7221
|
type: Component,
|
|
@@ -7208,26 +7224,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7208
7224
|
selector: 'checkbox-widget',
|
|
7209
7225
|
template: `
|
|
7210
7226
|
<label
|
|
7211
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
7227
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
7212
7228
|
[class]="options?.itemLabelHtmlClass || ''">
|
|
7213
7229
|
<input *ngIf="boundControl"
|
|
7214
7230
|
[formControl]="formControl"
|
|
7215
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7231
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7216
7232
|
[class]="(options?.fieldHtmlClass || '') + (isChecked ?
|
|
7217
7233
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7218
7234
|
(' ' + (options?.style?.unselected || '')))"
|
|
7219
|
-
[id]="'control' + layoutNode?._id"
|
|
7235
|
+
[id]="'control' + layoutNode()?._id"
|
|
7220
7236
|
[name]="controlName"
|
|
7221
7237
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7222
7238
|
type="checkbox">
|
|
7223
7239
|
<input *ngIf="!boundControl"
|
|
7224
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7240
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7225
7241
|
[checked]="isChecked ? 'checked' : null"
|
|
7226
7242
|
[class]="(options?.fieldHtmlClass || '') + (isChecked ?
|
|
7227
7243
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7228
7244
|
(' ' + (options?.style?.unselected || '')))"
|
|
7229
7245
|
[disabled]="controlDisabled"
|
|
7230
|
-
[id]="'control' + layoutNode?._id"
|
|
7246
|
+
[id]="'control' + layoutNode()?._id"
|
|
7231
7247
|
[name]="controlName"
|
|
7232
7248
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7233
7249
|
[value]="controlValue"
|
|
@@ -7238,25 +7254,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7238
7254
|
[innerHTML]="options?.title"></span>
|
|
7239
7255
|
</label>`,
|
|
7240
7256
|
}]
|
|
7241
|
-
}]
|
|
7242
|
-
type: Input
|
|
7243
|
-
}], layoutIndex: [{
|
|
7244
|
-
type: Input
|
|
7245
|
-
}], dataIndex: [{
|
|
7246
|
-
type: Input
|
|
7247
|
-
}] } });
|
|
7257
|
+
}] });
|
|
7248
7258
|
|
|
7249
7259
|
class CheckboxesComponent {
|
|
7250
|
-
constructor(
|
|
7251
|
-
this.jsf =
|
|
7260
|
+
constructor() {
|
|
7261
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7252
7262
|
this.controlDisabled = false;
|
|
7253
7263
|
this.boundControl = false;
|
|
7254
7264
|
this.checkboxList = [];
|
|
7265
|
+
this.layoutNode = input(undefined);
|
|
7266
|
+
this.layoutIndex = input(undefined);
|
|
7267
|
+
this.dataIndex = input(undefined);
|
|
7255
7268
|
}
|
|
7256
7269
|
ngOnInit() {
|
|
7257
|
-
this.options = this.layoutNode.options || {};
|
|
7258
|
-
|
|
7259
|
-
|
|
7270
|
+
this.options = this.layoutNode().options || {};
|
|
7271
|
+
const layoutNode = this.layoutNode();
|
|
7272
|
+
this.layoutOrientation = (layoutNode.type === 'checkboxes-inline' ||
|
|
7273
|
+
layoutNode.type === 'checkboxbuttons') ? 'horizontal' : 'vertical';
|
|
7260
7274
|
this.jsf.initializeControl(this);
|
|
7261
7275
|
this.checkboxList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, true);
|
|
7262
7276
|
if (this.boundControl) {
|
|
@@ -7274,8 +7288,8 @@ class CheckboxesComponent {
|
|
|
7274
7288
|
this.jsf.updateArrayCheckboxList(this, this.checkboxList);
|
|
7275
7289
|
}
|
|
7276
7290
|
}
|
|
7277
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxesComponent, deps: [
|
|
7278
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7291
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7292
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: CheckboxesComponent, 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: `
|
|
7279
7293
|
<label *ngIf="options?.title"
|
|
7280
7294
|
[class]="options?.labelHtmlClass || ''"
|
|
7281
7295
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
@@ -7284,7 +7298,7 @@ class CheckboxesComponent {
|
|
|
7284
7298
|
<!-- 'horizontal' = checkboxes-inline or checkboxbuttons -->
|
|
7285
7299
|
<div *ngIf="layoutOrientation === 'horizontal'" [class]="options?.htmlClass || ''">
|
|
7286
7300
|
<label *ngFor="let checkboxItem of checkboxList"
|
|
7287
|
-
[attr.for]="'control' + layoutNode?._id + '/' + checkboxItem.value"
|
|
7301
|
+
[attr.for]="'control' + layoutNode()?._id + '/' + checkboxItem.value"
|
|
7288
7302
|
[class]="(options?.itemLabelHtmlClass || '') + (checkboxItem.checked ?
|
|
7289
7303
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7290
7304
|
(' ' + (options?.style?.unselected || '')))">
|
|
@@ -7293,7 +7307,7 @@ class CheckboxesComponent {
|
|
|
7293
7307
|
[checked]="checkboxItem.checked"
|
|
7294
7308
|
[class]="options?.fieldHtmlClass || ''"
|
|
7295
7309
|
[disabled]="controlDisabled"
|
|
7296
|
-
[id]="'control' + layoutNode?._id + '/' + checkboxItem.value"
|
|
7310
|
+
[id]="'control' + layoutNode()?._id + '/' + checkboxItem.value"
|
|
7297
7311
|
[name]="checkboxItem?.name"
|
|
7298
7312
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7299
7313
|
[value]="checkboxItem.value"
|
|
@@ -7306,7 +7320,7 @@ class CheckboxesComponent {
|
|
|
7306
7320
|
<div *ngIf="layoutOrientation === 'vertical'">
|
|
7307
7321
|
<div *ngFor="let checkboxItem of checkboxList" [class]="options?.htmlClass || ''">
|
|
7308
7322
|
<label
|
|
7309
|
-
[attr.for]="'control' + layoutNode?._id + '/' + checkboxItem.value"
|
|
7323
|
+
[attr.for]="'control' + layoutNode()?._id + '/' + checkboxItem.value"
|
|
7310
7324
|
[class]="(options?.itemLabelHtmlClass || '') + (checkboxItem.checked ?
|
|
7311
7325
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7312
7326
|
(' ' + (options?.style?.unselected || '')))">
|
|
@@ -7323,7 +7337,7 @@ class CheckboxesComponent {
|
|
|
7323
7337
|
<span [innerHTML]="checkboxItem?.name"></span>
|
|
7324
7338
|
</label>
|
|
7325
7339
|
</div>
|
|
7326
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
7340
|
+
</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"] }] }); }
|
|
7327
7341
|
}
|
|
7328
7342
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: CheckboxesComponent, decorators: [{
|
|
7329
7343
|
type: Component,
|
|
@@ -7339,7 +7353,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7339
7353
|
<!-- 'horizontal' = checkboxes-inline or checkboxbuttons -->
|
|
7340
7354
|
<div *ngIf="layoutOrientation === 'horizontal'" [class]="options?.htmlClass || ''">
|
|
7341
7355
|
<label *ngFor="let checkboxItem of checkboxList"
|
|
7342
|
-
[attr.for]="'control' + layoutNode?._id + '/' + checkboxItem.value"
|
|
7356
|
+
[attr.for]="'control' + layoutNode()?._id + '/' + checkboxItem.value"
|
|
7343
7357
|
[class]="(options?.itemLabelHtmlClass || '') + (checkboxItem.checked ?
|
|
7344
7358
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7345
7359
|
(' ' + (options?.style?.unselected || '')))">
|
|
@@ -7348,7 +7362,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7348
7362
|
[checked]="checkboxItem.checked"
|
|
7349
7363
|
[class]="options?.fieldHtmlClass || ''"
|
|
7350
7364
|
[disabled]="controlDisabled"
|
|
7351
|
-
[id]="'control' + layoutNode?._id + '/' + checkboxItem.value"
|
|
7365
|
+
[id]="'control' + layoutNode()?._id + '/' + checkboxItem.value"
|
|
7352
7366
|
[name]="checkboxItem?.name"
|
|
7353
7367
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7354
7368
|
[value]="checkboxItem.value"
|
|
@@ -7361,7 +7375,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7361
7375
|
<div *ngIf="layoutOrientation === 'vertical'">
|
|
7362
7376
|
<div *ngFor="let checkboxItem of checkboxList" [class]="options?.htmlClass || ''">
|
|
7363
7377
|
<label
|
|
7364
|
-
[attr.for]="'control' + layoutNode?._id + '/' + checkboxItem.value"
|
|
7378
|
+
[attr.for]="'control' + layoutNode()?._id + '/' + checkboxItem.value"
|
|
7365
7379
|
[class]="(options?.itemLabelHtmlClass || '') + (checkboxItem.checked ?
|
|
7366
7380
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7367
7381
|
(' ' + (options?.style?.unselected || '')))">
|
|
@@ -7380,30 +7394,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7380
7394
|
</div>
|
|
7381
7395
|
</div>`,
|
|
7382
7396
|
}]
|
|
7383
|
-
}]
|
|
7384
|
-
type: Input
|
|
7385
|
-
}], layoutIndex: [{
|
|
7386
|
-
type: Input
|
|
7387
|
-
}], dataIndex: [{
|
|
7388
|
-
type: Input
|
|
7389
|
-
}] } });
|
|
7397
|
+
}] });
|
|
7390
7398
|
|
|
7391
7399
|
// TODO: Add this control
|
|
7392
7400
|
class FileComponent {
|
|
7393
|
-
constructor(
|
|
7394
|
-
this.jsf =
|
|
7401
|
+
constructor() {
|
|
7402
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7395
7403
|
this.controlDisabled = false;
|
|
7396
7404
|
this.boundControl = false;
|
|
7405
|
+
this.layoutNode = input(undefined);
|
|
7406
|
+
this.layoutIndex = input(undefined);
|
|
7407
|
+
this.dataIndex = input(undefined);
|
|
7397
7408
|
}
|
|
7398
7409
|
ngOnInit() {
|
|
7399
|
-
this.options = this.layoutNode.options || {};
|
|
7410
|
+
this.options = this.layoutNode().options || {};
|
|
7400
7411
|
this.jsf.initializeControl(this);
|
|
7401
7412
|
}
|
|
7402
7413
|
updateValue(event) {
|
|
7403
7414
|
this.jsf.updateValue(this, event.target.value);
|
|
7404
7415
|
}
|
|
7405
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileComponent, deps: [
|
|
7406
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7416
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7417
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: FileComponent, 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 }); }
|
|
7407
7418
|
}
|
|
7408
7419
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FileComponent, decorators: [{
|
|
7409
7420
|
type: Component,
|
|
@@ -7412,53 +7423,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7412
7423
|
selector: 'file-widget',
|
|
7413
7424
|
template: ``,
|
|
7414
7425
|
}]
|
|
7415
|
-
}]
|
|
7416
|
-
type: Input
|
|
7417
|
-
}], layoutIndex: [{
|
|
7418
|
-
type: Input
|
|
7419
|
-
}], dataIndex: [{
|
|
7420
|
-
type: Input
|
|
7421
|
-
}] } });
|
|
7426
|
+
}] });
|
|
7422
7427
|
|
|
7423
7428
|
class InputComponent {
|
|
7424
|
-
constructor(
|
|
7425
|
-
this.jsf =
|
|
7429
|
+
constructor() {
|
|
7430
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7426
7431
|
this.controlDisabled = false;
|
|
7427
7432
|
this.boundControl = false;
|
|
7428
7433
|
this.autoCompleteList = [];
|
|
7434
|
+
this.layoutNode = input(undefined);
|
|
7435
|
+
this.layoutIndex = input(undefined);
|
|
7436
|
+
this.dataIndex = input(undefined);
|
|
7429
7437
|
}
|
|
7430
7438
|
ngOnInit() {
|
|
7431
|
-
this.options = this.layoutNode.options || {};
|
|
7439
|
+
this.options = this.layoutNode().options || {};
|
|
7432
7440
|
this.jsf.initializeControl(this);
|
|
7433
7441
|
}
|
|
7434
7442
|
updateValue(event) {
|
|
7435
7443
|
this.jsf.updateValue(this, event.target.value);
|
|
7436
7444
|
}
|
|
7437
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputComponent, deps: [
|
|
7438
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7445
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7446
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: InputComponent, 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: `
|
|
7439
7447
|
<div [class]="options?.htmlClass || ''">
|
|
7440
7448
|
<label *ngIf="options?.title"
|
|
7441
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
7449
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
7442
7450
|
[class]="options?.labelHtmlClass || ''"
|
|
7443
7451
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7444
7452
|
[innerHTML]="options?.title"></label>
|
|
7445
7453
|
<input *ngIf="boundControl"
|
|
7446
7454
|
[formControl]="formControl"
|
|
7447
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7448
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
7455
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7456
|
+
[attr.list]="'control' + layoutNode()?._id + 'Autocomplete'"
|
|
7449
7457
|
[attr.maxlength]="options?.maxLength"
|
|
7450
7458
|
[attr.minlength]="options?.minLength"
|
|
7451
7459
|
[attr.pattern]="options?.pattern"
|
|
7452
7460
|
[attr.placeholder]="options?.placeholder"
|
|
7453
7461
|
[attr.required]="options?.required"
|
|
7454
7462
|
[class]="options?.fieldHtmlClass || ''"
|
|
7455
|
-
[id]="'control' + layoutNode?._id"
|
|
7463
|
+
[id]="'control' + layoutNode()?._id"
|
|
7456
7464
|
[name]="controlName"
|
|
7457
7465
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7458
|
-
[type]="layoutNode?.type">
|
|
7466
|
+
[type]="layoutNode()?.type">
|
|
7459
7467
|
<input *ngIf="!boundControl"
|
|
7460
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7461
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
7468
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7469
|
+
[attr.list]="'control' + layoutNode()?._id + 'Autocomplete'"
|
|
7462
7470
|
[attr.maxlength]="options?.maxLength"
|
|
7463
7471
|
[attr.minlength]="options?.minLength"
|
|
7464
7472
|
[attr.pattern]="options?.pattern"
|
|
@@ -7466,17 +7474,17 @@ class InputComponent {
|
|
|
7466
7474
|
[attr.required]="options?.required"
|
|
7467
7475
|
[class]="options?.fieldHtmlClass || ''"
|
|
7468
7476
|
[disabled]="controlDisabled"
|
|
7469
|
-
[id]="'control' + layoutNode?._id"
|
|
7477
|
+
[id]="'control' + layoutNode()?._id"
|
|
7470
7478
|
[name]="controlName"
|
|
7471
7479
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7472
|
-
[type]="layoutNode?.type"
|
|
7480
|
+
[type]="layoutNode()?.type"
|
|
7473
7481
|
[value]="controlValue"
|
|
7474
7482
|
(input)="updateValue($event)">
|
|
7475
7483
|
<datalist *ngIf="options?.typeahead?.source"
|
|
7476
|
-
[id]="'control' + layoutNode?._id + 'Autocomplete'">
|
|
7484
|
+
[id]="'control' + layoutNode()?._id + 'Autocomplete'">
|
|
7477
7485
|
<option *ngFor="let word of options?.typeahead?.source" [value]="word">
|
|
7478
7486
|
</datalist>
|
|
7479
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
7487
|
+
</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"] }] }); }
|
|
7480
7488
|
}
|
|
7481
7489
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputComponent, decorators: [{
|
|
7482
7490
|
type: Component,
|
|
@@ -7486,27 +7494,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7486
7494
|
template: `
|
|
7487
7495
|
<div [class]="options?.htmlClass || ''">
|
|
7488
7496
|
<label *ngIf="options?.title"
|
|
7489
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
7497
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
7490
7498
|
[class]="options?.labelHtmlClass || ''"
|
|
7491
7499
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7492
7500
|
[innerHTML]="options?.title"></label>
|
|
7493
7501
|
<input *ngIf="boundControl"
|
|
7494
7502
|
[formControl]="formControl"
|
|
7495
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7496
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
7503
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7504
|
+
[attr.list]="'control' + layoutNode()?._id + 'Autocomplete'"
|
|
7497
7505
|
[attr.maxlength]="options?.maxLength"
|
|
7498
7506
|
[attr.minlength]="options?.minLength"
|
|
7499
7507
|
[attr.pattern]="options?.pattern"
|
|
7500
7508
|
[attr.placeholder]="options?.placeholder"
|
|
7501
7509
|
[attr.required]="options?.required"
|
|
7502
7510
|
[class]="options?.fieldHtmlClass || ''"
|
|
7503
|
-
[id]="'control' + layoutNode?._id"
|
|
7511
|
+
[id]="'control' + layoutNode()?._id"
|
|
7504
7512
|
[name]="controlName"
|
|
7505
7513
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7506
|
-
[type]="layoutNode?.type">
|
|
7514
|
+
[type]="layoutNode()?.type">
|
|
7507
7515
|
<input *ngIf="!boundControl"
|
|
7508
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7509
|
-
[attr.list]="'control' + layoutNode?._id + 'Autocomplete'"
|
|
7516
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7517
|
+
[attr.list]="'control' + layoutNode()?._id + 'Autocomplete'"
|
|
7510
7518
|
[attr.maxlength]="options?.maxLength"
|
|
7511
7519
|
[attr.minlength]="options?.minLength"
|
|
7512
7520
|
[attr.pattern]="options?.pattern"
|
|
@@ -7514,41 +7522,38 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7514
7522
|
[attr.required]="options?.required"
|
|
7515
7523
|
[class]="options?.fieldHtmlClass || ''"
|
|
7516
7524
|
[disabled]="controlDisabled"
|
|
7517
|
-
[id]="'control' + layoutNode?._id"
|
|
7525
|
+
[id]="'control' + layoutNode()?._id"
|
|
7518
7526
|
[name]="controlName"
|
|
7519
7527
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7520
|
-
[type]="layoutNode?.type"
|
|
7528
|
+
[type]="layoutNode()?.type"
|
|
7521
7529
|
[value]="controlValue"
|
|
7522
7530
|
(input)="updateValue($event)">
|
|
7523
7531
|
<datalist *ngIf="options?.typeahead?.source"
|
|
7524
|
-
[id]="'control' + layoutNode?._id + 'Autocomplete'">
|
|
7532
|
+
[id]="'control' + layoutNode()?._id + 'Autocomplete'">
|
|
7525
7533
|
<option *ngFor="let word of options?.typeahead?.source" [value]="word">
|
|
7526
7534
|
</datalist>
|
|
7527
7535
|
</div>`,
|
|
7528
7536
|
}]
|
|
7529
|
-
}]
|
|
7530
|
-
type: Input
|
|
7531
|
-
}], layoutIndex: [{
|
|
7532
|
-
type: Input
|
|
7533
|
-
}], dataIndex: [{
|
|
7534
|
-
type: Input
|
|
7535
|
-
}] } });
|
|
7537
|
+
}] });
|
|
7536
7538
|
|
|
7537
7539
|
class MessageComponent {
|
|
7538
|
-
constructor(
|
|
7539
|
-
this.jsf =
|
|
7540
|
+
constructor() {
|
|
7541
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7540
7542
|
this.message = null;
|
|
7543
|
+
this.layoutNode = input(undefined);
|
|
7544
|
+
this.layoutIndex = input(undefined);
|
|
7545
|
+
this.dataIndex = input(undefined);
|
|
7541
7546
|
}
|
|
7542
7547
|
ngOnInit() {
|
|
7543
|
-
this.options = this.layoutNode.options || {};
|
|
7548
|
+
this.options = this.layoutNode().options || {};
|
|
7544
7549
|
this.message = this.options.help || this.options.helpvalue ||
|
|
7545
7550
|
this.options.msg || this.options.message;
|
|
7546
7551
|
}
|
|
7547
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MessageComponent, deps: [
|
|
7548
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7552
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7553
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: MessageComponent, 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: `
|
|
7549
7554
|
<span *ngIf="message"
|
|
7550
7555
|
[class]="options?.labelHtmlClass || ''"
|
|
7551
|
-
[innerHTML]="message"></span>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
7556
|
+
[innerHTML]="message"></span>`, isInline: true, dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
7552
7557
|
}
|
|
7553
7558
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MessageComponent, decorators: [{
|
|
7554
7559
|
type: Component,
|
|
@@ -7560,17 +7565,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7560
7565
|
[class]="options?.labelHtmlClass || ''"
|
|
7561
7566
|
[innerHTML]="message"></span>`,
|
|
7562
7567
|
}]
|
|
7563
|
-
}]
|
|
7564
|
-
type: Input
|
|
7565
|
-
}], layoutIndex: [{
|
|
7566
|
-
type: Input
|
|
7567
|
-
}], dataIndex: [{
|
|
7568
|
-
type: Input
|
|
7569
|
-
}] } });
|
|
7568
|
+
}] });
|
|
7570
7569
|
|
|
7571
7570
|
class NoneComponent {
|
|
7571
|
+
constructor() {
|
|
7572
|
+
this.layoutNode = input(undefined);
|
|
7573
|
+
this.layoutIndex = input(undefined);
|
|
7574
|
+
this.dataIndex = input(undefined);
|
|
7575
|
+
}
|
|
7572
7576
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7573
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7577
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: NoneComponent, 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 }); }
|
|
7574
7578
|
}
|
|
7575
7579
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NoneComponent, decorators: [{
|
|
7576
7580
|
type: Component,
|
|
@@ -7579,45 +7583,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7579
7583
|
selector: 'none-widget',
|
|
7580
7584
|
template: ``,
|
|
7581
7585
|
}]
|
|
7582
|
-
}]
|
|
7583
|
-
type: Input
|
|
7584
|
-
}], layoutIndex: [{
|
|
7585
|
-
type: Input
|
|
7586
|
-
}], dataIndex: [{
|
|
7587
|
-
type: Input
|
|
7588
|
-
}] } });
|
|
7586
|
+
}] });
|
|
7589
7587
|
|
|
7590
7588
|
class NumberComponent {
|
|
7591
|
-
constructor(
|
|
7592
|
-
this.jsf =
|
|
7589
|
+
constructor() {
|
|
7590
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7593
7591
|
this.controlDisabled = false;
|
|
7594
7592
|
this.boundControl = false;
|
|
7595
7593
|
this.allowNegative = true;
|
|
7596
7594
|
this.allowDecimal = true;
|
|
7597
7595
|
this.allowExponents = false;
|
|
7598
7596
|
this.lastValidNumber = '';
|
|
7597
|
+
this.layoutNode = input(undefined);
|
|
7598
|
+
this.layoutIndex = input(undefined);
|
|
7599
|
+
this.dataIndex = input(undefined);
|
|
7599
7600
|
}
|
|
7600
7601
|
ngOnInit() {
|
|
7601
|
-
this.options = this.layoutNode.options || {};
|
|
7602
|
+
this.options = this.layoutNode().options || {};
|
|
7602
7603
|
this.jsf.initializeControl(this);
|
|
7603
|
-
if (this.layoutNode.dataType === 'integer') {
|
|
7604
|
+
if (this.layoutNode().dataType === 'integer') {
|
|
7604
7605
|
this.allowDecimal = false;
|
|
7605
7606
|
}
|
|
7606
7607
|
}
|
|
7607
7608
|
updateValue(event) {
|
|
7608
7609
|
this.jsf.updateValue(this, event.target.value);
|
|
7609
7610
|
}
|
|
7610
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NumberComponent, deps: [
|
|
7611
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7611
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7612
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: NumberComponent, 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 } }, ngImport: i0, template: `
|
|
7612
7613
|
<div [class]="options?.htmlClass || ''">
|
|
7613
7614
|
<label *ngIf="options?.title"
|
|
7614
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
7615
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
7615
7616
|
[class]="options?.labelHtmlClass || ''"
|
|
7616
7617
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7617
7618
|
[innerHTML]="options?.title"></label>
|
|
7618
7619
|
<input *ngIf="boundControl"
|
|
7619
7620
|
[formControl]="formControl"
|
|
7620
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7621
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7621
7622
|
[attr.max]="options?.maximum"
|
|
7622
7623
|
[attr.min]="options?.minimum"
|
|
7623
7624
|
[attr.placeholder]="options?.placeholder"
|
|
@@ -7625,13 +7626,13 @@ class NumberComponent {
|
|
|
7625
7626
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
7626
7627
|
[attr.step]="options?.multipleOf || options?.step || 'any'"
|
|
7627
7628
|
[class]="options?.fieldHtmlClass || ''"
|
|
7628
|
-
[id]="'control' + layoutNode?._id"
|
|
7629
|
+
[id]="'control' + layoutNode()?._id"
|
|
7629
7630
|
[name]="controlName"
|
|
7630
7631
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7631
7632
|
[title]="lastValidNumber"
|
|
7632
|
-
[type]="layoutNode?.type === 'range' ? 'range' : 'number'">
|
|
7633
|
+
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'">
|
|
7633
7634
|
<input *ngIf="!boundControl"
|
|
7634
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7635
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7635
7636
|
[attr.max]="options?.maximum"
|
|
7636
7637
|
[attr.min]="options?.minimum"
|
|
7637
7638
|
[attr.placeholder]="options?.placeholder"
|
|
@@ -7640,15 +7641,15 @@ class NumberComponent {
|
|
|
7640
7641
|
[attr.step]="options?.multipleOf || options?.step || 'any'"
|
|
7641
7642
|
[class]="options?.fieldHtmlClass || ''"
|
|
7642
7643
|
[disabled]="controlDisabled"
|
|
7643
|
-
[id]="'control' + layoutNode?._id"
|
|
7644
|
+
[id]="'control' + layoutNode()?._id"
|
|
7644
7645
|
[name]="controlName"
|
|
7645
7646
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7646
7647
|
[title]="lastValidNumber"
|
|
7647
|
-
[type]="layoutNode?.type === 'range' ? 'range' : 'number'"
|
|
7648
|
+
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
|
|
7648
7649
|
[value]="controlValue"
|
|
7649
7650
|
(input)="updateValue($event)">
|
|
7650
|
-
<span *ngIf="layoutNode?.type === 'range'" [innerHTML]="controlValue"></span>
|
|
7651
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
7651
|
+
<span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
|
|
7652
|
+
</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"] }] }); }
|
|
7652
7653
|
}
|
|
7653
7654
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NumberComponent, decorators: [{
|
|
7654
7655
|
type: Component,
|
|
@@ -7658,13 +7659,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7658
7659
|
template: `
|
|
7659
7660
|
<div [class]="options?.htmlClass || ''">
|
|
7660
7661
|
<label *ngIf="options?.title"
|
|
7661
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
7662
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
7662
7663
|
[class]="options?.labelHtmlClass || ''"
|
|
7663
7664
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7664
7665
|
[innerHTML]="options?.title"></label>
|
|
7665
7666
|
<input *ngIf="boundControl"
|
|
7666
7667
|
[formControl]="formControl"
|
|
7667
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7668
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7668
7669
|
[attr.max]="options?.maximum"
|
|
7669
7670
|
[attr.min]="options?.minimum"
|
|
7670
7671
|
[attr.placeholder]="options?.placeholder"
|
|
@@ -7672,13 +7673,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7672
7673
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
7673
7674
|
[attr.step]="options?.multipleOf || options?.step || 'any'"
|
|
7674
7675
|
[class]="options?.fieldHtmlClass || ''"
|
|
7675
|
-
[id]="'control' + layoutNode?._id"
|
|
7676
|
+
[id]="'control' + layoutNode()?._id"
|
|
7676
7677
|
[name]="controlName"
|
|
7677
7678
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7678
7679
|
[title]="lastValidNumber"
|
|
7679
|
-
[type]="layoutNode?.type === 'range' ? 'range' : 'number'">
|
|
7680
|
+
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'">
|
|
7680
7681
|
<input *ngIf="!boundControl"
|
|
7681
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7682
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7682
7683
|
[attr.max]="options?.maximum"
|
|
7683
7684
|
[attr.min]="options?.minimum"
|
|
7684
7685
|
[attr.placeholder]="options?.placeholder"
|
|
@@ -7687,40 +7688,37 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7687
7688
|
[attr.step]="options?.multipleOf || options?.step || 'any'"
|
|
7688
7689
|
[class]="options?.fieldHtmlClass || ''"
|
|
7689
7690
|
[disabled]="controlDisabled"
|
|
7690
|
-
[id]="'control' + layoutNode?._id"
|
|
7691
|
+
[id]="'control' + layoutNode()?._id"
|
|
7691
7692
|
[name]="controlName"
|
|
7692
7693
|
[readonly]="options?.readonly ? 'readonly' : null"
|
|
7693
7694
|
[title]="lastValidNumber"
|
|
7694
|
-
[type]="layoutNode?.type === 'range' ? 'range' : 'number'"
|
|
7695
|
+
[type]="layoutNode()?.type === 'range' ? 'range' : 'number'"
|
|
7695
7696
|
[value]="controlValue"
|
|
7696
7697
|
(input)="updateValue($event)">
|
|
7697
|
-
<span *ngIf="layoutNode?.type === 'range'" [innerHTML]="controlValue"></span>
|
|
7698
|
+
<span *ngIf="layoutNode()?.type === 'range'" [innerHTML]="controlValue"></span>
|
|
7698
7699
|
</div>`,
|
|
7699
7700
|
}]
|
|
7700
|
-
}]
|
|
7701
|
-
type: Input
|
|
7702
|
-
}], layoutIndex: [{
|
|
7703
|
-
type: Input
|
|
7704
|
-
}], dataIndex: [{
|
|
7705
|
-
type: Input
|
|
7706
|
-
}] } });
|
|
7701
|
+
}] });
|
|
7707
7702
|
|
|
7708
7703
|
// TODO: Add this control
|
|
7709
7704
|
class OneOfComponent {
|
|
7710
|
-
constructor(
|
|
7711
|
-
this.jsf =
|
|
7705
|
+
constructor() {
|
|
7706
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7712
7707
|
this.controlDisabled = false;
|
|
7713
7708
|
this.boundControl = false;
|
|
7709
|
+
this.layoutNode = input(undefined);
|
|
7710
|
+
this.layoutIndex = input(undefined);
|
|
7711
|
+
this.dataIndex = input(undefined);
|
|
7714
7712
|
}
|
|
7715
7713
|
ngOnInit() {
|
|
7716
|
-
this.options = this.layoutNode.options || {};
|
|
7714
|
+
this.options = this.layoutNode().options || {};
|
|
7717
7715
|
this.jsf.initializeControl(this);
|
|
7718
7716
|
}
|
|
7719
7717
|
updateValue(event) {
|
|
7720
7718
|
this.jsf.updateValue(this, event.target.value);
|
|
7721
7719
|
}
|
|
7722
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OneOfComponent, deps: [
|
|
7723
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7720
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OneOfComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7721
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: OneOfComponent, 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 }); }
|
|
7724
7722
|
}
|
|
7725
7723
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OneOfComponent, decorators: [{
|
|
7726
7724
|
type: Component,
|
|
@@ -7729,26 +7727,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7729
7727
|
selector: 'one-of-widget',
|
|
7730
7728
|
template: ``,
|
|
7731
7729
|
}]
|
|
7732
|
-
}]
|
|
7733
|
-
type: Input
|
|
7734
|
-
}], layoutIndex: [{
|
|
7735
|
-
type: Input
|
|
7736
|
-
}], dataIndex: [{
|
|
7737
|
-
type: Input
|
|
7738
|
-
}] } });
|
|
7730
|
+
}] });
|
|
7739
7731
|
|
|
7740
7732
|
class RadiosComponent {
|
|
7741
|
-
constructor(
|
|
7742
|
-
this.jsf =
|
|
7733
|
+
constructor() {
|
|
7734
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7743
7735
|
this.controlDisabled = false;
|
|
7744
7736
|
this.boundControl = false;
|
|
7745
7737
|
this.layoutOrientation = 'vertical';
|
|
7746
7738
|
this.radiosList = [];
|
|
7739
|
+
this.layoutNode = input(undefined);
|
|
7740
|
+
this.layoutIndex = input(undefined);
|
|
7741
|
+
this.dataIndex = input(undefined);
|
|
7747
7742
|
}
|
|
7748
7743
|
ngOnInit() {
|
|
7749
|
-
this.options = this.layoutNode.options || {};
|
|
7750
|
-
|
|
7751
|
-
|
|
7744
|
+
this.options = this.layoutNode().options || {};
|
|
7745
|
+
const layoutNode = this.layoutNode();
|
|
7746
|
+
if (layoutNode.type === 'radios-inline' ||
|
|
7747
|
+
layoutNode.type === 'radiobuttons') {
|
|
7752
7748
|
this.layoutOrientation = 'horizontal';
|
|
7753
7749
|
}
|
|
7754
7750
|
this.radiosList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, true);
|
|
@@ -7757,10 +7753,10 @@ class RadiosComponent {
|
|
|
7757
7753
|
updateValue(event) {
|
|
7758
7754
|
this.jsf.updateValue(this, event.target.value);
|
|
7759
7755
|
}
|
|
7760
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RadiosComponent, deps: [
|
|
7761
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7756
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RadiosComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7757
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: RadiosComponent, 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: `
|
|
7762
7758
|
<label *ngIf="options?.title"
|
|
7763
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
7759
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
7764
7760
|
[class]="options?.labelHtmlClass || ''"
|
|
7765
7761
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7766
7762
|
[innerHTML]="options?.title"></label>
|
|
@@ -7769,19 +7765,19 @@ class RadiosComponent {
|
|
|
7769
7765
|
<div *ngIf="layoutOrientation === 'horizontal'"
|
|
7770
7766
|
[class]="options?.htmlClass || ''">
|
|
7771
7767
|
<label *ngFor="let radioItem of radiosList"
|
|
7772
|
-
[attr.for]="'control' + layoutNode?._id + '/' + radioItem?.value"
|
|
7768
|
+
[attr.for]="'control' + layoutNode()?._id + '/' + radioItem?.value"
|
|
7773
7769
|
[class]="(options?.itemLabelHtmlClass || '') +
|
|
7774
7770
|
((controlValue + '' === radioItem?.value + '') ?
|
|
7775
7771
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7776
7772
|
(' ' + (options?.style?.unselected || '')))">
|
|
7777
7773
|
<input type="radio"
|
|
7778
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7774
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7779
7775
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
7780
7776
|
[attr.required]="options?.required"
|
|
7781
7777
|
[checked]="radioItem?.value === controlValue"
|
|
7782
7778
|
[class]="options?.fieldHtmlClass || ''"
|
|
7783
7779
|
[disabled]="controlDisabled"
|
|
7784
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.value"
|
|
7780
|
+
[id]="'control' + layoutNode()?._id + '/' + radioItem?.value"
|
|
7785
7781
|
[name]="controlName"
|
|
7786
7782
|
[value]="radioItem?.value"
|
|
7787
7783
|
(change)="updateValue($event)">
|
|
@@ -7794,26 +7790,26 @@ class RadiosComponent {
|
|
|
7794
7790
|
<div *ngFor="let radioItem of radiosList"
|
|
7795
7791
|
[class]="options?.htmlClass || ''">
|
|
7796
7792
|
<label
|
|
7797
|
-
[attr.for]="'control' + layoutNode?._id + '/' + radioItem?.value"
|
|
7793
|
+
[attr.for]="'control' + layoutNode()?._id + '/' + radioItem?.value"
|
|
7798
7794
|
[class]="(options?.itemLabelHtmlClass || '') +
|
|
7799
7795
|
((controlValue + '' === radioItem?.value + '') ?
|
|
7800
7796
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7801
7797
|
(' ' + (options?.style?.unselected || '')))">
|
|
7802
7798
|
<input type="radio"
|
|
7803
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7799
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7804
7800
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
7805
7801
|
[attr.required]="options?.required"
|
|
7806
7802
|
[checked]="radioItem?.value === controlValue"
|
|
7807
7803
|
[class]="options?.fieldHtmlClass || ''"
|
|
7808
7804
|
[disabled]="controlDisabled"
|
|
7809
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.value"
|
|
7805
|
+
[id]="'control' + layoutNode()?._id + '/' + radioItem?.value"
|
|
7810
7806
|
[name]="controlName"
|
|
7811
7807
|
[value]="radioItem?.value"
|
|
7812
7808
|
(change)="updateValue($event)">
|
|
7813
7809
|
<span [innerHTML]="radioItem?.name"></span>
|
|
7814
7810
|
</label>
|
|
7815
7811
|
</div>
|
|
7816
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
7812
|
+
</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"] }] }); }
|
|
7817
7813
|
}
|
|
7818
7814
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RadiosComponent, decorators: [{
|
|
7819
7815
|
type: Component,
|
|
@@ -7822,7 +7818,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7822
7818
|
selector: 'radios-widget',
|
|
7823
7819
|
template: `
|
|
7824
7820
|
<label *ngIf="options?.title"
|
|
7825
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
7821
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
7826
7822
|
[class]="options?.labelHtmlClass || ''"
|
|
7827
7823
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
7828
7824
|
[innerHTML]="options?.title"></label>
|
|
@@ -7831,19 +7827,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7831
7827
|
<div *ngIf="layoutOrientation === 'horizontal'"
|
|
7832
7828
|
[class]="options?.htmlClass || ''">
|
|
7833
7829
|
<label *ngFor="let radioItem of radiosList"
|
|
7834
|
-
[attr.for]="'control' + layoutNode?._id + '/' + radioItem?.value"
|
|
7830
|
+
[attr.for]="'control' + layoutNode()?._id + '/' + radioItem?.value"
|
|
7835
7831
|
[class]="(options?.itemLabelHtmlClass || '') +
|
|
7836
7832
|
((controlValue + '' === radioItem?.value + '') ?
|
|
7837
7833
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7838
7834
|
(' ' + (options?.style?.unselected || '')))">
|
|
7839
7835
|
<input type="radio"
|
|
7840
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7836
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7841
7837
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
7842
7838
|
[attr.required]="options?.required"
|
|
7843
7839
|
[checked]="radioItem?.value === controlValue"
|
|
7844
7840
|
[class]="options?.fieldHtmlClass || ''"
|
|
7845
7841
|
[disabled]="controlDisabled"
|
|
7846
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.value"
|
|
7842
|
+
[id]="'control' + layoutNode()?._id + '/' + radioItem?.value"
|
|
7847
7843
|
[name]="controlName"
|
|
7848
7844
|
[value]="radioItem?.value"
|
|
7849
7845
|
(change)="updateValue($event)">
|
|
@@ -7856,19 +7852,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7856
7852
|
<div *ngFor="let radioItem of radiosList"
|
|
7857
7853
|
[class]="options?.htmlClass || ''">
|
|
7858
7854
|
<label
|
|
7859
|
-
[attr.for]="'control' + layoutNode?._id + '/' + radioItem?.value"
|
|
7855
|
+
[attr.for]="'control' + layoutNode()?._id + '/' + radioItem?.value"
|
|
7860
7856
|
[class]="(options?.itemLabelHtmlClass || '') +
|
|
7861
7857
|
((controlValue + '' === radioItem?.value + '') ?
|
|
7862
7858
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
7863
7859
|
(' ' + (options?.style?.unselected || '')))">
|
|
7864
7860
|
<input type="radio"
|
|
7865
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
7861
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
7866
7862
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
7867
7863
|
[attr.required]="options?.required"
|
|
7868
7864
|
[checked]="radioItem?.value === controlValue"
|
|
7869
7865
|
[class]="options?.fieldHtmlClass || ''"
|
|
7870
7866
|
[disabled]="controlDisabled"
|
|
7871
|
-
[id]="'control' + layoutNode?._id + '/' + radioItem?.value"
|
|
7867
|
+
[id]="'control' + layoutNode()?._id + '/' + radioItem?.value"
|
|
7872
7868
|
[name]="controlName"
|
|
7873
7869
|
[value]="radioItem?.value"
|
|
7874
7870
|
(change)="updateValue($event)">
|
|
@@ -7877,19 +7873,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7877
7873
|
</div>
|
|
7878
7874
|
</div>`,
|
|
7879
7875
|
}]
|
|
7880
|
-
}]
|
|
7881
|
-
type: Input
|
|
7882
|
-
}], layoutIndex: [{
|
|
7883
|
-
type: Input
|
|
7884
|
-
}], dataIndex: [{
|
|
7885
|
-
type: Input
|
|
7886
|
-
}] } });
|
|
7876
|
+
}] });
|
|
7887
7877
|
|
|
7888
7878
|
class SelectFrameworkComponent {
|
|
7889
|
-
constructor(
|
|
7890
|
-
this.componentFactory =
|
|
7891
|
-
this.jsf =
|
|
7879
|
+
constructor() {
|
|
7880
|
+
this.componentFactory = inject(ComponentFactoryResolver);
|
|
7881
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7892
7882
|
this.newComponent = null;
|
|
7883
|
+
this.layoutNode = input(undefined);
|
|
7884
|
+
this.layoutIndex = input(undefined);
|
|
7885
|
+
this.dataIndex = input(undefined);
|
|
7886
|
+
this.widgetContainer = viewChild('widgetContainer', { read: ViewContainerRef });
|
|
7893
7887
|
}
|
|
7894
7888
|
ngOnInit() {
|
|
7895
7889
|
this.updateComponent();
|
|
@@ -7898,8 +7892,9 @@ class SelectFrameworkComponent {
|
|
|
7898
7892
|
this.updateComponent();
|
|
7899
7893
|
}
|
|
7900
7894
|
updateComponent() {
|
|
7901
|
-
|
|
7902
|
-
|
|
7895
|
+
const widgetContainer = this.widgetContainer();
|
|
7896
|
+
if (widgetContainer && !this.newComponent && this.jsf.framework) {
|
|
7897
|
+
this.newComponent = widgetContainer.createComponent(this.componentFactory.resolveComponentFactory(this.jsf.framework));
|
|
7903
7898
|
//TODO fix all deprecated calls and test
|
|
7904
7899
|
//this.widgetContainer.createComponent<any>(this.jsf.framework)
|
|
7905
7900
|
}
|
|
@@ -7909,8 +7904,8 @@ class SelectFrameworkComponent {
|
|
|
7909
7904
|
}
|
|
7910
7905
|
}
|
|
7911
7906
|
}
|
|
7912
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectFrameworkComponent, deps: [
|
|
7913
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
7907
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
7908
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "17.3.12", type: SelectFrameworkComponent, 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 }); }
|
|
7914
7909
|
}
|
|
7915
7910
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectFrameworkComponent, decorators: [{
|
|
7916
7911
|
type: Component,
|
|
@@ -7919,19 +7914,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7919
7914
|
selector: 'select-framework-widget',
|
|
7920
7915
|
template: `<div #widgetContainer></div>`,
|
|
7921
7916
|
}]
|
|
7922
|
-
}]
|
|
7923
|
-
type: Input
|
|
7924
|
-
}], layoutIndex: [{
|
|
7925
|
-
type: Input
|
|
7926
|
-
}], dataIndex: [{
|
|
7927
|
-
type: Input
|
|
7928
|
-
}], widgetContainer: [{
|
|
7929
|
-
type: ViewChild,
|
|
7930
|
-
args: ['widgetContainer', {
|
|
7931
|
-
read: ViewContainerRef,
|
|
7932
|
-
static: true
|
|
7933
|
-
}]
|
|
7934
|
-
}] } });
|
|
7917
|
+
}] });
|
|
7935
7918
|
|
|
7936
7919
|
/**
|
|
7937
7920
|
* OrderableDirective
|
|
@@ -7955,18 +7938,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
7955
7938
|
* - drop: remove 'drag-target-...' classes from element, move dropped array item
|
|
7956
7939
|
*/
|
|
7957
7940
|
class OrderableDirective {
|
|
7958
|
-
constructor(
|
|
7959
|
-
this.elementRef =
|
|
7960
|
-
this.jsf =
|
|
7961
|
-
this.ngZone =
|
|
7941
|
+
constructor() {
|
|
7942
|
+
this.elementRef = inject(ElementRef);
|
|
7943
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
7944
|
+
this.ngZone = inject(NgZone);
|
|
7962
7945
|
this.overParentElement = false;
|
|
7963
7946
|
this.overChildElement = false;
|
|
7947
|
+
this.orderable = input(undefined);
|
|
7948
|
+
this.layoutNode = input(undefined);
|
|
7949
|
+
this.layoutIndex = input(undefined);
|
|
7950
|
+
this.dataIndex = input(undefined);
|
|
7964
7951
|
}
|
|
7965
7952
|
ngOnInit() {
|
|
7966
|
-
|
|
7953
|
+
const layoutIndex = this.layoutIndex();
|
|
7954
|
+
if (this.orderable() && this.layoutNode() && layoutIndex && this.dataIndex()) {
|
|
7967
7955
|
this.element = this.elementRef.nativeElement;
|
|
7968
7956
|
this.element.draggable = true;
|
|
7969
|
-
this.arrayLayoutIndex = 'move:' +
|
|
7957
|
+
this.arrayLayoutIndex = 'move:' + layoutIndex.slice(0, -1).toString();
|
|
7970
7958
|
this.ngZone.runOutsideAngular(() => {
|
|
7971
7959
|
// Listeners for movable element being dragged:
|
|
7972
7960
|
this.element.addEventListener('dragstart', (event) => {
|
|
@@ -7974,7 +7962,7 @@ class OrderableDirective {
|
|
|
7974
7962
|
event.dataTransfer.setData('text', '');
|
|
7975
7963
|
// Hack to bypass stupid HTML drag-and-drop dataTransfer protection
|
|
7976
7964
|
// so drag source info will be available on dragenter
|
|
7977
|
-
const sourceArrayIndex = this.dataIndex[this.dataIndex.length - 1];
|
|
7965
|
+
const sourceArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
|
|
7978
7966
|
sessionStorage.setItem(this.arrayLayoutIndex, sourceArrayIndex + '');
|
|
7979
7967
|
});
|
|
7980
7968
|
this.element.addEventListener('dragover', (event) => {
|
|
@@ -7996,10 +7984,10 @@ class OrderableDirective {
|
|
|
7996
7984
|
}
|
|
7997
7985
|
const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
|
|
7998
7986
|
if (sourceArrayIndex !== null) {
|
|
7999
|
-
if (this.dataIndex[this.dataIndex.length - 1] < +sourceArrayIndex) {
|
|
7987
|
+
if (this.dataIndex()[this.dataIndex().length - 1] < +sourceArrayIndex) {
|
|
8000
7988
|
this.element.classList.add('drag-target-top');
|
|
8001
7989
|
}
|
|
8002
|
-
else if (this.dataIndex[this.dataIndex.length - 1] > +sourceArrayIndex) {
|
|
7990
|
+
else if (this.dataIndex()[this.dataIndex().length - 1] > +sourceArrayIndex) {
|
|
8003
7991
|
this.element.classList.add('drag-target-bottom');
|
|
8004
7992
|
}
|
|
8005
7993
|
}
|
|
@@ -8023,7 +8011,7 @@ class OrderableDirective {
|
|
|
8023
8011
|
this.element.classList.remove('drag-target-bottom');
|
|
8024
8012
|
// Confirm that drop target is another item in the same array as source item
|
|
8025
8013
|
const sourceArrayIndex = sessionStorage.getItem(this.arrayLayoutIndex);
|
|
8026
|
-
const destArrayIndex = this.dataIndex[this.dataIndex.length - 1];
|
|
8014
|
+
const destArrayIndex = this.dataIndex()[this.dataIndex().length - 1];
|
|
8027
8015
|
if (sourceArrayIndex !== null && +sourceArrayIndex !== destArrayIndex) {
|
|
8028
8016
|
// Move array item
|
|
8029
8017
|
this.jsf.moveArrayItem(this, +sourceArrayIndex, destArrayIndex);
|
|
@@ -8034,8 +8022,8 @@ class OrderableDirective {
|
|
|
8034
8022
|
});
|
|
8035
8023
|
}
|
|
8036
8024
|
}
|
|
8037
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderableDirective, deps: [
|
|
8038
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
8025
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
8026
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "17.3.12", type: OrderableDirective, 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 }); }
|
|
8039
8027
|
}
|
|
8040
8028
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: OrderableDirective, decorators: [{
|
|
8041
8029
|
type: Directive,
|
|
@@ -8043,24 +8031,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8043
8031
|
// tslint:disable-next-line:directive-selector
|
|
8044
8032
|
selector: '[orderable]',
|
|
8045
8033
|
}]
|
|
8046
|
-
}]
|
|
8047
|
-
type: Input
|
|
8048
|
-
}], layoutNode: [{
|
|
8049
|
-
type: Input
|
|
8050
|
-
}], layoutIndex: [{
|
|
8051
|
-
type: Input
|
|
8052
|
-
}], dataIndex: [{
|
|
8053
|
-
type: Input
|
|
8054
|
-
}] } });
|
|
8034
|
+
}] });
|
|
8055
8035
|
|
|
8056
8036
|
class RootComponent {
|
|
8057
|
-
constructor(
|
|
8058
|
-
this.jsf =
|
|
8059
|
-
this.
|
|
8037
|
+
constructor() {
|
|
8038
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8039
|
+
this.dataIndex = input(undefined);
|
|
8040
|
+
this.layoutIndex = input(undefined);
|
|
8041
|
+
this.layout = input(undefined);
|
|
8042
|
+
this.isOrderable = input(undefined);
|
|
8043
|
+
this.isFlexItem = input(false);
|
|
8060
8044
|
}
|
|
8061
8045
|
isDraggable(node) {
|
|
8062
8046
|
return node.arrayItem && node.type !== '$ref' &&
|
|
8063
|
-
node.arrayItemType === 'list' && this.isOrderable !== false;
|
|
8047
|
+
node.arrayItemType === 'list' && this.isOrderable() !== false;
|
|
8064
8048
|
}
|
|
8065
8049
|
// Set attributes for flexbox child
|
|
8066
8050
|
// (container attributes are set in section.component)
|
|
@@ -8070,76 +8054,69 @@ class RootComponent {
|
|
|
8070
8054
|
(node.options || {})[attribute] || ['1', '1', 'auto'][index];
|
|
8071
8055
|
}
|
|
8072
8056
|
showWidget(layoutNode) {
|
|
8073
|
-
return this.jsf.evaluateCondition(layoutNode, this.dataIndex);
|
|
8057
|
+
return this.jsf.evaluateCondition(layoutNode, this.dataIndex());
|
|
8074
8058
|
}
|
|
8075
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RootComponent, deps: [
|
|
8076
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
8077
|
-
<div *ngFor="let layoutItem of layout; let i = index"
|
|
8078
|
-
[class.form-flex-item]="isFlexItem"
|
|
8059
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8060
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: RootComponent, 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: `
|
|
8061
|
+
<div *ngFor="let layoutItem of layout(); let i = index"
|
|
8062
|
+
[class.form-flex-item]="isFlexItem()"
|
|
8079
8063
|
[style.align-self]="(layoutItem.options || {})['align-self']"
|
|
8080
8064
|
[style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
|
|
8081
8065
|
[style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
|
|
8082
8066
|
[style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
|
|
8083
8067
|
[style.order]="(layoutItem.options || {}).order">
|
|
8084
8068
|
<div
|
|
8085
|
-
[dataIndex]="layoutItem?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
|
|
8086
|
-
[layoutIndex]="(layoutIndex || []).concat(i)"
|
|
8069
|
+
[dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
|
|
8070
|
+
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8087
8071
|
[layoutNode]="layoutItem"
|
|
8088
8072
|
[orderable]="isDraggable(layoutItem)">
|
|
8089
8073
|
<select-framework-widget *ngIf="showWidget(layoutItem)"
|
|
8090
|
-
[dataIndex]="layoutItem?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
|
|
8091
|
-
[layoutIndex]="(layoutIndex || []).concat(i)"
|
|
8074
|
+
[dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
|
|
8075
|
+
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8092
8076
|
[layoutNode]="layoutItem"></select-framework-widget>
|
|
8093
8077
|
</div>
|
|
8094
|
-
</div>`, 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:
|
|
8078
|
+
</div>`, 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: "component", type: SelectFrameworkComponent, selector: "select-framework-widget", inputs: ["layoutNode", "layoutIndex", "dataIndex"] }, { kind: "directive", type: OrderableDirective, selector: "[orderable]", inputs: ["orderable", "layoutNode", "layoutIndex", "dataIndex"] }] }); }
|
|
8095
8079
|
}
|
|
8096
8080
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: RootComponent, decorators: [{
|
|
8097
8081
|
type: Component,
|
|
8098
8082
|
args: [{ selector: 'root-widget', template: `
|
|
8099
|
-
<div *ngFor="let layoutItem of layout; let i = index"
|
|
8100
|
-
[class.form-flex-item]="isFlexItem"
|
|
8083
|
+
<div *ngFor="let layoutItem of layout(); let i = index"
|
|
8084
|
+
[class.form-flex-item]="isFlexItem()"
|
|
8101
8085
|
[style.align-self]="(layoutItem.options || {})['align-self']"
|
|
8102
8086
|
[style.flex-basis]="getFlexAttribute(layoutItem, 'flex-basis')"
|
|
8103
8087
|
[style.flex-grow]="getFlexAttribute(layoutItem, 'flex-grow')"
|
|
8104
8088
|
[style.flex-shrink]="getFlexAttribute(layoutItem, 'flex-shrink')"
|
|
8105
8089
|
[style.order]="(layoutItem.options || {}).order">
|
|
8106
8090
|
<div
|
|
8107
|
-
[dataIndex]="layoutItem?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
|
|
8108
|
-
[layoutIndex]="(layoutIndex || []).concat(i)"
|
|
8091
|
+
[dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
|
|
8092
|
+
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8109
8093
|
[layoutNode]="layoutItem"
|
|
8110
8094
|
[orderable]="isDraggable(layoutItem)">
|
|
8111
8095
|
<select-framework-widget *ngIf="showWidget(layoutItem)"
|
|
8112
|
-
[dataIndex]="layoutItem?.arrayItem ? (dataIndex || []).concat(i) : (dataIndex || [])"
|
|
8113
|
-
[layoutIndex]="(layoutIndex || []).concat(i)"
|
|
8096
|
+
[dataIndex]="layoutItem?.arrayItem ? (dataIndex() || []).concat(i) : (dataIndex() || [])"
|
|
8097
|
+
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8114
8098
|
[layoutNode]="layoutItem"></select-framework-widget>
|
|
8115
8099
|
</div>
|
|
8116
8100
|
</div>`, 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"] }]
|
|
8117
|
-
}]
|
|
8118
|
-
type: Input
|
|
8119
|
-
}], layoutIndex: [{
|
|
8120
|
-
type: Input
|
|
8121
|
-
}], layout: [{
|
|
8122
|
-
type: Input
|
|
8123
|
-
}], isOrderable: [{
|
|
8124
|
-
type: Input
|
|
8125
|
-
}], isFlexItem: [{
|
|
8126
|
-
type: Input
|
|
8127
|
-
}] } });
|
|
8101
|
+
}] });
|
|
8128
8102
|
|
|
8129
8103
|
class SectionComponent {
|
|
8130
|
-
constructor(
|
|
8131
|
-
this.jsf =
|
|
8104
|
+
constructor() {
|
|
8105
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8132
8106
|
this.expanded = true;
|
|
8107
|
+
this.layoutNode = input(undefined);
|
|
8108
|
+
this.layoutIndex = input(undefined);
|
|
8109
|
+
this.dataIndex = input(undefined);
|
|
8133
8110
|
}
|
|
8134
8111
|
get sectionTitle() {
|
|
8135
8112
|
return this.options.notitle ? null : this.jsf.setItemTitle(this);
|
|
8136
8113
|
}
|
|
8137
8114
|
ngOnInit() {
|
|
8138
8115
|
this.jsf.initializeControl(this);
|
|
8139
|
-
this.options = this.layoutNode.options || {};
|
|
8116
|
+
this.options = this.layoutNode().options || {};
|
|
8140
8117
|
this.expanded = typeof this.options.expanded === 'boolean' ?
|
|
8141
8118
|
this.options.expanded : !this.options.expandable;
|
|
8142
|
-
switch (this.layoutNode.type) {
|
|
8119
|
+
switch (this.layoutNode().type) {
|
|
8143
8120
|
case 'fieldset':
|
|
8144
8121
|
case 'array':
|
|
8145
8122
|
case 'tab':
|
|
@@ -8162,7 +8139,7 @@ class SectionComponent {
|
|
|
8162
8139
|
// Set attributes for flexbox container
|
|
8163
8140
|
// (child attributes are set in root.component)
|
|
8164
8141
|
getFlexAttribute(attribute) {
|
|
8165
|
-
const flexActive = this.layoutNode.type === 'flex' ||
|
|
8142
|
+
const flexActive = this.layoutNode().type === 'flex' ||
|
|
8166
8143
|
!!this.options.displayFlex ||
|
|
8167
8144
|
this.options.display === 'flex';
|
|
8168
8145
|
if (attribute !== 'flex' && !flexActive) {
|
|
@@ -8184,8 +8161,8 @@ class SectionComponent {
|
|
|
8184
8161
|
return this.options[attribute];
|
|
8185
8162
|
}
|
|
8186
8163
|
}
|
|
8187
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SectionComponent, deps: [
|
|
8188
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
8164
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8165
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: SectionComponent, 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: `
|
|
8189
8166
|
<div *ngIf="containerType === 'div'"
|
|
8190
8167
|
[class]="options?.htmlClass || ''"
|
|
8191
8168
|
[class.expandable]="options?.expandable && !expanded"
|
|
@@ -8196,9 +8173,9 @@ class SectionComponent {
|
|
|
8196
8173
|
[innerHTML]="sectionTitle"
|
|
8197
8174
|
(click)="toggleExpanded()"></label>
|
|
8198
8175
|
<root-widget *ngIf="expanded"
|
|
8199
|
-
[dataIndex]="dataIndex"
|
|
8200
|
-
[layout]="layoutNode.items"
|
|
8201
|
-
[layoutIndex]="layoutIndex"
|
|
8176
|
+
[dataIndex]="dataIndex()"
|
|
8177
|
+
[layout]="layoutNode().items"
|
|
8178
|
+
[layoutIndex]="layoutIndex()"
|
|
8202
8179
|
[isFlexItem]="getFlexAttribute('is-flex')"
|
|
8203
8180
|
[isOrderable]="options?.orderable"
|
|
8204
8181
|
[class.form-flex-column]="getFlexAttribute('flex-direction') === 'column'"
|
|
@@ -8227,9 +8204,9 @@ class SectionComponent {
|
|
|
8227
8204
|
[innerHTML]="options?.description"></p>
|
|
8228
8205
|
</div>
|
|
8229
8206
|
<root-widget *ngIf="expanded"
|
|
8230
|
-
[dataIndex]="dataIndex"
|
|
8231
|
-
[layout]="layoutNode.items"
|
|
8232
|
-
[layoutIndex]="layoutIndex"
|
|
8207
|
+
[dataIndex]="dataIndex()"
|
|
8208
|
+
[layout]="layoutNode().items"
|
|
8209
|
+
[layoutIndex]="layoutIndex()"
|
|
8233
8210
|
[isFlexItem]="getFlexAttribute('is-flex')"
|
|
8234
8211
|
[isOrderable]="options?.orderable"
|
|
8235
8212
|
[class.form-flex-column]="getFlexAttribute('flex-direction') === 'column'"
|
|
@@ -8246,7 +8223,7 @@ class SectionComponent {
|
|
|
8246
8223
|
[class]="options?.labelHelpBlockClass || ''"
|
|
8247
8224
|
[innerHTML]="options?.description"></p>
|
|
8248
8225
|
</div>
|
|
8249
|
-
</fieldset>`, isInline: true, styles: [".legend{font-weight:700}.expandable>legend:before,.expandable>label:before{content:\"\\25b6\";padding-right:.3em}.expanded>legend:before,.expanded>label:before{content:\"\\25bc\";padding-right:.2em}\n"], dependencies: [{ kind: "directive", type:
|
|
8226
|
+
</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"] }] }); }
|
|
8250
8227
|
}
|
|
8251
8228
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SectionComponent, decorators: [{
|
|
8252
8229
|
type: Component,
|
|
@@ -8261,9 +8238,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8261
8238
|
[innerHTML]="sectionTitle"
|
|
8262
8239
|
(click)="toggleExpanded()"></label>
|
|
8263
8240
|
<root-widget *ngIf="expanded"
|
|
8264
|
-
[dataIndex]="dataIndex"
|
|
8265
|
-
[layout]="layoutNode.items"
|
|
8266
|
-
[layoutIndex]="layoutIndex"
|
|
8241
|
+
[dataIndex]="dataIndex()"
|
|
8242
|
+
[layout]="layoutNode().items"
|
|
8243
|
+
[layoutIndex]="layoutIndex()"
|
|
8267
8244
|
[isFlexItem]="getFlexAttribute('is-flex')"
|
|
8268
8245
|
[isOrderable]="options?.orderable"
|
|
8269
8246
|
[class.form-flex-column]="getFlexAttribute('flex-direction') === 'column'"
|
|
@@ -8292,9 +8269,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8292
8269
|
[innerHTML]="options?.description"></p>
|
|
8293
8270
|
</div>
|
|
8294
8271
|
<root-widget *ngIf="expanded"
|
|
8295
|
-
[dataIndex]="dataIndex"
|
|
8296
|
-
[layout]="layoutNode.items"
|
|
8297
|
-
[layoutIndex]="layoutIndex"
|
|
8272
|
+
[dataIndex]="dataIndex()"
|
|
8273
|
+
[layout]="layoutNode().items"
|
|
8274
|
+
[layoutIndex]="layoutIndex()"
|
|
8298
8275
|
[isFlexItem]="getFlexAttribute('is-flex')"
|
|
8299
8276
|
[isOrderable]="options?.orderable"
|
|
8300
8277
|
[class.form-flex-column]="getFlexAttribute('flex-direction') === 'column'"
|
|
@@ -8311,47 +8288,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8311
8288
|
[class]="options?.labelHelpBlockClass || ''"
|
|
8312
8289
|
[innerHTML]="options?.description"></p>
|
|
8313
8290
|
</div>
|
|
8314
|
-
</fieldset>`, styles: [".legend{font-weight:700}.expandable>legend:before,.expandable>label:before{content:\"\\25b6\";padding-right:.3em}.expanded>legend:before,.expanded>label:before{content:\"\\25bc\";padding-right:.2em}\n"] }]
|
|
8315
|
-
}]
|
|
8316
|
-
type: Input
|
|
8317
|
-
}], layoutIndex: [{
|
|
8318
|
-
type: Input
|
|
8319
|
-
}], dataIndex: [{
|
|
8320
|
-
type: Input
|
|
8321
|
-
}] } });
|
|
8291
|
+
</fieldset>`, 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"] }]
|
|
8292
|
+
}] });
|
|
8322
8293
|
|
|
8323
8294
|
class SelectComponent {
|
|
8324
|
-
constructor(
|
|
8325
|
-
this.jsf =
|
|
8295
|
+
constructor() {
|
|
8296
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8326
8297
|
this.controlDisabled = false;
|
|
8327
8298
|
this.boundControl = false;
|
|
8328
8299
|
this.selectList = [];
|
|
8329
8300
|
this.isArray = isArray;
|
|
8301
|
+
this.layoutNode = input(undefined);
|
|
8302
|
+
this.layoutIndex = input(undefined);
|
|
8303
|
+
this.dataIndex = input(undefined);
|
|
8330
8304
|
}
|
|
8331
8305
|
ngOnInit() {
|
|
8332
|
-
this.options = this.layoutNode.options || {};
|
|
8306
|
+
this.options = this.layoutNode().options || {};
|
|
8333
8307
|
this.selectList = buildTitleMap(this.options.titleMap || this.options.enumNames, this.options.enum, !!this.options.required, !!this.options.flatList);
|
|
8334
8308
|
this.jsf.initializeControl(this);
|
|
8335
8309
|
}
|
|
8336
8310
|
updateValue(event) {
|
|
8337
8311
|
this.jsf.updateValue(this, event.target.value);
|
|
8338
8312
|
}
|
|
8339
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectComponent, deps: [
|
|
8340
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
8313
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8314
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: SelectComponent, 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: `
|
|
8341
8315
|
<div
|
|
8342
8316
|
[class]="options?.htmlClass || ''">
|
|
8343
8317
|
<label *ngIf="options?.title"
|
|
8344
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
8318
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
8345
8319
|
[class]="options?.labelHtmlClass || ''"
|
|
8346
8320
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
8347
8321
|
[innerHTML]="options?.title"></label>
|
|
8348
8322
|
<select *ngIf="boundControl"
|
|
8349
8323
|
[formControl]="formControl"
|
|
8350
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8324
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8351
8325
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
8352
8326
|
[attr.required]="options?.required"
|
|
8353
8327
|
[class]="options?.fieldHtmlClass || ''"
|
|
8354
|
-
[id]="'control' + layoutNode?._id"
|
|
8328
|
+
[id]="'control' + layoutNode()?._id"
|
|
8355
8329
|
[name]="controlName">
|
|
8356
8330
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
8357
8331
|
<option *ngIf="!isArray(selectItem?.items)"
|
|
@@ -8368,12 +8342,12 @@ class SelectComponent {
|
|
|
8368
8342
|
</ng-template>
|
|
8369
8343
|
</select>
|
|
8370
8344
|
<select *ngIf="!boundControl"
|
|
8371
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8345
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8372
8346
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
8373
8347
|
[attr.required]="options?.required"
|
|
8374
8348
|
[class]="options?.fieldHtmlClass || ''"
|
|
8375
8349
|
[disabled]="controlDisabled"
|
|
8376
|
-
[id]="'control' + layoutNode?._id"
|
|
8350
|
+
[id]="'control' + layoutNode()?._id"
|
|
8377
8351
|
[name]="controlName"
|
|
8378
8352
|
(change)="updateValue($event)">
|
|
8379
8353
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
@@ -8392,7 +8366,7 @@ class SelectComponent {
|
|
|
8392
8366
|
</optgroup>
|
|
8393
8367
|
</ng-template>
|
|
8394
8368
|
</select>
|
|
8395
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
8369
|
+
</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"] }] }); }
|
|
8396
8370
|
}
|
|
8397
8371
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectComponent, decorators: [{
|
|
8398
8372
|
type: Component,
|
|
@@ -8403,17 +8377,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8403
8377
|
<div
|
|
8404
8378
|
[class]="options?.htmlClass || ''">
|
|
8405
8379
|
<label *ngIf="options?.title"
|
|
8406
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
8380
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
8407
8381
|
[class]="options?.labelHtmlClass || ''"
|
|
8408
8382
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
8409
8383
|
[innerHTML]="options?.title"></label>
|
|
8410
8384
|
<select *ngIf="boundControl"
|
|
8411
8385
|
[formControl]="formControl"
|
|
8412
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8386
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8413
8387
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
8414
8388
|
[attr.required]="options?.required"
|
|
8415
8389
|
[class]="options?.fieldHtmlClass || ''"
|
|
8416
|
-
[id]="'control' + layoutNode?._id"
|
|
8390
|
+
[id]="'control' + layoutNode()?._id"
|
|
8417
8391
|
[name]="controlName">
|
|
8418
8392
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
8419
8393
|
<option *ngIf="!isArray(selectItem?.items)"
|
|
@@ -8430,12 +8404,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8430
8404
|
</ng-template>
|
|
8431
8405
|
</select>
|
|
8432
8406
|
<select *ngIf="!boundControl"
|
|
8433
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8407
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8434
8408
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
8435
8409
|
[attr.required]="options?.required"
|
|
8436
8410
|
[class]="options?.fieldHtmlClass || ''"
|
|
8437
8411
|
[disabled]="controlDisabled"
|
|
8438
|
-
[id]="'control' + layoutNode?._id"
|
|
8412
|
+
[id]="'control' + layoutNode()?._id"
|
|
8439
8413
|
[name]="controlName"
|
|
8440
8414
|
(change)="updateValue($event)">
|
|
8441
8415
|
<ng-template ngFor let-selectItem [ngForOf]="selectList">
|
|
@@ -8456,19 +8430,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8456
8430
|
</select>
|
|
8457
8431
|
</div>`,
|
|
8458
8432
|
}]
|
|
8459
|
-
}]
|
|
8460
|
-
type: Input
|
|
8461
|
-
}], layoutIndex: [{
|
|
8462
|
-
type: Input
|
|
8463
|
-
}], dataIndex: [{
|
|
8464
|
-
type: Input
|
|
8465
|
-
}] } });
|
|
8433
|
+
}] });
|
|
8466
8434
|
|
|
8467
8435
|
class SelectWidgetComponent {
|
|
8468
|
-
constructor(
|
|
8469
|
-
this.componentFactory =
|
|
8470
|
-
this.jsf =
|
|
8436
|
+
constructor() {
|
|
8437
|
+
this.componentFactory = inject(ComponentFactoryResolver);
|
|
8438
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8471
8439
|
this.newComponent = null;
|
|
8440
|
+
this.layoutNode = input(undefined);
|
|
8441
|
+
this.layoutIndex = input(undefined);
|
|
8442
|
+
this.dataIndex = input(undefined);
|
|
8443
|
+
this.widgetContainer = viewChild('widgetContainer', { read: ViewContainerRef });
|
|
8472
8444
|
}
|
|
8473
8445
|
ngOnInit() {
|
|
8474
8446
|
this.updateComponent();
|
|
@@ -8477,8 +8449,9 @@ class SelectWidgetComponent {
|
|
|
8477
8449
|
this.updateComponent();
|
|
8478
8450
|
}
|
|
8479
8451
|
updateComponent() {
|
|
8480
|
-
|
|
8481
|
-
|
|
8452
|
+
const widgetContainer = this.widgetContainer();
|
|
8453
|
+
if (widgetContainer && !this.newComponent && (this.layoutNode() || {}).widget) {
|
|
8454
|
+
this.newComponent = widgetContainer.createComponent(this.componentFactory.resolveComponentFactory(this.layoutNode().widget));
|
|
8482
8455
|
}
|
|
8483
8456
|
if (this.newComponent) {
|
|
8484
8457
|
for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
|
|
@@ -8486,8 +8459,8 @@ class SelectWidgetComponent {
|
|
|
8486
8459
|
}
|
|
8487
8460
|
}
|
|
8488
8461
|
}
|
|
8489
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectWidgetComponent, deps: [
|
|
8490
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
8462
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectWidgetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8463
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "17.3.12", type: SelectWidgetComponent, 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 }); }
|
|
8491
8464
|
}
|
|
8492
8465
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SelectWidgetComponent, decorators: [{
|
|
8493
8466
|
type: Component,
|
|
@@ -8496,29 +8469,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8496
8469
|
selector: 'select-widget-widget',
|
|
8497
8470
|
template: `<div #widgetContainer></div>`,
|
|
8498
8471
|
}]
|
|
8499
|
-
}]
|
|
8500
|
-
type: Input
|
|
8501
|
-
}], layoutIndex: [{
|
|
8502
|
-
type: Input
|
|
8503
|
-
}], dataIndex: [{
|
|
8504
|
-
type: Input
|
|
8505
|
-
}], widgetContainer: [{
|
|
8506
|
-
type: ViewChild,
|
|
8507
|
-
args: ['widgetContainer', { read: ViewContainerRef, static: true }]
|
|
8508
|
-
}] } });
|
|
8472
|
+
}] });
|
|
8509
8473
|
|
|
8510
8474
|
class SubmitComponent {
|
|
8511
|
-
constructor(
|
|
8512
|
-
this.jsf =
|
|
8475
|
+
constructor() {
|
|
8476
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8513
8477
|
this.controlDisabled = false;
|
|
8514
8478
|
this.boundControl = false;
|
|
8479
|
+
this.layoutNode = input(undefined);
|
|
8480
|
+
this.layoutIndex = input(undefined);
|
|
8481
|
+
this.dataIndex = input(undefined);
|
|
8515
8482
|
}
|
|
8516
8483
|
ngOnDestroy() {
|
|
8517
8484
|
this.isValidChangesSubs?.unsubscribe();
|
|
8518
8485
|
this.isValidChangesSubs = null;
|
|
8519
8486
|
}
|
|
8520
8487
|
ngOnInit() {
|
|
8521
|
-
this.options = this.layoutNode.options || {};
|
|
8488
|
+
this.options = this.layoutNode().options || {};
|
|
8522
8489
|
this.jsf.initializeControl(this);
|
|
8523
8490
|
if (hasOwn(this.options, 'disabled')) {
|
|
8524
8491
|
this.controlDisabled = this.options.disabled;
|
|
@@ -8539,19 +8506,19 @@ class SubmitComponent {
|
|
|
8539
8506
|
this.jsf.updateValue(this, event.target.value);
|
|
8540
8507
|
}
|
|
8541
8508
|
}
|
|
8542
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SubmitComponent, deps: [
|
|
8543
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
8509
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: SubmitComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8510
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: SubmitComponent, 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: `
|
|
8544
8511
|
<div
|
|
8545
8512
|
[class]="options?.htmlClass || ''">
|
|
8546
8513
|
<input
|
|
8547
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8514
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8548
8515
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
8549
8516
|
[attr.required]="options?.required"
|
|
8550
8517
|
[class]="options?.fieldHtmlClass || ''"
|
|
8551
8518
|
[disabled]="controlDisabled"
|
|
8552
|
-
[id]="'control' + layoutNode?._id"
|
|
8519
|
+
[id]="'control' + layoutNode()?._id"
|
|
8553
8520
|
[name]="controlName"
|
|
8554
|
-
[type]="layoutNode?.type"
|
|
8521
|
+
[type]="layoutNode()?.type"
|
|
8555
8522
|
[value]="controlValue"
|
|
8556
8523
|
(click)="updateValue($event)">
|
|
8557
8524
|
</div>`, isInline: true }); }
|
|
@@ -8565,51 +8532,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8565
8532
|
<div
|
|
8566
8533
|
[class]="options?.htmlClass || ''">
|
|
8567
8534
|
<input
|
|
8568
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8535
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8569
8536
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
8570
8537
|
[attr.required]="options?.required"
|
|
8571
8538
|
[class]="options?.fieldHtmlClass || ''"
|
|
8572
8539
|
[disabled]="controlDisabled"
|
|
8573
|
-
[id]="'control' + layoutNode?._id"
|
|
8540
|
+
[id]="'control' + layoutNode()?._id"
|
|
8574
8541
|
[name]="controlName"
|
|
8575
|
-
[type]="layoutNode?.type"
|
|
8542
|
+
[type]="layoutNode()?.type"
|
|
8576
8543
|
[value]="controlValue"
|
|
8577
8544
|
(click)="updateValue($event)">
|
|
8578
8545
|
</div>`,
|
|
8579
8546
|
}]
|
|
8580
|
-
}]
|
|
8581
|
-
type: Input
|
|
8582
|
-
}], layoutIndex: [{
|
|
8583
|
-
type: Input
|
|
8584
|
-
}], dataIndex: [{
|
|
8585
|
-
type: Input
|
|
8586
|
-
}] } });
|
|
8547
|
+
}] });
|
|
8587
8548
|
|
|
8588
8549
|
class TabsComponent {
|
|
8589
|
-
constructor(
|
|
8590
|
-
this.jsf =
|
|
8550
|
+
constructor() {
|
|
8551
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8591
8552
|
this.selectedItem = 0;
|
|
8592
8553
|
this.showAddTab = true;
|
|
8554
|
+
this.layoutNode = input(undefined);
|
|
8555
|
+
this.layoutIndex = input(undefined);
|
|
8556
|
+
this.dataIndex = input(undefined);
|
|
8593
8557
|
}
|
|
8594
8558
|
ngOnInit() {
|
|
8595
|
-
this.options = this.layoutNode.options || {};
|
|
8596
|
-
this.itemCount = this.layoutNode.items.length - 1;
|
|
8559
|
+
this.options = this.layoutNode().options || {};
|
|
8560
|
+
this.itemCount = this.layoutNode().items.length - 1;
|
|
8597
8561
|
this.updateControl();
|
|
8598
8562
|
}
|
|
8599
8563
|
select(index) {
|
|
8600
|
-
|
|
8601
|
-
|
|
8564
|
+
const layoutNode = this.layoutNode();
|
|
8565
|
+
if (layoutNode.items[index].type === '$ref') {
|
|
8566
|
+
this.itemCount = layoutNode.items.length;
|
|
8602
8567
|
this.jsf.addItem({
|
|
8603
|
-
layoutNode:
|
|
8604
|
-
layoutIndex: this.layoutIndex.concat(index),
|
|
8605
|
-
dataIndex: this.dataIndex.concat(index)
|
|
8568
|
+
layoutNode: signal(layoutNode.items[index]),
|
|
8569
|
+
layoutIndex: signal(this.layoutIndex().concat(index)),
|
|
8570
|
+
dataIndex: signal(this.dataIndex().concat(index))
|
|
8606
8571
|
});
|
|
8607
8572
|
this.updateControl();
|
|
8608
8573
|
}
|
|
8609
8574
|
this.selectedItem = index;
|
|
8610
8575
|
}
|
|
8611
8576
|
updateControl() {
|
|
8612
|
-
const lastItem = this.layoutNode.items[this.layoutNode.items.length - 1];
|
|
8577
|
+
const lastItem = this.layoutNode().items[this.layoutNode().items.length - 1];
|
|
8613
8578
|
if (lastItem.type === '$ref' &&
|
|
8614
8579
|
this.itemCount >= (lastItem.options.maxItems || 1000)) {
|
|
8615
8580
|
this.showAddTab = false;
|
|
@@ -8618,11 +8583,11 @@ class TabsComponent {
|
|
|
8618
8583
|
setTabTitle(item, index) {
|
|
8619
8584
|
return this.jsf.setArrayItemTitle(this, item, index);
|
|
8620
8585
|
}
|
|
8621
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabsComponent, deps: [
|
|
8622
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
8586
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8587
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: TabsComponent, 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: `
|
|
8623
8588
|
<ul
|
|
8624
8589
|
[class]="options?.labelHtmlClass || ''">
|
|
8625
|
-
<li *ngFor="let item of layoutNode?.items; let i = index"
|
|
8590
|
+
<li *ngFor="let item of layoutNode()?.items; let i = index"
|
|
8626
8591
|
[class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
|
|
8627
8592
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
8628
8593
|
(' ' + options?.style?.unselected))"
|
|
@@ -8636,25 +8601,25 @@ class TabsComponent {
|
|
|
8636
8601
|
</li>
|
|
8637
8602
|
</ul>
|
|
8638
8603
|
|
|
8639
|
-
<div *ngFor="let layoutItem of layoutNode?.items; let i = index"
|
|
8604
|
+
<div *ngFor="let layoutItem of layoutNode()?.items; let i = index"
|
|
8640
8605
|
[class]="options?.htmlClass || ''">
|
|
8641
8606
|
|
|
8642
8607
|
<select-framework-widget *ngIf="selectedItem === i"
|
|
8643
8608
|
[class]="(options?.fieldHtmlClass || '') +
|
|
8644
8609
|
' ' + (options?.activeClass || '') +
|
|
8645
8610
|
' ' + (options?.style?.selected || '')"
|
|
8646
|
-
[dataIndex]="layoutNode?.dataType === 'array' ? (dataIndex || []).concat(i) : dataIndex"
|
|
8647
|
-
[layoutIndex]="(layoutIndex || []).concat(i)"
|
|
8611
|
+
[dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
|
|
8612
|
+
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8648
8613
|
[layoutNode]="layoutItem"></select-framework-widget>
|
|
8649
8614
|
|
|
8650
|
-
</div>`, isInline: true, styles: ["a{cursor:pointer}\n"], dependencies: [{ kind: "directive", type:
|
|
8615
|
+
</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"] }] }); }
|
|
8651
8616
|
}
|
|
8652
8617
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabsComponent, decorators: [{
|
|
8653
8618
|
type: Component,
|
|
8654
8619
|
args: [{ selector: 'tabs-widget', template: `
|
|
8655
8620
|
<ul
|
|
8656
8621
|
[class]="options?.labelHtmlClass || ''">
|
|
8657
|
-
<li *ngFor="let item of layoutNode?.items; let i = index"
|
|
8622
|
+
<li *ngFor="let item of layoutNode()?.items; let i = index"
|
|
8658
8623
|
[class]="(options?.itemLabelHtmlClass || '') + (selectedItem === i ?
|
|
8659
8624
|
(' ' + (options?.activeClass || '') + ' ' + (options?.style?.selected || '')) :
|
|
8660
8625
|
(' ' + options?.style?.unselected))"
|
|
@@ -8668,31 +8633,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8668
8633
|
</li>
|
|
8669
8634
|
</ul>
|
|
8670
8635
|
|
|
8671
|
-
<div *ngFor="let layoutItem of layoutNode?.items; let i = index"
|
|
8636
|
+
<div *ngFor="let layoutItem of layoutNode()?.items; let i = index"
|
|
8672
8637
|
[class]="options?.htmlClass || ''">
|
|
8673
8638
|
|
|
8674
8639
|
<select-framework-widget *ngIf="selectedItem === i"
|
|
8675
8640
|
[class]="(options?.fieldHtmlClass || '') +
|
|
8676
8641
|
' ' + (options?.activeClass || '') +
|
|
8677
8642
|
' ' + (options?.style?.selected || '')"
|
|
8678
|
-
[dataIndex]="layoutNode?.dataType === 'array' ? (dataIndex || []).concat(i) : dataIndex"
|
|
8679
|
-
[layoutIndex]="(layoutIndex || []).concat(i)"
|
|
8643
|
+
[dataIndex]="layoutNode()?.dataType === 'array' ? (dataIndex() || []).concat(i) : dataIndex()"
|
|
8644
|
+
[layoutIndex]="(layoutIndex() || []).concat(i)"
|
|
8680
8645
|
[layoutNode]="layoutItem"></select-framework-widget>
|
|
8681
8646
|
|
|
8682
8647
|
</div>`, styles: ["a{cursor:pointer}\n"] }]
|
|
8683
|
-
}]
|
|
8684
|
-
type: Input
|
|
8685
|
-
}], layoutIndex: [{
|
|
8686
|
-
type: Input
|
|
8687
|
-
}], dataIndex: [{
|
|
8688
|
-
type: Input
|
|
8689
|
-
}] } });
|
|
8648
|
+
}] });
|
|
8690
8649
|
|
|
8691
8650
|
class TemplateComponent {
|
|
8692
|
-
constructor(
|
|
8693
|
-
this.componentFactory =
|
|
8694
|
-
this.jsf =
|
|
8651
|
+
constructor() {
|
|
8652
|
+
this.componentFactory = inject(ComponentFactoryResolver);
|
|
8653
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8695
8654
|
this.newComponent = null;
|
|
8655
|
+
this.layoutNode = input(undefined);
|
|
8656
|
+
this.layoutIndex = input(undefined);
|
|
8657
|
+
this.dataIndex = input(undefined);
|
|
8658
|
+
this.widgetContainer = viewChild('widgetContainer', { read: ViewContainerRef });
|
|
8696
8659
|
}
|
|
8697
8660
|
ngOnInit() {
|
|
8698
8661
|
this.updateComponent();
|
|
@@ -8701,8 +8664,10 @@ class TemplateComponent {
|
|
|
8701
8664
|
this.updateComponent();
|
|
8702
8665
|
}
|
|
8703
8666
|
updateComponent() {
|
|
8704
|
-
|
|
8705
|
-
|
|
8667
|
+
const layoutNode = this.layoutNode();
|
|
8668
|
+
const widgetContainer = this.widgetContainer();
|
|
8669
|
+
if (widgetContainer && !this.newComponent && layoutNode.options.template) {
|
|
8670
|
+
this.newComponent = widgetContainer.createComponent(this.componentFactory.resolveComponentFactory(layoutNode.options.template));
|
|
8706
8671
|
}
|
|
8707
8672
|
if (this.newComponent) {
|
|
8708
8673
|
for (const input of ['layoutNode', 'layoutIndex', 'dataIndex']) {
|
|
@@ -8710,8 +8675,8 @@ class TemplateComponent {
|
|
|
8710
8675
|
}
|
|
8711
8676
|
}
|
|
8712
8677
|
}
|
|
8713
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TemplateComponent, deps: [
|
|
8714
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
8678
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TemplateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8679
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "17.3.12", type: TemplateComponent, 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 }); }
|
|
8715
8680
|
}
|
|
8716
8681
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TemplateComponent, decorators: [{
|
|
8717
8682
|
type: Component,
|
|
@@ -8720,42 +8685,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8720
8685
|
selector: 'template-widget',
|
|
8721
8686
|
template: `<div #widgetContainer></div>`,
|
|
8722
8687
|
}]
|
|
8723
|
-
}]
|
|
8724
|
-
type: Input
|
|
8725
|
-
}], layoutIndex: [{
|
|
8726
|
-
type: Input
|
|
8727
|
-
}], dataIndex: [{
|
|
8728
|
-
type: Input
|
|
8729
|
-
}], widgetContainer: [{
|
|
8730
|
-
type: ViewChild,
|
|
8731
|
-
args: ['widgetContainer', { read: ViewContainerRef, static: true }]
|
|
8732
|
-
}] } });
|
|
8688
|
+
}] });
|
|
8733
8689
|
|
|
8734
8690
|
class TextareaComponent {
|
|
8735
|
-
constructor(
|
|
8736
|
-
this.jsf =
|
|
8691
|
+
constructor() {
|
|
8692
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
8737
8693
|
this.controlDisabled = false;
|
|
8738
8694
|
this.boundControl = false;
|
|
8695
|
+
this.layoutNode = input(undefined);
|
|
8696
|
+
this.layoutIndex = input(undefined);
|
|
8697
|
+
this.dataIndex = input(undefined);
|
|
8739
8698
|
}
|
|
8740
8699
|
ngOnInit() {
|
|
8741
|
-
this.options = this.layoutNode.options || {};
|
|
8700
|
+
this.options = this.layoutNode().options || {};
|
|
8742
8701
|
this.jsf.initializeControl(this);
|
|
8743
8702
|
}
|
|
8744
8703
|
updateValue(event) {
|
|
8745
8704
|
this.jsf.updateValue(this, event.target.value);
|
|
8746
8705
|
}
|
|
8747
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaComponent, deps: [
|
|
8748
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
8706
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8707
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: TextareaComponent, 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: `
|
|
8749
8708
|
<div
|
|
8750
8709
|
[class]="options?.htmlClass || ''">
|
|
8751
8710
|
<label *ngIf="options?.title"
|
|
8752
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
8711
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
8753
8712
|
[class]="options?.labelHtmlClass || ''"
|
|
8754
8713
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
8755
8714
|
[innerHTML]="options?.title"></label>
|
|
8756
8715
|
<textarea *ngIf="boundControl"
|
|
8757
8716
|
[formControl]="formControl"
|
|
8758
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8717
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8759
8718
|
[attr.maxlength]="options?.maxLength"
|
|
8760
8719
|
[attr.minlength]="options?.minLength"
|
|
8761
8720
|
[attr.pattern]="options?.pattern"
|
|
@@ -8763,10 +8722,10 @@ class TextareaComponent {
|
|
|
8763
8722
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
8764
8723
|
[attr.required]="options?.required"
|
|
8765
8724
|
[class]="options?.fieldHtmlClass || ''"
|
|
8766
|
-
[id]="'control' + layoutNode?._id"
|
|
8725
|
+
[id]="'control' + layoutNode()?._id"
|
|
8767
8726
|
[name]="controlName"></textarea>
|
|
8768
8727
|
<textarea *ngIf="!boundControl"
|
|
8769
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8728
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8770
8729
|
[attr.maxlength]="options?.maxLength"
|
|
8771
8730
|
[attr.minlength]="options?.minLength"
|
|
8772
8731
|
[attr.pattern]="options?.pattern"
|
|
@@ -8775,11 +8734,11 @@ class TextareaComponent {
|
|
|
8775
8734
|
[attr.required]="options?.required"
|
|
8776
8735
|
[class]="options?.fieldHtmlClass || ''"
|
|
8777
8736
|
[disabled]="controlDisabled"
|
|
8778
|
-
[id]="'control' + layoutNode?._id"
|
|
8737
|
+
[id]="'control' + layoutNode()?._id"
|
|
8779
8738
|
[name]="controlName"
|
|
8780
8739
|
[value]="controlValue"
|
|
8781
8740
|
(input)="updateValue($event)">{{controlValue}}</textarea>
|
|
8782
|
-
</div>`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
8741
|
+
</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"] }] }); }
|
|
8783
8742
|
}
|
|
8784
8743
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TextareaComponent, decorators: [{
|
|
8785
8744
|
type: Component,
|
|
@@ -8790,13 +8749,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8790
8749
|
<div
|
|
8791
8750
|
[class]="options?.htmlClass || ''">
|
|
8792
8751
|
<label *ngIf="options?.title"
|
|
8793
|
-
[attr.for]="'control' + layoutNode?._id"
|
|
8752
|
+
[attr.for]="'control' + layoutNode()?._id"
|
|
8794
8753
|
[class]="options?.labelHtmlClass || ''"
|
|
8795
8754
|
[style.display]="options?.notitle ? 'none' : ''"
|
|
8796
8755
|
[innerHTML]="options?.title"></label>
|
|
8797
8756
|
<textarea *ngIf="boundControl"
|
|
8798
8757
|
[formControl]="formControl"
|
|
8799
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8758
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8800
8759
|
[attr.maxlength]="options?.maxLength"
|
|
8801
8760
|
[attr.minlength]="options?.minLength"
|
|
8802
8761
|
[attr.pattern]="options?.pattern"
|
|
@@ -8804,10 +8763,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8804
8763
|
[attr.readonly]="options?.readonly ? 'readonly' : null"
|
|
8805
8764
|
[attr.required]="options?.required"
|
|
8806
8765
|
[class]="options?.fieldHtmlClass || ''"
|
|
8807
|
-
[id]="'control' + layoutNode?._id"
|
|
8766
|
+
[id]="'control' + layoutNode()?._id"
|
|
8808
8767
|
[name]="controlName"></textarea>
|
|
8809
8768
|
<textarea *ngIf="!boundControl"
|
|
8810
|
-
[attr.aria-describedby]="'control' + layoutNode?._id + 'Status'"
|
|
8769
|
+
[attr.aria-describedby]="'control' + layoutNode()?._id + 'Status'"
|
|
8811
8770
|
[attr.maxlength]="options?.maxLength"
|
|
8812
8771
|
[attr.minlength]="options?.minLength"
|
|
8813
8772
|
[attr.pattern]="options?.pattern"
|
|
@@ -8816,19 +8775,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
8816
8775
|
[attr.required]="options?.required"
|
|
8817
8776
|
[class]="options?.fieldHtmlClass || ''"
|
|
8818
8777
|
[disabled]="controlDisabled"
|
|
8819
|
-
[id]="'control' + layoutNode?._id"
|
|
8778
|
+
[id]="'control' + layoutNode()?._id"
|
|
8820
8779
|
[name]="controlName"
|
|
8821
8780
|
[value]="controlValue"
|
|
8822
8781
|
(input)="updateValue($event)">{{controlValue}}</textarea>
|
|
8823
8782
|
</div>`,
|
|
8824
8783
|
}]
|
|
8825
|
-
}]
|
|
8826
|
-
type: Input
|
|
8827
|
-
}], layoutIndex: [{
|
|
8828
|
-
type: Input
|
|
8829
|
-
}], dataIndex: [{
|
|
8830
|
-
type: Input
|
|
8831
|
-
}] } });
|
|
8784
|
+
}] });
|
|
8832
8785
|
|
|
8833
8786
|
class WidgetLibraryService {
|
|
8834
8787
|
constructor() {
|
|
@@ -9054,10 +9007,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
9054
9007
|
// https://github.com/edcarroll/ng2-semantic-ui
|
|
9055
9008
|
// https://github.com/vladotesanovic/ngSemantic
|
|
9056
9009
|
class FrameworkLibraryService {
|
|
9057
|
-
constructor(frameworks
|
|
9010
|
+
constructor(frameworks) {
|
|
9058
9011
|
this.frameworks = frameworks;
|
|
9059
|
-
|
|
9060
|
-
this.
|
|
9012
|
+
//private frameworks = inject(Framework);
|
|
9013
|
+
this.widgetLibrary = inject(WidgetLibraryService);
|
|
9014
|
+
this.http = inject(HttpClient);
|
|
9061
9015
|
this.activeFramework = null;
|
|
9062
9016
|
this.loadExternalAssets = false;
|
|
9063
9017
|
this.frameworkLibrary = {};
|
|
@@ -9197,7 +9151,7 @@ class FrameworkLibraryService {
|
|
|
9197
9151
|
return actFramework.unregisterTheme(name);
|
|
9198
9152
|
}
|
|
9199
9153
|
}
|
|
9200
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FrameworkLibraryService, deps: [{ token: Framework }
|
|
9154
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FrameworkLibraryService, deps: [{ token: Framework }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
9201
9155
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FrameworkLibraryService, providedIn: 'root' }); }
|
|
9202
9156
|
}
|
|
9203
9157
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: FrameworkLibraryService, decorators: [{
|
|
@@ -9208,10 +9162,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
9208
9162
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
9209
9163
|
type: Inject,
|
|
9210
9164
|
args: [Framework]
|
|
9211
|
-
}] }
|
|
9212
|
-
type: Inject,
|
|
9213
|
-
args: [WidgetLibraryService]
|
|
9214
|
-
}] }, { type: i1.HttpClient }] });
|
|
9165
|
+
}] }] });
|
|
9215
9166
|
|
|
9216
9167
|
const JSON_SCHEMA_FORM_VALUE_ACCESSOR = {
|
|
9217
9168
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -9253,17 +9204,11 @@ const JSON_SCHEMA_FORM_VALUE_ACCESSOR = {
|
|
|
9253
9204
|
* - brace, Browserified Ace editor http://thlorenz.github.io/brace
|
|
9254
9205
|
*/
|
|
9255
9206
|
class JsonSchemaFormComponent {
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
this.
|
|
9261
|
-
}
|
|
9262
|
-
constructor(changeDetector, frameworkLibrary, widgetLibrary, jsf) {
|
|
9263
|
-
this.changeDetector = changeDetector;
|
|
9264
|
-
this.frameworkLibrary = frameworkLibrary;
|
|
9265
|
-
this.widgetLibrary = widgetLibrary;
|
|
9266
|
-
this.jsf = jsf;
|
|
9207
|
+
constructor() {
|
|
9208
|
+
this.changeDetector = inject(ChangeDetectorRef);
|
|
9209
|
+
this.frameworkLibrary = inject(FrameworkLibraryService);
|
|
9210
|
+
this.widgetLibrary = inject(WidgetLibraryService);
|
|
9211
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
9267
9212
|
// TODO: quickfix to avoid subscribing twice to the same emitters
|
|
9268
9213
|
this.unsubscribeOnActivateForm$ = new Subject();
|
|
9269
9214
|
this.formValueSubscription = null;
|
|
@@ -9274,21 +9219,48 @@ class JsonSchemaFormComponent {
|
|
|
9274
9219
|
widgets: null, form: null, model: null, JSONSchema: null, UISchema: null,
|
|
9275
9220
|
formData: null, loadExternalAssets: null, debug: null,
|
|
9276
9221
|
};
|
|
9222
|
+
// Recommended inputs
|
|
9223
|
+
this.schema = input(undefined); // The JSON Schema
|
|
9224
|
+
this.layout = input(undefined); // The form layout
|
|
9225
|
+
this.data = input(undefined); // The form data
|
|
9226
|
+
this.options = input(undefined); // The global form options
|
|
9227
|
+
this.framework = input(undefined); // The framework to load
|
|
9228
|
+
this.widgets = input(undefined); // Any custom widgets to load
|
|
9229
|
+
// Alternate combined single input
|
|
9230
|
+
this.form = input(undefined); // For testing, and JSON Schema Form API compatibility
|
|
9231
|
+
// Angular Schema Form API compatibility input
|
|
9232
|
+
this.model = input(undefined); // Alternate input for form data
|
|
9233
|
+
// React JSON Schema Form API compatibility inputs
|
|
9234
|
+
this.JSONSchema = input(undefined); // Alternate input for JSON Schema
|
|
9235
|
+
this.UISchema = input(undefined); // UI schema - alternate form layout format
|
|
9236
|
+
this.formData = input(undefined); // Alternate input for form data
|
|
9237
|
+
this.ngModel = input(undefined); // Alternate input for Angular forms
|
|
9238
|
+
this.language = input(undefined); // Language
|
|
9239
|
+
// Development inputs, for testing and debugging
|
|
9240
|
+
this.loadExternalAssets = input(undefined); // Load external framework assets?
|
|
9241
|
+
this.debug = input(undefined); // Show debug information?
|
|
9242
|
+
this.theme = input(undefined); // Theme
|
|
9277
9243
|
// Outputs
|
|
9278
|
-
this.onChanges =
|
|
9279
|
-
this.onSubmit =
|
|
9280
|
-
this.isValid =
|
|
9281
|
-
this.validationErrors =
|
|
9282
|
-
this.formSchema =
|
|
9283
|
-
this.formLayout =
|
|
9244
|
+
this.onChanges = output(); // Live unvalidated internal form data
|
|
9245
|
+
this.onSubmit = output(); // Complete validated form data
|
|
9246
|
+
this.isValid = output(); // Is current data valid?
|
|
9247
|
+
this.validationErrors = output(); // Validation errors (if any)
|
|
9248
|
+
this.formSchema = output(); // Final schema used to create form
|
|
9249
|
+
this.formLayout = output(); // Final layout used to create form
|
|
9284
9250
|
// Outputs for possible 2-way data binding
|
|
9285
9251
|
// Only the one input providing the initial form data will be bound.
|
|
9286
9252
|
// If there is no inital data, input '{}' to activate 2-way data binding.
|
|
9287
9253
|
// There is no 2-way binding if inital data is combined inside the 'form' input.
|
|
9288
|
-
this.dataChange =
|
|
9289
|
-
this.modelChange =
|
|
9290
|
-
this.formDataChange =
|
|
9291
|
-
this.ngModelChange =
|
|
9254
|
+
this.dataChange = output();
|
|
9255
|
+
this.modelChange = output();
|
|
9256
|
+
this.formDataChange = output();
|
|
9257
|
+
this.ngModelChange = output();
|
|
9258
|
+
}
|
|
9259
|
+
get value() {
|
|
9260
|
+
return this.objectWrap ? this.jsf.data['1'] : this.jsf.data;
|
|
9261
|
+
}
|
|
9262
|
+
set value(value) {
|
|
9263
|
+
this.setFormValues(value, false);
|
|
9292
9264
|
}
|
|
9293
9265
|
ngOnDestroy() {
|
|
9294
9266
|
this.dataChangesSubs?.unsubscribe();
|
|
@@ -9300,6 +9272,14 @@ class JsonSchemaFormComponent {
|
|
|
9300
9272
|
this.isValidChangesSubs = null;
|
|
9301
9273
|
this.validationErrorChangesSubs = null;
|
|
9302
9274
|
}
|
|
9275
|
+
getInputValue(inputKey) {
|
|
9276
|
+
//TODO review if the value is meant to be a function and not a signal,
|
|
9277
|
+
//it might inadvertently be called!
|
|
9278
|
+
if (typeof this[inputKey] == "function") {
|
|
9279
|
+
return this[inputKey]();
|
|
9280
|
+
}
|
|
9281
|
+
return this[inputKey];
|
|
9282
|
+
}
|
|
9303
9283
|
resetScriptsAndStyleSheets() {
|
|
9304
9284
|
document.querySelectorAll('.ajsf').forEach(element => element.remove());
|
|
9305
9285
|
}
|
|
@@ -9372,13 +9352,14 @@ class JsonSchemaFormComponent {
|
|
|
9372
9352
|
}
|
|
9373
9353
|
updateForm() {
|
|
9374
9354
|
let changedData;
|
|
9355
|
+
const language = this.language();
|
|
9375
9356
|
if (!this.formInitialized || !this.formValuesInput ||
|
|
9376
|
-
(
|
|
9357
|
+
(language && language !== this.jsf.language)) {
|
|
9377
9358
|
this.initializeForm();
|
|
9378
9359
|
}
|
|
9379
9360
|
else {
|
|
9380
|
-
if (
|
|
9381
|
-
this.jsf.setLanguage(
|
|
9361
|
+
if (language && language !== this.jsf.language) {
|
|
9362
|
+
this.jsf.setLanguage(language);
|
|
9382
9363
|
}
|
|
9383
9364
|
// Get names of changed inputs
|
|
9384
9365
|
let changedInput = Object.keys(this.previousInputs)
|
|
@@ -9388,7 +9369,7 @@ class JsonSchemaFormComponent {
|
|
|
9388
9369
|
this.formValuesInput.startsWith('form.')) {
|
|
9389
9370
|
// If only 'form' input changed, get names of changed keys
|
|
9390
9371
|
changedInput = Object.keys(this.previousInputs.form || {})
|
|
9391
|
-
.filter(key => !isEqual$1(this.previousInputs.form[key], this.form[key]))
|
|
9372
|
+
.filter(key => !isEqual$1(this.previousInputs.form[key], this.form()[key]))
|
|
9392
9373
|
.map(key => `form.${key}`);
|
|
9393
9374
|
resetFirst = false;
|
|
9394
9375
|
}
|
|
@@ -9415,13 +9396,14 @@ class JsonSchemaFormComponent {
|
|
|
9415
9396
|
}
|
|
9416
9397
|
}
|
|
9417
9398
|
//set framework theme
|
|
9418
|
-
|
|
9419
|
-
|
|
9399
|
+
const theme = this.theme();
|
|
9400
|
+
if (theme && theme !== this.frameworkLibrary.getActiveTheme()?.name) {
|
|
9401
|
+
this.frameworkLibrary.requestThemeChange(theme);
|
|
9420
9402
|
}
|
|
9421
9403
|
// Update previous inputs
|
|
9422
9404
|
Object.keys(this.previousInputs)
|
|
9423
9405
|
.filter(input => this.previousInputs[input] !== this[input])
|
|
9424
|
-
.forEach(input => this.previousInputs[input] = this
|
|
9406
|
+
.forEach(input => this.previousInputs[input] = this.getInputValue(input));
|
|
9425
9407
|
}
|
|
9426
9408
|
}
|
|
9427
9409
|
setFormValues(formValues, resetFirst = true) {
|
|
@@ -9473,8 +9455,8 @@ class JsonSchemaFormComponent {
|
|
|
9473
9455
|
* the Angular formGroup used to control the reactive form.
|
|
9474
9456
|
*/
|
|
9475
9457
|
initializeForm(initialData) {
|
|
9476
|
-
if (this.schema || this.layout || this.data || this.form || this.model ||
|
|
9477
|
-
this.JSONSchema || this.UISchema || this.formData || this.ngModel ||
|
|
9458
|
+
if (this.schema() || this.layout() || this.data() || this.form() || this.model() ||
|
|
9459
|
+
this.JSONSchema() || this.UISchema() || this.formData() || this.ngModel() ||
|
|
9478
9460
|
this.jsf.data) {
|
|
9479
9461
|
// Reset all form values to defaults
|
|
9480
9462
|
this.jsf.resetAllValues();
|
|
@@ -9507,7 +9489,7 @@ class JsonSchemaFormComponent {
|
|
|
9507
9489
|
// console.log('dataRecursiveRefMap', this.jsf.dataRecursiveRefMap);
|
|
9508
9490
|
// Uncomment individual lines to output debugging information to browser:
|
|
9509
9491
|
// (These only work if the 'debug' option has also been set to 'true'.)
|
|
9510
|
-
if (this.debug || this.jsf.formOptions.debug) {
|
|
9492
|
+
if (this.debug() || this.jsf.formOptions.debug) {
|
|
9511
9493
|
const vars = [];
|
|
9512
9494
|
// vars.push(this.jsf.schema);
|
|
9513
9495
|
// vars.push(this.jsf.layout);
|
|
@@ -9537,24 +9519,28 @@ class JsonSchemaFormComponent {
|
|
|
9537
9519
|
* 2. form.options - Single input style
|
|
9538
9520
|
*/
|
|
9539
9521
|
initializeOptions() {
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
let
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9522
|
+
const language = this.language();
|
|
9523
|
+
if (language && language !== this.jsf.language) {
|
|
9524
|
+
this.jsf.setLanguage(language);
|
|
9525
|
+
}
|
|
9526
|
+
this.jsf.setOptions({ debug: !!this.debug() });
|
|
9527
|
+
let loadExternalAssets = this.loadExternalAssets() || false;
|
|
9528
|
+
let framework = this.framework() || 'default';
|
|
9529
|
+
const options = this.options();
|
|
9530
|
+
if (isObject(options)) {
|
|
9531
|
+
this.jsf.setOptions(options);
|
|
9532
|
+
loadExternalAssets = options.loadExternalAssets || loadExternalAssets;
|
|
9533
|
+
framework = options.framework || framework;
|
|
9534
|
+
}
|
|
9535
|
+
const form = this.form();
|
|
9536
|
+
if (isObject(form) && isObject(form.options)) {
|
|
9537
|
+
this.jsf.setOptions(form.options);
|
|
9538
|
+
loadExternalAssets = form.options.loadExternalAssets || loadExternalAssets;
|
|
9539
|
+
framework = form.options.framework || framework;
|
|
9540
|
+
}
|
|
9541
|
+
const widgets = this.widgets();
|
|
9542
|
+
if (isObject(widgets)) {
|
|
9543
|
+
this.jsf.setOptions({ widgets: widgets });
|
|
9558
9544
|
}
|
|
9559
9545
|
this.frameworkLibrary.setLoadExternalAssets(loadExternalAssets);
|
|
9560
9546
|
this.frameworkLibrary.setFramework(framework);
|
|
@@ -9564,11 +9550,12 @@ class JsonSchemaFormComponent {
|
|
|
9564
9550
|
this.widgetLibrary.registerWidget(widget, this.jsf.formOptions.widgets[widget]);
|
|
9565
9551
|
}
|
|
9566
9552
|
}
|
|
9567
|
-
if (isObject(
|
|
9568
|
-
this.jsf.setTpldata(
|
|
9553
|
+
if (isObject(form) && isObject(form.tpldata)) {
|
|
9554
|
+
this.jsf.setTpldata(form.tpldata);
|
|
9569
9555
|
}
|
|
9570
|
-
|
|
9571
|
-
|
|
9556
|
+
const theme = this.theme();
|
|
9557
|
+
if (theme) {
|
|
9558
|
+
this.frameworkLibrary.requestThemeChange(theme);
|
|
9572
9559
|
}
|
|
9573
9560
|
}
|
|
9574
9561
|
/**
|
|
@@ -9589,25 +9576,28 @@ class JsonSchemaFormComponent {
|
|
|
9589
9576
|
*/
|
|
9590
9577
|
initializeSchema() {
|
|
9591
9578
|
// TODO: update to allow non-object schemas
|
|
9592
|
-
|
|
9579
|
+
const form = this.form();
|
|
9580
|
+
const schema = this.schema();
|
|
9581
|
+
const JSONSchema = this.JSONSchema();
|
|
9582
|
+
if (isObject(schema)) {
|
|
9593
9583
|
this.jsf.AngularSchemaFormCompatibility = true;
|
|
9594
|
-
this.jsf.schema = cloneDeep(
|
|
9584
|
+
this.jsf.schema = cloneDeep(schema);
|
|
9595
9585
|
}
|
|
9596
|
-
else if (hasOwn(
|
|
9597
|
-
this.jsf.schema = cloneDeep(
|
|
9586
|
+
else if (hasOwn(form, 'schema') && isObject(form.schema)) {
|
|
9587
|
+
this.jsf.schema = cloneDeep(form.schema);
|
|
9598
9588
|
}
|
|
9599
|
-
else if (isObject(
|
|
9589
|
+
else if (isObject(JSONSchema)) {
|
|
9600
9590
|
this.jsf.ReactJsonSchemaFormCompatibility = true;
|
|
9601
|
-
this.jsf.schema = cloneDeep(
|
|
9591
|
+
this.jsf.schema = cloneDeep(JSONSchema);
|
|
9602
9592
|
}
|
|
9603
|
-
else if (hasOwn(
|
|
9593
|
+
else if (hasOwn(form, 'JSONSchema') && isObject(form.JSONSchema)) {
|
|
9604
9594
|
this.jsf.ReactJsonSchemaFormCompatibility = true;
|
|
9605
|
-
this.jsf.schema = cloneDeep(
|
|
9595
|
+
this.jsf.schema = cloneDeep(form.JSONSchema);
|
|
9606
9596
|
}
|
|
9607
|
-
else if (hasOwn(
|
|
9608
|
-
this.jsf.schema = cloneDeep(
|
|
9597
|
+
else if (hasOwn(form, 'properties') && isObject(form.properties)) {
|
|
9598
|
+
this.jsf.schema = cloneDeep(form);
|
|
9609
9599
|
}
|
|
9610
|
-
else if (isObject(
|
|
9600
|
+
else if (isObject(form)) {
|
|
9611
9601
|
// TODO: Handle other types of form input
|
|
9612
9602
|
}
|
|
9613
9603
|
if (!isEmpty(this.jsf.schema)) {
|
|
@@ -9673,36 +9663,40 @@ class JsonSchemaFormComponent {
|
|
|
9673
9663
|
* 7. (none) no data - initialize data from schema and layout defaults only
|
|
9674
9664
|
*/
|
|
9675
9665
|
initializeData() {
|
|
9676
|
-
|
|
9677
|
-
|
|
9666
|
+
const form = this.form();
|
|
9667
|
+
const data = this.data();
|
|
9668
|
+
const model = this.model();
|
|
9669
|
+
const ngModel = this.ngModel();
|
|
9670
|
+
if (hasValue(data)) {
|
|
9671
|
+
this.jsf.formValues = cloneDeep(data);
|
|
9678
9672
|
this.formValuesInput = 'data';
|
|
9679
9673
|
}
|
|
9680
|
-
else if (hasValue(
|
|
9674
|
+
else if (hasValue(model)) {
|
|
9681
9675
|
this.jsf.AngularSchemaFormCompatibility = true;
|
|
9682
|
-
this.jsf.formValues = cloneDeep(
|
|
9676
|
+
this.jsf.formValues = cloneDeep(model);
|
|
9683
9677
|
this.formValuesInput = 'model';
|
|
9684
9678
|
}
|
|
9685
|
-
else if (hasValue(
|
|
9679
|
+
else if (hasValue(ngModel)) {
|
|
9686
9680
|
this.jsf.AngularSchemaFormCompatibility = true;
|
|
9687
|
-
this.jsf.formValues = cloneDeep(
|
|
9681
|
+
this.jsf.formValues = cloneDeep(ngModel);
|
|
9688
9682
|
this.formValuesInput = 'ngModel';
|
|
9689
9683
|
}
|
|
9690
|
-
else if (isObject(
|
|
9684
|
+
else if (isObject(form) && hasValue(form.value)) {
|
|
9691
9685
|
this.jsf.JsonFormCompatibility = true;
|
|
9692
|
-
this.jsf.formValues = cloneDeep(
|
|
9686
|
+
this.jsf.formValues = cloneDeep(form.value);
|
|
9693
9687
|
this.formValuesInput = 'form.value';
|
|
9694
9688
|
}
|
|
9695
|
-
else if (isObject(
|
|
9696
|
-
this.jsf.formValues = cloneDeep(
|
|
9689
|
+
else if (isObject(form) && hasValue(form.data)) {
|
|
9690
|
+
this.jsf.formValues = cloneDeep(form.data);
|
|
9697
9691
|
this.formValuesInput = 'form.data';
|
|
9698
9692
|
}
|
|
9699
|
-
else if (hasValue(this.formData)) {
|
|
9693
|
+
else if (hasValue(this.formData())) {
|
|
9700
9694
|
this.jsf.ReactJsonSchemaFormCompatibility = true;
|
|
9701
9695
|
this.formValuesInput = 'formData';
|
|
9702
9696
|
}
|
|
9703
|
-
else if (hasOwn(
|
|
9697
|
+
else if (hasOwn(form, 'formData') && hasValue(form.formData)) {
|
|
9704
9698
|
this.jsf.ReactJsonSchemaFormCompatibility = true;
|
|
9705
|
-
this.jsf.formValues = cloneDeep(
|
|
9699
|
+
this.jsf.formValues = cloneDeep(form.formData);
|
|
9706
9700
|
this.formValuesInput = 'form.formData';
|
|
9707
9701
|
}
|
|
9708
9702
|
else {
|
|
@@ -9745,40 +9739,44 @@ class JsonSchemaFormComponent {
|
|
|
9745
9739
|
return layout;
|
|
9746
9740
|
};
|
|
9747
9741
|
// Check for layout inputs and, if found, initialize form layout
|
|
9748
|
-
|
|
9749
|
-
|
|
9742
|
+
const form = this.form();
|
|
9743
|
+
const layoutValue = this.layout();
|
|
9744
|
+
if (isArray(layoutValue)) {
|
|
9745
|
+
this.jsf.layout = cloneDeep(layoutValue);
|
|
9750
9746
|
}
|
|
9751
|
-
else if (isArray(
|
|
9747
|
+
else if (isArray(form)) {
|
|
9752
9748
|
this.jsf.AngularSchemaFormCompatibility = true;
|
|
9753
|
-
this.jsf.layout = cloneDeep(
|
|
9749
|
+
this.jsf.layout = cloneDeep(form);
|
|
9754
9750
|
}
|
|
9755
|
-
else if (
|
|
9751
|
+
else if (form && isArray(form.form)) {
|
|
9756
9752
|
this.jsf.JsonFormCompatibility = true;
|
|
9757
|
-
this.jsf.layout = fixJsonFormOptions(cloneDeep(
|
|
9753
|
+
this.jsf.layout = fixJsonFormOptions(cloneDeep(form.form));
|
|
9758
9754
|
}
|
|
9759
|
-
else if (
|
|
9760
|
-
this.jsf.layout = cloneDeep(
|
|
9755
|
+
else if (form && isArray(form.layout)) {
|
|
9756
|
+
this.jsf.layout = cloneDeep(form.layout);
|
|
9761
9757
|
}
|
|
9762
9758
|
else {
|
|
9763
9759
|
this.jsf.layout = ['*'];
|
|
9764
9760
|
}
|
|
9765
9761
|
// Check for alternate layout inputs
|
|
9766
9762
|
let alternateLayout = null;
|
|
9767
|
-
|
|
9763
|
+
const formValue = this.form();
|
|
9764
|
+
const UISchema = this.UISchema();
|
|
9765
|
+
if (isObject(UISchema)) {
|
|
9768
9766
|
this.jsf.ReactJsonSchemaFormCompatibility = true;
|
|
9769
|
-
alternateLayout = cloneDeep(
|
|
9767
|
+
alternateLayout = cloneDeep(UISchema);
|
|
9770
9768
|
}
|
|
9771
|
-
else if (hasOwn(
|
|
9769
|
+
else if (hasOwn(formValue, 'UISchema')) {
|
|
9772
9770
|
this.jsf.ReactJsonSchemaFormCompatibility = true;
|
|
9773
|
-
alternateLayout = cloneDeep(
|
|
9771
|
+
alternateLayout = cloneDeep(formValue.UISchema);
|
|
9774
9772
|
}
|
|
9775
|
-
else if (hasOwn(
|
|
9773
|
+
else if (hasOwn(formValue, 'uiSchema')) {
|
|
9776
9774
|
this.jsf.ReactJsonSchemaFormCompatibility = true;
|
|
9777
|
-
alternateLayout = cloneDeep(
|
|
9775
|
+
alternateLayout = cloneDeep(formValue.uiSchema);
|
|
9778
9776
|
}
|
|
9779
|
-
else if (hasOwn(
|
|
9777
|
+
else if (hasOwn(formValue, 'customFormItems')) {
|
|
9780
9778
|
this.jsf.JsonFormCompatibility = true;
|
|
9781
|
-
alternateLayout = fixJsonFormOptions(cloneDeep(
|
|
9779
|
+
alternateLayout = fixJsonFormOptions(cloneDeep(formValue.customFormItems));
|
|
9782
9780
|
}
|
|
9783
9781
|
// if alternate layout found, copy alternate layout options into schema
|
|
9784
9782
|
if (alternateLayout) {
|
|
@@ -9897,82 +9895,29 @@ class JsonSchemaFormComponent {
|
|
|
9897
9895
|
}
|
|
9898
9896
|
}
|
|
9899
9897
|
}
|
|
9900
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: JsonSchemaFormComponent, deps: [
|
|
9901
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
9898
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: JsonSchemaFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9899
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: JsonSchemaFormComponent, 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 }); }
|
|
9902
9900
|
}
|
|
9903
9901
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: JsonSchemaFormComponent, decorators: [{
|
|
9904
9902
|
type: Component,
|
|
9905
|
-
args: [{ selector: 'json-schema-form', changeDetection: ChangeDetectionStrategy.OnPush, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], 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>" }]
|
|
9906
|
-
}],
|
|
9907
|
-
type: Input
|
|
9908
|
-
}], layout: [{
|
|
9909
|
-
type: Input
|
|
9910
|
-
}], data: [{
|
|
9911
|
-
type: Input
|
|
9912
|
-
}], options: [{
|
|
9903
|
+
args: [{ selector: 'json-schema-form', changeDetection: ChangeDetectionStrategy.OnPush, providers: [JsonSchemaFormService, JSON_SCHEMA_FORM_VALUE_ACCESSOR], 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>" }]
|
|
9904
|
+
}], propDecorators: { value: [{
|
|
9913
9905
|
type: Input
|
|
9914
|
-
}], framework: [{
|
|
9915
|
-
type: Input
|
|
9916
|
-
}], widgets: [{
|
|
9917
|
-
type: Input
|
|
9918
|
-
}], form: [{
|
|
9919
|
-
type: Input
|
|
9920
|
-
}], model: [{
|
|
9921
|
-
type: Input
|
|
9922
|
-
}], JSONSchema: [{
|
|
9923
|
-
type: Input
|
|
9924
|
-
}], UISchema: [{
|
|
9925
|
-
type: Input
|
|
9926
|
-
}], formData: [{
|
|
9927
|
-
type: Input
|
|
9928
|
-
}], ngModel: [{
|
|
9929
|
-
type: Input
|
|
9930
|
-
}], language: [{
|
|
9931
|
-
type: Input
|
|
9932
|
-
}], loadExternalAssets: [{
|
|
9933
|
-
type: Input
|
|
9934
|
-
}], debug: [{
|
|
9935
|
-
type: Input
|
|
9936
|
-
}], theme: [{
|
|
9937
|
-
type: Input
|
|
9938
|
-
}], value: [{
|
|
9939
|
-
type: Input
|
|
9940
|
-
}], onChanges: [{
|
|
9941
|
-
type: Output
|
|
9942
|
-
}], onSubmit: [{
|
|
9943
|
-
type: Output
|
|
9944
|
-
}], isValid: [{
|
|
9945
|
-
type: Output
|
|
9946
|
-
}], validationErrors: [{
|
|
9947
|
-
type: Output
|
|
9948
|
-
}], formSchema: [{
|
|
9949
|
-
type: Output
|
|
9950
|
-
}], formLayout: [{
|
|
9951
|
-
type: Output
|
|
9952
|
-
}], dataChange: [{
|
|
9953
|
-
type: Output
|
|
9954
|
-
}], modelChange: [{
|
|
9955
|
-
type: Output
|
|
9956
|
-
}], formDataChange: [{
|
|
9957
|
-
type: Output
|
|
9958
|
-
}], ngModelChange: [{
|
|
9959
|
-
type: Output
|
|
9960
9906
|
}] } });
|
|
9961
9907
|
|
|
9962
9908
|
class NoFrameworkComponent {
|
|
9909
|
+
constructor() {
|
|
9910
|
+
this.layoutNode = input(undefined);
|
|
9911
|
+
this.layoutIndex = input(undefined);
|
|
9912
|
+
this.dataIndex = input(undefined);
|
|
9913
|
+
}
|
|
9963
9914
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NoFrameworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9964
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
9915
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: NoFrameworkComponent, 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"] }] }); }
|
|
9965
9916
|
}
|
|
9966
9917
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NoFrameworkComponent, decorators: [{
|
|
9967
9918
|
type: Component,
|
|
9968
|
-
args: [{ selector: 'no-framework', template: "<select-widget-widget [dataIndex]=\"dataIndex\" [layoutIndex]=\"layoutIndex\" [layoutNode]=\"layoutNode\">\r\n</select-widget-widget>" }]
|
|
9969
|
-
}]
|
|
9970
|
-
type: Input
|
|
9971
|
-
}], layoutIndex: [{
|
|
9972
|
-
type: Input
|
|
9973
|
-
}], dataIndex: [{
|
|
9974
|
-
type: Input
|
|
9975
|
-
}] } });
|
|
9919
|
+
args: [{ selector: 'no-framework', template: "<select-widget-widget [dataIndex]=\"dataIndex()\" [layoutIndex]=\"layoutIndex()\" [layoutNode]=\"layoutNode()\">\r\n</select-widget-widget>" }]
|
|
9920
|
+
}] });
|
|
9976
9921
|
|
|
9977
9922
|
// No framework - plain HTML controls (styles from form layout only)
|
|
9978
9923
|
class NoFramework extends Framework {
|
|
@@ -9990,27 +9935,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
9990
9935
|
}] });
|
|
9991
9936
|
|
|
9992
9937
|
class HiddenComponent {
|
|
9993
|
-
constructor(
|
|
9994
|
-
this.jsf =
|
|
9938
|
+
constructor() {
|
|
9939
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
9995
9940
|
this.controlDisabled = false;
|
|
9996
9941
|
this.boundControl = false;
|
|
9942
|
+
this.layoutNode = input(undefined);
|
|
9943
|
+
this.layoutIndex = input(undefined);
|
|
9944
|
+
this.dataIndex = input(undefined);
|
|
9997
9945
|
}
|
|
9998
9946
|
ngOnInit() {
|
|
9999
9947
|
this.jsf.initializeControl(this);
|
|
10000
9948
|
}
|
|
10001
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HiddenComponent, deps: [
|
|
10002
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
9949
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HiddenComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9950
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: HiddenComponent, 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: `
|
|
10003
9951
|
<input *ngIf="boundControl"
|
|
10004
9952
|
[formControl]="formControl"
|
|
10005
|
-
[id]="'control' + layoutNode?._id"
|
|
9953
|
+
[id]="'control' + layoutNode()?._id"
|
|
10006
9954
|
[name]="controlName"
|
|
10007
9955
|
type="hidden">
|
|
10008
9956
|
<input *ngIf="!boundControl"
|
|
10009
9957
|
[disabled]="controlDisabled"
|
|
10010
9958
|
[name]="controlName"
|
|
10011
|
-
[id]="'control' + layoutNode?._id"
|
|
9959
|
+
[id]="'control' + layoutNode()?._id"
|
|
10012
9960
|
type="hidden"
|
|
10013
|
-
[value]="controlValue">`, isInline: true, dependencies: [{ kind: "directive", type:
|
|
9961
|
+
[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"] }] }); }
|
|
10014
9962
|
}
|
|
10015
9963
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HiddenComponent, decorators: [{
|
|
10016
9964
|
type: Component,
|
|
@@ -10020,38 +9968,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
10020
9968
|
template: `
|
|
10021
9969
|
<input *ngIf="boundControl"
|
|
10022
9970
|
[formControl]="formControl"
|
|
10023
|
-
[id]="'control' + layoutNode?._id"
|
|
9971
|
+
[id]="'control' + layoutNode()?._id"
|
|
10024
9972
|
[name]="controlName"
|
|
10025
9973
|
type="hidden">
|
|
10026
9974
|
<input *ngIf="!boundControl"
|
|
10027
9975
|
[disabled]="controlDisabled"
|
|
10028
9976
|
[name]="controlName"
|
|
10029
|
-
[id]="'control' + layoutNode?._id"
|
|
9977
|
+
[id]="'control' + layoutNode()?._id"
|
|
10030
9978
|
type="hidden"
|
|
10031
9979
|
[value]="controlValue">`,
|
|
10032
9980
|
}]
|
|
10033
|
-
}]
|
|
10034
|
-
type: Input
|
|
10035
|
-
}], layoutIndex: [{
|
|
10036
|
-
type: Input
|
|
10037
|
-
}], dataIndex: [{
|
|
10038
|
-
type: Input
|
|
10039
|
-
}] } });
|
|
9981
|
+
}] });
|
|
10040
9982
|
|
|
10041
9983
|
class TabComponent {
|
|
10042
|
-
constructor(
|
|
10043
|
-
this.jsf =
|
|
9984
|
+
constructor() {
|
|
9985
|
+
this.jsf = inject(JsonSchemaFormService);
|
|
9986
|
+
this.layoutNode = input(undefined);
|
|
9987
|
+
this.layoutIndex = input(undefined);
|
|
9988
|
+
this.dataIndex = input(undefined);
|
|
10044
9989
|
}
|
|
10045
9990
|
ngOnInit() {
|
|
10046
|
-
this.options = this.layoutNode.options || {};
|
|
9991
|
+
this.options = this.layoutNode().options || {};
|
|
10047
9992
|
}
|
|
10048
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabComponent, deps: [
|
|
10049
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
9993
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9994
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "17.3.12", type: TabComponent, 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: `
|
|
10050
9995
|
<div [class]="options?.htmlClass || ''">
|
|
10051
9996
|
<root-widget
|
|
10052
|
-
[dataIndex]="dataIndex"
|
|
10053
|
-
[layoutIndex]="layoutIndex"
|
|
10054
|
-
[layout]="layoutNode.items"></root-widget>
|
|
9997
|
+
[dataIndex]="dataIndex()"
|
|
9998
|
+
[layoutIndex]="layoutIndex()"
|
|
9999
|
+
[layout]="layoutNode().items"></root-widget>
|
|
10055
10000
|
</div>`, isInline: true, dependencies: [{ kind: "component", type: RootComponent, selector: "root-widget", inputs: ["dataIndex", "layoutIndex", "layout", "isOrderable", "isFlexItem"] }] }); }
|
|
10056
10001
|
}
|
|
10057
10002
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: TabComponent, decorators: [{
|
|
@@ -10062,18 +10007,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
|
10062
10007
|
template: `
|
|
10063
10008
|
<div [class]="options?.htmlClass || ''">
|
|
10064
10009
|
<root-widget
|
|
10065
|
-
[dataIndex]="dataIndex"
|
|
10066
|
-
[layoutIndex]="layoutIndex"
|
|
10067
|
-
[layout]="layoutNode.items"></root-widget>
|
|
10010
|
+
[dataIndex]="dataIndex()"
|
|
10011
|
+
[layoutIndex]="layoutIndex()"
|
|
10012
|
+
[layout]="layoutNode().items"></root-widget>
|
|
10068
10013
|
</div>`,
|
|
10069
10014
|
}]
|
|
10070
|
-
}]
|
|
10071
|
-
type: Input
|
|
10072
|
-
}], layoutIndex: [{
|
|
10073
|
-
type: Input
|
|
10074
|
-
}], dataIndex: [{
|
|
10075
|
-
type: Input
|
|
10076
|
-
}] } });
|
|
10015
|
+
}] });
|
|
10077
10016
|
|
|
10078
10017
|
const BASIC_WIDGETS = [
|
|
10079
10018
|
AddReferenceComponent, OneOfComponent, ButtonComponent, CheckboxComponent,
|