@cdmx/wappler_ag_grid 1.0.5 → 1.0.6

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 },
@@ -617,7 +618,7 @@ dmx.Component('ag-grid', {
617
618
  return 'text';
618
619
  }
619
620
  }
620
- createCombinedValueGetter = (key, dataChanges, dataBindedChanges) => {
621
+ createCombinedValueGetter = (key, dataChanges, dataBindedChanges, displayDataChanges) => {
621
622
  const keyLookup = {};
622
623
 
623
624
  dataBindedChanges.forEach(change => {
@@ -636,6 +637,20 @@ dmx.Component('ag-grid', {
636
637
 
637
638
  return function (params) {
638
639
  const value = params.data[key];
640
+
641
+ if ((displayDataChanges.length > 0) && displayDataChanges.some(change => change.field === params.colDef.field)) {
642
+ const placeholderMap = Object.fromEntries(
643
+ Object.entries(params.data).map(([field, fieldValue]) => [`%${field}%`, fieldValue])
644
+ );
645
+ return displayDataChanges.reduce((cellData, change) => {
646
+ if (change.field === params.colDef.field) {
647
+ const placeholders = Object.keys(placeholderMap).join('|');
648
+ const regex = new RegExp(placeholders, 'g');
649
+ cellData = change.data.replace(regex, match => placeholderMap[match]);
650
+ }
651
+ return cellData;
652
+ }, value);
653
+ }
639
654
 
640
655
  // Check if there's a matching change in dataChanges
641
656
  const matchingChange = dataChanges.find(change => change.field === key && change.value === String(value));
@@ -821,7 +836,7 @@ dmx.Component('ag-grid', {
821
836
  }
822
837
  }
823
838
  else {
824
- valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes);
839
+ valueGetter = createCombinedValueGetter(key, options.data_changes, options.data_binded_changes, options.display_data_changes);
825
840
  filterValueGetter = createCombinedFilterValueGetter(key, options.data_changes, options.data_binded_changes);
826
841
  tooltipValueGetter = createCombinedTooltipValueGetter(key, options.data_changes, options.data_binded_changes);
827
842
 
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.6",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",