@syncfusion/ej2-react-form-builder 0.1.0-beta → 35.1.42

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 (160) hide show
  1. package/README.md +81 -36
  2. package/diConfig.json +148 -0
  3. package/dist/ej2-react-form-builder.min.js +10 -0
  4. package/dist/ej2-react-form-builder.umd.min.js +11 -0
  5. package/dist/ej2-react-form-builder.umd.min.js.map +1 -0
  6. package/dist/es6/ej2-react-form-builder.es2015.js +60 -0
  7. package/dist/es6/ej2-react-form-builder.es2015.js.map +1 -0
  8. package/form-builder.d.ts +4 -0
  9. package/form-builder.js +4 -0
  10. package/index.d.ts +2 -4
  11. package/index.js +2 -4
  12. package/license +6 -13
  13. package/package.json +19 -43
  14. package/src/form-builder/formbuilder.component.d.ts +37 -0
  15. package/src/form-builder/formbuilder.component.js +50 -0
  16. package/src/form-builder/index.d.ts +2 -0
  17. package/src/form-builder/index.js +2 -0
  18. package/src/form-builder/toolboxitems-directive.d.ts +28 -0
  19. package/src/form-builder/toolboxitems-directive.js +47 -0
  20. package/src/global.js +1 -0
  21. package/src/index.d.ts +2 -16
  22. package/src/index.js +2 -6
  23. package/Common/CheckboxGroup.d.ts +0 -13
  24. package/Common/CheckboxGroup.js +0 -50
  25. package/Common/ConditionalRuleEngine.d.ts +0 -296
  26. package/Common/ConditionalRuleEngine.js +0 -566
  27. package/Common/CustomTabComponent.d.ts +0 -17
  28. package/Common/CustomTabComponent.js +0 -30
  29. package/Common/CustomValidationEngine.d.ts +0 -58
  30. package/Common/CustomValidationEngine.js +0 -146
  31. package/Common/DataGridComponent.d.ts +0 -20
  32. package/Common/DataGridComponent.js +0 -273
  33. package/Common/FormValidator.d.ts +0 -485
  34. package/Common/FormValidator.js +0 -575
  35. package/Common/MinMaxRuleEngine.d.ts +0 -105
  36. package/Common/MinMaxRuleEngine.js +0 -365
  37. package/Common/StaticHtmlRenderer.d.ts +0 -14
  38. package/Common/StaticHtmlRenderer.js +0 -24
  39. package/Common/expressions/DependencyTracker.d.ts +0 -30
  40. package/Common/expressions/DependencyTracker.js +0 -128
  41. package/Common/expressions/ExpressionEngine.d.ts +0 -95
  42. package/Common/expressions/ExpressionEngine.js +0 -506
  43. package/Common/expressions/ExpressionParser.d.ts +0 -41
  44. package/Common/expressions/ExpressionParser.js +0 -269
  45. package/Common/expressions/useGridExpressions.d.ts +0 -12
  46. package/Common/expressions/useGridExpressions.js +0 -71
  47. package/Common/globalFormId.d.ts +0 -26
  48. package/Common/globalFormId.js +0 -45
  49. package/Common/json-converter.d.ts +0 -444
  50. package/Common/json-converter.js +0 -1184
  51. package/Common/parser.d.ts +0 -98
  52. package/Common/parser.js +0 -753
  53. package/Common/utils.d.ts +0 -130
  54. package/Common/utils.js +0 -574
  55. package/src/FormBuilder.d.ts +0 -211
  56. package/src/FormBuilder.js +0 -1299
  57. package/src/components/Database/ConnectionForm.d.ts +0 -8
  58. package/src/components/Database/ConnectionForm.js +0 -28
  59. package/src/components/TopBar.d.ts +0 -10
  60. package/src/components/TopBar.js +0 -7
  61. package/src/components/icons/ComponentIcons.d.ts +0 -44
  62. package/src/components/icons/ComponentIcons.js +0 -40
  63. package/src/components/layout/FormFieldWrapper.d.ts +0 -41
  64. package/src/components/layout/FormFieldWrapper.js +0 -112
  65. package/src/components/layout/LeftPane.d.ts +0 -23
  66. package/src/components/layout/LeftPane.js +0 -310
  67. package/src/components/layout/ListBoxPane.d.ts +0 -24
  68. package/src/components/layout/ListBoxPane.js +0 -94
  69. package/src/components/layout/MainSection.d.ts +0 -39
  70. package/src/components/layout/MainSection.js +0 -1766
  71. package/src/components/layout/Preview.d.ts +0 -12
  72. package/src/components/layout/Preview.js +0 -337
  73. package/src/components/layout/RightPane.d.ts +0 -22
  74. package/src/components/layout/RightPane.js +0 -370
  75. package/src/components/theme/ThemeSwitcher.d.ts +0 -14
  76. package/src/components/theme/ThemeSwitcher.js +0 -24
  77. package/src/components/theme/theme-constant.d.ts +0 -37
  78. package/src/components/theme/theme-constant.js +0 -23
  79. package/src/config/component-properties.json +0 -4929
  80. package/src/config/form-setting.json +0 -56
  81. package/src/config/locale.d.ts +0 -449
  82. package/src/config/locale.js +0 -449
  83. package/src/context/FormSchemaContext.d.ts +0 -32
  84. package/src/context/FormSchemaContext.js +0 -155
  85. package/src/context/LocalizationContext.d.ts +0 -27
  86. package/src/context/LocalizationContext.js +0 -43
  87. package/src/context/ThemeContext.d.ts +0 -23
  88. package/src/context/ThemeContext.js +0 -161
  89. package/src/context/contexts.d.ts +0 -6
  90. package/src/context/contexts.js +0 -6
  91. package/src/context/defaultFormSchema.d.ts +0 -6
  92. package/src/context/defaultFormSchema.js +0 -20
  93. package/src/defaultPalette.d.ts +0 -9
  94. package/src/defaultPalette.js +0 -45
  95. package/src/defaultTemplate.d.ts +0 -3
  96. package/src/defaultTemplate.js +0 -185
  97. package/src/import/schemaImportUtils.d.ts +0 -24
  98. package/src/import/schemaImportUtils.js +0 -121
  99. package/src/types/ActionButtons.d.ts +0 -44
  100. package/src/types/ActionButtons.js +0 -27
  101. package/src/types/ComponentProperties.d.ts +0 -33
  102. package/src/types/ComponentProperties.js +0 -2
  103. package/src/types/FormSchema.d.ts +0 -585
  104. package/src/types/FormSchema.js +0 -147
  105. package/src/types/connection.d.ts +0 -19
  106. package/src/types/connection.js +0 -9
  107. package/src/utils/AttributesEditor.d.ts +0 -13
  108. package/src/utils/AttributesEditor.js +0 -117
  109. package/src/utils/ButtonGroupEditor.d.ts +0 -15
  110. package/src/utils/ButtonGroupEditor.js +0 -141
  111. package/src/utils/ChoiceBasedFieldEditor.d.ts +0 -16
  112. package/src/utils/ChoiceBasedFieldEditor.js +0 -87
  113. package/src/utils/ClipboardHelper.d.ts +0 -26
  114. package/src/utils/ClipboardHelper.js +0 -83
  115. package/src/utils/ColumnBuilder.d.ts +0 -11
  116. package/src/utils/ColumnBuilder.js +0 -153
  117. package/src/utils/ColumnSpanEditor.d.ts +0 -8
  118. package/src/utils/ColumnSpanEditor.js +0 -98
  119. package/src/utils/ConditionDataEditor.d.ts +0 -29
  120. package/src/utils/ConditionDataEditor.js +0 -177
  121. package/src/utils/ConditionalEditorUtils.d.ts +0 -27
  122. package/src/utils/ConditionalEditorUtils.js +0 -310
  123. package/src/utils/ConditionsEditor.d.ts +0 -20
  124. package/src/utils/ConditionsEditor.js +0 -571
  125. package/src/utils/CustomAccordion.d.ts +0 -13
  126. package/src/utils/CustomAccordion.js +0 -38
  127. package/src/utils/CustomValidationEditor.d.ts +0 -11
  128. package/src/utils/CustomValidationEditor.js +0 -208
  129. package/src/utils/DataSourceCollector.d.ts +0 -3
  130. package/src/utils/DataSourceCollector.js +0 -252
  131. package/src/utils/ExpressionEditor.d.ts +0 -13
  132. package/src/utils/ExpressionEditor.js +0 -99
  133. package/src/utils/FormSettingsPanel.d.ts +0 -9
  134. package/src/utils/FormSettingsPanel.js +0 -60
  135. package/src/utils/LookupConfig.d.ts +0 -11
  136. package/src/utils/LookupConfig.js +0 -159
  137. package/src/utils/MinMaxValueEditor.d.ts +0 -25
  138. package/src/utils/MinMaxValueEditor.js +0 -188
  139. package/src/utils/OptionsEditor.d.ts +0 -8
  140. package/src/utils/OptionsEditor.js +0 -79
  141. package/src/utils/PropertyRenderer.d.ts +0 -22
  142. package/src/utils/PropertyRenderer.js +0 -210
  143. package/src/utils/ValueRenderer.d.ts +0 -2
  144. package/src/utils/ValueRenderer.js +0 -91
  145. package/src/utils/ej2DbAdaptor.d.ts +0 -6
  146. package/src/utils/ej2DbAdaptor.js +0 -38
  147. package/src/utils/mappingHeuristics.d.ts +0 -10
  148. package/src/utils/mappingHeuristics.js +0 -33
  149. package/src/utils/renderComponent.d.ts +0 -18
  150. package/src/utils/renderComponent.js +0 -300
  151. package/styles/tailwind3.css +0 -67
  152. package/styles/themes/action-buttons.css +0 -110
  153. package/styles/themes/datagrid.css +0 -380
  154. package/styles/themes/drag-reorder.css +0 -248
  155. package/styles/themes/import-dialog.css +0 -292
  156. package/styles/themes/index.css +0 -658
  157. package/styles/themes/left-pane.css +0 -253
  158. package/styles/themes/options-editor.css +0 -63
  159. package/styles/themes/preview.css +0 -702
  160. package/styles/themes/property-dialog.css +0 -371
