InputStyle and Ripple usage fixes on configurator

pull/3841/head
Tuğçe Küçükoğlu 2023-03-29 13:29:26 +03:00
parent a2993e1bdf
commit 693c27d1e7
2 changed files with 29 additions and 17 deletions

View File

@ -15,11 +15,11 @@
<h3>Input Style</h3> <h3>Input Style</h3>
<div class="flex gap-5"> <div class="flex gap-5">
<div class="flex align-items-center gap-2"> <div class="flex align-items-center gap-2">
<RadioButton v-model="inputStyle" name="inputStyle" value="outlined" inputId="outlined_input"></RadioButton> <RadioButton :modelValue="inputStyle" name="inputStyle" value="outlined" inputId="outlined_input" @update:modelValue="onInputStyleChange"></RadioButton>
<label for="outlined_input">Outlined</label> <label for="outlined_input">Outlined</label>
</div> </div>
<div class="flex align-items-center gap-2"> <div class="flex align-items-center gap-2">
<RadioButton v-model="inputStyle" name="inputStyle" value="filled" inputId="filled_input"></RadioButton> <RadioButton :modelValue="inputStyle" name="inputStyle" value="filled" inputId="filled_input" @update:modelValue="onInputStyleChange"></RadioButton>
<label for="filled_input">Filled</label> <label for="filled_input">Filled</label>
</div> </div>
</div> </div>
@ -27,7 +27,7 @@
<section class="mb-5"> <section class="mb-5">
<h3>Ripple Effect</h3> <h3>Ripple Effect</h3>
<InputSwitch v-model="ripple" /> <InputSwitch :modelValue="rippleActive" @update:modelValue="onRippleChange" />
</section> </section>
<section> <section>
@ -312,28 +312,23 @@
import EventBus from '@/layouts/AppEventBus'; import EventBus from '@/layouts/AppEventBus';
export default { export default {
emits: ['update:modelValue'], emits: ['updateConfigActive'],
props: { props: {
modelValue: Boolean configActive: {
type: Boolean,
default: false
}
}, },
data() { data() {
return { return {
visible: false, visible: false,
scale: 14, scale: 14,
scales: [12, 13, 14, 15, 16], scales: [12, 13, 14, 15, 16]
inputStyle: 'outlined',
ripple: true
}; };
}, },
watch: { watch: {
modelValue(value) { configActive(value) {
this.visible = value; this.visible = value;
},
inputStyle(value) {
this.$primevue.config.inputStyle = value;
},
ripple(value) {
this.$primevue.config.ripple = value;
} }
}, },
outsideClickListener: null, outsideClickListener: null,
@ -354,7 +349,7 @@ export default {
methods: { methods: {
onSidebarHide() { onSidebarHide() {
this.visible = false; this.visible = false;
this.$emit('update:modelValue', false); this.$emit('updateConfigActive', false);
}, },
changeTheme(theme, dark) { changeTheme(theme, dark) {
EventBus.emit('theme-change', { theme: theme, dark: dark }); EventBus.emit('theme-change', { theme: theme, dark: dark });
@ -369,6 +364,20 @@ export default {
}, },
applyScale() { applyScale() {
document.documentElement.style.fontSize = this.scale + 'px'; document.documentElement.style.fontSize = this.scale + 'px';
},
onInputStyleChange(value) {
this.$primevue.config.inputStyle = value;
},
onRippleChange(value) {
this.$primevue.config.ripple = value;
}
},
computed: {
inputStyle() {
return this.$primevue.config.inputStyle;
},
rippleActive() {
return this.$primevue.config.ripple;
} }
} }
}; };

View File

@ -3,7 +3,7 @@
<app-news v-if="$appState.newsActive" /> <app-news v-if="$appState.newsActive" />
<app-topbar @menubutton-click="onMenuButtonClick" @configbutton-click="onConfigButtonClick" /> <app-topbar @menubutton-click="onMenuButtonClick" @configbutton-click="onConfigButtonClick" />
<app-menu :active="sidebarActive" /> <app-menu :active="sidebarActive" />
<app-configurator v-model="appConfigActive" /> <app-configurator :configActive="appConfigActive" @updateConfigActive="onUpdateConfigActive" />
<div :class="['layout-mask', { 'layout-mask-active': sidebarActive }]" @click="onMaskClick"></div> <div :class="['layout-mask', { 'layout-mask-active': sidebarActive }]" @click="onMaskClick"></div>
<div class="layout-content"> <div class="layout-content">
<div class="layout-content-inner"> <div class="layout-content-inner">
@ -107,6 +107,9 @@ export default {
}, },
onConfigButtonClick() { onConfigButtonClick() {
this.appConfigActive = true; this.appConfigActive = true;
},
onUpdateConfigActive() {
this.appConfigActive = false;
} }
}, },
computed: { computed: {