@openg2p/registry-widgets 0.1.8 → 0.2.0
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/components/SectionRenderer.d.ts +5 -1
- package/dist/components/SectionRenderer.d.ts.map +1 -1
- package/dist/components/SectionsContainer.d.ts.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.esm.js +479 -109
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +479 -108
- package/dist/index.js.map +1 -1
- package/dist/registry/defaultWidgets.d.ts.map +1 -1
- package/dist/widgets/HeaderSectionWidget.d.ts +7 -0
- package/dist/widgets/HeaderSectionWidget.d.ts.map +1 -0
- package/dist/widgets/index.d.ts +1 -0
- package/dist/widgets/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2678,9 +2678,9 @@ const PanelRenderer = ({ panel, dataSourceRequestHandler, schemaData, onValueCha
|
|
|
2678
2678
|
}
|
|
2679
2679
|
return {
|
|
2680
2680
|
className: orientation === 'horizontal'
|
|
2681
|
-
? 'flex flex-row
|
|
2682
|
-
: 'flex flex-col
|
|
2683
|
-
style: {},
|
|
2681
|
+
? 'flex flex-row'
|
|
2682
|
+
: 'flex flex-col',
|
|
2683
|
+
style: { gap: orientation === 'horizontal' ? '16px' : '0px' },
|
|
2684
2684
|
};
|
|
2685
2685
|
};
|
|
2686
2686
|
const { className: containerClass, style: containerStyle } = getContainerClassAndStyle();
|
|
@@ -2733,7 +2733,7 @@ const PanelRenderer = ({ panel, dataSourceRequestHandler, schemaData, onValueCha
|
|
|
2733
2733
|
position: 'absolute',
|
|
2734
2734
|
right: 0,
|
|
2735
2735
|
top: 0,
|
|
2736
|
-
bottom:
|
|
2736
|
+
bottom: '5px',
|
|
2737
2737
|
width: '1px',
|
|
2738
2738
|
backgroundColor: isEditMode ? '#F2BA1A' : '#D1D5DB',
|
|
2739
2739
|
} }))] }) }, nestedPanel['panel-id'] || `panel-${index}`));
|
|
@@ -3327,13 +3327,13 @@ const FileInputWidget = ({ config }) => {
|
|
|
3327
3327
|
// For readonly mode, render as display only (no upload button)
|
|
3328
3328
|
if (widgetConfig['widget-readonly']) {
|
|
3329
3329
|
const label = translateConfig(widgetConfig['widget-label']);
|
|
3330
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] FileDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: displayValue ? renderFileDisplay() : jsxRuntimeExports.jsx("span", { className: "text-base text-gray-900 font-medium", children: "-" }) }), jsxRuntimeExports.jsx(FilePreviewModal, { file: previewFile, isOpen: isPreviewOpen && !!previewFile, onClose: () => {
|
|
3330
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] FileDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", title: String(displayValue || ''), children: displayValue ? renderFileDisplay() : jsxRuntimeExports.jsx("span", { className: "text-base text-gray-900 font-medium", children: "-" }) }), jsxRuntimeExports.jsx(FilePreviewModal, { file: previewFile, isOpen: isPreviewOpen && !!previewFile, onClose: () => {
|
|
3331
3331
|
console.log('Closing preview modal');
|
|
3332
3332
|
setIsPreviewOpen(false);
|
|
3333
3333
|
setPreviewFile(null);
|
|
3334
3334
|
} })] }));
|
|
3335
3335
|
}
|
|
3336
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px]", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center gap-2 sm:space-x-4", children: [jsxRuntimeExports.jsxs("label", { className: `cursor-pointer inline-flex items-center justify-between gap-2 border border-gray-300 shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 ${!isEnabled
|
|
3336
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px]", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-center gap-2 sm:space-x-4", children: [jsxRuntimeExports.jsxs("label", { className: `cursor-pointer inline-flex items-center justify-between gap-2 border border-gray-300 shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 ${!isEnabled
|
|
3337
3337
|
? 'opacity-50 cursor-not-allowed'
|
|
3338
3338
|
: ''}`, style: {
|
|
3339
3339
|
width: '100%',
|
|
@@ -3523,7 +3523,7 @@ const sectionValidate = (section, currentSchemaData, dispatch) => {
|
|
|
3523
3523
|
* - Panels wrap when they exceed available width
|
|
3524
3524
|
* - Sections can sit side-by-side if there's space
|
|
3525
3525
|
*/
|
|
3526
|
-
const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequestHandler, schemaData, onValueChange, gridColumnSpan, onSectionSave, hideEditButton = false, mode = 'RegistryView', namespace, changeRequestType, showChangeRequestLabel = true, dbSectionId, sectionRegisterId, onSectionDirtyChange, sectionIndex, sectionCount, expandedSectionIndex, onExpandSection, onSectionSaveSuccess, onPreviousSection, isDraft, }) => {
|
|
3526
|
+
const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequestHandler, schemaData, onValueChange, gridColumnSpan, onSectionSave, hideEditButton = false, mode = 'RegistryView', namespace, changeRequestType, showChangeRequestLabel = true, dbSectionId, sectionRegisterId, onSectionDirtyChange, sectionIndex, sectionCount, expandedSectionIndex, onExpandSection, onSectionSaveSuccess, onPreviousSection, isDraft, onEditModeChange, forceExitEdit, }) => {
|
|
3527
3527
|
const { translateConfig, translate } = useWidgetTranslation();
|
|
3528
3528
|
const { schemaData: contextSchemaData, dataSourceRequestHandler: contextDataSourceRequestHandler } = useWidgetContext();
|
|
3529
3529
|
const store = useStore();
|
|
@@ -3591,6 +3591,8 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3591
3591
|
};
|
|
3592
3592
|
return result;
|
|
3593
3593
|
}, [mode, currentSchemaData, storeValues]);
|
|
3594
|
+
// Original (non-namespaced) section ID — used for edit mode coordination with SectionsContainer
|
|
3595
|
+
const originalSectionId = section['section-id'];
|
|
3594
3596
|
// Use namespaced section for rendering
|
|
3595
3597
|
const sectionToRender = namespacedSection;
|
|
3596
3598
|
const sectionId = sectionToRender['section-id'];
|
|
@@ -3688,6 +3690,12 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3688
3690
|
const hasSupportingDocuments = supportingDocuments.length > 0;
|
|
3689
3691
|
// Edit mode state
|
|
3690
3692
|
const [isEditMode, setIsEditMode] = useState(false);
|
|
3693
|
+
// RegistryView: force exit edit mode when another section takes over
|
|
3694
|
+
useEffect(() => {
|
|
3695
|
+
if (forceExitEdit && isEditMode) {
|
|
3696
|
+
setIsEditMode(false);
|
|
3697
|
+
}
|
|
3698
|
+
}, [forceExitEdit]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
3691
3699
|
const [isDocumentsExpanded, setIsDocumentsExpanded] = useState(true);
|
|
3692
3700
|
const sectionRef = useRef(null);
|
|
3693
3701
|
const [sectionHeight, setSectionHeight] = useState(null);
|
|
@@ -3762,6 +3770,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3762
3770
|
setSectionHeight(height);
|
|
3763
3771
|
}
|
|
3764
3772
|
setIsEditMode(true);
|
|
3773
|
+
onEditModeChange?.(originalSectionId, true);
|
|
3765
3774
|
};
|
|
3766
3775
|
// Render the edit section (absolutely positioned duplicate via portal)
|
|
3767
3776
|
// IntakeForm never uses this overlay - content is shown inline in accordion
|
|
@@ -3810,7 +3819,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3810
3819
|
position: absolute;
|
|
3811
3820
|
right: 0;
|
|
3812
3821
|
top: 0;
|
|
3813
|
-
bottom:
|
|
3822
|
+
bottom: 5px;
|
|
3814
3823
|
width: 1px;
|
|
3815
3824
|
background-color: #F2BA1A;
|
|
3816
3825
|
}
|
|
@@ -3824,18 +3833,16 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3824
3833
|
}, children: [sectionToRender['section-title'] && (jsxRuntimeExports.jsx("h2", { className: "text-xl font-semibold mb-4", style: { fontFamily: 'Roboto, sans-serif', marginTop: '35px' }, children: translateConfig(sectionToRender['section-title']) })), jsxRuntimeExports.jsxs("div", { id: editGridId, className: "section-panels", children: [editableSection.panels.map((panel, index) => {
|
|
3825
3834
|
const isLastPanel = index === editableSection.panels.length - 1;
|
|
3826
3835
|
return (jsxRuntimeExports.jsx("div", { className: `panel-wrapper ${isLastPanel ? 'last-panel-wrapper' : ''}`, children: jsxRuntimeExports.jsx(PanelRenderer, { panel: panel, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: namespacedSchemaData, onValueChange: onValueChange, isEditMode: true }) }, panel['panel-id'] || `section-panel-${index}`));
|
|
3827
|
-
}),
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3836
|
+
}), jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', backgroundColor: '#F2BA1A', border: 'none', margin: '25px 0 0 0' } }), hasSupportingDocuments && (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs("div", { className: "supporting-documents-container", children: [jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => setIsDocumentsExpanded(!isDocumentsExpanded), className: "supporting-documents-title-button w-full flex items-center text-left", children: [jsxRuntimeExports.jsx("span", { className: "font-semibold", style: { fontFamily: 'Roboto, sans-serif', fontSize: '16px' }, children: translate('common.supportedDocuments') || 'Supported Documents' }), jsxRuntimeExports.jsx("img", { src: isDocumentsExpanded ? img$7 : img$6, alt: "Toggle Documents", className: "w-4 h-2.25 transition-transform ml-2" })] }), isDocumentsExpanded && (jsxRuntimeExports.jsx("div", { className: "supporting-documents-grid mt-4", children: supportingDocuments.map((doc, index) => {
|
|
3837
|
+
const docConfig = createDocumentWidgetConfig(doc, sectionId, index);
|
|
3838
|
+
return (jsxRuntimeExports.jsx("div", { className: "supporting-document-item", children: jsxRuntimeExports.jsx(FileInputWidget, { config: docConfig }) }, `${sectionId}-doc-${index}`));
|
|
3839
|
+
}) }))] }) })), jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', backgroundColor: '#F2BA1A', border: 'none', marginTop: hasSupportingDocuments ? '20px' : 0, marginBottom: '20px' } }), jsxRuntimeExports.jsx("div", { className: "edit-controls-container", style: { marginBottom: '20px' }, children: jsxRuntimeExports.jsxs("div", { className: "edit-controls-buttons", children: [jsxRuntimeExports.jsx("button", { onClick: handleCancel, className: "bg-white hover:bg-gray-50 text-gray-900 text-sm font-medium px-6 py-2 transition-colors border border-gray-300", style: { fontFamily: 'Roboto, sans-serif', borderRadius: '10px' }, children: translate('common.cancel') || 'Cancel' }), jsxRuntimeExports.jsx("button", { onClick: handleSave, disabled: !isDirty, className: "bg-gray-900 hover:bg-gray-800 text-white text-sm font-medium px-6 py-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed", style: { fontFamily: 'Roboto, sans-serif', borderRadius: '10px' }, children: translate('common.save') || 'Save' })] }) })] })] })] }), document.body);
|
|
3831
3840
|
};
|
|
3832
3841
|
const trackSectionChages = (widgets, sourceData, pathPrefix) => {
|
|
3833
3842
|
if (!widgets || widgets.length === 0)
|
|
3834
3843
|
return [];
|
|
3835
3844
|
const snapshot = {};
|
|
3836
3845
|
let hasTable = false;
|
|
3837
|
-
if (!sectionRegisterId)
|
|
3838
|
-
return [];
|
|
3839
3846
|
const resolvePath = (path) => (pathPrefix ? `${pathPrefix}.${path}` : path);
|
|
3840
3847
|
widgets.forEach(widget => {
|
|
3841
3848
|
const widgetPath = widget['widget-data-path'];
|
|
@@ -3865,9 +3872,11 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3865
3872
|
: fullPath;
|
|
3866
3873
|
cleanedSnapshot[fieldPath] = value;
|
|
3867
3874
|
});
|
|
3868
|
-
const sectionData =
|
|
3869
|
-
?
|
|
3870
|
-
|
|
3875
|
+
const sectionData = sectionRegisterId
|
|
3876
|
+
? (pathPrefix
|
|
3877
|
+
? getValueByPath(sourceData, resolvePath(sectionRegisterId))
|
|
3878
|
+
: sourceData[sectionRegisterId])
|
|
3879
|
+
: {};
|
|
3871
3880
|
return [
|
|
3872
3881
|
{
|
|
3873
3882
|
...sectionData,
|
|
@@ -3968,7 +3977,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3968
3977
|
}, [effectiveEditModeForDirty, isDirty, sectionId, onSectionDirtyChange]);
|
|
3969
3978
|
// IntakeForm only: section status badge (Saved / Modified and not saved / no badge when pristine)
|
|
3970
3979
|
const intakeFormSectionStatus = useMemo(() => {
|
|
3971
|
-
if (mode !== 'IntakeForm')
|
|
3980
|
+
if (mode !== 'IntakeForm' || isDraft === false)
|
|
3972
3981
|
return null;
|
|
3973
3982
|
const hasValue = (v) => v !== undefined && v !== null && (typeof v !== 'string' || v.trim().length > 0);
|
|
3974
3983
|
const currentSnapshot = buildSectionSnapshot(storeValues, namespace);
|
|
@@ -3987,6 +3996,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3987
3996
|
if (!store || !onSectionSave) {
|
|
3988
3997
|
console.warn('Missing store or onSectionSave in SectionRenderer');
|
|
3989
3998
|
setIsEditMode(false);
|
|
3999
|
+
onEditModeChange?.(originalSectionId, false);
|
|
3990
4000
|
return;
|
|
3991
4001
|
}
|
|
3992
4002
|
// Use original section (without namespace) for collecting widgets
|
|
@@ -4019,7 +4029,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4019
4029
|
if (JSON.stringify(oldSchemaData) !== JSON.stringify(newSchemaData)) {
|
|
4020
4030
|
try {
|
|
4021
4031
|
const sectionchanges = {
|
|
4022
|
-
section_id: dbSectionId,
|
|
4032
|
+
section_id: dbSectionId ?? originalSection['section-id'],
|
|
4023
4033
|
section_register_id: sectionRegisterId,
|
|
4024
4034
|
records: [...newSchemaData],
|
|
4025
4035
|
files: [...sectionFiles]
|
|
@@ -4031,52 +4041,56 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4031
4041
|
}
|
|
4032
4042
|
}
|
|
4033
4043
|
setIsEditMode(false);
|
|
4044
|
+
onEditModeChange?.(originalSectionId, false);
|
|
4034
4045
|
};
|
|
4035
4046
|
// IntakeForm: save section then collapse current and expand next (or stay on final section)
|
|
4036
4047
|
const handleIntakeFormSave = useCallback(async () => {
|
|
4037
|
-
if (
|
|
4048
|
+
if (sectionIndex === undefined)
|
|
4038
4049
|
return;
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
const
|
|
4050
|
-
|
|
4051
|
-
const
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
if (JSON.stringify(oldSchemaData) !== JSON.stringify(newSchemaData)) {
|
|
4059
|
-
try {
|
|
4060
|
-
await onSectionSave({
|
|
4061
|
-
section_id: dbSectionId,
|
|
4062
|
-
section_register_id: sectionRegisterId,
|
|
4063
|
-
records: [...newSchemaData],
|
|
4064
|
-
files: [...sectionFiles],
|
|
4050
|
+
// Only run save/validation logic when in draft mode and handlers are available
|
|
4051
|
+
if (isDraft !== false && store && onSectionSave) {
|
|
4052
|
+
const sectionWidgets = collectWidgets(originalSection.panels);
|
|
4053
|
+
const currentState = store.getState().widget;
|
|
4054
|
+
const currentSchemaData = currentState.values || {};
|
|
4055
|
+
const isSectionValid = sectionValidate(originalSection, currentSchemaData, dispatch);
|
|
4056
|
+
if (!isSectionValid)
|
|
4057
|
+
return;
|
|
4058
|
+
const oldSchemaData = schemaData || contextSchemaData;
|
|
4059
|
+
const newSchemaData = trackSectionChages(sectionWidgets, currentSchemaData, namespace);
|
|
4060
|
+
const sectionFiles = [];
|
|
4061
|
+
if (hasSupportingDocuments) {
|
|
4062
|
+
const originalSupportingDocuments = originalSection['section-supporting-documents'] || [];
|
|
4063
|
+
originalSupportingDocuments.forEach((doc) => {
|
|
4064
|
+
const originalDataPath = doc['document-data-path'];
|
|
4065
|
+
const storeDataPath = namespace && originalDataPath
|
|
4066
|
+
? `${namespace}.${originalDataPath}`
|
|
4067
|
+
: originalDataPath;
|
|
4068
|
+
sectionFiles.push(getValueByPath(currentSchemaData, storeDataPath));
|
|
4065
4069
|
});
|
|
4066
4070
|
}
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4071
|
+
if (JSON.stringify(oldSchemaData) !== JSON.stringify(newSchemaData)) {
|
|
4072
|
+
try {
|
|
4073
|
+
await onSectionSave({
|
|
4074
|
+
section_id: dbSectionId ?? originalSection['section-id'],
|
|
4075
|
+
section_register_id: sectionRegisterId,
|
|
4076
|
+
records: [...newSchemaData],
|
|
4077
|
+
files: [...sectionFiles],
|
|
4078
|
+
});
|
|
4079
|
+
}
|
|
4080
|
+
catch (error) {
|
|
4081
|
+
console.error('Section Changes Save failed', error);
|
|
4082
|
+
return;
|
|
4083
|
+
}
|
|
4070
4084
|
}
|
|
4085
|
+
if (mode === 'IntakeForm') {
|
|
4086
|
+
baselineSnapshotRef.current = buildSectionSnapshot(currentSchemaData, namespace);
|
|
4087
|
+
setIntakeFormBaselineTrigger((prev) => prev + 1);
|
|
4088
|
+
}
|
|
4089
|
+
onSectionDirtyChange?.(sectionId, false);
|
|
4071
4090
|
}
|
|
4072
|
-
//
|
|
4073
|
-
if (mode === 'IntakeForm') {
|
|
4074
|
-
baselineSnapshotRef.current = buildSectionSnapshot(currentSchemaData, namespace);
|
|
4075
|
-
setIntakeFormBaselineTrigger((prev) => prev + 1);
|
|
4076
|
-
}
|
|
4077
|
-
onSectionDirtyChange?.(sectionId, false);
|
|
4091
|
+
// Always navigate to the next section
|
|
4078
4092
|
onSectionSaveSuccess?.(sectionIndex);
|
|
4079
|
-
}, [store, onSectionSave, onSectionSaveSuccess, sectionIndex, originalSection, schemaData, contextSchemaData, namespace, hasSupportingDocuments, dbSectionId, sectionRegisterId, dispatch, buildSectionSnapshot, sectionId, onSectionDirtyChange, mode]);
|
|
4093
|
+
}, [store, onSectionSave, onSectionSaveSuccess, sectionIndex, originalSection, schemaData, contextSchemaData, namespace, hasSupportingDocuments, dbSectionId, sectionRegisterId, dispatch, buildSectionSnapshot, sectionId, onSectionDirtyChange, mode, isDraft]);
|
|
4080
4094
|
// Handle cancel button click
|
|
4081
4095
|
const handleCancel = () => {
|
|
4082
4096
|
// Revert values in store to original schema data
|
|
@@ -4138,6 +4152,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4138
4152
|
dispatch(setValues(newStoreValues));
|
|
4139
4153
|
}
|
|
4140
4154
|
setIsEditMode(false);
|
|
4155
|
+
onEditModeChange?.(originalSectionId, false);
|
|
4141
4156
|
};
|
|
4142
4157
|
// Create widget config for supporting document
|
|
4143
4158
|
const createDocumentWidgetConfig = (doc, sectionId, index) => {
|
|
@@ -4155,7 +4170,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4155
4170
|
'widget-id': widgetId,
|
|
4156
4171
|
'widget-data-path': doc['document-data-path'],
|
|
4157
4172
|
'widget-required': doc['document-required'] || false,
|
|
4158
|
-
'widget-readonly': false,
|
|
4173
|
+
'widget-readonly': mode === 'IntakeForm' && isDraft === false,
|
|
4159
4174
|
'widget-data-options': {
|
|
4160
4175
|
accept,
|
|
4161
4176
|
multiple: false,
|
|
@@ -4173,6 +4188,24 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4173
4188
|
min-height: auto !important;
|
|
4174
4189
|
height: auto !important;
|
|
4175
4190
|
}
|
|
4191
|
+
.${sectionClassId} label.text-gray-700,
|
|
4192
|
+
.${sectionClassId} .text-gray-600 {
|
|
4193
|
+
font-weight: 400 !important;
|
|
4194
|
+
color: rgba(0, 0, 0, 0.5) !important;
|
|
4195
|
+
width: 50% !important;
|
|
4196
|
+
min-width: 50% !important;
|
|
4197
|
+
max-width: 50% !important;
|
|
4198
|
+
flex-shrink: 0 !important;
|
|
4199
|
+
overflow: hidden !important;
|
|
4200
|
+
text-overflow: ellipsis !important;
|
|
4201
|
+
white-space: nowrap !important;
|
|
4202
|
+
}
|
|
4203
|
+
/* Readonly value text truncation */
|
|
4204
|
+
.${sectionClassId} .TextDisplayWidget > .flex-1 > .text-gray-900 {
|
|
4205
|
+
overflow: hidden;
|
|
4206
|
+
text-overflow: ellipsis;
|
|
4207
|
+
white-space: nowrap;
|
|
4208
|
+
}
|
|
4176
4209
|
|
|
4177
4210
|
/* Only apply fixed height when in edit mode */
|
|
4178
4211
|
.${sectionClassId}[data-edit-mode="true"] {
|
|
@@ -4307,6 +4340,9 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4307
4340
|
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-header {
|
|
4308
4341
|
transition: opacity 0.2s ease, background-color 0.2s ease;
|
|
4309
4342
|
}
|
|
4343
|
+
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-header h2 {
|
|
4344
|
+
color: #ED7C22;
|
|
4345
|
+
}
|
|
4310
4346
|
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-header:hover {
|
|
4311
4347
|
opacity: 0.85;
|
|
4312
4348
|
}
|
|
@@ -4316,7 +4352,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4316
4352
|
}
|
|
4317
4353
|
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-content {
|
|
4318
4354
|
padding-top: 8px;
|
|
4319
|
-
padding-bottom:
|
|
4355
|
+
padding-bottom: 0px;
|
|
4320
4356
|
}
|
|
4321
4357
|
.${sectionClassId}.intake-form-accordion-item .intake-form-edit-controls {
|
|
4322
4358
|
justify-content: flex-end;
|
|
@@ -4387,43 +4423,44 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4387
4423
|
fontWeight: 500,
|
|
4388
4424
|
backgroundColor: '#FEE2E2',
|
|
4389
4425
|
color: '#B91C1C',
|
|
4390
|
-
}, children: translate('common.sectionModified') || 'Modified and not saved' }))] }), jsxRuntimeExports.jsx("img", { src: isExpanded ? img$7 : img$6, alt: isExpanded ? 'Collapse' : 'Expand', className: "w-5 h-5 transition-transform", style: { flexShrink: 0, marginLeft: '12px' }, "aria-hidden": true })] }), isExpanded && (jsxRuntimeExports.jsx("div", { id: `intake-form-accordion-content-${sectionId}`, className: "intake-form-accordion-content", role: "region", "aria-labelledby": `intake-form-accordion-header-${sectionId}`, children: jsxRuntimeExports.jsxs("div", { id: gridId, className: "section-panels", style: { paddingTop: '8px' }, children: [editableSection.panels.map((panel, index) => (jsxRuntimeExports.jsx("div", { className: "panel-wrapper", children: jsxRuntimeExports.jsx(PanelRenderer, { panel: panel, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: namespacedSchemaData, onValueChange: onValueChange }) }, panel['panel-id'] || `section-panel-${index}`))),
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4426
|
+
}, children: translate('common.sectionModified') || 'Modified and not saved' }))] }), jsxRuntimeExports.jsx("img", { src: isExpanded ? img$7 : img$6, alt: isExpanded ? 'Collapse' : 'Expand', className: "w-5 h-5 transition-transform", style: { flexShrink: 0, marginLeft: '12px' }, "aria-hidden": true })] }), isExpanded && (jsxRuntimeExports.jsx("div", { id: `intake-form-accordion-content-${sectionId}`, className: "intake-form-accordion-content", role: "region", "aria-labelledby": `intake-form-accordion-header-${sectionId}`, children: jsxRuntimeExports.jsxs("div", { id: gridId, className: "section-panels", style: { paddingTop: '8px' }, children: [editableSection.panels.map((panel, index) => (jsxRuntimeExports.jsx("div", { className: "panel-wrapper", children: jsxRuntimeExports.jsx(PanelRenderer, { panel: panel, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: namespacedSchemaData, onValueChange: onValueChange, isEditMode: isDraft !== false }) }, panel['panel-id'] || `section-panel-${index}`))), jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', backgroundColor: '#F2BA1A', border: 'none', margin: '15px 0 0 0' } }), hasSupportingDocuments && (jsxRuntimeExports.jsxs("div", { className: "supporting-documents-container", children: [jsxRuntimeExports.jsx("span", { className: "font-semibold", style: { fontFamily: 'Roboto, sans-serif', fontSize: '16px' }, children: translate('common.supportedDocuments') || 'Supported Documents' }), jsxRuntimeExports.jsx("div", { className: "supporting-documents-grid mt-4", children: supportingDocuments.map((doc, docIndex) => {
|
|
4427
|
+
const docConfig = createDocumentWidgetConfig(doc, sectionId, docIndex);
|
|
4428
|
+
return (jsxRuntimeExports.jsx("div", { className: "supporting-document-item", children: jsxRuntimeExports.jsx(FileInputWidget, { config: docConfig }) }, `${sectionId}-doc-${docIndex}`));
|
|
4429
|
+
}) })] })), jsxRuntimeExports.jsxs("div", { className: "intake-form-edit-controls", style: {
|
|
4394
4430
|
display: 'flex',
|
|
4395
4431
|
justifyContent: 'flex-end',
|
|
4396
4432
|
alignItems: 'center',
|
|
4397
4433
|
gap: '12px',
|
|
4398
|
-
|
|
4434
|
+
marginTop: '10px',
|
|
4435
|
+
marginBottom: '10px',
|
|
4399
4436
|
width: '100%',
|
|
4400
|
-
}, children: [jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => onPreviousSection?.(sectionIndex),
|
|
4437
|
+
}, children: [typeof sectionIndex === 'number' && sectionIndex > 0 && (jsxRuntimeExports.jsxs("button", { type: "button", onClick: () => onPreviousSection?.(sectionIndex), className: "intake-form-prev-btn", style: {
|
|
4401
4438
|
fontFamily: 'Roboto, sans-serif',
|
|
4402
4439
|
fontSize: '14px',
|
|
4403
4440
|
fontWeight: 400,
|
|
4404
4441
|
padding: '8px 24px',
|
|
4405
4442
|
borderRadius: '10px',
|
|
4406
4443
|
border: '1px solid #FD8C3E',
|
|
4407
|
-
background: '#
|
|
4408
|
-
color:
|
|
4409
|
-
cursor:
|
|
4444
|
+
background: '#FFFFFF',
|
|
4445
|
+
color: 'rgba(0, 0, 0, 0.5)',
|
|
4446
|
+
cursor: 'pointer',
|
|
4410
4447
|
display: 'inline-flex',
|
|
4411
4448
|
alignItems: 'center',
|
|
4412
4449
|
gap: '8px',
|
|
4413
|
-
}, children: [jsxRuntimeExports.jsx("img", { src: img$5, alt: "", "aria-hidden": true, style: { width: '14px', height: '14px', opacity:
|
|
4450
|
+
}, children: [jsxRuntimeExports.jsx("img", { src: img$5, alt: "", "aria-hidden": true, style: { width: '14px', height: '14px', opacity: 0.5 } }), translate('common.previous') || 'Prev'] })), jsxRuntimeExports.jsxs("button", { type: "button", onClick: handleIntakeFormSave, className: "intake-form-save-btn", style: {
|
|
4414
4451
|
fontFamily: 'Roboto, sans-serif',
|
|
4415
4452
|
fontSize: '14px',
|
|
4416
4453
|
fontWeight: 400,
|
|
4417
4454
|
padding: '8px 24px',
|
|
4418
4455
|
borderRadius: '10px',
|
|
4419
4456
|
border: '1px solid #FD8C3E',
|
|
4420
|
-
background:
|
|
4421
|
-
color:
|
|
4422
|
-
cursor:
|
|
4457
|
+
background: '#FFFFFF',
|
|
4458
|
+
color: 'rgba(0, 0, 0, 0.5)',
|
|
4459
|
+
cursor: 'pointer',
|
|
4423
4460
|
display: 'inline-flex',
|
|
4424
4461
|
alignItems: 'center',
|
|
4425
4462
|
gap: '8px',
|
|
4426
|
-
}, children: [translate('common.
|
|
4463
|
+
}, children: [translate('common.next') || 'Next', jsxRuntimeExports.jsx("img", { src: img$4, alt: "", "aria-hidden": true, style: { width: '14px', height: '14px' } })] })] })] }) }))] })) : (
|
|
4427
4464
|
/* RegistryView / CRView: standard layout */
|
|
4428
4465
|
jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [sectionToRender['section-title'] && (jsxRuntimeExports.jsxs("div", { style: {
|
|
4429
4466
|
marginTop: '35px',
|
|
@@ -4663,6 +4700,11 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4663
4700
|
const dataSourceRequestHandler = propDataSourceRequestHandler || contextDataSourceRequestHandler;
|
|
4664
4701
|
// IntakeForm mode: accordion state - which section is expanded (null = none; first expanded by default)
|
|
4665
4702
|
const [expandedSectionIndex, setExpandedSectionIndex] = useState(0);
|
|
4703
|
+
// RegistryView: track which section is currently in edit mode (by section-id); null = none
|
|
4704
|
+
const [editingSectionId, setEditingSectionId] = useState(null);
|
|
4705
|
+
const handleEditModeChange = useCallback((sectionId, editing) => {
|
|
4706
|
+
setEditingSectionId(editing ? sectionId : null);
|
|
4707
|
+
}, []);
|
|
4666
4708
|
const safeSections = sections ?? [];
|
|
4667
4709
|
const prevSectionsLengthRef = useRef(safeSections.length);
|
|
4668
4710
|
// Track dirty (unsaved changes) per section for form handle validation
|
|
@@ -4680,7 +4722,9 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4680
4722
|
if (index + 1 < safeSections.length) {
|
|
4681
4723
|
setExpandedSectionIndex(index + 1);
|
|
4682
4724
|
}
|
|
4683
|
-
|
|
4725
|
+
else {
|
|
4726
|
+
setExpandedSectionIndex(null);
|
|
4727
|
+
}
|
|
4684
4728
|
}, [safeSections.length]);
|
|
4685
4729
|
// IntakeForm mode: called when Previous clicked - collapse current, expand previous
|
|
4686
4730
|
const handlePreviousSection = useCallback((index) => {
|
|
@@ -4847,20 +4891,24 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4847
4891
|
isDraft,
|
|
4848
4892
|
}
|
|
4849
4893
|
: {};
|
|
4894
|
+
// RegistryView: single-edit coordination props
|
|
4895
|
+
const registryViewEditProps = mode === 'RegistryView'
|
|
4896
|
+
? {
|
|
4897
|
+
onEditModeChange: handleEditModeChange,
|
|
4898
|
+
forceExitEdit: editingSectionId !== null && editingSectionId !== section['section-id'],
|
|
4899
|
+
}
|
|
4900
|
+
: {};
|
|
4850
4901
|
// Check if section has explicit column span
|
|
4851
4902
|
if (section['section-column-span']) {
|
|
4852
|
-
return (jsxRuntimeExports.jsx(SectionRenderer, { section: section, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: schemaData, onValueChange: onValueChange, gridColumnSpan: section['section-column-span'], onSectionSave: onSectionSave, hideEditButton: hideEditButton, mode: mode, namespace: sectionNamespace, onSectionDirtyChange: handleSectionDirtyChange, ...intakeFormProps }, section['section-id']));
|
|
4903
|
+
return (jsxRuntimeExports.jsx(SectionRenderer, { section: section, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: schemaData, onValueChange: onValueChange, gridColumnSpan: section['section-column-span'], onSectionSave: onSectionSave, hideEditButton: hideEditButton, mode: mode, namespace: sectionNamespace, onSectionDirtyChange: handleSectionDirtyChange, ...intakeFormProps, ...registryViewEditProps }, section['section-id']));
|
|
4853
4904
|
}
|
|
4854
4905
|
const verticalPanelsCount = countVerticalPanels(section.panels);
|
|
4855
4906
|
const tableWidgetColumnSpan = getTableWidgetColumnSpan(section.panels);
|
|
4856
4907
|
const containsTable = hasTableWidget(section.panels);
|
|
4857
|
-
// If section contains a table widget with explicit column span, use it
|
|
4858
|
-
// Otherwise, if it has a table widget, ensure it spans at least 2 columns
|
|
4859
|
-
// Otherwise, use the vertical panel count
|
|
4860
4908
|
const columnSpan = tableWidgetColumnSpan !== null
|
|
4861
4909
|
? tableWidgetColumnSpan
|
|
4862
4910
|
: (containsTable ? Math.max(verticalPanelsCount, 2) : verticalPanelsCount);
|
|
4863
|
-
return (jsxRuntimeExports.jsx(SectionRenderer, { section: section, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: schemaData, onValueChange: onValueChange, gridColumnSpan: columnSpan, onSectionSave: onSectionSave, hideEditButton: hideEditButton, mode: mode, namespace: sectionNamespace, onSectionDirtyChange: handleSectionDirtyChange, ...intakeFormProps }, section['section-id']));
|
|
4911
|
+
return (jsxRuntimeExports.jsx(SectionRenderer, { section: section, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: schemaData, onValueChange: onValueChange, gridColumnSpan: columnSpan, onSectionSave: onSectionSave, hideEditButton: hideEditButton, mode: mode, namespace: sectionNamespace, onSectionDirtyChange: handleSectionDirtyChange, ...intakeFormProps, ...registryViewEditProps }, section['section-id']));
|
|
4864
4912
|
}) })] }));
|
|
4865
4913
|
};
|
|
4866
4914
|
|
|
@@ -6770,9 +6818,9 @@ const TextInputWidget = ({ config }) => {
|
|
|
6770
6818
|
// For readonly mode, render as display text instead of input
|
|
6771
6819
|
if (widgetConfig['widget-readonly']) {
|
|
6772
6820
|
const label = translateConfig(widgetConfig['widget-label']);
|
|
6773
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] TextDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue }) })] }));
|
|
6821
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] TextDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue }) })] }));
|
|
6774
6822
|
}
|
|
6775
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-1", children: [jsxRuntimeExports.jsx("input", { type: getInputType(), value: displayValue, onChange: handleChange, onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: placeholder, maxLength: formatConfig?.mask ? undefined : maxLength, inputMode: formatConfig?.currency
|
|
6823
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 mb-1", children: [jsxRuntimeExports.jsx("input", { type: getInputType(), value: displayValue, onChange: handleChange, onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: placeholder, maxLength: formatConfig?.mask ? undefined : maxLength, inputMode: formatConfig?.currency
|
|
6776
6824
|
? 'decimal'
|
|
6777
6825
|
: formatConfig?.characterType === 'numeric' || formatConfig?.characterType === 'numeric-decimal'
|
|
6778
6826
|
? 'numeric'
|
|
@@ -6913,9 +6961,9 @@ const NumberInputWidget = ({ config }) => {
|
|
|
6913
6961
|
const label = translateConfig(widgetConfig['widget-label']);
|
|
6914
6962
|
const numValue = getNumericValue();
|
|
6915
6963
|
const display = numValue !== null ? formatNumber(numValue, formatConfig) : '';
|
|
6916
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] NumberDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: `text-base text-gray-900 font-medium ${textAlignClass}`, children: display }) })] }));
|
|
6964
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] NumberDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: `text-base text-gray-900 font-medium ${textAlignClass}`, title: String(display ?? ''), children: display }) })] }));
|
|
6917
6965
|
}
|
|
6918
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-1", children: [jsxRuntimeExports.jsx("input", { type: "text", inputMode: "decimal", value: displayValue, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: placeholder, maxLength: maxLength, className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${textAlignClass} ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (value === null || value === undefined || value === ''))
|
|
6966
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-1", children: [jsxRuntimeExports.jsx("input", { type: "text", inputMode: "decimal", value: displayValue, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, onKeyDown: handleKeyDown, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: placeholder, maxLength: maxLength, className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${textAlignClass} ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (value === null || value === undefined || value === ''))
|
|
6919
6967
|
? 'border-red-500 focus:ring-red-500 focus:border-red-500'
|
|
6920
6968
|
: 'border-gray-300'} ${!isEnabled || widgetConfig['widget-readonly'] ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'}`, style: { borderRadius: '10px' }, title: translateConfig(widgetConfig['widget-data-tooltip']) }), maxLength && (jsxRuntimeExports.jsxs("span", { className: `text-xs ml-2 flex-shrink-0 ${currentLength > maxLength
|
|
6921
6969
|
? 'text-red-500'
|
|
@@ -6986,20 +7034,20 @@ const BooleanWidget = ({ config }) => {
|
|
|
6986
7034
|
else {
|
|
6987
7035
|
displayValue = falseLabel;
|
|
6988
7036
|
}
|
|
6989
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] BooleanDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue }) })] }));
|
|
7037
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] BooleanDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue }) })] }));
|
|
6990
7038
|
}
|
|
6991
7039
|
// Render based on control type
|
|
6992
7040
|
if (controlType === 'checkbox') {
|
|
6993
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("label", { className: "flex items-center cursor-pointer", children: [jsxRuntimeExports.jsx("input", { type: "checkbox", checked: currentValue === true, onChange: handleCheckboxChange, onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: currentValue === true ? trueLabel : (currentValue === false ? falseLabel : '-') })] }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7041
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("label", { className: "flex items-center cursor-pointer", children: [jsxRuntimeExports.jsx("input", { type: "checkbox", checked: currentValue === true, onChange: handleCheckboxChange, onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: currentValue === true ? trueLabel : (currentValue === false ? falseLabel : '-') })] }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
6994
7042
|
}
|
|
6995
7043
|
if (controlType === 'radio') {
|
|
6996
7044
|
const containerClass = orientation === 'horizontal'
|
|
6997
7045
|
? 'flex flex-row space-x-4'
|
|
6998
7046
|
: 'flex flex-col space-y-2';
|
|
6999
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: containerClass, onBlur: onBlur, children: [allowUnset && (jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], checked: currentValue === null, onChange: () => handleRadioChange(null), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: "-" })] })), jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], checked: currentValue === true, onChange: () => handleRadioChange(true), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: trueLabel })] }), jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], checked: currentValue === false, onChange: () => handleRadioChange(false), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: falseLabel })] })] }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7047
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: containerClass, onBlur: onBlur, children: [allowUnset && (jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], checked: currentValue === null, onChange: () => handleRadioChange(null), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: "-" })] })), jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], checked: currentValue === true, onChange: () => handleRadioChange(true), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: trueLabel })] }), jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], checked: currentValue === false, onChange: () => handleRadioChange(false), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: falseLabel })] })] }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7000
7048
|
}
|
|
7001
7049
|
// Toggle/switch control type
|
|
7002
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 sm:min-w-[150px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-3", onBlur: onBlur, children: [allowUnset && (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => handleChange(null), disabled: !isEnabled || widgetConfig['widget-readonly'], className: `px-3 py-1 text-sm border ${currentValue === null
|
|
7050
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 sm:min-w-[150px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center space-x-3", onBlur: onBlur, children: [allowUnset && (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => handleChange(null), disabled: !isEnabled || widgetConfig['widget-readonly'], className: `px-3 py-1 text-sm border ${currentValue === null
|
|
7003
7051
|
? 'bg-blue-600 text-white border-blue-600'
|
|
7004
7052
|
: 'bg-white text-gray-700 border-gray-300'} ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : 'hover:bg-gray-50'}`, style: { borderRadius: '15px' }, children: "-" })), jsxRuntimeExports.jsx("button", { type: "button", onClick: () => handleChange(true), disabled: !isEnabled || widgetConfig['widget-readonly'], className: `px-3 py-1 text-sm border ${currentValue === true
|
|
7005
7053
|
? 'bg-blue-600 text-white border-blue-600'
|
|
@@ -7160,9 +7208,9 @@ const DateInputWidget = ({ config }) => {
|
|
|
7160
7208
|
else {
|
|
7161
7209
|
displayValue = '-';
|
|
7162
7210
|
}
|
|
7163
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] DateDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue }) })] }));
|
|
7211
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] DateDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue }) })] }));
|
|
7164
7212
|
}
|
|
7165
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("input", { type: inputType, value: getDisplayValue(), onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: placeholder, min: inputMethod === 'picker' ? effectiveMinDate : undefined, max: inputMethod === 'picker' ? effectiveMaxDate : undefined, className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (!value || value === ''))
|
|
7213
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("input", { type: inputType, value: getDisplayValue(), onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: placeholder, min: inputMethod === 'picker' ? effectiveMinDate : undefined, max: inputMethod === 'picker' ? effectiveMaxDate : undefined, className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (!value || value === ''))
|
|
7166
7214
|
? 'border-red-500 focus:ring-red-500 focus:border-red-500'
|
|
7167
7215
|
: 'border-gray-300'} ${!isEnabled || widgetConfig['widget-readonly'] ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'}`, style: { borderRadius: '10px' }, title: translateConfig(widgetConfig['widget-data-tooltip']) }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7168
7216
|
};
|
|
@@ -7603,9 +7651,9 @@ const DateTimeInputWidget = ({ config }) => {
|
|
|
7603
7651
|
else {
|
|
7604
7652
|
displayValue = '-';
|
|
7605
7653
|
}
|
|
7606
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] DateTimeDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue }) })] }));
|
|
7654
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] DateTimeDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue }) })] }));
|
|
7607
7655
|
}
|
|
7608
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("input", { type: inputType, value: getDisplayValue(), onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: placeholder, min: inputMethod === 'picker' ? effectiveMinDateTime : undefined, max: inputMethod === 'picker' ? effectiveMaxDateTime : undefined, className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (!value || value === ''))
|
|
7656
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("input", { type: inputType, value: getDisplayValue(), onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: placeholder, min: inputMethod === 'picker' ? effectiveMinDateTime : undefined, max: inputMethod === 'picker' ? effectiveMaxDateTime : undefined, className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (!value || value === ''))
|
|
7609
7657
|
? 'border-red-500 focus:ring-red-500 focus:border-red-500'
|
|
7610
7658
|
: 'border-gray-300'} ${!isEnabled || widgetConfig['widget-readonly'] ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'}`, style: { borderRadius: '10px' }, title: translateConfig(widgetConfig['widget-data-tooltip']) }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7611
7659
|
};
|
|
@@ -7619,9 +7667,9 @@ const SelectWidget = ({ config }) => {
|
|
|
7619
7667
|
// Find the selected option's label
|
|
7620
7668
|
const selectedOption = dataSourceOptions.find((option) => option.value === value);
|
|
7621
7669
|
const displayValue = selectedOption ? selectedOption.label : (value || '-');
|
|
7622
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] SelectDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue }) })] }));
|
|
7670
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] SelectDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue }) })] }));
|
|
7623
7671
|
}
|
|
7624
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("select", { value: value || '', onChange: (e) => onChange(e.target.value), onBlur: onBlur, disabled: !isEnabled || loading || widgetConfig['widget-readonly'], className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (!value || value === ''))
|
|
7672
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("select", { value: value || '', onChange: (e) => onChange(e.target.value), onBlur: onBlur, disabled: !isEnabled || loading || widgetConfig['widget-readonly'], className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (!value || value === ''))
|
|
7625
7673
|
? 'border-red-500 focus:ring-red-500 focus:border-red-500'
|
|
7626
7674
|
: 'border-gray-300'} ${!isEnabled || loading || widgetConfig['widget-readonly'] ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'}`, style: { borderRadius: '10px' }, title: translateConfig(widgetConfig['widget-data-tooltip']), children: [jsxRuntimeExports.jsx("option", { value: "", children: translate('common.select') }), dataSourceOptions.map((option) => (jsxRuntimeExports.jsx("option", { value: option.value, children: option.label }, option.value)))] }), loading && (jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-500 mt-1", children: translate('common.loadingOptions') })), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7627
7675
|
};
|
|
@@ -7691,9 +7739,9 @@ const RadioWidget = ({ config }) => {
|
|
|
7691
7739
|
const label = translateConfig(widgetConfig['widget-label']);
|
|
7692
7740
|
const selectedOption = processedOptions.find(opt => opt.value === currentValue);
|
|
7693
7741
|
const displayValue = selectedOption ? selectedOption.label : (allowUnset && currentValue === null ? '-' : '');
|
|
7694
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] RadioDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue }) })] }));
|
|
7742
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] RadioDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue }) })] }));
|
|
7695
7743
|
}
|
|
7696
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("div", { className: layoutConfig.className, style: layoutConfig.style, onBlur: onBlur, children: loading ? (jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-500", children: translate('common.loading') })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [allowUnset && (jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], checked: currentValue === null, onChange: handleUnset, disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: "-" })] })), processedOptions.map((option) => (jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], value: option.value, checked: currentValue === option.value, onChange: (e) => handleChange(option.value), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: translateConfig(option.label) })] }, option.value)))] })) }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7744
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("div", { className: layoutConfig.className, style: layoutConfig.style, onBlur: onBlur, children: loading ? (jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-500", children: translate('common.loading') })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [allowUnset && (jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], checked: currentValue === null, onChange: handleUnset, disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: "-" })] })), processedOptions.map((option) => (jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "radio", name: widgetConfig['widget-id'], value: option.value, checked: currentValue === option.value, onChange: (e) => handleChange(option.value), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: translateConfig(option.label) })] }, option.value)))] })) }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7697
7745
|
};
|
|
7698
7746
|
|
|
7699
7747
|
const CheckboxWidget = ({ config }) => {
|
|
@@ -7710,9 +7758,9 @@ const CheckboxWidget = ({ config }) => {
|
|
|
7710
7758
|
if (widgetConfig['widget-readonly']) {
|
|
7711
7759
|
const label = translateConfig(widgetConfig['widget-label']);
|
|
7712
7760
|
const displayValue = isChecked ? 'Yes' : 'No';
|
|
7713
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] CheckboxDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue }) })] }));
|
|
7761
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] CheckboxDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue }) })] }));
|
|
7714
7762
|
}
|
|
7715
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("label", { className: "flex items-center cursor-pointer", children: [jsxRuntimeExports.jsx("input", { type: "checkbox", checked: isChecked, onChange: (e) => onChange(e.target.checked), onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: isChecked ? 'Yes' : 'No' })] }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7763
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("label", { className: "flex items-center cursor-pointer", children: [jsxRuntimeExports.jsx("input", { type: "checkbox", checked: isChecked, onChange: (e) => onChange(e.target.checked), onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: isChecked ? 'Yes' : 'No' })] }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7716
7764
|
}
|
|
7717
7765
|
// Multiple checkboxes (with data source) - for array values
|
|
7718
7766
|
// Process and sort options if needed
|
|
@@ -7780,9 +7828,9 @@ const CheckboxWidget = ({ config }) => {
|
|
|
7780
7828
|
const displayValue = selectedOptions.length > 0
|
|
7781
7829
|
? selectedOptions.map(opt => translateConfig(opt.label)).join(', ')
|
|
7782
7830
|
: '-';
|
|
7783
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-3 CheckboxDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-sm text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue }) })] }));
|
|
7831
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-3 CheckboxDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-sm text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue }) })] }));
|
|
7784
7832
|
}
|
|
7785
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("div", { className: layoutConfig.className, style: layoutConfig.style, onBlur: onBlur, children: loading ? (jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-500", children: translate('common.loading') })) : (processedOptions.map((option) => (jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "checkbox", value: option.value, checked: selectedValues.includes(option.value), onChange: (e) => handleCheckboxChange(option.value, e.target.checked), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: translateConfig(option.label) })] }, option.value)))) }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7833
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("div", { className: layoutConfig.className, style: layoutConfig.style, onBlur: onBlur, children: loading ? (jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-500", children: translate('common.loading') })) : (processedOptions.map((option) => (jsxRuntimeExports.jsxs("label", { className: `flex items-center cursor-pointer ${!isEnabled || widgetConfig['widget-readonly'] ? 'opacity-50 cursor-not-allowed' : ''}`, children: [jsxRuntimeExports.jsx("input", { type: "checkbox", value: option.value, checked: selectedValues.includes(option.value), onChange: (e) => handleCheckboxChange(option.value, e.target.checked), disabled: !isEnabled || widgetConfig['widget-readonly'], className: "mr-2 h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded" }), jsxRuntimeExports.jsx("span", { className: "text-sm text-gray-700", children: translateConfig(option.label) })] }, option.value)))) }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7786
7834
|
};
|
|
7787
7835
|
|
|
7788
7836
|
const SimpleTableWidget = ({ config }) => {
|
|
@@ -7857,7 +7905,7 @@ const ArrayWidget = ({ config }) => {
|
|
|
7857
7905
|
newItems[index] = newValue;
|
|
7858
7906
|
onChange(newItems);
|
|
7859
7907
|
};
|
|
7860
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px]", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start mb-2", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 flex justify-between items-center", children: [jsxRuntimeExports.jsx("div", { className: "flex-1" }), operations.add && !isReadonly && isEnabled && (jsxRuntimeExports.jsx("button", { type: "button", onClick: addItem, className: "px-3 py-1 text-sm bg-blue-500 text-white hover:bg-blue-600", style: { borderRadius: '15px' }, children: addLabel }))] })] }), items.length === 0 ? (jsxRuntimeExports.jsxs("div", { className: "text-gray-500 text-sm py-4 text-center border border-gray-300 rounded", children: [translate('common.noItems'), ". ", operations.add && !isReadonly && translate('common.clickToAdd', { label: addLabel })] })) : (jsxRuntimeExports.jsx("div", { className: "space-y-2", children: items.map((itemValue, index) => {
|
|
7908
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px]", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start mb-2", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 flex justify-between items-center", children: [jsxRuntimeExports.jsx("div", { className: "flex-1" }), operations.add && !isReadonly && isEnabled && (jsxRuntimeExports.jsx("button", { type: "button", onClick: addItem, className: "px-3 py-1 text-sm bg-blue-500 text-white hover:bg-blue-600", style: { borderRadius: '15px' }, children: addLabel }))] })] }), items.length === 0 ? (jsxRuntimeExports.jsxs("div", { className: "text-gray-500 text-sm py-4 text-center border border-gray-300 rounded", children: [translate('common.noItems'), ". ", operations.add && !isReadonly && translate('common.clickToAdd', { label: addLabel })] })) : (jsxRuntimeExports.jsx("div", { className: "space-y-2", children: items.map((itemValue, index) => {
|
|
7861
7909
|
({
|
|
7862
7910
|
...itemConfig,
|
|
7863
7911
|
'widget-id': `${widgetConfig['widget-id']}-item-${index}`,
|
|
@@ -7917,7 +7965,7 @@ const IterableAccordionWidget = ({ config }) => {
|
|
|
7917
7965
|
newItems[index] = newValue;
|
|
7918
7966
|
onChange(newItems);
|
|
7919
7967
|
};
|
|
7920
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px]", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start mb-2", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 flex justify-between items-center", children: [jsxRuntimeExports.jsx("div", { className: "flex-1" }), operations.add && !isReadonly && isEnabled && (jsxRuntimeExports.jsx("button", { type: "button", onClick: addItem, className: "px-3 py-1 text-sm bg-blue-500 text-white hover:bg-blue-600", style: { borderRadius: '15px' }, children: addLabel }))] })] }), items.length === 0 ? (jsxRuntimeExports.jsxs("div", { className: "text-gray-500 text-sm py-4 text-center border border-gray-300 rounded", children: [translate('common.noItems'), ". ", operations.add && !isReadonly && translate('common.clickToAdd', { label: addLabel })] })) : (jsxRuntimeExports.jsx("div", { className: "space-y-2", children: items.map((itemValue, index) => {
|
|
7968
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px]", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start mb-2", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 flex justify-between items-center", children: [jsxRuntimeExports.jsx("div", { className: "flex-1" }), operations.add && !isReadonly && isEnabled && (jsxRuntimeExports.jsx("button", { type: "button", onClick: addItem, className: "px-3 py-1 text-sm bg-blue-500 text-white hover:bg-blue-600", style: { borderRadius: '15px' }, children: addLabel }))] })] }), items.length === 0 ? (jsxRuntimeExports.jsxs("div", { className: "text-gray-500 text-sm py-4 text-center border border-gray-300 rounded", children: [translate('common.noItems'), ". ", operations.add && !isReadonly && translate('common.clickToAdd', { label: addLabel })] })) : (jsxRuntimeExports.jsx("div", { className: "space-y-2", children: items.map((itemValue, index) => {
|
|
7921
7969
|
const isCollapsed = collapsedItems[index] ?? defaultCollapsed;
|
|
7922
7970
|
const parentPath = widgetConfig['widget-data-path'];
|
|
7923
7971
|
const childPath = itemConfig['widget-data-path'];
|
|
@@ -7965,9 +8013,9 @@ const PhoneInputWidget = ({ config }) => {
|
|
|
7965
8013
|
// For readonly mode, render as display text
|
|
7966
8014
|
if (widgetConfig['widget-readonly']) {
|
|
7967
8015
|
const label = translateConfig(widgetConfig['widget-label']);
|
|
7968
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] PhoneDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: displayValue || '-' }) })] }));
|
|
8016
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] PhoneDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(displayValue || ''), children: displayValue || '-' }) })] }));
|
|
7969
8017
|
}
|
|
7970
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("input", { type: "tel", value: displayValue, onChange: (e) => onChange(e.target.value), onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: translateConfig(widgetConfig['widget-data-placeholder']), className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (!value || value === ''))
|
|
8018
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsx("input", { type: "tel", value: displayValue, onChange: (e) => onChange(e.target.value), onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: translateConfig(widgetConfig['widget-data-placeholder']), className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (!value || value === ''))
|
|
7971
8019
|
? 'border-red-500 focus:ring-red-500 focus:border-red-500'
|
|
7972
8020
|
: 'border-gray-300'} ${!isEnabled || widgetConfig['widget-readonly'] ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'}`, style: { borderRadius: '10px' }, title: translateConfig(widgetConfig['widget-data-tooltip']) }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
7973
8021
|
};
|
|
@@ -7993,9 +8041,9 @@ const CurrencyInputWidget = ({ config }) => {
|
|
|
7993
8041
|
if (widgetConfig['widget-readonly']) {
|
|
7994
8042
|
const label = translateConfig(widgetConfig['widget-label']);
|
|
7995
8043
|
const display = formattedValue || (value !== null && value !== undefined ? String(value) : '-');
|
|
7996
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] CurrencyDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", children: display }) })] }));
|
|
8044
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] CurrencyDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("div", { className: "text-base text-gray-900 font-medium", title: String(display ?? ''), children: display }) })] }));
|
|
7997
8045
|
}
|
|
7998
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "relative", children: [jsxRuntimeExports.jsx("input", { type: "text", inputMode: "decimal", value: numericValue, onChange: handleChange, onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: translateConfig(widgetConfig['widget-data-placeholder']), className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (value === null || value === undefined || value === ''))
|
|
8046
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [translateConfig(widgetConfig['widget-label']), widgetConfig['widget-required'] && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "relative", children: [jsxRuntimeExports.jsx("input", { type: "text", inputMode: "decimal", value: numericValue, onChange: handleChange, onBlur: onBlur, disabled: !isEnabled || widgetConfig['widget-readonly'], placeholder: translateConfig(widgetConfig['widget-data-placeholder']), className: `w-full sm:w-[180px] max-w-full h-[30px] px-3 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${(touched && error.length > 0) || (widgetConfig['widget-required'] && (value === null || value === undefined || value === ''))
|
|
7999
8047
|
? 'border-red-500 focus:ring-red-500 focus:border-red-500'
|
|
8000
8048
|
: 'border-gray-300'} ${!isEnabled || widgetConfig['widget-readonly'] ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'}`, style: { borderRadius: '10px' }, title: translateConfig(widgetConfig['widget-data-tooltip']) }), formattedValue && formattedValue !== String(value) && (jsxRuntimeExports.jsx("span", { className: "absolute right-3 top-2 text-gray-500 text-sm", children: formattedValue }))] }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: error[0] }))] })] }) }));
|
|
8001
8049
|
};
|
|
@@ -8041,10 +8089,10 @@ const DisplayWidget = ({ config }) => {
|
|
|
8041
8089
|
const label = translateConfig(widgetConfig['widget-label']);
|
|
8042
8090
|
// If no label, render as paragraph text
|
|
8043
8091
|
if (!label || label.trim() === '') {
|
|
8044
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-3 text-base text-gray-700", children: displayValue }));
|
|
8092
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-3 text-base text-gray-700", title: String(displayValue ?? ''), children: displayValue }));
|
|
8045
8093
|
}
|
|
8046
8094
|
// With label, render as key-value pair
|
|
8047
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] }), jsxRuntimeExports.jsx("div", { className: "flex-1 text-base text-gray-900 font-medium", children: displayValue })] }));
|
|
8095
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] }), jsxRuntimeExports.jsx("div", { className: "flex-1 text-base text-gray-900 font-medium", title: String(displayValue ?? ''), children: displayValue })] }));
|
|
8048
8096
|
};
|
|
8049
8097
|
|
|
8050
8098
|
const TableCellSelect = ({ config, value, onValueChange }) => {
|
|
@@ -8858,7 +8906,7 @@ const TextAreaWidget = ({ config }) => {
|
|
|
8858
8906
|
// For readonly mode, render as preformatted text using <pre> tag
|
|
8859
8907
|
if (isReadonly) {
|
|
8860
8908
|
const displayValue = getStringValue() || '-';
|
|
8861
|
-
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] TextAreaDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("pre", { className: "text-base text-gray-900 font-medium whitespace-pre-wrap", style: {
|
|
8909
|
+
return (jsxRuntimeExports.jsxs("div", { className: "mb-[10px] TextAreaDisplayWidget flex flex-col sm:flex-row sm:items-start", children: [label && (jsxRuntimeExports.jsxs("div", { className: "text-base text-gray-600 font-medium md:min-w-[120px] sm:pr-4 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: label, children: [label, ":"] })), jsxRuntimeExports.jsx("div", { className: "flex-1", children: jsxRuntimeExports.jsx("pre", { className: "text-base text-gray-900 font-medium whitespace-pre-wrap", title: String(displayValue), style: {
|
|
8862
8910
|
fontFamily: 'Roboto, sans-serif',
|
|
8863
8911
|
margin: 0,
|
|
8864
8912
|
padding: 0,
|
|
@@ -8866,7 +8914,7 @@ const TextAreaWidget = ({ config }) => {
|
|
|
8866
8914
|
border: 'none',
|
|
8867
8915
|
}, children: displayValue }) })] }));
|
|
8868
8916
|
}
|
|
8869
|
-
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, children: [label, isRequired && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { style: { position: 'relative' }, children: [jsxRuntimeExports.jsx("textarea", { id: widgetConfig['widget-id'], rows: rows, value: getStringValue(), onChange: handleChange, onBlur: onBlur, disabled: !isEnabled, placeholder: placeholder, className: `w-full px-3 py-2 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${hasError
|
|
8917
|
+
return (jsxRuntimeExports.jsx("div", { className: "mb-[10px]", children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col sm:flex-row sm:items-start", children: [jsxRuntimeExports.jsxs("label", { className: "text-base font-medium text-gray-700 md:min-w-[120px] sm:pr-4 sm:pt-1 mb-1 sm:mb-0", style: { fontFamily: 'Roboto, sans-serif' }, title: translateConfig(widgetConfig['widget-label']), children: [label, isRequired && (jsxRuntimeExports.jsx("span", { className: "text-red-500 ml-1", children: "*" }))] }), jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [jsxRuntimeExports.jsxs("div", { style: { position: 'relative' }, children: [jsxRuntimeExports.jsx("textarea", { id: widgetConfig['widget-id'], rows: rows, value: getStringValue(), onChange: handleChange, onBlur: onBlur, disabled: !isEnabled, placeholder: placeholder, className: `w-full px-3 py-2 border shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${hasError
|
|
8870
8918
|
? 'border-red-500 focus:ring-red-500 focus:border-red-500'
|
|
8871
8919
|
: 'border-gray-300'} ${!isEnabled ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'}`, style: {
|
|
8872
8920
|
borderRadius: '10px',
|
|
@@ -8882,6 +8930,326 @@ const TextAreaWidget = ({ config }) => {
|
|
|
8882
8930
|
}, children: charCounterText }))] }), hasError && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: errorMessage }))] })] }) }));
|
|
8883
8931
|
};
|
|
8884
8932
|
|
|
8933
|
+
const DEFAULT_STATUS_COLORS = {
|
|
8934
|
+
active: '#16A34A',
|
|
8935
|
+
inactive: '#D97706',
|
|
8936
|
+
archived: '#6B7280',
|
|
8937
|
+
};
|
|
8938
|
+
// ── Hook: load data-source options for a single field ────────────
|
|
8939
|
+
// Options are loaded in both view and edit modes because view mode
|
|
8940
|
+
// needs them to resolve display labels (e.g. "active" → "Active").
|
|
8941
|
+
// For API data sources, loading is deferred to edit mode to avoid
|
|
8942
|
+
// unnecessary network calls when only labels are needed.
|
|
8943
|
+
function useFieldDataSource(fieldKey, fieldConfig, isReadonly) {
|
|
8944
|
+
const [options, setOptions] = useState([]);
|
|
8945
|
+
const { dataSourceRequestHandler, schemaData } = useWidgetContext();
|
|
8946
|
+
const values = useSelector((state) => state.widget.values);
|
|
8947
|
+
const dataSource = fieldConfig?.['data-source'];
|
|
8948
|
+
const dsType = dataSource?.type;
|
|
8949
|
+
const dsKey = dataSource
|
|
8950
|
+
? `${fieldKey}-${dsType}-${JSON.stringify(dataSource)}`
|
|
8951
|
+
: '';
|
|
8952
|
+
useEffect(() => {
|
|
8953
|
+
if (!dataSource) {
|
|
8954
|
+
setOptions([]);
|
|
8955
|
+
return;
|
|
8956
|
+
}
|
|
8957
|
+
// API sources: only fetch when editable to avoid unnecessary calls
|
|
8958
|
+
if (dataSource.type === 'api' && isReadonly) {
|
|
8959
|
+
return;
|
|
8960
|
+
}
|
|
8961
|
+
let cancelled = false;
|
|
8962
|
+
const load = async () => {
|
|
8963
|
+
try {
|
|
8964
|
+
let raw = [];
|
|
8965
|
+
if (dataSource.type === 'static') {
|
|
8966
|
+
raw = getStaticDataSource(dataSource);
|
|
8967
|
+
}
|
|
8968
|
+
else if (dataSource.type === 'api') {
|
|
8969
|
+
if (!dataSourceRequestHandler)
|
|
8970
|
+
return;
|
|
8971
|
+
raw = await getApiDataSource(dataSource, values, dataSourceRequestHandler);
|
|
8972
|
+
}
|
|
8973
|
+
else if (dataSource.type === 'schema') {
|
|
8974
|
+
raw = getSchemaDataSource(dataSource, schemaData || {});
|
|
8975
|
+
}
|
|
8976
|
+
const transformed = transformDataSourceOptions(raw, dataSource.valueKey, dataSource.labelKey);
|
|
8977
|
+
if (!cancelled)
|
|
8978
|
+
setOptions(transformed);
|
|
8979
|
+
}
|
|
8980
|
+
catch (err) {
|
|
8981
|
+
console.error(`[HeaderSectionWidget] Error loading data-source for field "${fieldKey}":`, err);
|
|
8982
|
+
if (!cancelled)
|
|
8983
|
+
setOptions([]);
|
|
8984
|
+
}
|
|
8985
|
+
};
|
|
8986
|
+
load();
|
|
8987
|
+
return () => { cancelled = true; };
|
|
8988
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8989
|
+
}, [dsKey, isReadonly, dataSourceRequestHandler]);
|
|
8990
|
+
return options;
|
|
8991
|
+
}
|
|
8992
|
+
// ── Main component ───────────────────────────────────────────────
|
|
8993
|
+
const HeaderSectionWidget = ({ config }) => {
|
|
8994
|
+
const { config: widgetConfig, getFieldValue, } = useBaseWidget({ config });
|
|
8995
|
+
const dispatch = useDispatch();
|
|
8996
|
+
const { translateConfig } = useWidgetTranslation();
|
|
8997
|
+
const { schemaData } = useWidgetContext();
|
|
8998
|
+
const values = useSelector((state) => state.widget.values);
|
|
8999
|
+
const isReadonly = widgetConfig['widget-readonly'] !== false;
|
|
9000
|
+
const dataPath = widgetConfig['widget-data-path'];
|
|
9001
|
+
// ── Per-field config map ──────────────────────────────────────
|
|
9002
|
+
const fieldConfigMap = useMemo(() => {
|
|
9003
|
+
return widgetConfig['widget-field-config'] || {};
|
|
9004
|
+
}, [widgetConfig['widget-field-config']]);
|
|
9005
|
+
// ── Load data source options for the status field ─────────────
|
|
9006
|
+
const statusOptions = useFieldDataSource('status', fieldConfigMap['status'], isReadonly);
|
|
9007
|
+
// ── Resolve field values ──────────────────────────────────────
|
|
9008
|
+
const paths = useMemo(() => {
|
|
9009
|
+
if (!dataPath || typeof dataPath !== 'object')
|
|
9010
|
+
return {};
|
|
9011
|
+
return dataPath;
|
|
9012
|
+
}, [dataPath]);
|
|
9013
|
+
const findValue = useCallback((fieldKey) => {
|
|
9014
|
+
const path = paths[fieldKey];
|
|
9015
|
+
if (!path)
|
|
9016
|
+
return undefined;
|
|
9017
|
+
const searchIn = (source) => {
|
|
9018
|
+
if (!source)
|
|
9019
|
+
return undefined;
|
|
9020
|
+
let v = getValueByPath(source, path);
|
|
9021
|
+
if (v !== undefined)
|
|
9022
|
+
return v;
|
|
9023
|
+
for (const obj of Object.values(source)) {
|
|
9024
|
+
if (obj && typeof obj === 'object' && !Array.isArray(obj)) {
|
|
9025
|
+
v = getValueByPath(obj, path);
|
|
9026
|
+
if (v !== undefined)
|
|
9027
|
+
return v;
|
|
9028
|
+
}
|
|
9029
|
+
}
|
|
9030
|
+
return undefined;
|
|
9031
|
+
};
|
|
9032
|
+
let result = searchIn(values);
|
|
9033
|
+
if (result === undefined)
|
|
9034
|
+
result = searchIn(schemaData);
|
|
9035
|
+
return result;
|
|
9036
|
+
}, [paths, values, schemaData]);
|
|
9037
|
+
const imageUrl = findValue('image') || null;
|
|
9038
|
+
const displayName = findValue('name') || '';
|
|
9039
|
+
const functionalId = findValue('functionalId') || '';
|
|
9040
|
+
const statusValue = findValue('status') || '';
|
|
9041
|
+
const statusReason = findValue('statusReason') || '';
|
|
9042
|
+
const createdBy = findValue('createdBy') || '';
|
|
9043
|
+
const createdAt = findValue('createdAt') || '';
|
|
9044
|
+
const lastApprovedBy = findValue('lastApprovedBy') || '';
|
|
9045
|
+
const lastApprovedAt = findValue('lastApprovedAt') || '';
|
|
9046
|
+
// ── Format options ────────────────────────────────────────────
|
|
9047
|
+
const format = (widgetConfig['widget-data-format'] || {});
|
|
9048
|
+
const imageSize = format.imageSize || 90;
|
|
9049
|
+
const nameColor = format.nameColor || '#ED7C22';
|
|
9050
|
+
const statusColors = {
|
|
9051
|
+
...DEFAULT_STATUS_COLORS,
|
|
9052
|
+
...(format.statusColors || {}),
|
|
9053
|
+
};
|
|
9054
|
+
// ── Value change helpers ──────────────────────────────────────
|
|
9055
|
+
const updateFieldValue = useCallback((fieldKey, newValue) => {
|
|
9056
|
+
const path = paths[fieldKey];
|
|
9057
|
+
if (!path)
|
|
9058
|
+
return;
|
|
9059
|
+
const updated = setValueByPath({ ...values }, path, newValue);
|
|
9060
|
+
dispatch(setValues(updated));
|
|
9061
|
+
}, [paths, values, dispatch]);
|
|
9062
|
+
// ── Status helpers ────────────────────────────────────────────
|
|
9063
|
+
const statusLabel = useMemo(() => {
|
|
9064
|
+
if (!statusValue)
|
|
9065
|
+
return '';
|
|
9066
|
+
const opt = statusOptions.find((o) => String(o.value).toLowerCase() === String(statusValue).toLowerCase());
|
|
9067
|
+
return opt ? opt.label : String(statusValue);
|
|
9068
|
+
}, [statusValue, statusOptions]);
|
|
9069
|
+
const statusColor = statusColors[String(statusValue).toLowerCase()] || '#6B7280';
|
|
9070
|
+
// ── Scoped class for CSS isolation ────────────────────────────
|
|
9071
|
+
const cls = `header-section-widget-${widgetConfig['widget-id']}`;
|
|
9072
|
+
// ── Indicator dot component ───────────────────────────────────
|
|
9073
|
+
const Dot = ({ color }) => (jsxRuntimeExports.jsx("span", { style: {
|
|
9074
|
+
display: 'inline-block',
|
|
9075
|
+
width: 8,
|
|
9076
|
+
height: 8,
|
|
9077
|
+
borderRadius: '50%',
|
|
9078
|
+
backgroundColor: color,
|
|
9079
|
+
flexShrink: 0,
|
|
9080
|
+
marginTop: 6,
|
|
9081
|
+
} }));
|
|
9082
|
+
// ── RENDER ────────────────────────────────────────────────────
|
|
9083
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { children: `
|
|
9084
|
+
.${cls} {
|
|
9085
|
+
display: flex;
|
|
9086
|
+
flex-direction: row;
|
|
9087
|
+
gap: 1.5rem;
|
|
9088
|
+
width: 100%;
|
|
9089
|
+
font-family: Roboto, sans-serif;
|
|
9090
|
+
padding: 35px 0 16px 0;
|
|
9091
|
+
}
|
|
9092
|
+
|
|
9093
|
+
.${cls} .hdr-left {
|
|
9094
|
+
display: flex;
|
|
9095
|
+
flex-direction: row;
|
|
9096
|
+
align-items: flex-start;
|
|
9097
|
+
gap: 1rem;
|
|
9098
|
+
flex: 1 1 55%;
|
|
9099
|
+
min-width: 0;
|
|
9100
|
+
}
|
|
9101
|
+
|
|
9102
|
+
.${cls} .hdr-right {
|
|
9103
|
+
display: flex;
|
|
9104
|
+
flex-direction: column;
|
|
9105
|
+
gap: 0.5rem;
|
|
9106
|
+
flex: 0 0 auto;
|
|
9107
|
+
min-width: 220px;
|
|
9108
|
+
}
|
|
9109
|
+
|
|
9110
|
+
.${cls} .hdr-avatar {
|
|
9111
|
+
width: ${imageSize}px;
|
|
9112
|
+
height: ${imageSize}px;
|
|
9113
|
+
border-radius: 8px;
|
|
9114
|
+
object-fit: cover;
|
|
9115
|
+
background-color: #e5e7eb;
|
|
9116
|
+
border: 2px solid #d1d5db;
|
|
9117
|
+
flex-shrink: 0;
|
|
9118
|
+
}
|
|
9119
|
+
|
|
9120
|
+
.${cls} .hdr-avatar-placeholder {
|
|
9121
|
+
width: ${imageSize}px;
|
|
9122
|
+
height: ${imageSize}px;
|
|
9123
|
+
border-radius: 8px;
|
|
9124
|
+
background-color: #e5e7eb;
|
|
9125
|
+
border: 2px solid #d1d5db;
|
|
9126
|
+
display: flex;
|
|
9127
|
+
align-items: center;
|
|
9128
|
+
justify-content: center;
|
|
9129
|
+
flex-shrink: 0;
|
|
9130
|
+
overflow: hidden;
|
|
9131
|
+
}
|
|
9132
|
+
|
|
9133
|
+
.${cls} .hdr-avatar-placeholder img {
|
|
9134
|
+
width: 100%;
|
|
9135
|
+
height: 100%;
|
|
9136
|
+
object-fit: cover;
|
|
9137
|
+
border-radius: 8px;
|
|
9138
|
+
}
|
|
9139
|
+
|
|
9140
|
+
.${cls} .hdr-info {
|
|
9141
|
+
display: flex;
|
|
9142
|
+
flex-direction: column;
|
|
9143
|
+
gap: 0.35rem;
|
|
9144
|
+
min-width: 0;
|
|
9145
|
+
flex: 1;
|
|
9146
|
+
}
|
|
9147
|
+
|
|
9148
|
+
.${cls} .hdr-name {
|
|
9149
|
+
font-size: 1.25rem;
|
|
9150
|
+
font-weight: 600;
|
|
9151
|
+
color: ${nameColor};
|
|
9152
|
+
line-height: 1.4;
|
|
9153
|
+
word-wrap: break-word;
|
|
9154
|
+
}
|
|
9155
|
+
|
|
9156
|
+
.${cls} .hdr-field-row {
|
|
9157
|
+
display: flex;
|
|
9158
|
+
align-items: flex-start;
|
|
9159
|
+
gap: 0.5rem;
|
|
9160
|
+
font-size: 0.875rem;
|
|
9161
|
+
line-height: 1.6;
|
|
9162
|
+
}
|
|
9163
|
+
|
|
9164
|
+
.${cls} .hdr-field-label {
|
|
9165
|
+
color: #6b7280;
|
|
9166
|
+
font-weight: 500;
|
|
9167
|
+
white-space: nowrap;
|
|
9168
|
+
}
|
|
9169
|
+
|
|
9170
|
+
.${cls} .hdr-field-value {
|
|
9171
|
+
color: #111827;
|
|
9172
|
+
font-weight: 600;
|
|
9173
|
+
}
|
|
9174
|
+
|
|
9175
|
+
.${cls} .hdr-status-badge {
|
|
9176
|
+
display: inline-block;
|
|
9177
|
+
padding: 2px 12px;
|
|
9178
|
+
border-radius: 4px;
|
|
9179
|
+
font-size: 0.75rem;
|
|
9180
|
+
font-weight: 600;
|
|
9181
|
+
color: #fff;
|
|
9182
|
+
}
|
|
9183
|
+
|
|
9184
|
+
.${cls} .hdr-meta-row {
|
|
9185
|
+
display: flex;
|
|
9186
|
+
align-items: baseline;
|
|
9187
|
+
gap: 0.35rem;
|
|
9188
|
+
font-size: 0.875rem;
|
|
9189
|
+
line-height: 1.6;
|
|
9190
|
+
}
|
|
9191
|
+
|
|
9192
|
+
.${cls} .hdr-meta-label {
|
|
9193
|
+
color: #6b7280;
|
|
9194
|
+
font-weight: 400;
|
|
9195
|
+
}
|
|
9196
|
+
|
|
9197
|
+
.${cls} .hdr-meta-value {
|
|
9198
|
+
color: #111827;
|
|
9199
|
+
font-weight: 600;
|
|
9200
|
+
}
|
|
9201
|
+
|
|
9202
|
+
.${cls} .hdr-select {
|
|
9203
|
+
height: 32px;
|
|
9204
|
+
padding: 0 8px;
|
|
9205
|
+
border: 1px solid #d1d5db;
|
|
9206
|
+
border-radius: 6px;
|
|
9207
|
+
font-size: 0.875rem;
|
|
9208
|
+
font-family: Roboto, sans-serif;
|
|
9209
|
+
background: #fff;
|
|
9210
|
+
min-width: 140px;
|
|
9211
|
+
color: #374151;
|
|
9212
|
+
}
|
|
9213
|
+
.${cls} .hdr-select:focus {
|
|
9214
|
+
outline: none;
|
|
9215
|
+
border-color: #ED7C22;
|
|
9216
|
+
box-shadow: 0 0 0 2px rgba(237, 124, 34, 0.15);
|
|
9217
|
+
}
|
|
9218
|
+
|
|
9219
|
+
.${cls} .hdr-input {
|
|
9220
|
+
height: 32px;
|
|
9221
|
+
padding: 0 8px;
|
|
9222
|
+
border: 1px solid #d1d5db;
|
|
9223
|
+
border-radius: 6px;
|
|
9224
|
+
font-size: 0.875rem;
|
|
9225
|
+
font-family: Roboto, sans-serif;
|
|
9226
|
+
background: #fff;
|
|
9227
|
+
min-width: 140px;
|
|
9228
|
+
color: #374151;
|
|
9229
|
+
}
|
|
9230
|
+
.${cls} .hdr-input:focus {
|
|
9231
|
+
outline: none;
|
|
9232
|
+
border-color: #ED7C22;
|
|
9233
|
+
box-shadow: 0 0 0 2px rgba(237, 124, 34, 0.15);
|
|
9234
|
+
}
|
|
9235
|
+
|
|
9236
|
+
@media (max-width: 768px) {
|
|
9237
|
+
.${cls} {
|
|
9238
|
+
flex-direction: column;
|
|
9239
|
+
}
|
|
9240
|
+
.${cls} .hdr-right {
|
|
9241
|
+
min-width: 0;
|
|
9242
|
+
}
|
|
9243
|
+
}
|
|
9244
|
+
` }), jsxRuntimeExports.jsxs("div", { className: cls, children: [jsxRuntimeExports.jsxs("div", { className: "hdr-left", children: [jsxRuntimeExports.jsxs("div", { children: [imageUrl ? (jsxRuntimeExports.jsx("img", { src: imageUrl, alt: displayName || 'Profile', className: "hdr-avatar", onError: (e) => {
|
|
9245
|
+
e.target.style.display = 'none';
|
|
9246
|
+
const placeholder = e.target
|
|
9247
|
+
.parentElement?.querySelector('.hdr-avatar-placeholder');
|
|
9248
|
+
if (placeholder)
|
|
9249
|
+
placeholder.style.display = 'flex';
|
|
9250
|
+
} })) : null, jsxRuntimeExports.jsx("div", { className: "hdr-avatar-placeholder", style: { display: imageUrl ? 'none' : 'flex' }, children: jsxRuntimeExports.jsx("img", { src: img$f, alt: "Profile Placeholder" }) })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-info", children: [displayName && jsxRuntimeExports.jsx("div", { className: "hdr-name", children: displayName }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsx(Dot, { color: "#9CA3AF" }), jsxRuntimeExports.jsxs("span", { className: "hdr-field-label", children: [translateConfig('Functional Record ID') || 'Functional Record ID', " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: functionalId || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsx(Dot, { color: isReadonly ? statusColor : '#F59E0B' }), jsxRuntimeExports.jsx("span", { className: "hdr-field-label", children: translateConfig('Record Status') || 'Record Status' }), isReadonly ? (statusLabel ? (jsxRuntimeExports.jsx("span", { className: "hdr-status-badge", style: { backgroundColor: statusColor }, children: statusLabel })) : (jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: "-" }))) : (jsxRuntimeExports.jsxs("select", { className: "hdr-select", value: statusValue, onChange: (e) => updateFieldValue('status', e.target.value), children: [jsxRuntimeExports.jsx("option", { value: "", children: translateConfig('Select') || 'Select' }), statusOptions.map((opt) => (jsxRuntimeExports.jsx("option", { value: opt.value, children: opt.label }, opt.value)))] }))] }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsx(Dot, { color: isReadonly ? '#9CA3AF' : '#F59E0B' }), jsxRuntimeExports.jsxs("span", { className: "hdr-field-label", children: [translateConfig('Status Reason') || 'Status Reason', " :"] }), isReadonly ? (jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: statusReason || '-' })) : (jsxRuntimeExports.jsx("input", { type: "text", className: "hdr-input", value: statusReason, placeholder: translateConfig('Enter Reason') || 'Enter Reason', onChange: (e) => updateFieldValue('statusReason', e.target.value) }))] })] })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-right", children: [jsxRuntimeExports.jsxs("div", { className: "hdr-meta-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-meta-label", children: [translateConfig('Created by') || 'Created by', " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: createdBy || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-meta-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-meta-label", children: [translateConfig('Created at') || 'Created at', " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: createdAt || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-meta-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-meta-label", children: [translateConfig('Last Approved by') || 'Last Approved by', " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: lastApprovedBy || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-meta-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-meta-label", children: [translateConfig('Last Approved at') || 'Last Approved at', " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: lastApprovedAt || '-' })] })] })] })] }));
|
|
9251
|
+
};
|
|
9252
|
+
|
|
8885
9253
|
/**
|
|
8886
9254
|
* Register all default/generic widgets
|
|
8887
9255
|
* This is called automatically when the package is imported
|
|
@@ -8921,6 +9289,8 @@ const registerDefaultWidgets = () => {
|
|
|
8921
9289
|
widgetRegistry.register({ widget: 'display', component: DisplayWidget });
|
|
8922
9290
|
// Profile widget for displaying user identity (image, name, ID)
|
|
8923
9291
|
widgetRegistry.register({ widget: 'profile', component: ProfileWidget });
|
|
9292
|
+
// Header section widget for full-width registry header with profile, status, and metadata
|
|
9293
|
+
widgetRegistry.register({ widget: 'header-section', component: HeaderSectionWidget });
|
|
8924
9294
|
};
|
|
8925
9295
|
// Auto-register on import
|
|
8926
9296
|
registerDefaultWidgets();
|
|
@@ -9277,5 +9647,5 @@ const translateUISchema = (schema, translate) => {
|
|
|
9277
9647
|
};
|
|
9278
9648
|
};
|
|
9279
9649
|
|
|
9280
|
-
export { ArrayWidget, BooleanWidget, CheckboxWidget, CurrencyInputWidget, DateInputWidget, DateTimeInputWidget, DisplayWidget, FileInputWidget, IterableAccordionWidget, JSONEditorPanel, NumberInputWidget, PanelRenderer, PhoneInputWidget, ProfileWidget, PropertyEditor, RadioWidget, SectionBuilder, SectionRenderer, SectionTree, SectionsContainer, SelectWidget, SimpleTableWidget, TableWidget, TextAreaWidget, TextInputWidget, VisualBuilderPanel, WidgetEventBus, WidgetProvider, WidgetRenderer, applyCaseControl, applyDecimalPrecision, applyMask, createWidgetStore, createZodSchema, evaluateCondition, filterByCharacterType, formatCurrency, formatDate, formatNumber, formatPhone, formatValue, geoHierarchyBuilder, getApiDataSource, getFormattedNumberLength, getSchemaDataSource, getStaticDataSource, getValueByPath, getWidgetValue, initI18n, isAllowedKey, parseDataPath, parseNumber, registerDefaultWidgets, removeMask, resetAll, resetWidget, setDataSource, setError, setLoading, setTouched, setValue, setValueByPath, setValues, setWidgetValue, shouldEnableWidget, shouldShowWidget, transformDataSourceOptions, translatePanelConfig, translateUISchema, translateWidgetConfig, useBaseWidget, useGeoWidgetCascade, useWidgetCascade, useWidgetContext, useWidgetEventBus, useWidgetTranslation, validateNumericValue, validateWidget, widgetRegistry };
|
|
9650
|
+
export { ArrayWidget, BooleanWidget, CheckboxWidget, CurrencyInputWidget, DateInputWidget, DateTimeInputWidget, DisplayWidget, FileInputWidget, HeaderSectionWidget, IterableAccordionWidget, JSONEditorPanel, NumberInputWidget, PanelRenderer, PhoneInputWidget, ProfileWidget, PropertyEditor, RadioWidget, SectionBuilder, SectionRenderer, SectionTree, SectionsContainer, SelectWidget, SimpleTableWidget, TableWidget, TextAreaWidget, TextInputWidget, VisualBuilderPanel, WidgetEventBus, WidgetProvider, WidgetRenderer, applyCaseControl, applyDecimalPrecision, applyMask, createWidgetStore, createZodSchema, evaluateCondition, filterByCharacterType, formatCurrency, formatDate, formatNumber, formatPhone, formatValue, geoHierarchyBuilder, getApiDataSource, getFormattedNumberLength, getSchemaDataSource, getStaticDataSource, getValueByPath, getWidgetValue, initI18n, isAllowedKey, parseDataPath, parseNumber, registerDefaultWidgets, removeMask, resetAll, resetWidget, setDataSource, setError, setLoading, setTouched, setValue, setValueByPath, setValues, setWidgetValue, shouldEnableWidget, shouldShowWidget, transformDataSourceOptions, translatePanelConfig, translateUISchema, translateWidgetConfig, useBaseWidget, useGeoWidgetCascade, useWidgetCascade, useWidgetContext, useWidgetEventBus, useWidgetTranslation, validateNumericValue, validateWidget, widgetRegistry };
|
|
9281
9651
|
//# sourceMappingURL=index.esm.js.map
|