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