@cdmx/wappler_ag_grid 2.0.20 → 2.1.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
@@ -1,65 +1,30 @@
1
1
  #### Developed and Maintained by: Roney Dsilva
2
2
 
3
- **Major Update:** This release upgrades from AG Grid v32.3.7 to v34.1.0, bringing significant performance improvements and exciting new features.
3
+ **Major Update:** This release upgrades AG Grid to v35.1.0, bringing continued performance improvements and new features.
4
4
 
5
- ## 🚀 What's New in v2.0.19
5
+ ## 🚀 What's New in v2.0.23
6
6
 
7
- 1. **🔥 AG Grid v34.1.0** - Latest version with all community features
8
- 2. **⚡ Performance Boost** - Up to 40% bundle size reduction potential
7
+ 1. **🔥 AG Grid v35.1.0** - Latest version with all community features
8
+ 2. **⚡ Smooth Upgrade** - Non-breaking upgrade from v34, all existing configurations continue to work
9
9
  3. **🎨 HTML Tooltips** - Rich HTML tooltip support with JavaScript functions
10
10
  4. **🔧 Enhanced Tooltip System** - Custom tooltip components with automatic HTML detection
11
- 5. **🚫 Suppress Model Update** - New option to prevent automatic reprocessing after update transactions
11
+ 5. **🚫 Suppress Model Update** - Option to prevent automatic reprocessing after update transactions
12
12
 
13
- - **Breaking Changes:** Some configurations may require updates due to AG Grid v33/v34 changes
14
-
15
- ## 🚀 What's New in AG Grid v34.1.0
16
-
17
- ### New Features Available in This Release:
18
-
19
- 1. **✅ Cell Editor Validation** - Built-in validation for all cell editors:
20
- - Automatic constraint checking based on column configuration
21
- - Override defaults with custom validation rules
22
- - Handle invalid values by reverting or blocking changes
23
-
24
- 2. **🎯 Bulk Cell Editing** - Edit multiple cells in a single action:
25
- - Select cells, enter new value, commit with Tab key
26
- - Ideal for updating status of multiple items or overriding null values
27
-
28
- 3. **⚡ Performance Improvements** - Up to 40% bundle size reduction through:
29
- - Modular architecture improvements
30
- - Better tree-shaking capabilities
31
- - Optimized loading times
32
-
33
- 4. **🎨 Enhanced Theming** - New Theming API for:
34
- - Dynamic theme manipulation at runtime
35
- - Better integration with Theme Builder
36
- - Easy customization via theme parameters
37
-
38
- ## 🔄 Migration from v1.x to v2.0
13
+ ## 🔄 Migration from v34 to v35
39
14
 
40
15
  ### Compatibility Notes:
41
- - **Good News:** This upgrade is largely **non-breaking** for existing implementations
16
+ - **Good News:** This upgrade is **non-breaking** for existing implementations
42
17
  - Your existing grids should continue to work without changes
43
- - AG Grid v34 is non-breaking from v33, so most configurations remain the same
18
+ - No deprecated API removals in v35
19
+
20
+ ### What Changed Internally:
21
+ - New automatic overlays for filtering and exporting are now suppressed by default to preserve existing overlay behavior
22
+ - Date/number filter range validation now enforces start < end
44
23
 
45
24
  ### Recommended Steps:
46
- 1. **Update Package:** Simply update to v2.0.2 - no code changes required for basic functionality
25
+ 1. **Update Package:** Simply update to the latest version - no code changes required
47
26
  2. **Test Your Grids:** Verify existing grids work as expected
48
- 3. **Explore New Features:** Gradually enable new v34 features as needed:
49
- - Enable Cell Editor Validation for better data quality
50
- - Try Batch/Bulk editing for improved user experience
51
- - Use the new Filters Tool Panel for better UX
52
- - Implement Tree Data Drag & Drop for hierarchical data
53
-
54
- ### Performance Benefits:
55
- - **Bundle Size:** Potential 20-40% reduction in bundle size
56
- - **Loading Speed:** Faster grid initialization
57
- - **Memory Usage:** Improved memory efficiency
58
-
59
- ### Breaking Changes (Minimal):
60
- - Some very old deprecated APIs (from v31 and earlier) have been removed
61
- - If you customized AG Grid CSS extensively, test your styling
62
- - The new Theming API is now default (but legacy CSS themes still work)
27
+ 3. **Test Exports:** Verify CSV/PDF exports work correctly
63
28
 
64
29
  # AG Grid Module Documentation
65
30
 
@@ -636,7 +601,94 @@ You can also specify left-only conditions, where only the field name is provided
636
601
  - The "Quick Filter" feature is designed to filter the results based on the value in the Filter Field defined in above settings.
637
602
  - Quick Filter is used to filter rows by comparing against the data in all columns. This can be used in addition to column-specific filtering.
