Skip to content

Commit 5b36c09

Browse files
committed
feat: Toggle datetimepicker when button is clicked
1 parent 52ed807 commit 5b36c09

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/au-date-time-picker.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
value.bind="textValue"
77
focus.trigger="inputFocus()">
88
<span class="input-group-append">
9-
<button class="btn btn-outline-secondary" type="button" click.delegate="show()">
9+
<button class="btn btn-outline-secondary" type="button" click.delegate="toggle()">
1010
<span class="fa fa-calendar"></span>
1111
</button>
1212
</span>

src/au-date-time-picker.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,10 @@ export class AuDateTimePicker {
234234
console.error('Not yet implemented');
235235
}
236236

237+
protected isVisible() {
238+
return this.poppedElement.style.display === '';
239+
}
240+
237241
public show() {
238242
this.poppedElement.style.display = '';
239243
}
@@ -247,4 +251,8 @@ export class AuDateTimePicker {
247251
this.show();
248252
}
249253
}
254+
255+
public toggle() {
256+
this.isVisible() ? this.hide() : this.show();
257+
}
250258
}

0 commit comments

Comments
 (0)