ui-soxo-bootstrap-core 2.6.1-dev.14 → 2.6.1-dev.15
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.
|
@@ -25,11 +25,15 @@ function getExportDefinition(entry, record) {
|
|
|
25
25
|
* @param {Array} root0.columns
|
|
26
26
|
* @param {Array} root0.patients
|
|
27
27
|
* @param {boolean} root0.isFixedIndex
|
|
28
|
-
* @param {Object} root0.CustomComponents
|
|
28
|
+
* @param {Object.<string, React.ComponentType<any>>} root0.CustomComponents
|
|
29
29
|
* @param {Function} root0.refresh
|
|
30
|
+
* @param {Object} [root0.otherDetails={}] - Optional details from the report configuration.
|
|
31
|
+
* @param {boolean} [root0.otherDetails.isFilterEnabled] - Fallback to enable filtering on all columns.
|
|
32
|
+
* @param {boolean} [root.otherDetails.isSortingEnabled] - Fallback to enable sorting on all columns.
|
|
33
|
+
* @param {boolean} [root0.otherDetails.isHeaderWrapEnabled] - Fallback to enable header text wrapping for all columns.
|
|
30
34
|
* @returns {Array}
|
|
31
35
|
*/
|
|
32
|
-
export default function buildDisplayColumns({ columns = [], patients = [], isFixedIndex, CustomComponents, refresh }) {
|
|
36
|
+
export default function buildDisplayColumns({ columns = [], patients = [], isFixedIndex, CustomComponents, refresh, otherDetails = {} }) {
|
|
33
37
|
const displayColumns = [
|
|
34
38
|
{
|
|
35
39
|
title: '#',
|
|
@@ -42,6 +46,12 @@ export default function buildDisplayColumns({ columns = [], patients = [], isFix
|
|
|
42
46
|
];
|
|
43
47
|
|
|
44
48
|
columns.forEach((entry, index) => {
|
|
49
|
+
const isFilterEnabled = entry.isFilterEnabled || otherDetails?.isFilterEnabled;
|
|
50
|
+
const isSortingEnabled = entry.isSortingEnabled || otherDetails?.isSortingEnabled;
|
|
51
|
+
const isHeaderWrapEnabled = otherDetails?.isHeaderWrapEnabled;
|
|
52
|
+
|
|
53
|
+
const titleStyle = isHeaderWrapEnabled ? { whiteSpace: 'pre-wrap', overflowWrap: 'break-word' } : {};
|
|
54
|
+
|
|
45
55
|
displayColumns.push({
|
|
46
56
|
render: (record) =>
|
|
47
57
|
renderDisplayCell({
|
|
@@ -52,20 +62,26 @@ export default function buildDisplayColumns({ columns = [], patients = [], isFix
|
|
|
52
62
|
}),
|
|
53
63
|
field: entry.field,
|
|
54
64
|
title: (
|
|
55
|
-
<Tooltip
|
|
56
|
-
|
|
65
|
+
<Tooltip
|
|
66
|
+
title={entry.tooltip || entry.title}
|
|
67
|
+
overlayInnerStyle={{
|
|
68
|
+
whiteSpace: 'normal',
|
|
69
|
+
overflowWrap: 'break-word',
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
<span style={titleStyle}>{entry.title}</span>
|
|
57
73
|
</Tooltip>
|
|
58
74
|
),
|
|
59
75
|
key: entry.field || `display_column_${index}`,
|
|
60
76
|
width: entry.width ? parseInt(entry.width, 10) : 160,
|
|
61
77
|
fixed: entry.isFixedColumn ? entry.isFixedColumn : null,
|
|
62
78
|
filters:
|
|
63
|
-
|
|
79
|
+
isFilterEnabled && Array.isArray(patients)
|
|
64
80
|
? [...new Set(patients.map((item) => item[entry.field]).filter(Boolean))].map((value) => ({ text: value, value }))
|
|
65
81
|
: null,
|
|
66
|
-
onFilter:
|
|
67
|
-
sorter:
|
|
68
|
-
filterSearch:
|
|
82
|
+
onFilter: isFilterEnabled ? (value, record) => record[entry.field] === value : null,
|
|
83
|
+
sorter: isSortingEnabled ? (a, b) => String(a[entry.field] ?? '').localeCompare(String(b[entry.field] ?? '')) : null,
|
|
84
|
+
filterSearch: !!isFilterEnabled,
|
|
69
85
|
exportDefinition: (record) => getExportDefinition(entry, record),
|
|
70
86
|
align: entry.type === 'number' ? 'right' : 'left',
|
|
71
87
|
});
|
|
@@ -723,6 +723,7 @@ function GuestList({
|
|
|
723
723
|
const { isMobile, dispatch } = useContext(GlobalContext);
|
|
724
724
|
const [single, setSingle] = useState({});
|
|
725
725
|
|
|
726
|
+
const otherDetails = config.other_details1 ? JSON.parse(config.other_details1) : {};
|
|
726
727
|
// const [view, setView] = useState(isMobile ? true : false); //Need to check this condition
|
|
727
728
|
const cols = buildDisplayColumns({
|
|
728
729
|
columns,
|
|
@@ -730,6 +731,7 @@ function GuestList({
|
|
|
730
731
|
isFixedIndex,
|
|
731
732
|
CustomComponents,
|
|
732
733
|
refresh,
|
|
734
|
+
otherDetails,
|
|
733
735
|
});
|
|
734
736
|
|
|
735
737
|
/**
|