@cdmx/wappler_ag_grid 1.2.6 → 1.2.8

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
@@ -3,6 +3,10 @@
3
3
 
4
4
  The AG Grid module allows you to create a flexible and customizable data grid with various options and properties. Below, you'll find the list of properties and options available for configuring the AG Grid module:
5
5
 
6
+ **Important Changes in v1.2.5:**
7
+ With the update to AG Grid v31, a built-in page limit dropdown feature has been introduced. Consequently, when utilizing external page limit selectors, it is necessary to configure the page selector settings accordingly. The defaults are 20, 50, and 100. If you wish to use values other than these defaults, kindly utilize the Page Size Selectors settings to define your preferred selections.
8
+
9
+
6
10
  ## AG Grid Properties
7
11
 
8
12
  1. **ID**: Unique ID for the grid. (Required)
@@ -12,6 +16,7 @@ The AG Grid module allows you to create a flexible and customizable data grid wi
12
16
  - "Alpine" (Default)
13
17
  - "Balham"
14
18
  - "Material"
19
+ - "Quartz"
15
20
  - "Custom"
16
21
  5. **Dark Mode** (Default: false)
17
22
  6. **Locale**: Select the locale for the grid. Currently supported locales: English (EN), Russian (RU) and Hebrew (HE). (Default: EN)
@@ -24,6 +29,7 @@ The overrides for the "Custom" theme can be applied in the ag-theme-custom.css f
24
29
 
25
30
  To use the "Custom" theme, copy "ag-theme-custom.css" to public/css/ag-theme-custom.css and include it in your layout file.
26
31
 
32
+
27
33
  ## AG Grid Options
28
34
  1. **Minimum Width**: The minimum width of the column. (Default: 150)
29
35
  2. **Resizable**: Specifies if the column can be resized. (Default: true)
@@ -36,7 +42,7 @@ To use the "Custom" theme, copy "ag-theme-custom.css" to public/css/ag-theme-cus
36
42
  9. **Suppress Row Deselection**: Specifies if rows can be deselected. (Default: false)
37
43
  10. **Pagination**: Enables pagination. (Default: true)
38
44
  11. **Auto Pagination**: Enables automatic pagination. (Default: false)
39
- 12. **Pagination Size Selectors**: Allowed selectors for for page size. (Default: [20,50,100] ).
45
+ 12. **Page Size Selectors**: Allowed selectors for for page size. (Default: [20,50,100] ).
40
46
  13. **Pagination Page Size**: Number of rows to show per page. (Default: 20)
41
47
  14. **Row Selection**: Row Selection (single or multiple).
42
48
  - "Single"
@@ -130,6 +136,8 @@ This grid allows you to define custom data changes for specific fields. The grid
130
136
 
131
137
  **Amount Fields** (Type: textbox, Default: null)
132
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.
133
141
 
134
142
  ---
135
143
 
@@ -858,7 +858,8 @@
858
858
  "display": "fieldset",
859
859
  "show": [
860
860
  "dataChanges",
861
- "amountFields"
861
+ "amountFields",
862
+ "amountFieldsPrecision"
862
863
  ],
863
864
  "noChangeOnHide": true,
864
865
  "groupEnabler": true,
@@ -920,7 +921,17 @@
920
921
  "attribute": "amount_fields",
921
922
  "title": "Amount Fields",
922
923
  "type": "text",
924
+ "initDisplay": "none",
925
+ "help": "Fields (numeric/float data fields) where you desire currency formatting to be applied."
926
+ },
927
+ {
928
+ "name": "amountFieldsPrecision",
929
+ "attribute": "amount_field_precision",
930
+ "title": "Amount Field Precision",
931
+ "type": "number",
932
+ "defaultValue": 2,
923
933
  "initDisplay": "none"
934
+ "help": "Setting precision digits after the decimal"
924
935
  }
925
936
  ]
926
937
  }
