buefy 0.7.9 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/dist/buefy.css +13759 -8263
- package/dist/buefy.js +9073 -14866
- package/dist/buefy.min.css +1 -5
- package/dist/buefy.min.js +2 -2
- package/dist/cjs/autocomplete.js +22 -0
- package/dist/cjs/button.js +106 -0
- package/dist/cjs/checkbox.js +135 -0
- package/dist/cjs/chunk-07fe6fc0.js +247 -0
- package/dist/cjs/chunk-0af453a7.js +105 -0
- package/dist/cjs/chunk-0e89e51b.js +394 -0
- package/dist/cjs/chunk-13e039f5.js +104 -0
- package/dist/cjs/chunk-143d9e6d.js +404 -0
- package/dist/cjs/chunk-19ebd649.js +114 -0
- package/dist/cjs/chunk-1b1231ce.js +94 -0
- package/dist/cjs/chunk-1e6abfcf.js +94 -0
- package/dist/cjs/chunk-28d164b1.js +172 -0
- package/dist/cjs/chunk-3396605d.js +394 -0
- package/dist/cjs/chunk-364a37a0.js +404 -0
- package/dist/cjs/chunk-3b066933.js +103 -0
- package/dist/cjs/chunk-3dffe6e7.js +54 -0
- package/dist/cjs/chunk-4a03b064.js +199 -0
- package/dist/cjs/chunk-50b06939.js +153 -0
- package/dist/cjs/chunk-52623128.js +105 -0
- package/dist/cjs/chunk-53d4f332.js +94 -0
- package/dist/cjs/chunk-544a95da.js +404 -0
- package/dist/cjs/chunk-545f01b1.js +49 -0
- package/dist/cjs/chunk-59b91990.js +64 -0
- package/dist/cjs/chunk-5b2a3329.js +394 -0
- package/dist/cjs/chunk-60061aa8.js +172 -0
- package/dist/cjs/chunk-67658e54.js +404 -0
- package/dist/cjs/chunk-6963026a.js +86 -0
- package/dist/cjs/chunk-6cece6b7.js +140 -0
- package/dist/cjs/chunk-6d6465c1.js +140 -0
- package/dist/cjs/chunk-6e9c0aca.js +94 -0
- package/dist/cjs/chunk-77f69fca.js +106 -0
- package/dist/cjs/chunk-7a25d736.js +114 -0
- package/dist/cjs/chunk-876befa8.js +247 -0
- package/dist/cjs/chunk-8985ffff.js +105 -0
- package/dist/cjs/chunk-8a05c8c9.js +207 -0
- package/dist/cjs/chunk-90407463.js +258 -0
- package/dist/cjs/chunk-956525c9.js +106 -0
- package/dist/cjs/chunk-96ce35a2.js +114 -0
- package/dist/cjs/chunk-9da1d120.js +86 -0
- package/dist/cjs/chunk-9f6a8079.js +54 -0
- package/dist/cjs/chunk-a60dc21d.js +281 -0
- package/dist/cjs/chunk-b628277d.js +199 -0
- package/dist/cjs/chunk-c146745e.js +153 -0
- package/dist/cjs/chunk-c2aec7a9.js +547 -0
- package/dist/cjs/chunk-c9641331.js +86 -0
- package/dist/cjs/chunk-d492406b.js +172 -0
- package/dist/cjs/chunk-e0aa62a0.js +404 -0
- package/dist/cjs/chunk-e45e0329.js +48 -0
- package/dist/cjs/chunk-e5de6583.js +207 -0
- package/dist/cjs/chunk-e85cceb6.js +258 -0
- package/dist/cjs/chunk-ed5addd6.js +547 -0
- package/dist/cjs/chunk-ef4753d5.js +283 -0
- package/dist/cjs/chunk-f0c597f9.js +199 -0
- package/dist/cjs/chunk-f1df1c63.js +9 -0
- package/dist/cjs/chunk-f1ee2f5c.js +207 -0
- package/dist/cjs/chunk-fbd4d545.js +247 -0
- package/dist/cjs/clockpicker.js +447 -0
- package/dist/cjs/collapse.js +102 -0
- package/dist/cjs/datepicker.js +1281 -0
- package/dist/cjs/dialog.js +237 -0
- package/dist/cjs/dropdown.js +19 -0
- package/dist/cjs/field.js +18 -0
- package/dist/cjs/icon.js +17 -0
- package/dist/cjs/index.js +164 -0
- package/dist/cjs/input.js +20 -0
- package/dist/cjs/loading.js +166 -0
- package/dist/cjs/menu.js +231 -0
- package/dist/cjs/message.js +65 -0
- package/dist/cjs/modal.js +48 -0
- package/dist/cjs/navbar.js +258 -0
- package/dist/cjs/notification.js +142 -0
- package/dist/cjs/numberinput.js +191 -0
- package/dist/cjs/pagination.js +19 -0
- package/dist/cjs/progress.js +151 -0
- package/dist/cjs/radio.js +224 -0
- package/dist/cjs/select.js +20 -0
- package/dist/cjs/slider.js +511 -0
- package/dist/cjs/snackbar.js +114 -0
- package/dist/cjs/steps.js +352 -0
- package/dist/cjs/switch.js +144 -0
- package/dist/cjs/table.js +877 -0
- package/dist/cjs/tabs.js +258 -0
- package/dist/cjs/tag.js +63 -0
- package/dist/cjs/taginput.js +297 -0
- package/dist/cjs/timepicker.js +75 -0
- package/dist/cjs/toast.js +89 -0
- package/dist/cjs/tooltip.js +17 -0
- package/dist/cjs/upload.js +210 -0
- package/dist/components/autocomplete/index.js +1084 -2
- package/dist/components/autocomplete/index.min.js +2 -0
- package/dist/components/button/index.js +425 -2
- package/dist/components/button/index.min.js +2 -0
- package/dist/components/checkbox/index.js +342 -2
- package/dist/components/checkbox/index.min.js +2 -0
- package/dist/components/clockpicker/index.js +2340 -2
- package/dist/components/clockpicker/index.min.js +2 -0
- package/dist/components/collapse/index.js +201 -2
- package/dist/components/collapse/index.min.js +2 -0
- package/dist/components/datepicker/index.js +2720 -2
- package/dist/components/datepicker/index.min.js +2 -0
- package/dist/components/dialog/index.js +768 -2
- package/dist/components/dialog/index.min.js +2 -0
- package/dist/components/dropdown/index.js +555 -2
- package/dist/components/dropdown/index.min.js +2 -0
- package/dist/components/field/index.js +447 -2
- package/dist/components/field/index.min.js +2 -0
- package/dist/components/icon/index.js +322 -2
- package/dist/components/icon/index.min.js +2 -0
- package/dist/components/input/index.js +675 -2
- package/dist/components/input/index.min.js +2 -0
- package/dist/components/loading/index.js +282 -2
- package/dist/components/loading/index.min.js +2 -0
- package/dist/components/menu/index.js +550 -2
- package/dist/components/menu/index.min.js +2 -0
- package/dist/components/message/index.js +482 -2
- package/dist/components/message/index.min.js +2 -0
- package/dist/components/modal/index.js +400 -2
- package/dist/components/modal/index.min.js +2 -0
- package/dist/components/navbar/index.js +371 -0
- package/dist/components/navbar/index.min.js +2 -0
- package/dist/components/notification/index.js +705 -2
- package/dist/components/notification/index.min.js +2 -0
- package/dist/components/numberinput/index.js +846 -2
- package/dist/components/numberinput/index.min.js +2 -0
- package/dist/components/pagination/index.js +577 -2
- package/dist/components/pagination/index.min.js +2 -0
- package/dist/components/progress/index.js +250 -0
- package/dist/components/progress/index.min.js +2 -0
- package/dist/components/radio/index.js +323 -2
- package/dist/components/radio/index.min.js +2 -0
- package/dist/components/select/index.js +571 -2
- package/dist/components/select/index.min.js +2 -0
- package/dist/components/slider/index.js +764 -0
- package/dist/components/slider/index.min.js +2 -0
- package/dist/components/snackbar/index.js +397 -2
- package/dist/components/snackbar/index.min.js +2 -0
- package/dist/components/steps/index.js +721 -2
- package/dist/components/steps/index.min.js +2 -0
- package/dist/components/switch/index.js +243 -2
- package/dist/components/switch/index.min.js +2 -0
- package/dist/components/table/index.js +1870 -2
- package/dist/components/table/index.min.js +2 -0
- package/dist/components/tabs/index.js +627 -2
- package/dist/components/tabs/index.min.js +2 -0
- package/dist/components/tag/index.js +262 -2
- package/dist/components/tag/index.min.js +2 -0
- package/dist/components/taginput/index.js +1459 -2
- package/dist/components/taginput/index.min.js +2 -0
- package/dist/components/timepicker/index.js +2053 -2
- package/dist/components/timepicker/index.min.js +2 -0
- package/dist/components/toast/index.js +372 -2
- package/dist/components/toast/index.min.js +2 -0
- package/dist/components/tooltip/index.js +236 -2
- package/dist/components/tooltip/index.min.js +2 -0
- package/dist/components/upload/index.js +501 -2
- package/dist/components/upload/index.min.js +2 -0
- package/dist/esm/autocomplete.js +18 -0
- package/dist/esm/button.js +102 -0
- package/dist/esm/checkbox.js +131 -0
- package/dist/esm/chunk-00e3e67f.js +401 -0
- package/dist/esm/chunk-051f8b06.js +105 -0
- package/dist/esm/chunk-0566c90d.js +152 -0
- package/dist/esm/chunk-07e19446.js +545 -0
- package/dist/esm/chunk-085a700d.js +7 -0
- package/dist/esm/chunk-0ad6938a.js +53 -0
- package/dist/esm/chunk-0e3f4fb5.js +52 -0
- package/dist/esm/chunk-10c85529.js +151 -0
- package/dist/esm/chunk-121b1efa.js +197 -0
- package/dist/esm/chunk-19dad95e.js +256 -0
- package/dist/esm/chunk-231b6066.js +113 -0
- package/dist/esm/chunk-24d1a01f.js +279 -0
- package/dist/esm/chunk-297bff6b.js +393 -0
- package/dist/esm/chunk-2b2ae5c6.js +245 -0
- package/dist/esm/chunk-2cb6f867.js +46 -0
- package/dist/esm/chunk-33717194.js +392 -0
- package/dist/esm/chunk-3b811b77.js +139 -0
- package/dist/esm/chunk-3e47308f.js +104 -0
- package/dist/esm/chunk-411d6eea.js +84 -0
- package/dist/esm/chunk-4535dec5.js +92 -0
- package/dist/esm/chunk-47a5f3a1.js +103 -0
- package/dist/esm/chunk-4a5384da.js +205 -0
- package/dist/esm/chunk-4b663574.js +112 -0
- package/dist/esm/chunk-4d393f09.js +170 -0
- package/dist/esm/chunk-4d695899.js +257 -0
- package/dist/esm/chunk-4f508891.js +171 -0
- package/dist/esm/chunk-531b8274.js +281 -0
- package/dist/esm/chunk-591ee4a2.js +151 -0
- package/dist/esm/chunk-5d3bf82e.js +170 -0
- package/dist/esm/chunk-5e0b0665.js +104 -0
- package/dist/esm/chunk-648b9aa4.js +45 -0
- package/dist/esm/chunk-666940cf.js +546 -0
- package/dist/esm/chunk-67c97e13.js +246 -0
- package/dist/esm/chunk-6844653e.js +401 -0
- package/dist/esm/chunk-699b7cb4.js +245 -0
- package/dist/esm/chunk-6f881e7d.js +51 -0
- package/dist/esm/chunk-7123d158.js +256 -0
- package/dist/esm/chunk-7cf87590.js +60 -0
- package/dist/esm/chunk-823177ac.js +545 -0
- package/dist/esm/chunk-8838757a.js +401 -0
- package/dist/esm/chunk-8ca878c0.js +198 -0
- package/dist/esm/chunk-8fc2e874.js +85 -0
- package/dist/esm/chunk-912ed715.js +92 -0
- package/dist/esm/chunk-92acc21f.js +392 -0
- package/dist/esm/chunk-98e86f40.js +197 -0
- package/dist/esm/chunk-99a1f9df.js +92 -0
- package/dist/esm/chunk-9a776697.js +112 -0
- package/dist/esm/chunk-9e3207cc.js +46 -0
- package/dist/esm/chunk-9ec14e09.js +112 -0
- package/dist/esm/chunk-a5ea70d0.js +205 -0
- package/dist/esm/chunk-ac3f4847.js +138 -0
- package/dist/esm/chunk-b5376f3e.js +92 -0
- package/dist/esm/chunk-b56eb2c8.js +197 -0
- package/dist/esm/chunk-b796d1b2.js +392 -0
- package/dist/esm/chunk-b822a5db.js +205 -0
- package/dist/esm/chunk-b9bdb0e4.js +6 -0
- package/dist/esm/chunk-bfe15983.js +401 -0
- package/dist/esm/chunk-c9039f68.js +104 -0
- package/dist/esm/chunk-cc718c15.js +245 -0
- package/dist/esm/chunk-cca88db8.js +99 -0
- package/dist/esm/chunk-d6200087.js +50 -0
- package/dist/esm/chunk-daeac852.js +138 -0
- package/dist/esm/chunk-db31c548.js +103 -0
- package/dist/esm/chunk-e5568f45.js +84 -0
- package/dist/esm/chunk-e5fce48f.js +59 -0
- package/dist/esm/chunk-e84b4047.js +170 -0
- package/dist/esm/chunk-e8d90b72.js +98 -0
- package/dist/esm/chunk-e932bb68.js +206 -0
- package/dist/esm/chunk-edd8ff91.js +103 -0
- package/dist/esm/chunk-f0465d8d.js +84 -0
- package/dist/esm/chunk-f743d154.js +93 -0
- package/dist/esm/chunk-f8036b32.js +402 -0
- package/dist/esm/chunk-f984748f.js +401 -0
- package/dist/esm/chunk-fd5b0e1e.js +99 -0
- package/dist/esm/clockpicker.js +443 -0
- package/dist/esm/collapse.js +98 -0
- package/dist/esm/datepicker.js +1277 -0
- package/dist/esm/dialog.js +231 -0
- package/dist/esm/dropdown.js +14 -0
- package/dist/esm/field.js +14 -0
- package/dist/esm/icon.js +13 -0
- package/dist/esm/index.js +154 -0
- package/dist/esm/input.js +16 -0
- package/dist/esm/loading.js +159 -0
- package/dist/esm/menu.js +225 -0
- package/dist/esm/message.js +61 -0
- package/dist/esm/modal.js +42 -0
- package/dist/esm/navbar.js +253 -0
- package/dist/esm/notification.js +135 -0
- package/dist/esm/numberinput.js +187 -0
- package/dist/esm/pagination.js +15 -0
- package/dist/esm/progress.js +147 -0
- package/dist/esm/radio.js +219 -0
- package/dist/esm/select.js +16 -0
- package/dist/esm/slider.js +506 -0
- package/dist/esm/snackbar.js +108 -0
- package/dist/esm/steps.js +347 -0
- package/dist/esm/switch.js +140 -0
- package/dist/esm/table.js +872 -0
- package/dist/esm/tabs.js +253 -0
- package/dist/esm/tag.js +59 -0
- package/dist/esm/taginput.js +293 -0
- package/dist/esm/timepicker.js +71 -0
- package/dist/esm/toast.js +83 -0
- package/dist/esm/tooltip.js +13 -0
- package/dist/esm/upload.js +206 -0
- package/package.json +26 -4
- package/src/components/checkbox/Checkbox.vue +12 -4
- package/src/components/checkbox/CheckboxButton.vue +10 -2
- package/src/components/clockpicker/Clockpicker.vue +0 -5
- package/src/components/datepicker/Datepicker.spec.js +60 -0
- package/src/components/datepicker/Datepicker.vue +46 -19
- package/src/components/datepicker/DatepickerTable.spec.js +107 -2
- package/src/components/datepicker/DatepickerTable.vue +73 -4
- package/src/components/datepicker/DatepickerTableRow.spec.js +127 -17
- package/src/components/datepicker/DatepickerTableRow.vue +103 -4
- package/src/components/dialog/Dialog.vue +5 -3
- package/src/components/dialog/index.js +2 -2
- package/src/components/dropdown/Dropdown.vue +1 -4
- package/src/components/dropdown/DropdownItem.vue +7 -3
- package/src/components/field/Field.spec.js +18 -0
- package/src/components/field/Field.vue +21 -2
- package/src/components/index.js +6 -0
- package/src/components/input/Input.vue +2 -2
- package/src/components/loading/index.js +1 -1
- package/src/components/modal/index.js +1 -1
- package/src/components/navbar/NavBar.spec.js +76 -0
- package/src/components/navbar/Navbar.vue +127 -0
- package/src/components/navbar/NavbarBurger.vue +25 -0
- package/src/components/navbar/NavbarItem.vue +21 -0
- package/src/components/navbar/index.js +20 -0
- package/src/components/notification/index.js +1 -1
- package/src/components/pagination/Pagination.vue +28 -6
- package/src/components/progress/Progress.spec.js +77 -0
- package/src/components/progress/Progress.vue +108 -0
- package/src/components/progress/__snapshots__/Progress.spec.js.snap +7 -0
- package/src/components/progress/index.js +17 -0
- package/src/components/radio/Radio.spec.js +18 -1
- package/src/components/radio/Radio.vue +11 -5
- package/src/components/radio/RadioButton.spec.js +18 -1
- package/src/components/radio/RadioButton.vue +20 -8
- package/src/components/select/Select.spec.js +22 -1
- package/src/components/select/Select.vue +2 -1
- package/src/components/select/__snapshots__/Select.spec.js.snap +7 -0
- package/src/components/slider/Slider.spec.js +10 -0
- package/src/components/slider/Slider.vue +240 -0
- package/src/components/slider/SliderThumb.vue +188 -0
- package/src/components/slider/SliderTick.vue +43 -0
- package/src/components/slider/index.js +20 -0
- package/src/components/snackbar/index.js +2 -2
- package/src/components/steps/StepItem.vue +2 -3
- package/src/components/steps/Steps.vue +7 -5
- package/src/components/switch/Switch.spec.js +29 -0
- package/src/components/switch/Switch.vue +29 -5
- package/src/components/switch/__snapshots__/Switch.spec.js.snap +3 -0
- package/src/components/table/Table.vue +30 -8
- package/src/components/table/TableColumn.vue +2 -2
- package/src/components/tag/Tag.vue +4 -1
- package/src/components/taginput/Taginput.spec.js +10 -0
- package/src/components/taginput/Taginput.vue +8 -3
- package/src/components/toast/index.js +2 -2
- package/src/components/tooltip/Tooltip.vue +5 -5
- package/src/components/upload/Upload.vue +15 -8
- package/src/index.js +11 -4
- package/src/scss/buefy-build.scss +3 -3
- package/src/scss/buefy.scss +4 -0
- package/src/scss/components/_datepicker.scss +40 -1
- package/src/scss/components/_form.scss +52 -1
- package/src/scss/components/_progress.scss +45 -0
- package/src/scss/components/_radio.scss +14 -14
- package/src/scss/components/_slider.scss +138 -0
- package/src/scss/components/_steps.scss +4 -4
- package/src/scss/components/_switch.scss +54 -2
- package/src/scss/components/_taginput.scss +3 -0
- package/src/scss/components/_upload.scss +1 -3
- package/src/utils/SlotComponent.js +9 -2
- package/src/utils/TimepickerMixin.js +17 -6
- package/src/utils/config.js +4 -1
- package/src/utils/helpers.spec.js +67 -0
- package/src/utils/plugins.js +2 -1
- package/types/components.d.ts +3 -3
- package/types/index.d.ts +24 -11
- package/dist/components/index.js +0 -2
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="b-slider"
|
|
4
|
+
:class="[size, type, rootClasses]">
|
|
5
|
+
<div
|
|
6
|
+
class="b-slider-track"
|
|
7
|
+
@click="onSliderClick"
|
|
8
|
+
ref="slider">
|
|
9
|
+
<div
|
|
10
|
+
class="b-slider-fill"
|
|
11
|
+
:style="barStyle"/>
|
|
12
|
+
<template v-if="ticks">
|
|
13
|
+
<b-slider-tick
|
|
14
|
+
v-for="(val, key) in tickValues"
|
|
15
|
+
:key="key"
|
|
16
|
+
:value="val"/>
|
|
17
|
+
</template>
|
|
18
|
+
<slot/>
|
|
19
|
+
<b-slider-thumb
|
|
20
|
+
v-model="value1"
|
|
21
|
+
:type="newTooltipType"
|
|
22
|
+
:tooltip="tooltip"
|
|
23
|
+
ref="button1"
|
|
24
|
+
role="slider"
|
|
25
|
+
:aria-valuenow="value1"
|
|
26
|
+
:aria-valuemin="min"
|
|
27
|
+
:aria-valuemax="max"
|
|
28
|
+
aria-orientation="horizontal"
|
|
29
|
+
:aria-label="Array.isArray(ariaLabel) ? ariaLabel[0] : ariaLabel"
|
|
30
|
+
:aria-disabled="disabled"/>
|
|
31
|
+
<b-slider-thumb
|
|
32
|
+
v-model="value2"
|
|
33
|
+
:type="newTooltipType"
|
|
34
|
+
:tooltip="tooltip"
|
|
35
|
+
ref="button2"
|
|
36
|
+
v-if="isRange"
|
|
37
|
+
role="slider"
|
|
38
|
+
:aria-valuenow="value2"
|
|
39
|
+
:aria-valuemin="min"
|
|
40
|
+
:aria-valuemax="max"
|
|
41
|
+
aria-orientation="horizontal"
|
|
42
|
+
:aria-label="Array.isArray(ariaLabel) ? ariaLabel[1] : ''"
|
|
43
|
+
:aria-disabled="disabled"/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import SliderThumb from './SliderThumb'
|
|
50
|
+
import SliderTick from './SliderTick'
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
name: 'BSlider',
|
|
54
|
+
components: {
|
|
55
|
+
[SliderThumb.name]: SliderThumb,
|
|
56
|
+
[SliderTick.name]: SliderTick
|
|
57
|
+
},
|
|
58
|
+
props: {
|
|
59
|
+
value: {
|
|
60
|
+
type: [Number, Array],
|
|
61
|
+
default: 0
|
|
62
|
+
},
|
|
63
|
+
min: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 0
|
|
66
|
+
},
|
|
67
|
+
max: {
|
|
68
|
+
type: Number,
|
|
69
|
+
default: 100
|
|
70
|
+
},
|
|
71
|
+
step: {
|
|
72
|
+
type: Number,
|
|
73
|
+
default: 1
|
|
74
|
+
},
|
|
75
|
+
type: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: 'is-primary'
|
|
78
|
+
},
|
|
79
|
+
size: String,
|
|
80
|
+
ticks: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: false
|
|
83
|
+
},
|
|
84
|
+
tooltip: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: true
|
|
87
|
+
},
|
|
88
|
+
tooltipType: String,
|
|
89
|
+
rounded: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
disabled: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false
|
|
96
|
+
},
|
|
97
|
+
ariaLabel: [String, Array]
|
|
98
|
+
},
|
|
99
|
+
data() {
|
|
100
|
+
return {
|
|
101
|
+
value1: null,
|
|
102
|
+
value2: null,
|
|
103
|
+
dragging: false,
|
|
104
|
+
isRange: false,
|
|
105
|
+
newTooltipType: this.tooltipType ? this.tooltipType : this.type,
|
|
106
|
+
_isSlider: true // Used by Thumb and Tick
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
computed: {
|
|
110
|
+
tickValues() {
|
|
111
|
+
if (!this.ticks || this.min > this.max || this.step === 0) return []
|
|
112
|
+
const result = []
|
|
113
|
+
for (let i = this.min + this.step; i < this.max; i = i + this.step) {
|
|
114
|
+
result.push(i)
|
|
115
|
+
}
|
|
116
|
+
return result
|
|
117
|
+
},
|
|
118
|
+
minValue() {
|
|
119
|
+
return Math.min(this.value1, this.value2)
|
|
120
|
+
},
|
|
121
|
+
maxValue() {
|
|
122
|
+
return Math.max(this.value1, this.value2)
|
|
123
|
+
},
|
|
124
|
+
barSize() {
|
|
125
|
+
return this.isRange
|
|
126
|
+
? `${100 * (this.maxValue - this.minValue) / (this.max - this.min)}%`
|
|
127
|
+
: `${100 * (this.value1 - this.min) / (this.max - this.min)}%`
|
|
128
|
+
},
|
|
129
|
+
barStart() {
|
|
130
|
+
return this.isRange
|
|
131
|
+
? `${100 * (this.minValue - this.min) / (this.max - this.min)}%`
|
|
132
|
+
: '0%'
|
|
133
|
+
},
|
|
134
|
+
precision() {
|
|
135
|
+
const precisions = [this.min, this.max, this.step].map((item) => {
|
|
136
|
+
let decimal = ('' + item).split('.')[1]
|
|
137
|
+
return decimal ? decimal.length : 0
|
|
138
|
+
})
|
|
139
|
+
return Math.max(...precisions)
|
|
140
|
+
},
|
|
141
|
+
barStyle() {
|
|
142
|
+
return {
|
|
143
|
+
width: this.barSize,
|
|
144
|
+
left: this.barStart
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
sliderSize() {
|
|
148
|
+
return this.$refs.slider['clientWidth']
|
|
149
|
+
},
|
|
150
|
+
rootClasses() {
|
|
151
|
+
return {
|
|
152
|
+
'is-rounded': this.rounded,
|
|
153
|
+
'is-dragging': this.dragging,
|
|
154
|
+
'is-disabled': this.disabled
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
watch: {
|
|
159
|
+
/**
|
|
160
|
+
* When v-model is changed set the new active step.
|
|
161
|
+
*/
|
|
162
|
+
value(value) {
|
|
163
|
+
this.setValues(value)
|
|
164
|
+
},
|
|
165
|
+
value1(val) {
|
|
166
|
+
this.isThumbReversed = this.value1 > this.value2
|
|
167
|
+
if (this.isRange) {
|
|
168
|
+
this.$emit('input', [this.minValue, this.maxValue])
|
|
169
|
+
} else {
|
|
170
|
+
this.$emit('input', val)
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
value2(val) {
|
|
174
|
+
this.isThumbReversed = this.value1 > this.value2
|
|
175
|
+
if (this.isRange) {
|
|
176
|
+
this.$emit('input', [this.minValue, this.maxValue])
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
min() {
|
|
180
|
+
this.setValues()
|
|
181
|
+
},
|
|
182
|
+
max() {
|
|
183
|
+
this.setValues()
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
methods: {
|
|
187
|
+
setValues(newValue) {
|
|
188
|
+
if (this.min > this.max) {
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
if (Array.isArray(newValue)) {
|
|
192
|
+
this.isRange = true
|
|
193
|
+
const smallValue = typeof newValue[0] !== 'number' || isNaN(newValue[0])
|
|
194
|
+
? this.min
|
|
195
|
+
: Math.min(Math.max(this.min, newValue[0]), this.max)
|
|
196
|
+
const largeValue = typeof newValue[1] !== 'number' || isNaN(newValue[1])
|
|
197
|
+
? this.max
|
|
198
|
+
: Math.max(Math.min(this.max, newValue[1]), this.min)
|
|
199
|
+
this.value1 = this.isThumbReversed ? largeValue : smallValue
|
|
200
|
+
this.value2 = this.isThumbReversed ? smallValue : largeValue
|
|
201
|
+
} else {
|
|
202
|
+
this.isRange = false
|
|
203
|
+
this.value1 = isNaN(newValue)
|
|
204
|
+
? this.min
|
|
205
|
+
: Math.min(this.max, Math.max(this.min, newValue))
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
onSliderClick(event) {
|
|
209
|
+
if (this.disabled || this.dragging) return
|
|
210
|
+
const sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left
|
|
211
|
+
const percent = (event.clientX - sliderOffsetLeft) / this.sliderSize * 100
|
|
212
|
+
const targetValue = this.min + percent * (this.max - this.min) / 100
|
|
213
|
+
const diffFirst = Math.abs(targetValue - this.value1)
|
|
214
|
+
if (!this.isRange) {
|
|
215
|
+
if (diffFirst < this.step / 2) return
|
|
216
|
+
this.$refs.button1.setPosition(percent)
|
|
217
|
+
} else {
|
|
218
|
+
const diffSecond = Math.abs(targetValue - this.value2)
|
|
219
|
+
if (diffFirst <= diffSecond) {
|
|
220
|
+
if (diffFirst < this.step / 2) return
|
|
221
|
+
this.$refs['button1'].setPosition(percent)
|
|
222
|
+
} else {
|
|
223
|
+
if (diffSecond < this.step / 2) return
|
|
224
|
+
this.$refs['button2'].setPosition(percent)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
this.emitChange()
|
|
228
|
+
},
|
|
229
|
+
emitChange() {
|
|
230
|
+
this.$emit('change', this.isRange
|
|
231
|
+
? [this.minValue, this.maxValue]
|
|
232
|
+
: this.value1)
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
created() {
|
|
236
|
+
this.setValues(this.value)
|
|
237
|
+
this.isThumbReversed = false
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
</script>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="b-slider-thumb-wrapper"
|
|
4
|
+
:class="{ 'is-dragging': dragging }"
|
|
5
|
+
:style="wrapperStyle">
|
|
6
|
+
<b-tooltip
|
|
7
|
+
:label="value.toString()"
|
|
8
|
+
:type="type"
|
|
9
|
+
:always="dragging || isFocused"
|
|
10
|
+
:active="!disabled && tooltip">
|
|
11
|
+
<div
|
|
12
|
+
class="b-slider-thumb"
|
|
13
|
+
:tabindex="disabled ? false : 0"
|
|
14
|
+
v-bind="$attrs"
|
|
15
|
+
@mousedown="onButtonDown"
|
|
16
|
+
@touchstart="onButtonDown"
|
|
17
|
+
@focus="onFocus"
|
|
18
|
+
@blur="onBlur"
|
|
19
|
+
@keydown.left.prevent="onLeftKeyDown"
|
|
20
|
+
@keydown.right.prevent="onRightKeyDown"
|
|
21
|
+
@keydown.down.prevent="onLeftKeyDown"
|
|
22
|
+
@keydown.up.prevent="onRightKeyDown"
|
|
23
|
+
@keydown.home.prevent="onHomeKeyDown"
|
|
24
|
+
@keydown.end.prevent="onEndKeyDown"/>
|
|
25
|
+
</b-tooltip>
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import Tooltip from '../tooltip/Tooltip'
|
|
31
|
+
export default {
|
|
32
|
+
name: 'BSliderThumb',
|
|
33
|
+
components: {
|
|
34
|
+
[Tooltip.name]: Tooltip
|
|
35
|
+
},
|
|
36
|
+
inheritAttrs: false,
|
|
37
|
+
props: {
|
|
38
|
+
value: {
|
|
39
|
+
type: Number,
|
|
40
|
+
default: 0
|
|
41
|
+
},
|
|
42
|
+
type: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: ''
|
|
45
|
+
},
|
|
46
|
+
tooltip: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
data() {
|
|
52
|
+
return {
|
|
53
|
+
isFocused: false,
|
|
54
|
+
dragging: false,
|
|
55
|
+
startX: 0,
|
|
56
|
+
startPosition: 0,
|
|
57
|
+
newPosition: null,
|
|
58
|
+
oldValue: this.value
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
computed: {
|
|
62
|
+
disabled() {
|
|
63
|
+
return this.$parent.disabled
|
|
64
|
+
},
|
|
65
|
+
max() {
|
|
66
|
+
return this.$parent.max
|
|
67
|
+
},
|
|
68
|
+
min() {
|
|
69
|
+
return this.$parent.min
|
|
70
|
+
},
|
|
71
|
+
step() {
|
|
72
|
+
return this.$parent.step
|
|
73
|
+
},
|
|
74
|
+
precision() {
|
|
75
|
+
return this.$parent.precision
|
|
76
|
+
},
|
|
77
|
+
currentPosition() {
|
|
78
|
+
return `${(this.value - this.min) / (this.max - this.min) * 100}%`
|
|
79
|
+
},
|
|
80
|
+
wrapperStyle() {
|
|
81
|
+
return { left: this.currentPosition }
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
watch: {
|
|
85
|
+
dragging(val) {
|
|
86
|
+
this.$parent.dragging = val
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
onFocus() {
|
|
91
|
+
this.isFocused = true
|
|
92
|
+
},
|
|
93
|
+
onBlur() {
|
|
94
|
+
this.isFocused = false
|
|
95
|
+
},
|
|
96
|
+
onButtonDown(event) {
|
|
97
|
+
if (this.disabled) return
|
|
98
|
+
event.preventDefault()
|
|
99
|
+
this.onDragStart(event)
|
|
100
|
+
if (typeof window !== 'undefined') {
|
|
101
|
+
document.addEventListener('mousemove', this.onDragging)
|
|
102
|
+
document.addEventListener('touchmove', this.onDragging)
|
|
103
|
+
document.addEventListener('mouseup', this.onDragEnd)
|
|
104
|
+
document.addEventListener('touchend', this.onDragEnd)
|
|
105
|
+
document.addEventListener('contextmenu', this.onDragEnd)
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
onLeftKeyDown() {
|
|
109
|
+
if (this.disabled || this.value === this.min) return
|
|
110
|
+
this.newPosition = parseFloat(this.currentPosition) -
|
|
111
|
+
this.step / (this.max - this.min) * 100
|
|
112
|
+
this.setPosition(this.newPosition)
|
|
113
|
+
this.$parent.emitChange()
|
|
114
|
+
},
|
|
115
|
+
onRightKeyDown() {
|
|
116
|
+
if (this.disabled || this.value === this.max) return
|
|
117
|
+
this.newPosition = parseFloat(this.currentPosition) +
|
|
118
|
+
this.step / (this.max - this.min) * 100
|
|
119
|
+
this.setPosition(this.newPosition)
|
|
120
|
+
this.$parent.emitChange()
|
|
121
|
+
},
|
|
122
|
+
onHomeKeyDown() {
|
|
123
|
+
if (this.disabled || this.value === this.min) return
|
|
124
|
+
this.newPosition = 0
|
|
125
|
+
this.setPosition(this.newPosition)
|
|
126
|
+
this.$parent.emitChange()
|
|
127
|
+
},
|
|
128
|
+
onEndKeyDown() {
|
|
129
|
+
if (this.disabled || this.value === this.max) return
|
|
130
|
+
this.newPosition = 100
|
|
131
|
+
this.setPosition(this.newPosition)
|
|
132
|
+
this.$parent.emitChange()
|
|
133
|
+
},
|
|
134
|
+
onDragStart(event) {
|
|
135
|
+
this.dragging = true
|
|
136
|
+
if (event.type === 'touchstart') {
|
|
137
|
+
event.clientX = event.touches[0].clientX
|
|
138
|
+
}
|
|
139
|
+
this.startX = event.clientX
|
|
140
|
+
this.startPosition = parseFloat(this.currentPosition)
|
|
141
|
+
this.newPosition = this.startPosition
|
|
142
|
+
},
|
|
143
|
+
onDragging(event) {
|
|
144
|
+
if (this.dragging) {
|
|
145
|
+
if (event.type === 'touchmove') {
|
|
146
|
+
event.clientX = event.touches[0].clientX
|
|
147
|
+
}
|
|
148
|
+
const diff = (event.clientX - this.startX) / this.$parent.sliderSize * 100
|
|
149
|
+
this.newPosition = this.startPosition + diff
|
|
150
|
+
this.setPosition(this.newPosition)
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
onDragEnd() {
|
|
154
|
+
if (this.value !== this.oldValue) {
|
|
155
|
+
this.$parent.emitChange()
|
|
156
|
+
}
|
|
157
|
+
setTimeout(() => {
|
|
158
|
+
// defer to prevent triggering click on the track
|
|
159
|
+
this.dragging = false
|
|
160
|
+
this.setPosition(this.newPosition)
|
|
161
|
+
})
|
|
162
|
+
if (typeof window !== 'undefined') {
|
|
163
|
+
document.removeEventListener('mousemove', this.onDragging)
|
|
164
|
+
document.removeEventListener('touchmove', this.onDragging)
|
|
165
|
+
document.removeEventListener('mouseup', this.onDragEnd)
|
|
166
|
+
document.removeEventListener('touchend', this.onDragEnd)
|
|
167
|
+
document.removeEventListener('contextmenu', this.onDragEnd)
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
setPosition(percent) {
|
|
171
|
+
if (percent === null || isNaN(percent)) return
|
|
172
|
+
if (percent < 0) {
|
|
173
|
+
percent = 0
|
|
174
|
+
} else if (percent > 100) {
|
|
175
|
+
percent = 100
|
|
176
|
+
}
|
|
177
|
+
const stepLength = 100 / ((this.max - this.min) / this.step)
|
|
178
|
+
const steps = Math.round(percent / stepLength)
|
|
179
|
+
let value = steps * stepLength / 100 * (this.max - this.min) + this.min
|
|
180
|
+
value = parseFloat(value.toFixed(this.precision))
|
|
181
|
+
this.$emit('input', value)
|
|
182
|
+
if (!this.dragging && value !== this.oldValue) {
|
|
183
|
+
this.oldValue = value
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="b-slider-tick"
|
|
4
|
+
:class="{ 'is-tick-hidden': hidden }"
|
|
5
|
+
:style="getTickStyle(position)">
|
|
6
|
+
<span v-if="$slots.default" class="b-slider-tick-label">
|
|
7
|
+
<slot/>
|
|
8
|
+
</span>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'BSliderTick',
|
|
15
|
+
props: {
|
|
16
|
+
value: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 0
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
computed: {
|
|
22
|
+
position() {
|
|
23
|
+
const pos = (this.value - this.$parent.min) /
|
|
24
|
+
(this.$parent.max - this.$parent.min) * 100
|
|
25
|
+
return (pos >= 0 && pos <= 100) ? pos : 0
|
|
26
|
+
},
|
|
27
|
+
hidden() {
|
|
28
|
+
return this.value === this.$parent.min || this.value === this.$parent.max
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
getTickStyle(position) {
|
|
33
|
+
return { 'left': position + '%' }
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
created() {
|
|
37
|
+
if (!this.$parent.$data._isSlider) {
|
|
38
|
+
this.$destroy()
|
|
39
|
+
throw new Error('You should wrap bSliderTick on a bSlider')
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Slider from './Slider'
|
|
2
|
+
import SliderTick from './SliderTick'
|
|
3
|
+
|
|
4
|
+
import { use, registerComponent } from '../../utils/plugins'
|
|
5
|
+
|
|
6
|
+
const Plugin = {
|
|
7
|
+
install(Vue) {
|
|
8
|
+
registerComponent(Vue, Slider)
|
|
9
|
+
registerComponent(Vue, SliderTick)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
use(Plugin)
|
|
14
|
+
|
|
15
|
+
export default Plugin
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
Slider,
|
|
19
|
+
SliderTick
|
|
20
|
+
}
|
|
@@ -33,7 +33,7 @@ const SnackbarProgrammatic = {
|
|
|
33
33
|
|
|
34
34
|
const Plugin = {
|
|
35
35
|
install(Vue) {
|
|
36
|
-
registerComponentProgrammatic(Vue, '
|
|
36
|
+
registerComponentProgrammatic(Vue, 'snackbar', SnackbarProgrammatic)
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -42,5 +42,5 @@ use(Plugin)
|
|
|
42
42
|
export default Plugin
|
|
43
43
|
|
|
44
44
|
export {
|
|
45
|
-
SnackbarProgrammatic
|
|
45
|
+
SnackbarProgrammatic
|
|
46
46
|
}
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
class="step-item"
|
|
10
10
|
:class="[stepItem.type || type, {
|
|
11
11
|
'is-active': activeStep === index,
|
|
12
|
-
'is-
|
|
12
|
+
'is-previous': activeStep > index
|
|
13
13
|
}]">
|
|
14
14
|
<a
|
|
15
15
|
class="step-link"
|
|
16
|
-
:class="{'is-clickable': isItemClickable(stepItem)}"
|
|
17
|
-
@click="isItemClickable(stepItem) && stepClick(index)">
|
|
16
|
+
:class="{'is-clickable': isItemClickable(stepItem, index)}"
|
|
17
|
+
@click="isItemClickable(stepItem, index) && stepClick(index)">
|
|
18
18
|
<div class="step-marker">
|
|
19
19
|
<b-icon
|
|
20
20
|
v-if="stepItem.icon"
|
|
@@ -187,9 +187,9 @@ export default {
|
|
|
187
187
|
/**
|
|
188
188
|
* Return if the step should be clickable or not.
|
|
189
189
|
*/
|
|
190
|
-
isItemClickable(stepItem) {
|
|
190
|
+
isItemClickable(stepItem, index) {
|
|
191
191
|
if (stepItem.clickable === undefined) {
|
|
192
|
-
return
|
|
192
|
+
return this.activeStep > index
|
|
193
193
|
}
|
|
194
194
|
return stepItem.clickable
|
|
195
195
|
},
|
|
@@ -213,6 +213,7 @@ export default {
|
|
|
213
213
|
if (prevItemIdx >= 0) {
|
|
214
214
|
prevItemIdx = this.stepItems.length - 1 - prevItemIdx
|
|
215
215
|
}
|
|
216
|
+
this.$emit('input', prevItemIdx)
|
|
216
217
|
this.changeStep(prevItemIdx)
|
|
217
218
|
},
|
|
218
219
|
|
|
@@ -224,6 +225,7 @@ export default {
|
|
|
224
225
|
const nextItemIdx = this.stepItems.findIndex((step, idx) => {
|
|
225
226
|
return idx > this.activeStep && step.visible
|
|
226
227
|
})
|
|
228
|
+
this.$emit('input', nextItemIdx)
|
|
227
229
|
this.changeStep(nextItemIdx)
|
|
228
230
|
}
|
|
229
231
|
},
|
|
@@ -8,4 +8,33 @@ describe('BSwitch', () => {
|
|
|
8
8
|
expect(wrapper.name()).toBe('BSwitch')
|
|
9
9
|
expect(wrapper.isVueInstance()).toBeTruthy()
|
|
10
10
|
})
|
|
11
|
+
|
|
12
|
+
it('render correctly', () => {
|
|
13
|
+
const wrapper = shallowMount(BSwitch)
|
|
14
|
+
|
|
15
|
+
expect(wrapper.html()).toMatchSnapshot()
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('renders input element by default', () => {
|
|
19
|
+
const wrapper = shallowMount(BSwitch)
|
|
20
|
+
|
|
21
|
+
expect(wrapper.contains('input')).toBeTruthy()
|
|
22
|
+
expect(wrapper.classes()).toContain('switch')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('updates internal value when v-model is changed', () => {
|
|
26
|
+
const wrapper = shallowMount(BSwitch)
|
|
27
|
+
const newValue = 'switch value'
|
|
28
|
+
wrapper.setProps({ value: newValue })
|
|
29
|
+
expect(wrapper.vm.newValue).toBe(newValue)
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
it('emit input event when computedValue is set', () => {
|
|
33
|
+
const wrapper = shallowMount(BSwitch)
|
|
34
|
+
const newValue = 'switch value'
|
|
35
|
+
wrapper.vm.computedValue = newValue
|
|
36
|
+
const valueEmitted = wrapper.emitted()['input'][0]
|
|
37
|
+
expect(wrapper.vm.newValue).toBe(newValue)
|
|
38
|
+
expect(valueEmitted).toContainEqual(newValue)
|
|
39
|
+
})
|
|
11
40
|
})
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label
|
|
3
3
|
class="switch"
|
|
4
|
-
:class="
|
|
4
|
+
:class="newClass"
|
|
5
5
|
ref="label"
|
|
6
6
|
:disabled="disabled"
|
|
7
|
+
@click="focus"
|
|
7
8
|
@keydown.prevent.enter="$refs.label.click()"
|
|
8
9
|
@mousedown="isMouseDown = true"
|
|
9
10
|
@mouseup="isMouseDown = false"
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
<input
|
|
13
14
|
v-model="computedValue"
|
|
14
15
|
type="checkbox"
|
|
16
|
+
ref="input"
|
|
15
17
|
@click.stop
|
|
16
18
|
:disabled="disabled"
|
|
17
19
|
:name="name"
|
|
@@ -28,19 +30,27 @@
|
|
|
28
30
|
export default {
|
|
29
31
|
name: 'BSwitch',
|
|
30
32
|
props: {
|
|
31
|
-
value: [String, Number, Boolean, Function, Object, Array
|
|
32
|
-
nativeValue: [String, Number, Boolean, Function, Object, Array
|
|
33
|
+
value: [String, Number, Boolean, Function, Object, Array],
|
|
34
|
+
nativeValue: [String, Number, Boolean, Function, Object, Array],
|
|
33
35
|
disabled: Boolean,
|
|
34
36
|
type: String,
|
|
35
37
|
name: String,
|
|
36
38
|
required: Boolean,
|
|
37
39
|
size: String,
|
|
38
40
|
trueValue: {
|
|
39
|
-
type: [String, Number, Boolean, Function, Object, Array
|
|
41
|
+
type: [String, Number, Boolean, Function, Object, Array],
|
|
40
42
|
default: true
|
|
41
43
|
},
|
|
42
44
|
falseValue: {
|
|
43
|
-
type: [String, Number, Boolean, Function, Object, Array
|
|
45
|
+
type: [String, Number, Boolean, Function, Object, Array],
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
rounded: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
52
|
+
outlined: {
|
|
53
|
+
type: Boolean,
|
|
44
54
|
default: false
|
|
45
55
|
}
|
|
46
56
|
},
|
|
@@ -59,6 +69,14 @@ export default {
|
|
|
59
69
|
this.newValue = value
|
|
60
70
|
this.$emit('input', value)
|
|
61
71
|
}
|
|
72
|
+
},
|
|
73
|
+
newClass() {
|
|
74
|
+
return [
|
|
75
|
+
this.size,
|
|
76
|
+
{ 'is-disabled': this.disabled },
|
|
77
|
+
{ 'is-rounded': this.rounded },
|
|
78
|
+
{ 'is-outlined': this.outlined }
|
|
79
|
+
]
|
|
62
80
|
}
|
|
63
81
|
},
|
|
64
82
|
watch: {
|
|
@@ -68,6 +86,12 @@ export default {
|
|
|
68
86
|
value(value) {
|
|
69
87
|
this.newValue = value
|
|
70
88
|
}
|
|
89
|
+
},
|
|
90
|
+
methods: {
|
|
91
|
+
focus() {
|
|
92
|
+
// MacOS FireFox and Safari do not focus when clicked
|
|
93
|
+
this.$refs.input.focus()
|
|
94
|
+
}
|
|
71
95
|
}
|
|
72
96
|
}
|
|
73
97
|
</script>
|