@ccs-ui/rc-pro 1.1.9 → 1.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.
@@ -29,6 +29,7 @@ var TableTree = function TableTree(_ref) {
29
29
  setData = _ref.setData,
30
30
  onSearchAfter = _ref.onSearchAfter,
31
31
  onSearchBefore = _ref.onSearchBefore,
32
+ parentFieldName = _ref.parentFieldName,
32
33
  handlePageChange = _ref.handlePageChange,
33
34
  isInModalOrDrawer = _ref.isInModalOrDrawer;
34
35
  // async tree expand key
@@ -38,11 +39,10 @@ var TableTree = function TableTree(_ref) {
38
39
  setExpandKeys = _useState2[1];
39
40
  var _ref2 = table,
40
41
  rowKey = _ref2.rowKey,
41
- asyncTree = _ref2.asyncTree,
42
- _ref2$childrenColumnN = _ref2.childrenColumnName,
43
- childrenColumnName = _ref2$childrenColumnN === void 0 ? 'children' : _ref2$childrenColumnN,
42
+ expandable = _ref2.expandable,
44
43
  columns = _ref2.columns,
45
44
  request = _ref2.request;
45
+ var childrenColumnName = (expandable === null || expandable === void 0 ? void 0 : expandable.childrenColumnName) || 'children';
46
46
 
47
47
  // 获取数据
48
48
  var _onRequestTree = /*#__PURE__*/function () {
@@ -61,8 +61,8 @@ var TableTree = function TableTree(_ref) {
61
61
  query = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
62
62
  record = _args.length > 1 ? _args[1] : undefined;
63
63
  params = query;
64
- if (record && asyncTree !== null && asyncTree !== void 0 && asyncTree.parentName) {
65
- params[asyncTree === null || asyncTree === void 0 ? void 0 : asyncTree.parentName] = record[rowKey];
64
+ if (record) {
65
+ params[parentFieldName] = record[rowKey];
66
66
  }
67
67
 
68
68
  // onSearchBefore 请求前回传参数,可以在父组件进行修改
@@ -134,12 +134,6 @@ var TableTree = function TableTree(_ref) {
134
134
  };
135
135
  });
136
136
  var onExpand = function onExpand(expanded, record) {
137
- var _table$asyncTree;
138
- if (!(table !== null && table !== void 0 && table.asyncTree)) return;
139
- if (!(table !== null && table !== void 0 && (_table$asyncTree = table.asyncTree) !== null && _table$asyncTree !== void 0 && _table$asyncTree.parentName)) {
140
- CcsUtils.showLogWarning('执行失败、参数treeParentName为空!!!');
141
- return;
142
- }
143
137
  if (!rowKey || (rowKey && record[rowKey]) === undefined) {
144
138
  CcsUtils.showLogWarning('rowKey未传入或传入rowKey不正确');
145
139
  return;
@@ -158,17 +152,12 @@ var TableTree = function TableTree(_ref) {
158
152
  };
159
153
 
160
154
  // 添加吸顶
161
- var tableParams = _objectSpread({
155
+ var tableParams = _objectSpread(_objectSpread({
162
156
  sticky: sticky
163
- }, table);
164
-
165
- // 异步树
166
- if (table !== null && table !== void 0 && table.asyncTree) {
167
- tableParams.expandable = {
168
- onExpand: onExpand,
169
- expandedRowKeys: expandKeys
170
- };
171
- }
157
+ }, table), {}, {
158
+ onExpand: onExpand,
159
+ expandedRowKeys: expandKeys
160
+ });
172
161
  return /*#__PURE__*/_jsx(CcsTable, _objectSpread(_objectSpread({
173
162
  onChange: handlePageChange,
174
163
  data: data,
@@ -1,4 +1,4 @@
1
- import { CcsTableProps } from '../pro-table';
1
+ import { CcsTableProps } from '../pro-table/table';
2
2
  import './index.less';
3
3
  type TableProps<T> = Omit<CcsTableProps<T>, 'request' | 'requestParam'>;
4
4
  declare const CustomTable: <T extends object = any>(props: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
package/es/table/index.js CHANGED
@@ -8,13 +8,11 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
8
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
  import { useDebounceFn, useEventListener, useUpdate, useUpdateEffect } from 'ahooks';
11
- import { Pagination, Table, Tooltip, theme } from 'antd';
11
+ import { Table, Tooltip, theme } from 'antd';
12
12
  import classNames from 'classnames';
13
13
  import { useRef } from 'react';
14
14
  import "./index.less";
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
- import { Fragment as _Fragment } from "react/jsx-runtime";
17
- import { jsxs as _jsxs } from "react/jsx-runtime";
18
16
  var DEFAULT_PAGE = {
19
17
  totalNum: 0,
20
18
  result: [],
@@ -128,30 +126,7 @@ var CustomTable = function CustomTable(props) {
128
126
  style: _objectSpread(_objectSpread({}, style), {}, {
129
127
  background: token.colorBgContainer
130
128
  }),
131
- children: restProps.render ? /*#__PURE__*/_jsxs(_Fragment, {
132
- children: [restProps.render(result || []), pagination === false ? null : /*#__PURE__*/_jsx(Pagination, _objectSpread({}, _objectSpread({
133
- total: totalNum,
134
- pageSize: pageSize,
135
- size: restProps.size === 'small' ? 'small' : 'default',
136
- simple: restProps.size === 'small',
137
- current: pageNo,
138
- showSizeChanger: true,
139
- showQuickJumper: true,
140
- showTotal: function showTotal() {
141
- return "\u5171".concat(totalNum, "\u6761\u8BB0\u5F55");
142
- },
143
- pageSizeOptions: ['10', '20', '30', '50', '100'],
144
- onChange: function onChange(page, size) {
145
- return restProps.onChange && restProps.onChange({
146
- pageSize: size,
147
- current: page
148
- }, {}, {}, {
149
- currentDataSource: [],
150
- action: 'paginate'
151
- });
152
- }
153
- }, pagination)))]
154
- }) : /*#__PURE__*/_jsx("div", {
129
+ children: /*#__PURE__*/_jsx("div", {
155
130
  ref: ref,
156
131
  children: /*#__PURE__*/_jsx(Table, _objectSpread({}, _objectSpread(_objectSpread({
157
132
  rowKey: rowKey,
@@ -27,10 +27,10 @@ var ThemeDialog = /*#__PURE__*/function () {
27
27
  }, {
28
28
  key: "easyMessage",
29
29
  value: function easyMessage(result, successText, failText) {
30
- if (result.success) {
30
+ if (result !== null && result !== void 0 && result.success) {
31
31
  ThemeDialog.message.success(successText || '操作成功');
32
32
  } else {
33
- ThemeDialog.message.error(failText || result.msg || '操作失败');
33
+ ThemeDialog.message.error(failText || (result === null || result === void 0 ? void 0 : result.msg) || '操作失败');
34
34
  }
35
35
  }
36
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "A react pro components",
5
5
  "license": "MIT",
6
6
  "module": "es/index.js",