tav-ui
Version:
111 lines (106 loc) • 5.98 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var antDesignVue = require('ant-design-vue');
var index = require('../../button-modal/index2.js');
var index$1 = require('../../icon/index2.js');
require('../../../utils/index2.js');
var types = require('./types2.js');
var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
var is = require('../../../utils/is2.js');
const _hoisted_1 = { style: { "position": "relative" } };
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
props: types.dropdownProps,
emits: ["menuEvent", "menuItemPopConfirmVisible"],
setup(__props, { emit }) {
const props = __props;
const ADropdown = antDesignVue.Dropdown;
const AMenu = antDesignVue.Menu;
const AMenuItem = antDesignVue.Menu.Item;
const AMenuDivider = antDesignVue.Menu.Divider;
function handleClickMenu(item) {
const { event } = item;
if (is.isDef(event)) {
const menu = props.dropMenuList.find((item2) => `${item2.event}` === `${event}`);
menu && emit("menuEvent", menu);
}
item.onClick?.();
}
const getAttr = (key) => ({ key });
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(vue.unref(ADropdown), vue.mergeProps({ trigger: _ctx.trigger }, _ctx.$attrs, {
"overlay-class-name": props.overlayClassName
}), {
overlay: vue.withCtx(() => [
vue.createVNode(vue.unref(AMenu), { "selected-keys": _ctx.selectedKeys }, {
default: vue.withCtx(() => [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.dropMenuList, (item) => {
return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
key: `${item.event}`
}, [
vue.createVNode(vue.unref(AMenuItem), vue.mergeProps(getAttr(item.event), {
disabled: item.disabled,
size: "small",
onClick: vue.withModifiers(($event) => handleClickMenu(item), ["stop", "prevent"])
}), {
default: vue.withCtx(() => [
vue.createCommentVNode(' <a-popconfirm\n v-if="popconfirm && item.popConfirm"\n v-bind="getPopConfirmAttrs(item.popConfirm)"\n :getPopupContainer="item.getPopupContainer"\n @visibleChange="handlePopConfirmVisible"\n >\n <template #icon v-if="item.popConfirm.icon">\n <Icon :icon="item.popConfirm.icon" />\n </template>\n <div>\n <Icon :icon="item.icon" v-if="item.icon" />\n <span class="ml-1">{{ item.text }}</span>\n </div>\n </a-popconfirm> '),
_ctx.popconfirm && item.popConfirm ? (vue.openBlock(), vue.createBlock(vue.unref(index.TaButtonModal), vue.mergeProps({ key: 0 }, item, { "is-in-drop-down": true }), vue.createSlots({
default: vue.withCtx(() => [
vue.createElementVNode("div", null, [
item.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.TaIcon), {
key: 0,
icon: item.icon
}, null, 8, ["icon"])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("span", {
class: vue.normalizeClass(`ml-1 ant-btn ant-btn-${item.type ?? "link"} ant-btn-sm ${item.className ?? ""}`),
style: { "font-size": "12px" }
}, vue.toDisplayString(item.text), 3)
])
]),
_: 2
}, [
item.popConfirm.icon ? {
name: "icon",
fn: vue.withCtx(() => [
vue.createVNode(vue.unref(index$1.TaIcon), {
icon: item.popConfirm.icon
}, null, 8, ["icon"])
])
} : void 0
]), 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
item.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$1.TaIcon), {
key: 0,
icon: item.icon
}, null, 8, ["icon"])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("span", {
class: vue.normalizeClass(`ml-1 ant-btn ant-btn-${item.type ?? "link"} ant-btn-sm ${item.className ?? ""}`),
style: { "font-size": "12px" }
}, vue.toDisplayString(item.text), 3),
vue.createCommentVNode(' <span class="ml-1">{{ item.text }}</span> ')
], 64))
]),
_: 2
}, 1040, ["disabled", "onClick"]),
item.divider ? (vue.openBlock(), vue.createBlock(vue.unref(AMenuDivider), {
key: `d-${item.event}`
})) : vue.createCommentVNode("v-if", true)
], 64);
}), 128))
]),
_: 1
}, 8, ["selected-keys"])
]),
default: vue.withCtx(() => [
vue.createElementVNode("span", _hoisted_1, [
vue.renderSlot(_ctx.$slots, "default")
])
]),
_: 3
}, 16, ["trigger", "overlay-class-name"]);
};
}
});
var Dropdown = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "/home/runner/work/tav-ui/tav-ui/packages/components/dropdown/src/dropdown.vue"]]);
exports["default"] = Dropdown;
//# sourceMappingURL=dropdown2.js.map