ds-web-all 1.0.1-beta.98 → 1.0.1-beta.99
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.
|
@@ -94,6 +94,8 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
94
94
|
initialFilterValues = _ref$initialFilterVal === void 0 ? {} : _ref$initialFilterVal,
|
|
95
95
|
_ref$isCacheListFilte = _ref.isCacheListFilter,
|
|
96
96
|
isCacheListFilter = _ref$isCacheListFilte === void 0 ? true : _ref$isCacheListFilte,
|
|
97
|
+
_ref$cacheFilterKey = _ref.cacheFilterKey,
|
|
98
|
+
cacheFilterKey = _ref$cacheFilterKey === void 0 ? 'cacheList' : _ref$cacheFilterKey,
|
|
97
99
|
_ref$emptyText = _ref.emptyText,
|
|
98
100
|
emptyText = _ref$emptyText === void 0 ? '暂无数据' : _ref$emptyText,
|
|
99
101
|
_ref$staticDataSource = _ref.staticDataSource,
|
|
@@ -135,13 +137,22 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
135
137
|
sortTable = _useState8[0],
|
|
136
138
|
setSortTable = _useState8[1];
|
|
137
139
|
var scrollTableRef = (0, _react.useRef)(null);
|
|
140
|
+
var cachePageSizeKey = (0, _react.useMemo)(function () {
|
|
141
|
+
return "".concat(cacheFilterKey, "PageSize");
|
|
142
|
+
}, [cacheFilterKey]);
|
|
143
|
+
var cachePageNoKey = (0, _react.useMemo)(function () {
|
|
144
|
+
return "".concat(cacheFilterKey, "PageNo");
|
|
145
|
+
}, [cacheFilterKey]);
|
|
146
|
+
var cacheSearchKey = (0, _react.useMemo)(function () {
|
|
147
|
+
return "".concat(cacheFilterKey, "Filter");
|
|
148
|
+
}, [cacheFilterKey]);
|
|
138
149
|
// 定义pageSize
|
|
139
|
-
var _useState9 = (0, _react.useState)(isCacheListFilter && ((_window$history$state = window.history.state) === null || _window$history$state === void 0 ? void 0 : _window$history$state
|
|
150
|
+
var _useState9 = (0, _react.useState)(isCacheListFilter && ((_window$history$state = window.history.state) === null || _window$history$state === void 0 ? void 0 : _window$history$state[cachePageSizeKey]) ? (_window$history$state2 = window.history.state) === null || _window$history$state2 === void 0 ? void 0 : _window$history$state2[cachePageSizeKey] : (0, _get.default)(tableProps, 'pagination.pageSize', (dataRequest === null || dataRequest === void 0 ? void 0 : (_dataRequest$params = dataRequest.params) === null || _dataRequest$params === void 0 ? void 0 : _dataRequest$params.pageSize) || 20)),
|
|
140
151
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
141
152
|
pageSize = _useState10[0],
|
|
142
153
|
setPageSize = _useState10[1];
|
|
143
154
|
// 当前页码
|
|
144
|
-
var _useState11 = (0, _react.useState)(isCacheListFilter ? (_window$history$state3 = (_window$history$state4 = window.history.state) === null || _window$history$state4 === void 0 ? void 0 : _window$history$state4
|
|
155
|
+
var _useState11 = (0, _react.useState)(isCacheListFilter ? (_window$history$state3 = (_window$history$state4 = window.history.state) === null || _window$history$state4 === void 0 ? void 0 : _window$history$state4[cachePageNoKey]) !== null && _window$history$state3 !== void 0 ? _window$history$state3 : 1 : 1),
|
|
145
156
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
146
157
|
pageNo = _useState12[0],
|
|
147
158
|
setPageNo = _useState12[1];
|
|
@@ -153,17 +164,13 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
153
164
|
(0, _react.useEffect)(function () {
|
|
154
165
|
if (isCacheListFilter) {
|
|
155
166
|
var _window$history$state5;
|
|
156
|
-
window.history.replaceState(_objectSpread(_objectSpread({}, (_window$history$state5 = window.history.state) !== null && _window$history$state5 !== void 0 ? _window$history$state5 : {}), {}, {
|
|
157
|
-
cacheListPageNo: pageNo
|
|
158
|
-
}), '');
|
|
167
|
+
window.history.replaceState(_objectSpread(_objectSpread({}, (_window$history$state5 = window.history.state) !== null && _window$history$state5 !== void 0 ? _window$history$state5 : {}), {}, _defineProperty({}, cachePageNoKey, pageNo)), '');
|
|
159
168
|
}
|
|
160
169
|
}, [pageNo]);
|
|
161
170
|
(0, _react.useEffect)(function () {
|
|
162
171
|
if (isCacheListFilter) {
|
|
163
172
|
var _window$history$state6;
|
|
164
|
-
window.history.replaceState(_objectSpread(_objectSpread({}, (_window$history$state6 = window.history.state) !== null && _window$history$state6 !== void 0 ? _window$history$state6 : {}), {}, {
|
|
165
|
-
cacheListPageSize: pageSize
|
|
166
|
-
}), '');
|
|
173
|
+
window.history.replaceState(_objectSpread(_objectSpread({}, (_window$history$state6 = window.history.state) !== null && _window$history$state6 !== void 0 ? _window$history$state6 : {}), {}, _defineProperty({}, cachePageSizeKey, pageSize)), '');
|
|
167
174
|
}
|
|
168
175
|
}, [pageSize]);
|
|
169
176
|
// 总数据条数
|
|
@@ -172,7 +179,7 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
172
179
|
total = _useState14[0],
|
|
173
180
|
setTotal = _useState14[1];
|
|
174
181
|
// 查询条件
|
|
175
|
-
var _useState15 = (0, _react.useState)(_objectSpread(_objectSpread({}, initialFilterValues), isCacheListFilter ? (_window$history$state7 = (_window$history$state8 = window.history.state) === null || _window$history$state8 === void 0 ? void 0 : _window$history$state8
|
|
182
|
+
var _useState15 = (0, _react.useState)(_objectSpread(_objectSpread({}, initialFilterValues), isCacheListFilter ? (_window$history$state7 = (_window$history$state8 = window.history.state) === null || _window$history$state8 === void 0 ? void 0 : _window$history$state8[cacheSearchKey]) !== null && _window$history$state7 !== void 0 ? _window$history$state7 : {} : {})),
|
|
176
183
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
177
184
|
search = _useState16[0],
|
|
178
185
|
setSearch = _useState16[1];
|
|
@@ -392,9 +399,7 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
392
399
|
}
|
|
393
400
|
if (isCacheListFilter) {
|
|
394
401
|
var _window$history$state22;
|
|
395
|
-
window.history.replaceState(_objectSpread(_objectSpread({}, (_window$history$state22 = window.history.state) !== null && _window$history$state22 !== void 0 ? _window$history$state22 : {}), {}, {
|
|
396
|
-
cacheListFilter: _objectSpread({}, newSearch)
|
|
397
|
-
}), '');
|
|
402
|
+
window.history.replaceState(_objectSpread(_objectSpread({}, (_window$history$state22 = window.history.state) !== null && _window$history$state22 !== void 0 ? _window$history$state22 : {}), {}, _defineProperty({}, cacheSearchKey, _objectSpread({}, newSearch))), '');
|
|
398
403
|
}
|
|
399
404
|
if (!dataRequest && typeof staticFilter === 'function') {
|
|
400
405
|
var newData = staticDataSourceCache.current.filter(function (el, i) {
|
|
@@ -416,9 +421,7 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
416
421
|
setSearch(initialFilterValues);
|
|
417
422
|
if (isCacheListFilter) {
|
|
418
423
|
var _window$history$state23;
|
|
419
|
-
window.history.replaceState(_objectSpread(_objectSpread({}, (_window$history$state23 = window.history.state) !== null && _window$history$state23 !== void 0 ? _window$history$state23 : {}), {}, {
|
|
420
|
-
cacheListFilter: _objectSpread({}, initialFilterValues)
|
|
421
|
-
}), '');
|
|
424
|
+
window.history.replaceState(_objectSpread(_objectSpread({}, (_window$history$state23 = window.history.state) !== null && _window$history$state23 !== void 0 ? _window$history$state23 : {}), {}, _defineProperty({}, cacheSearchKey, _objectSpread({}, initialFilterValues))), '');
|
|
422
425
|
}
|
|
423
426
|
formRef.current.resetFields(); // 重置搜索框中表单
|
|
424
427
|
formRef.current.setFieldsValue(initialFilterValues);
|