@linzjs/step-ag-grid 30.2.0 → 30.3.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@linzjs/step-ag-grid",
3
3
  "repository": "github:linz/step-ag-grid.git",
4
4
  "license": "MIT",
5
- "version": "30.2.0",
5
+ "version": "30.3.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -26,6 +26,8 @@ interface FilterUIProps {
26
26
 
27
27
  const EMPTY_KEY = '__EMPTY__';
28
28
  const DEFAULT_EMPTY_LABEL = '-';
29
+ const filterStateMap = new Map<string, boolean>();
30
+ const filterClickCountMap = new Map<string, number>();
29
31
 
30
32
  const FilterUI: React.FC<FilterUIProps> = ({
31
33
  allValues,
@@ -76,7 +78,6 @@ export class GridFilterColumnsMultiSelect implements IFilterComp {
76
78
  private reactRoot: Root | null = null;
77
79
  private filterButtonClickListener: ((e: Event) => void) | null = null;
78
80
  private filterButton: Element | null = null;
79
- private hasOpened = false;
80
81
 
81
82
  private normalizeCellValue(value: unknown): string {
82
83
  if (typeof value === 'string') return value.trim() === '' ? EMPTY_KEY : value;
@@ -134,13 +135,25 @@ export class GridFilterColumnsMultiSelect implements IFilterComp {
134
135
 
135
136
  if (this.filterButton) {
136
137
  this.filterButtonClickListener = (e: Event) => {
137
- if (this.hasOpened) {
138
- e.stopPropagation();
138
+ const clickCount = filterClickCountMap.get(columnId) || 0;
139
+ filterClickCountMap.set(columnId, clickCount + 1);
140
+
141
+ if (clickCount === 0) {
142
+ e.stopImmediatePropagation();
143
+ e.preventDefault();
144
+ this.params.api.hidePopupMenu();
145
+ filterStateMap.set(columnId, false);
146
+ return;
147
+ }
148
+
149
+ const isOpen = filterStateMap.get(columnId) || false;
150
+ if (isOpen) {
151
+ e.stopImmediatePropagation();
139
152
  e.preventDefault();
140
153
  this.params.api.hidePopupMenu();
141
- this.hasOpened = false;
154
+ filterStateMap.set(columnId, false);
142
155
  } else {
143
- this.hasOpened = true;
156
+ filterStateMap.set(columnId, true);
144
157
  }
145
158
  };
146
159