df-ae-forms-package 1.0.78 → 1.0.79

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
@@ -5146,7 +5146,7 @@ formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChan
5146
5146
  whiteSpace: 'nowrap',
5147
5147
  overflow: 'hidden',
5148
5148
  textOverflow: 'ellipsis'
5149
- }, children: component.basic?.label || `Column ${index + 1}` }, `header-${component.id}`))) })), dataEntries.length > 0 ? (dataEntries.map((entry, entryIndex) => (jsxRuntime.jsxs("div", { className: "table-row", style: {
5149
+ }, children: component.basic?.label || `Column ${index + 1}` }, `header-${component.id || index}`))) })), dataEntries.length > 0 ? (dataEntries.map((entry, entryIndex) => (jsxRuntime.jsxs("div", { className: "table-row", style: {
5150
5150
  // Use flex column for column view, grid for row view
5151
5151
  display: columnView ? 'flex' : 'grid',
5152
5152
  flexDirection: columnView ? 'column' : 'row',
@@ -6992,13 +6992,25 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
6992
6992
  updatedComponent.children = updateComponentValues(updatedComponent.children);
6993
6993
  }
6994
6994
  if (updatedComponent.name === 'table' && updatedComponent.cells) {
6995
- updatedComponent.cells = updatedComponent.cells.map((row) => row.map((cell) => {
6996
- const updatedCell = { ...cell };
6997
- if (updatedCell.components) {
6998
- updatedCell.components = updateComponentValues(updatedCell.components);
6995
+ updatedComponent.cells = updatedComponent.cells.map((rowOrCell) => {
6996
+ if (Array.isArray(rowOrCell)) {
6997
+ return rowOrCell.map((cell) => {
6998
+ const updatedCell = { ...cell };
6999
+ if (updatedCell.components) {
7000
+ updatedCell.components = updateComponentValues(updatedCell.components);
7001
+ }
7002
+ return updatedCell;
7003
+ });
7004
+ }
7005
+ else {
7006
+ // 1D flat cell
7007
+ const updatedCell = { ...rowOrCell };
7008
+ if (updatedCell.components) {
7009
+ updatedCell.components = updateComponentValues(updatedCell.components);
7010
+ }
7011
+ return updatedCell;
6999
7012
  }
7000
- return updatedCell;
7001
- }));
7013
+ });
7002
7014
  }
7003
7015
  if (updatedComponent.name === 'datagrid' && updatedComponent.entries) {
7004
7016
  updatedComponent.entries = updatedComponent.entries.map((entry) => {
@@ -7179,24 +7191,35 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
7179
7191
  // Handle notes change for table cell components
7180
7192
  const updatedComponents = formComponents.map(comp => {
7181
7193
  if (comp.id === component.id && comp.cells) {
7182
- const updatedCells = comp.cells.map((row) => row.map((cell) => {
7183
- if (cell.components) {
7184
- const updatedCellComponents = cell.components.map((cellComp) => {
7185
- if (cellComp.id === componentId) {
7186
- return {
7187
- ...cellComp,
7188
- basic: {
7189
- ...cellComp.basic,
7190
- notes
7194
+ const updatedCells = comp.cells.map((rowOrCell) => {
7195
+ if (Array.isArray(rowOrCell)) {
7196
+ return rowOrCell.map((cell) => {
7197
+ if (cell.components) {
7198
+ const updatedCellComponents = cell.components.map((cellComp) => {
7199
+ if (cellComp.id === componentId) {
7200
+ return { ...cellComp, basic: { ...cellComp.basic, notes } };
7191
7201
  }
7192
- };
7202
+ return cellComp;
7203
+ });
7204
+ return { ...cell, components: updatedCellComponents };
7193
7205
  }
7194
- return cellComp;
7206
+ return cell;
7195
7207
  });
7196
- return { ...cell, components: updatedCellComponents };
7197
7208
  }
7198
- return cell;
7199
- }));
7209
+ else {
7210
+ const cell = rowOrCell;
7211
+ if (cell.components) {
7212
+ const updatedCellComponents = cell.components.map((cellComp) => {
7213
+ if (cellComp.id === componentId) {
7214
+ return { ...cellComp, basic: { ...cellComp.basic, notes } };
7215
+ }
7216
+ return cellComp;
7217
+ });
7218
+ return { ...cell, components: updatedCellComponents };
7219
+ }
7220
+ return cell;
7221
+ }
7222
+ });
7200
7223
  return { ...comp, cells: updatedCells };
7201
7224
  }
7202
7225
  return comp;
@@ -7206,24 +7229,35 @@ onComponentSelect, onComponentDelete, onComponentEdit, onComponentUpdate, select
7206
7229
  // Handle attachment change for table cell components
7207
7230
  const updatedComponents = formComponents.map(comp => {
7208
7231
  if (comp.id === component.id && comp.cells) {
7209
- const updatedCells = comp.cells.map((row) => row.map((cell) => {
7210
- if (cell.components) {
7211
- const updatedCellComponents = cell.components.map((cellComp) => {
7212
- if (cellComp.id === componentId) {
7213
- return {
7214
- ...cellComp,
7215
- basic: {
7216
- ...cellComp.basic,
7217
- attachments: attachments || []
7232
+ const updatedCells = comp.cells.map((rowOrCell) => {
7233
+ if (Array.isArray(rowOrCell)) {
7234
+ return rowOrCell.map((cell) => {
7235
+ if (cell.components) {
7236
+ const updatedCellComponents = cell.components.map((cellComp) => {
7237
+ if (cellComp.id === componentId) {
7238
+ return { ...cellComp, basic: { ...cellComp.basic, attachments: attachments || [] } };
7218
7239
  }
7219
- };
7240
+ return cellComp;
7241
+ });
7242
+ return { ...cell, components: updatedCellComponents };
7220
7243
  }
7221
- return cellComp;
7244
+ return cell;
7222
7245
  });
7223
- return { ...cell, components: updatedCellComponents };
7224
7246
  }
7225
- return cell;
7226
- }));
7247
+ else {
7248
+ const cell = rowOrCell;
7249
+ if (cell.components) {
7250
+ const updatedCellComponents = cell.components.map((cellComp) => {
7251
+ if (cellComp.id === componentId) {
7252
+ return { ...cellComp, basic: { ...cellComp.basic, attachments: attachments || [] } };
7253
+ }
7254
+ return cellComp;
7255
+ });
7256
+ return { ...cell, components: updatedCellComponents };
7257
+ }
7258
+ return cell;
7259
+ }
7260
+ });
7227
7261
  return { ...comp, cells: updatedCells };
7228
7262
  }
7229
7263
  return comp;
@@ -7836,7 +7870,7 @@ const DfFormTable = ({ id, properties, mode = 'edit', formData = {}, validationE
7836
7870
  fontSize: '14px',
7837
7871
  textAlign: 'center'
7838
7872
  }, children: columnName }, `header-${colIndex}`));
7839
- }) }) })), jsxRuntime.jsx("tbody", { children: cellsWithIds.map((row, rowIndex) => (jsxRuntime.jsx("tr", { className: "table-row", children: row.map((cell) => (jsxRuntime.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))) })] })] }))] }));
7873
+ }) }) })), jsxRuntime.jsx("tbody", { children: cellsWithIds.filter(row => Array.isArray(row) && row.length > 0).map((row, rowIndex) => (jsxRuntime.jsx("tr", { className: "table-row", children: row.filter(cell => cell != null).map((cell) => (jsxRuntime.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))) })] })] }))] }));
7840
7874
  };
7841
7875
 
7842
7876
  var dfFormTable = /*#__PURE__*/Object.freeze({