@componyx/ui 0.0.0-stage → 1.0.4

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 (169) hide show
  1. package/AppSkin/AppSkin.css +1268 -0
  2. package/AppSkin/AppSkin.js +2748 -0
  3. package/AppSkin/Themes/Default.css +241 -0
  4. package/Base/Base.js +3407 -0
  5. package/Base/ComponentIcons.css +66 -0
  6. package/Base/Font/ComponentIcons.woff +0 -0
  7. package/Base/Font/UI.woff +0 -0
  8. package/Base/Library.js +8432 -0
  9. package/Base/NavigationManager.js +462 -0
  10. package/Base/ResponsiveTemplates.js +371 -0
  11. package/Base/Sanitizer.js +288 -0
  12. package/Base/Themes/Default.css +255 -0
  13. package/Base/UI.css +618 -0
  14. package/Base/UIResourcePath.js +6 -0
  15. package/Bindary/Bindary.js +2011 -0
  16. package/Bindary/Modules/Connection.js +216 -0
  17. package/Bindary/Modules/Core.js +854 -0
  18. package/Bindary/Modules/DataUpdater.js +351 -0
  19. package/Bindary/Modules/ExpressionEngine.js +347 -0
  20. package/Bindary/Modules/ProxyManager.js +482 -0
  21. package/Bindary/Modules/Renderer.js +605 -0
  22. package/Bindary/Modules/Router.js +291 -0
  23. package/Bindary/Modules/Scroller.js +89 -0
  24. package/Bindary/Modules/Template.js +1273 -0
  25. package/BookmarkSpy/BookmarkSpy.js +430 -0
  26. package/Box/Box.css +36 -0
  27. package/Box/Box.js +1685 -0
  28. package/Button/Button.css +470 -0
  29. package/Button/Button.js +1398 -0
  30. package/Button/Themes/Default.css +200 -0
  31. package/Carousel/Carousel.css +273 -0
  32. package/Carousel/Carousel.js +607 -0
  33. package/ColorButton/ColorButton.css +39 -0
  34. package/ColorButton/ColorButton.js +336 -0
  35. package/ColorPicker/ColorPicker.css +359 -0
  36. package/ColorPicker/ColorPicker.js +972 -0
  37. package/ComboBox/ComboBox.css +357 -0
  38. package/ComboBox/ComboBox.js +2342 -0
  39. package/ComboBox/Themes/Default.css +23 -0
  40. package/DataPager/DataPager.css +72 -0
  41. package/DataPager/DataPager.js +674 -0
  42. package/DatePicker/DatePicker.css +227 -0
  43. package/DatePicker/DatePicker.js +1531 -0
  44. package/DatePicker/Themes/Default.css +26 -0
  45. package/Dialog/Dialog.css +106 -0
  46. package/Dialog/Dialog.js +572 -0
  47. package/Dialog/Themes/Default.css +10 -0
  48. package/Editor/Data/Emoji.json +8285 -0
  49. package/Editor/Data/Special.json +1042 -0
  50. package/Editor/Editor.css +1562 -0
  51. package/Editor/Editor.js +4058 -0
  52. package/Editor/Font/Editor.woff +0 -0
  53. package/Editor/Modules/ComponentFactory.js +565 -0
  54. package/Editor/Modules/ContentManager.js +748 -0
  55. package/Editor/Modules/DialogManager.js +1234 -0
  56. package/Editor/Modules/EventManager.js +458 -0
  57. package/Editor/Modules/Format.js +950 -0
  58. package/Editor/Modules/History.js +191 -0
  59. package/Editor/Modules/LayoutState.js +379 -0
  60. package/Editor/Modules/ListManager.js +296 -0
  61. package/Editor/Modules/MenuManager.js +388 -0
  62. package/Editor/Modules/NodeManager.js +681 -0
  63. package/Editor/Modules/ParagraphButtons.js +122 -0
  64. package/Editor/Modules/Resizer.js +176 -0
  65. package/Editor/Modules/SelectionRange.js +564 -0
  66. package/Editor/Modules/SourceViewBuilder.js +212 -0
  67. package/Editor/Modules/SymbolPicker.js +208 -0
  68. package/Editor/Modules/Table.js +2327 -0
  69. package/Editor/Modules/TableDialog.js +757 -0
  70. package/Editor/Modules/Toolbar.js +375 -0
  71. package/Editor/Modules/TooltipMenu.js +125 -0
  72. package/Editor/Modules/Utility.js +131 -0
  73. package/Editor/Themes/Default.css +204 -0
  74. package/FileUpload/FileUpload.css +156 -0
  75. package/FileUpload/FileUpload.js +898 -0
  76. package/FileUpload/Themes/Default.css +17 -0
  77. package/Form/Form.css +1934 -0
  78. package/Form/Form.js +4943 -0
  79. package/Form/Modules/ActionManager.js +368 -0
  80. package/Form/Modules/BuildPanelManager.js +319 -0
  81. package/Form/Modules/ComponentFactory.js +468 -0
  82. package/Form/Modules/ComponentPanel.js +265 -0
  83. package/Form/Modules/ConfigPanelManager.js +685 -0
  84. package/Form/Modules/DataBinder.js +602 -0
  85. package/Form/Modules/DataObserver.js +717 -0
  86. package/Form/Modules/Draggable.js +756 -0
  87. package/Form/Modules/OptionsPanel.js +342 -0
  88. package/Form/Modules/Renderer.js +1889 -0
  89. package/Form/Modules/RuleEngine.js +585 -0
  90. package/Form/Modules/RulesPanel.js +1158 -0
  91. package/Form/Modules/Types.js +1709 -0
  92. package/Form/Modules/ValidationManager.js +194 -0
  93. package/Form/Themes/Default.css +216 -0
  94. package/FormField/FormField.css +468 -0
  95. package/FormField/FormField.js +576 -0
  96. package/FormField/Themes/Default.css +99 -0
  97. package/Grid/Grid.css +544 -0
  98. package/Grid/Grid.js +3761 -0
  99. package/Grid/Themes/Default.css +43 -0
  100. package/LICENSE +126 -0
  101. package/MaskedTextBox/MaskedTextBox.css +28 -0
  102. package/MaskedTextBox/MaskedTextBox.js +642 -0
  103. package/MaskedTextBox/Themes/Default.css +6 -0
  104. package/Menu/Menu.css +328 -0
  105. package/Menu/Menu.js +2386 -0
  106. package/Menu/Themes/Default.css +24 -0
  107. package/NumericBox/NumericBox.css +120 -0
  108. package/NumericBox/NumericBox.js +984 -0
  109. package/PanelBar/PanelBar.css +123 -0
  110. package/PanelBar/PanelBar.js +505 -0
  111. package/PanelBar/Themes/Default.css +51 -0
  112. package/PieChart/PieChart.css +95 -0
  113. package/PieChart/PieChart.js +820 -0
  114. package/PieChart/Themes/Default.css +9 -0
  115. package/README.md +178 -3
  116. package/Slider/Slider.css +348 -0
  117. package/Slider/Slider.js +1306 -0
  118. package/Slider/Themes/Default.css +44 -0
  119. package/TabStrip/TabStrip.css +52 -0
  120. package/TabStrip/TabStrip.js +362 -0
  121. package/TabStrip/Themes/Default.css +35 -0
  122. package/TimePicker/Themes/Default.css +30 -0
  123. package/TimePicker/TimePicker.css +253 -0
  124. package/TimePicker/TimePicker.js +1485 -0
  125. package/TooltipManager/Themes/Default.css +21 -0
  126. package/TooltipManager/TooltipManager.css +227 -0
  127. package/TooltipManager/TooltipManager.js +791 -0
  128. package/Validator/Validator.css +54 -0
  129. package/Validator/Validator.js +2508 -0
  130. package/componyx.html-data.json +619 -0
  131. package/index.js +27 -0
  132. package/package.json +43 -4
  133. package/types/AppSkin.d.ts +842 -0
  134. package/types/Base.d.ts +1034 -0
  135. package/types/Bindary.d.ts +1196 -0
  136. package/types/BookmarkSpy.d.ts +112 -0
  137. package/types/Box.d.ts +374 -0
  138. package/types/Button.d.ts +455 -0
  139. package/types/Carousel.d.ts +136 -0
  140. package/types/ColorButton.d.ts +120 -0
  141. package/types/ColorPicker.d.ts +225 -0
  142. package/types/ComboBox.d.ts +507 -0
  143. package/types/DataPager.d.ts +152 -0
  144. package/types/DatePicker.d.ts +354 -0
  145. package/types/Dialog.d.ts +160 -0
  146. package/types/Editor.d.ts +1289 -0
  147. package/types/FileUpload.d.ts +206 -0
  148. package/types/Form.d.ts +3078 -0
  149. package/types/FormField.d.ts +204 -0
  150. package/types/Grid.d.ts +911 -0
  151. package/types/Library.d.ts +1899 -0
  152. package/types/MaskedTextBox.d.ts +91 -0
  153. package/types/Menu.d.ts +577 -0
  154. package/types/NumericBox.d.ts +310 -0
  155. package/types/PanelBar.d.ts +223 -0
  156. package/types/PieChart.d.ts +224 -0
  157. package/types/ResponsiveTemplates.d.ts +108 -0
  158. package/types/Slider.d.ts +227 -0
  159. package/types/TabStrip.d.ts +185 -0
  160. package/types/TimePicker.d.ts +265 -0
  161. package/types/TooltipManager.d.ts +178 -0
  162. package/types/UI.d.ts +29 -0
  163. package/types/Validator.d.ts +653 -0
  164. package/types/index.d.ts +59 -0
  165. package/ui.css +11783 -0
  166. package/ui.js +79477 -0
  167. package/ui.min.css +138 -0
  168. package/ui.min.js +264 -0
  169. package/ui.min.js.map +1 -0
