buefy 0.9.26 → 0.9.28
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/README.md +3 -1
- package/dist/buefy.css +15904 -0
- package/dist/buefy.esm.js +17883 -0
- package/dist/buefy.esm.min.js +2 -0
- package/dist/buefy.js +17967 -0
- package/dist/buefy.min.css +1 -0
- package/dist/buefy.min.js +2 -0
- package/dist/cjs/Autocomplete-7a39c5ce.js +673 -0
- package/dist/cjs/Button-01827709.js +114 -0
- package/dist/cjs/CheckRadioMixin-c910f2ed.js +45 -0
- package/dist/cjs/Checkbox-43f54cc7.js +70 -0
- package/dist/cjs/Datepicker-680659bc.js +1679 -0
- package/dist/cjs/DropdownItem-422f8c34.js +559 -0
- package/dist/cjs/Field-4557b10c.js +315 -0
- package/dist/cjs/FormElementMixin-193a88b8.js +163 -0
- package/dist/cjs/Icon-78961800.js +189 -0
- package/dist/cjs/Image-c4bcd9b3.js +299 -0
- package/dist/cjs/InjectedChildMixin-d6bf7f91.js +135 -0
- package/dist/cjs/Input-e5a72d97.js +248 -0
- package/dist/cjs/Loading-6f2c7075.js +150 -0
- package/dist/cjs/MessageMixin-8d959514.js +146 -0
- package/dist/cjs/Modal-4cf07210.js +278 -0
- package/dist/cjs/NoticeMixin-01121bd2.js +154 -0
- package/dist/cjs/Pagination-d6b3fb85.js +413 -0
- package/dist/cjs/Select-2b3879bc.js +100 -0
- package/dist/cjs/SlotComponent-4fb48389.js +53 -0
- package/dist/cjs/TabbedChildMixin-907cad32.js +222 -0
- package/dist/cjs/Tag-437f65fb.js +154 -0
- package/dist/cjs/Timepicker-498fa02b.js +67 -0
- package/dist/cjs/TimepickerMixin-6c1a4ab4.js +661 -0
- package/dist/cjs/Tooltip-c1df7ee3.js +370 -0
- package/dist/cjs/_rollupPluginBabelHelpers-8b2e54ad.js +365 -0
- package/dist/cjs/autocomplete.js +22 -0
- package/dist/cjs/breadcrumb.js +139 -0
- package/dist/cjs/button.js +20 -0
- package/dist/cjs/carousel.js +662 -0
- package/dist/cjs/checkbox.js +86 -0
- package/dist/cjs/clockpicker.js +461 -0
- package/dist/cjs/collapse.js +128 -0
- package/dist/cjs/colorpicker.js +23 -0
- package/dist/cjs/config-8cfb5a4a.js +81 -0
- package/dist/cjs/config.js +18 -0
- package/dist/cjs/datepicker.js +27 -0
- package/dist/cjs/datetimepicker.js +377 -0
- package/dist/cjs/dialog.js +308 -0
- package/dist/cjs/dropdown.js +23 -0
- package/dist/cjs/field.js +18 -0
- package/dist/cjs/helpers.js +375 -0
- package/dist/cjs/icon.js +19 -0
- package/dist/cjs/image.js +19 -0
- package/dist/cjs/index-99d1c930.js +1633 -0
- package/dist/cjs/index.js +216 -0
- package/dist/cjs/input.js +21 -0
- package/dist/cjs/loading.js +38 -0
- package/dist/cjs/menu.js +304 -0
- package/dist/cjs/message.js +67 -0
- package/dist/cjs/modal.js +59 -0
- package/dist/cjs/navbar.js +679 -0
- package/dist/cjs/notification.js +181 -0
- package/dist/cjs/numberinput.js +278 -0
- package/dist/cjs/pagination.js +22 -0
- package/dist/cjs/plugins-7f41b028.js +94 -0
- package/dist/cjs/progress.js +239 -0
- package/dist/cjs/radio.js +130 -0
- package/dist/cjs/rate.js +156 -0
- package/dist/cjs/select.js +21 -0
- package/dist/cjs/sidebar.js +303 -0
- package/dist/cjs/skeleton.js +111 -0
- package/dist/cjs/slider.js +603 -0
- package/dist/cjs/snackbar.js +132 -0
- package/dist/cjs/ssr-20dba236.js +10 -0
- package/dist/cjs/steps.js +278 -0
- package/dist/cjs/switch.js +139 -0
- package/dist/cjs/table.js +1695 -0
- package/dist/cjs/tabs.js +214 -0
- package/dist/cjs/tag.js +70 -0
- package/dist/cjs/taginput.js +331 -0
- package/dist/cjs/timepicker.js +28 -0
- package/dist/cjs/toast.js +106 -0
- package/dist/cjs/tooltip.js +19 -0
- package/dist/cjs/trapFocus-261420b0.js +49 -0
- package/dist/cjs/upload.js +205 -0
- package/dist/components/autocomplete/index.js +1620 -0
- package/dist/components/autocomplete/index.min.js +2 -0
- package/dist/components/breadcrumb/index.js +297 -0
- package/dist/components/breadcrumb/index.min.js +2 -0
- package/dist/components/button/index.js +569 -0
- package/dist/components/button/index.min.js +2 -0
- package/dist/components/carousel/index.js +1629 -0
- package/dist/components/carousel/index.min.js +2 -0
- package/dist/components/checkbox/index.js +279 -0
- package/dist/components/checkbox/index.min.js +2 -0
- package/dist/components/clockpicker/index.js +3131 -0
- package/dist/components/clockpicker/index.min.js +2 -0
- package/dist/components/collapse/index.js +217 -0
- package/dist/components/collapse/index.min.js +2 -0
- package/dist/components/colorpicker/index.js +4249 -0
- package/dist/components/colorpicker/index.min.js +2 -0
- package/dist/components/datepicker/index.js +3845 -0
- package/dist/components/datepicker/index.min.js +2 -0
- package/dist/components/datetimepicker/index.js +4902 -0
- package/dist/components/datetimepicker/index.min.js +2 -0
- package/dist/components/dialog/index.js +1168 -0
- package/dist/components/dialog/index.min.js +2 -0
- package/dist/components/dropdown/index.js +1043 -0
- package/dist/components/dropdown/index.min.js +2 -0
- package/dist/components/field/index.js +511 -0
- package/dist/components/field/index.min.js +2 -0
- package/dist/components/icon/index.js +463 -0
- package/dist/components/icon/index.min.js +2 -0
- package/dist/components/image/index.js +513 -0
- package/dist/components/image/index.min.js +2 -0
- package/dist/components/input/index.js +862 -0
- package/dist/components/input/index.min.js +2 -0
- package/dist/components/loading/index.js +366 -0
- package/dist/components/loading/index.min.js +2 -0
- package/dist/components/menu/index.js +748 -0
- package/dist/components/menu/index.min.js +2 -0
- package/dist/components/message/index.js +650 -0
- package/dist/components/message/index.min.js +2 -0
- package/dist/components/modal/index.js +624 -0
- package/dist/components/modal/index.min.js +2 -0
- package/dist/components/navbar/index.js +805 -0
- package/dist/components/navbar/index.min.js +2 -0
- package/dist/components/notification/index.js +923 -0
- package/dist/components/notification/index.min.js +2 -0
- package/dist/components/numberinput/index.js +1119 -0
- package/dist/components/numberinput/index.min.js +2 -0
- package/dist/components/pagination/index.js +868 -0
- package/dist/components/pagination/index.min.js +2 -0
- package/dist/components/progress/index.js +621 -0
- package/dist/components/progress/index.min.js +2 -0
- package/dist/components/radio/index.js +260 -0
- package/dist/components/radio/index.min.js +2 -0
- package/dist/components/rate/index.js +600 -0
- package/dist/components/rate/index.min.js +2 -0
- package/dist/components/select/index.js +715 -0
- package/dist/components/select/index.min.js +2 -0
- package/dist/components/sidebar/index.js +467 -0
- package/dist/components/sidebar/index.min.js +2 -0
- package/dist/components/skeleton/index.js +200 -0
- package/dist/components/skeleton/index.min.js +2 -0
- package/dist/components/slider/index.js +1264 -0
- package/dist/components/slider/index.min.js +2 -0
- package/dist/components/snackbar/index.js +527 -0
- package/dist/components/snackbar/index.min.js +2 -0
- package/dist/components/steps/index.js +1180 -0
- package/dist/components/steps/index.min.js +2 -0
- package/dist/components/switch/index.js +297 -0
- package/dist/components/switch/index.min.js +2 -0
- package/dist/components/table/index.js +3480 -0
- package/dist/components/table/index.min.js +2 -0
- package/dist/components/tabs/index.js +1116 -0
- package/dist/components/tabs/index.min.js +2 -0
- package/dist/components/tag/index.js +307 -0
- package/dist/components/tag/index.min.js +2 -0
- package/dist/components/taginput/index.js +2104 -0
- package/dist/components/taginput/index.min.js +2 -0
- package/dist/components/timepicker/index.js +2843 -0
- package/dist/components/timepicker/index.min.js +2 -0
- package/dist/components/toast/index.js +501 -0
- package/dist/components/toast/index.min.js +2 -0
- package/dist/components/tooltip/index.js +630 -0
- package/dist/components/tooltip/index.min.js +2 -0
- package/dist/components/upload/index.js +525 -0
- package/dist/components/upload/index.min.js +2 -0
- package/dist/esm/Autocomplete-1a6e8770.js +671 -0
- package/dist/esm/Button-521f6efc.js +112 -0
- package/dist/esm/CheckRadioMixin-e726a83c.js +43 -0
- package/dist/esm/Checkbox-1d02686e.js +68 -0
- package/dist/esm/Datepicker-0ae1e826.js +1677 -0
- package/dist/esm/DropdownItem-55682322.js +556 -0
- package/dist/esm/Field-3ceba31e.js +313 -0
- package/dist/esm/FormElementMixin-b223d3c7.js +161 -0
- package/dist/esm/Icon-60d47b31.js +187 -0
- package/dist/esm/Image-75808acb.js +297 -0
- package/dist/esm/InjectedChildMixin-b4220787.js +130 -0
- package/dist/esm/Input-20612b63.js +246 -0
- package/dist/esm/Loading-ae028ea5.js +148 -0
- package/dist/esm/MessageMixin-d577a9f5.js +144 -0
- package/dist/esm/Modal-7da7641f.js +276 -0
- package/dist/esm/NoticeMixin-bd6f61d9.js +152 -0
- package/dist/esm/Pagination-68f12c1e.js +409 -0
- package/dist/esm/Select-97781d4e.js +98 -0
- package/dist/esm/SlotComponent-8871a20f.js +51 -0
- package/dist/esm/TabbedChildMixin-bcb13767.js +219 -0
- package/dist/esm/Tag-6365aa46.js +152 -0
- package/dist/esm/Timepicker-38480bbc.js +65 -0
- package/dist/esm/TimepickerMixin-d736b0a9.js +659 -0
- package/dist/esm/Tooltip-d98a769c.js +368 -0
- package/dist/esm/_rollupPluginBabelHelpers-df313029.js +350 -0
- package/dist/esm/autocomplete.js +18 -0
- package/dist/esm/breadcrumb.js +133 -0
- package/dist/esm/button.js +16 -0
- package/dist/esm/carousel.js +655 -0
- package/dist/esm/checkbox.js +81 -0
- package/dist/esm/clockpicker.js +456 -0
- package/dist/esm/collapse.js +123 -0
- package/dist/esm/colorpicker.js +14 -0
- package/dist/esm/config-e7d4b9c2.js +78 -0
- package/dist/esm/config.js +14 -0
- package/dist/esm/datepicker.js +23 -0
- package/dist/esm/datetimepicker.js +372 -0
- package/dist/esm/dialog.js +302 -0
- package/dist/esm/dropdown.js +18 -0
- package/dist/esm/field.js +14 -0
- package/dist/esm/helpers.js +348 -0
- package/dist/esm/icon.js +15 -0
- package/dist/esm/image.js +15 -0
- package/dist/esm/index-903f63ea.js +1629 -0
- package/dist/esm/index.js +182 -0
- package/dist/esm/input.js +17 -0
- package/dist/esm/loading.js +33 -0
- package/dist/esm/menu.js +297 -0
- package/dist/esm/message.js +62 -0
- package/dist/esm/modal.js +54 -0
- package/dist/esm/navbar.js +672 -0
- package/dist/esm/notification.js +175 -0
- package/dist/esm/numberinput.js +273 -0
- package/dist/esm/pagination.js +17 -0
- package/dist/esm/plugins-218aea86.js +89 -0
- package/dist/esm/progress.js +233 -0
- package/dist/esm/radio.js +124 -0
- package/dist/esm/rate.js +151 -0
- package/dist/esm/select.js +17 -0
- package/dist/esm/sidebar.js +298 -0
- package/dist/esm/skeleton.js +106 -0
- package/dist/esm/slider.js +597 -0
- package/dist/esm/snackbar.js +126 -0
- package/dist/esm/ssr-b847d137.js +7 -0
- package/dist/esm/steps.js +272 -0
- package/dist/esm/switch.js +134 -0
- package/dist/esm/table.js +1689 -0
- package/dist/esm/tabs.js +208 -0
- package/dist/esm/tag.js +65 -0
- package/dist/esm/taginput.js +326 -0
- package/dist/esm/timepicker.js +24 -0
- package/dist/esm/toast.js +100 -0
- package/dist/esm/tooltip.js +15 -0
- package/dist/esm/trapFocus-f0736873.js +47 -0
- package/dist/esm/upload.js +200 -0
- package/dist/vetur/attributes.json +3238 -0
- package/dist/vetur/tags.json +1183 -0
- package/package.json +3 -3
- package/src/components/autocomplete/Autocomplete.spec.js +16 -0
- package/src/components/autocomplete/Autocomplete.vue +9 -3
- package/src/components/colorpicker/ColorpickerHSLRepresentationSquare.vue +2 -0
- package/src/components/colorpicker/ColorpickerHSLRepresentationTriangle.vue +2 -0
- package/src/components/dropdown/Dropdown.vue +51 -3
- package/src/components/numberinput/Numberinput.vue +4 -0
- package/src/components/sidebar/Sidebar.vue +1 -0
- package/src/components/slider/Slider.vue +7 -2
- package/src/components/slider/SliderThumb.vue +8 -0
- package/src/components/table/Table.vue +4 -1
- package/src/components/table/TableColumn.spec.js +51 -0
- package/src/components/table/TableColumn.vue +8 -1
- package/src/components/taginput/Taginput.vue +7 -2
- package/src/components/tooltip/Tooltip.vue +10 -3
- package/src/scss/components/_dropdown.scss +4 -2
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import { e as _toConsumableArray, l as _createForOfIteratorHelper, b as _typeof } from './_rollupPluginBabelHelpers-df313029.js';
|
|
2
|
+
import { t as trapFocus } from './trapFocus-f0736873.js';
|
|
3
|
+
import { c as config } from './config-e7d4b9c2.js';
|
|
4
|
+
import { toCssWidth, isCustomElement, createAbsoluteElement, removeElement } from './helpers.js';
|
|
5
|
+
import { P as ProviderParentMixin, I as InjectedChildMixin } from './InjectedChildMixin-b4220787.js';
|
|
6
|
+
import { n as normalizeComponent } from './plugins-218aea86.js';
|
|
7
|
+
|
|
8
|
+
var DEFAULT_CLOSE_OPTIONS = ['escape', 'outside'];
|
|
9
|
+
var script$1 = {
|
|
10
|
+
name: 'BDropdown',
|
|
11
|
+
directives: {
|
|
12
|
+
trapFocus: trapFocus
|
|
13
|
+
},
|
|
14
|
+
mixins: [ProviderParentMixin('dropdown')],
|
|
15
|
+
props: {
|
|
16
|
+
value: {
|
|
17
|
+
type: [String, Number, Boolean, Object, Array, Function],
|
|
18
|
+
default: null
|
|
19
|
+
},
|
|
20
|
+
disabled: Boolean,
|
|
21
|
+
inline: Boolean,
|
|
22
|
+
scrollable: Boolean,
|
|
23
|
+
maxHeight: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
default: 200
|
|
26
|
+
},
|
|
27
|
+
position: {
|
|
28
|
+
type: String,
|
|
29
|
+
validator: function validator(value) {
|
|
30
|
+
return ['is-top-right', 'is-top-left', 'is-bottom-left', 'is-bottom-right'].indexOf(value) > -1;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
triggers: {
|
|
34
|
+
type: Array,
|
|
35
|
+
default: function _default() {
|
|
36
|
+
return ['click'];
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
mobileModal: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: function _default() {
|
|
42
|
+
return config.defaultDropdownMobileModal;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
ariaRole: {
|
|
46
|
+
type: String,
|
|
47
|
+
validator: function validator(value) {
|
|
48
|
+
return ['menu', 'list', 'dialog'].indexOf(value) > -1;
|
|
49
|
+
},
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
animation: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'fade'
|
|
55
|
+
},
|
|
56
|
+
multiple: Boolean,
|
|
57
|
+
trapFocus: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: function _default() {
|
|
60
|
+
return config.defaultTrapFocus;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
closeOnClick: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: true
|
|
66
|
+
},
|
|
67
|
+
canClose: {
|
|
68
|
+
type: [Array, Boolean],
|
|
69
|
+
default: true
|
|
70
|
+
},
|
|
71
|
+
expanded: Boolean,
|
|
72
|
+
appendToBody: Boolean,
|
|
73
|
+
appendToBodyCopyParent: Boolean,
|
|
74
|
+
triggerTabindex: {
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 0
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
data: function data() {
|
|
80
|
+
return {
|
|
81
|
+
selected: this.value,
|
|
82
|
+
style: {},
|
|
83
|
+
isActive: false,
|
|
84
|
+
isHoverable: false,
|
|
85
|
+
maybeTap: false,
|
|
86
|
+
isTouchEnabled: false,
|
|
87
|
+
_bodyEl: undefined,
|
|
88
|
+
// Used to append to body
|
|
89
|
+
timeOutID: null,
|
|
90
|
+
timeOutID2: null
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
rootClasses: function rootClasses() {
|
|
95
|
+
return [this.position, {
|
|
96
|
+
'is-disabled': this.disabled,
|
|
97
|
+
'is-hoverable': this.hoverable,
|
|
98
|
+
'is-inline': this.inline,
|
|
99
|
+
'is-active': this.isActive || this.inline,
|
|
100
|
+
'is-mobile-modal': this.isMobileModal,
|
|
101
|
+
'is-expanded': this.expanded,
|
|
102
|
+
'is-touch-enabled': this.isTouchEnabled
|
|
103
|
+
}];
|
|
104
|
+
},
|
|
105
|
+
isMobileModal: function isMobileModal() {
|
|
106
|
+
return this.mobileModal && !this.inline;
|
|
107
|
+
},
|
|
108
|
+
cancelOptions: function cancelOptions() {
|
|
109
|
+
return typeof this.canClose === 'boolean' ? this.canClose ? DEFAULT_CLOSE_OPTIONS : [] : this.canClose;
|
|
110
|
+
},
|
|
111
|
+
contentStyle: function contentStyle() {
|
|
112
|
+
return {
|
|
113
|
+
maxHeight: this.scrollable ? toCssWidth(this.maxHeight) : null,
|
|
114
|
+
overflow: this.scrollable ? 'auto' : null
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
hoverable: function hoverable() {
|
|
118
|
+
return this.triggers.indexOf('hover') >= 0;
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
watch: {
|
|
122
|
+
/**
|
|
123
|
+
* When v-model is changed set the new selected item.
|
|
124
|
+
*/
|
|
125
|
+
value: function value(_value) {
|
|
126
|
+
this.selected = _value;
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* Emit event when isActive value is changed.
|
|
130
|
+
*
|
|
131
|
+
* Also resets `isTouchEnabled` when it turns inactive.
|
|
132
|
+
*/
|
|
133
|
+
isActive: function isActive(value) {
|
|
134
|
+
var _this = this;
|
|
135
|
+
this.$emit('active-change', value);
|
|
136
|
+
if (!value) {
|
|
137
|
+
// delays to reset the touch enabled flag until the dropdown
|
|
138
|
+
// menu disappears to avoid glitches
|
|
139
|
+
// also takes care of chattering, e.g., repeated quick taps,
|
|
140
|
+
// otherwise the flag may become inconsistent with the actual
|
|
141
|
+
// state of the dropdown menu
|
|
142
|
+
this.timeOutID = setTimeout(function () {
|
|
143
|
+
if (!_this.isActive) {
|
|
144
|
+
_this.isTouchEnabled = false;
|
|
145
|
+
}
|
|
146
|
+
}, 250);
|
|
147
|
+
}
|
|
148
|
+
this.handleScroll();
|
|
149
|
+
if (this.appendToBody) {
|
|
150
|
+
this.$nextTick(function () {
|
|
151
|
+
_this.updateAppendToBody();
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
isHoverable: function isHoverable(value) {
|
|
156
|
+
if (this.hoverable) {
|
|
157
|
+
this.$emit('active-change', value);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
methods: {
|
|
162
|
+
handleScroll: function handleScroll() {
|
|
163
|
+
if (typeof window === 'undefined') return;
|
|
164
|
+
if (this.isMobileModal) {
|
|
165
|
+
if (this.isActive) {
|
|
166
|
+
document.documentElement.classList.add('is-clipped-touch');
|
|
167
|
+
} else {
|
|
168
|
+
document.documentElement.classList.remove('is-clipped-touch');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* Click listener from DropdownItem.
|
|
174
|
+
* 1. Set new selected item.
|
|
175
|
+
* 2. Emit input event to update the user v-model.
|
|
176
|
+
* 3. Close the dropdown.
|
|
177
|
+
*/
|
|
178
|
+
selectItem: function selectItem(value) {
|
|
179
|
+
if (this.multiple) {
|
|
180
|
+
if (this.selected) {
|
|
181
|
+
if (this.selected.indexOf(value) === -1) {
|
|
182
|
+
// Add value
|
|
183
|
+
this.selected = [].concat(_toConsumableArray(this.selected), [value]);
|
|
184
|
+
} else {
|
|
185
|
+
// Remove value
|
|
186
|
+
this.selected = this.selected.filter(function (val) {
|
|
187
|
+
return val !== value;
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
this.selected = [value];
|
|
192
|
+
}
|
|
193
|
+
this.$emit('change', this.selected);
|
|
194
|
+
} else {
|
|
195
|
+
if (this.selected !== value) {
|
|
196
|
+
this.selected = value;
|
|
197
|
+
this.$emit('change', this.selected);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
this.$emit('input', this.selected);
|
|
201
|
+
if (!this.multiple) {
|
|
202
|
+
this.isActive = !this.closeOnClick;
|
|
203
|
+
if (this.hoverable && this.closeOnClick) {
|
|
204
|
+
this.isHoverable = false;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* White-listed items to not close when clicked.
|
|
210
|
+
*/
|
|
211
|
+
isInWhiteList: function isInWhiteList(el) {
|
|
212
|
+
if (el === this.$refs.dropdownMenu) return true;
|
|
213
|
+
if (el === this.$refs.trigger) return true;
|
|
214
|
+
// All chidren from dropdown
|
|
215
|
+
if (this.$refs.dropdownMenu !== undefined) {
|
|
216
|
+
var children = this.$refs.dropdownMenu.querySelectorAll('*');
|
|
217
|
+
var _iterator = _createForOfIteratorHelper(children),
|
|
218
|
+
_step;
|
|
219
|
+
try {
|
|
220
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
221
|
+
var child = _step.value;
|
|
222
|
+
if (el === child) {
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
} catch (err) {
|
|
227
|
+
_iterator.e(err);
|
|
228
|
+
} finally {
|
|
229
|
+
_iterator.f();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// All children from trigger
|
|
233
|
+
if (this.$refs.trigger !== undefined) {
|
|
234
|
+
var _children = this.$refs.trigger.querySelectorAll('*');
|
|
235
|
+
var _iterator2 = _createForOfIteratorHelper(_children),
|
|
236
|
+
_step2;
|
|
237
|
+
try {
|
|
238
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
239
|
+
var _child = _step2.value;
|
|
240
|
+
if (el === _child) {
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
} catch (err) {
|
|
245
|
+
_iterator2.e(err);
|
|
246
|
+
} finally {
|
|
247
|
+
_iterator2.f();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return false;
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* Close dropdown if clicked outside.
|
|
254
|
+
*/
|
|
255
|
+
clickedOutside: function clickedOutside(event) {
|
|
256
|
+
if (this.cancelOptions.indexOf('outside') < 0) return;
|
|
257
|
+
if (this.inline) return;
|
|
258
|
+
var target = isCustomElement(this) ? event.composedPath()[0] : event.target;
|
|
259
|
+
if (!this.isInWhiteList(target)) this.isActive = false;
|
|
260
|
+
},
|
|
261
|
+
/**
|
|
262
|
+
* Keypress event that is bound to the document
|
|
263
|
+
*/
|
|
264
|
+
keyPress: function keyPress(_ref) {
|
|
265
|
+
var key = _ref.key;
|
|
266
|
+
if (this.isActive && (key === 'Escape' || key === 'Esc')) {
|
|
267
|
+
if (this.cancelOptions.indexOf('escape') < 0) return;
|
|
268
|
+
this.isActive = false;
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
onClick: function onClick() {
|
|
272
|
+
// hover precedes
|
|
273
|
+
if (this.triggers.indexOf('hover') !== -1) return;
|
|
274
|
+
if (this.triggers.indexOf('click') < 0) return;
|
|
275
|
+
this.toggle();
|
|
276
|
+
},
|
|
277
|
+
onContextMenu: function onContextMenu() {
|
|
278
|
+
if (this.triggers.indexOf('contextmenu') < 0) return;
|
|
279
|
+
this.toggle();
|
|
280
|
+
},
|
|
281
|
+
onHover: function onHover() {
|
|
282
|
+
if (this.triggers.indexOf('hover') < 0) return;
|
|
283
|
+
// touch precedes
|
|
284
|
+
if (this.isTouchEnabled) return;
|
|
285
|
+
this.isHoverable = true;
|
|
286
|
+
},
|
|
287
|
+
// takes care of touch-enabled devices
|
|
288
|
+
// - does nothing if hover trigger is disabled
|
|
289
|
+
// - suppresses hover trigger by setting isTouchEnabled
|
|
290
|
+
// - handles only a tap; i.e., touchstart on the trigger immediately
|
|
291
|
+
// folowed by touchend
|
|
292
|
+
onTouchStart: function onTouchStart() {
|
|
293
|
+
this.maybeTap = true;
|
|
294
|
+
},
|
|
295
|
+
onTouchMove: function onTouchMove() {
|
|
296
|
+
this.maybeTap = false;
|
|
297
|
+
},
|
|
298
|
+
onTouchEnd: function onTouchEnd(e) {
|
|
299
|
+
if (this.triggers.indexOf('hover') === -1) return;
|
|
300
|
+
if (!this.maybeTap) return;
|
|
301
|
+
// tap on dropdown contents may happen without preventDefault
|
|
302
|
+
e.preventDefault();
|
|
303
|
+
this.maybeTap = false;
|
|
304
|
+
this.isTouchEnabled = true;
|
|
305
|
+
this.toggle();
|
|
306
|
+
},
|
|
307
|
+
onFocus: function onFocus() {
|
|
308
|
+
if (this.triggers.indexOf('focus') < 0) return;
|
|
309
|
+
this.toggle();
|
|
310
|
+
},
|
|
311
|
+
/**
|
|
312
|
+
* Toggle dropdown if it's not disabled.
|
|
313
|
+
*/
|
|
314
|
+
toggle: function toggle() {
|
|
315
|
+
var _this2 = this;
|
|
316
|
+
if (this.disabled) return;
|
|
317
|
+
if (!this.isActive) {
|
|
318
|
+
// if not active, toggle after clickOutside event
|
|
319
|
+
// this fixes toggling programmatic
|
|
320
|
+
this.$nextTick(function () {
|
|
321
|
+
var value = !_this2.isActive;
|
|
322
|
+
_this2.isActive = value;
|
|
323
|
+
// Vue 2.6.x ???
|
|
324
|
+
_this2.timeOutID2 = setTimeout(function () {
|
|
325
|
+
return _this2.isActive = value;
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
} else {
|
|
329
|
+
this.isActive = !this.isActive;
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
updateAppendToBody: function updateAppendToBody() {
|
|
333
|
+
var dropdown = this.$refs.dropdown;
|
|
334
|
+
var dropdownMenu = this.$refs.dropdownMenu;
|
|
335
|
+
var trigger = this.$refs.trigger;
|
|
336
|
+
if (dropdownMenu && trigger) {
|
|
337
|
+
// update wrapper dropdown
|
|
338
|
+
var dropdownWrapper = this.$data._bodyEl.children[0];
|
|
339
|
+
dropdownWrapper.classList.forEach(function (item) {
|
|
340
|
+
return dropdownWrapper.classList.remove(item);
|
|
341
|
+
});
|
|
342
|
+
dropdownWrapper.classList.add('dropdown');
|
|
343
|
+
dropdownWrapper.classList.add('dropdown-menu-animation');
|
|
344
|
+
if (this.$vnode && this.$vnode.data && this.$vnode.data.staticClass) {
|
|
345
|
+
dropdownWrapper.classList.add(this.$vnode.data.staticClass);
|
|
346
|
+
}
|
|
347
|
+
this.rootClasses.forEach(function (item) {
|
|
348
|
+
// skip position prop
|
|
349
|
+
if (item && _typeof(item) === 'object') {
|
|
350
|
+
for (var key in item) {
|
|
351
|
+
if (item[key]) {
|
|
352
|
+
dropdownWrapper.classList.add(key);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
if (this.appendToBodyCopyParent) {
|
|
358
|
+
var parentNode = this.$refs.dropdown.parentNode;
|
|
359
|
+
var parent = this.$data._bodyEl;
|
|
360
|
+
parent.classList.forEach(function (item) {
|
|
361
|
+
return parent.classList.remove(item);
|
|
362
|
+
});
|
|
363
|
+
parentNode.classList.forEach(function (item) {
|
|
364
|
+
parent.classList.add(item);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
var rect = trigger.getBoundingClientRect();
|
|
368
|
+
var top = rect.top + window.scrollY;
|
|
369
|
+
var left = rect.left + window.scrollX;
|
|
370
|
+
if (!this.position || this.position.indexOf('bottom') >= 0) {
|
|
371
|
+
top += trigger.clientHeight;
|
|
372
|
+
} else {
|
|
373
|
+
top -= dropdownMenu.clientHeight;
|
|
374
|
+
}
|
|
375
|
+
if (this.position && this.position.indexOf('left') >= 0) {
|
|
376
|
+
left -= dropdownMenu.clientWidth - trigger.clientWidth;
|
|
377
|
+
}
|
|
378
|
+
this.style = {
|
|
379
|
+
position: 'absolute',
|
|
380
|
+
top: "".concat(top, "px"),
|
|
381
|
+
left: "".concat(left, "px"),
|
|
382
|
+
zIndex: '99',
|
|
383
|
+
width: this.expanded ? "".concat(dropdown.offsetWidth, "px") : undefined
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
mounted: function mounted() {
|
|
389
|
+
if (this.appendToBody) {
|
|
390
|
+
this.$data._bodyEl = createAbsoluteElement(this.$refs.dropdownMenu);
|
|
391
|
+
this.updateAppendToBody();
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
created: function created() {
|
|
395
|
+
if (typeof window !== 'undefined') {
|
|
396
|
+
document.addEventListener('click', this.clickedOutside);
|
|
397
|
+
document.addEventListener('keyup', this.keyPress);
|
|
398
|
+
}
|
|
399
|
+
},
|
|
400
|
+
beforeDestroy: function beforeDestroy() {
|
|
401
|
+
if (typeof window !== 'undefined') {
|
|
402
|
+
document.removeEventListener('click', this.clickedOutside);
|
|
403
|
+
document.removeEventListener('keyup', this.keyPress);
|
|
404
|
+
}
|
|
405
|
+
if (this.appendToBody) {
|
|
406
|
+
removeElement(this.$data._bodyEl);
|
|
407
|
+
}
|
|
408
|
+
clearTimeout(this.timeOutID);
|
|
409
|
+
clearTimeout(this.timeOutID2);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
/* script */
|
|
414
|
+
const __vue_script__$1 = script$1;
|
|
415
|
+
|
|
416
|
+
/* template */
|
|
417
|
+
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{ref:"dropdown",staticClass:"dropdown dropdown-menu-animation",class:_vm.rootClasses,on:{"mouseleave":function($event){_vm.isHoverable = false;}}},[(!_vm.inline)?_c('div',{ref:"trigger",staticClass:"dropdown-trigger",attrs:{"tabindex":_vm.disabled ? false : _vm.triggerTabindex,"aria-haspopup":"true"},on:{"click":_vm.onClick,"contextmenu":function($event){$event.preventDefault();return _vm.onContextMenu($event)},"mouseenter":_vm.onHover,"!focus":function($event){return _vm.onFocus($event)},"touchstart":_vm.onTouchStart,"touchmove":_vm.onTouchMove,"touchend":_vm.onTouchEnd}},[_vm._t("trigger",null,{"active":_vm.isActive})],2):_vm._e(),_c('transition',{attrs:{"name":_vm.animation}},[(_vm.isMobileModal)?_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.isActive),expression:"isActive"}],staticClass:"background",attrs:{"aria-hidden":!_vm.isActive}}):_vm._e()]),_c('transition',{attrs:{"name":_vm.animation}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:((!_vm.disabled && (_vm.isActive || _vm.isHoverable)) || _vm.inline),expression:"(!disabled && (isActive || isHoverable)) || inline"},{name:"trap-focus",rawName:"v-trap-focus",value:(_vm.trapFocus),expression:"trapFocus"}],ref:"dropdownMenu",staticClass:"dropdown-menu",style:(_vm.style),attrs:{"aria-hidden":!_vm.isActive}},[_c('div',{staticClass:"dropdown-content",style:(_vm.contentStyle),attrs:{"role":_vm.ariaRole,"aria-modal":!_vm.inline}},[_vm._t("default")],2)])])],1)};
|
|
418
|
+
var __vue_staticRenderFns__$1 = [];
|
|
419
|
+
|
|
420
|
+
/* style */
|
|
421
|
+
const __vue_inject_styles__$1 = undefined;
|
|
422
|
+
/* scoped */
|
|
423
|
+
const __vue_scope_id__$1 = undefined;
|
|
424
|
+
/* module identifier */
|
|
425
|
+
const __vue_module_identifier__$1 = undefined;
|
|
426
|
+
/* functional template */
|
|
427
|
+
const __vue_is_functional_template__$1 = false;
|
|
428
|
+
/* style inject */
|
|
429
|
+
|
|
430
|
+
/* style inject SSR */
|
|
431
|
+
|
|
432
|
+
/* style inject shadow dom */
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
|
|
437
|
+
{ render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
|
|
438
|
+
__vue_inject_styles__$1,
|
|
439
|
+
__vue_script__$1,
|
|
440
|
+
__vue_scope_id__$1,
|
|
441
|
+
__vue_is_functional_template__$1,
|
|
442
|
+
__vue_module_identifier__$1,
|
|
443
|
+
false,
|
|
444
|
+
undefined,
|
|
445
|
+
undefined,
|
|
446
|
+
undefined
|
|
447
|
+
);
|
|
448
|
+
|
|
449
|
+
var Dropdown = __vue_component__$1;
|
|
450
|
+
|
|
451
|
+
//
|
|
452
|
+
var script = {
|
|
453
|
+
name: 'BDropdownItem',
|
|
454
|
+
mixins: [InjectedChildMixin('dropdown')],
|
|
455
|
+
props: {
|
|
456
|
+
value: {
|
|
457
|
+
type: [String, Number, Boolean, Object, Array, Function],
|
|
458
|
+
default: null
|
|
459
|
+
},
|
|
460
|
+
separator: Boolean,
|
|
461
|
+
disabled: Boolean,
|
|
462
|
+
custom: Boolean,
|
|
463
|
+
focusable: {
|
|
464
|
+
type: Boolean,
|
|
465
|
+
default: true
|
|
466
|
+
},
|
|
467
|
+
paddingless: Boolean,
|
|
468
|
+
hasLink: Boolean,
|
|
469
|
+
ariaRole: {
|
|
470
|
+
type: String,
|
|
471
|
+
default: ''
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
computed: {
|
|
475
|
+
anchorClasses: function anchorClasses() {
|
|
476
|
+
return {
|
|
477
|
+
'is-disabled': this.parent.disabled || this.disabled,
|
|
478
|
+
'is-paddingless': this.paddingless,
|
|
479
|
+
'is-active': this.isActive
|
|
480
|
+
};
|
|
481
|
+
},
|
|
482
|
+
itemClasses: function itemClasses() {
|
|
483
|
+
return {
|
|
484
|
+
'dropdown-item': !this.hasLink,
|
|
485
|
+
'is-disabled': this.disabled,
|
|
486
|
+
'is-paddingless': this.paddingless,
|
|
487
|
+
'is-active': this.isActive,
|
|
488
|
+
'has-link': this.hasLink
|
|
489
|
+
};
|
|
490
|
+
},
|
|
491
|
+
ariaRoleItem: function ariaRoleItem() {
|
|
492
|
+
return this.ariaRole === 'menuitem' || this.ariaRole === 'listitem' ? this.ariaRole : null;
|
|
493
|
+
},
|
|
494
|
+
isClickable: function isClickable() {
|
|
495
|
+
return !this.parent.disabled && !this.separator && !this.disabled && !this.custom;
|
|
496
|
+
},
|
|
497
|
+
isActive: function isActive() {
|
|
498
|
+
if (this.parent.selected === null) return false;
|
|
499
|
+
if (this.parent.multiple) return this.parent.selected.indexOf(this.value) >= 0;
|
|
500
|
+
return this.value === this.parent.selected;
|
|
501
|
+
},
|
|
502
|
+
isFocusable: function isFocusable() {
|
|
503
|
+
return this.hasLink ? false : this.focusable;
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
methods: {
|
|
507
|
+
/**
|
|
508
|
+
* Click listener, select the item.
|
|
509
|
+
*/
|
|
510
|
+
selectItem: function selectItem() {
|
|
511
|
+
if (!this.isClickable) return;
|
|
512
|
+
this.parent.selectItem(this.value);
|
|
513
|
+
this.$emit('click');
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
/* script */
|
|
519
|
+
const __vue_script__ = script;
|
|
520
|
+
|
|
521
|
+
/* template */
|
|
522
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.separator)?_c('hr',{staticClass:"dropdown-divider"}):(!_vm.custom && !_vm.hasLink)?_c('a',{staticClass:"dropdown-item",class:_vm.anchorClasses,attrs:{"role":_vm.ariaRoleItem,"tabindex":_vm.isFocusable ? 0 : null},on:{"click":_vm.selectItem}},[_vm._t("default")],2):_c('div',{class:_vm.itemClasses,attrs:{"role":_vm.ariaRoleItem,"tabindex":_vm.isFocusable ? 0 : null},on:{"click":_vm.selectItem}},[_vm._t("default")],2)};
|
|
523
|
+
var __vue_staticRenderFns__ = [];
|
|
524
|
+
|
|
525
|
+
/* style */
|
|
526
|
+
const __vue_inject_styles__ = undefined;
|
|
527
|
+
/* scoped */
|
|
528
|
+
const __vue_scope_id__ = undefined;
|
|
529
|
+
/* module identifier */
|
|
530
|
+
const __vue_module_identifier__ = undefined;
|
|
531
|
+
/* functional template */
|
|
532
|
+
const __vue_is_functional_template__ = false;
|
|
533
|
+
/* style inject */
|
|
534
|
+
|
|
535
|
+
/* style inject SSR */
|
|
536
|
+
|
|
537
|
+
/* style inject shadow dom */
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
const __vue_component__ = /*#__PURE__*/normalizeComponent(
|
|
542
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
543
|
+
__vue_inject_styles__,
|
|
544
|
+
__vue_script__,
|
|
545
|
+
__vue_scope_id__,
|
|
546
|
+
__vue_is_functional_template__,
|
|
547
|
+
__vue_module_identifier__,
|
|
548
|
+
false,
|
|
549
|
+
undefined,
|
|
550
|
+
undefined,
|
|
551
|
+
undefined
|
|
552
|
+
);
|
|
553
|
+
|
|
554
|
+
var DropdownItem = __vue_component__;
|
|
555
|
+
|
|
556
|
+
export { DropdownItem as D, Dropdown as a };
|