listpage-next 0.0.234 → 0.0.235
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.
|
@@ -2,28 +2,11 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button } from "antd";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { styled } from "styled-components";
|
|
5
|
-
import { CloseOutlined } from "@ant-design/icons";
|
|
6
5
|
import { AsyncButton } from "../../../AsyncButton/index.js";
|
|
6
|
+
import { useCloseButton } from "./useCloseButton.js";
|
|
7
7
|
function useActions(props) {
|
|
8
|
-
const { actionPosition = 'bottom', okText, cancelText, onOk, icon, title, onCancel, extraActions
|
|
9
|
-
const closeButton =
|
|
10
|
-
if (true === closable) return /*#__PURE__*/ jsx(CloseButton, {
|
|
11
|
-
type: "text",
|
|
12
|
-
icon: /*#__PURE__*/ jsx(CloseOutlined, {}),
|
|
13
|
-
onClick: onCancel
|
|
14
|
-
});
|
|
15
|
-
if (false === closable) return null;
|
|
16
|
-
const { closeIcon, disabled } = closable;
|
|
17
|
-
return /*#__PURE__*/ jsx(CloseButton, {
|
|
18
|
-
type: "text",
|
|
19
|
-
disabled: disabled,
|
|
20
|
-
icon: closeIcon || /*#__PURE__*/ jsx(CloseOutlined, {}),
|
|
21
|
-
onClick: onCancel
|
|
22
|
-
});
|
|
23
|
-
}, [
|
|
24
|
-
closable,
|
|
25
|
-
onCancel
|
|
26
|
-
]);
|
|
8
|
+
const { actionPosition = 'bottom', okText, cancelText, onOk, icon, title, onCancel, extraActions } = props;
|
|
9
|
+
const { closeButton } = useCloseButton(props);
|
|
27
10
|
const actions = 'none' === actionPosition ? null : /*#__PURE__*/ jsxs(Fragment, {
|
|
28
11
|
children: [
|
|
29
12
|
/*#__PURE__*/ jsx(Button, {
|
|
@@ -39,12 +22,12 @@ function useActions(props) {
|
|
|
39
22
|
]
|
|
40
23
|
});
|
|
41
24
|
const footer = useMemo(()=>{
|
|
42
|
-
if ('bottom' === actionPosition) return /*#__PURE__*/ jsxs(
|
|
25
|
+
if ('bottom' === actionPosition) return /*#__PURE__*/ jsxs(Fragment, {
|
|
43
26
|
children: [
|
|
44
|
-
/*#__PURE__*/ jsx(
|
|
27
|
+
/*#__PURE__*/ jsx(FlexContainer, {
|
|
45
28
|
children: extraActions
|
|
46
29
|
}),
|
|
47
|
-
/*#__PURE__*/ jsx(
|
|
30
|
+
/*#__PURE__*/ jsx(ExtraContainer, {
|
|
48
31
|
children: actions
|
|
49
32
|
})
|
|
50
33
|
]
|
|
@@ -126,10 +109,4 @@ const ExtraContainer = styled.div`
|
|
|
126
109
|
gap: 8px;
|
|
127
110
|
justify-content: flex-end;
|
|
128
111
|
`;
|
|
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
|
-
`;
|
|
135
112
|
export { useActions };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PageModalProps } from '.';
|
|
2
|
+
export declare function useCloseButton(props: PageModalProps): {
|
|
3
|
+
closeButton: import("react/jsx-runtime").JSX.Element | null;
|
|
4
|
+
closable: boolean;
|
|
5
|
+
} | {
|
|
6
|
+
closeButton: import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
closable?: undefined;
|
|
8
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { CloseOutlined } from "@ant-design/icons";
|
|
4
|
+
import { styled } from "styled-components";
|
|
5
|
+
import { Button } from "antd";
|
|
6
|
+
function useCloseButton(props) {
|
|
7
|
+
const { actionPosition, onCancel, closable = true } = props;
|
|
8
|
+
const closeButton = useMemo(()=>{
|
|
9
|
+
if (true === closable) return /*#__PURE__*/ jsx(CloseButton, {
|
|
10
|
+
type: "text",
|
|
11
|
+
icon: /*#__PURE__*/ jsx(CloseOutlined, {}),
|
|
12
|
+
onClick: onCancel
|
|
13
|
+
});
|
|
14
|
+
if (false === closable) return null;
|
|
15
|
+
const { closeIcon, disabled } = closable;
|
|
16
|
+
return /*#__PURE__*/ jsx(CloseButton, {
|
|
17
|
+
type: "text",
|
|
18
|
+
disabled: disabled,
|
|
19
|
+
icon: closeIcon || /*#__PURE__*/ jsx(CloseOutlined, {}),
|
|
20
|
+
onClick: onCancel
|
|
21
|
+
});
|
|
22
|
+
}, [
|
|
23
|
+
closable,
|
|
24
|
+
onCancel
|
|
25
|
+
]);
|
|
26
|
+
if ('top' === actionPosition) return {
|
|
27
|
+
closeButton,
|
|
28
|
+
closable: false
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
closeButton
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const CloseButton = styled(Button)`
|
|
35
|
+
color: rgba(0, 0, 0, 0.45);
|
|
36
|
+
:hover {
|
|
37
|
+
color: rgba(0, 0, 0, 0.88);
|
|
38
|
+
}
|
|
39
|
+
`;
|
|
40
|
+
export { useCloseButton };
|