react-toolkits 2.13.29 → 2.13.31

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.31
4
+
5
+ ### Patch Changes
6
+
7
+ - e423d66: fix: app-id should be 'global' when disallowed changing game
8
+
9
+ ## 2.13.30
10
+
11
+ ### Patch Changes
12
+
13
+ - a30b5ea: fix: missing 'getOptions' prop in Layout component
14
+
3
15
  ## 2.13.29
4
16
 
5
17
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -133,6 +133,7 @@ interface LayoutProps extends Pick<GameSelectProps, 'filter'> {
133
133
  items?: NavMenuItem[];
134
134
  hideGameSelect?: boolean;
135
135
  navWidth?: string | number;
136
+ getGameSelectOptions?: GameSelectProps['getOptions'];
136
137
  headerExtra?: {
137
138
  left?: HeaderExtra[];
138
139
  right?: HeaderExtra[];
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;
@@ -972,7 +964,17 @@ var init_Layout = __esm({
972
964
  ({ Spin: Spin5, theme: theme3 } = Antd2);
973
965
  ({ Header, Sider, Content } = Antd2.Layout);
974
966
  Layout2 = (props) => {
975
- const { collapsible, isMenuLoading, items, headerExtra, children, navWidth, hideGameSelect, filter } = props;
967
+ const {
968
+ collapsible,
969
+ isMenuLoading,
970
+ items,
971
+ headerExtra,
972
+ children,
973
+ navWidth,
974
+ hideGameSelect,
975
+ filter,
976
+ getGameSelectOptions
977
+ } = props;
976
978
  const {
977
979
  token: { colorBgContainer, colorBorder }
978
980
  } = theme3.useToken();
@@ -1043,7 +1045,7 @@ var init_Layout = __esm({
1043
1045
  onClick: onCollapse
1044
1046
  }
1045
1047
  ),
1046
- permissionVersion !== "v1" /* V1 */ && !hideGameSelect && /* @__PURE__ */ jsx(GameSelect_default, { filter }),
1048
+ permissionVersion !== "v1" /* V1 */ && !hideGameSelect && /* @__PURE__ */ jsx(GameSelect_default, { filter, getOptions: getGameSelectOptions }),
1047
1049
  headerExtra?.left?.map((extra) => /* @__PURE__ */ jsx("span", { children: extra.children }, extra.key))
1048
1050
  ] }),
1049
1051
  /* @__PURE__ */ jsxs(Space, { size: "small", split: /* @__PURE__ */ jsx(Divider, { type: "vertical" }), children: [