638
603
 
639
- ## 💡 Implementation Examples for v34 Features
604
+ **Get Applied Filters**
605
+ - This action retrieves the currently applied filters from the grid and stores them in the `filterState` property.
606
+ - Use this to capture the current filter configuration for display, logging, or saving to a database.
607
+ - Returns an object with field names as keys and filter configurations as values.
608
+
609
+ **Get Filtered Data**
610
+ - This action retrieves all currently visible rows after filters have been applied.
611
+ - Unlike the grid's raw data, this returns only the rows that match the active filters.
612
+ - Useful for exporting filtered results or performing calculations on filtered data.
613
+
614
+ **Apply Filters**
615
+ - This action applies filters programmatically to the grid without user interaction.
616
+ - Pass a filter model object with the structure: `{ "fieldName": { type: "FilterType", filter: "value" } }`
617
+ - Automatically updates the `filterState` property with the applied filters.
618
+ - Example: `agGrid.applyFilters({ "status": { type: "Contains", filter: "Active" } })`
619
+
620
+ **Clear Filters**
621
+ - This action removes all currently applied filters from the grid.
622
+ - Useful for resetting the grid view or preparing for new filter configurations.
623
+ - Automatically clears the `filterState` property.
624
+
625
+ ## 💡 Implementation Examples
626
+
627
+ ### Filter Management Examples
628
+
629
+ **Getting Applied Filters**
630
+ ```javascript
631
+ // Retrieve current filters and store in filterState
632
+ agGrid.getAppliedFilters();
633
+
634
+ // Access the filters programmatically
635
+ const filters = agGrid.filterState;
636
+ console.log(filters);
637
+ // Output: { "name": { type: "Contains", filter: "John" }, "age": { type: "GreaterThan", filter: 30 } }
638
+ ```
639
+
640
+ **Getting Filtered Data**
641
+ ```javascript
642
+ // Get all rows that match the current filters
643
+ const filteredData = agGrid.getFilteredData();
644
+
645
+ // Use for calculations, exports, or other operations
646
+ const totalRows = filteredData.length;
647
+ const avgAge = filteredData.reduce((sum, row) => sum + row.age, 0) / filteredData.length;
648
+ ```
649
+
650
+ **Applying Filters Programmatically**
651
+ ```javascript
652
+ // Apply single filter
653
+ agGrid.applyFilters({
654
+ "status": { type: "Contains", filter: "Active" }
655
+ });
656
+
657
+ // Apply multiple filters
658
+ agGrid.applyFilters({
659
+ "department": { type: "Contains", filter: "Sales" },
660
+ "salary": { type: "GreaterThan", filter: 50000 },
661
+ "joinDate": { type: "GreaterThan", filter: "2023-01-01" }
662
+ });
663
+ ```
664
+
665
+ **Clearing Filters**
666
+ ```javascript
667
+ // Remove all filters from the grid
668
+ agGrid.clearFilters();
669
+
670
+ // The filterState will be reset to an empty object
671
+ console.log(agGrid.filterState); // Output: {}
672
+ ```
673
+
674
+ **Filter Model Structure**
675
+ ```javascript
676
+ // Common filter types and their structures:
677
+
678
+ // Text filters
679
+ { "name": { type: "Contains", filter: "John" } }
680
+ { "name": { type: "NotContains", filter: "Smith" } }
681
+ { "name": { type: "Equals", filter: "John Doe" } }
682
+
683
+ // Number filters
684
+ { "age": { type: "GreaterThan", filter: 30 } }
685
+ { "age": { type: "LessThan", filter: 65 } }
686
+ { "age": { type: "Equals", filter: 35 } }
687
+
688
+ // Date filters (use date strings or timestamps)
689
+ { "joinDate": { type: "GreaterThan", filter: "2023-01-01" } }
690
+ { "joinDate": { type: "LessThan", filter: "2024-12-31" } }
691
+ ```
640
692
 
641
693
  ### Cell Editor Validation Example
642
694
  ```javascript
@@ -692,14 +744,14 @@ tree_data_drag_drop: true
692
744
  // ]
693
745
  ```
694
746
 
695
- ## 🔧 Best Practices for v34
747
+ ## 🔧 Best Practices
696
748
 
697
- 1. **Performance:** Start with basic features and gradually enable v34 enhancements
749
+ 1. **Performance:** Start with basic features and gradually enable enhancements
698
750
  2. **Testing:** Test new features in development before production deployment
699
- 3. **Bundle Size:** Monitor bundle size improvements with the new architecture
700
- 4. **User Experience:** Combine multiple v34 features for enhanced workflows:
751
+ 3. **Bundle Size:** Monitor bundle size improvements with the modular architecture
752
+ 4. **User Experience:** Combine multiple features for enhanced workflows:
701
753
  - Use Batch Editing + Validation for better data entry
