@visns-studio/visns-components 6.0.1 → 6.0.2
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 +1 -1
- package/src/components/DataGrid.jsx +47 -2
package/package.json
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
92
92
|
},
|
|
93
93
|
"name": "@visns-studio/visns-components",
|
|
94
|
-
"version": "6.0.
|
|
94
|
+
"version": "6.0.2",
|
|
95
95
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
96
96
|
"main": "src/index.js",
|
|
97
97
|
"files": [
|
|
@@ -2403,23 +2403,68 @@ const DataGrid = forwardRef(
|
|
|
2403
2403
|
}
|
|
2404
2404
|
}, '');
|
|
2405
2405
|
|
|
2406
|
-
|
|
2406
|
+
let iconData = config.icons.find(
|
|
2407
2407
|
(icon) => icon.value === fieldValue
|
|
2408
2408
|
);
|
|
2409
2409
|
|
|
2410
|
+
// An icon marked fallback: true matches any non-empty value
|
|
2411
|
+
// that no explicit entry matched (e.g. "any country other
|
|
2412
|
+
// than Australia" → international icon).
|
|
2413
|
+
if (
|
|
2414
|
+
!iconData &&
|
|
2415
|
+
fieldValue !== '' &&
|
|
2416
|
+
fieldValue != null &&
|
|
2417
|
+
fieldValue !== 0
|
|
2418
|
+
) {
|
|
2419
|
+
iconData = config.icons.find(
|
|
2420
|
+
(icon) => icon.fallback === true
|
|
2421
|
+
);
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2410
2424
|
if (
|
|
2411
2425
|
iconData &&
|
|
2412
2426
|
(iconData.src || iconData.icon) &&
|
|
2413
2427
|
iconData.alt &&
|
|
2414
2428
|
iconData.tooltipContent
|
|
2415
2429
|
) {
|
|
2430
|
+
// tooltipFrom: path into the row data whose value (when
|
|
2431
|
+
// present) replaces the static tooltip — e.g. show the
|
|
2432
|
+
// actual country name on the international icon. Optional
|
|
2433
|
+
// tooltipPrefix is prepended to the resolved value.
|
|
2434
|
+
let tooltipContent = iconData.tooltipContent;
|
|
2435
|
+
if (Array.isArray(iconData.tooltipFrom)) {
|
|
2436
|
+
const resolved = iconData.tooltipFrom.reduce(
|
|
2437
|
+
(acc, id) => (acc == null ? acc : acc[id]),
|
|
2438
|
+
data
|
|
2439
|
+
);
|
|
2440
|
+
if (resolved != null && resolved !== '') {
|
|
2441
|
+
tooltipContent = `${
|
|
2442
|
+
iconData.tooltipPrefix || ''
|
|
2443
|
+
}${resolved}`;
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2416
2447
|
addIcon(
|
|
2417
2448
|
iconData.src ? iconData.src : null,
|
|
2418
2449
|
iconData.icon ? iconData.icon : null,
|
|
2419
2450
|
iconData.alt,
|
|
2420
|
-
|
|
2451
|
+
tooltipContent,
|
|
2421
2452
|
`coding-${config.id[0]}-${configKey}`
|
|
2422
2453
|
);
|
|
2454
|
+
} else {
|
|
2455
|
+
// Empty placeholder slot so every config group occupies a
|
|
2456
|
+
// fixed position — icons align vertically across rows.
|
|
2457
|
+
icons.push(
|
|
2458
|
+
<div
|
|
2459
|
+
key={`coding-slot-${config.id[0]}-${configKey}`}
|
|
2460
|
+
style={{
|
|
2461
|
+
display: 'inline-flex',
|
|
2462
|
+
width: '28px',
|
|
2463
|
+
height: '28px',
|
|
2464
|
+
margin: '0 1px',
|
|
2465
|
+
}}
|
|
2466
|
+
/>
|
|
2467
|
+
);
|
|
2423
2468
|
}
|
|
2424
2469
|
});
|
|
2425
2470
|
|