Refactor #3965 - Update Base components

pull/4011/head
mertsincan 2023-05-30 12:03:42 +01:00
parent 911c4de1fe
commit b6ec58de65
10 changed files with 62 additions and 73 deletions

View File

@ -45,7 +45,7 @@ const classes = {
} }
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_accordion_style', manual: true }); const { load: loadStyle } = useStyle(styles, { id: 'primevue_accordion_style', manual: true });
export default { export default {
name: 'BaseAccordion', name: 'BaseAccordion',
@ -81,15 +81,13 @@ export default {
} }
}, },
css: { css: {
classes classes,
loadStyle
}, },
watch: { provide() {
isUnstyled: { return {
immediate: true, $parentInstance: this
handler(newValue) { };
!newValue && loadStyle();
}
}
} }
}; };
</script> </script>

View File

@ -14,6 +14,11 @@ export default {
contentClass: null, contentClass: null,
contentProps: null, contentProps: null,
disabled: Boolean disabled: Boolean
},
provide() {
return {
$parentInstance: this
};
} }
}; };
</script> </script>

View File

@ -146,7 +146,7 @@
@click="onOptionSelect($event, option)" @click="onOptionSelect($event, option)"
@mousemove="onOptionMouseMove($event, getOptionIndex(i, getItemOptions))" @mousemove="onOptionMouseMove($event, getOptionIndex(i, getItemOptions))"
:data-p-highlight="isSelected(option)" :data-p-highlight="isSelected(option)"
:data-p-focus="focusedOptionIndex === getOptionIndex(index, getItemOptions)" :data-p-focus="focusedOptionIndex === getOptionIndex(i, getItemOptions)"
:data-p-disabled="isOptionDisabled(option)" :data-p-disabled="isOptionDisabled(option)"
v-bind="getPTOptions(option, getItemOptions, i, 'item')" v-bind="getPTOptions(option, getItemOptions, i, 'item')"
> >

View File

@ -148,7 +148,7 @@ const classes = {
hiddenSelectedMessage: 'p-hidden-accessible' hiddenSelectedMessage: 'p-hidden-accessible'
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_autocomplete_style', manual: true }); const { load: loadStyle } = useStyle(styles, { id: 'primevue_autocomplete_style', manual: true });
export default { export default {
name: 'BaseAutoComplete', name: 'BaseAutoComplete',
@ -312,15 +312,13 @@ export default {
}, },
css: { css: {
classes, classes,
inlineStyles inlineStyles,
loadStyle
}, },
watch: { provide() {
isUnstyled: { return {
immediate: true, $parentInstance: this
handler(newValue) { };
!newValue && loadStyle();
}
}
} }
}; };
</script> </script>

View File

@ -222,7 +222,7 @@ const classes = {
clearButton: 'p-button-text' clearButton: 'p-button-text'
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_calendar_style', manual: true }); const { load: loadStyle } = useStyle(styles, { id: 'primevue_calendar_style', manual: true });
export default { export default {
name: 'BaseCalendar', name: 'BaseCalendar',
@ -445,15 +445,13 @@ export default {
}, },
css: { css: {
inlineStyles, inlineStyles,
classes classes,
loadStyle
}, },
watch: { provide() {
isUnstyled: { return {
immediate: true, $parentInstance: this
handler(newValue) { };
!newValue && loadStyle();
}
}
} }
}; };
</script> </script>

View File

@ -43,7 +43,7 @@ const classes = {
icon: 'p-checkbox-icon' icon: 'p-checkbox-icon'
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_checkbox_style', manual: true }); const { load: loadStyle } = useStyle(styles, { id: 'primevue_checkbox_style', manual: true });
export default { export default {
name: 'BaseCheckbox', name: 'BaseCheckbox',
@ -106,15 +106,13 @@ export default {
} }
}, },
css: { css: {
classes classes,
loadStyle
}, },
watch: { provide() {
isUnstyled: { return {
immediate: true, $parentInstance: this
handler(newValue) { };
!newValue && loadStyle();
}
}
} }
}; };
</script> </script>

View File

@ -67,7 +67,7 @@ const classes = {
inputToken: 'p-chips-input-token' inputToken: 'p-chips-input-token'
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_chips_style', manual: true }); const { load: loadStyle } = useStyle(styles, { id: 'primevue_chips_style', manual: true });
export default { export default {
name: 'BaseChips', name: 'BaseChips',
@ -131,15 +131,13 @@ export default {
} }
}, },
css: { css: {
classes classes,
loadStyle
}, },
watch: { provide() {
isUnstyled: { return {
immediate: true, $parentInstance: this
handler(newValue) { };
!newValue && loadStyle();
}
}
} }
}; };
</script> </script>

View File

@ -32,7 +32,7 @@ const classes = {
hueHandle: 'p-colorpicker-hue-handle' hueHandle: 'p-colorpicker-hue-handle'
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_colorpicker_style', manual: true }); const { load: loadStyle } = useStyle(styles, { id: 'primevue_colorpicker_style', manual: true });
export default { export default {
name: 'BaseColorPicker', name: 'BaseColorPicker',
@ -77,15 +77,13 @@ export default {
panelClass: null panelClass: null
}, },
css: { css: {
classes classes,
loadStyle
}, },
watch: { provide() {
isUnstyled: { return {
immediate: true, $parentInstance: this
handler(newValue) { };
!newValue && loadStyle();
}
}
} }
}; };
</script> </script>

View File

@ -153,7 +153,7 @@ const classes = {
hiddenLastFocusableEl: 'p-hidden-accessible p-hidden-focusable' hiddenLastFocusableEl: 'p-hidden-accessible p-hidden-focusable'
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_dropdown_style', manual: true }); const { load: loadStyle } = useStyle(styles, { id: 'primevue_dropdown_style', manual: true });
export default { export default {
name: 'BaseDropdown', name: 'BaseDropdown',
@ -310,15 +310,13 @@ export default {
}, },
css: { css: {
inlineStyles, inlineStyles,
classes classes,
loadStyle
}, },
watch: { provide() {
isUnstyled: { return {
immediate: true, $parentInstance: this
handler(newValue) { };
!newValue && loadStyle();
}
}
} }
}; };
</script> </script>

View File

@ -38,7 +38,7 @@ const classes = {
content: 'p-fieldset-content' content: 'p-fieldset-content'
}; };
const { load: loadStyle, unload: unloadStyle } = useStyle(styles, { id: 'primevue_fieldset_style', manual: true }); const { load: loadStyle } = useStyle(styles, { id: 'primevue_fieldset_style', manual: true });
export default { export default {
name: 'BaseFieldset', name: 'BaseFieldset',
@ -53,15 +53,13 @@ export default {
} }
}, },
css: { css: {
classes classes,
loadStyle
}, },
watch: { provide() {
isUnstyled: { return {
immediate: true, $parentInstance: this
handler(newValue) { };
!newValue && loadStyle();
}
}
} }
}; };
</script> </script>