df-ae-forms-package 1.0.78 → 1.0.80

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
@@ -5144,7 +5144,7 @@ formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChan
5144
5144
  whiteSpace: 'nowrap',
5145
5145
  overflow: 'hidden',
5146
5146
  textOverflow: 'ellipsis'
5147
- }, children: component.basic?.label || `Column ${index + 1}` }, `header-${component.id}`))) })), dataEntries.length > 0 ? (dataEntries.map((entry, entryIndex) => (jsxs("div", { className: "table-row", style: {
5147
+ }, children: component.basic?.label || `Column ${index + 1}` }, `header-${component.id || index}`))) })), dataEntries.length > 0 ? (dataEntries.map((entry, entryIndex) => (jsxs("div", { className: "table-row", style: {
5148
5148
  // Use flex column for column view, grid for row view
5149
5149
  display: columnView ? 'flex' : 'grid',
5150
5150
  flexDirection: columnView ? 'column' : 'row',
@@ -6146,19 +6146,25 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6146
6146
  validatedComponent.children = getValidatedComponents(validatedComponent.children);
6147
6147
  }
6148
6148
  if (validatedComponent.cells && Array.isArray(validatedComponent.cells)) {
6149
- validatedComponent.cells = validatedComponent.cells.map((row) => {
6150
- if (Array.isArray(row)) {
6151
- return row.map((cell) => {
6149
+ validatedComponent.cells = validatedComponent.cells.map((rowOrCell) => {
6150
+ if (Array.isArray(rowOrCell)) {
6151
+ // Standard 2D: rowOrCell is an array of cells
6152
+ return rowOrCell.map((cell) => {
6152
6153
  if (cell && cell.components && Array.isArray(cell.components)) {
6153
- return {
6154
- ...cell,
6155
- components: getValidatedComponents(cell.components)
6156
- };
6154
+ return { ...cell, components: getValidatedComponents(cell.components) };
6157
6155
  }
6158
6156
  return cell;
6159
6157
  });
6160
6158
  }
6161
- return row;
6159
+ else if (typeof rowOrCell === 'object' && rowOrCell !== null) {
6160
+ // Flat 1D: rowOrCell IS the cell object
6161
+ const cell = rowOrCell;
6162
+ if (cell.components && Array.isArray(cell.components)) {
6163
+ return { ...cell, components: getValidatedComponents(cell.components) };
6164
+ }
6165
+ return cell;
6166
+ }
6167
+ return rowOrCell;
6162
6168
  });
6163
6169
  }
6164
6170
  if (validatedComponent.entries && Array.isArray(validatedComponent.entries)) {
@@ -6990,13 +6996,25 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6990
6996
  updatedComponent.children = updateComponentValues(updatedComponent.children);
6991
6997
  }
6992
6998
  if (updatedComponent.name === 'table' && updatedComponent.cells) {
6993
- updatedComponent.cells = updatedComponent.cells.map((row) => row.map((cell) => {
6994
- const updatedCell = { ...cell };
6995
- if (updatedCell.components) {
6996
- updatedCell.components = updateComponentValues(updatedCell.components);
6999
+ updatedComponent.cells = updatedComponent.cells.map((rowOrCell) => {
7000
+ if (Array.isArray(rowOrCell)) {
7001
+ return rowOrCell.map((cell) => {
7002
+ const updatedCell = { ...cell };
7003
+ if (updatedCell.components) {
7004
+ updatedCell.components = updateComponentValues(updatedCell.components);
7005
+ }
7006
+ return updatedCell;
7007
+ });
7008
+ }
7009
+ else {
7010
+ // 1D flat cell
7011
+ const updatedCell = { ...rowOrCell };
7012
+ if (updatedCell.components) {
7013
+ updatedCell.components = updateComponentValues(updatedCell.components);
7014
+ }
7015
+ return updatedCell;
6997
7016
  }
6998
- return updatedCell;
6999
- }));
7017
+ });
7000
7018
  }
7001
7019
  if (updatedComponent.name === 'datagrid' && updatedComponent.entries) {
7002
7020
  updatedComponent.entries = updatedComponent.entries.map((entry) => {
@@ -7177,24 +7195,35 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
7177
7195
  // Handle notes change for table cell components
7178
7196
  const updatedComponents = formComponents.map(comp => {
7179
7197
  if (comp.id === component.id && comp.cells) {
7180
- const updatedCells = comp.cells.map((row) => row.map((cell) => {
7181
- if (cell.components) {
7182
- const updatedCellComponents = cell.components.map((cellComp) => {
7183
- if (cellComp.id === componentId) {
7184
- return {
7185
- ...cellComp,
7186
- basic: {
7187
- ...cellComp.basic,
7188
- notes
7198
+ const updatedCells = comp.cells.map((rowOrCell) => {
7199
+ if (Array.isArray(rowOrCell)) {
7200
+ return rowOrCell.map((cell) => {
7201
+ if (cell.components) {
7202
+ const updatedCellComponents = cell.components.map((cellComp) => {
7203
+ if (cellComp.id === componentId) {
7204
+ return { ...cellComp, basic: { ...cellComp.basic, notes } };
7189
7205
  }
7190
- };
7206
+ return cellComp;
7207
+ });
7208
+ return { ...cell, components: updatedCellComponents };
7191
7209
  }
7192
- return cellComp;
7210
+ return cell;
7193
7211
  });
7194
- return { ...cell, components: updatedCellComponents };
7195
7212
  }
7196
- return cell;
7197
- }));
7213
+ else {
7214
+ const cell = rowOrCell;
7215
+ if (cell.components) {
7216
+ const updatedCellComponents = cell.components.map((cellComp) => {
7217
+ if (cellComp.id === componentId) {
7218
+ return { ...cellComp, basic: { ...cellComp.basic, notes } };
7219
+ }
7220
+ return cellComp;
7221
+ });
7222
+ return { ...cell, components: updatedCellComponents };
7223
+ }
7224
+ return cell;
7225
+ }
7226
+ });
7198
7227
  return { ...comp, cells: updatedCells };
7199
7228
  }
7200
7229
  return comp;
@@ -7204,24 +7233,35 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
7204
7233
  // Handle attachment change for table cell components
7205
7234
  const updatedComponents = formComponents.map(comp => {
7206
7235
  if (comp.id === component.id && comp.cells) {
7207
- const updatedCells = comp.cells.map((row) => row.map((cell) => {
7208
- if (cell.components) {
7209
- const updatedCellComponents = cell.components.map((cellComp) => {
7210
- if (cellComp.id === componentId) {
7211
- return {
7212
- ...cellComp,
7213
- basic: {
7214
- ...cellComp.basic,
7215
- attachments: attachments || []
7236
+ const updatedCells = comp.cells.map((rowOrCell) => {
7237
+ if (Array.isArray(rowOrCell)) {
7238
+ return rowOrCell.map((cell) => {
7239
+ if (cell.components) {
7240
+ const updatedCellComponents = cell.components.map((cellComp) => {
7241
+ if (cellComp.id === componentId) {
7242
+ return { ...cellComp, basic: { ...cellComp.basic, attachments: attachments || [] } };
7216
7243
  }
7217
- };
7244
+ return cellComp;
7245
+ });
7246
+ return { ...cell, components: updatedCellComponents };
7218
7247
  }
7219
- return cellComp;
7248
+ return cell;
7220
7249
  });
7221
- return { ...cell, components: updatedCellComponents };
7222
7250
  }
7223
- return cell;
7224
- }));
7251
+ else {
7252
+ const cell = rowOrCell;
7253
+ if (cell.components) {
7254
+ const updatedCellComponents = cell.components.map((cellComp) => {
7255
+ if (cellComp.id === componentId) {
7256
+ return { ...cellComp, basic: { ...cellComp.basic, attachments: attachments || [] } };
7257
+ }
7258
+ return cellComp;
7259
+ });
7260
+ return { ...cell, components: updatedCellComponents };
7261
+ }
7262
+ return cell;
7263
+ }
7264
+ });
7225
7265
  return { ...comp, cells: updatedCells };
7226
7266
  }
7227
7267
  return comp;
@@ -7621,15 +7661,22 @@ const DfFormTable = ({ id, properties, mode = 'edit', formData = {}, validationE
7621
7661
  const raw = properties.cells;
7622
7662
  if (!raw || !Array.isArray(raw) || raw.length === 0)
7623
7663
  return [];
7664
+ // DEBUG: Log cell structure to understand API format
7665
+ console.log('[DfFormTable] raw cells (first item):', JSON.stringify(raw[0], null, 2));
7666
+ console.log('[DfFormTable] is first item array?', Array.isArray(raw[0]));
7667
+ console.log('[DfFormTable] total cells:', raw.length);
7624
7668
  // Check if it's already a 2D array (first element is an array)
7625
7669
  if (Array.isArray(raw[0])) {
7670
+ console.log('[DfFormTable] Using 2D array format');
7626
7671
  return raw;
7627
7672
  }
7628
7673
  // It's a flat 1D array — reconstruct 2D using each cell's row/column
7674
+ console.log('[DfFormTable] Using 1D flat format, reconstructing 2D grid');
7629
7675
  const grid = [];
7630
7676
  raw.forEach((cell) => {
7631
7677
  const r = typeof cell.row === 'number' ? cell.row : 0;
7632
7678
  const c = typeof cell.column === 'number' ? cell.column : 0;
7679
+ console.log(`[DfFormTable] Cell at row=${r} col=${c}, components count:`, cell.components?.length ?? 0);
7633
7680
  if (!grid[r])
7634
7681
  grid[r] = [];
7635
7682
  grid[r][c] = cell;
@@ -7834,7 +7881,7 @@ const DfFormTable = ({ id, properties, mode = 'edit', formData = {}, validationE
7834
7881
  fontSize: '14px',
7835
7882
  textAlign: 'center'
7836
7883
  }, children: columnName }, `header-${colIndex}`));
7837
- }) }) })), jsx("tbody", { children: cellsWithIds.map((row, rowIndex) => (jsx("tr", { className: "table-row", children: row.map((cell) => (jsx(TableCellComponent, { cell: cell, mode: mode, onComponentSelect: onComponentSelect || (() => { }), onComponentDelete: handleComponentDelete, onComponentEdit: onComponentEdit, selectedComponent: selectedComponent || null, renderFormComponent: renderComponent, formData: formData, formTemplateId: formTemplateId, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, tableId: id, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue }, cell.id))) }, rowIndex))) })] })] }))] }));
7884
+ }) }) })), jsx("tbody", { children: cellsWithIds.filter(row => Array.isArray(row) && row.length > 0).map((row, rowIndex) => (jsx("tr", { className: "table-row", children: row.filter(cell => cell != null).map((cell) => (jsx(TableCellComponent, { cell: cell, mode: mode, onComponentSelect: onComponentSelect || (() => { }), onComponentDelete: handleComponentDelete, onComponentEdit: onComponentEdit, selectedComponent: selectedComponent || null, renderFormComponent: renderComponent, formData: formData, formTemplateId: formTemplateId, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, tableId: id, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue }, cell.id))) }, rowIndex))) })] })] }))] }));
7838
7885
  };
7839
7886
 
7840
7887
  var dfFormTable = /*#__PURE__*/Object.freeze({