@cdmx/wappler_ag_grid 1.2.7 → 1.2.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/README.md CHANGED
@@ -42,8 +42,8 @@ To use the "Custom" theme, copy "ag-theme-custom.css" to public/css/ag-theme-cus
42
42
  9. **Suppress Row Deselection**: Specifies if rows can be deselected. (Default: false)
43
43
  10. **Pagination**: Enables pagination. (Default: true)
44
44
  11. **Auto Pagination**: Enables automatic pagination. (Default: false)
45
- 12. **Page Size Selectors**: Allowed selectors for for page size. (Default: [20,50,100] ).
46
- 13. **Pagination Page Size**: Number of rows to show per page. (Default: 20)
45
+ 12. **Page Limit Selectors**: Allowed selectors for for page size. (Default: [20,50,100] ).
46
+ 13. **Page Limit**: Number of rows to show per page. (Default: 20)
47
47
  14. **Row Selection**: Row Selection (single or multiple).
48
48
  - "Single"
49
49
  - "Multiple" (Default)
@@ -136,6 +136,8 @@ This grid allows you to define custom data changes for specific fields. The grid
136
136
 
137
137
  **Amount Fields** (Type: textbox, Default: null)
138
138
  - Define the fields where the comma-separation and float parsing need to be applied.
139
+ **Amount Field Precision** (Type: number, Default: 2)
140
+ - Define the precision to be used for currency fields.
139
141
 
140
142
  ---
141
143
 
