eoss 0.1.0-alpha.39 → 0.1.0-alpha.40

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 (233) hide show
  1. package/lib/0.js +1 -1
  2. package/lib/1.js +1 -1
  3. package/lib/10.js +1 -1
  4. package/lib/11.js +1 -1
  5. package/lib/12.js +1 -1
  6. package/lib/13.js +1 -1
  7. package/lib/14.js +1 -1
  8. package/lib/15.js +1 -1
  9. package/lib/16.js +1 -1
  10. package/lib/17.js +1 -1
  11. package/lib/18.js +1 -1
  12. package/lib/19.js +1 -1
  13. package/lib/20.js +1 -1
  14. package/lib/21.js +1 -1
  15. package/lib/22.js +1 -1
  16. package/lib/23.js +1 -1
  17. package/lib/24.js +1 -1
  18. package/lib/25.js +1 -1
  19. package/lib/26.js +1 -1
  20. package/lib/27.js +1 -1
  21. package/lib/28.js +1 -1
  22. package/lib/29.js +1 -1
  23. package/lib/3.js +1 -1
  24. package/lib/30.js +1 -1
  25. package/lib/31.js +1 -1
  26. package/lib/32.js +1 -1
  27. package/lib/33.js +1 -1
  28. package/lib/34.js +1 -1
  29. package/lib/35.js +1 -1
  30. package/lib/36.js +1 -1
  31. package/lib/37.js +1 -1
  32. package/lib/38.js +1 -1
  33. package/lib/39.js +1 -1
  34. package/lib/4.js +1 -1
  35. package/lib/40.js +1 -1
  36. package/lib/41.js +1 -1
  37. package/lib/42.js +1 -1
  38. package/lib/43.js +1 -1
  39. package/lib/44.js +1 -1
  40. package/lib/45.js +1 -1
  41. package/lib/46.js +1 -1
  42. package/lib/47.js +1 -1
  43. package/lib/48.js +1 -1
  44. package/lib/49.js +1 -1
  45. package/lib/5.js +1 -1
  46. package/lib/50.js +1 -1
  47. package/lib/51.js +1 -1
  48. package/lib/52.js +1 -1
  49. package/lib/53.js +1 -1
  50. package/lib/54.js +1 -1
  51. package/lib/55.js +1 -1
  52. package/lib/56.js +1 -1
  53. package/lib/57.js +1 -1
  54. package/lib/58.js +1 -1
  55. package/lib/59.js +1 -1
  56. package/lib/6.js +1 -1
  57. package/lib/60.js +1 -1
  58. package/lib/61.js +1 -1
  59. package/lib/62.js +1 -1
  60. package/lib/63.js +1 -1
  61. package/lib/64.js +1 -1
  62. package/lib/65.js +1 -1
  63. package/lib/66.js +1 -1
  64. package/lib/67.js +1 -1
  65. package/lib/68.js +1 -1
  66. package/lib/69.js +1 -1
  67. package/lib/7.js +1 -1
  68. package/lib/70.js +1 -1
  69. package/lib/71.js +1 -1
  70. package/lib/72.js +1 -1
  71. package/lib/73.js +1 -1
  72. package/lib/74.js +1 -1
  73. package/lib/75.js +1 -1
  74. package/lib/76.js +1 -1
  75. package/lib/77.js +1 -1
  76. package/lib/78.js +1 -1
  77. package/lib/79.js +1 -1
  78. package/lib/8.js +1 -1
  79. package/lib/80.js +1 -1
  80. package/lib/81.js +1 -1
  81. package/lib/9.js +1 -1
  82. package/lib/account-login.js +837 -862
  83. package/lib/alert.js +2 -2
  84. package/lib/aside.js +2 -2
  85. package/lib/audit-trajectory.js +4 -4
  86. package/lib/autocomplete.js +1813 -1988
  87. package/lib/avatar.js +2 -2
  88. package/lib/backtop.js +2 -2
  89. package/lib/badge.js +2 -2
  90. package/lib/breadcrumb-item.js +4 -4
  91. package/lib/breadcrumb.js +4 -4
  92. package/lib/button-group.js +4 -4
  93. package/lib/button.js +2 -2
  94. package/lib/ca-login.js +837 -862
  95. package/lib/calendar.js +839 -864
  96. package/lib/card.js +2 -2
  97. package/lib/carousel-item.js +846 -871
  98. package/lib/carousel.js +839 -864
  99. package/lib/cascader-panel.js +852 -877
  100. package/lib/cascader.js +2048 -2223
  101. package/lib/checkbox-button.js +4 -4
  102. package/lib/checkbox-group.js +859 -884
  103. package/lib/checkbox.js +4 -4
  104. package/lib/col.js +2 -2
  105. package/lib/collapse-item.js +1040 -1065
  106. package/lib/collapse.js +1040 -1065
  107. package/lib/color-picker.js +972 -1122
  108. package/lib/container.js +2 -2
  109. package/lib/cron.js +12 -12
  110. package/lib/data-table.js +843 -868
  111. package/lib/date-picker.js +10520 -10695
  112. package/lib/descriptions-item.js +4 -4
  113. package/lib/descriptions.js +4 -4
  114. package/lib/dialog.js +837 -862
  115. package/lib/divider.js +2 -2
  116. package/lib/drawer.js +2 -2
  117. package/lib/dropdown-item.js +4 -4
  118. package/lib/dropdown-menu.js +974 -1124
  119. package/lib/dropdown.js +841 -866
  120. package/lib/email-login.js +837 -862
  121. package/lib/empty.js +2 -2
  122. package/lib/eoss.common.js +4023 -2668
  123. package/lib/flip.js +2 -2
  124. package/lib/flow-group.js +853 -878
  125. package/lib/flow.js +868 -893
  126. package/lib/flows.js +854 -879
  127. package/lib/footer.js +2 -2
  128. package/lib/form-item.js +860 -885
  129. package/lib/form.js +933 -950
  130. package/lib/guide.js +2 -2
  131. package/lib/header.js +2 -2
  132. package/lib/icon.js +837 -862
  133. package/lib/icons.js +2 -2
  134. package/lib/image-viewer.js +837 -862
  135. package/lib/image.js +4 -4
  136. package/lib/index.js +1 -1
  137. package/lib/infinite-scroll.js +2 -2
  138. package/lib/input-number.js +6 -6
  139. package/lib/input.js +839 -864
  140. package/lib/link.js +2 -2
  141. package/lib/loading.js +2 -2
  142. package/lib/login.js +867 -891
  143. package/lib/lowcode-view.js +1843 -1185
  144. package/lib/lowcode.js +3050 -1569
  145. package/lib/main.js +970 -988
  146. package/lib/marquee.js +837 -862
  147. package/lib/menu-item-group.js +15 -15
  148. package/lib/menu-item.js +6 -6
  149. package/lib/menu.js +2227 -2368
  150. package/lib/message-box.js +843 -868
  151. package/lib/message.js +839 -864
  152. package/lib/notification.js +861 -886
  153. package/lib/option-group.js +4 -4
  154. package/lib/option.js +839 -864
  155. package/lib/page-header.js +2 -2
  156. package/lib/pagination.js +839 -864
  157. package/lib/phone-login.js +847 -866
  158. package/lib/popconfirm.js +4 -4
  159. package/lib/popover.js +1831 -2006
  160. package/lib/process-config.js +839 -864
  161. package/lib/process-module.js +846 -871
  162. package/lib/process-rule.js +905 -930
  163. package/lib/progress.js +2 -2
  164. package/lib/qr-code.js +4 -4
  165. package/lib/qrcode-login.js +839 -864
  166. package/lib/radio-button.js +4 -4
  167. package/lib/radio-group.js +850 -875
  168. package/lib/radio.js +4 -4
  169. package/lib/rate.js +837 -862
  170. package/lib/retrial-auth.js +837 -862
  171. package/lib/row.js +2 -2
  172. package/lib/scrollbar.js +839 -864
  173. package/lib/select.js +2139 -2314
  174. package/lib/selector-panel.js +940 -965
  175. package/lib/selector.js +852 -877
  176. package/lib/slider.js +4 -4
  177. package/lib/step.js +32 -32
  178. package/lib/steps.js +874 -899
  179. package/lib/submenu.js +1269 -1385
  180. package/lib/switch.js +839 -864
  181. package/lib/tab-pane.js +4 -4
  182. package/lib/table-column.js +840 -865
  183. package/lib/table.js +1825 -2000
  184. package/lib/tabs.js +846 -871
  185. package/lib/tag.js +2 -2
  186. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  187. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  188. package/lib/theme-chalk/index.css +1 -1
  189. package/lib/theme-chalk/lowcode.css +1 -1
  190. package/lib/time-picker.js +6471 -6646
  191. package/lib/time-select.js +5039 -5214
  192. package/lib/timeline-item.js +2 -2
  193. package/lib/timeline.js +2 -2
  194. package/lib/tips.js +837 -862
  195. package/lib/toolbar.js +4 -4
  196. package/lib/tooltip.js +1813 -1988
  197. package/lib/transfer.js +837 -862
  198. package/lib/tree-group.js +853 -878
  199. package/lib/tree.js +1026 -1051
  200. package/lib/update-history.js +4 -4
  201. package/lib/upload.js +859 -884
  202. package/lib/wujie.js +841 -866
  203. package/package.json +1 -1
  204. package/packages/flow-group/src/main.vue +2 -2
  205. package/packages/form/src/form-item-render.vue +1 -0
  206. package/packages/form/src/form-item.vue +12 -6
  207. package/packages/form/src/form.vue +5 -5
  208. package/packages/login/src/login.vue +1 -0
  209. package/packages/lowcode/src/attribute/function.vue +28 -9
  210. package/packages/lowcode/src/attribute/props.vue +202 -0
  211. package/packages/lowcode/src/attribute/styles.vue +79 -5
  212. package/packages/lowcode/src/attribute.vue +61 -4
  213. package/packages/lowcode/src/canvas.vue +159 -2
  214. package/packages/lowcode/src/form-render.vue +305 -0
  215. package/packages/lowcode/src/lowcode.vue +33 -13
  216. package/packages/lowcode/src/modules.vue +53 -37
  217. package/packages/lowcode/src/render.vue +80 -25
  218. package/packages/lowcode/src/util/components.js +100 -0
  219. package/packages/lowcode/src/util/props-util.js +67 -0
  220. package/packages/lowcode/src/util/source-generator.js +69 -9
  221. package/packages/lowcode/src/util/source-parser.js +64 -10
  222. package/packages/lowcode-view/src/render.vue +48 -18
  223. package/packages/main/src/components/userinfo.vue +0 -1
  224. package/packages/menu/src/menu-item-group.vue +1 -1
  225. package/packages/menu/src/mixins.js +8 -4
  226. package/packages/menu/src/submenu.vue +35 -5
  227. package/packages/phone-login/src/phone-login.vue +5 -2
  228. package/packages/theme-chalk/dist/fonts/iconfont.ttf +0 -0
  229. package/packages/theme-chalk/dist/fonts/iconfont.woff +0 -0
  230. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  231. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  232. package/packages/theme-chalk/src/lowcode.scss +21 -2
  233. package/src/index.js +336 -336
package/lib/submenu.js CHANGED
@@ -82,17 +82,237 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 178);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 185);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
89
89
 
90
- /***/ 108:
90
+ /***/ 11:
91
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
+
93
+ "use strict";
94
+ /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
95
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
96
+ /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
97
+
98
+
99
+
100
+ var hasModal = false;
101
+ var hasInitZIndex = false;
102
+ // 跨模块副本共享的 z-index 计数器宿主。
103
+ // 低代码等场景会用 eoss / eoss/src / eoss/packages 多种身份加载本文件,
104
+ // 导致出现多份 PopupManager、各自从 2000 起算,出现“后弹出的层级反而比先弹出的小”。
105
+ // 把计数器挂到全局,所有副本共用同一条单调递增序列。
106
+ var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
107
+
108
+ var getModal = function getModal() {
109
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
110
+ var modalDom = PopupManager.modalDom;
111
+ if (modalDom) {
112
+ hasModal = true;
113
+ } else {
114
+ hasModal = false;
115
+ modalDom = document.createElement('div');
116
+ PopupManager.modalDom = modalDom;
117
+
118
+ modalDom.addEventListener('touchmove', function (event) {
119
+ event.preventDefault();
120
+ event.stopPropagation();
121
+ });
122
+
123
+ modalDom.addEventListener('click', function () {
124
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
125
+ });
126
+ }
127
+
128
+ return modalDom;
129
+ };
130
+
131
+ var instances = {};
132
+
133
+ var PopupManager = {
134
+ modalFade: true,
135
+
136
+ getInstance: function getInstance(id) {
137
+ return instances[id];
138
+ },
139
+
140
+ register: function register(id, instance) {
141
+ if (id && instance) {
142
+ instances[id] = instance;
143
+ }
144
+ },
145
+
146
+ deregister: function deregister(id) {
147
+ if (id) {
148
+ instances[id] = null;
149
+ delete instances[id];
150
+ }
151
+ },
152
+
153
+ nextZIndex: function nextZIndex() {
154
+ return PopupManager.zIndex++;
155
+ },
156
+
157
+ modalStack: [],
158
+
159
+ doOnModalClick: function doOnModalClick() {
160
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
161
+ if (!topItem) return;
162
+
163
+ var instance = PopupManager.getInstance(topItem.id);
164
+ if (instance && instance.closeOnClickModal) {
165
+ instance.close();
166
+ }
167
+ },
168
+
169
+ openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
170
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
171
+ if (!id || zIndex === undefined) return;
172
+ this.modalFade = modalFade;
173
+
174
+ var modalStack = this.modalStack;
175
+
176
+ for (var i = 0, j = modalStack.length; i < j; i++) {
177
+ var item = modalStack[i];
178
+ if (item.id === id) {
179
+ return;
180
+ }
181
+ }
182
+
183
+ var modalDom = getModal();
184
+
185
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal');
186
+ if (this.modalFade && !hasModal) {
187
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter');
188
+ }
189
+ if (modalClass) {
190
+ var classArr = modalClass.trim().split(/\s+/);
191
+ classArr.forEach(function (item) {
192
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item);
193
+ });
194
+ }
195
+ setTimeout(function () {
196
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-enter');
197
+ }, 200);
198
+
199
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
200
+ dom.parentNode.appendChild(modalDom);
201
+ } else {
202
+ document.body.appendChild(modalDom);
203
+ }
204
+
205
+ if (zIndex) {
206
+ modalDom.style.zIndex = zIndex;
207
+ }
208
+ modalDom.tabIndex = 0;
209
+ modalDom.style.display = '';
210
+
211
+ this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
212
+ },
213
+
214
+ closeModal: function closeModal(id) {
215
+ var modalStack = this.modalStack;
216
+ var modalDom = getModal();
217
+ var topItem = null;
218
+
219
+ if (modalStack.length > 0) {
220
+ topItem = modalStack[modalStack.length - 1];
221
+ if (topItem.id === id) {
222
+ modalStack.pop();
223
+ if (modalStack.length > 0) {
224
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
225
+ }
226
+ } else {
227
+ for (var i = modalStack.length - 1; i >= 0; i--) {
228
+ if (modalStack[i].id === id) {
229
+ modalStack.splice(i, 1);
230
+ break;
231
+ }
232
+ }
233
+ }
234
+ }
235
+
236
+ if (modalStack.length === 0) {
237
+ if (this.modalFade) {
238
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave');
239
+ }
240
+ setTimeout(function () {
241
+ if (modalStack.length === 0) {
242
+ if (topItem && topItem.modalClass) {
243
+ var classArr = topItem.modalClass.trim().split(/\s+/);
244
+ classArr.forEach(function (item) {
245
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
246
+ });
247
+ }
248
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
249
+ modalDom.style.display = 'none';
250
+ PopupManager.modalDom = undefined;
251
+ }
252
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-leave');
253
+ }, 200);
254
+ } else {
255
+ if (topItem && topItem.modalClass) {
256
+ var classArr = topItem.modalClass.trim().split(/\s+/);
257
+ classArr.forEach(function (item) {
258
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
259
+ });
260
+ }
261
+ }
262
+ }
263
+ };
264
+
265
+ Object.defineProperty(PopupManager, 'zIndex', {
266
+ configurable: true,
267
+ get: function get() {
268
+ if (!hasInitZIndex) {
269
+ if (globalScope.__EOSS_ZINDEX__ === undefined) {
270
+ globalScope.__EOSS_ZINDEX__ = (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$EOSS || {}).zIndex || 2000;
271
+ }
272
+ hasInitZIndex = true;
273
+ }
274
+ return globalScope.__EOSS_ZINDEX__;
275
+ },
276
+ set: function set(value) {
277
+ globalScope.__EOSS_ZINDEX__ = value;
278
+ }
279
+ });
280
+
281
+ var getTopPopup = function getTopPopup() {
282
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
283
+ if (PopupManager.modalStack.length > 0) {
284
+ var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
285
+ if (!topPopup) return;
286
+ var instance = PopupManager.getInstance(topPopup.id);
287
+
288
+ return instance;
289
+ }
290
+ };
291
+
292
+ if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
293
+ // handle `esc` key when the popup is shown
294
+ window.addEventListener('keydown', function (event) {
295
+ if (event.keyCode === 27) {
296
+ var topPopup = getTopPopup();
297
+
298
+ if (topPopup && topPopup.closeOnPressEscape) {
299
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
300
+ }
301
+ }
302
+ });
303
+ }
304
+
305
+ /* harmony default export */ __webpack_exports__["a"] = (PopupManager);
306
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(45)))
307
+
308
+ /***/ }),
309
+
310
+ /***/ 110:
91
311
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
312
 
