@fle-ui/plus-table 1.2.28-beta.1 → 1.2.29
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/{FormSearch → components/FormSearch}/FormRender.d.ts +1 -1
- package/es/{FormSearch → components/FormSearch}/FormRender.js +1 -2
- package/es/{FormSearch → components/FormSearch}/index.js +0 -8
- package/es/{FormSearch → components/FormSearch}/index.less +0 -3
- package/es/index.d.ts +4 -3
- package/es/index.js +425 -345
- package/es/mock/list.json +720 -0
- package/es/utils/common.d.ts +0 -10
- package/es/utils/common.js +0 -5
- package/lib/{FormSearch → components/FormSearch}/FormRender.d.ts +1 -1
- package/lib/{FormSearch → components/FormSearch}/FormRender.js +3 -4
- package/lib/{FormSearch → components/FormSearch}/index.js +0 -8
- package/lib/{FormSearch → components/FormSearch}/index.less +0 -3
- package/lib/index.d.ts +4 -3
- package/lib/index.js +422 -344
- package/lib/mock/list.json +720 -0
- package/lib/utils/common.d.ts +0 -10
- package/lib/utils/common.js +1 -7
- package/package.json +6 -6
- package/es/components/icon/index.d.ts +0 -3
- package/es/components/icon/index.js +0 -7
- package/es/json/columnKeys.d.ts +0 -15
- package/es/json/columnKeys.js +0 -182
- package/es/json/list.d.ts +0 -1365
- package/es/json/list.js +0 -1388
- package/lib/components/icon/index.d.ts +0 -3
- package/lib/components/icon/index.js +0 -13
- package/lib/json/columnKeys.d.ts +0 -15
- package/lib/json/columnKeys.js +0 -188
- package/lib/json/list.d.ts +0 -1365
- package/lib/json/list.js +0 -1394
- /package/es/{FormSearch → components/FormSearch}/index.d.ts +0 -0
- /package/lib/{FormSearch → components/FormSearch}/index.d.ts +0 -0
package/lib/index.js
CHANGED
|
@@ -7,11 +7,11 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _proComponents = require("@ant-design/pro-components");
|
|
9
9
|
var _antd = require("antd");
|
|
10
|
-
var _index = _interopRequireDefault(require("./FormSearch/index"));
|
|
10
|
+
var _index = _interopRequireDefault(require("./components/FormSearch/index"));
|
|
11
11
|
var _icons = require("@ant-design/icons");
|
|
12
12
|
var _common = require("./utils/common");
|
|
13
|
-
require("./FormSearch/index.less");
|
|
14
|
-
var _excluded = ["columns", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState", "options", "action", "showDefaultSetting"];
|
|
13
|
+
require("./components/FormSearch/index.less");
|
|
14
|
+
var _excluded = ["columns", "hasShowFull", "request", "pagination", "formRef", "actionRef", "defaultColumnsState", "options", "action", "search", "showDefaultSetting"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
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); }
|
|
17
17
|
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 && {}.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; }
|
|
@@ -33,8 +33,22 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
33
33
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
34
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
35
35
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
36
|
+
// 常量定义
|
|
37
|
+
var CONSTANTS = {
|
|
38
|
+
DRAWER_WIDTH: 380,
|
|
39
|
+
DEFAULT_TOP: 92,
|
|
40
|
+
RELOAD_DELAY: 100,
|
|
41
|
+
SEARCH_SPAN: {
|
|
42
|
+
xs: 12,
|
|
43
|
+
sm: 12,
|
|
44
|
+
md: 12,
|
|
45
|
+
lg: 12,
|
|
46
|
+
xl: 8,
|
|
47
|
+
xxl: 6
|
|
48
|
+
},
|
|
49
|
+
LABEL_WIDTH: 80
|
|
50
|
+
};
|
|
36
51
|
function PlusTable(props, ref) {
|
|
37
|
-
var _otherProps$scroll;
|
|
38
52
|
var columns = props.columns,
|
|
39
53
|
_props$hasShowFull = props.hasShowFull,
|
|
40
54
|
hasShowFull = _props$hasShowFull === void 0 ? true : _props$hasShowFull,
|
|
@@ -46,6 +60,7 @@ function PlusTable(props, ref) {
|
|
|
46
60
|
_props$options = props.options,
|
|
47
61
|
options = _props$options === void 0 ? {} : _props$options,
|
|
48
62
|
action = props.action,
|
|
63
|
+
search = props.search,
|
|
49
64
|
_props$showDefaultSet = props.showDefaultSetting,
|
|
50
65
|
showDefaultSetting = _props$showDefaultSet === void 0 ? true : _props$showDefaultSet,
|
|
51
66
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
@@ -54,7 +69,7 @@ function PlusTable(props, ref) {
|
|
|
54
69
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
70
|
searchDrawer = _useState2[0],
|
|
56
71
|
setSearchDrawer = _useState2[1];
|
|
57
|
-
var _useState3 = (0, _react.useState)(false),
|
|
72
|
+
var _useState3 = (0, _react.useState)(props.defaultShowFull || false),
|
|
58
73
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
74
|
showFull = _useState4[0],
|
|
60
75
|
setShowFull = _useState4[1];
|
|
@@ -63,305 +78,401 @@ function PlusTable(props, ref) {
|
|
|
63
78
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
64
79
|
columnsStateMap = _useState6[0],
|
|
65
80
|
setColumnsStateMap = _useState6[1];
|
|
81
|
+
var _useState7 = (0, _react.useState)(false),
|
|
82
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
83
|
+
isLoading = _useState8[0],
|
|
84
|
+
setIsLoading = _useState8[1];
|
|
66
85
|
var actionRef = (0, _react.useRef)();
|
|
67
86
|
(0, _react.useImperativeHandle)(propsActionRef, function () {
|
|
68
87
|
return actionRef.current;
|
|
69
88
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}));
|
|
97
|
-
function getFieldsValue() {
|
|
98
|
-
return _getFieldsValue.apply(this, arguments);
|
|
99
|
-
}
|
|
100
|
-
return getFieldsValue;
|
|
101
|
-
}(),
|
|
102
|
-
setFiledsValue: function () {
|
|
103
|
-
var _setFiledsValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
104
|
-
var _searchRef$current2, _drawFormRef$current2;
|
|
105
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
106
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
107
|
-
case 0:
|
|
108
|
-
_context2.next = 2;
|
|
109
|
-
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current2 = searchRef.current) === null || _searchRef$current2 === void 0 ? void 0 : _searchRef$current2.setFieldsValue(params);
|
|
110
|
-
case 2:
|
|
111
|
-
_context2.next = 4;
|
|
112
|
-
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current2 = drawFormRef.current) === null || _drawFormRef$current2 === void 0 ? void 0 : _drawFormRef$current2.setFieldsValue(params);
|
|
113
|
-
case 4:
|
|
114
|
-
case "end":
|
|
115
|
-
return _context2.stop();
|
|
116
|
-
}
|
|
117
|
-
}, _callee2);
|
|
118
|
-
}));
|
|
119
|
-
function setFiledsValue(_x) {
|
|
120
|
-
return _setFiledsValue.apply(this, arguments);
|
|
121
|
-
}
|
|
122
|
-
return setFiledsValue;
|
|
123
|
-
}(),
|
|
124
|
-
setFiledValue: function () {
|
|
125
|
-
var _setFiledValue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
|
|
126
|
-
var _searchRef$current3, _drawFormRef$current3;
|
|
127
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
128
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
129
|
-
case 0:
|
|
130
|
-
_context3.next = 2;
|
|
131
|
-
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current3 = searchRef.current) === null || _searchRef$current3 === void 0 ? void 0 : _searchRef$current3.setFieldValue(key, value);
|
|
132
|
-
case 2:
|
|
133
|
-
_context3.next = 4;
|
|
134
|
-
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current3 = drawFormRef.current) === null || _drawFormRef$current3 === void 0 ? void 0 : _drawFormRef$current3.setFieldValue(key, value);
|
|
135
|
-
case 4:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context3.stop();
|
|
138
|
-
}
|
|
139
|
-
}, _callee3);
|
|
140
|
-
}));
|
|
141
|
-
function setFiledValue(_x2, _x3) {
|
|
142
|
-
return _setFiledValue.apply(this, arguments);
|
|
143
|
-
}
|
|
144
|
-
return setFiledValue;
|
|
145
|
-
}()
|
|
146
|
-
};
|
|
147
|
-
});
|
|
148
|
-
var handleOnChangeColumn = function handleOnChangeColumn(map) {
|
|
149
|
-
// 列设置更新
|
|
150
|
-
setColumnsStateMap(function (columnsStateMap) {
|
|
151
|
-
var newObj = {};
|
|
152
|
-
for (var key in map) {
|
|
153
|
-
newObj[key] = _objectSpread(_objectSpread({}, columnsStateMap[key]), map[key]);
|
|
89
|
+
// 优化:使用 useCallback 避免重复创建函数
|
|
90
|
+
var getFieldsValue = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
91
|
+
var _searchRef$current, _drawFormRef$current, res1, res2;
|
|
92
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
93
|
+
while (1) switch (_context.prev = _context.next) {
|
|
94
|
+
case 0:
|
|
95
|
+
_context.prev = 0;
|
|
96
|
+
_context.next = 3;
|
|
97
|
+
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.getFieldsValue();
|
|
98
|
+
case 3:
|
|
99
|
+
res1 = _context.sent;
|
|
100
|
+
_context.next = 6;
|
|
101
|
+
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current = drawFormRef.current) === null || _drawFormRef$current === void 0 ? void 0 : _drawFormRef$current.getFieldsValue();
|
|
102
|
+
case 6:
|
|
103
|
+
res2 = _context.sent;
|
|
104
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, dealFetchParams(_objectSpread(_objectSpread({}, res1), res2))), {}, {
|
|
105
|
+
showFull: showFull
|
|
106
|
+
}));
|
|
107
|
+
case 10:
|
|
108
|
+
_context.prev = 10;
|
|
109
|
+
_context.t0 = _context["catch"](0);
|
|
110
|
+
console.error('获取字段值失败:', _context.t0);
|
|
111
|
+
return _context.abrupt("return", {});
|
|
112
|
+
case 14:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context.stop();
|
|
154
115
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return _regeneratorRuntime().wrap(function
|
|
161
|
-
while (1) switch (
|
|
116
|
+
}, _callee, null, [[0, 10]]);
|
|
117
|
+
})), [showFull]);
|
|
118
|
+
var setFiledsValue = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
119
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
|
|
120
|
+
var _searchRef$current2, _drawFormRef$current2;
|
|
121
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
122
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
162
123
|
case 0:
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
_context4.next = 3;
|
|
168
|
-
return props.updateSetting(columnsStateMap);
|
|
124
|
+
_context2.prev = 0;
|
|
125
|
+
_context2.next = 3;
|
|
126
|
+
return Promise.all([searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current2 = searchRef.current) === null || _searchRef$current2 === void 0 ? void 0 : _searchRef$current2.setFieldsValue(params), drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current2 = drawFormRef.current) === null || _drawFormRef$current2 === void 0 ? void 0 : _drawFormRef$current2.setFieldsValue(params)]);
|
|
169
127
|
case 3:
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
case
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return function handleSave() {
|
|
178
|
-
return _ref.apply(this, arguments);
|
|
179
|
-
};
|
|
180
|
-
}();
|
|
181
|
-
var handleReset = /*#__PURE__*/function () {
|
|
182
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
183
|
-
var _props$resetSetting;
|
|
184
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
185
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
186
|
-
case 0:
|
|
187
|
-
return _context5.abrupt("return", (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props).then(function (res) {
|
|
188
|
-
res.success && init();
|
|
189
|
-
}));
|
|
190
|
-
case 1:
|
|
128
|
+
_context2.next = 8;
|
|
129
|
+
break;
|
|
130
|
+
case 5:
|
|
131
|
+
_context2.prev = 5;
|
|
132
|
+
_context2.t0 = _context2["catch"](0);
|
|
133
|
+
console.error('设置字段值失败:', _context2.t0);
|
|
134
|
+
case 8:
|
|
191
135
|
case "end":
|
|
192
|
-
return
|
|
136
|
+
return _context2.stop();
|
|
193
137
|
}
|
|
194
|
-
},
|
|
138
|
+
}, _callee2, null, [[0, 5]]);
|
|
195
139
|
}));
|
|
196
|
-
return function
|
|
140
|
+
return function (_x) {
|
|
197
141
|
return _ref2.apply(this, arguments);
|
|
198
142
|
};
|
|
199
|
-
}();
|
|
200
|
-
var
|
|
201
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
202
|
-
var
|
|
203
|
-
return _regeneratorRuntime().wrap(function
|
|
204
|
-
while (1) switch (
|
|
143
|
+
}(), []);
|
|
144
|
+
var setFiledValue = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
145
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(key, value) {
|
|
146
|
+
var _searchRef$current3, _drawFormRef$current3;
|
|
147
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
148
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
205
149
|
case 0:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
_context6.next = 3;
|
|
211
|
-
return (_props$fetchSetting = props.fetchSetting) === null || _props$fetchSetting === void 0 ? void 0 : _props$fetchSetting.call(props);
|
|
150
|
+
_context3.prev = 0;
|
|
151
|
+
_context3.next = 3;
|
|
152
|
+
return Promise.all([searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current3 = searchRef.current) === null || _searchRef$current3 === void 0 ? void 0 : _searchRef$current3.setFieldValue(key, value), drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current3 = drawFormRef.current) === null || _drawFormRef$current3 === void 0 ? void 0 : _drawFormRef$current3.setFieldValue(key, value)]);
|
|
212
153
|
case 3:
|
|
213
|
-
|
|
214
|
-
|
|
154
|
+
_context3.next = 8;
|
|
155
|
+
break;
|
|
215
156
|
case 5:
|
|
157
|
+
_context3.prev = 5;
|
|
158
|
+
_context3.t0 = _context3["catch"](0);
|
|
159
|
+
console.error('设置字段值失败:', _context3.t0);
|
|
160
|
+
case 8:
|
|
216
161
|
case "end":
|
|
217
|
-
return
|
|
162
|
+
return _context3.stop();
|
|
218
163
|
}
|
|
219
|
-
},
|
|
164
|
+
}, _callee3, null, [[0, 5]]);
|
|
220
165
|
}));
|
|
221
|
-
return function
|
|
166
|
+
return function (_x2, _x3) {
|
|
222
167
|
return _ref3.apply(this, arguments);
|
|
223
168
|
};
|
|
224
|
-
}();
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
169
|
+
}(), []);
|
|
170
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
171
|
+
return {
|
|
172
|
+
getFieldsValue: getFieldsValue,
|
|
173
|
+
setFiledsValue: setFiledsValue,
|
|
174
|
+
setFiledValue: setFiledValue
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
// 优化:使用 useCallback 避免重复创建函数
|
|
178
|
+
var handleOnChangeColumn = (0, _react.useCallback)(function (map) {
|
|
179
|
+
setColumnsStateMap(function (prevState) {
|
|
180
|
+
var newObj = {};
|
|
181
|
+
for (var key in map) {
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(map, key)) {
|
|
183
|
+
newObj[key] = _objectSpread(_objectSpread({}, prevState[key]), map[key]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return newObj;
|
|
187
|
+
});
|
|
188
|
+
}, []);
|
|
189
|
+
var handleSave = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
190
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
191
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
192
|
+
case 0:
|
|
193
|
+
if (!props.updateSetting) {
|
|
194
|
+
_context4.next = 14;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
_context4.prev = 1;
|
|
198
|
+
setIsLoading(true);
|
|
199
|
+
_context4.next = 5;
|
|
200
|
+
return props.updateSetting(columnsStateMap);
|
|
201
|
+
case 5:
|
|
202
|
+
(0, _common.simulateClick)();
|
|
203
|
+
_context4.next = 11;
|
|
204
|
+
break;
|
|
205
|
+
case 8:
|
|
206
|
+
_context4.prev = 8;
|
|
207
|
+
_context4.t0 = _context4["catch"](1);
|
|
208
|
+
console.error('保存列设置失败:', _context4.t0);
|
|
209
|
+
case 11:
|
|
210
|
+
_context4.prev = 11;
|
|
211
|
+
setIsLoading(false);
|
|
212
|
+
return _context4.finish(11);
|
|
213
|
+
case 14:
|
|
214
|
+
case "end":
|
|
215
|
+
return _context4.stop();
|
|
216
|
+
}
|
|
217
|
+
}, _callee4, null, [[1, 8, 11, 14]]);
|
|
218
|
+
})), [props.updateSetting, columnsStateMap]);
|
|
219
|
+
var handleReset = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
220
|
+
var _props$resetSetting, res, fetchRes;
|
|
221
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
222
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
223
|
+
case 0:
|
|
224
|
+
_context5.prev = 0;
|
|
225
|
+
_context5.next = 3;
|
|
226
|
+
return (_props$resetSetting = props.resetSetting) === null || _props$resetSetting === void 0 ? void 0 : _props$resetSetting.call(props);
|
|
227
|
+
case 3:
|
|
228
|
+
res = _context5.sent;
|
|
229
|
+
if (!((res === null || res === void 0 ? void 0 : res.success) && props.fetchSetting)) {
|
|
230
|
+
_context5.next = 9;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
_context5.next = 7;
|
|
234
|
+
return props.fetchSetting();
|
|
235
|
+
case 7:
|
|
236
|
+
fetchRes = _context5.sent;
|
|
237
|
+
setColumnsStateMap(fetchRes);
|
|
238
|
+
case 9:
|
|
239
|
+
_context5.next = 14;
|
|
240
|
+
break;
|
|
241
|
+
case 11:
|
|
242
|
+
_context5.prev = 11;
|
|
243
|
+
_context5.t0 = _context5["catch"](0);
|
|
244
|
+
console.error('重置列设置失败:', _context5.t0);
|
|
245
|
+
case 14:
|
|
246
|
+
case "end":
|
|
247
|
+
return _context5.stop();
|
|
248
|
+
}
|
|
249
|
+
}, _callee5, null, [[0, 11]]);
|
|
250
|
+
})), [props.resetSetting, props.fetchSetting]);
|
|
251
|
+
var onValuesChange = (0, _react.useCallback)(function (changeValue, allValue) {
|
|
252
|
+
try {
|
|
253
|
+
var _drawFormRef$current4;
|
|
254
|
+
var currentValues = (_drawFormRef$current4 = drawFormRef.current) === null || _drawFormRef$current4 === void 0 ? void 0 : _drawFormRef$current4.getFieldsValue();
|
|
255
|
+
if (currentValues) {
|
|
256
|
+
var _searchRef$current4;
|
|
257
|
+
searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current4 = searchRef.current) === null || _searchRef$current4 === void 0 ? void 0 : _searchRef$current4.setFieldsValue(currentValues);
|
|
258
|
+
}
|
|
259
|
+
} catch (error) {
|
|
260
|
+
console.error('同步表单值失败:', error);
|
|
261
|
+
}
|
|
262
|
+
}, []);
|
|
263
|
+
var handleSearchAll = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
264
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(searchConfig) {
|
|
265
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
266
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
234
267
|
case 0:
|
|
235
|
-
|
|
268
|
+
try {
|
|
269
|
+
searchConfig.form.submit();
|
|
270
|
+
} catch (error) {
|
|
271
|
+
console.error('搜索失败:', error);
|
|
272
|
+
}
|
|
236
273
|
case 1:
|
|
237
274
|
case "end":
|
|
238
|
-
return
|
|
275
|
+
return _context6.stop();
|
|
239
276
|
}
|
|
240
|
-
},
|
|
277
|
+
}, _callee6);
|
|
241
278
|
}));
|
|
242
|
-
return function
|
|
243
|
-
return
|
|
279
|
+
return function (_x4) {
|
|
280
|
+
return _ref6.apply(this, arguments);
|
|
244
281
|
};
|
|
245
|
-
}();
|
|
246
|
-
(0, _react.
|
|
247
|
-
|
|
282
|
+
}(), []);
|
|
283
|
+
var handleShowFullChange = (0, _react.useCallback)(function (e) {
|
|
284
|
+
setShowFull(e.target.checked);
|
|
285
|
+
// 优化:使用 requestAnimationFrame 替代 setTimeout
|
|
286
|
+
requestAnimationFrame(function () {
|
|
287
|
+
var _actionRef$current, _actionRef$current$re;
|
|
288
|
+
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.reload) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
|
|
289
|
+
});
|
|
248
290
|
}, []);
|
|
249
|
-
var
|
|
250
|
-
|
|
291
|
+
var handleAdvancedFilterClick = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
292
|
+
var newDrawerState, _searchRef$current5, _drawFormRef$current5, fieldsValue;
|
|
293
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
294
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
295
|
+
case 0:
|
|
296
|
+
_context7.prev = 0;
|
|
297
|
+
newDrawerState = !searchDrawer;
|
|
298
|
+
setSearchDrawer(newDrawerState);
|
|
299
|
+
if (!newDrawerState) {
|
|
300
|
+
_context7.next = 8;
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
_context7.next = 6;
|
|
304
|
+
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current5 = searchRef.current) === null || _searchRef$current5 === void 0 ? void 0 : _searchRef$current5.getFieldsValue();
|
|
305
|
+
case 6:
|
|
306
|
+
fieldsValue = _context7.sent;
|
|
307
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current5 = drawFormRef.current) === null || _drawFormRef$current5 === void 0 ? void 0 : _drawFormRef$current5.setFieldsValue(fieldsValue);
|
|
308
|
+
case 8:
|
|
309
|
+
_context7.next = 13;
|
|
310
|
+
break;
|
|
311
|
+
case 10:
|
|
312
|
+
_context7.prev = 10;
|
|
313
|
+
_context7.t0 = _context7["catch"](0);
|
|
314
|
+
console.error('切换高级筛选失败:', _context7.t0);
|
|
315
|
+
case 13:
|
|
316
|
+
case "end":
|
|
317
|
+
return _context7.stop();
|
|
318
|
+
}
|
|
319
|
+
}, _callee7, null, [[0, 10]]);
|
|
320
|
+
})), [searchDrawer]);
|
|
321
|
+
var handleResetForm = (0, _react.useCallback)(function () {
|
|
322
|
+
try {
|
|
323
|
+
var _drawFormRef$current6, _actionRef$current2, _actionRef$current2$r, _actionRef$current3, _actionRef$current3$r;
|
|
324
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current6 = drawFormRef.current) === null || _drawFormRef$current6 === void 0 ? void 0 : _drawFormRef$current6.resetFields();
|
|
325
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.reset) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
|
|
326
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$r = _actionRef$current3.reload) === null || _actionRef$current3$r === void 0 ? void 0 : _actionRef$current3$r.call(_actionRef$current3);
|
|
327
|
+
} catch (error) {
|
|
328
|
+
console.error('重置表单失败:', error);
|
|
329
|
+
}
|
|
330
|
+
}, []);
|
|
331
|
+
// 修复死循环:只在组件挂载时执行一次,不依赖 init 函数
|
|
332
|
+
(0, _react.useEffect)(function () {
|
|
333
|
+
// 组件挂载时执行一次初始化
|
|
334
|
+
if (props.fetchSetting) {
|
|
335
|
+
props.fetchSetting().then(function (res) {
|
|
336
|
+
setColumnsStateMap(res);
|
|
337
|
+
}).catch(function (error) {
|
|
338
|
+
console.error('获取列设置失败:', error);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}, []); // 空依赖数组,只在挂载时执行一次
|
|
342
|
+
// 优化:使用 useMemo 缓存计算结果
|
|
343
|
+
var dealFetchParams = (0, _react.useCallback)(function (params) {
|
|
251
344
|
var fetchParams = {};
|
|
252
345
|
columns.forEach(function (item) {
|
|
253
|
-
var
|
|
254
|
-
if ((item === null || item === void 0 ? void 0 :
|
|
255
|
-
|
|
346
|
+
var dataIndex = item.dataIndex;
|
|
347
|
+
if ((item === null || item === void 0 ? void 0 : item.search) && _typeof(item.search) === 'object' && item.search.transform && params[dataIndex]) {
|
|
348
|
+
var transformResult = item.search.transform(params[dataIndex], dataIndex, params);
|
|
349
|
+
if (transformResult && _typeof(transformResult) === 'object') {
|
|
350
|
+
Object.assign(fetchParams, transformResult);
|
|
351
|
+
}
|
|
256
352
|
} else {
|
|
257
|
-
fetchParams =
|
|
353
|
+
fetchParams[dataIndex] = params[dataIndex];
|
|
258
354
|
}
|
|
259
355
|
});
|
|
260
356
|
return fetchParams;
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
357
|
+
}, [columns]);
|
|
358
|
+
// 优化:使用 useMemo 缓存列状态配置
|
|
359
|
+
var columnsState = (0, _react.useMemo)(function () {
|
|
360
|
+
return {
|
|
361
|
+
defaultValue: defaultColumnsState,
|
|
362
|
+
value: columnsStateMap,
|
|
363
|
+
onChange: handleOnChangeColumn
|
|
364
|
+
};
|
|
365
|
+
}, [defaultColumnsState, columnsStateMap, handleOnChangeColumn]);
|
|
366
|
+
// 优化:使用 useCallback 缓存请求函数
|
|
367
|
+
var propsRequest = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
368
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(params, sort, filter) {
|
|
369
|
+
var _searchRef$current6, _drawFormRef$current7, res1, res2;
|
|
272
370
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
273
371
|
while (1) switch (_context8.prev = _context8.next) {
|
|
274
372
|
case 0:
|
|
275
|
-
_context8.
|
|
276
|
-
|
|
277
|
-
|
|
373
|
+
_context8.prev = 0;
|
|
374
|
+
_context8.next = 3;
|
|
375
|
+
return searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current6 = searchRef.current) === null || _searchRef$current6 === void 0 ? void 0 : _searchRef$current6.getFieldsValue();
|
|
376
|
+
case 3:
|
|
278
377
|
res1 = _context8.sent;
|
|
279
|
-
_context8.next =
|
|
280
|
-
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$
|
|
281
|
-
case
|
|
378
|
+
_context8.next = 6;
|
|
379
|
+
return drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.getFieldsValue();
|
|
380
|
+
case 6:
|
|
282
381
|
res2 = _context8.sent;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (!res2[key]) {
|
|
286
|
-
res1[key] = undefined;
|
|
287
|
-
params[key] = undefined;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
if (!request) {
|
|
292
|
-
_context8.next = 13;
|
|
382
|
+
if (request) {
|
|
383
|
+
_context8.next = 9;
|
|
293
384
|
break;
|
|
294
385
|
}
|
|
295
|
-
_context8.
|
|
386
|
+
return _context8.abrupt("return", {});
|
|
387
|
+
case 9:
|
|
388
|
+
_context8.next = 11;
|
|
296
389
|
return request(_objectSpread(_objectSpread(_objectSpread({}, params), dealFetchParams(_objectSpread(_objectSpread(_objectSpread({}, res1), res2), params))), {}, {
|
|
297
390
|
showFull: showFull
|
|
298
391
|
}), sort, filter);
|
|
299
|
-
case
|
|
300
|
-
_context8.
|
|
301
|
-
_context8.next = 14;
|
|
302
|
-
break;
|
|
303
|
-
case 13:
|
|
304
|
-
_context8.t0 = {};
|
|
392
|
+
case 11:
|
|
393
|
+
return _context8.abrupt("return", _context8.sent);
|
|
305
394
|
case 14:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
395
|
+
_context8.prev = 14;
|
|
396
|
+
_context8.t0 = _context8["catch"](0);
|
|
397
|
+
console.error('请求数据失败:', _context8.t0);
|
|
398
|
+
return _context8.abrupt("return", {});
|
|
399
|
+
case 18:
|
|
309
400
|
case "end":
|
|
310
401
|
return _context8.stop();
|
|
311
402
|
}
|
|
312
|
-
}, _callee8);
|
|
403
|
+
}, _callee8, null, [[0, 14]]);
|
|
313
404
|
}));
|
|
314
|
-
return function
|
|
315
|
-
return
|
|
405
|
+
return function (_x5, _x6, _x7) {
|
|
406
|
+
return _ref8.apply(this, arguments);
|
|
316
407
|
};
|
|
317
|
-
}();
|
|
318
|
-
|
|
319
|
-
var __options = (
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
408
|
+
}(), [request, dealFetchParams, showFull]);
|
|
409
|
+
// 优化:使用 useMemo 缓存选项配置
|
|
410
|
+
var __options = (0, _react.useMemo)(function () {
|
|
411
|
+
var optionsSetting = _typeof(options) === 'object' && _typeof(options.setting) === 'object' ? options.setting : {};
|
|
412
|
+
console.log(action === null || action === void 0 ? void 0 : action.includes('columnSetting'), showDefaultSetting !== true);
|
|
413
|
+
if ((action === null || action === void 0 ? void 0 : action.includes('columnSetting')) && showDefaultSetting !== true) {
|
|
414
|
+
return _objectSpread(_objectSpread({}, options), {}, {
|
|
415
|
+
setting: _objectSpread(_objectSpread({}, optionsSetting), {}, {
|
|
416
|
+
checkedReset: false,
|
|
417
|
+
showListItemOption: true,
|
|
418
|
+
extra: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
419
|
+
onClick: handleSave,
|
|
420
|
+
style: {
|
|
421
|
+
cursor: isLoading ? 'not-allowed' : 'pointer',
|
|
422
|
+
opacity: isLoading ? 0.6 : 1,
|
|
423
|
+
pointerEvents: isLoading ? 'none' : 'auto'
|
|
424
|
+
}
|
|
425
|
+
}, isLoading ? '保存中...' : '保存'), /*#__PURE__*/_react.default.createElement("a", {
|
|
426
|
+
style: {
|
|
427
|
+
color: '#333'
|
|
428
|
+
},
|
|
429
|
+
onClick: handleReset
|
|
430
|
+
}, "\u91CD\u7F6E"))
|
|
431
|
+
})
|
|
432
|
+
});
|
|
342
433
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
434
|
+
return options;
|
|
435
|
+
}, [options, action, showDefaultSetting, handleSave, handleReset, isLoading]);
|
|
436
|
+
// 优化:使用 useMemo 缓存列配置
|
|
437
|
+
var processedColumns = (0, _react.useMemo)(function () {
|
|
438
|
+
if (!(action === null || action === void 0 ? void 0 : action.includes('advancedFilter'))) {
|
|
439
|
+
return columns;
|
|
440
|
+
}
|
|
441
|
+
return columns.map(function (item) {
|
|
442
|
+
if (item.baseSearch) {
|
|
443
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
444
|
+
search: item.search,
|
|
445
|
+
fieldProps: _objectSpread({
|
|
446
|
+
onChange: function onChange(e) {
|
|
447
|
+
try {
|
|
448
|
+
if (e) {
|
|
449
|
+
var _drawFormRef$current8;
|
|
450
|
+
var value = e.target ? e.target.value : e;
|
|
451
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current8 = drawFormRef.current) === null || _drawFormRef$current8 === void 0 ? void 0 : _drawFormRef$current8.setFieldsValue(_defineProperty({}, item.dataIndex, value));
|
|
452
|
+
} else {
|
|
453
|
+
var _drawFormRef$current10;
|
|
454
|
+
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields([item.dataIndex]);
|
|
455
|
+
}
|
|
456
|
+
} catch (error) {
|
|
457
|
+
console.error('字段值变更处理失败:', error);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}, item.fieldProps)
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
464
|
+
search: false
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
}, [columns, action]);
|
|
468
|
+
// 优化:使用 useMemo 缓存搜索配置
|
|
469
|
+
var searchConfig = (0, _react.useMemo)(function () {
|
|
470
|
+
if (!(action === null || action === void 0 ? void 0 : action.includes('advancedFilter'))) {
|
|
471
|
+
return props.search;
|
|
472
|
+
}
|
|
473
|
+
return _objectSpread(_objectSpread({}, search), {}, {
|
|
474
|
+
span: CONSTANTS.SEARCH_SPAN,
|
|
475
|
+
labelWidth: CONSTANTS.LABEL_WIDTH,
|
|
365
476
|
collapseRender: function collapseRender() {
|
|
366
477
|
return null;
|
|
367
478
|
},
|
|
@@ -371,17 +482,12 @@ function PlusTable(props, ref) {
|
|
|
371
482
|
size: "middle",
|
|
372
483
|
type: "primary",
|
|
373
484
|
onClick: function onClick() {
|
|
374
|
-
handleSearchAll(searchConfig);
|
|
485
|
+
return handleSearchAll(searchConfig);
|
|
375
486
|
}
|
|
376
487
|
}, "\u67E5\u8BE2"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
377
488
|
key: "2",
|
|
378
489
|
type: "default",
|
|
379
|
-
onClick:
|
|
380
|
-
var _drawFormRef$current6, _actionRef$current, _actionRef$current$re, _actionRef$current2, _actionRef$current2$r;
|
|
381
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current6 = drawFormRef.current) === null || _drawFormRef$current6 === void 0 ? void 0 : _drawFormRef$current6.resetFields();
|
|
382
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$re = _actionRef$current.reset) === null || _actionRef$current$re === void 0 ? void 0 : _actionRef$current$re.call(_actionRef$current);
|
|
383
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$r = _actionRef$current2.reload) === null || _actionRef$current2$r === void 0 ? void 0 : _actionRef$current2$r.call(_actionRef$current2);
|
|
384
|
-
},
|
|
490
|
+
onClick: handleResetForm,
|
|
385
491
|
size: "middle"
|
|
386
492
|
}, "\u91CD\u7F6E"), /*#__PURE__*/_react.default.createElement("a", {
|
|
387
493
|
key: "3",
|
|
@@ -389,74 +495,63 @@ function PlusTable(props, ref) {
|
|
|
389
495
|
wordBreak: 'break-word',
|
|
390
496
|
whiteSpace: 'nowrap'
|
|
391
497
|
},
|
|
392
|
-
onClick:
|
|
393
|
-
var _drawFormRef$current7, _searchRef$current6;
|
|
394
|
-
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
395
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
396
|
-
case 0:
|
|
397
|
-
_context9.next = 2;
|
|
398
|
-
return setSearchDrawer(!searchDrawer);
|
|
399
|
-
case 2:
|
|
400
|
-
// 没法实时监听数据所以这里要带过来
|
|
401
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current7 = drawFormRef.current) === null || _drawFormRef$current7 === void 0 ? void 0 : _drawFormRef$current7.setFieldsValue(searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current6 = searchRef.current) === null || _searchRef$current6 === void 0 ? void 0 : _searchRef$current6.getFieldsValue());
|
|
402
|
-
case 3:
|
|
403
|
-
case "end":
|
|
404
|
-
return _context9.stop();
|
|
405
|
-
}
|
|
406
|
-
}, _callee9);
|
|
407
|
-
}))
|
|
498
|
+
onClick: handleAdvancedFilterClick
|
|
408
499
|
}, /*#__PURE__*/_react.default.createElement(_icons.BarsOutlined, null), "\u9AD8\u7EA7\u7B5B\u9009")];
|
|
409
500
|
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
|
|
501
|
+
});
|
|
502
|
+
}, [action, props.search, handleSearchAll, handleResetForm, handleAdvancedFilterClick]);
|
|
503
|
+
// 优化:使用 useMemo 缓存工具栏渲染
|
|
504
|
+
var toolBarRender = (0, _react.useCallback)(function (searchConfig, rows) {
|
|
505
|
+
return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/_react.default.createElement(_antd.Checkbox, {
|
|
506
|
+
defaultChecked: showFull,
|
|
507
|
+
onChange: handleShowFullChange
|
|
508
|
+
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, typeof otherProps.toolBarRender === 'function' && otherProps.toolBarRender(searchConfig, rows)];
|
|
509
|
+
}, [action, showFull, handleShowFullChange, otherProps.toolBarRender]);
|
|
510
|
+
// 优化:使用 useMemo 缓存抽屉样式
|
|
511
|
+
var drawerStyle = (0, _react.useMemo)(function () {
|
|
512
|
+
return {
|
|
513
|
+
position: 'fixed',
|
|
514
|
+
top: props.top || CONSTANTS.DEFAULT_TOP
|
|
515
|
+
};
|
|
516
|
+
}, [props.top]);
|
|
517
|
+
// 优化:使用 useMemo 缓存抽屉底部按钮样式
|
|
518
|
+
var bottomButtonStyle = (0, _react.useMemo)(function () {
|
|
519
|
+
return {
|
|
520
|
+
position: 'fixed',
|
|
521
|
+
bottom: 0,
|
|
522
|
+
background: 'white',
|
|
523
|
+
display: 'flex',
|
|
524
|
+
width: "".concat(CONSTANTS.DRAWER_WIDTH, "px"),
|
|
525
|
+
borderTop: '1px solid #f0f0f0',
|
|
526
|
+
right: '0',
|
|
527
|
+
justifyContent: 'space-around',
|
|
528
|
+
padding: '16px',
|
|
529
|
+
boxSizing: 'border-box'
|
|
530
|
+
};
|
|
531
|
+
}, []);
|
|
532
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
533
|
+
className: "page_plustable__body"
|
|
534
|
+
}, /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, {
|
|
535
|
+
prefixCls: "ant"
|
|
536
|
+
}, /*#__PURE__*/_react.default.createElement(_proComponents.ProTable, _extends({
|
|
537
|
+
pagination: _objectSpread({
|
|
538
|
+
size: 'default'
|
|
539
|
+
}, pagination),
|
|
540
|
+
actionRef: actionRef,
|
|
541
|
+
formRef: searchRef,
|
|
542
|
+
search: searchConfig,
|
|
413
543
|
columnsState: (action === null || action === void 0 ? void 0 : action.includes('columnSetting')) ? columnsState : props.columnsState,
|
|
414
|
-
request: request ? propsRequest : undefined
|
|
415
|
-
|
|
416
|
-
,
|
|
417
|
-
columns: (action === null || action === void 0 ? void 0 : action.includes('advancedFilter')) ? columns.map(function (item) {
|
|
418
|
-
// 只保留基本搜索栏的配置
|
|
419
|
-
if (item.baseSearch) {
|
|
420
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
421
|
-
search: item.search,
|
|
422
|
-
fieldProps: _objectSpread({
|
|
423
|
-
onChange: function onChange(e) {
|
|
424
|
-
if (e) {
|
|
425
|
-
var _drawFormRef$current8;
|
|
426
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current8 = drawFormRef.current) === null || _drawFormRef$current8 === void 0 ? void 0 : _drawFormRef$current8.setFieldsValue(_defineProperty({}, item.dataIndex, e.target ? e.target.value : e));
|
|
427
|
-
} else {
|
|
428
|
-
var _drawFormRef$current10;
|
|
429
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current10 = drawFormRef.current) === null || _drawFormRef$current10 === void 0 ? void 0 : _drawFormRef$current10.resetFields([item.dataIndex]);
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}, item.fieldProps)
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
436
|
-
search: false
|
|
437
|
-
});
|
|
438
|
-
}) : columns,
|
|
439
|
-
toolBarRender: function toolBarRender(searchConfig, rows) {
|
|
440
|
-
return [(action === null || action === void 0 ? void 0 : action.includes('viewInvisibleData')) ? /*#__PURE__*/_react.default.createElement(_antd.Checkbox, {
|
|
441
|
-
onChange: function onChange(e) {
|
|
442
|
-
setShowFull(e.target.checked);
|
|
443
|
-
setTimeout(function () {
|
|
444
|
-
searchConfig === null || searchConfig === void 0 ? void 0 : searchConfig.reload();
|
|
445
|
-
}, 100);
|
|
446
|
-
}
|
|
447
|
-
}, "\u663E\u793A\u6240\u6709\u6570\u636E") : null, typeof otherProps.toolBarRender === 'function' && otherProps.toolBarRender(searchConfig, rows)];
|
|
448
|
-
},
|
|
544
|
+
request: request ? propsRequest : undefined,
|
|
545
|
+
columns: processedColumns,
|
|
546
|
+
toolBarRender: toolBarRender,
|
|
449
547
|
options: __options
|
|
450
548
|
}, otherProps)), /*#__PURE__*/_react.default.createElement(_antd.Drawer, {
|
|
451
549
|
onClose: function onClose() {
|
|
452
550
|
return setSearchDrawer(false);
|
|
453
551
|
},
|
|
454
|
-
title:
|
|
455
|
-
width:
|
|
456
|
-
rootStyle:
|
|
457
|
-
position: 'fixed',
|
|
458
|
-
top: props.top || 92
|
|
459
|
-
},
|
|
552
|
+
title: "\u9AD8\u7EA7\u7B5B\u9009",
|
|
553
|
+
width: CONSTANTS.DRAWER_WIDTH,
|
|
554
|
+
rootStyle: drawerStyle,
|
|
460
555
|
getContainer: (otherProps === null || otherProps === void 0 ? void 0 : otherProps.getContainer) || document.getElementsByTagName('body')[0],
|
|
461
556
|
className: "search-drawer",
|
|
462
557
|
open: searchDrawer,
|
|
@@ -465,9 +560,7 @@ function PlusTable(props, ref) {
|
|
|
465
560
|
}, /*#__PURE__*/_react.default.createElement(_index.default, {
|
|
466
561
|
columns: columns,
|
|
467
562
|
loading: false,
|
|
468
|
-
changeValue:
|
|
469
|
-
return onValuesChange(_changeValue, allValue);
|
|
470
|
-
},
|
|
563
|
+
changeValue: onValuesChange,
|
|
471
564
|
onFormSearchSubmit: function onFormSearchSubmit() {
|
|
472
565
|
var _searchRef$current7;
|
|
473
566
|
searchRef === null || searchRef === void 0 ? void 0 : (_searchRef$current7 = searchRef.current) === null || _searchRef$current7 === void 0 ? void 0 : _searchRef$current7.submit();
|
|
@@ -482,32 +575,17 @@ function PlusTable(props, ref) {
|
|
|
482
575
|
search: {
|
|
483
576
|
optionRender: function optionRender(searchConfig) {
|
|
484
577
|
return [/*#__PURE__*/_react.default.createElement("div", {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
bottom: 0,
|
|
488
|
-
background: 'white',
|
|
489
|
-
display: 'flex',
|
|
490
|
-
width: '380px',
|
|
491
|
-
borderTop: '1px solid #f0f0f0',
|
|
492
|
-
right: '0',
|
|
493
|
-
justifyContent: 'space-around',
|
|
494
|
-
padding: '16px',
|
|
495
|
-
boxSizing: 'border-box'
|
|
496
|
-
}
|
|
578
|
+
key: "bottom-buttons",
|
|
579
|
+
style: bottomButtonStyle
|
|
497
580
|
}, /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
498
581
|
size: "middle",
|
|
499
582
|
type: "primary",
|
|
500
583
|
onClick: function onClick() {
|
|
501
|
-
handleSearchAll(searchConfig);
|
|
584
|
+
return handleSearchAll(searchConfig);
|
|
502
585
|
}
|
|
503
586
|
}, "\u67E5\u8BE2"), /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
504
587
|
type: "default",
|
|
505
|
-
onClick:
|
|
506
|
-
var _drawFormRef$current11, _actionRef$current3, _actionRef$current3$r, _actionRef$current4, _actionRef$current4$r;
|
|
507
|
-
drawFormRef === null || drawFormRef === void 0 ? void 0 : (_drawFormRef$current11 = drawFormRef.current) === null || _drawFormRef$current11 === void 0 ? void 0 : _drawFormRef$current11.resetFields();
|
|
508
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$r = _actionRef$current3.reset) === null || _actionRef$current3$r === void 0 ? void 0 : _actionRef$current3$r.call(_actionRef$current3);
|
|
509
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$r = _actionRef$current4.reload) === null || _actionRef$current4$r === void 0 ? void 0 : _actionRef$current4$r.call(_actionRef$current4);
|
|
510
|
-
},
|
|
588
|
+
onClick: handleResetForm,
|
|
511
589
|
size: "middle"
|
|
512
590
|
}, "\u91CD\u7F6E"))];
|
|
513
591
|
},
|
|
@@ -518,6 +596,6 @@ function PlusTable(props, ref) {
|
|
|
518
596
|
},
|
|
519
597
|
manualRequest: true,
|
|
520
598
|
action: actionRef
|
|
521
|
-
})));
|
|
599
|
+
}))));
|
|
522
600
|
}
|
|
523
601
|
var _default = exports.default = /*#__PURE__*/_react.default.forwardRef(PlusTable);
|