listpage-next 0.0.170 → 0.0.172

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.
Files changed (86) hide show
  1. package/dist/components/PageLayout/components/PageContent/index.d.ts +5 -0
  2. package/dist/components/PageLayout/components/PageContent/index.js +15 -0
  3. package/dist/components/PageLayout/components/PageHeader/index.d.ts +5 -0
  4. package/dist/components/PageLayout/components/PageHeader/index.js +5 -0
  5. package/dist/components/PageLayout/components/PageLayout/index.d.ts +11 -0
  6. package/dist/components/PageLayout/components/PageLayout/index.js +44 -0
  7. package/dist/components/{Page/components/Loading → PageLayout/components/PageLoading}/index.js +16 -6
  8. package/dist/components/PageLayout/components/PageLogo/index.d.ts +7 -0
  9. package/dist/components/PageLayout/components/PageLogo/index.js +37 -0
  10. package/dist/components/PageLayout/components/PageProvider/float.d.ts +20 -0
  11. package/dist/components/PageLayout/components/PageProvider/float.js +64 -0
  12. package/dist/components/PageLayout/components/PageProvider/index.d.ts +17 -0
  13. package/dist/components/PageLayout/components/PageProvider/index.js +31 -0
  14. package/dist/components/PageLayout/components/PageSider/index.d.ts +8 -0
  15. package/dist/components/PageLayout/components/PageSider/index.js +42 -0
  16. package/dist/components/PageLayout/index.d.ts +4 -0
  17. package/dist/components/PageLayout/index.js +4 -0
  18. package/dist/context/index.d.ts +1 -1
  19. package/dist/demos/demo2.js +2 -2
  20. package/dist/demos/demo5.js +1 -1
  21. package/dist/features/ChatClient/components/ChatContent/index.js +1 -1
  22. package/dist/features/ChatClient/ui/Bubble/BubbleList.js +1 -1
  23. package/dist/features/ListPage/components/DataTable/index.d.ts +4 -0
  24. package/dist/{components/Page/components/ListPage/DataTable.js → features/ListPage/components/DataTable/index.js} +3 -3
  25. package/dist/features/ListPage/components/DataTable/renders/index.d.ts +7 -0
  26. package/dist/features/ListPage/components/DataTable/renders/index.js +13 -0
  27. package/dist/features/ListPage/components/DataTable/renders/link.d.ts +2 -0
  28. package/dist/features/ListPage/components/DataTable/renders/link.js +27 -0
  29. package/dist/features/ListPage/components/DataTable/renders/switch.d.ts +2 -0
  30. package/dist/features/ListPage/components/DataTable/renders/switch.js +10 -0
  31. package/dist/features/ListPage/components/DataTable/renders/tag.d.ts +2 -0
  32. package/dist/features/ListPage/components/DataTable/renders/tag.js +7 -0
  33. package/dist/features/ListPage/components/DataTable/renders/text.d.ts +2 -0
  34. package/dist/features/ListPage/components/DataTable/renders/text.js +10 -0
  35. package/dist/features/ListPage/components/DataTable/renders/time.d.ts +2 -0
  36. package/dist/features/ListPage/components/DataTable/renders/time.js +15 -0
  37. package/dist/features/ListPage/components/DataTable/types.d.ts +34 -0
  38. package/dist/features/ListPage/components/DataTable/types.js +0 -0
  39. package/dist/features/ListPage/components/DataTable/utils/render.d.ts +2 -0
  40. package/dist/features/ListPage/components/DataTable/utils/render.js +25 -0
  41. package/dist/features/ListPage/components/ListPageContainer/index.d.ts +17 -0
  42. package/dist/{components/Page/components/ListPage/v2.js → features/ListPage/components/ListPageContainer/index.js} +10 -24
  43. package/dist/features/ListPage/context/context.d.ts +4 -0
  44. package/dist/features/ListPage/context/context.js +22 -0
  45. package/dist/features/ListPage/context/index.d.ts +2 -0
  46. package/dist/features/ListPage/context/index.js +3 -0
  47. package/dist/features/ListPage/context/store.d.ts +37 -0
  48. package/dist/{components/Page/context/listpage.js → features/ListPage/context/store.js} +2 -42
  49. package/dist/features/ListPage/context/types.d.ts +12 -0
  50. package/dist/features/ListPage/context/types.js +0 -0
  51. package/dist/features/ListPage/hooks/useColumns.d.ts +3 -0
  52. package/dist/features/ListPage/hooks/useColumns.js +20 -0
  53. package/dist/{components/Page → features/ListPage}/hooks/useFloat.js +1 -1
  54. package/dist/features/ListPage/hooks/useHeader.d.ts +2 -0
  55. package/dist/{components/Page → features/ListPage}/hooks/useHeader.js +2 -2
  56. package/dist/{components/Page → features/ListPage}/hooks/usePagination.js +2 -2
  57. package/dist/{components/Page → features/ListPage}/hooks/useSelectionTools.js +1 -1
  58. package/dist/features/ListPage/index.d.ts +3 -0
  59. package/dist/features/ListPage/index.js +4 -0
  60. package/dist/{components/Page/components → features}/ListPage/styles.d.ts +3 -1
  61. package/dist/{components/Page/components → features}/ListPage/styles.js +15 -2
  62. package/dist/features/ListPage/types.d.ts +26 -0
  63. package/dist/features/ListPage/types.js +0 -0
  64. package/dist/features/ListPage/utils/index.d.ts +10 -0
  65. package/dist/features/ListPage/utils/index.js +23 -0
  66. package/dist/index.d.ts +2 -2
  67. package/dist/index.js +2 -2
  68. package/package.json +1 -1
  69. package/dist/components/Page/components/ListPage/DataTable.d.ts +0 -20
  70. package/dist/components/Page/components/ListPage/index.d.ts +0 -16
  71. package/dist/components/Page/components/ListPage/index.js +0 -51
  72. package/dist/components/Page/components/ListPage/v2.d.ts +0 -43
  73. package/dist/components/Page/components/PageContainer/index.d.ts +0 -10
  74. package/dist/components/Page/components/PageContainer/index.js +0 -82
  75. package/dist/components/Page/context/listpage.d.ts +0 -80
  76. package/dist/components/Page/context/page.d.ts +0 -13
  77. package/dist/components/Page/context/page.js +0 -15
  78. package/dist/components/Page/hooks/useColumns.d.ts +0 -3
  79. package/dist/components/Page/hooks/useColumns.js +0 -10
  80. package/dist/components/Page/hooks/useHeader.d.ts +0 -7
  81. package/dist/components/Page/index.d.ts +0 -8
  82. package/dist/components/Page/index.js +0 -7
  83. /package/dist/components/{Page/components/Loading → PageLayout/components/PageLoading}/index.d.ts +0 -0
  84. /package/dist/{components/Page → features/ListPage}/hooks/useFloat.d.ts +0 -0
  85. /package/dist/{components/Page → features/ListPage}/hooks/usePagination.d.ts +0 -0
  86. /package/dist/{components/Page → features/ListPage}/hooks/useSelectionTools.d.ts +0 -0
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from 'react';
2
+ export interface PageContentProps {
3
+ children?: ReactNode;
4
+ }
5
+ export declare const PageContent: (props: PageContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Layout } from "antd";
3
+ import { styled } from "styled-components";
4
+ const { Content } = Layout;
5
+ const PageContent = (props)=>{
6
+ const { children } = props;
7
+ return /*#__PURE__*/ jsx(ContentStyled, {
8
+ children: children
9
+ });
10
+ };
11
+ const ContentStyled = styled(Content)`
12
+ background-color: #fff;
13
+ overflow: auto;
14
+ `;
15
+ export { PageContent };
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from 'react';
2
+ export interface PageHeaderProps {
3
+ children?: ReactNode;
4
+ }
5
+ export declare const PageHeader: (props: PageHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ const PageHeader = (props)=>/*#__PURE__*/ jsx(Fragment, {
3
+ children: props.children
4
+ });
5
+ export { PageHeader };
@@ -0,0 +1,11 @@
1
+ import { SiderProps } from 'antd';
2
+ import { PageLogoProps } from '../PageLogo';
3
+ export interface PageLayoutProps {
4
+ sider?: React.ReactNode;
5
+ header?: React.ReactNode;
6
+ content?: React.ReactNode;
7
+ logo?: PageLogoProps;
8
+ defaultCollapsed?: boolean;
9
+ siderProps?: Omit<SiderProps, 'collapsed' | 'onCollapse'>;
10
+ }
11
+ export declare const PageLayout: (props: PageLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Layout } from "antd";
3
+ import { styled } from "styled-components";
4
+ import { PageSider } from "../PageSider/index.js";
5
+ import { PageHeader } from "../PageHeader/index.js";
6
+ import { PageContent } from "../PageContent/index.js";
7
+ import { PageProvider, usePageContext } from "../PageProvider/index.js";
8
+ const PageLayoutComponent = (props)=>{
9
+ const { siderProps, sider, header, content, logo } = props;
10
+ const { collapsed, setCollapsed } = usePageContext();
11
+ return /*#__PURE__*/ jsxs(LayoutStyled, {
12
+ children: [
13
+ /*#__PURE__*/ jsx(PageSider, {
14
+ ...siderProps,
15
+ logo: logo,
16
+ collapsed: collapsed,
17
+ onCollapse: setCollapsed,
18
+ children: sider
19
+ }),
20
+ /*#__PURE__*/ jsxs(Layout, {
21
+ hasSider: false,
22
+ children: [
23
+ /*#__PURE__*/ jsx(PageHeader, {
24
+ children: header
25
+ }),
26
+ /*#__PURE__*/ jsx(PageContent, {
27
+ children: content
28
+ })
29
+ ]
30
+ })
31
+ ]
32
+ });
33
+ };
34
+ const PageLayout = (props)=>/*#__PURE__*/ jsx(PageProvider, {
35
+ defaultCollapsed: props.defaultCollapsed,
36
+ children: /*#__PURE__*/ jsx(PageLayoutComponent, {
37
+ ...props
38
+ })
39
+ });
40
+ const LayoutStyled = styled(Layout)`
41
+ height: 100vh;
42
+ overflow: hidden;
43
+ `;
44
+ export { PageLayout };
@@ -15,7 +15,7 @@ const PageLoading = styled_components.div`
15
15
  &::after {
16
16
  animation: LoadingAnimation 1.5s linear infinite;
17
17
  border-radius: 5px;
18
- content: "";
18
+ content: '';
19
19
  height: 10px;
20
20
  left: 50%;
21
21
  position: absolute;
@@ -28,27 +28,37 @@ const PageLoading = styled_components.div`
28
28
 
29
29
  @keyframes LoadingAnimation {
30
30
  0% {
31
- box-shadow: -16px 20px 0 -5px #b89dfe, 0 20px 0 0 #2e6ee7,
31
+ box-shadow:
32
+ -16px 20px 0 -5px #b89dfe,
33
+ 0 20px 0 0 #2e6ee7,
32
34
  16px 20px 0 2px #b89dfe;
33
35
  }
34
36
 
35
37
  25% {
36
- box-shadow: -16px 20px 0 0 #b89dfe, 0 20px 0 2px #2e6ee7,
38
+ box-shadow:
39
+ -16px 20px 0 0 #b89dfe,
40
+ 0 20px 0 2px #2e6ee7,
37
41
  16px 20px 0 0 #b89dfe;
38
42
  }
39
43
 
40
44
  50% {
41
- box-shadow: -16px 20px 0 2px #b89dfe, 0 20px 0 0 #2e6ee7,
45
+ box-shadow:
46
+ -16px 20px 0 2px #b89dfe,
47
+ 0 20px 0 0 #2e6ee7,
42
48
  16px 20px 0 -5px #b89dfe;
43
49
  }
44
50
 
45
51
  75% {
46
- box-shadow: -16px 20px 0 0 #b89dfe, 0 20px 0 -5px #2e6ee7,
52
+ box-shadow:
53
+ -16px 20px 0 0 #b89dfe,
54
+ 0 20px 0 -5px #2e6ee7,
47
55
  16px 20px 0 0 #b89dfe;
48
56
  }
49
57
 
50
58
  to {
51
- box-shadow: -16px 20px 0 -5px #b89dfe, 0 20px 0 0 #2e6ee7,
59
+ box-shadow:
60
+ -16px 20px 0 -5px #b89dfe,
61
+ 0 20px 0 0 #2e6ee7,
52
62
  16px 20px 0 2px #b89dfe;
53
63
  }
54
64
  }
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ export interface PageLogoProps {
3
+ src?: string;
4
+ icon?: ReactNode;
5
+ title?: ReactNode;
6
+ }
7
+ export declare const PageLogo: (props: PageLogoProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Avatar, Image } from "antd";
3
+ import { styled } from "styled-components";
4
+ const PageLogo = (props)=>{
5
+ const { src, icon, title } = props;
6
+ return /*#__PURE__*/ jsxs(LogoContentWrapper, {
7
+ children: [
8
+ src && /*#__PURE__*/ jsx(Image, {
9
+ width: 30,
10
+ height: 30,
11
+ src: src,
12
+ preview: true
13
+ }),
14
+ icon && /*#__PURE__*/ jsx(Avatar, {
15
+ icon: icon,
16
+ shape: "circle",
17
+ size: 30
18
+ }),
19
+ title && /*#__PURE__*/ jsx(TitleContentWrapper, {
20
+ children: title
21
+ })
22
+ ]
23
+ });
24
+ };
25
+ const LogoContentWrapper = styled.div`
26
+ flex: 0;
27
+ display: flex;
28
+ align-items: center;
29
+ gap: 8px;
30
+ height: 48px;
31
+ `;
32
+ const TitleContentWrapper = styled.div`
33
+ font-size: 16px;
34
+ font-weight: 600;
35
+ color: #333;
36
+ `;
37
+ export { PageLogo };
@@ -0,0 +1,20 @@
1
+ import React, { JSX } from 'react';
2
+ export interface FloatContextProps {
3
+ showFloat: (key: string, record: any, onCloseCallback?: () => void) => void;
4
+ hideFloat: (key: string) => void;
5
+ }
6
+ export declare const FloatContext: React.Context<FloatContextProps | undefined>;
7
+ export declare const useFloatContext: () => FloatContextProps;
8
+ export declare const FloatProvider: (props: {
9
+ floats?: PageFloatProps[];
10
+ children: React.ReactNode;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ export type FloatComponentProps<T extends Record<string, any> = any> = {
13
+ record: T;
14
+ visible: boolean;
15
+ onClose: () => void;
16
+ };
17
+ export type PageFloatProps<T extends Record<string, any> = any> = {
18
+ key: string;
19
+ render: (props: FloatComponentProps<T>) => JSX.Element;
20
+ };
@@ -0,0 +1,64 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useRef, useState } from "react";
3
+ const FloatContext = /*#__PURE__*/ createContext(void 0);
4
+ const useFloatContext = ()=>{
5
+ const context = useContext(FloatContext);
6
+ if (!context) return {
7
+ showFloat: ()=>{},
8
+ hideFloat: ()=>{}
9
+ };
10
+ return context;
11
+ };
12
+ const FloatProvider = (props)=>{
13
+ const { floats = [], children } = props;
14
+ const elesRef = useRef([]);
15
+ const [eles, setEles] = useState([]);
16
+ const hideFloat = useCallback((key)=>{
17
+ elesRef.current = elesRef.current.filter((ele)=>ele.key !== key);
18
+ setEles([
19
+ ...elesRef.current.map((i)=>i.ele)
20
+ ]);
21
+ }, [
22
+ eles
23
+ ]);
24
+ const showFloat = useCallback((key, record, onCloseCallback)=>{
25
+ const Component = floats.find((i)=>i.key === key)?.render;
26
+ if (!Component) return;
27
+ const node = /*#__PURE__*/ jsx(Component, {
28
+ visible: true,
29
+ record: record,
30
+ onClose: ()=>{
31
+ onCloseCallback?.();
32
+ elesRef.current = elesRef.current.filter(({ ele })=>ele !== node);
33
+ setEles([
34
+ ...elesRef.current.map((i)=>i.ele)
35
+ ]);
36
+ }
37
+ }, key);
38
+ elesRef.current.push({
39
+ key,
40
+ ele: node
41
+ });
42
+ setEles([
43
+ ...elesRef.current.map((i)=>i.ele)
44
+ ]);
45
+ }, [
46
+ floats,
47
+ eles,
48
+ elesRef,
49
+ setEles
50
+ ]);
51
+ return /*#__PURE__*/ jsx(FloatContext.Provider, {
52
+ value: {
53
+ showFloat,
54
+ hideFloat
55
+ },
56
+ children: /*#__PURE__*/ jsxs(Fragment, {
57
+ children: [
58
+ children,
59
+ eles
60
+ ]
61
+ })
62
+ });
63
+ };
64
+ export { FloatContext, FloatProvider, useFloatContext };
@@ -0,0 +1,17 @@
1
+ import { PageFloatProps } from './float';
2
+ export declare const PageContext: import("react").Context<{
3
+ collapsed: boolean;
4
+ setCollapsed: (collapsed: boolean) => void;
5
+ }>;
6
+ export interface PageProviderProps {
7
+ children: React.ReactNode;
8
+ defaultCollapsed?: boolean;
9
+ floats?: PageFloatProps[];
10
+ }
11
+ export declare const PageProvider: ({ children, defaultCollapsed, floats, }: PageProviderProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const usePageContext: () => {
13
+ collapsed: boolean;
14
+ setCollapsed: (collapsed: boolean) => void;
15
+ showFloat: (key: string, record: any, onCloseCallback?: () => void) => void;
16
+ hideFloat: (key: string) => void;
17
+ };
@@ -0,0 +1,31 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useState } from "react";
3
+ import { FloatProvider, useFloatContext } from "./float.js";
4
+ const PageContext = /*#__PURE__*/ createContext({
5
+ collapsed: false,
6
+ setCollapsed: ()=>{}
7
+ });
8
+ const PageProvider = ({ children, defaultCollapsed = false, floats = [] })=>{
9
+ const [collapsed, setCollapsed] = useState(defaultCollapsed);
10
+ return /*#__PURE__*/ jsx(FloatProvider, {
11
+ floats: floats,
12
+ children: /*#__PURE__*/ jsx(PageContext.Provider, {
13
+ value: {
14
+ collapsed,
15
+ setCollapsed
16
+ },
17
+ children: children
18
+ })
19
+ });
20
+ };
21
+ const usePageContext = ()=>{
22
+ const { showFloat, hideFloat } = useFloatContext();
23
+ const { collapsed, setCollapsed } = useContext(PageContext);
24
+ return {
25
+ collapsed,
26
+ setCollapsed,
27
+ showFloat,
28
+ hideFloat
29
+ };
30
+ };
31
+ export { PageContext, PageProvider, usePageContext };
@@ -0,0 +1,8 @@
1
+ import { SiderProps } from 'antd';
2
+ import { ReactNode } from 'react';
3
+ import { PageLogoProps } from '../PageLogo';
4
+ export interface PageSiderProps extends Omit<SiderProps, 'children'> {
5
+ logo?: PageLogoProps;
6
+ children?: ReactNode;
7
+ }
8
+ export declare const PageSider: (props: PageSiderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { styled } from "styled-components";
3
+ import { Layout } from "antd";
4
+ import { PageLogo } from "../PageLogo/index.js";
5
+ const PageSider = (props)=>{
6
+ const { logo, children, ...siderProps } = props;
7
+ return /*#__PURE__*/ jsx(SiderStyled, {
8
+ trigger: null,
9
+ width: 256,
10
+ collapsedWidth: 80,
11
+ breakpoint: "lg",
12
+ collapsible: true,
13
+ ...siderProps,
14
+ children: /*#__PURE__*/ jsxs(SiderContent, {
15
+ children: [
16
+ logo && /*#__PURE__*/ jsx(PageLogo, {
17
+ ...logo
18
+ }),
19
+ /*#__PURE__*/ jsx(SiderContentWrapper, {
20
+ children: children
21
+ })
22
+ ]
23
+ })
24
+ });
25
+ };
26
+ const SiderStyled = styled(Layout.Sider)`
27
+ background-color: #fff;
28
+ border-right: 1px solid #e5e5e5;
29
+ display: flex;
30
+ flex-direction: column;
31
+ `;
32
+ const SiderContent = styled.div`
33
+ display: flex;
34
+ flex-direction: column;
35
+ overflow: hidden;
36
+ height: 100%;
37
+ `;
38
+ const SiderContentWrapper = styled.div`
39
+ flex: 1;
40
+ overflow: auto;
41
+ `;
42
+ export { PageSider };
@@ -0,0 +1,4 @@
1
+ export { PageLoading } from './components/PageLoading';
2
+ export { PageLayout } from './components/PageLayout';
3
+ export type { PageLayoutProps } from './components/PageLayout';
4
+ export { PageContext, usePageContext } from './components/PageProvider';
@@ -0,0 +1,4 @@
1
+ import { PageLoading } from "./components/PageLoading/index.js";
2
+ import { PageLayout } from "./components/PageLayout/index.js";
3
+ import { PageContext, usePageContext } from "./components/PageProvider/index.js";
4
+ export { PageContext, PageLayout, PageLoading, usePageContext };
@@ -1 +1 @@
1
- export { FloatContext, FloatProvider, useFloatContext, type FloatComponentProps } from './float';
1
+ export { FloatContext, FloatProvider, useFloatContext } from './float';
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { PageContainer } from "../components/Page/index.js";
2
+ import { PageLayout } from "../components/PageLayout/index.js";
3
3
  const Demo2 = ()=>{
4
4
  const sider = /*#__PURE__*/ jsx("div", {
5
5
  children: "侧边栏"
@@ -10,7 +10,7 @@ const Demo2 = ()=>{
10
10
  const header = /*#__PURE__*/ jsx("div", {
11
11
  children: "顶部"
12
12
  });
13
- return /*#__PURE__*/ jsx(PageContainer, {
13
+ return /*#__PURE__*/ jsx(PageLayout, {
14
14
  sider: sider,
15
15
  content: content,
16
16
  header: header
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Button, DatePicker, Input, Select, Space, Switch } from "antd";
3
- import { ListPage } from "../components/Page/components/ListPage/v2.js";
3
+ import { ListPage } from "../features/ListPage/index.js";
4
4
  const columns = [
5
5
  {
6
6
  key: 'enable',
@@ -5,7 +5,7 @@ import { styled } from "styled-components";
5
5
  import { ClientContentBody } from "./ClientContentBody.js";
6
6
  import { ClientContentHeader } from "./ClientContentHeader.js";
7
7
  import { MessageProvider, useChatClientContext } from "../../context/index.js";
8
- import { PageLoading } from "../../../../components/Page/components/Loading/index.js";
8
+ import { PageLoading } from "../../../../components/PageLayout/index.js";
9
9
  const ClientContentComponent = (props)=>{
10
10
  const { extra, style, header, sender, className, title, onTitleChange, onClickNewConversation, senderProps, bubbleProps } = props;
11
11
  return /*#__PURE__*/ jsxs(Container, {
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useRef } from "react";
3
3
  import { styled } from "styled-components";
4
- import { PageLoading } from "../../../../components/Page/index.js";
4
+ import { PageLoading } from "../../../../components/PageLayout/index.js";
5
5
  const BubbleList = (props)=>{
6
6
  const { loading, styles, messages, messageRender } = props;
7
7
  const bottomRef = useRef(null);
@@ -0,0 +1,4 @@
1
+ import { DataTableProps } from './types';
2
+ export declare const DataTable: (<FilterValue = any, RecordValue extends Record<string, any> = any>(props: DataTableProps<FilterValue, RecordValue>) => import("react/jsx-runtime").JSX.Element) & {
3
+ displayName: string;
4
+ };
@@ -1,13 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Card, Table } from "antd";
3
3
  import { observer } from "mobx-react-lite";
4
- import { useListPageStore } from "../../context/listpage.js";
5
- import { TableContainer } from "../../../DataTable/index.js";
4
+ import { useListPageStore } from "../../context/index.js";
6
5
  import { usePagination } from "../../hooks/usePagination.js";
7
6
  import { useColumns } from "../../hooks/useColumns.js";
8
7
  import { useSelectionTools } from "../../hooks/useSelectionTools.js";
8
+ import { TableContainer } from "../../styles.js";
9
9
  const DataTable = observer((props)=>{
10
- const { title, extra, columns, rowTitleKey, rowSelectionType, tableProps } = props;
10
+ const { title, extra, columns = [], rowTitleKey, rowSelectionType, tableProps } = props;
11
11
  const store = useListPageStore();
12
12
  const paginationEle = usePagination(tableProps?.pagination);
13
13
  const newColumns = useColumns(columns);
@@ -0,0 +1,7 @@
1
+ export declare const renders: {
2
+ link: import("../types").ColumnRender<"link">;
3
+ text: import("../types").ColumnRender<"text">;
4
+ tag: import("../types").ColumnRender<"tag">;
5
+ switch: import("../types").ColumnRender<"switch">;
6
+ time: import("../types").ColumnRender<"time">;
7
+ };
@@ -0,0 +1,13 @@
1
+ import { linkRender } from "./link.js";
2
+ import { switchRender } from "./switch.js";
3
+ import { tagRender } from "./tag.js";
4
+ import { textRender } from "./text.js";
5
+ import { timeRender } from "./time.js";
6
+ const renders = {
7
+ link: linkRender,
8
+ text: textRender,
9
+ tag: tagRender,
10
+ switch: switchRender,
11
+ time: timeRender
12
+ };
13
+ export { renders };
@@ -0,0 +1,2 @@
1
+ import { ColumnRender } from '../types';
2
+ export declare const linkRender: ColumnRender<'link'>;
@@ -0,0 +1,27 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { styled } from "styled-components";
3
+ const LinkStyle = styled.a`
4
+ color: #1677ff;
5
+ &:hover {
6
+ color: #69b1ff;
7
+ }
8
+ outline: 0;
9
+ text-decoration: none;
10
+ transition: color 0.3s;
11
+ background-color: transparent;
12
+ cursor: pointer;
13
+ `;
14
+ const getPropName = (propName, record)=>{
15
+ if ('function' == typeof propName) return propName(record);
16
+ return record[propName];
17
+ };
18
+ const linkRender = (value, record, index, props)=>{
19
+ const title = getPropName(props?.titlePropName || 'title', record);
20
+ const href = getPropName(props?.hrefPropName || 'href', record);
21
+ return /*#__PURE__*/ jsx(LinkStyle, {
22
+ href: href,
23
+ target: props?.target,
24
+ children: title
25
+ });
26
+ };
27
+ export { linkRender };
@@ -0,0 +1,2 @@
1
+ import { ColumnRender } from '../types';
2
+ export declare const switchRender: ColumnRender<'switch'>;
@@ -0,0 +1,10 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { AsyncSwitch } from "../../../../../components/AsyncSwitch/index.js";
3
+ const switchRender = (value, record, index, props)=>/*#__PURE__*/ jsx(AsyncSwitch, {
4
+ defaultValue: value,
5
+ ...props,
6
+ syncChange: async (checked)=>{
7
+ await props?.syncChange?.(checked, record);
8
+ }
9
+ });
10
+ export { switchRender };
@@ -0,0 +1,2 @@
1
+ import { ColumnRender } from '../types';
2
+ export declare const tagRender: ColumnRender<'tag'>;
@@ -0,0 +1,7 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Tag } from "antd";
3
+ const tagRender = (value, record, index, props)=>/*#__PURE__*/ jsx(Tag, {
4
+ ...props,
5
+ children: value
6
+ });
7
+ export { tagRender };
@@ -0,0 +1,2 @@
1
+ import { ColumnRender } from '../types';
2
+ export declare const textRender: ColumnRender<'text'>;
@@ -0,0 +1,10 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Typography } from "antd";
3
+ const textRender = (value, record, index, props)=>/*#__PURE__*/ jsx(Typography.Text, {
4
+ ellipsis: {
5
+ tooltip: true
6
+ },
7
+ ...props,
8
+ children: value
9
+ });
10
+ export { textRender };
@@ -0,0 +1,2 @@
1
+ import { ColumnRender } from '../types';
2
+ export declare const timeRender: ColumnRender<'time'>;
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import dayjs from "dayjs";
3
+ const timeRender = (value, record, index, props)=>{
4
+ try {
5
+ const time = value ? dayjs(value).format(props?.format) : '-';
6
+ return /*#__PURE__*/ jsx("span", {
7
+ children: time
8
+ });
9
+ } catch {
10
+ return /*#__PURE__*/ jsx("span", {
11
+ children: "-"
12
+ });
13
+ }
14
+ };
15
+ export { timeRender };
@@ -0,0 +1,34 @@
1
+ import { TableProps, TagProps, TypographyProps } from 'antd';
2
+ import { ColumnType } from 'antd/es/table';
3
+ import { HTMLAttributeAnchorTarget, ReactNode } from 'react';
4
+ import { ListPageStore } from '../../context';
5
+ export type ComponentType = 'text' | 'time' | 'tag' | 'link' | 'switch';
6
+ export type ComponentProps<RecordValue extends Record<string, any> = any> = {
7
+ text: TypographyProps['Text'];
8
+ time: {
9
+ format?: string;
10
+ };
11
+ tag: TagProps;
12
+ link: {
13
+ titlePropName?: string | ((record: RecordValue) => string);
14
+ hrefPropName?: string | ((record: RecordValue) => string);
15
+ target?: HTMLAttributeAnchorTarget;
16
+ };
17
+ switch: {
18
+ syncChange?: (value: boolean, record: RecordValue) => Promise<void>;
19
+ };
20
+ };
21
+ export type CustomColumnRender<RecordValue extends Record<string, any> = any, Context = any> = (value: RecordValue[keyof RecordValue], record: RecordValue, index: number, ctx: Context) => ReactNode;
22
+ export interface ListPageTableColumn<FilterValue = any, RecordValue extends Record<string, any> = any> extends ColumnType<RecordValue> {
23
+ component?: ComponentType | CustomColumnRender<RecordValue, ListPageStore<FilterValue, RecordValue>>;
24
+ props?: this['component'] extends ComponentType ? ComponentProps<RecordValue>[this['component']] : unknown;
25
+ }
26
+ export interface DataTableProps<FilterValue = any, RecordValue extends Record<string, any> = any> {
27
+ title?: ReactNode;
28
+ extra?: React.ReactNode | ((ctx: ListPageStore<FilterValue, RecordValue>) => React.ReactNode);
29
+ rowSelectionType?: 'checkbox' | 'radio';
30
+ rowTitleKey?: string;
31
+ columns?: ListPageTableColumn<FilterValue, RecordValue>[];
32
+ tableProps?: Omit<TableProps<RecordValue>, 'dataSource' | 'title' | 'columns'>;
33
+ }
34
+ export type ColumnRender<Type extends ComponentType, R extends Record<string, any> = any, K extends string = any> = (value: R[K], record: R, index: number, props: ComponentProps<R>[Type]) => ReactNode;
@@ -0,0 +1,2 @@
1
+ import { ComponentType } from '../types';
2
+ export declare function createColumnRender<RecordValue extends Record<string, any> = any, FilterValue = any>(component?: ComponentType, props?: any): ((value: any, record: RecordValue, index: number) => import("react").ReactNode) | undefined;