@visns-studio/visns-components 5.14.12 → 5.14.13
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/package.json +2 -2
- package/src/components/DataGrid.jsx +51 -0
package/package.json
CHANGED
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
90
90
|
},
|
|
91
91
|
"name": "@visns-studio/visns-components",
|
|
92
|
-
"version": "5.14.
|
|
92
|
+
"version": "5.14.13",
|
|
93
93
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
94
94
|
"main": "src/index.js",
|
|
95
95
|
"files": [
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"type": "git",
|
|
105
105
|
"url": "git+https://github.com/visnsstudio/visns-components.git"
|
|
106
106
|
},
|
|
107
|
-
"author": "
|
|
107
|
+
"author": "Omnia Global",
|
|
108
108
|
"license": "ISC",
|
|
109
109
|
"bugs": {
|
|
110
110
|
"url": "https://github.com/visnsstudio/visns-components/issues"
|
|
@@ -70,6 +70,7 @@ import {
|
|
|
70
70
|
Archive,
|
|
71
71
|
Volume2,
|
|
72
72
|
AlertTriangle,
|
|
73
|
+
AlertCircle,
|
|
73
74
|
} from 'lucide-react';
|
|
74
75
|
import styles from './styles/DataGrid.module.scss';
|
|
75
76
|
|
|
@@ -3282,6 +3283,39 @@ const DataGrid = forwardRef(
|
|
|
3282
3283
|
groupData?.name ||
|
|
3283
3284
|
'';
|
|
3284
3285
|
|
|
3286
|
+
// Check for important marker
|
|
3287
|
+
const checkGroupImportantMarker = (groupValue, importantMarkerConfig) => {
|
|
3288
|
+
if (!importantMarkerConfig || !dataRef.current?.length || !ajaxSetting?.groupBy) {
|
|
3289
|
+
return false;
|
|
3290
|
+
}
|
|
3291
|
+
|
|
3292
|
+
const { id: fieldId, value: expectedValue } = importantMarkerConfig;
|
|
3293
|
+
const groupField = ajaxSetting.groupBy[0];
|
|
3294
|
+
|
|
3295
|
+
// Get all rows that belong to this group
|
|
3296
|
+
const groupRows = dataRef.current.filter(
|
|
3297
|
+
(row) => row[groupField] === groupValue
|
|
3298
|
+
);
|
|
3299
|
+
|
|
3300
|
+
return groupRows.some(row => {
|
|
3301
|
+
const fieldValue = row[fieldId];
|
|
3302
|
+
|
|
3303
|
+
// Handle different value types
|
|
3304
|
+
if (typeof expectedValue === 'boolean') {
|
|
3305
|
+
return Boolean(fieldValue) === expectedValue;
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3308
|
+
return fieldValue === expectedValue;
|
|
3309
|
+
});
|
|
3310
|
+
};
|
|
3311
|
+
|
|
3312
|
+
const hasImportantMarker = checkGroupImportantMarker(
|
|
3313
|
+
groupValue,
|
|
3314
|
+
ajaxSetting?.groupBySetting?.importantMarker
|
|
3315
|
+
);
|
|
3316
|
+
const importantMarkerColor = ajaxSetting?.groupBySetting?.importantMarker?.colour;
|
|
3317
|
+
const importantMarkerTooltip = ajaxSetting?.groupBySetting?.importantMarker?.tooltip || "This group contains items that require attention";
|
|
3318
|
+
|
|
3285
3319
|
// Use ReactDataGrid's built-in toggle functionality
|
|
3286
3320
|
const collapsed =
|
|
3287
3321
|
collapsedGroups[groupValue] ||
|
|
@@ -3534,6 +3568,23 @@ const DataGrid = forwardRef(
|
|
|
3534
3568
|
}
|
|
3535
3569
|
>
|
|
3536
3570
|
{groupValue}
|
|
3571
|
+
{/* Important marker */}
|
|
3572
|
+
{hasImportantMarker && (
|
|
3573
|
+
<AlertCircle
|
|
3574
|
+
className="important-marker"
|
|
3575
|
+
style={{
|
|
3576
|
+
display: 'inline-block',
|
|
3577
|
+
marginLeft: '8px',
|
|
3578
|
+
color: importantMarkerColor || '#FF6961',
|
|
3579
|
+
position: 'relative',
|
|
3580
|
+
top: '1px'
|
|
3581
|
+
}}
|
|
3582
|
+
size={16}
|
|
3583
|
+
title={importantMarkerTooltip}
|
|
3584
|
+
data-tooltip-id="system-tooltip"
|
|
3585
|
+
data-tooltip-content={importantMarkerTooltip}
|
|
3586
|
+
/>
|
|
3587
|
+
)}
|
|
3537
3588
|
</strong>
|
|
3538
3589
|
{/* Click indicator */}
|
|
3539
3590
|
<span
|