buefy 0.9.18 → 0.9.21
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/CHANGELOG.md +1741 -1719
- package/dist/buefy.css +15848 -1
- package/dist/buefy.esm.js +77 -38
- package/dist/buefy.esm.min.js +2 -2
- package/dist/buefy.js +77 -38
- package/dist/buefy.min.css +1 -1
- package/dist/buefy.min.js +2 -2
- package/dist/cjs/autocomplete.js +5 -5
- package/dist/cjs/breadcrumb.js +1 -1
- package/dist/cjs/button.js +3 -3
- package/dist/cjs/carousel.js +3 -3
- package/dist/cjs/checkbox.js +1 -1
- package/dist/cjs/{chunk-5ed8a75a.js → chunk-09574ad9.js} +3 -3
- package/dist/cjs/{chunk-7c11fdde.js → chunk-201c9e5c.js} +1 -1
- package/dist/cjs/{chunk-545e1c7f.js → chunk-2a96ec68.js} +2 -2
- package/dist/cjs/{chunk-9103eeda.js → chunk-437dd7a0.js} +1 -0
- package/dist/cjs/{chunk-3b43d77a.js → chunk-5cd29907.js} +1 -1
- package/dist/cjs/{chunk-334bc809.js → chunk-7b44db6e.js} +2 -2
- package/dist/cjs/{chunk-779e6a5d.js → chunk-85b00a19.js} +8 -8
- package/dist/cjs/{chunk-5058e659.js → chunk-95c4b826.js} +3 -3
- package/dist/cjs/{chunk-83b41298.js → chunk-99367591.js} +24 -8
- package/dist/cjs/{chunk-73f8eef8.js → chunk-a6b29437.js} +1 -1
- package/dist/cjs/{chunk-8ef75f09.js → chunk-bcab8905.js} +6 -6
- package/dist/cjs/{chunk-54b0042d.js → chunk-befea70a.js} +2 -2
- package/dist/cjs/{chunk-4bcfaf1c.js → chunk-cc9676a6.js} +1 -1
- package/dist/cjs/{chunk-03279fd8.js → chunk-dddb035c.js} +1 -1
- package/dist/cjs/{chunk-e872f5e2.js → chunk-e0373ab6.js} +1 -1
- package/dist/cjs/{chunk-1f7e4ed3.js → chunk-e90b3d05.js} +2 -2
- package/dist/cjs/{chunk-f5285f14.js → chunk-eba24a95.js} +1 -1
- package/dist/cjs/{chunk-e86d3eeb.js → chunk-f5139026.js} +1 -1
- package/dist/cjs/{chunk-c8abb3ed.js → chunk-f8eb56c6.js} +2 -2
- package/dist/cjs/{chunk-87a116d9.js → chunk-fb8ff6be.js} +1 -2
- package/dist/cjs/clockpicker.js +17 -8
- package/dist/cjs/colorpicker.js +18 -11
- package/dist/cjs/config.js +1 -1
- package/dist/cjs/datepicker.js +8 -8
- package/dist/cjs/datetimepicker.js +10 -10
- package/dist/cjs/dialog.js +4 -4
- package/dist/cjs/dropdown.js +2 -2
- package/dist/cjs/field.js +2 -2
- package/dist/cjs/icon.js +2 -2
- package/dist/cjs/image.js +2 -2
- package/dist/cjs/index.js +20 -20
- package/dist/cjs/input.js +4 -4
- package/dist/cjs/loading.js +1 -1
- package/dist/cjs/menu.js +3 -3
- package/dist/cjs/message.js +3 -3
- package/dist/cjs/modal.js +2 -2
- package/dist/cjs/notification.js +4 -4
- package/dist/cjs/numberinput.js +4 -4
- package/dist/cjs/pagination.js +3 -3
- package/dist/cjs/progress.js +1 -1
- package/dist/cjs/rate.js +2 -2
- package/dist/cjs/select.js +4 -4
- package/dist/cjs/sidebar.js +16 -16
- package/dist/cjs/slider.js +2 -2
- package/dist/cjs/snackbar.js +2 -2
- package/dist/cjs/steps.js +3 -3
- package/dist/cjs/switch.js +1 -1
- package/dist/cjs/table.js +19 -12
- package/dist/cjs/tabs.js +3 -3
- package/dist/cjs/taginput.js +5 -5
- package/dist/cjs/timepicker.js +9 -9
- package/dist/cjs/toast.js +2 -2
- package/dist/cjs/tooltip.js +2 -2
- package/dist/cjs/upload.js +2 -2
- package/dist/components/autocomplete/index.js +2 -2
- package/dist/components/autocomplete/index.min.js +2 -2
- package/dist/components/breadcrumb/index.js +2 -1
- package/dist/components/breadcrumb/index.min.js +1 -1
- package/dist/components/button/index.js +3 -2
- package/dist/components/button/index.min.js +2 -2
- package/dist/components/carousel/index.js +2 -1
- package/dist/components/carousel/index.min.js +2 -2
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/checkbox/index.min.js +2 -2
- package/dist/components/clockpicker/index.js +13 -4
- package/dist/components/clockpicker/index.min.js +2 -2
- package/dist/components/collapse/index.js +1 -1
- package/dist/components/collapse/index.min.js +1 -1
- package/dist/components/colorpicker/index.js +36 -13
- package/dist/components/colorpicker/index.min.js +2 -2
- package/dist/components/datepicker/index.js +4 -4
- package/dist/components/datepicker/index.min.js +2 -2
- package/dist/components/datetimepicker/index.js +4 -4
- package/dist/components/datetimepicker/index.min.js +2 -2
- package/dist/components/dialog/index.js +3 -2
- package/dist/components/dialog/index.min.js +2 -2
- package/dist/components/dropdown/index.js +2 -1
- package/dist/components/dropdown/index.min.js +1 -1
- package/dist/components/field/index.js +3 -2
- package/dist/components/field/index.min.js +2 -2
- package/dist/components/icon/index.js +2 -1
- package/dist/components/icon/index.min.js +2 -2
- package/dist/components/image/index.js +2 -1
- package/dist/components/image/index.min.js +2 -2
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/index.min.js +2 -2
- package/dist/components/loading/index.js +1 -1
- package/dist/components/loading/index.min.js +1 -1
- package/dist/components/menu/index.js +3 -2
- package/dist/components/menu/index.min.js +2 -2
- package/dist/components/message/index.js +2 -1
- package/dist/components/message/index.min.js +2 -2
- package/dist/components/modal/index.js +2 -1
- package/dist/components/modal/index.min.js +2 -2
- package/dist/components/navbar/index.js +1 -1
- package/dist/components/navbar/index.min.js +1 -1
- package/dist/components/notification/index.js +2 -1
- package/dist/components/notification/index.min.js +2 -2
- package/dist/components/numberinput/index.js +2 -2
- package/dist/components/numberinput/index.min.js +2 -2
- package/dist/components/pagination/index.js +2 -1
- package/dist/components/pagination/index.min.js +2 -2
- package/dist/components/progress/index.js +2 -1
- package/dist/components/progress/index.min.js +2 -2
- package/dist/components/radio/index.js +1 -1
- package/dist/components/radio/index.min.js +1 -1
- package/dist/components/rate/index.js +2 -1
- package/dist/components/rate/index.min.js +2 -2
- package/dist/components/select/index.js +2 -2
- package/dist/components/select/index.min.js +2 -2
- package/dist/components/sidebar/index.js +17 -16
- package/dist/components/sidebar/index.min.js +1 -1
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/skeleton/index.min.js +1 -1
- package/dist/components/slider/index.js +25 -8
- package/dist/components/slider/index.min.js +2 -2
- package/dist/components/snackbar/index.js +2 -1
- package/dist/components/snackbar/index.min.js +1 -1
- package/dist/components/steps/index.js +2 -1
- package/dist/components/steps/index.min.js +2 -2
- package/dist/components/switch/index.js +2 -1
- package/dist/components/switch/index.min.js +1 -1
- package/dist/components/table/index.js +15 -8
- package/dist/components/table/index.min.js +2 -2
- package/dist/components/tabs/index.js +2 -1
- package/dist/components/tabs/index.min.js +2 -2
- package/dist/components/tag/index.js +1 -1
- package/dist/components/tag/index.min.js +1 -1
- package/dist/components/taginput/index.js +2 -2
- package/dist/components/taginput/index.min.js +2 -2
- package/dist/components/timepicker/index.js +3 -3
- package/dist/components/timepicker/index.min.js +2 -2
- package/dist/components/toast/index.js +2 -1
- package/dist/components/toast/index.min.js +1 -1
- package/dist/components/tooltip/index.js +25 -8
- package/dist/components/tooltip/index.min.js +2 -2
- package/dist/components/upload/index.js +2 -2
- package/dist/components/upload/index.min.js +2 -2
- package/dist/esm/autocomplete.js +6 -6
- package/dist/esm/breadcrumb.js +1 -1
- package/dist/esm/button.js +4 -4
- package/dist/esm/carousel.js +3 -3
- package/dist/esm/checkbox.js +2 -2
- package/dist/esm/{chunk-84c6dfd6.js → chunk-17b33cd2.js} +1 -2
- package/dist/esm/{chunk-a5e3ae5d.js → chunk-293c457c.js} +6 -6
- package/dist/esm/{chunk-d35985c7.js → chunk-33e1434e.js} +1 -1
- package/dist/esm/{chunk-690d5be4.js → chunk-493ff0a9.js} +1 -1
- package/dist/esm/{chunk-252f2b57.js → chunk-4a2008fa.js} +1 -1
- package/dist/esm/{chunk-6adc5c5d.js → chunk-4e788733.js} +2 -2
- package/dist/esm/{chunk-43fb1457.js → chunk-6c64686f.js} +8 -8
- package/dist/esm/{chunk-262b3f82.js → chunk-6e56b8bc.js} +2 -2
- package/dist/esm/{chunk-5435bd9a.js → chunk-7bb9107f.js} +1 -1
- package/dist/esm/{chunk-e044aa02.js → chunk-7e17a637.js} +1 -1
- package/dist/esm/{chunk-a628d44d.js → chunk-83c8b459.js} +3 -3
- package/dist/esm/{chunk-f967f402.js → chunk-9b0b8225.js} +24 -8
- package/dist/esm/{chunk-d9232770.js → chunk-a32d1427.js} +1 -1
- package/dist/esm/{chunk-598015da.js → chunk-ade5b253.js} +1 -1
- package/dist/esm/{chunk-f9eaeac4.js → chunk-b0123b89.js} +2 -2
- package/dist/esm/{chunk-58cdbf2b.js → chunk-b5576437.js} +3 -3
- package/dist/esm/{chunk-1a4fde6d.js → chunk-c5284276.js} +2 -2
- package/dist/esm/{chunk-effa4d25.js → chunk-d46e7ff0.js} +2 -2
- package/dist/esm/{chunk-8ed29c41.js → chunk-e92e3389.js} +1 -0
- package/dist/esm/{chunk-6d96579e.js → chunk-f32d0228.js} +1 -1
- package/dist/esm/clockpicker.js +17 -8
- package/dist/esm/colorpicker.js +18 -11
- package/dist/esm/config.js +1 -1
- package/dist/esm/datepicker.js +9 -9
- package/dist/esm/datetimepicker.js +10 -10
- package/dist/esm/dialog.js +4 -4
- package/dist/esm/dropdown.js +3 -3
- package/dist/esm/field.js +3 -3
- package/dist/esm/icon.js +3 -3
- package/dist/esm/image.js +3 -3
- package/dist/esm/index.js +20 -20
- package/dist/esm/input.js +5 -5
- package/dist/esm/loading.js +1 -1
- package/dist/esm/menu.js +3 -3
- package/dist/esm/message.js +3 -3
- package/dist/esm/modal.js +3 -3
- package/dist/esm/notification.js +4 -4
- package/dist/esm/numberinput.js +4 -4
- package/dist/esm/pagination.js +4 -4
- package/dist/esm/progress.js +1 -1
- package/dist/esm/rate.js +2 -2
- package/dist/esm/select.js +5 -5
- package/dist/esm/sidebar.js +16 -16
- package/dist/esm/slider.js +2 -2
- package/dist/esm/snackbar.js +2 -2
- package/dist/esm/steps.js +3 -3
- package/dist/esm/switch.js +1 -1
- package/dist/esm/table.js +19 -12
- package/dist/esm/tabs.js +3 -3
- package/dist/esm/taginput.js +5 -5
- package/dist/esm/timepicker.js +10 -10
- package/dist/esm/toast.js +2 -2
- package/dist/esm/tooltip.js +3 -3
- package/dist/esm/upload.js +2 -2
- package/dist/vetur/attributes.json +9 -1
- package/dist/vetur/tags.json +2 -1
- package/package.json +1 -1
- package/src/components/button/Button.spec.js +14 -0
- package/src/components/button/Button.vue +1 -1
- package/src/components/checkbox/Checkbox.vue +5 -1
- package/src/components/clockpicker/Clockpicker.vue +9 -1
- package/src/components/colorpicker/Colorpicker.vue +7 -2
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +3 -1
- package/src/components/datepicker/Datepicker.vue +1 -1
- package/src/components/field/Field.vue +1 -0
- package/src/components/menu/MenuItem.vue +1 -1
- package/src/components/sidebar/Sidebar.spec.js +105 -105
- package/src/components/sidebar/Sidebar.vue +303 -303
- package/src/components/table/Table.vue +10 -2
- package/src/components/table/TableColumn.vue +121 -118
- package/src/components/tooltip/Tooltip.vue +299 -288
- package/src/scss/components/_dropdown.scss +6 -0
- package/src/scss/utils/_helpers.scss +0 -6
- package/src/utils/FormElementMixin.js +0 -1
- package/src/utils/config.js +1 -0
|
@@ -1,288 +1,299 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="tooltip" :class="rootClasses">
|
|
3
|
-
<transition :name="newAnimation">
|
|
4
|
-
<div
|
|
5
|
-
v-show="active && (isActive || always)"
|
|
6
|
-
ref="content"
|
|
7
|
-
:class="['tooltip-content', contentClass]">
|
|
8
|
-
<template v-if="label">{{ label }}</template>
|
|
9
|
-
<template v-else-if="$slots.content">
|
|
10
|
-
<slot name="content" />
|
|
11
|
-
</template>
|
|
12
|
-
</div>
|
|
13
|
-
</transition>
|
|
14
|
-
<div
|
|
15
|
-
ref="trigger"
|
|
16
|
-
class="tooltip-trigger"
|
|
17
|
-
:style="triggerStyle"
|
|
18
|
-
@click="onClick"
|
|
19
|
-
@contextmenu="onContextMenu"
|
|
20
|
-
@mouseenter="onHover"
|
|
21
|
-
@focus.capture="onFocus"
|
|
22
|
-
@blur.capture="close"
|
|
23
|
-
@mouseleave="close">
|
|
24
|
-
<slot ref="slot" />
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script>
|
|
30
|
-
import config from '../../utils/config'
|
|
31
|
-
import { createAbsoluteElement, removeElement } from '../../utils/helpers'
|
|
32
|
-
|
|
33
|
-
export default {
|
|
34
|
-
name: 'BTooltip',
|
|
35
|
-
props: {
|
|
36
|
-
active: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: true
|
|
39
|
-
},
|
|
40
|
-
type: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: () => config.defaultTooltipType
|
|
43
|
-
},
|
|
44
|
-
label: String,
|
|
45
|
-
delay: {
|
|
46
|
-
type: Number,
|
|
47
|
-
default: () => config.defaultTooltipDelay
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
type:
|
|
51
|
-
default:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
type:
|
|
80
|
-
default:
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
tooltipEl.style.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
tooltipEl.style.
|
|
164
|
-
|
|
165
|
-
break
|
|
166
|
-
case 'is-
|
|
167
|
-
tooltipEl.style.width = `0px`
|
|
168
|
-
tooltipEl.style.height = `${trigger.clientHeight}px`
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
wrapper
|
|
178
|
-
wrapper.style.
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
if (this.triggers.indexOf('
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
this.open()
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
if (this.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="tooltip" :class="rootClasses">
|
|
3
|
+
<transition :name="newAnimation">
|
|
4
|
+
<div
|
|
5
|
+
v-show="active && (isActive || always)"
|
|
6
|
+
ref="content"
|
|
7
|
+
:class="['tooltip-content', contentClass]">
|
|
8
|
+
<template v-if="label">{{ label }}</template>
|
|
9
|
+
<template v-else-if="$slots.content">
|
|
10
|
+
<slot name="content" />
|
|
11
|
+
</template>
|
|
12
|
+
</div>
|
|
13
|
+
</transition>
|
|
14
|
+
<div
|
|
15
|
+
ref="trigger"
|
|
16
|
+
class="tooltip-trigger"
|
|
17
|
+
:style="triggerStyle"
|
|
18
|
+
@click="onClick"
|
|
19
|
+
@contextmenu="onContextMenu"
|
|
20
|
+
@mouseenter="onHover"
|
|
21
|
+
@focus.capture="onFocus"
|
|
22
|
+
@blur.capture="close"
|
|
23
|
+
@mouseleave="close">
|
|
24
|
+
<slot ref="slot" />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import config from '../../utils/config'
|
|
31
|
+
import { createAbsoluteElement, removeElement } from '../../utils/helpers'
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
name: 'BTooltip',
|
|
35
|
+
props: {
|
|
36
|
+
active: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true
|
|
39
|
+
},
|
|
40
|
+
type: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: () => config.defaultTooltipType
|
|
43
|
+
},
|
|
44
|
+
label: String,
|
|
45
|
+
delay: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: () => config.defaultTooltipDelay
|
|
48
|
+
},
|
|
49
|
+
closeDelay: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: () => config.defaultTooltipCloseDelay
|
|
52
|
+
},
|
|
53
|
+
position: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: 'is-top',
|
|
56
|
+
validator(value) {
|
|
57
|
+
return [
|
|
58
|
+
'is-top',
|
|
59
|
+
'is-bottom',
|
|
60
|
+
'is-left',
|
|
61
|
+
'is-right'
|
|
62
|
+
].indexOf(value) > -1
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
triggers: {
|
|
66
|
+
type: Array,
|
|
67
|
+
default: () => ['hover']
|
|
68
|
+
},
|
|
69
|
+
always: Boolean,
|
|
70
|
+
square: Boolean,
|
|
71
|
+
dashed: Boolean,
|
|
72
|
+
multilined: Boolean,
|
|
73
|
+
size: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: 'is-medium'
|
|
76
|
+
},
|
|
77
|
+
appendToBody: Boolean,
|
|
78
|
+
animated: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: true
|
|
81
|
+
},
|
|
82
|
+
animation: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: 'fade'
|
|
85
|
+
},
|
|
86
|
+
contentClass: String,
|
|
87
|
+
autoClose: {
|
|
88
|
+
type: [Array, Boolean],
|
|
89
|
+
default: true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
data() {
|
|
93
|
+
return {
|
|
94
|
+
isActive: false,
|
|
95
|
+
triggerStyle: {},
|
|
96
|
+
timer: null,
|
|
97
|
+
_bodyEl: undefined // Used to append to body
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
computed: {
|
|
101
|
+
rootClasses() {
|
|
102
|
+
return ['b-tooltip', this.type, this.position, this.size, {
|
|
103
|
+
'is-square': this.square,
|
|
104
|
+
'is-always': this.always,
|
|
105
|
+
'is-multiline': this.multilined,
|
|
106
|
+
'is-dashed': this.dashed
|
|
107
|
+
}]
|
|
108
|
+
},
|
|
109
|
+
newAnimation() {
|
|
110
|
+
return this.animated ? this.animation : undefined
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
watch: {
|
|
114
|
+
isActive() {
|
|
115
|
+
this.$emit(this.isActive ? 'open' : 'close')
|
|
116
|
+
if (this.appendToBody) {
|
|
117
|
+
this.updateAppendToBody()
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
methods: {
|
|
122
|
+
updateAppendToBody() {
|
|
123
|
+
const tooltip = this.$refs.tooltip
|
|
124
|
+
const trigger = this.$refs.trigger
|
|
125
|
+
if (tooltip && trigger) {
|
|
126
|
+
// update wrapper tooltip
|
|
127
|
+
const tooltipEl = this.$data._bodyEl.children[0]
|
|
128
|
+
tooltipEl.classList.forEach((item) => tooltipEl.classList.remove(item))
|
|
129
|
+
if (
|
|
130
|
+
this.$vnode &&
|
|
131
|
+
this.$vnode.data &&
|
|
132
|
+
this.$vnode.data.staticClass
|
|
133
|
+
) {
|
|
134
|
+
tooltipEl.classList.add(this.$vnode.data.staticClass)
|
|
135
|
+
}
|
|
136
|
+
this.rootClasses.forEach((item) => {
|
|
137
|
+
if (typeof item === 'object') {
|
|
138
|
+
for (let key in item) {
|
|
139
|
+
if (item[key]) {
|
|
140
|
+
tooltipEl.classList.add(key)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
tooltipEl.classList.add(item)
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
const rect = trigger.getBoundingClientRect()
|
|
149
|
+
|
|
150
|
+
let top = rect.top + window.scrollY
|
|
151
|
+
let left = rect.left + window.scrollX
|
|
152
|
+
|
|
153
|
+
const quaterHeight = trigger.clientHeight / 2 / 2
|
|
154
|
+
|
|
155
|
+
switch (this.position) {
|
|
156
|
+
case 'is-top':
|
|
157
|
+
tooltipEl.style.width = `${trigger.clientWidth}px`
|
|
158
|
+
tooltipEl.style.height = `0px`
|
|
159
|
+
top -= trigger.clientHeight - quaterHeight
|
|
160
|
+
break
|
|
161
|
+
case 'is-bottom':
|
|
162
|
+
tooltipEl.style.width = `${trigger.clientWidth}px`
|
|
163
|
+
tooltipEl.style.height = `0px`
|
|
164
|
+
top += quaterHeight
|
|
165
|
+
break
|
|
166
|
+
case 'is-left':
|
|
167
|
+
tooltipEl.style.width = `0px`
|
|
168
|
+
tooltipEl.style.height = `${trigger.clientHeight}px`
|
|
169
|
+
break
|
|
170
|
+
case 'is-right':
|
|
171
|
+
tooltipEl.style.width = `0px`
|
|
172
|
+
tooltipEl.style.height = `${trigger.clientHeight}px`
|
|
173
|
+
left += trigger.clientWidth
|
|
174
|
+
break
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const wrapper = this.$data._bodyEl
|
|
178
|
+
wrapper.style.position = 'absolute'
|
|
179
|
+
wrapper.style.top = `${top}px`
|
|
180
|
+
wrapper.style.left = `${left}px`
|
|
181
|
+
wrapper.style.width = `0px`
|
|
182
|
+
wrapper.style.zIndex = this.isActive || this.always ? '99' : '-1'
|
|
183
|
+
this.triggerStyle = {
|
|
184
|
+
zIndex: this.isActive || this.always ? '100' : undefined
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
onClick() {
|
|
189
|
+
if (this.triggers.indexOf('click') < 0) return
|
|
190
|
+
// if not active, toggle after clickOutside event
|
|
191
|
+
// this fixes toggling programmatic
|
|
192
|
+
this.$nextTick(() => {
|
|
193
|
+
setTimeout(() => this.open())
|
|
194
|
+
})
|
|
195
|
+
},
|
|
196
|
+
onHover() {
|
|
197
|
+
if (this.triggers.indexOf('hover') < 0) return
|
|
198
|
+
this.open()
|
|
199
|
+
},
|
|
200
|
+
onContextMenu(e) {
|
|
201
|
+
if (this.triggers.indexOf('contextmenu') < 0) return
|
|
202
|
+
e.preventDefault()
|
|
203
|
+
this.open()
|
|
204
|
+
},
|
|
205
|
+
onFocus() {
|
|
206
|
+
if (this.triggers.indexOf('focus') < 0) return
|
|
207
|
+
this.open()
|
|
208
|
+
},
|
|
209
|
+
open() {
|
|
210
|
+
if (this.delay) {
|
|
211
|
+
this.timer = setTimeout(() => {
|
|
212
|
+
this.isActive = true
|
|
213
|
+
this.timer = null
|
|
214
|
+
}, this.delay)
|
|
215
|
+
} else {
|
|
216
|
+
this.isActive = true
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
close() {
|
|
220
|
+
if (typeof this.autoClose === 'boolean') {
|
|
221
|
+
if (this.autoClose && this.timer) clearTimeout(this.timer)
|
|
222
|
+
if (this.closeDelay) {
|
|
223
|
+
this.timer = setTimeout(() => {
|
|
224
|
+
this.isActive = !this.autoClose
|
|
225
|
+
this.timer = null
|
|
226
|
+
}, this.closeDelay)
|
|
227
|
+
} else {
|
|
228
|
+
this.isActive = !this.autoClose
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* Close tooltip if clicked outside.
|
|
234
|
+
*/
|
|
235
|
+
clickedOutside(event) {
|
|
236
|
+
if (this.isActive) {
|
|
237
|
+
if (Array.isArray(this.autoClose)) {
|
|
238
|
+
if (this.autoClose.includes('outside')) {
|
|
239
|
+
if (!this.isInWhiteList(event.target)) {
|
|
240
|
+
this.isActive = false
|
|
241
|
+
return
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if (this.autoClose.includes('inside')) {
|
|
245
|
+
if (this.isInWhiteList(event.target)) this.isActive = false
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
/**
|
|
251
|
+
* Keypress event that is bound to the document
|
|
252
|
+
*/
|
|
253
|
+
keyPress({ key }) {
|
|
254
|
+
if (this.isActive && (key === 'Escape' || key === 'Esc')) {
|
|
255
|
+
if (Array.isArray(this.autoClose)) {
|
|
256
|
+
if (this.autoClose.indexOf('escape') >= 0) this.isActive = false
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* White-listed items to not close when clicked.
|
|
262
|
+
*/
|
|
263
|
+
isInWhiteList(el) {
|
|
264
|
+
if (el === this.$refs.content) return true
|
|
265
|
+
// All chidren from content
|
|
266
|
+
if (this.$refs.content !== undefined) {
|
|
267
|
+
const children = this.$refs.content.querySelectorAll('*')
|
|
268
|
+
for (const child of children) {
|
|
269
|
+
if (el === child) {
|
|
270
|
+
return true
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return false
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
mounted() {
|
|
278
|
+
if (this.appendToBody && typeof window !== 'undefined') {
|
|
279
|
+
this.$data._bodyEl = createAbsoluteElement(this.$refs.content)
|
|
280
|
+
this.updateAppendToBody()
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
created() {
|
|
284
|
+
if (typeof window !== 'undefined') {
|
|
285
|
+
document.addEventListener('click', this.clickedOutside)
|
|
286
|
+
document.addEventListener('keyup', this.keyPress)
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
beforeDestroy() {
|
|
290
|
+
if (typeof window !== 'undefined') {
|
|
291
|
+
document.removeEventListener('click', this.clickedOutside)
|
|
292
|
+
document.removeEventListener('keyup', this.keyPress)
|
|
293
|
+
}
|
|
294
|
+
if (this.appendToBody) {
|
|
295
|
+
removeElement(this.$data._bodyEl)
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
</script>
|
package/src/utils/config.js
CHANGED