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.
Files changed (230) hide show
  1. package/CHANGELOG.md +1741 -1719
  2. package/dist/buefy.css +15848 -1
  3. package/dist/buefy.esm.js +77 -38
  4. package/dist/buefy.esm.min.js +2 -2
  5. package/dist/buefy.js +77 -38
  6. package/dist/buefy.min.css +1 -1
  7. package/dist/buefy.min.js +2 -2
  8. package/dist/cjs/autocomplete.js +5 -5
  9. package/dist/cjs/breadcrumb.js +1 -1
  10. package/dist/cjs/button.js +3 -3
  11. package/dist/cjs/carousel.js +3 -3
  12. package/dist/cjs/checkbox.js +1 -1
  13. package/dist/cjs/{chunk-5ed8a75a.js → chunk-09574ad9.js} +3 -3
  14. package/dist/cjs/{chunk-7c11fdde.js → chunk-201c9e5c.js} +1 -1
  15. package/dist/cjs/{chunk-545e1c7f.js → chunk-2a96ec68.js} +2 -2
  16. package/dist/cjs/{chunk-9103eeda.js → chunk-437dd7a0.js} +1 -0
  17. package/dist/cjs/{chunk-3b43d77a.js → chunk-5cd29907.js} +1 -1
  18. package/dist/cjs/{chunk-334bc809.js → chunk-7b44db6e.js} +2 -2
  19. package/dist/cjs/{chunk-779e6a5d.js → chunk-85b00a19.js} +8 -8
  20. package/dist/cjs/{chunk-5058e659.js → chunk-95c4b826.js} +3 -3
  21. package/dist/cjs/{chunk-83b41298.js → chunk-99367591.js} +24 -8
  22. package/dist/cjs/{chunk-73f8eef8.js → chunk-a6b29437.js} +1 -1
  23. package/dist/cjs/{chunk-8ef75f09.js → chunk-bcab8905.js} +6 -6
  24. package/dist/cjs/{chunk-54b0042d.js → chunk-befea70a.js} +2 -2
  25. package/dist/cjs/{chunk-4bcfaf1c.js → chunk-cc9676a6.js} +1 -1
  26. package/dist/cjs/{chunk-03279fd8.js → chunk-dddb035c.js} +1 -1
  27. package/dist/cjs/{chunk-e872f5e2.js → chunk-e0373ab6.js} +1 -1
  28. package/dist/cjs/{chunk-1f7e4ed3.js → chunk-e90b3d05.js} +2 -2
  29. package/dist/cjs/{chunk-f5285f14.js → chunk-eba24a95.js} +1 -1
  30. package/dist/cjs/{chunk-e86d3eeb.js → chunk-f5139026.js} +1 -1
  31. package/dist/cjs/{chunk-c8abb3ed.js → chunk-f8eb56c6.js} +2 -2
  32. package/dist/cjs/{chunk-87a116d9.js → chunk-fb8ff6be.js} +1 -2
  33. package/dist/cjs/clockpicker.js +17 -8
  34. package/dist/cjs/colorpicker.js +18 -11
  35. package/dist/cjs/config.js +1 -1
  36. package/dist/cjs/datepicker.js +8 -8
  37. package/dist/cjs/datetimepicker.js +10 -10
  38. package/dist/cjs/dialog.js +4 -4
  39. package/dist/cjs/dropdown.js +2 -2
  40. package/dist/cjs/field.js +2 -2
  41. package/dist/cjs/icon.js +2 -2
  42. package/dist/cjs/image.js +2 -2
  43. package/dist/cjs/index.js +20 -20
  44. package/dist/cjs/input.js +4 -4
  45. package/dist/cjs/loading.js +1 -1
  46. package/dist/cjs/menu.js +3 -3
  47. package/dist/cjs/message.js +3 -3
  48. package/dist/cjs/modal.js +2 -2
  49. package/dist/cjs/notification.js +4 -4
  50. package/dist/cjs/numberinput.js +4 -4
  51. package/dist/cjs/pagination.js +3 -3
  52. package/dist/cjs/progress.js +1 -1
  53. package/dist/cjs/rate.js +2 -2
  54. package/dist/cjs/select.js +4 -4
  55. package/dist/cjs/sidebar.js +16 -16
  56. package/dist/cjs/slider.js +2 -2
  57. package/dist/cjs/snackbar.js +2 -2
  58. package/dist/cjs/steps.js +3 -3
  59. package/dist/cjs/switch.js +1 -1
  60. package/dist/cjs/table.js +19 -12
  61. package/dist/cjs/tabs.js +3 -3
  62. package/dist/cjs/taginput.js +5 -5
  63. package/dist/cjs/timepicker.js +9 -9
  64. package/dist/cjs/toast.js +2 -2
  65. package/dist/cjs/tooltip.js +2 -2
  66. package/dist/cjs/upload.js +2 -2
  67. package/dist/components/autocomplete/index.js +2 -2
  68. package/dist/components/autocomplete/index.min.js +2 -2
  69. package/dist/components/breadcrumb/index.js +2 -1
  70. package/dist/components/breadcrumb/index.min.js +1 -1
  71. package/dist/components/button/index.js +3 -2
  72. package/dist/components/button/index.min.js +2 -2
  73. package/dist/components/carousel/index.js +2 -1
  74. package/dist/components/carousel/index.min.js +2 -2
  75. package/dist/components/checkbox/index.js +2 -2
  76. package/dist/components/checkbox/index.min.js +2 -2
  77. package/dist/components/clockpicker/index.js +13 -4
  78. package/dist/components/clockpicker/index.min.js +2 -2
  79. package/dist/components/collapse/index.js +1 -1
  80. package/dist/components/collapse/index.min.js +1 -1
  81. package/dist/components/colorpicker/index.js +36 -13
  82. package/dist/components/colorpicker/index.min.js +2 -2
  83. package/dist/components/datepicker/index.js +4 -4
  84. package/dist/components/datepicker/index.min.js +2 -2
  85. package/dist/components/datetimepicker/index.js +4 -4
  86. package/dist/components/datetimepicker/index.min.js +2 -2
  87. package/dist/components/dialog/index.js +3 -2
  88. package/dist/components/dialog/index.min.js +2 -2
  89. package/dist/components/dropdown/index.js +2 -1
  90. package/dist/components/dropdown/index.min.js +1 -1
  91. package/dist/components/field/index.js +3 -2
  92. package/dist/components/field/index.min.js +2 -2
  93. package/dist/components/icon/index.js +2 -1
  94. package/dist/components/icon/index.min.js +2 -2
  95. package/dist/components/image/index.js +2 -1
  96. package/dist/components/image/index.min.js +2 -2
  97. package/dist/components/input/index.js +2 -2
  98. package/dist/components/input/index.min.js +2 -2
  99. package/dist/components/loading/index.js +1 -1
  100. package/dist/components/loading/index.min.js +1 -1
  101. package/dist/components/menu/index.js +3 -2
  102. package/dist/components/menu/index.min.js +2 -2
  103. package/dist/components/message/index.js +2 -1
  104. package/dist/components/message/index.min.js +2 -2
  105. package/dist/components/modal/index.js +2 -1
  106. package/dist/components/modal/index.min.js +2 -2
  107. package/dist/components/navbar/index.js +1 -1
  108. package/dist/components/navbar/index.min.js +1 -1
  109. package/dist/components/notification/index.js +2 -1
  110. package/dist/components/notification/index.min.js +2 -2
  111. package/dist/components/numberinput/index.js +2 -2
  112. package/dist/components/numberinput/index.min.js +2 -2
  113. package/dist/components/pagination/index.js +2 -1
  114. package/dist/components/pagination/index.min.js +2 -2
  115. package/dist/components/progress/index.js +2 -1
  116. package/dist/components/progress/index.min.js +2 -2
  117. package/dist/components/radio/index.js +1 -1
  118. package/dist/components/radio/index.min.js +1 -1
  119. package/dist/components/rate/index.js +2 -1
  120. package/dist/components/rate/index.min.js +2 -2
  121. package/dist/components/select/index.js +2 -2
  122. package/dist/components/select/index.min.js +2 -2
  123. package/dist/components/sidebar/index.js +17 -16
  124. package/dist/components/sidebar/index.min.js +1 -1
  125. package/dist/components/skeleton/index.js +1 -1
  126. package/dist/components/skeleton/index.min.js +1 -1
  127. package/dist/components/slider/index.js +25 -8
  128. package/dist/components/slider/index.min.js +2 -2
  129. package/dist/components/snackbar/index.js +2 -1
  130. package/dist/components/snackbar/index.min.js +1 -1
  131. package/dist/components/steps/index.js +2 -1
  132. package/dist/components/steps/index.min.js +2 -2
  133. package/dist/components/switch/index.js +2 -1
  134. package/dist/components/switch/index.min.js +1 -1
  135. package/dist/components/table/index.js +15 -8
  136. package/dist/components/table/index.min.js +2 -2
  137. package/dist/components/tabs/index.js +2 -1
  138. package/dist/components/tabs/index.min.js +2 -2
  139. package/dist/components/tag/index.js +1 -1
  140. package/dist/components/tag/index.min.js +1 -1
  141. package/dist/components/taginput/index.js +2 -2
  142. package/dist/components/taginput/index.min.js +2 -2
  143. package/dist/components/timepicker/index.js +3 -3
  144. package/dist/components/timepicker/index.min.js +2 -2
  145. package/dist/components/toast/index.js +2 -1
  146. package/dist/components/toast/index.min.js +1 -1
  147. package/dist/components/tooltip/index.js +25 -8
  148. package/dist/components/tooltip/index.min.js +2 -2
  149. package/dist/components/upload/index.js +2 -2
  150. package/dist/components/upload/index.min.js +2 -2
  151. package/dist/esm/autocomplete.js +6 -6
  152. package/dist/esm/breadcrumb.js +1 -1
  153. package/dist/esm/button.js +4 -4
  154. package/dist/esm/carousel.js +3 -3
  155. package/dist/esm/checkbox.js +2 -2
  156. package/dist/esm/{chunk-84c6dfd6.js → chunk-17b33cd2.js} +1 -2
  157. package/dist/esm/{chunk-a5e3ae5d.js → chunk-293c457c.js} +6 -6
  158. package/dist/esm/{chunk-d35985c7.js → chunk-33e1434e.js} +1 -1
  159. package/dist/esm/{chunk-690d5be4.js → chunk-493ff0a9.js} +1 -1
  160. package/dist/esm/{chunk-252f2b57.js → chunk-4a2008fa.js} +1 -1
  161. package/dist/esm/{chunk-6adc5c5d.js → chunk-4e788733.js} +2 -2
  162. package/dist/esm/{chunk-43fb1457.js → chunk-6c64686f.js} +8 -8
  163. package/dist/esm/{chunk-262b3f82.js → chunk-6e56b8bc.js} +2 -2
  164. package/dist/esm/{chunk-5435bd9a.js → chunk-7bb9107f.js} +1 -1
  165. package/dist/esm/{chunk-e044aa02.js → chunk-7e17a637.js} +1 -1
  166. package/dist/esm/{chunk-a628d44d.js → chunk-83c8b459.js} +3 -3
  167. package/dist/esm/{chunk-f967f402.js → chunk-9b0b8225.js} +24 -8
  168. package/dist/esm/{chunk-d9232770.js → chunk-a32d1427.js} +1 -1
  169. package/dist/esm/{chunk-598015da.js → chunk-ade5b253.js} +1 -1
  170. package/dist/esm/{chunk-f9eaeac4.js → chunk-b0123b89.js} +2 -2
  171. package/dist/esm/{chunk-58cdbf2b.js → chunk-b5576437.js} +3 -3
  172. package/dist/esm/{chunk-1a4fde6d.js → chunk-c5284276.js} +2 -2
  173. package/dist/esm/{chunk-effa4d25.js → chunk-d46e7ff0.js} +2 -2
  174. package/dist/esm/{chunk-8ed29c41.js → chunk-e92e3389.js} +1 -0
  175. package/dist/esm/{chunk-6d96579e.js → chunk-f32d0228.js} +1 -1
  176. package/dist/esm/clockpicker.js +17 -8
  177. package/dist/esm/colorpicker.js +18 -11
  178. package/dist/esm/config.js +1 -1
  179. package/dist/esm/datepicker.js +9 -9
  180. package/dist/esm/datetimepicker.js +10 -10
  181. package/dist/esm/dialog.js +4 -4
  182. package/dist/esm/dropdown.js +3 -3
  183. package/dist/esm/field.js +3 -3
  184. package/dist/esm/icon.js +3 -3
  185. package/dist/esm/image.js +3 -3
  186. package/dist/esm/index.js +20 -20
  187. package/dist/esm/input.js +5 -5
  188. package/dist/esm/loading.js +1 -1
  189. package/dist/esm/menu.js +3 -3
  190. package/dist/esm/message.js +3 -3
  191. package/dist/esm/modal.js +3 -3
  192. package/dist/esm/notification.js +4 -4
  193. package/dist/esm/numberinput.js +4 -4
  194. package/dist/esm/pagination.js +4 -4
  195. package/dist/esm/progress.js +1 -1
  196. package/dist/esm/rate.js +2 -2
  197. package/dist/esm/select.js +5 -5
  198. package/dist/esm/sidebar.js +16 -16
  199. package/dist/esm/slider.js +2 -2
  200. package/dist/esm/snackbar.js +2 -2
  201. package/dist/esm/steps.js +3 -3
  202. package/dist/esm/switch.js +1 -1
  203. package/dist/esm/table.js +19 -12
  204. package/dist/esm/tabs.js +3 -3
  205. package/dist/esm/taginput.js +5 -5
  206. package/dist/esm/timepicker.js +10 -10
  207. package/dist/esm/toast.js +2 -2
  208. package/dist/esm/tooltip.js +3 -3
  209. package/dist/esm/upload.js +2 -2
  210. package/dist/vetur/attributes.json +9 -1
  211. package/dist/vetur/tags.json +2 -1
  212. package/package.json +1 -1
  213. package/src/components/button/Button.spec.js +14 -0
  214. package/src/components/button/Button.vue +1 -1
  215. package/src/components/checkbox/Checkbox.vue +5 -1
  216. package/src/components/clockpicker/Clockpicker.vue +9 -1
  217. package/src/components/colorpicker/Colorpicker.vue +7 -2
  218. package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +3 -1
  219. package/src/components/datepicker/Datepicker.vue +1 -1
  220. package/src/components/field/Field.vue +1 -0
  221. package/src/components/menu/MenuItem.vue +1 -1
  222. package/src/components/sidebar/Sidebar.spec.js +105 -105
  223. package/src/components/sidebar/Sidebar.vue +303 -303
  224. package/src/components/table/Table.vue +10 -2
  225. package/src/components/table/TableColumn.vue +121 -118
  226. package/src/components/tooltip/Tooltip.vue +299 -288
  227. package/src/scss/components/_dropdown.scss +6 -0
  228. package/src/scss/utils/_helpers.scss +0 -6
  229. package/src/utils/FormElementMixin.js +0 -1
  230. package/src/utils/config.js +1 -0