702
- - Combine New Filters Tool Panel with server-side data
754
+ - Combine Filters Tool Panel with server-side data
703
755
  - Use Tree Data + Drag & Drop for hierarchical management
704
756
 
705
757
  ## License
@@ -57,6 +57,11 @@
57
57
  "name": "columnState",
58
58
  "title": "columnState",
59
59
  "type": "array"
60
+ },
61
+ {
62
+ "name": "filterState",
63
+ "title": "filterState",
64
+ "type": "object"
60
65
  }
61
66
  ],
62
67
  "outputType": "object",
@@ -3795,6 +3800,53 @@
3795
3800
  state: 'opened',
3796
3801
  help: 'Quick Search',
3797
3802
  properties: []
3803
+ },
3804
+ {
3805
+ addTitle: 'getAppliedFilters',
3806
+ title: 'Get Applied Filters',
3807
+ name: 'getAppliedFilters',
3808
+ icon: 'fa fa-lg fa-filter',
3809
+ state: 'opened',
3810
+ help: 'Get Currently Applied Filters and Store in filterState',
3811
+ properties: []
3812
+ },
3813
+ {
3814
+ addTitle: 'getFilteredData',
3815
+ title: 'Get Filtered Data',
3816
+ name: 'getFilteredData',
3817
+ icon: 'fa fa-lg fa-list',
3818
+ state: 'opened',
3819
+ help: 'Get All Filtered Row Data',
3820
+ properties: []
3821
+ },
3822
+ {
3823
+ addTitle: 'applyFilters',
3824
+ title: 'Apply Filters',
3825
+ name: 'applyFilters',
3826
+ icon: 'fa fa-lg fa-check-circle',
3827
+ state: 'opened',
3828
+ help: 'Apply Filters Programmatically',
3829
+ properties: [
3830
+ {
3831
+ group: 'Properties',
3832
+ variables: [
3833
+ {
3834
+ name: '1', optionName: '1', title: 'Filter Model', type: 'text',
3835
+ dataBindings: true, defaultValue: '{}', required: true,
3836
+ help: 'Filter model object with field-filter mappings'
3837
+ }
3838
+ ]
3839
+ }
3840
+ ]
3841
+ },
3842
+ {
3843
+ addTitle: 'clearFilters',
3844
+ title: 'Clear Filters',
3845
+ name: 'clearFilters',
3846
+ icon: 'fa fa-lg fa-times-circle',
3847
+ state: 'opened',
3848
+ help: 'Remove All Applied Filters',
3849
+ properties: []
3798
3850
  }
3799
3851
  ],
3800
3852
  "children": [],
