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/select.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 = 193);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 200);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -4467,7 +4467,227 @@ var getTableData = function getTableData(_ref9) {
4467
4467
 
4468
4468
  /***/ }),
4469
4469
 
4470
- /***/ 109:
4470
+ /***/ 11:
4471
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4472
+
4473
+ "use strict";
4474
+ /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
4475
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
4476
+ /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
4477
+
4478
+
4479
+
4480
+ var hasModal = false;
4481
+ var hasInitZIndex = false;
4482
+ // 跨模块副本共享的 z-index 计数器宿主。
4483
+ // 低代码等场景会用 eoss / eoss/src / eoss/packages 多种身份加载本文件,
4484
+ // 导致出现多份 PopupManager、各自从 2000 起算,出现“后弹出的层级反而比先弹出的小”。
4485
+ // 把计数器挂到全局,所有副本共用同一条单调递增序列。
4486
+ var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
4487
+
4488
+ var getModal = function getModal() {
4489
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
4490
+ var modalDom = PopupManager.modalDom;
4491
+ if (modalDom) {
4492
+ hasModal = true;
4493
+ } else {
4494
+ hasModal = false;
4495
+ modalDom = document.createElement('div');
4496
+ PopupManager.modalDom = modalDom;
4497
+
4498
+ modalDom.addEventListener('touchmove', function (event) {
4499
+ event.preventDefault();
4500
+ event.stopPropagation();
4501
+ });
4502
+
4503
+ modalDom.addEventListener('click', function () {
4504
+ PopupManager.doOnModalClick && PopupManager.doOnModalClick();
4505
+ });
4506
+ }
4507
+
4508
+ return modalDom;
4509
+ };
4510
+
4511
+ var instances = {};
4512
+
4513
+ var PopupManager = {
4514
+ modalFade: true,
4515
+
4516
+ getInstance: function getInstance(id) {
4517
+ return instances[id];
4518
+ },
4519
+
4520
+ register: function register(id, instance) {
4521
+ if (id && instance) {
4522
+ instances[id] = instance;
4523
+ }
4524
+ },
4525
+
4526
+ deregister: function deregister(id) {
4527
+ if (id) {
4528
+ instances[id] = null;
4529
+ delete instances[id];
4530
+ }
4531
+ },
4532
+
4533
+ nextZIndex: function nextZIndex() {
4534
+ return PopupManager.zIndex++;
4535
+ },
4536
+
4537
+ modalStack: [],
4538
+
4539
+ doOnModalClick: function doOnModalClick() {
4540
+ var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
4541
+ if (!topItem) return;
4542
+
4543
+ var instance = PopupManager.getInstance(topItem.id);
4544
+ if (instance && instance.closeOnClickModal) {
4545
+ instance.close();
4546
+ }
4547
+ },
4548
+
4549
+ openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
4550
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
4551
+ if (!id || zIndex === undefined) return;
4552
+ this.modalFade = modalFade;
4553
+
4554
+ var modalStack = this.modalStack;
4555
+
4556
+ for (var i = 0, j = modalStack.length; i < j; i++) {
4557
+ var item = modalStack[i];
4558
+ if (item.id === id) {
4559
+ return;
4560
+ }
4561
+ }
4562
+
4563
+ var modalDom = getModal();
4564
+
4565
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal');
4566
+ if (this.modalFade && !hasModal) {
4567
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter');
4568
+ }
4569
+ if (modalClass) {
4570
+ var classArr = modalClass.trim().split(/\s+/);
4571
+ classArr.forEach(function (item) {
4572
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item);
4573
+ });
4574
+ }
4575
+ setTimeout(function () {
4576
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-enter');
4577
+ }, 200);
4578
+
4579
+ if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
4580
+ dom.parentNode.appendChild(modalDom);
4581
+ } else {
4582
+ document.body.appendChild(modalDom);
4583
+ }
4584
+
4585
+ if (zIndex) {
4586
+ modalDom.style.zIndex = zIndex;
4587
+ }
4588
+ modalDom.tabIndex = 0;
4589
+ modalDom.style.display = '';
4590
+
4591
+ this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
4592
+ },
4593
+
4594
+ closeModal: function closeModal(id) {
4595
+ var modalStack = this.modalStack;
4596
+ var modalDom = getModal();
4597
+ var topItem = null;
4598
+
4599
+ if (modalStack.length > 0) {
4600
+ topItem = modalStack[modalStack.length - 1];
4601
+ if (topItem.id === id) {
4602
+ modalStack.pop();
4603
+ if (modalStack.length > 0) {
4604
+ modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
4605
+ }
4606
+ } else {
4607
+ for (var i = modalStack.length - 1; i >= 0; i--) {
4608
+ if (modalStack[i].id === id) {
4609
+ modalStack.splice(i, 1);
4610
+ break;
4611
+ }
4612
+ }
4613
+ }
4614
+ }
4615
+
4616
+ if (modalStack.length === 0) {
4617
+ if (this.modalFade) {
4618
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave');
4619
+ }
4620
+ setTimeout(function () {
4621
+ if (modalStack.length === 0) {
4622
+ if (topItem && topItem.modalClass) {
4623
+ var classArr = topItem.modalClass.trim().split(/\s+/);
4624
+ classArr.forEach(function (item) {
4625
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
4626
+ });
4627
+ }
4628
+ if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
4629
+ modalDom.style.display = 'none';
4630
+ PopupManager.modalDom = undefined;
4631
+ }
4632
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-leave');
4633
+ }, 200);
4634
+ } else {
4635
+ if (topItem && topItem.modalClass) {
4636
+ var classArr = topItem.modalClass.trim().split(/\s+/);
4637
+ classArr.forEach(function (item) {
4638
+ return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
4639
+ });
4640
+ }
4641
+ }
4642
+ }
4643
+ };
4644
+
4645
+ Object.defineProperty(PopupManager, 'zIndex', {
4646
+ configurable: true,
4647
+ get: function get() {
4648
+ if (!hasInitZIndex) {
4649
+ if (globalScope.__EOSS_ZINDEX__ === undefined) {
4650
+ globalScope.__EOSS_ZINDEX__ = (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$EOSS || {}).zIndex || 2000;
4651
+ }
4652
+ hasInitZIndex = true;
4653
+ }
4654
+ return globalScope.__EOSS_ZINDEX__;
4655
+ },
4656
+ set: function set(value) {
4657
+ globalScope.__EOSS_ZINDEX__ = value;
4658
+ }
4659
+ });
4660
+
4661
+ var getTopPopup = function getTopPopup() {
4662
+ if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
4663
+ if (PopupManager.modalStack.length > 0) {
4664
+ var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
4665
+ if (!topPopup) return;
4666
+ var instance = PopupManager.getInstance(topPopup.id);
4667
+
4668
+ return instance;
4669
+ }
4670
+ };
4671
+
4672
+ if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
4673
+ // handle `esc` key when the popup is shown
4674
+ window.addEventListener('keydown', function (event) {
4675
+ if (event.keyCode === 27) {
4676
+ var topPopup = getTopPopup();
4677
+
4678
+ if (topPopup && topPopup.closeOnPressEscape) {
4679
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
4680
+ }
4681
+ }
4682
+ });
4683
+ }
4684
+
4685
+ /* harmony default export */ __webpack_exports__["a"] = (PopupManager);
4686
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(45)))
4687
+
4688
+ /***/ }),
4689
+
4690
+ /***/ 111:
4471
4691
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4472
4692
 
4473
4693
  "use strict";
@@ -4804,261 +5024,41 @@ var component = Object(componentNormalizer["a" /* default */])(
4804
5024
 
4805
5025
  /***/ }),
4806
5026
 
4807
- /***/ 11:
5027
+ /***/ 112:
4808
5028
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4809
5029
 
4810
5030
  "use strict";
4811
- /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
4812
- /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
4813
- /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
4814
5031
 
4815
-
4816
-
4817
- var hasModal = false;
4818
- var hasInitZIndex = false;
4819
- // 跨模块副本共享的 z-index 计数器宿主。
4820
- // 低代码等场景会用 eoss / eoss/src / eoss/packages 多种身份加载本文件,
4821
- // 导致出现多份 PopupManager、各自从 2000 起算,出现“后弹出的层级反而比先弹出的小”。
4822
- // 把计数器挂到全局,所有副本共用同一条单调递增序列。
4823
- var globalScope = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
4824
-
4825
- var getModal = function getModal() {
4826
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
4827
- var modalDom = PopupManager.modalDom;
4828
- if (modalDom) {
4829
- hasModal = true;
4830
- } else {
4831
- hasModal = false;
4832
- modalDom = document.createElement('div');
4833
- PopupManager.modalDom = modalDom;
4834
-
4835
- modalDom.addEventListener('touchmove', function (event) {
4836
- event.preventDefault();
4837
- event.stopPropagation();
4838
- });
4839
-
4840
- modalDom.addEventListener('click', function () {
4841
- PopupManager.doOnModalClick && PopupManager.doOnModalClick();
4842
- });
4843
- }
4844
-
4845
- return modalDom;
4846
- };
4847
-
4848
- var instances = {};
4849
-
4850
- var PopupManager = {
4851
- modalFade: true,
4852
-
4853
- getInstance: function getInstance(id) {
4854
- return instances[id];
4855
- },
4856
-
4857
- register: function register(id, instance) {
4858
- if (id && instance) {
4859
- instances[id] = instance;
4860
- }
4861
- },
4862
-
4863
- deregister: function deregister(id) {
4864
- if (id) {
4865
- instances[id] = null;
4866
- delete instances[id];
4867
- }
4868
- },
4869
-
4870
- nextZIndex: function nextZIndex() {
4871
- return PopupManager.zIndex++;
4872
- },
4873
-
4874
- modalStack: [],
4875
-
4876
- doOnModalClick: function doOnModalClick() {
4877
- var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
4878
- if (!topItem) return;
4879
-
4880
- var instance = PopupManager.getInstance(topItem.id);
4881
- if (instance && instance.closeOnClickModal) {
4882
- instance.close();
4883
- }
4884
- },
4885
-
4886
- openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
4887
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
4888
- if (!id || zIndex === undefined) return;
4889
- this.modalFade = modalFade;
4890
-
4891
- var modalStack = this.modalStack;
4892
-
4893
- for (var i = 0, j = modalStack.length; i < j; i++) {
4894
- var item = modalStack[i];
4895
- if (item.id === id) {
4896
- return;
4897
- }
4898
- }
4899
-
4900
- var modalDom = getModal();
4901
-
4902
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal');
4903
- if (this.modalFade && !hasModal) {
4904
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-enter');
4905
- }
4906
- if (modalClass) {
4907
- var classArr = modalClass.trim().split(/\s+/);
4908
- classArr.forEach(function (item) {
4909
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, item);
4910
- });
4911
- }
4912
- setTimeout(function () {
4913
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-enter');
4914
- }, 200);
4915
-
4916
- if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
4917
- dom.parentNode.appendChild(modalDom);
4918
- } else {
4919
- document.body.appendChild(modalDom);
4920
- }
4921
-
4922
- if (zIndex) {
4923
- modalDom.style.zIndex = zIndex;
4924
- }
4925
- modalDom.tabIndex = 0;
4926
- modalDom.style.display = '';
4927
-
4928
- this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
4929
- },
4930
-
4931
- closeModal: function closeModal(id) {
4932
- var modalStack = this.modalStack;
4933
- var modalDom = getModal();
4934
- var topItem = null;
4935
-
4936
- if (modalStack.length > 0) {
4937
- topItem = modalStack[modalStack.length - 1];
4938
- if (topItem.id === id) {
4939
- modalStack.pop();
4940
- if (modalStack.length > 0) {
4941
- modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
4942
- }
4943
- } else {
4944
- for (var i = modalStack.length - 1; i >= 0; i--) {
4945
- if (modalStack[i].id === id) {
4946
- modalStack.splice(i, 1);
4947
- break;
4948
- }
4949
- }
4950
- }
4951
- }
4952
-
4953
- if (modalStack.length === 0) {
4954
- if (this.modalFade) {
4955
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(modalDom, 'v-modal-leave');
4956
- }
4957
- setTimeout(function () {
4958
- if (modalStack.length === 0) {
4959
- if (topItem && topItem.modalClass) {
4960
- var classArr = topItem.modalClass.trim().split(/\s+/);
4961
- classArr.forEach(function (item) {
4962
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
4963
- });
4964
- }
4965
- if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
4966
- modalDom.style.display = 'none';
4967
- PopupManager.modalDom = undefined;
4968
- }
4969
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, 'v-modal-leave');
4970
- }, 200);
4971
- } else {
4972
- if (topItem && topItem.modalClass) {
4973
- var classArr = topItem.modalClass.trim().split(/\s+/);
4974
- classArr.forEach(function (item) {
4975
- return Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "i"])(modalDom, item);
4976
- });
4977
- }
4978
- }
4979
- }
4980
- };
4981
-
4982
- Object.defineProperty(PopupManager, 'zIndex', {
4983
- configurable: true,
4984
- get: function get() {
4985
- if (!hasInitZIndex) {
4986
- if (globalScope.__EOSS_ZINDEX__ === undefined) {
4987
- globalScope.__EOSS_ZINDEX__ = (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$EOSS || {}).zIndex || 2000;
4988
- }
4989
- hasInitZIndex = true;
4990
- }
4991
- return globalScope.__EOSS_ZINDEX__;
4992
- },
4993
- set: function set(value) {
4994
- globalScope.__EOSS_ZINDEX__ = value;
4995
- }
4996
- });
4997
-
4998
- var getTopPopup = function getTopPopup() {
4999
- if (vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) return;
5000
- if (PopupManager.modalStack.length > 0) {
5001
- var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
5002
- if (!topPopup) return;
5003
- var instance = PopupManager.getInstance(topPopup.id);
5004
-
5005
- return instance;
5006
- }
5007
- };
5008
-
5009
- if (!vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer) {
5010
- // handle `esc` key when the popup is shown
5011
- window.addEventListener('keydown', function (event) {
5012
- if (event.keyCode === 27) {
5013
- var topPopup = getTopPopup();
5014
-
5015
- if (topPopup && topPopup.closeOnPressEscape) {
5016
- topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
5017
- }
5018
- }
5019
- });
5020
- }
5021
-
5022
- /* harmony default export */ __webpack_exports__["a"] = (PopupManager);
5023
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(45)))
5024
-
5025
- /***/ }),
5026
-
5027
- /***/ 110:
5028
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
5029
-
5030
- "use strict";
5031
-
5032
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/option-group.vue?vue&type=template&id=0b165b85&
5033
- var render = function () {
5034
- var _vm = this
5035
- var _h = _vm.$createElement
5036
- var _c = _vm._self._c || _h
5037
- return _c(
5038
- "ul",
5039
- {
5040
- directives: [
5041
- {
5042
- name: "show",
5043
- rawName: "v-show",
5044
- value: _vm.visible,
5045
- expression: "visible",
5046
- },
5047
- ],
5048
- staticClass: "es-select-group__wrap",
5049
- },
5050
- [
5051
- _c("li", { staticClass: "es-select-group__title" }, [
5052
- _vm._v(_vm._s(_vm.label)),
5053
- ]),
5054
- _c("li", [
5055
- _c("ul", { staticClass: "es-select-group" }, [_vm._t("default")], 2),
5056
- ]),
5057
- ]
5058
- )
5059
- }
5060
- var staticRenderFns = []
5061
- render._withStripped = true
5032
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/option-group.vue?vue&type=template&id=0b165b85&
5033
+ var render = function () {
5034
+ var _vm = this
5035
+ var _h = _vm.$createElement
5036
+ var _c = _vm._self._c || _h
5037
+ return _c(
5038
+ "ul",
5039
+ {
5040
+ directives: [
5041
+ {
5042
+ name: "show",
5043
+ rawName: "v-show",
5044
+ value: _vm.visible,
5045
+ expression: "visible",
5046
+ },
5047
+ ],
5048
+ staticClass: "es-select-group__wrap",
5049
+ },
5050
+ [
5051
+ _c("li", { staticClass: "es-select-group__title" }, [
5052
+ _vm._v(_vm._s(_vm.label)),
5053
+ ]),
5054
+ _c("li", [
5055
+ _c("ul", { staticClass: "es-select-group" }, [_vm._t("default")], 2),
5056
+ ]),
5057
+ ]
5058
+ )
5059
+ }
5060
+ var staticRenderFns = []
5061
+ render._withStripped = true
5062
5062
 
5063
5063
 
5064
5064
  // CONCATENATED MODULE: ./packages/select/src/option-group.vue?vue&type=template&id=0b165b85&
@@ -5437,14 +5437,80 @@ module.exports = require("lodash/cloneDeep");
5437
5437
 
5438
5438
  /***/ }),
5439
5439
 
5440
- /***/ 193:
5440
+ /***/ 2:
5441
+ /***/ (function(module, exports) {
5442
+
5443
+ module.exports = require("vue");
5444
+
5445
+ /***/ }),
5446
+
5447
+ /***/ 20:
5441
5448
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5442
5449
 
5443
5450
  "use strict";
5444
- // ESM COMPAT FLAG
5445
- __webpack_require__.r(__webpack_exports__);
5446
-
5447
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=ccd3dace&
5451
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return doEncrypt; });
5452
+ /* unused harmony export doDecrypt */
5453
+ /* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
5454
+ var sm2 = __webpack_require__(42).sm2;
5455
+
5456
+
5457
+ /**
5458
+ * doEncrypt
5459
+ * @desc:sm2加密
5460
+ * @author huangbo
5461
+ * @date 2022年5月7日
5462
+ * @param {string} [data] - 被加密的字符串
5463
+ * @param {string} [key] - 公钥
5464
+ **/
5465
+ var doEncrypt = function doEncrypt(_ref) {
5466
+ var data = _ref.data,
5467
+ key = _ref.key,
5468
+ mode = _ref.mode;
5469
+
5470
+ if (!key) {
5471
+ key = Object(_storage__WEBPACK_IMPORTED_MODULE_0__[/* getStorage */ "a"])('secretKey');
5472
+ }
5473
+ if (!mode) {
5474
+ mode = 1;
5475
+ }
5476
+ if (!new RegExp('^04').test(key)) {
5477
+ key = '04' + key;
5478
+ }
5479
+ var result = sm2.doEncrypt(data, key, mode);
5480
+ return result;
5481
+ };
5482
+
5483
+ /**
5484
+ * doDecrypt
5485
+ * @desc:sm2解密
5486
+ * @author huangbo
5487
+ * @date 2022年5月7日
5488
+ * @param {string} [data] - 被解密的加密字符串
5489
+ * @param {string} [key] - 私钥
5490
+ **/
5491
+ var doDecrypt = function doDecrypt(_ref2) {
5492
+ var data = _ref2.data,
5493
+ key = _ref2.key,
5494
+ mode = _ref2.mode;
5495
+
5496
+ var cipherMode = mode ? mode : 1;
5497
+ if (new RegExp('^04').test(key)) {
5498
+ key = key.slice(2);
5499
+ }
5500
+ var result = sm2.doDecrypt(data, key, cipherMode);
5501
+ return result;
5502
+ };
5503
+
5504
+ /***/ }),
5505
+
5506
+ /***/ 200:
5507
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
5508
+
5509
+ "use strict";
5510
+ // ESM COMPAT FLAG
5511
+ __webpack_require__.r(__webpack_exports__);
5512
+
5513
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=ccd3dace&
5448
5514
  var render = function () {
5449
5515
  var _vm = this
5450
5516
  var _h = _vm.$createElement
@@ -6089,7 +6155,7 @@ render._withStripped = true
6089
6155
  var emitter = __webpack_require__(15);
6090
6156
 
6091
6157
  // EXTERNAL MODULE: ./src/mixins/focus.js
6092
- var mixins_focus = __webpack_require__(84);
6158
+ var mixins_focus = __webpack_require__(86);
6093
6159
 
6094
6160
  // EXTERNAL MODULE: external "eoss/lib/input"
6095
6161
  var input_ = __webpack_require__(14);
@@ -6230,7 +6296,7 @@ var component = Object(componentNormalizer["a" /* default */])(
6230
6296
 
6231
6297
  /* harmony default export */ var select_dropdown = (component.exports);
6232
6298
  // EXTERNAL MODULE: ./packages/select/src/option.vue + 4 modules
6233
- var src_option = __webpack_require__(109);
6299
+ var src_option = __webpack_require__(111);
6234
6300
 
6235
6301
  // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/option-tree.vue?vue&type=template&id=9f3104b4&
6236
6302
  var option_treevue_type_template_id_9f3104b4_render = function () {
@@ -6282,7 +6348,7 @@ option_treevue_type_template_id_9f3104b4_render._withStripped = true
6282
6348
  // CONCATENATED MODULE: ./packages/select/src/option-tree.vue?vue&type=template&id=9f3104b4&
6283
6349
 
6284
6350
  // EXTERNAL MODULE: external "eoss/lib/tree"
6285
- var tree_ = __webpack_require__(50);
6351
+ var tree_ = __webpack_require__(51);
6286
6352
  var tree_default = /*#__PURE__*/__webpack_require__.n(tree_);
6287
6353
 
6288
6354
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/option-tree.vue?vue&type=script&lang=js&
@@ -6541,7 +6607,7 @@ var option_tree_component = Object(componentNormalizer["a" /* default */])(
6541
6607
 
6542
6608
  /* harmony default export */ var option_tree = (option_tree_component.exports);
6543
6609
  // EXTERNAL MODULE: external "eoss/lib/tag"
6544
- var tag_ = __webpack_require__(68);
6610
+ var tag_ = __webpack_require__(69);
6545
6611
  var tag_default = /*#__PURE__*/__webpack_require__.n(tag_);
6546
6612
 
6547
6613
  // EXTERNAL MODULE: external "eoss/lib/scrollbar"
@@ -6628,7 +6694,7 @@ var util = __webpack_require__(1);
6628
6694
  }
6629
6695
  });
6630
6696
  // EXTERNAL MODULE: ./src/utils/shared.js
6631
- var shared = __webpack_require__(81);
6697
+ var shared = __webpack_require__(82);
6632
6698
 
6633
6699
  // EXTERNAL MODULE: ./src/utils/ajax.js
6634
6700
  var ajax = __webpack_require__(10);
@@ -6638,7 +6704,7 @@ var button_ = __webpack_require__(13);
6638
6704
  var button_default = /*#__PURE__*/__webpack_require__.n(button_);
6639
6705
 
6640
6706
  // EXTERNAL MODULE: ./packages/select/src/option-group.vue + 4 modules
6641
- var option_group = __webpack_require__(110);
6707
+ var option_group = __webpack_require__(112);
6642
6708
 
6643
6709
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=script&lang=js&
6644
6710
  var selectvue_type_script_lang_js_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; };
