Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(MdDatepicker): add close, open events #1577

Merged
merged 2 commits into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docs/app/pages/Components/Datepicker/Datepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<p>All the following options can be applied to the md-datepicker component:</p>

<api-table :headings="props.headings" :props="props.props" slot="props" />
<api-table :headings="events.headings" :props="events.props" slot="events" />
</api-item>
</div>
</page-container>
Expand Down Expand Up @@ -72,6 +73,21 @@
defaults: 'true'
}
]
},
events: {
headings: ['Name', 'Description', 'Value'],
props: [
{
name: 'md-opened',
description: 'Triggered when a datepicker dialog opens',
value: 'null'
},
{
name: 'md-closed',
description: 'Triggered when a datepicker dialog closes',
value: 'null'
},
]
}
})
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/MdDatepicker/MdDatepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@
toggleDialog () {
if (!isFirefox || this.mdOverrideNative) {
this.showDialog = !this.showDialog
if (this.showDialog) {
this.$emit('md-opened')
} else {
this.$emit('md-closed')
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think md-opened and md-closed for transition enter and leave is better.

How do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not needed. In this case, the md-opened and md-closed will fire an intention of close and open.

} else {
this.$refs.input.$el.click()
}
Expand Down