@visns-studio/visns-components 5.11.16 → 5.11.18
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
CHANGED
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
88
88
|
},
|
|
89
89
|
"name": "@visns-studio/visns-components",
|
|
90
|
-
"version": "5.11.
|
|
90
|
+
"version": "5.11.18",
|
|
91
91
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
92
92
|
"main": "src/index.js",
|
|
93
93
|
"files": [
|
|
@@ -2639,15 +2639,31 @@ const DataGrid = forwardRef(
|
|
|
2639
2639
|
? column.id.join('-')
|
|
2640
2640
|
: column.id;
|
|
2641
2641
|
|
|
2642
|
+
// Auto-detect columns that should have word wrap enabled
|
|
2643
|
+
const shouldAutoEnableWordWrap =
|
|
2644
|
+
column.wordWrap !== false && // Allow explicit disable with wordWrap: false
|
|
2645
|
+
(
|
|
2646
|
+
// Text-heavy column patterns
|
|
2647
|
+
/^(task|description|notes?|comments?|content|message|details?|summary|reason|remarks?)$/i.test(columnId) ||
|
|
2648
|
+
/.*_(task|description|notes?|comments?|content|message|details?|summary|reason|remarks?)$/i.test(columnId) ||
|
|
2649
|
+
/(task|description|notes?|comments?|content|message|details?|summary|reason|remarks?)_.*$/i.test(columnId) ||
|
|
2650
|
+
// Check for long labels that might indicate text content
|
|
2651
|
+
(column.label && column.label.length > 15 && /description|notes|comments|details|content/i.test(column.label))
|
|
2652
|
+
);
|
|
2653
|
+
|
|
2654
|
+
const finalWordWrap = column.wordWrap === true || shouldAutoEnableWordWrap;
|
|
2655
|
+
|
|
2656
|
+
// Debug logging for word wrap detection
|
|
2657
|
+
if (shouldAutoEnableWordWrap && column.wordWrap !== true) {
|
|
2658
|
+
console.log(`DataGrid: Auto-enabled wordWrap for column "${columnId}" (${column.label})`);
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2642
2661
|
return {
|
|
2643
2662
|
...commonProps,
|
|
2644
2663
|
name: columnId,
|
|
2645
2664
|
filterEditor: filterEditor,
|
|
2646
2665
|
filterEditorProps: filterEditorProps,
|
|
2647
|
-
className:
|
|
2648
|
-
column.wordWrap === true
|
|
2649
|
-
? 'cell-word-wrap'
|
|
2650
|
-
: '',
|
|
2666
|
+
className: finalWordWrap ? 'cell-word-wrap' : '',
|
|
2651
2667
|
render: ({ data }) => {
|
|
2652
2668
|
if (
|
|
2653
2669
|
data &&
|
|
@@ -2711,9 +2727,7 @@ const DataGrid = forwardRef(
|
|
|
2711
2727
|
<CellWithTooltip
|
|
2712
2728
|
value={data[column.id]}
|
|
2713
2729
|
columnType="text"
|
|
2714
|
-
wordWrap={
|
|
2715
|
-
column.wordWrap === true
|
|
2716
|
-
}
|
|
2730
|
+
wordWrap={finalWordWrap}
|
|
2717
2731
|
>
|
|
2718
2732
|
<span>
|
|
2719
2733
|
{parse(content)}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { createPortal } from 'react-dom';
|
|
3
2
|
import { Tooltip } from 'react-tooltip';
|
|
4
3
|
import moment from 'moment';
|
|
5
4
|
import numeral from 'numeral';
|
|
@@ -13,6 +12,7 @@ const isTextTruncated = (element) => {
|
|
|
13
12
|
);
|
|
14
13
|
};
|
|
15
14
|
|
|
15
|
+
|
|
16
16
|
// Utility function to format cell value for tooltip display
|
|
17
17
|
const formatCellValueForTooltip = (value, columnType) => {
|
|
18
18
|
if (value === null || value === undefined || value === '') {
|
|
@@ -70,12 +70,46 @@ const CellWithTooltip = ({
|
|
|
70
70
|
// Check truncation on mount and when content changes
|
|
71
71
|
checkTruncation();
|
|
72
72
|
|
|
73
|
-
//
|
|
74
|
-
const
|
|
73
|
+
// Use intersection observer to re-check when cell becomes visible (helps with scrolling)
|
|
74
|
+
const observer = new IntersectionObserver(
|
|
75
|
+
(entries) => {
|
|
76
|
+
entries.forEach((entry) => {
|
|
77
|
+
if (entry.isIntersecting) {
|
|
78
|
+
// Small delay to ensure layout is complete
|
|
79
|
+
setTimeout(checkTruncation, 10);
|
|
80
|
+
} else {
|
|
81
|
+
// Hide tooltip when cell is out of view
|
|
82
|
+
setShowTooltip(false);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
threshold: 0.1,
|
|
88
|
+
rootMargin: '50px' // Add margin to prevent premature hiding
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
if (cellRef.current) {
|
|
93
|
+
observer.observe(cellRef.current);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Also check on window resize and scroll
|
|
97
|
+
const handleResize = () => setTimeout(checkTruncation, 10);
|
|
98
|
+
const handleScroll = () => setTimeout(checkTruncation, 10);
|
|
99
|
+
|
|
75
100
|
window.addEventListener('resize', handleResize);
|
|
101
|
+
// Listen to scroll events on the grid container
|
|
102
|
+
const gridContainer = cellRef.current?.closest('.InovuaReactDataGrid');
|
|
103
|
+
if (gridContainer) {
|
|
104
|
+
gridContainer.addEventListener('scroll', handleScroll);
|
|
105
|
+
}
|
|
76
106
|
|
|
77
107
|
return () => {
|
|
108
|
+
observer.disconnect();
|
|
78
109
|
window.removeEventListener('resize', handleResize);
|
|
110
|
+
if (gridContainer) {
|
|
111
|
+
gridContainer.removeEventListener('scroll', handleScroll);
|
|
112
|
+
}
|
|
79
113
|
};
|
|
80
114
|
}, [children, value]);
|
|
81
115
|
|
|
@@ -104,8 +138,8 @@ const CellWithTooltip = ({
|
|
|
104
138
|
width: '100%',
|
|
105
139
|
};
|
|
106
140
|
|
|
107
|
-
// Render tooltip
|
|
108
|
-
const tooltipPortal = shouldShowTooltip &&
|
|
141
|
+
// Render tooltip with improved positioning
|
|
142
|
+
const tooltipPortal = shouldShowTooltip && (
|
|
109
143
|
<Tooltip
|
|
110
144
|
id={tooltipId}
|
|
111
145
|
style={{
|
|
@@ -116,12 +150,21 @@ const CellWithTooltip = ({
|
|
|
116
150
|
fontSize: '13px',
|
|
117
151
|
maxWidth: '500px',
|
|
118
152
|
wordWrap: 'break-word',
|
|
119
|
-
zIndex:
|
|
153
|
+
zIndex: 999999,
|
|
154
|
+
position: 'fixed', // Ensure fixed positioning for proper calculation
|
|
120
155
|
}}
|
|
121
156
|
place="top"
|
|
122
|
-
offset={
|
|
123
|
-
|
|
124
|
-
|
|
157
|
+
offset={8}
|
|
158
|
+
float={false} // Prevent floating behavior that can cause displacement
|
|
159
|
+
clickable={false} // Prevent click interference
|
|
160
|
+
delayShow={300} // Small delay to prevent accidental shows
|
|
161
|
+
delayHide={100}
|
|
162
|
+
noArrow={false}
|
|
163
|
+
variant="dark"
|
|
164
|
+
className="cell-tooltip"
|
|
165
|
+
positionStrategy="fixed" // Use fixed positioning strategy
|
|
166
|
+
fallbackPlacements={['bottom', 'right', 'left']} // Fallback positions if top doesn't fit
|
|
167
|
+
/>
|
|
125
168
|
);
|
|
126
169
|
|
|
127
170
|
return (
|
|
@@ -133,6 +176,8 @@ const CellWithTooltip = ({
|
|
|
133
176
|
{...(shouldShowTooltip && {
|
|
134
177
|
'data-tooltip-id': tooltipId,
|
|
135
178
|
'data-tooltip-html': tooltipContent,
|
|
179
|
+
'data-tooltip-place': 'top',
|
|
180
|
+
'data-tooltip-offset': '8',
|
|
136
181
|
})}
|
|
137
182
|
>
|
|
138
183
|
{children}
|
|
@@ -195,7 +195,7 @@
|
|
|
195
195
|
/* Media queries for responsive design */
|
|
196
196
|
|
|
197
197
|
/* Tablet view (961px to 1024px) - Keep filter expanded in left container */
|
|
198
|
-
@media (max-width: 1024px) and (min-width:
|
|
198
|
+
@media (max-width: 1024px) and (min-width: 760px) {
|
|
199
199
|
/* Ensure filter remains visible and properly styled for tablets */
|
|
200
200
|
.tableFilter {
|
|
201
201
|
display: block;
|
|
@@ -224,7 +224,7 @@
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
/* Phone view (960px and below) - Use hamburger menu when navigation moves to top */
|
|
227
|
-
@media (max-width:
|
|
227
|
+
@media (max-width: 759px) {
|
|
228
228
|
.mobileToggle {
|
|
229
229
|
display: flex;
|
|
230
230
|
}
|
|
@@ -12,6 +12,22 @@ div[role="tooltip"],
|
|
|
12
12
|
position: fixed !important;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/* Specific styles for cell tooltips to prevent positioning issues */
|
|
16
|
+
.cell-tooltip {
|
|
17
|
+
position: fixed !important;
|
|
18
|
+
z-index: 999999 !important;
|
|
19
|
+
pointer-events: none !important; /* Prevent tooltip from interfering with mouse events */
|
|
20
|
+
max-width: 500px !important;
|
|
21
|
+
word-wrap: break-word !important;
|
|
22
|
+
white-space: normal !important;
|
|
23
|
+
line-height: 1.4 !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Ensure cell tooltip arrow positioning works correctly */
|
|
27
|
+
.cell-tooltip .react-tooltip-arrow {
|
|
28
|
+
position: absolute !important;
|
|
29
|
+
}
|
|
30
|
+
|
|
15
31
|
.InovuaReactDataGrid__header-wrapper {
|
|
16
32
|
border-top-left-radius: var(--br, 4px) !important;
|
|
17
33
|
border-top-right-radius: var(--br, 4px) !important;
|
|
@@ -46,7 +62,12 @@ div[role="tooltip"],
|
|
|
46
62
|
text-overflow: unset !important; /* Disable text truncation */
|
|
47
63
|
overflow: visible !important; /* Show wrapped content */
|
|
48
64
|
height: auto !important; /* Allow cell to expand vertically */
|
|
49
|
-
min-height:
|
|
65
|
+
min-height: 40px !important; /* Increased minimum height for better spacing */
|
|
66
|
+
line-height: 1.4 !important; /* Better line spacing for readability */
|
|
67
|
+
padding: 10px 8px !important; /* Increased vertical padding for multi-line content */
|
|
68
|
+
vertical-align: top !important; /* Align content to top for multi-line cells */
|
|
69
|
+
display: flex !important; /* Use flexbox for better content alignment */
|
|
70
|
+
align-items: flex-start !important; /* Align content to top */
|
|
50
71
|
}
|
|
51
72
|
|
|
52
73
|
/* Default cell behavior - no word wrap */
|