@ccs-ui/rc-pro 2.3.6-beta-26 → 2.3.6-beta-28

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,16 +1,17 @@
1
- import { FormInstance } from 'antd/lib/form';
2
- import { ReactElement } from 'react';
1
+ import { FormInstance } from 'antd';
2
+ import React, { ReactElement } from 'react';
3
3
  import { PropsWithElementChildren } from '../ccs';
4
4
  import { CcsProTableProps } from './table';
5
5
  type PropsType<T> = Pick<CcsProTableProps<T>, 'toolbar' | 'formItems' | 'formInitValues' | 'expandForm' | 'title' | 'formItemLabelWidth'> & PropsWithElementChildren & {
6
6
  /** 更多查询条件 */
7
7
  hasMore?: boolean;
8
- form: FormInstance<any>;
9
8
  /** table 操作栏 */
10
- tableOperation: ReactElement;
9
+ tableOperation?: ReactElement;
11
10
  /** 查询 */
12
11
  onSearch: () => void;
12
+ /** form */
13
+ formRef: React.RefObject<FormInstance<any>>;
13
14
  };
14
15
  /** 操作按钮、查询,重置、列筛选、 */
15
- declare function HeadComponent<T>({ form, title, toolbar, children, expandForm, formItems, formInitValues, formItemLabelWidth, tableOperation, onSearch, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
16
+ declare function HeadComponent<T>({ title, toolbar, expandForm, formItems, formInitValues, formItemLabelWidth, tableOperation, formRef, children, onSearch, }: PropsType<T>): import("react/jsx-runtime").JSX.Element;
16
17
  export default HeadComponent;
@@ -8,7 +8,7 @@ import { DownOutlined, UpOutlined } from '@ant-design/icons';
8
8
  import { useUpdateEffect } from 'ahooks';
9
9
  import { Button, Card, Form, theme } from 'antd';
10
10
  import _debounce from 'lodash.debounce';
11
- import React, { useEffect, useMemo, useRef, useState } from 'react';
11
+ import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
12
12
  import { CcsResizeObserver } from '..';
13
13
  import { getShowDpends } from "./_utils";
14
14
  import HeadFormItem from "./form-item";
@@ -17,10 +17,8 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
17
17
  import { Fragment as _Fragment } from "react/jsx-runtime";
18
18
  /** 操作按钮、查询,重置、列筛选、 */
19
19
  function HeadComponent(_ref) {
20
- var form = _ref.form,
21
- title = _ref.title,
20
+ var title = _ref.title,
22
21
  toolbar = _ref.toolbar,
23
- children = _ref.children,
24
22
  _ref$expandForm = _ref.expandForm,
25
23
  expandForm = _ref$expandForm === void 0 ? false : _ref$expandForm,
26
24
  _ref$formItems = _ref.formItems,
@@ -28,12 +26,15 @@ function HeadComponent(_ref) {
28
26
  formInitValues = _ref.formInitValues,
29
27
  formItemLabelWidth = _ref.formItemLabelWidth,
30
28
  tableOperation = _ref.tableOperation,
29
+ formRef = _ref.formRef,
30
+ children = _ref.children,
31
31
  onSearch = _ref.onSearch;
32
+ var _Form$useForm = Form.useForm(),
33
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
34
+ form = _Form$useForm2[0];
32
35
  var formItemsRef = useRef(null);
33
-
34
36
  // 根据位置判断是否换行ref
35
37
  var endItemRef = useRef(null);
36
-
37
38
  // 查询条件是否展开
38
39
  var _useState = useState(expandForm),
39
40
  _useState2 = _slicedToArray(_useState, 2),
@@ -46,6 +47,9 @@ function HeadComponent(_ref) {
46
47
  useUpdateEffect(function () {
47
48
  setIsExpand(expandForm);
48
49
  }, [expandForm]);
50
+ useImperativeHandle(formRef, function () {
51
+ return form;
52
+ });
49
53
 
50
54
  // 处理form item 依赖
51
55
  var allFormItems = useMemo(function () {
@@ -99,9 +103,6 @@ function HeadComponent(_ref) {
99
103
  onClick: function onClick() {
100
104
  return form.submit();
101
105
  },
102
- style: {
103
- marginLeft: !hasMore ? 10 : undefined
104
- },
105
106
  children: "\u67E5\u8BE2"
106
107
  }), toolbar ? null : tableOperation]
107
108
  });
@@ -210,36 +211,6 @@ function HeadComponent(_ref) {
210
211
  })]
211
212
  })
