@masterteam/form-builder 0.0.53 → 0.0.55
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.55",
|
|
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/forms": "^0.0.
|
|
24
|
-
"@masterteam/icons": "^0.0.17"
|
|
25
|
-
"@masterteam/components": "^0.0.287"
|
|
22
|
+
"@masterteam/components": "^0.0.302",
|
|
23
|
+
"@masterteam/forms": "^0.0.157",
|
|
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
|
/**
|
|
@@ -323,6 +347,12 @@ declare class FormBuilder implements OnInit {
|
|
|
323
347
|
private initialContextStateCleared;
|
|
324
348
|
private readonly contextKey;
|
|
325
349
|
readonly propertiesSectionVisible: _angular_core.Signal<boolean>;
|
|
350
|
+
/**
|
|
351
|
+
* A host-owned field list (see `FormBuilderFacade.enterLocalConfiguration`):
|
|
352
|
+
* the toolbox lists the properties the host seeded instead of resolving a
|
|
353
|
+
* context, and nothing reaches the form-configuration API.
|
|
354
|
+
*/
|
|
355
|
+
readonly isLocalFields: _angular_core.Signal<boolean>;
|
|
326
356
|
private readonly usedPropertyKeys;
|
|
327
357
|
private readonly propertiesMap;
|
|
328
358
|
/** Navigation options from initial context */
|
|
@@ -390,6 +420,8 @@ declare class FormBuilder implements OnInit {
|
|
|
390
420
|
removeScopePath(_scope?: ScopeKey): void;
|
|
391
421
|
/** Template-compatible version (returns properties array for the scope) */
|
|
392
422
|
getScopeProperties(_scope?: ScopeKey): PropertyItem[];
|
|
423
|
+
/** The Current scope's toolbox: the resolved context, or the host's list. */
|
|
424
|
+
private currentScopeProperties;
|
|
393
425
|
getFilteredProperties(_scope?: ScopeKey): PropertyItem[];
|
|
394
426
|
isScopePropertiesLoading(_scope?: ScopeKey): boolean;
|
|
395
427
|
getPropertyLabel(property: PropertyItem): string;
|
|
@@ -441,6 +473,20 @@ declare class SetModuleInfo {
|
|
|
441
473
|
declare class ResetFormBuilderState {
|
|
442
474
|
static readonly type = "[FormBuilder] Reset State";
|
|
443
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Start editing a field list in memory: the given configuration and the
|
|
478
|
+
* properties its toolbox offers. Field actions stop calling the API until
|
|
479
|
+
* `ExitLocalFormConfiguration`, which restores whatever was loaded before.
|
|
480
|
+
*/
|
|
481
|
+
declare class EnterLocalFormConfiguration {
|
|
482
|
+
formConfiguration: FormConfiguration;
|
|
483
|
+
properties: PropertyItem[];
|
|
484
|
+
static readonly type = "[FormBuilder] Enter Local Form Configuration";
|
|
485
|
+
constructor(formConfiguration: FormConfiguration, properties: PropertyItem[]);
|
|
486
|
+
}
|
|
487
|
+
declare class ExitLocalFormConfiguration {
|
|
488
|
+
static readonly type = "[FormBuilder] Exit Local Form Configuration";
|
|
489
|
+
}
|
|
444
490
|
declare class SetProperties {
|
|
445
491
|
properties: PropertyItem[];
|
|
446
492
|
static readonly type = "[FormBuilder] Set Properties";
|
|
@@ -568,37 +614,55 @@ declare class FormBuilderState extends CrudStateBase<FormSection, FormBuilderSta
|
|
|
568
614
|
setContextResolveExtraParams(ctx: StateContext<FormBuilderStateModel>, action: SetContextResolveExtraParams): void;
|
|
569
615
|
setProperties(ctx: StateContext<FormBuilderStateModel>, action: SetProperties): void;
|
|
570
616
|
setPreviewInfo(ctx: StateContext<FormBuilderStateModel>, action: SetPreviewInfo): void;
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
617
|
+
/**
|
|
618
|
+
* The store is global, so whatever a real builder page had loaded is set
|
|
619
|
+
* aside rather than overwritten, and comes back on exit. Re-entering while
|
|
620
|
+
* already local keeps the original stash.
|
|
621
|
+
*/
|
|
622
|
+
enterLocalFormConfiguration(ctx: StateContext<FormBuilderStateModel>, action: EnterLocalFormConfiguration): void;
|
|
623
|
+
exitLocalFormConfiguration(ctx: StateContext<FormBuilderStateModel>): void;
|
|
624
|
+
/** Apply `update` to one section's fields, renumbering `order` by position. */
|
|
625
|
+
private patchLocalFields;
|
|
626
|
+
/**
|
|
627
|
+
* A property can sit on the form once, so its key makes a stable id for a
|
|
628
|
+
* field that was never saved anywhere.
|
|
629
|
+
*/
|
|
630
|
+
private addLocalField;
|
|
631
|
+
private updateLocalField;
|
|
632
|
+
private deleteLocalField;
|
|
633
|
+
private reorderLocalFields;
|
|
634
|
+
private moveLocalField;
|
|
635
|
+
getFormConfiguration(ctx: StateContext<FormBuilderStateModel>): rxjs.Observable<Response$1<FormConfiguration>> | undefined;
|
|
636
|
+
resetFormConfiguration(ctx: StateContext<FormBuilderStateModel>): rxjs.Observable<Response$1<FormConfiguration>> | undefined;
|
|
637
|
+
resetFormFromAppForm(ctx: StateContext<FormBuilderStateModel>): rxjs.Observable<Response$1<FormConfiguration>> | undefined;
|
|
574
638
|
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
|
|
639
|
+
addSection(ctx: StateContext<FormBuilderStateModel>, action: AddSection): rxjs.Observable<Response$1<FormSection>> | undefined;
|
|
640
|
+
updateSection(ctx: StateContext<FormBuilderStateModel>, action: UpdateSection): rxjs.Observable<Response$1<FormSection>> | undefined;
|
|
577
641
|
reorderSections(ctx: StateContext<FormBuilderStateModel>, action: ReorderSections): rxjs.Observable<Response$1<{
|
|
578
642
|
sections: FormSection[];
|
|
579
|
-
}
|
|
643
|
+
}>> | undefined;
|
|
580
644
|
deleteSection(ctx: StateContext<FormBuilderStateModel>, action: DeleteSection): rxjs.Observable<Response$1<{
|
|
581
645
|
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<{
|
|
646
|
+
}>> | undefined;
|
|
647
|
+
addField(ctx: StateContext<FormBuilderStateModel>, action: AddField): void | rxjs.Observable<Response$1<FormField>>;
|
|
648
|
+
updateField(ctx: StateContext<FormBuilderStateModel>, action: UpdateField): void | rxjs.Observable<Response$1<FormField>>;
|
|
649
|
+
deleteField(ctx: StateContext<FormBuilderStateModel>, action: DeleteField): void | rxjs.Observable<Response$1<{
|
|
586
650
|
id: string;
|
|
587
651
|
sectionId: string;
|
|
588
652
|
}>>;
|
|
589
|
-
reorderFields(ctx: StateContext<FormBuilderStateModel>, action: ReorderFields): rxjs.Observable<Response$1<{
|
|
653
|
+
reorderFields(ctx: StateContext<FormBuilderStateModel>, action: ReorderFields): void | rxjs.Observable<Response$1<{
|
|
590
654
|
fields: FormField[];
|
|
591
655
|
}>>;
|
|
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
|
|
656
|
+
moveField(ctx: StateContext<FormBuilderStateModel>, action: MoveField): void | rxjs.Observable<Response$1<FormField>>;
|
|
657
|
+
addValidation(ctx: StateContext<FormBuilderStateModel>, action: AddValidation): rxjs.Observable<Response$1<ValidationRule>> | undefined;
|
|
658
|
+
updateValidation(ctx: StateContext<FormBuilderStateModel>, action: UpdateValidation): rxjs.Observable<Response$1<ValidationRule>> | undefined;
|
|
595
659
|
deleteValidation(ctx: StateContext<FormBuilderStateModel>, action: DeleteValidation): rxjs.Observable<Response$1<{
|
|
596
660
|
id: string | number;
|
|
597
|
-
}
|
|
598
|
-
toggleValidationActive(ctx: StateContext<FormBuilderStateModel>, action: ToggleValidationActive): rxjs.Observable<Response$1<ValidationRule
|
|
661
|
+
}>> | undefined;
|
|
662
|
+
toggleValidationActive(ctx: StateContext<FormBuilderStateModel>, action: ToggleValidationActive): rxjs.Observable<Response$1<ValidationRule>> | undefined;
|
|
599
663
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilderState, never>;
|
|
600
664
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormBuilderState>;
|
|
601
665
|
}
|
|
602
666
|
|
|
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 };
|
|
667
|
+
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
668
|
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 };
|