@syncfusion/ej2-react-form-builder 0.1.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Common/CheckboxGroup.d.ts +13 -0
- package/Common/CheckboxGroup.js +50 -0
- package/Common/ConditionalRuleEngine.d.ts +296 -0
- package/Common/ConditionalRuleEngine.js +566 -0
- package/Common/CustomTabComponent.d.ts +17 -0
- package/Common/CustomTabComponent.js +30 -0
- package/Common/CustomValidationEngine.d.ts +58 -0
- package/Common/CustomValidationEngine.js +146 -0
- package/Common/DataGridComponent.d.ts +20 -0
- package/Common/DataGridComponent.js +273 -0
- package/Common/FormValidator.d.ts +485 -0
- package/Common/FormValidator.js +575 -0
- package/Common/MinMaxRuleEngine.d.ts +105 -0
- package/Common/MinMaxRuleEngine.js +365 -0
- package/Common/StaticHtmlRenderer.d.ts +14 -0
- package/Common/StaticHtmlRenderer.js +24 -0
- package/Common/expressions/DependencyTracker.d.ts +30 -0
- package/Common/expressions/DependencyTracker.js +128 -0
- package/Common/expressions/ExpressionEngine.d.ts +95 -0
- package/Common/expressions/ExpressionEngine.js +506 -0
- package/Common/expressions/ExpressionParser.d.ts +41 -0
- package/Common/expressions/ExpressionParser.js +269 -0
- package/Common/expressions/useGridExpressions.d.ts +12 -0
- package/Common/expressions/useGridExpressions.js +71 -0
- package/Common/globalFormId.d.ts +26 -0
- package/Common/globalFormId.js +45 -0
- package/Common/json-converter.d.ts +444 -0
- package/Common/json-converter.js +1184 -0
- package/Common/parser.d.ts +98 -0
- package/Common/parser.js +753 -0
- package/Common/utils.d.ts +130 -0
- package/Common/utils.js +574 -0
- package/README.md +53 -0
- package/index.d.ts +6 -0
- package/index.js +6 -0
- package/license +13 -0
- package/package.json +54 -0
- package/src/FormBuilder.d.ts +211 -0
- package/src/FormBuilder.js +1299 -0
- package/src/components/Database/ConnectionForm.d.ts +8 -0
- package/src/components/Database/ConnectionForm.js +28 -0
- package/src/components/TopBar.d.ts +10 -0
- package/src/components/TopBar.js +7 -0
- package/src/components/icons/ComponentIcons.d.ts +44 -0
- package/src/components/icons/ComponentIcons.js +40 -0
- package/src/components/layout/FormFieldWrapper.d.ts +41 -0
- package/src/components/layout/FormFieldWrapper.js +112 -0
- package/src/components/layout/LeftPane.d.ts +23 -0
- package/src/components/layout/LeftPane.js +310 -0
- package/src/components/layout/ListBoxPane.d.ts +24 -0
- package/src/components/layout/ListBoxPane.js +94 -0
- package/src/components/layout/MainSection.d.ts +39 -0
- package/src/components/layout/MainSection.js +1766 -0
- package/src/components/layout/Preview.d.ts +12 -0
- package/src/components/layout/Preview.js +337 -0
- package/src/components/layout/RightPane.d.ts +22 -0
- package/src/components/layout/RightPane.js +370 -0
- package/src/components/theme/ThemeSwitcher.d.ts +14 -0
- package/src/components/theme/ThemeSwitcher.js +24 -0
- package/src/components/theme/theme-constant.d.ts +37 -0
- package/src/components/theme/theme-constant.js +23 -0
- package/src/config/component-properties.json +4929 -0
- package/src/config/form-setting.json +56 -0
- package/src/config/locale.d.ts +449 -0
- package/src/config/locale.js +449 -0
- package/src/context/FormSchemaContext.d.ts +32 -0
- package/src/context/FormSchemaContext.js +155 -0
- package/src/context/LocalizationContext.d.ts +27 -0
- package/src/context/LocalizationContext.js +43 -0
- package/src/context/ThemeContext.d.ts +23 -0
- package/src/context/ThemeContext.js +161 -0
- package/src/context/contexts.d.ts +6 -0
- package/src/context/contexts.js +6 -0
- package/src/context/defaultFormSchema.d.ts +6 -0
- package/src/context/defaultFormSchema.js +20 -0
- package/src/defaultPalette.d.ts +9 -0
- package/src/defaultPalette.js +45 -0
- package/src/defaultTemplate.d.ts +3 -0
- package/src/defaultTemplate.js +185 -0
- package/src/import/schemaImportUtils.d.ts +24 -0
- package/src/import/schemaImportUtils.js +121 -0
- package/src/index.d.ts +16 -0
- package/src/index.js +6 -0
- package/src/types/ActionButtons.d.ts +44 -0
- package/src/types/ActionButtons.js +27 -0
- package/src/types/ComponentProperties.d.ts +33 -0
- package/src/types/ComponentProperties.js +2 -0
- package/src/types/FormSchema.d.ts +585 -0
- package/src/types/FormSchema.js +147 -0
- package/src/types/connection.d.ts +19 -0
- package/src/types/connection.js +9 -0
- package/src/utils/AttributesEditor.d.ts +13 -0
- package/src/utils/AttributesEditor.js +117 -0
- package/src/utils/ButtonGroupEditor.d.ts +15 -0
- package/src/utils/ButtonGroupEditor.js +141 -0
- package/src/utils/ChoiceBasedFieldEditor.d.ts +16 -0
- package/src/utils/ChoiceBasedFieldEditor.js +87 -0
- package/src/utils/ClipboardHelper.d.ts +26 -0
- package/src/utils/ClipboardHelper.js +83 -0
- package/src/utils/ColumnBuilder.d.ts +11 -0
- package/src/utils/ColumnBuilder.js +153 -0
- package/src/utils/ColumnSpanEditor.d.ts +8 -0
- package/src/utils/ColumnSpanEditor.js +98 -0
- package/src/utils/ConditionDataEditor.d.ts +29 -0
- package/src/utils/ConditionDataEditor.js +177 -0
- package/src/utils/ConditionalEditorUtils.d.ts +27 -0
- package/src/utils/ConditionalEditorUtils.js +310 -0
- package/src/utils/ConditionsEditor.d.ts +20 -0
- package/src/utils/ConditionsEditor.js +571 -0
- package/src/utils/CustomAccordion.d.ts +13 -0
- package/src/utils/CustomAccordion.js +38 -0
- package/src/utils/CustomValidationEditor.d.ts +11 -0
- package/src/utils/CustomValidationEditor.js +208 -0
- package/src/utils/DataSourceCollector.d.ts +3 -0
- package/src/utils/DataSourceCollector.js +252 -0
- package/src/utils/ExpressionEditor.d.ts +13 -0
- package/src/utils/ExpressionEditor.js +99 -0
- package/src/utils/FormSettingsPanel.d.ts +9 -0
- package/src/utils/FormSettingsPanel.js +60 -0
- package/src/utils/LookupConfig.d.ts +11 -0
- package/src/utils/LookupConfig.js +159 -0
- package/src/utils/MinMaxValueEditor.d.ts +25 -0
- package/src/utils/MinMaxValueEditor.js +188 -0
- package/src/utils/OptionsEditor.d.ts +8 -0
- package/src/utils/OptionsEditor.js +79 -0
- package/src/utils/PropertyRenderer.d.ts +22 -0
- package/src/utils/PropertyRenderer.js +210 -0
- package/src/utils/ValueRenderer.d.ts +2 -0
- package/src/utils/ValueRenderer.js +91 -0
- package/src/utils/ej2DbAdaptor.d.ts +6 -0
- package/src/utils/ej2DbAdaptor.js +38 -0
- package/src/utils/mappingHeuristics.d.ts +10 -0
- package/src/utils/mappingHeuristics.js +33 -0
- package/src/utils/renderComponent.d.ts +18 -0
- package/src/utils/renderComponent.js +300 -0
- package/styles/tailwind3.css +67 -0
- package/styles/themes/action-buttons.css +110 -0
- package/styles/themes/datagrid.css +380 -0
- package/styles/themes/drag-reorder.css +248 -0
- package/styles/themes/import-dialog.css +292 -0
- package/styles/themes/index.css +658 -0
- package/styles/themes/left-pane.css +253 -0
- package/styles/themes/options-editor.css +63 -0
- package/styles/themes/preview.css +702 -0
- package/styles/themes/property-dialog.css +371 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@syncfusion/ej2-form-renderer/styles/tailwind3.css';
|
|
3
|
+
import type { FormSchema } from '../../types/FormSchema';
|
|
4
|
+
import type { UnifiedSchema } from '../../../Common/json-converter';
|
|
5
|
+
interface PreviewProps {
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
schema?: UnifiedSchema;
|
|
9
|
+
formSchema: FormSchema;
|
|
10
|
+
}
|
|
11
|
+
export declare const Preview: React.FC<PreviewProps>;
|
|
12
|
+
export default Preview;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo, useEffect, useRef } from 'react';
|
|
3
|
+
import { FormRendererComponent } from '@syncfusion/ej2-react-form-renderer';
|
|
4
|
+
import { ButtonComponent } from '@syncfusion/ej2-react-buttons';
|
|
5
|
+
import '@syncfusion/ej2-form-renderer/styles/tailwind3.css';
|
|
6
|
+
import { DialogComponent } from '@syncfusion/ej2-react-popups';
|
|
7
|
+
import { GridComponent, ColumnsDirective, ColumnDirective, Inject, Page, Sort, Filter } from '@syncfusion/ej2-react-grids';
|
|
8
|
+
import { formBuilderMode } from '../../FormBuilder';
|
|
9
|
+
import { getFormId } from '../../../Common/globalFormId';
|
|
10
|
+
import { useLocalization } from '../../context/LocalizationContext';
|
|
11
|
+
// Ignore list for components to exclude from grid columns
|
|
12
|
+
const IGNORE_COMPONENT_TYPES = ['button', 'staticHtml', 'panel', 'table', 'tabs', 'card', 'splitButton', 'fileUpload', 'message'];
|
|
13
|
+
const IGNORE_COMPONENT_NAMES = []; // Can be populated manually
|
|
14
|
+
const getSubmissionsFromStorage = async (formName) => {
|
|
15
|
+
try {
|
|
16
|
+
const response = await fetch(/*getRecordsUrl*/ '' + `${formName}`);
|
|
17
|
+
return response.ok ? await response.json() : [];
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Error fetching submissions:', error);
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const saveSubmissionToStorage = async (formName, submission) => {
|
|
25
|
+
try {
|
|
26
|
+
await fetch(/*submitUrl*/ '' + `${formName}`, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers: { 'Content-Type': 'application/json' },
|
|
29
|
+
body: JSON.stringify(submission)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.error('Error saving submission:', error);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const clearSubmissionsFromStorage = async (formName) => {
|
|
37
|
+
try {
|
|
38
|
+
await fetch(/*submitUrl*/ '' + `${formName}`, { method: 'DELETE' });
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.error('Error clearing submissions:', error);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const extractGridColumns = (formSchema) => {
|
|
45
|
+
const columns = [];
|
|
46
|
+
if (!formSchema?.components)
|
|
47
|
+
return columns;
|
|
48
|
+
const extractFromComponent = (component) => {
|
|
49
|
+
if (IGNORE_COMPONENT_TYPES.includes(component.type) || IGNORE_COMPONENT_NAMES.includes(component.name)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (component.label && component.type !== 'dataGrid') {
|
|
53
|
+
columns.push({
|
|
54
|
+
field: component.label,
|
|
55
|
+
headerText: component.label
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else if (component.label && component.type === 'dataGrid') {
|
|
59
|
+
columns.push({
|
|
60
|
+
field: component.label,
|
|
61
|
+
headerText: `${component.label} (View)`
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (component.children && Array.isArray(component.children)) {
|
|
65
|
+
component.children.forEach((child) => {
|
|
66
|
+
if (Array.isArray(child)) {
|
|
67
|
+
child.forEach((nestedChild) => extractFromComponent(nestedChild));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
extractFromComponent(child);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (component.tableCells && Array.isArray(component.tableCells)) {
|
|
75
|
+
component.tableCells.forEach((row) => {
|
|
76
|
+
if (Array.isArray(row)) {
|
|
77
|
+
row.forEach((cell) => {
|
|
78
|
+
if (Array.isArray(cell)) {
|
|
79
|
+
cell.forEach((cellComponent) => extractFromComponent(cellComponent));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
extractFromComponent(cell);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (component.tabItems && Array.isArray(component.tabItems)) {
|
|
89
|
+
component.tabItems.forEach((tab) => {
|
|
90
|
+
if (tab.content && Array.isArray(tab.content)) {
|
|
91
|
+
tab.content.forEach((tabComponent) => extractFromComponent(tabComponent));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
formSchema.components.forEach(component => extractFromComponent(component));
|
|
97
|
+
return columns;
|
|
98
|
+
};
|
|
99
|
+
export const Preview = ({ isOpen, onClose, schema, formSchema }) => {
|
|
100
|
+
const [showSuccessScreen, setShowSuccessScreen] = useState(false);
|
|
101
|
+
const [formKey, setFormKey] = useState(0);
|
|
102
|
+
const [showDataDialog, setShowDataDialog] = useState(false);
|
|
103
|
+
const [storageRefresh, setStorageRefresh] = useState(0);
|
|
104
|
+
const gridColumns = useMemo(() => extractGridColumns(formSchema), [formSchema]);
|
|
105
|
+
const [gridData, setGridData] = useState([]);
|
|
106
|
+
const [expandedGridData, setExpandedGridData] = useState(null);
|
|
107
|
+
const [showExpandedDialog, setShowExpandedDialog] = useState(false);
|
|
108
|
+
const previewMainSectionRef = useRef(null);
|
|
109
|
+
const { locale } = useLocalization();
|
|
110
|
+
const dataGridFields = useMemo(() => {
|
|
111
|
+
const fields = new Set();
|
|
112
|
+
const traverse = (components) => {
|
|
113
|
+
components.forEach(comp => {
|
|
114
|
+
if (comp.type === 'dataGrid' && comp.label) {
|
|
115
|
+
fields.add(comp.label);
|
|
116
|
+
}
|
|
117
|
+
if (comp.children)
|
|
118
|
+
traverse(comp.children);
|
|
119
|
+
if (comp.tableCells)
|
|
120
|
+
comp.tableCells.forEach((row) => row.forEach((cell) => traverse(cell)));
|
|
121
|
+
if (comp.tabItems)
|
|
122
|
+
comp.tabItems.forEach((tab) => tab.content && traverse(tab.content));
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
traverse(formSchema?.components || []);
|
|
126
|
+
return fields;
|
|
127
|
+
}, [formSchema]);
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
if (!isOpen || formBuilderMode !== 'component')
|
|
130
|
+
return;
|
|
131
|
+
const updatePreviewHeight = () => {
|
|
132
|
+
const container = document.getElementById('form-builder');
|
|
133
|
+
if (!container)
|
|
134
|
+
return;
|
|
135
|
+
const previewMainSection = previewMainSectionRef.current || container.querySelector('.preview-main-section');
|
|
136
|
+
if (!previewMainSection)
|
|
137
|
+
return;
|
|
138
|
+
const containerHeight = container.offsetHeight;
|
|
139
|
+
previewMainSection.style.height = `${containerHeight - 48}px`;
|
|
140
|
+
};
|
|
141
|
+
const rafId = requestAnimationFrame(updatePreviewHeight);
|
|
142
|
+
const resizeObserver = new ResizeObserver(updatePreviewHeight);
|
|
143
|
+
const container = document.getElementById('form-builder');
|
|
144
|
+
if (container) {
|
|
145
|
+
resizeObserver.observe(container);
|
|
146
|
+
}
|
|
147
|
+
window.addEventListener('resize', updatePreviewHeight);
|
|
148
|
+
return () => {
|
|
149
|
+
cancelAnimationFrame(rafId);
|
|
150
|
+
resizeObserver.disconnect();
|
|
151
|
+
window.removeEventListener('resize', updatePreviewHeight);
|
|
152
|
+
};
|
|
153
|
+
}, [isOpen, formSchema.components, formSchema.settings]);
|
|
154
|
+
if (!isOpen)
|
|
155
|
+
return null;
|
|
156
|
+
const handleSubmit = (args) => {
|
|
157
|
+
const formName = formSchema?.settings?.name || 'Untitled Form';
|
|
158
|
+
// Process auto number fields
|
|
159
|
+
const processedData = { ...args.data };
|
|
160
|
+
if (formBuilderMode === undefined) {
|
|
161
|
+
if (formSchema?.components) {
|
|
162
|
+
const processAutoNumberFields = (components) => {
|
|
163
|
+
components.forEach((component) => {
|
|
164
|
+
if (component.type === 'autoNumber') {
|
|
165
|
+
// Get submissions count from form data storage to calculate next index
|
|
166
|
+
const submissions = getSubmissionsFromStorage(formName);
|
|
167
|
+
const lastIndex = parseInt((submissions[submissions.length - 1]?.[component.label]?.replace(component.prefix, '').replace(component.suffix, '')) || String(component.startIndex - 1 || -1), 10);
|
|
168
|
+
const nextIndex = lastIndex + 1;
|
|
169
|
+
const formattedValue = `${component.prefix || ''}${nextIndex}${component.suffix || ''}`;
|
|
170
|
+
processedData[component.label] = formattedValue;
|
|
171
|
+
}
|
|
172
|
+
// Handle nested components (like panel children)
|
|
173
|
+
if (component.children && Array.isArray(component.children)) {
|
|
174
|
+
component.children.forEach((child) => {
|
|
175
|
+
if (Array.isArray(child)) {
|
|
176
|
+
processAutoNumberFields(child);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
processAutoNumberFields([child]);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
// Handle table cells
|
|
184
|
+
if (component.tableCells && Array.isArray(component.tableCells)) {
|
|
185
|
+
component.tableCells.forEach((row) => {
|
|
186
|
+
if (Array.isArray(row)) {
|
|
187
|
+
row.forEach((cell) => {
|
|
188
|
+
if (Array.isArray(cell)) {
|
|
189
|
+
processAutoNumberFields(cell);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
processAutoNumberFields([cell]);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
// Handle tab items
|
|
199
|
+
if (component.tabItems && Array.isArray(component.tabItems)) {
|
|
200
|
+
component.tabItems.forEach((tab) => {
|
|
201
|
+
if (tab.content && Array.isArray(tab.content)) {
|
|
202
|
+
processAutoNumberFields(tab.content);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
processAutoNumberFields(formSchema.components);
|
|
209
|
+
}
|
|
210
|
+
const currentFormId = getFormId();
|
|
211
|
+
const storageKey = (currentFormId && String(currentFormId).trim()) ? currentFormId : formName;
|
|
212
|
+
saveSubmissionToStorage(storageKey, processedData);
|
|
213
|
+
setStorageRefresh(prev => prev + 1);
|
|
214
|
+
setShowSuccessScreen(true);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const handleAddAnotherResponse = () => {
|
|
218
|
+
setShowSuccessScreen(false);
|
|
219
|
+
setFormKey(prev => prev + 1);
|
|
220
|
+
};
|
|
221
|
+
const handleClearData = () => {
|
|
222
|
+
const formName = formSchema?.settings?.name || 'Untitled Form';
|
|
223
|
+
clearSubmissionsFromStorage(formName);
|
|
224
|
+
setStorageRefresh(prev => prev + 1);
|
|
225
|
+
};
|
|
226
|
+
return (_jsxs(_Fragment, { children: [_jsxs("main", { role: "dialog", "aria-modal": "true", className: "preview-main-section", style: { position: 'absolute', top: '48px', left: 0, width: '100%' }, children: [_jsxs("div", { className: "main-header", children: [_jsx("div", { className: "left-section", children: formSchema?.settings?.name || 'Untitled Form' }), _jsx("div", { className: "center-section" }), _jsx("div", { className: "right-section", children: _jsx(ButtonComponent, { onClick: onClose, cssClass: "action-btn e-flat", children: "Close Preview" }) })] }), _jsx("div", { className: "preview-main-content", style: { width: "100%", position: "relative", zIndex: 9999, marginTop: "48px" }, children: !showSuccessScreen ? (_jsx("div", { className: `form-preview-area`, ref: previewMainSectionRef, children: (schema) &&
|
|
227
|
+
_jsx(FormRendererComponent, { locale: locale, style: { maxWidth: formSchema.settings?.width || 'var(--form-width)' }, schema: schema, className: "preview-form", submit: handleSubmit }, formKey) })) : (_jsx("div", { style: {
|
|
228
|
+
display: 'flex',
|
|
229
|
+
alignItems: 'center',
|
|
230
|
+
justifyContent: 'center',
|
|
231
|
+
minHeight: 'calc(100vh - 100px)',
|
|
232
|
+
position: 'relative',
|
|
233
|
+
zIndex: 99999,
|
|
234
|
+
background: "var(--preview-area-color)",
|
|
235
|
+
padding: '40px 20px'
|
|
236
|
+
}, children: _jsxs("div", { className: "e-card", style: {
|
|
237
|
+
textAlign: 'center',
|
|
238
|
+
maxWidth: '500px',
|
|
239
|
+
borderRadius: '12px',
|
|
240
|
+
padding: '60px 40px',
|
|
241
|
+
boxShadow: '0 10px 40px rgba(0, 0, 0, 0.08)',
|
|
242
|
+
animation: 'fadeIn 0.5s ease-in'
|
|
243
|
+
}, children: [_jsx("div", { style: {
|
|
244
|
+
width: '80px',
|
|
245
|
+
height: '80px',
|
|
246
|
+
background: 'linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)',
|
|
247
|
+
borderRadius: '50%',
|
|
248
|
+
display: 'flex',
|
|
249
|
+
alignItems: 'center',
|
|
250
|
+
justifyContent: 'center',
|
|
251
|
+
margin: '0 auto 30px',
|
|
252
|
+
animation: 'scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1)'
|
|
253
|
+
}, children: _jsx("svg", { width: "44", height: "44", viewBox: "0 0 44 44", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M13.8333 23.3333L19.25 28.75L30.1667 15.25", stroke: "white", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), _jsx("h1", { style: {
|
|
254
|
+
fontSize: '28px',
|
|
255
|
+
fontWeight: '600',
|
|
256
|
+
color: 'var(--dashboard-heading-color)',
|
|
257
|
+
margin: '0 0 12px 0',
|
|
258
|
+
lineHeight: '1.4'
|
|
259
|
+
}, children: "Thank You!" }), _jsx("p", { style: {
|
|
260
|
+
fontSize: '16px',
|
|
261
|
+
color: '#64748b',
|
|
262
|
+
margin: '0 0 40px 0',
|
|
263
|
+
lineHeight: '1.6'
|
|
264
|
+
}, children: "Your response has been submitted successfully." }), _jsxs("div", { style: {
|
|
265
|
+
display: 'flex',
|
|
266
|
+
gap: '12px',
|
|
267
|
+
flexDirection: 'column'
|
|
268
|
+
}, children: [_jsx(ButtonComponent, { onClick: handleAddAnotherResponse, cssClass: "e-primary", style: {
|
|
269
|
+
background: 'linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)',
|
|
270
|
+
border: 'none',
|
|
271
|
+
height: '44px',
|
|
272
|
+
fontSize: '15px',
|
|
273
|
+
fontWeight: '500',
|
|
274
|
+
borderRadius: '8px',
|
|
275
|
+
cursor: 'pointer',
|
|
276
|
+
transition: 'all 0.3s ease',
|
|
277
|
+
boxShadow: '0 4px 15px rgba(99, 102, 241, 0.3)'
|
|
278
|
+
}, children: "\uFF0B Add Another Response" }), _jsx(ButtonComponent, { onClick: () => {
|
|
279
|
+
const fetchData = async () => {
|
|
280
|
+
const currentFormId = getFormId()?.toString();
|
|
281
|
+
const data = await getSubmissionsFromStorage(currentFormId);
|
|
282
|
+
setGridData(data);
|
|
283
|
+
};
|
|
284
|
+
fetchData();
|
|
285
|
+
setShowDataDialog(true);
|
|
286
|
+
}, cssClass: "e-outline", style: {
|
|
287
|
+
height: '44px',
|
|
288
|
+
fontSize: '15px',
|
|
289
|
+
fontWeight: '500',
|
|
290
|
+
borderRadius: '8px',
|
|
291
|
+
cursor: 'pointer',
|
|
292
|
+
}, children: "View Submitted Data" }), _jsx(ButtonComponent, { onClick: onClose, cssClass: "e-outline", style: {
|
|
293
|
+
height: '44px',
|
|
294
|
+
fontSize: '15px',
|
|
295
|
+
fontWeight: '500',
|
|
296
|
+
borderRadius: '8px',
|
|
297
|
+
cursor: 'pointer',
|
|
298
|
+
}, children: "Close Preview" })] })] }) })) })] }), _jsx(DialogComponent, { header: "Submitted Data", isModal: false, width: "100%", height: "calc(100dvh - 48px)", position: { X: 0, Y: 48 }, visible: showDataDialog, close: () => setShowDataDialog(false), showCloseIcon: true, footerTemplate: () => (_jsx("div", { style: { display: 'flex', gap: '8px', justifyContent: 'flex-end' }, children: _jsx(ButtonComponent, { onClick: handleClearData, cssClass: "e-danger", children: "Clear All Data" }) })), children: _jsx("div", { style: { display: 'flex', flexDirection: 'column', height: '100%' }, children: _jsxs(GridComponent, { dataSource: gridData, allowPaging: true, pageSettings: { pageSize: 10 }, allowSorting: true, allowFiltering: true, children: [_jsx(ColumnsDirective, { children: gridColumns.map((column, index) => (_jsx(ColumnDirective, { field: column.field, headerText: column.headerText, isPrimaryKey: index === 0, template: (props) => {
|
|
299
|
+
const value = props[column.field];
|
|
300
|
+
if (dataGridFields.has(column.field) && Array.isArray(value)) {
|
|
301
|
+
return (_jsxs(ButtonComponent, { cssClass: "e-outline e-small", onClick: () => {
|
|
302
|
+
setExpandedGridData(value);
|
|
303
|
+
setShowExpandedDialog(true);
|
|
304
|
+
}, children: ["View (", value.length, ")"] }));
|
|
305
|
+
}
|
|
306
|
+
if (typeof value === 'boolean') {
|
|
307
|
+
return value ? 'true' : 'false';
|
|
308
|
+
}
|
|
309
|
+
if (typeof value === 'object' && value !== null) {
|
|
310
|
+
return JSON.stringify(value);
|
|
311
|
+
}
|
|
312
|
+
return value ?? '';
|
|
313
|
+
} }, index))) }), _jsx(Inject, { services: [Page, Sort, Filter] })] }) }) }), _jsx(DialogComponent, { isModal: true, width: "90%", height: "80%", visible: showExpandedDialog, close: () => setShowExpandedDialog(false), showCloseIcon: true, children: _jsxs(GridComponent, { dataSource: expandedGridData || [], allowPaging: true, pageSettings: { pageSize: 10 }, allowSorting: true, allowFiltering: true, children: [_jsx(ColumnsDirective, { children: expandedGridData && expandedGridData.length > 0 && Object.keys(expandedGridData[0]).map((key, index) => (_jsx(ColumnDirective, { field: key, headerText: key }, index))) }), _jsx(Inject, { services: [Page, Sort, Filter] })] }) }), _jsx("style", { children: `
|
|
314
|
+
@keyframes fadeIn {
|
|
315
|
+
from {
|
|
316
|
+
opacity: 0;
|
|
317
|
+
transform: translateY(10px);
|
|
318
|
+
}
|
|
319
|
+
to {
|
|
320
|
+
opacity: 1;
|
|
321
|
+
transform: translateY(0);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
@keyframes scaleIn {
|
|
326
|
+
from {
|
|
327
|
+
transform: scale(0.3);
|
|
328
|
+
opacity: 0;
|
|
329
|
+
}
|
|
330
|
+
to {
|
|
331
|
+
transform: scale(1);
|
|
332
|
+
opacity: 1;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
` })] }));
|
|
336
|
+
};
|
|
337
|
+
export default Preview;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PropertyValues, ComponentDefinition } from '../../types/ComponentProperties';
|
|
3
|
+
import type { FormSettings } from '../../types/FormSchema';
|
|
4
|
+
import { type PropertyChangedEventArgs } from '../../FormBuilder';
|
|
5
|
+
interface RightPaneProps {
|
|
6
|
+
mode: 'component' | 'formSettings';
|
|
7
|
+
componentType: string;
|
|
8
|
+
configData: Record<string, ComponentDefinition>;
|
|
9
|
+
formSettingsConfig?: any;
|
|
10
|
+
existingValues?: PropertyValues;
|
|
11
|
+
formSettings?: FormSettings;
|
|
12
|
+
onSave: (values: PropertyValues | FormSettings, key?: string) => void;
|
|
13
|
+
onPropertyChanged?: (args: PropertyChangedEventArgs) => void;
|
|
14
|
+
onClose: () => void;
|
|
15
|
+
builderMode?: 'Simple' | 'Developer';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* RightPane Component
|
|
19
|
+
*/
|
|
20
|
+
export declare const RightPane: React.FC<RightPaneProps>;
|
|
21
|
+
declare const _default: React.NamedExoticComponent<RightPaneProps>;
|
|
22
|
+
export default _default;
|