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
97 lines (91 loc) • 2.81 kB
JavaScript
import { mergeProps, openBlock, createBlock, resolveDynamicComponent, withCtx, renderSlot, normalizeClass } from 'vue';
import BaseComponent from '@primevue/core/basecomponent';
import ScrollAreaHandleStyle from 'primevue/scrollareahandle/style';
var script$1 = {
name: 'BaseScrollAreaHandle',
"extends": BaseComponent,
props: {
as: {
type: [String, Object],
"default": 'DIV'
},
asChild: {
type: Boolean,
"default": false
}
},
style: ScrollAreaHandleStyle,
provide: function provide() {
return {
$pcScrollAreaHandle: this,
$parentInstance: this
};
}
};
var script = {
name: 'ScrollAreaHandle',
"extends": script$1,
inheritAttrs: false,
inject: {
$pcScrollArea: {
"default": null
},
$pcScrollAreaScrollbar: {
"default": null
}
},
methods: {
onPointerdown: function onPointerdown(event) {
var _this$$pcScrollArea;
(_this$$pcScrollArea = this.$pcScrollArea) === null || _this$$pcScrollArea === void 0 || _this$$pcScrollArea.onHandlePointerDown(event, this.orientation);
}
},
computed: {
orientation: function orientation() {
var _this$$pcScrollAreaSc, _this$$pcScrollAreaSc2;
return (_this$$pcScrollAreaSc = (_this$$pcScrollAreaSc2 = this.$pcScrollAreaScrollbar) === null || _this$$pcScrollAreaSc2 === void 0 ? void 0 : _this$$pcScrollAreaSc2.orientation) !== null && _this$$pcScrollAreaSc !== void 0 ? _this$$pcScrollAreaSc : 'vertical';
},
isVertical: function isVertical() {
return this.orientation === 'vertical';
},
handleStyle: function handleStyle() {
if (this.isVertical) {
return {
height: 'var(--px-handle-height, 0px)',
transform: 'translate3d(0, var(--px-handle-offset, 0px), 0)'
};
}
return {
width: 'var(--px-handle-width, 0px)',
transform: 'translate3d(var(--px-handle-offset, 0px), 0, 0)'
};
},
attrs: function attrs() {
return mergeProps(this.a11yAttrs, this.ptmi('root'));
},
a11yAttrs: function a11yAttrs() {
return {
'data-orientation': this.orientation,
style: this.handleStyle,
onPointerdown: this.onPointerdown
};
}
}
};
function render(_ctx, _cache, $props, $setup, $data, $options) {
return !_ctx.asChild ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.as), mergeProps({
key: 0,
"class": _ctx.cx('root')
}, $options.attrs), {
"default": withCtx(function () {
return [renderSlot(_ctx.$slots, "default")];
}),
_: 3
}, 16, ["class"])) : renderSlot(_ctx.$slots, "default", {
key: 1,
"class": normalizeClass(_ctx.cx('root')),
a11yAttrs: $options.a11yAttrs
});
}
script.render = render;
export { script as default };