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.d.ts
CHANGED
|
@@ -712,10 +712,11 @@ interface DfFormSectionProps {
|
|
|
712
712
|
firstName?: string;
|
|
713
713
|
lastName?: string;
|
|
714
714
|
};
|
|
715
|
-
onCreateIssue?: (issueData: any, attachments:
|
|
715
|
+
onCreateIssue?: (issueData: any, attachments: any[]) => Promise<any>;
|
|
716
716
|
onUpdateIssue?: (issueId: string, updateData: any) => Promise<void>;
|
|
717
717
|
allowWorkflowActions?: boolean;
|
|
718
718
|
inEditMode?: boolean;
|
|
719
|
+
isStandalone?: boolean;
|
|
719
720
|
}
|
|
720
721
|
declare const DfFormSection: React.FC<DfFormSectionProps>;
|
|
721
722
|
|
|
@@ -789,10 +790,11 @@ interface DfFormTableProps {
|
|
|
789
790
|
firstName?: string;
|
|
790
791
|
lastName?: string;
|
|
791
792
|
};
|
|
792
|
-
onCreateIssue?: (issueData: any, attachments:
|
|
793
|
+
onCreateIssue?: (issueData: any, attachments: any[]) => Promise<any>;
|
|
793
794
|
onUpdateIssue?: (issueId: string, updateData: any) => Promise<void>;
|
|
794
795
|
allowWorkflowActions?: boolean;
|
|
795
796
|
inEditMode?: boolean;
|
|
797
|
+
isStandalone?: boolean;
|
|
796
798
|
}
|
|
797
799
|
declare const DfFormTable: React.FC<DfFormTableProps>;
|
|
798
800
|
|
|
@@ -876,7 +878,7 @@ interface IRaiseIssueModalProps {
|
|
|
876
878
|
notes?: string;
|
|
877
879
|
attachments?: File[] | null;
|
|
878
880
|
issue?: IIssue | null;
|
|
879
|
-
onCreateIssue?: (issueData: any, attachments:
|
|
881
|
+
onCreateIssue?: (issueData: any, attachments: any[]) => Promise<IIssue>;
|
|
880
882
|
onUpdateIssue?: (issueId: string, updateData: any) => Promise<void>;
|
|
881
883
|
user?: {
|
|
882
884
|
firstName?: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -333,6 +333,8 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
333
333
|
'John Smith',
|
|
334
334
|
'Sarah Johnson'
|
|
335
335
|
], workOrderNumber: initialWorkOrderNumber, assetNumber: initialAssetNumber, isStandalone, allowWorkflowActions, inEditMode = false, isEdit }) => {
|
|
336
|
+
// DEBUG: Log the isStandalone value
|
|
337
|
+
console.log('RaiseIssueModal - isStandalone:', isStandalone, 'type:', typeof isStandalone);
|
|
336
338
|
const [title, setTitle] = useState('');
|
|
337
339
|
const [description, setDescription] = useState('');
|
|
338
340
|
const [workOrderNumber, setWorkOrderNumber] = useState('');
|
|
@@ -406,6 +408,14 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
406
408
|
setLocalAttachments(prev => [...prev, ...newFiles]);
|
|
407
409
|
}
|
|
408
410
|
};
|
|
411
|
+
const convertFileToBase64 = (file) => {
|
|
412
|
+
return new Promise((resolve, reject) => {
|
|
413
|
+
const reader = new FileReader();
|
|
414
|
+
reader.readAsDataURL(file);
|
|
415
|
+
reader.onload = () => resolve(reader.result);
|
|
416
|
+
reader.onerror = error => reject(error);
|
|
417
|
+
});
|
|
418
|
+
};
|
|
409
419
|
const getAttachmentName = (file) => {
|
|
410
420
|
if (!file)
|
|
411
421
|
return 'Attachment';
|
|
@@ -436,10 +446,25 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
436
446
|
}
|
|
437
447
|
return null;
|
|
438
448
|
}
|
|
439
|
-
if (file.data
|
|
440
|
-
|
|
441
|
-
|
|
449
|
+
if (file.data) {
|
|
450
|
+
if (isDataUrlImage(file.data))
|
|
451
|
+
return file.data;
|
|
452
|
+
// Handle raw base64 data from API
|
|
453
|
+
if (file.fileName && isImage(file.fileName)) {
|
|
454
|
+
const fileName = String(file.fileName).toLowerCase();
|
|
455
|
+
let mimeType = 'image/png'; // Default
|
|
456
|
+
if (fileName.endsWith('.jpg') || fileName.endsWith('.jpeg'))
|
|
457
|
+
mimeType = 'image/jpeg';
|
|
458
|
+
else if (fileName.endsWith('.png'))
|
|
459
|
+
mimeType = 'image/png';
|
|
460
|
+
else if (fileName.endsWith('.gif'))
|
|
461
|
+
mimeType = 'image/gif';
|
|
462
|
+
else if (fileName.endsWith('.webp'))
|
|
463
|
+
mimeType = 'image/webp';
|
|
464
|
+
return `data:${mimeType};base64,${file.data}`;
|
|
465
|
+
}
|
|
442
466
|
return file.data;
|
|
467
|
+
}
|
|
443
468
|
return null;
|
|
444
469
|
};
|
|
445
470
|
useEffect(() => {
|
|
@@ -585,6 +610,17 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
585
610
|
try {
|
|
586
611
|
if (isEditMode && issue) {
|
|
587
612
|
// Update existing issue
|
|
613
|
+
// Convert attachments to base64 objects for API
|
|
614
|
+
const attachmentObjects = await Promise.all(localAttachments.map(async (file) => {
|
|
615
|
+
if (file instanceof File) {
|
|
616
|
+
const base64 = await convertFileToBase64(file);
|
|
617
|
+
return {
|
|
618
|
+
fileName: file.name,
|
|
619
|
+
data: base64
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
return file; // Already a data object
|
|
623
|
+
}));
|
|
588
624
|
const updateData = {
|
|
589
625
|
title: String(title || '').trim(),
|
|
590
626
|
description: String(description || '').trim(),
|
|
@@ -598,7 +634,8 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
598
634
|
comments: String(comments || '').trim() || '',
|
|
599
635
|
task: issue.component?.basic?.label || '',
|
|
600
636
|
taskValue: issue.component?.basic?.value || '',
|
|
601
|
-
isStandalone: !!isStandalone
|
|
637
|
+
isStandalone: !!isStandalone,
|
|
638
|
+
attachments: attachmentObjects
|
|
602
639
|
};
|
|
603
640
|
if (onUpdateIssue && issue._id) {
|
|
604
641
|
await onUpdateIssue(issue._id, updateData);
|
|
@@ -630,6 +667,17 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
630
667
|
comments: String(notes || '')
|
|
631
668
|
}
|
|
632
669
|
};
|
|
670
|
+
// Convert attachments to base64 objects for API
|
|
671
|
+
const attachmentObjects = await Promise.all(localAttachments.map(async (file) => {
|
|
672
|
+
if (file instanceof File) {
|
|
673
|
+
const base64 = await convertFileToBase64(file);
|
|
674
|
+
return {
|
|
675
|
+
fileName: file.name,
|
|
676
|
+
data: base64
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
return file; // Already a data object
|
|
680
|
+
}));
|
|
633
681
|
const createdBy = user ? `${user.firstName || ''} ${user.lastName || ''}`.trim() : 'User';
|
|
634
682
|
const issueData = {
|
|
635
683
|
title: String(title || '').trim(),
|
|
@@ -645,11 +693,12 @@ const RaiseIssueModal = ({ isOpen, onClose, onSuccess, component, formTemplateId
|
|
|
645
693
|
createdBy,
|
|
646
694
|
task: component?.basic?.label || '',
|
|
647
695
|
taskValue: component?.basic?.value || '',
|
|
648
|
-
isStandalone: !!isStandalone
|
|
696
|
+
isStandalone: !!isStandalone,
|
|
697
|
+
attachments: attachmentObjects // Include in data as well
|
|
649
698
|
};
|
|
650
|
-
let createdIssueResponse;
|
|
699
|
+
let createdIssueResponse;
|
|
651
700
|
if (onCreateIssue) {
|
|
652
|
-
createdIssueResponse = await onCreateIssue(issueData,
|
|
701
|
+
createdIssueResponse = await onCreateIssue(issueData, attachmentObjects);
|
|
653
702
|
}
|
|
654
703
|
toastService.showSuccess('Issue raised successfully');
|
|
655
704
|
if (onSuccess) {
|
|
@@ -4246,7 +4295,7 @@ const ComponentActionFeatures = ({ component, mode, formTemplateId, formValue, f
|
|
|
4246
4295
|
modalComponent.basic.value = selectedOption.value || effectiveValue;
|
|
4247
4296
|
}
|
|
4248
4297
|
return modalComponent;
|
|
4249
|
-
})(), formTemplateId: formTemplateId || '', notes: localNotes, attachments: localAttachments, isStandalone: isStandalone, workOrderNumber: workOrderNumber, assetNumber: assetNumber, user: user, onCreateIssue: onCreateIssue, onUpdateIssue: onUpdateIssue, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode }))] }));
|
|
4298
|
+
})(), 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)] }));
|
|
4250
4299
|
};
|
|
4251
4300
|
|
|
4252
4301
|
// Attachment Thumbnails Component for Submission View
|
|
@@ -5150,7 +5199,7 @@ const DfFormDataGrid = ({ id, properties, mode = 'edit', formData = {}, onValueC
|
|
|
5150
5199
|
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 })) }))] }));
|
|
5151
5200
|
};
|
|
5152
5201
|
|
|
5153
|
-
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 }) => {
|
|
5202
|
+
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 }) => {
|
|
5154
5203
|
const formValue = formData[child.id];
|
|
5155
5204
|
// Check if component has notes or attachments for submission view
|
|
5156
5205
|
const hasSubmissionData = mode === 'preview' && ((child.basic?.notes && child.basic.notes.trim().length > 0) ||
|
|
@@ -5168,9 +5217,9 @@ const DraggableChild = ({ child, selectedChild, mode, onChildSelect, onChildDele
|
|
|
5168
5217
|
return (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) && (jsx("div", { className: "child-drag-handle", ...listeners, ...attributes, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), children: jsx(GripVertical, { size: 14 }) })), jsxs("div", { className: "form-component-content section-child-content", children: [(mode === 'edit' || isChildrenEditMode) && (jsxs("div", { className: "component-actions child-actions", children: [jsx("button", { className: "btn edit-btn", onClick: (e) => {
|
|
5169
5218
|
e.stopPropagation();
|
|
5170
5219
|
onChildSelect(child);
|
|
5171
|
-
}, onMouseDown: (e) => e.stopPropagation(), title: "Edit properties", children: jsx(Edit, { size: 12 }) }), jsx("button", { className: "btn delete-btn", onClick: (e) => onChildDelete(child, e), onMouseDown: (e) => e.stopPropagation(), title: "Delete component", children: jsx(Trash2, { size: 12 }) })] })), jsxs("div", { className: "component-preview child-preview", children: [renderFormComponent(child), !['section', 'table', 'heading', 'file', 'instructions', 'signature', 'location', 'datagrid'].includes(child.name) && (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 && (jsx(ComponentSubmissionActions, { component: child }))] })] })] }));
|
|
5220
|
+
}, onMouseDown: (e) => e.stopPropagation(), title: "Edit properties", children: jsx(Edit, { size: 12 }) }), jsx("button", { className: "btn delete-btn", onClick: (e) => onChildDelete(child, e), onMouseDown: (e) => e.stopPropagation(), title: "Delete component", children: jsx(Trash2, { size: 12 }) })] })), jsxs("div", { className: "component-preview child-preview", children: [renderFormComponent(child), !['section', 'table', 'heading', 'file', 'instructions', 'signature', 'location', 'datagrid'].includes(child.name) && (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 && (jsx(ComponentSubmissionActions, { component: child }))] })] })] }));
|
|
5172
5221
|
};
|
|
5173
|
-
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 }) => {
|
|
5222
|
+
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 }) => {
|
|
5174
5223
|
const [isCollapsed, setIsCollapsed] = useState(properties.basic.collapsed);
|
|
5175
5224
|
const [isEditingTitle, setIsEditingTitle] = useState(false);
|
|
5176
5225
|
const [isEditingDescription, setIsEditingDescription] = useState(false);
|
|
@@ -5383,7 +5432,7 @@ const DfFormSection = ({ id, properties, mode = 'edit', formData = {}, onValueCh
|
|
|
5383
5432
|
}, children: isOver ? 'Drop components here' : 'Empty Section' }), jsx("div", { style: {
|
|
5384
5433
|
fontSize: '12px',
|
|
5385
5434
|
color: '#9ca3af'
|
|
5386
|
-
}, children: "Drag and drop components here to create your section" })] })) : (children.map((child) => (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)))) }) }))] }));
|
|
5435
|
+
}, children: "Drag and drop components here to create your section" })] })) : (children.map((child) => (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)))) }) }))] }));
|
|
5387
5436
|
};
|
|
5388
5437
|
|
|
5389
5438
|
// Dynamic imports to avoid circular dependencies
|
|
@@ -7293,12 +7342,12 @@ const ensureComponentHasId = (component) => {
|
|
|
7293
7342
|
}
|
|
7294
7343
|
return component;
|
|
7295
7344
|
};
|
|
7296
|
-
const SimpleTableComponent = ({ component, mode, renderFormComponent, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode }) => {
|
|
7345
|
+
const SimpleTableComponent = ({ component, mode, renderFormComponent, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode, isStandalone }) => {
|
|
7297
7346
|
const formValue = formData[component.id];
|
|
7298
7347
|
// Check if component has notes or attachments for submission view
|
|
7299
7348
|
const hasSubmissionData = mode === 'preview' && ((component.basic?.notes && component.basic.notes.trim().length > 0) ||
|
|
7300
7349
|
(component.basic?.attachments && Array.isArray(component.basic.attachments) && component.basic.attachments.length > 0));
|
|
7301
|
-
return (jsxs("div", { className: "simple-table-component", children: [renderFormComponent(component), !['section', 'table', 'heading', 'file', 'instructions', 'signature', 'location', 'datagrid'].includes(component.name) && (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 && (jsx(ComponentSubmissionActions, { component: component }))] }));
|
|
7350
|
+
return (jsxs("div", { className: "simple-table-component", children: [renderFormComponent(component), !['section', 'table', 'heading', 'file', 'instructions', 'signature', 'location', 'datagrid'].includes(component.name) && (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 && (jsx(ComponentSubmissionActions, { component: component }))] }));
|
|
7302
7351
|
};
|
|
7303
7352
|
const DraggableTableComponent = ({ component, selectedComponent, mode, onComponentSelect, onComponentDelete, onComponentEdit, renderFormComponent, isOverlay = false, }) => {
|
|
7304
7353
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging, isSorting, } = useSortable({
|
|
@@ -7319,7 +7368,7 @@ const DraggableTableComponent = ({ component, selectedComponent, mode, onCompone
|
|
|
7319
7368
|
onComponentDelete(component, e);
|
|
7320
7369
|
}, type: "button", title: "Delete Component", children: jsx(Trash2, { size: 12 }) })] }))] }));
|
|
7321
7370
|
};
|
|
7322
|
-
const TableCellComponent = ({ cell, mode, onComponentSelect, onComponentDelete, onComponentEdit, selectedComponent, renderFormComponent, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, tableId, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode }) => {
|
|
7371
|
+
const TableCellComponent = ({ cell, mode, onComponentSelect, onComponentDelete, onComponentEdit, selectedComponent, renderFormComponent, formData = {}, formTemplateId, onThresholdActionCompletion, onThresholdIssueRaised, tableId, onNotesChange, onAttachmentChange, workOrderNumber, assetNumber, user, onCreateIssue, onUpdateIssue, allowWorkflowActions, inEditMode, isStandalone }) => {
|
|
7323
7372
|
const dropZoneId = `table-cell-${tableId}-${cell.row}-${cell.column}`;
|
|
7324
7373
|
const { setNodeRef, isOver } = useDroppable({
|
|
7325
7374
|
id: dropZoneId,
|
|
@@ -7354,7 +7403,7 @@ const TableCellComponent = ({ cell, mode, onComponentSelect, onComponentDelete,
|
|
|
7354
7403
|
cell.components.map((component) => {
|
|
7355
7404
|
// Only ensure ID if it's truly missing - don't regenerate existing IDs
|
|
7356
7405
|
const componentWithId = component.id ? component : ensureComponentHasId(component);
|
|
7357
|
-
return (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));
|
|
7406
|
+
return (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));
|
|
7358
7407
|
}))) : (
|
|
7359
7408
|
// Only show drop zone content in edit mode
|
|
7360
7409
|
mode === 'edit' ? (jsx("div", { className: "empty-cell-placeholder", children: jsxs("div", { className: "cell-info", children: [jsx("span", { className: "drop-zone-text", children: "Drag and Drop a form component" }), jsxs("span", { className: "cell-coordinates", children: ["Cell (", cell.row + 1, ", ", cell.column + 1, ")"] })] }) })) : (
|
|
@@ -7365,7 +7414,7 @@ const TableCellComponent = ({ cell, mode, onComponentSelect, onComponentDelete,
|
|
|
7365
7414
|
visibility: 'hidden' // Hide content but maintain space
|
|
7366
7415
|
}, children: "\u00A0" }))) }) }));
|
|
7367
7416
|
};
|
|
7368
|
-
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 }) => {
|
|
7417
|
+
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 }) => {
|
|
7369
7418
|
const [isCollapsed, setIsCollapsed] = useState(false); // Always start expanded to show drop zones
|
|
7370
7419
|
// CRITICAL: Normalize cells from API format (object with numeric keys) to proper 2D array
|
|
7371
7420
|
// The API may return cells as [{"0": {cell}, "1": {cell}}, ...] instead of [[cell, cell], ...]
|
|
@@ -7603,7 +7652,7 @@ const DfFormTable = ({ id, properties, mode = 'edit', formData = {}, validationE
|
|
|
7603
7652
|
fontSize: '14px',
|
|
7604
7653
|
textAlign: 'center'
|
|
7605
7654
|
}, children: columnName }, `header-${colIndex}`));
|
|
7606
|
-
}) }) })), 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, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode }, cell.id))) }, rowIndex))) })] })] }))] }));
|
|
7655
|
+
}) }) })), 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, allowWorkflowActions: allowWorkflowActions, inEditMode: inEditMode, isStandalone: isStandalone }, cell.id))) }, rowIndex))) })] })] }))] }));
|
|
7607
7656
|
};
|
|
7608
7657
|
|
|
7609
7658
|
var dfFormTable = /*#__PURE__*/Object.freeze({
|