1
- import { computed } from 'vue' ;
1
+ import { computed , defineComponent } from 'vue' ;
2
2
import useStyle from './style' ;
3
3
import useConfigInject from '../config-provider/hooks/useConfigInject' ;
4
4
import type { IconType } from './interface' ;
5
5
import Notice from '../vc-notification/Notice' ;
6
6
import classNames from '../_util/classNames' ;
7
7
import type { NoticeProps } from '../vc-notification/Notice' ;
8
8
import type { VueNode } from '../_util/type' ;
9
- import {
10
- CheckCircleOutlined ,
11
- CloseCircleOutlined ,
12
- CloseOutlined ,
13
- ExclamationCircleOutlined ,
14
- InfoCircleOutlined ,
15
- } from '@ant-design/icons-vue' ;
9
+ import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined' ;
10
+ import ExclamationCircleFilled from '@ant-design/icons-vue/ExclamationCircleFilled' ;
11
+ import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled' ;
12
+ import CheckCircleFilled from '@ant-design/icons-vue/CheckCircleFilled' ;
13
+ import InfoCircleFilled from '@ant-design/icons-vue/InfoCircleFilled' ;
14
+ import CloseOutlined from '@ant-design/icons-vue/CloseOutlined' ;
16
15
import { renderHelper } from '../_util/util' ;
17
16
18
17
export function getCloseIcon ( prefixCls : string , closeIcon ?: VueNode ) {
@@ -34,11 +33,19 @@ export interface PureContentProps {
34
33
type ?: IconType ;
35
34
}
36
35
36
+ export const TypeIcon = {
37
+ info : < InfoCircleFilled /> ,
38
+ success : < CheckCircleFilled /> ,
39
+ error : < CloseCircleFilled /> ,
40
+ warning : < ExclamationCircleFilled /> ,
41
+ loading : < LoadingOutlined /> ,
42
+ } ;
43
+
37
44
const typeToIcon = {
38
- success : CheckCircleOutlined ,
39
- info : InfoCircleOutlined ,
40
- error : CloseCircleOutlined ,
41
- warning : ExclamationCircleOutlined ,
45
+ success : CheckCircleFilled ,
46
+ info : InfoCircleFilled ,
47
+ error : CloseCircleFilled ,
48
+ warning : ExclamationCircleFilled ,
42
49
} ;
43
50
44
51
export function PureContent ( {
@@ -74,36 +81,42 @@ export function PureContent({
74
81
75
82
export interface PurePanelProps
76
83
extends Omit < NoticeProps , 'prefixCls' | 'eventKey' > ,
77
- Omit < PureContentProps , 'prefixCls' | 'children' > {
84
+ Omit < PureContentProps , 'prefixCls' > {
78
85
prefixCls ?: string ;
79
86
}
80
87
81
88
/** @private Internal Component. Do not use in your production. */
82
- export default function PurePanel ( props : PurePanelProps ) {
83
- const { getPrefixCls } = useConfigInject ( 'notification' , props ) ;
84
- const prefixCls = computed ( ( ) => props . prefixCls || getPrefixCls ( 'notification' ) ) ;
85
- const noticePrefixCls = `${ prefixCls . value } -notice` ;
89
+ export default defineComponent < PurePanelProps > ( {
90
+ name : 'PurePanel' ,
91
+ inheritAttrs : false ,
92
+ props : [ 'prefixCls' , 'icon' , 'type' , 'message' , 'description' , 'btn' , 'closeIcon' ] as any ,
93
+ setup ( props ) {
94
+ const { getPrefixCls } = useConfigInject ( 'notification' , props ) ;
95
+ const prefixCls = computed ( ( ) => props . prefixCls || getPrefixCls ( 'notification' ) ) ;
96
+ const noticePrefixCls = computed ( ( ) => `${ prefixCls . value } -notice` ) ;
86
97
87
- const [ , hashId ] = useStyle ( prefixCls ) ;
88
-
89
- return (
90
- < Notice
91
- { ...props }
92
- prefixCls = { prefixCls . value }
93
- class = { classNames ( hashId . value , `${ noticePrefixCls } -pure-panel` ) }
94
- noticeKey = "pure"
95
- duration = { null }
96
- closable = { props . closable }
97
- closeIcon = { getCloseIcon ( prefixCls . value , props . closeIcon ) }
98
- >
99
- < PureContent
100
- prefixCls = { noticePrefixCls }
101
- icon = { props . icon }
102
- type = { props . type }
103
- message = { props . message }
104
- description = { props . description }
105
- btn = { props . btn }
106
- />
107
- </ Notice >
108
- ) ;
109
- }
98
+ const [ , hashId ] = useStyle ( prefixCls ) ;
99
+ return ( ) => {
100
+ return (
101
+ < Notice
102
+ { ...props }
103
+ prefixCls = { prefixCls . value }
104
+ class = { classNames ( hashId . value , `${ noticePrefixCls . value } -pure-panel` ) }
105
+ noticeKey = "pure"
106
+ duration = { null }
107
+ closable = { props . closable }
108
+ closeIcon = { getCloseIcon ( prefixCls . value , props . closeIcon ) }
109
+ >
110
+ < PureContent
111
+ prefixCls = { noticePrefixCls . value }
112
+ icon = { props . icon }
113
+ type = { props . type }
114
+ message = { props . message }
115
+ description = { props . description }
116
+ btn = { props . btn }
117
+ />
118
+ </ Notice >
119
+ ) ;
120
+ } ;
121
+ } ,
122
+ } ) ;
0 commit comments