@@ -1,303 +1,303 @@
1
- <template>
2
- <div class="b-sidebar">
3
- <div
4
- class="sidebar-background"
5
- v-if="overlay && isOpen"
6
- />
7
- <transition
8
- :name="transitionName"
9
- @before-enter="beforeEnter"
10
- @after-enter="afterEnter">
11
- <div
12
- v-show="isOpen"
13
- ref="sidebarContent"
14
- class="sidebar-content"
15
- :class="rootClasses"
16
- @mouseenter="onHover"
17
- @mouseleave="onHoverLeave">
18
- <slot />
19
- </div>
20
- </transition>
21
- </div>
22
- </template>
23
-
24
- <script>
25
- import config from '../../utils/config'
26
- import { removeElement, isCustomElement } from '../../utils/helpers'
27
-
28
- export default {
29
- name: 'BSidebar',
30
- model: {
31
- prop: 'open',
32
- event: 'update:open'
33
- },
34
- props: {
35
- open: Boolean,
36
- type: [String, Object],
37
- overlay: Boolean,
38
- position: {
39
- type: String,
40
- default: 'fixed',
41
- validator: (value) => {
42
- return [
43
- 'fixed',
44
- 'absolute',
45
- 'static'
46
- ].indexOf(value) >= 0
47
- }
48
- },
49
- fullheight: Boolean,
50
- fullwidth: Boolean,
51
- right: Boolean,
52
- mobile: {
53
- type: String
54
- },
55
- reduce: Boolean,
56
- expandOnHover: Boolean,
57
- expandOnHoverFixed: Boolean,
58
- delay: {
59
- type: Number,
60
- default: () => config.defaultSidebarDelay
61
- },
62
- canCancel: {
63
- type: [Array, Boolean],
64
- default: () => ['escape', 'outside']
65
- },
66
- onCancel: {
67
- type: Function,
68
- default: () => {}
69
- },
70
- scroll: {
71
- type: String,
72
- default: () => {
73
- return config.defaultModalScroll
74
- ? config.defaultModalScroll
75
- : 'clip'
76
- },
77
- validator: (value) => {
78
- return [
79
- 'clip',
80
- 'keep'
81
- ].indexOf(value) >= 0
82
- }
83
- }
84
- },
85
- data() {
86
- return {
87
- isOpen: this.open,
88
- isDelayOver: false,
89
- transitionName: null,
90
- animating: true,
91
- savedScrollTop: null,
92
- hasLeaved: false,
93
- whiteList: []
94
- }
95
- },
96
- computed: {
97
- rootClasses() {
98
- return [this.type, {
99
- 'is-fixed': this.isFixed,
100
- 'is-static': this.isStatic,
101
- 'is-absolute': this.isAbsolute,
102
- 'is-fullheight': this.fullheight,
103
- 'is-fullwidth': this.fullwidth,
104
- 'is-right': this.right,
105
- 'is-mini': this.reduce && !this.isDelayOver,
106
- 'is-mini-expand': this.expandOnHover || this.isDelayOver,
107
- 'is-mini-expand-fixed': (this.expandOnHover && this.expandOnHoverFixed) || this.isDelayOver,
108
- 'is-mini-delayed': this.delay !== null,
109
- 'is-mini-mobile': this.mobile === 'reduce',
110
- 'is-hidden-mobile': this.mobile === 'hide',
111
- 'is-fullwidth-mobile': this.mobile === 'fullwidth'
112
- }]
113
- },
114
- cancelOptions() {
115
- return typeof this.canCancel === 'boolean'
116
- ? this.canCancel
117
- ? ['escape', 'outside']
118
- : []
119
- : this.canCancel
120
- },
121
- isStatic() {
122
- return this.position === 'static'
123
- },
124
- isFixed() {
125
- return this.position === 'fixed'
126
- },
127
- isAbsolute() {
128
- return this.position === 'absolute'
129
- }
130
- },
131
- watch: {
132
- open: {
133
- handler(value) {
134
- this.isOpen = value
135
- if (this.overlay) {
136
- this.handleScroll()
137
- }
138
- const open = this.right ? !value : value
139
- this.transitionName = !open ? 'slide-prev' : 'slide-next'
140
- },
141
- immediate: true
142
- }
143
- },
144
- methods: {
145
- /**
146
- * Keypress event that is bound to the document.
147
- */
148
- keyPress({ key }) {
149
- if (this.isFixed) {
150
- if (this.isOpen && (key === 'Escape' || key === 'Esc')) this.cancel('escape')
151
- }
152
- },
153
-
154
- /**
155
- * Close the Sidebar if canCancel and call the onCancel prop (function).
156
- */
157
- cancel(method) {
158
- if (this.cancelOptions.indexOf(method) < 0) return
159
- if (this.isStatic) return
160
-
161
- this.onCancel.apply(null, arguments)
162
- this.close()
163
- },
164
-
165
- /**
166
- * Call the onCancel prop (function) and emit events
167
- */
168
- close() {
169
- this.isOpen = false
170
- this.$emit('close')
171
- this.$emit('update:open', false)
172
- },
173
-
174
- /**
175
- * Close fixed sidebar if clicked outside.
176
- */
177
- clickedOutside(event) {
178
- if (this.isFixed) {
179
- if (this.isOpen && !this.animating) {
180
- const target = isCustomElement(this) ? event.composedPath()[0] : event.target
181
- if (this.whiteList.indexOf(target) < 0) {
182
- this.cancel('outside')
183
- }
184
- }
185
- }
186
- },
187
-
188
- /**
189
- * Transition before-enter hook
190
- */
191
- beforeEnter() {
192
- this.animating = true
193
- },
194
-
195
- /**
196
- * Transition after-leave hook
197
- */
198
- afterEnter() {
199
- this.animating = false
200
- },
201
-
202
- handleScroll() {
203
- if (typeof window === 'undefined') return
204
-
205
- if (this.scroll === 'clip') {
206
- if (this.open) {
207
- document.documentElement.classList.add('is-clipped')
208
- } else {
209
- document.documentElement.classList.remove('is-clipped')
210
- }
211
- return
212
- }
213
-
214
- this.savedScrollTop = !this.savedScrollTop
215
- ? document.documentElement.scrollTop
216
- : this.savedScrollTop
217
-
218
- if (this.open) {
219
- document.body.classList.add('is-noscroll')
220
- } else {
221
- document.body.classList.remove('is-noscroll')
222
- }
223
-
224
- if (this.open) {
225
- document.body.style.top = `-${this.savedScrollTop}px`
226
- return
227
- }
228
-
229
- document.documentElement.scrollTop = this.savedScrollTop
230
- document.body.style.top = null
231
- this.savedScrollTop = null
232
- },
233
- onHover() {
234
- if (this.delay) {
235
- this.hasLeaved = false
236
- this.timer = setTimeout(() => {
237
- if (!this.hasLeaved) {
238
- this.isDelayOver = true
239
- }
240
- this.timer = null
241
- }, this.delay)
242
- } else {
243
- this.isDelayOver = false
244
- }
245
- },
246
- onHoverLeave() {
247
- this.hasLeaved = true
248
- this.timer = null
249
- this.isDelayOver = false
250
- }
251
- },
252
- created() {
253
- if (typeof window !== 'undefined') {
254
- document.addEventListener('keyup', this.keyPress)
255
- document.addEventListener('click', this.clickedOutside)
256
- }
257
- },
258
- mounted() {
259
- if (typeof window !== 'undefined') {
260
- if (this.isFixed) {
261
- document.body.appendChild(this.$el)
262
- }
263
- }
264
- if (this.overlay && this.open) {
265
- this.handleScroll()
266
- }
267
- },
268
- beforeDestroy() {
269
- if (typeof window !== 'undefined') {
270
- document.removeEventListener('keyup', this.keyPress)
271
- document.removeEventListener('click', this.clickedOutside)
272
- if (this.overlay) {
273
- // reset scroll
274
- document.documentElement.classList.remove('is-clipped')
275
- const savedScrollTop = !this.savedScrollTop
276
- ? document.documentElement.scrollTop
277
- : this.savedScrollTop
278
- document.body.classList.remove('is-noscroll')
279
- document.documentElement.scrollTop = savedScrollTop
280
- document.body.style.top = null
281
- }
282
- }
283
- if (this.isFixed) {
284
- removeElement(this.$el)
285
- }
286
- },
287
- beforeUpdate() {
288
- /**
289
- * White-listed items to not close when clicked.
290
- * Add sidebar content and all children.
291
- */
292
- this.whiteList = []
293
- this.whiteList.push(this.$refs.sidebarContent)
294
- // Add all chidren from sidebar
295
- if (this.$refs.sidebarContent !== undefined) {
296
- const children = this.$refs.sidebarContent.querySelectorAll('*')
297
- for (const child of children) {
298
- this.whiteList.push(child)
299
- }
300
- }
301
- }
302
- }
303
- </script>
1
+ <template>
2
+ <div class="b-sidebar">
3
+ <div
4
+ class="sidebar-background"
5
+ v-if="overlay && isOpen"
6
+ />
7
+ <transition
8
+ :name="transitionName"
9
+ @before-enter="beforeEnter"
10
+ @after-enter="afterEnter">
11
+ <div
12
+ v-show="isOpen"
13
+ ref="sidebarContent"
14
+ class="sidebar-content"
15
+ :class="rootClasses"
16
+ @mouseenter="onHover"
17
+ @mouseleave="onHoverLeave">
18
+ <slot />
19
+ </div>
20
+ </transition>
21
+ </div>
22
+ </template>
23
+
24
+ <script>
25
+ import config from '../../utils/config'
26
+ import { removeElement, isCustomElement } from '../../utils/helpers'
27
+
28
+ export default {
29
+ name: 'BSidebar',
30
+ model: {
31
+ prop: 'open',
32
+ event: 'update:open'
33
+ },
34
+ props: {
35
+ open: Boolean,
36
+ type: [String, Object],
37
+ overlay: Boolean,
38
+ position: {
39
+ type: String,
40
+ default: 'fixed',
41
+ validator: (value) => {
42
+ return [
43
+ 'fixed',
44
+ 'absolute',
45
+ 'static'
46
+ ].indexOf(value) >= 0
47
+ }
48
+ },
49
+ fullheight: Boolean,
50
+ fullwidth: Boolean,
51
+ right: Boolean,
52
+ mobile: {
53
+ type: String
54
+ },
55
+ reduce: Boolean,
56
+ expandOnHover: Boolean,
57
+ expandOnHoverFixed: Boolean,
58
+ delay: {
59
+ type: Number,
60
+ default: () => config.defaultSidebarDelay
61
+ },
62
+ canCancel: {
63
+ type: [Array, Boolean],
64
+ default: () => ['escape', 'outside']
65
+ },
66
+ onCancel: {
67
+ type: Function,
68
+ default: () => {}
69
+ },
70
+ scroll: {
71
+ type: String,
72
+ default: () => {
73
+ return config.defaultModalScroll
74
+ ? config.defaultModalScroll
75
+ : 'clip'
76
+ },
77
+ validator: (value) => {
78
+ return [
79
+ 'clip',
80
+ 'keep'
81
+ ].indexOf(value) >= 0
82
+ }
83
+ }
84
+ },
85
+ data() {
86
+ return {
87
+ isOpen: this.open,
88
+ isDelayOver: false,
89
+ transitionName: null,
90
+ animating: true,
91
+ savedScrollTop: null,
92
+ hasLeaved: false,
93
+ whiteList: []
94
+ }
95
+ },
96
+ computed: {
97
+ rootClasses() {
98
+ return [this.type, {
99
+ 'is-fixed': this.isFixed,
100
+ 'is-static': this.isStatic,
101
+ 'is-absolute': this.isAbsolute,
102
+ 'is-fullheight': this.fullheight,
103
+ 'is-fullwidth': this.fullwidth,
104
+ 'is-right': this.right,
105
+ 'is-mini': this.reduce && !this.isDelayOver,
106
+ 'is-mini-expand': this.expandOnHover || this.isDelayOver,
107
+ 'is-mini-expand-fixed': (this.expandOnHover && this.expandOnHoverFixed) || this.isDelayOver,
108
+ 'is-mini-delayed': this.delay !== null,
109
+ 'is-mini-mobile': this.mobile === 'reduce',
110
+ 'is-hidden-mobile': this.mobile === 'hide',
111
+ 'is-fullwidth-mobile': this.mobile === 'fullwidth'
112
+ }]
113
+ },
114
+ cancelOptions() {
115
+ return typeof this.canCancel === 'boolean'
116
+ ? this.canCancel
117
+ ? ['escape', 'outside']
118
+ : []
119
+ : this.canCancel
120
+ },
121
+ isStatic() {
122
+ return this.position === 'static'
123
+ },
124
+ isFixed() {
125
+ return this.position === 'fixed'
126
+ },
127
+ isAbsolute() {
128
+ return this.position === 'absolute'
129
+ }
130
+ },
131
+ watch: {
132
+ open: {
133
+ handler(value) {
134
+ this.isOpen = value
135
+ if (this.overlay) {
136
+ this.handleScroll()
137
+ }
138
+ const open = this.right ? !value : value
139
+ this.transitionName = !open ? 'slide-prev' : 'slide-next'
140
+ },
141
+ immediate: true
142
+ }
143
+ },
144
+ methods: {
145
+ /**
146
+ * Keypress event that is bound to the document.
147
+ */
148
+ keyPress({ key }) {
149
+ if (this.isFixed) {
150
+ if (this.isOpen && (key === 'Escape' || key === 'Esc')) this.cancel('escape')
151
+ }
152
+ },
153
+
154
+ /**
155
+ * Close the Sidebar if canCancel and call the onCancel prop (function).
156
+ */
157
+ cancel(method) {
158
+ if (this.cancelOptions.indexOf(method) < 0) return
159
+ if (this.isStatic) return
160
+
161
+ this.onCancel.apply(null, arguments)
162
+ this.close()
163
+ },
164
+
165
+ /**
166
+ * Call the onCancel prop (function) and emit events
167
+ */
168
+ close() {
169
+ this.isOpen = false
170
+ this.$emit('close')
171
+ this.$emit('update:open', false)
172
+ },
173
+
174
+ /**
175
+ * Close fixed sidebar if clicked outside.
176
+ */
177
+ clickedOutside(event) {
178
+ if (this.isFixed) {
179
+ if (this.isOpen && !this.animating) {
180
+ const target = isCustomElement(this) ? event.composedPath()[0] : event.target
181
+ if (this.whiteList.indexOf(target) < 0) {
182
+ this.cancel('outside')
183
+ }
184
+ }
185
+ }
186
+ },
187
+
188
+ /**
189
+ * Transition before-enter hook
190
+ */
191
+ beforeEnter() {
192
+ this.animating = true
193
+ },
194
+
195
+ /**
196
+ * Transition after-leave hook
197
+ */
198
+ afterEnter() {
199
+ this.animating = false
200
+ },
201
+
202
+ handleScroll() {
203
+ if (typeof window === 'undefined') return
204
+
205
+ if (this.scroll === 'clip') {
206
+ if (this.open) {
207
+ document.documentElement.classList.add('is-clipped')
208
+ } else {
209
+ document.documentElement.classList.remove('is-clipped')
210
+ }
211
+ return
212
+ }
213
+
214
+ this.savedScrollTop = !this.savedScrollTop
215
+ ? document.documentElement.scrollTop
216
+ : this.savedScrollTop
217
+
218
+ if (this.open) {
219
+ document.body.classList.add('is-noscroll')
220
+ } else {
221
+ document.body.classList.remove('is-noscroll')
222
+ }
223
+
224
+ if (this.open) {
225
+ document.body.style.top = `-${this.savedScrollTop}px`
226
+ return
227
+ }
228
+
229
+ document.documentElement.scrollTop = this.savedScrollTop
230
+ document.body.style.top = null
231
+ this.savedScrollTop = null
232
+ },
233
+ onHover() {
234
+ if (this.delay) {
235
+ this.hasLeaved = false
236
+ this.timer = setTimeout(() => {
237
+ if (!this.hasLeaved) {
238
+ this.isDelayOver = true
239
+ }
240
+ this.timer = null
241
+ }, this.delay)
242
+ } else {
243
+ this.isDelayOver = false
244
+ }
245
+ },
246
+ onHoverLeave() {
247
+ this.hasLeaved = true
248
+ this.timer = null
249
+ this.isDelayOver = false
250
+ }
251
+ },
252
+ created() {
253
+ if (typeof window !== 'undefined') {
254
+ document.addEventListener('keyup', this.keyPress)
255
+ document.addEventListener('click', this.clickedOutside)
256
+ }
257
+ },
258
+ mounted() {
259
+ if (typeof window !== 'undefined') {
260
+ if (this.isFixed) {
261
+ document.body.appendChild(this.$el)
262
+ }
263
+ }
264
+ if (this.overlay && this.open) {
265
+ this.handleScroll()
266
+ }
267
+ },
268
+ beforeDestroy() {
269
+ if (typeof window !== 'undefined') {
270
+ document.removeEventListener('keyup', this.keyPress)
271
+ document.removeEventListener('click', this.clickedOutside)
272
+ if (this.overlay) {
273
+ // reset scroll
274
+ document.documentElement.classList.remove('is-clipped')
275
+ const savedScrollTop = !this.savedScrollTop
276
+ ? document.documentElement.scrollTop
277
+ : this.savedScrollTop
278
+ document.body.classList.remove('is-noscroll')
279
+ document.documentElement.scrollTop = savedScrollTop
280
+ document.body.style.top = null
281
+ }
282
+ }
283
+ if (this.isFixed) {
284
+ removeElement(this.$el)
285
+ }
286
+ },
287
+ beforeUpdate() {
288
+ /**
289
+ * White-listed items to not close when clicked.
290
+ * Add sidebar content and all children.
291
+ */
292
+ this.whiteList = []
293
+ this.whiteList.push(this.$refs.sidebarContent)
294
+ // Add all chidren from sidebar
295
+ if (this.$refs.sidebarContent !== undefined) {
296
+ const children = this.$refs.sidebarContent.querySelectorAll('*')
297
+ for (const child of children) {
298
+ this.whiteList.push(child)
299
+ }
300
+ }
301
+ }
302
+ }
303
+ </script>
@@ -66,6 +66,7 @@
66
66
  <b-checkbox
