@cdmx/wappler_ag_grid 1.7.2 → 1.7.4

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
@@ -37,50 +37,51 @@ To use the "Custom" theme, copy "ag-theme-custom.css" to public/css/ag-theme-cus
37
37
  6. **Floating Filter**: Specifies if the column has a floating filter. (Default: true)
38
38
  7. **Exclude Hidden Fields**: Specifies if Hidden fields are to be excluded in CSV export. (Default: false)
39
39
  8. **CSV Export**: Specifies if Export to CSV is enabled. (Default: true)
40
- 9. **Enable RTL**: Enabled Right to Left, used for Hebrew and Arabic. (Default: false)
41
- 10. **Column Hover Highlight**: Specifies column hover highlighting. (Default: true)
42
- 11. **Suppress Row Deselection**: Specifies if rows can be deselected. (Default: false)
43
- 12. **Pagination**: Enables pagination. (Default: true)
44
- 13. **Auto Pagination**: Enables automatic pagination. (Default: false)
45
- 14. **Page Limit Selectors**: Allowed selectors for for page size. Set to false to hide the page size selector. (Default: [20,50,100] ).
46
- 15. **Page Limit**: Number of rows to show per page. (Default: 20)
47
- 16. **Row Selection**: Row Selection (single or multiple).
40
+ 9. **Exclude Fields CSV**: Specifies fields to be excluded in CSV export. (Default: null)
41
+ 10. **Enable RTL**: Enabled Right to Left, used for Hebrew and Arabic. (Default: false)
42
+ 11. **Column Hover Highlight**: Specifies column hover highlighting. (Default: true)
43
+ 12. **Suppress Row Deselection**: Specifies if rows can be deselected. (Default: false)
44
+ 13. **Pagination**: Enables pagination. (Default: true)
45
+ 14. **Auto Pagination**: Enables automatic pagination. (Default: false)
46
+ 15. **Page Limit Selectors**: Allowed selectors for for page size. Set to false to hide the page size selector. (Default: [20,50,100] ).
47
+ 16. **Page Limit**: Number of rows to show per page. (Default: 20)
48
+ 17. **Row Selection**: Row Selection (single or multiple).
48
49
  - "Single"
49
50
  - "Multiple" (Default)
50
- 17. **Timezone**: Timezone for Date Fields. Select the appropriate timezone from the dropdown list. (Default: Local)
51
- 18. **Date Format**: Date Format for displaying date values. (Default: "dd/MM/yyyy hh:mm A")
52
- 19. **Filter Field ID**: Specifies the field ID of the search field when using grid quick filter. Applicable when using Quick Filter feature of AG Grid, called from Dynamic Events on change event on the field. (Default: search_field)
53
- 20. **Loading Overlay**: This enables loading overlay. (Default: false)
54
- 21. **Loading Overlay Duration**: This sets loading overlay duration in ms. (Default: 500)
55
- 22. **Sticky Header and Horizontal Scrollbar**: Optionally specify the header offset and topbar class.
51
+ 18. **Timezone**: Timezone for Date Fields. Select the appropriate timezone from the dropdown list. (Default: Local)
52
+ 19. **Date Format**: Date Format for displaying date values. (Default: "dd/MM/yyyy hh:mm A")
53
+ 20. **Filter Field ID**: Specifies the field ID of the search field when using grid quick filter. Applicable when using Quick Filter feature of AG Grid, called from Dynamic Events on change event on the field. (Default: search_field)
54
+ 21. **Loading Overlay**: This enables loading overlay. (Default: false)
55
+ 22. **Loading Overlay Duration**: This sets loading overlay duration in ms. (Default: 500)
56
+ 23. **Sticky Header and Horizontal Scrollbar**: Optionally specify the header offset and topbar class.
56
57
  - Fixed Header: Enables sticky header. (Default: false)
57
58
  - Header Offset: Specifies offset from the top of the viewport area (Optional). (Default: 100)
58
59
  - Topbar Class: Specify class, e.g., "topbar", to measure the offset from (Optional). (Default: "topbar")
59
60
  - Topbar Offset: Specify topbar offset (Default: 80)
60
61
  - Fixed Horizontal Scroll: Enables Hovering horizontal scrollbar which stays at the bottom all the time. (Default: false)
61
62
  - Fixed Horizontal Scroll Width: Fixed horizontal scroll width percentage. (Default: 80%)
