@cdmx/wappler_ag_grid 1.4.0 → 1.4.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/README.md CHANGED
@@ -244,7 +244,8 @@ These configurations help you create organized and logical groupings of columns
244
244
  The "Total Row Footer" feature allows you to define and display a footer row in a grid or table that shows the totals and counts of specified columns. This can be helpful for summarizing data in your grid and providing users with a quick overview of important statistics.
245
245
 
246
246
  Configuration includes:
247
- - **Columns To Count**: Specify the columns you want to count in the footer row. Separate column names with commas.
247
+ - **Columns To Count**: Specify the columns you want to count in the footer row. Separate column names with commas. Note: Counts only Unique values by default.
248
+ - **Count Non-Unique**: Enable to count non-unique values.
248
249
  - **Columns To Sum**: Specify the columns you want to calculate the sum of in the footer row. Separate column names with commas.
249
250
  - **Fixed Footer**: Enables fixed footer totals row. (Default: false)
250
251
 
@@ -1330,6 +1330,7 @@
1330
1330
  "columnsToSum",
1331
1331
  "enableFixedFooter",
1332
1332
  "fixedFooterBottomPadding",
1333
+ "columnsToCountNonUnique"
1333
1334
  ],
1334
1335
  "noChangeOnHide": true,
1335
1336
  "groupEnabler": true,
@@ -1365,6 +1366,14 @@
1365
1366
  "unique_values": ""
1366
1367
  }
1367
1368
  },
1369
+ {
1370
+ "name": "columnsToCountNonUnique",
1371
+ "attribute": "dmx-bind:columns_to_count_nonunique",
1372
+ "title": "Count Non-Unique",
1373
+ "type": "boolean",
1374
+ "defaultValue": false,
1375
+ "initDisplay": "none"
1376
+ },
1368
1377
  {
1369
1378
  "name": "columnsToSum",
1370
1379
  "attribute": "columns_to_sum",
package/dmx-ag-grid.js CHANGED
@@ -179,7 +179,8 @@ dmx.Component('ag-grid', {
179
179
  compact_view_item_height: { type: Number, default: 20 },
180
180
  group_config: { type: Array, default: [] },
181
181
  columns_to_count: { type: Array, default: [] },
182
- columns_to_sum: { type: String, default: null }
182
+ columns_to_sum: { type: String, default: null },
183
+ columns_to_count_nonunique: { type: Boolean, default: false }
183
184
  },
184
185
 
185
186
  methods: {
@@ -706,7 +707,10 @@ dmx.Component('ag-grid', {
706
707
  };
707
708
 
708
709
  const convertedTimestamp = date.toLocaleString(options.date_locale, options);
709
- dateTimezone = new Date(convertedTimestamp).getTime();
710
+ const [datePart, timePart] = convertedTimestamp.split(', ');
711
+ const [day, month, year] = datePart.split('/');
712
+ const [hours, minutes, seconds] = timePart.split(':');
713
+ const dateTimezone = new Date(`${year}-${month}-${day}T${hours}:${minutes}:${seconds}`).getTime();
710
714
  return formatDate(dateTimezone)
711
715
  } else {
712
716
  return formatDate(date);
@@ -1381,14 +1385,17 @@ dmx.Component('ag-grid', {
1381
1385
  columnsToCount.forEach(function (colObj) {
1382
1386
  const col = colObj.field;
1383
1387
  const uniqueValuesToCount = colObj.unique_values.split(',');
1384
-
1385
1388
  result[0][col] = 0;
1386
1389
  let uniqueValues = new Set();
1387
1390
 
1388
1391
  rowData.forEach(function (line) {
1389
1392
  if (line.index < rowData.length) {
1390
1393
  const value = line.data[col];
1391
- if (!isNaN(value) && uniqueValuesToCount.includes(value.toString()) && !uniqueValues.has(value)) {
1394
+ if (options.columns_to_count_nonunique) {
1395
+ uniqueValues.add(value);
1396
+ result[0][col]++;
1397
+ }
1398
+ else if (!isNaN(value) && uniqueValuesToCount.includes(value.toString()) && !uniqueValues.has(value)) {
1392
1399
  uniqueValues.add(value);
1393
1400
  result[0][col]++;
1394
1401
  } else if (typeof value === 'string' && uniqueValuesToCount.includes(value) && !uniqueValues.has(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",