react-toolkits 2.13.26 → 2.13.28

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.13.28
4
+
5
+ ### Patch Changes
6
+
7
+ - 61478c7: fix: change getTotal and getDataSource default value in QueryList
8
+
9
+ ## 2.13.27
10
+
11
+ ### Patch Changes
12
+
13
+ - 40e6d81: fix: the return of getTotal and getDataSource are not right
14
+
3
15
  ## 2.13.26
4
16
 
5
17
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -190,10 +190,6 @@ interface PermissionButtonProps extends ButtonProps {
190
190
  }
191
191
  declare const PermissionButton: FC<PropsWithChildren<PermissionButtonProps>>;
192
192
 
193
- interface ListResponse<T = any> {
194
- list: T[];
195
- total: number;
196
- }
197
193
  interface QueryListPayload<Values = any> {
198
194
  page?: number;
199
195
  size?: number;
@@ -232,7 +228,7 @@ interface QueryListProps<Item extends AnyObject = AnyObject, Values = AnyObject,
232
228
  getDataSource?: (data: Data | undefined, form: FormInstance<Values>) => Item[] | undefined;
233
229
  footer?: (data: Data | undefined) => ReactNode;
234
230
  }
235
- declare const QueryList: <Item extends AnyObject = AnyObject, Values extends object | undefined = undefined, Data = ListResponse<Item>>(props: QueryListProps<Item, Values, Data> & {
231
+ declare const QueryList: <Item extends AnyObject = AnyObject, Values extends object | undefined = undefined, Data = any>(props: QueryListProps<Item, Values, Data> & {
236
232
  ref?: Ref<QueryListRef<Item, Values, Data>>;
237
233
  }) => ReactElement;
238
234
 
package/lib/index.js CHANGED
@@ -1288,8 +1288,8 @@ var init_QueryList = __esm({
1288
1288
  method: "GET",
1289
1289
  defaultSize: 10,
1290
1290
  refreshInterval: 0,
1291
- getTotal: (data2) => data2?.total,
1292
- getDataSource: (data2) => data2?.list,
1291
+ getTotal: (data2) => data2?.data?.total,
1292
+ getDataSource: (data2) => data2?.data?.list,
1293
1293
  ...props
1294
1294
  };
1295
1295
  const {
@@ -1319,7 +1319,6 @@ var init_QueryList = __esm({
1319
1319
  const { t } = useTranslation();
1320
1320
  const [_form] = Form.useForm(form);
1321
1321
  const action = useRef(3 /* Init */);
1322
- const _headers = typeof headers === "function" ? headers(_form) : headers;
1323
1322
  const { data: accessible, isLoading: isChecking } = usePermission(code);
1324
1323
  const [isValid, setIsValid] = useState(false);
1325
1324
  const { keyMap, getPayload, refetch } = useQueryListStore();
@@ -1335,6 +1334,7 @@ var init_QueryList = __esm({
1335
1334
  page: !onePage ? page : void 0,
1336
1335
  size: !onePage ? size : void 0
1337
1336
  } : void 0 : params;
1337
+ const _headers = typeof headers === "function" ? headers(_form) : headers;
1338
1338
  const shouldPoll = useRef(false);
1339
1339
  const requestConfig = {
1340
1340
  url: url4,
@@ -2715,8 +2715,8 @@ var init_userList = __esm({
2715
2715
  url: url2,
2716
2716
  rowKey: "id",
2717
2717
  columns,
2718
- getTotal: (response) => response?.Total,
2719
- getDataSource: (response) => response?.List,
2718
+ getTotal: (data) => data?.data.Total,
2719
+ getDataSource: (data) => data?.data.List,
2720
2720
  renderForm: (form) => /* @__PURE__ */ jsx(Form, { form, children: /* @__PURE__ */ jsx(Form.Item, { label: "\u540D\u79F0", name: "name", children: /* @__PURE__ */ jsx(Input, {}) }) })
2721
2721
  }
2722
2722
  )
@@ -2999,8 +2999,8 @@ var init_roleList = __esm({
2999
2999
  columns,
3000
3000
  code: "200001",
3001
3001
  url: url3,
3002
- getTotal: (response) => response?.Total,
3003
- getDataSource: (response) => response?.List
3002
+ getTotal: (data) => data?.data.Total,
3003
+ getDataSource: (data) => data?.data.List
3004
3004
  }
3005
3005
  )
3006
3006
  }
@@ -3542,8 +3542,8 @@ var OperationLogList = () => {
3542
3542
  columns,
3543
3543
  tableLayout: "fixed",
3544
3544
  url: "/api/usystem/log/list",
3545
- getTotal: (response) => response?.Total,
3546
- getDataSource: (response) => response?.List,
3545
+ getTotal: (data) => data?.data.Total,
3546
+ getDataSource: (data) => data?.data.List,
3547
3547
  renderForm: (form) => /* @__PURE__ */ jsxs(Form, { form, layout: "inline", children: [
3548
3548
  /* @__PURE__ */ jsx(Form.Item, { label: t("global.username"), name: "uname", children: /* @__PURE__ */ jsx(Input, { allowClear: true }) }),
3549
3549
  /* @__PURE__ */ jsx(Form.Item, { label: t("global.route"), name: "route", children: /* @__PURE__ */ jsx(Input, { allowClear: true }) }),