@kep-platform/basic-component 0.0.20 → 0.0.22

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.
@@ -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],
@@ -247,7 +249,7 @@ export default function Table(_ref3) {
247
249
  columns: headerColumns,
248
250
  rowData: titleRowData,
249
251
  isFlex: !scroll
250
- }), /*#__PURE__*/React.createElement(TableBody, {
252
+ }), dataSource.length > 0 ? /*#__PURE__*/React.createElement(TableBody, {
251
253
  direction: "column"
252
254
  }, formatedDataSource.map(function (rowData, index) {
253
255
  if (rowData) return /*#__PURE__*/React.createElement(TableBodyRow, {
@@ -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
+ })) : empty), 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) {
@@ -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.22",
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": "664f06c1285e22d9411eb86b566cb04adf649480",
78
78
  "dependencies": {
79
79
  "@ant-design/icons": "^5.3.7",
80
- "@kep-platform/hooks": "^0.0.20",
80
+ "@kep-platform/hooks": "^0.0.22",
81
81
  "color": "^4.2.3",
82
82
  "rc-pagination": "^4.1.0",
83
83
  "styled-components": "^6.1.11"