Skip to content

Commit

Permalink
feat: Add showOnInputFocus config option
Browse files Browse the repository at this point in the history
  • Loading branch information
klinki committed Apr 28, 2018
1 parent a19aff2 commit 52ed807
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/au-date-time-picker.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="input-group">
<input class="form-control datepicker-input" type="datetime"
value.bind="textValue"
focus.trigger="show()">
focus.trigger="inputFocus()">
<span class="input-group-append">
<button class="btn btn-outline-secondary" type="button" click.delegate="show()">
<span class="fa fa-calendar"></span>
Expand Down
6 changes: 6 additions & 0 deletions src/au-date-time-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,10 @@ export class AuDateTimePicker {
public hide() {
this.poppedElement.style.display = 'none';
}

public inputFocus() {
if (this.options.showOnInputFocus) {
this.show();
}
}
}
4 changes: 3 additions & 1 deletion src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ export interface DateTimePickerConfiguration {
weekStartsOn?: 0|1;
scopes?: SelectionScope[];
initialScope?: SelectionScope;
showOnInputFocus?: boolean;
}

export const DEFAULT_CONFIGURATION: DateTimePickerConfiguration = {
format: 'DD. MM. YYYY HH:mm',
weekStartsOn: 1,
scopes: DEFAULT_SCOPES.array,
initialScope: DEFAULT_SCOPES.initial
initialScope: DEFAULT_SCOPES.initial,
showOnInputFocus: true
};

0 comments on commit 52ed807

Please sign in to comment.