@syncfusion/ej2-react-form-renderer 0.1.2-beta → 34.2.2
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/README.md +88 -105
- package/diConfig.json +85 -0
- package/dist/ej2-react-form-renderer.min.js +10 -0
- package/dist/ej2-react-form-renderer.umd.min.js +11 -0
- package/dist/ej2-react-form-renderer.umd.min.js.map +1 -0
- package/dist/es6/ej2-react-form-renderer.es2015.js +37 -0
- package/dist/es6/ej2-react-form-renderer.es2015.js.map +1 -0
- package/form-renderer.d.ts +4 -0
- package/form-renderer.js +4 -0
- package/index.d.ts +2 -4
- package/index.js +2 -4
- package/license +6 -13
- package/package.json +19 -38
- package/src/form-renderer/formrenderer.component.d.ts +34 -0
- package/src/form-renderer/formrenderer.component.js +49 -0
- package/src/form-renderer/index.d.ts +1 -0
- package/src/form-renderer/index.js +1 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +2 -6
- package/src/index.js +2 -6
- package/styles/bds-lite.css +1 -0
- package/styles/bds-lite.scss +1 -0
- package/styles/bds.css +1 -0
- package/styles/bds.scss +1 -0
- package/styles/bootstrap-dark-lite.css +1 -0
- package/styles/bootstrap-dark-lite.scss +1 -0
- package/styles/bootstrap-dark.css +1 -26
- package/styles/bootstrap-dark.scss +1 -0
- package/styles/bootstrap-lite.css +1 -0
- package/styles/bootstrap-lite.scss +1 -0
- package/styles/bootstrap.css +1 -26
- package/styles/bootstrap.scss +1 -0
- package/styles/bootstrap4-lite.css +1 -0
- package/styles/bootstrap4-lite.scss +1 -0
- package/styles/bootstrap4.css +1 -26
- package/styles/bootstrap4.scss +1 -0
- package/styles/bootstrap5-dark-lite.css +1 -0
- package/styles/bootstrap5-dark-lite.scss +1 -0
- package/styles/bootstrap5-dark.css +1 -26
- package/styles/bootstrap5-dark.scss +1 -0
- package/styles/bootstrap5-lite.css +1 -0
- package/styles/bootstrap5-lite.scss +1 -0
- package/styles/bootstrap5.3-lite.css +1 -0
- package/styles/bootstrap5.3-lite.scss +1 -0
- package/styles/bootstrap5.3.css +1 -26
- package/styles/bootstrap5.3.scss +1 -0
- package/styles/bootstrap5.css +1 -26
- package/styles/bootstrap5.scss +1 -0
- package/styles/fabric-dark-lite.css +1 -0
- package/styles/fabric-dark-lite.scss +1 -0
- package/styles/fabric-dark.css +1 -0
- package/styles/fabric-dark.scss +1 -0
- package/styles/fabric-lite.css +1 -0
- package/styles/fabric-lite.scss +1 -0
- package/styles/fabric.css +1 -0
- package/styles/fabric.scss +1 -0
- package/styles/fluent-dark-lite.css +1 -0
- package/styles/fluent-dark-lite.scss +1 -0
- package/styles/fluent-dark.css +1 -26
- package/styles/fluent-dark.scss +1 -0
- package/styles/fluent-lite.css +1 -0
- package/styles/fluent-lite.scss +1 -0
- package/styles/fluent.css +1 -26
- package/styles/fluent.scss +1 -0
- package/styles/fluent2-lite.css +1 -0
- package/styles/fluent2-lite.scss +1 -0
- package/styles/fluent2.css +1 -26
- package/styles/fluent2.scss +1 -0
- package/styles/form-renderer/bds.css +1 -0
- package/styles/form-renderer/bds.scss +1 -0
- package/styles/form-renderer/bootstrap-dark.css +1 -0
- package/styles/form-renderer/bootstrap-dark.scss +1 -0
- package/styles/form-renderer/bootstrap.css +1 -0
- package/styles/form-renderer/bootstrap.scss +1 -0
- package/styles/form-renderer/bootstrap4.css +1 -0
- package/styles/form-renderer/bootstrap4.scss +1 -0
- package/styles/form-renderer/bootstrap5-dark.css +1 -0
- package/styles/form-renderer/bootstrap5-dark.scss +1 -0
- package/styles/form-renderer/bootstrap5.3.css +1 -0
- package/styles/form-renderer/bootstrap5.3.scss +1 -0
- package/styles/form-renderer/bootstrap5.css +1 -0
- package/styles/form-renderer/bootstrap5.scss +1 -0
- package/styles/form-renderer/fabric-dark.css +1 -0
- package/styles/form-renderer/fabric-dark.scss +1 -0
- package/styles/form-renderer/fabric.css +1 -0
- package/styles/form-renderer/fabric.scss +1 -0
- package/styles/form-renderer/fluent-dark.css +1 -0
- package/styles/form-renderer/fluent-dark.scss +1 -0
- package/styles/form-renderer/fluent.css +1 -0
- package/styles/form-renderer/fluent.scss +1 -0
- package/styles/form-renderer/fluent2.css +1 -0
- package/styles/form-renderer/fluent2.scss +1 -0
- package/styles/form-renderer/highcontrast-light.css +1 -0
- package/styles/form-renderer/highcontrast-light.scss +1 -0
- package/styles/form-renderer/highcontrast.css +1 -0
- package/styles/form-renderer/highcontrast.scss +1 -0
- package/styles/form-renderer/material-dark.css +1 -0
- package/styles/form-renderer/material-dark.scss +1 -0
- package/styles/form-renderer/material.css +1 -0
- package/styles/form-renderer/material.scss +1 -0
- package/styles/form-renderer/material3-dark.css +1 -0
- package/styles/form-renderer/material3-dark.scss +1 -0
- package/styles/form-renderer/material3.css +1 -0
- package/styles/form-renderer/material3.scss +1 -0
- package/styles/form-renderer/tailwind-dark.css +1 -0
- package/styles/form-renderer/tailwind-dark.scss +1 -0
- package/styles/form-renderer/tailwind.css +1 -0
- package/styles/form-renderer/tailwind.scss +1 -0
- package/styles/form-renderer/tailwind3.css +1 -0
- package/styles/form-renderer/tailwind3.scss +1 -0
- package/styles/highcontrast-light-lite.css +1 -0
- package/styles/highcontrast-light-lite.scss +1 -0
- package/styles/highcontrast-light.css +1 -0
- package/styles/highcontrast-light.scss +1 -0
- package/styles/highcontrast-lite.css +1 -0
- package/styles/highcontrast-lite.scss +1 -0
- package/styles/highcontrast.css +1 -0
- package/styles/highcontrast.scss +1 -0
- package/styles/material-dark-lite.css +1 -0
- package/styles/material-dark-lite.scss +1 -0
- package/styles/material-dark.css +1 -26
- package/styles/material-dark.scss +1 -0
- package/styles/material-lite.css +1 -0
- package/styles/material-lite.scss +1 -0
- package/styles/material.css +1 -26
- package/styles/material.scss +1 -0
- package/styles/material3-dark-lite.css +1 -0
- package/styles/material3-dark-lite.scss +1 -0
- package/styles/material3-dark.css +1 -26
- package/styles/material3-dark.scss +1 -0
- package/styles/material3-lite.css +1 -0
- package/styles/material3-lite.scss +1 -0
- package/styles/material3.css +1 -26
- package/styles/material3.scss +1 -0
- package/styles/tailwind-dark-lite.css +1 -0
- package/styles/tailwind-dark-lite.scss +1 -0
- package/styles/tailwind-dark.css +1 -26
- package/styles/tailwind-dark.scss +1 -0
- package/styles/tailwind-lite.css +1 -0
- package/styles/tailwind-lite.scss +1 -0
- package/styles/tailwind.css +1 -26
- package/styles/tailwind.scss +1 -0
- package/styles/tailwind3-lite.css +1 -0
- package/styles/tailwind3-lite.scss +1 -0
- package/styles/tailwind3.css +1 -26
- package/styles/tailwind3.scss +1 -0
- package/src/CheckboxGroup.d.ts +0 -12
- package/src/CheckboxGroup.js +0 -49
- package/src/ConditionalRuleEngine.d.ts +0 -295
- package/src/ConditionalRuleEngine.js +0 -566
- package/src/CustomTabComponent.d.ts +0 -13
- package/src/CustomTabComponent.js +0 -35
- package/src/DataGridComponent.d.ts +0 -28
- package/src/DataGridComponent.js +0 -147
- package/src/FormRenderer.d.ts +0 -84
- package/src/FormRenderer.js +0 -707
- package/src/FormValidator.d.ts +0 -479
- package/src/FormValidator.js +0 -579
- package/src/MinMaxRuleEngine.d.ts +0 -95
- package/src/MinMaxRuleEngine.js +0 -361
- package/src/StaticHtmlRenderer.d.ts +0 -8
- package/src/StaticHtmlRenderer.js +0 -21
- package/src/expressions/DependencyTracker.d.ts +0 -30
- package/src/expressions/DependencyTracker.js +0 -128
- package/src/expressions/ExpressionEngine.d.ts +0 -81
- package/src/expressions/ExpressionEngine.js +0 -503
- package/src/expressions/ExpressionParser.d.ts +0 -39
- package/src/expressions/ExpressionParser.js +0 -270
- package/src/json-converter.d.ts +0 -171
- package/src/json-converter.js +0 -1209
- package/src/parser.d.ts +0 -99
- package/src/parser.js +0 -753
- package/src/renderFormField.d.ts +0 -21
- package/src/renderFormField.js +0 -226
- package/src/types/FormSchema.d.ts +0 -211
- package/src/types/FormSchema.js +0 -1
- package/src/utils.js +0 -408
- package/styles/bootstrap5.3-dark.css +0 -26
- package/styles/fluent2-dark.css +0 -26
- package/styles/form-renderer.base.css +0 -499
- package/styles/tailwind3-dark.css +0 -10
package/src/utils.js
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Internationalization } from '@syncfusion/ej2-base';
|
|
3
|
-
import { DataManager, Query, UrlAdaptor, WebApiAdaptor, ODataV4Adaptor } from '@syncfusion/ej2-data';
|
|
4
|
-
import { ConditionalRuleEngine } from "./ConditionalRuleEngine";
|
|
5
|
-
import { UI_TYPE_TO_SEMANTIC_TYPE } from './json-converter';
|
|
6
|
-
/**
|
|
7
|
-
* Maps button style to Syncfusion CSS classes
|
|
8
|
-
* @param style - Button style ('primary' | 'flat' | 'information' | 'error' | 'success' | 'warning')
|
|
9
|
-
* @returns Space-separated CSS class string
|
|
10
|
-
*/
|
|
11
|
-
export const mapButtonStyleToClass = (style) => {
|
|
12
|
-
const styleMap = {
|
|
13
|
-
'primary': 'e-primary',
|
|
14
|
-
'flat': 'e-flat',
|
|
15
|
-
'information': 'e-info',
|
|
16
|
-
'error': 'e-danger',
|
|
17
|
-
'success': 'e-success',
|
|
18
|
-
'warning': 'e-warning'
|
|
19
|
-
};
|
|
20
|
-
return styleMap[style || 'primary'] || 'e-primary';
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Resolves button type to valid HTML button type
|
|
24
|
-
* @param type - Button type ('submit' | 'reset' | 'button')
|
|
25
|
-
* @returns Resolved button type
|
|
26
|
-
*/
|
|
27
|
-
export const resolveButtonType = (type) => {
|
|
28
|
-
return (type === 'submit' || type === 'reset') ? type : 'button';
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Maps button position to CSS justifyContent value
|
|
32
|
-
* @param position - Button position ('Left' | 'Right' | 'Center')
|
|
33
|
-
* @returns CSS justifyContent value
|
|
34
|
-
*/
|
|
35
|
-
export const mapPositionToJustifyContent = (position) => {
|
|
36
|
-
const positionMap = {
|
|
37
|
-
'Left': 'flex-start',
|
|
38
|
-
'Right': 'flex-end',
|
|
39
|
-
'Center': 'center'
|
|
40
|
-
};
|
|
41
|
-
return positionMap[position || 'Left'] || 'flex-start';
|
|
42
|
-
};
|
|
43
|
-
export function splitWidths(input) {
|
|
44
|
-
const result = input.map(v => (v === null ? NaN : Number(v)));
|
|
45
|
-
const sumKnown = result.reduce((s, v) => s + (isNaN(v) ? 0 : v), 0);
|
|
46
|
-
// If knowns already >= 100, unknowns become 0
|
|
47
|
-
const remainingInt = Math.max(0, Math.round(100 - sumKnown));
|
|
48
|
-
const unknownIndexes = result.map((v, i) => (isNaN(v) ? i : -1)).filter(i => i >= 0);
|
|
49
|
-
const k = unknownIndexes.length;
|
|
50
|
-
if (k === 0) {
|
|
51
|
-
// nothing to split; just clamp/round knowns so they sum to 100 if you prefer, but return as-is
|
|
52
|
-
return result.map(v => Math.round(v));
|
|
53
|
-
}
|
|
54
|
-
// Distribute integer percentage points to avoid fractional rounding problems
|
|
55
|
-
const base = Math.floor(remainingInt / k);
|
|
56
|
-
let remainder = remainingInt - base * k;
|
|
57
|
-
// Fill unknowns with base + 1 for first `remainder` items
|
|
58
|
-
unknownIndexes.forEach((idx) => {
|
|
59
|
-
const add = remainder > 0 ? base + 1 : base;
|
|
60
|
-
result[idx] = add;
|
|
61
|
-
remainder = Math.max(0, remainder - 1);
|
|
62
|
-
});
|
|
63
|
-
// Convert any NaN (shouldn't remain) to 0 and round knowns
|
|
64
|
-
return result.map(v => (isNaN(v) ? 0 : Math.round(v)));
|
|
65
|
-
}
|
|
66
|
-
export function extractAllDescendantIds(component) {
|
|
67
|
-
const childIds = [];
|
|
68
|
-
function traverse(comps) {
|
|
69
|
-
for (const comp of comps) {
|
|
70
|
-
childIds.push(comp.id);
|
|
71
|
-
// Recursively traverse nested structures
|
|
72
|
-
if (comp.children && Array.isArray(comp.children)) {
|
|
73
|
-
traverse(comp.children);
|
|
74
|
-
}
|
|
75
|
-
// Handle table cells
|
|
76
|
-
if (comp.tableCells && Array.isArray(comp.tableCells)) {
|
|
77
|
-
comp.tableCells.forEach((row) => {
|
|
78
|
-
if (Array.isArray(row)) {
|
|
79
|
-
row.forEach((cell) => {
|
|
80
|
-
if (Array.isArray(cell)) {
|
|
81
|
-
traverse(cell);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
// Handle tab items
|
|
88
|
-
if (comp.tabItems && Array.isArray(comp.tabItems)) {
|
|
89
|
-
comp.tabItems.forEach((tabItem) => {
|
|
90
|
-
if (tabItem.content && Array.isArray(tabItem.content)) {
|
|
91
|
-
traverse(tabItem.content);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// Start with direct children
|
|
98
|
-
if (component.children && Array.isArray(component.children)) {
|
|
99
|
-
traverse(component.children);
|
|
100
|
-
}
|
|
101
|
-
// Handle table cells
|
|
102
|
-
if (component.tableCells && Array.isArray(component.tableCells)) {
|
|
103
|
-
component.tableCells.forEach((row) => {
|
|
104
|
-
if (Array.isArray(row)) {
|
|
105
|
-
row.forEach((cell) => {
|
|
106
|
-
if (Array.isArray(cell)) {
|
|
107
|
-
traverse(cell);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
// Handle tab items
|
|
114
|
-
if (component.tabItems && Array.isArray(component.tabItems)) {
|
|
115
|
-
component.tabItems.forEach((tabItem) => {
|
|
116
|
-
if (tabItem.content && Array.isArray(tabItem.content)) {
|
|
117
|
-
traverse(tabItem.content);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return childIds;
|
|
122
|
-
}
|
|
123
|
-
export function formatDateValues(component, value) {
|
|
124
|
-
let intl = new Internationalization();
|
|
125
|
-
let dFormatter = intl.getDateFormat({
|
|
126
|
-
format: 'MM/dd/yyyy',
|
|
127
|
-
type: 'date'
|
|
128
|
-
});
|
|
129
|
-
if (component.type === 'date') {
|
|
130
|
-
value = dFormatter(new Date(value));
|
|
131
|
-
}
|
|
132
|
-
if (component.type === 'time') {
|
|
133
|
-
dFormatter = intl.getDateFormat({
|
|
134
|
-
format: 'hh:mm a',
|
|
135
|
-
type: 'time'
|
|
136
|
-
});
|
|
137
|
-
value = dFormatter(new Date(value));
|
|
138
|
-
}
|
|
139
|
-
if (component.type === 'dateTime') {
|
|
140
|
-
dFormatter = intl.getDateFormat({
|
|
141
|
-
format: 'MM/dd/yyyy hh:mm a',
|
|
142
|
-
type: 'dateTime'
|
|
143
|
-
});
|
|
144
|
-
value = dFormatter(new Date(value));
|
|
145
|
-
}
|
|
146
|
-
if (component.type === 'dateRange' && Array.isArray(value)) {
|
|
147
|
-
value = value.map(date => date ? dFormatter(new Date(date)) : null);
|
|
148
|
-
}
|
|
149
|
-
return value;
|
|
150
|
-
}
|
|
151
|
-
export const getComponentFromSchema = (id, formSchema) => {
|
|
152
|
-
if (!id || !formSchema)
|
|
153
|
-
return null;
|
|
154
|
-
const findInComponents = (components) => {
|
|
155
|
-
for (const comp of components) {
|
|
156
|
-
if (comp.id === id || comp.name === id)
|
|
157
|
-
return comp;
|
|
158
|
-
if (comp.children) {
|
|
159
|
-
const found = findInComponents(comp.children);
|
|
160
|
-
if (found)
|
|
161
|
-
return found;
|
|
162
|
-
}
|
|
163
|
-
if (comp.tableCells) {
|
|
164
|
-
for (const row of comp.tableCells) {
|
|
165
|
-
for (const cell of row) {
|
|
166
|
-
const found = findInComponents(cell);
|
|
167
|
-
if (found)
|
|
168
|
-
return found;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (comp.tabItems) {
|
|
173
|
-
for (const tab of comp.tabItems) {
|
|
174
|
-
if (tab.content) {
|
|
175
|
-
const found = findInComponents(tab.content);
|
|
176
|
-
if (found)
|
|
177
|
-
return found;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return null;
|
|
183
|
-
};
|
|
184
|
-
return findInComponents(formSchema.components || []);
|
|
185
|
-
};
|
|
186
|
-
/**
|
|
187
|
-
* Helper function to get the appropriate adaptor instance
|
|
188
|
-
* @param adaptorType - Type of adaptor ('WebApiAdaptor' | 'UrlAdaptor' | 'ODataV4Adaptor')
|
|
189
|
-
* @returns Adaptor instance
|
|
190
|
-
*/
|
|
191
|
-
export const getAdaptorInstance = (adaptorType) => {
|
|
192
|
-
switch (adaptorType) {
|
|
193
|
-
case 'WebApiAdaptor':
|
|
194
|
-
return new WebApiAdaptor();
|
|
195
|
-
case 'ODataV4Adaptor':
|
|
196
|
-
return new ODataV4Adaptor();
|
|
197
|
-
case 'UrlAdaptor':
|
|
198
|
-
default:
|
|
199
|
-
return new UrlAdaptor();
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* Extracts data from a nested path using dot notation and array indices
|
|
204
|
-
* @param data - The data object or array
|
|
205
|
-
* @param path - Path to the data (e.g., 'results.items', '[0].data', 'response[0].values')
|
|
206
|
-
* @returns Extracted data or empty array
|
|
207
|
-
*/
|
|
208
|
-
export const extractDataFromPath = (data, path) => {
|
|
209
|
-
if (!path || data === null || data === undefined)
|
|
210
|
-
return data;
|
|
211
|
-
// Split by dots but preserve array indices
|
|
212
|
-
const parts = path.split(/\.(?![^\[]*\])/); // Split by dots not inside brackets
|
|
213
|
-
let current = data;
|
|
214
|
-
for (const part of parts) {
|
|
215
|
-
if (current === null || current === undefined) {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
// Handle array index notation like [0] or results[0]
|
|
219
|
-
const arrayMatch = part.match(/^(\w*)\[(\d+)\]$/);
|
|
220
|
-
if (arrayMatch) {
|
|
221
|
-
const propName = arrayMatch[1];
|
|
222
|
-
const index = parseInt(arrayMatch[2]);
|
|
223
|
-
// If propName is empty, current should be an array
|
|
224
|
-
if (!propName) {
|
|
225
|
-
current = current[index];
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
current = current[propName]?.[index];
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
// Regular property access
|
|
233
|
-
current = current[part];
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return current;
|
|
237
|
-
};
|
|
238
|
-
/**
|
|
239
|
-
* Custom hook to fetch options from URL with custom headers
|
|
240
|
-
* @param componentOptions - The component options object which may contain URL and headers
|
|
241
|
-
* @param adaptorType - Type of adaptor to use ('WebApiAdaptor' | 'UrlAdaptor' | 'ODataV4Adaptor')
|
|
242
|
-
* @returns Array of fetched options
|
|
243
|
-
*/
|
|
244
|
-
export const useFetchOptions = (componentOptions) => {
|
|
245
|
-
const [fetchedOptions, setFetchedOptions] = React.useState([]);
|
|
246
|
-
React.useEffect(() => {
|
|
247
|
-
const isUrlType = componentOptions &&
|
|
248
|
-
typeof componentOptions === 'object' &&
|
|
249
|
-
!Array.isArray(componentOptions) &&
|
|
250
|
-
componentOptions.type === 'url' &&
|
|
251
|
-
componentOptions.url;
|
|
252
|
-
if (isUrlType) {
|
|
253
|
-
const urlConfig = componentOptions;
|
|
254
|
-
try {
|
|
255
|
-
const headers = {};
|
|
256
|
-
if (urlConfig.headers && Array.isArray(urlConfig.headers)) {
|
|
257
|
-
urlConfig.headers.forEach((h) => {
|
|
258
|
-
if (h.key?.trim()) {
|
|
259
|
-
headers[h.key] = h.value;
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
// ✅ Create DataManager with selected adaptor
|
|
264
|
-
const dataManager = new DataManager({
|
|
265
|
-
url: urlConfig.url,
|
|
266
|
-
adaptor: getAdaptorInstance(urlConfig.adaptorType),
|
|
267
|
-
headers: Object.keys(headers).length ? headers : undefined
|
|
268
|
-
});
|
|
269
|
-
// ✅ Build Query (dynamic support)
|
|
270
|
-
let query = new Query();
|
|
271
|
-
if (urlConfig.search && urlConfig.search.enabled && urlConfig.search.fields && urlConfig.search.fields.length > 0) {
|
|
272
|
-
const searchKey = urlConfig.search.key || 'search';
|
|
273
|
-
query = query.search(searchKey, urlConfig.search.fields);
|
|
274
|
-
}
|
|
275
|
-
// Apply sort query
|
|
276
|
-
if (urlConfig.sort && urlConfig.sort.enabled && urlConfig.sort.field) {
|
|
277
|
-
const sortDirection = urlConfig.sort.direction === 'descending' ? 'descending' : 'ascending';
|
|
278
|
-
query = query.sortBy(urlConfig.sort.field, sortDirection);
|
|
279
|
-
}
|
|
280
|
-
// Apply filter queries
|
|
281
|
-
if (urlConfig.filters && Array.isArray(urlConfig.filters) && urlConfig.filters.length > 0) {
|
|
282
|
-
urlConfig.filters.forEach((f) => {
|
|
283
|
-
if (f.field && f.operator && f.value) {
|
|
284
|
-
query = query.where(f.field, f.operator, f.value);
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
// Example: add params (query string)
|
|
289
|
-
if (urlConfig.queryParams) {
|
|
290
|
-
Object.keys(urlConfig.queryParams).forEach(key => {
|
|
291
|
-
query = query.addParams(key, urlConfig.queryParams[key]);
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
// Example: paging
|
|
295
|
-
if (urlConfig.skip)
|
|
296
|
-
query = query.skip(urlConfig.skip);
|
|
297
|
-
if (urlConfig.take)
|
|
298
|
-
query = query.take(urlConfig.take);
|
|
299
|
-
// ✅ Execute query
|
|
300
|
-
dataManager.executeQuery(query).then((res) => {
|
|
301
|
-
let data = res.result;
|
|
302
|
-
if (urlConfig.dataPath) {
|
|
303
|
-
data = extractDataFromPath(data, urlConfig.dataPath);
|
|
304
|
-
}
|
|
305
|
-
if (Array.isArray(data)) {
|
|
306
|
-
setFetchedOptions(data);
|
|
307
|
-
}
|
|
308
|
-
else if (typeof data === 'string') {
|
|
309
|
-
setFetchedOptions([data]);
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
setFetchedOptions([]);
|
|
313
|
-
}
|
|
314
|
-
}).catch((err) => {
|
|
315
|
-
console.error('DataManager fetch error:', err);
|
|
316
|
-
setFetchedOptions([]);
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
catch (err) {
|
|
320
|
-
console.error('Setup error:', err);
|
|
321
|
-
setFetchedOptions([]);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}, [componentOptions]);
|
|
325
|
-
return fetchedOptions;
|
|
326
|
-
};
|
|
327
|
-
/**
|
|
328
|
-
* Resolves component options from various sources
|
|
329
|
-
* Handles array options, URL-fetched options, and raw data options
|
|
330
|
-
* @param options - Component options (can be array, URL config, or raw data config)
|
|
331
|
-
* @param fetchedOptions - Pre-fetched options from URL
|
|
332
|
-
* @returns Resolved array of options
|
|
333
|
-
*/
|
|
334
|
-
export const resolveOptions = (options, fetchedOptions) => {
|
|
335
|
-
// If URL type with fetched data, return fetched options
|
|
336
|
-
if (options && typeof options === 'object' && !Array.isArray(options) && options.type === 'url') {
|
|
337
|
-
return fetchedOptions.length > 0 ? fetchedOptions : [];
|
|
338
|
-
}
|
|
339
|
-
// If already an array, return as-is
|
|
340
|
-
if (Array.isArray(options)) {
|
|
341
|
-
return options;
|
|
342
|
-
}
|
|
343
|
-
// If it's raw data type
|
|
344
|
-
if (options && typeof options === 'object' && !Array.isArray(options) && options.type === 'raw') {
|
|
345
|
-
return Array.isArray(options.data) ? options.data : [];
|
|
346
|
-
}
|
|
347
|
-
return [];
|
|
348
|
-
};
|
|
349
|
-
export const collectAvailableFieldNames = (components) => {
|
|
350
|
-
const fieldNames = [];
|
|
351
|
-
const traverse = (comps) => {
|
|
352
|
-
comps.forEach(comp => {
|
|
353
|
-
// Only add fields that have a name and aren't layout components
|
|
354
|
-
if (comp.name && !['panel', 'table', 'tabs', 'card', 'message', 'button', 'splitButton', 'staticHtml'].includes(comp.type)) {
|
|
355
|
-
// Get semantic type mapping for this component
|
|
356
|
-
const semanticType = UI_TYPE_TO_SEMANTIC_TYPE[comp.type];
|
|
357
|
-
if (semanticType) {
|
|
358
|
-
fieldNames.push({
|
|
359
|
-
name: comp.name,
|
|
360
|
-
type: semanticType.type,
|
|
361
|
-
...(semanticType.format && { format: semanticType.format })
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
// Traverse nested components
|
|
366
|
-
if (comp.children)
|
|
367
|
-
traverse(comp.children);
|
|
368
|
-
if (comp.tabItems) {
|
|
369
|
-
comp.tabItems.forEach(tab => {
|
|
370
|
-
if (tab.content)
|
|
371
|
-
traverse(tab.content);
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
if (comp.tableCells) {
|
|
375
|
-
comp.tableCells.forEach(row => {
|
|
376
|
-
row.forEach(cell => traverse(cell));
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
};
|
|
381
|
-
traverse(components);
|
|
382
|
-
return fieldNames;
|
|
383
|
-
};
|
|
384
|
-
/**
|
|
385
|
-
* Resolve conditional data for a DataGrid component
|
|
386
|
-
* Evaluates all conditionalData rules and applies the first matching one
|
|
387
|
-
* Returns both dataSource and custom columns if defined
|
|
388
|
-
*
|
|
389
|
-
* @param conditions - Component conditions including conditionalData rules
|
|
390
|
-
* @param formValues - Current form field values
|
|
391
|
-
* @returns Object with dataSource and columns, or undefined if no condition matches
|
|
392
|
-
*/
|
|
393
|
-
export const resolveConditionalData = (conditions, formValues) => {
|
|
394
|
-
if (!conditions?.conditionalData || !Array.isArray(conditions.conditionalData)) {
|
|
395
|
-
return undefined;
|
|
396
|
-
}
|
|
397
|
-
// Evaluate each conditional data rule in order
|
|
398
|
-
for (const rule of conditions.conditionalData) {
|
|
399
|
-
if (ConditionalRuleEngine.evaluateCondition(rule.condition, formValues)) {
|
|
400
|
-
// Condition is met - resolve and return both data source and columns
|
|
401
|
-
return {
|
|
402
|
-
dataSource: rule.dataSource,
|
|
403
|
-
columns: rule.includeColumns ? rule.columns : undefined
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return undefined;
|
|
408
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
@import '@syncfusion/ej2-base/styles/bootstrap5.3.css';
|
|
2
|
-
@import '@syncfusion/ej2-buttons/styles/bootstrap5.3.css';
|
|
3
|
-
@import '@syncfusion/ej2-inputs/styles/bootstrap5.3.css';
|
|
4
|
-
@import '@syncfusion/ej2-dropdowns/styles/bootstrap5.3.css';
|
|
5
|
-
@import '@syncfusion/ej2-calendars/styles/bootstrap5.3.css';
|
|
6
|
-
@import '@syncfusion/ej2-react-calendars/styles/bootstrap5.3.css';
|
|
7
|
-
@import '@syncfusion/ej2-navigations/styles/bootstrap5.3.css';
|
|
8
|
-
@import '@syncfusion/ej2-notifications/styles/bootstrap5.3.css';
|
|
9
|
-
@import '@syncfusion/ej2-popups/styles/bootstrap5.3.css';
|
|
10
|
-
@import '@syncfusion/ej2-lists/styles/bootstrap5.3.css';
|
|
11
|
-
@import '@syncfusion/ej2-splitbuttons/styles/bootstrap5.3.css';
|
|
12
|
-
@import "@syncfusion/ej2-react-popups/styles/bootstrap5.3.css";
|
|
13
|
-
@import "@syncfusion/ej2-react-grids/styles/bootstrap5.3.css";
|
|
14
|
-
@import "@syncfusion/ej2-splitbuttons/styles/bootstrap5.3.css";
|
|
15
|
-
@import "@syncfusion/ej2-image-editor/styles/bootstrap5.3.css";
|
|
16
|
-
@import "@syncfusion/ej2-layouts/styles/bootstrap5.3.css";
|
|
17
|
-
@import '@syncfusion/ej2-richtexteditor/styles/bootstrap5.3.css';
|
|
18
|
-
@import 'form-renderer.base.css';
|
|
19
|
-
|
|
20
|
-
:root {
|
|
21
|
-
--sf-bg-color: #212529;
|
|
22
|
-
--sf-font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', arial, 'Noto Sans', 'Liberation Sans', sans-serif, 'apple color emoji', 'Segoe UI emoji', 'Segoe UI Symbol', 'Noto color emoji';
|
|
23
|
-
--sf-text-color: #dee2e6;
|
|
24
|
-
--sf-tooltip-text-color: #adb5bd;
|
|
25
|
-
--sf-layout-border-color: #495057;
|
|
26
|
-
}
|
package/styles/fluent2-dark.css
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
@import '@syncfusion/ej2-base/styles/fluent2.css';
|
|
2
|
-
@import '@syncfusion/ej2-buttons/styles/fluent2.css';
|
|
3
|
-
@import '@syncfusion/ej2-inputs/styles/fluent2.css';
|
|
4
|
-
@import '@syncfusion/ej2-dropdowns/styles/fluent2.css';
|
|
5
|
-
@import '@syncfusion/ej2-calendars/styles/fluent2.css';
|
|
6
|
-
@import '@syncfusion/ej2-react-calendars/styles/fluent2.css';
|
|
7
|
-
@import '@syncfusion/ej2-navigations/styles/fluent2.css';
|
|
8
|
-
@import '@syncfusion/ej2-notifications/styles/fluent2.css';
|
|
9
|
-
@import '@syncfusion/ej2-popups/styles/fluent2.css';
|
|
10
|
-
@import '@syncfusion/ej2-lists/styles/fluent2.css';
|
|
11
|
-
@import '@syncfusion/ej2-splitbuttons/styles/fluent2.css';
|
|
12
|
-
@import "@syncfusion/ej2-react-popups/styles/fluent2.css";
|
|
13
|
-
@import "@syncfusion/ej2-react-grids/styles/fluent2.css";
|
|
14
|
-
@import "@syncfusion/ej2-splitbuttons/styles/fluent2.css";
|
|
15
|
-
@import "@syncfusion/ej2-image-editor/styles/fluent2.css";
|
|
16
|
-
@import "@syncfusion/ej2-layouts/styles/fluent2.css";
|
|
17
|
-
@import '@syncfusion/ej2-richtexteditor/styles/fluent2.css';
|
|
18
|
-
@import 'form-renderer.base.css';
|
|
19
|
-
|
|
20
|
-
:root {
|
|
21
|
-
--sf-bg-color: #1f1f1f;
|
|
22
|
-
--sf-font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
|
|
23
|
-
--sf-text-color: #fff;
|
|
24
|
-
--sf-tooltip-text-color: #d6d6d6;
|
|
25
|
-
--sf-layout-border-color: #525252;
|
|
26
|
-
}
|