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,5 @@
import Popconfirm from './src/popconfirm.vue';
import type { SFCWithInstall } from 'element-plus/es/utils';
export declare const ElPopconfirm: SFCWithInstall<typeof Popconfirm>;
export default ElPopconfirm;
export * from './src/popconfirm';

View File

@@ -0,0 +1,8 @@
import Popconfirm from './src/popconfirm2.mjs';
export { popconfirmEmits, popconfirmProps } from './src/popconfirm.mjs';
import { withInstall } from '../../utils/vue/install.mjs';
const ElPopconfirm = withInstall(Popconfirm);
export { ElPopconfirm, ElPopconfirm as default };
//# sourceMappingURL=index.mjs.map

View File

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

View File

@@ -0,0 +1,38 @@
import type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue';
import type Popconfirm from './popconfirm.vue';
export declare const popconfirmProps: {
readonly title: StringConstructor;
readonly confirmButtonText: StringConstructor;
readonly cancelButtonText: StringConstructor;
readonly confirmButtonType: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "text" | "default" | "primary" | "success" | "warning" | "info" | "danger", unknown, "primary", boolean>;
readonly cancelButtonType: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "text" | "default" | "primary" | "success" | "warning" | "info" | "danger", unknown, "text", boolean>;
readonly icon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly iconColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "#f90", boolean>;
readonly hideIcon: BooleanConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly effect: {
readonly default: "light";
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly teleported: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly persistent: BooleanConstructor;
readonly width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 150, boolean>;
readonly closeOnPressEscape: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
};
export declare const popconfirmEmits: {
/**
* @description triggers when click confirm button
*/
confirm: (e: MouseEvent) => boolean;
/**
* @description triggers when click cancel button
*/
cancel: (e: MouseEvent | KeyboardEvent) => boolean;
};
export type PopconfirmEmits = typeof popconfirmEmits;
export type PopconfirmProps = ExtractPropTypes<typeof popconfirmProps>;
export type PopconfirmPropsPublic = __ExtractPublicPropTypes<typeof popconfirmProps>;
export type PopconfirmInstance = InstanceType<typeof Popconfirm> & unknown;

View File

@@ -0,0 +1,55 @@
import { QuestionFilled } from '@element-plus/icons-vue';
import { buttonTypes } from '../../button/src/button2.mjs';
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
import { iconPropType } from '../../../utils/vue/icon.mjs';
import { useTooltipContentProps } from '../../tooltip/src/content.mjs';
const popconfirmProps = buildProps({
title: String,
confirmButtonText: String,
cancelButtonText: String,
confirmButtonType: {
type: String,
values: buttonTypes,
default: "primary"
},
cancelButtonType: {
type: String,
values: buttonTypes,
default: "text"
},
icon: {
type: iconPropType,
default: () => QuestionFilled
},
iconColor: {
type: String,
default: "#f90"
},
hideIcon: Boolean,
hideAfter: {
type: Number,
default: 200
},
effect: {
...useTooltipContentProps.effect,
default: "light"
},
teleported: useTooltipContentProps.teleported,
persistent: useTooltipContentProps.persistent,
width: {
type: [String, Number],
default: 150
},
closeOnPressEscape: {
type: Boolean,
default: true
}
});
const popconfirmEmits = {
confirm: (e) => e instanceof MouseEvent,
cancel: (e) => e instanceof MouseEvent || e instanceof KeyboardEvent
};
export { popconfirmEmits, popconfirmProps };
//# sourceMappingURL=popconfirm.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"popconfirm.mjs","sources":["../../../../../../packages/components/popconfirm/src/popconfirm.ts"],"sourcesContent":["import { buttonTypes } from '@element-plus/components/button'\nimport { QuestionFilled } from '@element-plus/icons-vue'\nimport { buildProps, iconPropType } from '@element-plus/utils'\nimport { useTooltipContentProps } from '@element-plus/components/tooltip'\n\nimport type { ExtractPropTypes, __ExtractPublicPropTypes } from 'vue'\nimport type Popconfirm from './popconfirm.vue'\n\nexport const popconfirmProps = buildProps({\n /**\n * @description Title\n */\n title: String,\n /**\n * @description Confirm button text\n */\n confirmButtonText: String,\n /**\n * @description Cancel button text\n */\n cancelButtonText: String,\n /**\n * @description Confirm button type\n */\n confirmButtonType: {\n type: String,\n values: buttonTypes,\n default: 'primary',\n },\n /**\n * @description Cancel button type\n */\n cancelButtonType: {\n type: String,\n values: buttonTypes,\n default: 'text',\n },\n /**\n * @description Icon Component\n */\n icon: {\n type: iconPropType,\n default: () => QuestionFilled,\n },\n /**\n * @description Icon color\n */\n iconColor: {\n type: String,\n default: '#f90',\n },\n /**\n * @description is hide Icon\n */\n hideIcon: Boolean,\n /**\n * @description delay of disappear, in millisecond\n */\n hideAfter: {\n type: Number,\n default: 200,\n },\n /**\n * @description Tooltip theme, built-in theme: `dark` / `light`\n */\n effect: {\n ...useTooltipContentProps.effect,\n default: 'light',\n },\n /**\n * @description whether popconfirm is teleported to the body\n */\n teleported: useTooltipContentProps.teleported,\n /**\n * @description when popconfirm inactive and `persistent` is `false` , popconfirm will be destroyed\n */\n persistent: useTooltipContentProps.persistent,\n /**\n * @description popconfirm width, min width 150px\n */\n width: {\n type: [String, Number],\n default: 150,\n },\n /**\n * @description whether the popConfirm can be closed by pressing ESC\n */\n closeOnPressEscape: {\n type: Boolean,\n default: true,\n },\n} as const)\n\nexport const popconfirmEmits = {\n /**\n * @description triggers when click confirm button\n */\n confirm: (e: MouseEvent) => e instanceof MouseEvent,\n /**\n * @description triggers when click cancel button\n */\n cancel: (e: MouseEvent | KeyboardEvent) =>\n e instanceof MouseEvent || e instanceof KeyboardEvent,\n}\n\nexport type PopconfirmEmits = typeof popconfirmEmits\n\nexport type PopconfirmProps = ExtractPropTypes<typeof popconfirmProps>\nexport type PopconfirmPropsPublic = __ExtractPublicPropTypes<\n typeof popconfirmProps\n>\n\nexport type PopconfirmInstance = InstanceType<typeof Popconfirm> & unknown\n"],"names":[],"mappings":";;;;;;AAIY,MAAC,eAAe,GAAG,UAAU,CAAC;AAC1C,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,iBAAiB,EAAE,MAAM;AAC3B,EAAE,gBAAgB,EAAE,MAAM;AAC1B,EAAE,iBAAiB,EAAE;AACrB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,WAAW;AACvB,IAAI,OAAO,EAAE,SAAS;AACtB,GAAG;AACH,EAAE,gBAAgB,EAAE;AACpB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,WAAW;AACvB,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,IAAI,OAAO,EAAE,MAAM,cAAc;AACjC,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,MAAM;AACnB,GAAG;AACH,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,GAAG,sBAAsB,CAAC,MAAM;AACpC,IAAI,OAAO,EAAE,OAAO;AACpB,GAAG;AACH,EAAE,UAAU,EAAE,sBAAsB,CAAC,UAAU;AAC/C,EAAE,UAAU,EAAE,sBAAsB,CAAC,UAAU;AAC/C,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,EAAE,kBAAkB,EAAE;AACtB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,eAAe,GAAG;AAC/B,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,UAAU;AACzC,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,UAAU,IAAI,CAAC,YAAY,aAAa;AACtE;;;;"}

View File

@@ -0,0 +1,78 @@
declare function __VLS_template(): {
actions?(_: {
confirm: (e: MouseEvent) => void;
cancel: (e: MouseEvent | KeyboardEvent) => void;
}): any;
reference?(_: {}): any;
};
declare const __VLS_component: import("vue").DefineComponent<{
readonly title: StringConstructor;
readonly confirmButtonText: StringConstructor;
readonly cancelButtonText: StringConstructor;
readonly confirmButtonType: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "text" | "default" | "primary" | "success" | "warning" | "info" | "danger", unknown, "primary", boolean>;
readonly cancelButtonType: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "text" | "default" | "primary" | "success" | "warning" | "info" | "danger", unknown, "text", boolean>;
readonly icon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly iconColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "#f90", boolean>;
readonly hideIcon: BooleanConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly effect: {
readonly default: "light";
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly teleported: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly persistent: BooleanConstructor;
readonly width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 150, boolean>;
readonly closeOnPressEscape: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
}, {
popperRef: import("vue").ComputedRef<import("element-plus").PopperInstance | undefined>;
hide: () => void;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
cancel: (e: MouseEvent | KeyboardEvent) => void;
confirm: (e: MouseEvent) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
readonly title: StringConstructor;
readonly confirmButtonText: StringConstructor;
readonly cancelButtonText: StringConstructor;
readonly confirmButtonType: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "text" | "default" | "primary" | "success" | "warning" | "info" | "danger", unknown, "primary", boolean>;
readonly cancelButtonType: import("element-plus/es/utils").EpPropFinalized<StringConstructor, "" | "text" | "default" | "primary" | "success" | "warning" | "info" | "danger", unknown, "text", boolean>;
readonly icon: import("element-plus/es/utils").EpPropFinalized<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown, () => any, boolean>;
readonly iconColor: import("element-plus/es/utils").EpPropFinalized<StringConstructor, unknown, unknown, "#f90", boolean>;
readonly hideIcon: BooleanConstructor;
readonly hideAfter: import("element-plus/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
readonly effect: {
readonly default: "light";
readonly type: import("vue").PropType<import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown>>;
readonly required: false;
readonly validator: ((val: unknown) => boolean) | undefined;
readonly __epPropKey: true;
};
readonly teleported: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
readonly persistent: BooleanConstructor;
readonly width: import("element-plus/es/utils").EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, 150, boolean>;
readonly closeOnPressEscape: import("element-plus/es/utils").EpPropFinalized<BooleanConstructor, unknown, unknown, true, boolean>;
}>> & {
onConfirm?: ((e: MouseEvent) => any) | undefined;
onCancel?: ((e: MouseEvent | KeyboardEvent) => any) | undefined;
}, {
readonly width: import("element-plus/es/utils").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
readonly icon: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component) | ((new (...args: any[]) => (string | import("vue").Component) & {}) | (() => string | import("vue").Component))[], unknown, unknown>;
readonly effect: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown>;
readonly hideAfter: number;
readonly teleported: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly persistent: boolean;
readonly closeOnPressEscape: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
readonly confirmButtonType: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "text" | "default" | "primary" | "success" | "warning" | "info" | "danger", unknown>;
readonly cancelButtonType: import("element-plus/es/utils").EpPropMergeType<StringConstructor, "" | "text" | "default" | "primary" | "success" | "warning" | "info" | "danger", unknown>;
readonly iconColor: string;
readonly hideIcon: 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,142 @@
import { defineComponent, ref, computed, unref, openBlock, createBlock, mergeProps, withCtx, createVNode, createElementVNode, normalizeClass, normalizeStyle, resolveDynamicComponent, createCommentVNode, createTextVNode, toDisplayString, renderSlot } from 'vue';
import { ElButton } from '../../button/index.mjs';
import { ElIcon } from '../../icon/index.mjs';
import { ElTooltip } from '../../tooltip/index.mjs';
import { popconfirmProps, popconfirmEmits } from './popconfirm.mjs';
import ElFocusTrap from '../../focus-trap/src/focus-trap.mjs';
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
import { useLocale } from '../../../hooks/use-locale/index.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
import { addUnit } from '../../../utils/dom/style.mjs';
const __default__ = defineComponent({
name: "ElPopconfirm"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: popconfirmProps,
emits: popconfirmEmits,
setup(__props, { expose, emit }) {
const props = __props;
const { t } = useLocale();
const ns = useNamespace("popconfirm");
const tooltipRef = ref();
const popperRef = computed(() => {
var _a;
return (_a = unref(tooltipRef)) == null ? void 0 : _a.popperRef;
});
const hidePopper = () => {
var _a, _b;
(_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
};
const style = computed(() => {
return {
width: addUnit(props.width)
};
});
const confirm = (e) => {
emit("confirm", e);
hidePopper();
};
const cancel = (e) => {
emit("cancel", e);
hidePopper();
};
const onCloseRequested = (event) => {
if (props.closeOnPressEscape) {
cancel(event);
}
};
const finalConfirmButtonText = computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
const finalCancelButtonText = computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
expose({
popperRef,
hide: hidePopper
});
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ElTooltip), mergeProps({
ref_key: "tooltipRef",
ref: tooltipRef,
trigger: "click",
effect: _ctx.effect
}, _ctx.$attrs, {
"popper-class": `${unref(ns).namespace.value}-popover`,
"popper-style": unref(style),
teleported: _ctx.teleported,
"fallback-placements": ["bottom", "top", "right", "left"],
"hide-after": _ctx.hideAfter,
persistent: _ctx.persistent
}), {
content: withCtx(() => [
createVNode(unref(ElFocusTrap), {
loop: "",
trapped: "",
onReleaseRequested: onCloseRequested
}, {
default: withCtx(() => [
createElementVNode("div", {
class: normalizeClass(unref(ns).b())
}, [
createElementVNode("div", {
class: normalizeClass(unref(ns).e("main"))
}, [
!_ctx.hideIcon && _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
key: 0,
class: normalizeClass(unref(ns).e("icon")),
style: normalizeStyle({ color: _ctx.iconColor })
}, {
default: withCtx(() => [
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
]),
_: 1
}, 8, ["class", "style"])) : createCommentVNode("v-if", true),
createTextVNode(" " + toDisplayString(_ctx.title), 1)
], 2),
createElementVNode("div", {
class: normalizeClass(unref(ns).e("action"))
}, [
renderSlot(_ctx.$slots, "actions", {
confirm,
cancel
}, () => [
createVNode(unref(ElButton), {
size: "small",
type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
text: _ctx.cancelButtonType === "text",
onClick: cancel
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(finalCancelButtonText)), 1)
]),
_: 1
}, 8, ["type", "text"]),
createVNode(unref(ElButton), {
size: "small",
type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
text: _ctx.confirmButtonType === "text",
onClick: confirm
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(finalConfirmButtonText)), 1)
]),
_: 1
}, 8, ["type", "text"])
])
], 2)
], 2)
]),
_: 3
})
]),
default: withCtx(() => [
_ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
]),
_: 3
}, 16, ["effect", "popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
};
}
});
var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "popconfirm.vue"]]);
export { Popconfirm as default };
//# sourceMappingURL=popconfirm2.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
import 'element-plus/es/components/base/style/css';
import 'element-plus/theme-chalk/el-popconfirm.css';
import 'element-plus/es/components/popover/style/css';
import 'element-plus/es/components/button/style/css';

View File

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

View File

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

View File

@@ -0,0 +1,4 @@
import 'element-plus/es/components/base/style';
import 'element-plus/theme-chalk/src/popconfirm.scss';
import 'element-plus/es/components/popover/style';
import 'element-plus/es/components/button/style';

View File

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

View File

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