Skip to content

Commit

Permalink
refactor: #7090 for Rating
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Jan 14, 2025
1 parent b70064c commit cfdee00
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions packages/primevue/src/rating/Rating.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<input
type="radio"
:value="value"
:name="d_name"
:name="namex"
:checked="d_value === value"
:disabled="disabled"
:readonly="readonly"
Expand All @@ -30,7 +30,6 @@

<script>
import { focus, getFirstFocusableElement } from '@primeuix/utils/dom';
import { UniqueComponentId } from '@primevue/core/utils';
import BanIcon from '@primevue/icons/ban';
import StarIcon from '@primevue/icons/star';
import StarFillIcon from '@primevue/icons/starfill';
Expand All @@ -43,19 +42,10 @@ export default {
emits: ['change', 'focus', 'blur'],
data() {
return {
d_name: this.name,
focusedOptionIndex: -1,
isFocusVisibleItem: true
};
},
watch: {
name: function (newValue) {
this.d_name = newValue || UniqueComponentId();
}
},
mounted() {
this.d_name = this.d_name || UniqueComponentId();
},
methods: {
getPTOptions(key, value) {
return this.ptm(key, {
Expand Down Expand Up @@ -104,6 +94,11 @@ export default {
return value === 1 ? this.$primevue.config.locale.aria.star : this.$primevue.config.locale.aria.stars.replace(/{star}/g, value);
}
},
computed: {
namex() {
return this.name || `${this.$attrSelector}_name`;
}
},
components: {
StarFillIcon,
StarIcon,
Expand Down

0 comments on commit cfdee00

Please sign in to comment.