buefy 0.9.13 → 0.9.14

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/dist/buefy.css +1 -1
  2. package/dist/buefy.esm.js +167 -117
  3. package/dist/buefy.esm.min.js +2 -2
  4. package/dist/buefy.js +168 -116
  5. package/dist/buefy.min.css +1 -1
  6. package/dist/buefy.min.js +2 -2
  7. package/dist/cjs/autocomplete.js +5 -5
  8. package/dist/cjs/breadcrumb.js +1 -1
  9. package/dist/cjs/button.js +3 -3
  10. package/dist/cjs/carousel.js +4 -4
  11. package/dist/cjs/{chunk-c6fbc7b4.js → chunk-02406b6a.js} +2 -2
  12. package/dist/cjs/{chunk-d0f8ea39.js → chunk-0cc2e136.js} +6 -6
  13. package/dist/cjs/{chunk-114191ae.js → chunk-0d901f36.js} +2 -2
  14. package/dist/cjs/{chunk-9e4cf4c5.js → chunk-1061ac68.js} +1 -1
  15. package/dist/cjs/{chunk-2c7de785.js → chunk-1d2f05e0.js} +0 -0
  16. package/dist/cjs/{chunk-30670fac.js → chunk-2a2403f9.js} +78 -62
  17. package/dist/cjs/{chunk-d54e40f6.js → chunk-2cdb1a89.js} +2 -9
  18. package/dist/cjs/{chunk-34949503.js → chunk-4a3a5cf7.js} +1 -1
  19. package/dist/cjs/{chunk-fe2f57ee.js → chunk-4ebee779.js} +2 -2
  20. package/dist/cjs/{chunk-2062216d.js → chunk-5a7e385c.js} +1 -1
  21. package/dist/cjs/{chunk-f5106717.js → chunk-74fb31db.js} +3 -3
  22. package/dist/cjs/{chunk-7da0c017.js → chunk-a267720d.js} +21 -21
  23. package/dist/cjs/{chunk-a11294f9.js → chunk-a268cb3d.js} +2 -2
  24. package/dist/cjs/{chunk-c7b2aa4b.js → chunk-bb7da16a.js} +1 -1
  25. package/dist/cjs/{chunk-2ae50815.js → chunk-bebdaf0b.js} +3 -3
  26. package/dist/cjs/{chunk-9103eeda.js → chunk-c0adb618.js} +1 -1
  27. package/dist/cjs/{chunk-d120e215.js → chunk-d7d30e52.js} +1 -1
  28. package/dist/cjs/{chunk-fefd7b77.js → chunk-ddd15f05.js} +0 -0
  29. package/dist/cjs/{chunk-2911aa4b.js → chunk-e8dc6270.js} +14 -11
  30. package/dist/cjs/{chunk-3cc5d9a6.js → chunk-eb8d954b.js} +0 -0
  31. package/dist/cjs/{chunk-6cb902f8.js → chunk-f536c03f.js} +1 -1
  32. package/dist/cjs/{chunk-61023b09.js → chunk-fbf3566e.js} +2 -2
  33. package/dist/cjs/clockpicker.js +8 -8
  34. package/dist/cjs/config.js +1 -1
  35. package/dist/cjs/datepicker.js +9 -9
  36. package/dist/cjs/datetimepicker.js +11 -11
  37. package/dist/cjs/dialog.js +4 -4
  38. package/dist/cjs/dropdown.js +3 -3
  39. package/dist/cjs/field.js +2 -2
  40. package/dist/cjs/helpers.js +20 -0
  41. package/dist/cjs/icon.js +2 -2
  42. package/dist/cjs/image.js +2 -2
  43. package/dist/cjs/index.js +24 -22
  44. package/dist/cjs/input.js +4 -4
  45. package/dist/cjs/loading.js +2 -2
  46. package/dist/cjs/menu.js +2 -2
  47. package/dist/cjs/message.js +3 -3
  48. package/dist/cjs/modal.js +2 -2
  49. package/dist/cjs/navbar.js +3 -0
  50. package/dist/cjs/notification.js +4 -4
  51. package/dist/cjs/numberinput.js +4 -4
  52. package/dist/cjs/pagination.js +3 -3
  53. package/dist/cjs/progress.js +2 -2
  54. package/dist/cjs/rate.js +2 -2
  55. package/dist/cjs/select.js +4 -4
  56. package/dist/cjs/sidebar.js +1 -1
  57. package/dist/cjs/slider.js +2 -2
  58. package/dist/cjs/snackbar.js +4 -3
  59. package/dist/cjs/steps.js +5 -5
  60. package/dist/cjs/switch.js +1 -1
  61. package/dist/cjs/table.js +24 -22
  62. package/dist/cjs/tabs.js +7 -7
  63. package/dist/cjs/taginput.js +5 -5
  64. package/dist/cjs/timepicker.js +10 -10
  65. package/dist/cjs/toast.js +2 -2
  66. package/dist/cjs/tooltip.js +2 -2
  67. package/dist/cjs/upload.js +21 -7
  68. package/dist/components/autocomplete/index.js +78 -62
  69. package/dist/components/autocomplete/index.min.js +2 -2
  70. package/dist/components/breadcrumb/index.js +2 -2
  71. package/dist/components/breadcrumb/index.min.js +1 -1
  72. package/dist/components/button/index.js +2 -2
  73. package/dist/components/button/index.min.js +2 -2
  74. package/dist/components/carousel/index.js +2 -2
  75. package/dist/components/carousel/index.min.js +2 -2
  76. package/dist/components/checkbox/index.js +1 -1
  77. package/dist/components/checkbox/index.min.js +1 -1
  78. package/dist/components/clockpicker/index.js +22 -22
  79. package/dist/components/clockpicker/index.min.js +2 -2
  80. package/dist/components/collapse/index.js +1 -1
  81. package/dist/components/collapse/index.min.js +1 -1
  82. package/dist/components/datepicker/index.js +29 -26
  83. package/dist/components/datepicker/index.min.js +2 -2
  84. package/dist/components/datetimepicker/index.js +29 -26
  85. package/dist/components/datetimepicker/index.min.js +2 -2
  86. package/dist/components/dialog/index.js +2 -2
  87. package/dist/components/dialog/index.min.js +2 -2
  88. package/dist/components/dropdown/index.js +2 -2
  89. package/dist/components/dropdown/index.min.js +1 -1
  90. package/dist/components/field/index.js +22 -22
  91. package/dist/components/field/index.min.js +1 -1
  92. package/dist/components/icon/index.js +2 -2
  93. package/dist/components/icon/index.min.js +2 -2
  94. package/dist/components/image/index.js +2 -2
  95. package/dist/components/image/index.min.js +2 -2
  96. package/dist/components/input/index.js +2 -2
  97. package/dist/components/input/index.min.js +2 -2
  98. package/dist/components/loading/index.js +1 -1
  99. package/dist/components/loading/index.min.js +1 -1
  100. package/dist/components/menu/index.js +2 -2
  101. package/dist/components/menu/index.min.js +2 -2
  102. package/dist/components/message/index.js +2 -2
  103. package/dist/components/message/index.min.js +2 -2
  104. package/dist/components/modal/index.js +2 -2
  105. package/dist/components/modal/index.min.js +2 -2
  106. package/dist/components/navbar/index.js +4 -1
  107. package/dist/components/navbar/index.min.js +2 -2
  108. package/dist/components/notification/index.js +3 -10
  109. package/dist/components/notification/index.min.js +2 -2
  110. package/dist/components/numberinput/index.js +2 -2
  111. package/dist/components/numberinput/index.min.js +2 -2
  112. package/dist/components/pagination/index.js +2 -2
  113. package/dist/components/pagination/index.min.js +2 -2
  114. package/dist/components/progress/index.js +2 -2
  115. package/dist/components/progress/index.min.js +2 -2
  116. package/dist/components/radio/index.js +1 -1
  117. package/dist/components/radio/index.min.js +1 -1
  118. package/dist/components/rate/index.js +2 -2
  119. package/dist/components/rate/index.min.js +2 -2
  120. package/dist/components/select/index.js +2 -2
  121. package/dist/components/select/index.min.js +2 -2
  122. package/dist/components/sidebar/index.js +2 -2
  123. package/dist/components/sidebar/index.min.js +1 -1
  124. package/dist/components/skeleton/index.js +1 -1
  125. package/dist/components/skeleton/index.min.js +1 -1
  126. package/dist/components/slider/index.js +2 -2
  127. package/dist/components/slider/index.min.js +2 -2
  128. package/dist/components/snackbar/index.js +5 -11
  129. package/dist/components/snackbar/index.min.js +2 -2
  130. package/dist/components/steps/index.js +2 -2
  131. package/dist/components/steps/index.min.js +2 -2
  132. package/dist/components/switch/index.js +2 -2
  133. package/dist/components/switch/index.min.js +1 -1
  134. package/dist/components/table/index.js +36 -16
  135. package/dist/components/table/index.min.js +2 -2
  136. package/dist/components/tabs/index.js +4 -4
  137. package/dist/components/tabs/index.min.js +2 -2
  138. package/dist/components/tag/index.js +1 -1
  139. package/dist/components/tag/index.min.js +1 -1
  140. package/dist/components/taginput/index.js +78 -62
  141. package/dist/components/taginput/index.min.js +2 -2
  142. package/dist/components/timepicker/index.js +22 -22
  143. package/dist/components/timepicker/index.min.js +2 -2
  144. package/dist/components/toast/index.js +3 -10
  145. package/dist/components/toast/index.min.js +2 -2
  146. package/dist/components/tooltip/index.js +2 -2
  147. package/dist/components/tooltip/index.min.js +1 -1
  148. package/dist/components/upload/index.js +21 -7
  149. package/dist/components/upload/index.min.js +2 -2
  150. package/dist/esm/autocomplete.js +6 -6
  151. package/dist/esm/breadcrumb.js +1 -1
  152. package/dist/esm/button.js +4 -4
  153. package/dist/esm/carousel.js +4 -4
  154. package/dist/esm/{chunk-21fc0948.js → chunk-03f0ac1a.js} +6 -6
  155. package/dist/esm/{chunk-b0c0c6b0.js → chunk-0c4e4e90.js} +0 -0
  156. package/dist/esm/{chunk-ae8ab23a.js → chunk-113685dc.js} +3 -3
  157. package/dist/esm/{chunk-71a547bc.js → chunk-1b63211c.js} +1 -1
  158. package/dist/esm/{chunk-d7f92d97.js → chunk-1f41edb4.js} +1 -1
  159. package/dist/esm/{chunk-3773c62d.js → chunk-2229e354.js} +1 -1
  160. package/dist/esm/{chunk-83eb0d37.js → chunk-40f06d9c.js} +2 -2
  161. package/dist/esm/{chunk-75a5af93.js → chunk-590a6902.js} +1 -1
  162. package/dist/esm/{chunk-22e9f916.js → chunk-5f0c3fc4.js} +14 -11
  163. package/dist/esm/{chunk-6019fd7a.js → chunk-79ac4d01.js} +79 -63
  164. package/dist/esm/{chunk-8ed29c41.js → chunk-8cad1844.js} +1 -1
  165. package/dist/esm/{chunk-29ca0df8.js → chunk-91404fa9.js} +0 -0
  166. package/dist/esm/{chunk-b07e3182.js → chunk-97f201e0.js} +21 -21
  167. package/dist/esm/{chunk-c9c58d0c.js → chunk-9e0ae963.js} +0 -0
  168. package/dist/esm/{chunk-ece062a7.js → chunk-a8516afd.js} +2 -2
  169. package/dist/esm/{chunk-4b67a181.js → chunk-b66a83ce.js} +2 -2
  170. package/dist/esm/{chunk-9f7f7441.js → chunk-b99e83bd.js} +1 -1
  171. package/dist/esm/{chunk-18e8b067.js → chunk-bbf5d78a.js} +2 -2
  172. package/dist/esm/{chunk-8d0f95b8.js → chunk-e01e9ef0.js} +3 -3
  173. package/dist/esm/{chunk-799e084d.js → chunk-e7eb83d8.js} +2 -9
  174. package/dist/esm/{chunk-d92f0cd9.js → chunk-ea9bc877.js} +1 -1
  175. package/dist/esm/{chunk-e7c9b2cb.js → chunk-efec59b6.js} +2 -2
  176. package/dist/esm/clockpicker.js +8 -8
  177. package/dist/esm/config.js +1 -1
  178. package/dist/esm/datepicker.js +10 -10
  179. package/dist/esm/datetimepicker.js +11 -11
  180. package/dist/esm/dialog.js +4 -4
  181. package/dist/esm/dropdown.js +4 -4
  182. package/dist/esm/field.js +3 -3
  183. package/dist/esm/helpers.js +19 -1
  184. package/dist/esm/icon.js +3 -3
  185. package/dist/esm/image.js +3 -3
  186. package/dist/esm/index.js +23 -23
  187. package/dist/esm/input.js +5 -5
  188. package/dist/esm/loading.js +3 -3
  189. package/dist/esm/menu.js +2 -2
  190. package/dist/esm/message.js +3 -3
  191. package/dist/esm/modal.js +3 -3
  192. package/dist/esm/navbar.js +3 -0
  193. package/dist/esm/notification.js +4 -4
  194. package/dist/esm/numberinput.js +4 -4
  195. package/dist/esm/pagination.js +4 -4
  196. package/dist/esm/progress.js +2 -2
  197. package/dist/esm/rate.js +2 -2
  198. package/dist/esm/select.js +5 -5
  199. package/dist/esm/sidebar.js +1 -1
  200. package/dist/esm/slider.js +2 -2
  201. package/dist/esm/snackbar.js +4 -3
  202. package/dist/esm/steps.js +5 -5
  203. package/dist/esm/switch.js +1 -1
  204. package/dist/esm/table.js +25 -23
  205. package/dist/esm/tabs.js +7 -7
  206. package/dist/esm/taginput.js +5 -5
  207. package/dist/esm/timepicker.js +11 -11
  208. package/dist/esm/toast.js +2 -2
  209. package/dist/esm/tooltip.js +3 -3
  210. package/dist/esm/upload.js +21 -7
  211. package/dist/vetur/attributes.json +4 -0
  212. package/dist/vetur/tags.json +1 -0
  213. package/package.json +1 -1
  214. package/src/components/autocomplete/Autocomplete.vue +711 -701
  215. package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.js.snap +1 -5
  216. package/src/components/carousel/__snapshots__/CarouselList.spec.js.snap +48 -48
  217. package/src/components/datepicker/DatepickerTableRow.spec.js +26 -0
  218. package/src/components/datepicker/DatepickerTableRow.vue +4 -5
  219. package/src/components/field/Field.vue +271 -271
  220. package/src/components/navbar/NavbarDropdown.vue +4 -0
  221. package/src/components/snackbar/index.js +2 -1
  222. package/src/components/table/Table.spec.js +17 -3
  223. package/src/components/table/Table.vue +8 -9
  224. package/src/components/tabs/Tabs.vue +185 -183
  225. package/src/components/timepicker/__snapshots__/Timepicker.spec.js.snap +18 -47
  226. package/src/components/upload/Upload.vue +19 -7
  227. package/src/utils/NoticeMixin.js +1 -5
  228. package/src/utils/config.js +1 -1
  229. package/src/utils/helpers.js +16 -0
  230. package/types/components.d.ts +5 -0
