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

140 lines (134 loc) 6.81 kB
import { isElement } from '@primeuix/utils/dom'; import { mergeProps, openBlock, createBlock, resolveDynamicComponent, withCtx, renderSlot, normalizeClass } from 'vue'; import BaseComponent from '@primevue/core/basecomponent'; import ScrollAreaScrollbarStyle from 'primevue/scrollareascrollbar/style'; var script$1 = { name: 'BaseScrollAreaScrollbar', "extends": BaseComponent, props: { orientation: { type: String, "default": 'vertical' }, as: { type: [String, Object], "default": 'DIV' }, asChild: { type: Boolean, "default": false } }, style: ScrollAreaScrollbarStyle, provide: function provide() { return { $pcScrollAreaScrollbar: 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: 'ScrollAreaScrollbar', "extends": script$1, inheritAttrs: false, inject: ['$pcScrollArea'], beforeUnmount: function beforeUnmount() { var _this$$pcScrollArea; (_this$$pcScrollArea = this.$pcScrollArea) === null || _this$$pcScrollArea === void 0 || _this$$pcScrollArea.setScrollbarEl(null, this.orientation); }, methods: { setRef: function setRef(el) { var _el$$el, _this$$pcScrollArea2; var dom = isElement(el) ? el : (_el$$el = el === null || el === void 0 ? void 0 : el.$el) !== null && _el$$el !== void 0 ? _el$$el : null; (_this$$pcScrollArea2 = this.$pcScrollArea) === null || _this$$pcScrollArea2 === void 0 || _this$$pcScrollArea2.setScrollbarEl(dom, this.orientation); }, onPointerdown: function onPointerdown(event) { var _this$$pcScrollArea3; (_this$$pcScrollArea3 = this.$pcScrollArea) === null || _this$$pcScrollArea3 === void 0 || _this$$pcScrollArea3.onScrollbarPointerDown(event, this.orientation); }, onPointermove: function onPointermove(event) { var _this$$pcScrollArea4; (_this$$pcScrollArea4 = this.$pcScrollArea) === null || _this$$pcScrollArea4 === void 0 || _this$$pcScrollArea4.onScrollbarPointerMove(event); }, onPointerup: function onPointerup(event) { var _this$$pcScrollArea5; (_this$$pcScrollArea5 = this.$pcScrollArea) === null || _this$$pcScrollArea5 === void 0 || _this$$pcScrollArea5.onScrollbarPointerUp(event); }, onWheel: function onWheel(event) { var _this$$pcScrollArea6; (_this$$pcScrollArea6 = this.$pcScrollArea) === null || _this$$pcScrollArea6 === void 0 || _this$$pcScrollArea6.onScrollbarWheel(event, this.orientation); } }, computed: { isVertical: function isVertical() { return this.orientation === 'vertical'; }, hovering: function hovering() { var _this$$pcScrollArea7; return !!((_this$$pcScrollArea7 = this.$pcScrollArea) !== null && _this$$pcScrollArea7 !== void 0 && _this$$pcScrollArea7.hovering); }, scrolling: function scrolling() { var _this$$pcScrollArea8, _this$$pcScrollArea9; return this.isVertical ? !!((_this$$pcScrollArea8 = this.$pcScrollArea) !== null && _this$$pcScrollArea8 !== void 0 && _this$$pcScrollArea8.scrollingY) : !!((_this$$pcScrollArea9 = this.$pcScrollArea) !== null && _this$$pcScrollArea9 !== void 0 && _this$$pcScrollArea9.scrollingX); }, hidden: function hidden() { var _this$$pcScrollArea0; var scrollMeta = (_this$$pcScrollArea0 = this.$pcScrollArea) === null || _this$$pcScrollArea0 === void 0 ? void 0 : _this$$pcScrollArea0.scrollMeta; return this.isVertical ? !!(scrollMeta !== null && scrollMeta !== void 0 && scrollMeta.hiddenY) : !!(scrollMeta !== null && scrollMeta !== void 0 && scrollMeta.hiddenX); }, scrollbarStyle: function scrollbarStyle() { var base = { display: this.hidden ? 'none' : undefined }; if (this.isVertical) { return _objectSpread(_objectSpread({}, base), {}, { bottom: 'var(--px-corner-height)' }); } return _objectSpread(_objectSpread({}, base), {}, { insetInlineEnd: 'var(--px-corner-width)' }); }, attrs: function attrs() { return mergeProps(this.a11yAttrs, this.ptmi('root')); }, a11yAttrs: function a11yAttrs() { return { ref: this.setRef, 'data-orientation': this.orientation, 'data-hovering': this.hovering ? '' : undefined, 'data-scrolling': this.scrolling ? '' : undefined, 'data-hidden': this.hidden ? '' : undefined, style: this.scrollbarStyle, onPointerdown: this.onPointerdown, onPointermove: this.onPointermove, onPointerup: this.onPointerup, onWheel: this.onWheel }; } } }; function render(_ctx, _cache, $props, $setup, $data, $options) { return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({ key: 0, "class": _ctx.cx('root'), style: _ctx.sx('root') }, $options.attrs), { "default": withCtx(function () { return [renderSlot(_ctx.$slots, "default")]; }), _: 3 }, 16, ["class", "style"])) : renderSlot(_ctx.$slots, "default", { key: 1, "class": normalizeClass(_ctx.cx('root')), a11yAttrs: $options.a11yAttrs }); } script.render = render; export { script as default };