package/dmx-ag-grid.js CHANGED
@@ -62,6 +62,7 @@ dmx.Component('ag-grid', {
62
62
  date_locale: { type: String, default: 'en-US' },
63
63
  date_format: { type: String, default: 'dd/MM/yyyy hh:mm A' },
64
64
  amount_fields: { type: String, default: null },
65
+ amount_field_precision: { type: Number, default: 2 },
65
66
  min_width: { type: Number, default: 150 },
66
67
  sortable: { type: Boolean, default: true },
67
68
  resizable: { type: Boolean, default: true },
@@ -242,7 +243,7 @@ dmx.Component('ag-grid', {
242
243
  transactionUpdate: function () {
243
244
  // const oldRowData = this.get('oldData');
244
245
  const gridInstance = this.get('gridInstance');
245
- const oldRowData = gridInstance.gridOptions.api.getModel().rowsToDisplay.map(row => row.data);
246
+ const oldRowData = gridInstance.getModel().rowsToDisplay.map(row => row.data);
246
247
  const newRowData = this.props.data;
247
248
  let transaction;
248
249
 
@@ -263,8 +264,8 @@ dmx.Component('ag-grid', {
263
264
  }
264
265
 
265
266
  if (gridInstance && gridInstance.gridOptions && transaction) {
266
- gridInstance.gridOptions.api.applyTransaction(transaction);
267
- gridInstance.gridOptions.api.refreshCells();
267
+ gridInstance.applyTransaction(transaction);
268
+ gridInstance.refreshCells();
268
269
  } else {
269
270
  console.error('AG Grid instance or transaction not found.');
270
271
  }
@@ -935,8 +936,8 @@ dmx.Component('ag-grid', {
935
936
  valueFormatter = function (params) {
936
937
  if (params.value != null) {
937
938
  return Number(params.value).toLocaleString(options.date_locale, {
938
- minimumFractionDigits: 2,
939
- maximumFractionDigits: 2,
939
+ minimumFractionDigits: options.amount_field_precision,
940
+ maximumFractionDigits: options.amount_field_precision
940
941
  });
941
942
  }
942
943
  return '-';
@@ -1321,10 +1322,10 @@ dmx.Component('ag-grid', {
1321
1322
  columnsToCount.forEach(function (colObj) {
1322
1323
  const col = colObj.field;
1323
1324
  const uniqueValuesToCount = colObj.unique_values.split(',');
1324
-
1325
+
1325
1326
  result[0][col] = 0;
1326
1327
  let uniqueValues = new Set();
1327
-
1328
+
1328
1329
  rowData.forEach(function (line) {
1329
1330
  if (line.index < rowData.length) {
1330
1331
  const value = line.data[col];
@@ -1334,11 +1335,11 @@ dmx.Component('ag-grid', {
1334
1335
  }
1335
1336
  }
1336
1337
  });
1337
-
1338
+
1338
1339
  result[0][col + '_unique_count'] = uniqueValues.size;
1339
1340
  });
1340
1341
  }
1341
- api.setPinnedBottomRowData(result);
1342
+ api.setGridOption('pinnedBottomRowData', result);
1342
1343
  }
1343
1344
 
1344
1345
  const gridDiv = document.getElementById(options.id+'-grid');
@@ -1424,8 +1425,8 @@ dmx.Component('ag-grid', {
1424
1425
  filter: customFilter.filter
1425
1426
  };
1426
1427
  });
1427
- gridInstance.gridOptions.api.setFilterModel(filterModel);
1428
- gridInstance.gridOptions.api.onFilterChanged();
1428
+ gridInstance.setFilterModel(filterModel);
1429
+ gridInstance.onFilterChanged();
1429
1430
  }
1430
1431
 
1431
1432
  const gridElement = document.getElementById(options.id+'-grid');
@@ -1436,7 +1437,7 @@ dmx.Component('ag-grid', {
1436
1437
  const gridContainer = gridElement.parentNode;
1437
1438
  // Add an event listener to the grid
1438
1439
  if (options.row_checkbox_event) {
1439
- gridConfig.api.addEventListener('rowSelected', (event) => {
1440
+ gridInstance.addEventListener('rowSelected', (event) => {
1440
1441
  if (event.node && event.node.isSelected()) {
1441
1442
  const rowData = event.node.data;
1442
1443
  this.set('data', rowData);
@@ -1512,7 +1513,7 @@ dmx.Component('ag-grid', {
1512
1513
  });
1513
1514
  }
1514
1515
  exportSelectedRows = () => {
1515
- const selectedRows = gridConfig.api.getSelectedRows();
1516
+ const selectedRows = gridInstance.getSelectedRows();
1516
1517
  this.set('selectedRows', selectedRows);
1517
1518
  }
1518
1519
  function updateHoveringBarStyles() {
@@ -1595,7 +1596,7 @@ dmx.Component('ag-grid', {
1595
1596
  return params.value;
1596
1597
  },
1597
1598
  };
1598
- gridConfig.api.exportDataAsCsv(params);
1599
+ gridInstance.exportDataAsCsv(params);
1599
1600
  };
1600
1601
  // Create the export button
1601
1602
  if (exportToCSV) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",