This repository was archived by the owner on Apr 17, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +21
-0
lines changed
Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,9 @@ interface Vue3DatePicker {
107107 textInput ?: boolean ;
108108 textInputOptions ?: {
109109 enterSubmit ?: boolean ;
110+ tabSubmit ?: boolean ;
110111 openMenu ?: boolean ;
112+ openMenuOnFocus ?: boolean ;
111113 rangeSeparator ?: string ;
112114 format ?: null ;
113115 } ;
Original file line number Diff line number Diff line change 1111 :value =" inputValue"
1212 @input =" handleInput"
1313 @keydown.enter =" handleEnter"
14+ @keydown.tab =" handleTab"
15+ @focus =" handleFocus"
1416 />
1517 <span class =" dp__input_icon" v-if =" $slots['input-icon'] && !hideInputIcon" ><slot name =" input-icon" /></span >
1618 <CalendarIcon v-if =" !$slots['input-icon'] && !hideInputIcon" class =" dp__input_icon dp__input_icons" />
9496 }
9597 };
9698
99+ const handleTab = (): void => {
100+ if (props .textInputOptions ?.tabSubmit && isValidDate (parsedDate .value )) {
101+ emit (' setInputDate' , parsedDate .value , true );
102+ parsedDate .value = null ;
103+ }
104+ };
105+
106+ const handleFocus = (): void => {
107+ if (props .textInputOptions ?.openMenuOnFocus && ! props .isMenuOpen ) {
108+ emit (' open' );
109+ }
110+ };
111+
97112 const handleOpen = () => {
98113 if (props .textInput && props .textInputOptions ?.openMenu && ! props .isMenuOpen ) {
99114 emit (' open' );
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ export interface TimeGridProps {
5757
5858export interface ITextInputOptions {
5959 enterSubmit : boolean ;
60+ tabSubmit : boolean ;
6061 openMenu : boolean ;
62+ openMenuOnFocus : boolean ;
6163 rangeSeparator : string ;
6264 format ?: null ;
6365}
Original file line number Diff line number Diff line change @@ -135,7 +135,9 @@ export const hoursToAmPmHours = (index: number): number => {
135135 */
136136export const getDefaultTextInputOptions = ( ) : ITextInputOptions => ( {
137137 enterSubmit : true ,
138+ tabSubmit : true ,
138139 openMenu : true ,
140+ openMenuOnFocus : true ,
139141 rangeSeparator : '-' ,
140142} ) ;
141143
You can’t perform that action at this time.
0 commit comments