Skip to content

Commit

Permalink
feat(QSelect): add class for wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
raha-frontend committed Jun 29, 2022
1 parent 12d1a29 commit c5cb34a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/qComponents/QSelect/src/QSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div
ref="root"
class="q-select"
:class="qSelectClasses"
@click="toggleMenu"
@mouseenter="state.hover = true"
@mouseleave="state.hover = false"
Expand Down Expand Up @@ -122,7 +123,12 @@ import type { QFormItemProvider } from '@/qComponents/QFormItem';
import type { QInputInstance } from '@/qComponents/QInput';
import type { QOptionModel, QOptionPropValue } from '@/qComponents/QOption';
import type { Nullable, Optional, UnwrappedInstance } from '#/helpers';
import type {
Nullable,
Optional,
UnwrappedInstance,
ClassValue
} from '#/helpers';
import QSelectDropdown from './components/QSelectDropdown';
import type { QSelectDropdownInstance } from './components/QSelectDropdown';
Expand Down Expand Up @@ -464,6 +470,10 @@ export default defineComponent({
);
});
const qSelectClasses = computed<ClassValue>(() => ({
'q-select__disabled': isDisabled.value
}));
const iconClass = computed<string>(() => {
if (props.remote && props.filterable) return 'q-icon-search';
return state.isDropdownShown
Expand Down Expand Up @@ -944,6 +954,7 @@ export default defineComponent({
isReadonly,
isDisabled,
isClearBtnShown,
qSelectClasses,
iconClass,
emptyText,
isNewOptionShown,
Expand Down
3 changes: 2 additions & 1 deletion src/qComponents/QSelect/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Ref, ComputedRef } from 'vue';
import type { QInputInstance } from '@/qComponents/QInput';
import type { QOptionModel, QOptionPropValue } from '@/qComponents/QOption';

import type { Nullable, UnwrappedInstance } from '#/helpers';
import type { Nullable, UnwrappedInstance, ClassValue } from '#/helpers';

import type { QSelectDropdownInstance } from './components/QSelectDropdown';
import type { QSelectTagsInstance } from './components/QSelectTags';
Expand Down Expand Up @@ -76,6 +76,7 @@ export interface QSelectInstance {
isReadonly: ComputedRef<Nullable<boolean>>;
isDisabled: ComputedRef<boolean>;
isClearBtnShown: ComputedRef<Nullable<boolean>>;
qSelectClasses: ComputedRef<ClassValue>;
iconClass: ComputedRef<string>;
emptyText: ComputedRef<string>;
isNewOptionShown: ComputedRef<boolean>;
Expand Down

0 comments on commit c5cb34a

Please sign in to comment.