antd-overlay 0.0.2 → 0.0.3
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.
- package/LICENSE +21 -0
- package/README.md +7 -10
- package/package.json +5 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 RaineySpace
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -62,19 +62,19 @@ interface MyModalProps extends CustomModalProps<{ result: string }> {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
const MyModal: React.FC<MyModalProps> = ({
|
|
65
|
-
open,
|
|
66
65
|
customClose,
|
|
67
66
|
customOk,
|
|
68
67
|
initialValue,
|
|
68
|
+
...props
|
|
69
69
|
}) => {
|
|
70
70
|
const [value, setValue] = useState(initialValue || '');
|
|
71
71
|
|
|
72
72
|
return (
|
|
73
73
|
<Modal
|
|
74
74
|
title="输入内容"
|
|
75
|
-
open={open}
|
|
76
75
|
onCancel={customClose}
|
|
77
76
|
onOk={() => customOk?.({ result: value })}
|
|
77
|
+
{...props}
|
|
78
78
|
>
|
|
79
79
|
<Input value={value} onChange={(e) => setValue(e.target.value)} />
|
|
80
80
|
</Modal>
|
|
@@ -312,22 +312,19 @@ import { CustomModalProps, useGlobalModal } from 'antd-overlay';
|
|
|
312
312
|
|
|
313
313
|
interface ConfirmDeleteModalProps extends CustomModalProps<void> {
|
|
314
314
|
itemName: string;
|
|
315
|
-
onConfirm: () => Promise<void>;
|
|
316
315
|
}
|
|
317
316
|
|
|
318
317
|
const ConfirmDeleteModal: React.FC<ConfirmDeleteModalProps> = ({
|
|
319
|
-
open,
|
|
320
318
|
customClose,
|
|
321
319
|
customOk,
|
|
322
320
|
itemName,
|
|
323
|
-
|
|
321
|
+
...props
|
|
324
322
|
}) => {
|
|
325
323
|
const [loading, setLoading] = useState(false);
|
|
326
324
|
|
|
327
325
|
const handleOk = async () => {
|
|
328
326
|
setLoading(true);
|
|
329
327
|
try {
|
|
330
|
-
await onConfirm();
|
|
331
328
|
message.success('删除成功');
|
|
332
329
|
customOk?.();
|
|
333
330
|
} catch (error) {
|
|
@@ -340,12 +337,12 @@ const ConfirmDeleteModal: React.FC<ConfirmDeleteModalProps> = ({
|
|
|
340
337
|
return (
|
|
341
338
|
<Modal
|
|
342
339
|
title="确认删除"
|
|
343
|
-
open={open}
|
|
344
340
|
onCancel={customClose}
|
|
345
341
|
onOk={handleOk}
|
|
346
342
|
confirmLoading={loading}
|
|
347
343
|
okText="删除"
|
|
348
344
|
okType="danger"
|
|
345
|
+
{...props}
|
|
349
346
|
>
|
|
350
347
|
确定要删除 "{itemName}" 吗?此操作不可恢复。
|
|
351
348
|
</Modal>
|
|
@@ -359,7 +356,7 @@ function ItemList() {
|
|
|
359
356
|
const handleDelete = (item: Item) => {
|
|
360
357
|
openConfirm({
|
|
361
358
|
itemName: item.name,
|
|
362
|
-
|
|
359
|
+
customOk: () => deleteItem(item.id),
|
|
363
360
|
});
|
|
364
361
|
};
|
|
365
362
|
|
|
@@ -393,9 +390,9 @@ interface UserDetailDrawerProps extends CustomDrawerProps {
|
|
|
393
390
|
}
|
|
394
391
|
|
|
395
392
|
const UserDetailDrawer: React.FC<UserDetailDrawerProps> = ({
|
|
396
|
-
open,
|
|
397
393
|
customClose,
|
|
398
394
|
userId,
|
|
395
|
+
...props
|
|
399
396
|
}) => {
|
|
400
397
|
const [user, setUser] = useState<User | null>(null);
|
|
401
398
|
const [loading, setLoading] = useState(false);
|
|
@@ -412,9 +409,9 @@ const UserDetailDrawer: React.FC<UserDetailDrawerProps> = ({
|
|
|
412
409
|
return (
|
|
413
410
|
<Drawer
|
|
414
411
|
title="用户详情"
|
|
415
|
-
open={open}
|
|
416
412
|
onClose={customClose}
|
|
417
413
|
width={500}
|
|
414
|
+
{...props}
|
|
418
415
|
>
|
|
419
416
|
{loading ? (
|
|
420
417
|
<Spin />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "antd-overlay",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Ant Design Modal/Drawer 命令式调用方案",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -8,14 +8,9 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./dist/index.d.cts",
|
|
17
|
-
"default": "./dist/index.cjs"
|
|
18
|
-
}
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
19
14
|
}
|
|
20
15
|
},
|
|
21
16
|
"files": [
|
|
@@ -47,7 +42,7 @@
|
|
|
47
42
|
"@changesets/cli": "^2.27.10",
|
|
48
43
|
"@eslint/js": "^9.17.0",
|
|
49
44
|
"@types/react": "^19.2.7",
|
|
50
|
-
"antd": "^6.
|
|
45
|
+
"antd": "^6.2.2",
|
|
51
46
|
"eslint": "^9.17.0",
|
|
52
47
|
"eslint-config-prettier": "^10.0.1",
|
|
53
48
|
"eslint-plugin-react-hooks": "^5.1.0",
|