import { computed, defineComponent } from 'vue';
import useStyle from './style';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import type { IconType } from './interface';
import Notice from '../vc-notification/Notice';
import classNames from '../_util/classNames';
import type { NoticeProps } from '../vc-notification/Notice';
import type { VueNode } from '../_util/type';
import LoadingOutlined from '@ant-design/icons-vue/LoadingOutlined';
import ExclamationCircleFilled from '@ant-design/icons-vue/ExclamationCircleFilled';
import CloseCircleFilled from '@ant-design/icons-vue/CloseCircleFilled';
import CheckCircleFilled from '@ant-design/icons-vue/CheckCircleFilled';
import InfoCircleFilled from '@ant-design/icons-vue/InfoCircleFilled';
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
import { renderHelper } from '../_util/util';
export function getCloseIcon(prefixCls: string, closeIcon?: VueNode) {
return (
closeIcon || (
)
);
}
export interface PureContentProps {
prefixCls: string;
icon?: VueNode;
message?: VueNode;
description?: VueNode;
btn?: VueNode;
type?: IconType;
}
export const TypeIcon = {
info: ,
success: ,
error: ,
warning: ,
loading: ,
};
const typeToIcon = {
success: CheckCircleFilled,
info: InfoCircleFilled,
error: CloseCircleFilled,
warning: ExclamationCircleFilled,
};
export function PureContent({
prefixCls,
icon,
type,
message,
description,
btn,
}: PureContentProps) {
let iconNode = null;
if (icon) {
iconNode = {renderHelper(icon)};
} else if (type) {
const Icon = typeToIcon[type];
iconNode = ;
}
return (
{iconNode}
{message}
{description}
{btn &&
{btn}
}
);
}
export interface PurePanelProps
extends Omit,
Omit {
prefixCls?: string;
}
/** @private Internal Component. Do not use in your production. */
export default defineComponent({
name: 'PurePanel',
inheritAttrs: false,
props: ['prefixCls', 'icon', 'type', 'message', 'description', 'btn', 'closeIcon'] as any,
setup(props) {
const { getPrefixCls } = useConfigInject('notification', props);
const prefixCls = computed(() => props.prefixCls || getPrefixCls('notification'));
const noticePrefixCls = computed(() => `${prefixCls.value}-notice`);
const [, hashId] = useStyle(prefixCls);
return () => {
return (
);
};
},
});