@@ -1,210 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { useRef, useState } from 'react';
3
- import { TextBoxComponent, NumericTextBoxComponent, ColorPickerComponent } from '@syncfusion/ej2-react-inputs';
4
- import { CheckBoxComponent, SwitchComponent, RadioButtonComponent } from '@syncfusion/ej2-react-buttons';
5
- import { DropDownListComponent, MultiSelectComponent } from '@syncfusion/ej2-react-dropdowns';
6
- import { DatePickerComponent, TimePickerComponent, DateTimePickerComponent, DateRangePickerComponent } from '@syncfusion/ej2-react-calendars';
7
- import { RichTextEditorComponent, Inject, Toolbar, HtmlEditor, QuickToolbar } from '@syncfusion/ej2-react-richtexteditor';
8
- import { OptionsEditor } from './OptionsEditor';
9
- import { AttributesEditor } from './AttributesEditor';
10
- import { ColumnBuilder } from './ColumnBuilder';
11
- import ButtonGroupEditor from './ButtonGroupEditor';
12
- import { ColumnSpanEditor } from './ColumnSpanEditor';
13
- import { useLocalization } from '../context/LocalizationContext';
14
- import { DataSourceCollector } from './DataSourceCollector';
15
- import { ExpressionEditor } from './ExpressionEditor';
16
- import MinMaxValueEditor from './MinMaxValueEditor';
17
- import LookupConfig from './LookupConfig';
18
- import { CustomValidationEditor } from './CustomValidationEditor';
19
- export const PropertyRenderer = ({ propertiesValues, property, initialValue, onChange, existingValues, mode }) => {
20
- const rteRef = useRef(null);
21
- const handleChange = (newValue) => {
22
- onChange(property.key, newValue);
23
- };
24
- const { l10n, locale } = useLocalization();
25
- switch (property.type) {
26
- case 'text':
27
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(TextBoxComponent, { id: `prop-text-${property.key}`, locale: locale, value: property.key !== 'name' && property.key !== 'width' ?
28
- initialValue !== undefined ? l10n.getConstant(initialValue) || initialValue : property.default || ''
29
- : initialValue !== undefined ? initialValue : property.default || '', placeholder: l10n.getConstant(property.placeholder), onChange: (property.key === 'defaultValue' || property.key === 'prefix' || property.key === 'suffix') ? undefined : (e) => handleChange(e.value), change: (property.key === 'defaultValue' || property.key === 'prefix' || property.key === 'suffix') ? (e) => handleChange(e.value) : undefined, floatLabelType: "Never", htmlAttributes: { 'maxLength': `${property.length}`, 'aria-label': `${l10n.getConstant(property.label)} textbox` } })] }));
30
- case 'number':
31
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(NumericTextBoxComponent, { id: `prop-number-${property.key}`, locale: locale, value: initialValue !== null && initialValue !== undefined ? initialValue : property.default, placeholder: l10n.getConstant(property.placeholder), min: property.min, max: property.max, format: 'n', step: property.step || 1, change: (e) => handleChange(e.value), floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} numeric textbox` } })] }));
32
- case 'boolean':
33
- return (_jsxs("div", { className: "property-field property-field-checkbox", children: [property.description && (_jsx("p", { className: "property-description property-description-inline", children: l10n.getConstant(property.description) })), _jsx(CheckBoxComponent, { id: `prop-boolean-${property.key}`, locale: locale, label: l10n.getConstant(property.label), checked: initialValue !== undefined ? initialValue : property.default, change: (e) => handleChange(e.checked), htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} checkbox` } })] }));
34
- case 'dropdown':
35
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(DropDownListComponent, { id: `prop-dropdown-${property.key}`, dataSource: (property.options || []).map(option => ({
36
- text: l10n.getConstant(option) || option,
37
- value: option.charAt(0).toUpperCase() + option.slice(1)
38
- })), locale: locale, fields: { text: 'text', value: 'value' }, value: initialValue || property.default, placeholder: l10n.getConstant(property.placeholder), change: (e) => handleChange(e.value), floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} dropdown` } })] }));
39
- case 'multiselect':
40
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(MultiSelectComponent, { id: `prop-dropdown-${property.key}`, dataSource: (property.options || []).map(option => ({
41
- text: l10n.getConstant(option) || option,
42
- value: option.charAt(0).toUpperCase() + option.slice(1)
43
- })), allowCustomValue: true, locale: locale, fields: { text: 'text', value: 'value' }, value: initialValue || property.default, placeholder: l10n.getConstant(property.placeholder), change: (e) => handleChange(e.value), floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} multiselect` } })] }));
44
- case 'radio':
45
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", id: `label-${property.key}`, children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", id: `desc-${property.key}`, children: l10n.getConstant(property.description) })), _jsx("div", { role: "radiogroup", "aria-labelledby": `label-${property.key}`, className: "radio-options", children: (property.options || []).map((opt, index) => {
46
- const isLast = index === (property.options || []).length - 1;
47
- return (_jsxs("div", { className: "radio-option", "aria-label": l10n.getConstant(property.label), children: [_jsx(RadioButtonComponent, { name: `prop-radio-${property.key}`, id: `prop-radio-${property.key}-${opt}`, label: l10n.getConstant(opt), value: opt, checked: initialValue === opt, change: () => handleChange(opt), htmlAttributes: { 'aria-describedby': `desc-${property.key}` } }), _jsx("div", { className: "property-description property-description-inline", style: { marginBottom: isLast ? '0' : '0.5rem', marginTop: '0.3rem' }, children: l10n.getConstant(`visibility_${opt}_description`) })] }, opt));
48
- }) })] }));
49
- case 'object':
50
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(TextBoxComponent, { id: `prop-object-${property.key}`, value: typeof initialValue === 'object' ? JSON.stringify(initialValue, null, 2) : (initialValue || JSON.stringify(property.default || {})), placeholder: l10n.getConstant(property.placeholder), multiline: true, locale: locale, change: (e) => {
51
- try {
52
- const parsed = JSON.parse(e.value);
53
- handleChange(parsed);
54
- }
55
- catch {
56
- handleChange(e.value);
57
- }
58
- }, floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} json input` } })] }));
59
- case 'array':
60
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(TextBoxComponent, { id: `prop-array-${property.key}`, value: Array.isArray(initialValue) ? JSON.stringify(initialValue) : (initialValue || JSON.stringify(property.default || [])), placeholder: 'e.g., ["item1", "item2"]', multiline: true, locale: locale, change: (e) => {
61
- try {
62
- const parsed = JSON.parse(e.value);
63
- handleChange(Array.isArray(parsed) ? parsed : []);
64
- }
65
- catch (err) {
66
- // Invalid JSON, keep as is for now
67
- handleChange(e.value);
68
- }
69
- }, floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} array textbox` } })] }));
70
- case 'html':
71
- const toolbarSettings = {
72
- items: ['Undo', 'Redo', '|', 'SourceCode']
73
- };
74
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(RichTextEditorComponent, { ref: rteRef, id: `prop-html-${property.key}`, editorMode: "HTML", locale: locale, toolbarSettings: toolbarSettings, value: initialValue || property.default || '', change: (e) => handleChange(e.value), saveInterval: 1, height: "180px", enableHtmlSanitizer: false, created: () => {
75
- if (rteRef.current) {
76
- setTimeout(() => {
77
- rteRef.current?.showSourceCode();
78
- }, 150);
79
- }
80
- }, htmlAttributes: { 'aria-label': `HTML Editor` }, children: _jsx(Inject, { services: [Toolbar, HtmlEditor, QuickToolbar] }) })] }));
81
- case 'conditionBuilder':
82
- return (_jsxs("div", { className: "property-field", children: [_jsx("label", { className: "property-label", children: l10n.getConstant(property.label) }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx("div", { className: "condition-builder-placeholder", children: _jsx("p", { style: { margin: 0, color: '#999', fontSize: '0.875rem' }, children: "Condition Builder (Coming Soon)" }) })] }));
83
- case 'expression':
84
- return (_jsxs("div", { className: "property-field", children: [_jsx("label", { className: "property-label", children: l10n.getConstant(property.label) }), property.description && (_jsx("div", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(ExpressionEditor, { expression: initialValue || property.default || '', availableFields: propertiesValues.availableFields || [], onExpressionChange: (expr) => { if (expr !== undefined && expr !== "" && expr !== initialValue) {
85
- handleChange(expr);
86
- } } })] }));
87
- case 'customValidation':
88
- return (_jsx("div", { className: "property-field", children: _jsx(CustomValidationEditor, { componentFields: propertiesValues.availableFields || [], excludeFieldId: existingValues?.name, values: property, existingRules: existingValues?.customValidation, onChange: handleChange }) }));
89
- case 'minMaxEditor':
90
- return (_jsxs("div", { className: "property-field", children: [_jsx("label", { className: "property-label", children: l10n.getConstant(property.label) }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(MinMaxValueEditor, { label: l10n.getConstant(property.label), initialValue: initialValue || [], mode: property.editorMode || 'number', onChange: handleChange, locale: locale, description: property.description ? l10n.getConstant(property.description) : undefined, currentFieldId: propertiesValues?.name, builderMode: mode })] }));
91
- case 'lookupconfig':
92
- return (_jsx(LookupConfig, { value: initialValue, onChange: (newValue) => handleChange(newValue) }));
93
- case 'options':
94
- const componentType = property.componentType || 'options';
95
- const useDataSourceCollector = mode != 'Simple' && ['fromurl'].includes(componentType.toLowerCase());
96
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), useDataSourceCollector ? (_jsx(DataSourceCollector, { value: initialValue || [l10n.getConstant('defaultOptionValue')], onChange: handleChange, type: componentType })) : (_jsx(OptionsEditor, { options: Array.isArray(initialValue) ? initialValue : [l10n.getConstant('defaultOptionValue')], onChange: handleChange, type: componentType }))] }));
97
- case 'buttonGroup':
98
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(ButtonGroupEditor, { buttons: Array.isArray(initialValue) ? initialValue : (property.default || []), onChange: (val) => handleChange(val) })] }));
99
- case 'attributes':
100
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), _jsx(AttributesEditor, { attributes: initialValue || [], onChange: handleChange })] }));
101
- case 'color':
102
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), _jsx(ColorPickerComponent, { locale: locale, value: initialValue || property.default || '', change: (e) => { handleChange(e.value); } }, `form`)] }));
103
- case 'day':
104
- const formatDate = (date) => {
105
- if (!date)
106
- return '';
107
- const month = String(date.getMonth() + 1).padStart(2, '0');
108
- const day = String(date.getDate()).padStart(2, '0');
109
- const year = date.getFullYear();
110
- return `${month}/${day}/${year}`;
111
- };
112
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(DatePickerComponent, { id: `prop-day-${property.key}`, locale: locale, value: initialValue ? new Date(initialValue) : undefined, format: "MM/dd/yyyy", placeholder: l10n.getConstant(property.placeholder) || 'Select a date', change: (e) => handleChange(e.value ? formatDate(e.value) : ''), floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} datePicker` } })] }));
113
- case 'time':
114
- const formatTime = (date) => {
115
- if (!date)
116
- return '';
117
- let hours = date.getHours();
118
- const minutes = String(date.getMinutes()).padStart(2, '0');
119
- const ampm = hours >= 12 ? 'PM' : 'AM';
120
- hours = hours % 12 || 12; // Convert to 12-hour format (1-12)
121
- const hoursStr = String(hours).padStart(2, '0');
122
- return `${hoursStr}:${minutes} ${ampm}`;
123
- };
124
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(TimePickerComponent, { id: `prop-time-${property.key}`, locale: locale, value: initialValue ? new Date(`2000-01-01 ${initialValue}`) : undefined, format: "hh:mm a", placeholder: l10n.getConstant(property.placeholder) || 'Select a time', change: (e) => handleChange(e.value ? formatTime(e.value) : ''), floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} timepicker` } })] }));
125
- case 'datetime':
126
- const formatDateTime = (date) => {
127
- if (!date)
128
- return '';
129
- const month = String(date.getMonth() + 1).padStart(2, '0');
130
- const day = String(date.getDate()).padStart(2, '0');
131
- const year = date.getFullYear();
132
- let hours = date.getHours();
133
- const ampm = hours >= 12 ? 'PM' : 'AM';
134
- hours = hours % 12 || 12; // Convert to 12-hour format (1-12)
135
- const hoursStr = String(hours).padStart(2, '0');
136
- const minutes = String(date.getMinutes()).padStart(2, '0');
137
- return `${month}/${day}/${year} ${hoursStr}:${minutes} ${ampm}`;
138
- };
139
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(DateTimePickerComponent, { id: `prop-datetime-${property.key}`, locale: locale, value: initialValue ? new Date(initialValue) : undefined, format: "MM/dd/yyyy hh:mm a", placeholder: l10n.getConstant(property.placeholder) || 'Select date and time', change: (e) => handleChange(e.value ? formatDateTime(e.value) : ''), floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} datetimepicker` } })] }));
140
- case 'daterange':
141
- const formatDateRange = (startDate, endDate) => {
142
- if (!startDate || !endDate)
143
- return '';
144
- const formatDate = (date) => {
145
- const month = String(date.getMonth() + 1).padStart(2, '0');
146
- const day = String(date.getDate()).padStart(2, '0');
147
- const year = date.getFullYear();
148
- return `${month}/${day}/${year}`;
149
- };
150
- return `${formatDate(startDate)} - ${formatDate(endDate)}`;
151
- };
152
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(DateRangePickerComponent, { id: `prop-daterange-${property.key}`, locale: locale, startDate: initialValue?.startDate ? new Date(initialValue.startDate) : undefined, endDate: initialValue?.endDate ? new Date(initialValue.endDate) : undefined, format: "MM/dd/yyyy", placeholder: l10n.getConstant(property.placeholder) || 'Select date range', change: (e) => {
153
- if (e.startDate && e.endDate) {
154
- handleChange(formatDateRange(e.startDate, e.endDate));
155
- }
156
- else {
157
- handleChange('');
158
- }
159
- }, floatLabelType: "Never", htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} daterangepicker` } })] }));
160
- case 'datagridcolumns':
161
- return (_jsx("div", { className: "property-field", children: _jsx(ColumnBuilder, { columns: Array.isArray(initialValue) ? initialValue : [], onChange: handleChange, name: propertiesValues.name || [], label: property.label }) }));
162
- case 'json':
163
- return (_jsx("div", { className: "property-field", children: _jsx(DataSourceCollector, { datakey: 'data', value: initialValue || property.default || '[]', onChange: handleChange, type: "grid", isAccordion: true }) }));
164
- case 'columnspaneditor':
165
- return (_jsxs("div", { className: "property-field", children: [_jsxs("label", { className: "property-label", children: [l10n.getConstant(property.label), property.required && _jsx("span", { className: "required", children: "*" })] }), property.description && (_jsx("p", { className: "property-description", children: l10n.getConstant(property.description) })), _jsx(ColumnSpanEditor, { columnCount: propertiesValues.columns || 2, initialWidths: initialValue?.widths, onChange: (widths) => handleChange({ widths }) }, property.key)] }));
166
- case 'switch':
167
- return (_jsxs("div", { className: "property-field", children: [property.description && (_jsx("p", { className: "property-description property-description-inline", children: l10n.getConstant(property.description) })), _jsxs("div", { className: "property-field property-field-checkbox", children: [_jsxs("div", { children: [l10n.getConstant(property.label), ":"] }), _jsx(SwitchComponent, { id: `prop-boolean-${property.key}`, locale: locale, offLabel: l10n.getConstant('off'), onLabel: l10n.getConstant('on'), checked: initialValue !== undefined ? initialValue : property.default, change: (e) => handleChange(e.checked), htmlAttributes: { 'aria-label': `${l10n.getConstant(property.label)} switch` } })] })] }));
168
- case 'URLImport':
169
- const [isEnabled, setIsEnabled] = useState(typeof initialValue === 'object'
170
- ? initialValue?.enabled ?? false
171
- : Boolean(initialValue));
172
- const currentValue = {
173
- enabled: isEnabled,
174
- serviceUrl: typeof initialValue === 'object'
175
- ? initialValue?.serviceUrl ?? ''
176
- : ''
177
- };
178
- const handleEnabledChange = (checked) => {
179
- checked ? handleChange({
180
- enabled: currentValue.serviceUrl ? true : false,
181
- serviceUrl: checked ? currentValue.serviceUrl || '' : ''
182
- }) : handleChange(null);
183
- setIsEnabled(checked);
184
- };
185
- const handleServiceChange = (value) => {
186
- handleChange({
187
- enabled: true,
188
- serviceUrl: value
189
- });
190
- };
191
- return (_jsxs("div", { className: "property-field", children: [_jsx("div", { className: "property-field property-field-checkbox", style: { marginBottom: '0.5rem' }, children: _jsx(CheckBoxComponent, { id: `prop-urlimport-${property.key}`, locale: locale, label: l10n.getConstant(property.label), checked: isEnabled, change: (e) => handleEnabledChange(e.checked === true) }, `${property.key}-${isEnabled}`) }), isEnabled && (_jsxs(_Fragment, { children: [property.description && (_jsx("p", { className: "property-description property-description-inline", children: l10n.getConstant(property.description) })), _jsx("div", { children: _jsx(TextBoxComponent, { id: `prop-url-${property.key}`, locale: locale, value: currentValue.serviceUrl, placeholder: l10n.getConstant(`${property.placeholder}`) || 'Enter service URL', change: (e) => handleServiceChange(e.value), floatLabelType: "Never" }) })] }))] }));
192
- default:
193
- return null;
194
- }
195
- };
196
- // Memoize PropertyRenderer to prevent unnecessary re-renders
197
- const MemoizedPropertyRenderer = React.memo(PropertyRenderer);
198
- export const PropertyGroupRenderer = React.memo(({ properties, existingValues, initialValues, onChange, mode }) => {
199
- return (_jsx("div", { className: "property-group", "aria-label": 'property-group', children: _jsx("div", { className: "property-group-content", children: properties.map((property) => {
200
- // Conditionally hide labelWidth when labelPosition is top/bottom
201
- if (property.key === 'labelWidth') {
202
- const labelPosition = initialValues['labelPosition'];
203
- if (!labelPosition || labelPosition === 'top' || labelPosition === 'bottom') {
204
- return null; // Don't render labelWidth for top/bottom positions
205
- }
206
- }
207
- return (_jsx(MemoizedPropertyRenderer, { propertiesValues: initialValues, property: property, initialValue: initialValues[property.key], existingValues: existingValues, onChange: onChange, mode: mode }, property.key));
208
- }) }) }));
209
- });
210
- export default MemoizedPropertyRenderer;
@@ -1,2 +0,0 @@
1
- declare const ValueRenderer: React.FC<any>;
2
- export default ValueRenderer;
@@ -1,91 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { DropDownListComponent, MultiSelectComponent } from "@syncfusion/ej2-react-dropdowns";
3
- import { useLocalization } from "../context/LocalizationContext";
4
- import { DatePickerComponent, DateRangePickerComponent, DateTimePickerComponent, TimePickerComponent } from "@syncfusion/ej2-react-calendars";
5
- import { NumericTextBoxComponent, TextBoxComponent } from "@syncfusion/ej2-react-inputs";
6
- import { useFormSchema } from "../context/FormSchemaContext";
7
- import { useMemo } from "react";
8
- import { Internationalization } from '@syncfusion/ej2-base';
9
- import { getComponentFromSchema, resolveOptions, useFetchOptions } from "../../Common/utils";
10
- const ValueRenderer = ({ componentForEdit, conditionsRef, handleSetValueValueChange }) => {
11
- const { l10n, locale } = useLocalization();
12
- const { formSchema } = useFormSchema();
13
- // Get live component with updated options from formSchema
14
- const liveComponent = useMemo(() => {
15
- return componentForEdit ? getComponentFromSchema(componentForEdit.id, formSchema) || componentForEdit : componentForEdit;
16
- }, [componentForEdit, formSchema]);
17
- const fetchedOptions = useFetchOptions(liveComponent.options);
18
- const resolvedOptions = Array.isArray(liveComponent.options)
19
- ? liveComponent.options
20
- : liveComponent.options?.type === 'url' ? resolveOptions(liveComponent.options, fetchedOptions) : [];
21
- return (_jsxs("div", { style: { margin: "10px", marginTop: "15px" }, children: [_jsx("label", { className: "property-description", style: { marginBottom: "5px", display: "block" }, children: l10n.getConstant('setValue') }), liveComponent && ((liveComponent.type === 'multiselect' || liveComponent.type === 'checkboxGroup') && liveComponent.options ? (_jsx(MultiSelectComponent, { id: `${liveComponent.id}_setValue`, locale: locale, dataSource: resolvedOptions.map((opt) => {
22
- const val = typeof opt === 'string' ? opt : opt.value;
23
- const label = typeof opt === 'string' ? opt : opt.label || opt.text || opt.value;
24
- return { text: label, value: val };
25
- }), fields: { text: 'text', value: 'value' }, value: Array.isArray(conditionsRef.current.setValueWhen?.value) ? conditionsRef.current.setValueWhen.value : [], change: (e) => handleSetValueValueChange({ target: { value: e.value } }), placeholder: "Select values", popupHeight: "300px" })) : (liveComponent.type === 'dropdown' || liveComponent.type === 'radio') && liveComponent.options ? (_jsx(DropDownListComponent, { id: `${liveComponent.id}_setValue`, locale: locale, dataSource: resolvedOptions.map((opt) => {
26
- const val = typeof opt === 'string' ? opt : opt.value;
27
- const label = typeof opt === 'string' ? opt : opt.label || opt.text || opt.value;
28
- return { text: label, value: val };
29
- }), fields: { text: 'text', value: 'value' }, value: conditionsRef.current.setValueWhen?.value || '', change: (e) => handleSetValueValueChange({ target: { value: e.value } }), placeholder: "Select value", popupHeight: "300px" })) : liveComponent.type === 'date' ? (_jsx(DatePickerComponent, { id: `${liveComponent.id}_setValue`, locale: locale, value: conditionsRef.current.setValueWhen?.value ? new Date(conditionsRef.current.setValueWhen.value) : undefined, change: (e) => {
30
- if (e.value !== null && e.value !== undefined) {
31
- // Format date using Syncfusion Internationalization
32
- const intl = new Internationalization();
33
- const formatter = intl.getDateFormat({
34
- format: 'MM/dd/yyyy',
35
- type: 'date'
36
- });
37
- handleSetValueValueChange({ target: { value: formatter(e.value) } });
38
- }
39
- }, placeholder: "Select date", format: "MM/dd/yyyy" })) : liveComponent.type === 'time' ? (_jsx(TimePickerComponent, { id: `${liveComponent.id}_setValue`, locale: locale, value: conditionsRef.current.setValueWhen?.value ? (typeof conditionsRef.current.setValueWhen.value === 'string'
40
- ? new Date(`2000-01-01 ${conditionsRef.current.setValueWhen.value}`)
41
- : conditionsRef.current.setValueWhen.value) : undefined, change: (e) => {
42
- if (e.value !== null && e.value !== undefined) {
43
- // Format time using Syncfusion Internationalization
44
- const intl = new Internationalization();
45
- const formatter = intl.getDateFormat({
46
- format: 'hh:mm a',
47
- type: 'time'
48
- });
49
- handleSetValueValueChange({ target: { value: formatter(e.value) } });
50
- }
51
- }, placeholder: "Select time", format: "hh:mm a" })) : liveComponent.type === 'dateTime' ? (_jsx(DateTimePickerComponent, { id: `${liveComponent.id}_setValue`, locale: locale, value: conditionsRef.current.setValueWhen?.value ? new Date(conditionsRef.current.setValueWhen.value) : undefined, change: (e) => {
52
- if (e.value !== null && e.value !== undefined) {
53
- // Format dateTime using Syncfusion Internationalization
54
- const intl = new Internationalization();
55
- const formatter = intl.getDateFormat({
56
- format: 'MM/dd/yyyy hh:mm a',
57
- type: 'dateTime'
58
- });
59
- handleSetValueValueChange({ target: { value: formatter(e.value) } });
60
- }
61
- }, placeholder: "Select date and time", format: "MM/dd/yyyy hh:mm a" })) : liveComponent.type === 'dateRange' ? (_jsx(DateRangePickerComponent, { id: `${liveComponent.id}_setValue`, locale: locale, value: conditionsRef.current.setValueWhen?.value ? (Array.isArray(conditionsRef.current.setValueWhen.value)
62
- ? [new Date(conditionsRef.current.setValueWhen.value[0]), new Date(conditionsRef.current.setValueWhen.value[1])]
63
- : undefined) : undefined, change: (e) => {
64
- if (e.value !== null && e.value !== undefined && Array.isArray(e.value) && e.value.length === 2) {
65
- // Format date range using Syncfusion Internationalization
66
- const intl = new Internationalization();
67
- const formatter = intl.getDateFormat({
68
- format: 'MM/dd/yyyy',
69
- type: 'date'
70
- });
71
- const startDate = formatter(e.value[0]);
72
- const endDate = formatter(e.value[1]);
73
- handleSetValueValueChange({ target: { value: [startDate, endDate] } });
74
- }
75
- }, placeholder: "Select date range", format: "MM/dd/yyyy" })) : liveComponent.type === 'number' || liveComponent.type === 'rating' || liveComponent.type === 'rangeSlider' ? (_jsx(NumericTextBoxComponent, { id: `${liveComponent.id}_setValue`, locale: locale, value: conditionsRef.current.setValueWhen?.value || 0, change: (e) => handleSetValueValueChange({ target: { value: e.value } }), placeholder: "Enter number", format: "n" })) : liveComponent.type === 'dateRange' ? (_jsx(DateRangePickerComponent, { id: `${liveComponent.id}_setValue`, locale: locale, value: conditionsRef.current.setValueWhen?.value ? (Array.isArray(conditionsRef.current.setValueWhen.value)
76
- ? [new Date(conditionsRef.current.setValueWhen.value[0]), new Date(conditionsRef.current.setValueWhen.value[1])]
77
- : undefined) : undefined, change: (e) => {
78
- if (e.value !== null && e.value !== undefined && Array.isArray(e.value) && e.value.length === 2) {
79
- // Format date range using Syncfusion Internationalization
80
- const intl = new Internationalization();
81
- const formatter = intl.getDateFormat({
82
- format: 'MM/dd/yyyy',
83
- type: 'date'
84
- });
85
- const startDate = formatter(e.value[0]);
86
- const endDate = formatter(e.value[1]);
87
- handleSetValueValueChange({ target: { value: [startDate, endDate] } });
88
- }
89
- }, placeholder: "Select date range", format: "MM/dd/yyyy" })) : (_jsx(TextBoxComponent, { id: `${liveComponent.id}_setValue`, type: "text", locale: locale, value: conditionsRef.current.setValueWhen?.value || '', change: (e) => handleSetValueValueChange({ target: { value: e.value } }), placeholder: `Enter value for ${liveComponent.label || liveComponent.id}` })))] }));
90
- };
91
- export default ValueRenderer;
@@ -1,6 +0,0 @@
1
- import { UrlAdaptor, Query } from '@syncfusion/ej2-data';
2
- export declare class DbImportAdaptor extends UrlAdaptor {
3
- private sessionId;
4
- constructor(sessionId: string);
5
- read(request: any, _query?: Query): Promise<any>;
6
- }
@@ -1,38 +0,0 @@
1
- import { UrlAdaptor } from '@syncfusion/ej2-data';
2
- export class DbImportAdaptor extends UrlAdaptor {
3
- sessionId;
4
- constructor(sessionId) {
5
- super();
6
- this.sessionId = sessionId;
7
- }
8
- async read(request, _query) {
9
- const params = request.params || {};
10
- const action = params.action;
11
- const table = params.table || '';
12
- const limit = params.limit || 10;
13
- let url = '';
14
- if (action === 'tables') {
15
- url = `/api/db/tables?sessionId=${encodeURIComponent(this.sessionId)}`;
16
- }
17
- else if (action === 'columns') {
18
- url = `/api/db/columns?sessionId=${encodeURIComponent(this.sessionId)}&table=${encodeURIComponent(table)}`;
19
- }
20
- else if (action === 'sample') {
21
- url = `/api/db/sample?sessionId=${encodeURIComponent(this.sessionId)}&table=${encodeURIComponent(table)}&limit=${limit}`;
22
- }
23
- else {
24
- throw new Error('DbImportAdaptor: action param required (tables|columns|sample)');
25
- }
26
- const resp = await fetch(url, { credentials: 'same-origin' });
27
- if (!resp.ok)
28
- throw new Error(`Request failed ${resp.status}`);
29
- const json = await resp.json();
30
- if (json.tables)
31
- return { result: json.tables, count: json.tables.length };
32
- if (json.columns)
33
- return { result: json.columns, count: json.columns.length };
34
- if (json.rows)
35
- return { result: json.rows, count: json.rows.length };
36
- return { result: [], count: 0 };
37
- }
38
- }
@@ -1,10 +0,0 @@
1
- export type ColumnInfo = {
2
- name: string;
3
- dataType: string;
4
- nullable?: boolean;
5
- maxLength?: number | null;
6
- isPrimary?: boolean;
7
- };
8
- export declare function suggestFieldType(col: ColumnInfo): string;
9
- export declare function mapFieldType(col: ColumnInfo): string;
10
- export declare function suggestDropdownCandidates(_: any[]): any[];
@@ -1,33 +0,0 @@
1
- // Return a suggested form field type for a given column data type
2
- export function suggestFieldType(col) {
3
- const t = (col.dataType || '').toLowerCase();
4
- if (t.includes('char') || t.includes('text') || t === 'string' || t.includes('uuid'))
5
- return 'textbox';
6
- if (t === 'boolean' || t === 'bit' || t === 'tinyint(1)')
7
- return 'Checkbox';
8
- if (t.includes('int') || t === 'number' || t === 'numeric' || t === 'decimal' || t === 'bigint')
9
- return 'number';
10
- if (t.includes('date') || t.includes('time') || t.includes('timestamp'))
11
- return 'datepicker';
12
- if (t === 'json' || t === 'jsonb' || t === 'object')
13
- return 'textarea';
14
- // default fallback
15
- return 'textBox';
16
- }
17
- export function mapFieldType(col) {
18
- const t = (col.dataType || '').toLowerCase();
19
- if (t.includes('char') || t.includes('text') || t === 'string' || t.includes('uuid'))
20
- return 'string';
21
- if (t === 'boolean' || t === 'bit' || t === 'tinyint(1)')
22
- return 'Checkbox';
23
- if (t.includes('int') || t === 'number' || t === 'numeric' || t === 'decimal' || t === 'bigint')
24
- return 'number';
25
- if (t.includes('date') || t.includes('time') || t.includes('timestamp'))
26
- return 'date';
27
- // default fallback
28
- return 'textBox';
29
- }
30
- // Optionally derive dropdown candidates from sample rows (not implemented here)
31
- export function suggestDropdownCandidates(_) {
32
- return [];
33
- }
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { type FormComponent } from '../types/FormSchema';
3
- import { type FormState } from '../../Common/FormValidator';
4
- import { type DataGridRef } from '../../Common/DataGridComponent';
5
- import { L10n } from '@syncfusion/ej2-base';
6
- export interface RenderComponentProps {
7
- component: FormComponent;
8
- formState?: FormState;
9
- gridRefs?: Record<string, React.RefObject<DataGridRef>>;
10
- l10n: L10n;
11
- locale: string;
12
- formSettings?: any;
13
- }
14
- /**
15
- * Shared component rendering utility used by both MainSection and ComponentPreview
16
- * Renders a FormComponent with all properties applied consistently
17
- */
18
- export declare const RenderComponent: ({ component, formState, gridRefs, l10n, locale, formSettings }: RenderComponentProps) => React.ReactNode;