From 021f7f23d5113e8d28914b0b1852e29a7a264a14 Mon Sep 17 00:00:00 2001 From: Cagatay Civici Date: Thu, 1 Feb 2024 16:11:24 +0300 Subject: [PATCH] Refactor on input filled and global usage --- components/lib/calendar/BaseCalendar.vue | 2 +- components/lib/calendar/style/CalendarStyle.js | 4 +--- components/lib/config/PrimeVue.d.ts | 2 +- components/lib/config/PrimeVue.js | 2 +- components/lib/inputtext/BaseInputText.vue | 2 +- components/lib/inputtext/style/InputTextStyle.js | 2 +- layouts/default.vue | 1 - 7 files changed, 6 insertions(+), 9 deletions(-) diff --git a/components/lib/calendar/BaseCalendar.vue b/components/lib/calendar/BaseCalendar.vue index 668a3ef28..6b0e7940f 100644 --- a/components/lib/calendar/BaseCalendar.vue +++ b/components/lib/calendar/BaseCalendar.vue @@ -178,7 +178,7 @@ export default { }, variant: { type: String, - default: 'outlined' + default: null }, invalid: { type: Boolean, diff --git a/components/lib/calendar/style/CalendarStyle.js b/components/lib/calendar/style/CalendarStyle.js index 7691ad1ca..79fcbb639 100644 --- a/components/lib/calendar/style/CalendarStyle.js +++ b/components/lib/calendar/style/CalendarStyle.js @@ -167,13 +167,12 @@ const classes = { 'p-calendar-timeonly': props.timeOnly, 'p-calendar-disabled': props.disabled, 'p-invalid': props.invalid, - 'p-variant-filled': props.variant === 'filled', 'p-inputwrapper-filled': props.modelValue, 'p-inputwrapper-focus': state.focused, 'p-focus': state.focused || state.overlayVisible } ], - input: 'p-inputtext p-component', + input: ({ props }) => ['p-inputtext p-component', { 'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled' }], dropdownButton: 'p-datepicker-trigger', inputIcon: 'p-datepicker-trigger-icon', panel: ({ instance, props, state }) => [ @@ -187,7 +186,6 @@ const classes = { 'p-datepicker-monthpicker': state.currentView === 'month', 'p-datepicker-yearpicker': state.currentView === 'year', 'p-datepicker-touch-ui': props.touchUI, - 'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled', 'p-ripple-disabled': instance.$primevue.config.ripple === false } ], diff --git a/components/lib/config/PrimeVue.d.ts b/components/lib/config/PrimeVue.d.ts index 7f466e1a3..0838a0b33 100644 --- a/components/lib/config/PrimeVue.d.ts +++ b/components/lib/config/PrimeVue.d.ts @@ -99,7 +99,7 @@ import { VirtualScrollerPassThroughOptions } from '../virtualscroller'; export interface PrimeVueConfiguration { ripple?: boolean; - inputStyle?: string; + inputStyle?: 'filled' | 'outlined' | undefined; locale?: PrimeVueLocaleOptions; filterMatchModeOptions?: any; zIndex?: PrimeVueZIndexOptions; diff --git a/components/lib/config/PrimeVue.js b/components/lib/config/PrimeVue.js index d0daa7d23..3e0fcd8f2 100644 --- a/components/lib/config/PrimeVue.js +++ b/components/lib/config/PrimeVue.js @@ -3,7 +3,7 @@ import { inject, reactive } from 'vue'; export const defaultOptions = { ripple: false, - inputStyle: 'outlined', + inputStyle: null, locale: { startsWith: 'Starts with', contains: 'Contains', diff --git a/components/lib/inputtext/BaseInputText.vue b/components/lib/inputtext/BaseInputText.vue index ac94e0904..829614580 100644 --- a/components/lib/inputtext/BaseInputText.vue +++ b/components/lib/inputtext/BaseInputText.vue @@ -17,7 +17,7 @@ export default { }, variant: { type: String, - default: 'outlined' + default: null } }, style: InputTextStyle, diff --git a/components/lib/inputtext/style/InputTextStyle.js b/components/lib/inputtext/style/InputTextStyle.js index e0924c4b4..fe713e5a2 100644 --- a/components/lib/inputtext/style/InputTextStyle.js +++ b/components/lib/inputtext/style/InputTextStyle.js @@ -8,7 +8,7 @@ const classes = { 'p-inputtext-sm': props.size === 'small', 'p-inputtext-lg': props.size === 'large', 'p-invalid': props.invalid, - 'p-variant-filled': props.variant === 'filled' + 'p-variant-filled': props.variant ? props.variant === 'filled' : instance.$primevue.config.inputStyle === 'filled' } ] }; diff --git a/layouts/default.vue b/layouts/default.vue index cc1312595..2d4f483c3 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -120,7 +120,6 @@ export default { return [ { 'layout-news-active': this.$appState.newsActive, - 'p-input-filled': this.$primevue.config.inputStyle === 'filled', 'p-ripple-disabled': this.$appState.ripple === false, 'layout-dark': this.$appState.darkTheme, 'layout-light': !this.$appState.darkTheme