@topthink/common 1.5.28 → 1.5.30
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/lib/index.js +9 -9
- package/lib/index.js.map +1 -1
- package/package.json +53 -54
- package/scss/app.scss +9 -9
- package/scss/menu.scss +402 -402
- package/types/components/access.d.ts +8 -8
- package/types/components/app-provider.d.ts +12 -12
- package/types/components/content.d.ts +13 -13
- package/types/components/header.d.ts +8 -8
- package/types/components/link-button.d.ts +6 -6
- package/types/components/user-provider.d.ts +15 -15
- package/types/components/with-request.d.ts +9 -9
- package/types/hooks/use-route-handle.d.ts +1 -1
- package/types/index.d.ts +39 -39
- package/types/layout/sider/context.d.ts +13 -13
- package/types/layout/sider/index.d.ts +14 -14
- package/types/layout/sider/toggle.d.ts +1 -1
- package/types/layout/tab.d.ts +9 -9
- package/types/layout/use-menu.d.ts +3 -3
- package/types/pages/login.d.ts +10 -10
- package/types/pages/logout.d.ts +5 -5
- package/types/pages/social.d.ts +8 -8
- package/types/theme.d.ts +7 -7
- package/types/utils/create-application.d.ts +23 -23
- package/types/utils/get-menu-data.d.ts +11 -11
- package/types/utils/transform-routes.d.ts +2 -2
- package/types/utils/types.d.ts +19 -19
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { User } from '../utils/types';
|
|
3
|
-
export interface AccessProps {
|
|
4
|
-
require?: string | string[] | ((user: User) => boolean);
|
|
5
|
-
fallback?: ReactNode;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export default function Access({ require, children, fallback }: AccessProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { User } from '../utils/types';
|
|
3
|
+
export interface AccessProps {
|
|
4
|
+
require?: string | string[] | ((user: User) => boolean);
|
|
5
|
+
fallback?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export default function Access({ require, children, fallback }: AccessProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import { App, AppResolver } from '../utils/types';
|
|
3
|
-
type AppContextType = [App, Dispatch<SetStateAction<App>>];
|
|
4
|
-
export declare const AppContext: import("react").Context<AppContextType | null>;
|
|
5
|
-
interface Props {
|
|
6
|
-
appResolver?: AppResolver;
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}
|
|
9
|
-
export default function AppProvider({ appResolver, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare function useAppState(): AppContextType;
|
|
11
|
-
export declare function useApp(): App;
|
|
12
|
-
export {};
|
|
1
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
+
import { App, AppResolver } from '../utils/types';
|
|
3
|
+
type AppContextType = [App, Dispatch<SetStateAction<App>>];
|
|
4
|
+
export declare const AppContext: import("react").Context<AppContextType | null>;
|
|
5
|
+
interface Props {
|
|
6
|
+
appResolver?: AppResolver;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export default function AppProvider({ appResolver, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function useAppState(): AppContextType;
|
|
11
|
+
export declare function useApp(): App;
|
|
12
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ElementType, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
-
interface ContentProps<As extends ElementType = ElementType> {
|
|
3
|
-
title?: ReactNode;
|
|
4
|
-
header?: ReactNode;
|
|
5
|
-
nav?: ReactNode;
|
|
6
|
-
extra?: ReactNode;
|
|
7
|
-
showBack?: boolean | string;
|
|
8
|
-
fixed?: boolean | number;
|
|
9
|
-
className?: string;
|
|
10
|
-
bodyAs?: As;
|
|
11
|
-
}
|
|
12
|
-
export default function Content({ title, header, nav, children, extra, showBack, className, bodyAs, fixed }: PropsWithChildren<ContentProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
1
|
+
import { ElementType, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
interface ContentProps<As extends ElementType = ElementType> {
|
|
3
|
+
title?: ReactNode;
|
|
4
|
+
header?: ReactNode;
|
|
5
|
+
nav?: ReactNode;
|
|
6
|
+
extra?: ReactNode;
|
|
7
|
+
showBack?: boolean | string;
|
|
8
|
+
fixed?: boolean | number;
|
|
9
|
+
className?: string;
|
|
10
|
+
bodyAs?: As;
|
|
11
|
+
}
|
|
12
|
+
export default function Content({ title, header, nav, children, extra, showBack, className, bodyAs, fixed }: PropsWithChildren<ContentProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
-
interface Props {
|
|
3
|
-
menus: ReactNode;
|
|
4
|
-
className?: string;
|
|
5
|
-
logo?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export default function Header({ children, menus, className, logo }: PropsWithChildren<Props>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
menus: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
logo?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function Header({ children, menus, className, logo }: PropsWithChildren<Props>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LinkProps } from 'react-router-dom';
|
|
2
|
-
import { ButtonProps } from '@topthink/components';
|
|
3
|
-
interface Props extends ButtonProps, Pick<LinkProps, 'to' | 'replace'> {
|
|
4
|
-
}
|
|
5
|
-
export default function LinkButton({ to, replace, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
1
|
+
import { LinkProps } from 'react-router-dom';
|
|
2
|
+
import { ButtonProps } from '@topthink/components';
|
|
3
|
+
interface Props extends ButtonProps, Pick<LinkProps, 'to' | 'replace'> {
|
|
4
|
+
}
|
|
5
|
+
export default function LinkButton({ to, replace, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { User, UserResolver } from '../utils/types';
|
|
3
|
-
type UserContextType = [User, Dispatch<SetStateAction<User>>, () => void] & {
|
|
4
|
-
user: User;
|
|
5
|
-
setUser: Dispatch<SetStateAction<User>>;
|
|
6
|
-
refresh: () => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const UserContext: React.Context<UserContextType | null>;
|
|
9
|
-
interface Props {
|
|
10
|
-
userResolver: UserResolver;
|
|
11
|
-
onResolved: (user: User) => void;
|
|
12
|
-
}
|
|
13
|
-
declare const UserProvider: ({ userResolver, onResolved }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare function useUser(): UserContextType;
|
|
15
|
-
export default UserProvider;
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { User, UserResolver } from '../utils/types';
|
|
3
|
+
type UserContextType = [User, Dispatch<SetStateAction<User>>, () => void] & {
|
|
4
|
+
user: User;
|
|
5
|
+
setUser: Dispatch<SetStateAction<User>>;
|
|
6
|
+
refresh: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const UserContext: React.Context<UserContextType | null>;
|
|
9
|
+
interface Props {
|
|
10
|
+
userResolver: UserResolver;
|
|
11
|
+
onResolved: (user: User) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const UserProvider: ({ userResolver, onResolved }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function useUser(): UserContextType;
|
|
15
|
+
export default UserProvider;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { RequestConfig } from '@topthink/components';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
interface Props {
|
|
4
|
-
request: RequestConfig;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
export default function WithRequest({ request, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare function useRequestData<T = any>(): T;
|
|
9
|
-
export {};
|
|
1
|
+
import { RequestConfig } from '@topthink/components';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
request: RequestConfig;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export default function WithRequest({ request, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function useRequestData<T = any>(): T;
|
|
9
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useRouteHandle(): Record<string, any>;
|
|
1
|
+
export default function useRouteHandle(): Record<string, any>;
|
package/types/index.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { App } from './utils/types';
|
|
2
|
-
declare module 'react-router-dom' {
|
|
3
|
-
interface Metadata {
|
|
4
|
-
title?: string;
|
|
5
|
-
icon?: string;
|
|
6
|
-
hideInMenu?: boolean;
|
|
7
|
-
hideChildrenInMenu?: boolean;
|
|
8
|
-
hideMenu?: boolean;
|
|
9
|
-
access?: number | string | string[] | ((app: App) => boolean);
|
|
10
|
-
href?: string;
|
|
11
|
-
}
|
|
12
|
-
interface IndexRouteObject {
|
|
13
|
-
meta?: Metadata;
|
|
14
|
-
}
|
|
15
|
-
interface NonIndexRouteObject {
|
|
16
|
-
meta?: Metadata;
|
|
17
|
-
}
|
|
18
|
-
function useMatches(): {
|
|
19
|
-
id: string;
|
|
20
|
-
pathname: string;
|
|
21
|
-
params: Record<string, string | undefined>;
|
|
22
|
-
data: unknown;
|
|
23
|
-
handle: Record<string, any>;
|
|
24
|
-
}[];
|
|
25
|
-
}
|
|
26
|
-
export { default as SiderLayout } from './layout/sider';
|
|
27
|
-
export { default as TabLayout } from './layout/tab';
|
|
28
|
-
export { default as Header } from './components/header';
|
|
29
|
-
export { default as Access } from './components/access';
|
|
30
|
-
export { default as Content } from './components/content';
|
|
31
|
-
export { default as LinkButton } from './components/link-button';
|
|
32
|
-
export { useUser } from './components/user-provider';
|
|
33
|
-
export { useApp, useAppState } from './components/app-provider';
|
|
34
|
-
export { default as WithRequest, useRequestData } from './components/with-request';
|
|
35
|
-
export { User, App } from './utils/types';
|
|
36
|
-
export { default as createApplication } from './utils/create-application';
|
|
37
|
-
export { RouteObject, useRoutes, Link, Outlet, useLocation, useNavigate, useOutlet, useParams, useSearchParams, Navigate, useMatches, useLoaderData, useRouteLoaderData, useRevalidator, useRouteError, } from 'react-router-dom';
|
|
38
|
-
export * from '@topthink/components';
|
|
39
|
-
export { CommonTheme } from './theme';
|
|
1
|
+
import { App } from './utils/types';
|
|
2
|
+
declare module 'react-router-dom' {
|
|
3
|
+
interface Metadata {
|
|
4
|
+
title?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
hideInMenu?: boolean;
|
|
7
|
+
hideChildrenInMenu?: boolean;
|
|
8
|
+
hideMenu?: boolean;
|
|
9
|
+
access?: number | string | string[] | ((app: App) => boolean);
|
|
10
|
+
href?: string;
|
|
11
|
+
}
|
|
12
|
+
interface IndexRouteObject {
|
|
13
|
+
meta?: Metadata;
|
|
14
|
+
}
|
|
15
|
+
interface NonIndexRouteObject {
|
|
16
|
+
meta?: Metadata;
|
|
17
|
+
}
|
|
18
|
+
function useMatches(): {
|
|
19
|
+
id: string;
|
|
20
|
+
pathname: string;
|
|
21
|
+
params: Record<string, string | undefined>;
|
|
22
|
+
data: unknown;
|
|
23
|
+
handle: Record<string, any>;
|
|
24
|
+
}[];
|
|
25
|
+
}
|
|
26
|
+
export { default as SiderLayout } from './layout/sider';
|
|
27
|
+
export { default as TabLayout } from './layout/tab';
|
|
28
|
+
export { default as Header } from './components/header';
|
|
29
|
+
export { default as Access } from './components/access';
|
|
30
|
+
export { default as Content } from './components/content';
|
|
31
|
+
export { default as LinkButton } from './components/link-button';
|
|
32
|
+
export { useUser } from './components/user-provider';
|
|
33
|
+
export { useApp, useAppState } from './components/app-provider';
|
|
34
|
+
export { default as WithRequest, useRequestData } from './components/with-request';
|
|
35
|
+
export { User, App } from './utils/types';
|
|
36
|
+
export { default as createApplication } from './utils/create-application';
|
|
37
|
+
export { RouteObject, useRoutes, Link, Outlet, useLocation, useNavigate, useOutlet, useParams, useSearchParams, Navigate, useMatches, useLoaderData, useRouteLoaderData, useRevalidator, useRouteError, } from 'react-router-dom';
|
|
38
|
+
export * from '@topthink/components';
|
|
39
|
+
export { CommonTheme } from './theme';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export declare const SiderContext: import("react").Context<{
|
|
3
|
-
toggle: ReactNode;
|
|
4
|
-
show: boolean;
|
|
5
|
-
setShow: (show: boolean) => void;
|
|
6
|
-
headless: boolean;
|
|
7
|
-
} | undefined>;
|
|
8
|
-
export declare const useSider: () => {
|
|
9
|
-
toggle: ReactNode;
|
|
10
|
-
show: boolean;
|
|
11
|
-
setShow: (show: boolean) => void;
|
|
12
|
-
headless: boolean;
|
|
13
|
-
} | undefined;
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export declare const SiderContext: import("react").Context<{
|
|
3
|
+
toggle: ReactNode;
|
|
4
|
+
show: boolean;
|
|
5
|
+
setShow: (show: boolean) => void;
|
|
6
|
+
headless: boolean;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
export declare const useSider: () => {
|
|
9
|
+
toggle: ReactNode;
|
|
10
|
+
show: boolean;
|
|
11
|
+
setShow: (show: boolean) => void;
|
|
12
|
+
headless: boolean;
|
|
13
|
+
} | undefined;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { RouteObject } from 'react-router-dom';
|
|
2
|
-
import { ElementType, ReactNode } from 'react';
|
|
3
|
-
interface Props<As extends ElementType = ElementType> {
|
|
4
|
-
className?: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
header?: ReactNode;
|
|
7
|
-
headerAs?: As;
|
|
8
|
-
footer?: ReactNode;
|
|
9
|
-
footerAs?: As;
|
|
10
|
-
routes?: RouteObject[];
|
|
11
|
-
top?: number;
|
|
12
|
-
}
|
|
13
|
-
export default function SiderLayout({ className, title, header, headerAs, footer, footerAs, top, routes }: Props): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export {};
|
|
1
|
+
import { RouteObject } from 'react-router-dom';
|
|
2
|
+
import { ElementType, ReactNode } from 'react';
|
|
3
|
+
interface Props<As extends ElementType = ElementType> {
|
|
4
|
+
className?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
header?: ReactNode;
|
|
7
|
+
headerAs?: As;
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
footerAs?: As;
|
|
10
|
+
routes?: RouteObject[];
|
|
11
|
+
top?: number;
|
|
12
|
+
}
|
|
13
|
+
export default function SiderLayout({ className, title, header, headerAs, footer, footerAs, top, routes }: Props): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function Toggle(): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export default function Toggle(): import("react/jsx-runtime").JSX.Element;
|
package/types/layout/tab.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
interface Props {
|
|
3
|
-
title?: ReactNode;
|
|
4
|
-
header?: ReactNode;
|
|
5
|
-
showBack?: boolean;
|
|
6
|
-
extra?: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export default function TabLayout({ title, header, showBack, extra }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
title?: ReactNode;
|
|
4
|
+
header?: ReactNode;
|
|
5
|
+
showBack?: boolean;
|
|
6
|
+
extra?: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export default function TabLayout({ title, header, showBack, extra }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RouteObject } from 'react-router-dom';
|
|
2
|
-
import { MenuData } from '../utils/get-menu-data';
|
|
3
|
-
export default function useMenu(routes?: RouteObject[]): [MenuData[], string | undefined];
|
|
1
|
+
import { RouteObject } from 'react-router-dom';
|
|
2
|
+
import { MenuData } from '../utils/get-menu-data';
|
|
3
|
+
export default function useMenu(routes?: RouteObject[]): [MenuData[], string | undefined];
|
package/types/pages/login.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface LoginProps {
|
|
3
|
-
onAuthorize: (url: string, query?: Record<string, string>) => void;
|
|
4
|
-
onLogined: (token?: string) => string;
|
|
5
|
-
}
|
|
6
|
-
interface Props extends LoginProps {
|
|
7
|
-
onLogin: (props: LoginProps) => ReactNode;
|
|
8
|
-
}
|
|
9
|
-
export default function Login({ onLogin, onLogined, onAuthorize }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface LoginProps {
|
|
3
|
+
onAuthorize: (url: string, query?: Record<string, string>) => void;
|
|
4
|
+
onLogined: (token?: string) => string;
|
|
5
|
+
}
|
|
6
|
+
interface Props extends LoginProps {
|
|
7
|
+
onLogin: (props: LoginProps) => ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export default function Login({ onLogin, onLogined, onAuthorize }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
package/types/pages/logout.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
interface LogoutProps {
|
|
2
|
-
onLogout: () => void | Promise<void>;
|
|
3
|
-
}
|
|
4
|
-
export default function Logout({ onLogout }: LogoutProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export {};
|
|
1
|
+
interface LogoutProps {
|
|
2
|
+
onLogout: () => void | Promise<void>;
|
|
3
|
+
}
|
|
4
|
+
export default function Logout({ onLogout }: LogoutProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export {};
|
package/types/pages/social.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Promisable } from '../utils/types';
|
|
2
|
-
interface LoginProps {
|
|
3
|
-
onLogined: (token?: string) => string;
|
|
4
|
-
onAuthorize?: (token?: any) => Promisable<void | string | undefined>;
|
|
5
|
-
implicit?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export default function Social({ onLogined, onAuthorize, implicit }: LoginProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
1
|
+
import { Promisable } from '../utils/types';
|
|
2
|
+
interface LoginProps {
|
|
3
|
+
onLogined: (token?: string) => string;
|
|
4
|
+
onAuthorize?: (token?: any) => Promisable<void | string | undefined>;
|
|
5
|
+
implicit?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function Social({ onLogined, onAuthorize, implicit }: LoginProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
package/types/theme.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export interface CommonTheme {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
}
|
|
4
|
-
declare module '@topthink/components' {
|
|
5
|
-
interface ComponentsTheme extends CommonTheme {
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
export interface CommonTheme {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}
|
|
4
|
+
declare module '@topthink/components' {
|
|
5
|
+
interface ComponentsTheme extends CommonTheme {
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { RouteObject } from 'react-router-dom';
|
|
2
|
-
import { LoginProps } from '../pages/login';
|
|
3
|
-
import { AppResolver, Promisable, UserResolver } from './types';
|
|
4
|
-
import { ReactElement, ReactNode } from 'react';
|
|
5
|
-
interface Component<P = {}> {
|
|
6
|
-
(props: P): (ReactElement | null);
|
|
7
|
-
}
|
|
8
|
-
interface Options {
|
|
9
|
-
baseURL?: string;
|
|
10
|
-
basename?: string;
|
|
11
|
-
authentication?: 'cookie' | 'token';
|
|
12
|
-
implicit?: boolean;
|
|
13
|
-
onLogout?: () => Promisable<void>;
|
|
14
|
-
onAuthorize?: (token?: any) => Promisable<void | string | undefined>;
|
|
15
|
-
onLogin: (props: LoginProps) => ReactNode;
|
|
16
|
-
appResolver?: AppResolver;
|
|
17
|
-
userResolver: UserResolver;
|
|
18
|
-
routes: RouteObject[];
|
|
19
|
-
extraRoutes?: RouteObject[];
|
|
20
|
-
RootComponent?: Component;
|
|
21
|
-
}
|
|
22
|
-
export default function createApplication(options: Options): () => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export {};
|
|
1
|
+
import { RouteObject } from 'react-router-dom';
|
|
2
|
+
import { LoginProps } from '../pages/login';
|
|
3
|
+
import { AppResolver, Promisable, UserResolver } from './types';
|
|
4
|
+
import { ReactElement, ReactNode } from 'react';
|
|
5
|
+
interface Component<P = {}> {
|
|
6
|
+
(props: P): (ReactElement | null);
|
|
7
|
+
}
|
|
8
|
+
interface Options {
|
|
9
|
+
baseURL?: string;
|
|
10
|
+
basename?: string;
|
|
11
|
+
authentication?: 'cookie' | 'token';
|
|
12
|
+
implicit?: boolean;
|
|
13
|
+
onLogout?: () => Promisable<void>;
|
|
14
|
+
onAuthorize?: (token?: any) => Promisable<void | string | undefined>;
|
|
15
|
+
onLogin: (props: LoginProps) => ReactNode;
|
|
16
|
+
appResolver?: AppResolver;
|
|
17
|
+
userResolver: UserResolver;
|
|
18
|
+
routes: RouteObject[];
|
|
19
|
+
extraRoutes?: RouteObject[];
|
|
20
|
+
RootComponent?: Component;
|
|
21
|
+
}
|
|
22
|
+
export default function createApplication(options: Options): () => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { RouteObject } from 'react-router-dom';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { App } from './types';
|
|
4
|
-
export interface MenuData {
|
|
5
|
-
path: string;
|
|
6
|
-
title: string;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
isExternal?: boolean;
|
|
9
|
-
children: MenuData[];
|
|
10
|
-
}
|
|
11
|
-
export default function getMenuData(app: App, routes: RouteObject[], base?: string): MenuData[];
|
|
1
|
+
import type { RouteObject } from 'react-router-dom';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { App } from './types';
|
|
4
|
+
export interface MenuData {
|
|
5
|
+
path: string;
|
|
6
|
+
title: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
isExternal?: boolean;
|
|
9
|
+
children: MenuData[];
|
|
10
|
+
}
|
|
11
|
+
export default function getMenuData(app: App, routes: RouteObject[], base?: string): MenuData[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { RouteObject } from 'react-router-dom';
|
|
2
|
-
export default function transformRoutes(routes: RouteObject[], hideInMenu?: boolean): RouteObject[];
|
|
1
|
+
import { RouteObject } from 'react-router-dom';
|
|
2
|
+
export default function transformRoutes(routes: RouteObject[], hideInMenu?: boolean): RouteObject[];
|
package/types/utils/types.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export interface App {
|
|
2
|
-
user?: User;
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}
|
|
5
|
-
export interface User {
|
|
6
|
-
id: number;
|
|
7
|
-
name: string;
|
|
8
|
-
email: string;
|
|
9
|
-
avatar: string;
|
|
10
|
-
mobile: string;
|
|
11
|
-
is_certified: boolean;
|
|
12
|
-
is_enterprise: boolean;
|
|
13
|
-
roles: string[];
|
|
14
|
-
access_level: number | string;
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}
|
|
17
|
-
export type AppResolver = () => App | Promise<App>;
|
|
18
|
-
export type UserResolver = () => User | Promise<User>;
|
|
19
|
-
export type Promisable<T> = T | Promise<T>;
|
|
1
|
+
export interface App {
|
|
2
|
+
user?: User;
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface User {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
email: string;
|
|
9
|
+
avatar: string;
|
|
10
|
+
mobile: string;
|
|
11
|
+
is_certified: boolean;
|
|
12
|
+
is_enterprise: boolean;
|
|
13
|
+
roles: string[];
|
|
14
|
+
access_level: number | string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export type AppResolver = () => App | Promise<App>;
|
|
18
|
+
export type UserResolver = () => User | Promise<User>;
|
|
19
|
+
export type Promisable<T> = T | Promise<T>;
|