@@ -0,0 +1,468 @@
1
+ /*! Componyx.UI | (c) E.H. Daanen / Componyx | BUSL-1.1 | componyx.com/license */
2
+ componyx.UI.form_modules = componyx.UI.form_modules || {};
3
+ componyx.UI.form_modules.ComponentFactory = class ComponentFactory
4
+ {
5
+ #classOption;
6
+ constructor(form)
7
+ {
8
+ this.form = form;
9
+ this.InputTypeOption = this.form.constructor.InputTypeOption;
10
+ this.#classOption = form.classOption;
11
+ }
12
+
13
+ getComponentType(type)
14
+ {
15
+ return componyx.UI[this.InputTypeOption.getName(type)];
16
+ }
17
+
18
+ createElement(id)
19
+ {
20
+ const el = $lib(`#${id}`);
21
+
22
+ if (el)
23
+ return el;
24
+ else
25
+ return $lib.element(this.form, '', '', '', '', { id: `${id}` }); // temporary place inside form container, element will be moved into form-field field template
26
+ }
27
+
28
+ setAttribute(element, attr, value = '')
29
+ {
30
+ element.setAttribute(attr, value);
31
+ }
32
+
33
+ createInput({ type, id, name, value, placeholder, checked, disabled, events, container })
34
+ {
35
+ const el = $lib.element(container, '', type === 'textarea' ? 'textarea' : 'input', '', '', {
36
+ type: type !== 'textarea' ? type : undefined,
37
+ id: id || undefined,
38
+ name,
39
+ value: (!$lib.isEmpty(value)) ? value : undefined,
40
+ placeholder: (!$lib.isEmpty(placeholder)) ? placeholder : undefined,
41
+ checked: checked === true ? true : undefined,
42
+ disabled: disabled === true ? true : undefined
43
+ });
44
+
45
+ $lib.each(events, (handler, eventType) =>
46
+ {
47
+ $lib.on(el, eventType, handler);
48
+ });
49
+
50
+ return el;
51
+ }
52
+
53
+ createTextarea(id, name, value, placeholder, events)
54
+ {
55
+ return this.createInput({ type: 'textarea', id, name, value, placeholder, events });
56
+ }
57
+
58
+ createCheckbox(id, name, value, checked, events)
59
+ {
60
+ return this.createInput({ type: 'checkbox', id, name, value, checked, events });
61
+ }
62
+
63
+ createRadio(id, name, value, checked, events)
64
+ {
65
+ return this.createInput({ type: 'radio', id, name, value, checked, events });
66
+ }
67
+
68
+ createTextInput(id, name, value, placeholder, events)
69
+ {
70
+ return this.createInput({ type: 'text', id, name, value, placeholder, events });
71
+ }
72
+
73
+ createHiddenInput(id)
74
+ {
75
+ return this.createInput({ type: 'hidden', container: this.form, id: id });
76
+ }
77
+
78
+ createDragHandle(container)
79
+ {
80
+ const dragHandle = $lib.element(container, '', '', '', { "class": this.form.getCssClass(this.#classOption.DRAG_HANDLE) });
81
+ dragHandle.innerHTML = '<b></b><b></b><b></b>';
82
+ }
83
+
84
+ createNumericBox(container, id, cloneId, config)
85
+ {
86
+ config.decimalSeparator = this.form.format.decimalSeparator;
87
+ config.groupSeparator = this.form.format.groupSeparator;
88
+
89
+ return this.createComponent(container, this.getComponentType(this.InputTypeOption.NUMERICBOX), this.createElement(id).id, cloneId, config);
90
+ }
91
+
92
+ createComboBox(container, id, cloneId, config = {}, noResultLabel)
93
+ {
94
+ if (!config.placeholder)
95
+ config.placeholder = this.form.labels.comboBoxDefaultHint;
96
+
97
+ const combo = this.createComponent(container, this.getComponentType(this.InputTypeOption.COMBOBOX), this.createElement(id).id, cloneId, config);
98
+
99
+ if (noResultLabel)
100
+ combo.setNoResultTemplate(config.noResultLabel);
101
+
102
+ return combo;
103
+ }
104
+
105
+ createColorButton(container, id, cloneId, config)
106
+ {
107
+ return this.createComponent(container, componyx.UI.ColorButton, this.createElement(id).id, cloneId, config);
108
+ }
109
+
110
+ createButton(container, id, cloneId, config)
111
+ {
112
+ return this.createComponent(container, componyx.UI.Button, id, cloneId, {
113
+ ...config,
114
+ transparent: $lib.isEmpty(config.transparent) ? true : config.transparent,
115
+ transparentBorder: $lib.isEmpty(config.transparentBorder) ? true : config.transparentBorder,
116
+ primary: $lib.isEmpty(config.primary) ? false : config.primary,
117
+ hasIcon: !$lib.isEmpty(config.cssClassIcon),
118
+ cssClassIcon: `${this.form.getCssClass(this.#classOption.ICON)} ${config.cssClassIcon}`,
119
+ tooltipManagerId: this.form.tooltipManager.id,
120
+ tooltipId: this.addTooltip(id.replace(`${this.form.id}_`, ''), config),
121
+ command: config.command,
122
+ renderId: false,
123
+ });
124
+ }
125
+
126
+ addTooltip(id, config)
127
+ {
128
+ let key = config.key,
129
+ text = config.tooltip || '';
130
+
131
+ if (key && !config.tooltip)
132
+ text += ` (Ctrl+${key.toUpperCase()})`;
133
+
134
+ if (text)
135
+ {
136
+ this.form.tooltipManager.addTooltip(id, text);
137
+ return id;
138
+ }
139
+
140
+ return null;
141
+ }
142
+
143
+ createFormField(container, id, cloneId, label, fieldTemplate, config = {}, postRender)
144
+ {
145
+ const formField = this.createComponent(container, componyx.UI.FormField, id, cloneId, {
146
+ ...config,
147
+ wrapFieldContent: (fieldTemplate && fieldTemplate.nodeName === 'INPUT' || fieldTemplate.nodeName === 'TEXTAREA') ? false : true, // no need to wrap direct input fields
148
+ tooltipManagerId: (config.tooltipId) ? this.form.tooltipManager.id : null,
149
+ borderless: false,
150
+ events: {
151
+ onPostRender: (formField) =>
152
+ {
153
+ if (postRender)
154
+ postRender(formField);
155
+ }
156
+ },
157
+ _mustRender: false
158
+ });
159
+
160
+ formField.setLabelTemplate(label);
161
+ formField.setFieldTemplate(fieldTemplate);
162
+
163
+ if (this.form.renderState === $base.static.RenderState.RENDERED)
164
+ formField.render();
165
+
166
+ if (this.form.displayMode === this.form.constructor.DisplayModeOption.BUILD)
167
+ formField.element.tabIndex = 0;
168
+
169
+ return formField;
170
+ }
171
+
172
+ createTooltipManager(container, id, cloneId, config = {})
173
+ {
174
+ const tooltipBox = $UI.createComponent(componyx.UI.Box, {
175
+ id: id + '_TooltipManagerBox',
176
+ containerElement: container,
177
+ cssClass: this.form.getCssClass(this.#classOption.FIELD_TOOLTIP),
178
+ expandDirection: componyx.UI.Box.ExpandDirectionOption.DOWN,
179
+ autoPosition: componyx.UI.Box.AutoPositionOption.EXPAND,
180
+ alignX: componyx.UI.Box.AlignXOption.CENTER,
181
+ autoInvertFit: true
182
+ });
183
+
184
+ return this.createComponent(container, componyx.UI.TooltipManager, id, cloneId, { ...config, boxId: tooltipBox.id, _mustRender: false });
185
+ }
186
+
187
+ createComponent(container, type, id, cloneId, config = {})
188
+ {
189
+ const component = $UI.createComponent(type, { id: id, containerElement: container });
190
+
191
+ component.clone($UI.store[cloneId], this.form);
192
+
193
+ const { events, ...restSettings } = config;
194
+ Object.assign(component, Object.fromEntries(Object.entries(restSettings).filter(([k, v]) => v !== undefined))); // don't assign undefined properties
195
+
196
+ if (config._disableDataBinding !== true)
197
+ {
198
+ if ((component.hiddenInputId !== undefined && $lib.isEmpty(component.hiddenInputId))
199
+ || (component.inputId !== undefined && $lib.isEmpty(component.hiddenInputId))) // set the setting attribute on the input to enable data binding via the DataBinder
200
+ {
201
+ let hiddenId = `${id}_value`,
202
+ hiddenInput = $lib(`#${hiddenId}`);
203
+
204
+ if (!hiddenInput)
205
+ {
206
+ hiddenInput = this.createHiddenInput(hiddenId);
207
+
208
+ if (this.form.isBuildMode())
209
+ this.setAttribute(hiddenInput, 'data-ui-form-setting');
210
+ }
211
+
212
+ if (component.hiddenInputId !== undefined)
213
+ component.hiddenInputId = hiddenInput.id;
214
+ else if (component.inputId !== undefined)
215
+ component.inputId = hiddenInput.id;
216
+ }
217
+ }
218
+
219
+ component.keepInputId = true;
220
+ component.cloneInput = false;
221
+ component.ignoreConnectionCallbacks = true;
222
+ component.showing = (!$lib.isEmpty(config.showing)) ? config.showing : true;
223
+
224
+ if (events && typeof events === 'object')
225
+ {
226
+ for (const [eventName, handler] of Object.entries(events))
227
+ {
228
+ if (!eventName || !handler)
229
+ continue;
230
+
231
+ if (component.events?.[eventName]?.priorityAdd)
232
+ {
233
+ component.events[eventName].priorityAdd(handler);
234
+ }
235
+ }
236
+ }
237
+
238
+ component.events.onPostRender.priorityAdd(() => { this.form.isReady(); }, null, true); // Mark form ready after internal postRender events, avoiding global postRender call
239
+
240
+ if (this.form.renderState === $base.static.RenderState.RENDERED && config._mustRender !== false)
241
+ component.render();
242
+
243
+ return component;
244
+ }
245
+
246
+ getComponentConfig(field, allowSelection = true)
247
+ {
248
+ const config = {
249
+ name: field.name,
250
+ value: field.value,
251
+ placeholder: field.placeholder,
252
+ events: {}
253
+ };
254
+
255
+ if (field.inputType === this.InputTypeOption.MASKEDTEXTBOX)
256
+ {
257
+ this.configureMaskedTextBox(field, config);
258
+ }
259
+ else if (field.inputType === this.InputTypeOption.NUMERICBOX)
260
+ {
261
+ this.configureNumericBox(field, config);
262
+ }
263
+ else if (field.inputType === this.InputTypeOption.COMBOBOX)
264
+ {
265
+ this.configureComboBox(field, config, allowSelection);
266
+ }
267
+ else if (field.inputType === this.InputTypeOption.DATEPICKER)
268
+ {
269
+ this.configureDatePicker(field, config);
270
+ }
271
+ else if (field.inputType === this.InputTypeOption.TIMEPICKER)
272
+ {
273
+ this.configureTimePicker(field, config);
274
+ }
275
+ else if (field.inputType === this.InputTypeOption.SLIDER)
276
+ {
277
+ this.configureSlider(field, config);
278
+ }
279
+ else if (field.inputType === this.InputTypeOption.FILEUPLOAD)
280
+ {
281
+ this.configureFileUpload(field, config);
282
+ }
283
+ else if (field.inputType === this.InputTypeOption.EDITOR)
284
+ {
285
+ this.configureEditor(field, config);
286
+ }
287
+
288
+ return config;
289
+ }
290
+
291
+ configureMaskedTextBox(field, config = {})
292
+ {
293
+ const settings = field.componentSettings || {},
294
+ defaults = { allowedCharacters: 0 };
295
+
296
+ return this.#configureComponentConfig(settings, config, defaults);
297
+ }
298
+
299
+ configureNumericBox(field, config = {})
300
+ {
301
+ const settings = field.componentSettings || {};
302
+
303
+ config.decimalSeparator = this.form.format.decimalSeparator;
304
+ config.groupSeparator = this.form.format.groupSeparator;
305
+
306
+ return this.#configureComponentConfig(settings, config);
307
+ }
308
+
309
+ configureComboBox(field, config = {}, allowSelection = true)
310
+ {
311
+ const settings = field.componentSettings || {};
312
+
313
+ this.#configureComponentConfig(settings, config);
314
+
315
+ if (field.dataSourceId)
316
+ {
317
+ config.loadOnDemand = true;
318
+ this.configureDataSource(config, field.dataSourceId);
319
+ }
320
+ else if (!$lib.isEmpty(field.options))
321
+ {
322
+ config.itemList = field.options.map(option =>
323
+ {
324
+ this.form.ensureItemId(option);
325
+ return { id: option.id, text: option.label, value: option.value, selected: (allowSelection) ? option.selected : false, disabled: option.disabled };
326
+ });
327
+ }
328
+
329
+ if (this.form.isBuildMode())
330
+ {
331
+ config.events = {
332
+ onPostRender: (comboBox) =>
333
+ {
334
+ this.form.updateFieldOptions(field);
335
+ }
336
+ };
337
+ }
338
+
339
+ return config;
340
+ }
341
+
342
+ configureDatePicker(field, config = {})
343
+ {
344
+ const settings = field.componentSettings || {};
345
+
346
+ config.dateFormat = this.form.format.dateFormat;
347
+ return this.#configureComponentConfig(settings, config);
348
+ }
349
+
350
+ configureTimePicker(field, config = {})
351
+ {
352
+ const settings = field.componentSettings || {},
353
+ defaults = { incrementalValue: 5 };
354
+ return this.#configureComponentConfig(settings, config, defaults);
355
+ }
356
+
357
+ configureSlider(field, config = {})
358
+ {
359
+ const settings = field.componentSettings || {};
360
+
361
+ this.#configureComponentConfig(settings, config);
362
+
363
+ if (settings.range)
364
+ {
365
+ const el = $lib.element({ container: this.form, tag: 'input', props: { id: `${field.id}_Range`, type: 'hidden' } }); // we need to create a hidden input for data-binding
366
+ config.rangeHiddenInputId = el.id;
367
+ }
368
+
369
+ if (settings.tickMarks)
370
+ {
371
+ config.tickMarkSide = componyx.UI.Slider.TickMarkSideOption.BOTH;
372
+ config.tickMarkValueSide = componyx.UI.Slider.TickMarkSideOption.AFTER;
373
+ }
374
+
375
+
376
+ return config;
377
+ }
378
+
379
+ configureFileUpload(field, config = {})
380
+ {
381
+ const settings = field.componentSettings || {};
382
+
383
+ if (field.dataSourceId)
384
+ this.configureDataSource(config, field.dataSourceId);
385
+
386
+ return this.#configureComponentConfig(settings, config);
387
+ }
388
+
389
+ configureEditor(field, config = {})
390
+ {
391
+ const settings = field.componentSettings || {},
392
+ { visibleCommands, ...otherSettings } = settings,
393
+ commandSettings = visibleCommands || {},
394
+ coreCommands = ['*core'],
395
+ listCommands = ['*list'],
396
+ optionalCommands = [...listCommands, 'block', 'link', 'special'];
397
+
398
+ config.visibleCommands = [...coreCommands];
399
+
400
+ if (commandSettings.all)
401
+ {
402
+ config.visibleCommands = [...coreCommands, ...optionalCommands];
403
+ ['all', 'list', 'block', 'link', 'special'].forEach(k => delete commandSettings[k]);
404
+ }
405
+
406
+ for (const [key, value] of Object.entries(commandSettings))
407
+ {
408
+ let cmds = config.visibleCommands;
409
+
410
+ if (!value || cmds.includes(`${key}`) || cmds.includes(`*${key}`))
411
+ continue;
412
+
413
+ config.visibleCommands.push(key);
414
+ }
415
+
416
+ this.#configureComponentConfig(otherSettings, config);
417
+
418
+ return config;
419
+ }
420
+
421
+ configureDataSource(config, dataSourceId)
422
+ {
423
+ let dataSource = this.form.dataSources.find(ds => ds.id === dataSourceId),
424
+ ajaxMethod;
425
+
426
+ config.ajax = { customParameters: dataSource.params ?? {} };
427
+
428
+ if (dataSource.inputType === this.InputTypeOption.FILEUPLOAD)
429
+ ajaxMethod = config.ajax.upload = {};
430
+ else
431
+ ajaxMethod = config.ajax.load = {};
432
+
433
+ ajaxMethod.url = dataSource.url;
434
+ ajaxMethod.absoluteURL = dataSource.absoluteURL || true;
435
+ ajaxMethod.headers = dataSource.headers || null;
436
+ return config;
437
+ }
438
+
439
+ #configureComponentConfig(settings, config, defaults = {})
440
+ {
441
+ for (const key in settings)
442
+ {
443
+ if (settings[key] !== undefined)
444
+ {
445
+ if (Array.isArray(settings[key]))
446
+ config[key] = [...settings[key]];
447
+ else if (typeof settings[key] === 'object' && settings[key] !== null)
448
+ config[key] = { ...settings[key] };
449
+ else
450
+ config[key] = settings[key];
451
+ }
452
+ }
453
+
454
+ for (const key in defaults)
455
+ {
456
+ if (config[key] === undefined && defaults[key] !== undefined)
457
+ {
458
+ config[key] = defaults[key];
459
+ }
460
+ }
461
+
462
+ return config;
463
+ }
464
+ };
465
+
466
+ var ComponentFactory = componyx.UI.form_modules.ComponentFactory;
467
+
468
+ export { ComponentFactory as default };