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,4902 @@
|
|
|
1
|
+
/*! Buefy v0.9.28 | MIT License | github.com/buefy/buefy */
|
|
2
|
+
(function (global, factory) {
|
|
3
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
4
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
5
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Datetimepicker = {}));
|
|
6
|
+
})(this, (function (exports) { 'use strict';
|
|
7
|
+
|
|
8
|
+
function ownKeys(e, r) {
|
|
9
|
+
var t = Object.keys(e);
|
|
10
|
+
if (Object.getOwnPropertySymbols) {
|
|
11
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
12
|
+
r && (o = o.filter(function (r) {
|
|
13
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
14
|
+
})), t.push.apply(t, o);
|
|
15
|
+
}
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
function _objectSpread2(e) {
|
|
19
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
20
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
21
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
22
|
+
_defineProperty(e, r, t[r]);
|
|
23
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
24
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
function _toPrimitive(t, r) {
|
|
30
|
+
if ("object" != typeof t || !t) return t;
|
|
31
|
+
var e = t[Symbol.toPrimitive];
|
|
32
|
+
if (void 0 !== e) {
|
|
33
|
+
var i = e.call(t, r || "default");
|
|
34
|
+
if ("object" != typeof i) return i;
|
|
35
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
36
|
+
}
|
|
37
|
+
return ("string" === r ? String : Number)(t);
|
|
38
|
+
}
|
|
39
|
+
function _toPropertyKey(t) {
|
|
40
|
+
var i = _toPrimitive(t, "string");
|
|
41
|
+
return "symbol" == typeof i ? i : String(i);
|
|
42
|
+
}
|
|
43
|
+
function _typeof(o) {
|
|
44
|
+
"@babel/helpers - typeof";
|
|
45
|
+
|
|
46
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
47
|
+
return typeof o;
|
|
48
|
+
} : function (o) {
|
|
49
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
50
|
+
}, _typeof(o);
|
|
51
|
+
}
|
|
52
|
+
function _defineProperty(obj, key, value) {
|
|
53
|
+
key = _toPropertyKey(key);
|
|
54
|
+
if (key in obj) {
|
|
55
|
+
Object.defineProperty(obj, key, {
|
|
56
|
+
value: value,
|
|
57
|
+
enumerable: true,
|
|
58
|
+
configurable: true,
|
|
59
|
+
writable: true
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
obj[key] = value;
|
|
63
|
+
}
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
66
|
+
function _toArray(arr) {
|
|
67
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
68
|
+
}
|
|
69
|
+
function _toConsumableArray(arr) {
|
|
70
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
71
|
+
}
|
|
72
|
+
function _arrayWithoutHoles(arr) {
|
|
73
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
74
|
+
}
|
|
75
|
+
function _arrayWithHoles(arr) {
|
|
76
|
+
if (Array.isArray(arr)) return arr;
|
|
77
|
+
}
|
|
78
|
+
function _iterableToArray(iter) {
|
|
79
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
80
|
+
}
|
|
81
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
82
|
+
if (!o) return;
|
|
83
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
84
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
85
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
86
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
87
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
88
|
+
}
|
|
89
|
+
function _arrayLikeToArray(arr, len) {
|
|
90
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
91
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
92
|
+
return arr2;
|
|
93
|
+
}
|
|
94
|
+
function _nonIterableSpread() {
|
|
95
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
96
|
+
}
|
|
97
|
+
function _nonIterableRest() {
|
|
98
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
99
|
+
}
|
|
100
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
101
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
102
|
+
if (!it) {
|
|
103
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
104
|
+
if (it) o = it;
|
|
105
|
+
var i = 0;
|
|
106
|
+
var F = function () {};
|
|
107
|
+
return {
|
|
108
|
+
s: F,
|
|
109
|
+
n: function () {
|
|
110
|
+
if (i >= o.length) return {
|
|
111
|
+
done: true
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
done: false,
|
|
115
|
+
value: o[i++]
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
e: function (e) {
|
|
119
|
+
throw e;
|
|
120
|
+
},
|
|
121
|
+
f: F
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
125
|
+
}
|
|
126
|
+
var normalCompletion = true,
|
|
127
|
+
didErr = false,
|
|
128
|
+
err;
|
|
129
|
+
return {
|
|
130
|
+
s: function () {
|
|
131
|
+
it = it.call(o);
|
|
132
|
+
},
|
|
133
|
+
n: function () {
|
|
134
|
+
var step = it.next();
|
|
135
|
+
normalCompletion = step.done;
|
|
136
|
+
return step;
|
|
137
|
+
},
|
|
138
|
+
e: function (e) {
|
|
139
|
+
didErr = true;
|
|
140
|
+
err = e;
|
|
141
|
+
},
|
|
142
|
+
f: function () {
|
|
143
|
+
try {
|
|
144
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
145
|
+
} finally {
|
|
146
|
+
if (didErr) throw err;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
var config = {
|
|
153
|
+
defaultContainerElement: null,
|
|
154
|
+
defaultIconPack: 'mdi',
|
|
155
|
+
defaultIconComponent: null,
|
|
156
|
+
defaultIconPrev: 'chevron-left',
|
|
157
|
+
defaultIconNext: 'chevron-right',
|
|
158
|
+
defaultLocale: undefined,
|
|
159
|
+
defaultDialogConfirmText: null,
|
|
160
|
+
defaultDialogCancelText: null,
|
|
161
|
+
defaultSnackbarDuration: 3500,
|
|
162
|
+
defaultSnackbarPosition: null,
|
|
163
|
+
defaultToastDuration: 2000,
|
|
164
|
+
defaultToastPosition: null,
|
|
165
|
+
defaultNotificationDuration: 2000,
|
|
166
|
+
defaultNotificationPosition: null,
|
|
167
|
+
defaultTooltipType: 'is-primary',
|
|
168
|
+
defaultTooltipDelay: null,
|
|
169
|
+
defaultTooltipCloseDelay: null,
|
|
170
|
+
defaultSidebarDelay: null,
|
|
171
|
+
defaultInputAutocomplete: 'on',
|
|
172
|
+
defaultDateFormatter: null,
|
|
173
|
+
defaultDateParser: null,
|
|
174
|
+
defaultDateCreator: null,
|
|
175
|
+
defaultTimeCreator: null,
|
|
176
|
+
defaultDayNames: null,
|
|
177
|
+
defaultMonthNames: null,
|
|
178
|
+
defaultFirstDayOfWeek: null,
|
|
179
|
+
defaultUnselectableDaysOfWeek: null,
|
|
180
|
+
defaultTimeFormatter: null,
|
|
181
|
+
defaultTimeParser: null,
|
|
182
|
+
defaultModalCanCancel: ['escape', 'x', 'outside', 'button'],
|
|
183
|
+
defaultModalScroll: null,
|
|
184
|
+
defaultDatepickerMobileNative: true,
|
|
185
|
+
defaultTimepickerMobileNative: true,
|
|
186
|
+
defaultTimepickerMobileModal: true,
|
|
187
|
+
defaultNoticeQueue: true,
|
|
188
|
+
defaultInputHasCounter: true,
|
|
189
|
+
defaultTaginputHasCounter: true,
|
|
190
|
+
defaultUseHtml5Validation: true,
|
|
191
|
+
defaultDropdownMobileModal: true,
|
|
192
|
+
defaultFieldLabelPosition: null,
|
|
193
|
+
defaultDatepickerYearsRange: [-100, 10],
|
|
194
|
+
defaultDatepickerNearbyMonthDays: true,
|
|
195
|
+
defaultDatepickerNearbySelectableMonthDays: false,
|
|
196
|
+
defaultDatepickerShowWeekNumber: false,
|
|
197
|
+
defaultDatepickerWeekNumberClickable: false,
|
|
198
|
+
defaultDatepickerMobileModal: true,
|
|
199
|
+
defaultTrapFocus: true,
|
|
200
|
+
defaultAutoFocus: true,
|
|
201
|
+
defaultButtonRounded: false,
|
|
202
|
+
defaultSwitchRounded: true,
|
|
203
|
+
defaultCarouselInterval: 3500,
|
|
204
|
+
defaultTabsExpanded: false,
|
|
205
|
+
defaultTabsAnimated: true,
|
|
206
|
+
defaultTabsType: null,
|
|
207
|
+
defaultStatusIcon: true,
|
|
208
|
+
defaultProgrammaticPromise: false,
|
|
209
|
+
defaultLinkTags: ['a', 'button', 'input', 'router-link', 'nuxt-link', 'n-link', 'RouterLink', 'NuxtLink', 'NLink'],
|
|
210
|
+
defaultImageWebpFallback: null,
|
|
211
|
+
defaultImageLazy: true,
|
|
212
|
+
defaultImageResponsive: true,
|
|
213
|
+
defaultImageRatio: null,
|
|
214
|
+
defaultImageSrcsetFormatter: null,
|
|
215
|
+
defaultBreadcrumbTag: 'a',
|
|
216
|
+
defaultBreadcrumbAlign: 'is-left',
|
|
217
|
+
defaultBreadcrumbSeparator: '',
|
|
218
|
+
defaultBreadcrumbSize: 'is-medium',
|
|
219
|
+
customIconPacks: null
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Checks if the flag is set
|
|
224
|
+
* @param val
|
|
225
|
+
* @param flag
|
|
226
|
+
* @returns {boolean}
|
|
227
|
+
*/
|
|
228
|
+
function hasFlag(val, flag) {
|
|
229
|
+
return (val & flag) === flag;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Merge function to replace Object.assign with deep merging possibility
|
|
234
|
+
*/
|
|
235
|
+
var isObject = function isObject(item) {
|
|
236
|
+
return _typeof(item) === 'object' && !Array.isArray(item);
|
|
237
|
+
};
|
|
238
|
+
var mergeFn = function mergeFn(target, source) {
|
|
239
|
+
var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
240
|
+
if (deep || !Object.assign) {
|
|
241
|
+
var isDeep = function isDeep(prop) {
|
|
242
|
+
return isObject(source[prop]) && target !== null && target.hasOwnProperty(prop) && isObject(target[prop]);
|
|
243
|
+
};
|
|
244
|
+
var replaced = Object.getOwnPropertyNames(source).map(function (prop) {
|
|
245
|
+
return _defineProperty({}, prop, isDeep(prop) ? mergeFn(target[prop], source[prop], deep) : source[prop]);
|
|
246
|
+
}).reduce(function (a, b) {
|
|
247
|
+
return _objectSpread2(_objectSpread2({}, a), b);
|
|
248
|
+
}, {});
|
|
249
|
+
return _objectSpread2(_objectSpread2({}, target), replaced);
|
|
250
|
+
} else {
|
|
251
|
+
return Object.assign(target, source);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var merge = mergeFn;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Mobile detection
|
|
258
|
+
* https://www.abeautifulsite.net/detecting-mobile-devices-with-javascript
|
|
259
|
+
*/
|
|
260
|
+
var isMobile = {
|
|
261
|
+
Android: function Android() {
|
|
262
|
+
return typeof window !== 'undefined' && window.navigator.userAgent.match(/Android/i);
|
|
263
|
+
},
|
|
264
|
+
BlackBerry: function BlackBerry() {
|
|
265
|
+
return typeof window !== 'undefined' && window.navigator.userAgent.match(/BlackBerry/i);
|
|
266
|
+
},
|
|
267
|
+
iOS: function iOS() {
|
|
268
|
+
return typeof window !== 'undefined' && (window.navigator.userAgent.match(/iPhone|iPad|iPod/i) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);
|
|
269
|
+
},
|
|
270
|
+
Opera: function Opera() {
|
|
271
|
+
return typeof window !== 'undefined' && window.navigator.userAgent.match(/Opera Mini/i);
|
|
272
|
+
},
|
|
273
|
+
Windows: function Windows() {
|
|
274
|
+
return typeof window !== 'undefined' && window.navigator.userAgent.match(/IEMobile/i);
|
|
275
|
+
},
|
|
276
|
+
any: function any() {
|
|
277
|
+
return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows();
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
function removeElement(el) {
|
|
281
|
+
if (typeof el.remove !== 'undefined') {
|
|
282
|
+
el.remove();
|
|
283
|
+
} else if (typeof el.parentNode !== 'undefined' && el.parentNode !== null) {
|
|
284
|
+
el.parentNode.removeChild(el);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function createAbsoluteElement(el) {
|
|
288
|
+
var root = document.createElement('div');
|
|
289
|
+
root.style.position = 'absolute';
|
|
290
|
+
root.style.left = '0px';
|
|
291
|
+
root.style.top = '0px';
|
|
292
|
+
root.style.width = '100%';
|
|
293
|
+
var wrapper = document.createElement('div');
|
|
294
|
+
root.appendChild(wrapper);
|
|
295
|
+
wrapper.appendChild(el);
|
|
296
|
+
document.body.appendChild(root);
|
|
297
|
+
return root;
|
|
298
|
+
}
|
|
299
|
+
function isVueComponent(c) {
|
|
300
|
+
return c && c._isVue;
|
|
301
|
+
}
|
|
302
|
+
function toCssWidth(width) {
|
|
303
|
+
return width === undefined ? null : isNaN(width) ? width : width + 'px';
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Return month names according to a specified locale
|
|
308
|
+
* @param {String} locale A bcp47 localerouter. undefined will use the user browser locale
|
|
309
|
+
* @param {String} format long (ex. March), short (ex. Mar) or narrow (M)
|
|
310
|
+
* @return {Array<String>} An array of month names
|
|
311
|
+
*/
|
|
312
|
+
function getMonthNames() {
|
|
313
|
+
var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
314
|
+
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'long';
|
|
315
|
+
var dates = [];
|
|
316
|
+
for (var i = 0; i < 12; i++) {
|
|
317
|
+
dates.push(new Date(2000, i, 15));
|
|
318
|
+
}
|
|
319
|
+
var dtf = new Intl.DateTimeFormat(locale, {
|
|
320
|
+
month: format
|
|
321
|
+
});
|
|
322
|
+
return dates.map(function (d) {
|
|
323
|
+
return dtf.format(d);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Return weekday names according to a specified locale
|
|
329
|
+
* @param {String} locale A bcp47 localerouter. undefined will use the user browser locale
|
|
330
|
+
* @param {String} format long (ex. Thursday), short (ex. Thu) or narrow (T)
|
|
331
|
+
* @return {Array<String>} An array of weekday names
|
|
332
|
+
*/
|
|
333
|
+
function getWeekdayNames() {
|
|
334
|
+
var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
335
|
+
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'narrow';
|
|
336
|
+
var dates = [];
|
|
337
|
+
for (var i = 0; i < 7; i++) {
|
|
338
|
+
var dt = new Date(2000, 0, i + 1);
|
|
339
|
+
dates[dt.getDay()] = dt;
|
|
340
|
+
}
|
|
341
|
+
var dtf = new Intl.DateTimeFormat(locale, {
|
|
342
|
+
weekday: format
|
|
343
|
+
});
|
|
344
|
+
return dates.map(function (d) {
|
|
345
|
+
return dtf.format(d);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Accept a regex with group names and return an object
|
|
351
|
+
* ex. matchWithGroups(/((?!=<year>)\d+)\/((?!=<month>)\d+)\/((?!=<day>)\d+)/, '2000/12/25')
|
|
352
|
+
* will return { year: 2000, month: 12, day: 25 }
|
|
353
|
+
* @param {String} includes injections of (?!={groupname}) for each group
|
|
354
|
+
* @param {String} the string to run regex
|
|
355
|
+
* @return {Object} an object with a property for each group having the group's match as the value
|
|
356
|
+
*/
|
|
357
|
+
function matchWithGroups(pattern, str) {
|
|
358
|
+
var matches = str.match(pattern);
|
|
359
|
+
return pattern
|
|
360
|
+
// get the pattern as a string
|
|
361
|
+
.toString()
|
|
362
|
+
// suss out the groups
|
|
363
|
+
.match(/<(.+?)>/g)
|
|
364
|
+
// remove the braces
|
|
365
|
+
.map(function (group) {
|
|
366
|
+
var groupMatches = group.match(/<(.+)>/);
|
|
367
|
+
if (!groupMatches || groupMatches.length <= 0) {
|
|
368
|
+
return null;
|
|
369
|
+
}
|
|
370
|
+
return group.match(/<(.+)>/)[1];
|
|
371
|
+
})
|
|
372
|
+
// create an object with a property for each group having the group's match as the value
|
|
373
|
+
.reduce(function (acc, curr, index, arr) {
|
|
374
|
+
if (matches && matches.length > index) {
|
|
375
|
+
acc[curr] = matches[index + 1];
|
|
376
|
+
} else {
|
|
377
|
+
acc[curr] = null;
|
|
378
|
+
}
|
|
379
|
+
return acc;
|
|
380
|
+
}, {});
|
|
381
|
+
}
|
|
382
|
+
function isCustomElement(vm) {
|
|
383
|
+
return 'shadowRoot' in vm.$root.$options;
|
|
384
|
+
}
|
|
385
|
+
var isDefined = function isDefined(d) {
|
|
386
|
+
return d !== undefined;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
var FormElementMixin = {
|
|
390
|
+
props: {
|
|
391
|
+
size: String,
|
|
392
|
+
expanded: Boolean,
|
|
393
|
+
loading: Boolean,
|
|
394
|
+
rounded: Boolean,
|
|
395
|
+
icon: String,
|
|
396
|
+
iconPack: String,
|
|
397
|
+
// Native options to use in HTML5 validation
|
|
398
|
+
autocomplete: String,
|
|
399
|
+
maxlength: [Number, String],
|
|
400
|
+
useHtml5Validation: {
|
|
401
|
+
type: Boolean,
|
|
402
|
+
default: function _default() {
|
|
403
|
+
return config.defaultUseHtml5Validation;
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
validationMessage: String,
|
|
407
|
+
locale: {
|
|
408
|
+
type: [String, Array],
|
|
409
|
+
default: function _default() {
|
|
410
|
+
return config.defaultLocale;
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
statusIcon: {
|
|
414
|
+
type: Boolean,
|
|
415
|
+
default: function _default() {
|
|
416
|
+
return config.defaultStatusIcon;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
data: function data() {
|
|
421
|
+
return {
|
|
422
|
+
isValid: true,
|
|
423
|
+
isFocused: false,
|
|
424
|
+
newIconPack: this.iconPack || config.defaultIconPack
|
|
425
|
+
};
|
|
426
|
+
},
|
|
427
|
+
computed: {
|
|
428
|
+
/**
|
|
429
|
+
* Find parent Field, max 3 levels deep.
|
|
430
|
+
*/
|
|
431
|
+
parentField: function parentField() {
|
|
432
|
+
var parent = this.$parent;
|
|
433
|
+
for (var i = 0; i < 3; i++) {
|
|
434
|
+
if (parent && !parent.$data._isField) {
|
|
435
|
+
parent = parent.$parent;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return parent;
|
|
439
|
+
},
|
|
440
|
+
/**
|
|
441
|
+
* Get the type prop from parent if it's a Field.
|
|
442
|
+
*/
|
|
443
|
+
statusType: function statusType() {
|
|
444
|
+
var _ref = this.parentField || {},
|
|
445
|
+
newType = _ref.newType;
|
|
446
|
+
if (!newType) return;
|
|
447
|
+
if (typeof newType === 'string') {
|
|
448
|
+
return newType;
|
|
449
|
+
} else {
|
|
450
|
+
for (var key in newType) {
|
|
451
|
+
if (newType[key]) {
|
|
452
|
+
return key;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
/**
|
|
458
|
+
* Get the message prop from parent if it's a Field.
|
|
459
|
+
*/
|
|
460
|
+
statusMessage: function statusMessage() {
|
|
461
|
+
if (!this.parentField) return;
|
|
462
|
+
return this.parentField.newMessage || this.parentField.$slots.message;
|
|
463
|
+
},
|
|
464
|
+
/**
|
|
465
|
+
* Fix icon size for inputs, large was too big
|
|
466
|
+
*/
|
|
467
|
+
iconSize: function iconSize() {
|
|
468
|
+
switch (this.size) {
|
|
469
|
+
case 'is-small':
|
|
470
|
+
return this.size;
|
|
471
|
+
case 'is-medium':
|
|
472
|
+
return;
|
|
473
|
+
case 'is-large':
|
|
474
|
+
return this.newIconPack === 'mdi' ? 'is-medium' : '';
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
methods: {
|
|
479
|
+
/**
|
|
480
|
+
* Focus method that work dynamically depending on the component.
|
|
481
|
+
*/
|
|
482
|
+
focus: function focus() {
|
|
483
|
+
var el = this.getElement();
|
|
484
|
+
if (el === undefined) return;
|
|
485
|
+
this.$nextTick(function () {
|
|
486
|
+
if (el) el.focus();
|
|
487
|
+
});
|
|
488
|
+
},
|
|
489
|
+
onBlur: function onBlur($event) {
|
|
490
|
+
this.isFocused = false;
|
|
491
|
+
this.$emit('blur', $event);
|
|
492
|
+
this.checkHtml5Validity();
|
|
493
|
+
},
|
|
494
|
+
onFocus: function onFocus($event) {
|
|
495
|
+
this.isFocused = true;
|
|
496
|
+
this.$emit('focus', $event);
|
|
497
|
+
},
|
|
498
|
+
getElement: function getElement() {
|
|
499
|
+
var el = this.$refs[this.$data._elementRef];
|
|
500
|
+
while (isVueComponent(el)) {
|
|
501
|
+
el = el.$refs[el.$data._elementRef];
|
|
502
|
+
}
|
|
503
|
+
return el;
|
|
504
|
+
},
|
|
505
|
+
setInvalid: function setInvalid() {
|
|
506
|
+
var type = 'is-danger';
|
|
507
|
+
var message = this.validationMessage || this.getElement().validationMessage;
|
|
508
|
+
this.setValidity(type, message);
|
|
509
|
+
},
|
|
510
|
+
setValidity: function setValidity(type, message) {
|
|
511
|
+
var _this = this;
|
|
512
|
+
this.$nextTick(function () {
|
|
513
|
+
if (_this.parentField) {
|
|
514
|
+
// Set type only if not defined
|
|
515
|
+
if (!_this.parentField.type) {
|
|
516
|
+
_this.parentField.newType = type;
|
|
517
|
+
}
|
|
518
|
+
// Set message only if not defined
|
|
519
|
+
if (!_this.parentField.message) {
|
|
520
|
+
_this.parentField.newMessage = message;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
},
|
|
525
|
+
/**
|
|
526
|
+
* Check HTML5 validation, set isValid property.
|
|
527
|
+
* If validation fail, send 'is-danger' type,
|
|
528
|
+
* and error message to parent if it's a Field.
|
|
529
|
+
*/
|
|
530
|
+
checkHtml5Validity: function checkHtml5Validity() {
|
|
531
|
+
if (!this.useHtml5Validation) return;
|
|
532
|
+
var el = this.getElement();
|
|
533
|
+
if (el === undefined) return;
|
|
534
|
+
if (!el.checkValidity()) {
|
|
535
|
+
this.setInvalid();
|
|
536
|
+
this.isValid = false;
|
|
537
|
+
} else {
|
|
538
|
+
this.setValidity(null, null);
|
|
539
|
+
this.isValid = true;
|
|
540
|
+
}
|
|
541
|
+
return this.isValid;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
var findFocusable = function findFocusable(element) {
|
|
547
|
+
var programmatic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
548
|
+
if (!element) {
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
if (programmatic) {
|
|
552
|
+
return element.querySelectorAll("*[tabindex=\"-1\"]");
|
|
553
|
+
}
|
|
554
|
+
return element.querySelectorAll("a[href]:not([tabindex=\"-1\"]),\n area[href],\n input:not([disabled]),\n select:not([disabled]),\n textarea:not([disabled]),\n button:not([disabled]),\n iframe,\n object,\n embed,\n *[tabindex]:not([tabindex=\"-1\"]),\n *[contenteditable]");
|
|
555
|
+
};
|
|
556
|
+
var onKeyDown;
|
|
557
|
+
var bind = function bind(el, _ref) {
|
|
558
|
+
var _ref$value = _ref.value,
|
|
559
|
+
value = _ref$value === void 0 ? true : _ref$value;
|
|
560
|
+
if (value) {
|
|
561
|
+
var focusable = findFocusable(el);
|
|
562
|
+
var focusableProg = findFocusable(el, true);
|
|
563
|
+
if (focusable && focusable.length > 0) {
|
|
564
|
+
onKeyDown = function onKeyDown(event) {
|
|
565
|
+
// Need to get focusable each time since it can change between key events
|
|
566
|
+
// ex. changing month in a datepicker
|
|
567
|
+
focusable = findFocusable(el);
|
|
568
|
+
focusableProg = findFocusable(el, true);
|
|
569
|
+
var firstFocusable = focusable[0];
|
|
570
|
+
var lastFocusable = focusable[focusable.length - 1];
|
|
571
|
+
if (event.target === firstFocusable && event.shiftKey && event.key === 'Tab') {
|
|
572
|
+
event.preventDefault();
|
|
573
|
+
lastFocusable.focus();
|
|
574
|
+
} else if ((event.target === lastFocusable || Array.from(focusableProg).indexOf(event.target) >= 0) && !event.shiftKey && event.key === 'Tab') {
|
|
575
|
+
event.preventDefault();
|
|
576
|
+
firstFocusable.focus();
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
el.addEventListener('keydown', onKeyDown);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
var unbind = function unbind(el) {
|
|
584
|
+
el.removeEventListener('keydown', onKeyDown);
|
|
585
|
+
};
|
|
586
|
+
var directive = {
|
|
587
|
+
bind: bind,
|
|
588
|
+
unbind: unbind
|
|
589
|
+
};
|
|
590
|
+
var trapFocus = directive;
|
|
591
|
+
|
|
592
|
+
var items = 1;
|
|
593
|
+
var sorted$1 = 3;
|
|
594
|
+
var ProviderParentMixin = (function (itemName) {
|
|
595
|
+
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
596
|
+
var mixin = {
|
|
597
|
+
provide: function provide() {
|
|
598
|
+
return _defineProperty({}, 'b' + itemName, this);
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
if (hasFlag(flags, items)) {
|
|
602
|
+
mixin.data = function () {
|
|
603
|
+
return {
|
|
604
|
+
childItems: []
|
|
605
|
+
};
|
|
606
|
+
};
|
|
607
|
+
mixin.methods = {
|
|
608
|
+
_registerItem: function _registerItem(item) {
|
|
609
|
+
this.childItems.push(item);
|
|
610
|
+
},
|
|
611
|
+
_unregisterItem: function _unregisterItem(item) {
|
|
612
|
+
this.childItems = this.childItems.filter(function (i) {
|
|
613
|
+
return i !== item;
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
if (hasFlag(flags, sorted$1)) {
|
|
618
|
+
mixin.watch = {
|
|
619
|
+
/**
|
|
620
|
+
* When items are added/removed deep search in the elements default's slot
|
|
621
|
+
* And mark the items with their index
|
|
622
|
+
*/
|
|
623
|
+
childItems: function childItems(items) {
|
|
624
|
+
if (items.length > 0 && this.$scopedSlots.default) {
|
|
625
|
+
var tag = items[0].$vnode.tag;
|
|
626
|
+
var index = 0;
|
|
627
|
+
var deepSearch = function deepSearch(children) {
|
|
628
|
+
var _iterator = _createForOfIteratorHelper(children),
|
|
629
|
+
_step;
|
|
630
|
+
try {
|
|
631
|
+
var _loop = function _loop() {
|
|
632
|
+
var child = _step.value;
|
|
633
|
+
if (child.tag === tag) {
|
|
634
|
+
// An item with the same tag will for sure be found
|
|
635
|
+
var it = items.find(function (i) {
|
|
636
|
+
return i.$vnode === child;
|
|
637
|
+
});
|
|
638
|
+
if (it) {
|
|
639
|
+
it.index = index++;
|
|
640
|
+
}
|
|
641
|
+
} else if (child.tag) {
|
|
642
|
+
var sub = child.componentInstance ? child.componentInstance.$scopedSlots.default ? child.componentInstance.$scopedSlots.default() : child.componentInstance.$children : child.children;
|
|
643
|
+
if (Array.isArray(sub) && sub.length > 0) {
|
|
644
|
+
deepSearch(sub.map(function (e) {
|
|
645
|
+
return e.$vnode;
|
|
646
|
+
}));
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
651
|
+
_loop();
|
|
652
|
+
}
|
|
653
|
+
} catch (err) {
|
|
654
|
+
_iterator.e(err);
|
|
655
|
+
} finally {
|
|
656
|
+
_iterator.f();
|
|
657
|
+
}
|
|
658
|
+
return false;
|
|
659
|
+
};
|
|
660
|
+
deepSearch(this.$scopedSlots.default());
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
mixin.computed = {
|
|
665
|
+
/**
|
|
666
|
+
* When items are added/removed sort them according to their position
|
|
667
|
+
*/
|
|
668
|
+
sortedItems: function sortedItems() {
|
|
669
|
+
return this.childItems.slice().sort(function (i1, i2) {
|
|
670
|
+
return i1.index - i2.index;
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return mixin;
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
var DEFAULT_CLOSE_OPTIONS = ['escape', 'outside'];
|
|
680
|
+
var script$c = {
|
|
681
|
+
name: 'BDropdown',
|
|
682
|
+
directives: {
|
|
683
|
+
trapFocus: trapFocus
|
|
684
|
+
},
|
|
685
|
+
mixins: [ProviderParentMixin('dropdown')],
|
|
686
|
+
props: {
|
|
687
|
+
value: {
|
|
688
|
+
type: [String, Number, Boolean, Object, Array, Function],
|
|
689
|
+
default: null
|
|
690
|
+
},
|
|
691
|
+
disabled: Boolean,
|
|
692
|
+
inline: Boolean,
|
|
693
|
+
scrollable: Boolean,
|
|
694
|
+
maxHeight: {
|
|
695
|
+
type: [String, Number],
|
|
696
|
+
default: 200
|
|
697
|
+
},
|
|
698
|
+
position: {
|
|
699
|
+
type: String,
|
|
700
|
+
validator: function validator(value) {
|
|
701
|
+
return ['is-top-right', 'is-top-left', 'is-bottom-left', 'is-bottom-right'].indexOf(value) > -1;
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
triggers: {
|
|
705
|
+
type: Array,
|
|
706
|
+
default: function _default() {
|
|
707
|
+
return ['click'];
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
mobileModal: {
|
|
711
|
+
type: Boolean,
|
|
712
|
+
default: function _default() {
|
|
713
|
+
return config.defaultDropdownMobileModal;
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
ariaRole: {
|
|
717
|
+
type: String,
|
|
718
|
+
validator: function validator(value) {
|
|
719
|
+
return ['menu', 'list', 'dialog'].indexOf(value) > -1;
|
|
720
|
+
},
|
|
721
|
+
default: null
|
|
722
|
+
},
|
|
723
|
+
animation: {
|
|
724
|
+
type: String,
|
|
725
|
+
default: 'fade'
|
|
726
|
+
},
|
|
727
|
+
multiple: Boolean,
|
|
728
|
+
trapFocus: {
|
|
729
|
+
type: Boolean,
|
|
730
|
+
default: function _default() {
|
|
731
|
+
return config.defaultTrapFocus;
|
|
732
|
+
}
|
|
733
|
+
},
|
|
734
|
+
closeOnClick: {
|
|
735
|
+
type: Boolean,
|
|
736
|
+
default: true
|
|
737
|
+
},
|
|
738
|
+
canClose: {
|
|
739
|
+
type: [Array, Boolean],
|
|
740
|
+
default: true
|
|
741
|
+
},
|
|
742
|
+
expanded: Boolean,
|
|
743
|
+
appendToBody: Boolean,
|
|
744
|
+
appendToBodyCopyParent: Boolean,
|
|
745
|
+
triggerTabindex: {
|
|
746
|
+
type: Number,
|
|
747
|
+
default: 0
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
data: function data() {
|
|
751
|
+
return {
|
|
752
|
+
selected: this.value,
|
|
753
|
+
style: {},
|
|
754
|
+
isActive: false,
|
|
755
|
+
isHoverable: false,
|
|
756
|
+
maybeTap: false,
|
|
757
|
+
isTouchEnabled: false,
|
|
758
|
+
_bodyEl: undefined,
|
|
759
|
+
// Used to append to body
|
|
760
|
+
timeOutID: null,
|
|
761
|
+
timeOutID2: null
|
|
762
|
+
};
|
|
763
|
+
},
|
|
764
|
+
computed: {
|
|
765
|
+
rootClasses: function rootClasses() {
|
|
766
|
+
return [this.position, {
|
|
767
|
+
'is-disabled': this.disabled,
|
|
768
|
+
'is-hoverable': this.hoverable,
|
|
769
|
+
'is-inline': this.inline,
|
|
770
|
+
'is-active': this.isActive || this.inline,
|
|
771
|
+
'is-mobile-modal': this.isMobileModal,
|
|
772
|
+
'is-expanded': this.expanded,
|
|
773
|
+
'is-touch-enabled': this.isTouchEnabled
|
|
774
|
+
}];
|
|
775
|
+
},
|
|
776
|
+
isMobileModal: function isMobileModal() {
|
|
777
|
+
return this.mobileModal && !this.inline;
|
|
778
|
+
},
|
|
779
|
+
cancelOptions: function cancelOptions() {
|
|
780
|
+
return typeof this.canClose === 'boolean' ? this.canClose ? DEFAULT_CLOSE_OPTIONS : [] : this.canClose;
|
|
781
|
+
},
|
|
782
|
+
contentStyle: function contentStyle() {
|
|
783
|
+
return {
|
|
784
|
+
maxHeight: this.scrollable ? toCssWidth(this.maxHeight) : null,
|
|
785
|
+
overflow: this.scrollable ? 'auto' : null
|
|
786
|
+
};
|
|
787
|
+
},
|
|
788
|
+
hoverable: function hoverable() {
|
|
789
|
+
return this.triggers.indexOf('hover') >= 0;
|
|
790
|
+
}
|
|
791
|
+
},
|
|
792
|
+
watch: {
|
|
793
|
+
/**
|
|
794
|
+
* When v-model is changed set the new selected item.
|
|
795
|
+
*/
|
|
796
|
+
value: function value(_value) {
|
|
797
|
+
this.selected = _value;
|
|
798
|
+
},
|
|
799
|
+
/**
|
|
800
|
+
* Emit event when isActive value is changed.
|
|
801
|
+
*
|
|
802
|
+
* Also resets `isTouchEnabled` when it turns inactive.
|
|
803
|
+
*/
|
|
804
|
+
isActive: function isActive(value) {
|
|
805
|
+
var _this = this;
|
|
806
|
+
this.$emit('active-change', value);
|
|
807
|
+
if (!value) {
|
|
808
|
+
// delays to reset the touch enabled flag until the dropdown
|
|
809
|
+
// menu disappears to avoid glitches
|
|
810
|
+
// also takes care of chattering, e.g., repeated quick taps,
|
|
811
|
+
// otherwise the flag may become inconsistent with the actual
|
|
812
|
+
// state of the dropdown menu
|
|
813
|
+
this.timeOutID = setTimeout(function () {
|
|
814
|
+
if (!_this.isActive) {
|
|
815
|
+
_this.isTouchEnabled = false;
|
|
816
|
+
}
|
|
817
|
+
}, 250);
|
|
818
|
+
}
|
|
819
|
+
this.handleScroll();
|
|
820
|
+
if (this.appendToBody) {
|
|
821
|
+
this.$nextTick(function () {
|
|
822
|
+
_this.updateAppendToBody();
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
},
|
|
826
|
+
isHoverable: function isHoverable(value) {
|
|
827
|
+
if (this.hoverable) {
|
|
828
|
+
this.$emit('active-change', value);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
methods: {
|
|
833
|
+
handleScroll: function handleScroll() {
|
|
834
|
+
if (typeof window === 'undefined') return;
|
|
835
|
+
if (this.isMobileModal) {
|
|
836
|
+
if (this.isActive) {
|
|
837
|
+
document.documentElement.classList.add('is-clipped-touch');
|
|
838
|
+
} else {
|
|
839
|
+
document.documentElement.classList.remove('is-clipped-touch');
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
/**
|
|
844
|
+
* Click listener from DropdownItem.
|
|
845
|
+
* 1. Set new selected item.
|
|
846
|
+
* 2. Emit input event to update the user v-model.
|
|
847
|
+
* 3. Close the dropdown.
|
|
848
|
+
*/
|
|
849
|
+
selectItem: function selectItem(value) {
|
|
850
|
+
if (this.multiple) {
|
|
851
|
+
if (this.selected) {
|
|
852
|
+
if (this.selected.indexOf(value) === -1) {
|
|
853
|
+
// Add value
|
|
854
|
+
this.selected = [].concat(_toConsumableArray(this.selected), [value]);
|
|
855
|
+
} else {
|
|
856
|
+
// Remove value
|
|
857
|
+
this.selected = this.selected.filter(function (val) {
|
|
858
|
+
return val !== value;
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
} else {
|
|
862
|
+
this.selected = [value];
|
|
863
|
+
}
|
|
864
|
+
this.$emit('change', this.selected);
|
|
865
|
+
} else {
|
|
866
|
+
if (this.selected !== value) {
|
|
867
|
+
this.selected = value;
|
|
868
|
+
this.$emit('change', this.selected);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
this.$emit('input', this.selected);
|
|
872
|
+
if (!this.multiple) {
|
|
873
|
+
this.isActive = !this.closeOnClick;
|
|
874
|
+
if (this.hoverable && this.closeOnClick) {
|
|
875
|
+
this.isHoverable = false;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
},
|
|
879
|
+
/**
|
|
880
|
+
* White-listed items to not close when clicked.
|
|
881
|
+
*/
|
|
882
|
+
isInWhiteList: function isInWhiteList(el) {
|
|
883
|
+
if (el === this.$refs.dropdownMenu) return true;
|
|
884
|
+
if (el === this.$refs.trigger) return true;
|
|
885
|
+
// All chidren from dropdown
|
|
886
|
+
if (this.$refs.dropdownMenu !== undefined) {
|
|
887
|
+
var children = this.$refs.dropdownMenu.querySelectorAll('*');
|
|
888
|
+
var _iterator = _createForOfIteratorHelper(children),
|
|
889
|
+
_step;
|
|
890
|
+
try {
|
|
891
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
892
|
+
var child = _step.value;
|
|
893
|
+
if (el === child) {
|
|
894
|
+
return true;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
} catch (err) {
|
|
898
|
+
_iterator.e(err);
|
|
899
|
+
} finally {
|
|
900
|
+
_iterator.f();
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
// All children from trigger
|
|
904
|
+
if (this.$refs.trigger !== undefined) {
|
|
905
|
+
var _children = this.$refs.trigger.querySelectorAll('*');
|
|
906
|
+
var _iterator2 = _createForOfIteratorHelper(_children),
|
|
907
|
+
_step2;
|
|
908
|
+
try {
|
|
909
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
910
|
+
var _child = _step2.value;
|
|
911
|
+
if (el === _child) {
|
|
912
|
+
return true;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
} catch (err) {
|
|
916
|
+
_iterator2.e(err);
|
|
917
|
+
} finally {
|
|
918
|
+
_iterator2.f();
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return false;
|
|
922
|
+
},
|
|
923
|
+
/**
|
|
924
|
+
* Close dropdown if clicked outside.
|
|
925
|
+
*/
|
|
926
|
+
clickedOutside: function clickedOutside(event) {
|
|
927
|
+
if (this.cancelOptions.indexOf('outside') < 0) return;
|
|
928
|
+
if (this.inline) return;
|
|
929
|
+
var target = isCustomElement(this) ? event.composedPath()[0] : event.target;
|
|
930
|
+
if (!this.isInWhiteList(target)) this.isActive = false;
|
|
931
|
+
},
|
|
932
|
+
/**
|
|
933
|
+
* Keypress event that is bound to the document
|
|
934
|
+
*/
|
|
935
|
+
keyPress: function keyPress(_ref) {
|
|
936
|
+
var key = _ref.key;
|
|
937
|
+
if (this.isActive && (key === 'Escape' || key === 'Esc')) {
|
|
938
|
+
if (this.cancelOptions.indexOf('escape') < 0) return;
|
|
939
|
+
this.isActive = false;
|
|
940
|
+
}
|
|
941
|
+
},
|
|
942
|
+
onClick: function onClick() {
|
|
943
|
+
// hover precedes
|
|
944
|
+
if (this.triggers.indexOf('hover') !== -1) return;
|
|
945
|
+
if (this.triggers.indexOf('click') < 0) return;
|
|
946
|
+
this.toggle();
|
|
947
|
+
},
|
|
948
|
+
onContextMenu: function onContextMenu() {
|
|
949
|
+
if (this.triggers.indexOf('contextmenu') < 0) return;
|
|
950
|
+
this.toggle();
|
|
951
|
+
},
|
|
952
|
+
onHover: function onHover() {
|
|
953
|
+
if (this.triggers.indexOf('hover') < 0) return;
|
|
954
|
+
// touch precedes
|
|
955
|
+
if (this.isTouchEnabled) return;
|
|
956
|
+
this.isHoverable = true;
|
|
957
|
+
},
|
|
958
|
+
// takes care of touch-enabled devices
|
|
959
|
+
// - does nothing if hover trigger is disabled
|
|
960
|
+
// - suppresses hover trigger by setting isTouchEnabled
|
|
961
|
+
// - handles only a tap; i.e., touchstart on the trigger immediately
|
|
962
|
+
// folowed by touchend
|
|
963
|
+
onTouchStart: function onTouchStart() {
|
|
964
|
+
this.maybeTap = true;
|
|
965
|
+
},
|
|
966
|
+
onTouchMove: function onTouchMove() {
|
|
967
|
+
this.maybeTap = false;
|
|
968
|
+
},
|
|
969
|
+
onTouchEnd: function onTouchEnd(e) {
|
|
970
|
+
if (this.triggers.indexOf('hover') === -1) return;
|
|
971
|
+
if (!this.maybeTap) return;
|
|
972
|
+
// tap on dropdown contents may happen without preventDefault
|
|
973
|
+
e.preventDefault();
|
|
974
|
+
this.maybeTap = false;
|
|
975
|
+
this.isTouchEnabled = true;
|
|
976
|
+
this.toggle();
|
|
977
|
+
},
|
|
978
|
+
onFocus: function onFocus() {
|
|
979
|
+
if (this.triggers.indexOf('focus') < 0) return;
|
|
980
|
+
this.toggle();
|
|
981
|
+
},
|
|
982
|
+
/**
|
|
983
|
+
* Toggle dropdown if it's not disabled.
|
|
984
|
+
*/
|
|
985
|
+
toggle: function toggle() {
|
|
986
|
+
var _this2 = this;
|
|
987
|
+
if (this.disabled) return;
|
|
988
|
+
if (!this.isActive) {
|
|
989
|
+
// if not active, toggle after clickOutside event
|
|
990
|
+
// this fixes toggling programmatic
|
|
991
|
+
this.$nextTick(function () {
|
|
992
|
+
var value = !_this2.isActive;
|
|
993
|
+
_this2.isActive = value;
|
|
994
|
+
// Vue 2.6.x ???
|
|
995
|
+
_this2.timeOutID2 = setTimeout(function () {
|
|
996
|
+
return _this2.isActive = value;
|
|
997
|
+
});
|
|
998
|
+
});
|
|
999
|
+
} else {
|
|
1000
|
+
this.isActive = !this.isActive;
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
updateAppendToBody: function updateAppendToBody() {
|
|
1004
|
+
var dropdown = this.$refs.dropdown;
|
|
1005
|
+
var dropdownMenu = this.$refs.dropdownMenu;
|
|
1006
|
+
var trigger = this.$refs.trigger;
|
|
1007
|
+
if (dropdownMenu && trigger) {
|
|
1008
|
+
// update wrapper dropdown
|
|
1009
|
+
var dropdownWrapper = this.$data._bodyEl.children[0];
|
|
1010
|
+
dropdownWrapper.classList.forEach(function (item) {
|
|
1011
|
+
return dropdownWrapper.classList.remove(item);
|
|
1012
|
+
});
|
|
1013
|
+
dropdownWrapper.classList.add('dropdown');
|
|
1014
|
+
dropdownWrapper.classList.add('dropdown-menu-animation');
|
|
1015
|
+
if (this.$vnode && this.$vnode.data && this.$vnode.data.staticClass) {
|
|
1016
|
+
dropdownWrapper.classList.add(this.$vnode.data.staticClass);
|
|
1017
|
+
}
|
|
1018
|
+
this.rootClasses.forEach(function (item) {
|
|
1019
|
+
// skip position prop
|
|
1020
|
+
if (item && _typeof(item) === 'object') {
|
|
1021
|
+
for (var key in item) {
|
|
1022
|
+
if (item[key]) {
|
|
1023
|
+
dropdownWrapper.classList.add(key);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
if (this.appendToBodyCopyParent) {
|
|
1029
|
+
var parentNode = this.$refs.dropdown.parentNode;
|
|
1030
|
+
var parent = this.$data._bodyEl;
|
|
1031
|
+
parent.classList.forEach(function (item) {
|
|
1032
|
+
return parent.classList.remove(item);
|
|
1033
|
+
});
|
|
1034
|
+
parentNode.classList.forEach(function (item) {
|
|
1035
|
+
parent.classList.add(item);
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
var rect = trigger.getBoundingClientRect();
|
|
1039
|
+
var top = rect.top + window.scrollY;
|
|
1040
|
+
var left = rect.left + window.scrollX;
|
|
1041
|
+
if (!this.position || this.position.indexOf('bottom') >= 0) {
|
|
1042
|
+
top += trigger.clientHeight;
|
|
1043
|
+
} else {
|
|
1044
|
+
top -= dropdownMenu.clientHeight;
|
|
1045
|
+
}
|
|
1046
|
+
if (this.position && this.position.indexOf('left') >= 0) {
|
|
1047
|
+
left -= dropdownMenu.clientWidth - trigger.clientWidth;
|
|
1048
|
+
}
|
|
1049
|
+
this.style = {
|
|
1050
|
+
position: 'absolute',
|
|
1051
|
+
top: "".concat(top, "px"),
|
|
1052
|
+
left: "".concat(left, "px"),
|
|
1053
|
+
zIndex: '99',
|
|
1054
|
+
width: this.expanded ? "".concat(dropdown.offsetWidth, "px") : undefined
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
mounted: function mounted() {
|
|
1060
|
+
if (this.appendToBody) {
|
|
1061
|
+
this.$data._bodyEl = createAbsoluteElement(this.$refs.dropdownMenu);
|
|
1062
|
+
this.updateAppendToBody();
|
|
1063
|
+
}
|
|
1064
|
+
},
|
|
1065
|
+
created: function created() {
|
|
1066
|
+
if (typeof window !== 'undefined') {
|
|
1067
|
+
document.addEventListener('click', this.clickedOutside);
|
|
1068
|
+
document.addEventListener('keyup', this.keyPress);
|
|
1069
|
+
}
|
|
1070
|
+
},
|
|
1071
|
+
beforeDestroy: function beforeDestroy() {
|
|
1072
|
+
if (typeof window !== 'undefined') {
|
|
1073
|
+
document.removeEventListener('click', this.clickedOutside);
|
|
1074
|
+
document.removeEventListener('keyup', this.keyPress);
|
|
1075
|
+
}
|
|
1076
|
+
if (this.appendToBody) {
|
|
1077
|
+
removeElement(this.$data._bodyEl);
|
|
1078
|
+
}
|
|
1079
|
+
clearTimeout(this.timeOutID);
|
|
1080
|
+
clearTimeout(this.timeOutID2);
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
|
|
1085
|
+
if (typeof shadowMode !== 'boolean') {
|
|
1086
|
+
createInjectorSSR = createInjector;
|
|
1087
|
+
createInjector = shadowMode;
|
|
1088
|
+
shadowMode = false;
|
|
1089
|
+
}
|
|
1090
|
+
// Vue.extend constructor export interop.
|
|
1091
|
+
const options = typeof script === 'function' ? script.options : script;
|
|
1092
|
+
// render functions
|
|
1093
|
+
if (template && template.render) {
|
|
1094
|
+
options.render = template.render;
|
|
1095
|
+
options.staticRenderFns = template.staticRenderFns;
|
|
1096
|
+
options._compiled = true;
|
|
1097
|
+
// functional template
|
|
1098
|
+
if (isFunctionalTemplate) {
|
|
1099
|
+
options.functional = true;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
// scopedId
|
|
1103
|
+
if (scopeId) {
|
|
1104
|
+
options._scopeId = scopeId;
|
|
1105
|
+
}
|
|
1106
|
+
let hook;
|
|
1107
|
+
if (moduleIdentifier) {
|
|
1108
|
+
// server build
|
|
1109
|
+
hook = function (context) {
|
|
1110
|
+
// 2.3 injection
|
|
1111
|
+
context =
|
|
1112
|
+
context || // cached call
|
|
1113
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
1114
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
|
|
1115
|
+
// 2.2 with runInNewContext: true
|
|
1116
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
1117
|
+
context = __VUE_SSR_CONTEXT__;
|
|
1118
|
+
}
|
|
1119
|
+
// inject component styles
|
|
1120
|
+
if (style) {
|
|
1121
|
+
style.call(this, createInjectorSSR(context));
|
|
1122
|
+
}
|
|
1123
|
+
// register component module identifier for async chunk inference
|
|
1124
|
+
if (context && context._registeredComponents) {
|
|
1125
|
+
context._registeredComponents.add(moduleIdentifier);
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
// used by ssr in case component is cached and beforeCreate
|
|
1129
|
+
// never gets called
|
|
1130
|
+
options._ssrRegister = hook;
|
|
1131
|
+
}
|
|
1132
|
+
else if (style) {
|
|
1133
|
+
hook = shadowMode
|
|
1134
|
+
? function (context) {
|
|
1135
|
+
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
|
|
1136
|
+
}
|
|
1137
|
+
: function (context) {
|
|
1138
|
+
style.call(this, createInjector(context));
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
if (hook) {
|
|
1142
|
+
if (options.functional) {
|
|
1143
|
+
// register for functional component in vue file
|
|
1144
|
+
const originalRender = options.render;
|
|
1145
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
1146
|
+
hook.call(context);
|
|
1147
|
+
return originalRender(h, context);
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
else {
|
|
1151
|
+
// inject component registration as beforeCreate hook
|
|
1152
|
+
const existing = options.beforeCreate;
|
|
1153
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
return script;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/* script */
|
|
1160
|
+
const __vue_script__$c = script$c;
|
|
1161
|
+
|
|
1162
|
+
/* template */
|
|
1163
|
+
var __vue_render__$b = 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)};
|
|
1164
|
+
var __vue_staticRenderFns__$b = [];
|
|
1165
|
+
|
|
1166
|
+
/* style */
|
|
1167
|
+
const __vue_inject_styles__$c = undefined;
|
|
1168
|
+
/* scoped */
|
|
1169
|
+
const __vue_scope_id__$c = undefined;
|
|
1170
|
+
/* module identifier */
|
|
1171
|
+
const __vue_module_identifier__$c = undefined;
|
|
1172
|
+
/* functional template */
|
|
1173
|
+
const __vue_is_functional_template__$c = false;
|
|
1174
|
+
/* style inject */
|
|
1175
|
+
|
|
1176
|
+
/* style inject SSR */
|
|
1177
|
+
|
|
1178
|
+
/* style inject shadow dom */
|
|
1179
|
+
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
const __vue_component__$c = /*#__PURE__*/normalizeComponent(
|
|
1183
|
+
{ render: __vue_render__$b, staticRenderFns: __vue_staticRenderFns__$b },
|
|
1184
|
+
__vue_inject_styles__$c,
|
|
1185
|
+
__vue_script__$c,
|
|
1186
|
+
__vue_scope_id__$c,
|
|
1187
|
+
__vue_is_functional_template__$c,
|
|
1188
|
+
__vue_module_identifier__$c,
|
|
1189
|
+
false,
|
|
1190
|
+
undefined,
|
|
1191
|
+
undefined,
|
|
1192
|
+
undefined
|
|
1193
|
+
);
|
|
1194
|
+
|
|
1195
|
+
var Dropdown = __vue_component__$c;
|
|
1196
|
+
|
|
1197
|
+
var sorted = 1;
|
|
1198
|
+
var optional = 2;
|
|
1199
|
+
var InjectedChildMixin = (function (parentItemName) {
|
|
1200
|
+
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1201
|
+
var mixin = {
|
|
1202
|
+
inject: {
|
|
1203
|
+
parent: {
|
|
1204
|
+
from: 'b' + parentItemName,
|
|
1205
|
+
default: false
|
|
1206
|
+
}
|
|
1207
|
+
},
|
|
1208
|
+
created: function created() {
|
|
1209
|
+
if (!this.parent) {
|
|
1210
|
+
if (!hasFlag(flags, optional)) {
|
|
1211
|
+
this.$destroy();
|
|
1212
|
+
throw new Error('You should wrap ' + this.$options.name + ' in a ' + parentItemName);
|
|
1213
|
+
}
|
|
1214
|
+
} else if (this.parent._registerItem) {
|
|
1215
|
+
this.parent._registerItem(this);
|
|
1216
|
+
}
|
|
1217
|
+
},
|
|
1218
|
+
beforeDestroy: function beforeDestroy() {
|
|
1219
|
+
if (this.parent && this.parent._unregisterItem) {
|
|
1220
|
+
this.parent._unregisterItem(this);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
if (hasFlag(flags, sorted)) {
|
|
1225
|
+
mixin.data = function () {
|
|
1226
|
+
return {
|
|
1227
|
+
index: null
|
|
1228
|
+
};
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
return mixin;
|
|
1232
|
+
});
|
|
1233
|
+
|
|
1234
|
+
//
|
|
1235
|
+
var script$b = {
|
|
1236
|
+
name: 'BDropdownItem',
|
|
1237
|
+
mixins: [InjectedChildMixin('dropdown')],
|
|
1238
|
+
props: {
|
|
1239
|
+
value: {
|
|
1240
|
+
type: [String, Number, Boolean, Object, Array, Function],
|
|
1241
|
+
default: null
|
|
1242
|
+
},
|
|
1243
|
+
separator: Boolean,
|
|
1244
|
+
disabled: Boolean,
|
|
1245
|
+
custom: Boolean,
|
|
1246
|
+
focusable: {
|
|
1247
|
+
type: Boolean,
|
|
1248
|
+
default: true
|
|
1249
|
+
},
|
|
1250
|
+
paddingless: Boolean,
|
|
1251
|
+
hasLink: Boolean,
|
|
1252
|
+
ariaRole: {
|
|
1253
|
+
type: String,
|
|
1254
|
+
default: ''
|
|
1255
|
+
}
|
|
1256
|
+
},
|
|
1257
|
+
computed: {
|
|
1258
|
+
anchorClasses: function anchorClasses() {
|
|
1259
|
+
return {
|
|
1260
|
+
'is-disabled': this.parent.disabled || this.disabled,
|
|
1261
|
+
'is-paddingless': this.paddingless,
|
|
1262
|
+
'is-active': this.isActive
|
|
1263
|
+
};
|
|
1264
|
+
},
|
|
1265
|
+
itemClasses: function itemClasses() {
|
|
1266
|
+
return {
|
|
1267
|
+
'dropdown-item': !this.hasLink,
|
|
1268
|
+
'is-disabled': this.disabled,
|
|
1269
|
+
'is-paddingless': this.paddingless,
|
|
1270
|
+
'is-active': this.isActive,
|
|
1271
|
+
'has-link': this.hasLink
|
|
1272
|
+
};
|
|
1273
|
+
},
|
|
1274
|
+
ariaRoleItem: function ariaRoleItem() {
|
|
1275
|
+
return this.ariaRole === 'menuitem' || this.ariaRole === 'listitem' ? this.ariaRole : null;
|
|
1276
|
+
},
|
|
1277
|
+
isClickable: function isClickable() {
|
|
1278
|
+
return !this.parent.disabled && !this.separator && !this.disabled && !this.custom;
|
|
1279
|
+
},
|
|
1280
|
+
isActive: function isActive() {
|
|
1281
|
+
if (this.parent.selected === null) return false;
|
|
1282
|
+
if (this.parent.multiple) return this.parent.selected.indexOf(this.value) >= 0;
|
|
1283
|
+
return this.value === this.parent.selected;
|
|
1284
|
+
},
|
|
1285
|
+
isFocusable: function isFocusable() {
|
|
1286
|
+
return this.hasLink ? false : this.focusable;
|
|
1287
|
+
}
|
|
1288
|
+
},
|
|
1289
|
+
methods: {
|
|
1290
|
+
/**
|
|
1291
|
+
* Click listener, select the item.
|
|
1292
|
+
*/
|
|
1293
|
+
selectItem: function selectItem() {
|
|
1294
|
+
if (!this.isClickable) return;
|
|
1295
|
+
this.parent.selectItem(this.value);
|
|
1296
|
+
this.$emit('click');
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
/* script */
|
|
1302
|
+
const __vue_script__$b = script$b;
|
|
1303
|
+
|
|
1304
|
+
/* template */
|
|
1305
|
+
var __vue_render__$a = 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)};
|
|
1306
|
+
var __vue_staticRenderFns__$a = [];
|
|
1307
|
+
|
|
1308
|
+
/* style */
|
|
1309
|
+
const __vue_inject_styles__$b = undefined;
|
|
1310
|
+
/* scoped */
|
|
1311
|
+
const __vue_scope_id__$b = undefined;
|
|
1312
|
+
/* module identifier */
|
|
1313
|
+
const __vue_module_identifier__$b = undefined;
|
|
1314
|
+
/* functional template */
|
|
1315
|
+
const __vue_is_functional_template__$b = false;
|
|
1316
|
+
/* style inject */
|
|
1317
|
+
|
|
1318
|
+
/* style inject SSR */
|
|
1319
|
+
|
|
1320
|
+
/* style inject shadow dom */
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
const __vue_component__$b = /*#__PURE__*/normalizeComponent(
|
|
1325
|
+
{ render: __vue_render__$a, staticRenderFns: __vue_staticRenderFns__$a },
|
|
1326
|
+
__vue_inject_styles__$b,
|
|
1327
|
+
__vue_script__$b,
|
|
1328
|
+
__vue_scope_id__$b,
|
|
1329
|
+
__vue_is_functional_template__$b,
|
|
1330
|
+
__vue_module_identifier__$b,
|
|
1331
|
+
false,
|
|
1332
|
+
undefined,
|
|
1333
|
+
undefined,
|
|
1334
|
+
undefined
|
|
1335
|
+
);
|
|
1336
|
+
|
|
1337
|
+
var DropdownItem = __vue_component__$b;
|
|
1338
|
+
|
|
1339
|
+
var mdiIcons = {
|
|
1340
|
+
sizes: {
|
|
1341
|
+
'default': 'mdi-24px',
|
|
1342
|
+
'is-small': null,
|
|
1343
|
+
'is-medium': 'mdi-36px',
|
|
1344
|
+
'is-large': 'mdi-48px'
|
|
1345
|
+
},
|
|
1346
|
+
iconPrefix: 'mdi-'
|
|
1347
|
+
};
|
|
1348
|
+
var faIcons = function faIcons() {
|
|
1349
|
+
var faIconPrefix = config && config.defaultIconComponent ? '' : 'fa-';
|
|
1350
|
+
return {
|
|
1351
|
+
sizes: {
|
|
1352
|
+
'default': null,
|
|
1353
|
+
'is-small': null,
|
|
1354
|
+
'is-medium': faIconPrefix + 'lg',
|
|
1355
|
+
'is-large': faIconPrefix + '2x'
|
|
1356
|
+
},
|
|
1357
|
+
iconPrefix: faIconPrefix,
|
|
1358
|
+
internalIcons: {
|
|
1359
|
+
'information': 'info-circle',
|
|
1360
|
+
'alert': 'exclamation-triangle',
|
|
1361
|
+
'alert-circle': 'exclamation-circle',
|
|
1362
|
+
'chevron-right': 'angle-right',
|
|
1363
|
+
'chevron-left': 'angle-left',
|
|
1364
|
+
'chevron-down': 'angle-down',
|
|
1365
|
+
'eye-off': 'eye-slash',
|
|
1366
|
+
'menu-down': 'caret-down',
|
|
1367
|
+
'menu-up': 'caret-up',
|
|
1368
|
+
'close-circle': 'times-circle'
|
|
1369
|
+
}
|
|
1370
|
+
};
|
|
1371
|
+
};
|
|
1372
|
+
var getIcons = function getIcons() {
|
|
1373
|
+
var icons = {
|
|
1374
|
+
mdi: mdiIcons,
|
|
1375
|
+
fa: faIcons(),
|
|
1376
|
+
fas: faIcons(),
|
|
1377
|
+
far: faIcons(),
|
|
1378
|
+
fad: faIcons(),
|
|
1379
|
+
fab: faIcons(),
|
|
1380
|
+
fal: faIcons(),
|
|
1381
|
+
'fa-solid': faIcons(),
|
|
1382
|
+
'fa-regular': faIcons(),
|
|
1383
|
+
'fa-light': faIcons(),
|
|
1384
|
+
'fa-thin': faIcons(),
|
|
1385
|
+
'fa-duotone': faIcons(),
|
|
1386
|
+
'fa-brands': faIcons()
|
|
1387
|
+
};
|
|
1388
|
+
if (config && config.customIconPacks) {
|
|
1389
|
+
icons = merge(icons, config.customIconPacks, true);
|
|
1390
|
+
}
|
|
1391
|
+
return icons;
|
|
1392
|
+
};
|
|
1393
|
+
var getIcons$1 = getIcons;
|
|
1394
|
+
|
|
1395
|
+
var script$a = {
|
|
1396
|
+
name: 'BIcon',
|
|
1397
|
+
props: {
|
|
1398
|
+
type: [String, Object],
|
|
1399
|
+
component: String,
|
|
1400
|
+
pack: String,
|
|
1401
|
+
icon: String,
|
|
1402
|
+
size: String,
|
|
1403
|
+
customSize: String,
|
|
1404
|
+
customClass: String,
|
|
1405
|
+
both: Boolean // This is used internally to show both MDI and FA icon
|
|
1406
|
+
},
|
|
1407
|
+
computed: {
|
|
1408
|
+
iconConfig: function iconConfig() {
|
|
1409
|
+
var allIcons = getIcons$1();
|
|
1410
|
+
return allIcons[this.newPack];
|
|
1411
|
+
},
|
|
1412
|
+
iconPrefix: function iconPrefix() {
|
|
1413
|
+
if (this.iconConfig && this.iconConfig.iconPrefix) {
|
|
1414
|
+
return this.iconConfig.iconPrefix;
|
|
1415
|
+
}
|
|
1416
|
+
return '';
|
|
1417
|
+
},
|
|
1418
|
+
/**
|
|
1419
|
+
* Internal icon name based on the pack.
|
|
1420
|
+
* If pack is 'fa', gets the equivalent FA icon name of the MDI,
|
|
1421
|
+
* internal icons are always MDI.
|
|
1422
|
+
*/
|
|
1423
|
+
newIcon: function newIcon() {
|
|
1424
|
+
return "".concat(this.iconPrefix).concat(this.getEquivalentIconOf(this.icon));
|
|
1425
|
+
},
|
|
1426
|
+
newPack: function newPack() {
|
|
1427
|
+
return this.pack || config.defaultIconPack;
|
|
1428
|
+
},
|
|
1429
|
+
newType: function newType() {
|
|
1430
|
+
if (!this.type) return;
|
|
1431
|
+
var splitType = [];
|
|
1432
|
+
if (typeof this.type === 'string') {
|
|
1433
|
+
splitType = this.type.split('-');
|
|
1434
|
+
} else {
|
|
1435
|
+
for (var key in this.type) {
|
|
1436
|
+
if (this.type[key]) {
|
|
1437
|
+
splitType = key.split('-');
|
|
1438
|
+
break;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
if (splitType.length <= 1) return;
|
|
1443
|
+
var _splitType = splitType,
|
|
1444
|
+
_splitType2 = _toArray(_splitType),
|
|
1445
|
+
type = _splitType2.slice(1);
|
|
1446
|
+
return "has-text-".concat(type.join('-'));
|
|
1447
|
+
},
|
|
1448
|
+
newCustomSize: function newCustomSize() {
|
|
1449
|
+
return this.customSize || this.customSizeByPack;
|
|
1450
|
+
},
|
|
1451
|
+
customSizeByPack: function customSizeByPack() {
|
|
1452
|
+
if (this.iconConfig && this.iconConfig.sizes) {
|
|
1453
|
+
if (this.size && this.iconConfig.sizes[this.size] !== undefined) {
|
|
1454
|
+
return this.iconConfig.sizes[this.size];
|
|
1455
|
+
} else if (this.iconConfig.sizes.default) {
|
|
1456
|
+
return this.iconConfig.sizes.default;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
return null;
|
|
1460
|
+
},
|
|
1461
|
+
useIconComponent: function useIconComponent() {
|
|
1462
|
+
return this.component || config.defaultIconComponent;
|
|
1463
|
+
}
|
|
1464
|
+
},
|
|
1465
|
+
methods: {
|
|
1466
|
+
/**
|
|
1467
|
+
* Equivalent icon name of the MDI.
|
|
1468
|
+
*/
|
|
1469
|
+
getEquivalentIconOf: function getEquivalentIconOf(value) {
|
|
1470
|
+
// Only transform the class if the both prop is set to true
|
|
1471
|
+
if (!this.both) {
|
|
1472
|
+
return value;
|
|
1473
|
+
}
|
|
1474
|
+
if (this.iconConfig && this.iconConfig.internalIcons && this.iconConfig.internalIcons[value]) {
|
|
1475
|
+
return this.iconConfig.internalIcons[value];
|
|
1476
|
+
}
|
|
1477
|
+
return value;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
/* script */
|
|
1483
|
+
const __vue_script__$a = script$a;
|
|
1484
|
+
|
|
1485
|
+
/* template */
|
|
1486
|
+
var __vue_render__$9 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',{staticClass:"icon",class:[_vm.newType, _vm.size]},[(!_vm.useIconComponent)?_c('i',{class:[_vm.newPack, _vm.newIcon, _vm.newCustomSize, _vm.customClass]}):_c(_vm.useIconComponent,{tag:"component",class:[_vm.customClass],attrs:{"icon":[_vm.newPack, _vm.newIcon],"size":_vm.newCustomSize}})],1)};
|
|
1487
|
+
var __vue_staticRenderFns__$9 = [];
|
|
1488
|
+
|
|
1489
|
+
/* style */
|
|
1490
|
+
const __vue_inject_styles__$a = undefined;
|
|
1491
|
+
/* scoped */
|
|
1492
|
+
const __vue_scope_id__$a = undefined;
|
|
1493
|
+
/* module identifier */
|
|
1494
|
+
const __vue_module_identifier__$a = undefined;
|
|
1495
|
+
/* functional template */
|
|
1496
|
+
const __vue_is_functional_template__$a = false;
|
|
1497
|
+
/* style inject */
|
|
1498
|
+
|
|
1499
|
+
/* style inject SSR */
|
|
1500
|
+
|
|
1501
|
+
/* style inject shadow dom */
|
|
1502
|
+
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
const __vue_component__$a = /*#__PURE__*/normalizeComponent(
|
|
1506
|
+
{ render: __vue_render__$9, staticRenderFns: __vue_staticRenderFns__$9 },
|
|
1507
|
+
__vue_inject_styles__$a,
|
|
1508
|
+
__vue_script__$a,
|
|
1509
|
+
__vue_scope_id__$a,
|
|
1510
|
+
__vue_is_functional_template__$a,
|
|
1511
|
+
__vue_module_identifier__$a,
|
|
1512
|
+
false,
|
|
1513
|
+
undefined,
|
|
1514
|
+
undefined,
|
|
1515
|
+
undefined
|
|
1516
|
+
);
|
|
1517
|
+
|
|
1518
|
+
var Icon = __vue_component__$a;
|
|
1519
|
+
|
|
1520
|
+
var script$9 = {
|
|
1521
|
+
name: 'BInput',
|
|
1522
|
+
components: _defineProperty({}, Icon.name, Icon),
|
|
1523
|
+
mixins: [FormElementMixin],
|
|
1524
|
+
inheritAttrs: false,
|
|
1525
|
+
props: {
|
|
1526
|
+
value: [Number, String],
|
|
1527
|
+
type: {
|
|
1528
|
+
type: String,
|
|
1529
|
+
default: 'text'
|
|
1530
|
+
},
|
|
1531
|
+
lazy: {
|
|
1532
|
+
type: Boolean,
|
|
1533
|
+
default: false
|
|
1534
|
+
},
|
|
1535
|
+
passwordReveal: Boolean,
|
|
1536
|
+
iconClickable: Boolean,
|
|
1537
|
+
hasCounter: {
|
|
1538
|
+
type: Boolean,
|
|
1539
|
+
default: function _default() {
|
|
1540
|
+
return config.defaultInputHasCounter;
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
customClass: {
|
|
1544
|
+
type: String,
|
|
1545
|
+
default: ''
|
|
1546
|
+
},
|
|
1547
|
+
iconRight: String,
|
|
1548
|
+
iconRightClickable: Boolean,
|
|
1549
|
+
iconRightType: String
|
|
1550
|
+
},
|
|
1551
|
+
data: function data() {
|
|
1552
|
+
return {
|
|
1553
|
+
newValue: this.value,
|
|
1554
|
+
newType: this.type,
|
|
1555
|
+
newAutocomplete: this.autocomplete || config.defaultInputAutocomplete,
|
|
1556
|
+
isPasswordVisible: false,
|
|
1557
|
+
_elementRef: this.type === 'textarea' ? 'textarea' : 'input'
|
|
1558
|
+
};
|
|
1559
|
+
},
|
|
1560
|
+
computed: {
|
|
1561
|
+
computedValue: {
|
|
1562
|
+
get: function get() {
|
|
1563
|
+
return this.newValue;
|
|
1564
|
+
},
|
|
1565
|
+
set: function set(value) {
|
|
1566
|
+
this.newValue = value;
|
|
1567
|
+
this.$emit('input', value);
|
|
1568
|
+
}
|
|
1569
|
+
},
|
|
1570
|
+
rootClasses: function rootClasses() {
|
|
1571
|
+
return [this.iconPosition, this.size, {
|
|
1572
|
+
'is-expanded': this.expanded,
|
|
1573
|
+
'is-loading': this.loading,
|
|
1574
|
+
'is-clearfix': !this.hasMessage
|
|
1575
|
+
}];
|
|
1576
|
+
},
|
|
1577
|
+
inputClasses: function inputClasses() {
|
|
1578
|
+
return [this.statusType, this.size, {
|
|
1579
|
+
'is-rounded': this.rounded
|
|
1580
|
+
}];
|
|
1581
|
+
},
|
|
1582
|
+
hasIconRight: function hasIconRight() {
|
|
1583
|
+
return this.passwordReveal || this.loading || this.statusIcon && this.statusTypeIcon || this.iconRight;
|
|
1584
|
+
},
|
|
1585
|
+
rightIcon: function rightIcon() {
|
|
1586
|
+
if (this.passwordReveal) {
|
|
1587
|
+
return this.passwordVisibleIcon;
|
|
1588
|
+
} else if (this.iconRight) {
|
|
1589
|
+
return this.iconRight;
|
|
1590
|
+
}
|
|
1591
|
+
return this.statusTypeIcon;
|
|
1592
|
+
},
|
|
1593
|
+
rightIconType: function rightIconType() {
|
|
1594
|
+
if (this.passwordReveal) {
|
|
1595
|
+
return 'is-primary';
|
|
1596
|
+
} else if (this.iconRight) {
|
|
1597
|
+
return this.iconRightType || null;
|
|
1598
|
+
}
|
|
1599
|
+
return this.statusType;
|
|
1600
|
+
},
|
|
1601
|
+
/**
|
|
1602
|
+
* Position of the icon or if it's both sides.
|
|
1603
|
+
*/
|
|
1604
|
+
iconPosition: function iconPosition() {
|
|
1605
|
+
var iconClasses = '';
|
|
1606
|
+
if (this.icon) {
|
|
1607
|
+
iconClasses += 'has-icons-left ';
|
|
1608
|
+
}
|
|
1609
|
+
if (this.hasIconRight) {
|
|
1610
|
+
iconClasses += 'has-icons-right';
|
|
1611
|
+
}
|
|
1612
|
+
return iconClasses;
|
|
1613
|
+
},
|
|
1614
|
+
/**
|
|
1615
|
+
* Icon name (MDI) based on the type.
|
|
1616
|
+
*/
|
|
1617
|
+
statusTypeIcon: function statusTypeIcon() {
|
|
1618
|
+
switch (this.statusType) {
|
|
1619
|
+
case 'is-success':
|
|
1620
|
+
return 'check';
|
|
1621
|
+
case 'is-danger':
|
|
1622
|
+
return 'alert-circle';
|
|
1623
|
+
case 'is-info':
|
|
1624
|
+
return 'information';
|
|
1625
|
+
case 'is-warning':
|
|
1626
|
+
return 'alert';
|
|
1627
|
+
}
|
|
1628
|
+
},
|
|
1629
|
+
/**
|
|
1630
|
+
* Check if have any message prop from parent if it's a Field.
|
|
1631
|
+
*/
|
|
1632
|
+
hasMessage: function hasMessage() {
|
|
1633
|
+
return !!this.statusMessage;
|
|
1634
|
+
},
|
|
1635
|
+
/**
|
|
1636
|
+
* Current password-reveal icon name.
|
|
1637
|
+
*/
|
|
1638
|
+
passwordVisibleIcon: function passwordVisibleIcon() {
|
|
1639
|
+
return !this.isPasswordVisible ? 'eye' : 'eye-off';
|
|
1640
|
+
},
|
|
1641
|
+
/**
|
|
1642
|
+
* Get value length
|
|
1643
|
+
*/
|
|
1644
|
+
valueLength: function valueLength() {
|
|
1645
|
+
if (typeof this.computedValue === 'string') {
|
|
1646
|
+
return Array.from(this.computedValue).length;
|
|
1647
|
+
} else if (typeof this.computedValue === 'number') {
|
|
1648
|
+
return this.computedValue.toString().length;
|
|
1649
|
+
}
|
|
1650
|
+
return 0;
|
|
1651
|
+
}
|
|
1652
|
+
},
|
|
1653
|
+
watch: {
|
|
1654
|
+
/**
|
|
1655
|
+
* When v-model is changed:
|
|
1656
|
+
* 1. Set internal value.
|
|
1657
|
+
* 2. Validate it if the value came from outside;
|
|
1658
|
+
* i.e., not equal to computedValue
|
|
1659
|
+
*/
|
|
1660
|
+
value: function value(_value) {
|
|
1661
|
+
var _this = this;
|
|
1662
|
+
var fromOutside = this.computedValue != _value; // eslint-disable-line eqeqeq
|
|
1663
|
+
this.newValue = _value;
|
|
1664
|
+
if (fromOutside) {
|
|
1665
|
+
// validation must wait for DOM updated
|
|
1666
|
+
this.$nextTick(function () {
|
|
1667
|
+
!_this.isValid && _this.checkHtml5Validity();
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1671
|
+
type: function type(_type) {
|
|
1672
|
+
this.newType = _type;
|
|
1673
|
+
}
|
|
1674
|
+
},
|
|
1675
|
+
methods: {
|
|
1676
|
+
/**
|
|
1677
|
+
* Toggle the visibility of a password-reveal input
|
|
1678
|
+
* by changing the type and focus the input right away.
|
|
1679
|
+
*/
|
|
1680
|
+
togglePasswordVisibility: function togglePasswordVisibility() {
|
|
1681
|
+
var _this2 = this;
|
|
1682
|
+
this.isPasswordVisible = !this.isPasswordVisible;
|
|
1683
|
+
this.newType = this.isPasswordVisible ? 'text' : 'password';
|
|
1684
|
+
this.$nextTick(function () {
|
|
1685
|
+
_this2.focus();
|
|
1686
|
+
});
|
|
1687
|
+
},
|
|
1688
|
+
iconClick: function iconClick(emit, event) {
|
|
1689
|
+
var _this3 = this;
|
|
1690
|
+
this.$emit(emit, event);
|
|
1691
|
+
this.$nextTick(function () {
|
|
1692
|
+
_this3.focus();
|
|
1693
|
+
});
|
|
1694
|
+
},
|
|
1695
|
+
rightIconClick: function rightIconClick(event) {
|
|
1696
|
+
if (this.passwordReveal) {
|
|
1697
|
+
this.togglePasswordVisibility();
|
|
1698
|
+
} else if (this.iconRightClickable) {
|
|
1699
|
+
this.iconClick('icon-right-click', event);
|
|
1700
|
+
}
|
|
1701
|
+
},
|
|
1702
|
+
onInput: function onInput(event) {
|
|
1703
|
+
if (!this.lazy) {
|
|
1704
|
+
var value = event.target.value;
|
|
1705
|
+
this.updateValue(value);
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
onChange: function onChange(event) {
|
|
1709
|
+
if (this.lazy) {
|
|
1710
|
+
var value = event.target.value;
|
|
1711
|
+
this.updateValue(value);
|
|
1712
|
+
}
|
|
1713
|
+
},
|
|
1714
|
+
updateValue: function updateValue(value) {
|
|
1715
|
+
this.computedValue = value;
|
|
1716
|
+
!this.isValid && this.checkHtml5Validity();
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
};
|
|
1720
|
+
|
|
1721
|
+
/* script */
|
|
1722
|
+
const __vue_script__$9 = script$9;
|
|
1723
|
+
|
|
1724
|
+
/* template */
|
|
1725
|
+
var __vue_render__$8 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"control",class:_vm.rootClasses},[(_vm.type !== 'textarea')?_c('input',_vm._b({ref:"input",staticClass:"input",class:[_vm.inputClasses, _vm.customClass],attrs:{"type":_vm.newType,"autocomplete":_vm.newAutocomplete,"maxlength":_vm.maxlength},domProps:{"value":_vm.computedValue},on:{"input":_vm.onInput,"change":_vm.onChange,"blur":_vm.onBlur,"focus":_vm.onFocus}},'input',_vm.$attrs,false)):_c('textarea',_vm._b({ref:"textarea",staticClass:"textarea",class:[_vm.inputClasses, _vm.customClass],attrs:{"maxlength":_vm.maxlength},domProps:{"value":_vm.computedValue},on:{"input":_vm.onInput,"change":_vm.onChange,"blur":_vm.onBlur,"focus":_vm.onFocus}},'textarea',_vm.$attrs,false)),(_vm.icon)?_c('b-icon',{staticClass:"is-left",class:{'is-clickable': _vm.iconClickable},attrs:{"icon":_vm.icon,"pack":_vm.iconPack,"size":_vm.iconSize},nativeOn:{"click":function($event){return _vm.iconClick('icon-click', $event)}}}):_vm._e(),(!_vm.loading && _vm.hasIconRight)?_c('b-icon',{staticClass:"is-right",class:{ 'is-clickable': _vm.passwordReveal || _vm.iconRightClickable },attrs:{"icon":_vm.rightIcon,"pack":_vm.iconPack,"size":_vm.iconSize,"type":_vm.rightIconType,"both":""},nativeOn:{"click":function($event){return _vm.rightIconClick($event)}}}):_vm._e(),(_vm.maxlength && _vm.hasCounter && _vm.type !== 'number')?_c('small',{staticClass:"help counter",class:{ 'is-invisible': !_vm.isFocused }},[_vm._v(" "+_vm._s(_vm.valueLength)+" / "+_vm._s(_vm.maxlength)+" ")]):_vm._e()],1)};
|
|
1726
|
+
var __vue_staticRenderFns__$8 = [];
|
|
1727
|
+
|
|
1728
|
+
/* style */
|
|
1729
|
+
const __vue_inject_styles__$9 = undefined;
|
|
1730
|
+
/* scoped */
|
|
1731
|
+
const __vue_scope_id__$9 = undefined;
|
|
1732
|
+
/* module identifier */
|
|
1733
|
+
const __vue_module_identifier__$9 = undefined;
|
|
1734
|
+
/* functional template */
|
|
1735
|
+
const __vue_is_functional_template__$9 = false;
|
|
1736
|
+
/* style inject */
|
|
1737
|
+
|
|
1738
|
+
/* style inject SSR */
|
|
1739
|
+
|
|
1740
|
+
/* style inject shadow dom */
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
|
|
1744
|
+
const __vue_component__$9 = /*#__PURE__*/normalizeComponent(
|
|
1745
|
+
{ render: __vue_render__$8, staticRenderFns: __vue_staticRenderFns__$8 },
|
|
1746
|
+
__vue_inject_styles__$9,
|
|
1747
|
+
__vue_script__$9,
|
|
1748
|
+
__vue_scope_id__$9,
|
|
1749
|
+
__vue_is_functional_template__$9,
|
|
1750
|
+
__vue_module_identifier__$9,
|
|
1751
|
+
false,
|
|
1752
|
+
undefined,
|
|
1753
|
+
undefined,
|
|
1754
|
+
undefined
|
|
1755
|
+
);
|
|
1756
|
+
|
|
1757
|
+
var Input = __vue_component__$9;
|
|
1758
|
+
|
|
1759
|
+
var script$8 = {
|
|
1760
|
+
name: 'BFieldBody',
|
|
1761
|
+
props: {
|
|
1762
|
+
message: {
|
|
1763
|
+
type: [String, Array]
|
|
1764
|
+
},
|
|
1765
|
+
type: {
|
|
1766
|
+
type: [String, Object]
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1769
|
+
render: function render(createElement) {
|
|
1770
|
+
var _this = this;
|
|
1771
|
+
var first = true;
|
|
1772
|
+
return createElement('div', {
|
|
1773
|
+
attrs: {
|
|
1774
|
+
'class': 'field-body'
|
|
1775
|
+
}
|
|
1776
|
+
}, this.$slots.default.map(function (element) {
|
|
1777
|
+
// skip returns and comments
|
|
1778
|
+
if (!element.tag) {
|
|
1779
|
+
return element;
|
|
1780
|
+
}
|
|
1781
|
+
var message;
|
|
1782
|
+
if (first) {
|
|
1783
|
+
message = _this.message;
|
|
1784
|
+
first = false;
|
|
1785
|
+
}
|
|
1786
|
+
return createElement('b-field', {
|
|
1787
|
+
attrs: {
|
|
1788
|
+
type: _this.type,
|
|
1789
|
+
message: message
|
|
1790
|
+
}
|
|
1791
|
+
}, [element]);
|
|
1792
|
+
}));
|
|
1793
|
+
}
|
|
1794
|
+
};
|
|
1795
|
+
|
|
1796
|
+
/* script */
|
|
1797
|
+
const __vue_script__$8 = script$8;
|
|
1798
|
+
|
|
1799
|
+
/* template */
|
|
1800
|
+
|
|
1801
|
+
/* style */
|
|
1802
|
+
const __vue_inject_styles__$8 = undefined;
|
|
1803
|
+
/* scoped */
|
|
1804
|
+
const __vue_scope_id__$8 = undefined;
|
|
1805
|
+
/* module identifier */
|
|
1806
|
+
const __vue_module_identifier__$8 = undefined;
|
|
1807
|
+
/* functional template */
|
|
1808
|
+
const __vue_is_functional_template__$8 = undefined;
|
|
1809
|
+
/* style inject */
|
|
1810
|
+
|
|
1811
|
+
/* style inject SSR */
|
|
1812
|
+
|
|
1813
|
+
/* style inject shadow dom */
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
|
|
1817
|
+
const __vue_component__$8 = /*#__PURE__*/normalizeComponent(
|
|
1818
|
+
{},
|
|
1819
|
+
__vue_inject_styles__$8,
|
|
1820
|
+
__vue_script__$8,
|
|
1821
|
+
__vue_scope_id__$8,
|
|
1822
|
+
__vue_is_functional_template__$8,
|
|
1823
|
+
__vue_module_identifier__$8,
|
|
1824
|
+
false,
|
|
1825
|
+
undefined,
|
|
1826
|
+
undefined,
|
|
1827
|
+
undefined
|
|
1828
|
+
);
|
|
1829
|
+
|
|
1830
|
+
var FieldBody = __vue_component__$8;
|
|
1831
|
+
|
|
1832
|
+
var script$7 = {
|
|
1833
|
+
name: 'BField',
|
|
1834
|
+
components: _defineProperty({}, FieldBody.name, FieldBody),
|
|
1835
|
+
provide: function provide() {
|
|
1836
|
+
return {
|
|
1837
|
+
'BField': this
|
|
1838
|
+
};
|
|
1839
|
+
},
|
|
1840
|
+
inject: {
|
|
1841
|
+
parent: {
|
|
1842
|
+
from: 'BField',
|
|
1843
|
+
default: false
|
|
1844
|
+
}
|
|
1845
|
+
},
|
|
1846
|
+
// Used internally only when using Field in Field
|
|
1847
|
+
props: {
|
|
1848
|
+
type: [String, Object],
|
|
1849
|
+
label: String,
|
|
1850
|
+
labelFor: String,
|
|
1851
|
+
message: [String, Array, Object],
|
|
1852
|
+
grouped: Boolean,
|
|
1853
|
+
groupMultiline: Boolean,
|
|
1854
|
+
position: String,
|
|
1855
|
+
expanded: Boolean,
|
|
1856
|
+
horizontal: Boolean,
|
|
1857
|
+
addons: {
|
|
1858
|
+
type: Boolean,
|
|
1859
|
+
default: true
|
|
1860
|
+
},
|
|
1861
|
+
customClass: String,
|
|
1862
|
+
labelPosition: {
|
|
1863
|
+
type: String,
|
|
1864
|
+
default: function _default() {
|
|
1865
|
+
return config.defaultFieldLabelPosition;
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
},
|
|
1869
|
+
data: function data() {
|
|
1870
|
+
return {
|
|
1871
|
+
newType: this.type,
|
|
1872
|
+
newMessage: this.message,
|
|
1873
|
+
fieldLabelSize: null,
|
|
1874
|
+
_isField: true // Used internally by Input and Select
|
|
1875
|
+
};
|
|
1876
|
+
},
|
|
1877
|
+
computed: {
|
|
1878
|
+
rootClasses: function rootClasses() {
|
|
1879
|
+
return [{
|
|
1880
|
+
'is-expanded': this.expanded,
|
|
1881
|
+
'is-horizontal': this.horizontal,
|
|
1882
|
+
'is-floating-in-label': this.hasLabel && !this.horizontal && this.labelPosition === 'inside',
|
|
1883
|
+
'is-floating-label': this.hasLabel && !this.horizontal && this.labelPosition === 'on-border'
|
|
1884
|
+
}, this.numberInputClasses];
|
|
1885
|
+
},
|
|
1886
|
+
innerFieldClasses: function innerFieldClasses() {
|
|
1887
|
+
return [this.fieldType(), this.newPosition, {
|
|
1888
|
+
'is-grouped-multiline': this.groupMultiline
|
|
1889
|
+
}];
|
|
1890
|
+
},
|
|
1891
|
+
hasInnerField: function hasInnerField() {
|
|
1892
|
+
return this.grouped || this.groupMultiline || this.hasAddons();
|
|
1893
|
+
},
|
|
1894
|
+
/**
|
|
1895
|
+
* Correct Bulma class for the side of the addon or group.
|
|
1896
|
+
*
|
|
1897
|
+
* This is not kept like the others (is-small, etc.),
|
|
1898
|
+
* because since 'has-addons' is set automatically it
|
|
1899
|
+
* doesn't make sense to teach users what addons are exactly.
|
|
1900
|
+
*/
|
|
1901
|
+
newPosition: function newPosition() {
|
|
1902
|
+
if (this.position === undefined) return;
|
|
1903
|
+
var position = this.position.split('-');
|
|
1904
|
+
if (position.length < 1) return;
|
|
1905
|
+
var prefix = this.grouped ? 'is-grouped-' : 'has-addons-';
|
|
1906
|
+
if (this.position) return prefix + position[1];
|
|
1907
|
+
},
|
|
1908
|
+
/**
|
|
1909
|
+
* Formatted message in case it's an array
|
|
1910
|
+
* (each element is separated by <br> tag)
|
|
1911
|
+
*/
|
|
1912
|
+
formattedMessage: function formattedMessage() {
|
|
1913
|
+
if (this.parent && this.parent.hasInnerField) {
|
|
1914
|
+
return ''; // Message will be displayed in parent field
|
|
1915
|
+
}
|
|
1916
|
+
if (typeof this.newMessage === 'string') {
|
|
1917
|
+
return [this.newMessage];
|
|
1918
|
+
}
|
|
1919
|
+
var messages = [];
|
|
1920
|
+
if (Array.isArray(this.newMessage)) {
|
|
1921
|
+
this.newMessage.forEach(function (message) {
|
|
1922
|
+
if (typeof message === 'string') {
|
|
1923
|
+
messages.push(message);
|
|
1924
|
+
} else {
|
|
1925
|
+
for (var key in message) {
|
|
1926
|
+
if (message[key]) {
|
|
1927
|
+
messages.push(key);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
});
|
|
1932
|
+
} else {
|
|
1933
|
+
for (var key in this.newMessage) {
|
|
1934
|
+
if (this.newMessage[key]) {
|
|
1935
|
+
messages.push(key);
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
return messages.filter(function (m) {
|
|
1940
|
+
if (m) return m;
|
|
1941
|
+
});
|
|
1942
|
+
},
|
|
1943
|
+
hasLabel: function hasLabel() {
|
|
1944
|
+
return this.label || this.$slots.label;
|
|
1945
|
+
},
|
|
1946
|
+
hasMessage: function hasMessage() {
|
|
1947
|
+
return (!this.parent || !this.parent.hasInnerField) && this.newMessage || this.$slots.message;
|
|
1948
|
+
},
|
|
1949
|
+
numberInputClasses: function numberInputClasses() {
|
|
1950
|
+
if (this.$slots.default) {
|
|
1951
|
+
var numberinput = this.$slots.default.filter(function (node) {
|
|
1952
|
+
return node.tag && node.tag.toLowerCase().indexOf('numberinput') >= 0;
|
|
1953
|
+
})[0];
|
|
1954
|
+
if (numberinput) {
|
|
1955
|
+
var classes = ['has-numberinput'];
|
|
1956
|
+
var controlsPosition = numberinput.componentOptions.propsData.controlsPosition;
|
|
1957
|
+
var size = numberinput.componentOptions.propsData.size;
|
|
1958
|
+
if (controlsPosition) {
|
|
1959
|
+
classes.push("has-numberinput-".concat(controlsPosition));
|
|
1960
|
+
}
|
|
1961
|
+
if (size) {
|
|
1962
|
+
classes.push("has-numberinput-".concat(size));
|
|
1963
|
+
}
|
|
1964
|
+
return classes;
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
return null;
|
|
1968
|
+
}
|
|
1969
|
+
},
|
|
1970
|
+
watch: {
|
|
1971
|
+
/**
|
|
1972
|
+
* Set internal type when prop change.
|
|
1973
|
+
*/
|
|
1974
|
+
type: function type(value) {
|
|
1975
|
+
this.newType = value;
|
|
1976
|
+
},
|
|
1977
|
+
/**
|
|
1978
|
+
* Set internal message when prop change.
|
|
1979
|
+
*/
|
|
1980
|
+
message: function message(value) {
|
|
1981
|
+
this.newMessage = value;
|
|
1982
|
+
},
|
|
1983
|
+
/**
|
|
1984
|
+
* Set parent message if we use Field in Field.
|
|
1985
|
+
*/
|
|
1986
|
+
newMessage: function newMessage(value) {
|
|
1987
|
+
if (this.parent && this.parent.hasInnerField) {
|
|
1988
|
+
if (!this.parent.type) {
|
|
1989
|
+
this.parent.newType = this.newType;
|
|
1990
|
+
}
|
|
1991
|
+
if (!this.parent.message) {
|
|
1992
|
+
this.parent.newMessage = value;
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
},
|
|
1997
|
+
methods: {
|
|
1998
|
+
/**
|
|
1999
|
+
* Field has addons if there are more than one slot
|
|
2000
|
+
* (element / component) in the Field.
|
|
2001
|
+
* Or is grouped when prop is set.
|
|
2002
|
+
* Is a method to be called when component re-render.
|
|
2003
|
+
*/
|
|
2004
|
+
fieldType: function fieldType() {
|
|
2005
|
+
if (this.grouped) return 'is-grouped';
|
|
2006
|
+
if (this.hasAddons()) return 'has-addons';
|
|
2007
|
+
},
|
|
2008
|
+
hasAddons: function hasAddons() {
|
|
2009
|
+
var renderedNode = 0;
|
|
2010
|
+
if (this.$slots.default) {
|
|
2011
|
+
renderedNode = this.$slots.default.reduce(function (i, node) {
|
|
2012
|
+
return node.tag ? i + 1 : i;
|
|
2013
|
+
}, 0);
|
|
2014
|
+
}
|
|
2015
|
+
return renderedNode > 1 && this.addons && !this.horizontal;
|
|
2016
|
+
}
|
|
2017
|
+
},
|
|
2018
|
+
mounted: function mounted() {
|
|
2019
|
+
if (this.horizontal) {
|
|
2020
|
+
// Bulma docs: .is-normal for any .input or .button
|
|
2021
|
+
var elements = this.$el.querySelectorAll('.input, .select, .button, .textarea, .b-slider');
|
|
2022
|
+
if (elements.length > 0) {
|
|
2023
|
+
this.fieldLabelSize = 'is-normal';
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
|
|
2029
|
+
/* script */
|
|
2030
|
+
const __vue_script__$7 = script$7;
|
|
2031
|
+
|
|
2032
|
+
/* template */
|
|
2033
|
+
var __vue_render__$7 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"field",class:_vm.rootClasses},[(_vm.horizontal)?_c('div',{staticClass:"field-label",class:[_vm.customClass, _vm.fieldLabelSize]},[(_vm.hasLabel)?_c('label',{staticClass:"label",class:_vm.customClass,attrs:{"for":_vm.labelFor}},[(_vm.$slots.label)?_vm._t("label"):[_vm._v(_vm._s(_vm.label))]],2):_vm._e()]):[(_vm.hasLabel)?_c('label',{staticClass:"label",class:_vm.customClass,attrs:{"for":_vm.labelFor}},[(_vm.$slots.label)?_vm._t("label"):[_vm._v(_vm._s(_vm.label))]],2):_vm._e()],(_vm.horizontal)?_c('b-field-body',{attrs:{"message":_vm.newMessage ? _vm.formattedMessage : '',"type":_vm.newType}},[_vm._t("default")],2):(_vm.hasInnerField)?_c('div',{staticClass:"field-body"},[_c('b-field',{class:_vm.innerFieldClasses,attrs:{"addons":false,"type":_vm.type}},[_vm._t("default")],2)],1):[_vm._t("default")],(_vm.hasMessage && !_vm.horizontal)?_c('p',{staticClass:"help",class:_vm.newType},[(_vm.$slots.message)?_vm._t("message",null,{"messages":_vm.formattedMessage}):[_vm._l((_vm.formattedMessage),function(mess,i){return [_vm._v(" "+_vm._s(mess)+" "),((i + 1) < _vm.formattedMessage.length)?_c('br',{key:i}):_vm._e()]})]],2):_vm._e()],2)};
|
|
2034
|
+
var __vue_staticRenderFns__$7 = [];
|
|
2035
|
+
|
|
2036
|
+
/* style */
|
|
2037
|
+
const __vue_inject_styles__$7 = undefined;
|
|
2038
|
+
/* scoped */
|
|
2039
|
+
const __vue_scope_id__$7 = undefined;
|
|
2040
|
+
/* module identifier */
|
|
2041
|
+
const __vue_module_identifier__$7 = undefined;
|
|
2042
|
+
/* functional template */
|
|
2043
|
+
const __vue_is_functional_template__$7 = false;
|
|
2044
|
+
/* style inject */
|
|
2045
|
+
|
|
2046
|
+
/* style inject SSR */
|
|
2047
|
+
|
|
2048
|
+
/* style inject shadow dom */
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
|
|
2052
|
+
const __vue_component__$7 = /*#__PURE__*/normalizeComponent(
|
|
2053
|
+
{ render: __vue_render__$7, staticRenderFns: __vue_staticRenderFns__$7 },
|
|
2054
|
+
__vue_inject_styles__$7,
|
|
2055
|
+
__vue_script__$7,
|
|
2056
|
+
__vue_scope_id__$7,
|
|
2057
|
+
__vue_is_functional_template__$7,
|
|
2058
|
+
__vue_module_identifier__$7,
|
|
2059
|
+
false,
|
|
2060
|
+
undefined,
|
|
2061
|
+
undefined,
|
|
2062
|
+
undefined
|
|
2063
|
+
);
|
|
2064
|
+
|
|
2065
|
+
var Field = __vue_component__$7;
|
|
2066
|
+
|
|
2067
|
+
var script$6 = {
|
|
2068
|
+
name: 'BSelect',
|
|
2069
|
+
components: _defineProperty({}, Icon.name, Icon),
|
|
2070
|
+
mixins: [FormElementMixin],
|
|
2071
|
+
inheritAttrs: false,
|
|
2072
|
+
props: {
|
|
2073
|
+
value: {
|
|
2074
|
+
type: [String, Number, Boolean, Object, Array, Function, Date],
|
|
2075
|
+
default: null
|
|
2076
|
+
},
|
|
2077
|
+
placeholder: String,
|
|
2078
|
+
multiple: Boolean,
|
|
2079
|
+
nativeSize: [String, Number]
|
|
2080
|
+
},
|
|
2081
|
+
data: function data() {
|
|
2082
|
+
return {
|
|
2083
|
+
selected: this.value,
|
|
2084
|
+
_elementRef: 'select'
|
|
2085
|
+
};
|
|
2086
|
+
},
|
|
2087
|
+
computed: {
|
|
2088
|
+
computedValue: {
|
|
2089
|
+
get: function get() {
|
|
2090
|
+
return this.selected;
|
|
2091
|
+
},
|
|
2092
|
+
set: function set(value) {
|
|
2093
|
+
this.selected = value;
|
|
2094
|
+
this.$emit('input', value);
|
|
2095
|
+
!this.isValid && this.checkHtml5Validity();
|
|
2096
|
+
}
|
|
2097
|
+
},
|
|
2098
|
+
spanClasses: function spanClasses() {
|
|
2099
|
+
return [this.size, this.statusType, {
|
|
2100
|
+
'is-fullwidth': this.expanded,
|
|
2101
|
+
'is-loading': this.loading,
|
|
2102
|
+
'is-multiple': this.multiple,
|
|
2103
|
+
'is-rounded': this.rounded,
|
|
2104
|
+
'is-empty': this.selected === null
|
|
2105
|
+
}];
|
|
2106
|
+
}
|
|
2107
|
+
},
|
|
2108
|
+
watch: {
|
|
2109
|
+
/**
|
|
2110
|
+
* When v-model is changed:
|
|
2111
|
+
* 1. Set the selected option.
|
|
2112
|
+
* 2. If it's invalid, validate again.
|
|
2113
|
+
*/
|
|
2114
|
+
value: function value(_value) {
|
|
2115
|
+
this.selected = _value;
|
|
2116
|
+
!this.isValid && this.checkHtml5Validity();
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
|
|
2121
|
+
/* script */
|
|
2122
|
+
const __vue_script__$6 = script$6;
|
|
2123
|
+
|
|
2124
|
+
/* template */
|
|
2125
|
+
var __vue_render__$6 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"control",class:{ 'is-expanded': _vm.expanded, 'has-icons-left': _vm.icon }},[_c('span',{staticClass:"select",class:_vm.spanClasses},[_c('select',_vm._b({directives:[{name:"model",rawName:"v-model",value:(_vm.computedValue),expression:"computedValue"}],ref:"select",attrs:{"multiple":_vm.multiple,"size":_vm.nativeSize},on:{"blur":function($event){_vm.$emit('blur', $event) && _vm.checkHtml5Validity();},"focus":function($event){return _vm.$emit('focus', $event)},"change":function($event){var $$selectedVal = Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return val}); _vm.computedValue=$event.target.multiple ? $$selectedVal : $$selectedVal[0];}}},'select',_vm.$attrs,false),[(_vm.placeholder)?[(_vm.computedValue == null)?_c('option',{attrs:{"disabled":"","hidden":""},domProps:{"value":null}},[_vm._v(" "+_vm._s(_vm.placeholder)+" ")]):_vm._e()]:_vm._e(),_vm._t("default")],2)]),(_vm.icon)?_c('b-icon',{staticClass:"is-left",attrs:{"icon":_vm.icon,"pack":_vm.iconPack,"size":_vm.iconSize}}):_vm._e()],1)};
|
|
2126
|
+
var __vue_staticRenderFns__$6 = [];
|
|
2127
|
+
|
|
2128
|
+
/* style */
|
|
2129
|
+
const __vue_inject_styles__$6 = undefined;
|
|
2130
|
+
/* scoped */
|
|
2131
|
+
const __vue_scope_id__$6 = undefined;
|
|
2132
|
+
/* module identifier */
|
|
2133
|
+
const __vue_module_identifier__$6 = undefined;
|
|
2134
|
+
/* functional template */
|
|
2135
|
+
const __vue_is_functional_template__$6 = false;
|
|
2136
|
+
/* style inject */
|
|
2137
|
+
|
|
2138
|
+
/* style inject SSR */
|
|
2139
|
+
|
|
2140
|
+
/* style inject shadow dom */
|
|
2141
|
+
|
|
2142
|
+
|
|
2143
|
+
|
|
2144
|
+
const __vue_component__$6 = /*#__PURE__*/normalizeComponent(
|
|
2145
|
+
{ render: __vue_render__$6, staticRenderFns: __vue_staticRenderFns__$6 },
|
|
2146
|
+
__vue_inject_styles__$6,
|
|
2147
|
+
__vue_script__$6,
|
|
2148
|
+
__vue_scope_id__$6,
|
|
2149
|
+
__vue_is_functional_template__$6,
|
|
2150
|
+
__vue_module_identifier__$6,
|
|
2151
|
+
false,
|
|
2152
|
+
undefined,
|
|
2153
|
+
undefined,
|
|
2154
|
+
undefined
|
|
2155
|
+
);
|
|
2156
|
+
|
|
2157
|
+
var Select = __vue_component__$6;
|
|
2158
|
+
|
|
2159
|
+
//
|
|
2160
|
+
//
|
|
2161
|
+
//
|
|
2162
|
+
//
|
|
2163
|
+
//
|
|
2164
|
+
//
|
|
2165
|
+
//
|
|
2166
|
+
//
|
|
2167
|
+
//
|
|
2168
|
+
//
|
|
2169
|
+
//
|
|
2170
|
+
//
|
|
2171
|
+
//
|
|
2172
|
+
//
|
|
2173
|
+
//
|
|
2174
|
+
//
|
|
2175
|
+
//
|
|
2176
|
+
//
|
|
2177
|
+
//
|
|
2178
|
+
//
|
|
2179
|
+
//
|
|
2180
|
+
//
|
|
2181
|
+
//
|
|
2182
|
+
//
|
|
2183
|
+
//
|
|
2184
|
+
//
|
|
2185
|
+
//
|
|
2186
|
+
//
|
|
2187
|
+
//
|
|
2188
|
+
//
|
|
2189
|
+
//
|
|
2190
|
+
//
|
|
2191
|
+
//
|
|
2192
|
+
//
|
|
2193
|
+
//
|
|
2194
|
+
//
|
|
2195
|
+
//
|
|
2196
|
+
//
|
|
2197
|
+
//
|
|
2198
|
+
//
|
|
2199
|
+
//
|
|
2200
|
+
//
|
|
2201
|
+
//
|
|
2202
|
+
//
|
|
2203
|
+
//
|
|
2204
|
+
//
|
|
2205
|
+
//
|
|
2206
|
+
//
|
|
2207
|
+
//
|
|
2208
|
+
//
|
|
2209
|
+
|
|
2210
|
+
var script$5 = {
|
|
2211
|
+
name: 'BDatepickerTableRow',
|
|
2212
|
+
inject: {
|
|
2213
|
+
$datepicker: {
|
|
2214
|
+
name: '$datepicker',
|
|
2215
|
+
default: false
|
|
2216
|
+
}
|
|
2217
|
+
},
|
|
2218
|
+
props: {
|
|
2219
|
+
selectedDate: {
|
|
2220
|
+
type: [Date, Array]
|
|
2221
|
+
},
|
|
2222
|
+
hoveredDateRange: Array,
|
|
2223
|
+
day: {
|
|
2224
|
+
type: Number
|
|
2225
|
+
},
|
|
2226
|
+
week: {
|
|
2227
|
+
type: Array,
|
|
2228
|
+
required: true
|
|
2229
|
+
},
|
|
2230
|
+
month: {
|
|
2231
|
+
type: Number,
|
|
2232
|
+
required: true
|
|
2233
|
+
},
|
|
2234
|
+
minDate: Date,
|
|
2235
|
+
maxDate: Date,
|
|
2236
|
+
disabled: Boolean,
|
|
2237
|
+
unselectableDates: [Array, Function],
|
|
2238
|
+
unselectableDaysOfWeek: Array,
|
|
2239
|
+
selectableDates: [Array, Function],
|
|
2240
|
+
events: Array,
|
|
2241
|
+
indicators: String,
|
|
2242
|
+
dateCreator: Function,
|
|
2243
|
+
nearbyMonthDays: Boolean,
|
|
2244
|
+
nearbySelectableMonthDays: Boolean,
|
|
2245
|
+
showWeekNumber: Boolean,
|
|
2246
|
+
weekNumberClickable: Boolean,
|
|
2247
|
+
range: Boolean,
|
|
2248
|
+
multiple: Boolean,
|
|
2249
|
+
rulesForFirstWeek: Number,
|
|
2250
|
+
firstDayOfWeek: Number
|
|
2251
|
+
},
|
|
2252
|
+
watch: {
|
|
2253
|
+
day: function day(_day) {
|
|
2254
|
+
var _this = this;
|
|
2255
|
+
var refName = "day-".concat(this.month, "-").concat(_day);
|
|
2256
|
+
this.$nextTick(function () {
|
|
2257
|
+
if (_this.$refs[refName] && _this.$refs[refName].length > 0) {
|
|
2258
|
+
if (_this.$refs[refName][0]) {
|
|
2259
|
+
_this.$refs[refName][0].focus();
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
}); // $nextTick needed when month is changed
|
|
2263
|
+
}
|
|
2264
|
+
},
|
|
2265
|
+
methods: {
|
|
2266
|
+
firstWeekOffset: function firstWeekOffset(year, dow, doy) {
|
|
2267
|
+
// first-week day -- which january is always in the first week (4 for iso, 1 for other)
|
|
2268
|
+
var fwd = 7 + dow - doy;
|
|
2269
|
+
// first-week day local weekday -- which local weekday is fwd
|
|
2270
|
+
var firstJanuary = new Date(year, 0, fwd);
|
|
2271
|
+
var fwdlw = (7 + firstJanuary.getDay() - dow) % 7;
|
|
2272
|
+
return -fwdlw + fwd - 1;
|
|
2273
|
+
},
|
|
2274
|
+
daysInYear: function daysInYear(year) {
|
|
2275
|
+
return this.isLeapYear(year) ? 366 : 365;
|
|
2276
|
+
},
|
|
2277
|
+
isLeapYear: function isLeapYear(year) {
|
|
2278
|
+
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
2279
|
+
},
|
|
2280
|
+
getSetDayOfYear: function getSetDayOfYear(input) {
|
|
2281
|
+
return Math.round((input - new Date(input.getFullYear(), 0, 1)) / 864e5) + 1;
|
|
2282
|
+
},
|
|
2283
|
+
weeksInYear: function weeksInYear(year, dow, doy) {
|
|
2284
|
+
var weekOffset = this.firstWeekOffset(year, dow, doy);
|
|
2285
|
+
var weekOffsetNext = this.firstWeekOffset(year + 1, dow, doy);
|
|
2286
|
+
return (this.daysInYear(year) - weekOffset + weekOffsetNext) / 7;
|
|
2287
|
+
},
|
|
2288
|
+
getWeekNumber: function getWeekNumber(mom) {
|
|
2289
|
+
var dow = this.firstDayOfWeek; // first day of week
|
|
2290
|
+
// Rules for the first week : 1 for the 1st January, 4 for the 4th January
|
|
2291
|
+
var doy = this.rulesForFirstWeek;
|
|
2292
|
+
var weekOffset = this.firstWeekOffset(mom.getFullYear(), dow, doy);
|
|
2293
|
+
var week = Math.floor((this.getSetDayOfYear(mom) - weekOffset - 1) / 7) + 1;
|
|
2294
|
+
var resWeek;
|
|
2295
|
+
var resYear;
|
|
2296
|
+
if (week < 1) {
|
|
2297
|
+
resYear = mom.getFullYear() - 1;
|
|
2298
|
+
resWeek = week + this.weeksInYear(resYear, dow, doy);
|
|
2299
|
+
} else if (week > this.weeksInYear(mom.getFullYear(), dow, doy)) {
|
|
2300
|
+
resWeek = week - this.weeksInYear(mom.getFullYear(), dow, doy);
|
|
2301
|
+
resYear = mom.getFullYear() + 1;
|
|
2302
|
+
} else {
|
|
2303
|
+
resYear = mom.getFullYear();
|
|
2304
|
+
resWeek = week;
|
|
2305
|
+
}
|
|
2306
|
+
return {
|
|
2307
|
+
week: resWeek,
|
|
2308
|
+
year: resYear
|
|
2309
|
+
};
|
|
2310
|
+
},
|
|
2311
|
+
clickWeekNumber: function clickWeekNumber(weekData) {
|
|
2312
|
+
if (this.weekNumberClickable) {
|
|
2313
|
+
this.$datepicker.$emit('week-number-click', weekData.week, weekData.year);
|
|
2314
|
+
}
|
|
2315
|
+
},
|
|
2316
|
+
/*
|
|
2317
|
+
* Check that selected day is within earliest/latest params and
|
|
2318
|
+
* is within this month
|
|
2319
|
+
*/
|
|
2320
|
+
selectableDate: function selectableDate(day) {
|
|
2321
|
+
var validity = [];
|
|
2322
|
+
if (this.minDate) {
|
|
2323
|
+
validity.push(day >= this.minDate);
|
|
2324
|
+
}
|
|
2325
|
+
if (this.maxDate) {
|
|
2326
|
+
validity.push(day <= this.maxDate);
|
|
2327
|
+
}
|
|
2328
|
+
if (this.nearbyMonthDays && !this.nearbySelectableMonthDays) {
|
|
2329
|
+
validity.push(day.getMonth() === this.month);
|
|
2330
|
+
}
|
|
2331
|
+
if (this.selectableDates) {
|
|
2332
|
+
if (typeof this.selectableDates === 'function') {
|
|
2333
|
+
if (this.selectableDates(day)) {
|
|
2334
|
+
return true;
|
|
2335
|
+
} else {
|
|
2336
|
+
validity.push(false);
|
|
2337
|
+
}
|
|
2338
|
+
} else {
|
|
2339
|
+
for (var i = 0; i < this.selectableDates.length; i++) {
|
|
2340
|
+
var enabledDate = this.selectableDates[i];
|
|
2341
|
+
if (day.getDate() === enabledDate.getDate() && day.getFullYear() === enabledDate.getFullYear() && day.getMonth() === enabledDate.getMonth()) {
|
|
2342
|
+
return true;
|
|
2343
|
+
} else {
|
|
2344
|
+
validity.push(false);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
if (this.unselectableDates) {
|
|
2350
|
+
if (typeof this.unselectableDates === 'function') {
|
|
2351
|
+
validity.push(!this.unselectableDates(day));
|
|
2352
|
+
} else {
|
|
2353
|
+
for (var _i = 0; _i < this.unselectableDates.length; _i++) {
|
|
2354
|
+
var disabledDate = this.unselectableDates[_i];
|
|
2355
|
+
validity.push(day.getDate() !== disabledDate.getDate() || day.getFullYear() !== disabledDate.getFullYear() || day.getMonth() !== disabledDate.getMonth());
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
if (this.unselectableDaysOfWeek) {
|
|
2360
|
+
for (var _i2 = 0; _i2 < this.unselectableDaysOfWeek.length; _i2++) {
|
|
2361
|
+
var dayOfWeek = this.unselectableDaysOfWeek[_i2];
|
|
2362
|
+
validity.push(day.getDay() !== dayOfWeek);
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
return validity.indexOf(false) < 0;
|
|
2366
|
+
},
|
|
2367
|
+
/*
|
|
2368
|
+
* Emit select event with chosen date as payload
|
|
2369
|
+
*/
|
|
2370
|
+
emitChosenDate: function emitChosenDate(day) {
|
|
2371
|
+
if (this.disabled) return;
|
|
2372
|
+
if (this.selectableDate(day)) {
|
|
2373
|
+
this.$emit('select', day);
|
|
2374
|
+
}
|
|
2375
|
+
},
|
|
2376
|
+
eventsDateMatch: function eventsDateMatch(day) {
|
|
2377
|
+
if (!this.events || !this.events.length) return false;
|
|
2378
|
+
var dayEvents = [];
|
|
2379
|
+
for (var i = 0; i < this.events.length; i++) {
|
|
2380
|
+
if (this.events[i].date.getDay() === day.getDay()) {
|
|
2381
|
+
dayEvents.push(this.events[i]);
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
if (!dayEvents.length) {
|
|
2385
|
+
return false;
|
|
2386
|
+
}
|
|
2387
|
+
return dayEvents;
|
|
2388
|
+
},
|
|
2389
|
+
/*
|
|
2390
|
+
* Build classObject for cell using validations
|
|
2391
|
+
*/
|
|
2392
|
+
classObject: function classObject(day) {
|
|
2393
|
+
function dateMatch(dateOne, dateTwo, multiple) {
|
|
2394
|
+
// if either date is null or undefined, return false
|
|
2395
|
+
// if using multiple flag, return false
|
|
2396
|
+
if (!dateOne || !dateTwo || multiple) {
|
|
2397
|
+
return false;
|
|
2398
|
+
}
|
|
2399
|
+
if (Array.isArray(dateTwo)) {
|
|
2400
|
+
return dateTwo.some(function (date) {
|
|
2401
|
+
return dateOne.getDate() === date.getDate() && dateOne.getFullYear() === date.getFullYear() && dateOne.getMonth() === date.getMonth();
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2404
|
+
return dateOne.getDate() === dateTwo.getDate() && dateOne.getFullYear() === dateTwo.getFullYear() && dateOne.getMonth() === dateTwo.getMonth();
|
|
2405
|
+
}
|
|
2406
|
+
function dateWithin(dateOne, dates, multiple) {
|
|
2407
|
+
if (!Array.isArray(dates) || multiple) {
|
|
2408
|
+
return false;
|
|
2409
|
+
}
|
|
2410
|
+
return dateOne > dates[0] && dateOne < dates[1];
|
|
2411
|
+
}
|
|
2412
|
+
return _defineProperty({
|
|
2413
|
+
'is-selected': dateMatch(day, this.selectedDate) || dateWithin(day, this.selectedDate, this.multiple),
|
|
2414
|
+
'is-first-selected': dateMatch(day, Array.isArray(this.selectedDate) && this.selectedDate[0], this.multiple),
|
|
2415
|
+
'is-within-selected': dateWithin(day, this.selectedDate, this.multiple),
|
|
2416
|
+
'is-last-selected': dateMatch(day, Array.isArray(this.selectedDate) && this.selectedDate[1], this.multiple),
|
|
2417
|
+
'is-within-hovered-range': this.hoveredDateRange && this.hoveredDateRange.length === 2 && (dateMatch(day, this.hoveredDateRange) || dateWithin(day, this.hoveredDateRange)),
|
|
2418
|
+
'is-first-hovered': dateMatch(day, Array.isArray(this.hoveredDateRange) && this.hoveredDateRange[0]),
|
|
2419
|
+
'is-within-hovered': dateWithin(day, this.hoveredDateRange),
|
|
2420
|
+
'is-last-hovered': dateMatch(day, Array.isArray(this.hoveredDateRange) && this.hoveredDateRange[1]),
|
|
2421
|
+
'is-today': dateMatch(day, this.dateCreator()),
|
|
2422
|
+
'is-selectable': this.selectableDate(day) && !this.disabled,
|
|
2423
|
+
'is-unselectable': !this.selectableDate(day) || this.disabled,
|
|
2424
|
+
'is-invisible': !this.nearbyMonthDays && day.getMonth() !== this.month,
|
|
2425
|
+
'is-nearby': this.nearbySelectableMonthDays && day.getMonth() !== this.month,
|
|
2426
|
+
'has-event': this.eventsDateMatch(day)
|
|
2427
|
+
}, this.indicators, this.eventsDateMatch(day));
|
|
2428
|
+
},
|
|
2429
|
+
setRangeHoverEndDate: function setRangeHoverEndDate(day) {
|
|
2430
|
+
if (this.range) {
|
|
2431
|
+
this.$emit('rangeHoverEndDate', day);
|
|
2432
|
+
}
|
|
2433
|
+
},
|
|
2434
|
+
manageKeydown: function manageKeydown(event, weekDay) {
|
|
2435
|
+
// https://developer.mozilla.org/fr/docs/Web/API/KeyboardEvent/key/Key_Values#Navigation_keys
|
|
2436
|
+
var key = event.key;
|
|
2437
|
+
var preventDefault = true;
|
|
2438
|
+
switch (key) {
|
|
2439
|
+
case 'Tab':
|
|
2440
|
+
{
|
|
2441
|
+
preventDefault = false;
|
|
2442
|
+
break;
|
|
2443
|
+
}
|
|
2444
|
+
case ' ':
|
|
2445
|
+
case 'Space':
|
|
2446
|
+
case 'Spacebar':
|
|
2447
|
+
case 'Enter':
|
|
2448
|
+
{
|
|
2449
|
+
this.emitChosenDate(weekDay);
|
|
2450
|
+
break;
|
|
2451
|
+
}
|
|
2452
|
+
case 'ArrowLeft':
|
|
2453
|
+
case 'Left':
|
|
2454
|
+
{
|
|
2455
|
+
this.changeFocus(weekDay, -1);
|
|
2456
|
+
break;
|
|
2457
|
+
}
|
|
2458
|
+
case 'ArrowRight':
|
|
2459
|
+
case 'Right':
|
|
2460
|
+
{
|
|
2461
|
+
this.changeFocus(weekDay, 1);
|
|
2462
|
+
break;
|
|
2463
|
+
}
|
|
2464
|
+
case 'ArrowUp':
|
|
2465
|
+
case 'Up':
|
|
2466
|
+
{
|
|
2467
|
+
this.changeFocus(weekDay, -7);
|
|
2468
|
+
break;
|
|
2469
|
+
}
|
|
2470
|
+
case 'ArrowDown':
|
|
2471
|
+
case 'Down':
|
|
2472
|
+
{
|
|
2473
|
+
this.changeFocus(weekDay, 7);
|
|
2474
|
+
break;
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
if (preventDefault) {
|
|
2478
|
+
event.preventDefault();
|
|
2479
|
+
}
|
|
2480
|
+
},
|
|
2481
|
+
changeFocus: function changeFocus(day, inc) {
|
|
2482
|
+
var nextDay = new Date(day.getTime());
|
|
2483
|
+
nextDay.setDate(day.getDate() + inc);
|
|
2484
|
+
while ((!this.minDate || nextDay > this.minDate) && (!this.maxDate || nextDay < this.maxDate) && !this.selectableDate(nextDay)) {
|
|
2485
|
+
nextDay.setDate(nextDay.getDate() + Math.sign(inc));
|
|
2486
|
+
}
|
|
2487
|
+
this.setRangeHoverEndDate(nextDay);
|
|
2488
|
+
this.$emit('change-focus', nextDay);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
};
|
|
2492
|
+
|
|
2493
|
+
/* script */
|
|
2494
|
+
const __vue_script__$5 = script$5;
|
|
2495
|
+
|
|
2496
|
+
/* template */
|
|
2497
|
+
var __vue_render__$5 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"datepicker-row"},[(_vm.showWeekNumber)?_c('a',{staticClass:"datepicker-cell is-week-number",class:{'is-clickable': _vm.weekNumberClickable },on:{"click":function($event){$event.preventDefault();_vm.clickWeekNumber(_vm.getWeekNumber(_vm.week[6]));}}},[_c('span',[_vm._v(_vm._s(_vm.getWeekNumber(_vm.week[6]).week))])]):_vm._e(),_vm._l((_vm.week),function(weekDay,index){return [(_vm.selectableDate(weekDay) && !_vm.disabled)?_c('a',{key:index,ref:("day-" + (weekDay.getMonth()) + "-" + (weekDay.getDate())),refInFor:true,staticClass:"datepicker-cell",class:_vm.classObject(weekDay),attrs:{"role":"button","href":"#","disabled":_vm.disabled,"tabindex":_vm.day === weekDay.getDate() && _vm.month === weekDay.getMonth() ? null : -1},on:{"click":function($event){$event.preventDefault();return _vm.emitChosenDate(weekDay)},"mouseenter":function($event){return _vm.setRangeHoverEndDate(weekDay)},"keydown":function($event){return _vm.manageKeydown($event, weekDay)}}},[_c('span',[_vm._v(_vm._s(weekDay.getDate()))]),(_vm.eventsDateMatch(weekDay))?_c('div',{staticClass:"events"},_vm._l((_vm.eventsDateMatch(weekDay)),function(event,index){return _c('div',{key:index,staticClass:"event",class:event.type})}),0):_vm._e()]):_c('div',{key:index,staticClass:"datepicker-cell",class:_vm.classObject(weekDay)},[_c('span',[_vm._v(_vm._s(weekDay.getDate()))]),(_vm.eventsDateMatch(weekDay))?_c('div',{staticClass:"events"},_vm._l((_vm.eventsDateMatch(weekDay)),function(event,index){return _c('div',{key:index,staticClass:"event",class:event.type})}),0):_vm._e()])]})],2)};
|
|
2498
|
+
var __vue_staticRenderFns__$5 = [];
|
|
2499
|
+
|
|
2500
|
+
/* style */
|
|
2501
|
+
const __vue_inject_styles__$5 = undefined;
|
|
2502
|
+
/* scoped */
|
|
2503
|
+
const __vue_scope_id__$5 = undefined;
|
|
2504
|
+
/* module identifier */
|
|
2505
|
+
const __vue_module_identifier__$5 = undefined;
|
|
2506
|
+
/* functional template */
|
|
2507
|
+
const __vue_is_functional_template__$5 = false;
|
|
2508
|
+
/* style inject */
|
|
2509
|
+
|
|
2510
|
+
/* style inject SSR */
|
|
2511
|
+
|
|
2512
|
+
/* style inject shadow dom */
|
|
2513
|
+
|
|
2514
|
+
|
|
2515
|
+
|
|
2516
|
+
const __vue_component__$5 = /*#__PURE__*/normalizeComponent(
|
|
2517
|
+
{ render: __vue_render__$5, staticRenderFns: __vue_staticRenderFns__$5 },
|
|
2518
|
+
__vue_inject_styles__$5,
|
|
2519
|
+
__vue_script__$5,
|
|
2520
|
+
__vue_scope_id__$5,
|
|
2521
|
+
__vue_is_functional_template__$5,
|
|
2522
|
+
__vue_module_identifier__$5,
|
|
2523
|
+
false,
|
|
2524
|
+
undefined,
|
|
2525
|
+
undefined,
|
|
2526
|
+
undefined
|
|
2527
|
+
);
|
|
2528
|
+
|
|
2529
|
+
var DatepickerTableRow = __vue_component__$5;
|
|
2530
|
+
|
|
2531
|
+
var script$4 = {
|
|
2532
|
+
name: 'BDatepickerTable',
|
|
2533
|
+
components: _defineProperty({}, DatepickerTableRow.name, DatepickerTableRow),
|
|
2534
|
+
props: {
|
|
2535
|
+
value: {
|
|
2536
|
+
type: [Date, Array]
|
|
2537
|
+
},
|
|
2538
|
+
dayNames: Array,
|
|
2539
|
+
monthNames: Array,
|
|
2540
|
+
firstDayOfWeek: Number,
|
|
2541
|
+
events: Array,
|
|
2542
|
+
indicators: String,
|
|
2543
|
+
minDate: Date,
|
|
2544
|
+
maxDate: Date,
|
|
2545
|
+
focused: Object,
|
|
2546
|
+
disabled: Boolean,
|
|
2547
|
+
dateCreator: Function,
|
|
2548
|
+
unselectableDates: [Array, Function],
|
|
2549
|
+
unselectableDaysOfWeek: Array,
|
|
2550
|
+
selectableDates: [Array, Function],
|
|
2551
|
+
nearbyMonthDays: Boolean,
|
|
2552
|
+
nearbySelectableMonthDays: Boolean,
|
|
2553
|
+
showWeekNumber: Boolean,
|
|
2554
|
+
weekNumberClickable: Boolean,
|
|
2555
|
+
rulesForFirstWeek: Number,
|
|
2556
|
+
range: Boolean,
|
|
2557
|
+
multiple: Boolean
|
|
2558
|
+
},
|
|
2559
|
+
data: function data() {
|
|
2560
|
+
return {
|
|
2561
|
+
selectedBeginDate: undefined,
|
|
2562
|
+
selectedEndDate: undefined,
|
|
2563
|
+
hoveredEndDate: undefined
|
|
2564
|
+
};
|
|
2565
|
+
},
|
|
2566
|
+
computed: {
|
|
2567
|
+
multipleSelectedDates: {
|
|
2568
|
+
get: function get() {
|
|
2569
|
+
return this.multiple && this.value ? this.value : [];
|
|
2570
|
+
},
|
|
2571
|
+
set: function set(value) {
|
|
2572
|
+
this.$emit('input', value);
|
|
2573
|
+
}
|
|
2574
|
+
},
|
|
2575
|
+
visibleDayNames: function visibleDayNames() {
|
|
2576
|
+
var visibleDayNames = [];
|
|
2577
|
+
var index = this.firstDayOfWeek;
|
|
2578
|
+
while (visibleDayNames.length < this.dayNames.length) {
|
|
2579
|
+
var currentDayName = this.dayNames[index % this.dayNames.length];
|
|
2580
|
+
visibleDayNames.push(currentDayName);
|
|
2581
|
+
index++;
|
|
2582
|
+
}
|
|
2583
|
+
if (this.showWeekNumber) visibleDayNames.unshift('');
|
|
2584
|
+
return visibleDayNames;
|
|
2585
|
+
},
|
|
2586
|
+
hasEvents: function hasEvents() {
|
|
2587
|
+
return this.events && this.events.length;
|
|
2588
|
+
},
|
|
2589
|
+
/*
|
|
2590
|
+
* Return array of all events in the specified month
|
|
2591
|
+
*/
|
|
2592
|
+
eventsInThisMonth: function eventsInThisMonth() {
|
|
2593
|
+
if (!this.events) return [];
|
|
2594
|
+
var monthEvents = [];
|
|
2595
|
+
for (var i = 0; i < this.events.length; i++) {
|
|
2596
|
+
var event = this.events[i];
|
|
2597
|
+
if (!event.hasOwnProperty('date')) {
|
|
2598
|
+
event = {
|
|
2599
|
+
date: event
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
if (!event.hasOwnProperty('type')) {
|
|
2603
|
+
event.type = 'is-primary';
|
|
2604
|
+
}
|
|
2605
|
+
if (event.date.getMonth() === this.focused.month && event.date.getFullYear() === this.focused.year) {
|
|
2606
|
+
monthEvents.push(event);
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2609
|
+
return monthEvents;
|
|
2610
|
+
},
|
|
2611
|
+
/*
|
|
2612
|
+
* Return array of all weeks in the specified month
|
|
2613
|
+
*/
|
|
2614
|
+
weeksInThisMonth: function weeksInThisMonth() {
|
|
2615
|
+
this.validateFocusedDay();
|
|
2616
|
+
var month = this.focused.month;
|
|
2617
|
+
var year = this.focused.year;
|
|
2618
|
+
var weeksInThisMonth = [];
|
|
2619
|
+
var startingDay = 1;
|
|
2620
|
+
while (weeksInThisMonth.length < 6) {
|
|
2621
|
+
var newWeek = this.weekBuilder(startingDay, month, year);
|
|
2622
|
+
weeksInThisMonth.push(newWeek);
|
|
2623
|
+
startingDay += 7;
|
|
2624
|
+
}
|
|
2625
|
+
return weeksInThisMonth;
|
|
2626
|
+
},
|
|
2627
|
+
hoveredDateRange: function hoveredDateRange() {
|
|
2628
|
+
if (!this.range) {
|
|
2629
|
+
return [];
|
|
2630
|
+
}
|
|
2631
|
+
if (!isNaN(this.selectedEndDate)) {
|
|
2632
|
+
return [];
|
|
2633
|
+
}
|
|
2634
|
+
if (this.hoveredEndDate < this.selectedBeginDate) {
|
|
2635
|
+
return [this.hoveredEndDate, this.selectedBeginDate].filter(isDefined);
|
|
2636
|
+
}
|
|
2637
|
+
return [this.selectedBeginDate, this.hoveredEndDate].filter(isDefined);
|
|
2638
|
+
}
|
|
2639
|
+
},
|
|
2640
|
+
methods: {
|
|
2641
|
+
/*
|
|
2642
|
+
* Emit input event with selected date as payload for v-model in parent
|
|
2643
|
+
*/
|
|
2644
|
+
updateSelectedDate: function updateSelectedDate(date) {
|
|
2645
|
+
if (!this.range && !this.multiple) {
|
|
2646
|
+
this.$emit('input', date);
|
|
2647
|
+
} else if (this.range) {
|
|
2648
|
+
this.handleSelectRangeDate(date);
|
|
2649
|
+
} else if (this.multiple) {
|
|
2650
|
+
this.handleSelectMultipleDates(date);
|
|
2651
|
+
}
|
|
2652
|
+
},
|
|
2653
|
+
/*
|
|
2654
|
+
* If both begin and end dates are set, reset the end date and set the begin date.
|
|
2655
|
+
* If only begin date is selected, emit an array of the begin date and the new date.
|
|
2656
|
+
* If not set, only set the begin date.
|
|
2657
|
+
*/
|
|
2658
|
+
handleSelectRangeDate: function handleSelectRangeDate(date) {
|
|
2659
|
+
if (this.selectedBeginDate && this.selectedEndDate) {
|
|
2660
|
+
this.selectedBeginDate = date;
|
|
2661
|
+
this.selectedEndDate = undefined;
|
|
2662
|
+
this.$emit('range-start', date);
|
|
2663
|
+
} else if (this.selectedBeginDate && !this.selectedEndDate) {
|
|
2664
|
+
if (this.selectedBeginDate > date) {
|
|
2665
|
+
this.selectedEndDate = this.selectedBeginDate;
|
|
2666
|
+
this.selectedBeginDate = date;
|
|
2667
|
+
} else {
|
|
2668
|
+
this.selectedEndDate = date;
|
|
2669
|
+
}
|
|
2670
|
+
this.$emit('range-end', date);
|
|
2671
|
+
this.$emit('input', [this.selectedBeginDate, this.selectedEndDate]);
|
|
2672
|
+
} else {
|
|
2673
|
+
this.selectedBeginDate = date;
|
|
2674
|
+
this.$emit('range-start', date);
|
|
2675
|
+
}
|
|
2676
|
+
},
|
|
2677
|
+
/*
|
|
2678
|
+
* If selected date already exists list of selected dates, remove it from the list
|
|
2679
|
+
* Otherwise, add date to list of selected dates
|
|
2680
|
+
*/
|
|
2681
|
+
handleSelectMultipleDates: function handleSelectMultipleDates(date) {
|
|
2682
|
+
var multipleSelect = this.multipleSelectedDates.filter(function (selectedDate) {
|
|
2683
|
+
return selectedDate.getDate() === date.getDate() && selectedDate.getFullYear() === date.getFullYear() && selectedDate.getMonth() === date.getMonth();
|
|
2684
|
+
});
|
|
2685
|
+
if (multipleSelect.length) {
|
|
2686
|
+
this.multipleSelectedDates = this.multipleSelectedDates.filter(function (selectedDate) {
|
|
2687
|
+
return selectedDate.getDate() !== date.getDate() || selectedDate.getFullYear() !== date.getFullYear() || selectedDate.getMonth() !== date.getMonth();
|
|
2688
|
+
});
|
|
2689
|
+
} else {
|
|
2690
|
+
this.multipleSelectedDates = [].concat(_toConsumableArray(this.multipleSelectedDates), [date]);
|
|
2691
|
+
}
|
|
2692
|
+
},
|
|
2693
|
+
/*
|
|
2694
|
+
* Return array of all days in the week that the startingDate is within
|
|
2695
|
+
*/
|
|
2696
|
+
weekBuilder: function weekBuilder(startingDate, month, year) {
|
|
2697
|
+
var thisMonth = new Date(year, month);
|
|
2698
|
+
var thisWeek = [];
|
|
2699
|
+
var dayOfWeek = new Date(year, month, startingDate).getDay();
|
|
2700
|
+
var end = dayOfWeek >= this.firstDayOfWeek ? dayOfWeek - this.firstDayOfWeek : 7 - this.firstDayOfWeek + dayOfWeek;
|
|
2701
|
+
var daysAgo = 1;
|
|
2702
|
+
for (var i = 0; i < end; i++) {
|
|
2703
|
+
thisWeek.unshift(new Date(thisMonth.getFullYear(), thisMonth.getMonth(), startingDate - daysAgo));
|
|
2704
|
+
daysAgo++;
|
|
2705
|
+
}
|
|
2706
|
+
thisWeek.push(new Date(year, month, startingDate));
|
|
2707
|
+
var daysForward = 1;
|
|
2708
|
+
while (thisWeek.length < 7) {
|
|
2709
|
+
thisWeek.push(new Date(year, month, startingDate + daysForward));
|
|
2710
|
+
daysForward++;
|
|
2711
|
+
}
|
|
2712
|
+
return thisWeek;
|
|
2713
|
+
},
|
|
2714
|
+
validateFocusedDay: function validateFocusedDay() {
|
|
2715
|
+
var focusedDate = new Date(this.focused.year, this.focused.month, this.focused.day);
|
|
2716
|
+
if (this.selectableDate(focusedDate)) return;
|
|
2717
|
+
var day = 0;
|
|
2718
|
+
// Number of days in the current month
|
|
2719
|
+
var monthDays = new Date(this.focused.year, this.focused.month + 1, 0).getDate();
|
|
2720
|
+
var firstFocusable = null;
|
|
2721
|
+
while (!firstFocusable && ++day < monthDays) {
|
|
2722
|
+
var date = new Date(this.focused.year, this.focused.month, day);
|
|
2723
|
+
if (this.selectableDate(date)) {
|
|
2724
|
+
firstFocusable = focusedDate;
|
|
2725
|
+
var focused = {
|
|
2726
|
+
day: date.getDate(),
|
|
2727
|
+
month: date.getMonth(),
|
|
2728
|
+
year: date.getFullYear()
|
|
2729
|
+
};
|
|
2730
|
+
this.$emit('update:focused', focused);
|
|
2731
|
+
}
|
|
2732
|
+
}
|
|
2733
|
+
},
|
|
2734
|
+
/*
|
|
2735
|
+
* Check that selected day is within earliest/latest params and
|
|
2736
|
+
* is within this month
|
|
2737
|
+
*/
|
|
2738
|
+
selectableDate: function selectableDate(day) {
|
|
2739
|
+
var validity = [];
|
|
2740
|
+
if (this.minDate) {
|
|
2741
|
+
validity.push(day >= this.minDate);
|
|
2742
|
+
}
|
|
2743
|
+
if (this.maxDate) {
|
|
2744
|
+
validity.push(day <= this.maxDate);
|
|
2745
|
+
}
|
|
2746
|
+
if (this.nearbyMonthDays && !this.nearbySelectableMonthDays) {
|
|
2747
|
+
validity.push(day.getMonth() === this.focused.month);
|
|
2748
|
+
}
|
|
2749
|
+
if (this.selectableDates) {
|
|
2750
|
+
if (typeof this.selectableDates === 'function') {
|
|
2751
|
+
if (this.selectableDates(day)) {
|
|
2752
|
+
return true;
|
|
2753
|
+
} else {
|
|
2754
|
+
validity.push(false);
|
|
2755
|
+
}
|
|
2756
|
+
} else {
|
|
2757
|
+
for (var i = 0; i < this.selectableDates.length; i++) {
|
|
2758
|
+
var enabledDate = this.selectableDates[i];
|
|
2759
|
+
if (day.getDate() === enabledDate.getDate() && day.getFullYear() === enabledDate.getFullYear() && day.getMonth() === enabledDate.getMonth()) {
|
|
2760
|
+
return true;
|
|
2761
|
+
} else {
|
|
2762
|
+
validity.push(false);
|
|
2763
|
+
}
|
|
2764
|
+
}
|
|
2765
|
+
}
|
|
2766
|
+
}
|
|
2767
|
+
if (this.unselectableDates) {
|
|
2768
|
+
if (typeof this.unselectableDates === 'function') {
|
|
2769
|
+
validity.push(!this.unselectableDates(day));
|
|
2770
|
+
} else {
|
|
2771
|
+
for (var _i = 0; _i < this.unselectableDates.length; _i++) {
|
|
2772
|
+
var disabledDate = this.unselectableDates[_i];
|
|
2773
|
+
validity.push(day.getDate() !== disabledDate.getDate() || day.getFullYear() !== disabledDate.getFullYear() || day.getMonth() !== disabledDate.getMonth());
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
if (this.unselectableDaysOfWeek) {
|
|
2778
|
+
for (var _i2 = 0; _i2 < this.unselectableDaysOfWeek.length; _i2++) {
|
|
2779
|
+
var dayOfWeek = this.unselectableDaysOfWeek[_i2];
|
|
2780
|
+
validity.push(day.getDay() !== dayOfWeek);
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
return validity.indexOf(false) < 0;
|
|
2784
|
+
},
|
|
2785
|
+
eventsInThisWeek: function eventsInThisWeek(week) {
|
|
2786
|
+
return this.eventsInThisMonth.filter(function (event) {
|
|
2787
|
+
var stripped = new Date(Date.parse(event.date));
|
|
2788
|
+
stripped.setHours(0, 0, 0, 0);
|
|
2789
|
+
var timed = stripped.getTime();
|
|
2790
|
+
return week.some(function (weekDate) {
|
|
2791
|
+
return weekDate.getTime() === timed;
|
|
2792
|
+
});
|
|
2793
|
+
});
|
|
2794
|
+
},
|
|
2795
|
+
setRangeHoverEndDate: function setRangeHoverEndDate(day) {
|
|
2796
|
+
this.hoveredEndDate = day;
|
|
2797
|
+
},
|
|
2798
|
+
changeFocus: function changeFocus(day) {
|
|
2799
|
+
var focused = {
|
|
2800
|
+
day: day.getDate(),
|
|
2801
|
+
month: day.getMonth(),
|
|
2802
|
+
year: day.getFullYear()
|
|
2803
|
+
};
|
|
2804
|
+
this.$emit('update:focused', focused);
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
};
|
|
2808
|
+
|
|
2809
|
+
/* script */
|
|
2810
|
+
const __vue_script__$4 = script$4;
|
|
2811
|
+
|
|
2812
|
+
/* template */
|
|
2813
|
+
var __vue_render__$4 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',{staticClass:"datepicker-table"},[_c('header',{staticClass:"datepicker-header"},_vm._l((_vm.visibleDayNames),function(day,index){return _c('div',{key:index,staticClass:"datepicker-cell"},[_c('span',[_vm._v(_vm._s(day))])])}),0),_c('div',{staticClass:"datepicker-body",class:{'has-events':_vm.hasEvents}},_vm._l((_vm.weeksInThisMonth),function(week,index){return _c('b-datepicker-table-row',{key:index,attrs:{"selected-date":_vm.value,"day":_vm.focused.day,"week":week,"month":_vm.focused.month,"min-date":_vm.minDate,"max-date":_vm.maxDate,"disabled":_vm.disabled,"unselectable-dates":_vm.unselectableDates,"unselectable-days-of-week":_vm.unselectableDaysOfWeek,"selectable-dates":_vm.selectableDates,"events":_vm.eventsInThisWeek(week),"indicators":_vm.indicators,"date-creator":_vm.dateCreator,"nearby-month-days":_vm.nearbyMonthDays,"nearby-selectable-month-days":_vm.nearbySelectableMonthDays,"show-week-number":_vm.showWeekNumber,"week-number-clickable":_vm.weekNumberClickable,"first-day-of-week":_vm.firstDayOfWeek,"rules-for-first-week":_vm.rulesForFirstWeek,"range":_vm.range,"hovered-date-range":_vm.hoveredDateRange,"multiple":_vm.multiple},on:{"select":_vm.updateSelectedDate,"rangeHoverEndDate":_vm.setRangeHoverEndDate,"change-focus":_vm.changeFocus}})}),1)])};
|
|
2814
|
+
var __vue_staticRenderFns__$4 = [];
|
|
2815
|
+
|
|
2816
|
+
/* style */
|
|
2817
|
+
const __vue_inject_styles__$4 = undefined;
|
|
2818
|
+
/* scoped */
|
|
2819
|
+
const __vue_scope_id__$4 = undefined;
|
|
2820
|
+
/* module identifier */
|
|
2821
|
+
const __vue_module_identifier__$4 = undefined;
|
|
2822
|
+
/* functional template */
|
|
2823
|
+
const __vue_is_functional_template__$4 = false;
|
|
2824
|
+
/* style inject */
|
|
2825
|
+
|
|
2826
|
+
/* style inject SSR */
|
|
2827
|
+
|
|
2828
|
+
/* style inject shadow dom */
|
|
2829
|
+
|
|
2830
|
+
|
|
2831
|
+
|
|
2832
|
+
const __vue_component__$4 = /*#__PURE__*/normalizeComponent(
|
|
2833
|
+
{ render: __vue_render__$4, staticRenderFns: __vue_staticRenderFns__$4 },
|
|
2834
|
+
__vue_inject_styles__$4,
|
|
2835
|
+
__vue_script__$4,
|
|
2836
|
+
__vue_scope_id__$4,
|
|
2837
|
+
__vue_is_functional_template__$4,
|
|
2838
|
+
__vue_module_identifier__$4,
|
|
2839
|
+
false,
|
|
2840
|
+
undefined,
|
|
2841
|
+
undefined,
|
|
2842
|
+
undefined
|
|
2843
|
+
);
|
|
2844
|
+
|
|
2845
|
+
var DatepickerTable = __vue_component__$4;
|
|
2846
|
+
|
|
2847
|
+
//
|
|
2848
|
+
var script$3 = {
|
|
2849
|
+
name: 'BDatepickerMonth',
|
|
2850
|
+
props: {
|
|
2851
|
+
value: {
|
|
2852
|
+
type: [Date, Array]
|
|
2853
|
+
},
|
|
2854
|
+
monthNames: Array,
|
|
2855
|
+
events: Array,
|
|
2856
|
+
indicators: String,
|
|
2857
|
+
minDate: Date,
|
|
2858
|
+
maxDate: Date,
|
|
2859
|
+
focused: Object,
|
|
2860
|
+
disabled: Boolean,
|
|
2861
|
+
dateCreator: Function,
|
|
2862
|
+
unselectableDates: [Array, Function],
|
|
2863
|
+
unselectableDaysOfWeek: Array,
|
|
2864
|
+
selectableDates: [Array, Function],
|
|
2865
|
+
range: Boolean,
|
|
2866
|
+
multiple: Boolean
|
|
2867
|
+
},
|
|
2868
|
+
data: function data() {
|
|
2869
|
+
return {
|
|
2870
|
+
selectedBeginDate: undefined,
|
|
2871
|
+
selectedEndDate: undefined,
|
|
2872
|
+
hoveredEndDate: undefined,
|
|
2873
|
+
multipleSelectedDates: this.multiple && this.value ? this.value : []
|
|
2874
|
+
};
|
|
2875
|
+
},
|
|
2876
|
+
computed: {
|
|
2877
|
+
hasEvents: function hasEvents() {
|
|
2878
|
+
return this.events && this.events.length;
|
|
2879
|
+
},
|
|
2880
|
+
/*
|
|
2881
|
+
* Return array of all events in the specified month
|
|
2882
|
+
*/
|
|
2883
|
+
eventsInThisYear: function eventsInThisYear() {
|
|
2884
|
+
if (!this.events) return [];
|
|
2885
|
+
var yearEvents = [];
|
|
2886
|
+
for (var i = 0; i < this.events.length; i++) {
|
|
2887
|
+
var event = this.events[i];
|
|
2888
|
+
if (!event.hasOwnProperty('date')) {
|
|
2889
|
+
event = {
|
|
2890
|
+
date: event
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
if (!event.hasOwnProperty('type')) {
|
|
2894
|
+
event.type = 'is-primary';
|
|
2895
|
+
}
|
|
2896
|
+
if (event.date.getFullYear() === this.focused.year) {
|
|
2897
|
+
yearEvents.push(event);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
return yearEvents;
|
|
2901
|
+
},
|
|
2902
|
+
monthDates: function monthDates() {
|
|
2903
|
+
var year = this.focused.year;
|
|
2904
|
+
var months = [];
|
|
2905
|
+
for (var i = 0; i < 12; i++) {
|
|
2906
|
+
var d = new Date(year, i, 1);
|
|
2907
|
+
d.setHours(0, 0, 0, 0);
|
|
2908
|
+
months.push(d);
|
|
2909
|
+
}
|
|
2910
|
+
return months;
|
|
2911
|
+
},
|
|
2912
|
+
focusedMonth: function focusedMonth() {
|
|
2913
|
+
return this.focused.month;
|
|
2914
|
+
},
|
|
2915
|
+
hoveredDateRange: function hoveredDateRange() {
|
|
2916
|
+
if (!this.range) {
|
|
2917
|
+
return [];
|
|
2918
|
+
}
|
|
2919
|
+
if (!isNaN(this.selectedEndDate)) {
|
|
2920
|
+
return [];
|
|
2921
|
+
}
|
|
2922
|
+
if (this.hoveredEndDate < this.selectedBeginDate) {
|
|
2923
|
+
return [this.hoveredEndDate, this.selectedBeginDate].filter(isDefined);
|
|
2924
|
+
}
|
|
2925
|
+
return [this.selectedBeginDate, this.hoveredEndDate].filter(isDefined);
|
|
2926
|
+
}
|
|
2927
|
+
},
|
|
2928
|
+
watch: {
|
|
2929
|
+
focusedMonth: function focusedMonth(month) {
|
|
2930
|
+
var _this = this;
|
|
2931
|
+
var refName = "month-".concat(month);
|
|
2932
|
+
if (this.$refs[refName] && this.$refs[refName].length > 0) {
|
|
2933
|
+
this.$nextTick(function () {
|
|
2934
|
+
if (_this.$refs[refName][0]) {
|
|
2935
|
+
_this.$refs[refName][0].focus();
|
|
2936
|
+
}
|
|
2937
|
+
}); // $nextTick needed when year is changed
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
},
|
|
2941
|
+
methods: {
|
|
2942
|
+
selectMultipleDates: function selectMultipleDates(date) {
|
|
2943
|
+
var multipleSelect = this.multipleSelectedDates.filter(function (selectedDate) {
|
|
2944
|
+
return selectedDate.getDate() === date.getDate() && selectedDate.getFullYear() === date.getFullYear() && selectedDate.getMonth() === date.getMonth();
|
|
2945
|
+
});
|
|
2946
|
+
if (multipleSelect.length) {
|
|
2947
|
+
this.multipleSelectedDates = this.multipleSelectedDates.filter(function (selectedDate) {
|
|
2948
|
+
return selectedDate.getDate() !== date.getDate() || selectedDate.getFullYear() !== date.getFullYear() || selectedDate.getMonth() !== date.getMonth();
|
|
2949
|
+
});
|
|
2950
|
+
} else {
|
|
2951
|
+
this.multipleSelectedDates.push(date);
|
|
2952
|
+
}
|
|
2953
|
+
this.$emit('input', this.multipleSelectedDates);
|
|
2954
|
+
},
|
|
2955
|
+
selectableDate: function selectableDate(day) {
|
|
2956
|
+
var validity = [];
|
|
2957
|
+
if (this.minDate) {
|
|
2958
|
+
validity.push(day >= this.minDate);
|
|
2959
|
+
}
|
|
2960
|
+
if (this.maxDate) {
|
|
2961
|
+
validity.push(day <= this.maxDate);
|
|
2962
|
+
}
|
|
2963
|
+
validity.push(day.getFullYear() === this.focused.year);
|
|
2964
|
+
if (this.selectableDates) {
|
|
2965
|
+
if (typeof this.selectableDates === 'function') {
|
|
2966
|
+
if (this.selectableDates(day)) {
|
|
2967
|
+
return true;
|
|
2968
|
+
} else {
|
|
2969
|
+
validity.push(false);
|
|
2970
|
+
}
|
|
2971
|
+
} else {
|
|
2972
|
+
for (var i = 0; i < this.selectableDates.length; i++) {
|
|
2973
|
+
var enabledDate = this.selectableDates[i];
|
|
2974
|
+
if (day.getFullYear() === enabledDate.getFullYear() && day.getMonth() === enabledDate.getMonth()) {
|
|
2975
|
+
return true;
|
|
2976
|
+
} else {
|
|
2977
|
+
validity.push(false);
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2982
|
+
if (this.unselectableDates) {
|
|
2983
|
+
if (typeof this.unselectableDates === 'function') {
|
|
2984
|
+
validity.push(!this.unselectableDates(day));
|
|
2985
|
+
} else {
|
|
2986
|
+
for (var _i = 0; _i < this.unselectableDates.length; _i++) {
|
|
2987
|
+
var disabledDate = this.unselectableDates[_i];
|
|
2988
|
+
validity.push(day.getFullYear() !== disabledDate.getFullYear() || day.getMonth() !== disabledDate.getMonth());
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
if (this.unselectableDaysOfWeek) {
|
|
2993
|
+
for (var _i2 = 0; _i2 < this.unselectableDaysOfWeek.length; _i2++) {
|
|
2994
|
+
var dayOfWeek = this.unselectableDaysOfWeek[_i2];
|
|
2995
|
+
validity.push(day.getDay() !== dayOfWeek);
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
return validity.indexOf(false) < 0;
|
|
2999
|
+
},
|
|
3000
|
+
eventsDateMatch: function eventsDateMatch(day) {
|
|
3001
|
+
if (!this.eventsInThisYear.length) return false;
|
|
3002
|
+
var monthEvents = [];
|
|
3003
|
+
for (var i = 0; i < this.eventsInThisYear.length; i++) {
|
|
3004
|
+
if (this.eventsInThisYear[i].date.getMonth() === day.getMonth()) {
|
|
3005
|
+
monthEvents.push(this.events[i]);
|
|
3006
|
+
}
|
|
3007
|
+
}
|
|
3008
|
+
if (!monthEvents.length) {
|
|
3009
|
+
return false;
|
|
3010
|
+
}
|
|
3011
|
+
return monthEvents;
|
|
3012
|
+
},
|
|
3013
|
+
/*
|
|
3014
|
+
* Build classObject for cell using validations
|
|
3015
|
+
*/
|
|
3016
|
+
classObject: function classObject(day) {
|
|
3017
|
+
function dateMatch(dateOne, dateTwo, multiple) {
|
|
3018
|
+
// if either date is null or undefined, return false
|
|
3019
|
+
if (!dateOne || !dateTwo || multiple) {
|
|
3020
|
+
return false;
|
|
3021
|
+
}
|
|
3022
|
+
if (Array.isArray(dateTwo)) {
|
|
3023
|
+
return dateTwo.some(function (date) {
|
|
3024
|
+
return dateOne.getFullYear() === date.getFullYear() && dateOne.getMonth() === date.getMonth();
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
return dateOne.getFullYear() === dateTwo.getFullYear() && dateOne.getMonth() === dateTwo.getMonth();
|
|
3028
|
+
}
|
|
3029
|
+
function dateWithin(dateOne, dates, multiple) {
|
|
3030
|
+
if (!Array.isArray(dates) || multiple) {
|
|
3031
|
+
return false;
|
|
3032
|
+
}
|
|
3033
|
+
return dateOne > dates[0] && dateOne < dates[1];
|
|
3034
|
+
}
|
|
3035
|
+
function dateMultipleSelected(dateOne, dates, multiple) {
|
|
3036
|
+
if (!Array.isArray(dates) || !multiple) {
|
|
3037
|
+
return false;
|
|
3038
|
+
}
|
|
3039
|
+
return dates.some(function (date) {
|
|
3040
|
+
return dateOne.getDate() === date.getDate() && dateOne.getFullYear() === date.getFullYear() && dateOne.getMonth() === date.getMonth();
|
|
3041
|
+
});
|
|
3042
|
+
}
|
|
3043
|
+
return {
|
|
3044
|
+
'is-selected': dateMatch(day, this.value, this.multiple) || dateWithin(day, this.value, this.multiple) || dateMultipleSelected(day, this.multipleSelectedDates, this.multiple),
|
|
3045
|
+
'is-first-selected': dateMatch(day, Array.isArray(this.value) && this.value[0], this.multiple),
|
|
3046
|
+
'is-within-selected': dateWithin(day, this.value, this.multiple),
|
|
3047
|
+
'is-last-selected': dateMatch(day, Array.isArray(this.value) && this.value[1], this.multiple),
|
|
3048
|
+
'is-within-hovered-range': this.hoveredDateRange && this.hoveredDateRange.length === 2 && (dateMatch(day, this.hoveredDateRange) || dateWithin(day, this.hoveredDateRange)),
|
|
3049
|
+
'is-first-hovered': dateMatch(day, Array.isArray(this.hoveredDateRange) && this.hoveredDateRange[0]),
|
|
3050
|
+
'is-within-hovered': dateWithin(day, this.hoveredDateRange),
|
|
3051
|
+
'is-last-hovered': dateMatch(day, Array.isArray(this.hoveredDateRange) && this.hoveredDateRange[1]),
|
|
3052
|
+
'is-today': dateMatch(day, this.dateCreator()),
|
|
3053
|
+
'is-selectable': this.selectableDate(day) && !this.disabled,
|
|
3054
|
+
'is-unselectable': !this.selectableDate(day) || this.disabled
|
|
3055
|
+
};
|
|
3056
|
+
},
|
|
3057
|
+
manageKeydown: function manageKeydown(_ref, date) {
|
|
3058
|
+
var key = _ref.key;
|
|
3059
|
+
// https://developer.mozilla.org/fr/docs/Web/API/KeyboardEvent/key/Key_Values#Navigation_keys
|
|
3060
|
+
switch (key) {
|
|
3061
|
+
case ' ':
|
|
3062
|
+
case 'Space':
|
|
3063
|
+
case 'Spacebar':
|
|
3064
|
+
case 'Enter':
|
|
3065
|
+
{
|
|
3066
|
+
this.updateSelectedDate(date);
|
|
3067
|
+
break;
|
|
3068
|
+
}
|
|
3069
|
+
case 'ArrowLeft':
|
|
3070
|
+
case 'Left':
|
|
3071
|
+
{
|
|
3072
|
+
this.changeFocus(date, -1);
|
|
3073
|
+
break;
|
|
3074
|
+
}
|
|
3075
|
+
case 'ArrowRight':
|
|
3076
|
+
case 'Right':
|
|
3077
|
+
{
|
|
3078
|
+
this.changeFocus(date, 1);
|
|
3079
|
+
break;
|
|
3080
|
+
}
|
|
3081
|
+
case 'ArrowUp':
|
|
3082
|
+
case 'Up':
|
|
3083
|
+
{
|
|
3084
|
+
this.changeFocus(date, -3);
|
|
3085
|
+
break;
|
|
3086
|
+
}
|
|
3087
|
+
case 'ArrowDown':
|
|
3088
|
+
case 'Down':
|
|
3089
|
+
{
|
|
3090
|
+
this.changeFocus(date, 3);
|
|
3091
|
+
break;
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
},
|
|
3095
|
+
/*
|
|
3096
|
+
* Emit input event with selected date as payload for v-model in parent
|
|
3097
|
+
*/
|
|
3098
|
+
updateSelectedDate: function updateSelectedDate(date) {
|
|
3099
|
+
if (!this.range && !this.multiple) {
|
|
3100
|
+
this.emitChosenDate(date);
|
|
3101
|
+
} else if (this.range) {
|
|
3102
|
+
this.handleSelectRangeDate(date);
|
|
3103
|
+
} else if (this.multiple) {
|
|
3104
|
+
this.selectMultipleDates(date);
|
|
3105
|
+
}
|
|
3106
|
+
},
|
|
3107
|
+
/*
|
|
3108
|
+
* Emit select event with chosen date as payload
|
|
3109
|
+
*/
|
|
3110
|
+
emitChosenDate: function emitChosenDate(day) {
|
|
3111
|
+
if (this.disabled) return;
|
|
3112
|
+
if (!this.multiple) {
|
|
3113
|
+
if (this.selectableDate(day)) {
|
|
3114
|
+
this.$emit('input', day);
|
|
3115
|
+
}
|
|
3116
|
+
} else {
|
|
3117
|
+
this.selectMultipleDates(day);
|
|
3118
|
+
}
|
|
3119
|
+
},
|
|
3120
|
+
/*
|
|
3121
|
+
* If both begin and end dates are set, reset the end date and set the begin date.
|
|
3122
|
+
* If only begin date is selected, emit an array of the begin date and the new date.
|
|
3123
|
+
* If not set, only set the begin date.
|
|
3124
|
+
*/
|
|
3125
|
+
handleSelectRangeDate: function handleSelectRangeDate(date) {
|
|
3126
|
+
if (this.disabled) return;
|
|
3127
|
+
if (this.selectedBeginDate && this.selectedEndDate) {
|
|
3128
|
+
this.selectedBeginDate = date;
|
|
3129
|
+
this.selectedEndDate = undefined;
|
|
3130
|
+
this.$emit('range-start', date);
|
|
3131
|
+
} else if (this.selectedBeginDate && !this.selectedEndDate) {
|
|
3132
|
+
if (this.selectedBeginDate > date) {
|
|
3133
|
+
this.selectedEndDate = this.selectedBeginDate;
|
|
3134
|
+
this.selectedBeginDate = date;
|
|
3135
|
+
} else {
|
|
3136
|
+
this.selectedEndDate = date;
|
|
3137
|
+
}
|
|
3138
|
+
this.$emit('range-end', date);
|
|
3139
|
+
this.$emit('input', [this.selectedBeginDate, this.selectedEndDate]);
|
|
3140
|
+
} else {
|
|
3141
|
+
this.selectedBeginDate = date;
|
|
3142
|
+
this.$emit('range-start', date);
|
|
3143
|
+
}
|
|
3144
|
+
},
|
|
3145
|
+
setRangeHoverEndDate: function setRangeHoverEndDate(day) {
|
|
3146
|
+
if (this.range) {
|
|
3147
|
+
this.hoveredEndDate = day;
|
|
3148
|
+
}
|
|
3149
|
+
},
|
|
3150
|
+
changeFocus: function changeFocus(month, inc) {
|
|
3151
|
+
var nextMonth = month;
|
|
3152
|
+
nextMonth.setMonth(month.getMonth() + inc);
|
|
3153
|
+
this.$emit('change-focus', nextMonth);
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
|
|
3158
|
+
/* script */
|
|
3159
|
+
const __vue_script__$3 = script$3;
|
|
3160
|
+
|
|
3161
|
+
/* template */
|
|
3162
|
+
var __vue_render__$3 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',{staticClass:"datepicker-table"},[_c('div',{staticClass:"datepicker-body",class:{'has-events':_vm.hasEvents}},[_c('div',{staticClass:"datepicker-months"},[_vm._l((_vm.monthDates),function(date,index){return [(_vm.selectableDate(date) && !_vm.disabled)?_c('a',{key:index,ref:("month-" + (date.getMonth())),refInFor:true,staticClass:"datepicker-cell",class:[
|
|
3163
|
+
_vm.classObject(date),
|
|
3164
|
+
{'has-event': _vm.eventsDateMatch(date)},
|
|
3165
|
+
_vm.indicators
|
|
3166
|
+
],attrs:{"role":"button","href":"#","disabled":_vm.disabled,"tabindex":_vm.focused.month === date.getMonth() ? null : -1},on:{"click":function($event){$event.preventDefault();return _vm.updateSelectedDate(date)},"mouseenter":function($event){return _vm.setRangeHoverEndDate(date)},"keydown":function($event){$event.preventDefault();return _vm.manageKeydown($event, date)}}},[_vm._v(" "+_vm._s(_vm.monthNames[date.getMonth()])+" "),(_vm.eventsDateMatch(date))?_c('div',{staticClass:"events"},_vm._l((_vm.eventsDateMatch(date)),function(event,index){return _c('div',{key:index,staticClass:"event",class:event.type})}),0):_vm._e()]):_c('div',{key:index,staticClass:"datepicker-cell",class:_vm.classObject(date)},[_vm._v(" "+_vm._s(_vm.monthNames[date.getMonth()])+" ")])]})],2)])])};
|
|
3167
|
+
var __vue_staticRenderFns__$3 = [];
|
|
3168
|
+
|
|
3169
|
+
/* style */
|
|
3170
|
+
const __vue_inject_styles__$3 = undefined;
|
|
3171
|
+
/* scoped */
|
|
3172
|
+
const __vue_scope_id__$3 = undefined;
|
|
3173
|
+
/* module identifier */
|
|
3174
|
+
const __vue_module_identifier__$3 = undefined;
|
|
3175
|
+
/* functional template */
|
|
3176
|
+
const __vue_is_functional_template__$3 = false;
|
|
3177
|
+
/* style inject */
|
|
3178
|
+
|
|
3179
|
+
/* style inject SSR */
|
|
3180
|
+
|
|
3181
|
+
/* style inject shadow dom */
|
|
3182
|
+
|
|
3183
|
+
|
|
3184
|
+
|
|
3185
|
+
const __vue_component__$3 = /*#__PURE__*/normalizeComponent(
|
|
3186
|
+
{ render: __vue_render__$3, staticRenderFns: __vue_staticRenderFns__$3 },
|
|
3187
|
+
__vue_inject_styles__$3,
|
|
3188
|
+
__vue_script__$3,
|
|
3189
|
+
__vue_scope_id__$3,
|
|
3190
|
+
__vue_is_functional_template__$3,
|
|
3191
|
+
__vue_module_identifier__$3,
|
|
3192
|
+
false,
|
|
3193
|
+
undefined,
|
|
3194
|
+
undefined,
|
|
3195
|
+
undefined
|
|
3196
|
+
);
|
|
3197
|
+
|
|
3198
|
+
var DatepickerMonth = __vue_component__$3;
|
|
3199
|
+
|
|
3200
|
+
var defaultDateFormatter = function defaultDateFormatter(date, vm) {
|
|
3201
|
+
var targetDates = Array.isArray(date) ? date : [date];
|
|
3202
|
+
var dates = targetDates.map(function (date) {
|
|
3203
|
+
var d = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 12);
|
|
3204
|
+
return !vm.isTypeMonth ? vm.dtf.format(d) : vm.dtfMonth.format(d);
|
|
3205
|
+
});
|
|
3206
|
+
return !vm.multiple ? dates.join(' - ') : dates.join(', ');
|
|
3207
|
+
};
|
|
3208
|
+
var defaultDateParser = function defaultDateParser(date, vm) {
|
|
3209
|
+
if (vm.dtf.formatToParts && typeof vm.dtf.formatToParts === 'function') {
|
|
3210
|
+
var formatRegex = (vm.isTypeMonth ? vm.dtfMonth : vm.dtf).formatToParts(new Date(2000, 11, 25)).map(function (part) {
|
|
3211
|
+
if (part.type === 'literal') {
|
|
3212
|
+
return part.value;
|
|
3213
|
+
}
|
|
3214
|
+
return "((?!=<".concat(part.type, ">)\\d+)");
|
|
3215
|
+
}).join('');
|
|
3216
|
+
var dateGroups = matchWithGroups(formatRegex, date);
|
|
3217
|
+
|
|
3218
|
+
// We do a simple validation for the group.
|
|
3219
|
+
// If it is not valid, it will fallback to Date.parse below
|
|
3220
|
+
if (dateGroups.year && dateGroups.year.length === 4 && dateGroups.month && dateGroups.month <= 12) {
|
|
3221
|
+
if (vm.isTypeMonth) return new Date(dateGroups.year, dateGroups.month - 1);else if (dateGroups.day && dateGroups.day <= 31) {
|
|
3222
|
+
return new Date(dateGroups.year, dateGroups.month - 1, dateGroups.day, 12);
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
// Fallback if formatToParts is not supported or if we were not able to parse a valid date
|
|
3227
|
+
if (!vm.isTypeMonth) return new Date(Date.parse(date));
|
|
3228
|
+
if (date) {
|
|
3229
|
+
var s = date.split('/');
|
|
3230
|
+
var year = s[0].length === 4 ? s[0] : s[1];
|
|
3231
|
+
var month = s[0].length === 2 ? s[0] : s[1];
|
|
3232
|
+
if (year && month) {
|
|
3233
|
+
return new Date(parseInt(year, 10), parseInt(month - 1, 10), 1, 0, 0, 0, 0);
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
return null;
|
|
3237
|
+
};
|
|
3238
|
+
var script$2 = {
|
|
3239
|
+
name: 'BDatepicker',
|
|
3240
|
+
components: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, DatepickerTable.name, DatepickerTable), DatepickerMonth.name, DatepickerMonth), Input.name, Input), Field.name, Field), Select.name, Select), Icon.name, Icon), Dropdown.name, Dropdown), DropdownItem.name, DropdownItem),
|
|
3241
|
+
mixins: [FormElementMixin],
|
|
3242
|
+
inheritAttrs: false,
|
|
3243
|
+
provide: function provide() {
|
|
3244
|
+
return {
|
|
3245
|
+
$datepicker: this
|
|
3246
|
+
};
|
|
3247
|
+
},
|
|
3248
|
+
props: {
|
|
3249
|
+
value: {
|
|
3250
|
+
type: [Date, Array]
|
|
3251
|
+
},
|
|
3252
|
+
dayNames: {
|
|
3253
|
+
type: Array,
|
|
3254
|
+
default: function _default() {
|
|
3255
|
+
if (!Array.isArray(config.defaultDayNames)) {
|
|
3256
|
+
return undefined;
|
|
3257
|
+
}
|
|
3258
|
+
return config.defaultDayNames;
|
|
3259
|
+
}
|
|
3260
|
+
},
|
|
3261
|
+
monthNames: {
|
|
3262
|
+
type: Array,
|
|
3263
|
+
default: function _default() {
|
|
3264
|
+
if (!Array.isArray(config.defaultMonthNames)) {
|
|
3265
|
+
return undefined;
|
|
3266
|
+
}
|
|
3267
|
+
return config.defaultMonthNames;
|
|
3268
|
+
}
|
|
3269
|
+
},
|
|
3270
|
+
firstDayOfWeek: {
|
|
3271
|
+
type: Number,
|
|
3272
|
+
default: function _default() {
|
|
3273
|
+
if (typeof config.defaultFirstDayOfWeek === 'number') {
|
|
3274
|
+
return config.defaultFirstDayOfWeek;
|
|
3275
|
+
} else {
|
|
3276
|
+
return 0;
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
},
|
|
3280
|
+
inline: Boolean,
|
|
3281
|
+
minDate: Date,
|
|
3282
|
+
maxDate: Date,
|
|
3283
|
+
focusedDate: Date,
|
|
3284
|
+
placeholder: String,
|
|
3285
|
+
editable: Boolean,
|
|
3286
|
+
disabled: Boolean,
|
|
3287
|
+
horizontalTimePicker: Boolean,
|
|
3288
|
+
unselectableDates: [Array, Function],
|
|
3289
|
+
unselectableDaysOfWeek: {
|
|
3290
|
+
type: Array,
|
|
3291
|
+
default: function _default() {
|
|
3292
|
+
return config.defaultUnselectableDaysOfWeek;
|
|
3293
|
+
}
|
|
3294
|
+
},
|
|
3295
|
+
selectableDates: [Array, Function],
|
|
3296
|
+
dateFormatter: {
|
|
3297
|
+
type: Function,
|
|
3298
|
+
default: function _default(date, vm) {
|
|
3299
|
+
if (typeof config.defaultDateFormatter === 'function') {
|
|
3300
|
+
return config.defaultDateFormatter(date);
|
|
3301
|
+
} else {
|
|
3302
|
+
return defaultDateFormatter(date, vm);
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
},
|
|
3306
|
+
dateParser: {
|
|
3307
|
+
type: Function,
|
|
3308
|
+
default: function _default(date, vm) {
|
|
3309
|
+
if (typeof config.defaultDateParser === 'function') {
|
|
3310
|
+
return config.defaultDateParser(date);
|
|
3311
|
+
} else {
|
|
3312
|
+
return defaultDateParser(date, vm);
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
},
|
|
3316
|
+
dateCreator: {
|
|
3317
|
+
type: Function,
|
|
3318
|
+
default: function _default() {
|
|
3319
|
+
if (typeof config.defaultDateCreator === 'function') {
|
|
3320
|
+
return config.defaultDateCreator();
|
|
3321
|
+
} else {
|
|
3322
|
+
return new Date();
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
},
|
|
3326
|
+
mobileNative: {
|
|
3327
|
+
type: Boolean,
|
|
3328
|
+
default: function _default() {
|
|
3329
|
+
return config.defaultDatepickerMobileNative;
|
|
3330
|
+
}
|
|
3331
|
+
},
|
|
3332
|
+
position: String,
|
|
3333
|
+
iconRight: String,
|
|
3334
|
+
iconRightClickable: Boolean,
|
|
3335
|
+
events: Array,
|
|
3336
|
+
indicators: {
|
|
3337
|
+
type: String,
|
|
3338
|
+
default: 'dots'
|
|
3339
|
+
},
|
|
3340
|
+
openOnFocus: Boolean,
|
|
3341
|
+
iconPrev: {
|
|
3342
|
+
type: String,
|
|
3343
|
+
default: function _default() {
|
|
3344
|
+
return config.defaultIconPrev;
|
|
3345
|
+
}
|
|
3346
|
+
},
|
|
3347
|
+
iconNext: {
|
|
3348
|
+
type: String,
|
|
3349
|
+
default: function _default() {
|
|
3350
|
+
return config.defaultIconNext;
|
|
3351
|
+
}
|
|
3352
|
+
},
|
|
3353
|
+
yearsRange: {
|
|
3354
|
+
type: Array,
|
|
3355
|
+
default: function _default() {
|
|
3356
|
+
return config.defaultDatepickerYearsRange;
|
|
3357
|
+
}
|
|
3358
|
+
},
|
|
3359
|
+
type: {
|
|
3360
|
+
type: String,
|
|
3361
|
+
validator: function validator(value) {
|
|
3362
|
+
return ['month'].indexOf(value) >= 0;
|
|
3363
|
+
}
|
|
3364
|
+
},
|
|
3365
|
+
nearbyMonthDays: {
|
|
3366
|
+
type: Boolean,
|
|
3367
|
+
default: function _default() {
|
|
3368
|
+
return config.defaultDatepickerNearbyMonthDays;
|
|
3369
|
+
}
|
|
3370
|
+
},
|
|
3371
|
+
nearbySelectableMonthDays: {
|
|
3372
|
+
type: Boolean,
|
|
3373
|
+
default: function _default() {
|
|
3374
|
+
return config.defaultDatepickerNearbySelectableMonthDays;
|
|
3375
|
+
}
|
|
3376
|
+
},
|
|
3377
|
+
showWeekNumber: {
|
|
3378
|
+
type: Boolean,
|
|
3379
|
+
default: function _default() {
|
|
3380
|
+
return config.defaultDatepickerShowWeekNumber;
|
|
3381
|
+
}
|
|
3382
|
+
},
|
|
3383
|
+
weekNumberClickable: {
|
|
3384
|
+
type: Boolean,
|
|
3385
|
+
default: function _default() {
|
|
3386
|
+
return config.defaultDatepickerWeekNumberClickable;
|
|
3387
|
+
}
|
|
3388
|
+
},
|
|
3389
|
+
rulesForFirstWeek: {
|
|
3390
|
+
type: Number,
|
|
3391
|
+
default: function _default() {
|
|
3392
|
+
return 4;
|
|
3393
|
+
}
|
|
3394
|
+
},
|
|
3395
|
+
range: {
|
|
3396
|
+
type: Boolean,
|
|
3397
|
+
default: false
|
|
3398
|
+
},
|
|
3399
|
+
closeOnClick: {
|
|
3400
|
+
type: Boolean,
|
|
3401
|
+
default: true
|
|
3402
|
+
},
|
|
3403
|
+
multiple: {
|
|
3404
|
+
type: Boolean,
|
|
3405
|
+
default: false
|
|
3406
|
+
},
|
|
3407
|
+
mobileModal: {
|
|
3408
|
+
type: Boolean,
|
|
3409
|
+
default: function _default() {
|
|
3410
|
+
return config.defaultDatepickerMobileModal;
|
|
3411
|
+
}
|
|
3412
|
+
},
|
|
3413
|
+
focusable: {
|
|
3414
|
+
type: Boolean,
|
|
3415
|
+
default: true
|
|
3416
|
+
},
|
|
3417
|
+
trapFocus: {
|
|
3418
|
+
type: Boolean,
|
|
3419
|
+
default: function _default() {
|
|
3420
|
+
return config.defaultTrapFocus;
|
|
3421
|
+
}
|
|
3422
|
+
},
|
|
3423
|
+
appendToBody: Boolean,
|
|
3424
|
+
ariaNextLabel: String,
|
|
3425
|
+
ariaPreviousLabel: String
|
|
3426
|
+
},
|
|
3427
|
+
data: function data() {
|
|
3428
|
+
var focusedDate = (Array.isArray(this.value) ? this.value[0] : this.value) || this.focusedDate || this.dateCreator();
|
|
3429
|
+
if (!this.value && this.maxDate && this.maxDate.getFullYear() < focusedDate.getFullYear()) {
|
|
3430
|
+
focusedDate.setFullYear(this.maxDate.getFullYear());
|
|
3431
|
+
}
|
|
3432
|
+
return {
|
|
3433
|
+
dateSelected: this.value,
|
|
3434
|
+
focusedDateData: {
|
|
3435
|
+
day: focusedDate.getDate(),
|
|
3436
|
+
month: focusedDate.getMonth(),
|
|
3437
|
+
year: focusedDate.getFullYear()
|
|
3438
|
+
},
|
|
3439
|
+
_elementRef: 'input',
|
|
3440
|
+
_isDatepicker: true
|
|
3441
|
+
};
|
|
3442
|
+
},
|
|
3443
|
+
computed: {
|
|
3444
|
+
computedValue: {
|
|
3445
|
+
get: function get() {
|
|
3446
|
+
return this.dateSelected;
|
|
3447
|
+
},
|
|
3448
|
+
set: function set(value) {
|
|
3449
|
+
var _this = this;
|
|
3450
|
+
this.updateInternalState(value);
|
|
3451
|
+
if (!this.multiple) this.togglePicker(false);
|
|
3452
|
+
this.$emit('input', value);
|
|
3453
|
+
if (this.useHtml5Validation) {
|
|
3454
|
+
this.$nextTick(function () {
|
|
3455
|
+
_this.checkHtml5Validity();
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
},
|
|
3460
|
+
formattedValue: function formattedValue() {
|
|
3461
|
+
return this.formatValue(this.computedValue);
|
|
3462
|
+
},
|
|
3463
|
+
localeOptions: function localeOptions() {
|
|
3464
|
+
return new Intl.DateTimeFormat(this.locale, {
|
|
3465
|
+
year: 'numeric',
|
|
3466
|
+
month: 'numeric'
|
|
3467
|
+
}).resolvedOptions();
|
|
3468
|
+
},
|
|
3469
|
+
dtf: function dtf() {
|
|
3470
|
+
return new Intl.DateTimeFormat(this.locale);
|
|
3471
|
+
},
|
|
3472
|
+
dtfMonth: function dtfMonth() {
|
|
3473
|
+
return new Intl.DateTimeFormat(this.locale, {
|
|
3474
|
+
year: this.localeOptions.year || 'numeric',
|
|
3475
|
+
month: this.localeOptions.month || '2-digit'
|
|
3476
|
+
});
|
|
3477
|
+
},
|
|
3478
|
+
newMonthNames: function newMonthNames() {
|
|
3479
|
+
if (Array.isArray(this.monthNames)) {
|
|
3480
|
+
return this.monthNames;
|
|
3481
|
+
}
|
|
3482
|
+
return getMonthNames(this.locale);
|
|
3483
|
+
},
|
|
3484
|
+
newDayNames: function newDayNames() {
|
|
3485
|
+
if (Array.isArray(this.dayNames)) {
|
|
3486
|
+
return this.dayNames;
|
|
3487
|
+
}
|
|
3488
|
+
return getWeekdayNames(this.locale);
|
|
3489
|
+
},
|
|
3490
|
+
listOfMonths: function listOfMonths() {
|
|
3491
|
+
var minMonth = 0;
|
|
3492
|
+
var maxMonth = 12;
|
|
3493
|
+
if (this.minDate && this.focusedDateData.year === this.minDate.getFullYear()) {
|
|
3494
|
+
minMonth = this.minDate.getMonth();
|
|
3495
|
+
}
|
|
3496
|
+
if (this.maxDate && this.focusedDateData.year === this.maxDate.getFullYear()) {
|
|
3497
|
+
maxMonth = this.maxDate.getMonth();
|
|
3498
|
+
}
|
|
3499
|
+
return this.newMonthNames.map(function (name, index) {
|
|
3500
|
+
return {
|
|
3501
|
+
name: name,
|
|
3502
|
+
index: index,
|
|
3503
|
+
disabled: index < minMonth || index > maxMonth
|
|
3504
|
+
};
|
|
3505
|
+
});
|
|
3506
|
+
},
|
|
3507
|
+
/*
|
|
3508
|
+
* Returns an array of years for the year dropdown. If earliest/latest
|
|
3509
|
+
* dates are set by props, range of years will fall within those dates.
|
|
3510
|
+
*/
|
|
3511
|
+
listOfYears: function listOfYears() {
|
|
3512
|
+
var latestYear = this.focusedDateData.year + this.yearsRange[1];
|
|
3513
|
+
if (this.maxDate && this.maxDate.getFullYear() < latestYear) {
|
|
3514
|
+
latestYear = Math.max(this.maxDate.getFullYear(), this.focusedDateData.year);
|
|
3515
|
+
}
|
|
3516
|
+
var earliestYear = this.focusedDateData.year + this.yearsRange[0];
|
|
3517
|
+
if (this.minDate && this.minDate.getFullYear() > earliestYear) {
|
|
3518
|
+
earliestYear = Math.min(this.minDate.getFullYear(), this.focusedDateData.year);
|
|
3519
|
+
}
|
|
3520
|
+
var arrayOfYears = [];
|
|
3521
|
+
for (var i = earliestYear; i <= latestYear; i++) {
|
|
3522
|
+
arrayOfYears.push(i);
|
|
3523
|
+
}
|
|
3524
|
+
return arrayOfYears.reverse();
|
|
3525
|
+
},
|
|
3526
|
+
showPrev: function showPrev() {
|
|
3527
|
+
if (!this.minDate) return false;
|
|
3528
|
+
if (this.isTypeMonth) {
|
|
3529
|
+
return this.focusedDateData.year <= this.minDate.getFullYear();
|
|
3530
|
+
}
|
|
3531
|
+
var dateToCheck = new Date(this.focusedDateData.year, this.focusedDateData.month);
|
|
3532
|
+
var date = new Date(this.minDate.getFullYear(), this.minDate.getMonth());
|
|
3533
|
+
return dateToCheck <= date;
|
|
3534
|
+
},
|
|
3535
|
+
showNext: function showNext() {
|
|
3536
|
+
if (!this.maxDate) return false;
|
|
3537
|
+
if (this.isTypeMonth) {
|
|
3538
|
+
return this.focusedDateData.year >= this.maxDate.getFullYear();
|
|
3539
|
+
}
|
|
3540
|
+
var dateToCheck = new Date(this.focusedDateData.year, this.focusedDateData.month);
|
|
3541
|
+
var date = new Date(this.maxDate.getFullYear(), this.maxDate.getMonth());
|
|
3542
|
+
return dateToCheck >= date;
|
|
3543
|
+
},
|
|
3544
|
+
isMobile: function isMobile$1() {
|
|
3545
|
+
return this.mobileNative && isMobile.any();
|
|
3546
|
+
},
|
|
3547
|
+
isTypeMonth: function isTypeMonth() {
|
|
3548
|
+
return this.type === 'month';
|
|
3549
|
+
},
|
|
3550
|
+
ariaRole: function ariaRole() {
|
|
3551
|
+
if (!this.inline) {
|
|
3552
|
+
return 'dialog';
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
},
|
|
3556
|
+
watch: {
|
|
3557
|
+
/**
|
|
3558
|
+
* When v-model is changed:
|
|
3559
|
+
* 1. Update internal value.
|
|
3560
|
+
* 2. If it's invalid, validate again.
|
|
3561
|
+
*/
|
|
3562
|
+
value: function value(_value) {
|
|
3563
|
+
this.updateInternalState(_value);
|
|
3564
|
+
if (!this.multiple) this.togglePicker(false);
|
|
3565
|
+
},
|
|
3566
|
+
focusedDate: function focusedDate(value) {
|
|
3567
|
+
if (value) {
|
|
3568
|
+
this.focusedDateData = {
|
|
3569
|
+
day: value.getDate(),
|
|
3570
|
+
month: value.getMonth(),
|
|
3571
|
+
year: value.getFullYear()
|
|
3572
|
+
};
|
|
3573
|
+
}
|
|
3574
|
+
},
|
|
3575
|
+
/*
|
|
3576
|
+
* Emit input event on month and/or year change
|
|
3577
|
+
*/
|
|
3578
|
+
'focusedDateData.month': function focusedDateDataMonth(value) {
|
|
3579
|
+
this.$emit('change-month', value);
|
|
3580
|
+
},
|
|
3581
|
+
'focusedDateData.year': function focusedDateDataYear(value) {
|
|
3582
|
+
this.$emit('change-year', value);
|
|
3583
|
+
}
|
|
3584
|
+
},
|
|
3585
|
+
methods: {
|
|
3586
|
+
/*
|
|
3587
|
+
* Parse string into date
|
|
3588
|
+
*/
|
|
3589
|
+
onChange: function onChange(value) {
|
|
3590
|
+
var date = this.dateParser(value, this);
|
|
3591
|
+
if (date && (!isNaN(date) || Array.isArray(date) && date.length === 2 && !isNaN(date[0]) && !isNaN(date[1]))) {
|
|
3592
|
+
this.computedValue = date;
|
|
3593
|
+
} else {
|
|
3594
|
+
// Force refresh input value when not valid date
|
|
3595
|
+
this.computedValue = null;
|
|
3596
|
+
if (this.$refs.input) {
|
|
3597
|
+
this.$refs.input.newValue = this.computedValue;
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
},
|
|
3601
|
+
/*
|
|
3602
|
+
* Format date into string
|
|
3603
|
+
*/
|
|
3604
|
+
formatValue: function formatValue(value) {
|
|
3605
|
+
if (Array.isArray(value)) {
|
|
3606
|
+
var isArrayWithValidDates = Array.isArray(value) && value.every(function (v) {
|
|
3607
|
+
return !isNaN(v);
|
|
3608
|
+
});
|
|
3609
|
+
return isArrayWithValidDates ? this.dateFormatter(_toConsumableArray(value), this) : null;
|
|
3610
|
+
}
|
|
3611
|
+
return value && !isNaN(value) ? this.dateFormatter(value, this) : null;
|
|
3612
|
+
},
|
|
3613
|
+
/*
|
|
3614
|
+
* Either decrement month by 1 if not January or decrement year by 1
|
|
3615
|
+
* and set month to 11 (December) or decrement year when 'month'
|
|
3616
|
+
*/
|
|
3617
|
+
prev: function prev() {
|
|
3618
|
+
if (this.disabled) return;
|
|
3619
|
+
if (this.isTypeMonth) {
|
|
3620
|
+
this.focusedDateData.year -= 1;
|
|
3621
|
+
} else {
|
|
3622
|
+
if (this.focusedDateData.month > 0) {
|
|
3623
|
+
this.focusedDateData.month -= 1;
|
|
3624
|
+
} else {
|
|
3625
|
+
this.focusedDateData.month = 11;
|
|
3626
|
+
this.focusedDateData.year -= 1;
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
},
|
|
3630
|
+
/*
|
|
3631
|
+
* Either increment month by 1 if not December or increment year by 1
|
|
3632
|
+
* and set month to 0 (January) or increment year when 'month'
|
|
3633
|
+
*/
|
|
3634
|
+
next: function next() {
|
|
3635
|
+
if (this.disabled) return;
|
|
3636
|
+
if (this.isTypeMonth) {
|
|
3637
|
+
this.focusedDateData.year += 1;
|
|
3638
|
+
} else {
|
|
3639
|
+
if (this.focusedDateData.month < 11) {
|
|
3640
|
+
this.focusedDateData.month += 1;
|
|
3641
|
+
} else {
|
|
3642
|
+
this.focusedDateData.month = 0;
|
|
3643
|
+
this.focusedDateData.year += 1;
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
},
|
|
3647
|
+
formatNative: function formatNative(value) {
|
|
3648
|
+
return this.isTypeMonth ? this.formatYYYYMM(value) : this.formatYYYYMMDD(value);
|
|
3649
|
+
},
|
|
3650
|
+
/*
|
|
3651
|
+
* Format date into string 'YYYY-MM-DD'
|
|
3652
|
+
*/
|
|
3653
|
+
formatYYYYMMDD: function formatYYYYMMDD(value) {
|
|
3654
|
+
var date = new Date(value);
|
|
3655
|
+
if (value && !isNaN(date)) {
|
|
3656
|
+
var year = date.getFullYear();
|
|
3657
|
+
var month = date.getMonth() + 1;
|
|
3658
|
+
var day = date.getDate();
|
|
3659
|
+
return year + '-' + ((month < 10 ? '0' : '') + month) + '-' + ((day < 10 ? '0' : '') + day);
|
|
3660
|
+
}
|
|
3661
|
+
return '';
|
|
3662
|
+
},
|
|
3663
|
+
/*
|
|
3664
|
+
* Format date into string 'YYYY-MM'
|
|
3665
|
+
*/
|
|
3666
|
+
formatYYYYMM: function formatYYYYMM(value) {
|
|
3667
|
+
var date = new Date(value);
|
|
3668
|
+
if (value && !isNaN(date)) {
|
|
3669
|
+
var year = date.getFullYear();
|
|
3670
|
+
var month = date.getMonth() + 1;
|
|
3671
|
+
return year + '-' + ((month < 10 ? '0' : '') + month);
|
|
3672
|
+
}
|
|
3673
|
+
return '';
|
|
3674
|
+
},
|
|
3675
|
+
/*
|
|
3676
|
+
* Parse date from string
|
|
3677
|
+
*/
|
|
3678
|
+
onChangeNativePicker: function onChangeNativePicker(event) {
|
|
3679
|
+
var date = event.target.value;
|
|
3680
|
+
var s = date ? date.split('-') : [];
|
|
3681
|
+
if (s.length === 3) {
|
|
3682
|
+
var year = parseInt(s[0], 10);
|
|
3683
|
+
var month = parseInt(s[1]) - 1;
|
|
3684
|
+
var day = parseInt(s[2]);
|
|
3685
|
+
this.computedValue = new Date(year, month, day);
|
|
3686
|
+
} else {
|
|
3687
|
+
this.computedValue = null;
|
|
3688
|
+
}
|
|
3689
|
+
},
|
|
3690
|
+
updateInternalState: function updateInternalState(value) {
|
|
3691
|
+
if (this.dateSelected === value) return;
|
|
3692
|
+
var isArray = Array.isArray(value);
|
|
3693
|
+
var currentDate = isArray ? !value.length ? this.dateCreator() : value[value.length - 1] : !value ? this.dateCreator() : value;
|
|
3694
|
+
if (!isArray || isArray && this.dateSelected && value.length > this.dateSelected.length) {
|
|
3695
|
+
this.focusedDateData = {
|
|
3696
|
+
day: currentDate.getDate(),
|
|
3697
|
+
month: currentDate.getMonth(),
|
|
3698
|
+
year: currentDate.getFullYear()
|
|
3699
|
+
};
|
|
3700
|
+
}
|
|
3701
|
+
this.dateSelected = value;
|
|
3702
|
+
},
|
|
3703
|
+
/*
|
|
3704
|
+
* Toggle datepicker
|
|
3705
|
+
*/
|
|
3706
|
+
togglePicker: function togglePicker(active) {
|
|
3707
|
+
if (this.$refs.dropdown) {
|
|
3708
|
+
var isActive = typeof active === 'boolean' ? active : !this.$refs.dropdown.isActive;
|
|
3709
|
+
if (isActive) {
|
|
3710
|
+
this.$refs.dropdown.isActive = isActive;
|
|
3711
|
+
} else if (this.closeOnClick) {
|
|
3712
|
+
this.$refs.dropdown.isActive = isActive;
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
},
|
|
3716
|
+
/*
|
|
3717
|
+
* Call default onFocus method and show datepicker
|
|
3718
|
+
*/
|
|
3719
|
+
handleOnFocus: function handleOnFocus(event) {
|
|
3720
|
+
this.onFocus(event);
|
|
3721
|
+
if (this.openOnFocus) {
|
|
3722
|
+
this.togglePicker(true);
|
|
3723
|
+
}
|
|
3724
|
+
},
|
|
3725
|
+
/*
|
|
3726
|
+
* Toggle dropdown
|
|
3727
|
+
*/
|
|
3728
|
+
toggle: function toggle() {
|
|
3729
|
+
if (this.mobileNative && this.isMobile) {
|
|
3730
|
+
var input = this.$refs.input.$refs.input;
|
|
3731
|
+
input.focus();
|
|
3732
|
+
input.click();
|
|
3733
|
+
return;
|
|
3734
|
+
}
|
|
3735
|
+
this.$refs.dropdown.toggle();
|
|
3736
|
+
},
|
|
3737
|
+
/*
|
|
3738
|
+
* Avoid dropdown toggle when is already visible
|
|
3739
|
+
*/
|
|
3740
|
+
onInputClick: function onInputClick(event) {
|
|
3741
|
+
if (this.$refs.dropdown.isActive) {
|
|
3742
|
+
event.stopPropagation();
|
|
3743
|
+
}
|
|
3744
|
+
},
|
|
3745
|
+
/**
|
|
3746
|
+
* Keypress event that is bound to the document.
|
|
3747
|
+
*/
|
|
3748
|
+
keyPress: function keyPress(_ref) {
|
|
3749
|
+
var key = _ref.key;
|
|
3750
|
+
if (this.$refs.dropdown && this.$refs.dropdown.isActive && (key === 'Escape' || key === 'Esc')) {
|
|
3751
|
+
this.togglePicker(false);
|
|
3752
|
+
}
|
|
3753
|
+
},
|
|
3754
|
+
/**
|
|
3755
|
+
* Emit 'blur' event on dropdown is not active (closed)
|
|
3756
|
+
*/
|
|
3757
|
+
onActiveChange: function onActiveChange(value) {
|
|
3758
|
+
if (!value) {
|
|
3759
|
+
this.onBlur();
|
|
3760
|
+
}
|
|
3761
|
+
/*
|
|
3762
|
+
* Emit 'active-change' when on dropdown active state change
|
|
3763
|
+
*/
|
|
3764
|
+
this.$emit('active-change', value);
|
|
3765
|
+
},
|
|
3766
|
+
changeFocus: function changeFocus(day) {
|
|
3767
|
+
this.focusedDateData = {
|
|
3768
|
+
day: day.getDate(),
|
|
3769
|
+
month: day.getMonth(),
|
|
3770
|
+
year: day.getFullYear()
|
|
3771
|
+
};
|
|
3772
|
+
}
|
|
3773
|
+
},
|
|
3774
|
+
created: function created() {
|
|
3775
|
+
if (typeof window !== 'undefined') {
|
|
3776
|
+
document.addEventListener('keyup', this.keyPress);
|
|
3777
|
+
}
|
|
3778
|
+
},
|
|
3779
|
+
beforeDestroy: function beforeDestroy() {
|
|
3780
|
+
if (typeof window !== 'undefined') {
|
|
3781
|
+
document.removeEventListener('keyup', this.keyPress);
|
|
3782
|
+
}
|
|
3783
|
+
}
|
|
3784
|
+
};
|
|
3785
|
+
|
|
3786
|
+
/* script */
|
|
3787
|
+
const __vue_script__$2 = script$2;
|
|
3788
|
+
|
|
3789
|
+
/* template */
|
|
3790
|
+
var __vue_render__$2 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"datepicker control",class:[_vm.size, {'is-expanded': _vm.expanded}]},[(!_vm.isMobile || _vm.inline)?_c('b-dropdown',{ref:"dropdown",attrs:{"position":_vm.position,"disabled":_vm.disabled,"inline":_vm.inline,"mobile-modal":_vm.mobileModal,"trap-focus":_vm.trapFocus,"aria-role":_vm.ariaRole,"append-to-body":_vm.appendToBody,"append-to-body-copy-parent":"","trigger-tabindex":-1},on:{"active-change":_vm.onActiveChange},scopedSlots:_vm._u([(!_vm.inline)?{key:"trigger",fn:function(props){return [_vm._t("trigger",[_c('b-input',_vm._b({ref:"input",attrs:{"autocomplete":"off","value":_vm.formattedValue,"placeholder":_vm.placeholder,"size":_vm.size,"icon":_vm.icon,"icon-right":_vm.iconRight,"icon-right-clickable":_vm.iconRightClickable,"icon-pack":_vm.iconPack,"rounded":_vm.rounded,"loading":_vm.loading,"disabled":_vm.disabled,"readonly":!_vm.editable,"use-html5-validation":false},on:{"icon-right-click":function($event){return _vm.$emit('icon-right-click', $event)},"focus":_vm.handleOnFocus},nativeOn:{"click":function($event){return _vm.onInputClick($event)},"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.togglePicker(true)},"change":function($event){return _vm.onChange($event.target.value)}}},'b-input',_vm.$attrs,false))],null,props)]}}:null],null,true)},[_c('b-dropdown-item',{class:{'dropdown-horizontal-timepicker': _vm.horizontalTimePicker},attrs:{"disabled":_vm.disabled,"focusable":_vm.focusable,"custom":""}},[_c('div',[_c('header',{staticClass:"datepicker-header"},[(_vm.$slots.header !== undefined && _vm.$slots.header.length)?[_vm._t("header")]:_c('div',{staticClass:"pagination field is-centered",class:_vm.size},[_c('a',{directives:[{name:"show",rawName:"v-show",value:(!_vm.showPrev && !_vm.disabled),expression:"!showPrev && !disabled"}],staticClass:"pagination-previous",attrs:{"role":"button","href":"#","disabled":_vm.disabled,"aria-label":_vm.ariaPreviousLabel},on:{"click":function($event){$event.preventDefault();return _vm.prev($event)},"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }$event.preventDefault();return _vm.prev($event)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }$event.preventDefault();return _vm.prev($event)}]}},[_c('b-icon',{attrs:{"icon":_vm.iconPrev,"pack":_vm.iconPack,"both":"","type":"is-primary is-clickable"}})],1),_c('a',{directives:[{name:"show",rawName:"v-show",value:(!_vm.showNext && !_vm.disabled),expression:"!showNext && !disabled"}],staticClass:"pagination-next",attrs:{"role":"button","href":"#","disabled":_vm.disabled,"aria-label":_vm.ariaNextLabel},on:{"click":function($event){$event.preventDefault();return _vm.next($event)},"keydown":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }$event.preventDefault();return _vm.next($event)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }$event.preventDefault();return _vm.next($event)}]}},[_c('b-icon',{attrs:{"icon":_vm.iconNext,"pack":_vm.iconPack,"both":"","type":"is-primary is-clickable"}})],1),_c('div',{staticClass:"pagination-list"},[_c('b-field',[(!_vm.isTypeMonth)?_c('b-select',{attrs:{"disabled":_vm.disabled,"size":_vm.size},model:{value:(_vm.focusedDateData.month),callback:function ($$v) {_vm.$set(_vm.focusedDateData, "month", $$v);},expression:"focusedDateData.month"}},_vm._l((_vm.listOfMonths),function(month){return _c('option',{key:month.name,attrs:{"disabled":month.disabled},domProps:{"value":month.index}},[_vm._v(" "+_vm._s(month.name)+" ")])}),0):_vm._e(),_c('b-select',{attrs:{"disabled":_vm.disabled,"size":_vm.size},model:{value:(_vm.focusedDateData.year),callback:function ($$v) {_vm.$set(_vm.focusedDateData, "year", $$v);},expression:"focusedDateData.year"}},_vm._l((_vm.listOfYears),function(year){return _c('option',{key:year,domProps:{"value":year}},[_vm._v(" "+_vm._s(year)+" ")])}),0)],1)],1)])],2),(!_vm.isTypeMonth)?_c('div',{staticClass:"datepicker-content",class:{'content-horizontal-timepicker': _vm.horizontalTimePicker}},[_c('b-datepicker-table',{attrs:{"day-names":_vm.newDayNames,"month-names":_vm.newMonthNames,"first-day-of-week":_vm.firstDayOfWeek,"rules-for-first-week":_vm.rulesForFirstWeek,"min-date":_vm.minDate,"max-date":_vm.maxDate,"focused":_vm.focusedDateData,"disabled":_vm.disabled,"unselectable-dates":_vm.unselectableDates,"unselectable-days-of-week":_vm.unselectableDaysOfWeek,"selectable-dates":_vm.selectableDates,"events":_vm.events,"indicators":_vm.indicators,"date-creator":_vm.dateCreator,"type-month":_vm.isTypeMonth,"nearby-month-days":_vm.nearbyMonthDays,"nearby-selectable-month-days":_vm.nearbySelectableMonthDays,"show-week-number":_vm.showWeekNumber,"week-number-clickable":_vm.weekNumberClickable,"range":_vm.range,"multiple":_vm.multiple},on:{"range-start":function (date) { return _vm.$emit('range-start', date); },"range-end":function (date) { return _vm.$emit('range-end', date); },"close":function($event){return _vm.togglePicker(false)},"update:focused":function($event){_vm.focusedDateData = $event;}},model:{value:(_vm.computedValue),callback:function ($$v) {_vm.computedValue=$$v;},expression:"computedValue"}})],1):_c('div',[_c('b-datepicker-month',{attrs:{"month-names":_vm.newMonthNames,"min-date":_vm.minDate,"max-date":_vm.maxDate,"focused":_vm.focusedDateData,"disabled":_vm.disabled,"unselectable-dates":_vm.unselectableDates,"unselectable-days-of-week":_vm.unselectableDaysOfWeek,"selectable-dates":_vm.selectableDates,"events":_vm.events,"indicators":_vm.indicators,"date-creator":_vm.dateCreator,"range":_vm.range,"multiple":_vm.multiple},on:{"range-start":function (date) { return _vm.$emit('range-start', date); },"range-end":function (date) { return _vm.$emit('range-end', date); },"close":function($event){return _vm.togglePicker(false)},"change-focus":_vm.changeFocus,"update:focused":function($event){_vm.focusedDateData = $event;}},model:{value:(_vm.computedValue),callback:function ($$v) {_vm.computedValue=$$v;},expression:"computedValue"}})],1)]),(_vm.$slots.default !== undefined && _vm.$slots.default.length)?_c('footer',{staticClass:"datepicker-footer",class:{'footer-horizontal-timepicker': _vm.horizontalTimePicker}},[_vm._t("default")],2):_vm._e()])],1):_c('b-input',_vm._b({ref:"input",attrs:{"type":!_vm.isTypeMonth ? 'date' : 'month',"autocomplete":"off","value":_vm.formatNative(_vm.computedValue),"placeholder":_vm.placeholder,"size":_vm.size,"icon":_vm.icon,"icon-pack":_vm.iconPack,"rounded":_vm.rounded,"loading":_vm.loading,"max":_vm.formatNative(_vm.maxDate),"min":_vm.formatNative(_vm.minDate),"disabled":_vm.disabled,"readonly":false,"use-html5-validation":false},on:{"focus":_vm.onFocus,"blur":_vm.onBlur},nativeOn:{"change":function($event){return _vm.onChangeNativePicker($event)}}},'b-input',_vm.$attrs,false))],1)};
|
|
3791
|
+
var __vue_staticRenderFns__$2 = [];
|
|
3792
|
+
|
|
3793
|
+
/* style */
|
|
3794
|
+
const __vue_inject_styles__$2 = undefined;
|
|
3795
|
+
/* scoped */
|
|
3796
|
+
const __vue_scope_id__$2 = undefined;
|
|
3797
|
+
/* module identifier */
|
|
3798
|
+
const __vue_module_identifier__$2 = undefined;
|
|
3799
|
+
/* functional template */
|
|
3800
|
+
const __vue_is_functional_template__$2 = false;
|
|
3801
|
+
/* style inject */
|
|
3802
|
+
|
|
3803
|
+
/* style inject SSR */
|
|
3804
|
+
|
|
3805
|
+
/* style inject shadow dom */
|
|
3806
|
+
|
|
3807
|
+
|
|
3808
|
+
|
|
3809
|
+
const __vue_component__$2 = /*#__PURE__*/normalizeComponent(
|
|
3810
|
+
{ render: __vue_render__$2, staticRenderFns: __vue_staticRenderFns__$2 },
|
|
3811
|
+
__vue_inject_styles__$2,
|
|
3812
|
+
__vue_script__$2,
|
|
3813
|
+
__vue_scope_id__$2,
|
|
3814
|
+
__vue_is_functional_template__$2,
|
|
3815
|
+
__vue_module_identifier__$2,
|
|
3816
|
+
false,
|
|
3817
|
+
undefined,
|
|
3818
|
+
undefined,
|
|
3819
|
+
undefined
|
|
3820
|
+
);
|
|
3821
|
+
|
|
3822
|
+
var Datepicker = __vue_component__$2;
|
|
3823
|
+
|
|
3824
|
+
var AM$1 = 'AM';
|
|
3825
|
+
var PM$1 = 'PM';
|
|
3826
|
+
var HOUR_FORMAT_24 = '24';
|
|
3827
|
+
var HOUR_FORMAT_12 = '12';
|
|
3828
|
+
var defaultTimeFormatter = function defaultTimeFormatter(date, vm) {
|
|
3829
|
+
return vm.dtf.format(date);
|
|
3830
|
+
};
|
|
3831
|
+
var defaultTimeParser = function defaultTimeParser(timeString, vm) {
|
|
3832
|
+
if (timeString) {
|
|
3833
|
+
var d = null;
|
|
3834
|
+
if (vm.computedValue && !isNaN(vm.computedValue)) {
|
|
3835
|
+
d = new Date(vm.computedValue);
|
|
3836
|
+
} else {
|
|
3837
|
+
d = vm.timeCreator();
|
|
3838
|
+
d.setMilliseconds(0);
|
|
3839
|
+
}
|
|
3840
|
+
if (vm.dtf.formatToParts && typeof vm.dtf.formatToParts === 'function') {
|
|
3841
|
+
var formatRegex = vm.dtf.formatToParts(d).map(function (part) {
|
|
3842
|
+
if (part.type === 'literal') {
|
|
3843
|
+
return part.value.replace(/ /g, '\\s?');
|
|
3844
|
+
} else if (part.type === 'dayPeriod') {
|
|
3845
|
+
return "((?!=<".concat(part.type, ">)(").concat(vm.amString, "|").concat(vm.pmString, "|").concat(AM$1, "|").concat(PM$1, "|").concat(AM$1.toLowerCase(), "|").concat(PM$1.toLowerCase(), ")?)");
|
|
3846
|
+
}
|
|
3847
|
+
return "((?!=<".concat(part.type, ">)\\d+)");
|
|
3848
|
+
}).join('');
|
|
3849
|
+
var timeGroups = matchWithGroups(formatRegex, timeString);
|
|
3850
|
+
|
|
3851
|
+
// We do a simple validation for the group.
|
|
3852
|
+
// If it is not valid, it will fallback to Date.parse below
|
|
3853
|
+
timeGroups.hour = timeGroups.hour ? parseInt(timeGroups.hour, 10) : null;
|
|
3854
|
+
timeGroups.minute = timeGroups.minute ? parseInt(timeGroups.minute, 10) : null;
|
|
3855
|
+
timeGroups.second = timeGroups.second ? parseInt(timeGroups.second, 10) : null;
|
|
3856
|
+
if (timeGroups.hour && timeGroups.hour >= 0 && timeGroups.hour < 24 && timeGroups.minute && timeGroups.minute >= 0 && timeGroups.minute < 59) {
|
|
3857
|
+
if (timeGroups.dayPeriod && (timeGroups.dayPeriod.toLowerCase() === vm.pmString.toLowerCase() || timeGroups.dayPeriod.toLowerCase() === PM$1.toLowerCase()) && timeGroups.hour < 12) {
|
|
3858
|
+
timeGroups.hour += 12;
|
|
3859
|
+
}
|
|
3860
|
+
d.setHours(timeGroups.hour);
|
|
3861
|
+
d.setMinutes(timeGroups.minute);
|
|
3862
|
+
d.setSeconds(timeGroups.second || 0);
|
|
3863
|
+
return d;
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
// Fallback if formatToParts is not supported or if we were not able to parse a valid date
|
|
3868
|
+
var am = false;
|
|
3869
|
+
if (vm.hourFormat === HOUR_FORMAT_12) {
|
|
3870
|
+
var dateString12 = timeString.split(' ');
|
|
3871
|
+
timeString = dateString12[0];
|
|
3872
|
+
am = dateString12[1] === vm.amString || dateString12[1] === AM$1;
|
|
3873
|
+
}
|
|
3874
|
+
var time = timeString.split(':');
|
|
3875
|
+
var hours = parseInt(time[0], 10);
|
|
3876
|
+
var minutes = parseInt(time[1], 10);
|
|
3877
|
+
var seconds = vm.enableSeconds ? parseInt(time[2], 10) : 0;
|
|
3878
|
+
if (isNaN(hours) || hours < 0 || hours > 23 || vm.hourFormat === HOUR_FORMAT_12 && (hours < 1 || hours > 12) || isNaN(minutes) || minutes < 0 || minutes > 59) {
|
|
3879
|
+
return null;
|
|
3880
|
+
}
|
|
3881
|
+
d.setSeconds(seconds);
|
|
3882
|
+
d.setMinutes(minutes);
|
|
3883
|
+
if (vm.hourFormat === HOUR_FORMAT_12) {
|
|
3884
|
+
if (am && hours === 12) {
|
|
3885
|
+
hours = 0;
|
|
3886
|
+
} else if (!am && hours !== 12) {
|
|
3887
|
+
hours += 12;
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
d.setHours(hours);
|
|
3891
|
+
return new Date(d.getTime());
|
|
3892
|
+
}
|
|
3893
|
+
return null;
|
|
3894
|
+
};
|
|
3895
|
+
var TimepickerMixin = {
|
|
3896
|
+
mixins: [FormElementMixin],
|
|
3897
|
+
inheritAttrs: false,
|
|
3898
|
+
props: {
|
|
3899
|
+
value: Date,
|
|
3900
|
+
inline: Boolean,
|
|
3901
|
+
minTime: Date,
|
|
3902
|
+
maxTime: Date,
|
|
3903
|
+
placeholder: String,
|
|
3904
|
+
editable: Boolean,
|
|
3905
|
+
disabled: Boolean,
|
|
3906
|
+
hourFormat: {
|
|
3907
|
+
type: String,
|
|
3908
|
+
validator: function validator(value) {
|
|
3909
|
+
return value === HOUR_FORMAT_24 || value === HOUR_FORMAT_12;
|
|
3910
|
+
}
|
|
3911
|
+
},
|
|
3912
|
+
incrementHours: {
|
|
3913
|
+
type: Number,
|
|
3914
|
+
default: 1
|
|
3915
|
+
},
|
|
3916
|
+
incrementMinutes: {
|
|
3917
|
+
type: Number,
|
|
3918
|
+
default: 1
|
|
3919
|
+
},
|
|
3920
|
+
incrementSeconds: {
|
|
3921
|
+
type: Number,
|
|
3922
|
+
default: 1
|
|
3923
|
+
},
|
|
3924
|
+
timeFormatter: {
|
|
3925
|
+
type: Function,
|
|
3926
|
+
default: function _default(date, vm) {
|
|
3927
|
+
if (typeof config.defaultTimeFormatter === 'function') {
|
|
3928
|
+
return config.defaultTimeFormatter(date);
|
|
3929
|
+
} else {
|
|
3930
|
+
return defaultTimeFormatter(date, vm);
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
},
|
|
3934
|
+
timeParser: {
|
|
3935
|
+
type: Function,
|
|
3936
|
+
default: function _default(date, vm) {
|
|
3937
|
+
if (typeof config.defaultTimeParser === 'function') {
|
|
3938
|
+
return config.defaultTimeParser(date);
|
|
3939
|
+
} else {
|
|
3940
|
+
return defaultTimeParser(date, vm);
|
|
3941
|
+
}
|
|
3942
|
+
}
|
|
3943
|
+
},
|
|
3944
|
+
mobileNative: {
|
|
3945
|
+
type: Boolean,
|
|
3946
|
+
default: function _default() {
|
|
3947
|
+
return config.defaultTimepickerMobileNative;
|
|
3948
|
+
}
|
|
3949
|
+
},
|
|
3950
|
+
mobileModal: {
|
|
3951
|
+
type: Boolean,
|
|
3952
|
+
default: function _default() {
|
|
3953
|
+
return config.defaultTimepickerMobileModal;
|
|
3954
|
+
}
|
|
3955
|
+
},
|
|
3956
|
+
timeCreator: {
|
|
3957
|
+
type: Function,
|
|
3958
|
+
default: function _default() {
|
|
3959
|
+
if (typeof config.defaultTimeCreator === 'function') {
|
|
3960
|
+
return config.defaultTimeCreator();
|
|
3961
|
+
} else {
|
|
3962
|
+
return new Date();
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
},
|
|
3966
|
+
position: String,
|
|
3967
|
+
unselectableTimes: Array,
|
|
3968
|
+
openOnFocus: Boolean,
|
|
3969
|
+
enableSeconds: Boolean,
|
|
3970
|
+
defaultMinutes: Number,
|
|
3971
|
+
defaultSeconds: Number,
|
|
3972
|
+
focusable: {
|
|
3973
|
+
type: Boolean,
|
|
3974
|
+
default: true
|
|
3975
|
+
},
|
|
3976
|
+
tzOffset: {
|
|
3977
|
+
type: Number,
|
|
3978
|
+
default: 0
|
|
3979
|
+
},
|
|
3980
|
+
appendToBody: Boolean,
|
|
3981
|
+
resetOnMeridianChange: {
|
|
3982
|
+
type: Boolean,
|
|
3983
|
+
default: false
|
|
3984
|
+
}
|
|
3985
|
+
},
|
|
3986
|
+
data: function data() {
|
|
3987
|
+
return {
|
|
3988
|
+
dateSelected: this.value,
|
|
3989
|
+
hoursSelected: null,
|
|
3990
|
+
minutesSelected: null,
|
|
3991
|
+
secondsSelected: null,
|
|
3992
|
+
meridienSelected: null,
|
|
3993
|
+
_elementRef: 'input',
|
|
3994
|
+
AM: AM$1,
|
|
3995
|
+
PM: PM$1,
|
|
3996
|
+
HOUR_FORMAT_24: HOUR_FORMAT_24,
|
|
3997
|
+
HOUR_FORMAT_12: HOUR_FORMAT_12
|
|
3998
|
+
};
|
|
3999
|
+
},
|
|
4000
|
+
computed: {
|
|
4001
|
+
computedValue: {
|
|
4002
|
+
get: function get() {
|
|
4003
|
+
return this.dateSelected;
|
|
4004
|
+
},
|
|
4005
|
+
set: function set(value) {
|
|
4006
|
+
this.dateSelected = value;
|
|
4007
|
+
this.$emit('input', this.dateSelected);
|
|
4008
|
+
}
|
|
4009
|
+
},
|
|
4010
|
+
localeOptions: function localeOptions() {
|
|
4011
|
+
return new Intl.DateTimeFormat(this.locale, {
|
|
4012
|
+
hour: 'numeric',
|
|
4013
|
+
minute: 'numeric',
|
|
4014
|
+
second: this.enableSeconds ? 'numeric' : undefined
|
|
4015
|
+
}).resolvedOptions();
|
|
4016
|
+
},
|
|
4017
|
+
dtf: function dtf() {
|
|
4018
|
+
return new Intl.DateTimeFormat(this.locale, {
|
|
4019
|
+
hour: this.localeOptions.hour || 'numeric',
|
|
4020
|
+
minute: this.localeOptions.minute || 'numeric',
|
|
4021
|
+
second: this.enableSeconds ? this.localeOptions.second || 'numeric' : undefined,
|
|
4022
|
+
// Fixes 12 hour display github.com/buefy/buefy/issues/3418
|
|
4023
|
+
hourCycle: !this.isHourFormat24 ? 'h12' : 'h23'
|
|
4024
|
+
});
|
|
4025
|
+
},
|
|
4026
|
+
newHourFormat: function newHourFormat() {
|
|
4027
|
+
return this.hourFormat || (this.localeOptions.hour12 ? HOUR_FORMAT_12 : HOUR_FORMAT_24);
|
|
4028
|
+
},
|
|
4029
|
+
sampleTime: function sampleTime() {
|
|
4030
|
+
var d = this.timeCreator();
|
|
4031
|
+
d.setHours(10);
|
|
4032
|
+
d.setSeconds(0);
|
|
4033
|
+
d.setMinutes(0);
|
|
4034
|
+
d.setMilliseconds(0);
|
|
4035
|
+
return d;
|
|
4036
|
+
},
|
|
4037
|
+
hourLiteral: function hourLiteral() {
|
|
4038
|
+
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
|
|
4039
|
+
var d = this.sampleTime;
|
|
4040
|
+
var parts = this.dtf.formatToParts(d);
|
|
4041
|
+
var literal = parts.find(function (part, idx) {
|
|
4042
|
+
return idx > 0 && parts[idx - 1].type === 'hour';
|
|
4043
|
+
});
|
|
4044
|
+
if (literal) {
|
|
4045
|
+
return literal.value;
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
return ':';
|
|
4049
|
+
},
|
|
4050
|
+
minuteLiteral: function minuteLiteral() {
|
|
4051
|
+
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
|
|
4052
|
+
var d = this.sampleTime;
|
|
4053
|
+
var parts = this.dtf.formatToParts(d);
|
|
4054
|
+
var literal = parts.find(function (part, idx) {
|
|
4055
|
+
return idx > 0 && parts[idx - 1].type === 'minute';
|
|
4056
|
+
});
|
|
4057
|
+
if (literal) {
|
|
4058
|
+
return literal.value;
|
|
4059
|
+
}
|
|
4060
|
+
}
|
|
4061
|
+
return ':';
|
|
4062
|
+
},
|
|
4063
|
+
secondLiteral: function secondLiteral() {
|
|
4064
|
+
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
|
|
4065
|
+
var d = this.sampleTime;
|
|
4066
|
+
var parts = this.dtf.formatToParts(d);
|
|
4067
|
+
var literal = parts.find(function (part, idx) {
|
|
4068
|
+
return idx > 0 && parts[idx - 1].type === 'second';
|
|
4069
|
+
});
|
|
4070
|
+
if (literal) {
|
|
4071
|
+
return literal.value;
|
|
4072
|
+
}
|
|
4073
|
+
}
|
|
4074
|
+
},
|
|
4075
|
+
amString: function amString() {
|
|
4076
|
+
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
|
|
4077
|
+
var d = this.sampleTime;
|
|
4078
|
+
d.setHours(10);
|
|
4079
|
+
var dayPeriod = this.dtf.formatToParts(d).find(function (part) {
|
|
4080
|
+
return part.type === 'dayPeriod';
|
|
4081
|
+
});
|
|
4082
|
+
if (dayPeriod) {
|
|
4083
|
+
return dayPeriod.value;
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
4086
|
+
return AM$1;
|
|
4087
|
+
},
|
|
4088
|
+
pmString: function pmString() {
|
|
4089
|
+
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
|
|
4090
|
+
var d = this.sampleTime;
|
|
4091
|
+
d.setHours(20);
|
|
4092
|
+
var dayPeriod = this.dtf.formatToParts(d).find(function (part) {
|
|
4093
|
+
return part.type === 'dayPeriod';
|
|
4094
|
+
});
|
|
4095
|
+
if (dayPeriod) {
|
|
4096
|
+
return dayPeriod.value;
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
return PM$1;
|
|
4100
|
+
},
|
|
4101
|
+
hours: function hours() {
|
|
4102
|
+
if (!this.incrementHours || this.incrementHours < 1) throw new Error('Hour increment cannot be null or less than 1.');
|
|
4103
|
+
var hours = [];
|
|
4104
|
+
var numberOfHours = this.isHourFormat24 ? 24 : 12;
|
|
4105
|
+
for (var i = 0; i < numberOfHours; i += this.incrementHours) {
|
|
4106
|
+
var value = i;
|
|
4107
|
+
var label = value;
|
|
4108
|
+
if (!this.isHourFormat24) {
|
|
4109
|
+
value = i + 1;
|
|
4110
|
+
label = value;
|
|
4111
|
+
if (this.meridienSelected === this.amString) {
|
|
4112
|
+
if (value === 12) {
|
|
4113
|
+
value = 0;
|
|
4114
|
+
}
|
|
4115
|
+
} else if (this.meridienSelected === this.pmString) {
|
|
4116
|
+
if (value !== 12) {
|
|
4117
|
+
value += 12;
|
|
4118
|
+
}
|
|
4119
|
+
}
|
|
4120
|
+
}
|
|
4121
|
+
hours.push({
|
|
4122
|
+
label: this.formatNumber(label),
|
|
4123
|
+
value: value
|
|
4124
|
+
});
|
|
4125
|
+
}
|
|
4126
|
+
return hours;
|
|
4127
|
+
},
|
|
4128
|
+
minutes: function minutes() {
|
|
4129
|
+
if (!this.incrementMinutes || this.incrementMinutes < 1) throw new Error('Minute increment cannot be null or less than 1.');
|
|
4130
|
+
var minutes = [];
|
|
4131
|
+
for (var i = 0; i < 60; i += this.incrementMinutes) {
|
|
4132
|
+
minutes.push({
|
|
4133
|
+
label: this.formatNumber(i, true),
|
|
4134
|
+
value: i
|
|
4135
|
+
});
|
|
4136
|
+
}
|
|
4137
|
+
return minutes;
|
|
4138
|
+
},
|
|
4139
|
+
seconds: function seconds() {
|
|
4140
|
+
if (!this.incrementSeconds || this.incrementSeconds < 1) throw new Error('Second increment cannot be null or less than 1.');
|
|
4141
|
+
var seconds = [];
|
|
4142
|
+
for (var i = 0; i < 60; i += this.incrementSeconds) {
|
|
4143
|
+
seconds.push({
|
|
4144
|
+
label: this.formatNumber(i, true),
|
|
4145
|
+
value: i
|
|
4146
|
+
});
|
|
4147
|
+
}
|
|
4148
|
+
return seconds;
|
|
4149
|
+
},
|
|
4150
|
+
meridiens: function meridiens() {
|
|
4151
|
+
return [this.amString, this.pmString];
|
|
4152
|
+
},
|
|
4153
|
+
isMobile: function isMobile$1() {
|
|
4154
|
+
return this.mobileNative && isMobile.any();
|
|
4155
|
+
},
|
|
4156
|
+
isHourFormat24: function isHourFormat24() {
|
|
4157
|
+
return this.newHourFormat === HOUR_FORMAT_24;
|
|
4158
|
+
}
|
|
4159
|
+
},
|
|
4160
|
+
watch: {
|
|
4161
|
+
hourFormat: function hourFormat() {
|
|
4162
|
+
if (this.hoursSelected !== null) {
|
|
4163
|
+
this.meridienSelected = this.hoursSelected >= 12 ? this.pmString : this.amString;
|
|
4164
|
+
}
|
|
4165
|
+
},
|
|
4166
|
+
locale: function locale() {
|
|
4167
|
+
// see updateInternalState default
|
|
4168
|
+
if (!this.value) {
|
|
4169
|
+
this.meridienSelected = this.amString;
|
|
4170
|
+
}
|
|
4171
|
+
},
|
|
4172
|
+
/**
|
|
4173
|
+
* When v-model is changed:
|
|
4174
|
+
* 1. Update internal value.
|
|
4175
|
+
* 2. If it's invalid, validate again.
|
|
4176
|
+
*/
|
|
4177
|
+
value: {
|
|
4178
|
+
handler: function handler(value) {
|
|
4179
|
+
this.updateInternalState(value);
|
|
4180
|
+
!this.isValid && this.$refs.input.checkHtml5Validity();
|
|
4181
|
+
},
|
|
4182
|
+
immediate: true
|
|
4183
|
+
}
|
|
4184
|
+
},
|
|
4185
|
+
methods: {
|
|
4186
|
+
onMeridienChange: function onMeridienChange(value) {
|
|
4187
|
+
if (this.hoursSelected !== null && this.resetOnMeridianChange) {
|
|
4188
|
+
this.hoursSelected = null;
|
|
4189
|
+
this.minutesSelected = null;
|
|
4190
|
+
this.secondsSelected = null;
|
|
4191
|
+
this.computedValue = null;
|
|
4192
|
+
} else if (this.hoursSelected !== null) {
|
|
4193
|
+
if (value === this.pmString) {
|
|
4194
|
+
this.hoursSelected += 12;
|
|
4195
|
+
} else if (value === this.amString) {
|
|
4196
|
+
this.hoursSelected -= 12;
|
|
4197
|
+
}
|
|
4198
|
+
}
|
|
4199
|
+
this.updateDateSelected(this.hoursSelected, this.minutesSelected, this.enableSeconds ? this.secondsSelected : 0, value);
|
|
4200
|
+
},
|
|
4201
|
+
onHoursChange: function onHoursChange(value) {
|
|
4202
|
+
if (!this.minutesSelected && typeof this.defaultMinutes !== 'undefined') {
|
|
4203
|
+
this.minutesSelected = this.defaultMinutes;
|
|
4204
|
+
}
|
|
4205
|
+
if (!this.secondsSelected && typeof this.defaultSeconds !== 'undefined') {
|
|
4206
|
+
this.secondsSelected = this.defaultSeconds;
|
|
4207
|
+
}
|
|
4208
|
+
this.updateDateSelected(parseInt(value, 10), this.minutesSelected, this.enableSeconds ? this.secondsSelected : 0, this.meridienSelected);
|
|
4209
|
+
},
|
|
4210
|
+
onMinutesChange: function onMinutesChange(value) {
|
|
4211
|
+
if (!this.secondsSelected && this.defaultSeconds) {
|
|
4212
|
+
this.secondsSelected = this.defaultSeconds;
|
|
4213
|
+
}
|
|
4214
|
+
this.updateDateSelected(this.hoursSelected, parseInt(value, 10), this.enableSeconds ? this.secondsSelected : 0, this.meridienSelected);
|
|
4215
|
+
},
|
|
4216
|
+
onSecondsChange: function onSecondsChange(value) {
|
|
4217
|
+
this.updateDateSelected(this.hoursSelected, this.minutesSelected, parseInt(value, 10), this.meridienSelected);
|
|
4218
|
+
},
|
|
4219
|
+
updateDateSelected: function updateDateSelected(hours, minutes, seconds, meridiens) {
|
|
4220
|
+
if (hours != null && minutes != null && (!this.isHourFormat24 && meridiens !== null || this.isHourFormat24)) {
|
|
4221
|
+
var time = null;
|
|
4222
|
+
if (this.computedValue && !isNaN(this.computedValue)) {
|
|
4223
|
+
time = new Date(this.computedValue);
|
|
4224
|
+
} else {
|
|
4225
|
+
time = this.timeCreator();
|
|
4226
|
+
time.setMilliseconds(0);
|
|
4227
|
+
}
|
|
4228
|
+
time.setHours(hours);
|
|
4229
|
+
time.setMinutes(minutes);
|
|
4230
|
+
time.setSeconds(seconds);
|
|
4231
|
+
if (!isNaN(time.getTime())) this.computedValue = new Date(time.getTime());
|
|
4232
|
+
}
|
|
4233
|
+
},
|
|
4234
|
+
updateInternalState: function updateInternalState(value) {
|
|
4235
|
+
if (value) {
|
|
4236
|
+
this.hoursSelected = value.getHours();
|
|
4237
|
+
this.minutesSelected = value.getMinutes();
|
|
4238
|
+
this.secondsSelected = value.getSeconds();
|
|
4239
|
+
this.meridienSelected = value.getHours() >= 12 ? this.pmString : this.amString;
|
|
4240
|
+
} else {
|
|
4241
|
+
this.hoursSelected = null;
|
|
4242
|
+
this.minutesSelected = null;
|
|
4243
|
+
this.secondsSelected = null;
|
|
4244
|
+
this.meridienSelected = this.amString;
|
|
4245
|
+
}
|
|
4246
|
+
this.dateSelected = value;
|
|
4247
|
+
},
|
|
4248
|
+
isHourDisabled: function isHourDisabled(hour) {
|
|
4249
|
+
var _this = this;
|
|
4250
|
+
var disabled = false;
|
|
4251
|
+
if (this.minTime) {
|
|
4252
|
+
var minHours = this.minTime.getHours();
|
|
4253
|
+
var noMinutesAvailable = this.minutes.every(function (minute) {
|
|
4254
|
+
return _this.isMinuteDisabledForHour(hour, minute.value);
|
|
4255
|
+
});
|
|
4256
|
+
disabled = hour < minHours || noMinutesAvailable;
|
|
4257
|
+
}
|
|
4258
|
+
if (this.maxTime) {
|
|
4259
|
+
if (!disabled) {
|
|
4260
|
+
var maxHours = this.maxTime.getHours();
|
|
4261
|
+
disabled = hour > maxHours;
|
|
4262
|
+
}
|
|
4263
|
+
}
|
|
4264
|
+
if (this.unselectableTimes) {
|
|
4265
|
+
if (!disabled) {
|
|
4266
|
+
var unselectable = this.unselectableTimes.filter(function (time) {
|
|
4267
|
+
if (_this.enableSeconds && _this.secondsSelected !== null) {
|
|
4268
|
+
return time.getHours() === hour && time.getMinutes() === _this.minutesSelected && time.getSeconds() === _this.secondsSelected;
|
|
4269
|
+
} else if (_this.minutesSelected !== null) {
|
|
4270
|
+
return time.getHours() === hour && time.getMinutes() === _this.minutesSelected;
|
|
4271
|
+
}
|
|
4272
|
+
return false;
|
|
4273
|
+
});
|
|
4274
|
+
if (unselectable.length > 0) {
|
|
4275
|
+
disabled = true;
|
|
4276
|
+
} else {
|
|
4277
|
+
disabled = this.minutes.every(function (minute) {
|
|
4278
|
+
return _this.unselectableTimes.filter(function (time) {
|
|
4279
|
+
return time.getHours() === hour && time.getMinutes() === minute.value;
|
|
4280
|
+
}).length > 0;
|
|
4281
|
+
});
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
return disabled;
|
|
4286
|
+
},
|
|
4287
|
+
isMinuteDisabledForHour: function isMinuteDisabledForHour(hour, minute) {
|
|
4288
|
+
var disabled = false;
|
|
4289
|
+
if (this.minTime) {
|
|
4290
|
+
var minHours = this.minTime.getHours();
|
|
4291
|
+
var minMinutes = this.minTime.getMinutes();
|
|
4292
|
+
disabled = hour === minHours && minute < minMinutes;
|
|
4293
|
+
}
|
|
4294
|
+
if (this.maxTime) {
|
|
4295
|
+
if (!disabled) {
|
|
4296
|
+
var maxHours = this.maxTime.getHours();
|
|
4297
|
+
var maxMinutes = this.maxTime.getMinutes();
|
|
4298
|
+
disabled = hour === maxHours && minute > maxMinutes;
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
return disabled;
|
|
4302
|
+
},
|
|
4303
|
+
isMinuteDisabled: function isMinuteDisabled(minute) {
|
|
4304
|
+
var _this2 = this;
|
|
4305
|
+
var disabled = false;
|
|
4306
|
+
if (this.hoursSelected !== null) {
|
|
4307
|
+
if (this.isHourDisabled(this.hoursSelected)) {
|
|
4308
|
+
disabled = true;
|
|
4309
|
+
} else {
|
|
4310
|
+
disabled = this.isMinuteDisabledForHour(this.hoursSelected, minute);
|
|
4311
|
+
}
|
|
4312
|
+
if (this.unselectableTimes) {
|
|
4313
|
+
if (!disabled) {
|
|
4314
|
+
var unselectable = this.unselectableTimes.filter(function (time) {
|
|
4315
|
+
if (_this2.enableSeconds && _this2.secondsSelected !== null) {
|
|
4316
|
+
return time.getHours() === _this2.hoursSelected && time.getMinutes() === minute && time.getSeconds() === _this2.secondsSelected;
|
|
4317
|
+
} else {
|
|
4318
|
+
return time.getHours() === _this2.hoursSelected && time.getMinutes() === minute;
|
|
4319
|
+
}
|
|
4320
|
+
});
|
|
4321
|
+
disabled = unselectable.length > 0;
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
return disabled;
|
|
4326
|
+
},
|
|
4327
|
+
isSecondDisabled: function isSecondDisabled(second) {
|
|
4328
|
+
var _this3 = this;
|
|
4329
|
+
var disabled = false;
|
|
4330
|
+
if (this.minutesSelected !== null) {
|
|
4331
|
+
if (this.isMinuteDisabled(this.minutesSelected)) {
|
|
4332
|
+
disabled = true;
|
|
4333
|
+
} else {
|
|
4334
|
+
if (this.minTime) {
|
|
4335
|
+
var minHours = this.minTime.getHours();
|
|
4336
|
+
var minMinutes = this.minTime.getMinutes();
|
|
4337
|
+
var minSeconds = this.minTime.getSeconds();
|
|
4338
|
+
disabled = this.hoursSelected === minHours && this.minutesSelected === minMinutes && second < minSeconds;
|
|
4339
|
+
}
|
|
4340
|
+
if (this.maxTime) {
|
|
4341
|
+
if (!disabled) {
|
|
4342
|
+
var maxHours = this.maxTime.getHours();
|
|
4343
|
+
var maxMinutes = this.maxTime.getMinutes();
|
|
4344
|
+
var maxSeconds = this.maxTime.getSeconds();
|
|
4345
|
+
disabled = this.hoursSelected === maxHours && this.minutesSelected === maxMinutes && second > maxSeconds;
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
if (this.unselectableTimes) {
|
|
4350
|
+
if (!disabled) {
|
|
4351
|
+
var unselectable = this.unselectableTimes.filter(function (time) {
|
|
4352
|
+
return time.getHours() === _this3.hoursSelected && time.getMinutes() === _this3.minutesSelected && time.getSeconds() === second;
|
|
4353
|
+
});
|
|
4354
|
+
disabled = unselectable.length > 0;
|
|
4355
|
+
}
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
return disabled;
|
|
4359
|
+
},
|
|
4360
|
+
/*
|
|
4361
|
+
* Parse string into date
|
|
4362
|
+
*/
|
|
4363
|
+
onChange: function onChange(value) {
|
|
4364
|
+
var date = this.timeParser(value, this);
|
|
4365
|
+
this.updateInternalState(date);
|
|
4366
|
+
if (date && !isNaN(date)) {
|
|
4367
|
+
this.computedValue = date;
|
|
4368
|
+
} else {
|
|
4369
|
+
// Force refresh input value when not valid date
|
|
4370
|
+
this.computedValue = null;
|
|
4371
|
+
this.$refs.input.newValue = this.computedValue;
|
|
4372
|
+
}
|
|
4373
|
+
},
|
|
4374
|
+
/*
|
|
4375
|
+
* Toggle timepicker
|
|
4376
|
+
*/
|
|
4377
|
+
toggle: function toggle(active) {
|
|
4378
|
+
if (this.$refs.dropdown) {
|
|
4379
|
+
this.$refs.dropdown.isActive = typeof active === 'boolean' ? active : !this.$refs.dropdown.isActive;
|
|
4380
|
+
}
|
|
4381
|
+
},
|
|
4382
|
+
/*
|
|
4383
|
+
* Close timepicker
|
|
4384
|
+
*/
|
|
4385
|
+
close: function close() {
|
|
4386
|
+
this.toggle(false);
|
|
4387
|
+
},
|
|
4388
|
+
/*
|
|
4389
|
+
* Call default onFocus method and show timepicker
|
|
4390
|
+
*/
|
|
4391
|
+
handleOnFocus: function handleOnFocus() {
|
|
4392
|
+
this.onFocus();
|
|
4393
|
+
if (this.openOnFocus) {
|
|
4394
|
+
this.toggle(true);
|
|
4395
|
+
}
|
|
4396
|
+
},
|
|
4397
|
+
/*
|
|
4398
|
+
* Format date into string 'HH-MM-SS'
|
|
4399
|
+
*/
|
|
4400
|
+
formatHHMMSS: function formatHHMMSS(value) {
|
|
4401
|
+
var date = new Date(value);
|
|
4402
|
+
if (value && !isNaN(date)) {
|
|
4403
|
+
var hours = date.getHours();
|
|
4404
|
+
var minutes = date.getMinutes();
|
|
4405
|
+
var seconds = date.getSeconds();
|
|
4406
|
+
return this.formatNumber(hours, true) + ':' + this.formatNumber(minutes, true) + ':' + this.formatNumber(seconds, true);
|
|
4407
|
+
}
|
|
4408
|
+
return '';
|
|
4409
|
+
},
|
|
4410
|
+
/*
|
|
4411
|
+
* Parse time from string
|
|
4412
|
+
*/
|
|
4413
|
+
onChangeNativePicker: function onChangeNativePicker(event) {
|
|
4414
|
+
var date = event.target.value;
|
|
4415
|
+
if (date) {
|
|
4416
|
+
var time = null;
|
|
4417
|
+
if (this.computedValue && !isNaN(this.computedValue)) {
|
|
4418
|
+
time = new Date(this.computedValue);
|
|
4419
|
+
} else {
|
|
4420
|
+
time = new Date();
|
|
4421
|
+
time.setMilliseconds(0);
|
|
4422
|
+
}
|
|
4423
|
+
var t = date.split(':');
|
|
4424
|
+
time.setHours(parseInt(t[0], 10));
|
|
4425
|
+
time.setMinutes(parseInt(t[1], 10));
|
|
4426
|
+
time.setSeconds(t[2] ? parseInt(t[2], 10) : 0);
|
|
4427
|
+
this.computedValue = new Date(time.getTime());
|
|
4428
|
+
} else {
|
|
4429
|
+
this.computedValue = null;
|
|
4430
|
+
}
|
|
4431
|
+
},
|
|
4432
|
+
formatNumber: function formatNumber(value, prependZero) {
|
|
4433
|
+
return this.isHourFormat24 || prependZero ? this.pad(value) : value;
|
|
4434
|
+
},
|
|
4435
|
+
pad: function pad(value) {
|
|
4436
|
+
return (value < 10 ? '0' : '') + value;
|
|
4437
|
+
},
|
|
4438
|
+
/*
|
|
4439
|
+
* Format date into string
|
|
4440
|
+
*/
|
|
4441
|
+
formatValue: function formatValue(date) {
|
|
4442
|
+
if (date && !isNaN(date)) {
|
|
4443
|
+
return this.timeFormatter(date, this);
|
|
4444
|
+
} else {
|
|
4445
|
+
return null;
|
|
4446
|
+
}
|
|
4447
|
+
},
|
|
4448
|
+
/**
|
|
4449
|
+
* Keypress event that is bound to the document.
|
|
4450
|
+
*/
|
|
4451
|
+
keyPress: function keyPress(_ref) {
|
|
4452
|
+
var key = _ref.key;
|
|
4453
|
+
if (this.$refs.dropdown && this.$refs.dropdown.isActive && (key === 'Escape' || key === 'Esc')) {
|
|
4454
|
+
this.toggle(false);
|
|
4455
|
+
}
|
|
4456
|
+
},
|
|
4457
|
+
/**
|
|
4458
|
+
* Emit 'blur' event on dropdown is not active (closed)
|
|
4459
|
+
*/
|
|
4460
|
+
onActiveChange: function onActiveChange(value) {
|
|
4461
|
+
if (!value) {
|
|
4462
|
+
this.onBlur();
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
},
|
|
4466
|
+
created: function created() {
|
|
4467
|
+
if (typeof window !== 'undefined') {
|
|
4468
|
+
document.addEventListener('keyup', this.keyPress);
|
|
4469
|
+
}
|
|
4470
|
+
},
|
|
4471
|
+
beforeDestroy: function beforeDestroy() {
|
|
4472
|
+
if (typeof window !== 'undefined') {
|
|
4473
|
+
document.removeEventListener('keyup', this.keyPress);
|
|
4474
|
+
}
|
|
4475
|
+
}
|
|
4476
|
+
};
|
|
4477
|
+
|
|
4478
|
+
var script$1 = {
|
|
4479
|
+
name: 'BTimepicker',
|
|
4480
|
+
components: _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, Input.name, Input), Field.name, Field), Select.name, Select), Icon.name, Icon), Dropdown.name, Dropdown), DropdownItem.name, DropdownItem),
|
|
4481
|
+
mixins: [TimepickerMixin],
|
|
4482
|
+
inheritAttrs: false,
|
|
4483
|
+
data: function data() {
|
|
4484
|
+
return {
|
|
4485
|
+
_isTimepicker: true
|
|
4486
|
+
};
|
|
4487
|
+
},
|
|
4488
|
+
computed: {
|
|
4489
|
+
nativeStep: function nativeStep() {
|
|
4490
|
+
if (this.enableSeconds) return '1';
|
|
4491
|
+
}
|
|
4492
|
+
}
|
|
4493
|
+
};
|
|
4494
|
+
|
|
4495
|
+
/* script */
|
|
4496
|
+
const __vue_script__$1 = script$1;
|
|
4497
|
+
|
|
4498
|
+
/* template */
|
|
4499
|
+
var __vue_render__$1 = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"timepicker control",class:[_vm.size, {'is-expanded': _vm.expanded}]},[(!_vm.isMobile || _vm.inline)?_c('b-dropdown',{ref:"dropdown",attrs:{"position":_vm.position,"disabled":_vm.disabled,"inline":_vm.inline,"mobile-modal":_vm.mobileModal,"append-to-body":_vm.appendToBody,"append-to-body-copy-parent":""},on:{"active-change":_vm.onActiveChange},scopedSlots:_vm._u([(!_vm.inline)?{key:"trigger",fn:function(){return [_vm._t("trigger",[_c('b-input',_vm._b({ref:"input",attrs:{"autocomplete":"off","value":_vm.formatValue(_vm.computedValue),"placeholder":_vm.placeholder,"size":_vm.size,"icon":_vm.icon,"icon-pack":_vm.iconPack,"loading":_vm.loading,"disabled":_vm.disabled,"readonly":!_vm.editable,"rounded":_vm.rounded,"use-html5-validation":_vm.useHtml5Validation},on:{"focus":_vm.handleOnFocus},nativeOn:{"keyup":function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.toggle(true)},"change":function($event){return _vm.onChange($event.target.value)}}},'b-input',_vm.$attrs,false))])]},proxy:true}:null],null,true)},[_c('b-dropdown-item',{attrs:{"disabled":_vm.disabled,"focusable":_vm.focusable,"custom":""}},[_c('b-field',{attrs:{"grouped":"","position":"is-centered"}},[_c('b-select',{attrs:{"disabled":_vm.disabled,"placeholder":"00"},nativeOn:{"change":function($event){return _vm.onHoursChange($event.target.value)}},model:{value:(_vm.hoursSelected),callback:function ($$v) {_vm.hoursSelected=$$v;},expression:"hoursSelected"}},_vm._l((_vm.hours),function(hour){return _c('option',{key:hour.value,attrs:{"disabled":_vm.isHourDisabled(hour.value)},domProps:{"value":hour.value}},[_vm._v(" "+_vm._s(hour.label)+" ")])}),0),_c('span',{staticClass:"control is-colon"},[_vm._v(_vm._s(_vm.hourLiteral))]),_c('b-select',{attrs:{"disabled":_vm.disabled,"placeholder":"00"},nativeOn:{"change":function($event){return _vm.onMinutesChange($event.target.value)}},model:{value:(_vm.minutesSelected),callback:function ($$v) {_vm.minutesSelected=$$v;},expression:"minutesSelected"}},_vm._l((_vm.minutes),function(minute){return _c('option',{key:minute.value,attrs:{"disabled":_vm.isMinuteDisabled(minute.value)},domProps:{"value":minute.value}},[_vm._v(" "+_vm._s(minute.label)+" ")])}),0),(_vm.enableSeconds)?[_c('span',{staticClass:"control is-colon"},[_vm._v(_vm._s(_vm.minuteLiteral))]),_c('b-select',{attrs:{"disabled":_vm.disabled,"placeholder":"00"},nativeOn:{"change":function($event){return _vm.onSecondsChange($event.target.value)}},model:{value:(_vm.secondsSelected),callback:function ($$v) {_vm.secondsSelected=$$v;},expression:"secondsSelected"}},_vm._l((_vm.seconds),function(second){return _c('option',{key:second.value,attrs:{"disabled":_vm.isSecondDisabled(second.value)},domProps:{"value":second.value}},[_vm._v(" "+_vm._s(second.label)+" ")])}),0),_c('span',{staticClass:"control is-colon"},[_vm._v(_vm._s(_vm.secondLiteral))])]:_vm._e(),(!_vm.isHourFormat24)?_c('b-select',{attrs:{"disabled":_vm.disabled},nativeOn:{"change":function($event){return _vm.onMeridienChange($event.target.value)}},model:{value:(_vm.meridienSelected),callback:function ($$v) {_vm.meridienSelected=$$v;},expression:"meridienSelected"}},_vm._l((_vm.meridiens),function(meridien){return _c('option',{key:meridien,domProps:{"value":meridien}},[_vm._v(" "+_vm._s(meridien)+" ")])}),0):_vm._e()],2),(_vm.$slots.default !== undefined && _vm.$slots.default.length)?_c('footer',{staticClass:"timepicker-footer"},[_vm._t("default")],2):_vm._e()],1)],1):_c('b-input',_vm._b({ref:"input",attrs:{"type":"time","step":_vm.nativeStep,"autocomplete":"off","value":_vm.formatHHMMSS(_vm.computedValue),"placeholder":_vm.placeholder,"size":_vm.size,"icon":_vm.icon,"icon-pack":_vm.iconPack,"rounded":_vm.rounded,"loading":_vm.loading,"max":_vm.formatHHMMSS(_vm.maxTime),"min":_vm.formatHHMMSS(_vm.minTime),"disabled":_vm.disabled,"readonly":false,"use-html5-validation":_vm.useHtml5Validation},on:{"focus":_vm.handleOnFocus,"blur":function($event){_vm.onBlur() && _vm.checkHtml5Validity();}},nativeOn:{"change":function($event){return _vm.onChange($event.target.value)}}},'b-input',_vm.$attrs,false))],1)};
|
|
4500
|
+
var __vue_staticRenderFns__$1 = [];
|
|
4501
|
+
|
|
4502
|
+
/* style */
|
|
4503
|
+
const __vue_inject_styles__$1 = undefined;
|
|
4504
|
+
/* scoped */
|
|
4505
|
+
const __vue_scope_id__$1 = undefined;
|
|
4506
|
+
/* module identifier */
|
|
4507
|
+
const __vue_module_identifier__$1 = undefined;
|
|
4508
|
+
/* functional template */
|
|
4509
|
+
const __vue_is_functional_template__$1 = false;
|
|
4510
|
+
/* style inject */
|
|
4511
|
+
|
|
4512
|
+
/* style inject SSR */
|
|
4513
|
+
|
|
4514
|
+
/* style inject shadow dom */
|
|
4515
|
+
|
|
4516
|
+
|
|
4517
|
+
|
|
4518
|
+
const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
|
|
4519
|
+
{ render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
|
|
4520
|
+
__vue_inject_styles__$1,
|
|
4521
|
+
__vue_script__$1,
|
|
4522
|
+
__vue_scope_id__$1,
|
|
4523
|
+
__vue_is_functional_template__$1,
|
|
4524
|
+
__vue_module_identifier__$1,
|
|
4525
|
+
false,
|
|
4526
|
+
undefined,
|
|
4527
|
+
undefined,
|
|
4528
|
+
undefined
|
|
4529
|
+
);
|
|
4530
|
+
|
|
4531
|
+
var Timepicker = __vue_component__$1;
|
|
4532
|
+
|
|
4533
|
+
var AM = 'AM';
|
|
4534
|
+
var PM = 'PM';
|
|
4535
|
+
var script = {
|
|
4536
|
+
name: 'BDatetimepicker',
|
|
4537
|
+
components: _defineProperty(_defineProperty({}, Datepicker.name, Datepicker), Timepicker.name, Timepicker),
|
|
4538
|
+
mixins: [FormElementMixin],
|
|
4539
|
+
inheritAttrs: false,
|
|
4540
|
+
props: {
|
|
4541
|
+
value: {
|
|
4542
|
+
type: Date
|
|
4543
|
+
},
|
|
4544
|
+
editable: {
|
|
4545
|
+
type: Boolean,
|
|
4546
|
+
default: false
|
|
4547
|
+
},
|
|
4548
|
+
placeholder: String,
|
|
4549
|
+
horizontalTimePicker: Boolean,
|
|
4550
|
+
disabled: Boolean,
|
|
4551
|
+
firstDayOfWeek: {
|
|
4552
|
+
type: Number,
|
|
4553
|
+
default: function _default() {
|
|
4554
|
+
if (typeof config.defaultFirstDayOfWeek === 'number') {
|
|
4555
|
+
return config.defaultFirstDayOfWeek;
|
|
4556
|
+
} else {
|
|
4557
|
+
return 0;
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
},
|
|
4561
|
+
rulesForFirstWeek: {
|
|
4562
|
+
type: Number,
|
|
4563
|
+
default: function _default() {
|
|
4564
|
+
return 4;
|
|
4565
|
+
}
|
|
4566
|
+
},
|
|
4567
|
+
icon: String,
|
|
4568
|
+
iconRight: String,
|
|
4569
|
+
iconRightClickable: Boolean,
|
|
4570
|
+
iconPack: String,
|
|
4571
|
+
inline: Boolean,
|
|
4572
|
+
openOnFocus: Boolean,
|
|
4573
|
+
position: String,
|
|
4574
|
+
mobileNative: {
|
|
4575
|
+
type: Boolean,
|
|
4576
|
+
default: true
|
|
4577
|
+
},
|
|
4578
|
+
minDatetime: Date,
|
|
4579
|
+
maxDatetime: Date,
|
|
4580
|
+
nearbyMonthDays: {
|
|
4581
|
+
type: Boolean,
|
|
4582
|
+
default: config.defaultDatepickerNearbyMonthDays
|
|
4583
|
+
},
|
|
4584
|
+
datetimeFormatter: {
|
|
4585
|
+
type: Function
|
|
4586
|
+
},
|
|
4587
|
+
datetimeParser: {
|
|
4588
|
+
type: Function
|
|
4589
|
+
},
|
|
4590
|
+
datetimeCreator: {
|
|
4591
|
+
type: Function,
|
|
4592
|
+
default: function _default(date) {
|
|
4593
|
+
if (typeof config.defaultDatetimeCreator === 'function') {
|
|
4594
|
+
return config.defaultDatetimeCreator(date);
|
|
4595
|
+
} else {
|
|
4596
|
+
return date;
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
},
|
|
4600
|
+
datepicker: Object,
|
|
4601
|
+
timepicker: Object,
|
|
4602
|
+
tzOffset: {
|
|
4603
|
+
type: Number,
|
|
4604
|
+
default: 0
|
|
4605
|
+
},
|
|
4606
|
+
focusable: {
|
|
4607
|
+
type: Boolean,
|
|
4608
|
+
default: true
|
|
4609
|
+
},
|
|
4610
|
+
appendToBody: Boolean
|
|
4611
|
+
},
|
|
4612
|
+
data: function data() {
|
|
4613
|
+
return {
|
|
4614
|
+
newValue: this.adjustValue(this.value)
|
|
4615
|
+
};
|
|
4616
|
+
},
|
|
4617
|
+
computed: {
|
|
4618
|
+
computedValue: {
|
|
4619
|
+
get: function get() {
|
|
4620
|
+
return this.newValue;
|
|
4621
|
+
},
|
|
4622
|
+
set: function set(value) {
|
|
4623
|
+
if (value) {
|
|
4624
|
+
var val = new Date(value.getTime());
|
|
4625
|
+
if (this.newValue) {
|
|
4626
|
+
// restore time part
|
|
4627
|
+
if ((value.getDate() !== this.newValue.getDate() || value.getMonth() !== this.newValue.getMonth() || value.getFullYear() !== this.newValue.getFullYear()) && value.getHours() === 0 && value.getMinutes() === 0 && value.getSeconds() === 0) {
|
|
4628
|
+
val.setHours(this.newValue.getHours(), this.newValue.getMinutes(), this.newValue.getSeconds(), 0);
|
|
4629
|
+
}
|
|
4630
|
+
} else {
|
|
4631
|
+
val = this.datetimeCreator(value);
|
|
4632
|
+
}
|
|
4633
|
+
// check min and max range
|
|
4634
|
+
if (this.minDatetime && val < this.adjustValue(this.minDatetime)) {
|
|
4635
|
+
val = this.adjustValue(this.minDatetime);
|
|
4636
|
+
} else if (this.maxDatetime && val > this.adjustValue(this.maxDatetime)) {
|
|
4637
|
+
val = this.adjustValue(this.maxDatetime);
|
|
4638
|
+
}
|
|
4639
|
+
this.newValue = new Date(val.getTime());
|
|
4640
|
+
} else {
|
|
4641
|
+
this.newValue = this.adjustValue(value);
|
|
4642
|
+
}
|
|
4643
|
+
var adjustedValue = this.adjustValue(this.newValue, true); // reverse adjust
|
|
4644
|
+
this.$emit('input', adjustedValue);
|
|
4645
|
+
}
|
|
4646
|
+
},
|
|
4647
|
+
localeOptions: function localeOptions() {
|
|
4648
|
+
return new Intl.DateTimeFormat(this.locale, {
|
|
4649
|
+
year: 'numeric',
|
|
4650
|
+
month: 'numeric',
|
|
4651
|
+
day: 'numeric',
|
|
4652
|
+
hour: 'numeric',
|
|
4653
|
+
minute: 'numeric',
|
|
4654
|
+
second: this.enableSeconds() ? 'numeric' : undefined
|
|
4655
|
+
}).resolvedOptions();
|
|
4656
|
+
},
|
|
4657
|
+
dtf: function dtf() {
|
|
4658
|
+
return new Intl.DateTimeFormat(this.locale, {
|
|
4659
|
+
year: this.localeOptions.year || 'numeric',
|
|
4660
|
+
month: this.localeOptions.month || 'numeric',
|
|
4661
|
+
day: this.localeOptions.day || 'numeric',
|
|
4662
|
+
hour: this.localeOptions.hour || 'numeric',
|
|
4663
|
+
minute: this.localeOptions.minute || 'numeric',
|
|
4664
|
+
second: this.enableSeconds() ? this.localeOptions.second || 'numeric' : undefined,
|
|
4665
|
+
hourCycle: !this.isHourFormat24() ? 'h12' : 'h23'
|
|
4666
|
+
});
|
|
4667
|
+
},
|
|
4668
|
+
isMobileNative: function isMobileNative() {
|
|
4669
|
+
return this.mobileNative && this.tzOffset === 0;
|
|
4670
|
+
},
|
|
4671
|
+
isMobile: function isMobile$1() {
|
|
4672
|
+
return this.isMobileNative && isMobile.any();
|
|
4673
|
+
},
|
|
4674
|
+
minDate: function minDate() {
|
|
4675
|
+
if (!this.minDatetime) {
|
|
4676
|
+
return this.datepicker ? this.adjustValue(this.datepicker.minDate) : null;
|
|
4677
|
+
}
|
|
4678
|
+
var adjMinDatetime = this.adjustValue(this.minDatetime);
|
|
4679
|
+
return new Date(adjMinDatetime.getFullYear(), adjMinDatetime.getMonth(), adjMinDatetime.getDate(), 0, 0, 0, 0);
|
|
4680
|
+
},
|
|
4681
|
+
maxDate: function maxDate() {
|
|
4682
|
+
if (!this.maxDatetime) {
|
|
4683
|
+
return this.datepicker ? this.adjustValue(this.datepicker.maxDate) : null;
|
|
4684
|
+
}
|
|
4685
|
+
var adjMaxDatetime = this.adjustValue(this.maxDatetime);
|
|
4686
|
+
return new Date(adjMaxDatetime.getFullYear(), adjMaxDatetime.getMonth(), adjMaxDatetime.getDate(), 0, 0, 0, 0);
|
|
4687
|
+
},
|
|
4688
|
+
minTime: function minTime() {
|
|
4689
|
+
if (!this.minDatetime || this.newValue === null || typeof this.newValue === 'undefined') {
|
|
4690
|
+
return this.timepicker ? this.adjustValue(this.timepicker.minTime) : null;
|
|
4691
|
+
}
|
|
4692
|
+
var adjMinDatetime = this.adjustValue(this.minDatetime);
|
|
4693
|
+
if (adjMinDatetime.getFullYear() === this.newValue.getFullYear() && adjMinDatetime.getMonth() === this.newValue.getMonth() && adjMinDatetime.getDate() === this.newValue.getDate()) {
|
|
4694
|
+
return adjMinDatetime;
|
|
4695
|
+
}
|
|
4696
|
+
},
|
|
4697
|
+
maxTime: function maxTime() {
|
|
4698
|
+
if (!this.maxDatetime || this.newValue === null || typeof this.newValue === 'undefined') {
|
|
4699
|
+
return this.timepicker ? this.adjustValue(this.timepicker.maxTime) : null;
|
|
4700
|
+
}
|
|
4701
|
+
var adjMaxDatetime = this.adjustValue(this.maxDatetime);
|
|
4702
|
+
if (adjMaxDatetime.getFullYear() === this.newValue.getFullYear() && adjMaxDatetime.getMonth() === this.newValue.getMonth() && adjMaxDatetime.getDate() === this.newValue.getDate()) {
|
|
4703
|
+
return adjMaxDatetime;
|
|
4704
|
+
}
|
|
4705
|
+
},
|
|
4706
|
+
datepickerSize: function datepickerSize() {
|
|
4707
|
+
return this.datepicker && this.datepicker.size ? this.datepicker.size : this.size;
|
|
4708
|
+
},
|
|
4709
|
+
timepickerSize: function timepickerSize() {
|
|
4710
|
+
return this.timepicker && this.timepicker.size ? this.timepicker.size : this.size;
|
|
4711
|
+
},
|
|
4712
|
+
timepickerDisabled: function timepickerDisabled() {
|
|
4713
|
+
return this.timepicker && this.timepicker.disabled ? this.timepicker.disabled : this.disabled;
|
|
4714
|
+
}
|
|
4715
|
+
},
|
|
4716
|
+
watch: {
|
|
4717
|
+
value: function value() {
|
|
4718
|
+
this.newValue = this.adjustValue(this.value);
|
|
4719
|
+
},
|
|
4720
|
+
tzOffset: function tzOffset() {
|
|
4721
|
+
this.newValue = this.adjustValue(this.value);
|
|
4722
|
+
}
|
|
4723
|
+
},
|
|
4724
|
+
methods: {
|
|
4725
|
+
enableSeconds: function enableSeconds() {
|
|
4726
|
+
if (this.$refs.timepicker) {
|
|
4727
|
+
return this.$refs.timepicker.enableSeconds;
|
|
4728
|
+
}
|
|
4729
|
+
return false;
|
|
4730
|
+
},
|
|
4731
|
+
isHourFormat24: function isHourFormat24() {
|
|
4732
|
+
if (this.$refs.timepicker) {
|
|
4733
|
+
return this.$refs.timepicker.isHourFormat24;
|
|
4734
|
+
}
|
|
4735
|
+
return !this.localeOptions.hour12;
|
|
4736
|
+
},
|
|
4737
|
+
adjustValue: function adjustValue(value) {
|
|
4738
|
+
var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4739
|
+
if (!value) return value;
|
|
4740
|
+
if (reverse) {
|
|
4741
|
+
return new Date(value.getTime() - this.tzOffset * 60000);
|
|
4742
|
+
} else {
|
|
4743
|
+
return new Date(value.getTime() + this.tzOffset * 60000);
|
|
4744
|
+
}
|
|
4745
|
+
},
|
|
4746
|
+
defaultDatetimeParser: function defaultDatetimeParser(date) {
|
|
4747
|
+
if (typeof this.datetimeParser === 'function') {
|
|
4748
|
+
return this.datetimeParser(date);
|
|
4749
|
+
} else if (typeof config.defaultDatetimeParser === 'function') {
|
|
4750
|
+
return config.defaultDatetimeParser(date);
|
|
4751
|
+
} else {
|
|
4752
|
+
if (this.dtf.formatToParts && typeof this.dtf.formatToParts === 'function') {
|
|
4753
|
+
var dayPeriods = [AM, PM, AM.toLowerCase(), PM.toLowerCase()];
|
|
4754
|
+
if (this.$refs.timepicker) {
|
|
4755
|
+
dayPeriods.push(this.$refs.timepicker.amString);
|
|
4756
|
+
dayPeriods.push(this.$refs.timepicker.pmString);
|
|
4757
|
+
}
|
|
4758
|
+
var parts = this.dtf.formatToParts(new Date());
|
|
4759
|
+
var formatRegex = parts.map(function (part, idx) {
|
|
4760
|
+
if (part.type === 'literal') {
|
|
4761
|
+
if (idx + 1 < parts.length && parts[idx + 1].type === 'hour') {
|
|
4762
|
+
return "[^\\d]+";
|
|
4763
|
+
}
|
|
4764
|
+
return part.value.replace(/ /g, '\\s?');
|
|
4765
|
+
} else if (part.type === 'dayPeriod') {
|
|
4766
|
+
return "((?!=<".concat(part.type, ">)(").concat(dayPeriods.join('|'), ")?)");
|
|
4767
|
+
}
|
|
4768
|
+
return "((?!=<".concat(part.type, ">)\\d+)");
|
|
4769
|
+
}).join('');
|
|
4770
|
+
var datetimeGroups = matchWithGroups(formatRegex, date);
|
|
4771
|
+
|
|
4772
|
+
// We do a simple validation for the group.
|
|
4773
|
+
// If it is not valid, it will fallback to Date.parse below
|
|
4774
|
+
if (datetimeGroups.year && datetimeGroups.year.length === 4 && datetimeGroups.month && datetimeGroups.month <= 12 && datetimeGroups.day && datetimeGroups.day <= 31 && datetimeGroups.hour && datetimeGroups.hour >= 0 && datetimeGroups.hour < 24 && datetimeGroups.minute && datetimeGroups.minute >= 0 && datetimeGroups.minute <= 59) {
|
|
4775
|
+
var d = new Date(datetimeGroups.year, datetimeGroups.month - 1, datetimeGroups.day, datetimeGroups.hour, datetimeGroups.minute, datetimeGroups.second || 0);
|
|
4776
|
+
return d;
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
return new Date(Date.parse(date));
|
|
4780
|
+
}
|
|
4781
|
+
},
|
|
4782
|
+
defaultDatetimeFormatter: function defaultDatetimeFormatter(date) {
|
|
4783
|
+
if (typeof this.datetimeFormatter === 'function') {
|
|
4784
|
+
return this.datetimeFormatter(date);
|
|
4785
|
+
} else if (typeof config.defaultDatetimeFormatter === 'function') {
|
|
4786
|
+
return config.defaultDatetimeFormatter(date);
|
|
4787
|
+
} else {
|
|
4788
|
+
return this.dtf.format(date);
|
|
4789
|
+
}
|
|
4790
|
+
},
|
|
4791
|
+
/*
|
|
4792
|
+
* Parse date from string
|
|
4793
|
+
*/
|
|
4794
|
+
onChangeNativePicker: function onChangeNativePicker(event) {
|
|
4795
|
+
var date = event.target.value;
|
|
4796
|
+
var s = date ? date.split(/\D/) : [];
|
|
4797
|
+
if (s.length >= 5) {
|
|
4798
|
+
var year = parseInt(s[0], 10);
|
|
4799
|
+
var month = parseInt(s[1], 10) - 1;
|
|
4800
|
+
var day = parseInt(s[2], 10);
|
|
4801
|
+
var hours = parseInt(s[3], 10);
|
|
4802
|
+
var minutes = parseInt(s[4], 10);
|
|
4803
|
+
// Seconds are omitted intentionally; they are unsupported by input
|
|
4804
|
+
// type=datetime-local and cause the control to fail native validation
|
|
4805
|
+
this.computedValue = new Date(year, month, day, hours, minutes);
|
|
4806
|
+
} else {
|
|
4807
|
+
this.computedValue = null;
|
|
4808
|
+
}
|
|
4809
|
+
},
|
|
4810
|
+
/*
|
|
4811
|
+
* Emit 'active-change' on datepicker active state change
|
|
4812
|
+
*/
|
|
4813
|
+
onActiveChange: function onActiveChange(value) {
|
|
4814
|
+
this.$emit('active-change', value);
|
|
4815
|
+
},
|
|
4816
|
+
formatNative: function formatNative(value) {
|
|
4817
|
+
var date = new Date(value);
|
|
4818
|
+
if (value && !isNaN(date)) {
|
|
4819
|
+
var year = date.getFullYear();
|
|
4820
|
+
var month = date.getMonth() + 1;
|
|
4821
|
+
var day = date.getDate();
|
|
4822
|
+
var hours = date.getHours();
|
|
4823
|
+
var minutes = date.getMinutes();
|
|
4824
|
+
var seconds = date.getSeconds();
|
|
4825
|
+
return year + '-' + ((month < 10 ? '0' : '') + month) + '-' + ((day < 10 ? '0' : '') + day) + 'T' + ((hours < 10 ? '0' : '') + hours) + ':' + ((minutes < 10 ? '0' : '') + minutes) + ':' + ((seconds < 10 ? '0' : '') + seconds);
|
|
4826
|
+
}
|
|
4827
|
+
return '';
|
|
4828
|
+
},
|
|
4829
|
+
toggle: function toggle() {
|
|
4830
|
+
this.$refs.datepicker.toggle();
|
|
4831
|
+
}
|
|
4832
|
+
},
|
|
4833
|
+
mounted: function mounted() {
|
|
4834
|
+
if (!this.isMobile || this.inline) {
|
|
4835
|
+
// $refs attached, it's time to refresh datepicker (input)
|
|
4836
|
+
if (this.newValue) {
|
|
4837
|
+
this.$refs.datepicker.$forceUpdate();
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
}
|
|
4841
|
+
};
|
|
4842
|
+
|
|
4843
|
+
/* script */
|
|
4844
|
+
const __vue_script__ = script;
|
|
4845
|
+
|
|
4846
|
+
/* template */
|
|
4847
|
+
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (!_vm.isMobile || _vm.inline)?_c('b-datepicker',_vm._b({ref:"datepicker",attrs:{"rounded":_vm.rounded,"open-on-focus":_vm.openOnFocus,"position":_vm.position,"loading":_vm.loading,"inline":_vm.inline,"editable":_vm.editable,"expanded":_vm.expanded,"close-on-click":false,"first-day-of-week":_vm.firstDayOfWeek,"rules-for-first-week":_vm.rulesForFirstWeek,"date-formatter":_vm.defaultDatetimeFormatter,"date-parser":_vm.defaultDatetimeParser,"min-date":_vm.minDate,"max-date":_vm.maxDate,"nearby-month-days":_vm.nearbyMonthDays,"icon":_vm.icon,"icon-right":_vm.iconRight,"icon-right-clickable":_vm.iconRightClickable,"icon-pack":_vm.iconPack,"size":_vm.datepickerSize,"placeholder":_vm.placeholder,"horizontal-time-picker":_vm.horizontalTimePicker,"range":false,"disabled":_vm.disabled,"mobile-native":_vm.isMobileNative,"locale":_vm.locale,"focusable":_vm.focusable,"append-to-body":_vm.appendToBody},on:{"focus":_vm.onFocus,"blur":_vm.onBlur,"active-change":_vm.onActiveChange,"icon-right-click":function($event){return _vm.$emit('icon-right-click')},"change-month":function($event){return _vm.$emit('change-month', $event)},"change-year":function($event){return _vm.$emit('change-year', $event)}},model:{value:(_vm.computedValue),callback:function ($$v) {_vm.computedValue=$$v;},expression:"computedValue"}},'b-datepicker',_vm.datepicker,false),[_c('nav',{staticClass:"level is-mobile"},[(_vm.$slots.left !== undefined)?_c('div',{staticClass:"level-item has-text-centered"},[_vm._t("left")],2):_vm._e(),_c('div',{staticClass:"level-item has-text-centered"},[_c('b-timepicker',_vm._b({ref:"timepicker",attrs:{"inline":"","editable":_vm.editable,"min-time":_vm.minTime,"max-time":_vm.maxTime,"size":_vm.timepickerSize,"disabled":_vm.timepickerDisabled,"focusable":_vm.focusable,"mobile-native":_vm.isMobileNative,"locale":_vm.locale},model:{value:(_vm.computedValue),callback:function ($$v) {_vm.computedValue=$$v;},expression:"computedValue"}},'b-timepicker',_vm.timepicker,false))],1),(_vm.$slots.right !== undefined)?_c('div',{staticClass:"level-item has-text-centered"},[_vm._t("right")],2):_vm._e()])]):_c('b-input',_vm._b({ref:"input",attrs:{"type":"datetime-local","autocomplete":"off","value":_vm.formatNative(_vm.computedValue),"placeholder":_vm.placeholder,"size":_vm.size,"icon":_vm.icon,"icon-pack":_vm.iconPack,"rounded":_vm.rounded,"loading":_vm.loading,"max":_vm.formatNative(_vm.maxDate),"min":_vm.formatNative(_vm.minDate),"disabled":_vm.disabled,"readonly":false,"use-html5-validation":_vm.useHtml5Validation},on:{"focus":_vm.onFocus,"blur":_vm.onBlur},nativeOn:{"change":function($event){return _vm.onChangeNativePicker($event)}}},'b-input',_vm.$attrs,false))};
|
|
4848
|
+
var __vue_staticRenderFns__ = [];
|
|
4849
|
+
|
|
4850
|
+
/* style */
|
|
4851
|
+
const __vue_inject_styles__ = undefined;
|
|
4852
|
+
/* scoped */
|
|
4853
|
+
const __vue_scope_id__ = undefined;
|
|
4854
|
+
/* module identifier */
|
|
4855
|
+
const __vue_module_identifier__ = undefined;
|
|
4856
|
+
/* functional template */
|
|
4857
|
+
const __vue_is_functional_template__ = false;
|
|
4858
|
+
/* style inject */
|
|
4859
|
+
|
|
4860
|
+
/* style inject SSR */
|
|
4861
|
+
|
|
4862
|
+
/* style inject shadow dom */
|
|
4863
|
+
|
|
4864
|
+
|
|
4865
|
+
|
|
4866
|
+
const __vue_component__ = /*#__PURE__*/normalizeComponent(
|
|
4867
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
4868
|
+
__vue_inject_styles__,
|
|
4869
|
+
__vue_script__,
|
|
4870
|
+
__vue_scope_id__,
|
|
4871
|
+
__vue_is_functional_template__,
|
|
4872
|
+
__vue_module_identifier__,
|
|
4873
|
+
false,
|
|
4874
|
+
undefined,
|
|
4875
|
+
undefined,
|
|
4876
|
+
undefined
|
|
4877
|
+
);
|
|
4878
|
+
|
|
4879
|
+
var Datetimepicker = __vue_component__;
|
|
4880
|
+
|
|
4881
|
+
var use = function use(plugin) {
|
|
4882
|
+
if (typeof window !== 'undefined' && window.Vue) {
|
|
4883
|
+
window.Vue.use(plugin);
|
|
4884
|
+
}
|
|
4885
|
+
};
|
|
4886
|
+
var registerComponent = function registerComponent(Vue, component) {
|
|
4887
|
+
Vue.component(component.name, component);
|
|
4888
|
+
};
|
|
4889
|
+
|
|
4890
|
+
var Plugin = {
|
|
4891
|
+
install: function install(Vue) {
|
|
4892
|
+
registerComponent(Vue, Datetimepicker);
|
|
4893
|
+
}
|
|
4894
|
+
};
|
|
4895
|
+
use(Plugin);
|
|
4896
|
+
|
|
4897
|
+
exports.BDatetimepicker = Datetimepicker;
|
|
4898
|
+
exports["default"] = Plugin;
|
|
4899
|
+
|
|
4900
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4901
|
+
|
|
4902
|
+
}));
|