@masterteam/form-builder 0.0.54 → 0.0.56
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.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"directory": "../../../dist/masterteam/form-builder",
|
|
6
6
|
"linkDirectory": true,
|
|
@@ -19,10 +19,9 @@
|
|
|
19
19
|
"rxjs": "^7.8.2",
|
|
20
20
|
"tailwindcss": "^4.2.2",
|
|
21
21
|
"tailwindcss-primeui": "^0.6.1",
|
|
22
|
-
"@masterteam/
|
|
23
|
-
"@masterteam/
|
|
24
|
-
"@masterteam/icons": "^0.0.17"
|
|
25
|
-
"@masterteam/forms": "^0.0.156"
|
|
22
|
+
"@masterteam/components": "^0.0.311",
|
|
23
|
+
"@masterteam/forms": "^0.0.163",
|
|
24
|
+
"@masterteam/icons": "^0.0.17"
|
|
26
25
|
},
|
|
27
26
|
"sideEffects": false,
|
|
28
27
|
"exports": {
|
|
@@ -51,7 +51,14 @@ interface FormField {
|
|
|
51
51
|
_pending?: boolean;
|
|
52
52
|
_deleting?: boolean;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
/**
|
|
55
|
+
* - `builder` — the full editor over a module's form configuration.
|
|
56
|
+
* - `manageProperties` — read/write permissions and size only.
|
|
57
|
+
* - `localFields` — an in-memory field list a host seeds and reads back (see
|
|
58
|
+
* `EnterLocalFormConfiguration`): one section, order / size / required, and
|
|
59
|
+
* nothing is sent to the form-configuration API.
|
|
60
|
+
*/
|
|
61
|
+
type FormBuilderMode = 'builder' | 'manageProperties' | 'localFields';
|
|
55
62
|
interface FormSection {
|
|
56
63
|
id: string;
|
|
57
64
|
name: {
|
|
@@ -202,12 +209,24 @@ interface FormBuilderStateModel extends LoadingStateShape<FormBuilderActionKey>
|
|
|
202
209
|
* moduleId on `ResetFormBuilderState`.
|
|
203
210
|
*/
|
|
204
211
|
contextResolveExtraParams: Record<string, unknown> | null;
|
|
212
|
+
/**
|
|
213
|
+
* Field edits change this state only, never the form-configuration API. Set
|
|
214
|
+
* by `EnterLocalFormConfiguration` for a host that owns the result itself —
|
|
215
|
+
* the Local EntityList field list is the case this exists for.
|
|
216
|
+
*/
|
|
217
|
+
localMode: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* The state a local session set aside, restored by
|
|
220
|
+
* `ExitLocalFormConfiguration`. The store is global, so a host that edits a
|
|
221
|
+
* local field list while a real builder page is loaded must not clobber it.
|
|
222
|
+
*/
|
|
223
|
+
stashedState: Omit<FormBuilderStateModel, 'stashedState'> | null;
|
|
205
224
|
}
|
|
206
225
|
|
|
207
226
|
declare class FormBuilderFacade {
|
|
208
227
|
private readonly store;
|
|
209
228
|
private readonly stateSignal;
|
|
210
|
-
readonly formConfiguration: _angular_core.Signal<
|
|
229
|
+
readonly formConfiguration: _angular_core.Signal<FormConfiguration | null>;
|
|
211
230
|
readonly sections: _angular_core.Signal<_masterteam_form_builder.FormSection[]>;
|
|
212
231
|
readonly properties: _angular_core.Signal<PropertyItem[]>;
|
|
213
232
|
readonly validations: _angular_core.Signal<_masterteam_form_builder.ValidationRule[]>;
|
|
@@ -217,6 +236,8 @@ declare class FormBuilderFacade {
|
|
|
217
236
|
readonly parentModuleId: _angular_core.Signal<string | number | null>;
|
|
218
237
|
readonly parentPath: _angular_core.Signal<string>;
|
|
219
238
|
readonly previewInfo: _angular_core.Signal<PreviewInfo | null>;
|
|
239
|
+
/** True while a host edits a field list in memory; see `enterLocalConfiguration`. */
|
|
240
|
+
readonly localMode: _angular_core.Signal<boolean>;
|
|
220
241
|
readonly contextResolveExtraParams: _angular_core.Signal<Record<string, unknown> | null>;
|
|
221
242
|
readonly isLoadingFormConfiguration: _angular_core.Signal<boolean>;
|
|
222
243
|
readonly isResettingFormConfiguration: _angular_core.Signal<boolean>;
|
|
@@ -241,6 +262,9 @@ declare class FormBuilderFacade {
|
|
|
241
262
|
readonly validationError: _angular_core.Signal<string | null>;
|
|
242
263
|
setModuleInfo(moduleType: string, moduleId: string | number, parentModuleType?: string, parentModuleId?: string | number, parentPath?: string): rxjs.Observable<void>;
|
|
243
264
|
resetState(): rxjs.Observable<void>;
|
|
265
|
+
/** See `EnterLocalFormConfiguration`. Pair every call with `exitLocalConfiguration`. */
|
|
266
|
+
enterLocalConfiguration(formConfiguration: FormConfiguration, properties: PropertyItem[]): rxjs.Observable<void>;
|
|
267
|
+
exitLocalConfiguration(): rxjs.Observable<void>;
|
|
244
268
|
setProperties(properties: PropertyItem[]): rxjs.Observable<void>;
|
|
245
269
|
setPreviewInfo(payload: PreviewInfo): rxjs.Observable<void>;
|
|
246
270
|
/**
|
|
@@ -291,8 +315,15 @@ declare class FormBuilder implements OnInit {
|
|
|
291
315
|
private readonly popovers;
|
|
292
316
|
/** Extra CSS class(es) applied to the main canvas wrapper div. */
|
|
293
317
|
readonly canvasStyleClass: _angular_core.InputSignal<string>;
|
|
294
|
-
/**
|
|
295
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Operating mode: 'builder' (full editor), 'manageProperties' (read/write
|
|
320
|
+
* permissions only) or 'localFields' (a host-owned field list).
|
|
321
|
+
*
|
|
322
|
+
* A missing value means 'builder'. Hosts mount this component straight on a
|
|
323
|
+
* route, and `withComponentInputBinding()` sets every input the route does
|
|
324
|
+
* not supply to `undefined`, which would otherwise hide the whole toolbar.
|
|
325
|
+
*/
|
|
326
|
+
readonly mode: _angular_core.InputSignalWithTransform<FormBuilderMode, FormBuilderMode | null | undefined>;
|
|
296
327
|
/** Controls the draggable properties sidebar independently from the main builder canvas. */
|
|
297
328
|
readonly showPropertiesSection: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
298
329
|
private dialogRef;
|
|
@@ -323,6 +354,12 @@ declare class FormBuilder implements OnInit {
|
|
|
323
354
|
private initialContextStateCleared;
|
|
324
355
|
private readonly contextKey;
|
|
325
356
|
readonly propertiesSectionVisible: _angular_core.Signal<boolean>;
|
|
357
|
+
/**
|
|
358
|
+
* A host-owned field list (see `FormBuilderFacade.enterLocalConfiguration`):
|
|
359
|
+
* the toolbox lists the properties the host seeded instead of resolving a
|
|
360
|
+
* context, and nothing reaches the form-configuration API.
|
|
361
|
+
*/
|
|
362
|
+
readonly isLocalFields: _angular_core.Signal<boolean>;
|
|
326
363
|
private readonly usedPropertyKeys;
|
|
327
364
|
private readonly propertiesMap;
|
|
328
365
|
/** Navigation options from initial context */
|
|
@@ -390,6 +427,8 @@ declare class FormBuilder implements OnInit {
|
|
|
390
427
|
removeScopePath(_scope?: ScopeKey): void;
|
|
391
428
|
/** Template-compatible version (returns properties array for the scope) */
|
|
392
429
|
getScopeProperties(_scope?: ScopeKey): PropertyItem[];
|
|
430
|
+
/** The Current scope's toolbox: the resolved context, or the host's list. */
|
|
431
|
+
private currentScopeProperties;
|
|
393
432
|
getFilteredProperties(_scope?: ScopeKey): PropertyItem[];
|
|
394
433
|
isScopePropertiesLoading(_scope?: ScopeKey): boolean;
|
|
395
434
|
getPropertyLabel(property: PropertyItem): string;
|
|
@@ -441,6 +480,20 @@ declare class SetModuleInfo {
|
|
|
441
480
|
declare class ResetFormBuilderState {
|
|
442
481
|
static readonly type = "[FormBuilder] Reset State";
|
|
443
482
|
}
|
|
483
|
+
/**
|
|
484
|
+
* Start editing a field list in memory: the given configuration and the
|
|
485
|
+
* properties its toolbox offers. Field actions stop calling the API until
|
|
486
|
+
* `ExitLocalFormConfiguration`, which restores whatever was loaded before.
|
|
487
|
+
*/
|
|
488
|
+
declare class EnterLocalFormConfiguration {
|
|
489
|
+
formConfiguration: FormConfiguration;
|
|
490
|
+
properties: PropertyItem[];
|
|
491
|
+
static readonly type = "[FormBuilder] Enter Local Form Configuration";
|
|
492
|
+
constructor(formConfiguration: FormConfiguration, properties: PropertyItem[]);
|
|
493
|
+
}
|
|
494
|
+
declare class ExitLocalFormConfiguration {
|
|
495
|
+
static readonly type = "[FormBuilder] Exit Local Form Configuration";
|
|
496
|
+
}
|
|
444
497
|
declare class SetProperties {
|
|
445
498
|
properties: PropertyItem[];
|
|
446
499
|
static readonly type = "[FormBuilder] Set Properties";
|
|
@@ -568,37 +621,55 @@ declare class FormBuilderState extends CrudStateBase<FormSection, FormBuilderSta
|
|
|
568
621
|
setContextResolveExtraParams(ctx: StateContext<FormBuilderStateModel>, action: SetContextResolveExtraParams): void;
|
|
569
622
|
setProperties(ctx: StateContext<FormBuilderStateModel>, action: SetProperties): void;
|
|
570
623
|
setPreviewInfo(ctx: StateContext<FormBuilderStateModel>, action: SetPreviewInfo): void;
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
624
|
+
/**
|
|
625
|
+
* The store is global, so whatever a real builder page had loaded is set
|
|
626
|
+
* aside rather than overwritten, and comes back on exit. Re-entering while
|
|
627
|
+
* already local keeps the original stash.
|
|
628
|
+
*/
|
|
629
|
+
enterLocalFormConfiguration(ctx: StateContext<FormBuilderStateModel>, action: EnterLocalFormConfiguration): void;
|
|
630
|
+
exitLocalFormConfiguration(ctx: StateContext<FormBuilderStateModel>): void;
|
|
631
|
+
/** Apply `update` to one section's fields, renumbering `order` by position. */
|
|
632
|
+
private patchLocalFields;
|
|
633
|
+
/**
|
|
634
|
+
* A property can sit on the form once, so its key makes a stable id for a
|
|
635
|
+
* field that was never saved anywhere.
|
|
636
|
+
*/
|
|
637
|
+
private addLocalField;
|
|
638
|
+
private updateLocalField;
|
|
639
|
+
private deleteLocalField;
|
|
640
|
+
private reorderLocalFields;
|
|
641
|
+
private moveLocalField;
|
|
642
|
+
getFormConfiguration(ctx: StateContext<FormBuilderStateModel>): rxjs.Observable<Response$1<FormConfiguration>> | undefined;
|
|
643
|
+
resetFormConfiguration(ctx: StateContext<FormBuilderStateModel>): rxjs.Observable<Response$1<FormConfiguration>> | undefined;
|
|
644
|
+
resetFormFromAppForm(ctx: StateContext<FormBuilderStateModel>): rxjs.Observable<Response$1<FormConfiguration>> | undefined;
|
|
574
645
|
updateFormSettings(ctx: StateContext<FormBuilderStateModel>, action: UpdateFormSettings): rxjs.Observable<Response$1<FormConfiguration>> | undefined;
|
|
575
|
-
addSection(ctx: StateContext<FormBuilderStateModel>, action: AddSection): rxjs.Observable<Response$1<FormSection
|
|
576
|
-
updateSection(ctx: StateContext<FormBuilderStateModel>, action: UpdateSection): rxjs.Observable<Response$1<FormSection
|
|
646
|
+
addSection(ctx: StateContext<FormBuilderStateModel>, action: AddSection): rxjs.Observable<Response$1<FormSection>> | undefined;
|
|
647
|
+
updateSection(ctx: StateContext<FormBuilderStateModel>, action: UpdateSection): rxjs.Observable<Response$1<FormSection>> | undefined;
|
|
577
648
|
reorderSections(ctx: StateContext<FormBuilderStateModel>, action: ReorderSections): rxjs.Observable<Response$1<{
|
|
578
649
|
sections: FormSection[];
|
|
579
|
-
}
|
|
650
|
+
}>> | undefined;
|
|
580
651
|
deleteSection(ctx: StateContext<FormBuilderStateModel>, action: DeleteSection): rxjs.Observable<Response$1<{
|
|
581
652
|
id: string;
|
|
582
|
-
}
|
|
583
|
-
addField(ctx: StateContext<FormBuilderStateModel>, action: AddField): rxjs.Observable<Response$1<FormField>>;
|
|
584
|
-
updateField(ctx: StateContext<FormBuilderStateModel>, action: UpdateField): rxjs.Observable<Response$1<FormField>>;
|
|
585
|
-
deleteField(ctx: StateContext<FormBuilderStateModel>, action: DeleteField): rxjs.Observable<Response$1<{
|
|
653
|
+
}>> | undefined;
|
|
654
|
+
addField(ctx: StateContext<FormBuilderStateModel>, action: AddField): void | rxjs.Observable<Response$1<FormField>>;
|
|
655
|
+
updateField(ctx: StateContext<FormBuilderStateModel>, action: UpdateField): void | rxjs.Observable<Response$1<FormField>>;
|
|
656
|
+
deleteField(ctx: StateContext<FormBuilderStateModel>, action: DeleteField): void | rxjs.Observable<Response$1<{
|
|
586
657
|
id: string;
|
|
587
658
|
sectionId: string;
|
|
588
659
|
}>>;
|
|
589
|
-
reorderFields(ctx: StateContext<FormBuilderStateModel>, action: ReorderFields): rxjs.Observable<Response$1<{
|
|
660
|
+
reorderFields(ctx: StateContext<FormBuilderStateModel>, action: ReorderFields): void | rxjs.Observable<Response$1<{
|
|
590
661
|
fields: FormField[];
|
|
591
662
|
}>>;
|
|
592
|
-
moveField(ctx: StateContext<FormBuilderStateModel>, action: MoveField): rxjs.Observable<Response$1<FormField>>;
|
|
593
|
-
addValidation(ctx: StateContext<FormBuilderStateModel>, action: AddValidation): rxjs.Observable<Response$1<ValidationRule
|
|
594
|
-
updateValidation(ctx: StateContext<FormBuilderStateModel>, action: UpdateValidation): rxjs.Observable<Response$1<ValidationRule
|
|
663
|
+
moveField(ctx: StateContext<FormBuilderStateModel>, action: MoveField): void | rxjs.Observable<Response$1<FormField>>;
|
|
664
|
+
addValidation(ctx: StateContext<FormBuilderStateModel>, action: AddValidation): rxjs.Observable<Response$1<ValidationRule>> | undefined;
|
|
665
|
+
updateValidation(ctx: StateContext<FormBuilderStateModel>, action: UpdateValidation): rxjs.Observable<Response$1<ValidationRule>> | undefined;
|
|
595
666
|
deleteValidation(ctx: StateContext<FormBuilderStateModel>, action: DeleteValidation): rxjs.Observable<Response$1<{
|
|
596
667
|
id: string | number;
|
|
597
|
-
}
|
|
598
|
-
toggleValidationActive(ctx: StateContext<FormBuilderStateModel>, action: ToggleValidationActive): rxjs.Observable<Response$1<ValidationRule
|
|
668
|
+
}>> | undefined;
|
|
669
|
+
toggleValidationActive(ctx: StateContext<FormBuilderStateModel>, action: ToggleValidationActive): rxjs.Observable<Response$1<ValidationRule>> | undefined;
|
|
599
670
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilderState, never>;
|
|
600
671
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormBuilderState>;
|
|
601
672
|
}
|
|
602
673
|
|
|
603
|
-
export { AddField, AddSection, AddValidation, DeleteField, DeleteSection, DeleteValidation, FormBuilder, FormBuilderActionKey, FormBuilderFacade, FormBuilderState, GetFormConfiguration, MoveField, ReorderFields, ReorderSections, ResetFormBuilderState, ResetFormConfiguration, ResetFormFromAppForm, SetContextResolveExtraParams, SetModuleInfo, SetPreviewInfo, SetProperties, ToggleValidationActive, UpdateField, UpdateFormSettings, UpdateSection, UpdateValidation };
|
|
674
|
+
export { AddField, AddSection, AddValidation, DeleteField, DeleteSection, DeleteValidation, EnterLocalFormConfiguration, ExitLocalFormConfiguration, FormBuilder, FormBuilderActionKey, FormBuilderFacade, FormBuilderState, GetFormConfiguration, MoveField, ReorderFields, ReorderSections, ResetFormBuilderState, ResetFormConfiguration, ResetFormFromAppForm, SetContextResolveExtraParams, SetModuleInfo, SetPreviewInfo, SetProperties, ToggleValidationActive, UpdateField, UpdateFormSettings, UpdateSection, UpdateValidation };
|
|
604
675
|
export type { AddFieldPayload, AddSectionPayload, AddValidationPayload, EnrichedFormField, EnrichedFormSection, FieldWidth, FormBuilderMode, FormBuilderStateModel, FormConfiguration, FormField, FormRenderMode, FormSection, LocalizedText, MoveFieldPayload, PreviewInfo, PropertyItem, ReorderFieldPayload, ReorderSectionPayload, Response, ToggleValidationPayload, UpdateFieldPayload, UpdateFormSettingsPayload, UpdateSectionPayload, UpdateValidationPayload, ValidationRule, ValidationSeverity };
|