@dynamic-field-kit/angular 1.0.2 → 1.2.1
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/README.md +120 -61
- package/components/BaseInput.d.ts +22 -0
- package/components/DynamicInput.d.ts +28 -0
- package/components/FieldInput.d.ts +14 -0
- package/components/MultiFieldInput.d.ts +23 -0
- package/esm2020/components/BaseInput.mjs +46 -0
- package/esm2020/components/DynamicInput.mjs +146 -0
- package/esm2020/components/FieldInput.mjs +66 -0
- package/esm2020/components/MultiFieldInput.mjs +79 -0
- package/esm2020/dynamic-field-kit-angular.mjs +5 -0
- package/esm2020/layout/defaultLayouts.mjs +43 -0
- package/esm2020/layout/index.mjs +2 -0
- package/esm2020/lib/dynamic-field-kit.module.mjs +20 -0
- package/esm2020/public-api.mjs +14 -0
- package/esm2020/types/layout.mjs +2 -0
- package/fesm2015/dynamic-field-kit-angular.mjs +393 -0
- package/fesm2015/dynamic-field-kit-angular.mjs.map +1 -0
- package/fesm2020/dynamic-field-kit-angular.mjs +390 -0
- package/fesm2020/dynamic-field-kit-angular.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/layout/defaultLayouts.d.ts +13 -0
- package/layout/index.d.ts +1 -0
- package/lib/dynamic-field-kit.module.d.ts +11 -0
- package/package.json +47 -42
- package/public-api.d.ts +9 -0
- package/types/layout.d.ts +1 -0
- package/dist/README.md +0 -65
- package/dist/fesm2022/dynamic-field-kit-angular.mjs +0 -266
- package/dist/fesm2022/dynamic-field-kit-angular.mjs.map +0 -1
- package/dist/types/dynamic-field-kit-angular.d.ts +0 -70
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { NgClass, NgFor } from "@angular/common";
|
|
2
|
+
import { Component, Input, Output, EventEmitter } from "@angular/core";
|
|
3
|
+
import { FieldInput } from "./FieldInput";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class MultiFieldInput {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.fieldDescriptions = [];
|
|
8
|
+
this.onChange = new EventEmitter();
|
|
9
|
+
this.layout = "column";
|
|
10
|
+
this.data = {};
|
|
11
|
+
this.visibleFields = [];
|
|
12
|
+
}
|
|
13
|
+
trackByFn(index, field) {
|
|
14
|
+
return field.name || index;
|
|
15
|
+
}
|
|
16
|
+
ngOnInit() {
|
|
17
|
+
this.init();
|
|
18
|
+
}
|
|
19
|
+
ngOnChanges(_changes) {
|
|
20
|
+
this.init();
|
|
21
|
+
}
|
|
22
|
+
init() {
|
|
23
|
+
if (this.properties)
|
|
24
|
+
this.data = { ...this.properties };
|
|
25
|
+
this.updateVisibleFields();
|
|
26
|
+
}
|
|
27
|
+
updateVisibleFields() {
|
|
28
|
+
this.visibleFields = this.fieldDescriptions.filter((f) => !f.appearCondition || f.appearCondition(this.data));
|
|
29
|
+
}
|
|
30
|
+
onFieldChange(event) {
|
|
31
|
+
this.data = { ...this.data, [event.key]: event.value };
|
|
32
|
+
this.updateVisibleFields();
|
|
33
|
+
this.onChange.emit(this.data);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
MultiFieldInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MultiFieldInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
37
|
+
MultiFieldInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MultiFieldInput, isStandalone: true, selector: "dfk-multi-field-input", inputs: { fieldDescriptions: "fieldDescriptions", properties: "properties", layout: "layout" }, outputs: { onChange: "onChange" }, usesOnChanges: true, ngImport: i0, template: `
|
|
38
|
+
<div class="flex flex-col gap-3 p-4 border rounded-lg bg-gray-50" [ngClass]="{
|
|
39
|
+
'flex-row gap-3': layout === 'row',
|
|
40
|
+
'grid grid-cols-2 gap-3': layout === 'grid'
|
|
41
|
+
}">
|
|
42
|
+
<dfk-field-input
|
|
43
|
+
*ngFor="let field of visibleFields; trackBy: trackByFn"
|
|
44
|
+
[fieldDescription]="field"
|
|
45
|
+
[renderInfos]="data"
|
|
46
|
+
(onValueChangeField)="onFieldChange($event)"
|
|
47
|
+
></dfk-field-input>
|
|
48
|
+
</div>
|
|
49
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: FieldInput, selector: "dfk-field-input", inputs: ["fieldDescription", "renderInfos"], outputs: ["onValueChangeField"] }] });
|
|
50
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MultiFieldInput, decorators: [{
|
|
51
|
+
type: Component,
|
|
52
|
+
args: [{
|
|
53
|
+
selector: "dfk-multi-field-input",
|
|
54
|
+
standalone: true,
|
|
55
|
+
imports: [NgClass, NgFor, FieldInput],
|
|
56
|
+
template: `
|
|
57
|
+
<div class="flex flex-col gap-3 p-4 border rounded-lg bg-gray-50" [ngClass]="{
|
|
58
|
+
'flex-row gap-3': layout === 'row',
|
|
59
|
+
'grid grid-cols-2 gap-3': layout === 'grid'
|
|
60
|
+
}">
|
|
61
|
+
<dfk-field-input
|
|
62
|
+
*ngFor="let field of visibleFields; trackBy: trackByFn"
|
|
63
|
+
[fieldDescription]="field"
|
|
64
|
+
[renderInfos]="data"
|
|
65
|
+
(onValueChangeField)="onFieldChange($event)"
|
|
66
|
+
></dfk-field-input>
|
|
67
|
+
</div>
|
|
68
|
+
`,
|
|
69
|
+
}]
|
|
70
|
+
}], propDecorators: { fieldDescriptions: [{
|
|
71
|
+
type: Input
|
|
72
|
+
}], properties: [{
|
|
73
|
+
type: Input
|
|
74
|
+
}], onChange: [{
|
|
75
|
+
type: Output
|
|
76
|
+
}], layout: [{
|
|
77
|
+
type: Input
|
|
78
|
+
}] } });
|
|
79
|
+
//# sourceMappingURL=data:application/json;base64,eyJ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YmxlRmllbGRzKCkge1xuICAgIHRoaXMudmlzaWJsZUZpZWxkcyA9IHRoaXMuZmllbGREZXNjcmlwdGlvbnMuZmlsdGVyKFxuICAgICAgKGYpID0+ICFmLmFwcGVhckNvbmRpdGlvbiB8fCBmLmFwcGVhckNvbmRpdGlvbih0aGlzLmRhdGEpXG4gICAgKVxuICB9XG5cbiAgb25GaWVsZENoYW5nZShldmVudDogeyB2YWx1ZTogYW55OyBrZXk6IHN0cmluZyB9KSB7XG4gICAgdGhpcy5kYXRhID0geyAuLi50aGlzLmRhdGEsIFtldmVudC5rZXldOiBldmVudC52YWx1ZSB9XG4gICAgdGhpcy51cGRhdGVWaXNpYmxlRmllbGRzKClcbiAgICB0aGlzLm9uQ2hhbmdlLmVtaXQodGhpcy5kYXRhKVxuICB9XG59XG4iXX0=
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
export * from './public-api';
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYW1pYy1maWVsZC1raXQtYW5ndWxhci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9keW5hbWljLWZpZWxkLWtpdC1hbmd1bGFyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export class ColumnLayout {
|
|
5
|
+
}
|
|
6
|
+
ColumnLayout.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7
|
+
ColumnLayout.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ColumnLayout, isStandalone: true, selector: "dfk-column-layout", ngImport: i0, template: `<div style="display:flex;flex-direction:column;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
8
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnLayout, decorators: [{
|
|
9
|
+
type: Component,
|
|
10
|
+
args: [{
|
|
11
|
+
selector: "dfk-column-layout",
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [CommonModule],
|
|
14
|
+
template: `<div style="display:flex;flex-direction:column;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
15
|
+
}]
|
|
16
|
+
}] });
|
|
17
|
+
export class RowLayout {
|
|
18
|
+
}
|
|
19
|
+
RowLayout.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RowLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20
|
+
RowLayout.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: RowLayout, isStandalone: true, selector: "dfk-row-layout", ngImport: i0, template: `<div style="display:flex;flex-direction:row;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RowLayout, decorators: [{
|
|
22
|
+
type: Component,
|
|
23
|
+
args: [{
|
|
24
|
+
selector: "dfk-row-layout",
|
|
25
|
+
standalone: true,
|
|
26
|
+
imports: [CommonModule],
|
|
27
|
+
template: `<div style="display:flex;flex-direction:row;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
28
|
+
}]
|
|
29
|
+
}] });
|
|
30
|
+
export class GridLayout {
|
|
31
|
+
}
|
|
32
|
+
GridLayout.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GridLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
33
|
+
GridLayout.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GridLayout, isStandalone: true, selector: "dfk-grid-layout", ngImport: i0, template: `<div style="display:grid;grid-template-columns:repeat(var(--dfk-columns,2),1fr);gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
34
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GridLayout, decorators: [{
|
|
35
|
+
type: Component,
|
|
36
|
+
args: [{
|
|
37
|
+
selector: "dfk-grid-layout",
|
|
38
|
+
standalone: true,
|
|
39
|
+
imports: [CommonModule],
|
|
40
|
+
template: `<div style="display:grid;grid-template-columns:repeat(var(--dfk-columns,2),1fr);gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
41
|
+
}]
|
|
42
|
+
}] });
|
|
43
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmYXVsdExheW91dHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGF5b3V0L2RlZmF1bHRMYXlvdXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxlQUFlLENBQUE7QUFDekMsT0FBTyxFQUFFLFlBQVksRUFBRS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
export * from "./defaultLayouts";
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGF5b3V0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsa0JBQWtCLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tIFwiLi9kZWZhdWx0TGF5b3V0c1wiXG4iXX0=
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { DynamicInput } from '../components/DynamicInput';
|
|
4
|
+
import { FieldInput } from '../components/FieldInput';
|
|
5
|
+
import { MultiFieldInput } from '../components/MultiFieldInput';
|
|
6
|
+
import { ColumnLayout, RowLayout, GridLayout } from '../layout/defaultLayouts';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export class DynamicFieldKitModule {
|
|
9
|
+
}
|
|
10
|
+
DynamicFieldKitModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicFieldKitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
11
|
+
DynamicFieldKitModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: DynamicFieldKitModule, imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout], exports: [DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout] });
|
|
12
|
+
DynamicFieldKitModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicFieldKitModule, imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout] });
|
|
13
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicFieldKitModule, decorators: [{
|
|
14
|
+
type: NgModule,
|
|
15
|
+
args: [{
|
|
16
|
+
imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout],
|
|
17
|
+
exports: [DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout],
|
|
18
|
+
}]
|
|
19
|
+
}] });
|
|
20
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYW1pYy1maWVsZC1raXQubW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2xpYi9keW5hbWljLWZpZWxkLWtpdC5tb2R1bGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGVBQWUsQ0FBQTtBQUN4QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0saUJBQWlCLENBQUE7QUFFOUMsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDRCQUE0QixDQUFBO0FBQ3pELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQTtBQUNyRCxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sK0JBQStCLENBQUE7QUFFL0QsT0FBTyxFQUFFLFlBQVksRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLE1BQU0sMEJBQTBCLENBQUE7O0FBTTlFLE1BQU0sT0FBTyxxQkFBcUI7O21IQUFyQixxQkFBcUI7b0hBQXJCLHFCQUFxQixZQUh0QixZQUFZLEVBQUUsWUFBWSxFQUFFLFVBQVUsRUFBRSxlQUFlLEVBQUUsWUFBWSxFQUFFLFNBQVMsRUFBRSxVQUFVLGFBQzVGLFlBQVksRUFBRSxVQ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1dCwgTXVsdGlGaWVsZElucHV0LCBDb2x1bW5MYXlvdXQsIFJvd0xheW91dCwgR3JpZExheW91dF0sXHJcbiAgZXhwb3J0czogW0R5bmFtaWNJbnB1dCwgRmllbGRJbnB1dCwgTXVsdGlGaWVsZElucHV0LCBDb2x1bW5MYXlvdXQsIFJvd0xheW91dCwgR3JpZExheW91dF0sXHJcbn0pXHJcbmV4cG9ydCBjbGFzcyBEeW5hbWljRmllbGRLaXRNb2R1bGUge31cclxuIl19
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// public-api.ts
|
|
2
|
+
// Components
|
|
3
|
+
export * from './components/BaseInput';
|
|
4
|
+
export * from './components/DynamicInput';
|
|
5
|
+
export * from './components/FieldInput';
|
|
6
|
+
export * from './components/MultiFieldInput';
|
|
7
|
+
// Layout
|
|
8
|
+
export * from './layout';
|
|
9
|
+
export * from './types/layout';
|
|
10
|
+
// Module
|
|
11
|
+
export * from './lib/dynamic-field-kit.module';
|
|
12
|
+
// Optional: expose registry for advanced use cases, but not required for basic usage
|
|
13
|
+
export { fieldRegistry } from '@dynamic-field-kit/core';
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGdCQUFnQjtBQUVoQixhQUFhO0FBQ2IsY0FBYyx3QkFBd0IsQ0FBQztBQUN2QyxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsY0FBYyw4QkFBOEIsQ0FBQztBQUU3QyxTQUFTO0FBQ1QsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYyxnQkFBZ0IsQ0FBQztBQUUvQixTQUFTO0FBQ1QsY0FBYyxnQ0FBZ0MsQ0FBQztBQVMvQ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J2ZXJzaW9uIjozLCJmaWxlIjoibGF5b3V0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3R5cGVzL2xheW91dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHR5cGUgTGF5b3V0Q29uZmlnID0gXCJjb2x1bW5cIiB8IFwicm93XCIgfCBcImdyaWRcIlxuIl19
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Component, Input, Output, SimpleChange, ViewContainerRef, ViewChild, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule, NgIf, NgClass, NgFor } from '@angular/common';
|
|
4
|
+
import { fieldRegistry } from '@dynamic-field-kit/core';
|
|
5
|
+
export { fieldRegistry } from '@dynamic-field-kit/core';
|
|
6
|
+
|
|
7
|
+
class BaseInputComponent {
|
|
8
|
+
constructor(cdr) {
|
|
9
|
+
this.cdr = cdr;
|
|
10
|
+
// Add more from mplis as needed
|
|
11
|
+
this.valueChange = new EventEmitter();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
BaseInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BaseInputComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
15
|
+
BaseInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: BaseInputComponent, selector: "ng-component", inputs: { value: "value", label: "label", placeholder: "placeholder", required: "required", disabled: "disabled", options: "options", className: "className", description: "description", errorMessage: "errorMessage", acceptFile: "acceptFile", maxLength: "maxLength", minNumber: "minNumber", maxNumber: "maxNumber" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: '', isInline: true });
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: BaseInputComponent, decorators: [{
|
|
17
|
+
type: Component,
|
|
18
|
+
args: [{
|
|
19
|
+
template: ''
|
|
20
|
+
}]
|
|
21
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { value: [{
|
|
22
|
+
type: Input
|
|
23
|
+
}], label: [{
|
|
24
|
+
type: Input
|
|
25
|
+
}], placeholder: [{
|
|
26
|
+
type: Input
|
|
27
|
+
}], required: [{
|
|
28
|
+
type: Input
|
|
29
|
+
}], disabled: [{
|
|
30
|
+
type: Input
|
|
31
|
+
}], options: [{
|
|
32
|
+
type: Input
|
|
33
|
+
}], className: [{
|
|
34
|
+
type: Input
|
|
35
|
+
}], description: [{
|
|
36
|
+
type: Input
|
|
37
|
+
}], errorMessage: [{
|
|
38
|
+
type: Input
|
|
39
|
+
}], acceptFile: [{
|
|
40
|
+
type: Input
|
|
41
|
+
}], maxLength: [{
|
|
42
|
+
type: Input
|
|
43
|
+
}], minNumber: [{
|
|
44
|
+
type: Input
|
|
45
|
+
}], maxNumber: [{
|
|
46
|
+
type: Input
|
|
47
|
+
}], valueChange: [{
|
|
48
|
+
type: Output
|
|
49
|
+
}] } });
|
|
50
|
+
|
|
51
|
+
class DynamicInput extends BaseInputComponent {
|
|
52
|
+
constructor() {
|
|
53
|
+
super(...arguments);
|
|
54
|
+
this.valueChange = new EventEmitter();
|
|
55
|
+
this.onChange = new EventEmitter(); // backward compat
|
|
56
|
+
}
|
|
57
|
+
ngOnChanges(changes) {
|
|
58
|
+
var _a, _b, _c;
|
|
59
|
+
if (changes["type"] && !changes["type"].firstChange && this.host) {
|
|
60
|
+
this.render();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (this.inputInstance) {
|
|
64
|
+
this.applyKnownProps(this.inputInstance);
|
|
65
|
+
const childChanges = {};
|
|
66
|
+
for (const prop in changes) {
|
|
67
|
+
childChanges[prop] = new SimpleChange(changes[prop].previousValue, changes[prop].currentValue, changes[prop].firstChange);
|
|
68
|
+
}
|
|
69
|
+
(_b = (_a = this.inputInstance).ngOnChanges) === null || _b === void 0 ? void 0 : _b.call(_a, childChanges);
|
|
70
|
+
(_c = this.compRef) === null || _c === void 0 ? void 0 : _c.changeDetectorRef.detectChanges();
|
|
71
|
+
}
|
|
72
|
+
else if (this.host) {
|
|
73
|
+
this.render();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
ngAfterViewInit() {
|
|
77
|
+
this.render();
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
var _a;
|
|
81
|
+
const Renderer = fieldRegistry.get(this.type);
|
|
82
|
+
this.cleanupRenderedComponent();
|
|
83
|
+
this.host.clear();
|
|
84
|
+
if (!Renderer) {
|
|
85
|
+
const el = document.createElement("div");
|
|
86
|
+
el.textContent = `Unknown field type: ${this.type}`;
|
|
87
|
+
this.host.element.nativeElement.appendChild(el);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const compType = Renderer;
|
|
92
|
+
const compRef = this.host.createComponent(compType);
|
|
93
|
+
const instance = compRef.instance;
|
|
94
|
+
if (!instance)
|
|
95
|
+
throw new Error(`Failed to create instance for ${this.type}`);
|
|
96
|
+
this.applyKnownProps(instance);
|
|
97
|
+
this.bindOutput(instance, "valueChange");
|
|
98
|
+
this.bindOutput(instance, "onValueChange");
|
|
99
|
+
(_a = instance.changeDetectorRef) === null || _a === void 0 ? void 0 : _a.detectChanges();
|
|
100
|
+
this.compRef = compRef;
|
|
101
|
+
this.inputInstance = instance;
|
|
102
|
+
compRef.changeDetectorRef.detectChanges();
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
// Fallback to function renderer
|
|
106
|
+
try {
|
|
107
|
+
const props = {
|
|
108
|
+
value: this.value,
|
|
109
|
+
onValueChange: (v) => this.emitValue(v),
|
|
110
|
+
label: this.label,
|
|
111
|
+
placeholder: this.placeholder,
|
|
112
|
+
required: this.required,
|
|
113
|
+
options: this.options,
|
|
114
|
+
className: this.className,
|
|
115
|
+
description: this.description,
|
|
116
|
+
disabled: this.disabled,
|
|
117
|
+
errorMessage: this.errorMessage,
|
|
118
|
+
};
|
|
119
|
+
const out = Renderer(props);
|
|
120
|
+
if (typeof out === 'string') {
|
|
121
|
+
const el = document.createElement('div');
|
|
122
|
+
el.innerHTML = out;
|
|
123
|
+
this.host.element.nativeElement.appendChild(el);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (e) {
|
|
127
|
+
const el = document.createElement('div');
|
|
128
|
+
el.textContent = `Failed to render field: ${this.type}`;
|
|
129
|
+
this.host.element.nativeElement.appendChild(el);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
applyKnownProps(instance) {
|
|
134
|
+
const knownProps = ["value", "label", "placeholder", "required", "disabled", "options", "className", "description", "errorMessage"];
|
|
135
|
+
for (const prop of knownProps) {
|
|
136
|
+
if (prop in this && prop in instance) {
|
|
137
|
+
instance[prop] = this[prop];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
bindOutput(instance, outputName) {
|
|
142
|
+
const output = instance === null || instance === void 0 ? void 0 : instance[outputName];
|
|
143
|
+
if (!output || typeof output.subscribe !== "function")
|
|
144
|
+
return;
|
|
145
|
+
output.subscribe((value) => {
|
|
146
|
+
this.emitValue(value);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
emitValue(value) {
|
|
150
|
+
this.valueChange.emit(value);
|
|
151
|
+
this.onChange.emit(value);
|
|
152
|
+
}
|
|
153
|
+
cleanupRenderedComponent() {
|
|
154
|
+
var _a;
|
|
155
|
+
(_a = this.compRef) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
156
|
+
this.compRef = undefined;
|
|
157
|
+
this.inputInstance = undefined;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
DynamicInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
161
|
+
DynamicInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DynamicInput, isStandalone: true, selector: "dfk-dynamic-input", inputs: { type: "type", value: "value", label: "label", placeholder: "placeholder", required: "required", options: "options", className: "className", description: "description" }, outputs: { valueChange: "valueChange", onChange: "onChange" }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, read: ViewContainerRef }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `<div #host style="display: contents;"></div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicInput, decorators: [{
|
|
163
|
+
type: Component,
|
|
164
|
+
args: [{
|
|
165
|
+
selector: "dfk-dynamic-input",
|
|
166
|
+
standalone: true,
|
|
167
|
+
imports: [CommonModule],
|
|
168
|
+
template: `<div #host style="display: contents;"></div>`,
|
|
169
|
+
}]
|
|
170
|
+
}], propDecorators: { type: [{
|
|
171
|
+
type: Input
|
|
172
|
+
}], value: [{
|
|
173
|
+
type: Input
|
|
174
|
+
}], label: [{
|
|
175
|
+
type: Input
|
|
176
|
+
}], placeholder: [{
|
|
177
|
+
type: Input
|
|
178
|
+
}], required: [{
|
|
179
|
+
type: Input
|
|
180
|
+
}], options: [{
|
|
181
|
+
type: Input
|
|
182
|
+
}], className: [{
|
|
183
|
+
type: Input
|
|
184
|
+
}], description: [{
|
|
185
|
+
type: Input
|
|
186
|
+
}], valueChange: [{
|
|
187
|
+
type: Output
|
|
188
|
+
}], onChange: [{
|
|
189
|
+
type: Output
|
|
190
|
+
}], host: [{
|
|
191
|
+
type: ViewChild,
|
|
192
|
+
args: ["host", { read: ViewContainerRef, static: false }]
|
|
193
|
+
}] } });
|
|
194
|
+
|
|
195
|
+
class FieldInput {
|
|
196
|
+
constructor() {
|
|
197
|
+
this.onValueChangeField = new EventEmitter();
|
|
198
|
+
}
|
|
199
|
+
getFieldValue() {
|
|
200
|
+
if (!this.fieldDescription || !this.renderInfos)
|
|
201
|
+
return undefined;
|
|
202
|
+
const value = this.renderInfos[this.fieldDescription.name];
|
|
203
|
+
if (value === undefined && this.fieldDescription.type === "text") {
|
|
204
|
+
return "";
|
|
205
|
+
}
|
|
206
|
+
return value;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
FieldInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FieldInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
210
|
+
FieldInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FieldInput, isStandalone: true, selector: "dfk-field-input", inputs: { fieldDescription: "fieldDescription", renderInfos: "renderInfos" }, outputs: { onValueChangeField: "onValueChangeField" }, ngImport: i0, template: `
|
|
211
|
+
<dfk-dynamic-input
|
|
212
|
+
*ngIf="fieldDescription && renderInfos"
|
|
213
|
+
[type]="fieldDescription!.type"
|
|
214
|
+
[value]="getFieldValue()"
|
|
215
|
+
[label]="fieldDescription!.label"
|
|
216
|
+
[placeholder]="fieldDescription!.placeholder"
|
|
217
|
+
[required]="fieldDescription!.required"
|
|
218
|
+
[description]="fieldDescription!.description"
|
|
219
|
+
[options]="fieldDescription!.options"
|
|
220
|
+
[className]="fieldDescription!.className"
|
|
221
|
+
(valueChange)="onValueChangeField.emit({ value: $event, key: fieldDescription!.name })"
|
|
222
|
+
[disabled]="false"
|
|
223
|
+
[errorMessage]="''"
|
|
224
|
+
></dfk-dynamic-input>
|
|
225
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DynamicInput, selector: "dfk-dynamic-input", inputs: ["type", "value", "label", "placeholder", "required", "options", "className", "description"], outputs: ["valueChange", "onChange"] }] });
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FieldInput, decorators: [{
|
|
227
|
+
type: Component,
|
|
228
|
+
args: [{
|
|
229
|
+
selector: "dfk-field-input",
|
|
230
|
+
standalone: true,
|
|
231
|
+
imports: [NgIf, DynamicInput],
|
|
232
|
+
template: `
|
|
233
|
+
<dfk-dynamic-input
|
|
234
|
+
*ngIf="fieldDescription && renderInfos"
|
|
235
|
+
[type]="fieldDescription!.type"
|
|
236
|
+
[value]="getFieldValue()"
|
|
237
|
+
[label]="fieldDescription!.label"
|
|
238
|
+
[placeholder]="fieldDescription!.placeholder"
|
|
239
|
+
[required]="fieldDescription!.required"
|
|
240
|
+
[description]="fieldDescription!.description"
|
|
241
|
+
[options]="fieldDescription!.options"
|
|
242
|
+
[className]="fieldDescription!.className"
|
|
243
|
+
(valueChange)="onValueChangeField.emit({ value: $event, key: fieldDescription!.name })"
|
|
244
|
+
[disabled]="false"
|
|
245
|
+
[errorMessage]="''"
|
|
246
|
+
></dfk-dynamic-input>
|
|
247
|
+
`,
|
|
248
|
+
}]
|
|
249
|
+
}], propDecorators: { fieldDescription: [{
|
|
250
|
+
type: Input
|
|
251
|
+
}], renderInfos: [{
|
|
252
|
+
type: Input
|
|
253
|
+
}], onValueChangeField: [{
|
|
254
|
+
type: Output
|
|
255
|
+
}] } });
|
|
256
|
+
|
|
257
|
+
class MultiFieldInput {
|
|
258
|
+
constructor() {
|
|
259
|
+
this.fieldDescriptions = [];
|
|
260
|
+
this.onChange = new EventEmitter();
|
|
261
|
+
this.layout = "column";
|
|
262
|
+
this.data = {};
|
|
263
|
+
this.visibleFields = [];
|
|
264
|
+
}
|
|
265
|
+
trackByFn(index, field) {
|
|
266
|
+
return field.name || index;
|
|
267
|
+
}
|
|
268
|
+
ngOnInit() {
|
|
269
|
+
this.init();
|
|
270
|
+
}
|
|
271
|
+
ngOnChanges(_changes) {
|
|
272
|
+
this.init();
|
|
273
|
+
}
|
|
274
|
+
init() {
|
|
275
|
+
if (this.properties)
|
|
276
|
+
this.data = Object.assign({}, this.properties);
|
|
277
|
+
this.updateVisibleFields();
|
|
278
|
+
}
|
|
279
|
+
updateVisibleFields() {
|
|
280
|
+
this.visibleFields = this.fieldDescriptions.filter((f) => !f.appearCondition || f.appearCondition(this.data));
|
|
281
|
+
}
|
|
282
|
+
onFieldChange(event) {
|
|
283
|
+
this.data = Object.assign(Object.assign({}, this.data), { [event.key]: event.value });
|
|
284
|
+
this.updateVisibleFields();
|
|
285
|
+
this.onChange.emit(this.data);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
MultiFieldInput.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MultiFieldInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
289
|
+
MultiFieldInput.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MultiFieldInput, isStandalone: true, selector: "dfk-multi-field-input", inputs: { fieldDescriptions: "fieldDescriptions", properties: "properties", layout: "layout" }, outputs: { onChange: "onChange" }, usesOnChanges: true, ngImport: i0, template: `
|
|
290
|
+
<div class="flex flex-col gap-3 p-4 border rounded-lg bg-gray-50" [ngClass]="{
|
|
291
|
+
'flex-row gap-3': layout === 'row',
|
|
292
|
+
'grid grid-cols-2 gap-3': layout === 'grid'
|
|
293
|
+
}">
|
|
294
|
+
<dfk-field-input
|
|
295
|
+
*ngFor="let field of visibleFields; trackBy: trackByFn"
|
|
296
|
+
[fieldDescription]="field"
|
|
297
|
+
[renderInfos]="data"
|
|
298
|
+
(onValueChangeField)="onFieldChange($event)"
|
|
299
|
+
></dfk-field-input>
|
|
300
|
+
</div>
|
|
301
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: FieldInput, selector: "dfk-field-input", inputs: ["fieldDescription", "renderInfos"], outputs: ["onValueChangeField"] }] });
|
|
302
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MultiFieldInput, decorators: [{
|
|
303
|
+
type: Component,
|
|
304
|
+
args: [{
|
|
305
|
+
selector: "dfk-multi-field-input",
|
|
306
|
+
standalone: true,
|
|
307
|
+
imports: [NgClass, NgFor, FieldInput],
|
|
308
|
+
template: `
|
|
309
|
+
<div class="flex flex-col gap-3 p-4 border rounded-lg bg-gray-50" [ngClass]="{
|
|
310
|
+
'flex-row gap-3': layout === 'row',
|
|
311
|
+
'grid grid-cols-2 gap-3': layout === 'grid'
|
|
312
|
+
}">
|
|
313
|
+
<dfk-field-input
|
|
314
|
+
*ngFor="let field of visibleFields; trackBy: trackByFn"
|
|
315
|
+
[fieldDescription]="field"
|
|
316
|
+
[renderInfos]="data"
|
|
317
|
+
(onValueChangeField)="onFieldChange($event)"
|
|
318
|
+
></dfk-field-input>
|
|
319
|
+
</div>
|
|
320
|
+
`,
|
|
321
|
+
}]
|
|
322
|
+
}], propDecorators: { fieldDescriptions: [{
|
|
323
|
+
type: Input
|
|
324
|
+
}], properties: [{
|
|
325
|
+
type: Input
|
|
326
|
+
}], onChange: [{
|
|
327
|
+
type: Output
|
|
328
|
+
}], layout: [{
|
|
329
|
+
type: Input
|
|
330
|
+
}] } });
|
|
331
|
+
|
|
332
|
+
class ColumnLayout {
|
|
333
|
+
}
|
|
334
|
+
ColumnLayout.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
335
|
+
ColumnLayout.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ColumnLayout, isStandalone: true, selector: "dfk-column-layout", ngImport: i0, template: `<div style="display:flex;flex-direction:column;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
336
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ColumnLayout, decorators: [{
|
|
337
|
+
type: Component,
|
|
338
|
+
args: [{
|
|
339
|
+
selector: "dfk-column-layout",
|
|
340
|
+
standalone: true,
|
|
341
|
+
imports: [CommonModule],
|
|
342
|
+
template: `<div style="display:flex;flex-direction:column;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
343
|
+
}]
|
|
344
|
+
}] });
|
|
345
|
+
class RowLayout {
|
|
346
|
+
}
|
|
347
|
+
RowLayout.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RowLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
348
|
+
RowLayout.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: RowLayout, isStandalone: true, selector: "dfk-row-layout", ngImport: i0, template: `<div style="display:flex;flex-direction:row;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RowLayout, decorators: [{
|
|
350
|
+
type: Component,
|
|
351
|
+
args: [{
|
|
352
|
+
selector: "dfk-row-layout",
|
|
353
|
+
standalone: true,
|
|
354
|
+
imports: [CommonModule],
|
|
355
|
+
template: `<div style="display:flex;flex-direction:row;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
356
|
+
}]
|
|
357
|
+
}] });
|
|
358
|
+
class GridLayout {
|
|
359
|
+
}
|
|
360
|
+
GridLayout.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GridLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
361
|
+
GridLayout.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GridLayout, isStandalone: true, selector: "dfk-grid-layout", ngImport: i0, template: `<div style="display:grid;grid-template-columns:repeat(var(--dfk-columns,2),1fr);gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
362
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GridLayout, decorators: [{
|
|
363
|
+
type: Component,
|
|
364
|
+
args: [{
|
|
365
|
+
selector: "dfk-grid-layout",
|
|
366
|
+
standalone: true,
|
|
367
|
+
imports: [CommonModule],
|
|
368
|
+
template: `<div style="display:grid;grid-template-columns:repeat(var(--dfk-columns,2),1fr);gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
369
|
+
}]
|
|
370
|
+
}] });
|
|
371
|
+
|
|
372
|
+
class DynamicFieldKitModule {
|
|
373
|
+
}
|
|
374
|
+
DynamicFieldKitModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicFieldKitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
375
|
+
DynamicFieldKitModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: DynamicFieldKitModule, imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout], exports: [DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout] });
|
|
376
|
+
DynamicFieldKitModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicFieldKitModule, imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout] });
|
|
377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DynamicFieldKitModule, decorators: [{
|
|
378
|
+
type: NgModule,
|
|
379
|
+
args: [{
|
|
380
|
+
imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout],
|
|
381
|
+
exports: [DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout],
|
|
382
|
+
}]
|
|
383
|
+
}] });
|
|
384
|
+
|
|
385
|
+
// public-api.ts
|
|
386
|
+
// Components
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Generated bundle index. Do not edit.
|
|
390
|
+
*/
|
|
391
|
+
|
|
392
|
+
export { BaseInputComponent, ColumnLayout, DynamicFieldKitModule, DynamicInput, FieldInput, GridLayout, MultiFieldInput, RowLayout };
|
|
393
|
+
//# sourceMappingURL=dynamic-field-kit-angular.mjs.map
|