@kep-platform/basic-component 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ export type ColumnsProps = {
10
10
  } & HtmlHTMLAttributes<HTMLUListElement>;
11
11
  export declare const Column: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, never>, "ref"> & {
12
12
  ref?: ((instance: HTMLLIElement | null) => void) | React.RefObject<HTMLLIElement> | null | undefined;
13
- }, Omit<ColumnType, "render" | "dataIndex"> & {
13
+ }, Omit<ColumnType, "dataIndex" | "render"> & {
14
14
  key: React.Key;
15
15
  title?: React.ReactNode;
16
16
  index?: number | undefined;
@@ -15,6 +15,7 @@ export type TableProps = {
15
15
  headerRender?: (column: ColumnType) => ReactNode;
16
16
  groupBy?: string;
17
17
  pagination?: Pagination | false;
18
+ empty?: ReactNode;
18
19
  };
19
- export default function Table({ columns, dataSource, rowKey, actions, title, scroll, onChange, headerRender, pagination: outerPagination, }: TableProps): React.JSX.Element;
20
+ export default function Table({ columns, dataSource, rowKey, actions, title, scroll, onChange, headerRender, pagination: outerPagination, empty, }: TableProps): React.JSX.Element;
20
21
  export {};
@@ -137,7 +137,9 @@ export default function Table(_ref3) {
137
137
  scroll = _ref3.scroll,
138
138
  _onChange2 = _ref3.onChange,
139
139
  headerRender = _ref3.headerRender,
140
- outerPagination = _ref3.pagination;
140
+ outerPagination = _ref3.pagination,
141
+ _ref3$empty = _ref3.empty,
142
+ empty = _ref3$empty === void 0 ? /*#__PURE__*/React.createElement(React.Fragment, null) : _ref3$empty;
141
143
  var _useState = useState(null),
142
144
  _useState2 = _slicedToArray(_useState, 2),
143
145
  sorterController = _useState2[0],
@@ -224,7 +226,7 @@ export default function Table(_ref3) {
224
226
  } else {
225
227
  return element;
226
228
  }
227
- }))))), /*#__PURE__*/React.createElement(TableContent, {
229
+ }))))), dataSource.length === 0 ? empty : /*#__PURE__*/React.createElement(TableContent, {
228
230
  onScroll: function onScroll(e) {
229
231
  var tableContainer = e.target;
230
232
  if (boxShadowBox.current) {
@@ -258,7 +260,7 @@ export default function Table(_ref3) {
258
260
  columns: columns,
259
261
  isFlex: !scroll
260
262
  }));else return undefined;
261
- }))), /*#__PURE__*/React.createElement("br", null), pagination !== false && /*#__PURE__*/React.createElement(Pagination, _extends({}, pagination, {
263
+ }))), /*#__PURE__*/React.createElement("br", null), pagination !== false && dataSource.length !== 0 && /*#__PURE__*/React.createElement(Pagination, _extends({}, pagination, {
262
264
  total: (pagination === null || pagination === void 0 ? void 0 : pagination.total) || dataSource.length,
263
265
  justifyContent: "right",
264
266
  onChange: function onChange(current, pageSize) {
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- export declare const MainArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HtmlHTMLAttributes<HTMLDivElement> | keyof import("../Flex").FlexItemProps> & import("../Flex").FlexItemProps & React.HtmlHTMLAttributes<HTMLDivElement>, "ref"> & {
2
+ export declare const MainArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("../Flex").FlexItemProps | keyof React.HtmlHTMLAttributes<HTMLDivElement>> & import("../Flex").FlexItemProps & React.HtmlHTMLAttributes<HTMLDivElement>, "ref"> & {
3
3
  ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
4
4
  }, never>> & string;
5
5
  type MainPropertyProps = {
@@ -155,6 +155,13 @@ export var TreeNodeController = function TreeNodeController(_ref) {
155
155
  });
156
156
  }
157
157
  }, [onSelect, selectedKeys, multiple, selected]);
158
+ var onContextMenuHandler = useCallback(function (e) {
159
+ onSelect([node[fieldNames.key]], {
160
+ nativeEvent: e,
161
+ node: node,
162
+ selected: !selected
163
+ });
164
+ }, [onSelect, selectedKeys, multiple, selected]);
158
165
  var onClickExpandIconhandler = useCallback(function (e) {
159
166
  if (expanded) {
160
167
  onExpand(expandedKeys.filter(function (key) {
@@ -198,7 +205,7 @@ export var TreeNodeController = function TreeNodeController(_ref) {
198
205
  selected: selectedKeys.includes(node[fieldNames.key]),
199
206
  width: width,
200
207
  onClick: onClickNodeHandler,
201
- onContextMenu: onClickNodeHandler
208
+ onContextMenu: onContextMenuHandler
202
209
  }, contextMenuRender ? /*#__PURE__*/React.createElement(Menu.Popup, {
203
210
  trigger: "contextmenu",
204
211
  items: contextMenuRender(node),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kep-platform/basic-component",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "A react library developed with dumi",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -74,10 +74,10 @@
74
74
  "react-dom": "^18.0.0",
75
75
  "stylelint": "^14.9.1"
76
76
  },
77
- "gitHead": "d4f36d49811bbff1291bc103c104a2f9c947fc4b",
77
+ "gitHead": "52099c3504fd710771a1c9c6718824f064c8329a",
78
78
  "dependencies": {
79
79
  "@ant-design/icons": "^5.3.7",
80
- "@kep-platform/hooks": "^0.0.20",
80
+ "@kep-platform/hooks": "^0.0.21",
81
81
  "color": "^4.2.3",
82
82
  "rc-pagination": "^4.1.0",
83
83
  "styled-components": "^6.1.11"