@visns-studio/visns-components 5.9.10 → 5.9.12
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/crm/DataGrid.jsx +58 -10
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.9.
|
|
90
|
+
"version": "5.9.12",
|
|
91
91
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
92
92
|
"main": "src/index.js",
|
|
93
93
|
"files": [
|
|
@@ -87,6 +87,7 @@ import Form from './Form';
|
|
|
87
87
|
import _ from 'lodash';
|
|
88
88
|
|
|
89
89
|
// CSS styles to ensure consistent group header heights with compact design and click indicators
|
|
90
|
+
// Also includes improved multi-line content handling for data rows
|
|
90
91
|
const groupHeaderStyles = `
|
|
91
92
|
.datagrid-fixed-group-headers .group-header-fixed-height {
|
|
92
93
|
height: 34px !important;
|
|
@@ -168,6 +169,31 @@ const groupHeaderStyles = `
|
|
|
168
169
|
min-height: 34px !important;
|
|
169
170
|
max-height: 34px !important;
|
|
170
171
|
}
|
|
172
|
+
|
|
173
|
+
/* Enhanced multi-line content support for data cells */
|
|
174
|
+
.InovuaReactDataGrid__cell {
|
|
175
|
+
word-wrap: break-word;
|
|
176
|
+
white-space: pre-wrap;
|
|
177
|
+
line-height: 1.3;
|
|
178
|
+
padding: 4px 8px;
|
|
179
|
+
vertical-align: top;
|
|
180
|
+
min-height: 32px;
|
|
181
|
+
display: flex;
|
|
182
|
+
align-items: flex-start;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* Ensure cell content adapts to content height */
|
|
186
|
+
.InovuaReactDataGrid__cell-content {
|
|
187
|
+
width: 100%;
|
|
188
|
+
overflow-wrap: break-word;
|
|
189
|
+
word-break: break-word;
|
|
190
|
+
hyphens: auto;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* Improve row height calculation trigger after data changes */
|
|
194
|
+
.InovuaReactDataGrid__row {
|
|
195
|
+
transition: height 0.1s ease-out;
|
|
196
|
+
}
|
|
171
197
|
`;
|
|
172
198
|
|
|
173
199
|
// Inject styles into the document head
|
|
@@ -359,6 +385,7 @@ const CellWithTooltip = ({
|
|
|
359
385
|
);
|
|
360
386
|
};
|
|
361
387
|
|
|
388
|
+
|
|
362
389
|
const DataGrid = forwardRef(
|
|
363
390
|
(
|
|
364
391
|
{
|
|
@@ -595,6 +622,7 @@ const DataGrid = forwardRef(
|
|
|
595
622
|
if (ajaxSetting?.groupBy) {
|
|
596
623
|
groupsInitializedRef.current = false;
|
|
597
624
|
setCollapsedGroups({}); // Clear existing state when groupBy changes
|
|
625
|
+
|
|
598
626
|
}
|
|
599
627
|
}, [ajaxSetting?.groupBy]);
|
|
600
628
|
|
|
@@ -718,6 +746,14 @@ const DataGrid = forwardRef(
|
|
|
718
746
|
setTableData(res.data);
|
|
719
747
|
}
|
|
720
748
|
dataRef.current = res.data;
|
|
749
|
+
|
|
750
|
+
// Force grid to recalculate row heights after data changes
|
|
751
|
+
// This helps with multi-line content timing without interfering with core mechanisms
|
|
752
|
+
setTimeout(() => {
|
|
753
|
+
if (gridRef.current?.api) {
|
|
754
|
+
gridRef.current.api.forceUpdate();
|
|
755
|
+
}
|
|
756
|
+
}, 10);
|
|
721
757
|
});
|
|
722
758
|
|
|
723
759
|
return sqlResult;
|
|
@@ -1636,6 +1672,21 @@ const DataGrid = forwardRef(
|
|
|
1636
1672
|
const { onClick } = rowProps;
|
|
1637
1673
|
|
|
1638
1674
|
rowProps.onClick = (event) => {
|
|
1675
|
+
// Check if this is a group row - group rows should only handle expand/collapse, not onRowClick
|
|
1676
|
+
const isGroupRow = rowProps.isGroupRow ||
|
|
1677
|
+
rowProps.data?.__group ||
|
|
1678
|
+
event.target.closest('.InovuaReactDataGrid__group-row') ||
|
|
1679
|
+
event.target.closest('.InovuaReactDataGrid__group-cell');
|
|
1680
|
+
|
|
1681
|
+
if (isGroupRow) {
|
|
1682
|
+
// For group rows, only allow the original onClick handler (for expand/collapse)
|
|
1683
|
+
// Do NOT call onRowClick as it should only apply to data rows
|
|
1684
|
+
if (onClick) {
|
|
1685
|
+
onClick(event);
|
|
1686
|
+
}
|
|
1687
|
+
return;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1639
1690
|
const cellElement = event.target.closest(
|
|
1640
1691
|
'.InovuaReactDataGrid__cell'
|
|
1641
1692
|
);
|
|
@@ -2220,16 +2271,12 @@ const DataGrid = forwardRef(
|
|
|
2220
2271
|
});
|
|
2221
2272
|
};
|
|
2222
2273
|
|
|
2223
|
-
// Apply immediately and with
|
|
2274
|
+
// Apply immediately and with a conservative delay
|
|
2224
2275
|
applyGroupedStyling();
|
|
2225
2276
|
const timer1 = setTimeout(applyGroupedStyling, 100);
|
|
2226
|
-
|
|
2227
|
-
const timer3 = setTimeout(applyGroupedStyling, 1000);
|
|
2228
|
-
|
|
2277
|
+
|
|
2229
2278
|
return () => {
|
|
2230
2279
|
clearTimeout(timer1);
|
|
2231
|
-
clearTimeout(timer2);
|
|
2232
|
-
clearTimeout(timer3);
|
|
2233
2280
|
};
|
|
2234
2281
|
}
|
|
2235
2282
|
}, [ajaxSetting?.groupBy, gridColumns]);
|
|
@@ -4538,15 +4585,16 @@ const DataGrid = forwardRef(
|
|
|
4538
4585
|
}, [dataCount, gridHeight, window.innerHeight]);
|
|
4539
4586
|
|
|
4540
4587
|
useEffect(() => {
|
|
4541
|
-
const
|
|
4588
|
+
const debouncedHandleResize = debounce(() => {
|
|
4542
4589
|
setWindowHeight(window.innerHeight);
|
|
4543
|
-
};
|
|
4590
|
+
}, 150);
|
|
4544
4591
|
|
|
4545
|
-
window.addEventListener('resize',
|
|
4592
|
+
window.addEventListener('resize', debouncedHandleResize);
|
|
4546
4593
|
|
|
4547
4594
|
// Clean up the event listener
|
|
4548
4595
|
return () => {
|
|
4549
|
-
window.removeEventListener('resize',
|
|
4596
|
+
window.removeEventListener('resize', debouncedHandleResize);
|
|
4597
|
+
debouncedHandleResize.cancel();
|
|
4550
4598
|
};
|
|
4551
4599
|
}, []);
|
|
4552
4600
|
|