@stemy/ngx-dynamic-form 19.9.32 → 19.9.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/stemy-ngx-dynamic-form.mjs +80 -50
- package/fesm2022/stemy-ngx-dynamic-form.mjs.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +15 -13
- package/ngx-dynamic-form/components/dynamic-form-date/dynamic-form-date.component.d.ts +6 -0
- package/ngx-dynamic-form/ngx-dynamic-form.imports.d.ts +2 -2
- package/ngx-dynamic-form/ngx-dynamic-form.module.d.ts +20 -19
- package/ngx-dynamic-form/services/dynamic-form-builder.service.d.ts +2 -1
- package/ngx-dynamic-form/services/dynamic-form-schema.service.d.ts +1 -1
- package/ngx-dynamic-form/utils/decorators.d.ts +2 -1
- package/ngx-dynamic-form/utils/misc.d.ts +2 -2
- package/ngx-dynamic-form/utils/validation.d.ts +1 -0
- package/package.json +2 -2
- package/public_api.d.ts +4 -3
|
@@ -77,6 +77,12 @@ function FormSelect(data) {
|
|
|
77
77
|
defineFormControl(target, key, (fb, path, options) => fb.createFormSelect(key, data, path, options));
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
+
function FormDate(data) {
|
|
81
|
+
data = data || {};
|
|
82
|
+
return (target, key) => {
|
|
83
|
+
defineFormControl(target, key, (fb, path, options) => fb.createFormDate(key, data, path, options));
|
|
84
|
+
};
|
|
85
|
+
}
|
|
80
86
|
function FormUpload(data) {
|
|
81
87
|
data = data || {};
|
|
82
88
|
return (target, key) => {
|
|
@@ -145,7 +151,7 @@ function controlStatus(control, timeout = 10) {
|
|
|
145
151
|
* @param value Value to convert to date string
|
|
146
152
|
* @param format Expected date format (date, date-time)
|
|
147
153
|
*/
|
|
148
|
-
function convertToDateFormat(value, format) {
|
|
154
|
+
function convertToDateFormat(value, format = "date") {
|
|
149
155
|
if (!ObjectUtils.isDefined(value) || !format?.includes("date"))
|
|
150
156
|
return value;
|
|
151
157
|
value = ObjectUtils.isDate(value) ? value : new Date(value);
|
|
@@ -160,7 +166,7 @@ function convertToDateFormat(value, format) {
|
|
|
160
166
|
* @param value Value to convert to date
|
|
161
167
|
* @param format Expected date format (date, date-time)
|
|
162
168
|
*/
|
|
163
|
-
function convertToDate(value, format) {
|
|
169
|
+
function convertToDate(value, format = "date") {
|
|
164
170
|
return (!ObjectUtils.isDefined(value) || !format?.includes("date"))
|
|
165
171
|
? value
|
|
166
172
|
: new Date(convertToDateFormat(value, format));
|
|
@@ -311,7 +317,7 @@ function isFieldHidden(field) {
|
|
|
311
317
|
const MIN_INPUT_NUM = -1999999999;
|
|
312
318
|
const MAX_INPUT_NUM = 1999999999;
|
|
313
319
|
const EDITOR_TYPES = ["php", "json", "html", "css", "scss"];
|
|
314
|
-
const CUSTOM_INPUT_TYPES = ["checkbox", "textarea", "wysiwyg", "password"];
|
|
320
|
+
const CUSTOM_INPUT_TYPES = ["checkbox", "textarea", "wysiwyg", "date", "password"];
|
|
315
321
|
|
|
316
322
|
function validationMessage(errorKey) {
|
|
317
323
|
const key = `form.error.${errorKey}`;
|
|
@@ -429,6 +435,8 @@ function maxLengthValidation(maxLength) {
|
|
|
429
435
|
}
|
|
430
436
|
function minValueValidation() {
|
|
431
437
|
return validateEach((v, f) => {
|
|
438
|
+
if (v == null)
|
|
439
|
+
return true;
|
|
432
440
|
const type = f.props.type || "number";
|
|
433
441
|
const min = type.includes("date")
|
|
434
442
|
? convertToDate(f.props.min, type) : Number(f.props.min ?? 0);
|
|
@@ -436,11 +444,13 @@ function minValueValidation() {
|
|
|
436
444
|
const date = new Date(v);
|
|
437
445
|
return isNaN(date) || date >= min;
|
|
438
446
|
}
|
|
439
|
-
return v
|
|
447
|
+
return v >= min;
|
|
440
448
|
}, "minValue");
|
|
441
449
|
}
|
|
442
450
|
function maxValueValidation() {
|
|
443
451
|
return validateEach((v, f) => {
|
|
452
|
+
if (v == null)
|
|
453
|
+
return true;
|
|
444
454
|
const type = f.props.type || "number";
|
|
445
455
|
const max = type.includes("date")
|
|
446
456
|
? convertToDate(f.props.max, type) : Number(f.props.max ?? 0);
|
|
@@ -448,7 +458,7 @@ function maxValueValidation() {
|
|
|
448
458
|
const date = new Date(v);
|
|
449
459
|
return isNaN(date) || date <= max;
|
|
450
460
|
}
|
|
451
|
-
return v
|
|
461
|
+
return v <= max;
|
|
452
462
|
}, "maxValue");
|
|
453
463
|
}
|
|
454
464
|
function enumValidation($enum) {
|
|
@@ -456,6 +466,11 @@ function enumValidation($enum) {
|
|
|
456
466
|
return $enum.includes(v);
|
|
457
467
|
}, "enum");
|
|
458
468
|
}
|
|
469
|
+
function equalsValidation(target) {
|
|
470
|
+
return validateEach(v => {
|
|
471
|
+
return v === target;
|
|
472
|
+
}, "equals");
|
|
473
|
+
}
|
|
459
474
|
function setFieldMinDate(field, min, setValue = true) {
|
|
460
475
|
setFieldProp(field, "min", min);
|
|
461
476
|
addFieldValidators(field, [minValueValidation()]);
|
|
@@ -817,16 +832,20 @@ class DynamicFormBuilderService {
|
|
|
817
832
|
style: data.style === "list" ? "list" : "table"
|
|
818
833
|
}, parent, options);
|
|
819
834
|
}
|
|
835
|
+
createFormDate(key, data, parent, options) {
|
|
836
|
+
data = data || {};
|
|
837
|
+
return this.createFormField(key, "date", data, {
|
|
838
|
+
min: convertToDateFormat(data.min),
|
|
839
|
+
max: convertToDateFormat(data.max),
|
|
840
|
+
disabledDays: Array.isArray(data.disabledDays)
|
|
841
|
+
? data.disabledDays.map(n => convertToNumber(n)) : [],
|
|
842
|
+
disabledDates: Array.isArray(data.disabledDates)
|
|
843
|
+
? data.disabledDates.map(n => convertToDate(n)) : [],
|
|
844
|
+
strict: data.strict !== false,
|
|
845
|
+
}, parent, options);
|
|
846
|
+
}
|
|
820
847
|
createFormUpload(key, data, parent, options) {
|
|
821
848
|
data = data || {};
|
|
822
|
-
if (data.asFile) {
|
|
823
|
-
data.inline = true;
|
|
824
|
-
console.warn(`File upload property "asFile" is deprecated. Use "inline" instead.`);
|
|
825
|
-
}
|
|
826
|
-
if (data.multi) {
|
|
827
|
-
data.multiple = true;
|
|
828
|
-
console.warn(`File upload property "multi" is deprecated. Use "multiple" instead.`);
|
|
829
|
-
}
|
|
830
849
|
const baseUrl = data.url?.startsWith("http") ? data.url : this.api.url(data.url || "assets");
|
|
831
850
|
return this.createFormField(key, "upload", data, {
|
|
832
851
|
inline: data.inline === true,
|
|
@@ -835,10 +854,7 @@ class DynamicFormBuilderService {
|
|
|
835
854
|
url: baseUrl,
|
|
836
855
|
uploadUrl: data.url?.startsWith("http")
|
|
837
856
|
? data.uploadUrl
|
|
838
|
-
: (data.uploadUrl ? this.api.url(data.uploadUrl || "assets") : baseUrl)
|
|
839
|
-
maxSize: isNaN(data.maxSize) ? MAX_INPUT_NUM : data.maxSize,
|
|
840
|
-
uploadOptions: data.uploadOptions || {},
|
|
841
|
-
createUploadData: data.createUploadData
|
|
857
|
+
: (data.uploadUrl ? this.api.url(data.uploadUrl || "assets") : baseUrl)
|
|
842
858
|
}, parent, options);
|
|
843
859
|
}
|
|
844
860
|
createFormGroup(key, fields, data, parent, options) {
|
|
@@ -1203,20 +1219,9 @@ class DynamicFormSchemaService {
|
|
|
1203
1219
|
return !field ? [] : options.customize(field, property, schema);
|
|
1204
1220
|
}
|
|
1205
1221
|
async getFormFieldForProp(property, options, parent) {
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
return this.getFormGroupConfig(property, options, parent);
|
|
1210
|
-
}
|
|
1211
|
-
// Then check the property type
|
|
1212
|
-
switch (property.type) {
|
|
1213
|
-
case "object":
|
|
1214
|
-
return this.getFormEditorConfig(property, options, parent);
|
|
1215
|
-
case "file":
|
|
1216
|
-
case "upload":
|
|
1217
|
-
return this.getFormUploadConfig(property, options, parent);
|
|
1218
|
-
case "boolean":
|
|
1219
|
-
return this.getFormCheckboxConfig(property, options, parent);
|
|
1222
|
+
if (property.type === "boolean") {
|
|
1223
|
+
// Handle boolean first
|
|
1224
|
+
return this.getFormCheckboxConfig(property, options, parent);
|
|
1220
1225
|
}
|
|
1221
1226
|
const $enum = property.items?.enum || property.enum;
|
|
1222
1227
|
if (Array.isArray($enum) || ObjectUtils.isStringWithValue(property.optionsPath) || ObjectUtils.isStringWithValue(property.endpoint)) {
|
|
@@ -1234,17 +1239,23 @@ class DynamicFormSchemaService {
|
|
|
1234
1239
|
return this.getFormTextareaConfig(property, options, parent);
|
|
1235
1240
|
}
|
|
1236
1241
|
if (property.format == "date" || property.format == "date-time") {
|
|
1237
|
-
return this.
|
|
1242
|
+
return this.getFormDateConfig(property, options, parent);
|
|
1238
1243
|
}
|
|
1244
|
+
// First check property references, because a dynamic schema can be a type of object which we use for editor
|
|
1245
|
+
const refs = await this.openApi.getReferences(property, options.schema);
|
|
1246
|
+
if (refs.length > 0) {
|
|
1247
|
+
return this.getFormGroupConfig(property, options, parent);
|
|
1248
|
+
}
|
|
1249
|
+
// Then check if it might be an editor property
|
|
1239
1250
|
if (this.checkIsEditorProperty(property)) {
|
|
1240
1251
|
return this.getFormEditorConfig(property, options, parent);
|
|
1241
1252
|
}
|
|
1242
1253
|
return this.getFormInputConfig(property, options, parent);
|
|
1243
1254
|
}
|
|
1244
1255
|
checkIsEditorProperty(property) {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1256
|
+
return property.type === "object"
|
|
1257
|
+
|| EDITOR_TYPES.indexOf(property.format) >= 0
|
|
1258
|
+
|| property.format?.endsWith("script");
|
|
1248
1259
|
}
|
|
1249
1260
|
getFormFieldData(property, options) {
|
|
1250
1261
|
const validators = {};
|
|
@@ -1361,13 +1372,16 @@ class DynamicFormSchemaService {
|
|
|
1361
1372
|
type: property.format || "json"
|
|
1362
1373
|
}, parent, options);
|
|
1363
1374
|
}
|
|
1364
|
-
|
|
1365
|
-
const type = property.format == "date-time" ? "datetime-local" : "date";
|
|
1366
|
-
|
|
1375
|
+
getFormDateConfig(property, options, parent) {
|
|
1376
|
+
// const type = property.format == "date-time" ? "datetime-local" : "date";
|
|
1377
|
+
// TODO: Support date-time also
|
|
1378
|
+
return this.builder.createFormDate(property.id, {
|
|
1367
1379
|
...this.getFormFieldData(property, options),
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1380
|
+
min: convertToDate(property.minimum ?? property.min, property.format),
|
|
1381
|
+
max: convertToDate(property.maximum ?? property.max, property.format),
|
|
1382
|
+
disabledDays: property.disabledDays,
|
|
1383
|
+
disabledDates: property.disabledDates,
|
|
1384
|
+
strict: property.strict,
|
|
1371
1385
|
}, parent, options);
|
|
1372
1386
|
}
|
|
1373
1387
|
getFormSelectConfig($enum, property, options, parent) {
|
|
@@ -1389,8 +1403,7 @@ class DynamicFormSchemaService {
|
|
|
1389
1403
|
inline: property.inline,
|
|
1390
1404
|
accept: property.accept,
|
|
1391
1405
|
url: property.url,
|
|
1392
|
-
|
|
1393
|
-
uploadOptions: property.uploadOptions
|
|
1406
|
+
uploadUrl: property.uploadUrl,
|
|
1394
1407
|
}, parent, options);
|
|
1395
1408
|
}
|
|
1396
1409
|
getFormCheckboxConfig(property, options, parent) {
|
|
@@ -1527,6 +1540,9 @@ class DynamicFormSchemaService {
|
|
|
1527
1540
|
if (Array.isArray(property.enum)) {
|
|
1528
1541
|
validators.enum = enumValidation(property.enum);
|
|
1529
1542
|
}
|
|
1543
|
+
if ("equals" in property) {
|
|
1544
|
+
validators.equals = equalsValidation(property.equals);
|
|
1545
|
+
}
|
|
1530
1546
|
// if (isString(property.pattern) && property.pattern.length) {
|
|
1531
1547
|
// validators.pattern = property.pattern;
|
|
1532
1548
|
// }
|
|
@@ -1554,6 +1570,9 @@ class DynamicFormSchemaService {
|
|
|
1554
1570
|
if (Array.isArray(items.enum)) {
|
|
1555
1571
|
validators.enum = enumValidation(items.enum);
|
|
1556
1572
|
}
|
|
1573
|
+
if ("equals" in items) {
|
|
1574
|
+
validators.equals = equalsValidation(items.equals);
|
|
1575
|
+
}
|
|
1557
1576
|
}
|
|
1558
1577
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormSchemaService, deps: [{ token: i2.OpenApiService }, { token: i0.Injector }, { token: DynamicFormBuilderService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1559
1578
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormSchemaService }); }
|
|
@@ -2219,6 +2238,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImpo
|
|
|
2219
2238
|
args: [{ standalone: false, selector: "dynamic-form-chips", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<chips [formControl]=\"formControl\"\n [type]=\"props.type\"\n [step]=\"props.step\"\n [minLength]=\"props.minLength\"\n [maxLength]=\"props.maxLength\"\n [min]=\"props.min\"\n [max]=\"props.max\"\n [multiple]=\"props.multiple\"\n [strict]=\"props.strict\"\n [options]=\"props.options | formlySelectOptions | async\"\n [testId]=\"field.testId\"\n [formlyAttributes]=\"field\">\n</chips>\n" }]
|
|
2220
2239
|
}] });
|
|
2221
2240
|
|
|
2241
|
+
class DynamicFormDateComponent extends DynamicFieldType {
|
|
2242
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormDateComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2243
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", type: DynamicFormDateComponent, isStandalone: false, selector: "dynamic-form-date", usesInheritance: true, ngImport: i0, template: "<date-picker [formControl]=\"formControl\"\n [min]=\"$any(props.min)\"\n [max]=\"$any(props.max)\"\n [disabledDays]=\"props.daysDisabled\"\n [disabledDates]=\"\"></date-picker>\n", dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.DatePickerComponent, selector: "date-picker" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
2244
|
+
}
|
|
2245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormDateComponent, decorators: [{
|
|
2246
|
+
type: Component,
|
|
2247
|
+
args: [{ standalone: false, selector: "dynamic-form-date", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<date-picker [formControl]=\"formControl\"\n [min]=\"$any(props.min)\"\n [max]=\"$any(props.max)\"\n [disabledDays]=\"props.daysDisabled\"\n [disabledDates]=\"\"></date-picker>\n" }]
|
|
2248
|
+
}] });
|
|
2249
|
+
|
|
2222
2250
|
class DynamicFormEditorComponent extends DynamicFieldType {
|
|
2223
2251
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2224
2252
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.22", type: DynamicFormEditorComponent, isStandalone: false, selector: "dynamic-form-editor", usesInheritance: true, ngImport: i0, template: "<code-editor [lang]=\"props.type\"\n [formControl]=\"formControl\"\n [formlyAttributes]=\"field\">\n</code-editor>\n", dependencies: [{ kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i2.CodeEditorComponent, selector: "code-editor", inputs: ["value", "lang", "disabled"], outputs: ["valueChange"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
@@ -2291,11 +2319,11 @@ class DynamicFormTranslationComponent extends DynamicFormArrayComponent {
|
|
|
2291
2319
|
this.currentTab.set(index);
|
|
2292
2320
|
}
|
|
2293
2321
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTranslationComponent, deps: [{ token: i2.EventsService }, { token: LANGUAGE_SERVICE }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2294
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormTranslationComponent, isStandalone: false, selector: "dynamic-form-translation", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n @if (ix === currentTab()) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\n <formly-validation-message\n [field]=\"field\"\n id=\"
|
|
2322
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormTranslationComponent, isStandalone: false, selector: "dynamic-form-translation", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n @if (ix === currentTab()) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\n <formly-validation-message\n [field]=\"field\"\n [id]=\"id + '-formly-validation-error'\"\n role=\"alert\"\n ></formly-validation-message>\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}.field-errors.invalid-feedback{display:block}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2295
2323
|
}
|
|
2296
2324
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormTranslationComponent, decorators: [{
|
|
2297
2325
|
type: Component,
|
|
2298
|
-
args: [{ standalone: false, selector: "dynamic-form-translation", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n @if (ix === currentTab()) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\n <formly-validation-message\n [field]=\"field\"\n id=\"
|
|
2326
|
+
args: [{ standalone: false, selector: "dynamic-form-translation", encapsulation: ViewEncapsulation.None, template: "@if (field.display) {\n @if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.markRequired) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n @if (ix === currentTab()) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\n <formly-validation-message\n [field]=\"field\"\n [id]=\"id + '-formly-validation-error'\"\n role=\"alert\"\n ></formly-validation-message>\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}.field-errors.invalid-feedback{display:block}\n"] }]
|
|
2299
2327
|
}], ctorParameters: () => [{ type: i2.EventsService }, { type: undefined, decorators: [{
|
|
2300
2328
|
type: Inject,
|
|
2301
2329
|
args: [LANGUAGE_SERVICE]
|
|
@@ -2354,11 +2382,11 @@ class DynamicFormGroupComponent extends FieldWrapper {
|
|
|
2354
2382
|
return this.field?.parent;
|
|
2355
2383
|
}
|
|
2356
2384
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2357
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormGroupComponent, isStandalone: false, selector: "dynamic-form-group", usesInheritance: true, ngImport: i0, template: "<ng-template #innerLabelTemplate let-label=\"label\">\r\n <label class=\"field-label\" [for]=\"id\">\r\n <span [innerHTML]=\"label | safe: 'html'\"></span>\r\n @if (props.markRequired) {\r\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\r\n }\r\n @if (props.description) {\r\n <p class=\"field-description\" [innerHTML]=\"props.description | translate | safe: 'html'\"></p>\r\n }\r\n </label>\r\n</ng-template>\r\n<ng-template #labelTemplate>\r\n @let label = !props.label || props.hideLabel || parent?.props?.useTabs ? null : props.label | translate;\r\n @if (label) {\r\n <ng-container [ngxTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || innerLabelTemplate\"\r\n [context]=\"field\"\r\n [additionalContext]=\"{label: label}\"></ng-container>\r\n }\r\n</ng-template>\r\n@if (field.display) {\r\n @if (props.labelAlign === \"before\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n <tabs class=\"field-container\" [testId]=\"(field.testId || 'form') + '-tab'\">\r\n @for (itemField of field.fieldGroup; track itemField) {\r\n @if (itemField.display) {\r\n @if (props.useTabs && itemField.fieldGroup) {\r\n <div class=\"form-fieldset-item\"\r\n [tabsItem]=\"itemField.id\"\r\n [classes]=\"['form-fieldset-tab', itemField.valid === false ? 'invalid' : 'valid']\"\r\n [label]=\"itemField.props.label\">\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n </div>\r\n } @else {\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n }\r\n }\r\n }\r\n @if (showError && field.key !== null) {\r\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\r\n <formly-validation-message\r\n [field]=\"field\"\r\n id=\"
|
|
2385
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.22", type: DynamicFormGroupComponent, isStandalone: false, selector: "dynamic-form-group", usesInheritance: true, ngImport: i0, template: "<ng-template #innerLabelTemplate let-label=\"label\">\r\n <label class=\"field-label\" [for]=\"id\">\r\n <span [innerHTML]=\"label | safe: 'html'\"></span>\r\n @if (props.markRequired) {\r\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\r\n }\r\n @if (props.description) {\r\n <p class=\"field-description\" [innerHTML]=\"props.description | translate | safe: 'html'\"></p>\r\n }\r\n </label>\r\n</ng-template>\r\n<ng-template #labelTemplate>\r\n @let label = !props.label || props.hideLabel || parent?.props?.useTabs ? null : props.label | translate;\r\n @if (label) {\r\n <ng-container [ngxTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || innerLabelTemplate\"\r\n [context]=\"field\"\r\n [additionalContext]=\"{label: label}\"></ng-container>\r\n }\r\n</ng-template>\r\n@if (field.display) {\r\n @if (props.labelAlign === \"before\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n <tabs class=\"field-container\" [testId]=\"(field.testId || 'form') + '-tab'\">\r\n @for (itemField of field.fieldGroup; track itemField) {\r\n @if (itemField.display) {\r\n @if (props.useTabs && itemField.fieldGroup) {\r\n <div class=\"form-fieldset-item\"\r\n [tabsItem]=\"itemField.id\"\r\n [classes]=\"['form-fieldset-tab', itemField.valid === false ? 'invalid' : 'valid']\"\r\n [label]=\"itemField.props.label\">\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n </div>\r\n } @else {\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n }\r\n }\r\n }\r\n @if (showError && field.key !== null) {\r\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\r\n <formly-validation-message\r\n [field]=\"field\"\r\n [id]=\"id + '-formly-validation-error'\"\r\n role=\"alert\"\r\n ></formly-validation-message>\r\n </div>\r\n }\r\n </tabs>\r\n @if (props.labelAlign === \"after\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n}\r\n", styles: [".dynamic-form-group>.field-container{overflow:hidden}.form-fieldset-item.hidden-tab{display:none}.form-fieldset-tab{position:relative;--invalid-bg: rgba(184, 38, 38, 1);--invalid-border: rgba(184, 38, 38, .6);--invalid-color: #ececec;--invalid-box-size: 15px;--invalid-box-pull: -3px}.form-fieldset-tab.invalid>btn .async-target{border:1px solid var(--invalid-border)}.form-fieldset-tab.invalid:after{background:var(--invalid-bg);color:var(--invalid-color);font-size:10px;line-height:var(--invalid-box-size);width:var(--invalid-box-size);height:var(--invalid-box-size);text-align:center;border-radius:5px;content:\"!\";display:block;position:absolute;top:var(--invalid-box-pull);right:var(--invalid-box-pull)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgxTemplateOutletDirective, selector: "[ngxTemplateOutlet]", inputs: ["context", "additionalContext", "ngxTemplateOutlet"] }, { kind: "directive", type: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "path", "classes"] }, { kind: "component", type: i2.TabsComponent, selector: "tabs", inputs: ["value", "options", "type", "size", "testId", "tabsClass"], outputs: ["valueChange", "selectedChange"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.SafeHtmlPipe, name: "safe" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: DynamicFormTemplatePipe, name: "dynamicFormTemplate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
2358
2386
|
}
|
|
2359
2387
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: DynamicFormGroupComponent, decorators: [{
|
|
2360
2388
|
type: Component,
|
|
2361
|
-
args: [{ standalone: false, selector: "dynamic-form-group", encapsulation: ViewEncapsulation.None, template: "<ng-template #innerLabelTemplate let-label=\"label\">\r\n <label class=\"field-label\" [for]=\"id\">\r\n <span [innerHTML]=\"label | safe: 'html'\"></span>\r\n @if (props.markRequired) {\r\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\r\n }\r\n @if (props.description) {\r\n <p class=\"field-description\" [innerHTML]=\"props.description | translate | safe: 'html'\"></p>\r\n }\r\n </label>\r\n</ng-template>\r\n<ng-template #labelTemplate>\r\n @let label = !props.label || props.hideLabel || parent?.props?.useTabs ? null : props.label | translate;\r\n @if (label) {\r\n <ng-container [ngxTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || innerLabelTemplate\"\r\n [context]=\"field\"\r\n [additionalContext]=\"{label: label}\"></ng-container>\r\n }\r\n</ng-template>\r\n@if (field.display) {\r\n @if (props.labelAlign === \"before\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n <tabs class=\"field-container\" [testId]=\"(field.testId || 'form') + '-tab'\">\r\n @for (itemField of field.fieldGroup; track itemField) {\r\n @if (itemField.display) {\r\n @if (props.useTabs && itemField.fieldGroup) {\r\n <div class=\"form-fieldset-item\"\r\n [tabsItem]=\"itemField.id\"\r\n [classes]=\"['form-fieldset-tab', itemField.valid === false ? 'invalid' : 'valid']\"\r\n [label]=\"itemField.props.label\">\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n </div>\r\n } @else {\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n }\r\n }\r\n }\r\n @if (showError && field.key !== null) {\r\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\r\n <formly-validation-message\r\n [field]=\"field\"\r\n id=\"
|
|
2389
|
+
args: [{ standalone: false, selector: "dynamic-form-group", encapsulation: ViewEncapsulation.None, template: "<ng-template #innerLabelTemplate let-label=\"label\">\r\n <label class=\"field-label\" [for]=\"id\">\r\n <span [innerHTML]=\"label | safe: 'html'\"></span>\r\n @if (props.markRequired) {\r\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\r\n }\r\n @if (props.description) {\r\n <p class=\"field-description\" [innerHTML]=\"props.description | translate | safe: 'html'\"></p>\r\n }\r\n </label>\r\n</ng-template>\r\n<ng-template #labelTemplate>\r\n @let label = !props.label || props.hideLabel || parent?.props?.useTabs ? null : props.label | translate;\r\n @if (label) {\r\n <ng-container [ngxTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || innerLabelTemplate\"\r\n [context]=\"field\"\r\n [additionalContext]=\"{label: label}\"></ng-container>\r\n }\r\n</ng-template>\r\n@if (field.display) {\r\n @if (props.labelAlign === \"before\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n <tabs class=\"field-container\" [testId]=\"(field.testId || 'form') + '-tab'\">\r\n @for (itemField of field.fieldGroup; track itemField) {\r\n @if (itemField.display) {\r\n @if (props.useTabs && itemField.fieldGroup) {\r\n <div class=\"form-fieldset-item\"\r\n [tabsItem]=\"itemField.id\"\r\n [classes]=\"['form-fieldset-tab', itemField.valid === false ? 'invalid' : 'valid']\"\r\n [label]=\"itemField.props.label\">\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n </div>\r\n } @else {\r\n <formly-field [field]=\"itemField\"></formly-field>\r\n }\r\n }\r\n }\r\n @if (showError && field.key !== null) {\r\n <div *ngIf=\"showError\" class=\"field-errors invalid-feedback\">\r\n <formly-validation-message\r\n [field]=\"field\"\r\n [id]=\"id + '-formly-validation-error'\"\r\n role=\"alert\"\r\n ></formly-validation-message>\r\n </div>\r\n }\r\n </tabs>\r\n @if (props.labelAlign === \"after\") {\r\n <ng-container [ngTemplateOutlet]=\"labelTemplate\"></ng-container>\r\n }\r\n}\r\n", styles: [".dynamic-form-group>.field-container{overflow:hidden}.form-fieldset-item.hidden-tab{display:none}.form-fieldset-tab{position:relative;--invalid-bg: rgba(184, 38, 38, 1);--invalid-border: rgba(184, 38, 38, .6);--invalid-color: #ececec;--invalid-box-size: 15px;--invalid-box-pull: -3px}.form-fieldset-tab.invalid>btn .async-target{border:1px solid var(--invalid-border)}.form-fieldset-tab.invalid:after{background:var(--invalid-bg);color:var(--invalid-color);font-size:10px;line-height:var(--invalid-box-size);width:var(--invalid-box-size);height:var(--invalid-box-size);text-align:center;border-radius:5px;content:\"!\";display:block;position:absolute;top:var(--invalid-box-pull);right:var(--invalid-box-pull)}\n"] }]
|
|
2362
2390
|
}] });
|
|
2363
2391
|
|
|
2364
2392
|
// --- Components ---
|
|
@@ -2367,6 +2395,7 @@ const components = [
|
|
|
2367
2395
|
DynamicFormComponent,
|
|
2368
2396
|
DynamicFormArrayComponent,
|
|
2369
2397
|
DynamicFormChipsComponent,
|
|
2398
|
+
DynamicFormDateComponent,
|
|
2370
2399
|
DynamicFormEditorComponent,
|
|
2371
2400
|
DynamicFormPasswordComponent,
|
|
2372
2401
|
DynamicFormStaticComponent,
|
|
@@ -2396,6 +2425,7 @@ class NgxDynamicFormModule {
|
|
|
2396
2425
|
types: [
|
|
2397
2426
|
{ name: "array", component: DynamicFormArrayComponent },
|
|
2398
2427
|
{ name: "chips", component: DynamicFormChipsComponent },
|
|
2428
|
+
{ name: "date", component: DynamicFormDateComponent },
|
|
2399
2429
|
{ name: "editor", component: DynamicFormEditorComponent },
|
|
2400
2430
|
{ name: "password", component: DynamicFormPasswordComponent },
|
|
2401
2431
|
{ name: "static", component: DynamicFormStaticComponent },
|
|
@@ -2437,12 +2467,12 @@ class NgxDynamicFormModule {
|
|
|
2437
2467
|
return makeEnvironmentProviders(NgxDynamicFormModule.getProviders(config));
|
|
2438
2468
|
}
|
|
2439
2469
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.22", ngImport: i0, type: NgxDynamicFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
2440
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.22", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormEditorComponent, DynamicFormPasswordComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe], imports: [CommonModule,
|
|
2470
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.22", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormDateComponent, DynamicFormEditorComponent, DynamicFormPasswordComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe], imports: [CommonModule,
|
|
2441
2471
|
FormsModule,
|
|
2442
2472
|
ReactiveFormsModule,
|
|
2443
2473
|
NgxUtilsModule,
|
|
2444
2474
|
FormlyModule,
|
|
2445
|
-
FormlySelectModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormEditorComponent, DynamicFormPasswordComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe, FormsModule,
|
|
2475
|
+
FormlySelectModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormDateComponent, DynamicFormEditorComponent, DynamicFormPasswordComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe, FormsModule,
|
|
2446
2476
|
ReactiveFormsModule,
|
|
2447
2477
|
NgxUtilsModule,
|
|
2448
2478
|
FormlyModule,
|
|
@@ -2496,5 +2526,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.22", ngImpo
|
|
|
2496
2526
|
* Generated bundle index. Do not edit.
|
|
2497
2527
|
*/
|
|
2498
2528
|
|
|
2499
|
-
export { AsyncSubmitDirective, DEFAULT_NUMERIC_STEP, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormEditorComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormPasswordComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormStaticComponent, DynamicFormTemplateDirective, DynamicFormTemplatePipe, DynamicFormTemplateService, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, EDITOR_TYPES, FORM_ROOT_ID, FormArray, FormFieldSet, FormGroup, FormInput, FormSelect, FormSerializable, FormStatic, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, RichTranslationModel, TranslationModel, addFieldValidators, arrayLengthValidation, clearFieldArray, controlStatus, controlValues, convertToDate, convertToDateFormat, convertToNumber, customizeFormField, emailValidation, enumValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, isFieldHidden, isFieldVisible, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDefault, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldMinDate, setFieldProp, setFieldProps, setFieldSerialize, setFieldValue, translationValidation };
|
|
2529
|
+
export { AsyncSubmitDirective, DEFAULT_NUMERIC_STEP, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormDateComponent, DynamicFormEditorComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormPasswordComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormStaticComponent, DynamicFormTemplateDirective, DynamicFormTemplatePipe, DynamicFormTemplateService, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, EDITOR_TYPES, FORM_ROOT_ID, FormArray, FormDate, FormFieldSet, FormGroup, FormInput, FormSelect, FormSerializable, FormStatic, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, RichTranslationModel, TranslationModel, addFieldValidators, arrayLengthValidation, clearFieldArray, controlStatus, controlValues, convertToDate, convertToDateFormat, convertToNumber, customizeFormField, emailValidation, enumValidation, equalsValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, isFieldHidden, isFieldVisible, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDefault, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldMinDate, setFieldProp, setFieldProps, setFieldSerialize, setFieldValue, translationValidation };
|
|
2500
2530
|
//# sourceMappingURL=stemy-ngx-dynamic-form.mjs.map
|