@linzjs/step-ag-grid 7.8.1 → 7.9.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/index.css +6 -1
- package/dist/index.js +22 -14
- package/dist/index.js.map +1 -1
- package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +3 -1
- package/dist/step-ag-grid.esm.js +22 -14
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +12 -10
- package/src/components/GridCell.tsx +8 -2
- package/src/components/gridRender/GridRenderGenericCell.tsx +3 -1
- package/src/stories/grid/GridReadOnly.stories.tsx +8 -1
- package/src/styles/Grid.scss +6 -1
package/dist/index.css
CHANGED
|
@@ -343,8 +343,13 @@
|
|
|
343
343
|
padding: 4px 8px;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
.GridCell-editableIcon {
|
|
346
|
+
.ag-cell .GridCell-editableIcon {
|
|
347
347
|
fill: #beb9b4;
|
|
348
|
+
visibility: hidden;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.ag-cell:hover .GridCell-editableIcon, .ag-cell.ag-cell-focus .GridCell-editableIcon {
|
|
352
|
+
visibility: visible;
|
|
348
353
|
}
|
|
349
354
|
|
|
350
355
|
.GridFormMessage-container {
|
package/dist/index.js
CHANGED
|
@@ -2815,18 +2815,8 @@ var Grid = function (params) {
|
|
|
2815
2815
|
}
|
|
2816
2816
|
}, [checkUpdating]);
|
|
2817
2817
|
var onCellDoubleClick = React.useCallback(function (event) {
|
|
2818
|
-
|
|
2819
|
-
var editable = fnOrVar((_a = event.colDef) === null || _a === void 0 ? void 0 : _a.editable, event);
|
|
2820
|
-
if (!editable)
|
|
2821
|
-
return;
|
|
2822
|
-
var editAction = (_c = (_b = event.colDef) === null || _b === void 0 ? void 0 : _b.cellRendererParams) === null || _c === void 0 ? void 0 : _c.editAction;
|
|
2823
|
-
if (editAction) {
|
|
2824
|
-
// Clicked row comes first in selected rows
|
|
2825
|
-
editAction(__spreadArray([event.data], event.api.getSelectedRows().filter(function (row) { return row.id !== event.data.id; }), true));
|
|
2826
|
-
}
|
|
2827
|
-
else if (!((_e = (_d = event.colDef) === null || _d === void 0 ? void 0 : _d.cellRendererParams) === null || _e === void 0 ? void 0 : _e.singleClickEdit)) {
|
|
2818
|
+
if (!invokeEditAction(event))
|
|
2828
2819
|
startCellEditing(event);
|
|
2829
|
-
}
|
|
2830
2820
|
}, [startCellEditing]);
|
|
2831
2821
|
var onCellClicked = React.useCallback(function (event) {
|
|
2832
2822
|
var _a, _b;
|
|
@@ -2834,9 +2824,20 @@ var Grid = function (params) {
|
|
|
2834
2824
|
startCellEditing(event);
|
|
2835
2825
|
}
|
|
2836
2826
|
}, [startCellEditing]);
|
|
2827
|
+
var invokeEditAction = function (e) {
|
|
2828
|
+
var _a, _b, _c;
|
|
2829
|
+
var editAction = (_b = (_a = e.colDef) === null || _a === void 0 ? void 0 : _a.cellRendererParams) === null || _b === void 0 ? void 0 : _b.editAction;
|
|
2830
|
+
if (!editAction)
|
|
2831
|
+
return false;
|
|
2832
|
+
var editable = fnOrVar((_c = e.colDef) === null || _c === void 0 ? void 0 : _c.editable, e);
|
|
2833
|
+
editable && editAction(__spreadArray([e.data], e.api.getSelectedRows().filter(function (row) { return row.id !== e.data.id; }), true));
|
|
2834
|
+
return true;
|
|
2835
|
+
};
|
|
2837
2836
|
var onCellKeyPress = React.useCallback(function (e) {
|
|
2838
|
-
if (e.event.key === "Enter")
|
|
2839
|
-
|
|
2837
|
+
if (e.event.key === "Enter") {
|
|
2838
|
+
if (!invokeEditAction(e))
|
|
2839
|
+
startCellEditing(e);
|
|
2840
|
+
}
|
|
2840
2841
|
}, [startCellEditing]);
|
|
2841
2842
|
var onCellEditingStopped = React.useCallback(function (event) {
|
|
2842
2843
|
refreshSelectedRows(event);
|
|
@@ -2881,7 +2882,7 @@ var GridCellRenderer = function (props) {
|
|
|
2881
2882
|
var warningText = warningFn ? warningFn(props) : undefined;
|
|
2882
2883
|
var infoFn = rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.info;
|
|
2883
2884
|
var infoText = infoFn ? infoFn(props) : undefined;
|
|
2884
|
-
return (jsxRuntime.jsx(GridLoadableCell, __assign({ isLoading: checkUpdating((_b = (_a = colDef.field) !== null && _a !== void 0 ? _a : colDef.colId) !== null && _b !== void 0 ? _b : "", props.data.id) }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [typeof warningText === "string" && jsxRuntime.jsx(GridIcon, { icon: "ic_warning", title: warningText }), typeof infoText === "string" && jsxRuntime.jsx(GridIcon, { icon: "ic_info", title: infoText }), jsxRuntime.jsx("div", __assign({ style: { display: "flex", flex: 1, overflow: "hidden" } }, { children: ((_c = colDef === null || colDef === void 0 ? void 0 : colDef.cellRendererParams) === null || _c === void 0 ? void 0 : _c.originalCellRenderer) ? (jsxRuntime.jsx(colDef.cellRendererParams.originalCellRenderer, __assign({}, props))) : (jsxRuntime.jsx("span", __assign({ title: props.valueFormatted }, { children: props.valueFormatted }))) })), fnOrVar((_d = props.colDef) === null || _d === void 0 ? void 0 : _d.editable, props) && (rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.
|
|
2885
|
+
return (jsxRuntime.jsx(GridLoadableCell, __assign({ isLoading: checkUpdating((_b = (_a = colDef.field) !== null && _a !== void 0 ? _a : colDef.colId) !== null && _b !== void 0 ? _b : "", props.data.id) }, { children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [typeof warningText === "string" && jsxRuntime.jsx(GridIcon, { icon: "ic_warning", title: warningText }), typeof infoText === "string" && jsxRuntime.jsx(GridIcon, { icon: "ic_info", title: infoText }), jsxRuntime.jsx("div", __assign({ style: { display: "flex", flex: 1, overflow: "hidden" } }, { children: ((_c = colDef === null || colDef === void 0 ? void 0 : colDef.cellRendererParams) === null || _c === void 0 ? void 0 : _c.originalCellRenderer) ? (jsxRuntime.jsx(colDef.cellRendererParams.originalCellRenderer, __assign({}, props))) : (jsxRuntime.jsx("span", __assign({ title: props.valueFormatted }, { children: props.valueFormatted }))) })), fnOrVar((_d = props.colDef) === null || _d === void 0 ? void 0 : _d.editable, props) && (rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.rightHoverElement) && (jsxRuntime.jsx("div", __assign({ style: { display: "flex", alignItems: "center" } }, { children: rendererParams === null || rendererParams === void 0 ? void 0 : rendererParams.rightHoverElement })))] }) })));
|
|
2885
2886
|
};
|
|
2886
2887
|
/*
|
|
2887
2888
|
* All cells should use this
|
|
@@ -2893,6 +2894,13 @@ var GridCell = function (props, custom) {
|
|
|
2893
2894
|
editable: (_a = props.editable) !== null && _a !== void 0 ? _a : true,
|
|
2894
2895
|
cellEditor: GenericCellEditorComponentWrapper(custom)
|
|
2895
2896
|
})), { suppressKeyboardEvent: function (e) {
|
|
2897
|
+
var _a, _b, _c, _d;
|
|
2898
|
+
var shortcutKeys = (_b = (_a = e.colDef.cellRendererParams) === null || _a === void 0 ? void 0 : _a.shortcutKeys) !== null && _b !== void 0 ? _b : {};
|
|
2899
|
+
var exec = shortcutKeys[e.event.key];
|
|
2900
|
+
if (!e.editing && !e.event.repeat && e.event.type === "keypress" && exec) {
|
|
2901
|
+
var editable = fnOrVar((_c = e.colDef) === null || _c === void 0 ? void 0 : _c.editable, e);
|
|
2902
|
+
return editable ? (_d = exec(e)) !== null && _d !== void 0 ? _d : true : true;
|
|
2903
|
+
}
|
|
2896
2904
|
// It's important that aggrid doesn't trigger edit on enter
|
|
2897
2905
|
// as the incorrect selected rows will be returned
|
|
2898
2906
|
return !["ArrowLeft", "ArrowRight", "ArrowDown", "ArrowUp", "Tab", " "].includes(e.event.key);
|