62
- 23. **Row Height**: Height of each row in pixels. (Default: Auto)
63
- 24. **Header Height**: Height of the header row in pixels. (Default: Auto)
64
- 25. **Wrap Header Text**: This will cause long headers to wrap. (Default: true)
65
- 26. **Auto Header Height**: The header height is automatically set based on the content of the header. (Default: true)
66
- 27. **Auto Height**: The height is automatically set based on the content of the cells. (Default: false)
67
- 28. **Wrap Text**: This will cause long texts to wrap in the cells. (Default: false)
68
- 29. **Center Align (V)**: Specifies if the cell data should be vertically centered. (Default: false)
69
- 30. **Suppress Row Click Selection**: Disables row selection on row click. (Default: false)
70
- 31. **Suppress Menu Hide**: Prevents hiding the column menu. (Default: false)
71
- 32. **Suppress Movable Columns**: Disables moving columns. (Default: false)
72
- 33. **Enable Cell Expressions**: Enables expressions in cell values. (Default: false)
73
- 34. **Animate Rows**: Enables row animation on data changes. (Default: false)
74
- 35. **Suppress Aggregation Function in Header**: Hides the aggregation function in column headers. (Default: false)
75
- 36. **Suppress Clipboard Paste**: Disables pasting data from the clipboard. (Default: false)
76
- 37. **Suppress Scroll on New Data**: Prevents scrolling to newly added data. (Default: false)
77
- 38. **Suppress Property Names Check**: Disables checking for duplicate property names. (Default: false)
78
- 39. **Hide ID Field**: Hides the ID Field in the Grid. (Default: false)
79
- 40. **Numeric Column Align**: Align numeric columns to the right. (Default: false)
80
- 41. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
81
- 42. **Row Double Click Events**: Enables row double click events. This can be used in Dynamic events => Grid Events => Row Double Clicked. (Default: false)
82
- 43. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
83
- 44. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
63
+ 24. **Row Height**: Height of each row in pixels. (Default: Auto)
64
+ 25. **Header Height**: Height of the header row in pixels. (Default: Auto)
65
+ 26. **Wrap Header Text**: This will cause long headers to wrap. (Default: true)
66
+ 27. **Auto Header Height**: The header height is automatically set based on the content of the header. (Default: true)
67
+ 28. **Auto Height**: The height is automatically set based on the content of the cells. (Default: false)
68
+ 29. **Wrap Text**: This will cause long texts to wrap in the cells. (Default: false)
69
+ 30. **Center Align (V)**: Specifies if the cell data should be vertically centered. (Default: false)
70
+ 31. **Suppress Row Click Selection**: Disables row selection on row click. (Default: false)
71
+ 32. **Suppress Menu Hide**: Prevents hiding the column menu. (Default: false)
72
+ 33. **Suppress Movable Columns**: Disables moving columns. (Default: false)
73
+ 34. **Enable Cell Expressions**: Enables expressions in cell values. (Default: false)
74
+ 35. **Animate Rows**: Enables row animation on data changes. (Default: false)
75
+ 36. **Suppress Aggregation Function in Header**: Hides the aggregation function in column headers. (Default: false)
76
+ 37. **Suppress Clipboard Paste**: Disables pasting data from the clipboard. (Default: false)
77
+ 38. **Suppress Scroll on New Data**: Prevents scrolling to newly added data. (Default: false)
78
+ 39. **Suppress Property Names Check**: Disables checking for duplicate property names. (Default: false)
79
+ 40. **Hide ID Field**: Hides the ID Field in the Grid. (Default: false)
80
+ 41. **Numeric Column Align**: Align numeric columns to the right. (Default: false)
81
+ 42. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
82
+ 43. **Row Double Click Events**: Enables row double click events. This can be used in Dynamic events => Grid Events => Row Double Clicked. (Default: false)
83
+ 44. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
84
+ 45. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
84
85
 
85
86
  # Data Type Overrides
86
87
 
@@ -300,7 +301,7 @@ Configuration includes:
300
301
 
301
302
  ---
302
303
 
303
- # Set Filters
304
+ # Set Filters and Sort Orders
304
305
 
305
306
  The "Set Filters" feature allows you to enable the setting of filters for columns in a user interface. This feature allows to preset filters when the grid is rendered.
306
307
 
@@ -313,6 +314,13 @@ Toggle to enable or disable the feature. When enabled, users can set filters for
313
314
  - **Filter Type**: The type of filter to apply, options available are: "Starts With," "Less Than," "Date From," "Greater Than," "Equals," and "Contains."
314
315
  - **Filter Value**: The Value/Filter to be applied.
315
316
 
