Skip to content

Commit

Permalink
feat: Toggle datetimepicker when button is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
klinki committed Apr 28, 2018
1 parent 52ed807 commit 5b36c09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/au-date-time-picker.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
value.bind="textValue"
focus.trigger="inputFocus()">
<span class="input-group-append">
<button class="btn btn-outline-secondary" type="button" click.delegate="show()">
<button class="btn btn-outline-secondary" type="button" click.delegate="toggle()">
<span class="fa fa-calendar"></span>
</button>
</span>
Expand Down
8 changes: 8 additions & 0 deletions src/au-date-time-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ export class AuDateTimePicker {
console.error('Not yet implemented');
}

protected isVisible() {
return this.poppedElement.style.display === '';
}

public show() {
this.poppedElement.style.display = '';
}
Expand All @@ -247,4 +251,8 @@ export class AuDateTimePicker {
this.show();
}
}

public toggle() {
this.isVisible() ? this.hide() : this.show();
}
}

0 comments on commit 5b36c09

Please sign in to comment.