hongluan-business-ui
Version:
Hongluan Business Component Library for Vue 3
166 lines (161 loc) • 7.03 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var hongluanUi = require('hongluan-ui');
var util = require('../../../utils/util.js');
var dockContainer = require('./dock-container.js');
var useDockContainer = require('./use-dock-container.js');
var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
const _sfc_main = vue.defineComponent({
name: "DockContainer",
components: {
HlScrollbar: hongluanUi.HlScrollbar,
HlGroup: hongluanUi.HlGroup,
HlThumb: hongluanUi.HlThumb,
HlIcon: hongluanUi.HlIcon,
SystemClose: hongluanUi.SystemClose
},
directives: {},
inheritAttrs: false,
props: dockContainer.dockContainerProps,
emits: dockContainer.dockContainerEmits,
setup(props) {
const { prefix } = util.usePrefix();
const scrollbarRef = vue.ref();
const { t } = hongluanUi.useLocale();
const dialogRef = vue.ref();
const dialog = useDockContainer.useDockContainer(props, scrollbarRef);
return {
prefix,
t,
hlPrefix: hongluanUi.PREFIX.toLowerCase(),
dialogRef,
scrollbarRef,
...dialog
};
}
});
const _hoisted_1 = { class: "panel-body" };
const _hoisted_2 = { class: "dock-items" };
const _hoisted_3 = { class: "item-content" };
const _hoisted_4 = {
key: 0,
class: "dock-placeholder media"
};
const _hoisted_5 = ["title"];
const _hoisted_6 = ["src"];
const _hoisted_7 = ["src"];
const _hoisted_8 = { class: "item-title" };
const _hoisted_9 = ["onClick"];
const _hoisted_10 = {
key: 1,
class: "empty-text"
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_hl_thumb = vue.resolveComponent("hl-thumb");
const _component_system_close = vue.resolveComponent("system-close");
const _component_hl_icon = vue.resolveComponent("hl-icon");
const _component_hl_group = vue.resolveComponent("hl-group");
const _component_hl_scrollbar = vue.resolveComponent("hl-scrollbar");
return vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
vue.createVNode(vue.Transition, {
name: _ctx.animName,
onAfterEnter: _ctx.afterEnter,
onAfterLeave: _ctx.afterLeave,
onBeforeLeave: _ctx.beforeLeave
}, {
default: vue.withCtx(() => [
vue.withDirectives(vue.createElementVNode("div", vue.mergeProps(_ctx.$attrs, {
class: [
_ctx.prefix + "-dock-container",
_ctx.hlPrefix + "-panel",
"at-" + _ctx.placement,
_ctx.customClass
],
style: [
{
width: _ctx.width,
height: _ctx.height,
zIndex: _ctx.zIndex,
"--dock-item-width": _ctx.itemWidth,
"--dock-item-height": _ctx.itemHeight
}
],
"aria-modal": "true",
role: "drawer",
"aria-label": "drawer",
onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
}, ["stop"]))
}), [
vue.createElementVNode("div", _hoisted_1, [
vue.renderSlot(_ctx.$slots, "default", { data: "dockItems" }, () => [
_ctx.dockItems.length ? (vue.openBlock(), vue.createBlock(_component_hl_scrollbar, {
key: 0,
ref: "scrollbarRef",
class: "scrollbar"
}, {
default: vue.withCtx(() => [
vue.createElementVNode("div", _hoisted_2, [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.dockItems, (item) => {
return vue.openBlock(), vue.createBlock(_component_hl_group, {
key: item.id,
class: "dock-item",
dir: "vertical",
onClick: vue.withModifiers(($event) => _ctx.restoreDockItem(item.id), ["stop"])
}, {
default: vue.withCtx(() => [
vue.createElementVNode("div", _hoisted_3, [
!item.snapshot ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4)) : typeof item.snapshot === "string" ? (vue.openBlock(), vue.createElementBlock("p", {
key: 1,
class: "media text",
title: item.snapshot
}, vue.toDisplayString(item.snapshot), 9, _hoisted_5)) : item.snapshot.type === "image" ? (vue.openBlock(), vue.createBlock(_component_hl_thumb, {
key: 2,
src: item.snapshot.url,
class: "media full",
fit: "cover"
}, null, 8, ["src"])) : item.snapshot.type === "video" ? (vue.openBlock(), vue.createElementBlock("video", {
key: 3,
src: item.snapshot.url,
class: "media"
}, null, 8, _hoisted_6)) : item.snapshot.type === "audio" ? (vue.openBlock(), vue.createElementBlock("audio", {
key: 4,
src: item.snapshot.url,
class: "media",
controls: "controls"
}, null, 8, _hoisted_7)) : vue.createCommentVNode("v-if", true)
]),
vue.createElementVNode("div", _hoisted_8, vue.toDisplayString(item.title), 1),
vue.createElementVNode("div", {
class: "item-close",
onClick: vue.withModifiers(($event) => _ctx.closeDockItem(item.id), ["stop"])
}, [
vue.createVNode(_component_hl_icon, null, {
default: vue.withCtx(() => [
vue.createVNode(_component_system_close)
]),
_: 1
})
], 8, _hoisted_9)
]),
_: 2
}, 1032, ["onClick"]);
}), 128))
])
]),
_: 1
}, 512)) : vue.createCommentVNode("v-if", true),
_ctx.dockItems.length === 0 ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_10, vue.toDisplayString(_ctx.t("hl.table.emptyText")), 1)) : vue.createCommentVNode("v-if", true)
])
])
], 16), [
[vue.vShow, _ctx.visible]
])
]),
_: 3
}, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
]);
}
var DockContainer = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["render", _sfc_render]]);
exports["default"] = DockContainer;
//# sourceMappingURL=dock-container2.js.map