listpage-next 0.0.232 → 0.0.234
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,14 +1,8 @@
|
|
|
1
1
|
import { ModalProps } from 'antd';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
export interface PageModalProps extends Omit<ModalProps, '
|
|
4
|
-
visible: boolean;
|
|
5
|
-
onOk?: () => void;
|
|
6
|
-
onCancel?: () => void;
|
|
7
|
-
okText?: string;
|
|
8
|
-
cancelText?: string;
|
|
3
|
+
export interface PageModalProps extends Omit<ModalProps, 'footer' | 'title'> {
|
|
9
4
|
icon?: ReactNode;
|
|
10
5
|
title: string;
|
|
11
|
-
children?: ReactNode;
|
|
12
6
|
actionPosition?: 'top' | 'bottom' | 'none';
|
|
13
7
|
extraActions?: ReactNode;
|
|
14
8
|
}
|
|
@@ -3,15 +3,13 @@ import { Modal } from "antd";
|
|
|
3
3
|
import styled_components from "styled-components";
|
|
4
4
|
import { useActions } from "./useActions.js";
|
|
5
5
|
const PageModal = (props)=>{
|
|
6
|
-
const { icon,
|
|
6
|
+
const { icon, children, extraActions, actionPosition = 'bottom', ...modalProps } = props;
|
|
7
7
|
const { footer, header } = useActions(props);
|
|
8
8
|
return /*#__PURE__*/ jsx(ModalStyled, {
|
|
9
9
|
...modalProps,
|
|
10
|
-
open: visible,
|
|
11
10
|
title: header,
|
|
12
|
-
closeIcon: null,
|
|
13
11
|
footer: footer,
|
|
14
|
-
closable:
|
|
12
|
+
closable: false,
|
|
15
13
|
children: children
|
|
16
14
|
});
|
|
17
15
|
};
|
|
@@ -7,14 +7,14 @@ import { AsyncButton } from "../../../AsyncButton/index.js";
|
|
|
7
7
|
function useActions(props) {
|
|
8
8
|
const { actionPosition = 'bottom', okText, cancelText, onOk, icon, title, onCancel, extraActions, closable = true } = props;
|
|
9
9
|
const closeButton = useMemo(()=>{
|
|
10
|
-
if (true === closable) return /*#__PURE__*/ jsx(
|
|
10
|
+
if (true === closable) return /*#__PURE__*/ jsx(CloseButton, {
|
|
11
11
|
type: "text",
|
|
12
12
|
icon: /*#__PURE__*/ jsx(CloseOutlined, {}),
|
|
13
13
|
onClick: onCancel
|
|
14
14
|
});
|
|
15
15
|
if (false === closable) return null;
|
|
16
16
|
const { closeIcon, disabled } = closable;
|
|
17
|
-
return /*#__PURE__*/ jsx(
|
|
17
|
+
return /*#__PURE__*/ jsx(CloseButton, {
|
|
18
18
|
type: "text",
|
|
19
19
|
disabled: disabled,
|
|
20
20
|
icon: closeIcon || /*#__PURE__*/ jsx(CloseOutlined, {}),
|
|
@@ -32,9 +32,6 @@ function useActions(props) {
|
|
|
32
32
|
children: cancelText || '取消'
|
|
33
33
|
}),
|
|
34
34
|
/*#__PURE__*/ jsx(AsyncButton, {
|
|
35
|
-
style: {
|
|
36
|
-
marginLeft: '0.65rem'
|
|
37
|
-
},
|
|
38
35
|
type: "primary",
|
|
39
36
|
onClick: onOk,
|
|
40
37
|
children: okText || '确定'
|
|
@@ -126,7 +123,13 @@ const ExtraContainer = styled.div`
|
|
|
126
123
|
flex-shrink: 0;
|
|
127
124
|
display: flex;
|
|
128
125
|
align-items: center;
|
|
129
|
-
gap:
|
|
126
|
+
gap: 8px;
|
|
130
127
|
justify-content: flex-end;
|
|
131
128
|
`;
|
|
129
|
+
const CloseButton = styled(Button)`
|
|
130
|
+
color: rgba(0, 0, 0, 0.45);
|
|
131
|
+
:hover {
|
|
132
|
+
color: rgba(0, 0, 0, 0.88);
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
132
135
|
export { useActions };
|