buefy 0.9.13 → 0.9.17
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 +1706 -1639
- package/README.md +1 -1
- package/dist/buefy.css +313 -1
- package/dist/buefy.esm.js +4431 -2331
- package/dist/buefy.esm.min.js +2 -2
- package/dist/buefy.js +4467 -2364
- package/dist/buefy.min.css +1 -1
- package/dist/buefy.min.js +2 -2
- package/dist/cjs/autocomplete.js +5 -5
- package/dist/cjs/button.js +3 -3
- package/dist/cjs/carousel.js +4 -4
- package/dist/cjs/{chunk-34949503.js → chunk-0d6f213f.js} +2 -2
- package/dist/cjs/{chunk-2c7de785.js → chunk-0e3108f5.js} +2 -2
- package/dist/cjs/{chunk-2911aa4b.js → chunk-1438658c.js} +14 -11
- package/dist/cjs/{chunk-114191ae.js → chunk-1f7e4ed3.js} +3 -3
- package/dist/cjs/{chunk-a11294f9.js → chunk-334bc809.js} +1 -1
- package/dist/cjs/chunk-45739695.js +332 -0
- package/dist/cjs/{chunk-c7b2aa4b.js → chunk-4bcfaf1c.js} +0 -0
- package/dist/cjs/{chunk-f5106717.js → chunk-5058e659.js} +3 -3
- package/dist/cjs/{chunk-61023b09.js → chunk-545e1c7f.js} +102 -16
- package/dist/cjs/{chunk-30670fac.js → chunk-54b0042d.js} +19 -3
- package/dist/cjs/{chunk-fe2f57ee.js → chunk-5ed8a75a.js} +2 -2
- package/dist/cjs/{chunk-d120e215.js → chunk-73f8eef8.js} +8 -2
- package/dist/cjs/{chunk-2062216d.js → chunk-7c11fdde.js} +5 -4
- package/dist/cjs/{chunk-3cc5d9a6.js → chunk-841c0e0f.js} +1 -1
- package/dist/cjs/{chunk-9e4cf4c5.js → chunk-87a116d9.js} +0 -0
- package/dist/cjs/{chunk-fefd7b77.js → chunk-a53b7aff.js} +0 -0
- package/dist/cjs/{chunk-d0f8ea39.js → chunk-c0a093d7.js} +7 -7
- package/dist/cjs/{chunk-7da0c017.js → chunk-c8abb3ed.js} +21 -21
- package/dist/cjs/{chunk-c6fbc7b4.js → chunk-d0df905a.js} +15 -2
- package/dist/cjs/{chunk-d54e40f6.js → chunk-e86d3eeb.js} +1 -8
- package/dist/cjs/{chunk-6cb902f8.js → chunk-e872f5e2.js} +1 -1
- package/dist/cjs/{chunk-2ae50815.js → chunk-f5285f14.js} +4 -4
- package/dist/cjs/clockpicker.js +8 -8
- package/dist/cjs/colorpicker.js +1752 -0
- package/dist/cjs/config.js +1 -1
- package/dist/cjs/datepicker.js +11 -11
- package/dist/cjs/datetimepicker.js +30 -14
- package/dist/cjs/dialog.js +5 -5
- package/dist/cjs/dropdown.js +3 -3
- package/dist/cjs/field.js +2 -2
- package/dist/cjs/helpers.js +21 -1
- package/dist/cjs/icon.js +2 -2
- package/dist/cjs/image.js +2 -2
- package/dist/cjs/index.js +27 -22
- package/dist/cjs/input.js +4 -4
- package/dist/cjs/loading.js +5 -5
- package/dist/cjs/menu.js +2 -2
- package/dist/cjs/message.js +4 -9
- package/dist/cjs/modal.js +5 -5
- package/dist/cjs/navbar.js +4 -1
- package/dist/cjs/notification.js +7 -7
- package/dist/cjs/numberinput.js +30 -21
- package/dist/cjs/pagination.js +7 -7
- package/dist/cjs/progress.js +3 -3
- package/dist/cjs/rate.js +2 -2
- package/dist/cjs/select.js +4 -4
- package/dist/cjs/sidebar.js +1 -1
- package/dist/cjs/slider.js +3 -3
- package/dist/cjs/snackbar.js +5 -4
- package/dist/cjs/steps.js +5 -5
- package/dist/cjs/table.js +157 -146
- package/dist/cjs/tabs.js +7 -7
- package/dist/cjs/taginput.js +5 -5
- package/dist/cjs/timepicker.js +12 -12
- package/dist/cjs/toast.js +3 -3
- package/dist/cjs/tooltip.js +4 -4
- package/dist/cjs/upload.js +23 -9
- package/dist/components/autocomplete/index.js +24 -2
- package/dist/components/autocomplete/index.min.js +2 -2
- package/dist/components/breadcrumb/index.js +1 -1
- package/dist/components/breadcrumb/index.min.js +1 -1
- package/dist/components/button/index.js +8 -2
- package/dist/components/button/index.min.js +2 -2
- package/dist/components/carousel/index.js +8 -2
- package/dist/components/carousel/index.min.js +2 -2
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/checkbox/index.min.js +1 -1
- package/dist/components/clockpicker/index.js +41 -22
- 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 +4318 -0
- package/dist/components/colorpicker/index.min.js +2 -0
- package/dist/components/datepicker/index.js +48 -26
- package/dist/components/datepicker/index.min.js +2 -2
- package/dist/components/datetimepicker/index.js +66 -28
- package/dist/components/datetimepicker/index.min.js +2 -2
- package/dist/components/dialog/index.js +8 -2
- package/dist/components/dialog/index.min.js +2 -2
- package/dist/components/dropdown/index.js +14 -1
- package/dist/components/dropdown/index.min.js +2 -2
- package/dist/components/field/index.js +21 -21
- package/dist/components/field/index.min.js +1 -1
- package/dist/components/icon/index.js +8 -2
- package/dist/components/icon/index.min.js +2 -2
- package/dist/components/image/index.js +1 -1
- package/dist/components/image/index.min.js +1 -1
- package/dist/components/input/index.js +8 -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 +8 -2
- package/dist/components/menu/index.min.js +2 -2
- package/dist/components/message/index.js +11 -9
- package/dist/components/message/index.min.js +2 -2
- package/dist/components/modal/index.js +1 -1
- package/dist/components/modal/index.min.js +1 -1
- package/dist/components/navbar/index.js +4 -1
- package/dist/components/navbar/index.min.js +2 -2
- package/dist/components/notification/index.js +13 -13
- package/dist/components/notification/index.min.js +2 -2
- package/dist/components/numberinput/index.js +34 -19
- package/dist/components/numberinput/index.min.js +2 -2
- package/dist/components/pagination/index.js +107 -16
- package/dist/components/pagination/index.min.js +2 -2
- package/dist/components/progress/index.js +2 -2
- 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 +8 -2
- package/dist/components/rate/index.min.js +2 -2
- package/dist/components/select/index.js +8 -2
- package/dist/components/select/index.min.js +2 -2
- package/dist/components/sidebar/index.js +1 -1
- 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 +2 -2
- package/dist/components/slider/index.min.js +2 -2
- package/dist/components/snackbar/index.js +4 -10
- package/dist/components/snackbar/index.min.js +2 -2
- package/dist/components/steps/index.js +8 -2
- package/dist/components/steps/index.min.js +2 -2
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.min.js +1 -1
- package/dist/components/table/index.js +253 -133
- package/dist/components/table/index.min.js +2 -2
- package/dist/components/tabs/index.js +10 -4
- 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 +24 -2
- package/dist/components/taginput/index.min.js +2 -2
- package/dist/components/timepicker/index.js +41 -22
- package/dist/components/timepicker/index.min.js +2 -2
- package/dist/components/toast/index.js +2 -9
- package/dist/components/toast/index.min.js +2 -2
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/tooltip/index.min.js +2 -2
- package/dist/components/upload/index.js +20 -6
- package/dist/components/upload/index.min.js +2 -2
- package/dist/esm/autocomplete.js +6 -6
- package/dist/esm/button.js +4 -4
- package/dist/esm/carousel.js +4 -4
- package/dist/esm/{chunk-18e8b067.js → chunk-1a4fde6d.js} +102 -17
- package/dist/esm/{chunk-3773c62d.js → chunk-22cf6667.js} +2 -2
- package/dist/esm/{chunk-ece062a7.js → chunk-262b3f82.js} +1 -1
- package/dist/esm/chunk-455cdeae.js +317 -0
- package/dist/esm/{chunk-d7f92d97.js → chunk-5435bd9a.js} +5 -4
- package/dist/esm/{chunk-e7c9b2cb.js → chunk-58cdbf2b.js} +2 -2
- package/dist/esm/{chunk-29ca0df8.js → chunk-60a03517.js} +1 -1
- package/dist/esm/{chunk-21fc0948.js → chunk-66cef090.js} +7 -7
- package/dist/esm/{chunk-71a547bc.js → chunk-690d5be4.js} +1 -1
- package/dist/esm/{chunk-83eb0d37.js → chunk-6adc5c5d.js} +3 -3
- package/dist/esm/{chunk-c9c58d0c.js → chunk-6d0f2352.js} +0 -0
- package/dist/esm/{chunk-8d0f95b8.js → chunk-6d96579e.js} +4 -4
- package/dist/esm/{chunk-22e9f916.js → chunk-6fb4a069.js} +14 -11
- package/dist/esm/{chunk-75a5af93.js → chunk-84c6dfd6.js} +0 -0
- package/dist/esm/{chunk-ae8ab23a.js → chunk-a628d44d.js} +3 -3
- package/dist/esm/{chunk-b0c0c6b0.js → chunk-c9c18b2f.js} +0 -0
- package/dist/esm/{chunk-9f7f7441.js → chunk-d35985c7.js} +0 -0
- package/dist/esm/{chunk-799e084d.js → chunk-d9232770.js} +1 -8
- package/dist/esm/{chunk-4b67a181.js → chunk-dbd43ef1.js} +15 -2
- package/dist/esm/{chunk-d92f0cd9.js → chunk-e044aa02.js} +8 -2
- package/dist/esm/{chunk-b07e3182.js → chunk-effa4d25.js} +21 -21
- package/dist/esm/{chunk-6019fd7a.js → chunk-f9eaeac4.js} +19 -3
- package/dist/esm/clockpicker.js +8 -8
- package/dist/esm/colorpicker.js +1748 -0
- package/dist/esm/config.js +1 -1
- package/dist/esm/datepicker.js +10 -10
- package/dist/esm/datetimepicker.js +29 -13
- package/dist/esm/dialog.js +4 -4
- package/dist/esm/dropdown.js +4 -4
- package/dist/esm/field.js +3 -3
- package/dist/esm/helpers.js +20 -2
- package/dist/esm/icon.js +3 -3
- package/dist/esm/image.js +3 -3
- package/dist/esm/index.js +94 -91
- package/dist/esm/input.js +5 -5
- package/dist/esm/loading.js +3 -3
- package/dist/esm/menu.js +2 -2
- package/dist/esm/message.js +3 -8
- package/dist/esm/modal.js +3 -3
- package/dist/esm/navbar.js +4 -1
- package/dist/esm/notification.js +5 -5
- package/dist/esm/numberinput.js +30 -21
- package/dist/esm/pagination.js +4 -4
- package/dist/esm/progress.js +3 -3
- package/dist/esm/rate.js +2 -2
- package/dist/esm/select.js +5 -5
- package/dist/esm/sidebar.js +1 -1
- package/dist/esm/slider.js +2 -2
- package/dist/esm/snackbar.js +4 -3
- package/dist/esm/steps.js +5 -5
- package/dist/esm/table.js +155 -144
- package/dist/esm/tabs.js +7 -7
- package/dist/esm/taginput.js +5 -5
- package/dist/esm/timepicker.js +11 -11
- package/dist/esm/toast.js +2 -2
- package/dist/esm/tooltip.js +3 -3
- package/dist/esm/upload.js +21 -7
- package/dist/vetur/attributes.json +96 -0
- package/dist/vetur/tags.json +30 -1
- package/package.json +1 -1
- package/src/components/autocomplete/Autocomplete.vue +10 -0
- package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.js.snap +1 -5
- package/src/components/carousel/__snapshots__/CarouselList.spec.js.snap +48 -48
- package/src/components/colorpicker/Colorpicker.spec.js +10 -0
- package/src/components/colorpicker/Colorpicker.vue +354 -0
- package/src/components/colorpicker/ColorpickerAlphaSlider.spec.js +14 -0
- package/src/components/colorpicker/ColorpickerAlphaSlider.vue +194 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.spec.js +22 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.vue +366 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.spec.js +22 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +442 -0
- package/src/components/colorpicker/__snapshots__/ColorPickerHSLRepresentationSquare.spec.js.snap +12 -0
- package/src/components/colorpicker/__snapshots__/Colorpicker.spec.js.snap +32 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerAlphaSlider.spec.js.snap +11 -0
- package/src/components/colorpicker/__snapshots__/ColorpickerHSLRepresentationTriangle.spec.js.snap +36 -0
- package/src/components/colorpicker/index.js +17 -0
- package/src/components/datepicker/DatepickerTableRow.spec.js +26 -0
- package/src/components/datepicker/DatepickerTableRow.vue +4 -5
- package/src/components/datetimepicker/Datetimepicker.vue +17 -1
- package/src/components/dropdown/Dropdown.vue +13 -0
- package/src/components/field/Field.vue +271 -271
- package/src/components/index.js +2 -0
- package/src/components/message/Message.vue +0 -5
- package/src/components/navbar/NavbarDropdown.vue +4 -0
- package/src/components/notification/Notification.vue +1 -1
- package/src/components/numberinput/Numberinput.spec.js +62 -0
- package/src/components/numberinput/Numberinput.vue +22 -15
- package/src/components/pagination/Pagination.vue +141 -51
- package/src/components/progress/Progress.vue +1 -1
- package/src/components/snackbar/index.js +2 -1
- package/src/components/table/Table.spec.js +17 -3
- package/src/components/table/Table.vue +1436 -1409
- package/src/components/table/TablePagination.vue +10 -2
- package/src/components/tabs/Tabs.vue +2 -0
- package/src/components/timepicker/__snapshots__/Timepicker.spec.js.snap +18 -47
- package/src/components/tooltip/Tooltip.vue +2 -2
- package/src/components/upload/Upload.vue +19 -7
- package/src/scss/buefy.scss +1 -0
- package/src/scss/components/_colorpicker.scss +283 -0
- package/src/scss/components/_pagination.scss +38 -0
- package/src/utils/MessageMixin.js +2 -1
- package/src/utils/NoticeMixin.js +1 -5
- package/src/utils/color.js +441 -0
- package/src/utils/color.spec.js +52 -0
- package/src/utils/helpers.js +16 -0
- package/src/utils/icons.js +7 -1
- package/types/components.d.ts +7 -2
- package/types/helpers.d.ts +2 -1
- package/dist/cjs/chunk-92621ff7.js +0 -141
- package/dist/esm/chunk-2452e3d3.js +0 -134
|
@@ -160,7 +160,8 @@ export default {
|
|
|
160
160
|
return this.newValue
|
|
161
161
|
},
|
|
162
162
|
set(value) {
|
|
163
|
-
|
|
163
|
+
// Parses the number, so that "0" => 0, and "invalid" => null
|
|
164
|
+
let newValue = (Number(value) === 0) ? 0 : (Number(value) || null)
|
|
164
165
|
if (value === '' || value === undefined || value === null) {
|
|
165
166
|
if (this.minNumber !== undefined) {
|
|
166
167
|
newValue = this.minNumber
|
|
@@ -210,9 +211,15 @@ export default {
|
|
|
210
211
|
return typeof this.max === 'string' ? parseFloat(this.max) : this.max
|
|
211
212
|
},
|
|
212
213
|
stepNumber() {
|
|
214
|
+
if (this.newStep === 'any') {
|
|
215
|
+
return 1
|
|
216
|
+
}
|
|
213
217
|
return typeof this.newStep === 'string' ? parseFloat(this.newStep) : this.newStep
|
|
214
218
|
},
|
|
215
219
|
minStepNumber() {
|
|
220
|
+
if (this.newStep === 'any' && typeof this.newMinStep === 'undefined') {
|
|
221
|
+
return 'any'
|
|
222
|
+
}
|
|
216
223
|
const step = typeof this.newMinStep !== 'undefined' ? this.newMinStep : this.newStep
|
|
217
224
|
return typeof step === 'string' ? parseFloat(step) : step
|
|
218
225
|
},
|
|
@@ -254,27 +261,27 @@ export default {
|
|
|
254
261
|
return this.disabled || (control === 'plus' ? this.disabledMax : this.disabledMin)
|
|
255
262
|
},
|
|
256
263
|
decrement() {
|
|
257
|
-
if (
|
|
258
|
-
if (this.
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
return
|
|
262
|
-
}
|
|
263
|
-
this.computedValue = 0
|
|
264
|
+
if (this.computedValue === null || typeof this.computedValue === 'undefined') {
|
|
265
|
+
if (this.maxNumber !== null && typeof this.maxNumber !== 'undefined') {
|
|
266
|
+
this.computedValue = this.maxNumber
|
|
267
|
+
return
|
|
264
268
|
}
|
|
269
|
+
this.computedValue = 0
|
|
270
|
+
}
|
|
271
|
+
if (typeof this.minNumber === 'undefined' || (this.computedValue - this.stepNumber) >= this.minNumber) {
|
|
265
272
|
const value = this.computedValue - this.stepNumber
|
|
266
273
|
this.computedValue = parseFloat(value.toFixed(this.stepDecimals))
|
|
267
274
|
}
|
|
268
275
|
},
|
|
269
276
|
increment() {
|
|
270
|
-
if (
|
|
271
|
-
if (this.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return
|
|
275
|
-
}
|
|
276
|
-
this.computedValue = 0
|
|
277
|
+
if (this.computedValue === null || typeof this.computedValue === 'undefined') {
|
|
278
|
+
if (this.minNumber !== null && typeof this.minNumber !== 'undefined') {
|
|
279
|
+
this.computedValue = this.minNumber
|
|
280
|
+
return
|
|
277
281
|
}
|
|
282
|
+
this.computedValue = 0
|
|
283
|
+
}
|
|
284
|
+
if (typeof this.maxNumber === 'undefined' || (this.computedValue + this.stepNumber) <= this.maxNumber) {
|
|
278
285
|
const value = this.computedValue + this.stepNumber
|
|
279
286
|
this.computedValue = parseFloat(value.toFixed(this.stepDecimals))
|
|
280
287
|
}
|
|
@@ -3,60 +3,78 @@
|
|
|
3
3
|
<slot
|
|
4
4
|
v-if="$scopedSlots.previous"
|
|
5
5
|
name="previous"
|
|
6
|
-
:page="
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
:page="
|
|
7
|
+
getPage(current - 1, {
|
|
8
|
+
disabled: !hasPrev,
|
|
9
|
+
class: 'pagination-previous',
|
|
10
|
+
'aria-label': ariaPreviousLabel,
|
|
11
|
+
})
|
|
12
|
+
"
|
|
13
|
+
>
|
|
11
14
|
<b-icon
|
|
12
15
|
:icon="iconPrev"
|
|
13
16
|
:pack="iconPack"
|
|
14
17
|
both
|
|
15
|
-
aria-hidden="true"/>
|
|
18
|
+
aria-hidden="true" />
|
|
16
19
|
</slot>
|
|
17
20
|
<BPaginationButton
|
|
18
21
|
v-else
|
|
19
22
|
class="pagination-previous"
|
|
20
23
|
:disabled="!hasPrev"
|
|
21
24
|
:page="getPage(current - 1)"
|
|
22
|
-
:aria-label="ariaPreviousLabel"
|
|
25
|
+
:aria-label="ariaPreviousLabel"
|
|
26
|
+
>
|
|
23
27
|
<b-icon
|
|
24
28
|
:icon="iconPrev"
|
|
25
29
|
:pack="iconPack"
|
|
26
30
|
both
|
|
27
|
-
aria-hidden="true"/>
|
|
31
|
+
aria-hidden="true" />
|
|
28
32
|
</BPaginationButton>
|
|
29
33
|
<slot
|
|
30
34
|
v-if="$scopedSlots.next"
|
|
31
35
|
name="next"
|
|
32
|
-
:page="
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
:page="
|
|
37
|
+
getPage(current + 1, {
|
|
38
|
+
disabled: !hasNext,
|
|
39
|
+
class: 'pagination-next',
|
|
40
|
+
'aria-label': ariaNextLabel,
|
|
41
|
+
})
|
|
42
|
+
"
|
|
43
|
+
>
|
|
37
44
|
<b-icon
|
|
38
45
|
:icon="iconNext"
|
|
39
46
|
:pack="iconPack"
|
|
40
47
|
both
|
|
41
|
-
aria-hidden="true"/>
|
|
48
|
+
aria-hidden="true" />
|
|
42
49
|
</slot>
|
|
43
50
|
<BPaginationButton
|
|
44
51
|
v-else
|
|
45
52
|
class="pagination-next"
|
|
46
53
|
:disabled="!hasNext"
|
|
47
54
|
:page="getPage(current + 1)"
|
|
48
|
-
:aria-label="ariaNextLabel"
|
|
55
|
+
:aria-label="ariaNextLabel"
|
|
56
|
+
>
|
|
49
57
|
<b-icon
|
|
50
58
|
:icon="iconNext"
|
|
51
59
|
:pack="iconPack"
|
|
52
60
|
both
|
|
53
|
-
aria-hidden="true"/>
|
|
61
|
+
aria-hidden="true" />
|
|
54
62
|
</BPaginationButton>
|
|
55
63
|
|
|
64
|
+
<div class="control pagination-input">
|
|
65
|
+
<input
|
|
66
|
+
v-if="pageInput"
|
|
67
|
+
class="input"
|
|
68
|
+
:value="inputValue"
|
|
69
|
+
@input="handleAllowableInputPageRange"
|
|
70
|
+
@keypress="handleOnKeyPress"
|
|
71
|
+
:size="pageCount.toString().length"
|
|
72
|
+
:maxlength="pageCount.toString().length"
|
|
73
|
+
>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
56
76
|
<small class="info" v-if="simple">
|
|
57
|
-
<template v-if="perPage == 1">
|
|
58
|
-
{{ firstItem }} / {{ total }}
|
|
59
|
-
</template>
|
|
77
|
+
<template v-if="perPage == 1"> {{ firstItem }} / {{ total }} </template>
|
|
60
78
|
<template v-else>
|
|
61
79
|
{{ firstItem }}-{{ Math.min(current * perPage, total) }} / {{ total }}
|
|
62
80
|
</template>
|
|
@@ -64,37 +82,26 @@
|
|
|
64
82
|
<ul class="pagination-list" v-else>
|
|
65
83
|
<!--First-->
|
|
66
84
|
<li v-if="hasFirst">
|
|
67
|
-
<slot
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<
|
|
72
|
-
v-else
|
|
73
|
-
:page="getPage(1)" />
|
|
85
|
+
<slot v-if="$scopedSlots.default" :page="getPage(1)" />
|
|
86
|
+
<BPaginationButton v-else :page="getPage(1)" />
|
|
87
|
+
</li>
|
|
88
|
+
<li v-if="hasFirstEllipsis">
|
|
89
|
+
<span class="pagination-ellipsis">…</span>
|
|
74
90
|
</li>
|
|
75
|
-
<li v-if="hasFirstEllipsis"><span class="pagination-ellipsis">…</span></li>
|
|
76
91
|
|
|
77
92
|
<!--Pages-->
|
|
78
93
|
<li v-for="page in pagesInRange" :key="page.number">
|
|
79
|
-
<slot
|
|
80
|
-
|
|
81
|
-
:page="page"
|
|
82
|
-
/>
|
|
83
|
-
<BPaginationButton
|
|
84
|
-
v-else
|
|
85
|
-
:page="page" />
|
|
94
|
+
<slot v-if="$scopedSlots.default" :page="page" />
|
|
95
|
+
<BPaginationButton v-else :page="page" />
|
|
86
96
|
</li>
|
|
87
97
|
|
|
88
98
|
<!--Last-->
|
|
89
|
-
<li v-if="hasLastEllipsis"
|
|
99
|
+
<li v-if="hasLastEllipsis">
|
|
100
|
+
<span class="pagination-ellipsis">…</span>
|
|
101
|
+
</li>
|
|
90
102
|
<li v-if="hasLast">
|
|
91
|
-
<slot
|
|
92
|
-
|
|
93
|
-
:page="getPage(pageCount)"
|
|
94
|
-
/>
|
|
95
|
-
<BPaginationButton
|
|
96
|
-
v-else
|
|
97
|
-
:page="getPage(pageCount)" />
|
|
103
|
+
<slot v-if="$scopedSlots.default" :page="getPage(pageCount)" />
|
|
104
|
+
<BPaginationButton v-else :page="getPage(pageCount)" />
|
|
98
105
|
</li>
|
|
99
106
|
</ul>
|
|
100
107
|
</nav>
|
|
@@ -104,6 +111,7 @@
|
|
|
104
111
|
import PaginationButton from './PaginationButton'
|
|
105
112
|
import Icon from '../icon/Icon'
|
|
106
113
|
import config from '../../utils/config'
|
|
114
|
+
import debounce from '../../utils/debounce'
|
|
107
115
|
|
|
108
116
|
export default {
|
|
109
117
|
name: 'BPagination',
|
|
@@ -154,16 +162,29 @@ export default {
|
|
|
154
162
|
ariaNextLabel: String,
|
|
155
163
|
ariaPreviousLabel: String,
|
|
156
164
|
ariaPageLabel: String,
|
|
157
|
-
ariaCurrentLabel: String
|
|
165
|
+
ariaCurrentLabel: String,
|
|
166
|
+
pageInput: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
default: false
|
|
169
|
+
},
|
|
170
|
+
pageInputPosition: String,
|
|
171
|
+
debouncePageInput: [Number, String]
|
|
172
|
+
},
|
|
173
|
+
data() {
|
|
174
|
+
return {
|
|
175
|
+
inputValue: this.current
|
|
176
|
+
}
|
|
158
177
|
},
|
|
159
178
|
computed: {
|
|
160
179
|
rootClasses() {
|
|
161
180
|
return [
|
|
162
181
|
this.order,
|
|
163
182
|
this.size,
|
|
183
|
+
this.pageInputPosition,
|
|
164
184
|
{
|
|
165
185
|
'is-simple': this.simple,
|
|
166
|
-
'is-rounded': this.rounded
|
|
186
|
+
'is-rounded': this.rounded,
|
|
187
|
+
'has-input': this.pageInput
|
|
167
188
|
}
|
|
168
189
|
]
|
|
169
190
|
},
|
|
@@ -199,17 +220,17 @@ export default {
|
|
|
199
220
|
},
|
|
200
221
|
|
|
201
222
|
/**
|
|
202
|
-
|
|
223
|
+
* Check if first page button should be visible.
|
|
203
224
|
*/
|
|
204
225
|
hasFirst() {
|
|
205
|
-
return this.current >=
|
|
226
|
+
return this.current >= 2 + this.beforeCurrent
|
|
206
227
|
},
|
|
207
228
|
|
|
208
229
|
/**
|
|
209
230
|
* Check if first ellipsis should be visible.
|
|
210
231
|
*/
|
|
211
232
|
hasFirstEllipsis() {
|
|
212
|
-
return this.current >=
|
|
233
|
+
return this.current >= this.beforeCurrent + 4
|
|
213
234
|
},
|
|
214
235
|
|
|
215
236
|
/**
|
|
@@ -262,6 +283,20 @@ export default {
|
|
|
262
283
|
*/
|
|
263
284
|
pageCount(value) {
|
|
264
285
|
if (this.current > value) this.last()
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
current(value) {
|
|
289
|
+
this.inputValue = value
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
debouncePageInput: {
|
|
293
|
+
handler(value) {
|
|
294
|
+
this.debounceHandlePageInput = debounce(
|
|
295
|
+
this.handleOnInputPageChange,
|
|
296
|
+
value
|
|
297
|
+
)
|
|
298
|
+
},
|
|
299
|
+
immediate: true
|
|
265
300
|
}
|
|
266
301
|
},
|
|
267
302
|
methods: {
|
|
@@ -272,13 +307,13 @@ export default {
|
|
|
272
307
|
this.changePage(this.current - 1, event)
|
|
273
308
|
},
|
|
274
309
|
/**
|
|
275
|
-
|
|
310
|
+
* Next button click listener.
|
|
276
311
|
*/
|
|
277
312
|
next(event) {
|
|
278
313
|
this.changePage(this.current + 1, event)
|
|
279
314
|
},
|
|
280
315
|
/**
|
|
281
|
-
|
|
316
|
+
* First button click listener.
|
|
282
317
|
*/
|
|
283
318
|
first(event) {
|
|
284
319
|
this.changePage(1, event)
|
|
@@ -292,6 +327,7 @@ export default {
|
|
|
292
327
|
|
|
293
328
|
changePage(num, event) {
|
|
294
329
|
if (this.current === num || num < 1 || num > this.pageCount) return
|
|
330
|
+
|
|
295
331
|
this.$emit('update:current', num)
|
|
296
332
|
this.$emit('change', num)
|
|
297
333
|
|
|
@@ -306,9 +342,12 @@ export default {
|
|
|
306
342
|
number: num,
|
|
307
343
|
isCurrent: this.current === num,
|
|
308
344
|
click: (event) => this.changePage(num, event),
|
|
345
|
+
input: (event, inputNum) => this.changePage(+inputNum, event),
|
|
309
346
|
disabled: options.disabled || false,
|
|
310
347
|
class: options.class || '',
|
|
311
|
-
'aria-label':
|
|
348
|
+
'aria-label':
|
|
349
|
+
options['aria-label'] ||
|
|
350
|
+
this.getAriaPageLabel(num, this.current === num)
|
|
312
351
|
}
|
|
313
352
|
},
|
|
314
353
|
|
|
@@ -319,9 +358,60 @@ export default {
|
|
|
319
358
|
if (this.ariaPageLabel && (!isCurrent || !this.ariaCurrentLabel)) {
|
|
320
359
|
return this.ariaPageLabel + ' ' + pageNumber + '.'
|
|
321
360
|
} else if (this.ariaPageLabel && isCurrent && this.ariaCurrentLabel) {
|
|
322
|
-
return
|
|
361
|
+
return (
|
|
362
|
+
this.ariaCurrentLabel +
|
|
363
|
+
', ' +
|
|
364
|
+
this.ariaPageLabel +
|
|
365
|
+
' ' +
|
|
366
|
+
pageNumber +
|
|
367
|
+
'.'
|
|
368
|
+
)
|
|
323
369
|
}
|
|
324
370
|
return null
|
|
371
|
+
},
|
|
372
|
+
|
|
373
|
+
handleOnInputPageChange(event) {
|
|
374
|
+
this.getPage(this.inputValue).input(event, this.inputValue)
|
|
375
|
+
},
|
|
376
|
+
|
|
377
|
+
handleOnInputDebounce(event) {
|
|
378
|
+
if (this.debouncePageInput) {
|
|
379
|
+
this.debounceHandlePageInput(event)
|
|
380
|
+
} else {
|
|
381
|
+
this.handleOnInputPageChange(event)
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
handleOnKeyPress(event) {
|
|
385
|
+
// --- This is required to only allow numeric inputs for the page input - --- //
|
|
386
|
+
// --- size attribute does not work with input type number. --- //
|
|
387
|
+
let ASCIICode = event.which || event.keyCode
|
|
388
|
+
|
|
389
|
+
if (ASCIICode >= 48 && ASCIICode <= 57) {
|
|
390
|
+
return true
|
|
391
|
+
} else {
|
|
392
|
+
return event.preventDefault()
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
handleAllowableInputPageRange(event) {
|
|
396
|
+
if (+event.target.value > 0 && +event.target.value <= this.pageCount) {
|
|
397
|
+
this.handleOnInputValue(event)
|
|
398
|
+
} else {
|
|
399
|
+
// --- It is nessacery to set inputValue to 1 and then to '' so that the DOM- --- //
|
|
400
|
+
// --- will update the input component even when Backspace is used and then-
|
|
401
|
+
// --- 0 us entered. --- //
|
|
402
|
+
this.inputValue = 1
|
|
403
|
+
this.inputValue = ''
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
handleOnInputValue(event) {
|
|
407
|
+
let inputValue = +event.target.value
|
|
408
|
+
this.inputValue = inputValue
|
|
409
|
+
if (Number.isInteger(this.inputValue)) {
|
|
410
|
+
this.handleOnInputDebounce(event)
|
|
411
|
+
} else {
|
|
412
|
+
// --- if NaN, then set inputValue back to current --- //
|
|
413
|
+
this.inputValue = this.current
|
|
414
|
+
}
|
|
325
415
|
}
|
|
326
416
|
}
|
|
327
417
|
}
|
|
@@ -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: '
|
|
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
|
|
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,
|
|
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', () => {
|