完全跑通1.0版本

This commit is contained in:
2026-05-26 12:56:03 +08:00
parent 2ece5174a7
commit 93c714a93b
11557 changed files with 1648225 additions and 36 deletions

View File

@@ -0,0 +1,9 @@
import { SFCWithInstall } from "../../utils/vue/typescript.js";
import { AlertEmits, AlertProps, AlertPropsPublic, alertEffects, alertEmits, alertProps } from "./src/alert.js";
import _default from "./src/alert.vue.js";
import { AlertInstance } from "./src/instance.js";
//#region ../../packages/components/alert/index.d.ts
declare const ElAlert: SFCWithInstall<typeof _default>;
//#endregion
export { AlertEmits, type AlertInstance, AlertProps, AlertPropsPublic, ElAlert, ElAlert as default, alertEffects, alertEmits, alertProps };

View File

@@ -0,0 +1,17 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
const require_install = require("../../utils/vue/install.js");
const require_alert = require("./src/alert.js");
const require_alert$1 = require("./src/alert2.js");
//#region ../../packages/components/alert/index.ts
const ElAlert = require_install.withInstall(require_alert$1.default);
//#endregion
exports.ElAlert = ElAlert;
exports.default = ElAlert;
exports.alertEffects = require_alert.alertEffects;
exports.alertEmits = require_alert.alertEmits;
exports.alertProps = require_alert.alertProps;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","names":["withInstall","Alert"],"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"],"mappings":";;;;;;;;AAKA,MAAa,UAAwCA,gBAAAA,YAAYC,gBAAAA,QAAM"}

View File

@@ -0,0 +1,63 @@
import { TypeComponentsMap } from "../../../utils/vue/icon.js";
import { EpPropFinalized } from "../../../utils/vue/props/types.js";
import { ExtractPublicPropTypes } from "vue";
//#region ../../packages/components/alert/src/alert.d.ts
declare const alertEffects: readonly ["light", "dark"];
interface AlertProps {
/**
* @description alert title.
*/
title?: string;
/**
* @description descriptive text.
*/
description?: string;
/**
* @description alert type.
*/
type?: keyof typeof TypeComponentsMap;
/**
* @description whether alert can be dismissed.
*/
closable?: boolean;
/**
* @description text for replacing x button
*/
closeText?: string;
/**
* @description whether show icon
*/
showIcon?: boolean;
/**
* @description should content be placed in center.
*/
center?: boolean;
/**
* @description theme style
*/
effect?: 'light' | 'dark';
}
/**
* @deprecated Removed after 3.0.0, Use `AlertProps` instead.
*/
declare const alertProps: {
readonly title: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly description: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly type: EpPropFinalized<StringConstructor, "error" | "info" | "primary" | "success" | "warning", unknown, "info", boolean>;
readonly closable: EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly closeText: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
readonly showIcon: BooleanConstructor;
readonly center: BooleanConstructor;
readonly effect: EpPropFinalized<StringConstructor, "light" | "dark", unknown, "light", boolean>;
};
/**
* @deprecated Removed after 3.0.0, Use `AlertProps` instead.
*/
type AlertPropsPublic = ExtractPublicPropTypes<typeof alertProps>;
declare const alertEmits: {
close: (evt: MouseEvent) => boolean;
};
type AlertEmits = typeof alertEmits;
//#endregion
export { AlertEmits, AlertProps, AlertPropsPublic, alertEffects, alertEmits, alertProps };

View File

