react-toolkits 2.9.4 → 2.9.6

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.9.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 17dcf26: feat: add theme prop
8
+
9
+ ## 2.9.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 9509968: feat: change game_id type
14
+
3
15
  ## 2.9.4
4
16
 
5
17
  ### Patch Changes
package/lib/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import * as react from 'react';
3
3
  import { FC, PropsWithChildren, Key, ReactNode, ReactElement, Ref } from 'react';
4
4
  import { ParagraphProps } from 'antd/es/typography/Paragraph';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
6
- import { FormInstance, ButtonProps, ModalProps, FormProps } from 'antd';
6
+ import { FormInstance, MenuProps, ButtonProps, ModalProps, FormProps } from 'antd';
7
7
  import { TableProps } from 'antd/es/table';
8
8
  import { MenuDividerType, MenuItemType, SubMenuType, MenuItemGroupType } from 'antd/es/menu/interface';
9
9
  import { Merge } from 'ts-essentials';
@@ -201,6 +201,7 @@ type NavMenuItem = MenuItemType2 | SubMenuType2 | MenuItemGroupType2 | MenuDivid
201
201
 
202
202
  interface NavMenuProps {
203
203
  items?: NavMenuItem[];
204
+ theme?: MenuProps['theme'];
204
205
  }
205
206
  declare const NavMenu: react.NamedExoticComponent<NavMenuProps>;
206
207
 
@@ -208,7 +209,7 @@ type Area = 'all' | 'cn' | 'global';
208
209
  type ScreenLayoutType = 0 | 1;
209
210
  interface Game {
210
211
  id: number;
211
- game_id: number;
212
+ game_id: string | number;
212
213
  game_group: string;
213
214
  name: string;
214
215
  screen_type: ScreenLayoutType;
@@ -226,10 +227,8 @@ interface GameState {
226
227
  game: Game | null;
227
228
  games: Game[];
228
229
  isLoading: boolean;
229
- switching: boolean;
230
- setGame: (id: number) => Promise<void>;
230
+ setGame: (id: string | number) => Promise<void>;
231
231
  refetchGames: () => Promise<void>;
232
- setSwitching: (switching: boolean) => void;
233
232
  }
234
233
 
235
234
  interface GameSelectProps {
package/lib/index.js CHANGED
@@ -61,7 +61,7 @@ var init_en_GB = __esm({
61
61
  SignIn: {
62
62
  title: "Sign In Method",
63
63
  thirdParty: "Third party sign in",
64
- signInWithIDass: "Sign in width IDass",
64
+ signInWithIDass: "Sign in with IDass",
65
65
  unregistered: "You are not yet registered on the platform, please contact the administrator",
66
66
  welcome: "Welcome"
67
67
  },
@@ -385,7 +385,7 @@ var init_NavMenu = __esm({
385
385
  init_stores();
386
386
  init_utils();
387
387
  NavMenu = memo(function NavMenu2(props) {
388
- const { items } = props;
388
+ const { items, theme: theme4 } = props;
389
389
  const location = useLocation();
390
390
  const flattenItems = useMemo(() => flatItems(items ?? []), [items]);
391
391
  const codes = useMemo(() => flattenItems.map((item) => item.code).filter(Boolean), [flattenItems]);
@@ -415,6 +415,7 @@ var init_NavMenu = __esm({
415
415
  return /* @__PURE__ */ jsx(
416
416
  Menu,
417
417
  {
418
+ theme: theme4,
418
419
  style: { borderRight: "none" },
419
420
  items: internalItems,
420
421
  mode: "inline",
@@ -583,16 +584,17 @@ var init_stores2 = __esm({
583
584
  (set, get2) => ({
584
585
  initialized: false,
585
586
  isLoading: false,
586
- switching: false,
587
587
  game: null,
588
588
  games: [],
589
589
  async setGame(id2) {
590
- const { initialized, refetchGames } = get2();
591
- if (!initialized) {
592
- await refetchGames();
590
+ if (id2 === get2().game?.game_id) {
591
+ return;
593
592
  }
594
- const matchedGame = (get2().games ?? []).find((item) => item.game_id === id2);
595
- set({ game: matchedGame ?? null });
593
+ if (!get2().initialized) {
594
+ await get2().refetchGames();
595
+ }
596
+ const game = (get2().games ?? []).find((item) => item.game_id === id2) ?? null;
597
+ set({ game });
596
598
  },
597
599
  async refetchGames() {
598
600
  if (!get2().isLoading) {
@@ -607,8 +609,7 @@ var init_stores2 = __esm({
607
609
  });
608
610
  }
609
611
  }
610
- },
611
- setSwitching: (switching) => set({ switching })
612
+ }
612
613
  }),
613
614
  {
614
615
  name: "game",
@@ -638,7 +639,7 @@ var init_GameSelect = __esm({
638
639
  }));
639
640
  const onChange = async (id2) => {
640
641
  setGame(id2);
641
- onGameChange?.(games.find((item) => item.game_id === id2));
642
+ onGameChange?.(games.find((item) => String(item.game_id) === String(id2)));
642
643
  };
643
644
  return /* @__PURE__ */ jsxs(Space, { children: [
644
645
  /* @__PURE__ */ jsx(Text, { children: t("GameSelect.label") }),