@@ -8302,72 +8368,6 @@ src_select.install = function (Vue) {
8302
8368
 
8303
8369
  /***/ }),
8304
8370
 
8305
- /***/ 2:
8306
- /***/ (function(module, exports) {
8307
-
8308
- module.exports = require("vue");
8309
-
8310
- /***/ }),
8311
-
8312
- /***/ 20:
8313
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
8314
-
8315
- "use strict";
8316
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return doEncrypt; });
8317
- /* unused harmony export doDecrypt */
8318
- /* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
8319
- var sm2 = __webpack_require__(42).sm2;
8320
-
8321
-
8322
- /**
8323
- * doEncrypt
8324
- * @desc:sm2加密
8325
- * @author huangbo
8326
- * @date 2022年5月7日
8327
- * @param {string} [data] - 被加密的字符串
8328
- * @param {string} [key] - 公钥
8329
- **/
8330
- var doEncrypt = function doEncrypt(_ref) {
8331
- var data = _ref.data,
8332
- key = _ref.key,
8333
- mode = _ref.mode;
8334
-
8335
- if (!key) {
8336
- key = Object(_storage__WEBPACK_IMPORTED_MODULE_0__[/* getStorage */ "a"])('secretKey');
8337
- }
8338
- if (!mode) {
8339
- mode = 1;
8340
- }
8341
- if (!new RegExp('^04').test(key)) {
8342
- key = '04' + key;
8343
- }
8344
- var result = sm2.doEncrypt(data, key, mode);
8345
- return result;
8346
- };
8347
-
8348
- /**
8349
- * doDecrypt
8350
- * @desc:sm2解密
8351
- * @author huangbo
8352
- * @date 2022年5月7日
8353
- * @param {string} [data] - 被解密的加密字符串
8354
- * @param {string} [key] - 私钥
8355
- **/
8356
- var doDecrypt = function doDecrypt(_ref2) {
8357
- var data = _ref2.data,
8358
- key = _ref2.key,
8359
- mode = _ref2.mode;
8360
-
8361
- var cipherMode = mode ? mode : 1;
8362
- if (new RegExp('^04').test(key)) {
8363
- key = key.slice(2);
8364
- }
8365
- var result = sm2.doDecrypt(data, key, cipherMode);
8366
- return result;
8367
- };
8368
-
8369
- /***/ }),
8370
-
8371
8371
  /***/ 21:
