|
8 | 8 | <transition :name="animation" @after-leave="animationEnded('content')" appear> |
9 | 9 | <div v-if="show" :class="['dg-container', {'dg-container--has-input': (isHardConfirm || isPrompt)}]" @click="closeAtOutsideClick" > |
10 | 10 | <div class="dg-content-cont dg-content-cont--floating"> |
11 | | - <div class="dg-main-content" @click.stop> |
| 11 | + <div class="dg-main-content" :class="customClass.mainContent" @click.stop> |
12 | 12 |
|
13 | | - <div :class="['dg-content-body', {'dg-content-body--has-title': messageHasTitle}]"> |
| 13 | + <div :class="['dg-content-body', customClass.body, {'dg-content-body--has-title': messageHasTitle}]"> |
14 | 14 | <template v-if="messageHasTitle"> |
15 | 15 | <h6 v-if="options.html" class="dg-title" v-html="messageTitle"></h6> |
16 | 16 | <h6 v-else="" class="dg-title">{{ messageTitle }}</h6> |
|
34 | 34 | </form> |
35 | 35 | </div> |
36 | 36 |
|
37 | | - <div class="dg-content-footer"> |
| 37 | + <div class="dg-content-footer" :class="customClass.footer"> |
38 | 38 |
|
39 | | - <button @click="clickLeftBtn()" :is="leftBtnComponent" :loading="loading" |
| 39 | + <button @click="clickLeftBtn()" :is="leftBtnComponent" :loading="loading" :class="customClass.cancel" |
40 | 40 | :enabled="leftBtnEnabled" :options="options" :focus="leftBtnFocus"> |
41 | 41 | <span v-if="options.html" v-html="leftBtnText"></span> |
42 | 42 | <span v-else="">{{ leftBtnText }}</span> |
43 | 43 | </button> |
44 | 44 |
|
45 | | - <button :is="rightBtnComponent" @click="clickRightBtn()" :loading="loading" |
| 45 | + <button :is="rightBtnComponent" @click="clickRightBtn()" :loading="loading" :class="customClass.ok" |
46 | 46 | :enabled="rightBtnEnabled" :options="options" :focus="rightBtnFocus"> |
47 | 47 | <span v-if="options.html" v-html="rightBtnText"></span> |
48 | 48 | <span v-else="">{{ rightBtnText }}</span> |
|
60 | 60 | <script> |
61 | 61 | import OkBtn from './ok-btn.vue' |
62 | 62 | import CancelBtn from './cancel-btn.vue' |
63 | | - import {DIALOG_TYPES, ANIMATION_TYPES, CONFIRM_TYPES} from '../js/constants' |
| 63 | + import {DIALOG_TYPES, ANIMATION_TYPES, CONFIRM_TYPES, CUSTOM_CLASS} from '../js/constants' |
64 | 64 |
|
65 | 65 | import MessageMixin from '../js/mixins/message-mixin' |
66 | 66 | import ButtonMixin from '../js/mixins/btn-mixin' |
|
72 | 72 | show: true, |
73 | 73 | loading: false, |
74 | 74 | closed: false, |
| 75 | + customClass: Object.assign({}, CUSTOM_CLASS), |
75 | 76 | endedAnimations: [] |
76 | 77 | } |
77 | 78 | }, |
|
115 | 116 | rightBtnComponent(){ |
116 | 117 | return (this.options.reverse === true) ? 'cancel-btn' : 'ok-btn' |
117 | 118 | }, |
118 | | - hardConfirmHelpText() { |
| 119 | + hardConfirmHelpText(){ |
119 | 120 | return this.options.verificationHelp |
120 | 121 | .replace(/\[\+:(\w+)]/g, (match, $1) => { |
121 | 122 | return this.options[$1] || match |
122 | 123 | }) |
123 | 124 | } |
124 | 125 | }, |
125 | 126 | mounted () { |
| 127 | + this.setCustomClasses() |
126 | 128 | this.isHardConfirm && this.$refs.inputElem.focus() |
127 | 129 | }, |
128 | 130 | methods: { |
|
178 | 180 | this.$emit('close', this.options.id) |
179 | 181 | } |
180 | 182 |
|
| 183 | + }, |
| 184 | + setCustomClasses(){ |
| 185 | + if (this.options.hasOwnProperty('customClass')) { |
| 186 | + Object.keys(this.options.customClass).forEach(prop => { |
| 187 | + if (!Object.keys(CUSTOM_CLASS).includes(prop)) { |
| 188 | + console.warn(`[WARNING]: Custom class name "${prop}" could not be found!`) |
| 189 | + } |
| 190 | + }); |
| 191 | + } |
| 192 | + this.customClass = Object.assign(this.customClass, this.options.customClass); |
181 | 193 | } |
182 | 194 | }, |
183 | 195 | beforeDestroy(){ |
|
0 commit comments