@masterteam/form-builder 0.0.2 → 0.0.3
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/form-builder.css +2 -4
- package/fesm2022/masterteam-form-builder.mjs +1908 -0
- package/fesm2022/masterteam-form-builder.mjs.map +1 -0
- package/package.json +16 -16
- package/types/masterteam-form-builder.d.ts +297 -0
- package/.angular/cache/21.0.2/ng-packagr/db70d8f07b5a2d2d1c3124ca92e8d56d14fb894dce4d4867ba7c0db29ba913a3 +0 -1
- package/.angular/cache/21.0.2/ng-packagr/tsbuildinfo/masterteam-form-builder.tsbuildinfo +0 -1
- package/BACKEND_API_SPEC.md +0 -338
- package/angular.json +0 -26
- package/ng-package.json +0 -13
- package/src/lib/fb-field-conditions/condition-constants.ts +0 -262
- package/src/lib/fb-field-conditions/fb-field-conditions.html +0 -35
- package/src/lib/fb-field-conditions/fb-field-conditions.ts +0 -123
- package/src/lib/fb-field-form/fb-field-form.html +0 -59
- package/src/lib/fb-field-form/fb-field-form.ts +0 -250
- package/src/lib/fb-preview-form/fb-preview-form.html +0 -31
- package/src/lib/fb-preview-form/fb-preview-form.ts +0 -147
- package/src/lib/fb-section/fb-section.html +0 -130
- package/src/lib/fb-section/fb-section.ts +0 -211
- package/src/lib/fb-section-form/fb-section-form.html +0 -38
- package/src/lib/fb-section-form/fb-section-form.ts +0 -128
- package/src/lib/form-builder.html +0 -166
- package/src/lib/form-builder.model.ts +0 -27
- package/src/lib/form-builder.scss +0 -20
- package/src/lib/form-builder.ts +0 -208
- package/src/public-api.ts +0 -6
- package/src/store/form-builder/api.model.ts +0 -13
- package/src/store/form-builder/form-builder.actions.ts +0 -113
- package/src/store/form-builder/form-builder.facade.ts +0 -207
- package/src/store/form-builder/form-builder.model.ts +0 -147
- package/src/store/form-builder/form-builder.state.ts +0 -668
- package/src/store/form-builder/index.ts +0 -5
- package/tsconfig.json +0 -31
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import * as _masterteam_form_builder from '@masterteam/form-builder';
|
|
2
|
+
import * as _angular_core from '@angular/core';
|
|
3
|
+
import { LoadingStateShape, CrudStateBase, Response as Response$1 } from '@masterteam/components';
|
|
4
|
+
import { CdkDragDrop } from '@angular/cdk/drag-drop';
|
|
5
|
+
import * as rxjs from 'rxjs';
|
|
6
|
+
import { StateContext } from '@ngxs/store';
|
|
7
|
+
|
|
8
|
+
declare enum FormBuilderActionKey {
|
|
9
|
+
GetFormConfiguration = "getFormConfiguration",
|
|
10
|
+
ResetFormConfiguration = "resetFormConfiguration",
|
|
11
|
+
AddSection = "addSection",
|
|
12
|
+
UpdateSection = "updateSection",
|
|
13
|
+
DeleteSection = "deleteSection",
|
|
14
|
+
AddField = "addField",
|
|
15
|
+
UpdateField = "updateField",
|
|
16
|
+
DeleteField = "deleteField",
|
|
17
|
+
MoveField = "moveField",
|
|
18
|
+
ReorderFields = "reorderFields"
|
|
19
|
+
}
|
|
20
|
+
type FieldWidth = '25' | '50' | '100';
|
|
21
|
+
interface FormField {
|
|
22
|
+
id: string;
|
|
23
|
+
sectionId: string;
|
|
24
|
+
propertyId: number;
|
|
25
|
+
width: FieldWidth;
|
|
26
|
+
order: number;
|
|
27
|
+
hiddenInCreation?: boolean;
|
|
28
|
+
hiddenInEditForm?: boolean;
|
|
29
|
+
isRequired?: boolean;
|
|
30
|
+
showConditionalDisplayFormula?: boolean;
|
|
31
|
+
conditionalDisplayFormula?: string;
|
|
32
|
+
_pending?: boolean;
|
|
33
|
+
_deleting?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface FormSection {
|
|
36
|
+
id: string;
|
|
37
|
+
name: {
|
|
38
|
+
en: string;
|
|
39
|
+
ar: string;
|
|
40
|
+
};
|
|
41
|
+
order: number;
|
|
42
|
+
fields: FormField[];
|
|
43
|
+
}
|
|
44
|
+
interface FormConfiguration {
|
|
45
|
+
isActive: boolean;
|
|
46
|
+
sections: FormSection[];
|
|
47
|
+
}
|
|
48
|
+
interface AddSectionPayload {
|
|
49
|
+
name: {
|
|
50
|
+
en: string;
|
|
51
|
+
ar: string;
|
|
52
|
+
};
|
|
53
|
+
order?: number;
|
|
54
|
+
}
|
|
55
|
+
interface UpdateSectionPayload {
|
|
56
|
+
name?: {
|
|
57
|
+
en: string;
|
|
58
|
+
ar: string;
|
|
59
|
+
};
|
|
60
|
+
order?: number;
|
|
61
|
+
}
|
|
62
|
+
interface AddFieldPayload {
|
|
63
|
+
propertyId: number;
|
|
64
|
+
width: FieldWidth;
|
|
65
|
+
order?: number;
|
|
66
|
+
hiddenInCreation?: boolean;
|
|
67
|
+
hiddenInEditForm?: boolean;
|
|
68
|
+
isRequired?: boolean;
|
|
69
|
+
showConditionalDisplayFormula?: boolean;
|
|
70
|
+
conditionalDisplayFormula?: string;
|
|
71
|
+
}
|
|
72
|
+
interface UpdateFieldPayload {
|
|
73
|
+
width?: FieldWidth;
|
|
74
|
+
order?: number;
|
|
75
|
+
hiddenInCreation?: boolean;
|
|
76
|
+
hiddenInEditForm?: boolean;
|
|
77
|
+
isRequired?: boolean;
|
|
78
|
+
showConditionalDisplayFormula?: boolean;
|
|
79
|
+
conditionalDisplayFormula?: string | null;
|
|
80
|
+
}
|
|
81
|
+
interface MoveFieldPayload {
|
|
82
|
+
targetSectionId: string;
|
|
83
|
+
order?: number;
|
|
84
|
+
}
|
|
85
|
+
interface ReorderFieldPayload {
|
|
86
|
+
id: string;
|
|
87
|
+
order: number;
|
|
88
|
+
}
|
|
89
|
+
interface PropertyItem {
|
|
90
|
+
id: number;
|
|
91
|
+
name: string | Record<string, string>;
|
|
92
|
+
viewType?: string;
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
}
|
|
95
|
+
interface EnrichedFormField extends FormField {
|
|
96
|
+
name: string;
|
|
97
|
+
type: string;
|
|
98
|
+
data?: any;
|
|
99
|
+
}
|
|
100
|
+
interface EnrichedFormSection extends Omit<FormSection, 'fields'> {
|
|
101
|
+
fields: EnrichedFormField[];
|
|
102
|
+
}
|
|
103
|
+
interface FormBuilderStateModel extends LoadingStateShape<FormBuilderActionKey> {
|
|
104
|
+
moduleType: string | null;
|
|
105
|
+
moduleId: string | number | null;
|
|
106
|
+
parentModuleType: string | null;
|
|
107
|
+
parentModuleId: string | number | null;
|
|
108
|
+
parentPath: string;
|
|
109
|
+
formConfiguration: FormConfiguration | null;
|
|
110
|
+
properties: PropertyItem[];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare class FormBuilderFacade {
|
|
114
|
+
private readonly store;
|
|
115
|
+
private readonly stateSignal;
|
|
116
|
+
readonly formConfiguration: _angular_core.Signal<_masterteam_form_builder.FormConfiguration | null>;
|
|
117
|
+
readonly sections: _angular_core.Signal<_masterteam_form_builder.FormSection[]>;
|
|
118
|
+
readonly properties: _angular_core.Signal<PropertyItem[]>;
|
|
119
|
+
readonly moduleType: _angular_core.Signal<string | null>;
|
|
120
|
+
readonly moduleId: _angular_core.Signal<string | number | null>;
|
|
121
|
+
readonly isLoadingFormConfiguration: _angular_core.Signal<boolean>;
|
|
122
|
+
readonly isResettingFormConfiguration: _angular_core.Signal<boolean>;
|
|
123
|
+
readonly isAddingSection: _angular_core.Signal<boolean>;
|
|
124
|
+
readonly isUpdatingSection: _angular_core.Signal<boolean>;
|
|
125
|
+
readonly isDeletingSection: _angular_core.Signal<boolean>;
|
|
126
|
+
readonly isAddingField: _angular_core.Signal<boolean>;
|
|
127
|
+
readonly isUpdatingField: _angular_core.Signal<boolean>;
|
|
128
|
+
readonly isDeletingField: _angular_core.Signal<boolean>;
|
|
129
|
+
readonly isMovingField: _angular_core.Signal<boolean>;
|
|
130
|
+
readonly formConfigurationError: _angular_core.Signal<string | null>;
|
|
131
|
+
readonly sectionError: _angular_core.Signal<string | null>;
|
|
132
|
+
readonly fieldError: _angular_core.Signal<string | null>;
|
|
133
|
+
setModuleInfo(moduleType: string, moduleId: string | number, parentModuleType?: string, parentModuleId?: string | number, parentPath?: string): rxjs.Observable<void>;
|
|
134
|
+
resetState(): rxjs.Observable<void>;
|
|
135
|
+
setProperties(properties: PropertyItem[]): rxjs.Observable<void>;
|
|
136
|
+
getFormConfiguration(): rxjs.Observable<void>;
|
|
137
|
+
resetFormConfiguration(): rxjs.Observable<void>;
|
|
138
|
+
addSection(payload: AddSectionPayload): rxjs.Observable<void>;
|
|
139
|
+
updateSection(sectionId: string, payload: UpdateSectionPayload): rxjs.Observable<void>;
|
|
140
|
+
deleteSection(sectionId: string): rxjs.Observable<void>;
|
|
141
|
+
addField(sectionId: string, payload: AddFieldPayload): rxjs.Observable<void>;
|
|
142
|
+
updateField(sectionId: string, fieldId: string, payload: UpdateFieldPayload): rxjs.Observable<void>;
|
|
143
|
+
deleteField(sectionId: string, fieldId: string): rxjs.Observable<void>;
|
|
144
|
+
reorderFields(sectionId: string, payload: ReorderFieldPayload[]): rxjs.Observable<void>;
|
|
145
|
+
moveField(sectionId: string, fieldId: string, payload: MoveFieldPayload): rxjs.Observable<void>;
|
|
146
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilderFacade, never>;
|
|
147
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormBuilderFacade>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare class FormBuilder {
|
|
151
|
+
private readonly modalService;
|
|
152
|
+
private readonly confirmationService;
|
|
153
|
+
private readonly translocoService;
|
|
154
|
+
protected readonly facade: FormBuilderFacade;
|
|
155
|
+
private dialogRef;
|
|
156
|
+
readonly activeTab: _angular_core.WritableSignal<string>;
|
|
157
|
+
readonly sections: _angular_core.Signal<_masterteam_form_builder.FormSection[]>;
|
|
158
|
+
readonly properties: _angular_core.Signal<PropertyItem[]>;
|
|
159
|
+
readonly isLoading: _angular_core.Signal<boolean>;
|
|
160
|
+
readonly error: _angular_core.Signal<string | null>;
|
|
161
|
+
private readonly propertiesMap;
|
|
162
|
+
readonly enrichedSections: _angular_core.Signal<EnrichedFormSection[]>;
|
|
163
|
+
readonly availableTabs: _angular_core.Signal<{
|
|
164
|
+
id: string;
|
|
165
|
+
title: string;
|
|
166
|
+
properties: PropertyItem[];
|
|
167
|
+
}[]>;
|
|
168
|
+
constructor();
|
|
169
|
+
drop(event: CdkDragDrop<EnrichedFormField[] | PropertyItem[]>): void;
|
|
170
|
+
addSection(): void;
|
|
171
|
+
openPreview(): void;
|
|
172
|
+
resetFormConfiguration(): void;
|
|
173
|
+
noReturnPredicate: () => boolean;
|
|
174
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilder, never>;
|
|
175
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormBuilder, "mt-form-builder", never, {}, {}, never, never, true, never>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Standard API Response wrapper
|
|
180
|
+
*/
|
|
181
|
+
interface Response<T> {
|
|
182
|
+
endpoint: string;
|
|
183
|
+
status: number;
|
|
184
|
+
code: number;
|
|
185
|
+
locale: string;
|
|
186
|
+
message?: string | null;
|
|
187
|
+
errors?: any | null;
|
|
188
|
+
data: T;
|
|
189
|
+
cacheSession?: string;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
declare class SetModuleInfo {
|
|
193
|
+
moduleType: string;
|
|
194
|
+
moduleId: string | number;
|
|
195
|
+
parentModuleType?: string | undefined;
|
|
196
|
+
parentModuleId?: string | number | undefined;
|
|
197
|
+
parentPath?: string | undefined;
|
|
198
|
+
static readonly type = "[FormBuilder] Set Module Info";
|
|
199
|
+
constructor(moduleType: string, moduleId: string | number, parentModuleType?: string | undefined, parentModuleId?: string | number | undefined, parentPath?: string | undefined);
|
|
200
|
+
}
|
|
201
|
+
declare class ResetFormBuilderState {
|
|
202
|
+
static readonly type = "[FormBuilder] Reset State";
|
|
203
|
+
}
|
|
204
|
+
declare class SetProperties {
|
|
205
|
+
properties: PropertyItem[];
|
|
206
|
+
static readonly type = "[FormBuilder] Set Properties";
|
|
207
|
+
constructor(properties: PropertyItem[]);
|
|
208
|
+
}
|
|
209
|
+
declare class GetFormConfiguration {
|
|
210
|
+
static readonly type = "[FormBuilder] Get Form Configuration";
|
|
211
|
+
}
|
|
212
|
+
declare class ResetFormConfiguration {
|
|
213
|
+
static readonly type = "[FormBuilder] Reset Form Configuration";
|
|
214
|
+
}
|
|
215
|
+
declare class AddSection {
|
|
216
|
+
payload: AddSectionPayload;
|
|
217
|
+
static readonly type = "[FormBuilder] Add Section";
|
|
218
|
+
constructor(payload: AddSectionPayload);
|
|
219
|
+
}
|
|
220
|
+
declare class UpdateSection {
|
|
221
|
+
sectionId: string;
|
|
222
|
+
payload: UpdateSectionPayload;
|
|
223
|
+
static readonly type = "[FormBuilder] Update Section";
|
|
224
|
+
constructor(sectionId: string, payload: UpdateSectionPayload);
|
|
225
|
+
}
|
|
226
|
+
declare class DeleteSection {
|
|
227
|
+
sectionId: string;
|
|
228
|
+
static readonly type = "[FormBuilder] Delete Section";
|
|
229
|
+
constructor(sectionId: string);
|
|
230
|
+
}
|
|
231
|
+
declare class AddField {
|
|
232
|
+
sectionId: string;
|
|
233
|
+
payload: AddFieldPayload;
|
|
234
|
+
static readonly type = "[FormBuilder] Add Field";
|
|
235
|
+
constructor(sectionId: string, payload: AddFieldPayload);
|
|
236
|
+
}
|
|
237
|
+
declare class UpdateField {
|
|
238
|
+
sectionId: string;
|
|
239
|
+
fieldId: string;
|
|
240
|
+
payload: UpdateFieldPayload;
|
|
241
|
+
static readonly type = "[FormBuilder] Update Field";
|
|
242
|
+
constructor(sectionId: string, fieldId: string, payload: UpdateFieldPayload);
|
|
243
|
+
}
|
|
244
|
+
declare class DeleteField {
|
|
245
|
+
sectionId: string;
|
|
246
|
+
fieldId: string;
|
|
247
|
+
static readonly type = "[FormBuilder] Delete Field";
|
|
248
|
+
constructor(sectionId: string, fieldId: string);
|
|
249
|
+
}
|
|
250
|
+
declare class ReorderFields {
|
|
251
|
+
sectionId: string;
|
|
252
|
+
payload: ReorderFieldPayload[];
|
|
253
|
+
static readonly type = "[FormBuilder] Reorder Fields";
|
|
254
|
+
constructor(sectionId: string, payload: ReorderFieldPayload[]);
|
|
255
|
+
}
|
|
256
|
+
declare class MoveField {
|
|
257
|
+
sectionId: string;
|
|
258
|
+
fieldId: string;
|
|
259
|
+
payload: MoveFieldPayload;
|
|
260
|
+
static readonly type = "[FormBuilder] Move Field";
|
|
261
|
+
constructor(sectionId: string, fieldId: string, payload: MoveFieldPayload);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare class FormBuilderState extends CrudStateBase<FormSection, FormBuilderStateModel, FormBuilderActionKey> {
|
|
265
|
+
private http;
|
|
266
|
+
private baseUrl;
|
|
267
|
+
private getApiPath;
|
|
268
|
+
static getState(state: FormBuilderStateModel): FormBuilderStateModel;
|
|
269
|
+
static getFormConfiguration(state: FormBuilderStateModel): FormConfiguration | null;
|
|
270
|
+
static getSections(state: FormBuilderStateModel): FormSection[];
|
|
271
|
+
static getModuleType(state: FormBuilderStateModel): string | null;
|
|
272
|
+
static getModuleId(state: FormBuilderStateModel): string | number | null;
|
|
273
|
+
static getProperties(state: FormBuilderStateModel): _masterteam_form_builder.PropertyItem[];
|
|
274
|
+
setModuleInfo(ctx: StateContext<FormBuilderStateModel>, action: SetModuleInfo): void;
|
|
275
|
+
resetState(ctx: StateContext<FormBuilderStateModel>): void;
|
|
276
|
+
setProperties(ctx: StateContext<FormBuilderStateModel>, action: SetProperties): void;
|
|
277
|
+
getFormConfiguration(ctx: StateContext<FormBuilderStateModel>): rxjs.Observable<Response$1<FormConfiguration>>;
|
|
278
|
+
resetFormConfiguration(ctx: StateContext<FormBuilderStateModel>): rxjs.Observable<Response$1<FormConfiguration>>;
|
|
279
|
+
addSection(ctx: StateContext<FormBuilderStateModel>, action: AddSection): rxjs.Observable<Response$1<FormSection>>;
|
|
280
|
+
updateSection(ctx: StateContext<FormBuilderStateModel>, action: UpdateSection): rxjs.Observable<Response$1<FormSection>>;
|
|
281
|
+
deleteSection(ctx: StateContext<FormBuilderStateModel>, action: DeleteSection): rxjs.Observable<Response$1<{
|
|
282
|
+
id: string;
|
|
283
|
+
}>>;
|
|
284
|
+
addField(ctx: StateContext<FormBuilderStateModel>, action: AddField): rxjs.Observable<Response$1<FormField>>;
|
|
285
|
+
updateField(ctx: StateContext<FormBuilderStateModel>, action: UpdateField): rxjs.Observable<Response$1<FormField>>;
|
|
286
|
+
deleteField(ctx: StateContext<FormBuilderStateModel>, action: DeleteField): rxjs.Observable<Response$1<{
|
|
287
|
+
id: string;
|
|
288
|
+
sectionId: string;
|
|
289
|
+
}>>;
|
|
290
|
+
reorderFields(ctx: StateContext<FormBuilderStateModel>, action: ReorderFields): rxjs.Observable<Response$1<FormField[]>>;
|
|
291
|
+
moveField(ctx: StateContext<FormBuilderStateModel>, action: MoveField): rxjs.Observable<Response$1<FormField>>;
|
|
292
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormBuilderState, never>;
|
|
293
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<FormBuilderState>;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export { AddField, AddSection, DeleteField, DeleteSection, FormBuilder, FormBuilderActionKey, FormBuilderFacade, FormBuilderState, GetFormConfiguration, MoveField, ReorderFields, ResetFormBuilderState, ResetFormConfiguration, SetModuleInfo, SetProperties, UpdateField, UpdateSection };
|
|
297
|
+
export type { AddFieldPayload, AddSectionPayload, EnrichedFormField, EnrichedFormSection, FieldWidth, FormBuilderStateModel, FormConfiguration, FormField, FormSection, MoveFieldPayload, PropertyItem, ReorderFieldPayload, Response, UpdateFieldPayload, UpdateSectionPayload };
|