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
125 lines (119 loc) • 4.01 kB
JavaScript
import { cn } from '@primeuix/utils';
import { mergeProps, openBlock, createBlock, resolveDynamicComponent, withCtx, createElementVNode, renderSlot, normalizeClass } from 'vue';
import BaseComponent from '@primevue/core/basecomponent';
import CompareIndicatorStyle from 'primevue/compareindicator/style';
var script$1 = {
name: 'BaseCompareIndicator',
"extends": BaseComponent,
props: {
as: {
type: [String, Object],
"default": 'SPAN'
},
asChild: {
type: Boolean,
"default": false
},
inputId: {
type: String,
"default": undefined
},
inputStyle: {
type: [String, Object, Array],
"default": undefined
},
inputClass: {
type: [String, Object, Array],
"default": undefined
}
},
style: CompareIndicatorStyle,
provide: function provide() {
return {
$pcCompareIndicator: this,
$parentInstance: this
};
}
};
var script = {
name: 'CompareIndicator',
"extends": script$1,
inheritAttrs: false,
inject: ['$pcCompare'],
methods: {
getInputAttrs: function getInputAttrs() {
var _compare$tabindex;
var compare = this.$pcCompare;
if (!compare) return {};
return {
name: compare.name,
type: 'range',
min: compare.min,
max: compare.max,
step: compare.step,
value: compare.d_value,
disabled: compare.disabled,
readonly: compare.readonly,
tabindex: compare.disabled ? -1 : (_compare$tabindex = compare.tabindex) !== null && _compare$tabindex !== void 0 ? _compare$tabindex : 0,
'aria-valuemin': compare.min,
'aria-valuemax': compare.max,
'aria-valuenow': compare.d_value,
'aria-orientation': compare.orientation,
'aria-readonly': compare.readonly ? 'true' : undefined,
'aria-labelledby': compare.ariaLabelledby,
'aria-label': compare.ariaLabel,
onInput: compare.onInputInput,
onChange: compare.onInputChange,
onFocus: compare.onInputFocus,
onBlur: compare.onInputBlur
};
}
},
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('indicator'), this.ptmi('root'));
},
a11yAttrs: function a11yAttrs() {
var compare = this.$pcCompare;
if (!compare) return {};
return {
'data-pc-section': 'root',
'data-orientation': compare.orientation,
'data-disabled': compare.disabled ? '' : undefined,
'data-invalid': compare.invalid ? '' : undefined,
'data-dragging': compare.isDragging ? '' : undefined
};
},
inputAttrs: function inputAttrs() {
var _this$$pcCompare2;
return mergeProps({
id: this.inputId,
style: this.inputStyle
}, ((_this$$pcCompare2 = this.$pcCompare) === null || _this$$pcCompare2 === void 0 ? void 0 : _this$$pcCompare2.ptm('input')) || {}, this.getInputAttrs());
},
inputClassValue: function inputClassValue() {
var _this$$pcCompare3;
return cn((_this$$pcCompare3 = this.$pcCompare) === null || _this$$pcCompare3 === void 0 ? void 0 : _this$$pcCompare3.cx('input'), this.inputClass);
}
}
};
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 [createElementVNode("input", mergeProps({
"class": $options.inputClassValue
}, $options.inputAttrs), null, 16), 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 };