UNPKG

@vuesax-alpha/nightly

Version:
142 lines (137 loc) 5.04 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var index$4 = require('../../button/index.js'); var index$3 = require('../../icon/index.js'); var index$2 = require('../../popper/index.js'); require('../../../hooks/index.js'); require('../../../utils/index.js'); var popconfirm = require('./popconfirm2.js'); var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js'); var index = require('../../../hooks/use-locale/index.js'); var index$1 = require('../../../hooks/use-namespace/index.js'); var style = require('../../../utils/dom/style.js'); const __default__ = vue.defineComponent({ name: "VsPopconfirm" }); const _sfc_main = vue.defineComponent({ ...__default__, props: popconfirm.popconfirmProps, emits: popconfirm.popconfirmEmits, setup(__props, { emit }) { const props = __props; const { t } = index.useLocale(); const ns = index$1.useNamespace("popconfirm"); const tooltipRef = vue.ref(); const hidePopper = () => { var _a; (_a = tooltipRef.value) == null ? void 0 : _a.hide(); }; const style$1 = vue.computed(() => { return { width: style.addUnit(props.width) }; }); const confirm = (e) => { emit("confirm", e); hidePopper(); }; const cancel = (e) => { emit("cancel", e); hidePopper(); }; const finalConfirmButtonText = vue.computed( () => props.confirmButtonText || t("vs.popconfirm.confirmButtonText") ); const finalCancelButtonText = vue.computed( () => props.cancelButtonText || t("vs.popconfirm.cancelButtonText") ); return (_ctx, _cache) => { return vue.openBlock(), vue.createBlock(vue.unref(index$2.VsPopper), vue.mergeProps({ ref_key: "tooltipRef", ref: tooltipRef, trigger: "click", color: "light" }, _ctx.$attrs, { animation: _ctx.animation, "popper-class": `${vue.unref(ns).namespace.value}-popconfirm`, "popper-style": style$1.value, teleported: _ctx.teleported, "fallback-placements": ["bottom", "top", "right", "left"], "hide-after": _ctx.hideAfter, persistent: _ctx.persistent }), { content: vue.withCtx(() => [ vue.createElementVNode( "div", { class: vue.normalizeClass(vue.unref(ns).e("main")) }, [ !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.VsIcon), { key: 0, class: vue.normalizeClass(vue.unref(ns).e("icon")), style: vue.normalizeStyle({ color: _ctx.iconColor }), size: "26" }, { default: vue.withCtx(() => [ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon))) ]), _: 1 }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true), vue.createTextVNode( " " + vue.toDisplayString(_ctx.title), 1 ) ], 2 ), vue.createElementVNode( "div", { class: vue.normalizeClass(vue.unref(ns).e("action")) }, [ vue.createVNode(vue.unref(index$4.VsButton), { size: _ctx.cancelButtonSize, color: _ctx.cancelButtonColor, type: _ctx.cancelButtonType, onClick: cancel }, { default: vue.withCtx(() => [ vue.createTextVNode( vue.toDisplayString(finalCancelButtonText.value), 1 ) ]), _: 1 }, 8, ["size", "color", "type"]), vue.createVNode(vue.unref(index$4.VsButton), { size: _ctx.confirmButtonSize, color: _ctx.confirmButtonColor, type: _ctx.confirmButtonType, onClick: confirm }, { default: vue.withCtx(() => [ vue.createTextVNode( vue.toDisplayString(finalConfirmButtonText.value), 1 ) ]), _: 1 }, 8, ["size", "color", "type"]) ], 2 ) ]), default: vue.withCtx(() => [ _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true) ]), _: 3 }, 16, ["animation", "popper-class", "popper-style", "teleported", "hide-after", "persistent"]); }; } }); var Popconfirm = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/home/runner/work/vuesax-alpha/vuesax-alpha/packages/components/popconfirm/src/popconfirm.vue"]]); exports["default"] = Popconfirm; //# sourceMappingURL=popconfirm.js.map