Skip to content

Commit 73210c4

Browse files
committed
refactor: [vue2] Further fixes for v0.8
1 parent 108b1c0 commit 73210c4

28 files changed

+200
-369
lines changed

src/app-visibility.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function onchange (evt) {
2929
}
3030

3131
appVisibility = state
32-
Events.trigger('app:visibility', state)
32+
Events.$emit('app:visibility', state)
3333
}
3434

3535
Utils.dom.ready(() => {

src/components/action-sheet/ActionSheet.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export default {
161161
},
162162
mounted () {
163163
this.$refs.dialog.open()
164+
this.$root.quasarClose = this.close
164165
},
165166
destroyed () {
166167
if (Utils.dom.has(this.$el)) {

src/components/dialog/Dialog.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
</div>
4949
</label>
5050

51-
<div v-if="el.type === 'range' || el.type === 'double-range'" style="margin-bottom: 10px">
52-
<label v-html="el.label"></label>
51+
<div v-if="el.type === 'range' || el.type === 'double-range'" style="margin-top: 15px; margin-bottom: 10px">
52+
<label v-html="el.label + ' (' + (el.type === 'double-range' ? el.model.min + ' to ' + el.model.max : el.model) + ')'"></label>
5353
<component
5454
:is="'quasar-' + el.type"
5555
v-model="el.model"
@@ -64,7 +64,7 @@
6464

6565
<div v-if="el.type === 'rating'" style="margin-bottom: 10px">
6666
<label v-html="el.label"></label>
67-
<quasar-rating v-model="el.model" :max="el.max" :icon="el.icon"></quasar-rating>
67+
<quasar-rating v-model="el.model" :max="el.max" :icon="el.icon" :style="{fontSize: el.size || '2rem'}"></quasar-rating>
6868
</div>
6969
</template>
7070
</div>
@@ -157,6 +157,7 @@ export default {
157157
},
158158
mounted () {
159159
this.$refs.dialog.open()
160+
this.$root.quasarClose = this.close
160161
},
161162
destroyed () {
162163
if (Utils.dom.has(this.$el)) {

src/components/loading/loading.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function show ({
4040
}, delay)
4141

4242
appIsInProgress = true
43-
Events.trigger('app:loading', true)
43+
Events.$emit('app:loading', true)
4444
}
4545

4646
function hide () {
@@ -60,7 +60,7 @@ function hide () {
6060
}
6161

6262
appIsInProgress = false
63-
Events.trigger('app:loading', false)
63+
Events.$emit('app:loading', false)
6464
}
6565

6666
export default {

src/components/modal-generator.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ export default function (VueComponent) {
66
const node = document.createElement('div')
77
document.body.appendChild(node)
88

9-
/* eslint-disable no-new */
10-
new Vue({
9+
let vm = new Vue({
1110
el: node,
1211
data () {
1312
return {props}
1413
},
1514
render: h => h(VueComponent, {props})
1615
})
16+
17+
return {
18+
close (fn) {
19+
vm.quasarClose(fn)
20+
}
21+
}
1722
}
1823
}
1924
}

src/components/toast/Toast.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default {
9898
this.__show()
9999
},
100100
__show () {
101-
Events.trigger('app:toast', this.stack[0].html)
101+
Events.$emit('app:toast', this.stack[0].html)
102102
103103
this.timer = setTimeout(() => {
104104
if (this.stack.length > 0) {

src/components/toast/toast.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Utils from '../../utils'
2-
import Events from '../../events'
32
import Toast from './Toast.vue'
43

54
let
@@ -23,12 +22,6 @@ let
2322
}
2423
]
2524

26-
Events.on('app:vue-ready', (_Vue) => {
27-
let node = document.createElement('div')
28-
document.body.appendChild(node)
29-
toast = new _Vue(Toast).$mount(node)
30-
})
31-
3225
function create (opts, defaults) {
3326
if (!opts) {
3427
throw new Error('Missing toast options.')
@@ -49,9 +42,16 @@ types.forEach(type => {
4942
create[type.name] = opts => create(opts, type.defaults)
5043
})
5144

45+
export function install (_Vue) {
46+
let node = document.createElement('div')
47+
document.body.appendChild(node)
48+
toast = new _Vue(Toast).$mount(node)
49+
}
50+
5251
export default {
5352
create,
5453
setDefaults (opts) {
5554
toast.setDefaults(opts)
56-
}
55+
},
56+
install
5757
}

src/css-components/list/list.ios.styl

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
$item-primary-secondary-color ?= rgb(117, 117, 117)
2+
$item-content-label-color ?= rgba(0, 0, 0, .87)
3+
$item-label-color ?= rgba(0, 0, 0, .54)
4+
15
.item
2-
color rgba(0, 0, 0, .87)
36
height 48px
47
position relative
58
display block
@@ -18,7 +21,7 @@
1821
background rgba(0, 0, 0, .3)
1922

2023
> .item-primary
21-
color rgb(117, 117, 117)
24+
color $item-primary-secondary-color
2225
> div.item-primary
2326
position absolute
2427
top 0
@@ -45,7 +48,6 @@
4548
line-height 24px
4649
border-radius 50%
4750
> img.item-primary
48-
color rgb(255, 255, 255)
4951
display inline-flex
5052
align-items center
5153
justify-content center
@@ -56,7 +58,6 @@
5658
top 4px
5759
left 16px
5860
user-select none
59-
background-color rgb(188, 188, 188)
6061
&:not(.thumbnail)
6162
border-radius 50%
6263

@@ -69,14 +70,15 @@
6970
margin-left 72px
7071
&.has-secondary
7172
margin-right 72px
72-
> span, > div > span
73-
color rgba(0, 0, 0, .87)
73+
&:not(.no-style)
74+
> span, > div > span
75+
color $item-content-label-color
7476

7577
> .item-primary ~ .item-content
7678
margin-left 72px
7779

7880
> .item-secondary
79-
color rgb(117, 117, 117)
81+
color $item-primary-secondary-color
8082
position absolute
8183
top 0
8284
margin 12px
@@ -124,17 +126,18 @@
124126
padding-top 20px
125127
padding-bottom 16px
126128

127-
> div:not(.stacked-label):not(.floating-label):not([class^='quasar-'])
128-
overflow hidden
129-
text-overflow ellipsis
130-
white-space nowrap
129+
&:not(.no-style)
130+
> div:not(.stacked-label):not(.floating-label):not([class^='quasar-'])
131+
overflow hidden
132+
text-overflow ellipsis
133+
white-space nowrap
131134

132-
> div:not(:first-of-type)
133-
font-size 14px
134-
line-height 16px
135-
height 16px
136-
margin 4px 0 0
137-
color rgba(0, 0, 0, .54)
135+
> div:not(:first-of-type):not([class^='quasar-'])
136+
font-size 14px
137+
line-height 16px
138+
height 16px
139+
margin 4px 0 0
140+
color $item-label-color
138141

139142
&.three-lines
140143
height 88px
@@ -148,24 +151,25 @@
148151
padding-top 16px
149152
padding-bottom 16px
150153

151-
> div:not(.stacked-label):not(.floating-label):not([class^='quasar-'])
152-
overflow hidden
153-
text-overflow ellipsis
154+
&:not(.no-style)
155+
> div:not(.stacked-label):not(.floating-label):not([class^='quasar-'])
156+
overflow hidden
157+
text-overflow ellipsis
154158

155-
> div:first-of-type:not([class^='quasar-'])
156-
white-space nowrap
159+
> div:first-of-type:not([class^='quasar-'])
160+
white-space nowrap
157161

158-
> div:not(:first-of-type)
159-
font-size 14px
160-
line-height 18px
161-
height 36px
162-
margin 4px 0 0
163-
color rgba(0, 0, 0, .54)
164-
overflow hidden
165-
text-overflow ellipsis
166-
display -webkit-box
167-
-webkit-line-clamp 2
168-
-webkit-box-orient vertical
162+
> div:not(:first-of-type):not([class^='quasar-'])
163+
font-size 14px
164+
line-height 18px
165+
height 36px
166+
margin 4px 0 0
167+
color $item-label-color
168+
overflow hidden
169+
text-overflow ellipsis
170+
display -webkit-box
171+
-webkit-line-clamp 2
172+
-webkit-box-orient vertical
169173

170174
&.multiple-lines
171175
height auto
@@ -174,7 +178,7 @@
174178
padding-top 16px
175179

176180
.item-label
177-
color rgba(0, 0, 0, .5) !important
181+
color $item-label-color !important
178182
.item-smaller
179183
font-size 14px
180184

@@ -218,7 +222,7 @@ body.desktop .item.item-link:hover
218222
visibility hidden
219223

220224
.list-label
221-
color rgba(0, 0, 0, .54)
225+
color $item-label-color
222226
font-size 14px
223227
font-weight 500
224228
line-height 48px

0 commit comments

Comments
 (0)