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
83 lines (77 loc) • 3.86 kB
JavaScript
import { mergeProps, openBlock, createBlock, resolveDynamicComponent, renderSlot, normalizeClass } from 'vue';
import BaseComponent from '@primevue/core/basecomponent';
import SidebarRailStyle from 'primevue/sidebarrail/style';
var script$1 = {
name: 'BaseSidebarRail',
"extends": BaseComponent,
props: {
as: {
type: [String, Object],
"default": 'BUTTON'
},
asChild: {
type: Boolean,
"default": false
}
},
style: SidebarRailStyle,
provide: function provide() {
return {
$pcSidebarRail: this,
$parentInstance: this
};
}
};
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
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), true).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; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var script = {
name: 'SidebarRail',
"extends": script$1,
inheritAttrs: false,
inject: {
$pcSidebar: {
"default": null
}
},
methods: {
onClick: function onClick(event) {
var _this$$pcSidebar;
(_this$$pcSidebar = this.$pcSidebar) === null || _this$$pcSidebar === void 0 || _this$$pcSidebar.toggle(event);
}
},
computed: {
a11yAttrs: function a11yAttrs() {
var _this$$pcSidebar$getS, _this$$pcSidebar2;
var sidebarPart = (_this$$pcSidebar$getS = (_this$$pcSidebar2 = this.$pcSidebar) === null || _this$$pcSidebar2 === void 0 ? void 0 : _this$$pcSidebar2.getSectionAttrs('rail')) !== null && _this$$pcSidebar$getS !== void 0 ? _this$$pcSidebar$getS : {};
return _objectSpread(_objectSpread({}, sidebarPart), {}, {
'data-pc-name': 'sidebarrail',
'data-pc-section': 'root',
'aria-label': 'Toggle Sidebar',
tabIndex: -1
});
},
attrs: function attrs() {
return mergeProps(this.a11yAttrs, this.ptmi('root'));
}
}
};
function render(_ctx, _cache, $props, $setup, $data, $options) {
return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({
key: 0,
"class": _ctx.cx('root'),
type: _ctx.as === 'BUTTON' || _ctx.as === 'button' ? 'button' : undefined
}, $options.attrs, {
onClick: $options.onClick
}), null, 16, ["class", "type", "onClick"])) : renderSlot(_ctx.$slots, "default", {
key: 1,
a11yAttrs: $options.a11yAttrs,
"class": normalizeClass(_ctx.cx('root')),
onClick: $options.onClick
});
}
script.render = render;
export { script as default };