{"action":"created","issue":{"url":"https://api.github.com/repos/vuetifyjs/vuetify/issues/5406","repository_url":"https://api.github.com/repos/vuetifyjs/vuetify","labels_url":"https://api.github.com/repos/vuetifyjs/vuetify/issues/5406/labels{/name}","comments_url":"https://api.github.com/repos/vuetifyjs/vuetify/issues/5406/comments","events_url":"https://api.github.com/repos/vuetifyjs/vuetify/issues/5406/events","html_url":"https://github.com/vuetifyjs/vuetify/pull/5406","id":373248944,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI1MjIzMjUx","number":5406,"title":"Added ability to prevent v-edit-dialog from saving","user":{"login":"ayZagen","id":11196940,"node_id":"MDQ6VXNlcjExMTk2OTQw","avatar_url":"https://avatars0.githubusercontent.com/u/11196940?v=4","gravatar_id":"","url":"https://api.github.com/users/ayZagen","html_url":"https://github.com/ayZagen","followers_url":"https://api.github.com/users/ayZagen/followers","following_url":"https://api.github.com/users/ayZagen/following{/other_user}","gists_url":"https://api.github.com/users/ayZagen/gists{/gist_id}","starred_url":"https://api.github.com/users/ayZagen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayZagen/subscriptions","organizations_url":"https://api.github.com/users/ayZagen/orgs","repos_url":"https://api.github.com/users/ayZagen/repos","events_url":"https://api.github.com/users/ayZagen/events{/privacy}","received_events_url":"https://api.github.com/users/ayZagen/received_events","type":"User","site_admin":false},"labels":[{"id":941134152,"node_id":"MDU6TGFiZWw5NDExMzQxNTI=","url":"https://api.github.com/repos/vuetifyjs/vuetify/labels/S:%20has%20merge%20conflicts","name":"S: has merge conflicts","color":"edc740","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-23T23:53:18Z","updated_at":"2018-11-20T14:58:43Z","closed_at":"2018-11-20T14:58:43Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/vuetifyjs/vuetify/pulls/5406","html_url":"https://github.com/vuetifyjs/vuetify/pull/5406","diff_url":"https://github.com/vuetifyjs/vuetify/pull/5406.diff","patch_url":"https://github.com/vuetifyjs/vuetify/pull/5406.patch"},"body":"<!--\r\nMAKE SURE TO READ THE CONTRIBUTING GUIDE BEFORE CREATING A PR\r\nhttps://github.com/vuetifyjs/vuetify/blob/master/.github/CONTRIBUTING.md\r\n-->\r\n\r\n<!-- Provide a general summary of your changes in the Title above -->\r\n<!-- Keep the title short and descriptive, as it will be used as a commit message -->\r\n\r\n## Description\r\n<!--- Describe your changes in detail -->\r\n\r\nBy using native custom events we could prevent dialog from closing without affecting general usage.\r\n## Motivation and Context\r\n<!--- Why is this change required? What problem does it solve? -->\r\n<!--- If it fixes an open issue, please link to the issue here. -->\r\nWe are not able to prevent v-edit-dialog from saving. For ex. when there is a validation error in the inputs saving shouldn't be done.\r\n[issue#3344](https://github.com/vuetifyjs/vuetify/issues/3344)\r\n\r\n## How Has This Been Tested?\r\n<!--- Please describe how you tested your changes. -->\r\n<!--- Have you created new tests or updated existing ones? -->\r\n<!--- e.g. unit | visually | e2e | none -->\r\nThere are two simple cases:\r\nDoes it save the value and close the dialog if event is prevented => should not save and shouldn't close\r\nDoes it save the value and close the dialog if event is not prevented => should save and close\r\n\r\n## Markup:\r\n<!--- Paste markup for testing your change --->\r\n<details>\r\n\r\n```vue\r\n<template>\r\n  <v-app>\r\n    <v-edit-dialog\r\n      :return-value.sync=\"name\"\r\n      lazy\r\n      @save.native=\"beforeSave\"\r\n      @save=\"save\"\r\n      @cancel=\"cancel\"\r\n      @open=\"open\"\r\n      @close=\"close\"\r\n    > {{ name }}\r\n      <v-text-field\r\n        slot=\"input\"\r\n        v-model=\"name\"\r\n        :rules=\"[required]\"\r\n        label=\"Edit\"\r\n        single-line\r\n        counter\r\n      ></v-text-field>\r\n    </v-edit-dialog>\r\n    <v-snackbar v-model=\"snack\" :timeout=\"3000\" :color=\"snackColor\">\r\n      {{ snackText }}\r\n      <v-btn flat @click=\"snack = false\">Close</v-btn>\r\n    </v-snackbar>\r\n  </v-app>\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data: () => ({\r\n      snack: false,\r\n      snackColor: '',\r\n      snackText: '',\r\n      name: \"test\",\r\n      required: (v) => !!v || 'Required'\r\n    }),\r\n    methods: {\r\n      // Event detail contains vnodes of passed input slots\r\n      beforeSave ($event) {\r\n        // Check if field/s has any error\r\n        if ($event.detail.vnodes.filter(v => v.componentInstance.hasError).length > 0) {\r\n          $event.preventDefault()\r\n          this.snack = true\r\n          this.snackColor = 'error'\r\n          this.snackText = 'Has Error'\r\n        }\r\n      },\r\n      save () {\r\n        this.snack = true\r\n        this.snackColor = 'success'\r\n        this.snackText = 'Data saved'\r\n      },\r\n      cancel () {\r\n        this.snack = true\r\n        this.snackColor = 'error'\r\n        this.snackText = 'Canceled'\r\n      },\r\n      open () {\r\n        this.snack = true\r\n        this.snackColor = 'info'\r\n        this.snackText = 'Dialog opened'\r\n      },\r\n      close () {\r\n        console.log('Dialog closed')\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n```\r\n</details>\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)\r\n- [ ] Improvement/refactoring (non-breaking change that doesn't add any feature but make things better)\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] The PR title is no longer than 64 characters.\r\n- [x] The PR is submitted to the correct branch (`master` for bug fixes, `dev` for new features and breaking changes).\r\n- [x] My code follows the code style of this project.\r\n- [ ] My change requires a change to the documentation.\r\n- [ ] I have created a PR in the [documentation](https://github.com/vuetifyjs/vuetifyjs.com) with the necessary changes.\r\n"},"comment":{"url":"https://api.github.com/repos/vuetifyjs/vuetify/issues/comments/440302534","html_url":"https://github.com/vuetifyjs/vuetify/pull/5406#issuecomment-440302534","issue_url":"https://api.github.com/repos/vuetifyjs/vuetify/issues/5406","id":440302534,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MDMwMjUzNA==","user":{"login":"johnleider","id":9064066,"node_id":"MDQ6VXNlcjkwNjQwNjY=","avatar_url":"https://avatars3.githubusercontent.com/u/9064066?v=4","gravatar_id":"","url":"https://api.github.com/users/johnleider","html_url":"https://github.com/johnleider","followers_url":"https://api.github.com/users/johnleider/followers","following_url":"https://api.github.com/users/johnleider/following{/other_user}","gists_url":"https://api.github.com/users/johnleider/gists{/gist_id}","starred_url":"https://api.github.com/users/johnleider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnleider/subscriptions","organizations_url":"https://api.github.com/users/johnleider/orgs","repos_url":"https://api.github.com/users/johnleider/repos","events_url":"https://api.github.com/users/johnleider/events{/privacy}","received_events_url":"https://api.github.com/users/johnleider/received_events","type":"User","site_admin":false},"created_at":"2018-11-20T14:58:43Z","updated_at":"2018-11-20T14:58:43Z","author_association":"MEMBER","body":"This Pull Request is being closed due to unresolved merge conflicts. Once corrected we will re-open.\r\n\r\nThank you for your contribution and interest in improving Vuetify!"}}
{"actor":{"display_login":"johnleider"}}