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