@cdmx/wappler_ag_grid 1.5.13 → 1.6.0

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
@@ -33,51 +33,54 @@ To use the "Custom" theme, copy "ag-theme-custom.css" to public/css/ag-theme-cus
33
33
  4. **Case-Insensitive Sort**: Specifies if the columns are sorted in case-insensitive manner. (Default: false)
34
34
  5. **Filter**: Specifies if the column has a filter. (Default: true)
35
35
  6. **Floating Filter**: Specifies if the column has a floating filter. (Default: true)
36
- 7. **CSV Export**: Specifies if Export to CSV is enabled. (Default: true)
37
- 8. **Enable RTL**: Enabled Right to Left, used for Hebrew and Arabic. (Default: false)
38
- 9. **Column Hover Highlight**: Specifies column hover highlighting. (Default: true)
39
- 10. **Suppress Row Deselection**: Specifies if rows can be deselected. (Default: false)
40
- 11. **Pagination**: Enables pagination. (Default: true)
41
- 12. **Auto Pagination**: Enables automatic pagination. (Default: false)
42
- 13. **Page Limit Selectors**: Allowed selectors for for page size. Set to false to hide the page size selector. (Default: [20,50,100] ).
43
- 14. **Page Limit**: Number of rows to show per page. (Default: 20)
44
- 15. **Row Selection**: Row Selection (single or multiple).
36
+ 7. **Editiable Cells**: Makes cells editable. (Default: false)
37
+ 8. **Editiable Rows**: Makes row data editable. (Default: false)
38
+ 9. **CSV Export**: Specifies if Export to CSV is enabled. (Default: true)
39
+ 10. **Enable RTL**: Enabled Right to Left, used for Hebrew and Arabic. (Default: false)
40
+ 11. **Column Hover Highlight**: Specifies column hover highlighting. (Default: true)
41
+ 12. **Suppress Row Deselection**: Specifies if rows can be deselected. (Default: false)
42
+ 13. **Pagination**: Enables pagination. (Default: true)
43
+ 14. **Auto Pagination**: Enables automatic pagination. (Default: false)
44
+ 15. **Page Limit Selectors**: Allowed selectors for for page size. Set to false to hide the page size selector. (Default: [20,50,100] ).
45
+ 16. **Page Limit**: Number of rows to show per page. (Default: 20)
46
+ 17. **Row Selection**: Row Selection (single or multiple).
45
47
  - "Single"
46
48
  - "Multiple" (Default)
47
- 16. **Timezone**: Timezone for Date Fields. Select the appropriate timezone from the dropdown list. (Default: Local)
48
- 17. **Date Format**: Date Format for displaying date values. (Default: "dd/MM/yyyy hh:mm A")
49
- 18. **Filder 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)
50
- 19. **Loading Overlay**: This enables loading overlay. (Default: false)
51
- 20. **Loading Overlay Duration**: This sets loading overlay duration in ms. (Default: 500)
52
- 21. **Sticky Header and Horizontal Scrollbar**: Optionally specify the header offset and topbar class.
49
+ 18. **Timezone**: Timezone for Date Fields. Select the appropriate timezone from the dropdown list. (Default: Local)
50
+ 19. **Date Format**: Date Format for displaying date values. (Default: "dd/MM/yyyy hh:mm A")
51
+ 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)
52
+ 21. **Loading Overlay**: This enables loading overlay. (Default: false)
53
+ 22. **Loading Overlay Duration**: This sets loading overlay duration in ms. (Default: 500)
54
+ 23. **Sticky Header and Horizontal Scrollbar**: Optionally specify the header offset and topbar class.
53
55
  - Fixed Header: Enables sticky header. (Default: false)
54
56
  - Header Offset: Specifies offset from the top of the viewport area (Optional). (Default: 100)
55
57
  - Topbar Class: Specify class, e.g., "topbar", to measure the offset from (Optional). (Default: "topbar")
56
58
  - Topbar Offset: Specify topbar offset (Default: 80)
57
59
  - Fixed Horizontal Scroll: Enables Hovering horizontal scrollbar which stays at the bottom all the time. (Default: false)
58
60
  - Fixed Horizontal Scroll Width: Fixed horizontal scroll width percentage. (Default: 80%)
