This commit is contained in:
2025-09-19 14:25:20 +08:00
parent 269893a435
commit fbf3f77229
24949 changed files with 2839404 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import Alert from './src/alert.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElAlert: SFCWithInstall<typeof Alert>;
export default ElAlert;
export * from './src/alert';
export type { AlertInstance } from './src/instance';

View File

@@ -0,0 +1,8 @@
import Alert from './src/alert.mjs';
export { alertEffects, alertEmits, alertProps } from './src/alert2.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElAlert = withInstall(Alert);
export { ElAlert, ElAlert as default };
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/alert/index.ts"],"sourcesContent":["import { withInstall } from '@element-plus/utils'\nimport Alert from './src/alert.vue'\n\nimport type { SFCWithInstall } from '@element-plus/utils'\n\nexport const ElAlert: SFCWithInstall<typeof Alert> = withInstall(Alert)\nexport default ElAlert\n\nexport * from './src/alert'\nexport type { AlertInstance } from './src/instance'\n"],"names":[],"mappings":";;;;AAEY,MAAC,OAAO,GAAG,WAAW,CAAC,KAAK;;;;"}

View File

@@ -0,0 +1,22 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
export declare const alertEffects: readonly ["light", "dark"];
export declare const alertProps: {
readonly showAfter: NumberConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly autoClose: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly title: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly description: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "error" | "primary" | "success" | "warning" | "info", unknown, "info", boolean>;
readonly closable: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly closeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly showIcon: BooleanConstructor;
readonly center: BooleanConstructor;
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "dark" | "light", unknown, "light", boolean>;
};
export type AlertProps = ExtractPropTypes<typeof alertProps>;
export type AlertPropsPublic = __ExtractPublicPropTypes<typeof alertProps>;
export declare const alertEmits: {
open: () => boolean;
close: (evt?: Event) => boolean;
};
export type AlertEmits = typeof alertEmits;

View File

