@mailstep/design-system 0.7.47-beta.2 → 0.7.47-beta.4
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/package.json +1 -1
- package/ui/Blocks/CommonGrid/CommonGrid.js +1 -1
- package/ui/Blocks/CommonGrid/CommonGridContainer.js +1 -1
- package/ui/Blocks/CommonGrid/HoC/withProps.d.ts +3 -0
- package/ui/Blocks/CommonGrid/HoC/withProps.js +21 -0
- package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.d.ts +2 -2
- package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.js +8 -10
- package/ui/Blocks/CommonGrid/components/DataRow.d.ts +2 -4
- package/ui/Blocks/CommonGrid/components/DataRow.js +12 -62
- package/ui/Blocks/CommonGrid/components/FilterRow.d.ts +1 -1
- package/ui/Blocks/CommonGrid/components/FilterRow.js +6 -4
- package/ui/Blocks/CommonGrid/components/HeadRow.d.ts +2 -2
- package/ui/Blocks/CommonGrid/components/HeadRow.js +2 -2
- package/ui/Blocks/CommonGrid/components/Table.d.ts +9 -0
- package/ui/Blocks/CommonGrid/components/gridCells/IconButtonInCell.js +4 -10
- package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.d.ts +9 -5
- package/ui/Blocks/CommonGrid/components/gridCells/RowActionsCell.js +54 -10
- package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.d.ts +1 -6
- package/ui/Blocks/CommonGrid/hooks/useEditReadAsColumn.js +21 -15
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.js +1 -0
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +0 -4
- package/ui/Blocks/CommonGrid/styles.js +1 -1
- package/ui/index.es.js +11800 -11843
- package/ui/index.umd.js +455 -475
- package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/ReadEditButtonCell.d.ts +0 -6
- package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/ReadEditButtonCell.js +0 -26
- package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/index.d.ts +0 -2
- package/ui/Blocks/CommonGrid/components/ReadEditButtonCell/index.js +0 -2
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DataCellProps, ActionColumn } from '../../types';
|
|
2
|
-
type Props = DataCellProps<{
|
|
3
|
-
id: string;
|
|
4
|
-
}>;
|
|
5
|
-
declare const getReadEditButtonCell: (actionColumn?: ActionColumn) => ({ rowData, onRowAction }: Props) => JSX.Element | null;
|
|
6
|
-
export default getReadEditButtonCell;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useMemo } from 'react';
|
|
3
|
-
import { isFunction } from 'lodash/fp';
|
|
4
|
-
import { RowActionsCell } from '../gridCells';
|
|
5
|
-
var getReadEditButtonCell = function (actionColumn) {
|
|
6
|
-
return function ReadEditButtonCell(_a) {
|
|
7
|
-
var rowData = _a.rowData, onRowAction = _a.onRowAction;
|
|
8
|
-
var canEdit = isFunction(actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.canRowEdit) ? actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.canRowEdit(rowData) : actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.canRowEdit;
|
|
9
|
-
var canRead = isFunction(actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.canRowRead) ? actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.canRowRead(rowData) : actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.canRowRead;
|
|
10
|
-
// if canEdit and canRead are both true, canEdit supersedes canRead
|
|
11
|
-
var handleOnClick = useCallback(function () {
|
|
12
|
-
var action = canEdit ? 'row_edit' : 'row_read';
|
|
13
|
-
if (onRowAction)
|
|
14
|
-
onRowAction(rowData === null || rowData === void 0 ? void 0 : rowData.id, action, rowData);
|
|
15
|
-
}, [canEdit, onRowAction, rowData]);
|
|
16
|
-
var linkTo = useMemo(function () {
|
|
17
|
-
var _a;
|
|
18
|
-
var mode = canEdit ? 'edit' : 'read';
|
|
19
|
-
return (_a = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.createLink) === null || _a === void 0 ? void 0 : _a.call(actionColumn, { mode: mode, id: rowData === null || rowData === void 0 ? void 0 : rowData.id });
|
|
20
|
-
}, [canEdit, rowData === null || rowData === void 0 ? void 0 : rowData.id]);
|
|
21
|
-
if (!canEdit && !canRead)
|
|
22
|
-
return null;
|
|
23
|
-
return _jsx(RowActionsCell, { canEdit: !!canEdit, onClick: handleOnClick, linkTo: linkTo });
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export default getReadEditButtonCell;
|