1 line
18 KiB
Plaintext
1 line
18 KiB
Plaintext
|
|
{"version":3,"file":"index.mjs","sources":["../../src/rating/BaseRating.vue","../../src/rating/Rating.vue","../../src/rating/Rating.vue?vue&type=template&id=1f2fc99e&lang.js"],"sourcesContent":["<script>\nimport BaseEditableHolder from '@primevue/core/baseeditableholder';\nimport RatingStyle from 'primevue/rating/style';\n\nexport default {\n name: 'BaseRating',\n extends: BaseEditableHolder,\n props: {\n readonly: {\n type: Boolean,\n default: false\n },\n stars: {\n type: Number,\n default: 5\n },\n onIcon: {\n type: String,\n default: undefined\n },\n offIcon: {\n type: String,\n default: undefined\n }\n },\n style: RatingStyle,\n provide() {\n return {\n $pcRating: this,\n $parentInstance: this\n };\n }\n};\n</script>\n","<template>\n <div :class=\"cx('root')\" v-bind=\"ptmi('root')\" :data-p=\"dataP\">\n <template v-for=\"value in stars\" :key=\"value\">\n <div :class=\"cx('option', { value })\" @click=\"onOptionClick($event, value)\" v-bind=\"getPTOptions('option', value)\" :data-p-active=\"value <= d_value\" :data-p-focused=\"value === focusedOptionIndex\" :data-p=\"dataOption(value)\">\n <span class=\"p-hidden-accessible\" v-bind=\"ptm('hiddenOptionInputContainer')\" :data-p-hidden-accessible=\"true\">\n <input\n type=\"radio\"\n :value=\"value\"\n :name=\"namex\"\n :checked=\"d_value === value\"\n :disabled=\"disabled\"\n :readonly=\"readonly\"\n :aria-label=\"starAriaLabel(value)\"\n @focus=\"onFocus($event, value)\"\n @blur=\"onBlur\"\n @change=\"onChange($event, value)\"\n v-bind=\"ptm('hiddenOptionInput')\"\n />\n </span>\n <slot v-if=\"value <= d_value\" name=\"onicon\" :value=\"value\" :toggleCallback=\"(event) => onChange(event, value)\" :class=\"cx('onIcon')\">\n <component :is=\"onIcon ? 'span' : 'StarFillIcon'\" :class=\"[cx('onIcon'), onIcon]\" v-bind=\"ptm('onIcon')\" />\n </slot>\n <slot v-else name=\"officon\" :value=\"value\" :class=\"cx('offIcon')\" :toggleCallback=\"(event) => onChange(event, value)\">\n <component :is=\"offIcon ? 'span' : 'StarIcon'\" :class=\"[cx('offIcon'), offIcon]\" v-bind=\"ptm('offIcon')\" />\n </slot>\n </div>\n </template>\n </div>\n</template>\n\n<script>\nimport { cn } from '@primeuix/utils';\nimport { focus, getFirstFocusableElement } from '@primeuix/utils/dom';\nimport BanIcon from '@primevue/icons/ban';\nimport StarIcon from '@primevue/icons/star';\nimport StarFillIcon from '@primevue/icons/starfill';\nimport BaseRating from './BaseRating.vue';\n\nexport default {\n name: 'Rating',\n extends: BaseRating,\n inheritAttrs: false,\n emits: ['change', 'focus', 'blur'],\n data() {\n return {\n focusedOptionIndex: -1,\n isFocusVisibleItem: true\n };\n },\n methods: {\n getPTOptions(key, value) {\n return this.ptm(key, {\n context: {\n active: value <= this.d_value,\n focused: value === this.focusedOptionIndex\n }\n });\n },\n onOptionClick(event, value) {\n if (!this.readonly && !this.disabled) {\n this.onOptionSelect(event, value);\n this.isFocusVisibleItem = false;\n const firstFocusableEl = getFirstFocusableElement(event.currentTarget);\n\n firstFocusableEl && focus(firstFocusableEl);\n }\n },\n onFocus(event, value) {\n this.focusedOptionIndex = va
|