Skip to content

Commit 1abdf8d

Browse files
committed
feat(sizes): changed the idea about different sizes
1 parent a53dfe4 commit 1abdf8d

File tree

7 files changed

+28
-23
lines changed

7 files changed

+28
-23
lines changed

gh-pages-src/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"build-with-deploy": "yarn build && yarn deploy"
1010
},
1111
"dependencies": {
12+
"bootstrap": "^4.3.1",
1213
"vue-analytics": "^5.16.4",
1314
"vuetify": "2.0.0-alpha.9"
1415
},

gh-pages-src/pages/dev/Example6.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
>
2626
</v-flex>
2727
<v-flex xs6>
28-
{{ selected }}
2928
<!--
3029
<cool-select
3130
v-model="selected"
@@ -41,7 +40,7 @@
4140
v-model="selected"
4241
:items="items"
4342
placeholder="lg"
44-
size-lg
43+
size="lg"
4544
/>
4645

4746
<br>
@@ -54,11 +53,13 @@
5453

5554
<br>
5655

56+
<!-- TODO вместо size-* использовать size="size-name" -->
57+
5758
<cool-select
5859
v-model="selected"
5960
:items="items"
6061
placeholder="sm"
61-
size-sm
62+
size="sm"
6263
/>
6364
</v-flex>
6465
</v-layout>
@@ -67,6 +68,7 @@
6768

6869
<script>
6970
import { CoolSelect } from '../../main'
71+
import 'bootstrap/dist/css/bootstrap.min.css'
7072
7173
const initSeconds = 5
7274

gh-pages-src/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
resolved "https://registry.yarnpkg.com/@mdi/font/-/font-3.5.95.tgz#422d1982566b4a0577b457cd0acc2168ee8343c3"
88
integrity sha512-WHSJ0TJ70qkn+EPsW9w22pQU+kjEnRZlfN4N7xsFFmKa6VhpdQcwTWqj9PDH3oq6Be2p0IW/VDURJvPWDnBAUw==
99

10+
bootstrap@^4.3.1:
11+
version "4.3.1"
12+
resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-4.3.1.tgz#280ca8f610504d99d7b6b4bfc4b68cec601704ac"
13+
integrity sha512-rXqOmH1VilAt2DyPzluTi2blhk17bO7ef+zLLPlWvG494pDxcM234pJ8wTc/6R40UWizAIIMgxjvxZg5kmsbag==
14+
1015
vue-analytics@^5.16.4:
1116
version "5.16.4"
1217
resolved "https://registry.yarnpkg.com/vue-analytics/-/vue-analytics-5.16.4.tgz#7f9e197cbc64afac96884a05214b17efaf8e9d09"

src/component.vue

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
:tabindex="disableSearch ? 0 : -1"
55
:class="{
66
'IZ-select': true,
7-
'IZ-select--sm': sizeSm,
8-
'IZ-select--lg': sizeLg
7+
'IZ-select--sm': size === SIZES.SMALL,
8+
'IZ-select--lg': size === SIZES.LARGE
99
}"
1010
@keydown.up="onSelectByArrow"
1111
@keydown.down="onSelectByArrow"
@@ -167,6 +167,7 @@ import { isObject, getOffsetSum } from './helpers'
167167
import eventsListeners from './eventsListeners'
168168
import props from './props'
169169
import computed from './computed'
170+
import { SIZES } from '~/constants'
170171
171172
export default {
172173
name: 'VueSelect',
@@ -178,6 +179,7 @@ export default {
178179
props,
179180
data () {
180181
return {
182+
SIZES,
181183
wishShowMenu: false,
182184
arrowsIndex: null,
183185
focused: false,
@@ -252,13 +254,6 @@ export default {
252254
this.setInputFocused()
253255
}
254256
255-
// scroll to component input el
256-
// this.$refs['IZ-select__input'].scrollIntoView({
257-
// behavior: 'smooth',
258-
// // to top or bottom border
259-
// block: this.isMobile ? 'start' : 'end'
260-
// })
261-
262257
if (window.scrollTo && this.allowMobileScroll && this.isMobile) {
263258
const { top } = getOffsetSum(this.$refs['IZ-select__input'])
264259

src/computed.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ export default {
2929
if (this.loading) {
3030
styles['background-image'] = `url(${this.loadingIndicator})`
3131
}
32-
if (this.inputElCustomAttributes) {
32+
if (this.inputElCustomAttributes && this.inputElCustomAttributes.style) {
3333
styles = {
3434
...styles,
35-
...this.inputElCustomAttributes
35+
...this.inputElCustomAttributes.style
3636
}
3737
}
3838

src/constants.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const SIZES = {
2+
DEFAULT: 'default',
3+
SMALL: 'sm',
4+
LARGE: 'lg'
5+
}

src/props.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { SIZES } from './constants'
2+
13
export default {
24
value: {
35
type: [Array, Object, String, Number, Boolean], // TODO set to null (any type) after issue fix
@@ -142,14 +144,9 @@ export default {
142144
default: false,
143145
note: 'does the component have a successful state. If true, then apply green colors.'
144146
},
145-
sizeSm: {
146-
type: Boolean,
147-
default: false,
148-
note: 'sets a small size'
149-
},
150-
sizeLg: {
151-
type: Boolean,
152-
default: false,
153-
note: 'sets a large size'
147+
size: {
148+
type: String,
149+
default: SIZES.DEFAULT,
150+
note: 'sets size'
154151
}
155152
}

0 commit comments

Comments
 (0)