@@ -1,271 +1,271 @@
1
- <template>
2
- <div class="field" :class="rootClasses">
3
- <div
4
- v-if="horizontal"
5
- class="field-label"
6
- :class="[customClass, fieldLabelSize]">
7
- <label
8
- v-if="hasLabel"
9
- :for="labelFor"
10
- :class="customClass"
11
- class="label" >
12
- <slot v-if="$slots.label" name="label"/>
13
- <template v-else>{{ label }}</template>
14
- </label>
15
- </div>
16
- <template v-else>
17
- <label
18
- v-if="hasLabel"
19
- :for="labelFor"
20
- :class="customClass"
21
- class="label">
22
- <slot v-if="$slots.label" name="label"/>
23
- <template v-else>{{ label }}</template>
24
- </label>
25
- </template>
26
- <b-field-body
27
- v-if="horizontal"
28
- :message="newMessage ? formattedMessage : ''"
29
- :type="newType">
30
- <slot/>
31
- </b-field-body>
32
- <div v-else-if="hasInnerField" class="field-body">
33
- <b-field
34
- :addons="false"
35
- :class="innerFieldClasses">
36
- <slot/>
37
- </b-field>
38
- </div>
39
- <template v-else>
40
- <slot/>
41
- </template>
42
- <p
43
- v-if="hasMessage && !horizontal"
44
- class="help"
45
- :class="newType"
46
- >
47
- <slot v-if="$slots.message" name="message"/>
48
- <template v-else>
49
- <template v-for="(mess, i) in formattedMessage">
50
- {{ mess }}
51
- <br :key="i" v-if="(i + 1) < formattedMessage.length">
52
- </template>
53
- </template>
54
- </p>
55
- </div>
56
- </template>
57
-
58
- <script>
59
- import config from '../../utils/config'
60
- import FieldBody from './FieldBody'
61
-
62
- export default {
63
- name: 'BField',
64
- components: {
65
- [FieldBody.name]: FieldBody
66
- },
67
- provide() {
68
- return {
69
- 'BField': this
70
- }
71
- },
72
- inject: {
73
- parent: {
74
- from: 'BField',
75
- default: false
76
- }
77
- }, // Used internally only when using Field in Field
78
- props: {
79
- type: [String, Object],
80
- label: String,
81
- labelFor: String,
82
- message: [String, Array, Object],
83
- grouped: Boolean,
84
- groupMultiline: Boolean,
85
- position: String,
86
- expanded: Boolean,
87
- horizontal: Boolean,
88
- addons: {
89
- type: Boolean,
90
- default: true
91
- },
92
- customClass: String,
93
- labelPosition: {
94
- type: String,
95
- default: () => { return config.defaultFieldLabelPosition }
96
- }
97
- },
98
- data() {
99
- return {
100
- newType: this.type,
101
- newMessage: this.message,
102
- fieldLabelSize: null,
103
- _isField: true // Used internally by Input and Select
104
- }
105
- },
106
- computed: {
107
- rootClasses() {
108
- return [{
109
- 'is-expanded': this.expanded,
110
- 'is-horizontal': this.horizontal,
111
- 'is-floating-in-label': this.hasLabel && !this.horizontal &&
112
- this.labelPosition === 'inside',
113
- 'is-floating-label': this.hasLabel && !this.horizontal &&
114
- this.labelPosition === 'on-border'
115
- },
116
- this.numberInputClasses]
117
- },
118
- innerFieldClasses() {
119
- return [
120
- this.fieldType(),
121
- this.newPosition,
122
- {
123
- 'is-grouped-multiline': this.groupMultiline
124
- }
125
- ]
126
- },
127
- hasInnerField() {
128
- return this.grouped || this.groupMultiline || this.hasAddons()
129
- },
130
- /**
131
- * Correct Bulma class for the side of the addon or group.
132
- *
133
- * This is not kept like the others (is-small, etc.),
134
- * because since 'has-addons' is set automatically it
135
- * doesn't make sense to teach users what addons are exactly.
136
- */
137
- newPosition() {
138
- if (this.position === undefined) return
139
-
140
- const position = this.position.split('-')
141
- if (position.length < 1) return
142
-
143
- const prefix = this.grouped
144
- ? 'is-grouped-'
145
- : 'has-addons-'
146
-
147
- if (this.position) return prefix + position[1]
148
- },
149
- /**
150
- * Formatted message in case it's an array
151
- * (each element is separated by <br> tag)
152
- */
153
- formattedMessage() {
154
- if (this.parent && this.parent.hasInnerField) {
155
- return '' // Message will be displayed in parent field
156
- }
157
- if (typeof this.newMessage === 'string') {
158
- return [this.newMessage]
159
- }
160
- let messages = []
161
- if (Array.isArray(this.newMessage)) {
162
- this.newMessage.forEach((message) => {
163
- if (typeof message === 'string') {
164
- messages.push(message)
165
- } else {
166
- for (let key in message) {
167
- if (message[key]) {
168
- messages.push(key)
169
- }
170
- }
171
- }
172
- })
173
- } else {
174
- for (let key in this.newMessage) {
175
- if (this.newMessage[key]) {
176
- messages.push(key)
177
- }
178
- }
179
- }
180
- return messages.filter((m) => { if (m) return m })
181
- },
182
- hasLabel() {
183
- return this.label || this.$slots.label
184
- },
185
- hasMessage() {
186
- return ((!this.parent || !this.parent.hasInnerField) && this.newMessage) ||
187
- this.$slots.message
188
- },
189
- numberInputClasses() {
190
- if (this.$slots.default) {
191
- const numberinput = this.$slots.default.filter((node) => node.tag && node.tag.toLowerCase().indexOf('numberinput') >= 0)[0]
192
- if (numberinput) {
193
- const classes = ['has-numberinput']
194
- const controlsPosition = numberinput.componentOptions.propsData.controlsPosition
195
- const size = numberinput.componentOptions.propsData.size
196
- if (controlsPosition) {
197
- classes.push(`has-numberinput-${controlsPosition}`)
198
- }
199
- if (size) {
200
- classes.push(`has-numberinput-${size}`)
201
- }
202
- return classes
203
- }
204
- }
205
- return null
206
- }
207
- },
208
- watch: {
209
- /**
210
- * Set internal type when prop change.
211
- */
212
- type(value) {
213
- this.newType = value
214
- },
215
-
216
- /**
217
- * Set internal message when prop change.
218
- */
219
- message(value) {
220
- this.newMessage = value
221
- },
222
-
223
- /**
224
- * Set parent message if we use Field in Field.
225
- */
226
- newMessage(value) {
227
- if (this.parent && this.parent.hasInnerField) {
228
- if (!this.parent.type) {
229
- this.parent.newType = this.newType
230
- }
231
- if (!this.parent.message) {
232
- this.parent.newMessage = value
233
- }
234
- }
235
- }
236
- },
237
- methods: {
238
- /**
239
- * Field has addons if there are more than one slot
240
- * (element / component) in the Field.
241
- * Or is grouped when prop is set.
242
- * Is a method to be called when component re-render.
243
- */
244
- fieldType() {
245
- if (this.grouped) return 'is-grouped'
246
- if (this.hasAddons()) return 'has-addons'
247
- },
248
- hasAddons() {
249
- let renderedNode = 0
250
- if (this.$slots.default) {
251
- renderedNode = this.$slots.default.reduce((i, node) => node.tag ? i + 1 : i, 0)
252
- }
253
- return (
254
- renderedNode > 1 &&
255
- this.addons &&
256
- !this.horizontal
257
- )
258
- }
259
- },
260
- mounted() {
261
- if (this.horizontal) {
262
- // Bulma docs: .is-normal for any .input or .button
263
- const elements = this.$el.querySelectorAll('.input, .select, .button, .textarea, .b-slider')
264
- if (elements.length > 0) {
265
- this.fieldLabelSize = 'is-normal'
266
- }
267
- }
268
- }
269
- }
270
-
271
- </script>
1
+ <template>
2
+ <div class="field" :class="rootClasses">
3
+ <div
4
+ v-if="horizontal"
5
+ class="field-label"
6
+ :class="[customClass, fieldLabelSize]">
7
+ <label
8
+ v-if="hasLabel"
9
+ :for="labelFor"
10
+ :class="customClass"
11
+ class="label" >
12
+ <slot v-if="$slots.label" name="label"/>
13
+ <template v-else>{{ label }}</template>
14
+ </label>
15
+ </div>
16
+ <template v-else>
17
+ <label
18
+ v-if="hasLabel"
19
+ :for="labelFor"
20
+ :class="customClass"
21
+ class="label">
22
+ <slot v-if="$slots.label" name="label"/>
23
+ <template v-else>{{ label }}</template>
24
+ </label>
25
+ </template>
26
+ <b-field-body
27
+ v-if="horizontal"
28
+ :message="newMessage ? formattedMessage : ''"
29
+ :type="newType">
30
+ <slot/>
31
+ </b-field-body>
32
+ <div v-else-if="hasInnerField" class="field-body">
33
+ <b-field
34
+ :addons="false"
35
+ :class="innerFieldClasses">
36
+ <slot/>
37
+ </b-field>
38
+ </div>
39
+ <template v-else>
40
+ <slot/>
41
+ </template>
42
+ <p
43
+ v-if="hasMessage && !horizontal"
44
+ class="help"
45
+ :class="newType"
46
+ >
47
+ <slot v-if="$slots.message" name="message"/>
48
+ <template v-else>
49
+ <template v-for="(mess, i) in formattedMessage">
50
+ {{ mess }}
51
+ <br :key="i" v-if="(i + 1) < formattedMessage.length">
52
+ </template>
53
+ </template>
54
+ </p>
55
+ </div>
56
+ </template>
57
+
58
+ <script>
59
+ import config from '../../utils/config'
60
+ import FieldBody from './FieldBody'
61
+
62
+ export default {
63
+ name: 'BField',
64
+ components: {
65
+ [FieldBody.name]: FieldBody
66
+ },
67
+ provide() {
68
+ return {
69
+ 'BField': this
70
+ }
71
+ },
72
+ inject: {
73
+ parent: {
74
+ from: 'BField',
75
+ default: false
76
+ }
77
+ }, // Used internally only when using Field in Field
78
+ props: {
79
+ type: [String, Object],
80
+ label: String,
81
+ labelFor: String,
82
+ message: [String, Array, Object],
83
+ grouped: Boolean,
84
+ groupMultiline: Boolean,
85
+ position: String,
86
+ expanded: Boolean,
87
+ horizontal: Boolean,
88
+ addons: {
89
+ type: Boolean,
90
+ default: true
91
+ },
92
+ customClass: String,
93
+ labelPosition: {
94
+ type: String,
95
+ default: () => { return config.defaultFieldLabelPosition }
96
+ }
97
+ },
98
+ data() {
99
+ return {
100
+ newType: this.type,
101
+ newMessage: this.message,
102
+ fieldLabelSize: null,
103
+ _isField: true // Used internally by Input and Select
104
+ }
105
+ },
106
+ computed: {
107
+ rootClasses() {
108
+ return [{
109
+ 'is-expanded': this.expanded,
110
+ 'is-horizontal': this.horizontal,
111
+ 'is-floating-in-label': this.hasLabel && !this.horizontal &&
112
+ this.labelPosition === 'inside',
113
+ 'is-floating-label': this.hasLabel && !this.horizontal &&
114
+ this.labelPosition === 'on-border'
115
+ },
116
+ this.numberInputClasses]
117
+ },
118
+ innerFieldClasses() {
119
+ return [
120
+ this.fieldType(),
121
+ this.newPosition,
122
+ {
123
+ 'is-grouped-multiline': this.groupMultiline
124
+ }
125
+ ]
126
+ },
127
+ hasInnerField() {
128
+ return this.grouped || this.groupMultiline || this.hasAddons()
129
+ },
130
+ /**
131
+ * Correct Bulma class for the side of the addon or group.
132
+ *
133
+ * This is not kept like the others (is-small, etc.),
134
+ * because since 'has-addons' is set automatically it
135
+ * doesn't make sense to teach users what addons are exactly.
136
+ */
137
+ newPosition() {
138
+ if (this.position === undefined) return
139
+
140
+ const position = this.position.split('-')
141
+ if (position.length < 1) return
142
+
143
+ const prefix = this.grouped
144
+ ? 'is-grouped-'
145
+ : 'has-addons-'
146
+
147
+ if (this.position) return prefix + position[1]
148
+ },
149
+ /**
150
+ * Formatted message in case it's an array
151
+ * (each element is separated by <br> tag)
152
+ */
153
+ formattedMessage() {
154
+ if (this.parent && this.parent.hasInnerField) {
155
+ return '' // Message will be displayed in parent field
156
+ }
157
+ if (typeof this.newMessage === 'string') {
158
+ return [this.newMessage]
159
+ }
160
+ let messages = []
161
+ if (Array.isArray(this.newMessage)) {
162
+ this.newMessage.forEach((message) => {
163
+ if (typeof message === 'string') {
164
+ messages.push(message)
165
+ } else {
166
+ for (let key in message) {
167
+ if (message[key]) {
168
+ messages.push(key)
169
+ }
170
+ }
171
+ }
172
+ })
173
+ } else {
174
+ for (let key in this.newMessage) {
175
+ if (this.newMessage[key]) {
176
+ messages.push(key)
177
+ }
178
+ }
179
+ }
180
+ return messages.filter((m) => { if (m) return m })
181
+ },
182
+ hasLabel() {
183
+ return this.label || this.$slots.label
184
+ },
185
+ hasMessage() {
186
+ return ((!this.parent || !this.parent.hasInnerField) && this.newMessage) ||
187
+ this.$slots.message
188
+ },
189
+ numberInputClasses() {
190
+ if (this.$slots.default) {
191
+ const numberinput = this.$slots.default.filter((node) => node.tag && node.tag.toLowerCase().indexOf('numberinput') >= 0)[0]
192
+ if (numberinput) {
193
+ const classes = ['has-numberinput']
194
+ const controlsPosition = numberinput.componentOptions.propsData.controlsPosition
195
+ const size = numberinput.componentOptions.propsData.size
196
+ if (controlsPosition) {
197
+ classes.push(`has-numberinput-${controlsPosition}`)
198
+ }
199
+ if (size) {
200
+ classes.push(`has-numberinput-${size}`)
201
+ }
202
+ return classes
203
+ }
204
+ }
205
+ return null
206
+ }
207
+ },
208
+ watch: {
209
+ /**
210
+ * Set internal type when prop change.
211
+ */
212
+ type(value) {
213
+ this.newType = value
214
+ },
215
+
216
+ /**
217
+ * Set internal message when prop change.
218
+ */
219
+ message(value) {
220
+ this.newMessage = value
221
+ },
222
+
223
+ /**
224
+ * Set parent message if we use Field in Field.
225
+ */
226
+ newMessage(value) {
227
+ if (this.parent && this.parent.hasInnerField) {
228
+ if (!this.parent.type) {
229
+ this.parent.newType = this.newType
230
+ }
231
+ if (!this.parent.message) {
232
+ this.parent.newMessage = value
233
+ }
234
+ }
235
+ }
236
+ },
237
+ methods: {
238
+ /**
239
+ * Field has addons if there are more than one slot
240
+ * (element / component) in the Field.
241
+ * Or is grouped when prop is set.
242
+ * Is a method to be called when component re-render.
243
+ */
244
+ fieldType() {
245
+ if (this.grouped) return 'is-grouped'
246
+ if (this.hasAddons()) return 'has-addons'
247
+ },
248
+ hasAddons() {
249
+ let renderedNode = 0
250
+ if (this.$slots.default) {
251
+ renderedNode = this.$slots.default.reduce((i, node) => node.tag ? i + 1 : i, 0)
252
+ }
253
+ return (
254
+ renderedNode > 1 &&
255
+ this.addons &&
256
+ !this.horizontal
257
+ )
258
+ }
259
+ },
260
+ mounted() {
261
+ if (this.horizontal) {
262
+ // Bulma docs: .is-normal for any .input or .button
263
+ const elements = this.$el.querySelectorAll('.input, .select, .button, .textarea, .b-slider')
264
+ if (elements.length > 0) {
265
+ this.fieldLabelSize = 'is-normal'
266
+ }
267
+ }
268
+ }
269
+ }
270
+
271
+ </script>
@@ -74,6 +74,10 @@ export default {
74
74
  watch: {
75
75
  active(value) {
76
76
  this.newActive = value
77
+ },
78
+
79
+ newActive(value) {
80
+ this.$emit('active-change', value)
77
81
  }
78
82
  },
79
83
  methods: {
@@ -17,7 +17,8 @@ const SnackbarProgrammatic = {
17
17
 
18
18
  const defaultParam = {
19
19
  type: 'is-success',
20
- position: config.defaultSnackbarPosition || 'is-bottom-right'
20
+ position: config.defaultSnackbarPosition || 'is-bottom-right',
21
+ queue: true
21
22
  }
22
23
  if (params.parent) {
23
24
  parent = params.parent
@@ -148,7 +148,7 @@ describe('BTable', () => {
148
148
  describe('Searchable', () => {
149
149
  const data = [
150
150
  { id: 1, name: 'Jesse' },
151
- { id: 2, name: 'John' },
151
+ { id: 2, name: 'João' },
152
152
  { id: 3, name: 'Tina' },
153
153
  { id: 4, name: 'Anne' },
154
154
  { id: 5, name: 'Clarence' }
@@ -191,7 +191,21 @@ describe('BTable', () => {
191
191
  searchInput.vm.$emit('input', 'J')
192
192
  bodyRows = wrapper.findAll('tbody tr')
193
193
 
194
- expect(bodyRows).toHaveLength(2) // Jesse and John
194
+ expect(bodyRows).toHaveLength(2) // Jesse and João
195
+ })
196
+
197
+ it('displays filtered data when searching by name without accent', () => {
198
+ searchInput.vm.$emit('input', 'Joao')
199
+ bodyRows = wrapper.findAll('tbody tr')
200
+
201
+ expect(bodyRows).toHaveLength(1) // João
202
+ })
203
+
204
+ it('displays filtered data when searching by name with accent', () => {
205
+ searchInput.vm.$emit('input', 'João')
206
+ bodyRows = wrapper.findAll('tbody tr')
207
+
208
+ expect(bodyRows).toHaveLength(1) // João
195
209
  })
196
210
 
197
211
  it('displays filtered data when searching and updating data', () => {
@@ -204,7 +218,7 @@ describe('BTable', () => {
204
218
  })
205
219
  bodyRows = wrapper.findAll('tbody tr')
206
220
 
207
- expect(bodyRows).toHaveLength(3) // Jesse, John and Justin
221
+ expect(bodyRows).toHaveLength(3) // Jesse, João and Justin
208
222
  })
209
223
 
210
224
  it('debounce search filtering when debounce-search is defined', () => {
@@ -372,7 +372,7 @@
372
372
  </template>
373
373
 
374
374
  <script>
375
- import { getValueByPath, indexOf, multiColumnSort, escapeRegExpChars, toCssWidth } from '../../utils/helpers'
375
+ import { getValueByPath, indexOf, multiColumnSort, escapeRegExpChars, toCssWidth, removeDiacriticsFromString, isNil } from '../../utils/helpers'
376
376
  import debounce from '../../utils/debounce'
377
377
  import { VueInstance } from '../../utils/config'
378
378
  import Checkbox from '../checkbox/Checkbox'
@@ -908,8 +908,10 @@ export default {
908
908
  return isAsc ? newA - newB : newB - newA
909
909
  }
910
910
 
911
- if (!newA && newA !== 0) return 1
912
- if (!newB && newB !== 0) return -1
911
+ // sort null values to the bottom when in asc order
912
+ // and to the top when in desc order
913
+ if (!isNil(newB) && isNil(newA)) return isAsc ? 1 : -1
914
+ if (!isNil(newA) && isNil(newB)) return isAsc ? -1 : 1
913
915
  if (newA === newB) return 0
914
916
 
915
917
  newA = (typeof newA === 'string')
@@ -1157,11 +1159,7 @@ export default {
1157
1159
 
1158
1160
  isRowFiltered(row) {
1159
1161
  for (const key in this.filters) {
1160
- // remove key if empty
1161
- if (!this.filters[key]) {
1162
- delete this.filters[key]
1163
- return true
1164
- }
1162
+ if (!this.filters[key]) continue
1165
1163
  const input = this.filters[key]
1166
1164
  const column = this.newColumns.filter((c) => c.field === key)[0]
1167
1165
  if (column && column.customSearch && typeof column.customSearch === 'function') {
@@ -1173,7 +1171,8 @@ export default {
1173
1171
  if (value !== Number(input)) return false
1174
1172
  } else {
1175
1173
  const re = new RegExp(escapeRegExpChars(input), 'i')
1176
- if (!re.test(value)) return false
1174
+ const valueWithoutDiacritics = removeDiacriticsFromString(value)
1175
+ return re.test(valueWithoutDiacritics) || re.test(value)
1177
1176
  }
1178
1177
  }
1179
1178
  }