@@ -0,0 +1,64 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_objects = require("../../../utils/objects.js");
const require_runtime = require("../../../utils/vue/props/runtime.js");
const require_icon = require("../../../utils/vue/icon.js");
//#region ../../packages/components/alert/src/alert.ts
const alertEffects = ["light", "dark"];
/**
* @deprecated Removed after 3.0.0, Use `AlertProps` instead.
*/
const alertProps = require_runtime.buildProps({
/**
* @description alert title.
*/
title: {
type: String,
default: ""
},
description: {
type: String,
default: ""
},
/**
* @description alert type.
*/
type: {
type: String,
values: require_objects.keysOf(require_icon.TypeComponentsMap),
default: "info"
},
/**
* @description whether alert can be dismissed.
*/
closable: {
type: Boolean,
default: true
},
/**
* @description text for replacing x button
*/
closeText: {
type: String,
default: ""
},
/**
* @description whether show icon
*/
showIcon: Boolean,
/**
* @description should content be placed in center.
*/
center: Boolean,
effect: {
type: String,
values: alertEffects,
default: "light"
}
});
const alertEmits = { close: (evt) => evt instanceof MouseEvent };
//#endregion
exports.alertEffects = alertEffects;
exports.alertEmits = alertEmits;
exports.alertProps = alertProps;
//# sourceMappingURL=alert.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"alert.js","names":["buildProps","keysOf","TypeComponentsMap"],"sources":["../../../../../../packages/components/alert/src/alert.ts"],"sourcesContent":["import { TypeComponentsMap, buildProps, keysOf } from '@element-plus/utils'\n\nimport type { ExtractPublicPropTypes } from 'vue'\n\nexport const alertEffects = ['light', 'dark'] as const\n\nexport interface AlertProps {\n /**\n * @description alert title.\n */\n title?: string\n /**\n * @description descriptive text.\n */\n description?: string\n /**\n * @description alert type.\n */\n type?: keyof typeof TypeComponentsMap\n /**\n * @description whether alert can be dismissed.\n */\n closable?: boolean\n /**\n * @description text for replacing x button\n */\n closeText?: string\n /**\n * @description whether show icon\n */\n showIcon?: boolean\n /**\n * @description should content be placed in center.\n */\n center?: boolean\n /**\n * @description theme style\n */\n effect?: 'light' | 'dark'\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `AlertProps` instead.\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} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `AlertProps` instead.\n */\nexport type AlertPropsPublic = ExtractPublicPropTypes<typeof alertProps>\n\nexport const alertEmits = {\n close: (evt: MouseEvent) => evt instanceof MouseEvent,\n}\nexport type AlertEmits = typeof alertEmits\n"],"mappings":";;;;;AAIA,MAAa,eAAe,CAAC,SAAS,OAAO;;;;AAwC7C,MAAa,aAAaA,gBAAAA,WAAW;;;;CAInC,OAAO;EACL,MAAM;EACN,SAAS;EACV;CACD,aAAa;EACX,MAAM;EACN,SAAS;EACV;;;;CAID,MAAM;EACJ,MAAM;EACN,QAAQC,gBAAAA,OAAOC,aAAAA,kBAAkB;EACjC,SAAS;EACV;;;;CAID,UAAU;EACR,MAAM;EACN,SAAS;EACV;;;;CAID,WAAW;EACT,MAAM;EACN,SAAS;EACV;;;;CAID,UAAU;;;;CAIV,QAAQ;CACR,QAAQ;EACN,MAAM;EACN,QAAQ;EACR,SAAS;EACV;CACF,CAAU;AAOX,MAAa,aAAa,EACxB,QAAQ,QAAoB,eAAe,YAC5C"}

View File