8372
8372
  /***/ (function(module, exports) {
8373
8373
 
@@ -8559,7 +8559,7 @@ module.exports = require("throttle-debounce");
8559
8559
 
8560
8560
 
8561
8561
 
8562
- var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(52);
8562
+ var PopperJS = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer ? function () {} : __webpack_require__(53);
8563
8563
  var stopPropagation = function stopPropagation(e) {
8564
8564
  return e.stopPropagation();
8565
8565
  };
@@ -9895,17 +9895,19 @@ function insertAfter(newEl, targetEl) {
9895
9895
 
9896
9896
  /***/ }),
9897
9897
 
9898
- /***/ 50:
9898
+ /***/ 51:
9899
9899
  /***/ (function(module, exports) {
9900
9900
 
9901
9901
  module.exports = require("eoss/lib/tree");
9902
9902
 
9903
9903
  /***/ }),
9904
9904
 
9905
- /***/ 52:
9905
+ /***/ 53:
9906
9906
  /***/ (function(module, exports, __webpack_require__) {
9907
9907
 
9908
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
9908
+ 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; };
9909
+
9910
+ /**
9909
9911
  * @fileOverview Kickass library to create and place poppers near their reference elements.
9910
9912
  * @version {{version}}
9911
9913
  * @license
@@ -9928,68 +9930,60 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
9928
9930
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9929
9931
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
9930
9932
  * SOFTWARE.
9931
- */
9932
-
9933
- //
9934
- // Cross module loader
9935
- // Supported: Node, AMD, Browser globals
9936
- //
9937
- (function (root, factory) {
9938
- if (true) {
9939
- // AMD. Register as an anonymous module.
9933
+ */
9934
+
9935
+ //
9936
+ // Cross module loader
9937
+ // Supported: Node, AMD, Browser globals
9938
+ //
9939
+ (function (root, factory) {
9940
+ if (true) {
9941
+ // AMD. Register as an anonymous module.
9940
9942
  !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
9941
9943
  __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
9942
9944
  (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
9943
9945
  __WEBPACK_AMD_DEFINE_FACTORY__),
9944
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
9945
- } else {}
9946
- })(this, function () {
9947
- 'use strict';
9948
-
9949
- var root = window;
9950
- // default options
9951
- var DEFAULTS = {
9952
- // placement of the popper
9953
- placement: 'bottom',
9954
-
9955
- gpuAcceleration: true,
9956
-
9957
- // shift popper from its origin by the given amount of pixels (can be negative)
9958
- offset: 0,
9959
-
9960
- // the element which will act as boundary of the popper
9961
- boundariesElement: 'viewport',
9962
-
9963
- // amount of pixel used to define a minimum distance between the boundaries and the popper
9964
- boundariesPadding: 5,
9965
-
9966
- // popper will try to prevent overflow following this order,
9967
- // by default, then, it could overflow on the left and on top of the boundariesElement
9968
- preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
9969
-
9970
- // the behavior used by flip to change the placement of the popper
9971
- flipBehavior: 'flip',
9972
-
9973
- arrowElement: '[x-arrow]',
9974
-
9975
- arrowOffset: 0,
9976
-
9977
- // list of functions used to modify the offsets before they are applied to the popper
9978
- modifiers: [
9979
- 'shift',
9980
- 'offset',
9981
- 'preventOverflow',
9982
- 'keepTogether',
9983
- 'arrow',
9984
- 'flip',
9985
- 'applyStyle'
9986
- ],
9987
-
9988
- modifiersIgnored: [],
9989
-
9990
- forceAbsolute: false
9991
- };
9992
-
9946
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
9947
+ } else {}
9948
+ })(this, function () {
9949
+ 'use strict';
9950
+
9951
+ var root = window;
9952
+ // default options
9953
+ var DEFAULTS = {
9954
+ // placement of the popper
9955
+ placement: 'bottom',
9956
+
9957
+ gpuAcceleration: true,
9958
+
9959
+ // shift popper from its origin by the given amount of pixels (can be negative)
9960
+ offset: 0,
9961
+
9962
+ // the element which will act as boundary of the popper
9963
+ boundariesElement: 'viewport',
9964
+
9965
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
9966
+ boundariesPadding: 5,
9967
+
9968
+ // popper will try to prevent overflow following this order,
9969
+ // by default, then, it could overflow on the left and on top of the boundariesElement
9970
+ preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
9971
+
9972
+ // the behavior used by flip to change the placement of the popper
9973
+ flipBehavior: 'flip',
9974
+
9975
+ arrowElement: '[x-arrow]',
9976
+
9977
+ arrowOffset: 0,
9978
+
9979
+ // list of functions used to modify the offsets before they are applied to the popper
9980
+ modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
9981
+
9982
+ modifiersIgnored: [],
9983
+
9984
+ forceAbsolute: false
9985
+ };
9986
+
9993
9987
  /**
9994
9988
  * Create a new Popper.js instance
9995
9989
  * @constructor Popper
@@ -10054,125 +10048,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10054
10048
  *
10055
10049
  * @param {Boolean} [options.removeOnDestroy=false]
10056
10050
  * Set to true if you want to automatically remove the popper when you call the `destroy` method.
10057
- */
10058
- function Popper(reference, popper, options) {
10059
- this._reference = reference.jquery ? reference[0] : reference;
10060
- this.state = {};
10061
-
10062
- // if the popper variable is a configuration object, parse it to generate an HTMLElement
10063
- // generate a default popper if is not defined
10064
- var isNotDefined = typeof popper === 'undefined' || popper === null;
10065
- var isConfig =
10066
- popper && Object.prototype.toString.call(popper) === '[object Object]';
10067
- if (isNotDefined || isConfig) {
10068
- this._popper = this.parse(isConfig ? popper : {});
10069
- }
10070
- // otherwise, use the given HTMLElement as popper
10071
- else {
10072
- this._popper = popper.jquery ? popper[0] : popper;
10073
- }
10074
-
10075
- // with {} we create a new object with the options inside it
10076
- this._options = Object.assign({}, DEFAULTS, options);
10077
-
10078
- // refactoring modifiers' list
10079
- this._options.modifiers = this._options.modifiers.map(
10080
- function (modifier) {
10081
- // remove ignored modifiers
10082
- if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
10083
-
10084
- // set the x-placement attribute before everything else because it could be used to add margins to the popper
10085
- // margins needs to be calculated to get the correct popper offsets
10086
- if (modifier === 'applyStyle') {
10087
- this._popper.setAttribute('x-placement', this._options.placement);
10088
- }
10089
-
10090
- // return predefined modifier identified by string or keep the custom one
10091
- return this.modifiers[modifier] || modifier;
10092
- }.bind(this)
10093
- );
10094
-
10095
- // make sure to apply the popper position before any computation
10096
- this.state.position = this._getPosition(this._popper, this._reference);
10097
- setStyle(this._popper, { position: this.state.position, top: 0 });
10098
-
10099
- // fire the first update to position the popper in the right place
10100
- this.update();
10101
-
10102
- // setup event listeners, they will take care of update the position in specific situations
10103
- this._setupEventListeners();
10104
- return this;
10105
- }
10106
-
10107
- //
10108
- // Methods
10109
- //
10051
+ */
10052
+ function Popper(reference, popper, options) {
10053
+ this._reference = reference.jquery ? reference[0] : reference;
10054
+ this.state = {};
10055
+
10056
+ // if the popper variable is a configuration object, parse it to generate an HTMLElement
10057
+ // generate a default popper if is not defined
10058
+ var isNotDefined = typeof popper === 'undefined' || popper === null;
10059
+ var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
10060
+ if (isNotDefined || isConfig) {
10061
+ this._popper = this.parse(isConfig ? popper : {});
10062
+ }
10063
+ // otherwise, use the given HTMLElement as popper
10064
+ else {
10065
+ this._popper = popper.jquery ? popper[0] : popper;
10066
+ }
10067
+
10068
+ // with {} we create a new object with the options inside it
10069
+ this._options = Object.assign({}, DEFAULTS, options);
10070
+
10071
+ // refactoring modifiers' list
10072
+ this._options.modifiers = this._options.modifiers.map(function (modifier) {
10073
+ // remove ignored modifiers
10074
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
10075
+
10076
+ // set the x-placement attribute before everything else because it could be used to add margins to the popper
10077
+ // margins needs to be calculated to get the correct popper offsets
10078
+ if (modifier === 'applyStyle') {
10079
+ this._popper.setAttribute('x-placement', this._options.placement);
10080
+ }
10081
+
10082
+ // return predefined modifier identified by string or keep the custom one
10083
+ return this.modifiers[modifier] || modifier;
10084
+ }.bind(this));
10085
+
10086
+ // make sure to apply the popper position before any computation
10087
+ this.state.position = this._getPosition(this._popper, this._reference);
10088
+ setStyle(this._popper, { position: this.state.position, top: 0 });
10089
+
10090
+ // fire the first update to position the popper in the right place
10091
+ this.update();
10092
+
10093
+ // setup event listeners, they will take care of update the position in specific situations
10094
+ this._setupEventListeners();
10095
+ return this;
10096
+ }
10097
+
10098
+ //
10099
+ // Methods
10100
+ //
10110
10101
  /**
10111
10102
  * Destroy the popper
10112
10103
  * @method
10113
10104
  * @memberof Popper
10114
- */
10115
- Popper.prototype.destroy = function () {
10116
- this._popper.removeAttribute('x-placement');
10117
- this._popper.style.left = '';
10118
- this._popper.style.position = '';
10119
- this._popper.style.top = '';
10120
- this._popper.style[getSupportedPropertyName('transform')] = '';
10121
- this._removeEventListeners();
10122
-
10123
- // remove the popper if user explicity asked for the deletion on destroy
10124
- if (this._options.removeOnDestroy) {
10125
- this._popper.remove();
10126
- }
10127
- return this;
10128
- };
10129
-
10105
+ */
10106
+ Popper.prototype.destroy = function () {
10107
+ this._popper.removeAttribute('x-placement');
10108
+ this._popper.style.left = '';
10109
+ this._popper.style.position = '';
10110
+ this._popper.style.top = '';
10111
+ this._popper.style[getSupportedPropertyName('transform')] = '';
10112
+ this._removeEventListeners();
10113
+
10114
+ // remove the popper if user explicity asked for the deletion on destroy
10115
+ if (this._options.removeOnDestroy) {
10116
+ this._popper.remove();
10117
+ }
10118
+ return this;
10119
+ };
10120
+
10130
10121
  /**
10131
10122
  * Updates the position of the popper, computing the new offsets and applying the new style
10132
10123
  * @method
10133
10124
  * @memberof Popper
10134
- */
10135
- Popper.prototype.update = function () {
10136
- var data = { instance: this, styles: {} };
10137
-
10138
- // store placement inside the data object, modifiers will be able to edit `placement` if needed
10139
- // and refer to _originalPlacement to know the original value
10140
- data.placement = this._options.placement;
10141
- data._originalPlacement = this._options.placement;
10142
-
10143
- // compute the popper and reference offsets and put them inside data.offsets
10144
- data.offsets = this._getOffsets(
10145
- this._popper,
10146
- this._reference,
10147
- data.placement
10148
- );
10149
-
10150
- // get boundaries
10151
- data.boundaries = this._getBoundaries(
10152
- data,
10153
- this._options.boundariesPadding,
10154
- this._options.boundariesElement
10155
- );
10156
-
10157
- data = this.runModifiers(data, this._options.modifiers);
10158
-
10159
- if (typeof this.state.updateCallback === 'function') {
10160
- this.state.updateCallback(data);
10161
- }
10162
- };
10163
-
10125
+ */
10126
+ Popper.prototype.update = function () {
10127
+ var data = { instance: this, styles: {} };
10128
+
10129
+ // store placement inside the data object, modifiers will be able to edit `placement` if needed
10130
+ // and refer to _originalPlacement to know the original value
10131
+ data.placement = this._options.placement;
10132
+ data._originalPlacement = this._options.placement;
10133
+
10134
+ // compute the popper and reference offsets and put them inside data.offsets
10135
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
10136
+
10137
+ // get boundaries
10138
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
10139
+
10140
+ data = this.runModifiers(data, this._options.modifiers);
10141
+
10142
+ if (typeof this.state.updateCallback === 'function') {
10143
+ this.state.updateCallback(data);
10144
+ }
10145
+ };
10146
+
10164
10147
  /**
10165
10148
  * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
10166
10149
  * @method
10167
10150
  * @memberof Popper
10168
10151
  * @param {Function} callback
10169
- */
10170
- Popper.prototype.onCreate = function (callback) {
10171
- // the createCallbacks return as first argument the popper instance
10172
- callback(this);
10173
- return this;
10174
- };
10175
-
10152
+ */
10153
+ Popper.prototype.onCreate = function (callback) {
10154
+ // the createCallbacks return as first argument the popper instance
10155
+ callback(this);
10156
+ return this;
10157
+ };
10158
+
10176
10159
  /**
10177
10160
  * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
10178
10161
  * used to style popper and its arrow.
@@ -10180,101 +10163,93 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10180
10163
  * @method
10181
10164
  * @memberof Popper
10182
10165
  * @param {Function} callback
10183
- */
10184
- Popper.prototype.onUpdate = function (callback) {
10185
- this.state.updateCallback = callback;
10186
- return this;
10187
- };
10188
-
10166
+ */
10167
+ Popper.prototype.onUpdate = function (callback) {
10168
+ this.state.updateCallback = callback;
10169
+ return this;
10170
+ };
10171
+
10189
10172
  /**
10190
10173
  * Helper used to generate poppers from a configuration file
10191
10174
  * @method
10192
10175
  * @memberof Popper
10193
10176
  * @param config {Object} configuration
10194
10177
  * @returns {HTMLElement} popper
10195
- */
10196
- Popper.prototype.parse = function (config) {
10197
- var defaultConfig = {
10198
- tagName: 'div',
10199
- classNames: ['popper'],
10200
- attributes: [],
10201
- parent: root.document.body,
10202
- content: '',
10203
- contentType: 'text',
10204
- arrowTagName: 'div',
10205
- arrowClassNames: ['popper__arrow'],
10206
- arrowAttributes: ['x-arrow']
10207
- };
10208
- config = Object.assign({}, defaultConfig, config);
10209
-
10210
- var d = root.document;
10211
-
10212
- var popper = d.createElement(config.tagName);
10213
- addClassNames(popper, config.classNames);
10214
- addAttributes(popper, config.attributes);
10215
- if (config.contentType === 'node') {
10216
- popper.appendChild(
10217
- config.content.jquery ? config.content[0] : config.content
10218
- );
10219
- } else if (config.contentType === 'html') {
10220
- popper.innerHTML = config.content;
10221
- } else {
10222
- popper.textContent = config.content;
10223
- }
10224
-
10225
- if (config.arrowTagName) {
10226
- var arrow = d.createElement(config.arrowTagName);
10227
- addClassNames(arrow, config.arrowClassNames);
10228
- addAttributes(arrow, config.arrowAttributes);
10229
- popper.appendChild(arrow);
10230
- }
10231
-
10232
- var parent = config.parent.jquery ? config.parent[0] : config.parent;
10233
-
10234
- // if the given parent is a string, use it to match an element
10235
- // if more than one element is matched, the first one will be used as parent
10236
- // if no elements are matched, the script will throw an error
10237
- if (typeof parent === 'string') {
10238
- parent = d.querySelectorAll(config.parent);
10239
- if (parent.length > 1) {
10240
- console.warn(
10241
- 'WARNING: the given `parent` query(' +
10242
- config.parent +
10243
- ') matched more than one element, the first one will be used'
10244
- );
10245
- }
10246
- if (parent.length === 0) {
10247
- throw "ERROR: the given `parent` doesn't exists!";
10248
- }
10249
- parent = parent[0];
10250
- }
10251
- // if the given parent is a DOM nodes list or an array of nodes with more than one element,
10252
- // the first one will be used as parent
10253
- if (parent.length > 1 && parent instanceof Element === false) {
10254
- console.warn(
10255
- 'WARNING: you have passed as parent a list of elements, the first one will be used'
10256
- );
10257
- parent = parent[0];
10258
- }
10259
-
10260
- // append the generated popper to its parent
10261
- parent.appendChild(popper);
10262
-
10263
- return popper;
10264
-
10178
+ */
10179
+ Popper.prototype.parse = function (config) {
10180
+ var defaultConfig = {
10181
+ tagName: 'div',
10182
+ classNames: ['popper'],
10183
+ attributes: [],
10184
+ parent: root.document.body,
10185
+ content: '',
10186
+ contentType: 'text',
10187
+ arrowTagName: 'div',
10188
+ arrowClassNames: ['popper__arrow'],
10189
+ arrowAttributes: ['x-arrow']
10190
+ };
10191
+ config = Object.assign({}, defaultConfig, config);
10192
+
10193
+ var d = root.document;
10194
+
10195
+ var popper = d.createElement(config.tagName);
10196
+ addClassNames(popper, config.classNames);
10197
+ addAttributes(popper, config.attributes);
10198
+ if (config.contentType === 'node') {
10199
+ popper.appendChild(config.content.jquery ? config.content[0] : config.content);
10200
+ } else if (config.contentType === 'html') {
10201
+ popper.innerHTML = config.content;
10202
+ } else {
10203
+ popper.textContent = config.content;
10204
+ }
10205
+
10206
+ if (config.arrowTagName) {
10207
+ var arrow = d.createElement(config.arrowTagName);
10208
+ addClassNames(arrow, config.arrowClassNames);
10209
+ addAttributes(arrow, config.arrowAttributes);
10210
+ popper.appendChild(arrow);
10211
+ }
10212
+
10213
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
10214
+
10215
+ // if the given parent is a string, use it to match an element
10216
+ // if more than one element is matched, the first one will be used as parent
10217
+ // if no elements are matched, the script will throw an error
10218
+ if (typeof parent === 'string') {
10219
+ parent = d.querySelectorAll(config.parent);
10220
+ if (parent.length > 1) {
10221
+ console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
10222
+ }
10223
+ if (parent.length === 0) {
10224
+ throw "ERROR: the given `parent` doesn't exists!";
10225
+ }
10226
+ parent = parent[0];
10227
+ }
10228
+ // if the given parent is a DOM nodes list or an array of nodes with more than one element,
10229
+ // the first one will be used as parent
10230
+ if (parent.length > 1 && parent instanceof Element === false) {
10231
+ console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
10232
+ parent = parent[0];
10233
+ }
10234
+
10235
+ // append the generated popper to its parent
10236
+ parent.appendChild(popper);
10237
+
10238
+ return popper;
10239
+
10265
10240
  /**
10266
10241
  * Adds class names to the given element
10267
10242
  * @function
10268
10243
  * @ignore
10269
10244
  * @param {HTMLElement} target
10270
10245
  * @param {Array} classes
10271
- */
10272
- function addClassNames(element, classNames) {
10273
- classNames.forEach(function (className) {
10274
- element.classList.add(className);
10275
- });
10276
- }
10277
-
10246
+ */
10247
+ function addClassNames(element, classNames) {
10248
+ classNames.forEach(function (className) {
10249
+ element.classList.add(className);
10250
+ });
10251
+ }
10252
+
10278
10253
  /**
10279
10254
  * Adds attributes to the given element
10280
10255
  * @function
@@ -10283,17 +10258,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10283
10258
  * @param {Array} attributes
10284
10259
  * @example
10285
10260
  * addAttributes(element, [ 'data-info:foobar' ]);
10286
- */
10287
- function addAttributes(element, attributes) {
10288
- attributes.forEach(function (attribute) {
10289
- element.setAttribute(
10290
- attribute.split(':')[0],
10291
- attribute.split(':')[1] || ''
10292
- );
10293
- });
10294
- }
10295
- };
10296
-
10261
+ */
10262
+ function addAttributes(element, attributes) {
10263
+ attributes.forEach(function (attribute) {
10264
+ element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
10265
+ });
10266
+ }
10267
+ };
10268
+
10297
10269
  /**
10298
10270
  * Helper used to get the position which will be applied to the popper
10299
10271
  * @method
@@ -10301,20 +10273,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10301
10273
  * @param config {HTMLElement} popper element
10302
10274
  * @param reference {HTMLElement} reference element
10303
10275
  * @returns {String} position
10304
- */
10305
- Popper.prototype._getPosition = function (popper, reference) {
10306
- var container = getOffsetParent(reference);
10307
-
10308
- if (this._options.forceAbsolute) {
10309
- return 'absolute';
10310
- }
10311
-
10312
- // Decide if the popper will be fixed
10313
- // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
10314
- var isParentFixed = isFixed(reference, container);
10315
- return isParentFixed ? 'fixed' : 'absolute';
10316
- };
10317
-
10276
+ */
10277
+ Popper.prototype._getPosition = function (popper, reference) {
10278
+ var container = getOffsetParent(reference);
10279
+
10280
+ if (this._options.forceAbsolute) {
10281
+ return 'absolute';
10282
+ }
10283
+
10284
+ // Decide if the popper will be fixed
10285
+ // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
10286
+ var isParentFixed = isFixed(reference, container);
10287
+ return isParentFixed ? 'fixed' : 'absolute';
10288
+ };
10289
+
10318
10290
  /**
10319
10291
  * Get offsets to the popper
10320
10292
  * @method
@@ -10323,110 +10295,91 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10323
10295
  * @param {Element} popper - the popper element
10324
10296
  * @param {Element} reference - the reference element (the popper will be relative to this)
10325
10297
  * @returns {Object} An object containing the offsets which will be applied to the popper
10326
- */
10327
- Popper.prototype._getOffsets = function (popper, reference, placement) {
10328
- placement = placement.split('-')[0];
10329
- var popperOffsets = {};
10330
-
10331
- popperOffsets.position = this.state.position;
10332
- var isParentFixed = popperOffsets.position === 'fixed';
10333
-
10334
- //
10335
- // Get reference element position
10336
- //
10337
- var referenceOffsets = getOffsetRectRelativeToCustomParent(
10338
- reference,
10339
- popper,
10340
- isParentFixed
10341
- );
10342
-
10343
- //
10344
- // Get popper sizes
10345
- //
10346
- var popperRect = getOuterSizes(popper);
10347
-
10348
- //
10349
- // Compute offsets of popper
10350
- //
10351
-
10352
- // depending by the popper placement we have to compute its offsets slightly differently
10353
- if (['right', 'left'].indexOf(placement) !== -1) {
10354
- popperOffsets.top =
10355
- referenceOffsets.top +
10356
- referenceOffsets.height / 2 -
10357
- popperRect.height / 2;
10358
- if (placement === 'left') {
10359
- popperOffsets.left = referenceOffsets.left - popperRect.width;
10360
- } else {
10361
- popperOffsets.left = referenceOffsets.right;
10362
- }
10363
- } else {
10364
- popperOffsets.left =
10365
- referenceOffsets.left +
10366
- referenceOffsets.width / 2 -
10367
- popperRect.width / 2;
10368
- if (placement === 'top') {
10369
- popperOffsets.top = referenceOffsets.top - popperRect.height;
10370
- } else {
10371
- popperOffsets.top = referenceOffsets.bottom;
10372
- }
10373
- }
10374
-
10375
- // Add width and height to our offsets object
10376
- popperOffsets.width = popperRect.width;
10377
- popperOffsets.height = popperRect.height;
10378
-
10379
- return {
10380
- popper: popperOffsets,
10381
- reference: referenceOffsets
10382
- };
10383
- };
10384
-
10298
+ */
10299
+ Popper.prototype._getOffsets = function (popper, reference, placement) {
10300
+ placement = placement.split('-')[0];
10301
+ var popperOffsets = {};
10302
+
10303
+ popperOffsets.position = this.state.position;
10304
+ var isParentFixed = popperOffsets.position === 'fixed';
10305
+
10306
+ //
10307
+ // Get reference element position
10308
+ //
10309
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, popper, isParentFixed);
10310
+
10311
+ //
10312
+ // Get popper sizes
10313
+ //
10314
+ var popperRect = getOuterSizes(popper);
10315
+
10316
+ //
10317
+ // Compute offsets of popper
10318
+ //
10319
+
10320
+ // depending by the popper placement we have to compute its offsets slightly differently
10321
+ if (['right', 'left'].indexOf(placement) !== -1) {
10322
+ popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
10323
+ if (placement === 'left') {
10324
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
10325
+ } else {
10326
+ popperOffsets.left = referenceOffsets.right;
10327
+ }
10328
+ } else {
10329
+ popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
10330
+ if (placement === 'top') {
10331
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
10332
+ } else {
10333
+ popperOffsets.top = referenceOffsets.bottom;
10334
+ }
10335
+ }
10336
+
10337
+ // Add width and height to our offsets object
10338
+ popperOffsets.width = popperRect.width;
10339
+ popperOffsets.height = popperRect.height;
10340
+
10341
+ return {
10342
+ popper: popperOffsets,
10343
+ reference: referenceOffsets
10344
+ };
10345
+ };
10346
+
10385
10347
  /**
10386
10348
  * Setup needed event listeners used to update the popper position
10387
10349
  * @method
10388
10350
  * @memberof Popper
10389
10351
  * @access private
10390
- */
10391
- Popper.prototype._setupEventListeners = function () {
10392
- // NOTE: 1 DOM access here
10393
- this.state.updateBound = this.update.bind(this);
10394
- // 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
10395
- this.state.realWindow = getRealWindow(this._popper);
10396
- this.state.realWindow.addEventListener('resize', this.state.updateBound);
10397
- // if the boundariesElement is window we don't need to listen for the scroll event
10398
- if (this._options.boundariesElement !== 'window') {
10399
- var target = getScrollParent(this._reference);
10400
- target.addEventListener('scroll', this.state.updateBound);
10401
- this.state.scrollTarget = target;
10402
- }
10403
- };
10404
-
10352
+ */
10353
+ Popper.prototype._setupEventListeners = function () {
10354
+ // NOTE: 1 DOM access here
10355
+ this.state.updateBound = this.update.bind(this);
10356
+ // 无界等微前端场景下沙箱 window 不会触发 resize,需监听真实 window
10357
+ this.state.realWindow = getRealWindow(this._popper);
10358
+ this.state.realWindow.addEventListener('resize', this.state.updateBound);
10359
+ // if the boundariesElement is window we don't need to listen for the scroll event
10360
+ if (this._options.boundariesElement !== 'window') {
10361
+ var target = getScrollParent(this._reference);
10362
+ target.addEventListener('scroll', this.state.updateBound);
10363
+ this.state.scrollTarget = target;
10364
+ }
10365
+ };
10366
+
10405
10367
  /**
10406
10368
  * Remove event listeners used to update the popper position
10407
10369
  * @method
10408
10370
  * @memberof Popper
10409
10371
  * @access private
10410
- */
10411
- Popper.prototype._removeEventListeners = function () {
10412
- // NOTE: 1 DOM access here
10413
- (this.state.realWindow || root).removeEventListener(
10414
- 'resize',
10415
- this.state.updateBound
10416
- );
10417
- if (
10418
- this._options.boundariesElement !== 'window' &&
10419
- this.state.scrollTarget
10420
- ) {
10421
- this.state.scrollTarget.removeEventListener(
10422
- 'scroll',
10423
- this.state.updateBound
10424
- );
10425
- this.state.scrollTarget = null;
10426
- }
10427
- this.state.updateBound = null;
10428
- };
10429
-
10372
+ */
10373
+ Popper.prototype._removeEventListeners = function () {
10374
+ // NOTE: 1 DOM access here
10375
+ (this.state.realWindow || root).removeEventListener('resize', this.state.updateBound);
10376
+ if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
10377
+ this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
10378
+ this.state.scrollTarget = null;
10379
+ }
10380
+ this.state.updateBound = null;
10381
+ };
10382
+
10430
10383
  /**
10431
10384
  * Computed the boundaries limits and return them
10432
10385
  * @method
@@ -10436,75 +10389,56 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10436
10389
  * @param {Number} padding - Boundaries padding
10437
10390
  * @param {Element} boundariesElement - Element used to define the boundaries
10438
10391
  * @returns {Object} Coordinates of the boundaries
10439
- */
10440
- Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
10441
- // NOTE: 1 DOM access here
10442
- var boundaries = {};
10443
- var width, height;
10444
- if (boundariesElement === 'window') {
10445
- var body = root.document.body,
10446
- html = root.document.documentElement;
10447
-
10448
- height = Math.max(
10449
- body.scrollHeight,
10450
- body.offsetHeight,
10451
- html.clientHeight,
10452
- html.scrollHeight,
10453
- html.offsetHeight
10454
- );
10455
- width = Math.max(
10456
- body.scrollWidth,
10457
- body.offsetWidth,
10458
- html.clientWidth,
10459
- html.scrollWidth,
10460
- html.offsetWidth
10461
- );
10462
-
10463
- boundaries = {
10464
- top: 0,
10465
- right: width,
10466
- bottom: height,
10467
- left: 0
10468
- };
10469
- } else if (boundariesElement === 'viewport') {
10470
- // 将真实 window 的视口换算到 popper 所在包含块的坐标系。
10471
- // 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
10472
- // 统一从元素自身的 view 与真实包含块获取
10473
- var realWindow = getRealWindow(this._popper);
10474
- var containingBlockRect = getContainingBlockRect(
10475
- this._popper,
10476
- data.offsets.popper.position === 'fixed'
10477
- );
10478
-
10479
- boundaries = {
10480
- top: 0 - containingBlockRect.top,
10481
- right:
10482
- realWindow.document.documentElement.clientWidth -
10483
- containingBlockRect.left,
10484
- bottom:
10485
- realWindow.document.documentElement.clientHeight -
10486
- containingBlockRect.top,
10487
- left: 0 - containingBlockRect.left
10488
- };
10489
- } else {
10490
- if (getOffsetParent(this._popper) === boundariesElement) {
10491
- boundaries = {
10492
- top: 0,
10493
- left: 0,
10494
- right: boundariesElement.clientWidth,
10495
- bottom: boundariesElement.clientHeight
10496
- };
10497
- } else {
10498
- boundaries = getOffsetRect(boundariesElement);
10499
- }
10500
- }
10501
- boundaries.left += padding;
10502
- boundaries.right -= padding;
10503
- boundaries.top = boundaries.top + padding;
10504
- boundaries.bottom = boundaries.bottom - padding;
10505
- return boundaries;
10506
- };
10507
-
10392
+ */
10393
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
10394
+ // NOTE: 1 DOM access here
10395
+ var boundaries = {};
10396
+ var width, height;
10397
+ if (boundariesElement === 'window') {
10398
+ var body = root.document.body,
10399
+ html = root.document.documentElement;
10400
+
10401
+ height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
10402
+ width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
10403
+
10404
+ boundaries = {
10405
+ top: 0,
10406
+ right: width,
10407
+ bottom: height,
10408
+ left: 0
10409
+ };
10410
+ } else if (boundariesElement === 'viewport') {
10411
+ // 将真实 window 的视口换算到 popper 所在包含块的坐标系。
10412
+ // 无界等场景下沙箱 window 的尺寸、shadowRoot 内元素的 scrollTop 均不可靠,
10413
+ // 统一从元素自身的 view 与真实包含块获取
10414
+ var realWindow = getRealWindow(this._popper);
10415
+ var containingBlockRect = getContainingBlockRect(this._popper, data.offsets.popper.position === 'fixed');
10416
+
10417
+ boundaries = {
10418
+ top: 0 - containingBlockRect.top,
10419
+ right: realWindow.document.documentElement.clientWidth - containingBlockRect.left,
10420
+ bottom: realWindow.document.documentElement.clientHeight - containingBlockRect.top,
10421
+ left: 0 - containingBlockRect.left
10422
+ };
10423
+ } else {
10424
+ if (getOffsetParent(this._popper) === boundariesElement) {
10425
+ boundaries = {
10426
+ top: 0,
10427
+ left: 0,
10428
+ right: boundariesElement.clientWidth,
10429
+ bottom: boundariesElement.clientHeight
10430
+ };
10431
+ } else {
10432
+ boundaries = getOffsetRect(boundariesElement);
10433
+ }
10434
+ }
10435
+ boundaries.left += padding;
10436
+ boundaries.right -= padding;
10437
+ boundaries.top = boundaries.top + padding;
10438
+ boundaries.bottom = boundaries.bottom - padding;
10439
+ return boundaries;
10440
+ };
10441
+
10508
10442
  /**
10509
10443
  * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
10510
10444
  * @method
@@ -10513,27 +10447,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10513
10447
  * @param {Object} data
10514
10448
  * @param {Array} modifiers
10515
10449
  * @param {Function} ends
10516
- */
10517
- Popper.prototype.runModifiers = function (data, modifiers, ends) {
10518
- var modifiersToRun = modifiers.slice();
10519
- if (ends !== undefined) {
10520
- modifiersToRun = this._options.modifiers.slice(
10521
- 0,
10522
- getArrayKeyIndex(this._options.modifiers, ends)
10523
- );
10524
- }
10525
-
10526
- modifiersToRun.forEach(
10527
- function (modifier) {
10528
- if (isFunction(modifier)) {
10529
- data = modifier.call(this, data);
10530
- }
10531
- }.bind(this)
10532
- );
10533
-
10534
- return data;
10535
- };
10536
-
10450
+ */
10451
+ Popper.prototype.runModifiers = function (data, modifiers, ends) {
10452
+ var modifiersToRun = modifiers.slice();
10453
+ if (ends !== undefined) {
10454
+ modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
10455
+ }
10456
+
10457
+ modifiersToRun.forEach(function (modifier) {
10458
+ if (isFunction(modifier)) {
10459
+ data = modifier.call(this, data);
10460
+ }
10461
+ }.bind(this));
10462
+
10463
+ return data;
10464
+ };
10465
+
10537
10466
  /**
10538
10467
  * Helper used to know if the given modifier depends from another one.
10539
10468
  * @method
@@ -10541,204 +10470,191 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10541
10470
  * @param {String} requesting - name of requesting modifier
10542
10471
  * @param {String} requested - name of requested modifier
10543
10472
  * @returns {Boolean}
10544
- */
10545
- Popper.prototype.isModifierRequired = function (requesting, requested) {
10546
- var index = getArrayKeyIndex(this._options.modifiers, requesting);
10547
- return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
10548
- return modifier === requested;
10549
- }).length;
10550
- };
10551
-
10552
- //
10553
- // Modifiers
10554
- //
10555
-
10473
+ */
10474
+ Popper.prototype.isModifierRequired = function (requesting, requested) {
10475
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
10476
+ return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
10477
+ return modifier === requested;
10478
+ }).length;
10479
+ };
10480
+
10481
+ //
10482
+ // Modifiers
10483
+ //
10484
+
10556
10485
  /**
10557
10486
  * Modifiers list
10558
10487
  * @namespace Popper.modifiers
10559
10488
  * @memberof Popper
10560
10489
  * @type {Object}
10561
- */
10562
- Popper.prototype.modifiers = {};
10563
-
10490
+ */
10491
+ Popper.prototype.modifiers = {};
10492
+
10564
10493
  /**
10565
10494
  * Apply the computed styles to the popper element
10566
10495
  * @method
10567
10496
  * @memberof Popper.modifiers
10568
10497
  * @argument {Object} data - The data object generated by `update` method
10569
10498
  * @returns {Object} The same data object
10570
- */
10571
- Popper.prototype.modifiers.applyStyle = function (data) {
10572
- // apply the final offsets to the popper
10573
- // NOTE: 1 DOM access here
10574
- var styles = {
10575
- position: data.offsets.popper.position
10576
- };
10577
-
10578
- // round top and left to avoid blurry text
10579
- var left = Math.round(data.offsets.popper.left);
10580
- var top = Math.round(data.offsets.popper.top);
10581
-
10582
- // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
10583
- // we automatically use the supported prefixed version if needed
10584
- var prefixedProperty;
10585
- if (
10586
- this._options.gpuAcceleration &&
10587
- (prefixedProperty = getSupportedPropertyName('transform'))
10588
- ) {
10589
- styles[prefixedProperty] =
10590
- 'translate3d(' + left + 'px, ' + top + 'px, 0)';
10591
- styles.top = 0;
10592
- styles.left = 0;
10593
- }
10594
- // othwerise, we use the standard `left` and `top` properties
10595
- else {
10596
- styles.left = left;
10597
- styles.top = top;
10598
- }
10599
-
10600
- // any property present in `data.styles` will be applied to the popper,
10601
- // in this way we can make the 3rd party modifiers add custom styles to it
10602
- // Be aware, modifiers could override the properties defined in the previous
10603
- // lines of this modifier!
10604
- Object.assign(styles, data.styles);
10605
-
10606
- setStyle(this._popper, styles);
10607
-
10608
- // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
10609
- // NOTE: 1 DOM access here
10610
- this._popper.setAttribute('x-placement', data.placement);
10611
-
10612
- // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
10613
- if (
10614
- this.isModifierRequired(
10615
- this.modifiers.applyStyle,
10616
- this.modifiers.arrow
10617
- ) &&
10618
- data.offsets.arrow
10619
- ) {
10620
- setStyle(data.arrowElement, data.offsets.arrow);
10621
- }
10622
-
10623
- return data;
10624
- };
10625
-
10499
+ */
10500
+ Popper.prototype.modifiers.applyStyle = function (data) {
10501
+ // apply the final offsets to the popper
10502
+ // NOTE: 1 DOM access here
10503
+ var styles = {
10504
+ position: data.offsets.popper.position
10505
+ };
10506
+
10507
+ // round top and left to avoid blurry text
10508
+ var left = Math.round(data.offsets.popper.left);
10509
+ var top = Math.round(data.offsets.popper.top);
10510
+
10511
+ // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
10512
+ // we automatically use the supported prefixed version if needed
10513
+ var prefixedProperty;
10514
+ if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
10515
+ styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
10516
+ styles.top = 0;
10517
+ styles.left = 0;
10518
+ }
10519
+ // othwerise, we use the standard `left` and `top` properties
10520
+ else {
10521
+ styles.left = left;
10522
+ styles.top = top;
10523
+ }
10524
+
10525
+ // any property present in `data.styles` will be applied to the popper,
10526
+ // in this way we can make the 3rd party modifiers add custom styles to it
10527
+ // Be aware, modifiers could override the properties defined in the previous
10528
+ // lines of this modifier!
10529
+ Object.assign(styles, data.styles);
10530
+
10531
+ setStyle(this._popper, styles);
10532
+
10533
+ // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
10534
+ // NOTE: 1 DOM access here
10535
+ this._popper.setAttribute('x-placement', data.placement);
10536
+
10537
+ // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
10538
+ if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
10539
+ setStyle(data.arrowElement, data.offsets.arrow);
10540
+ }
10541
+
10542
+ return data;
10543
+ };
10544
+
10626
10545
  /**
10627
10546
  * Modifier used to shift the popper on the start or end of its reference element side
10628
10547
  * @method
10629
10548
  * @memberof Popper.modifiers
10630
10549
  * @argument {Object} data - The data object generated by `update` method
10631
10550
  * @returns {Object} The data object, properly modified
10632
- */
10633
- Popper.prototype.modifiers.shift = function (data) {
10634
- var placement = data.placement;
10635
- var basePlacement = placement.split('-')[0];
10636
- var shiftVariation = placement.split('-')[1];
10637
-
10638
- // if shift shiftVariation is specified, run the modifier
10639
- if (shiftVariation) {
10640
- var reference = data.offsets.reference;
10641
- var popper = getPopperClientRect(data.offsets.popper);
10642
-
10643
- var shiftOffsets = {
10644
- y: {
10645
- start: { top: reference.top },
10646
- end: { top: reference.top + reference.height - popper.height }
10647
- },
10648
- x: {
10649
- start: { left: reference.left },
10650
- end: { left: reference.left + reference.width - popper.width }
10651
- }
10652
- };
10653
-
10654
- var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
10655
-
10656
- data.offsets.popper = Object.assign(
10657
- popper,
10658
- shiftOffsets[axis][shiftVariation]
10659
- );
10660
- }
10661
-
10662
- return data;
10663
- };
10664
-
10551
+ */
10552
+ Popper.prototype.modifiers.shift = function (data) {
10553
+ var placement = data.placement;
10554
+ var basePlacement = placement.split('-')[0];
10555
+ var shiftVariation = placement.split('-')[1];
10556
+
10557
+ // if shift shiftVariation is specified, run the modifier
10558
+ if (shiftVariation) {
10559
+ var reference = data.offsets.reference;
10560
+ var popper = getPopperClientRect(data.offsets.popper);
10561
+
10562
+ var shiftOffsets = {
10563
+ y: {
10564
+ start: { top: reference.top },
10565
+ end: { top: reference.top + reference.height - popper.height }
10566
+ },
10567
+ x: {
10568
+ start: { left: reference.left },
10569
+ end: { left: reference.left + reference.width - popper.width }
10570
+ }
10571
+ };
10572
+
10573
+ var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
10574
+
10575
+ data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
10576
+ }
10577
+
10578
+ return data;
10579
+ };
10580
+
10665
10581
  /**
10666
10582
  * Modifier used to make sure the popper does not overflows from it's boundaries
10667
10583
  * @method
10668
10584
  * @memberof Popper.modifiers
10669
10585
  * @argument {Object} data - The data object generated by `update` method
10670
10586
  * @returns {Object} The data object, properly modified
10671
- */
10672
- Popper.prototype.modifiers.preventOverflow = function (data) {
10673
- var order = this._options.preventOverflowOrder;
10674
- var popper = getPopperClientRect(data.offsets.popper);
10675
-
10676
- var check = {
10677
- left: function () {
10678
- var left = popper.left;
10679
- if (popper.left < data.boundaries.left) {
10680
- left = Math.max(popper.left, data.boundaries.left);
10681
- }
10682
- return { left: left };
10683
- },
10684
- right: function () {
10685
- var left = popper.left;
10686
- if (popper.right > data.boundaries.right) {
10687
- left = Math.min(popper.left, data.boundaries.right - popper.width);
10688
- }
10689
- return { left: left };
10690
- },
10691
- top: function () {
10692
- var top = popper.top;
10693
- if (popper.top < data.boundaries.top) {
10694
- top = Math.max(popper.top, data.boundaries.top);
10695
- }
10696
- return { top: top };
10697
- },
10698
- bottom: function () {
10699
- var top = popper.top;
10700
- if (popper.bottom > data.boundaries.bottom) {
10701
- top = Math.min(popper.top, data.boundaries.bottom - popper.height);
10702
- }
10703
- return { top: top };
10704
- }
10705
- };
10706
-
10707
- order.forEach(function (direction) {
10708
- data.offsets.popper = Object.assign(popper, check[direction]());
10709
- });
10710
-
10711
- return data;
10712
- };
10713
-
10587
+ */
10588
+ Popper.prototype.modifiers.preventOverflow = function (data) {
10589
+ var order = this._options.preventOverflowOrder;
10590
+ var popper = getPopperClientRect(data.offsets.popper);
10591
+
10592
+ var check = {
10593
+ left: function left() {
10594
+ var left = popper.left;
10595
+ if (popper.left < data.boundaries.left) {
10596
+ left = Math.max(popper.left, data.boundaries.left);
10597
+ }
10598
+ return { left: left };
10599
+ },
10600
+ right: function right() {
10601
+ var left = popper.left;
10602
+ if (popper.right > data.boundaries.right) {
10603
+ left = Math.min(popper.left, data.boundaries.right - popper.width);
10604
+ }
10605
+ return { left: left };
10606
+ },
10607
+ top: function top() {
10608
+ var top = popper.top;
10609
+ if (popper.top < data.boundaries.top) {
10610
+ top = Math.max(popper.top, data.boundaries.top);
10611
+ }
10612
+ return { top: top };
10613
+ },
10614
+ bottom: function bottom() {
10615
+ var top = popper.top;
10616
+ if (popper.bottom > data.boundaries.bottom) {
10617
+ top = Math.min(popper.top, data.boundaries.bottom - popper.height);
10618
+ }
10619
+ return { top: top };
10620
+ }
10621
+ };
10622
+
10623
+ order.forEach(function (direction) {
10624
+ data.offsets.popper = Object.assign(popper, check[direction]());
10625
+ });
10626
+
10627
+ return data;
10628
+ };
10629
+
10714
10630
  /**
10715
10631
  * Modifier used to make sure the popper is always near its reference
10716
10632
  * @method
10717
10633
  * @memberof Popper.modifiers
10718
10634
  * @argument {Object} data - The data object generated by _update method
10719
10635
  * @returns {Object} The data object, properly modified
10720
- */
10721
- Popper.prototype.modifiers.keepTogether = function (data) {
10722
- var popper = getPopperClientRect(data.offsets.popper);
10723
- var reference = data.offsets.reference;
10724
- var f = Math.floor;
10725
-
10726
- if (popper.right < f(reference.left)) {
10727
- data.offsets.popper.left = f(reference.left) - popper.width;
10728
- }
10729
- if (popper.left > f(reference.right)) {
10730
- data.offsets.popper.left = f(reference.right);
10731
- }
10732
- if (popper.bottom < f(reference.top)) {
10733
- data.offsets.popper.top = f(reference.top) - popper.height;
10734
- }
10735
- if (popper.top > f(reference.bottom)) {
10736
- data.offsets.popper.top = f(reference.bottom);
10737
- }
10738
-
10739
- return data;
10740
- };
10741
-
10636
+ */
10637
+ Popper.prototype.modifiers.keepTogether = function (data) {
10638
+ var popper = getPopperClientRect(data.offsets.popper);
10639
+ var reference = data.offsets.reference;
10640
+ var f = Math.floor;
10641
+
10642
+ if (popper.right < f(reference.left)) {
10643
+ data.offsets.popper.left = f(reference.left) - popper.width;
10644
+ }
10645
+ if (popper.left > f(reference.right)) {
10646
+ data.offsets.popper.left = f(reference.right);
10647
+ }
10648
+ if (popper.bottom < f(reference.top)) {
10649
+ data.offsets.popper.top = f(reference.top) - popper.height;
10650
+ }
10651
+ if (popper.top > f(reference.bottom)) {
10652
+ data.offsets.popper.top = f(reference.bottom);
10653
+ }
10654
+
10655
+ return data;
10656
+ };
10657
+
10742
10658
  /**
10743
10659
  * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
10744
10660
  * Requires the `preventOverflow` modifier before it in order to work.
@@ -10747,81 +10663,61 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10747
10663
  * @memberof Popper.modifiers
10748
10664
  * @argument {Object} data - The data object generated by _update method
10749
10665
  * @returns {Object} The data object, properly modified
10750
- */
10751
- Popper.prototype.modifiers.flip = function (data) {
10752
- // check if preventOverflow is in the list of modifiers before the flip modifier.
10753
- // otherwise flip would not work as expected.
10754
- if (
10755
- !this.isModifierRequired(
10756
- this.modifiers.flip,
10757
- this.modifiers.preventOverflow
10758
- )
10759
- ) {
10760
- console.warn(
10761
- 'WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!'
10762
- );
10763
- return data;
10764
- }
10765
-
10766
- if (data.flipped && data.placement === data._originalPlacement) {
10767
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
10768
- return data;
10769
- }
10770
-
10771
- var placement = data.placement.split('-')[0];
10772
- var placementOpposite = getOppositePlacement(placement);
10773
- var variation = data.placement.split('-')[1] || '';
10774
-
10775
- var flipOrder = [];
10776
- if (this._options.flipBehavior === 'flip') {
10777
- flipOrder = [placement, placementOpposite];
10778
- } else {
10779
- flipOrder = this._options.flipBehavior;
10780
- }
10781
-
10782
- flipOrder.forEach(
10783
- function (step, index) {
10784
- if (placement !== step || flipOrder.length === index + 1) {
10785
- return;
10786
- }
10787
-
10788
- placement = data.placement.split('-')[0];
10789
- placementOpposite = getOppositePlacement(placement);
10790
-
10791
- var popperOffsets = getPopperClientRect(data.offsets.popper);
10792
-
10793
- // this boolean is used to distinguish right and bottom from top and left
10794
- // they need different computations to get flipped
10795
- var a = ['right', 'bottom'].indexOf(placement) !== -1;
10796
-
10797
- // using Math.floor because the reference offsets may contain decimals we are not going to consider here
10798
- if (
10799
- (a &&
10800
- Math.floor(data.offsets.reference[placement]) >
10801
- Math.floor(popperOffsets[placementOpposite])) ||
10802
- (!a &&
10803
- Math.floor(data.offsets.reference[placement]) <
10804
- Math.floor(popperOffsets[placementOpposite]))
10805
- ) {
10806
- // we'll use this boolean to detect any flip loop
10807
- data.flipped = true;
10808
- data.placement = flipOrder[index + 1];
10809
- if (variation) {
10810
- data.placement += '-' + variation;
10811
- }
10812
- data.offsets.popper = this._getOffsets(
10813
- this._popper,
10814
- this._reference,
10815
- data.placement
10816
- ).popper;
10817
-
10818
- data = this.runModifiers(data, this._options.modifiers, this._flip);
10819
- }
10820
- }.bind(this)
10821
- );
10822
- return data;
10823
- };
10824
-
10666
+ */
10667
+ Popper.prototype.modifiers.flip = function (data) {
10668
+ // check if preventOverflow is in the list of modifiers before the flip modifier.
10669
+ // otherwise flip would not work as expected.
10670
+ if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
10671
+ console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
10672
+ return data;
10673
+ }
10674
+
10675
+ if (data.flipped && data.placement === data._originalPlacement) {
10676
+ // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
10677
+ return data;
10678
+ }
10679
+
10680
+ var placement = data.placement.split('-')[0];
10681
+ var placementOpposite = getOppositePlacement(placement);
10682
+ var variation = data.placement.split('-')[1] || '';
10683
+
10684
+ var flipOrder = [];
10685
+ if (this._options.flipBehavior === 'flip') {
10686
+ flipOrder = [placement, placementOpposite];
10687
+ } else {
10688
+ flipOrder = this._options.flipBehavior;
10689
+ }
10690
+
10691
+ flipOrder.forEach(function (step, index) {
10692
+ if (placement !== step || flipOrder.length === index + 1) {
10693
+ return;
10694
+ }
10695
+
10696
+ placement = data.placement.split('-')[0];
10697
+ placementOpposite = getOppositePlacement(placement);
10698
+
10699
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
10700
+
10701
+ // this boolean is used to distinguish right and bottom from top and left
10702
+ // they need different computations to get flipped
10703
+ var a = ['right', 'bottom'].indexOf(placement) !== -1;
10704
+
10705
+ // using Math.floor because the reference offsets may contain decimals we are not going to consider here
10706
+ if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
10707
+ // we'll use this boolean to detect any flip loop
10708
+ data.flipped = true;
10709
+ data.placement = flipOrder[index + 1];
10710
+ if (variation) {
10711
+ data.placement += '-' + variation;
10712
+ }
10713
+ data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
10714
+
10715
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
10716
+ }
10717
+ }.bind(this));
10718
+ return data;
10719
+ };
10720
+
10825
10721
  /**
10826
10722
  * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
10827
10723
  * The offsets will shift the popper on the side of its reference element.
@@ -10829,23 +10725,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10829
10725
  * @memberof Popper.modifiers
10830
10726
  * @argument {Object} data - The data object generated by _update method
10831
10727
  * @returns {Object} The data object, properly modified
10832
- */
10833
- Popper.prototype.modifiers.offset = function (data) {
10834
- var offset = this._options.offset;
10835
- var popper = data.offsets.popper;
10836
-
10837
- if (data.placement.indexOf('left') !== -1) {
10838
- popper.top -= offset;
10839
- } else if (data.placement.indexOf('right') !== -1) {
10840
- popper.top += offset;
10841
- } else if (data.placement.indexOf('top') !== -1) {
10842
- popper.left -= offset;
10843
- } else if (data.placement.indexOf('bottom') !== -1) {
10844
- popper.left += offset;
10845
- }
10846
- return data;
10847
- };
10848
-
10728
+ */
10729
+ Popper.prototype.modifiers.offset = function (data) {
10730
+ var offset = this._options.offset;
10731
+ var popper = data.offsets.popper;
10732
+
10733
+ if (data.placement.indexOf('left') !== -1) {
10734
+ popper.top -= offset;
10735
+ } else if (data.placement.indexOf('right') !== -1) {
10736
+ popper.top += offset;
10737
+ } else if (data.placement.indexOf('top') !== -1) {
10738
+ popper.left -= offset;
10739
+ } else if (data.placement.indexOf('bottom') !== -1) {
10740
+ popper.left += offset;
10741
+ }
10742
+ return data;
10743
+ };
10744
+
10849
10745
  /**
10850
10746
  * 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
10851
10747
  * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
@@ -10853,147 +10749,136 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
10853
10749
  * @memberof Popper.modifiers
10854
10750
  * @argument {Object} data - The data object generated by _update method
10855
10751
  * @returns {Object} The data object, properly modified
10856
- */
10857
- Popper.prototype.modifiers.arrow = function (data) {
10858
- var arrow = this._options.arrowElement;
10859
- var arrowOffset = this._options.arrowOffset;
10860
-
10861
- // if the arrowElement is a string, suppose it's a CSS selector
10862
- if (typeof arrow === 'string') {
10863
- arrow = this._popper.querySelector(arrow);
10864
- }
10865
-
10866
- // if arrow element is not found, don't run the modifier
10867
- if (!arrow) {
10868
- return data;
10869
- }
10870
-
10871
- // the arrow element must be child of its popper
10872
- if (!this._popper.contains(arrow)) {
10873
- console.warn(
10874
- 'WARNING: `arrowElement` must be child of its popper element!'
10875
- );
10876
- return data;
10877
- }
10878
-
10879
- // arrow depends on keepTogether in order to work
10880
- if (
10881
- !this.isModifierRequired(
10882
- this.modifiers.arrow,
10883
- this.modifiers.keepTogether
10884
- )
10885
- ) {
10886
- console.warn(
10887
- 'WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!'
10888
- );
10889
- return data;
10890
- }
10891
-
10892
- var arrowStyle = {};
10893
- var placement = data.placement.split('-')[0];
10894
- var popper = getPopperClientRect(data.offsets.popper);
10895
- var reference = data.offsets.reference;
10896
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
10897
-
10898
- var len = isVertical ? 'height' : 'width';
10899
- var side = isVertical ? 'top' : 'left';
10900
- var translate = isVertical ? 'translateY' : 'translateX';
10901
- var altSide = isVertical ? 'left' : 'top';
10902
- var opSide = isVertical ? 'bottom' : 'right';
10903
- var arrowSize = getOuterSizes(arrow)[len];
10904
-
10905
- //
10906
- // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
10907
- //
10908
-
10909
- // top/left side
10910
- if (reference[opSide] - arrowSize < popper[side]) {
10911
- data.offsets.popper[side] -=
10912
- popper[side] - (reference[opSide] - arrowSize);
10913
- }
10914
- // bottom/right side
10915
- if (reference[side] + arrowSize > popper[opSide]) {
10916
- data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
10917
- }
10918
-
10919
- // compute center of the popper
10920
- var center =
10921
- reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
10922
-
10923
- var sideValue = center - popper[side];
10924
-
10925
- // prevent arrow from being placed not contiguously to its popper
10926
- sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
10927
- arrowStyle[side] = sideValue;
10928
- arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
10929
-
10930
- data.offsets.arrow = arrowStyle;
10931
- data.arrowElement = arrow;
10932
-
10933
- return data;
10934
- };
10935
-
10936
- //
10937
- // Helpers
10938
- //
10939
-
10752
+ */
10753
+ Popper.prototype.modifiers.arrow = function (data) {
10754
+ var arrow = this._options.arrowElement;
10755
+ var arrowOffset = this._options.arrowOffset;
10756
+
10757
+ // if the arrowElement is a string, suppose it's a CSS selector
10758
+ if (typeof arrow === 'string') {
10759
+ arrow = this._popper.querySelector(arrow);
10760
+ }
10761
+
10762
+ // if arrow element is not found, don't run the modifier
10763
+ if (!arrow) {
10764
+ return data;
10765
+ }
10766
+
10767
+ // the arrow element must be child of its popper
10768
+ if (!this._popper.contains(arrow)) {
10769
+ console.warn('WARNING: `arrowElement` must be child of its popper element!');
10770
+ return data;
10771
+ }
10772
+
10773
+ // arrow depends on keepTogether in order to work
10774
+ if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
10775
+ console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
10776
+ return data;
10777
+ }
10778
+
10779
+ var arrowStyle = {};
10780
+ var placement = data.placement.split('-')[0];
10781
+ var popper = getPopperClientRect(data.offsets.popper);
10782
+ var reference = data.offsets.reference;
10783
+ var isVertical = ['left', 'right'].indexOf(placement) !== -1;
10784
+
10785
+ var len = isVertical ? 'height' : 'width';
10786
+ var side = isVertical ? 'top' : 'left';
10787
+ var translate = isVertical ? 'translateY' : 'translateX';
10788
+ var altSide = isVertical ? 'left' : 'top';
10789
+ var opSide = isVertical ? 'bottom' : 'right';
10790
+ var arrowSize = getOuterSizes(arrow)[len];
10791
+
10792
+ //
10793
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
10794
+ //
10795
+
10796
+ // top/left side
10797
+ if (reference[opSide] - arrowSize < popper[side]) {
10798
+ data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
10799
+ }
10800
+ // bottom/right side
10801
+ if (reference[side] + arrowSize > popper[opSide]) {
10802
+ data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
10803
+ }
10804
+
10805
+ // compute center of the popper
10806
+ var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
10807
+
10808
+ var sideValue = center - popper[side];
10809
+
10810
+ // prevent arrow from being placed not contiguously to its popper
10811
+ sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
10812
+ arrowStyle[side] = sideValue;
10813
+ arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
10814
+
10815
+ data.offsets.arrow = arrowStyle;
10816
+ data.arrowElement = arrow;
10817
+
10818
+ return data;
10819
+ };
10820
+
10821
+ //
10822
+ // Helpers
10823
+ //
10824
+
10940
10825
  /**
10941
10826
  * Get the outer sizes of the given element (offset size + margins)
10942
10827
  * @function
10943
10828
  * @ignore
10944
10829
  * @argument {Element} element
10945
10830
  * @returns {Object} object containing width and height properties
10946
- */
10947
- function getOuterSizes(element) {
10948
- // NOTE: 1 DOM access here
10949
- var _display = element.style.display,
10950
- _visibility = element.style.visibility;
10951
- element.style.display = 'block';
10952
- element.style.visibility = 'hidden';
10953
- var calcWidthToForceRepaint = element.offsetWidth;
10954
- // original method
10955
- var styles = getRealWindow(element).getComputedStyle(element);
10956
- var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
10957
- var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
10958
- var result = {
10959
- width: element.offsetWidth + y,
10960
- height: element.offsetHeight + x
10961
- };
10962
-
10963
- // reset element styles
10964
- element.style.display = _display;
10965
- element.style.visibility = _visibility;
10966
- return result;
10967
- }
10968
-
10831
+ */
10832
+ function getOuterSizes(element) {
10833
+ // NOTE: 1 DOM access here
10834
+ var _display = element.style.display,
10835
+ _visibility = element.style.visibility;
10836
+ element.style.display = 'block';
10837
+ element.style.visibility = 'hidden';
10838
+ var calcWidthToForceRepaint = element.offsetWidth;
10839
+ // original method
10840
+ var styles = getRealWindow(element).getComputedStyle(element);
10841
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
10842
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
10843
+ var result = {
10844
+ width: element.offsetWidth + y,
10845
+ height: element.offsetHeight + x
10846
+ };
10847
+
10848
+ // reset element styles
10849
+ element.style.display = _display;
10850
+ element.style.visibility = _visibility;
10851
+ return result;
10852
+ }
10853
+
10969
10854
  /**
10970
10855
  * Get the opposite placement of the given one/
10971
10856
  * @function
10972
10857
  * @ignore
10973
10858
  * @argument {String} placement
10974
10859
  * @returns {String} flipped placement
10975
- */
10976
- function getOppositePlacement(placement) {
10977
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
10978
- return placement.replace(/left|right|bottom|top/g, function (matched) {
10979
- return hash[matched];
10980
- });
10981
- }
10982
-
10860
+ */
10861
+ function getOppositePlacement(placement) {
10862
+ var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
10863
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
10864
+ return hash[matched];
10865
+ });
10866
+ }
10867
+
10983
10868
  /**
10984
10869
  * Given the popper offsets, generate an output similar to getBoundingClientRect
10985
10870
  * @function
10986
10871
  * @ignore
10987
10872
  * @argument {Object} popperOffsets
10988
10873
  * @returns {Object} ClientRect like output
10989
- */
10990
- function getPopperClientRect(popperOffsets) {
10991
- var offsets = Object.assign({}, popperOffsets);
10992
- offsets.right = offsets.left + offsets.width;
10993
- offsets.bottom = offsets.top + offsets.height;
10994
- return offsets;
10995
- }
10996
-
10874
+ */
10875
+ function getPopperClientRect(popperOffsets) {
10876
+ var offsets = Object.assign({}, popperOffsets);
10877
+ offsets.right = offsets.left + offsets.width;
10878
+ offsets.bottom = offsets.top + offsets.height;
10879
+ return offsets;
10880
+ }
10881
+
10997
10882
  /**
10998
10883
  * Given an array and the key to find, returns its index
10999
10884
  * @function
@@ -11001,48 +10886,46 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
11001
10886
  * @argument {Array} arr
11002
10887
  * @argument keyToFind
11003
10888
  * @returns index or null
11004
- */
11005
- function getArrayKeyIndex(arr, keyToFind) {
11006
- var i = 0,
11007
- key;
11008
- for (key in arr) {
11009
- if (arr[key] === keyToFind) {
11010
- return i;
11011
- }
11012
- i++;
11013
- }
11014
- return null;
11015
- }
11016
-
10889
+ */
10890
+ function getArrayKeyIndex(arr, keyToFind) {
10891
+ var i = 0,
10892
+ key;
10893
+ for (key in arr) {
10894
+ if (arr[key] === keyToFind) {
10895
+ return i;
10896
+ }
10897
+ i++;
10898
+ }
10899
+ return null;
10900
+ }
10901
+
11017
10902
  /**
11018
10903
  * Get CSS computed property of the given element
11019
10904
  * @function
11020
10905
  * @ignore
11021
10906
  * @argument {Eement} element
11022
10907
  * @argument {String} property
11023
- */
11024
- function getStyleComputedProperty(element, property) {
11025
- // NOTE: 1 DOM access here
11026
- // 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
11027
- // 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
11028
- var css = getRealWindow(element).getComputedStyle(element, null);
11029
- return css[property];
11030
- }
11031
-
10908
+ */
10909
+ function getStyleComputedProperty(element, property) {
10910
+ // NOTE: 1 DOM access here
10911
+ // 无界等微前端场景下沙箱 window 与元素实际渲染所在 window 可能不一致,
10912
+ // 需使用元素自身的 view 读取计算样式,避免跨 document 读取到空值
10913
+ var css = getRealWindow(element).getComputedStyle(element, null);
10914
+ return css[property];
10915
+ }
10916
+
11032
10917
  /**
11033
10918
  * Returns the offset parent of the given element
11034
10919
  * @function
11035
10920
  * @ignore
11036
10921
  * @argument {Element} element
11037
10922
  * @returns {Element} offset parent
11038
- */
11039
- function getOffsetParent(element) {
11040
- var offsetParent = element.offsetParent;
11041
- return offsetParent === root.document.body || !offsetParent
11042
- ? root.document.documentElement
11043
- : offsetParent;
11044
- }
11045
-
10923
+ */
10924
+ function getOffsetParent(element) {
10925
+ var offsetParent = element.offsetParent;
10926
+ return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
10927
+ }
10928
+
11046
10929
  /**
11047
10930
  * Returns the window the given element actually renders in.
11048
10931
  * 无界等微前端场景下组件代码运行在沙箱 window 中,而 DOM 实际渲染在
@@ -11051,16 +10934,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
11051
10934
  * @ignore
11052
10935
  * @argument {Element} element
11053
10936
  * @returns {Window} window
11054
- */
11055
- function getRealWindow(element) {
11056
- return (
11057
- (element &&
11058
- element.ownerDocument &&
11059
- element.ownerDocument.defaultView) ||
11060
- root
11061
- );
11062
- }
11063
-
10937
+ */
10938
+ function getRealWindow(element) {
10939
+ return element && element.ownerDocument && element.ownerDocument.defaultView || root;
10940
+ }
10941
+
11064
10942
  /**
11065
10943
  * Returns the viewport rect of the containing block actually used to position the popper.
11066
10944
  * 无界微前端等场景下 popper 被挂载进子应用的 shadowRoot,offsetParent 的兜底值
@@ -11074,82 +10952,72 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
11074
10952
  * @argument {Element} element - popper element
11075
10953
  * @argument {Boolean} fixed - whether the popper is fixed positioned
11076
10954
  * @returns {Object} rect
11077
- */
11078
- function getContainingBlockRect(element, fixed) {
11079
- if (fixed) {
11080
- return { top: 0, left: 0, right: 0, bottom: 0 };
11081
- }
11082
-
11083
- var node = element.parentNode;
11084
- while (node) {
11085
- if (node.nodeType === 1) {
11086
- if (getStyleComputedProperty(node, 'position') !== 'static') {
11087
- return getBoundingClientRect(node);
11088
- }
11089
- } else if (node.nodeType === 11) {
11090
- // 遇到 shadowRoot,跨边界从宿主元素继续向上查找
11091
- node = node.host;
11092
- continue;
11093
- } else {
11094
- break;
11095
- }
11096
- node = node.parentNode;
11097
- }
11098
-
11099
- var win = getRealWindow(element);
11100
- return {
11101
- top: -(win.pageYOffset || 0),
11102
- left: -(win.pageXOffset || 0),
11103
- right: 0,
11104
- bottom: 0
11105
- };
11106
- }
11107
-
10955
+ */
10956
+ function getContainingBlockRect(element, fixed) {
10957
+ if (fixed) {
10958
+ return { top: 0, left: 0, right: 0, bottom: 0 };
10959
+ }
10960
+
10961
+ var node = element.parentNode;
10962
+ while (node) {
10963
+ if (node.nodeType === 1) {
10964
+ if (getStyleComputedProperty(node, 'position') !== 'static') {
10965
+ return getBoundingClientRect(node);
10966
+ }
10967
+ } else if (node.nodeType === 11) {
10968
+ // 遇到 shadowRoot,跨边界从宿主元素继续向上查找
10969
+ node = node.host;
10970
+ continue;
10971
+ } else {
10972
+ break;
10973
+ }
10974
+ node = node.parentNode;
10975
+ }
10976
+
10977
+ var win = getRealWindow(element);
10978
+ return {
10979
+ top: -(win.pageYOffset || 0),
10980
+ left: -(win.pageXOffset || 0),
10981
+ right: 0,
10982
+ bottom: 0
10983
+ };
10984
+ }
10985
+
11108
10986
  /**
11109
10987
  * Returns the scrolling parent of the given element
11110
10988
  * @function
11111
10989
  * @ignore
11112
10990
  * @argument {Element} element
11113
10991
  * @returns {Element} offset parent
11114
- */
11115
- function getScrollParent(element) {
11116
- var parent = element.parentNode;
11117
- if (!parent) {
11118
- return element;
11119
- }
11120
-
11121
- if (parent.nodeType === 11) {
11122
- // 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
11123
- // 否则查找到 shadowRoot 即终止,滚动事件无法被监听
11124
- return getScrollParent(parent.host);
11125
- }
11126
-
11127
- if (parent.nodeType !== 1) {
11128
- // 到达 document,返回元素实际渲染所在的真实 window,
11129
- // 保证 window 滚动时能触发位置更新
11130
- return getRealWindow(element);
11131
- }
11132
-
11133
- // Firefox want us to check `-x` and `-y` variations as well
11134
- if (
11135
- ['scroll', 'auto'].indexOf(
11136
- getStyleComputedProperty(parent, 'overflow')
11137
- ) !== -1 ||
11138
- ['scroll', 'auto'].indexOf(
11139
- getStyleComputedProperty(parent, 'overflow-x')
11140
- ) !== -1 ||
11141
- ['scroll', 'auto'].indexOf(
11142
- getStyleComputedProperty(parent, 'overflow-y')
11143
- ) !== -1
11144
- ) {
11145
- // If the detected scrollParent is body, we perform an additional check on its parentNode
11146
- // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
11147
- // fixes issue #65
11148
- return parent;
11149
- }
11150
- return getScrollParent(parent);
11151
- }
11152
-
10992
+ */
10993
+ function getScrollParent(element) {
10994
+ var parent = element.parentNode;
10995
+ if (!parent) {
10996
+ return element;
10997
+ }
10998
+
10999
+ if (parent.nodeType === 11) {
11000
+ // 无界等微前端场景 DOM 位于 shadowRoot 内,需跨边界从宿主元素继续向上查找,
11001
+ // 否则查找到 shadowRoot 即终止,滚动事件无法被监听
11002
+ return getScrollParent(parent.host);
11003
+ }
11004
+
11005
+ if (parent.nodeType !== 1) {
11006
+ // 到达 document,返回元素实际渲染所在的真实 window,
11007
+ // 保证 window 滚动时能触发位置更新
11008
+ return getRealWindow(element);
11009
+ }
11010
+
11011
+ // Firefox want us to check `-x` and `-y` variations as well
11012
+ if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
11013
+ // If the detected scrollParent is body, we perform an additional check on its parentNode
11014
+ // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
11015
+ // fixes issue #65
11016
+ return parent;
11017
+ }
11018
+ return getScrollParent(parent);
11019
+ }
11020
+
11153
11021
  /**
11154
11022
  * Check if the given element is fixed or is inside a fixed parent
11155
11023
  * @function
@@ -11157,125 +11025,114 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
11157
11025
  * @argument {Element} element
11158
11026
  * @argument {Element} customContainer
11159
11027
  * @returns {Boolean} answer to "isFixed?"
11160
- */
11161
- function isFixed(element) {
11162
- if (element === root.document.body) {
11163
- return false;
11164
- }
11165
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
11166
- return true;
11167
- }
11168
- var parent = element.parentNode;
11169
- if (parent && parent.nodeType === 11) {
11170
- // 跨 shadowRoot 边界,从宿主元素继续向上判断
11171
- parent = parent.host;
11172
- }
11173
- return parent && parent.nodeType === 1 ? isFixed(parent) : false;
11174
- }
11175
-
11028
+ */
11029
+ function isFixed(element) {
11030
+ if (element === root.document.body) {
11031
+ return false;
11032
+ }
11033
+ if (getStyleComputedProperty(element, 'position') === 'fixed') {
11034
+ return true;
11035
+ }
11036
+ var parent = element.parentNode;
11037
+ if (parent && parent.nodeType === 11) {
11038
+ // 跨 shadowRoot 边界,从宿主元素继续向上判断
11039
+ parent = parent.host;
11040
+ }
11041
+ return parent && parent.nodeType === 1 ? isFixed(parent) : false;
11042
+ }
11043
+
11176
11044
  /**
11177
11045
  * Set the style to the given popper
11178
11046
  * @function
11179
11047
  * @ignore
11180
11048
  * @argument {Element} element - Element to apply the style to
11181
11049
  * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
11182
- */
11183
- function setStyle(element, styles) {
11184
- function is_numeric(n) {
11185
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
11186
- }
11187
- Object.keys(styles).forEach(function (prop) {
11188
- var unit = '';
11189
- // add unit if the value is numeric and is one of the following
11190
- if (
11191
- ['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==
11192
- -1 &&
11193
- is_numeric(styles[prop])
11194
- ) {
11195
- unit = 'px';
11196
- }
11197
- element.style[prop] = styles[prop] + unit;
11198
- });
11199
- }
11200
-
11050
+ */
11051
+ function setStyle(element, styles) {
11052
+ function is_numeric(n) {
11053
+ return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
11054
+ }
11055
+ Object.keys(styles).forEach(function (prop) {
11056
+ var unit = '';
11057
+ // add unit if the value is numeric and is one of the following
11058
+ if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
11059
+ unit = 'px';
11060
+ }
11061
+ element.style[prop] = styles[prop] + unit;
11062
+ });
11063
+ }
11064
+
11201
11065
  /**
11202
11066
  * Check if the given variable is a function
11203
11067
  * @function
11204
11068
  * @ignore
11205
11069
  * @argument {*} functionToCheck - variable to check
11206
11070
  * @returns {Boolean} answer to: is a function?
11207
- */
11208
- function isFunction(functionToCheck) {
11209
- var getType = {};
11210
- return (
11211
- functionToCheck &&
11212
- getType.toString.call(functionToCheck) === '[object Function]'
11213
- );
11214
- }
11215
-
11071
+ */
11072
+ function isFunction(functionToCheck) {
11073
+ var getType = {};
11074
+ return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
11075
+ }
11076
+
11216
11077
  /**
11217
11078
  * Get the position of the given element, relative to its offset parent
11218
11079
  * @function
11219
11080
  * @ignore
11220
11081
  * @param {Element} element
11221
11082
  * @return {Object} position - Coordinates of the element and its `scrollTop`
11222
- */
11223
- function getOffsetRect(element) {
11224
- var transform = getStyle(element, 'transform')
11225
- .replace(/[^0-9\-,]/g, '')
11226
- .split(',');
11227
- var elementRect = {
11228
- width: element.offsetWidth,
11229
- height: element.offsetHeight,
11230
- left:
11231
- element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
11232
- top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
11233
- };
11234
-
11235
- elementRect.right = elementRect.left + elementRect.width;
11236
- elementRect.bottom = elementRect.top + elementRect.height;
11237
-
11238
- // position
11239
- return elementRect;
11240
- }
11241
-
11083
+ */
11084
+ function getOffsetRect(element) {
11085
+ var transform = getStyle(element, 'transform').replace(/[^0-9\-,]/g, '').split(',');
11086
+ var elementRect = {
11087
+ width: element.offsetWidth,
11088
+ height: element.offsetHeight,
11089
+ left: element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
11090
+ top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
11091
+ };
11092
+
11093
+ elementRect.right = elementRect.left + elementRect.width;
11094
+ elementRect.bottom = elementRect.top + elementRect.height;
11095
+
11096
+ // position
11097
+ return elementRect;
11098
+ }
11099
+
11242
11100
  /**
11243
11101
  * Get bounding client rect of given element
11244
11102
  * @function
11245
11103
  * @ignore
11246
11104
  * @param {HTMLElement} element
11247
11105
  * @return {Object} client rect
11248
- */
11249
- function getBoundingClientRect(element) {
11250
- var rect = element.getBoundingClientRect();
11251
-
11252
- // whether the IE version is lower than 11
11253
- var isIE = /MSIE|Trident/.test(navigator.userAgent);
11254
-
11255
- // fix ie document bounding top always 0 bug
11256
- var rectTop =
11257
- isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
11258
-
11259
- return {
11260
- left: rect.left,
11261
- top: rectTop,
11262
- right: rect.right,
11263
- bottom: rect.bottom,
11264
- width: rect.right - rect.left,
11265
- height: rect.bottom - rectTop
11266
- };
11267
- }
11268
-
11269
- function getStyle(dom, attr) {
11270
- if (dom.style[attr]) {
11271
- return dom.style[attr];
11272
- }
11273
- if (window.getComputedStyle) {
11274
- return getComputedStyle(dom, null)[attr];
11275
- }
11276
- return dom.currentStyle[attr];
11277
- }
11278
-
11106
+ */
11107
+ function getBoundingClientRect(element) {
11108
+ var rect = element.getBoundingClientRect();
11109
+
11110
+ // whether the IE version is lower than 11
11111
+ var isIE = /MSIE|Trident/.test(navigator.userAgent);
11112
+
11113
+ // fix ie document bounding top always 0 bug
11114
+ var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
11115
+
11116
+ return {
11117
+ left: rect.left,
11118
+ top: rectTop,
11119
+ right: rect.right,
11120
+ bottom: rect.bottom,
11121
+ width: rect.right - rect.left,
11122
+ height: rect.bottom - rectTop
11123
+ };
11124
+ }
11125
+
11126
+ function getStyle(dom, attr) {
11127
+ if (dom.style[attr]) {
11128
+ return dom.style[attr];
11129
+ }
11130
+ if (window.getComputedStyle) {
11131
+ return getComputedStyle(dom, null)[attr];
11132
+ }
11133
+ return dom.currentStyle[attr];
11134
+ }
11135
+
11279
11136
  /**
11280
11137
  * Given an element and one of its parents, return the offset
11281
11138
  * @function
@@ -11283,45 +11140,43 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
11283
11140
  * @param {HTMLElement} element
11284
11141
  * @param {HTMLElement} parent
11285
11142
  * @return {Object} rect
11286
- */
11287
- function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
11288
- var elementRect = getBoundingClientRect(element);
11289
- // parent 为 popper 元素:取其真实包含块的视口 rect,
11290
- // 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
11291
- var parentRect = getContainingBlockRect(parent, fixed);
11292
-
11293
- var rect = {
11294
- top: elementRect.top - parentRect.top,
11295
- left: elementRect.left - parentRect.left,
11296
- bottom: elementRect.top - parentRect.top + elementRect.height,
11297
- right: elementRect.left - parentRect.left + elementRect.width,
11298
- width: elementRect.width,
11299
- height: elementRect.height
11300
- };
11301
- return rect;
11302
- }
11303
-
11143
+ */
11144
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
11145
+ var elementRect = getBoundingClientRect(element);
11146
+ // parent 为 popper 元素:取其真实包含块的视口 rect,
11147
+ // 避免无界 shadowRoot 等场景下包含块假设错误导致的整体偏移
11148
+ var parentRect = getContainingBlockRect(parent, fixed);
11149
+
11150
+ var rect = {
11151
+ top: elementRect.top - parentRect.top,
11152
+ left: elementRect.left - parentRect.left,
11153
+ bottom: elementRect.top - parentRect.top + elementRect.height,
11154
+ right: elementRect.left - parentRect.left + elementRect.width,
11155
+ width: elementRect.width,
11156
+ height: elementRect.height
11157
+ };
11158
+ return rect;
11159
+ }
11160
+
11304
11161
  /**
11305
11162
  * Get the prefixed supported property name
11306
11163
  * @function
11307
11164
  * @ignore
11308
11165
  * @argument {String} property (camelCase)
11309
11166
  * @returns {String} prefixed property (camelCase)
11310
- */
11311
- function getSupportedPropertyName(property) {
11312
- var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
11313
-
11314
- for (var i = 0; i < prefixes.length; i++) {
11315
- var toCheck = prefixes[i]
11316
- ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1)
11317
- : property;
11318
- if (typeof root.document.body.style[toCheck] !== 'undefined') {
11319
- return toCheck;
11320
- }
11321
- }
11322
- return null;
11323
- }
11324
-
11167
+ */
11168
+ function getSupportedPropertyName(property) {
11169
+ var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
11170
+
11171
+ for (var i = 0; i < prefixes.length; i++) {
11172
+ var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
11173
+ if (typeof root.document.body.style[toCheck] !== 'undefined') {
11174
+ return toCheck;
11175
+ }
11176
+ }
11177
+ return null;
11178
+ }
11179
+
11325
11180
  /**
11326
11181
  * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
11327
11182
  * objects to a target object. It will return the target object.
@@ -11329,46 +11184,41 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
11329
11184
  * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
11330
11185
  * @function
11331
11186
  * @ignore
11332
- */
11333
- if (!Object.assign) {
11334
- Object.defineProperty(Object, 'assign', {
11335
- enumerable: false,
11336
- configurable: true,
11337
- writable: true,
11338
- value: function (target) {
11339
- if (target === undefined || target === null) {
11340
- throw new TypeError('Cannot convert first argument to object');
11341
- }
11342
-
11343
- var to = Object(target);
11344
- for (var i = 1; i < arguments.length; i++) {
11345
- var nextSource = arguments[i];
11346
- if (nextSource === undefined || nextSource === null) {
11347
- continue;
11348
- }
11349
- nextSource = Object(nextSource);
11350
-
11351
- var keysArray = Object.keys(nextSource);
11352
- for (
11353
- var nextIndex = 0, len = keysArray.length;
11354
- nextIndex < len;
11355
- nextIndex++
11356
- ) {
11357
- var nextKey = keysArray[nextIndex];
11358
- var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
11359
- if (desc !== undefined && desc.enumerable) {
11360
- to[nextKey] = nextSource[nextKey];
11361
- }
11362
- }
11363
- }
11364
- return to;
11365
- }
11366
- });
11367
- }
11368
-
11369
- return Popper;
11370
- });
11187
+ */
11188
+ if (!Object.assign) {
11189
+ Object.defineProperty(Object, 'assign', {
11190
+ enumerable: false,
11191
+ configurable: true,
11192
+ writable: true,
11193
+ value: function value(target) {
11194
+ if (target === undefined || target === null) {
11195
+ throw new TypeError('Cannot convert first argument to object');
11196
+ }
11197
+
11198
+ var to = Object(target);
11199
+ for (var i = 1; i < arguments.length; i++) {
11200
+ var nextSource = arguments[i];
11201
+ if (nextSource === undefined || nextSource === null) {
11202
+ continue;
11203
+ }
11204
+ nextSource = Object(nextSource);
11205
+
11206
+ var keysArray = Object.keys(nextSource);
11207
+ for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
11208
+ var nextKey = keysArray[nextIndex];
11209
+ var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
11210
+ if (desc !== undefined && desc.enumerable) {
11211
+ to[nextKey] = nextSource[nextKey];
11212
+ }
11213
+ }
11214
+ }
11215
+ return to;
11216
+ }
11217
+ });
11218
+ }
11371
11219
 
