Refactor #3832 Refactor #3833 - For Fieldset

pull/3852/head
Bahadır Sofuoğlu 2023-04-11 09:48:49 +03:00
parent fdebb7ec87
commit 586c2f563c
1 changed files with 7 additions and 10 deletions

View File

@ -18,7 +18,7 @@
v-bind="{ ...toggleButtonProps, ...ptm('toggler') }" v-bind="{ ...toggleButtonProps, ...ptm('toggler') }"
> >
<slot name="togglericon" :collapsed="d_collapsed"> <slot name="togglericon" :collapsed="d_collapsed">
<span :class="iconClass" v-bind="ptm('togglericon')"></span> <component :is="d_collapsed ? 'PlusIcon' : 'MinusIcon'" v-bind="ptm('togglericon')" class="p-fieldset-toggler" />
</slot> </slot>
<slot name="legend"> <slot name="legend">
<span class="p-fieldset-legend-text" v-bind="ptm('legendtitle')">{{ legend }}</span> <span class="p-fieldset-legend-text" v-bind="ptm('legendtitle')">{{ legend }}</span>
@ -38,6 +38,8 @@
<script> <script>
import BaseComponent from 'primevue/basecomponent'; import BaseComponent from 'primevue/basecomponent';
import Ripple from 'primevue/ripple'; import Ripple from 'primevue/ripple';
import MinusIcon from 'primevue/icon/minus';
import PlusIcon from 'primevue/icon/plus';
import { UniqueComponentId } from 'primevue/utils'; import { UniqueComponentId } from 'primevue/utils';
export default { export default {
@ -80,15 +82,6 @@ export default {
} }
}, },
computed: { computed: {
iconClass() {
return [
'p-fieldset-toggler pi ',
{
'pi-minus': !this.d_collapsed,
'pi-plus': this.d_collapsed
}
];
},
ariaId() { ariaId() {
return UniqueComponentId(); return UniqueComponentId();
}, },
@ -98,6 +91,10 @@ export default {
}, },
directives: { directives: {
ripple: Ripple ripple: Ripple
},
components: {
PlusIcon,
MinusIcon
} }
}; };
</script> </script>