@visns-studio/visns-components 5.13.8 → 5.13.9

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.8",
91
+ "version": "5.13.9",
92
92
  "description": "Various packages to assist in the development of our Custom Applications.",
93
93
  "main": "src/index.js",
94
94
  "files": [
@@ -370,7 +370,7 @@ const GenericEditableTable = ({
370
370
  if (coloursValue) {
371
371
  return `${coloursValue}40`; // Add 40% opacity
372
372
  }
373
-
373
+
374
374
  // Check for status color if no manual color is set
375
375
  const statusColor = getStatusColor(entry);
376
376
  return statusColor ? `${statusColor}40` : undefined; // Add 40% opacity
@@ -396,11 +396,10 @@ const GenericEditableTable = ({
396
396
  return statusOption?.colour || undefined;
397
397
  }
398
398
  }
399
-
399
+
400
400
  return undefined;
401
401
  };
402
402
 
403
-
404
403
  // Calculate total project cost (sum of all entries excluding margin row)
405
404
  const calculateTotalProjectCost = (dataEntries) => {
406
405
  const totalColIndex = columns.findIndex((c) => c.type === 'total');
@@ -425,8 +424,8 @@ const GenericEditableTable = ({
425
424
  if (!whereConditions || !Array.isArray(whereConditions)) {
426
425
  return true;
427
426
  }
428
-
429
- return whereConditions.every(condition => {
427
+
428
+ return whereConditions.every((condition) => {
430
429
  const { id, value } = condition;
431
430
  return row[id] === value;
432
431
  });
@@ -472,9 +471,11 @@ const GenericEditableTable = ({
472
471
  if (!data || !Array.isArray(data)) {
473
472
  return 0;
474
473
  }
475
-
476
- const filteredData = data.filter(row => matchesWhereConditions(row, whereConditions));
477
-
474
+
475
+ const filteredData = data.filter((row) =>
476
+ matchesWhereConditions(row, whereConditions)
477
+ );
478
+
478
479
  return filteredData.reduce((sum, entry) => {
479
480
  return sum + calculateTotal(entry, keys);
480
481
  }, 0);
@@ -1294,7 +1295,7 @@ const GenericEditableTable = ({
1294
1295
  textAlign: 'left',
1295
1296
  width: '20%',
1296
1297
  }}
1297
- colSpan={3}
1298
+ colSpan={2}
1298
1299
  >
1299
1300
  Margin %
1300
1301
  </th>
@@ -1307,6 +1308,7 @@ const GenericEditableTable = ({
1307
1308
  textAlign: 'right',
1308
1309
  width: '20%',
1309
1310
  }}
1311
+ colSpan={2}
1310
1312
  >
1311
1313
  Total
1312
1314
  </th>
@@ -1325,7 +1327,7 @@ const GenericEditableTable = ({
1325
1327
  {/* Margin % input */}
1326
1328
  <td
1327
1329
  style={{ textAlign: 'center', padding: '8px' }}
1328
- colSpan={3}
1330
+ colSpan={2}
1329
1331
  >
1330
1332
  <input
1331
1333
  type="number"
@@ -1351,6 +1353,7 @@ const GenericEditableTable = ({
1351
1353
  fontWeight: 'bold',
1352
1354
  padding: '8px',
1353
1355
  }}
1356
+ colSpan={2}
1354
1357
  >
1355
1358
  {totalWithMargin.toLocaleString('en-AU', {
1356
1359
  style: 'currency',
@@ -1661,10 +1664,16 @@ const GenericEditableTable = ({
1661
1664
  );
1662
1665
  }
1663
1666
  if (index === totalColIndex) {
1664
- const totalColumn = columns[totalColIndex];
1667
+ const totalColumn =
1668
+ columns[totalColIndex];
1665
1669
  const groupTotal =
1666
1670
  group.entries
1667
- .filter(entry => matchesWhereConditions(entry, totalColumn.where))
1671
+ .filter((entry) =>
1672
+ matchesWhereConditions(
1673
+ entry,
1674
+ totalColumn.where
1675
+ )
1676
+ )
1668
1677
  .reduce(
1669
1678
  (sum, entry) =>
1670
1679
  sum +
@@ -1728,11 +1737,9 @@ const GenericEditableTable = ({
1728
1737
  <td
1729
1738
  key={column.id}
1730
1739
  style={{
1731
- width:
1732
- column.width || 'auto',
1740
+ width: column.width || 'auto',
1733
1741
  textAlign:
1734
- column.type ===
1735
- 'currency'
1742
+ column.type === 'currency'
1736
1743
  ? 'right'
1737
1744
  : 'left',
1738
1745
  }}
@@ -1817,21 +1824,25 @@ const GenericEditableTable = ({
1817
1824
  );
1818
1825
  }
1819
1826
  if (index === totalColIndex) {
1820
- const totalColumn = columns[totalColIndex];
1827
+ const totalColumn =
1828
+ columns[totalColIndex];
1821
1829
  const overallTotal =
1822
- sortBySortOrder(
1823
- localData
1824
- )
1825
- .filter(entry => matchesWhereConditions(entry, totalColumn.where))
1826
- .reduce(
1827
- (sum, entry) =>
1828
- sum +
1829
- calculateTotal(
1830
+ sortBySortOrder(localData)
1831
+ .filter((entry) =>
1832
+ matchesWhereConditions(
1830
1833
  entry,
1831
- totalColumn.keys
1832
- ),
1833
- 0
1834
- );
1834
+ totalColumn.where
1835
+ )
1836
+ )
1837
+ .reduce(
1838
+ (sum, entry) =>
1839
+ sum +
1840
+ calculateTotal(
1841
+ entry,
1842
+ totalColumn.keys
1843
+ ),
1844
+ 0
1845
+ );
1835
1846
  return (
1836
1847
  <td key={col.id}>
1837
1848
  {overallTotal.toLocaleString(