Skip to content

Commit

Permalink
feat(component): improve the inputStyles logic and height style
Browse files Browse the repository at this point in the history
  • Loading branch information
iliyaZelenko committed Apr 6, 2019
1 parent e9127ff commit 1aeb01d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
- validation
- support on mobile devices
- disabled and readonly
- the ability to set the size of the field and other styles
- TypeScript support

Write your suggestions, glad to add.

Expand Down
10 changes: 9 additions & 1 deletion gh-pages-src/pages/dev/Example6.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
<div class="demo-page-wrap">
<div>
<cool-select
ref="select"
v-model="selected"
:items="items"
:style="{
height: '50px'
}"
placeholder="Select name"
/>

<cool-select
v-model="selected"
:items="items"
placeholder="Select name"
Expand Down
24 changes: 13 additions & 11 deletions src/component.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@

<input
ref="IZ-select__input-for-text"
v-bind="inputElCustomAttributes"
:value="inputValue"
:placeholder="placeholder"
:style="inputForTextStyles"
:class="inputForTextClass"
:disabled="disableSearch || disabled"
:readonly="readonly"
:tabindex="disableSearch ? -1 : 0"
type="text"
role="combobox"
autocomplete="off"
v-bind="{
value: inputValue,
placeholder,
class: inputForTextClass,
disabled: disableSearch || disabled,
readonly,
tabindex: disableSearch ? -1 : 0,
type: 'text',
role: 'combobox',
autocomplete: 'off',
...inputElCustomAttributes,
style: inputForTextStyles,
}"
@keyup="onSearchKeyUp"
@keydown="onSearchKeyDown"
@input="onSearch"
Expand Down
12 changes: 9 additions & 3 deletions src/computed.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ export default {
return this.$scopedSlots.selection && this.selectedItem && !this.getSearchData()
},
inputForTextStyles () {
let styles = {}

if (this.loading) {
return {
'background-image': `url(${this.loadingIndicator})`
styles['background-image'] = `url(${this.loadingIndicator})`
}
if (this.inputElCustomAttributes) {
styles = {
...styles,
...this.inputElCustomAttributes
}
}

return {}
return styles
},
hasMenu () {
return this.wishShowMenu && !this.loading // this.focused && !this.loading
Expand Down
8 changes: 8 additions & 0 deletions src/styles/common/main.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
.IZ-select__input-wrap
display: flex
align-items: center
height: 100%

.IZ-select__input
height: 100%;

input
height: 100%;

.fade
&-leave-active
Expand All @@ -16,3 +23,4 @@
&-enter, &-leave-to
opacity: 0


0 comments on commit 1aeb01d

Please sign in to comment.