@cdmx/wappler_ag_grid 1.0.5 → 1.0.7

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
@@ -61,9 +61,10 @@ The overrides for the "Custom" theme can be applied in the ag-theme-custom.css f
61
61
  29. **Suppress Scroll on New Data**: Prevents scrolling to newly added data. (Default: false)
62
62
  30. **Suppress Property Names Check**: Disables checking for duplicate property names. (Default: false)
63
63
  31. **Hide ID Field**: Hides the ID Field in the Grid. (Default: false)
64
- 32. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
65
- 33. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
66
- 34. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
64
+ 33. **Numeric Column Align**: Align numeric columns to the right. (Default: false)
65
+ 34. **Row Click Events**: Enables row click events. This can be used in Dynamic events => Grid Events => Row Clicked. (Default: false)
66
+ 35. **Enable Row Selection**: Enables row selection. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
67
+ 36. **Enable Row Status Toggle**: Enables row status toggle events. This can be used in Dynamic events => Grid Events => Checkbox Checked || Checkbox Unchecked. (Default: false)
67
68
 
68
69
  # Data Type Overrides
69
70
 
@@ -101,7 +102,7 @@ This grid allows you to configure custom tooltips for specific fields. The grid
101
102
  # Advanced Data Manipulation
102
103
 
103
104
  The Advanced Data Manipulation feature allows you to add custom values to the field data based on specific conditions.
104
- This grid allows you to define custom data changes for specific fields. The grid has the following columns:
105
+ This grid allows you to define custom data changes for specific fields. The grid has the following settings:
105
106
 
106
107
  1. **Field**: The field name for which you want to apply the custom data changes. (field name)
107
108
  2. **Data**: The new data source or value to be used for the field. (Eg. SC data source array or JSON Data source)
@@ -115,7 +116,7 @@ This grid allows you to define custom data changes for specific fields. The grid
115
116
  # Data Manipulation
116
117
 
117
118
  The Data Manipulation feature allows you to add custom values to the field data based on specific conditions.
118
- This grid allows you to define custom data changes for specific fields. The grid has the following columns:
119
+ This grid allows you to define custom data changes for specific fields. The grid has the following settings:
119
120
 
120
121
  1. **Field**: The field name for which you want to apply the custom data changes.
121
122
  2. **Value**: The value to be replaced in the field data.
@@ -124,7 +125,17 @@ This grid allows you to define custom data changes for specific fields. The grid
124
125
 
125
126
  **Amount Fields** (Type: textbox, Default: null)
126
127
  - Define the fields where the comma-separation and float parsing need to be applied.
127
-
128
+
129
+ ---
130
+
131
+ # Display Data Manipulation
132
+
133
+ The Display Data Manipulation feature allows you to add custom text, Combine fields data.
134
+ The grid has the following settings:
135
+
136
+ 1. **Field**: The field name for which you want to apply the custom data changes.
137
+ 2. **Data**: The value to be replaced in the field data ex: %first_name% %last_name%.
138
+
128
139
  ---
129
140
  # Custom Headers
130
141
 
@@ -890,6 +890,59 @@
890
890
  }
891
891
  ]
892
892
  },
893
+ {
894
+ "group": "📒 Display Data Manipulation",
895
+ "variables": [
896
+ {
897
+ "name": "display_data_changes",
898
+ "title": "Configure Fields",
899
+ "attributeStartsWith": "dmx-bind",
900
+ "attribute": "display_data_changes",
901
+ "type": "boolean",
902
+ "defaultValue": false,
903
+ "display": "fieldset",
904
+ "show": [
905
+ "displayDataChanges",
906
+ ],
907
+ "noChangeOnHide": true,
908
+ "groupEnabler": true,
909
+ "help": "Add custom values for Display, Combine columns and add custom text for display."
910
+ "children": [
911
+ {
912
+ "name": "displayDataChanges",
913
+ "attribute": "dmx-bind:display_data_changes",
914
+ "title": "Fields Data",
915
+ "type": "grid",
916
+ "dataBindings": true,
917
+ "jsonFormat": true,
918
+ "encloseBT": true,
919
+ "jsonBT": true,
920
+ "initDisplay": "none",
921
+ "columns": [
922
+ {
923
+ "field": "field",
924
+ "caption": "Field",
925
+ "editable": {
926
+ "type": "text"
927
+ }
928
+ },
929
+ {
930
+ field: "data",
931
+ caption: "Data",
932
+ editable: {
933
+ type: "text"
934
+ }
935
+ }
936
+ ],
937
+ "newRecord": {
938
+ "field": "",
939
+ "data": ""
940
+ }
941
+ }
942
+ ]
943
+ }
944
+ ]
945
+ },
893
946
  {
894
947
  "group": "📒 Custom Headers",
895
948
  "variables": [
package/dmx-ag-grid.js CHANGED
@@ -24,6 +24,7 @@ dmx.Component('ag-grid', {
24
24
  auto_header_height: { type: Boolean, default: true },
25
25
  wrap_text: { type: Boolean, default: false },
26
26
  data_changes: { type: Array, default: [] },
27
+ display_data_changes: { type: Array, default: [] },
27
28
  data: { type: Array, default: [] },
28
29
  dom_layout: { type: String, default: 'autoHeight' },
29
30
  enable_cell_text_selection: { type: Boolean, default: true },
@@ -337,6 +338,7 @@ dmx.Component('ag-grid', {
337
338
  let groupedColumnDefs = [];
338
339
  let exportToCSV = this.props.export_to_csv;
339
340
  let gridInstance = null;
341
+ let cellRenderer;
340
342
  this.$node.innerHTML = `<div id=${options.id}-grid class="${options.grid_theme}"></div>`;
341
343
  if (!rowData || rowData.length === 0) {
342
344
  console.error('No row data provided.');
@@ -617,7 +619,7 @@ dmx.Component('ag-grid', {
617
619
  return 'text';
618
620
  }
619
621
  }
620
- createCombinedValueGetter = (key, dataChanges, dataBindedChanges) => {
622
+ createCombinedValueGetter = (key, dataChanges, dataBindedChanges, displayDataChanges) => {
621
623
  const keyLookup = {};
622
624
 
623
625
  dataBindedChanges.forEach(change => {
@@ -636,6 +638,20 @@ dmx.Component('ag-grid', {
636
638
 
637
639
  return function (params) {
638
640
  const value = params.data[key];
641
+
642
+ if ((displayDataChanges.length > 0) && displayDataChanges.some(change => change.field === params.colDef.field)) {
643
+ const placeholderMap = Object.fromEntries(
644
+ Object.entries(params.data).map(([field, fieldValue]) => [`%${field}%`, fieldValue])
645
+ );
646
+ return displayDataChanges.reduce((cellData, change) => {
647
+ if (change.field === params.colDef.field) {
648
+ const placeholders = Object.keys(placeholderMap).join('|');
649
+ const regex = new RegExp(placeholders, 'g');
650
+ cellData = change.data.replace(regex, match => placeholderMap[match]);
651
+ }
652
+ return cellData;
653
+ }, value);
654
+ }
639
655
 
640
656
  // Check if there's a matching change in dataChanges
641
657
  const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
@@ -821,7 +837,7 @@ dmx.Component('ag-grid', {
821
837
  }
822
838
  }
823
839
  else {
824
- valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes);
840
+ valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes, options.display_data_changes);
825
841
  filterValueGetter = createCombinedFilterValueGetter(key, options.data_changes, options.data_binded_changes);
826
842
  tooltipValueGetter = createCombinedTooltipValueGetter(key, options.data_changes, options.data_binded_changes);
827
843
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",