59
- 22. **Row Height**: Height of each row in pixels. (Default: Auto)
60
- 23. **Header Height**: Height of the header row in pixels. (Default: Auto)
61
- 24. **Wrap Header Text**: This will cause long headers to wrap. (Default: true)
62
- 25. **Auto Header Height**: The header height is automatically set based on the content of the header. (Default: true)
63
- 26. **Auto Height**: The height is automatically set based on the content of the cells. (Default: false)
64
- 27. **Wrap Text**: This will cause long texts to wrap in the cells. (Default: false)
65
- 28. **Suppress Row Click Selection**: Disables row selection on row click. (Default: false)
66
- 29. **Suppress Menu Hide**: Prevents hiding the column menu. (Default: false)
67
- 30. **Suppress Movable Columns**: Disables moving columns. (Default: false)
68
- 31. **Enable Cell Expressions**: Enables expressions in cell values. (Default: false)
69
- 32. **Animate Rows**: Enables row animation on data changes. (Default: false)
70
- 33. **Suppress Aggregation Function in Header**: Hides the aggregation function in column headers. (Default: false)
71
- 34. **Suppress Clipboard Paste**: Disables pasting data from the clipboard. (Default: false)
72
- 35. **Suppress Scroll on New Data**: Prevents scrolling to newly added data. (Default: false)
73
- 36. **Suppress Property Names Check**: Disables checking for duplicate property names. (Default: false)
74
- 37. **Hide ID Field**: Hides the ID Field in the Grid. (Default: false)
75
- 38. **ID Present**: Uses ID field data for performing transactional updates on the Grid. Required to be enabled when perfomring transaction updates (Reload on Grid). (Default: false)
76
- 39. **Numeric Column Align**: Align numeric columns to the right. (Default: false)
77
- 40. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
78
- 41. **Row Double Click Events**: Enables row double click events. This can be used in Dynamic events => Grid Events => Row Double Clicked. (Default: false)
79
- 42. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
80
- 43. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
61
+ 24. **Row Height**: Height of each row in pixels. (Default: Auto)
62
+ 25. **Header Height**: Height of the header row in pixels. (Default: Auto)
63
+ 26. **Wrap Header Text**: This will cause long headers to wrap. (Default: true)
64
+ 27. **Auto Header Height**: The header height is automatically set based on the content of the header. (Default: true)
65
+ 28. **Auto Height**: The height is automatically set based on the content of the cells. (Default: false)
66
+ 29. **Wrap Text**: This will cause long texts to wrap in the cells. (Default: false)
67
+ 30. **Center Align (V)**: Specifies if the cell data should be vertically centered. (Default: false)
68
+ 31. **Center Align (H)**: Specifies if the cell data should be vertically centered. (Default: false)
69
+ 32. **Suppress Row Click Selection**: Disables row selection on row click. (Default: false)
70
+ 33. **Suppress Menu Hide**: Prevents hiding the column menu. (Default: false)
71
+ 34. **Suppress Movable Columns**: Disables moving columns. (Default: false)
72
+ 35. **Enable Cell Expressions**: Enables expressions in cell values. (Default: false)
73
+ 36. **Animate Rows**: Enables row animation on data changes. (Default: false)
74
+ 37. **Suppress Aggregation Function in Header**: Hides the aggregation function in column headers. (Default: false)
75
+ 38. **Suppress Clipboard Paste**: Disables pasting data from the clipboard. (Default: false)
76
+ 39. **Suppress Scroll on New Data**: Prevents scrolling to newly added data. (Default: false)
77
+ 40. **Suppress Property Names Check**: Disables checking for duplicate property names. (Default: false)
78
+ 41. **Hide ID Field**: Hides the ID Field in the Grid. (Default: false)
79
+ 42. **Numeric Column Align**: Align numeric columns to the right. (Default: false)
80
+ 43. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
81
+ 44. **Row Double Click Events**: Enables row double click events. This can be used in Dynamic events => Grid Events => Row Double Clicked. (Default: false)
82
+ 45. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
83
+ 46. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
81
84
 
82
85
  # Data Type Overrides
83
86
 
@@ -176,6 +176,22 @@
176
176
  "defaultValue": true,
177
177
  "help": "Specifies if the column has a floating filter"
178
178
  },
