@mailstep/design-system 0.7.47-beta.3 → 0.7.47-beta.5

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.
@@ -1,6 +0,0 @@
1
- import type { DataCellProps, ActionColumn, UxState, GridActionsType } from '../../types';
2
- type Props = DataCellProps<{
3
- id: string;
4
- }>;
5
- declare const getReadEditButtonCell: (actionColumn?: ActionColumn, uxState?: UxState, onUxChange?: GridActionsType['handleUxChange']) => ({ 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 { RowActionsCell } from '../gridCells';
4
- import { isFunction } from 'lodash/fp';
5
- var getReadEditButtonCell = function (actionColumn, uxState, onUxChange) {
6
- return function ReadEditButtonCell(_a) {
7
- var _b;
8
- var rowData = _a.rowData, onRowAction = _a.onRowAction;
9
- 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;
10
- 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;
11
- var withCheckboxes = !!((_b = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _b === void 0 ? void 0 : _b.length) || (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.forceCheckboxes);
12
- // if canEdit and canRead are both true, canEdit supersedes canRead
13
- var handleOnClick = useCallback(function () {
14
- var action = canEdit ? 'row_edit' : 'row_read';
15
- if (onRowAction)
16
- onRowAction(rowData === null || rowData === void 0 ? void 0 : rowData.id, action, rowData);
17
- }, [canEdit, onRowAction, rowData]);
18
- var linkTo = useMemo(function () {
19
- var _a;
20
- var mode = canEdit ? 'edit' : 'read';
21
- 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 });
22
- }, [canEdit, rowData === null || rowData === void 0 ? void 0 : rowData.id]);
23
- return (_jsx(RowActionsCell, { canEdit: !!canEdit, canRead: !!canRead, onClick: handleOnClick, linkTo: linkTo, withCheckboxes: withCheckboxes, rowDataId: rowData === null || rowData === void 0 ? void 0 : rowData.id, checkedRows: uxState === null || uxState === void 0 ? void 0 : uxState.checkedRows, onUxChange: onUxChange }));
24
- };
25
- };
26
- export default getReadEditButtonCell;
@@ -1,2 +0,0 @@
1
- import ReadEditButtonCell from './ReadEditButtonCell';
2
- export default ReadEditButtonCell;
@@ -1,2 +0,0 @@
1
- import ReadEditButtonCell from './ReadEditButtonCell';
2
- export default ReadEditButtonCell;