fan-standard-comp 4.1.2 → 4.1.4
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/dist/fan-standard-comp.min.css +1 -1
- package/dist/fan-standard-comp.min.js +1 -1
- package/es/CompositeTable/index.d.ts +0 -0
- package/es/CompositeTable/index.js +211 -0
- package/es/CompositeTable/index.style.d.ts +5 -0
- package/es/CompositeTable/index.style.js +27 -0
- package/es/FormComp/FieldComponent/ExtensionField.d.ts +2 -2
- package/es/FormComp/FieldComponent/ExtensionField.js +1 -1
- package/es/FormComp/FieldComponent/index.js +2 -6
- package/es/StandardContent/ContentHeader.js +17 -25
- package/es/StandardContent/SubfieldContent.js +12 -9
- package/es/StandardContent/WrapperContent.js +9 -8
- package/es/StandardContent/styles/Subfield.js +18 -5
- package/es/StandardContent/styles/Wrapper.js +13 -2
- package/es/StandardContent/styles/index.less +8 -2
- package/es/StandardFilter/index.js +52 -28
- package/es/StandardFilter/style/FilterStyle.js +3 -2
- package/es/StandardFilter/style/index.less +7 -0
- package/es/StandardForm/index.js +3 -1
- package/es/StandardTable/index.d.ts +4 -28
- package/es/StandardTable/index.js +65 -5
- package/es/StandardTable/types.d.ts +33 -0
- package/es/StandardTable/types.js +1 -0
- package/es/StandardTablePro/index.d.ts +5 -7
- package/es/StandardTablePro/index.js +246 -84
- package/es/StandardTablePro/types.d.ts +29 -0
- package/es/StandardTablePro/types.js +1 -0
- package/es/StandardTablePro/useFetchData.d.ts +0 -0
- package/es/StandardTablePro/useFetchData.js +275 -0
- package/es/StandardTablePro/utils.d.ts +3 -0
- package/es/StandardTablePro/utils.js +49 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -0
- package/es/types.d.ts +1 -0
- package/es/types.js +1 -0
- package/es/utils/ValueFormat.d.ts +1 -1
- package/es/utils/ValueFormat.js +42 -27
- package/es/utils/getParentNodes.js +1 -1
- package/es/utils/urlUtils.d.ts +6 -0
- package/es/utils/urlUtils.js +26 -0
- package/lib/CompositeTable/index.d.ts +0 -0
- package/lib/CompositeTable/index.js +212 -0
- package/lib/CompositeTable/index.style.d.ts +5 -0
- package/lib/CompositeTable/index.style.js +33 -0
- package/lib/FormComp/FieldComponent/ExtensionField.d.ts +2 -2
- package/lib/FormComp/FieldComponent/ExtensionField.js +1 -1
- package/lib/FormComp/FieldComponent/index.js +2 -6
- package/lib/StandardContent/ContentHeader.js +16 -24
- package/lib/StandardContent/SubfieldContent.js +12 -9
- package/lib/StandardContent/WrapperContent.js +9 -8
- package/lib/StandardContent/styles/Subfield.js +18 -5
- package/lib/StandardContent/styles/Wrapper.js +13 -2
- package/lib/StandardContent/styles/index.less +8 -2
- package/lib/StandardFilter/index.js +52 -28
- package/lib/StandardFilter/style/FilterStyle.js +3 -2
- package/lib/StandardFilter/style/index.less +7 -0
- package/lib/StandardForm/index.js +3 -1
- package/lib/StandardTable/index.d.ts +4 -28
- package/lib/StandardTable/index.js +64 -4
- package/lib/StandardTable/types.d.ts +33 -0
- package/lib/StandardTable/types.js +5 -0
- package/lib/StandardTablePro/index.d.ts +5 -7
- package/lib/StandardTablePro/index.js +244 -82
- package/lib/StandardTablePro/types.d.ts +29 -0
- package/lib/StandardTablePro/types.js +5 -0
- package/lib/StandardTablePro/useFetchData.d.ts +0 -0
- package/lib/StandardTablePro/useFetchData.js +276 -0
- package/lib/StandardTablePro/utils.d.ts +3 -0
- package/lib/StandardTablePro/utils.js +55 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +20 -0
- package/lib/types.d.ts +1 -0
- package/lib/types.js +16 -0
- package/lib/utils/ValueFormat.d.ts +1 -1
- package/lib/utils/ValueFormat.js +42 -29
- package/lib/utils/getParentNodes.js +1 -1
- package/lib/utils/urlUtils.d.ts +6 -0
- package/lib/utils/urlUtils.js +27 -3
- package/package.json +2 -2
|
@@ -20,6 +20,7 @@ import ButtonGroup from "../ButtonGroup/";
|
|
|
20
20
|
import { general } from "../data/";
|
|
21
21
|
import "./style/index.less";
|
|
22
22
|
import { FanContext } from "../ConfigContext";
|
|
23
|
+
import dayjs from "dayjs";
|
|
23
24
|
import useStyle from "./style/FilterStyle";
|
|
24
25
|
import SpecIcon from "../SpecIcon";
|
|
25
26
|
var FormItem = Form.Item;
|
|
@@ -64,11 +65,18 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
64
65
|
colon = _providerConfig$props10 === void 0 ? true : _providerConfig$props10,
|
|
65
66
|
dateFormatter = _providerConfig$props.dateFormatter,
|
|
66
67
|
_providerConfig$props11 = _providerConfig$props.collapseable,
|
|
67
|
-
collapseable = _providerConfig$props11 === void 0 ? false : _providerConfig$props11
|
|
68
|
+
collapseable = _providerConfig$props11 === void 0 ? false : _providerConfig$props11,
|
|
69
|
+
parseTransform = _providerConfig$props.parseTransform,
|
|
70
|
+
_providerConfig$props12 = _providerConfig$props.forceListener,
|
|
71
|
+
forceListener = _providerConfig$props12 === void 0 ? true : _providerConfig$props12;
|
|
68
72
|
var filterFormRef = useRef();
|
|
69
73
|
// ref 的转发
|
|
70
74
|
useImperativeHandle(ref, function () {
|
|
71
|
-
return filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.current
|
|
75
|
+
return _objectSpread(_objectSpread({}, filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.current), {}, {
|
|
76
|
+
onSubmit: function onSubmit(values) {
|
|
77
|
+
return handleSearch(values);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
72
80
|
});
|
|
73
81
|
var _useState = useState([]),
|
|
74
82
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -193,7 +201,8 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
193
201
|
protoFormItem: {
|
|
194
202
|
style: {
|
|
195
203
|
textAlign: filterFormLayout === 'horizontal' ? 'right' : 'left'
|
|
196
|
-
}
|
|
204
|
+
},
|
|
205
|
+
className: filterFormLayout === 'horizontal' ? 'filter-action-right' : 'filter-action-left'
|
|
197
206
|
},
|
|
198
207
|
colSpan: filterButtonColSpan || 24 - calculateTimes * (24 / general.modalSize[itemGroupSize].columnNumber)
|
|
199
208
|
}, filterButtonConfig), {}, {
|
|
@@ -239,27 +248,33 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
239
248
|
resetValues[item] = undefined;
|
|
240
249
|
});
|
|
241
250
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
251
|
+
var dateFieldTypes = ['datePicker', 'dateTimePicker', 'rangePicker', 'rangeTimePicker', 'timePicker', 'timePickerRange'];
|
|
252
|
+
var filterDateFields = formItemGroup.filter(function (fItem) {
|
|
253
|
+
return dateFieldTypes.includes(fItem.type);
|
|
254
|
+
});
|
|
255
|
+
if (parseTransform) {
|
|
256
|
+
newVal = parseTransform(_objectSpread({}, newVal));
|
|
257
|
+
}
|
|
258
|
+
// 如果配置了dateFormatter='string',则将默认对其他进行格式转换
|
|
259
|
+
if (dateFormatter === 'string') {
|
|
260
|
+
// 需要将字符串转换成日期格式
|
|
261
|
+
filterDateFields.forEach(function (dItem) {
|
|
262
|
+
if (newVal[dItem.filedName || dItem.fieldName]) {
|
|
263
|
+
if (typeof newVal[dItem.filedName || dItem.fieldName] === 'string') {
|
|
264
|
+
// console.log('将字符串转换成dayjs')
|
|
265
|
+
newVal[dItem.filedName || dItem.fieldName] = dayjs(newVal[dItem.filedName || dItem.fieldName]);
|
|
266
|
+
} else if (Array.isArray(newVal[dItem.filedName || dItem.fieldName])) {
|
|
267
|
+
// console.log('将数组转换成dayjs数组')
|
|
268
|
+
newVal[dItem.filedName || dItem.fieldName] = newVal[dItem.filedName || dItem.fieldName].map(function (valItem) {
|
|
269
|
+
return typeof valItem === 'string' ? dayjs(valItem) : valItem;
|
|
270
|
+
});
|
|
271
|
+
} else {
|
|
272
|
+
// console.log('其他情况', newVal[dItem.filedName] instanceof Date)
|
|
273
|
+
// console.log('其他情况,当它是日期格式,则不进行转换')
|
|
260
274
|
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
263
278
|
filterFormRef.current.setFieldsValue(_objectSpread(_objectSpread({}, resetValues), newVal || {})); // 直接清空表单的赋值
|
|
264
279
|
forceUpdateForm();
|
|
265
280
|
};
|
|
@@ -276,7 +291,8 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
276
291
|
if (Object.prototype.hasOwnProperty.call(values, false)) {
|
|
277
292
|
delete values.false; // 自定义结构会莫名的出来一个false字段
|
|
278
293
|
}
|
|
279
|
-
var resultValues =
|
|
294
|
+
var resultValues = UtilValueFormat(values, reFormItemGroup, dateFormatter);
|
|
295
|
+
// reFormItemGroup里面有 transform,则筛选转换
|
|
280
296
|
// console.log('格式化前数据', values)
|
|
281
297
|
// console.log('格式化后数据', resultValues)
|
|
282
298
|
if (onFilterSearch) {
|
|
@@ -359,11 +375,19 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
359
375
|
}
|
|
360
376
|
}, [formItemGroup, collapseable, filterFormLayout, collapsed, columnNumberAndSize === null || columnNumberAndSize === void 0 ? void 0 : columnNumberAndSize.columnNumber, itemGroupConfig, filterFormRef, filterFormRef === null || filterFormRef === void 0 || (_filterFormRef$curren4 = filterFormRef.current) === null || _filterFormRef$curren4 === void 0 ? void 0 : _filterFormRef$curren4.getFieldValue()]);
|
|
361
377
|
useEffect(function () {
|
|
362
|
-
if (
|
|
363
|
-
|
|
378
|
+
if (!forceListener) {
|
|
379
|
+
if (initialValues && JSON.stringify(initialValues) !== '{}') {
|
|
380
|
+
updateFormFields(initialValues, true);
|
|
381
|
+
}
|
|
364
382
|
}
|
|
365
|
-
}, [
|
|
366
|
-
|
|
383
|
+
}, []);
|
|
384
|
+
useEffect(function () {
|
|
385
|
+
if (forceListener) {
|
|
386
|
+
if (initialValues && JSON.stringify(initialValues) !== '{}') {
|
|
387
|
+
updateFormFields(initialValues, true);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}, [forceListener, initialValues]);
|
|
367
391
|
// / 表单列表组 formItemGroup 类型为数组或者React.Node
|
|
368
392
|
var renderFormItemGroup = function renderFormItemGroup() {
|
|
369
393
|
if (Array.isArray(reFormItemGroup)) {
|
|
@@ -16,8 +16,9 @@ var StandardFilterStyleFunc = function StandardFilterStyleFunc(prefix) {
|
|
|
16
16
|
// backgroundColor: token.colorBgBase,
|
|
17
17
|
'.filter-form': {
|
|
18
18
|
'.ant-form-item-control, ant-form-item-label': {
|
|
19
|
-
lineHeight: token.controlHeight + 'px'
|
|
20
|
-
}
|
|
19
|
+
// lineHeight: token.controlHeight + 'px'// @input-height-base;
|
|
20
|
+
},
|
|
21
|
+
'.ant-btn .ant-btn-icon': {}
|
|
21
22
|
},
|
|
22
23
|
'.filter-form .ant-form-item': {
|
|
23
24
|
marginRight: token.paddingMD,
|
package/es/StandardForm/index.js
CHANGED
|
@@ -23,6 +23,7 @@ import "./style/index.less";
|
|
|
23
23
|
import ActionList from "./ActionList";
|
|
24
24
|
import useStyle from "./style/index";
|
|
25
25
|
import { FanContext } from "../ConfigContext";
|
|
26
|
+
import { UtilValueFormat } from "../utils";
|
|
26
27
|
var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
27
28
|
var InitFanContext = useContext(FanContext);
|
|
28
29
|
var providerConfig = InitFanContext['StandardForm'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
@@ -98,7 +99,8 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
98
99
|
getFormFields && getFormFields(initForm && initForm.getFieldsValue() || {}, initForm);
|
|
99
100
|
};
|
|
100
101
|
var onFormFinish = function onFormFinish(values) {
|
|
101
|
-
|
|
102
|
+
var resultValues = UtilValueFormat(values, formItemGroup);
|
|
103
|
+
if (onSubmit) onSubmit(_objectSpread({}, resultValues));
|
|
102
104
|
};
|
|
103
105
|
var onFormFinishFailed = function onFormFinishFailed(_ref) {
|
|
104
106
|
var values = _ref.values,
|
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import './style/index.less';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export interface StandardTableProps {
|
|
8
|
-
columns?: any[];
|
|
9
|
-
data: StandardTableDataProps;
|
|
10
|
-
rowKey?: string;
|
|
11
|
-
onChange?: (pageConfig?: any) => void;
|
|
12
|
-
hideOrderNumber?: boolean;
|
|
13
|
-
emptyText?: string;
|
|
14
|
-
codes?: object[];
|
|
15
|
-
permissionCodes?: string[];
|
|
16
|
-
className?: string;
|
|
17
|
-
rowSelection?: any;
|
|
18
|
-
orderNumber?: object;
|
|
19
|
-
columnsConfig?: object;
|
|
20
|
-
buttonGroup?: any[];
|
|
21
|
-
title?: React.ReactNode | string;
|
|
22
|
-
min?: number;
|
|
23
|
-
buttonGroupConfig?: any;
|
|
24
|
-
batchButtonGroup?: any[];
|
|
25
|
-
buttonGroupPlacement?: string | 'left' | 'right' | 'bottomLeft' | 'bottomRight';
|
|
26
|
-
[k: string]: any;
|
|
27
|
-
}
|
|
28
|
-
declare const StandardTable: FC<StandardTableProps>;
|
|
29
|
-
export default StandardTable;
|
|
3
|
+
import type { StandardTableProps } from './types';
|
|
4
|
+
declare const _default: React.NamedExoticComponent<StandardTableProps>;
|
|
5
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["data", "rowKey", "rowSelection", "columns", "hideOrderNumber", "orderNumber", "className", "emptyText", "codes", "permissionCodes", "columnsConfig", "title", "buttonGroup", "buttonGroupConfig", "min", "batchButtonGroup", "buttonGroupPlacement"];
|
|
2
|
+
var _excluded = ["data", "rowKey", "rowSelection", "columns", "hideOrderNumber", "orderNumber", "className", "emptyText", "codes", "permissionCodes", "columnsConfig", "title", "buttonGroup", "buttonGroupConfig", "min", "batchButtonGroup", "buttonGroupPlacement", "sortOrders"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -14,7 +14,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
14
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
15
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
import React, { useContext } from 'react';
|
|
17
|
+
import React, { useContext, memo } from 'react';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
19
|
import { Table, Card } from 'antd';
|
|
20
20
|
import ButtonGroup from "../ButtonGroup/index";
|
|
@@ -54,6 +54,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
54
54
|
batchButtonGroup = _providerConfig$props.batchButtonGroup,
|
|
55
55
|
_providerConfig$props5 = _providerConfig$props.buttonGroupPlacement,
|
|
56
56
|
buttonGroupPlacement = _providerConfig$props5 === void 0 ? 'right' : _providerConfig$props5,
|
|
57
|
+
sortOrders = _providerConfig$props.sortOrders,
|
|
57
58
|
rest = _objectWithoutProperties(_providerConfig$props, _excluded);
|
|
58
59
|
// 加上类型修复 TS:2322 报警
|
|
59
60
|
var resetColumns = [_objectSpread(_objectSpread({
|
|
@@ -77,7 +78,8 @@ var StandardTable = function StandardTable(props) {
|
|
|
77
78
|
pageSizeOptions: ['5', '10', '15', '20', '30', '50'],
|
|
78
79
|
showTotal: function showTotal(total, range) {
|
|
79
80
|
return "".concat(range[0], "-").concat(range[1], "\u6761 \u5171").concat(total, "\u6761");
|
|
80
|
-
}
|
|
81
|
+
},
|
|
82
|
+
pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || (pagination === null || pagination === void 0 ? void 0 : pagination.size)
|
|
81
83
|
}, pagination);
|
|
82
84
|
if (columns) {
|
|
83
85
|
var recombinationColumns = columns.map(function (colItem) {
|
|
@@ -135,10 +137,27 @@ var StandardTable = function StandardTable(props) {
|
|
|
135
137
|
colItem.render = function (text, record, rowIndex) {
|
|
136
138
|
return text || text === 0 ? text : '-';
|
|
137
139
|
};
|
|
140
|
+
if (sortOrders && (sortOrders.hasOwnProperty(colItem.key) || sortOrders.hasOwnProperty(colItem.dataIndex))) {
|
|
141
|
+
colItem.sortOrder = (sortOrders === null || sortOrders === void 0 ? void 0 : sortOrders[colItem.key]) || (sortOrders === null || sortOrders === void 0 ? void 0 : sortOrders[colItem.dataIndex]) || (sortOrders === null || sortOrders === void 0 ? void 0 : sortOrders[colItem.key]) || null;
|
|
142
|
+
colItem.sortOrderExtra = true;
|
|
143
|
+
} else {
|
|
144
|
+
if (colItem.sortOrderExtra) {
|
|
145
|
+
delete colItem.sortOrder;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
138
148
|
// return Object.assign({ ellipsis: undefined, render: undefined }, { ...otherColumns, ...colItem }); // ellipsis要配置在render之前
|
|
139
149
|
return _objectSpread(_objectSpread({}, otherColumn), colItem);
|
|
140
150
|
}
|
|
151
|
+
if (sortOrders && (sortOrders.hasOwnProperty(colItem.key) || sortOrders.hasOwnProperty(colItem.dataIndex))) {
|
|
152
|
+
colItem.sortOrder = (sortOrders === null || sortOrders === void 0 ? void 0 : sortOrders[colItem.key]) || (sortOrders === null || sortOrders === void 0 ? void 0 : sortOrders[colItem.dataIndex]) || (sortOrders === null || sortOrders === void 0 ? void 0 : sortOrders[colItem.key]) || null;
|
|
153
|
+
colItem.sortOrderExtra = true;
|
|
154
|
+
} else {
|
|
155
|
+
if (colItem.sortOrderExtra) {
|
|
156
|
+
delete colItem.sortOrder;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
141
159
|
// return Object.assign({ ellipsis: undefined, render: undefined }, { ...otherColumns, ...colItem }) // ellipsis要配置在render之前
|
|
160
|
+
// return { ...otherColumn, ...colItem }
|
|
142
161
|
return _objectSpread(_objectSpread({}, otherColumn), colItem);
|
|
143
162
|
});
|
|
144
163
|
resetColumns = hideOrderNumber ? recombinationColumns : resetColumns.concat(recombinationColumns);
|
|
@@ -184,6 +203,47 @@ var StandardTable = function StandardTable(props) {
|
|
|
184
203
|
filterReset: '重置',
|
|
185
204
|
emptyText: emptyText || '暂无数据'
|
|
186
205
|
}
|
|
187
|
-
}, rest
|
|
206
|
+
}, rest, {
|
|
207
|
+
// @ts-ignore
|
|
208
|
+
onChange: function onChange(pagination, filters, sorter, extra) {
|
|
209
|
+
var _rest$onChange;
|
|
210
|
+
var sorterParams = {}; // 取当前列表中有配置排序条件
|
|
211
|
+
// (columns || []).forEach((cItem: any) => {
|
|
212
|
+
// if (cItem.hasOwnProperty('sorter') && cItem.type !== 'action') {
|
|
213
|
+
// // 加这个赋值处理是为了避免sorter为空时,原url已经加上了排序值,但是未清空
|
|
214
|
+
// sorterParams[`${sortPrefixToUrl}${cItem?.key || cItem?.dataIndex}`] = undefined
|
|
215
|
+
// }
|
|
216
|
+
// })
|
|
217
|
+
var sorters = [];
|
|
218
|
+
if (Array.isArray(sorter)) {
|
|
219
|
+
// 多个条件
|
|
220
|
+
sorters = sorter.map(function (item) {
|
|
221
|
+
return _objectSpread({}, item);
|
|
222
|
+
});
|
|
223
|
+
} else if (JSON.stringify(sorter) !== '{}') {
|
|
224
|
+
// 单个条件
|
|
225
|
+
sorters.push(_objectSpread({}, sorter));
|
|
226
|
+
}
|
|
227
|
+
// 取当前字段的排序值
|
|
228
|
+
// let orders: any = {};
|
|
229
|
+
(sorters || []).forEach(function (item) {
|
|
230
|
+
sorterParams["".concat(item === null || item === void 0 ? void 0 : item.columnKey)] = item === null || item === void 0 ? void 0 : item.order;
|
|
231
|
+
// sorterParams[`${sortPrefixToUrl}${item?.columnKey}`] = item?.order
|
|
232
|
+
});
|
|
233
|
+
rest === null || rest === void 0 || (_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 || _rest$onChange.call(rest, _objectSpread(_objectSpread({}, pagination), {}, {
|
|
234
|
+
size: pagination.pageSize,
|
|
235
|
+
orders: sorters.map(function (item) {
|
|
236
|
+
return {
|
|
237
|
+
column: item.columnKey,
|
|
238
|
+
asc: item.order == 'ascend'
|
|
239
|
+
};
|
|
240
|
+
}),
|
|
241
|
+
// 对象
|
|
242
|
+
sorters: sorters,
|
|
243
|
+
// 数组
|
|
244
|
+
sorterParams: sorterParams // 对象
|
|
245
|
+
}), filters, sorter, extra);
|
|
246
|
+
}
|
|
247
|
+
}))));
|
|
188
248
|
};
|
|
189
|
-
export default StandardTable;
|
|
249
|
+
export default /*#__PURE__*/memo(StandardTable);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ButtonGroupOptionsProps } from "../ButtonGroup";
|
|
3
|
+
export interface StandardTableDataProps {
|
|
4
|
+
list?: object[];
|
|
5
|
+
pagination?: any;
|
|
6
|
+
}
|
|
7
|
+
export interface ExButtonGroupProps {
|
|
8
|
+
buttonGroup?: ButtonGroupOptionsProps[];
|
|
9
|
+
batchButtonGroup?: ButtonGroupOptionsProps[];
|
|
10
|
+
[k: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export interface StandardTableProps {
|
|
13
|
+
columns?: any[];
|
|
14
|
+
data: StandardTableDataProps;
|
|
15
|
+
rowKey?: string;
|
|
16
|
+
onChange?: (pageConfig?: any) => void;
|
|
17
|
+
hideOrderNumber?: boolean;
|
|
18
|
+
emptyText?: string;
|
|
19
|
+
codes?: object[];
|
|
20
|
+
permissionCodes?: string[];
|
|
21
|
+
className?: string;
|
|
22
|
+
rowSelection?: any;
|
|
23
|
+
orderNumber?: object;
|
|
24
|
+
columnsConfig?: object;
|
|
25
|
+
buttonGroup?: any[];
|
|
26
|
+
title?: React.ReactNode | string;
|
|
27
|
+
min?: number;
|
|
28
|
+
buttonGroupConfig?: any;
|
|
29
|
+
batchButtonGroup?: any[];
|
|
30
|
+
buttonGroupPlacement?: string | 'left' | 'right' | 'bottomLeft' | 'bottomRight';
|
|
31
|
+
sortOrders?: object;
|
|
32
|
+
[k: string]: any;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
declare const StandardTablePro: React.ForwardRefExoticComponent<React.RefAttributes<StandardTableProType>>;
|
|
2
|
+
import { StandardTableProType } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 复合表格:筛选+表格列表
|
|
5
|
+
* */
|
|
6
|
+
declare const StandardTablePro: React.ForwardRefExoticComponent<Omit<StandardTableProType, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
7
|
export default StandardTablePro;
|