@@ -0,0 +1,113 @@
import { defineComponent, useSlots, ref, computed, toRef, openBlock, createBlock, Transition, unref, withCtx, withDirectives, createElementVNode, normalizeClass, renderSlot, resolveDynamicComponent, createCommentVNode, createElementBlock, createTextVNode, toDisplayString, Fragment, createVNode, vShow } from 'vue';
import { ElIcon } from '../../icon/index.mjs';
import { alertProps, alertEmits } from './alert2.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useDelayedToggle } from '../../../hooks/use-delayed-toggle/index.mjs';
import { TypeComponentsMap, TypeComponents } from '../../../utils/vue/icon.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { isUndefined } from '../../../utils/types.mjs';
import { isClient } from '@vueuse/core';
const __default__ = defineComponent({
name: "ElAlert"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: alertProps,
emits: alertEmits,
setup(__props, { emit }) {
const props = __props;
const { Close } = TypeComponents;
const slots = useSlots();
const ns = useNamespace("alert");
const visible = ref(isUndefined(props.showAfter));
const iconComponent = computed(() => TypeComponentsMap[props.type]);
const hasDesc = computed(() => !!(props.description || slots.default));
const open = () => {
visible.value = true;
emit("open");
};
const close = (event) => {
visible.value = false;
emit("close", event);
};
const { onOpen, onClose } = useDelayedToggle({
showAfter: toRef(props, "showAfter", 0),
hideAfter: toRef(props, "hideAfter"),
autoClose: toRef(props, "autoClose"),
open,
close
});
if (isClient) {
onOpen();
}
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, {
name: unref(ns).b("fade"),
persisted: ""
}, {
default: withCtx(() => [
withDirectives(createElementVNode("div", {
class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.type), unref(ns).is("center", _ctx.center), unref(ns).is(_ctx.effect)]),
role: "alert"
}, [
_ctx.showIcon && (_ctx.$slots.icon || unref(iconComponent)) ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass([unref(ns).e("icon"), { [unref(ns).is("big")]: unref(hasDesc) }])
}, {
default: withCtx(() => [
renderSlot(_ctx.$slots, "icon", {}, () => [
(openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
])
]),
_: 3
}, 8, ["class"])) : createCommentVNode("v-if", true),
createElementVNode("div", {
class: normalizeClass(unref(ns).e("content"))
}, [
_ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
key: 0,
class: normalizeClass([unref(ns).e("title"), { "with-description": unref(hasDesc) }])
}, [
renderSlot(_ctx.$slots, "title", {}, () => [
createTextVNode(toDisplayString(_ctx.title), 1)
])
], 2)) : createCommentVNode("v-if", true),
unref(hasDesc) ? (openBlock(), createElementBlock("p", {
key: 1,
class: normalizeClass(unref(ns).e("description"))
}, [
renderSlot(_ctx.$slots, "default", {}, () => [
createTextVNode(toDisplayString(_ctx.description), 1)
])
], 2)) : createCommentVNode("v-if", true),
_ctx.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
_ctx.closeText ? (openBlock(), createElementBlock("div", {
key: 0,
class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
onClick: close
}, toDisplayString(_ctx.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
key: 1,
class: normalizeClass(unref(ns).e("close-btn")),
onClick: unref(onClose)
}, {
default: withCtx(() => [
createVNode(unref(Close))
]),
_: 1
}, 8, ["class", "onClick"]))
], 64)) : createCommentVNode("v-if", true)
], 2)
], 2), [
[vShow, visible.value]
])
]),
_: 3
}, 8, ["name"]);
};
}
});
var Alert = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "alert.vue"]]);
export { Alert as default };
//# sourceMappingURL=alert.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"alert.mjs","sources":["../../../../../../packages/components/alert/src/alert.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"visible\"\n :class=\"[ns.b(), ns.m(type), ns.is('center', center), ns.is(effect)]\"\n role=\"alert\"\n >\n <el-icon\n v-if=\"showIcon && ($slots.icon || iconComponent)\"\n :class=\"[ns.e('icon'), { [ns.is('big')]: hasDesc }]\"\n >\n <slot name=\"icon\">\n <component :is=\"iconComponent\" />\n </slot>\n </el-icon>\n\n <div :class=\"ns.e('content')\">\n <span\n v-if=\"title || $slots.title\"\n :class=\"[ns.e('title'), { 'with-description': hasDesc }]\"\n >\n <slot name=\"title\">{{ title }}</slot>\n </span>\n <p v-if=\"hasDesc\" :class=\"ns.e('description')\">\n <slot>\n {{ description }}\n </slot>\n </p>\n <template v-if=\"closable\">\n <div\n v-if=\"closeText\"\n :class=\"[ns.e('close-btn'), ns.is('customed')]\"\n @click=\"close\"\n >\n {{ closeText }}\n </div>\n <el-icon v-else :class=\"ns.e('close-btn')\" @click=\"onClose\">\n <Close />\n </el-icon>\n </template>\n </div>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, toRef, useSlots } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n TypeComponents,\n TypeComponentsMap,\n isClient,\n isUndefined,\n} from '@element-plus/utils'\nimport { useDelayedToggle, useNamespace } from '@element-plus/hooks'\nimport { alertEmits, alertProps } from './alert'\n\nconst { Close } = TypeComponents\n\ndefineOptions({\n name: 'ElAlert',\n})\n\nconst props = defineProps(alertProps)\nconst emit = defineEmits(alertEmits)\nconst slots = useSlots()\n\nconst ns = useNamespace('alert')\n\nconst visible = ref(isUndefined(props.showAfter))\n\nconst iconComponent = computed(() => TypeComponentsMap[props.type])\n\nconst hasDesc = computed(() => !!(props.description || slots.default))\n\nconst open = () => {\n visible.value = true\n emit('open')\n}\n\nconst close = (event?: Event) => {\n visible.value = false\n emit('close', event)\n}\n\nconst { onOpen, onClose } = useDelayedToggle({\n showAfter: toRef(props, 'showAfter', 0),\n hideAfter: toRef(props, 'hideAfter'),\n autoClose: toRef(props, 'autoClose'),\n open,\n close,\n})\n\nif (isClient) {\n onOpen()\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;mCA2Dc,CAAA;AAAA,EACZ,IAAM,EAAA,SAAA;AACR,CAAA,CAAA,CAAA;;;;;;;AAJA,IAAM,MAAA,EAAE,OAAU,GAAA,cAAA,CAAA;AAQlB,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,IAAM,MAAA,EAAA,GAAK,aAAa,OAAO,CAAA,CAAA;AAE/B,IAAA,MAAM,OAAU,GAAA,GAAA,CAAI,WAAY,CAAA,KAAA,CAAM,SAAS,CAAC,CAAA,CAAA;AAEhD,IAAA,MAAM,gBAAgB,QAAS,CAAA,MAAM,iBAAkB,CAAA,KAAA,CAAM,IAAI,CAAC,CAAA,CAAA;AAElE,IAAM,MAAA,OAAA,GAAU,SAAS,MAAM,CAAC,EAAE,KAAM,CAAA,WAAA,IAAe,MAAM,OAAQ,CAAA,CAAA,CAAA;AAErE,IAAA,MAAM,OAAO,MAAM;AACjB,MAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA,CAAA;AAChB,MAAA,IAAA,CAAK,MAAM,CAAA,CAAA;AAAA,KACb,CAAA;AAEA,IAAM,MAAA,KAAA,GAAQ,CAAC,KAAkB,KAAA;AAC/B,MAAA,OAAA,CAAQ,KAAQ,GAAA,KAAA,CAAA;AAChB,MAAA,IAAA,CAAK,SAAS,KAAK,CAAA,CAAA;AAAA,KACrB,CAAA;AAEA,IAAA,MAAM,EAAE,MAAA,EAAQ,OAAQ,EAAA,GAAI,gBAAiB,CAAA;AAAA,MAC3C,SAAW,EAAA,KAAA,CAAM,KAAO,EAAA,WAAA,EAAa,CAAC,CAAA;AAAA,MACtC,SAAA,EAAW,KAAM,CAAA,KAAA,EAAO,WAAW,CAAA;AAAA,MACnC,SAAA,EAAW,KAAM,CAAA,KAAA,EAAO,WAAW,CAAA;AAAA,MACnC,IAAA;AAAA,MACA,KAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,IAAI,QAAU,EAAA;AACZ,MAAO,MAAA,EAAA,CAAA;AAAA,KACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,54 @@
declare function __VLS_template(): {
icon?(_: {}): any;
title?(_: {}): any;
default?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly showAfter: NumberConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly autoClose: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly title: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly description: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "error" | "primary" | "success" | "warning" | "info", unknown, "info", boolean>;
readonly closable: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly closeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly showIcon: BooleanConstructor;
readonly center: BooleanConstructor;
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "dark" | "light", unknown, "light", boolean>;
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
open: () => void;
close: (evt?: Event | undefined) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly showAfter: NumberConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly autoClose: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
readonly title: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly description: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly type: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "error" | "primary" | "success" | "warning" | "info", unknown, "info", boolean>;
readonly closable: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly closeText: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly showIcon: BooleanConstructor;
readonly center: BooleanConstructor;
readonly effect: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "dark" | "light", unknown, "light", boolean>;
}>> & {
onOpen?: (() => any) | undefined;
onClose?: ((evt?: Event | undefined) => any) | undefined;
}, {
readonly title: string;
readonly center: boolean;
readonly type: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "error" | "primary" | "success" | "warning" | "info", unknown>;
readonly description: string;
readonly effect: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "dark" | "light", unknown>;
readonly hideAfter: number;
readonly autoClose: number;
readonly closable: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly closeText: string;
readonly showIcon: boolean;
}>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};

