@linzjs/step-ag-grid 30.1.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/dist/GridTheme.scss +12 -0
- package/dist/src/components/gridFilter/GridFilterColumnsMultiSelect.d.ts +0 -1
- package/dist/step-ag-grid.cjs +40 -22
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +40 -22
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/gridFilter/GridFilterColumnsMultiSelect.tsx +18 -5
- package/src/components/gridPopoverEdit/{GridPopoverEditDropDown.ts → GridPopoverEditDropDown.tsx} +10 -2
- package/src/contexts/GridContextProvider.tsx +13 -8
- package/src/styles/GridTheme.scss +12 -0
package/package.json
CHANGED
|
@@ -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
|
-
|
|
138
|
-
|
|
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
|
-
|
|
154
|
+
filterStateMap.set(columnId, false);
|
|
142
155
|
} else {
|
|
143
|
-
|
|
156
|
+
filterStateMap.set(columnId, true);
|
|
144
157
|
}
|
|
145
158
|
};
|
|
146
159
|
|
package/src/components/gridPopoverEdit/{GridPopoverEditDropDown.ts → GridPopoverEditDropDown.tsx}
RENAMED
|
@@ -2,14 +2,21 @@ import clsx from 'clsx';
|
|
|
2
2
|
|
|
3
3
|
import { GenericCellEditorProps, GridCell } from '../GridCell';
|
|
4
4
|
import { GridFormDropDown, GridFormDropDownProps } from '../gridForm/GridFormDropDown';
|
|
5
|
+
import { GridIcon } from '../GridIcon';
|
|
5
6
|
import { GenericCellColDef } from '../gridRender/GridRenderGenericCell';
|
|
6
7
|
import { ColDefT, GridBaseRow } from '../types';
|
|
7
8
|
|
|
8
9
|
export const GridPopoverEditDropDown = <TData extends GridBaseRow, TValue = any, TOptionValue = any>(
|
|
9
10
|
colDef: GenericCellColDef<TData, TValue>,
|
|
10
11
|
props: GenericCellEditorProps<GridFormDropDownProps<TData, TOptionValue>>,
|
|
11
|
-
): ColDefT<TData, TValue> =>
|
|
12
|
-
|
|
12
|
+
): ColDefT<TData, TValue> => {
|
|
13
|
+
colDef.cellRendererParams = {
|
|
14
|
+
rightHoverElement: (
|
|
15
|
+
<GridIcon icon={'ic_arrow_drop_down'} title={''} className={'GridCell-editableIcon GridCell-dropDownIcon'} />
|
|
16
|
+
),
|
|
17
|
+
...colDef.cellRendererParams,
|
|
18
|
+
};
|
|
19
|
+
return GridCell<TData, TValue, GridFormDropDownProps<TData, TOptionValue>>(colDef, {
|
|
13
20
|
editor: GridFormDropDown,
|
|
14
21
|
...props,
|
|
15
22
|
editorParams: {
|
|
@@ -24,3 +31,4 @@ export const GridPopoverEditDropDown = <TData extends GridBaseRow, TValue = any,
|
|
|
24
31
|
),
|
|
25
32
|
},
|
|
26
33
|
});
|
|
34
|
+
};
|
|
@@ -41,9 +41,20 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
|
|
|
41
41
|
const enableMultilineBulkEditRef = useRef(false);
|
|
42
42
|
const idsBeforeUpdate = useRef<TData['id'][]>([]);
|
|
43
43
|
const prePopupFocusedCell = useRef<CellPosition>();
|
|
44
|
-
const [externallySelectedItemsAreInSync,
|
|
44
|
+
const [externallySelectedItemsAreInSync, _setExternallySelectedItemsAreInSync] = useState(false);
|
|
45
45
|
const externalFilters = useRef<GridFilterExternal<TData>[]>([]);
|
|
46
46
|
|
|
47
|
+
// waitForExternallySelectedItemsToBeInSync can't use the state as it won't be updated during function execution
|
|
48
|
+
const externallySelectedItemsAreInSyncRef = useRef(false);
|
|
49
|
+
|
|
50
|
+
const setExternallySelectedItemsAreInSync = useCallback(
|
|
51
|
+
(cond: boolean) => {
|
|
52
|
+
_setExternallySelectedItemsAreInSync(cond);
|
|
53
|
+
externallySelectedItemsAreInSyncRef.current = cond;
|
|
54
|
+
},
|
|
55
|
+
[_setExternallySelectedItemsAreInSync],
|
|
56
|
+
);
|
|
57
|
+
|
|
47
58
|
const setQuickFilter = useCallback(
|
|
48
59
|
(filter: string) => {
|
|
49
60
|
// If we don't clear the focused cell focus switches back to grid when typing in the quick filter input
|
|
@@ -539,12 +550,6 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
|
|
|
539
550
|
}
|
|
540
551
|
}, [gridApi]);
|
|
541
552
|
|
|
542
|
-
// waitForExternallySelectedItemsToBeInSync can't use the state as it won't be updated during function execution
|
|
543
|
-
const externallySelectedItemsAreInSyncRef = useRef(false);
|
|
544
|
-
useEffect(() => {
|
|
545
|
-
externallySelectedItemsAreInSyncRef.current = externallySelectedItemsAreInSync;
|
|
546
|
-
}, [externallySelectedItemsAreInSync]);
|
|
547
|
-
|
|
548
553
|
const waitForExternallySelectedItemsToBeInSync = useCallback(async () => {
|
|
549
554
|
if (!hasExternallySelectedItemsRef.current) {
|
|
550
555
|
externallySelectedItemsAreInSyncRef.current = true;
|
|
@@ -613,7 +618,7 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
|
|
|
613
618
|
startCellEditingInProgressRef.current = false;
|
|
614
619
|
}
|
|
615
620
|
},
|
|
616
|
-
[anyUpdating, gridApi, prePopupOps, waitForExternallySelectedItemsToBeInSync],
|
|
621
|
+
[anyUpdating, gridApi, prePopupOps, setExternallySelectedItemsAreInSync, waitForExternallySelectedItemsToBeInSync],
|
|
617
622
|
);
|
|
618
623
|
|
|
619
624
|
const bulkEditingCompleteCallbackRef = useRef<() => Promise<void> | void>();
|
|
@@ -190,6 +190,18 @@ $grid-base-font-size: calc(#{lui.$base-font-size} - 1px);
|
|
|
190
190
|
align-items: center;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
.ag-cell span.GridCell-dropDownIcon {
|
|
194
|
+
fill: lui.$charcoal;
|
|
195
|
+
max-width: 26px;
|
|
196
|
+
width: 26px;
|
|
197
|
+
visibility: hidden;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.ag-cell.ag-cell-inline-editing span.GridCell-dropDownIcon {
|
|
201
|
+
max-width: 24px;
|
|
202
|
+
width: 24px;
|
|
203
|
+
}
|
|
204
|
+
|
|
193
205
|
.ag-cell .GridCell-editableIcon {
|
|
194
206
|
fill: lui.$silver;
|
|
195
207
|
visibility: hidden;
|