listpage-next 0.0.193 → 0.0.194

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.
@@ -1,3 +1,4 @@
1
1
  import { ClientOptions } from './types';
2
- export declare function setupBaseUrl(HttpClient: typeof import('./index').HttpClient): void;
2
+ import { type HttpClient as BaseHttpClient } from './index';
3
+ export declare function setupBaseUrl(HttpClient: typeof BaseHttpClient): void;
3
4
  export declare function mergeServerConfig(server: ClientOptions['server']): ClientOptions['server'];
@@ -1 +1,2 @@
1
- export declare function setupClient(HttpClient: typeof import('./index').HttpClient): void;
1
+ import { type HttpClient as BaseHttpClient } from './index';
2
+ export declare function setupClient(HttpClient: typeof BaseHttpClient): void;
@@ -14,9 +14,11 @@ function setupClient(HttpClient) {
14
14
  };
15
15
  HttpClient.prototype.setup = function() {
16
16
  const successCodes = this.options.successCodes || [
17
- 10000,
18
17
  200
19
18
  ];
19
+ const unauthorizedCodes = this.options.unauthorizedCodes || [
20
+ 401
21
+ ];
20
22
  const apiClient = this.createAxiosInstance();
21
23
  apiClient.interceptors.request.use((config)=>{
22
24
  config.headers.Authorization = `Bearer ${this.getToken()}`;
@@ -44,6 +46,10 @@ function setupClient(HttpClient) {
44
46
  });
45
47
  return Promise.reject(error);
46
48
  }
49
+ if (this.options.loginPath && unauthorizedCodes?.includes(response.data.code)) {
50
+ this.setToken('');
51
+ window.location.href = this.options.loginPath;
52
+ }
47
53
  return response;
48
54
  }, (error)=>{
49
55
  console.error('Response Error:', error);
@@ -1 +1,2 @@
1
- export declare function setupHeaders(HttpClient: typeof import('./index').HttpClient): void;
1
+ import { type HttpClient as BaseHttpClient } from './index';
2
+ export declare function setupHeaders(HttpClient: typeof BaseHttpClient): void;
@@ -1 +1,2 @@
1
- export declare function setupToken(HttpClient: typeof import('./index').HttpClient): void;
1
+ import { type HttpClient as BaseHttpClient } from './index';
2
+ export declare function setupToken(HttpClient: typeof BaseHttpClient): void;
@@ -4,6 +4,8 @@ export interface ClientOptions {
4
4
  token?: string;
5
5
  tokenKey?: string;
6
6
  successCodes?: number[];
7
+ unauthorizedCodes?: number[];
8
+ loginPath?: string;
7
9
  server?: {
8
10
  protocol?: string;
9
11
  host?: string;
@@ -1,3 +1,4 @@
1
+ import { CSSProperties } from 'react';
1
2
  import { SiderProps } from 'antd';
2
3
  import { usePageContext } from '../PageProvider';
3
4
  import { PageLogoProps } from '../PageLogo';
@@ -11,5 +12,8 @@ export interface PageLayoutProps {
11
12
  floats?: PageFloatProps[];
12
13
  defaultCollapsed?: boolean;
13
14
  siderProps?: Omit<SiderProps, 'collapsed' | 'onCollapse'>;
15
+ styles?: {
16
+ container?: CSSProperties;
17
+ };
14
18
  }
15
19
  export declare const PageLayout: (props: PageLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,13 +7,14 @@ import { PageHeader } from "../PageHeader/index.js";
7
7
  import { PageContent } from "../PageContent/index.js";
8
8
  import { PageProvider, usePageContext } from "../PageProvider/index.js";
9
9
  const PageLayoutComponent = (props)=>{
10
- const { siderProps, sider, header, content, logo, pageRef } = props;
10
+ const { siderProps, sider, header, content, logo, pageRef, styles } = props;
11
11
  const context = usePageContext();
12
12
  const { collapsed, setCollapsed } = context;
13
13
  useImperativeHandle(pageRef, ()=>context, [
14
14
  context
15
15
  ]);
16
16
  return /*#__PURE__*/ jsxs(LayoutStyled, {
17
+ style: styles?.container,
17
18
  children: [
18
19
  /*#__PURE__*/ jsx(PageSider, {
19
20
  ...siderProps,
@@ -6,15 +6,15 @@ const PageLogo = (props)=>{
6
6
  return /*#__PURE__*/ jsxs(LogoContentWrapper, {
7
7
  children: [
8
8
  src && /*#__PURE__*/ jsx(Image, {
9
- width: 30,
10
- height: 30,
9
+ width: 24,
10
+ height: 24,
11
11
  src: src,
12
12
  preview: true
13
13
  }),
14
14
  icon && /*#__PURE__*/ jsx(Avatar, {
15
15
  icon: icon,
16
16
  shape: "circle",
17
- size: 30
17
+ size: 24
18
18
  }),
19
19
  title && /*#__PURE__*/ jsx(TitleContentWrapper, {
20
20
  children: title
@@ -23,14 +23,18 @@ const PageLogo = (props)=>{
23
23
  });
24
24
  };
25
25
  const LogoContentWrapper = styled.div`
26
- flex: 0;
26
+ flex-shrink: 0;
27
+ flex-grow: 0;
27
28
  display: flex;
28
29
  align-items: center;
29
30
  gap: 8px;
30
- height: 48px;
31
+ height: 64px;
32
+
33
+ padding: 0 22px;
31
34
  `;
32
35
  const TitleContentWrapper = styled.div`
33
- font-size: 16px;
36
+ font-size: 20px;
37
+ line-height: 24px;
34
38
  font-weight: 600;
35
39
  color: #333;
36
40
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.193",
3
+ "version": "0.0.194",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",