react-toolkits 2.22.11 → 2.22.12
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 +6 -0
- package/lib/chunk-3N7LFLKJ.js +2 -0
- package/lib/chunk-3N7LFLKJ.js.map +1 -0
- package/lib/chunk-BRZIJDNT.js +2 -0
- package/lib/chunk-BRZIJDNT.js.map +1 -0
- package/lib/chunk-JQHQKJFH.js +2 -0
- package/lib/chunk-JQHQKJFH.js.map +1 -0
- package/lib/chunk-N67BWR5M.js +3 -0
- package/lib/chunk-N67BWR5M.js.map +1 -0
- package/lib/chunk-OLVGFJFN.js +2 -0
- package/lib/chunk-OLVGFJFN.js.map +1 -0
- package/lib/chunk-PB74M2DE.js +2 -0
- package/lib/chunk-PB74M2DE.js.map +1 -0
- package/lib/chunk-PMXRIKKI.js +2 -0
- package/lib/chunk-PMXRIKKI.js.map +1 -0
- package/lib/chunk-S6NRRFWG.js +2 -0
- package/lib/chunk-S6NRRFWG.js.map +1 -0
- package/lib/chunk-ZRGA4NV7.js +2 -0
- package/lib/chunk-ZRGA4NV7.js.map +1 -0
- package/lib/createMenuItem-WS2MRQJF.js +2 -0
- package/lib/createMenuItem-WS2MRQJF.js.map +1 -0
- package/lib/index.css +0 -3
- package/lib/index.d.ts +792 -21
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -0
- package/lib/menuItemList-CVNXJ7CP.js +2 -0
- package/lib/menuItemList-CVNXJ7CP.js.map +1 -0
- package/lib/roleDetail-WPKPZSX2.js +2 -0
- package/lib/roleDetail-WPKPZSX2.js.map +1 -0
- package/lib/roleList-RY6ZEVB4.js +2 -0
- package/lib/roleList-RY6ZEVB4.js.map +1 -0
- package/lib/updateMenuItem-AJRUUJ6K.js +2 -0
- package/lib/updateMenuItem-AJRUUJ6K.js.map +1 -0
- package/lib/userDetail-QQDMP7HT.js +2 -0
- package/lib/userDetail-QQDMP7HT.js.map +1 -0
- package/lib/userList-Q4RULNHM.js +2 -0
- package/lib/userList-Q4RULNHM.js.map +1 -0
- package/locale/context.js +2 -1
- package/locale/context.js.map +1 -0
- package/locale/en_GB.js +2 -1
- package/locale/en_GB.js.map +1 -0
- package/locale/hooks.js +2 -1
- package/locale/hooks.js.map +1 -0
- package/locale/index.js +2 -1
- package/locale/index.js.map +1 -0
- package/locale/ja_JP.js +2 -1
- package/locale/ja_JP.js.map +1 -0
- package/locale/ko_KR.js +2 -1
- package/locale/ko_KR.js.map +1 -0
- package/locale/zh_CN.js +2 -1
- package/locale/zh_CN.js.map +1 -0
- package/package.json +6 -36
- package/lib/components.d.ts +0 -429
- package/lib/components.js +0 -1
- package/lib/constants.d.ts +0 -11
- package/lib/constants.js +0 -2
- package/lib/hooks.d.ts +0 -108
- package/lib/hooks.js +0 -1
- package/lib/logo-L6MFCL6M.png +0 -0
- package/lib/modules.d.ts +0 -7
- package/lib/modules.js +0 -1
- package/lib/pages.d.ts +0 -20
- package/lib/pages.js +0 -2
- package/lib/services.d.ts +0 -196
- package/lib/services.js +0 -1
- package/lib/types-DVKf5poe.d.ts +0 -19
- package/lib/types.d.ts +0 -23
- package/lib/types.js +0 -0
- package/lib/utils.d.ts +0 -6
- package/lib/utils.js +0 -1
package/lib/services.d.ts
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { Options } from 'ky';
|
|
3
|
-
import { G as Game } from './types-DVKf5poe.js';
|
|
4
|
-
import { MenuListItem } from './types.js';
|
|
5
|
-
|
|
6
|
-
declare function usePermission(code?: string | string[], config?: Options): {
|
|
7
|
-
data: boolean | Record<string, boolean>;
|
|
8
|
-
error: Error;
|
|
9
|
-
isError: true;
|
|
10
|
-
isPending: false;
|
|
11
|
-
isLoading: false;
|
|
12
|
-
isLoadingError: false;
|
|
13
|
-
isRefetchError: true;
|
|
14
|
-
isSuccess: false;
|
|
15
|
-
isPlaceholderData: false;
|
|
16
|
-
status: "error";
|
|
17
|
-
dataUpdatedAt: number;
|
|
18
|
-
errorUpdatedAt: number;
|
|
19
|
-
failureCount: number;
|
|
20
|
-
failureReason: Error | null;
|
|
21
|
-
errorUpdateCount: number;
|
|
22
|
-
isFetched: boolean;
|
|
23
|
-
isFetchedAfterMount: boolean;
|
|
24
|
-
isFetching: boolean;
|
|
25
|
-
isInitialLoading: boolean;
|
|
26
|
-
isPaused: boolean;
|
|
27
|
-
isRefetching: boolean;
|
|
28
|
-
isStale: boolean;
|
|
29
|
-
isEnabled: boolean;
|
|
30
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, boolean> & {
|
|
31
|
-
has_all?: boolean;
|
|
32
|
-
}, Error>>;
|
|
33
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
34
|
-
promise: Promise<Record<string, boolean> & {
|
|
35
|
-
has_all?: boolean;
|
|
36
|
-
}>;
|
|
37
|
-
} | {
|
|
38
|
-
data: boolean | Record<string, boolean>;
|
|
39
|
-
error: null;
|
|
40
|
-
isError: false;
|
|
41
|
-
isPending: false;
|
|
42
|
-
isLoading: false;
|
|
43
|
-
isLoadingError: false;
|
|
44
|
-
isRefetchError: false;
|
|
45
|
-
isSuccess: true;
|
|
46
|
-
isPlaceholderData: false;
|
|
47
|
-
status: "success";
|
|
48
|
-
dataUpdatedAt: number;
|
|
49
|
-
errorUpdatedAt: number;
|
|
50
|
-
failureCount: number;
|
|
51
|
-
failureReason: Error | null;
|
|
52
|
-
errorUpdateCount: number;
|
|
53
|
-
isFetched: boolean;
|
|
54
|
-
isFetchedAfterMount: boolean;
|
|
55
|
-
isFetching: boolean;
|
|
56
|
-
isInitialLoading: boolean;
|
|
57
|
-
isPaused: boolean;
|
|
58
|
-
isRefetching: boolean;
|
|
59
|
-
isStale: boolean;
|
|
60
|
-
isEnabled: boolean;
|
|
61
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, boolean> & {
|
|
62
|
-
has_all?: boolean;
|
|
63
|
-
}, Error>>;
|
|
64
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
65
|
-
promise: Promise<Record<string, boolean> & {
|
|
66
|
-
has_all?: boolean;
|
|
67
|
-
}>;
|
|
68
|
-
} | {
|
|
69
|
-
data: boolean | Record<string, boolean>;
|
|
70
|
-
error: Error;
|
|
71
|
-
isError: true;
|
|
72
|
-
isPending: false;
|
|
73
|
-
isLoading: false;
|
|
74
|
-
isLoadingError: true;
|
|
75
|
-
isRefetchError: false;
|
|
76
|
-
isSuccess: false;
|
|
77
|
-
isPlaceholderData: false;
|
|
78
|
-
status: "error";
|
|
79
|
-
dataUpdatedAt: number;
|
|
80
|
-
errorUpdatedAt: number;
|
|
81
|
-
failureCount: number;
|
|
82
|
-
failureReason: Error | null;
|
|
83
|
-
errorUpdateCount: number;
|
|
84
|
-
isFetched: boolean;
|
|
85
|
-
isFetchedAfterMount: boolean;
|
|
86
|
-
isFetching: boolean;
|
|
87
|
-
isInitialLoading: boolean;
|
|
88
|
-
isPaused: boolean;
|
|
89
|
-
isRefetching: boolean;
|
|
90
|
-
isStale: boolean;
|
|
91
|
-
isEnabled: boolean;
|
|
92
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, boolean> & {
|
|
93
|
-
has_all?: boolean;
|
|
94
|
-
}, Error>>;
|
|
95
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
96
|
-
promise: Promise<Record<string, boolean> & {
|
|
97
|
-
has_all?: boolean;
|
|
98
|
-
}>;
|
|
99
|
-
} | {
|
|
100
|
-
data: boolean | Record<string, boolean>;
|
|
101
|
-
error: null;
|
|
102
|
-
isError: false;
|
|
103
|
-
isPending: true;
|
|
104
|
-
isLoading: true;
|
|
105
|
-
isLoadingError: false;
|
|
106
|
-
isRefetchError: false;
|
|
107
|
-
isSuccess: false;
|
|
108
|
-
isPlaceholderData: false;
|
|
109
|
-
status: "pending";
|
|
110
|
-
dataUpdatedAt: number;
|
|
111
|
-
errorUpdatedAt: number;
|
|
112
|
-
failureCount: number;
|
|
113
|
-
failureReason: Error | null;
|
|
114
|
-
errorUpdateCount: number;
|
|
115
|
-
isFetched: boolean;
|
|
116
|
-
isFetchedAfterMount: boolean;
|
|
117
|
-
isFetching: boolean;
|
|
118
|
-
isInitialLoading: boolean;
|
|
119
|
-
isPaused: boolean;
|
|
120
|
-
isRefetching: boolean;
|
|
121
|
-
isStale: boolean;
|
|
122
|
-
isEnabled: boolean;
|
|
123
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, boolean> & {
|
|
124
|
-
has_all?: boolean;
|
|
125
|
-
}, Error>>;
|
|
126
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
127
|
-
promise: Promise<Record<string, boolean> & {
|
|
128
|
-
has_all?: boolean;
|
|
129
|
-
}>;
|
|
130
|
-
} | {
|
|
131
|
-
data: boolean | Record<string, boolean>;
|
|
132
|
-
error: null;
|
|
133
|
-
isError: false;
|
|
134
|
-
isPending: true;
|
|
135
|
-
isLoadingError: false;
|
|
136
|
-
isRefetchError: false;
|
|
137
|
-
isSuccess: false;
|
|
138
|
-
isPlaceholderData: false;
|
|
139
|
-
status: "pending";
|
|
140
|
-
dataUpdatedAt: number;
|
|
141
|
-
errorUpdatedAt: number;
|
|
142
|
-
failureCount: number;
|
|
143
|
-
failureReason: Error | null;
|
|
144
|
-
errorUpdateCount: number;
|
|
145
|
-
isFetched: boolean;
|
|
146
|
-
isFetchedAfterMount: boolean;
|
|
147
|
-
isFetching: boolean;
|
|
148
|
-
isLoading: boolean;
|
|
149
|
-
isInitialLoading: boolean;
|
|
150
|
-
isPaused: boolean;
|
|
151
|
-
isRefetching: boolean;
|
|
152
|
-
isStale: boolean;
|
|
153
|
-
isEnabled: boolean;
|
|
154
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, boolean> & {
|
|
155
|
-
has_all?: boolean;
|
|
156
|
-
}, Error>>;
|
|
157
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
158
|
-
promise: Promise<Record<string, boolean> & {
|
|
159
|
-
has_all?: boolean;
|
|
160
|
-
}>;
|
|
161
|
-
} | {
|
|
162
|
-
data: boolean | Record<string, boolean>;
|
|
163
|
-
isError: false;
|
|
164
|
-
error: null;
|
|
165
|
-
isPending: false;
|
|
166
|
-
isLoading: false;
|
|
167
|
-
isLoadingError: false;
|
|
168
|
-
isRefetchError: false;
|
|
169
|
-
isSuccess: true;
|
|
170
|
-
isPlaceholderData: true;
|
|
171
|
-
status: "success";
|
|
172
|
-
dataUpdatedAt: number;
|
|
173
|
-
errorUpdatedAt: number;
|
|
174
|
-
failureCount: number;
|
|
175
|
-
failureReason: Error | null;
|
|
176
|
-
errorUpdateCount: number;
|
|
177
|
-
isFetched: boolean;
|
|
178
|
-
isFetchedAfterMount: boolean;
|
|
179
|
-
isFetching: boolean;
|
|
180
|
-
isInitialLoading: boolean;
|
|
181
|
-
isPaused: boolean;
|
|
182
|
-
isRefetching: boolean;
|
|
183
|
-
isStale: boolean;
|
|
184
|
-
isEnabled: boolean;
|
|
185
|
-
refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<Record<string, boolean> & {
|
|
186
|
-
has_all?: boolean;
|
|
187
|
-
}, Error>>;
|
|
188
|
-
fetchStatus: _tanstack_react_query.FetchStatus;
|
|
189
|
-
promise: Promise<Record<string, boolean> & {
|
|
190
|
-
has_all?: boolean;
|
|
191
|
-
}>;
|
|
192
|
-
};
|
|
193
|
-
declare function useMenuList(): _tanstack_react_query.UseQueryResult<MenuListItem[], Error>;
|
|
194
|
-
declare const useGames: () => _tanstack_react_query.UseQueryResult<Game[], Error>;
|
|
195
|
-
|
|
196
|
-
export { useGames, useMenuList, usePermission };
|
package/lib/services.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {useQuery}from'@tanstack/react-query';import {App}from'antd';import {createContext,useContext,useMemo}from'react';import {useStore}from'zustand';import'react/jsx-runtime';import N from'ky';var y="App-ID";var U=createContext(null);function T(e){let t=useContext(U);if(!t)throw new Error("Missing ToolkitsProvider in the tree");return useStore(t,(r=>r))}var x=[0,1,200],E={OK:200,UNAUTHORIZED:401,FORBIDDEN:403,UNREGISTERED:412},M=3e4;var b=e=>!e||typeof e!="object"?"Unknown error":e.msg||e.message||e.error||"Unknown error",V=e=>{let{value:t,allowedCodes:r}=e;return t==null||typeof t!="number"?!1:r.includes(t)},G=(e,t)=>{if(t<E.OK||t>=300)return !1;if(!e||typeof e!="object")return !0;let r=[{field:"code",value:e.code,allowedCodes:x},{field:"status",value:e.status,allowedCodes:x},{field:"errno",value:e.errno,allowedCodes:x}];return r.some(i=>i.value!==void 0&&i.value!==null)?r.every(i=>i.value===void 0||i.value===null||V(i)):!0},H=async(e,t)=>{switch(t){case"blob":return e.blob();case"text":return e.text();case"arrayBuffer":return e.arrayBuffer();case"formData":return e.formData();case"json":default:return e.json()}},k=e=>{let{notification:t}=App.useApp(),r=T(),{token:u,isGlobal:i,gameId:l,permissionVersion:g,signInPath:c,clearToken:P}=r,R=()=>{P(),c&&(window.location.href=c);},S=()=>{if(P(),c){let s=new URL(c,window.location.origin);s.searchParams.set("unregistered","true"),window.location.href=s.toString();}},O=()=>{t.error({message:"\u8BBF\u95EE\u88AB\u7981\u6B62",description:"\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u6B64\u8D44\u6E90\u3002"});},q=s=>async(o,n,p)=>{if(s==="blob"||s==="arrayBuffer"||s==="text"||s==="formData")return p;let a;try{a=await p.clone().json();}catch{return p}if(G(a,p.status)){let h=a.data!==void 0?a.data:a;return new Response(JSON.stringify(h),{status:p.status,statusText:p.statusText,headers:p.headers})}let d=b(a);t.error({message:"Request failed",description:d});let f=new Error(d);throw f.response=p,f.data=a,f},A=(s,o)=>{switch(s){case E.UNAUTHORIZED:R();break;case E.UNREGISTERED:S();break;case E.FORBIDDEN:O();break;default:{let n=b(o)||`HTTP ${s} Error`;t.error({message:"Request failed",description:n});break}}},C=useMemo(()=>N.create({prefixUrl:e,retry:0,timeout:M,headers:{Accept:"application/json","Content-Type":"application/json"},hooks:{beforeRequest:[o=>{u&&o.headers.set("Authorization",`Bearer ${u}`),!o.headers.has(y)&&g!=="v1"&&(i||!l?o.headers.set(y,"global"):o.headers.set(y,encodeURIComponent(String(l))));}],beforeError:[async o=>{let{response:n}=o;if(n){let p=n.status,a;try{let d=n.headers.get("content-type")||"";(d.includes("application/json")||d.startsWith("text/"))&&(a=await n.clone().json());}catch{}A(p,a);}else t.error({message:"Network Error",description:o.message||"Network request failed"});return o}]}}),[e,u,i,l,g]),m=async(s,o,n,p)=>{let{responseType:a,...d}=p||{},f={...d,hooks:{...d.hooks,afterResponse:[...d.hooks?.afterResponse||[],q(a)]}},h;return n?h=await C(o,{method:s,json:n,...f}):h=await C(o,{method:s,...f}),H(h,a)};return {get:(s,o)=>m("GET",s,void 0,o),post:(s,o,n)=>m("POST",s,o,n),put:(s,o,n)=>m("PUT",s,o,n),delete:(s,o)=>m("DELETE",s,void 0,o),patch:(s,o,n)=>m("PATCH",s,o,n),options:(s,o)=>m("OPTIONS",s,void 0,o),head:(s,o)=>m("HEAD",s,void 0,o),request:s=>{let{url:o,...n}=s;return m(n.method||"GET",o,void 0,n)},instance:C}};var v={permissions:{check:(e,t)=>["permissions","check",e,t],allPermissions:["permissions","all"],allPermissionsV2:["permissions","allV2"]},users:{all:["users"],detail:e=>["users","detail",e],create:["users","create"],update:["users","update"],delete:["users","delete"]},roles:{all:["roles"],detail:(e,t)=>["roles","detail",e,t],create:e=>["roles","create",e],update:e=>["roles","update",e],delete:["roles","delete"]},menus:{all:["menus"],navbar:e=>["menus","navbar",e],detail:e=>["menus","detail",e],create:["menus","create"],update:["menus","update"],delete:["menus","delete"]},enums:{gameGroups:["enums","gameGroups"],gameIds:e=>["enums","gameIds",e]}};function ve(e,t){let r=k(),{permissionVersion:u}=T(),i=u!=="v1"?"/api/usystem/user/checkV2":"/api/usystem/user/check",l=typeof e<"u"?typeof e=="string"?[e]:e:[],g=u!=="v1"?"v2":"v1",{data:c,...P}=useQuery({queryKey:l.length>0?v.permissions.check(l,g):["permissions","disabled"],queryFn:()=>r.post(i,{json:{permissions:l},...t}),enabled:l.length>0}),R=!0;return typeof e=="string"?R=c?.has_all?!0:c?.[e]??!1:Array.isArray(e)&&e.length>0&&(R=l.reduce((S,O)=>(S[O]=c?.has_all?!0:c?.[O]??!1,S),{})),{...P,data:R}}function Ce(){let{signInPath:e,gameId:t}=T(),r=k();return useQuery({queryKey:v.menus.navbar(t?String(t):void 0),queryFn:()=>r.get("/api/usystem/menu/navbar",{headers:{[y]:t?encodeURIComponent(String(t)):"global"}}),enabled:window.location.pathname!==e})}var xe=()=>{let{gameApiV2:e,permissionVersion:t}=T(),r=k(),u=t!=="v1"?e?"/api/game/list":"/api/usystem/game/all":null;return useQuery({queryKey:v.enums.gameGroups,queryFn:async()=>{if(!u)return [];let i={headers:{[y]:"global"}};return e?(await r.get(u,i))?.list??[]:await r.get(u,i)??[]},enabled:!!u,staleTime:1/0})};export{xe as useGames,Ce as useMenuList,ve as usePermission};
|
package/lib/types-DVKf5poe.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
type Area = 'all' | 'cn' | 'global';
|
|
2
|
-
type ScreenOrientation = 0 | 1;
|
|
3
|
-
interface Game {
|
|
4
|
-
id: number;
|
|
5
|
-
game_id: string | number;
|
|
6
|
-
game_group: string;
|
|
7
|
-
name: string;
|
|
8
|
-
screen_type: ScreenOrientation;
|
|
9
|
-
area: Area;
|
|
10
|
-
icon: string;
|
|
11
|
-
auth: string;
|
|
12
|
-
ctime: string;
|
|
13
|
-
mtime: string;
|
|
14
|
-
is_delete: 0 | 1;
|
|
15
|
-
is_new_game: 0 | 1;
|
|
16
|
-
server_type: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type { Game as G };
|
package/lib/types.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
interface Permission {
|
|
2
|
-
label: string;
|
|
3
|
-
value: string;
|
|
4
|
-
route: string;
|
|
5
|
-
method?: string;
|
|
6
|
-
}
|
|
7
|
-
interface MenuListItem {
|
|
8
|
-
id: number;
|
|
9
|
-
category: string;
|
|
10
|
-
is_common: boolean;
|
|
11
|
-
is_model: boolean;
|
|
12
|
-
model_name: string;
|
|
13
|
-
permissions: Permission[];
|
|
14
|
-
front_route: string;
|
|
15
|
-
order: number;
|
|
16
|
-
scheme: string;
|
|
17
|
-
ext: string;
|
|
18
|
-
}
|
|
19
|
-
type RecursivePartial<T> = NonNullable<T> extends object ? {
|
|
20
|
-
[P in keyof T]?: NonNullable<T[P]> extends (infer U)[] ? RecursivePartial<U>[] : NonNullable<T[P]> extends object ? RecursivePartial<T[P]> : T[P];
|
|
21
|
-
} : T;
|
|
22
|
-
|
|
23
|
-
export type { MenuListItem, Permission, RecursivePartial };
|
package/lib/types.js
DELETED
|
File without changes
|
package/lib/utils.d.ts
DELETED
package/lib/utils.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s={getItem:t=>sessionStorage.getItem(t)||localStorage.getItem(t),setItem:(t,e)=>{sessionStorage.setItem(t,e),localStorage.setItem(t,e);},removeItem(t){sessionStorage.removeItem(t),localStorage.removeItem(t);}},r=0,n=()=>{let t=Date.now(),e=Math.floor(Math.random()*1e3),o=++r%1e3;return t*1e6+e*1e3+o};export{n as generateId,s as mixedStorage};
|