@masterteam/form-builder 0.0.7 → 0.0.9

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": "@masterteam/form-builder",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/form-builder",
6
6
  "linkDirectory": true,
@@ -19,10 +19,10 @@
19
19
  "rxjs": "^7.8.2",
20
20
  "tailwindcss": "^4.1.17",
21
21
  "tailwindcss-primeui": "^0.6.1",
22
- "@masterteam/properties": "^0.0.29",
23
- "@masterteam/components": "^0.0.81",
24
- "@masterteam/forms": "^0.0.35",
25
- "@masterteam/icons": "^0.0.12"
22
+ "@masterteam/properties": "^0.0.31",
23
+ "@masterteam/icons": "^0.0.13",
24
+ "@masterteam/components": "^0.0.90",
25
+ "@masterteam/forms": "^0.0.36"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "exports": {
@@ -1,5 +1,6 @@
1
1
  import * as _masterteam_form_builder from '@masterteam/form-builder';
2
2
  import * as _angular_core from '@angular/core';
3
+ import { OnInit } from '@angular/core';
3
4
  import { LoadingStateShape, CrudStateBase, Response as Response$1 } from '@masterteam/components';
4
5
  import { CdkDragDrop } from '@angular/cdk/drag-drop';
5
6
  import * as rxjs from 'rxjs';
@@ -25,17 +26,21 @@ type FieldWidth = '25' | '50' | '100';
25
26
  interface FormField {
26
27
  id: string;
27
28
  sectionId: string;
28
- propertyId: number;
29
+ propertyKey: string;
30
+ property?: PropertyItem;
29
31
  width: FieldWidth;
30
32
  order: number;
31
33
  hiddenInCreation?: boolean;
32
34
  hiddenInEditForm?: boolean;
33
35
  isRequired?: boolean;
36
+ isRead?: boolean;
37
+ isWrite?: boolean;
34
38
  showConditionalDisplayFormula?: boolean;
35
39
  conditionalDisplayFormula?: string;
36
40
  _pending?: boolean;
37
41
  _deleting?: boolean;
38
42
  }
43
+ type FormBuilderMode = 'builder' | 'manageProperties';
39
44
  interface FormSection {
40
45
  id: string;
41
46
  name: {
@@ -77,12 +82,14 @@ interface UpdateSectionPayload {
77
82
  order?: number;
78
83
  }
79
84
  interface AddFieldPayload {
80
- propertyId: number;
85
+ propertyKey: string;
81
86
  width: FieldWidth;
82
87
  order?: number;
83
88
  hiddenInCreation?: boolean;
84
89
  hiddenInEditForm?: boolean;
85
90
  isRequired?: boolean;
91
+ isRead?: boolean;
92
+ isWrite?: boolean;
86
93
  showConditionalDisplayFormula?: boolean;
87
94
  conditionalDisplayFormula?: string;
88
95
  }
@@ -92,6 +99,8 @@ interface UpdateFieldPayload {
92
99
  hiddenInCreation?: boolean;
93
100
  hiddenInEditForm?: boolean;
94
101
  isRequired?: boolean;
102
+ isRead?: boolean;
103
+ isWrite?: boolean;
95
104
  showConditionalDisplayFormula?: boolean;
96
105
  conditionalDisplayFormula?: string | null;
97
106
  }
@@ -125,7 +134,8 @@ interface ToggleValidationPayload {
125
134
  enabled: boolean;
126
135
  }
127
136
  interface PropertyItem {
128
- id: number;
137
+ key: string;
138
+ propertyId?: number;
129
139
  name: string | Record<string, string>;
130
140
  viewType?: string;
131
141
  [key: string]: any;
@@ -157,6 +167,9 @@ declare class FormBuilderFacade {
157
167
  readonly validations: _angular_core.Signal<_masterteam_form_builder.ValidationRule[]>;
158
168
  readonly moduleType: _angular_core.Signal<string | null>;
159
169
  readonly moduleId: _angular_core.Signal<string | number | null>;
170
+ readonly parentModuleType: _angular_core.Signal<string | null>;
171
+ readonly parentModuleId: _angular_core.Signal<string | number | null>;
172
+ readonly parentPath: _angular_core.Signal<string>;
160
173
  readonly isLoadingFormConfiguration: _angular_core.Signal<boolean>;
161
174
  readonly isResettingFormConfiguration: _angular_core.Signal<boolean>;
162
175
  readonly isAddingSection: _angular_core.Signal<boolean>;
@@ -195,31 +208,107 @@ declare class FormBuilderFacade {
195
208
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormBuilderFacade>;
196
209
  }
197
210
 
198
- declare class FormBuilder {
211
+ type ScopeKey = 'Current' | 'Host' | 'Parent' | 'Ancestors' | 'Children' | 'Descendants' | 'Related' | 'Siblings';
212
+ type PathToken = Exclude<ScopeKey, 'Current'>;
213
+ interface ContextOption {
214
+ contextKey: string;
215
+ label: string;
216
+ }
217
+ interface PathSegment {
218
+ token: PathToken;
219
+ value: string;
220
+ label: string;
221
+ }
222
+ declare class FormBuilder implements OnInit {
199
223
  private readonly modalService;
200
224
  private readonly confirmationService;
201
225
  private readonly translocoService;
202
226
  protected readonly facade: FormBuilderFacade;
227
+ private readonly contextService;
228
+ private readonly popovers;
229
+ /** Extra CSS class(es) applied to the main canvas wrapper div. */
230
+ readonly canvasStyleClass: _angular_core.InputSignal<string>;
231
+ /** Operating mode: 'builder' (full editor) or 'manageProperties' (read/write permissions only). */
232
+ readonly mode: _angular_core.InputSignal<FormBuilderMode>;
203
233
  private dialogRef;
204
- readonly activeTab: _angular_core.WritableSignal<string>;
205
- readonly searchQuery: _angular_core.WritableSignal<string>;
206
234
  readonly sections: _angular_core.Signal<_masterteam_form_builder.FormSection[]>;
207
235
  readonly properties: _angular_core.Signal<PropertyItem[]>;
208
236
  readonly isLoading: _angular_core.Signal<boolean>;
209
237
  readonly error: _angular_core.Signal<string | null>;
238
+ readonly moduleType: _angular_core.Signal<string | null>;
239
+ readonly moduleId: _angular_core.Signal<string | number | null>;
240
+ readonly parentPath: _angular_core.Signal<string>;
241
+ readonly activeScope: _angular_core.WritableSignal<ScopeKey>;
242
+ readonly searchQuery: _angular_core.WritableSignal<string>;
243
+ readonly isContextLoading: _angular_core.WritableSignal<boolean>;
244
+ private readonly initialContext;
245
+ private readonly currentProperties;
246
+ readonly scopeLoading: _angular_core.WritableSignal<boolean>;
247
+ readonly scopeProperties: _angular_core.WritableSignal<PropertyItem[]>;
248
+ readonly scopePath: _angular_core.WritableSignal<PathSegment[]>;
249
+ readonly scopeSelectedKey: _angular_core.WritableSignal<string>;
250
+ private scopeNavigation;
251
+ private initialRequestId;
252
+ private scopeRequestId;
253
+ private lastContextKey;
254
+ private readonly contextKey;
255
+ private readonly usedPropertyKeys;
210
256
  private readonly propertiesMap;
211
- readonly enrichedSections: _angular_core.Signal<EnrichedFormSection[]>;
212
- readonly availableTabs: _angular_core.Signal<{
213
- id: string;
214
- title: string;
215
- properties: PropertyItem[];
216
- }[]>;
217
- readonly filteredPropertiesByTab: _angular_core.Signal<{
218
- id: string;
219
- title: string;
220
- properties: PropertyItem[];
257
+ /** Navigation options from initial context */
258
+ readonly baseScopeContexts: _angular_core.Signal<Record<ScopeKey, ContextOption[]>>;
259
+ /** Available scope tabs */
260
+ readonly scopeOptions: _angular_core.Signal<{
261
+ key: ScopeKey;
262
+ label: string;
221
263
  }[]>;
264
+ /** Enriched sections for display */
265
+ readonly enrichedSections: _angular_core.Signal<EnrichedFormSection[]>;
222
266
  constructor();
267
+ ngOnInit(): void;
268
+ private loadInitialContext;
269
+ onScopeChange(scope: ScopeKey): void;
270
+ private loadScopeContext;
271
+ private resetScopeState;
272
+ getScopeBaseContexts(scope: ScopeKey): ContextOption[];
273
+ /** Template calls this with scope.key */
274
+ getScopePath(_scope?: ScopeKey): PathSegment[];
275
+ getTokenLabel(token: PathToken): string;
276
+ getScopeSegmentLabel(_scope: ScopeKey, index: number): string;
277
+ getScopeSegmentOptions(_scope: ScopeKey, index: number): ContextOption[];
278
+ setScopeSegmentValue(_scope: ScopeKey, index: number, contextKey: string, label?: string): void;
279
+ private findOptionLabel;
280
+ /** Template handler: hide popover first, then set value (like formula-builder) */
281
+ onSetScopeSegmentValue(scope: ScopeKey, index: number, contextKey: string, popover: {
282
+ hide: () => void;
283
+ }): void;
284
+ addScopeSegment(_scope: ScopeKey, token: PathToken): void;
285
+ /** Template handler: hide popover first, then add segment (like formula-builder) */
286
+ onAddScopeSegment(scope: ScopeKey, token: PathToken, popover: {
287
+ hide: () => void;
288
+ }): void;
289
+ getScopeNextTokens(_scope?: ScopeKey): PathToken[];
290
+ canAddNextScopeSegment(_scope?: ScopeKey): boolean;
291
+ canRemoveScopePath(_scope?: ScopeKey): boolean;
292
+ removeScopePath(_scope?: ScopeKey): void;
293
+ /** Template-compatible version (returns properties array for the scope) */
294
+ getScopeProperties(_scope?: ScopeKey): PropertyItem[];
295
+ getScopePropertyOptions(_scope?: ScopeKey): Array<{
296
+ key: string;
297
+ name: string;
298
+ }>;
299
+ getScopeSelectedPropertyKey(_scope?: ScopeKey): string;
300
+ setScopeSelectedProperty(_scope: ScopeKey, key: string): void;
301
+ getScopeSelectedProperty(_scope?: ScopeKey): PropertyItem | null;
302
+ getFilteredProperties(_scope?: ScopeKey): PropertyItem[];
303
+ isScopePropertiesLoading(_scope?: ScopeKey): boolean;
304
+ getPropertyLabel(property: PropertyItem): string;
305
+ private hideAllPopovers;
306
+ private getNavigationOptionsByToken;
307
+ private resolvePropertyName;
308
+ private createContextOption;
309
+ private formatContextLabel;
310
+ private formatContextKey;
311
+ private mergeContextOptions;
223
312
  drop(event: CdkDragDrop<EnrichedFormField[] | PropertyItem[]>): void;
224
313
  addSection(): void;
225
314
  openPreview(): void;
@@ -227,7 +316,7 @@ declare class FormBuilder {
227
316
  resetFormConfiguration(): void;
228
317
  noReturnPredicate: () => boolean;
229
318
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilder, never>;
230
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormBuilder, "mt-form-builder", never, {}, {}, never, never, true, never>;
319
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormBuilder, "mt-form-builder", never, { "canvasStyleClass": { "alias": "canvasStyleClass"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
231
320
  }
232
321
 
233
322
  /**
@@ -347,6 +436,9 @@ declare class FormBuilderState extends CrudStateBase<FormSection, FormBuilderSta
347
436
  static getSections(state: FormBuilderStateModel): FormSection[];
348
437
  static getModuleType(state: FormBuilderStateModel): string | null;
349
438
  static getModuleId(state: FormBuilderStateModel): string | number | null;
439
+ static getParentModuleType(state: FormBuilderStateModel): string | null;
440
+ static getParentModuleId(state: FormBuilderStateModel): string | number | null;
441
+ static getParentPath(state: FormBuilderStateModel): string;
350
442
  static getProperties(state: FormBuilderStateModel): _masterteam_form_builder.PropertyItem[];
351
443
  static getValidations(state: FormBuilderStateModel): ValidationRule[];
352
444
  setModuleInfo(ctx: StateContext<FormBuilderStateModel>, action: SetModuleInfo): void;
@@ -380,4 +472,4 @@ declare class FormBuilderState extends CrudStateBase<FormSection, FormBuilderSta
380
472
  }
381
473
 
382
474
  export { AddField, AddSection, AddValidation, DeleteField, DeleteSection, DeleteValidation, FormBuilder, FormBuilderActionKey, FormBuilderFacade, FormBuilderState, GetFormConfiguration, MoveField, ReorderFields, ResetFormBuilderState, ResetFormConfiguration, SetModuleInfo, SetProperties, ToggleValidationActive, UpdateField, UpdateSection, UpdateValidation };
383
- export type { AddFieldPayload, AddSectionPayload, AddValidationPayload, EnrichedFormField, EnrichedFormSection, FieldWidth, FormBuilderStateModel, FormConfiguration, FormField, FormSection, MoveFieldPayload, PropertyItem, ReorderFieldPayload, Response, ToggleValidationPayload, UpdateFieldPayload, UpdateSectionPayload, UpdateValidationPayload, ValidationRule, ValidationSeverity };
475
+ export type { AddFieldPayload, AddSectionPayload, AddValidationPayload, EnrichedFormField, EnrichedFormSection, FieldWidth, FormBuilderMode, FormBuilderStateModel, FormConfiguration, FormField, FormSection, MoveFieldPayload, PropertyItem, ReorderFieldPayload, Response, ToggleValidationPayload, UpdateFieldPayload, UpdateSectionPayload, UpdateValidationPayload, ValidationRule, ValidationSeverity };