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