@linzjs/step-ag-grid 30.2.0 → 30.4.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/src/components/gridFilter/GridFilterColumnsMultiSelect.d.ts +0 -1
- package/dist/src/components/gridForm/GridFormInlineTextInput.d.ts +5 -0
- package/dist/step-ag-grid.cjs +24 -6
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +24 -6
- 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/gridForm/GridFormInlineTextInput.tsx +9 -1
- package/src/stories/grid/GridInlineText.stories.tsx +99 -18
|
@@ -18,7 +18,6 @@ export declare class GridFilterColumnsMultiSelect implements IFilterComp {
|
|
|
18
18
|
private reactRoot;
|
|
19
19
|
private filterButtonClickListener;
|
|
20
20
|
private filterButton;
|
|
21
|
-
private hasOpened;
|
|
22
21
|
private normalizeCellValue;
|
|
23
22
|
private loadFieldValues;
|
|
24
23
|
init(params: CheckboxMultiFilterParams): void;
|
|
@@ -10,6 +10,11 @@ export interface GridFormInlineTextInput<TData extends GridBaseRow> extends Text
|
|
|
10
10
|
selectedRowIds: TData['id'][];
|
|
11
11
|
value: string;
|
|
12
12
|
}) => MaybePromise<boolean>;
|
|
13
|
+
onChange?: (props: {
|
|
14
|
+
selectedRows: TData[];
|
|
15
|
+
selectedRowIds: TData['id'][];
|
|
16
|
+
value: string;
|
|
17
|
+
}) => void;
|
|
13
18
|
helpText?: string;
|
|
14
19
|
}
|
|
15
20
|
export declare const GridFormInlineTextInput: <TData extends GridBaseRow>(props: GridFormInlineTextInput<TData>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/step-ag-grid.cjs
CHANGED
|
@@ -62068,6 +62068,8 @@ styleInject(css_248z$3);
|
|
|
62068
62068
|
|
|
62069
62069
|
const EMPTY_KEY = '__EMPTY__';
|
|
62070
62070
|
const DEFAULT_EMPTY_LABEL = '-';
|
|
62071
|
+
const filterStateMap = new Map();
|
|
62072
|
+
const filterClickCountMap = new Map();
|
|
62071
62073
|
const FilterUI = ({ allValues, selected, labels, labelFormatter, onToggleAll, onToggleOne, }) => {
|
|
62072
62074
|
const allChecked = allValues.length > 0 && selected.size === allValues.length;
|
|
62073
62075
|
const getDisplayLabel = (raw) => {
|
|
@@ -62086,7 +62088,6 @@ class GridFilterColumnsMultiSelect {
|
|
|
62086
62088
|
reactRoot = null;
|
|
62087
62089
|
filterButtonClickListener = null;
|
|
62088
62090
|
filterButton = null;
|
|
62089
|
-
hasOpened = false;
|
|
62090
62091
|
normalizeCellValue(value) {
|
|
62091
62092
|
if (typeof value === 'string')
|
|
62092
62093
|
return value.trim() === '' ? EMPTY_KEY : value;
|
|
@@ -62136,14 +62137,24 @@ class GridFilterColumnsMultiSelect {
|
|
|
62136
62137
|
this.filterButton = document.querySelector(`[col-id="${columnId}"] .ag-header-cell-filter-button`);
|
|
62137
62138
|
if (this.filterButton) {
|
|
62138
62139
|
this.filterButtonClickListener = (e) => {
|
|
62139
|
-
|
|
62140
|
-
|
|
62140
|
+
const clickCount = filterClickCountMap.get(columnId) || 0;
|
|
62141
|
+
filterClickCountMap.set(columnId, clickCount + 1);
|
|
62142
|
+
if (clickCount === 0) {
|
|
62143
|
+
e.stopImmediatePropagation();
|
|
62141
62144
|
e.preventDefault();
|
|
62142
62145
|
this.params.api.hidePopupMenu();
|
|
62143
|
-
|
|
62146
|
+
filterStateMap.set(columnId, false);
|
|
62147
|
+
return;
|
|
62148
|
+
}
|
|
62149
|
+
const isOpen = filterStateMap.get(columnId) || false;
|
|
62150
|
+
if (isOpen) {
|
|
62151
|
+
e.stopImmediatePropagation();
|
|
62152
|
+
e.preventDefault();
|
|
62153
|
+
this.params.api.hidePopupMenu();
|
|
62154
|
+
filterStateMap.set(columnId, false);
|
|
62144
62155
|
}
|
|
62145
62156
|
else {
|
|
62146
|
-
|
|
62157
|
+
filterStateMap.set(columnId, true);
|
|
62147
62158
|
}
|
|
62148
62159
|
};
|
|
62149
62160
|
this.filterButton.addEventListener('click', this.filterButtonClickListener, true);
|
|
@@ -63168,7 +63179,14 @@ const GridFormInlineTextInput = (props) => {
|
|
|
63168
63179
|
input?.removeEventListener('keydown', tabRecorder, { capture: true });
|
|
63169
63180
|
};
|
|
63170
63181
|
}, [tabRecorder]);
|
|
63171
|
-
return (jsxRuntime.jsx("div", { className: clsx('GridFormInlineTextInput', invalid() && 'GridFormInlineTextInput-error'), title: String(invalid() ?? ''), children: jsxRuntime.jsx("input", { ref: inputRef, type: 'text', value: value, onChange: (e) =>
|
|
63182
|
+
return (jsxRuntime.jsx("div", { className: clsx('GridFormInlineTextInput', invalid() && 'GridFormInlineTextInput-error'), title: String(invalid() ?? ''), children: jsxRuntime.jsx("input", { ref: inputRef, type: 'text', value: value, onChange: (e) => {
|
|
63183
|
+
setValue(e.target.value);
|
|
63184
|
+
if (props.onChange) {
|
|
63185
|
+
const selectedRows = getSelectedRows();
|
|
63186
|
+
const selectedRowIds = selectedRows.map((data) => data.id);
|
|
63187
|
+
props.onChange({ selectedRows, selectedRowIds, value: e.target.value });
|
|
63188
|
+
}
|
|
63189
|
+
}, placeholder: props.placeholder ?? 'Type here', onBlur: () => {
|
|
63172
63190
|
void triggerSave(CloseReason.BLUR);
|
|
63173
63191
|
}, onKeyUp: (e) => {
|
|
63174
63192
|
if (e.key === 'Enter') {
|