react-toolkits 2.13.30 → 2.13.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # react-toolkits
2
2
 
3
+ ## 2.13.32
4
+
5
+ ### Patch Changes
6
+
7
+ - 575bb87: feat: display user search only when current permission is v3
8
+
9
+ ## 2.13.31
10
+
11
+ ### Patch Changes
12
+
13
+ - e423d66: fix: app-id should be 'global' when disallowed changing game
14
+
3
15
  ## 2.13.30
4
16
 
5
17
  ### Patch Changes
package/lib/index.js CHANGED
@@ -619,20 +619,12 @@ var init_highlight = __esm({
619
619
  }
620
620
  });
621
621
  function usePermission(code, config) {
622
- const { axios: axios2, permissionVersion, gameId } = useToolkitsStore((s) => s);
622
+ const { axios: axios2, permissionVersion } = useToolkitsStore((s) => s);
623
623
  const url4 = permissionVersion !== "v1" /* V1 */ ? "/api/usystem/user/checkV2" : "/api/usystem/user/check";
624
624
  const permissionCodes = typeof code !== "undefined" ? typeof code === "string" ? [code] : code : [];
625
625
  const body = { permissions: permissionCodes };
626
- const mergedConfig = {
627
- ...config,
628
- headers: {
629
- // FIXME: 在 QueryList 内,切换游戏的时有时不会触发查询
630
- [APP_ID_HEADER]: gameId,
631
- ...config?.headers
632
- }
633
- };
634
626
  const { data, ...rest } = useSWR6(
635
- permissionCodes.length > 0 ? [url4, body, mergedConfig] : null,
627
+ permissionCodes.length > 0 ? [url4, body, config] : null,
636
628
  (args) => axios2.post(...args).then((response) => response.data.data)
637
629
  );
638
630
  let newData;
@@ -2570,6 +2562,7 @@ var init_userList = __esm({
2570
2562
  const remove = useRemoveUser();
2571
2563
  const { mutate: mutate2, refetch } = useQueryListStore();
2572
2564
  const { permissionVersion } = useToolkitsStore((s) => s);
2565
+ const isV3 = permissionVersion === "v3" /* V3 */;
2573
2566
  const { show: showCreateModal, modal: createModal } = useCreateUserModal({
2574
2567
  onSuccess() {
2575
2568
  refetch(url2, { page: 1 });
@@ -2600,7 +2593,7 @@ var init_userList = __esm({
2600
2593
  dataIndex: "name",
2601
2594
  key: "name",
2602
2595
  render(value, record) {
2603
- if (permissionVersion === "v3" /* V3 */) {
2596
+ if (isV3) {
2604
2597
  return /* @__PURE__ */ jsx(Link, { to: `./${record.id}`, children: value });
2605
2598
  }
2606
2599
  return value;
@@ -2611,7 +2604,7 @@ var init_userList = __esm({
2611
2604
  dataIndex: "id",
2612
2605
  key: "id"
2613
2606
  },
2614
- permissionVersion !== "v3" /* V3 */ && {
2607
+ isV3 && {
2615
2608
  title: t("global.role"),
2616
2609
  dataIndex: "roles",
2617
2610
  key: "roles",
@@ -2639,7 +2632,7 @@ var init_userList = __esm({
2639
2632
  type: "link",
2640
2633
  code: "100003",
2641
2634
  onClick: () => {
2642
- if (permissionVersion === "v3" /* V3 */) {
2635
+ if (isV3) {
2643
2636
  showUpdateModalV2({
2644
2637
  initialValues: {
2645
2638
  name,
@@ -2711,7 +2704,7 @@ var init_userList = __esm({
2711
2704
  icon: /* @__PURE__ */ jsx(UserAddOutlined, {}),
2712
2705
  code: "100002",
2713
2706
  onClick: () => {
2714
- if (permissionVersion === "v3" /* V3 */) {
2707
+ if (isV3) {
2715
2708
  showCreateModalV2();
2716
2709
  } else {
2717
2710
  showCreateModal();
@@ -2729,7 +2722,7 @@ var init_userList = __esm({
2729
2722
  columns,
2730
2723
  getTotal: (data) => data?.data.Total,
2731
2724
  getDataSource: (data) => data?.data.List,
2732
- renderForm: (form) => /* @__PURE__ */ jsx(Form, { form, children: /* @__PURE__ */ jsx(Form.Item, { label: "\u540D\u79F0", name: "name", children: /* @__PURE__ */ jsx(Input, {}) }) })
2725
+ renderForm: isV3 ? (form) => /* @__PURE__ */ jsx(Form, { form, children: /* @__PURE__ */ jsx(Form.Item, { label: "\u540D\u79F0", name: "name", children: /* @__PURE__ */ jsx(Input, {}) }) }) : void 0
2733
2726
  }
2734
2727
  )
2735
2728
  }