Skip to content

Commit 555b744

Browse files
committed
feat: quasarframework#29 Draft for Datepicker component
1 parent 89a61af commit 555b744

File tree

13 files changed

+821
-2
lines changed

13 files changed

+821
-2
lines changed

build/script.build.javascript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,16 @@ var
2424
include: ['**/*.svg', '**/*.html']
2525
},
2626
external = [
27-
'jquery',
2827
'fastclick',
2928
'hammerjs',
29+
'moment',
3030
'velocity-animate',
3131
'velocity-animate/velocity.ui'
3232
],
3333
globals = {
3434
fastclick: 'FastClick',
3535
hammerjs: 'Hammer',
36+
moment: 'moment',
3637
'velocity-animate': 'Velocity',
3738
'velocity-animate/velocity.ui': 'velui'
3839
},

dev/views/form.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
<template>
22

3+
<p class="caption">Date</p>
4+
<quasar-datetime :model.sync="timestamp" type="date"></quasar-datetime>
5+
<br>
6+
<quasar-inline-datetime :model.sync="timestamp" type="date"></quasar-inline-datetime>
7+
<p class="caption">Time</p>
8+
<quasar-datetime :model.sync="timestamp" type="time"></quasar-datetime>
9+
<br>
10+
<quasar-inline-datetime :model.sync="timestamp" type="time"></quasar-inline-datetime>
11+
<p class="caption">Datetime</p>
12+
<quasar-datetime :model.sync="timestamp" type="datetime"></quasar-datetime>
13+
<br>
14+
<quasar-inline-datetime :model.sync="timestamp" type="datetime"></quasar-inline-datetime>
15+
16+
<div style="height: 50px">&nbsp;</div>
317
<div style="border: 1px solid black">
418
<input v-model="text">
519
<input v-model="text" :disabled="true">
@@ -353,7 +367,8 @@ export default {
353367
text: '',
354368
multiline: '',
355369
number: 64,
356-
number2: 44
370+
number2: 44,
371+
timestamp: '2004-02-01T20:45:00.000Z'
357372
}
358373
}
359374
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
"peerDependencies": {
123123
"fastclick": "^1.0.6",
124124
"hammerjs": "^2.0.8",
125+
"moment": "^2.14.1",
125126
"velocity-animate": "^1.2.3",
126127
"vue": "^1.0.26",
127128
"vue-touch": "^1.1.0"

src/components/modal/modal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class Modal {
8787
this.$backdrop.addEventListener('click', this.close)
8888
}
8989

90+
document.body.classList.add('with-modal')
91+
9092
let
9193
effect,
9294
options = {
@@ -144,6 +146,7 @@ class Modal {
144146
duration,
145147
complete: () => {
146148
this.$el.classList.add('hidden')
149+
document.body.classList.remove('with-modal')
147150

148151
if (this.selfDestroy) {
149152
this.destroy()

src/components/modal/modal.mat.styl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ $modal-slim-body-padding ?= 0 24px
1717
$modal-scroll-size ?= 240px
1818
$modal-buttons-padding ?= 8px 8px 12px 24px
1919

20+
body.with-modal
21+
overflow hidden !important
2022

2123
minimized-modal()
2224
max-width 80vw

src/install.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ import Checkbox from './vue-components/checkbox/checkbox.vue'
1616
import Chips from './vue-components/chips/chips.vue'
1717
import ContextMenuDesktop from './vue-components/context-menu/context-menu-desktop.vue'
1818
import ContextMenuMobile from './vue-components/context-menu/context-menu-mobile.vue'
19+
import Datetime from './vue-components/datetime/datetime.vue'
20+
import DesktopDatetime from './vue-components/datetime/datetime-desktop.vue'
21+
import InlineDatetime from './vue-components/datetime/inline-datetime.vue'
1922
import Drawer from './vue-components/drawer/drawer.vue'
2023
import DrawerLink from './vue-components/drawer/drawer-link.vue'
2124
import Fab from './vue-components/fab/fab.vue'
@@ -72,6 +75,8 @@ function registerComponents (_Vue) {
7275
_Vue.component('quasar-checkbox', Checkbox)
7376
_Vue.component('quasar-chips', Chips)
7477
_Vue.component('quasar-context-menu', Platform.is.desktop ? ContextMenuDesktop : ContextMenuMobile)
78+
_Vue.component('quasar-datetime', Platform.is.desktop ? DesktopDatetime : Datetime)
79+
_Vue.component('quasar-inline-datetime', InlineDatetime)
7580
_Vue.component('quasar-drawer', Drawer)
7681
_Vue.component('quasar-drawer-link', DrawerLink)
7782
_Vue.component('quasar-fab', Fab)

src/themes/core/orientation.styl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,21 @@
2828
transform rotate(0deg)
2929
100%
3030
transform rotate(359deg)
31+
32+
@keyframes quasar-pop-in
33+
0%
34+
opacity 0
35+
transform scale(.7)
36+
70%
37+
opacity 1
38+
transform scale(1.07)
39+
100%
40+
transform scale(1)
41+
42+
@keyframes quasar-scale-in
43+
0%
44+
opacity 0
45+
transform scale(.7)
46+
100%
47+
opacity 1
48+
transform scale(1)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<template>
2+
<div class="quasar-datetime-desktop">
3+
<quasar-popover v-ref:popover :disabled="disabled">
4+
<div slot="target" class="cursor-pointer textfield" :class="{disabled: disabled}">
5+
<span>{{{ label }}}</span>
6+
<span class="float-right quasar-select-arrow">&#8675</span>
7+
</div>
8+
9+
<quasar-inline-datetime :model.sync="model" :type="type"></quasar-inline-datetime>
10+
</quasar-popover>
11+
</div>
12+
</template>
13+
14+
<script>
15+
import moment from 'moment'
16+
17+
export default {
18+
props: {
19+
type: {
20+
type: String,
21+
default: 'date',
22+
twoWay: true
23+
},
24+
model: {
25+
type: String,
26+
required: true
27+
},
28+
format: {
29+
type: String
30+
},
31+
okLabel: {
32+
type: String,
33+
default: 'Set'
34+
},
35+
cancelLabel: {
36+
type: String,
37+
default: 'Cancel'
38+
},
39+
disabled: {
40+
type: Boolean,
41+
default: false,
42+
coerce: Boolean
43+
}
44+
},
45+
computed: {
46+
label () {
47+
let format
48+
49+
if (this.format) {
50+
format = this.format
51+
}
52+
else if (this.type === 'date') {
53+
format = 'YYYY-MM-DD'
54+
}
55+
else if (this.type === 'time') {
56+
format = 'HH:mm'
57+
}
58+
else {
59+
format = 'YYYY-MM-DD HH:mm:ss'
60+
}
61+
62+
return moment(this.model).format(format)
63+
}
64+
}
65+
}
66+
</script>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<div>
3+
<quasar-inline-datetime :model.sync="model" :type="type">
4+
<div class="modal-buttons row full-width">
5+
<button @click="close()" class="primary clear">{{ cancelLabel }}</button>
6+
<button @click="set(model)" class="primary clear">{{ okLabel }}</button>
7+
</div>
8+
</quasar-inline-datetime>
9+
</div>
10+
</template>
11+
12+
<script>
13+
export default {
14+
methods: {}
15+
}
16+
</script>

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

Whitespace-only changes.

0 commit comments

Comments
 (0)