package/dmx-ag-grid.js CHANGED
@@ -7,6 +7,7 @@ dmx.Component('ag-grid', {
7
7
  fileData: [],
8
8
  selectedRows: [],
9
9
  columnState: [],
10
+ filterState: [],
10
11
  state: {
11
12
  gridReady: !1,
12
13
  firstDataRendered: !1,
@@ -403,6 +404,60 @@ dmx.Component('ag-grid', {
403
404
  },
404
405
  quickFilter: function () {
405
406
  onFilterTextBoxChanged();
407
+ },
408
+ getAppliedFilters: function () {
409
+ dmx.nextTick(function() {
410
+ const gridInstance = this.get('gridInstance');
411
+ if (gridInstance) {
412
+ const filterModel = gridInstance.getFilterModel();
413
+ this.set('filterState', filterModel || {});
414
+ return filterModel;
415
+ } else {
416
+ console.error('Grid not loaded to get filters');
417
+ return null;
418
+ }
419
+ }, this);
420
+ },
421
+ getFilteredData: function () {
422
+ dmx.nextTick(function() {
423
+ const gridInstance = this.get('gridInstance');
424
+ if (gridInstance) {
425
+ const filteredData = [];
426
+ gridInstance.forEachNodeAfterFilter(node => {
427
+ if (node.data) {
428
+ filteredData.push(node.data);
429
+ }
430
+ });
431
+ return filteredData;
432
+ } else {
433
+ console.error('Grid not loaded to get filtered data');
434
+ return null;
435
+ }
436
+ }, this);
437
+ },
438
+ applyFilters: function (filterModel) {
439
+ dmx.nextTick(function() {
440
+ const gridInstance = this.get('gridInstance');
441
+ if (gridInstance && filterModel) {
442
+ gridInstance.setFilterModel(filterModel);
443
+ gridInstance.onFilterChanged();
444
+ this.set('filterState', filterModel);
445
+ } else {
446
+ console.error('Grid not loaded or filter model is invalid');
447
+ }
448
+ }, this);
449
+ },
450
+ clearFilters: function () {
451
+ dmx.nextTick(function() {
452
+ const gridInstance = this.get('gridInstance');
453
+ if (gridInstance) {
454
+ gridInstance.setFilterModel(null);
455
+ gridInstance.onFilterChanged();
456
+ this.set('filterState', {});
457
+ } else {
458
+ console.error('Grid not loaded to clear filters');
459
+ }
460
+ }, this);
406
461
  }
407
462
  },
408
463
 
@@ -1772,6 +1827,7 @@ dmx.Component('ag-grid', {
1772
1827
  suppressScrollOnNewData: this.props.suppress_scroll_on_new_data,
1773
1828
  columnHoverHighlight: this.props.column_hover_highlight,
1774
1829
  tooltipShowDelay: options.tooltip_show_delay,
1830
+ suppressOverlays: ['noMatchingRows', 'exporting'],
1775
1831
  onFilterModified: function (params) {
1776
1832
  const columnApi = params.api;
1777
1833
  const rowCount = columnApi.getDisplayedRowCount();
@@ -1987,16 +2043,19 @@ dmx.Component('ag-grid', {
1987
2043
  const gridConfig = {
1988
2044
  columnDefs: columnDefs,
1989
2045
  ...gridOptions,
1990
- // Store export configuration for each grid instance
1991
- exportConfig: {
1992
- export_csv_filename: options.export_csv_filename,
1993
- export_pdf_filename: options.export_pdf_filename,
1994
- export_remove_html: options.export_remove_html,
1995
- export_trim_data: options.export_trim_data,
1996
- export_exclude_fields: options.export_exclude_fields,
1997
- export_exclude_hidden_fields: options.export_exclude_hidden_fields,
1998
- group_config: options.group_config,
1999
- column_state_storage_key: options.column_state_storage_key
2046
+ // Store export configuration in context to avoid AG Grid warnings
2047
+ context: {
2048
+ ...gridOptions.context,
2049
+ exportConfig: {
2050
+ export_csv_filename: options.export_csv_filename,
2051
+ export_pdf_filename: options.export_pdf_filename,
2052
+ export_remove_html: options.export_remove_html,
2053
+ export_trim_data: options.export_trim_data,
2054
+ export_exclude_fields: options.export_exclude_fields,
2055
+ export_exclude_hidden_fields: options.export_exclude_hidden_fields,
2056
+ group_config: options.group_config,
2057
+ column_state_storage_key: options.column_state_storage_key
2058
+ }
2000
2059
  }
2001
2060
  };
2002
2061
  // Store gridConfig on component instance for export functions
@@ -2188,7 +2247,7 @@ dmx.Component('ag-grid', {
2188
2247
  };
2189
2248
 
2190
2249
  exportGridData = (currentGridInstance, currentGridConfig) => {
2191
- const exportConfig = currentGridConfig.exportConfig;
2250
+ const exportConfig = currentGridConfig.context.exportConfig;
2192
2251
  const excludedColumnIds = ['checkboxColumn', 'actionsColumn'];
2193
2252
  const exportExcludeFieldsArray = exportConfig.export_exclude_fields ? exportConfig.export_exclude_fields.split(',') : [];
2194
2253
 
@@ -2388,7 +2447,7 @@ dmx.Component('ag-grid', {
2388
2447
  console.error('Grid API is destroyed or not initialized.');
2389
2448
  return;
2390
2449
  }
2391
- const exportConfig = currentGridConfig.exportConfig;
2450
+ const exportConfig = currentGridConfig.context.exportConfig;
2392
2451
  const excludedColumnIds = ['checkboxColumn', 'actionsColumn'];
2393
2452
  const exportExcludeFieldsArray = exportConfig.export_exclude_fields ? exportConfig.export_exclude_fields.split(',') : [];
2394
2453
  let fieldsAndColIds;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@cdmx/wappler_ag_grid",
3
- "version": "2.0.20",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
- "description": "App Connect module for AG Grid v34 - Advanced data grid with enhanced editing, filtering, and tree data capabilities.",
5
+ "description": "App Connect module for AG Grid v35 - Advanced data grid with enhanced editing, filtering, and tree data capabilities.",
6
6
  "license": "MIT",
7
7
  "author": {
8
8
  "name": "cdmx-in",
@@ -14,8 +14,8 @@
14
14
  "ag-grid"
15
15
  ],
16
16
  "dependencies": {
17
- "@ag-grid-community/locale": "~34.1.0",
18
- "ag-grid-community": "~34.1.0",
17
+ "@ag-grid-community/locale": "~35.1.0",
18
+ "ag-grid-community": "~35.1.0",
19
19
  "papaparse": "~5.5.2",
20
20
  "pdfmake": "~0.2.18",
21
21
  "read-excel-file": "~5.8.7"