@cdmx/wappler_ag_grid 0.5.9 → 0.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
@@ -148,10 +148,34 @@ Enter the names of fields you want to hide separated by commas. The specified fi
148
148
  Enter the names of filters you want to hide separated by commas. The specified filters will be hidden from the view.
149
149
 
150
150
  **Hide Sort Filters**
151
- Enter the names of sort filters you want to hide separated by commas. The specified sort filters will be hidden from the view.
151
+ Enter the names of the sort filters you want to hide separated by commas. The specified sort filters will be hidden from the view.
152
152
 
153
153
  ---
154
154
 
155
+ # Amount Fields
156
+ The amount fields configuration consists of the following parameters:
157
+
158
+ - **Amount Fields** (Type: checkbox, Default: false)
159
+ - Enable or disable the comma-separation for amount fields.
160
+
161
+ - **Amount Fields** (Type: textbox, Default: null)
162
+ - Define the fields where the comma-separation and float parsing need to be applied.
163
+ ---
164
+
165
+ # Compact View
166
+ The compact view configuration consists of the following parameters:
167
+
168
+ - **Compact View** (Type: checkbox, Default: false)
169
+ - Enable or disable the compact view for the grid.
170
+
171
+ - **Grid Size** (Type: number, Default: 3)
172
+ - Specify the grid size for the compact view. This determines the number of columns in each row.
173
+
174
+ - **Grid Item Height** (Type: number, Default: 20)
175
+ - Set the height of each item in the compact view.
176
+
177
+ ---
178
+
155
179
  # Configure Actions Column
156
180
  The Configure Actions Column feature allows you to configure actions for the buttons in the Actions Column.
157
181
 
@@ -202,6 +226,17 @@ Specify the tooltip text for the Delete Action button.
202
226
  Specify the CSS class for styling the Delete Action button.
203
227
  Specify the CSS class for styling the icon of the Delete Action button.
204
228
 
229
+ # Action Attributes
230
+
231
+ **Load**
232
+ - Mainly to be used in conjunction with "No Auto Load" enabled so that you can load only when certain conditions are met.
233
+ - Use Case: Used when you're awaiting the population of specific elements or data before loading the grid. It's also useful for refreshing the grid intentionally.
234
+
235
+ **Reload** (Beta)
236
+ - To be used in conjunction with "No Auto Load" being enabled
237
+ - This performs a transactional update of the client-side data in the grid after comparing the existing and updated datasets
238
+ - To use this: Enable "No Auto Load", On Edit or update actions, perform an SC load, On Success of SC load perform the AG Grid Module Reload Action.
239
+
205
240
  ## License
206
241
 
207
242
  The AG Grid module is licensed under the MIT License. Please refer to the license file for more details.
package/dmx-ag-grid.js CHANGED
@@ -96,16 +96,48 @@ dmx.Component('ag-grid', {
96
96
  },
97
97
  reloadGrid: function () {
98
98
  dmx.nextTick(function() {
99
- this.refreshGrid();
99
+ this.transactionUpdate();
100
100
  }, this);
101
101
  },
102
102
  loadGrid: function () {
103
103
  dmx.nextTick(function() {
104
- this.refreshGrid();
104
+ let gridInstance = this.refreshGrid();
105
+ this.set('gridInstance', gridInstance);
105
106
  }, this);
106
107
  }
107
108
  },
108
109
 
110
+ transactionUpdate: function () {
111
+ // const oldRowData = this.get('oldData');
112
+ const gridInstance = this.get('gridInstance');
113
+ const oldRowData = gridInstance.gridOptions.api.getModel().rowsToDisplay.map(row => row.data);
114
+ const newRowData = this.props.data;
115
+ let transaction;
116
+
117
+ if (oldRowData && oldRowData.length > 0) {
118
+ const addedRows = newRowData.filter(newRow => !oldRowData.some(oldRow => newRow.id === oldRow.id));
119
+ const removedRows = oldRowData.filter(oldRow => !newRowData.some(newRow => oldRow.id === newRow.id));
120
+ const updatedRows = newRowData.filter(newRow => {
121
+ const oldRow = oldRowData.find(old => old.id === newRow.id);
122
+ return oldRow && JSON.stringify(oldRow) !== JSON.stringify(newRow);
123
+ });
124
+
125
+ // Apply transactional updates to AG Grid
126
+ transaction = {
127
+ add: addedRows,
128
+ remove: removedRows,
129
+ update: updatedRows,
130
+ };
131
+ }
132
+
133
+ if (gridInstance && gridInstance.gridOptions && transaction) {
134
+ gridInstance.gridOptions.api.applyTransaction(transaction);
135
+ gridInstance.gridOptions.api.refreshCells();
136
+ } else {
137
+ console.error('AG Grid instance or transaction not found.');
138
+ }
139
+ },
140
+
109
141
  refreshGrid: function () {
110
142
  const options = this.props
111
143
  const rowData = this.props.data;
@@ -540,6 +572,7 @@ dmx.Component('ag-grid', {
540
572
  let filterParams;
541
573
  let minWidth;
542
574
  let hide;
575
+ let type;
543
576
  let colId;
544
577
 
545
578
  if (dataType === 'number') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.5.9",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation",
6
6
  "license": "MIT",