@stemy/ngx-dynamic-form 19.6.4 → 19.6.6
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 +247 -242
- package/fesm2022/stemy-ngx-dynamic-form.mjs.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +1 -0
- package/ngx-dynamic-form/components/dynamic-form/dynamic-form.component.d.ts +2 -1
- package/ngx-dynamic-form/utils/customizer.d.ts +2 -2
- package/ngx-dynamic-form/utils/internal.d.ts +1 -2
- package/ngx-dynamic-form/utils/misc.d.ts +12 -0
- package/package.json +2 -2
- package/public_api.d.ts +1 -1
|
@@ -2,11 +2,11 @@ import * as i2 from '@stemy/ngx-utils';
|
|
|
2
2
|
import { cachedFactory, ReflectUtils, ObjectUtils, LANGUAGE_SERVICE, ForbiddenZone, API_SERVICE, StringUtils, TOASTER_SERVICE, EventsService, NgxUtilsModule } from '@stemy/ngx-utils';
|
|
3
3
|
import { of, merge, Observable, firstValueFrom, BehaviorSubject, combineLatestWith, switchMap, distinctUntilChanged, first, Subject } from 'rxjs';
|
|
4
4
|
import { debounceTime } from 'rxjs/operators';
|
|
5
|
-
import * as i1 from '@angular/forms';
|
|
6
|
-
import { FormGroup as FormGroup$1, FormArray as FormArray$1, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
7
5
|
import * as i0 from '@angular/core';
|
|
8
6
|
import { Inject, Injectable, untracked, input, output, inject, Renderer2, ElementRef, computed, signal, effect, HostListener, HostBinding, Directive, Type, Component, Injector, ChangeDetectionStrategy, ViewEncapsulation, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
9
|
-
import
|
|
7
|
+
import * as i1 from '@angular/forms';
|
|
8
|
+
import { FormGroup as FormGroup$1, FormArray as FormArray$1, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
|
+
import { outputToObservable, toSignal, rxResource, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
10
10
|
import * as i3 from '@ngx-formly/core';
|
|
11
11
|
import { FieldType, ɵobserve as _observe, FieldArrayType, FieldWrapper, provideFormlyConfig, provideFormlyCore, FormlyModule } from '@ngx-formly/core';
|
|
12
12
|
import * as i1$1 from '@angular/common';
|
|
@@ -214,8 +214,8 @@ function maxLengthValidation(maxLength, each) {
|
|
|
214
214
|
function minValueValidation(min, each) {
|
|
215
215
|
return validateEach(each, v => {
|
|
216
216
|
if (min instanceof Date) {
|
|
217
|
-
|
|
218
|
-
return isNaN(
|
|
217
|
+
const date = new Date(v);
|
|
218
|
+
return isNaN(date) || date >= min;
|
|
219
219
|
}
|
|
220
220
|
return v == null || v >= min;
|
|
221
221
|
}, "minValue");
|
|
@@ -223,130 +223,13 @@ function minValueValidation(min, each) {
|
|
|
223
223
|
function maxValueValidation(max, each) {
|
|
224
224
|
return validateEach(each, v => {
|
|
225
225
|
if (max instanceof Date) {
|
|
226
|
-
|
|
227
|
-
return isNaN(
|
|
226
|
+
const date = new Date(v);
|
|
227
|
+
return isNaN(date) || date <= max;
|
|
228
228
|
}
|
|
229
229
|
return v == null || v <= max;
|
|
230
230
|
}, "maxValue");
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
class ConfigForSchemaWrap {
|
|
234
|
-
opts;
|
|
235
|
-
mode;
|
|
236
|
-
injector;
|
|
237
|
-
schema;
|
|
238
|
-
get labelPrefix() {
|
|
239
|
-
return this.opts.labelPrefix;
|
|
240
|
-
}
|
|
241
|
-
get labelCustomizer() {
|
|
242
|
-
return this.opts.labelCustomizer;
|
|
243
|
-
}
|
|
244
|
-
get testId() {
|
|
245
|
-
return this.opts.testId;
|
|
246
|
-
}
|
|
247
|
-
get context() {
|
|
248
|
-
return this.opts.context;
|
|
249
|
-
}
|
|
250
|
-
fieldCustomizer;
|
|
251
|
-
constructor(opts, mode, injector, schema) {
|
|
252
|
-
this.opts = opts;
|
|
253
|
-
this.mode = mode;
|
|
254
|
-
this.injector = injector;
|
|
255
|
-
this.schema = schema;
|
|
256
|
-
this.fieldCustomizer = this.mode !== "wrap" || !ObjectUtils.isFunction(this.opts.fieldCustomizer)
|
|
257
|
-
? field => field
|
|
258
|
-
: this.opts.fieldCustomizer;
|
|
259
|
-
}
|
|
260
|
-
async customize(field, property, schema) {
|
|
261
|
-
field.defaultValue = property.format?.startsWith("date")
|
|
262
|
-
? convertToDateFormat(property.default, property.format) : property.default;
|
|
263
|
-
const res = await ForbiddenZone.run("customizer", () => this.fieldCustomizer(field, this.forCustomizer(), this.injector, property, schema));
|
|
264
|
-
return !res ? [field] : handleConfigs(res);
|
|
265
|
-
}
|
|
266
|
-
forCustomizer() {
|
|
267
|
-
return new ConfigForSchemaWrap(this.opts, "customizer", this.injector, this.schema);
|
|
268
|
-
}
|
|
269
|
-
forSchema(schema) {
|
|
270
|
-
return new ConfigForSchemaWrap(this.opts, this.mode, this.injector, schema);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
async function toWrapOptions(customizeOrOptions, injector, schema, errorMsg) {
|
|
274
|
-
if (errorMsg && ForbiddenZone.isForbidden("customizer")) {
|
|
275
|
-
throw new Error(errorMsg);
|
|
276
|
-
}
|
|
277
|
-
if (customizeOrOptions instanceof ConfigForSchemaWrap) {
|
|
278
|
-
return customizeOrOptions;
|
|
279
|
-
}
|
|
280
|
-
let schemaOptions = customizeOrOptions;
|
|
281
|
-
if (!ObjectUtils.isObject(schemaOptions)) {
|
|
282
|
-
schemaOptions = {
|
|
283
|
-
fieldCustomizer: customizeOrOptions
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
return new ConfigForSchemaWrap(schemaOptions, "wrap", injector, schema);
|
|
287
|
-
}
|
|
288
|
-
function convertToDateFormat(value, format) {
|
|
289
|
-
if (!ObjectUtils.isDefined(value))
|
|
290
|
-
return undefined;
|
|
291
|
-
value = ObjectUtils.isDate(value) ? value : new Date(value);
|
|
292
|
-
const date = isNaN(value) ? new Date() : value;
|
|
293
|
-
return format === "datetime-local" || format === "date-time"
|
|
294
|
-
? new Date(date.getTime() - date.getTimezoneOffset() * 60000)
|
|
295
|
-
.toISOString()
|
|
296
|
-
.slice(0, 16)
|
|
297
|
-
: date.toISOString().slice(0, 10);
|
|
298
|
-
}
|
|
299
|
-
function handleConfigs(configs) {
|
|
300
|
-
return Array.isArray(configs) ? configs : [configs];
|
|
301
|
-
}
|
|
302
|
-
function arrayItemActionToExpression(actionName) {
|
|
303
|
-
return (field) => {
|
|
304
|
-
const action = field.parent?.props?.[actionName];
|
|
305
|
-
// Needed to immediately reflect the changes on the view
|
|
306
|
-
field.options.detectChanges(field);
|
|
307
|
-
if (action === false)
|
|
308
|
-
return false;
|
|
309
|
-
// Returns the actual calculated value
|
|
310
|
-
return ObjectUtils.isFunction(action)
|
|
311
|
-
? action(field.formControl?.value, Number(field.key), field)
|
|
312
|
-
: true;
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
function mergeFormFields(formFields) {
|
|
316
|
-
const res = [];
|
|
317
|
-
for (const formModel of formFields) {
|
|
318
|
-
for (const subModel of formModel) {
|
|
319
|
-
const index = res.findIndex(t => t.key == subModel.key);
|
|
320
|
-
if (index >= 0) {
|
|
321
|
-
res[index] = subModel;
|
|
322
|
-
continue;
|
|
323
|
-
}
|
|
324
|
-
res.push(subModel);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return res;
|
|
328
|
-
}
|
|
329
|
-
function getFormValidationErrors(controls, parentPath = "") {
|
|
330
|
-
const errors = [];
|
|
331
|
-
Object.entries(controls).forEach(([name, control], ix) => {
|
|
332
|
-
const path = !parentPath ? name : `${parentPath}.${name}`;
|
|
333
|
-
if (control instanceof FormGroup$1) {
|
|
334
|
-
getFormValidationErrors(control.controls, path).forEach(error => errors.push(error));
|
|
335
|
-
return;
|
|
336
|
-
}
|
|
337
|
-
if (control instanceof FormArray$1) {
|
|
338
|
-
control.controls.forEach((control, ix) => {
|
|
339
|
-
getFormValidationErrors(control.controls, `${path}.${ix}`).forEach(error => errors.push(error));
|
|
340
|
-
});
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
Object.entries(control.errors || {}).forEach(([errorKey, errorValue]) => {
|
|
344
|
-
errors.push({ control, path, errorKey, errorValue });
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
return errors;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
233
|
function replaceSpecialChars(str, to = "-") {
|
|
351
234
|
return `${str}`.replace(/[&\/\\#, +()$~%.@'":*?<>{}]/g, to);
|
|
352
235
|
}
|
|
@@ -370,6 +253,32 @@ function controlStatus(control, timeout = 10) {
|
|
|
370
253
|
const changes$ = control.statusChanges.pipe(debounceTime(timeout));
|
|
371
254
|
return merge(initial$, changes$);
|
|
372
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Convert value to a string with corrected date format (date, date-time)
|
|
258
|
+
* @param value Value to convert to date string
|
|
259
|
+
* @param format Expected date format (date, date-time)
|
|
260
|
+
*/
|
|
261
|
+
function convertToDateFormat(value, format) {
|
|
262
|
+
if (!ObjectUtils.isDefined(value) || format?.includes("date"))
|
|
263
|
+
return value;
|
|
264
|
+
value = ObjectUtils.isDate(value) ? value : new Date(value);
|
|
265
|
+
const date = isNaN(value) ? new Date() : value;
|
|
266
|
+
return format === "datetime-local" || format === "date-time"
|
|
267
|
+
? new Date(date.getTime() - date.getTimezoneOffset() * 60000)
|
|
268
|
+
.toISOString()
|
|
269
|
+
.slice(0, 16)
|
|
270
|
+
: date.toISOString().slice(0, 10);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Convert value to date object with format (date, date-time)
|
|
274
|
+
* @param value Value to convert to date string
|
|
275
|
+
* @param format Expected date format (date, date-time)
|
|
276
|
+
*/
|
|
277
|
+
function convertToDate(value, format) {
|
|
278
|
+
return (!ObjectUtils.isDefined(value) || format?.includes("date"))
|
|
279
|
+
? value
|
|
280
|
+
: new Date(convertToDateFormat(value, format));
|
|
281
|
+
}
|
|
373
282
|
function getFieldByPath(field, path) {
|
|
374
283
|
if (field.path === path) {
|
|
375
284
|
return field;
|
|
@@ -469,12 +378,108 @@ const MIN_INPUT_NUM = -1999999999;
|
|
|
469
378
|
const MAX_INPUT_NUM = 1999999999;
|
|
470
379
|
const EDITOR_FORMATS = ["php", "json", "html", "css", "scss"];
|
|
471
380
|
|
|
381
|
+
class ConfigForSchemaWrap {
|
|
382
|
+
get labelPrefix() {
|
|
383
|
+
return this.opts.labelPrefix;
|
|
384
|
+
}
|
|
385
|
+
get labelCustomizer() {
|
|
386
|
+
return this.opts.labelCustomizer;
|
|
387
|
+
}
|
|
388
|
+
get testId() {
|
|
389
|
+
return this.opts.testId;
|
|
390
|
+
}
|
|
391
|
+
get context() {
|
|
392
|
+
return this.opts.context;
|
|
393
|
+
}
|
|
394
|
+
constructor(opts, mode, injector, schema) {
|
|
395
|
+
this.opts = opts;
|
|
396
|
+
this.mode = mode;
|
|
397
|
+
this.injector = injector;
|
|
398
|
+
this.schema = schema;
|
|
399
|
+
this.fieldCustomizer = this.mode !== "wrap" || !ObjectUtils.isFunction(this.opts.fieldCustomizer)
|
|
400
|
+
? field => field
|
|
401
|
+
: this.opts.fieldCustomizer;
|
|
402
|
+
}
|
|
403
|
+
async customize(field, property, schema) {
|
|
404
|
+
field.defaultValue = property.format?.startsWith("date")
|
|
405
|
+
? convertToDateFormat(property.default, property.format) : property.default;
|
|
406
|
+
const res = await ForbiddenZone.run("customizer", () => this.fieldCustomizer(field, this.forCustomizer(), this.injector, property, schema));
|
|
407
|
+
return !res ? [field] : handleConfigs(res);
|
|
408
|
+
}
|
|
409
|
+
forCustomizer() {
|
|
410
|
+
return new ConfigForSchemaWrap(this.opts, "customizer", this.injector, this.schema);
|
|
411
|
+
}
|
|
412
|
+
forSchema(schema) {
|
|
413
|
+
return new ConfigForSchemaWrap(this.opts, this.mode, this.injector, schema);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
async function toWrapOptions(customizeOrOptions, injector, schema, errorMsg) {
|
|
417
|
+
if (errorMsg && ForbiddenZone.isForbidden("customizer")) {
|
|
418
|
+
throw new Error(errorMsg);
|
|
419
|
+
}
|
|
420
|
+
if (customizeOrOptions instanceof ConfigForSchemaWrap) {
|
|
421
|
+
return customizeOrOptions;
|
|
422
|
+
}
|
|
423
|
+
let schemaOptions = customizeOrOptions;
|
|
424
|
+
if (!ObjectUtils.isObject(schemaOptions)) {
|
|
425
|
+
schemaOptions = {
|
|
426
|
+
fieldCustomizer: customizeOrOptions
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
return new ConfigForSchemaWrap(schemaOptions, "wrap", injector, schema);
|
|
430
|
+
}
|
|
431
|
+
function handleConfigs(configs) {
|
|
432
|
+
return Array.isArray(configs) ? configs : [configs];
|
|
433
|
+
}
|
|
434
|
+
function arrayItemActionToExpression(actionName) {
|
|
435
|
+
return (field) => {
|
|
436
|
+
const action = field.parent?.props?.[actionName];
|
|
437
|
+
// Needed to immediately reflect the changes on the view
|
|
438
|
+
field.options.detectChanges(field);
|
|
439
|
+
if (action === false)
|
|
440
|
+
return false;
|
|
441
|
+
// Returns the actual calculated value
|
|
442
|
+
return ObjectUtils.isFunction(action)
|
|
443
|
+
? action(field.formControl?.value, Number(field.key), field)
|
|
444
|
+
: true;
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function mergeFormFields(formFields) {
|
|
448
|
+
const res = [];
|
|
449
|
+
for (const formModel of formFields) {
|
|
450
|
+
for (const subModel of formModel) {
|
|
451
|
+
const index = res.findIndex(t => t.key == subModel.key);
|
|
452
|
+
if (index >= 0) {
|
|
453
|
+
res[index] = subModel;
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
res.push(subModel);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return res;
|
|
460
|
+
}
|
|
461
|
+
function getFormValidationErrors(controls, parentPath = "") {
|
|
462
|
+
const errors = [];
|
|
463
|
+
Object.entries(controls).forEach(([name, control], ix) => {
|
|
464
|
+
const path = !parentPath ? name : `${parentPath}.${name}`;
|
|
465
|
+
if (control instanceof FormGroup$1) {
|
|
466
|
+
getFormValidationErrors(control.controls, path).forEach(error => errors.push(error));
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
if (control instanceof FormArray$1) {
|
|
470
|
+
control.controls.forEach((control, ix) => {
|
|
471
|
+
getFormValidationErrors(control.controls, `${path}.${ix}`).forEach(error => errors.push(error));
|
|
472
|
+
});
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
Object.entries(control.errors || {}).forEach(([errorKey, errorValue]) => {
|
|
476
|
+
errors.push({ control, path, errorKey, errorValue });
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
return errors;
|
|
480
|
+
}
|
|
481
|
+
|
|
472
482
|
class DynamicFormBuilderService {
|
|
473
|
-
injector;
|
|
474
|
-
events;
|
|
475
|
-
api;
|
|
476
|
-
languages;
|
|
477
|
-
language;
|
|
478
483
|
constructor(injector, events, api, languages) {
|
|
479
484
|
this.injector = injector;
|
|
480
485
|
this.events = events;
|
|
@@ -836,8 +841,8 @@ class DynamicFormBuilderService {
|
|
|
836
841
|
}
|
|
837
842
|
});
|
|
838
843
|
}
|
|
839
|
-
static
|
|
840
|
-
static
|
|
844
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormBuilderService, deps: [{ token: i0.Injector }, { token: i2.EventsService }, { token: API_SERVICE }, { token: LANGUAGE_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
845
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormBuilderService }); }
|
|
841
846
|
}
|
|
842
847
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormBuilderService, decorators: [{
|
|
843
848
|
type: Injectable
|
|
@@ -850,9 +855,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
850
855
|
}] }] });
|
|
851
856
|
|
|
852
857
|
class DynamicFormSchemaService {
|
|
853
|
-
openApi;
|
|
854
|
-
injector;
|
|
855
|
-
builder;
|
|
856
858
|
get api() {
|
|
857
859
|
return this.openApi.api;
|
|
858
860
|
}
|
|
@@ -1182,10 +1184,10 @@ class DynamicFormSchemaService {
|
|
|
1182
1184
|
validators.maxLength = maxLengthValidation(property.maxLength);
|
|
1183
1185
|
}
|
|
1184
1186
|
if (!isNaN(property.minimum)) {
|
|
1185
|
-
validators.min = minValueValidation(property.minimum);
|
|
1187
|
+
validators.min = minValueValidation(convertToDate(property.minimum, property.format));
|
|
1186
1188
|
}
|
|
1187
1189
|
if (!isNaN(property.maximum)) {
|
|
1188
|
-
validators.max = maxValueValidation(property.maximum);
|
|
1190
|
+
validators.max = maxValueValidation(convertToDate(property.maximum, property.format));
|
|
1189
1191
|
}
|
|
1190
1192
|
// if (isString(property.pattern) && property.pattern.length) {
|
|
1191
1193
|
// validators.pattern = property.pattern;
|
|
@@ -1212,18 +1214,14 @@ class DynamicFormSchemaService {
|
|
|
1212
1214
|
validators.itemsMaxValue = maxValueValidation(items.maximum, true);
|
|
1213
1215
|
}
|
|
1214
1216
|
}
|
|
1215
|
-
static
|
|
1216
|
-
static
|
|
1217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormSchemaService, deps: [{ token: i2.OpenApiService }, { token: i0.Injector }, { token: DynamicFormBuilderService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1218
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormSchemaService }); }
|
|
1217
1219
|
}
|
|
1218
1220
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormSchemaService, decorators: [{
|
|
1219
1221
|
type: Injectable
|
|
1220
1222
|
}], ctorParameters: () => [{ type: i2.OpenApiService }, { type: i0.Injector }, { type: DynamicFormBuilderService }] });
|
|
1221
1223
|
|
|
1222
1224
|
class DynamicFormService {
|
|
1223
|
-
fs;
|
|
1224
|
-
fb;
|
|
1225
|
-
injector;
|
|
1226
|
-
api;
|
|
1227
1225
|
constructor(fs, fb, injector, api) {
|
|
1228
1226
|
this.fs = fs;
|
|
1229
1227
|
this.fb = fb;
|
|
@@ -1355,8 +1353,8 @@ class DynamicFormService {
|
|
|
1355
1353
|
}
|
|
1356
1354
|
});
|
|
1357
1355
|
}
|
|
1358
|
-
static
|
|
1359
|
-
static
|
|
1356
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormService, deps: [{ token: DynamicFormSchemaService }, { token: DynamicFormBuilderService }, { token: i0.Injector }, { token: API_SERVICE }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1357
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormService }); }
|
|
1360
1358
|
}
|
|
1361
1359
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormService, decorators: [{
|
|
1362
1360
|
type: Injectable
|
|
@@ -1366,25 +1364,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1366
1364
|
}] }] });
|
|
1367
1365
|
|
|
1368
1366
|
class AsyncSubmitDirective {
|
|
1369
|
-
method = input(null, { alias: "async-submit" });
|
|
1370
|
-
mode = input("click");
|
|
1371
|
-
form = input();
|
|
1372
|
-
context = input();
|
|
1373
|
-
onSuccess = output();
|
|
1374
|
-
onError = output();
|
|
1375
|
-
toaster = inject(TOASTER_SERVICE);
|
|
1376
|
-
renderer = inject(Renderer2);
|
|
1377
|
-
elem = inject(ElementRef);
|
|
1378
|
-
status = computed(() => {
|
|
1379
|
-
const form = this.form();
|
|
1380
|
-
return form?.status() || null;
|
|
1381
|
-
});
|
|
1382
|
-
group = computed(() => {
|
|
1383
|
-
const form = this.form();
|
|
1384
|
-
return form?.group() || null;
|
|
1385
|
-
});
|
|
1386
|
-
loading = signal(false);
|
|
1387
|
-
callback = signal(null);
|
|
1388
1367
|
get isDisabled() {
|
|
1389
1368
|
return this.status() !== "VALID";
|
|
1390
1369
|
}
|
|
@@ -1392,6 +1371,25 @@ class AsyncSubmitDirective {
|
|
|
1392
1371
|
return this.loading();
|
|
1393
1372
|
}
|
|
1394
1373
|
constructor() {
|
|
1374
|
+
this.method = input(null, { alias: "async-submit" });
|
|
1375
|
+
this.mode = input("click");
|
|
1376
|
+
this.form = input();
|
|
1377
|
+
this.context = input();
|
|
1378
|
+
this.onSuccess = output();
|
|
1379
|
+
this.onError = output();
|
|
1380
|
+
this.toaster = inject(TOASTER_SERVICE);
|
|
1381
|
+
this.renderer = inject(Renderer2);
|
|
1382
|
+
this.elem = inject(ElementRef);
|
|
1383
|
+
this.status = computed(() => {
|
|
1384
|
+
const form = this.form();
|
|
1385
|
+
return form?.status() || null;
|
|
1386
|
+
});
|
|
1387
|
+
this.group = computed(() => {
|
|
1388
|
+
const form = this.form();
|
|
1389
|
+
return form?.group() || null;
|
|
1390
|
+
});
|
|
1391
|
+
this.loading = signal(false);
|
|
1392
|
+
this.callback = signal(null);
|
|
1395
1393
|
if (this.elem.nativeElement.tagName === "BUTTON") {
|
|
1396
1394
|
this.renderer.setAttribute(this.elem.nativeElement, "type", "button");
|
|
1397
1395
|
}
|
|
@@ -1446,8 +1444,8 @@ class AsyncSubmitDirective {
|
|
|
1446
1444
|
this.toaster.error(reason.message, reason.context);
|
|
1447
1445
|
});
|
|
1448
1446
|
}
|
|
1449
|
-
static
|
|
1450
|
-
static
|
|
1447
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncSubmitDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1448
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AsyncSubmitDirective, isStandalone: false, selector: "[async-submit]", inputs: { method: { classPropertyName: "method", publicName: "async-submit", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSuccess: "onSuccess", onError: "onError" }, host: { listeners: { "click": "click()" }, properties: { "class.disabled": "this.isDisabled", "class.loading": "this.isLoading" } }, exportAs: ["async-submit"], ngImport: i0 }); }
|
|
1451
1449
|
}
|
|
1452
1450
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AsyncSubmitDirective, decorators: [{
|
|
1453
1451
|
type: Directive,
|
|
@@ -1468,9 +1466,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1468
1466
|
}] } });
|
|
1469
1467
|
|
|
1470
1468
|
class DynamicFieldType extends FieldType {
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1469
|
+
constructor() {
|
|
1470
|
+
super(...arguments);
|
|
1471
|
+
this.stateChanges = new Subject();
|
|
1472
|
+
this._errorState = false;
|
|
1473
|
+
this._focused = false;
|
|
1474
|
+
}
|
|
1474
1475
|
ngOnDestroy() {
|
|
1475
1476
|
delete this.formField?._control;
|
|
1476
1477
|
this.stateChanges.complete();
|
|
@@ -1557,8 +1558,8 @@ class DynamicFieldType extends FieldType {
|
|
|
1557
1558
|
};
|
|
1558
1559
|
}
|
|
1559
1560
|
}
|
|
1560
|
-
static
|
|
1561
|
-
static
|
|
1561
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFieldType, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1562
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFieldType, isStandalone: false, selector: "dynamic-field-type", usesInheritance: true, ngImport: i0, template: "", isInline: true }); }
|
|
1562
1563
|
}
|
|
1563
1564
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFieldType, decorators: [{
|
|
1564
1565
|
type: Component,
|
|
@@ -1570,56 +1571,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1570
1571
|
}] });
|
|
1571
1572
|
|
|
1572
1573
|
class DynamicFormComponent {
|
|
1573
|
-
builder = inject(DynamicFormBuilderService);
|
|
1574
|
-
events = inject(EventsService);
|
|
1575
|
-
languages = inject(LANGUAGE_SERVICE);
|
|
1576
|
-
labelPrefix = input("label");
|
|
1577
|
-
labelCustomizer = input(null);
|
|
1578
|
-
testId = input("");
|
|
1579
|
-
useTabs = input(false);
|
|
1580
|
-
data = input({});
|
|
1581
|
-
fields = input(null);
|
|
1582
|
-
fieldChanges = new Subject();
|
|
1583
|
-
language = toSignal(this.events.languageChanged, {
|
|
1584
|
-
initialValue: this.languages.currentLanguage
|
|
1585
|
-
});
|
|
1586
|
-
enableTranslations = toSignal(this.events.translationsEnabled, {
|
|
1587
|
-
initialValue: this.languages.enableTranslations
|
|
1588
|
-
});
|
|
1589
|
-
config = computed(() => {
|
|
1590
|
-
const options = {
|
|
1591
|
-
labelPrefix: this.labelPrefix(),
|
|
1592
|
-
labelCustomizer: this.labelCustomizer(),
|
|
1593
|
-
testId: this.testId(),
|
|
1594
|
-
};
|
|
1595
|
-
const fields = this.fields() || this.builder.resolveFormFields(this.data()?.constructor, null, options);
|
|
1596
|
-
return [
|
|
1597
|
-
this.builder.createFormGroup(null, () => fields, {
|
|
1598
|
-
label: "",
|
|
1599
|
-
useTabs: this.useTabs(),
|
|
1600
|
-
hidden: false,
|
|
1601
|
-
className: "dynamic-form-root-group"
|
|
1602
|
-
}, null, options)
|
|
1603
|
-
];
|
|
1604
|
-
});
|
|
1605
|
-
group = computed(() => {
|
|
1606
|
-
this.config();
|
|
1607
|
-
return new FormGroup$1({});
|
|
1608
|
-
});
|
|
1609
|
-
status$ = rxResource({
|
|
1610
|
-
request: () => this.group(),
|
|
1611
|
-
loader: p => controlStatus(p.request),
|
|
1612
|
-
defaultValue: "PENDING"
|
|
1613
|
-
});
|
|
1614
|
-
status = computed(() => this.status$.value());
|
|
1615
|
-
onSubmit = output();
|
|
1616
|
-
options = {
|
|
1617
|
-
fieldChanges: this.fieldChanges,
|
|
1618
|
-
formState: {
|
|
1619
|
-
injector: inject(Injector)
|
|
1620
|
-
}
|
|
1621
|
-
};
|
|
1622
1574
|
constructor() {
|
|
1575
|
+
this.builder = inject(DynamicFormBuilderService);
|
|
1576
|
+
this.events = inject(EventsService);
|
|
1577
|
+
this.languages = inject(LANGUAGE_SERVICE);
|
|
1578
|
+
this.labelPrefix = input("label");
|
|
1579
|
+
this.labelCustomizer = input(null);
|
|
1580
|
+
this.testId = input("");
|
|
1581
|
+
this.useTabs = input(false);
|
|
1582
|
+
this.data = input({});
|
|
1583
|
+
this.fields = input(null);
|
|
1584
|
+
this.fieldChanges = new Subject();
|
|
1585
|
+
this.language = toSignal(this.events.languageChanged, {
|
|
1586
|
+
initialValue: this.languages.currentLanguage
|
|
1587
|
+
});
|
|
1588
|
+
this.enableTranslations = toSignal(this.events.translationsEnabled, {
|
|
1589
|
+
initialValue: this.languages.enableTranslations
|
|
1590
|
+
});
|
|
1591
|
+
this.config = computed(() => {
|
|
1592
|
+
const options = {
|
|
1593
|
+
labelPrefix: this.labelPrefix(),
|
|
1594
|
+
labelCustomizer: this.labelCustomizer(),
|
|
1595
|
+
testId: this.testId(),
|
|
1596
|
+
};
|
|
1597
|
+
const fields = this.fields() || this.builder.resolveFormFields(this.data()?.constructor, null, options);
|
|
1598
|
+
return [
|
|
1599
|
+
this.builder.createFormGroup(null, () => fields, {
|
|
1600
|
+
label: "",
|
|
1601
|
+
useTabs: this.useTabs(),
|
|
1602
|
+
hidden: false,
|
|
1603
|
+
className: "dynamic-form-root-group"
|
|
1604
|
+
}, null, options)
|
|
1605
|
+
];
|
|
1606
|
+
});
|
|
1607
|
+
this.group = computed(() => {
|
|
1608
|
+
this.config();
|
|
1609
|
+
return new FormGroup$1({});
|
|
1610
|
+
});
|
|
1611
|
+
this.status$ = rxResource({
|
|
1612
|
+
request: () => this.group(),
|
|
1613
|
+
loader: p => controlStatus(p.request),
|
|
1614
|
+
defaultValue: "PENDING"
|
|
1615
|
+
});
|
|
1616
|
+
this.status = computed(() => this.status$.value());
|
|
1617
|
+
this.onSubmit = output();
|
|
1618
|
+
this.onChanges = outputFromObservable(this.fieldChanges);
|
|
1619
|
+
this.options = {
|
|
1620
|
+
fieldChanges: this.fieldChanges,
|
|
1621
|
+
formState: {
|
|
1622
|
+
injector: inject(Injector)
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1623
1625
|
effect(() => {
|
|
1624
1626
|
this.language();
|
|
1625
1627
|
this.enableTranslations();
|
|
@@ -1636,8 +1638,8 @@ class DynamicFormComponent {
|
|
|
1636
1638
|
reset() {
|
|
1637
1639
|
this.options?.resetModel?.();
|
|
1638
1640
|
}
|
|
1639
|
-
static
|
|
1640
|
-
static
|
|
1641
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1642
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormComponent, isStandalone: false, selector: "dynamic-form", inputs: { labelPrefix: { classPropertyName: "labelPrefix", publicName: "labelPrefix", isSignal: true, isRequired: false, transformFunction: null }, labelCustomizer: { classPropertyName: "labelCustomizer", publicName: "labelCustomizer", isSignal: true, isRequired: false, transformFunction: null }, testId: { classPropertyName: "testId", publicName: "testId", isSignal: true, isRequired: false, transformFunction: null }, useTabs: { classPropertyName: "useTabs", publicName: "useTabs", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSubmit: "onSubmit", onChanges: "onChanges" }, ngImport: i0, template: "@if (config() && group()) {\n <form [formGroup]=\"group()\" (ngSubmit)=\"submit()\" autocomplete=\"off\" role=\"presentation\">\n <input type=\"submit\" [hidden]=\"true\" />\n <formly-form [model]=\"data()\"\n [fields]=\"config()\"\n [form]=\"group()\"\n [options]=\"options\"></formly-form>\n <ng-content></ng-content>\n </form>\n}\n", styles: [".dynamic-form-field.dynamic-form-hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i3.LegacyFormlyForm, selector: "formly-form" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1641
1643
|
}
|
|
1642
1644
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormComponent, decorators: [{
|
|
1643
1645
|
type: Component,
|
|
@@ -1645,7 +1647,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1645
1647
|
}], ctorParameters: () => [] });
|
|
1646
1648
|
|
|
1647
1649
|
class DynamicFormArrayComponent extends FieldArrayType {
|
|
1648
|
-
|
|
1650
|
+
constructor() {
|
|
1651
|
+
super(...arguments);
|
|
1652
|
+
this.currentTab = signal(0);
|
|
1653
|
+
}
|
|
1649
1654
|
clearItems() {
|
|
1650
1655
|
const control = this.formControl;
|
|
1651
1656
|
while (control.length > 0) {
|
|
@@ -1663,8 +1668,8 @@ class DynamicFormArrayComponent extends FieldArrayType {
|
|
|
1663
1668
|
const length = this.field.fieldGroup.length;
|
|
1664
1669
|
this.currentTab.set(Math.min(this.currentTab(), length - 1));
|
|
1665
1670
|
}
|
|
1666
|
-
static
|
|
1667
|
-
static
|
|
1671
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormArrayComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1672
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormArrayComponent, isStandalone: false, selector: "dynamic-form-array", 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 </label>\n }\n <div class=\"field-container\">\n <tabs class=\"form-array-items\" [(value)]=\"currentTab\">\n @for (itemField of field.fieldGroup; track itemField.key; let ix = $index) {\n <ng-template #fieldContent>\n <div class=\"form-array-buttons\">\n @if (itemField.removeItem) {\n <btn icon=\"trash\" (click)=\"removeItem(ix)\"></btn>\n }\n @if (itemField.insertItem) {\n <btn icon=\"plus\" (click)=\"addItem(ix)\"></btn>\n }\n </div>\n <formly-field [field]=\"itemField\"></formly-field>\n </ng-template>\n @if (props.useTabs) {\n <div class=\"form-array-item\"\n [tabsItem]=\"ix\"\n [label]=\"(itemField.formControl.value | getValue : props.tabsLabel) || ix + 1\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n } @else {\n <div class=\"form-array-item\">\n <ng-container [ngTemplateOutlet]=\"fieldContent\"></ng-container>\n </div>\n }\n }\n </tabs>\n\n <div class=\"form-array-buttons\">\n @if (props.clearItems) {\n <btn icon=\"trash\" label=\"button.clear-items\" (click)=\"clearItems()\"></btn>\n }\n @if (props.addItem) {\n <btn icon=\"plus\" label=\"button.insert-item\" (click)=\"addItem()\"></btn>\n }\n </div>\n </div>\n}\n", styles: [".form-array-item.hidden-tab{display:none}.form-array-buttons{display:flex;gap:5px;margin-bottom:5px}\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.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "classes"] }, { kind: "component", type: i2.BtnComponent, selector: "btn", inputs: ["label", "tooltip", "icon", "disabled", "type", "size"] }, { 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: "pipe", type: i2.GetValuePipe, name: "getValue" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1668
1673
|
}
|
|
1669
1674
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormArrayComponent, decorators: [{
|
|
1670
1675
|
type: Component,
|
|
@@ -1672,8 +1677,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1672
1677
|
}] });
|
|
1673
1678
|
|
|
1674
1679
|
class DynamicFormChipsComponent extends DynamicFieldType {
|
|
1675
|
-
static
|
|
1676
|
-
static
|
|
1680
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormChipsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1681
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormChipsComponent, isStandalone: false, selector: "dynamic-form-chips", usesInheritance: true, ngImport: i0, 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 [formlyAttributes]=\"field\">\n</chips>\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.ChipsComponent, selector: "chips", inputs: ["value", "multiple", "disabled", "type", "min", "max", "minLength", "maxLength", "step", "placeholder", "unique", "options"], outputs: ["valueChange"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1677
1682
|
}
|
|
1678
1683
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormChipsComponent, decorators: [{
|
|
1679
1684
|
type: Component,
|
|
@@ -1681,8 +1686,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1681
1686
|
}] });
|
|
1682
1687
|
|
|
1683
1688
|
class DynamicFormUploadComponent extends DynamicFieldType {
|
|
1684
|
-
static
|
|
1685
|
-
static
|
|
1689
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormUploadComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1690
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormUploadComponent, isStandalone: false, selector: "dynamic-form-upload", usesInheritance: true, ngImport: i0, template: "<upload [formControl]=\"formControl\"\n [multiple]=\"props.multiple\"\n [inline]=\"props.inline\"\n [accept]=\"props.accept\"\n [baseUrl]=\"props.url\"\n [makeUpload]=\"props.createUploadData\"\n [formlyAttributes]=\"field\">\n</upload>\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.UploadComponent, selector: "upload", inputs: ["value", "disabled", "inline", "accept", "baseUrl", "message", "multiple", "buttonText", "makeUpload", "preProcess"], outputs: ["onUploaded", "onRemove"] }, { kind: "directive", type: i3.LegacyFormlyAttributes, selector: "[formlyAttributes]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
1686
1691
|
}
|
|
1687
1692
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormUploadComponent, decorators: [{
|
|
1688
1693
|
type: Component,
|
|
@@ -1693,8 +1698,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1693
1698
|
* This is just a test wrapper component
|
|
1694
1699
|
*/
|
|
1695
1700
|
class DynamicFormAlertComponent extends FieldWrapper {
|
|
1696
|
-
static
|
|
1697
|
-
static
|
|
1701
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormAlertComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1702
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: DynamicFormAlertComponent, isStandalone: false, selector: "dynamic-form-alert", usesInheritance: true, ngImport: i0, template: "<div class=\"dynamic-form-alert\">\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: [".dynamic-form-alert{border:2px dashed red;width:100%}\n"], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1698
1703
|
}
|
|
1699
1704
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormAlertComponent, decorators: [{
|
|
1700
1705
|
type: Component,
|
|
@@ -1702,8 +1707,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1702
1707
|
}] });
|
|
1703
1708
|
|
|
1704
1709
|
class DynamicFormFieldComponent extends FieldWrapper {
|
|
1705
|
-
static
|
|
1706
|
-
static
|
|
1710
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1711
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormFieldComponent, isStandalone: false, selector: "dynamic-form-field", usesInheritance: true, ngImport: i0, template: "@if (props.label && props.hideLabel !== true) {\n <label class=\"field-label\" [for]=\"id\">\n {{ props.label | translate }}\n <p class=\"field-description\" *ngIf=\"props.description\">{{ props.description | translate }}</p>\n @if (props.required && props.hideRequiredMarker !== true) {\n <span class=\"field-required\" aria-hidden=\"true\">*</span>\n }\n </label>\n}\n<div class=\"field-container\">\n <ng-container #fieldComponent></ng-container>\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", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LegacyFormlyValidationMessage, selector: "formly-validation-message" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1707
1712
|
}
|
|
1708
1713
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldComponent, decorators: [{
|
|
1709
1714
|
type: Component,
|
|
@@ -1711,8 +1716,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1711
1716
|
}] });
|
|
1712
1717
|
|
|
1713
1718
|
class DynamicFormFieldsetComponent extends FieldWrapper {
|
|
1714
|
-
static
|
|
1715
|
-
static
|
|
1719
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldsetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1720
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormFieldsetComponent, isStandalone: false, selector: "dynamic-form-fieldset", usesInheritance: true, ngImport: i0, template: "@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"props.label && !field.parent.props.useTabs\">\n {{ props.label | translate }}\n </legend>\n <div class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField) {\n @if (itemField.display) {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n </div>\n}\n", dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1716
1721
|
}
|
|
1717
1722
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormFieldsetComponent, decorators: [{
|
|
1718
1723
|
type: Component,
|
|
@@ -1720,8 +1725,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1720
1725
|
}] });
|
|
1721
1726
|
|
|
1722
1727
|
class DynamicFormGroupComponent extends FieldWrapper {
|
|
1723
|
-
static
|
|
1724
|
-
static
|
|
1728
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1729
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: DynamicFormGroupComponent, isStandalone: false, selector: "dynamic-form-group", 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 </label>\n }\n <tabs class=\"field-container\">\n @for (itemField of field.fieldGroup; track itemField; let ix = $index) {\n @if (itemField.display) {\n @if (props.useTabs && itemField.wrappers | includes: 'form-fieldset') {\n <div class=\"form-fieldset-item\"\n [tabsItem]=\"ix\"\n [classes]=\"['form-fieldset-tab', itemField.valid ? 'valid' : 'invalid']\"\n [label]=\"itemField.props.label\">\n <formly-field [field]=\"itemField\"></formly-field>\n </div>\n } @else {\n <formly-field [field]=\"itemField\"></formly-field>\n }\n }\n }\n </tabs>\n}\n", styles: [".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: i2.TabsItemDirective, selector: "[tabsItem]", inputs: ["tabsItem", "label", "tooltip", "icon", "disabled", "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: "pipe", type: i2.IncludesPipe, name: "includes" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
1725
1730
|
}
|
|
1726
1731
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DynamicFormGroupComponent, decorators: [{
|
|
1727
1732
|
type: Component,
|
|
@@ -1783,16 +1788,16 @@ class NgxDynamicFormModule {
|
|
|
1783
1788
|
static provideForms(config) {
|
|
1784
1789
|
return makeEnvironmentProviders(NgxDynamicFormModule.getProviders(config));
|
|
1785
1790
|
}
|
|
1786
|
-
static
|
|
1787
|
-
static
|
|
1791
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1792
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormUploadComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective], imports: [CommonModule,
|
|
1788
1793
|
FormsModule,
|
|
1789
1794
|
ReactiveFormsModule,
|
|
1790
1795
|
NgxUtilsModule,
|
|
1791
1796
|
FormlyModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormUploadComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, FormsModule,
|
|
1792
1797
|
ReactiveFormsModule,
|
|
1793
1798
|
NgxUtilsModule,
|
|
1794
|
-
FormlyModule] });
|
|
1795
|
-
static
|
|
1799
|
+
FormlyModule] }); }
|
|
1800
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, providers: [
|
|
1796
1801
|
...pipes
|
|
1797
1802
|
], imports: [CommonModule,
|
|
1798
1803
|
FormsModule,
|
|
@@ -1801,7 +1806,7 @@ class NgxDynamicFormModule {
|
|
|
1801
1806
|
FormlyModule, FormsModule,
|
|
1802
1807
|
ReactiveFormsModule,
|
|
1803
1808
|
NgxUtilsModule,
|
|
1804
|
-
FormlyModule] });
|
|
1809
|
+
FormlyModule] }); }
|
|
1805
1810
|
}
|
|
1806
1811
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NgxDynamicFormModule, decorators: [{
|
|
1807
1812
|
type: NgModule,
|
|
@@ -1837,5 +1842,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1837
1842
|
* Generated bundle index. Do not edit.
|
|
1838
1843
|
*/
|
|
1839
1844
|
|
|
1840
|
-
export { AsyncSubmitDirective, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormUploadComponent, EDITOR_FORMATS, FORM_ROOT_ID, FormFile, FormGroup, FormInput, FormModel, FormSelect, FormSerializable, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, addFieldValidators, clearFieldArray, controlStatus, controlValues, customizeFormField, emailValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDefault, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldProp, setFieldProps, translationValidation };
|
|
1845
|
+
export { AsyncSubmitDirective, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormUploadComponent, EDITOR_FORMATS, FORM_ROOT_ID, FormFile, FormGroup, FormInput, FormModel, FormSelect, FormSerializable, FormUpload, MAX_INPUT_NUM, MIN_INPUT_NUM, NgxDynamicFormModule, addFieldValidators, clearFieldArray, controlStatus, controlValues, convertToDate, convertToDateFormat, customizeFormField, emailValidation, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDefault, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldProp, setFieldProps, translationValidation };
|
|
1841
1846
|
//# sourceMappingURL=stemy-ngx-dynamic-form.mjs.map
|