df-ae-forms-package 1.1.10 → 1.1.11
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.d.ts +5 -3
- package/dist/index.esm.js +67 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +67 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -335,6 +335,8 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
335
335
|
'John Smith',
|
|
336
336
|
'Sarah Johnson'
|
|
337
337
|
], workOrderNumber: initialWorkOrderNumber, assetNumber: initialAssetNumber, isStandalone, allowWorkflowActions, inEditMode = false, isEdit }) => {
|
|
338
|
+
// DEBUG: Log the isStandalone value
|
|
339
|
+
console.log('RaiseIssueModal - isStandalone:', isStandalone, 'type:', typeof isStandalone);
|
|
338
340
|
const [title, setTitle] = React.useState('');
|
|
339
341
|
const [description, setDescription] = React.useState('');
|
|
340
342
|
const [workOrderNumber, setWorkOrderNumber] = React.useState('');
|
|
@@ -408,6 +410,14 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
408
410
|
setLocalAttachments(prev => [...prev, ...newFiles]);
|
|
409
411
|
}
|
|
410
412
|
};
|
|
413
|
+
const convertFileToBase64 = (file) => {
|
|
414
|
+
return new Promise((resolve, reject) => {
|
|
415
|
+
const reader = new FileReader();
|
|
416
|
+
reader.readAsDataURL(file);
|
|
417
|
+
reader.onload = () => resolve(reader.result);
|
|
418
|
+
reader.onerror = error => reject(error);
|
|
419
|
+
});
|
|
420
|
+
};
|
|
411
421
|
const getAttachmentName = (file) => {
|
|
412
422
|
if (!file)
|
|
413
423
|
return 'Attachment';
|
|
@@ -438,10 +448,25 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
438
448
|
}
|
|
439
449
|
return null;
|
|
440
450
|
}
|
|
441
|
-
if (file.data
|
|
442
|
-
|
|
443
|
-
|
|
451
|
+
if (file.data) {
|
|
452
|
+
if (isDataUrlImage(file.data))
|
|
453
|
+
return file.data;
|
|
454
|
+
// Handle raw base64 data from API
|
|
455
|
+
if (file.fileName && isImage(file.fileName)) {
|
|
456
|
+
const fileName = String(file.fileName).toLowerCase();
|
|
457
|
+
let mimeType = 'image/png'; // Default
|
|
458
|
+
if (fileName.endsWith('.jpg') || fileName.endsWith('.jpeg'))
|
|
459
|
+
mimeType = 'image/jpeg';
|
|
460
|
+
else if (fileName.endsWith('.png'))
|
|
461
|
+
mimeType = 'image/png';
|
|
462
|
+
else if (fileName.endsWith('.gif'))
|
|
463
|
+
mimeType = 'image/gif';
|
|
464
|
+
else if (fileName.endsWith('.webp'))
|
|
465
|
+
mimeType = 'image/webp';
|
|
466
|
+
return `data:${mimeType};base64,${file.data}`;
|
|
467
|
+
}
|
|
444
468
|
return file.data;
|
|
469
|
+
}
|
|
445
470
|
return null;
|
|
446
471
|
};
|
|
447
472
|
React.useEffect(() => {
|
|
@@ -587,6 +612,17 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
587
612
|
try {
|
|
588
613
|
if (isEditMode && issue) {
|
|
589
614
|
// Update existing issue
|
|
615
|
+
// Convert attachments to base64 objects for API
|
|
616
|
+
const attachmentObjects = await Promise.all(localAttachments.map(async (file) => {
|
|
617
|
+
if (file instanceof File) {
|
|
618
|
+
const base64 = await convertFileToBase64(file);
|
|
619
|
+
return {
|
|
620
|
+
fileName: file.name,
|
|
621
|
+
data: base64
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
return file; // Already a data object
|
|
625
|
+
}));
|
|
590
626
|
const updateData = {
|
|
591
627
|
title: String(title || '').trim(),
|
|
592
628
|
description: String(description || '').trim(),
|
|
@@ -600,7 +636,8 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
600
636
|
comments: String(comments || '').trim() || '',
|
|
601
637
|
task: issue.component?.basic?.label || '',
|
|
602
638
|
taskValue: issue.component?.basic?.value || '',
|
|
603
|
-
isStandalone: !!isStandalone
|
|
639
|
+
isStandalone: !!isStandalone,
|
|
640
|
+
attachments: attachmentObjects
|
|
604
641
|
};
|
|
605
642
|
if (onUpdateIssue && issue._id) {
|
|
606
643
|
await onUpdateIssue(issue._id, updateData);
|
|
@@ -632,6 +669,17 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
632
669
|
comments: String(notes || '')
|
|
633
670
|
}
|
|
634
671
|
};
|
|
672
|
+
// Convert attachments to base64 objects for API
|
|
673
|
+
const attachmentObjects = await Promise.all(localAttachments.map(async (file) => {
|
|
674
|
+
if (file instanceof File) {
|
|
675
|
+
const base64 = await convertFileToBase64(file);
|
|
676
|
+
return {
|
|
677
|
+
fileName: file.name,
|
|
678
|
+
data: base64
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
return file; // Already a data object
|
|
682
|
+
}));
|
|
635
683
|
const createdBy = user ? `${user.firstName || ''} ${user.lastName || ''}`.trim() : 'User';
|
|
636
684
|
const issueData = {
|
|
637
685
|
title: String(title || '').trim(),
|
|
@@ -647,11 +695,12 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
647
695
|
createdBy,
|
|
648
696
|
task: component?.basic?.label || '',
|
|
649
697
|
taskValue: component?.basic?.value || '',
|
|
650
|
-
isStandalone: !!isStandalone
|
|
698
|
+
isStandalone: !!isStandalone,
|
|
699
|
+
attachments: attachmentObjects // Include in data as well
|
|
651
700
|
};
|
|
652
|
-
let createdIssueResponse;
|
|
701
|
+
let createdIssueResponse;
|
|
653
702
|
if (onCreateIssue) {
|
|
654
|
-
createdIssueResponse = await onCreateIssue(issueData,
|
|
703
|
+
createdIssueResponse = await onCreateIssue(issueData, attachmentObjects);
|
|
655
704
|
}
|
|
656
705
|
toastService.showSuccess('Issue raised successfully');
|
|
657
706
|
if (onSuccess) {
|
|
@@ -4248,7 +4297,7 @@ const ComponentActionFeatures = ({ component, mode, formTemplateId, formValue, f
|
|
|
4248
4297
|
modalComponent.basic.value = selectedOption.value || effectiveValue;
|
|
4249
4298
|
}
|
|
4250
4299
|
return modalComponent;
|
|
4251
|
-
})(), formTemplateId: formTemplateId || '', notes: localNotes, attachments: localAttachments, isStandalone: isStandalone, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode }))] }));
|
|
4300
|
+
})(), formTemplateId: formTemplateId || '', notes: localNotes, attachments: localAttachments, isStandalone: isStandalone, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode })), console.log('ComponentActionFeatures - isStandalone:', isStandalone, 'workOrderNumber:', workOrderNumber, 'assetNumber:', assetNumber)] }));
|
|
4252
4301
|
};
|
|
4253
4302
|
|
|
4254
4303
|
// Attachment Thumbnails Component for Submission View
|
|
@@ -5152,7 +5201,7 @@ const DfFormDataGrid = ({ id, properties, mode = 'edit', formData = {}, onValueC
|
|
|
5152
5201
|
templateComponents: gridComponents, dataEntries: dataEntries, renderFormComponent: renderFormComponent || renderComponent, mode: mode, allowAddRemoveEntries: properties.datagrid?.allowAddRemoveEntries ?? true, addAnotherText: properties.datagrid?.addAnotherText ?? 'Add Entry', removeText: properties.datagrid?.removeText ?? 'Remove', maxEntries: properties.datagrid?.maxEntries ?? 10, minEntries: properties.datagrid?.minEntries ?? 1, displayAsGrid: properties.datagrid?.displayAsGrid ?? true, onAddEntry: handleAddEntry, onRemoveEntry: handleRemoveEntry, formData: formData, formTemplateId: formTemplateId, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, columnView: properties.datagrid?.columnView, shouldShowComponent: shouldShowComponent })) }))] }));
|
|
5153
5202
|
};
|
|
5154
5203
|
|
|
5155
|
-
const DraggableChild = ({ child, selectedChild, mode, onChildSelect, onChildDelete, renderFormComponent, isOverlay = false, isChildrenEditMode = false, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode }) => {
|
|
5204
|
+
const DraggableChild = ({ child, selectedChild, mode, onChildSelect, onChildDelete, renderFormComponent, isOverlay = false, isChildrenEditMode = false, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode, isStandalone }) => {
|
|
5156
5205
|
const formValue = formData[child.id];
|
|
5157
5206
|
// Check if component has notes or attachments for submission view
|
|
5158
5207
|
const hasSubmissionData = mode === 'preview' && ((child.basic?.notes && child.basic.notes.trim().length > 0) ||
|
|
@@ -5170,9 +5219,9 @@ const DraggableChild = ({ child, selectedChild, mode, onChildSelect, onChildDele
|
|
|
5170
5219
|
return (jsxRuntime.jsxs("div", { ref: setNodeRef, style: style, className: `form-component section-child ${selectedChild?.id === child.id ? 'selected' : ''} ${isDragging ? 'dragging' : ''} ${isSorting ? 'sorting' : ''} ${isChildrenEditMode ? 'children-edit-active' : ''}`, onClick: () => !isDragging && onChildSelect(child), role: "button", tabIndex: 0, children: [(mode === 'edit' || isChildrenEditMode) && (jsxRuntime.jsx("div", { className: "child-drag-handle", ...listeners, ...attributes, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsxRuntime.jsx(lucideReact.GripVertical, { size: 14 }) })), jsxRuntime.jsxs("div", { className: "form-component-content section-child-content", children: [(mode === 'edit' || isChildrenEditMode) && (jsxRuntime.jsxs("div", { className: "component-actions child-actions", children: [jsxRuntime.jsx("button", { className: "btn edit-btn", onClick: (e) => {
|
|
5171
5220
|
e.stopPropagation();
|
|
5172
5221
|
onChildSelect(child);
|
|
5173
|
-
}, onMouseDown: (e) => e.stopPropagation(), title: "Edit properties", children: jsxRuntime.jsx(lucideReact.Edit, { size: 12 }) }), jsxRuntime.jsx("button", { className: "btn delete-btn", onClick: (e) => onChildDelete(child, e), onMouseDown: (e) => e.stopPropagation(), title: "Delete component", children: jsxRuntime.jsx(lucideReact.Trash2, { size: 12 }) })] })), jsxRuntime.jsxs("div", { className: "component-preview child-preview", children: [renderFormComponent(child), !['section', 'table', 'heading', 'file', 'instructions', 'signature', 'location', 'datagrid'].includes(child.name) && (jsxRuntime.jsx(ComponentActionFeatures, { component: child, mode: "test", formTemplateId: formTemplateId, formValue: formValue, formData: formData, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange ? (notes) => onNotesChange(child.id, notes) : undefined, onAttachmentChange: onAttachmentChange ? (attachments) => onAttachmentChange(child.id, attachments) : undefined, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode })), hasSubmissionData && (jsxRuntime.jsx(ComponentSubmissionActions, { component: child }))] })] })] }));
|
|
5222
|
+
}, onMouseDown: (e) => e.stopPropagation(), title: "Edit properties", children: jsxRuntime.jsx(lucideReact.Edit, { size: 12 }) }), jsxRuntime.jsx("button", { className: "btn delete-btn", onClick: (e) => onChildDelete(child, e), onMouseDown: (e) => e.stopPropagation(), title: "Delete component", children: jsxRuntime.jsx(lucideReact.Trash2, { size: 12 }) })] })), jsxRuntime.jsxs("div", { className: "component-preview child-preview", children: [renderFormComponent(child), !['section', 'table', 'heading', 'file', 'instructions', 'signature', 'location', 'datagrid'].includes(child.name) && (jsxRuntime.jsx(ComponentActionFeatures, { component: child, mode: "test", formTemplateId: formTemplateId, formValue: formValue, formData: formData, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange ? (notes) => onNotesChange(child.id, notes) : undefined, onAttachmentChange: onAttachmentChange ? (attachments) => onAttachmentChange(child.id, attachments) : undefined, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode, isStandalone: isStandalone })), hasSubmissionData && (jsxRuntime.jsx(ComponentSubmissionActions, { component: child }))] })] })] }));
|
|
5174
5223
|
};
|
|
5175
|
-
const DfFormSection = ({ id, properties, mode = 'edit', formData = {}, onValueChange, onSelect, isSelected = false, className = '', onSectionSelect, onChildSelect, onChildDelete, selectedChild, renderFormComponent, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode }) => {
|
|
5224
|
+
const DfFormSection = ({ id, properties, mode = 'edit', formData = {}, onValueChange, onSelect, isSelected = false, className = '', onSectionSelect, onChildSelect, onChildDelete, selectedChild, renderFormComponent, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode, isStandalone }) => {
|
|
5176
5225
|
const [isCollapsed, setIsCollapsed] = React.useState(properties.basic.collapsed);
|
|
5177
5226
|
const [isEditingTitle, setIsEditingTitle] = React.useState(false);
|
|
5178
5227
|
const [isEditingDescription, setIsEditingDescription] = React.useState(false);
|
|
@@ -5385,7 +5434,7 @@ const DfFormSection = ({ id, properties, mode = 'edit', formData = {}, onValueCh
|
|
|
5385
5434
|
}, children: isOver ? 'Drop components here' : 'Empty Section' }), jsxRuntime.jsx("div", { style: {
|
|
5386
5435
|
fontSize: '12px',
|
|
5387
5436
|
color: '#9ca3af'
|
|
5388
|
-
}, children: "Drag and drop components here to create your section" })] })) : (children.map((child) => (jsxRuntime.jsx(DraggableChild, { child: child, selectedChild: selectedChild || null, mode: mode, onChildSelect: handleChildSelect, onChildDelete: handleChildDelete, renderFormComponent: renderComponent, isChildrenEditMode: isChildrenEditMode, formData: formData, formTemplateId: formTemplateId, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode }, child.id)))) }) }))] }));
|
|
5437
|
+
}, children: "Drag and drop components here to create your section" })] })) : (children.map((child) => (jsxRuntime.jsx(DraggableChild, { child: child, selectedChild: selectedChild || null, mode: mode, onChildSelect: handleChildSelect, onChildDelete: handleChildDelete, renderFormComponent: renderComponent, isChildrenEditMode: isChildrenEditMode, formData: formData, formTemplateId: formTemplateId, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode, isStandalone: isStandalone }, child.id)))) }) }))] }));
|
|
5389
5438
|
};
|
|
5390
5439
|
|
|
5391
5440
|
// Dynamic imports to avoid circular dependencies
|
|
@@ -7295,12 +7344,12 @@ const ensureComponentHasId = (component) => {
|
|
|
7295
7344
|
}
|
|
7296
7345
|
return component;
|
|
7297
7346
|
};
|
|
7298
|
-
const SimpleTableComponent = ({ component, mode, renderFormComponent, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode }) => {
|
|
7347
|
+
const SimpleTableComponent = ({ component, mode, renderFormComponent, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode, isStandalone }) => {
|
|
7299
7348
|
const formValue = formData[component.id];
|
|
7300
7349
|
// Check if component has notes or attachments for submission view
|
|
7301
7350
|
const hasSubmissionData = mode === 'preview' && ((component.basic?.notes && component.basic.notes.trim().length > 0) ||
|
|
7302
7351
|
(component.basic?.attachments && Array.isArray(component.basic.attachments) && component.basic.attachments.length > 0));
|
|
7303
|
-
return (jsxRuntime.jsxs("div", { className: "simple-table-component", children: [renderFormComponent(component), !['section', 'table', 'heading', 'file', 'instructions', 'signature', 'location', 'datagrid'].includes(component.name) && (jsxRuntime.jsx(ComponentActionFeatures, { component: component, mode: "test", formTemplateId: formTemplateId, formValue: formValue, formData: formData, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange ? (notes) => onNotesChange(component.id, notes) : undefined, onAttachmentChange: onAttachmentChange ? (attachments) => onAttachmentChange(component.id, attachments) : undefined, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode })), hasSubmissionData && (jsxRuntime.jsx(ComponentSubmissionActions, { component: component }))] }));
|
|
7352
|
+
return (jsxRuntime.jsxs("div", { className: "simple-table-component", children: [renderFormComponent(component), !['section', 'table', 'heading', 'file', 'instructions', 'signature', 'location', 'datagrid'].includes(component.name) && (jsxRuntime.jsx(ComponentActionFeatures, { component: component, mode: "test", formTemplateId: formTemplateId, formValue: formValue, formData: formData, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange ? (notes) => onNotesChange(component.id, notes) : undefined, onAttachmentChange: onAttachmentChange ? (attachments) => onAttachmentChange(component.id, attachments) : undefined, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode, isStandalone: isStandalone })), hasSubmissionData && (jsxRuntime.jsx(ComponentSubmissionActions, { component: component }))] }));
|
|
7304
7353
|
};
|
|
7305
7354
|
const DraggableTableComponent = ({ component, selectedComponent, mode, onComponentSelect, onComponentDelete, onComponentEdit, renderFormComponent, isOverlay = false, }) => {
|
|
7306
7355
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging, isSorting, } = sortable.useSortable({
|
|
@@ -7321,7 +7370,7 @@ const DraggableTableComponent = ({ component, selectedComponent, mode, onCompone
|
|
|
7321
7370
|
onComponentDelete(component, e);
|
|
7322
7371
|
}, type: "button", title: "Delete Component", children: jsxRuntime.jsx(lucideReact.Trash2, { size: 12 }) })] }))] }));
|
|
7323
7372
|
};
|
|
7324
|
-
const TableCellComponent = ({ cell, mode, onComponentSelect, onComponentDelete, onComponentEdit, selectedComponent, renderFormComponent, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, tableId, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode }) => {
|
|
7373
|
+
const TableCellComponent = ({ cell, mode, onComponentSelect, onComponentDelete, onComponentEdit, selectedComponent, renderFormComponent, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, tableId, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode, isStandalone }) => {
|
|
7325
7374
|
const dropZoneId = `table-cell-${tableId}-${cell.row}-${cell.column}`;
|
|
7326
7375
|
const { setNodeRef, isOver } = core.useDroppable({
|
|
7327
7376
|
id: dropZoneId,
|
|
@@ -7356,7 +7405,7 @@ const TableCellComponent = ({ cell, mode, onComponentSelect, onComponentDelete,
|
|
|
7356
7405
|
cell.components.map((component) => {
|
|
7357
7406
|
// Only ensure ID if it's truly missing - don't regenerate existing IDs
|
|
7358
7407
|
const componentWithId = component.id ? component : ensureComponentHasId(component);
|
|
7359
|
-
return (jsxRuntime.jsx(SimpleTableComponent, { component: componentWithId, mode: mode, renderFormComponent: renderFormComponent, formData: formData, formTemplateId: formTemplateId, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode }, componentWithId.id));
|
|
7408
|
+
return (jsxRuntime.jsx(SimpleTableComponent, { component: componentWithId, mode: mode, renderFormComponent: renderFormComponent, formData: formData, formTemplateId: formTemplateId, onThresholdActionCompletion: onThresholdActionCompletion, onThresholdIssueRaised: onThresholdIssueRaised, onNotesChange: onNotesChange, onAttachmentChange: onAttachmentChange, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode, isStandalone: isStandalone }, componentWithId.id));
|
|
7360
7409
|
}))) : (
|
|
7361
7410
|
// Only show drop zone content in edit mode
|
|
7362
7411
|
mode === 'edit' ? (jsxRuntime.jsx("div", { className: "empty-cell-placeholder", children: jsxRuntime.jsxs("div", { className: "cell-info", children: [jsxRuntime.jsx("span", { className: "drop-zone-text", children: "Drag and Drop a form component" }), jsxRuntime.jsxs("span", { className: "cell-coordinates", children: ["Cell (", cell.row + 1, ", ", cell.column + 1, ")"] })] }) })) : (
|
|
@@ -7367,7 +7416,7 @@ const TableCellComponent = ({ cell, mode, onComponentSelect, onComponentDelete,
|
|
|
7367
7416
|
visibility: 'hidden' // Hide content but maintain space
|
|
7368
7417
|
}, children: "\u00A0" }))) }) }));
|
|
7369
7418
|
};
|
|
7370
|
-
const DfFormTable = ({ id, properties, mode = 'edit', formData = {}, validationErrors = {}, touchedFields = {}, formSubmitted = false, onValueChange, onSelect, isSelected = false, className = '', onTableSelect, onComponentSelect, onComponentDelete, onComponentEdit, selectedComponent, renderFormComponent, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode }) => {
|
|
7419
|
+
const DfFormTable = ({ id, properties, mode = 'edit', formData = {}, validationErrors = {}, touchedFields = {}, formSubmitted = false, onValueChange, onSelect, isSelected = false, className = '', onTableSelect, onComponentSelect, onComponentDelete, onComponentEdit, selectedComponent, renderFormComponent, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode, isStandalone }) => {
|
|
7371
7420
|
const [isCollapsed, setIsCollapsed] = React.useState(false); // Always start expanded to show drop zones
|
|
7372
7421
|
// CRITICAL: Normalize cells from API format (object with numeric keys) to proper 2D array
|
|
7373
7422
|
// The API may return cells as [{"0": {cell}, "1": {cell}}, ...] instead of [[cell, cell], ...]
|
|
@@ -7605,7 +7654,7 @@ const DfFormTable = ({ id, properties, mode = 'edit', formData = {}, validationE
|
|
|
7605
7654
|
fontSize: '14px',
|
|
7606
7655
|
textAlign: 'center'
|
|
7607
7656
|
}, children: columnName }, `header-${colIndex}`));
|
|
7608
|
-
}) }) })), 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, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode }, cell.id))) }, rowIndex))) })] })] }))] }));
|
|
7657
|
+
}) }) })), 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, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode, isStandalone: isStandalone }, cell.id))) }, rowIndex))) })] })] }))] }));
|
|
7609
7658
|
};
|
|
7610
7659
|
|
|
7611
7660
|
var dfFormTable = /*#__PURE__*/Object.freeze({
|