xmirror-components 1.0.34-alpha.2 → 1.0.36

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.
@@ -132,6 +132,9 @@ var useSearchParams = function (initialValue, options) {
132
132
  */
133
133
  useBlocker(function (_a) {
134
134
  var currentLocation = _a.currentLocation, nextLocation = _a.nextLocation, historyAction = _a.historyAction;
135
+ if (historyAction === 'POP') {
136
+ return false;
137
+ }
135
138
  if (currentLocation.pathname !==
136
139
  nextLocation.pathname) {
137
140
  if (storage === 'url') {
@@ -295,6 +295,14 @@ function useTable(request, options) {
295
295
  var currentPageSize = (_c = pagination.pageSize) !== null && _c !== void 0 ? _c : paginationRef.current.pageSize;
296
296
  initList(currentPage, currentPageSize);
297
297
  }, [initList, searchParams]);
298
+ var reset = function () {
299
+ setSelectedRows([]);
300
+ setTableData([]);
301
+ setPagination(__assign({ current: 1, pageSize: 10, total: 0 }, defaultPagination));
302
+ setLoading(false);
303
+ searchParams.pageNum = 1;
304
+ searchParams.pageSize = (defaultPagination === null || defaultPagination === void 0 ? void 0 : defaultPagination.pageSize) || 10;
305
+ };
298
306
  // 初始化
299
307
  useEffect(function () {
300
308
  if (immediate) {
@@ -321,7 +329,8 @@ function useTable(request, options) {
321
329
  pagination: pagination,
322
330
  params: searchParams,
323
331
  submit: search,
324
- refresh: refresh
332
+ refresh: refresh,
333
+ reset: reset
325
334
  },
326
335
  rowSelection: {
327
336
  selectedRows: selectedRows,
@@ -106,6 +106,10 @@ export interface ReturnData<T = AnyObject> {
106
106
  * 刷新页面
107
107
  */
108
108
  refresh: (searchData?: Record<string, unknown>) => void;
109
+ /**
110
+ * 重置分页信息
111
+ */
112
+ reset: () => void;
109
113
  };
110
114
  /**
111
115
  * 多选条件
@@ -137,6 +137,9 @@ var useSearchParams = function (initialValue, options) {
137
137
  */
138
138
  (0, react_router_dom_1.useBlocker)(function (_a) {
139
139
  var currentLocation = _a.currentLocation, nextLocation = _a.nextLocation, historyAction = _a.historyAction;
140
+ if (historyAction === 'POP') {
141
+ return false;
142
+ }
140
143
  if (currentLocation.pathname !==
141
144
  nextLocation.pathname) {
142
145
  if (storage === 'url') {
@@ -297,6 +297,14 @@ function useTable(request, options) {
297
297
  var currentPageSize = (_c = pagination.pageSize) !== null && _c !== void 0 ? _c : paginationRef.current.pageSize;
298
298
  initList(currentPage, currentPageSize);
299
299
  }, [initList, searchParams]);
300
+ var reset = function () {
301
+ setSelectedRows([]);
302
+ setTableData([]);
303
+ setPagination(__assign({ current: 1, pageSize: 10, total: 0 }, defaultPagination));
304
+ setLoading(false);
305
+ searchParams.pageNum = 1;
306
+ searchParams.pageSize = (defaultPagination === null || defaultPagination === void 0 ? void 0 : defaultPagination.pageSize) || 10;
307
+ };
300
308
  // 初始化
301
309
  (0, react_1.useEffect)(function () {
302
310
  if (immediate) {
@@ -323,7 +331,8 @@ function useTable(request, options) {
323
331
  pagination: pagination,
324
332
  params: searchParams,
325
333
  submit: search,
326
- refresh: refresh
334
+ refresh: refresh,
335
+ reset: reset
327
336
  },
328
337
  rowSelection: {
329
338
  selectedRows: selectedRows,
@@ -345,6 +345,10 @@ declare interface ReturnData<T = AnyObject> {
345
345
  * 刷新页面
346
346
  */
347
347
  refresh: (searchData?: Record<string, unknown>) => void;
348
+ /**
349
+ * 重置分页信息
350
+ */
351
+ reset: () => void;
348
352
  };
349
353
  /**
350
354
  * 多选条件
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.34-alpha.2",
3
+ "version": "1.0.36",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",
@@ -106,6 +106,10 @@ export interface ReturnData<T = AnyObject> {
106
106
  * 刷新页面
107
107
  */
108
108
  refresh: (searchData?: Record<string, unknown>) => void;
109
+ /**
110
+ * 重置分页信息
111
+ */
112
+ reset: () => void;
109
113
  };
110
114
  /**
111
115
  * 多选条件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.34-alpha.2",
3
+ "version": "1.0.36",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",