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.js CHANGED
@@ -178,9 +178,21 @@ class ConditionalLogicService {
178
178
  if (found)
179
179
  return found;
180
180
  }
181
- if (comp.name === 'table' && comp.cells) {
182
- for (const row of comp.cells) {
183
- for (const cell of row) {
181
+ if (comp.name === 'table' && comp.cells && Array.isArray(comp.cells)) {
182
+ for (const rowOrCell of comp.cells) {
183
+ // Handle 2D array structure (standard: cells[row][col])
184
+ if (Array.isArray(rowOrCell)) {
185
+ for (const cell of rowOrCell) {
186
+ if (cell.components) {
187
+ const found = this.findComponent(cell.components, componentId);
188
+ if (found)
189
+ return found;
190
+ }
191
+ }
192
+ }
193
+ // Handle 1D array structure (flat: cells[i]) - robust fallback
194
+ else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
195
+ const cell = rowOrCell;
184
196
  if (cell.components) {
185
197
  const found = this.findComponent(cell.components, componentId);
186
198
  if (found)
@@ -222,9 +234,18 @@ class ConditionalLogicService {
222
234
  traverse(item.children);
223
235
  if (item.templateComponents)
224
236
  traverse(item.templateComponents);
225
- if (item.cells) {
226
- for (const row of item.cells) {
227
- for (const cell of row) {
237
+ if (item.cells && Array.isArray(item.cells)) {
238
+ for (const rowOrCell of item.cells) {
239
+ // Handle 2D array structure (standard)
240
+ if (Array.isArray(rowOrCell)) {
241
+ for (const cell of rowOrCell) {
242
+ if (cell.components)
243
+ traverse(cell.components);
244
+ }
245
+ }
246
+ // Handle 1D array structure (flat)
247
+ else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
248
+ const cell = rowOrCell;
228
249
  if (cell.components)
229
250
  traverse(cell.components);
230
251
  }
@@ -6012,14 +6033,22 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6012
6033
  }
6013
6034
  // Handle nested components in table cells
6014
6035
  if (component.cells && Array.isArray(component.cells)) {
6015
- component.cells.forEach((row, _rowIndex) => {
6016
- if (Array.isArray(row)) {
6017
- row.forEach((cell, _cellIndex) => {
6036
+ component.cells.forEach((rowOrCell, _rowIndex) => {
6037
+ // Handle 2D array (standard)
6038
+ if (Array.isArray(rowOrCell)) {
6039
+ rowOrCell.forEach((cell, _cellIndex) => {
6018
6040
  if (cell && cell.components && Array.isArray(cell.components)) {
6019
6041
  initializeComponentValues(cell.components, values);
6020
6042
  }
6021
6043
  });
6022
6044
  }
6045
+ // Handle 1D array (flat)
6046
+ else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
6047
+ const cell = rowOrCell;
6048
+ if (cell && cell.components && Array.isArray(cell.components)) {
6049
+ initializeComponentValues(cell.components, values);
6050
+ }
6051
+ }
6023
6052
  });
6024
6053
  }
6025
6054
  // Handle nested components in datagrid entries
@@ -6080,11 +6109,23 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6080
6109
  // Recurse
6081
6110
  if (comp.children)
6082
6111
  extractNotesAndAttachments(comp.children);
6083
- if (comp.cells)
6084
- comp.cells.forEach((row) => row.forEach((cell) => {
6085
- if (cell.components)
6086
- extractNotesAndAttachments(cell.components);
6087
- }));
6112
+ if (comp.cells && Array.isArray(comp.cells)) {
6113
+ comp.cells.forEach((rowOrCell) => {
6114
+ // Handle 2D array
6115
+ if (Array.isArray(rowOrCell)) {
6116
+ rowOrCell.forEach((cell) => {
6117
+ if (cell.components)
6118
+ extractNotesAndAttachments(cell.components);
6119
+ });
6120
+ }
6121
+ // Handle 1D array
6122
+ else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
6123
+ const cell = rowOrCell;
6124
+ if (cell.components)
6125
+ extractNotesAndAttachments(cell.components);
6126
+ }
6127
+ });
6128
+ }
6088
6129
  if (comp.entries)
6089
6130
  comp.entries.forEach((entry) => {
6090
6131
  if (entry.components)
@@ -6121,9 +6162,10 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6121
6162
  validatedComponent.children = getValidatedComponents(validatedComponent.children);
6122
6163
  }
6123
6164
  if (validatedComponent.cells && Array.isArray(validatedComponent.cells)) {
6124
- validatedComponent.cells = validatedComponent.cells.map((row) => {
6125
- if (Array.isArray(row)) {
6126
- return row.map((cell) => {
6165
+ validatedComponent.cells = validatedComponent.cells.map((rowOrCell) => {
6166
+ // Handle 2D array
6167
+ if (Array.isArray(rowOrCell)) {
6168
+ return rowOrCell.map((cell) => {
6127
6169
  if (cell && cell.components && Array.isArray(cell.components)) {
6128
6170
  return {
6129
6171
  ...cell,
@@ -6133,7 +6175,18 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6133
6175
  return cell;
6134
6176
  });
6135
6177
  }
6136
- return row;
6178
+ // Handle 1D array
6179
+ else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
6180
+ const cell = rowOrCell;
6181
+ if (cell && cell.components && Array.isArray(cell.components)) {
6182
+ return {
6183
+ ...cell,
6184
+ components: getValidatedComponents(cell.components)
6185
+ };
6186
+ }
6187
+ return cell;
6188
+ }
6189
+ return rowOrCell;
6137
6190
  });
6138
6191
  }
6139
6192
  if (validatedComponent.entries && Array.isArray(validatedComponent.entries)) {