@linzjs/step-ag-grid 8.3.2 → 8.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/gridRender/GridRenderGenericCell.d.ts +2 -2
- package/dist/step-ag-grid.esm.js +10 -3
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridCell.tsx +14 -5
- package/src/components/gridForm/GridFormDropDown.tsx +1 -1
- package/src/components/gridRender/GridRenderGenericCell.tsx +2 -2
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { GridBaseRow } from "./Grid";
|
|
|
3
3
|
import { GridUpdatingContext } from "../contexts/GridUpdatingContext";
|
|
4
4
|
import { GridCellMultiSelectClassRules } from "./GridCellMultiSelectClassRules";
|
|
5
5
|
import { GenericCellColDef, GenericCellRendererParams } from "./gridRender/GridRenderGenericCell";
|
|
6
|
-
import { ColDef, ICellEditorParams, ICellRendererParams } from "ag-grid-community";
|
|
6
|
+
import { ColDef, ICellEditorParams, ICellRendererParams, ValueGetterFunc } from "ag-grid-community";
|
|
7
7
|
import { GridLoadableCell } from "./GridLoadableCell";
|
|
8
8
|
import { GridIcon } from "./GridIcon";
|
|
9
9
|
import { SuppressKeyboardEventParams, ValueFormatterParams } from "ag-grid-community/dist/lib/entities/colDef";
|
|
@@ -22,15 +22,19 @@ export const GridCellRenderer = (props: ICellRendererParams) => {
|
|
|
22
22
|
|
|
23
23
|
const rendererParams = colDef.cellRendererParams as GenericCellRendererParams<any> | undefined;
|
|
24
24
|
const warningFn = rendererParams?.warning;
|
|
25
|
-
|
|
25
|
+
let warningText = warningFn ? warningFn(props) : undefined;
|
|
26
26
|
const infoFn = rendererParams?.info;
|
|
27
|
-
|
|
27
|
+
let infoText = infoFn ? infoFn(props) : undefined;
|
|
28
|
+
if (Array.isArray(warningText)) warningText = warningText.join("\n");
|
|
29
|
+
if (Array.isArray(infoText)) infoText = infoText.join("\n");
|
|
28
30
|
|
|
29
31
|
return (
|
|
30
32
|
<GridLoadableCell isLoading={checkUpdating(colDef.field ?? colDef.colId ?? "", props.data.id)}>
|
|
31
33
|
<>
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
+
{!!warningText && (
|
|
35
|
+
<GridIcon icon={"ic_warning_outline"} title={typeof warningText === "string" ? warningText : "Warning"} />
|
|
36
|
+
)}
|
|
37
|
+
{!!infoText && <GridIcon icon={"ic_info_outline"} title={typeof infoText === "string" ? infoText : "Info"} />}
|
|
34
38
|
<div style={{ display: "flex", flex: 1, overflow: "hidden" }}>
|
|
35
39
|
{colDef?.cellRendererParams?.originalCellRenderer ? (
|
|
36
40
|
<colDef.cellRendererParams.originalCellRenderer {...props} />
|
|
@@ -91,6 +95,11 @@ export const GridCell = <RowType extends GridBaseRow, Props extends CellEditorCo
|
|
|
91
95
|
...(custom?.editorParams && {
|
|
92
96
|
cellEditorParams: { ...custom.editorParams, multiEdit: custom.multiEdit },
|
|
93
97
|
}),
|
|
98
|
+
// If there's a valueFormatter and no filterValueGetter then create a filterValueGetter
|
|
99
|
+
...(props.valueFormatter &&
|
|
100
|
+
!props.filterValueGetter && {
|
|
101
|
+
filterValueGetter: props.valueFormatter as string | ValueGetterFunc,
|
|
102
|
+
}),
|
|
94
103
|
// Default value formatter, otherwise react freaks out on objects
|
|
95
104
|
valueFormatter: (params: ValueFormatterParams) => {
|
|
96
105
|
if (params.value == null) return "–";
|
|
@@ -300,7 +300,7 @@ export const GridFormDropDown = <RowType extends GridBaseRow>(props: GridFormDro
|
|
|
300
300
|
setValue: (value: any) => {
|
|
301
301
|
setSubSelectedValue(value);
|
|
302
302
|
if (subComponentInitialValue.current === null) {
|
|
303
|
-
// copy the default value of the subcomponent so we can change detect on save
|
|
303
|
+
// copy the default value of the subcomponent, so we can change detect on save
|
|
304
304
|
subComponentInitialValue.current = JSON.stringify(value);
|
|
305
305
|
}
|
|
306
306
|
},
|
|
@@ -37,6 +37,6 @@ export interface GenericCellRendererParams<RowType extends GridBaseRow> {
|
|
|
37
37
|
rightHoverElement?: JSX.Element | undefined;
|
|
38
38
|
editAction?: (selectedRows: RowType[]) => void;
|
|
39
39
|
shortcutKeys?: Record<string, ((params: SuppressKeyboardEventParams) => boolean | void) | undefined>;
|
|
40
|
-
warning?: (props: RowICellRendererParams<RowType>) => string | boolean | null | undefined;
|
|
41
|
-
info?: (props: RowICellRendererParams<RowType>) => string | boolean | null | undefined;
|
|
40
|
+
warning?: (props: RowICellRendererParams<RowType>) => string | string[] | boolean | null | undefined;
|
|
41
|
+
info?: (props: RowICellRendererParams<RowType>) => string | string[] | boolean | null | undefined;
|
|
42
42
|
}
|