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
|
@@ -12,6 +12,7 @@ var _ButtonGroup = _interopRequireDefault(require("../ButtonGroup/"));
|
|
|
12
12
|
var _data = require("../data/");
|
|
13
13
|
require("./style/index.less");
|
|
14
14
|
var _ConfigContext = require("../ConfigContext");
|
|
15
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
15
16
|
var _FilterStyle = _interopRequireDefault(require("./style/FilterStyle"));
|
|
16
17
|
var _SpecIcon = _interopRequireDefault(require("../SpecIcon"));
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -72,11 +73,18 @@ var StandardFilter = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
72
73
|
colon = _providerConfig$props10 === void 0 ? true : _providerConfig$props10,
|
|
73
74
|
dateFormatter = _providerConfig$props.dateFormatter,
|
|
74
75
|
_providerConfig$props11 = _providerConfig$props.collapseable,
|
|
75
|
-
collapseable = _providerConfig$props11 === void 0 ? false : _providerConfig$props11
|
|
76
|
+
collapseable = _providerConfig$props11 === void 0 ? false : _providerConfig$props11,
|
|
77
|
+
parseTransform = _providerConfig$props.parseTransform,
|
|
78
|
+
_providerConfig$props12 = _providerConfig$props.forceListener,
|
|
79
|
+
forceListener = _providerConfig$props12 === void 0 ? true : _providerConfig$props12;
|
|
76
80
|
var filterFormRef = (0, _react.useRef)();
|
|
77
81
|
// ref 的转发
|
|
78
82
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
79
|
-
return filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.current
|
|
83
|
+
return _objectSpread(_objectSpread({}, filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.current), {}, {
|
|
84
|
+
onSubmit: function onSubmit(values) {
|
|
85
|
+
return handleSearch(values);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
80
88
|
});
|
|
81
89
|
var _useState = (0, _react.useState)([]),
|
|
82
90
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -201,7 +209,8 @@ var StandardFilter = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
201
209
|
protoFormItem: {
|
|
202
210
|
style: {
|
|
203
211
|
textAlign: filterFormLayout === 'horizontal' ? 'right' : 'left'
|
|
204
|
-
}
|
|
212
|
+
},
|
|
213
|
+
className: filterFormLayout === 'horizontal' ? 'filter-action-right' : 'filter-action-left'
|
|
205
214
|
},
|
|
206
215
|
colSpan: filterButtonColSpan || 24 - calculateTimes * (24 / _data.general.modalSize[itemGroupSize].columnNumber)
|
|
207
216
|
}, filterButtonConfig), {}, {
|
|
@@ -247,27 +256,33 @@ var StandardFilter = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
247
256
|
resetValues[item] = undefined;
|
|
248
257
|
});
|
|
249
258
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
259
|
+
var dateFieldTypes = ['datePicker', 'dateTimePicker', 'rangePicker', 'rangeTimePicker', 'timePicker', 'timePickerRange'];
|
|
260
|
+
var filterDateFields = formItemGroup.filter(function (fItem) {
|
|
261
|
+
return dateFieldTypes.includes(fItem.type);
|
|
262
|
+
});
|
|
263
|
+
if (parseTransform) {
|
|
264
|
+
newVal = parseTransform(_objectSpread({}, newVal));
|
|
265
|
+
}
|
|
266
|
+
// 如果配置了dateFormatter='string',则将默认对其他进行格式转换
|
|
267
|
+
if (dateFormatter === 'string') {
|
|
268
|
+
// 需要将字符串转换成日期格式
|
|
269
|
+
filterDateFields.forEach(function (dItem) {
|
|
270
|
+
if (newVal[dItem.filedName || dItem.fieldName]) {
|
|
271
|
+
if (typeof newVal[dItem.filedName || dItem.fieldName] === 'string') {
|
|
272
|
+
// console.log('将字符串转换成dayjs')
|
|
273
|
+
newVal[dItem.filedName || dItem.fieldName] = (0, _dayjs.default)(newVal[dItem.filedName || dItem.fieldName]);
|
|
274
|
+
} else if (Array.isArray(newVal[dItem.filedName || dItem.fieldName])) {
|
|
275
|
+
// console.log('将数组转换成dayjs数组')
|
|
276
|
+
newVal[dItem.filedName || dItem.fieldName] = newVal[dItem.filedName || dItem.fieldName].map(function (valItem) {
|
|
277
|
+
return typeof valItem === 'string' ? (0, _dayjs.default)(valItem) : valItem;
|
|
278
|
+
});
|
|
279
|
+
} else {
|
|
280
|
+
// console.log('其他情况', newVal[dItem.filedName] instanceof Date)
|
|
281
|
+
// console.log('其他情况,当它是日期格式,则不进行转换')
|
|
268
282
|
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
271
286
|
filterFormRef.current.setFieldsValue(_objectSpread(_objectSpread({}, resetValues), newVal || {})); // 直接清空表单的赋值
|
|
272
287
|
forceUpdateForm();
|
|
273
288
|
};
|
|
@@ -284,7 +299,8 @@ var StandardFilter = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
284
299
|
if (Object.prototype.hasOwnProperty.call(values, false)) {
|
|
285
300
|
delete values.false; // 自定义结构会莫名的出来一个false字段
|
|
286
301
|
}
|
|
287
|
-
var resultValues =
|
|
302
|
+
var resultValues = (0, _utils.UtilValueFormat)(values, reFormItemGroup, dateFormatter);
|
|
303
|
+
// reFormItemGroup里面有 transform,则筛选转换
|
|
288
304
|
// console.log('格式化前数据', values)
|
|
289
305
|
// console.log('格式化后数据', resultValues)
|
|
290
306
|
if (onFilterSearch) {
|
|
@@ -367,11 +383,19 @@ var StandardFilter = /*#__PURE__*/_react.default.forwardRef(function (props, ref
|
|
|
367
383
|
}
|
|
368
384
|
}, [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()]);
|
|
369
385
|
(0, _react.useEffect)(function () {
|
|
370
|
-
if (
|
|
371
|
-
|
|
386
|
+
if (!forceListener) {
|
|
387
|
+
if (initialValues && JSON.stringify(initialValues) !== '{}') {
|
|
388
|
+
updateFormFields(initialValues, true);
|
|
389
|
+
}
|
|
372
390
|
}
|
|
373
|
-
}, [
|
|
374
|
-
|
|
391
|
+
}, []);
|
|
392
|
+
(0, _react.useEffect)(function () {
|
|
393
|
+
if (forceListener) {
|
|
394
|
+
if (initialValues && JSON.stringify(initialValues) !== '{}') {
|
|
395
|
+
updateFormFields(initialValues, true);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}, [forceListener, initialValues]);
|
|
375
399
|
// / 表单列表组 formItemGroup 类型为数组或者React.Node
|
|
376
400
|
var renderFormItemGroup = function renderFormItemGroup() {
|
|
377
401
|
if (Array.isArray(reFormItemGroup)) {
|
|
@@ -22,8 +22,9 @@ var StandardFilterStyleFunc = function StandardFilterStyleFunc(prefix) {
|
|
|
22
22
|
// backgroundColor: token.colorBgBase,
|
|
23
23
|
'.filter-form': {
|
|
24
24
|
'.ant-form-item-control, ant-form-item-label': {
|
|
25
|
-
lineHeight: token.controlHeight + 'px'
|
|
26
|
-
}
|
|
25
|
+
// lineHeight: token.controlHeight + 'px'// @input-height-base;
|
|
26
|
+
},
|
|
27
|
+
'.ant-btn .ant-btn-icon': {}
|
|
27
28
|
},
|
|
28
29
|
'.filter-form .ant-form-item': {
|
|
29
30
|
marginRight: token.paddingMD,
|
|
@@ -13,6 +13,7 @@ require("./style/index.less");
|
|
|
13
13
|
var _ActionList = _interopRequireDefault(require("./ActionList"));
|
|
14
14
|
var _index2 = _interopRequireDefault(require("./style/index"));
|
|
15
15
|
var _ConfigContext = require("../ConfigContext");
|
|
16
|
+
var _utils = require("../utils");
|
|
16
17
|
var _excluded = ["formItemGroup", "className", "initialValues", "layout", "grid", "getFormFields", "fieldStatus", "onSubmit", "confirmText", "onCancel", "cancelText", "confirmButtonProps", "cancelButtonProps", "actionAlign", "actionGroup", "onFinishFailed", "children", "prefix", "postfix", "fieldSize", "displayLayout", "itemGroupConfig"];
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -107,7 +108,8 @@ var StandardForm = /*#__PURE__*/_react.default.forwardRef(function (props, ref)
|
|
|
107
108
|
getFormFields && getFormFields(initForm && initForm.getFieldsValue() || {}, initForm);
|
|
108
109
|
};
|
|
109
110
|
var onFormFinish = function onFormFinish(values) {
|
|
110
|
-
|
|
111
|
+
var resultValues = (0, _utils.UtilValueFormat)(values, formItemGroup);
|
|
112
|
+
if (onSubmit) onSubmit(_objectSpread({}, resultValues));
|
|
111
113
|
};
|
|
112
114
|
var onFormFinishFailed = function onFormFinishFailed(_ref) {
|
|
113
115
|
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;
|
|
@@ -13,7 +13,7 @@ require("./style/index.less");
|
|
|
13
13
|
var _ConfigContext = require("../ConfigContext");
|
|
14
14
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
15
15
|
var _index3 = _interopRequireDefault(require("./style/index"));
|
|
16
|
-
var _excluded = ["data", "rowKey", "rowSelection", "columns", "hideOrderNumber", "orderNumber", "className", "emptyText", "codes", "permissionCodes", "columnsConfig", "title", "buttonGroup", "buttonGroupConfig", "min", "batchButtonGroup", "buttonGroupPlacement"];
|
|
16
|
+
var _excluded = ["data", "rowKey", "rowSelection", "columns", "hideOrderNumber", "orderNumber", "className", "emptyText", "codes", "permissionCodes", "columnsConfig", "title", "buttonGroup", "buttonGroupConfig", "min", "batchButtonGroup", "buttonGroupPlacement", "sortOrders"];
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -63,6 +63,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
63
63
|
batchButtonGroup = _providerConfig$props.batchButtonGroup,
|
|
64
64
|
_providerConfig$props5 = _providerConfig$props.buttonGroupPlacement,
|
|
65
65
|
buttonGroupPlacement = _providerConfig$props5 === void 0 ? 'right' : _providerConfig$props5,
|
|
66
|
+
sortOrders = _providerConfig$props.sortOrders,
|
|
66
67
|
rest = _objectWithoutProperties(_providerConfig$props, _excluded);
|
|
67
68
|
// 加上类型修复 TS:2322 报警
|
|
68
69
|
var resetColumns = [_objectSpread(_objectSpread({
|
|
@@ -86,7 +87,8 @@ var StandardTable = function StandardTable(props) {
|
|
|
86
87
|
pageSizeOptions: ['5', '10', '15', '20', '30', '50'],
|
|
87
88
|
showTotal: function showTotal(total, range) {
|
|
88
89
|
return "".concat(range[0], "-").concat(range[1], "\u6761 \u5171").concat(total, "\u6761");
|
|
89
|
-
}
|
|
90
|
+
},
|
|
91
|
+
pageSize: (pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || (pagination === null || pagination === void 0 ? void 0 : pagination.size)
|
|
90
92
|
}, pagination);
|
|
91
93
|
if (columns) {
|
|
92
94
|
var recombinationColumns = columns.map(function (colItem) {
|
|
@@ -144,10 +146,27 @@ var StandardTable = function StandardTable(props) {
|
|
|
144
146
|
colItem.render = function (text, record, rowIndex) {
|
|
145
147
|
return text || text === 0 ? text : '-';
|
|
146
148
|
};
|
|
149
|
+
if (sortOrders && (sortOrders.hasOwnProperty(colItem.key) || sortOrders.hasOwnProperty(colItem.dataIndex))) {
|
|
150
|
+
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;
|
|
151
|
+
colItem.sortOrderExtra = true;
|
|
152
|
+
} else {
|
|
153
|
+
if (colItem.sortOrderExtra) {
|
|
154
|
+
delete colItem.sortOrder;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
147
157
|
// return Object.assign({ ellipsis: undefined, render: undefined }, { ...otherColumns, ...colItem }); // ellipsis要配置在render之前
|
|
148
158
|
return _objectSpread(_objectSpread({}, otherColumn), colItem);
|
|
149
159
|
}
|
|
160
|
+
if (sortOrders && (sortOrders.hasOwnProperty(colItem.key) || sortOrders.hasOwnProperty(colItem.dataIndex))) {
|
|
161
|
+
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;
|
|
162
|
+
colItem.sortOrderExtra = true;
|
|
163
|
+
} else {
|
|
164
|
+
if (colItem.sortOrderExtra) {
|
|
165
|
+
delete colItem.sortOrder;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
150
168
|
// return Object.assign({ ellipsis: undefined, render: undefined }, { ...otherColumns, ...colItem }) // ellipsis要配置在render之前
|
|
169
|
+
// return { ...otherColumn, ...colItem }
|
|
151
170
|
return _objectSpread(_objectSpread({}, otherColumn), colItem);
|
|
152
171
|
});
|
|
153
172
|
resetColumns = hideOrderNumber ? recombinationColumns : resetColumns.concat(recombinationColumns);
|
|
@@ -193,6 +212,47 @@ var StandardTable = function StandardTable(props) {
|
|
|
193
212
|
filterReset: '重置',
|
|
194
213
|
emptyText: emptyText || '暂无数据'
|
|
195
214
|
}
|
|
196
|
-
}, rest
|
|
215
|
+
}, rest, {
|
|
216
|
+
// @ts-ignore
|
|
217
|
+
onChange: function onChange(pagination, filters, sorter, extra) {
|
|
218
|
+
var _rest$onChange;
|
|
219
|
+
var sorterParams = {}; // 取当前列表中有配置排序条件
|
|
220
|
+
// (columns || []).forEach((cItem: any) => {
|
|
221
|
+
// if (cItem.hasOwnProperty('sorter') && cItem.type !== 'action') {
|
|
222
|
+
// // 加这个赋值处理是为了避免sorter为空时,原url已经加上了排序值,但是未清空
|
|
223
|
+
// sorterParams[`${sortPrefixToUrl}${cItem?.key || cItem?.dataIndex}`] = undefined
|
|
224
|
+
// }
|
|
225
|
+
// })
|
|
226
|
+
var sorters = [];
|
|
227
|
+
if (Array.isArray(sorter)) {
|
|
228
|
+
// 多个条件
|
|
229
|
+
sorters = sorter.map(function (item) {
|
|
230
|
+
return _objectSpread({}, item);
|
|
231
|
+
});
|
|
232
|
+
} else if (JSON.stringify(sorter) !== '{}') {
|
|
233
|
+
// 单个条件
|
|
234
|
+
sorters.push(_objectSpread({}, sorter));
|
|
235
|
+
}
|
|
236
|
+
// 取当前字段的排序值
|
|
237
|
+
// let orders: any = {};
|
|
238
|
+
(sorters || []).forEach(function (item) {
|
|
239
|
+
sorterParams["".concat(item === null || item === void 0 ? void 0 : item.columnKey)] = item === null || item === void 0 ? void 0 : item.order;
|
|
240
|
+
// sorterParams[`${sortPrefixToUrl}${item?.columnKey}`] = item?.order
|
|
241
|
+
});
|
|
242
|
+
rest === null || rest === void 0 || (_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 || _rest$onChange.call(rest, _objectSpread(_objectSpread({}, pagination), {}, {
|
|
243
|
+
size: pagination.pageSize,
|
|
244
|
+
orders: sorters.map(function (item) {
|
|
245
|
+
return {
|
|
246
|
+
column: item.columnKey,
|
|
247
|
+
asc: item.order == 'ascend'
|
|
248
|
+
};
|
|
249
|
+
}),
|
|
250
|
+
// 对象
|
|
251
|
+
sorters: sorters,
|
|
252
|
+
// 数组
|
|
253
|
+
sorterParams: sorterParams // 对象
|
|
254
|
+
}), filters, sorter, extra);
|
|
255
|
+
}
|
|
256
|
+
}))));
|
|
197
257
|
};
|
|
198
|
-
var _default = exports.default = StandardTable;
|
|
258
|
+
var _default = exports.default = /*#__PURE__*/(0, _react.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
|
+
}
|
|
@@ -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;
|