@stemy/ngx-dynamic-form 19.8.14 → 19.8.16
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 +180 -18
- package/fesm2022/stemy-ngx-dynamic-form.mjs.map +1 -1
- package/ngx-dynamic-form/common-types.d.ts +7 -1
- package/ngx-dynamic-form/components/dynamic-form/dynamic-form.component.d.ts +1 -1
- package/ngx-dynamic-form/directives/dynamic-form-template.directive.d.ts +22 -0
- package/ngx-dynamic-form/ngx-dynamic-form.imports.d.ts +4 -4
- package/ngx-dynamic-form/ngx-dynamic-form.module.d.ts +8 -6
- package/ngx-dynamic-form/pipes/dynamic-form-template.pipe.d.ts +18 -0
- package/ngx-dynamic-form/services/dynamic-form-template.service.d.ts +15 -0
- package/ngx-dynamic-form/services/dynamic-form.service.d.ts +2 -2
- package/ngx-dynamic-form/utils/internal.d.ts +1 -0
- package/package.json +1 -1
- package/public_api.d.ts +5 -2
|
@@ -4,7 +4,7 @@ import { of, merge, Observable, firstValueFrom, BehaviorSubject, combineLatestWi
|
|
|
4
4
|
import { debounceTime } from 'rxjs/operators';
|
|
5
5
|
import { __decorate } from 'tslib';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { Inject, Injectable, untracked, input, inject, Renderer2, ElementRef, computed, signal, effect, HostBinding, Directive, Type, Component, output, Injector, ChangeDetectionStrategy, ViewEncapsulation, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
7
|
+
import { Inject, Injectable, untracked, input, inject, Renderer2, ElementRef, computed, signal, effect, HostBinding, Directive, Input, Pipe, Type, Component, output, Injector, ChangeDetectionStrategy, ViewEncapsulation, makeEnvironmentProviders, NgModule } from '@angular/core';
|
|
8
8
|
import * as i1 from '@angular/forms';
|
|
9
9
|
import { FormGroup as FormGroup$1, FormArray as FormArray$1, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
10
10
|
import { outputToObservable, toSignal, rxResource, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
@@ -550,6 +550,9 @@ async function toWrapOptions(customizeOrOptions, injector, schema, errorMsg) {
|
|
|
550
550
|
}
|
|
551
551
|
return new ConfigForSchemaWrap(schemaOptions, "wrap", injector, schema);
|
|
552
552
|
}
|
|
553
|
+
function toStringArray(value) {
|
|
554
|
+
return (Array.isArray(value) ? value : String(value || "").split(",")).filter(ObjectUtils.isStringWithValue);
|
|
555
|
+
}
|
|
553
556
|
function handleConfigs(configs) {
|
|
554
557
|
return Array.isArray(configs) ? configs : [configs];
|
|
555
558
|
}
|
|
@@ -943,6 +946,7 @@ class DynamicFormBuilderService {
|
|
|
943
946
|
const field = {
|
|
944
947
|
...this.createFormSerializer(key, data),
|
|
945
948
|
fieldSet: String(data.fieldSet || ""),
|
|
949
|
+
purposes: toStringArray(data.purposes),
|
|
946
950
|
priority: isNaN(data.priority) ? Number.MAX_SAFE_INTEGER : Number(data.priority),
|
|
947
951
|
wrappers: wrappers.filter(ObjectUtils.isDefined),
|
|
948
952
|
type: data.componentType || type,
|
|
@@ -1149,6 +1153,7 @@ class DynamicFormSchemaService {
|
|
|
1149
1153
|
layout: property.layout,
|
|
1150
1154
|
serialize: property.serialize,
|
|
1151
1155
|
fieldSet: property.fieldSet,
|
|
1156
|
+
purposes: property.purposes || property.purpose,
|
|
1152
1157
|
priority: property.priority,
|
|
1153
1158
|
componentType: property.componentType,
|
|
1154
1159
|
wrappers: wrappers.filter(ObjectUtils.isStringWithValue),
|
|
@@ -1512,24 +1517,26 @@ class DynamicFormService {
|
|
|
1512
1517
|
group.updateValueAndValidity();
|
|
1513
1518
|
});
|
|
1514
1519
|
}
|
|
1515
|
-
async serializeForm(form, validate = true) {
|
|
1520
|
+
async serializeForm(form, validate = true, ...purposes) {
|
|
1516
1521
|
const fields = untracked(() => form.config());
|
|
1517
1522
|
if (!fields)
|
|
1518
1523
|
return null;
|
|
1519
1524
|
if (validate) {
|
|
1520
1525
|
await this.validateForm(form);
|
|
1521
1526
|
}
|
|
1522
|
-
return this.serialize(fields);
|
|
1527
|
+
return this.serialize(fields, purposes);
|
|
1523
1528
|
}
|
|
1524
|
-
async serialize(fields) {
|
|
1529
|
+
async serialize(fields, purposes = []) {
|
|
1525
1530
|
const result = {};
|
|
1531
|
+
purposes = purposes ?? [];
|
|
1526
1532
|
if (!fields)
|
|
1527
1533
|
return result;
|
|
1528
1534
|
for (const field of fields) {
|
|
1529
1535
|
const serializer = field.serializer;
|
|
1530
1536
|
const key = `${field.key}`;
|
|
1531
1537
|
const shouldSerialize = field.serialize?.(field, this.injector) ?? field.props?.hidden !== true;
|
|
1532
|
-
|
|
1538
|
+
const includes = purposes.length > 0 ? Array.prototype.includes.bind(field.purposes ?? []) : null;
|
|
1539
|
+
if (!shouldSerialize || (includes && !includes(purposes))) {
|
|
1533
1540
|
continue;
|
|
1534
1541
|
}
|
|
1535
1542
|
if (ObjectUtils.isFunction(serializer)) {
|
|
@@ -1538,7 +1545,7 @@ class DynamicFormService {
|
|
|
1538
1545
|
}
|
|
1539
1546
|
const control = field.formControl;
|
|
1540
1547
|
if (field.fieldGroup) {
|
|
1541
|
-
const group = await this.serialize(field.fieldGroup);
|
|
1548
|
+
const group = await this.serialize(field.fieldGroup, purposes);
|
|
1542
1549
|
if (field.key && !field.asFieldSet) {
|
|
1543
1550
|
result[key] = !field.fieldArray ? group : Object.values(group);
|
|
1544
1551
|
continue;
|
|
@@ -1579,6 +1586,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
1579
1586
|
args: [API_SERVICE]
|
|
1580
1587
|
}] }] });
|
|
1581
1588
|
|
|
1589
|
+
const templateTypes = ["control", "label", "input", "prefix", "suffix", "setPrefix", "setSuffix"];
|
|
1590
|
+
class DynamicFormTemplateService {
|
|
1591
|
+
templatesUpdated;
|
|
1592
|
+
templates;
|
|
1593
|
+
constructor() {
|
|
1594
|
+
this.templatesUpdated = new Subject();
|
|
1595
|
+
this.templates = new Map();
|
|
1596
|
+
templateTypes.forEach(templateType => {
|
|
1597
|
+
this.templates.set(templateType, new Map());
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
isValidType(type) {
|
|
1601
|
+
return templateTypes.includes(type);
|
|
1602
|
+
}
|
|
1603
|
+
get(type, key) {
|
|
1604
|
+
if (!this.templates.has(type))
|
|
1605
|
+
return null;
|
|
1606
|
+
const templates = this.templates.get(type);
|
|
1607
|
+
return templates.has(key) ? templates.get(key) : null;
|
|
1608
|
+
}
|
|
1609
|
+
add(key, type, template) {
|
|
1610
|
+
if (!this.templates.has(type)) {
|
|
1611
|
+
this.templates.set(type, new Map());
|
|
1612
|
+
}
|
|
1613
|
+
this.templates.get(type).set(key, template);
|
|
1614
|
+
this.templatesUpdated.next();
|
|
1615
|
+
}
|
|
1616
|
+
remove(key, type) {
|
|
1617
|
+
if (!this.templates.has(type))
|
|
1618
|
+
return;
|
|
1619
|
+
this.templates.get(type).delete(key);
|
|
1620
|
+
this.templatesUpdated.next();
|
|
1621
|
+
}
|
|
1622
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1623
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplateService });
|
|
1624
|
+
}
|
|
1625
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplateService, decorators: [{
|
|
1626
|
+
type: Injectable
|
|
1627
|
+
}], ctorParameters: () => [] });
|
|
1628
|
+
|
|
1582
1629
|
class AsyncSubmitDirective extends AsyncMethodBase {
|
|
1583
1630
|
method = input(null, { alias: "async-submit" });
|
|
1584
1631
|
mode = input("click");
|
|
@@ -1667,6 +1714,118 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
1667
1714
|
args: ["class.loading"]
|
|
1668
1715
|
}] } });
|
|
1669
1716
|
|
|
1717
|
+
class DynamicFormTemplateDirective {
|
|
1718
|
+
templates;
|
|
1719
|
+
template;
|
|
1720
|
+
control;
|
|
1721
|
+
label;
|
|
1722
|
+
input;
|
|
1723
|
+
prefix;
|
|
1724
|
+
suffix;
|
|
1725
|
+
setPrefix;
|
|
1726
|
+
setSuffix;
|
|
1727
|
+
setting = null;
|
|
1728
|
+
constructor(templates, template) {
|
|
1729
|
+
this.templates = templates;
|
|
1730
|
+
this.template = template;
|
|
1731
|
+
}
|
|
1732
|
+
ngOnChanges() {
|
|
1733
|
+
this.ngOnDestroy();
|
|
1734
|
+
this.setting = this.selectType();
|
|
1735
|
+
if (!this.setting)
|
|
1736
|
+
return;
|
|
1737
|
+
this.templates.add(...this.setting, this.template);
|
|
1738
|
+
}
|
|
1739
|
+
ngOnDestroy() {
|
|
1740
|
+
if (!this.setting)
|
|
1741
|
+
return;
|
|
1742
|
+
this.templates.remove(...this.setting);
|
|
1743
|
+
}
|
|
1744
|
+
selectType() {
|
|
1745
|
+
const inputs = Object.keys(this);
|
|
1746
|
+
for (const input of inputs) {
|
|
1747
|
+
const value = this[input];
|
|
1748
|
+
if (this.templates.isValidType(input) && ObjectUtils.isStringWithValue(value)) {
|
|
1749
|
+
return [value, input];
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
return null;
|
|
1753
|
+
}
|
|
1754
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplateDirective, deps: [{ token: DynamicFormTemplateService }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
1755
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.19", type: DynamicFormTemplateDirective, isStandalone: false, selector: "ng-template[control],\n ng-template[label],\n ng-template[input],\n ng-template[prefix],\n ng-template[suffix],\n ng-template[setPrefix],\n ng-template[setSuffix]", inputs: { control: "control", label: "label", input: "input", prefix: "prefix", suffix: "suffix", setPrefix: "setPrefix", setSuffix: "setSuffix" }, usesOnChanges: true, ngImport: i0 });
|
|
1756
|
+
}
|
|
1757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplateDirective, decorators: [{
|
|
1758
|
+
type: Directive,
|
|
1759
|
+
args: [{
|
|
1760
|
+
standalone: false,
|
|
1761
|
+
selector: `ng-template[control],
|
|
1762
|
+
ng-template[label],
|
|
1763
|
+
ng-template[input],
|
|
1764
|
+
ng-template[prefix],
|
|
1765
|
+
ng-template[suffix],
|
|
1766
|
+
ng-template[setPrefix],
|
|
1767
|
+
ng-template[setSuffix]`
|
|
1768
|
+
}]
|
|
1769
|
+
}], ctorParameters: () => [{ type: DynamicFormTemplateService }, { type: i0.TemplateRef }], propDecorators: { control: [{
|
|
1770
|
+
type: Input
|
|
1771
|
+
}], label: [{
|
|
1772
|
+
type: Input
|
|
1773
|
+
}], input: [{
|
|
1774
|
+
type: Input
|
|
1775
|
+
}], prefix: [{
|
|
1776
|
+
type: Input
|
|
1777
|
+
}], suffix: [{
|
|
1778
|
+
type: Input
|
|
1779
|
+
}], setPrefix: [{
|
|
1780
|
+
type: Input
|
|
1781
|
+
}], setSuffix: [{
|
|
1782
|
+
type: Input
|
|
1783
|
+
}] } });
|
|
1784
|
+
|
|
1785
|
+
class DynamicFormTemplatePipe {
|
|
1786
|
+
templates;
|
|
1787
|
+
templatesUpdated;
|
|
1788
|
+
cachedKey;
|
|
1789
|
+
cachedType;
|
|
1790
|
+
cachedTemplate;
|
|
1791
|
+
constructor(templates) {
|
|
1792
|
+
this.templates = templates;
|
|
1793
|
+
this.cachedKey = null;
|
|
1794
|
+
this.cachedType = null;
|
|
1795
|
+
this.cachedTemplate = null;
|
|
1796
|
+
}
|
|
1797
|
+
ngOnInit() {
|
|
1798
|
+
this.templatesUpdated = this.templates.templatesUpdated.subscribe(() => {
|
|
1799
|
+
this.cachedTemplate = null;
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
ngOnDestroy() {
|
|
1803
|
+
if (this.templatesUpdated)
|
|
1804
|
+
this.templatesUpdated.unsubscribe();
|
|
1805
|
+
}
|
|
1806
|
+
transform(field, type) {
|
|
1807
|
+
const key = String(field.key || field.id);
|
|
1808
|
+
if (!field || !key)
|
|
1809
|
+
return null;
|
|
1810
|
+
if (this.cachedTemplate === null || this.cachedKey !== key || this.cachedType !== type) {
|
|
1811
|
+
this.cachedKey = key;
|
|
1812
|
+
this.cachedType = type;
|
|
1813
|
+
this.cachedTemplate = this.templates.get(type, key);
|
|
1814
|
+
}
|
|
1815
|
+
return this.cachedTemplate;
|
|
1816
|
+
}
|
|
1817
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplatePipe, deps: [{ token: DynamicFormTemplateService }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1818
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplatePipe, isStandalone: false, name: "dynamicFormTemplate", pure: false });
|
|
1819
|
+
}
|
|
1820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormTemplatePipe, decorators: [{
|
|
1821
|
+
type: Pipe,
|
|
1822
|
+
args: [{
|
|
1823
|
+
standalone: false,
|
|
1824
|
+
pure: false,
|
|
1825
|
+
name: "dynamicFormTemplate"
|
|
1826
|
+
}]
|
|
1827
|
+
}], ctorParameters: () => [{ type: DynamicFormTemplateService }] });
|
|
1828
|
+
|
|
1670
1829
|
class DynamicFieldType extends FieldType {
|
|
1671
1830
|
stateChanges = new Subject();
|
|
1672
1831
|
_errorState = false;
|
|
@@ -1847,8 +2006,8 @@ class DynamicFormComponent {
|
|
|
1847
2006
|
reset() {
|
|
1848
2007
|
this.options?.resetModel?.();
|
|
1849
2008
|
}
|
|
1850
|
-
serialize(validate = true) {
|
|
1851
|
-
return this.forms.serializeForm(this, validate);
|
|
2009
|
+
serialize(validate = true, ...purposes) {
|
|
2010
|
+
return this.forms.serializeForm(this, validate, ...purposes);
|
|
1852
2011
|
}
|
|
1853
2012
|
getField(path) {
|
|
1854
2013
|
const config = untracked(() => this.config());
|
|
@@ -1859,11 +2018,11 @@ class DynamicFormComponent {
|
|
|
1859
2018
|
return field?.formControl ?? null;
|
|
1860
2019
|
}
|
|
1861
2020
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormComponent, deps: [{ token: DynamicFormService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1862
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", 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 }, legacyLabels: { classPropertyName: "legacyLabels", publicName: "legacyLabels", 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", onFieldChanges: "onFieldChanges", onValueChanges: "onValueChanges", onInit: "onInit" }, 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 });
|
|
2021
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", 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 }, legacyLabels: { classPropertyName: "legacyLabels", publicName: "legacyLabels", 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", onFieldChanges: "onFieldChanges", onValueChanges: "onValueChanges", onInit: "onInit" }, providers: [DynamicFormTemplateService], 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 });
|
|
1863
2022
|
}
|
|
1864
2023
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormComponent, decorators: [{
|
|
1865
2024
|
type: Component,
|
|
1866
|
-
args: [{ standalone: false, selector: "dynamic-form", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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"] }]
|
|
2025
|
+
args: [{ standalone: false, selector: "dynamic-form", encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [DynamicFormTemplateService], 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"] }]
|
|
1867
2026
|
}], ctorParameters: () => [{ type: DynamicFormService }] });
|
|
1868
2027
|
|
|
1869
2028
|
class DynamicFormArrayComponent extends FieldArrayType {
|
|
@@ -1983,20 +2142,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
1983
2142
|
|
|
1984
2143
|
class DynamicFormFieldComponent extends FieldWrapper {
|
|
1985
2144
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormFieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1986
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: DynamicFormFieldComponent, isStandalone: false, selector: "dynamic-form-field", usesInheritance: true, ngImport: i0, template: "<ng-template #labelTemplate>\n @let label = !props.label || props.hideLabel ? null : props.label | translate;\n @if (label) {\n <label class=\"field-label\" [for]=\"id\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\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</ng-template>\n@if (props.labelAlign === \"before\") {\n
|
|
2145
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: DynamicFormFieldComponent, isStandalone: false, selector: "dynamic-form-field", usesInheritance: true, ngImport: i0, template: "<ng-template #labelTemplate>\n @let label = !props.label || props.hideLabel ? null : props.label | translate;\n @if (label) {\n <label class=\"field-label\" [for]=\"id\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\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</ng-template>\n<ng-template #inputTemplate>\n <ng-container #fieldComponent></ng-container>\n</ng-template>\n<ng-template #controlTemplate>\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'prefix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n @if (props.labelAlign === \"before\") {\n <ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || labelTemplate\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n }\n <div class=\"field-container\">\n <ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'input') || inputTemplate\"\n [ngTemplateOutletContext]=\"field\"></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 @if (props.labelAlign === \"after\") {\n <ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || labelTemplate\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n }\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'suffix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n</ng-template>\n<ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'control') || controlTemplate\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\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: "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 });
|
|
1987
2146
|
}
|
|
1988
2147
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormFieldComponent, decorators: [{
|
|
1989
2148
|
type: Component,
|
|
1990
|
-
args: [{ standalone: false, selector: "dynamic-form-field", encapsulation: ViewEncapsulation.None, template: "<ng-template #labelTemplate>\n @let label = !props.label || props.hideLabel ? null : props.label | translate;\n @if (label) {\n <label class=\"field-label\" [for]=\"id\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\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</ng-template>\n@if (props.labelAlign === \"before\") {\n
|
|
2149
|
+
args: [{ standalone: false, selector: "dynamic-form-field", encapsulation: ViewEncapsulation.None, template: "<ng-template #labelTemplate>\n @let label = !props.label || props.hideLabel ? null : props.label | translate;\n @if (label) {\n <label class=\"field-label\" [for]=\"id\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\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</ng-template>\n<ng-template #inputTemplate>\n <ng-container #fieldComponent></ng-container>\n</ng-template>\n<ng-template #controlTemplate>\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'prefix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n @if (props.labelAlign === \"before\") {\n <ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || labelTemplate\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n }\n <div class=\"field-container\">\n <ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'input') || inputTemplate\"\n [ngTemplateOutletContext]=\"field\"></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 @if (props.labelAlign === \"after\") {\n <ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'label') || labelTemplate\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n }\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'suffix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n</ng-template>\n<ng-container [ngTemplateOutlet]=\"(field | dynamicFormTemplate : 'control') || controlTemplate\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n" }]
|
|
1991
2150
|
}] });
|
|
1992
2151
|
|
|
1993
2152
|
class DynamicFormFieldsetComponent extends FieldWrapper {
|
|
1994
2153
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormFieldsetComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1995
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: DynamicFormFieldsetComponent, isStandalone: false, selector: "dynamic-form-fieldset", usesInheritance: true, ngImport: i0, template: "@let label = !props.label || props.hideLabel || field.parent.props.useTabs ? null : props.label | translate;\n@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"label\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\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.SafeHtmlPipe, name: "safe" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
2154
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: DynamicFormFieldsetComponent, isStandalone: false, selector: "dynamic-form-fieldset", usesInheritance: true, ngImport: i0, template: "@let label = !props.label || props.hideLabel || field.parent.props.useTabs ? null : props.label | translate;\n@if (field.display) {\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'setPrefix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n <legend class=\"field-legend\" *ngIf=\"label\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\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 <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'setSuffix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n}\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: "component", type: i3.LegacyFormlyField, selector: "formly-field" }, { kind: "pipe", type: i2.SafeHtmlPipe, name: "safe" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "pipe", type: DynamicFormTemplatePipe, name: "dynamicFormTemplate" }], encapsulation: i0.ViewEncapsulation.None });
|
|
1996
2155
|
}
|
|
1997
2156
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: DynamicFormFieldsetComponent, decorators: [{
|
|
1998
2157
|
type: Component,
|
|
1999
|
-
args: [{ standalone: false, selector: "dynamic-form-fieldset", encapsulation: ViewEncapsulation.None, template: "@let label = !props.label || props.hideLabel || field.parent.props.useTabs ? null : props.label | translate;\n@if (field.display) {\n <legend class=\"field-legend\" *ngIf=\"label\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\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" }]
|
|
2158
|
+
args: [{ standalone: false, selector: "dynamic-form-fieldset", encapsulation: ViewEncapsulation.None, template: "@let label = !props.label || props.hideLabel || field.parent.props.useTabs ? null : props.label | translate;\n@if (field.display) {\n <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'setPrefix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n <legend class=\"field-legend\" *ngIf=\"label\">\n <span [innerHTML]=\"label | safe: 'html'\"></span>\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 <ng-container [ngTemplateOutlet]=\"field | dynamicFormTemplate : 'setSuffix'\"\n [ngTemplateOutletContext]=\"field\"></ng-container>\n}\n" }]
|
|
2000
2159
|
}] });
|
|
2001
2160
|
|
|
2002
2161
|
class DynamicFormGroupComponent extends FieldWrapper {
|
|
@@ -2026,9 +2185,12 @@ const components = [
|
|
|
2026
2185
|
// --- Directives ---
|
|
2027
2186
|
const directives = [
|
|
2028
2187
|
AsyncSubmitDirective,
|
|
2188
|
+
DynamicFormTemplateDirective
|
|
2029
2189
|
];
|
|
2030
2190
|
// --- Pipes ---
|
|
2031
|
-
const pipes = [
|
|
2191
|
+
const pipes = [
|
|
2192
|
+
DynamicFormTemplatePipe
|
|
2193
|
+
];
|
|
2032
2194
|
|
|
2033
2195
|
class NgxDynamicFormModule {
|
|
2034
2196
|
static getProviders(config) {
|
|
@@ -2070,12 +2232,12 @@ class NgxDynamicFormModule {
|
|
|
2070
2232
|
return makeEnvironmentProviders(NgxDynamicFormModule.getProviders(config));
|
|
2071
2233
|
}
|
|
2072
2234
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: NgxDynamicFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2073
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.19", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective], imports: [CommonModule,
|
|
2235
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.19", ngImport: i0, type: NgxDynamicFormModule, declarations: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe], imports: [CommonModule,
|
|
2074
2236
|
FormsModule,
|
|
2075
2237
|
ReactiveFormsModule,
|
|
2076
2238
|
NgxUtilsModule,
|
|
2077
2239
|
FormlyModule,
|
|
2078
|
-
FormlySelectModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, FormsModule,
|
|
2240
|
+
FormlySelectModule], exports: [DynamicFieldType, DynamicFormComponent, DynamicFormArrayComponent, DynamicFormChipsComponent, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, DynamicFormAlertComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, AsyncSubmitDirective, DynamicFormTemplateDirective, DynamicFormTemplatePipe, FormsModule,
|
|
2079
2241
|
ReactiveFormsModule,
|
|
2080
2242
|
NgxUtilsModule,
|
|
2081
2243
|
FormlyModule,
|
|
@@ -2129,5 +2291,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
2129
2291
|
* Generated bundle index. Do not edit.
|
|
2130
2292
|
*/
|
|
2131
2293
|
|
|
2132
|
-
export { AsyncSubmitDirective, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormStaticComponent, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, EDITOR_FORMATS, 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, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, isFieldHidden, isFieldVisible, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDefault, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldProp, setFieldProps, setFieldSerialize, setFieldValue, translationValidation };
|
|
2294
|
+
export { AsyncSubmitDirective, DynamicFieldType, DynamicFormAlertComponent, DynamicFormArrayComponent, DynamicFormBuilderService, DynamicFormChipsComponent, DynamicFormComponent, DynamicFormFieldComponent, DynamicFormFieldsetComponent, DynamicFormGroupComponent, DynamicFormSchemaService, DynamicFormService, DynamicFormStaticComponent, DynamicFormTemplateDirective, DynamicFormTemplatePipe, DynamicFormTemplateService, DynamicFormTranslationComponent, DynamicFormUploadComponent, DynamicFormWysiwygComponent, EDITOR_FORMATS, 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, getFieldByPath, getFieldsByKey, getFieldsByPredicate, getSelectOptions, insertToFieldArray, isFieldHidden, isFieldVisible, jsonValidation, maxLengthValidation, maxValueValidation, minLengthValidation, minValueValidation, phoneValidation, removeFieldValidators, removeFromFieldArray, replaceFieldArray, replaceSpecialChars, requiredValidation, setFieldDefault, setFieldDisabled, setFieldHidden, setFieldHooks, setFieldProp, setFieldProps, setFieldSerialize, setFieldValue, translationValidation };
|
|
2133
2295
|
//# sourceMappingURL=stemy-ngx-dynamic-form.mjs.map
|