@cdmx/wappler_ag_grid 0.9.3 → 0.9.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
@@ -341,6 +341,10 @@ Specify the tooltip text for Button 10.
341
341
  - This action enables you to reset the grid's column state to default state.
342
342
  - It is useful when you want to revert the column configuration to a default configuration.
343
343
 
344
+ **Pin Columns to Left**
345
+ - This action allows you to pin one or more columns to the left side of the grid.
346
+ - It is useful when you want to freeze specific columns in place for easy reference, even as you scroll horizontally.
347
+
344
348
  **Import File Data**
345
349
  - The "Import File Data" action allows to import data from CSV and XLSX files into the AG Grid. This action simplifies the process of populating the grid with external data sources.
346
350
  - Key Features:
@@ -1851,9 +1851,29 @@
1851
1851
  name: 'resetColumnState',
1852
1852
  icon: 'fa fa-lg fa-undo',
1853
1853
  state: 'opened',
1854
- help: 'Save Column State to Browser Local Storage',
1854
+ help: 'Reset Column State stored in Browser Local Storage',
1855
1855
  properties: []
1856
1856
  },
1857
+ {
1858
+ addTitle: 'pinColumnsState',
1859
+ title: 'Pin Columns',
1860
+ name: 'pinColumns',
1861
+ icon: 'fa fa-lg fa-thumbtack',
1862
+ state: 'opened',
1863
+ help: 'Pin Columns to Left',
1864
+ properties: [
1865
+ {
1866
+ group: 'Properties',
1867
+ variables: [
1868
+ {
1869
+ name: '1', optionName: '1', title: 'Column Name', type: 'text',
1870
+ dataBindings: true, defaultValue: '', required: true,
1871
+ help: 'Column Name to Pin to the Left'
1872
+ }
1873
+ ]
1874
+ }
1875
+ ]
1876
+ },
1857
1877
  {
1858
1878
  addTitle: 'importFileData',
1859
1879
  title: 'Import File Data',
package/dmx-ag-grid.js CHANGED
@@ -193,6 +193,9 @@ dmx.Component('ag-grid', {
193
193
  this.set('gridInstance', gridInstance);
194
194
  }, this);
195
195
  },
196
+ pinColumns: function (fieldId) {
197
+ pinColumnToLeft(fieldId);
198
+ },
196
199
  importFileData: async function (fieldId) {
197
200
  await this.parseFileData(fieldId);
198
201
  },
@@ -1177,6 +1180,16 @@ dmx.Component('ag-grid', {
1177
1180
  const gridConfig = {
1178
1181
  onGridReady: function (params) {
1179
1182
  const columnApi = params.columnApi;
1183
+ pinColumnToLeft = (fieldToPin) => {
1184
+ const columnState = columnApi.getColumnState();
1185
+ const columnIndex = columnState.findIndex(column => column.colId === fieldToPin);
1186
+ if (columnIndex !== -1) {
1187
+ for (let i = 0; i <= columnIndex; i++) {
1188
+ columnState[i].pinned = 'left';
1189
+ }
1190
+ columnApi.applyColumnState({ state: columnState });
1191
+ }
1192
+ }
1180
1193
  saveColumnStateToStorage = () => {
1181
1194
  const columnState = columnApi.getColumnState();
1182
1195
  const pageId = getPageId();
@@ -1349,23 +1362,19 @@ dmx.Component('ag-grid', {
1349
1362
  // Create the export button
1350
1363
  if (exportToCSV) {
1351
1364
  const existingExportButton = document.getElementById('exportButton');
1352
- // If it already exists, just exit the function
1353
1365
  if (existingExportButton) {
1354
1366
  return;
1355
1367
  }
1356
1368
  const exportButton = document.createElement('button');
1357
1369
  exportButton.id = 'exportButton';
1358
-
1359
- // Add the icon
1360
1370
  const icon = document.createElement('i');
1361
- icon.classList.add('fas', 'fa-file-csv'); // Use the Font Awesome icon class here
1371
+ icon.classList.add('fas', 'fa-file-csv');
1362
1372
  exportButton.appendChild(icon);
1363
1373
 
1364
1374
  // Add the button text
1365
1375
  const buttonText = document.createElement('span');
1366
1376
  buttonText.innerText = ' Export to CSV';
1367
1377
  exportButton.appendChild(buttonText);
1368
- // Add some fancy styles to the button
1369
1378
  exportButton.style.backgroundColor = '#4CAF50';
1370
1379
  exportButton.style.border = 'none';
1371
1380
  exportButton.style.color = 'white';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "type": "module",
5
5
  "description": "App Connect module for AG Grid Table Generation.",
6
6
  "license": "MIT",