93
313
  "use strict";
94
314
 
95
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/submenu.vue?vue&type=template&id=146e2160&
315
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/submenu.vue?vue&type=template&id=09f0751a&
96
316
  var render = function () {
97
317
  var _vm = this
98
318
  var _h = _vm.$createElement
@@ -376,7 +596,7 @@ var render = function () {
376
596
  "close-icon": _vm.closeIcon,
377
597
  isFourthTabs: _vm.isFourthTabs,
378
598
  iconColors: _vm.iconColors,
379
- iconColor: _vm.getColor(index),
599
+ iconColor: _vm.getColor(index, item),
380
600
  },
381
601
  },
382
602
  "component",
@@ -399,16 +619,16 @@ var staticRenderFns = []
399
619
  render._withStripped = true
400
620
 
401
621
 
402
- // CONCATENATED MODULE: ./packages/menu/src/submenu.vue?vue&type=template&id=146e2160&
622
+ // CONCATENATED MODULE: ./packages/menu/src/submenu.vue?vue&type=template&id=09f0751a&
403
623
 
404
624
  // EXTERNAL MODULE: ./src/utils/scrollbar.js
405
625
  var scrollbar = __webpack_require__(23);
406
626
 
407
627
  // EXTERNAL MODULE: ./packages/menu/src/mixins.js
408
- var mixins = __webpack_require__(80);
628
+ var mixins = __webpack_require__(81);
409
629
 
410
630
  // EXTERNAL MODULE: ./packages/menu/src/menu-mixin.js
411
- var menu_mixin = __webpack_require__(67);
631
+ var menu_mixin = __webpack_require__(68);
412
632
 
413
633
  // EXTERNAL MODULE: ./src/mixins/emitter.js
414
634
  var emitter = __webpack_require__(15);
@@ -417,13 +637,13 @@ var emitter = __webpack_require__(15);
417
637
  var vue_popper = __webpack_require__(27);
418
638
 
419
639
  // EXTERNAL MODULE: ./packages/menu/src/menu-item.vue + 4 modules
420
- var menu_item = __webpack_require__(60);
640
+ var menu_item = __webpack_require__(61);
421
641
 
422
642
  // EXTERNAL MODULE: ./packages/menu/src/menu-item-group.vue + 4 modules
423
- var menu_item_group = __webpack_require__(82);
643
+ var menu_item_group = __webpack_require__(84);
424
644
 
425
645
  // EXTERNAL MODULE: ./src/transitions/collapse-transition.js
426
- var collapse_transition = __webpack_require__(69);
646
+ var collapse_transition = __webpack_require__(70);
427
647
 
428
648
  // EXTERNAL MODULE: external "eoss/lib/icon"
429
649
  var icon_ = __webpack_require__(26);
@@ -749,8 +969,10 @@ var poperMixins = {
749
969
  return this.collapse ? 'es-zoom-in-left' : 'es-zoom-in-top';
750
970
  },
751
971
  opened: function opened() {
752
- var open = this.open && !this.collapse || this.index && this.rootMenu.openedMenus.indexOf(this.index) > -1;
753
- return open;
972
+ // 展开状态统一由 rootMenu.openedMenus 驱动,
973
+ // open 属性仅作为默认展开的初始值(见 syncOpenProp),不参与计算,
974
+ // 否则 open 为 true 时会短路导致点击无法折叠
975
+ return !!this.index && this.rootMenu.openedMenus.indexOf(this.index) > -1;
754
976
  },
755
977
  active: function active() {
756
978
  var isActive = false;
@@ -849,6 +1071,15 @@ var poperMixins = {
849
1071
  });
850
1072
  }
851
1073
  },
1074
+ open: function open() {
1075
+ this.syncOpenProp();
1076
+ },
1077
+ collapse: function collapse(val) {
1078
+ // 整菜单收起会清空 openedMenus,取消收起后按 open 属性恢复默认展开
1079
+ if (!val) {
1080
+ this.syncOpenProp();
1081
+ }
1082
+ },
852
1083
  iconColors: function iconColors() {
853
1084
  // 当iconColors变化时,清除缓存
854
1085
  this._colorCache = null;
@@ -889,6 +1120,28 @@ var poperMixins = {
889
1120
  },
890
1121
 
891
1122
  methods: {
1123
+ /**
1124
+ * 同步 open 属性到 rootMenu.openedMenus:
1125
+ * open 语义为“默认展开”,写入 openedMenus 后仍可被点击正常折叠/展开
1126
+ */
1127
+ syncOpenProp: function syncOpenProp() {
1128
+ if (!this.index || this.collapse) {
1129
+ return;
1130
+ }
1131
+ var rootMenu = this.rootMenu;
1132
+ var isOpened = rootMenu.openedMenus.indexOf(this.index) > -1;
1133
+ if (this.open && !isOpened) {
1134
+ // 默认展开直接写入 openedMenus,不走 openMenu 的 uniqueOpened 过滤:
1135
+ // 嵌套子菜单内层先于外层 mounted,若走 openMenu,
1136
+ // 外层展开时会把不在其 indexPath 上的内层默认展开过滤收起
1137
+ rootMenu.openedMenus.push(this.index);
1138
+ rootMenu.$nextTick(function () {
1139
+ return rootMenu.updated();
1140
+ });
1141
+ } else if (!this.open && isOpened) {
1142
+ rootMenu.closeMenu(this.index);
1143
+ }
1144
+ },
892
1145
  handleCollapseToggle: function handleCollapseToggle(value) {
893
1146
  if (value) {
894
1147
  this.initPopper();
@@ -996,6 +1249,7 @@ var poperMixins = {
996
1249
  this.parentMenu.addSubmenu(this);
997
1250
  this.rootMenu.addSubmenu(this);
998
1251
  this.initPopper();
1252
+ this.syncOpenProp();
999
1253
  },
1000
1254
  updated: function updated() {
1001
1255
  var _this5 = this;
@@ -1047,249 +1301,29 @@ var component = Object(componentNormalizer["a" /* default */])(
1047
1301
 
1048
1302
  /***/ }),
1049
1303
 
1050
- /***/ 11:
1304
+ /***/ 15:
1051
1305
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1052
1306
 
1053
1307
  "use strict";
1054
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
1055
- /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
1056
- /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
1308
+ function _broadcast(componentName, eventName, params) {
1309
+ this.$children.forEach(function (child) {
1310
+ var name = child.$options.componentName;
1057
1311
 
1312
+ if (name === componentName) {
1313
+ child.$emit.apply(child, [eventName].concat(params));
1314
+ } else {
1315
+ _broadcast.apply(child, [componentName, eventName].concat([params]));
1316
+ }
1317
+ });
1318
+ }
1319
+ /* harmony default export */ __webpack_exports__["a"] = ({
1320
+ methods: {
1321
+ dispatch: function dispatch(componentName, eventName, params) {
1322
+ var parent = this.$parent || this.$root;
1323
+ var name = parent.$options.componentName;
1058
1324
 
1059
-
1060
- var hasModal = false;
1061
- var hasInitZIndex = false;
1062
- // 跨模块副本共享的 z-index 计数器宿主。
1063
- // 低代码等场景会用 eoss / eoss/src / eoss/packages 多种身份加载本文件,
1064
- // 导致出现多份 PopupManager、各自从 2000 起算,出现“后弹出的层级反而比先弹出的小”。
1065
- // 把计数器挂到全局,所有副本共用同一条单调递增序列。
1066
- var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
1067
-
1068
- var getModal = function getModal() {
1069
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
1070
- var modalDom = PopupManager.modalDom;
1071
- if (modalDom) {
1072
- hasModal = true;
1073
- } else {
1074
- hasModal = false;
1075
- modalDom = document.createElement('div');
1076
- PopupManager.modalDom = modalDom;
1077
-
1078
- modalDom.addEventListener('touchmove', function (event) {
1079
- event.preventDefault();
1080
- event.stopPropagation();
1081
- });
1082
-
1083
- modalDom.addEventListener('click', function () {
1084
- PopupManager.doOnModalClick && PopupManager.doOnModalClick();
1085
- });
1086
- }
1087
-
1088
- return modalDom;
1089
- };
1090
-
1091
- var instances = {};
1092
-
1093
- var PopupManager = {
1094
- modalFade: true,
1095
-
1096
- getInstance: function getInstance(id) {
1097
- return instances[id];
1098
- },
1099
-
1100
- register: function register(id, instance) {
1101
- if (id && instance) {
1102
- instances[id] = instance;
1103
- }
1104
- },
1105
-
1106
- deregister: function deregister(id) {
1107
- if (id) {
1108
- instances[id] = null;
1109
- delete instances[id];
1110
- }
1111
- },
1112
-
1113
- nextZIndex: function nextZIndex() {
1114
- return PopupManager.zIndex++;
1115
- },
1116
-
1117
- modalStack: [],
1118
-
1119
- doOnModalClick: function doOnModalClick() {
1120
- var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
1121
- if (!topItem) return;
1122
-
1123
- var instance = PopupManager.getInstance(topItem.id);
1124
- if (instance && instance.closeOnClickModal) {
1125
- instance.close();
1126
- }
1127
- },
1128
-
1129
- openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
1130
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
1131
- if (!id || zIndex === undefined) return;
1132
- this.modalFade = modalFade;
1133
-
1134
- var modalStack = this.modalStack;
1135
-
1136
- for (var i = 0, j = modalStack.length; i < j; i++) {
1137
- var item = modalStack[i];
1138
- if (item.id === id) {
1139
- return;
1140
- }
1141
- }
1142
-
1143
- var modalDom = getModal();
1144
-
1145
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal');
1146
- if (this.modalFade && !hasModal) {
1147
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter');
1148
- }
1149
- if (modalClass) {
1150
- var classArr = modalClass.trim().split(/\s+/);
1151
- classArr.forEach(function (item) {
1152
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item);
1153
- });
1154
- }
1155
- setTimeout(function () {
1156
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-enter');
1157
- }, 200);
1158
-
1159
- if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
1160
- dom.parentNode.appendChild(modalDom);
1161
- } else {
1162
- document.body.appendChild(modalDom);
1163
- }
1164
-
1165
- if (zIndex) {
1166
- modalDom.style.zIndex = zIndex;
1167
- }
1168
- modalDom.tabIndex = 0;
1169
- modalDom.style.display = '';
1170
-
1171
- this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
1172
- },
1173
-
1174
- closeModal: function closeModal(id) {
1175
- var modalStack = this.modalStack;
1176
- var modalDom = getModal();
1177
- var topItem = null;
1178
-
1179
- if (modalStack.length > 0) {
1180
- topItem = modalStack[modalStack.length - 1];
1181
- if (topItem.id === id) {
1182
- modalStack.pop();
1183
- if (modalStack.length > 0) {
1184
- modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
1185
- }
1186
- } else {
1187
- for (var i = modalStack.length - 1; i >= 0; i--) {
1188
- if (modalStack[i].id === id) {
1189
- modalStack.splice(i, 1);
1190
- break;
1191
- }
1192
- }
1193
- }
1194
- }
1195
-
1196
- if (modalStack.length === 0) {
1197
- if (this.modalFade) {
1198
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave');
1199
- }
1200
- setTimeout(function () {
1201
- if (modalStack.length === 0) {
1202
- if (topItem && topItem.modalClass) {
1203
- var classArr = topItem.modalClass.trim().split(/\s+/);
1204
- classArr.forEach(function (item) {
1205
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
1206
- });
1207
- }
1208
- if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
1209
- modalDom.style.display = 'none';
1210
- PopupManager.modalDom = undefined;
1211
- }
1212
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-leave');
1213
- }, 200);
1214
- } else {
1215
- if (topItem && topItem.modalClass) {
1216
- var classArr = topItem.modalClass.trim().split(/\s+/);
1217
- classArr.forEach(function (item) {
1218
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
1219
- });
1220
- }
1221
- }
1222
- }
1223
- };
1224
-
1225
- Object.defineProperty(PopupManager, 'zIndex', {
1226
- configurable: true,
1227
- get: function get() {
1228
- if (!hasInitZIndex) {
1229
- if (globalScope.__EOSS_ZINDEX__ === undefined) {
1230
- globalScope.__EOSS_ZINDEX__ = (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$EOSS || {}).zIndex || 2000;
1231
- }
1232
- hasInitZIndex = true;
1233
- }
1234
- return globalScope.__EOSS_ZINDEX__;
1235
- },
1236
- set: function set(value) {
1237
- globalScope.__EOSS_ZINDEX__ = value;
1238
- }
1239
- });
1240
-
1241
- var getTopPopup = function getTopPopup() {
1242
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
1243
- if (PopupManager.modalStack.length > 0) {
1244
- var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
1245
- if (!topPopup) return;
1246
- var instance = PopupManager.getInstance(topPopup.id);
1247
-
1248
- return instance;
1249
- }
1250
- };
1251
-
1252
- if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
1253
- // handle `esc` key when the popup is shown
1254
- window.addEventListener('keydown', function (event) {
1255
- if (event.keyCode === 27) {
1256
- var topPopup = getTopPopup();
1257
-
1258
- if (topPopup && topPopup.closeOnPressEscape) {
1259
- topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
1260
- }
1261
- }
1262
- });
1263
- }
1264
-
1265
- /* harmony default export */ __webpack_exports__["a"] = (PopupManager);
1266
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(45)))
1267
-
1268
- /***/ }),
1269
-
1270
- /***/ 15:
1271
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1272
-
1273
- "use strict";
1274
- function _broadcast(componentName, eventName, params) {
1275
- this.$children.forEach(function (child) {
1276
- var name = child.$options.componentName;
1277
-
1278
- if (name === componentName) {
1279
- child.$emit.apply(child, [eventName].concat(params));
1280
- } else {
1281
- _broadcast.apply(child, [componentName, eventName].concat([params]));
1282
- }
1283
- });
1284
- }
1285
- /* harmony default export */ __webpack_exports__["a"] = ({
1286
- methods: {
1287
- dispatch: function dispatch(componentName, eventName, params) {
1288
- var parent = this.$parent || this.$root;
1289
- var name = parent.$options.componentName;
1290
-
1291
- while (parent && (!name || name !== componentName)) {
1292
- parent = parent.$parent;
1325
+ while (parent && (!name || name !== componentName)) {
1326
+ parent = parent.$parent;
1293
1327
 
1294
1328
  if (parent) {
1295
1329
  name = parent.$options.componentName;
@@ -1307,12 +1341,12 @@ function _broadcast(componentName, eventName, params) {
1307
1341
 
1308
1342
  /***/ }),
1309
1343
 
1310
- /***/ 178:
1344
+ /***/ 185:
1311
1345
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
1312
1346
 
1313
1347
  "use strict";
1314
1348
  __webpack_require__.r(__webpack_exports__);
1315
- /* harmony import */ var _menu_src_submenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(108);
1349
+ /* harmony import */ var _menu_src_submenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(110);
1316
1350
 
1317
1351
 
1318
1352
  /* istanbul ignore next */
@@ -1515,7 +1549,7 @@ module.exports = require("eoss/lib/icon");
1515
1549
 
1516
1550
 
1517
1551
 
1518
- var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(52);
1552
+ var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(53);
1519
1553
  var stopPropagation = function stopPropagation(e) {
1520
1554
  return e.stopPropagation();
1521
1555
  };
@@ -2422,10 +2456,12 @@ function insertAfter(newEl, targetEl) {
2422
2456
 
2423
2457
  /***/ }),
2424
2458
 
2425
- /***/ 52:
2459
+ /***/ 53:
2426
2460
  /***/ (function(module, exports, __webpack_require__) {
2427
2461
 
2428
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
2462
+ 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; };
2463
+
2464
+ /**
2429
2465
  * @fileOverview Kickass library to create and place poppers near their reference elements.
2430
2466
  * @version {{version}}
2431
2467
  * @license
@@ -2448,68 +2484,60 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
2448
2484
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2449
2485
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2450
2486
  * SOFTWARE.
2451
- */
2452
-
2453
- //
2454
- // Cross module loader
2455
- // Supported: Node, AMD, Browser globals
2456
- //
2457
- (function (root, factory) {
2458
- if (true) {
2459
- // AMD. Register as an anonymous module.
2487
+ */
2488
+
2489
+ //
2490
+ // Cross module loader
2491
+ // Supported: Node, AMD, Browser globals
2492
+ //
2493
+ (function (root, factory) {
2494
+ if (true) {
2495
+ // AMD. Register as an anonymous module.
2460
2496
  !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
2461
2497
  __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
2462
2498
  (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
2463
2499
  __WEBPACK_AMD_DEFINE_FACTORY__),
2464
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2465
- } else {}
2466
- })(this, function () {
2467
- 'use strict';
2468
-
2469
- var root = window;
2470
- // default options
2471
- var DEFAULTS = {
2472
- // placement of the popper
2473
- placement: 'bottom',
2474
-
2475
- gpuAcceleration: true,
2476
-
2477
- // shift popper from its origin by the given amount of pixels (can be negative)
2478
- offset: 0,
2479
-
2480
- // the element which will act as boundary of the popper
2481
- boundariesElement: 'viewport',
2482
-
2483
- // amount of pixel used to define a minimum distance between the boundaries and the popper
2484
- boundariesPadding: 5,
2485
-
2486
- // popper will try to prevent overflow following this order,
2487
- // by default, then, it could overflow on the left and on top of the boundariesElement
2488
- preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
2489
-
2490
- // the behavior used by flip to change the placement of the popper
2491
- flipBehavior: 'flip',
2492
-
2493
- arrowElement: '[x-arrow]',
2494
-
2495
- arrowOffset: 0,
2496
-
2497
- // list of functions used to modify the offsets before they are applied to the popper
2498
- modifiers: [
2499
- 'shift',
2500
- 'offset',
2501
- 'preventOverflow',
2502
- 'keepTogether',
2503
- 'arrow',
2504
- 'flip',
2505
- 'applyStyle'
2506
- ],
2507
-
2508
- modifiersIgnored: [],
2509
-
2510
- forceAbsolute: false
2511
- };
2512
-
2500
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2501
+ } else {}
2502
+ })(this, function () {
2503
+ 'use strict';
2504
+
2505
+ var root = window;
2506
+ // default options
2507
+ var DEFAULTS = {
2508
+ // placement of the popper
2509
+ placement: 'bottom',
2510
+
2511
+ gpuAcceleration: true,
2512
+
2513
+ // shift popper from its origin by the given amount of pixels (can be negative)
2514
+ offset: 0,
2515
+
2516
+ // the element which will act as boundary of the popper
2517
+ boundariesElement: 'viewport',
2518
+
2519
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
2520
+ boundariesPadding: 5,
2521
+
2522
+ // popper will try to prevent overflow following this order,
2523
+ // by default, then, it could overflow on the left and on top of the boundariesElement
2524
+ preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
2525
+
2526
+ // the behavior used by flip to change the placement of the popper
2527
+ flipBehavior: 'flip',
2528
+
2529
+ arrowElement: '[x-arrow]',
2530
+
2531
+ arrowOffset: 0,
2532
+
2533
+ // list of functions used to modify the offsets before they are applied to the popper
2534
+ modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
2535
+
2536
+ modifiersIgnored: [],
2537
+
2538
+ forceAbsolute: false
2539
+ };
2540
+
2513
2541
  /**
2514
2542
  * Create a new Popper.js instance
2515
2543
  * @constructor Popper
@@ -2574,125 +2602,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
2574
2602
  *
2575
2603
  * @param {Boolean} [options.removeOnDestroy=false]
2576
2604
  * Set to true if you want to automatically remove the popper when you call the `destroy` method.
2577
- */
2578
- function Popper(reference, popper, options) {
2579
- this._reference = reference.jquery ? reference[0] : reference;
2580
- this.state = {};
2581
-
2582
- // if the popper variable is a configuration object, parse it to generate an HTMLElement
2583
- // generate a default popper if is not defined
2584
- var isNotDefined = typeof popper === 'undefined' || popper === null;
2585
- var isConfig =
2586
- popper && Object.prototype.toString.call(popper) === '[object Object]';
2587
- if (isNotDefined || isConfig) {
2588
- this._popper = this.parse(isConfig ? popper : {});
2589
- }
2590
- // otherwise, use the given HTMLElement as popper
2591
- else {
2592
- this._popper = popper.jquery ? popper[0] : popper;
2593
- }
2594
-
2595
- // with {} we create a new object with the options inside it
2596
- this._options = Object.assign({}, DEFAULTS, options);
2597
-
2598
- // refactoring modifiers' list
2599
- this._options.modifiers = this._options.modifiers.map(
2600
- function (modifier) {
2601
- // remove ignored modifiers
2602
- if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
2603
-
2604
- // set the x-placement attribute before everything else because it could be used to add margins to the popper
2605
- // margins needs to be calculated to get the correct popper offsets
2606
- if (modifier === 'applyStyle') {
2607
- this._popper.setAttribute('x-placement', this._options.placement);
2608
- }
2609
-
2610
- // return predefined modifier identified by string or keep the custom one
2611
- return this.modifiers[modifier] || modifier;
2612
- }.bind(this)
2613
- );
2614
-
2615
- // make sure to apply the popper position before any computation
2616
- this.state.position = this._getPosition(this._popper, this._reference);
2617
- setStyle(this._popper, { position: this.state.position, top: 0 });
2618
-
2619
- // fire the first update to position the popper in the right place
2620
- this.update();
2621
-
2622
- // setup event listeners, they will take care of update the position in specific situations
2623
- this._setupEventListeners();
2624
- return this;
2625
- }
2626
-
2627
- //
2628
- // Methods
2629
- //
2605
+ */
2606
+ function Popper(reference, popper, options) {
2607
+ this._reference = reference.jquery ? reference[0] : reference;
2608
+ this.state = {};
2609
+
2610
+ // if the popper variable is a configuration object, parse it to generate an HTMLElement
2611
+ // generate a default popper if is not defined
2612
+ var isNotDefined = typeof popper === 'undefined' || popper === null;
2613
+ var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
2614
+ if (isNotDefined || isConfig) {
2615
+ this._popper = this.parse(isConfig ? popper : {});
2616
+ }
2617
+ // otherwise, use the given HTMLElement as popper
2618
+ else {
2619
+ this._popper = popper.jquery ? popper[0] : popper;
2620
+ }
2621
+
2622
+ // with {} we create a new object with the options inside it
2623
+ this._options = Object.assign({}, DEFAULTS, options);
2624
+
2625
+ // refactoring modifiers' list
2626
+ this._options.modifiers = this._options.modifiers.map(function (modifier) {
2627
+ // remove ignored modifiers
2628
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
2629
+
2630
+ // set the x-placement attribute before everything else because it could be used to add margins to the popper
2631
+ // margins needs to be calculated to get the correct popper offsets
2632
+ if (modifier === 'applyStyle') {
2633
+ this._popper.setAttribute('x-placement', this._options.placement);
2634
+ }
2635
+
2636
+ // return predefined modifier identified by string or keep the custom one
2637
+ return this.modifiers[modifier] || modifier;
2638
+ }.bind(this));
2639
+
2640
+ // make sure to apply the popper position before any computation
2641
+ this.state.position = this._getPosition(this._popper, this._reference);
2642
+ setStyle(this._popper, { position: this.state.position, top: 0 });
2643
+
2644
+ // fire the first update to position the popper in the right place
2645
+ this.update();
2646
+
2647
+ // setup event listeners, they will take care of update the position in specific situations
2648
+ this._setupEventListeners();
2649
+ return this;
2650
+ }
2651
+
2652
+ //
2653
+ // Methods
2654
+ //
2630
2655
  /**
2631
2656
  * Destroy the popper
2632
2657
  * @method
2633
2658
  * @memberof Popper
2634
- */
2635
- Popper.prototype.destroy = function () {
2636
- this._popper.removeAttribute('x-placement');
2637
- this._popper.style.left = '';
2638
- this._popper.style.position = '';
2639
- this._popper.style.top = '';
2640
- this._popper.style[getSupportedPropertyName('transform')] = '';
2641
- this._removeEventListeners();
2642
-
2643
- // remove the popper if user explicity asked for the deletion on destroy
2644
- if (this._options.removeOnDestroy) {
2645
- this._popper.remove();
2646
- }
2647
- return this;
2648
- };
2649
-
2659
+ */
2660
+ Popper.prototype.destroy = function () {
2661
+ this._popper.removeAttribute('x-placement');
2662
+ this._popper.style.left = '';
2663
+ this._popper.style.position = '';
2664
+ this._popper.style.top = '';
2665
+ this._popper.style[getSupportedPropertyName('transform')] = '';
2666
+ this._removeEventListeners();
2667
+
2668
+ // remove the popper if user explicity asked for the deletion on destroy
2669
+ if (this._options.removeOnDestroy) {
2670
+ this._popper.remove();
2671
+ }
2672
+ return this;
2673
+ };
2674
+
2650
2675
  /**
2651
2676
  * Updates the position of the popper, computing the new offsets and applying the new style
2652
2677
  * @method
2653
2678
  * @memberof Popper
2654
- */
2655
- Popper.prototype.update = function () {
2656
- var data = { instance: this, styles: {} };
2657
-
2658
- // store placement inside the data object, modifiers will be able to edit `placement` if needed
2659
- // and refer to _originalPlacement to know the original value
2660
- data.placement = this._options.placement;
2661
- data._originalPlacement = this._options.placement;
2662
-
2663
- // compute the popper and reference offsets and put them inside data.offsets
2664
- data.offsets = this._getOffsets(
2665
- this._popper,
2666
- this._reference,
2667
- data.placement
2668
- );
2669
-
2670
- // get boundaries
2671
- data.boundaries = this._getBoundaries(
2672
- data,
2673
- this._options.boundariesPadding,
2674
- this._options.boundariesElement
2675
- );
2676
-
2677
- data = this.runModifiers(data, this._options.modifiers);
2678
-
2679
- if (typeof this.state.updateCallback === 'function') {
2680
- this.state.updateCallback(data);
2681
- }
2682
- };
2683
-
2679
+ */
2680
+ Popper.prototype.update = function () {
2681
+ var data = { instance: this, styles: {} };
2682
+
2683
+ // store placement inside the data object, modifiers will be able to edit `placement` if needed
2684
+ // and refer to _originalPlacement to know the original value
2685
+ data.placement = this._options.placement;
2686
+ data._originalPlacement = this._options.placement;
2687
+
2688
+ // compute the popper and reference offsets and put them inside data.offsets
2689
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
2690
+
2691
+ // get boundaries
2692
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
2693
+
2694
+ data = this.runModifiers(data, this._options.modifiers);
2695
+
2696
+ if (typeof this.state.updateCallback === 'function') {
2697
+ this.state.updateCallback(data);
2698
+ }
2699
+ };
2700
+
2684
2701
  /**
2685
2702
  * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
2686
2703
  * @method
2687
2704
  * @memberof Popper
2688
2705
  * @param {Function} callback
2689
- */
2690
- Popper.prototype.onCreate = function (callback) {
2691
- // the createCallbacks return as first argument the popper instance
2692
- callback(this);
2693
- return this;
2694
- };
2695
-
2706
+ */
2707
+ Popper.prototype.onCreate = function (callback) {
2708
+ // the createCallbacks return as first argument the popper instance
2709
+ callback(this);
2710
+ return this;
2711
+ };
2712
+
2696
2713
  /**
2697
2714
  * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
2698
2715
  * used to style popper and its arrow.
@@ -2700,101 +2717,93 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
2700
2717
  * @method
2701
2718
  * @memberof Popper
2702
2719
  * @param {Function} callback
2703
- */
2704
- Popper.prototype.onUpdate = function (callback) {
2705
- this.state.updateCallback = callback;
2706
- return this;
2707
- };
2708
-
2720
+ */
2721
+ Popper.prototype.onUpdate = function (callback) {
2722
+ this.state.updateCallback = callback;
2723
+ return this;
2724
+ };
2725
+
2709
2726
  /**
2710
2727
  * Helper used to generate poppers from a configuration file
2711
2728
  * @method
2712
2729
  * @memberof Popper
2713
2730
  * @param config {Object} configuration
2714
2731
  * @returns {HTMLElement} popper
2715
- */
2716
- Popper.prototype.parse = function (config) {
2717
- var defaultConfig = {
2718
- tagName: 'div',
2719
- classNames: ['popper'],
2720
- attributes: [],
2721
- parent: root.document.body,
2722
- content: '',
2723
- contentType: 'text',
2724
- arrowTagName: 'div',
2725
- arrowClassNames: ['popper__arrow'],
2726
- arrowAttributes: ['x-arrow']
2727
- };
2728
- config = Object.assign({}, defaultConfig, config);
2729
-
2730
- var d = root.document;
2731
-
2732
- var popper = d.createElement(config.tagName);
2733
- addClassNames(popper, config.classNames);
2734
- addAttributes(popper, config.attributes);
2735
- if (config.contentType === 'node') {
2736
- popper.appendChild(
2737
- config.content.jquery ? config.content[0] : config.content
2738
- );
2739
- } else if (config.contentType === 'html') {
2740
- popper.innerHTML = config.content;
2741
- } else {
2742
- popper.textContent = config.content;
2743
- }
2744
-
2745
- if (config.arrowTagName) {
2746
- var arrow = d.createElement(config.arrowTagName);
2747
- addClassNames(arrow, config.arrowClassNames);
2748
- addAttributes(arrow, config.arrowAttributes);
2749
- popper.appendChild(arrow);
2750
- }
2751
-
2752
- var parent = config.parent.jquery ? config.parent[0] : config.parent;
2753
-
2754
- // if the given parent is a string, use it to match an element
2755
- // if more than one element is matched, the first one will be used as parent
2756
- // if no elements are matched, the script will throw an error
2757
- if (typeof parent === 'string') {
2758
- parent = d.querySelectorAll(config.parent);
2759
- if (parent.length > 1) {
2760
- console.warn(
2761
- 'WARNING: the given `parent` query(' +
2762
- config.parent +
2763
- ') matched more than one element, the first one will be used'
2764
- );
2765
- }
2766
- if (parent.length === 0) {
2767
- throw "ERROR: the given `parent` doesn't exists!";
2768
- }
2769
- parent = parent[0];
2770
- }
2771
- // if the given parent is a DOM nodes list or an array of nodes with more than one element,
2772
- // the first one will be used as parent
2773
- if (parent.length > 1 && parent instanceof Element === false) {
2774
- console.warn(
2775
- 'WARNING: you have passed as parent a list of elements, the first one will be used'
2776
- );
2777
- parent = parent[0];
2778
- }
2779
-
2780
- // append the generated popper to its parent
2781
- parent.appendChild(popper);
2782
-
2783
- return popper;
2784
-
2732
+ */
2733
+ Popper.prototype.parse = function (config) {
2734
+ var defaultConfig = {
2735
+ tagName: 'div',
2736
+ classNames: ['popper'],
2737
+ attributes: [],
2738
+ parent: root.document.body,
2739
+ content: '',
2740
+ contentType: 'text',
2741
+ arrowTagName: 'div',
2742
+ arrowClassNames: ['popper__arrow'],
2743
+ arrowAttributes: ['x-arrow']
2744
+ };
2745
+ config = Object.assign({}, defaultConfig, config);
2746
+
2747
+ var d = root.document;
2748
+
2749
+ var popper = d.createElement(config.tagName);
2750
+ addClassNames(popper, config.classNames);
2751
+ addAttributes(popper, config.attributes);
2752
+ if (config.contentType === 'node') {
2753
+ popper.appendChild(config.content.jquery ? config.content[0] : config.content);
2754
+ } else if (config.contentType === 'html') {
2755
+ popper.innerHTML = config.content;
2756
+ } else {
2757
+ popper.textContent = config.content;
2758
+ }
2759
+
2760
+ if (config.arrowTagName) {
2761
+ var arrow = d.createElement(config.arrowTagName);
2762
+ addClassNames(arrow, config.arrowClassNames);
2763
+ addAttributes(arrow, config.arrowAttributes);
2764
+ popper.appendChild(arrow);
2765
+ }
2766
+
2767
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
2768
+
2769
+ // if the given parent is a string, use it to match an element
2770
+ // if more than one element is matched, the first one will be used as parent
2771
+ // if no elements are matched, the script will throw an error
2772
+ if (typeof parent === 'string') {
2773
+ parent = d.querySelectorAll(config.parent);
2774
+ if (parent.length > 1) {
2775
+ console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
2776
+ }
2777
+ if (parent.length === 0) {
2778
+ throw "ERROR: the given `parent` doesn't exists!";
2779
+ }
2780
+ parent = parent[0];
2781
+ }
2782
+ // if the given parent is a DOM nodes list or an array of nodes with more than one element,
2783
+ // the first one will be used as parent
2784
+ if (parent.length > 1 && parent instanceof Element === false) {
2785
+ console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
2786
+ parent = parent[0];
2787
+ }
2788
+
2789
+ // append the generated popper to its parent
2790
+ parent.appendChild(popper);
2791
+
2792
+ return popper;
2793
+
2785
2794
  /**
2786
2795
  * Adds class names to the given element
2787
2796
  * @function
2788
2797
  * @ignore
2789
2798
  * @param {HTMLElement} target
2790
2799
  * @param {Array} classes
2791
- */
2792
- function addClassNames(element, classNames) {
2793
- classNames.forEach(function (className) {
2794
- element.classList.add(className);
2795
- });
2796
- }
2797
-
2800
+ */
2801
+ function addClassNames(element, classNames) {
2802
+ classNames.forEach(function (className) {
2803
+ element.classList.add(className);
2804
+ });
2805
+ }
2806
+
2798
2807
  /**
2799
2808
  * Adds attributes to the given element
2800
2809
  * @function
@@ -2803,17 +2812,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
2803
2812
  * @param {Array} attributes
2804
2813
  * @example
2805
2814
  * addAttributes(element, [ 'data-info:foobar' ]);
2806
- */
2807
- function addAttributes(element, attributes) {
2808
- attributes.forEach(function (attribute) {
2809
- element.setAttribute(
2810
- attribute.split(':')[0],
2811
- attribute.split(':')[1] || ''
2812
- );
2813
- });
2814
- }
2815
- };
2816
-
2815
+ */
2816
+ function addAttributes(element, attributes) {
2817
+ attributes.forEach(function (attribute) {
2818
+ element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
2819
+ });
2820
+ }
2821
+ };
2822
+
2817
2823
  /**
2818
2824
  * Helper used to get the position which will be applied to the popper
2819
2825
  * @method
@@ -2821,20 +2827,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
2821
2827
  * @param config {HTMLElement} popper element
2822
2828
  * @param reference {HTMLElement} reference element
2823
2829
  * @returns {String} position
2824
- */
2825
- Popper.prototype._getPosition = function (popper, reference) {
2826
- var container = getOffsetParent(reference);
2827
-
2828
- if (this._options.forceAbsolute) {
2829
- return 'absolute';
2830
- }
2831
-
2832
- // Decide if the popper will be fixed
2833
- // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
2834
- var isParentFixed = isFixed(reference, container);
2835
- return isParentFixed ? 'fixed' : 'absolute';
2836
- };
2837
-
2830
+ */
2831
+ Popper.prototype._getPosition = function (popper, reference) {
2832
+ var container = getOffsetParent(reference);
2833
+
2834
+ if (this._options.forceAbsolute) {
2835
+ return 'absolute';
2836
+ }
2837
+
2838
+ // Decide if the popper will be fixed
2839
+ // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
2840
+ var isParentFixed = isFixed(reference, container);
2841
+ return isParentFixed ? 'fixed' : 'absolute';
2842
+ };
2843
+
2838
2844
  /**
2839
2845
  * Get offsets to the popper
2840
2846
  * @method
@@ -2843,110 +2849,91 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
2843
2849
  * @param {Element} popper - the popper element
2844
2850
  * @param {Element} reference - the reference element (the popper will be relative to this)
2845
2851
  * @returns {Object} An object containing the offsets which will be applied to the popper
2846
- */
2847
- Popper.prototype._getOffsets = function (popper, reference, placement) {
2848
- placement = placement.split('-')[0];
2849
- var popperOffsets = {};
2850
-
2851
- popperOffsets.position = this.state.position;
2852
- var isParentFixed = popperOffsets.position === 'fixed';
2853
-
2854
- //
2855
- // Get reference element position
2856
- //
2857
- var referenceOffsets = getOffsetRectRelativeToCustomParent(
2858
- reference,
2859
- popper,
2860
- isParentFixed
2861
- );
2862
-
2863
- //
2864
- // Get popper sizes
2865
- //
2866
- var popperRect = getOuterSizes(popper);
2867
-
2868
- //
2869
- // Compute offsets of popper
2870
- //
2871
-
2872
- // depending by the popper placement we have to compute its offsets slightly differently
2873
- if (['right', 'left'].indexOf(placement) !== -1) {
2874
- popperOffsets.top =
2875
- referenceOffsets.top +
2876
- referenceOffsets.height / 2 -
2877
- popperRect.height / 2;
2878
- if (placement === 'left') {
2879
- popperOffsets.left = referenceOffsets.left - popperRect.width;
2880
- } else {
2881
- popperOffsets.left = referenceOffsets.right;
2882
- }
2883
- } else {
2884
- popperOffsets.left =
2885
- referenceOffsets.left +
2886
- referenceOffsets.width / 2 -
2887
- popperRect.width / 2;
2888
- if (placement === 'top') {
2889
- popperOffsets.top = referenceOffsets.top - popperRect.height;
2890
- } else {
2891
- popperOffsets.top = referenceOffsets.bottom;
2892
- }
2893
- }
2894
-
2895
- // Add width and height to our offsets object
2896
- popperOffsets.width = popperRect.width;
2897
- popperOffsets.height = popperRect.height;
2898
-
2899
- return {
2900
- popper: popperOffsets,
2901
- reference: referenceOffsets
2902
- };
2903
- };
2904
-
2852
+ */
2853
+ Popper.prototype._getOffsets = function (popper, reference, placement) {
2854
+ placement = placement.split('-')[0];
2855
+ var popperOffsets = {};
2856
+
2857
+ popperOffsets.position = this.state.position;
2858
+ var isParentFixed = popperOffsets.position === 'fixed';
2859
+
2860
+ //
2861
+ // Get reference element position
2862
+ //
2863
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, popper, isParentFixed);
2864
+
2865
+ //
2866
+ // Get popper sizes
2867
+ //
2868
+ var popperRect = getOuterSizes(popper);
2869
+
2870
+ //
2871
+ // Compute offsets of popper
2872
+ //
2873
+
2874
+ // depending by the popper placement we have to compute its offsets slightly differently
2875
+ if (['right', 'left'].indexOf(placement) !== -1) {
2876
+ popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
2877
+ if (placement === 'left') {
2878
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
2879
+ } else {
2880
+ popperOffsets.left = referenceOffsets.right;
2881
+ }
2882
+ } else {
2883
+ popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
2884
+ if (placement === 'top') {
2885
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
2886
+ } else {
2887
+ popperOffsets.top = referenceOffsets.bottom;
2888
+ }
2889
+ }
2890
+
2891
+ // Add width and height to our offsets object
2892
+ popperOffsets.width = popperRect.width;
2893
+ popperOffsets.height = popperRect.height;
2894
+
2895
+ return {
2896
+ popper: popperOffsets,
2897
+ reference: referenceOffsets
2898
+ };
2899
+ };
2900
+
2905
2901
  /**
2906
2902
  * Setup needed event listeners used to update the popper position
2907
2903
  * @method
2908
2904
  * @memberof Popper
2909
2905
  * @access private
2910
- */
2911
- Popper.prototype._setupEventListeners = function () {
2912
- // NOTE: 1 DOM access here
2913
- this.state.updateBound = this.update.bind(this);
2914
- // 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
2915
- this.state.realWindow = getRealWindow(this._popper);
2916
- this.state.realWindow.addEventListener('resize', this.state.updateBound);
2917
- // if the boundariesElement is window we don't need to listen for the scroll event
2918
- if (this._options.boundariesElement !== 'window') {
2919
- var target = getScrollParent(this._reference);
2920
- target.addEventListener('scroll', this.state.updateBound);
2921
- this.state.scrollTarget = target;
2922
- }
2923
- };
2924
-
2906
+ */
2907
+ Popper.prototype._setupEventListeners = function () {
2908
+ // NOTE: 1 DOM access here
2909
+ this.state.updateBound = this.update.bind(this);
2910
+ // 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
2911
+ this.state.realWindow = getRealWindow(this._popper);
2912
+ this.state.realWindow.addEventListener('resize', this.state.updateBound);
2913
+ // if the boundariesElement is window we don't need to listen for the scroll event
2914
+ if (this._options.boundariesElement !== 'window') {
2915
+ var target = getScrollParent(this._reference);
2916
+ target.addEventListener('scroll', this.state.updateBound);
2917
+ this.state.scrollTarget = target;
2918
+ }
2919
+ };
2920
+
2925
2921
  /**
2926
2922
  * Remove event listeners used to update the popper position
2927
2923
  * @method
2928
2924
  * @memberof Popper
2929
2925
  * @access private
2930
- */
2931
- Popper.prototype._removeEventListeners = function () {
2932
- // NOTE: 1 DOM access here
2933
- (this.state.realWindow || root).removeEventListener(
2934
- 'resize',
2935
- this.state.updateBound
2936
- );
2937
- if (
2938
- this._options.boundariesElement !== 'window' &&
2939
- this.state.scrollTarget
2940
- ) {
2941
- this.state.scrollTarget.removeEventListener(
2942
- 'scroll',
2943
- this.state.updateBound
2944
- );
2945
- this.state.scrollTarget = null;
2946
- }
2947
- this.state.updateBound = null;
2948
- };
2949
-
2926
+ */
2927
+ Popper.prototype._removeEventListeners = function () {
2928
+ // NOTE: 1 DOM access here
2929
+ (this.state.realWindow || root).removeEventListener('resize', this.state.updateBound);
2930
+ if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
2931
+ this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
2932
+ this.state.scrollTarget = null;
2933
+ }
2934
+ this.state.updateBound = null;
2935
+ };
2936
+
2950
2937
  /**
2951
2938
  * Computed the boundaries limits and return them
2952
2939
  * @method
@@ -2956,75 +2943,56 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
2956
2943
  * @param {Number} padding - Boundaries padding
2957
2944
  * @param {Element} boundariesElement - Element used to define the boundaries
2958
2945
  * @returns {Object} Coordinates of the boundaries
2959
- */
2960
- Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
2961
- // NOTE: 1 DOM access here
2962
- var boundaries = {};
2963
- var width, height;
2964
- if (boundariesElement === 'window') {
2965
- var body = root.document.body,
2966
- html = root.document.documentElement;
2967
-
2968
- height = Math.max(
2969
- body.scrollHeight,
2970
- body.offsetHeight,
2971
- html.clientHeight,
2972
- html.scrollHeight,
2973
- html.offsetHeight
2974
- );
2975
- width = Math.max(
2976
- body.scrollWidth,
2977
- body.offsetWidth,
2978
- html.clientWidth,
2979
- html.scrollWidth,
2980
- html.offsetWidth
2981
- );
2982
-
2983
- boundaries = {
2984
- top: 0,
2985
- right: width,
2986
- bottom: height,
2987
- left: 0
2988
- };
2989
- } else if (boundariesElement === 'viewport') {
2990
- // 将真实 window 的视口换算到 popper 所在包含块的坐标系。
2991
- // 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
2992
- // 统一从元素自身的 view 与真实包含块获取
2993
- var realWindow = getRealWindow(this._popper);
2994
- var containingBlockRect = getContainingBlockRect(
2995
- this._popper,
2996
- data.offsets.popper.position === 'fixed'
2997
- );
2998
-
2999
- boundaries = {
3000
- top: 0 - containingBlockRect.top,
3001
- right:
3002
- realWindow.document.documentElement.clientWidth -
3003
- containingBlockRect.left,
3004
- bottom:
3005
- realWindow.document.documentElement.clientHeight -
3006
- containingBlockRect.top,
3007
- left: 0 - containingBlockRect.left
3008
- };
3009
- } else {
3010
- if (getOffsetParent(this._popper) === boundariesElement) {
3011
- boundaries = {
3012
- top: 0,
3013
- left: 0,
3014
- right: boundariesElement.clientWidth,
3015
- bottom: boundariesElement.clientHeight
3016
- };
3017
- } else {
3018
- boundaries = getOffsetRect(boundariesElement);
3019
- }
3020
- }
3021
- boundaries.left += padding;
3022
- boundaries.right -= padding;
3023
- boundaries.top = boundaries.top + padding;
3024
- boundaries.bottom = boundaries.bottom - padding;
3025
- return boundaries;
3026
- };
3027
-
2946
+ */
2947
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
2948
+ // NOTE: 1 DOM access here
2949
+ var boundaries = {};
2950
+ var width, height;
2951
+ if (boundariesElement === 'window') {
2952
+ var body = root.document.body,
2953
+ html = root.document.documentElement;
2954
+
2955
+ height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
2956
+ width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
2957
+
2958
+ boundaries = {
2959
+ top: 0,
2960
+ right: width,
2961
+ bottom: height,
2962
+ left: 0
2963
+ };
2964
+ } else if (boundariesElement === 'viewport') {
2965
+ // 将真实 window 的视口换算到 popper 所在包含块的坐标系。
2966
+ // 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
2967
+ // 统一从元素自身的 view 与真实包含块获取
2968
+ var realWindow = getRealWindow(this._popper);
2969
+ var containingBlockRect = getContainingBlockRect(this._popper, data.offsets.popper.position === 'fixed');
2970
+
2971
+ boundaries = {
2972
+ top: 0 - containingBlockRect.top,
2973
+ right: realWindow.document.documentElement.clientWidth - containingBlockRect.left,
2974
+ bottom: realWindow.document.documentElement.clientHeight - containingBlockRect.top,
2975
+ left: 0 - containingBlockRect.left
2976
+ };
2977
+ } else {
2978
+ if (getOffsetParent(this._popper) === boundariesElement) {
2979
+ boundaries = {
2980
+ top: 0,
2981
+ left: 0,
2982
+ right: boundariesElement.clientWidth,
2983
+ bottom: boundariesElement.clientHeight
2984
+ };
2985
+ } else {
2986
+ boundaries = getOffsetRect(boundariesElement);
2987
+ }
2988
+ }
2989
+ boundaries.left += padding;
2990
+ boundaries.right -= padding;
2991
+ boundaries.top = boundaries.top + padding;
2992
+ boundaries.bottom = boundaries.bottom - padding;
2993
+ return boundaries;
2994
+ };
2995
+
3028
2996
  /**
3029
2997
  * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
3030
2998
  * @method
@@ -3033,27 +3001,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3033
3001
  * @param {Object} data
3034
3002
  * @param {Array} modifiers
3035
3003
  * @param {Function} ends
3036
- */
3037
- Popper.prototype.runModifiers = function (data, modifiers, ends) {
3038
- var modifiersToRun = modifiers.slice();
3039
- if (ends !== undefined) {
3040
- modifiersToRun = this._options.modifiers.slice(
3041
- 0,
3042
- getArrayKeyIndex(this._options.modifiers, ends)
3043
- );
3044
- }
3045
-
3046
- modifiersToRun.forEach(
3047
- function (modifier) {
3048
- if (isFunction(modifier)) {
3049
- data = modifier.call(this, data);
3050
- }
3051
- }.bind(this)
3052
- );
3053
-
3054
- return data;
3055
- };
3056
-
3004
+ */
3005
+ Popper.prototype.runModifiers = function (data, modifiers, ends) {
3006
+ var modifiersToRun = modifiers.slice();
3007
+ if (ends !== undefined) {
3008
+ modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
3009
+ }
3010
+
3011
+ modifiersToRun.forEach(function (modifier) {
3012
+ if (isFunction(modifier)) {
3013
+ data = modifier.call(this, data);
3014
+ }
3015
+ }.bind(this));
3016
+
3017
+ return data;
3018
+ };
3019
+
3057
3020
  /**
3058
3021
  * Helper used to know if the given modifier depends from another one.
3059
3022
  * @method
@@ -3061,204 +3024,191 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3061
3024
  * @param {String} requesting - name of requesting modifier
3062
3025
  * @param {String} requested - name of requested modifier
3063
3026
  * @returns {Boolean}
3064
- */
3065
- Popper.prototype.isModifierRequired = function (requesting, requested) {
3066
- var index = getArrayKeyIndex(this._options.modifiers, requesting);
3067
- return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
3068
- return modifier === requested;
3069
- }).length;
3070
- };
3071
-
3072
- //
3073
- // Modifiers
3074
- //
3075
-
3027
+ */
3028
+ Popper.prototype.isModifierRequired = function (requesting, requested) {
3029
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
3030
+ return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
3031
+ return modifier === requested;
3032
+ }).length;
3033
+ };
3034
+
3035
+ //
3036
+ // Modifiers
3037
+ //
3038
+
3076
3039
  /**
3077
3040
  * Modifiers list
3078
3041
  * @namespace Popper.modifiers
3079
3042
  * @memberof Popper
3080
3043
  * @type {Object}
3081
- */
3082
- Popper.prototype.modifiers = {};
3083
-
3044
+ */
3045
+ Popper.prototype.modifiers = {};
3046
+
3084
3047
  /**
3085
3048
  * Apply the computed styles to the popper element
3086
3049
  * @method
3087
3050
  * @memberof Popper.modifiers
3088
3051
  * @argument {Object} data - The data object generated by `update` method
3089
3052
  * @returns {Object} The same data object
3090
- */
3091
- Popper.prototype.modifiers.applyStyle = function (data) {
3092
- // apply the final offsets to the popper
3093
- // NOTE: 1 DOM access here
3094
- var styles = {
3095
- position: data.offsets.popper.position
3096
- };
3097
-
3098
- // round top and left to avoid blurry text
3099
- var left = Math.round(data.offsets.popper.left);
3100
- var top = Math.round(data.offsets.popper.top);
3101
-
3102
- // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
3103
- // we automatically use the supported prefixed version if needed
3104
- var prefixedProperty;
3105
- if (
3106
- this._options.gpuAcceleration &&
3107
- (prefixedProperty = getSupportedPropertyName('transform'))
3108
- ) {
3109
- styles[prefixedProperty] =
3110
- 'translate3d(' + left + 'px, ' + top + 'px, 0)';
3111
- styles.top = 0;
3112
- styles.left = 0;
3113
- }
3114
- // othwerise, we use the standard `left` and `top` properties
3115
- else {
3116
- styles.left = left;
3117
- styles.top = top;
3118
- }
3119
-
3120
- // any property present in `data.styles` will be applied to the popper,
3121
- // in this way we can make the 3rd party modifiers add custom styles to it
3122
- // Be aware, modifiers could override the properties defined in the previous
3123
- // lines of this modifier!
3124
- Object.assign(styles, data.styles);
3125
-
3126
- setStyle(this._popper, styles);
3127
-
3128
- // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
3129
- // NOTE: 1 DOM access here
3130
- this._popper.setAttribute('x-placement', data.placement);
3131
-
3132
- // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
3133
- if (
3134
- this.isModifierRequired(
3135
- this.modifiers.applyStyle,
3136
- this.modifiers.arrow
3137
- ) &&
3138
- data.offsets.arrow
3139
- ) {
3140
- setStyle(data.arrowElement, data.offsets.arrow);
3141
- }
3142
-
3143
- return data;
3144
- };
3145
-
3053
+ */
3054
+ Popper.prototype.modifiers.applyStyle = function (data) {
3055
+ // apply the final offsets to the popper
3056
+ // NOTE: 1 DOM access here
3057
+ var styles = {
3058
+ position: data.offsets.popper.position
3059
+ };
3060
+
3061
+ // round top and left to avoid blurry text
3062
+ var left = Math.round(data.offsets.popper.left);
3063
+ var top = Math.round(data.offsets.popper.top);
3064
+
3065
+ // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
3066
+ // we automatically use the supported prefixed version if needed
3067
+ var prefixedProperty;
3068
+ if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
3069
+ styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
3070
+ styles.top = 0;
3071
+ styles.left = 0;
3072
+ }
3073
+ // othwerise, we use the standard `left` and `top` properties
3074
+ else {
3075
+ styles.left = left;
3076
+ styles.top = top;
3077
+ }
3078
+
3079
+ // any property present in `data.styles` will be applied to the popper,
3080
+ // in this way we can make the 3rd party modifiers add custom styles to it
3081
+ // Be aware, modifiers could override the properties defined in the previous
3082
+ // lines of this modifier!
3083
+ Object.assign(styles, data.styles);
3084
+
3085
+ setStyle(this._popper, styles);
3086
+
3087
+ // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
3088
+ // NOTE: 1 DOM access here
3089
+ this._popper.setAttribute('x-placement', data.placement);
3090
+
3091
+ // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
3092
+ if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
3093
+ setStyle(data.arrowElement, data.offsets.arrow);
3094
+ }
3095
+
3096
+ return data;
3097
+ };
3098
+
3146
3099
  /**
3147
3100
  * Modifier used to shift the popper on the start or end of its reference element side
3148
3101
  * @method
3149
3102
  * @memberof Popper.modifiers
3150
3103
  * @argument {Object} data - The data object generated by `update` method
3151
3104
  * @returns {Object} The data object, properly modified
3152
- */
3153
- Popper.prototype.modifiers.shift = function (data) {
3154
- var placement = data.placement;
3155
- var basePlacement = placement.split('-')[0];
3156
- var shiftVariation = placement.split('-')[1];
3157
-
3158
- // if shift shiftVariation is specified, run the modifier
3159
- if (shiftVariation) {
3160
- var reference = data.offsets.reference;
3161
- var popper = getPopperClientRect(data.offsets.popper);
3162
-
3163
- var shiftOffsets = {
3164
- y: {
3165
- start: { top: reference.top },
3166
- end: { top: reference.top + reference.height - popper.height }
3167
- },
3168
- x: {
3169
- start: { left: reference.left },
3170
- end: { left: reference.left + reference.width - popper.width }
3171
- }
3172
- };
3173
-
3174
- var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
3175
-
3176
- data.offsets.popper = Object.assign(
3177
- popper,
3178
- shiftOffsets[axis][shiftVariation]
3179
- );
3180
- }
3181
-
3182
- return data;
3183
- };
3184
-
3105
+ */
3106
+ Popper.prototype.modifiers.shift = function (data) {
3107
+ var placement = data.placement;
3108
+ var basePlacement = placement.split('-')[0];
3109
+ var shiftVariation = placement.split('-')[1];
3110
+
3111
+ // if shift shiftVariation is specified, run the modifier
3112
+ if (shiftVariation) {
3113
+ var reference = data.offsets.reference;
3114
+ var popper = getPopperClientRect(data.offsets.popper);
3115
+
3116
+ var shiftOffsets = {
3117
+ y: {
3118
+ start: { top: reference.top },
3119
+ end: { top: reference.top + reference.height - popper.height }
3120
+ },
3121
+ x: {
3122
+ start: { left: reference.left },
3123
+ end: { left: reference.left + reference.width - popper.width }
3124
+ }
3125
+ };
3126
+
3127
+ var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
3128
+
3129
+ data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
3130
+ }
3131
+
3132
+ return data;
3133
+ };
3134
+
3185
3135
  /**
3186
3136
  * Modifier used to make sure the popper does not overflows from it's boundaries
3187
3137
  * @method
3188
3138
  * @memberof Popper.modifiers
3189
3139
  * @argument {Object} data - The data object generated by `update` method
3190
3140
  * @returns {Object} The data object, properly modified
3191
- */
3192
- Popper.prototype.modifiers.preventOverflow = function (data) {
3193
- var order = this._options.preventOverflowOrder;
3194
- var popper = getPopperClientRect(data.offsets.popper);
3195
-
3196
- var check = {
3197
- left: function () {
3198
- var left = popper.left;
3199
- if (popper.left < data.boundaries.left) {
3200
- left = Math.max(popper.left, data.boundaries.left);
3201
- }
3202
- return { left: left };
3203
- },
3204
- right: function () {
3205
- var left = popper.left;
3206
- if (popper.right > data.boundaries.right) {
3207
- left = Math.min(popper.left, data.boundaries.right - popper.width);
3208
- }
3209
- return { left: left };
3210
- },
3211
- top: function () {
3212
- var top = popper.top;
3213
- if (popper.top < data.boundaries.top) {
3214
- top = Math.max(popper.top, data.boundaries.top);
3215
- }
3216
- return { top: top };
3217
- },
3218
- bottom: function () {
3219
- var top = popper.top;
3220
- if (popper.bottom > data.boundaries.bottom) {
3221
- top = Math.min(popper.top, data.boundaries.bottom - popper.height);
3222
- }
3223
- return { top: top };
3224
- }
3225
- };
3226
-
3227
- order.forEach(function (direction) {
3228
- data.offsets.popper = Object.assign(popper, check[direction]());
3229
- });
3230
-
3231
- return data;
3232
- };
3233
-
3141
+ */
3142
+ Popper.prototype.modifiers.preventOverflow = function (data) {
3143
+ var order = this._options.preventOverflowOrder;
3144
+ var popper = getPopperClientRect(data.offsets.popper);
3145
+
3146
+ var check = {
3147
+ left: function left() {
3148
+ var left = popper.left;
3149
+ if (popper.left < data.boundaries.left) {
3150
+ left = Math.max(popper.left, data.boundaries.left);
3151
+ }
3152
+ return { left: left };
3153
+ },
3154
+ right: function right() {
3155
+ var left = popper.left;
3156
+ if (popper.right > data.boundaries.right) {
3157
+ left = Math.min(popper.left, data.boundaries.right - popper.width);
3158
+ }
3159
+ return { left: left };
3160
+ },
3161
+ top: function top() {
3162
+ var top = popper.top;
3163
+ if (popper.top < data.boundaries.top) {
3164
+ top = Math.max(popper.top, data.boundaries.top);
3165
+ }
3166
+ return { top: top };
3167
+ },
3168
+ bottom: function bottom() {
3169
+ var top = popper.top;
3170
+ if (popper.bottom > data.boundaries.bottom) {
3171
+ top = Math.min(popper.top, data.boundaries.bottom - popper.height);
3172
+ }
3173
+ return { top: top };
3174
+ }
3175
+ };
3176
+
3177
+ order.forEach(function (direction) {
3178
+ data.offsets.popper = Object.assign(popper, check[direction]());
3179
+ });
3180
+
3181
+ return data;
3182
+ };
3183
+
3234
3184
  /**
3235
3185
  * Modifier used to make sure the popper is always near its reference
3236
3186
  * @method
3237
3187
  * @memberof Popper.modifiers
3238
3188
  * @argument {Object} data - The data object generated by _update method
3239
3189
  * @returns {Object} The data object, properly modified
3240
- */
3241
- Popper.prototype.modifiers.keepTogether = function (data) {
3242
- var popper = getPopperClientRect(data.offsets.popper);
3243
- var reference = data.offsets.reference;
3244
- var f = Math.floor;
3245
-
3246
- if (popper.right < f(reference.left)) {
3247
- data.offsets.popper.left = f(reference.left) - popper.width;
3248
- }
3249
- if (popper.left > f(reference.right)) {
3250
- data.offsets.popper.left = f(reference.right);
3251
- }
3252
- if (popper.bottom < f(reference.top)) {
3253
- data.offsets.popper.top = f(reference.top) - popper.height;
3254
- }
3255
- if (popper.top > f(reference.bottom)) {
3256
- data.offsets.popper.top = f(reference.bottom);
3257
- }
3258
-
3259
- return data;
3260
- };
3261
-
3190
+ */
3191
+ Popper.prototype.modifiers.keepTogether = function (data) {
3192
+ var popper = getPopperClientRect(data.offsets.popper);
3193
+ var reference = data.offsets.reference;
3194
+ var f = Math.floor;
3195
+
3196
+ if (popper.right < f(reference.left)) {
3197
+ data.offsets.popper.left = f(reference.left) - popper.width;
3198
+ }
3199
+ if (popper.left > f(reference.right)) {
3200
+ data.offsets.popper.left = f(reference.right);
3201
+ }
3202
+ if (popper.bottom < f(reference.top)) {
3203
+ data.offsets.popper.top = f(reference.top) - popper.height;
3204
+ }
3205
+ if (popper.top > f(reference.bottom)) {
3206
+ data.offsets.popper.top = f(reference.bottom);
3207
+ }
3208
+
3209
+ return data;
3210
+ };
3211
+
3262
3212
  /**
3263
3213
  * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
3264
3214
  * Requires the `preventOverflow` modifier before it in order to work.
@@ -3267,81 +3217,61 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3267
3217
  * @memberof Popper.modifiers
3268
3218
  * @argument {Object} data - The data object generated by _update method
3269
3219
  * @returns {Object} The data object, properly modified
3270
- */
3271
- Popper.prototype.modifiers.flip = function (data) {
3272
- // check if preventOverflow is in the list of modifiers before the flip modifier.
3273
- // otherwise flip would not work as expected.
3274
- if (
3275
- !this.isModifierRequired(
3276
- this.modifiers.flip,
3277
- this.modifiers.preventOverflow
3278
- )
3279
- ) {
3280
- console.warn(
3281
- 'WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!'
3282
- );
3283
- return data;
3284
- }
3285
-
3286
- if (data.flipped && data.placement === data._originalPlacement) {
3287
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
3288
- return data;
3289
- }
3290
-
3291
- var placement = data.placement.split('-')[0];
3292
- var placementOpposite = getOppositePlacement(placement);
3293
- var variation = data.placement.split('-')[1] || '';
3294
-
3295
- var flipOrder = [];
3296
- if (this._options.flipBehavior === 'flip') {
3297
- flipOrder = [placement, placementOpposite];
3298
- } else {
3299
- flipOrder = this._options.flipBehavior;
3300
- }
3301
-
3302
- flipOrder.forEach(
3303
- function (step, index) {
3304
- if (placement !== step || flipOrder.length === index + 1) {
3305
- return;
3306
- }
3307
-
3308
- placement = data.placement.split('-')[0];
3309
- placementOpposite = getOppositePlacement(placement);
3310
-
3311
- var popperOffsets = getPopperClientRect(data.offsets.popper);
3312
-
3313
- // this boolean is used to distinguish right and bottom from top and left
3314
- // they need different computations to get flipped
3315
- var a = ['right', 'bottom'].indexOf(placement) !== -1;
3316
-
3317
- // using Math.floor because the reference offsets may contain decimals we are not going to consider here
3318
- if (
3319
- (a &&
3320
- Math.floor(data.offsets.reference[placement]) >
3321
- Math.floor(popperOffsets[placementOpposite])) ||
3322
- (!a &&
3323
- Math.floor(data.offsets.reference[placement]) <
3324
- Math.floor(popperOffsets[placementOpposite]))
3325
- ) {
3326
- // we'll use this boolean to detect any flip loop
3327
- data.flipped = true;
3328
- data.placement = flipOrder[index + 1];
3329
- if (variation) {
3330
- data.placement += '-' + variation;
3331
- }
3332
- data.offsets.popper = this._getOffsets(
3333
- this._popper,
3334
- this._reference,
3335
- data.placement
3336
- ).popper;
3337
-
3338
- data = this.runModifiers(data, this._options.modifiers, this._flip);
3339
- }
3340
- }.bind(this)
3341
- );
3342
- return data;
3343
- };
3344
-
3220
+ */
3221
+ Popper.prototype.modifiers.flip = function (data) {
3222
+ // check if preventOverflow is in the list of modifiers before the flip modifier.
3223
+ // otherwise flip would not work as expected.
3224
+ if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
3225
+ console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
3226
+ return data;
3227
+ }
3228
+
3229
+ if (data.flipped && data.placement === data._originalPlacement) {
3230
+ // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
3231
+ return data;
3232
+ }
3233
+
3234
+ var placement = data.placement.split('-')[0];
3235
+ var placementOpposite = getOppositePlacement(placement);
3236
+ var variation = data.placement.split('-')[1] || '';
3237
+
3238
+ var flipOrder = [];
3239
+ if (this._options.flipBehavior === 'flip') {
3240
+ flipOrder = [placement, placementOpposite];
3241
+ } else {
3242
+ flipOrder = this._options.flipBehavior;
3243
+ }
3244
+
3245
+ flipOrder.forEach(function (step, index) {
3246
+ if (placement !== step || flipOrder.length === index + 1) {
3247
+ return;
3248
+ }
3249
+
3250
+ placement = data.placement.split('-')[0];
3251
+ placementOpposite = getOppositePlacement(placement);
3252
+
3253
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
3254
+
3255
+ // this boolean is used to distinguish right and bottom from top and left
3256
+ // they need different computations to get flipped
3257
+ var a = ['right', 'bottom'].indexOf(placement) !== -1;
3258
+
3259
+ // using Math.floor because the reference offsets may contain decimals we are not going to consider here
3260
+ if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
3261
+ // we'll use this boolean to detect any flip loop
3262
+ data.flipped = true;
3263
+ data.placement = flipOrder[index + 1];
3264
+ if (variation) {
3265
+ data.placement += '-' + variation;
3266
+ }
3267
+ data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
3268
+
3269
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
3270
+ }
3271
+ }.bind(this));
3272
+ return data;
3273
+ };
3274
+
3345
3275
  /**
3346
3276
  * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
3347
3277
  * The offsets will shift the popper on the side of its reference element.
@@ -3349,23 +3279,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3349
3279
  * @memberof Popper.modifiers
3350
3280
  * @argument {Object} data - The data object generated by _update method
3351
3281
  * @returns {Object} The data object, properly modified
3352
- */
3353
- Popper.prototype.modifiers.offset = function (data) {
3354
- var offset = this._options.offset;
3355
- var popper = data.offsets.popper;
3356
-
3357
- if (data.placement.indexOf('left') !== -1) {
3358
- popper.top -= offset;
3359
- } else if (data.placement.indexOf('right') !== -1) {
3360
- popper.top += offset;
3361
- } else if (data.placement.indexOf('top') !== -1) {
3362
- popper.left -= offset;
3363
- } else if (data.placement.indexOf('bottom') !== -1) {
3364
- popper.left += offset;
3365
- }
3366
- return data;
3367
- };
3368
-
3282
+ */
3283
+ Popper.prototype.modifiers.offset = function (data) {
3284
+ var offset = this._options.offset;
3285
+ var popper = data.offsets.popper;
3286
+
3287
+ if (data.placement.indexOf('left') !== -1) {
3288
+ popper.top -= offset;
3289
+ } else if (data.placement.indexOf('right') !== -1) {
3290
+ popper.top += offset;
3291
+ } else if (data.placement.indexOf('top') !== -1) {
3292
+ popper.left -= offset;
3293
+ } else if (data.placement.indexOf('bottom') !== -1) {
3294
+ popper.left += offset;
3295
+ }
3296
+ return data;
3297
+ };
3298
+
3369
3299
  /**
3370
3300
  * 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
3371
3301
  * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
@@ -3373,147 +3303,136 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3373
3303
  * @memberof Popper.modifiers
3374
3304
  * @argument {Object} data - The data object generated by _update method
3375
3305
  * @returns {Object} The data object, properly modified
3376
- */
3377
- Popper.prototype.modifiers.arrow = function (data) {
3378
- var arrow = this._options.arrowElement;
3379
- var arrowOffset = this._options.arrowOffset;
3380
-
3381
- // if the arrowElement is a string, suppose it's a CSS selector
3382
- if (typeof arrow === 'string') {
3383
- arrow = this._popper.querySelector(arrow);
3384
- }
3385
-
3386
- // if arrow element is not found, don't run the modifier
3387
- if (!arrow) {
3388
- return data;
3389
- }
3390
-
3391
- // the arrow element must be child of its popper
3392
- if (!this._popper.contains(arrow)) {
3393
- console.warn(
3394
- 'WARNING: `arrowElement` must be child of its popper element!'
3395
- );
3396
- return data;
3397
- }
3398
-
3399
- // arrow depends on keepTogether in order to work
3400
- if (
3401
- !this.isModifierRequired(
3402
- this.modifiers.arrow,
3403
- this.modifiers.keepTogether
3404
- )
3405
- ) {
3406
- console.warn(
3407
- 'WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!'
3408
- );
3409
- return data;
3410
- }
3411
-
3412
- var arrowStyle = {};
3413
- var placement = data.placement.split('-')[0];
3414
- var popper = getPopperClientRect(data.offsets.popper);
3415
- var reference = data.offsets.reference;
3416
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
3417
-
3418
- var len = isVertical ? 'height' : 'width';
3419
- var side = isVertical ? 'top' : 'left';
3420
- var translate = isVertical ? 'translateY' : 'translateX';
3421
- var altSide = isVertical ? 'left' : 'top';
3422
- var opSide = isVertical ? 'bottom' : 'right';
3423
- var arrowSize = getOuterSizes(arrow)[len];
3424
-
3425
- //
3426
- // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
3427
- //
3428
-
3429
- // top/left side
3430
- if (reference[opSide] - arrowSize < popper[side]) {
3431
- data.offsets.popper[side] -=
3432
- popper[side] - (reference[opSide] - arrowSize);
3433
- }
3434
- // bottom/right side
3435
- if (reference[side] + arrowSize > popper[opSide]) {
3436
- data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
3437
- }
3438
-
3439
- // compute center of the popper
3440
- var center =
3441
- reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
3442
-
3443
- var sideValue = center - popper[side];
3444
-
3445
- // prevent arrow from being placed not contiguously to its popper
3446
- sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
3447
- arrowStyle[side] = sideValue;
3448
- arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
3449
-
3450
- data.offsets.arrow = arrowStyle;
3451
- data.arrowElement = arrow;
3452
-
3453
- return data;
3454
- };
3455
-
3456
- //
3457
- // Helpers
3458
- //
3459
-
3306
+ */
3307
+ Popper.prototype.modifiers.arrow = function (data) {
3308
+ var arrow = this._options.arrowElement;
3309
+ var arrowOffset = this._options.arrowOffset;
3310
+
3311
+ // if the arrowElement is a string, suppose it's a CSS selector
3312
+ if (typeof arrow === 'string') {
3313
+ arrow = this._popper.querySelector(arrow);
3314
+ }
3315
+
3316
+ // if arrow element is not found, don't run the modifier
3317
+ if (!arrow) {
3318
+ return data;
3319
+ }
3320
+
3321
+ // the arrow element must be child of its popper
3322
+ if (!this._popper.contains(arrow)) {
3323
+ console.warn('WARNING: `arrowElement` must be child of its popper element!');
3324
+ return data;
3325
+ }
3326
+
3327
+ // arrow depends on keepTogether in order to work
3328
+ if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
3329
+ console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
3330
+ return data;
3331
+ }
3332
+
3333
+ var arrowStyle = {};
3334
+ var placement = data.placement.split('-')[0];
3335
+ var popper = getPopperClientRect(data.offsets.popper);
3336
+ var reference = data.offsets.reference;
3337
+ var isVertical = ['left', 'right'].indexOf(placement) !== -1;
3338
+
3339
+ var len = isVertical ? 'height' : 'width';
3340
+ var side = isVertical ? 'top' : 'left';
3341
+ var translate = isVertical ? 'translateY' : 'translateX';
3342
+ var altSide = isVertical ? 'left' : 'top';
3343
+ var opSide = isVertical ? 'bottom' : 'right';
3344
+ var arrowSize = getOuterSizes(arrow)[len];
3345
+
3346
+ //
3347
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
3348
+ //
3349
+
3350
+ // top/left side
3351
+ if (reference[opSide] - arrowSize < popper[side]) {
3352
+ data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
3353
+ }
3354
+ // bottom/right side
3355
+ if (reference[side] + arrowSize > popper[opSide]) {
3356
+ data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
3357
+ }
3358
+
3359
+ // compute center of the popper
3360
+ var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
3361
+
3362
+ var sideValue = center - popper[side];
3363
+
3364
+ // prevent arrow from being placed not contiguously to its popper
3365
+ sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
3366
+ arrowStyle[side] = sideValue;
3367
+ arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
3368
+
3369
+ data.offsets.arrow = arrowStyle;
3370
+ data.arrowElement = arrow;
3371
+
3372
+ return data;
3373
+ };
3374
+
3375
+ //
3376
+ // Helpers
3377
+ //
3378
+
3460
3379
  /**
3461
3380
  * Get the outer sizes of the given element (offset size + margins)
3462
3381
  * @function
3463
3382
  * @ignore
3464
3383
  * @argument {Element} element
3465
3384
  * @returns {Object} object containing width and height properties
3466
- */
3467
- function getOuterSizes(element) {
3468
- // NOTE: 1 DOM access here
3469
- var _display = element.style.display,
3470
- _visibility = element.style.visibility;
3471
- element.style.display = 'block';
3472
- element.style.visibility = 'hidden';
3473
- var calcWidthToForceRepaint = element.offsetWidth;
3474
- // original method
3475
- var styles = getRealWindow(element).getComputedStyle(element);
3476
- var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
3477
- var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
3478
- var result = {
3479
- width: element.offsetWidth + y,
3480
- height: element.offsetHeight + x
3481
- };
3482
-
3483
- // reset element styles
3484
- element.style.display = _display;
3485
- element.style.visibility = _visibility;
3486
- return result;
3487
- }
3488
-
3385
+ */
3386
+ function getOuterSizes(element) {
3387
+ // NOTE: 1 DOM access here
3388
+ var _display = element.style.display,
3389
+ _visibility = element.style.visibility;
3390
+ element.style.display = 'block';
3391
+ element.style.visibility = 'hidden';
3392
+ var calcWidthToForceRepaint = element.offsetWidth;
3393
+ // original method
3394
+ var styles = getRealWindow(element).getComputedStyle(element);
3395
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
3396
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
3397
+ var result = {
3398
+ width: element.offsetWidth + y,
3399
+ height: element.offsetHeight + x
3400
+ };
3401
+
3402
+ // reset element styles
3403
+ element.style.display = _display;
3404
+ element.style.visibility = _visibility;
3405
+ return result;
3406
+ }
3407
+
3489
3408
  /**
3490
3409
  * Get the opposite placement of the given one/
3491
3410
  * @function
3492
3411
  * @ignore
3493
3412
  * @argument {String} placement
3494
3413
  * @returns {String} flipped placement
3495
- */
3496
- function getOppositePlacement(placement) {
3497
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
3498
- return placement.replace(/left|right|bottom|top/g, function (matched) {
3499
- return hash[matched];
3500
- });
3501
- }
3502
-
3414
+ */
3415
+ function getOppositePlacement(placement) {
3416
+ var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
3417
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
3418
+ return hash[matched];
3419
+ });
3420
+ }
3421
+
3503
3422
  /**
3504
3423
  * Given the popper offsets, generate an output similar to getBoundingClientRect
3505
3424
  * @function
3506
3425
  * @ignore
3507
3426
  * @argument {Object} popperOffsets
3508
3427
  * @returns {Object} ClientRect like output
3509
- */
3510
- function getPopperClientRect(popperOffsets) {
3511
- var offsets = Object.assign({}, popperOffsets);
3512
- offsets.right = offsets.left + offsets.width;
3513
- offsets.bottom = offsets.top + offsets.height;
3514
- return offsets;
3515
- }
3516
-
3428
+ */
3429
+ function getPopperClientRect(popperOffsets) {
3430
+ var offsets = Object.assign({}, popperOffsets);
3431
+ offsets.right = offsets.left + offsets.width;
3432
+ offsets.bottom = offsets.top + offsets.height;
3433
+ return offsets;
3434
+ }
3435
+
3517
3436
  /**
3518
3437
  * Given an array and the key to find, returns its index
3519
3438
  * @function
@@ -3521,48 +3440,46 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3521
3440
  * @argument {Array} arr
3522
3441
  * @argument keyToFind
3523
3442
  * @returns index or null
3524
- */
3525
- function getArrayKeyIndex(arr, keyToFind) {
3526
- var i = 0,
3527
- key;
3528
- for (key in arr) {
3529
- if (arr[key] === keyToFind) {
3530
- return i;
3531
- }
3532
- i++;
3533
- }
3534
- return null;
3535
- }
3536
-
3443
+ */
3444
+ function getArrayKeyIndex(arr, keyToFind) {
3445
+ var i = 0,
3446
+ key;
3447
+ for (key in arr) {
3448
+ if (arr[key] === keyToFind) {
3449
+ return i;
3450
+ }
3451
+ i++;
3452
+ }
3453
+ return null;
3454
+ }
3455
+
3537
3456
  /**
3538
3457
  * Get CSS computed property of the given element
3539
3458
  * @function
3540
3459
  * @ignore
3541
3460
  * @argument {Eement} element
3542
3461
  * @argument {String} property
3543
- */
3544
- function getStyleComputedProperty(element, property) {
3545
- // NOTE: 1 DOM access here
3546
- // 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
3547
- // 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
3548
- var css = getRealWindow(element).getComputedStyle(element, null);
3549
- return css[property];
3550
- }
3551
-
3462
+ */
3463
+ function getStyleComputedProperty(element, property) {
3464
+ // NOTE: 1 DOM access here
3465
+ // 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
3466
+ // 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
3467
+ var css = getRealWindow(element).getComputedStyle(element, null);
3468
+ return css[property];
3469
+ }
3470
+
3552
3471
  /**
3553
3472
  * Returns the offset parent of the given element
3554
3473
  * @function
3555
3474
  * @ignore
3556
3475
  * @argument {Element} element
3557
3476
  * @returns {Element} offset parent
3558
- */
3559
- function getOffsetParent(element) {
3560
- var offsetParent = element.offsetParent;
3561
- return offsetParent === root.document.body || !offsetParent
3562
- ? root.document.documentElement
3563
- : offsetParent;
3564
- }
3565
-
3477
+ */
3478
+ function getOffsetParent(element) {
3479
+ var offsetParent = element.offsetParent;
3480
+ return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
3481
+ }
3482
+
3566
3483
  /**
3567
3484
  * Returns the window the given element actually renders in.
3568
3485
  * 无界等微前端场景下组件代码运行在沙箱 window 中,而 DOM 实际渲染在
@@ -3571,16 +3488,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3571
3488
  * @ignore
3572
3489
  * @argument {Element} element
3573
3490
  * @returns {Window} window
3574
- */
3575
- function getRealWindow(element) {
3576
- return (
3577
- (element &&
3578
- element.ownerDocument &&
3579
- element.ownerDocument.defaultView) ||
3580
- root
3581
- );
3582
- }
3583
-
3491
+ */
3492
+ function getRealWindow(element) {
3493
+ return element && element.ownerDocument && element.ownerDocument.defaultView || root;
3494
+ }
3495
+
3584
3496
  /**
3585
3497
  * Returns the viewport rect of the containing block actually used to position the popper.
3586
3498
  * 无界微前端等场景下 popper 被挂载进子应用的 shadowRoot,offsetParent 的兜底值
@@ -3594,82 +3506,72 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3594
3506
  * @argument {Element} element - popper element
3595
3507
  * @argument {Boolean} fixed - whether the popper is fixed positioned
3596
3508
  * @returns {Object} rect
3597
- */
3598
- function getContainingBlockRect(element, fixed) {
3599
- if (fixed) {
3600
- return { top: 0, left: 0, right: 0, bottom: 0 };
3601
- }
3602
-
3603
- var node = element.parentNode;
3604
- while (node) {
3605
- if (node.nodeType === 1) {
3606
- if (getStyleComputedProperty(node, 'position') !== 'static') {
3607
- return getBoundingClientRect(node);
3608
- }
3609
- } else if (node.nodeType === 11) {
3610
- // 遇到 shadowRoot,跨边界从宿主元素继续向上查找
3611
- node = node.host;
3612
- continue;
3613
- } else {
3614
- break;
3615
- }
3616
- node = node.parentNode;
3617
- }
3618
-
3619
- var win = getRealWindow(element);
3620
- return {
3621
- top: -(win.pageYOffset || 0),
3622
- left: -(win.pageXOffset || 0),
3623
- right: 0,
3624
- bottom: 0
3625
- };
3626
- }
3627
-
3509
+ */
3510
+ function getContainingBlockRect(element, fixed) {
3511
+ if (fixed) {
3512
+ return { top: 0, left: 0, right: 0, bottom: 0 };
3513
+ }
3514
+
3515
+ var node = element.parentNode;
3516
+ while (node) {
3517
+ if (node.nodeType === 1) {
3518
+ if (getStyleComputedProperty(node, 'position') !== 'static') {
3519
+ return getBoundingClientRect(node);
3520
+ }
3521
+ } else if (node.nodeType === 11) {
3522
+ // 遇到 shadowRoot,跨边界从宿主元素继续向上查找
3523
+ node = node.host;
3524
+ continue;
3525
+ } else {
3526
+ break;
3527
+ }
3528
+ node = node.parentNode;
3529
+ }
3530
+
3531
+ var win = getRealWindow(element);
3532
+ return {
3533
+ top: -(win.pageYOffset || 0),
3534
+ left: -(win.pageXOffset || 0),
3535
+ right: 0,
3536
+ bottom: 0
3537
+ };
3538
+ }
3539
+
3628
3540
  /**
3629
3541
  * Returns the scrolling parent of the given element
3630
3542
  * @function
3631
3543
  * @ignore
3632
3544
  * @argument {Element} element
3633
3545
  * @returns {Element} offset parent
3634
- */
3635
- function getScrollParent(element) {
3636
- var parent = element.parentNode;
3637
- if (!parent) {
3638
- return element;
3639
- }
3640
-
3641
- if (parent.nodeType === 11) {
3642
- // 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
3643
- // 否则查找到 shadowRoot 即终止,滚动事件无法被监听
3644
- return getScrollParent(parent.host);
3645
- }
3646
-
3647
- if (parent.nodeType !== 1) {
3648
- // 到达 document,返回元素实际渲染所在的真实 window,
3649
- // 保证 window 滚动时能触发位置更新
3650
- return getRealWindow(element);
3651
- }
3652
-
3653
- // Firefox want us to check `-x` and `-y` variations as well
3654
- if (
3655
- ['scroll', 'auto'].indexOf(
3656
- getStyleComputedProperty(parent, 'overflow')
3657
- ) !== -1 ||
3658
- ['scroll', 'auto'].indexOf(
3659
- getStyleComputedProperty(parent, 'overflow-x')
3660
- ) !== -1 ||
3661
- ['scroll', 'auto'].indexOf(
3662
- getStyleComputedProperty(parent, 'overflow-y')
3663
- ) !== -1
3664
- ) {
3665
- // If the detected scrollParent is body, we perform an additional check on its parentNode
3666
- // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
3667
- // fixes issue #65
3668
- return parent;
3669
- }
3670
- return getScrollParent(parent);
3671
- }
3672
-
3546
+ */
3547
+ function getScrollParent(element) {
3548
+ var parent = element.parentNode;
3549
+ if (!parent) {
3550
+ return element;
3551
+ }
3552
+
3553
+ if (parent.nodeType === 11) {
3554
+ // 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
3555
+ // 否则查找到 shadowRoot 即终止,滚动事件无法被监听
3556
+ return getScrollParent(parent.host);
3557
+ }
3558
+
3559
+ if (parent.nodeType !== 1) {
3560
+ // 到达 document,返回元素实际渲染所在的真实 window,
3561
+ // 保证 window 滚动时能触发位置更新
3562
+ return getRealWindow(element);
3563
+ }
3564
+
3565
+ // Firefox want us to check `-x` and `-y` variations as well
3566
+ if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
3567
+ // If the detected scrollParent is body, we perform an additional check on its parentNode
3568
+ // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
3569
+ // fixes issue #65
3570
+ return parent;
3571
+ }
3572
+ return getScrollParent(parent);
3573
+ }
3574
+
3673
3575
  /**
3674
3576
  * Check if the given element is fixed or is inside a fixed parent
3675
3577
  * @function
@@ -3677,125 +3579,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3677
3579
  * @argument {Element} element
3678
3580
  * @argument {Element} customContainer
3679
3581
  * @returns {Boolean} answer to "isFixed?"
3680
- */
3681
- function isFixed(element) {
3682
- if (element === root.document.body) {
3683
- return false;
3684
- }
3685
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
3686
- return true;
3687
- }
3688
- var parent = element.parentNode;
3689
- if (parent && parent.nodeType === 11) {
3690
- // 跨 shadowRoot 边界,从宿主元素继续向上判断
3691
- parent = parent.host;
3692
- }
3693
- return parent && parent.nodeType === 1 ? isFixed(parent) : false;
3694
- }
3695
-
3582
+ */
3583
+ function isFixed(element) {
3584
+ if (element === root.document.body) {
3585
+ return false;
3586
+ }
3587
+ if (getStyleComputedProperty(element, 'position') === 'fixed') {
3588
+ return true;
3589
+ }
3590
+ var parent = element.parentNode;
3591
+ if (parent && parent.nodeType === 11) {
3592
+ // 跨 shadowRoot 边界,从宿主元素继续向上判断
3593
+ parent = parent.host;
3594
+ }
3595
+ return parent && parent.nodeType === 1 ? isFixed(parent) : false;
3596
+ }
3597
+
3696
3598
  /**
3697
3599
  * Set the style to the given popper
3698
3600
  * @function
3699
3601
  * @ignore
3700
3602
  * @argument {Element} element - Element to apply the style to
3701
3603
  * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
3702
- */
3703
- function setStyle(element, styles) {
3704
- function is_numeric(n) {
3705
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
3706
- }
3707
- Object.keys(styles).forEach(function (prop) {
3708
- var unit = '';
3709
- // add unit if the value is numeric and is one of the following
3710
- if (
3711
- ['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==
3712
- -1 &&
3713
- is_numeric(styles[prop])
3714
- ) {
3715
- unit = 'px';
3716
- }
3717
- element.style[prop] = styles[prop] + unit;
3718
- });
3719
- }
3720
-
3604
+ */
3605
+ function setStyle(element, styles) {
3606
+ function is_numeric(n) {
3607
+ return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
3608
+ }
3609
+ Object.keys(styles).forEach(function (prop) {
3610
+ var unit = '';
3611
+ // add unit if the value is numeric and is one of the following
3612
+ if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
3613
+ unit = 'px';
3614
+ }
3615
+ element.style[prop] = styles[prop] + unit;
3616
+ });
3617
+ }
3618
+
3721
3619
  /**
3722
3620
  * Check if the given variable is a function
3723
3621
  * @function
3724
3622
  * @ignore
3725
3623
  * @argument {*} functionToCheck - variable to check
3726
3624
  * @returns {Boolean} answer to: is a function?
3727
- */
3728
- function isFunction(functionToCheck) {
3729
- var getType = {};
3730
- return (
3731
- functionToCheck &&
3732
- getType.toString.call(functionToCheck) === '[object Function]'
3733
- );
3734
- }
3735
-
3625
+ */
3626
+ function isFunction(functionToCheck) {
3627
+ var getType = {};
3628
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
3629
+ }
3630
+
3736
3631
  /**
3737
3632
  * Get the position of the given element, relative to its offset parent
3738
3633
  * @function
3739
3634
  * @ignore
3740
3635
  * @param {Element} element
3741
3636
  * @return {Object} position - Coordinates of the element and its `scrollTop`
3742
- */
3743
- function getOffsetRect(element) {
3744
- var transform = getStyle(element, 'transform')
3745
- .replace(/[^0-9\-,]/g, '')
3746
- .split(',');
3747
- var elementRect = {
3748
- width: element.offsetWidth,
3749
- height: element.offsetHeight,
3750
- left:
3751
- element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
3752
- top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
3753
- };
3754
-
3755
- elementRect.right = elementRect.left + elementRect.width;
3756
- elementRect.bottom = elementRect.top + elementRect.height;
3757
-
3758
- // position
3759
- return elementRect;
3760
- }
3761
-
3637
+ */
3638
+ function getOffsetRect(element) {
3639
+ var transform = getStyle(element, 'transform').replace(/[^0-9\-,]/g, '').split(',');
3640
+ var elementRect = {
3641
+ width: element.offsetWidth,
3642
+ height: element.offsetHeight,
3643
+ left: element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
3644
+ top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
3645
+ };
3646
+
3647
+ elementRect.right = elementRect.left + elementRect.width;
3648
+ elementRect.bottom = elementRect.top + elementRect.height;
3649
+
3650
+ // position
3651
+ return elementRect;
3652
+ }
3653
+
3762
3654
  /**
3763
3655
  * Get bounding client rect of given element
3764
3656
  * @function
3765
3657
  * @ignore
3766
3658
  * @param {HTMLElement} element
3767
3659
  * @return {Object} client rect
3768
- */
3769
- function getBoundingClientRect(element) {
3770
- var rect = element.getBoundingClientRect();
3771
-
3772
- // whether the IE version is lower than 11
3773
- var isIE = /MSIE|Trident/.test(navigator.userAgent);
3774
-
3775
- // fix ie document bounding top always 0 bug
3776
- var rectTop =
3777
- isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
3778
-
3779
- return {
3780
- left: rect.left,
3781
- top: rectTop,
3782
- right: rect.right,
3783
- bottom: rect.bottom,
3784
- width: rect.right - rect.left,
3785
- height: rect.bottom - rectTop
3786
- };
3787
- }
3788
-
3789
- function getStyle(dom, attr) {
3790
- if (dom.style[attr]) {
3791
- return dom.style[attr];
3792
- }
3793
- if (window.getComputedStyle) {
3794
- return getComputedStyle(dom, null)[attr];
3795
- }
3796
- return dom.currentStyle[attr];
3797
- }
3798
-
3660
+ */
3661
+ function getBoundingClientRect(element) {
3662
+ var rect = element.getBoundingClientRect();
3663
+
3664
+ // whether the IE version is lower than 11
3665
+ var isIE = /MSIE|Trident/.test(navigator.userAgent);
3666
+
3667
+ // fix ie document bounding top always 0 bug
3668
+ var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
3669
+
3670
+ return {
3671
+ left: rect.left,
3672
+ top: rectTop,
3673
+ right: rect.right,
3674
+ bottom: rect.bottom,
3675
+ width: rect.right - rect.left,
3676
+ height: rect.bottom - rectTop
3677
+ };
3678
+ }
3679
+
3680
+ function getStyle(dom, attr) {
3681
+ if (dom.style[attr]) {
3682
+ return dom.style[attr];
3683
+ }
3684
+ if (window.getComputedStyle) {
3685
+ return getComputedStyle(dom, null)[attr];
3686
+ }
3687
+ return dom.currentStyle[attr];
3688
+ }
3689
+
3799
3690
  /**
3800
3691
  * Given an element and one of its parents, return the offset
3801
3692
  * @function
@@ -3803,45 +3694,43 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3803
3694
  * @param {HTMLElement} element
3804
3695
  * @param {HTMLElement} parent
3805
3696
  * @return {Object} rect
3806
- */
3807
- function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
3808
- var elementRect = getBoundingClientRect(element);
3809
- // parent 为 popper 元素:取其真实包含块的视口 rect,
3810
- // 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
3811
- var parentRect = getContainingBlockRect(parent, fixed);
3812
-
3813
- var rect = {
3814
- top: elementRect.top - parentRect.top,
3815
- left: elementRect.left - parentRect.left,
3816
- bottom: elementRect.top - parentRect.top + elementRect.height,
3817
- right: elementRect.left - parentRect.left + elementRect.width,
3818
- width: elementRect.width,
3819
- height: elementRect.height
3820
- };
3821
- return rect;
3822
- }
3823
-
3697
+ */
3698
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
3699
+ var elementRect = getBoundingClientRect(element);
3700
+ // parent 为 popper 元素:取其真实包含块的视口 rect,
3701
+ // 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
3702
+ var parentRect = getContainingBlockRect(parent, fixed);
3703
+
3704
+ var rect = {
3705
+ top: elementRect.top - parentRect.top,
3706
+ left: elementRect.left - parentRect.left,
3707
+ bottom: elementRect.top - parentRect.top + elementRect.height,
3708
+ right: elementRect.left - parentRect.left + elementRect.width,
3709
+ width: elementRect.width,
3710
+ height: elementRect.height
3711
+ };
3712
+ return rect;
3713
+ }
3714
+
3824
3715
  /**
3825
3716
  * Get the prefixed supported property name
3826
3717
  * @function
3827
3718
  * @ignore
3828
3719
  * @argument {String} property (camelCase)
3829
3720
  * @returns {String} prefixed property (camelCase)
3830
- */
3831
- function getSupportedPropertyName(property) {
3832
- var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
3833
-
3834
- for (var i = 0; i < prefixes.length; i++) {
3835
- var toCheck = prefixes[i]
3836
- ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1)
3837
- : property;
3838
- if (typeof root.document.body.style[toCheck] !== 'undefined') {
3839
- return toCheck;
3840
- }
3841
- }
3842
- return null;
3843
- }
3844
-
3721
+ */
3722
+ function getSupportedPropertyName(property) {
3723
+ var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
3724
+
3725
+ for (var i = 0; i < prefixes.length; i++) {
3726
+ var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
3727
+ if (typeof root.document.body.style[toCheck] !== 'undefined') {
3728
+ return toCheck;
3729
+ }
3730
+ }
3731
+ return null;
3732
+ }
3733
+
3845
3734
  /**
3846
3735
  * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
3847
3736
  * objects to a target object. It will return the target object.
@@ -3849,50 +3738,45 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3849
3738
  * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
3850
3739
  * @function
3851
3740
  * @ignore
3852
- */
3853
- if (!Object.assign) {
3854
- Object.defineProperty(Object, 'assign', {
3855
- enumerable: false,
3856
- configurable: true,
3857
- writable: true,
3858
- value: function (target) {
3859
- if (target === undefined || target === null) {
3860
- throw new TypeError('Cannot convert first argument to object');
3861
- }
3862
-
3863
- var to = Object(target);
3864
- for (var i = 1; i < arguments.length; i++) {
3865
- var nextSource = arguments[i];
3866
- if (nextSource === undefined || nextSource === null) {
3867
- continue;
3868
- }
3869
- nextSource = Object(nextSource);
3870
-
3871
- var keysArray = Object.keys(nextSource);
3872
- for (
3873
- var nextIndex = 0, len = keysArray.length;
3874
- nextIndex < len;
3875
- nextIndex++
3876
- ) {
3877
- var nextKey = keysArray[nextIndex];
3878
- var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
3879
- if (desc !== undefined && desc.enumerable) {
3880
- to[nextKey] = nextSource[nextKey];
3881
- }
3882
- }
3883
- }
3884
- return to;
3885
- }
3886
- });
3887
- }
3888
-
3889
- return Popper;
3890
- });
3741
+ */
3742
+ if (!Object.assign) {
3743
+ Object.defineProperty(Object, 'assign', {
3744
+ enumerable: false,
3745
+ configurable: true,
3746
+ writable: true,
3747
+ value: function value(target) {
3748
+ if (target === undefined || target === null) {
3749
+ throw new TypeError('Cannot convert first argument to object');
3750
+ }
3891
3751
 
3752
+ var to = Object(target);
3753
+ for (var i = 1; i < arguments.length; i++) {
3754
+ var nextSource = arguments[i];
3755
+ if (nextSource === undefined || nextSource === null) {
3756
+ continue;
3757
+ }
3758
+ nextSource = Object(nextSource);
3759
+
3760
+ var keysArray = Object.keys(nextSource);
3761
+ for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
3762
+ var nextKey = keysArray[nextIndex];
3763
+ var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
3764
+ if (desc !== undefined && desc.enumerable) {
3765
+ to[nextKey] = nextSource[nextKey];
3766
+ }
3767
+ }
3768
+ }
3769
+ return to;
3770
+ }
3771
+ });
3772
+ }
3773
+
3774
+ return Popper;
3775
+ });
3892
3776
 
3893
3777
  /***/ }),
3894
3778
 
3895
- /***/ 60:
3779
+ /***/ 61:
3896
3780
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3897
3781
 
3898
3782
  "use strict";
@@ -4030,7 +3914,7 @@ render._withStripped = true
4030
3914
  // CONCATENATED MODULE: ./packages/menu/src/menu-item.vue?vue&type=template&id=4175d146&
4031
3915
 
4032
3916
  // EXTERNAL MODULE: ./packages/menu/src/menu-mixin.js
4033
- var menu_mixin = __webpack_require__(67);
3917
+ var menu_mixin = __webpack_require__(68);
4034
3918
 
4035
3919
  // EXTERNAL MODULE: external "eoss/lib/tooltip"
4036
3920
  var tooltip_ = __webpack_require__(36);
@@ -4255,7 +4139,7 @@ var component = Object(componentNormalizer["a" /* default */])(
4255
4139
 
4256
4140
  /***/ }),
4257
4141
 
4258
- /***/ 67:
4142
+ /***/ 68:
4259
4143
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4260
4144
 
4261
4145
  "use strict";
@@ -4304,7 +4188,7 @@ var component = Object(componentNormalizer["a" /* default */])(
4304
4188
 
4305
4189
  /***/ }),
4306
4190
 
4307
- /***/ 69:
4191
+ /***/ 70:
4308
4192
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4309
4193
 
4310
4194
  "use strict";
@@ -4406,7 +4290,7 @@ var Transition = function () {
4406
4290
 
4407
4291
  /***/ }),
4408
4292
 
4409
- /***/ 80:
4293
+ /***/ 81:
4410
4294
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4411
4295
 
4412
4296
  "use strict";
@@ -4490,7 +4374,7 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
4490
4374
  if (!this._colorCache) {
4491
4375
  this._colorCache = {};
4492
4376
  }
4493
- var isParentMenuIcon = item.children && item.children.length || this.isFourthTabs && item.fourthTabs && item.fourthTabs.length;
4377
+ // 缓存键为颜色槽位;缓存值仅依赖 iconColors 与槽位(iconColors 变化由 watcher 清缓存)
4494
4378
  var key = Array.isArray(this.iconColors) ? 'index_' + index % this.iconColors.length : 'single_color';
4495
4379
 
4496
4380
  if (!this._colorCache[key]) {
@@ -4498,7 +4382,7 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
4498
4382
  this._colorCache[key] = {
4499
4383
  '--icon-bg-color': bgColor,
4500
4384
  '--icon-color': '#fff',
4501
- '--icon-font-size': isParentMenuIcon ? '16px' : '12px'
4385
+ '--icon-font-size': '12px'
4502
4386
  };
4503
4387
  }
4504
4388
 
@@ -4569,12 +4453,12 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
4569
4453
 
4570
4454
  /***/ }),
4571
4455
 
4572
- /***/ 82:
4456
+ /***/ 84:
4573
4457
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4574
4458
 
4575
4459
  "use strict";
4576
4460
 
4577
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/menu-item-group.vue?vue&type=template&id=6d5d18cf&
4461
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/menu-item-group.vue?vue&type=template&id=ec02cbb0&
4578
4462
  var render = function () {
4579
4463
  var _vm = this
4580
4464
  var _h = _vm.$createElement
@@ -4610,7 +4494,7 @@ var render = function () {
4610
4494
  "open-icon": _vm.openIcon,
4611
4495
  "close-icon": _vm.closeIcon,
4612
4496
  isFourthTabs: _vm.isFourthTabs,
4613
- iconColor: _vm.getColor(index),
4497
+ iconColor: _vm.getColor(index, item),
4614
4498
  iconColors: _vm.iconColors,
4615
4499
  },
4616
4500
  },
@@ -4630,13 +4514,13 @@ var staticRenderFns = []
4630
4514
  render._withStripped = true
4631
4515
 
4632
4516
 
4633
- // CONCATENATED MODULE: ./packages/menu/src/menu-item-group.vue?vue&type=template&id=6d5d18cf&
4517
+ // CONCATENATED MODULE: ./packages/menu/src/menu-item-group.vue?vue&type=template&id=ec02cbb0&
4634
4518
 
4635
4519
  // EXTERNAL MODULE: ./packages/menu/src/mixins.js
4636
- var mixins = __webpack_require__(80);
4520
+ var mixins = __webpack_require__(81);
4637
4521
 
4638
4522
  // EXTERNAL MODULE: ./packages/menu/src/menu-item.vue + 4 modules
4639
- var menu_item = __webpack_require__(60);
4523
+ var menu_item = __webpack_require__(61);
4640
4524
 
4641
4525
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/src/menu-item-group.vue?vue&type=script&lang=js&
4642
4526
  //