ngx-t-forms-types 0.0.1

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.
Files changed (139) hide show
  1. package/dist/Configs/currencies.d.ts +6 -0
  2. package/dist/Configs/currencies.js +1083 -0
  3. package/dist/Configs/datePipes.d.ts +4 -0
  4. package/dist/Configs/datePipes.js +16 -0
  5. package/dist/index.d.ts +8 -0
  6. package/dist/index.js +8 -0
  7. package/dist/interfaces/Form/ArrayFunctions.d.ts +9 -0
  8. package/dist/interfaces/Form/ArrayFunctions.js +7 -0
  9. package/dist/interfaces/Form/CustomeConfigInter.d.ts +10 -0
  10. package/dist/interfaces/Form/CustomeConfigInter.js +1 -0
  11. package/dist/interfaces/Form/FileUploadFn.d.ts +11 -0
  12. package/dist/interfaces/Form/FileUploadFn.js +1 -0
  13. package/dist/interfaces/Form/FormInClassUtils.d.ts +52 -0
  14. package/dist/interfaces/Form/FormInClassUtils.js +1 -0
  15. package/dist/interfaces/Form/IFormsInitStateInterface.d.ts +51 -0
  16. package/dist/interfaces/Form/IFormsInitStateInterface.js +14 -0
  17. package/dist/interfaces/Form/PrePopulateDataInterface.d.ts +4 -0
  18. package/dist/interfaces/Form/PrePopulateDataInterface.js +1 -0
  19. package/dist/interfaces/Form/formChangeHistory.d.ts +5 -0
  20. package/dist/interfaces/Form/formChangeHistory.js +1 -0
  21. package/dist/interfaces/Form/formInterface.d.ts +19 -0
  22. package/dist/interfaces/Form/formInterface.js +1 -0
  23. package/dist/interfaces/Form/formSubmissionHandleInterface.d.ts +7 -0
  24. package/dist/interfaces/Form/formSubmissionHandleInterface.js +1 -0
  25. package/dist/interfaces/Form/index.d.ts +12 -0
  26. package/dist/interfaces/Form/index.js +2 -0
  27. package/dist/interfaces/FormBuilder/DefaultEelement.d.ts +3 -0
  28. package/dist/interfaces/FormBuilder/DefaultEelement.js +741 -0
  29. package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.d.ts +143 -0
  30. package/dist/interfaces/FormBuilder/DefaultInputConfigInterface.js +1 -0
  31. package/dist/interfaces/FormBuilder/ElementEditorTypes.d.ts +31 -0
  32. package/dist/interfaces/FormBuilder/ElementEditorTypes.js +40 -0
  33. package/dist/interfaces/FormBuilder/FormBuilderCallBackFunctions.d.ts +20 -0
  34. package/dist/interfaces/FormBuilder/FormBuilderCallBackFunctions.js +1 -0
  35. package/dist/interfaces/FormBuilder/FormInputKeys.d.ts +86 -0
  36. package/dist/interfaces/FormBuilder/FormInputKeys.js +90 -0
  37. package/dist/interfaces/FormBuilder/elementEditor.d.ts +82 -0
  38. package/dist/interfaces/FormBuilder/elementEditor.js +34 -0
  39. package/dist/interfaces/FormBuilder/index.d.ts +10 -0
  40. package/dist/interfaces/FormBuilder/index.js +6 -0
  41. package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.d.ts +3 -0
  42. package/dist/interfaces/FormBuilder/inputConfig/ElementEditConfig.js +644 -0
  43. package/dist/interfaces/FormBuilder/inputConfig/getInputValueFromElement.d.ts +1 -0
  44. package/dist/interfaces/FormBuilder/inputConfig/getInputValueFromElement.js +37 -0
  45. package/dist/interfaces/FormBuilder/postmanCollection.d.ts +126 -0
  46. package/dist/interfaces/FormBuilder/postmanCollection.js +1 -0
  47. package/dist/interfaces/FormBuilder/workflowSelectionConfig.d.ts +7 -0
  48. package/dist/interfaces/FormBuilder/workflowSelectionConfig.js +1 -0
  49. package/dist/interfaces/FormSlide/accessTree.d.ts +23 -0
  50. package/dist/interfaces/FormSlide/accessTree.js +1 -0
  51. package/dist/interfaces/FormSlide/controlValidation.d.ts +12 -0
  52. package/dist/interfaces/FormSlide/controlValidation.js +1 -0
  53. package/dist/interfaces/FormSlide/formSlideInterface.d.ts +22 -0
  54. package/dist/interfaces/FormSlide/formSlideInterface.js +7 -0
  55. package/dist/interfaces/FormSlide/index.d.ts +4 -0
  56. package/dist/interfaces/FormSlide/index.js +2 -0
  57. package/dist/interfaces/Tower/ITowerFormSteps.d.ts +14 -0
  58. package/dist/interfaces/Tower/ITowerFormSteps.js +1 -0
  59. package/dist/interfaces/Tower/index.d.ts +2 -0
  60. package/dist/interfaces/Tower/index.js +1 -0
  61. package/dist/interfaces/environment/IStoreFunctions.d.ts +58 -0
  62. package/dist/interfaces/environment/IStoreFunctions.js +1 -0
  63. package/dist/interfaces/environment/environment.d.ts +6 -0
  64. package/dist/interfaces/environment/environment.js +1 -0
  65. package/dist/interfaces/environment/index.d.ts +2 -0
  66. package/dist/interfaces/environment/index.js +1 -0
  67. package/dist/interfaces/formInput/APIDataFetchingConfigurationInterface.d.ts +54 -0
  68. package/dist/interfaces/formInput/APIDataFetchingConfigurationInterface.js +7 -0
  69. package/dist/interfaces/formInput/BasicFormInputInterface.d.ts +141 -0
  70. package/dist/interfaces/formInput/BasicFormInputInterface.js +99 -0
  71. package/dist/interfaces/formInput/ConditionalInputRule.d.ts +7 -0
  72. package/dist/interfaces/formInput/ConditionalInputRule.js +1 -0
  73. package/dist/interfaces/formInput/DateRangePickerInput.d.ts +9 -0
  74. package/dist/interfaces/formInput/DateRangePickerInput.js +1 -0
  75. package/dist/interfaces/formInput/FileUploadInputInterface.d.ts +49 -0
  76. package/dist/interfaces/formInput/FileUploadInputInterface.js +40 -0
  77. package/dist/interfaces/formInput/FormControlCustomValidatorsInterface.d.ts +10 -0
  78. package/dist/interfaces/formInput/FormControlCustomValidatorsInterface.js +1 -0
  79. package/dist/interfaces/formInput/FormInputBasicOptionInterface.d.ts +4 -0
  80. package/dist/interfaces/formInput/FormInputBasicOptionInterface.js +1 -0
  81. package/dist/interfaces/formInput/FormSectionTitleDescription.d.ts +6 -0
  82. package/dist/interfaces/formInput/FormSectionTitleDescription.js +1 -0
  83. package/dist/interfaces/formInput/IMscoaAccount.d.ts +84 -0
  84. package/dist/interfaces/formInput/IMscoaAccount.js +1 -0
  85. package/dist/interfaces/formInput/MatDataOptionsInterface.d.ts +14 -0
  86. package/dist/interfaces/formInput/MatDataOptionsInterface.js +1 -0
  87. package/dist/interfaces/formInput/MatrixInputInterface.d.ts +8 -0
  88. package/dist/interfaces/formInput/MatrixInputInterface.js +1 -0
  89. package/dist/interfaces/formInput/MinimumInputRequiredInterface.d.ts +33 -0
  90. package/dist/interfaces/formInput/MinimumInputRequiredInterface.js +18 -0
  91. package/dist/interfaces/formInput/MscoaInput.d.ts +16 -0
  92. package/dist/interfaces/formInput/MscoaInput.js +19 -0
  93. package/dist/interfaces/formInput/MultipleInterface.d.ts +15 -0
  94. package/dist/interfaces/formInput/MultipleInterface.js +1 -0
  95. package/dist/interfaces/formInput/RichTextEditorInput.d.ts +8 -0
  96. package/dist/interfaces/formInput/RichTextEditorInput.js +5 -0
  97. package/dist/interfaces/formInput/TableConfigurationsInterface.d.ts +17 -0
  98. package/dist/interfaces/formInput/TableConfigurationsInterface.js +1 -0
  99. package/dist/interfaces/formInput/TableSelectionInput.d.ts +6 -0
  100. package/dist/interfaces/formInput/TableSelectionInput.js +1 -0
  101. package/dist/interfaces/formInput/TextAreaInput.d.ts +5 -0
  102. package/dist/interfaces/formInput/TextAreaInput.js +1 -0
  103. package/dist/interfaces/formInput/ToggleInputInterface.d.ts +8 -0
  104. package/dist/interfaces/formInput/ToggleInputInterface.js +5 -0
  105. package/dist/interfaces/formInput/calculatedFieldRules.d.ts +7 -0
  106. package/dist/interfaces/formInput/calculatedFieldRules.js +1 -0
  107. package/dist/interfaces/formInput/calculationVariableInterface.d.ts +21 -0
  108. package/dist/interfaces/formInput/calculationVariableInterface.js +7 -0
  109. package/dist/interfaces/formInput/index.d.ts +22 -0
  110. package/dist/interfaces/formInput/index.js +7 -0
  111. package/dist/interfaces/formInput/schema.d.ts +9 -0
  112. package/dist/interfaces/formInput/schema.js +1 -0
  113. package/dist/interfaces/formInput/userSignature.d.ts +7 -0
  114. package/dist/interfaces/formInput/userSignature.js +1 -0
  115. package/dist/interfaces/pipeline-builder/index.d.ts +2 -0
  116. package/dist/interfaces/pipeline-builder/index.js +2 -0
  117. package/dist/interfaces/pipeline-builder/pipelineStages.d.ts +47 -0
  118. package/dist/interfaces/pipeline-builder/pipelineStages.js +30 -0
  119. package/dist/interfaces/upgradeFunctions/interfaces/init-form.d.ts +268 -0
  120. package/dist/interfaces/upgradeFunctions/interfaces/init-form.js +6 -0
  121. package/dist/schemas/CalculatedFieldRulesSchema.d.ts +6 -0
  122. package/dist/schemas/CalculatedFieldRulesSchema.js +27 -0
  123. package/dist/schemas/FormInputSchema.d.ts +15 -0
  124. package/dist/schemas/FormInputSchema.js +197 -0
  125. package/dist/schemas/FormSchema.d.ts +26 -0
  126. package/dist/schemas/FormSchema.js +134 -0
  127. package/dist/schemas/MatOptionsSchema.d.ts +8 -0
  128. package/dist/schemas/MatOptionsSchema.js +54 -0
  129. package/dist/schemas/MscoaConfigSchema.d.ts +8 -0
  130. package/dist/schemas/MscoaConfigSchema.js +22 -0
  131. package/dist/schemas/customValidationSchema.d.ts +2 -0
  132. package/dist/schemas/customValidationSchema.js +8 -0
  133. package/dist/schemas/index.d.ts +4 -0
  134. package/dist/schemas/index.js +4 -0
  135. package/dist/schemas/tests/FormInputValidator.spec.d.ts +1 -0
  136. package/dist/schemas/tests/FormInputValidator.spec.js +68 -0
  137. package/dist/schemas/tests/MOCK_DATA.d.ts +49 -0
  138. package/dist/schemas/tests/MOCK_DATA.js +59 -0
  139. package/package.json +61 -0