View File

@@ -0,0 +1,46 @@
import { useDelayedToggleProps } from '../../../hooks/use-delayed-toggle/index.mjs';
import { TypeComponentsMap } from '../../../utils/vue/icon.mjs';
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
import { keysOf } from '../../../utils/objects.mjs';
import { isUndefined } from '../../../utils/types.mjs';
const alertEffects = ["light", "dark"];
const alertProps = buildProps({
title: {
type: String,
default: ""
},
description: {
type: String,
default: ""
},
type: {
type: String,
values: keysOf(TypeComponentsMap),
default: "info"
},
closable: {
type: Boolean,
default: true
},
closeText: {
type: String,
default: ""
},
showIcon: Boolean,
center: Boolean,
effect: {
type: String,
values: alertEffects,
default: "light"
},
...useDelayedToggleProps,
showAfter: Number
});
const alertEmits = {
open: () => true,
close: (evt) => isUndefined(evt) || evt instanceof Event
};
export { alertEffects, alertEmits, alertProps };
//# sourceMappingURL=alert2.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"alert2.mjs","sources":["../../../../../../packages/components/alert/src/alert.ts"],"sourcesContent":["import { useDelayedToggleProps } from '@element-plus/hooks'\nimport {\n TypeComponentsMap,\n buildProps,\n isUndefined,\n keysOf,\n} from '@element-plus/utils'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\n\nexport const alertEffects = ['light', 'dark'] as const\n\nexport const alertProps = buildProps({\n /**\n * @description alert title.\n */\n title: {\n type: String,\n default: '',\n },\n description: {\n type: String,\n default: '',\n },\n /**\n * @description alert type.\n */\n type: {\n type: String,\n values: keysOf(TypeComponentsMap),\n default: 'info',\n },\n /**\n * @description whether alert can be dismissed.\n */\n closable: {\n type: Boolean,\n default: true,\n },\n /**\n * @description text for replacing x button\n */\n closeText: {\n type: String,\n default: '',\n },\n /**\n * @description whether show icon\n */\n showIcon: Boolean,\n /**\n * @description should content be placed in center.\n */\n center: Boolean,\n effect: {\n type: String,\n values: alertEffects,\n default: 'light',\n },\n ...useDelayedToggleProps,\n /**\n * @description delay of appearance, in millisecond\n */\n showAfter: Number,\n} as const)\nexport type AlertProps = ExtractPropTypes<typeof alertProps>\nexport type AlertPropsPublic = __ExtractPublicPropTypes<typeof alertProps>\n\nexport const alertEmits = {\n open: () => true,\n close: (evt?: Event) => isUndefined(evt) || evt instanceof Event,\n}\nexport type AlertEmits = typeof alertEmits\n"],"names":[],"mappings":";;;;;;AAOY,MAAC,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE;AAClC,MAAC,UAAU,GAAG,UAAU,CAAC;AACrC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC;AACrC,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,MAAM,EAAE,OAAO;AACjB,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,YAAY;AACxB,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,GAAG,qBAAqB;AAC1B,EAAE,SAAS,EAAE,MAAM;AACnB,CAAC,EAAE;AACS,MAAC,UAAU,GAAG;AAC1B,EAAE,IAAI,EAAE,MAAM,IAAI;AAClB,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,YAAY,KAAK;AAC1D;;;;"}

View File

@@ -0,0 +1,2 @@
import type Alert from './alert.vue';
export type AlertInstance = InstanceType<typeof Alert> & unknown;

View File

@@ -0,0 +1,2 @@
//# sourceMappingURL=instance.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"instance.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
import 'element-plus/es/components/base/style/css';
import 'element-plus/theme-chalk/el-alert.css';

View File

@@ -0,0 +1,3 @@
import '../../base/style/css.mjs';
import 'element-plus/theme-chalk/el-alert.css';
//# sourceMappingURL=css.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"css.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}

View File

@@ -0,0 +1,2 @@
import 'element-plus/es/components/base/style';
import 'element-plus/theme-chalk/src/alert.scss';

View File

@@ -0,0 +1,3 @@
import '../../base/style/index.mjs';
import 'element-plus/theme-chalk/src/alert.scss';
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}