UNPKG

primevue

Version:

PrimeVue is a premium UI library for Vue featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBlock, wh

114 lines (108 loc) 3.55 kB
import BaseComponent from '@primevue/core/basecomponent'; import SidebarLayoutStyle from 'primevue/sidebarlayout/style'; import { openBlock, createBlock, resolveDynamicComponent, mergeProps, withCtx, renderSlot, normalizeClass } from 'vue'; var script$1 = { name: 'BaseSidebarLayout', "extends": BaseComponent, props: { as: { type: [String, Object], "default": 'DIV' }, asChild: { type: Boolean, "default": false } }, style: SidebarLayoutStyle, provide: function provide() { return { $pcSidebarLayout: this, $parentInstance: this }; } }; var script = { name: 'SidebarLayout', "extends": script$1, inheritAttrs: false, triggerEvent: null, data: function data() { return { registryMap: new Map() }; }, methods: { registerSidebar: function registerSidebar(id, entry) { this.registryMap.set(id, entry); }, unregisterSidebar: function unregisterSidebar(id) { this.registryMap["delete"](id); }, getSidebarEntry: function getSidebarEntry(id) { return this.registryMap.get(id); }, getSidebarEntries: function getSidebarEntries() { return this.registryMap; }, toggleSidebar: function toggleSidebar(target, event) { if (target) { var _this$registryMap$get; (_this$registryMap$get = this.registryMap.get(target)) === null || _this$registryMap$get === void 0 || _this$registryMap$get.toggle(event); return; } if (this.registryMap.size >= 1) { var _this$registryMap$val; (_this$registryMap$val = this.registryMap.values().next().value) === null || _this$registryMap$val === void 0 || _this$registryMap$val.toggle(event); } }, collapseSidebar: function collapseSidebar(target, event) { if (typeof target === 'string') { var entry = this.registryMap.get(target); if (entry !== null && entry !== void 0 && entry.open) entry.toggle(event); return; } var originalEvent = event !== null && event !== void 0 ? event : target; this.registryMap.forEach(function (entry) { if (entry.open && entry.dismissable) entry.toggle(originalEvent); }); }, notifyTriggerClick: function notifyTriggerClick(event) { // Remember the click dispatched by a SidebarTrigger so the same event, once it bubbles // to SidebarMain, is not treated as an outside click that would undo the trigger action. this.triggerEvent = event; }, onMainClick: function onMainClick(event) { if (event && this.triggerEvent === event) { this.triggerEvent = null; return; } this.registryMap.forEach(function (entry) { if (entry.open && entry.overlay && entry.hideOnOutsideClick) entry.toggle(event); }); }, isAnySidebarOpen: function isAnySidebarOpen() { var open = false; this.registryMap.forEach(function (entry) { if (entry.open) open = true; }); return open; } } }; function render(_ctx, _cache, $props, $setup, $data, $options) { return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ key: 0, "class": _ctx.cx('root') }, _ctx.ptmi('root')), { "default": withCtx(function () { return [renderSlot(_ctx.$slots, "default")]; }), _: 3 }, 16, ["class"])) : renderSlot(_ctx.$slots, "default", { key: 1, "class": normalizeClass(_ctx.cx('root')) }); } script.render = render; export { script as default };