@linzjs/step-ag-grid 26.0.1 → 27.0.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/Grid.d.ts +1 -0
- package/dist/src/components/GridCell.d.ts +5 -28
- package/dist/step-ag-grid.cjs +5 -3
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +5 -3
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +5 -2
- package/src/components/GridCell.test.tsx +3 -2
- package/src/components/GridCell.tsx +4 -38
- package/src/components/gridPopoverEdit/GridButton.tsx +4 -4
- package/src/react-menu3/components/ControlledMenu.tsx +1 -1
|
@@ -13,6 +13,7 @@ export interface GridProps<TData extends GridBaseRow = GridBaseRow> {
|
|
|
13
13
|
readOnly?: boolean;
|
|
14
14
|
defaultPostSort?: boolean;
|
|
15
15
|
selectable?: boolean;
|
|
16
|
+
hideSelectColumn?: boolean;
|
|
16
17
|
theme?: string;
|
|
17
18
|
['data-testid']?: string;
|
|
18
19
|
domLayout?: GridOptions['domLayout'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColDef, EditableCallback, ICellEditorParams, ICellRendererParams } from 'ag-grid-community';
|
|
2
|
-
import {
|
|
2
|
+
import { SuppressKeyboardEventParams, ValueFormatterFunc, ValueGetterFunc } from 'ag-grid-community';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
4
|
import { GridBaseRow } from './Grid';
|
|
5
5
|
import { GenericCellColDef } from './gridRender';
|
|
@@ -8,48 +8,25 @@ export interface GenericCellEditorProps<E> {
|
|
|
8
8
|
editor?: (editorProps: E) => ReactElement;
|
|
9
9
|
editorParams?: E;
|
|
10
10
|
}
|
|
11
|
-
export interface SAICellRendererParams<TData = any, TValue = any, TContext = any> extends Omit<ICellRendererParams<TData, TValue, TContext>, 'data'> {
|
|
12
|
-
data: TData;
|
|
13
|
-
}
|
|
14
11
|
export declare const GridCellRenderer: (props: ICellRendererParams) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export interface SAValueGetterParams<TData = any, TValue = any> extends Omit<ValueGetterParams<TData, TValue>, 'data'> {
|
|
16
|
-
data: TData;
|
|
17
|
-
getValue: (field: string) => any;
|
|
18
|
-
}
|
|
19
|
-
export interface SAValueGetterFunc<TData = any, TValue = any> {
|
|
20
|
-
(params: SAValueGetterParams<TData, TValue>): TValue | null | undefined;
|
|
21
|
-
}
|
|
22
|
-
export interface SAEditableCallbackParams<TData = any, TValue = any> extends Omit<EditableCallbackParams<TData, TValue>, 'data'> {
|
|
23
|
-
data: TData;
|
|
24
|
-
}
|
|
25
|
-
export interface SAEditableCallback<TData = any, TValue = any> {
|
|
26
|
-
(params: SAEditableCallbackParams<TData, TValue>): boolean;
|
|
27
|
-
}
|
|
28
|
-
export interface SAValueFormatterParams<TData = any, TValue = any> extends Omit<ValueFormatterParams<TData, TValue>, 'data' | 'value'> {
|
|
29
|
-
data: TData;
|
|
30
|
-
value: TValue;
|
|
31
|
-
}
|
|
32
|
-
export interface SAValueFormatterFunc<TData = any, TValue = any> {
|
|
33
|
-
(params: SAValueFormatterParams<TData, TValue>): string;
|
|
34
|
-
}
|
|
35
12
|
export interface ColDefT<TData extends GridBaseRow, ValueType = any> extends ColDef<TData, ValueType> {
|
|
36
13
|
editable?: boolean | EditableCallback<TData, ValueType>;
|
|
37
14
|
valueGetter?: string | ValueGetterFunc<TData, ValueType>;
|
|
38
15
|
valueFormatter?: string | ValueFormatterFunc<TData, ValueType>;
|
|
39
|
-
cellRenderer?: ((props:
|
|
16
|
+
cellRenderer?: ((props: ICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined) | string;
|
|
40
17
|
cellRendererParams?: {
|
|
41
18
|
singleClickEdit?: boolean;
|
|
42
19
|
rightHoverElement?: ReactElement;
|
|
43
20
|
originalCellRenderer?: any;
|
|
44
21
|
editAction?: (selectedRows: TData[]) => void;
|
|
45
22
|
shortcutKeys?: Record<string, () => void>;
|
|
46
|
-
warning?: (props:
|
|
47
|
-
info?: (props:
|
|
23
|
+
warning?: (props: ICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined;
|
|
24
|
+
info?: (props: ICellRendererParams<TData, ValueType>) => ReactElement | string | false | null | undefined;
|
|
48
25
|
};
|
|
49
26
|
editor?: (editorProps: any) => ReactElement;
|
|
50
27
|
}
|
|
51
28
|
export declare const suppressCellKeyboardEvents: (e: SuppressKeyboardEventParams) => any;
|
|
52
|
-
export declare const generateFilterGetter: <TData extends GridBaseRow, ValueType>(field: string | undefined, filterValueGetter: string | ValueGetterFunc<TData, ValueType> | undefined, valueFormatter: string | ValueFormatterFunc<TData, ValueType> | undefined) => string |
|
|
29
|
+
export declare const generateFilterGetter: <TData extends GridBaseRow, ValueType>(field: string | undefined, filterValueGetter: string | ValueGetterFunc<TData, ValueType> | undefined, valueFormatter: string | ValueFormatterFunc<TData, ValueType> | undefined) => string | ValueGetterFunc<TData, ValueType> | undefined;
|
|
53
30
|
export declare const GridCell: <TData extends GridBaseRow, TValue = any, Props extends CellEditorCommon = any>(props: GenericCellColDef<TData, TValue>, custom?: {
|
|
54
31
|
multiEdit?: boolean;
|
|
55
32
|
preventAutoEdit?: boolean;
|
package/dist/step-ag-grid.cjs
CHANGED
|
@@ -2066,7 +2066,7 @@ const ControlledMenuFr = ({ 'aria-label': ariaLabel, className, containerProps,
|
|
|
2066
2066
|
}
|
|
2067
2067
|
break;
|
|
2068
2068
|
}
|
|
2069
|
-
}, [anchorRef, saveButtonRef]);
|
|
2069
|
+
}, [anchorRef, onClose, saveButtonRef]);
|
|
2070
2070
|
const handleKeydownTabAndEnter = React.useMemo(() => handleKeyboardTabAndEnter(true), [handleKeyboardTabAndEnter]);
|
|
2071
2071
|
const handleKeyupTabAndEnter = React.useMemo(() => handleKeyboardTabAndEnter(false), [handleKeyboardTabAndEnter]);
|
|
2072
2072
|
React.useEffect(() => {
|
|
@@ -3180,6 +3180,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3180
3180
|
}, [params, clearHighlightRowClasses]);
|
|
3181
3181
|
// This is setting a ref in the GridContext so won't be triggering an update loop
|
|
3182
3182
|
setOnCellEditingComplete(params.onCellEditingComplete);
|
|
3183
|
+
const selectWidth = params.hideSelectColumn ? 0 : selectable && params.onRowDragEnd ? 76 : 48;
|
|
3183
3184
|
const headerRowCount = columnDefs.some((c) => c.children) ? 2 : 1;
|
|
3184
3185
|
return (jsxRuntime.jsxs("div", { "data-testid": dataTestId, className: clsx('Grid-container', theme, 'theme-specific', staleGrid && 'Grid-sortIsStale', gridReady && rowData && autoSized && 'Grid-ready'), children: [gridContextMenu.component, jsxRuntime.jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsxRuntime.jsx(agGridReact.AgGridReact, { theme: 'legacy', rowSelection: selectable
|
|
3185
3186
|
? {
|
|
@@ -3191,9 +3192,10 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3191
3192
|
event.api.forEachNode(() => rowCount++);
|
|
3192
3193
|
return (jsxRuntime.jsx(GridNoRowsOverlay, { loading: !rowData || params.loading === true, rowCount: rowCount, headerRowHeight: headerRowCount * rowHeight, filteredRowCount: event.api.getDisplayedRowCount(), noRowsOverlayText: params.noRowsOverlayText, noRowsMatchingOverlayText: params.noRowsMatchingOverlayText }));
|
|
3193
3194
|
}, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: params.onRowDragEnd || !defaultPostSort ? undefined : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragCancel: clearHighlightRowClasses, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, suppressCellFocus: params.suppressCellFocus, pinnedTopRowData: params.pinnedTopRowData, pinnedBottomRowData: params.pinnedBottomRowData, selectionColumnDef: {
|
|
3195
|
+
suppressNavigable: params.hideSelectColumn,
|
|
3194
3196
|
rowDrag: !!params.onRowDragEnd,
|
|
3195
|
-
minWidth:
|
|
3196
|
-
maxWidth:
|
|
3197
|
+
minWidth: selectWidth,
|
|
3198
|
+
maxWidth: selectWidth,
|
|
3197
3199
|
pinned: selectColumnPinned,
|
|
3198
3200
|
headerComponentParams: {
|
|
3199
3201
|
exportable: false,
|