@@ -218,7 +218,7 @@
218
218
  {
219
219
  "name": "paginationPageSizeSelector",
220
220
  "attribute": "dmx-bind:pagination_page_size_selector",
221
- "title": "Pagination Size Selectors",
221
+ "title": "Page Limit Selectors",
222
222
  "type": "text",
223
223
  "defaultValue": "[20,50,100]",
224
224
  "help": "Allowed selectors for for page size."
@@ -226,7 +226,7 @@
226
226
  {
227
227
  "name": "paginationPageSize",
228
228
  "attribute": "pagination_page_size",
229
- "title": "Pagination Page Size",
229
+ "title": "Page Limit",
230
230
  "type": "number",
231
231
  "defaultValue": 20,
232
232
  "help": "Number of rows to show per page"
package/dmx-ag-grid.js CHANGED
@@ -243,7 +243,7 @@ dmx.Component('ag-grid', {
243
243
  transactionUpdate: function () {
244
244
  // const oldRowData = this.get('oldData');
245
245
  const gridInstance = this.get('gridInstance');
246
- const oldRowData = gridInstance.gridOptions.api.getModel().rowsToDisplay.map(row => row.data);
246
+ const oldRowData = gridInstance.getModel().rowsToDisplay.map(row => row.data);
247
247
  const newRowData = this.props.data;
248
248
  let transaction;
249
249
 
@@ -264,8 +264,8 @@ dmx.Component('ag-grid', {
264
264
  }
265
265
 
266
266
  if (gridInstance && gridInstance.gridOptions && transaction) {
267
- gridInstance.gridOptions.api.applyTransaction(transaction);
268
- gridInstance.gridOptions.api.refreshCells();
267
+ gridInstance.applyTransaction(transaction);
268
+ gridInstance.refreshCells();
269
269
  } else {
270
270
  console.error('AG Grid instance or transaction not found.');
271
271
  }
@@ -422,6 +422,14 @@ dmx.Component('ag-grid', {
422
422
  this.dispatchEvent('row_double_clicked')
423
423
  }
424
424
 
425
+ function actionsRendererForPinnedBottom(params) {
426
+ if (params.node && params.node.rowPinned === 'bottom') {
427
+ return ''; // Render an empty string for bottom pinned row
428
+ } else {
429
+ return actionsRenderer(params);
430
+ }
431
+ }
432
+
425
433
  function checkboxCellRenderer(params) {
426
434
  const idValue = params.data.id;
427
435
  const columnName = params.colDef.field;
@@ -1145,7 +1153,7 @@ dmx.Component('ag-grid', {
1145
1153
  colId: 'actionsColumn',
1146
1154
  filter: null,
1147
1155
  sortable: false,
1148
- cellRenderer: actionsRenderer,
1156
+ cellRenderer: actionsRendererForPinnedBottom,
1149
1157
  minWidth: options.actions_column_min_width,
1150
1158
  maxWidth: options.actions_column_max_width,
1151
1159
  pinned: (options.pin_actions ? options.actions_column_position: undefined),
@@ -1322,24 +1330,27 @@ dmx.Component('ag-grid', {
1322
1330
  columnsToCount.forEach(function (colObj) {
1323
1331
  const col = colObj.field;
1324
1332
  const uniqueValuesToCount = colObj.unique_values.split(',');
1325
-
1333
+
1326
1334
  result[0][col] = 0;
1327
1335
  let uniqueValues = new Set();
1328
-
1336
+
1329
1337
  rowData.forEach(function (line) {
1330
1338
  if (line.index < rowData.length) {
1331
1339
  const value = line.data[col];
1332
- if (uniqueValuesToCount.includes(value) && !uniqueValues.has(value)) {
1340
+ if (!isNaN(value) && uniqueValuesToCount.includes(value.toString()) && !uniqueValues.has(value)) {
1341
+ uniqueValues.add(value);
1342
+ result[0][col]++;
1343
+ } else if (typeof value === 'string' && uniqueValuesToCount.includes(value) && !uniqueValues.has(value)) {
1333
1344
  uniqueValues.add(value);
1334
1345
  result[0][col]++;
1335
1346
  }
1336
1347
  }
1337
1348
  });
1338
-
1349
+
1339
1350
  result[0][col + '_unique_count'] = uniqueValues.size;
1340
1351
  });
1341
1352
  }
1342
- api.setPinnedBottomRowData(result);
1353
+ api.setGridOption('pinnedBottomRowData', result);
1343
1354
  }
1344
1355
 
1345
1356
  const gridDiv = document.getElementById(options.id+'-grid');
@@ -1425,8 +1436,8 @@ dmx.Component('ag-grid', {
1425
1436
  filter: customFilter.filter
1426
1437
  };
1427
1438
  });
1428
- gridInstance.gridOptions.api.setFilterModel(filterModel);
1429
- gridInstance.gridOptions.api.onFilterChanged();
1439
+ gridInstance.setFilterModel(filterModel);
1440
+ gridInstance.onFilterChanged();
1430
1441
  }
1431
1442
 
1432
1443
  const gridElement = document.getElementById(options.id+'-grid');
@@ -1437,7 +1448,7 @@ dmx.Component('ag-grid', {
1437
1448
  const gridContainer = gridElement.parentNode;
1438
1449
  // Add an event listener to the grid
1439
1450
  if (options.row_checkbox_event) {
1440
- gridConfig.api.addEventListener('rowSelected', (event) => {
1451
+ gridInstance.addEventListener('rowSelected', (event) => {
1441
1452
  if (event.node && event.node.isSelected()) {
1442
1453
  const rowData = event.node.data;
1443
1454
  this.set('data', rowData);
@@ -1513,7 +1524,7 @@ dmx.Component('ag-grid', {
1513
1524
  });
1514
1525
  }
1515
1526
  exportSelectedRows = () => {
1516
- const selectedRows = gridConfig.api.getSelectedRows();
1527
+ const selectedRows = gridInstance.getSelectedRows();
1517
1528
  this.set('selectedRows', selectedRows);
1518
1529
  }
1519
1530
  function updateHoveringBarStyles() {
@@ -1596,7 +1607,7 @@ dmx.Component('ag-grid', {
1596
1607
  return params.value;
1597
1608
  },
1598
1609
  };
1599
- gridConfig.api.exportDataAsCsv(params);
1610
+ gridInstance.exportDataAsCsv(params);
1600
1611
  };
1601
1612
  // Create the export button
1602
1613
  if (exportToCSV) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  ],
16
16
  "dependencies": {
17
17
  "ag-grid-community": "31.0.x",
18
- "exceljs": "4.3.x",
18
+ "exceljs": "4.4.x",
19
19
  "moment": "2.29.x",
20
20
  "papaparse": "5.4.x"
21
21
  },
@@ -24,3 +24,4 @@
24
24
  "publish-dry-run": "npm publish ./dist --access public --dry-run"
25
25
  }
26
26
  }
27
+