Skip to content

Commit 52ed807

Browse files
committed
feat: Add showOnInputFocus config option
1 parent a19aff2 commit 52ed807

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/au-date-time-picker.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="input-group">
55
<input class="form-control datepicker-input" type="datetime"
66
value.bind="textValue"
7-
focus.trigger="show()">
7+
focus.trigger="inputFocus()">
88
<span class="input-group-append">
99
<button class="btn btn-outline-secondary" type="button" click.delegate="show()">
1010
<span class="fa fa-calendar"></span>

src/au-date-time-picker.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,10 @@ export class AuDateTimePicker {
241241
public hide() {
242242
this.poppedElement.style.display = 'none';
243243
}
244+
245+
public inputFocus() {
246+
if (this.options.showOnInputFocus) {
247+
this.show();
248+
}
249+
}
244250
}

src/configuration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ export interface DateTimePickerConfiguration {
88
weekStartsOn?: 0|1;
99
scopes?: SelectionScope[];
1010
initialScope?: SelectionScope;
11+
showOnInputFocus?: boolean;
1112
}
1213

1314
export const DEFAULT_CONFIGURATION: DateTimePickerConfiguration = {
1415
format: 'DD. MM. YYYY HH:mm',
1516
weekStartsOn: 1,
1617
scopes: DEFAULT_SCOPES.array,
17-
initialScope: DEFAULT_SCOPES.initial
18+
initialScope: DEFAULT_SCOPES.initial,
19+
showOnInputFocus: true
1820
};

0 commit comments

Comments
 (0)