@@ -0,0 +1,34 @@
import { TypeComponentsMap } from "../../../utils/vue/icon.js";
import { AlertProps } from "./alert.js";
import * as _$vue from "vue";
//#region ../../packages/components/alert/src/alert.vue.d.ts
declare var __VLS_13: {}, __VLS_20: {}, __VLS_22: {};
type __VLS_Slots = {} & {
icon?: (props: typeof __VLS_13) => any;
} & {
title?: (props: typeof __VLS_20) => any;
} & {
default?: (props: typeof __VLS_22) => any;
};
declare const __VLS_base: _$vue.DefineComponent<AlertProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {
close: (evt: MouseEvent) => void;
}, string, _$vue.PublicProps, Readonly<AlertProps> & Readonly<{
onClose?: ((evt: MouseEvent) => any) | undefined;
}>, {
description: string;
title: string;
type: keyof typeof TypeComponentsMap;
closable: boolean;
closeText: string;
effect: "light" | "dark";
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
declare const _default: typeof __VLS_export;
type __VLS_WithSlots<T, S> = T & {
new (): {
$slots: S;
};
};
//#endregion
export { _default as default };

View File

@@ -0,0 +1,81 @@
require("../../../_virtual/_rolldown/runtime.js");
const require_icon = require("../../../utils/vue/icon.js");
const require_vnode = require("../../../utils/vue/vnode.js");
const require_index = require("../../../hooks/use-namespace/index.js");
const require_alert = require("./alert.js");
const require_index$1 = require("../../icon/index.js");
let vue = require("vue");
//#region ../../packages/components/alert/src/alert.vue?vue&type=script&setup=true&lang.ts
var alert_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
name: "ElAlert",
__name: "alert",
props: require_alert.alertProps,
emits: require_alert.alertEmits,
setup(__props, { emit: __emit }) {
const { Close } = require_icon.TypeComponents;
const props = __props;
const emit = __emit;
const slots = (0, vue.useSlots)();
const ns = require_index.useNamespace("alert");
const visible = (0, vue.ref)(true);
const iconComponent = (0, vue.computed)(() => require_icon.TypeComponentsMap[props.type]);
const hasDesc = (0, vue.computed)(() => {
if (props.description) return true;
const slotContent = slots.default?.();
if (!slotContent) return false;
return require_vnode.flattedChildren(slotContent).some((child) => !require_vnode.isComment(child));
});
const close = (evt) => {
visible.value = false;
emit("close", evt);
};
return (_ctx, _cache) => {
return (0, vue.openBlock)(), (0, vue.createBlock)(vue.Transition, {
name: (0, vue.unref)(ns).b("fade"),
persisted: ""
}, {
default: (0, vue.withCtx)(() => [(0, vue.withDirectives)((0, vue.createElementVNode)("div", {
class: (0, vue.normalizeClass)([
(0, vue.unref)(ns).b(),
(0, vue.unref)(ns).m(__props.type),
(0, vue.unref)(ns).is("center", __props.center),
(0, vue.unref)(ns).is(__props.effect)
]),
role: "alert"
}, [__props.showIcon && (_ctx.$slots.icon || iconComponent.value) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(require_index$1.ElIcon), {
key: 0,
class: (0, vue.normalizeClass)([(0, vue.unref)(ns).e("icon"), (0, vue.unref)(ns).is("big", hasDesc.value)])
}, {
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "icon", {}, () => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(iconComponent.value)))])]),
_: 3
}, 8, ["class"])) : (0, vue.createCommentVNode)("v-if", true), (0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("content")) }, [
__props.title || _ctx.$slots.title ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
key: 0,
class: (0, vue.normalizeClass)([(0, vue.unref)(ns).e("title"), { "with-description": hasDesc.value }])
}, [(0, vue.renderSlot)(_ctx.$slots, "title", {}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.title), 1)])], 2)) : (0, vue.createCommentVNode)("v-if", true),
hasDesc.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", {
key: 1,
class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("description"))
}, [(0, vue.renderSlot)(_ctx.$slots, "default", {}, () => [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.description), 1)])], 2)) : (0, vue.createCommentVNode)("v-if", true),
__props.closable ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, [__props.closeText ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
key: 0,
class: (0, vue.normalizeClass)([(0, vue.unref)(ns).e("close-btn"), (0, vue.unref)(ns).is("customed")]),
onClick: close
}, (0, vue.toDisplayString)(__props.closeText), 3)) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(require_index$1.ElIcon), {
key: 1,
class: (0, vue.normalizeClass)((0, vue.unref)(ns).e("close-btn")),
onClick: close
}, {
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(Close))]),
_: 1
}, 8, ["class"]))], 64)) : (0, vue.createCommentVNode)("v-if", true)
], 2)], 2), [[vue.vShow, visible.value]])]),
_: 3
}, 8, ["name"]);
};
}
});
//#endregion
exports.default = alert_vue_vue_type_script_setup_true_lang_default;
//# sourceMappingURL=alert.vue_vue_type_script_setup_true_lang.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
Object.defineProperties(exports, {
__esModule: { value: true },
[Symbol.toStringTag]: { value: "Module" }
});
//#region ../../packages/components/alert/src/alert.vue
var alert_default = require("./alert.vue_vue_type_script_setup_true_lang.js").default;
//#endregion
exports.default = alert_default;
//# sourceMappingURL=alert2.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"alert2.js","names":[],"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=\"close\">\n <Close />\n </el-icon>\n </template>\n </div>\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref, useSlots } from 'vue'\nimport { ElIcon } from '@element-plus/components/icon'\nimport {\n TypeComponents,\n TypeComponentsMap,\n flattedChildren,\n isComment,\n} from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { alertEmits } from './alert'\n\nimport type { AlertProps } from './alert'\n\nconst { Close } = TypeComponents\n\ndefineOptions({\n name: 'ElAlert',\n})\n\nconst props = withDefaults(defineProps<AlertProps>(), {\n title: '',\n description: '',\n type: 'info',\n closable: true,\n closeText: '',\n effect: 'light',\n})\nconst emit = defineEmits(alertEmits)\nconst slots = useSlots()\n\nconst ns = useNamespace('alert')\n\nconst visible = ref(true)\n\nconst iconComponent = computed(() => TypeComponentsMap[props.type])\n\nconst hasDesc = computed(() => {\n if (props.description) return true\n const slotContent = slots.default?.()\n if (!slotContent) return false\n\n const children = flattedChildren(slotContent)\n return children.some((child) => !isComment(child))\n})\n\nconst close = (evt: MouseEvent) => {\n visible.value = false\n emit('close', evt)\n}\n</script>\n"],"mappings":""}

View File

@@ -0,0 +1,6 @@
import _default from "./alert.vue.js";
//#region ../../packages/components/alert/src/instance.d.ts
type AlertInstance = InstanceType<typeof _default> & unknown;
//#endregion
export { AlertInstance };

View File

@@ -0,0 +1 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });

View File

@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../base/style/css.js");
require("element-plus/theme-chalk/el-alert.css");

View File

@@ -0,0 +1,3 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("../../base/style/index.js");
require("element-plus/theme-chalk/src/alert.scss");