Skip to content

Commit

Permalink
fix: message icons, add info dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
yariksav committed Sep 29, 2020
1 parent 4ae8644 commit 57bfbbe
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 15 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ const res = await this.$dialog.confirm({
})
```

### Info dialog
```js
const res = await this.$dialog.info({
text: 'File copied successfully',
title: 'Info'
})
```

### Warning dialog
```js
const res = await this.$dialog.warning({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuetify-dialog",
"version": "2.0.11",
"version": "2.0.12",
"description": "Dialog helper for vuetify.js",
"scripts": {
"build": "npm run build:umd & npm run build:es & npm run build:unpkg",
Expand Down
5 changes: 3 additions & 2 deletions src/components/Alert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@input="$emit('submit')"
:dismissible="dismissible"
:type="color"
:icon="icon"
:icon="getIcon"
:outlined="outlined"
:prominent="prominent"
:text="flat"
Expand All @@ -23,13 +23,15 @@
<script>
import DialogActions from './DialogActions.vue'
import Iconable from '../mixins/iconable'
import { VAlert } from 'vuetify/lib'
export default {
components: {
DialogActions,
VAlert
},
mixins: [Iconable],
layout: ['notification', { showClose: false }],
props: {
color: {
Expand All @@ -44,7 +46,6 @@ export default {
type: String,
default: ''
},
icon: String,
outlined: Boolean,
prominent: Boolean,
dismissible: {
Expand Down
14 changes: 2 additions & 12 deletions src/components/Confirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
</template>

<script>
import Confirmable from 'vuedl/src/mixins/confirmable'
import Colorable from '../mixins/colorable'
import Iconable from '../mixins/iconable'
import DialogActions from './DialogActions.vue'
import { VCard, VCardText, VToolbar, VToolbarTitle, VIcon } from 'vuetify/lib'
Expand All @@ -46,26 +46,16 @@ export default {
VIcon
},
layout: ['default', { width: 450 }],
mixins: [Confirmable, Colorable],
mixins: [Iconable, Confirmable, Colorable],
props: {
actionOptions: Object,
icon: {
type: [String, Boolean],
default: undefined
},
text: {
type: [String, Function],
required: true,
default: ''
}
},
computed: {
getIcon () {
if (this.icon === false) {
return
}
return this.icon || (this.$vuetify && this.$vuetify.icons && this.$vuetify.icons[this.type]) || this.type
},
getText () {
return typeof this.text === 'function' ? this.text() : this.text
}
Expand Down
8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ function install (Vue, options = {}) {
...options.error
})

manager.component('info', Confirm, {
type: 'info',
waitForResult: true,
actions: ['Ok'],
actionOptions: actionOptions,
...options.info
})

manager.component('toast', Toast, {
waitForResult: true,
actionOptions: actionOptions,
Expand Down
17 changes: 17 additions & 0 deletions src/mixins/iconable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default {
props: {
icon: {
type: [String, Boolean],
default: undefined
},
type: String
},
computed: {
getIcon () {
if (this.icon === false) {
return
}
return this.icon || (this.$vuetify && this.$vuetify.icons && this.$vuetify.icons.values[this.type]) || this.type
}
}
}

0 comments on commit 57bfbbe

Please sign in to comment.