@mdsfe/mds-ui 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +778 -0
- package/LICENSE +21 -0
- package/README.md +106 -0
- package/dist/_locale/index.js +18 -0
- package/dist/_locale/zh-CN.js +123 -0
- package/dist/_mixin/emitter.js +35 -0
- package/dist/_mixin/focus.js +13 -0
- package/dist/_mixin/locale.js +17 -0
- package/dist/_mixin/popper.js +192 -0
- package/dist/_mixin/tooltip.js +218 -0
- package/dist/_util/__test__/switchcase.test.js +43 -0
- package/dist/_util/autoprefixer.js +249 -0
- package/dist/_util/clickoutside.js +79 -0
- package/dist/_util/date.js +368 -0
- package/dist/_util/dateUtil.js +311 -0
- package/dist/_util/dom.js +240 -0
- package/dist/_util/getRequestAnimationFrame.js +50 -0
- package/dist/_util/getScroll.js +21 -0
- package/dist/_util/loaders/loaders.css.js +52 -0
- package/dist/_util/loaders/loading.js +53 -0
- package/dist/_util/merge.js +18 -0
- package/dist/_util/popper.js +1261 -0
- package/dist/_util/popup/index.js +232 -0
- package/dist/_util/popup/popup-manager.js +205 -0
- package/dist/_util/proptype.js +12 -0
- package/dist/_util/repeatClick.js +30 -0
- package/dist/_util/resize.js +61 -0
- package/dist/_util/resizeEvent.js +59 -0
- package/dist/_util/scrollIntoView.js +38 -0
- package/dist/_util/scrollbar-width.js +37 -0
- package/dist/_util/soda.js +54 -0
- package/dist/_util/switchcase.js +22 -0
- package/dist/_util/throttleByAnimationFrame.js +70 -0
- package/dist/_util/tree/node.js +412 -0
- package/dist/_util/tree/tree.js +410 -0
- package/dist/_util/util.js +166 -0
- package/dist/_util/vue-popper.js +213 -0
- package/dist/affix.js +509 -0
- package/dist/anchor.js +522 -0
- package/dist/avatar.js +437 -0
- package/dist/backtop.js +469 -0
- package/dist/badge.js +439 -0
- package/dist/bordershadow.js +310 -0
- package/dist/breadcrumb.js +434 -0
- package/dist/button.js +579 -0
- package/dist/card.js +514 -0
- package/dist/carousel.js +1326 -0
- package/dist/cascaderpanel.js +2320 -0
- package/dist/checkbox.js +681 -0
- package/dist/col.js +546 -0
- package/dist/collapse.js +671 -0
- package/dist/color.js +306 -0
- package/dist/datepicker.js +8089 -0
- package/dist/divider.js +346 -0
- package/dist/drawer.js +652 -0
- package/dist/dropdown.js +687 -0
- package/dist/empty.js +416 -0
- package/dist/font.js +306 -0
- package/dist/form.js +878 -0
- package/dist/icon.js +401 -0
- package/dist/index.js +1 -0
- package/dist/input.js +1251 -0
- package/dist/inputnumber.js +689 -0
- package/dist/layout.js +786 -0
- package/dist/list.js +789 -0
- package/dist/loading.js +430 -0
- package/dist/mds-ui.min.css +7 -0
- package/dist/mds-ui.min.js +64911 -0
- package/dist/menu.js +1131 -0
- package/dist/message.js +1016 -0
- package/dist/modal.js +895 -0
- package/dist/notification.js +818 -0
- package/dist/pagination.js +1213 -0
- package/dist/popconfirm.js +336 -0
- package/dist/popover.js +206 -0
- package/dist/progress.js +1023 -0
- package/dist/radio.js +760 -0
- package/dist/rate.js +765 -0
- package/dist/row.js +546 -0
- package/dist/select.js +4950 -0
- package/dist/slider.js +1411 -0
- package/dist/slottable.js +1414 -0
- package/dist/steps.js +546 -0
- package/dist/style/affix.css +5524 -0
- package/dist/style/anchor.css +5572 -0
- package/dist/style/avatar.css +5587 -0
- package/dist/style/backtop.css +34 -0
- package/dist/style/badge.css +5655 -0
- package/dist/style/bordershadow.css +5601 -0
- package/dist/style/breadcrumb.css +5551 -0
- package/dist/style/button.css +7679 -0
- package/dist/style/card.css +5670 -0
- package/dist/style/carousel.css +5731 -0
- package/dist/style/cascaderpanel.css +125 -0
- package/dist/style/checkbox.css +5700 -0
- package/dist/style/col.css +8121 -0
- package/dist/style/collapse.css +5593 -0
- package/dist/style/color.css +6136 -0
- package/dist/style/datepicker.css +5977 -0
- package/dist/style/divider.css +5558 -0
- package/dist/style/drawer.css +7979 -0
- package/dist/style/dropdown.css +7950 -0
- package/dist/style/empty.css +5563 -0
- package/dist/style/font.css +5559 -0
- package/dist/style/form.css +5662 -0
- package/dist/style/icon.css +5538 -0
- package/dist/style/input.css +6256 -0
- package/dist/style/inputnumber.css +5828 -0
- package/dist/style/layout.css +5572 -0
- package/dist/style/list.css +5655 -0
- package/dist/style/loading.css +5540 -0
- package/dist/style/menu.css +6183 -0
- package/dist/style/message.css +194 -0
- package/dist/style/modal.css +5637 -0
- package/dist/style/notification.css +5706 -0
- package/dist/style/pagination.css +6683 -0
- package/dist/style/popconfirm.css +7951 -0
- package/dist/style/popover.css +5727 -0
- package/dist/style/progress.css +5714 -0
- package/dist/style/radio.css +5769 -0
- package/dist/style/rate.css +5616 -0
- package/dist/style/row.css +8121 -0
- package/dist/style/select.css +5729 -0
- package/dist/style/slider.css +5594 -0
- package/dist/style/slottable.css +5831 -0
- package/dist/style/steps.css +6100 -0
- package/dist/style/switch.css +5624 -0
- package/dist/style/table.css +8392 -0
- package/dist/style/tabs.css +6047 -0
- package/dist/style/tag.css +5935 -0
- package/dist/style/text.css +5636 -0
- package/dist/style/timeline.css +5602 -0
- package/dist/style/timepicker.css +5904 -0
- package/dist/style/tooltip.css +5686 -0
- package/dist/style/transfer.css +101 -0
- package/dist/style/transition.css +1417 -0
- package/dist/style/tree.css +5598 -0
- package/dist/style/typography.css +5640 -0
- package/dist/style/upload.css +5834 -0
- package/dist/switch.js +448 -0
- package/dist/table.js +3809 -0
- package/dist/tabs.js +1273 -0
- package/dist/tag.js +478 -0
- package/dist/text.js +1100 -0
- package/dist/timeline.js +495 -0
- package/dist/timepicker.js +1567 -0
- package/dist/tooltip.js +179 -0
- package/dist/transfer.js +981 -0
- package/dist/transition.js +246 -0
- package/dist/tree.js +1866 -0
- package/dist/typography.js +469 -0
- package/dist/upload.js +1990 -0
- package/package.json +144 -0
package/dist/select.js
ADDED
|
@@ -0,0 +1,4950 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory(require("./_util/proptype"), require("./icon"), require("vue"), require("./_mixin/emitter"), require("./input"), require("./_util/util"), require("./_util/resizeEvent"), require("./tag"));
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define(["./_util/proptype", "./icon", "vue", "./_mixin/emitter", "./input", "./_util/util", "./_util/resizeEvent", "./tag"], factory);
|
|
6
|
+
else {
|
|
7
|
+
var a = typeof exports === 'object' ? factory(require("./_util/proptype"), require("./icon"), require("vue"), require("./_mixin/emitter"), require("./input"), require("./_util/util"), require("./_util/resizeEvent"), require("./tag")) : factory(root["./_util/proptype"], root["./icon"], root["Vue"], root["./_mixin/emitter"], root["./input"], root["./_util/util"], root["./_util/resizeEvent"], root["./tag"]);
|
|
8
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
+
}
|
|
10
|
+
})(window, function(__WEBPACK_EXTERNAL_MODULE__3__, __WEBPACK_EXTERNAL_MODULE__4__, __WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__10__, __WEBPACK_EXTERNAL_MODULE__14__, __WEBPACK_EXTERNAL_MODULE__55__, __WEBPACK_EXTERNAL_MODULE__66__) {
|
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
12
|
+
/******/ // The module cache
|
|
13
|
+
/******/ var installedModules = {};
|
|
14
|
+
/******/
|
|
15
|
+
/******/ // The require function
|
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
|
17
|
+
/******/
|
|
18
|
+
/******/ // Check if module is in cache
|
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
|
21
|
+
/******/ }
|
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
|
24
|
+
/******/ i: moduleId,
|
|
25
|
+
/******/ l: false,
|
|
26
|
+
/******/ exports: {}
|
|
27
|
+
/******/ };
|
|
28
|
+
/******/
|
|
29
|
+
/******/ // Execute the module function
|
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
31
|
+
/******/
|
|
32
|
+
/******/ // Flag the module as loaded
|
|
33
|
+
/******/ module.l = true;
|
|
34
|
+
/******/
|
|
35
|
+
/******/ // Return the exports of the module
|
|
36
|
+
/******/ return module.exports;
|
|
37
|
+
/******/ }
|
|
38
|
+
/******/
|
|
39
|
+
/******/
|
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
41
|
+
/******/ __webpack_require__.m = modules;
|
|
42
|
+
/******/
|
|
43
|
+
/******/ // expose the module cache
|
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
|
45
|
+
/******/
|
|
46
|
+
/******/ // define getter function for harmony exports
|
|
47
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
48
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
49
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
50
|
+
/******/ }
|
|
51
|
+
/******/ };
|
|
52
|
+
/******/
|
|
53
|
+
/******/ // define __esModule on exports
|
|
54
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
55
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
56
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
57
|
+
/******/ }
|
|
58
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
+
/******/ };
|
|
60
|
+
/******/
|
|
61
|
+
/******/ // create a fake namespace object
|
|
62
|
+
/******/ // mode & 1: value is a module id, require it
|
|
63
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
64
|
+
/******/ // mode & 4: return value when already ns object
|
|
65
|
+
/******/ // mode & 8|1: behave like require
|
|
66
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
67
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
68
|
+
/******/ if(mode & 8) return value;
|
|
69
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
70
|
+
/******/ var ns = Object.create(null);
|
|
71
|
+
/******/ __webpack_require__.r(ns);
|
|
72
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
73
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
74
|
+
/******/ return ns;
|
|
75
|
+
/******/ };
|
|
76
|
+
/******/
|
|
77
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
78
|
+
/******/ __webpack_require__.n = function(module) {
|
|
79
|
+
/******/ var getter = module && module.__esModule ?
|
|
80
|
+
/******/ function getDefault() { return module['default']; } :
|
|
81
|
+
/******/ function getModuleExports() { return module; };
|
|
82
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
83
|
+
/******/ return getter;
|
|
84
|
+
/******/ };
|
|
85
|
+
/******/
|
|
86
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
87
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // __webpack_public_path__
|
|
90
|
+
/******/ __webpack_require__.p = "/dist/";
|
|
91
|
+
/******/
|
|
92
|
+
/******/
|
|
93
|
+
/******/ // Load entry module and return exports
|
|
94
|
+
/******/ return __webpack_require__(__webpack_require__.s = 84);
|
|
95
|
+
/******/ })
|
|
96
|
+
/************************************************************************/
|
|
97
|
+
/******/ ({
|
|
98
|
+
|
|
99
|
+
/***/ 0:
|
|
100
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
101
|
+
|
|
102
|
+
"use strict";
|
|
103
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
|
104
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
105
|
+
|
|
106
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
107
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
108
|
+
// be included in the final webpack user bundle.
|
|
109
|
+
|
|
110
|
+
function normalizeComponent (
|
|
111
|
+
scriptExports,
|
|
112
|
+
render,
|
|
113
|
+
staticRenderFns,
|
|
114
|
+
functionalTemplate,
|
|
115
|
+
injectStyles,
|
|
116
|
+
scopeId,
|
|
117
|
+
moduleIdentifier, /* server only */
|
|
118
|
+
shadowMode /* vue-cli only */
|
|
119
|
+
) {
|
|
120
|
+
// Vue.extend constructor export interop
|
|
121
|
+
var options = typeof scriptExports === 'function'
|
|
122
|
+
? scriptExports.options
|
|
123
|
+
: scriptExports
|
|
124
|
+
|
|
125
|
+
// render functions
|
|
126
|
+
if (render) {
|
|
127
|
+
options.render = render
|
|
128
|
+
options.staticRenderFns = staticRenderFns
|
|
129
|
+
options._compiled = true
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// functional template
|
|
133
|
+
if (functionalTemplate) {
|
|
134
|
+
options.functional = true
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// scopedId
|
|
138
|
+
if (scopeId) {
|
|
139
|
+
options._scopeId = 'data-v-' + scopeId
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var hook
|
|
143
|
+
if (moduleIdentifier) { // server build
|
|
144
|
+
hook = function (context) {
|
|
145
|
+
// 2.3 injection
|
|
146
|
+
context =
|
|
147
|
+
context || // cached call
|
|
148
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
149
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
150
|
+
// 2.2 with runInNewContext: true
|
|
151
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
152
|
+
context = __VUE_SSR_CONTEXT__
|
|
153
|
+
}
|
|
154
|
+
// inject component styles
|
|
155
|
+
if (injectStyles) {
|
|
156
|
+
injectStyles.call(this, context)
|
|
157
|
+
}
|
|
158
|
+
// register component module identifier for async chunk inferrence
|
|
159
|
+
if (context && context._registeredComponents) {
|
|
160
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// used by ssr in case component is cached and beforeCreate
|
|
164
|
+
// never gets called
|
|
165
|
+
options._ssrRegister = hook
|
|
166
|
+
} else if (injectStyles) {
|
|
167
|
+
hook = shadowMode
|
|
168
|
+
? function () {
|
|
169
|
+
injectStyles.call(
|
|
170
|
+
this,
|
|
171
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
: injectStyles
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (hook) {
|
|
178
|
+
if (options.functional) {
|
|
179
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
180
|
+
// go through the normalizer
|
|
181
|
+
options._injectStyles = hook
|
|
182
|
+
// register for functional component in vue file
|
|
183
|
+
var originalRender = options.render
|
|
184
|
+
options.render = function renderWithStyleInjection (h, context) {
|
|
185
|
+
hook.call(context)
|
|
186
|
+
return originalRender(h, context)
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
// inject component registration as beforeCreate hook
|
|
190
|
+
var existing = options.beforeCreate
|
|
191
|
+
options.beforeCreate = existing
|
|
192
|
+
? [].concat(existing, hook)
|
|
193
|
+
: [hook]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
exports: scriptExports,
|
|
199
|
+
options: options
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
/***/ }),
|
|
205
|
+
|
|
206
|
+
/***/ 1:
|
|
207
|
+
/***/ (function(module, exports) {
|
|
208
|
+
|
|
209
|
+
module.exports = require("babel-runtime/helpers/defineProperty");
|
|
210
|
+
|
|
211
|
+
/***/ }),
|
|
212
|
+
|
|
213
|
+
/***/ 10:
|
|
214
|
+
/***/ (function(module, exports) {
|
|
215
|
+
|
|
216
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__10__;
|
|
217
|
+
|
|
218
|
+
/***/ }),
|
|
219
|
+
|
|
220
|
+
/***/ 11:
|
|
221
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
222
|
+
|
|
223
|
+
"use strict";
|
|
224
|
+
/* unused harmony export noop */
|
|
225
|
+
/* unused harmony export getOffsetLeft */
|
|
226
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getValueByPath; });
|
|
227
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return valueEquals; });
|
|
228
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return arrayFindIndex; });
|
|
229
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrayFind; });
|
|
230
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return coerceTruthyValueToArray; });
|
|
231
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isIE; });
|
|
232
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isEdge; });
|
|
233
|
+
/* unused harmony export isFirefox */
|
|
234
|
+
/* unused harmony export assert */
|
|
235
|
+
/* unused harmony export escapeRegexpString */
|
|
236
|
+
/* unused harmony export getOffsetWidth */
|
|
237
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isFunction; });
|
|
238
|
+
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
|
239
|
+
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
240
|
+
|
|
241
|
+
var noop = function noop() {};
|
|
242
|
+
|
|
243
|
+
var getScroll = function getScroll(w, top) {
|
|
244
|
+
var ret = top ? w.pageYOffset : w.pageXOffset;
|
|
245
|
+
var method = top ? 'scrollTop' : 'scrollLeft';
|
|
246
|
+
if (typeof ret !== 'number') {
|
|
247
|
+
var d = w.document;
|
|
248
|
+
// ie6,7,8 standard mode
|
|
249
|
+
ret = d.documentElement[method];
|
|
250
|
+
if (typeof ret !== 'number') {
|
|
251
|
+
// quirks mode
|
|
252
|
+
ret = d.body[method];
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return ret;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
var getClientPosition = function getClientPosition(elem) {
|
|
259
|
+
var box = void 0;
|
|
260
|
+
var x = void 0;
|
|
261
|
+
var y = void 0;
|
|
262
|
+
var doc = elem.ownerDocument;
|
|
263
|
+
var body = doc.body;
|
|
264
|
+
var docElem = doc && doc.documentElement;
|
|
265
|
+
box = elem.getBoundingClientRect();
|
|
266
|
+
x = box.left;
|
|
267
|
+
y = box.top;
|
|
268
|
+
x -= docElem.clientLeft || body.clientLeft || 0;
|
|
269
|
+
y -= docElem.clientTop || body.clientTop || 0;
|
|
270
|
+
return {
|
|
271
|
+
left: x,
|
|
272
|
+
top: y
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
var getOffsetLeft = function getOffsetLeft(el) {
|
|
277
|
+
var pos = getClientPosition(el);
|
|
278
|
+
var doc = el.ownerDocument;
|
|
279
|
+
var w = doc.defaultView || doc.parentWindow;
|
|
280
|
+
pos.left += getScroll(w);
|
|
281
|
+
return pos.left;
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* 获取对象深层级的对象,避免循环
|
|
285
|
+
* @export
|
|
286
|
+
* @param {*} sourceObj 源对象 {a:{b:{d:1}}}
|
|
287
|
+
* @param {*} pathName path组成的数组 例如:'a.b.c'
|
|
288
|
+
* @param {*} defaultValue 如果没有值默认的值 []
|
|
289
|
+
*/
|
|
290
|
+
function getValueByPath(sourceObj, pathName, defaultValue) {
|
|
291
|
+
var getValue = function getValue(sourceObj, pathNameArray) {
|
|
292
|
+
var key = pathNameArray.shift();
|
|
293
|
+
var value = sourceObj[key];
|
|
294
|
+
if (value === undefined || value === null) {
|
|
295
|
+
return defaultValue;
|
|
296
|
+
} else if (pathNameArray.length === 0) {
|
|
297
|
+
return value;
|
|
298
|
+
} else if (pathNameArray.length > 0) {
|
|
299
|
+
return getValue(value, pathNameArray);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
var pathNameArray = pathName.split('.');
|
|
303
|
+
return getValue(sourceObj, pathNameArray);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
*
|
|
307
|
+
* 判断两个数是否相等
|
|
308
|
+
* @param {*} a
|
|
309
|
+
* @param {*} b
|
|
310
|
+
* @returns
|
|
311
|
+
*/
|
|
312
|
+
var valueEquals = function valueEquals(a, b) {
|
|
313
|
+
// see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript
|
|
314
|
+
if (a === b) return true;
|
|
315
|
+
if (!(a instanceof Array)) return false;
|
|
316
|
+
if (!(b instanceof Array)) return false;
|
|
317
|
+
if (a.length !== b.length) return false;
|
|
318
|
+
for (var i = 0; i !== a.length; ++i) {
|
|
319
|
+
if (a[i] !== b[i]) return false;
|
|
320
|
+
}
|
|
321
|
+
return true;
|
|
322
|
+
};
|
|
323
|
+
// TODO: use native Array.find, Array.findIndex when IE support is dropped
|
|
324
|
+
var arrayFindIndex = function arrayFindIndex(arr, pred) {
|
|
325
|
+
for (var i = 0; i !== arr.length; ++i) {
|
|
326
|
+
if (pred(arr[i])) {
|
|
327
|
+
return i;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return -1;
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
var arrayFind = function arrayFind(arr, pred) {
|
|
334
|
+
var idx = arrayFindIndex(arr, pred);
|
|
335
|
+
return idx !== -1 ? arr[idx] : undefined;
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
// coerce truthy value to array
|
|
339
|
+
var coerceTruthyValueToArray = function coerceTruthyValueToArray(val) {
|
|
340
|
+
if (Array.isArray(val)) {
|
|
341
|
+
return val;
|
|
342
|
+
} else if (val) {
|
|
343
|
+
return [val];
|
|
344
|
+
} else {
|
|
345
|
+
return [];
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
var isIE = function isIE() {
|
|
350
|
+
return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && !isNaN(Number(document.documentMode));
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
var isEdge = function isEdge() {
|
|
354
|
+
return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
var isFirefox = function isFirefox() {
|
|
358
|
+
return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
var assert = function assert(condition, msg) {
|
|
362
|
+
if (!condition) throw new Error('[mds-ui] ' + msg);
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
*
|
|
366
|
+
* 特殊字符转译
|
|
367
|
+
* @param {string} [value='']
|
|
368
|
+
*/
|
|
369
|
+
var escapeRegexpString = function escapeRegexpString() {
|
|
370
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
371
|
+
return String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* Get element offset width
|
|
375
|
+
* @param {*} node HTMLDOMElemment
|
|
376
|
+
* @return {Number} width
|
|
377
|
+
*/
|
|
378
|
+
/**
|
|
379
|
+
* Get element offset width
|
|
380
|
+
* @param {*} node HTMLDOMElemment
|
|
381
|
+
* @return {Number} width
|
|
382
|
+
*/
|
|
383
|
+
var getOffsetWidth = function getOffsetWidth(node) {
|
|
384
|
+
return node ? node.offsetWidth : 0;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/** 判断是否为函数
|
|
388
|
+
* @param {*} functionToCheck
|
|
389
|
+
* @returns
|
|
390
|
+
*/
|
|
391
|
+
var isFunction = function isFunction(functionToCheck) {
|
|
392
|
+
var getType = {};
|
|
393
|
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/***/ }),
|
|
397
|
+
|
|
398
|
+
/***/ 12:
|
|
399
|
+
/***/ (function(module, exports) {
|
|
400
|
+
|
|
401
|
+
module.exports = require("babel-runtime/core-js/object/keys");
|
|
402
|
+
|
|
403
|
+
/***/ }),
|
|
404
|
+
|
|
405
|
+
/***/ 131:
|
|
406
|
+
/***/ (function(module, exports) {
|
|
407
|
+
|
|
408
|
+
// removed by extract-text-webpack-plugin
|
|
409
|
+
|
|
410
|
+
/***/ }),
|
|
411
|
+
|
|
412
|
+
/***/ 14:
|
|
413
|
+
/***/ (function(module, exports) {
|
|
414
|
+
|
|
415
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__14__;
|
|
416
|
+
|
|
417
|
+
/***/ }),
|
|
418
|
+
|
|
419
|
+
/***/ 15:
|
|
420
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
421
|
+
|
|
422
|
+
"use strict";
|
|
423
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return on; });
|
|
424
|
+
/* unused harmony export off */
|
|
425
|
+
/* unused harmony export once */
|
|
426
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return hasClass; });
|
|
427
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addClass; });
|
|
428
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return removeClass; });
|
|
429
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getStyle; });
|
|
430
|
+
/* unused harmony export setStyle */
|
|
431
|
+
/* unused harmony export isScroll */
|
|
432
|
+
/* unused harmony export getScrollContainer */
|
|
433
|
+
/* unused harmony export isInContainer */
|
|
434
|
+
/* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
|
|
435
|
+
/* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);
|
|
436
|
+
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
|
|
437
|
+
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_1__);
|
|
438
|
+
|
|
439
|
+
/* istanbul ignore next */
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
var isServer = vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer;
|
|
444
|
+
|
|
445
|
+
/* eslint no-useless-escape: 0 */
|
|
446
|
+
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
|
|
447
|
+
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
|
|
448
|
+
var ieVersion = isServer ? 0 : Number(document.documentMode);
|
|
449
|
+
|
|
450
|
+
/* istanbul ignore next */
|
|
451
|
+
var trim = function trim(string) {
|
|
452
|
+
return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
|
|
453
|
+
};
|
|
454
|
+
/* istanbul ignore next */
|
|
455
|
+
var camelCase = function camelCase(name) {
|
|
456
|
+
return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
|
|
457
|
+
return offset ? letter.toUpperCase() : letter;
|
|
458
|
+
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
/* istanbul ignore next */
|
|
462
|
+
var on = function () {
|
|
463
|
+
if (!isServer && document.addEventListener) {
|
|
464
|
+
return function (element, event, handler) {
|
|
465
|
+
if (element && event && handler) {
|
|
466
|
+
element.addEventListener(event, handler, false);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
} else {
|
|
470
|
+
return function (element, event, handler) {
|
|
471
|
+
if (element && event && handler) {
|
|
472
|
+
element.attachEvent('on' + event, handler);
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
}();
|
|
477
|
+
|
|
478
|
+
/* istanbul ignore next */
|
|
479
|
+
var off = function () {
|
|
480
|
+
if (!isServer && document.removeEventListener) {
|
|
481
|
+
return function (element, event, handler) {
|
|
482
|
+
if (element && event) {
|
|
483
|
+
element.removeEventListener(event, handler, false);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
} else {
|
|
487
|
+
return function (element, event, handler) {
|
|
488
|
+
if (element && event) {
|
|
489
|
+
element.detachEvent('on' + event, handler);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
}();
|
|
494
|
+
|
|
495
|
+
/* istanbul ignore next */
|
|
496
|
+
var once = function once(el, event, fn) {
|
|
497
|
+
var listener = function listener() {
|
|
498
|
+
if (fn) {
|
|
499
|
+
fn.apply(this, arguments);
|
|
500
|
+
}
|
|
501
|
+
off(el, event, listener);
|
|
502
|
+
};
|
|
503
|
+
on(el, event, listener);
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
/* istanbul ignore next */
|
|
507
|
+
function hasClass(el, cls) {
|
|
508
|
+
if (!el || !cls) return false;
|
|
509
|
+
if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
|
|
510
|
+
if (el.classList) {
|
|
511
|
+
return el.classList.contains(cls);
|
|
512
|
+
} else {
|
|
513
|
+
return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/* istanbul ignore next */
|
|
518
|
+
function addClass(el, cls) {
|
|
519
|
+
if (!el) return;
|
|
520
|
+
var curClass = el.className;
|
|
521
|
+
var classes = (cls || '').split(' ');
|
|
522
|
+
|
|
523
|
+
for (var i = 0, j = classes.length; i < j; i++) {
|
|
524
|
+
var clsName = classes[i];
|
|
525
|
+
if (!clsName) continue;
|
|
526
|
+
|
|
527
|
+
if (el.classList) {
|
|
528
|
+
el.classList.add(clsName);
|
|
529
|
+
} else if (!hasClass(el, clsName)) {
|
|
530
|
+
curClass += ' ' + clsName;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (!el.classList) {
|
|
534
|
+
el.className = curClass;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/* istanbul ignore next */
|
|
539
|
+
function removeClass(el, cls) {
|
|
540
|
+
if (!el || !cls) return;
|
|
541
|
+
var classes = cls.split(' ');
|
|
542
|
+
var curClass = ' ' + el.className + ' ';
|
|
543
|
+
|
|
544
|
+
for (var i = 0, j = classes.length; i < j; i++) {
|
|
545
|
+
var clsName = classes[i];
|
|
546
|
+
if (!clsName) continue;
|
|
547
|
+
|
|
548
|
+
if (el.classList) {
|
|
549
|
+
el.classList.remove(clsName);
|
|
550
|
+
} else if (hasClass(el, clsName)) {
|
|
551
|
+
curClass = curClass.replace(' ' + clsName + ' ', ' ');
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (!el.classList) {
|
|
555
|
+
el.className = trim(curClass);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/* istanbul ignore next */
|
|
560
|
+
var getStyle = ieVersion < 9 ? function (element, styleName) {
|
|
561
|
+
if (isServer) return;
|
|
562
|
+
if (!element || !styleName) return null;
|
|
563
|
+
styleName = camelCase(styleName);
|
|
564
|
+
if (styleName === 'float') {
|
|
565
|
+
styleName = 'styleFloat';
|
|
566
|
+
}
|
|
567
|
+
try {
|
|
568
|
+
switch (styleName) {
|
|
569
|
+
case 'opacity':
|
|
570
|
+
try {
|
|
571
|
+
return element.filters.item('alpha').opacity / 100;
|
|
572
|
+
} catch (e) {
|
|
573
|
+
return 1.0;
|
|
574
|
+
}
|
|
575
|
+
default:
|
|
576
|
+
return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
|
|
577
|
+
}
|
|
578
|
+
} catch (e) {
|
|
579
|
+
return element.style[styleName];
|
|
580
|
+
}
|
|
581
|
+
} : function (element, styleName) {
|
|
582
|
+
if (isServer) return;
|
|
583
|
+
if (!element || !styleName) return null;
|
|
584
|
+
styleName = camelCase(styleName);
|
|
585
|
+
if (styleName === 'float') {
|
|
586
|
+
styleName = 'cssFloat';
|
|
587
|
+
}
|
|
588
|
+
try {
|
|
589
|
+
var computed = document.defaultView.getComputedStyle(element, '');
|
|
590
|
+
return element.style[styleName] || computed ? computed[styleName] : null;
|
|
591
|
+
} catch (e) {
|
|
592
|
+
return element.style[styleName];
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
/* istanbul ignore next */
|
|
597
|
+
function setStyle(element, styleName, value) {
|
|
598
|
+
if (!element || !styleName) return;
|
|
599
|
+
|
|
600
|
+
if ((typeof styleName === 'undefined' ? 'undefined' : babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(styleName)) === 'object') {
|
|
601
|
+
for (var prop in styleName) {
|
|
602
|
+
if (styleName.hasOwnProperty(prop)) {
|
|
603
|
+
setStyle(element, prop, styleName[prop]);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
} else {
|
|
607
|
+
styleName = camelCase(styleName);
|
|
608
|
+
if (styleName === 'opacity' && ieVersion < 9) {
|
|
609
|
+
element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
|
|
610
|
+
} else {
|
|
611
|
+
element.style[styleName] = value;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
var isScroll = function isScroll(el, vertical) {
|
|
617
|
+
if (isServer) return;
|
|
618
|
+
|
|
619
|
+
var determinedDirection = vertical !== null || vertical !== undefined;
|
|
620
|
+
var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow');
|
|
621
|
+
|
|
622
|
+
return overflow.match(/(scroll|auto)/);
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
var getScrollContainer = function getScrollContainer(el, vertical) {
|
|
626
|
+
if (isServer) return;
|
|
627
|
+
|
|
628
|
+
var parent = el;
|
|
629
|
+
while (parent) {
|
|
630
|
+
if ([window, document, document.documentElement].includes(parent)) {
|
|
631
|
+
return window;
|
|
632
|
+
}
|
|
633
|
+
if (isScroll(parent, vertical)) {
|
|
634
|
+
return parent;
|
|
635
|
+
}
|
|
636
|
+
parent = parent.parentNode;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
return parent;
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
var isInContainer = function isInContainer(el, container) {
|
|
643
|
+
if (isServer || !el || !container) return false;
|
|
644
|
+
|
|
645
|
+
var elRect = el.getBoundingClientRect();
|
|
646
|
+
var containerRect = void 0;
|
|
647
|
+
|
|
648
|
+
if ([window, document, document.documentElement, null, undefined].includes(container)) {
|
|
649
|
+
containerRect = {
|
|
650
|
+
top: 0,
|
|
651
|
+
right: window.innerWidth,
|
|
652
|
+
bottom: window.innerHeight,
|
|
653
|
+
left: 0
|
|
654
|
+
};
|
|
655
|
+
} else {
|
|
656
|
+
containerRect = container.getBoundingClientRect();
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
/***/ }),
|
|
663
|
+
|
|
664
|
+
/***/ 205:
|
|
665
|
+
/***/ (function(module, exports) {
|
|
666
|
+
|
|
667
|
+
// removed by extract-text-webpack-plugin
|
|
668
|
+
|
|
669
|
+
/***/ }),
|
|
670
|
+
|
|
671
|
+
/***/ 207:
|
|
672
|
+
/***/ (function(module, exports) {
|
|
673
|
+
|
|
674
|
+
// removed by extract-text-webpack-plugin
|
|
675
|
+
|
|
676
|
+
/***/ }),
|
|
677
|
+
|
|
678
|
+
/***/ 24:
|
|
679
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
680
|
+
|
|
681
|
+
"use strict";
|
|
682
|
+
|
|
683
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/scroll-bar/scroll-bar.vue?vue&type=template&id=2fbcec38&
|
|
684
|
+
var render = function () {
|
|
685
|
+
var _vm = this
|
|
686
|
+
var _h = _vm.$createElement
|
|
687
|
+
var _c = _vm._self._c || _h
|
|
688
|
+
return _c(
|
|
689
|
+
"ul",
|
|
690
|
+
{ ref: "wrap", class: _vm.classes, attrs: { role: "mds-scroll-bar" } },
|
|
691
|
+
[_vm._t("default")],
|
|
692
|
+
2
|
|
693
|
+
)
|
|
694
|
+
}
|
|
695
|
+
var staticRenderFns = []
|
|
696
|
+
render._withStripped = true
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
// CONCATENATED MODULE: ./components/scroll-bar/scroll-bar.vue?vue&type=template&id=2fbcec38&
|
|
700
|
+
|
|
701
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/scroll-bar/scroll-bar.vue?vue&type=script&lang=js&
|
|
702
|
+
//
|
|
703
|
+
//
|
|
704
|
+
//
|
|
705
|
+
//
|
|
706
|
+
//
|
|
707
|
+
//
|
|
708
|
+
//
|
|
709
|
+
//
|
|
710
|
+
//
|
|
711
|
+
|
|
712
|
+
/* harmony default export */ var scroll_barvue_type_script_lang_js_ = ({
|
|
713
|
+
name: 'mdsScrollBar',
|
|
714
|
+
props: {
|
|
715
|
+
prefixCls: {
|
|
716
|
+
type: String,
|
|
717
|
+
default: 'mds-scroll-bar'
|
|
718
|
+
}
|
|
719
|
+
},
|
|
720
|
+
data: function data() {
|
|
721
|
+
return {};
|
|
722
|
+
},
|
|
723
|
+
|
|
724
|
+
computed: {
|
|
725
|
+
classes: function classes() {
|
|
726
|
+
var prefixCls = this.prefixCls;
|
|
727
|
+
return ['' + prefixCls, prefixCls + '-root'];
|
|
728
|
+
},
|
|
729
|
+
wrap: function wrap() {
|
|
730
|
+
return this.$refs.wrap;
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
methods: {},
|
|
734
|
+
created: function created() {}
|
|
735
|
+
});
|
|
736
|
+
// CONCATENATED MODULE: ./components/scroll-bar/scroll-bar.vue?vue&type=script&lang=js&
|
|
737
|
+
/* harmony default export */ var scroll_bar_scroll_barvue_type_script_lang_js_ = (scroll_barvue_type_script_lang_js_);
|
|
738
|
+
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
739
|
+
var componentNormalizer = __webpack_require__(0);
|
|
740
|
+
|
|
741
|
+
// CONCATENATED MODULE: ./components/scroll-bar/scroll-bar.vue
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
/* normalize component */
|
|
748
|
+
|
|
749
|
+
var component = Object(componentNormalizer["a" /* default */])(
|
|
750
|
+
scroll_bar_scroll_barvue_type_script_lang_js_,
|
|
751
|
+
render,
|
|
752
|
+
staticRenderFns,
|
|
753
|
+
false,
|
|
754
|
+
null,
|
|
755
|
+
null,
|
|
756
|
+
null
|
|
757
|
+
|
|
758
|
+
)
|
|
759
|
+
|
|
760
|
+
/* hot reload */
|
|
761
|
+
if (false) { var api; }
|
|
762
|
+
component.options.__file = "components/scroll-bar/scroll-bar.vue"
|
|
763
|
+
/* harmony default export */ var scroll_bar = (component.exports);
|
|
764
|
+
// CONCATENATED MODULE: ./components/scroll-bar/index.js
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
/* harmony default export */ var components_scroll_bar = __webpack_exports__["a"] = (scroll_bar);
|
|
768
|
+
|
|
769
|
+
/***/ }),
|
|
770
|
+
|
|
771
|
+
/***/ 3:
|
|
772
|
+
/***/ (function(module, exports) {
|
|
773
|
+
|
|
774
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
|
|
775
|
+
|
|
776
|
+
/***/ }),
|
|
777
|
+
|
|
778
|
+
/***/ 39:
|
|
779
|
+
/***/ (function(module, exports) {
|
|
780
|
+
|
|
781
|
+
module.exports = require("throttle-debounce");
|
|
782
|
+
|
|
783
|
+
/***/ }),
|
|
784
|
+
|
|
785
|
+
/***/ 4:
|
|
786
|
+
/***/ (function(module, exports) {
|
|
787
|
+
|
|
788
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
|
|
789
|
+
|
|
790
|
+
/***/ }),
|
|
791
|
+
|
|
792
|
+
/***/ 5:
|
|
793
|
+
/***/ (function(module, exports) {
|
|
794
|
+
|
|
795
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__5__;
|
|
796
|
+
|
|
797
|
+
/***/ }),
|
|
798
|
+
|
|
799
|
+
/***/ 55:
|
|
800
|
+
/***/ (function(module, exports) {
|
|
801
|
+
|
|
802
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__55__;
|
|
803
|
+
|
|
804
|
+
/***/ }),
|
|
805
|
+
|
|
806
|
+
/***/ 6:
|
|
807
|
+
/***/ (function(module, exports) {
|
|
808
|
+
|
|
809
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__6__;
|
|
810
|
+
|
|
811
|
+
/***/ }),
|
|
812
|
+
|
|
813
|
+
/***/ 65:
|
|
814
|
+
/***/ (function(module, exports) {
|
|
815
|
+
|
|
816
|
+
module.exports = require("babel-runtime/core-js/object/get-own-property-descriptor");
|
|
817
|
+
|
|
818
|
+
/***/ }),
|
|
819
|
+
|
|
820
|
+
/***/ 66:
|
|
821
|
+
/***/ (function(module, exports) {
|
|
822
|
+
|
|
823
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__66__;
|
|
824
|
+
|
|
825
|
+
/***/ }),
|
|
826
|
+
|
|
827
|
+
/***/ 8:
|
|
828
|
+
/***/ (function(module, exports) {
|
|
829
|
+
|
|
830
|
+
module.exports = require("babel-runtime/helpers/typeof");
|
|
831
|
+
|
|
832
|
+
/***/ }),
|
|
833
|
+
|
|
834
|
+
/***/ 84:
|
|
835
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
836
|
+
|
|
837
|
+
"use strict";
|
|
838
|
+
// ESM COMPAT FLAG
|
|
839
|
+
__webpack_require__.r(__webpack_exports__);
|
|
840
|
+
|
|
841
|
+
// EXTERNAL MODULE: ./components/style/index.less
|
|
842
|
+
var style = __webpack_require__(131);
|
|
843
|
+
|
|
844
|
+
// EXTERNAL MODULE: ./components/select/style/index.less
|
|
845
|
+
var select_style = __webpack_require__(205);
|
|
846
|
+
|
|
847
|
+
// EXTERNAL MODULE: ./components/select/style/transition.less
|
|
848
|
+
var transition = __webpack_require__(207);
|
|
849
|
+
|
|
850
|
+
// CONCATENATED MODULE: ./components/select/style/index.js
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/select/select.vue?vue&type=template&id=12933cc4&
|
|
855
|
+
var render = function () {
|
|
856
|
+
var _vm = this
|
|
857
|
+
var _h = _vm.$createElement
|
|
858
|
+
var _c = _vm._self._c || _h
|
|
859
|
+
return _c(
|
|
860
|
+
"div",
|
|
861
|
+
{
|
|
862
|
+
directives: [
|
|
863
|
+
{
|
|
864
|
+
name: "clickoutside",
|
|
865
|
+
rawName: "v-clickoutside",
|
|
866
|
+
value: _vm.handleClose,
|
|
867
|
+
expression: "handleClose",
|
|
868
|
+
},
|
|
869
|
+
],
|
|
870
|
+
class: _vm.wrapperClass,
|
|
871
|
+
on: {
|
|
872
|
+
click: function ($event) {
|
|
873
|
+
$event.stopPropagation()
|
|
874
|
+
return _vm.toggleMenu($event)
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
},
|
|
878
|
+
[
|
|
879
|
+
_vm.multiple
|
|
880
|
+
? _c(
|
|
881
|
+
"div",
|
|
882
|
+
{
|
|
883
|
+
ref: "tags",
|
|
884
|
+
class: _vm.wrapperTagsClass,
|
|
885
|
+
style: { "max-width": _vm.inputWidth - 32 + "px", width: "100%" },
|
|
886
|
+
},
|
|
887
|
+
[
|
|
888
|
+
_vm.selected.length
|
|
889
|
+
? _c(
|
|
890
|
+
"span",
|
|
891
|
+
[
|
|
892
|
+
_vm.collapseTags
|
|
893
|
+
? [
|
|
894
|
+
_c(
|
|
895
|
+
"mds-tag",
|
|
896
|
+
{
|
|
897
|
+
key: _vm.getValueKey(_vm.selected[0]),
|
|
898
|
+
ref: "tag",
|
|
899
|
+
attrs: {
|
|
900
|
+
closable: true,
|
|
901
|
+
size: _vm.size,
|
|
902
|
+
type: "info",
|
|
903
|
+
useTransition: false,
|
|
904
|
+
},
|
|
905
|
+
on: {
|
|
906
|
+
close: function ($event) {
|
|
907
|
+
return _vm.deleteTag(
|
|
908
|
+
$event,
|
|
909
|
+
_vm.selected[0]
|
|
910
|
+
)
|
|
911
|
+
},
|
|
912
|
+
},
|
|
913
|
+
},
|
|
914
|
+
[
|
|
915
|
+
_c(
|
|
916
|
+
"span",
|
|
917
|
+
{ class: _vm.prefixCls + "-tags-text" },
|
|
918
|
+
[
|
|
919
|
+
_vm._v(
|
|
920
|
+
_vm._s(
|
|
921
|
+
_vm.echoKey
|
|
922
|
+
? _vm.selected[0][_vm.echoKey]
|
|
923
|
+
: _vm.selected[0].currentLabel
|
|
924
|
+
)
|
|
925
|
+
),
|
|
926
|
+
]
|
|
927
|
+
),
|
|
928
|
+
]
|
|
929
|
+
),
|
|
930
|
+
_vm.selected.length > 1
|
|
931
|
+
? _c(
|
|
932
|
+
"mds-tag",
|
|
933
|
+
{
|
|
934
|
+
key: "collapseTagsName",
|
|
935
|
+
attrs: {
|
|
936
|
+
closable: false,
|
|
937
|
+
size: _vm.size,
|
|
938
|
+
type: "info",
|
|
939
|
+
},
|
|
940
|
+
},
|
|
941
|
+
[
|
|
942
|
+
_c(
|
|
943
|
+
"span",
|
|
944
|
+
{ class: _vm.prefixCls + "-tags-text" },
|
|
945
|
+
[
|
|
946
|
+
_vm._v(
|
|
947
|
+
"+ " + _vm._s(_vm.selected.length - 1)
|
|
948
|
+
),
|
|
949
|
+
]
|
|
950
|
+
),
|
|
951
|
+
]
|
|
952
|
+
)
|
|
953
|
+
: _vm._e(),
|
|
954
|
+
]
|
|
955
|
+
: _c(
|
|
956
|
+
"transition-group",
|
|
957
|
+
{ on: { "after-leave": _vm.resetInputHeight } },
|
|
958
|
+
_vm._l(_vm.selected, function (item) {
|
|
959
|
+
return _c(
|
|
960
|
+
"mds-tag",
|
|
961
|
+
{
|
|
962
|
+
key: _vm.getValueKey(item),
|
|
963
|
+
ref: "tag",
|
|
964
|
+
refInFor: true,
|
|
965
|
+
attrs: {
|
|
966
|
+
closable: !_vm.selectDisabled,
|
|
967
|
+
size: _vm.size,
|
|
968
|
+
hit: item.hitState,
|
|
969
|
+
type: "info",
|
|
970
|
+
},
|
|
971
|
+
on: {
|
|
972
|
+
close: function ($event) {
|
|
973
|
+
return _vm.deleteTag($event, item)
|
|
974
|
+
},
|
|
975
|
+
},
|
|
976
|
+
},
|
|
977
|
+
[
|
|
978
|
+
_c(
|
|
979
|
+
"span",
|
|
980
|
+
{ class: _vm.prefixCls + "-tags-text" },
|
|
981
|
+
[
|
|
982
|
+
_vm._v(
|
|
983
|
+
_vm._s(
|
|
984
|
+
_vm.echoKey
|
|
985
|
+
? item[_vm.echoKey]
|
|
986
|
+
: item.currentLabel
|
|
987
|
+
)
|
|
988
|
+
),
|
|
989
|
+
]
|
|
990
|
+
),
|
|
991
|
+
]
|
|
992
|
+
)
|
|
993
|
+
}),
|
|
994
|
+
1
|
|
995
|
+
),
|
|
996
|
+
],
|
|
997
|
+
2
|
|
998
|
+
)
|
|
999
|
+
: _vm._e(),
|
|
1000
|
+
_vm.filterable
|
|
1001
|
+
? _c("input", {
|
|
1002
|
+
directives: [
|
|
1003
|
+
{
|
|
1004
|
+
name: "model",
|
|
1005
|
+
rawName: "v-model",
|
|
1006
|
+
value: _vm.query,
|
|
1007
|
+
expression: "query",
|
|
1008
|
+
},
|
|
1009
|
+
],
|
|
1010
|
+
ref: "input",
|
|
1011
|
+
class: _vm.wrapperSearchInputClass,
|
|
1012
|
+
style: {
|
|
1013
|
+
"flex-grow": "1",
|
|
1014
|
+
width: _vm.inputLength / (_vm.inputWidth - 32) + "%",
|
|
1015
|
+
"max-width": _vm.inputWidth - 42 + "px",
|
|
1016
|
+
},
|
|
1017
|
+
attrs: {
|
|
1018
|
+
type: "text",
|
|
1019
|
+
disabled: _vm.selectDisabled,
|
|
1020
|
+
autocomplete: _vm.autoComplete || _vm.autocomplete,
|
|
1021
|
+
},
|
|
1022
|
+
domProps: { value: _vm.query },
|
|
1023
|
+
on: {
|
|
1024
|
+
focus: _vm.handleFocus,
|
|
1025
|
+
blur: function ($event) {
|
|
1026
|
+
_vm.softFocus = false
|
|
1027
|
+
},
|
|
1028
|
+
keyup: _vm.managePlaceholder,
|
|
1029
|
+
keydown: [
|
|
1030
|
+
_vm.resetInputState,
|
|
1031
|
+
function ($event) {
|
|
1032
|
+
if (
|
|
1033
|
+
!$event.type.indexOf("key") &&
|
|
1034
|
+
_vm._k($event.keyCode, "down", 40, $event.key, [
|
|
1035
|
+
"Down",
|
|
1036
|
+
"ArrowDown",
|
|
1037
|
+
])
|
|
1038
|
+
) {
|
|
1039
|
+
return null
|
|
1040
|
+
}
|
|
1041
|
+
$event.preventDefault()
|
|
1042
|
+
return _vm.navigateOptions("next")
|
|
1043
|
+
},
|
|
1044
|
+
function ($event) {
|
|
1045
|
+
if (
|
|
1046
|
+
!$event.type.indexOf("key") &&
|
|
1047
|
+
_vm._k($event.keyCode, "up", 38, $event.key, [
|
|
1048
|
+
"Up",
|
|
1049
|
+
"ArrowUp",
|
|
1050
|
+
])
|
|
1051
|
+
) {
|
|
1052
|
+
return null
|
|
1053
|
+
}
|
|
1054
|
+
$event.preventDefault()
|
|
1055
|
+
return _vm.navigateOptions("prev")
|
|
1056
|
+
},
|
|
1057
|
+
function ($event) {
|
|
1058
|
+
if (
|
|
1059
|
+
!$event.type.indexOf("key") &&
|
|
1060
|
+
_vm._k(
|
|
1061
|
+
$event.keyCode,
|
|
1062
|
+
"enter",
|
|
1063
|
+
13,
|
|
1064
|
+
$event.key,
|
|
1065
|
+
"Enter"
|
|
1066
|
+
)
|
|
1067
|
+
) {
|
|
1068
|
+
return null
|
|
1069
|
+
}
|
|
1070
|
+
$event.preventDefault()
|
|
1071
|
+
return _vm.selectOption($event)
|
|
1072
|
+
},
|
|
1073
|
+
function ($event) {
|
|
1074
|
+
if (
|
|
1075
|
+
!$event.type.indexOf("key") &&
|
|
1076
|
+
_vm._k($event.keyCode, "esc", 27, $event.key, [
|
|
1077
|
+
"Esc",
|
|
1078
|
+
"Escape",
|
|
1079
|
+
])
|
|
1080
|
+
) {
|
|
1081
|
+
return null
|
|
1082
|
+
}
|
|
1083
|
+
$event.stopPropagation()
|
|
1084
|
+
$event.preventDefault()
|
|
1085
|
+
_vm.visible = false
|
|
1086
|
+
},
|
|
1087
|
+
function ($event) {
|
|
1088
|
+
if (
|
|
1089
|
+
!$event.type.indexOf("key") &&
|
|
1090
|
+
_vm._k(
|
|
1091
|
+
$event.keyCode,
|
|
1092
|
+
"delete",
|
|
1093
|
+
[8, 46],
|
|
1094
|
+
$event.key,
|
|
1095
|
+
["Backspace", "Delete", "Del"]
|
|
1096
|
+
)
|
|
1097
|
+
) {
|
|
1098
|
+
return null
|
|
1099
|
+
}
|
|
1100
|
+
return _vm.deletePrevTag($event)
|
|
1101
|
+
},
|
|
1102
|
+
function ($event) {
|
|
1103
|
+
if (
|
|
1104
|
+
!$event.type.indexOf("key") &&
|
|
1105
|
+
_vm._k($event.keyCode, "tab", 9, $event.key, "Tab")
|
|
1106
|
+
) {
|
|
1107
|
+
return null
|
|
1108
|
+
}
|
|
1109
|
+
_vm.visible = false
|
|
1110
|
+
},
|
|
1111
|
+
],
|
|
1112
|
+
compositionstart: _vm.handleComposition,
|
|
1113
|
+
compositionupdate: _vm.handleComposition,
|
|
1114
|
+
compositionend: _vm.handleComposition,
|
|
1115
|
+
input: [
|
|
1116
|
+
function ($event) {
|
|
1117
|
+
if ($event.target.composing) {
|
|
1118
|
+
return
|
|
1119
|
+
}
|
|
1120
|
+
_vm.query = $event.target.value
|
|
1121
|
+
},
|
|
1122
|
+
_vm.debouncedQueryChange,
|
|
1123
|
+
],
|
|
1124
|
+
},
|
|
1125
|
+
})
|
|
1126
|
+
: _vm._e(),
|
|
1127
|
+
]
|
|
1128
|
+
)
|
|
1129
|
+
: _vm._e(),
|
|
1130
|
+
_c(
|
|
1131
|
+
"mds-input",
|
|
1132
|
+
{
|
|
1133
|
+
ref: "reference",
|
|
1134
|
+
class: { "is-focus": _vm.visible },
|
|
1135
|
+
attrs: {
|
|
1136
|
+
type: "text",
|
|
1137
|
+
placeholder: _vm.currentPlaceholder,
|
|
1138
|
+
name: _vm.name,
|
|
1139
|
+
id: _vm.id,
|
|
1140
|
+
autocomplete: _vm.autoComplete || _vm.autocomplete,
|
|
1141
|
+
size: _vm.size,
|
|
1142
|
+
disabled: _vm.selectDisabled,
|
|
1143
|
+
readonly: _vm.readonly,
|
|
1144
|
+
"validate-event": false,
|
|
1145
|
+
tabindex: _vm.multiple && _vm.filterable ? "-1" : null,
|
|
1146
|
+
},
|
|
1147
|
+
on: { focus: _vm.handleFocus, blur: _vm.handleBlur },
|
|
1148
|
+
nativeOn: {
|
|
1149
|
+
keyup: function ($event) {
|
|
1150
|
+
return _vm.debouncedOnInputChange($event)
|
|
1151
|
+
},
|
|
1152
|
+
keydown: [
|
|
1153
|
+
function ($event) {
|
|
1154
|
+
if (
|
|
1155
|
+
!$event.type.indexOf("key") &&
|
|
1156
|
+
_vm._k($event.keyCode, "down", 40, $event.key, [
|
|
1157
|
+
"Down",
|
|
1158
|
+
"ArrowDown",
|
|
1159
|
+
])
|
|
1160
|
+
) {
|
|
1161
|
+
return null
|
|
1162
|
+
}
|
|
1163
|
+
$event.stopPropagation()
|
|
1164
|
+
$event.preventDefault()
|
|
1165
|
+
return _vm.navigateOptions("next")
|
|
1166
|
+
},
|
|
1167
|
+
function ($event) {
|
|
1168
|
+
if (
|
|
1169
|
+
!$event.type.indexOf("key") &&
|
|
1170
|
+
_vm._k($event.keyCode, "up", 38, $event.key, [
|
|
1171
|
+
"Up",
|
|
1172
|
+
"ArrowUp",
|
|
1173
|
+
])
|
|
1174
|
+
) {
|
|
1175
|
+
return null
|
|
1176
|
+
}
|
|
1177
|
+
$event.stopPropagation()
|
|
1178
|
+
$event.preventDefault()
|
|
1179
|
+
return _vm.navigateOptions("prev")
|
|
1180
|
+
},
|
|
1181
|
+
function ($event) {
|
|
1182
|
+
if (
|
|
1183
|
+
!$event.type.indexOf("key") &&
|
|
1184
|
+
_vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
|
1185
|
+
) {
|
|
1186
|
+
return null
|
|
1187
|
+
}
|
|
1188
|
+
$event.preventDefault()
|
|
1189
|
+
return _vm.selectOption($event)
|
|
1190
|
+
},
|
|
1191
|
+
function ($event) {
|
|
1192
|
+
if (
|
|
1193
|
+
!$event.type.indexOf("key") &&
|
|
1194
|
+
_vm._k($event.keyCode, "esc", 27, $event.key, [
|
|
1195
|
+
"Esc",
|
|
1196
|
+
"Escape",
|
|
1197
|
+
])
|
|
1198
|
+
) {
|
|
1199
|
+
return null
|
|
1200
|
+
}
|
|
1201
|
+
$event.stopPropagation()
|
|
1202
|
+
$event.preventDefault()
|
|
1203
|
+
_vm.visible = false
|
|
1204
|
+
},
|
|
1205
|
+
function ($event) {
|
|
1206
|
+
if (
|
|
1207
|
+
!$event.type.indexOf("key") &&
|
|
1208
|
+
_vm._k($event.keyCode, "tab", 9, $event.key, "Tab")
|
|
1209
|
+
) {
|
|
1210
|
+
return null
|
|
1211
|
+
}
|
|
1212
|
+
_vm.visible = false
|
|
1213
|
+
},
|
|
1214
|
+
],
|
|
1215
|
+
paste: function ($event) {
|
|
1216
|
+
return _vm.debouncedOnInputChange($event)
|
|
1217
|
+
},
|
|
1218
|
+
mouseenter: function ($event) {
|
|
1219
|
+
_vm.inputHovering = true
|
|
1220
|
+
},
|
|
1221
|
+
mouseleave: function ($event) {
|
|
1222
|
+
_vm.inputHovering = false
|
|
1223
|
+
},
|
|
1224
|
+
},
|
|
1225
|
+
model: {
|
|
1226
|
+
value: _vm.selectedLabel,
|
|
1227
|
+
callback: function ($$v) {
|
|
1228
|
+
_vm.selectedLabel = $$v
|
|
1229
|
+
},
|
|
1230
|
+
expression: "selectedLabel",
|
|
1231
|
+
},
|
|
1232
|
+
},
|
|
1233
|
+
[
|
|
1234
|
+
_vm.$slots.prefix
|
|
1235
|
+
? _c("template", { slot: "prefix" }, [_vm._t("prefix")], 2)
|
|
1236
|
+
: _vm._e(),
|
|
1237
|
+
_c("template", { slot: "suffix" }, [
|
|
1238
|
+
_c("i", {
|
|
1239
|
+
directives: [
|
|
1240
|
+
{
|
|
1241
|
+
name: "show",
|
|
1242
|
+
rawName: "v-show",
|
|
1243
|
+
value: !_vm.showClose,
|
|
1244
|
+
expression: "!showClose",
|
|
1245
|
+
},
|
|
1246
|
+
],
|
|
1247
|
+
staticClass:
|
|
1248
|
+
"mdsicon mdsicon-fill-solid-down mds-select-drop-icon",
|
|
1249
|
+
class: _vm.iconClass,
|
|
1250
|
+
}),
|
|
1251
|
+
_vm.showClose
|
|
1252
|
+
? _c("i", {
|
|
1253
|
+
staticClass:
|
|
1254
|
+
"mdsicon mdsicon-line-close mds-select-close-icon",
|
|
1255
|
+
on: { click: _vm.handleClearClick },
|
|
1256
|
+
})
|
|
1257
|
+
: _vm._e(),
|
|
1258
|
+
]),
|
|
1259
|
+
],
|
|
1260
|
+
2
|
|
1261
|
+
),
|
|
1262
|
+
_c(
|
|
1263
|
+
"transition",
|
|
1264
|
+
{
|
|
1265
|
+
attrs: { name: "mds-select-zoom-in-top" },
|
|
1266
|
+
on: {
|
|
1267
|
+
"before-enter": _vm.handleMenuEnter,
|
|
1268
|
+
"after-leave": _vm.doDestroy,
|
|
1269
|
+
},
|
|
1270
|
+
},
|
|
1271
|
+
[
|
|
1272
|
+
_c(
|
|
1273
|
+
"mds-drop-down",
|
|
1274
|
+
{
|
|
1275
|
+
directives: [
|
|
1276
|
+
{
|
|
1277
|
+
name: "show",
|
|
1278
|
+
rawName: "v-show",
|
|
1279
|
+
value: _vm.visible && _vm.emptyText !== false,
|
|
1280
|
+
expression: "visible && emptyText !== false",
|
|
1281
|
+
},
|
|
1282
|
+
],
|
|
1283
|
+
ref: "popper",
|
|
1284
|
+
attrs: {
|
|
1285
|
+
"append-to-body": _vm.popperAppendToBody,
|
|
1286
|
+
size: _vm.selectSize,
|
|
1287
|
+
hasSlot: _vm.hasSlot,
|
|
1288
|
+
},
|
|
1289
|
+
},
|
|
1290
|
+
[
|
|
1291
|
+
_vm.hasSlot ? _vm._t("dropDownRender") : _vm._e(),
|
|
1292
|
+
_c(
|
|
1293
|
+
"mds-scroll-bar",
|
|
1294
|
+
[
|
|
1295
|
+
_vm.showNewOption
|
|
1296
|
+
? _c("mds-option", {
|
|
1297
|
+
attrs: { value: _vm.query, created: "" },
|
|
1298
|
+
})
|
|
1299
|
+
: _vm._e(),
|
|
1300
|
+
_vm._t("default"),
|
|
1301
|
+
],
|
|
1302
|
+
2
|
|
1303
|
+
),
|
|
1304
|
+
_vm.emptyText &&
|
|
1305
|
+
(!_vm.allowCreate ||
|
|
1306
|
+
_vm.loading ||
|
|
1307
|
+
(_vm.allowCreate && _vm.options.length === 0))
|
|
1308
|
+
? [
|
|
1309
|
+
_vm.$slots.empty
|
|
1310
|
+
? _vm._t("empty")
|
|
1311
|
+
: _c("p", { staticClass: "mds-select-dropdown-empty" }, [
|
|
1312
|
+
_vm._v(
|
|
1313
|
+
"\n " +
|
|
1314
|
+
_vm._s(_vm.emptyText) +
|
|
1315
|
+
"\n "
|
|
1316
|
+
),
|
|
1317
|
+
]),
|
|
1318
|
+
]
|
|
1319
|
+
: _vm._e(),
|
|
1320
|
+
],
|
|
1321
|
+
2
|
|
1322
|
+
),
|
|
1323
|
+
],
|
|
1324
|
+
1
|
|
1325
|
+
),
|
|
1326
|
+
],
|
|
1327
|
+
1
|
|
1328
|
+
)
|
|
1329
|
+
}
|
|
1330
|
+
var staticRenderFns = []
|
|
1331
|
+
render._withStripped = true
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
// CONCATENATED MODULE: ./components/select/select.vue?vue&type=template&id=12933cc4&
|
|
1335
|
+
|
|
1336
|
+
// EXTERNAL MODULE: external "babel-runtime/core-js/object/keys"
|
|
1337
|
+
var keys_ = __webpack_require__(12);
|
|
1338
|
+
var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
|
|
1339
|
+
|
|
1340
|
+
// EXTERNAL MODULE: external "./input"
|
|
1341
|
+
var external_input_ = __webpack_require__(10);
|
|
1342
|
+
var external_input_default = /*#__PURE__*/__webpack_require__.n(external_input_);
|
|
1343
|
+
|
|
1344
|
+
// EXTERNAL MODULE: external "./_mixin/emitter"
|
|
1345
|
+
var emitter_ = __webpack_require__(6);
|
|
1346
|
+
var emitter_default = /*#__PURE__*/__webpack_require__.n(emitter_);
|
|
1347
|
+
|
|
1348
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/select/select-dropdown.vue?vue&type=template&id=30ac5bac&
|
|
1349
|
+
var select_dropdownvue_type_template_id_30ac5bac_render = function () {
|
|
1350
|
+
var _vm = this
|
|
1351
|
+
var _h = _vm.$createElement
|
|
1352
|
+
var _c = _vm._self._c || _h
|
|
1353
|
+
return _c(
|
|
1354
|
+
"div",
|
|
1355
|
+
{
|
|
1356
|
+
ref: "popper",
|
|
1357
|
+
class: _vm.wrapperClass,
|
|
1358
|
+
style: { minWidth: _vm.minWidth },
|
|
1359
|
+
},
|
|
1360
|
+
[_vm._t("default")],
|
|
1361
|
+
2
|
|
1362
|
+
)
|
|
1363
|
+
}
|
|
1364
|
+
var select_dropdownvue_type_template_id_30ac5bac_staticRenderFns = []
|
|
1365
|
+
select_dropdownvue_type_template_id_30ac5bac_render._withStripped = true
|
|
1366
|
+
|
|
1367
|
+
|
|
1368
|
+
// CONCATENATED MODULE: ./components/select/select-dropdown.vue?vue&type=template&id=30ac5bac&
|
|
1369
|
+
|
|
1370
|
+
// EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
|
|
1371
|
+
var defineProperty_ = __webpack_require__(1);
|
|
1372
|
+
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
|
|
1373
|
+
|
|
1374
|
+
// EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
|
|
1375
|
+
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(5);
|
|
1376
|
+
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default = /*#__PURE__*/__webpack_require__.n(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_);
|
|
1377
|
+
|
|
1378
|
+
// CONCATENATED MODULE: ./components/_util/merge.js
|
|
1379
|
+
/* harmony default export */ var merge = (function (target) {
|
|
1380
|
+
for (var i = 1, j = arguments.length; i < j; i++) {
|
|
1381
|
+
var source = arguments[i] || {};
|
|
1382
|
+
for (var prop in source) {
|
|
1383
|
+
if (source.hasOwnProperty(prop)) {
|
|
1384
|
+
var value = source[prop];
|
|
1385
|
+
if (value !== undefined) {
|
|
1386
|
+
target[prop] = value;
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
return target;
|
|
1392
|
+
});
|
|
1393
|
+
// EXTERNAL MODULE: ./components/_util/dom.js
|
|
1394
|
+
var _util_dom = __webpack_require__(15);
|
|
1395
|
+
|
|
1396
|
+
// CONCATENATED MODULE: ./components/_util/popup/popup-manager.js
|
|
1397
|
+
|
|
1398
|
+
|
|
1399
|
+
|
|
1400
|
+
var hasModal = false;
|
|
1401
|
+
var hasInitZIndex = false;
|
|
1402
|
+
var popup_manager_zIndex = void 0;
|
|
1403
|
+
|
|
1404
|
+
var popup_manager_getModal = function getModal() {
|
|
1405
|
+
if (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$isServer) return;
|
|
1406
|
+
var modalDom = PopupManager.modalDom;
|
|
1407
|
+
if (modalDom) {
|
|
1408
|
+
hasModal = true;
|
|
1409
|
+
} else {
|
|
1410
|
+
hasModal = false;
|
|
1411
|
+
modalDom = document.createElement('div');
|
|
1412
|
+
PopupManager.modalDom = modalDom;
|
|
1413
|
+
|
|
1414
|
+
modalDom.addEventListener('touchmove', function (event) {
|
|
1415
|
+
event.preventDefault();
|
|
1416
|
+
event.stopPropagation();
|
|
1417
|
+
});
|
|
1418
|
+
|
|
1419
|
+
modalDom.addEventListener('click', function () {
|
|
1420
|
+
PopupManager.doOnModalClick && PopupManager.doOnModalClick();
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
|
|
1424
|
+
return modalDom;
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
var instances = {};
|
|
1428
|
+
|
|
1429
|
+
var PopupManager = {
|
|
1430
|
+
modalFade: true,
|
|
1431
|
+
|
|
1432
|
+
getInstance: function getInstance(id) {
|
|
1433
|
+
return instances[id];
|
|
1434
|
+
},
|
|
1435
|
+
|
|
1436
|
+
register: function register(id, instance) {
|
|
1437
|
+
if (id && instance) {
|
|
1438
|
+
instances[id] = instance;
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
|
|
1442
|
+
deregister: function deregister(id) {
|
|
1443
|
+
if (id) {
|
|
1444
|
+
instances[id] = null;
|
|
1445
|
+
delete instances[id];
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
|
|
1449
|
+
nextZIndex: function nextZIndex() {
|
|
1450
|
+
return PopupManager.zIndex++;
|
|
1451
|
+
},
|
|
1452
|
+
|
|
1453
|
+
modalStack: [],
|
|
1454
|
+
|
|
1455
|
+
doOnModalClick: function doOnModalClick() {
|
|
1456
|
+
var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
|
|
1457
|
+
if (!topItem) return;
|
|
1458
|
+
|
|
1459
|
+
var instance = PopupManager.getInstance(topItem.id);
|
|
1460
|
+
if (instance && instance.closeOnClickModal) {
|
|
1461
|
+
instance.close();
|
|
1462
|
+
}
|
|
1463
|
+
},
|
|
1464
|
+
|
|
1465
|
+
openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
|
|
1466
|
+
if (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$isServer) return;
|
|
1467
|
+
if (!id || zIndex === undefined) return;
|
|
1468
|
+
this.modalFade = modalFade;
|
|
1469
|
+
|
|
1470
|
+
var modalStack = this.modalStack;
|
|
1471
|
+
|
|
1472
|
+
for (var i = 0, j = modalStack.length; i < j; i++) {
|
|
1473
|
+
var item = modalStack[i];
|
|
1474
|
+
if (item.id === id) {
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
var modalDom = popup_manager_getModal();
|
|
1480
|
+
|
|
1481
|
+
Object(_util_dom["a" /* addClass */])(modalDom, 'v-modal');
|
|
1482
|
+
if (this.modalFade && !hasModal) {
|
|
1483
|
+
Object(_util_dom["a" /* addClass */])(modalDom, 'v-modal-enter');
|
|
1484
|
+
}
|
|
1485
|
+
if (modalClass) {
|
|
1486
|
+
var classArr = modalClass.trim().split(/\s+/);
|
|
1487
|
+
classArr.forEach(function (item) {
|
|
1488
|
+
return Object(_util_dom["a" /* addClass */])(modalDom, item);
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
setTimeout(function () {
|
|
1492
|
+
Object(_util_dom["e" /* removeClass */])(modalDom, 'v-modal-enter');
|
|
1493
|
+
}, 200);
|
|
1494
|
+
|
|
1495
|
+
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
|
|
1496
|
+
dom.parentNode.appendChild(modalDom);
|
|
1497
|
+
} else {
|
|
1498
|
+
document.body.appendChild(modalDom);
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
if (zIndex) {
|
|
1502
|
+
modalDom.style.zIndex = zIndex;
|
|
1503
|
+
}
|
|
1504
|
+
modalDom.tabIndex = 0;
|
|
1505
|
+
modalDom.style.display = '';
|
|
1506
|
+
|
|
1507
|
+
this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
|
|
1508
|
+
},
|
|
1509
|
+
|
|
1510
|
+
closeModal: function closeModal(id) {
|
|
1511
|
+
var modalStack = this.modalStack;
|
|
1512
|
+
var modalDom = popup_manager_getModal();
|
|
1513
|
+
|
|
1514
|
+
if (modalStack.length > 0) {
|
|
1515
|
+
var topItem = modalStack[modalStack.length - 1];
|
|
1516
|
+
if (topItem.id === id) {
|
|
1517
|
+
if (topItem.modalClass) {
|
|
1518
|
+
var classArr = topItem.modalClass.trim().split(/\s+/);
|
|
1519
|
+
classArr.forEach(function (item) {
|
|
1520
|
+
return Object(_util_dom["e" /* removeClass */])(modalDom, item);
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
modalStack.pop();
|
|
1525
|
+
if (modalStack.length > 0) {
|
|
1526
|
+
modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
|
|
1527
|
+
}
|
|
1528
|
+
} else {
|
|
1529
|
+
for (var i = modalStack.length - 1; i >= 0; i--) {
|
|
1530
|
+
if (modalStack[i].id === id) {
|
|
1531
|
+
modalStack.splice(i, 1);
|
|
1532
|
+
break;
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
if (modalStack.length === 0) {
|
|
1539
|
+
if (this.modalFade) {
|
|
1540
|
+
Object(_util_dom["a" /* addClass */])(modalDom, 'v-modal-leave');
|
|
1541
|
+
}
|
|
1542
|
+
setTimeout(function () {
|
|
1543
|
+
if (modalStack.length === 0) {
|
|
1544
|
+
if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
|
|
1545
|
+
modalDom.style.display = 'none';
|
|
1546
|
+
PopupManager.modalDom = undefined;
|
|
1547
|
+
}
|
|
1548
|
+
Object(_util_dom["e" /* removeClass */])(modalDom, 'v-modal-leave');
|
|
1549
|
+
}, 200);
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
};
|
|
1553
|
+
|
|
1554
|
+
Object.defineProperty(PopupManager, 'zIndex', {
|
|
1555
|
+
configurable: true,
|
|
1556
|
+
get: function get() {
|
|
1557
|
+
if (!hasInitZIndex) {
|
|
1558
|
+
popup_manager_zIndex = popup_manager_zIndex || (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$ELEMENT || {}).zIndex || 2000;
|
|
1559
|
+
hasInitZIndex = true;
|
|
1560
|
+
}
|
|
1561
|
+
return popup_manager_zIndex;
|
|
1562
|
+
},
|
|
1563
|
+
set: function set(value) {
|
|
1564
|
+
popup_manager_zIndex = value;
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
|
|
1568
|
+
var popup_manager_getTopPopup = function getTopPopup() {
|
|
1569
|
+
if (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$isServer) return;
|
|
1570
|
+
if (PopupManager.modalStack.length > 0) {
|
|
1571
|
+
var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
|
|
1572
|
+
if (!topPopup) return;
|
|
1573
|
+
var instance = PopupManager.getInstance(topPopup.id);
|
|
1574
|
+
|
|
1575
|
+
return instance;
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
|
|
1579
|
+
if (!external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$isServer) {
|
|
1580
|
+
// handle `esc` key when the popup is shown
|
|
1581
|
+
window.addEventListener('keydown', function (event) {
|
|
1582
|
+
if (event.keyCode === 27) {
|
|
1583
|
+
var topPopup = popup_manager_getTopPopup();
|
|
1584
|
+
|
|
1585
|
+
if (topPopup && topPopup.closeOnPressEscape) {
|
|
1586
|
+
topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/* harmony default export */ var popup_manager = (PopupManager);
|
|
1593
|
+
// CONCATENATED MODULE: ./components/_util/scrollbar-width.js
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
var scrollBarWidth = void 0;
|
|
1597
|
+
|
|
1598
|
+
/* harmony default export */ var scrollbar_width = (function () {
|
|
1599
|
+
if (external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$isServer) return 0;
|
|
1600
|
+
if (scrollBarWidth !== undefined) return scrollBarWidth;
|
|
1601
|
+
|
|
1602
|
+
var outer = document.createElement('div');
|
|
1603
|
+
outer.className = 'mds-scrollbar__wrap';
|
|
1604
|
+
outer.style.visibility = 'hidden';
|
|
1605
|
+
outer.style.width = '100px';
|
|
1606
|
+
outer.style.position = 'absolute';
|
|
1607
|
+
outer.style.top = '-9999px';
|
|
1608
|
+
document.body.appendChild(outer);
|
|
1609
|
+
|
|
1610
|
+
var widthNoScroll = outer.offsetWidth;
|
|
1611
|
+
outer.style.overflow = 'scroll';
|
|
1612
|
+
|
|
1613
|
+
var inner = document.createElement('div');
|
|
1614
|
+
inner.style.width = '100%';
|
|
1615
|
+
outer.appendChild(inner);
|
|
1616
|
+
|
|
1617
|
+
var widthWithScroll = inner.offsetWidth;
|
|
1618
|
+
outer.parentNode.removeChild(outer);
|
|
1619
|
+
scrollBarWidth = widthNoScroll - widthWithScroll;
|
|
1620
|
+
|
|
1621
|
+
return scrollBarWidth;
|
|
1622
|
+
});
|
|
1623
|
+
// CONCATENATED MODULE: ./components/_util/popup/index.js
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
var idSeed = 1;
|
|
1631
|
+
|
|
1632
|
+
var popup_scrollBarWidth = void 0;
|
|
1633
|
+
|
|
1634
|
+
/* harmony default export */ var popup = ({
|
|
1635
|
+
props: {
|
|
1636
|
+
visible: {
|
|
1637
|
+
type: Boolean,
|
|
1638
|
+
default: false
|
|
1639
|
+
},
|
|
1640
|
+
openDelay: {},
|
|
1641
|
+
closeDelay: {},
|
|
1642
|
+
zIndex: {},
|
|
1643
|
+
modal: {
|
|
1644
|
+
type: Boolean,
|
|
1645
|
+
default: false
|
|
1646
|
+
},
|
|
1647
|
+
modalFade: {
|
|
1648
|
+
type: Boolean,
|
|
1649
|
+
default: true
|
|
1650
|
+
},
|
|
1651
|
+
modalClass: {},
|
|
1652
|
+
modalAppendToBody: {
|
|
1653
|
+
type: Boolean,
|
|
1654
|
+
default: false
|
|
1655
|
+
},
|
|
1656
|
+
lockScroll: {
|
|
1657
|
+
type: Boolean,
|
|
1658
|
+
default: true
|
|
1659
|
+
},
|
|
1660
|
+
closeOnPressEscape: {
|
|
1661
|
+
type: Boolean,
|
|
1662
|
+
default: false
|
|
1663
|
+
},
|
|
1664
|
+
closeOnClickModal: {
|
|
1665
|
+
type: Boolean,
|
|
1666
|
+
default: false
|
|
1667
|
+
}
|
|
1668
|
+
},
|
|
1669
|
+
|
|
1670
|
+
beforeMount: function beforeMount() {
|
|
1671
|
+
this._popupId = 'popup-' + idSeed++;
|
|
1672
|
+
popup_manager.register(this._popupId, this);
|
|
1673
|
+
},
|
|
1674
|
+
beforeDestroy: function beforeDestroy() {
|
|
1675
|
+
popup_manager.deregister(this._popupId);
|
|
1676
|
+
popup_manager.closeModal(this._popupId);
|
|
1677
|
+
|
|
1678
|
+
this.restoreBodyStyle();
|
|
1679
|
+
},
|
|
1680
|
+
data: function data() {
|
|
1681
|
+
return {
|
|
1682
|
+
opened: false,
|
|
1683
|
+
bodyPaddingRight: null,
|
|
1684
|
+
computedBodyPaddingRight: 0,
|
|
1685
|
+
withoutHiddenClass: true,
|
|
1686
|
+
rendered: false
|
|
1687
|
+
};
|
|
1688
|
+
},
|
|
1689
|
+
|
|
1690
|
+
|
|
1691
|
+
watch: {
|
|
1692
|
+
visible: function visible(val) {
|
|
1693
|
+
var _this = this;
|
|
1694
|
+
|
|
1695
|
+
if (val) {
|
|
1696
|
+
if (this._opening) return;
|
|
1697
|
+
if (!this.rendered) {
|
|
1698
|
+
this.rendered = true;
|
|
1699
|
+
external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.nextTick(function () {
|
|
1700
|
+
_this.open();
|
|
1701
|
+
});
|
|
1702
|
+
} else {
|
|
1703
|
+
this.open();
|
|
1704
|
+
}
|
|
1705
|
+
} else {
|
|
1706
|
+
this.close();
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
},
|
|
1710
|
+
|
|
1711
|
+
methods: {
|
|
1712
|
+
open: function open(options) {
|
|
1713
|
+
var _this2 = this;
|
|
1714
|
+
|
|
1715
|
+
if (!this.rendered) {
|
|
1716
|
+
this.rendered = true;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
var props = merge({}, this.$props || this, options);
|
|
1720
|
+
|
|
1721
|
+
if (this._closeTimer) {
|
|
1722
|
+
clearTimeout(this._closeTimer);
|
|
1723
|
+
this._closeTimer = null;
|
|
1724
|
+
}
|
|
1725
|
+
clearTimeout(this._openTimer);
|
|
1726
|
+
|
|
1727
|
+
var openDelay = Number(props.openDelay);
|
|
1728
|
+
if (openDelay > 0) {
|
|
1729
|
+
this._openTimer = setTimeout(function () {
|
|
1730
|
+
_this2._openTimer = null;
|
|
1731
|
+
_this2.doOpen(props);
|
|
1732
|
+
}, openDelay);
|
|
1733
|
+
} else {
|
|
1734
|
+
this.doOpen(props);
|
|
1735
|
+
}
|
|
1736
|
+
},
|
|
1737
|
+
doOpen: function doOpen(props) {
|
|
1738
|
+
if (this.$isServer) return;
|
|
1739
|
+
if (this.willOpen && !this.willOpen()) return;
|
|
1740
|
+
if (this.opened) return;
|
|
1741
|
+
|
|
1742
|
+
this._opening = true;
|
|
1743
|
+
|
|
1744
|
+
var dom = this.$el;
|
|
1745
|
+
|
|
1746
|
+
var modal = props.modal;
|
|
1747
|
+
|
|
1748
|
+
var zIndex = props.zIndex;
|
|
1749
|
+
if (zIndex) {
|
|
1750
|
+
popup_manager.zIndex = zIndex;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
if (modal) {
|
|
1754
|
+
if (this._closing) {
|
|
1755
|
+
popup_manager.closeModal(this._popupId);
|
|
1756
|
+
this._closing = false;
|
|
1757
|
+
}
|
|
1758
|
+
popup_manager.openModal(this._popupId, popup_manager.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
|
|
1759
|
+
if (props.lockScroll) {
|
|
1760
|
+
this.withoutHiddenClass = !Object(_util_dom["c" /* hasClass */])(document.body, 'mds-popup-parent--hidden');
|
|
1761
|
+
if (this.withoutHiddenClass) {
|
|
1762
|
+
this.bodyPaddingRight = document.body.style.paddingRight;
|
|
1763
|
+
this.computedBodyPaddingRight = parseInt(Object(_util_dom["b" /* getStyle */])(document.body, 'paddingRight'), 10);
|
|
1764
|
+
}
|
|
1765
|
+
popup_scrollBarWidth = scrollbar_width();
|
|
1766
|
+
var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
|
|
1767
|
+
var bodyOverflowY = Object(_util_dom["b" /* getStyle */])(document.body, 'overflowY');
|
|
1768
|
+
if (popup_scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
|
|
1769
|
+
document.body.style.paddingRight = this.computedBodyPaddingRight + popup_scrollBarWidth + 'px';
|
|
1770
|
+
}
|
|
1771
|
+
Object(_util_dom["a" /* addClass */])(document.body, 'mds-popup-parent--hidden');
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
if (getComputedStyle(dom).position === 'static') {
|
|
1776
|
+
dom.style.position = 'absolute';
|
|
1777
|
+
}
|
|
1778
|
+
dom.style.zIndex = popup_manager.nextZIndex();
|
|
1779
|
+
this.opened = true;
|
|
1780
|
+
|
|
1781
|
+
this.onOpen && this.onOpen();
|
|
1782
|
+
|
|
1783
|
+
this.doAfterOpen();
|
|
1784
|
+
},
|
|
1785
|
+
doAfterOpen: function doAfterOpen() {
|
|
1786
|
+
this._opening = false;
|
|
1787
|
+
},
|
|
1788
|
+
close: function close() {
|
|
1789
|
+
var _this3 = this;
|
|
1790
|
+
|
|
1791
|
+
if (this.willClose && !this.willClose()) return;
|
|
1792
|
+
|
|
1793
|
+
if (this._openTimer !== null) {
|
|
1794
|
+
clearTimeout(this._openTimer);
|
|
1795
|
+
this._openTimer = null;
|
|
1796
|
+
}
|
|
1797
|
+
clearTimeout(this._closeTimer);
|
|
1798
|
+
|
|
1799
|
+
var closeDelay = Number(this.closeDelay);
|
|
1800
|
+
|
|
1801
|
+
if (closeDelay > 0) {
|
|
1802
|
+
this._closeTimer = setTimeout(function () {
|
|
1803
|
+
_this3._closeTimer = null;
|
|
1804
|
+
_this3.doClose();
|
|
1805
|
+
}, closeDelay);
|
|
1806
|
+
} else {
|
|
1807
|
+
this.doClose();
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
doClose: function doClose() {
|
|
1811
|
+
this._closing = true;
|
|
1812
|
+
|
|
1813
|
+
this.onClose && this.onClose();
|
|
1814
|
+
|
|
1815
|
+
if (this.lockScroll) {
|
|
1816
|
+
setTimeout(this.restoreBodyStyle, 200);
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
this.opened = false;
|
|
1820
|
+
|
|
1821
|
+
this.doAfterClose();
|
|
1822
|
+
},
|
|
1823
|
+
doAfterClose: function doAfterClose() {
|
|
1824
|
+
popup_manager.closeModal(this._popupId);
|
|
1825
|
+
this._closing = false;
|
|
1826
|
+
},
|
|
1827
|
+
restoreBodyStyle: function restoreBodyStyle() {
|
|
1828
|
+
if (this.modal && this.withoutHiddenClass) {
|
|
1829
|
+
document.body.style.paddingRight = this.bodyPaddingRight;
|
|
1830
|
+
Object(_util_dom["e" /* removeClass */])(document.body, 'mds-popup-parent--hidden');
|
|
1831
|
+
}
|
|
1832
|
+
this.withoutHiddenClass = true;
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
});
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
// EXTERNAL MODULE: external "babel-runtime/core-js/object/get-own-property-descriptor"
|
|
1839
|
+
var get_own_property_descriptor_ = __webpack_require__(65);
|
|
1840
|
+
var get_own_property_descriptor_default = /*#__PURE__*/__webpack_require__.n(get_own_property_descriptor_);
|
|
1841
|
+
|
|
1842
|
+
// EXTERNAL MODULE: external "babel-runtime/core-js/object/assign"
|
|
1843
|
+
var assign_ = __webpack_require__(9);
|
|
1844
|
+
var assign_default = /*#__PURE__*/__webpack_require__.n(assign_);
|
|
1845
|
+
|
|
1846
|
+
// CONCATENATED MODULE: ./components/_util/popper.js
|
|
1847
|
+
|
|
1848
|
+
|
|
1849
|
+
|
|
1850
|
+
/**
|
|
1851
|
+
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
|
1852
|
+
* @version {{version}}
|
|
1853
|
+
* @license
|
|
1854
|
+
* Copyright (c) 2016 Federico Zivolo and contributors
|
|
1855
|
+
*
|
|
1856
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1857
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
1858
|
+
* in the Software without restriction, including without limitation the rights
|
|
1859
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1860
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
1861
|
+
* furnished to do so, subject to the following conditions:
|
|
1862
|
+
*
|
|
1863
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
1864
|
+
* copies or substantial portions of the Software.
|
|
1865
|
+
*
|
|
1866
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1867
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1868
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1869
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1870
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1871
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1872
|
+
* SOFTWARE.
|
|
1873
|
+
*/
|
|
1874
|
+
|
|
1875
|
+
//
|
|
1876
|
+
// Cross module loader
|
|
1877
|
+
// Supported: Node, AMD, Browser globals
|
|
1878
|
+
//
|
|
1879
|
+
function popper_createPopper() {
|
|
1880
|
+
'use strict';
|
|
1881
|
+
|
|
1882
|
+
var root = window;
|
|
1883
|
+
// default options
|
|
1884
|
+
var DEFAULTS = {
|
|
1885
|
+
// placement of the popper
|
|
1886
|
+
placement: 'bottom',
|
|
1887
|
+
|
|
1888
|
+
gpuAcceleration: true,
|
|
1889
|
+
|
|
1890
|
+
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
1891
|
+
offset: 0,
|
|
1892
|
+
|
|
1893
|
+
// the element which will act as boundary of the popper
|
|
1894
|
+
boundariesElement: 'viewport',
|
|
1895
|
+
|
|
1896
|
+
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
1897
|
+
boundariesPadding: 5,
|
|
1898
|
+
|
|
1899
|
+
// popper will try to prevent overflow following this order,
|
|
1900
|
+
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
1901
|
+
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
1902
|
+
|
|
1903
|
+
// the behavior used by flip to change the placement of the popper
|
|
1904
|
+
flipBehavior: 'flip',
|
|
1905
|
+
|
|
1906
|
+
arrowElement: '[x-arrow]',
|
|
1907
|
+
|
|
1908
|
+
arrowOffset: 0,
|
|
1909
|
+
|
|
1910
|
+
// list of functions used to modify the offsets before they are applied to the popper
|
|
1911
|
+
modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
|
|
1912
|
+
|
|
1913
|
+
modifiersIgnored: [],
|
|
1914
|
+
|
|
1915
|
+
forceAbsolute: false
|
|
1916
|
+
|
|
1917
|
+
/**
|
|
1918
|
+
* Create a new Popper.js instance
|
|
1919
|
+
* @constructor Popper
|
|
1920
|
+
* @param {HTMLElement} reference - The reference element used to position the popper
|
|
1921
|
+
* @param {HTMLElement|Object} popper
|
|
1922
|
+
* The HTML element used as popper, or a configuration used to generate the popper.
|
|
1923
|
+
* @param {String} [popper.tagName='div'] The tag name of the generated popper.
|
|
1924
|
+
* @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
|
|
1925
|
+
* @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
|
|
1926
|
+
* @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
|
|
1927
|
+
* @param {String} [popper.content=''] The content of the popper, it can be text, html, or node if it is not text, set `contentType` to `html` or `node`.
|
|
1928
|
+
* @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
|
|
1929
|
+
* @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
|
|
1930
|
+
* @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
|
|
1931
|
+
* @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
|
|
1932
|
+
* @param {Object} options
|
|
1933
|
+
* @param {String} [options.placement=bottom]
|
|
1934
|
+
* Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
|
|
1935
|
+
* left(-start, -end)`
|
|
1936
|
+
*
|
|
1937
|
+
* @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
|
|
1938
|
+
* The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
|
|
1939
|
+
* its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
|
|
1940
|
+
* reference element.
|
|
1941
|
+
* By default, it will look for a child node of the popper with the `x-arrow` attribute.
|
|
1942
|
+
*
|
|
1943
|
+
* @param {Boolean} [options.gpuAcceleration=true]
|
|
1944
|
+
* When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
|
|
1945
|
+
* browser to use the GPU to accelerate the rendering.
|
|
1946
|
+
* If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
|
|
1947
|
+
*
|
|
1948
|
+
* @param {Number} [options.offset=0]
|
|
1949
|
+
* Amount of pixels the popper will be shifted (can be negative).
|
|
1950
|
+
*
|
|
1951
|
+
* @param {String|Element} [options.boundariesElement='viewport']
|
|
1952
|
+
* The element which will define the boundaries of the popper position, the popper will never be placed outside
|
|
1953
|
+
* of the defined boundaries (except if `keepTogether` is enabled)
|
|
1954
|
+
*
|
|
1955
|
+
* @param {Number} [options.boundariesPadding=5]
|
|
1956
|
+
* Additional padding for the boundaries
|
|
1957
|
+
*
|
|
1958
|
+
* @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
|
|
1959
|
+
* Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
|
|
1960
|
+
* this means that the last ones will never overflow
|
|
1961
|
+
*
|
|
1962
|
+
* @param {String|Array} [options.flipBehavior='flip']
|
|
1963
|
+
* The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
|
|
1964
|
+
* overlap its reference element. Defining `flip` as value, the placement will be flipped on
|
|
1965
|
+
* its axis (`right - left`, `top - bottom`).
|
|
1966
|
+
* You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
|
|
1967
|
+
* how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
|
|
1968
|
+
* then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
|
|
1969
|
+
*
|
|
1970
|
+
* @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
|
|
1971
|
+
* List of functions used to modify the data before they are applied to the popper, add your custom functions
|
|
1972
|
+
* to this array to edit the offsets and placement.
|
|
1973
|
+
* The function should reflect the @params and @returns of preventOverflow
|
|
1974
|
+
*
|
|
1975
|
+
* @param {Array} [options.modifiersIgnored=[]]
|
|
1976
|
+
* Put here any built-in modifier name you want to exclude from the modifiers list
|
|
1977
|
+
* The function should reflect the @params and @returns of preventOverflow
|
|
1978
|
+
*
|
|
1979
|
+
* @param {Boolean} [options.removeOnDestroy=false]
|
|
1980
|
+
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
|
|
1981
|
+
*/
|
|
1982
|
+
};function Popper(reference, popper, options) {
|
|
1983
|
+
this._reference = reference.jquery ? reference[0] : reference;
|
|
1984
|
+
this.state = {};
|
|
1985
|
+
|
|
1986
|
+
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
1987
|
+
// generate a default popper if is not defined
|
|
1988
|
+
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
1989
|
+
var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
|
|
1990
|
+
if (isNotDefined || isConfig) {
|
|
1991
|
+
this._popper = this.parse(isConfig ? popper : {});
|
|
1992
|
+
} else {
|
|
1993
|
+
// otherwise, use the given HTMLElement as popper
|
|
1994
|
+
this._popper = popper.jquery ? popper[0] : popper;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
// with {} we create a new object with the options inside it
|
|
1998
|
+
this._options = assign_default()({}, DEFAULTS, options);
|
|
1999
|
+
|
|
2000
|
+
// refactoring modifiers' list
|
|
2001
|
+
this._options.modifiers = this._options.modifiers.map(function (modifier) {
|
|
2002
|
+
// remove ignored modifiers
|
|
2003
|
+
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
|
|
2004
|
+
|
|
2005
|
+
// set the x-placement attribute before everything else because it could be used to add margins to the popper
|
|
2006
|
+
// margins needs to be calculated to get the correct popper offsets
|
|
2007
|
+
if (modifier === 'applyStyle') {
|
|
2008
|
+
this._popper.setAttribute('x-placement', this._options.placement);
|
|
2009
|
+
}
|
|
2010
|
+
|
|
2011
|
+
// return predefined modifier identified by string or keep the custom one
|
|
2012
|
+
return this.modifiers[modifier] || modifier;
|
|
2013
|
+
}.bind(this));
|
|
2014
|
+
|
|
2015
|
+
// make sure to apply the popper position before any computation
|
|
2016
|
+
this.state.position = this._getPosition(this._popper, this._reference);
|
|
2017
|
+
setStyle(this._popper, { position: this.state.position, top: 0 });
|
|
2018
|
+
|
|
2019
|
+
// fire the first update to position the popper in the right place
|
|
2020
|
+
this.update();
|
|
2021
|
+
|
|
2022
|
+
// setup event listeners, they will take care of update the position in specific situations
|
|
2023
|
+
this._setupEventListeners();
|
|
2024
|
+
return this;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
//
|
|
2028
|
+
// Methods
|
|
2029
|
+
//
|
|
2030
|
+
/**
|
|
2031
|
+
* Destroy the popper
|
|
2032
|
+
* @method
|
|
2033
|
+
* @memberof Popper
|
|
2034
|
+
*/
|
|
2035
|
+
Popper.prototype.destroy = function () {
|
|
2036
|
+
this._popper.removeAttribute('x-placement');
|
|
2037
|
+
this._popper.style.left = '';
|
|
2038
|
+
this._popper.style.position = '';
|
|
2039
|
+
this._popper.style.top = '';
|
|
2040
|
+
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
2041
|
+
this._removeEventListeners();
|
|
2042
|
+
|
|
2043
|
+
// remove the popper if user explicity asked for the deletion on destroy
|
|
2044
|
+
if (this._options.removeOnDestroy) {
|
|
2045
|
+
this._popper.remove();
|
|
2046
|
+
}
|
|
2047
|
+
return this;
|
|
2048
|
+
};
|
|
2049
|
+
|
|
2050
|
+
/**
|
|
2051
|
+
* Updates the position of the popper, computing the new offsets and applying the new style
|
|
2052
|
+
* @method
|
|
2053
|
+
* @memberof Popper
|
|
2054
|
+
*/
|
|
2055
|
+
Popper.prototype.update = function () {
|
|
2056
|
+
var data = { instance: this, styles: {}
|
|
2057
|
+
|
|
2058
|
+
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
2059
|
+
// and refer to _originalPlacement to know the original value
|
|
2060
|
+
};data.placement = this._options.placement;
|
|
2061
|
+
data._originalPlacement = this._options.placement;
|
|
2062
|
+
|
|
2063
|
+
// compute the popper and reference offsets and put them inside data.offsets
|
|
2064
|
+
data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
|
|
2065
|
+
|
|
2066
|
+
// get boundaries
|
|
2067
|
+
data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
|
|
2068
|
+
|
|
2069
|
+
data = this.runModifiers(data, this._options.modifiers);
|
|
2070
|
+
|
|
2071
|
+
if (typeof this.state.updateCallback === 'function') {
|
|
2072
|
+
this.state.updateCallback(data);
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
|
|
2076
|
+
/**
|
|
2077
|
+
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
|
|
2078
|
+
* @method
|
|
2079
|
+
* @memberof Popper
|
|
2080
|
+
* @param {Function} callback
|
|
2081
|
+
*/
|
|
2082
|
+
Popper.prototype.onCreate = function (callback) {
|
|
2083
|
+
// the createCallbacks return as first argument the popper instance
|
|
2084
|
+
|
|
2085
|
+
/* eslint standard/no-callback-literal: 0 */
|
|
2086
|
+
callback(this);
|
|
2087
|
+
return this;
|
|
2088
|
+
};
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
|
|
2092
|
+
* used to style popper and its arrow.
|
|
2093
|
+
* NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
|
|
2094
|
+
* @method
|
|
2095
|
+
* @memberof Popper
|
|
2096
|
+
* @param {Function} callback
|
|
2097
|
+
*/
|
|
2098
|
+
Popper.prototype.onUpdate = function (callback) {
|
|
2099
|
+
this.state.updateCallback = callback;
|
|
2100
|
+
return this;
|
|
2101
|
+
};
|
|
2102
|
+
|
|
2103
|
+
/**
|
|
2104
|
+
* Helper used to generate poppers from a configuration file
|
|
2105
|
+
* @method
|
|
2106
|
+
* @memberof Popper
|
|
2107
|
+
* @param config {Object} configuration
|
|
2108
|
+
* @returns {HTMLElement} popper
|
|
2109
|
+
*/
|
|
2110
|
+
Popper.prototype.parse = function (config) {
|
|
2111
|
+
var defaultConfig = {
|
|
2112
|
+
tagName: 'div',
|
|
2113
|
+
classNames: ['popper'],
|
|
2114
|
+
attributes: [],
|
|
2115
|
+
parent: root.document.body,
|
|
2116
|
+
content: '',
|
|
2117
|
+
contentType: 'text',
|
|
2118
|
+
arrowTagName: 'div',
|
|
2119
|
+
arrowClassNames: ['popper__arrow'],
|
|
2120
|
+
arrowAttributes: ['x-arrow']
|
|
2121
|
+
};
|
|
2122
|
+
config = assign_default()({}, defaultConfig, config);
|
|
2123
|
+
|
|
2124
|
+
var d = root.document;
|
|
2125
|
+
|
|
2126
|
+
var popper = d.createElement(config.tagName);
|
|
2127
|
+
addClassNames(popper, config.classNames);
|
|
2128
|
+
addAttributes(popper, config.attributes);
|
|
2129
|
+
if (config.contentType === 'node') {
|
|
2130
|
+
popper.appendChild(config.content.jquery ? config.content[0] : config.content);
|
|
2131
|
+
} else if (config.contentType === 'html') {
|
|
2132
|
+
popper.innerHTML = config.content;
|
|
2133
|
+
} else {
|
|
2134
|
+
popper.textContent = config.content;
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
if (config.arrowTagName) {
|
|
2138
|
+
var arrow = d.createElement(config.arrowTagName);
|
|
2139
|
+
addClassNames(arrow, config.arrowClassNames);
|
|
2140
|
+
addAttributes(arrow, config.arrowAttributes);
|
|
2141
|
+
popper.appendChild(arrow);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
var parent = config.parent.jquery ? config.parent[0] : config.parent;
|
|
2145
|
+
|
|
2146
|
+
// if the given parent is a string, use it to match an element
|
|
2147
|
+
// if more than one element is matched, the first one will be used as parent
|
|
2148
|
+
// if no elements are matched, the script will throw an error
|
|
2149
|
+
if (typeof parent === 'string') {
|
|
2150
|
+
parent = d.querySelectorAll(config.parent);
|
|
2151
|
+
if (parent.length > 1) {
|
|
2152
|
+
console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
|
|
2153
|
+
}
|
|
2154
|
+
if (parent.length === 0) {
|
|
2155
|
+
throw new Error('ERROR: the given parent doesn\'t exists!');
|
|
2156
|
+
}
|
|
2157
|
+
parent = parent[0];
|
|
2158
|
+
}
|
|
2159
|
+
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
|
|
2160
|
+
// the first one will be used as parent
|
|
2161
|
+
if (parent.length > 1 && parent instanceof Element === false) {
|
|
2162
|
+
console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
|
|
2163
|
+
parent = parent[0];
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
// append the generated popper to its parent
|
|
2167
|
+
parent.appendChild(popper);
|
|
2168
|
+
|
|
2169
|
+
return popper;
|
|
2170
|
+
|
|
2171
|
+
/**
|
|
2172
|
+
* Adds class names to the given element
|
|
2173
|
+
* @function
|
|
2174
|
+
* @ignore
|
|
2175
|
+
* @param {HTMLElement} target
|
|
2176
|
+
* @param {Array} classes
|
|
2177
|
+
*/
|
|
2178
|
+
function addClassNames(element, classNames) {
|
|
2179
|
+
classNames.forEach(function (className) {
|
|
2180
|
+
element.classList.add(className);
|
|
2181
|
+
});
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* Adds attributes to the given element
|
|
2186
|
+
* @function
|
|
2187
|
+
* @ignore
|
|
2188
|
+
* @param {HTMLElement} target
|
|
2189
|
+
* @param {Array} attributes
|
|
2190
|
+
* @example
|
|
2191
|
+
* addAttributes(element, [ 'data-info:foobar' ])
|
|
2192
|
+
*/
|
|
2193
|
+
function addAttributes(element, attributes) {
|
|
2194
|
+
attributes.forEach(function (attribute) {
|
|
2195
|
+
element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
|
|
2196
|
+
});
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* Helper used to get the position which will be applied to the popper
|
|
2202
|
+
* @method
|
|
2203
|
+
* @memberof Popper
|
|
2204
|
+
* @param config {HTMLElement} popper element
|
|
2205
|
+
* @param reference {HTMLElement} reference element
|
|
2206
|
+
* @returns {String} position
|
|
2207
|
+
*/
|
|
2208
|
+
Popper.prototype._getPosition = function (popper, reference) {
|
|
2209
|
+
var container = getOffsetParent(reference);
|
|
2210
|
+
|
|
2211
|
+
if (this._options.forceAbsolute) {
|
|
2212
|
+
return 'absolute';
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
// Decide if the popper will be fixed
|
|
2216
|
+
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
2217
|
+
var isParentFixed = isFixed(reference, container);
|
|
2218
|
+
return isParentFixed ? 'fixed' : 'absolute';
|
|
2219
|
+
};
|
|
2220
|
+
|
|
2221
|
+
/**
|
|
2222
|
+
* Get offsets to the popper
|
|
2223
|
+
* @method
|
|
2224
|
+
* @memberof Popper
|
|
2225
|
+
* @access private
|
|
2226
|
+
* @param {Element} popper - the popper element
|
|
2227
|
+
* @param {Element} reference - the reference element (the popper will be relative to this)
|
|
2228
|
+
* @returns {Object} An object containing the offsets which will be applied to the popper
|
|
2229
|
+
*/
|
|
2230
|
+
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
2231
|
+
placement = placement.split('-')[0];
|
|
2232
|
+
var popperOffsets = {};
|
|
2233
|
+
|
|
2234
|
+
popperOffsets.position = this.state.position;
|
|
2235
|
+
var isParentFixed = popperOffsets.position === 'fixed';
|
|
2236
|
+
|
|
2237
|
+
//
|
|
2238
|
+
// Get reference element position
|
|
2239
|
+
//
|
|
2240
|
+
var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
|
|
2241
|
+
|
|
2242
|
+
//
|
|
2243
|
+
// Get popper sizes
|
|
2244
|
+
//
|
|
2245
|
+
var popperRect = getOuterSizes(popper);
|
|
2246
|
+
|
|
2247
|
+
//
|
|
2248
|
+
// Compute offsets of popper
|
|
2249
|
+
//
|
|
2250
|
+
|
|
2251
|
+
// depending by the popper placement we have to compute its offsets slightly differently
|
|
2252
|
+
if (['right', 'left'].indexOf(placement) !== -1) {
|
|
2253
|
+
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
|
|
2254
|
+
if (placement === 'left') {
|
|
2255
|
+
popperOffsets.left = referenceOffsets.left - popperRect.width;
|
|
2256
|
+
} else {
|
|
2257
|
+
popperOffsets.left = referenceOffsets.right;
|
|
2258
|
+
}
|
|
2259
|
+
} else {
|
|
2260
|
+
popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
|
|
2261
|
+
if (placement === 'top') {
|
|
2262
|
+
popperOffsets.top = referenceOffsets.top - popperRect.height;
|
|
2263
|
+
} else {
|
|
2264
|
+
popperOffsets.top = referenceOffsets.bottom;
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
// Add width and height to our offsets object
|
|
2269
|
+
popperOffsets.width = popperRect.width;
|
|
2270
|
+
popperOffsets.height = popperRect.height;
|
|
2271
|
+
|
|
2272
|
+
return {
|
|
2273
|
+
popper: popperOffsets,
|
|
2274
|
+
reference: referenceOffsets
|
|
2275
|
+
};
|
|
2276
|
+
};
|
|
2277
|
+
|
|
2278
|
+
/**
|
|
2279
|
+
* Setup needed event listeners used to update the popper position
|
|
2280
|
+
* @method
|
|
2281
|
+
* @memberof Popper
|
|
2282
|
+
* @access private
|
|
2283
|
+
*/
|
|
2284
|
+
Popper.prototype._setupEventListeners = function () {
|
|
2285
|
+
// NOTE: 1 DOM access here
|
|
2286
|
+
this.state.updateBound = this.update.bind(this);
|
|
2287
|
+
root.addEventListener('resize', this.state.updateBound);
|
|
2288
|
+
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
2289
|
+
if (this._options.boundariesElement !== 'window') {
|
|
2290
|
+
var target = getScrollParent(this._reference);
|
|
2291
|
+
// here it could be both `body` or `documentElement` thanks to Firefox, we then check both
|
|
2292
|
+
if (target === root.document.body || target === root.document.documentElement) {
|
|
2293
|
+
target = root;
|
|
2294
|
+
}
|
|
2295
|
+
target.addEventListener('scroll', this.state.updateBound);
|
|
2296
|
+
this.state.scrollTarget = target;
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
|
|
2300
|
+
/**
|
|
2301
|
+
* Remove event listeners used to update the popper position
|
|
2302
|
+
* @method
|
|
2303
|
+
* @memberof Popper
|
|
2304
|
+
* @access private
|
|
2305
|
+
*/
|
|
2306
|
+
Popper.prototype._removeEventListeners = function () {
|
|
2307
|
+
// NOTE: 1 DOM access here
|
|
2308
|
+
root.removeEventListener('resize', this.state.updateBound);
|
|
2309
|
+
if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
|
|
2310
|
+
this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
|
|
2311
|
+
this.state.scrollTarget = null;
|
|
2312
|
+
}
|
|
2313
|
+
this.state.updateBound = null;
|
|
2314
|
+
};
|
|
2315
|
+
|
|
2316
|
+
/**
|
|
2317
|
+
* Computed the boundaries limits and return them
|
|
2318
|
+
* @method
|
|
2319
|
+
* @memberof Popper
|
|
2320
|
+
* @access private
|
|
2321
|
+
* @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
|
|
2322
|
+
* @param {Number} padding - Boundaries padding
|
|
2323
|
+
* @param {Element} boundariesElement - Element used to define the boundaries
|
|
2324
|
+
* @returns {Object} Coordinates of the boundaries
|
|
2325
|
+
*/
|
|
2326
|
+
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
2327
|
+
// NOTE: 1 DOM access here
|
|
2328
|
+
var boundaries = {};
|
|
2329
|
+
var width, height;
|
|
2330
|
+
if (boundariesElement === 'window') {
|
|
2331
|
+
var body = root.document.body;
|
|
2332
|
+
var html = root.document.documentElement;
|
|
2333
|
+
|
|
2334
|
+
height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
|
|
2335
|
+
width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
|
|
2336
|
+
|
|
2337
|
+
boundaries = {
|
|
2338
|
+
top: 0,
|
|
2339
|
+
right: width,
|
|
2340
|
+
bottom: height,
|
|
2341
|
+
left: 0
|
|
2342
|
+
};
|
|
2343
|
+
} else if (boundariesElement === 'viewport') {
|
|
2344
|
+
var offsetParent = getOffsetParent(this._popper);
|
|
2345
|
+
var scrollParent = getScrollParent(this._popper);
|
|
2346
|
+
var offsetParentRect = getOffsetRect(offsetParent);
|
|
2347
|
+
|
|
2348
|
+
// Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
|
|
2349
|
+
var getScrollTopValue = function getScrollTopValue(element) {
|
|
2350
|
+
return element === document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
|
|
2351
|
+
};
|
|
2352
|
+
var getScrollLeftValue = function getScrollLeftValue(element) {
|
|
2353
|
+
return element === document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
|
|
2354
|
+
};
|
|
2355
|
+
|
|
2356
|
+
// if the popper is fixed we don't have to substract scrolling from the boundaries
|
|
2357
|
+
var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
|
|
2358
|
+
var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
|
|
2359
|
+
|
|
2360
|
+
boundaries = {
|
|
2361
|
+
top: 0 - (offsetParentRect.top - scrollTop),
|
|
2362
|
+
right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
|
|
2363
|
+
bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
|
|
2364
|
+
left: 0 - (offsetParentRect.left - scrollLeft)
|
|
2365
|
+
};
|
|
2366
|
+
} else {
|
|
2367
|
+
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
2368
|
+
boundaries = {
|
|
2369
|
+
top: 0,
|
|
2370
|
+
left: 0,
|
|
2371
|
+
right: boundariesElement.clientWidth,
|
|
2372
|
+
bottom: boundariesElement.clientHeight
|
|
2373
|
+
};
|
|
2374
|
+
} else {
|
|
2375
|
+
boundaries = getOffsetRect(boundariesElement);
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
boundaries.left += padding;
|
|
2379
|
+
boundaries.right -= padding;
|
|
2380
|
+
boundaries.top = boundaries.top + padding;
|
|
2381
|
+
boundaries.bottom = boundaries.bottom - padding;
|
|
2382
|
+
return boundaries;
|
|
2383
|
+
};
|
|
2384
|
+
|
|
2385
|
+
/**
|
|
2386
|
+
* Loop trough the list of modifiers and run them in order, each of them will then edit the data object
|
|
2387
|
+
* @method
|
|
2388
|
+
* @memberof Popper
|
|
2389
|
+
* @access public
|
|
2390
|
+
* @param {Object} data
|
|
2391
|
+
* @param {Array} modifiers
|
|
2392
|
+
* @param {Function} ends
|
|
2393
|
+
*/
|
|
2394
|
+
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
2395
|
+
var modifiersToRun = modifiers.slice();
|
|
2396
|
+
if (ends !== undefined) {
|
|
2397
|
+
modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
modifiersToRun.forEach(function (modifier) {
|
|
2401
|
+
if (isFunction(modifier)) {
|
|
2402
|
+
data = modifier.call(this, data);
|
|
2403
|
+
}
|
|
2404
|
+
}.bind(this));
|
|
2405
|
+
|
|
2406
|
+
return data;
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2409
|
+
/**
|
|
2410
|
+
* Helper used to know if the given modifier depends from another one.
|
|
2411
|
+
* @method
|
|
2412
|
+
* @memberof Popper
|
|
2413
|
+
* @param {String} requesting - name of requesting modifier
|
|
2414
|
+
* @param {String} requested - name of requested modifier
|
|
2415
|
+
* @returns {Boolean}
|
|
2416
|
+
*/
|
|
2417
|
+
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
2418
|
+
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
2419
|
+
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
2420
|
+
return modifier === requested;
|
|
2421
|
+
}).length;
|
|
2422
|
+
};
|
|
2423
|
+
|
|
2424
|
+
//
|
|
2425
|
+
// Modifiers
|
|
2426
|
+
//
|
|
2427
|
+
|
|
2428
|
+
/**
|
|
2429
|
+
* Modifiers list
|
|
2430
|
+
* @namespace Popper.modifiers
|
|
2431
|
+
* @memberof Popper
|
|
2432
|
+
* @type {Object}
|
|
2433
|
+
*/
|
|
2434
|
+
Popper.prototype.modifiers = {};
|
|
2435
|
+
|
|
2436
|
+
/**
|
|
2437
|
+
* Apply the computed styles to the popper element
|
|
2438
|
+
* @method
|
|
2439
|
+
* @memberof Popper.modifiers
|
|
2440
|
+
* @argument {Object} data - The data object generated by `update` method
|
|
2441
|
+
* @returns {Object} The same data object
|
|
2442
|
+
*/
|
|
2443
|
+
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
2444
|
+
// apply the final offsets to the popper
|
|
2445
|
+
// NOTE: 1 DOM access here
|
|
2446
|
+
var styles = {
|
|
2447
|
+
position: data.offsets.popper.position
|
|
2448
|
+
|
|
2449
|
+
// round top and left to avoid blurry text
|
|
2450
|
+
};var left = Math.round(data.offsets.popper.left);
|
|
2451
|
+
var top = Math.round(data.offsets.popper.top);
|
|
2452
|
+
|
|
2453
|
+
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
2454
|
+
// we automatically use the supported prefixed version if needed
|
|
2455
|
+
var prefixedProperty;
|
|
2456
|
+
if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
|
|
2457
|
+
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
|
2458
|
+
styles.top = 0;
|
|
2459
|
+
styles.left = 0;
|
|
2460
|
+
} else {
|
|
2461
|
+
// othwerise, we use the standard `left` and `top` properties
|
|
2462
|
+
styles.left = left;
|
|
2463
|
+
styles.top = top;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
// any property present in `data.styles` will be applied to the popper,
|
|
2467
|
+
// in this way we can make the 3rd party modifiers add custom styles to it
|
|
2468
|
+
// Be aware, modifiers could override the properties defined in the previous
|
|
2469
|
+
// lines of this modifier!
|
|
2470
|
+
assign_default()(styles, data.styles);
|
|
2471
|
+
|
|
2472
|
+
setStyle(this._popper, styles);
|
|
2473
|
+
|
|
2474
|
+
// set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
|
|
2475
|
+
// NOTE: 1 DOM access here
|
|
2476
|
+
this._popper.setAttribute('x-placement', data.placement);
|
|
2477
|
+
|
|
2478
|
+
// if the arrow modifier is required and the arrow style has been computed, apply the arrow style
|
|
2479
|
+
if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
|
|
2480
|
+
setStyle(data.arrowElement, data.offsets.arrow);
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
return data;
|
|
2484
|
+
};
|
|
2485
|
+
|
|
2486
|
+
/**
|
|
2487
|
+
* Modifier used to shift the popper on the start or end of its reference element side
|
|
2488
|
+
* @method
|
|
2489
|
+
* @memberof Popper.modifiers
|
|
2490
|
+
* @argument {Object} data - The data object generated by `update` method
|
|
2491
|
+
* @returns {Object} The data object, properly modified
|
|
2492
|
+
*/
|
|
2493
|
+
Popper.prototype.modifiers.shift = function (data) {
|
|
2494
|
+
var placement = data.placement;
|
|
2495
|
+
var basePlacement = placement.split('-')[0];
|
|
2496
|
+
var shiftVariation = placement.split('-')[1];
|
|
2497
|
+
|
|
2498
|
+
// if shift shiftVariation is specified, run the modifier
|
|
2499
|
+
if (shiftVariation) {
|
|
2500
|
+
var reference = data.offsets.reference;
|
|
2501
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
2502
|
+
|
|
2503
|
+
var shiftOffsets = {
|
|
2504
|
+
y: {
|
|
2505
|
+
start: { top: reference.top },
|
|
2506
|
+
end: { top: reference.top + reference.height - popper.height }
|
|
2507
|
+
},
|
|
2508
|
+
x: {
|
|
2509
|
+
start: { left: reference.left },
|
|
2510
|
+
end: { left: reference.left + reference.width - popper.width }
|
|
2511
|
+
}
|
|
2512
|
+
};
|
|
2513
|
+
|
|
2514
|
+
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
2515
|
+
|
|
2516
|
+
data.offsets.popper = assign_default()(popper, shiftOffsets[axis][shiftVariation]);
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
return data;
|
|
2520
|
+
};
|
|
2521
|
+
|
|
2522
|
+
/**
|
|
2523
|
+
* Modifier used to make sure the popper does not overflows from it's boundaries
|
|
2524
|
+
* @method
|
|
2525
|
+
* @memberof Popper.modifiers
|
|
2526
|
+
* @argument {Object} data - The data object generated by `update` method
|
|
2527
|
+
* @returns {Object} The data object, properly modified
|
|
2528
|
+
*/
|
|
2529
|
+
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
2530
|
+
var order = this._options.preventOverflowOrder;
|
|
2531
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
2532
|
+
|
|
2533
|
+
var check = {
|
|
2534
|
+
left: function left() {
|
|
2535
|
+
var left = popper.left;
|
|
2536
|
+
if (popper.left < data.boundaries.left) {
|
|
2537
|
+
left = Math.max(popper.left, data.boundaries.left);
|
|
2538
|
+
}
|
|
2539
|
+
return { left: left };
|
|
2540
|
+
},
|
|
2541
|
+
right: function right() {
|
|
2542
|
+
var left = popper.left;
|
|
2543
|
+
if (popper.right > data.boundaries.right) {
|
|
2544
|
+
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
2545
|
+
}
|
|
2546
|
+
return { left: left };
|
|
2547
|
+
},
|
|
2548
|
+
top: function top() {
|
|
2549
|
+
var top = popper.top;
|
|
2550
|
+
if (popper.top < data.boundaries.top) {
|
|
2551
|
+
top = Math.max(popper.top, data.boundaries.top);
|
|
2552
|
+
}
|
|
2553
|
+
return { top: top };
|
|
2554
|
+
},
|
|
2555
|
+
bottom: function bottom() {
|
|
2556
|
+
var top = popper.top;
|
|
2557
|
+
if (popper.bottom > data.boundaries.bottom) {
|
|
2558
|
+
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
2559
|
+
}
|
|
2560
|
+
return { top: top };
|
|
2561
|
+
}
|
|
2562
|
+
};
|
|
2563
|
+
|
|
2564
|
+
order.forEach(function (direction) {
|
|
2565
|
+
data.offsets.popper = assign_default()(popper, check[direction]());
|
|
2566
|
+
});
|
|
2567
|
+
|
|
2568
|
+
return data;
|
|
2569
|
+
};
|
|
2570
|
+
|
|
2571
|
+
/**
|
|
2572
|
+
* Modifier used to make sure the popper is always near its reference
|
|
2573
|
+
* @method
|
|
2574
|
+
* @memberof Popper.modifiers
|
|
2575
|
+
* @argument {Object} data - The data object generated by _update method
|
|
2576
|
+
* @returns {Object} The data object, properly modified
|
|
2577
|
+
*/
|
|
2578
|
+
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
2579
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
2580
|
+
var reference = data.offsets.reference;
|
|
2581
|
+
var f = Math.floor;
|
|
2582
|
+
|
|
2583
|
+
if (popper.right < f(reference.left)) {
|
|
2584
|
+
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
2585
|
+
}
|
|
2586
|
+
if (popper.left > f(reference.right)) {
|
|
2587
|
+
data.offsets.popper.left = f(reference.right);
|
|
2588
|
+
}
|
|
2589
|
+
if (popper.bottom < f(reference.top)) {
|
|
2590
|
+
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
2591
|
+
}
|
|
2592
|
+
if (popper.top > f(reference.bottom)) {
|
|
2593
|
+
data.offsets.popper.top = f(reference.bottom);
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
return data;
|
|
2597
|
+
};
|
|
2598
|
+
|
|
2599
|
+
/**
|
|
2600
|
+
* Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
|
|
2601
|
+
* Requires the `preventOverflow` modifier before it in order to work.
|
|
2602
|
+
* **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
|
|
2603
|
+
* @method
|
|
2604
|
+
* @memberof Popper.modifiers
|
|
2605
|
+
* @argument {Object} data - The data object generated by _update method
|
|
2606
|
+
* @returns {Object} The data object, properly modified
|
|
2607
|
+
*/
|
|
2608
|
+
Popper.prototype.modifiers.flip = function (data) {
|
|
2609
|
+
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
2610
|
+
// otherwise flip would not work as expected.
|
|
2611
|
+
if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
|
|
2612
|
+
console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
|
|
2613
|
+
return data;
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
if (data.flipped && data.placement === data._originalPlacement) {
|
|
2617
|
+
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
|
2618
|
+
return data;
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
var placement = data.placement.split('-')[0];
|
|
2622
|
+
var placementOpposite = getOppositePlacement(placement);
|
|
2623
|
+
var variation = data.placement.split('-')[1] || '';
|
|
2624
|
+
|
|
2625
|
+
var flipOrder = [];
|
|
2626
|
+
if (this._options.flipBehavior === 'flip') {
|
|
2627
|
+
flipOrder = [placement, placementOpposite];
|
|
2628
|
+
} else {
|
|
2629
|
+
flipOrder = this._options.flipBehavior;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
flipOrder.forEach(function (step, index) {
|
|
2633
|
+
if (placement !== step || flipOrder.length === index + 1) {
|
|
2634
|
+
return;
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
placement = data.placement.split('-')[0];
|
|
2638
|
+
placementOpposite = getOppositePlacement(placement);
|
|
2639
|
+
|
|
2640
|
+
var popperOffsets = getPopperClientRect(data.offsets.popper);
|
|
2641
|
+
|
|
2642
|
+
// this boolean is used to distinguish right and bottom from top and left
|
|
2643
|
+
// they need different computations to get flipped
|
|
2644
|
+
var a = ['right', 'bottom'].indexOf(placement) !== -1;
|
|
2645
|
+
|
|
2646
|
+
// using Math.floor because the reference offsets may contain decimals we are not going to consider here
|
|
2647
|
+
if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
|
|
2648
|
+
// we'll use this boolean to detect any flip loop
|
|
2649
|
+
data.flipped = true;
|
|
2650
|
+
data.placement = flipOrder[index + 1];
|
|
2651
|
+
if (variation) {
|
|
2652
|
+
data.placement += '-' + variation;
|
|
2653
|
+
}
|
|
2654
|
+
data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
|
|
2655
|
+
|
|
2656
|
+
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
2657
|
+
}
|
|
2658
|
+
}.bind(this));
|
|
2659
|
+
return data;
|
|
2660
|
+
};
|
|
2661
|
+
|
|
2662
|
+
/**
|
|
2663
|
+
* Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
|
|
2664
|
+
* The offsets will shift the popper on the side of its reference element.
|
|
2665
|
+
* @method
|
|
2666
|
+
* @memberof Popper.modifiers
|
|
2667
|
+
* @argument {Object} data - The data object generated by _update method
|
|
2668
|
+
* @returns {Object} The data object, properly modified
|
|
2669
|
+
*/
|
|
2670
|
+
Popper.prototype.modifiers.offset = function (data) {
|
|
2671
|
+
var offset = this._options.offset;
|
|
2672
|
+
var popper = data.offsets.popper;
|
|
2673
|
+
|
|
2674
|
+
if (data.placement.indexOf('left') !== -1) {
|
|
2675
|
+
popper.top -= offset;
|
|
2676
|
+
} else if (data.placement.indexOf('right') !== -1) {
|
|
2677
|
+
popper.top += offset;
|
|
2678
|
+
} else if (data.placement.indexOf('top') !== -1) {
|
|
2679
|
+
popper.left -= offset;
|
|
2680
|
+
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
2681
|
+
popper.left += offset;
|
|
2682
|
+
}
|
|
2683
|
+
return data;
|
|
2684
|
+
};
|
|
2685
|
+
|
|
2686
|
+
/**
|
|
2687
|
+
* Modifier used to move the arrows on the edge of the popper to make sure them are always between the popper and the reference element
|
|
2688
|
+
* It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
|
|
2689
|
+
* @method
|
|
2690
|
+
* @memberof Popper.modifiers
|
|
2691
|
+
* @argument {Object} data - The data object generated by _update method
|
|
2692
|
+
* @returns {Object} The data object, properly modified
|
|
2693
|
+
*/
|
|
2694
|
+
Popper.prototype.modifiers.arrow = function (data) {
|
|
2695
|
+
var arrow = this._options.arrowElement;
|
|
2696
|
+
// debug arrow set with height 0px
|
|
2697
|
+
var arrowOffset = this._options.arrowOffset;
|
|
2698
|
+
|
|
2699
|
+
// if the arrowElement is a string, suppose it's a CSS selector
|
|
2700
|
+
if (typeof arrow === 'string') {
|
|
2701
|
+
arrow = this._popper.querySelector(arrow);
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
// if arrow element is not found, don't run the modifier
|
|
2705
|
+
if (!arrow) {
|
|
2706
|
+
return data;
|
|
2707
|
+
}
|
|
2708
|
+
|
|
2709
|
+
// the arrow element must be child of its popper
|
|
2710
|
+
if (!this._popper.contains(arrow)) {
|
|
2711
|
+
console.warn('WARNING: `arrowElement` must be child of its popper element!');
|
|
2712
|
+
return data;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
// arrow depends on keepTogether in order to work
|
|
2716
|
+
if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
|
|
2717
|
+
console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
|
|
2718
|
+
return data;
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
var arrowStyle = {};
|
|
2722
|
+
var placement = data.placement.split('-')[0];
|
|
2723
|
+
var popper = getPopperClientRect(data.offsets.popper);
|
|
2724
|
+
var reference = data.offsets.reference;
|
|
2725
|
+
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
2726
|
+
|
|
2727
|
+
var len = isVertical ? 'height' : 'width';
|
|
2728
|
+
var side = isVertical ? 'top' : 'left';
|
|
2729
|
+
// var translate = isVertical ? 'translateY' : 'translateX'
|
|
2730
|
+
var altSide = isVertical ? 'left' : 'top';
|
|
2731
|
+
var opSide = isVertical ? 'bottom' : 'right';
|
|
2732
|
+
var arrowSize = getOuterSizes(arrow)[len];
|
|
2733
|
+
|
|
2734
|
+
//
|
|
2735
|
+
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
|
|
2736
|
+
//
|
|
2737
|
+
|
|
2738
|
+
// top/left side
|
|
2739
|
+
if (reference[opSide] - arrowSize < popper[side]) {
|
|
2740
|
+
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
|
|
2741
|
+
}
|
|
2742
|
+
// bottom/right side
|
|
2743
|
+
if (reference[side] + arrowSize > popper[opSide]) {
|
|
2744
|
+
data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
// compute center of the popper
|
|
2748
|
+
var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
|
|
2749
|
+
|
|
2750
|
+
var sideValue = center - popper[side];
|
|
2751
|
+
|
|
2752
|
+
// prevent arrow from being placed not contiguously to its popper
|
|
2753
|
+
sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
|
|
2754
|
+
arrowStyle[side] = sideValue;
|
|
2755
|
+
arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
|
|
2756
|
+
|
|
2757
|
+
data.offsets.arrow = arrowStyle;
|
|
2758
|
+
data.arrowElement = arrow;
|
|
2759
|
+
|
|
2760
|
+
return data;
|
|
2761
|
+
};
|
|
2762
|
+
|
|
2763
|
+
//
|
|
2764
|
+
// Helpers
|
|
2765
|
+
//
|
|
2766
|
+
|
|
2767
|
+
/**
|
|
2768
|
+
* Get the outer sizes of the given element (offset size + margins)
|
|
2769
|
+
* @function
|
|
2770
|
+
* @ignore
|
|
2771
|
+
* @argument {Element} element
|
|
2772
|
+
* @returns {Object} object containing width and height properties
|
|
2773
|
+
*/
|
|
2774
|
+
function getOuterSizes(element) {
|
|
2775
|
+
// NOTE: 1 DOM access here
|
|
2776
|
+
var _display = element.style.display;
|
|
2777
|
+
var _visibility = element.style.visibility;
|
|
2778
|
+
element.style.display = 'block';
|
|
2779
|
+
element.style.visibility = 'hidden';
|
|
2780
|
+
|
|
2781
|
+
// original method
|
|
2782
|
+
var styles = root.getComputedStyle(element);
|
|
2783
|
+
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
2784
|
+
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
2785
|
+
var result = { width: element.offsetWidth + y, height: element.offsetHeight + x
|
|
2786
|
+
|
|
2787
|
+
// reset element styles
|
|
2788
|
+
};element.style.display = _display;
|
|
2789
|
+
element.style.visibility = _visibility;
|
|
2790
|
+
return result;
|
|
2791
|
+
}
|
|
2792
|
+
|
|
2793
|
+
/**
|
|
2794
|
+
* Get the opposite placement of the given one/
|
|
2795
|
+
* @function
|
|
2796
|
+
* @ignore
|
|
2797
|
+
* @argument {String} placement
|
|
2798
|
+
* @returns {String} flipped placement
|
|
2799
|
+
*/
|
|
2800
|
+
function getOppositePlacement(placement) {
|
|
2801
|
+
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
2802
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
2803
|
+
return hash[matched];
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
/**
|
|
2808
|
+
* Given the popper offsets, generate an output similar to getBoundingClientRect
|
|
2809
|
+
* @function
|
|
2810
|
+
* @ignore
|
|
2811
|
+
* @argument {Object} popperOffsets
|
|
2812
|
+
* @returns {Object} ClientRect like output
|
|
2813
|
+
*/
|
|
2814
|
+
function getPopperClientRect(popperOffsets) {
|
|
2815
|
+
var offsets = assign_default()({}, popperOffsets);
|
|
2816
|
+
offsets.right = offsets.left + offsets.width;
|
|
2817
|
+
offsets.bottom = offsets.top + offsets.height;
|
|
2818
|
+
return offsets;
|
|
2819
|
+
}
|
|
2820
|
+
|
|
2821
|
+
/**
|
|
2822
|
+
* Given an array and the key to find, returns its index
|
|
2823
|
+
* @function
|
|
2824
|
+
* @ignore
|
|
2825
|
+
* @argument {Array} arr
|
|
2826
|
+
* @argument keyToFind
|
|
2827
|
+
* @returns index or null
|
|
2828
|
+
*/
|
|
2829
|
+
function getArrayKeyIndex(arr, keyToFind) {
|
|
2830
|
+
var i = 0;
|
|
2831
|
+
var key;
|
|
2832
|
+
for (key in arr) {
|
|
2833
|
+
if (arr[key] === keyToFind) {
|
|
2834
|
+
return i;
|
|
2835
|
+
}
|
|
2836
|
+
i++;
|
|
2837
|
+
}
|
|
2838
|
+
return null;
|
|
2839
|
+
}
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* Get CSS computed property of the given element
|
|
2843
|
+
* @function
|
|
2844
|
+
* @ignore
|
|
2845
|
+
* @argument {Eement} element
|
|
2846
|
+
* @argument {String} property
|
|
2847
|
+
*/
|
|
2848
|
+
function getStyleComputedProperty(element, property) {
|
|
2849
|
+
// NOTE: 1 DOM access here
|
|
2850
|
+
var css = root.getComputedStyle(element, null);
|
|
2851
|
+
return css[property];
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
/**
|
|
2855
|
+
* Returns the offset parent of the given element
|
|
2856
|
+
* @function
|
|
2857
|
+
* @ignore
|
|
2858
|
+
* @argument {Element} element
|
|
2859
|
+
* @returns {Element} offset parent
|
|
2860
|
+
*/
|
|
2861
|
+
function getOffsetParent(element) {
|
|
2862
|
+
// NOTE: 1 DOM access here
|
|
2863
|
+
var offsetParent = element.offsetParent;
|
|
2864
|
+
return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2867
|
+
/**
|
|
2868
|
+
* Returns the scrolling parent of the given element
|
|
2869
|
+
* @function
|
|
2870
|
+
* @ignore
|
|
2871
|
+
* @argument {Element} element
|
|
2872
|
+
* @returns {Element} offset parent
|
|
2873
|
+
*/
|
|
2874
|
+
function getScrollParent(element) {
|
|
2875
|
+
var parent = element.parentNode;
|
|
2876
|
+
|
|
2877
|
+
if (!parent) {
|
|
2878
|
+
return element;
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
if (parent === root.document) {
|
|
2882
|
+
// Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
|
|
2883
|
+
// greater than 0 and return the proper element
|
|
2884
|
+
if (root.document.body.scrollTop || root.document.body.scrollLeft) {
|
|
2885
|
+
return root.document.body;
|
|
2886
|
+
} else {
|
|
2887
|
+
return root.document.documentElement;
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
// Firefox want us to check `-x` and `-y` variations as well
|
|
2892
|
+
if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
|
|
2893
|
+
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
2894
|
+
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
2895
|
+
// fixes issue #65
|
|
2896
|
+
return parent;
|
|
2897
|
+
}
|
|
2898
|
+
return getScrollParent(element.parentNode);
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
/**
|
|
2902
|
+
* Check if the given element is fixed or is inside a fixed parent
|
|
2903
|
+
* @function
|
|
2904
|
+
* @ignore
|
|
2905
|
+
* @argument {Element} element
|
|
2906
|
+
* @argument {Element} customContainer
|
|
2907
|
+
* @returns {Boolean} answer to "isFixed?"
|
|
2908
|
+
*/
|
|
2909
|
+
function isFixed(element) {
|
|
2910
|
+
if (element === root.document.body) {
|
|
2911
|
+
return false;
|
|
2912
|
+
}
|
|
2913
|
+
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
2914
|
+
return true;
|
|
2915
|
+
}
|
|
2916
|
+
return element.parentNode ? isFixed(element.parentNode) : element;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
/**
|
|
2920
|
+
* Set the style to the given popper
|
|
2921
|
+
* @function
|
|
2922
|
+
* @ignore
|
|
2923
|
+
* @argument {Element} element - Element to apply the style to
|
|
2924
|
+
* @argument {Object} styles - Object with a list of properties and values which will be applied to the element
|
|
2925
|
+
*/
|
|
2926
|
+
function setStyle(element, styles) {
|
|
2927
|
+
function isNumeric(n) {
|
|
2928
|
+
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
2929
|
+
}
|
|
2930
|
+
keys_default()(styles).forEach(function (prop) {
|
|
2931
|
+
var unit = '';
|
|
2932
|
+
// add unit if the value is numeric and is one of the following
|
|
2933
|
+
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
|
|
2934
|
+
unit = 'px';
|
|
2935
|
+
}
|
|
2936
|
+
element.style[prop] = styles[prop] + unit;
|
|
2937
|
+
});
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
/**
|
|
2941
|
+
* Check if the given variable is a function
|
|
2942
|
+
* @function
|
|
2943
|
+
* @ignore
|
|
2944
|
+
* @argument {*} functionToCheck - variable to check
|
|
2945
|
+
* @returns {Boolean} answer to: is a function?
|
|
2946
|
+
*/
|
|
2947
|
+
function isFunction(functionToCheck) {
|
|
2948
|
+
var getType = {};
|
|
2949
|
+
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
/**
|
|
2953
|
+
* Get the position of the given element, relative to its offset parent
|
|
2954
|
+
* @function
|
|
2955
|
+
* @ignore
|
|
2956
|
+
* @param {Element} element
|
|
2957
|
+
* @return {Object} position - Coordinates of the element and its `scrollTop`
|
|
2958
|
+
*/
|
|
2959
|
+
function getOffsetRect(element) {
|
|
2960
|
+
var elementRect = {
|
|
2961
|
+
width: element.offsetWidth,
|
|
2962
|
+
height: element.offsetHeight,
|
|
2963
|
+
left: element.offsetLeft,
|
|
2964
|
+
top: element.offsetTop
|
|
2965
|
+
};
|
|
2966
|
+
|
|
2967
|
+
elementRect.right = elementRect.left + elementRect.width;
|
|
2968
|
+
elementRect.bottom = elementRect.top + elementRect.height;
|
|
2969
|
+
|
|
2970
|
+
// position
|
|
2971
|
+
return elementRect;
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
/**
|
|
2975
|
+
* Get bounding client rect of given element
|
|
2976
|
+
* @function
|
|
2977
|
+
* @ignore
|
|
2978
|
+
* @param {HTMLElement} element
|
|
2979
|
+
* @return {Object} client rect
|
|
2980
|
+
*/
|
|
2981
|
+
function getBoundingClientRect(element) {
|
|
2982
|
+
var rect = element.getBoundingClientRect();
|
|
2983
|
+
|
|
2984
|
+
// whether the IE version is lower than 11
|
|
2985
|
+
var isIE = navigator.userAgent.indexOf('MSIE') !== -1;
|
|
2986
|
+
|
|
2987
|
+
// fix ie document bounding top always 0 bug
|
|
2988
|
+
var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
|
|
2989
|
+
|
|
2990
|
+
return {
|
|
2991
|
+
left: rect.left,
|
|
2992
|
+
top: rectTop,
|
|
2993
|
+
right: rect.right,
|
|
2994
|
+
bottom: rect.bottom,
|
|
2995
|
+
width: rect.right - rect.left,
|
|
2996
|
+
height: rect.bottom - rectTop
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
/**
|
|
3001
|
+
* Given an element and one of its parents, return the offset
|
|
3002
|
+
* @function
|
|
3003
|
+
* @ignore
|
|
3004
|
+
* @param {HTMLElement} element
|
|
3005
|
+
* @param {HTMLElement} parent
|
|
3006
|
+
* @return {Object} rect
|
|
3007
|
+
*/
|
|
3008
|
+
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
3009
|
+
var elementRect = getBoundingClientRect(element);
|
|
3010
|
+
var parentRect = getBoundingClientRect(parent);
|
|
3011
|
+
|
|
3012
|
+
if (fixed) {
|
|
3013
|
+
var scrollParent = getScrollParent(parent);
|
|
3014
|
+
parentRect.top += scrollParent.scrollTop;
|
|
3015
|
+
parentRect.bottom += scrollParent.scrollTop;
|
|
3016
|
+
parentRect.left += scrollParent.scrollLeft;
|
|
3017
|
+
parentRect.right += scrollParent.scrollLeft;
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
var rect = {
|
|
3021
|
+
top: elementRect.top - parentRect.top,
|
|
3022
|
+
left: elementRect.left - parentRect.left,
|
|
3023
|
+
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
3024
|
+
right: elementRect.left - parentRect.left + elementRect.width,
|
|
3025
|
+
width: elementRect.width,
|
|
3026
|
+
height: elementRect.height
|
|
3027
|
+
};
|
|
3028
|
+
return rect;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
/**
|
|
3032
|
+
* Get the prefixed supported property name
|
|
3033
|
+
* @function
|
|
3034
|
+
* @ignore
|
|
3035
|
+
* @argument {String} property (camelCase)
|
|
3036
|
+
* @returns {String} prefixed property (camelCase)
|
|
3037
|
+
*/
|
|
3038
|
+
function getSupportedPropertyName(property) {
|
|
3039
|
+
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
3040
|
+
|
|
3041
|
+
for (var i = 0; i < prefixes.length; i++) {
|
|
3042
|
+
var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
|
|
3043
|
+
if (typeof root.document.body.style[toCheck] !== 'undefined') {
|
|
3044
|
+
return toCheck;
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
return null;
|
|
3048
|
+
}
|
|
3049
|
+
|
|
3050
|
+
/**
|
|
3051
|
+
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
|
|
3052
|
+
* objects to a target object. It will return the target object.
|
|
3053
|
+
* This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
|
|
3054
|
+
* Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
3055
|
+
* @function
|
|
3056
|
+
* @ignore
|
|
3057
|
+
*/
|
|
3058
|
+
if (!assign_default.a) {
|
|
3059
|
+
Object.defineProperty(Object, 'assign', {
|
|
3060
|
+
enumerable: false,
|
|
3061
|
+
configurable: true,
|
|
3062
|
+
writable: true,
|
|
3063
|
+
value: function value(target) {
|
|
3064
|
+
if (target === undefined || target === null) {
|
|
3065
|
+
throw new TypeError('Cannot convert first argument to object');
|
|
3066
|
+
}
|
|
3067
|
+
|
|
3068
|
+
var to = Object(target);
|
|
3069
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
3070
|
+
var nextSource = arguments[i];
|
|
3071
|
+
if (nextSource === undefined || nextSource === null) {
|
|
3072
|
+
continue;
|
|
3073
|
+
}
|
|
3074
|
+
nextSource = Object(nextSource);
|
|
3075
|
+
|
|
3076
|
+
var keysArray = keys_default()(nextSource);
|
|
3077
|
+
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
|
3078
|
+
var nextKey = keysArray[nextIndex];
|
|
3079
|
+
var desc = get_own_property_descriptor_default()(nextSource, nextKey);
|
|
3080
|
+
if (desc !== undefined && desc.enumerable) {
|
|
3081
|
+
to[nextKey] = nextSource[nextKey];
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
return to;
|
|
3086
|
+
}
|
|
3087
|
+
});
|
|
3088
|
+
}
|
|
3089
|
+
return Popper;
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
/* harmony default export */ var _util_popper = (popper_createPopper());
|
|
3093
|
+
// CONCATENATED MODULE: ./components/_util/vue-popper.js
|
|
3094
|
+
|
|
3095
|
+
|
|
3096
|
+
|
|
3097
|
+
// todo 可以替换但是 替换后功能有差异 待定
|
|
3098
|
+
// import PopperJS2 from 'popper.js'
|
|
3099
|
+
var PopperJS = external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$isServer ? function () {} : _util_popper;
|
|
3100
|
+
var stop = function stop(e) {
|
|
3101
|
+
return e.stopPropagation();
|
|
3102
|
+
};
|
|
3103
|
+
|
|
3104
|
+
/**
|
|
3105
|
+
* @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
|
|
3106
|
+
* @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
|
|
3107
|
+
* @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
|
|
3108
|
+
* @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
|
|
3109
|
+
* @param {Boolean} [visible=false] Visibility of the popup element.
|
|
3110
|
+
* @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
|
|
3111
|
+
*/
|
|
3112
|
+
/* harmony default export */ var vue_popper = ({
|
|
3113
|
+
props: {
|
|
3114
|
+
transformOrigin: {
|
|
3115
|
+
type: [Boolean, String],
|
|
3116
|
+
default: true
|
|
3117
|
+
},
|
|
3118
|
+
placement: {
|
|
3119
|
+
type: String,
|
|
3120
|
+
default: 'bottom'
|
|
3121
|
+
},
|
|
3122
|
+
boundariesPadding: {
|
|
3123
|
+
type: Number,
|
|
3124
|
+
default: 5
|
|
3125
|
+
},
|
|
3126
|
+
reference: {},
|
|
3127
|
+
popper: {},
|
|
3128
|
+
offset: {
|
|
3129
|
+
default: 0
|
|
3130
|
+
},
|
|
3131
|
+
value: Boolean,
|
|
3132
|
+
visibleArrow: Boolean,
|
|
3133
|
+
arrowOffset: {
|
|
3134
|
+
type: Number,
|
|
3135
|
+
default: 35
|
|
3136
|
+
},
|
|
3137
|
+
appendToBody: {
|
|
3138
|
+
type: Boolean,
|
|
3139
|
+
default: true
|
|
3140
|
+
},
|
|
3141
|
+
popperOptions: {
|
|
3142
|
+
type: Object,
|
|
3143
|
+
default: function _default() {
|
|
3144
|
+
return {
|
|
3145
|
+
gpuAcceleration: false
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
},
|
|
3150
|
+
|
|
3151
|
+
data: function data() {
|
|
3152
|
+
return {
|
|
3153
|
+
showPopper: false,
|
|
3154
|
+
currentPlacement: ''
|
|
3155
|
+
};
|
|
3156
|
+
},
|
|
3157
|
+
|
|
3158
|
+
|
|
3159
|
+
watch: {
|
|
3160
|
+
value: {
|
|
3161
|
+
immediate: true,
|
|
3162
|
+
handler: function handler(val) {
|
|
3163
|
+
this.showPopper = val;
|
|
3164
|
+
this.$emit('input', val);
|
|
3165
|
+
}
|
|
3166
|
+
},
|
|
3167
|
+
|
|
3168
|
+
showPopper: function showPopper(val) {
|
|
3169
|
+
if (this.disabled) return;
|
|
3170
|
+
val ? this.updatePopper() : this.destroyPopper();
|
|
3171
|
+
this.$emit('input', val);
|
|
3172
|
+
}
|
|
3173
|
+
},
|
|
3174
|
+
|
|
3175
|
+
methods: {
|
|
3176
|
+
createPopper: function createPopper() {
|
|
3177
|
+
var _this = this;
|
|
3178
|
+
|
|
3179
|
+
if (this.$isServer) return;
|
|
3180
|
+
this.currentPlacement = this.currentPlacement || this.placement;
|
|
3181
|
+
if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
|
|
3182
|
+
return;
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
var options = this.popperOptions;
|
|
3186
|
+
var popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
|
|
3187
|
+
var reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
|
|
3188
|
+
|
|
3189
|
+
if (!reference && this.$slots.reference && this.$slots.reference[0]) {
|
|
3190
|
+
reference = this.referenceElm = this.$slots.reference[0].elm;
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
if (!popper || !reference) return;
|
|
3194
|
+
if (this.visibleArrow) this.appendArrow(popper);
|
|
3195
|
+
if (this.appendToBody) document.body.appendChild(this.popperElm);
|
|
3196
|
+
if (this.popperJS && this.popperJS.destroy) {
|
|
3197
|
+
this.popperJS.destroy();
|
|
3198
|
+
}
|
|
3199
|
+
options.placement = this.currentPlacement;
|
|
3200
|
+
options.offset = this.offset;
|
|
3201
|
+
options.arrowOffset = this.arrowOffset;
|
|
3202
|
+
this.popperJS = new PopperJS(reference, popper, options);
|
|
3203
|
+
this.popperJS.onCreate(function (_) {
|
|
3204
|
+
_this.$emit('created', _this);
|
|
3205
|
+
_this.resetTransformOrigin();
|
|
3206
|
+
_this.$nextTick(_this.updatePopper);
|
|
3207
|
+
});
|
|
3208
|
+
if (typeof options.onUpdate === 'function') {
|
|
3209
|
+
this.popperJS.onUpdate(options.onUpdate);
|
|
3210
|
+
}
|
|
3211
|
+
this.popperJS._popper.style.zIndex = popup_manager.nextZIndex();
|
|
3212
|
+
this.popperElm.addEventListener('click', stop);
|
|
3213
|
+
},
|
|
3214
|
+
updatePopper: function updatePopper() {
|
|
3215
|
+
var popperJS = this.popperJS;
|
|
3216
|
+
if (popperJS) {
|
|
3217
|
+
popperJS.update();
|
|
3218
|
+
if (popperJS._popper) {
|
|
3219
|
+
popperJS._popper.style.zIndex = popup_manager.nextZIndex();
|
|
3220
|
+
}
|
|
3221
|
+
} else {
|
|
3222
|
+
this.createPopper();
|
|
3223
|
+
}
|
|
3224
|
+
},
|
|
3225
|
+
doDestroy: function doDestroy(forceDestroy) {
|
|
3226
|
+
/* istanbul ignore if */
|
|
3227
|
+
if (!this.popperJS || this.showPopper && !forceDestroy) return;
|
|
3228
|
+
if (!forceDestroy) {
|
|
3229
|
+
if (this.popperElm && this.popperElm.parentNode === document.body) {
|
|
3230
|
+
this.popperElm.removeEventListener('click', stop);
|
|
3231
|
+
document.body.removeChild(this.popperElm);
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
this.popperJS.destroy();
|
|
3235
|
+
this.popperJS = null;
|
|
3236
|
+
},
|
|
3237
|
+
destroyPopper: function destroyPopper() {
|
|
3238
|
+
if (this.popperJS) {
|
|
3239
|
+
this.resetTransformOrigin();
|
|
3240
|
+
}
|
|
3241
|
+
},
|
|
3242
|
+
resetTransformOrigin: function resetTransformOrigin() {
|
|
3243
|
+
if (!this.transformOrigin) return;
|
|
3244
|
+
var placementMap = {
|
|
3245
|
+
top: 'bottom',
|
|
3246
|
+
bottom: 'top',
|
|
3247
|
+
left: 'right',
|
|
3248
|
+
right: 'left'
|
|
3249
|
+
};
|
|
3250
|
+
var placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
|
|
3251
|
+
var origin = placementMap[placement];
|
|
3252
|
+
this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === 'string' ? this.transformOrigin : ['top', 'bottom'].indexOf(placement) > -1 ? 'center ' + origin : origin + ' center';
|
|
3253
|
+
},
|
|
3254
|
+
appendArrow: function appendArrow(element) {
|
|
3255
|
+
var hash = void 0;
|
|
3256
|
+
if (this.appended) {
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
|
|
3260
|
+
this.appended = true;
|
|
3261
|
+
|
|
3262
|
+
for (var item in element.attributes) {
|
|
3263
|
+
if (/^_v-/.test(element.attributes[item].name)) {
|
|
3264
|
+
hash = element.attributes[item].name;
|
|
3265
|
+
break;
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
|
|
3269
|
+
var arrow = document.createElement('div');
|
|
3270
|
+
|
|
3271
|
+
if (hash) {
|
|
3272
|
+
arrow.setAttribute(hash, '');
|
|
3273
|
+
}
|
|
3274
|
+
arrow.setAttribute('x-arrow', '');
|
|
3275
|
+
arrow.className = 'popper__arrow';
|
|
3276
|
+
element.appendChild(arrow);
|
|
3277
|
+
}
|
|
3278
|
+
},
|
|
3279
|
+
|
|
3280
|
+
beforeDestroy: function beforeDestroy() {
|
|
3281
|
+
this.doDestroy(true);
|
|
3282
|
+
if (this.popperElm && this.popperElm.parentNode === document.body) {
|
|
3283
|
+
this.popperElm.removeEventListener('click', stop);
|
|
3284
|
+
document.body.removeChild(this.popperElm);
|
|
3285
|
+
}
|
|
3286
|
+
},
|
|
3287
|
+
|
|
3288
|
+
|
|
3289
|
+
// call destroy in keep-alive mode
|
|
3290
|
+
deactivated: function deactivated() {
|
|
3291
|
+
this.$options.beforeDestroy[0].call(this);
|
|
3292
|
+
}
|
|
3293
|
+
});
|
|
3294
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/select/select-dropdown.vue?vue&type=script&lang=js&
|
|
3295
|
+
|
|
3296
|
+
//
|
|
3297
|
+
//
|
|
3298
|
+
//
|
|
3299
|
+
//
|
|
3300
|
+
//
|
|
3301
|
+
//
|
|
3302
|
+
//
|
|
3303
|
+
//
|
|
3304
|
+
//
|
|
3305
|
+
|
|
3306
|
+
|
|
3307
|
+
/* harmony default export */ var select_dropdownvue_type_script_lang_js_ = ({
|
|
3308
|
+
name: 'MdsSelectDropdown',
|
|
3309
|
+
componentName: 'MdsSelectDropdown',
|
|
3310
|
+
mixins: [vue_popper],
|
|
3311
|
+
props: {
|
|
3312
|
+
hasSlot: {
|
|
3313
|
+
type: Boolean,
|
|
3314
|
+
default: false
|
|
3315
|
+
},
|
|
3316
|
+
size: String,
|
|
3317
|
+
placement: {
|
|
3318
|
+
default: 'bottom'
|
|
3319
|
+
},
|
|
3320
|
+
prefixCls: {
|
|
3321
|
+
type: String,
|
|
3322
|
+
default: 'mds-select'
|
|
3323
|
+
},
|
|
3324
|
+
boundariesPadding: {
|
|
3325
|
+
default: 0
|
|
3326
|
+
},
|
|
3327
|
+
popperOptions: {
|
|
3328
|
+
default: function _default() {
|
|
3329
|
+
return {
|
|
3330
|
+
gpuAcceleration: false
|
|
3331
|
+
};
|
|
3332
|
+
}
|
|
3333
|
+
},
|
|
3334
|
+
appendToBody: {
|
|
3335
|
+
type: Boolean,
|
|
3336
|
+
default: true
|
|
3337
|
+
}
|
|
3338
|
+
},
|
|
3339
|
+
|
|
3340
|
+
data: function data() {
|
|
3341
|
+
return {
|
|
3342
|
+
minWidth: ''
|
|
3343
|
+
};
|
|
3344
|
+
},
|
|
3345
|
+
|
|
3346
|
+
computed: {
|
|
3347
|
+
popperClass: function popperClass() {
|
|
3348
|
+
return this.$parent.popperClass || '';
|
|
3349
|
+
},
|
|
3350
|
+
wrapperClass: function wrapperClass() {
|
|
3351
|
+
var _ref;
|
|
3352
|
+
|
|
3353
|
+
var prefixCls = this.prefixCls;
|
|
3354
|
+
return _ref = {}, defineProperty_default()(_ref, prefixCls + '-dropdown', true), defineProperty_default()(_ref, prefixCls + '-dropdown-' + this.size, true), defineProperty_default()(_ref, 'is-multiple', this.$parent.multiple), defineProperty_default()(_ref, this.popperClass, true), defineProperty_default()(_ref, prefixCls + '-dropdown-slot', this.hasSlot), _ref;
|
|
3355
|
+
}
|
|
3356
|
+
},
|
|
3357
|
+
watch: {
|
|
3358
|
+
'$parent.inputWidth': function $parentInputWidth() {
|
|
3359
|
+
this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
|
|
3360
|
+
}
|
|
3361
|
+
},
|
|
3362
|
+
mounted: function mounted() {
|
|
3363
|
+
var _this = this;
|
|
3364
|
+
|
|
3365
|
+
this.referenceElm = this.$parent.$refs.reference.$el;
|
|
3366
|
+
this.$parent.popperElm = this.popperElm = this.$el;
|
|
3367
|
+
this.$on('updatePopper', function () {
|
|
3368
|
+
_this.updatePopper();
|
|
3369
|
+
// if (this.$parent.visible) {
|
|
3370
|
+
// this.updatePopper()
|
|
3371
|
+
// this.$nextTick(() => {
|
|
3372
|
+
// const popper = this.$refs.popper.style
|
|
3373
|
+
// const left = document.querySelector('.is-focus').getBoundingClientRect().left
|
|
3374
|
+
// popper.left = left + 'px'
|
|
3375
|
+
// console.log(popper.left, left)
|
|
3376
|
+
// })
|
|
3377
|
+
// }
|
|
3378
|
+
});
|
|
3379
|
+
this.$on('destroyPopper', this.destroyPopper);
|
|
3380
|
+
}
|
|
3381
|
+
});
|
|
3382
|
+
// CONCATENATED MODULE: ./components/select/select-dropdown.vue?vue&type=script&lang=js&
|
|
3383
|
+
/* harmony default export */ var select_select_dropdownvue_type_script_lang_js_ = (select_dropdownvue_type_script_lang_js_);
|
|
3384
|
+
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
3385
|
+
var componentNormalizer = __webpack_require__(0);
|
|
3386
|
+
|
|
3387
|
+
// CONCATENATED MODULE: ./components/select/select-dropdown.vue
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
|
|
3391
|
+
|
|
3392
|
+
|
|
3393
|
+
/* normalize component */
|
|
3394
|
+
|
|
3395
|
+
var component = Object(componentNormalizer["a" /* default */])(
|
|
3396
|
+
select_select_dropdownvue_type_script_lang_js_,
|
|
3397
|
+
select_dropdownvue_type_template_id_30ac5bac_render,
|
|
3398
|
+
select_dropdownvue_type_template_id_30ac5bac_staticRenderFns,
|
|
3399
|
+
false,
|
|
3400
|
+
null,
|
|
3401
|
+
null,
|
|
3402
|
+
null
|
|
3403
|
+
|
|
3404
|
+
)
|
|
3405
|
+
|
|
3406
|
+
/* hot reload */
|
|
3407
|
+
if (false) { var api; }
|
|
3408
|
+
component.options.__file = "components/select/select-dropdown.vue"
|
|
3409
|
+
/* harmony default export */ var select_dropdown = (component.exports);
|
|
3410
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/select/option.vue?vue&type=template&id=71b3a886&
|
|
3411
|
+
var optionvue_type_template_id_71b3a886_render = function () {
|
|
3412
|
+
var _vm = this
|
|
3413
|
+
var _h = _vm.$createElement
|
|
3414
|
+
var _c = _vm._self._c || _h
|
|
3415
|
+
return _c(
|
|
3416
|
+
"li",
|
|
3417
|
+
{
|
|
3418
|
+
directives: [
|
|
3419
|
+
{
|
|
3420
|
+
name: "show",
|
|
3421
|
+
rawName: "v-show",
|
|
3422
|
+
value: _vm.visible,
|
|
3423
|
+
expression: "visible",
|
|
3424
|
+
},
|
|
3425
|
+
],
|
|
3426
|
+
class: _vm.wrapperClass,
|
|
3427
|
+
on: {
|
|
3428
|
+
click: function ($event) {
|
|
3429
|
+
$event.stopPropagation()
|
|
3430
|
+
return _vm.optionClick($event)
|
|
3431
|
+
},
|
|
3432
|
+
},
|
|
3433
|
+
},
|
|
3434
|
+
[
|
|
3435
|
+
_vm._t("default", [
|
|
3436
|
+
_vm._v("\n " + _vm._s(_vm.currentLabel) + "\n "),
|
|
3437
|
+
]),
|
|
3438
|
+
_c("mds-icon", {
|
|
3439
|
+
class: _vm.prefixCls + "-item-multiple-seleted-icon-pos",
|
|
3440
|
+
attrs: { type: "line-check" },
|
|
3441
|
+
}),
|
|
3442
|
+
],
|
|
3443
|
+
2
|
|
3444
|
+
)
|
|
3445
|
+
}
|
|
3446
|
+
var optionvue_type_template_id_71b3a886_staticRenderFns = []
|
|
3447
|
+
optionvue_type_template_id_71b3a886_render._withStripped = true
|
|
3448
|
+
|
|
3449
|
+
|
|
3450
|
+
// CONCATENATED MODULE: ./components/select/option.vue?vue&type=template&id=71b3a886&
|
|
3451
|
+
|
|
3452
|
+
// EXTERNAL MODULE: external "babel-runtime/helpers/typeof"
|
|
3453
|
+
var typeof_ = __webpack_require__(8);
|
|
3454
|
+
var typeof_default = /*#__PURE__*/__webpack_require__.n(typeof_);
|
|
3455
|
+
|
|
3456
|
+
// EXTERNAL MODULE: external "./icon"
|
|
3457
|
+
var external_icon_ = __webpack_require__(4);
|
|
3458
|
+
var external_icon_default = /*#__PURE__*/__webpack_require__.n(external_icon_);
|
|
3459
|
+
|
|
3460
|
+
// EXTERNAL MODULE: external "./_util/util"
|
|
3461
|
+
var util_ = __webpack_require__(14);
|
|
3462
|
+
|
|
3463
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/select/option.vue?vue&type=script&lang=js&
|
|
3464
|
+
|
|
3465
|
+
|
|
3466
|
+
//
|
|
3467
|
+
//
|
|
3468
|
+
//
|
|
3469
|
+
//
|
|
3470
|
+
//
|
|
3471
|
+
//
|
|
3472
|
+
//
|
|
3473
|
+
//
|
|
3474
|
+
//
|
|
3475
|
+
//
|
|
3476
|
+
//
|
|
3477
|
+
//
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
|
|
3481
|
+
|
|
3482
|
+
/* harmony default export */ var optionvue_type_script_lang_js_ = ({
|
|
3483
|
+
name: 'MdsOption',
|
|
3484
|
+
componentName: 'MdsOption',
|
|
3485
|
+
mixins: [emitter_default.a],
|
|
3486
|
+
components: {
|
|
3487
|
+
MdsIcon: external_icon_default.a
|
|
3488
|
+
},
|
|
3489
|
+
inject: ['select'],
|
|
3490
|
+
props: {
|
|
3491
|
+
value: {
|
|
3492
|
+
required: true
|
|
3493
|
+
},
|
|
3494
|
+
prefixCls: {
|
|
3495
|
+
type: String,
|
|
3496
|
+
default: 'mds-select'
|
|
3497
|
+
},
|
|
3498
|
+
label: [String, Number],
|
|
3499
|
+
created: Boolean,
|
|
3500
|
+
disabled: {
|
|
3501
|
+
type: Boolean,
|
|
3502
|
+
default: false
|
|
3503
|
+
},
|
|
3504
|
+
/**
|
|
3505
|
+
* @Description 回显的值
|
|
3506
|
+
* @Date 2020-10-23 12:10:26 星期五
|
|
3507
|
+
*/
|
|
3508
|
+
echo: {
|
|
3509
|
+
type: [String, Number]
|
|
3510
|
+
}
|
|
3511
|
+
},
|
|
3512
|
+
|
|
3513
|
+
data: function data() {
|
|
3514
|
+
return {
|
|
3515
|
+
index: -1,
|
|
3516
|
+
groupDisabled: false,
|
|
3517
|
+
visible: true,
|
|
3518
|
+
hitState: false,
|
|
3519
|
+
hover: false
|
|
3520
|
+
};
|
|
3521
|
+
},
|
|
3522
|
+
|
|
3523
|
+
computed: {
|
|
3524
|
+
wrapperClass: function wrapperClass() {
|
|
3525
|
+
var _ref;
|
|
3526
|
+
|
|
3527
|
+
var prefixCls = this.prefixCls;
|
|
3528
|
+
return _ref = {}, defineProperty_default()(_ref, prefixCls + '-item', true), defineProperty_default()(_ref, prefixCls + '-item-selected', this.itemSelected), defineProperty_default()(_ref, prefixCls + '-item-multiple-seleted', this.itemSelected && this.select.multiple), defineProperty_default()(_ref, prefixCls + '-item-disabled', this.disabled || this.groupDisabled || this.limitReached), _ref;
|
|
3529
|
+
},
|
|
3530
|
+
isObject: function isObject() {
|
|
3531
|
+
return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
|
|
3532
|
+
},
|
|
3533
|
+
currentLabel: function currentLabel() {
|
|
3534
|
+
return this.label || (this.isObject ? '' : this.value);
|
|
3535
|
+
},
|
|
3536
|
+
itemSelected: function itemSelected() {
|
|
3537
|
+
if (!this.select.multiple) {
|
|
3538
|
+
return this.isEqual(this.value, this.select.value);
|
|
3539
|
+
} else {
|
|
3540
|
+
return this.contains(this.select.value, this.value);
|
|
3541
|
+
}
|
|
3542
|
+
},
|
|
3543
|
+
limitReached: function limitReached() {
|
|
3544
|
+
if (this.select.multiple) {
|
|
3545
|
+
return !this.itemSelected && (this.select.value || []).length >= this.select.multipleLimit && this.select.multipleLimit > 0;
|
|
3546
|
+
} else {
|
|
3547
|
+
return false;
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
},
|
|
3551
|
+
|
|
3552
|
+
watch: {
|
|
3553
|
+
currentLabel: function currentLabel() {
|
|
3554
|
+
if (!this.created && !this.select.remote) this.dispatch('MdsSelect', 'setSelected');
|
|
3555
|
+
},
|
|
3556
|
+
value: function value(val, oldVal) {
|
|
3557
|
+
var _select = this.select,
|
|
3558
|
+
remote = _select.remote,
|
|
3559
|
+
valueKey = _select.valueKey;
|
|
3560
|
+
|
|
3561
|
+
if (!this.created && !remote) {
|
|
3562
|
+
if (valueKey && (typeof val === 'undefined' ? 'undefined' : typeof_default()(val)) === 'object' && (typeof oldVal === 'undefined' ? 'undefined' : typeof_default()(oldVal)) === 'object' && val[valueKey] === oldVal[valueKey]) {
|
|
3563
|
+
return;
|
|
3564
|
+
}
|
|
3565
|
+
this.dispatch('MdsSelect', 'setSelected');
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3568
|
+
},
|
|
3569
|
+
methods: {
|
|
3570
|
+
isEqual: function isEqual(a, b) {
|
|
3571
|
+
if (!this.isObject) {
|
|
3572
|
+
return a === b;
|
|
3573
|
+
} else {
|
|
3574
|
+
var valueKey = this.select.valueKey;
|
|
3575
|
+
return Object(util_["getValueByPath"])(a, valueKey) === Object(util_["getValueByPath"])(b, valueKey);
|
|
3576
|
+
}
|
|
3577
|
+
},
|
|
3578
|
+
contains: function contains() {
|
|
3579
|
+
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
3580
|
+
var target = arguments[1];
|
|
3581
|
+
|
|
3582
|
+
if (!this.isObject) {
|
|
3583
|
+
return arr && arr.indexOf(target) > -1;
|
|
3584
|
+
} else {
|
|
3585
|
+
var valueKey = this.select.valueKey;
|
|
3586
|
+
return arr && arr.some(function (item) {
|
|
3587
|
+
return Object(util_["getValueByPath"])(item, valueKey) === Object(util_["getValueByPath"])(target, valueKey);
|
|
3588
|
+
});
|
|
3589
|
+
}
|
|
3590
|
+
},
|
|
3591
|
+
handleGroupDisabled: function handleGroupDisabled(val) {
|
|
3592
|
+
this.groupDisabled = val;
|
|
3593
|
+
},
|
|
3594
|
+
optionClick: function optionClick(e) {
|
|
3595
|
+
if (this.disabled !== true && this.groupDisabled !== true && this.limitReached !== true) {
|
|
3596
|
+
this.dispatch('MdsSelect', 'handleOptionClick', [this, true]);
|
|
3597
|
+
}
|
|
3598
|
+
},
|
|
3599
|
+
queryChange: function queryChange(query) {
|
|
3600
|
+
this.visible = new RegExp(Object(util_["escapeRegexpString"])(query), 'i').test(this.currentLabel) || this.created;
|
|
3601
|
+
if (!this.visible) {
|
|
3602
|
+
this.select.filteredOptionsCount--;
|
|
3603
|
+
}
|
|
3604
|
+
}
|
|
3605
|
+
},
|
|
3606
|
+
|
|
3607
|
+
created: function created() {
|
|
3608
|
+
this.select.options.push(this);
|
|
3609
|
+
this.select.cachedOptions.push(this);
|
|
3610
|
+
this.select.optionsCount++;
|
|
3611
|
+
this.select.filteredOptionsCount++;
|
|
3612
|
+
|
|
3613
|
+
this.$on('queryChange', this.queryChange);
|
|
3614
|
+
this.$on('handleGroupDisabled', this.handleGroupDisabled);
|
|
3615
|
+
},
|
|
3616
|
+
beforeDestroy: function beforeDestroy() {
|
|
3617
|
+
var _select2 = this.select,
|
|
3618
|
+
selected = _select2.selected,
|
|
3619
|
+
multiple = _select2.multiple;
|
|
3620
|
+
|
|
3621
|
+
var selectedOptions = multiple ? selected : [selected];
|
|
3622
|
+
var index = this.select.cachedOptions.indexOf(this);
|
|
3623
|
+
var selectedIndex = selectedOptions.indexOf(this);
|
|
3624
|
+
// if option is not selected, remove it from cache
|
|
3625
|
+
if (index > -1 && selectedIndex < 0) {
|
|
3626
|
+
this.select.cachedOptions.splice(index, 1);
|
|
3627
|
+
}
|
|
3628
|
+
this.select.onOptionDestroy(this.select.options.indexOf(this));
|
|
3629
|
+
}
|
|
3630
|
+
});
|
|
3631
|
+
// CONCATENATED MODULE: ./components/select/option.vue?vue&type=script&lang=js&
|
|
3632
|
+
/* harmony default export */ var select_optionvue_type_script_lang_js_ = (optionvue_type_script_lang_js_);
|
|
3633
|
+
// CONCATENATED MODULE: ./components/select/option.vue
|
|
3634
|
+
|
|
3635
|
+
|
|
3636
|
+
|
|
3637
|
+
|
|
3638
|
+
|
|
3639
|
+
/* normalize component */
|
|
3640
|
+
|
|
3641
|
+
var option_component = Object(componentNormalizer["a" /* default */])(
|
|
3642
|
+
select_optionvue_type_script_lang_js_,
|
|
3643
|
+
optionvue_type_template_id_71b3a886_render,
|
|
3644
|
+
optionvue_type_template_id_71b3a886_staticRenderFns,
|
|
3645
|
+
false,
|
|
3646
|
+
null,
|
|
3647
|
+
null,
|
|
3648
|
+
null
|
|
3649
|
+
|
|
3650
|
+
)
|
|
3651
|
+
|
|
3652
|
+
/* hot reload */
|
|
3653
|
+
if (false) { var option_api; }
|
|
3654
|
+
option_component.options.__file = "components/select/option.vue"
|
|
3655
|
+
/* harmony default export */ var select_option = (option_component.exports);
|
|
3656
|
+
// EXTERNAL MODULE: ./components/scroll-bar/index.js + 5 modules
|
|
3657
|
+
var scroll_bar = __webpack_require__(24);
|
|
3658
|
+
|
|
3659
|
+
// EXTERNAL MODULE: external "./tag"
|
|
3660
|
+
var external_tag_ = __webpack_require__(66);
|
|
3661
|
+
var external_tag_default = /*#__PURE__*/__webpack_require__.n(external_tag_);
|
|
3662
|
+
|
|
3663
|
+
// EXTERNAL MODULE: external "throttle-debounce"
|
|
3664
|
+
var external_throttle_debounce_ = __webpack_require__(39);
|
|
3665
|
+
|
|
3666
|
+
// EXTERNAL MODULE: external "./_util/resizeEvent"
|
|
3667
|
+
var resizeEvent_ = __webpack_require__(55);
|
|
3668
|
+
|
|
3669
|
+
// CONCATENATED MODULE: ./components/_util/clickoutside.js
|
|
3670
|
+
|
|
3671
|
+
|
|
3672
|
+
|
|
3673
|
+
var nodeList = [];
|
|
3674
|
+
var ctx = '@@clickoutsideContext';
|
|
3675
|
+
|
|
3676
|
+
var startClick = void 0;
|
|
3677
|
+
var seed = 0;
|
|
3678
|
+
|
|
3679
|
+
!external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$isServer && Object(_util_dom["d" /* on */])(document, 'mousedown', function (e) {
|
|
3680
|
+
return startClick = e;
|
|
3681
|
+
});
|
|
3682
|
+
|
|
3683
|
+
!external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_default.a.prototype.$isServer && Object(_util_dom["d" /* on */])(document, 'mouseup', function (e) {
|
|
3684
|
+
nodeList.forEach(function (node) {
|
|
3685
|
+
return node[ctx].documentHandler(e, startClick);
|
|
3686
|
+
});
|
|
3687
|
+
});
|
|
3688
|
+
|
|
3689
|
+
function createDocumentHandler(el, binding, vnode) {
|
|
3690
|
+
return function () {
|
|
3691
|
+
var mouseup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3692
|
+
var mousedown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3693
|
+
|
|
3694
|
+
if (!vnode || !vnode.context || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target || vnode.context.popperElm && (vnode.context.popperElm.contains(mouseup.target) || vnode.context.popperElm.contains(mousedown.target))) return;
|
|
3695
|
+
|
|
3696
|
+
if (binding.expression && el[ctx].methodName && vnode.context[el[ctx].methodName]) {
|
|
3697
|
+
vnode.context[el[ctx].methodName]();
|
|
3698
|
+
} else {
|
|
3699
|
+
el[ctx].bindingFn && el[ctx].bindingFn();
|
|
3700
|
+
}
|
|
3701
|
+
};
|
|
3702
|
+
}
|
|
3703
|
+
|
|
3704
|
+
/**
|
|
3705
|
+
* v-clickoutside
|
|
3706
|
+
* @desc 点击元素外面才会触发的事件
|
|
3707
|
+
* @example
|
|
3708
|
+
* ```vue
|
|
3709
|
+
* <div v-element-clickoutside="handleClose">
|
|
3710
|
+
* ```
|
|
3711
|
+
*/
|
|
3712
|
+
/* harmony default export */ var clickoutside = ({
|
|
3713
|
+
bind: function bind(el, binding, vnode) {
|
|
3714
|
+
nodeList.push(el);
|
|
3715
|
+
var id = seed++;
|
|
3716
|
+
el[ctx] = {
|
|
3717
|
+
id: id,
|
|
3718
|
+
documentHandler: createDocumentHandler(el, binding, vnode),
|
|
3719
|
+
methodName: binding.expression,
|
|
3720
|
+
bindingFn: binding.value
|
|
3721
|
+
};
|
|
3722
|
+
},
|
|
3723
|
+
update: function update(el, binding, vnode) {
|
|
3724
|
+
el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
|
|
3725
|
+
el[ctx].methodName = binding.expression;
|
|
3726
|
+
el[ctx].bindingFn = binding.value;
|
|
3727
|
+
},
|
|
3728
|
+
unbind: function unbind(el) {
|
|
3729
|
+
var len = nodeList.length;
|
|
3730
|
+
|
|
3731
|
+
for (var i = 0; i < len; i++) {
|
|
3732
|
+
if (nodeList[i][ctx].id === el[ctx].id) {
|
|
3733
|
+
nodeList.splice(i, 1);
|
|
3734
|
+
break;
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
delete el[ctx];
|
|
3738
|
+
}
|
|
3739
|
+
});
|
|
3740
|
+
// EXTERNAL MODULE: ./components/_util/util.js
|
|
3741
|
+
var util = __webpack_require__(11);
|
|
3742
|
+
|
|
3743
|
+
// EXTERNAL MODULE: external "./_util/proptype"
|
|
3744
|
+
var proptype_ = __webpack_require__(3);
|
|
3745
|
+
|
|
3746
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/select/select.vue?vue&type=script&lang=js&
|
|
3747
|
+
|
|
3748
|
+
//
|
|
3749
|
+
//
|
|
3750
|
+
//
|
|
3751
|
+
//
|
|
3752
|
+
//
|
|
3753
|
+
//
|
|
3754
|
+
//
|
|
3755
|
+
//
|
|
3756
|
+
//
|
|
3757
|
+
//
|
|
3758
|
+
//
|
|
3759
|
+
//
|
|
3760
|
+
//
|
|
3761
|
+
//
|
|
3762
|
+
//
|
|
3763
|
+
//
|
|
3764
|
+
//
|
|
3765
|
+
//
|
|
3766
|
+
//
|
|
3767
|
+
//
|
|
3768
|
+
//
|
|
3769
|
+
//
|
|
3770
|
+
//
|
|
3771
|
+
//
|
|
3772
|
+
//
|
|
3773
|
+
//
|
|
3774
|
+
//
|
|
3775
|
+
//
|
|
3776
|
+
//
|
|
3777
|
+
//
|
|
3778
|
+
//
|
|
3779
|
+
//
|
|
3780
|
+
//
|
|
3781
|
+
//
|
|
3782
|
+
//
|
|
3783
|
+
//
|
|
3784
|
+
//
|
|
3785
|
+
//
|
|
3786
|
+
//
|
|
3787
|
+
//
|
|
3788
|
+
//
|
|
3789
|
+
//
|
|
3790
|
+
//
|
|
3791
|
+
//
|
|
3792
|
+
//
|
|
3793
|
+
//
|
|
3794
|
+
//
|
|
3795
|
+
//
|
|
3796
|
+
//
|
|
3797
|
+
//
|
|
3798
|
+
//
|
|
3799
|
+
//
|
|
3800
|
+
//
|
|
3801
|
+
//
|
|
3802
|
+
//
|
|
3803
|
+
//
|
|
3804
|
+
//
|
|
3805
|
+
//
|
|
3806
|
+
//
|
|
3807
|
+
//
|
|
3808
|
+
//
|
|
3809
|
+
//
|
|
3810
|
+
//
|
|
3811
|
+
//
|
|
3812
|
+
//
|
|
3813
|
+
//
|
|
3814
|
+
//
|
|
3815
|
+
//
|
|
3816
|
+
//
|
|
3817
|
+
//
|
|
3818
|
+
//
|
|
3819
|
+
//
|
|
3820
|
+
//
|
|
3821
|
+
//
|
|
3822
|
+
//
|
|
3823
|
+
//
|
|
3824
|
+
//
|
|
3825
|
+
//
|
|
3826
|
+
//
|
|
3827
|
+
//
|
|
3828
|
+
//
|
|
3829
|
+
//
|
|
3830
|
+
//
|
|
3831
|
+
//
|
|
3832
|
+
//
|
|
3833
|
+
//
|
|
3834
|
+
//
|
|
3835
|
+
//
|
|
3836
|
+
//
|
|
3837
|
+
//
|
|
3838
|
+
//
|
|
3839
|
+
//
|
|
3840
|
+
//
|
|
3841
|
+
//
|
|
3842
|
+
//
|
|
3843
|
+
//
|
|
3844
|
+
//
|
|
3845
|
+
//
|
|
3846
|
+
//
|
|
3847
|
+
//
|
|
3848
|
+
//
|
|
3849
|
+
//
|
|
3850
|
+
//
|
|
3851
|
+
//
|
|
3852
|
+
//
|
|
3853
|
+
//
|
|
3854
|
+
//
|
|
3855
|
+
//
|
|
3856
|
+
//
|
|
3857
|
+
//
|
|
3858
|
+
//
|
|
3859
|
+
//
|
|
3860
|
+
//
|
|
3861
|
+
//
|
|
3862
|
+
//
|
|
3863
|
+
//
|
|
3864
|
+
//
|
|
3865
|
+
//
|
|
3866
|
+
//
|
|
3867
|
+
//
|
|
3868
|
+
//
|
|
3869
|
+
//
|
|
3870
|
+
//
|
|
3871
|
+
//
|
|
3872
|
+
//
|
|
3873
|
+
//
|
|
3874
|
+
//
|
|
3875
|
+
//
|
|
3876
|
+
//
|
|
3877
|
+
//
|
|
3878
|
+
//
|
|
3879
|
+
//
|
|
3880
|
+
//
|
|
3881
|
+
//
|
|
3882
|
+
//
|
|
3883
|
+
//
|
|
3884
|
+
//
|
|
3885
|
+
//
|
|
3886
|
+
//
|
|
3887
|
+
//
|
|
3888
|
+
//
|
|
3889
|
+
//
|
|
3890
|
+
//
|
|
3891
|
+
//
|
|
3892
|
+
//
|
|
3893
|
+
//
|
|
3894
|
+
//
|
|
3895
|
+
//
|
|
3896
|
+
//
|
|
3897
|
+
//
|
|
3898
|
+
//
|
|
3899
|
+
//
|
|
3900
|
+
//
|
|
3901
|
+
//
|
|
3902
|
+
//
|
|
3903
|
+
//
|
|
3904
|
+
//
|
|
3905
|
+
//
|
|
3906
|
+
//
|
|
3907
|
+
//
|
|
3908
|
+
//
|
|
3909
|
+
|
|
3910
|
+
|
|
3911
|
+
|
|
3912
|
+
|
|
3913
|
+
|
|
3914
|
+
|
|
3915
|
+
|
|
3916
|
+
|
|
3917
|
+
|
|
3918
|
+
|
|
3919
|
+
|
|
3920
|
+
|
|
3921
|
+
|
|
3922
|
+
|
|
3923
|
+
var SIZEMAP = {
|
|
3924
|
+
mini: 'mn',
|
|
3925
|
+
small: 'sm',
|
|
3926
|
+
medium: 'md',
|
|
3927
|
+
default: '',
|
|
3928
|
+
large: 'lg'
|
|
3929
|
+
};
|
|
3930
|
+
/* harmony default export */ var selectvue_type_script_lang_js_ = ({
|
|
3931
|
+
name: 'MdsSelect',
|
|
3932
|
+
componentName: 'MdsSelect',
|
|
3933
|
+
directives: { Clickoutside: clickoutside },
|
|
3934
|
+
mixins: [emitter_default.a],
|
|
3935
|
+
components: {
|
|
3936
|
+
MdsInput: external_input_default.a,
|
|
3937
|
+
MdsDropDown: select_dropdown,
|
|
3938
|
+
MdsOption: select_option,
|
|
3939
|
+
MdsScrollBar: scroll_bar["a" /* default */],
|
|
3940
|
+
MdsIcon: external_icon_default.a,
|
|
3941
|
+
MdsTag: external_tag_default.a
|
|
3942
|
+
},
|
|
3943
|
+
provide: function provide() {
|
|
3944
|
+
return {
|
|
3945
|
+
select: this
|
|
3946
|
+
};
|
|
3947
|
+
},
|
|
3948
|
+
|
|
3949
|
+
|
|
3950
|
+
computed: {
|
|
3951
|
+
// 存在dropdown-slot
|
|
3952
|
+
hasSlot: function hasSlot() {
|
|
3953
|
+
return this.$slots.dropDownRender && this.$slots.dropDownRender.length !== 0;
|
|
3954
|
+
},
|
|
3955
|
+
|
|
3956
|
+
// 外层class
|
|
3957
|
+
wrapperClass: function wrapperClass() {
|
|
3958
|
+
return [this.prefixCls, this.selectSize ? this.prefixCls + '-' + this.selectSize : ''];
|
|
3959
|
+
},
|
|
3960
|
+
|
|
3961
|
+
// tags 容器class
|
|
3962
|
+
wrapperTagsClass: function wrapperTagsClass() {
|
|
3963
|
+
return [this.prefixCls + '-tags-warrp'];
|
|
3964
|
+
},
|
|
3965
|
+
|
|
3966
|
+
// 搜索的inputclass
|
|
3967
|
+
wrapperSearchInputClass: function wrapperSearchInputClass() {
|
|
3968
|
+
return [this.prefixCls + '-inner-input', this.selectSize ? 'is-' + this.selectSize : ''];
|
|
3969
|
+
},
|
|
3970
|
+
readonly: function readonly() {
|
|
3971
|
+
return !this.filterable || this.multiple || !Object(util["g" /* isIE */])() && !Object(util["e" /* isEdge */])() && !this.visible;
|
|
3972
|
+
},
|
|
3973
|
+
|
|
3974
|
+
// 展示关闭
|
|
3975
|
+
showClose: function showClose() {
|
|
3976
|
+
var hasValue = this.multiple ? Array.isArray(this.value) && this.value.length > 0 : this.value !== undefined && this.value !== null && this.value !== '';
|
|
3977
|
+
var criteria = this.clearable && !this.selectDisabled && this.inputHovering && hasValue;
|
|
3978
|
+
return criteria;
|
|
3979
|
+
},
|
|
3980
|
+
iconClass: function iconClass() {
|
|
3981
|
+
return this.remote || this.filterable ? this.visible ? 'mdsicon-line-search' : '' : this.visible ? this.prefixCls + '-active-icon' : this.prefixCls + '-normal-icon';
|
|
3982
|
+
},
|
|
3983
|
+
debounce: function debounce() {
|
|
3984
|
+
return this.remote ? 300 : 0;
|
|
3985
|
+
},
|
|
3986
|
+
|
|
3987
|
+
// 空文档
|
|
3988
|
+
emptyText: function emptyText() {
|
|
3989
|
+
if (this.loading) {
|
|
3990
|
+
return this.loadingText;
|
|
3991
|
+
} else {
|
|
3992
|
+
if (this.remote && this.query === '' && this.options.length === 0) {
|
|
3993
|
+
return false;
|
|
3994
|
+
}
|
|
3995
|
+
if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
|
|
3996
|
+
return this.noMatchText;
|
|
3997
|
+
}
|
|
3998
|
+
if (this.options.length === 0) {
|
|
3999
|
+
return this.noDataText;
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
return null;
|
|
4003
|
+
},
|
|
4004
|
+
showNewOption: function showNewOption() {
|
|
4005
|
+
var _this = this;
|
|
4006
|
+
|
|
4007
|
+
var hasExistingOption = this.options.filter(function (option) {
|
|
4008
|
+
return !option.created;
|
|
4009
|
+
}).some(function (option) {
|
|
4010
|
+
return option.currentLabel === _this.query;
|
|
4011
|
+
});
|
|
4012
|
+
return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
|
|
4013
|
+
},
|
|
4014
|
+
selectSize: function selectSize() {
|
|
4015
|
+
var size = this.size;
|
|
4016
|
+
return SIZEMAP[size];
|
|
4017
|
+
},
|
|
4018
|
+
selectDisabled: function selectDisabled() {
|
|
4019
|
+
return this.disabled;
|
|
4020
|
+
}
|
|
4021
|
+
},
|
|
4022
|
+
props: {
|
|
4023
|
+
name: String,
|
|
4024
|
+
id: String,
|
|
4025
|
+
value: {
|
|
4026
|
+
required: true
|
|
4027
|
+
},
|
|
4028
|
+
autocomplete: {
|
|
4029
|
+
type: String,
|
|
4030
|
+
default: 'off'
|
|
4031
|
+
},
|
|
4032
|
+
/** @Deprecated in next major version */
|
|
4033
|
+
autoComplete: {
|
|
4034
|
+
type: String,
|
|
4035
|
+
validator: function validator(val) {
|
|
4036
|
+
return true;
|
|
4037
|
+
}
|
|
4038
|
+
},
|
|
4039
|
+
automaticDropdown: Boolean,
|
|
4040
|
+
size: {
|
|
4041
|
+
validator: function validator(value) {
|
|
4042
|
+
return Object(proptype_["oneOf"])(value, keys_default()(SIZEMAP));
|
|
4043
|
+
},
|
|
4044
|
+
default: 'medium'
|
|
4045
|
+
},
|
|
4046
|
+
disabled: Boolean,
|
|
4047
|
+
clearable: Boolean,
|
|
4048
|
+
filterable: Boolean,
|
|
4049
|
+
allowCreate: Boolean,
|
|
4050
|
+
loading: Boolean,
|
|
4051
|
+
popperClass: String,
|
|
4052
|
+
remote: Boolean,
|
|
4053
|
+
loadingText: {
|
|
4054
|
+
type: String,
|
|
4055
|
+
default: '加载中'
|
|
4056
|
+
},
|
|
4057
|
+
noMatchText: {
|
|
4058
|
+
type: String,
|
|
4059
|
+
default: '暂无数据'
|
|
4060
|
+
},
|
|
4061
|
+
noDataText: {
|
|
4062
|
+
type: String,
|
|
4063
|
+
default: '暂无数据'
|
|
4064
|
+
},
|
|
4065
|
+
remoteMethod: Function,
|
|
4066
|
+
filterMethod: Function,
|
|
4067
|
+
multiple: Boolean,
|
|
4068
|
+
multipleLimit: {
|
|
4069
|
+
type: Number,
|
|
4070
|
+
default: 0
|
|
4071
|
+
},
|
|
4072
|
+
placeholder: {
|
|
4073
|
+
type: String,
|
|
4074
|
+
default: function _default() {
|
|
4075
|
+
// return t('el.select.placeholder')
|
|
4076
|
+
}
|
|
4077
|
+
},
|
|
4078
|
+
defaultFirstOption: Boolean,
|
|
4079
|
+
reserveKeyword: Boolean,
|
|
4080
|
+
valueKey: {
|
|
4081
|
+
type: String,
|
|
4082
|
+
default: 'value'
|
|
4083
|
+
},
|
|
4084
|
+
collapseTags: Boolean,
|
|
4085
|
+
popperAppendToBody: {
|
|
4086
|
+
type: Boolean,
|
|
4087
|
+
default: true
|
|
4088
|
+
},
|
|
4089
|
+
prefixCls: {
|
|
4090
|
+
type: String,
|
|
4091
|
+
default: 'mds-select'
|
|
4092
|
+
},
|
|
4093
|
+
/**
|
|
4094
|
+
* @Description 用来控制回显内容的key(选项本身需包含该属性)
|
|
4095
|
+
* @Date 2020-10-23 10:47:44 星期五
|
|
4096
|
+
*/
|
|
4097
|
+
echoKey: {
|
|
4098
|
+
type: String
|
|
4099
|
+
},
|
|
4100
|
+
width: String
|
|
4101
|
+
},
|
|
4102
|
+
|
|
4103
|
+
data: function data() {
|
|
4104
|
+
return {
|
|
4105
|
+
options: [],
|
|
4106
|
+
cachedOptions: [],
|
|
4107
|
+
createdLabel: null,
|
|
4108
|
+
createdSelected: false,
|
|
4109
|
+
selected: this.multiple ? [] : {},
|
|
4110
|
+
inputLength: 20,
|
|
4111
|
+
inputWidth: 0,
|
|
4112
|
+
initialInputHeight: 0,
|
|
4113
|
+
cachedPlaceHolder: '',
|
|
4114
|
+
optionsCount: 0,
|
|
4115
|
+
filteredOptionsCount: 0,
|
|
4116
|
+
visible: false,
|
|
4117
|
+
softFocus: false,
|
|
4118
|
+
selectedLabel: '',
|
|
4119
|
+
hoverIndex: -1,
|
|
4120
|
+
query: '',
|
|
4121
|
+
previousQuery: null,
|
|
4122
|
+
inputHovering: false,
|
|
4123
|
+
currentPlaceholder: '',
|
|
4124
|
+
menuVisibleOnFocus: false,
|
|
4125
|
+
isOnComposition: false,
|
|
4126
|
+
isSilentBlur: false
|
|
4127
|
+
};
|
|
4128
|
+
},
|
|
4129
|
+
|
|
4130
|
+
|
|
4131
|
+
watch: {
|
|
4132
|
+
selectDisabled: function selectDisabled() {
|
|
4133
|
+
var _this2 = this;
|
|
4134
|
+
|
|
4135
|
+
this.$nextTick(function () {
|
|
4136
|
+
_this2.resetInputHeight();
|
|
4137
|
+
});
|
|
4138
|
+
},
|
|
4139
|
+
placeholder: function placeholder(val) {
|
|
4140
|
+
this.cachedPlaceHolder = this.currentPlaceholder = val;
|
|
4141
|
+
},
|
|
4142
|
+
value: function value(val, oldVal) {
|
|
4143
|
+
if (this.multiple) {
|
|
4144
|
+
this.resetInputHeight();
|
|
4145
|
+
if (val && val.length > 0 || this.$refs.input && this.query !== '') {
|
|
4146
|
+
this.currentPlaceholder = '';
|
|
4147
|
+
} else {
|
|
4148
|
+
this.currentPlaceholder = this.cachedPlaceHolder;
|
|
4149
|
+
}
|
|
4150
|
+
if (this.filterable && !this.reserveKeyword) {
|
|
4151
|
+
this.query = '';
|
|
4152
|
+
this.handleQueryChange(this.query);
|
|
4153
|
+
}
|
|
4154
|
+
}
|
|
4155
|
+
this.setSelected();
|
|
4156
|
+
if (this.filterable && !this.multiple) {
|
|
4157
|
+
this.inputLength = 20;
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4160
|
+
if (!Object(util["h" /* valueEquals */])(val, oldVal)) {
|
|
4161
|
+
this.dispatch('MdsFormItem', 'formItemChange', val);
|
|
4162
|
+
}
|
|
4163
|
+
},
|
|
4164
|
+
visible: function visible(val) {
|
|
4165
|
+
var _this3 = this;
|
|
4166
|
+
|
|
4167
|
+
if (!val) {
|
|
4168
|
+
this.broadcast('MdsSelectDropdown', 'destroyPopper');
|
|
4169
|
+
if (this.$refs.input) {
|
|
4170
|
+
this.$refs.input.blur();
|
|
4171
|
+
}
|
|
4172
|
+
this.query = '';
|
|
4173
|
+
this.previousQuery = null;
|
|
4174
|
+
this.selectedLabel = '';
|
|
4175
|
+
this.inputLength = 20;
|
|
4176
|
+
this.menuVisibleOnFocus = false;
|
|
4177
|
+
this.resetHoverIndex();
|
|
4178
|
+
this.$nextTick(function () {
|
|
4179
|
+
if (_this3.$refs.input && _this3.$refs.input.value === '' && _this3.selected.length === 0) {
|
|
4180
|
+
_this3.currentPlaceholder = _this3.cachedPlaceHolder;
|
|
4181
|
+
}
|
|
4182
|
+
});
|
|
4183
|
+
if (!this.multiple) {
|
|
4184
|
+
if (this.selected) {
|
|
4185
|
+
if (this.filterable && this.allowCreate && this.createdSelected && this.createdLabel) {
|
|
4186
|
+
this.selectedLabel = this.createdLabel;
|
|
4187
|
+
} else if (this.echoKey && this.selected[this.echoKey]) {
|
|
4188
|
+
this.selectedLabel = this.selected[this.echoKey];
|
|
4189
|
+
} else {
|
|
4190
|
+
this.selectedLabel = this.selected.currentLabel;
|
|
4191
|
+
}
|
|
4192
|
+
if (this.filterable) this.query = this.selectedLabel;
|
|
4193
|
+
}
|
|
4194
|
+
|
|
4195
|
+
if (this.filterable) {
|
|
4196
|
+
this.currentPlaceholder = this.cachedPlaceHolder;
|
|
4197
|
+
}
|
|
4198
|
+
}
|
|
4199
|
+
} else {
|
|
4200
|
+
this.broadcast('MdsSelectDropdown', 'updatePopper');
|
|
4201
|
+
if (this.filterable) {
|
|
4202
|
+
this.query = this.remote ? '' : this.selectedLabel;
|
|
4203
|
+
this.handleQueryChange(this.query);
|
|
4204
|
+
if (this.multiple) {
|
|
4205
|
+
this.$refs.input.focus();
|
|
4206
|
+
} else {
|
|
4207
|
+
if (!this.remote) {
|
|
4208
|
+
this.broadcast('MdsOption', 'queryChange', '');
|
|
4209
|
+
this.broadcast('MdsOptionGroup', 'queryChange');
|
|
4210
|
+
}
|
|
4211
|
+
|
|
4212
|
+
if (this.selectedLabel) {
|
|
4213
|
+
this.currentPlaceholder = this.selectedLabel;
|
|
4214
|
+
this.selectedLabel = '';
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
this.$emit('visible-change', val);
|
|
4220
|
+
},
|
|
4221
|
+
options: function options() {
|
|
4222
|
+
var _this4 = this;
|
|
4223
|
+
|
|
4224
|
+
if (this.$isServer) return;
|
|
4225
|
+
this.$nextTick(function () {
|
|
4226
|
+
_this4.broadcast('MdsSelectDropdown', 'updatePopper');
|
|
4227
|
+
});
|
|
4228
|
+
if (this.multiple) {
|
|
4229
|
+
this.resetInputHeight();
|
|
4230
|
+
}
|
|
4231
|
+
var inputs = this.$el.querySelectorAll('input');
|
|
4232
|
+
if ([].indexOf.call(inputs, document.activeElement) === -1) {
|
|
4233
|
+
this.setSelected();
|
|
4234
|
+
}
|
|
4235
|
+
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
|
|
4236
|
+
this.checkDefaultFirstOption();
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
},
|
|
4240
|
+
|
|
4241
|
+
methods: {
|
|
4242
|
+
handleElli: function handleElli(el, left, wrapperWidth) {
|
|
4243
|
+
var mLeft = parseInt(getComputedStyle(el).marginLeft);
|
|
4244
|
+
var pRight = parseInt(getComputedStyle(el).paddingRight);
|
|
4245
|
+
var tagWidth = parseInt(getComputedStyle(el).width);
|
|
4246
|
+
if (tagWidth + left + mLeft + pRight > wrapperWidth) {
|
|
4247
|
+
if (!this.collapseTags) {
|
|
4248
|
+
el.parentElement.style.maxWidth = '100%';
|
|
4249
|
+
}
|
|
4250
|
+
el.style.display = 'flex';
|
|
4251
|
+
el.style.alignItems = 'center';
|
|
4252
|
+
el.style.overflow = 'hidden';
|
|
4253
|
+
el.style.textOverflow = 'ellipsis';
|
|
4254
|
+
el.style.whiteSpace = 'nowrap';
|
|
4255
|
+
var tagEl = el.children[0];
|
|
4256
|
+
tagEl.style.overflow = 'hidden';
|
|
4257
|
+
tagEl.style.textOverflow = 'ellipsis';
|
|
4258
|
+
tagEl.style.wordBreak = 'break-all';
|
|
4259
|
+
// debugger
|
|
4260
|
+
// const icon = el.children[0].children[1]
|
|
4261
|
+
// icon.style.position = 'absolute'
|
|
4262
|
+
// icon.style.top = '10px'
|
|
4263
|
+
// icon.style.right = '4px'
|
|
4264
|
+
}
|
|
4265
|
+
},
|
|
4266
|
+
tagElli: function tagElli() {
|
|
4267
|
+
var _this5 = this;
|
|
4268
|
+
|
|
4269
|
+
this.$nextTick(function () {
|
|
4270
|
+
if (_this5.$refs.tags && _this5.$refs.tag) {
|
|
4271
|
+
var wrapperWidth = parseInt(getComputedStyle(_this5.$refs.tags).width);
|
|
4272
|
+
var left = parseInt(getComputedStyle(_this5.$refs.tags).paddingLeft);
|
|
4273
|
+
if (Array.isArray(_this5.$refs.tag)) {
|
|
4274
|
+
_this5.$refs.tag.forEach(function (item) {
|
|
4275
|
+
var el = item.$el;
|
|
4276
|
+
_this5.handleElli(el, left, wrapperWidth);
|
|
4277
|
+
});
|
|
4278
|
+
} else {
|
|
4279
|
+
var el = _this5.$refs.tag.$el;
|
|
4280
|
+
_this5.$nextTick(function () {
|
|
4281
|
+
_this5.handleElli(el, left, wrapperWidth);
|
|
4282
|
+
});
|
|
4283
|
+
}
|
|
4284
|
+
}
|
|
4285
|
+
});
|
|
4286
|
+
},
|
|
4287
|
+
handleComposition: function handleComposition(event) {
|
|
4288
|
+
var _this6 = this;
|
|
4289
|
+
|
|
4290
|
+
var text = event.target.value;
|
|
4291
|
+
if (event.type === 'compositionend') {
|
|
4292
|
+
this.isOnComposition = false;
|
|
4293
|
+
this.$nextTick(function (_) {
|
|
4294
|
+
return _this6.handleQueryChange(text);
|
|
4295
|
+
});
|
|
4296
|
+
} else {
|
|
4297
|
+
this.isOnComposition = true;
|
|
4298
|
+
}
|
|
4299
|
+
},
|
|
4300
|
+
handleQueryChange: function handleQueryChange(val) {
|
|
4301
|
+
var _this7 = this;
|
|
4302
|
+
|
|
4303
|
+
if (this.previousQuery === val || this.isOnComposition) return;
|
|
4304
|
+
if (this.previousQuery === null && (typeof this.filterMethod === 'function' || typeof this.remoteMethod === 'function')) {
|
|
4305
|
+
this.previousQuery = val;
|
|
4306
|
+
return;
|
|
4307
|
+
}
|
|
4308
|
+
this.previousQuery = val;
|
|
4309
|
+
this.$nextTick(function () {
|
|
4310
|
+
if (_this7.visible) _this7.broadcast('MdsSelectDropdown', 'updatePopper');
|
|
4311
|
+
});
|
|
4312
|
+
this.hoverIndex = -1;
|
|
4313
|
+
if (this.multiple && this.filterable) {
|
|
4314
|
+
this.$nextTick(function () {
|
|
4315
|
+
var length = _this7.$refs.input.value.length * 15 + 20;
|
|
4316
|
+
_this7.inputLength = _this7.collapseTags ? Math.min(50, length) : length;
|
|
4317
|
+
_this7.managePlaceholder();
|
|
4318
|
+
_this7.resetInputHeight();
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4321
|
+
if (this.remote && typeof this.remoteMethod === 'function') {
|
|
4322
|
+
this.hoverIndex = -1;
|
|
4323
|
+
this.remoteMethod(val);
|
|
4324
|
+
} else if (typeof this.filterMethod === 'function') {
|
|
4325
|
+
this.filterMethod(val);
|
|
4326
|
+
this.broadcast('MdsOptionGroup', 'queryChange');
|
|
4327
|
+
} else {
|
|
4328
|
+
this.filteredOptionsCount = this.optionsCount;
|
|
4329
|
+
this.broadcast('MdsOption', 'queryChange', val);
|
|
4330
|
+
this.broadcast('MdsOptionGroup', 'queryChange');
|
|
4331
|
+
}
|
|
4332
|
+
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
|
|
4333
|
+
this.checkDefaultFirstOption();
|
|
4334
|
+
}
|
|
4335
|
+
},
|
|
4336
|
+
scrollToOption: function scrollToOption(option) {
|
|
4337
|
+
var target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
|
|
4338
|
+
if (this.$refs.popper && target) {
|
|
4339
|
+
// const menu = this.$refs.popper.$el.querySelector('.mds-select-dropdown-wrap')
|
|
4340
|
+
// scrollIntoView(menu, target)
|
|
4341
|
+
}
|
|
4342
|
+
this.$refs.scrollbar && this.$refs.scrollbar.handleScroll();
|
|
4343
|
+
},
|
|
4344
|
+
handleMenuEnter: function handleMenuEnter() {
|
|
4345
|
+
var _this8 = this;
|
|
4346
|
+
|
|
4347
|
+
this.$nextTick(function () {
|
|
4348
|
+
return _this8.scrollToOption(_this8.selected);
|
|
4349
|
+
});
|
|
4350
|
+
},
|
|
4351
|
+
emitChange: function emitChange(val) {
|
|
4352
|
+
var _this9 = this;
|
|
4353
|
+
|
|
4354
|
+
if (!Object(util["h" /* valueEquals */])(this.value, val)) {
|
|
4355
|
+
this.$emit('change', val);
|
|
4356
|
+
this.$nextTick(function () {
|
|
4357
|
+
_this9.tagElli();
|
|
4358
|
+
});
|
|
4359
|
+
}
|
|
4360
|
+
},
|
|
4361
|
+
getOption: function getOption(value) {
|
|
4362
|
+
var option = void 0;
|
|
4363
|
+
var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
|
|
4364
|
+
var isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]';
|
|
4365
|
+
var isUndefined = Object.prototype.toString.call(value).toLowerCase() === '[object undefined]';
|
|
4366
|
+
|
|
4367
|
+
for (var i = this.cachedOptions.length - 1; i >= 0; i--) {
|
|
4368
|
+
var cachedOption = this.cachedOptions[i];
|
|
4369
|
+
var isEqual = isObject ? Object(util["d" /* getValueByPath */])(cachedOption.value, this.valueKey) === Object(util["d" /* getValueByPath */])(value, this.valueKey) : cachedOption.value === value;
|
|
4370
|
+
if (isEqual) {
|
|
4371
|
+
option = cachedOption;
|
|
4372
|
+
break;
|
|
4373
|
+
}
|
|
4374
|
+
}
|
|
4375
|
+
if (option) return option;
|
|
4376
|
+
var label = !isObject && !isNull && !isUndefined ? value : '';
|
|
4377
|
+
var newOption = {
|
|
4378
|
+
value: value,
|
|
4379
|
+
currentLabel: label
|
|
4380
|
+
};
|
|
4381
|
+
if (this.multiple) {
|
|
4382
|
+
newOption.hitState = false;
|
|
4383
|
+
}
|
|
4384
|
+
return newOption;
|
|
4385
|
+
},
|
|
4386
|
+
setSelected: function setSelected() {
|
|
4387
|
+
var _this10 = this;
|
|
4388
|
+
|
|
4389
|
+
if (!this.multiple) {
|
|
4390
|
+
var option = this.getOption(this.value);
|
|
4391
|
+
if (option.created) {
|
|
4392
|
+
this.createdLabel = option.currentLabel;
|
|
4393
|
+
this.createdSelected = true;
|
|
4394
|
+
} else {
|
|
4395
|
+
this.createdSelected = false;
|
|
4396
|
+
}
|
|
4397
|
+
// this.selectedLabel = option.currentLabel
|
|
4398
|
+
this.selectedLabel = this.echoKey ? option[this.echoKey] : option.currentLabel;
|
|
4399
|
+
this.selected = option;
|
|
4400
|
+
if (this.filterable) this.query = this.selectedLabel;
|
|
4401
|
+
return;
|
|
4402
|
+
}
|
|
4403
|
+
var result = [];
|
|
4404
|
+
if (Array.isArray(this.value)) {
|
|
4405
|
+
this.value.forEach(function (value) {
|
|
4406
|
+
result.push(_this10.getOption(value));
|
|
4407
|
+
});
|
|
4408
|
+
}
|
|
4409
|
+
this.selected = result;
|
|
4410
|
+
this.$nextTick(function () {
|
|
4411
|
+
_this10.resetInputHeight();
|
|
4412
|
+
});
|
|
4413
|
+
},
|
|
4414
|
+
handleFocus: function handleFocus(event) {
|
|
4415
|
+
if (!this.softFocus) {
|
|
4416
|
+
if (this.automaticDropdown || this.filterable) {
|
|
4417
|
+
this.visible = true;
|
|
4418
|
+
if (this.filterable) {
|
|
4419
|
+
this.menuVisibleOnFocus = true;
|
|
4420
|
+
}
|
|
4421
|
+
}
|
|
4422
|
+
this.$emit('focus', event);
|
|
4423
|
+
} else {
|
|
4424
|
+
this.softFocus = false;
|
|
4425
|
+
}
|
|
4426
|
+
},
|
|
4427
|
+
blur: function blur() {
|
|
4428
|
+
this.visible = false;
|
|
4429
|
+
this.$refs.reference.blur();
|
|
4430
|
+
},
|
|
4431
|
+
focus: function focus() {
|
|
4432
|
+
this.visible = true;
|
|
4433
|
+
this.$refs.reference.focus();
|
|
4434
|
+
},
|
|
4435
|
+
handleBlur: function handleBlur(event) {
|
|
4436
|
+
var _this11 = this;
|
|
4437
|
+
|
|
4438
|
+
setTimeout(function () {
|
|
4439
|
+
if (_this11.isSilentBlur) {
|
|
4440
|
+
_this11.isSilentBlur = false;
|
|
4441
|
+
} else {
|
|
4442
|
+
_this11.$emit('blur', event);
|
|
4443
|
+
}
|
|
4444
|
+
}, 50);
|
|
4445
|
+
this.softFocus = false;
|
|
4446
|
+
},
|
|
4447
|
+
handleClearClick: function handleClearClick(event) {
|
|
4448
|
+
this.deleteSelected(event);
|
|
4449
|
+
},
|
|
4450
|
+
doDestroy: function doDestroy() {
|
|
4451
|
+
this.$refs.popper && this.$refs.popper.doDestroy();
|
|
4452
|
+
},
|
|
4453
|
+
handleClose: function handleClose() {
|
|
4454
|
+
this.visible = false;
|
|
4455
|
+
},
|
|
4456
|
+
toggleLastOptionHitState: function toggleLastOptionHitState(hit) {
|
|
4457
|
+
if (!Array.isArray(this.selected)) return;
|
|
4458
|
+
var option = this.selected[this.selected.length - 1];
|
|
4459
|
+
if (!option) return;
|
|
4460
|
+
|
|
4461
|
+
if (hit === true || hit === false) {
|
|
4462
|
+
option.hitState = hit;
|
|
4463
|
+
return hit;
|
|
4464
|
+
}
|
|
4465
|
+
|
|
4466
|
+
option.hitState = !option.hitState;
|
|
4467
|
+
return option.hitState;
|
|
4468
|
+
},
|
|
4469
|
+
deletePrevTag: function deletePrevTag(e) {
|
|
4470
|
+
if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
|
|
4471
|
+
var value = this.value.slice();
|
|
4472
|
+
value.pop();
|
|
4473
|
+
this.$emit('input', value);
|
|
4474
|
+
this.emitChange(value);
|
|
4475
|
+
}
|
|
4476
|
+
},
|
|
4477
|
+
managePlaceholder: function managePlaceholder() {
|
|
4478
|
+
if (this.currentPlaceholder !== '') {
|
|
4479
|
+
this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
|
|
4480
|
+
}
|
|
4481
|
+
},
|
|
4482
|
+
resetInputState: function resetInputState(e) {
|
|
4483
|
+
if (e.keyCode !== 8) this.toggleLastOptionHitState(false);
|
|
4484
|
+
this.inputLength = this.$refs.input.value.length * 15 + 20;
|
|
4485
|
+
this.resetInputHeight();
|
|
4486
|
+
},
|
|
4487
|
+
resetInputHeight: function resetInputHeight() {
|
|
4488
|
+
var _this12 = this;
|
|
4489
|
+
|
|
4490
|
+
// if (this.collapseTags && !this.filterable) return
|
|
4491
|
+
this.$nextTick(function () {
|
|
4492
|
+
if (!_this12.$refs.reference) return;
|
|
4493
|
+
var inputChildNodes = _this12.$refs.reference.$el.childNodes;
|
|
4494
|
+
var input = [].filter.call(inputChildNodes, function (item) {
|
|
4495
|
+
return item.tagName === 'INPUT';
|
|
4496
|
+
})[0];
|
|
4497
|
+
var tags = _this12.$refs.tags;
|
|
4498
|
+
var sizeInMap = _this12.initialInputHeight || 40;
|
|
4499
|
+
input.style.height = _this12.selected.length === 0 ? sizeInMap + 'px' : Math.max(tags ? tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap) + 'px';
|
|
4500
|
+
if (_this12.visible && _this12.emptyText !== false) {
|
|
4501
|
+
_this12.broadcast('MdsSelectDropdown', 'updatePopper');
|
|
4502
|
+
}
|
|
4503
|
+
});
|
|
4504
|
+
},
|
|
4505
|
+
resetHoverIndex: function resetHoverIndex() {
|
|
4506
|
+
var _this13 = this;
|
|
4507
|
+
|
|
4508
|
+
setTimeout(function () {
|
|
4509
|
+
if (!_this13.multiple) {
|
|
4510
|
+
_this13.hoverIndex = _this13.options.indexOf(_this13.selected);
|
|
4511
|
+
} else {
|
|
4512
|
+
if (_this13.selected.length > 0) {
|
|
4513
|
+
_this13.hoverIndex = Math.min.apply(null, _this13.selected.map(function (item) {
|
|
4514
|
+
return _this13.options.indexOf(item);
|
|
4515
|
+
}));
|
|
4516
|
+
} else {
|
|
4517
|
+
_this13.hoverIndex = -1;
|
|
4518
|
+
}
|
|
4519
|
+
}
|
|
4520
|
+
}, 300);
|
|
4521
|
+
},
|
|
4522
|
+
handleOptionSelect: function handleOptionSelect(option, byClick) {
|
|
4523
|
+
var _this14 = this;
|
|
4524
|
+
|
|
4525
|
+
if (this.multiple) {
|
|
4526
|
+
var value = (this.value || []).slice();
|
|
4527
|
+
var optionIndex = this.getValueIndex(value, option.value);
|
|
4528
|
+
if (optionIndex > -1) {
|
|
4529
|
+
value.splice(optionIndex, 1);
|
|
4530
|
+
} else if (this.multipleLimit <= 0 || value.length < this.multipleLimit) {
|
|
4531
|
+
value.push(option.value);
|
|
4532
|
+
}
|
|
4533
|
+
this.$emit('input', value);
|
|
4534
|
+
this.emitChange(value);
|
|
4535
|
+
if (option.created) {
|
|
4536
|
+
this.query = '';
|
|
4537
|
+
this.handleQueryChange('');
|
|
4538
|
+
this.inputLength = 20;
|
|
4539
|
+
}
|
|
4540
|
+
if (this.filterable) this.$refs.input.focus();
|
|
4541
|
+
} else {
|
|
4542
|
+
this.$emit('input', option.value);
|
|
4543
|
+
this.emitChange(option.value);
|
|
4544
|
+
this.visible = false;
|
|
4545
|
+
}
|
|
4546
|
+
this.isSilentBlur = byClick;
|
|
4547
|
+
this.setSoftFocus();
|
|
4548
|
+
if (this.visible) return;
|
|
4549
|
+
this.$nextTick(function () {
|
|
4550
|
+
_this14.scrollToOption(option);
|
|
4551
|
+
});
|
|
4552
|
+
},
|
|
4553
|
+
setSoftFocus: function setSoftFocus() {
|
|
4554
|
+
this.softFocus = true;
|
|
4555
|
+
var input = this.$refs.input || this.$refs.reference;
|
|
4556
|
+
if (input) {
|
|
4557
|
+
input.focus();
|
|
4558
|
+
}
|
|
4559
|
+
},
|
|
4560
|
+
getValueIndex: function getValueIndex() {
|
|
4561
|
+
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
4562
|
+
var value = arguments[1];
|
|
4563
|
+
|
|
4564
|
+
var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
|
|
4565
|
+
if (!isObject) {
|
|
4566
|
+
return arr.indexOf(value);
|
|
4567
|
+
} else {
|
|
4568
|
+
var valueKey = this.valueKey;
|
|
4569
|
+
var index = -1;
|
|
4570
|
+
arr.some(function (item, i) {
|
|
4571
|
+
if (Object(util["d" /* getValueByPath */])(item, valueKey) === Object(util["d" /* getValueByPath */])(value, valueKey)) {
|
|
4572
|
+
index = i;
|
|
4573
|
+
return true;
|
|
4574
|
+
}
|
|
4575
|
+
return false;
|
|
4576
|
+
});
|
|
4577
|
+
return index;
|
|
4578
|
+
}
|
|
4579
|
+
},
|
|
4580
|
+
toggleMenu: function toggleMenu() {
|
|
4581
|
+
if (!this.selectDisabled) {
|
|
4582
|
+
if (this.menuVisibleOnFocus) {
|
|
4583
|
+
this.menuVisibleOnFocus = false;
|
|
4584
|
+
} else {
|
|
4585
|
+
this.visible = !this.visible;
|
|
4586
|
+
}
|
|
4587
|
+
if (this.visible) {
|
|
4588
|
+
;(this.$refs.input || this.$refs.reference).focus();
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
},
|
|
4592
|
+
selectOption: function selectOption() {
|
|
4593
|
+
if (!this.visible) {
|
|
4594
|
+
this.toggleMenu();
|
|
4595
|
+
} else {
|
|
4596
|
+
if (this.options[this.hoverIndex]) {
|
|
4597
|
+
this.handleOptionSelect(this.options[this.hoverIndex]);
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
},
|
|
4601
|
+
deleteSelected: function deleteSelected(event) {
|
|
4602
|
+
event.stopPropagation();
|
|
4603
|
+
var value = this.multiple ? [] : '';
|
|
4604
|
+
this.$emit('input', value);
|
|
4605
|
+
this.emitChange(value);
|
|
4606
|
+
this.visible = false;
|
|
4607
|
+
this.$emit('clear');
|
|
4608
|
+
},
|
|
4609
|
+
deleteTag: function deleteTag(event, tag) {
|
|
4610
|
+
var index = this.selected.indexOf(tag);
|
|
4611
|
+
if (index > -1 && !this.selectDisabled) {
|
|
4612
|
+
var value = this.value.slice();
|
|
4613
|
+
value.splice(index, 1);
|
|
4614
|
+
this.emitChange(value);
|
|
4615
|
+
this.$emit('input', value);
|
|
4616
|
+
this.$emit('remove-tag', tag.value);
|
|
4617
|
+
}
|
|
4618
|
+
event.stopPropagation();
|
|
4619
|
+
},
|
|
4620
|
+
onInputChange: function onInputChange() {
|
|
4621
|
+
if (this.filterable && this.query !== this.selectedLabel) {
|
|
4622
|
+
this.query = this.selectedLabel;
|
|
4623
|
+
this.handleQueryChange(this.query);
|
|
4624
|
+
}
|
|
4625
|
+
},
|
|
4626
|
+
onOptionDestroy: function onOptionDestroy(index) {
|
|
4627
|
+
if (index > -1) {
|
|
4628
|
+
this.optionsCount--;
|
|
4629
|
+
this.filteredOptionsCount--;
|
|
4630
|
+
this.options.splice(index, 1);
|
|
4631
|
+
}
|
|
4632
|
+
},
|
|
4633
|
+
resetInputWidth: function resetInputWidth() {
|
|
4634
|
+
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
|
|
4635
|
+
},
|
|
4636
|
+
handleResize: function handleResize() {
|
|
4637
|
+
this.resetInputWidth();
|
|
4638
|
+
if (this.multiple) this.resetInputHeight();
|
|
4639
|
+
},
|
|
4640
|
+
checkDefaultFirstOption: function checkDefaultFirstOption() {
|
|
4641
|
+
this.hoverIndex = -1;
|
|
4642
|
+
// highlight the created option
|
|
4643
|
+
var hasCreated = false;
|
|
4644
|
+
for (var i = this.options.length - 1; i >= 0; i--) {
|
|
4645
|
+
if (this.options[i].created) {
|
|
4646
|
+
hasCreated = true;
|
|
4647
|
+
this.hoverIndex = i;
|
|
4648
|
+
break;
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
if (hasCreated) return;
|
|
4652
|
+
for (var _i = 0; _i !== this.options.length; ++_i) {
|
|
4653
|
+
var option = this.options[_i];
|
|
4654
|
+
if (this.query) {
|
|
4655
|
+
// highlight first options that passes the filter
|
|
4656
|
+
if (!option.disabled && !option.groupDisabled && option.visible) {
|
|
4657
|
+
this.hoverIndex = _i;
|
|
4658
|
+
break;
|
|
4659
|
+
}
|
|
4660
|
+
} else {
|
|
4661
|
+
// highlight currently selected option
|
|
4662
|
+
if (option.itemSelected) {
|
|
4663
|
+
this.hoverIndex = _i;
|
|
4664
|
+
break;
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
},
|
|
4669
|
+
getValueKey: function getValueKey(item) {
|
|
4670
|
+
if (Object.prototype.toString.call(item.value).toLowerCase() !== '[object object]') {
|
|
4671
|
+
return item.value;
|
|
4672
|
+
} else {
|
|
4673
|
+
return Object(util["d" /* getValueByPath */])(item.value, this.valueKey);
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4676
|
+
},
|
|
4677
|
+
|
|
4678
|
+
created: function created() {
|
|
4679
|
+
var _this15 = this;
|
|
4680
|
+
|
|
4681
|
+
this.cachedPlaceHolder = this.currentPlaceholder = this.placeholder;
|
|
4682
|
+
if (this.multiple && !Array.isArray(this.value)) {
|
|
4683
|
+
this.$emit('input', []);
|
|
4684
|
+
}
|
|
4685
|
+
if (!this.multiple && Array.isArray(this.value)) {
|
|
4686
|
+
this.$emit('input', '');
|
|
4687
|
+
}
|
|
4688
|
+
|
|
4689
|
+
this.debouncedOnInputChange = Object(external_throttle_debounce_["debounce"])(this.debounce, function () {
|
|
4690
|
+
_this15.onInputChange();
|
|
4691
|
+
});
|
|
4692
|
+
|
|
4693
|
+
this.debouncedQueryChange = Object(external_throttle_debounce_["debounce"])(this.debounce, function (e) {
|
|
4694
|
+
_this15.handleQueryChange(e.target.value);
|
|
4695
|
+
});
|
|
4696
|
+
|
|
4697
|
+
this.$on('handleOptionClick', this.handleOptionSelect);
|
|
4698
|
+
this.$on('setSelected', this.setSelected);
|
|
4699
|
+
},
|
|
4700
|
+
mounted: function mounted() {
|
|
4701
|
+
var _this16 = this;
|
|
4702
|
+
|
|
4703
|
+
if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
|
|
4704
|
+
this.currentPlaceholder = '';
|
|
4705
|
+
}
|
|
4706
|
+
Object(resizeEvent_["addResizeListener"])(this.$el, this.handleResize);
|
|
4707
|
+
|
|
4708
|
+
var reference = this.$refs.reference;
|
|
4709
|
+
if (reference && reference.$el) {
|
|
4710
|
+
var sizeMap = {
|
|
4711
|
+
medium: 36,
|
|
4712
|
+
small: 32,
|
|
4713
|
+
mini: 28
|
|
4714
|
+
};
|
|
4715
|
+
var input = reference.$el.querySelector('input');
|
|
4716
|
+
this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
|
|
4717
|
+
}
|
|
4718
|
+
if (this.remote && this.multiple) {
|
|
4719
|
+
this.resetInputHeight();
|
|
4720
|
+
}
|
|
4721
|
+
this.$nextTick(function () {
|
|
4722
|
+
if (reference && reference.$el) {
|
|
4723
|
+
_this16.inputWidth = reference.$el.getBoundingClientRect().width;
|
|
4724
|
+
}
|
|
4725
|
+
});
|
|
4726
|
+
this.setSelected();
|
|
4727
|
+
this.tagElli();
|
|
4728
|
+
},
|
|
4729
|
+
beforeDestroy: function beforeDestroy() {
|
|
4730
|
+
if (this.$el && this.handleResize) {
|
|
4731
|
+
Object(resizeEvent_["removeResizeListener"])(this.$el, this.handleResize);
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
});
|
|
4735
|
+
// CONCATENATED MODULE: ./components/select/select.vue?vue&type=script&lang=js&
|
|
4736
|
+
/* harmony default export */ var select_selectvue_type_script_lang_js_ = (selectvue_type_script_lang_js_);
|
|
4737
|
+
// CONCATENATED MODULE: ./components/select/select.vue
|
|
4738
|
+
|
|
4739
|
+
|
|
4740
|
+
|
|
4741
|
+
|
|
4742
|
+
|
|
4743
|
+
/* normalize component */
|
|
4744
|
+
|
|
4745
|
+
var select_component = Object(componentNormalizer["a" /* default */])(
|
|
4746
|
+
select_selectvue_type_script_lang_js_,
|
|
4747
|
+
render,
|
|
4748
|
+
staticRenderFns,
|
|
4749
|
+
false,
|
|
4750
|
+
null,
|
|
4751
|
+
null,
|
|
4752
|
+
null
|
|
4753
|
+
|
|
4754
|
+
)
|
|
4755
|
+
|
|
4756
|
+
/* hot reload */
|
|
4757
|
+
if (false) { var select_api; }
|
|
4758
|
+
select_component.options.__file = "components/select/select.vue"
|
|
4759
|
+
/* harmony default export */ var select_select = (select_component.exports);
|
|
4760
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/select/option-group.vue?vue&type=template&id=0f8a7d6f&
|
|
4761
|
+
var option_groupvue_type_template_id_0f8a7d6f_render = function () {
|
|
4762
|
+
var _vm = this
|
|
4763
|
+
var _h = _vm.$createElement
|
|
4764
|
+
var _c = _vm._self._c || _h
|
|
4765
|
+
return _c(
|
|
4766
|
+
"ul",
|
|
4767
|
+
{
|
|
4768
|
+
directives: [
|
|
4769
|
+
{
|
|
4770
|
+
name: "show",
|
|
4771
|
+
rawName: "v-show",
|
|
4772
|
+
value: _vm.visible,
|
|
4773
|
+
expression: "visible",
|
|
4774
|
+
},
|
|
4775
|
+
],
|
|
4776
|
+
class: _vm.wrapperClass,
|
|
4777
|
+
},
|
|
4778
|
+
[
|
|
4779
|
+
_c("li", { class: _vm.wrapperTitleClass }, [_vm._v(_vm._s(_vm.label))]),
|
|
4780
|
+
_c("li", [
|
|
4781
|
+
_c("ul", { class: _vm.wrapperConentClass }, [_vm._t("default")], 2),
|
|
4782
|
+
]),
|
|
4783
|
+
]
|
|
4784
|
+
)
|
|
4785
|
+
}
|
|
4786
|
+
var option_groupvue_type_template_id_0f8a7d6f_staticRenderFns = []
|
|
4787
|
+
option_groupvue_type_template_id_0f8a7d6f_render._withStripped = true
|
|
4788
|
+
|
|
4789
|
+
|
|
4790
|
+
// CONCATENATED MODULE: ./components/select/option-group.vue?vue&type=template&id=0f8a7d6f&
|
|
4791
|
+
|
|
4792
|
+
// CONCATENATED MODULE: ./components/_mixin/emitter.js
|
|
4793
|
+
function _broadcast(componentName, eventName, params) {
|
|
4794
|
+
this.$children.forEach(function (child) {
|
|
4795
|
+
var name = child.$options.componentName;
|
|
4796
|
+
if (name === componentName) {
|
|
4797
|
+
child.$emit.apply(child, [eventName].concat(params));
|
|
4798
|
+
} else {
|
|
4799
|
+
_broadcast.apply(child, [componentName, eventName].concat([params]));
|
|
4800
|
+
}
|
|
4801
|
+
});
|
|
4802
|
+
}
|
|
4803
|
+
/* harmony default export */ var emitter = ({
|
|
4804
|
+
methods: {
|
|
4805
|
+
dispatch: function dispatch(componentName, eventName, params) {
|
|
4806
|
+
var parent = this.$parent || this.$root;
|
|
4807
|
+
var name = parent.$options.componentName;
|
|
4808
|
+
|
|
4809
|
+
while (parent && (!name || name !== componentName)) {
|
|
4810
|
+
parent = parent.$parent;
|
|
4811
|
+
|
|
4812
|
+
if (parent) {
|
|
4813
|
+
name = parent.$options.componentName;
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4816
|
+
if (parent) {
|
|
4817
|
+
parent.$emit.apply(parent, [eventName].concat(params));
|
|
4818
|
+
}
|
|
4819
|
+
},
|
|
4820
|
+
broadcast: function broadcast(componentName, eventName, params) {
|
|
4821
|
+
_broadcast.call(this, componentName, eventName, params);
|
|
4822
|
+
}
|
|
4823
|
+
}
|
|
4824
|
+
});
|
|
4825
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/select/option-group.vue?vue&type=script&lang=js&
|
|
4826
|
+
|
|
4827
|
+
//
|
|
4828
|
+
//
|
|
4829
|
+
//
|
|
4830
|
+
//
|
|
4831
|
+
//
|
|
4832
|
+
//
|
|
4833
|
+
//
|
|
4834
|
+
//
|
|
4835
|
+
//
|
|
4836
|
+
//
|
|
4837
|
+
//
|
|
4838
|
+
|
|
4839
|
+
|
|
4840
|
+
/* harmony default export */ var option_groupvue_type_script_lang_js_ = ({
|
|
4841
|
+
name: 'MdsOptGroup',
|
|
4842
|
+
componentName: 'mdsOptGroup',
|
|
4843
|
+
mixins: [emitter],
|
|
4844
|
+
props: {
|
|
4845
|
+
label: String,
|
|
4846
|
+
prefixCls: {
|
|
4847
|
+
type: String,
|
|
4848
|
+
default: 'mds-select'
|
|
4849
|
+
},
|
|
4850
|
+
disabled: {
|
|
4851
|
+
type: Boolean,
|
|
4852
|
+
default: false
|
|
4853
|
+
}
|
|
4854
|
+
},
|
|
4855
|
+
|
|
4856
|
+
data: function data() {
|
|
4857
|
+
return {
|
|
4858
|
+
visible: true
|
|
4859
|
+
};
|
|
4860
|
+
},
|
|
4861
|
+
|
|
4862
|
+
computed: {
|
|
4863
|
+
wrapperClass: function wrapperClass() {
|
|
4864
|
+
var prefixCls = this.prefixCls;
|
|
4865
|
+
return defineProperty_default()({}, prefixCls + '-group', true);
|
|
4866
|
+
},
|
|
4867
|
+
wrapperTitleClass: function wrapperTitleClass() {
|
|
4868
|
+
var prefixCls = this.prefixCls;
|
|
4869
|
+
return defineProperty_default()({}, prefixCls + '-group-title', true);
|
|
4870
|
+
},
|
|
4871
|
+
wrapperConentClass: function wrapperConentClass() {
|
|
4872
|
+
var prefixCls = this.prefixCls;
|
|
4873
|
+
return defineProperty_default()({}, prefixCls + '-wrapper', true);
|
|
4874
|
+
}
|
|
4875
|
+
},
|
|
4876
|
+
watch: {
|
|
4877
|
+
disabled: function disabled(val) {
|
|
4878
|
+
this.broadcast('MdsOption', 'handleGroupDisabled', val);
|
|
4879
|
+
}
|
|
4880
|
+
},
|
|
4881
|
+
|
|
4882
|
+
methods: {
|
|
4883
|
+
queryChange: function queryChange() {
|
|
4884
|
+
this.visible = this.$children && Array.isArray(this.$children) && this.$children.some(function (option) {
|
|
4885
|
+
return option.visible === true;
|
|
4886
|
+
});
|
|
4887
|
+
}
|
|
4888
|
+
},
|
|
4889
|
+
|
|
4890
|
+
created: function created() {
|
|
4891
|
+
this.$on('queryChange', this.queryChange);
|
|
4892
|
+
},
|
|
4893
|
+
mounted: function mounted() {
|
|
4894
|
+
if (this.disabled) {
|
|
4895
|
+
this.broadcast('mdOption', 'handleGroupDisabled', this.disabled);
|
|
4896
|
+
}
|
|
4897
|
+
}
|
|
4898
|
+
});
|
|
4899
|
+
// CONCATENATED MODULE: ./components/select/option-group.vue?vue&type=script&lang=js&
|
|
4900
|
+
/* harmony default export */ var select_option_groupvue_type_script_lang_js_ = (option_groupvue_type_script_lang_js_);
|
|
4901
|
+
// CONCATENATED MODULE: ./components/select/option-group.vue
|
|
4902
|
+
|
|
4903
|
+
|
|
4904
|
+
|
|
4905
|
+
|
|
4906
|
+
|
|
4907
|
+
/* normalize component */
|
|
4908
|
+
|
|
4909
|
+
var option_group_component = Object(componentNormalizer["a" /* default */])(
|
|
4910
|
+
select_option_groupvue_type_script_lang_js_,
|
|
4911
|
+
option_groupvue_type_template_id_0f8a7d6f_render,
|
|
4912
|
+
option_groupvue_type_template_id_0f8a7d6f_staticRenderFns,
|
|
4913
|
+
false,
|
|
4914
|
+
null,
|
|
4915
|
+
null,
|
|
4916
|
+
null
|
|
4917
|
+
|
|
4918
|
+
)
|
|
4919
|
+
|
|
4920
|
+
/* hot reload */
|
|
4921
|
+
if (false) { var option_group_api; }
|
|
4922
|
+
option_group_component.options.__file = "components/select/option-group.vue"
|
|
4923
|
+
/* harmony default export */ var option_group = (option_group_component.exports);
|
|
4924
|
+
// CONCATENATED MODULE: ./components/select/index.js
|
|
4925
|
+
|
|
4926
|
+
|
|
4927
|
+
|
|
4928
|
+
|
|
4929
|
+
|
|
4930
|
+
select_select.MdsOption = select_option;
|
|
4931
|
+
select_select.MdsOptionGroup = option_group;
|
|
4932
|
+
/* istanbul ignore next */
|
|
4933
|
+
select_select.install = function (Vue) {
|
|
4934
|
+
Vue.component(select_select.name, select_select);
|
|
4935
|
+
Vue.component(select_option.name, select_option);
|
|
4936
|
+
Vue.component(option_group.name, option_group);
|
|
4937
|
+
};
|
|
4938
|
+
/* harmony default export */ var components_select = __webpack_exports__["default"] = (select_select);
|
|
4939
|
+
|
|
4940
|
+
/***/ }),
|
|
4941
|
+
|
|
4942
|
+
/***/ 9:
|
|
4943
|
+
/***/ (function(module, exports) {
|
|
4944
|
+
|
|
4945
|
+
module.exports = require("babel-runtime/core-js/object/assign");
|
|
4946
|
+
|
|
4947
|
+
/***/ })
|
|
4948
|
+
|
|
4949
|
+
/******/ });
|
|
4950
|
+
});
|