@lemon-fe/components 0.1.10 → 0.1.11

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 +1,6 @@
1
1
  import type { RowAction } from './typings';
2
2
  interface Props<T> {
3
- actions: (RowAction<T> | null)[];
3
+ actions: (RowAction<T> | null)[] | ((record: T, index: number) => (RowAction<T> | null)[]);
4
4
  row: T;
5
5
  index: number;
6
6
  }
@@ -18,7 +18,7 @@ import { createPortal } from 'react-dom';
18
18
  import { PREFIX_CLS } from '../constants';
19
19
  import Icons from '../Icons';
20
20
  export default function Actions(props) {
21
- var actions = props.actions,
21
+ var actionsProp = props.actions,
22
22
  row = props.row,
23
23
  index = props.index;
24
24
 
@@ -61,6 +61,7 @@ export default function Actions(props) {
61
61
  }
62
62
  };
63
63
 
64
+ var actions = typeof actionsProp === 'function' ? actionsProp(row, index) : actionsProp;
64
65
  return /*#__PURE__*/React.createElement("div", {
65
66
  className: prefixCls,
66
67
  onMouseLeave: closePop
@@ -311,7 +311,7 @@ function BaseTable(props) {
311
311
 
312
312
 
313
313
  useMemo(function () {
314
- if (rowActions !== undefined && rowActions.length > 0) {
314
+ if (rowActions !== undefined) {
315
315
  var actionCol = {
316
316
  title: '',
317
317
  className: "".concat(PREFIX_CLS, "-table-operator-column"),
@@ -39,5 +39,5 @@ export interface BaseTableProps<T> extends Omit<TableProps<T>, 'columns' | 'scro
39
39
  /**
40
40
  * @description 行操作按钮组
41
41
  */
42
- rowActions?: (RowAction<T> | null)[];
42
+ rowActions?: (RowAction<T> | null)[] | ((record: T, index: number) => (RowAction<T> | null)[]);
43
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/components",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -41,5 +41,5 @@
41
41
  "react": "^17.0.2",
42
42
  "react-dom": "^17.0.2"
43
43
  },
44
- "gitHead": "58dc15b111e2965a940be72535debd94635b8914"
44
+ "gitHead": "9162635a0745c3de1b02293c9b1e9d6f2ac5b2c1"
45
45
  }