11220
+ return Popper;
11221
+ });
11372
11222
 
11373
11223
  /***/ }),
11374
11224
 
@@ -11945,7 +11795,7 @@ var changeInTime = '/baseIssueRules/changeInTime';
11945
11795
 
11946
11796
  /***/ }),
11947
11797
 
11948
- /***/ 68:
11798
+ /***/ 69:
11949
11799
  /***/ (function(module, exports) {
11950
11800
 
11951
11801
  module.exports = require("eoss/lib/tag");
@@ -12002,759 +11852,736 @@ module.exports = require("eoss/lib/tag");
12002
11852
  /* unused harmony export getSecond */
12003
11853
  /* unused harmony export getWeekday */
12004
11854
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
12005
- /* Modified from https://github.com/taylorhakes/fecha
12006
- *
12007
- * The MIT License (MIT)
12008
- *
12009
- * Copyright (c) 2015 Taylor Hakes
12010
- *
12011
- * Permission is hereby granted, free of charge, to any person obtaining a copy
12012
- * of this software and associated documentation files (the "Software"), to deal
12013
- * in the Software without restriction, including without limitation the rights
12014
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12015
- * copies of the Software, and to permit persons to whom the Software is
12016
- * furnished to do so, subject to the following conditions:
12017
- *
12018
- * The above copyright notice and this permission notice shall be included in all
12019
- * copies or substantial portions of the Software.
12020
- *
12021
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12022
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12023
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12024
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12025
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12026
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12027
- * SOFTWARE.
12028
- */
12029
-
12030
- /*eslint-disable*/
12031
- // 把 YYYY-MM-DD 改成了 yyyy-MM-dd
12032
-
12033
-
11855
+
11856
+
12034
11857
  /**
12035
11858
  * Parse or format dates
12036
11859
  * @class fecha
12037
- */
12038
- const fecha = {};
12039
- const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
12040
- const twoDigits = '\\d\\d?';
12041
- const threeDigits = '\\d{3}';
12042
- const fourDigits = '\\d{4}';
12043
- const word = '[^\\s]+';
12044
- const literal = /\[([^]*?)\]/gm;
12045
- const noop = function () {};
12046
-
12047
- function regexEscape(str) {
12048
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
12049
- }
12050
-
12051
- function shorten(arr, sLen) {
12052
- const newArr = [];
12053
- for (let i = 0, len = arr.length; i < len; i++) {
12054
- newArr.push(arr[i].substr(0, sLen));
12055
- }
12056
- return newArr;
12057
- }
12058
-
12059
- function monthUpdate() {
12060
- return function (d, v) {
12061
- const index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
12062
- if (~index) {
12063
- d.month = index;
12064
- }
12065
- };
12066
- }
12067
-
12068
- function pad(val, len) {
12069
- val = String(val);
12070
- len = len || 2;
12071
- while (val.length < len) {
12072
- val = '0' + val;
12073
- }
12074
- return val;
12075
- }
12076
-
12077
- // 直接使用中文日期名称常量
12078
- const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
12079
- const monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
12080
- const monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
12081
- const dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
12082
- const amPm = ['上午', '下午'];
12083
- const DoFn = function DoFn(D) {
12084
- return D + '日';
12085
- };
12086
-
12087
- const formatFlags = {
12088
- D: function(dateObj) {
12089
- return dateObj.getDay();
12090
- },
12091
- DD: function(dateObj) {
12092
- return pad(dateObj.getDay());
12093
- },
12094
- Do: function(dateObj) {
12095
- return DoFn(dateObj.getDate());
12096
- },
12097
- d: function(dateObj) {
12098
- return dateObj.getDate();
12099
- },
12100
- dd: function(dateObj) {
12101
- return pad(dateObj.getDate());
12102
- },
12103
- ddd: function(dateObj) {
12104
- return dayNamesShort[dateObj.getDay()];
12105
- },
12106
- dddd: function(dateObj) {
12107
- return dayNames[dateObj.getDay()];
12108
- },
12109
- M: function(dateObj) {
12110
- return dateObj.getMonth() + 1;
12111
- },
12112
- MM: function(dateObj) {
12113
- return pad(dateObj.getMonth() + 1);
12114
- },
12115
- MMM: function(dateObj) {
12116
- return monthNamesShort[dateObj.getMonth()];
12117
- },
12118
- MMMM: function(dateObj) {
12119
- return monthNames[dateObj.getMonth()];
12120
- },
12121
- yy: function(dateObj) {
12122
- return pad(String(dateObj.getFullYear()), 4).substr(2);
12123
- },
12124
- yyyy: function(dateObj) {
12125
- return pad(dateObj.getFullYear(), 4);
12126
- },
12127
- h: function(dateObj) {
12128
- return dateObj.getHours() % 12 || 12;
12129
- },
12130
- hh: function(dateObj) {
12131
- return pad(dateObj.getHours() % 12 || 12);
12132
- },
12133
- H: function(dateObj) {
12134
- return dateObj.getHours();
12135
- },
12136
- HH: function(dateObj) {
12137
- return pad(dateObj.getHours());
12138
- },
12139
- m: function(dateObj) {
12140
- return dateObj.getMinutes();
12141
- },
12142
- mm: function(dateObj) {
12143
- return pad(dateObj.getMinutes());
12144
- },
12145
- s: function(dateObj) {
12146
- return dateObj.getSeconds();
12147
- },
12148
- ss: function(dateObj) {
12149
- return pad(dateObj.getSeconds());
12150
- },
12151
- S: function(dateObj) {
12152
- return Math.round(dateObj.getMilliseconds() / 100);
12153
- },
12154
- SS: function(dateObj) {
12155
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
12156
- },
12157
- SSS: function(dateObj) {
12158
- return pad(dateObj.getMilliseconds(), 3);
12159
- },
12160
- a: function(dateObj) {
12161
- return dateObj.getHours() < 12 ? '上午' : '下午';
12162
- },
12163
- A: function(dateObj) {
12164
- return dateObj.getHours() < 12 ? '上午' : '下午';
12165
- },
12166
- ZZ: function(dateObj) {
12167
- const o = dateObj.getTimezoneOffset();
12168
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
12169
- }
12170
- };
12171
-
12172
- const parseFlags = {
12173
- d: [twoDigits, function (d, v) {
12174
- d.day = v;
12175
- }],
12176
- Do: [twoDigits + word, function (d, v) {
12177
- d.day = parseInt(v, 10);
12178
- }],
12179
- M: [twoDigits, function (d, v) {
12180
- d.month = v - 1;
12181
- }],
12182
- yy: [twoDigits, function (d, v) {
12183
- const da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
12184
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
12185
- }],
12186
- h: [twoDigits, function (d, v) {
12187
- d.hour = v;
12188
- }],
12189
- m: [twoDigits, function (d, v) {
12190
- d.minute = v;
12191
- }],
12192
- s: [twoDigits, function (d, v) {
12193
- d.second = v;
12194
- }],
12195
- yyyy: [fourDigits, function (d, v) {
12196
- d.year = v;
12197
- }],
12198
- S: ['\\d', function (d, v) {
12199
- d.millisecond = v * 100;
12200
- }],
12201
- SS: ['\\d{2}', function (d, v) {
12202
- d.millisecond = v * 10;
12203
- }],
12204
- SSS: [threeDigits, function (d, v) {
12205
- d.millisecond = v;
12206
- }],
12207
- D: [twoDigits, noop],
12208
- ddd: [word, noop],
12209
- MMM: [word, monthUpdate('monthNamesShort')],
12210
- MMMM: [word, monthUpdate('monthNames')],
12211
- a: [word, function (d, v) {
12212
- const val = v.toLowerCase();
12213
- if (val === '上午') {
12214
- d.isPm = false;
12215
- } else if (val === '下午') {
12216
- d.isPm = true;
12217
- }
12218
- }],
12219
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
12220
- let parts = (v + '').match(/([+-]|\d\d)/gi), minutes;
12221
-
12222
- if (parts) {
12223
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
12224
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
12225
- }
12226
- }]
12227
- };
12228
- parseFlags.dd = parseFlags.d;
12229
- parseFlags.dddd = parseFlags.ddd;
12230
- parseFlags.DD = parseFlags.D;
12231
- parseFlags.mm = parseFlags.m;
12232
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
12233
- parseFlags.MM = parseFlags.M;
12234
- parseFlags.ss = parseFlags.s;
12235
- parseFlags.A = parseFlags.a;
12236
-
12237
-
12238
- // Some common format strings
12239
- fecha.masks = {
12240
- default: 'ddd MMM dd yyyy HH:mm:ss',
12241
- shortDate: 'M/D/yy',
12242
- mediumDate: 'MMM d, yyyy',
12243
- longDate: 'MMMM d, yyyy',
12244
- fullDate: 'dddd, MMMM d, yyyy',
12245
- shortTime: 'HH:mm',
12246
- mediumTime: 'HH:mm:ss',
12247
- longTime: 'HH:mm:ss.SSS'
12248
- };
12249
-
11860
+ */
11861
+ var fecha = {};
11862
+ var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
11863
+ var twoDigits = '\\d\\d?';
11864
+ var threeDigits = '\\d{3}';
11865
+ var fourDigits = '\\d{4}';
11866
+ var word = '[^\\s]+';
11867
+ var literal = /\[([^]*?)\]/gm;
11868
+ var noop = function noop() {};
11869
+
11870
+ function regexEscape(str) {
11871
+ return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
11872
+ }
11873
+
11874
+ function shorten(arr, sLen) {
11875
+ var newArr = [];
11876
+ for (var i = 0, len = arr.length; i < len; i++) {
11877
+ newArr.push(arr[i].substr(0, sLen));
11878
+ }
11879
+ return newArr;
11880
+ }
11881
+
11882
+ function monthUpdate() {
11883
+ return function (d, v) {
11884
+ var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
11885
+ if (~index) {
11886
+ d.month = index;
11887
+ }
11888
+ };
11889
+ }
11890
+
11891
+ function pad(val, len) {
11892
+ val = String(val);
11893
+ len = len || 2;
11894
+ while (val.length < len) {
11895
+ val = '0' + val;
11896
+ }
11897
+ return val;
11898
+ }
11899
+
11900
+ // 直接使用中文日期名称常量
11901
+ var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
11902
+ var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
11903
+ var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
11904
+ var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
11905
+ var amPm = ['上午', '下午'];
11906
+ var DoFn = function DoFn(D) {
11907
+ return D + '日';
11908
+ };
11909
+
11910
+ var formatFlags = {
11911
+ D: function D(dateObj) {
11912
+ return dateObj.getDay();
11913
+ },
11914
+ DD: function DD(dateObj) {
11915
+ return pad(dateObj.getDay());
11916
+ },
11917
+ Do: function Do(dateObj) {
11918
+ return DoFn(dateObj.getDate());
11919
+ },
11920
+ d: function d(dateObj) {
11921
+ return dateObj.getDate();
11922
+ },
11923
+ dd: function dd(dateObj) {
11924
+ return pad(dateObj.getDate());
11925
+ },
11926
+ ddd: function ddd(dateObj) {
11927
+ return dayNamesShort[dateObj.getDay()];
11928
+ },
11929
+ dddd: function dddd(dateObj) {
11930
+ return dayNames[dateObj.getDay()];
11931
+ },
11932
+ M: function M(dateObj) {
11933
+ return dateObj.getMonth() + 1;
11934
+ },
11935
+ MM: function MM(dateObj) {
11936
+ return pad(dateObj.getMonth() + 1);
11937
+ },
11938
+ MMM: function MMM(dateObj) {
11939
+ return monthNamesShort[dateObj.getMonth()];
11940
+ },
11941
+ MMMM: function MMMM(dateObj) {
11942
+ return monthNames[dateObj.getMonth()];
11943
+ },
11944
+ yy: function yy(dateObj) {
11945
+ return pad(String(dateObj.getFullYear()), 4).substr(2);
11946
+ },
11947
+ yyyy: function yyyy(dateObj) {
11948
+ return pad(dateObj.getFullYear(), 4);
11949
+ },
11950
+ h: function h(dateObj) {
11951
+ return dateObj.getHours() % 12 || 12;
11952
+ },
11953
+ hh: function hh(dateObj) {
11954
+ return pad(dateObj.getHours() % 12 || 12);
11955
+ },
11956
+ H: function H(dateObj) {
11957
+ return dateObj.getHours();
11958
+ },
11959
+ HH: function HH(dateObj) {
11960
+ return pad(dateObj.getHours());
11961
+ },
11962
+ m: function m(dateObj) {
11963
+ return dateObj.getMinutes();
11964
+ },
11965
+ mm: function mm(dateObj) {
11966
+ return pad(dateObj.getMinutes());
11967
+ },
11968
+ s: function s(dateObj) {
11969
+ return dateObj.getSeconds();
11970
+ },
11971
+ ss: function ss(dateObj) {
11972
+ return pad(dateObj.getSeconds());
11973
+ },
11974
+ S: function S(dateObj) {
11975
+ return Math.round(dateObj.getMilliseconds() / 100);
11976
+ },
11977
+ SS: function SS(dateObj) {
11978
+ return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
11979
+ },
11980
+ SSS: function SSS(dateObj) {
11981
+ return pad(dateObj.getMilliseconds(), 3);
11982
+ },
11983
+ a: function a(dateObj) {
11984
+ return dateObj.getHours() < 12 ? '上午' : '下午';
11985
+ },
11986
+ A: function A(dateObj) {
11987
+ return dateObj.getHours() < 12 ? '上午' : '下午';
11988
+ },
11989
+ ZZ: function ZZ(dateObj) {
11990
+ var o = dateObj.getTimezoneOffset();
11991
+ return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
11992
+ }
11993
+ };
11994
+
11995
+ var parseFlags = {
11996
+ d: [twoDigits, function (d, v) {
11997
+ d.day = v;
11998
+ }],
11999
+ Do: [twoDigits + word, function (d, v) {
12000
+ d.day = parseInt(v, 10);
12001
+ }],
12002
+ M: [twoDigits, function (d, v) {
12003
+ d.month = v - 1;
12004
+ }],
12005
+ yy: [twoDigits, function (d, v) {
12006
+ var da = new Date(),
12007
+ cent = +('' + da.getFullYear()).substr(0, 2);
12008
+ d.year = '' + (v > 68 ? cent - 1 : cent) + v;
12009
+ }],
12010
+ h: [twoDigits, function (d, v) {
12011
+ d.hour = v;
12012
+ }],
12013
+ m: [twoDigits, function (d, v) {
12014
+ d.minute = v;
12015
+ }],
12016
+ s: [twoDigits, function (d, v) {
12017
+ d.second = v;
12018
+ }],
12019
+ yyyy: [fourDigits, function (d, v) {
12020
+ d.year = v;
12021
+ }],
12022
+ S: ['\\d', function (d, v) {
12023
+ d.millisecond = v * 100;
12024
+ }],
12025
+ SS: ['\\d{2}', function (d, v) {
12026
+ d.millisecond = v * 10;
12027
+ }],
12028
+ SSS: [threeDigits, function (d, v) {
12029
+ d.millisecond = v;
12030
+ }],
12031
+ D: [twoDigits, noop],
12032
+ ddd: [word, noop],
12033
+ MMM: [word, monthUpdate('monthNamesShort')],
12034
+ MMMM: [word, monthUpdate('monthNames')],
12035
+ a: [word, function (d, v) {
12036
+ var val = v.toLowerCase();
12037
+ if (val === '上午') {
12038
+ d.isPm = false;
12039
+ } else if (val === '下午') {
12040
+ d.isPm = true;
12041
+ }
12042
+ }],
12043
+ ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
12044
+ var parts = (v + '').match(/([+-]|\d\d)/gi),
12045
+ minutes = void 0;
12046
+
12047
+ if (parts) {
12048
+ minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
12049
+ d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
12050
+ }
12051
+ }]
12052
+ };
12053
+ parseFlags.dd = parseFlags.d;
12054
+ parseFlags.dddd = parseFlags.ddd;
12055
+ parseFlags.DD = parseFlags.D;
12056
+ parseFlags.mm = parseFlags.m;
12057
+ parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
12058
+ parseFlags.MM = parseFlags.M;
12059
+ parseFlags.ss = parseFlags.s;
12060
+ parseFlags.A = parseFlags.a;
12061
+
12062
+ // Some common format strings
12063
+ fecha.masks = {
12064
+ default: 'ddd MMM dd yyyy HH:mm:ss',
12065
+ shortDate: 'M/D/yy',
12066
+ mediumDate: 'MMM d, yyyy',
12067
+ longDate: 'MMMM d, yyyy',
12068
+ fullDate: 'dddd, MMMM d, yyyy',
12069
+ shortTime: 'HH:mm',
12070
+ mediumTime: 'HH:mm:ss',
12071
+ longTime: 'HH:mm:ss.SSS'
12072
+ };
12073
+
12250
12074
  /***
12251
12075
  * Format a date
12252
12076
  * @method format
12253
12077
  * @param {Date|number} dateObj
12254
12078
  * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
12255
- */
12256
- fecha.format = function (dateObj, mask) {
12257
- if (typeof dateObj === 'number') {
12258
- dateObj = new Date(dateObj);
12259
- }
12260
-
12261
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
12262
- throw new Error('Invalid Date in fecha.format');
12263
- }
12264
-
12265
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
12266
-
12267
- const literals = [];
12268
-
12269
- // Make literals inactive by replacing them with ??
12270
- mask = mask.replace(literal, function($0, $1) {
12271
- literals.push($1);
12272
- return '@@@';
12273
- });
12274
- // Apply formatting rules
12275
- mask = mask.replace(token, function ($0) {
12276
- return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
12277
- });
12278
- // Inline literal values back into the formatted value
12279
- return mask.replace(/@@@/g, function() {
12280
- return literals.shift();
12281
- });
12282
- };
12283
-
12079
+ */
12080
+ fecha.format = function (dateObj, mask) {
12081
+ if (typeof dateObj === 'number') {
12082
+ dateObj = new Date(dateObj);
12083
+ }
12084
+
12085
+ if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
12086
+ throw new Error('Invalid Date in fecha.format');
12087
+ }
12088
+
12089
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
12090
+
12091
+ var literals = [];
12092
+
12093
+ // Make literals inactive by replacing them with ??
12094
+ mask = mask.replace(literal, function ($0, $1) {
12095
+ literals.push($1);
12096
+ return '@@@';
12097
+ });
12098
+ // Apply formatting rules
12099
+ mask = mask.replace(token, function ($0) {
12100
+ return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
12101
+ });
12102
+ // Inline literal values back into the formatted value
12103
+ return mask.replace(/@@@/g, function () {
12104
+ return literals.shift();
12105
+ });
12106
+ };
12107
+
12284
12108
  /**
12285
12109
  * Parse a date string into an object, changes - into /
12286
12110
  * @method parse
12287
12111
  * @param {string} dateStr Date string
12288
12112
  * @param {string} format Date parse format
12289
12113
  * @returns {Date|boolean}
12290
- */
12291
- fecha.parse = function (dateStr, format) {
12292
- if (typeof format !== 'string') {
12293
- throw new Error('Invalid format in fecha.parse');
12294
- }
12295
-
12296
- format = fecha.masks[format] || format;
12297
-
12298
- // Avoid regular expression denial of service, fail early for really long strings
12299
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
12300
- if (dateStr.length > 1000) {
12301
- return null;
12302
- }
12303
-
12304
- const dateInfo = {};
12305
- const parseInfo = [];
12306
- const literals = [];
12307
- format = format.replace(literal, function($0, $1) {
12308
- literals.push($1);
12309
- return '@@@';
12310
- });
12311
- let newFormat = regexEscape(format).replace(token, function ($0) {
12312
- if (parseFlags[$0]) {
12313
- const info = parseFlags[$0];
12314
- parseInfo.push(info[1]);
12315
- return '(' + info[0] + ')';
12316
- }
12317
-
12318
- return $0;
12319
- });
12320
- newFormat = newFormat.replace(/@@@/g, function() {
12321
- return literals.shift();
12322
- });
12323
- const matches = dateStr.match(new RegExp(newFormat, 'i'));
12324
- if (!matches) {
12325
- return null;
12326
- }
12327
-
12328
- for (let i = 1; i < matches.length; i++) {
12329
- parseInfo[i - 1](dateInfo, matches[i]);
12330
- }
12331
-
12332
- const today = new Date();
12333
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
12334
- dateInfo.hour = +dateInfo.hour + 12;
12335
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
12336
- dateInfo.hour = 0;
12337
- }
12338
-
12339
- let date;
12340
- if (dateInfo.timezoneOffset != null) {
12341
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
12342
- date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
12343
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
12344
- } else {
12345
- date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
12346
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
12347
- }
12348
- return date;
12349
- };
12350
-
12351
- // 导出fecha对象
12352
-
12353
-
12354
- // 以下是从date-util.js合并的函数
12355
- const newArray = function(start, end) {
12356
- let result = [];
12357
- for (let i = start; i <= end; i++) {
12358
- result.push(i);
12359
- }
12360
- return result;
12361
- };
12362
-
12363
- const getSettings = () => {
12364
- return {
12365
- dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
12366
- dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
12367
- monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
12368
- monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
12369
- amPm: ['上午', '下午']
12370
- };
12371
- };
12372
-
12373
- const toDate = function(date) {
12374
- return isDate(date) ? new Date(date) : null;
12375
- };
12376
-
12377
- const isDate = function(date) {
12378
- if (date === null || date === undefined) return false;
12379
- if (isNaN(new Date(date).getTime())) return false;
12380
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
12381
- return true;
12382
- };
12383
-
12384
- const isDateObject = function(val) {
12385
- return val instanceof Date;
12386
- };
12387
-
12388
- const formatDate = function (date, format = 'yyyy-MM-dd') {
12389
- // 处理多种输入类型
12390
- if (!date) return '';
12391
-
12392
- // 如果是时间戳,转成日期对象
12393
- if (typeof date === 'number') {
12394
- date = new Date(date);
12395
- }
12396
- // 如果是字符串,转成日期对象
12397
- if (typeof date === 'string') {
12398
- date = new Date(date);
12399
- }
12400
-
12401
- // 调用toDate进一步验证和转换
12402
- date = toDate(date);
12403
- if (!date) return '';
12404
-
12405
- // 兼容大写和小写的格式标记
12406
- // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
12407
- const lowercaseFormat = format
12408
- .replace(/YYYY/g, 'yyyy')
12409
- .replace(/D/g, 'd')
12410
-
12411
- // 使用fecha库进行格式化,支持中文配置
12412
- const str = fecha.format(date, lowercaseFormat, getSettings());
12413
- return str;
12414
- };
12415
-
12416
- const parseDate = function(string, format) {
12417
- return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
12418
- };
12419
-
12420
- const getDayCountOfMonth = function(year, month) {
12421
- if (month === 3 || month === 5 || month === 8 || month === 10) {
12422
- return 30;
12423
- }
12424
-
12425
- if (month === 1) {
12426
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
12427
- return 29;
12428
- } else {
12429
- return 28;
12430
- }
12431
- }
12432
-
12433
- return 31;
12434
- };
12435
-
12436
- const getDayCountOfYear = function(year) {
12437
- const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
12438
- return isLeapYear ? 366 : 365;
12439
- };
12440
-
12441
- const getFirstDayOfMonth = function(date) {
12442
- const temp = new Date(date.getTime());
12443
- temp.setDate(1);
12444
- return temp.getDay();
12445
- };
12446
-
12447
- // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
12448
- // {prev, next} Date should work for Daylight Saving Time
12449
- // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
12450
- const prevDate = function(date, amount = 1) {
12451
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
12452
- };
12453
-
12454
- const nextDate = function(date, amount = 1) {
12455
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
12456
- };
12457
-
12458
- const getStartDateOfMonth = function(year, month) {
12459
- const result = new Date(year, month, 1);
12460
- const day = result.getDay();
12461
-
12462
- if (day === 0) {
12463
- return prevDate(result, 7);
12464
- } else {
12465
- return prevDate(result, day);
12466
- }
12467
- };
12468
-
12469
- const getWeekNumber = function(date) {
12470
- // 支持多种输入类型
12471
- if (!date||!isDate(date)) {
12472
- date = new Date();
12473
- }
12474
- if (typeof date === 'string') {
12475
- date = new Date(date);
12476
- }
12477
-
12478
- // 验证日期有效性
12479
- if (!isDate(date)) return null;
12480
-
12481
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
12482
- // 设置为最近的星期四:当前日期 + 4 - 当前星期数
12483
- // 将星期日的星期数设为7
12484
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
12485
- // 获取当年的第一天
12486
- const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
12487
- // 计算到最近的星期四的完整周数
12488
- const weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
12489
- // 返回周数
12490
- return weekNo;
12491
- };
12492
-
12493
- const getRangeHours = function(ranges) {
12494
- const hours = [];
12495
- let disabledHours = [];
12496
-
12497
- (ranges || []).forEach(range => {
12498
- const value = range.map(date => date.getHours());
12499
-
12500
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
12501
- });
12502
-
12503
- if (disabledHours.length) {
12504
- for (let i = 0; i < 24; i++) {
12505
- hours[i] = disabledHours.indexOf(i) === -1;
12506
- }
12507
- } else {
12508
- for (let i = 0; i < 24; i++) {
12509
- hours[i] = false;
12510
- }
12511
- }
12512
-
12513
- return hours;
12514
- };
12515
-
12516
- const getPrevMonthLastDays = (date, amount) => {
12517
- if (amount <= 0) return [];
12518
- const temp = new Date(date.getTime());
12519
- temp.setDate(0);
12520
- const lastDay = temp.getDate();
12521
- return range(amount).map((_, index) => lastDay - (amount - index - 1));
12522
- };
12523
-
12524
- const getMonthDays = (date) => {
12525
- const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
12526
- const days = temp.getDate();
12527
- return range(days).map((_, index) => index + 1);
12528
- };
12529
-
12530
- function setRangeData(arr, start, end, value) {
12531
- for (let i = start; i < end; i++) {
12532
- arr[i] = value;
12533
- }
12534
- }
12535
-
12536
- const getRangeMinutes = function(ranges, hour) {
12537
- const minutes = new Array(60);
12538
-
12539
- if (ranges.length > 0) {
12540
- ranges.forEach(range => {
12541
- const start = range[0];
12542
- const end = range[1];
12543
- const startHour = start.getHours();
12544
- const startMinute = start.getMinutes();
12545
- const endHour = end.getHours();
12546
- const endMinute = end.getMinutes();
12547
- if (startHour === hour && endHour !== hour) {
12548
- setRangeData(minutes, startMinute, 60, true);
12549
- } else if (startHour === hour && endHour === hour) {
12550
- setRangeData(minutes, startMinute, endMinute + 1, true);
12551
- } else if (startHour !== hour && endHour === hour) {
12552
- setRangeData(minutes, 0, endMinute + 1, true);
12553
- } else if (startHour < hour && endHour > hour) {
12554
- setRangeData(minutes, 0, 60, true);
12555
- }
12556
- });
12557
- } else {
12558
- setRangeData(minutes, 0, 60, true);
12559
- }
12560
- return minutes;
12561
- };
12562
-
12563
- const range = function(n) {
12564
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
12565
- return Array.apply(null, {length: n}).map((_, n) => n);
12566
- };
12567
-
12568
- const modifyDate = function(date, y, m, d) {
12569
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
12570
- };
12571
-
12572
- const modifyTime = function(date, h, m, s) {
12573
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
12574
- };
12575
-
12576
- const modifyWithTimeString = (date, time) => {
12577
- if (date == null || !time) {
12578
- return date;
12579
- }
12580
- time = parseDate(time, 'HH:mm:ss');
12581
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
12582
- };
12583
-
12584
- const clearTime = function(date) {
12585
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
12586
- };
12587
-
12588
- const clearMilliseconds = function(date) {
12589
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
12590
- };
12591
-
12592
- const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
12593
- // TODO: refactory a more elegant solution
12594
- if (ranges.length === 0) return date;
12595
- const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
12596
- const ndate = normalizeDate(date);
12597
- const nranges = ranges.map(range => range.map(normalizeDate));
12598
- if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
12599
-
12600
- let minDate = nranges[0][0];
12601
- let maxDate = nranges[0][0];
12602
-
12603
- nranges.forEach(nrange => {
12604
- minDate = new Date(Math.min(nrange[0], minDate));
12605
- maxDate = new Date(Math.max(nrange[1], minDate));
12606
- });
12607
-
12608
- const ret = ndate < minDate ? minDate : maxDate;
12609
- // preserve Year/Month/Date
12610
- return modifyDate(
12611
- ret,
12612
- date.getFullYear(),
12613
- date.getMonth(),
12614
- date.getDate()
12615
- );
12616
- };
12617
-
12618
- const timeWithinRange = function(date, selectableRange, format) {
12619
- const limitedDate = limitTimeRange(date, selectableRange, format);
12620
- return limitedDate.getTime() === date.getTime();
12621
- };
12622
-
12623
- const changeYearMonthAndClampDate = function(date, year, month) {
12624
- // clamp date to the number of days in `year`, `month`
12625
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
12626
- const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
12627
- return modifyDate(date, year, month, monthDate);
12628
- };
12629
-
12630
- const prevMonth = function(date) {
12631
- const year = date.getFullYear();
12632
- const month = date.getMonth();
12633
- return month === 0
12634
- ? changeYearMonthAndClampDate(date, year - 1, 11)
12635
- : changeYearMonthAndClampDate(date, year, month - 1);
12636
- };
12637
-
12638
- const nextMonth = function(date) {
12639
- const year = date.getFullYear();
12640
- const month = date.getMonth();
12641
- return month === 11
12642
- ? changeYearMonthAndClampDate(date, year + 1, 0)
12643
- : changeYearMonthAndClampDate(date, year, month + 1);
12644
- };
12645
-
12646
- const prevYear = function(date, amount = 1) {
12647
- const year = date.getFullYear();
12648
- const month = date.getMonth();
12649
- return changeYearMonthAndClampDate(date, year - amount, month);
12650
- };
12651
-
12652
- const nextYear = function(date, amount = 1) {
12653
- const year = date.getFullYear();
12654
- const month = date.getMonth();
12655
- return changeYearMonthAndClampDate(date, year + amount, month);
12656
- };
12657
-
12658
- const extractDateFormat = function(format) {
12659
- return format
12660
- .replace(/\W?m{1,2}|\W?ZZ/g, '')
12661
- .replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
12662
- .trim();
12663
- };
12664
-
12665
- const extractTimeFormat = function(format) {
12666
- return format
12667
- .replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
12668
- .trim();
12669
- };
12670
-
12671
- const validateRangeInOneMonth = function(start, end) {
12672
- return (start.getMonth() === end.getMonth()) && (start.getFullYear() === end.getFullYear());
12673
- };
12674
-
12114
+ */
12115
+ fecha.parse = function (dateStr, format) {
12116
+ if (typeof format !== 'string') {
12117
+ throw new Error('Invalid format in fecha.parse');
12118
+ }
12119
+
12120
+ format = fecha.masks[format] || format;
12121
+
12122
+ // Avoid regular expression denial of service, fail early for really long strings
12123
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
12124
+ if (dateStr.length > 1000) {
12125
+ return null;
12126
+ }
12127
+
12128
+ var dateInfo = {};
12129
+ var parseInfo = [];
12130
+ var literals = [];
12131
+ format = format.replace(literal, function ($0, $1) {
12132
+ literals.push($1);
12133
+ return '@@@';
12134
+ });
12135
+ var newFormat = regexEscape(format).replace(token, function ($0) {
12136
+ if (parseFlags[$0]) {
12137
+ var info = parseFlags[$0];
12138
+ parseInfo.push(info[1]);
12139
+ return '(' + info[0] + ')';
12140
+ }
12141
+
12142
+ return $0;
12143
+ });
12144
+ newFormat = newFormat.replace(/@@@/g, function () {
12145
+ return literals.shift();
12146
+ });
12147
+ var matches = dateStr.match(new RegExp(newFormat, 'i'));
12148
+ if (!matches) {
12149
+ return null;
12150
+ }
12151
+
12152
+ for (var i = 1; i < matches.length; i++) {
12153
+ parseInfo[i - 1](dateInfo, matches[i]);
12154
+ }
12155
+
12156
+ var today = new Date();
12157
+ if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
12158
+ dateInfo.hour = +dateInfo.hour + 12;
12159
+ } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
12160
+ dateInfo.hour = 0;
12161
+ }
12162
+
12163
+ var date = void 0;
12164
+ if (dateInfo.timezoneOffset != null) {
12165
+ dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
12166
+ 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));
12167
+ } else {
12168
+ 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);
12169
+ }
12170
+ return date;
12171
+ };
12172
+
12173
+ // 导出fecha对象
12174
+
12175
+
12176
+ // 以下是从date-util.js合并的函数
12177
+ var newArray = function newArray(start, end) {
12178
+ var result = [];
12179
+ for (var i = start; i <= end; i++) {
12180
+ result.push(i);
12181
+ }
12182
+ return result;
12183
+ };
12184
+
12185
+ var getSettings = function getSettings() {
12186
+ return {
12187
+ dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
12188
+ dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
12189
+ monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
12190
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
12191
+ amPm: ['上午', '下午']
12192
+ };
12193
+ };
12194
+
12195
+ var toDate = function toDate(date) {
12196
+ return isDate(date) ? new Date(date) : null;
12197
+ };
12198
+
12199
+ var isDate = function isDate(date) {
12200
+ if (date === null || date === undefined) return false;
12201
+ if (isNaN(new Date(date).getTime())) return false;
12202
+ if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
12203
+ return true;
12204
+ };
12205
+
12206
+ var isDateObject = function isDateObject(val) {
12207
+ return val instanceof Date;
12208
+ };
12209
+
12210
+ var formatDate = function formatDate(date) {
12211
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
12212
+
12213
+ // 处理多种输入类型
12214
+ if (!date) return '';
12215
+
12216
+ // 如果是时间戳,转成日期对象
12217
+ if (typeof date === 'number') {
12218
+ date = new Date(date);
12219
+ }
12220
+ // 如果是字符串,转成日期对象
12221
+ if (typeof date === 'string') {
12222
+ date = new Date(date);
12223
+ }
12224
+
12225
+ // 调用toDate进一步验证和转换
12226
+ date = toDate(date);
12227
+ if (!date) return '';
12228
+
12229
+ // 兼容大写和小写的格式标记
12230
+ // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
12231
+ var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
12232
+
12233
+ // 使用fecha库进行格式化,支持中文配置
12234
+ var str = fecha.format(date, lowercaseFormat, getSettings());
12235
+ return str;
12236
+ };
12237
+
12238
+ var parseDate = function parseDate(string, format) {
12239
+ return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
12240
+ };
12241
+
12242
+ var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
12243
+ if (month === 3 || month === 5 || month === 8 || month === 10) {
12244
+ return 30;
12245
+ }
12246
+
12247
+ if (month === 1) {
12248
+ if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
12249
+ return 29;
12250
+ } else {
12251
+ return 28;
12252
+ }
12253
+ }
12254
+
12255
+ return 31;
12256
+ };
12257
+
12258
+ var getDayCountOfYear = function getDayCountOfYear(year) {
12259
+ var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
12260
+ return isLeapYear ? 366 : 365;
12261
+ };
12262
+
12263
+ var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
12264
+ var temp = new Date(date.getTime());
12265
+ temp.setDate(1);
12266
+ return temp.getDay();
12267
+ };
12268
+
12269
+ // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
12270
+ // {prev, next} Date should work for Daylight Saving Time
12271
+ // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
12272
+ var prevDate = function prevDate(date) {
12273
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
12274
+
12275
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
12276
+ };
12277
+
12278
+ var nextDate = function nextDate(date) {
12279
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
12280
+
12281
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
12282
+ };
12283
+
12284
+ var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
12285
+ var result = new Date(year, month, 1);
12286
+ var day = result.getDay();
12287
+
12288
+ if (day === 0) {
12289
+ return prevDate(result, 7);
12290
+ } else {
12291
+ return prevDate(result, day);
12292
+ }
12293
+ };
12294
+
12295
+ var getWeekNumber = function getWeekNumber(date) {
12296
+ // 支持多种输入类型
12297
+ if (!date || !isDate(date)) {
12298
+ date = new Date();
12299
+ }
12300
+ if (typeof date === 'string') {
12301
+ date = new Date(date);
12302
+ }
12303
+
12304
+ // 验证日期有效性
12305
+ if (!isDate(date)) return null;
12306
+
12307
+ var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
12308
+ // 设置为最近的星期四:当前日期 + 4 - 当前星期数
12309
+ // 将星期日的星期数设为7
12310
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
12311
+ // 获取当年的第一天
12312
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
12313
+ // 计算到最近的星期四的完整周数
12314
+ var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
12315
+ // 返回周数
12316
+ return weekNo;
12317
+ };
12318
+
12319
+ var getRangeHours = function getRangeHours(ranges) {
12320
+ var hours = [];
12321
+ var disabledHours = [];
12322
+
12323
+ (ranges || []).forEach(function (range) {
12324
+ var value = range.map(function (date) {
12325
+ return date.getHours();
12326
+ });
12327
+
12328
+ disabledHours = disabledHours.concat(newArray(value[0], value[1]));
12329
+ });
12330
+
12331
+ if (disabledHours.length) {
12332
+ for (var i = 0; i < 24; i++) {
12333
+ hours[i] = disabledHours.indexOf(i) === -1;
12334
+ }
12335
+ } else {
12336
+ for (var _i = 0; _i < 24; _i++) {
12337
+ hours[_i] = false;
12338
+ }
12339
+ }
12340
+
12341
+ return hours;
12342
+ };
12343
+
12344
+ var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
12345
+ if (amount <= 0) return [];
12346
+ var temp = new Date(date.getTime());
12347
+ temp.setDate(0);
12348
+ var lastDay = temp.getDate();
12349
+ return range(amount).map(function (_, index) {
12350
+ return lastDay - (amount - index - 1);
12351
+ });
12352
+ };
12353
+
12354
+ var getMonthDays = function getMonthDays(date) {
12355
+ var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
12356
+ var days = temp.getDate();
12357
+ return range(days).map(function (_, index) {
12358
+ return index + 1;
12359
+ });
12360
+ };
12361
+
12362
+ function setRangeData(arr, start, end, value) {
12363
+ for (var i = start; i < end; i++) {
12364
+ arr[i] = value;
12365
+ }
12366
+ }
12367
+
12368
+ var getRangeMinutes = function getRangeMinutes(ranges, hour) {
12369
+ var minutes = new Array(60);
12370
+
12371
+ if (ranges.length > 0) {
12372
+ ranges.forEach(function (range) {
12373
+ var start = range[0];
12374
+ var end = range[1];
12375
+ var startHour = start.getHours();
12376
+ var startMinute = start.getMinutes();
12377
+ var endHour = end.getHours();
12378
+ var endMinute = end.getMinutes();
12379
+ if (startHour === hour && endHour !== hour) {
12380
+ setRangeData(minutes, startMinute, 60, true);
12381
+ } else if (startHour === hour && endHour === hour) {
12382
+ setRangeData(minutes, startMinute, endMinute + 1, true);
12383
+ } else if (startHour !== hour && endHour === hour) {
12384
+ setRangeData(minutes, 0, endMinute + 1, true);
12385
+ } else if (startHour < hour && endHour > hour) {
12386
+ setRangeData(minutes, 0, 60, true);
12387
+ }
12388
+ });
12389
+ } else {
12390
+ setRangeData(minutes, 0, 60, true);
12391
+ }
12392
+ return minutes;
12393
+ };
12394
+
12395
+ var range = function range(n) {
12396
+ // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
12397
+ return Array.apply(null, { length: n }).map(function (_, n) {
12398
+ return n;
12399
+ });
12400
+ };
12401
+
12402
+ var modifyDate = function modifyDate(date, y, m, d) {
12403
+ return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
12404
+ };
12405
+
12406
+ var modifyTime = function modifyTime(date, h, m, s) {
12407
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
12408
+ };
12409
+
12410
+ var modifyWithTimeString = function modifyWithTimeString(date, time) {
12411
+ if (date == null || !time) {
12412
+ return date;
12413
+ }
12414
+ time = parseDate(time, 'HH:mm:ss');
12415
+ return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
12416
+ };
12417
+
12418
+ var clearTime = function clearTime(date) {
12419
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
12420
+ };
12421
+
12422
+ var clearMilliseconds = function clearMilliseconds(date) {
12423
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
12424
+ };
12425
+
12426
+ var limitTimeRange = function limitTimeRange(date, ranges) {
12427
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
12428
+
12429
+ // TODO: refactory a more elegant solution
12430
+ if (ranges.length === 0) return date;
12431
+ var normalizeDate = function normalizeDate(date) {
12432
+ return fecha.parse(fecha.format(date, format), format);
12433
+ };
12434
+ var ndate = normalizeDate(date);
12435
+ var nranges = ranges.map(function (range) {
12436
+ return range.map(normalizeDate);
12437
+ });
12438
+ if (nranges.some(function (nrange) {
12439
+ return ndate >= nrange[0] && ndate <= nrange[1];
12440
+ })) return date;
12441
+
12442
+ var minDate = nranges[0][0];
12443
+ var maxDate = nranges[0][0];
12444
+
12445
+ nranges.forEach(function (nrange) {
12446
+ minDate = new Date(Math.min(nrange[0], minDate));
12447
+ maxDate = new Date(Math.max(nrange[1], minDate));
12448
+ });
12449
+
12450
+ var ret = ndate < minDate ? minDate : maxDate;
12451
+ // preserve Year/Month/Date
12452
+ return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
12453
+ };
12454
+
12455
+ var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
12456
+ var limitedDate = limitTimeRange(date, selectableRange, format);
12457
+ return limitedDate.getTime() === date.getTime();
12458
+ };
12459
+
12460
+ var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
12461
+ // clamp date to the number of days in `year`, `month`
12462
+ // eg: (2010-1-31, 2010, 2) => 2010-2-28
12463
+ var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
12464
+ return modifyDate(date, year, month, monthDate);
12465
+ };
12466
+
12467
+ var prevMonth = function prevMonth(date) {
12468
+ var year = date.getFullYear();
12469
+ var month = date.getMonth();
12470
+ return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
12471
+ };
12472
+
12473
+ var nextMonth = function nextMonth(date) {
12474
+ var year = date.getFullYear();
12475
+ var month = date.getMonth();
12476
+ return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
12477
+ };
12478
+
12479
+ var prevYear = function prevYear(date) {
12480
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
12481
+
12482
+ var year = date.getFullYear();
12483
+ var month = date.getMonth();
12484
+ return changeYearMonthAndClampDate(date, year - amount, month);
12485
+ };
12486
+
12487
+ var nextYear = function nextYear(date) {
12488
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
12489
+
12490
+ var year = date.getFullYear();
12491
+ var month = date.getMonth();
12492
+ return changeYearMonthAndClampDate(date, year + amount, month);
12493
+ };
12494
+
12495
+ var extractDateFormat = function extractDateFormat(format) {
12496
+ return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
12497
+ };
12498
+
12499
+ var extractTimeFormat = function extractTimeFormat(format) {
12500
+ return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
12501
+ };
12502
+
12503
+ var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
12504
+ return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
12505
+ };
12506
+
12675
12507
  /**
12676
12508
  * 计算两个日期之间的工作日数量(不包括周末和节假日)
12677
12509
  * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
12678
12510
  * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
12679
12511
  * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
12680
12512
  * @returns {number} 工作日数量
12681
- */
12682
- const calculateNetworkDays = function (start_date, end_date, holidays = []) {
12683
- if (typeof start_date !== 'string' || typeof end_date !== 'string') {
12684
- throw new Error(
12685
- "Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'."
12686
- );
12687
- }
12688
-
12689
- const startDateObj = new Date(start_date);
12690
- const endDateObj = new Date(end_date);
12691
-
12692
- if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
12693
- throw new Error(
12694
- "Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'."
12695
- );
12696
- }
12697
-
12698
- if (startDateObj > endDateObj) {
12699
- throw new Error('Start date should be earlier than or equal to end date.');
12700
- }
12701
-
12702
- let workdays = 0;
12703
-
12704
- // Iterate through each day in the date range
12705
- for (
12706
- let currentDate = new Date(startDateObj);
12707
- currentDate <= endDateObj;
12708
- currentDate.setDate(currentDate.getDate() + 1)
12709
- ) {
12710
- // Check if the current day is a weekend (Saturday or Sunday)
12711
- const isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
12712
-
12713
- // Check if the current day is a holiday
12714
- const isHoliday = holidays.some((holiday) => {
12715
- const holidayDate = new Date(holiday);
12716
- return currentDate.toDateString() === holidayDate.toDateString();
12717
- });
12718
-
12719
- // If it's a workday (not a weekend or holiday), increment the workdays count
12720
- if (!isWeekend && !isHoliday) {
12721
- workdays++;
12722
- }
12723
- }
12724
-
12725
- return workdays;
12726
- };
12727
-
12513
+ */
12514
+ var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
12515
+ var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
12516
+
12517
+ if (typeof start_date !== 'string' || typeof end_date !== 'string') {
12518
+ throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
12519
+ }
12520
+
12521
+ var startDateObj = new Date(start_date);
12522
+ var endDateObj = new Date(end_date);
12523
+
12524
+ if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
12525
+ throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
12526
+ }
12527
+
12528
+ if (startDateObj > endDateObj) {
12529
+ throw new Error('Start date should be earlier than or equal to end date.');
12530
+ }
12531
+
12532
+ var workdays = 0;
12533
+
12534
+ // Iterate through each day in the date range
12535
+
12536
+ var _loop = function _loop(currentDate) {
12537
+ // Check if the current day is a weekend (Saturday or Sunday)
12538
+ var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
12539
+
12540
+ // Check if the current day is a holiday
12541
+ var isHoliday = holidays.some(function (holiday) {
12542
+ var holidayDate = new Date(holiday);
12543
+ return currentDate.toDateString() === holidayDate.toDateString();
12544
+ });
12545
+
12546
+ // If it's a workday (not a weekend or holiday), increment the workdays count
12547
+ if (!isWeekend && !isHoliday) {
12548
+ workdays++;
12549
+ }
12550
+ };
12551
+
12552
+ for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
12553
+ _loop(currentDate);
12554
+ }
12555
+
12556
+ return workdays;
12557
+ };
12558
+
12728
12559
  /**
12729
12560
  * 日期加减天数
12730
12561
  * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
12731
12562
  * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
12732
12563
  * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
12733
- */
12734
- const dateAddDays = function (start_date, days) {
12735
- if (typeof start_date !== 'string' || !Number.isInteger(days)) {
12736
- throw new Error(
12737
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days."
12738
- );
12739
- }
12740
-
12741
- const startDateObj = new Date(start_date);
12742
- if (isNaN(startDateObj.getTime())) {
12743
- throw new Error(
12744
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
12745
- );
12746
- }
12747
-
12748
- const resultDateObj = new Date(startDateObj);
12749
- resultDateObj.setDate(resultDateObj.getDate() + days);
12750
-
12751
- const resultYear = resultDateObj.getFullYear();
12752
- const resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
12753
- const resultDay = String(resultDateObj.getDate()).padStart(2, '0');
12754
-
12755
- return `${resultYear}-${resultMonth}-${resultDay}`;
12756
- };
12757
-
12564
+ */
12565
+ var dateAddDays = function dateAddDays(start_date, days) {
12566
+ if (typeof start_date !== 'string' || !Number.isInteger(days)) {
12567
+ 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.");
12568
+ }
12569
+
12570
+ var startDateObj = new Date(start_date);
12571
+ if (isNaN(startDateObj.getTime())) {
12572
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
12573
+ }
12574
+
12575
+ var resultDateObj = new Date(startDateObj);
12576
+ resultDateObj.setDate(resultDateObj.getDate() + days);
12577
+
12578
+ var resultYear = resultDateObj.getFullYear();
12579
+ var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
12580
+ var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
12581
+
12582
+ return resultYear + '-' + resultMonth + '-' + resultDay;
12583
+ };
12584
+
12758
12585
  /**
12759
12586
  * 计算两个日期之间的差值
12760
12587
  * @date 2023年12月14日
@@ -12762,182 +12589,180 @@ const dateAddDays = function (start_date, days) {
12762
12589
  * @param {String} end_date - 结束日期字符串
12763
12590
  * @param {String} unit - 单位:year/month/day
12764
12591
  * @returns {Number} 差值
12765
- */
12766
- const dateDiff = function (start_date, end_date, unit = 'day') {
12767
- // Assuming date strings are in "YYYY-MM-DD" format
12768
- var startDate = new Date(start_date);
12769
- var endDate = new Date(end_date);
12770
-
12771
- // If the date is invalid, return 0
12772
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
12773
- return 0;
12774
- }
12775
-
12776
- if (unit === 'year') {
12777
- return endDate.getFullYear() - startDate.getFullYear();
12778
- } else if (unit === 'month') {
12779
- return (
12780
- (endDate.getFullYear() - startDate.getFullYear()) * 12 +
12781
- (endDate.getMonth() - startDate.getMonth())
12782
- );
12783
- } else {
12784
- // Default to day
12785
- var timeDifference = endDate - startDate;
12786
- // Calculate days (86400000 milliseconds per day)
12787
- return Math.floor(timeDifference / 86400000);
12788
- }
12789
- };
12790
-
12592
+ */
12593
+ var dateDiff = function dateDiff(start_date, end_date) {
12594
+ var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
12595
+
12596
+ // Assuming date strings are in "YYYY-MM-DD" format
12597
+ var startDate = new Date(start_date);
12598
+ var endDate = new Date(end_date);
12599
+
12600
+ // If the date is invalid, return 0
12601
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
12602
+ return 0;
12603
+ }
12604
+
12605
+ if (unit === 'year') {
12606
+ return endDate.getFullYear() - startDate.getFullYear();
12607
+ } else if (unit === 'month') {
12608
+ return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
12609
+ } else {
12610
+ // Default to day
12611
+ var timeDifference = endDate - startDate;
12612
+ // Calculate days (86400000 milliseconds per day)
12613
+ return Math.floor(timeDifference / 86400000);
12614
+ }
12615
+ };
12616
+
12791
12617
  /**
12792
12618
  * 获取月份中的日期
12793
12619
  * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
12794
12620
  * @returns {number} 月份中的日期(1-31)
12795
- */
12796
- const dayOfMonth = function (date) {
12797
- if (typeof date !== 'string') {
12798
- throw new Error(
12799
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'."
12800
- );
12801
- }
12802
-
12803
- const dateObj = new Date(date);
12804
- if (isNaN(dateObj.getTime())) {
12805
- throw new Error(
12806
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
12807
- );
12808
- }
12809
-
12810
- return dateObj.getDate();
12811
- };
12812
-
12621
+ */
12622
+ var dayOfMonth = function dayOfMonth(date) {
12623
+ if (typeof date !== 'string') {
12624
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
12625
+ }
12626
+
12627
+ var dateObj = new Date(date);
12628
+ if (isNaN(dateObj.getTime())) {
12629
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
12630
+ }
12631
+
12632
+ return dateObj.getDate();
12633
+ };
12634
+
12813
12635
  /**
12814
12636
  * 获取当前日期
12815
12637
  * @date 2022年5月7日
12816
12638
  * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
12817
12639
  * @returns {string} 当前日期的格式化字符串
12818
- */
12819
- const getCurrentDate = function (format = 'YYYY-MM-DD') {
12820
- return formatDate(new Date(), format);
12821
- };
12822
-
12640
+ */
12641
+ var getCurrentDate = function getCurrentDate() {
12642
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
12643
+
12644
+ return formatDate(new Date(), format);
12645
+ };
12646
+
12823
12647
  /**
12824
12648
  * 获取当前日期时间
12825
12649
  * @date 2022年5月7日
12826
12650
  * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
12827
12651
  * @returns {string} 当前日期时间的格式化字符串
12828
- */
12829
- const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
12830
- return formatDate(new Date(), format);
12831
- };
12832
-
12652
+ */
12653
+ var getCurrentDateTime = function getCurrentDateTime() {
12654
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
12655
+
12656
+ return formatDate(new Date(), format);
12657
+ };
12658
+
12833
12659
  /**
12834
12660
  * 获取小时
12835
12661
  * @date 2022年5月7日
12836
12662
  * @param {Date|string} [date] - 日期对象或日期字符串
12837
12663
  * @returns {number} 小时数(0-23)
12838
- */
12839
- const getHour = function (date) {
12840
- if (!date) {
12841
- return new Date().getHours();
12842
- }
12843
- if (typeof date === 'string') {
12844
- date = new Date(date);
12845
- }
12846
- return date.getHours();
12847
- };
12848
-
12664
+ */
12665
+ var getHour = function getHour(date) {
12666
+ if (!date) {
12667
+ return new Date().getHours();
12668
+ }
12669
+ if (typeof date === 'string') {
12670
+ date = new Date(date);
12671
+ }
12672
+ return date.getHours();
12673
+ };
12674
+
12849
12675
  /**
12850
12676
  * 获取分钟
12851
12677
  * @date 2022年5月7日
12852
12678
  * @param {Date|string} [date] - 日期对象或日期字符串
12853
12679
  * @returns {number} 分钟数(0-59)
12854
- */
12855
- const getMinute = function (date) {
12856
- if (!date) {
12857
- return new Date().getMinutes();
12858
- }
12859
- if (typeof date === 'string') {
12860
- date = new Date(date);
12861
- }
12862
- return date.getMinutes();
12863
- };
12864
-
12680
+ */
12681
+ var getMinute = function getMinute(date) {
12682
+ if (!date) {
12683
+ return new Date().getMinutes();
12684
+ }
12685
+ if (typeof date === 'string') {
12686
+ date = new Date(date);
12687
+ }
12688
+ return date.getMinutes();
12689
+ };
12690
+
12865
12691
  /**
12866
12692
  * 获取月份
12867
12693
  * @date 2022年5月7日
12868
12694
  * @param {Date|string} [date] - 日期对象或日期字符串
12869
12695
  * @returns {number} 月份数(1-12)
12870
- */
12871
- const getMonth = function (date) {
12872
- if (!date) {
12873
- return new Date().getMonth() + 1;
12874
- }
12875
- if (typeof date === 'string') {
12876
- date = new Date(date);
12877
- }
12878
- return date.getMonth() + 1;
12879
- };
12880
-
12696
+ */
12697
+ var getMonth = function getMonth(date) {
12698
+ if (!date) {
12699
+ return new Date().getMonth() + 1;
12700
+ }
12701
+ if (typeof date === 'string') {
12702
+ date = new Date(date);
12703
+ }
12704
+ return date.getMonth() + 1;
12705
+ };
12706
+
12881
12707
  /**
12882
12708
  * 获取秒
12883
12709
  * @date 2022年5月7日
12884
12710
  * @param {Date|string} [date] - 日期对象或日期字符串
12885
12711
  * @returns {number} 秒数(0-59)
12886
- */
12887
- const getSecond = function (date) {
12888
- if (!date) {
12889
- return new Date().getSeconds();
12890
- }
12891
- if (typeof date === 'string') {
12892
- date = new Date(date);
12893
- }
12894
- return date.getSeconds();
12895
- };
12896
-
12712
+ */
12713
+ var getSecond = function getSecond(date) {
12714
+ if (!date) {
12715
+ return new Date().getSeconds();
12716
+ }
12717
+ if (typeof date === 'string') {
12718
+ date = new Date(date);
12719
+ }
12720
+ return date.getSeconds();
12721
+ };
12722
+
12897
12723
  /**
12898
12724
  * 获取星期几
12899
12725
  * @date 2022年5月7日
12900
12726
  * @param {Date|string} [date] - 日期对象或日期字符串
12901
12727
  * @returns {number} 星期几(0-6,0表示星期日)
12902
- */
12903
- const getWeekday = function (date) {
12904
- if (!date) {
12905
- return new Date().getDay();
12906
- }
12907
- if (typeof date === 'string') {
12908
- date = new Date(date);
12909
- }
12910
- return date.getDay();
12911
- };
12912
-
12913
-
12728
+ */
12729
+ var getWeekday = function getWeekday(date) {
12730
+ if (!date) {
12731
+ return new Date().getDay();
12732
+ }
12733
+ if (typeof date === 'string') {
12734
+ date = new Date(date);
12735
+ }
12736
+ return date.getDay();
12737
+ };
12738
+
12914
12739
  /**
12915
12740
  * @desc 获取上午/下午/晚上
12916
12741
  * @author huangbo
12917
12742
  * @date 2022年5月7日
12918
12743
  * @param {String} [time] - 时间
12919
- **/
12920
- const timeCycle = function (time) {
12921
- let hour = 0;
12922
- if (!time) {
12923
- hour = new Date().getHours();
12924
- } else if (typeof time === 'string') {
12925
- // 从时间字符串中提取小时
12926
- const match = time.match(/^(\d{1,2})/);
12927
- if (match) {
12928
- hour = parseInt(match[1], 10);
12929
- }
12930
- } else if (typeof time === 'number') {
12931
- hour = time;
12932
- }
12933
- // 判断时间段
12934
- if (hour >= 5 && hour < 12) {
12935
- return '上午';
12936
- } else if (hour >= 12 && hour < 18) {
12937
- return '下午';
12938
- } else {
12939
- return '晚上';
12940
- }
12744
+ **/
12745
+ var timeCycle = function timeCycle(time) {
12746
+ var hour = 0;
12747
+ if (!time) {
12748
+ hour = new Date().getHours();
12749
+ } else if (typeof time === 'string') {
12750
+ // 从时间字符串中提取小时
12751
+ var match = time.match(/^(\d{1,2})/);
12752
+ if (match) {
12753
+ hour = parseInt(match[1], 10);
12754
+ }
12755
+ } else if (typeof time === 'number') {
12756
+ hour = time;
12757
+ }
12758
+ // 判断时间段
12759
+ if (hour >= 5 && hour < 12) {
12760
+ return '上午';
12761
+ } else if (hour >= 12 && hour < 18) {
12762
+ return '下午';
12763
+ } else {
12764
+ return '晚上';
12765
+ }
12941
12766
  };
12942
12767
 
12943
12768
  /***/ }),
@@ -12949,7 +12774,7 @@ module.exports = require("eoss/lib/message-box");
12949
12774
 
12950
12775
  /***/ }),
12951
12776
 
12952
- /***/ 81:
12777
+ /***/ 82:
12953
12778
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
12954
12779
 
12955
12780
  "use strict";
@@ -12980,7 +12805,7 @@ function isKorean(text) {
12980
12805
 
12981
12806
  /***/ }),
12982
12807
 
12983
- /***/ 84:
12808
+ /***/ 86:
12984
12809
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
12985
12810
 
12986
12811
  "use strict";