317
+ ### Set Sort Orders
318
+ Toggle to enable or disable the feature. When enabled, users can set sort orders for columns. (Default: false)
319
+
320
+ **Custom Sort Orders**: A grid that allows you to define custom sort orders.
321
+ - **Field**: The column name to sort.
322
+ - **Sort Order**: Select Ascending or Descending Order for the Field."
323
+
316
324
  ---
317
325
 
318
326
  # Configure Actions Column
@@ -176,22 +176,6 @@
176
176
  "defaultValue": true,
177
177
  "help": "Specifies if the column has a floating filter"
178
178
  },
179
- {
180
- "name": "exportExcludeHidden",
181
- "attribute": "dmx-bind:export_exclude_hidden_fields",
182
- "title": "Exclude Hidden Fields",
183
- "type": "boolean",
184
- "defaultValue": false,
185
- "help": "Specifies if Hidden fields are to be excluded in CSV export."
186
- },
187
- {
188
- "name": "exportToCSV",
189
- "attribute": "dmx-bind:export_to_csv",
190
- "title": "CSV Export",
191
- "type": "boolean",
192
- "defaultValue": true,
193
- "help": "Specifies if Export to CSV to be enabled"
194
- },
195
179
  {
196
180
  "name": "enableRtl",
197
181
  "attribute": "dmx-bind:enable_rtl",
@@ -232,6 +216,29 @@
232
216
  "defaultValue": false,
233
217
  "help": "Built-in pagination size as per page size."
234
218
  },
219
+ {
220
+ "name": "exportToCSV",
221
+ "attribute": "dmx-bind:export_to_csv",
222
+ "title": "CSV Export",
223
+ "type": "boolean",
224
+ "defaultValue": true,
225
+ "help": "Specifies if Export to CSV to be enabled"
226
+ },
227
+ {
228
+ "name": "exportExcludeHidden",
229
+ "attribute": "dmx-bind:export_exclude_hidden_fields",
230
+ "title": "Exclude Hidden Fields",
231
+ "type": "boolean",
232
+ "defaultValue": false,
233
+ "help": "Specifies if Hidden fields are to be excluded in CSV export."
234
+ },
235
+ {
236
+ "name": "exportExcludeFields",
237
+ "attribute": "export_exclude_fields",
238
+ "title": "Exclude Fields CSV",
239
+ "type": "text",
240
+ "help": "Specifies fields to be excluded in CSV export (comma-seperated)."
241
+ },
235
242
  {
236
243
  "name": "paginationPageSizeSelector",
237
244
  "attribute": "dmx-bind:pagination_page_size_selector",
@@ -1625,7 +1632,7 @@
1625
1632
  ]
1626
1633
  },
1627
1634
  {
1628
- "group": "📒 Set Filters",
1635
+ "group": "📒 Set Filters and Sort Orders",
1629
1636
  "variables": [
1630
1637
  {
1631
1638
  "name": "setFilters",
@@ -1690,6 +1697,57 @@
1690
1697
  }
1691
1698
  }
1692
1699
  ]
1700
+ },
1701
+ {
1702
+ "name": "setSortOrders",
1703
+ "title": "Set Sort Orders",
1704
+ "attributeStartsWith": "dmx-bind",
1705
+ "attribute": "set_sort_order",
1706
+ "type": "boolean",
1707
+ "defaultValue": false,
1708
+ "display": "fieldset",
1709
+ "show": ["listCustomSortOrder"],
1710
+ "noChangeOnHide": true,
1711
+ "groupEnabler": true,
1712
+ "help": "Allows setting sort orders for columns",
1713
+ "children": [
1714
+ {
1715
+ "name": "listCustomSortOrder",
1716
+ "attribute": "dmx-bind:csort",
1717
+ "title": "Custom Sort Order",
1718
+ "type": "grid",
1719
+ "jsonFormat": true,
1720
+ "dataBindings": true,
1721
+ "encloseBT": true,
1722
+ "jsonBT": true,
1723
+ "initDisplay": "none",
1724
+ "columns": [
1725
+ {
1726
+ "field": "field",
1727
+ "caption": "Field",
1728
+ "editable": {
1729
+ "type": "text"
1730
+ }
1731
+ },
1732
+ {
1733
+ "field": "sort",
1734
+ "caption": "Sort Order",
1735
+ "editable": {
1736
+ "type": "list",
1737
+ "items": [
1738
+ {"id": "asc", "text": "Ascending"},
1739
+ {"id": "desc", "text": "Descending"}
1740
+ ]
1741
+ }
1742
+ "help": "Sort Order for the fields."
1743
+ }
1744
+ ],
1745
+ "newRecord": {
1746
+ "field": "",
1747
+ "sort": "asc"
1748
+ }
1749
+ }
1750
+ ]
1693
1751
  }
