You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
8.7 KiB

{"ast":null,"code":"import { defineComponent, ref, computed, openBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, normalizeClass, normalizeStyle, resolveDynamicComponent, createCommentVNode, createTextVNode, toDisplayString, renderSlot, createVNode } from 'vue';\nimport { ElButton } from '../../button/index.mjs';\nimport { ElIcon } from '../../icon/index.mjs';\nimport { ElTooltip } from '../../tooltip/index.mjs';\nimport '../../../hooks/index.mjs';\nimport '../../../utils/index.mjs';\nimport { popconfirmProps, popconfirmEmits } from './popconfirm.mjs';\nimport _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';\nimport { useLocale } from '../../../hooks/use-locale/index.mjs';\nimport { useNamespace } from '../../../hooks/use-namespace/index.mjs';\nimport { addUnit } from '../../../utils/dom/style.mjs';\nconst __default__ = defineComponent({\n name: \"ElPopconfirm\"\n});\nconst _sfc_main = /* @__PURE__ */defineComponent({\n ...__default__,\n props: popconfirmProps,\n emits: popconfirmEmits,\n setup(__props, {\n emit\n }) {\n const props = __props;\n const {\n t\n } = useLocale();\n const ns = useNamespace(\"popconfirm\");\n const tooltipRef = ref();\n const hidePopper = () => {\n var _a, _b;\n (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);\n };\n const style = computed(() => {\n return {\n width: addUnit(props.width)\n };\n });\n const confirm = e => {\n emit(\"confirm\", e);\n hidePopper();\n };\n const cancel = e => {\n emit(\"cancel\", e);\n hidePopper();\n };\n const finalConfirmButtonText = computed(() => props.confirmButtonText || t(\"el.popconfirm.confirmButtonText\"));\n const finalCancelButtonText = computed(() => props.cancelButtonText || t(\"el.popconfirm.cancelButtonText\"));\n return (_ctx, _cache) => {\n return openBlock(), createBlock(unref(ElTooltip), mergeProps({\n ref_key: \"tooltipRef\",\n ref: tooltipRef,\n trigger: \"click\",\n effect: \"light\"\n }, _ctx.$attrs, {\n \"popper-class\": `${unref(ns).namespace.value}-popover`,\n \"popper-style\": unref(style),\n teleported: _ctx.teleported,\n \"fallback-placements\": [\"bottom\", \"top\", \"right\", \"left\"],\n \"hide-after\": _ctx.hideAfter,\n persistent: _ctx.persistent\n }), {\n content: withCtx(() => [createElementVNode(\"div\", {\n class: normalizeClass(unref(ns).b())\n }, [createElementVNode(\"div\", {\n class: normalizeClass(unref(ns).e(\"main\"))\n }, [!_ctx.hideIcon && _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {\n key: 0,\n class: normalizeClass(unref(ns).e(\"icon\")),\n style: normalizeStyle({\n color: _ctx.iconColor\n })\n }, {\n default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))]),\n _: 1\n }, 8, [\"class\", \"style\"])) : createCommentVNode(\"v-if\", true), createTextVNode(\" \" + toDisplayString(_ctx.title), 1)], 2), createElementVNode(\"div\", {\n class: normalizeClass(unref(ns).e(\"action\"))\n }, [renderSlot(_ctx.$slots, \"actions\", {\n confirm,\n cancel\n }, () => [createVNode(unref(ElButton), {\n size: \"small\",\n type: _ctx.cancelButtonType === \"text\" ? \"\" : _ctx.cancelButtonType,\n text: _ctx.cancelButtonType === \"text\",\n onClick: cancel\n }, {\n default: withCtx(() => [createTextVNode(toDisplayString(unref(finalCancelButtonText)), 1)]),\n _: 1\n }, 8, [\"type\", \"text\"]), createVNode(unref(ElButton), {\n size: \"small\",\n type: _ctx.confirmButtonType === \"text\" ? \"\" : _ctx.confirmButtonType,\n text: _ctx.confirmButtonType === \"text\",\n onClick: confirm\n }, {\n default: withCtx(() => [createTextVNode(toDisplayString(unref(finalConfirmButtonText)), 1)]),\n _: 1\n }, 8, [\"type\", \"text\"])])], 2)], 2)]),\n default: withCtx(() => [_ctx.$slots.reference ? renderSlot(_ctx.$slots, \"reference\", {\n key: 0\n }) : createCommentVNode(\"v-if\", true)]),\n _: 3\n }, 16, [\"popper-class\", \"popper-style\", \"teleported\", \"hide-after\", \"persistent\"]);\n };\n }\n});\nvar Popconfirm = /* @__PURE__ */_export_sfc(_sfc_main, [[\"__file\", \"popconfirm.vue\"]]);\nexport { Popconfirm as default };","map":{"version":3,"names":["name","t","useLocale","ns","useNamespace","tooltipRef","ref","hidePopper","_a","_b","value","onClose","call","style","computed","width","addUnit","props","confirm","e","emit","cancel","finalConfirmButtonText","confirmButtonText","finalCancelButtonText","cancelButtonText","_ctx","_cache","openBlock","createBlock","unref","ElTooltip","mergeProps","ref_key"],"sources":["../../../../../../packages/components/popconfirm/src/popconfirm.vue"],"sourcesContent":["<template>\n <el-tooltip\n ref=\"tooltipRef\"\n trigger=\"click\"\n effect=\"light\"\n v-bind=\"$attrs\"\n :popper-class=\"`${ns.namespace.value}-popover`\"\n :popper-style=\"style\"\n :teleported=\"teleported\"\n :fallback-placements=\"['bottom', 'top', 'right', 'left']\"\n :hide-after=\"hideAfter\"\n :persistent=\"persistent\"\n >\n <template #content>\n <div :class=\"ns.b()\">\n <div :class=\"ns.e('main')\">\n <el-icon\n v-if=\"!hideIcon && icon\"\n :class=\"ns.e('icon')\"\n :style=\"{ color: iconColor }\"\n >\n <component :is=\"icon\" />\n </el-icon>\n {{ title }}\n </div>\n <div :class=\"ns.e('action')\">\n <slot name=\"actions\" :confirm=\"confirm\" :cancel=\"cancel\">\n <el-button\n size=\"small\"\n :type=\"cancelButtonType === 'text' ? '' : cancelButtonType\"\n :text=\"cancelButtonType === 'text'\"\n @click=\"cancel\"\n >\n {{ finalCancelButtonText }}\n </el-button>\n <el-button\n size=\"small\"\n :type=\"confirmButtonType === 'text' ? '' : confirmButtonType\"\n :text=\"confirmButtonType === 'text'\"\n @click=\"confirm\"\n >\n {{ finalConfirmButtonText }}\n </el-button>\n </slot>\n </div>\n </div>\n </template>\n <template v-if=\"$slots.reference\">\n <slot name=\"reference\" />\n </template>\n </el-tooltip>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, ref } from 'vue'\nimport ElButton from '@element-plus/components/button'\nimport ElIcon from '@element-plus/components/icon'\nimport ElTooltip from '@element-plus/components/tooltip'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { addUnit } from '@element-plus/utils'\nimport { popconfirmEmits, popconfirmProps } from './popconfirm'\n\nimport type { TooltipInstance } from '@element-plus/components/tooltip'\n\ndefineOptions({\n name: 'ElPopconfirm',\n})\n\nconst props = defineProps(popconfirmProps)\nconst emit = defineEmits(popconfirmEmits)\n\nconst { t } = useLocale()\nconst ns = useNamespace('popconfirm')\nconst tooltipRef = ref<TooltipInstance>()\n\nconst hidePopper = () => {\n tooltipRef.value?.onClose?.()\n}\n\nconst style = computed(() => {\n return {\n width: addUnit(props.width),\n }\n})\n\nconst confirm = (e: MouseEvent) => {\n emit('confirm', e)\n hidePopper()\n}\nconst cancel = (e: MouseEvent) => {\n emit('cancel', e)\n hidePopper()\n}\n\nconst finalConfirmButtonText = computed(\n () => props.confirmButtonText || t('el.popconfirm.confirmButtonText')\n)\nconst finalCancelButtonText = computed(\n () => props.cancelButtonText || t('el.popconfirm.cancelButtonText')\n)\n</script>\n"],"mappings":";;;;;;;;;;;mCAgEc;EACZA,IAAM;AACR;;;;;;;;;IAKM;MAAEC;IAAE,IAAIC,SAAU;IAClB,MAAAC,EAAA,GAAKC,YAAA,CAAa,YAAY;IACpC,MAAMC,UAAA,GAAaC,GAAqB;IAExC,MAAMC,UAAA,GAAaA,CAAA,KAAM;MACvB,IAAAC,EAAA,EAAAC,EAAA;MACF,CAAAA,EAAA,IAAAD,EAAA,GAAAH,UAAA,CAAAK,KAAA,qBAAAF,EAAA,CAAAG,OAAA,qBAAAF,EAAA,CAAAG,IAAA,CAAAJ,EAAA;IAEA,CAAM;IACG,MAAAK,KAAA,GAAAC,QAAA;MACL;QACFC,KAAA,EAAAC,OAAA,CAAAC,KAAA,CAAAF,KAAA;MAAA,CACD;IAED,CAAM;IACJ,MAAAG,OAAA,GAAAC,CAAgB,IAAC;MACNC,IAAA,YAAAD,CAAA;MACbZ,UAAA;IACA,CAAM;IACJ,MAAAc,MAAA,GAAAF,CAAe,IAAC;MACLC,IAAA,WAAAD,CAAA;MACbZ,UAAA;IAEA;IAA+B,MACvBe,sBAA2B,GAAAR,QAAmC,OAAAG,KAAA,CAAAM,iBAAA,IAAAtB,CAAA;IACtE,MAAAuB,qBAAA,GAAAV,QAAA,OAAAG,KAAA,CAAAQ,gBAAA,IAAAxB,CAAA;IACA,OAA8B,CAAAyB,IAAA,EAAAC,MAAA;MAC5B,OAAMC,SAA0B,IAAAC,WAAA,CAAEC,KAAgC,CAAAC,SAAA,GAAAC,UAAA;QACpEC,OAAA","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}