Skip to content

Commit 0143348

Browse files
committed
fix: [vue2] Final fixes for v0.8
1 parent 14a4bd5 commit 0143348

File tree

11 files changed

+77
-58
lines changed

11 files changed

+77
-58
lines changed

build/script.build.javascript.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ var
3131
'fastclick',
3232
'hammerjs',
3333
'moment',
34-
'velocity-animate',
35-
'velocity-animate/velocity.ui'
34+
'velocity-animate'
3635
],
3736
globals = {
3837
fastclick: 'FastClick',
3938
hammerjs: 'Hammer',
4039
moment: 'moment',
41-
'velocity-animate': 'Velocity',
42-
'velocity-animate/velocity.ui': 'velui'
40+
'velocity-animate': 'Velocity'
4341
},
4442
rollupConfig = {
4543
entry: 'src/index.js',

src/components/dialog/Dialog.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
</div>
4949
</label>
5050

51+
<!--
5152
<div v-if="el.type === 'range' || el.type === 'double-range'" style="margin-top: 15px; margin-bottom: 10px">
5253
<label v-html="el.label + ' (' + (el.type === 'double-range' ? el.model.min + ' to ' + el.model.max : el.model) + ')'"></label>
5354
<component
@@ -61,6 +62,7 @@
6162
:snap="el.snap"
6263
></component>
6364
</div>
65+
-->
6466

6567
<div v-if="el.type === 'rating'" style="margin-bottom: 10px">
6668
<label v-html="el.label"></label>

src/index.es6.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Velocity from 'velocity-animate'
22
window.Velocity = Velocity
3-
import 'velocity-animate/velocity.ui'
43

54
import install from './install'
65
import start from './start'

src/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Velocity from 'velocity-animate'
22
window.Velocity = Velocity
3-
import 'velocity-animate/velocity.ui'
43

54
import install from './install'
65
import start from './start'

src/themes/core/normalize.styl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,10 @@ input[type='search']
152152
input[type='search']::-webkit-search-cancel-button,
153153
input[type='search']::-webkit-search-decoration
154154
-webkit-appearance none
155+
156+
/*
157+
* Remove browser controller for input type="number"
158+
*/
159+
input::-webkit-outer-spin-button,
160+
input::-webkit-inner-spin-button
161+
-webkit-appearance none

src/vue-components/drawer/Drawer.vue

Lines changed: 58 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ const
3333
backdropOpacity = {
3434
mat: 0.7,
3535
ios: 0.2
36-
},
37-
appContainer = document.getElementById('quasar-app')
36+
}
3837
3938
function getCurrentPosition (node) {
4039
let transform = Utils.dom.style(node, 'transform')
41-
return transform !== 'none' ? parseInt(transform.split(/[()]/)[1].split(', ')[4], 10) : 0
40+
return transform && transform !== 'none' ? parseInt(transform.split(/[()]/)[1].split(', ')[4], 10) : 0
4241
}
4342
4443
function getBetween (value, min, max) {
@@ -69,14 +68,22 @@ export default {
6968
node = this.$refs.content,
7069
backdrop = this.$refs.backdrop,
7170
currentPosition = getCurrentPosition(node),
72-
closePosition = (this.rightSide ? 1 : -1) * this.width
71+
closePosition = (this.rightSide ? 1 : -1) * this.width,
72+
animationNeeded = this.opened || (!this.opened && percentage !== 0),
73+
complete = () => {
74+
if (!this.opened) {
75+
backdrop.classList.remove('active')
76+
}
77+
else {
78+
window.addEventListener('resize', this.close)
79+
}
80+
if (typeof done === 'function') {
81+
done()
82+
}
83+
}
7384
7485
Velocity(node, 'stop')
75-
Velocity(
76-
node,
77-
{translateX: this.opened ? [0, currentPosition] : [closePosition, currentPosition]},
78-
{duration: !this.opened || currentPosition !== 0 ? drawerAnimationSpeed : 0}
79-
)
86+
Velocity(backdrop, 'stop')
8087
8188
if (this.opened) {
8289
backdrop.classList.add('active')
@@ -101,7 +108,16 @@ export default {
101108
}
102109
}
103110
104-
Velocity(backdrop, 'stop')
111+
if (!animationNeeded) {
112+
complete()
113+
return
114+
}
115+
116+
Velocity(
117+
node,
118+
{translateX: this.opened ? [0, currentPosition] : [closePosition, currentPosition]},
119+
{duration: !this.opened || currentPosition !== 0 ? drawerAnimationSpeed : 0}
120+
)
105121
Velocity(
106122
backdrop,
107123
{
@@ -110,17 +126,7 @@ export default {
110126
},
111127
{
112128
duration: drawerAnimationSpeed,
113-
complete: () => {
114-
if (!this.opened) {
115-
backdrop.classList.remove('active')
116-
}
117-
else {
118-
window.addEventListener('resize', this.close)
119-
}
120-
if (typeof done === 'function') {
121-
done()
122-
}
123-
}
129+
complete
124130
}
125131
)
126132
},
@@ -152,16 +158,34 @@ export default {
152158
}
153159
154160
let
155-
currentPosition = getCurrentPosition(appContainer),
156-
openPosition = (this.rightSide ? -1 : 1) * this.width
161+
currentPosition = getCurrentPosition(this.layoutContainer),
162+
openPosition = (this.rightSide ? -1 : 1) * this.width,
163+
animationNeeded = this.opened || (!this.opened && percentage !== 0),
164+
complete = () => {
165+
if (!this.opened) {
166+
backdrop.classList.remove('active')
167+
document.body.classList.remove('drawer-opened')
168+
}
169+
else {
170+
window.addEventListener('resize', this.close)
171+
}
172+
if (typeof done === 'function') {
173+
done()
174+
}
175+
}
176+
177+
Velocity(this.layoutContainer, 'stop')
178+
Velocity(backdrop, 'stop')
157179
158-
Velocity(appContainer, 'stop')
159-
Velocity(appContainer,
180+
if (!animationNeeded) {
181+
complete()
182+
return
183+
}
184+
185+
Velocity(this.layoutContainer,
160186
{translateX: this.opened ? [openPosition, currentPosition] : [0, currentPosition]},
161187
{duration: !this.opened || currentPosition !== openPosition ? drawerAnimationSpeed : 0}
162188
)
163-
164-
Velocity(backdrop, 'stop')
165189
Velocity(
166190
backdrop,
167191
{
@@ -170,18 +194,7 @@ export default {
170194
},
171195
{
172196
duration: drawerAnimationSpeed,
173-
complete: () => {
174-
if (!this.opened) {
175-
backdrop.classList.remove('active')
176-
document.body.classList.remove('drawer-opened')
177-
}
178-
else {
179-
window.addEventListener('resize', this.close)
180-
}
181-
if (typeof done === 'function') {
182-
done()
183-
}
184-
}
197+
complete
185198
}
186199
)
187200
},
@@ -208,7 +221,7 @@ export default {
208221
position = Math.min(position, this.width)
209222
percentage = 1.0 - (this.width - Math.abs(position)) / this.width
210223
fn = this.__iosToggleAnimate
211-
target = appContainer
224+
target = this.layoutContainer
212225
position = (this.rightSide ? -1 : 1) * position
213226
}
214227
else { // mat
@@ -251,7 +264,7 @@ export default {
251264
position = initialPosition + position
252265
percentage = (this.rightSide ? -1 : 1) * position / this.width
253266
fn = this.__iosToggleAnimate
254-
target = appContainer
267+
target = this.layoutContainer
255268
}
256269
else { // mat
257270
percentage = 1 + (this.rightSide ? -1 : 1) * position / this.width
@@ -304,6 +317,10 @@ export default {
304317
this.$nextTick(() => {
305318
const content = this.$refs.content
306319
320+
if (theme.current === 'ios') {
321+
this.layoutContainer = this.$el.closest('.layout') || document.getElementById('quasar-app')
322+
}
323+
307324
this.width = Utils.dom.width(content)
308325
309326
;[].slice.call(content.getElementsByClassName('drawer-closer')).forEach(el => {

src/vue-components/modal/modal.ios.styl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ maximized-modal()
8181
&.quasar-modal-leave-active .modal-content
8282
transform scale(.8)
8383

84+
.modal, .modal-content
85+
transition all .2s ease-in-out
86+
8487
.modal-header
8588
text-align $modal-header-text-align
8689
padding $modal-header-padding

src/vue-components/numeric/Numeric.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<i @click="__setByOffset(-1)">remove</i>
44
<input
55
class="no-style auto quasar-input-field"
6-
type="text"
6+
type="number"
77
v-model.number="model"
88
@blur="__updateValue()"
99
@keydown.enter="__updateValue()"

src/vue-components/pagination/Pagination.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<input
1111
ref="input"
12-
type="text"
12+
type="number"
1313
v-model.number.lazy="newPage"
1414
:style="{width: inputPlaceholder.length * 10 + 'px'}"
1515
:placeholder="inputPlaceholder"

src/vue-directives/go-back.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import Platform from '../platform'
22
import Utils from '../utils'
33

44
export default {
5-
bind (el, { value }, vnode) {
6-
let ctx = { value, position: window.history.length - 1 }
5+
bind (el, { value, modifiers }, vnode) {
6+
let ctx = { value, position: window.history.length - 1, single: modifiers.single }
77

88
if (Platform.is.cordova) {
99
ctx.goBack = () => {
10-
vnode.context.$router.go(ctx.position - window.history.length)
10+
vnode.context.$router.go(ctx.single ? -1 : ctx.position - window.history.length)
1111
}
1212
}
1313
else {

src/web-storage.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ function encode (value) {
1818
if (typeof value === 'function') {
1919
return '__q_strn|' + value.toString()
2020
}
21-
if (Array.isArray(value)) {
22-
return '__q_arra|' + JSON.stringify(value)
23-
}
2421
if (value === Object(value)) {
2522
return '__q_objt|' + JSON.stringify(value)
2623
}
@@ -58,9 +55,6 @@ function decode (value) {
5855
case '__q_strn':
5956
return '' + source
6057

61-
case '__q_arra':
62-
return JSON.parse(source)
63-
6458
case '__q_objt':
6559
return JSON.parse(source)
6660

0 commit comments

Comments
 (0)