1694
1752
  ]
1695
1753
  },
package/dmx-ag-grid.js CHANGED
@@ -27,6 +27,7 @@ dmx.Component('ag-grid', {
27
27
  cwidths: { type: Object, default: {} },
28
28
  ctypes: { type: Array, default: [] },
29
29
  cfilters: { type: Array, default: [] },
30
+ csort: { type: Array, default: [] },
30
31
  cstatic_select_editors: { type: Object, default: {} },
31
32
  cdynamic_select_editors: { type: Object, default: {} },
32
33
  cselect_placeholder: { type: String, default: "-" },
@@ -82,6 +83,7 @@ dmx.Component('ag-grid', {
82
83
  column_hover_highlight: { type: Boolean, default: true },
83
84
  quick_filter_field: { type: String, default: 'search_field' },
84
85
  export_exclude_hidden_fields: { type: Boolean, default: false },
86
+ export_exclude_fields: { type: String, default: null },
85
87
  export_to_csv: { type: Boolean, default: true },
86
88
  export_csv_filename: { type: String, default: 'export.csv' },
87
89
  fixed_header: { type: Boolean, default: false },
@@ -856,17 +858,17 @@ dmx.Component('ag-grid', {
856
858
 
857
859
  if ((displayDataChanges.length > 0) && displayDataChanges.some(change => change.field === params.colDef.field)) {
858
860
  const placeholderMap = Object.fromEntries(
859
- Object.entries(params.data).map(([field, fieldValue]) => [`%${field}%`, fieldValue])
861
+ Object.entries(params.data).map(([field, fieldValue]) => [`%${field}%`, fieldValue !== null ? fieldValue : ''])
860
862
  );
861
863
  return displayDataChanges.reduce((cellData, change) => {
862
- if (change.field === params.colDef.field) {
863
- const placeholders = Object.keys(placeholderMap).join('|');
864
- const regex = new RegExp(placeholders, 'g');
865
- cellData = change.data.replace(regex, match => placeholderMap[match]);
866
- }
867
- return cellData;
864
+ if (change.field === params.colDef.field) {
865
+ const placeholders = Object.keys(placeholderMap).join('|');
866
+ const regex = new RegExp(placeholders + '|%[^%]+%', 'g');
867
+ cellData = change.data.replace(regex, match => placeholderMap[match] || '');
868
+ }
869
+ return cellData;
868
870
  }, value);
869
- }
871
+ }
870
872
 
871
873
  // Check if there's a matching change in dataChanges
872
874
  const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
@@ -1460,6 +1462,19 @@ dmx.Component('ag-grid', {
1460
1462
  },
1461
1463
  onGridReady: (params) => {
1462
1464
  const columnApi = params.columnApi.api;
1465
+ if (options.csort && options.csort.length > 0) {
1466
+ let sortModel = options.csort.map(function(sortItem, index) {
1467
+ return {
1468
+ colId: sortItem.field,
1469
+ sort: sortItem.sort,
1470
+ sortIndex: index
1471
+ };
1472
+ });
1473
+ columnApi.applyColumnState({
1474
+ state: sortModel,
1475
+ defaultState: { sort: null }
1476
+ });
1477
+ }
1463
1478
  hideColumn = (fieldToHide) => {
1464
1479
  columnApi.setColumnsVisible([fieldToHide], false);
1465
1480
  }
@@ -1781,6 +1796,7 @@ dmx.Component('ag-grid', {
1781
1796
  //CSV Export Function
1782
1797
  exportGridData = () => {
1783
1798
  const excludedColumnIds = ['checkboxColumn', 'actionsColumn'];
1799
+ const exportExcludeFieldsArray = options.export_exclude_fields ? options.export_exclude_fields.split(',') : [];
1784
1800
  // Extracting fields and colIds from columnDefs
1785
1801
  let fieldsAndColIds;
1786
1802
  if (options.group_config) {
@@ -1811,7 +1827,8 @@ dmx.Component('ag-grid', {
1811
1827
  }
1812
1828
  const fieldsToExport = fieldsAndColIds.filter((column) => {
1813
1829
  return !excludedColumnIds.includes(column.colId) &&
1814
- (!options.export_exclude_hidden_fields || !column.hide);
1830
+ (!options.export_exclude_hidden_fields || !column.hide) &&
1831
+ !exportExcludeFieldsArray.includes(column.field);
1815
1832
  }).map((column) => column.field);
1816
1833
 
1817
1834
  const params = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",