@tagplus/components 1.1.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tp.common.js +1 -1
- package/dist/tp.common.js.map +1 -1
- package/dist/tp.umd.js +1 -1
- package/dist/tp.umd.js.map +1 -1
- package/dist/tp.umd.min.js +1 -1
- package/dist/tp.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Dialog/Dialog.vue +235 -0
- package/src/components/Dialog/index.js +3 -0
- package/src/components/index.js +3 -1
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"email": "bruno@tagplus.com.br"
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
|
-
"version": "1.
|
|
11
|
+
"version": "1.2.2",
|
|
12
12
|
"main": "./dist/tp.common.js",
|
|
13
13
|
"directories": {
|
|
14
14
|
"lib": "src/lib"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"axios": "^0.27.0",
|
|
46
46
|
"core-js": "^3.21.1",
|
|
47
47
|
"element-theme-chalk": "^2.13",
|
|
48
|
-
"element-ui": "
|
|
48
|
+
"element-ui": "2.15.8",
|
|
49
49
|
"js-cookie": "^3.0.1",
|
|
50
50
|
"vue": "^2.6.14",
|
|
51
51
|
"vue-axios": "^2.1.5",
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition
|
|
3
|
+
name="dialog-fade"
|
|
4
|
+
@after-enter="afterEnter"
|
|
5
|
+
@after-leave="afterLeave"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
v-show="visible"
|
|
9
|
+
class="el-dialog__wrapper"
|
|
10
|
+
@click.self="handleWrapperClick"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
:key="key"
|
|
14
|
+
ref="dialog"
|
|
15
|
+
role="dialog"
|
|
16
|
+
aria-modal="true"
|
|
17
|
+
:aria-label="title || 'dialog'"
|
|
18
|
+
:class="['el-dialog', { 'is-fullscreen': fullscreen, 'el-dialog--center': center }, customClass]"
|
|
19
|
+
:style="style"
|
|
20
|
+
>
|
|
21
|
+
<div class="el-dialog__header">
|
|
22
|
+
<slot name="title">
|
|
23
|
+
<span class="el-dialog__title">{{ title }}</span>
|
|
24
|
+
</slot>
|
|
25
|
+
<button
|
|
26
|
+
v-if="showClose"
|
|
27
|
+
type="button"
|
|
28
|
+
class="el-dialog__headerbtn"
|
|
29
|
+
aria-label="Close"
|
|
30
|
+
@click="handleClose"
|
|
31
|
+
>
|
|
32
|
+
<i class="el-dialog__close el-icon el-icon-close" />
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
<div
|
|
36
|
+
v-if="rendered"
|
|
37
|
+
class="el-dialog__body"
|
|
38
|
+
>
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
<div
|
|
42
|
+
v-if="$slots.footer"
|
|
43
|
+
class="el-dialog__footer"
|
|
44
|
+
>
|
|
45
|
+
<slot name="footer" />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</transition>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
import Popup from 'element-ui/src/utils/popup'
|
|
54
|
+
import Migrating from 'element-ui/src/mixins/migrating'
|
|
55
|
+
import emitter from 'element-ui/src/mixins/emitter'
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Sobrescreve o Dialog original sem usar o extends porque trocou um watch e watch não sobrescreve
|
|
59
|
+
* <BR /> A nossa versão chama o $emit open quando tem v-if
|
|
60
|
+
*/
|
|
61
|
+
export default {
|
|
62
|
+
name: 'TpDialog',
|
|
63
|
+
|
|
64
|
+
mixins: [Popup, emitter, Migrating],
|
|
65
|
+
|
|
66
|
+
props: {
|
|
67
|
+
title: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: ''
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
modal: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: true
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
modalAppendToBody: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: true
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
appendToBody: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: false
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
lockScroll: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: true
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
closeOnClickModal: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: true
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
closeOnPressEscape: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
default: true
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
showClose: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
width: String,
|
|
108
|
+
|
|
109
|
+
fullscreen: Boolean,
|
|
110
|
+
|
|
111
|
+
customClass: {
|
|
112
|
+
type: String,
|
|
113
|
+
default: ''
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
top: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: '15vh'
|
|
119
|
+
},
|
|
120
|
+
beforeClose: Function,
|
|
121
|
+
center: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: false
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
destroyOnClose: Boolean
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
data () {
|
|
130
|
+
return {
|
|
131
|
+
closed: false,
|
|
132
|
+
key: 0
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
computed: {
|
|
137
|
+
style () {
|
|
138
|
+
const style = {}
|
|
139
|
+
if (!this.fullscreen) {
|
|
140
|
+
style.marginTop = this.top
|
|
141
|
+
if (this.width) {
|
|
142
|
+
style.width = this.width
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return style
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
watch: {
|
|
150
|
+
// CORREÇÂO Sobrescreve o watch visible do dialog original para rodar o open quando tem v-if
|
|
151
|
+
visible: {
|
|
152
|
+
immediate: true,
|
|
153
|
+
handler (val, oldValue) {
|
|
154
|
+
// Fixing undefined reference of $el with next tick.
|
|
155
|
+
this.$nextTick(() => {
|
|
156
|
+
if (val) {
|
|
157
|
+
this.closed = false
|
|
158
|
+
this.$emit('open')
|
|
159
|
+
this.$el.addEventListener('scroll', this.updatePopper)
|
|
160
|
+
this.$nextTick(() => {
|
|
161
|
+
this.$refs.dialog.scrollTop = 0
|
|
162
|
+
})
|
|
163
|
+
if (this.appendToBody) {
|
|
164
|
+
document.body.appendChild(this.$el)
|
|
165
|
+
}
|
|
166
|
+
} else {
|
|
167
|
+
this.$el.removeEventListener('scroll', this.updatePopper)
|
|
168
|
+
if (!this.closed) this.$emit('close')
|
|
169
|
+
if (this.destroyOnClose) {
|
|
170
|
+
this.$nextTick(() => {
|
|
171
|
+
this.key++
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
mounted () {
|
|
181
|
+
if (this.visible) {
|
|
182
|
+
this.rendered = true
|
|
183
|
+
this.open()
|
|
184
|
+
if (this.appendToBody) {
|
|
185
|
+
document.body.appendChild(this.$el)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
destroyed () {
|
|
191
|
+
// if appendToBody is true, remove DOM node after destroy
|
|
192
|
+
if (this.appendToBody && this.$el && this.$el.parentNode) {
|
|
193
|
+
this.$el.parentNode.removeChild(this.$el)
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
methods: {
|
|
198
|
+
getMigratingConfig () {
|
|
199
|
+
return {
|
|
200
|
+
props: {
|
|
201
|
+
size: 'size is removed.'
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
handleWrapperClick () {
|
|
206
|
+
if (!this.closeOnClickModal) return
|
|
207
|
+
this.handleClose()
|
|
208
|
+
},
|
|
209
|
+
handleClose () {
|
|
210
|
+
if (typeof this.beforeClose === 'function') {
|
|
211
|
+
this.beforeClose(this.hide)
|
|
212
|
+
} else {
|
|
213
|
+
this.hide()
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
hide (cancel) {
|
|
217
|
+
if (cancel !== false) {
|
|
218
|
+
this.$emit('update:visible', false)
|
|
219
|
+
this.$emit('close')
|
|
220
|
+
this.closed = true
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
updatePopper () {
|
|
224
|
+
this.broadcast('ElSelectDropdown', 'updatePopper')
|
|
225
|
+
this.broadcast('ElDropdownMenu', 'updatePopper')
|
|
226
|
+
},
|
|
227
|
+
afterEnter () {
|
|
228
|
+
this.$emit('opened')
|
|
229
|
+
},
|
|
230
|
+
afterLeave () {
|
|
231
|
+
this.$emit('closed')
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
</script>
|
package/src/components/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import Multisuggest from './Multisuggest'
|
|
|
11
11
|
import Step from './Step'
|
|
12
12
|
import Steps from './Steps'
|
|
13
13
|
import InputNumber from './InputNumber'
|
|
14
|
+
import Dialog from './Dialog'
|
|
14
15
|
|
|
15
16
|
export {
|
|
16
17
|
Autosuggest,
|
|
@@ -25,5 +26,6 @@ export {
|
|
|
25
26
|
Multisuggest,
|
|
26
27
|
Step,
|
|
27
28
|
Steps,
|
|
28
|
-
InputNumber
|
|
29
|
+
InputNumber,
|
|
30
|
+
Dialog
|
|
29
31
|
}
|