@visns-studio/visns-components 5.13.9 → 5.13.11

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
@@ -88,7 +88,7 @@
88
88
  "react-dom": "^17.0.0 || ^18.0.0"
89
89
  },
90
90
  "name": "@visns-studio/visns-components",
91
- "version": "5.13.9",
91
+ "version": "5.13.11",
92
92
  "description": "Various packages to assist in the development of our Custom Applications.",
93
93
  "main": "src/index.js",
94
94
  "files": [
@@ -450,7 +450,7 @@ const DataGrid = forwardRef(
450
450
  if (gridRef.current?.api) {
451
451
  gridRef.current.api.forceUpdate();
452
452
  }
453
- }, 10);
453
+ }, 50); // Increased delay to ensure proper rendering consistency
454
454
  });
455
455
 
456
456
  return sqlResult.then((res) => ({
@@ -1208,6 +1208,14 @@ const DataGrid = forwardRef(
1208
1208
 
1209
1209
  const handleReload = () => {
1210
1210
  gridRef.current.paginationProps.reload();
1211
+
1212
+ // Force grid to recalculate row heights after reload
1213
+ // This fixes the row height rendering issue after filter changes
1214
+ setTimeout(() => {
1215
+ if (gridRef.current?.api) {
1216
+ gridRef.current.api.forceUpdate();
1217
+ }
1218
+ }, 50); // Increased delay to ensure proper rendering after reload
1211
1219
  };
1212
1220
 
1213
1221
  const handleGroupAction = async (groupValue, iconConfig) => {
@@ -1312,6 +1320,13 @@ const DataGrid = forwardRef(
1312
1320
  // Reload grid data if needed
1313
1321
  if (gridRef.current && gridRef.current.paginationProps) {
1314
1322
  gridRef.current.paginationProps.reload();
1323
+
1324
+ // Force grid to recalculate row heights after reload
1325
+ setTimeout(() => {
1326
+ if (gridRef.current?.api) {
1327
+ gridRef.current.api.forceUpdate();
1328
+ }
1329
+ }, 50);
1315
1330
  }
1316
1331
  } catch (error) {
1317
1332
  console.error('Group action fetch error:', error);
@@ -3130,6 +3145,13 @@ const DataGrid = forwardRef(
3130
3145
  // Force reload of data
3131
3146
  if (gridRef.current && gridRef.current.paginationProps) {
3132
3147
  gridRef.current.paginationProps.reload();
3148
+
3149
+ // Force grid to recalculate row heights after reload
3150
+ setTimeout(() => {
3151
+ if (gridRef.current?.api) {
3152
+ gridRef.current.api.forceUpdate();
3153
+ }
3154
+ }, 50);
3133
3155
  }
3134
3156
  }, [ajaxSetting?.url]);
3135
3157
 
@@ -638,11 +638,46 @@ function GenericDetail({
638
638
  }
639
639
  };
640
640
 
641
- const handleExport = ({ url, key }) => {
641
+ const handleExport = ({ url, key, method = 'GET' }) => {
642
642
  if (!url) return toast.error('Export URL not found');
643
643
 
644
- const exportUrl = key ? `${url}/${data[key]}` : url;
645
- window.open(exportUrl);
644
+ let exportUrl = url;
645
+
646
+ // Replace {id} placeholder with actual ID value
647
+ if (key && data[key]) {
648
+ exportUrl = url.replace('{id}', data[key]);
649
+ } else if (url.includes('{id}') && data.id) {
650
+ exportUrl = url.replace('{id}', data.id);
651
+ }
652
+
653
+ // Legacy support: append key value to URL if no placeholder found
654
+ if (!url.includes('{id}') && key && data[key]) {
655
+ exportUrl = `${url}/${data[key]}`;
656
+ }
657
+
658
+ if (method === 'POST') {
659
+ // Create a form to submit POST request
660
+ const form = document.createElement('form');
661
+ form.method = 'POST';
662
+ form.action = exportUrl;
663
+ form.target = '_blank';
664
+
665
+ // Add CSRF token if available
666
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content');
667
+ if (csrfToken) {
668
+ const csrfInput = document.createElement('input');
669
+ csrfInput.type = 'hidden';
670
+ csrfInput.name = '_token';
671
+ csrfInput.value = csrfToken;
672
+ form.appendChild(csrfInput);
673
+ }
674
+
675
+ document.body.appendChild(form);
676
+ form.submit();
677
+ document.body.removeChild(form);
678
+ } else {
679
+ window.open(exportUrl);
680
+ }
646
681
  };
647
682
 
648
683
  const handleCustomAction = async (action) => {
@@ -1398,6 +1433,115 @@ function GenericDetail({
1398
1433
  case 'total':
1399
1434
  return renderTotal();
1400
1435
  default:
1436
+ if (id === 'proposalDynamic') {
1437
+ return size === 'full' && truncatedValue
1438
+ ? <div className={styles.proposalDynamicContainer}>
1439
+ <iframe
1440
+ srcDoc={`
1441
+ <!DOCTYPE html>
1442
+ <html>
1443
+ <head>
1444
+ <style>
1445
+ body {
1446
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
1447
+ font-size: 14px;
1448
+ line-height: 1.5;
1449
+ color: #333;
1450
+ margin: 0;
1451
+ padding: 16px;
1452
+ overflow-wrap: break-word;
1453
+ word-wrap: break-word;
1454
+ }
1455
+ h1, h2, h3, h4, h5, h6 {
1456
+ font-size: 1.2em;
1457
+ font-weight: bold;
1458
+ margin: 0.5em 0;
1459
+ padding: 0;
1460
+ line-height: 1.3;
1461
+ }
1462
+ p, div, span {
1463
+ margin: 0 0 0.5em 0;
1464
+ padding: 0;
1465
+ font-size: 14px;
1466
+ line-height: 1.5;
1467
+ }
1468
+ table {
1469
+ max-width: 100%;
1470
+ border-collapse: collapse;
1471
+ font-size: 14px;
1472
+ margin: 0.5em 0;
1473
+ }
1474
+ td, th {
1475
+ padding: 0.25em 0.5em;
1476
+ font-size: 14px;
1477
+ line-height: 1.3;
1478
+ }
1479
+ img {
1480
+ max-width: 100%;
1481
+ height: auto;
1482
+ display: block;
1483
+ margin: 0.5em 0;
1484
+ }
1485
+ </style>
1486
+ </head>
1487
+ <body>
1488
+ <br /><p>${truncatedValue}</p>
1489
+ </body>
1490
+ </html>
1491
+ `}
1492
+ style={{
1493
+ width: '100%',
1494
+ minHeight: '400px',
1495
+ border: 'none',
1496
+ backgroundColor: 'transparent'
1497
+ }}
1498
+ onLoad={(e) => {
1499
+ const iframe = e.target;
1500
+ const doc = iframe.contentDocument || iframe.contentWindow.document;
1501
+ const height = doc.body.scrollHeight;
1502
+ iframe.style.height = height + 'px';
1503
+ }}
1504
+ />
1505
+ </div>
1506
+ : <div className={styles.proposalDynamicContainer}>
1507
+ <iframe
1508
+ srcDoc={`
1509
+ <!DOCTYPE html>
1510
+ <html>
1511
+ <head>
1512
+ <style>
1513
+ body {
1514
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
1515
+ font-size: 14px;
1516
+ line-height: 1.5;
1517
+ color: #333;
1518
+ margin: 0;
1519
+ padding: 16px;
1520
+ overflow-wrap: break-word;
1521
+ word-wrap: break-word;
1522
+ }
1523
+ </style>
1524
+ </head>
1525
+ <body>
1526
+ ${truncatedValue}
1527
+ </body>
1528
+ </html>
1529
+ `}
1530
+ style={{
1531
+ width: '100%',
1532
+ minHeight: '200px',
1533
+ border: 'none',
1534
+ backgroundColor: 'transparent'
1535
+ }}
1536
+ onLoad={(e) => {
1537
+ const iframe = e.target;
1538
+ const doc = iframe.contentDocument || iframe.contentWindow.document;
1539
+ const height = doc.body.scrollHeight;
1540
+ iframe.style.height = height + 'px';
1541
+ }}
1542
+ />
1543
+ </div>;
1544
+ }
1401
1545
  return size === 'full' && truncatedValue
1402
1546
  ? parse(`<br /><p>${truncatedValue}</p>`)
1403
1547
  : truncatedValue;
@@ -2528,7 +2672,7 @@ function GenericDetail({
2528
2672
  )
2529
2673
  }
2530
2674
  >
2531
- Export
2675
+ {activeTabConfig.export.label || 'Export'}
2532
2676
  </button>
2533
2677
  )}
2534
2678