212
213
  })]
213
- }), toolbar && /*#__PURE__*/_jsxs(Card, {
214
- styles: {
215
- cover: {
216
- borderRadius: 0
217
- },
218
- body: {
219
- display: 'flex',
220
- justifyContent: 'space-between',
221
- width: '100%',
222
- padding: '12px 16px',
223
- alignContent: 'center'
224
- }
225
- },
226
- style: {
227
- borderRadius: 0,
228
- borderLeft: 0,
229
- borderBottom: 0,
230
- borderRight: 0
231
- },
232
- children: [/*#__PURE__*/_jsx("div", {
233
- style: {
234
- flex: '1 1 auto'
235
- },
236
- children: toolbar
237
- }), /*#__PURE__*/_jsx("div", {
238
- style: {
239
- flex: '0 0 auto'
240
- },
241
- children: tableOperation
242
- })]
243
214
  }), children]
244
215
  });
245
216
  }
@@ -73,6 +73,8 @@ export type CcsProTableProps<RecordType> = Pick<PropsWithCss, 'className'> & Pro
73
73
  toolbar?: ReactElement;
74
74
  /** 操作按钮扩展 */
75
75
  toolbarExtra?: ReactElement;
76
+ /** 边框 */
77
+ bordered?: boolean;
76
78
  /** 展开查询条件,默认false */
77
79
  expandForm?: boolean;
78
80
  /** table 数据区域 */
@@ -18,7 +18,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
18
18
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
19
  import CcsUtils from '@ccs-ui/utils';
20
20
  import { useUpdateEffect } from 'ahooks';
21
- import { theme as antTheme, Empty, Form } from 'antd';
21
+ import { theme as antTheme, Card, Empty } from 'antd';
22
22
  import classNames from 'classnames';
23
23
  import _debounce from 'lodash.debounce';
24
24
  import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
@@ -32,8 +32,8 @@ import "./index.less";
32
32
  import TableOperation from "./operation";
33
33
  import TableTree from "./tree";
34
34
  import { jsx as _jsx } from "react/jsx-runtime";
35
- import { Fragment as _Fragment } from "react/jsx-runtime";
36
35
  import { jsxs as _jsxs } from "react/jsx-runtime";
