ngx-dynamic-entity-builder 1.0.0 → 1.2.0

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 CHANGED
@@ -1,54 +1,75 @@
1
- # ngx-dynamic-entity-builder
2
-
3
- Visual drag-and-drop Angular form builder for `@dynamic-entity/core` and `ngx-dynamic-entity`.
4
-
5
- ## Features
6
- - **Visual palette & canvas** — drag-and-drop authoring for all 19 field type keys, from the
7
- shared catalog in `@dynamic-entity/core` (so the builder can never drift from the renderer).
8
- - **Inspector** — properties, validation, options, display flags, `showWhen` conditions,
9
- `criticalField`, `showOnMinimize`, and `patchOnTrue`.
10
- - **Entity reference config** — registry key, display fields, static filters, parent→child
11
- cascade (`parentField` + `lookupFilter`/`lookupPath`), and `autoPatch` mappings.
12
- - **Rules** — author a rule with `RuleFormComponent`, manage the set per field with
13
- `FieldRulesListComponent` (reorder, enable/disable, edit, delete).
14
- - **Tab & module manager** — primary and nested tab structures.
15
- - **Live preview** — projected content slot; the builder does not depend on the renderer.
16
-
17
- ## Installation
18
- ```bash
19
- npm install ngx-dynamic-entity-builder @dynamic-entity/core
20
- ```
21
-
22
- `ngx-dynamic-entity` is not required — pass a rendered preview in as projected content if you
23
- want one.
24
-
25
- ## Usage
26
- ```html
27
- <ngx-entity-builder
28
- [config]="initialConfig"
29
- [rules]="initialRules"
30
- (configChange)="onConfigUpdated($event)"
31
- />
32
- ```
33
-
34
- ## Rules are stored beside the config
35
-
36
- `BuilderStore` keeps rules separate from `EntityFormConfig` — they are persisted per form, not
37
- inside the config object. Load and export them explicitly:
38
-
39
- ```ts
40
- store.load(config);
41
- store.loadRules(rules);
42
- // …authoring…
43
- const config = store.exportConfig();
44
- const rules = store.exportRules();
45
- ```
46
-
47
- Reordering rules renumbers `priority` contiguously from 1.
48
-
49
- ## Sub-components
50
-
51
- Each panel is individually importable: `FieldPaletteComponent`, `FieldInspectorComponent`,
52
- `TabManagerComponent`, `RuleFormComponent`, `FieldRulesListComponent`,
53
- `EntityReferenceConfigComponent`. All read and write through the `BuilderStore` provided by
54
- `EntityBuilderComponent`.
1
+ # ngx-dynamic-entity-builder
2
+
3
+ [![npm version](https://img.shields.io/npm/v/ngx-dynamic-entity-builder.svg?color=purple)](https://www.npmjs.com/package/ngx-dynamic-entity-builder)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)
5
+
6
+ Visual Angular builder for authoring `EntityFormConfig` schemas consumed by `ngx-dynamic-entity`. Supports Angular 17 through 22.
7
+
8
+ ---
9
+
10
+ ## 📦 Installation
11
+
12
+ ```bash
13
+ npm install ngx-dynamic-entity-builder ngx-dynamic-entity @dynamic-entity/core
14
+ ```
15
+
16
+ Unlike the renderer, **the builder requires Angular Material and the CDK**, and needs animations enabled:
17
+
18
+ ```typescript
19
+ // app.config.ts
20
+ import { ApplicationConfig } from '@angular/core';
21
+ import { provideAnimations } from '@angular/platform-browser/animations';
22
+
23
+ export const appConfig: ApplicationConfig = {
24
+ providers: [provideAnimations()],
25
+ };
26
+ ```
27
+
28
+ ---
29
+
30
+ ## ✨ Features
31
+
32
+ - **Palette & canvas** — click a field type in the palette to add it; drag to reorder within the canvas and tree.
33
+ - **Property inspector** — configure validators, options, display flags, `criticalField`, `maskData`, `autoPatch`, and `patchOnTrue`.
34
+ - **Entity reference designer** — registry key mapping, display fields, static filters, and parent→child cascades (`parentField` + `lookupFilter`).
35
+ - **Rules manager** — create, reorder, edit, and toggle reactive rules (`RuleFormComponent`, `FieldRulesListComponent`).
36
+ - **Tab & tree manager** — organize primary tabs, sub-tabs, nested groups, and array field lists. Nesting is recursive; no depth limit is enforced.
37
+ - **Live preview slot** — a projected content slot, so the builder renders a preview without depending on the renderer package.
38
+ - **All 19 field types** from the `@dynamic-entity/core` catalog.
39
+
40
+ ---
41
+
42
+ ## 🚀 Usage
43
+
44
+ ```html
45
+ <ngx-entity-builder
46
+ [config]="initialConfig"
47
+ [languages]="['en', 'de']"
48
+ [availableRoles]="['admin', 'editor']"
49
+ (configChange)="onConfigUpdated($event)"
50
+ (save)="onSave($event)"
51
+ />
52
+ ```
53
+
54
+ ### Inputs
55
+
56
+ | Input | Type | Notes |
57
+ |---|---|---|
58
+ | `config` | `EntityFormConfig \| undefined` | Omit to start from an empty schema. |
59
+ | `languages` | `string[]` | Locales offered for localized labels. Defaults to `['en']`. |
60
+ | `availableRoles` | `string[]` | Roles offered in the permissions editor. |
61
+ | `commonModules` | `readonly CommonModuleEntry[]` | Shared-module options for tabs. |
62
+
63
+ ### Outputs
64
+
65
+ | Output | Payload |
66
+ |---|---|
67
+ | `configChange` | `EntityFormConfig` — emitted on every edit. |
68
+ | `save` | `EntityFormConfig` — emitted when the user saves. |
69
+
70
+ ---
71
+
72
+ ## ⚠️ Known limitations
73
+
74
+ - **Field ids must be unique across the entire schema**, not just within a tab. Rules, `showWhen` conditions, and `autoPatch` mappings all address fields by bare id, so two fields sharing an id in different tabs will interfere with one another.
75
+ - **Structural edits apply to top-level tabs only.** Removing, duplicating, moving, and reordering a field works for fields on a top-level tab; a field inside a sub-tab can be selected and edited but not yet restructured.