@quansitech/antd-admin 1.1.30 → 1.1.32

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.
@@ -75,7 +75,7 @@ export default function (props) {
75
75
  aspect = parseInt(aspects[0]) / parseInt(aspects[1]);
76
76
  }
77
77
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ImgCrop, {
78
- quality: ((_props$fieldProps$cro = props.fieldProps.crop) === null || _props$fieldProps$cro === void 0 ? void 0 : _props$fieldProps$cro.quality) || 0.8,
78
+ quality: ((_props$fieldProps$cro = props.fieldProps.crop) === null || _props$fieldProps$cro === void 0 ? void 0 : _props$fieldProps$cro.quality) || 0.92,
79
79
  rotationSlider: true,
80
80
  aspect: aspect
81
81
  }, dom));
@@ -31,27 +31,27 @@ import { diffTree, getValueByPath, routerNavigateTo } from "../lib/helpers";
31
31
  import qs from 'qs';
32
32
  import { TabsContext } from "./TabsContext";
33
33
  export default function (props) {
34
- var searchUrl = props.searchUrl;
35
34
  var request = /*#__PURE__*/function () {
36
35
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params, sort, filter) {
37
- var _formRef$current;
38
36
  var data, only, res;
39
37
  return _regeneratorRuntime().wrap(function _callee$(_context) {
40
38
  while (1) switch (_context.prev = _context.next) {
41
39
  case 0:
42
- setLoading(true);
43
- data = _objectSpread(_objectSpread(_objectSpread({}, filter), (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldsValue()), {}, {
40
+ data = _objectSpread(_objectSpread(_objectSpread({}, params), filter), {}, {
44
41
  sort: sort
45
42
  });
46
43
  if (props.pagination) {
47
44
  data[props.pagination.paramName || 'page'] = params.current;
45
+ delete data.current;
46
+ delete data.pageSize;
48
47
  }
49
48
  setEditableKeys([]);
50
49
  setEditableValues([]);
51
50
  if (modalContext.inModal) {
52
- _context.next = 10;
51
+ _context.next = 9;
53
52
  break;
54
53
  }
54
+ // 如果不在 modal 中,则使用 routerNavigateTo
55
55
  only = ['dataSource', 'pagination', 'extraRenderValues'];
56
56
  if (tabsContext.inTabs) {
57
57
  only.push('tabs');
@@ -77,16 +77,16 @@ export default function (props) {
77
77
  }
78
78
  });
79
79
  return _context.abrupt("return");
80
- case 10:
81
- _context.prev = 10;
82
- _context.next = 13;
80
+ case 9:
81
+ _context.prev = 9;
82
+ _context.next = 12;
83
83
  return http.get(searchUrl, {
84
84
  params: data,
85
85
  headers: {
86
86
  'X-Table-Search': '1'
87
87
  }
88
88
  });
89
- case 13:
89
+ case 12:
90
90
  res = _context.sent;
91
91
  if (res.data.pagination) {
92
92
  setPagination(_objectSpread(_objectSpread({}, res.data.pagination), {}, {
@@ -101,15 +101,15 @@ export default function (props) {
101
101
  data: res.data.dataSource || [],
102
102
  success: true
103
103
  });
104
- case 18:
105
- _context.prev = 18;
104
+ case 17:
105
+ _context.prev = 17;
106
106
  setLoading(false);
107
- return _context.finish(18);
108
- case 21:
107
+ return _context.finish(17);
108
+ case 20:
109
109
  case "end":
110
110
  return _context.stop();
111
111
  }
112
- }, _callee, null, [[10,, 18, 21]]);
112
+ }, _callee, null, [[9,, 17, 20]]);
113
113
  }));
114
114
  return function request(_x, _x2, _x3) {
115
115
  return _ref.apply(this, arguments);
@@ -150,47 +150,51 @@ export default function (props) {
150
150
  return row;
151
151
  });
152
152
  };
153
+ var _useState = useState(props.searchUrl),
154
+ _useState2 = _slicedToArray(_useState, 2),
155
+ searchUrl = _useState2[0],
156
+ setSearchUrl = _useState2[1];
153
157
  var formRef = useRef();
154
158
  var actionRef = useRef();
155
- var _useState = useState({}),
156
- _useState2 = _slicedToArray(_useState, 2),
157
- lastQuery = _useState2[0],
158
- setLastQuery = _useState2[1];
159
- var _useState3 = useState(function () {
159
+ var _useState3 = useState({}),
160
+ _useState4 = _slicedToArray(_useState3, 2),
161
+ lastQuery = _useState4[0],
162
+ setLastQuery = _useState4[1];
163
+ var _useState5 = useState(function () {
160
164
  return [];
161
165
  }),
162
- _useState4 = _slicedToArray(_useState3, 2),
163
- editableKeys = _useState4[0],
164
- setEditableKeys = _useState4[1];
165
- var _useState5 = useState([]),
166
166
  _useState6 = _slicedToArray(_useState5, 2),
167
- selectedRows = _useState6[0],
168
- setSelectedRows = _useState6[1];
167
+ editableKeys = _useState6[0],
168
+ setEditableKeys = _useState6[1];
169
169
  var _useState7 = useState([]),
170
170
  _useState8 = _slicedToArray(_useState7, 2),
171
- editableValues = _useState8[0],
172
- setEditableValues = _useState8[1];
173
- var _useState9 = useState(false),
171
+ selectedRows = _useState8[0],
172
+ setSelectedRows = _useState8[1];
173
+ var _useState9 = useState([]),
174
174
  _useState10 = _slicedToArray(_useState9, 2),
175
- loading = _useState10[0],
176
- setLoading = _useState10[1];
177
- // @ts-ignore
178
- var _useState11 = useState(props.pagination),
175
+ editableValues = _useState10[0],
176
+ setEditableValues = _useState10[1];
177
+ var _useState11 = useState(false),
179
178
  _useState12 = _slicedToArray(_useState11, 2),
180
- pagination = _useState12[0],
181
- setPagination = _useState12[1];
182
- var _useState13 = useState(postData(props.dataSource)),
179
+ loading = _useState12[0],
180
+ setLoading = _useState12[1];
181
+ // @ts-ignore
182
+ var _useState13 = useState(props.pagination),
183
183
  _useState14 = _slicedToArray(_useState13, 2),
184
- dataSource = _useState14[0],
185
- setDataSource = _useState14[1];
186
- var _useState15 = useState(true),
184
+ pagination = _useState14[0],
185
+ setPagination = _useState14[1];
186
+ var _useState15 = useState(postData(props.dataSource)),
187
187
  _useState16 = _slicedToArray(_useState15, 2),
188
- sticky = _useState16[0],
189
- setSticky = _useState16[1];
190
- var _useState17 = useState(props.extraRenderValues),
188
+ dataSource = _useState16[0],
189
+ setDataSource = _useState16[1];
190
+ var _useState17 = useState(true),
191
191
  _useState18 = _slicedToArray(_useState17, 2),
192
- extraRenderValues = _useState18[0],
193
- setExtraRenderValues = _useState18[1];
192
+ sticky = _useState18[0],
193
+ setSticky = _useState18[1];
194
+ var _useState19 = useState(props.extraRenderValues),
195
+ _useState20 = _slicedToArray(_useState19, 2),
196
+ extraRenderValues = _useState20[0],
197
+ setExtraRenderValues = _useState20[1];
194
198
  var modalContext = useContext(ModalContext);
195
199
  var tabsContext = useContext(TabsContext);
196
200
  useEffect(function () {
@@ -204,19 +208,26 @@ export default function (props) {
204
208
 
205
209
  // 搜索
206
210
  if (!searchUrl) {
207
- searchUrl = window.location.href;
211
+ var s = window.location.href;
212
+ s = s.replace(/page=\d+&?/, '');
213
+ columns.filter(function (c) {
214
+ return c.search !== false;
215
+ }).map(function (c) {
216
+ s = s.replace(new RegExp("".concat(c.dataIndex, "=[^&]*&?")), '');
217
+ });
218
+ setSearchUrl(s);
208
219
  }
209
- setLastQuery(props.defaultSearchValue);
220
+ setLastQuery(props.defaultSearchValue || {});
210
221
  if (!modalContext.inModal) {
211
222
  var query = qs.parse(window.location.search.replace(/^\?/, ''));
212
223
  if (query && Object.keys(query).length) {
213
- var _formRef$current2;
224
+ var _formRef$current;
214
225
  Object.keys(query).forEach(function (key) {
215
226
  if (typeof query[key] === 'string') {
216
227
  /^\d+$/.test(query[key]) && (query[key] = parseInt(query[key]));
217
228
  }
218
229
  });
219
- (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.setFieldsValue(query);
230
+ (_formRef$current = formRef.current) === null || _formRef$current === void 0 || _formRef$current.setFieldsValue(query);
220
231
  }
221
232
  }
222
233
  }, []);
@@ -257,7 +268,7 @@ export default function (props) {
257
268
  form: {
258
269
  initialValues: props.defaultSearchValue,
259
270
  onValuesChange: function onValuesChange(changedValues, allValues) {
260
- var _formRef$current3;
271
+ var _formRef$current2;
261
272
  var submit = columns.filter(function (c) {
262
273
  if (!c.searchOnChange) {
263
274
  return false;
@@ -268,7 +279,7 @@ export default function (props) {
268
279
  return;
269
280
  }
270
281
  // 是否立即搜索
271
- (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 || _formRef$current3.submit();
282
+ (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 || _formRef$current2.submit();
272
283
  }
273
284
  },
274
285
  rowSelection: props.rowSelection && {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quansitech/antd-admin",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"