@openg2p/registry-widgets 1.0.1 → 1.1.0-dev.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/README.md +52 -1
- package/dist/components/SectionBuilder/schemas.d.ts +4 -0
- package/dist/components/SectionBuilder/schemas.d.ts.map +1 -1
- package/dist/components/SectionRenderer.d.ts.map +1 -1
- package/dist/components/SectionsContainer.d.ts.map +1 -1
- package/dist/components/WidgetProvider.d.ts +4 -1
- package/dist/components/WidgetProvider.d.ts.map +1 -1
- package/dist/index.d.ts +168 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +700 -188
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +703 -187
- package/dist/index.js.map +1 -1
- package/dist/registry/defaultWidgets.d.ts.map +1 -1
- package/dist/theme/index.d.ts +35 -9
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/widgets/HeaderSectionWidget.d.ts.map +1 -1
- package/dist/widgets/ProfileWidget.d.ts +2 -2
- package/dist/widgets/ScoresDisplayWidget.d.ts +32 -0
- package/dist/widgets/ScoresDisplayWidget.d.ts.map +1 -0
- package/dist/widgets/TableWidget.d.ts.map +1 -1
- package/dist/widgets/index.d.ts +1 -0
- package/dist/widgets/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1675,6 +1675,158 @@ class WidgetEventBus {
|
|
|
1675
1675
|
}
|
|
1676
1676
|
}
|
|
1677
1677
|
|
|
1678
|
+
/**
|
|
1679
|
+
* Built-in default values (matches the original hardcoded colours).
|
|
1680
|
+
*/
|
|
1681
|
+
const defaultTheme = {
|
|
1682
|
+
colors: {
|
|
1683
|
+
primary: '#F5BB1A',
|
|
1684
|
+
primaryDark: '#F07B1A',
|
|
1685
|
+
primaryLight: '#FBE6AA',
|
|
1686
|
+
primaryAccent: '#EE7C22',
|
|
1687
|
+
border: '#C4C4C4',
|
|
1688
|
+
borderLight: '#E4E4E4',
|
|
1689
|
+
background: '#FFFFFF',
|
|
1690
|
+
backgroundAlt: '#F6F6F6',
|
|
1691
|
+
text: '#011627',
|
|
1692
|
+
textMuted: '#727474',
|
|
1693
|
+
success: '#16A34A',
|
|
1694
|
+
successDark: '#047857',
|
|
1695
|
+
successLight: '#D1FAE5',
|
|
1696
|
+
error: '#B91C1C',
|
|
1697
|
+
errorLight: '#FEE2E2',
|
|
1698
|
+
warning: '#F59E0B',
|
|
1699
|
+
info: '#2563EB',
|
|
1700
|
+
},
|
|
1701
|
+
section: {
|
|
1702
|
+
borderRadius: '8px',
|
|
1703
|
+
borderColor: '#E4E4E4',
|
|
1704
|
+
backgroundColor: '#FFFFFF',
|
|
1705
|
+
titleColor: '#011627',
|
|
1706
|
+
dividerColor: '#F5BB1A',
|
|
1707
|
+
},
|
|
1708
|
+
panel: {
|
|
1709
|
+
dividerColor: '#C4C4C4',
|
|
1710
|
+
backgroundColor: 'transparent',
|
|
1711
|
+
},
|
|
1712
|
+
button: {
|
|
1713
|
+
primaryBg: '#FFFFFF',
|
|
1714
|
+
primaryColor: '#011627',
|
|
1715
|
+
primaryBorder: '#F07B1A',
|
|
1716
|
+
secondaryBg: '#FFFFFF',
|
|
1717
|
+
secondaryColor: '#011627',
|
|
1718
|
+
secondaryBorder: '#C4C4C4',
|
|
1719
|
+
borderRadius: '6px',
|
|
1720
|
+
},
|
|
1721
|
+
widget: {
|
|
1722
|
+
labelColor: '#011627',
|
|
1723
|
+
inputBorderColor: '#C4C4C4',
|
|
1724
|
+
inputFocusBorderColor: '#F5BB1A',
|
|
1725
|
+
inputBackground: '#FFFFFF',
|
|
1726
|
+
errorColor: '#B91C1C',
|
|
1727
|
+
helpTextColor: '#727474',
|
|
1728
|
+
tableHeaderBg: '#F6F6F6',
|
|
1729
|
+
tableHeaderColor: '#727474',
|
|
1730
|
+
tableBodyBg: '#FFFFFF',
|
|
1731
|
+
tableBorderColor: '#C4C4C4',
|
|
1732
|
+
tableRowDividerColor: '#E4E4E4',
|
|
1733
|
+
tableEditingRowBg: '#FBE6AA',
|
|
1734
|
+
tableDeletedRowBg: '#FEE2E2',
|
|
1735
|
+
tableEmptyTextColor: '#727474',
|
|
1736
|
+
tableBorderRadius: '15px',
|
|
1737
|
+
},
|
|
1738
|
+
};
|
|
1739
|
+
/**
|
|
1740
|
+
* Merge a user-supplied (partial) theme with the built-in defaults.
|
|
1741
|
+
*/
|
|
1742
|
+
function resolveTheme(theme) {
|
|
1743
|
+
if (!theme)
|
|
1744
|
+
return defaultTheme;
|
|
1745
|
+
return {
|
|
1746
|
+
colors: { ...defaultTheme.colors, ...theme.colors },
|
|
1747
|
+
section: { ...defaultTheme.section, ...theme.section },
|
|
1748
|
+
panel: { ...defaultTheme.panel, ...theme.panel },
|
|
1749
|
+
button: { ...defaultTheme.button, ...theme.button },
|
|
1750
|
+
widget: { ...defaultTheme.widget, ...theme.widget },
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Convert a resolved theme into a flat Record of CSS custom properties.
|
|
1755
|
+
* These are set on the provider wrapper element so every descendant can
|
|
1756
|
+
* reference them with `var(--owt-…)`.
|
|
1757
|
+
*
|
|
1758
|
+
* Prefix: `--owt-` (OpenG2P Widget Theme).
|
|
1759
|
+
*/
|
|
1760
|
+
function themeToCSSVariables(resolved) {
|
|
1761
|
+
return {
|
|
1762
|
+
// --- colors ---
|
|
1763
|
+
'--owt-color-primary': resolved.colors.primary,
|
|
1764
|
+
'--owt-color-primary-dark': resolved.colors.primaryDark,
|
|
1765
|
+
'--owt-color-primary-light': resolved.colors.primaryLight,
|
|
1766
|
+
'--owt-color-primary-accent': resolved.colors.primaryAccent,
|
|
1767
|
+
'--owt-color-border': resolved.colors.border,
|
|
1768
|
+
'--owt-color-border-light': resolved.colors.borderLight,
|
|
1769
|
+
'--owt-color-bg': resolved.colors.background,
|
|
1770
|
+
'--owt-color-bg-alt': resolved.colors.backgroundAlt,
|
|
1771
|
+
'--owt-color-text': resolved.colors.text,
|
|
1772
|
+
'--owt-color-text-muted': resolved.colors.textMuted,
|
|
1773
|
+
'--owt-color-success': resolved.colors.success,
|
|
1774
|
+
'--owt-color-success-dark': resolved.colors.successDark,
|
|
1775
|
+
'--owt-color-success-light': resolved.colors.successLight,
|
|
1776
|
+
'--owt-color-error': resolved.colors.error,
|
|
1777
|
+
'--owt-color-error-light': resolved.colors.errorLight,
|
|
1778
|
+
'--owt-color-warning': resolved.colors.warning,
|
|
1779
|
+
'--owt-color-info': resolved.colors.info,
|
|
1780
|
+
// --- section ---
|
|
1781
|
+
'--owt-section-border-radius': resolved.section.borderRadius,
|
|
1782
|
+
'--owt-section-border-color': resolved.section.borderColor,
|
|
1783
|
+
'--owt-section-bg': resolved.section.backgroundColor,
|
|
1784
|
+
'--owt-section-title-color': resolved.section.titleColor,
|
|
1785
|
+
'--owt-section-divider-color': resolved.section.dividerColor,
|
|
1786
|
+
// --- panel ---
|
|
1787
|
+
'--owt-panel-divider-color': resolved.panel.dividerColor,
|
|
1788
|
+
'--owt-panel-bg': resolved.panel.backgroundColor,
|
|
1789
|
+
// --- button ---
|
|
1790
|
+
'--owt-btn-primary-bg': resolved.button.primaryBg,
|
|
1791
|
+
'--owt-btn-primary-color': resolved.button.primaryColor,
|
|
1792
|
+
'--owt-btn-primary-border': resolved.button.primaryBorder,
|
|
1793
|
+
'--owt-btn-secondary-bg': resolved.button.secondaryBg,
|
|
1794
|
+
'--owt-btn-secondary-color': resolved.button.secondaryColor,
|
|
1795
|
+
'--owt-btn-secondary-border': resolved.button.secondaryBorder,
|
|
1796
|
+
'--owt-btn-border-radius': resolved.button.borderRadius,
|
|
1797
|
+
// --- widget ---
|
|
1798
|
+
'--owt-widget-label-color': resolved.widget.labelColor,
|
|
1799
|
+
'--owt-widget-input-border': resolved.widget.inputBorderColor,
|
|
1800
|
+
'--owt-widget-input-focus-border': resolved.widget.inputFocusBorderColor,
|
|
1801
|
+
'--owt-widget-input-bg': resolved.widget.inputBackground,
|
|
1802
|
+
'--owt-widget-error-color': resolved.widget.errorColor,
|
|
1803
|
+
'--owt-widget-helptext-color': resolved.widget.helpTextColor,
|
|
1804
|
+
// --- widget / table ---
|
|
1805
|
+
'--owt-widget-table-header-bg': resolved.widget.tableHeaderBg,
|
|
1806
|
+
'--owt-widget-table-header-color': resolved.widget.tableHeaderColor,
|
|
1807
|
+
'--owt-widget-table-body-bg': resolved.widget.tableBodyBg,
|
|
1808
|
+
'--owt-widget-table-border-color': resolved.widget.tableBorderColor,
|
|
1809
|
+
'--owt-widget-table-row-divider': resolved.widget.tableRowDividerColor,
|
|
1810
|
+
'--owt-widget-table-editing-row-bg': resolved.widget.tableEditingRowBg,
|
|
1811
|
+
'--owt-widget-table-deleted-row-bg': resolved.widget.tableDeletedRowBg,
|
|
1812
|
+
'--owt-widget-table-empty-color': resolved.widget.tableEmptyTextColor,
|
|
1813
|
+
'--owt-widget-table-border-radius': resolved.widget.tableBorderRadius,
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
const ThemeContext = createContext(defaultTheme);
|
|
1818
|
+
/**
|
|
1819
|
+
* Access the resolved widget theme from any component inside `<WidgetProvider>`.
|
|
1820
|
+
*
|
|
1821
|
+
* ```tsx
|
|
1822
|
+
* const theme = useWidgetTheme();
|
|
1823
|
+
* // theme.colors.primary, theme.section.dividerColor, etc.
|
|
1824
|
+
* ```
|
|
1825
|
+
*/
|
|
1826
|
+
function useWidgetTheme() {
|
|
1827
|
+
return useContext(ThemeContext);
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1678
1830
|
const WidgetContext = createContext({
|
|
1679
1831
|
dataSourceRequestHandler: undefined,
|
|
1680
1832
|
schemaData: undefined,
|
|
@@ -1683,10 +1835,13 @@ const WidgetContext = createContext({
|
|
|
1683
1835
|
const useWidgetContext = () => {
|
|
1684
1836
|
return useContext(WidgetContext);
|
|
1685
1837
|
};
|
|
1686
|
-
const WidgetProvider = ({ store, dataSourceRequestHandler, schemaData, translate, children, }) => {
|
|
1838
|
+
const WidgetProvider = ({ store, dataSourceRequestHandler, schemaData, translate, theme, children, }) => {
|
|
1687
1839
|
const widgetStore = useMemo(() => store || createWidgetStore(), [store]);
|
|
1688
1840
|
// Create event bus instance (one per provider)
|
|
1689
1841
|
const eventBus = useMemo(() => new WidgetEventBus(), []);
|
|
1842
|
+
// Resolve theme: merge user-supplied overrides with defaults
|
|
1843
|
+
const resolvedTheme = useMemo(() => resolveTheme(theme), [theme]);
|
|
1844
|
+
const cssVariables = useMemo(() => themeToCSSVariables(resolvedTheme), [resolvedTheme]);
|
|
1690
1845
|
// Memoize context value to prevent unnecessary re-renders
|
|
1691
1846
|
const contextValue = useMemo(() => ({
|
|
1692
1847
|
dataSourceRequestHandler,
|
|
@@ -1715,7 +1870,7 @@ const WidgetProvider = ({ store, dataSourceRequestHandler, schemaData, translate
|
|
|
1715
1870
|
}
|
|
1716
1871
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1717
1872
|
}, [schemaData, widgetStore]); // Only run on mount
|
|
1718
|
-
const content = (jsxRuntimeExports.jsx(Provider, { store: widgetStore, children: jsxRuntimeExports.jsx(WidgetContext.Provider, { value: contextValue, children: jsxRuntimeExports.jsx(WidgetEventBusContext.Provider, { value: eventBus, children: children }) }) }));
|
|
1873
|
+
const content = (jsxRuntimeExports.jsx(Provider, { store: widgetStore, children: jsxRuntimeExports.jsx(ThemeContext.Provider, { value: resolvedTheme, children: jsxRuntimeExports.jsx(WidgetContext.Provider, { value: contextValue, children: jsxRuntimeExports.jsx(WidgetEventBusContext.Provider, { value: eventBus, children: jsxRuntimeExports.jsx("div", { className: "openg2p-widget-theme-root", style: cssVariables, children: children }) }) }) }) }));
|
|
1719
1874
|
return content;
|
|
1720
1875
|
};
|
|
1721
1876
|
|
|
@@ -2735,7 +2890,7 @@ const PanelRenderer = ({ panel, dataSourceRequestHandler, schemaData, onValueCha
|
|
|
2735
2890
|
top: 0,
|
|
2736
2891
|
bottom: '5px',
|
|
2737
2892
|
width: '1px',
|
|
2738
|
-
backgroundColor: isEditMode ? '#
|
|
2893
|
+
backgroundColor: isEditMode ? 'var(--owt-color-primary, #F5BB1A)' : 'var(--owt-panel-divider-color, #C4C4C4)',
|
|
2739
2894
|
} }))] }) }, nestedPanel['panel-id'] || `panel-${index}`));
|
|
2740
2895
|
}), widgets.map((widgetConfig, index) => {
|
|
2741
2896
|
// Don't use readonly state in key - it causes remounting which resets userHasSetValueRef
|
|
@@ -3297,10 +3452,10 @@ const FileInputWidget = ({ config }) => {
|
|
|
3297
3452
|
return (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [fileIconElement, jsxRuntimeExports.jsx("button", { type: "button", onClick: (e) => {
|
|
3298
3453
|
console.log('Button clicked!', file);
|
|
3299
3454
|
handleFileClick(file, e);
|
|
3300
|
-
}, className: "text-sm hover:underline focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded cursor-pointer", style: { color: isSupportingDocument ? '#
|
|
3455
|
+
}, className: "text-sm hover:underline focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded cursor-pointer", style: { color: isSupportingDocument ? 'var(--owt-color-text, #011627)' : 'var(--owt-color-info, #2563eb)' }, title: "Click to preview", children: fileName })] }));
|
|
3301
3456
|
}
|
|
3302
3457
|
else {
|
|
3303
|
-
return (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [fileIconElement, jsxRuntimeExports.jsx("span", { className: "text-sm", style: { color: isSupportingDocument ? '#
|
|
3458
|
+
return (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [fileIconElement, jsxRuntimeExports.jsx("span", { className: "text-sm", style: { color: isSupportingDocument ? 'var(--owt-color-text, #011627)' : '#4b5563' }, children: fileName })] }));
|
|
3304
3459
|
}
|
|
3305
3460
|
}
|
|
3306
3461
|
else {
|
|
@@ -3316,10 +3471,10 @@ const FileInputWidget = ({ config }) => {
|
|
|
3316
3471
|
flexShrink: 0
|
|
3317
3472
|
} }));
|
|
3318
3473
|
if (canPreview) {
|
|
3319
|
-
return (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [fileIconElement, jsxRuntimeExports.jsx("button", { type: "button", onClick: (e) => handleFileClick(file, e), className: "text-sm hover:underline focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded cursor-pointer", style: { color: isSupportingDocument ? '#
|
|
3474
|
+
return (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [fileIconElement, jsxRuntimeExports.jsx("button", { type: "button", onClick: (e) => handleFileClick(file, e), className: "text-sm hover:underline focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded cursor-pointer", style: { color: isSupportingDocument ? 'var(--owt-color-text, #011627)' : 'var(--owt-color-info, #2563eb)' }, title: "Click to preview", children: fileName })] }, index));
|
|
3320
3475
|
}
|
|
3321
3476
|
else {
|
|
3322
|
-
return (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [fileIconElement, jsxRuntimeExports.jsx("span", { className: "text-sm", style: { color: isSupportingDocument ? '#
|
|
3477
|
+
return (jsxRuntimeExports.jsxs("div", { style: { display: 'flex', alignItems: 'center' }, children: [fileIconElement, jsxRuntimeExports.jsx("span", { className: "text-sm", style: { color: isSupportingDocument ? 'var(--owt-color-text, #011627)' : '#4b5563' }, children: fileName })] }, index));
|
|
3323
3478
|
}
|
|
3324
3479
|
}) }));
|
|
3325
3480
|
}
|
|
@@ -3525,6 +3680,8 @@ const sectionValidate = (section, currentSchemaData, dispatch) => {
|
|
|
3525
3680
|
*/
|
|
3526
3681
|
const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequestHandler, schemaData, onValueChange, gridColumnSpan, onSectionSave, hideEditButton = false, mode = 'RegistryView', namespace, changeRequestType, showChangeRequestLabel = true, dbSectionId, sectionRegisterId, onSectionDirtyChange, sectionIndex, sectionCount, expandedSectionIndex, onExpandSection, onSectionSaveSuccess, onPreviousSection, isDraft, onEditModeChange, forceExitEdit, }) => {
|
|
3527
3682
|
const { translateConfig, translate } = useWidgetTranslation();
|
|
3683
|
+
const resolvedTheme = useWidgetTheme();
|
|
3684
|
+
const portalCSSVariables = useMemo(() => themeToCSSVariables(resolvedTheme), [resolvedTheme]);
|
|
3528
3685
|
const { schemaData: contextSchemaData, dataSourceRequestHandler: contextDataSourceRequestHandler } = useWidgetContext();
|
|
3529
3686
|
const store = useStore();
|
|
3530
3687
|
const dispatch = useDispatch();
|
|
@@ -3541,22 +3698,41 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3541
3698
|
}
|
|
3542
3699
|
return section;
|
|
3543
3700
|
}, [section, namespace]);
|
|
3544
|
-
// Create namespaced schemaData if namespace is provided
|
|
3545
|
-
//
|
|
3546
|
-
// need a nested object at values[namespace] so getValueByPath can traverse it.
|
|
3701
|
+
// Create namespaced schemaData if namespace is provided
|
|
3702
|
+
// This ensures widgets can read initial values from schemaData at namespaced paths
|
|
3547
3703
|
const namespacedSchemaData = useMemo(() => {
|
|
3548
3704
|
if (!namespace || !currentSchemaData) {
|
|
3549
3705
|
return schemaData;
|
|
3550
3706
|
}
|
|
3551
|
-
|
|
3707
|
+
// Create a namespaced version of schemaData by copying values to namespaced paths
|
|
3708
|
+
const namespaced = { ...currentSchemaData };
|
|
3709
|
+
// Copy all top-level keys to namespaced paths
|
|
3710
|
+
Object.keys(currentSchemaData).forEach(key => {
|
|
3711
|
+
const namespacedKey = `${namespace}.${key}`;
|
|
3712
|
+
if (!(namespacedKey in namespaced)) {
|
|
3713
|
+
namespaced[namespacedKey] = currentSchemaData[key];
|
|
3714
|
+
}
|
|
3715
|
+
});
|
|
3716
|
+
// Also handle nested objects - copy nested values to namespaced paths
|
|
3717
|
+
const copyNestedValues = (obj, prefix = '') => {
|
|
3718
|
+
if (obj && typeof obj === 'object' && !Array.isArray(obj)) {
|
|
3719
|
+
Object.keys(obj).forEach(key => {
|
|
3720
|
+
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
3721
|
+
const namespacedPath = `${namespace}.${fullPath}`;
|
|
3722
|
+
if (typeof obj[key] === 'object' && obj[key] !== null && !Array.isArray(obj[key])) {
|
|
3723
|
+
copyNestedValues(obj[key], fullPath);
|
|
3724
|
+
// Also set the nested object at the namespaced path
|
|
3725
|
+
setValueByPath(namespaced, namespacedPath, obj[key]);
|
|
3726
|
+
}
|
|
3727
|
+
else {
|
|
3728
|
+
setValueByPath(namespaced, namespacedPath, obj[key]);
|
|
3729
|
+
}
|
|
3730
|
+
});
|
|
3731
|
+
}
|
|
3732
|
+
};
|
|
3733
|
+
copyNestedValues(currentSchemaData);
|
|
3734
|
+
return namespaced;
|
|
3552
3735
|
}, [namespace, schemaData, currentSchemaData]);
|
|
3553
|
-
// Populate the store with namespaced schema data so that namespaced widgets
|
|
3554
|
-
// can read their initial values via getValueByPath on the namespaced paths.
|
|
3555
|
-
useEffect(() => {
|
|
3556
|
-
if (namespace && namespacedSchemaData) {
|
|
3557
|
-
dispatch(setValues(namespacedSchemaData));
|
|
3558
|
-
}
|
|
3559
|
-
}, [namespace, namespacedSchemaData, dispatch]);
|
|
3560
3736
|
const crViewData = useMemo(() => {
|
|
3561
3737
|
if (mode !== 'CRView')
|
|
3562
3738
|
return null;
|
|
@@ -3802,9 +3978,10 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3802
3978
|
top: 0;
|
|
3803
3979
|
bottom: 5px;
|
|
3804
3980
|
width: 1px;
|
|
3805
|
-
background-color: #
|
|
3981
|
+
background-color: var(--owt-color-primary, #F5BB1A);
|
|
3806
3982
|
}
|
|
3807
3983
|
` }), jsxRuntimeExports.jsxs("div", { className: `section ${sectionClassId} ${sectionClassId}-edit px-4 sm:px-6 lg:px-8`, "data-section-id": `${sectionId}-edit`, style: {
|
|
3984
|
+
...portalCSSVariables,
|
|
3808
3985
|
position: 'absolute',
|
|
3809
3986
|
top: `${editSectionPosition.top}px`,
|
|
3810
3987
|
left: `${editSectionPosition.left}px`,
|
|
@@ -3814,10 +3991,22 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3814
3991
|
}, 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) => {
|
|
3815
3992
|
const isLastPanel = index === editableSection.panels.length - 1;
|
|
3816
3993
|
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}`));
|
|
3817
|
-
}), jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', backgroundColor: '#
|
|
3994
|
+
}), jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', backgroundColor: 'var(--owt-section-divider-color, #F5BB1A)', 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) => {
|
|
3818
3995
|
const docConfig = createDocumentWidgetConfig(doc, sectionId, index);
|
|
3819
3996
|
return (jsxRuntimeExports.jsx("div", { className: "supporting-document-item", children: jsxRuntimeExports.jsx(FileInputWidget, { config: docConfig }) }, `${sectionId}-doc-${index}`));
|
|
3820
|
-
}) }))] }) })), jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', backgroundColor: '#
|
|
3997
|
+
}) }))] }) })), jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', backgroundColor: 'var(--owt-section-divider-color, #F5BB1A)', 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: "text-sm font-medium px-6 py-2 transition-colors", style: {
|
|
3998
|
+
fontFamily: 'Roboto, sans-serif',
|
|
3999
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
4000
|
+
border: '1px solid var(--owt-btn-secondary-border, #C4C4C4)',
|
|
4001
|
+
backgroundColor: 'var(--owt-btn-secondary-bg, #FFFFFF)',
|
|
4002
|
+
color: 'var(--owt-btn-secondary-color, #011627)',
|
|
4003
|
+
}, children: translate('common.cancel') || 'Cancel' }), jsxRuntimeExports.jsx("button", { onClick: handleSave, disabled: !isDirty, className: "text-sm font-medium px-6 py-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed", style: {
|
|
4004
|
+
fontFamily: 'Roboto, sans-serif',
|
|
4005
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
4006
|
+
border: '1px solid var(--owt-btn-primary-border, #F07B1A)',
|
|
4007
|
+
backgroundColor: 'var(--owt-color-primary, #F5BB1A)',
|
|
4008
|
+
color: 'var(--owt-color-bg, #FFFFFF)',
|
|
4009
|
+
}, children: translate('common.save') || 'Save' })] }) })] })] })] }), document.body);
|
|
3821
4010
|
};
|
|
3822
4011
|
const trackSectionChages = (widgets, sourceData, pathPrefix) => {
|
|
3823
4012
|
if (!widgets || widgets.length === 0)
|
|
@@ -3918,8 +4107,6 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3918
4107
|
const baselineSnapshotRef = useRef(null);
|
|
3919
4108
|
// IntakeForm only: increment when baseline is updated after save - forces badge to update (refs don't trigger re-renders)
|
|
3920
4109
|
const [intakeFormBaselineTrigger, setIntakeFormBaselineTrigger] = useState(0);
|
|
3921
|
-
// IntakeForm only: tracks whether the user has actually saved this section (prevents "Saved" badge on initial load)
|
|
3922
|
-
const [hasBeenSavedByUser, setHasBeenSavedByUser] = useState(false);
|
|
3923
4110
|
// IntakeForm: treat as edit mode for dirty tracking when isDraft. RegistryView: use isEditMode.
|
|
3924
4111
|
const effectiveEditModeForDirty = mode === 'IntakeForm' ? (isDraft !== false) : isEditMode;
|
|
3925
4112
|
// Compute isDirty: compare current store state to baseline (only when in edit mode)
|
|
@@ -3962,68 +4149,18 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
3962
4149
|
const intakeFormSectionStatus = useMemo(() => {
|
|
3963
4150
|
if (mode !== 'IntakeForm' || isDraft === false)
|
|
3964
4151
|
return null;
|
|
4152
|
+
const hasValue = (v) => v !== undefined && v !== null && (typeof v !== 'string' || v.trim().length > 0);
|
|
4153
|
+
const currentSnapshot = buildSectionSnapshot(storeValues, namespace);
|
|
4154
|
+
const record = currentSnapshot.records?.[0];
|
|
4155
|
+
const hasData = record &&
|
|
4156
|
+
typeof record === 'object' &&
|
|
4157
|
+
Object.values(record).some((v) => hasValue(v));
|
|
3965
4158
|
if (isDirty)
|
|
3966
4159
|
return 'modified';
|
|
3967
|
-
if (
|
|
4160
|
+
if (hasData)
|
|
3968
4161
|
return 'saved';
|
|
3969
4162
|
return null;
|
|
3970
|
-
}, [mode, isDirty,
|
|
3971
|
-
// Revert store values to the original schemaData for this section's widgets.
|
|
3972
|
-
// Used by both handleSave (RegistryView raises a CR, so values should not persist)
|
|
3973
|
-
// and handleCancel.
|
|
3974
|
-
const revertToOriginalValues = useCallback(() => {
|
|
3975
|
-
const sectionWidgets = collectWidgets(originalSection.panels);
|
|
3976
|
-
const oldSchemaData = schemaData || contextSchemaData;
|
|
3977
|
-
const currentStoreValues = store.getState().widget.values;
|
|
3978
|
-
let newStoreValues = currentStoreValues;
|
|
3979
|
-
sectionWidgets.forEach(widget => {
|
|
3980
|
-
const originalWidgetId = widget['widget-id'];
|
|
3981
|
-
const namespacedWidgetId = namespace ? `${namespace}__${originalWidgetId}` : originalWidgetId;
|
|
3982
|
-
const widgetId = namespacedWidgetId;
|
|
3983
|
-
const originalDataPath = widget['widget-data-path'];
|
|
3984
|
-
const storeDataPath = namespace && originalDataPath
|
|
3985
|
-
? (typeof originalDataPath === 'string'
|
|
3986
|
-
? `${namespace}.${originalDataPath}`
|
|
3987
|
-
: Object.fromEntries(Object.entries(originalDataPath).map(([key, path]) => [key, `${namespace}.${path}`])))
|
|
3988
|
-
: originalDataPath;
|
|
3989
|
-
if (widgetId && originalDataPath) {
|
|
3990
|
-
let oldValue;
|
|
3991
|
-
if (typeof originalDataPath === 'object') {
|
|
3992
|
-
oldValue = {};
|
|
3993
|
-
Object.entries(originalDataPath).forEach(([key, path]) => {
|
|
3994
|
-
if (typeof path === 'string') {
|
|
3995
|
-
oldValue[key] = getValueByPath(oldSchemaData, path);
|
|
3996
|
-
}
|
|
3997
|
-
});
|
|
3998
|
-
}
|
|
3999
|
-
else if (typeof originalDataPath === 'string') {
|
|
4000
|
-
oldValue = getValueByPath(oldSchemaData, originalDataPath);
|
|
4001
|
-
}
|
|
4002
|
-
if (oldValue !== undefined) {
|
|
4003
|
-
newStoreValues = setWidgetValue(newStoreValues, storeDataPath, widgetId, oldValue);
|
|
4004
|
-
// Also revert the widgetId-based entry — useBaseWidget.handleChange
|
|
4005
|
-
// sets values[widgetId] during editing, and useBaseWidget.currentValue
|
|
4006
|
-
// reads values[widgetId] first before falling through to the dataPath.
|
|
4007
|
-
newStoreValues = { ...newStoreValues, [widgetId]: oldValue };
|
|
4008
|
-
}
|
|
4009
|
-
}
|
|
4010
|
-
});
|
|
4011
|
-
if (hasSupportingDocuments) {
|
|
4012
|
-
const originalSupportingDocuments = originalSection['section-supporting-documents'] || [];
|
|
4013
|
-
originalSupportingDocuments.forEach((doc, index) => {
|
|
4014
|
-
const widgetId = `supporting-doc-${sectionId}-${index}`;
|
|
4015
|
-
const originalDataPath = doc['document-data-path'];
|
|
4016
|
-
const storeDataPath = namespace && originalDataPath
|
|
4017
|
-
? `${namespace}.${originalDataPath}`
|
|
4018
|
-
: originalDataPath;
|
|
4019
|
-
const oldValue = getValueByPath(oldSchemaData, originalDataPath);
|
|
4020
|
-
newStoreValues = setWidgetValue(newStoreValues, storeDataPath, widgetId, oldValue);
|
|
4021
|
-
});
|
|
4022
|
-
}
|
|
4023
|
-
if (newStoreValues !== currentStoreValues) {
|
|
4024
|
-
dispatch(setValues(newStoreValues));
|
|
4025
|
-
}
|
|
4026
|
-
}, [originalSection, schemaData, contextSchemaData, store, namespace, hasSupportingDocuments, sectionId, dispatch]);
|
|
4163
|
+
}, [mode, isDirty, storeValues, namespace, buildSectionSnapshot]);
|
|
4027
4164
|
// Handle save button click
|
|
4028
4165
|
const handleSave = async () => {
|
|
4029
4166
|
if (!store || !onSectionSave) {
|
|
@@ -4073,12 +4210,6 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4073
4210
|
console.error('Section Changes Save failed', error);
|
|
4074
4211
|
}
|
|
4075
4212
|
}
|
|
4076
|
-
// In RegistryView, save raises a CR — the actual data update follows a
|
|
4077
|
-
// separate approval workflow, so revert the displayed values to the
|
|
4078
|
-
// originals so the view doesn't show unapproved edits.
|
|
4079
|
-
if (mode === 'RegistryView') {
|
|
4080
|
-
revertToOriginalValues();
|
|
4081
|
-
}
|
|
4082
4213
|
setIsEditMode(false);
|
|
4083
4214
|
onEditModeChange?.(originalSectionId, false);
|
|
4084
4215
|
};
|
|
@@ -4124,7 +4255,6 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4124
4255
|
if (mode === 'IntakeForm') {
|
|
4125
4256
|
baselineSnapshotRef.current = buildSectionSnapshot(currentSchemaData, namespace);
|
|
4126
4257
|
setIntakeFormBaselineTrigger((prev) => prev + 1);
|
|
4127
|
-
setHasBeenSavedByUser(true);
|
|
4128
4258
|
}
|
|
4129
4259
|
onSectionDirtyChange?.(sectionId, false);
|
|
4130
4260
|
}
|
|
@@ -4133,7 +4263,64 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4133
4263
|
}, [store, onSectionSave, onSectionSaveSuccess, sectionIndex, originalSection, schemaData, contextSchemaData, namespace, hasSupportingDocuments, dbSectionId, sectionRegisterId, dispatch, buildSectionSnapshot, sectionId, onSectionDirtyChange, mode, isDraft]);
|
|
4134
4264
|
// Handle cancel button click
|
|
4135
4265
|
const handleCancel = () => {
|
|
4136
|
-
|
|
4266
|
+
// Revert values in store to original schema data
|
|
4267
|
+
// Use original section (without namespace) for collecting widgets
|
|
4268
|
+
const sectionWidgets = collectWidgets(originalSection.panels);
|
|
4269
|
+
const oldSchemaData = schemaData || contextSchemaData;
|
|
4270
|
+
const currentStoreValues = store.getState().widget.values;
|
|
4271
|
+
let newStoreValues = currentStoreValues;
|
|
4272
|
+
sectionWidgets.forEach(widget => {
|
|
4273
|
+
const originalWidgetId = widget['widget-id'];
|
|
4274
|
+
// If namespace was used, we need to use namespaced widget ID and data path
|
|
4275
|
+
const namespacedWidgetId = namespace ? `${namespace}__${originalWidgetId}` : originalWidgetId;
|
|
4276
|
+
const widgetId = namespacedWidgetId;
|
|
4277
|
+
const originalDataPath = widget['widget-data-path'];
|
|
4278
|
+
// If namespace was used, data path in store is namespaced, but we read from original schema using original path
|
|
4279
|
+
const storeDataPath = namespace && originalDataPath
|
|
4280
|
+
? (typeof originalDataPath === 'string'
|
|
4281
|
+
? `${namespace}.${originalDataPath}`
|
|
4282
|
+
: Object.fromEntries(Object.entries(originalDataPath).map(([key, path]) => [key, `${namespace}.${path}`])))
|
|
4283
|
+
: originalDataPath;
|
|
4284
|
+
if (widgetId && originalDataPath) {
|
|
4285
|
+
// Handle multi-path (object) or single path (string)
|
|
4286
|
+
// Read from original schema data using original paths
|
|
4287
|
+
let oldValue;
|
|
4288
|
+
if (typeof originalDataPath === 'object') {
|
|
4289
|
+
// Multi-path: get values for each path
|
|
4290
|
+
oldValue = {};
|
|
4291
|
+
Object.entries(originalDataPath).forEach(([key, path]) => {
|
|
4292
|
+
if (typeof path === 'string') {
|
|
4293
|
+
oldValue[key] = getValueByPath(oldSchemaData, path);
|
|
4294
|
+
}
|
|
4295
|
+
});
|
|
4296
|
+
}
|
|
4297
|
+
else if (typeof originalDataPath === 'string') {
|
|
4298
|
+
oldValue = getValueByPath(oldSchemaData, originalDataPath);
|
|
4299
|
+
}
|
|
4300
|
+
// Set in store using namespaced data path (if namespace was used)
|
|
4301
|
+
if (oldValue !== undefined) {
|
|
4302
|
+
newStoreValues = setWidgetValue(newStoreValues, storeDataPath, widgetId, oldValue);
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
});
|
|
4306
|
+
// Also revert supporting documents if any
|
|
4307
|
+
if (hasSupportingDocuments) {
|
|
4308
|
+
// Use original section's supporting documents to get original data paths
|
|
4309
|
+
const originalSupportingDocuments = originalSection['section-supporting-documents'] || [];
|
|
4310
|
+
originalSupportingDocuments.forEach((doc, index) => {
|
|
4311
|
+
const widgetId = `supporting-doc-${sectionId}-${index}`;
|
|
4312
|
+
const originalDataPath = doc['document-data-path'];
|
|
4313
|
+
// If namespace was used, data path in store is namespaced
|
|
4314
|
+
const storeDataPath = namespace && originalDataPath
|
|
4315
|
+
? `${namespace}.${originalDataPath}`
|
|
4316
|
+
: originalDataPath;
|
|
4317
|
+
const oldValue = getValueByPath(oldSchemaData, originalDataPath);
|
|
4318
|
+
newStoreValues = setWidgetValue(newStoreValues, storeDataPath, widgetId, oldValue);
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4321
|
+
if (newStoreValues !== currentStoreValues) {
|
|
4322
|
+
dispatch(setValues(newStoreValues));
|
|
4323
|
+
}
|
|
4137
4324
|
setIsEditMode(false);
|
|
4138
4325
|
onEditModeChange?.(originalSectionId, false);
|
|
4139
4326
|
};
|
|
@@ -4174,7 +4361,7 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4174
4361
|
.${sectionClassId} label.text-gray-700,
|
|
4175
4362
|
.${sectionClassId} .text-gray-600 {
|
|
4176
4363
|
font-weight: 400 !important;
|
|
4177
|
-
color:
|
|
4364
|
+
color: var(--owt-color-text-muted, #727474) !important;
|
|
4178
4365
|
width: 50% !important;
|
|
4179
4366
|
min-width: 50% !important;
|
|
4180
4367
|
max-width: 50% !important;
|
|
@@ -4219,11 +4406,11 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4219
4406
|
.${sectionClassId}-edit {
|
|
4220
4407
|
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2),
|
|
4221
4408
|
0 8px 10px -6px rgba(0, 0, 0, 0.1);
|
|
4222
|
-
border-color: #
|
|
4409
|
+
border-color: var(--owt-color-primary-dark, #F07B1A);
|
|
4223
4410
|
border-style: dashed;
|
|
4224
4411
|
border-width: 1px;
|
|
4225
|
-
background-color: #
|
|
4226
|
-
border-radius: 10px;
|
|
4412
|
+
background-color: var(--owt-color-primary-light, #FBE6AA);
|
|
4413
|
+
border-radius: var(--owt-section-border-radius, 10px);
|
|
4227
4414
|
z-index: 10;
|
|
4228
4415
|
position: absolute;
|
|
4229
4416
|
}
|
|
@@ -4323,23 +4510,23 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4323
4510
|
|
|
4324
4511
|
/* IntakeForm accordion */
|
|
4325
4512
|
.${sectionClassId}.intake-form-accordion-item {
|
|
4326
|
-
border-color: #
|
|
4513
|
+
border-color: var(--owt-color-border-light, #E4E4E4);
|
|
4327
4514
|
transition: box-shadow 0.2s ease, border-color 0.2s ease;
|
|
4328
4515
|
}
|
|
4329
4516
|
.${sectionClassId}.intake-form-accordion-item:hover {
|
|
4330
|
-
border-color: #
|
|
4517
|
+
border-color: var(--owt-color-border, #C4C4C4);
|
|
4331
4518
|
}
|
|
4332
4519
|
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-header {
|
|
4333
4520
|
transition: opacity 0.2s ease, background-color 0.2s ease;
|
|
4334
4521
|
}
|
|
4335
4522
|
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-header h2 {
|
|
4336
|
-
color: #
|
|
4523
|
+
color: var(--owt-color-primary-dark, #F07B1A);
|
|
4337
4524
|
}
|
|
4338
4525
|
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-header:hover {
|
|
4339
4526
|
opacity: 0.85;
|
|
4340
4527
|
}
|
|
4341
4528
|
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-header:focus-visible {
|
|
4342
|
-
outline: 2px solid #
|
|
4529
|
+
outline: 2px solid var(--owt-color-primary, #F5BB1A);
|
|
4343
4530
|
outline-offset: 2px;
|
|
4344
4531
|
}
|
|
4345
4532
|
.${sectionClassId}.intake-form-accordion-item .intake-form-accordion-content {
|
|
@@ -4351,27 +4538,27 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4351
4538
|
width: 100%;
|
|
4352
4539
|
}
|
|
4353
4540
|
.${sectionClassId}.intake-form-accordion-item .intake-form-prev-btn {
|
|
4354
|
-
color:
|
|
4541
|
+
color: var(--owt-color-text-muted, #727474) !important;
|
|
4355
4542
|
}
|
|
4356
4543
|
.${sectionClassId}.intake-form-accordion-item .intake-form-prev-btn:disabled {
|
|
4357
|
-
color:
|
|
4544
|
+
color: var(--owt-color-border, #C4C4C4) !important;
|
|
4358
4545
|
}
|
|
4359
4546
|
.${sectionClassId}.intake-form-accordion-item .intake-form-prev-btn:hover:not(:disabled) {
|
|
4360
|
-
background-color: #
|
|
4361
|
-
border-color: #
|
|
4547
|
+
background-color: var(--owt-color-bg-alt, #F6F6F6);
|
|
4548
|
+
border-color: var(--owt-btn-primary-border, #F07B1A);
|
|
4362
4549
|
}
|
|
4363
4550
|
.${sectionClassId}.intake-form-accordion-item .intake-form-save-btn:hover:not(:disabled) {
|
|
4364
|
-
background-color: #
|
|
4551
|
+
background-color: var(--owt-color-border-light, #E4E4E4);
|
|
4365
4552
|
}
|
|
4366
|
-
` }), jsxRuntimeExports.jsx("div", { ref: sectionRef, className: `section ${sectionClassId} px-4 sm:px-6 lg:px-8 border-2
|
|
4553
|
+
` }), jsxRuntimeExports.jsx("div", { ref: sectionRef, className: `section ${sectionClassId} px-4 sm:px-6 lg:px-8 border-2 ${mode === 'IntakeForm' ? 'intake-form-accordion-item' : ''}`, "data-section-id": sectionId, "data-has-table": hasTableWidget ? 'true' : 'false', "data-has-explicit-span": hasExplicitTableSpan ? 'true' : 'false', "data-edit-mode": isEditMode ? 'true' : 'false', "data-section-dirty": isEditMode && isDirty ? 'true' : 'false', "data-column-span": columnSpan, "data-change-request-type": changeRequestType, "data-intake-form-expanded": mode === 'IntakeForm' ? (isExpanded ? 'true' : 'false') : undefined, style: {
|
|
4367
4554
|
gridColumn: `span ${columnSpan}`,
|
|
4368
4555
|
width: '100%',
|
|
4369
|
-
borderRadius: '10px',
|
|
4370
|
-
|
|
4556
|
+
borderRadius: 'var(--owt-section-border-radius, 10px)',
|
|
4557
|
+
borderColor: 'var(--owt-color-bg, #FFFFFF)',
|
|
4371
4558
|
...(mode === 'IntakeForm' && isExpanded
|
|
4372
|
-
? { backgroundColor: '#
|
|
4559
|
+
? { backgroundColor: 'var(--owt-color-primary-light, #FBE6AA)', border: '1px dashed var(--owt-color-primary-dark, #F07B1A)' }
|
|
4373
4560
|
: {
|
|
4374
|
-
backgroundColor: changeRequestType === 'old' ? '#
|
|
4561
|
+
backgroundColor: changeRequestType === 'old' ? 'var(--owt-color-bg-alt, #F6F6F6)' : 'var(--owt-section-bg, #FFFFFF)',
|
|
4375
4562
|
opacity: changeRequestType === 'old' ? 0.95 : 1,
|
|
4376
4563
|
}),
|
|
4377
4564
|
...(isEditMode && sectionHeight ? {
|
|
@@ -4405,17 +4592,17 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4405
4592
|
borderRadius: '9999px',
|
|
4406
4593
|
fontSize: '12px',
|
|
4407
4594
|
fontWeight: 500,
|
|
4408
|
-
backgroundColor: '#D1FAE5',
|
|
4409
|
-
color: '#047857',
|
|
4595
|
+
backgroundColor: 'var(--owt-color-success-light, #D1FAE5)',
|
|
4596
|
+
color: 'var(--owt-color-success-dark, #047857)',
|
|
4410
4597
|
}, children: translate('common.sectionSaved') || 'Saved' })), intakeFormSectionStatus === 'modified' && (jsxRuntimeExports.jsx("span", { style: {
|
|
4411
4598
|
display: 'inline-block',
|
|
4412
4599
|
padding: '4px 10px',
|
|
4413
4600
|
borderRadius: '9999px',
|
|
4414
4601
|
fontSize: '12px',
|
|
4415
4602
|
fontWeight: 500,
|
|
4416
|
-
backgroundColor: '#FEE2E2',
|
|
4417
|
-
color: '#B91C1C',
|
|
4418
|
-
}, 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: '#
|
|
4603
|
+
backgroundColor: 'var(--owt-color-error-light, #FEE2E2)',
|
|
4604
|
+
color: 'var(--owt-color-error, #B91C1C)',
|
|
4605
|
+
}, 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: 'var(--owt-section-divider-color, #F5BB1A)', 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) => {
|
|
4419
4606
|
const docConfig = createDocumentWidgetConfig(doc, sectionId, docIndex);
|
|
4420
4607
|
return (jsxRuntimeExports.jsx("div", { className: "supporting-document-item", children: jsxRuntimeExports.jsx(FileInputWidget, { config: docConfig }) }, `${sectionId}-doc-${docIndex}`));
|
|
4421
4608
|
}) })] })), jsxRuntimeExports.jsxs("div", { className: "intake-form-edit-controls", style: {
|
|
@@ -4431,10 +4618,10 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4431
4618
|
fontSize: '14px',
|
|
4432
4619
|
fontWeight: 400,
|
|
4433
4620
|
padding: '8px 24px',
|
|
4434
|
-
borderRadius: '10px',
|
|
4435
|
-
border: '1px solid #
|
|
4436
|
-
background: '#FFFFFF',
|
|
4437
|
-
color: '
|
|
4621
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
4622
|
+
border: '1px solid var(--owt-btn-primary-border, #F07B1A)',
|
|
4623
|
+
background: 'var(--owt-btn-primary-bg, #FFFFFF)',
|
|
4624
|
+
color: 'var(--owt-color-text-muted, #727474)',
|
|
4438
4625
|
cursor: 'pointer',
|
|
4439
4626
|
display: 'inline-flex',
|
|
4440
4627
|
alignItems: 'center',
|
|
@@ -4444,10 +4631,10 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4444
4631
|
fontSize: '14px',
|
|
4445
4632
|
fontWeight: 400,
|
|
4446
4633
|
padding: '8px 24px',
|
|
4447
|
-
borderRadius: '10px',
|
|
4448
|
-
border: '1px solid #
|
|
4449
|
-
background: '#FFFFFF',
|
|
4450
|
-
color: '
|
|
4634
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
4635
|
+
border: '1px solid var(--owt-btn-primary-border, #F07B1A)',
|
|
4636
|
+
background: 'var(--owt-btn-primary-bg, #FFFFFF)',
|
|
4637
|
+
color: 'var(--owt-color-text-muted, #727474)',
|
|
4451
4638
|
cursor: 'pointer',
|
|
4452
4639
|
display: 'inline-flex',
|
|
4453
4640
|
alignItems: 'center',
|
|
@@ -4470,11 +4657,11 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4470
4657
|
fontWeight: 600,
|
|
4471
4658
|
textTransform: 'uppercase',
|
|
4472
4659
|
letterSpacing: '0.5px',
|
|
4473
|
-
backgroundColor: changeRequestType === 'new' ? '#
|
|
4474
|
-
color: changeRequestType === 'new' ? '#FFFFFF' : '#
|
|
4660
|
+
backgroundColor: changeRequestType === 'new' ? 'var(--owt-color-success, #16A34A)' : 'var(--owt-color-error-light, #FEE2E2)',
|
|
4661
|
+
color: changeRequestType === 'new' ? 'var(--owt-color-bg, #FFFFFF)' : 'var(--owt-color-error, #B91C1C)',
|
|
4475
4662
|
whiteSpace: 'nowrap',
|
|
4476
4663
|
boxShadow: changeRequestType === 'new' ? '0 2px 4px rgba(40, 167, 69, 0.3)' : 'none',
|
|
4477
|
-
}, children: changeRequestType === 'new' ? 'New' : 'Old' }))] })), jsxRuntimeExports.jsxs("div", { id: gridId, className: "section-panels", style: mode === 'RegistryView' && hideEditButton ? { paddingBottom: '
|
|
4664
|
+
}, children: changeRequestType === 'new' ? 'New' : 'Old' }))] })), jsxRuntimeExports.jsxs("div", { id: gridId, className: "section-panels", style: mode === 'RegistryView' && hideEditButton ? { paddingBottom: '30px' } : {}, 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}`))), mode === 'CRView' && crViewData && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', marginTop: '20px', marginBottom: '0px', border: 'none', backgroundColor: 'var(--owt-color-border, #C4C4C4)' } }), jsxRuntimeExports.jsxs("div", { className: "cr-view-container", style: {
|
|
4478
4665
|
marginTop: '20px',
|
|
4479
4666
|
paddingBottom: '30px',
|
|
4480
4667
|
display: 'flex',
|
|
@@ -4489,17 +4676,17 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4489
4676
|
}, children: [jsxRuntimeExports.jsx("span", { style: {
|
|
4490
4677
|
fontFamily: 'Roboto, sans-serif',
|
|
4491
4678
|
fontSize: '14px',
|
|
4492
|
-
color: '#
|
|
4679
|
+
color: 'var(--owt-color-text, #011627)',
|
|
4493
4680
|
fontWeight: 'normal',
|
|
4494
4681
|
}, children: "Created by" }), jsxRuntimeExports.jsx("img", { src: img$a, alt: "Person", width: "16", height: "16", style: { filter: 'brightness(0) saturate(100%) invert(56%) sepia(45%) saturate(5139%) hue-rotate(348deg) brightness(96%) contrast(92%)' } }), crViewData?.createdBy && (jsxRuntimeExports.jsx("span", { style: {
|
|
4495
4682
|
fontFamily: 'Roboto, sans-serif',
|
|
4496
4683
|
fontSize: '14px',
|
|
4497
|
-
color: '#
|
|
4684
|
+
color: 'var(--owt-color-text, #011627)',
|
|
4498
4685
|
fontWeight: 'normal',
|
|
4499
4686
|
}, children: crViewData.createdBy })), jsxRuntimeExports.jsx("img", { src: img$9, alt: "Calendar", width: "16", height: "16", style: { marginLeft: '6px' } }), crViewData?.createdDate && (jsxRuntimeExports.jsx("span", { style: {
|
|
4500
4687
|
fontFamily: 'Roboto, sans-serif',
|
|
4501
4688
|
fontSize: '14px',
|
|
4502
|
-
color: '#
|
|
4689
|
+
color: 'var(--owt-color-text, #011627)',
|
|
4503
4690
|
fontWeight: 'normal',
|
|
4504
4691
|
}, children: crViewData.createdDate }))] }), jsxRuntimeExports.jsxs("div", { className: "approved-by-section", style: {
|
|
4505
4692
|
display: 'flex',
|
|
@@ -4510,22 +4697,22 @@ const SectionRenderer = ({ section, dataSourceRequestHandler: propDataSourceRequ
|
|
|
4510
4697
|
}, children: [jsxRuntimeExports.jsx("span", { style: {
|
|
4511
4698
|
fontFamily: 'Roboto, sans-serif',
|
|
4512
4699
|
fontSize: '14px',
|
|
4513
|
-
color: '#
|
|
4700
|
+
color: 'var(--owt-color-text, #011627)',
|
|
4514
4701
|
fontWeight: 'normal',
|
|
4515
4702
|
}, children: "Approved by" }), jsxRuntimeExports.jsx("img", { src: img$a, alt: "Person", width: "16", height: "16", style: { filter: 'brightness(0) saturate(100%) invert(56%) sepia(45%) saturate(5139%) hue-rotate(348deg) brightness(96%) contrast(92%)' } }), crViewData?.approvedBy && (jsxRuntimeExports.jsx("span", { style: {
|
|
4516
4703
|
fontFamily: 'Roboto, sans-serif',
|
|
4517
4704
|
fontSize: '14px',
|
|
4518
|
-
color: '#
|
|
4705
|
+
color: 'var(--owt-color-text, #011627)',
|
|
4519
4706
|
fontWeight: 'normal',
|
|
4520
4707
|
}, children: crViewData.approvedBy })), jsxRuntimeExports.jsx("img", { src: img$9, alt: "Calendar", width: "16", height: "16", style: { marginLeft: '6px' } }), crViewData?.approvedDate && (jsxRuntimeExports.jsx("span", { style: {
|
|
4521
4708
|
fontFamily: 'Roboto, sans-serif',
|
|
4522
4709
|
fontSize: '14px',
|
|
4523
|
-
color: '#
|
|
4710
|
+
color: 'var(--owt-color-text, #011627)',
|
|
4524
4711
|
fontWeight: 'normal',
|
|
4525
|
-
}, children: crViewData.approvedDate }))] })] })] })), mode === 'RegistryView' && !hideEditButton && (jsxRuntimeExports.jsx("hr", { className: "
|
|
4712
|
+
}, children: crViewData.approvedDate }))] })] })] })), mode === 'RegistryView' && !hideEditButton && (jsxRuntimeExports.jsx("hr", { className: "w-full", style: { height: '1px', marginTop: !isEditMode ? '10px' : 0, marginBottom: '14px', border: 'none', backgroundColor: 'var(--owt-color-border, #C4C4C4)' } })), mode === 'RegistryView' && !isEditMode && !hideEditButton && (jsxRuntimeExports.jsx("div", { className: "flex justify-center items-center", style: { marginBottom: '20px' }, children: jsxRuntimeExports.jsxs("button", { onClick: handleEdit, className: "font-normal inline-flex items-center gap-2 bg-transparent border-0 p-0 cursor-pointer hover:opacity-80", style: {
|
|
4526
4713
|
fontFamily: 'Roboto, sans-serif',
|
|
4527
4714
|
fontSize: '16px',
|
|
4528
|
-
color: '
|
|
4715
|
+
color: 'var(--owt-color-text-muted, #727474)'
|
|
4529
4716
|
}, children: [translate('common.editDetails') || 'Edit Details', jsxRuntimeExports.jsx("img", { src: img$8, alt: "right-arrow", className: "w-3.5 h-3.5 brightness-0 opacity-50" })] }) }))] })] })) })] }));
|
|
4530
4717
|
};
|
|
4531
4718
|
|
|
@@ -4699,9 +4886,6 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4699
4886
|
}, []);
|
|
4700
4887
|
const safeSections = sections ?? [];
|
|
4701
4888
|
const prevSectionsLengthRef = useRef(safeSections.length);
|
|
4702
|
-
// Stable ref for namespace so formHandle useMemo doesn't depend on the (possibly inline) function identity
|
|
4703
|
-
const namespaceRef = useRef(namespace);
|
|
4704
|
-
namespaceRef.current = namespace;
|
|
4705
4889
|
// Track dirty (unsaved changes) per section for form handle validation
|
|
4706
4890
|
const sectionDirtyMapRef = useRef({});
|
|
4707
4891
|
const handleSectionDirtyChange = useCallback((sectionId, isDirty) => {
|
|
@@ -4747,14 +4931,11 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4747
4931
|
// Form handle for onFormReady - allows host to validate and get all section data from its own Submit button
|
|
4748
4932
|
const formHandle = useMemo(() => {
|
|
4749
4933
|
const getValues = () => store.getState().widget?.values || {};
|
|
4750
|
-
const getNamespace = (section, index) =>
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
: ns(section['section-id'], index)
|
|
4756
|
-
: undefined;
|
|
4757
|
-
};
|
|
4934
|
+
const getNamespace = (section, index) => namespace
|
|
4935
|
+
? typeof namespace === 'string'
|
|
4936
|
+
? namespace
|
|
4937
|
+
: namespace(section['section-id'], index)
|
|
4938
|
+
: undefined;
|
|
4758
4939
|
const checkNoUnsavedChanges = () => {
|
|
4759
4940
|
const hasDirty = Object.values(sectionDirtyMapRef.current).some(Boolean);
|
|
4760
4941
|
if (hasDirty) {
|
|
@@ -4804,7 +4985,7 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4804
4985
|
return results;
|
|
4805
4986
|
},
|
|
4806
4987
|
};
|
|
4807
|
-
}, [store, dispatch, safeSections]);
|
|
4988
|
+
}, [store, dispatch, safeSections, namespace]);
|
|
4808
4989
|
// Call onFormReady when form is ready (sections loaded)
|
|
4809
4990
|
useEffect(() => {
|
|
4810
4991
|
if (onFormReady && safeSections.length > 0) {
|
|
@@ -4877,6 +5058,7 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4877
5058
|
const sectionNamespace = namespace
|
|
4878
5059
|
? (typeof namespace === 'string' ? namespace : namespace(section['section-id'], index))
|
|
4879
5060
|
: undefined;
|
|
5061
|
+
const hideEditForSection = hideEditButton || section['section-hide-edit-button'] === true;
|
|
4880
5062
|
// IntakeForm mode: pass accordion state and handlers
|
|
4881
5063
|
const intakeFormProps = mode === 'IntakeForm'
|
|
4882
5064
|
? {
|
|
@@ -4898,7 +5080,7 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4898
5080
|
: {};
|
|
4899
5081
|
// Check if section has explicit column span
|
|
4900
5082
|
if (section['section-column-span']) {
|
|
4901
|
-
return (jsxRuntimeExports.jsx(SectionRenderer, { section: section, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: schemaData, onValueChange: onValueChange, gridColumnSpan: section['section-column-span'], onSectionSave: onSectionSave, hideEditButton:
|
|
5083
|
+
return (jsxRuntimeExports.jsx(SectionRenderer, { section: section, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: schemaData, onValueChange: onValueChange, gridColumnSpan: section['section-column-span'], onSectionSave: onSectionSave, hideEditButton: hideEditForSection, mode: mode, namespace: sectionNamespace, onSectionDirtyChange: handleSectionDirtyChange, ...intakeFormProps, ...registryViewEditProps }, section['section-id']));
|
|
4902
5084
|
}
|
|
4903
5085
|
const verticalPanelsCount = countVerticalPanels(section.panels);
|
|
4904
5086
|
const tableWidgetColumnSpan = getTableWidgetColumnSpan(section.panels);
|
|
@@ -4906,7 +5088,7 @@ const SectionsContainer = ({ sections, dataSourceRequestHandler: propDataSourceR
|
|
|
4906
5088
|
const columnSpan = tableWidgetColumnSpan !== null
|
|
4907
5089
|
? tableWidgetColumnSpan
|
|
4908
5090
|
: (containsTable ? Math.max(verticalPanelsCount, 2) : verticalPanelsCount);
|
|
4909
|
-
return (jsxRuntimeExports.jsx(SectionRenderer, { section: section, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: schemaData, onValueChange: onValueChange, gridColumnSpan: columnSpan, onSectionSave: onSectionSave, hideEditButton:
|
|
5091
|
+
return (jsxRuntimeExports.jsx(SectionRenderer, { section: section, dataSourceRequestHandler: dataSourceRequestHandler, schemaData: schemaData, onValueChange: onValueChange, gridColumnSpan: columnSpan, onSectionSave: onSectionSave, hideEditButton: hideEditForSection, mode: mode, namespace: sectionNamespace, onSectionDirtyChange: handleSectionDirtyChange, ...intakeFormProps, ...registryViewEditProps }, section['section-id']));
|
|
4910
5092
|
}) })] }));
|
|
4911
5093
|
};
|
|
4912
5094
|
|
|
@@ -8098,7 +8280,11 @@ const TableCellSelect = ({ config, value, onValueChange }) => {
|
|
|
8098
8280
|
// Use useBaseWidget to get data source options (it handles loading)
|
|
8099
8281
|
const { dataSourceOptions, loading, config: widgetConfig, } = useBaseWidget({ config });
|
|
8100
8282
|
const isReadonly = config['widget-readonly'] || false;
|
|
8101
|
-
return (jsxRuntimeExports.jsxs("select", { value: value || '', onChange: (e) => onValueChange(e.target.value), disabled: isReadonly || loading, className: `w-full h-[28px] px-2 text-sm border focus:outline-none
|
|
8283
|
+
return (jsxRuntimeExports.jsxs("select", { value: value || '', onChange: (e) => onValueChange(e.target.value), disabled: isReadonly || loading, className: `w-full h-[28px] px-2 text-sm border focus:outline-none ${isReadonly || loading ? 'cursor-not-allowed' : ''} table-cell-input`, style: {
|
|
8284
|
+
borderRadius: '10px',
|
|
8285
|
+
borderColor: 'var(--owt-widget-input-border, #C4C4C4)',
|
|
8286
|
+
backgroundColor: isReadonly || loading ? 'var(--owt-color-bg-alt, #F6F6F6)' : 'var(--owt-color-bg, #FFFFFF)',
|
|
8287
|
+
}, children: [jsxRuntimeExports.jsx("option", { value: "", children: translate('common.select') || 'Select' }), dataSourceOptions.map((option) => (jsxRuntimeExports.jsx("option", { value: option.value, children: option.label }, option.value)))] }));
|
|
8102
8288
|
};
|
|
8103
8289
|
const SelectDisplayValue = ({ config, value }) => {
|
|
8104
8290
|
const { dataSourceOptions, loading } = useBaseWidget({ config });
|
|
@@ -8117,7 +8303,11 @@ const TableCellText = ({ config, value, onValueChange }) => {
|
|
|
8117
8303
|
config['widget-data-format'];
|
|
8118
8304
|
const maxLength = config['widget-data-validation']?.maxLength;
|
|
8119
8305
|
const displayValue = value !== null && value !== undefined ? String(value) : '';
|
|
8120
|
-
return (jsxRuntimeExports.jsx("input", { type: "text", value: displayValue, onChange: (e) => onValueChange(e.target.value), disabled: isReadonly, placeholder: placeholder, maxLength: maxLength, className: `w-full h-[28px] px-2 text-sm border focus:outline-none
|
|
8306
|
+
return (jsxRuntimeExports.jsx("input", { type: "text", value: displayValue, onChange: (e) => onValueChange(e.target.value), disabled: isReadonly, placeholder: placeholder, maxLength: maxLength, className: `w-full h-[28px] px-2 text-sm border focus:outline-none ${isReadonly ? 'cursor-not-allowed' : ''} table-cell-input`, style: {
|
|
8307
|
+
borderRadius: '10px',
|
|
8308
|
+
borderColor: 'var(--owt-widget-input-border, #C4C4C4)',
|
|
8309
|
+
backgroundColor: isReadonly ? 'var(--owt-color-bg-alt, #F6F6F6)' : 'var(--owt-color-bg, #FFFFFF)',
|
|
8310
|
+
} }));
|
|
8121
8311
|
};
|
|
8122
8312
|
const TableCellNumber = ({ config, value, onValueChange }) => {
|
|
8123
8313
|
const isReadonly = config['widget-readonly'] || false;
|
|
@@ -8140,14 +8330,22 @@ const TableCellNumber = ({ config, value, onValueChange }) => {
|
|
|
8140
8330
|
onValueChange(inputValue);
|
|
8141
8331
|
}
|
|
8142
8332
|
};
|
|
8143
|
-
return (jsxRuntimeExports.jsx("input", { type: "number", value: displayValue, onChange: handleChange, disabled: isReadonly, placeholder: placeholder, min: validationConfig?.min, max: validationConfig?.max, step: formatConfig?.decimalPlaces ? Math.pow(0.1, formatConfig.decimalPlaces) : undefined, className: `w-full h-[28px] px-2 text-sm border focus:outline-none
|
|
8333
|
+
return (jsxRuntimeExports.jsx("input", { type: "number", value: displayValue, onChange: handleChange, disabled: isReadonly, placeholder: placeholder, min: validationConfig?.min, max: validationConfig?.max, step: formatConfig?.decimalPlaces ? Math.pow(0.1, formatConfig.decimalPlaces) : undefined, className: `w-full h-[28px] px-2 text-sm border focus:outline-none text-right ${isReadonly ? 'cursor-not-allowed' : ''} table-cell-input`, style: {
|
|
8334
|
+
borderRadius: '10px',
|
|
8335
|
+
borderColor: 'var(--owt-widget-input-border, #C4C4C4)',
|
|
8336
|
+
backgroundColor: isReadonly ? 'var(--owt-color-bg-alt, #F6F6F6)' : 'var(--owt-color-bg, #FFFFFF)',
|
|
8337
|
+
} }));
|
|
8144
8338
|
};
|
|
8145
8339
|
const TableCellDate = ({ config, value, onValueChange }) => {
|
|
8146
8340
|
const isReadonly = config['widget-readonly'] || false;
|
|
8147
8341
|
const placeholder = config['widget-data-placeholder'] || '';
|
|
8148
8342
|
// input type="date" requires YYYY-MM-DD format
|
|
8149
8343
|
const displayValue = value && typeof value === 'string' ? value.split('T')[0] : '';
|
|
8150
|
-
return (jsxRuntimeExports.jsx("input", { type: "date", value: displayValue, onChange: (e) => onValueChange(e.target.value), disabled: isReadonly, placeholder: placeholder, className: `w-full h-[28px] px-2 text-sm border focus:outline-none
|
|
8344
|
+
return (jsxRuntimeExports.jsx("input", { type: "date", value: displayValue, onChange: (e) => onValueChange(e.target.value), disabled: isReadonly, placeholder: placeholder, className: `w-full h-[28px] px-2 text-sm border focus:outline-none ${isReadonly ? 'cursor-not-allowed' : ''} table-cell-input`, style: {
|
|
8345
|
+
borderRadius: '10px',
|
|
8346
|
+
borderColor: 'var(--owt-widget-input-border, #C4C4C4)',
|
|
8347
|
+
backgroundColor: isReadonly ? 'var(--owt-color-bg-alt, #F6F6F6)' : 'var(--owt-color-bg, #FFFFFF)',
|
|
8348
|
+
} }));
|
|
8151
8349
|
};
|
|
8152
8350
|
const TableWidget = ({ config }) => {
|
|
8153
8351
|
const { value, error, touched, isEnabled, onChange, config: widgetConfig, } = useBaseWidget({ config });
|
|
@@ -8554,13 +8752,13 @@ const TableWidget = ({ config }) => {
|
|
|
8554
8752
|
return {}; // No special styling when editing
|
|
8555
8753
|
const editAction = row?.edit_action;
|
|
8556
8754
|
if (editAction === 'ADD') {
|
|
8557
|
-
return { color: '#
|
|
8755
|
+
return { color: 'var(--owt-color-success, #16A34A)' };
|
|
8558
8756
|
}
|
|
8559
8757
|
else if (editAction === 'DELETE') {
|
|
8560
|
-
return { color: '#
|
|
8758
|
+
return { color: 'var(--owt-color-error, #B91C1C)', textDecoration: 'line-through' };
|
|
8561
8759
|
}
|
|
8562
8760
|
else if (editAction === 'UPDATE') {
|
|
8563
|
-
return { color: '#
|
|
8761
|
+
return { color: 'var(--owt-color-warning, #F59E0B)' };
|
|
8564
8762
|
}
|
|
8565
8763
|
return {};
|
|
8566
8764
|
};
|
|
@@ -8644,27 +8842,81 @@ const TableWidget = ({ config }) => {
|
|
|
8644
8842
|
.${tableWidgetId} button {
|
|
8645
8843
|
border-radius: 10px !important;
|
|
8646
8844
|
}
|
|
8647
|
-
|
|
8845
|
+
/* Focus ring for table cell inputs */
|
|
8846
|
+
.${tableWidgetId} .table-cell-input:focus {
|
|
8847
|
+
box-shadow: 0 0 0 1px var(--owt-widget-input-focus-border, #F07B1A);
|
|
8848
|
+
border-color: var(--owt-widget-input-focus-border, #F07B1A);
|
|
8849
|
+
}
|
|
8850
|
+
` }), jsxRuntimeExports.jsxs("div", { className: `table-widget-container ${tableWidgetId}`, children: [confirmationState?.show && (jsxRuntimeExports.jsx("div", { className: "fixed inset-0 flex items-center justify-center z-50", style: { backgroundColor: 'rgba(0,0,0,0.5)' }, children: jsxRuntimeExports.jsxs("div", { className: "rounded-lg p-6 max-w-md w-full mx-4", style: { backgroundColor: 'var(--owt-color-bg, #FFFFFF)' }, children: [jsxRuntimeExports.jsx("h3", { className: "text-lg font-semibold mb-4", style: { color: 'var(--owt-color-text, #011627)' }, children: translate('table.confirm') || 'Confirm Action' }), jsxRuntimeExports.jsx("p", { className: "mb-6", style: { color: 'var(--owt-color-text, #011627)' }, children: confirmationState.message }), jsxRuntimeExports.jsxs("div", { className: "flex justify-end gap-3", children: [jsxRuntimeExports.jsx("button", { onClick: confirmationState.onCancel, className: "px-4 py-2 text-sm font-medium", style: {
|
|
8851
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8852
|
+
border: '1px solid var(--owt-btn-secondary-border, #C4C4C4)',
|
|
8853
|
+
backgroundColor: 'var(--owt-btn-secondary-bg, #FFFFFF)',
|
|
8854
|
+
color: 'var(--owt-btn-secondary-color, #011627)',
|
|
8855
|
+
}, children: translate('common.cancel') || 'Cancel' }), jsxRuntimeExports.jsx("button", { onClick: confirmationState.onConfirm, className: "px-4 py-2 text-sm font-medium", style: {
|
|
8856
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8857
|
+
border: '1px solid var(--owt-btn-primary-border, #F07B1A)',
|
|
8858
|
+
backgroundColor: 'var(--owt-color-primary, #F5BB1A)',
|
|
8859
|
+
color: 'var(--owt-color-bg, #FFFFFF)',
|
|
8860
|
+
}, children: translate('table.discard') || 'Discard & Continue' })] })] }) })), operations.add && !isReadonly && isEnabled && (isSectionEditMode || !isAnyRowEditing) && (jsxRuntimeExports.jsx("div", { className: "flex justify-end mb-2", children: jsxRuntimeExports.jsx("button", { type: "button", onClick: startAdd, disabled: loadingRowIndex !== null, className: "px-3 py-1 text-sm disabled:opacity-50 disabled:cursor-not-allowed", style: {
|
|
8861
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8862
|
+
border: '1px solid var(--owt-btn-primary-border, #F07B1A)',
|
|
8863
|
+
backgroundColor: 'var(--owt-color-primary, #F5BB1A)',
|
|
8864
|
+
color: 'var(--owt-color-bg, #FFFFFF)',
|
|
8865
|
+
}, children: translate('table.addRecord') || 'Add New Record' }) })), jsxRuntimeExports.jsx("div", { className: "overflow-x-auto border", style: { borderRadius: 'var(--owt-widget-table-border-radius, 15px)', borderColor: 'var(--owt-widget-table-border-color, #C4C4C4)' }, children: jsxRuntimeExports.jsxs("table", { className: "min-w-full", style: { borderCollapse: 'separate', borderSpacing: 0 }, children: [jsxRuntimeExports.jsx("thead", { style: { backgroundColor: 'var(--owt-widget-table-header-bg, #F6F6F6)' }, children: jsxRuntimeExports.jsxs("tr", { style: { borderBottom: '1px solid var(--owt-widget-table-row-divider, #E4E4E4)' }, children: [columns.map((col) => (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider", style: { color: 'var(--owt-widget-table-header-color, #727474)' }, children: translateConfig(col['widget-label']) }, col['column-key']))), ((operations.edit || operations.remove) && !isReadonly) || isAnyRowEditing || isSectionEditMode ? (jsxRuntimeExports.jsx("th", { className: "px-4 py-3 text-left text-xs font-medium uppercase tracking-wider", style: { color: 'var(--owt-widget-table-header-color, #727474)' }, children: translate('common.actions') || 'Actions' })) : null] }) }), jsxRuntimeExports.jsxs("tbody", { style: { backgroundColor: 'var(--owt-widget-table-body-bg, #FFFFFF)' }, children: [rows.length === 0 && !isAdding && (jsxRuntimeExports.jsx("tr", { children: jsxRuntimeExports.jsxs("td", { colSpan: columns.length + (((operations.edit || operations.remove) && !isReadonly) || isSectionEditMode ? 1 : 0), className: "px-4 py-6 text-center text-sm", style: { color: 'var(--owt-widget-table-empty-color, #727474)' }, children: [translate('table.noData') || 'No records available.', operations.add && !isReadonly && ` ${translate('table.clickToAdd') || 'Click "Add New Record" to add one.'}`] }) })), rows.map((row, rowIndex) => {
|
|
8648
8866
|
const isEditing = isRowEditing(rowIndex);
|
|
8649
8867
|
const isLoading = loadingRowIndex === rowIndex;
|
|
8650
|
-
return (jsxRuntimeExports.jsxs("tr", { className:
|
|
8868
|
+
return (jsxRuntimeExports.jsxs("tr", { className: isLoading ? 'opacity-50' : '', style: {
|
|
8869
|
+
borderBottom: '1px solid var(--owt-widget-table-row-divider, #E4E4E4)',
|
|
8870
|
+
backgroundColor: isEditing
|
|
8871
|
+
? 'var(--owt-widget-table-editing-row-bg, #FBE6AA)'
|
|
8872
|
+
: row.edit_action === 'DELETE'
|
|
8873
|
+
? 'var(--owt-widget-table-deleted-row-bg, #FEE2E2)'
|
|
8874
|
+
: undefined,
|
|
8875
|
+
}, children: [columns.map((col) => {
|
|
8651
8876
|
return (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 whitespace-nowrap", children: renderCell(rowIndex, col, row) }, col['column-key']));
|
|
8652
8877
|
}), ((operations.edit || operations.remove) && !isReadonly) || isEditing || isSectionEditMode ? (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 whitespace-nowrap", style: { minWidth: '120px' }, children: isEditing ? (
|
|
8653
8878
|
// Show OK (Save)/Cancel buttons when row is being edited (works in both section edit mode and normal mode)
|
|
8654
|
-
jsxRuntimeExports.jsxs("div", { className: "flex flex-row gap-2 items-center", style: { width: '100%' }, children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: saveEdit, disabled: isLoading, className: "px-3 py-1 text-xs font-medium
|
|
8879
|
+
jsxRuntimeExports.jsxs("div", { className: "flex flex-row gap-2 items-center", style: { width: '100%' }, children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: saveEdit, disabled: isLoading, className: "px-3 py-1 text-xs font-medium disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap flex-shrink-0", style: {
|
|
8655
8880
|
display: 'inline-block',
|
|
8656
8881
|
minWidth: '60px',
|
|
8657
|
-
backgroundColor: '#
|
|
8658
|
-
color: '#
|
|
8882
|
+
backgroundColor: 'var(--owt-color-success, #16A34A)',
|
|
8883
|
+
color: 'var(--owt-color-bg, #FFFFFF)',
|
|
8659
8884
|
border: 'none',
|
|
8660
|
-
borderRadius: '
|
|
8661
|
-
}, children: translate('common.ok') || 'OK' }), jsxRuntimeExports.jsx("button", { type: "button", onClick: cancelEdit, disabled: isLoading, className: "px-3 py-1 text-xs font-medium
|
|
8885
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8886
|
+
}, children: translate('common.ok') || 'OK' }), jsxRuntimeExports.jsx("button", { type: "button", onClick: cancelEdit, disabled: isLoading, className: "px-3 py-1 text-xs font-medium disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap flex-shrink-0", style: {
|
|
8887
|
+
display: 'inline-block',
|
|
8888
|
+
minWidth: '60px',
|
|
8889
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8890
|
+
border: '1px solid var(--owt-btn-secondary-border, #C4C4C4)',
|
|
8891
|
+
backgroundColor: 'var(--owt-btn-secondary-bg, #FFFFFF)',
|
|
8892
|
+
color: 'var(--owt-btn-secondary-color, #011627)',
|
|
8893
|
+
}, children: translate('common.cancel') || 'Cancel' })] })) : (
|
|
8662
8894
|
// Show Edit/Delete buttons when row is not being edited
|
|
8663
|
-
jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [operations.edit && (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => startEdit(rowIndex), disabled: isAnyRowEditing || isLoading, className: "px-3 py-1 text-xs
|
|
8664
|
-
|
|
8895
|
+
jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [operations.edit && (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => startEdit(rowIndex), disabled: isAnyRowEditing || isLoading, className: "px-3 py-1 text-xs disabled:opacity-50 disabled:cursor-not-allowed", style: {
|
|
8896
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8897
|
+
color: 'var(--owt-color-primary-dark, #F07B1A)',
|
|
8898
|
+
backgroundColor: 'transparent',
|
|
8899
|
+
border: 'none',
|
|
8900
|
+
}, children: translate('common.edit') || 'Edit' })), operations.remove && (jsxRuntimeExports.jsx("button", { type: "button", onClick: () => deleteRow(rowIndex), disabled: isAnyRowEditing || isLoading, className: "px-3 py-1 text-xs disabled:opacity-50 disabled:cursor-not-allowed", style: {
|
|
8901
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8902
|
+
color: 'var(--owt-color-error, #B91C1C)',
|
|
8903
|
+
backgroundColor: 'transparent',
|
|
8904
|
+
border: 'none',
|
|
8905
|
+
}, children: translate('common.remove') || 'Delete' }))] })) })) : null] }, rowIndex));
|
|
8906
|
+
}), isAdding && newRowData && (jsxRuntimeExports.jsxs("tr", { style: { backgroundColor: 'var(--owt-widget-table-editing-row-bg, #FBE6AA)' }, children: [columns.map((col) => (jsxRuntimeExports.jsx("td", { className: "px-4 py-3 whitespace-nowrap", children: renderCell(rows.length, col, { ...newRowData, edit_action: 'ADD' }) }, col['column-key']))), jsxRuntimeExports.jsx("td", { className: "px-4 py-3 whitespace-nowrap", children: jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [jsxRuntimeExports.jsx("button", { type: "button", onClick: saveAdd, disabled: loadingRowIndex === -1, className: "px-3 py-1 text-xs disabled:opacity-50", style: {
|
|
8907
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8908
|
+
backgroundColor: 'var(--owt-color-success, #16A34A)',
|
|
8909
|
+
color: 'var(--owt-color-bg, #FFFFFF)',
|
|
8910
|
+
border: 'none',
|
|
8911
|
+
}, children: translate('common.save') || 'Save' }), jsxRuntimeExports.jsx("button", { type: "button", onClick: () => {
|
|
8665
8912
|
setIsAdding(false);
|
|
8666
8913
|
setNewRowData(null);
|
|
8667
|
-
}, disabled: loadingRowIndex === -1, className: "px-3 py-1 text-xs
|
|
8914
|
+
}, disabled: loadingRowIndex === -1, className: "px-3 py-1 text-xs disabled:opacity-50", style: {
|
|
8915
|
+
borderRadius: 'var(--owt-btn-border-radius, 10px)',
|
|
8916
|
+
border: '1px solid var(--owt-btn-secondary-border, #C4C4C4)',
|
|
8917
|
+
backgroundColor: 'var(--owt-btn-secondary-bg, #FFFFFF)',
|
|
8918
|
+
color: 'var(--owt-btn-secondary-color, #011627)',
|
|
8919
|
+
}, children: translate('common.cancel') || 'Cancel' })] }) })] }))] })] }) }), touched && error.length > 0 && (jsxRuntimeExports.jsx("p", { className: "text-sm mt-1", style: { color: 'var(--owt-widget-error-color, #B91C1C)' }, children: error[0] }))] })] }));
|
|
8668
8920
|
};
|
|
8669
8921
|
|
|
8670
8922
|
const ProfileWidget = ({ config }) => {
|
|
@@ -8753,7 +9005,7 @@ const ProfileWidget = ({ config }) => {
|
|
|
8753
9005
|
// Get format options (using index access for widget-specific properties)
|
|
8754
9006
|
const format = widgetConfig['widget-data-format'] || {};
|
|
8755
9007
|
const imageSize = format.imageSize || 80;
|
|
8756
|
-
const nameColor = format.nameColor || '#
|
|
9008
|
+
const nameColor = format.nameColor || 'var(--owt-color-primary-dark, #F07B1A)';
|
|
8757
9009
|
const showIdLabel = format.showIdLabel !== false; // Default to true
|
|
8758
9010
|
// Generate a unique class ID for this widget instance
|
|
8759
9011
|
const widgetClassId = `profile-widget-${config['widget-id']}`;
|
|
@@ -8776,8 +9028,8 @@ const ProfileWidget = ({ config }) => {
|
|
|
8776
9028
|
height: ${imageSize}px;
|
|
8777
9029
|
border-radius: 8px;
|
|
8778
9030
|
object-fit: cover;
|
|
8779
|
-
background-color: #e5e7eb;
|
|
8780
|
-
border: 2px solid #d1d5db;
|
|
9031
|
+
background-color: var(--owt-color-border-light, #e5e7eb);
|
|
9032
|
+
border: 2px solid var(--owt-color-border, #d1d5db);
|
|
8781
9033
|
flex-shrink: 0;
|
|
8782
9034
|
}
|
|
8783
9035
|
|
|
@@ -8785,8 +9037,8 @@ const ProfileWidget = ({ config }) => {
|
|
|
8785
9037
|
width: ${imageSize}px;
|
|
8786
9038
|
height: ${imageSize}px;
|
|
8787
9039
|
border-radius: 8px;
|
|
8788
|
-
background-color: #e5e7eb;
|
|
8789
|
-
border: 2px solid #d1d5db;
|
|
9040
|
+
background-color: var(--owt-color-border-light, #e5e7eb);
|
|
9041
|
+
border: 2px solid var(--owt-color-border, #d1d5db);
|
|
8790
9042
|
display: flex;
|
|
8791
9043
|
align-items: center;
|
|
8792
9044
|
justify-content: center;
|
|
@@ -8827,12 +9079,12 @@ const ProfileWidget = ({ config }) => {
|
|
|
8827
9079
|
}
|
|
8828
9080
|
|
|
8829
9081
|
.${widgetClassId} .profile-id-label {
|
|
8830
|
-
color: #6b7280;
|
|
9082
|
+
color: var(--owt-color-text-muted, #6b7280);
|
|
8831
9083
|
font-weight: 500;
|
|
8832
9084
|
}
|
|
8833
9085
|
|
|
8834
9086
|
.${widgetClassId} .profile-id-value {
|
|
8835
|
-
color: #111827;
|
|
9087
|
+
color: var(--owt-color-text, #111827);
|
|
8836
9088
|
font-weight: 400;
|
|
8837
9089
|
}
|
|
8838
9090
|
` }), jsxRuntimeExports.jsxs("div", { className: widgetClassId, children: [jsxRuntimeExports.jsxs("div", { className: "profile-avatar-container", children: [imageUrl ? (jsxRuntimeExports.jsx("img", { src: imageUrl, alt: displayName || 'Profile', className: "profile-avatar", onError: (e) => {
|
|
@@ -8923,7 +9175,7 @@ const TextAreaWidget = ({ config }) => {
|
|
|
8923
9175
|
minHeight: `${rows * 1.5 * 14 + 16}px`, // Approximate height based on rows
|
|
8924
9176
|
} }), showCharCounter && (jsxRuntimeExports.jsx("div", { className: "absolute bottom-2 right-2 text-xs px-1 rounded", style: {
|
|
8925
9177
|
fontFamily: 'Roboto, sans-serif',
|
|
8926
|
-
color: maxLength && currentLength > maxLength ? '#EF4444' : '#6B7280',
|
|
9178
|
+
color: maxLength && currentLength > maxLength ? 'var(--owt-widget-error-color, #EF4444)' : 'var(--owt-widget-helptext-color, #6B7280)',
|
|
8927
9179
|
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
|
8928
9180
|
}, children: charCounterText }))] }), hasError && (jsxRuntimeExports.jsx("p", { className: "text-red-500 text-sm mt-1", children: errorMessage }))] })] }) }));
|
|
8929
9181
|
};
|
|
@@ -9070,7 +9322,7 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9070
9322
|
// ── Format options ────────────────────────────────────────────
|
|
9071
9323
|
const format = (widgetConfig['widget-data-format'] || {});
|
|
9072
9324
|
const imageSize = format.imageSize || 120;
|
|
9073
|
-
const nameColor = format.nameColor || '#
|
|
9325
|
+
const nameColor = format.nameColor || 'var(--owt-color-primary-dark, #F07B1A)';
|
|
9074
9326
|
const statusColors = {
|
|
9075
9327
|
...DEFAULT_STATUS_COLORS,
|
|
9076
9328
|
...(format.statusColors || {}),
|
|
@@ -9090,9 +9342,19 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9090
9342
|
const opt = statusOptions.find((o) => String(o.value).toLowerCase() === String(statusValue).toLowerCase());
|
|
9091
9343
|
return opt ? opt.label : String(statusValue);
|
|
9092
9344
|
}, [statusValue, statusOptions]);
|
|
9093
|
-
const statusColor = statusColors[String(statusValue).toLowerCase()] || '#6B7280';
|
|
9345
|
+
const statusColor = statusColors[String(statusValue).toLowerCase()] || 'var(--owt-color-text-muted, #6B7280)';
|
|
9094
9346
|
// ── Scoped class for CSS isolation ────────────────────────────
|
|
9095
9347
|
const cls = `header-section-widget-${widgetConfig['widget-id']}`;
|
|
9348
|
+
// ── Indicator dot component ───────────────────────────────────
|
|
9349
|
+
const Dot = ({ color }) => (jsxRuntimeExports.jsx("span", { style: {
|
|
9350
|
+
display: 'inline-block',
|
|
9351
|
+
width: 8,
|
|
9352
|
+
height: 8,
|
|
9353
|
+
borderRadius: '50%',
|
|
9354
|
+
backgroundColor: color,
|
|
9355
|
+
flexShrink: 0,
|
|
9356
|
+
marginTop: 6,
|
|
9357
|
+
} }));
|
|
9096
9358
|
// ── RENDER ────────────────────────────────────────────────────
|
|
9097
9359
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { children: `
|
|
9098
9360
|
.${cls} {
|
|
@@ -9126,8 +9388,8 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9126
9388
|
height: ${imageSize}px;
|
|
9127
9389
|
border-radius: 8px;
|
|
9128
9390
|
object-fit: cover;
|
|
9129
|
-
background-color: #e5e7eb;
|
|
9130
|
-
border: 2px solid #d1d5db;
|
|
9391
|
+
background-color: var(--owt-color-border-light, #e5e7eb);
|
|
9392
|
+
border: 2px solid var(--owt-color-border, #d1d5db);
|
|
9131
9393
|
flex-shrink: 0;
|
|
9132
9394
|
}
|
|
9133
9395
|
|
|
@@ -9135,8 +9397,8 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9135
9397
|
width: ${imageSize}px;
|
|
9136
9398
|
height: ${imageSize}px;
|
|
9137
9399
|
border-radius: 8px;
|
|
9138
|
-
background-color: #e5e7eb;
|
|
9139
|
-
border: 2px solid #d1d5db;
|
|
9400
|
+
background-color: var(--owt-color-border-light, #e5e7eb);
|
|
9401
|
+
border: 2px solid var(--owt-color-border, #d1d5db);
|
|
9140
9402
|
display: flex;
|
|
9141
9403
|
align-items: center;
|
|
9142
9404
|
justify-content: center;
|
|
@@ -9182,7 +9444,7 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9182
9444
|
}
|
|
9183
9445
|
|
|
9184
9446
|
.${cls} .hdr-field-value {
|
|
9185
|
-
color: #111827;
|
|
9447
|
+
color: var(--owt-color-text, #111827);
|
|
9186
9448
|
font-weight: 500;
|
|
9187
9449
|
}
|
|
9188
9450
|
|
|
@@ -9209,41 +9471,41 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9209
9471
|
}
|
|
9210
9472
|
|
|
9211
9473
|
.${cls} .hdr-meta-value {
|
|
9212
|
-
color: #111827;
|
|
9474
|
+
color: var(--owt-color-text, #111827);
|
|
9213
9475
|
font-weight: 500;
|
|
9214
9476
|
}
|
|
9215
9477
|
|
|
9216
9478
|
.${cls} .hdr-select {
|
|
9217
9479
|
height: 32px;
|
|
9218
9480
|
padding: 0 8px;
|
|
9219
|
-
border: 1px solid #d1d5db;
|
|
9481
|
+
border: 1px solid var(--owt-widget-input-border, #d1d5db);
|
|
9220
9482
|
border-radius: 6px;
|
|
9221
9483
|
font-size: 0.875rem;
|
|
9222
9484
|
font-family: Roboto, sans-serif;
|
|
9223
|
-
background: #fff;
|
|
9485
|
+
background: var(--owt-widget-input-bg, #fff);
|
|
9224
9486
|
min-width: 140px;
|
|
9225
|
-
color: #374151;
|
|
9487
|
+
color: var(--owt-btn-primary-color, #374151);
|
|
9226
9488
|
}
|
|
9227
9489
|
.${cls} .hdr-select:focus {
|
|
9228
9490
|
outline: none;
|
|
9229
|
-
border-color: #
|
|
9491
|
+
border-color: var(--owt-widget-input-focus-border, #F07B1A);
|
|
9230
9492
|
box-shadow: 0 0 0 2px rgba(237, 124, 34, 0.15);
|
|
9231
9493
|
}
|
|
9232
9494
|
|
|
9233
9495
|
.${cls} .hdr-input {
|
|
9234
9496
|
height: 32px;
|
|
9235
9497
|
padding: 0 8px;
|
|
9236
|
-
border: 1px solid #d1d5db;
|
|
9498
|
+
border: 1px solid var(--owt-widget-input-border, #d1d5db);
|
|
9237
9499
|
border-radius: 6px;
|
|
9238
9500
|
font-size: 0.875rem;
|
|
9239
9501
|
font-family: Roboto, sans-serif;
|
|
9240
|
-
background: #fff;
|
|
9502
|
+
background: var(--owt-widget-input-bg, #fff);
|
|
9241
9503
|
min-width: 140px;
|
|
9242
|
-
color: #374151;
|
|
9504
|
+
color: var(--owt-btn-primary-color, #374151);
|
|
9243
9505
|
}
|
|
9244
9506
|
.${cls} .hdr-input:focus {
|
|
9245
9507
|
outline: none;
|
|
9246
|
-
border-color: #
|
|
9508
|
+
border-color: var(--owt-widget-input-focus-border, #F07B1A);
|
|
9247
9509
|
box-shadow: 0 0 0 2px rgba(237, 124, 34, 0.15);
|
|
9248
9510
|
}
|
|
9249
9511
|
|
|
@@ -9261,7 +9523,255 @@ const HeaderSectionWidget = ({ config }) => {
|
|
|
9261
9523
|
.parentElement?.querySelector('.hdr-avatar-placeholder');
|
|
9262
9524
|
if (placeholder)
|
|
9263
9525
|
placeholder.style.display = 'flex';
|
|
9264
|
-
} })) : 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.jsxs("span", { className: "hdr-field-label", children: [getLabel('functionalId'), " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: functionalId || '-' })] }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsx("span", { className: "hdr-field-label", children: getLabel('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: getLabel('select') }), statusOptions.map((opt) => (jsxRuntimeExports.jsx("option", { value: opt.value, children: opt.label }, opt.value)))] }))] }), jsxRuntimeExports.jsxs("div", { className: "hdr-field-row", children: [jsxRuntimeExports.jsxs("span", { className: "hdr-field-label", children: [getLabel('statusReason'), " :"] }), isReadonly ? (jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: statusReason || '-' })) : (jsxRuntimeExports.jsx("input", { type: "text", className: "hdr-input", value: statusReason, placeholder: getLabel('enterReason'), 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: [getLabel('createdBy'), " :"] }), 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: [getLabel('createdAt'), " :"] }), 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: [getLabel('lastApprovedBy'), " :"] }), 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: [getLabel('lastApprovedAt'), " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: lastApprovedAt || '-' })] })] })] })] }));
|
|
9526
|
+
} })) : 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: [getLabel('functionalId'), " :"] }), 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: getLabel('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: getLabel('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: [getLabel('statusReason'), " :"] }), isReadonly ? (jsxRuntimeExports.jsx("span", { className: "hdr-field-value", children: statusReason || '-' })) : (jsxRuntimeExports.jsx("input", { type: "text", className: "hdr-input", value: statusReason, placeholder: getLabel('enterReason'), 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: [getLabel('createdBy'), " :"] }), 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: [getLabel('createdAt'), " :"] }), 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: [getLabel('lastApprovedBy'), " :"] }), 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: [getLabel('lastApprovedAt'), " :"] }), jsxRuntimeExports.jsx("span", { className: "hdr-meta-value", children: lastApprovedAt || '-' })] })] })] })] }));
|
|
9527
|
+
};
|
|
9528
|
+
|
|
9529
|
+
function tryFormatDateTime(value) {
|
|
9530
|
+
if (typeof value !== 'string' || !value)
|
|
9531
|
+
return value ? String(value) : '-';
|
|
9532
|
+
const d = new Date(value);
|
|
9533
|
+
if (Number.isNaN(d.getTime()))
|
|
9534
|
+
return value;
|
|
9535
|
+
try {
|
|
9536
|
+
return d.toLocaleString(undefined, {
|
|
9537
|
+
year: 'numeric',
|
|
9538
|
+
month: 'short',
|
|
9539
|
+
day: '2-digit',
|
|
9540
|
+
hour: '2-digit',
|
|
9541
|
+
minute: '2-digit',
|
|
9542
|
+
});
|
|
9543
|
+
}
|
|
9544
|
+
catch {
|
|
9545
|
+
return value;
|
|
9546
|
+
}
|
|
9547
|
+
}
|
|
9548
|
+
function pickLatestScore(scores) {
|
|
9549
|
+
if (!scores || scores.length === 0)
|
|
9550
|
+
return null;
|
|
9551
|
+
const withTime = scores
|
|
9552
|
+
.map((s) => {
|
|
9553
|
+
const t = typeof s?.computed_at === 'string' ? new Date(s.computed_at).getTime() : NaN;
|
|
9554
|
+
return { s, t };
|
|
9555
|
+
})
|
|
9556
|
+
.filter((x) => !Number.isNaN(x.t));
|
|
9557
|
+
if (withTime.length === 0)
|
|
9558
|
+
return scores[0] || null;
|
|
9559
|
+
withTime.sort((a, b) => b.t - a.t);
|
|
9560
|
+
return withTime[0]?.s || null;
|
|
9561
|
+
}
|
|
9562
|
+
/**
|
|
9563
|
+
* Scores Display Widget - full-width, view-only widget
|
|
9564
|
+
*
|
|
9565
|
+
* Expected config (reference):
|
|
9566
|
+
* {
|
|
9567
|
+
* "widget": "scores-display",
|
|
9568
|
+
* "widget-type": "group",
|
|
9569
|
+
* "widget-id": "record-scores",
|
|
9570
|
+
* "widget-data-source": {
|
|
9571
|
+
* "type": "api",
|
|
9572
|
+
* "service": "staff-portal-api",
|
|
9573
|
+
* "endpoint": "get_scores",
|
|
9574
|
+
* "method": "POST",
|
|
9575
|
+
* "params": { "internal_record_id_path": "internal_record_id" }
|
|
9576
|
+
* }
|
|
9577
|
+
* }
|
|
9578
|
+
*
|
|
9579
|
+
* The host's `dataSourceRequestHandler` is invoked with:
|
|
9580
|
+
* - service: config.widget-data-source.service
|
|
9581
|
+
* - endpoint: config.widget-data-source.endpoint
|
|
9582
|
+
* - method: config.widget-data-source.method (default POST)
|
|
9583
|
+
* - params: { internal_record_id: <resolved from internal_record_id_path> }
|
|
9584
|
+
*/
|
|
9585
|
+
const ScoresDisplayWidget = ({ config, dataSourceRequestHandler: propHandler, schemaData: propSchemaData, }) => {
|
|
9586
|
+
const { dataSourceRequestHandler: ctxHandler, schemaData: ctxSchemaData } = useWidgetContext();
|
|
9587
|
+
const handler = propHandler || ctxHandler;
|
|
9588
|
+
const schemaData = propSchemaData || ctxSchemaData || {};
|
|
9589
|
+
const values = useSelector((state) => state.widget.values);
|
|
9590
|
+
const api = config['widget-data-source'];
|
|
9591
|
+
const isApi = api?.type === 'api';
|
|
9592
|
+
const apiDs = isApi ? api : null;
|
|
9593
|
+
const internalIdPath = useMemo(() => {
|
|
9594
|
+
if (!apiDs)
|
|
9595
|
+
return undefined;
|
|
9596
|
+
const p = apiDs.params || {};
|
|
9597
|
+
const fromParams = p.internal_record_id_path || p.internalRecordIdPath;
|
|
9598
|
+
const fromConfig = typeof config.internal_record_id_path === 'string'
|
|
9599
|
+
? config.internal_record_id_path
|
|
9600
|
+
: undefined;
|
|
9601
|
+
return fromParams || fromConfig;
|
|
9602
|
+
}, [apiDs, config]);
|
|
9603
|
+
const internalRecordId = useMemo(() => {
|
|
9604
|
+
if (!internalIdPath)
|
|
9605
|
+
return undefined;
|
|
9606
|
+
const fromValues = getValueByPath(values || {}, internalIdPath);
|
|
9607
|
+
if (fromValues !== undefined && fromValues !== null && String(fromValues).trim() !== '') {
|
|
9608
|
+
return String(fromValues);
|
|
9609
|
+
}
|
|
9610
|
+
const fromSchema = getValueByPath(schemaData || {}, internalIdPath);
|
|
9611
|
+
if (fromSchema !== undefined && fromSchema !== null && String(fromSchema).trim() !== '') {
|
|
9612
|
+
return String(fromSchema);
|
|
9613
|
+
}
|
|
9614
|
+
return undefined;
|
|
9615
|
+
}, [internalIdPath, values, schemaData]);
|
|
9616
|
+
const [loading, setLoading] = useState(false);
|
|
9617
|
+
const [error, setError] = useState(null);
|
|
9618
|
+
const [response, setResponse] = useState(null);
|
|
9619
|
+
useEffect(() => {
|
|
9620
|
+
let cancelled = false;
|
|
9621
|
+
const load = async () => {
|
|
9622
|
+
if (!apiDs) {
|
|
9623
|
+
setError('Scores widget requires an API data source.');
|
|
9624
|
+
setResponse(null);
|
|
9625
|
+
return;
|
|
9626
|
+
}
|
|
9627
|
+
if (!handler) {
|
|
9628
|
+
setError(null);
|
|
9629
|
+
setResponse(null);
|
|
9630
|
+
return;
|
|
9631
|
+
}
|
|
9632
|
+
const service = apiDs.service;
|
|
9633
|
+
const endpoint = apiDs.endpoint;
|
|
9634
|
+
const method = apiDs.method || 'POST';
|
|
9635
|
+
if (!service || !endpoint) {
|
|
9636
|
+
setError('Scores widget API data source is missing service/endpoint.');
|
|
9637
|
+
setResponse(null);
|
|
9638
|
+
return;
|
|
9639
|
+
}
|
|
9640
|
+
if (!internalRecordId) {
|
|
9641
|
+
setError(null);
|
|
9642
|
+
setResponse(null);
|
|
9643
|
+
return;
|
|
9644
|
+
}
|
|
9645
|
+
try {
|
|
9646
|
+
setLoading(true);
|
|
9647
|
+
setError(null);
|
|
9648
|
+
const rawParams = apiDs.params || {};
|
|
9649
|
+
// Never pass the path helper through to the API.
|
|
9650
|
+
const { internal_record_id_path, internalRecordIdPath, ...rest } = rawParams;
|
|
9651
|
+
void internal_record_id_path;
|
|
9652
|
+
void internalRecordIdPath;
|
|
9653
|
+
const params = {
|
|
9654
|
+
...rest,
|
|
9655
|
+
internal_record_id: internalRecordId,
|
|
9656
|
+
};
|
|
9657
|
+
const res = await handler(service, endpoint, method, params, {
|
|
9658
|
+
headers: apiDs.headers,
|
|
9659
|
+
});
|
|
9660
|
+
if (cancelled)
|
|
9661
|
+
return;
|
|
9662
|
+
// Accept either direct payload or OpenG2P wrapper objects.
|
|
9663
|
+
const envelope = res && typeof res === 'object' ? res : null;
|
|
9664
|
+
const payload = envelope?.response_body?.response_payload ?? envelope?.data ?? res;
|
|
9665
|
+
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
9666
|
+
setResponse(payload);
|
|
9667
|
+
}
|
|
9668
|
+
else {
|
|
9669
|
+
setResponse({ scores: Array.isArray(payload) ? payload : [] });
|
|
9670
|
+
}
|
|
9671
|
+
}
|
|
9672
|
+
catch (e) {
|
|
9673
|
+
if (cancelled)
|
|
9674
|
+
return;
|
|
9675
|
+
const maybeErr = e;
|
|
9676
|
+
const msg = maybeErr && typeof maybeErr === 'object' && typeof maybeErr.message === 'string'
|
|
9677
|
+
? maybeErr.message
|
|
9678
|
+
: 'Failed to load scores.';
|
|
9679
|
+
setError(msg);
|
|
9680
|
+
setResponse(null);
|
|
9681
|
+
}
|
|
9682
|
+
finally {
|
|
9683
|
+
if (!cancelled)
|
|
9684
|
+
setLoading(false);
|
|
9685
|
+
}
|
|
9686
|
+
};
|
|
9687
|
+
load();
|
|
9688
|
+
return () => {
|
|
9689
|
+
cancelled = true;
|
|
9690
|
+
};
|
|
9691
|
+
}, [apiDs, handler, internalRecordId]);
|
|
9692
|
+
const latest = useMemo(() => pickLatestScore(response?.scores), [response]);
|
|
9693
|
+
const cls = `scores-display-widget-${config['widget-id']}`;
|
|
9694
|
+
const scoreType = latest?.score_type ? String(latest.score_type) : '-';
|
|
9695
|
+
const scoreValue = latest?.computed_score !== undefined && latest?.computed_score !== null && String(latest.computed_score) !== ''
|
|
9696
|
+
? String(latest.computed_score)
|
|
9697
|
+
: '-';
|
|
9698
|
+
const computedAt = tryFormatDateTime(latest?.computed_at);
|
|
9699
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { children: `
|
|
9700
|
+
.${cls} {
|
|
9701
|
+
width: 100%;
|
|
9702
|
+
font-family: Roboto, sans-serif;
|
|
9703
|
+
padding: 0;
|
|
9704
|
+
display: flex;
|
|
9705
|
+
flex-direction: column;
|
|
9706
|
+
gap: 8px;
|
|
9707
|
+
}
|
|
9708
|
+
|
|
9709
|
+
.${cls} .scores-subtle {
|
|
9710
|
+
font-size: 13px;
|
|
9711
|
+
color: var(--owt-color-text-muted, #727474);
|
|
9712
|
+
font-weight: 400;
|
|
9713
|
+
}
|
|
9714
|
+
|
|
9715
|
+
.${cls} .scores-card {
|
|
9716
|
+
width: 100%;
|
|
9717
|
+
border: none;
|
|
9718
|
+
border-radius: 0;
|
|
9719
|
+
background: transparent;
|
|
9720
|
+
padding: 0;
|
|
9721
|
+
display: grid;
|
|
9722
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
9723
|
+
gap: 16px;
|
|
9724
|
+
align-items: center;
|
|
9725
|
+
}
|
|
9726
|
+
|
|
9727
|
+
.${cls} .scores-col {
|
|
9728
|
+
min-width: 0;
|
|
9729
|
+
display: flex;
|
|
9730
|
+
flex-direction: column;
|
|
9731
|
+
gap: 6px;
|
|
9732
|
+
}
|
|
9733
|
+
|
|
9734
|
+
.${cls} .scores-label {
|
|
9735
|
+
font-size: 12px;
|
|
9736
|
+
color: var(--owt-color-text-muted, #727474);
|
|
9737
|
+
font-weight: 600;
|
|
9738
|
+
letter-spacing: 0.25px;
|
|
9739
|
+
text-transform: uppercase;
|
|
9740
|
+
}
|
|
9741
|
+
|
|
9742
|
+
.${cls} .scores-value {
|
|
9743
|
+
font-size: 16px;
|
|
9744
|
+
font-weight: 600;
|
|
9745
|
+
color: var(--owt-color-text, #011627);
|
|
9746
|
+
line-height: 1.25;
|
|
9747
|
+
word-break: break-word;
|
|
9748
|
+
}
|
|
9749
|
+
|
|
9750
|
+
.${cls} .scores-value--highlight {
|
|
9751
|
+
font-weight: 800;
|
|
9752
|
+
color: var(--owt-color-primary-dark, #F07B1A);
|
|
9753
|
+
}
|
|
9754
|
+
|
|
9755
|
+
.${cls} .scores-value-wrap {
|
|
9756
|
+
display: inline-flex;
|
|
9757
|
+
align-items: baseline;
|
|
9758
|
+
gap: 10px;
|
|
9759
|
+
flex-wrap: wrap;
|
|
9760
|
+
}
|
|
9761
|
+
|
|
9762
|
+
.${cls} .scores-value-badge { display: inline; }
|
|
9763
|
+
|
|
9764
|
+
.${cls} .scores-statusline {
|
|
9765
|
+
grid-column: 1 / -1;
|
|
9766
|
+
margin-top: 2px;
|
|
9767
|
+
}
|
|
9768
|
+
|
|
9769
|
+
@media (max-width: 768px) {
|
|
9770
|
+
.${cls} .scores-card {
|
|
9771
|
+
grid-template-columns: 1fr;
|
|
9772
|
+
}
|
|
9773
|
+
}
|
|
9774
|
+
` }), jsxRuntimeExports.jsx("div", { className: cls, children: jsxRuntimeExports.jsxs("div", { className: "scores-card", children: [jsxRuntimeExports.jsxs("div", { className: "scores-col", "aria-live": "polite", children: [jsxRuntimeExports.jsx("div", { className: "scores-label", children: "Score Type" }), jsxRuntimeExports.jsx("div", { className: "scores-value-wrap", children: jsxRuntimeExports.jsx("span", { className: "scores-value-badge", children: jsxRuntimeExports.jsx("span", { className: "scores-value scores-value--highlight", children: scoreType }) }) })] }), jsxRuntimeExports.jsxs("div", { className: "scores-col", children: [jsxRuntimeExports.jsx("div", { className: "scores-label", children: "Score" }), jsxRuntimeExports.jsx("div", { className: "scores-value-wrap", children: jsxRuntimeExports.jsx("span", { className: "scores-value-badge", children: jsxRuntimeExports.jsx("span", { className: "scores-value scores-value--highlight", children: scoreValue }) }) })] }), jsxRuntimeExports.jsxs("div", { className: "scores-col", children: [jsxRuntimeExports.jsx("div", { className: "scores-label", children: "Computed at" }), jsxRuntimeExports.jsx("div", { className: "scores-value", children: computedAt })] }), jsxRuntimeExports.jsx("div", { className: "scores-statusline", children: loading ? (jsxRuntimeExports.jsx("div", { className: "scores-subtle", children: "Loading scores\u2026" })) : error ? (jsxRuntimeExports.jsx("div", { className: "scores-subtle", style: { color: 'var(--owt-color-error, #B91C1C)' }, children: error })) : !latest ? (jsxRuntimeExports.jsx("div", { className: "scores-subtle", children: "No scores available." })) : null })] }) })] }));
|
|
9265
9775
|
};
|
|
9266
9776
|
|
|
9267
9777
|
/**
|
|
@@ -9305,6 +9815,8 @@ const registerDefaultWidgets = () => {
|
|
|
9305
9815
|
widgetRegistry.register({ widget: 'profile', component: ProfileWidget });
|
|
9306
9816
|
// Header section widget for full-width registry header with profile, status, and metadata
|
|
9307
9817
|
widgetRegistry.register({ widget: 'header-section', component: HeaderSectionWidget });
|
|
9818
|
+
// Scores display widget for full-width computed scores display (view-only)
|
|
9819
|
+
widgetRegistry.register({ widget: 'scores-display', component: ScoresDisplayWidget });
|
|
9308
9820
|
};
|
|
9309
9821
|
// Auto-register on import
|
|
9310
9822
|
registerDefaultWidgets();
|
|
@@ -9666,5 +10178,5 @@ const translateUISchema = (schema, translate) => {
|
|
|
9666
10178
|
};
|
|
9667
10179
|
};
|
|
9668
10180
|
|
|
9669
|
-
export { ArrayWidget, BooleanWidget, CheckboxWidget, CurrencyInputWidget, DateInputWidget, DateTimeInputWidget, DisplayWidget, FileInputWidget, HeaderSectionWidget, IterableAccordionWidget, JSONEditorPanel, NumberInputWidget, PanelRenderer, PhoneInputWidget, ProfileWidget, PropertyEditor, RadioWidget, SectionBuilder, SectionRenderer, SectionTree, SectionsContainer, SelectWidget, SimpleTableWidget, TableWidget, TextAreaWidget, TextInputWidget, VisualBuilderPanel, WidgetEventBus, WidgetProvider, WidgetRenderer, applyCaseControl, applyDecimalPrecision, applyMask, createWidgetStore, createZodSchema, evaluateCondition, filterByCharacterType, formatCurrency, formatDate, formatNumber, formatPhone, formatValue, geoHierarchyBuilder, getApiDataSource, getFormattedNumberLength, getSchemaDataSource, getStaticDataSource, getValueByPath, getWidgetValue, initI18n, isAllowedKey, parseDataPath, parseNumber, registerDefaultWidgets, removeMask, resetAll, resetWidget, setDataSource, setError, setLoading, setTouched, setValue, setValueByPath, setValues, setWidgetValue, shouldEnableWidget, shouldShowWidget, transformDataSourceOptions, translatePanelConfig, translateUISchema, translateWidgetConfig, useBaseWidget, useGeoWidgetCascade, useWidgetCascade, useWidgetContext, useWidgetEventBus, useWidgetTranslation, validateNumericValue, validateWidget, widgetRegistry };
|
|
10181
|
+
export { ArrayWidget, BooleanWidget, CheckboxWidget, CurrencyInputWidget, DateInputWidget, DateTimeInputWidget, DisplayWidget, FileInputWidget, HeaderSectionWidget, IterableAccordionWidget, JSONEditorPanel, NumberInputWidget, PanelRenderer, PhoneInputWidget, ProfileWidget, PropertyEditor, RadioWidget, ScoresDisplayWidget, SectionBuilder, SectionRenderer, SectionTree, SectionsContainer, SelectWidget, SimpleTableWidget, TableWidget, TextAreaWidget, TextInputWidget, VisualBuilderPanel, WidgetEventBus, WidgetProvider, WidgetRenderer, applyCaseControl, applyDecimalPrecision, applyMask, createWidgetStore, createZodSchema, defaultTheme, evaluateCondition, filterByCharacterType, formatCurrency, formatDate, formatNumber, formatPhone, formatValue, geoHierarchyBuilder, getApiDataSource, getFormattedNumberLength, getSchemaDataSource, getStaticDataSource, getValueByPath, getWidgetValue, initI18n, isAllowedKey, parseDataPath, parseNumber, registerDefaultWidgets, removeMask, resetAll, resetWidget, resolveTheme, setDataSource, setError, setLoading, setTouched, setValue, setValueByPath, setValues, setWidgetValue, shouldEnableWidget, shouldShowWidget, transformDataSourceOptions, translatePanelConfig, translateUISchema, translateWidgetConfig, useBaseWidget, useGeoWidgetCascade, useWidgetCascade, useWidgetContext, useWidgetEventBus, useWidgetTheme, useWidgetTranslation, validateNumericValue, validateWidget, widgetRegistry };
|
|
9670
10182
|
//# sourceMappingURL=index.esm.js.map
|