36
+ import { Fragment as _Fragment } from "react/jsx-runtime";
37
37
  function onSetObj(target, paths, value) {
38
38
  while (paths.length > 0) {
39
39
  var path = paths.shift();
@@ -75,6 +75,7 @@ var InternalProTable = function InternalProTable(props) {
75
75
  _props$formItems = props.formItems,
76
76
  formItems = _props$formItems === void 0 ? [] : _props$formItems,
77
77
  leafNode = props.leafNode,
78
+ bordered = props.bordered,
78
79
  parentFieldName = props.parentFieldName,
79
80
  _props$formInitValues = props.formInitValues,
80
81
  formInitValues = _props$formInitValues === void 0 ? {} : _props$formInitValues;
@@ -122,9 +123,7 @@ var InternalProTable = function InternalProTable(props) {
122
123
  // table ref
123
124
  var tableRef = useRef();
124
125
  // 查询form
125
- var _Form$useForm = Form.useForm(),
126
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
127
- form = _Form$useForm2[0];
126
+ var formRef = useRef(null);
128
127
  // table data
129
128
  var _useState = useState({
130
129
  total: 0,
@@ -166,157 +165,150 @@ var InternalProTable = function InternalProTable(props) {
166
165
 
167
166
  // 获取数据
168
167
  var onRequest = /*#__PURE__*/function () {
169
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventType) {
168
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(eventType) {
169
+ var _formRef$current, _props$table;
170
170
  var pageNo,
171
171
  pageSize,
172
172
  record,
173
- _args2 = arguments;
174
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
175
- while (1) switch (_context2.prev = _context2.next) {
173
+ formValues,
174
+ fieldNames,
175
+ _fieldNames$requestPa,
176
+ _fieldNames$requestPa2,
177
+ fsFilters,
178
+ _fieldNames$requestPa3,
179
+ fsPageNo,
180
+ _fieldNames$requestPa4,
181
+ fsPageSize,
182
+ _fieldNames$requestPa5,
183
+ fsOrderProps,
184
+ fsQuery,
185
+ params,
186
+ _filtersRef$current,
187
+ filters,
188
+ orderProps,
189
+ _treeRef$current,
190
+ requestResult,
191
+ dataSource,
192
+ total,
193
+ _args = arguments;
194
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
195
+ while (1) switch (_context.prev = _context.next) {
176
196
  case 0:
177
- pageNo = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : 1;
178
- pageSize = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : (pagination ? pagination.defaultPageSize : 10) || 10;
179
- record = _args2.length > 3 ? _args2[3] : undefined;
197
+ pageNo = _args.length > 1 && _args[1] !== undefined ? _args[1] : 1;
198
+ pageSize = _args.length > 2 && _args[2] !== undefined ? _args[2] : (pagination ? pagination.defaultPageSize : 10) || 10;
199
+ record = _args.length > 3 ? _args[3] : undefined;
180
200
  if (!(!isAuth || !httpRequest)) {
181
- _context2.next = 5;
201
+ _context.next = 5;
182
202
  break;
183
203
  }
184
- return _context2.abrupt("return");
204
+ return _context.abrupt("return");
185
205
  case 5:
186
- // 构建查询条件:表单数据、请求额外参数、分页参数、其他参数
187
- form.validateFields().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
188
- var _props$table;
189
- var formValues,
190
- fieldNames,
191
- _fieldNames$requestPa,
192
- _fieldNames$requestPa2,
193
- fsFilters,
194
- _fieldNames$requestPa3,
195
- fsPageNo,
196
- _fieldNames$requestPa4,
197
- fsPageSize,
198
- _fieldNames$requestPa5,
199
- fsOrderProps,
200
- fsQuery,
201
- params,
202
- _filtersRef$current,
203
- filters,
204
- orderProps,
205
- _treeRef$current,
206
- requestResult,
207
- dataSource,
208
- total,
209
- _args = arguments;
210
- return _regeneratorRuntime().wrap(function _callee$(_context) {
211
- while (1) switch (_context.prev = _context.next) {
212
- case 0:
213
- formValues = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
214
- // 接口字段指定
215
- fieldNames = _objectSpread(_objectSpread({}, globalFieldNames), (_props$table = props.table) === null || _props$table === void 0 ? void 0 : _props$table.fieldNames); // 格式化条件
216
- if (formatFormItems.length) {
217
- Object.keys(formValues).forEach(function (k) {
218
- if (formValues[k] !== undefined) {
219
- var s = formatFormItems.find(function (f) {
220
- return f.name === k;
221
- });
222
- if (s) formValues[k] = s.onFormat && s.onFormat(formValues[k]);
223
- }
224
- });
225
- }
226
- _fieldNames$requestPa = fieldNames.requestParam, _fieldNames$requestPa2 = _fieldNames$requestPa.filters, fsFilters = _fieldNames$requestPa2 === void 0 ? ['filters'] : _fieldNames$requestPa2, _fieldNames$requestPa3 = _fieldNames$requestPa.pageNo, fsPageNo = _fieldNames$requestPa3 === void 0 ? ['pageNo'] : _fieldNames$requestPa3, _fieldNames$requestPa4 = _fieldNames$requestPa.pageSize, fsPageSize = _fieldNames$requestPa4 === void 0 ? ['pageSize'] : _fieldNames$requestPa4, _fieldNames$requestPa5 = _fieldNames$requestPa.orderProps, fsOrderProps = _fieldNames$requestPa5 === void 0 ? ['orderProps'] : _fieldNames$requestPa5, fsQuery = _fieldNames$requestPa.query; // 构建请求参数
227
- params = {
228
- eventType: eventType
229
- };
230
- if (fsQuery && fsQuery.length > 0) {
231
- onSetObj(params, fsQuery, _objectSpread(_objectSpread({}, requestParam), formValues));
232
- } else {
233
- params = _objectSpread(_objectSpread({}, requestParam), formValues);
234
- }
206
+ _context.next = 7;
207
+ return (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.validateFields();
208
+ case 7:
209
+ formValues = _context.sent;
210
+ // 接口字段指定
211
+ fieldNames = _objectSpread(_objectSpread({}, globalFieldNames), (_props$table = props.table) === null || _props$table === void 0 ? void 0 : _props$table.fieldNames); // 格式化条件
212
+ if (formatFormItems.length) {
213
+ Object.keys(formValues).forEach(function (k) {
214
+ if (formValues[k] !== undefined) {
215
+ var s = formatFormItems.find(function (f) {
216
+ return f.name === k;
217
+ });
218
+ if (s) formValues[k] = s.onFormat && s.onFormat(formValues[k]);
219
+ }
220
+ });
221
+ }
235
222
 
236
- // 分页
237
- if (pagination !== false) {
238
- onSetObj(params, fsPageNo, pageNo);
239
- onSetObj(params, fsPageSize, pageSize);
240
- }
223
+ // 请求字段
224
+ _fieldNames$requestPa = fieldNames.requestParam, _fieldNames$requestPa2 = _fieldNames$requestPa.filters, fsFilters = _fieldNames$requestPa2 === void 0 ? ['filters'] : _fieldNames$requestPa2, _fieldNames$requestPa3 = _fieldNames$requestPa.pageNo, fsPageNo = _fieldNames$requestPa3 === void 0 ? ['pageNo'] : _fieldNames$requestPa3, _fieldNames$requestPa4 = _fieldNames$requestPa.pageSize, fsPageSize = _fieldNames$requestPa4 === void 0 ? ['pageSize'] : _fieldNames$requestPa4, _fieldNames$requestPa5 = _fieldNames$requestPa.orderProps, fsOrderProps = _fieldNames$requestPa5 === void 0 ? ['orderProps'] : _fieldNames$requestPa5, fsQuery = _fieldNames$requestPa.query; // 构建请求参数
225
+ params = {
226
+ eventType: eventType
227
+ };
228
+ if (fsQuery && fsQuery.length > 0) {
229
+ onSetObj(params, fsQuery, _objectSpread(_objectSpread(_objectSpread({}, requestParam), formInitValues), formValues));
230
+ } else {
231
+ params = _objectSpread(_objectSpread({}, requestParam), formValues);
232
+ }
241
233
 
242
- // 列过滤或排序参数
243
- _filtersRef$current = filtersRef.current, filters = _filtersRef$current.filters, orderProps = _filtersRef$current.orderProps;
244
- if (Object.keys(filters).length > 0) {
245
- onSetObj(params, fsFilters, filters);
246
- }
247
- if (orderProps.length > 0) {
248
- onSetObj(params, fsOrderProps, orderProps);
249
- }
234
+ // 分页
235
+ if (pagination !== false) {
236
+ onSetObj(params, fsPageNo, pageNo);
237
+ onSetObj(params, fsPageSize, pageSize);
238
+ }
250
239
 
251
- // 异步树
252
- if (!parentFieldName) {
253
- _context.next = 13;
254
- break;
255
- }
256
- (_treeRef$current = treeRef.current) === null || _treeRef$current === void 0 || _treeRef$current.onRequestTree(params.query, record);
257
- return _context.abrupt("return");
258
- case 13:
259
- // 发起请求
260
- setData(function (d) {
261
- return _objectSpread(_objectSpread({}, d), {}, {
262
- loading: true
263
- });
264
- });
265
- _context.next = 16;
266
- return httpRequest(params);
267
- case 16:
268
- requestResult = _context.sent;
269
- if (!requestResult) {
270
- _context.next = 26;
271
- break;
272
- }
273
- // 获取table数据
274
- dataSource = getDataFromFields(requestResult, fieldNames.dataSource);
275
- total = getDataFromFields(requestResult, fieldNames.total);
276
- if (!(total === undefined || dataSource === undefined)) {
277
- _context.next = 23;
278
- break;
279
- }
280
- setData({
281
- dataSource: dataSource,
282
- pageSize: pageSize,
283
- current: pageNo,
284
- total: total,
285
- loading: false
286
- });
287
- return _context.abrupt("return");
288
- case 23:
289
- // 当前页无数据,返回上一页
290
- if (!dataSource.length && pageNo !== 1) {
291
- onRequest('reload', pageNo - 1);
292
- } else {
293
- setData({
294
- current: pageNo,
295
- pageSize: pageSize,
296
- loading: false,
297
- dataSource: dataSource,
298
- total: total || 0
299
- });
300
- }
301
- _context.next = 27;
302
- break;
303
- case 26:
304
- setData(function (d) {
305
- return _objectSpread(_objectSpread({}, d), {}, {
306
- loading: false
307
- });
308
- });
309
- case 27:
310
- case "end":
311
- return _context.stop();
312
- }
313
- }, _callee);
314
- }))).catch(function () {});
315
- case 6:
240
+ // 列过滤或排序参数
241
+ _filtersRef$current = filtersRef.current, filters = _filtersRef$current.filters, orderProps = _filtersRef$current.orderProps;
242
+ if (Object.keys(filters).length > 0) {
243
+ onSetObj(params, fsFilters, filters);
244
+ }
245
+ if (orderProps.length > 0) {
246
+ onSetObj(params, fsOrderProps, orderProps);
247
+ }
248
+
249
+ // 异步树
250
+ if (!parentFieldName) {
251
+ _context.next = 20;
252
+ break;
253
+ }
254
+ (_treeRef$current = treeRef.current) === null || _treeRef$current === void 0 || _treeRef$current.onRequestTree(params.query, record);
255
+ return _context.abrupt("return");
256
+ case 20:
257
+ // 发起请求
258
+ setData(function (d) {
259
+ return _objectSpread(_objectSpread({}, d), {}, {
260
+ loading: true
261
+ });
262
+ });
263
+ _context.next = 23;
264
+ return httpRequest(params);
265
+ case 23:
266
+ requestResult = _context.sent;
267
+ if (!requestResult) {
268
+ _context.next = 33;
269
+ break;
270
+ }
271
+ // 获取table数据
272
+ dataSource = getDataFromFields(requestResult, fieldNames.dataSource);
273
+ total = getDataFromFields(requestResult, fieldNames.total);
274
+ if (!(total === undefined || dataSource === undefined)) {
275
+ _context.next = 30;
276
+ break;
277
+ }
278
+ setData({
279
+ dataSource: dataSource,
280
+ pageSize: pageSize,
281
+ current: pageNo,
282
+ total: total,
283
+ loading: false
284
+ });
285
+ return _context.abrupt("return");
286
+ case 30:
287
+ // 当前页无数据,返回上一页
288
+ if (!dataSource.length && pageNo !== 1) {
289
+ onRequest('reload', pageNo - 1);
290
+ } else {
291
+ setData({
292
+ current: pageNo,
293
+ pageSize: pageSize,
294
+ loading: false,
295
+ dataSource: dataSource,
296
+ total: total || 0
297
+ });
298
+ }
299
+ _context.next = 34;
300
+ break;
301
+ case 33:
302
+ setData(function (d) {
303
+ return _objectSpread(_objectSpread({}, d), {}, {
304
+ loading: false
305
+ });
306
+ });
307
+ case 34:
316
308
  case "end":
317
- return _context2.stop();
309
+ return _context.stop();
318
310
  }
319
- }, _callee2);
311
+ }, _callee);
320
312
  }));
