UNPKG

tdesign-vue

Version:
179 lines (175 loc) 6.63 kB
/** * tdesign v1.14.1 * (c) 2025 tdesign * @license MIT */ import { h as helper } from '../_chunks/dep-6a4dc7bb.js'; import _defineProperty from '@babel/runtime/helpers/defineProperty'; import { InfoCircleFilledIcon, ErrorCircleFilledIcon } from 'tdesign-icons-vue'; import mixins from '../utils/mixins.js'; import getConfigReceiverMixins, { getGlobalIconMixins } from '../config-provider/config-receiver.js'; import { Popup } from '../popup/index.js'; import props from './props.js'; import { renderTNodeJSXDefault, renderContent, renderTNodeJSX } from '../utils/render-tnode.js'; import { emitEvent } from '../utils/event.js'; import ActionMixin from '../dialog/actions.js'; import 'vue'; import 'lodash-es'; import '../config-provider/context.js'; import '../_common/js/global-config/default-config.js'; import '../_common/js/global-config/locale/zh_CN.js'; import '../_chunks/dep-ba613a02.js'; import '@babel/runtime/helpers/typeof'; import '../_chunks/dep-fdb1b253.js'; import 'dayjs'; import '../_common/js/global-config/t.js'; import '@babel/runtime/helpers/slicedToArray'; import '../popup/popup.js'; import '@popperjs/core'; import '../utils/dom.js'; import 'raf'; import '../utils/easing.js'; import '../utils/helper.js'; import '@babel/runtime/helpers/objectWithoutProperties'; import '../_common/js/utils/setStyle.js'; import '../popup/props.js'; import '../popup/container.js'; import '../popup/utils.js'; import '../utils/map-props.js'; import '../utils/withInstall.js'; import '../popup/plugin.js'; import '../_common/js/log/log.js'; import '@babel/runtime/helpers/readOnlyError'; import '@vue/composition-api'; import '../button/index.js'; import '../button/button.js'; import '../loading/index.js'; import '../loading/directive.js'; import '../loading/plugin.js'; import '../loading/loading.js'; import '../loading/icon/gradient.js'; import '../_common/js/loading/circle-adapter.js'; import '../_common/js/utils/helper.js'; import '@babel/runtime/helpers/toConsumableArray'; import '../utils/transfer-dom.js'; import '../loading/props.js'; import '../config.js'; import '../button/props.js'; import '../utils/ripple.js'; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } var _Popconfirm = mixins(ActionMixin, getConfigReceiverMixins("popconfirm"), getGlobalIconMixins()).extend({ name: "TPopconfirm", props: _objectSpread({}, props), model: { prop: "visible", event: "visible-change" }, computed: { themeIcon: function themeIcon() { var _this$useGlobalIcon = this.useGlobalIcon({ InfoCircleFilledIcon: InfoCircleFilledIcon, ErrorCircleFilledIcon: ErrorCircleFilledIcon }), InfoCircleFilledIcon$1 = _this$useGlobalIcon.InfoCircleFilledIcon, ErrorCircleFilledIcon$1 = _this$useGlobalIcon.ErrorCircleFilledIcon; var iconMap = { "default": InfoCircleFilledIcon$1, warning: ErrorCircleFilledIcon$1, danger: ErrorCircleFilledIcon$1 }; return iconMap[this.theme]; }, iconCls: function iconCls() { var theme = this.theme || "default"; return "".concat(this.componentName, "__icon--").concat(theme); }, innerPopupProps: function innerPopupProps() { return _objectSpread({ showArrow: this.showArrow, overlayClassName: [this.componentName, "".concat(this.componentName, "__popup--").concat(this.theme || "default")], trigger: "click", destroyOnClose: this.destroyOnClose, placement: this.placement }, this.popupProps); } }, methods: { cancelBtnAction: function cancelBtnAction(e) { emitEvent(this, "cancel", { e: e }); var cancelContext = { e: e, trigger: "cancel" }; emitEvent(this, "visible-change", false, cancelContext); }, confirmBtnAction: function confirmBtnAction(e) { emitEvent(this, "confirm", { e: e }); var confirmContext = { e: e, trigger: "confirm" }; emitEvent(this, "visible-change", false, confirmContext); }, renderIcon: function renderIcon() { var h = this.$createElement; var Icon = this.themeIcon; return renderTNodeJSXDefault(this, "icon", h(Icon, { "class": this.iconCls })); }, onPopupVisibleChange: function onPopupVisibleChange(val, context) { this.$emit("visible-change", val, context); this.onVisibleChange && this.onVisibleChange(val, context); } }, render: function render() { var h = arguments[0]; var triggerElement = renderContent(this, "default", "triggerElement"); var cancelBtn = this.getCancelBtn({ cancelBtn: this.cancelBtn, globalCancel: this.global.cancel, size: "small", className: "".concat(this.componentName, "__cancel") }); var confirmBtn = this.getConfirmBtn({ theme: this.theme, confirmBtn: this.confirmBtn, globalConfirm: this.global.confirm, size: "small", globalConfirmBtnTheme: this.global.confirmBtnTheme, className: "".concat(this.componentName, "__confirm") }); return h(Popup, helper([{ "ref": "popup", "attrs": { "visible": this.visible } }, { "props": this.innerPopupProps }, {}, { "on": { "visible-change": this.onPopupVisibleChange } }]), [h("template", { "slot": "content", "attrs": { "role": "popconfirm" } }, [h("div", { "class": "".concat(this.componentName, "__content") }, [h("div", { "class": "".concat(this.componentName, "__body") }, [this.renderIcon(), h("div", { "class": "".concat(this.componentName, "__inner") }, [renderTNodeJSX(this, "content")])]), Boolean(cancelBtn || confirmBtn) && h("div", { "class": "".concat(this.componentName, "__buttons") }, [cancelBtn, confirmBtn])])]), triggerElement]); } }); export { _Popconfirm as default }; //# sourceMappingURL=popconfirm.js.map