@masterteam/forms 0.0.51 → 0.0.53
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/assets/forms.css +1 -1
- package/fesm2022/masterteam-forms-client-form.mjs +128 -15
- package/fesm2022/masterteam-forms-client-form.mjs.map +1 -1
- package/fesm2022/masterteam-forms-dynamic-field.mjs +8 -4
- package/fesm2022/masterteam-forms-dynamic-field.mjs.map +1 -1
- package/fesm2022/masterteam-forms-dynamic-form.mjs +2 -2
- package/fesm2022/masterteam-forms-dynamic-form.mjs.map +1 -1
- package/package.json +2 -2
- package/types/masterteam-forms-client-form.d.ts +69 -20
|
@@ -23,13 +23,30 @@ type ProcessFormMode = 'Approval' | 'Direct';
|
|
|
23
23
|
type ProcessFormSubmitStatus = 'PendingApproval' | 'Executed';
|
|
24
24
|
type OperationType = 'FormOperation' | 'ActionOperation';
|
|
25
25
|
type ProcessFormSource = 'Step' | 'None';
|
|
26
|
+
type ClientFormResolvedRenderMode = 'form' | 'steps' | 'tabs';
|
|
27
|
+
type ClientFormFooterActionMode = 'loading' | 'steps' | 'submit';
|
|
28
|
+
interface ClientFormFooterState {
|
|
29
|
+
loading: boolean;
|
|
30
|
+
isLoaded: boolean;
|
|
31
|
+
renderMode: ClientFormResolvedRenderMode;
|
|
32
|
+
actionMode: ClientFormFooterActionMode;
|
|
33
|
+
stepNavigationEnabled: boolean;
|
|
34
|
+
sectionNavigationEnabled: boolean;
|
|
35
|
+
currentStep: number;
|
|
36
|
+
stepCount: number;
|
|
37
|
+
canGoToPreviousStep: boolean;
|
|
38
|
+
canGoToNextStep: boolean;
|
|
39
|
+
showPreviousStep: boolean;
|
|
40
|
+
showNextStep: boolean;
|
|
41
|
+
showSubmit: boolean;
|
|
42
|
+
}
|
|
26
43
|
interface ProcessFormLoadRequest {
|
|
27
44
|
moduleKey: string;
|
|
28
45
|
operationKey: string;
|
|
29
|
-
moduleId?: number;
|
|
30
|
-
levelId?: number;
|
|
31
|
-
levelDataId?: number;
|
|
32
|
-
moduleDataId?: number;
|
|
46
|
+
moduleId?: number | string;
|
|
47
|
+
levelId?: number | string;
|
|
48
|
+
levelDataId?: number | string;
|
|
49
|
+
moduleDataId?: number | string;
|
|
33
50
|
requestSchemaId?: number;
|
|
34
51
|
draftProcessId?: number;
|
|
35
52
|
preview?: boolean;
|
|
@@ -50,15 +67,20 @@ interface ProcessFormLoadResponse {
|
|
|
50
67
|
interface ProcessFormSubmitRequest {
|
|
51
68
|
moduleKey: string;
|
|
52
69
|
operationKey: string;
|
|
53
|
-
moduleId?: number;
|
|
54
|
-
levelId?: number;
|
|
55
|
-
levelDataId?: number;
|
|
56
|
-
moduleDataId?: number;
|
|
57
|
-
recordId?: number;
|
|
70
|
+
moduleId?: number | string;
|
|
71
|
+
levelId?: number | string;
|
|
72
|
+
levelDataId?: number | string;
|
|
73
|
+
moduleDataId?: number | string;
|
|
74
|
+
recordId?: number | string;
|
|
58
75
|
requestSchemaId?: number;
|
|
59
76
|
returnUrl?: string;
|
|
60
77
|
fields: ProcessFormSubmitField[];
|
|
61
78
|
}
|
|
79
|
+
interface ClientFormSubmitRequestMapperContext {
|
|
80
|
+
formValue: Record<string, any>;
|
|
81
|
+
loadResponse: ProcessFormLoadResponse;
|
|
82
|
+
}
|
|
83
|
+
type ClientFormSubmitRequestMapper = (request: ProcessFormSubmitRequest, context: ClientFormSubmitRequestMapperContext) => ProcessFormSubmitRequest;
|
|
62
84
|
interface ProcessFormSubmitField {
|
|
63
85
|
requestPropertyId?: number;
|
|
64
86
|
propertyKey: string;
|
|
@@ -157,6 +179,7 @@ interface ClientFormField {
|
|
|
157
179
|
interface ClientPropertyItem {
|
|
158
180
|
key: string;
|
|
159
181
|
propertyId?: number;
|
|
182
|
+
isCalculated?: boolean;
|
|
160
183
|
name: string | {
|
|
161
184
|
display?: string;
|
|
162
185
|
en?: string;
|
|
@@ -266,13 +289,26 @@ declare class ClientFormStateService {
|
|
|
266
289
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<ClientFormStateService>;
|
|
267
290
|
}
|
|
268
291
|
|
|
292
|
+
type StepTimelineState = 'completed' | 'current' | 'upcoming';
|
|
293
|
+
interface StepTimelineItem {
|
|
294
|
+
key: string;
|
|
295
|
+
label: string;
|
|
296
|
+
value: number;
|
|
297
|
+
state: StepTimelineState;
|
|
298
|
+
selected: boolean;
|
|
299
|
+
beforeLineActive: boolean;
|
|
300
|
+
afterLineActive: boolean;
|
|
301
|
+
}
|
|
269
302
|
/**
|
|
270
303
|
* Client Form — Runtime process form component.
|
|
271
304
|
*
|
|
272
305
|
* Self-contained, signal-based (no NGXS). Each instance manages its own state
|
|
273
306
|
* via a component-scoped `ClientFormStateService`.
|
|
274
307
|
*
|
|
275
|
-
*
|
|
308
|
+
* Submit and reset actions stay external. Step navigation buttons are optional
|
|
309
|
+
* and can be hidden with `showInternalStepActions`.
|
|
310
|
+
*
|
|
311
|
+
* Parent can control actions via `viewChild()`:
|
|
276
312
|
*
|
|
277
313
|
* ```html
|
|
278
314
|
* <mt-client-form #processForm [moduleKey]="'Risk'" [operationKey]="'CloseRisk'" />
|
|
@@ -292,7 +328,9 @@ declare class ClientForm implements OnDestroy {
|
|
|
292
328
|
protected readonly state: ClientFormStateService;
|
|
293
329
|
private loadSub?;
|
|
294
330
|
private submitSub?;
|
|
331
|
+
private readonly hasStartedLoad;
|
|
295
332
|
readonly runtimeMessages: _angular_core.WritableSignal<FormulaRuntimeMessage[]>;
|
|
333
|
+
private readonly translocoService;
|
|
296
334
|
readonly submitting: _angular_core.Signal<boolean>;
|
|
297
335
|
readonly submitError: _angular_core.Signal<string | null>;
|
|
298
336
|
readonly isSubmitted: _angular_core.Signal<boolean>;
|
|
@@ -305,27 +343,30 @@ declare class ClientForm implements OnDestroy {
|
|
|
305
343
|
readonly currentStep: _angular_core.WritableSignal<number>;
|
|
306
344
|
readonly moduleKey: _angular_core.InputSignal<string>;
|
|
307
345
|
readonly operationKey: _angular_core.InputSignal<string>;
|
|
308
|
-
readonly moduleId: _angular_core.InputSignal<number | undefined>;
|
|
309
|
-
readonly levelId: _angular_core.InputSignal<number | undefined>;
|
|
310
|
-
readonly levelDataId: _angular_core.InputSignal<number | undefined>;
|
|
311
|
-
readonly moduleDataId: _angular_core.InputSignal<number | undefined>;
|
|
346
|
+
readonly moduleId: _angular_core.InputSignal<string | number | undefined>;
|
|
347
|
+
readonly levelId: _angular_core.InputSignal<string | number | undefined>;
|
|
348
|
+
readonly levelDataId: _angular_core.InputSignal<string | number | undefined>;
|
|
349
|
+
readonly moduleDataId: _angular_core.InputSignal<string | number | undefined>;
|
|
312
350
|
readonly requestSchemaId: _angular_core.InputSignal<number | undefined>;
|
|
313
351
|
readonly draftProcessId: _angular_core.InputSignal<number | undefined>;
|
|
314
352
|
readonly preview: _angular_core.InputSignal<boolean>;
|
|
315
353
|
readonly returnUrl: _angular_core.InputSignal<string | undefined>;
|
|
354
|
+
readonly submitRequestMapper: _angular_core.InputSignal<ClientFormSubmitRequestMapper | null>;
|
|
316
355
|
readonly readonly: _angular_core.InputSignal<boolean>;
|
|
317
356
|
readonly autoLoad: _angular_core.InputSignal<boolean>;
|
|
318
357
|
readonly formMode: _angular_core.InputSignal<"create" | "edit">;
|
|
319
|
-
readonly renderMode: _angular_core.InputSignal<"
|
|
358
|
+
readonly renderMode: _angular_core.InputSignal<"form" | "steps" | "tabs" | undefined>;
|
|
320
359
|
readonly showInternalStepActions: _angular_core.InputSignal<boolean>;
|
|
321
|
-
readonly lang: _angular_core.
|
|
360
|
+
readonly lang: _angular_core.WritableSignal<"en" | "ar">;
|
|
322
361
|
readonly lookups: _angular_core.InputSignal<ClientLookup[]>;
|
|
323
362
|
readonly ignoredFieldKeys: _angular_core.InputSignal<string[]>;
|
|
363
|
+
readonly rtl: _angular_core.Signal<boolean>;
|
|
324
364
|
readonly loaded: _angular_core.OutputEmitterRef<ProcessFormLoadResponse>;
|
|
325
365
|
readonly submitted: _angular_core.OutputEmitterRef<ProcessFormSubmitResponse>;
|
|
326
366
|
readonly errored: _angular_core.OutputEmitterRef<string>;
|
|
327
367
|
readonly modeDetected: _angular_core.OutputEmitterRef<ProcessFormMode>;
|
|
328
368
|
readonly formSourceDetected: _angular_core.OutputEmitterRef<ProcessFormSource>;
|
|
369
|
+
readonly footerStateChanged: _angular_core.OutputEmitterRef<ClientFormFooterState>;
|
|
329
370
|
readonly formControl: FormControl<Record<string, any> | null>;
|
|
330
371
|
readonly formConfig: _angular_core.Signal<DynamicFormConfig | null>;
|
|
331
372
|
readonly initialValues: _angular_core.Signal<Record<string, any>>;
|
|
@@ -336,14 +377,17 @@ declare class ClientForm implements OnDestroy {
|
|
|
336
377
|
readonly editableFormConfig: _angular_core.Signal<DynamicFormConfig | null>;
|
|
337
378
|
readonly stepSections: _angular_core.Signal<_masterteam_components.SectionConfig[]>;
|
|
338
379
|
readonly hasEditableFormSections: _angular_core.Signal<boolean>;
|
|
339
|
-
readonly effectiveRenderMode: _angular_core.Signal<"
|
|
380
|
+
readonly effectiveRenderMode: _angular_core.Signal<"form" | "steps" | "tabs">;
|
|
340
381
|
readonly stepsEnabled: _angular_core.Signal<boolean>;
|
|
341
382
|
readonly tabsEnabled: _angular_core.Signal<boolean>;
|
|
342
383
|
readonly sectionNavigationEnabled: _angular_core.Signal<boolean>;
|
|
343
384
|
readonly tabOptions: _angular_core.Signal<OptionItem[]>;
|
|
385
|
+
readonly stepTimeline: _angular_core.Signal<StepTimelineItem[]>;
|
|
344
386
|
readonly visibleSectionKeys: _angular_core.Signal<string[] | null>;
|
|
345
387
|
readonly forcedHiddenFieldKeys: _angular_core.Signal<string[]>;
|
|
346
388
|
readonly effectiveForcedHiddenFieldKeys: _angular_core.Signal<string[]>;
|
|
389
|
+
readonly footerLoading: _angular_core.Signal<boolean>;
|
|
390
|
+
readonly footerState: _angular_core.Signal<ClientFormFooterState>;
|
|
347
391
|
constructor();
|
|
348
392
|
/**
|
|
349
393
|
* Load form configuration from the API.
|
|
@@ -384,11 +428,16 @@ declare class ClientForm implements OnDestroy {
|
|
|
384
428
|
getCurrentStep(): number;
|
|
385
429
|
getStepCount(): number;
|
|
386
430
|
isStepNavigationEnabled(): boolean;
|
|
431
|
+
isSectionNavigationEnabled(): boolean;
|
|
432
|
+
isFooterLoading(): boolean;
|
|
433
|
+
getResolvedRenderMode(): ClientFormResolvedRenderMode;
|
|
434
|
+
getFooterState(): ClientFormFooterState;
|
|
387
435
|
ngOnDestroy(): void;
|
|
388
436
|
private buildLoadRequest;
|
|
389
437
|
private buildSubmitRequest;
|
|
438
|
+
private resolveStepTimelineState;
|
|
390
439
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientForm, never>;
|
|
391
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClientForm, "mt-client-form", never, { "moduleKey": { "alias": "moduleKey"; "required": true; "isSignal": true; }; "operationKey": { "alias": "operationKey"; "required": true; "isSignal": true; }; "moduleId": { "alias": "moduleId"; "required": false; "isSignal": true; }; "levelId": { "alias": "levelId"; "required": false; "isSignal": true; }; "levelDataId": { "alias": "levelDataId"; "required": false; "isSignal": true; }; "moduleDataId": { "alias": "moduleDataId"; "required": false; "isSignal": true; }; "requestSchemaId": { "alias": "requestSchemaId"; "required": false; "isSignal": true; }; "draftProcessId": { "alias": "draftProcessId"; "required": false; "isSignal": true; }; "preview": { "alias": "preview"; "required": false; "isSignal": true; }; "returnUrl": { "alias": "returnUrl"; "required": false; "isSignal": true; }; "
|
|
440
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<ClientForm, "mt-client-form", never, { "moduleKey": { "alias": "moduleKey"; "required": true; "isSignal": true; }; "operationKey": { "alias": "operationKey"; "required": true; "isSignal": true; }; "moduleId": { "alias": "moduleId"; "required": false; "isSignal": true; }; "levelId": { "alias": "levelId"; "required": false; "isSignal": true; }; "levelDataId": { "alias": "levelDataId"; "required": false; "isSignal": true; }; "moduleDataId": { "alias": "moduleDataId"; "required": false; "isSignal": true; }; "requestSchemaId": { "alias": "requestSchemaId"; "required": false; "isSignal": true; }; "draftProcessId": { "alias": "draftProcessId"; "required": false; "isSignal": true; }; "preview": { "alias": "preview"; "required": false; "isSignal": true; }; "returnUrl": { "alias": "returnUrl"; "required": false; "isSignal": true; }; "submitRequestMapper": { "alias": "submitRequestMapper"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "autoLoad": { "alias": "autoLoad"; "required": false; "isSignal": true; }; "formMode": { "alias": "formMode"; "required": false; "isSignal": true; }; "renderMode": { "alias": "renderMode"; "required": false; "isSignal": true; }; "showInternalStepActions": { "alias": "showInternalStepActions"; "required": false; "isSignal": true; }; "lookups": { "alias": "lookups"; "required": false; "isSignal": true; }; "ignoredFieldKeys": { "alias": "ignoredFieldKeys"; "required": false; "isSignal": true; }; }, { "loaded": "loaded"; "submitted": "submitted"; "errored": "errored"; "modeDetected": "modeDetected"; "formSourceDetected": "formSourceDetected"; "footerStateChanged": "footerStateChanged"; }, never, never, true, never>;
|
|
392
441
|
}
|
|
393
442
|
|
|
394
443
|
/**
|
|
@@ -421,7 +470,7 @@ declare class ClientFormApiService {
|
|
|
421
470
|
* @param mode 'create' or 'edit' — filters hidden fields accordingly
|
|
422
471
|
* @param lookups Available lookup definitions for resolving Lookup/LookupMultiSelect options
|
|
423
472
|
*/
|
|
424
|
-
declare function mapToDynamicFormConfig(config: ClientFormConfiguration, lang?: 'en' | 'ar', mode?: 'create' | 'edit', lookups?: ClientLookup[]): DynamicFormConfig;
|
|
473
|
+
declare function mapToDynamicFormConfig(config: ClientFormConfiguration, lang?: 'en' | 'ar', mode?: 'create' | 'edit', lookups?: ClientLookup[], context?: ProcessFormContext | null): DynamicFormConfig;
|
|
425
474
|
/**
|
|
426
475
|
* Convert API property values into a flat key-value object
|
|
427
476
|
* suitable for `formControl.patchValue()`.
|
|
@@ -440,4 +489,4 @@ declare function getPreviewOnlyFieldKeys(config: ClientFormConfiguration, mode?:
|
|
|
440
489
|
declare function mapPreviewFieldsToEntities(config: ClientFormConfiguration, values: ProcessFormValue[], mode?: 'create' | 'edit'): EntityData[];
|
|
441
490
|
|
|
442
491
|
export { ClientForm, ClientFormApiService, ClientFormStateService, getPreviewOnlyFieldKeys, isFormRequiredInterception, mapFormValueToSubmitFields, mapPreviewFieldsToEntities, mapToDynamicFormConfig, mapValuesToFormValue };
|
|
443
|
-
export type { ClientFieldWidth, ClientFormConfiguration, ClientFormField, ClientFormRenderMode, ClientFormSection, ClientLookup, ClientLookupItem, ClientPropertyItem, ClientValidationRule, FormRequiredInterception, OperationType, ProcessFormContext, ProcessFormLoadRequest, ProcessFormLoadResponse, ProcessFormMode, ProcessFormSource, ProcessFormSubmitField, ProcessFormSubmitRecord, ProcessFormSubmitRecordField, ProcessFormSubmitRequest, ProcessFormSubmitResponse, ProcessFormSubmitStatus, ProcessFormSubmitValue, ProcessFormValue, ProcessFormValueMetadata, Response };
|
|
492
|
+
export type { ClientFieldWidth, ClientFormConfiguration, ClientFormField, ClientFormFooterActionMode, ClientFormFooterState, ClientFormRenderMode, ClientFormResolvedRenderMode, ClientFormSection, ClientFormSubmitRequestMapper, ClientFormSubmitRequestMapperContext, ClientLookup, ClientLookupItem, ClientPropertyItem, ClientValidationRule, FormRequiredInterception, OperationType, ProcessFormContext, ProcessFormLoadRequest, ProcessFormLoadResponse, ProcessFormMode, ProcessFormSource, ProcessFormSubmitField, ProcessFormSubmitRecord, ProcessFormSubmitRecordField, ProcessFormSubmitRequest, ProcessFormSubmitResponse, ProcessFormSubmitStatus, ProcessFormSubmitValue, ProcessFormValue, ProcessFormValueMetadata, Response };
|