mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Refactor #3965 - For Fieldset
This commit is contained in:
parent
69d6ed9ccc
commit
717e0d79e6
3 changed files with 76 additions and 61 deletions
67
components/lib/fieldset/BaseFieldset.vue
Normal file
67
components/lib/fieldset/BaseFieldset.vue
Normal file
|
@ -0,0 +1,67 @@
|
|||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
import { useStyle } from 'primevue/usestyle';
|
||||
|
||||
const styles = `
|
||||
.p-fieldset-legend > a,
|
||||
.p-fieldset-legend > span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.p-fieldset-toggleable .p-fieldset-legend a {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.p-fieldset-legend-text {
|
||||
line-height: 1;
|
||||
}
|
||||
`;
|
||||
|
||||
const classes = {
|
||||
root: ({ props }) => [
|
||||
'p-fieldset p-component',
|
||||
{
|
||||
'p-fieldset-toggleable': props.toggleable
|
||||
}
|
||||
],
|
||||
legend: 'p-fieldset-legend',
|
||||
legendtitle: 'p-fieldset-legend-text',
|
||||
togglericon: 'p-fieldset-toggler',
|
||||
legendtitle: 'p-fieldset-legend-text',
|
||||
toggleablecontent: 'p-toggleable-content',
|
||||
content: 'p-fieldset-content'
|
||||
};
|
||||
|
||||
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_fieldset_style', manual: true });
|
||||
|
||||
export default {
|
||||
name: 'BaseFieldset',
|
||||
extends: BaseComponent,
|
||||
props: {
|
||||
legend: String,
|
||||
toggleable: Boolean,
|
||||
collapsed: Boolean,
|
||||
toggleButtonProps: {
|
||||
type: null,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
style: {
|
||||
classes
|
||||
},
|
||||
watch: {
|
||||
isUnstyled: {
|
||||
immediate: true,
|
||||
handler(newValue) {
|
||||
!newValue && loadStyle();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue