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/menu.js CHANGED
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 206);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 213);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -3285,12 +3285,232 @@ var warning = function warning(content, _callback3) {
3285
3285
 
3286
3286
  /***/ }),
3287
3287
 
3288
- /***/ 108:
3288
+ /***/ 11:
3289
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3290
+
3291
+ "use strict";
3292
+ /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
3293
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
3294
+ /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
3295
+
3296
+
3297
+
3298
+ var hasModal = false;
3299
+ var hasInitZIndex = false;
3300
+ // 跨模块副本共享的 z-index 计数器宿主。
3301
+ // 低代码等场景会用 eoss / eoss/src / eoss/packages 多种身份加载本文件,
3302
+ // 导致出现多份 PopupManager、各自从 2000 起算,出现“后弹出的层级反而比先弹出的小”。
3303
+ // 把计数器挂到全局,所有副本共用同一条单调递增序列。
3304
+ var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
3305
+
3306
+ var getModal = function getModal() {
3307
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
3308
+ var modalDom = PopupManager.modalDom;
3309
+ if (modalDom) {
3310
+ hasModal = true;
3311
+ } else {
3312
+ hasModal = false;
3313
+ modalDom = document.createElement('div');
3314
+ PopupManager.modalDom = modalDom;
3315
+
3316
+ modalDom.addEventListener('touchmove', function (event) {
3317
+ event.preventDefault();
3318
+ event.stopPropagation();
3319
+ });
3320
+
3321
+ modalDom.addEventListener('click', function () {
3322
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
3323
+ });
3324
+ }
3325
+
3326
+ return modalDom;
3327
+ };
3328
+
3329
+ var instances = {};
3330
+
3331
+ var PopupManager = {
3332
+ modalFade: true,
3333
+
3334
+ getInstance: function getInstance(id) {
3335
+ return instances[id];
3336
+ },
3337
+
3338
+ register: function register(id, instance) {
3339
+ if (id && instance) {
3340
+ instances[id] = instance;
3341
+ }
3342
+ },
3343
+
3344
+ deregister: function deregister(id) {
3345
+ if (id) {
3346
+ instances[id] = null;
3347
+ delete instances[id];
3348
+ }
3349
+ },
3350
+
3351
+ nextZIndex: function nextZIndex() {
3352
+ return PopupManager.zIndex++;
3353
+ },
3354
+
3355
+ modalStack: [],
3356
+
3357
+ doOnModalClick: function doOnModalClick() {
3358
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
3359
+ if (!topItem) return;
3360
+
3361
+ var instance = PopupManager.getInstance(topItem.id);
3362
+ if (instance && instance.closeOnClickModal) {
3363
+ instance.close();
3364
+ }
3365
+ },
3366
+
3367
+ openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
3368
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
3369
+ if (!id || zIndex === undefined) return;
3370
+ this.modalFade = modalFade;
3371
+
3372
+ var modalStack = this.modalStack;
3373
+
3374
+ for (var i = 0, j = modalStack.length; i < j; i++) {
3375
+ var item = modalStack[i];
3376
+ if (item.id === id) {
3377
+ return;
3378
+ }
3379
+ }
3380
+
3381
+ var modalDom = getModal();
3382
+
3383
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal');
3384
+ if (this.modalFade && !hasModal) {
3385
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter');
3386
+ }
3387
+ if (modalClass) {
3388
+ var classArr = modalClass.trim().split(/\s+/);
3389
+ classArr.forEach(function (item) {
3390
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item);
3391
+ });
3392
+ }
3393
+ setTimeout(function () {
3394
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-enter');
3395
+ }, 200);
3396
+
3397
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
3398
+ dom.parentNode.appendChild(modalDom);
3399
+ } else {
3400
+ document.body.appendChild(modalDom);
3401
+ }
3402
+
3403
+ if (zIndex) {
3404
+ modalDom.style.zIndex = zIndex;
3405
+ }
3406
+ modalDom.tabIndex = 0;
3407
+ modalDom.style.display = '';
3408
+
3409
+ this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
3410
+ },
3411
+
3412
+ closeModal: function closeModal(id) {
3413
+ var modalStack = this.modalStack;
3414
+ var modalDom = getModal();
3415
+ var topItem = null;
3416
+
3417
+ if (modalStack.length > 0) {
3418
+ topItem = modalStack[modalStack.length - 1];
3419
+ if (topItem.id === id) {
3420
+ modalStack.pop();
3421
+ if (modalStack.length > 0) {
3422
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
3423
+ }
3424
+ } else {
3425
+ for (var i = modalStack.length - 1; i >= 0; i--) {
3426
+ if (modalStack[i].id === id) {
3427
+ modalStack.splice(i, 1);
3428
+ break;
3429
+ }
3430
+ }
3431
+ }
3432
+ }
3433
+
3434
+ if (modalStack.length === 0) {
3435
+ if (this.modalFade) {
3436
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave');
3437
+ }
3438
+ setTimeout(function () {
3439
+ if (modalStack.length === 0) {
3440
+ if (topItem && topItem.modalClass) {
3441
+ var classArr = topItem.modalClass.trim().split(/\s+/);
3442
+ classArr.forEach(function (item) {
3443
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
3444
+ });
3445
+ }
3446
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
3447
+ modalDom.style.display = 'none';
3448
+ PopupManager.modalDom = undefined;
3449
+ }
3450
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-leave');
3451
+ }, 200);
3452
+ } else {
3453
+ if (topItem && topItem.modalClass) {
3454
+ var classArr = topItem.modalClass.trim().split(/\s+/);
3455
+ classArr.forEach(function (item) {
3456
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
3457
+ });
3458
+ }
3459
+ }
3460
+ }
3461
+ };
3462
+
3463
+ Object.defineProperty(PopupManager, 'zIndex', {
3464
+ configurable: true,
3465
+ get: function get() {
3466
+ if (!hasInitZIndex) {
3467
+ if (globalScope.__EOSS_ZINDEX__ === undefined) {
3468
+ globalScope.__EOSS_ZINDEX__ = (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$EOSS || {}).zIndex || 2000;
3469
+ }
3470
+ hasInitZIndex = true;
3471
+ }
3472
+ return globalScope.__EOSS_ZINDEX__;
3473
+ },
3474
+ set: function set(value) {
3475
+ globalScope.__EOSS_ZINDEX__ = value;
3476
+ }
3477
+ });
3478
+
3479
+ var getTopPopup = function getTopPopup() {
3480
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
3481
+ if (PopupManager.modalStack.length > 0) {
3482
+ var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
3483
+ if (!topPopup) return;
3484
+ var instance = PopupManager.getInstance(topPopup.id);
3485
+
3486
+ return instance;
3487
+ }
3488
+ };
3489
+
3490
+ if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
3491
+ // handle `esc` key when the popup is shown
3492
+ window.addEventListener('keydown', function (event) {
3493
+ if (event.keyCode === 27) {
3494
+ var topPopup = getTopPopup();
3495
+
3496
+ if (topPopup && topPopup.closeOnPressEscape) {
3497
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
3498
+ }
3499
+ }
3500
+ });
3501
+ }
3502
+
3503
+ /* harmony default export */ __webpack_exports__["a"] = (PopupManager);
3504
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(45)))
3505
+
3506
+ /***/ }),
3507
+
3508
+ /***/ 110:
3289
3509
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3290
3510
 
3291
3511
  "use strict";
3292
3512
 
3293
- // 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&
3513
+ // 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&
3294
3514
  var render = function () {
3295
3515
  var _vm = this
3296
3516
  var _h = _vm.$createElement
@@ -3574,7 +3794,7 @@ var render = function () {
3574
3794
  "close-icon": _vm.closeIcon,
3575
3795
  isFourthTabs: _vm.isFourthTabs,
3576
3796
  iconColors: _vm.iconColors,
3577
- iconColor: _vm.getColor(index),
3797
+ iconColor: _vm.getColor(index, item),
3578
3798
  },
3579
3799
  },
3580
3800
  "component",
@@ -3597,16 +3817,16 @@ var staticRenderFns = []
3597
3817
  render._withStripped = true
3598
3818
 
3599
3819
 
3600
- // CONCATENATED MODULE: ./packages/menu/src/submenu.vue?vue&type=template&id=146e2160&
3820
+ // CONCATENATED MODULE: ./packages/menu/src/submenu.vue?vue&type=template&id=09f0751a&
3601
3821
 
3602
3822
  // EXTERNAL MODULE: ./src/utils/scrollbar.js
3603
3823
  var scrollbar = __webpack_require__(23);
3604
3824
 
3605
3825
  // EXTERNAL MODULE: ./packages/menu/src/mixins.js
3606
- var mixins = __webpack_require__(80);
3826
+ var mixins = __webpack_require__(81);
3607
3827
 
3608
3828
  // EXTERNAL MODULE: ./packages/menu/src/menu-mixin.js
3609
- var menu_mixin = __webpack_require__(67);
3829
+ var menu_mixin = __webpack_require__(68);
3610
3830
 
3611
3831
  // EXTERNAL MODULE: ./src/mixins/emitter.js
3612
3832
  var emitter = __webpack_require__(15);
@@ -3615,13 +3835,13 @@ var emitter = __webpack_require__(15);
3615
3835
  var vue_popper = __webpack_require__(27);
3616
3836
 
3617
3837
  // EXTERNAL MODULE: ./packages/menu/src/menu-item.vue + 4 modules
3618
- var menu_item = __webpack_require__(60);
3838
+ var menu_item = __webpack_require__(61);
3619
3839
 
3620
3840
  // EXTERNAL MODULE: ./packages/menu/src/menu-item-group.vue + 4 modules
3621
- var menu_item_group = __webpack_require__(82);
3841
+ var menu_item_group = __webpack_require__(84);
3622
3842
 
3623
3843
  // EXTERNAL MODULE: ./src/transitions/collapse-transition.js
3624
- var collapse_transition = __webpack_require__(69);
3844
+ var collapse_transition = __webpack_require__(70);
3625
3845
 
3626
3846
  // EXTERNAL MODULE: external "eoss/lib/icon"
3627
3847
  var icon_ = __webpack_require__(26);
@@ -3947,8 +4167,10 @@ var poperMixins = {
3947
4167
  return this.collapse ? 'es-zoom-in-left' : 'es-zoom-in-top';
3948
4168
  },
3949
4169
  opened: function opened() {
3950
- var open = this.open && !this.collapse || this.index && this.rootMenu.openedMenus.indexOf(this.index) > -1;
3951
- return open;
4170
+ // 展开状态统一由 rootMenu.openedMenus 驱动,
4171
+ // open 属性仅作为默认展开的初始值(见 syncOpenProp),不参与计算,
4172
+ // 否则 open 为 true 时会短路导致点击无法折叠
4173
+ return !!this.index && this.rootMenu.openedMenus.indexOf(this.index) > -1;
3952
4174
  },
3953
4175
  active: function active() {
3954
4176
  var isActive = false;
@@ -4047,6 +4269,15 @@ var poperMixins = {
4047
4269
  });
4048
4270
  }
4049
4271
  },
4272
+ open: function open() {
4273
+ this.syncOpenProp();
4274
+ },
4275
+ collapse: function collapse(val) {
4276
+ // 整菜单收起会清空 openedMenus,取消收起后按 open 属性恢复默认展开
4277
+ if (!val) {
4278
+ this.syncOpenProp();
4279
+ }
4280
+ },
4050
4281
  iconColors: function iconColors() {
4051
4282
  // 当iconColors变化时,清除缓存
4052
4283
  this._colorCache = null;
@@ -4087,6 +4318,28 @@ var poperMixins = {
4087
4318
  },
4088
4319
 
4089
4320
  methods: {
4321
+ /**
4322
+ * 同步 open 属性到 rootMenu.openedMenus:
4323
+ * open 语义为“默认展开”,写入 openedMenus 后仍可被点击正常折叠/展开
4324
+ */
4325
+ syncOpenProp: function syncOpenProp() {
4326
+ if (!this.index || this.collapse) {
4327
+ return;
4328
+ }
4329
+ var rootMenu = this.rootMenu;
4330
+ var isOpened = rootMenu.openedMenus.indexOf(this.index) > -1;
4331
+ if (this.open && !isOpened) {
4332
+ // 默认展开直接写入 openedMenus,不走 openMenu 的 uniqueOpened 过滤:
4333
+ // 嵌套子菜单内层先于外层 mounted,若走 openMenu,
4334
+ // 外层展开时会把不在其 indexPath 上的内层默认展开过滤收起
4335
+ rootMenu.openedMenus.push(this.index);
4336
+ rootMenu.$nextTick(function () {
4337
+ return rootMenu.updated();
4338
+ });
4339
+ } else if (!this.open && isOpened) {
4340
+ rootMenu.closeMenu(this.index);
4341
+ }
4342
+ },
4090
4343
  handleCollapseToggle: function handleCollapseToggle(value) {
4091
4344
  if (value) {
4092
4345
  this.initPopper();
@@ -4194,6 +4447,7 @@ var poperMixins = {
4194
4447
  this.parentMenu.addSubmenu(this);
4195
4448
  this.rootMenu.addSubmenu(this);
4196
4449
  this.initPopper();
4450
+ this.syncOpenProp();
4197
4451
  },
4198
4452
  updated: function updated() {
4199
4453
  var _this5 = this;
@@ -4245,239 +4499,19 @@ var component = Object(componentNormalizer["a" /* default */])(
4245
4499
 
4246
4500
  /***/ }),
4247
4501
 
4248
- /***/ 11:
4502
+ /***/ 12:
4249
4503
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4250
4504
 
4251
4505
  "use strict";
4252
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
4253
- /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
4254
- /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
4255
-
4256
-
4257
-
4258
- var hasModal = false;
4259
- var hasInitZIndex = false;
4260
- // 跨模块副本共享的 z-index 计数器宿主。
4261
- // 低代码等场景会用 eoss / eoss/src / eoss/packages 多种身份加载本文件,
4262
- // 导致出现多份 PopupManager、各自从 2000 起算,出现“后弹出的层级反而比先弹出的小”。
4263
- // 把计数器挂到全局,所有副本共用同一条单调递增序列。
4264
- var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
4265
-
4266
- var getModal = function getModal() {
4267
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
4268
- var modalDom = PopupManager.modalDom;
4269
- if (modalDom) {
4270
- hasModal = true;
4271
- } else {
4272
- hasModal = false;
4273
- modalDom = document.createElement('div');
4274
- PopupManager.modalDom = modalDom;
4275
-
4276
- modalDom.addEventListener('touchmove', function (event) {
4277
- event.preventDefault();
4278
- event.stopPropagation();
4279
- });
4280
-
4281
- modalDom.addEventListener('click', function () {
4282
- PopupManager.doOnModalClick && PopupManager.doOnModalClick();
4283
- });
4284
- }
4285
-
4286
- return modalDom;
4287
- };
4288
-
4289
- var instances = {};
4290
-
4291
- var PopupManager = {
4292
- modalFade: true,
4293
-
4294
- getInstance: function getInstance(id) {
4295
- return instances[id];
4296
- },
4297
-
4298
- register: function register(id, instance) {
4299
- if (id && instance) {
4300
- instances[id] = instance;
4301
- }
4302
- },
4303
-
4304
- deregister: function deregister(id) {
4305
- if (id) {
4306
- instances[id] = null;
4307
- delete instances[id];
4308
- }
4309
- },
4310
-
4311
- nextZIndex: function nextZIndex() {
4312
- return PopupManager.zIndex++;
4313
- },
4314
-
4315
- modalStack: [],
4316
-
4317
- doOnModalClick: function doOnModalClick() {
4318
- var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
4319
- if (!topItem) return;
4320
-
4321
- var instance = PopupManager.getInstance(topItem.id);
4322
- if (instance && instance.closeOnClickModal) {
4323
- instance.close();
4324
- }
4325
- },
4326
-
4327
- openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
4328
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
4329
- if (!id || zIndex === undefined) return;
4330
- this.modalFade = modalFade;
4331
-
4332
- var modalStack = this.modalStack;
4333
-
4334
- for (var i = 0, j = modalStack.length; i < j; i++) {
4335
- var item = modalStack[i];
4336
- if (item.id === id) {
4337
- return;
4338
- }
4339
- }
4340
-
4341
- var modalDom = getModal();
4342
-
4343
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal');
4344
- if (this.modalFade && !hasModal) {
4345
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter');
4346
- }
4347
- if (modalClass) {
4348
- var classArr = modalClass.trim().split(/\s+/);
4349
- classArr.forEach(function (item) {
4350
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item);
4351
- });
4352
- }
4353
- setTimeout(function () {
4354
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-enter');
4355
- }, 200);
4356
-
4357
- if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
4358
- dom.parentNode.appendChild(modalDom);
4359
- } else {
4360
- document.body.appendChild(modalDom);
4361
- }
4362
-
4363
- if (zIndex) {
4364
- modalDom.style.zIndex = zIndex;
4365
- }
4366
- modalDom.tabIndex = 0;
4367
- modalDom.style.display = '';
4368
-
4369
- this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
4370
- },
4371
-
4372
- closeModal: function closeModal(id) {
4373
- var modalStack = this.modalStack;
4374
- var modalDom = getModal();
4375
- var topItem = null;
4376
-
4377
- if (modalStack.length > 0) {
4378
- topItem = modalStack[modalStack.length - 1];
4379
- if (topItem.id === id) {
4380
- modalStack.pop();
4381
- if (modalStack.length > 0) {
4382
- modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
4383
- }
4384
- } else {
4385
- for (var i = modalStack.length - 1; i >= 0; i--) {
4386
- if (modalStack[i].id === id) {
4387
- modalStack.splice(i, 1);
4388
- break;
4389
- }
4390
- }
4391
- }
4392
- }
4393
-
4394
- if (modalStack.length === 0) {
4395
- if (this.modalFade) {
4396
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave');
4397
- }
4398
- setTimeout(function () {
4399
- if (modalStack.length === 0) {
4400
- if (topItem && topItem.modalClass) {
4401
- var classArr = topItem.modalClass.trim().split(/\s+/);
4402
- classArr.forEach(function (item) {
4403
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
4404
- });
4405
- }
4406
- if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
4407
- modalDom.style.display = 'none';
4408
- PopupManager.modalDom = undefined;
4409
- }
4410
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-leave');
4411
- }, 200);
4412
- } else {
4413
- if (topItem && topItem.modalClass) {
4414
- var classArr = topItem.modalClass.trim().split(/\s+/);
4415
- classArr.forEach(function (item) {
4416
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
4417
- });
4418
- }
4419
- }
4420
- }
4421
- };
4422
-
4423
- Object.defineProperty(PopupManager, 'zIndex', {
4424
- configurable: true,
4425
- get: function get() {
4426
- if (!hasInitZIndex) {
4427
- if (globalScope.__EOSS_ZINDEX__ === undefined) {
4428
- globalScope.__EOSS_ZINDEX__ = (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$EOSS || {}).zIndex || 2000;
4429
- }
4430
- hasInitZIndex = true;
4431
- }
4432
- return globalScope.__EOSS_ZINDEX__;
4433
- },
4434
- set: function set(value) {
4435
- globalScope.__EOSS_ZINDEX__ = value;
4436
- }
4437
- });
4438
-
4439
- var getTopPopup = function getTopPopup() {
4440
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
4441
- if (PopupManager.modalStack.length > 0) {
4442
- var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
4443
- if (!topPopup) return;
4444
- var instance = PopupManager.getInstance(topPopup.id);
4445
-
4446
- return instance;
4447
- }
4448
- };
4449
-
4450
- if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
4451
- // handle `esc` key when the popup is shown
4452
- window.addEventListener('keydown', function (event) {
4453
- if (event.keyCode === 27) {
4454
- var topPopup = getTopPopup();
4455
-
4456
- if (topPopup && topPopup.closeOnPressEscape) {
4457
- topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
4458
- }
4459
- }
4460
- });
4461
- }
4462
-
4463
- /* harmony default export */ __webpack_exports__["a"] = (PopupManager);
4464
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(45)))
4465
-
4466
- /***/ }),
4467
-
4468
- /***/ 12:
4469
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4470
-
4471
- "use strict";
4472
- /* unused harmony export getHue */
4473
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getColor; });
4474
- /* unused harmony export getLightness */
4475
- /* unused harmony export getSaturation */
4476
- /* unused harmony export rgbToHsv */
4477
- /* unused harmony export hsvTorgb */
4478
- /* unused harmony export mixColor */
4479
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getRgb; });
4480
- /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
4506
+ /* unused harmony export getHue */
4507
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getColor; });
4508
+ /* unused harmony export getLightness */
4509
+ /* unused harmony export getSaturation */
4510
+ /* unused harmony export rgbToHsv */
4511
+ /* unused harmony export hsvTorgb */
4512
+ /* unused harmony export mixColor */
4513
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getRgb; });
4514
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
4481
4515
 
4482
4516
  var $hueStep = 2;
4483
4517
  var $saturationStep1 = 0.16;
@@ -4741,7 +4775,7 @@ module.exports = require("vue");
4741
4775
 
4742
4776
  /***/ }),
4743
4777
 
4744
- /***/ 206:
4778
+ /***/ 213:
4745
4779
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4746
4780
 
4747
4781
  "use strict";
@@ -4850,19 +4884,19 @@ menuvue_type_template_id_31887554_render._withStripped = true
4850
4884
  // CONCATENATED MODULE: ./packages/menu/src/menu.vue?vue&type=template&id=31887554&
4851
4885
 
4852
4886
  // EXTERNAL MODULE: ./packages/menu/src/mixins.js
4853
- var mixins = __webpack_require__(80);
4887
+ var mixins = __webpack_require__(81);
4854
4888
 
4855
4889
  // EXTERNAL MODULE: ./packages/menu/src/submenu.vue + 4 modules
4856
- var submenu = __webpack_require__(108);
4890
+ var submenu = __webpack_require__(110);
4857
4891
 
4858
4892
  // EXTERNAL MODULE: ./packages/menu/src/menu-item.vue + 4 modules
4859
- var menu_item = __webpack_require__(60);
4893
+ var menu_item = __webpack_require__(61);
4860
4894
 
4861
4895
  // EXTERNAL MODULE: ./src/components/bar.js
4862
- var bar = __webpack_require__(58);
4896
+ var bar = __webpack_require__(59);
4863
4897
 
4864
4898
  // EXTERNAL MODULE: ./packages/menu/src/menu-item-group.vue + 4 modules
4865
- var menu_item_group = __webpack_require__(82);
4899
+ var menu_item_group = __webpack_require__(84);
4866
4900
 
4867
4901
  // EXTERNAL MODULE: ./src/mixins/emitter.js
4868
4902
  var emitter = __webpack_require__(15);
@@ -4871,7 +4905,7 @@ var emitter = __webpack_require__(15);
4871
4905
  var migrating = __webpack_require__(46);
4872
4906
 
4873
4907
  // EXTERNAL MODULE: ./src/utils/aria-utils.js
4874
- var aria_utils = __webpack_require__(61);
4908
+ var aria_utils = __webpack_require__(62);
4875
4909
 
4876
4910
  // CONCATENATED MODULE: ./src/utils/menu/aria-submenu.js
4877
4911
 
@@ -5909,7 +5943,7 @@ module.exports = require("eoss/lib/icon");
5909
5943
 
5910
5944
 
5911
5945
 
5912
- var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(52);
5946
+ var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(53);
5913
5947
  var stopPropagation = function stopPropagation(e) {
5914
5948
  return e.stopPropagation();
5915
5949
  };
@@ -6955,10 +6989,12 @@ function insertAfter(newEl, targetEl) {
6955
6989
 
6956
6990
  /***/ }),
6957
6991
 
6958
- /***/ 52:
6992
+ /***/ 53:
6959
6993
  /***/ (function(module, exports, __webpack_require__) {
6960
6994
 
6961
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
6995
+ 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; };
6996
+
6997
+ /**
6962
6998
  * @fileOverview Kickass library to create and place poppers near their reference elements.
6963
6999
  * @version {{version}}
6964
7000
  * @license
@@ -6981,68 +7017,60 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
6981
7017
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6982
7018
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
6983
7019
  * SOFTWARE.
6984
- */
6985
-
6986
- //
6987
- // Cross module loader
6988
- // Supported: Node, AMD, Browser globals
6989
- //
6990
- (function (root, factory) {
6991
- if (true) {
6992
- // AMD. Register as an anonymous module.
7020
+ */
7021
+
7022
+ //
7023
+ // Cross module loader
7024
+ // Supported: Node, AMD, Browser globals
7025
+ //
7026
+ (function (root, factory) {
7027
+ if (true) {
7028
+ // AMD. Register as an anonymous module.
6993
7029
  !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
6994
7030
  __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
6995
7031
  (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
6996
7032
  __WEBPACK_AMD_DEFINE_FACTORY__),
6997
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
6998
- } else {}
6999
- })(this, function () {
7000
- 'use strict';
7001
-
7002
- var root = window;
7003
- // default options
7004
- var DEFAULTS = {
7005
- // placement of the popper
7006
- placement: 'bottom',
7007
-
7008
- gpuAcceleration: true,
7009
-
7010
- // shift popper from its origin by the given amount of pixels (can be negative)
7011
- offset: 0,
7012
-
7013
- // the element which will act as boundary of the popper
7014
- boundariesElement: 'viewport',
7015
-
7016
- // amount of pixel used to define a minimum distance between the boundaries and the popper
7017
- boundariesPadding: 5,
7018
-
7019
- // popper will try to prevent overflow following this order,
7020
- // by default, then, it could overflow on the left and on top of the boundariesElement
7021
- preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
7022
-
7023
- // the behavior used by flip to change the placement of the popper
7024
- flipBehavior: 'flip',
7025
-
7026
- arrowElement: '[x-arrow]',
7027
-
7028
- arrowOffset: 0,
7029
-
7030
- // list of functions used to modify the offsets before they are applied to the popper
7031
- modifiers: [
7032
- 'shift',
7033
- 'offset',
7034
- 'preventOverflow',
7035
- 'keepTogether',
7036
- 'arrow',
7037
- 'flip',
7038
- 'applyStyle'
7039
- ],
7040
-
7041
- modifiersIgnored: [],
7042
-
7043
- forceAbsolute: false
7044
- };
7045
-
7033
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
7034
+ } else {}
7035
+ })(this, function () {
7036
+ 'use strict';
7037
+
7038
+ var root = window;
7039
+ // default options
7040
+ var DEFAULTS = {
7041
+ // placement of the popper
7042
+ placement: 'bottom',
7043
+
7044
+ gpuAcceleration: true,
7045
+
7046
+ // shift popper from its origin by the given amount of pixels (can be negative)
7047
+ offset: 0,
7048
+
7049
+ // the element which will act as boundary of the popper
7050
+ boundariesElement: 'viewport',
7051
+
7052
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
7053
+ boundariesPadding: 5,
7054
+
7055
+ // popper will try to prevent overflow following this order,
7056
+ // by default, then, it could overflow on the left and on top of the boundariesElement
7057
+ preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
7058
+
7059
+ // the behavior used by flip to change the placement of the popper
7060
+ flipBehavior: 'flip',
7061
+
7062
+ arrowElement: '[x-arrow]',
7063
+
7064
+ arrowOffset: 0,
7065
+
7066
+ // list of functions used to modify the offsets before they are applied to the popper
7067
+ modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
7068
+
7069
+ modifiersIgnored: [],
7070
+
7071
+ forceAbsolute: false
7072
+ };
7073
+
7046
7074
  /**
7047
7075
  * Create a new Popper.js instance
7048
7076
  * @constructor Popper
@@ -7107,125 +7135,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7107
7135
  *
7108
7136
  * @param {Boolean} [options.removeOnDestroy=false]
7109
7137
  * Set to true if you want to automatically remove the popper when you call the `destroy` method.
7110
- */
7111
- function Popper(reference, popper, options) {
7112
- this._reference = reference.jquery ? reference[0] : reference;
7113
- this.state = {};
7114
-
7115
- // if the popper variable is a configuration object, parse it to generate an HTMLElement
7116
- // generate a default popper if is not defined
7117
- var isNotDefined = typeof popper === 'undefined' || popper === null;
7118
- var isConfig =
7119
- popper && Object.prototype.toString.call(popper) === '[object Object]';
7120
- if (isNotDefined || isConfig) {
7121
- this._popper = this.parse(isConfig ? popper : {});
7122
- }
7123
- // otherwise, use the given HTMLElement as popper
7124
- else {
7125
- this._popper = popper.jquery ? popper[0] : popper;
7126
- }
7127
-
7128
- // with {} we create a new object with the options inside it
7129
- this._options = Object.assign({}, DEFAULTS, options);
7130
-
7131
- // refactoring modifiers' list
7132
- this._options.modifiers = this._options.modifiers.map(
7133
- function (modifier) {
7134
- // remove ignored modifiers
7135
- if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
7136
-
7137
- // set the x-placement attribute before everything else because it could be used to add margins to the popper
7138
- // margins needs to be calculated to get the correct popper offsets
7139
- if (modifier === 'applyStyle') {
7140
- this._popper.setAttribute('x-placement', this._options.placement);
7141
- }
7142
-
7143
- // return predefined modifier identified by string or keep the custom one
7144
- return this.modifiers[modifier] || modifier;
7145
- }.bind(this)
7146
- );
7147
-
7148
- // make sure to apply the popper position before any computation
7149
- this.state.position = this._getPosition(this._popper, this._reference);
7150
- setStyle(this._popper, { position: this.state.position, top: 0 });
7151
-
7152
- // fire the first update to position the popper in the right place
7153
- this.update();
7154
-
7155
- // setup event listeners, they will take care of update the position in specific situations
7156
- this._setupEventListeners();
7157
- return this;
7158
- }
7159
-
7160
- //
7161
- // Methods
7162
- //
7138
+ */
7139
+ function Popper(reference, popper, options) {
7140
+ this._reference = reference.jquery ? reference[0] : reference;
7141
+ this.state = {};
7142
+
7143
+ // if the popper variable is a configuration object, parse it to generate an HTMLElement
7144
+ // generate a default popper if is not defined
7145
+ var isNotDefined = typeof popper === 'undefined' || popper === null;
7146
+ var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
7147
+ if (isNotDefined || isConfig) {
7148
+ this._popper = this.parse(isConfig ? popper : {});
7149
+ }
7150
+ // otherwise, use the given HTMLElement as popper
7151
+ else {
7152
+ this._popper = popper.jquery ? popper[0] : popper;
7153
+ }
7154
+
7155
+ // with {} we create a new object with the options inside it
7156
+ this._options = Object.assign({}, DEFAULTS, options);
7157
+
7158
+ // refactoring modifiers' list
7159
+ this._options.modifiers = this._options.modifiers.map(function (modifier) {
7160
+ // remove ignored modifiers
7161
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
7162
+
7163
+ // set the x-placement attribute before everything else because it could be used to add margins to the popper
7164
+ // margins needs to be calculated to get the correct popper offsets
7165
+ if (modifier === 'applyStyle') {
7166
+ this._popper.setAttribute('x-placement', this._options.placement);
7167
+ }
7168
+
7169
+ // return predefined modifier identified by string or keep the custom one
7170
+ return this.modifiers[modifier] || modifier;
7171
+ }.bind(this));
7172
+
7173
+ // make sure to apply the popper position before any computation
7174
+ this.state.position = this._getPosition(this._popper, this._reference);
7175
+ setStyle(this._popper, { position: this.state.position, top: 0 });
7176
+
7177
+ // fire the first update to position the popper in the right place
7178
+ this.update();
7179
+
7180
+ // setup event listeners, they will take care of update the position in specific situations
7181
+ this._setupEventListeners();
7182
+ return this;
7183
+ }
7184
+
7185
+ //
7186
+ // Methods
7187
+ //
7163
7188
  /**
7164
7189
  * Destroy the popper
7165
7190
  * @method
7166
7191
  * @memberof Popper
7167
- */
7168
- Popper.prototype.destroy = function () {
7169
- this._popper.removeAttribute('x-placement');
7170
- this._popper.style.left = '';
7171
- this._popper.style.position = '';
7172
- this._popper.style.top = '';
7173
- this._popper.style[getSupportedPropertyName('transform')] = '';
7174
- this._removeEventListeners();
7175
-
7176
- // remove the popper if user explicity asked for the deletion on destroy
7177
- if (this._options.removeOnDestroy) {
7178
- this._popper.remove();
7179
- }
7180
- return this;
7181
- };
7182
-
7192
+ */
7193
+ Popper.prototype.destroy = function () {
7194
+ this._popper.removeAttribute('x-placement');
7195
+ this._popper.style.left = '';
7196
+ this._popper.style.position = '';
7197
+ this._popper.style.top = '';
7198
+ this._popper.style[getSupportedPropertyName('transform')] = '';
7199
+ this._removeEventListeners();
7200
+
7201
+ // remove the popper if user explicity asked for the deletion on destroy
7202
+ if (this._options.removeOnDestroy) {
7203
+ this._popper.remove();
7204
+ }
7205
+ return this;
7206
+ };
7207
+
7183
7208
  /**
7184
7209
  * Updates the position of the popper, computing the new offsets and applying the new style
7185
7210
  * @method
7186
7211
  * @memberof Popper
7187
- */
7188
- Popper.prototype.update = function () {
7189
- var data = { instance: this, styles: {} };
7190
-
7191
- // store placement inside the data object, modifiers will be able to edit `placement` if needed
7192
- // and refer to _originalPlacement to know the original value
7193
- data.placement = this._options.placement;
7194
- data._originalPlacement = this._options.placement;
7195
-
7196
- // compute the popper and reference offsets and put them inside data.offsets
7197
- data.offsets = this._getOffsets(
7198
- this._popper,
7199
- this._reference,
7200
- data.placement
7201
- );
7202
-
7203
- // get boundaries
7204
- data.boundaries = this._getBoundaries(
7205
- data,
7206
- this._options.boundariesPadding,
7207
- this._options.boundariesElement
7208
- );
7209
-
7210
- data = this.runModifiers(data, this._options.modifiers);
7211
-
7212
- if (typeof this.state.updateCallback === 'function') {
7213
- this.state.updateCallback(data);
7214
- }
7215
- };
7216
-
7217
- /**
7218
- * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
7219
- * @method
7220
- * @memberof Popper
7212
+ */
7213
+ Popper.prototype.update = function () {
7214
+ var data = { instance: this, styles: {} };
7215
+
7216
+ // store placement inside the data object, modifiers will be able to edit `placement` if needed
7217
+ // and refer to _originalPlacement to know the original value
7218
+ data.placement = this._options.placement;
7219
+ data._originalPlacement = this._options.placement;
7220
+
7221
+ // compute the popper and reference offsets and put them inside data.offsets
7222
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
7223
+
7224
+ // get boundaries
7225
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
7226
+
7227
+ data = this.runModifiers(data, this._options.modifiers);
7228
+
7229
+ if (typeof this.state.updateCallback === 'function') {
7230
+ this.state.updateCallback(data);
7231
+ }
7232
+ };
7233
+
7234
+ /**
7235
+ * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
7236
+ * @method
7237
+ * @memberof Popper
7221
7238
  * @param {Function} callback
7222
- */
7223
- Popper.prototype.onCreate = function (callback) {
7224
- // the createCallbacks return as first argument the popper instance
7225
- callback(this);
7226
- return this;
7227
- };
7228
-
7239
+ */
7240
+ Popper.prototype.onCreate = function (callback) {
7241
+ // the createCallbacks return as first argument the popper instance
7242
+ callback(this);
7243
+ return this;
7244
+ };
7245
+
7229
7246
  /**
7230
7247
  * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
7231
7248
  * used to style popper and its arrow.
@@ -7233,101 +7250,93 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7233
7250
  * @method
7234
7251
  * @memberof Popper
7235
7252
  * @param {Function} callback
7236
- */
7237
- Popper.prototype.onUpdate = function (callback) {
7238
- this.state.updateCallback = callback;
7239
- return this;
7240
- };
7241
-
7253
+ */
7254
+ Popper.prototype.onUpdate = function (callback) {
7255
+ this.state.updateCallback = callback;
7256
+ return this;
7257
+ };
7258
+
7242
7259
  /**
7243
7260
  * Helper used to generate poppers from a configuration file
7244
7261
  * @method
7245
7262
  * @memberof Popper
7246
7263
  * @param config {Object} configuration
7247
7264
  * @returns {HTMLElement} popper
7248
- */
7249
- Popper.prototype.parse = function (config) {
7250
- var defaultConfig = {
7251
- tagName: 'div',
7252
- classNames: ['popper'],
7253
- attributes: [],
7254
- parent: root.document.body,
7255
- content: '',
7256
- contentType: 'text',
7257
- arrowTagName: 'div',
7258
- arrowClassNames: ['popper__arrow'],
7259
- arrowAttributes: ['x-arrow']
7260
- };
7261
- config = Object.assign({}, defaultConfig, config);
7262
-
7263
- var d = root.document;
7264
-
7265
- var popper = d.createElement(config.tagName);
7266
- addClassNames(popper, config.classNames);
7267
- addAttributes(popper, config.attributes);
7268
- if (config.contentType === 'node') {
7269
- popper.appendChild(
7270
- config.content.jquery ? config.content[0] : config.content
7271
- );
7272
- } else if (config.contentType === 'html') {
7273
- popper.innerHTML = config.content;
7274
- } else {
7275
- popper.textContent = config.content;
7276
- }
7277
-
7278
- if (config.arrowTagName) {
7279
- var arrow = d.createElement(config.arrowTagName);
7280
- addClassNames(arrow, config.arrowClassNames);
7281
- addAttributes(arrow, config.arrowAttributes);
7282
- popper.appendChild(arrow);
7283
- }
7284
-
7285
- var parent = config.parent.jquery ? config.parent[0] : config.parent;
7286
-
7287
- // if the given parent is a string, use it to match an element
7288
- // if more than one element is matched, the first one will be used as parent
7289
- // if no elements are matched, the script will throw an error
7290
- if (typeof parent === 'string') {
7291
- parent = d.querySelectorAll(config.parent);
7292
- if (parent.length > 1) {
7293
- console.warn(
7294
- 'WARNING: the given `parent` query(' +
7295
- config.parent +
7296
- ') matched more than one element, the first one will be used'
7297
- );
7298
- }
7299
- if (parent.length === 0) {
7300
- throw "ERROR: the given `parent` doesn't exists!";
7301
- }
7302
- parent = parent[0];
7303
- }
7304
- // if the given parent is a DOM nodes list or an array of nodes with more than one element,
7305
- // the first one will be used as parent
7306
- if (parent.length > 1 && parent instanceof Element === false) {
7307
- console.warn(
7308
- 'WARNING: you have passed as parent a list of elements, the first one will be used'
7309
- );
7310
- parent = parent[0];
7311
- }
7312
-
7313
- // append the generated popper to its parent
7314
- parent.appendChild(popper);
7315
-
7316
- return popper;
7317
-
7265
+ */
7266
+ Popper.prototype.parse = function (config) {
7267
+ var defaultConfig = {
7268
+ tagName: 'div',
7269
+ classNames: ['popper'],
7270
+ attributes: [],
7271
+ parent: root.document.body,
7272
+ content: '',
7273
+ contentType: 'text',
7274
+ arrowTagName: 'div',
7275
+ arrowClassNames: ['popper__arrow'],
7276
+ arrowAttributes: ['x-arrow']
7277
+ };
7278
+ config = Object.assign({}, defaultConfig, config);
7279
+
7280
+ var d = root.document;
7281
+
7282
+ var popper = d.createElement(config.tagName);
7283
+ addClassNames(popper, config.classNames);
7284
+ addAttributes(popper, config.attributes);
7285
+ if (config.contentType === 'node') {
7286
+ popper.appendChild(config.content.jquery ? config.content[0] : config.content);
7287
+ } else if (config.contentType === 'html') {
7288
+ popper.innerHTML = config.content;
7289
+ } else {
7290
+ popper.textContent = config.content;
7291
+ }
7292
+
7293
+ if (config.arrowTagName) {
7294
+ var arrow = d.createElement(config.arrowTagName);
7295
+ addClassNames(arrow, config.arrowClassNames);
7296
+ addAttributes(arrow, config.arrowAttributes);
7297
+ popper.appendChild(arrow);
7298
+ }
7299
+
7300
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
7301
+
7302
+ // if the given parent is a string, use it to match an element
7303
+ // if more than one element is matched, the first one will be used as parent
7304
+ // if no elements are matched, the script will throw an error
7305
+ if (typeof parent === 'string') {
7306
+ parent = d.querySelectorAll(config.parent);
7307
+ if (parent.length > 1) {
7308
+ console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
7309
+ }
7310
+ if (parent.length === 0) {
7311
+ throw "ERROR: the given `parent` doesn't exists!";
7312
+ }
7313
+ parent = parent[0];
7314
+ }
7315
+ // if the given parent is a DOM nodes list or an array of nodes with more than one element,
7316
+ // the first one will be used as parent
7317
+ if (parent.length > 1 && parent instanceof Element === false) {
7318
+ console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
7319
+ parent = parent[0];
7320
+ }
7321
+
7322
+ // append the generated popper to its parent
7323
+ parent.appendChild(popper);
7324
+
7325
+ return popper;
7326
+
7318
7327
  /**
7319
7328
  * Adds class names to the given element
7320
7329
  * @function
7321
7330
  * @ignore
7322
7331
  * @param {HTMLElement} target
7323
7332
  * @param {Array} classes
7324
- */
7325
- function addClassNames(element, classNames) {
7326
- classNames.forEach(function (className) {
7327
- element.classList.add(className);
7328
- });
7329
- }
7330
-
7333
+ */
7334
+ function addClassNames(element, classNames) {
7335
+ classNames.forEach(function (className) {
7336
+ element.classList.add(className);
7337
+ });
7338
+ }
7339
+
7331
7340
  /**
7332
7341
  * Adds attributes to the given element
7333
7342
  * @function
@@ -7336,17 +7345,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7336
7345
  * @param {Array} attributes
7337
7346
  * @example
7338
7347
  * addAttributes(element, [ 'data-info:foobar' ]);
7339
- */
7340
- function addAttributes(element, attributes) {
7341
- attributes.forEach(function (attribute) {
7342
- element.setAttribute(
7343
- attribute.split(':')[0],
7344
- attribute.split(':')[1] || ''
7345
- );
7346
- });
7347
- }
7348
- };
7349
-
7348
+ */
7349
+ function addAttributes(element, attributes) {
7350
+ attributes.forEach(function (attribute) {
7351
+ element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
7352
+ });
7353
+ }
7354
+ };
7355
+
7350
7356
  /**
7351
7357
  * Helper used to get the position which will be applied to the popper
7352
7358
  * @method
@@ -7354,20 +7360,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7354
7360
  * @param config {HTMLElement} popper element
7355
7361
  * @param reference {HTMLElement} reference element
7356
7362
  * @returns {String} position
7357
- */
7358
- Popper.prototype._getPosition = function (popper, reference) {
7359
- var container = getOffsetParent(reference);
7360
-
7361
- if (this._options.forceAbsolute) {
7362
- return 'absolute';
7363
- }
7364
-
7365
- // Decide if the popper will be fixed
7366
- // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
7367
- var isParentFixed = isFixed(reference, container);
7368
- return isParentFixed ? 'fixed' : 'absolute';
7369
- };
7370
-
7363
+ */
7364
+ Popper.prototype._getPosition = function (popper, reference) {
7365
+ var container = getOffsetParent(reference);
7366
+
7367
+ if (this._options.forceAbsolute) {
7368
+ return 'absolute';
7369
+ }
7370
+
7371
+ // Decide if the popper will be fixed
7372
+ // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
7373
+ var isParentFixed = isFixed(reference, container);
7374
+ return isParentFixed ? 'fixed' : 'absolute';
7375
+ };
7376
+
7371
7377
  /**
7372
7378
  * Get offsets to the popper
7373
7379
  * @method
@@ -7376,110 +7382,91 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7376
7382
  * @param {Element} popper - the popper element
7377
7383
  * @param {Element} reference - the reference element (the popper will be relative to this)
7378
7384
  * @returns {Object} An object containing the offsets which will be applied to the popper
7379
- */
7380
- Popper.prototype._getOffsets = function (popper, reference, placement) {
7381
- placement = placement.split('-')[0];
7382
- var popperOffsets = {};
7383
-
7384
- popperOffsets.position = this.state.position;
7385
- var isParentFixed = popperOffsets.position === 'fixed';
7386
-
7387
- //
7388
- // Get reference element position
7389
- //
7390
- var referenceOffsets = getOffsetRectRelativeToCustomParent(
7391
- reference,
7392
- popper,
7393
- isParentFixed
7394
- );
7395
-
7396
- //
7397
- // Get popper sizes
7398
- //
7399
- var popperRect = getOuterSizes(popper);
7400
-
7401
- //
7402
- // Compute offsets of popper
7403
- //
7404
-
7405
- // depending by the popper placement we have to compute its offsets slightly differently
7406
- if (['right', 'left'].indexOf(placement) !== -1) {
7407
- popperOffsets.top =
7408
- referenceOffsets.top +
7409
- referenceOffsets.height / 2 -
7410
- popperRect.height / 2;
7411
- if (placement === 'left') {
7412
- popperOffsets.left = referenceOffsets.left - popperRect.width;
7413
- } else {
7414
- popperOffsets.left = referenceOffsets.right;
7415
- }
7416
- } else {
7417
- popperOffsets.left =
7418
- referenceOffsets.left +
7419
- referenceOffsets.width / 2 -
7420
- popperRect.width / 2;
7421
- if (placement === 'top') {
7422
- popperOffsets.top = referenceOffsets.top - popperRect.height;
7423
- } else {
7424
- popperOffsets.top = referenceOffsets.bottom;
7425
- }
7426
- }
7427
-
7428
- // Add width and height to our offsets object
7429
- popperOffsets.width = popperRect.width;
7430
- popperOffsets.height = popperRect.height;
7431
-
7432
- return {
7433
- popper: popperOffsets,
7434
- reference: referenceOffsets
7435
- };
7436
- };
7437
-
7385
+ */
7386
+ Popper.prototype._getOffsets = function (popper, reference, placement) {
7387
+ placement = placement.split('-')[0];
7388
+ var popperOffsets = {};
7389
+
7390
+ popperOffsets.position = this.state.position;
7391
+ var isParentFixed = popperOffsets.position === 'fixed';
7392
+
7393
+ //
7394
+ // Get reference element position
7395
+ //
7396
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, popper, isParentFixed);
7397
+
7398
+ //
7399
+ // Get popper sizes
7400
+ //
7401
+ var popperRect = getOuterSizes(popper);
7402
+
7403
+ //
7404
+ // Compute offsets of popper
7405
+ //
7406
+
7407
+ // depending by the popper placement we have to compute its offsets slightly differently
7408
+ if (['right', 'left'].indexOf(placement) !== -1) {
7409
+ popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
7410
+ if (placement === 'left') {
7411
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
7412
+ } else {
7413
+ popperOffsets.left = referenceOffsets.right;
7414
+ }
7415
+ } else {
7416
+ popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
7417
+ if (placement === 'top') {
7418
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
7419
+ } else {
7420
+ popperOffsets.top = referenceOffsets.bottom;
7421
+ }
7422
+ }
7423
+
7424
+ // Add width and height to our offsets object
7425
+ popperOffsets.width = popperRect.width;
7426
+ popperOffsets.height = popperRect.height;
7427
+
7428
+ return {
7429
+ popper: popperOffsets,
7430
+ reference: referenceOffsets
7431
+ };
7432
+ };
7433
+
7438
7434
  /**
7439
7435
  * Setup needed event listeners used to update the popper position
7440
7436
  * @method
7441
7437
  * @memberof Popper
7442
7438
  * @access private
7443
- */
7444
- Popper.prototype._setupEventListeners = function () {
7445
- // NOTE: 1 DOM access here
7446
- this.state.updateBound = this.update.bind(this);
7447
- // 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
7448
- this.state.realWindow = getRealWindow(this._popper);
7449
- this.state.realWindow.addEventListener('resize', this.state.updateBound);
7450
- // if the boundariesElement is window we don't need to listen for the scroll event
7451
- if (this._options.boundariesElement !== 'window') {
7452
- var target = getScrollParent(this._reference);
7453
- target.addEventListener('scroll', this.state.updateBound);
7454
- this.state.scrollTarget = target;
7455
- }
7456
- };
7457
-
7439
+ */
7440
+ Popper.prototype._setupEventListeners = function () {
7441
+ // NOTE: 1 DOM access here
7442
+ this.state.updateBound = this.update.bind(this);
7443
+ // 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
7444
+ this.state.realWindow = getRealWindow(this._popper);
7445
+ this.state.realWindow.addEventListener('resize', this.state.updateBound);
7446
+ // if the boundariesElement is window we don't need to listen for the scroll event
7447
+ if (this._options.boundariesElement !== 'window') {
7448
+ var target = getScrollParent(this._reference);
7449
+ target.addEventListener('scroll', this.state.updateBound);
7450
+ this.state.scrollTarget = target;
7451
+ }
7452
+ };
7453
+
7458
7454
  /**
7459
7455
  * Remove event listeners used to update the popper position
7460
7456
  * @method
7461
7457
  * @memberof Popper
7462
7458
  * @access private
7463
- */
7464
- Popper.prototype._removeEventListeners = function () {
7465
- // NOTE: 1 DOM access here
7466
- (this.state.realWindow || root).removeEventListener(
7467
- 'resize',
7468
- this.state.updateBound
7469
- );
7470
- if (
7471
- this._options.boundariesElement !== 'window' &&
7472
- this.state.scrollTarget
7473
- ) {
7474
- this.state.scrollTarget.removeEventListener(
7475
- 'scroll',
7476
- this.state.updateBound
7477
- );
7478
- this.state.scrollTarget = null;
7479
- }
7480
- this.state.updateBound = null;
7481
- };
7482
-
7459
+ */
7460
+ Popper.prototype._removeEventListeners = function () {
7461
+ // NOTE: 1 DOM access here
7462
+ (this.state.realWindow || root).removeEventListener('resize', this.state.updateBound);
7463
+ if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
7464
+ this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
7465
+ this.state.scrollTarget = null;
7466
+ }
7467
+ this.state.updateBound = null;
7468
+ };
7469
+
7483
7470
  /**
7484
7471
  * Computed the boundaries limits and return them
7485
7472
  * @method
@@ -7489,75 +7476,56 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7489
7476
  * @param {Number} padding - Boundaries padding
7490
7477
  * @param {Element} boundariesElement - Element used to define the boundaries
7491
7478
  * @returns {Object} Coordinates of the boundaries
7492
- */
7493
- Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
7494
- // NOTE: 1 DOM access here
7495
- var boundaries = {};
7496
- var width, height;
7497
- if (boundariesElement === 'window') {
7498
- var body = root.document.body,
7499
- html = root.document.documentElement;
7500
-
7501
- height = Math.max(
7502
- body.scrollHeight,
7503
- body.offsetHeight,
7504
- html.clientHeight,
7505
- html.scrollHeight,
7506
- html.offsetHeight
7507
- );
7508
- width = Math.max(
7509
- body.scrollWidth,
7510
- body.offsetWidth,
7511
- html.clientWidth,
7512
- html.scrollWidth,
7513
- html.offsetWidth
7514
- );
7515
-
7516
- boundaries = {
7517
- top: 0,
7518
- right: width,
7519
- bottom: height,
7520
- left: 0
7521
- };
7522
- } else if (boundariesElement === 'viewport') {
7523
- // 将真实 window 的视口换算到 popper 所在包含块的坐标系。
7524
- // 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
7525
- // 统一从元素自身的 view 与真实包含块获取
7526
- var realWindow = getRealWindow(this._popper);
7527
- var containingBlockRect = getContainingBlockRect(
7528
- this._popper,
7529
- data.offsets.popper.position === 'fixed'
7530
- );
7531
-
7532
- boundaries = {
7533
- top: 0 - containingBlockRect.top,
7534
- right:
7535
- realWindow.document.documentElement.clientWidth -
7536
- containingBlockRect.left,
7537
- bottom:
7538
- realWindow.document.documentElement.clientHeight -
7539
- containingBlockRect.top,
7540
- left: 0 - containingBlockRect.left
7541
- };
7542
- } else {
7543
- if (getOffsetParent(this._popper) === boundariesElement) {
7544
- boundaries = {
7545
- top: 0,
7546
- left: 0,
7547
- right: boundariesElement.clientWidth,
7548
- bottom: boundariesElement.clientHeight
7549
- };
7550
- } else {
7551
- boundaries = getOffsetRect(boundariesElement);
7552
- }
7553
- }
7554
- boundaries.left += padding;
7555
- boundaries.right -= padding;
7556
- boundaries.top = boundaries.top + padding;
7557
- boundaries.bottom = boundaries.bottom - padding;
7558
- return boundaries;
7559
- };
7560
-
7479
+ */
7480
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
7481
+ // NOTE: 1 DOM access here
7482
+ var boundaries = {};
7483
+ var width, height;
7484
+ if (boundariesElement === 'window') {
7485
+ var body = root.document.body,
7486
+ html = root.document.documentElement;
7487
+
7488
+ height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
7489
+ width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
7490
+
7491
+ boundaries = {
7492
+ top: 0,
7493
+ right: width,
7494
+ bottom: height,
7495
+ left: 0
7496
+ };
7497
+ } else if (boundariesElement === 'viewport') {
7498
+ // 将真实 window 的视口换算到 popper 所在包含块的坐标系。
7499
+ // 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
7500
+ // 统一从元素自身的 view 与真实包含块获取
7501
+ var realWindow = getRealWindow(this._popper);
7502
+ var containingBlockRect = getContainingBlockRect(this._popper, data.offsets.popper.position === 'fixed');
7503
+
7504
+ boundaries = {
7505
+ top: 0 - containingBlockRect.top,
7506
+ right: realWindow.document.documentElement.clientWidth - containingBlockRect.left,
7507
+ bottom: realWindow.document.documentElement.clientHeight - containingBlockRect.top,
7508
+ left: 0 - containingBlockRect.left
7509
+ };
7510
+ } else {
7511
+ if (getOffsetParent(this._popper) === boundariesElement) {
7512
+ boundaries = {
7513
+ top: 0,
7514
+ left: 0,
7515
+ right: boundariesElement.clientWidth,
7516
+ bottom: boundariesElement.clientHeight
7517
+ };
7518
+ } else {
7519
+ boundaries = getOffsetRect(boundariesElement);
7520
+ }
7521
+ }
7522
+ boundaries.left += padding;
7523
+ boundaries.right -= padding;
7524
+ boundaries.top = boundaries.top + padding;
7525
+ boundaries.bottom = boundaries.bottom - padding;
7526
+ return boundaries;
7527
+ };
7528
+
7561
7529
  /**
7562
7530
  * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
7563
7531
  * @method
@@ -7566,27 +7534,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7566
7534
  * @param {Object} data
7567
7535
  * @param {Array} modifiers
7568
7536
  * @param {Function} ends
7569
- */
7570
- Popper.prototype.runModifiers = function (data, modifiers, ends) {
7571
- var modifiersToRun = modifiers.slice();
7572
- if (ends !== undefined) {
7573
- modifiersToRun = this._options.modifiers.slice(
7574
- 0,
7575
- getArrayKeyIndex(this._options.modifiers, ends)
7576
- );
7577
- }
7578
-
7579
- modifiersToRun.forEach(
7580
- function (modifier) {
7581
- if (isFunction(modifier)) {
7582
- data = modifier.call(this, data);
7583
- }
7584
- }.bind(this)
7585
- );
7586
-
7587
- return data;
7588
- };
7589
-
7537
+ */
7538
+ Popper.prototype.runModifiers = function (data, modifiers, ends) {
7539
+ var modifiersToRun = modifiers.slice();
7540
+ if (ends !== undefined) {
7541
+ modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
7542
+ }
7543
+
7544
+ modifiersToRun.forEach(function (modifier) {
7545
+ if (isFunction(modifier)) {
7546
+ data = modifier.call(this, data);
7547
+ }
7548
+ }.bind(this));
7549
+
7550
+ return data;
7551
+ };
7552
+
7590
7553
  /**
7591
7554
  * Helper used to know if the given modifier depends from another one.
7592
7555
  * @method
@@ -7594,204 +7557,191 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7594
7557
  * @param {String} requesting - name of requesting modifier
7595
7558
  * @param {String} requested - name of requested modifier
7596
7559
  * @returns {Boolean}
7597
- */
7598
- Popper.prototype.isModifierRequired = function (requesting, requested) {
7599
- var index = getArrayKeyIndex(this._options.modifiers, requesting);
7600
- return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
7601
- return modifier === requested;
7602
- }).length;
7603
- };
7604
-
7605
- //
7606
- // Modifiers
7607
- //
7608
-
7560
+ */
7561
+ Popper.prototype.isModifierRequired = function (requesting, requested) {
7562
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
7563
+ return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
7564
+ return modifier === requested;
7565
+ }).length;
7566
+ };
7567
+
7568
+ //
7569
+ // Modifiers
7570
+ //
7571
+
7609
7572
  /**
7610
7573
  * Modifiers list
7611
7574
  * @namespace Popper.modifiers
7612
7575
  * @memberof Popper
7613
7576
  * @type {Object}
7614
- */
7615
- Popper.prototype.modifiers = {};
7616
-
7577
+ */
7578
+ Popper.prototype.modifiers = {};
7579
+
7617
7580
  /**
7618
7581
  * Apply the computed styles to the popper element
7619
7582
  * @method
7620
7583
  * @memberof Popper.modifiers
7621
7584
  * @argument {Object} data - The data object generated by `update` method
7622
7585
  * @returns {Object} The same data object
7623
- */
7624
- Popper.prototype.modifiers.applyStyle = function (data) {
7625
- // apply the final offsets to the popper
7626
- // NOTE: 1 DOM access here
7627
- var styles = {
7628
- position: data.offsets.popper.position
7629
- };
7630
-
7631
- // round top and left to avoid blurry text
7632
- var left = Math.round(data.offsets.popper.left);
7633
- var top = Math.round(data.offsets.popper.top);
7634
-
7635
- // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
7636
- // we automatically use the supported prefixed version if needed
7637
- var prefixedProperty;
7638
- if (
7639
- this._options.gpuAcceleration &&
7640
- (prefixedProperty = getSupportedPropertyName('transform'))
7641
- ) {
7642
- styles[prefixedProperty] =
7643
- 'translate3d(' + left + 'px, ' + top + 'px, 0)';
7644
- styles.top = 0;
7645
- styles.left = 0;
7646
- }
7647
- // othwerise, we use the standard `left` and `top` properties
7648
- else {
7649
- styles.left = left;
7650
- styles.top = top;
7651
- }
7652
-
7653
- // any property present in `data.styles` will be applied to the popper,
7654
- // in this way we can make the 3rd party modifiers add custom styles to it
7655
- // Be aware, modifiers could override the properties defined in the previous
7656
- // lines of this modifier!
7657
- Object.assign(styles, data.styles);
7658
-
7659
- setStyle(this._popper, styles);
7660
-
7661
- // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
7662
- // NOTE: 1 DOM access here
7663
- this._popper.setAttribute('x-placement', data.placement);
7664
-
7665
- // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
7666
- if (
7667
- this.isModifierRequired(
7668
- this.modifiers.applyStyle,
7669
- this.modifiers.arrow
7670
- ) &&
7671
- data.offsets.arrow
7672
- ) {
7673
- setStyle(data.arrowElement, data.offsets.arrow);
7674
- }
7675
-
7676
- return data;
7677
- };
7678
-
7586
+ */
7587
+ Popper.prototype.modifiers.applyStyle = function (data) {
7588
+ // apply the final offsets to the popper
7589
+ // NOTE: 1 DOM access here
7590
+ var styles = {
7591
+ position: data.offsets.popper.position
7592
+ };
7593
+
7594
+ // round top and left to avoid blurry text
7595
+ var left = Math.round(data.offsets.popper.left);
7596
+ var top = Math.round(data.offsets.popper.top);
7597
+
7598
+ // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
7599
+ // we automatically use the supported prefixed version if needed
7600
+ var prefixedProperty;
7601
+ if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
7602
+ styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
7603
+ styles.top = 0;
7604
+ styles.left = 0;
7605
+ }
7606
+ // othwerise, we use the standard `left` and `top` properties
7607
+ else {
7608
+ styles.left = left;
7609
+ styles.top = top;
7610
+ }
7611
+
7612
+ // any property present in `data.styles` will be applied to the popper,
7613
+ // in this way we can make the 3rd party modifiers add custom styles to it
7614
+ // Be aware, modifiers could override the properties defined in the previous
7615
+ // lines of this modifier!
7616
+ Object.assign(styles, data.styles);
7617
+
7618
+ setStyle(this._popper, styles);
7619
+
7620
+ // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
7621
+ // NOTE: 1 DOM access here
7622
+ this._popper.setAttribute('x-placement', data.placement);
7623
+
7624
+ // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
7625
+ if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
7626
+ setStyle(data.arrowElement, data.offsets.arrow);
7627
+ }
7628
+
7629
+ return data;
7630
+ };
7631
+
7679
7632
  /**
7680
7633
  * Modifier used to shift the popper on the start or end of its reference element side
7681
7634
  * @method
7682
7635
  * @memberof Popper.modifiers
7683
7636
  * @argument {Object} data - The data object generated by `update` method
7684
7637
  * @returns {Object} The data object, properly modified
7685
- */
7686
- Popper.prototype.modifiers.shift = function (data) {
7687
- var placement = data.placement;
7688
- var basePlacement = placement.split('-')[0];
7689
- var shiftVariation = placement.split('-')[1];
7690
-
7691
- // if shift shiftVariation is specified, run the modifier
7692
- if (shiftVariation) {
7693
- var reference = data.offsets.reference;
7694
- var popper = getPopperClientRect(data.offsets.popper);
7695
-
7696
- var shiftOffsets = {
7697
- y: {
7698
- start: { top: reference.top },
7699
- end: { top: reference.top + reference.height - popper.height }
7700
- },
7701
- x: {
7702
- start: { left: reference.left },
7703
- end: { left: reference.left + reference.width - popper.width }
7704
- }
7705
- };
7706
-
7707
- var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
7708
-
7709
- data.offsets.popper = Object.assign(
7710
- popper,
7711
- shiftOffsets[axis][shiftVariation]
7712
- );
7713
- }
7714
-
7715
- return data;
7716
- };
7717
-
7638
+ */
7639
+ Popper.prototype.modifiers.shift = function (data) {
7640
+ var placement = data.placement;
7641
+ var basePlacement = placement.split('-')[0];
7642
+ var shiftVariation = placement.split('-')[1];
7643
+
7644
+ // if shift shiftVariation is specified, run the modifier
7645
+ if (shiftVariation) {
7646
+ var reference = data.offsets.reference;
7647
+ var popper = getPopperClientRect(data.offsets.popper);
7648
+
7649
+ var shiftOffsets = {
7650
+ y: {
7651
+ start: { top: reference.top },
7652
+ end: { top: reference.top + reference.height - popper.height }
7653
+ },
7654
+ x: {
7655
+ start: { left: reference.left },
7656
+ end: { left: reference.left + reference.width - popper.width }
7657
+ }
7658
+ };
7659
+
7660
+ var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
7661
+
7662
+ data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
7663
+ }
7664
+
7665
+ return data;
7666
+ };
7667
+
7718
7668
  /**
7719
7669
  * Modifier used to make sure the popper does not overflows from it's boundaries
7720
7670
  * @method
7721
7671
  * @memberof Popper.modifiers
7722
7672
  * @argument {Object} data - The data object generated by `update` method
7723
7673
  * @returns {Object} The data object, properly modified
7724
- */
7725
- Popper.prototype.modifiers.preventOverflow = function (data) {
7726
- var order = this._options.preventOverflowOrder;
7727
- var popper = getPopperClientRect(data.offsets.popper);
7728
-
7729
- var check = {
7730
- left: function () {
7731
- var left = popper.left;
7732
- if (popper.left < data.boundaries.left) {
7733
- left = Math.max(popper.left, data.boundaries.left);
7734
- }
7735
- return { left: left };
7736
- },
7737
- right: function () {
7738
- var left = popper.left;
7739
- if (popper.right > data.boundaries.right) {
7740
- left = Math.min(popper.left, data.boundaries.right - popper.width);
7741
- }
7742
- return { left: left };
7743
- },
7744
- top: function () {
7745
- var top = popper.top;
7746
- if (popper.top < data.boundaries.top) {
7747
- top = Math.max(popper.top, data.boundaries.top);
7748
- }
7749
- return { top: top };
7750
- },
7751
- bottom: function () {
7752
- var top = popper.top;
7753
- if (popper.bottom > data.boundaries.bottom) {
7754
- top = Math.min(popper.top, data.boundaries.bottom - popper.height);
7755
- }
7756
- return { top: top };
7757
- }
7758
- };
7759
-
7760
- order.forEach(function (direction) {
7761
- data.offsets.popper = Object.assign(popper, check[direction]());
7762
- });
7763
-
7764
- return data;
7765
- };
7766
-
7674
+ */
7675
+ Popper.prototype.modifiers.preventOverflow = function (data) {
7676
+ var order = this._options.preventOverflowOrder;
7677
+ var popper = getPopperClientRect(data.offsets.popper);
7678
+
7679
+ var check = {
7680
+ left: function left() {
7681
+ var left = popper.left;
7682
+ if (popper.left < data.boundaries.left) {
7683
+ left = Math.max(popper.left, data.boundaries.left);
7684
+ }
7685
+ return { left: left };
7686
+ },
7687
+ right: function right() {
7688
+ var left = popper.left;
7689
+ if (popper.right > data.boundaries.right) {
7690
+ left = Math.min(popper.left, data.boundaries.right - popper.width);
7691
+ }
7692
+ return { left: left };
7693
+ },
7694
+ top: function top() {
7695
+ var top = popper.top;
7696
+ if (popper.top < data.boundaries.top) {
7697
+ top = Math.max(popper.top, data.boundaries.top);
7698
+ }
7699
+ return { top: top };
7700
+ },
7701
+ bottom: function bottom() {
7702
+ var top = popper.top;
7703
+ if (popper.bottom > data.boundaries.bottom) {
7704
+ top = Math.min(popper.top, data.boundaries.bottom - popper.height);
7705
+ }
7706
+ return { top: top };
7707
+ }
7708
+ };
7709
+
7710
+ order.forEach(function (direction) {
7711
+ data.offsets.popper = Object.assign(popper, check[direction]());
7712
+ });
7713
+
7714
+ return data;
7715
+ };
7716
+
7767
7717
  /**
7768
7718
  * Modifier used to make sure the popper is always near its reference
7769
7719
  * @method
7770
7720
  * @memberof Popper.modifiers
7771
7721
  * @argument {Object} data - The data object generated by _update method
7772
7722
  * @returns {Object} The data object, properly modified
7773
- */
7774
- Popper.prototype.modifiers.keepTogether = function (data) {
7775
- var popper = getPopperClientRect(data.offsets.popper);
7776
- var reference = data.offsets.reference;
7777
- var f = Math.floor;
7778
-
7779
- if (popper.right < f(reference.left)) {
7780
- data.offsets.popper.left = f(reference.left) - popper.width;
7781
- }
7782
- if (popper.left > f(reference.right)) {
7783
- data.offsets.popper.left = f(reference.right);
7784
- }
7785
- if (popper.bottom < f(reference.top)) {
7786
- data.offsets.popper.top = f(reference.top) - popper.height;
7787
- }
7788
- if (popper.top > f(reference.bottom)) {
7789
- data.offsets.popper.top = f(reference.bottom);
7790
- }
7791
-
7792
- return data;
7793
- };
7794
-
7723
+ */
7724
+ Popper.prototype.modifiers.keepTogether = function (data) {
7725
+ var popper = getPopperClientRect(data.offsets.popper);
7726
+ var reference = data.offsets.reference;
7727
+ var f = Math.floor;
7728
+
7729
+ if (popper.right < f(reference.left)) {
7730
+ data.offsets.popper.left = f(reference.left) - popper.width;
7731
+ }
7732
+ if (popper.left > f(reference.right)) {
7733
+ data.offsets.popper.left = f(reference.right);
7734
+ }
7735
+ if (popper.bottom < f(reference.top)) {
7736
+ data.offsets.popper.top = f(reference.top) - popper.height;
7737
+ }
7738
+ if (popper.top > f(reference.bottom)) {
7739
+ data.offsets.popper.top = f(reference.bottom);
7740
+ }
7741
+
7742
+ return data;
7743
+ };
7744
+
7795
7745
  /**
7796
7746
  * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
7797
7747
  * Requires the `preventOverflow` modifier before it in order to work.
@@ -7800,81 +7750,61 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7800
7750
  * @memberof Popper.modifiers
7801
7751
  * @argument {Object} data - The data object generated by _update method
7802
7752
  * @returns {Object} The data object, properly modified
7803
- */
7804
- Popper.prototype.modifiers.flip = function (data) {
7805
- // check if preventOverflow is in the list of modifiers before the flip modifier.
7806
- // otherwise flip would not work as expected.
7807
- if (
7808
- !this.isModifierRequired(
7809
- this.modifiers.flip,
7810
- this.modifiers.preventOverflow
7811
- )
7812
- ) {
7813
- console.warn(
7814
- 'WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!'
7815
- );
7816
- return data;
7817
- }
7818
-
7819
- if (data.flipped && data.placement === data._originalPlacement) {
7820
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
7821
- return data;
7822
- }
7823
-
7824
- var placement = data.placement.split('-')[0];
7825
- var placementOpposite = getOppositePlacement(placement);
7826
- var variation = data.placement.split('-')[1] || '';
7827
-
7828
- var flipOrder = [];
7829
- if (this._options.flipBehavior === 'flip') {
7830
- flipOrder = [placement, placementOpposite];
7831
- } else {
7832
- flipOrder = this._options.flipBehavior;
7833
- }
7834
-
7835
- flipOrder.forEach(
7836
- function (step, index) {
7837
- if (placement !== step || flipOrder.length === index + 1) {
7838
- return;
7839
- }
7840
-
7841
- placement = data.placement.split('-')[0];
7842
- placementOpposite = getOppositePlacement(placement);
7843
-
7844
- var popperOffsets = getPopperClientRect(data.offsets.popper);
7845
-
7846
- // this boolean is used to distinguish right and bottom from top and left
7847
- // they need different computations to get flipped
7848
- var a = ['right', 'bottom'].indexOf(placement) !== -1;
7849
-
7850
- // using Math.floor because the reference offsets may contain decimals we are not going to consider here
7851
- if (
7852
- (a &&
7853
- Math.floor(data.offsets.reference[placement]) >
7854
- Math.floor(popperOffsets[placementOpposite])) ||
7855
- (!a &&
7856
- Math.floor(data.offsets.reference[placement]) <
7857
- Math.floor(popperOffsets[placementOpposite]))
7858
- ) {
7859
- // we'll use this boolean to detect any flip loop
7860
- data.flipped = true;
7861
- data.placement = flipOrder[index + 1];
7862
- if (variation) {
7863
- data.placement += '-' + variation;
7864
- }
7865
- data.offsets.popper = this._getOffsets(
7866
- this._popper,
7867
- this._reference,
7868
- data.placement
7869
- ).popper;
7870
-
7871
- data = this.runModifiers(data, this._options.modifiers, this._flip);
7872
- }
7873
- }.bind(this)
7874
- );
7875
- return data;
7876
- };
7877
-
7753
+ */
7754
+ Popper.prototype.modifiers.flip = function (data) {
7755
+ // check if preventOverflow is in the list of modifiers before the flip modifier.
7756
+ // otherwise flip would not work as expected.
7757
+ if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
7758
+ console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
7759
+ return data;
7760
+ }
7761
+
7762
+ if (data.flipped && data.placement === data._originalPlacement) {
7763
+ // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
7764
+ return data;
7765
+ }
7766
+
7767
+ var placement = data.placement.split('-')[0];
7768
+ var placementOpposite = getOppositePlacement(placement);
7769
+ var variation = data.placement.split('-')[1] || '';
7770
+
7771
+ var flipOrder = [];
7772
+ if (this._options.flipBehavior === 'flip') {
7773
+ flipOrder = [placement, placementOpposite];
7774
+ } else {
7775
+ flipOrder = this._options.flipBehavior;
7776
+ }
7777
+
7778
+ flipOrder.forEach(function (step, index) {
7779
+ if (placement !== step || flipOrder.length === index + 1) {
7780
+ return;
7781
+ }
7782
+
7783
+ placement = data.placement.split('-')[0];
7784
+ placementOpposite = getOppositePlacement(placement);
7785
+
7786
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
7787
+
7788
+ // this boolean is used to distinguish right and bottom from top and left
7789
+ // they need different computations to get flipped
7790
+ var a = ['right', 'bottom'].indexOf(placement) !== -1;
7791
+
7792
+ // using Math.floor because the reference offsets may contain decimals we are not going to consider here
7793
+ if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
7794
+ // we'll use this boolean to detect any flip loop
7795
+ data.flipped = true;
7796
+ data.placement = flipOrder[index + 1];
7797
+ if (variation) {
7798
+ data.placement += '-' + variation;
7799
+ }
7800
+ data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
7801
+
7802
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
7803
+ }
7804
+ }.bind(this));
7805
+ return data;
7806
+ };
7807
+
7878
7808
  /**
7879
7809
  * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
7880
7810
  * The offsets will shift the popper on the side of its reference element.
@@ -7882,23 +7812,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7882
7812
  * @memberof Popper.modifiers
7883
7813
  * @argument {Object} data - The data object generated by _update method
7884
7814
  * @returns {Object} The data object, properly modified
7885
- */
7886
- Popper.prototype.modifiers.offset = function (data) {
7887
- var offset = this._options.offset;
7888
- var popper = data.offsets.popper;
7889
-
7890
- if (data.placement.indexOf('left') !== -1) {
7891
- popper.top -= offset;
7892
- } else if (data.placement.indexOf('right') !== -1) {
7893
- popper.top += offset;
7894
- } else if (data.placement.indexOf('top') !== -1) {
7895
- popper.left -= offset;
7896
- } else if (data.placement.indexOf('bottom') !== -1) {
7897
- popper.left += offset;
7898
- }
7899
- return data;
7900
- };
7901
-
7815
+ */
7816
+ Popper.prototype.modifiers.offset = function (data) {
7817
+ var offset = this._options.offset;
7818
+ var popper = data.offsets.popper;
7819
+
7820
+ if (data.placement.indexOf('left') !== -1) {
7821
+ popper.top -= offset;
7822
+ } else if (data.placement.indexOf('right') !== -1) {
7823
+ popper.top += offset;
7824
+ } else if (data.placement.indexOf('top') !== -1) {
7825
+ popper.left -= offset;
7826
+ } else if (data.placement.indexOf('bottom') !== -1) {
7827
+ popper.left += offset;
7828
+ }
7829
+ return data;
7830
+ };
7831
+
7902
7832
  /**
7903
7833
  * 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
7904
7834
  * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
@@ -7906,147 +7836,136 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
7906
7836
  * @memberof Popper.modifiers
7907
7837
  * @argument {Object} data - The data object generated by _update method
7908
7838
  * @returns {Object} The data object, properly modified
7909
- */
7910
- Popper.prototype.modifiers.arrow = function (data) {
7911
- var arrow = this._options.arrowElement;
7912
- var arrowOffset = this._options.arrowOffset;
7913
-
7914
- // if the arrowElement is a string, suppose it's a CSS selector
7915
- if (typeof arrow === 'string') {
7916
- arrow = this._popper.querySelector(arrow);
7917
- }
7918
-
7919
- // if arrow element is not found, don't run the modifier
7920
- if (!arrow) {
7921
- return data;
7922
- }
7923
-
7924
- // the arrow element must be child of its popper
7925
- if (!this._popper.contains(arrow)) {
7926
- console.warn(
7927
- 'WARNING: `arrowElement` must be child of its popper element!'
7928
- );
7929
- return data;
7930
- }
7931
-
7932
- // arrow depends on keepTogether in order to work
7933
- if (
7934
- !this.isModifierRequired(
7935
- this.modifiers.arrow,
7936
- this.modifiers.keepTogether
7937
- )
7938
- ) {
7939
- console.warn(
7940
- 'WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!'
7941
- );
7942
- return data;
7943
- }
7944
-
7945
- var arrowStyle = {};
7946
- var placement = data.placement.split('-')[0];
7947
- var popper = getPopperClientRect(data.offsets.popper);
7948
- var reference = data.offsets.reference;
7949
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
7950
-
7951
- var len = isVertical ? 'height' : 'width';
7952
- var side = isVertical ? 'top' : 'left';
7953
- var translate = isVertical ? 'translateY' : 'translateX';
7954
- var altSide = isVertical ? 'left' : 'top';
7955
- var opSide = isVertical ? 'bottom' : 'right';
7956
- var arrowSize = getOuterSizes(arrow)[len];
7957
-
7958
- //
7959
- // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
7960
- //
7961
-
7962
- // top/left side
7963
- if (reference[opSide] - arrowSize < popper[side]) {
7964
- data.offsets.popper[side] -=
7965
- popper[side] - (reference[opSide] - arrowSize);
7966
- }
7967
- // bottom/right side
7968
- if (reference[side] + arrowSize > popper[opSide]) {
7969
- data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
7970
- }
7971
-
7972
- // compute center of the popper
7973
- var center =
7974
- reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
7975
-
7976
- var sideValue = center - popper[side];
7977
-
7978
- // prevent arrow from being placed not contiguously to its popper
7979
- sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
7980
- arrowStyle[side] = sideValue;
7981
- arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
7982
-
7983
- data.offsets.arrow = arrowStyle;
7984
- data.arrowElement = arrow;
7985
-
7986
- return data;
7987
- };
7988
-
7989
- //
7990
- // Helpers
7991
- //
7992
-
7839
+ */
7840
+ Popper.prototype.modifiers.arrow = function (data) {
7841
+ var arrow = this._options.arrowElement;
7842
+ var arrowOffset = this._options.arrowOffset;
7843
+
7844
+ // if the arrowElement is a string, suppose it's a CSS selector
7845
+ if (typeof arrow === 'string') {
7846
+ arrow = this._popper.querySelector(arrow);
7847
+ }
7848
+
7849
+ // if arrow element is not found, don't run the modifier
7850
+ if (!arrow) {
7851
+ return data;
7852
+ }
7853
+
7854
+ // the arrow element must be child of its popper
7855
+ if (!this._popper.contains(arrow)) {
7856
+ console.warn('WARNING: `arrowElement` must be child of its popper element!');
7857
+ return data;
7858
+ }
7859
+
7860
+ // arrow depends on keepTogether in order to work
7861
+ if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
7862
+ console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
7863
+ return data;
7864
+ }
7865
+
7866
+ var arrowStyle = {};
7867
+ var placement = data.placement.split('-')[0];
7868
+ var popper = getPopperClientRect(data.offsets.popper);
7869
+ var reference = data.offsets.reference;
7870
+ var isVertical = ['left', 'right'].indexOf(placement) !== -1;
7871
+
7872
+ var len = isVertical ? 'height' : 'width';
7873
+ var side = isVertical ? 'top' : 'left';
7874
+ var translate = isVertical ? 'translateY' : 'translateX';
7875
+ var altSide = isVertical ? 'left' : 'top';
7876
+ var opSide = isVertical ? 'bottom' : 'right';
7877
+ var arrowSize = getOuterSizes(arrow)[len];
7878
+
7879
+ //
7880
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
7881
+ //
7882
+
7883
+ // top/left side
7884
+ if (reference[opSide] - arrowSize < popper[side]) {
7885
+ data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
7886
+ }
7887
+ // bottom/right side
7888
+ if (reference[side] + arrowSize > popper[opSide]) {
7889
+ data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
7890
+ }
7891
+
7892
+ // compute center of the popper
7893
+ var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
7894
+
7895
+ var sideValue = center - popper[side];
7896
+
7897
+ // prevent arrow from being placed not contiguously to its popper
7898
+ sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
7899
+ arrowStyle[side] = sideValue;
7900
+ arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
7901
+
7902
+ data.offsets.arrow = arrowStyle;
7903
+ data.arrowElement = arrow;
7904
+
7905
+ return data;
7906
+ };
7907
+
7908
+ //
7909
+ // Helpers
7910
+ //
7911
+
7993
7912
  /**
7994
7913
  * Get the outer sizes of the given element (offset size + margins)
7995
7914
  * @function
7996
7915
  * @ignore
7997
7916
  * @argument {Element} element
7998
7917
  * @returns {Object} object containing width and height properties
7999
- */
8000
- function getOuterSizes(element) {
8001
- // NOTE: 1 DOM access here
8002
- var _display = element.style.display,
8003
- _visibility = element.style.visibility;
8004
- element.style.display = 'block';
8005
- element.style.visibility = 'hidden';
8006
- var calcWidthToForceRepaint = element.offsetWidth;
8007
- // original method
8008
- var styles = getRealWindow(element).getComputedStyle(element);
8009
- var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
8010
- var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
8011
- var result = {
8012
- width: element.offsetWidth + y,
8013
- height: element.offsetHeight + x
8014
- };
8015
-
8016
- // reset element styles
8017
- element.style.display = _display;
8018
- element.style.visibility = _visibility;
8019
- return result;
8020
- }
8021
-
7918
+ */
7919
+ function getOuterSizes(element) {
7920
+ // NOTE: 1 DOM access here
7921
+ var _display = element.style.display,
7922
+ _visibility = element.style.visibility;
7923
+ element.style.display = 'block';
7924
+ element.style.visibility = 'hidden';
7925
+ var calcWidthToForceRepaint = element.offsetWidth;
7926
+ // original method
7927
+ var styles = getRealWindow(element).getComputedStyle(element);
7928
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
7929
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
7930
+ var result = {
7931
+ width: element.offsetWidth + y,
7932
+ height: element.offsetHeight + x
7933
+ };
7934
+
7935
+ // reset element styles
7936
+ element.style.display = _display;
7937
+ element.style.visibility = _visibility;
7938
+ return result;
7939
+ }
7940
+
8022
7941
  /**
8023
7942
  * Get the opposite placement of the given one/
8024
7943
  * @function
8025
7944
  * @ignore
8026
7945
  * @argument {String} placement
8027
7946
  * @returns {String} flipped placement
8028
- */
8029
- function getOppositePlacement(placement) {
8030
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
8031
- return placement.replace(/left|right|bottom|top/g, function (matched) {
8032
- return hash[matched];
8033
- });
8034
- }
8035
-
7947
+ */
7948
+ function getOppositePlacement(placement) {
7949
+ var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
7950
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
7951
+ return hash[matched];
7952
+ });
7953
+ }
7954
+
8036
7955
  /**
8037
7956
  * Given the popper offsets, generate an output similar to getBoundingClientRect
8038
7957
  * @function
8039
7958
  * @ignore
8040
7959
  * @argument {Object} popperOffsets
8041
7960
  * @returns {Object} ClientRect like output
8042
- */
8043
- function getPopperClientRect(popperOffsets) {
8044
- var offsets = Object.assign({}, popperOffsets);
8045
- offsets.right = offsets.left + offsets.width;
8046
- offsets.bottom = offsets.top + offsets.height;
8047
- return offsets;
8048
- }
8049
-
7961
+ */
7962
+ function getPopperClientRect(popperOffsets) {
7963
+ var offsets = Object.assign({}, popperOffsets);
7964
+ offsets.right = offsets.left + offsets.width;
7965
+ offsets.bottom = offsets.top + offsets.height;
7966
+ return offsets;
7967
+ }
7968
+
8050
7969
  /**
8051
7970
  * Given an array and the key to find, returns its index
8052
7971
  * @function
@@ -8054,48 +7973,46 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
8054
7973
  * @argument {Array} arr
8055
7974
  * @argument keyToFind
8056
7975
  * @returns index or null
8057
- */
8058
- function getArrayKeyIndex(arr, keyToFind) {
8059
- var i = 0,
8060
- key;
8061
- for (key in arr) {
8062
- if (arr[key] === keyToFind) {
8063
- return i;
8064
- }
8065
- i++;
8066
- }
8067
- return null;
8068
- }
8069
-
7976
+ */
7977
+ function getArrayKeyIndex(arr, keyToFind) {
7978
+ var i = 0,
7979
+ key;
7980
+ for (key in arr) {
7981
+ if (arr[key] === keyToFind) {
7982
+ return i;
7983
+ }
7984
+ i++;
7985
+ }
7986
+ return null;
7987
+ }
7988
+
8070
7989
  /**
8071
7990
  * Get CSS computed property of the given element
8072
7991
  * @function
8073
7992
  * @ignore
8074
7993
  * @argument {Eement} element
8075
7994
  * @argument {String} property
8076
- */
8077
- function getStyleComputedProperty(element, property) {
8078
- // NOTE: 1 DOM access here
8079
- // 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
8080
- // 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
8081
- var css = getRealWindow(element).getComputedStyle(element, null);
8082
- return css[property];
8083
- }
8084
-
7995
+ */
7996
+ function getStyleComputedProperty(element, property) {
7997
+ // NOTE: 1 DOM access here
7998
+ // 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
7999
+ // 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
8000
+ var css = getRealWindow(element).getComputedStyle(element, null);
8001
+ return css[property];
8002
+ }
8003
+
8085
8004
  /**
8086
8005
  * Returns the offset parent of the given element
8087
8006
  * @function
8088
8007
  * @ignore
8089
8008
  * @argument {Element} element
8090
8009
  * @returns {Element} offset parent
8091
- */
8092
- function getOffsetParent(element) {
8093
- var offsetParent = element.offsetParent;
8094
- return offsetParent === root.document.body || !offsetParent
8095
- ? root.document.documentElement
8096
- : offsetParent;
8097
- }
8098
-
8010
+ */
8011
+ function getOffsetParent(element) {
8012
+ var offsetParent = element.offsetParent;
8013
+ return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
8014
+ }
8015
+
8099
8016
  /**
8100
8017
  * Returns the window the given element actually renders in.
8101
8018
  * 无界等微前端场景下组件代码运行在沙箱 window 中,而 DOM 实际渲染在
@@ -8104,16 +8021,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
8104
8021
  * @ignore
8105
8022
  * @argument {Element} element
8106
8023
  * @returns {Window} window
8107
- */
8108
- function getRealWindow(element) {
8109
- return (
8110
- (element &&
8111
- element.ownerDocument &&
8112
- element.ownerDocument.defaultView) ||
8113
- root
8114
- );
8115
- }
8116
-
8024
+ */
8025
+ function getRealWindow(element) {
8026
+ return element && element.ownerDocument && element.ownerDocument.defaultView || root;
8027
+ }
8028
+
8117
8029
  /**
8118
8030
  * Returns the viewport rect of the containing block actually used to position the popper.
8119
8031
  * 无界微前端等场景下 popper 被挂载进子应用的 shadowRoot,offsetParent 的兜底值
@@ -8127,82 +8039,72 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
8127
8039
  * @argument {Element} element - popper element
8128
8040
  * @argument {Boolean} fixed - whether the popper is fixed positioned
8129
8041
  * @returns {Object} rect
8130
- */
8131
- function getContainingBlockRect(element, fixed) {
8132
- if (fixed) {
8133
- return { top: 0, left: 0, right: 0, bottom: 0 };
8134
- }
8135
-
8136
- var node = element.parentNode;
8137
- while (node) {
8138
- if (node.nodeType === 1) {
8139
- if (getStyleComputedProperty(node, 'position') !== 'static') {
8140
- return getBoundingClientRect(node);
8141
- }
8142
- } else if (node.nodeType === 11) {
8143
- // 遇到 shadowRoot,跨边界从宿主元素继续向上查找
8144
- node = node.host;
8145
- continue;
8146
- } else {
8147
- break;
8148
- }
8149
- node = node.parentNode;
8150
- }
8151
-
8152
- var win = getRealWindow(element);
8153
- return {
8154
- top: -(win.pageYOffset || 0),
8155
- left: -(win.pageXOffset || 0),
8156
- right: 0,
8157
- bottom: 0
8158
- };
8159
- }
8160
-
8042
+ */
8043
+ function getContainingBlockRect(element, fixed) {
8044
+ if (fixed) {
8045
+ return { top: 0, left: 0, right: 0, bottom: 0 };
8046
+ }
8047
+
8048
+ var node = element.parentNode;
8049
+ while (node) {
8050
+ if (node.nodeType === 1) {
8051
+ if (getStyleComputedProperty(node, 'position') !== 'static') {
8052
+ return getBoundingClientRect(node);
8053
+ }
8054
+ } else if (node.nodeType === 11) {
8055
+ // 遇到 shadowRoot,跨边界从宿主元素继续向上查找
8056
+ node = node.host;
8057
+ continue;
8058
+ } else {
8059
+ break;
8060
+ }
8061
+ node = node.parentNode;
8062
+ }
8063
+
8064
+ var win = getRealWindow(element);
8065
+ return {
8066
+ top: -(win.pageYOffset || 0),
8067
+ left: -(win.pageXOffset || 0),
8068
+ right: 0,
8069
+ bottom: 0
8070
+ };
8071
+ }
8072
+
8161
8073
  /**
8162
8074
  * Returns the scrolling parent of the given element
8163
8075
  * @function
8164
8076
  * @ignore
8165
8077
  * @argument {Element} element
8166
8078
  * @returns {Element} offset parent
8167
- */
8168
- function getScrollParent(element) {
8169
- var parent = element.parentNode;
8170
- if (!parent) {
8171
- return element;
8172
- }
8173
-
8174
- if (parent.nodeType === 11) {
8175
- // 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
8176
- // 否则查找到 shadowRoot 即终止,滚动事件无法被监听
8177
- return getScrollParent(parent.host);
8178
- }
8179
-
8180
- if (parent.nodeType !== 1) {
8181
- // 到达 document,返回元素实际渲染所在的真实 window,
8182
- // 保证 window 滚动时能触发位置更新
8183
- return getRealWindow(element);
8184
- }
8185
-
8186
- // Firefox want us to check `-x` and `-y` variations as well
8187
- if (
8188
- ['scroll', 'auto'].indexOf(
8189
- getStyleComputedProperty(parent, 'overflow')
8190
- ) !== -1 ||
8191
- ['scroll', 'auto'].indexOf(
8192
- getStyleComputedProperty(parent, 'overflow-x')
8193
- ) !== -1 ||
8194
- ['scroll', 'auto'].indexOf(
8195
- getStyleComputedProperty(parent, 'overflow-y')
8196
- ) !== -1
8197
- ) {
8198
- // If the detected scrollParent is body, we perform an additional check on its parentNode
8199
- // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
8200
- // fixes issue #65
8201
- return parent;
8202
- }
8203
- return getScrollParent(parent);
8204
- }
8205
-
8079
+ */
8080
+ function getScrollParent(element) {
8081
+ var parent = element.parentNode;
8082
+ if (!parent) {
8083
+ return element;
8084
+ }
8085
+
8086
+ if (parent.nodeType === 11) {
8087
+ // 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
8088
+ // 否则查找到 shadowRoot 即终止,滚动事件无法被监听
8089
+ return getScrollParent(parent.host);
8090
+ }
8091
+
8092
+ if (parent.nodeType !== 1) {
8093
+ // 到达 document,返回元素实际渲染所在的真实 window,
8094
+ // 保证 window 滚动时能触发位置更新
8095
+ return getRealWindow(element);
8096
+ }
8097
+
8098
+ // Firefox want us to check `-x` and `-y` variations as well
8099
+ if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
8100
+ // If the detected scrollParent is body, we perform an additional check on its parentNode
8101
+ // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
8102
+ // fixes issue #65
8103
+ return parent;
8104
+ }
8105
+ return getScrollParent(parent);
8106
+ }
8107
+
8206
8108
  /**
8207
8109
  * Check if the given element is fixed or is inside a fixed parent
8208
8110
  * @function
@@ -8210,125 +8112,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
8210
8112
  * @argument {Element} element
8211
8113
  * @argument {Element} customContainer
8212
8114
  * @returns {Boolean} answer to "isFixed?"
8213
- */
8214
- function isFixed(element) {
8215
- if (element === root.document.body) {
8216
- return false;
8217
- }
8218
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
8219
- return true;
8220
- }
8221
- var parent = element.parentNode;
8222
- if (parent && parent.nodeType === 11) {
8223
- // 跨 shadowRoot 边界,从宿主元素继续向上判断
8224
- parent = parent.host;
8225
- }
8226
- return parent && parent.nodeType === 1 ? isFixed(parent) : false;
8227
- }
8228
-
8229
- /**
8230
- * Set the style to the given popper
8231
- * @function
8232
- * @ignore
8233
- * @argument {Element} element - Element to apply the style to
8234
- * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
8235
- */
8236
- function setStyle(element, styles) {
8237
- function is_numeric(n) {
8238
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
8239
- }
8240
- Object.keys(styles).forEach(function (prop) {
8241
- var unit = '';
8242
- // add unit if the value is numeric and is one of the following
8243
- if (
8244
- ['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==
8245
- -1 &&
8246
- is_numeric(styles[prop])
8247
- ) {
8248
- unit = 'px';
8249
- }
8250
- element.style[prop] = styles[prop] + unit;
8251
- });
8252
- }
8253
-
8254
- /**
8115
+ */
8116
+ function isFixed(element) {
8117
+ if (element === root.document.body) {
8118
+ return false;
8119
+ }
8120
+ if (getStyleComputedProperty(element, 'position') === 'fixed') {
8121
+ return true;
8122
+ }
8123
+ var parent = element.parentNode;
8124
+ if (parent && parent.nodeType === 11) {
8125
+ // 跨 shadowRoot 边界,从宿主元素继续向上判断
8126
+ parent = parent.host;
8127
+ }
8128
+ return parent && parent.nodeType === 1 ? isFixed(parent) : false;
8129
+ }
8130
+
8131
+ /**
8132
+ * Set the style to the given popper
8133
+ * @function
8134
+ * @ignore
8135
+ * @argument {Element} element - Element to apply the style to
8136
+ * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
8137
+ */
8138
+ function setStyle(element, styles) {
8139
+ function is_numeric(n) {
8140
+ return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
8141
+ }
8142
+ Object.keys(styles).forEach(function (prop) {
8143
+ var unit = '';
8144
+ // add unit if the value is numeric and is one of the following
8145
+ if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
8146
+ unit = 'px';
8147
+ }
8148
+ element.style[prop] = styles[prop] + unit;
8149
+ });
8150
+ }
8151
+
8152
+ /**
8255
8153
  * Check if the given variable is a function
8256
8154
  * @function
8257
8155
  * @ignore
8258
8156
  * @argument {*} functionToCheck - variable to check
8259
8157
  * @returns {Boolean} answer to: is a function?
8260
- */
8261
- function isFunction(functionToCheck) {
8262
- var getType = {};
8263
- return (
8264
- functionToCheck &&
8265
- getType.toString.call(functionToCheck) === '[object Function]'
8266
- );
8267
- }
8268
-
8158
+ */
8159
+ function isFunction(functionToCheck) {
8160
+ var getType = {};
8161
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
8162
+ }
8163
+
8269
8164
  /**
8270
8165
  * Get the position of the given element, relative to its offset parent
8271
8166
  * @function
8272
8167
  * @ignore
8273
8168
  * @param {Element} element
8274
8169
  * @return {Object} position - Coordinates of the element and its `scrollTop`
8275
- */
8276
- function getOffsetRect(element) {
8277
- var transform = getStyle(element, 'transform')
8278
- .replace(/[^0-9\-,]/g, '')
8279
- .split(',');
8280
- var elementRect = {
8281
- width: element.offsetWidth,
8282
- height: element.offsetHeight,
8283
- left:
8284
- element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
8285
- top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
8286
- };
8287
-
8288
- elementRect.right = elementRect.left + elementRect.width;
8289
- elementRect.bottom = elementRect.top + elementRect.height;
8290
-
8291
- // position
8292
- return elementRect;
8293
- }
8294
-
8170
+ */
8171
+ function getOffsetRect(element) {
8172
+ var transform = getStyle(element, 'transform').replace(/[^0-9\-,]/g, '').split(',');
8173
+ var elementRect = {
8174
+ width: element.offsetWidth,
8175
+ height: element.offsetHeight,
8176
+ left: element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
8177
+ top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
8178
+ };
8179
+
8180
+ elementRect.right = elementRect.left + elementRect.width;
8181
+ elementRect.bottom = elementRect.top + elementRect.height;
8182
+
8183
+ // position
8184
+ return elementRect;
8185
+ }
8186
+
8295
8187
  /**
8296
8188
  * Get bounding client rect of given element
8297
8189
  * @function
8298
8190
  * @ignore
8299
8191
  * @param {HTMLElement} element
8300
8192
  * @return {Object} client rect
8301
- */
8302
- function getBoundingClientRect(element) {
8303
- var rect = element.getBoundingClientRect();
8304
-
8305
- // whether the IE version is lower than 11
8306
- var isIE = /MSIE|Trident/.test(navigator.userAgent);
8307
-
8308
- // fix ie document bounding top always 0 bug
8309
- var rectTop =
8310
- isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
8311
-
8312
- return {
8313
- left: rect.left,
8314
- top: rectTop,
8315
- right: rect.right,
8316
- bottom: rect.bottom,
8317
- width: rect.right - rect.left,
8318
- height: rect.bottom - rectTop
8319
- };
8320
- }
8321
-
8322
- function getStyle(dom, attr) {
8323
- if (dom.style[attr]) {
8324
- return dom.style[attr];
8325
- }
8326
- if (window.getComputedStyle) {
8327
- return getComputedStyle(dom, null)[attr];
8328
- }
8329
- return dom.currentStyle[attr];
8330
- }
8331
-
8193
+ */
8194
+ function getBoundingClientRect(element) {
8195
+ var rect = element.getBoundingClientRect();
8196
+
8197
+ // whether the IE version is lower than 11
8198
+ var isIE = /MSIE|Trident/.test(navigator.userAgent);
8199
+
8200
+ // fix ie document bounding top always 0 bug
8201
+ var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
8202
+
8203
+ return {
8204
+ left: rect.left,
8205
+ top: rectTop,
8206
+ right: rect.right,
8207
+ bottom: rect.bottom,
8208
+ width: rect.right - rect.left,
8209
+ height: rect.bottom - rectTop
8210
+ };
8211
+ }
8212
+
8213
+ function getStyle(dom, attr) {
8214
+ if (dom.style[attr]) {
8215
+ return dom.style[attr];
8216
+ }
8217
+ if (window.getComputedStyle) {
8218
+ return getComputedStyle(dom, null)[attr];
8219
+ }
8220
+ return dom.currentStyle[attr];
8221
+ }
8222
+
8332
8223
  /**
8333
8224
  * Given an element and one of its parents, return the offset
8334
8225
  * @function
@@ -8336,45 +8227,43 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
8336
8227
  * @param {HTMLElement} element
8337
8228
  * @param {HTMLElement} parent
8338
8229
  * @return {Object} rect
8339
- */
8340
- function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
8341
- var elementRect = getBoundingClientRect(element);
8342
- // parent 为 popper 元素:取其真实包含块的视口 rect,
8343
- // 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
8344
- var parentRect = getContainingBlockRect(parent, fixed);
8345
-
8346
- var rect = {
8347
- top: elementRect.top - parentRect.top,
8348
- left: elementRect.left - parentRect.left,
8349
- bottom: elementRect.top - parentRect.top + elementRect.height,
8350
- right: elementRect.left - parentRect.left + elementRect.width,
8351
- width: elementRect.width,
8352
- height: elementRect.height
8353
- };
8354
- return rect;
8355
- }
8356
-
8230
+ */
8231
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
8232
+ var elementRect = getBoundingClientRect(element);
8233
+ // parent 为 popper 元素:取其真实包含块的视口 rect,
8234
+ // 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
8235
+ var parentRect = getContainingBlockRect(parent, fixed);
8236
+
8237
+ var rect = {
8238
+ top: elementRect.top - parentRect.top,
8239
+ left: elementRect.left - parentRect.left,
8240
+ bottom: elementRect.top - parentRect.top + elementRect.height,
8241
+ right: elementRect.left - parentRect.left + elementRect.width,
8242
+ width: elementRect.width,
8243
+ height: elementRect.height
8244
+ };
8245
+ return rect;
8246
+ }
8247
+
8357
8248
  /**
8358
8249
  * Get the prefixed supported property name
8359
8250
  * @function
8360
8251
  * @ignore
8361
8252
  * @argument {String} property (camelCase)
8362
8253
  * @returns {String} prefixed property (camelCase)
8363
- */
8364
- function getSupportedPropertyName(property) {
8365
- var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
8366
-
8367
- for (var i = 0; i < prefixes.length; i++) {
8368
- var toCheck = prefixes[i]
8369
- ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1)
8370
- : property;
8371
- if (typeof root.document.body.style[toCheck] !== 'undefined') {
8372
- return toCheck;
8373
- }
8374
- }
8375
- return null;
8376
- }
8377
-
8254
+ */
8255
+ function getSupportedPropertyName(property) {
8256
+ var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
8257
+
8258
+ for (var i = 0; i < prefixes.length; i++) {
8259
+ var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
8260
+ if (typeof root.document.body.style[toCheck] !== 'undefined') {
8261
+ return toCheck;
8262
+ }
8263
+ }
8264
+ return null;
8265
+ }
8266
+
8378
8267
  /**
8379
8268
  * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
8380
8269
  * objects to a target object. It will return the target object.
@@ -8382,50 +8271,45 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
8382
8271
  * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
8383
8272
  * @function
8384
8273
  * @ignore
8385
- */
8386
- if (!Object.assign) {
8387
- Object.defineProperty(Object, 'assign', {
8388
- enumerable: false,
8389
- configurable: true,
8390
- writable: true,
8391
- value: function (target) {
8392
- if (target === undefined || target === null) {
8393
- throw new TypeError('Cannot convert first argument to object');
8394
- }
8395
-
8396
- var to = Object(target);
8397
- for (var i = 1; i < arguments.length; i++) {
8398
- var nextSource = arguments[i];
8399
- if (nextSource === undefined || nextSource === null) {
8400
- continue;
8401
- }
8402
- nextSource = Object(nextSource);
8403
-
8404
- var keysArray = Object.keys(nextSource);
8405
- for (
8406
- var nextIndex = 0, len = keysArray.length;
8407
- nextIndex < len;
8408
- nextIndex++
8409
- ) {
8410
- var nextKey = keysArray[nextIndex];
8411
- var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
8412
- if (desc !== undefined && desc.enumerable) {
8413
- to[nextKey] = nextSource[nextKey];
8414
- }
8415
- }
8416
- }
8417
- return to;
8418
- }
8419
- });
8420
- }
8421
-
8422
- return Popper;
8423
- });
8274
+ */
8275
+ if (!Object.assign) {
8276
+ Object.defineProperty(Object, 'assign', {
8277
+ enumerable: false,
8278
+ configurable: true,
8279
+ writable: true,
8280
+ value: function value(target) {
8281
+ if (target === undefined || target === null) {
8282
+ throw new TypeError('Cannot convert first argument to object');
8283
+ }
8284
+
8285
+ var to = Object(target);
8286
+ for (var i = 1; i < arguments.length; i++) {
8287
+ var nextSource = arguments[i];
8288
+ if (nextSource === undefined || nextSource === null) {
8289
+ continue;
8290
+ }
8291
+ nextSource = Object(nextSource);
8292
+
8293
+ var keysArray = Object.keys(nextSource);
8294
+ for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
8295
+ var nextKey = keysArray[nextIndex];
8296
+ var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
8297
+ if (desc !== undefined && desc.enumerable) {
8298
+ to[nextKey] = nextSource[nextKey];
8299
+ }
8300
+ }
8301
+ }
8302
+ return to;
8303
+ }
8304
+ });
8305
+ }
8424
8306
 
8307
+ return Popper;
8308
+ });
8425
8309
 
8426
8310
  /***/ }),
8427
8311
 
8428
- /***/ 58:
8312
+ /***/ 59:
8429
8313
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
8430
8314
 
8431
8315
  "use strict";
@@ -8783,7 +8667,7 @@ function renderThumbStyle(_ref3) {
8783
8667
 
8784
8668
  /***/ }),
8785
8669
 
8786
- /***/ 60:
8670
+ /***/ 61:
8787
8671
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
8788
8672
 
8789
8673
  "use strict";
@@ -8921,7 +8805,7 @@ render._withStripped = true
8921
8805
  // CONCATENATED MODULE: ./packages/menu/src/menu-item.vue?vue&type=template&id=4175d146&
8922
8806
 
8923
8807
  // EXTERNAL MODULE: ./packages/menu/src/menu-mixin.js
8924
- var menu_mixin = __webpack_require__(67);
8808
+ var menu_mixin = __webpack_require__(68);
8925
8809
 
8926
8810
  // EXTERNAL MODULE: external "eoss/lib/tooltip"
8927
8811
  var tooltip_ = __webpack_require__(36);
@@ -9146,7 +9030,7 @@ var component = Object(componentNormalizer["a" /* default */])(
9146
9030
 
9147
9031
  /***/ }),
9148
9032
 
9149
- /***/ 61:
9033
+ /***/ 62:
9150
9034
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
9151
9035
 
9152
9036
  "use strict";
@@ -9276,7 +9160,7 @@ aria.Utils.keys = {
9276
9160
 
9277
9161
  /***/ }),
9278
9162
 
9279
- /***/ 67:
9163
+ /***/ 68:
9280
9164
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
9281
9165
 
9282
9166
  "use strict";
@@ -9325,108 +9209,6 @@ aria.Utils.keys = {
9325
9209
 
9326
9210
  /***/ }),
9327
9211
 
9328
- /***/ 69:
9329
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
9330
-
9331
- "use strict";
9332
- /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
9333
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9334
-
9335
-
9336
-
9337
- var Transition = function () {
9338
- function Transition() {
9339
- _classCallCheck(this, Transition);
9340
- }
9341
-
9342
- Transition.prototype.beforeEnter = function beforeEnter(el) {
9343
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
9344
- if (!el.dataset) el.dataset = {};
9345
- if (el.dataset.state === 6 || !el.dataset.state) {
9346
- el.dataset.oldPaddingTop = el.style.paddingTop;
9347
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
9348
- }
9349
- el.dataset.state = 1;
9350
-
9351
- el.style.height = '0';
9352
- el.style.paddingTop = 0;
9353
- el.style.paddingBottom = 0;
9354
- };
9355
-
9356
- Transition.prototype.enter = function enter(el) {
9357
- el.dataset.oldOverflow = el.style.overflow;
9358
- if (el.scrollHeight !== 0) {
9359
- el.style.height = el.scrollHeight + 'px';
9360
- el.style.paddingTop = el.dataset.oldPaddingTop;
9361
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
9362
- } else {
9363
- el.style.height = '';
9364
- el.style.paddingTop = el.dataset.oldPaddingTop;
9365
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
9366
- }
9367
-
9368
- el.dataset.state = 2;
9369
- el.style.overflow = 'hidden';
9370
- };
9371
-
9372
- Transition.prototype.afterEnter = function afterEnter(el) {
9373
- // for safari: remove class then reset height is necessary
9374
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
9375
- el.style.height = '';
9376
- el.style.overflow = el.dataset.oldOverflow;
9377
- el.dataset.state = 3;
9378
- };
9379
-
9380
- Transition.prototype.beforeLeave = function beforeLeave(el) {
9381
- if (!el.dataset) el.dataset = {};
9382
- el.dataset.oldPaddingTop = el.style.paddingTop;
9383
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
9384
- el.dataset.oldOverflow = el.style.overflow;
9385
- el.dataset.state = 4;
9386
-
9387
- el.style.height = el.scrollHeight + 'px';
9388
- el.style.overflow = 'hidden';
9389
- };
9390
-
9391
- Transition.prototype.leave = function leave(el) {
9392
- if (el.scrollHeight !== 0) {
9393
- // for safari: add class after set height, or it will jump to zero height suddenly, weired
9394
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
9395
- el.style.height = 0;
9396
- el.style.paddingTop = 0;
9397
- el.style.paddingBottom = 0;
9398
- el.dataset.state = 5;
9399
- }
9400
- };
9401
-
9402
- Transition.prototype.afterLeave = function afterLeave(el) {
9403
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
9404
- el.style.height = '';
9405
- el.style.overflow = el.dataset.oldOverflow;
9406
- el.style.paddingTop = el.dataset.oldPaddingTop;
9407
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
9408
- el.dataset.state = 6;
9409
- };
9410
-
9411
- return Transition;
9412
- }();
9413
-
9414
- /* harmony default export */ __webpack_exports__["a"] = ({
9415
- name: 'EsCollapseTransition',
9416
- functional: true,
9417
- render: function render(h, _ref) {
9418
- var children = _ref.children;
9419
-
9420
- var data = {
9421
- on: new Transition()
9422
- };
9423
-
9424
- return h('transition', data, children);
9425
- }
9426
- });
9427
-
9428
- /***/ }),
9429
-
9430
9212
  /***/ 7:
9431
9213
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
9432
9214
 
@@ -9477,946 +9259,1023 @@ var Transition = function () {
9477
9259
  /* unused harmony export getSecond */
9478
9260
  /* unused harmony export getWeekday */
9479
9261
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
9480
- /* Modified from https://github.com/taylorhakes/fecha
9481
- *
9482
- * The MIT License (MIT)
9483
- *
9484
- * Copyright (c) 2015 Taylor Hakes
9485
- *
9486
- * Permission is hereby granted, free of charge, to any person obtaining a copy
9487
- * of this software and associated documentation files (the "Software"), to deal
9488
- * in the Software without restriction, including without limitation the rights
9489
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9490
- * copies of the Software, and to permit persons to whom the Software is
9491
- * furnished to do so, subject to the following conditions:
9492
- *
9493
- * The above copyright notice and this permission notice shall be included in all
9494
- * copies or substantial portions of the Software.
9495
- *
9496
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9497
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9498
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
9499
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9500
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9501
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
9502
- * SOFTWARE.
9503
- */
9504
-
9505
- /*eslint-disable*/
9506
- // 把 YYYY-MM-DD 改成了 yyyy-MM-dd
9507
-
9508
-
9262
+
9263
+
9509
9264
  /**
9510
9265
  * Parse or format dates
9511
9266
  * @class fecha
9512
- */
9513
- const fecha = {};
9514
- const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
9515
- const twoDigits = '\\d\\d?';
9516
- const threeDigits = '\\d{3}';
9517
- const fourDigits = '\\d{4}';
9518
- const word = '[^\\s]+';
9519
- const literal = /\[([^]*?)\]/gm;
9520
- const noop = function () {};
9521
-
9522
- function regexEscape(str) {
9523
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
9524
- }
9525
-
9526
- function shorten(arr, sLen) {
9527
- const newArr = [];
9528
- for (let i = 0, len = arr.length; i < len; i++) {
9529
- newArr.push(arr[i].substr(0, sLen));
9530
- }
9531
- return newArr;
9532
- }
9533
-
9534
- function monthUpdate() {
9535
- return function (d, v) {
9536
- const index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
9537
- if (~index) {
9538
- d.month = index;
9539
- }
9540
- };
9541
- }
9542
-
9543
- function pad(val, len) {
9544
- val = String(val);
9545
- len = len || 2;
9546
- while (val.length < len) {
9547
- val = '0' + val;
9548
- }
9549
- return val;
9550
- }
9551
-
9552
- // 直接使用中文日期名称常量
9553
- const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
9554
- const monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
9555
- const monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
9556
- const dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
9557
- const amPm = ['上午', '下午'];
9558
- const DoFn = function DoFn(D) {
9559
- return D + '日';
9560
- };
9561
-
9562
- const formatFlags = {
9563
- D: function(dateObj) {
9564
- return dateObj.getDay();
9565
- },
9566
- DD: function(dateObj) {
9567
- return pad(dateObj.getDay());
9568
- },
9569
- Do: function(dateObj) {
9570
- return DoFn(dateObj.getDate());
9571
- },
9572
- d: function(dateObj) {
9573
- return dateObj.getDate();
9574
- },
9575
- dd: function(dateObj) {
9576
- return pad(dateObj.getDate());
9577
- },
9578
- ddd: function(dateObj) {
9579
- return dayNamesShort[dateObj.getDay()];
9580
- },
9581
- dddd: function(dateObj) {
9582
- return dayNames[dateObj.getDay()];
9583
- },
9584
- M: function(dateObj) {
9585
- return dateObj.getMonth() + 1;
9586
- },
9587
- MM: function(dateObj) {
9588
- return pad(dateObj.getMonth() + 1);
9589
- },
9590
- MMM: function(dateObj) {
9591
- return monthNamesShort[dateObj.getMonth()];
9592
- },
9593
- MMMM: function(dateObj) {
9594
- return monthNames[dateObj.getMonth()];
9595
- },
9596
- yy: function(dateObj) {
9597
- return pad(String(dateObj.getFullYear()), 4).substr(2);
9598
- },
9599
- yyyy: function(dateObj) {
9600
- return pad(dateObj.getFullYear(), 4);
9601
- },
9602
- h: function(dateObj) {
9603
- return dateObj.getHours() % 12 || 12;
9604
- },
9605
- hh: function(dateObj) {
9606
- return pad(dateObj.getHours() % 12 || 12);
9607
- },
9608
- H: function(dateObj) {
9609
- return dateObj.getHours();
9610
- },
9611
- HH: function(dateObj) {
9612
- return pad(dateObj.getHours());
9613
- },
9614
- m: function(dateObj) {
9615
- return dateObj.getMinutes();
9616
- },
9617
- mm: function(dateObj) {
9618
- return pad(dateObj.getMinutes());
9619
- },
9620
- s: function(dateObj) {
9621
- return dateObj.getSeconds();
9622
- },
9623
- ss: function(dateObj) {
9624
- return pad(dateObj.getSeconds());
9625
- },
9626
- S: function(dateObj) {
9627
- return Math.round(dateObj.getMilliseconds() / 100);
9628
- },
9629
- SS: function(dateObj) {
9630
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
9631
- },
9632
- SSS: function(dateObj) {
9633
- return pad(dateObj.getMilliseconds(), 3);
9634
- },
9635
- a: function(dateObj) {
9636
- return dateObj.getHours() < 12 ? '上午' : '下午';
9637
- },
9638
- A: function(dateObj) {
9639
- return dateObj.getHours() < 12 ? '上午' : '下午';
9640
- },
9641
- ZZ: function(dateObj) {
9642
- const o = dateObj.getTimezoneOffset();
9643
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
9644
- }
9645
- };
9646
-
9647
- const parseFlags = {
9648
- d: [twoDigits, function (d, v) {
9649
- d.day = v;
9650
- }],
9651
- Do: [twoDigits + word, function (d, v) {
9652
- d.day = parseInt(v, 10);
9653
- }],
9654
- M: [twoDigits, function (d, v) {
9655
- d.month = v - 1;
9656
- }],
9657
- yy: [twoDigits, function (d, v) {
9658
- const da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
9659
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
9660
- }],
9661
- h: [twoDigits, function (d, v) {
9662
- d.hour = v;
9663
- }],
9664
- m: [twoDigits, function (d, v) {
9665
- d.minute = v;
9666
- }],
9667
- s: [twoDigits, function (d, v) {
9668
- d.second = v;
9669
- }],
9670
- yyyy: [fourDigits, function (d, v) {
9671
- d.year = v;
9672
- }],
9673
- S: ['\\d', function (d, v) {
9674
- d.millisecond = v * 100;
9675
- }],
9676
- SS: ['\\d{2}', function (d, v) {
9677
- d.millisecond = v * 10;
9678
- }],
9679
- SSS: [threeDigits, function (d, v) {
9680
- d.millisecond = v;
9681
- }],
9682
- D: [twoDigits, noop],
9683
- ddd: [word, noop],
9684
- MMM: [word, monthUpdate('monthNamesShort')],
9685
- MMMM: [word, monthUpdate('monthNames')],
9686
- a: [word, function (d, v) {
9687
- const val = v.toLowerCase();
9688
- if (val === '上午') {
9689
- d.isPm = false;
9690
- } else if (val === '下午') {
9691
- d.isPm = true;
9692
- }
9693
- }],
9694
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
9695
- let parts = (v + '').match(/([+-]|\d\d)/gi), minutes;
9696
-
9697
- if (parts) {
9698
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
9699
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
9700
- }
9701
- }]
9702
- };
9703
- parseFlags.dd = parseFlags.d;
9704
- parseFlags.dddd = parseFlags.ddd;
9705
- parseFlags.DD = parseFlags.D;
9706
- parseFlags.mm = parseFlags.m;
9707
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
9708
- parseFlags.MM = parseFlags.M;
9709
- parseFlags.ss = parseFlags.s;
9710
- parseFlags.A = parseFlags.a;
9711
-
9712
-
9713
- // Some common format strings
9714
- fecha.masks = {
9715
- default: 'ddd MMM dd yyyy HH:mm:ss',
9716
- shortDate: 'M/D/yy',
9717
- mediumDate: 'MMM d, yyyy',
9718
- longDate: 'MMMM d, yyyy',
9719
- fullDate: 'dddd, MMMM d, yyyy',
9720
- shortTime: 'HH:mm',
9721
- mediumTime: 'HH:mm:ss',
9722
- longTime: 'HH:mm:ss.SSS'
9723
- };
9724
-
9267
+ */
9268
+ var fecha = {};
9269
+ var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
9270
+ var twoDigits = '\\d\\d?';
9271
+ var threeDigits = '\\d{3}';
9272
+ var fourDigits = '\\d{4}';
9273
+ var word = '[^\\s]+';
9274
+ var literal = /\[([^]*?)\]/gm;
9275
+ var noop = function noop() {};
9276
+
9277
+ function regexEscape(str) {
9278
+ return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
9279
+ }
9280
+
9281
+ function shorten(arr, sLen) {
9282
+ var newArr = [];
9283
+ for (var i = 0, len = arr.length; i < len; i++) {
9284
+ newArr.push(arr[i].substr(0, sLen));
9285
+ }
9286
+ return newArr;
9287
+ }
9288
+
9289
+ function monthUpdate() {
9290
+ return function (d, v) {
9291
+ var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
9292
+ if (~index) {
9293
+ d.month = index;
9294
+ }
9295
+ };
9296
+ }
9297
+
9298
+ function pad(val, len) {
9299
+ val = String(val);
9300
+ len = len || 2;
9301
+ while (val.length < len) {
9302
+ val = '0' + val;
9303
+ }
9304
+ return val;
9305
+ }
9306
+
9307
+ // 直接使用中文日期名称常量
9308
+ var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
9309
+ var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
9310
+ var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
9311
+ var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
9312
+ var amPm = ['上午', '下午'];
9313
+ var DoFn = function DoFn(D) {
9314
+ return D + '日';
9315
+ };
9316
+
9317
+ var formatFlags = {
9318
+ D: function D(dateObj) {
9319
+ return dateObj.getDay();
9320
+ },
9321
+ DD: function DD(dateObj) {
9322
+ return pad(dateObj.getDay());
9323
+ },
9324
+ Do: function Do(dateObj) {
9325
+ return DoFn(dateObj.getDate());
9326
+ },
9327
+ d: function d(dateObj) {
9328
+ return dateObj.getDate();
9329
+ },
9330
+ dd: function dd(dateObj) {
9331
+ return pad(dateObj.getDate());
9332
+ },
9333
+ ddd: function ddd(dateObj) {
9334
+ return dayNamesShort[dateObj.getDay()];
9335
+ },
9336
+ dddd: function dddd(dateObj) {
9337
+ return dayNames[dateObj.getDay()];
9338
+ },
9339
+ M: function M(dateObj) {
9340
+ return dateObj.getMonth() + 1;
9341
+ },
9342
+ MM: function MM(dateObj) {
9343
+ return pad(dateObj.getMonth() + 1);
9344
+ },
9345
+ MMM: function MMM(dateObj) {
9346
+ return monthNamesShort[dateObj.getMonth()];
9347
+ },
9348
+ MMMM: function MMMM(dateObj) {
9349
+ return monthNames[dateObj.getMonth()];
9350
+ },
9351
+ yy: function yy(dateObj) {
9352
+ return pad(String(dateObj.getFullYear()), 4).substr(2);
9353
+ },
9354
+ yyyy: function yyyy(dateObj) {
9355
+ return pad(dateObj.getFullYear(), 4);
9356
+ },
9357
+ h: function h(dateObj) {
9358
+ return dateObj.getHours() % 12 || 12;
9359
+ },
9360
+ hh: function hh(dateObj) {
9361
+ return pad(dateObj.getHours() % 12 || 12);
9362
+ },
9363
+ H: function H(dateObj) {
9364
+ return dateObj.getHours();
9365
+ },
9366
+ HH: function HH(dateObj) {
9367
+ return pad(dateObj.getHours());
9368
+ },
9369
+ m: function m(dateObj) {
9370
+ return dateObj.getMinutes();
9371
+ },
9372
+ mm: function mm(dateObj) {
9373
+ return pad(dateObj.getMinutes());
9374
+ },
9375
+ s: function s(dateObj) {
9376
+ return dateObj.getSeconds();
9377
+ },
9378
+ ss: function ss(dateObj) {
9379
+ return pad(dateObj.getSeconds());
9380
+ },
9381
+ S: function S(dateObj) {
9382
+ return Math.round(dateObj.getMilliseconds() / 100);
9383
+ },
9384
+ SS: function SS(dateObj) {
9385
+ return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
9386
+ },
9387
+ SSS: function SSS(dateObj) {
9388
+ return pad(dateObj.getMilliseconds(), 3);
9389
+ },
9390
+ a: function a(dateObj) {
9391
+ return dateObj.getHours() < 12 ? '上午' : '下午';
9392
+ },
9393
+ A: function A(dateObj) {
9394
+ return dateObj.getHours() < 12 ? '上午' : '下午';
9395
+ },
9396
+ ZZ: function ZZ(dateObj) {
9397
+ var o = dateObj.getTimezoneOffset();
9398
+ return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
9399
+ }
9400
+ };
9401
+
9402
+ var parseFlags = {
9403
+ d: [twoDigits, function (d, v) {
9404
+ d.day = v;
9405
+ }],
9406
+ Do: [twoDigits + word, function (d, v) {
9407
+ d.day = parseInt(v, 10);
9408
+ }],
9409
+ M: [twoDigits, function (d, v) {
9410
+ d.month = v - 1;
9411
+ }],
9412
+ yy: [twoDigits, function (d, v) {
9413
+ var da = new Date(),
9414
+ cent = +('' + da.getFullYear()).substr(0, 2);
9415
+ d.year = '' + (v > 68 ? cent - 1 : cent) + v;
9416
+ }],
9417
+ h: [twoDigits, function (d, v) {
9418
+ d.hour = v;
9419
+ }],
9420
+ m: [twoDigits, function (d, v) {
9421
+ d.minute = v;
9422
+ }],
9423
+ s: [twoDigits, function (d, v) {
9424
+ d.second = v;
9425
+ }],
9426
+ yyyy: [fourDigits, function (d, v) {
9427
+ d.year = v;
9428
+ }],
9429
+ S: ['\\d', function (d, v) {
9430
+ d.millisecond = v * 100;
9431
+ }],
9432
+ SS: ['\\d{2}', function (d, v) {
9433
+ d.millisecond = v * 10;
9434
+ }],
9435
+ SSS: [threeDigits, function (d, v) {
9436
+ d.millisecond = v;
9437
+ }],
9438
+ D: [twoDigits, noop],
9439
+ ddd: [word, noop],
9440
+ MMM: [word, monthUpdate('monthNamesShort')],
9441
+ MMMM: [word, monthUpdate('monthNames')],
9442
+ a: [word, function (d, v) {
9443
+ var val = v.toLowerCase();
9444
+ if (val === '上午') {
9445
+ d.isPm = false;
9446
+ } else if (val === '下午') {
9447
+ d.isPm = true;
9448
+ }
9449
+ }],
9450
+ ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
9451
+ var parts = (v + '').match(/([+-]|\d\d)/gi),
9452
+ minutes = void 0;
9453
+
9454
+ if (parts) {
9455
+ minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
9456
+ d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
9457
+ }
9458
+ }]
9459
+ };
9460
+ parseFlags.dd = parseFlags.d;
9461
+ parseFlags.dddd = parseFlags.ddd;
9462
+ parseFlags.DD = parseFlags.D;
9463
+ parseFlags.mm = parseFlags.m;
9464
+ parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
9465
+ parseFlags.MM = parseFlags.M;
9466
+ parseFlags.ss = parseFlags.s;
9467
+ parseFlags.A = parseFlags.a;
9468
+
9469
+ // Some common format strings
9470
+ fecha.masks = {
9471
+ default: 'ddd MMM dd yyyy HH:mm:ss',
9472
+ shortDate: 'M/D/yy',
9473
+ mediumDate: 'MMM d, yyyy',
9474
+ longDate: 'MMMM d, yyyy',
9475
+ fullDate: 'dddd, MMMM d, yyyy',
9476
+ shortTime: 'HH:mm',
9477
+ mediumTime: 'HH:mm:ss',
9478
+ longTime: 'HH:mm:ss.SSS'
9479
+ };
9480
+
9725
9481
  /***
9726
9482
  * Format a date
9727
9483
  * @method format
9728
9484
  * @param {Date|number} dateObj
9729
9485
  * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
9730
- */
9731
- fecha.format = function (dateObj, mask) {
9732
- if (typeof dateObj === 'number') {
9733
- dateObj = new Date(dateObj);
9734
- }
9735
-
9736
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
9737
- throw new Error('Invalid Date in fecha.format');
9738
- }
9739
-
9740
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
9741
-
9742
- const literals = [];
9743
-
9744
- // Make literals inactive by replacing them with ??
9745
- mask = mask.replace(literal, function($0, $1) {
9746
- literals.push($1);
9747
- return '@@@';
9748
- });
9749
- // Apply formatting rules
9750
- mask = mask.replace(token, function ($0) {
9751
- return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
9752
- });
9753
- // Inline literal values back into the formatted value
9754
- return mask.replace(/@@@/g, function() {
9755
- return literals.shift();
9756
- });
9757
- };
9758
-
9486
+ */
9487
+ fecha.format = function (dateObj, mask) {
9488
+ if (typeof dateObj === 'number') {
9489
+ dateObj = new Date(dateObj);
9490
+ }
9491
+
9492
+ if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
9493
+ throw new Error('Invalid Date in fecha.format');
9494
+ }
9495
+
9496
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
9497
+
9498
+ var literals = [];
9499
+
9500
+ // Make literals inactive by replacing them with ??
9501
+ mask = mask.replace(literal, function ($0, $1) {
9502
+ literals.push($1);
9503
+ return '@@@';
9504
+ });
9505
+ // Apply formatting rules
9506
+ mask = mask.replace(token, function ($0) {
9507
+ return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
9508
+ });
9509
+ // Inline literal values back into the formatted value
9510
+ return mask.replace(/@@@/g, function () {
9511
+ return literals.shift();
9512
+ });
9513
+ };
9514
+
9759
9515
  /**
9760
9516
  * Parse a date string into an object, changes - into /
9761
9517
  * @method parse
9762
9518
  * @param {string} dateStr Date string
9763
9519
  * @param {string} format Date parse format
9764
9520
  * @returns {Date|boolean}
9765
- */
9766
- fecha.parse = function (dateStr, format) {
9767
- if (typeof format !== 'string') {
9768
- throw new Error('Invalid format in fecha.parse');
9769
- }
9770
-
9771
- format = fecha.masks[format] || format;
9772
-
9773
- // Avoid regular expression denial of service, fail early for really long strings
9774
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
9775
- if (dateStr.length > 1000) {
9776
- return null;
9777
- }
9778
-
9779
- const dateInfo = {};
9780
- const parseInfo = [];
9781
- const literals = [];
9782
- format = format.replace(literal, function($0, $1) {
9783
- literals.push($1);
9784
- return '@@@';
9785
- });
9786
- let newFormat = regexEscape(format).replace(token, function ($0) {
9787
- if (parseFlags[$0]) {
9788
- const info = parseFlags[$0];
9789
- parseInfo.push(info[1]);
9790
- return '(' + info[0] + ')';
9791
- }
9792
-
9793
- return $0;
9794
- });
9795
- newFormat = newFormat.replace(/@@@/g, function() {
9796
- return literals.shift();
9797
- });
9798
- const matches = dateStr.match(new RegExp(newFormat, 'i'));
9799
- if (!matches) {
9800
- return null;
9801
- }
9802
-
9803
- for (let i = 1; i < matches.length; i++) {
9804
- parseInfo[i - 1](dateInfo, matches[i]);
9805
- }
9806
-
9807
- const today = new Date();
9808
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
9809
- dateInfo.hour = +dateInfo.hour + 12;
9810
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
9811
- dateInfo.hour = 0;
9812
- }
9813
-
9814
- let date;
9815
- if (dateInfo.timezoneOffset != null) {
9816
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
9817
- date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
9818
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
9819
- } else {
9820
- date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
9821
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
9822
- }
9823
- return date;
9824
- };
9825
-
9826
- // 导出fecha对象
9827
-
9828
-
9829
- // 以下是从date-util.js合并的函数
9830
- const newArray = function(start, end) {
9831
- let result = [];
9832
- for (let i = start; i <= end; i++) {
9833
- result.push(i);
9834
- }
9835
- return result;
9836
- };
9837
-
9838
- const getSettings = () => {
9839
- return {
9840
- dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
9841
- dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
9842
- monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
9843
- monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
9844
- amPm: ['上午', '下午']
9845
- };
9846
- };
9847
-
9848
- const toDate = function(date) {
9849
- return isDate(date) ? new Date(date) : null;
9850
- };
9851
-
9852
- const isDate = function(date) {
9853
- if (date === null || date === undefined) return false;
9854
- if (isNaN(new Date(date).getTime())) return false;
9855
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
9856
- return true;
9857
- };
9858
-
9859
- const isDateObject = function(val) {
9860
- return val instanceof Date;
9861
- };
9862
-
9863
- const formatDate = function (date, format = 'yyyy-MM-dd') {
9864
- // 处理多种输入类型
9865
- if (!date) return '';
9866
-
9867
- // 如果是时间戳,转成日期对象
9868
- if (typeof date === 'number') {
9869
- date = new Date(date);
9870
- }
9871
- // 如果是字符串,转成日期对象
9872
- if (typeof date === 'string') {
9873
- date = new Date(date);
9874
- }
9875
-
9876
- // 调用toDate进一步验证和转换
9877
- date = toDate(date);
9878
- if (!date) return '';
9879
-
9880
- // 兼容大写和小写的格式标记
9881
- // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
9882
- const lowercaseFormat = format
9883
- .replace(/YYYY/g, 'yyyy')
9884
- .replace(/D/g, 'd')
9885
-
9886
- // 使用fecha库进行格式化,支持中文配置
9887
- const str = fecha.format(date, lowercaseFormat, getSettings());
9888
- return str;
9889
- };
9890
-
9891
- const parseDate = function(string, format) {
9892
- return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
9893
- };
9894
-
9895
- const getDayCountOfMonth = function(year, month) {
9896
- if (month === 3 || month === 5 || month === 8 || month === 10) {
9897
- return 30;
9898
- }
9899
-
9900
- if (month === 1) {
9901
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
9902
- return 29;
9903
- } else {
9904
- return 28;
9905
- }
9906
- }
9907
-
9908
- return 31;
9909
- };
9910
-
9911
- const getDayCountOfYear = function(year) {
9912
- const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
9913
- return isLeapYear ? 366 : 365;
9914
- };
9915
-
9916
- const getFirstDayOfMonth = function(date) {
9917
- const temp = new Date(date.getTime());
9918
- temp.setDate(1);
9919
- return temp.getDay();
9920
- };
9921
-
9922
- // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
9923
- // {prev, next} Date should work for Daylight Saving Time
9924
- // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
9925
- const prevDate = function(date, amount = 1) {
9926
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
9927
- };
9928
-
9929
- const nextDate = function(date, amount = 1) {
9930
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
9931
- };
9932
-
9933
- const getStartDateOfMonth = function(year, month) {
9934
- const result = new Date(year, month, 1);
9935
- const day = result.getDay();
9936
-
9937
- if (day === 0) {
9938
- return prevDate(result, 7);
9939
- } else {
9940
- return prevDate(result, day);
9941
- }
9942
- };
9943
-
9944
- const getWeekNumber = function(date) {
9945
- // 支持多种输入类型
9946
- if (!date||!isDate(date)) {
9947
- date = new Date();
9948
- }
9949
- if (typeof date === 'string') {
9950
- date = new Date(date);
9951
- }
9952
-
9953
- // 验证日期有效性
9954
- if (!isDate(date)) return null;
9955
-
9956
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
9957
- // 设置为最近的星期四:当前日期 + 4 - 当前星期数
9958
- // 将星期日的星期数设为7
9959
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
9960
- // 获取当年的第一天
9961
- const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
9962
- // 计算到最近的星期四的完整周数
9963
- const weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
9964
- // 返回周数
9965
- return weekNo;
9966
- };
9967
-
9968
- const getRangeHours = function(ranges) {
9969
- const hours = [];
9970
- let disabledHours = [];
9971
-
9972
- (ranges || []).forEach(range => {
9973
- const value = range.map(date => date.getHours());
9974
-
9975
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
9976
- });
9977
-
9978
- if (disabledHours.length) {
9979
- for (let i = 0; i < 24; i++) {
9980
- hours[i] = disabledHours.indexOf(i) === -1;
9981
- }
9982
- } else {
9983
- for (let i = 0; i < 24; i++) {
9984
- hours[i] = false;
9985
- }
9986
- }
9987
-
9988
- return hours;
9989
- };
9990
-
9991
- const getPrevMonthLastDays = (date, amount) => {
9992
- if (amount <= 0) return [];
9993
- const temp = new Date(date.getTime());
9994
- temp.setDate(0);
9995
- const lastDay = temp.getDate();
9996
- return range(amount).map((_, index) => lastDay - (amount - index - 1));
9997
- };
9998
-
9999
- const getMonthDays = (date) => {
10000
- const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
10001
- const days = temp.getDate();
10002
- return range(days).map((_, index) => index + 1);
10003
- };
10004
-
10005
- function setRangeData(arr, start, end, value) {
10006
- for (let i = start; i < end; i++) {
10007
- arr[i] = value;
10008
- }
10009
- }
10010
-
10011
- const getRangeMinutes = function(ranges, hour) {
10012
- const minutes = new Array(60);
10013
-
10014
- if (ranges.length > 0) {
10015
- ranges.forEach(range => {
10016
- const start = range[0];
10017
- const end = range[1];
10018
- const startHour = start.getHours();
10019
- const startMinute = start.getMinutes();
10020
- const endHour = end.getHours();
10021
- const endMinute = end.getMinutes();
10022
- if (startHour === hour && endHour !== hour) {
10023
- setRangeData(minutes, startMinute, 60, true);
10024
- } else if (startHour === hour && endHour === hour) {
10025
- setRangeData(minutes, startMinute, endMinute + 1, true);
10026
- } else if (startHour !== hour && endHour === hour) {
10027
- setRangeData(minutes, 0, endMinute + 1, true);
10028
- } else if (startHour < hour && endHour > hour) {
10029
- setRangeData(minutes, 0, 60, true);
10030
- }
10031
- });
10032
- } else {
10033
- setRangeData(minutes, 0, 60, true);
10034
- }
10035
- return minutes;
10036
- };
10037
-
10038
- const range = function(n) {
10039
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
10040
- return Array.apply(null, {length: n}).map((_, n) => n);
10041
- };
10042
-
10043
- const modifyDate = function(date, y, m, d) {
10044
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
10045
- };
10046
-
10047
- const modifyTime = function(date, h, m, s) {
10048
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
10049
- };
10050
-
10051
- const modifyWithTimeString = (date, time) => {
10052
- if (date == null || !time) {
10053
- return date;
10054
- }
10055
- time = parseDate(time, 'HH:mm:ss');
10056
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
10057
- };
10058
-
10059
- const clearTime = function(date) {
10060
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
10061
- };
10062
-
10063
- const clearMilliseconds = function(date) {
10064
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
10065
- };
10066
-
10067
- const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
10068
- // TODO: refactory a more elegant solution
10069
- if (ranges.length === 0) return date;
10070
- const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
10071
- const ndate = normalizeDate(date);
10072
- const nranges = ranges.map(range => range.map(normalizeDate));
10073
- if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
10074
-
10075
- let minDate = nranges[0][0];
10076
- let maxDate = nranges[0][0];
10077
-
10078
- nranges.forEach(nrange => {
10079
- minDate = new Date(Math.min(nrange[0], minDate));
10080
- maxDate = new Date(Math.max(nrange[1], minDate));
10081
- });
10082
-
10083
- const ret = ndate < minDate ? minDate : maxDate;
10084
- // preserve Year/Month/Date
10085
- return modifyDate(
10086
- ret,
10087
- date.getFullYear(),
10088
- date.getMonth(),
10089
- date.getDate()
10090
- );
10091
- };
10092
-
10093
- const timeWithinRange = function(date, selectableRange, format) {
10094
- const limitedDate = limitTimeRange(date, selectableRange, format);
10095
- return limitedDate.getTime() === date.getTime();
10096
- };
10097
-
10098
- const changeYearMonthAndClampDate = function(date, year, month) {
10099
- // clamp date to the number of days in `year`, `month`
10100
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
10101
- const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
10102
- return modifyDate(date, year, month, monthDate);
10103
- };
10104
-
10105
- const prevMonth = function(date) {
10106
- const year = date.getFullYear();
10107
- const month = date.getMonth();
10108
- return month === 0
10109
- ? changeYearMonthAndClampDate(date, year - 1, 11)
10110
- : changeYearMonthAndClampDate(date, year, month - 1);
10111
- };
10112
-
10113
- const nextMonth = function(date) {
10114
- const year = date.getFullYear();
10115
- const month = date.getMonth();
10116
- return month === 11
10117
- ? changeYearMonthAndClampDate(date, year + 1, 0)
10118
- : changeYearMonthAndClampDate(date, year, month + 1);
10119
- };
10120
-
10121
- const prevYear = function(date, amount = 1) {
10122
- const year = date.getFullYear();
10123
- const month = date.getMonth();
10124
- return changeYearMonthAndClampDate(date, year - amount, month);
10125
- };
10126
-
10127
- const nextYear = function(date, amount = 1) {
10128
- const year = date.getFullYear();
10129
- const month = date.getMonth();
10130
- return changeYearMonthAndClampDate(date, year + amount, month);
10131
- };
10132
-
10133
- const extractDateFormat = function(format) {
10134
- return format
10135
- .replace(/\W?m{1,2}|\W?ZZ/g, '')
10136
- .replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
10137
- .trim();
10138
- };
10139
-
10140
- const extractTimeFormat = function(format) {
10141
- return format
10142
- .replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
10143
- .trim();
10144
- };
10145
-
10146
- const validateRangeInOneMonth = function(start, end) {
10147
- return (start.getMonth() === end.getMonth()) && (start.getFullYear() === end.getFullYear());
10148
- };
10149
-
10150
- /**
10151
- * 计算两个日期之间的工作日数量(不包括周末和节假日)
10152
- * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
10153
- * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
10154
- * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
10155
- * @returns {number} 工作日数量
10156
- */
10157
- const calculateNetworkDays = function (start_date, end_date, holidays = []) {
10158
- if (typeof start_date !== 'string' || typeof end_date !== 'string') {
10159
- throw new Error(
10160
- "Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'."
10161
- );
10162
- }
10163
-
10164
- const startDateObj = new Date(start_date);
10165
- const endDateObj = new Date(end_date);
10166
-
10167
- if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
10168
- throw new Error(
10169
- "Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'."
10170
- );
10171
- }
10172
-
10173
- if (startDateObj > endDateObj) {
10174
- throw new Error('Start date should be earlier than or equal to end date.');
10175
- }
10176
-
10177
- let workdays = 0;
10178
-
10179
- // Iterate through each day in the date range
10180
- for (
10181
- let currentDate = new Date(startDateObj);
10182
- currentDate <= endDateObj;
10183
- currentDate.setDate(currentDate.getDate() + 1)
10184
- ) {
10185
- // Check if the current day is a weekend (Saturday or Sunday)
10186
- const isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
10187
-
10188
- // Check if the current day is a holiday
10189
- const isHoliday = holidays.some((holiday) => {
10190
- const holidayDate = new Date(holiday);
10191
- return currentDate.toDateString() === holidayDate.toDateString();
10192
- });
10193
-
10194
- // If it's a workday (not a weekend or holiday), increment the workdays count
10195
- if (!isWeekend && !isHoliday) {
10196
- workdays++;
10197
- }
10198
- }
10199
-
10200
- return workdays;
10201
- };
10202
-
10203
- /**
10204
- * 日期加减天数
10205
- * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
10206
- * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
10207
- * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
10208
- */
10209
- const dateAddDays = function (start_date, days) {
10210
- if (typeof start_date !== 'string' || !Number.isInteger(days)) {
10211
- throw new Error(
10212
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days."
10213
- );
10214
- }
10215
-
10216
- const startDateObj = new Date(start_date);
10217
- if (isNaN(startDateObj.getTime())) {
10218
- throw new Error(
10219
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
10220
- );
10221
- }
10222
-
10223
- const resultDateObj = new Date(startDateObj);
10224
- resultDateObj.setDate(resultDateObj.getDate() + days);
10225
-
10226
- const resultYear = resultDateObj.getFullYear();
10227
- const resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
10228
- const resultDay = String(resultDateObj.getDate()).padStart(2, '0');
10229
-
10230
- return `${resultYear}-${resultMonth}-${resultDay}`;
10231
- };
10232
-
10233
- /**
9521
+ */
9522
+ fecha.parse = function (dateStr, format) {
9523
+ if (typeof format !== 'string') {
9524
+ throw new Error('Invalid format in fecha.parse');
9525
+ }
9526
+
9527
+ format = fecha.masks[format] || format;
9528
+
9529
+ // Avoid regular expression denial of service, fail early for really long strings
9530
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
9531
+ if (dateStr.length > 1000) {
9532
+ return null;
9533
+ }
9534
+
9535
+ var dateInfo = {};
9536
+ var parseInfo = [];
9537
+ var literals = [];
9538
+ format = format.replace(literal, function ($0, $1) {
9539
+ literals.push($1);
9540
+ return '@@@';
9541
+ });
9542
+ var newFormat = regexEscape(format).replace(token, function ($0) {
9543
+ if (parseFlags[$0]) {
9544
+ var info = parseFlags[$0];
9545
+ parseInfo.push(info[1]);
9546
+ return '(' + info[0] + ')';
9547
+ }
9548
+
9549
+ return $0;
9550
+ });
9551
+ newFormat = newFormat.replace(/@@@/g, function () {
9552
+ return literals.shift();
9553
+ });
9554
+ var matches = dateStr.match(new RegExp(newFormat, 'i'));
9555
+ if (!matches) {
9556
+ return null;
9557
+ }
9558
+
9559
+ for (var i = 1; i < matches.length; i++) {
9560
+ parseInfo[i - 1](dateInfo, matches[i]);
9561
+ }
9562
+
9563
+ var today = new Date();
9564
+ if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
9565
+ dateInfo.hour = +dateInfo.hour + 12;
9566
+ } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
9567
+ dateInfo.hour = 0;
9568
+ }
9569
+
9570
+ var date = void 0;
9571
+ if (dateInfo.timezoneOffset != null) {
9572
+ dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
9573
+ date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
9574
+ } else {
9575
+ date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
9576
+ }
9577
+ return date;
9578
+ };
9579
+
9580
+ // 导出fecha对象
9581
+
9582
+
9583
+ // 以下是从date-util.js合并的函数
9584
+ var newArray = function newArray(start, end) {
9585
+ var result = [];
9586
+ for (var i = start; i <= end; i++) {
9587
+ result.push(i);
9588
+ }
9589
+ return result;
9590
+ };
9591
+
9592
+ var getSettings = function getSettings() {
9593
+ return {
9594
+ dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
9595
+ dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
9596
+ monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
9597
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
9598
+ amPm: ['上午', '下午']
9599
+ };
9600
+ };
9601
+
9602
+ var toDate = function toDate(date) {
9603
+ return isDate(date) ? new Date(date) : null;
9604
+ };
9605
+
9606
+ var isDate = function isDate(date) {
9607
+ if (date === null || date === undefined) return false;
9608
+ if (isNaN(new Date(date).getTime())) return false;
9609
+ if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
9610
+ return true;
9611
+ };
9612
+
9613
+ var isDateObject = function isDateObject(val) {
9614
+ return val instanceof Date;
9615
+ };
9616
+
9617
+ var formatDate = function formatDate(date) {
9618
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
9619
+
9620
+ // 处理多种输入类型
9621
+ if (!date) return '';
9622
+
9623
+ // 如果是时间戳,转成日期对象
9624
+ if (typeof date === 'number') {
9625
+ date = new Date(date);
9626
+ }
9627
+ // 如果是字符串,转成日期对象
9628
+ if (typeof date === 'string') {
9629
+ date = new Date(date);
9630
+ }
9631
+
9632
+ // 调用toDate进一步验证和转换
9633
+ date = toDate(date);
9634
+ if (!date) return '';
9635
+
9636
+ // 兼容大写和小写的格式标记
9637
+ // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
9638
+ var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
9639
+
9640
+ // 使用fecha库进行格式化,支持中文配置
9641
+ var str = fecha.format(date, lowercaseFormat, getSettings());
9642
+ return str;
9643
+ };
9644
+
9645
+ var parseDate = function parseDate(string, format) {
9646
+ return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
9647
+ };
9648
+
9649
+ var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
9650
+ if (month === 3 || month === 5 || month === 8 || month === 10) {
9651
+ return 30;
9652
+ }
9653
+
9654
+ if (month === 1) {
9655
+ if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
9656
+ return 29;
9657
+ } else {
9658
+ return 28;
9659
+ }
9660
+ }
9661
+
9662
+ return 31;
9663
+ };
9664
+
9665
+ var getDayCountOfYear = function getDayCountOfYear(year) {
9666
+ var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
9667
+ return isLeapYear ? 366 : 365;
9668
+ };
9669
+
9670
+ var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
9671
+ var temp = new Date(date.getTime());
9672
+ temp.setDate(1);
9673
+ return temp.getDay();
9674
+ };
9675
+
9676
+ // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
9677
+ // {prev, next} Date should work for Daylight Saving Time
9678
+ // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
9679
+ var prevDate = function prevDate(date) {
9680
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9681
+
9682
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
9683
+ };
9684
+
9685
+ var nextDate = function nextDate(date) {
9686
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9687
+
9688
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
9689
+ };
9690
+
9691
+ var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
9692
+ var result = new Date(year, month, 1);
9693
+ var day = result.getDay();
9694
+
9695
+ if (day === 0) {
9696
+ return prevDate(result, 7);
9697
+ } else {
9698
+ return prevDate(result, day);
9699
+ }
9700
+ };
9701
+
9702
+ var getWeekNumber = function getWeekNumber(date) {
9703
+ // 支持多种输入类型
9704
+ if (!date || !isDate(date)) {
9705
+ date = new Date();
9706
+ }
9707
+ if (typeof date === 'string') {
9708
+ date = new Date(date);
9709
+ }
9710
+
9711
+ // 验证日期有效性
9712
+ if (!isDate(date)) return null;
9713
+
9714
+ var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
9715
+ // 设置为最近的星期四:当前日期 + 4 - 当前星期数
9716
+ // 将星期日的星期数设为7
9717
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
9718
+ // 获取当年的第一天
9719
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
9720
+ // 计算到最近的星期四的完整周数
9721
+ var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
9722
+ // 返回周数
9723
+ return weekNo;
9724
+ };
9725
+
9726
+ var getRangeHours = function getRangeHours(ranges) {
9727
+ var hours = [];
9728
+ var disabledHours = [];
9729
+
9730
+ (ranges || []).forEach(function (range) {
9731
+ var value = range.map(function (date) {
9732
+ return date.getHours();
9733
+ });
9734
+
9735
+ disabledHours = disabledHours.concat(newArray(value[0], value[1]));
9736
+ });
9737
+
9738
+ if (disabledHours.length) {
9739
+ for (var i = 0; i < 24; i++) {
9740
+ hours[i] = disabledHours.indexOf(i) === -1;
9741
+ }
9742
+ } else {
9743
+ for (var _i = 0; _i < 24; _i++) {
9744
+ hours[_i] = false;
9745
+ }
9746
+ }
9747
+
9748
+ return hours;
9749
+ };
9750
+
9751
+ var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
9752
+ if (amount <= 0) return [];
9753
+ var temp = new Date(date.getTime());
9754
+ temp.setDate(0);
9755
+ var lastDay = temp.getDate();
9756
+ return range(amount).map(function (_, index) {
9757
+ return lastDay - (amount - index - 1);
9758
+ });
9759
+ };
9760
+
9761
+ var getMonthDays = function getMonthDays(date) {
9762
+ var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
9763
+ var days = temp.getDate();
9764
+ return range(days).map(function (_, index) {
9765
+ return index + 1;
9766
+ });
9767
+ };
9768
+
9769
+ function setRangeData(arr, start, end, value) {
9770
+ for (var i = start; i < end; i++) {
9771
+ arr[i] = value;
9772
+ }
9773
+ }
9774
+
9775
+ var getRangeMinutes = function getRangeMinutes(ranges, hour) {
9776
+ var minutes = new Array(60);
9777
+
9778
+ if (ranges.length > 0) {
9779
+ ranges.forEach(function (range) {
9780
+ var start = range[0];
9781
+ var end = range[1];
9782
+ var startHour = start.getHours();
9783
+ var startMinute = start.getMinutes();
9784
+ var endHour = end.getHours();
9785
+ var endMinute = end.getMinutes();
9786
+ if (startHour === hour && endHour !== hour) {
9787
+ setRangeData(minutes, startMinute, 60, true);
9788
+ } else if (startHour === hour && endHour === hour) {
9789
+ setRangeData(minutes, startMinute, endMinute + 1, true);
9790
+ } else if (startHour !== hour && endHour === hour) {
9791
+ setRangeData(minutes, 0, endMinute + 1, true);
9792
+ } else if (startHour < hour && endHour > hour) {
9793
+ setRangeData(minutes, 0, 60, true);
9794
+ }
9795
+ });
9796
+ } else {
9797
+ setRangeData(minutes, 0, 60, true);
9798
+ }
9799
+ return minutes;
9800
+ };
9801
+
9802
+ var range = function range(n) {
9803
+ // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
9804
+ return Array.apply(null, { length: n }).map(function (_, n) {
9805
+ return n;
9806
+ });
9807
+ };
9808
+
9809
+ var modifyDate = function modifyDate(date, y, m, d) {
9810
+ return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
9811
+ };
9812
+
9813
+ var modifyTime = function modifyTime(date, h, m, s) {
9814
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
9815
+ };
9816
+
9817
+ var modifyWithTimeString = function modifyWithTimeString(date, time) {
9818
+ if (date == null || !time) {
9819
+ return date;
9820
+ }
9821
+ time = parseDate(time, 'HH:mm:ss');
9822
+ return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
9823
+ };
9824
+
9825
+ var clearTime = function clearTime(date) {
9826
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
9827
+ };
9828
+
9829
+ var clearMilliseconds = function clearMilliseconds(date) {
9830
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
9831
+ };
9832
+
9833
+ var limitTimeRange = function limitTimeRange(date, ranges) {
9834
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
9835
+
9836
+ // TODO: refactory a more elegant solution
9837
+ if (ranges.length === 0) return date;
9838
+ var normalizeDate = function normalizeDate(date) {
9839
+ return fecha.parse(fecha.format(date, format), format);
9840
+ };
9841
+ var ndate = normalizeDate(date);
9842
+ var nranges = ranges.map(function (range) {
9843
+ return range.map(normalizeDate);
9844
+ });
9845
+ if (nranges.some(function (nrange) {
9846
+ return ndate >= nrange[0] && ndate <= nrange[1];
9847
+ })) return date;
9848
+
9849
+ var minDate = nranges[0][0];
9850
+ var maxDate = nranges[0][0];
9851
+
9852
+ nranges.forEach(function (nrange) {
9853
+ minDate = new Date(Math.min(nrange[0], minDate));
9854
+ maxDate = new Date(Math.max(nrange[1], minDate));
9855
+ });
9856
+
9857
+ var ret = ndate < minDate ? minDate : maxDate;
9858
+ // preserve Year/Month/Date
9859
+ return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
9860
+ };
9861
+
9862
+ var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
9863
+ var limitedDate = limitTimeRange(date, selectableRange, format);
9864
+ return limitedDate.getTime() === date.getTime();
9865
+ };
9866
+
9867
+ var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
9868
+ // clamp date to the number of days in `year`, `month`
9869
+ // eg: (2010-1-31, 2010, 2) => 2010-2-28
9870
+ var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
9871
+ return modifyDate(date, year, month, monthDate);
9872
+ };
9873
+
9874
+ var prevMonth = function prevMonth(date) {
9875
+ var year = date.getFullYear();
9876
+ var month = date.getMonth();
9877
+ return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
9878
+ };
9879
+
9880
+ var nextMonth = function nextMonth(date) {
9881
+ var year = date.getFullYear();
9882
+ var month = date.getMonth();
9883
+ return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
9884
+ };
9885
+
9886
+ var prevYear = function prevYear(date) {
9887
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9888
+
9889
+ var year = date.getFullYear();
9890
+ var month = date.getMonth();
9891
+ return changeYearMonthAndClampDate(date, year - amount, month);
9892
+ };
9893
+
9894
+ var nextYear = function nextYear(date) {
9895
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9896
+
9897
+ var year = date.getFullYear();
9898
+ var month = date.getMonth();
9899
+ return changeYearMonthAndClampDate(date, year + amount, month);
9900
+ };
9901
+
9902
+ var extractDateFormat = function extractDateFormat(format) {
9903
+ return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
9904
+ };
9905
+
9906
+ var extractTimeFormat = function extractTimeFormat(format) {
9907
+ return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
9908
+ };
9909
+
9910
+ var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
9911
+ return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
9912
+ };
9913
+
9914
+ /**
9915
+ * 计算两个日期之间的工作日数量(不包括周末和节假日)
9916
+ * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
9917
+ * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
9918
+ * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
9919
+ * @returns {number} 工作日数量
9920
+ */
9921
+ var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
9922
+ var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
9923
+
9924
+ if (typeof start_date !== 'string' || typeof end_date !== 'string') {
9925
+ throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
9926
+ }
9927
+
9928
+ var startDateObj = new Date(start_date);
9929
+ var endDateObj = new Date(end_date);
9930
+
9931
+ if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
9932
+ throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
9933
+ }
9934
+
9935
+ if (startDateObj > endDateObj) {
9936
+ throw new Error('Start date should be earlier than or equal to end date.');
9937
+ }
9938
+
9939
+ var workdays = 0;
9940
+
9941
+ // Iterate through each day in the date range
9942
+
9943
+ var _loop = function _loop(currentDate) {
9944
+ // Check if the current day is a weekend (Saturday or Sunday)
9945
+ var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
9946
+
9947
+ // Check if the current day is a holiday
9948
+ var isHoliday = holidays.some(function (holiday) {
9949
+ var holidayDate = new Date(holiday);
9950
+ return currentDate.toDateString() === holidayDate.toDateString();
9951
+ });
9952
+
9953
+ // If it's a workday (not a weekend or holiday), increment the workdays count
9954
+ if (!isWeekend && !isHoliday) {
9955
+ workdays++;
9956
+ }
9957
+ };
9958
+
9959
+ for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
9960
+ _loop(currentDate);
9961
+ }
9962
+
9963
+ return workdays;
9964
+ };
9965
+
9966
+ /**
9967
+ * 日期加减天数
9968
+ * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
9969
+ * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
9970
+ * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
9971
+ */
9972
+ var dateAddDays = function dateAddDays(start_date, days) {
9973
+ if (typeof start_date !== 'string' || !Number.isInteger(days)) {
9974
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days.");
9975
+ }
9976
+
9977
+ var startDateObj = new Date(start_date);
9978
+ if (isNaN(startDateObj.getTime())) {
9979
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
9980
+ }
9981
+
9982
+ var resultDateObj = new Date(startDateObj);
9983
+ resultDateObj.setDate(resultDateObj.getDate() + days);
9984
+
9985
+ var resultYear = resultDateObj.getFullYear();
9986
+ var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
9987
+ var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
9988
+
9989
+ return resultYear + '-' + resultMonth + '-' + resultDay;
9990
+ };
9991
+
9992
+ /**
10234
9993
  * 计算两个日期之间的差值
10235
9994
  * @date 2023年12月14日
10236
9995
  * @param {String} start_date - 起始日期字符串
10237
9996
  * @param {String} end_date - 结束日期字符串
10238
9997
  * @param {String} unit - 单位:year/month/day
10239
9998
  * @returns {Number} 差值
10240
- */
10241
- const dateDiff = function (start_date, end_date, unit = 'day') {
10242
- // Assuming date strings are in "YYYY-MM-DD" format
10243
- var startDate = new Date(start_date);
10244
- var endDate = new Date(end_date);
10245
-
10246
- // If the date is invalid, return 0
10247
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
10248
- return 0;
10249
- }
10250
-
10251
- if (unit === 'year') {
10252
- return endDate.getFullYear() - startDate.getFullYear();
10253
- } else if (unit === 'month') {
10254
- return (
10255
- (endDate.getFullYear() - startDate.getFullYear()) * 12 +
10256
- (endDate.getMonth() - startDate.getMonth())
10257
- );
10258
- } else {
10259
- // Default to day
10260
- var timeDifference = endDate - startDate;
10261
- // Calculate days (86400000 milliseconds per day)
10262
- return Math.floor(timeDifference / 86400000);
10263
- }
10264
- };
10265
-
9999
+ */
10000
+ var dateDiff = function dateDiff(start_date, end_date) {
10001
+ var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
10002
+
10003
+ // Assuming date strings are in "YYYY-MM-DD" format
10004
+ var startDate = new Date(start_date);
10005
+ var endDate = new Date(end_date);
10006
+
10007
+ // If the date is invalid, return 0
10008
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
10009
+ return 0;
10010
+ }
10011
+
10012
+ if (unit === 'year') {
10013
+ return endDate.getFullYear() - startDate.getFullYear();
10014
+ } else if (unit === 'month') {
10015
+ return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
10016
+ } else {
10017
+ // Default to day
10018
+ var timeDifference = endDate - startDate;
10019
+ // Calculate days (86400000 milliseconds per day)
10020
+ return Math.floor(timeDifference / 86400000);
10021
+ }
10022
+ };
10023
+
10266
10024
  /**
10267
10025
  * 获取月份中的日期
10268
10026
  * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
10269
10027
  * @returns {number} 月份中的日期(1-31)
10270
- */
10271
- const dayOfMonth = function (date) {
10272
- if (typeof date !== 'string') {
10273
- throw new Error(
10274
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'."
10275
- );
10276
- }
10277
-
10278
- const dateObj = new Date(date);
10279
- if (isNaN(dateObj.getTime())) {
10280
- throw new Error(
10281
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
10282
- );
10283
- }
10284
-
10285
- return dateObj.getDate();
10286
- };
10287
-
10028
+ */
10029
+ var dayOfMonth = function dayOfMonth(date) {
10030
+ if (typeof date !== 'string') {
10031
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
10032
+ }
10033
+
10034
+ var dateObj = new Date(date);
10035
+ if (isNaN(dateObj.getTime())) {
10036
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
10037
+ }
10038
+
10039
+ return dateObj.getDate();
10040
+ };
10041
+
10288
10042
  /**
10289
10043
  * 获取当前日期
10290
10044
  * @date 2022年5月7日
10291
10045
  * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
10292
10046
  * @returns {string} 当前日期的格式化字符串
10293
- */
10294
- const getCurrentDate = function (format = 'YYYY-MM-DD') {
10295
- return formatDate(new Date(), format);
10296
- };
10297
-
10047
+ */
10048
+ var getCurrentDate = function getCurrentDate() {
10049
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
10050
+
10051
+ return formatDate(new Date(), format);
10052
+ };
10053
+
10298
10054
  /**
10299
10055
  * 获取当前日期时间
10300
10056
  * @date 2022年5月7日
10301
10057
  * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
10302
10058
  * @returns {string} 当前日期时间的格式化字符串
10303
- */
10304
- const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
10305
- return formatDate(new Date(), format);
10306
- };
10307
-
10059
+ */
10060
+ var getCurrentDateTime = function getCurrentDateTime() {
10061
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
10062
+
10063
+ return formatDate(new Date(), format);
10064
+ };
10065
+
10308
10066
  /**
10309
10067
  * 获取小时
10310
10068
  * @date 2022年5月7日
10311
10069
  * @param {Date|string} [date] - 日期对象或日期字符串
10312
10070
  * @returns {number} 小时数(0-23)
10313
- */
10314
- const getHour = function (date) {
10315
- if (!date) {
10316
- return new Date().getHours();
10317
- }
10318
- if (typeof date === 'string') {
10319
- date = new Date(date);
10320
- }
10321
- return date.getHours();
10322
- };
10323
-
10071
+ */
10072
+ var getHour = function getHour(date) {
10073
+ if (!date) {
10074
+ return new Date().getHours();
10075
+ }
10076
+ if (typeof date === 'string') {
10077
+ date = new Date(date);
10078
+ }
10079
+ return date.getHours();
10080
+ };
10081
+
10324
10082
  /**
10325
10083
  * 获取分钟
10326
10084
  * @date 2022年5月7日
10327
10085
  * @param {Date|string} [date] - 日期对象或日期字符串
10328
10086
  * @returns {number} 分钟数(0-59)
10329
- */
10330
- const getMinute = function (date) {
10331
- if (!date) {
10332
- return new Date().getMinutes();
10333
- }
10334
- if (typeof date === 'string') {
10335
- date = new Date(date);
10336
- }
10337
- return date.getMinutes();
10338
- };
10339
-
10087
+ */
10088
+ var getMinute = function getMinute(date) {
10089
+ if (!date) {
10090
+ return new Date().getMinutes();
10091
+ }
10092
+ if (typeof date === 'string') {
10093
+ date = new Date(date);
10094
+ }
10095
+ return date.getMinutes();
10096
+ };
10097
+
10340
10098
  /**
10341
10099
  * 获取月份
10342
10100
  * @date 2022年5月7日
10343
10101
  * @param {Date|string} [date] - 日期对象或日期字符串
10344
10102
  * @returns {number} 月份数(1-12)
10345
- */
10346
- const getMonth = function (date) {
10347
- if (!date) {
10348
- return new Date().getMonth() + 1;
10349
- }
10350
- if (typeof date === 'string') {
10351
- date = new Date(date);
10352
- }
10353
- return date.getMonth() + 1;
10354
- };
10355
-
10103
+ */
10104
+ var getMonth = function getMonth(date) {
10105
+ if (!date) {
10106
+ return new Date().getMonth() + 1;
10107
+ }
10108
+ if (typeof date === 'string') {
10109
+ date = new Date(date);
10110
+ }
10111
+ return date.getMonth() + 1;
10112
+ };
10113
+
10356
10114
  /**
10357
10115
  * 获取秒
10358
10116
  * @date 2022年5月7日
10359
10117
  * @param {Date|string} [date] - 日期对象或日期字符串
10360
10118
  * @returns {number} 秒数(0-59)
10361
- */
10362
- const getSecond = function (date) {
10363
- if (!date) {
10364
- return new Date().getSeconds();
10365
- }
10366
- if (typeof date === 'string') {
10367
- date = new Date(date);
10368
- }
10369
- return date.getSeconds();
10370
- };
10371
-
10119
+ */
10120
+ var getSecond = function getSecond(date) {
10121
+ if (!date) {
10122
+ return new Date().getSeconds();
10123
+ }
10124
+ if (typeof date === 'string') {
10125
+ date = new Date(date);
10126
+ }
10127
+ return date.getSeconds();
10128
+ };
10129
+
10372
10130
  /**
10373
10131
  * 获取星期几
10374
10132
  * @date 2022年5月7日
10375
10133
  * @param {Date|string} [date] - 日期对象或日期字符串
10376
10134
  * @returns {number} 星期几(0-6,0表示星期日)
10377
- */
10378
- const getWeekday = function (date) {
10379
- if (!date) {
10380
- return new Date().getDay();
10381
- }
10382
- if (typeof date === 'string') {
10383
- date = new Date(date);
10384
- }
10385
- return date.getDay();
10386
- };
10387
-
10388
-
10135
+ */
10136
+ var getWeekday = function getWeekday(date) {
10137
+ if (!date) {
10138
+ return new Date().getDay();
10139
+ }
10140
+ if (typeof date === 'string') {
10141
+ date = new Date(date);
10142
+ }
10143
+ return date.getDay();
10144
+ };
10145
+
10389
10146
  /**
10390
10147
  * @desc 获取上午/下午/晚上
10391
10148
  * @author huangbo
10392
10149
  * @date 2022年5月7日
10393
10150
  * @param {String} [time] - 时间
10394
- **/
10395
- const timeCycle = function (time) {
10396
- let hour = 0;
10397
- if (!time) {
10398
- hour = new Date().getHours();
10399
- } else if (typeof time === 'string') {
10400
- // 从时间字符串中提取小时
10401
- const match = time.match(/^(\d{1,2})/);
10402
- if (match) {
10403
- hour = parseInt(match[1], 10);
10404
- }
10405
- } else if (typeof time === 'number') {
10406
- hour = time;
10407
- }
10408
- // 判断时间段
10409
- if (hour >= 5 && hour < 12) {
10410
- return '上午';
10411
- } else if (hour >= 12 && hour < 18) {
10412
- return '下午';
10413
- } else {
10414
- return '晚上';
10415
- }
10151
+ **/
10152
+ var timeCycle = function timeCycle(time) {
10153
+ var hour = 0;
10154
+ if (!time) {
10155
+ hour = new Date().getHours();
10156
+ } else if (typeof time === 'string') {
10157
+ // 从时间字符串中提取小时
10158
+ var match = time.match(/^(\d{1,2})/);
10159
+ if (match) {
10160
+ hour = parseInt(match[1], 10);
10161
+ }
10162
+ } else if (typeof time === 'number') {
10163
+ hour = time;
10164
+ }
10165
+ // 判断时间段
10166
+ if (hour >= 5 && hour < 12) {
10167
+ return '上午';
10168
+ } else if (hour >= 12 && hour < 18) {
10169
+ return '下午';
10170
+ } else {
10171
+ return '晚上';
10172
+ }
10416
10173
  };
10417
10174
 
10418
10175
  /***/ }),
10419
10176
 
10177
+ /***/ 70:
10178
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
10179
+
10180
+ "use strict";
10181
+ /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
10182
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10183
+
10184
+
10185
+
10186
+ var Transition = function () {
10187
+ function Transition() {
10188
+ _classCallCheck(this, Transition);
10189
+ }
10190
+
10191
+ Transition.prototype.beforeEnter = function beforeEnter(el) {
10192
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
10193
+ if (!el.dataset) el.dataset = {};
10194
+ if (el.dataset.state === 6 || !el.dataset.state) {
10195
+ el.dataset.oldPaddingTop = el.style.paddingTop;
10196
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
10197
+ }
10198
+ el.dataset.state = 1;
10199
+
10200
+ el.style.height = '0';
10201
+ el.style.paddingTop = 0;
10202
+ el.style.paddingBottom = 0;
10203
+ };
10204
+
10205
+ Transition.prototype.enter = function enter(el) {
10206
+ el.dataset.oldOverflow = el.style.overflow;
10207
+ if (el.scrollHeight !== 0) {
10208
+ el.style.height = el.scrollHeight + 'px';
10209
+ el.style.paddingTop = el.dataset.oldPaddingTop;
10210
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
10211
+ } else {
10212
+ el.style.height = '';
10213
+ el.style.paddingTop = el.dataset.oldPaddingTop;
10214
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
10215
+ }
10216
+
10217
+ el.dataset.state = 2;
10218
+ el.style.overflow = 'hidden';
10219
+ };
10220
+
10221
+ Transition.prototype.afterEnter = function afterEnter(el) {
10222
+ // for safari: remove class then reset height is necessary
10223
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
10224
+ el.style.height = '';
10225
+ el.style.overflow = el.dataset.oldOverflow;
10226
+ el.dataset.state = 3;
10227
+ };
10228
+
10229
+ Transition.prototype.beforeLeave = function beforeLeave(el) {
10230
+ if (!el.dataset) el.dataset = {};
10231
+ el.dataset.oldPaddingTop = el.style.paddingTop;
10232
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
10233
+ el.dataset.oldOverflow = el.style.overflow;
10234
+ el.dataset.state = 4;
10235
+
10236
+ el.style.height = el.scrollHeight + 'px';
10237
+ el.style.overflow = 'hidden';
10238
+ };
10239
+
10240
+ Transition.prototype.leave = function leave(el) {
10241
+ if (el.scrollHeight !== 0) {
10242
+ // for safari: add class after set height, or it will jump to zero height suddenly, weired
10243
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
10244
+ el.style.height = 0;
10245
+ el.style.paddingTop = 0;
10246
+ el.style.paddingBottom = 0;
10247
+ el.dataset.state = 5;
10248
+ }
10249
+ };
10250
+
10251
+ Transition.prototype.afterLeave = function afterLeave(el) {
10252
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
10253
+ el.style.height = '';
10254
+ el.style.overflow = el.dataset.oldOverflow;
10255
+ el.style.paddingTop = el.dataset.oldPaddingTop;
10256
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
10257
+ el.dataset.state = 6;
10258
+ };
10259
+
10260
+ return Transition;
10261
+ }();
10262
+
10263
+ /* harmony default export */ __webpack_exports__["a"] = ({
10264
+ name: 'EsCollapseTransition',
10265
+ functional: true,
10266
+ render: function render(h, _ref) {
10267
+ var children = _ref.children;
10268
+
10269
+ var data = {
10270
+ on: new Transition()
10271
+ };
10272
+
10273
+ return h('transition', data, children);
10274
+ }
10275
+ });
10276
+
10277
+ /***/ }),
10278
+
10420
10279
  /***/ 8:
10421
10280
  /***/ (function(module, exports) {
10422
10281
 
@@ -10424,7 +10283,7 @@ module.exports = require("eoss/lib/message-box");
10424
10283
 
10425
10284
  /***/ }),
10426
10285
 
10427
- /***/ 80:
10286
+ /***/ 81:
10428
10287
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
10429
10288
 
10430
10289
  "use strict";
@@ -10508,7 +10367,7 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
10508
10367
  if (!this._colorCache) {
10509
10368
  this._colorCache = {};
10510
10369
  }
10511
- var isParentMenuIcon = item.children && item.children.length || this.isFourthTabs && item.fourthTabs && item.fourthTabs.length;
10370
+ // 缓存键为颜色槽位;缓存值仅依赖 iconColors 与槽位(iconColors 变化由 watcher 清缓存)
10512
10371
  var key = Array.isArray(this.iconColors) ? 'index_' + index % this.iconColors.length : 'single_color';
10513
10372
 
10514
10373
  if (!this._colorCache[key]) {
@@ -10516,7 +10375,7 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
10516
10375
  this._colorCache[key] = {
10517
10376
  '--icon-bg-color': bgColor,
10518
10377
  '--icon-color': '#fff',
10519
- '--icon-font-size': isParentMenuIcon ? '16px' : '12px'
10378
+ '--icon-font-size': '12px'
10520
10379
  };
10521
10380
  }
10522
10381
 
@@ -10587,12 +10446,12 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
10587
10446
 
10588
10447
  /***/ }),
10589
10448
 
10590
- /***/ 82:
10449
+ /***/ 84:
10591
10450
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
10592
10451
 
10593
10452
  "use strict";
10594
10453
 
10595
- // 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&
10454
+ // 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&
10596
10455
  var render = function () {
10597
10456
  var _vm = this
10598
10457
  var _h = _vm.$createElement
@@ -10628,7 +10487,7 @@ var render = function () {
10628
10487
  "open-icon": _vm.openIcon,
10629
10488
  "close-icon": _vm.closeIcon,
10630
10489
  isFourthTabs: _vm.isFourthTabs,
10631
- iconColor: _vm.getColor(index),
10490
+ iconColor: _vm.getColor(index, item),
10632
10491
  iconColors: _vm.iconColors,
10633
10492
  },
10634
10493
  },
@@ -10648,13 +10507,13 @@ var staticRenderFns = []
10648
10507
  render._withStripped = true
10649
10508
 
10650
10509
 
10651
- // CONCATENATED MODULE: ./packages/menu/src/menu-item-group.vue?vue&type=template&id=6d5d18cf&
10510
+ // CONCATENATED MODULE: ./packages/menu/src/menu-item-group.vue?vue&type=template&id=ec02cbb0&
10652
10511
 
10653
10512
  // EXTERNAL MODULE: ./packages/menu/src/mixins.js
10654
- var mixins = __webpack_require__(80);
10513
+ var mixins = __webpack_require__(81);
10655
10514
 
10656
10515
  // EXTERNAL MODULE: ./packages/menu/src/menu-item.vue + 4 modules
10657
- var menu_item = __webpack_require__(60);
10516
+ var menu_item = __webpack_require__(61);
10658
10517
 
10659
10518
  // 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&
10660
10519
  //