Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added noScrollEvent prop for TimePicker #207

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Here is an example of UMD implementation: https://codepen.io/louismazel/pen/jQWN
| no-keyboard (12) | Boolean | no | false |
| right (13) | Boolean | no | false |
| noClearButton | Boolean | no | false |
| noScrollEvent (14) | Boolean | no | false |

(1) hint : Is a text that replaces the label/placeholder (Ex : Error designation)

Expand Down Expand Up @@ -189,6 +190,8 @@ When you set `isSelected` to true, the shortcut is selected by default

(13) right : add this attribute to align the picker on right

(14) noScrollEvent : Set this to `true` if you don't want the time picker to auto-select a time after scrolling

# Events API

| Event | Return |
Expand Down
2 changes: 1 addition & 1 deletion docs/css/app.055a816d.css → docs/css/app.1af1da25.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><link rel=icon href=favicon.ico><title>vue-ctk-date-time-picker</title><link href=css/app.055a816d.css rel=preload as=style><link href=js/app.2e8e2ac8.js rel=preload as=script><link href=js/chunk-vendors.ee611b34.js rel=preload as=script><link href=css/app.055a816d.css rel=stylesheet></head><body><noscript><strong>We're sorry but vue-ctk-date-time-picker doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.ee611b34.js></script><script src=js/app.2e8e2ac8.js></script></body></html>
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"><link rel=icon href=favicon.ico><title>vue-ctk-date-time-picker</title><link href=css/app.1af1da25.css rel=preload as=style><link href=js/app.e5c714b8.js rel=preload as=script><link href=js/chunk-vendors.ee611b34.js rel=preload as=script><link href=css/app.1af1da25.css rel=stylesheet></head><body><noscript><strong>We're sorry but vue-ctk-date-time-picker doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.ee611b34.js></script><script src=js/app.e5c714b8.js></script></body></html>
2 changes: 0 additions & 2 deletions docs/js/app.2e8e2ac8.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/app.2e8e2ac8.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions docs/js/app.e5c714b8.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/js/app.e5c714b8.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
:disabled-weekly="demo.options.disabledWeekly"
:right="demo.options.right"
:no-clear-button="demo.options.noClearButton"
:no-scroll-event="demo.options.noScrollEvent"
>
<input
v-if="demo.options && demo.options.slot && demo.options.slot.type === 'input'"
Expand Down Expand Up @@ -250,7 +251,7 @@
booleanOptions: [
'noHeader', 'autoClose', 'error', 'dark', 'overlay', 'noWeekendDays', 'noShortcuts',
'noButton', 'onlyDate', 'range', 'onlyTime', 'inline', 'persistent', 'disabled', 'noButtonNow', 'noValueToCustomElem',
'noKeyboard', 'right', 'noClearButton', 'noLabel'
'noKeyboard', 'right', 'noClearButton', 'noLabel', 'noScrollEvent'
],
stringOptions: [
'id', 'label', 'hint', 'color', 'buttonColor', 'position', 'format', 'formatted', 'outputFormat',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:ref="column.type"
:class="[`time-picker-column-${column.type}`]"
class="time-picker-column flex-1 flex flex-direction-column text-center"
@scroll="noScrollEvent
@scroll="noScrollEvent || positionViewChanging
? null
: column.type === 'hours' ? onScrollHours($event) : column.type === 'minutes' ? onScrollMinutes($event) : onScrollApms($event)
"
Expand Down Expand Up @@ -102,7 +102,8 @@
dark: { type: Boolean, default: null },
disabledHours: { type: Array, default: () => ([]) },
minTime: { type: String, default: null },
maxTime: { type: String, default: null }
maxTime: { type: String, default: null },
noScrollEvent: { type: Boolean, default: false }
},
data () {
return {
Expand All @@ -111,7 +112,7 @@
apm: null,
oldvalue: this.value,
columnPadding: {},
noScrollEvent: !!(this.value && !this.inline),
positionViewChanging: !!(this.value && !this.inline),
delay: 0
}
},
Expand Down Expand Up @@ -359,7 +360,7 @@
}
},
initPositionView () {
this.noScrollEvent = true
this.positionViewChanging = true
const containers = ['hours', 'minutes']
if (this.apms) containers.push('apms')
setTimeout(() => {
Expand All @@ -376,7 +377,7 @@
}
}
setTimeout(() => {
this.noScrollEvent = false
this.positionViewChanging = false
}, 500)
})
}, 0)
Expand Down
4 changes: 3 additions & 1 deletion src/VueCtkDateTimePicker/_subs/PickersContainer/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
:disabled-hours="disabledHours"
:min-time="minTime"
:max-time="maxTime"
:no-scroll-event="noScrollEvent"
/>
</div>
<ButtonValidate
Expand Down Expand Up @@ -137,7 +138,8 @@
firstDayOfWeek: { type: Number, default: null },
customShortcuts: { type: Array, default: null },
noKeyboard: { type: Boolean, default: false },
right: { type: Boolean, default: false }
right: { type: Boolean, default: false },
noScrollEvent: { type: Boolean, default: false }
},
data () {
return {
Expand Down
1 change: 1 addition & 0 deletions src/VueCtkDateTimePicker/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
:custom-shortcuts="customShortcuts"
:no-keyboard="noKeyboard"
:right="right"
:no-scroll-event="noScrollEvent"
@validate="validate"
@close="toggleDatePicker(false)"
/>
Expand Down
3 changes: 2 additions & 1 deletion src/VueCtkDateTimePicker/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ export default {
noValueToCustomElem: { type: Boolean, default: false },
noKeyboard: { type: Boolean, default: false },
right: { type: Boolean, default: false },
noClearButton: { type: Boolean, default: false }
noClearButton: { type: Boolean, default: false },
noScrollEvent: { type: Boolean, default: false }
}