cy-element-ui 1.0.62 → 1.0.63
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/lib/alert.js +4 -4
- package/lib/aside.js +77 -77
- package/lib/autocomplete.js +159 -3940
- package/lib/avatar.js +108 -108
- package/lib/backtop.js +110 -110
- package/lib/badge.js +108 -108
- package/lib/breadcrumb-item.js +4 -4
- package/lib/breadcrumb.js +4 -4
- package/lib/button-group.js +4 -4
- package/lib/button.js +4 -4
- package/lib/calendar.js +46 -1545
- package/lib/card.js +96 -96
- package/lib/carousel-item.js +108 -452
- package/lib/carousel.js +116 -185
- package/lib/cascader-panel.js +187 -2270
- package/lib/cascader.js +275 -6452
- package/lib/checkbox-button.js +11 -43
- package/lib/checkbox-group.js +15 -47
- package/lib/checkbox.js +15 -47
- package/lib/col.js +2 -2
- package/lib/collapse-item.js +110 -815
- package/lib/collapse.js +108 -108
- package/lib/color-picker.js +153 -3953
- package/lib/container.js +88 -88
- package/lib/date-picker.js +419 -5230
- package/lib/descriptions-item.js +2 -2
- package/lib/descriptions.js +8 -63
- package/lib/dialog.js +22 -1200
- package/lib/directives/repeat-click.js +2 -2
- package/lib/divider.js +104 -104
- package/lib/drawer.js +105 -875
- package/lib/dropdown-item.js +11 -43
- package/lib/dropdown-menu.js +75 -2277
- package/lib/dropdown.js +136 -1072
- package/lib/element-ui.common.js +29785 -42723
- package/lib/empty.js +7 -603
- package/lib/fileUpload.js +109 -2477
- package/lib/footer.js +77 -77
- package/lib/form-item.js +28 -418
- package/lib/form.js +15 -29
- package/lib/header.js +77 -77
- package/lib/icon.js +4 -4
- package/lib/image.js +49 -1376
- package/lib/index.js +1 -1
- package/lib/infinite-scroll.js +21 -311
- package/lib/input-number.js +33 -1422
- package/lib/input.js +37 -507
- package/lib/link.js +4 -4
- package/lib/loading.js +67 -804
- package/lib/locale/format.js +1 -1
- package/lib/locale/index.js +1 -1
- package/lib/main.js +64 -64
- package/lib/menu-item-group.js +4 -4
- package/lib/menu-item.js +61 -2945
- package/lib/menu.js +54 -745
- package/lib/message-box.js +80 -2537
- package/lib/message.js +24 -1102
- package/lib/mixins/locale.js +1 -1
- package/lib/mixins/migrating.js +1 -1
- package/lib/notification.js +25 -1102
- package/lib/option-group.js +11 -43
- package/lib/option.js +18 -394
- package/lib/page-header.js +87 -683
- package/lib/pagination.js +139 -6078
- package/lib/popconfirm.js +219 -3508
- package/lib/popover.js +99 -2624
- package/lib/progress.js +4 -4
- package/lib/radio-button.js +11 -43
- package/lib/radio-group.js +11 -43
- package/lib/radio.js +15 -47
- package/lib/rate.js +113 -756
- package/lib/result.js +4 -4
- package/lib/row.js +2 -2
- package/lib/scrollbar.js +50 -735
- package/lib/select.js +209 -4352
- package/lib/selectDisplayInput.js +108 -108
- package/lib/skeleton-item.js +2 -2
- package/lib/skeleton.js +108 -108
- package/lib/slider.js +120 -4266
- package/lib/spinner.js +4 -4
- package/lib/statistic.js +117 -9605
- package/lib/step.js +108 -108
- package/lib/steps.js +99 -514
- package/lib/subTitle.js +91 -91
- package/lib/submenu.js +121 -2442
- package/lib/switch.js +21 -476
- package/lib/tab-pane.js +4 -4
- package/lib/tabDialog.js +37 -1563
- package/lib/table-column.js +32 -880
- package/lib/table.js +424 -4467
- package/lib/tabs.js +12 -425
- package/lib/tag.js +4 -4
- package/lib/theme-chalk/base.css +1 -1
- package/lib/theme-chalk/element.css +1 -1
- package/lib/theme-chalk/fileUpload.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/selectDisplayInput.css +1 -1
- package/lib/theme-chalk/subTitle.css +1 -1
- package/lib/theme-chalk/tabDialog.css +1 -1
- package/lib/theme-chalk/treeSelect.css +1 -1
- package/lib/time-picker.js +285 -5013
- package/lib/time-select.js +181 -4949
- package/lib/timeline-item.js +108 -108
- package/lib/timeline.js +82 -82
- package/lib/tooltip.js +41 -2566
- package/lib/transfer.js +142 -2136
- package/lib/transitions/collapse-transition.js +1 -1
- package/lib/tree.js +55 -1372
- package/lib/treeSelect.js +106 -3421
- package/lib/upload.js +28 -1047
- package/lib/utils/clickoutside.js +1 -1
- package/lib/utils/date-util.js +2 -2
- package/lib/utils/popup/index.js +2 -2
- package/lib/utils/popup/popup-manager.js +1 -1
- package/lib/utils/util.js +1 -1
- package/lib/utils/vdom.js +1 -1
- package/lib/utils/vue-popper.js +1 -1
- package/package.json +2 -2
- package/src/index.js +1 -1
- package/lib/theme-chalk/alert.css +0 -1
- package/lib/theme-chalk/aside.css +0 -1
- package/lib/theme-chalk/autocomplete.css +0 -1
- package/lib/theme-chalk/avatar.css +0 -1
- package/lib/theme-chalk/backtop.css +0 -1
- package/lib/theme-chalk/badge.css +0 -1
- package/lib/theme-chalk/breadcrumb-item.css +0 -0
- package/lib/theme-chalk/breadcrumb.css +0 -1
- package/lib/theme-chalk/button-group.css +0 -0
- package/lib/theme-chalk/button.css +0 -1
- package/lib/theme-chalk/calendar.css +0 -1
- package/lib/theme-chalk/card.css +0 -1
- package/lib/theme-chalk/carousel-item.css +0 -1
- package/lib/theme-chalk/carousel.css +0 -1
- package/lib/theme-chalk/cascader-panel.css +0 -1
- package/lib/theme-chalk/cascader.css +0 -1
- package/lib/theme-chalk/checkbox-button.css +0 -0
- package/lib/theme-chalk/checkbox-group.css +0 -0
- package/lib/theme-chalk/checkbox.css +0 -1
- package/lib/theme-chalk/col.css +0 -1
- package/lib/theme-chalk/collapse-item.css +0 -0
- package/lib/theme-chalk/collapse.css +0 -1
- package/lib/theme-chalk/color-picker.css +0 -1
- package/lib/theme-chalk/container.css +0 -1
- package/lib/theme-chalk/date-picker.css +0 -1
- package/lib/theme-chalk/descriptions-item.css +0 -1
- package/lib/theme-chalk/descriptions.css +0 -1
- package/lib/theme-chalk/dialog.css +0 -1
- package/lib/theme-chalk/display.css +0 -1
- package/lib/theme-chalk/divider.css +0 -1
- package/lib/theme-chalk/drawer.css +0 -1
- package/lib/theme-chalk/dropdown-item.css +0 -0
- package/lib/theme-chalk/dropdown-menu.css +0 -0
- package/lib/theme-chalk/dropdown.css +0 -1
- package/lib/theme-chalk/empty.css +0 -1
- package/lib/theme-chalk/fonts/element-icons.ttf +0 -0
- package/lib/theme-chalk/fonts/element-icons.woff +0 -0
- package/lib/theme-chalk/footer.css +0 -1
- package/lib/theme-chalk/form-item.css +0 -0
- package/lib/theme-chalk/form.css +0 -1
- package/lib/theme-chalk/header.css +0 -1
- package/lib/theme-chalk/icon.css +0 -1
- package/lib/theme-chalk/image.css +0 -1
- package/lib/theme-chalk/index.scss +0 -1
- package/lib/theme-chalk/infinite-scroll.css +0 -0
- package/lib/theme-chalk/infiniteScroll.css +0 -0
- package/lib/theme-chalk/input-number.css +0 -1
- package/lib/theme-chalk/input.css +0 -1
- package/lib/theme-chalk/link.css +0 -1
- package/lib/theme-chalk/loading.css +0 -1
- package/lib/theme-chalk/main.css +0 -1
- package/lib/theme-chalk/menu-item-group.css +0 -0
- package/lib/theme-chalk/menu-item.css +0 -0
- package/lib/theme-chalk/menu.css +0 -1
- package/lib/theme-chalk/message-box.css +0 -1
- package/lib/theme-chalk/message.css +0 -1
- package/lib/theme-chalk/notification.css +0 -1
- package/lib/theme-chalk/option-group.css +0 -1
- package/lib/theme-chalk/option.css +0 -1
- package/lib/theme-chalk/page-header.css +0 -1
- package/lib/theme-chalk/pagination.css +0 -1
- package/lib/theme-chalk/popconfirm.css +0 -1
- package/lib/theme-chalk/popover.css +0 -1
- package/lib/theme-chalk/popper.css +0 -1
- package/lib/theme-chalk/progress.css +0 -1
- package/lib/theme-chalk/radio-button.css +0 -1
- package/lib/theme-chalk/radio-group.css +0 -1
- package/lib/theme-chalk/radio.css +0 -1
- package/lib/theme-chalk/rate.css +0 -1
- package/lib/theme-chalk/reset.css +0 -1
- package/lib/theme-chalk/result.css +0 -1
- package/lib/theme-chalk/row.css +0 -1
- package/lib/theme-chalk/scrollbar.css +0 -1
- package/lib/theme-chalk/select-dropdown.css +0 -1
- package/lib/theme-chalk/select.css +0 -1
- package/lib/theme-chalk/skeleton-item.css +0 -1
- package/lib/theme-chalk/skeleton.css +0 -1
- package/lib/theme-chalk/slider.css +0 -1
- package/lib/theme-chalk/spinner.css +0 -1
- package/lib/theme-chalk/statistic.css +0 -1
- package/lib/theme-chalk/step.css +0 -1
- package/lib/theme-chalk/steps.css +0 -1
- package/lib/theme-chalk/submenu.css +0 -0
- package/lib/theme-chalk/switch.css +0 -1
- package/lib/theme-chalk/tab-pane.css +0 -0
- package/lib/theme-chalk/table-column.css +0 -1
- package/lib/theme-chalk/table.css +0 -1
- package/lib/theme-chalk/tabs.css +0 -1
- package/lib/theme-chalk/tag.css +0 -1
- package/lib/theme-chalk/time-picker.css +0 -1
- package/lib/theme-chalk/time-select.css +0 -1
- package/lib/theme-chalk/timeline-item.css +0 -1
- package/lib/theme-chalk/timeline.css +0 -1
- package/lib/theme-chalk/tooltip.css +0 -1
- package/lib/theme-chalk/transfer.css +0 -1
- package/lib/theme-chalk/tree.css +0 -1
- package/lib/theme-chalk/upload.css +0 -1
package/lib/treeSelect.js
CHANGED
|
@@ -82,464 +82,117 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 134);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ({
|
|
89
89
|
|
|
90
90
|
/***/ 0:
|
|
91
|
-
/***/ (function(module, exports) {
|
|
92
|
-
|
|
93
|
-
module.exports = require("vue");
|
|
94
|
-
|
|
95
|
-
/***/ }),
|
|
96
|
-
|
|
97
|
-
/***/ 1:
|
|
98
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
99
|
-
|
|
100
|
-
"use strict";
|
|
101
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return on; });
|
|
102
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return off; });
|
|
103
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return once; });
|
|
104
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasClass; });
|
|
105
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addClass; });
|
|
106
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return removeClass; });
|
|
107
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getStyle; });
|
|
108
|
-
/* unused harmony export setStyle */
|
|
109
|
-
/* unused harmony export isScroll */
|
|
110
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollContainer; });
|
|
111
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isInContainer; });
|
|
112
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
113
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
114
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
115
|
-
|
|
116
|
-
/* istanbul ignore next */
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
var isServer = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer;
|
|
121
|
-
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
|
|
122
|
-
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
|
|
123
|
-
var ieVersion = isServer ? 0 : Number(document.documentMode);
|
|
124
|
-
|
|
125
|
-
/* istanbul ignore next */
|
|
126
|
-
var trim = function trim(string) {
|
|
127
|
-
return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
|
|
128
|
-
};
|
|
129
|
-
/* istanbul ignore next */
|
|
130
|
-
var camelCase = function camelCase(name) {
|
|
131
|
-
return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
|
|
132
|
-
return offset ? letter.toUpperCase() : letter;
|
|
133
|
-
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
/* istanbul ignore next */
|
|
137
|
-
var on = function () {
|
|
138
|
-
if (!isServer && document.addEventListener) {
|
|
139
|
-
return function (element, event, handler) {
|
|
140
|
-
if (element && event && handler) {
|
|
141
|
-
element.addEventListener(event, handler, false);
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
} else {
|
|
145
|
-
return function (element, event, handler) {
|
|
146
|
-
if (element && event && handler) {
|
|
147
|
-
element.attachEvent('on' + event, handler);
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}();
|
|
152
|
-
|
|
153
|
-
/* istanbul ignore next */
|
|
154
|
-
var off = function () {
|
|
155
|
-
if (!isServer && document.removeEventListener) {
|
|
156
|
-
return function (element, event, handler) {
|
|
157
|
-
if (element && event) {
|
|
158
|
-
element.removeEventListener(event, handler, false);
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
} else {
|
|
162
|
-
return function (element, event, handler) {
|
|
163
|
-
if (element && event) {
|
|
164
|
-
element.detachEvent('on' + event, handler);
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
}();
|
|
169
|
-
|
|
170
|
-
/* istanbul ignore next */
|
|
171
|
-
var once = function once(el, event, fn) {
|
|
172
|
-
var listener = function listener() {
|
|
173
|
-
if (fn) {
|
|
174
|
-
fn.apply(this, arguments);
|
|
175
|
-
}
|
|
176
|
-
off(el, event, listener);
|
|
177
|
-
};
|
|
178
|
-
on(el, event, listener);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/* istanbul ignore next */
|
|
182
|
-
function hasClass(el, cls) {
|
|
183
|
-
if (!el || !cls) return false;
|
|
184
|
-
if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
|
|
185
|
-
if (el.classList) {
|
|
186
|
-
return el.classList.contains(cls);
|
|
187
|
-
} else {
|
|
188
|
-
return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
/* istanbul ignore next */
|
|
193
|
-
function addClass(el, cls) {
|
|
194
|
-
if (!el) return;
|
|
195
|
-
var curClass = el.className;
|
|
196
|
-
var classes = (cls || '').split(' ');
|
|
197
|
-
|
|
198
|
-
for (var i = 0, j = classes.length; i < j; i++) {
|
|
199
|
-
var clsName = classes[i];
|
|
200
|
-
if (!clsName) continue;
|
|
201
|
-
|
|
202
|
-
if (el.classList) {
|
|
203
|
-
el.classList.add(clsName);
|
|
204
|
-
} else if (!hasClass(el, clsName)) {
|
|
205
|
-
curClass += ' ' + clsName;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
if (!el.classList) {
|
|
209
|
-
el.setAttribute('class', curClass);
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
/* istanbul ignore next */
|
|
214
|
-
function removeClass(el, cls) {
|
|
215
|
-
if (!el || !cls) return;
|
|
216
|
-
var classes = cls.split(' ');
|
|
217
|
-
var curClass = ' ' + el.className + ' ';
|
|
218
|
-
|
|
219
|
-
for (var i = 0, j = classes.length; i < j; i++) {
|
|
220
|
-
var clsName = classes[i];
|
|
221
|
-
if (!clsName) continue;
|
|
222
|
-
|
|
223
|
-
if (el.classList) {
|
|
224
|
-
el.classList.remove(clsName);
|
|
225
|
-
} else if (hasClass(el, clsName)) {
|
|
226
|
-
curClass = curClass.replace(' ' + clsName + ' ', ' ');
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
if (!el.classList) {
|
|
230
|
-
el.setAttribute('class', trim(curClass));
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
/* istanbul ignore next */
|
|
235
|
-
var getStyle = ieVersion < 9 ? function (element, styleName) {
|
|
236
|
-
if (isServer) return;
|
|
237
|
-
if (!element || !styleName) return null;
|
|
238
|
-
styleName = camelCase(styleName);
|
|
239
|
-
if (styleName === 'float') {
|
|
240
|
-
styleName = 'styleFloat';
|
|
241
|
-
}
|
|
242
|
-
try {
|
|
243
|
-
switch (styleName) {
|
|
244
|
-
case 'opacity':
|
|
245
|
-
try {
|
|
246
|
-
return element.filters.item('alpha').opacity / 100;
|
|
247
|
-
} catch (e) {
|
|
248
|
-
return 1.0;
|
|
249
|
-
}
|
|
250
|
-
default:
|
|
251
|
-
return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
|
|
252
|
-
}
|
|
253
|
-
} catch (e) {
|
|
254
|
-
return element.style[styleName];
|
|
255
|
-
}
|
|
256
|
-
} : function (element, styleName) {
|
|
257
|
-
if (isServer) return;
|
|
258
|
-
if (!element || !styleName) return null;
|
|
259
|
-
styleName = camelCase(styleName);
|
|
260
|
-
if (styleName === 'float') {
|
|
261
|
-
styleName = 'cssFloat';
|
|
262
|
-
}
|
|
263
|
-
try {
|
|
264
|
-
var computed = document.defaultView.getComputedStyle(element, '');
|
|
265
|
-
return element.style[styleName] || computed ? computed[styleName] : null;
|
|
266
|
-
} catch (e) {
|
|
267
|
-
return element.style[styleName];
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
/* istanbul ignore next */
|
|
272
|
-
function setStyle(element, styleName, value) {
|
|
273
|
-
if (!element || !styleName) return;
|
|
274
|
-
|
|
275
|
-
if ((typeof styleName === 'undefined' ? 'undefined' : _typeof(styleName)) === 'object') {
|
|
276
|
-
for (var prop in styleName) {
|
|
277
|
-
if (styleName.hasOwnProperty(prop)) {
|
|
278
|
-
setStyle(element, prop, styleName[prop]);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
} else {
|
|
282
|
-
styleName = camelCase(styleName);
|
|
283
|
-
if (styleName === 'opacity' && ieVersion < 9) {
|
|
284
|
-
element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
|
|
285
|
-
} else {
|
|
286
|
-
element.style[styleName] = value;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
var isScroll = function isScroll(el, vertical) {
|
|
292
|
-
if (isServer) return;
|
|
293
|
-
|
|
294
|
-
var determinedDirection = vertical !== null && vertical !== undefined;
|
|
295
|
-
var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow');
|
|
296
|
-
|
|
297
|
-
return overflow.match(/(scroll|auto|overlay)/);
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
var getScrollContainer = function getScrollContainer(el, vertical) {
|
|
301
|
-
if (isServer) return;
|
|
302
|
-
|
|
303
|
-
var parent = el;
|
|
304
|
-
while (parent) {
|
|
305
|
-
if ([window, document, document.documentElement].includes(parent)) {
|
|
306
|
-
return window;
|
|
307
|
-
}
|
|
308
|
-
if (isScroll(parent, vertical)) {
|
|
309
|
-
return parent;
|
|
310
|
-
}
|
|
311
|
-
parent = parent.parentNode;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return parent;
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
var isInContainer = function isInContainer(el, container) {
|
|
318
|
-
if (isServer || !el || !container) return false;
|
|
319
|
-
|
|
320
|
-
var elRect = el.getBoundingClientRect();
|
|
321
|
-
var containerRect = void 0;
|
|
322
|
-
|
|
323
|
-
if ([window, document, document.documentElement, null, undefined].includes(container)) {
|
|
324
|
-
containerRect = {
|
|
325
|
-
top: 0,
|
|
326
|
-
right: window.innerWidth,
|
|
327
|
-
bottom: window.innerHeight,
|
|
328
|
-
left: 0
|
|
329
|
-
};
|
|
330
|
-
} else {
|
|
331
|
-
containerRect = container.getBoundingClientRect();
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
/***/ }),
|
|
338
|
-
|
|
339
|
-
/***/ 10:
|
|
340
91
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
341
92
|
|
|
342
93
|
"use strict";
|
|
343
|
-
/* harmony
|
|
344
|
-
/*
|
|
345
|
-
/* harmony import */ var element_ui_src_utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(23);
|
|
350
|
-
var stop = function stop(e) {
|
|
351
|
-
return e.stopPropagation();
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
|
|
356
|
-
* @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
|
|
357
|
-
* @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
|
|
358
|
-
* @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
|
|
359
|
-
* @param {Boolean} [visible=false] Visibility of the popup element.
|
|
360
|
-
* @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
|
|
361
|
-
*/
|
|
362
|
-
/* harmony default export */ __webpack_exports__["a"] = ({
|
|
363
|
-
props: {
|
|
364
|
-
transformOrigin: {
|
|
365
|
-
type: [Boolean, String],
|
|
366
|
-
default: true
|
|
367
|
-
},
|
|
368
|
-
placement: {
|
|
369
|
-
type: String,
|
|
370
|
-
default: 'bottom'
|
|
371
|
-
},
|
|
372
|
-
boundariesPadding: {
|
|
373
|
-
type: Number,
|
|
374
|
-
default: 5
|
|
375
|
-
},
|
|
376
|
-
reference: {},
|
|
377
|
-
popper: {},
|
|
378
|
-
offset: {
|
|
379
|
-
default: 0
|
|
380
|
-
},
|
|
381
|
-
value: Boolean,
|
|
382
|
-
visibleArrow: Boolean,
|
|
383
|
-
arrowOffset: {
|
|
384
|
-
type: Number,
|
|
385
|
-
default: 35
|
|
386
|
-
},
|
|
387
|
-
appendToBody: {
|
|
388
|
-
type: Boolean,
|
|
389
|
-
default: true
|
|
390
|
-
},
|
|
391
|
-
popperOptions: {
|
|
392
|
-
type: Object,
|
|
393
|
-
default: function _default() {
|
|
394
|
-
return {
|
|
395
|
-
gpuAcceleration: false
|
|
396
|
-
};
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
},
|
|
400
|
-
|
|
401
|
-
data: function data() {
|
|
402
|
-
return {
|
|
403
|
-
showPopper: false,
|
|
404
|
-
currentPlacement: ''
|
|
405
|
-
};
|
|
406
|
-
},
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
watch: {
|
|
410
|
-
value: {
|
|
411
|
-
immediate: true,
|
|
412
|
-
handler: function handler(val) {
|
|
413
|
-
this.showPopper = val;
|
|
414
|
-
this.$emit('input', val);
|
|
415
|
-
}
|
|
416
|
-
},
|
|
417
|
-
|
|
418
|
-
showPopper: function showPopper(val) {
|
|
419
|
-
if (this.disabled) return;
|
|
420
|
-
val ? this.updatePopper() : this.destroyPopper();
|
|
421
|
-
this.$emit('input', val);
|
|
422
|
-
}
|
|
423
|
-
},
|
|
424
|
-
|
|
425
|
-
methods: {
|
|
426
|
-
createPopper: function createPopper() {
|
|
427
|
-
var _this = this;
|
|
428
|
-
|
|
429
|
-
if (this.$isServer) return;
|
|
430
|
-
this.currentPlacement = this.currentPlacement || this.placement;
|
|
431
|
-
if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
var options = this.popperOptions;
|
|
436
|
-
var popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
|
|
437
|
-
var reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
|
|
438
|
-
|
|
439
|
-
if (!reference && this.$slots.reference && this.$slots.reference[0]) {
|
|
440
|
-
reference = this.referenceElm = this.$slots.reference[0].elm;
|
|
441
|
-
}
|
|
94
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
|
95
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
442
96
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
if (this.popperJS && this.popperJS.destroy) {
|
|
447
|
-
this.popperJS.destroy();
|
|
448
|
-
}
|
|
97
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
98
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
99
|
+
// be included in the final webpack user bundle.
|
|
449
100
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
this.popperElm.addEventListener('click', stop);
|
|
464
|
-
},
|
|
465
|
-
updatePopper: function updatePopper() {
|
|
466
|
-
var popperJS = this.popperJS;
|
|
467
|
-
if (popperJS) {
|
|
468
|
-
popperJS.update();
|
|
469
|
-
if (popperJS._popper) {
|
|
470
|
-
popperJS._popper.style.zIndex = element_ui_src_utils_popup__WEBPACK_IMPORTED_MODULE_1__[/* PopupManager */ "a"].nextZIndex();
|
|
471
|
-
}
|
|
472
|
-
} else {
|
|
473
|
-
this.createPopper();
|
|
474
|
-
}
|
|
475
|
-
},
|
|
476
|
-
doDestroy: function doDestroy(forceDestroy) {
|
|
477
|
-
/* istanbul ignore if */
|
|
478
|
-
if (!this.popperJS || this.showPopper && !forceDestroy) return;
|
|
479
|
-
this.popperJS.destroy();
|
|
480
|
-
this.popperJS = null;
|
|
481
|
-
},
|
|
482
|
-
destroyPopper: function destroyPopper() {
|
|
483
|
-
if (this.popperJS) {
|
|
484
|
-
this.resetTransformOrigin();
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
resetTransformOrigin: function resetTransformOrigin() {
|
|
488
|
-
if (!this.transformOrigin) return;
|
|
489
|
-
var placementMap = {
|
|
490
|
-
top: 'bottom',
|
|
491
|
-
bottom: 'top',
|
|
492
|
-
left: 'right',
|
|
493
|
-
right: 'left'
|
|
494
|
-
};
|
|
495
|
-
var placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
|
|
496
|
-
var origin = placementMap[placement];
|
|
497
|
-
this.popperJS._popper.style.transformOrigin = typeof this.transformOrigin === 'string' ? this.transformOrigin : ['top', 'bottom'].indexOf(placement) > -1 ? 'center ' + origin : origin + ' center';
|
|
498
|
-
},
|
|
499
|
-
appendArrow: function appendArrow(element) {
|
|
500
|
-
var hash = void 0;
|
|
501
|
-
if (this.appended) {
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
101
|
+
function normalizeComponent(
|
|
102
|
+
scriptExports,
|
|
103
|
+
render,
|
|
104
|
+
staticRenderFns,
|
|
105
|
+
functionalTemplate,
|
|
106
|
+
injectStyles,
|
|
107
|
+
scopeId,
|
|
108
|
+
moduleIdentifier /* server only */,
|
|
109
|
+
shadowMode /* vue-cli only */
|
|
110
|
+
) {
|
|
111
|
+
// Vue.extend constructor export interop
|
|
112
|
+
var options =
|
|
113
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
504
114
|
|
|
505
|
-
|
|
115
|
+
// render functions
|
|
116
|
+
if (render) {
|
|
117
|
+
options.render = render
|
|
118
|
+
options.staticRenderFns = staticRenderFns
|
|
119
|
+
options._compiled = true
|
|
120
|
+
}
|
|
506
121
|
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
}
|
|
512
|
-
}
|
|
122
|
+
// functional template
|
|
123
|
+
if (functionalTemplate) {
|
|
124
|
+
options.functional = true
|
|
125
|
+
}
|
|
513
126
|
|
|
514
|
-
|
|
127
|
+
// scopedId
|
|
128
|
+
if (scopeId) {
|
|
129
|
+
options._scopeId = 'data-v-' + scopeId
|
|
130
|
+
}
|
|
515
131
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
132
|
+
var hook
|
|
133
|
+
if (moduleIdentifier) {
|
|
134
|
+
// server build
|
|
135
|
+
hook = function (context) {
|
|
136
|
+
// 2.3 injection
|
|
137
|
+
context =
|
|
138
|
+
context || // cached call
|
|
139
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
140
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
141
|
+
// 2.2 with runInNewContext: true
|
|
142
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
143
|
+
context = __VUE_SSR_CONTEXT__
|
|
144
|
+
}
|
|
145
|
+
// inject component styles
|
|
146
|
+
if (injectStyles) {
|
|
147
|
+
injectStyles.call(this, context)
|
|
148
|
+
}
|
|
149
|
+
// register component module identifier for async chunk inferrence
|
|
150
|
+
if (context && context._registeredComponents) {
|
|
151
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// used by ssr in case component is cached and beforeCreate
|
|
155
|
+
// never gets called
|
|
156
|
+
options._ssrRegister = hook
|
|
157
|
+
} else if (injectStyles) {
|
|
158
|
+
hook = shadowMode
|
|
159
|
+
? function () {
|
|
160
|
+
injectStyles.call(
|
|
161
|
+
this,
|
|
162
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
: injectStyles
|
|
166
|
+
}
|
|
524
167
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
168
|
+
if (hook) {
|
|
169
|
+
if (options.functional) {
|
|
170
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
171
|
+
// go through the normalizer
|
|
172
|
+
options._injectStyles = hook
|
|
173
|
+
// register for functional component in vue file
|
|
174
|
+
var originalRender = options.render
|
|
175
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
176
|
+
hook.call(context)
|
|
177
|
+
return originalRender(h, context)
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
// inject component registration as beforeCreate hook
|
|
181
|
+
var existing = options.beforeCreate
|
|
182
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
183
|
+
}
|
|
184
|
+
}
|
|
532
185
|
|
|
186
|
+
return {
|
|
187
|
+
exports: scriptExports,
|
|
188
|
+
options: options
|
|
189
|
+
}
|
|
190
|
+
}
|
|
533
191
|
|
|
534
|
-
// call destroy in keep-alive mode
|
|
535
|
-
deactivated: function deactivated() {
|
|
536
|
-
this.$options.beforeDestroy[0].call(this);
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
192
|
|
|
540
193
|
/***/ }),
|
|
541
194
|
|
|
542
|
-
/***/
|
|
195
|
+
/***/ 134:
|
|
543
196
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
544
197
|
|
|
545
198
|
"use strict";
|
|
@@ -723,11 +376,13 @@ render._withStripped = true
|
|
|
723
376
|
|
|
724
377
|
// CONCATENATED MODULE: ./packages/treeSelect/src/main.vue?vue&type=template&id=6bc2d52a
|
|
725
378
|
|
|
726
|
-
// EXTERNAL MODULE:
|
|
727
|
-
var
|
|
379
|
+
// EXTERNAL MODULE: external "cy-element-ui/lib/checkbox"
|
|
380
|
+
var checkbox_ = __webpack_require__(15);
|
|
381
|
+
var checkbox_default = /*#__PURE__*/__webpack_require__.n(checkbox_);
|
|
728
382
|
|
|
729
|
-
// EXTERNAL MODULE:
|
|
730
|
-
var
|
|
383
|
+
// EXTERNAL MODULE: external "cy-element-ui/lib/popover"
|
|
384
|
+
var popover_ = __webpack_require__(42);
|
|
385
|
+
var popover_default = /*#__PURE__*/__webpack_require__.n(popover_);
|
|
731
386
|
|
|
732
387
|
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/treeSelect/src/main.vue?vue&type=script&lang=js
|
|
733
388
|
|
|
@@ -736,7 +391,7 @@ var popover = __webpack_require__(42);
|
|
|
736
391
|
|
|
737
392
|
/* harmony default export */ var mainvue_type_script_lang_js = ({
|
|
738
393
|
name: 'CyTreeSelect',
|
|
739
|
-
component: [
|
|
394
|
+
component: [checkbox_default.a, popover_default.a],
|
|
740
395
|
model: {
|
|
741
396
|
prop: 'value',
|
|
742
397
|
event: 'change'
|
|
@@ -1037,7 +692,7 @@ var popover = __webpack_require__(42);
|
|
|
1037
692
|
// CONCATENATED MODULE: ./packages/treeSelect/src/main.vue?vue&type=script&lang=js
|
|
1038
693
|
/* harmony default export */ var src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
|
|
1039
694
|
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
1040
|
-
var componentNormalizer = __webpack_require__(
|
|
695
|
+
var componentNormalizer = __webpack_require__(0);
|
|
1041
696
|
|
|
1042
697
|
// CONCATENATED MODULE: ./packages/treeSelect/src/main.vue
|
|
1043
698
|
|
|
@@ -1071,2987 +726,17 @@ main.install = function (Vue) {
|
|
|
1071
726
|
|
|
1072
727
|
/***/ }),
|
|
1073
728
|
|
|
1074
|
-
/***/
|
|
1075
|
-
/***/ (function(module,
|
|
729
|
+
/***/ 15:
|
|
730
|
+
/***/ (function(module, exports) {
|
|
1076
731
|
|
|
1077
|
-
|
|
1078
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
|
1079
|
-
/* globals __VUE_SSR_CONTEXT__ */
|
|
732
|
+
module.exports = require("cy-element-ui/lib/checkbox");
|
|
1080
733
|
|
|
1081
|
-
|
|
1082
|
-
// This module is a runtime utility for cleaner component module output and will
|
|
1083
|
-
// be included in the final webpack user bundle.
|
|
1084
|
-
|
|
1085
|
-
function normalizeComponent(
|
|
1086
|
-
scriptExports,
|
|
1087
|
-
render,
|
|
1088
|
-
staticRenderFns,
|
|
1089
|
-
functionalTemplate,
|
|
1090
|
-
injectStyles,
|
|
1091
|
-
scopeId,
|
|
1092
|
-
moduleIdentifier /* server only */,
|
|
1093
|
-
shadowMode /* vue-cli only */
|
|
1094
|
-
) {
|
|
1095
|
-
// Vue.extend constructor export interop
|
|
1096
|
-
var options =
|
|
1097
|
-
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
1098
|
-
|
|
1099
|
-
// render functions
|
|
1100
|
-
if (render) {
|
|
1101
|
-
options.render = render
|
|
1102
|
-
options.staticRenderFns = staticRenderFns
|
|
1103
|
-
options._compiled = true
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
// functional template
|
|
1107
|
-
if (functionalTemplate) {
|
|
1108
|
-
options.functional = true
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
// scopedId
|
|
1112
|
-
if (scopeId) {
|
|
1113
|
-
options._scopeId = 'data-v-' + scopeId
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
var hook
|
|
1117
|
-
if (moduleIdentifier) {
|
|
1118
|
-
// server build
|
|
1119
|
-
hook = function (context) {
|
|
1120
|
-
// 2.3 injection
|
|
1121
|
-
context =
|
|
1122
|
-
context || // cached call
|
|
1123
|
-
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
1124
|
-
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
1125
|
-
// 2.2 with runInNewContext: true
|
|
1126
|
-
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
1127
|
-
context = __VUE_SSR_CONTEXT__
|
|
1128
|
-
}
|
|
1129
|
-
// inject component styles
|
|
1130
|
-
if (injectStyles) {
|
|
1131
|
-
injectStyles.call(this, context)
|
|
1132
|
-
}
|
|
1133
|
-
// register component module identifier for async chunk inferrence
|
|
1134
|
-
if (context && context._registeredComponents) {
|
|
1135
|
-
context._registeredComponents.add(moduleIdentifier)
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
// used by ssr in case component is cached and beforeCreate
|
|
1139
|
-
// never gets called
|
|
1140
|
-
options._ssrRegister = hook
|
|
1141
|
-
} else if (injectStyles) {
|
|
1142
|
-
hook = shadowMode
|
|
1143
|
-
? function () {
|
|
1144
|
-
injectStyles.call(
|
|
1145
|
-
this,
|
|
1146
|
-
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
1147
|
-
)
|
|
1148
|
-
}
|
|
1149
|
-
: injectStyles
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
if (hook) {
|
|
1153
|
-
if (options.functional) {
|
|
1154
|
-
// for template-only hot-reload because in that case the render fn doesn't
|
|
1155
|
-
// go through the normalizer
|
|
1156
|
-
options._injectStyles = hook
|
|
1157
|
-
// register for functional component in vue file
|
|
1158
|
-
var originalRender = options.render
|
|
1159
|
-
options.render = function renderWithStyleInjection(h, context) {
|
|
1160
|
-
hook.call(context)
|
|
1161
|
-
return originalRender(h, context)
|
|
1162
|
-
}
|
|
1163
|
-
} else {
|
|
1164
|
-
// inject component registration as beforeCreate hook
|
|
1165
|
-
var existing = options.beforeCreate
|
|
1166
|
-
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
return {
|
|
1171
|
-
exports: scriptExports,
|
|
1172
|
-
options: options
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
/***/ }),
|
|
1178
|
-
|
|
1179
|
-
/***/ 23:
|
|
1180
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1181
|
-
|
|
1182
|
-
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
1183
|
-
|
|
1184
|
-
/**
|
|
1185
|
-
* @fileOverview Kickass library to create and place poppers near their reference elements.
|
|
1186
|
-
* @version {{version}}
|
|
1187
|
-
* @license
|
|
1188
|
-
* Copyright (c) 2016 Federico Zivolo and contributors
|
|
1189
|
-
*
|
|
1190
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1191
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
1192
|
-
* in the Software without restriction, including without limitation the rights
|
|
1193
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1194
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
1195
|
-
* furnished to do so, subject to the following conditions:
|
|
1196
|
-
*
|
|
1197
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
1198
|
-
* copies or substantial portions of the Software.
|
|
1199
|
-
*
|
|
1200
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1201
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1202
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1203
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1204
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1205
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1206
|
-
* SOFTWARE.
|
|
1207
|
-
*/
|
|
1208
|
-
|
|
1209
|
-
//
|
|
1210
|
-
// Cross module loader
|
|
1211
|
-
// Supported: Node, AMD, Browser globals
|
|
1212
|
-
//
|
|
1213
|
-
;(function (root, factory) {
|
|
1214
|
-
if (true) {
|
|
1215
|
-
// AMD. Register as an anonymous module.
|
|
1216
|
-
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
1217
|
-
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
1218
|
-
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
|
|
1219
|
-
__WEBPACK_AMD_DEFINE_FACTORY__),
|
|
1220
|
-
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
|
|
1221
|
-
} else {}
|
|
1222
|
-
})(this, function () {
|
|
1223
|
-
|
|
1224
|
-
'use strict';
|
|
1225
|
-
|
|
1226
|
-
var root = window;
|
|
1227
|
-
|
|
1228
|
-
// default options
|
|
1229
|
-
var DEFAULTS = {
|
|
1230
|
-
// placement of the popper
|
|
1231
|
-
placement: 'bottom',
|
|
1232
|
-
|
|
1233
|
-
gpuAcceleration: true,
|
|
1234
|
-
|
|
1235
|
-
// shift popper from its origin by the given amount of pixels (can be negative)
|
|
1236
|
-
offset: 0,
|
|
1237
|
-
|
|
1238
|
-
// the element which will act as boundary of the popper
|
|
1239
|
-
boundariesElement: 'viewport',
|
|
1240
|
-
|
|
1241
|
-
// amount of pixel used to define a minimum distance between the boundaries and the popper
|
|
1242
|
-
boundariesPadding: 5,
|
|
1243
|
-
|
|
1244
|
-
// popper will try to prevent overflow following this order,
|
|
1245
|
-
// by default, then, it could overflow on the left and on top of the boundariesElement
|
|
1246
|
-
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
|
|
1247
|
-
|
|
1248
|
-
// the behavior used by flip to change the placement of the popper
|
|
1249
|
-
flipBehavior: 'flip',
|
|
1250
|
-
|
|
1251
|
-
arrowElement: '[x-arrow]',
|
|
1252
|
-
|
|
1253
|
-
arrowOffset: 0,
|
|
1254
|
-
|
|
1255
|
-
// list of functions used to modify the offsets before they are applied to the popper
|
|
1256
|
-
modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
|
|
1257
|
-
|
|
1258
|
-
modifiersIgnored: [],
|
|
1259
|
-
|
|
1260
|
-
forceAbsolute: false
|
|
1261
|
-
};
|
|
1262
|
-
|
|
1263
|
-
/**
|
|
1264
|
-
* Create a new Popper.js instance
|
|
1265
|
-
* @constructor Popper
|
|
1266
|
-
* @param {HTMLElement} reference - The reference element used to position the popper
|
|
1267
|
-
* @param {HTMLElement|Object} popper
|
|
1268
|
-
* The HTML element used as popper, or a configuration used to generate the popper.
|
|
1269
|
-
* @param {String} [popper.tagName='div'] The tag name of the generated popper.
|
|
1270
|
-
* @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
|
|
1271
|
-
* @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
|
|
1272
|
-
* @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
|
|
1273
|
-
* @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`.
|
|
1274
|
-
* @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
|
|
1275
|
-
* @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
|
|
1276
|
-
* @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
|
|
1277
|
-
* @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
|
|
1278
|
-
* @param {Object} options
|
|
1279
|
-
* @param {String} [options.placement=bottom]
|
|
1280
|
-
* Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
|
|
1281
|
-
* left(-start, -end)`
|
|
1282
|
-
*
|
|
1283
|
-
* @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
|
|
1284
|
-
* The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
|
|
1285
|
-
* its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
|
|
1286
|
-
* reference element.
|
|
1287
|
-
* By default, it will look for a child node of the popper with the `x-arrow` attribute.
|
|
1288
|
-
*
|
|
1289
|
-
* @param {Boolean} [options.gpuAcceleration=true]
|
|
1290
|
-
* When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
|
|
1291
|
-
* browser to use the GPU to accelerate the rendering.
|
|
1292
|
-
* If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
|
|
1293
|
-
*
|
|
1294
|
-
* @param {Number} [options.offset=0]
|
|
1295
|
-
* Amount of pixels the popper will be shifted (can be negative).
|
|
1296
|
-
*
|
|
1297
|
-
* @param {String|Element} [options.boundariesElement='viewport']
|
|
1298
|
-
* The element which will define the boundaries of the popper position, the popper will never be placed outside
|
|
1299
|
-
* of the defined boundaries (except if `keepTogether` is enabled)
|
|
1300
|
-
*
|
|
1301
|
-
* @param {Number} [options.boundariesPadding=5]
|
|
1302
|
-
* Additional padding for the boundaries
|
|
1303
|
-
*
|
|
1304
|
-
* @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
|
|
1305
|
-
* Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
|
|
1306
|
-
* this means that the last ones will never overflow
|
|
1307
|
-
*
|
|
1308
|
-
* @param {String|Array} [options.flipBehavior='flip']
|
|
1309
|
-
* The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
|
|
1310
|
-
* overlap its reference element. Defining `flip` as value, the placement will be flipped on
|
|
1311
|
-
* its axis (`right - left`, `top - bottom`).
|
|
1312
|
-
* You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
|
|
1313
|
-
* how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
|
|
1314
|
-
* then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
|
|
1315
|
-
*
|
|
1316
|
-
* @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
|
|
1317
|
-
* List of functions used to modify the data before they are applied to the popper, add your custom functions
|
|
1318
|
-
* to this array to edit the offsets and placement.
|
|
1319
|
-
* The function should reflect the @params and @returns of preventOverflow
|
|
1320
|
-
*
|
|
1321
|
-
* @param {Array} [options.modifiersIgnored=[]]
|
|
1322
|
-
* Put here any built-in modifier name you want to exclude from the modifiers list
|
|
1323
|
-
* The function should reflect the @params and @returns of preventOverflow
|
|
1324
|
-
*
|
|
1325
|
-
* @param {Boolean} [options.removeOnDestroy=false]
|
|
1326
|
-
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
|
|
1327
|
-
*/
|
|
1328
|
-
function Popper(reference, popper, options) {
|
|
1329
|
-
this._reference = reference.jquery ? reference[0] : reference;
|
|
1330
|
-
this.state = {};
|
|
1331
|
-
|
|
1332
|
-
// if the popper variable is a configuration object, parse it to generate an HTMLElement
|
|
1333
|
-
// generate a default popper if is not defined
|
|
1334
|
-
var isNotDefined = typeof popper === 'undefined' || popper === null;
|
|
1335
|
-
var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
|
|
1336
|
-
if (isNotDefined || isConfig) {
|
|
1337
|
-
this._popper = this.parse(isConfig ? popper : {});
|
|
1338
|
-
}
|
|
1339
|
-
// otherwise, use the given HTMLElement as popper
|
|
1340
|
-
else {
|
|
1341
|
-
this._popper = popper.jquery ? popper[0] : popper;
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
// with {} we create a new object with the options inside it
|
|
1345
|
-
this._options = Object.assign({}, DEFAULTS, options);
|
|
1346
|
-
|
|
1347
|
-
// refactoring modifiers' list
|
|
1348
|
-
this._options.modifiers = this._options.modifiers.map(function (modifier) {
|
|
1349
|
-
// remove ignored modifiers
|
|
1350
|
-
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
|
|
1351
|
-
|
|
1352
|
-
// set the x-placement attribute before everything else because it could be used to add margins to the popper
|
|
1353
|
-
// margins needs to be calculated to get the correct popper offsets
|
|
1354
|
-
if (modifier === 'applyStyle') {
|
|
1355
|
-
this._popper.setAttribute('x-placement', this._options.placement);
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
// return predefined modifier identified by string or keep the custom one
|
|
1359
|
-
return this.modifiers[modifier] || modifier;
|
|
1360
|
-
}.bind(this));
|
|
1361
|
-
|
|
1362
|
-
// make sure to apply the popper position before any computation
|
|
1363
|
-
this.state.position = this._getPosition(this._popper, this._reference);
|
|
1364
|
-
setStyle(this._popper, { position: this.state.position, top: 0 });
|
|
1365
|
-
|
|
1366
|
-
// fire the first update to position the popper in the right place
|
|
1367
|
-
this.update();
|
|
1368
|
-
|
|
1369
|
-
// setup event listeners, they will take care of update the position in specific situations
|
|
1370
|
-
this._setupEventListeners();
|
|
1371
|
-
return this;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
//
|
|
1375
|
-
// Methods
|
|
1376
|
-
//
|
|
1377
|
-
/**
|
|
1378
|
-
* Destroy the popper
|
|
1379
|
-
* @method
|
|
1380
|
-
* @memberof Popper
|
|
1381
|
-
*/
|
|
1382
|
-
Popper.prototype.destroy = function () {
|
|
1383
|
-
this._popper.removeAttribute('x-placement');
|
|
1384
|
-
this._popper.style.left = '';
|
|
1385
|
-
this._popper.style.position = '';
|
|
1386
|
-
this._popper.style.top = '';
|
|
1387
|
-
this._popper.style[getSupportedPropertyName('transform')] = '';
|
|
1388
|
-
this._removeEventListeners();
|
|
1389
|
-
|
|
1390
|
-
// remove the popper if user explicity asked for the deletion on destroy
|
|
1391
|
-
if (this._options.removeOnDestroy) {
|
|
1392
|
-
this._popper.remove();
|
|
1393
|
-
}
|
|
1394
|
-
return this;
|
|
1395
|
-
};
|
|
1396
|
-
|
|
1397
|
-
/**
|
|
1398
|
-
* Updates the position of the popper, computing the new offsets and applying the new style
|
|
1399
|
-
* @method
|
|
1400
|
-
* @memberof Popper
|
|
1401
|
-
*/
|
|
1402
|
-
Popper.prototype.update = function () {
|
|
1403
|
-
var data = { instance: this, styles: {} };
|
|
1404
|
-
|
|
1405
|
-
// store placement inside the data object, modifiers will be able to edit `placement` if needed
|
|
1406
|
-
// and refer to _originalPlacement to know the original value
|
|
1407
|
-
data.placement = this._options.placement;
|
|
1408
|
-
data._originalPlacement = this._options.placement;
|
|
1409
|
-
|
|
1410
|
-
// compute the popper and reference offsets and put them inside data.offsets
|
|
1411
|
-
data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
|
|
1412
|
-
|
|
1413
|
-
// get boundaries
|
|
1414
|
-
data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
|
|
1415
|
-
|
|
1416
|
-
data = this.runModifiers(data, this._options.modifiers);
|
|
1417
|
-
|
|
1418
|
-
if (typeof this.state.updateCallback === 'function') {
|
|
1419
|
-
this.state.updateCallback(data);
|
|
1420
|
-
}
|
|
1421
|
-
};
|
|
1422
|
-
|
|
1423
|
-
/**
|
|
1424
|
-
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
|
|
1425
|
-
* @method
|
|
1426
|
-
* @memberof Popper
|
|
1427
|
-
* @param {Function} callback
|
|
1428
|
-
*/
|
|
1429
|
-
Popper.prototype.onCreate = function (callback) {
|
|
1430
|
-
// the createCallbacks return as first argument the popper instance
|
|
1431
|
-
callback(this);
|
|
1432
|
-
return this;
|
|
1433
|
-
};
|
|
1434
|
-
|
|
1435
|
-
/**
|
|
1436
|
-
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
|
|
1437
|
-
* used to style popper and its arrow.
|
|
1438
|
-
* NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
|
|
1439
|
-
* @method
|
|
1440
|
-
* @memberof Popper
|
|
1441
|
-
* @param {Function} callback
|
|
1442
|
-
*/
|
|
1443
|
-
Popper.prototype.onUpdate = function (callback) {
|
|
1444
|
-
this.state.updateCallback = callback;
|
|
1445
|
-
return this;
|
|
1446
|
-
};
|
|
1447
|
-
|
|
1448
|
-
/**
|
|
1449
|
-
* Helper used to generate poppers from a configuration file
|
|
1450
|
-
* @method
|
|
1451
|
-
* @memberof Popper
|
|
1452
|
-
* @param config {Object} configuration
|
|
1453
|
-
* @returns {HTMLElement} popper
|
|
1454
|
-
*/
|
|
1455
|
-
Popper.prototype.parse = function (config) {
|
|
1456
|
-
var defaultConfig = {
|
|
1457
|
-
tagName: 'div',
|
|
1458
|
-
classNames: ['popper'],
|
|
1459
|
-
attributes: [],
|
|
1460
|
-
parent: root.document.body,
|
|
1461
|
-
content: '',
|
|
1462
|
-
contentType: 'text',
|
|
1463
|
-
arrowTagName: 'div',
|
|
1464
|
-
arrowClassNames: ['popper__arrow'],
|
|
1465
|
-
arrowAttributes: ['x-arrow']
|
|
1466
|
-
};
|
|
1467
|
-
config = Object.assign({}, defaultConfig, config);
|
|
1468
|
-
|
|
1469
|
-
var d = root.document;
|
|
1470
|
-
|
|
1471
|
-
var popper = d.createElement(config.tagName);
|
|
1472
|
-
addClassNames(popper, config.classNames);
|
|
1473
|
-
addAttributes(popper, config.attributes);
|
|
1474
|
-
if (config.contentType === 'node') {
|
|
1475
|
-
popper.appendChild(config.content.jquery ? config.content[0] : config.content);
|
|
1476
|
-
} else if (config.contentType === 'html') {
|
|
1477
|
-
popper.innerHTML = config.content;
|
|
1478
|
-
} else {
|
|
1479
|
-
popper.textContent = config.content;
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
if (config.arrowTagName) {
|
|
1483
|
-
var arrow = d.createElement(config.arrowTagName);
|
|
1484
|
-
addClassNames(arrow, config.arrowClassNames);
|
|
1485
|
-
addAttributes(arrow, config.arrowAttributes);
|
|
1486
|
-
popper.appendChild(arrow);
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1489
|
-
var parent = config.parent.jquery ? config.parent[0] : config.parent;
|
|
1490
|
-
|
|
1491
|
-
// if the given parent is a string, use it to match an element
|
|
1492
|
-
// if more than one element is matched, the first one will be used as parent
|
|
1493
|
-
// if no elements are matched, the script will throw an error
|
|
1494
|
-
if (typeof parent === 'string') {
|
|
1495
|
-
parent = d.querySelectorAll(config.parent);
|
|
1496
|
-
if (parent.length > 1) {
|
|
1497
|
-
console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
|
|
1498
|
-
}
|
|
1499
|
-
if (parent.length === 0) {
|
|
1500
|
-
throw 'ERROR: the given `parent` doesn\'t exists!';
|
|
1501
|
-
}
|
|
1502
|
-
parent = parent[0];
|
|
1503
|
-
}
|
|
1504
|
-
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
|
|
1505
|
-
// the first one will be used as parent
|
|
1506
|
-
if (parent.length > 1 && parent instanceof Element === false) {
|
|
1507
|
-
console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
|
|
1508
|
-
parent = parent[0];
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
// append the generated popper to its parent
|
|
1512
|
-
parent.appendChild(popper);
|
|
1513
|
-
|
|
1514
|
-
return popper;
|
|
1515
|
-
|
|
1516
|
-
/**
|
|
1517
|
-
* Adds class names to the given element
|
|
1518
|
-
* @function
|
|
1519
|
-
* @ignore
|
|
1520
|
-
* @param {HTMLElement} target
|
|
1521
|
-
* @param {Array} classes
|
|
1522
|
-
*/
|
|
1523
|
-
function addClassNames(element, classNames) {
|
|
1524
|
-
classNames.forEach(function (className) {
|
|
1525
|
-
element.classList.add(className);
|
|
1526
|
-
});
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
/**
|
|
1530
|
-
* Adds attributes to the given element
|
|
1531
|
-
* @function
|
|
1532
|
-
* @ignore
|
|
1533
|
-
* @param {HTMLElement} target
|
|
1534
|
-
* @param {Array} attributes
|
|
1535
|
-
* @example
|
|
1536
|
-
* addAttributes(element, [ 'data-info:foobar' ]);
|
|
1537
|
-
*/
|
|
1538
|
-
function addAttributes(element, attributes) {
|
|
1539
|
-
attributes.forEach(function (attribute) {
|
|
1540
|
-
element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
|
|
1541
|
-
});
|
|
1542
|
-
}
|
|
1543
|
-
};
|
|
1544
|
-
|
|
1545
|
-
/**
|
|
1546
|
-
* Helper used to get the position which will be applied to the popper
|
|
1547
|
-
* @method
|
|
1548
|
-
* @memberof Popper
|
|
1549
|
-
* @param config {HTMLElement} popper element
|
|
1550
|
-
* @param reference {HTMLElement} reference element
|
|
1551
|
-
* @returns {String} position
|
|
1552
|
-
*/
|
|
1553
|
-
Popper.prototype._getPosition = function (popper, reference) {
|
|
1554
|
-
var container = getOffsetParent(reference);
|
|
1555
|
-
|
|
1556
|
-
if (this._options.forceAbsolute) {
|
|
1557
|
-
return 'absolute';
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1560
|
-
// Decide if the popper will be fixed
|
|
1561
|
-
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
|
|
1562
|
-
var isParentFixed = isFixed(reference, container);
|
|
1563
|
-
return isParentFixed ? 'fixed' : 'absolute';
|
|
1564
|
-
};
|
|
1565
|
-
|
|
1566
|
-
/**
|
|
1567
|
-
* Get offsets to the popper
|
|
1568
|
-
* @method
|
|
1569
|
-
* @memberof Popper
|
|
1570
|
-
* @access private
|
|
1571
|
-
* @param {Element} popper - the popper element
|
|
1572
|
-
* @param {Element} reference - the reference element (the popper will be relative to this)
|
|
1573
|
-
* @returns {Object} An object containing the offsets which will be applied to the popper
|
|
1574
|
-
*/
|
|
1575
|
-
Popper.prototype._getOffsets = function (popper, reference, placement) {
|
|
1576
|
-
placement = placement.split('-')[0];
|
|
1577
|
-
var popperOffsets = {};
|
|
1578
|
-
|
|
1579
|
-
popperOffsets.position = this.state.position;
|
|
1580
|
-
var isParentFixed = popperOffsets.position === 'fixed';
|
|
1581
|
-
|
|
1582
|
-
//
|
|
1583
|
-
// Get reference element position
|
|
1584
|
-
//
|
|
1585
|
-
var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
|
|
1586
|
-
|
|
1587
|
-
//
|
|
1588
|
-
// Get popper sizes
|
|
1589
|
-
//
|
|
1590
|
-
var popperRect = getOuterSizes(popper);
|
|
1591
|
-
|
|
1592
|
-
//
|
|
1593
|
-
// Compute offsets of popper
|
|
1594
|
-
//
|
|
1595
|
-
|
|
1596
|
-
// depending by the popper placement we have to compute its offsets slightly differently
|
|
1597
|
-
if (['right', 'left'].indexOf(placement) !== -1) {
|
|
1598
|
-
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
|
|
1599
|
-
if (placement === 'left') {
|
|
1600
|
-
popperOffsets.left = referenceOffsets.left - popperRect.width;
|
|
1601
|
-
} else {
|
|
1602
|
-
popperOffsets.left = referenceOffsets.right;
|
|
1603
|
-
}
|
|
1604
|
-
} else {
|
|
1605
|
-
popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
|
|
1606
|
-
if (placement === 'top') {
|
|
1607
|
-
popperOffsets.top = referenceOffsets.top - popperRect.height;
|
|
1608
|
-
} else {
|
|
1609
|
-
popperOffsets.top = referenceOffsets.bottom;
|
|
1610
|
-
}
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
// Add width and height to our offsets object
|
|
1614
|
-
popperOffsets.width = popperRect.width;
|
|
1615
|
-
popperOffsets.height = popperRect.height;
|
|
1616
|
-
|
|
1617
|
-
return {
|
|
1618
|
-
popper: popperOffsets,
|
|
1619
|
-
reference: referenceOffsets
|
|
1620
|
-
};
|
|
1621
|
-
};
|
|
1622
|
-
|
|
1623
|
-
/**
|
|
1624
|
-
* Setup needed event listeners used to update the popper position
|
|
1625
|
-
* @method
|
|
1626
|
-
* @memberof Popper
|
|
1627
|
-
* @access private
|
|
1628
|
-
*/
|
|
1629
|
-
Popper.prototype._setupEventListeners = function () {
|
|
1630
|
-
// NOTE: 1 DOM access here
|
|
1631
|
-
this.state.updateBound = this.update.bind(this);
|
|
1632
|
-
root.addEventListener('resize', this.state.updateBound);
|
|
1633
|
-
// if the boundariesElement is window we don't need to listen for the scroll event
|
|
1634
|
-
if (this._options.boundariesElement !== 'window') {
|
|
1635
|
-
var target = getScrollParent(this._reference);
|
|
1636
|
-
// here it could be both `body` or `documentElement` thanks to Firefox, we then check both
|
|
1637
|
-
if (target === root.document.body || target === root.document.documentElement) {
|
|
1638
|
-
target = root;
|
|
1639
|
-
}
|
|
1640
|
-
target.addEventListener('scroll', this.state.updateBound);
|
|
1641
|
-
this.state.scrollTarget = target;
|
|
1642
|
-
}
|
|
1643
|
-
};
|
|
1644
|
-
|
|
1645
|
-
/**
|
|
1646
|
-
* Remove event listeners used to update the popper position
|
|
1647
|
-
* @method
|
|
1648
|
-
* @memberof Popper
|
|
1649
|
-
* @access private
|
|
1650
|
-
*/
|
|
1651
|
-
Popper.prototype._removeEventListeners = function () {
|
|
1652
|
-
// NOTE: 1 DOM access here
|
|
1653
|
-
root.removeEventListener('resize', this.state.updateBound);
|
|
1654
|
-
if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
|
|
1655
|
-
this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
|
|
1656
|
-
this.state.scrollTarget = null;
|
|
1657
|
-
}
|
|
1658
|
-
this.state.updateBound = null;
|
|
1659
|
-
};
|
|
1660
|
-
|
|
1661
|
-
/**
|
|
1662
|
-
* Computed the boundaries limits and return them
|
|
1663
|
-
* @method
|
|
1664
|
-
* @memberof Popper
|
|
1665
|
-
* @access private
|
|
1666
|
-
* @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
|
|
1667
|
-
* @param {Number} padding - Boundaries padding
|
|
1668
|
-
* @param {Element} boundariesElement - Element used to define the boundaries
|
|
1669
|
-
* @returns {Object} Coordinates of the boundaries
|
|
1670
|
-
*/
|
|
1671
|
-
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
|
|
1672
|
-
// NOTE: 1 DOM access here
|
|
1673
|
-
var boundaries = {};
|
|
1674
|
-
var width, height;
|
|
1675
|
-
if (boundariesElement === 'window') {
|
|
1676
|
-
var body = root.document.body,
|
|
1677
|
-
html = root.document.documentElement;
|
|
1678
|
-
|
|
1679
|
-
height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
|
|
1680
|
-
width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
|
|
1681
|
-
|
|
1682
|
-
boundaries = {
|
|
1683
|
-
top: 0,
|
|
1684
|
-
right: width,
|
|
1685
|
-
bottom: height,
|
|
1686
|
-
left: 0
|
|
1687
|
-
};
|
|
1688
|
-
} else if (boundariesElement === 'viewport') {
|
|
1689
|
-
var offsetParent = getOffsetParent(this._popper);
|
|
1690
|
-
var scrollParent = getScrollParent(this._popper);
|
|
1691
|
-
var offsetParentRect = getOffsetRect(offsetParent);
|
|
1692
|
-
|
|
1693
|
-
// Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
|
|
1694
|
-
var getScrollTopValue = function getScrollTopValue(element) {
|
|
1695
|
-
return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
|
|
1696
|
-
};
|
|
1697
|
-
var getScrollLeftValue = function getScrollLeftValue(element) {
|
|
1698
|
-
return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
|
|
1699
|
-
};
|
|
1700
|
-
|
|
1701
|
-
// if the popper is fixed we don't have to substract scrolling from the boundaries
|
|
1702
|
-
var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
|
|
1703
|
-
var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
|
|
1704
|
-
|
|
1705
|
-
boundaries = {
|
|
1706
|
-
top: 0 - (offsetParentRect.top - scrollTop),
|
|
1707
|
-
right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
|
|
1708
|
-
bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
|
|
1709
|
-
left: 0 - (offsetParentRect.left - scrollLeft)
|
|
1710
|
-
};
|
|
1711
|
-
} else {
|
|
1712
|
-
if (getOffsetParent(this._popper) === boundariesElement) {
|
|
1713
|
-
boundaries = {
|
|
1714
|
-
top: 0,
|
|
1715
|
-
left: 0,
|
|
1716
|
-
right: boundariesElement.clientWidth,
|
|
1717
|
-
bottom: boundariesElement.clientHeight
|
|
1718
|
-
};
|
|
1719
|
-
} else {
|
|
1720
|
-
boundaries = getOffsetRect(boundariesElement);
|
|
1721
|
-
}
|
|
1722
|
-
}
|
|
1723
|
-
boundaries.left += padding;
|
|
1724
|
-
boundaries.right -= padding;
|
|
1725
|
-
boundaries.top = boundaries.top + padding;
|
|
1726
|
-
boundaries.bottom = boundaries.bottom - padding;
|
|
1727
|
-
return boundaries;
|
|
1728
|
-
};
|
|
1729
|
-
|
|
1730
|
-
/**
|
|
1731
|
-
* Loop trough the list of modifiers and run them in order, each of them will then edit the data object
|
|
1732
|
-
* @method
|
|
1733
|
-
* @memberof Popper
|
|
1734
|
-
* @access public
|
|
1735
|
-
* @param {Object} data
|
|
1736
|
-
* @param {Array} modifiers
|
|
1737
|
-
* @param {Function} ends
|
|
1738
|
-
*/
|
|
1739
|
-
Popper.prototype.runModifiers = function (data, modifiers, ends) {
|
|
1740
|
-
var modifiersToRun = modifiers.slice();
|
|
1741
|
-
if (ends !== undefined) {
|
|
1742
|
-
modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
modifiersToRun.forEach(function (modifier) {
|
|
1746
|
-
if (isFunction(modifier)) {
|
|
1747
|
-
data = modifier.call(this, data);
|
|
1748
|
-
}
|
|
1749
|
-
}.bind(this));
|
|
1750
|
-
|
|
1751
|
-
return data;
|
|
1752
|
-
};
|
|
1753
|
-
|
|
1754
|
-
/**
|
|
1755
|
-
* Helper used to know if the given modifier depends from another one.
|
|
1756
|
-
* @method
|
|
1757
|
-
* @memberof Popper
|
|
1758
|
-
* @param {String} requesting - name of requesting modifier
|
|
1759
|
-
* @param {String} requested - name of requested modifier
|
|
1760
|
-
* @returns {Boolean}
|
|
1761
|
-
*/
|
|
1762
|
-
Popper.prototype.isModifierRequired = function (requesting, requested) {
|
|
1763
|
-
var index = getArrayKeyIndex(this._options.modifiers, requesting);
|
|
1764
|
-
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
|
|
1765
|
-
return modifier === requested;
|
|
1766
|
-
}).length;
|
|
1767
|
-
};
|
|
1768
|
-
|
|
1769
|
-
//
|
|
1770
|
-
// Modifiers
|
|
1771
|
-
//
|
|
1772
|
-
|
|
1773
|
-
/**
|
|
1774
|
-
* Modifiers list
|
|
1775
|
-
* @namespace Popper.modifiers
|
|
1776
|
-
* @memberof Popper
|
|
1777
|
-
* @type {Object}
|
|
1778
|
-
*/
|
|
1779
|
-
Popper.prototype.modifiers = {};
|
|
1780
|
-
|
|
1781
|
-
/**
|
|
1782
|
-
* Apply the computed styles to the popper element
|
|
1783
|
-
* @method
|
|
1784
|
-
* @memberof Popper.modifiers
|
|
1785
|
-
* @argument {Object} data - The data object generated by `update` method
|
|
1786
|
-
* @returns {Object} The same data object
|
|
1787
|
-
*/
|
|
1788
|
-
Popper.prototype.modifiers.applyStyle = function (data) {
|
|
1789
|
-
// apply the final offsets to the popper
|
|
1790
|
-
// NOTE: 1 DOM access here
|
|
1791
|
-
var styles = {
|
|
1792
|
-
position: data.offsets.popper.position
|
|
1793
|
-
};
|
|
1794
|
-
|
|
1795
|
-
// round top and left to avoid blurry text
|
|
1796
|
-
var left = Math.round(data.offsets.popper.left);
|
|
1797
|
-
var top = Math.round(data.offsets.popper.top);
|
|
1798
|
-
|
|
1799
|
-
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
|
|
1800
|
-
// we automatically use the supported prefixed version if needed
|
|
1801
|
-
var prefixedProperty;
|
|
1802
|
-
if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
|
|
1803
|
-
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
|
|
1804
|
-
styles.top = 0;
|
|
1805
|
-
styles.left = 0;
|
|
1806
|
-
}
|
|
1807
|
-
// othwerise, we use the standard `left` and `top` properties
|
|
1808
|
-
else {
|
|
1809
|
-
styles.left = left;
|
|
1810
|
-
styles.top = top;
|
|
1811
|
-
}
|
|
1812
|
-
|
|
1813
|
-
// any property present in `data.styles` will be applied to the popper,
|
|
1814
|
-
// in this way we can make the 3rd party modifiers add custom styles to it
|
|
1815
|
-
// Be aware, modifiers could override the properties defined in the previous
|
|
1816
|
-
// lines of this modifier!
|
|
1817
|
-
Object.assign(styles, data.styles);
|
|
1818
|
-
|
|
1819
|
-
setStyle(this._popper, styles);
|
|
1820
|
-
|
|
1821
|
-
// set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
|
|
1822
|
-
// NOTE: 1 DOM access here
|
|
1823
|
-
this._popper.setAttribute('x-placement', data.placement);
|
|
1824
|
-
|
|
1825
|
-
// if the arrow modifier is required and the arrow style has been computed, apply the arrow style
|
|
1826
|
-
if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
|
|
1827
|
-
setStyle(data.arrowElement, data.offsets.arrow);
|
|
1828
|
-
}
|
|
1829
|
-
|
|
1830
|
-
return data;
|
|
1831
|
-
};
|
|
1832
|
-
|
|
1833
|
-
/**
|
|
1834
|
-
* Modifier used to shift the popper on the start or end of its reference element side
|
|
1835
|
-
* @method
|
|
1836
|
-
* @memberof Popper.modifiers
|
|
1837
|
-
* @argument {Object} data - The data object generated by `update` method
|
|
1838
|
-
* @returns {Object} The data object, properly modified
|
|
1839
|
-
*/
|
|
1840
|
-
Popper.prototype.modifiers.shift = function (data) {
|
|
1841
|
-
var placement = data.placement;
|
|
1842
|
-
var basePlacement = placement.split('-')[0];
|
|
1843
|
-
var shiftVariation = placement.split('-')[1];
|
|
1844
|
-
|
|
1845
|
-
// if shift shiftVariation is specified, run the modifier
|
|
1846
|
-
if (shiftVariation) {
|
|
1847
|
-
var reference = data.offsets.reference;
|
|
1848
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
1849
|
-
|
|
1850
|
-
var shiftOffsets = {
|
|
1851
|
-
y: {
|
|
1852
|
-
start: { top: reference.top },
|
|
1853
|
-
end: { top: reference.top + reference.height - popper.height }
|
|
1854
|
-
},
|
|
1855
|
-
x: {
|
|
1856
|
-
start: { left: reference.left },
|
|
1857
|
-
end: { left: reference.left + reference.width - popper.width }
|
|
1858
|
-
}
|
|
1859
|
-
};
|
|
1860
|
-
|
|
1861
|
-
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
|
|
1862
|
-
|
|
1863
|
-
data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
return data;
|
|
1867
|
-
};
|
|
1868
|
-
|
|
1869
|
-
/**
|
|
1870
|
-
* Modifier used to make sure the popper does not overflows from it's boundaries
|
|
1871
|
-
* @method
|
|
1872
|
-
* @memberof Popper.modifiers
|
|
1873
|
-
* @argument {Object} data - The data object generated by `update` method
|
|
1874
|
-
* @returns {Object} The data object, properly modified
|
|
1875
|
-
*/
|
|
1876
|
-
Popper.prototype.modifiers.preventOverflow = function (data) {
|
|
1877
|
-
var order = this._options.preventOverflowOrder;
|
|
1878
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
1879
|
-
|
|
1880
|
-
var check = {
|
|
1881
|
-
left: function left() {
|
|
1882
|
-
var left = popper.left;
|
|
1883
|
-
if (popper.left < data.boundaries.left) {
|
|
1884
|
-
left = Math.max(popper.left, data.boundaries.left);
|
|
1885
|
-
}
|
|
1886
|
-
return { left: left };
|
|
1887
|
-
},
|
|
1888
|
-
right: function right() {
|
|
1889
|
-
var left = popper.left;
|
|
1890
|
-
if (popper.right > data.boundaries.right) {
|
|
1891
|
-
left = Math.min(popper.left, data.boundaries.right - popper.width);
|
|
1892
|
-
}
|
|
1893
|
-
return { left: left };
|
|
1894
|
-
},
|
|
1895
|
-
top: function top() {
|
|
1896
|
-
var top = popper.top;
|
|
1897
|
-
if (popper.top < data.boundaries.top) {
|
|
1898
|
-
top = Math.max(popper.top, data.boundaries.top);
|
|
1899
|
-
}
|
|
1900
|
-
return { top: top };
|
|
1901
|
-
},
|
|
1902
|
-
bottom: function bottom() {
|
|
1903
|
-
var top = popper.top;
|
|
1904
|
-
if (popper.bottom > data.boundaries.bottom) {
|
|
1905
|
-
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
|
|
1906
|
-
}
|
|
1907
|
-
return { top: top };
|
|
1908
|
-
}
|
|
1909
|
-
};
|
|
1910
|
-
|
|
1911
|
-
order.forEach(function (direction) {
|
|
1912
|
-
data.offsets.popper = Object.assign(popper, check[direction]());
|
|
1913
|
-
});
|
|
1914
|
-
|
|
1915
|
-
return data;
|
|
1916
|
-
};
|
|
1917
|
-
|
|
1918
|
-
/**
|
|
1919
|
-
* Modifier used to make sure the popper is always near its reference
|
|
1920
|
-
* @method
|
|
1921
|
-
* @memberof Popper.modifiers
|
|
1922
|
-
* @argument {Object} data - The data object generated by _update method
|
|
1923
|
-
* @returns {Object} The data object, properly modified
|
|
1924
|
-
*/
|
|
1925
|
-
Popper.prototype.modifiers.keepTogether = function (data) {
|
|
1926
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
1927
|
-
var reference = data.offsets.reference;
|
|
1928
|
-
var f = Math.floor;
|
|
1929
|
-
|
|
1930
|
-
if (popper.right < f(reference.left)) {
|
|
1931
|
-
data.offsets.popper.left = f(reference.left) - popper.width;
|
|
1932
|
-
}
|
|
1933
|
-
if (popper.left > f(reference.right)) {
|
|
1934
|
-
data.offsets.popper.left = f(reference.right);
|
|
1935
|
-
}
|
|
1936
|
-
if (popper.bottom < f(reference.top)) {
|
|
1937
|
-
data.offsets.popper.top = f(reference.top) - popper.height;
|
|
1938
|
-
}
|
|
1939
|
-
if (popper.top > f(reference.bottom)) {
|
|
1940
|
-
data.offsets.popper.top = f(reference.bottom);
|
|
1941
|
-
}
|
|
1942
|
-
|
|
1943
|
-
return data;
|
|
1944
|
-
};
|
|
1945
|
-
|
|
1946
|
-
/**
|
|
1947
|
-
* Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
|
|
1948
|
-
* Requires the `preventOverflow` modifier before it in order to work.
|
|
1949
|
-
* **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
|
|
1950
|
-
* @method
|
|
1951
|
-
* @memberof Popper.modifiers
|
|
1952
|
-
* @argument {Object} data - The data object generated by _update method
|
|
1953
|
-
* @returns {Object} The data object, properly modified
|
|
1954
|
-
*/
|
|
1955
|
-
Popper.prototype.modifiers.flip = function (data) {
|
|
1956
|
-
// check if preventOverflow is in the list of modifiers before the flip modifier.
|
|
1957
|
-
// otherwise flip would not work as expected.
|
|
1958
|
-
if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
|
|
1959
|
-
console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
|
|
1960
|
-
return data;
|
|
1961
|
-
}
|
|
1962
|
-
|
|
1963
|
-
if (data.flipped && data.placement === data._originalPlacement) {
|
|
1964
|
-
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
|
|
1965
|
-
return data;
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
var placement = data.placement.split('-')[0];
|
|
1969
|
-
var placementOpposite = getOppositePlacement(placement);
|
|
1970
|
-
var variation = data.placement.split('-')[1] || '';
|
|
1971
|
-
|
|
1972
|
-
var flipOrder = [];
|
|
1973
|
-
if (this._options.flipBehavior === 'flip') {
|
|
1974
|
-
flipOrder = [placement, placementOpposite];
|
|
1975
|
-
} else {
|
|
1976
|
-
flipOrder = this._options.flipBehavior;
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
flipOrder.forEach(function (step, index) {
|
|
1980
|
-
if (placement !== step || flipOrder.length === index + 1) {
|
|
1981
|
-
return;
|
|
1982
|
-
}
|
|
1983
|
-
|
|
1984
|
-
placement = data.placement.split('-')[0];
|
|
1985
|
-
placementOpposite = getOppositePlacement(placement);
|
|
1986
|
-
|
|
1987
|
-
var popperOffsets = getPopperClientRect(data.offsets.popper);
|
|
1988
|
-
|
|
1989
|
-
// this boolean is used to distinguish right and bottom from top and left
|
|
1990
|
-
// they need different computations to get flipped
|
|
1991
|
-
var a = ['right', 'bottom'].indexOf(placement) !== -1;
|
|
1992
|
-
|
|
1993
|
-
// using Math.floor because the reference offsets may contain decimals we are not going to consider here
|
|
1994
|
-
if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
|
|
1995
|
-
// we'll use this boolean to detect any flip loop
|
|
1996
|
-
data.flipped = true;
|
|
1997
|
-
data.placement = flipOrder[index + 1];
|
|
1998
|
-
if (variation) {
|
|
1999
|
-
data.placement += '-' + variation;
|
|
2000
|
-
}
|
|
2001
|
-
data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
|
|
2002
|
-
|
|
2003
|
-
data = this.runModifiers(data, this._options.modifiers, this._flip);
|
|
2004
|
-
}
|
|
2005
|
-
}.bind(this));
|
|
2006
|
-
return data;
|
|
2007
|
-
};
|
|
2008
|
-
|
|
2009
|
-
/**
|
|
2010
|
-
* Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
|
|
2011
|
-
* The offsets will shift the popper on the side of its reference element.
|
|
2012
|
-
* @method
|
|
2013
|
-
* @memberof Popper.modifiers
|
|
2014
|
-
* @argument {Object} data - The data object generated by _update method
|
|
2015
|
-
* @returns {Object} The data object, properly modified
|
|
2016
|
-
*/
|
|
2017
|
-
Popper.prototype.modifiers.offset = function (data) {
|
|
2018
|
-
var offset = this._options.offset;
|
|
2019
|
-
var popper = data.offsets.popper;
|
|
2020
|
-
|
|
2021
|
-
if (data.placement.indexOf('left') !== -1) {
|
|
2022
|
-
popper.top -= offset;
|
|
2023
|
-
} else if (data.placement.indexOf('right') !== -1) {
|
|
2024
|
-
popper.top += offset;
|
|
2025
|
-
} else if (data.placement.indexOf('top') !== -1) {
|
|
2026
|
-
popper.left -= offset;
|
|
2027
|
-
} else if (data.placement.indexOf('bottom') !== -1) {
|
|
2028
|
-
popper.left += offset;
|
|
2029
|
-
}
|
|
2030
|
-
return data;
|
|
2031
|
-
};
|
|
2032
|
-
|
|
2033
|
-
/**
|
|
2034
|
-
* 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
|
|
2035
|
-
* It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
|
|
2036
|
-
* @method
|
|
2037
|
-
* @memberof Popper.modifiers
|
|
2038
|
-
* @argument {Object} data - The data object generated by _update method
|
|
2039
|
-
* @returns {Object} The data object, properly modified
|
|
2040
|
-
*/
|
|
2041
|
-
Popper.prototype.modifiers.arrow = function (data) {
|
|
2042
|
-
var arrow = this._options.arrowElement;
|
|
2043
|
-
var arrowOffset = this._options.arrowOffset;
|
|
2044
|
-
|
|
2045
|
-
// if the arrowElement is a string, suppose it's a CSS selector
|
|
2046
|
-
if (typeof arrow === 'string') {
|
|
2047
|
-
arrow = this._popper.querySelector(arrow);
|
|
2048
|
-
}
|
|
2049
|
-
|
|
2050
|
-
// if arrow element is not found, don't run the modifier
|
|
2051
|
-
if (!arrow) {
|
|
2052
|
-
return data;
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
// the arrow element must be child of its popper
|
|
2056
|
-
if (!this._popper.contains(arrow)) {
|
|
2057
|
-
console.warn('WARNING: `arrowElement` must be child of its popper element!');
|
|
2058
|
-
return data;
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
// arrow depends on keepTogether in order to work
|
|
2062
|
-
if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
|
|
2063
|
-
console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
|
|
2064
|
-
return data;
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
var arrowStyle = {};
|
|
2068
|
-
var placement = data.placement.split('-')[0];
|
|
2069
|
-
var popper = getPopperClientRect(data.offsets.popper);
|
|
2070
|
-
var reference = data.offsets.reference;
|
|
2071
|
-
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
|
2072
|
-
|
|
2073
|
-
var len = isVertical ? 'height' : 'width';
|
|
2074
|
-
var side = isVertical ? 'top' : 'left';
|
|
2075
|
-
var translate = isVertical ? 'translateY' : 'translateX';
|
|
2076
|
-
var altSide = isVertical ? 'left' : 'top';
|
|
2077
|
-
var opSide = isVertical ? 'bottom' : 'right';
|
|
2078
|
-
var arrowSize = getOuterSizes(arrow)[len];
|
|
2079
|
-
|
|
2080
|
-
//
|
|
2081
|
-
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
|
|
2082
|
-
//
|
|
2083
|
-
|
|
2084
|
-
// top/left side
|
|
2085
|
-
if (reference[opSide] - arrowSize < popper[side]) {
|
|
2086
|
-
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
|
|
2087
|
-
}
|
|
2088
|
-
// bottom/right side
|
|
2089
|
-
if (reference[side] + arrowSize > popper[opSide]) {
|
|
2090
|
-
data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
|
|
2091
|
-
}
|
|
2092
|
-
|
|
2093
|
-
// compute center of the popper
|
|
2094
|
-
var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
|
|
2095
|
-
|
|
2096
|
-
var sideValue = center - popper[side];
|
|
2097
|
-
|
|
2098
|
-
// prevent arrow from being placed not contiguously to its popper
|
|
2099
|
-
sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
|
|
2100
|
-
arrowStyle[side] = sideValue;
|
|
2101
|
-
arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
|
|
2102
|
-
|
|
2103
|
-
data.offsets.arrow = arrowStyle;
|
|
2104
|
-
data.arrowElement = arrow;
|
|
2105
|
-
|
|
2106
|
-
return data;
|
|
2107
|
-
};
|
|
2108
|
-
|
|
2109
|
-
//
|
|
2110
|
-
// Helpers
|
|
2111
|
-
//
|
|
2112
|
-
|
|
2113
|
-
/**
|
|
2114
|
-
* Get the outer sizes of the given element (offset size + margins)
|
|
2115
|
-
* @function
|
|
2116
|
-
* @ignore
|
|
2117
|
-
* @argument {Element} element
|
|
2118
|
-
* @returns {Object} object containing width and height properties
|
|
2119
|
-
*/
|
|
2120
|
-
function getOuterSizes(element) {
|
|
2121
|
-
// NOTE: 1 DOM access here
|
|
2122
|
-
var _display = element.style.display,
|
|
2123
|
-
_visibility = element.style.visibility;
|
|
2124
|
-
element.style.display = 'block';element.style.visibility = 'hidden';
|
|
2125
|
-
var calcWidthToForceRepaint = element.offsetWidth;
|
|
2126
|
-
|
|
2127
|
-
// original method
|
|
2128
|
-
var styles = root.getComputedStyle(element);
|
|
2129
|
-
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
|
|
2130
|
-
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
|
|
2131
|
-
var result = { width: element.offsetWidth + y, height: element.offsetHeight + x };
|
|
2132
|
-
|
|
2133
|
-
// reset element styles
|
|
2134
|
-
element.style.display = _display;element.style.visibility = _visibility;
|
|
2135
|
-
return result;
|
|
2136
|
-
}
|
|
2137
|
-
|
|
2138
|
-
/**
|
|
2139
|
-
* Get the opposite placement of the given one/
|
|
2140
|
-
* @function
|
|
2141
|
-
* @ignore
|
|
2142
|
-
* @argument {String} placement
|
|
2143
|
-
* @returns {String} flipped placement
|
|
2144
|
-
*/
|
|
2145
|
-
function getOppositePlacement(placement) {
|
|
2146
|
-
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
|
|
2147
|
-
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
2148
|
-
return hash[matched];
|
|
2149
|
-
});
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
/**
|
|
2153
|
-
* Given the popper offsets, generate an output similar to getBoundingClientRect
|
|
2154
|
-
* @function
|
|
2155
|
-
* @ignore
|
|
2156
|
-
* @argument {Object} popperOffsets
|
|
2157
|
-
* @returns {Object} ClientRect like output
|
|
2158
|
-
*/
|
|
2159
|
-
function getPopperClientRect(popperOffsets) {
|
|
2160
|
-
var offsets = Object.assign({}, popperOffsets);
|
|
2161
|
-
offsets.right = offsets.left + offsets.width;
|
|
2162
|
-
offsets.bottom = offsets.top + offsets.height;
|
|
2163
|
-
return offsets;
|
|
2164
|
-
}
|
|
2165
|
-
|
|
2166
|
-
/**
|
|
2167
|
-
* Given an array and the key to find, returns its index
|
|
2168
|
-
* @function
|
|
2169
|
-
* @ignore
|
|
2170
|
-
* @argument {Array} arr
|
|
2171
|
-
* @argument keyToFind
|
|
2172
|
-
* @returns index or null
|
|
2173
|
-
*/
|
|
2174
|
-
function getArrayKeyIndex(arr, keyToFind) {
|
|
2175
|
-
var i = 0,
|
|
2176
|
-
key;
|
|
2177
|
-
for (key in arr) {
|
|
2178
|
-
if (arr[key] === keyToFind) {
|
|
2179
|
-
return i;
|
|
2180
|
-
}
|
|
2181
|
-
i++;
|
|
2182
|
-
}
|
|
2183
|
-
return null;
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
|
-
/**
|
|
2187
|
-
* Get CSS computed property of the given element
|
|
2188
|
-
* @function
|
|
2189
|
-
* @ignore
|
|
2190
|
-
* @argument {Eement} element
|
|
2191
|
-
* @argument {String} property
|
|
2192
|
-
*/
|
|
2193
|
-
function getStyleComputedProperty(element, property) {
|
|
2194
|
-
// NOTE: 1 DOM access here
|
|
2195
|
-
var css = root.getComputedStyle(element, null);
|
|
2196
|
-
return css[property];
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
/**
|
|
2200
|
-
* Returns the offset parent of the given element
|
|
2201
|
-
* @function
|
|
2202
|
-
* @ignore
|
|
2203
|
-
* @argument {Element} element
|
|
2204
|
-
* @returns {Element} offset parent
|
|
2205
|
-
*/
|
|
2206
|
-
function getOffsetParent(element) {
|
|
2207
|
-
// NOTE: 1 DOM access here
|
|
2208
|
-
var offsetParent = element.offsetParent;
|
|
2209
|
-
return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
|
|
2210
|
-
}
|
|
2211
|
-
|
|
2212
|
-
/**
|
|
2213
|
-
* Returns the scrolling parent of the given element
|
|
2214
|
-
* @function
|
|
2215
|
-
* @ignore
|
|
2216
|
-
* @argument {Element} element
|
|
2217
|
-
* @returns {Element} offset parent
|
|
2218
|
-
*/
|
|
2219
|
-
function getScrollParent(element) {
|
|
2220
|
-
var parent = element.parentNode;
|
|
2221
|
-
|
|
2222
|
-
if (!parent) {
|
|
2223
|
-
return element;
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
if (parent === root.document) {
|
|
2227
|
-
// Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
|
|
2228
|
-
// greater than 0 and return the proper element
|
|
2229
|
-
if (root.document.body.scrollTop || root.document.body.scrollLeft) {
|
|
2230
|
-
return root.document.body;
|
|
2231
|
-
} else {
|
|
2232
|
-
return root.document.documentElement;
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
|
-
|
|
2236
|
-
// Firefox want us to check `-x` and `-y` variations as well
|
|
2237
|
-
if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
|
|
2238
|
-
// If the detected scrollParent is body, we perform an additional check on its parentNode
|
|
2239
|
-
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
|
|
2240
|
-
// fixes issue #65
|
|
2241
|
-
return parent;
|
|
2242
|
-
}
|
|
2243
|
-
return getScrollParent(element.parentNode);
|
|
2244
|
-
}
|
|
2245
|
-
|
|
2246
|
-
/**
|
|
2247
|
-
* Check if the given element is fixed or is inside a fixed parent
|
|
2248
|
-
* @function
|
|
2249
|
-
* @ignore
|
|
2250
|
-
* @argument {Element} element
|
|
2251
|
-
* @argument {Element} customContainer
|
|
2252
|
-
* @returns {Boolean} answer to "isFixed?"
|
|
2253
|
-
*/
|
|
2254
|
-
function isFixed(element) {
|
|
2255
|
-
if (element === root.document.body) {
|
|
2256
|
-
return false;
|
|
2257
|
-
}
|
|
2258
|
-
if (getStyleComputedProperty(element, 'position') === 'fixed') {
|
|
2259
|
-
return true;
|
|
2260
|
-
}
|
|
2261
|
-
return element.parentNode ? isFixed(element.parentNode) : element;
|
|
2262
|
-
}
|
|
2263
|
-
|
|
2264
|
-
/**
|
|
2265
|
-
* Set the style to the given popper
|
|
2266
|
-
* @function
|
|
2267
|
-
* @ignore
|
|
2268
|
-
* @argument {Element} element - Element to apply the style to
|
|
2269
|
-
* @argument {Object} styles - Object with a list of properties and values which will be applied to the element
|
|
2270
|
-
*/
|
|
2271
|
-
function setStyle(element, styles) {
|
|
2272
|
-
function is_numeric(n) {
|
|
2273
|
-
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
|
2274
|
-
}
|
|
2275
|
-
Object.keys(styles).forEach(function (prop) {
|
|
2276
|
-
var unit = '';
|
|
2277
|
-
// add unit if the value is numeric and is one of the following
|
|
2278
|
-
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
|
|
2279
|
-
unit = 'px';
|
|
2280
|
-
}
|
|
2281
|
-
element.style[prop] = styles[prop] + unit;
|
|
2282
|
-
});
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
/**
|
|
2286
|
-
* Check if the given variable is a function
|
|
2287
|
-
* @function
|
|
2288
|
-
* @ignore
|
|
2289
|
-
* @argument {*} functionToCheck - variable to check
|
|
2290
|
-
* @returns {Boolean} answer to: is a function?
|
|
2291
|
-
*/
|
|
2292
|
-
function isFunction(functionToCheck) {
|
|
2293
|
-
var getType = {};
|
|
2294
|
-
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
2295
|
-
}
|
|
2296
|
-
|
|
2297
|
-
/**
|
|
2298
|
-
* Get the position of the given element, relative to its offset parent
|
|
2299
|
-
* @function
|
|
2300
|
-
* @ignore
|
|
2301
|
-
* @param {Element} element
|
|
2302
|
-
* @return {Object} position - Coordinates of the element and its `scrollTop`
|
|
2303
|
-
*/
|
|
2304
|
-
function getOffsetRect(element) {
|
|
2305
|
-
var elementRect = {
|
|
2306
|
-
width: element.offsetWidth,
|
|
2307
|
-
height: element.offsetHeight,
|
|
2308
|
-
left: element.offsetLeft,
|
|
2309
|
-
top: element.offsetTop
|
|
2310
|
-
};
|
|
2311
|
-
|
|
2312
|
-
elementRect.right = elementRect.left + elementRect.width;
|
|
2313
|
-
elementRect.bottom = elementRect.top + elementRect.height;
|
|
2314
|
-
|
|
2315
|
-
// position
|
|
2316
|
-
return elementRect;
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
/**
|
|
2320
|
-
* Get bounding client rect of given element
|
|
2321
|
-
* @function
|
|
2322
|
-
* @ignore
|
|
2323
|
-
* @param {HTMLElement} element
|
|
2324
|
-
* @return {Object} client rect
|
|
2325
|
-
*/
|
|
2326
|
-
function getBoundingClientRect(element) {
|
|
2327
|
-
var rect = element.getBoundingClientRect();
|
|
2328
|
-
|
|
2329
|
-
// whether the IE version is lower than 11
|
|
2330
|
-
var isIE = navigator.userAgent.indexOf("MSIE") != -1;
|
|
2331
|
-
|
|
2332
|
-
// fix ie document bounding top always 0 bug
|
|
2333
|
-
var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
|
|
2334
|
-
|
|
2335
|
-
return {
|
|
2336
|
-
left: rect.left,
|
|
2337
|
-
top: rectTop,
|
|
2338
|
-
right: rect.right,
|
|
2339
|
-
bottom: rect.bottom,
|
|
2340
|
-
width: rect.right - rect.left,
|
|
2341
|
-
height: rect.bottom - rectTop
|
|
2342
|
-
};
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
/**
|
|
2346
|
-
* Given an element and one of its parents, return the offset
|
|
2347
|
-
* @function
|
|
2348
|
-
* @ignore
|
|
2349
|
-
* @param {HTMLElement} element
|
|
2350
|
-
* @param {HTMLElement} parent
|
|
2351
|
-
* @return {Object} rect
|
|
2352
|
-
*/
|
|
2353
|
-
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
|
|
2354
|
-
var elementRect = getBoundingClientRect(element);
|
|
2355
|
-
var parentRect = getBoundingClientRect(parent);
|
|
2356
|
-
|
|
2357
|
-
if (fixed) {
|
|
2358
|
-
var scrollParent = getScrollParent(parent);
|
|
2359
|
-
parentRect.top += scrollParent.scrollTop;
|
|
2360
|
-
parentRect.bottom += scrollParent.scrollTop;
|
|
2361
|
-
parentRect.left += scrollParent.scrollLeft;
|
|
2362
|
-
parentRect.right += scrollParent.scrollLeft;
|
|
2363
|
-
}
|
|
2364
|
-
|
|
2365
|
-
var rect = {
|
|
2366
|
-
top: elementRect.top - parentRect.top,
|
|
2367
|
-
left: elementRect.left - parentRect.left,
|
|
2368
|
-
bottom: elementRect.top - parentRect.top + elementRect.height,
|
|
2369
|
-
right: elementRect.left - parentRect.left + elementRect.width,
|
|
2370
|
-
width: elementRect.width,
|
|
2371
|
-
height: elementRect.height
|
|
2372
|
-
};
|
|
2373
|
-
return rect;
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
|
-
/**
|
|
2377
|
-
* Get the prefixed supported property name
|
|
2378
|
-
* @function
|
|
2379
|
-
* @ignore
|
|
2380
|
-
* @argument {String} property (camelCase)
|
|
2381
|
-
* @returns {String} prefixed property (camelCase)
|
|
2382
|
-
*/
|
|
2383
|
-
function getSupportedPropertyName(property) {
|
|
2384
|
-
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
|
|
2385
|
-
|
|
2386
|
-
for (var i = 0; i < prefixes.length; i++) {
|
|
2387
|
-
var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
|
|
2388
|
-
if (typeof root.document.body.style[toCheck] !== 'undefined') {
|
|
2389
|
-
return toCheck;
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
return null;
|
|
2393
|
-
}
|
|
2394
|
-
|
|
2395
|
-
/**
|
|
2396
|
-
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
|
|
2397
|
-
* objects to a target object. It will return the target object.
|
|
2398
|
-
* This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
|
|
2399
|
-
* Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
|
|
2400
|
-
* @function
|
|
2401
|
-
* @ignore
|
|
2402
|
-
*/
|
|
2403
|
-
if (!Object.assign) {
|
|
2404
|
-
Object.defineProperty(Object, 'assign', {
|
|
2405
|
-
enumerable: false,
|
|
2406
|
-
configurable: true,
|
|
2407
|
-
writable: true,
|
|
2408
|
-
value: function value(target) {
|
|
2409
|
-
if (target === undefined || target === null) {
|
|
2410
|
-
throw new TypeError('Cannot convert first argument to object');
|
|
2411
|
-
}
|
|
2412
|
-
|
|
2413
|
-
var to = Object(target);
|
|
2414
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
2415
|
-
var nextSource = arguments[i];
|
|
2416
|
-
if (nextSource === undefined || nextSource === null) {
|
|
2417
|
-
continue;
|
|
2418
|
-
}
|
|
2419
|
-
nextSource = Object(nextSource);
|
|
2420
|
-
|
|
2421
|
-
var keysArray = Object.keys(nextSource);
|
|
2422
|
-
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
|
|
2423
|
-
var nextKey = keysArray[nextIndex];
|
|
2424
|
-
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
|
|
2425
|
-
if (desc !== undefined && desc.enumerable) {
|
|
2426
|
-
to[nextKey] = nextSource[nextKey];
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
|
-
return to;
|
|
2431
|
-
}
|
|
2432
|
-
});
|
|
2433
|
-
}
|
|
2434
|
-
|
|
2435
|
-
return Popper;
|
|
2436
|
-
});
|
|
2437
|
-
|
|
2438
|
-
/***/ }),
|
|
2439
|
-
|
|
2440
|
-
/***/ 26:
|
|
2441
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2442
|
-
|
|
2443
|
-
"use strict";
|
|
2444
|
-
// ESM COMPAT FLAG
|
|
2445
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2446
|
-
|
|
2447
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=template&id=7957d3f1
|
|
2448
|
-
var render = function render() {
|
|
2449
|
-
var _vm = this,
|
|
2450
|
-
_c = _vm._self._c
|
|
2451
|
-
return _c(
|
|
2452
|
-
"label",
|
|
2453
|
-
{
|
|
2454
|
-
staticClass: "el-checkbox",
|
|
2455
|
-
class: [
|
|
2456
|
-
_vm.border && _vm.checkboxSize
|
|
2457
|
-
? "el-checkbox--" + _vm.checkboxSize
|
|
2458
|
-
: "",
|
|
2459
|
-
{ "is-disabled": _vm.isDisabled },
|
|
2460
|
-
{ "is-bordered": _vm.border },
|
|
2461
|
-
{ "is-checked": _vm.isChecked },
|
|
2462
|
-
],
|
|
2463
|
-
attrs: { id: _vm.id },
|
|
2464
|
-
},
|
|
2465
|
-
[
|
|
2466
|
-
_c(
|
|
2467
|
-
"span",
|
|
2468
|
-
{
|
|
2469
|
-
staticClass: "el-checkbox__input",
|
|
2470
|
-
class: {
|
|
2471
|
-
"is-disabled": _vm.isDisabled,
|
|
2472
|
-
"is-checked": _vm.isChecked,
|
|
2473
|
-
"is-indeterminate": _vm.indeterminate,
|
|
2474
|
-
"is-focus": _vm.focus,
|
|
2475
|
-
},
|
|
2476
|
-
attrs: {
|
|
2477
|
-
tabindex: _vm.indeterminate ? 0 : false,
|
|
2478
|
-
role: _vm.indeterminate ? "checkbox" : false,
|
|
2479
|
-
"aria-checked": _vm.indeterminate ? "mixed" : false,
|
|
2480
|
-
},
|
|
2481
|
-
},
|
|
2482
|
-
[
|
|
2483
|
-
_c("span", { staticClass: "el-checkbox__inner" }),
|
|
2484
|
-
_vm.trueLabel || _vm.falseLabel
|
|
2485
|
-
? _c("input", {
|
|
2486
|
-
directives: [
|
|
2487
|
-
{
|
|
2488
|
-
name: "model",
|
|
2489
|
-
rawName: "v-model",
|
|
2490
|
-
value: _vm.model,
|
|
2491
|
-
expression: "model",
|
|
2492
|
-
},
|
|
2493
|
-
],
|
|
2494
|
-
staticClass: "el-checkbox__original",
|
|
2495
|
-
attrs: {
|
|
2496
|
-
type: "checkbox",
|
|
2497
|
-
"aria-hidden": _vm.indeterminate ? "true" : "false",
|
|
2498
|
-
name: _vm.name,
|
|
2499
|
-
disabled: _vm.isDisabled,
|
|
2500
|
-
"true-value": _vm.trueLabel,
|
|
2501
|
-
"false-value": _vm.falseLabel,
|
|
2502
|
-
},
|
|
2503
|
-
domProps: {
|
|
2504
|
-
checked: Array.isArray(_vm.model)
|
|
2505
|
-
? _vm._i(_vm.model, null) > -1
|
|
2506
|
-
: _vm._q(_vm.model, _vm.trueLabel),
|
|
2507
|
-
},
|
|
2508
|
-
on: {
|
|
2509
|
-
change: [
|
|
2510
|
-
function ($event) {
|
|
2511
|
-
var $$a = _vm.model,
|
|
2512
|
-
$$el = $event.target,
|
|
2513
|
-
$$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
|
|
2514
|
-
if (Array.isArray($$a)) {
|
|
2515
|
-
var $$v = null,
|
|
2516
|
-
$$i = _vm._i($$a, $$v)
|
|
2517
|
-
if ($$el.checked) {
|
|
2518
|
-
$$i < 0 && (_vm.model = $$a.concat([$$v]))
|
|
2519
|
-
} else {
|
|
2520
|
-
$$i > -1 &&
|
|
2521
|
-
(_vm.model = $$a
|
|
2522
|
-
.slice(0, $$i)
|
|
2523
|
-
.concat($$a.slice($$i + 1)))
|
|
2524
|
-
}
|
|
2525
|
-
} else {
|
|
2526
|
-
_vm.model = $$c
|
|
2527
|
-
}
|
|
2528
|
-
},
|
|
2529
|
-
_vm.handleChange,
|
|
2530
|
-
],
|
|
2531
|
-
focus: function ($event) {
|
|
2532
|
-
_vm.focus = true
|
|
2533
|
-
},
|
|
2534
|
-
blur: function ($event) {
|
|
2535
|
-
_vm.focus = false
|
|
2536
|
-
},
|
|
2537
|
-
},
|
|
2538
|
-
})
|
|
2539
|
-
: _c("input", {
|
|
2540
|
-
directives: [
|
|
2541
|
-
{
|
|
2542
|
-
name: "model",
|
|
2543
|
-
rawName: "v-model",
|
|
2544
|
-
value: _vm.model,
|
|
2545
|
-
expression: "model",
|
|
2546
|
-
},
|
|
2547
|
-
],
|
|
2548
|
-
staticClass: "el-checkbox__original",
|
|
2549
|
-
attrs: {
|
|
2550
|
-
type: "checkbox",
|
|
2551
|
-
"aria-hidden": _vm.indeterminate ? "true" : "false",
|
|
2552
|
-
disabled: _vm.isDisabled,
|
|
2553
|
-
name: _vm.name,
|
|
2554
|
-
},
|
|
2555
|
-
domProps: {
|
|
2556
|
-
value: _vm.label,
|
|
2557
|
-
checked: Array.isArray(_vm.model)
|
|
2558
|
-
? _vm._i(_vm.model, _vm.label) > -1
|
|
2559
|
-
: _vm.model,
|
|
2560
|
-
},
|
|
2561
|
-
on: {
|
|
2562
|
-
change: [
|
|
2563
|
-
function ($event) {
|
|
2564
|
-
var $$a = _vm.model,
|
|
2565
|
-
$$el = $event.target,
|
|
2566
|
-
$$c = $$el.checked ? true : false
|
|
2567
|
-
if (Array.isArray($$a)) {
|
|
2568
|
-
var $$v = _vm.label,
|
|
2569
|
-
$$i = _vm._i($$a, $$v)
|
|
2570
|
-
if ($$el.checked) {
|
|
2571
|
-
$$i < 0 && (_vm.model = $$a.concat([$$v]))
|
|
2572
|
-
} else {
|
|
2573
|
-
$$i > -1 &&
|
|
2574
|
-
(_vm.model = $$a
|
|
2575
|
-
.slice(0, $$i)
|
|
2576
|
-
.concat($$a.slice($$i + 1)))
|
|
2577
|
-
}
|
|
2578
|
-
} else {
|
|
2579
|
-
_vm.model = $$c
|
|
2580
|
-
}
|
|
2581
|
-
},
|
|
2582
|
-
_vm.handleChange,
|
|
2583
|
-
],
|
|
2584
|
-
focus: function ($event) {
|
|
2585
|
-
_vm.focus = true
|
|
2586
|
-
},
|
|
2587
|
-
blur: function ($event) {
|
|
2588
|
-
_vm.focus = false
|
|
2589
|
-
},
|
|
2590
|
-
},
|
|
2591
|
-
}),
|
|
2592
|
-
]
|
|
2593
|
-
),
|
|
2594
|
-
_vm.$slots.default || _vm.label
|
|
2595
|
-
? _c(
|
|
2596
|
-
"span",
|
|
2597
|
-
{ staticClass: "el-checkbox__label" },
|
|
2598
|
-
[
|
|
2599
|
-
_vm._t("default"),
|
|
2600
|
-
!_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e(),
|
|
2601
|
-
],
|
|
2602
|
-
2
|
|
2603
|
-
)
|
|
2604
|
-
: _vm._e(),
|
|
2605
|
-
]
|
|
2606
|
-
)
|
|
2607
|
-
}
|
|
2608
|
-
var staticRenderFns = []
|
|
2609
|
-
render._withStripped = true
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=template&id=7957d3f1
|
|
2613
|
-
|
|
2614
|
-
// EXTERNAL MODULE: ./src/mixins/emitter.js
|
|
2615
|
-
var emitter = __webpack_require__(6);
|
|
2616
|
-
|
|
2617
|
-
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
/* harmony default export */ var checkboxvue_type_script_lang_js = ({
|
|
2622
|
-
name: 'ElCheckbox',
|
|
2623
|
-
|
|
2624
|
-
mixins: [emitter["a" /* default */]],
|
|
2625
|
-
|
|
2626
|
-
inject: {
|
|
2627
|
-
elForm: {
|
|
2628
|
-
default: ''
|
|
2629
|
-
},
|
|
2630
|
-
elFormItem: {
|
|
2631
|
-
default: ''
|
|
2632
|
-
}
|
|
2633
|
-
},
|
|
2634
|
-
|
|
2635
|
-
componentName: 'ElCheckbox',
|
|
2636
|
-
|
|
2637
|
-
data: function data() {
|
|
2638
|
-
return {
|
|
2639
|
-
selfModel: false,
|
|
2640
|
-
focus: false,
|
|
2641
|
-
isLimitExceeded: false
|
|
2642
|
-
};
|
|
2643
|
-
},
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
computed: {
|
|
2647
|
-
model: {
|
|
2648
|
-
get: function get() {
|
|
2649
|
-
return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
|
|
2650
|
-
},
|
|
2651
|
-
set: function set(val) {
|
|
2652
|
-
if (this.isGroup) {
|
|
2653
|
-
this.isLimitExceeded = false;
|
|
2654
|
-
this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
|
|
2655
|
-
|
|
2656
|
-
this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
|
|
2657
|
-
|
|
2658
|
-
this.isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
|
|
2659
|
-
} else {
|
|
2660
|
-
this.$emit('input', val);
|
|
2661
|
-
this.selfModel = val;
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
},
|
|
2665
|
-
|
|
2666
|
-
isChecked: function isChecked() {
|
|
2667
|
-
if ({}.toString.call(this.model) === '[object Boolean]') {
|
|
2668
|
-
return this.model;
|
|
2669
|
-
} else if (Array.isArray(this.model)) {
|
|
2670
|
-
return this.model.indexOf(this.label) > -1;
|
|
2671
|
-
} else if (this.model !== null && this.model !== undefined) {
|
|
2672
|
-
return this.model === this.trueLabel;
|
|
2673
|
-
}
|
|
2674
|
-
},
|
|
2675
|
-
isGroup: function isGroup() {
|
|
2676
|
-
var parent = this.$parent;
|
|
2677
|
-
while (parent) {
|
|
2678
|
-
if (parent.$options.componentName !== 'ElCheckboxGroup') {
|
|
2679
|
-
parent = parent.$parent;
|
|
2680
|
-
} else {
|
|
2681
|
-
this._checkboxGroup = parent;
|
|
2682
|
-
return true;
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
return false;
|
|
2686
|
-
},
|
|
2687
|
-
store: function store() {
|
|
2688
|
-
return this._checkboxGroup ? this._checkboxGroup.value : this.value;
|
|
2689
|
-
},
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
/* used to make the isDisabled judgment under max/min props */
|
|
2693
|
-
isLimitDisabled: function isLimitDisabled() {
|
|
2694
|
-
var _checkboxGroup = this._checkboxGroup,
|
|
2695
|
-
max = _checkboxGroup.max,
|
|
2696
|
-
min = _checkboxGroup.min;
|
|
2697
|
-
|
|
2698
|
-
return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
|
|
2699
|
-
},
|
|
2700
|
-
isDisabled: function isDisabled() {
|
|
2701
|
-
return this.isGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
|
|
2702
|
-
},
|
|
2703
|
-
_elFormItemSize: function _elFormItemSize() {
|
|
2704
|
-
return (this.elFormItem || {}).elFormItemSize;
|
|
2705
|
-
},
|
|
2706
|
-
checkboxSize: function checkboxSize() {
|
|
2707
|
-
var temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
|
2708
|
-
return this.isGroup ? this._checkboxGroup.checkboxGroupSize || temCheckboxSize : temCheckboxSize;
|
|
2709
|
-
}
|
|
2710
|
-
},
|
|
2711
|
-
|
|
2712
|
-
props: {
|
|
2713
|
-
value: {},
|
|
2714
|
-
label: {},
|
|
2715
|
-
indeterminate: Boolean,
|
|
2716
|
-
disabled: Boolean,
|
|
2717
|
-
checked: Boolean,
|
|
2718
|
-
name: String,
|
|
2719
|
-
trueLabel: [String, Number],
|
|
2720
|
-
falseLabel: [String, Number],
|
|
2721
|
-
id: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
|
|
2722
|
-
controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
|
|
2723
|
-
border: Boolean,
|
|
2724
|
-
size: String
|
|
2725
|
-
},
|
|
2726
|
-
|
|
2727
|
-
methods: {
|
|
2728
|
-
addToStore: function addToStore() {
|
|
2729
|
-
if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
|
|
2730
|
-
this.model.push(this.label);
|
|
2731
|
-
} else {
|
|
2732
|
-
this.model = this.trueLabel || true;
|
|
2733
|
-
}
|
|
2734
|
-
},
|
|
2735
|
-
handleChange: function handleChange(ev) {
|
|
2736
|
-
var _this = this;
|
|
2737
|
-
|
|
2738
|
-
if (this.isLimitExceeded) return;
|
|
2739
|
-
var value = void 0;
|
|
2740
|
-
if (ev.target.checked) {
|
|
2741
|
-
value = this.trueLabel === undefined ? true : this.trueLabel;
|
|
2742
|
-
} else {
|
|
2743
|
-
value = this.falseLabel === undefined ? false : this.falseLabel;
|
|
2744
|
-
}
|
|
2745
|
-
this.$emit('change', value, ev);
|
|
2746
|
-
this.$nextTick(function () {
|
|
2747
|
-
if (_this.isGroup) {
|
|
2748
|
-
_this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
|
|
2749
|
-
}
|
|
2750
|
-
});
|
|
2751
|
-
}
|
|
2752
|
-
},
|
|
2753
|
-
|
|
2754
|
-
created: function created() {
|
|
2755
|
-
this.checked && this.addToStore();
|
|
2756
|
-
},
|
|
2757
|
-
mounted: function mounted() {
|
|
2758
|
-
// 为indeterminate元素 添加aria-controls 属性
|
|
2759
|
-
if (this.indeterminate) {
|
|
2760
|
-
this.$el.setAttribute('aria-controls', this.controls);
|
|
2761
|
-
}
|
|
2762
|
-
},
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
watch: {
|
|
2766
|
-
value: function value(_value) {
|
|
2767
|
-
this.dispatch('ElFormItem', 'el.form.change', _value);
|
|
2768
|
-
}
|
|
2769
|
-
}
|
|
2770
|
-
});
|
|
2771
|
-
// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue?vue&type=script&lang=js
|
|
2772
|
-
/* harmony default export */ var src_checkboxvue_type_script_lang_js = (checkboxvue_type_script_lang_js);
|
|
2773
|
-
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
2774
|
-
var componentNormalizer = __webpack_require__(2);
|
|
2775
|
-
|
|
2776
|
-
// CONCATENATED MODULE: ./packages/checkbox/src/checkbox.vue
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
/* normalize component */
|
|
2783
|
-
|
|
2784
|
-
var component = Object(componentNormalizer["a" /* default */])(
|
|
2785
|
-
src_checkboxvue_type_script_lang_js,
|
|
2786
|
-
render,
|
|
2787
|
-
staticRenderFns,
|
|
2788
|
-
false,
|
|
2789
|
-
null,
|
|
2790
|
-
null,
|
|
2791
|
-
null
|
|
2792
|
-
|
|
2793
|
-
)
|
|
2794
|
-
|
|
2795
|
-
/* harmony default export */ var src_checkbox = (component.exports);
|
|
2796
|
-
// CONCATENATED MODULE: ./packages/checkbox/index.js
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
/* istanbul ignore next */
|
|
2800
|
-
src_checkbox.install = function (Vue) {
|
|
2801
|
-
Vue.component(src_checkbox.name, src_checkbox);
|
|
2802
|
-
};
|
|
2803
|
-
|
|
2804
|
-
/* harmony default export */ var packages_checkbox = __webpack_exports__["default"] = (src_checkbox);
|
|
2805
|
-
|
|
2806
|
-
/***/ }),
|
|
2807
|
-
|
|
2808
|
-
/***/ 3:
|
|
2809
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2810
|
-
|
|
2811
|
-
"use strict";
|
|
2812
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return noop; });
|
|
2813
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return hasOwn; });
|
|
2814
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return toObject; });
|
|
2815
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getValueByPath; });
|
|
2816
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getPropByPath; });
|
|
2817
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return generateId; });
|
|
2818
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return valueEquals; });
|
|
2819
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return escapeRegexpString; });
|
|
2820
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return arrayFindIndex; });
|
|
2821
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrayFind; });
|
|
2822
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return coerceTruthyValueToArray; });
|
|
2823
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return isIE; });
|
|
2824
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return isEdge; });
|
|
2825
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return isFirefox; });
|
|
2826
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return autoprefixer; });
|
|
2827
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return kebabCase; });
|
|
2828
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return capitalize; });
|
|
2829
|
-
/* unused harmony export looseEqual */
|
|
2830
|
-
/* unused harmony export arrayEquals */
|
|
2831
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return isEqual; });
|
|
2832
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return isEmpty; });
|
|
2833
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return rafThrottle; });
|
|
2834
|
-
/* unused harmony export objToArray */
|
|
2835
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return isMac; });
|
|
2836
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
2837
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
2838
|
-
/* harmony import */ var element_ui_src_utils_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
|
2839
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2845
|
-
|
|
2846
|
-
function noop() {};
|
|
2847
|
-
|
|
2848
|
-
function hasOwn(obj, key) {
|
|
2849
|
-
return hasOwnProperty.call(obj, key);
|
|
2850
|
-
};
|
|
2851
|
-
|
|
2852
|
-
function extend(to, _from) {
|
|
2853
|
-
for (var key in _from) {
|
|
2854
|
-
to[key] = _from[key];
|
|
2855
|
-
}
|
|
2856
|
-
return to;
|
|
2857
|
-
};
|
|
2858
|
-
|
|
2859
|
-
function toObject(arr) {
|
|
2860
|
-
var res = {};
|
|
2861
|
-
for (var i = 0; i < arr.length; i++) {
|
|
2862
|
-
if (arr[i]) {
|
|
2863
|
-
extend(res, arr[i]);
|
|
2864
|
-
}
|
|
2865
|
-
}
|
|
2866
|
-
return res;
|
|
2867
|
-
};
|
|
2868
|
-
|
|
2869
|
-
var getValueByPath = function getValueByPath(object, prop) {
|
|
2870
|
-
prop = prop || '';
|
|
2871
|
-
var paths = prop.split('.');
|
|
2872
|
-
var current = object;
|
|
2873
|
-
var result = null;
|
|
2874
|
-
for (var i = 0, j = paths.length; i < j; i++) {
|
|
2875
|
-
var path = paths[i];
|
|
2876
|
-
if (!current) break;
|
|
2877
|
-
|
|
2878
|
-
if (i === j - 1) {
|
|
2879
|
-
result = current[path];
|
|
2880
|
-
break;
|
|
2881
|
-
}
|
|
2882
|
-
current = current[path];
|
|
2883
|
-
}
|
|
2884
|
-
return result;
|
|
2885
|
-
};
|
|
2886
|
-
|
|
2887
|
-
function getPropByPath(obj, path, strict) {
|
|
2888
|
-
var tempObj = obj;
|
|
2889
|
-
path = path.replace(/\[(\w+)\]/g, '.$1');
|
|
2890
|
-
path = path.replace(/^\./, '');
|
|
2891
|
-
|
|
2892
|
-
var keyArr = path.split('.');
|
|
2893
|
-
var i = 0;
|
|
2894
|
-
for (var len = keyArr.length; i < len - 1; ++i) {
|
|
2895
|
-
if (!tempObj && !strict) break;
|
|
2896
|
-
var key = keyArr[i];
|
|
2897
|
-
if (key in tempObj) {
|
|
2898
|
-
tempObj = tempObj[key];
|
|
2899
|
-
} else {
|
|
2900
|
-
if (strict) {
|
|
2901
|
-
throw new Error('please transfer a valid prop path to form item!');
|
|
2902
|
-
}
|
|
2903
|
-
break;
|
|
2904
|
-
}
|
|
2905
|
-
}
|
|
2906
|
-
return {
|
|
2907
|
-
o: tempObj,
|
|
2908
|
-
k: keyArr[i],
|
|
2909
|
-
v: tempObj ? tempObj[keyArr[i]] : null
|
|
2910
|
-
};
|
|
2911
|
-
};
|
|
2912
|
-
|
|
2913
|
-
var generateId = function generateId() {
|
|
2914
|
-
return Math.floor(Math.random() * 10000);
|
|
2915
|
-
};
|
|
2916
|
-
|
|
2917
|
-
var valueEquals = function valueEquals(a, b) {
|
|
2918
|
-
// see: https://stackoverflow.com/questions/3115982/how-to-check-if-two-arrays-are-equal-with-javascript
|
|
2919
|
-
if (a === b) return true;
|
|
2920
|
-
if (!(a instanceof Array)) return false;
|
|
2921
|
-
if (!(b instanceof Array)) return false;
|
|
2922
|
-
if (a.length !== b.length) return false;
|
|
2923
|
-
for (var i = 0; i !== a.length; ++i) {
|
|
2924
|
-
if (a[i] !== b[i]) return false;
|
|
2925
|
-
}
|
|
2926
|
-
return true;
|
|
2927
|
-
};
|
|
2928
|
-
|
|
2929
|
-
var escapeRegexpString = function escapeRegexpString() {
|
|
2930
|
-
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
2931
|
-
return String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
|
|
2932
|
-
};
|
|
2933
|
-
|
|
2934
|
-
// TODO: use native Array.find, Array.findIndex when IE support is dropped
|
|
2935
|
-
var arrayFindIndex = function arrayFindIndex(arr, pred) {
|
|
2936
|
-
for (var i = 0; i !== arr.length; ++i) {
|
|
2937
|
-
if (pred(arr[i])) {
|
|
2938
|
-
return i;
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
return -1;
|
|
2942
|
-
};
|
|
2943
|
-
|
|
2944
|
-
var arrayFind = function arrayFind(arr, pred) {
|
|
2945
|
-
var idx = arrayFindIndex(arr, pred);
|
|
2946
|
-
return idx !== -1 ? arr[idx] : undefined;
|
|
2947
|
-
};
|
|
2948
|
-
|
|
2949
|
-
// coerce truthy value to array
|
|
2950
|
-
var coerceTruthyValueToArray = function coerceTruthyValueToArray(val) {
|
|
2951
|
-
if (Array.isArray(val)) {
|
|
2952
|
-
return val;
|
|
2953
|
-
} else if (val) {
|
|
2954
|
-
return [val];
|
|
2955
|
-
} else {
|
|
2956
|
-
return [];
|
|
2957
|
-
}
|
|
2958
|
-
};
|
|
2959
|
-
|
|
2960
|
-
var isIE = function isIE() {
|
|
2961
|
-
return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && !isNaN(Number(document.documentMode));
|
|
2962
|
-
};
|
|
2963
|
-
|
|
2964
|
-
var isEdge = function isEdge() {
|
|
2965
|
-
return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
|
|
2966
|
-
};
|
|
2967
|
-
|
|
2968
|
-
var isFirefox = function isFirefox() {
|
|
2969
|
-
return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && !!window.navigator.userAgent.match(/firefox/i);
|
|
2970
|
-
};
|
|
2971
|
-
|
|
2972
|
-
var autoprefixer = function autoprefixer(style) {
|
|
2973
|
-
if ((typeof style === 'undefined' ? 'undefined' : _typeof(style)) !== 'object') return style;
|
|
2974
|
-
var rules = ['transform', 'transition', 'animation'];
|
|
2975
|
-
var prefixes = ['ms-', 'webkit-'];
|
|
2976
|
-
rules.forEach(function (rule) {
|
|
2977
|
-
var value = style[rule];
|
|
2978
|
-
if (rule && value) {
|
|
2979
|
-
prefixes.forEach(function (prefix) {
|
|
2980
|
-
style[prefix + rule] = value;
|
|
2981
|
-
});
|
|
2982
|
-
}
|
|
2983
|
-
});
|
|
2984
|
-
return style;
|
|
2985
|
-
};
|
|
2986
|
-
|
|
2987
|
-
var kebabCase = function kebabCase(str) {
|
|
2988
|
-
var hyphenateRE = /([^-])([A-Z])/g;
|
|
2989
|
-
return str.replace(hyphenateRE, '$1-$2').replace(hyphenateRE, '$1-$2').toLowerCase();
|
|
2990
|
-
};
|
|
2991
|
-
|
|
2992
|
-
var capitalize = function capitalize(str) {
|
|
2993
|
-
if (!Object(element_ui_src_utils_types__WEBPACK_IMPORTED_MODULE_1__[/* isString */ "e"])(str)) return str;
|
|
2994
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
2995
|
-
};
|
|
2996
|
-
|
|
2997
|
-
var looseEqual = function looseEqual(a, b) {
|
|
2998
|
-
var isObjectA = Object(element_ui_src_utils_types__WEBPACK_IMPORTED_MODULE_1__[/* isObject */ "d"])(a);
|
|
2999
|
-
var isObjectB = Object(element_ui_src_utils_types__WEBPACK_IMPORTED_MODULE_1__[/* isObject */ "d"])(b);
|
|
3000
|
-
if (isObjectA && isObjectB) {
|
|
3001
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
3002
|
-
} else if (!isObjectA && !isObjectB) {
|
|
3003
|
-
return String(a) === String(b);
|
|
3004
|
-
} else {
|
|
3005
|
-
return false;
|
|
3006
|
-
}
|
|
3007
|
-
};
|
|
3008
|
-
|
|
3009
|
-
var arrayEquals = function arrayEquals(arrayA, arrayB) {
|
|
3010
|
-
arrayA = arrayA || [];
|
|
3011
|
-
arrayB = arrayB || [];
|
|
3012
|
-
|
|
3013
|
-
if (arrayA.length !== arrayB.length) {
|
|
3014
|
-
return false;
|
|
3015
|
-
}
|
|
3016
|
-
|
|
3017
|
-
for (var i = 0; i < arrayA.length; i++) {
|
|
3018
|
-
if (!looseEqual(arrayA[i], arrayB[i])) {
|
|
3019
|
-
return false;
|
|
3020
|
-
}
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3023
|
-
return true;
|
|
3024
|
-
};
|
|
3025
|
-
|
|
3026
|
-
var isEqual = function isEqual(value1, value2) {
|
|
3027
|
-
if (Array.isArray(value1) && Array.isArray(value2)) {
|
|
3028
|
-
return arrayEquals(value1, value2);
|
|
3029
|
-
}
|
|
3030
|
-
return looseEqual(value1, value2);
|
|
3031
|
-
};
|
|
3032
|
-
|
|
3033
|
-
var isEmpty = function isEmpty(val) {
|
|
3034
|
-
// null or undefined
|
|
3035
|
-
if (val == null) return true;
|
|
3036
|
-
|
|
3037
|
-
if (typeof val === 'boolean') return false;
|
|
3038
|
-
|
|
3039
|
-
if (typeof val === 'number') return !val;
|
|
3040
|
-
|
|
3041
|
-
if (val instanceof Error) return val.message === '';
|
|
3042
|
-
|
|
3043
|
-
switch (Object.prototype.toString.call(val)) {
|
|
3044
|
-
// String or Array
|
|
3045
|
-
case '[object String]':
|
|
3046
|
-
case '[object Array]':
|
|
3047
|
-
return !val.length;
|
|
3048
|
-
|
|
3049
|
-
// Map or Set or File
|
|
3050
|
-
case '[object File]':
|
|
3051
|
-
case '[object Map]':
|
|
3052
|
-
case '[object Set]':
|
|
3053
|
-
{
|
|
3054
|
-
return !val.size;
|
|
3055
|
-
}
|
|
3056
|
-
// Plain Object
|
|
3057
|
-
case '[object Object]':
|
|
3058
|
-
{
|
|
3059
|
-
return !Object.keys(val).length;
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
return false;
|
|
3064
|
-
};
|
|
3065
|
-
|
|
3066
|
-
function rafThrottle(fn) {
|
|
3067
|
-
var locked = false;
|
|
3068
|
-
return function () {
|
|
3069
|
-
var _this = this;
|
|
3070
|
-
|
|
3071
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3072
|
-
args[_key] = arguments[_key];
|
|
3073
|
-
}
|
|
3074
|
-
|
|
3075
|
-
if (locked) return;
|
|
3076
|
-
locked = true;
|
|
3077
|
-
window.requestAnimationFrame(function (_) {
|
|
3078
|
-
fn.apply(_this, args);
|
|
3079
|
-
locked = false;
|
|
3080
|
-
});
|
|
3081
|
-
};
|
|
3082
|
-
}
|
|
3083
|
-
|
|
3084
|
-
function objToArray(obj) {
|
|
3085
|
-
if (Array.isArray(obj)) {
|
|
3086
|
-
return obj;
|
|
3087
|
-
}
|
|
3088
|
-
return isEmpty(obj) ? [] : [obj];
|
|
3089
|
-
}
|
|
3090
|
-
|
|
3091
|
-
var isMac = function isMac() {
|
|
3092
|
-
return !vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer && /macintosh|mac os x/i.test(navigator.userAgent);
|
|
3093
|
-
};
|
|
3094
|
-
|
|
3095
|
-
/***/ }),
|
|
3096
|
-
|
|
3097
|
-
/***/ 4:
|
|
3098
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3099
|
-
|
|
3100
|
-
"use strict";
|
|
3101
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isString; });
|
|
3102
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isObject; });
|
|
3103
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return isHtmlElement; });
|
|
3104
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isFunction; });
|
|
3105
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isUndefined; });
|
|
3106
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isDefined; });
|
|
3107
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
3108
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
3109
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
function isString(obj) {
|
|
3114
|
-
return Object.prototype.toString.call(obj) === '[object String]';
|
|
3115
|
-
}
|
|
3116
|
-
|
|
3117
|
-
function isObject(obj) {
|
|
3118
|
-
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
3119
|
-
}
|
|
3120
|
-
|
|
3121
|
-
function isHtmlElement(node) {
|
|
3122
|
-
return node && node.nodeType === Node.ELEMENT_NODE;
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
/**
|
|
3126
|
-
* - Inspired:
|
|
3127
|
-
* https://github.com/jashkenas/underscore/blob/master/modules/isFunction.js
|
|
3128
|
-
*/
|
|
3129
|
-
var isFunction = function isFunction(functionToCheck) {
|
|
3130
|
-
var getType = {};
|
|
3131
|
-
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
|
|
3132
|
-
};
|
|
3133
|
-
|
|
3134
|
-
if ( true && (typeof Int8Array === 'undefined' ? 'undefined' : _typeof(Int8Array)) !== 'object' && (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer || typeof document.childNodes !== 'function')) {
|
|
3135
|
-
isFunction = function isFunction(obj) {
|
|
3136
|
-
return typeof obj === 'function' || false;
|
|
3137
|
-
};
|
|
3138
|
-
}
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
var isUndefined = function isUndefined(val) {
|
|
3143
|
-
return val === void 0;
|
|
3144
|
-
};
|
|
3145
|
-
|
|
3146
|
-
var isDefined = function isDefined(val) {
|
|
3147
|
-
return val !== undefined && val !== null;
|
|
3148
|
-
};
|
|
3149
|
-
|
|
3150
|
-
/***/ }),
|
|
3151
|
-
|
|
3152
|
-
/***/ 42:
|
|
3153
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3154
|
-
|
|
3155
|
-
"use strict";
|
|
3156
|
-
// ESM COMPAT FLAG
|
|
3157
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3158
|
-
|
|
3159
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./packages/popover/src/main.vue?vue&type=template&id=a6ece982
|
|
3160
|
-
var render = function render() {
|
|
3161
|
-
var _vm = this,
|
|
3162
|
-
_c = _vm._self._c
|
|
3163
|
-
return _c(
|
|
3164
|
-
"span",
|
|
3165
|
-
[
|
|
3166
|
-
_c(
|
|
3167
|
-
"transition",
|
|
3168
|
-
{
|
|
3169
|
-
attrs: { name: _vm.transition },
|
|
3170
|
-
on: {
|
|
3171
|
-
"after-enter": _vm.handleAfterEnter,
|
|
3172
|
-
"after-leave": _vm.handleAfterLeave,
|
|
3173
|
-
},
|
|
3174
|
-
},
|
|
3175
|
-
[
|
|
3176
|
-
_c(
|
|
3177
|
-
"div",
|
|
3178
|
-
{
|
|
3179
|
-
directives: [
|
|
3180
|
-
{
|
|
3181
|
-
name: "show",
|
|
3182
|
-
rawName: "v-show",
|
|
3183
|
-
value: !_vm.disabled && _vm.showPopper,
|
|
3184
|
-
expression: "!disabled && showPopper",
|
|
3185
|
-
},
|
|
3186
|
-
],
|
|
3187
|
-
ref: "popper",
|
|
3188
|
-
staticClass: "el-popover el-popper",
|
|
3189
|
-
class: [_vm.popperClass, _vm.content && "el-popover--plain"],
|
|
3190
|
-
style: { width: _vm.width + "px" },
|
|
3191
|
-
attrs: {
|
|
3192
|
-
role: "tooltip",
|
|
3193
|
-
id: _vm.tooltipId,
|
|
3194
|
-
"aria-hidden":
|
|
3195
|
-
_vm.disabled || !_vm.showPopper ? "true" : "false",
|
|
3196
|
-
},
|
|
3197
|
-
},
|
|
3198
|
-
[
|
|
3199
|
-
_vm.title
|
|
3200
|
-
? _c("div", {
|
|
3201
|
-
staticClass: "el-popover__title",
|
|
3202
|
-
domProps: { textContent: _vm._s(_vm.title) },
|
|
3203
|
-
})
|
|
3204
|
-
: _vm._e(),
|
|
3205
|
-
_vm._t("default", function () {
|
|
3206
|
-
return [_vm._v(_vm._s(_vm.content))]
|
|
3207
|
-
}),
|
|
3208
|
-
],
|
|
3209
|
-
2
|
|
3210
|
-
),
|
|
3211
|
-
]
|
|
3212
|
-
),
|
|
3213
|
-
_c(
|
|
3214
|
-
"span",
|
|
3215
|
-
{ ref: "wrapper", staticClass: "el-popover__reference-wrapper" },
|
|
3216
|
-
[_vm._t("reference")],
|
|
3217
|
-
2
|
|
3218
|
-
),
|
|
3219
|
-
],
|
|
3220
|
-
1
|
|
3221
|
-
)
|
|
3222
|
-
}
|
|
3223
|
-
var staticRenderFns = []
|
|
3224
|
-
render._withStripped = true
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
// CONCATENATED MODULE: ./packages/popover/src/main.vue?vue&type=template&id=a6ece982
|
|
3228
|
-
|
|
3229
|
-
// EXTERNAL MODULE: ./src/utils/vue-popper.js
|
|
3230
|
-
var vue_popper = __webpack_require__(10);
|
|
3231
|
-
|
|
3232
|
-
// EXTERNAL MODULE: ./src/utils/dom.js
|
|
3233
|
-
var dom = __webpack_require__(1);
|
|
3234
|
-
|
|
3235
|
-
// EXTERNAL MODULE: ./src/utils/util.js
|
|
3236
|
-
var util = __webpack_require__(3);
|
|
3237
|
-
|
|
3238
|
-
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/popover/src/main.vue?vue&type=script&lang=js
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
/* harmony default export */ var mainvue_type_script_lang_js = ({
|
|
3246
|
-
name: 'ElPopover',
|
|
3247
|
-
|
|
3248
|
-
mixins: [vue_popper["a" /* default */]],
|
|
3249
|
-
|
|
3250
|
-
props: {
|
|
3251
|
-
trigger: {
|
|
3252
|
-
type: String,
|
|
3253
|
-
default: 'click',
|
|
3254
|
-
validator: function validator(value) {
|
|
3255
|
-
return ['click', 'focus', 'hover', 'manual'].indexOf(value) > -1;
|
|
3256
|
-
}
|
|
3257
|
-
},
|
|
3258
|
-
openDelay: {
|
|
3259
|
-
type: Number,
|
|
3260
|
-
default: 0
|
|
3261
|
-
},
|
|
3262
|
-
closeDelay: {
|
|
3263
|
-
type: Number,
|
|
3264
|
-
default: 200
|
|
3265
|
-
},
|
|
3266
|
-
title: String,
|
|
3267
|
-
disabled: Boolean,
|
|
3268
|
-
content: String,
|
|
3269
|
-
reference: {},
|
|
3270
|
-
popperClass: String,
|
|
3271
|
-
width: {},
|
|
3272
|
-
visibleArrow: {
|
|
3273
|
-
default: true
|
|
3274
|
-
},
|
|
3275
|
-
arrowOffset: {
|
|
3276
|
-
type: Number,
|
|
3277
|
-
default: 0
|
|
3278
|
-
},
|
|
3279
|
-
transition: {
|
|
3280
|
-
type: String,
|
|
3281
|
-
default: 'fade-in-linear'
|
|
3282
|
-
},
|
|
3283
|
-
tabindex: {
|
|
3284
|
-
type: Number,
|
|
3285
|
-
default: 0
|
|
3286
|
-
}
|
|
3287
|
-
},
|
|
3288
|
-
|
|
3289
|
-
computed: {
|
|
3290
|
-
tooltipId: function tooltipId() {
|
|
3291
|
-
return 'el-popover-' + Object(util["g" /* generateId */])();
|
|
3292
|
-
}
|
|
3293
|
-
},
|
|
3294
|
-
watch: {
|
|
3295
|
-
showPopper: function showPopper(val) {
|
|
3296
|
-
if (this.disabled) {
|
|
3297
|
-
return;
|
|
3298
|
-
}
|
|
3299
|
-
val ? this.$emit('show') : this.$emit('hide');
|
|
3300
|
-
}
|
|
3301
|
-
},
|
|
3302
|
-
|
|
3303
|
-
mounted: function mounted() {
|
|
3304
|
-
var _this = this;
|
|
3305
|
-
|
|
3306
|
-
var reference = this.referenceElm = this.reference || this.$refs.reference;
|
|
3307
|
-
var popper = this.popper || this.$refs.popper;
|
|
3308
|
-
|
|
3309
|
-
if (!reference && this.$refs.wrapper && this.$refs.wrapper.children) {
|
|
3310
|
-
reference = this.referenceElm = this.$refs.wrapper.children[0];
|
|
3311
|
-
}
|
|
3312
|
-
// 可访问性
|
|
3313
|
-
if (reference) {
|
|
3314
|
-
Object(dom["a" /* addClass */])(reference, 'el-popover__reference');
|
|
3315
|
-
reference.setAttribute('aria-describedby', this.tooltipId);
|
|
3316
|
-
reference.setAttribute('tabindex', this.tabindex); // tab序列
|
|
3317
|
-
popper.setAttribute('tabindex', 0);
|
|
3318
|
-
|
|
3319
|
-
if (this.trigger !== 'click') {
|
|
3320
|
-
Object(dom["g" /* on */])(reference, 'focusin', function () {
|
|
3321
|
-
_this.handleFocus();
|
|
3322
|
-
var instance = reference.__vue__;
|
|
3323
|
-
if (instance && typeof instance.focus === 'function') {
|
|
3324
|
-
instance.focus();
|
|
3325
|
-
}
|
|
3326
|
-
});
|
|
3327
|
-
Object(dom["g" /* on */])(popper, 'focusin', this.handleFocus);
|
|
3328
|
-
Object(dom["g" /* on */])(reference, 'focusout', this.handleBlur);
|
|
3329
|
-
Object(dom["g" /* on */])(popper, 'focusout', this.handleBlur);
|
|
3330
|
-
}
|
|
3331
|
-
Object(dom["g" /* on */])(reference, 'keydown', this.handleKeydown);
|
|
3332
|
-
Object(dom["g" /* on */])(reference, 'click', this.handleClick);
|
|
3333
|
-
}
|
|
3334
|
-
if (this.trigger === 'click') {
|
|
3335
|
-
Object(dom["g" /* on */])(reference, 'click', this.doToggle);
|
|
3336
|
-
Object(dom["g" /* on */])(document, 'click', this.handleDocumentClick);
|
|
3337
|
-
} else if (this.trigger === 'hover') {
|
|
3338
|
-
Object(dom["g" /* on */])(reference, 'mouseenter', this.handleMouseEnter);
|
|
3339
|
-
Object(dom["g" /* on */])(popper, 'mouseenter', this.handleMouseEnter);
|
|
3340
|
-
Object(dom["g" /* on */])(reference, 'mouseleave', this.handleMouseLeave);
|
|
3341
|
-
Object(dom["g" /* on */])(popper, 'mouseleave', this.handleMouseLeave);
|
|
3342
|
-
} else if (this.trigger === 'focus') {
|
|
3343
|
-
if (this.tabindex < 0) {
|
|
3344
|
-
console.warn('[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key');
|
|
3345
|
-
}
|
|
3346
|
-
if (reference.querySelector('input, textarea')) {
|
|
3347
|
-
Object(dom["g" /* on */])(reference, 'focusin', this.doShow);
|
|
3348
|
-
Object(dom["g" /* on */])(reference, 'focusout', this.doClose);
|
|
3349
|
-
} else {
|
|
3350
|
-
Object(dom["g" /* on */])(reference, 'mousedown', this.doShow);
|
|
3351
|
-
Object(dom["g" /* on */])(reference, 'mouseup', this.doClose);
|
|
3352
|
-
}
|
|
3353
|
-
}
|
|
3354
|
-
},
|
|
3355
|
-
beforeDestroy: function beforeDestroy() {
|
|
3356
|
-
this.cleanup();
|
|
3357
|
-
},
|
|
3358
|
-
deactivated: function deactivated() {
|
|
3359
|
-
this.cleanup();
|
|
3360
|
-
},
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
methods: {
|
|
3364
|
-
doToggle: function doToggle() {
|
|
3365
|
-
this.showPopper = !this.showPopper;
|
|
3366
|
-
},
|
|
3367
|
-
doShow: function doShow() {
|
|
3368
|
-
this.showPopper = true;
|
|
3369
|
-
},
|
|
3370
|
-
doClose: function doClose() {
|
|
3371
|
-
this.showPopper = false;
|
|
3372
|
-
},
|
|
3373
|
-
handleFocus: function handleFocus() {
|
|
3374
|
-
Object(dom["a" /* addClass */])(this.referenceElm, 'focusing');
|
|
3375
|
-
if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = true;
|
|
3376
|
-
},
|
|
3377
|
-
handleClick: function handleClick() {
|
|
3378
|
-
Object(dom["i" /* removeClass */])(this.referenceElm, 'focusing');
|
|
3379
|
-
},
|
|
3380
|
-
handleBlur: function handleBlur() {
|
|
3381
|
-
Object(dom["i" /* removeClass */])(this.referenceElm, 'focusing');
|
|
3382
|
-
if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = false;
|
|
3383
|
-
},
|
|
3384
|
-
handleMouseEnter: function handleMouseEnter() {
|
|
3385
|
-
var _this2 = this;
|
|
3386
|
-
|
|
3387
|
-
clearTimeout(this._timer);
|
|
3388
|
-
if (this.openDelay) {
|
|
3389
|
-
this._timer = setTimeout(function () {
|
|
3390
|
-
_this2.showPopper = true;
|
|
3391
|
-
}, this.openDelay);
|
|
3392
|
-
} else {
|
|
3393
|
-
this.showPopper = true;
|
|
3394
|
-
}
|
|
3395
|
-
},
|
|
3396
|
-
handleKeydown: function handleKeydown(ev) {
|
|
3397
|
-
if (ev.keyCode === 27 && this.trigger !== 'manual') {
|
|
3398
|
-
// esc
|
|
3399
|
-
this.doClose();
|
|
3400
|
-
}
|
|
3401
|
-
},
|
|
3402
|
-
handleMouseLeave: function handleMouseLeave() {
|
|
3403
|
-
var _this3 = this;
|
|
3404
|
-
|
|
3405
|
-
clearTimeout(this._timer);
|
|
3406
|
-
if (this.closeDelay) {
|
|
3407
|
-
this._timer = setTimeout(function () {
|
|
3408
|
-
_this3.showPopper = false;
|
|
3409
|
-
}, this.closeDelay);
|
|
3410
|
-
} else {
|
|
3411
|
-
this.showPopper = false;
|
|
3412
|
-
}
|
|
3413
|
-
},
|
|
3414
|
-
handleDocumentClick: function handleDocumentClick(e) {
|
|
3415
|
-
var reference = this.reference || this.$refs.reference;
|
|
3416
|
-
var popper = this.popper || this.$refs.popper;
|
|
3417
|
-
|
|
3418
|
-
if (!reference && this.$refs.wrapper && this.$refs.wrapper.children) {
|
|
3419
|
-
reference = this.referenceElm = this.$refs.wrapper.children[0];
|
|
3420
|
-
}
|
|
3421
|
-
if (!this.$el || !reference || this.$el.contains(e.target) || reference.contains(e.target) || !popper || popper.contains(e.target)) return;
|
|
3422
|
-
this.showPopper = false;
|
|
3423
|
-
},
|
|
3424
|
-
handleAfterEnter: function handleAfterEnter() {
|
|
3425
|
-
this.$emit('after-enter');
|
|
3426
|
-
},
|
|
3427
|
-
handleAfterLeave: function handleAfterLeave() {
|
|
3428
|
-
this.$emit('after-leave');
|
|
3429
|
-
this.doDestroy();
|
|
3430
|
-
},
|
|
3431
|
-
cleanup: function cleanup() {
|
|
3432
|
-
if (this.openDelay || this.closeDelay) {
|
|
3433
|
-
clearTimeout(this._timer);
|
|
3434
|
-
}
|
|
3435
|
-
}
|
|
3436
|
-
},
|
|
3437
|
-
|
|
3438
|
-
destroyed: function destroyed() {
|
|
3439
|
-
var reference = this.reference;
|
|
3440
|
-
|
|
3441
|
-
Object(dom["f" /* off */])(reference, 'click', this.doToggle);
|
|
3442
|
-
Object(dom["f" /* off */])(reference, 'mouseup', this.doClose);
|
|
3443
|
-
Object(dom["f" /* off */])(reference, 'mousedown', this.doShow);
|
|
3444
|
-
Object(dom["f" /* off */])(reference, 'focusin', this.doShow);
|
|
3445
|
-
Object(dom["f" /* off */])(reference, 'focusout', this.doClose);
|
|
3446
|
-
Object(dom["f" /* off */])(reference, 'mousedown', this.doShow);
|
|
3447
|
-
Object(dom["f" /* off */])(reference, 'mouseup', this.doClose);
|
|
3448
|
-
Object(dom["f" /* off */])(reference, 'mouseleave', this.handleMouseLeave);
|
|
3449
|
-
Object(dom["f" /* off */])(reference, 'mouseenter', this.handleMouseEnter);
|
|
3450
|
-
Object(dom["f" /* off */])(document, 'click', this.handleDocumentClick);
|
|
3451
|
-
}
|
|
3452
|
-
});
|
|
3453
|
-
// CONCATENATED MODULE: ./packages/popover/src/main.vue?vue&type=script&lang=js
|
|
3454
|
-
/* harmony default export */ var src_mainvue_type_script_lang_js = (mainvue_type_script_lang_js);
|
|
3455
|
-
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
3456
|
-
var componentNormalizer = __webpack_require__(2);
|
|
3457
|
-
|
|
3458
|
-
// CONCATENATED MODULE: ./packages/popover/src/main.vue
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
/* normalize component */
|
|
3465
|
-
|
|
3466
|
-
var component = Object(componentNormalizer["a" /* default */])(
|
|
3467
|
-
src_mainvue_type_script_lang_js,
|
|
3468
|
-
render,
|
|
3469
|
-
staticRenderFns,
|
|
3470
|
-
false,
|
|
3471
|
-
null,
|
|
3472
|
-
null,
|
|
3473
|
-
null
|
|
3474
|
-
|
|
3475
|
-
)
|
|
3476
|
-
|
|
3477
|
-
/* harmony default export */ var main = (component.exports);
|
|
3478
|
-
// CONCATENATED MODULE: ./packages/popover/src/directive.js
|
|
3479
|
-
var getReference = function getReference(el, binding, vnode) {
|
|
3480
|
-
var _ref = binding.expression ? binding.value : binding.arg;
|
|
3481
|
-
var popper = vnode.context.$refs[_ref];
|
|
3482
|
-
if (popper) {
|
|
3483
|
-
if (Array.isArray(popper)) {
|
|
3484
|
-
popper[0].$refs.reference = el;
|
|
3485
|
-
} else {
|
|
3486
|
-
popper.$refs.reference = el;
|
|
3487
|
-
}
|
|
3488
|
-
}
|
|
3489
|
-
};
|
|
3490
|
-
|
|
3491
|
-
/* harmony default export */ var directive = ({
|
|
3492
|
-
bind: function bind(el, binding, vnode) {
|
|
3493
|
-
getReference(el, binding, vnode);
|
|
3494
|
-
},
|
|
3495
|
-
inserted: function inserted(el, binding, vnode) {
|
|
3496
|
-
getReference(el, binding, vnode);
|
|
3497
|
-
}
|
|
3498
|
-
});
|
|
3499
|
-
// EXTERNAL MODULE: external "vue"
|
|
3500
|
-
var external_vue_ = __webpack_require__(0);
|
|
3501
|
-
var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
|
|
3502
|
-
|
|
3503
|
-
// CONCATENATED MODULE: ./packages/popover/index.js
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
external_vue_default.a.directive('popover', directive);
|
|
3509
|
-
|
|
3510
|
-
/* istanbul ignore next */
|
|
3511
|
-
main.install = function (Vue) {
|
|
3512
|
-
Vue.directive('popover', directive);
|
|
3513
|
-
Vue.component(main.name, main);
|
|
3514
|
-
};
|
|
3515
|
-
main.directive = directive;
|
|
3516
|
-
|
|
3517
|
-
/* harmony default export */ var popover = __webpack_exports__["default"] = (main);
|
|
3518
|
-
|
|
3519
|
-
/***/ }),
|
|
3520
|
-
|
|
3521
|
-
/***/ 6:
|
|
3522
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3523
|
-
|
|
3524
|
-
"use strict";
|
|
3525
|
-
function _broadcast(componentName, eventName, params) {
|
|
3526
|
-
this.$children.forEach(function (child) {
|
|
3527
|
-
var name = child.$options.componentName;
|
|
3528
|
-
|
|
3529
|
-
if (name === componentName) {
|
|
3530
|
-
child.$emit.apply(child, [eventName].concat(params));
|
|
3531
|
-
} else {
|
|
3532
|
-
_broadcast.apply(child, [componentName, eventName].concat([params]));
|
|
3533
|
-
}
|
|
3534
|
-
});
|
|
3535
|
-
}
|
|
3536
|
-
/* harmony default export */ __webpack_exports__["a"] = ({
|
|
3537
|
-
methods: {
|
|
3538
|
-
dispatch: function dispatch(componentName, eventName, params) {
|
|
3539
|
-
var parent = this.$parent || this.$root;
|
|
3540
|
-
var name = parent.$options.componentName;
|
|
3541
|
-
|
|
3542
|
-
while (parent && (!name || name !== componentName)) {
|
|
3543
|
-
parent = parent.$parent;
|
|
3544
|
-
|
|
3545
|
-
if (parent) {
|
|
3546
|
-
name = parent.$options.componentName;
|
|
3547
|
-
}
|
|
3548
|
-
}
|
|
3549
|
-
if (parent) {
|
|
3550
|
-
parent.$emit.apply(parent, [eventName].concat(params));
|
|
3551
|
-
}
|
|
3552
|
-
},
|
|
3553
|
-
broadcast: function broadcast(componentName, eventName, params) {
|
|
3554
|
-
_broadcast.call(this, componentName, eventName, params);
|
|
3555
|
-
}
|
|
3556
|
-
}
|
|
3557
|
-
});
|
|
3558
|
-
|
|
3559
|
-
/***/ }),
|
|
3560
|
-
|
|
3561
|
-
/***/ 7:
|
|
3562
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3563
|
-
|
|
3564
|
-
"use strict";
|
|
3565
|
-
/* harmony default export */ __webpack_exports__["a"] = (function (target) {
|
|
3566
|
-
for (var i = 1, j = arguments.length; i < j; i++) {
|
|
3567
|
-
var source = arguments[i] || {};
|
|
3568
|
-
for (var prop in source) {
|
|
3569
|
-
if (source.hasOwnProperty(prop)) {
|
|
3570
|
-
var value = source[prop];
|
|
3571
|
-
if (value !== undefined) {
|
|
3572
|
-
target[prop] = value;
|
|
3573
|
-
}
|
|
3574
|
-
}
|
|
3575
|
-
}
|
|
3576
|
-
}
|
|
3577
|
-
|
|
3578
|
-
return target;
|
|
3579
|
-
});;
|
|
3580
|
-
|
|
3581
|
-
/***/ }),
|
|
3582
|
-
|
|
3583
|
-
/***/ 8:
|
|
3584
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3585
|
-
|
|
3586
|
-
"use strict";
|
|
3587
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
3588
|
-
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
var scrollBarWidth = void 0;
|
|
3592
|
-
|
|
3593
|
-
/* harmony default export */ __webpack_exports__["a"] = (function () {
|
|
3594
|
-
if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return 0;
|
|
3595
|
-
if (scrollBarWidth !== undefined) return scrollBarWidth;
|
|
3596
|
-
|
|
3597
|
-
var outer = document.createElement('div');
|
|
3598
|
-
outer.className = 'el-scrollbar__wrap';
|
|
3599
|
-
outer.style.visibility = 'hidden';
|
|
3600
|
-
outer.style.width = '100px';
|
|
3601
|
-
outer.style.position = 'absolute';
|
|
3602
|
-
outer.style.top = '-9999px';
|
|
3603
|
-
document.body.appendChild(outer);
|
|
3604
|
-
|
|
3605
|
-
var widthNoScroll = outer.offsetWidth;
|
|
3606
|
-
outer.style.overflow = 'scroll';
|
|
3607
|
-
|
|
3608
|
-
var inner = document.createElement('div');
|
|
3609
|
-
inner.style.width = '100%';
|
|
3610
|
-
outer.appendChild(inner);
|
|
3611
|
-
|
|
3612
|
-
var widthWithScroll = inner.offsetWidth;
|
|
3613
|
-
outer.parentNode.removeChild(outer);
|
|
3614
|
-
scrollBarWidth = widthNoScroll - widthWithScroll;
|
|
3615
|
-
|
|
3616
|
-
return scrollBarWidth;
|
|
3617
|
-
});;
|
|
3618
|
-
|
|
3619
|
-
/***/ }),
|
|
3620
|
-
|
|
3621
|
-
/***/ 9:
|
|
3622
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3623
|
-
|
|
3624
|
-
"use strict";
|
|
3625
|
-
|
|
3626
|
-
// EXPORTS
|
|
3627
|
-
__webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ popup_manager; });
|
|
3628
|
-
|
|
3629
|
-
// EXTERNAL MODULE: external "vue"
|
|
3630
|
-
var external_vue_ = __webpack_require__(0);
|
|
3631
|
-
var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
|
|
3632
|
-
|
|
3633
|
-
// EXTERNAL MODULE: ./src/utils/merge.js
|
|
3634
|
-
var merge = __webpack_require__(7);
|
|
3635
|
-
|
|
3636
|
-
// EXTERNAL MODULE: ./src/utils/dom.js
|
|
3637
|
-
var utils_dom = __webpack_require__(1);
|
|
3638
|
-
|
|
3639
|
-
// CONCATENATED MODULE: ./src/utils/popup/popup-manager.js
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
var hasModal = false;
|
|
3644
|
-
var hasInitZIndex = false;
|
|
3645
|
-
var popup_manager_zIndex = void 0;
|
|
3646
|
-
|
|
3647
|
-
var popup_manager_getModal = function getModal() {
|
|
3648
|
-
if (external_vue_default.a.prototype.$isServer) return;
|
|
3649
|
-
var modalDom = PopupManager.modalDom;
|
|
3650
|
-
if (modalDom) {
|
|
3651
|
-
hasModal = true;
|
|
3652
|
-
} else {
|
|
3653
|
-
hasModal = false;
|
|
3654
|
-
modalDom = document.createElement('div');
|
|
3655
|
-
PopupManager.modalDom = modalDom;
|
|
3656
|
-
|
|
3657
|
-
modalDom.addEventListener('touchmove', function (event) {
|
|
3658
|
-
event.preventDefault();
|
|
3659
|
-
event.stopPropagation();
|
|
3660
|
-
});
|
|
3661
|
-
|
|
3662
|
-
modalDom.addEventListener('click', function () {
|
|
3663
|
-
PopupManager.doOnModalClick && PopupManager.doOnModalClick();
|
|
3664
|
-
});
|
|
3665
|
-
}
|
|
3666
|
-
|
|
3667
|
-
return modalDom;
|
|
3668
|
-
};
|
|
3669
|
-
|
|
3670
|
-
var instances = {};
|
|
3671
|
-
|
|
3672
|
-
var PopupManager = {
|
|
3673
|
-
modalFade: true,
|
|
3674
|
-
|
|
3675
|
-
getInstance: function getInstance(id) {
|
|
3676
|
-
return instances[id];
|
|
3677
|
-
},
|
|
3678
|
-
|
|
3679
|
-
register: function register(id, instance) {
|
|
3680
|
-
if (id && instance) {
|
|
3681
|
-
instances[id] = instance;
|
|
3682
|
-
}
|
|
3683
|
-
},
|
|
3684
|
-
|
|
3685
|
-
deregister: function deregister(id) {
|
|
3686
|
-
if (id) {
|
|
3687
|
-
instances[id] = null;
|
|
3688
|
-
delete instances[id];
|
|
3689
|
-
}
|
|
3690
|
-
},
|
|
3691
|
-
|
|
3692
|
-
nextZIndex: function nextZIndex() {
|
|
3693
|
-
return PopupManager.zIndex++;
|
|
3694
|
-
},
|
|
3695
|
-
|
|
3696
|
-
modalStack: [],
|
|
3697
|
-
|
|
3698
|
-
doOnModalClick: function doOnModalClick() {
|
|
3699
|
-
var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
|
|
3700
|
-
if (!topItem) return;
|
|
3701
|
-
|
|
3702
|
-
var instance = PopupManager.getInstance(topItem.id);
|
|
3703
|
-
if (instance && instance.closeOnClickModal) {
|
|
3704
|
-
instance.close();
|
|
3705
|
-
}
|
|
3706
|
-
},
|
|
3707
|
-
|
|
3708
|
-
openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
|
|
3709
|
-
if (external_vue_default.a.prototype.$isServer) return;
|
|
3710
|
-
if (!id || zIndex === undefined) return;
|
|
3711
|
-
this.modalFade = modalFade;
|
|
3712
|
-
|
|
3713
|
-
var modalStack = this.modalStack;
|
|
3714
|
-
|
|
3715
|
-
for (var i = 0, j = modalStack.length; i < j; i++) {
|
|
3716
|
-
var item = modalStack[i];
|
|
3717
|
-
if (item.id === id) {
|
|
3718
|
-
return;
|
|
3719
|
-
}
|
|
3720
|
-
}
|
|
3721
|
-
|
|
3722
|
-
var modalDom = popup_manager_getModal();
|
|
3723
|
-
|
|
3724
|
-
Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal');
|
|
3725
|
-
if (this.modalFade && !hasModal) {
|
|
3726
|
-
Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal-enter');
|
|
3727
|
-
}
|
|
3728
|
-
if (modalClass) {
|
|
3729
|
-
var classArr = modalClass.trim().split(/\s+/);
|
|
3730
|
-
classArr.forEach(function (item) {
|
|
3731
|
-
return Object(utils_dom["a" /* addClass */])(modalDom, item);
|
|
3732
|
-
});
|
|
3733
|
-
}
|
|
3734
|
-
setTimeout(function () {
|
|
3735
|
-
Object(utils_dom["i" /* removeClass */])(modalDom, 'v-modal-enter');
|
|
3736
|
-
}, 200);
|
|
3737
|
-
|
|
3738
|
-
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
|
|
3739
|
-
dom.parentNode.appendChild(modalDom);
|
|
3740
|
-
} else {
|
|
3741
|
-
document.body.appendChild(modalDom);
|
|
3742
|
-
}
|
|
3743
|
-
|
|
3744
|
-
if (zIndex) {
|
|
3745
|
-
modalDom.style.zIndex = zIndex;
|
|
3746
|
-
}
|
|
3747
|
-
modalDom.tabIndex = 0;
|
|
3748
|
-
modalDom.style.display = '';
|
|
3749
|
-
|
|
3750
|
-
this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
|
|
3751
|
-
},
|
|
3752
|
-
|
|
3753
|
-
closeModal: function closeModal(id) {
|
|
3754
|
-
var modalStack = this.modalStack;
|
|
3755
|
-
var modalDom = popup_manager_getModal();
|
|
3756
|
-
|
|
3757
|
-
if (modalStack.length > 0) {
|
|
3758
|
-
var topItem = modalStack[modalStack.length - 1];
|
|
3759
|
-
if (topItem.id === id) {
|
|
3760
|
-
if (topItem.modalClass) {
|
|
3761
|
-
var classArr = topItem.modalClass.trim().split(/\s+/);
|
|
3762
|
-
classArr.forEach(function (item) {
|
|
3763
|
-
return Object(utils_dom["i" /* removeClass */])(modalDom, item);
|
|
3764
|
-
});
|
|
3765
|
-
}
|
|
3766
|
-
|
|
3767
|
-
modalStack.pop();
|
|
3768
|
-
if (modalStack.length > 0) {
|
|
3769
|
-
modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
|
|
3770
|
-
}
|
|
3771
|
-
} else {
|
|
3772
|
-
for (var i = modalStack.length - 1; i >= 0; i--) {
|
|
3773
|
-
if (modalStack[i].id === id) {
|
|
3774
|
-
modalStack.splice(i, 1);
|
|
3775
|
-
break;
|
|
3776
|
-
}
|
|
3777
|
-
}
|
|
3778
|
-
}
|
|
3779
|
-
}
|
|
3780
|
-
|
|
3781
|
-
if (modalStack.length === 0) {
|
|
3782
|
-
if (this.modalFade) {
|
|
3783
|
-
Object(utils_dom["a" /* addClass */])(modalDom, 'v-modal-leave');
|
|
3784
|
-
}
|
|
3785
|
-
setTimeout(function () {
|
|
3786
|
-
if (modalStack.length === 0) {
|
|
3787
|
-
if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
|
|
3788
|
-
modalDom.style.display = 'none';
|
|
3789
|
-
PopupManager.modalDom = undefined;
|
|
3790
|
-
}
|
|
3791
|
-
Object(utils_dom["i" /* removeClass */])(modalDom, 'v-modal-leave');
|
|
3792
|
-
}, 200);
|
|
3793
|
-
}
|
|
3794
|
-
}
|
|
3795
|
-
};
|
|
3796
|
-
|
|
3797
|
-
Object.defineProperty(PopupManager, 'zIndex', {
|
|
3798
|
-
configurable: true,
|
|
3799
|
-
get: function get() {
|
|
3800
|
-
if (!hasInitZIndex) {
|
|
3801
|
-
popup_manager_zIndex = popup_manager_zIndex || (external_vue_default.a.prototype.$ELEMENT || {}).zIndex || 2000;
|
|
3802
|
-
hasInitZIndex = true;
|
|
3803
|
-
}
|
|
3804
|
-
return popup_manager_zIndex;
|
|
3805
|
-
},
|
|
3806
|
-
set: function set(value) {
|
|
3807
|
-
popup_manager_zIndex = value;
|
|
3808
|
-
}
|
|
3809
|
-
});
|
|
3810
|
-
|
|
3811
|
-
var popup_manager_getTopPopup = function getTopPopup() {
|
|
3812
|
-
if (external_vue_default.a.prototype.$isServer) return;
|
|
3813
|
-
if (PopupManager.modalStack.length > 0) {
|
|
3814
|
-
var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
|
|
3815
|
-
if (!topPopup) return;
|
|
3816
|
-
var instance = PopupManager.getInstance(topPopup.id);
|
|
3817
|
-
|
|
3818
|
-
return instance;
|
|
3819
|
-
}
|
|
3820
|
-
};
|
|
3821
|
-
|
|
3822
|
-
if (!external_vue_default.a.prototype.$isServer) {
|
|
3823
|
-
// handle `esc` key when the popup is shown
|
|
3824
|
-
window.addEventListener('keydown', function (event) {
|
|
3825
|
-
if (event.keyCode === 27) {
|
|
3826
|
-
var topPopup = popup_manager_getTopPopup();
|
|
3827
|
-
|
|
3828
|
-
if (topPopup && topPopup.closeOnPressEscape) {
|
|
3829
|
-
topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
});
|
|
3833
|
-
}
|
|
3834
|
-
|
|
3835
|
-
/* harmony default export */ var popup_manager = (PopupManager);
|
|
3836
|
-
// EXTERNAL MODULE: ./src/utils/scrollbar-width.js
|
|
3837
|
-
var scrollbar_width = __webpack_require__(8);
|
|
3838
|
-
|
|
3839
|
-
// CONCATENATED MODULE: ./src/utils/popup/index.js
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
var idSeed = 1;
|
|
3847
|
-
|
|
3848
|
-
var scrollBarWidth = void 0;
|
|
3849
|
-
|
|
3850
|
-
/* harmony default export */ var popup = __webpack_exports__["b"] = ({
|
|
3851
|
-
props: {
|
|
3852
|
-
visible: {
|
|
3853
|
-
type: Boolean,
|
|
3854
|
-
default: false
|
|
3855
|
-
},
|
|
3856
|
-
openDelay: {},
|
|
3857
|
-
closeDelay: {},
|
|
3858
|
-
zIndex: {},
|
|
3859
|
-
modal: {
|
|
3860
|
-
type: Boolean,
|
|
3861
|
-
default: false
|
|
3862
|
-
},
|
|
3863
|
-
modalFade: {
|
|
3864
|
-
type: Boolean,
|
|
3865
|
-
default: true
|
|
3866
|
-
},
|
|
3867
|
-
modalClass: {},
|
|
3868
|
-
modalAppendToBody: {
|
|
3869
|
-
type: Boolean,
|
|
3870
|
-
default: false
|
|
3871
|
-
},
|
|
3872
|
-
lockScroll: {
|
|
3873
|
-
type: Boolean,
|
|
3874
|
-
default: true
|
|
3875
|
-
},
|
|
3876
|
-
closeOnPressEscape: {
|
|
3877
|
-
type: Boolean,
|
|
3878
|
-
default: false
|
|
3879
|
-
},
|
|
3880
|
-
closeOnClickModal: {
|
|
3881
|
-
type: Boolean,
|
|
3882
|
-
default: false
|
|
3883
|
-
}
|
|
3884
|
-
},
|
|
3885
|
-
|
|
3886
|
-
beforeMount: function beforeMount() {
|
|
3887
|
-
this._popupId = 'popup-' + idSeed++;
|
|
3888
|
-
popup_manager.register(this._popupId, this);
|
|
3889
|
-
},
|
|
3890
|
-
beforeDestroy: function beforeDestroy() {
|
|
3891
|
-
popup_manager.deregister(this._popupId);
|
|
3892
|
-
popup_manager.closeModal(this._popupId);
|
|
3893
|
-
|
|
3894
|
-
this.restoreBodyStyle();
|
|
3895
|
-
},
|
|
3896
|
-
data: function data() {
|
|
3897
|
-
return {
|
|
3898
|
-
opened: false,
|
|
3899
|
-
bodyPaddingRight: null,
|
|
3900
|
-
computedBodyPaddingRight: 0,
|
|
3901
|
-
withoutHiddenClass: true,
|
|
3902
|
-
rendered: false
|
|
3903
|
-
};
|
|
3904
|
-
},
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
watch: {
|
|
3908
|
-
visible: function visible(val) {
|
|
3909
|
-
var _this = this;
|
|
3910
|
-
|
|
3911
|
-
if (val) {
|
|
3912
|
-
if (this._opening) return;
|
|
3913
|
-
if (!this.rendered) {
|
|
3914
|
-
this.rendered = true;
|
|
3915
|
-
external_vue_default.a.nextTick(function () {
|
|
3916
|
-
_this.open();
|
|
3917
|
-
});
|
|
3918
|
-
} else {
|
|
3919
|
-
this.open();
|
|
3920
|
-
}
|
|
3921
|
-
} else {
|
|
3922
|
-
this.close();
|
|
3923
|
-
}
|
|
3924
|
-
}
|
|
3925
|
-
},
|
|
3926
|
-
|
|
3927
|
-
methods: {
|
|
3928
|
-
open: function open(options) {
|
|
3929
|
-
var _this2 = this;
|
|
3930
|
-
|
|
3931
|
-
if (!this.rendered) {
|
|
3932
|
-
this.rendered = true;
|
|
3933
|
-
}
|
|
3934
|
-
|
|
3935
|
-
var props = Object(merge["a" /* default */])({}, this.$props || this, options);
|
|
3936
|
-
|
|
3937
|
-
if (this._closeTimer) {
|
|
3938
|
-
clearTimeout(this._closeTimer);
|
|
3939
|
-
this._closeTimer = null;
|
|
3940
|
-
}
|
|
3941
|
-
clearTimeout(this._openTimer);
|
|
3942
|
-
|
|
3943
|
-
var openDelay = Number(props.openDelay);
|
|
3944
|
-
if (openDelay > 0) {
|
|
3945
|
-
this._openTimer = setTimeout(function () {
|
|
3946
|
-
_this2._openTimer = null;
|
|
3947
|
-
_this2.doOpen(props);
|
|
3948
|
-
}, openDelay);
|
|
3949
|
-
} else {
|
|
3950
|
-
this.doOpen(props);
|
|
3951
|
-
}
|
|
3952
|
-
},
|
|
3953
|
-
doOpen: function doOpen(props) {
|
|
3954
|
-
if (this.$isServer) return;
|
|
3955
|
-
if (this.willOpen && !this.willOpen()) return;
|
|
3956
|
-
if (this.opened) return;
|
|
3957
|
-
|
|
3958
|
-
this._opening = true;
|
|
3959
|
-
|
|
3960
|
-
var dom = this.$el;
|
|
3961
|
-
|
|
3962
|
-
var modal = props.modal;
|
|
3963
|
-
|
|
3964
|
-
var zIndex = props.zIndex;
|
|
3965
|
-
if (zIndex) {
|
|
3966
|
-
popup_manager.zIndex = zIndex;
|
|
3967
|
-
}
|
|
3968
|
-
|
|
3969
|
-
if (modal) {
|
|
3970
|
-
if (this._closing) {
|
|
3971
|
-
popup_manager.closeModal(this._popupId);
|
|
3972
|
-
this._closing = false;
|
|
3973
|
-
}
|
|
3974
|
-
popup_manager.openModal(this._popupId, popup_manager.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
|
|
3975
|
-
if (props.lockScroll) {
|
|
3976
|
-
this.withoutHiddenClass = !Object(utils_dom["d" /* hasClass */])(document.body, 'el-popup-parent--hidden');
|
|
3977
|
-
if (this.withoutHiddenClass) {
|
|
3978
|
-
this.bodyPaddingRight = document.body.style.paddingRight;
|
|
3979
|
-
this.computedBodyPaddingRight = parseInt(Object(utils_dom["c" /* getStyle */])(document.body, 'paddingRight'), 10);
|
|
3980
|
-
}
|
|
3981
|
-
scrollBarWidth = Object(scrollbar_width["a" /* default */])();
|
|
3982
|
-
var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
|
|
3983
|
-
var bodyOverflowY = Object(utils_dom["c" /* getStyle */])(document.body, 'overflowY');
|
|
3984
|
-
if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
|
|
3985
|
-
document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px';
|
|
3986
|
-
}
|
|
3987
|
-
Object(utils_dom["a" /* addClass */])(document.body, 'el-popup-parent--hidden');
|
|
3988
|
-
}
|
|
3989
|
-
}
|
|
3990
|
-
|
|
3991
|
-
if (getComputedStyle(dom).position === 'static') {
|
|
3992
|
-
dom.style.position = 'absolute';
|
|
3993
|
-
}
|
|
3994
|
-
|
|
3995
|
-
dom.style.zIndex = popup_manager.nextZIndex();
|
|
3996
|
-
this.opened = true;
|
|
3997
|
-
|
|
3998
|
-
this.onOpen && this.onOpen();
|
|
3999
|
-
|
|
4000
|
-
this.doAfterOpen();
|
|
4001
|
-
},
|
|
4002
|
-
doAfterOpen: function doAfterOpen() {
|
|
4003
|
-
this._opening = false;
|
|
4004
|
-
},
|
|
4005
|
-
close: function close() {
|
|
4006
|
-
var _this3 = this;
|
|
4007
|
-
|
|
4008
|
-
if (this.willClose && !this.willClose()) return;
|
|
4009
|
-
|
|
4010
|
-
if (this._openTimer !== null) {
|
|
4011
|
-
clearTimeout(this._openTimer);
|
|
4012
|
-
this._openTimer = null;
|
|
4013
|
-
}
|
|
4014
|
-
clearTimeout(this._closeTimer);
|
|
4015
|
-
|
|
4016
|
-
var closeDelay = Number(this.closeDelay);
|
|
4017
|
-
|
|
4018
|
-
if (closeDelay > 0) {
|
|
4019
|
-
this._closeTimer = setTimeout(function () {
|
|
4020
|
-
_this3._closeTimer = null;
|
|
4021
|
-
_this3.doClose();
|
|
4022
|
-
}, closeDelay);
|
|
4023
|
-
} else {
|
|
4024
|
-
this.doClose();
|
|
4025
|
-
}
|
|
4026
|
-
},
|
|
4027
|
-
doClose: function doClose() {
|
|
4028
|
-
this._closing = true;
|
|
4029
|
-
|
|
4030
|
-
this.onClose && this.onClose();
|
|
4031
|
-
|
|
4032
|
-
if (this.lockScroll) {
|
|
4033
|
-
setTimeout(this.restoreBodyStyle, 200);
|
|
4034
|
-
}
|
|
4035
|
-
|
|
4036
|
-
this.opened = false;
|
|
4037
|
-
|
|
4038
|
-
this.doAfterClose();
|
|
4039
|
-
},
|
|
4040
|
-
doAfterClose: function doAfterClose() {
|
|
4041
|
-
popup_manager.closeModal(this._popupId);
|
|
4042
|
-
this._closing = false;
|
|
4043
|
-
},
|
|
4044
|
-
restoreBodyStyle: function restoreBodyStyle() {
|
|
4045
|
-
if (this.modal && this.withoutHiddenClass) {
|
|
4046
|
-
document.body.style.paddingRight = this.bodyPaddingRight;
|
|
4047
|
-
Object(utils_dom["i" /* removeClass */])(document.body, 'el-popup-parent--hidden');
|
|
4048
|
-
}
|
|
4049
|
-
this.withoutHiddenClass = true;
|
|
4050
|
-
}
|
|
4051
|
-
}
|
|
4052
|
-
});
|
|
734
|
+
/***/ }),
|
|
4053
735
|
|
|
736
|
+
/***/ 42:
|
|
737
|
+
/***/ (function(module, exports) {
|
|
4054
738
|
|
|
739
|
+
module.exports = require("cy-element-ui/lib/popover");
|
|
4055
740
|
|
|
4056
741
|
/***/ })
|
|
4057
742
|
|