listpage-next 0.0.211 → 0.0.213
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.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModalProps } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface PageModalProps extends Omit<ModalProps, 'visible' | 'open' | 'onOk' | 'onCancel' | 'footer' | 'title' | 'children' | 'okText' | 'cancelText' | 'closeIcon' | 'closeable'> {
|
|
4
|
+
visible: boolean;
|
|
5
|
+
onOk?: () => void;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
okText?: string;
|
|
8
|
+
cancelText?: string;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
title: string;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
actionPosition?: 'top' | 'bottom';
|
|
13
|
+
footerExtra?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const PageModal: (props: PageModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Modal } from "antd";
|
|
3
|
+
import styled_components from "styled-components";
|
|
4
|
+
import { AsyncButton } from "../../../AsyncButton/index.js";
|
|
5
|
+
const PageModal = (props)=>{
|
|
6
|
+
const { icon, visible, onCancel, onOk, okText, cancelText, title, children, footerExtra, actionPosition = 'bottom', ...modalProps } = props;
|
|
7
|
+
const footer = /*#__PURE__*/ jsxs(Fragment, {
|
|
8
|
+
children: [
|
|
9
|
+
/*#__PURE__*/ jsx(FlexContainer, {
|
|
10
|
+
children: footerExtra
|
|
11
|
+
}),
|
|
12
|
+
/*#__PURE__*/ jsxs("div", {
|
|
13
|
+
children: [
|
|
14
|
+
/*#__PURE__*/ jsx(Button, {
|
|
15
|
+
type: "text",
|
|
16
|
+
onClick: onCancel,
|
|
17
|
+
children: cancelText || '取消'
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ jsx(AsyncButton, {
|
|
20
|
+
style: {
|
|
21
|
+
marginLeft: '0.65rem'
|
|
22
|
+
},
|
|
23
|
+
type: "primary",
|
|
24
|
+
onClick: onOk,
|
|
25
|
+
children: okText || '确定'
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
const header = /*#__PURE__*/ jsxs(HeaderContainer, {
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ jsxs(FlexContainer, {
|
|
34
|
+
children: [
|
|
35
|
+
icon,
|
|
36
|
+
title
|
|
37
|
+
]
|
|
38
|
+
}),
|
|
39
|
+
/*#__PURE__*/ jsxs("div", {
|
|
40
|
+
children: [
|
|
41
|
+
footerExtra,
|
|
42
|
+
/*#__PURE__*/ jsx(Button, {
|
|
43
|
+
type: "text",
|
|
44
|
+
onClick: onCancel,
|
|
45
|
+
children: cancelText || '取消'
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ jsx(AsyncButton, {
|
|
48
|
+
style: {
|
|
49
|
+
marginLeft: '0.65rem'
|
|
50
|
+
},
|
|
51
|
+
type: "primary",
|
|
52
|
+
onClick: onOk,
|
|
53
|
+
children: okText || '确定'
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
return /*#__PURE__*/ jsx(ModalStyled, {
|
|
60
|
+
...modalProps,
|
|
61
|
+
open: visible,
|
|
62
|
+
title: 'top' === actionPosition ? header : /*#__PURE__*/ jsxs(FlexContainer, {
|
|
63
|
+
children: [
|
|
64
|
+
icon,
|
|
65
|
+
title
|
|
66
|
+
]
|
|
67
|
+
}),
|
|
68
|
+
closeIcon: null,
|
|
69
|
+
closable: 'bottom' === actionPosition,
|
|
70
|
+
footer: 'top' === actionPosition ? null : footer,
|
|
71
|
+
onCancel: onCancel,
|
|
72
|
+
onOk: onOk,
|
|
73
|
+
children: children
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const ModalStyled = styled_components(Modal)`
|
|
77
|
+
.ant-modal-content {
|
|
78
|
+
padding: 0;
|
|
79
|
+
}
|
|
80
|
+
.ant-modal-close {
|
|
81
|
+
top: 10px;
|
|
82
|
+
}
|
|
83
|
+
.ant-modal-footer {
|
|
84
|
+
padding: 14px 21px;
|
|
85
|
+
|
|
86
|
+
background-color: rgb(249 250 251 / 1);
|
|
87
|
+
border-top: 1px solid rgb(243 244 246 / 1);
|
|
88
|
+
justify-content: space-between;
|
|
89
|
+
align-items: center;
|
|
90
|
+
display: flex;
|
|
91
|
+
margin-top: 0;
|
|
92
|
+
|
|
93
|
+
border-radius: 0 0 0.5rem 0.5rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ant-modal-header {
|
|
97
|
+
margin: 0;
|
|
98
|
+
padding: 14px 21px;
|
|
99
|
+
background-color: rgb(249 250 251 / 1);
|
|
100
|
+
border-bottom: 1px solid rgb(243 244 246 / 1);
|
|
101
|
+
}
|
|
102
|
+
.ant-modal-body {
|
|
103
|
+
padding: 21px;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
const FlexContainer = styled_components.div`
|
|
107
|
+
flex-grow: 1;
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
gap: 4px;
|
|
111
|
+
`;
|
|
112
|
+
const HeaderContainer = styled_components.div`
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
`;
|
|
116
|
+
export { PageModal };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { PageModal } from "./components/PageModal/index.js";
|
|
1
2
|
import { PageLoading } from "./components/PageLoading/index.js";
|
|
2
3
|
import { PageLayout } from "./components/PageLayout/index.js";
|
|
3
4
|
import { LayoutContent } from "./components/LayoutContent/index.js";
|
|
4
5
|
import { PageContext, usePageContext } from "./components/PageProvider/index.js";
|
|
5
|
-
export { LayoutContent, PageContext, PageLayout, PageLoading, usePageContext };
|
|
6
|
+
export { LayoutContent, PageContext, PageLayout, PageLoading, PageModal, usePageContext };
|