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
90 lines (84 loc) • 2.71 kB
JavaScript
import { mergeProps, openBlock, createBlock, Transition, withCtx, resolveDynamicComponent, renderSlot, normalizeClass, createCommentVNode } from 'vue';
import BaseComponent from '@primevue/core/basecomponent';
import SidebarBackdropStyle from 'primevue/sidebarbackdrop/style';
var script$1 = {
name: 'BaseSidebarBackdrop',
"extends": BaseComponent,
props: {
as: {
type: [String, Object],
"default": 'DIV'
},
asChild: {
type: Boolean,
"default": false
}
},
style: SidebarBackdropStyle,
provide: function provide() {
return {
$pcSidebarBackdrop: this,
$parentInstance: this
};
}
};
var script = {
name: 'SidebarBackdrop',
"extends": script$1,
inheritAttrs: false,
inject: {
$pcSidebarLayout: {
"default": null
}
},
methods: {
onClick: function onClick(event) {
var _this$$pcSidebarLayou;
(_this$$pcSidebarLayou = this.$pcSidebarLayout) === null || _this$$pcSidebarLayou === void 0 || _this$$pcSidebarLayou.collapseSidebar(event);
}
},
computed: {
visible: function visible() {
var _this$$pcSidebarLayou2, _this$$pcSidebarLayou3;
return !!((_this$$pcSidebarLayou2 = this.$pcSidebarLayout) !== null && _this$$pcSidebarLayou2 !== void 0 && (_this$$pcSidebarLayou3 = _this$$pcSidebarLayou2.isAnySidebarOpen) !== null && _this$$pcSidebarLayou3 !== void 0 && _this$$pcSidebarLayou3.call(_this$$pcSidebarLayou2));
},
a11yAttrs: function a11yAttrs() {
return {
'data-pc-name': 'sidebarbackdrop',
'data-pc-section': 'root',
'data-state': this.visible ? 'expanded' : 'collapsed'
};
},
attrs: function attrs() {
return mergeProps(this.a11yAttrs, this.ptmi('root'));
}
}
};
function render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createBlock(Transition, {
name: "p-overlay-mask",
appear: ""
}, {
"default": withCtx(function () {
return [$options.visible && !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({
key: 0,
"class": _ctx.cx('root')
}, $options.attrs, {
onClick: $options.onClick
}), {
"default": withCtx(function () {
return [renderSlot(_ctx.$slots, "default")];
}),
_: 3
}, 16, ["class", "onClick"])) : $options.visible && _ctx.asChild ? renderSlot(_ctx.$slots, "default", {
key: 1,
a11yAttrs: $options.a11yAttrs,
"class": normalizeClass(_ctx.cx('root')),
onClick: $options.onClick
}) : createCommentVNode("", true)];
}),
_: 3
});
}
script.render = render;
export { script as default };