df-ae-forms-package 1.0.70 → 1.0.71

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 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 row of comp.cells) {
181
- for (const cell of row) {
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 row of item.cells) {
225
- for (const cell of row) {
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((row, _rowIndex) => {
6014
- if (Array.isArray(row)) {
6015
- row.forEach((cell, _cellIndex) => {
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((row) => row.forEach((cell) => {
6083
- if (cell.components)
6084
- extractNotesAndAttachments(cell.components);
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((row) => {
6123
- if (Array.isArray(row)) {
6124
- return row.map((cell) => {
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
- return row;
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)) {