buefy 0.9.9 → 0.9.13
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 +1639 -1609
- package/dist/buefy.css +20 -2
- package/dist/buefy.esm.js +2227 -1869
- package/dist/buefy.esm.min.js +2 -2
- package/dist/buefy.js +2266 -1907
- package/dist/buefy.min.css +1 -1
- package/dist/buefy.min.js +2 -2
- package/dist/cjs/autocomplete.js +6 -6
- package/dist/cjs/breadcrumb.js +127 -0
- package/dist/cjs/button.js +6 -107
- package/dist/cjs/carousel.js +9 -7
- package/dist/cjs/checkbox.js +5 -5
- package/dist/cjs/{chunk-d33a8a78.js → chunk-114191ae.js} +3 -3
- package/dist/cjs/{chunk-dafdb70c.js → chunk-2062216d.js} +39 -3
- package/dist/cjs/{chunk-64efc596.js → chunk-2911aa4b.js} +20 -16
- package/dist/cjs/{chunk-96ab31c1.js → chunk-2ae50815.js} +7 -7
- package/dist/cjs/{chunk-c3032504.js → chunk-2c7de785.js} +3 -3
- package/dist/cjs/{chunk-50ff3a78.js → chunk-30670fac.js} +96 -15
- package/dist/cjs/{chunk-e57b3891.js → chunk-34949503.js} +2 -2
- package/dist/cjs/{chunk-0abd2223.js → chunk-3b43d77a.js} +2 -2
- package/dist/cjs/{chunk-dcdbe2e8.js → chunk-3cc5d9a6.js} +1 -1
- package/dist/cjs/{chunk-0b57168e.js → chunk-61023b09.js} +3 -3
- package/dist/cjs/chunk-6cb902f8.js +314 -0
- package/dist/cjs/{chunk-adb01a93.js → chunk-7da0c017.js} +26 -24
- package/dist/cjs/{chunk-60255743.js → chunk-9103eeda.js} +4 -0
- package/dist/cjs/{chunk-14c82365.js → chunk-92621ff7.js} +37 -0
- package/dist/cjs/{chunk-816cba7a.js → chunk-9e4cf4c5.js} +1 -1
- package/dist/cjs/{chunk-33b9d1cf.js → chunk-a11294f9.js} +27 -26
- package/dist/cjs/{chunk-430b5370.js → chunk-bfcad370.js} +25 -2
- package/dist/cjs/{chunk-cc470e7c.js → chunk-c6fbc7b4.js} +7 -7
- package/dist/cjs/{chunk-993f89de.js → chunk-c7b2aa4b.js} +5 -4
- package/dist/cjs/{chunk-6474e963.js → chunk-d0f8ea39.js} +9 -9
- package/dist/cjs/{chunk-3acb500b.js → chunk-d120e215.js} +2 -2
- package/dist/cjs/{chunk-f5baaa70.js → chunk-d54e40f6.js} +2 -1
- package/dist/cjs/{chunk-916a2858.js → chunk-f5106717.js} +4 -4
- package/dist/cjs/chunk-fe2f57ee.js +110 -0
- package/dist/cjs/{chunk-2571dc7c.js → chunk-fefd7b77.js} +0 -0
- package/dist/cjs/clockpicker.js +11 -11
- package/dist/cjs/config.js +2 -2
- package/dist/cjs/datepicker.js +12 -12
- package/dist/cjs/datetimepicker.js +22 -15
- package/dist/cjs/dialog.js +13 -11
- package/dist/cjs/dropdown.js +8 -8
- package/dist/cjs/field.js +5 -5
- package/dist/cjs/helpers.js +2 -3
- package/dist/cjs/icon.js +3 -3
- package/dist/cjs/image.js +6 -311
- package/dist/cjs/index.js +29 -23
- package/dist/cjs/input.js +5 -5
- package/dist/cjs/loading.js +6 -6
- package/dist/cjs/menu.js +3 -3
- package/dist/cjs/message.js +6 -6
- package/dist/cjs/modal.js +6 -6
- package/dist/cjs/navbar.js +16 -4
- package/dist/cjs/notification.js +23 -11
- package/dist/cjs/numberinput.js +9 -7
- package/dist/cjs/pagination.js +8 -8
- package/dist/cjs/progress.js +10 -6
- package/dist/cjs/radio.js +3 -3
- package/dist/cjs/rate.js +3 -3
- package/dist/cjs/select.js +7 -7
- package/dist/cjs/sidebar.js +2 -2
- package/dist/cjs/slider.js +4 -4
- package/dist/cjs/snackbar.js +5 -5
- package/dist/cjs/steps.js +8 -8
- package/dist/cjs/switch.js +1 -1
- package/dist/cjs/table.js +13 -13
- package/dist/cjs/tabs.js +8 -8
- package/dist/cjs/tag.js +3 -3
- package/dist/cjs/taginput.js +34 -22
- package/dist/cjs/timepicker.js +13 -13
- package/dist/cjs/toast.js +5 -5
- package/dist/cjs/tooltip.js +5 -5
- package/dist/cjs/upload.js +5 -5
- package/dist/components/autocomplete/index.js +98 -13
- package/dist/components/autocomplete/index.min.js +2 -2
- package/dist/components/breadcrumb/index.js +293 -0
- package/dist/components/breadcrumb/index.min.js +2 -0
- package/dist/components/button/index.js +5 -1
- package/dist/components/button/index.min.js +2 -2
- package/dist/components/carousel/index.js +348 -15
- 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 +54 -47
- 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/datepicker/index.js +41 -32
- package/dist/components/datepicker/index.min.js +2 -2
- package/dist/components/datetimepicker/index.js +75 -58
- package/dist/components/datetimepicker/index.min.js +2 -2
- package/dist/components/dialog/index.js +126 -18
- package/dist/components/dialog/index.min.js +2 -2
- package/dist/components/dropdown/index.js +5 -1
- package/dist/components/dropdown/index.min.js +1 -1
- package/dist/components/field/index.js +29 -23
- package/dist/components/field/index.min.js +2 -2
- package/dist/components/icon/index.js +5 -1
- package/dist/components/icon/index.min.js +2 -2
- package/dist/components/image/index.js +463 -444
- package/dist/components/image/index.min.js +2 -2
- package/dist/components/input/index.js +5 -1
- package/dist/components/input/index.min.js +2 -2
- package/dist/components/loading/index.js +2 -2
- package/dist/components/loading/index.min.js +2 -2
- package/dist/components/menu/index.js +5 -1
- package/dist/components/menu/index.min.js +2 -2
- package/dist/components/message/index.js +43 -3
- package/dist/components/message/index.min.js +2 -2
- package/dist/components/modal/index.js +7 -2
- package/dist/components/modal/index.min.js +2 -2
- package/dist/components/navbar/index.js +16 -4
- package/dist/components/navbar/index.min.js +2 -2
- package/dist/components/notification/index.js +59 -6
- package/dist/components/notification/index.min.js +2 -2
- package/dist/components/numberinput/index.js +9 -3
- package/dist/components/numberinput/index.min.js +2 -2
- package/dist/components/pagination/index.js +5 -1
- package/dist/components/pagination/index.min.js +2 -2
- package/dist/components/progress/index.js +10 -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 +5 -1
- package/dist/components/rate/index.min.js +2 -2
- package/dist/components/select/index.js +5 -1
- package/dist/components/select/index.min.js +2 -2
- package/dist/components/sidebar/index.js +5 -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 +5 -1
- package/dist/components/slider/index.min.js +2 -2
- package/dist/components/snackbar/index.js +7 -2
- package/dist/components/snackbar/index.min.js +2 -2
- package/dist/components/steps/index.js +5 -1
- package/dist/components/steps/index.min.js +2 -2
- package/dist/components/switch/index.js +5 -1
- package/dist/components/switch/index.min.js +1 -1
- package/dist/components/table/index.js +6 -2
- package/dist/components/table/index.min.js +2 -2
- package/dist/components/tabs/index.js +5 -1
- package/dist/components/tabs/index.min.js +2 -2
- package/dist/components/tag/index.js +26 -3
- package/dist/components/tag/index.min.js +2 -2
- package/dist/components/taginput/index.js +185 -29
- package/dist/components/taginput/index.min.js +2 -2
- package/dist/components/timepicker/index.js +54 -47
- package/dist/components/timepicker/index.min.js +2 -2
- package/dist/components/toast/index.js +7 -2
- package/dist/components/toast/index.min.js +2 -2
- package/dist/components/tooltip/index.js +5 -1
- package/dist/components/tooltip/index.min.js +1 -1
- package/dist/components/upload/index.js +5 -1
- package/dist/components/upload/index.min.js +2 -2
- package/dist/esm/autocomplete.js +7 -7
- package/dist/esm/breadcrumb.js +122 -0
- package/dist/esm/button.js +6 -107
- package/dist/esm/carousel.js +7 -5
- package/dist/esm/{chunk-56040896.js → chunk-18e8b067.js} +3 -3
- package/dist/esm/{chunk-fa404a2c.js → chunk-21fc0948.js} +7 -7
- package/dist/esm/{chunk-f9299099.js → chunk-22e9f916.js} +19 -15
- package/dist/esm/{chunk-1fafdf15.js → chunk-2452e3d3.js} +37 -1
- package/dist/esm/{chunk-1297c2c9.js → chunk-29ca0df8.js} +1 -1
- package/dist/esm/{chunk-3c2169d7.js → chunk-2f2f0a74.js} +25 -2
- package/dist/esm/{chunk-cf72ce36.js → chunk-3773c62d.js} +2 -2
- package/dist/esm/{chunk-2c957994.js → chunk-4b67a181.js} +3 -3
- package/dist/esm/{chunk-45740cdc.js → chunk-6019fd7a.js} +96 -15
- package/dist/esm/chunk-71a547bc.js +312 -0
- package/dist/esm/{chunk-516e4877.js → chunk-75a5af93.js} +1 -1
- package/dist/esm/{chunk-4e380ee2.js → chunk-799e084d.js} +2 -1
- package/dist/esm/{chunk-37678809.js → chunk-83eb0d37.js} +3 -3
- package/dist/esm/{chunk-34c74085.js → chunk-8d0f95b8.js} +4 -4
- package/dist/esm/{chunk-652f2dad.js → chunk-8ed29c41.js} +4 -0
- package/dist/esm/{chunk-742a9694.js → chunk-9f7f7441.js} +3 -2
- package/dist/esm/{chunk-f160efb9.js → chunk-ae8ab23a.js} +4 -4
- package/dist/esm/{chunk-c3b09672.js → chunk-b07e3182.js} +26 -24
- package/dist/esm/{chunk-e36a4f2c.js → chunk-b0c0c6b0.js} +0 -0
- package/dist/esm/{chunk-ee935ae6.js → chunk-c9c58d0c.js} +1 -1
- package/dist/esm/{chunk-1d62828e.js → chunk-d7f92d97.js} +39 -3
- package/dist/esm/{chunk-7fd02ffe.js → chunk-d92f0cd9.js} +2 -2
- package/dist/esm/chunk-e7c9b2cb.js +108 -0
- package/dist/esm/{chunk-0e22ae0a.js → chunk-ece062a7.js} +27 -26
- package/dist/esm/clockpicker.js +9 -9
- package/dist/esm/config.js +2 -2
- package/dist/esm/datepicker.js +11 -11
- package/dist/esm/datetimepicker.js +21 -14
- package/dist/esm/dialog.js +10 -8
- package/dist/esm/dropdown.js +5 -5
- package/dist/esm/field.js +4 -4
- package/dist/esm/helpers.js +2 -3
- package/dist/esm/icon.js +4 -4
- package/dist/esm/image.js +6 -311
- package/dist/esm/index.js +106 -100
- package/dist/esm/input.js +6 -6
- package/dist/esm/loading.js +4 -4
- package/dist/esm/menu.js +3 -3
- package/dist/esm/message.js +5 -5
- package/dist/esm/modal.js +4 -4
- package/dist/esm/navbar.js +16 -4
- package/dist/esm/notification.js +22 -10
- package/dist/esm/numberinput.js +9 -7
- package/dist/esm/pagination.js +5 -5
- package/dist/esm/progress.js +8 -4
- package/dist/esm/rate.js +3 -3
- package/dist/esm/select.js +6 -6
- package/dist/esm/sidebar.js +2 -2
- package/dist/esm/slider.js +3 -3
- package/dist/esm/snackbar.js +4 -4
- package/dist/esm/steps.js +6 -6
- package/dist/esm/switch.js +1 -1
- package/dist/esm/table.js +9 -9
- package/dist/esm/tabs.js +6 -6
- package/dist/esm/tag.js +2 -2
- package/dist/esm/taginput.js +33 -21
- package/dist/esm/timepicker.js +12 -12
- package/dist/esm/toast.js +4 -4
- package/dist/esm/tooltip.js +4 -4
- package/dist/esm/upload.js +3 -3
- package/dist/vetur/attributes.json +95 -19
- package/dist/vetur/tags.json +37 -4
- package/package.json +2 -2
- package/src/components/autocomplete/Autocomplete.spec.js +70 -0
- package/src/components/autocomplete/Autocomplete.vue +93 -18
- package/src/components/breadcrumb/Breadcrumb.spec.js +63 -0
- package/src/components/breadcrumb/Breadcrumb.vue +43 -0
- package/src/components/breadcrumb/BreadcrumbItem.spec.js +25 -0
- package/src/components/breadcrumb/BreadcrumbItem.vue +33 -0
- package/src/components/breadcrumb/__snapshots__/Breadcrumb.spec.js.snap +7 -0
- package/src/components/breadcrumb/__snapshots__/BreadcrumbItem.spec.js.snap +7 -0
- package/src/components/breadcrumb/index.js +20 -0
- package/src/components/carousel/CarouselList.vue +3 -1
- package/src/components/carousel/__snapshots__/CarouselList.spec.js.snap +128 -8
- package/src/components/clockpicker/Clockpicker.vue +259 -259
- package/src/components/datepicker/Datepicker.vue +10 -6
- package/src/components/datetimepicker/Datetimepicker.vue +8 -1
- package/src/components/dialog/Dialog.vue +10 -10
- package/src/components/field/Field.vue +271 -270
- package/src/components/image/Image.spec.js +197 -183
- package/src/components/image/Image.vue +4 -2
- package/src/components/index.js +2 -0
- package/src/components/loading/Loading.vue +1 -1
- package/src/components/loading/__snapshots__/Loading.spec.js.snap +1 -1
- package/src/components/message/Message.vue +7 -1
- package/src/components/message/__snapshots__/Message.spec.js.snap +1 -0
- package/src/components/modal/Modal.vue +2 -0
- package/src/components/navbar/Navbar.vue +5 -1
- package/src/components/navbar/NavbarBurger.vue +1 -0
- package/src/components/navbar/NavbarDropdown.vue +8 -2
- package/src/components/navbar/__snapshots__/NavBar.spec.js.snap +11 -11
- package/src/components/navbar/__snapshots__/NavBarBurger.spec.js.snap +3 -0
- package/src/components/navbar/__snapshots__/NavbarDropdown.spec.js.snap +1 -1
- package/src/components/notification/Notification.vue +6 -0
- package/src/components/notification/NotificationNotice.vue +16 -3
- package/src/components/notification/__snapshots__/Notification.spec.js.snap +1 -0
- package/src/components/numberinput/Numberinput.spec.js +10 -0
- package/src/components/numberinput/Numberinput.vue +4 -2
- package/src/components/progress/Progress.vue +6 -2
- package/src/components/snackbar/Snackbar.vue +2 -0
- package/src/components/tag/Tag.vue +25 -2
- package/src/components/tag/__snapshots__/Tag.spec.js.snap +1 -1
- package/src/components/taginput/Taginput.spec.js +57 -1
- package/src/components/taginput/Taginput.vue +373 -364
- package/src/components/toast/Toast.vue +1 -1
- package/src/index.js +2 -0
- package/src/scss/buefy.scss +1 -0
- package/src/scss/components/_loading.scss +2 -1
- package/src/scss/components/_message.scss +3 -0
- package/src/scss/components/_notification.scss +8 -0
- package/src/scss/components/_progress.scss +8 -0
- package/src/utils/MessageMixin.js +32 -1
- package/src/utils/NoticeMixin.js +1 -0
- package/src/utils/TimepickerMixin.js +718 -716
- package/src/utils/config.js +4 -0
- package/src/utils/helpers.js +1 -2
- package/types/components.d.ts +5 -0
- package/src/components/navbar/__snapshots__/NavbarBurger.spec.js.snap +0 -3
|
@@ -1,364 +1,373 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="taginput control" :class="rootClasses">
|
|
3
|
-
<div
|
|
4
|
-
class="taginput-container"
|
|
5
|
-
:class="[statusType, size, containerClasses]"
|
|
6
|
-
:disabled="disabled"
|
|
7
|
-
@click="hasInput && focus($event)">
|
|
8
|
-
<slot name="selected" :tags="tags">
|
|
9
|
-
<b-tag
|
|
10
|
-
v-for="(tag, index) in tags"
|
|
11
|
-
:key="getNormalizedTagText(tag) + index"
|
|
12
|
-
:type="type"
|
|
13
|
-
:close-type="closeType"
|
|
14
|
-
:size="size"
|
|
15
|
-
:rounded="rounded"
|
|
16
|
-
:attached="attached"
|
|
17
|
-
:tabstop="false"
|
|
18
|
-
:disabled="disabled"
|
|
19
|
-
:ellipsis="ellipsis"
|
|
20
|
-
:closable="closable"
|
|
21
|
-
:aria-close-label="ariaCloseLabel"
|
|
22
|
-
:title="ellipsis && getNormalizedTagText(tag)"
|
|
23
|
-
@close="removeTag(index, $event)">
|
|
24
|
-
<slot name="tag" :tag="tag">
|
|
25
|
-
{{ getNormalizedTagText(tag) }}
|
|
26
|
-
</slot>
|
|
27
|
-
</b-tag>
|
|
28
|
-
</slot>
|
|
29
|
-
|
|
30
|
-
<b-autocomplete
|
|
31
|
-
ref="autocomplete"
|
|
32
|
-
v-if="hasInput"
|
|
33
|
-
v-model="newTag"
|
|
34
|
-
v-bind="$attrs"
|
|
35
|
-
:data="data"
|
|
36
|
-
:field="field"
|
|
37
|
-
:icon="icon"
|
|
38
|
-
:icon-pack="iconPack"
|
|
39
|
-
:maxlength="maxlength"
|
|
40
|
-
:has-counter="false"
|
|
41
|
-
:size="size"
|
|
42
|
-
:disabled="disabled"
|
|
43
|
-
:loading="loading"
|
|
44
|
-
:autocomplete="nativeAutocomplete"
|
|
45
|
-
:open-on-focus="openOnFocus"
|
|
46
|
-
:keep-open="openOnFocus"
|
|
47
|
-
:keep-first="keepFirst"
|
|
48
|
-
:group-field="groupField"
|
|
49
|
-
:group-options="groupOptions"
|
|
50
|
-
:use-html5-validation="useHtml5Validation"
|
|
51
|
-
:check-infinite-scroll="checkInfiniteScroll"
|
|
52
|
-
:append-to-body="appendToBody"
|
|
53
|
-
:confirm-keys="confirmKeys"
|
|
54
|
-
@typing="onTyping"
|
|
55
|
-
@focus="onFocus"
|
|
56
|
-
@blur="customOnBlur"
|
|
57
|
-
@keydown.native="keydown"
|
|
58
|
-
@compositionstart.native="isComposing = true"
|
|
59
|
-
@compositionend.native="isComposing = false"
|
|
60
|
-
@select="onSelect"
|
|
61
|
-
@infinite-scroll="emitInfiniteScroll"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
import
|
|
101
|
-
import
|
|
102
|
-
import
|
|
103
|
-
import
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
[
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return {
|
|
206
|
-
'is-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
if (!
|
|
318
|
-
|
|
319
|
-
this.
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
this
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
this.
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
this
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="taginput control" :class="rootClasses">
|
|
3
|
+
<div
|
|
4
|
+
class="taginput-container"
|
|
5
|
+
:class="[statusType, size, containerClasses]"
|
|
6
|
+
:disabled="disabled"
|
|
7
|
+
@click="hasInput && focus($event)">
|
|
8
|
+
<slot name="selected" :tags="tags">
|
|
9
|
+
<b-tag
|
|
10
|
+
v-for="(tag, index) in tags"
|
|
11
|
+
:key="getNormalizedTagText(tag) + index"
|
|
12
|
+
:type="type"
|
|
13
|
+
:close-type="closeType"
|
|
14
|
+
:size="size"
|
|
15
|
+
:rounded="rounded"
|
|
16
|
+
:attached="attached"
|
|
17
|
+
:tabstop="false"
|
|
18
|
+
:disabled="disabled"
|
|
19
|
+
:ellipsis="ellipsis"
|
|
20
|
+
:closable="closable"
|
|
21
|
+
:aria-close-label="ariaCloseLabel"
|
|
22
|
+
:title="ellipsis && getNormalizedTagText(tag)"
|
|
23
|
+
@close="removeTag(index, $event)">
|
|
24
|
+
<slot name="tag" :tag="tag">
|
|
25
|
+
{{ getNormalizedTagText(tag) }}
|
|
26
|
+
</slot>
|
|
27
|
+
</b-tag>
|
|
28
|
+
</slot>
|
|
29
|
+
|
|
30
|
+
<b-autocomplete
|
|
31
|
+
ref="autocomplete"
|
|
32
|
+
v-if="hasInput"
|
|
33
|
+
v-model="newTag"
|
|
34
|
+
v-bind="$attrs"
|
|
35
|
+
:data="data"
|
|
36
|
+
:field="field"
|
|
37
|
+
:icon="icon"
|
|
38
|
+
:icon-pack="iconPack"
|
|
39
|
+
:maxlength="maxlength"
|
|
40
|
+
:has-counter="false"
|
|
41
|
+
:size="size"
|
|
42
|
+
:disabled="disabled"
|
|
43
|
+
:loading="loading"
|
|
44
|
+
:autocomplete="nativeAutocomplete"
|
|
45
|
+
:open-on-focus="openOnFocus"
|
|
46
|
+
:keep-open="openOnFocus"
|
|
47
|
+
:keep-first="keepFirst"
|
|
48
|
+
:group-field="groupField"
|
|
49
|
+
:group-options="groupOptions"
|
|
50
|
+
:use-html5-validation="useHtml5Validation"
|
|
51
|
+
:check-infinite-scroll="checkInfiniteScroll"
|
|
52
|
+
:append-to-body="appendToBody"
|
|
53
|
+
:confirm-keys="confirmKeys"
|
|
54
|
+
@typing="onTyping"
|
|
55
|
+
@focus="onFocus"
|
|
56
|
+
@blur="customOnBlur"
|
|
57
|
+
@keydown.native="keydown"
|
|
58
|
+
@compositionstart.native="isComposing = true"
|
|
59
|
+
@compositionend.native="isComposing = false"
|
|
60
|
+
@select="onSelect"
|
|
61
|
+
@infinite-scroll="emitInfiniteScroll"
|
|
62
|
+
v-on="listeners">
|
|
63
|
+
<template
|
|
64
|
+
v-if="hasHeaderSlot"
|
|
65
|
+
#header>
|
|
66
|
+
<slot name="header" />
|
|
67
|
+
</template>
|
|
68
|
+
<template
|
|
69
|
+
v-if="hasDefaultSlot"
|
|
70
|
+
#default="props">
|
|
71
|
+
<slot
|
|
72
|
+
:option="props.option"
|
|
73
|
+
:index="props.index" />
|
|
74
|
+
</template>
|
|
75
|
+
<template
|
|
76
|
+
v-if="hasEmptySlot"
|
|
77
|
+
#empty>
|
|
78
|
+
<slot name="empty" />
|
|
79
|
+
</template>
|
|
80
|
+
<template
|
|
81
|
+
v-if="hasFooterSlot"
|
|
82
|
+
#footer>
|
|
83
|
+
<slot name="footer" />
|
|
84
|
+
</template>
|
|
85
|
+
</b-autocomplete>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<small v-if="hasCounter && (maxtags || maxlength)" class="help counter">
|
|
89
|
+
<template v-if="maxlength && valueLength > 0">
|
|
90
|
+
{{ valueLength }} / {{ maxlength }}
|
|
91
|
+
</template>
|
|
92
|
+
<template v-else-if="maxtags">
|
|
93
|
+
{{ tagsLength }} / {{ maxtags }}
|
|
94
|
+
</template>
|
|
95
|
+
</small>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<script>
|
|
100
|
+
import { getValueByPath } from '../../utils/helpers'
|
|
101
|
+
import Tag from '../tag/Tag'
|
|
102
|
+
import Autocomplete from '../autocomplete/Autocomplete'
|
|
103
|
+
import config from '../../utils/config'
|
|
104
|
+
import FormElementMixin from '../../utils/FormElementMixin'
|
|
105
|
+
|
|
106
|
+
export default {
|
|
107
|
+
name: 'BTaginput',
|
|
108
|
+
components: {
|
|
109
|
+
[Autocomplete.name]: Autocomplete,
|
|
110
|
+
[Tag.name]: Tag
|
|
111
|
+
},
|
|
112
|
+
mixins: [FormElementMixin],
|
|
113
|
+
inheritAttrs: false,
|
|
114
|
+
props: {
|
|
115
|
+
value: {
|
|
116
|
+
type: Array,
|
|
117
|
+
default: () => []
|
|
118
|
+
},
|
|
119
|
+
data: {
|
|
120
|
+
type: Array,
|
|
121
|
+
default: () => []
|
|
122
|
+
},
|
|
123
|
+
type: String,
|
|
124
|
+
closeType: String,
|
|
125
|
+
rounded: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
default: false
|
|
128
|
+
},
|
|
129
|
+
attached: {
|
|
130
|
+
type: Boolean,
|
|
131
|
+
default: false
|
|
132
|
+
},
|
|
133
|
+
maxtags: {
|
|
134
|
+
type: [Number, String],
|
|
135
|
+
required: false
|
|
136
|
+
},
|
|
137
|
+
hasCounter: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: () => config.defaultTaginputHasCounter
|
|
140
|
+
},
|
|
141
|
+
field: {
|
|
142
|
+
type: String,
|
|
143
|
+
default: 'value'
|
|
144
|
+
},
|
|
145
|
+
autocomplete: Boolean,
|
|
146
|
+
groupField: String,
|
|
147
|
+
groupOptions: String,
|
|
148
|
+
nativeAutocomplete: String,
|
|
149
|
+
openOnFocus: Boolean,
|
|
150
|
+
keepFirst: Boolean,
|
|
151
|
+
disabled: Boolean,
|
|
152
|
+
ellipsis: Boolean,
|
|
153
|
+
closable: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
default: true
|
|
156
|
+
},
|
|
157
|
+
ariaCloseLabel: String,
|
|
158
|
+
confirmKeys: {
|
|
159
|
+
type: Array,
|
|
160
|
+
default: () => [',', 'Tab', 'Enter']
|
|
161
|
+
},
|
|
162
|
+
removeOnKeys: {
|
|
163
|
+
type: Array,
|
|
164
|
+
default: () => ['Backspace']
|
|
165
|
+
},
|
|
166
|
+
allowNew: Boolean,
|
|
167
|
+
onPasteSeparators: {
|
|
168
|
+
type: Array,
|
|
169
|
+
default: () => [',']
|
|
170
|
+
},
|
|
171
|
+
beforeAdding: {
|
|
172
|
+
type: Function,
|
|
173
|
+
default: () => true
|
|
174
|
+
},
|
|
175
|
+
allowDuplicates: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: false
|
|
178
|
+
},
|
|
179
|
+
checkInfiniteScroll: {
|
|
180
|
+
type: Boolean,
|
|
181
|
+
default: false
|
|
182
|
+
},
|
|
183
|
+
createTag: {
|
|
184
|
+
type: Function,
|
|
185
|
+
default: (tag) => tag
|
|
186
|
+
},
|
|
187
|
+
appendToBody: Boolean
|
|
188
|
+
},
|
|
189
|
+
data() {
|
|
190
|
+
return {
|
|
191
|
+
tags: Array.isArray(this.value) ? this.value.slice(0) : (this.value || []),
|
|
192
|
+
newTag: '',
|
|
193
|
+
isComposing: false,
|
|
194
|
+
_elementRef: 'autocomplete',
|
|
195
|
+
_isTaginput: true
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
computed: {
|
|
199
|
+
listeners() {
|
|
200
|
+
const { input, ...listeners } = this.$listeners
|
|
201
|
+
return listeners
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
rootClasses() {
|
|
205
|
+
return {
|
|
206
|
+
'is-expanded': this.expanded
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
containerClasses() {
|
|
211
|
+
return {
|
|
212
|
+
'is-focused': this.isFocused,
|
|
213
|
+
'is-focusable': this.hasInput
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
valueLength() {
|
|
218
|
+
return this.newTag.trim().length
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
hasDefaultSlot() {
|
|
222
|
+
return !!this.$scopedSlots.default
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
hasEmptySlot() {
|
|
226
|
+
return !!this.$slots.empty
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
hasHeaderSlot() {
|
|
230
|
+
return !!this.$slots.header
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
hasFooterSlot() {
|
|
234
|
+
return !!this.$slots.footer
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Show the input field if a maxtags hasn't been set or reached.
|
|
239
|
+
*/
|
|
240
|
+
hasInput() {
|
|
241
|
+
return this.maxtags == null || this.maxtags === 1 || this.tagsLength < this.maxtags
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
tagsLength() {
|
|
245
|
+
return this.tags.length
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* If Taginput has onPasteSeparators prop,
|
|
250
|
+
* returning new RegExp used to split pasted string.
|
|
251
|
+
*/
|
|
252
|
+
separatorsAsRegExp() {
|
|
253
|
+
const sep = this.onPasteSeparators
|
|
254
|
+
|
|
255
|
+
return sep.length ? new RegExp(sep.map((s) => {
|
|
256
|
+
return s ? s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') : null
|
|
257
|
+
}).join('|'), 'g') : null
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
watch: {
|
|
261
|
+
/**
|
|
262
|
+
* When v-model is changed set internal value.
|
|
263
|
+
*/
|
|
264
|
+
value(value) {
|
|
265
|
+
this.tags = Array.isArray(value) ? value.slice(0) : (value || [])
|
|
266
|
+
},
|
|
267
|
+
|
|
268
|
+
hasInput() {
|
|
269
|
+
if (!this.hasInput) this.onBlur()
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
methods: {
|
|
273
|
+
addTag(tag) {
|
|
274
|
+
const tagToAdd = tag || this.newTag.trim()
|
|
275
|
+
|
|
276
|
+
if (tagToAdd) {
|
|
277
|
+
if (!this.autocomplete) {
|
|
278
|
+
const reg = this.separatorsAsRegExp
|
|
279
|
+
if (reg && tagToAdd.match(reg)) {
|
|
280
|
+
tagToAdd.split(reg)
|
|
281
|
+
.map((t) => t.trim())
|
|
282
|
+
.filter((t) => t.length !== 0)
|
|
283
|
+
.map(this.addTag)
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
// Add the tag input if it is not blank
|
|
288
|
+
// or previously added (if not allowDuplicates).
|
|
289
|
+
const add = !this.allowDuplicates ? this.tags.indexOf(tagToAdd) === -1 : true
|
|
290
|
+
if (add && this.beforeAdding(tagToAdd)) {
|
|
291
|
+
if (this.maxtags === 1) {
|
|
292
|
+
this.tags = [] // replace existing tag if only 1 is allowed
|
|
293
|
+
}
|
|
294
|
+
this.tags.push(this.createTag(tagToAdd))
|
|
295
|
+
this.$emit('input', this.tags)
|
|
296
|
+
this.$emit('add', tagToAdd)
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// after autocomplete events
|
|
300
|
+
requestAnimationFrame(() => {
|
|
301
|
+
this.newTag = ''
|
|
302
|
+
this.$emit('typing', '')
|
|
303
|
+
})
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
getNormalizedTagText(tag) {
|
|
308
|
+
if (typeof tag === 'object') {
|
|
309
|
+
tag = getValueByPath(tag, this.field)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return `${tag}`
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
customOnBlur(event) {
|
|
316
|
+
// Add tag on-blur if not select only
|
|
317
|
+
if (!this.autocomplete) this.addTag()
|
|
318
|
+
|
|
319
|
+
this.onBlur(event)
|
|
320
|
+
},
|
|
321
|
+
|
|
322
|
+
onSelect(option) {
|
|
323
|
+
if (!option) return
|
|
324
|
+
|
|
325
|
+
this.addTag(option)
|
|
326
|
+
this.$nextTick(() => {
|
|
327
|
+
this.newTag = ''
|
|
328
|
+
})
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
removeTag(index, event) {
|
|
332
|
+
const tag = this.tags.splice(index, 1)[0]
|
|
333
|
+
this.$emit('input', this.tags)
|
|
334
|
+
this.$emit('remove', tag)
|
|
335
|
+
if (event) event.stopPropagation()
|
|
336
|
+
if (this.openOnFocus && this.$refs.autocomplete) {
|
|
337
|
+
this.$refs.autocomplete.focus()
|
|
338
|
+
}
|
|
339
|
+
return tag
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
removeLastTag() {
|
|
343
|
+
if (this.tagsLength > 0) {
|
|
344
|
+
this.removeTag(this.tagsLength - 1)
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
|
|
348
|
+
keydown(event) {
|
|
349
|
+
const { key } = event // cannot destructure preventDefault (https://stackoverflow.com/a/49616808/2774496)
|
|
350
|
+
if (this.removeOnKeys.indexOf(key) !== -1 && !this.newTag.length) {
|
|
351
|
+
this.removeLastTag()
|
|
352
|
+
}
|
|
353
|
+
// Stop if is to accept select only
|
|
354
|
+
if (this.autocomplete && !this.allowNew) return
|
|
355
|
+
|
|
356
|
+
if (this.confirmKeys.indexOf(key) >= 0) {
|
|
357
|
+
// Allow Tab to advance to next field regardless
|
|
358
|
+
if (key !== 'Tab') event.preventDefault()
|
|
359
|
+
if (key === 'Enter' && this.isComposing) return
|
|
360
|
+
this.addTag()
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
onTyping(event) {
|
|
365
|
+
this.$emit('typing', event.trim())
|
|
366
|
+
},
|
|
367
|
+
|
|
368
|
+
emitInfiniteScroll() {
|
|
369
|
+
this.$emit('infinite-scroll')
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
</script>
|