react-toolkits 2.13.31 → 2.13.33
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 +12 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +17 -17
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ declare const NavMenu: react.NamedExoticComponent<NavMenuProps>;
|
|
|
120
120
|
|
|
121
121
|
interface GameSelectProps {
|
|
122
122
|
filter?: (game: Game) => boolean;
|
|
123
|
-
|
|
123
|
+
options?: (data?: Game[]) => SelectProps['options'];
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
type HeaderExtra = {
|
|
@@ -133,7 +133,7 @@ interface LayoutProps extends Pick<GameSelectProps, 'filter'> {
|
|
|
133
133
|
items?: NavMenuItem[];
|
|
134
134
|
hideGameSelect?: boolean;
|
|
135
135
|
navWidth?: string | number;
|
|
136
|
-
|
|
136
|
+
gameSelectOptions?: GameSelectProps['options'];
|
|
137
137
|
headerExtra?: {
|
|
138
138
|
left?: HeaderExtra[];
|
|
139
139
|
right?: HeaderExtra[];
|
package/lib/index.js
CHANGED
|
@@ -909,13 +909,13 @@ var init_GameSelect = __esm({
|
|
|
909
909
|
init_hooks3();
|
|
910
910
|
({ Text } = Typography);
|
|
911
911
|
GameSelect = (props) => {
|
|
912
|
-
const { filter,
|
|
912
|
+
const { filter, options } = props;
|
|
913
913
|
const { t } = useTranslation();
|
|
914
914
|
const { gameApiV2, gameId, setGameId } = useToolkitsStore((s) => s);
|
|
915
915
|
const { data, isLoading } = useGames();
|
|
916
916
|
const { mutate: mutate2 } = useSWRConfig();
|
|
917
917
|
const filteredData = data?.filter((item) => filter?.(item) ?? true);
|
|
918
|
-
const
|
|
918
|
+
const _options = typeof options === "function" ? options(filteredData) : filteredData?.map((item) => ({
|
|
919
919
|
label: item.name,
|
|
920
920
|
value: gameApiV2 ? item.game_id : item.id
|
|
921
921
|
}));
|
|
@@ -924,14 +924,13 @@ var init_GameSelect = __esm({
|
|
|
924
924
|
setGameId(value);
|
|
925
925
|
};
|
|
926
926
|
useEffect(() => {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
setGameId(id2);
|
|
927
|
+
if (data && data.length > 0) {
|
|
928
|
+
const firstId = gameApiV2 ? data[0].game_id : data[0].id;
|
|
929
|
+
if (data.every((item) => String(item.game_id || item.id) !== String(gameId))) {
|
|
930
|
+
setGameId(firstId);
|
|
931
|
+
}
|
|
933
932
|
}
|
|
934
|
-
}, [
|
|
933
|
+
}, [data]);
|
|
935
934
|
return /* @__PURE__ */ jsxs(Space, { children: [
|
|
936
935
|
/* @__PURE__ */ jsx(Text, { children: t("GameSelect.label") }),
|
|
937
936
|
/* @__PURE__ */ jsx(
|
|
@@ -943,7 +942,7 @@ var init_GameSelect = __esm({
|
|
|
943
942
|
placeholder: t("GameSelect.placeholder"),
|
|
944
943
|
loading: isLoading,
|
|
945
944
|
style: { width: "200px" },
|
|
946
|
-
options,
|
|
945
|
+
options: _options,
|
|
947
946
|
onChange
|
|
948
947
|
}
|
|
949
948
|
)
|
|
@@ -973,7 +972,7 @@ var init_Layout = __esm({
|
|
|
973
972
|
navWidth,
|
|
974
973
|
hideGameSelect,
|
|
975
974
|
filter,
|
|
976
|
-
|
|
975
|
+
gameSelectOptions
|
|
977
976
|
} = props;
|
|
978
977
|
const {
|
|
979
978
|
token: { colorBgContainer, colorBorder }
|
|
@@ -1045,7 +1044,7 @@ var init_Layout = __esm({
|
|
|
1045
1044
|
onClick: onCollapse
|
|
1046
1045
|
}
|
|
1047
1046
|
),
|
|
1048
|
-
permissionVersion !== "v1" /* V1 */ && !hideGameSelect && /* @__PURE__ */ jsx(GameSelect_default, { filter,
|
|
1047
|
+
permissionVersion !== "v1" /* V1 */ && !hideGameSelect && /* @__PURE__ */ jsx(GameSelect_default, { filter, options: gameSelectOptions }),
|
|
1049
1048
|
headerExtra?.left?.map((extra) => /* @__PURE__ */ jsx("span", { children: extra.children }, extra.key))
|
|
1050
1049
|
] }),
|
|
1051
1050
|
/* @__PURE__ */ jsxs(Space, { size: "small", split: /* @__PURE__ */ jsx(Divider, { type: "vertical" }), children: [
|
|
@@ -2562,6 +2561,7 @@ var init_userList = __esm({
|
|
|
2562
2561
|
const remove = useRemoveUser();
|
|
2563
2562
|
const { mutate: mutate2, refetch } = useQueryListStore();
|
|
2564
2563
|
const { permissionVersion } = useToolkitsStore((s) => s);
|
|
2564
|
+
const isV3 = permissionVersion === "v3" /* V3 */;
|
|
2565
2565
|
const { show: showCreateModal, modal: createModal } = useCreateUserModal({
|
|
2566
2566
|
onSuccess() {
|
|
2567
2567
|
refetch(url2, { page: 1 });
|
|
@@ -2592,7 +2592,7 @@ var init_userList = __esm({
|
|
|
2592
2592
|
dataIndex: "name",
|
|
2593
2593
|
key: "name",
|
|
2594
2594
|
render(value, record) {
|
|
2595
|
-
if (
|
|
2595
|
+
if (isV3) {
|
|
2596
2596
|
return /* @__PURE__ */ jsx(Link, { to: `./${record.id}`, children: value });
|
|
2597
2597
|
}
|
|
2598
2598
|
return value;
|
|
@@ -2603,7 +2603,7 @@ var init_userList = __esm({
|
|
|
2603
2603
|
dataIndex: "id",
|
|
2604
2604
|
key: "id"
|
|
2605
2605
|
},
|
|
2606
|
-
|
|
2606
|
+
isV3 && {
|
|
2607
2607
|
title: t("global.role"),
|
|
2608
2608
|
dataIndex: "roles",
|
|
2609
2609
|
key: "roles",
|
|
@@ -2631,7 +2631,7 @@ var init_userList = __esm({
|
|
|
2631
2631
|
type: "link",
|
|
2632
2632
|
code: "100003",
|
|
2633
2633
|
onClick: () => {
|
|
2634
|
-
if (
|
|
2634
|
+
if (isV3) {
|
|
2635
2635
|
showUpdateModalV2({
|
|
2636
2636
|
initialValues: {
|
|
2637
2637
|
name,
|
|
@@ -2703,7 +2703,7 @@ var init_userList = __esm({
|
|
|
2703
2703
|
icon: /* @__PURE__ */ jsx(UserAddOutlined, {}),
|
|
2704
2704
|
code: "100002",
|
|
2705
2705
|
onClick: () => {
|
|
2706
|
-
if (
|
|
2706
|
+
if (isV3) {
|
|
2707
2707
|
showCreateModalV2();
|
|
2708
2708
|
} else {
|
|
2709
2709
|
showCreateModal();
|
|
@@ -2721,7 +2721,7 @@ var init_userList = __esm({
|
|
|
2721
2721
|
columns,
|
|
2722
2722
|
getTotal: (data) => data?.data.Total,
|
|
2723
2723
|
getDataSource: (data) => data?.data.List,
|
|
2724
|
-
renderForm: (form) => /* @__PURE__ */ jsx(Form, { form, children: /* @__PURE__ */ jsx(Form.Item, { label: "\u540D\u79F0", name: "name", children: /* @__PURE__ */ jsx(Input, {}) }) })
|
|
2724
|
+
renderForm: isV3 ? (form) => /* @__PURE__ */ jsx(Form, { form, children: /* @__PURE__ */ jsx(Form.Item, { label: "\u540D\u79F0", name: "name", children: /* @__PURE__ */ jsx(Input, {}) }) }) : void 0
|
|
2725
2725
|
}
|
|
2726
2726
|
)
|
|
2727
2727
|
}
|