UNPKG

@empathyco/x-components

Version:
54 lines (51 loc) 1.2 kB
import { defineComponent, computed } from 'vue'; import BaseRating from '../../base-rating.vue.js'; /** * Renders a label for a rating filter, allowing to override the elements used to paint * the rating. * * @public */ var _sfc_main = defineComponent({ components: { BaseRating, }, props: { /** * The filter data to render. * * @public */ filter: { type: Object, required: true, }, /** * Maximum number of elements to paint. * * @public */ max: { type: Number, default: 5, }, }, setup(props) { /** * Converts the label string into a number. * * @returns The label as number or 0 if it is not a valid number. * * @internal */ const value = computed(() => { const x = Number.parseFloat(props.filter.label) ?? 0; return Number.isNaN(x) ? 0 : x; }); return { value, }; }, }); export { _sfc_main as default }; //# sourceMappingURL=base-rating-filter-label.vue2.js.map