1- import { computed } from 'vue' ;
1+ import { computed , defineComponent } from 'vue' ;
22import useStyle from './style' ;
33import useConfigInject from '../config-provider/hooks/useConfigInject' ;
44import type { IconType } from './interface' ;
55import Notice from '../vc-notification/Notice' ;
66import classNames from '../_util/classNames' ;
77import type { NoticeProps } from '../vc-notification/Notice' ;
88import 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' ;
1615import { renderHelper } from '../_util/util' ;
1716
1817export function getCloseIcon ( prefixCls : string , closeIcon ?: VueNode ) {
@@ -34,11 +33,19 @@ export interface PureContentProps {
3433 type ?: IconType ;
3534}
3635
36+ export const TypeIcon = {
37+ info : < InfoCircleFilled /> ,
38+ success : < CheckCircleFilled /> ,
39+ error : < CloseCircleFilled /> ,
40+ warning : < ExclamationCircleFilled /> ,
41+ loading : < LoadingOutlined /> ,
42+ } ;
43+
3744const 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 ,
4249} ;
4350
4451export function PureContent ( {
@@ -74,36 +81,42 @@ export function PureContent({
7481
7582export interface PurePanelProps
7683 extends Omit < NoticeProps , 'prefixCls' | 'eventKey' > ,
77- Omit < PureContentProps , 'prefixCls' | 'children' > {
84+ Omit < PureContentProps , 'prefixCls' > {
7885 prefixCls ?: string ;
7986}
8087
8188/** @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` ) ;
8697
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