321
313
  return function onRequest(_x) {
322
314
  return _ref2.apply(this, arguments);
@@ -376,8 +368,9 @@ var InternalProTable = function InternalProTable(props) {
376
368
 
377
369
  // 重置
378
370
  var _onReset = function onReset() {
371
+ var _formRef$current2;
379
372
  if (selectedRows.length > 0) setSelectedRows([]);
380
- form === null || form === void 0 || form.resetFields();
373
+ (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.resetFields();
381
374
  // 清空columns显示filter和sort值
382
375
  columns === null || columns === void 0 || columns.forEach(function (c) {
383
376
  if (c.filterDropdown || c.filters) {
@@ -400,10 +393,11 @@ var InternalProTable = function InternalProTable(props) {
400
393
 
401
394
  // form 数据 查询,重载,重置方法
402
395
  useImperativeHandle(proRef, function () {
396
+ var _formRef$current3;
403
397
  return {
404
398
  data: data,
405
399
  selectedRows: selectedRows,
406
- formValues: _objectSpread(_objectSpread({}, form.getFieldsValue()), filtersRef.current),
400
+ formValues: _objectSpread(_objectSpread({}, (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.getFieldsValue()), filtersRef.current),
407
401
  onSearch: function onSearch() {
408
402
  _onSearch();
409
403
  },
@@ -507,10 +501,10 @@ var InternalProTable = function InternalProTable(props) {
507
501
  }
508
502
 
509
503
  // 选择,只传入一个type参数或不传,封装选择行为
510
- var _ref4 = table.rowSelection || {},
511
- _ref4$type = _ref4.type,
512
- type = _ref4$type === void 0 ? 'checkbox' : _ref4$type,
513
- restSelection = _objectWithoutProperties(_ref4, _excluded);
504
+ var _ref3 = table.rowSelection || {},
505
+ _ref3$type = _ref3.type,
506
+ type = _ref3$type === void 0 ? 'checkbox' : _ref3$type,
507
+ restSelection = _objectWithoutProperties(_ref3, _excluded);
514
508
  var hasSelection = table.rowSelection && CcsUtils.isEmpty(restSelection);
515
509
  var rowSelection = hasSelection ? {
516
510
  type: type,
@@ -571,31 +565,19 @@ var InternalProTable = function InternalProTable(props) {
571
565
  } : undefined
572
566
  }));
573
567
  };
574
- var newToolbar = toolbar && /*#__PURE__*/_jsx(TableSelectionContext.Provider, {
575
- value: {
576
- selectedRows: selectedRows
577
- },
578
- children: toolbar
579
- });
580
- var newToolbarExtra = /*#__PURE__*/_jsx(TableSelectionContext.Provider, {
581
- value: {
582
- selectedRows: selectedRows
583
- },
584
- children: toolbarExtra
585
- });
586
568
  var _antTheme$useToken = antTheme.useToken(),
587
569
  token = _antTheme$useToken.token;
588
570
  var rootStyle = styles.root || {};
589
- if (table !== null && table !== void 0 && table.bordered) {
571
+ if (bordered) {
590
572
  rootStyle = _objectSpread({
591
573
  border: "1px solid ".concat(token.colorBorderSecondary),
592
574
  borderRadius: 4
593
575
  }, rootStyle);
594
576
  }
595
577
  var onFullScreen = function onFullScreen(isFull) {
596
- var _ref5 = containerRef.current || {},
597
- classList = _ref5.classList,
598
- style = _ref5.style;
578
+ var _ref4 = containerRef.current || {},
579
+ classList = _ref4.classList,
580
+ style = _ref4.style;
599
581
  if (isFull) {
600
582
  classList === null || classList === void 0 || classList.add('css-table-full');
601
583
  style.backgroundColor = token.colorBgContainer;
@@ -616,6 +598,18 @@ var InternalProTable = function InternalProTable(props) {
616
598
 
617
599
  // 监听容器尺寸变化
618
600
  var onResize = _debounce(resizeFn, 500);
601
+
602
+ // table 操作按钮
603
+ var renderTableOperation = (table === null || table === void 0 ? void 0 : table.hideOperation) !== true ? /*#__PURE__*/_jsx(TableOperation, {
604
+ onChangeRowSize: function onChangeRowSize(e) {
605
+ return setTableRowSize(e);
606
+ },
607
+ tableRowSize: tableRowSize,
608
+ onReset: _onReset,
609
+ columns: columns,
610
+ tableRef: tableRef,
611
+ onFullScreen: onFullScreen
612
+ }) : undefined;
619
613
  return /*#__PURE__*/_jsxs(_Fragment, {
620
614
  children: [/*#__PURE__*/_jsx(CcsResizeObserver.Target, {
621
615
  targetRef: tableContentRef,
@@ -626,26 +620,52 @@ var InternalProTable = function InternalProTable(props) {
626
620
  overflow: (table === null || table === void 0 || (_table$scroll2 = table.scroll) === null || _table$scroll2 === void 0 ? void 0 : _table$scroll2.y) === 'auto' ? 'hidden' : 'unset'
627
621
  }),
628
622
  ref: containerRef,
629
- children: [!(!formItems.length && !toolbar) && isAuth && /*#__PURE__*/_jsx(HeadComponent, {
630
- form: form,
631
- toolbar: newToolbar,
632
- formItems: formItems,
633
- expandForm: expandForm,
634
- formInitValues: formInitValues,
635
- formItemLabelWidth: props.formItemLabelWidth,
636
- onSearch: _onSearch,
637
- title: props.title,
638
- tableOperation: (table === null || table === void 0 ? void 0 : table.hideOperation) !== true ? /*#__PURE__*/_jsx(TableOperation, {
639
- onChangeRowSize: function onChangeRowSize(e) {
640
- return setTableRowSize(e);
623
+ children: [isAuth && /*#__PURE__*/_jsxs(TableSelectionContext.Provider, {
624
+ value: {
625
+ selectedRows: selectedRows
626
+ },
627
+ children: [/*#__PURE__*/_jsx(HeadComponent, {
628
+ formRef: formRef,
629
+ toolbar: toolbar,
630
+ formItems: formItems,
631
+ expandForm: expandForm,
632
+ formInitValues: formInitValues,
633
+ formItemLabelWidth: props.formItemLabelWidth,
634
+ onSearch: _onSearch,
635
+ title: props.title,
636
+ tableOperation: renderTableOperation,
637
+ children: toolbarExtra
638
+ }), (toolbar || formItems.length === 0 && renderTableOperation) && /*#__PURE__*/_jsxs(Card, {
639
+ styles: {
640
+ cover: {
641
+ borderRadius: 0
642
+ },
643
+ body: {
644
+ display: 'flex',
645
+ justifyContent: 'space-between',
646
+ width: '100%',
647
+ padding: '12px 16px',
648
+ alignContent: 'center'
649
+ }
650
+ },
651
+ style: {
652
+ borderRadius: 0,
653
+ borderLeft: 0,
654
+ borderBottom: 0,
655
+ borderRight: 0
641
656
  },
642
- tableRowSize: tableRowSize,
643
- onReset: _onReset,
644
- columns: columns,
645
- tableRef: tableRef,
646
- onFullScreen: onFullScreen
647
- }) : /*#__PURE__*/_jsx(_Fragment, {}),
648
- children: newToolbarExtra
657
+ children: [/*#__PURE__*/_jsx("div", {
658
+ style: {
659
+ flex: '1 1 auto'
660
+ },
661
+ children: toolbar
662
+ }), /*#__PURE__*/_jsx("div", {
663
+ style: {
664
+ flex: '0 0 auto'
665
+ },
666
+ children: renderTableOperation
667
+ })]
668
+ }), children]
649
669
  }), /*#__PURE__*/_jsxs("div", {
650
670
  className: "".concat(classPrefix, "-table-content"),
651
671
  style: _objectSpread(_objectSpread({}, styles === null || styles === void 0 ? void 0 : styles.table), {}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "2.3.6-beta-26",
3
+ "version": "2.3.6-beta-28",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {