cy-element-ui 1.0.39 → 1.0.41

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