67
67
  autocomplete="off"
68
68
  :value="isAllChecked"
69
+ :type="checkboxType"
69
70
  :disabled="isAllUncheckable"
70
71
  @change.native="checkAll"/>
71
72
  </template>
@@ -148,6 +149,7 @@
148
149
  <b-checkbox
149
150
  autocomplete="off"
150
151
  :value="isAllChecked"
152
+ :type="checkboxType"
151
153
  :disabled="isAllUncheckable"
152
154
  @change.native="checkAll"/>
153
155
  </template>
@@ -256,8 +258,9 @@
256
258
  v-if="checkable && checkboxPosition === 'left'">
257
259
  <b-checkbox
258
260
  autocomplete="off"
259
- :disabled="!isRowCheckable(row)"
260
261
  :value="isRowChecked(row)"
262
+ :type="checkboxType"
263
+ :disabled="!isRowCheckable(row)"
261
264
  @click.native.prevent.stop="checkRow(row, index, $event)"
262
265
  />
263
266
  </td>
@@ -287,8 +290,9 @@
287
290
  v-if="checkable && checkboxPosition === 'right'">
288
291
  <b-checkbox
289
292
  autocomplete="off"
290
- :disabled="!isRowCheckable(row)"
291
293
  :value="isRowChecked(row)"
294
+ :type="checkboxType"
295
+ :disabled="!isRowCheckable(row)"
292
296
  @click.native.prevent.stop="checkRow(row, index, $event)"
293
297
  />
294
298
  </td>
@@ -430,6 +434,10 @@ export default {
430
434
  type: Boolean,
431
435
  default: true
432
436
  },
437
+ checkboxType: {
438
+ type: String,
439
+ default: 'is-primary'
440
+ },
433
441
  checkboxPosition: {
434
442
  type: String,
435
443
  default: 'left',