179
+ {
180
+ "name": "cellEditable",
181
+ "attribute": "dmx-bind:cell_editable",
182
+ "title": "Editable Cells",
183
+ "type": "boolean",
184
+ "defaultValue": false,
185
+ "help": "Makes cells editable."
186
+ },
187
+ {
188
+ "name": "rowEditable",
189
+ "attribute": "dmx-bind:row_editable",
190
+ "title": "Row Editable",
191
+ "type": "boolean",
192
+ "defaultValue": false,
193
+ "help": "Makes entire row editable."
194
+ },
179
195
  {
180
196
  "name": "exportToCSV",
181
197
  "attribute": "dmx-bind:export_to_csv",
@@ -451,6 +467,22 @@
451
467
  "defaultValue": false,
452
468
  "help": "This will cause long texts to wrap in the cells."
453
469
  },
470
+ {
471
+ "name": "vCenterCellData",
472
+ "attribute": "dmx-bind:vert_center_cell_data",
473
+ "title": "Center Align (V)",
474
+ "type": "boolean",
475
+ "defaultValue": false,
476
+ "help": "Specifies if the cell data should be vertically centered."
477
+ },
478
+ {
479
+ "name": "hCenterCellData",
480
+ "attribute": "dmx-bind:horz_center_cell_data",
481
+ "title": "Center Align (H)",
482
+ "type": "boolean",
483
+ "defaultValue": false,
484
+ "help": "Specifies if the cell data should be horizontally centered."
485
+ },
454
486
  {
455
487
  "name": "autoHeight",
456
488
  "attribute": "dmx-bind:auto_height",
@@ -539,14 +571,6 @@
539
571
  "defaultValue": false,
540
572
  "help": "Hides the ID Field in Grid"
541
573
  },
542
- {
543
- "name": "idPreset",
544
- "attribute": "dmx-bind:id_present",
545
- "title": "ID Present",
546
- "type": "boolean",
547
- "defaultValue": false,
548
- "help": "Uses ID field data for performing transactional updates on the Grid. Required to be enabled when perfomring transaction updates (Reload on Grid)"
549
- },
550
574
  {
551
575
  "name": "numericColumnAlign",
552
576
  "attribute": "dmx-bind:numeric_column_align",
@@ -2804,6 +2828,74 @@
2804
2828
  "dmx-ag-grid": true
2805
2829
  }
2806
2830
  },
