@masterteam/form-builder 0.0.5 → 0.0.7
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.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"directory": "../../../dist/masterteam/form-builder",
|
|
6
6
|
"linkDirectory": true,
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"rxjs": "^7.8.2",
|
|
20
20
|
"tailwindcss": "^4.1.17",
|
|
21
21
|
"tailwindcss-primeui": "^0.6.1",
|
|
22
|
-
"@masterteam/properties": "^0.0.
|
|
23
|
-
"@masterteam/
|
|
24
|
-
"@masterteam/
|
|
22
|
+
"@masterteam/properties": "^0.0.29",
|
|
23
|
+
"@masterteam/components": "^0.0.81",
|
|
24
|
+
"@masterteam/forms": "^0.0.35",
|
|
25
25
|
"@masterteam/icons": "^0.0.12"
|
|
26
26
|
},
|
|
27
27
|
"sideEffects": false,
|
|
@@ -15,7 +15,11 @@ declare enum FormBuilderActionKey {
|
|
|
15
15
|
UpdateField = "updateField",
|
|
16
16
|
DeleteField = "deleteField",
|
|
17
17
|
MoveField = "moveField",
|
|
18
|
-
ReorderFields = "reorderFields"
|
|
18
|
+
ReorderFields = "reorderFields",
|
|
19
|
+
AddValidation = "addValidation",
|
|
20
|
+
UpdateValidation = "updateValidation",
|
|
21
|
+
DeleteValidation = "deleteValidation",
|
|
22
|
+
ToggleValidationActive = "toggleValidationActive"
|
|
19
23
|
}
|
|
20
24
|
type FieldWidth = '25' | '50' | '100';
|
|
21
25
|
interface FormField {
|
|
@@ -44,6 +48,19 @@ interface FormSection {
|
|
|
44
48
|
interface FormConfiguration {
|
|
45
49
|
isActive: boolean;
|
|
46
50
|
sections: FormSection[];
|
|
51
|
+
validations?: ValidationRule[];
|
|
52
|
+
}
|
|
53
|
+
type ValidationSeverity = 'error' | 'warning';
|
|
54
|
+
interface ValidationRule {
|
|
55
|
+
id: string | number;
|
|
56
|
+
formulaTokens: string;
|
|
57
|
+
formulaText: string;
|
|
58
|
+
message: {
|
|
59
|
+
en: string;
|
|
60
|
+
ar: string;
|
|
61
|
+
};
|
|
62
|
+
severity: ValidationSeverity;
|
|
63
|
+
enabled: boolean;
|
|
47
64
|
}
|
|
48
65
|
interface AddSectionPayload {
|
|
49
66
|
name: {
|
|
@@ -86,6 +103,27 @@ interface ReorderFieldPayload {
|
|
|
86
103
|
id: string;
|
|
87
104
|
order: number;
|
|
88
105
|
}
|
|
106
|
+
interface AddValidationPayload {
|
|
107
|
+
formulaTokens: string;
|
|
108
|
+
formulaText: string;
|
|
109
|
+
message: {
|
|
110
|
+
en: string;
|
|
111
|
+
ar: string;
|
|
112
|
+
};
|
|
113
|
+
severity: ValidationSeverity;
|
|
114
|
+
}
|
|
115
|
+
interface UpdateValidationPayload {
|
|
116
|
+
formulaTokens: string;
|
|
117
|
+
formulaText: string;
|
|
118
|
+
message: {
|
|
119
|
+
en: string;
|
|
120
|
+
ar: string;
|
|
121
|
+
};
|
|
122
|
+
severity: ValidationSeverity;
|
|
123
|
+
}
|
|
124
|
+
interface ToggleValidationPayload {
|
|
125
|
+
enabled: boolean;
|
|
126
|
+
}
|
|
89
127
|
interface PropertyItem {
|
|
90
128
|
id: number;
|
|
91
129
|
name: string | Record<string, string>;
|
|
@@ -116,6 +154,7 @@ declare class FormBuilderFacade {
|
|
|
116
154
|
readonly formConfiguration: _angular_core.Signal<_masterteam_form_builder.FormConfiguration | null>;
|
|
117
155
|
readonly sections: _angular_core.Signal<_masterteam_form_builder.FormSection[]>;
|
|
118
156
|
readonly properties: _angular_core.Signal<PropertyItem[]>;
|
|
157
|
+
readonly validations: _angular_core.Signal<_masterteam_form_builder.ValidationRule[]>;
|
|
119
158
|
readonly moduleType: _angular_core.Signal<string | null>;
|
|
120
159
|
readonly moduleId: _angular_core.Signal<string | number | null>;
|
|
121
160
|
readonly isLoadingFormConfiguration: _angular_core.Signal<boolean>;
|
|
@@ -127,9 +166,14 @@ declare class FormBuilderFacade {
|
|
|
127
166
|
readonly isUpdatingField: _angular_core.Signal<boolean>;
|
|
128
167
|
readonly isDeletingField: _angular_core.Signal<boolean>;
|
|
129
168
|
readonly isMovingField: _angular_core.Signal<boolean>;
|
|
169
|
+
readonly isAddingValidation: _angular_core.Signal<boolean>;
|
|
170
|
+
readonly isUpdatingValidation: _angular_core.Signal<boolean>;
|
|
171
|
+
readonly isDeletingValidation: _angular_core.Signal<boolean>;
|
|
172
|
+
readonly isTogglingValidation: _angular_core.Signal<boolean>;
|
|
130
173
|
readonly formConfigurationError: _angular_core.Signal<string | null>;
|
|
131
174
|
readonly sectionError: _angular_core.Signal<string | null>;
|
|
132
175
|
readonly fieldError: _angular_core.Signal<string | null>;
|
|
176
|
+
readonly validationError: _angular_core.Signal<string | null>;
|
|
133
177
|
setModuleInfo(moduleType: string, moduleId: string | number, parentModuleType?: string, parentModuleId?: string | number, parentPath?: string): rxjs.Observable<void>;
|
|
134
178
|
resetState(): rxjs.Observable<void>;
|
|
135
179
|
setProperties(properties: PropertyItem[]): rxjs.Observable<void>;
|
|
@@ -143,6 +187,10 @@ declare class FormBuilderFacade {
|
|
|
143
187
|
deleteField(sectionId: string, fieldId: string): rxjs.Observable<void>;
|
|
144
188
|
reorderFields(sectionId: string, payload: ReorderFieldPayload[]): rxjs.Observable<void>;
|
|
145
189
|
moveField(sectionId: string, fieldId: string, payload: MoveFieldPayload): rxjs.Observable<void>;
|
|
190
|
+
addValidation(payload: AddValidationPayload): rxjs.Observable<void>;
|
|
191
|
+
updateValidation(validationId: string | number, payload: UpdateValidationPayload): rxjs.Observable<void>;
|
|
192
|
+
deleteValidation(validationId: string | number): rxjs.Observable<void>;
|
|
193
|
+
toggleValidationActive(validationId: string | number, payload: ToggleValidationPayload): rxjs.Observable<void>;
|
|
146
194
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilderFacade, never>;
|
|
147
195
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormBuilderFacade>;
|
|
148
196
|
}
|
|
@@ -154,6 +202,7 @@ declare class FormBuilder {
|
|
|
154
202
|
protected readonly facade: FormBuilderFacade;
|
|
155
203
|
private dialogRef;
|
|
156
204
|
readonly activeTab: _angular_core.WritableSignal<string>;
|
|
205
|
+
readonly searchQuery: _angular_core.WritableSignal<string>;
|
|
157
206
|
readonly sections: _angular_core.Signal<_masterteam_form_builder.FormSection[]>;
|
|
158
207
|
readonly properties: _angular_core.Signal<PropertyItem[]>;
|
|
159
208
|
readonly isLoading: _angular_core.Signal<boolean>;
|
|
@@ -165,10 +214,16 @@ declare class FormBuilder {
|
|
|
165
214
|
title: string;
|
|
166
215
|
properties: PropertyItem[];
|
|
167
216
|
}[]>;
|
|
217
|
+
readonly filteredPropertiesByTab: _angular_core.Signal<{
|
|
218
|
+
id: string;
|
|
219
|
+
title: string;
|
|
220
|
+
properties: PropertyItem[];
|
|
221
|
+
}[]>;
|
|
168
222
|
constructor();
|
|
169
223
|
drop(event: CdkDragDrop<EnrichedFormField[] | PropertyItem[]>): void;
|
|
170
224
|
addSection(): void;
|
|
171
225
|
openPreview(): void;
|
|
226
|
+
openValidationRules(): void;
|
|
172
227
|
resetFormConfiguration(): void;
|
|
173
228
|
noReturnPredicate: () => boolean;
|
|
174
229
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilder, never>;
|
|
@@ -260,6 +315,28 @@ declare class MoveField {
|
|
|
260
315
|
static readonly type = "[FormBuilder] Move Field";
|
|
261
316
|
constructor(sectionId: string, fieldId: string, payload: MoveFieldPayload);
|
|
262
317
|
}
|
|
318
|
+
declare class AddValidation {
|
|
319
|
+
payload: AddValidationPayload;
|
|
320
|
+
static readonly type = "[FormBuilder] Add Validation";
|
|
321
|
+
constructor(payload: AddValidationPayload);
|
|
322
|
+
}
|
|
323
|
+
declare class UpdateValidation {
|
|
324
|
+
validationId: string | number;
|
|
325
|
+
payload: UpdateValidationPayload;
|
|
326
|
+
static readonly type = "[FormBuilder] Update Validation";
|
|
327
|
+
constructor(validationId: string | number, payload: UpdateValidationPayload);
|
|
328
|
+
}
|
|
329
|
+
declare class DeleteValidation {
|
|
330
|
+
validationId: string | number;
|
|
331
|
+
static readonly type = "[FormBuilder] Delete Validation";
|
|
332
|
+
constructor(validationId: string | number);
|
|
333
|
+
}
|
|
334
|
+
declare class ToggleValidationActive {
|
|
335
|
+
validationId: string | number;
|
|
336
|
+
payload: ToggleValidationPayload;
|
|
337
|
+
static readonly type = "[FormBuilder] Toggle Validation Active";
|
|
338
|
+
constructor(validationId: string | number, payload: ToggleValidationPayload);
|
|
339
|
+
}
|
|
263
340
|
|
|
264
341
|
declare class FormBuilderState extends CrudStateBase<FormSection, FormBuilderStateModel, FormBuilderActionKey> {
|
|
265
342
|
private http;
|
|
@@ -271,6 +348,7 @@ declare class FormBuilderState extends CrudStateBase<FormSection, FormBuilderSta
|
|
|
271
348
|
static getModuleType(state: FormBuilderStateModel): string | null;
|
|
272
349
|
static getModuleId(state: FormBuilderStateModel): string | number | null;
|
|
273
350
|
static getProperties(state: FormBuilderStateModel): _masterteam_form_builder.PropertyItem[];
|
|
351
|
+
static getValidations(state: FormBuilderStateModel): ValidationRule[];
|
|
274
352
|
setModuleInfo(ctx: StateContext<FormBuilderStateModel>, action: SetModuleInfo): void;
|
|
275
353
|
resetState(ctx: StateContext<FormBuilderStateModel>): void;
|
|
276
354
|
setProperties(ctx: StateContext<FormBuilderStateModel>, action: SetProperties): void;
|
|
@@ -291,9 +369,15 @@ declare class FormBuilderState extends CrudStateBase<FormSection, FormBuilderSta
|
|
|
291
369
|
fields: FormField[];
|
|
292
370
|
}>>;
|
|
293
371
|
moveField(ctx: StateContext<FormBuilderStateModel>, action: MoveField): rxjs.Observable<Response$1<FormField>>;
|
|
372
|
+
addValidation(ctx: StateContext<FormBuilderStateModel>, action: AddValidation): rxjs.Observable<Response$1<ValidationRule>>;
|
|
373
|
+
updateValidation(ctx: StateContext<FormBuilderStateModel>, action: UpdateValidation): rxjs.Observable<Response$1<ValidationRule>>;
|
|
374
|
+
deleteValidation(ctx: StateContext<FormBuilderStateModel>, action: DeleteValidation): rxjs.Observable<Response$1<{
|
|
375
|
+
id: string | number;
|
|
376
|
+
}>>;
|
|
377
|
+
toggleValidationActive(ctx: StateContext<FormBuilderStateModel>, action: ToggleValidationActive): rxjs.Observable<Response$1<ValidationRule>>;
|
|
294
378
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilderState, never>;
|
|
295
379
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormBuilderState>;
|
|
296
380
|
}
|
|
297
381
|
|
|
298
|
-
export { AddField, AddSection, DeleteField, DeleteSection, FormBuilder, FormBuilderActionKey, FormBuilderFacade, FormBuilderState, GetFormConfiguration, MoveField, ReorderFields, ResetFormBuilderState, ResetFormConfiguration, SetModuleInfo, SetProperties, UpdateField, UpdateSection };
|
|
299
|
-
export type { AddFieldPayload, AddSectionPayload, EnrichedFormField, EnrichedFormSection, FieldWidth, FormBuilderStateModel, FormConfiguration, FormField, FormSection, MoveFieldPayload, PropertyItem, ReorderFieldPayload, Response, UpdateFieldPayload, UpdateSectionPayload };
|
|
382
|
+
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 };
|