@masterteam/forms 0.0.36 → 0.0.38

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/forms",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/forms",
6
6
  "linkDirectory": true,
@@ -17,7 +17,7 @@
17
17
  "primeng": "21.0.1",
18
18
  "@primeuix/themes": "^2.0.2",
19
19
  "rxjs": "^7.8.2",
20
- "@masterteam/components": "^0.0.90"
20
+ "@masterteam/components": "^0.0.92"
21
21
  },
22
22
  "sideEffects": false,
23
23
  "exports": {
@@ -93,7 +93,7 @@ interface ProcessFormContext {
93
93
  }
94
94
  type ClientFieldWidth = '25' | '50' | '100';
95
95
  interface ClientFormConfiguration {
96
- isActive: boolean;
96
+ isActive?: boolean;
97
97
  sections: ClientFormSection[];
98
98
  validations?: ClientValidationRule[];
99
99
  }
@@ -110,7 +110,9 @@ interface ClientFormField {
110
110
  id: string;
111
111
  sectionId: string;
112
112
  propertyKey: string;
113
+ /** Property info — may come as `property` or `propertyMetadata` from API */
113
114
  property?: ClientPropertyItem;
115
+ propertyMetadata?: ClientPropertyItem;
114
116
  width: ClientFieldWidth;
115
117
  order: number;
116
118
  hiddenInCreation?: boolean;
@@ -124,8 +126,14 @@ interface ClientFormField {
124
126
  interface ClientPropertyItem {
125
127
  key: string;
126
128
  propertyId?: number;
127
- name: string | Record<string, string>;
129
+ name: string | {
130
+ display?: string;
131
+ en?: string;
132
+ ar?: string;
133
+ [k: string]: string | undefined;
134
+ };
128
135
  viewType?: string;
136
+ source?: string;
129
137
  configuration?: Record<string, unknown>;
130
138
  [key: string]: any;
131
139
  }
@@ -140,6 +148,33 @@ interface ClientValidationRule {
140
148
  severity: 'error' | 'warning';
141
149
  enabled: boolean;
142
150
  }
151
+ interface ClientLookup {
152
+ id: number;
153
+ key: string;
154
+ name: {
155
+ display?: string;
156
+ ar?: string;
157
+ en?: string;
158
+ };
159
+ items: ClientLookupItem[];
160
+ }
161
+ interface ClientLookupItem {
162
+ id: number;
163
+ lookupId: number;
164
+ key: string;
165
+ name: {
166
+ display?: string;
167
+ ar?: string;
168
+ en?: string;
169
+ };
170
+ description?: {
171
+ display?: string;
172
+ ar?: string;
173
+ en?: string;
174
+ };
175
+ color?: string;
176
+ order: number;
177
+ }
143
178
  interface FormRequiredInterception {
144
179
  requestSchemaId: number;
145
180
  operationType: OperationType;
@@ -228,6 +263,13 @@ declare class ClientForm implements OnDestroy {
228
263
  protected readonly state: ClientFormStateService;
229
264
  private loadSub?;
230
265
  private submitSub?;
266
+ readonly submitting: _angular_core.Signal<boolean>;
267
+ readonly submitError: _angular_core.Signal<string | null>;
268
+ readonly isSubmitted: _angular_core.Signal<boolean>;
269
+ readonly isPendingApproval: _angular_core.Signal<boolean>;
270
+ readonly isExecuted: _angular_core.Signal<boolean>;
271
+ readonly isLoaded: _angular_core.Signal<boolean>;
272
+ readonly loading: _angular_core.Signal<boolean>;
231
273
  readonly moduleKey: _angular_core.InputSignal<string>;
232
274
  readonly operationKey: _angular_core.InputSignal<string>;
233
275
  readonly moduleId: _angular_core.InputSignal<number | undefined>;
@@ -242,6 +284,7 @@ declare class ClientForm implements OnDestroy {
242
284
  readonly autoLoad: _angular_core.InputSignal<boolean>;
243
285
  readonly formMode: _angular_core.InputSignal<"create" | "edit">;
244
286
  readonly lang: _angular_core.InputSignal<"en" | "ar">;
287
+ readonly lookups: _angular_core.InputSignal<ClientLookup[]>;
245
288
  readonly loaded: _angular_core.OutputEmitterRef<ProcessFormLoadResponse>;
246
289
  readonly submitted: _angular_core.OutputEmitterRef<ProcessFormSubmitResponse>;
247
290
  readonly errored: _angular_core.OutputEmitterRef<string>;
@@ -252,8 +295,7 @@ declare class ClientForm implements OnDestroy {
252
295
  readonly initialValues: _angular_core.Signal<Record<string, any>>;
253
296
  readonly virtualFields: _angular_core.Signal<ProcessFormValue[]>;
254
297
  readonly hasVirtualFields: _angular_core.Signal<boolean>;
255
- private readonly autoLoadEffect;
256
- private readonly patchValuesEffect;
298
+ constructor();
257
299
  /**
258
300
  * Load form configuration from the API.
259
301
  * Builds request from current input values.
@@ -284,7 +326,7 @@ declare class ClientForm implements OnDestroy {
284
326
  private buildLoadRequest;
285
327
  private buildSubmitRequest;
286
328
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ClientForm, never>;
287
- 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; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "autoLoad": { "alias": "autoLoad"; "required": false; "isSignal": true; }; "formMode": { "alias": "formMode"; "required": false; "isSignal": true; }; "lang": { "alias": "lang"; "required": false; "isSignal": true; }; }, { "loaded": "loaded"; "submitted": "submitted"; "errored": "errored"; "modeDetected": "modeDetected"; "formSourceDetected": "formSourceDetected"; }, never, never, true, never>;
329
+ 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; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "autoLoad": { "alias": "autoLoad"; "required": false; "isSignal": true; }; "formMode": { "alias": "formMode"; "required": false; "isSignal": true; }; "lang": { "alias": "lang"; "required": false; "isSignal": true; }; "lookups": { "alias": "lookups"; "required": false; "isSignal": true; }; }, { "loaded": "loaded"; "submitted": "submitted"; "errored": "errored"; "modeDetected": "modeDetected"; "formSourceDetected": "formSourceDetected"; }, never, never, true, never>;
288
330
  }
289
331
 
290
332
  /**
@@ -313,11 +355,12 @@ declare class ClientFormApiService {
313
355
  * Convert a runtime FormConfiguration into a DynamicFormConfig
314
356
  * that can be passed directly to `<mt-dynamic-form>`.
315
357
  *
316
- * @param config The form configuration from the load API
317
- * @param lang Current UI language ('en' | 'ar')
318
- * @param mode 'create' or 'edit' — filters hidden fields accordingly
358
+ * @param config The form configuration from the load API
359
+ * @param lang Current UI language ('en' | 'ar')
360
+ * @param mode 'create' or 'edit' — filters hidden fields accordingly
361
+ * @param lookups Available lookup definitions for resolving Lookup/LookupMultiSelect options
319
362
  */
320
- declare function mapToDynamicFormConfig(config: ClientFormConfiguration, lang?: 'en' | 'ar', mode?: 'create' | 'edit'): DynamicFormConfig;
363
+ declare function mapToDynamicFormConfig(config: ClientFormConfiguration, lang?: 'en' | 'ar', mode?: 'create' | 'edit', lookups?: ClientLookup[]): DynamicFormConfig;
321
364
  /**
322
365
  * Convert API property values into a flat key-value object
323
366
  * suitable for `formControl.patchValue()`.
@@ -334,4 +377,4 @@ declare function mapValuesToFormValue(values: ProcessFormValue[]): Record<string
334
377
  declare function mapFormValueToSubmitValues(formValue: Record<string, any>, loadResponse: ProcessFormLoadResponse): ProcessFormSubmitValue[];
335
378
 
336
379
  export { ClientForm, ClientFormApiService, ClientFormStateService, isFormRequiredInterception, mapFormValueToSubmitValues, mapToDynamicFormConfig, mapValuesToFormValue };
337
- export type { ClientFieldWidth, ClientFormConfiguration, ClientFormField, ClientFormSection, ClientPropertyItem, ClientValidationRule, FormRequiredInterception, OperationType, ProcessFormContext, ProcessFormLoadRequest, ProcessFormLoadResponse, ProcessFormMode, ProcessFormSource, ProcessFormSubmitRequest, ProcessFormSubmitResponse, ProcessFormSubmitStatus, ProcessFormSubmitValue, ProcessFormValue, ProcessFormValueMetadata, Response };
380
+ export type { ClientFieldWidth, ClientFormConfiguration, ClientFormField, ClientFormSection, ClientLookup, ClientLookupItem, ClientPropertyItem, ClientValidationRule, FormRequiredInterception, OperationType, ProcessFormContext, ProcessFormLoadRequest, ProcessFormLoadResponse, ProcessFormMode, ProcessFormSource, ProcessFormSubmitRequest, ProcessFormSubmitResponse, ProcessFormSubmitStatus, ProcessFormSubmitValue, ProcessFormValue, ProcessFormValueMetadata, Response };