2831
+ {
2832
+ "name": "dmx-ag-grid-cell-edited",
2833
+ "attributeStartsWith": "dmx-on",
2834
+ "attribute": "cell_data_edited",
2835
+ "display": "fieldset",
2836
+ "title": "Cell Data Edited",
2837
+ "icon": "fa fa-lg fa-chevron-right",
2838
+ "groupTitle": "Grid Events",
2839
+ "groupIcon": "fa fa-lg fa-cubes",
2840
+ "defaultValue": false,
2841
+ "show": [
2842
+ "cellDataUpdated"
2843
+ ],
2844
+ "noChangeOnHide": true,
2845
+ "type": "boolean",
2846
+ "groupEnabler": true,
2847
+ "children": [
2848
+ {
2849
+ "name": "cellDataUpdated",
2850
+ "attributeStartsWith": "dmx-on",
2851
+ "attribute": "cell_data_edited",
2852
+ "isValue": true,
2853
+ "actionsPicker": true,
2854
+ "title": "Action:",
2855
+ "type": "text",
2856
+ "help": "Choose the action to execute.",
2857
+ "defaultValue": "",
2858
+ "initDisplay": "none"
2859
+ }
2860
+ ],
2861
+ "allowedOn": {
2862
+ "dmx-ag-grid": true
2863
+ }
2864
+ },
2865
+ {
2866
+ "name": "dmx-ag-grid-row-edited",
2867
+ "attributeStartsWith": "dmx-on",
2868
+ "attribute": "row_data_edited",
2869
+ "display": "fieldset",
2870
+ "title": "Row Data Edited",
2871
+ "icon": "fa fa-lg fa-chevron-right",
2872
+ "groupTitle": "Grid Events",
2873
+ "groupIcon": "fa fa-lg fa-cubes",
2874
+ "defaultValue": false,
2875
+ "show": [
2876
+ "rowDataUpdated"
2877
+ ],
2878
+ "noChangeOnHide": true,
2879
+ "type": "boolean",
2880
+ "groupEnabler": true,
2881
+ "children": [
2882
+ {
2883
+ "name": "rowDataUpdated",
2884
+ "attributeStartsWith": "dmx-on",
2885
+ "attribute": "row_data_edited",
2886
+ "isValue": true,
2887
+ "actionsPicker": true,
2888
+ "title": "Action:",
2889
+ "type": "text",
2890
+ "help": "Choose the action to execute.",
2891
+ "defaultValue": "",
2892
+ "initDisplay": "none"
2893
+ }
2894
+ ],
2895
+ "allowedOn": {
2896
+ "dmx-ag-grid": true
2897
+ }
2898
+ },
2807
2899
  {
2808
2900
  "name": "dmx-ag-grid-checkbox-checked",
2809
2901
  "attributeStartsWith": "dmx-on",
package/dmx-ag-grid.js CHANGED
@@ -30,6 +30,8 @@ dmx.Component('ag-grid', {
30
30
  auto_header_height: { type: Boolean, default: true },
31
31
  wrap_text: { type: Boolean, default: false },
32
32
  auto_height: { type: Boolean, default: false },
33
+ vert_center_cell_data: { type: Boolean, default: false },
34
+ horz_center_cell_data: { type: Boolean, default: false },
33
35
  data_changes: { type: Array, default: [] },
34
36
  display_data_changes: { type: Array, default: [] },
35
37
  js_data_changes: { type: Array, default: [] },
@@ -57,7 +59,6 @@ dmx.Component('ag-grid', {
57
59
  suppress_scroll_on_new_data: { type: Boolean, default: false },
58
60
  suppress_property_names_check: { type: Boolean, default: false },
59
61
  hide_id_field: { type: Boolean, default: false },
60
- id_present: { type: Boolean, default: false },
61
62
  numeric_column_align: { type: Boolean, default: false },
62
63
  enable_rtl: { type: Boolean, default: false },
63
64
  locale_text: { type: String, default: null },
@@ -67,6 +68,8 @@ dmx.Component('ag-grid', {
67
68
  amount_field_precision: { type: Number, default: 2 },
68
69
  min_width: { type: Number, default: 150 },
69
70
  sortable: { type: Boolean, default: true },
71
+ cell_editable: { type: Boolean, default: false },
72
+ row_editable: { type: Boolean, default: false },
70
73
  ci_sort: { type: Boolean, default: false },
71
74
  resizable: { type: Boolean, default: true },
72
75
  filter: { type: Boolean, default: true },
@@ -394,6 +397,7 @@ dmx.Component('ag-grid', {
394
397
  let cellRenderer;
395
398
  const gridThemeClass = options.dark_mode ? `${options.grid_theme}-dark` : options.grid_theme;
396
399
  this.$node.innerHTML = `<div id=${options.id}-grid class="${gridThemeClass}"></div>`;
400
+ let idFieldPresent = false;
397
401
  if (!rowData || rowData.length === 0) {
398
402
  console.error('No row data provided.');
399
403
  return;
@@ -958,6 +962,7 @@ dmx.Component('ag-grid', {
958
962
  columnDefs = this.props.column_defs;
959
963
  } else {
960
964
  const firstRow = rowData[0];
965
+ idFieldPresent = Object.keys(firstRow).includes('id');
961
966
  columnDefs = Object.keys(firstRow).map(key => {
962
967
  // Assuming rowData is an array of objects
963
968
  const values = rowData.map(row => row[key]);
@@ -1187,6 +1192,7 @@ dmx.Component('ag-grid', {
1187
1192
  checkboxSelection: true,
1188
1193
  showDisabledCheckboxes: true,
1189
1194
  resizable: false,
1195
+ editable: false,
1190
1196
  width: 50,
1191
1197
  maxWidth: 50,
1192
1198
  suppressMenu: true
@@ -1204,6 +1210,7 @@ dmx.Component('ag-grid', {
1204
1210
  minWidth: options.actions_column_min_width,
1205
1211
  maxWidth: options.actions_column_max_width,
1206
1212
  autoHeight: true,
1213
+ editable: false,
1207
1214
  pinned: (options.pin_actions ? options.actions_column_position: undefined),
1208
1215
  cellRendererParams: {
1209
1216
  buttons: [],
@@ -1292,7 +1299,7 @@ dmx.Component('ag-grid', {
1292
1299
  localeText = AG_GRID_LOCALE_PT
1293
1300
  }
1294
1301
  const gridOptions = {
1295
- ...(options.id_present ? { getRowId: params => params.data.id } : {}),
1302
+ ...(idFieldPresent ? { getRowId: params => params.data.id } : {}),
1296
1303
  columnDefs: (groupedColumnDefs && groupedColumnDefs.length > 0) ? groupedColumnDefs : columnDefs,
1297
1304
  localeText: localeText,
1298
1305
  enableRtl: options.enable_rtl,
@@ -1310,8 +1317,10 @@ dmx.Component('ag-grid', {
1310
1317
  autoHeight: options.auto_height,
1311
1318
  filter: options.filter,
1312
1319
  sortable: options.sortable,
1320
+ editable: options.cell_editable,
1313
1321
  floatingFilter: options.floating_filter
1314
1322
  },
1323
+ editType: (options.row_editable ? 'fullRow': undefined),
1315
1324
  domLayout: this.props.dom_layout,
1316
1325
  enableCellTextSelection: true,
1317
1326
  rowSelection: this.props.row_selection,
@@ -1389,6 +1398,20 @@ dmx.Component('ag-grid', {
1389
1398
  updateHoveringBarStyles();
1390
1399
  }
1391
1400
  },
1401
+ onCellValueChanged: (params) => {
1402
+ this.set('data', params.data);
1403
+ this.set('id', params.data.id);
1404
+ dmx.nextTick(function() {
1405
+ this.dispatchEvent('cell_data_edited');
1406
+ }, this);
1407
+ },
1408
+ onRowValueChanged: (params) => {
1409
+ this.set('data', params.data);
1410
+ this.set('id', params.data.id);
1411
+ dmx.nextTick(function() {
1412
+ this.dispatchEvent('row_data_edited');
1413
+ }, this);
1414
+ },
1392
1415
  components: {
1393
1416
  clickCellRenderer: clickCellRenderer,
1394
1417
  checkboxCellRenderer: checkboxCellRenderer,
@@ -1509,6 +1532,29 @@ dmx.Component('ag-grid', {
1509
1532
  }
1510
1533
 
1511
1534
  const gridElement = document.getElementById(options.id+'-grid');
1535
+ if (options.vert_center_cell_data || options.horz_center_cell_data) {
1536
+ const styleElement = document.createElement('style');
1537
+ if (options.vert_center_cell_data) {
1538
+ styleElement.textContent += `
1539
+ .ag-cell {
1540
+ display: flex;
1541
+ align-items: center;
1542
+ }
1543
+ `;
1544
+ }
1545
+ if (options.horz_center_cell_data) {
1546
+ styleElement.textContent += `
1547
+ .ag-cell {
1548
+ display: flex;
1549
+ justify-content: center;
1550
+ }
1551
+ .ag-header-cell-label {
1552
+ justify-content: center;
1553
+ }
1554
+ `;
1555
+ }
1556
+ gridElement.appendChild(styleElement);
1557
+ }
1512
1558
  if (options.compact_view) {
1513
1559
  gridElement.style.setProperty('--ag-grid-size', `${options.compact_view_grid_size}`+'px');
1514
1560
  gridElement.style.setProperty('--ag-list-item-height', `${options.compact_view_item_height}`+'px');
@@ -1604,9 +1650,8 @@ dmx.Component('ag-grid', {
1604
1650
  }
1605
1651
  }
1606
1652
  function updateHoveringBarStyles() {
1607
- const existingStyle = document.getElementById('hovering-bar-style');
1653
+ const existingStyle = gridElement.querySelector('#hovering-bar-style');
1608
1654
  if (options.fixed_horizontal_scroll) {
1609
- // Create a new style element
1610
1655
  const styleElement = document.createElement('style');
1611
1656
  styleElement.id = 'hovering-bar-style';
1612
1657
  const agRootWrapper = gridElement.querySelector('.ag-root-wrapper');
@@ -1623,7 +1668,7 @@ dmx.Component('ag-grid', {
1623
1668
  if (existingStyle) {
1624
1669
  existingStyle.parentNode.replaceChild(styleElement, existingStyle);
1625
1670
  } else {
1626
- document.head.appendChild(styleElement);
1671
+ gridElement.appendChild(styleElement);
1627
1672
  }
1628
1673
  } else if (existingStyle) {
1629
1674
  // Remove the style element if it exists
@@ -1728,6 +1773,8 @@ dmx.Component('ag-grid', {
1728
1773
  row_clicked: Event,
1729
1774
  row_double_clicked: Event,
1730
1775
  cell_clicked: Event,
1776
+ cell_data_edited: Event,
1777
+ row_data_edited: Event,
1731
1778
  row_checkbox_checked: Event,
1732
1779
  row_checkbox_unchecked: Event,
1733
1780
  row_status_enabled: Event,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.5.13",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",