@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
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './components/BaseInput';
|
|
2
|
+
export * from './components/DynamicInput';
|
|
3
|
+
export * from './components/FieldInput';
|
|
4
|
+
export * from './components/MultiFieldInput';
|
|
5
|
+
export * from './layout';
|
|
6
|
+
export * from './types/layout';
|
|
7
|
+
export * from './lib/dynamic-field-kit.module';
|
|
8
|
+
export type { FieldTypeKey, FieldDescription, FieldRendererProps } from '@dynamic-field-kit/core';
|
|
9
|
+
export { fieldRegistry } from '@dynamic-field-kit/core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type LayoutConfig = "column" | "row" | "grid";
|
package/dist/README.md
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# @dynamic-field-kit/angular
|
|
2
|
-
|
|
3
|
-
Lightweight Angular adapters for `@dynamic-field-kit/core`.
|
|
4
|
-
|
|
5
|
-
This package mirrors the React package structure and exposes Angular components that integrate with the shared `fieldRegistry` from `@dynamic-field-kit/core`.
|
|
6
|
-
|
|
7
|
-
Quick overview
|
|
8
|
-
- Exports a minimal Angular integration: `DynamicInput`, `FieldInput`, `MultiFieldInput`, layout components and `DynamicFieldKitModule` (see `src/public-api.ts`).
|
|
9
|
-
- Designed for local development (source import) and can be packaged with `ng-packagr` for distribution.
|
|
10
|
-
|
|
11
|
-
Usage (consumer Angular app)
|
|
12
|
-
|
|
13
|
-
1. Install the package (recommended: use packaged artifact or local `file:` during development):
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# from your Angular app
|
|
17
|
-
npm install @dynamic-field-kit/core @dynamic-field-kit/angular
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
2. Import the module in your `AppModule`:
|
|
21
|
-
|
|
22
|
-
```ts
|
|
23
|
-
import { DynamicFieldKitModule } from '@dynamic-field-kit/angular'
|
|
24
|
-
|
|
25
|
-
@NgModule({
|
|
26
|
-
imports: [BrowserModule, DynamicFieldKitModule],
|
|
27
|
-
})
|
|
28
|
-
export class AppModule {}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
3. Register Angular component classes into the shared registry at app startup (example):
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
// src/main.ts
|
|
35
|
-
import '@dynamic-field-kit/angular/src/examples' // registers example component into fieldRegistry
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Then use the Angular adapter components (`dfk-multi-field-input`, etc.) in templates.
|
|
39
|
-
|
|
40
|
-
Local development
|
|
41
|
-
- You can import the package source directly in your Angular app using `file:` references in `package.json` (see `example/angular-instructions.md` and `example/angular-app/` for a scaffold).
|
|
42
|
-
|
|
43
|
-
Build & publish
|
|
44
|
-
- This package supports `ng-packagr`. To build locally:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
cd packages/angular
|
|
48
|
-
npm install --no-audit --no-fund --save-dev ng-packagr rimraf
|
|
49
|
-
npm run build
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
- To publish to npm (scoped package), ensure `publishConfig.access` is `public` and run:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
cd packages/angular
|
|
56
|
-
npm publish --access public
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Notes & caveats
|
|
60
|
-
- The Angular adapter expects consumers to register Angular component classes (not React components) in `fieldRegistry` when using the Angular runtime.
|
|
61
|
-
- The package exports a `DynamicFieldKitModule` to simplify consumer imports, and also provides standalone components for more advanced composition.
|
|
62
|
-
|
|
63
|
-
Examples & docs
|
|
64
|
-
- See `example/angular-instructions.md` for detailed wiring steps.
|
|
65
|
-
- Try the local scaffold at `example/angular-app/` for a hands-on demo.
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, ViewContainerRef, ViewChild, Output, Input, Component, NgModule } from '@angular/core';
|
|
3
|
-
import { fieldRegistry } from '@dynamic-field-kit/core';
|
|
4
|
-
import * as i1 from '@angular/common';
|
|
5
|
-
import { CommonModule } from '@angular/common';
|
|
6
|
-
|
|
7
|
-
class DynamicInput {
|
|
8
|
-
type;
|
|
9
|
-
value;
|
|
10
|
-
onChange = new EventEmitter();
|
|
11
|
-
host;
|
|
12
|
-
ngOnChanges(_changes) {
|
|
13
|
-
this.render();
|
|
14
|
-
}
|
|
15
|
-
render() {
|
|
16
|
-
const Renderer = fieldRegistry.get(this.type);
|
|
17
|
-
this.host.clear();
|
|
18
|
-
if (!Renderer) {
|
|
19
|
-
// render a simple text node when missing
|
|
20
|
-
const el = document.createElement("div");
|
|
21
|
-
el.textContent = `Unknown field type: ${this.type}`;
|
|
22
|
-
this.host.element.nativeElement.appendChild(el);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
// If a registered renderer is an Angular Component class, create it.
|
|
26
|
-
// Consumers integrating Angular should register Angular component classes into the shared registry.
|
|
27
|
-
try {
|
|
28
|
-
const compType = Renderer;
|
|
29
|
-
const compRef = this.host.createComponent(compType);
|
|
30
|
-
// pass common props if inputs exist
|
|
31
|
-
if (compRef.instance) {
|
|
32
|
-
if ("value" in compRef.instance)
|
|
33
|
-
compRef.instance.value = this.value;
|
|
34
|
-
if ("onValueChange" in compRef.instance)
|
|
35
|
-
compRef.instance.onValueChange = (v) => this.onChange.emit(v);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
catch (err) {
|
|
39
|
-
// fallback: attempt to call renderer as function
|
|
40
|
-
try {
|
|
41
|
-
const out = Renderer({ value: this.value, onValueChange: (v) => this.onChange.emit(v) });
|
|
42
|
-
// If renderer returned a string/html, append
|
|
43
|
-
if (typeof out === "string") {
|
|
44
|
-
const el = document.createElement("div");
|
|
45
|
-
el.innerHTML = out;
|
|
46
|
-
this.host.element.nativeElement.appendChild(el);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
const el = document.createElement("div");
|
|
51
|
-
el.textContent = `Failed to render field: ${this.type}`;
|
|
52
|
-
this.host.element.nativeElement.appendChild(el);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: DynamicInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
57
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.5", type: DynamicInput, isStandalone: true, selector: "dfk-dynamic-input", inputs: { type: "type", value: "value" }, outputs: { onChange: "onChange" }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, read: ViewContainerRef, static: true }], usesOnChanges: true, ngImport: i0, template: `<ng-template #host></ng-template>`, isInline: true });
|
|
58
|
-
}
|
|
59
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: DynamicInput, decorators: [{
|
|
60
|
-
type: Component,
|
|
61
|
-
args: [{
|
|
62
|
-
selector: "dfk-dynamic-input",
|
|
63
|
-
standalone: true,
|
|
64
|
-
template: `<ng-template #host></ng-template>`,
|
|
65
|
-
}]
|
|
66
|
-
}], propDecorators: { type: [{
|
|
67
|
-
type: Input
|
|
68
|
-
}], value: [{
|
|
69
|
-
type: Input
|
|
70
|
-
}], onChange: [{
|
|
71
|
-
type: Output
|
|
72
|
-
}], host: [{
|
|
73
|
-
type: ViewChild,
|
|
74
|
-
args: ["host", { read: ViewContainerRef, static: true }]
|
|
75
|
-
}] } });
|
|
76
|
-
|
|
77
|
-
class FieldInput {
|
|
78
|
-
fieldDescription;
|
|
79
|
-
renderInfos;
|
|
80
|
-
onValueChangeField = new EventEmitter();
|
|
81
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: FieldInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
82
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.5", type: FieldInput, isStandalone: true, selector: "dfk-field-input", inputs: { fieldDescription: "fieldDescription", renderInfos: "renderInfos" }, outputs: { onValueChangeField: "onValueChangeField" }, ngImport: i0, template: `
|
|
83
|
-
<dfk-dynamic-input
|
|
84
|
-
[type]="fieldDescription.type"
|
|
85
|
-
[value]="renderInfos[fieldDescription.name]"
|
|
86
|
-
[ngClass]="fieldDescription.className"
|
|
87
|
-
(onChange)="onValueChangeField.emit({ value: $event, key: fieldDescription.name })"
|
|
88
|
-
></dfk-dynamic-input>
|
|
89
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: DynamicInput, selector: "dfk-dynamic-input", inputs: ["type", "value"], outputs: ["onChange"] }] });
|
|
90
|
-
}
|
|
91
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: FieldInput, decorators: [{
|
|
92
|
-
type: Component,
|
|
93
|
-
args: [{
|
|
94
|
-
selector: "dfk-field-input",
|
|
95
|
-
standalone: true,
|
|
96
|
-
imports: [CommonModule, DynamicInput],
|
|
97
|
-
template: `
|
|
98
|
-
<dfk-dynamic-input
|
|
99
|
-
[type]="fieldDescription.type"
|
|
100
|
-
[value]="renderInfos[fieldDescription.name]"
|
|
101
|
-
[ngClass]="fieldDescription.className"
|
|
102
|
-
(onChange)="onValueChangeField.emit({ value: $event, key: fieldDescription.name })"
|
|
103
|
-
></dfk-dynamic-input>
|
|
104
|
-
`,
|
|
105
|
-
}]
|
|
106
|
-
}], propDecorators: { fieldDescription: [{
|
|
107
|
-
type: Input
|
|
108
|
-
}], renderInfos: [{
|
|
109
|
-
type: Input
|
|
110
|
-
}], onValueChangeField: [{
|
|
111
|
-
type: Output
|
|
112
|
-
}] } });
|
|
113
|
-
|
|
114
|
-
class LayoutRegistry {
|
|
115
|
-
layouts = new Map();
|
|
116
|
-
register(type, renderer) {
|
|
117
|
-
if (this.layouts.has(type)) {
|
|
118
|
-
console.warn(`[dynamic-field-kit] Layout "${type}" already exists`);
|
|
119
|
-
}
|
|
120
|
-
this.layouts.set(type, renderer);
|
|
121
|
-
}
|
|
122
|
-
get(type) {
|
|
123
|
-
return this.layouts.get(type);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
const layoutRegistry = new LayoutRegistry();
|
|
127
|
-
|
|
128
|
-
class ColumnLayout {
|
|
129
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ColumnLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
130
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.5", 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 }] });
|
|
131
|
-
}
|
|
132
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: ColumnLayout, decorators: [{
|
|
133
|
-
type: Component,
|
|
134
|
-
args: [{
|
|
135
|
-
selector: "dfk-column-layout",
|
|
136
|
-
standalone: true,
|
|
137
|
-
imports: [CommonModule],
|
|
138
|
-
template: `<div style="display:flex;flex-direction:column;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
139
|
-
}]
|
|
140
|
-
}] });
|
|
141
|
-
class RowLayout {
|
|
142
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: RowLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
143
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.5", 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 }] });
|
|
144
|
-
}
|
|
145
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: RowLayout, decorators: [{
|
|
146
|
-
type: Component,
|
|
147
|
-
args: [{
|
|
148
|
-
selector: "dfk-row-layout",
|
|
149
|
-
standalone: true,
|
|
150
|
-
imports: [CommonModule],
|
|
151
|
-
template: `<div style="display:flex;flex-direction:row;gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
152
|
-
}]
|
|
153
|
-
}] });
|
|
154
|
-
class GridLayout {
|
|
155
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: GridLayout, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
156
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.5", 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 }] });
|
|
157
|
-
}
|
|
158
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: GridLayout, decorators: [{
|
|
159
|
-
type: Component,
|
|
160
|
-
args: [{
|
|
161
|
-
selector: "dfk-grid-layout",
|
|
162
|
-
standalone: true,
|
|
163
|
-
imports: [CommonModule],
|
|
164
|
-
template: `<div style="display:grid;grid-template-columns:repeat(var(--dfk-columns,2),1fr);gap:var(--dfk-gap,12px)"><ng-content></ng-content></div>`,
|
|
165
|
-
}]
|
|
166
|
-
}] });
|
|
167
|
-
layoutRegistry.register("column", ColumnLayout);
|
|
168
|
-
layoutRegistry.register("row", RowLayout);
|
|
169
|
-
layoutRegistry.register("grid", GridLayout);
|
|
170
|
-
|
|
171
|
-
var defaultLayouts = /*#__PURE__*/Object.freeze({
|
|
172
|
-
__proto__: null,
|
|
173
|
-
ColumnLayout: ColumnLayout,
|
|
174
|
-
GridLayout: GridLayout,
|
|
175
|
-
RowLayout: RowLayout
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
function resolveLayout(layout) {
|
|
179
|
-
if (!layout)
|
|
180
|
-
return { type: "column", config: {} };
|
|
181
|
-
if (typeof layout === "string")
|
|
182
|
-
return { type: layout, config: {} };
|
|
183
|
-
return { type: layout.type, config: layout };
|
|
184
|
-
}
|
|
185
|
-
class MultiFieldInput {
|
|
186
|
-
fieldDescriptions = [];
|
|
187
|
-
properties;
|
|
188
|
-
onChange = new EventEmitter();
|
|
189
|
-
layout;
|
|
190
|
-
host;
|
|
191
|
-
data = {};
|
|
192
|
-
ngOnInit() {
|
|
193
|
-
if (this.properties)
|
|
194
|
-
this.data = { ...this.properties };
|
|
195
|
-
const visibleFields = this.fieldDescriptions.filter((f) => !f.appearCondition || f.appearCondition(this.data));
|
|
196
|
-
const { type, config } = resolveLayout(this.layout);
|
|
197
|
-
const LayoutComp = layoutRegistry.get(type);
|
|
198
|
-
if (!LayoutComp)
|
|
199
|
-
throw new Error(`Unknown layout: ${type}`);
|
|
200
|
-
const layoutRef = this.host.createComponent(LayoutComp);
|
|
201
|
-
// project children manually: create FieldInput components into the layout's ViewContainerRef if exposed.
|
|
202
|
-
// For now, we append simple FieldInput components as children of layout element.
|
|
203
|
-
const el = document.createElement("div");
|
|
204
|
-
visibleFields.forEach((f) => {
|
|
205
|
-
const wrapper = document.createElement("div");
|
|
206
|
-
wrapper.textContent = f.label || f.name;
|
|
207
|
-
el.appendChild(wrapper);
|
|
208
|
-
});
|
|
209
|
-
try {
|
|
210
|
-
layoutRef.location.nativeElement.appendChild(el);
|
|
211
|
-
}
|
|
212
|
-
catch { }
|
|
213
|
-
}
|
|
214
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: MultiFieldInput, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
215
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.5", type: MultiFieldInput, isStandalone: true, selector: "dfk-multi-field-input", inputs: { fieldDescriptions: "fieldDescriptions", properties: "properties", layout: "layout" }, outputs: { onChange: "onChange" }, viewQueries: [{ propertyName: "host", first: true, predicate: ["host"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: `
|
|
216
|
-
<ng-container #host></ng-container>
|
|
217
|
-
`, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
218
|
-
}
|
|
219
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: MultiFieldInput, decorators: [{
|
|
220
|
-
type: Component,
|
|
221
|
-
args: [{
|
|
222
|
-
selector: "dfk-multi-field-input",
|
|
223
|
-
standalone: true,
|
|
224
|
-
imports: [CommonModule],
|
|
225
|
-
template: `
|
|
226
|
-
<ng-container #host></ng-container>
|
|
227
|
-
`,
|
|
228
|
-
}]
|
|
229
|
-
}], propDecorators: { fieldDescriptions: [{
|
|
230
|
-
type: Input
|
|
231
|
-
}], properties: [{
|
|
232
|
-
type: Input
|
|
233
|
-
}], onChange: [{
|
|
234
|
-
type: Output
|
|
235
|
-
}], layout: [{
|
|
236
|
-
type: Input
|
|
237
|
-
}], host: [{
|
|
238
|
-
type: ViewChild,
|
|
239
|
-
args: ["host", { read: ViewContainerRef, static: true }]
|
|
240
|
-
}] } });
|
|
241
|
-
|
|
242
|
-
class DynamicFieldKitModule {
|
|
243
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: DynamicFieldKitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
244
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.5", ngImport: i0, type: DynamicFieldKitModule, imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout], exports: [DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout] });
|
|
245
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: DynamicFieldKitModule, imports: [CommonModule, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout] });
|
|
246
|
-
}
|
|
247
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.5", ngImport: i0, type: DynamicFieldKitModule, decorators: [{
|
|
248
|
-
type: NgModule,
|
|
249
|
-
args: [{
|
|
250
|
-
imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout],
|
|
251
|
-
exports: [DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout],
|
|
252
|
-
}]
|
|
253
|
-
}] });
|
|
254
|
-
|
|
255
|
-
async function registerDefaults() {
|
|
256
|
-
await Promise.resolve().then(function () { return defaultLayouts; });
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// Public API surface for the Angular package (used by ng-packagr)
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* Generated bundle index. Do not edit.
|
|
263
|
-
*/
|
|
264
|
-
|
|
265
|
-
export { ColumnLayout, DynamicFieldKitModule, DynamicInput, FieldInput, GridLayout, MultiFieldInput, RowLayout, layoutRegistry };
|
|
266
|
-
//# sourceMappingURL=dynamic-field-kit-angular.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-field-kit-angular.mjs","sources":["../../src/components/DynamicInput.ts","../../src/components/FieldInput.ts","../../src/layout/layoutRegistry.ts","../../src/layout/defaultLayouts.ts","../../src/components/MultiFieldInput.ts","../../src/lib/dynamic-field-kit.module.ts","../../src/registerDefaults.ts","../../src/public-api.ts","../../src/dynamic-field-kit-angular.ts"],"sourcesContent":["import { Component, Input, Output, EventEmitter, ViewChild, ViewContainerRef, OnChanges, SimpleChanges, Type } from \"@angular/core\"\r\nimport { fieldRegistry, FieldRendererProps, FieldTypeKey } from \"@dynamic-field-kit/core\"\r\n\r\n@Component({\r\n selector: \"dfk-dynamic-input\",\r\n standalone: true,\r\n template: `<ng-template #host></ng-template>`,\r\n})\r\nexport class DynamicInput<T extends FieldTypeKey = FieldTypeKey> implements OnChanges {\r\n @Input() type!: T\r\n @Input() value?: any\r\n @Output() onChange = new EventEmitter<any>()\r\n\r\n @ViewChild(\"host\", { read: ViewContainerRef, static: true }) host!: ViewContainerRef\r\n\r\n ngOnChanges(_changes: SimpleChanges) {\r\n this.render()\r\n }\r\n\r\n private render() {\r\n const Renderer = (fieldRegistry as any).get(this.type)\r\n this.host.clear()\r\n if (!Renderer) {\r\n // render a simple text node when missing\r\n const el = document.createElement(\"div\")\r\n el.textContent = `Unknown field type: ${this.type}`\r\n this.host.element.nativeElement.appendChild(el)\r\n return\r\n }\r\n\r\n // If a registered renderer is an Angular Component class, create it.\r\n // Consumers integrating Angular should register Angular component classes into the shared registry.\r\n try {\r\n const compType = Renderer as Type<any>\r\n const compRef = this.host.createComponent(compType)\r\n // pass common props if inputs exist\r\n if (compRef.instance) {\r\n if (\"value\" in compRef.instance) compRef.instance.value = this.value\r\n if (\"onValueChange\" in compRef.instance) compRef.instance.onValueChange = (v: any) => this.onChange.emit(v)\r\n }\r\n } catch (err) {\r\n // fallback: attempt to call renderer as function\r\n try {\r\n const out = Renderer({ value: this.value, onValueChange: (v: any) => this.onChange.emit(v) } as FieldRendererProps)\r\n // If renderer returned a string/html, append\r\n if (typeof out === \"string\") {\r\n const el = document.createElement(\"div\")\r\n el.innerHTML = out\r\n this.host.element.nativeElement.appendChild(el)\r\n }\r\n } catch (e) {\r\n const el = document.createElement(\"div\")\r\n el.textContent = `Failed to render field: ${this.type}`\r\n this.host.element.nativeElement.appendChild(el)\r\n }\r\n }\r\n }\r\n}\r\n","import { Component, Input, Output, EventEmitter } from \"@angular/core\"\r\nimport { CommonModule } from '@angular/common'\r\nimport { DynamicInput } from './DynamicInput'\r\nimport { FieldDescription, Properties } from \"@dynamic-field-kit/core\"\r\n\r\n@Component({\r\n selector: \"dfk-field-input\",\r\n standalone: true,\r\n imports: [CommonModule, DynamicInput],\r\n template: `\r\n <dfk-dynamic-input\r\n [type]=\"fieldDescription.type\"\r\n [value]=\"renderInfos[fieldDescription.name]\"\r\n [ngClass]=\"fieldDescription.className\"\r\n (onChange)=\"onValueChangeField.emit({ value: $event, key: fieldDescription.name })\"\r\n ></dfk-dynamic-input>\r\n `,\r\n})\r\nexport class FieldInput {\r\n @Input() fieldDescription!: FieldDescription\r\n @Input() renderInfos!: Properties\r\n @Output() onValueChangeField = new EventEmitter<any>()\r\n}\r\n","import { Type } from \"@angular/core\"\r\n\r\nexport type LayoutRenderer = Type<any>\r\n\r\nexport class LayoutRegistry {\r\n private layouts = new Map<string, LayoutRenderer>()\r\n\r\n register(type: string, renderer: LayoutRenderer) {\r\n if (this.layouts.has(type)) {\r\n console.warn(`[dynamic-field-kit] Layout \"${type}\" already exists`)\r\n }\r\n this.layouts.set(type, renderer)\r\n }\r\n\r\n get(type: string): LayoutRenderer | undefined {\r\n return this.layouts.get(type)\r\n }\r\n}\r\n\r\nexport const layoutRegistry = new LayoutRegistry()\r\n","\r\nimport { Component } from \"@angular/core\"\r\nimport { layoutRegistry } from \"./layoutRegistry\"\r\nimport { CommonModule } from '@angular/common'\r\n\r\n@Component({\r\n selector: \"dfk-column-layout\",\r\n standalone: true,\r\n imports: [CommonModule],\r\n template: `<div style=\"display:flex;flex-direction:column;gap:var(--dfk-gap,12px)\"><ng-content></ng-content></div>`,\r\n})\r\nexport class ColumnLayout {}\r\n\r\n@Component({\r\n selector: \"dfk-row-layout\",\r\n standalone: true,\r\n imports: [CommonModule],\r\n template: `<div style=\"display:flex;flex-direction:row;gap:var(--dfk-gap,12px)\"><ng-content></ng-content></div>`,\r\n})\r\nexport class RowLayout {}\r\n\r\n@Component({\r\n selector: \"dfk-grid-layout\",\r\n standalone: true,\r\n imports: [CommonModule],\r\n template: `<div style=\"display:grid;grid-template-columns:repeat(var(--dfk-columns,2),1fr);gap:var(--dfk-gap,12px)\"><ng-content></ng-content></div>`,\r\n})\r\nexport class GridLayout {}\r\n\r\nlayoutRegistry.register(\"column\", ColumnLayout)\r\nlayoutRegistry.register(\"row\", RowLayout)\r\nlayoutRegistry.register(\"grid\", GridLayout)\r\n","import { Component, Input, Output, EventEmitter, OnInit, ViewContainerRef, ViewChild } from \"@angular/core\"\r\nimport { CommonModule } from '@angular/common'\r\n\r\nimport { FieldDescription, Properties } from \"@dynamic-field-kit/core\"\r\nimport { layoutRegistry } from \"../layout\"\r\nimport { LayoutConfig } from \"../types/layout\"\r\nimport { FieldInput } from \"./FieldInput\"\r\n\r\nfunction resolveLayout(layout?: LayoutConfig) {\r\n if (!layout) return { type: \"column\", config: {} }\r\n if (typeof layout === \"string\") return { type: layout, config: {} }\r\n return { type: layout.type, config: layout }\r\n}\r\n\r\n@Component({\r\n selector: \"dfk-multi-field-input\",\r\n standalone: true,\r\n imports: [CommonModule],\r\n template: `\r\n <ng-container #host></ng-container>\r\n `,\r\n})\r\nexport class MultiFieldInput implements OnInit {\r\n @Input() fieldDescriptions: FieldDescription[] = []\r\n @Input() properties?: Properties\r\n @Output() onChange = new EventEmitter<Properties>()\r\n @Input() layout?: LayoutConfig\r\n\r\n @ViewChild(\"host\", { read: ViewContainerRef, static: true }) host!: ViewContainerRef\r\n\r\n private data: Properties = {}\r\n\r\n ngOnInit() {\r\n if (this.properties) this.data = { ...this.properties }\r\n const visibleFields = this.fieldDescriptions.filter((f) => !f.appearCondition || f.appearCondition(this.data))\r\n\r\n const { type, config } = resolveLayout(this.layout)\r\n const LayoutComp = layoutRegistry.get(type)\r\n if (!LayoutComp) throw new Error(`Unknown layout: ${type}`)\r\n\r\n const layoutRef = this.host.createComponent(LayoutComp as any)\r\n // project children manually: create FieldInput components into the layout's ViewContainerRef if exposed.\r\n // For now, we append simple FieldInput components as children of layout element.\r\n const el = document.createElement(\"div\")\r\n visibleFields.forEach((f) => {\r\n const wrapper = document.createElement(\"div\")\r\n wrapper.textContent = f.label || f.name\r\n el.appendChild(wrapper)\r\n })\r\n try {\r\n layoutRef.location.nativeElement.appendChild(el)\r\n } catch {}\r\n }\r\n}\r\n","import { NgModule } from '@angular/core'\r\nimport { CommonModule } from '@angular/common'\r\n\r\nimport { DynamicInput } from '../components/DynamicInput'\r\nimport { FieldInput } from '../components/FieldInput'\r\nimport { MultiFieldInput } from '../components/MultiFieldInput'\r\n\r\nimport { ColumnLayout, RowLayout, GridLayout } from '../layout/defaultLayouts'\r\n\r\n@NgModule({\r\n imports: [CommonModule, DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout],\r\n exports: [DynamicInput, FieldInput, MultiFieldInput, ColumnLayout, RowLayout, GridLayout],\r\n})\r\nexport class DynamicFieldKitModule {}\r\n","export async function registerDefaults() {\r\n await import(\"./layout/defaultLayouts\")\r\n}\r\n","// Public API surface for the Angular package (used by ng-packagr)\r\nexport * from './components/DynamicInput'\r\nexport * from './components/FieldInput'\r\nexport * from './components/MultiFieldInput'\r\nexport * from './layout'\r\nexport * from './types/layout'\r\nexport * from './lib/dynamic-field-kit.module'\r\n\r\n// Ensure default registrations run when library is imported\r\nimport './registerDefaults'\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAQa,YAAY,CAAA;AACd,IAAA,IAAI;AACJ,IAAA,KAAK;AACJ,IAAA,QAAQ,GAAG,IAAI,YAAY,EAAO;AAEiB,IAAA,IAAI;AAEjE,IAAA,WAAW,CAAC,QAAuB,EAAA;QACjC,IAAI,CAAC,MAAM,EAAE;IACf;IAEQ,MAAM,GAAA;QACZ,MAAM,QAAQ,GAAI,aAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;AACtD,QAAA,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;QACjB,IAAI,CAAC,QAAQ,EAAE;;YAEb,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC;YACxC,EAAE,CAAC,WAAW,GAAG,CAAA,oBAAA,EAAuB,IAAI,CAAC,IAAI,EAAE;YACnD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,EAAE,UAAU,CAAA,EAAA,OAAA,EAAA,CAC5F,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,CAAA,EAAA,CAAA;wGAE7E,qBAAqB,EAAA,OAAA,EAAA,CAHtB,YAAY,EAAgB,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,CAAA,EAAA,CAAA;;2FAG3F,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAJjC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC;AACvG,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC;AAC1F,iBAAA;;;ACZM,eAAe,gBAAgB,GAAA;AAClC,IAAA,MAAM,8DAAiC;AAC3C;;ACFA;;ACAA;;AAEG;;;;"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnChanges, EventEmitter, ViewContainerRef, SimpleChanges, OnInit, Type } from '@angular/core';
|
|
3
|
-
import { FieldTypeKey, FieldDescription, Properties } from '@dynamic-field-kit/core';
|
|
4
|
-
import * as i1 from '@angular/common';
|
|
5
|
-
|
|
6
|
-
declare class DynamicInput<T extends FieldTypeKey = FieldTypeKey> implements OnChanges {
|
|
7
|
-
type: T;
|
|
8
|
-
value?: any;
|
|
9
|
-
onChange: EventEmitter<any>;
|
|
10
|
-
host: ViewContainerRef;
|
|
11
|
-
ngOnChanges(_changes: SimpleChanges): void;
|
|
12
|
-
private render;
|
|
13
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicInput<any>, never>;
|
|
14
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicInput<any>, "dfk-dynamic-input", never, { "type": { "alias": "type"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, { "onChange": "onChange"; }, never, never, true, never>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare class FieldInput {
|
|
18
|
-
fieldDescription: FieldDescription;
|
|
19
|
-
renderInfos: Properties;
|
|
20
|
-
onValueChangeField: EventEmitter<any>;
|
|
21
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FieldInput, never>;
|
|
22
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FieldInput, "dfk-field-input", never, { "fieldDescription": { "alias": "fieldDescription"; "required": false; }; "renderInfos": { "alias": "renderInfos"; "required": false; }; }, { "onValueChangeField": "onValueChangeField"; }, never, never, true, never>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
type LayoutConfig = string | {
|
|
26
|
-
type: string;
|
|
27
|
-
[k: string]: any;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
declare class MultiFieldInput implements OnInit {
|
|
31
|
-
fieldDescriptions: FieldDescription[];
|
|
32
|
-
properties?: Properties;
|
|
33
|
-
onChange: EventEmitter<Properties>;
|
|
34
|
-
layout?: LayoutConfig;
|
|
35
|
-
host: ViewContainerRef;
|
|
36
|
-
private data;
|
|
37
|
-
ngOnInit(): void;
|
|
38
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MultiFieldInput, never>;
|
|
39
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MultiFieldInput, "dfk-multi-field-input", never, { "fieldDescriptions": { "alias": "fieldDescriptions"; "required": false; }; "properties": { "alias": "properties"; "required": false; }; "layout": { "alias": "layout"; "required": false; }; }, { "onChange": "onChange"; }, never, never, true, never>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type LayoutRenderer = Type<any>;
|
|
43
|
-
declare class LayoutRegistry {
|
|
44
|
-
private layouts;
|
|
45
|
-
register(type: string, renderer: LayoutRenderer): void;
|
|
46
|
-
get(type: string): LayoutRenderer | undefined;
|
|
47
|
-
}
|
|
48
|
-
declare const layoutRegistry: LayoutRegistry;
|
|
49
|
-
|
|
50
|
-
declare class ColumnLayout {
|
|
51
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ColumnLayout, never>;
|
|
52
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ColumnLayout, "dfk-column-layout", never, {}, {}, never, ["*"], true, never>;
|
|
53
|
-
}
|
|
54
|
-
declare class RowLayout {
|
|
55
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RowLayout, never>;
|
|
56
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<RowLayout, "dfk-row-layout", never, {}, {}, never, ["*"], true, never>;
|
|
57
|
-
}
|
|
58
|
-
declare class GridLayout {
|
|
59
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<GridLayout, never>;
|
|
60
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<GridLayout, "dfk-grid-layout", never, {}, {}, never, ["*"], true, never>;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
declare class DynamicFieldKitModule {
|
|
64
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicFieldKitModule, never>;
|
|
65
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DynamicFieldKitModule, never, [typeof i1.CommonModule, typeof DynamicInput, typeof FieldInput, typeof MultiFieldInput, typeof ColumnLayout, typeof RowLayout, typeof GridLayout], [typeof DynamicInput, typeof FieldInput, typeof MultiFieldInput, typeof ColumnLayout, typeof RowLayout, typeof GridLayout]>;
|
|
66
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<DynamicFieldKitModule>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export { ColumnLayout, DynamicFieldKitModule, DynamicInput, FieldInput, GridLayout, MultiFieldInput, RowLayout, layoutRegistry };
|
|
70
|
-
export type { LayoutConfig };
|