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.55 kB
JavaScript
import { mergeProps, openBlock, createBlock, resolveDynamicComponent, withCtx, renderSlot, normalizeClass } from 'vue';
import BaseComponent from '@primevue/core/basecomponent';
import CompareHandleStyle from 'primevue/comparehandle/style';
var script$1 = {
name: 'BaseCompareHandle',
"extends": BaseComponent,
props: {
as: {
type: [String, Object],
"default": 'SPAN'
},
asChild: {
type: Boolean,
"default": false
}
},
style: CompareHandleStyle,
provide: function provide() {
return {
$pcCompareHandle: this,
$parentInstance: this
};
}
};
var script = {
name: 'CompareHandle',
"extends": script$1,
inheritAttrs: false,
inject: ['$pcCompare'],
methods: {
getHandleStyle: function getHandleStyle() {
var compare = this.$pcCompare;
var percent = compare.getValuePercent(compare.d_value);
return compare.isHorizontal ? {
position: 'absolute',
insetInlineStart: "".concat(percent, "%"),
insetBlockStart: 0,
translate: '-50% 0'
} : {
position: 'absolute',
insetInlineStart: 0,
bottom: "".concat(percent, "%"),
translate: '0 50%'
};
}
},
computed: {
attrs: function attrs() {
var _this$$pcCompare;
return mergeProps(this.a11yAttrs, (_this$$pcCompare = this.$pcCompare) === null || _this$$pcCompare === void 0 ? void 0 : _this$$pcCompare.ptm('handle'), this.ptmi('root'));
},
a11yAttrs: function a11yAttrs() {
var compare = this.$pcCompare;
if (!compare) return {};
return {
tabindex: -1,
style: this.getHandleStyle(),
'data-pc-section': 'root',
'data-orientation': compare.orientation,
'data-disabled': compare.disabled ? '' : undefined,
'data-invalid': compare.invalid ? '' : undefined,
'data-dragging': compare.isDragging ? '' : undefined,
onPointerdown: compare.onHandlePointerDown
};
}
}
};
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 };