Skip to content

Commit 5cb9b7b

Browse files
Samuell1marcosmoura
authored andcommitted
feat(MdDatepicker): add close and open events (#1577)
* feat(MdDatepicker): add close, open events * docs(MdDatepicker): close, open events
1 parent dc7892e commit 5cb9b7b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

docs/app/pages/Components/Datepicker/Datepicker.vue

+16
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<p>All the following options can be applied to the md-datepicker component:</p>
3333

3434
<api-table :headings="props.headings" :props="props.props" slot="props" />
35+
<api-table :headings="events.headings" :props="events.props" slot="events" />
3536
</api-item>
3637
</div>
3738
</page-container>
@@ -72,6 +73,21 @@
7273
defaults: 'true'
7374
}
7475
]
76+
},
77+
events: {
78+
headings: ['Name', 'Description', 'Value'],
79+
props: [
80+
{
81+
name: 'md-opened',
82+
description: 'Triggered when a datepicker dialog opens',
83+
value: 'null'
84+
},
85+
{
86+
name: 'md-closed',
87+
description: 'Triggered when a datepicker dialog closes',
88+
value: 'null'
89+
},
90+
]
7591
}
7692
})
7793
}

src/components/MdDatepicker/MdDatepicker.vue

+5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
toggleDialog () {
8585
if (!isFirefox || this.mdOverrideNative) {
8686
this.showDialog = !this.showDialog
87+
if (this.showDialog) {
88+
this.$emit('md-opened')
89+
} else {
90+
this.$emit('md-closed')
91+
}
8792
} else {
8893
this.$refs.input.$el.click()
8994
}

0 commit comments

Comments
 (0)