@@ -0,0 +1,644 @@
1
+ import { CurrenciesList } from "../../../Configs/currencies";
2
+ import { DatePipeOptions } from "../../../Configs/datePipes";
3
+ import { ElementTypes, InputDataTypes, InputPipeTypes, InputTypes } from "../../formInput";
4
+ import { DataSources } from "../../formInput/APIDataFetchingConfigurationInterface";
5
+ import { InputFileType } from "../../formInput/FileUploadInputInterface";
6
+ import { RichTextEditorType } from "../../formInput/RichTextEditorInput";
7
+ import { LabelPosition } from "../../formInput/ToggleInputInterface";
8
+ import { AllFormInputPrimaryKeys, SpecialElementKeys } from "../FormInputKeys";
9
+ import { BlurHandleTypes, ElementEditorTypes } from "../elementEditor";
10
+ export var ElementConfig = {
11
+ editorSections: [
12
+ {
13
+ label: 'Basic Configuration',
14
+ id: "4bc757c5-5830-4135-9bdc-df4d1aace7f1",
15
+ showItemValue: 'label',
16
+ elements: [
17
+ {
18
+ name: SpecialElementKeys.Default,
19
+ deepBind: [AllFormInputPrimaryKeys.ColSize],
20
+ id: "bcc00a6b-4323-4cc8-9cb6-b3efc0aedfd2",
21
+ editType: ElementEditorTypes.Range,
22
+ min: 1,
23
+ max: 12,
24
+ step: 1,
25
+ format: (value) => `${(value / 12) * 100} %`,
26
+ hint: `The size determines the width of the input column in the form.
27
+ A column size of 12 will take up the full width of the form, while a column size of 4 will take up a third of the form.
28
+ `,
29
+ label: 'Input column size',
30
+ },
31
+ {
32
+ name: SpecialElementKeys.Default,
33
+ deepBind: [AllFormInputPrimaryKeys.Label],
34
+ editType: ElementEditorTypes.Input,
35
+ id: "cbe76f17-7a33-481e-b945-38ba146ea194",
36
+ label: 'Input label',
37
+ blurHandle: BlurHandleTypes.PrePopulateFormControl,
38
+ },
39
+ {
40
+ name: SpecialElementKeys.Default,
41
+ deepBind: [AllFormInputPrimaryKeys.FormControlName],
42
+ id: "8db68cde-52ca-4be6-9db9-e0d53217f00a",
43
+ hint: 'The form control is an inputs unique identifier in the form group, and should be in CamelCase',
44
+ editType: ElementEditorTypes.Input,
45
+ label: 'Control name ',
46
+ blurHandle: BlurHandleTypes.CleanFormControl,
47
+ },
48
+ {
49
+ name: AllFormInputPrimaryKeys.Appearance,
50
+ deepBind: [AllFormInputPrimaryKeys.Appearance],
51
+ hint: 'Choose between filled or outlined input styling',
52
+ id: 'a768dbcd-97e3-42c6-9299-b6b49842d813',
53
+ editType: ElementEditorTypes.OptionSelect,
54
+ options: ['fill', 'outline'].map((type) => ({ label: type, value: type })),
55
+ label: 'Appearance',
56
+ },
57
+ {
58
+ name: SpecialElementKeys.Default,
59
+ deepBind: [AllFormInputPrimaryKeys.Required],
60
+ id: '99cd6f5a-2bca-4cfb-832a-6ec2a9da40ae',
61
+ editType: ElementEditorTypes.Toggle,
62
+ label: 'Input is required',
63
+ },
64
+ {
65
+ name: AllFormInputPrimaryKeys.StartDateControl,
66
+ id: "73b3f981-9f7d-4361-9aee-4507e20bf255",
67
+ editType: ElementEditorTypes.Input,
68
+ deepBind: [AllFormInputPrimaryKeys.StartDateControl],
69
+ blurHandle: BlurHandleTypes.CleanFormControl,
70
+ disabled: [
71
+ //Don't allow editing if the form control name is already set
72
+ {
73
+ deepBind: [AllFormInputPrimaryKeys.Id],
74
+ testType: 'exists'
75
+ },
76
+ ],
77
+ hint: "Because a date range has two values representing the start end end value, you need to assign a form control name to the start date input.",
78
+ label: 'Start Date Control name',
79
+ },
80
+ {
81
+ name: AllFormInputPrimaryKeys.EndDateControl,
82
+ deepBind: [AllFormInputPrimaryKeys.EndDateControl],
83
+ id: "a50917da-9129-434a-b2db-316dea2ff0a7",
84
+ disabled: [
85
+ //Don't allow editing if the form control name is already set
86
+ {
87
+ deepBind: [AllFormInputPrimaryKeys.Id],
88
+ testType: 'exists'
89
+ },
90
+ ],
91
+ editType: ElementEditorTypes.Input,
92
+ blurHandle: BlurHandleTypes.CleanFormControl,
93
+ label: 'End Date Control name',
94
+ },
95
+ {
96
+ name: AllFormInputPrimaryKeys.Type,
97
+ editType: ElementEditorTypes.ChipSelect,
98
+ deepBind: [AllFormInputPrimaryKeys.Type],
99
+ id: "37e210dd-5e25-4bab-8a40-779770cf1f61",
100
+ label: 'Input type',
101
+ hint: 'The type of input determines the type of data that can be entered into the input',
102
+ options: Object.values(InputTypes).map((type) => ({ label: type, value: type })),
103
+ },
104
+ {
105
+ name: AllFormInputPrimaryKeys.FileType,
106
+ editType: ElementEditorTypes.OptionSelect,
107
+ deepBind: [AllFormInputPrimaryKeys.FileType],
108
+ id: "fdde0f7a-5d18-497f-998b-74957cb1dc22",
109
+ label: 'File Type',
110
+ options: Object.values(InputFileType).map((type) => ({ label: type, value: type })),
111
+ },
112
+ {
113
+ name: AllFormInputPrimaryKeys.SingleSelect,
114
+ editType: ElementEditorTypes.Toggle,
115
+ deepBind: [AllFormInputPrimaryKeys.SingleSelect],
116
+ id: "b475bbc9-6316-427b-ab03-830e03b83d81",
117
+ label: 'Restrict to a single upload',
118
+ },
119
+ {
120
+ name: AllFormInputPrimaryKeys.LabelPosition,
121
+ editType: ElementEditorTypes.OptionSelect,
122
+ id: "b70c056d-32d4-4fa0-918a-a0d4b5f84c94",
123
+ deepBind: [AllFormInputPrimaryKeys.LabelPosition],
124
+ label: 'Label position',
125
+ options: Object.values(LabelPosition).map((type) => ({ label: type, value: type })),
126
+ },
127
+ {
128
+ name: SpecialElementKeys.Default,
129
+ id: "e7be625c-f771-4c09-b121-32e1b1ce72b1",
130
+ deepBind: [AllFormInputPrimaryKeys.Min],
131
+ additionalTest: [
132
+ {
133
+ expression: `type === ${InputTypes.Number} || type === ${InputTypes.Date}`,
134
+ },
135
+ ],
136
+ editType: ElementEditorTypes.Input,
137
+ label: 'Minimum value',
138
+ },
139
+ {
140
+ name: SpecialElementKeys.Default,
141
+ deepBind: [AllFormInputPrimaryKeys.Max],
142
+ id: "04709d9d-53e8-4078-8833-425921cdc27c",
143
+ additionalTest: [
144
+ {
145
+ expression: `type === ${InputTypes.Number} || type === ${InputTypes.Date}`,
146
+ },
147
+ ],
148
+ editType: ElementEditorTypes.Input,
149
+ label: 'Maximum value',
150
+ },
151
+ {
152
+ name: AllFormInputPrimaryKeys.MinLength,
153
+ deepBind: [AllFormInputPrimaryKeys.MinLength],
154
+ editType: ElementEditorTypes.Input,
155
+ id: "a894e16f-2d7e-4dca-825f-452eef3aebcc",
156
+ label: 'Min length of characters',
157
+ },
158
+ {
159
+ name: AllFormInputPrimaryKeys.MaxLength,
160
+ deepBind: [AllFormInputPrimaryKeys.MaxLength],
161
+ editType: ElementEditorTypes.Input,
162
+ label: 'Max length of characters',
163
+ id: "9bc50894-5230-46f2-91de-b45673b3a80a"
164
+ },
165
+ {
166
+ name: AllFormInputPrimaryKeys.HandleLabel,
167
+ deepBind: [AllFormInputPrimaryKeys.HandleLabel],
168
+ editType: ElementEditorTypes.Input,
169
+ label: 'Handle label',
170
+ id: "3f056cc9-e639-4db7-aa41-3f96593356b2"
171
+ },
172
+ {
173
+ name: AllFormInputPrimaryKeys.MscoaConfig,
174
+ editType: ElementEditorTypes.Toggle,
175
+ label: 'Allow selection of all mscoa segments',
176
+ deepBind: ['mscoaConfig', 'showAllSegments'],
177
+ clearOnChange: [
178
+ [AllFormInputPrimaryKeys.MscoaConfig, 'segments'],
179
+ ],
180
+ hint: 'If enabled, the user can select any segment from the MScoa configuration',
181
+ id: "0f78efcc-5477-4202-916a-8a7cf459c017"
182
+ },
183
+ {
184
+ name: AllFormInputPrimaryKeys.MscoaConfig,
185
+ deepBind: ['mscoaConfig', 'segments'],
186
+ editType: ElementEditorTypes.ConfigMscoaSegments,
187
+ label: 'Configure MScoa segments',
188
+ fetchOptions: ['mscoaConfig', 'showAllSegments'],
189
+ id: "ba1a5b79-b071-44a6-b39a-bf1c2fafcda5"
190
+ },
191
+ {
192
+ name: AllFormInputPrimaryKeys.RichTextEditorLibrary,
193
+ editType: ElementEditorTypes.ChipSelect,
194
+ label: 'Rich text editor library',
195
+ deepBind: [AllFormInputPrimaryKeys.RichTextEditorLibrary],
196
+ additionalTest: [
197
+ {
198
+ expression: `element === ${ElementTypes.Editor}`,
199
+ deepBind: ['element'],
200
+ },
201
+ ],
202
+ options: Object.values(RichTextEditorType).map((type) => ({ label: type, value: type })),
203
+ id: "9e98d072-cea9-4ee0-a085-0a8998ec0d7a"
204
+ }
205
+ ],
206
+ },
207
+ {
208
+ label: 'Input value configurations',
209
+ id: "ce6e8786-45c3-4167-a84c-e871da0c13aa",
210
+ elements: [
211
+ {
212
+ name: AllFormInputPrimaryKeys.Value,
213
+ editType: ElementEditorTypes.Input,
214
+ label: 'Default value',
215
+ hint: 'Set a default value for the input',
216
+ deepBind: [AllFormInputPrimaryKeys.Value],
217
+ id: "791d7452-765c-47db-bb15-cd9b3c58a259"
218
+ },
219
+ {
220
+ name: AllFormInputPrimaryKeys.DataType,
221
+ deepBind: [AllFormInputPrimaryKeys.DataType],
222
+ editType: ElementEditorTypes.ChipSelect,
223
+ hint: 'The data type is the type of data that the input will hold.Data types are used to validate the input data',
224
+ label: 'Data value type',
225
+ id: "07e33ac0-ba36-48b9-989f-a33293f93051",
226
+ options: Object.values(InputDataTypes).map((type) => ({ label: type, value: type })),
227
+ },
228
+ {
229
+ name: SpecialElementKeys.Default,
230
+ editType: ElementEditorTypes.Toggle,
231
+ deepBind: [AllFormInputPrimaryKeys.Readonly],
232
+ label: 'Set as readonly field',
233
+ id: "cdc5173b-8464-4e03-b0fb-6258437fa50b"
234
+ },
235
+ {
236
+ name: AllFormInputPrimaryKeys.IServeInputWithRequisitionItems,
237
+ deepBind: ['iServeInputWithRequisitionItems'],
238
+ editType: ElementEditorTypes.FormInputSelector,
239
+ label: 'Select Input with requisitions',
240
+ id: "4a976294-451e-4501-a02a-b5df76254beb"
241
+ },
242
+ /// NOTE: Caluculated field rules
243
+ {
244
+ name: SpecialElementKeys.Default,
245
+ editType: ElementEditorTypes.Toggle,
246
+ deepBind: [AllFormInputPrimaryKeys.IsCalculatedField],
247
+ additionalTest: [
248
+ {
249
+ expression: `type === number`,
250
+ deepBind: ['type'],
251
+ },
252
+ ],
253
+ label: 'Is calculated field',
254
+ clearOnChange: [
255
+ ['calculatedFieldRules'],
256
+ ],
257
+ id: "6443ed57-665a-4d0e-8487-33a6e2278f27"
258
+ },
259
+ {
260
+ name: SpecialElementKeys.Default,
261
+ editType: ElementEditorTypes.CalculatedFieldRules,
262
+ label: 'Is calculated form field',
263
+ deepBind: ['calculatedFieldRules'],
264
+ fetchOptions: [],
265
+ additionalTest: [
266
+ {
267
+ expression: `isCalculatedField === true`,
268
+ deepBind: ['isCalculatedField'],
269
+ },
270
+ ],
271
+ id: "70aa312f-ee21-4970-a8a7-6fd6c9d572f1"
272
+ },
273
+ ],
274
+ },
275
+ {
276
+ label: 'Data mapping for value',
277
+ id: "d4d792af-c983-4587-a94f-781d7b963b4d",
278
+ elements: [
279
+ {
280
+ name: AllFormInputPrimaryKeys.MatOptions,
281
+ deepBind: ['matOptions', 'fetch', 'value', 'source'],
282
+ hint: `Choose data source for input values - affects how values are populated and which configuration options become available`,
283
+ editType: ElementEditorTypes.ChipSelect,
284
+ label: 'Select value source',
285
+ clearOnChange: [
286
+ ['matOptions', 'fetch', 'value'],
287
+ ],
288
+ options: [
289
+ { label: 'Form Input', value: DataSources.Local },
290
+ { label: 'Postman API', value: DataSources.Api },
291
+ { label: 'Data Pipeline', value: DataSources.MongoDb },
292
+ ],
293
+ id: "18361155-034d-40dd-a445-a493437ed5fc"
294
+ },
295
+ {
296
+ name: SpecialElementKeys.Default,
297
+ deepBind: ['matOptions', 'fetch', 'value', 'inputSourceId'],
298
+ editType: ElementEditorTypes.FormInputSelector,
299
+ hint: `Links this field to a source input: when the source input's value changes, this field will automatically update to match.This creates a dynamic connection between fields.`,
300
+ additionalTest: [
301
+ {
302
+ expression: `source === ${DataSources.Local}`,
303
+ deepBind: ['matOptions', 'fetch', 'value', 'source'],
304
+ },
305
+ ],
306
+ label: 'Select Input To fetch Data from',
307
+ id: "865658d5-6ba4-4402-952f-731cfaeefb76"
308
+ },
309
+ {
310
+ name: SpecialElementKeys.Default,
311
+ deepBind: ['matOptions', 'fetch', 'value'],
312
+ editType: ElementEditorTypes.ApiCall,
313
+ additionalTest: [
314
+ {
315
+ expression: `source === ${DataSources.Api}`,
316
+ deepBind: ['matOptions', 'fetch', 'value', 'source'],
317
+ },
318
+ ],
319
+ clearOnChange: [
320
+ ['matOptions', 'fetch', 'value'],
321
+ ],
322
+ hint: `APIs are loaded from Postman collection. Configure required headers, payload format, and response mapping before use. Ensure API is documented in Postman.`,
323
+ label: 'Select API to fetch data from',
324
+ id: "95724e64-9d5b-4260-866c-4ada95670b46"
325
+ },
326
+ {
327
+ name: SpecialElementKeys.Default,
328
+ deepBind: ['matOptions', 'fetch', 'value'],
329
+ editType: ElementEditorTypes.MongoPipelineBuilder,
330
+ hint: `MongoDb pipelines are used to fetch data from a MongoDb database.
331
+ Configure the pipeline to fetch the required data before use.`,
332
+ additionalTest: [
333
+ {
334
+ expression: `source === ${DataSources.MongoDb}`,
335
+ deepBind: ['matOptions', 'fetch', 'value', 'source'],
336
+ },
337
+ ],
338
+ label: 'Configure a MongoDb data pipeline',
339
+ id: "7b2989ae-2f54-4849-93d0-aff56ac12ef2"
340
+ },
341
+ {
342
+ name: SpecialElementKeys.Default,
343
+ deepBind: [
344
+ 'matOptions',
345
+ 'fetch',
346
+ 'value',
347
+ 'backEndConfig',
348
+ 'minimumInputRequired',
349
+ ],
350
+ additionalTest: [
351
+ {
352
+ testType: 'exists',
353
+ deepBind: [
354
+ 'matOptions',
355
+ 'fetch',
356
+ 'value',
357
+ 'backEndConfig',
358
+ 'minimumInputRequired',
359
+ ],
360
+ }
361
+ ],
362
+ hint: `These are payload fields that are required to be filled in order to fetch data from the selected source`,
363
+ editType: ElementEditorTypes.RequiredInputs,
364
+ label: 'Set up required inputs',
365
+ id: "2d0f1e18-897b-4c28-97bc-3078be09f8ee"
366
+ },
367
+ {
368
+ name: SpecialElementKeys.Default,
369
+ deepBind: ['matOptions', 'fetch', 'value', 'valueAccessRules'],
370
+ hint: `Map the fetched data to the input value. This is useful when the fetched data is an object and you want to map a specific field to the input value.It also allow data transformation before setting the value`,
371
+ fetchOptions: ['matOptions', 'fetch', 'value', '_id'],
372
+ additionalTest: [
373
+ {
374
+ testType: 'exists',
375
+ // Because only Api calls have value access rules
376
+ deepBind: ['matOptions', 'fetch', 'value'],
377
+ },
378
+ ],
379
+ editType: ElementEditorTypes.ApiValueAccessRules,
380
+ label: 'Map value to fetched data',
381
+ id: "26939f46-e8ed-404c-886e-2838495d56e6"
382
+ },
383
+ ]
384
+ },
385
+ {
386
+ label: 'Data Configuration for options',
387
+ id: "a283ec41-0397-494c-b78d-51c18414a343",
388
+ elements: [
389
+ {
390
+ name: AllFormInputPrimaryKeys.MatOptions,
391
+ deepBind: ['matOptions', 'fetch', 'options', 'source'],
392
+ editType: ElementEditorTypes.ChipSelect,
393
+ label: 'Select options source',
394
+ clearOnChange: [
395
+ ['matOptions', 'fetch', 'options'],
396
+ ],
397
+ options: [
398
+ { label: 'Custom options', value: DataSources.CustomOptions },
399
+ { label: 'Form Input', value: DataSources.Local },
400
+ { label: 'Postman API', value: DataSources.Api },
401
+ { label: 'Data Pipeline', value: DataSources.MongoDb },
402
+ ],
403
+ id: "114b794c-0288-4253-915c-ac8456191698"
404
+ },
405
+ {
406
+ name: SpecialElementKeys.Default,
407
+ deepBind: ['matOptions', 'options'],
408
+ additionalTest: [
409
+ {
410
+ expression: `source === ${DataSources.CustomOptions}`,
411
+ deepBind: ['matOptions', 'fetch', 'options', 'source'],
412
+ },
413
+ ],
414
+ editType: ElementEditorTypes.SelectionOptions,
415
+ label: 'Configure options',
416
+ id: "622142bb-9794-48a5-8cb7-4b503220259a"
417
+ },
418
+ {
419
+ name: SpecialElementKeys.MatOptionsItemType,
420
+ editType: ElementEditorTypes.ChipSelect,
421
+ label: 'Option item type',
422
+ deepBind: ['matOptions', 'optionType'],
423
+ additionalTest: [
424
+ {
425
+ expression: `element === select`,
426
+ deepBind: ['element'],
427
+ },
428
+ ],
429
+ options: [
430
+ { label: 'Text', value: 'text' },
431
+ { label: 'User', value: 'user' },
432
+ ],
433
+ id: "d46d9261-f777-4ff5-9436-c9f7b119f5e0"
434
+ },
435
+ {
436
+ name: SpecialElementKeys.Default,
437
+ deepBind: ['matOptions', 'fetch', 'options', 'inputSourceId'],
438
+ editType: ElementEditorTypes.FormInputSelector,
439
+ additionalTest: [
440
+ {
441
+ expression: `source === ${DataSources.Local}`,
442
+ deepBind: ['matOptions', 'fetch', 'options', 'source'],
443
+ },
444
+ ],
445
+ label: 'Select Input To fetch Options Data from',
446
+ id: "8c8e62ee-a4f0-4129-8e3b-8270669ff716"
447
+ },
448
+ {
449
+ name: SpecialElementKeys.Default,
450
+ deepBind: ['matOptions', 'fetch', 'options'],
451
+ additionalTest: [
452
+ {
453
+ expression: "source === mongoPipeline",
454
+ deepBind: ['matOptions', 'fetch', 'options', 'source'],
455
+ },
456
+ ],
457
+ editType: ElementEditorTypes.MongoPipelineBuilder,
458
+ label: 'Configure a MongoDb data pipeline',
459
+ id: "4e31a786-ec96-4b42-8156-31357958c032"
460
+ },
461
+ {
462
+ name: SpecialElementKeys.Default,
463
+ deepBind: ['matOptions', 'fetch', 'options'],
464
+ additionalTest: [
465
+ {
466
+ expression: "source === api",
467
+ deepBind: ['matOptions', 'fetch', 'options', 'source'],
468
+ },
469
+ ],
470
+ editType: ElementEditorTypes.ApiCall,
471
+ label: 'Select API to fetch data from',
472
+ id: "df9e2a34-7bf5-411e-a265-14ca4f85166d"
473
+ },
474
+ {
475
+ name: SpecialElementKeys.Default,
476
+ deepBind: [
477
+ 'matOptions',
478
+ 'fetch',
479
+ 'options',
480
+ 'backEndConfig',
481
+ 'minimumInputRequired',
482
+ ],
483
+ additionalTest: [
484
+ {
485
+ testType: 'exists',
486
+ deepBind: [
487
+ 'matOptions',
488
+ 'fetch',
489
+ 'options',
490
+ 'backEndConfig',
491
+ 'minimumInputRequired',
492
+ ],
493
+ }
494
+ ],
495
+ editType: ElementEditorTypes.RequiredInputs,
496
+ label: 'Set up required inputs',
497
+ id: "ce8f3b42-340d-4f3e-8d6a-13c93251173f"
498
+ },
499
+ {
500
+ name: SpecialElementKeys.Default,
501
+ deepBind: ['matOptions', 'fetch', 'options', 'valueAccessRules'],
502
+ fetchOptions: ['matOptions', 'fetch', 'options', '_id'],
503
+ additionalTest: [
504
+ {
505
+ testType: 'exists',
506
+ deepBind: ['matOptions', 'fetch', 'options'],
507
+ },
508
+ ],
509
+ editType: ElementEditorTypes.ApiValueAccessRules,
510
+ label: 'Map option value to fetched data',
511
+ id: "e24ce283-4cea-497e-b692-feeb4f3afbed"
512
+ },
513
+ ]
514
+ },
515
+ {
516
+ label: 'Validation & Formatting',
517
+ id: "1d3149de-d1e9-4b51-93c4-5cb82e51107c",
518
+ elements: [
519
+ {
520
+ name: SpecialElementKeys.Default,
521
+ editType: ElementEditorTypes.Toggle,
522
+ deepBind: [AllFormInputPrimaryKeys.OnlySetTempErrorOnTouch],
523
+ label: 'Set temporary errors only on touch',
524
+ hint: 'If enabled, the input will only show errors when the user interacts with the input',
525
+ id: "264bf529-c0f1-4393-b6fd-1d5eb48fce91"
526
+ },
527
+ {
528
+ name: SpecialElementKeys.Default,
529
+ editType: ElementEditorTypes.Input,
530
+ deepBind: [AllFormInputPrimaryKeys.HintLabel],
531
+ label: 'Input hint',
532
+ id: "6a047c2f-ff33-4154-8c07-90d5272346a4"
533
+ },
534
+ {
535
+ name: AllFormInputPrimaryKeys.TourContent,
536
+ editType: ElementEditorTypes.Input,
537
+ deepBind: [AllFormInputPrimaryKeys.TourContent,],
538
+ label: 'App tour message',
539
+ id: "a72704ba-d2a9-4884-bc90-14dac84b7d23"
540
+ },
541
+ {
542
+ name: AllFormInputPrimaryKeys.Spellcheck,
543
+ editType: ElementEditorTypes.Toggle,
544
+ deepBind: [AllFormInputPrimaryKeys.Spellcheck],
545
+ label: 'Enable spellcheck',
546
+ id: "ca2cf43b-8614-4a5e-b664-3cf96b9d239f"
547
+ },
548
+ {
549
+ name: SpecialElementKeys.DefaultValuePipe,
550
+ editType: ElementEditorTypes.ChipSelect,
551
+ label: 'Add a value pipe',
552
+ deepBind: ['pipe', 'pipeType'],
553
+ additionalTest: [
554
+ {
555
+ expression: `type === ${InputTypes.Number}`,
556
+ deepBind: ['type'],
557
+ },
558
+ ],
559
+ id: "328e8d2b-86a9-4ccd-8adc-635393c1c3a9",
560
+ options: Object.values(InputPipeTypes).map((type) => ({ label: type, value: type })),
561
+ },
562
+ {
563
+ name: SpecialElementKeys.DefaultCurrencySelect,
564
+ editType: ElementEditorTypes.OptionSelect,
565
+ deepBind: ['pipe', 'param'],
566
+ label: 'Select currency to apply',
567
+ options: CurrenciesList,
568
+ id: "209d2295-cbaa-4f99-98d2-15c4515581b8",
569
+ additionalTest: [
570
+ {
571
+ expression: `type === ${InputTypes.Number}`,
572
+ deepBind: ['type'],
573
+ },
574
+ {
575
+ expression: `pipeType === ${InputPipeTypes.Currency}`,
576
+ deepBind: ['pipe', 'pipeType'],
577
+ },
578
+ ],
579
+ },
580
+ {
581
+ name: SpecialElementKeys.DefaultValuePipe,
582
+ editType: ElementEditorTypes.OptionSelect,
583
+ deepBind: ['pipe', 'param'],
584
+ label: 'Select date format',
585
+ options: DatePipeOptions,
586
+ additionalTest: [
587
+ {
588
+ expression: `pipeType === ${InputPipeTypes.Date}`,
589
+ deepBind: ['pipe', 'pipeType'],
590
+ },
591
+ ],
592
+ id: "36b8e1e1-625b-422a-8aa8-b594f3524bcc"
593
+ },
594
+ {
595
+ name: SpecialElementKeys.DefaultDecimalNumberInput,
596
+ editType: ElementEditorTypes.Input,
597
+ label: 'Decimal numbers',
598
+ deepBind: ['pipe', 'param'],
599
+ additionalTest: [
600
+ {
601
+ expression: `type === ${InputTypes.Number}`,
602
+ deepBind: ['type'],
603
+ },
604
+ {
605
+ expression: `pipeType === ${InputPipeTypes.Decimal}`,
606
+ deepBind: ['pipe', 'pipeType'],
607
+ },
608
+ ],
609
+ id: "d0771f0e-eaec-457c-a2f4-e454fd9092c7"
610
+ },
611
+ {
612
+ name: SpecialElementKeys.Default,
613
+ editType: ElementEditorTypes.Input,
614
+ label: "On change event",
615
+ deepBind: ['script', 'onChange'],
616
+ id: "cece038b-66b2-4e23-b3a3-01902ff342c3"
617
+ },
618
+ {
619
+ name: AllFormInputPrimaryKeys.Validators,
620
+ editType: ElementEditorTypes.Validators,
621
+ label: 'Add Validators',
622
+ deepBind: ['validators'],
623
+ id: "babd1b19-aa49-41b6-bd06-1c34ea2b9fe0"
624
+ },
625
+ ],
626
+ },
627
+ ],
628
+ };
629
+ export const getElementEditorConfig = deepCopy(ElementConfig);
630
+ function deepCopy(obj) {
631
+ if (obj === null || typeof obj !== 'object') {
632
+ return obj;
633
+ }
634
+ if (Array.isArray(obj)) {
635
+ return obj.map(item => deepCopy(item));
636
+ }
637
+ const copy = {};
638
+ for (const key in obj) {
639
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
640
+ copy[key] = deepCopy(obj[key]);
641
+ }
642
+ }
643
+ return copy;
644
+ }
@@ -0,0 +1,37 @@
1
+ import { ElementTypes, InputDataTypes, MinInputTypes } from "../../formInput";
2
+ import { DataSources } from "../../formInput/APIDataFetchingConfigurationInterface";
3
+ import { ElementEditorTypes } from "../elementEditor";
4
+ function elementValue(element) {
5
+ const editType = element.editType;
6
+ switch (editType) {
7
+ case ElementEditorTypes.ApiCall:
8
+ return {
9
+ valueAccessRules: [],
10
+ source: DataSources.Api,
11
+ _id: '89445d2e-ea0a-4207-a393-e7b0a83e9f690',
12
+ name: 'Api Call',
13
+ httpEndPoint: 'localhost:3000/api',
14
+ httpMethod: 'POST',
15
+ postFormData: true,
16
+ backEndConfig: {
17
+ minimumInputRequired: [
18
+ {
19
+ name: 'value',
20
+ type: MinInputTypes.MapTo,
21
+ mapTo: [
22
+ {
23
+ formControlName: 'value',
24
+ dataType: InputDataTypes.String,
25
+ element: ElementTypes.Input
26
+ }
27
+ ],
28
+ }
29
+ ]
30
+ }
31
+ };
32
+ case ElementEditorTypes.
33
+ default:
34
+ return 'text';
35
+ break;
36
+ }
37
+ }