df-ae-forms-package 1.0.70 → 1.0.72
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/dist/index.esm.js +89 -33
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +89 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -176,9 +176,21 @@ class ConditionalLogicService {
|
|
|
176
176
|
if (found)
|
|
177
177
|
return found;
|
|
178
178
|
}
|
|
179
|
-
if (comp.name === 'table' && comp.cells) {
|
|
180
|
-
for (const
|
|
181
|
-
|
|
179
|
+
if (comp.name === 'table' && comp.cells && Array.isArray(comp.cells)) {
|
|
180
|
+
for (const rowOrCell of comp.cells) {
|
|
181
|
+
// Handle 2D array structure (standard: cells[row][col])
|
|
182
|
+
if (Array.isArray(rowOrCell)) {
|
|
183
|
+
for (const cell of rowOrCell) {
|
|
184
|
+
if (cell.components) {
|
|
185
|
+
const found = this.findComponent(cell.components, componentId);
|
|
186
|
+
if (found)
|
|
187
|
+
return found;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Handle 1D array structure (flat: cells[i]) - robust fallback
|
|
192
|
+
else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
|
|
193
|
+
const cell = rowOrCell;
|
|
182
194
|
if (cell.components) {
|
|
183
195
|
const found = this.findComponent(cell.components, componentId);
|
|
184
196
|
if (found)
|
|
@@ -220,9 +232,18 @@ class ConditionalLogicService {
|
|
|
220
232
|
traverse(item.children);
|
|
221
233
|
if (item.templateComponents)
|
|
222
234
|
traverse(item.templateComponents);
|
|
223
|
-
if (item.cells) {
|
|
224
|
-
for (const
|
|
225
|
-
|
|
235
|
+
if (item.cells && Array.isArray(item.cells)) {
|
|
236
|
+
for (const rowOrCell of item.cells) {
|
|
237
|
+
// Handle 2D array structure (standard)
|
|
238
|
+
if (Array.isArray(rowOrCell)) {
|
|
239
|
+
for (const cell of rowOrCell) {
|
|
240
|
+
if (cell.components)
|
|
241
|
+
traverse(cell.components);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Handle 1D array structure (flat)
|
|
245
|
+
else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
|
|
246
|
+
const cell = rowOrCell;
|
|
226
247
|
if (cell.components)
|
|
227
248
|
traverse(cell.components);
|
|
228
249
|
}
|
|
@@ -6010,14 +6031,22 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
6010
6031
|
}
|
|
6011
6032
|
// Handle nested components in table cells
|
|
6012
6033
|
if (component.cells && Array.isArray(component.cells)) {
|
|
6013
|
-
component.cells.forEach((
|
|
6014
|
-
|
|
6015
|
-
|
|
6034
|
+
component.cells.forEach((rowOrCell, _rowIndex) => {
|
|
6035
|
+
// Handle 2D array (standard)
|
|
6036
|
+
if (Array.isArray(rowOrCell)) {
|
|
6037
|
+
rowOrCell.forEach((cell, _cellIndex) => {
|
|
6016
6038
|
if (cell && cell.components && Array.isArray(cell.components)) {
|
|
6017
6039
|
initializeComponentValues(cell.components, values);
|
|
6018
6040
|
}
|
|
6019
6041
|
});
|
|
6020
6042
|
}
|
|
6043
|
+
// Handle 1D array (flat)
|
|
6044
|
+
else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
|
|
6045
|
+
const cell = rowOrCell;
|
|
6046
|
+
if (cell && cell.components && Array.isArray(cell.components)) {
|
|
6047
|
+
initializeComponentValues(cell.components, values);
|
|
6048
|
+
}
|
|
6049
|
+
}
|
|
6021
6050
|
});
|
|
6022
6051
|
}
|
|
6023
6052
|
// Handle nested components in datagrid entries
|
|
@@ -6078,11 +6107,23 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
6078
6107
|
// Recurse
|
|
6079
6108
|
if (comp.children)
|
|
6080
6109
|
extractNotesAndAttachments(comp.children);
|
|
6081
|
-
if (comp.cells)
|
|
6082
|
-
comp.cells.forEach((
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6110
|
+
if (comp.cells && Array.isArray(comp.cells)) {
|
|
6111
|
+
comp.cells.forEach((rowOrCell) => {
|
|
6112
|
+
// Handle 2D array
|
|
6113
|
+
if (Array.isArray(rowOrCell)) {
|
|
6114
|
+
rowOrCell.forEach((cell) => {
|
|
6115
|
+
if (cell.components)
|
|
6116
|
+
extractNotesAndAttachments(cell.components);
|
|
6117
|
+
});
|
|
6118
|
+
}
|
|
6119
|
+
// Handle 1D array
|
|
6120
|
+
else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
|
|
6121
|
+
const cell = rowOrCell;
|
|
6122
|
+
if (cell.components)
|
|
6123
|
+
extractNotesAndAttachments(cell.components);
|
|
6124
|
+
}
|
|
6125
|
+
});
|
|
6126
|
+
}
|
|
6086
6127
|
if (comp.entries)
|
|
6087
6128
|
comp.entries.forEach((entry) => {
|
|
6088
6129
|
if (entry.components)
|
|
@@ -6119,9 +6160,10 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
6119
6160
|
validatedComponent.children = getValidatedComponents(validatedComponent.children);
|
|
6120
6161
|
}
|
|
6121
6162
|
if (validatedComponent.cells && Array.isArray(validatedComponent.cells)) {
|
|
6122
|
-
validatedComponent.cells = validatedComponent.cells.map((
|
|
6123
|
-
|
|
6124
|
-
|
|
6163
|
+
validatedComponent.cells = validatedComponent.cells.map((rowOrCell) => {
|
|
6164
|
+
// Handle 2D array
|
|
6165
|
+
if (Array.isArray(rowOrCell)) {
|
|
6166
|
+
return rowOrCell.map((cell) => {
|
|
6125
6167
|
if (cell && cell.components && Array.isArray(cell.components)) {
|
|
6126
6168
|
return {
|
|
6127
6169
|
...cell,
|
|
@@ -6131,7 +6173,18 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
6131
6173
|
return cell;
|
|
6132
6174
|
});
|
|
6133
6175
|
}
|
|
6134
|
-
|
|
6176
|
+
// Handle 1D array
|
|
6177
|
+
else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
|
|
6178
|
+
const cell = rowOrCell;
|
|
6179
|
+
if (cell && cell.components && Array.isArray(cell.components)) {
|
|
6180
|
+
return {
|
|
6181
|
+
...cell,
|
|
6182
|
+
components: getValidatedComponents(cell.components)
|
|
6183
|
+
};
|
|
6184
|
+
}
|
|
6185
|
+
return cell;
|
|
6186
|
+
}
|
|
6187
|
+
return rowOrCell;
|
|
6135
6188
|
});
|
|
6136
6189
|
}
|
|
6137
6190
|
if (validatedComponent.entries && Array.isArray(validatedComponent.entries)) {
|
|
@@ -6216,12 +6269,22 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
6216
6269
|
}
|
|
6217
6270
|
// Handle nested components in table cells
|
|
6218
6271
|
if (component.cells && Array.isArray(component.cells)) {
|
|
6219
|
-
component.cells.forEach((
|
|
6220
|
-
|
|
6272
|
+
component.cells.forEach((rowOrCell) => {
|
|
6273
|
+
// Handle 2D array (standard)
|
|
6274
|
+
if (Array.isArray(rowOrCell)) {
|
|
6275
|
+
rowOrCell.forEach((cell) => {
|
|
6276
|
+
if (cell.components && Array.isArray(cell.components)) {
|
|
6277
|
+
evaluateComponentConditionalLogic(cell.components, visibility, currentFormValues, fullSchema);
|
|
6278
|
+
}
|
|
6279
|
+
});
|
|
6280
|
+
}
|
|
6281
|
+
// Handle 1D array (flat)
|
|
6282
|
+
else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
|
|
6283
|
+
const cell = rowOrCell;
|
|
6221
6284
|
if (cell.components && Array.isArray(cell.components)) {
|
|
6222
6285
|
evaluateComponentConditionalLogic(cell.components, visibility, currentFormValues, fullSchema);
|
|
6223
6286
|
}
|
|
6224
|
-
}
|
|
6287
|
+
}
|
|
6225
6288
|
});
|
|
6226
6289
|
}
|
|
6227
6290
|
// Handle nested components in datagrid entries
|
|
@@ -6256,19 +6319,12 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
|
|
|
6256
6319
|
}, [formComponents, formValues]);
|
|
6257
6320
|
// Check if a component should be visible based on conditional logic
|
|
6258
6321
|
const shouldShowComponent = useCallback((componentId) => {
|
|
6259
|
-
//
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
// Table and datagrid components are always visible at the root level (their contents handle logic)
|
|
6263
|
-
if (component && (component.name === 'table' || component.name === 'datagrid')) {
|
|
6264
|
-
return true;
|
|
6322
|
+
// Check the visibility map first
|
|
6323
|
+
if (componentVisibility.hasOwnProperty(componentId)) {
|
|
6324
|
+
return componentVisibility[componentId] === true;
|
|
6265
6325
|
}
|
|
6266
|
-
//
|
|
6267
|
-
|
|
6268
|
-
const isVisible = (componentVisibility[componentId] !== false) &&
|
|
6269
|
-
(!component?._id || componentVisibility[component._id] !== false) &&
|
|
6270
|
-
(!component?.id || componentVisibility[component.id] !== false);
|
|
6271
|
-
return isVisible;
|
|
6326
|
+
// If not in visibility map, component should be visible by default
|
|
6327
|
+
return true;
|
|
6272
6328
|
}, [componentVisibility, formComponents]);
|
|
6273
6329
|
// Handle form value changes and re-evaluate conditional logic
|
|
6274
6330
|
const onFormValueChange = useCallback((change) => {
|