ngx-dynamic-entity-builder 1.6.0 → 1.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-dynamic-entity-builder",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Angular standalone visual builder for authoring dynamic-entity EntityConfig (fields, tabs, validators, RBAC).",
5
5
  "//typings": "Local workspace resolution only: ng-packagr 21 writes types/ngx-dynamic-entity-builder.d.ts into dist/package.json. Do NOT add a 'main' field here — ng-packagr does not generate one, so it would be copied verbatim and resolve wrongly in the published package.",
6
6
  "typings": "types/ngx-dynamic-entity-builder.d.ts",
@@ -10,8 +10,8 @@
10
10
  "@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
11
11
  "@angular/forms": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
12
12
  "@angular/material": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
13
- "@dynamic-entity/core": "^1.6.0",
14
- "ngx-dynamic-entity": "^1.6.0",
13
+ "@dynamic-entity/core": "^1.7.0",
14
+ "ngx-dynamic-entity": "^1.7.0",
15
15
  "rxjs": "^7.0.0"
16
16
  },
17
17
  "keywords": [
@@ -109,7 +109,36 @@ declare class BuilderStore {
109
109
  * therefore see deeper than `fields()`, which stops at a tab's own fields.
110
110
  */
111
111
  private allFieldIds;
112
+ /**
113
+ * Resolve a field by key, where a key is either its `refererField` path or a bare id.
114
+ *
115
+ * Every resolution in this store funnels through here, which is why a bare id was enough
116
+ * to edit the wrong field: with `personal.address` and `work.address` both present, the
117
+ * first match won, so selecting or editing the second one silently addressed the first.
118
+ *
119
+ * The path is tried across the whole tree before any bare id is, so an exact key never
120
+ * loses to a nearer-but-wrong match. Bare ids still resolve — every existing caller and
121
+ * spec passes one, and for an unambiguous id it is the same field either way.
122
+ */
112
123
  private findFieldInTabs;
124
+ private findFieldBy;
125
+ /**
126
+ * The key a caller should hand back to address this exact field. Templates use it so a
127
+ * click on the second of two same-named fields selects that one.
128
+ */
129
+ keyOf(field: {
130
+ id: string;
131
+ refererField?: string;
132
+ }): string;
133
+ /**
134
+ * Whether this exact field is the selected one.
135
+ *
136
+ * Not `selectedFieldId() === field.id`: selection may hold a bare id or a path depending
137
+ * on who set it, and with two fields sharing an id a bare comparison lights up both rows
138
+ * — or neither, once the click starts storing a path. Resolving both sides answers for
139
+ * the field itself.
140
+ */
141
+ isSelected(field: NestedFieldConfig): boolean;
113
142
  addField(type: RichFieldType, targetTabId?: string): string;
114
143
  updateField(id: string, patch: Partial<NestedFieldConfig>): void;
115
144
  /**
@@ -129,10 +158,16 @@ declare class BuilderStore {
129
158
  * That was survivable while renaming was a rare manual act; label-derived ids make it
130
159
  * routine, so the references move with it.
131
160
  */
161
+ /**
162
+ * `key` addresses the field to rename; `oldId` is the bare id every *reference* to it
163
+ * carries. They were one parameter, which worked only while an id was unique across the
164
+ * config: resolving needs the path, while `showWhen`, `parentField`, `autoPatch` targets
165
+ * and rules are all keyed by bare id and never match a path.
166
+ */
132
167
  private applyRename;
133
- removeField(id: string): void;
168
+ removeField(key: string): void;
134
169
  duplicateField(id: string): string | null;
135
- moveField(id: string, direction: -1 | 1): void;
170
+ moveField(key: string, direction: -1 | 1): void;
136
171
  /**
137
172
  * Moves a field to another tab, keeping its id.
138
173
  *
@@ -160,7 +195,7 @@ declare class BuilderStore {
160
195
  * Only the config's default language drives the id; translating a label must not rename
161
196
  * anything.
162
197
  */
163
- setFieldLabel(id: string, language: string, value: string): void;
198
+ setFieldLabel(key: string, language: string, value: string): void;
164
199
  /** `derived`, or `derived_2`, `derived_3`… if another field already holds it. */
165
200
  private availableId;
166
201
  setFieldPlaceholder(id: string, language: string, value: string): void;