eoss 0.1.0-alpha.25 → 0.1.0-alpha.26

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 (254) 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 +1000 -971
  83. package/lib/alert.js +2 -2
  84. package/lib/aside.js +2 -2
  85. package/lib/audit-trajectory.js +75 -71
  86. package/lib/autocomplete.js +2136 -1951
  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 +12 -12
  93. package/lib/button.js +2 -2
  94. package/lib/ca-login.js +913 -888
  95. package/lib/calendar.js +872 -847
  96. package/lib/card.js +2 -2
  97. package/lib/carousel-item.js +905 -880
  98. package/lib/carousel.js +1042 -1017
  99. package/lib/cascader-panel.js +926 -901
  100. package/lib/cascader.js +2022 -1837
  101. package/lib/checkbox-button.js +2 -2
  102. package/lib/checkbox-group.js +1000 -971
  103. package/lib/checkbox.js +2 -2
  104. package/lib/col.js +2 -2
  105. package/lib/collapse-item.js +2174 -1980
  106. package/lib/collapse.js +2175 -1980
  107. package/lib/color-picker.js +1112 -952
  108. package/lib/config/api.js +3 -0
  109. package/lib/container.js +2 -2
  110. package/lib/cron.js +2 -2
  111. package/lib/data-table.js +1007 -978
  112. package/lib/date-picker.js +2142 -1957
  113. package/lib/dialog.js +910 -885
  114. package/lib/divider.js +2 -2
  115. package/lib/drawer.js +2 -2
  116. package/lib/dropdown-item.js +4 -4
  117. package/lib/dropdown-menu.js +1104 -944
  118. package/lib/dropdown.js +925 -900
  119. package/lib/email-login.js +999 -970
  120. package/lib/empty.js +2 -2
  121. package/lib/eoss.common.js +8751 -4166
  122. package/lib/flip.js +2 -2
  123. package/lib/flow-group.js +906 -881
  124. package/lib/flow.js +1112 -1083
  125. package/lib/flows.js +1010 -981
  126. package/lib/footer.js +2 -2
  127. package/lib/form-item.js +909 -884
  128. package/lib/form.js +2185 -1986
  129. package/lib/guide.js +620 -0
  130. package/lib/header.js +2 -2
  131. package/lib/icon.js +981 -952
  132. package/lib/icons.js +2 -2
  133. package/lib/image-viewer.js +907 -882
  134. package/lib/image.js +4 -4
  135. package/lib/index.js +1 -1
  136. package/lib/infinite-scroll.js +2 -2
  137. package/lib/input-number.js +4 -4
  138. package/lib/input.js +910 -885
  139. package/lib/link.js +2 -2
  140. package/lib/loading.js +2 -2
  141. package/lib/login.js +1027 -998
  142. package/lib/lowcode.js +17336 -13510
  143. package/lib/main.js +14933 -14625
  144. package/lib/marquee.js +907 -882
  145. package/lib/menu-item-group.js +2 -2
  146. package/lib/menu-item.js +2 -2
  147. package/lib/menu.js +2011 -1826
  148. package/lib/message-box.js +923 -898
  149. package/lib/message.js +911 -886
  150. package/lib/notification.js +911 -886
  151. package/lib/option-group.js +2 -2
  152. package/lib/option.js +907 -882
  153. package/lib/page-header.js +2 -2
  154. package/lib/pagination.js +910 -885
  155. package/lib/phone-login.js +998 -969
  156. package/lib/popconfirm.js +12 -12
  157. package/lib/popover.js +2009 -1824
  158. package/lib/process-config.js +1015 -986
  159. package/lib/process-module.js +1001 -972
  160. package/lib/process-rule.js +1019 -990
  161. package/lib/progress.js +5 -5
  162. package/lib/qr-code.js +4 -4
  163. package/lib/qrcode-login.js +1057 -1028
  164. package/lib/radio-button.js +2 -2
  165. package/lib/radio-group.js +998 -969
  166. package/lib/radio.js +2 -2
  167. package/lib/rate.js +907 -882
  168. package/lib/row.js +2 -2
  169. package/lib/scrollbar.js +904 -879
  170. package/lib/select.js +2135 -1945
  171. package/lib/selector-panel.js +1009 -980
  172. package/lib/selector.js +1001 -972
  173. package/lib/slider.js +2 -2
  174. package/lib/step.js +2172 -1977
  175. package/lib/steps.js +907 -882
  176. package/lib/submenu.js +1119 -959
  177. package/lib/switch.js +907 -882
  178. package/lib/tab-pane.js +2 -2
  179. package/lib/table-column.js +906 -881
  180. package/lib/table.js +2236 -2047
  181. package/lib/tabs.js +911 -886
  182. package/lib/tag.js +2 -2
  183. package/lib/theme-chalk/base.css +1 -1
  184. package/lib/theme-chalk/guide.css +1 -0
  185. package/lib/theme-chalk/icon.css +1 -1
  186. package/lib/theme-chalk/index.css +1 -1
  187. package/lib/theme-chalk/lowcode-view.css +1 -0
  188. package/lib/theme-chalk/lowcode.css +1 -1
  189. package/lib/theme-chalk/main.css +1 -1
  190. package/lib/theme-chalk/pagination.css +1 -1
  191. package/lib/theme-chalk/select-dropdown.css +1 -1
  192. package/lib/theme-chalk/select.css +1 -1
  193. package/lib/theme-chalk/wujie.css +1 -0
  194. package/lib/time-picker.js +1977 -1792
  195. package/lib/time-select.js +1978 -1793
  196. package/lib/timeline-item.js +2 -2
  197. package/lib/timeline.js +2 -2
  198. package/lib/tips.js +998 -969
  199. package/lib/toolbar.js +2 -2
  200. package/lib/tooltip.js +2006 -1821
  201. package/lib/transfer.js +916 -891
  202. package/lib/tree-group.js +978 -949
  203. package/lib/tree.js +999 -970
  204. package/lib/update-history.js +76 -72
  205. package/lib/upload.js +1028 -999
  206. package/lib/utils/frame.js +133 -0
  207. package/lib/wujie.js +5037 -0
  208. package/package.json +3 -2
  209. package/packages/cascader/src/cascader.vue +1 -1
  210. package/packages/date-picker/src/picker.vue +1 -1
  211. package/packages/form/src/form-item-render.vue +10 -6
  212. package/packages/guide/index.js +8 -0
  213. package/packages/guide/src/directive.js +47 -0
  214. package/packages/guide/src/guide.vue +89 -0
  215. package/packages/guide/src/manager.js +133 -0
  216. package/packages/input/src/input.vue +1 -1
  217. package/packages/lowcode/src/aside.vue +41 -8
  218. package/packages/lowcode/src/attribute/bind.vue +2 -4
  219. package/packages/lowcode/src/attribute/dependency.vue +3 -16
  220. package/packages/lowcode/src/attribute/function.vue +2 -4
  221. package/packages/lowcode/src/attribute/property.vue +3 -15
  222. package/packages/lowcode/src/attribute/styles.vue +105 -11
  223. package/packages/lowcode/src/attribute.vue +5 -35
  224. package/packages/lowcode/src/canvas.vue +223 -97
  225. package/packages/lowcode/src/iframe.vue +60 -0
  226. package/packages/lowcode/src/lowcode.vue +32 -8
  227. package/packages/lowcode/src/pages.vue +1 -1
  228. package/packages/lowcode/src/render.vue +312 -70
  229. package/packages/lowcode/src/util/source-generator.js +7 -11
  230. package/packages/lowcode/src/util/source-parser.js +1 -1
  231. package/packages/lowcode-view/index.js +1 -1
  232. package/packages/lowcode-view/src/Iframe.vue +55 -0
  233. package/packages/lowcode-view/src/Modulels.vue +239 -0
  234. package/packages/lowcode-view/src/render.vue +337 -0
  235. package/packages/lowcode-view/src/view.vue +763 -0
  236. package/packages/main/src/components/pages.vue +11 -2
  237. package/packages/main/src/event-center.js +160 -0
  238. package/packages/main/src/minxs.js +60 -90
  239. package/packages/progress/src/progress.vue +1 -1
  240. package/packages/select/src/select.vue +2 -1
  241. package/packages/theme-chalk/src/common/var.scss +34 -10
  242. package/packages/theme-chalk/src/guide.scss +93 -0
  243. package/packages/theme-chalk/src/icon.scss +425 -426
  244. package/packages/theme-chalk/src/index.scss +2 -0
  245. package/packages/theme-chalk/src/lowcode-view.scss +288 -0
  246. package/packages/theme-chalk/src/lowcode.scss +11 -1
  247. package/packages/theme-chalk/src/select-dropdown.scss +1 -1
  248. package/packages/theme-chalk/src/wujie.scss +5 -0
  249. package/packages/wujie/index.js +10 -0
  250. package/packages/wujie/src/wujie.vue +205 -0
  251. package/src/config/api.js +3 -0
  252. package/src/index.js +325 -319
  253. package/src/utils/frame.js +102 -0
  254. package/packages/lowcode/src/view.vue +0 -187
@@ -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 = 161);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 166);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -565,7 +565,7 @@ function scrollMove(wrap) {
565
565
 
566
566
  /***/ }),
567
567
 
568
- /***/ 161:
568
+ /***/ 166:
569
569
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
570
570
 
571
571
  "use strict";
@@ -582,7 +582,7 @@ _date_picker_src_picker_time_select__WEBPACK_IMPORTED_MODULE_0__[/* default */ "
582
582
 
583
583
  /***/ }),
584
584
 
585
- /***/ 17:
585
+ /***/ 18:
586
586
  /***/ (function(module, exports) {
587
587
 
588
588
  module.exports = require("eoss/lib/input");
@@ -639,736 +639,759 @@ module.exports = require("eoss/lib/input");
639
639
  /* unused harmony export getSecond */
640
640
  /* unused harmony export getWeekday */
641
641
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
642
-
643
-
642
+ /* Modified from https://github.com/taylorhakes/fecha
643
+ *
644
+ * The MIT License (MIT)
645
+ *
646
+ * Copyright (c) 2015 Taylor Hakes
647
+ *
648
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
649
+ * of this software and associated documentation files (the "Software"), to deal
650
+ * in the Software without restriction, including without limitation the rights
651
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
652
+ * copies of the Software, and to permit persons to whom the Software is
653
+ * furnished to do so, subject to the following conditions:
654
+ *
655
+ * The above copyright notice and this permission notice shall be included in all
656
+ * copies or substantial portions of the Software.
657
+ *
658
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
659
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
660
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
661
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
662
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
663
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
664
+ * SOFTWARE.
665
+ */
666
+
667
+ /*eslint-disable*/
668
+ // 把 YYYY-MM-DD 改成了 yyyy-MM-dd
669
+
670
+
644
671
  /**
645
672
  * Parse or format dates
646
673
  * @class fecha
647
- */
648
- var fecha = {};
649
- var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
650
- var twoDigits = '\\d\\d?';
651
- var threeDigits = '\\d{3}';
652
- var fourDigits = '\\d{4}';
653
- var word = '[^\\s]+';
654
- var literal = /\[([^]*?)\]/gm;
655
- var noop = function noop() {};
656
-
657
- function regexEscape(str) {
658
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
659
- }
660
-
661
- function shorten(arr, sLen) {
662
- var newArr = [];
663
- for (var i = 0, len = arr.length; i < len; i++) {
664
- newArr.push(arr[i].substr(0, sLen));
665
- }
666
- return newArr;
667
- }
668
-
669
- function monthUpdate() {
670
- return function (d, v) {
671
- var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
672
- if (~index) {
673
- d.month = index;
674
- }
675
- };
676
- }
677
-
678
- function pad(val, len) {
679
- val = String(val);
680
- len = len || 2;
681
- while (val.length < len) {
682
- val = '0' + val;
683
- }
684
- return val;
685
- }
686
-
687
- // 直接使用中文日期名称常量
688
- var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
689
- var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
690
- var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
691
- var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
692
- var amPm = ['上午', '下午'];
693
- var DoFn = function DoFn(D) {
694
- return D + '日';
695
- };
696
-
697
- var formatFlags = {
698
- D: function D(dateObj) {
699
- return dateObj.getDay();
700
- },
701
- DD: function DD(dateObj) {
702
- return pad(dateObj.getDay());
703
- },
704
- Do: function Do(dateObj) {
705
- return DoFn(dateObj.getDate());
706
- },
707
- d: function d(dateObj) {
708
- return dateObj.getDate();
709
- },
710
- dd: function dd(dateObj) {
711
- return pad(dateObj.getDate());
712
- },
713
- ddd: function ddd(dateObj) {
714
- return dayNamesShort[dateObj.getDay()];
715
- },
716
- dddd: function dddd(dateObj) {
717
- return dayNames[dateObj.getDay()];
718
- },
719
- M: function M(dateObj) {
720
- return dateObj.getMonth() + 1;
721
- },
722
- MM: function MM(dateObj) {
723
- return pad(dateObj.getMonth() + 1);
724
- },
725
- MMM: function MMM(dateObj) {
726
- return monthNamesShort[dateObj.getMonth()];
727
- },
728
- MMMM: function MMMM(dateObj) {
729
- return monthNames[dateObj.getMonth()];
730
- },
731
- yy: function yy(dateObj) {
732
- return pad(String(dateObj.getFullYear()), 4).substr(2);
733
- },
734
- yyyy: function yyyy(dateObj) {
735
- return pad(dateObj.getFullYear(), 4);
736
- },
737
- h: function h(dateObj) {
738
- return dateObj.getHours() % 12 || 12;
739
- },
740
- hh: function hh(dateObj) {
741
- return pad(dateObj.getHours() % 12 || 12);
742
- },
743
- H: function H(dateObj) {
744
- return dateObj.getHours();
745
- },
746
- HH: function HH(dateObj) {
747
- return pad(dateObj.getHours());
748
- },
749
- m: function m(dateObj) {
750
- return dateObj.getMinutes();
751
- },
752
- mm: function mm(dateObj) {
753
- return pad(dateObj.getMinutes());
754
- },
755
- s: function s(dateObj) {
756
- return dateObj.getSeconds();
757
- },
758
- ss: function ss(dateObj) {
759
- return pad(dateObj.getSeconds());
760
- },
761
- S: function S(dateObj) {
762
- return Math.round(dateObj.getMilliseconds() / 100);
763
- },
764
- SS: function SS(dateObj) {
765
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
766
- },
767
- SSS: function SSS(dateObj) {
768
- return pad(dateObj.getMilliseconds(), 3);
769
- },
770
- a: function a(dateObj) {
771
- return dateObj.getHours() < 12 ? '上午' : '下午';
772
- },
773
- A: function A(dateObj) {
774
- return dateObj.getHours() < 12 ? '上午' : '下午';
775
- },
776
- ZZ: function ZZ(dateObj) {
777
- var o = dateObj.getTimezoneOffset();
778
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
779
- }
780
- };
781
-
782
- var parseFlags = {
783
- d: [twoDigits, function (d, v) {
784
- d.day = v;
785
- }],
786
- Do: [twoDigits + word, function (d, v) {
787
- d.day = parseInt(v, 10);
788
- }],
789
- M: [twoDigits, function (d, v) {
790
- d.month = v - 1;
791
- }],
792
- yy: [twoDigits, function (d, v) {
793
- var da = new Date(),
794
- cent = +('' + da.getFullYear()).substr(0, 2);
795
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
796
- }],
797
- h: [twoDigits, function (d, v) {
798
- d.hour = v;
799
- }],
800
- m: [twoDigits, function (d, v) {
801
- d.minute = v;
802
- }],
803
- s: [twoDigits, function (d, v) {
804
- d.second = v;
805
- }],
806
- yyyy: [fourDigits, function (d, v) {
807
- d.year = v;
808
- }],
809
- S: ['\\d', function (d, v) {
810
- d.millisecond = v * 100;
811
- }],
812
- SS: ['\\d{2}', function (d, v) {
813
- d.millisecond = v * 10;
814
- }],
815
- SSS: [threeDigits, function (d, v) {
816
- d.millisecond = v;
817
- }],
818
- D: [twoDigits, noop],
819
- ddd: [word, noop],
820
- MMM: [word, monthUpdate('monthNamesShort')],
821
- MMMM: [word, monthUpdate('monthNames')],
822
- a: [word, function (d, v) {
823
- var val = v.toLowerCase();
824
- if (val === '上午') {
825
- d.isPm = false;
826
- } else if (val === '下午') {
827
- d.isPm = true;
828
- }
829
- }],
830
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
831
- var parts = (v + '').match(/([+-]|\d\d)/gi),
832
- minutes = void 0;
833
-
834
- if (parts) {
835
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
836
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
837
- }
838
- }]
839
- };
840
- parseFlags.dd = parseFlags.d;
841
- parseFlags.dddd = parseFlags.ddd;
842
- parseFlags.DD = parseFlags.D;
843
- parseFlags.mm = parseFlags.m;
844
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
845
- parseFlags.MM = parseFlags.M;
846
- parseFlags.ss = parseFlags.s;
847
- parseFlags.A = parseFlags.a;
848
-
849
- // Some common format strings
850
- fecha.masks = {
851
- default: 'ddd MMM dd yyyy HH:mm:ss',
852
- shortDate: 'M/D/yy',
853
- mediumDate: 'MMM d, yyyy',
854
- longDate: 'MMMM d, yyyy',
855
- fullDate: 'dddd, MMMM d, yyyy',
856
- shortTime: 'HH:mm',
857
- mediumTime: 'HH:mm:ss',
858
- longTime: 'HH:mm:ss.SSS'
859
- };
860
-
674
+ */
675
+ const fecha = {};
676
+ const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
677
+ const twoDigits = '\\d\\d?';
678
+ const threeDigits = '\\d{3}';
679
+ const fourDigits = '\\d{4}';
680
+ const word = '[^\\s]+';
681
+ const literal = /\[([^]*?)\]/gm;
682
+ const noop = function () {};
683
+
684
+ function regexEscape(str) {
685
+ return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
686
+ }
687
+
688
+ function shorten(arr, sLen) {
689
+ const newArr = [];
690
+ for (let i = 0, len = arr.length; i < len; i++) {
691
+ newArr.push(arr[i].substr(0, sLen));
692
+ }
693
+ return newArr;
694
+ }
695
+
696
+ function monthUpdate() {
697
+ return function (d, v) {
698
+ const index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
699
+ if (~index) {
700
+ d.month = index;
701
+ }
702
+ };
703
+ }
704
+
705
+ function pad(val, len) {
706
+ val = String(val);
707
+ len = len || 2;
708
+ while (val.length < len) {
709
+ val = '0' + val;
710
+ }
711
+ return val;
712
+ }
713
+
714
+ // 直接使用中文日期名称常量
715
+ const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
716
+ const monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
717
+ const monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
718
+ const dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
719
+ const amPm = ['上午', '下午'];
720
+ const DoFn = function DoFn(D) {
721
+ return D + '日';
722
+ };
723
+
724
+ const formatFlags = {
725
+ D: function(dateObj) {
726
+ return dateObj.getDay();
727
+ },
728
+ DD: function(dateObj) {
729
+ return pad(dateObj.getDay());
730
+ },
731
+ Do: function(dateObj) {
732
+ return DoFn(dateObj.getDate());
733
+ },
734
+ d: function(dateObj) {
735
+ return dateObj.getDate();
736
+ },
737
+ dd: function(dateObj) {
738
+ return pad(dateObj.getDate());
739
+ },
740
+ ddd: function(dateObj) {
741
+ return dayNamesShort[dateObj.getDay()];
742
+ },
743
+ dddd: function(dateObj) {
744
+ return dayNames[dateObj.getDay()];
745
+ },
746
+ M: function(dateObj) {
747
+ return dateObj.getMonth() + 1;
748
+ },
749
+ MM: function(dateObj) {
750
+ return pad(dateObj.getMonth() + 1);
751
+ },
752
+ MMM: function(dateObj) {
753
+ return monthNamesShort[dateObj.getMonth()];
754
+ },
755
+ MMMM: function(dateObj) {
756
+ return monthNames[dateObj.getMonth()];
757
+ },
758
+ yy: function(dateObj) {
759
+ return pad(String(dateObj.getFullYear()), 4).substr(2);
760
+ },
761
+ yyyy: function(dateObj) {
762
+ return pad(dateObj.getFullYear(), 4);
763
+ },
764
+ h: function(dateObj) {
765
+ return dateObj.getHours() % 12 || 12;
766
+ },
767
+ hh: function(dateObj) {
768
+ return pad(dateObj.getHours() % 12 || 12);
769
+ },
770
+ H: function(dateObj) {
771
+ return dateObj.getHours();
772
+ },
773
+ HH: function(dateObj) {
774
+ return pad(dateObj.getHours());
775
+ },
776
+ m: function(dateObj) {
777
+ return dateObj.getMinutes();
778
+ },
779
+ mm: function(dateObj) {
780
+ return pad(dateObj.getMinutes());
781
+ },
782
+ s: function(dateObj) {
783
+ return dateObj.getSeconds();
784
+ },
785
+ ss: function(dateObj) {
786
+ return pad(dateObj.getSeconds());
787
+ },
788
+ S: function(dateObj) {
789
+ return Math.round(dateObj.getMilliseconds() / 100);
790
+ },
791
+ SS: function(dateObj) {
792
+ return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
793
+ },
794
+ SSS: function(dateObj) {
795
+ return pad(dateObj.getMilliseconds(), 3);
796
+ },
797
+ a: function(dateObj) {
798
+ return dateObj.getHours() < 12 ? '上午' : '下午';
799
+ },
800
+ A: function(dateObj) {
801
+ return dateObj.getHours() < 12 ? '上午' : '下午';
802
+ },
803
+ ZZ: function(dateObj) {
804
+ const o = dateObj.getTimezoneOffset();
805
+ return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
806
+ }
807
+ };
808
+
809
+ const parseFlags = {
810
+ d: [twoDigits, function (d, v) {
811
+ d.day = v;
812
+ }],
813
+ Do: [twoDigits + word, function (d, v) {
814
+ d.day = parseInt(v, 10);
815
+ }],
816
+ M: [twoDigits, function (d, v) {
817
+ d.month = v - 1;
818
+ }],
819
+ yy: [twoDigits, function (d, v) {
820
+ const da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
821
+ d.year = '' + (v > 68 ? cent - 1 : cent) + v;
822
+ }],
823
+ h: [twoDigits, function (d, v) {
824
+ d.hour = v;
825
+ }],
826
+ m: [twoDigits, function (d, v) {
827
+ d.minute = v;
828
+ }],
829
+ s: [twoDigits, function (d, v) {
830
+ d.second = v;
831
+ }],
832
+ yyyy: [fourDigits, function (d, v) {
833
+ d.year = v;
834
+ }],
835
+ S: ['\\d', function (d, v) {
836
+ d.millisecond = v * 100;
837
+ }],
838
+ SS: ['\\d{2}', function (d, v) {
839
+ d.millisecond = v * 10;
840
+ }],
841
+ SSS: [threeDigits, function (d, v) {
842
+ d.millisecond = v;
843
+ }],
844
+ D: [twoDigits, noop],
845
+ ddd: [word, noop],
846
+ MMM: [word, monthUpdate('monthNamesShort')],
847
+ MMMM: [word, monthUpdate('monthNames')],
848
+ a: [word, function (d, v) {
849
+ const val = v.toLowerCase();
850
+ if (val === '上午') {
851
+ d.isPm = false;
852
+ } else if (val === '下午') {
853
+ d.isPm = true;
854
+ }
855
+ }],
856
+ ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
857
+ let parts = (v + '').match(/([+-]|\d\d)/gi), minutes;
858
+
859
+ if (parts) {
860
+ minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
861
+ d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
862
+ }
863
+ }]
864
+ };
865
+ parseFlags.dd = parseFlags.d;
866
+ parseFlags.dddd = parseFlags.ddd;
867
+ parseFlags.DD = parseFlags.D;
868
+ parseFlags.mm = parseFlags.m;
869
+ parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
870
+ parseFlags.MM = parseFlags.M;
871
+ parseFlags.ss = parseFlags.s;
872
+ parseFlags.A = parseFlags.a;
873
+
874
+
875
+ // Some common format strings
876
+ fecha.masks = {
877
+ default: 'ddd MMM dd yyyy HH:mm:ss',
878
+ shortDate: 'M/D/yy',
879
+ mediumDate: 'MMM d, yyyy',
880
+ longDate: 'MMMM d, yyyy',
881
+ fullDate: 'dddd, MMMM d, yyyy',
882
+ shortTime: 'HH:mm',
883
+ mediumTime: 'HH:mm:ss',
884
+ longTime: 'HH:mm:ss.SSS'
885
+ };
886
+
861
887
  /***
862
888
  * Format a date
863
889
  * @method format
864
890
  * @param {Date|number} dateObj
865
891
  * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
866
- */
867
- fecha.format = function (dateObj, mask) {
868
- if (typeof dateObj === 'number') {
869
- dateObj = new Date(dateObj);
870
- }
871
-
872
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
873
- throw new Error('Invalid Date in fecha.format');
874
- }
875
-
876
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
877
-
878
- var literals = [];
879
-
880
- // Make literals inactive by replacing them with ??
881
- mask = mask.replace(literal, function ($0, $1) {
882
- literals.push($1);
883
- return '@@@';
884
- });
885
- // Apply formatting rules
886
- mask = mask.replace(token, function ($0) {
887
- return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
888
- });
889
- // Inline literal values back into the formatted value
890
- return mask.replace(/@@@/g, function () {
891
- return literals.shift();
892
- });
893
- };
894
-
892
+ */
893
+ fecha.format = function (dateObj, mask) {
894
+ if (typeof dateObj === 'number') {
895
+ dateObj = new Date(dateObj);
896
+ }
897
+
898
+ if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
899
+ throw new Error('Invalid Date in fecha.format');
900
+ }
901
+
902
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
903
+
904
+ const literals = [];
905
+
906
+ // Make literals inactive by replacing them with ??
907
+ mask = mask.replace(literal, function($0, $1) {
908
+ literals.push($1);
909
+ return '@@@';
910
+ });
911
+ // Apply formatting rules
912
+ mask = mask.replace(token, function ($0) {
913
+ return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
914
+ });
915
+ // Inline literal values back into the formatted value
916
+ return mask.replace(/@@@/g, function() {
917
+ return literals.shift();
918
+ });
919
+ };
920
+
895
921
  /**
896
922
  * Parse a date string into an object, changes - into /
897
923
  * @method parse
898
924
  * @param {string} dateStr Date string
899
925
  * @param {string} format Date parse format
900
926
  * @returns {Date|boolean}
901
- */
902
- fecha.parse = function (dateStr, format) {
903
- if (typeof format !== 'string') {
904
- throw new Error('Invalid format in fecha.parse');
905
- }
906
-
907
- format = fecha.masks[format] || format;
908
-
909
- // Avoid regular expression denial of service, fail early for really long strings
910
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
911
- if (dateStr.length > 1000) {
912
- return null;
913
- }
914
-
915
- var dateInfo = {};
916
- var parseInfo = [];
917
- var literals = [];
918
- format = format.replace(literal, function ($0, $1) {
919
- literals.push($1);
920
- return '@@@';
921
- });
922
- var newFormat = regexEscape(format).replace(token, function ($0) {
923
- if (parseFlags[$0]) {
924
- var info = parseFlags[$0];
925
- parseInfo.push(info[1]);
926
- return '(' + info[0] + ')';
927
- }
928
-
929
- return $0;
930
- });
931
- newFormat = newFormat.replace(/@@@/g, function () {
932
- return literals.shift();
933
- });
934
- var matches = dateStr.match(new RegExp(newFormat, 'i'));
935
- if (!matches) {
936
- return null;
937
- }
938
-
939
- for (var i = 1; i < matches.length; i++) {
940
- parseInfo[i - 1](dateInfo, matches[i]);
941
- }
942
-
943
- var today = new Date();
944
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
945
- dateInfo.hour = +dateInfo.hour + 12;
946
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
947
- dateInfo.hour = 0;
948
- }
949
-
950
- var date = void 0;
951
- if (dateInfo.timezoneOffset != null) {
952
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
953
- 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));
954
- } else {
955
- 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);
956
- }
957
- return date;
958
- };
959
-
960
- // 导出fecha对象
961
-
962
-
963
- // 以下是从date-util.js合并的函数
964
- var newArray = function newArray(start, end) {
965
- var result = [];
966
- for (var i = start; i <= end; i++) {
967
- result.push(i);
968
- }
969
- return result;
970
- };
971
-
972
- var getSettings = function getSettings() {
973
- return {
974
- dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
975
- dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
976
- monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
977
- monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
978
- amPm: ['上午', '下午']
979
- };
980
- };
981
-
982
- var toDate = function toDate(date) {
983
- return isDate(date) ? new Date(date) : null;
984
- };
985
-
986
- var isDate = function isDate(date) {
987
- if (date === null || date === undefined) return false;
988
- if (isNaN(new Date(date).getTime())) return false;
989
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
990
- return true;
991
- };
992
-
993
- var isDateObject = function isDateObject(val) {
994
- return val instanceof Date;
995
- };
996
-
997
- var formatDate = function formatDate(date) {
998
- var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
999
-
1000
- // 处理多种输入类型
1001
- if (!date) return '';
1002
-
1003
- // 如果是时间戳,转成日期对象
1004
- if (typeof date === 'number') {
1005
- date = new Date(date);
1006
- }
1007
- // 如果是字符串,转成日期对象
1008
- if (typeof date === 'string') {
1009
- date = new Date(date);
1010
- }
1011
-
1012
- // 调用toDate进一步验证和转换
1013
- date = toDate(date);
1014
- if (!date) return '';
1015
-
1016
- // 兼容大写和小写的格式标记
1017
- // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
1018
- var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
1019
-
1020
- // 使用fecha库进行格式化,支持中文配置
1021
- var str = fecha.format(date, lowercaseFormat, getSettings());
1022
- return str;
1023
- };
1024
-
1025
- var parseDate = function parseDate(string, format) {
1026
- return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
1027
- };
1028
-
1029
- var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
1030
- if (month === 3 || month === 5 || month === 8 || month === 10) {
1031
- return 30;
1032
- }
1033
-
1034
- if (month === 1) {
1035
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
1036
- return 29;
1037
- } else {
1038
- return 28;
1039
- }
1040
- }
1041
-
1042
- return 31;
1043
- };
1044
-
1045
- var getDayCountOfYear = function getDayCountOfYear(year) {
1046
- var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
1047
- return isLeapYear ? 366 : 365;
1048
- };
1049
-
1050
- var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
1051
- var temp = new Date(date.getTime());
1052
- temp.setDate(1);
1053
- return temp.getDay();
1054
- };
1055
-
1056
- // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
1057
- // {prev, next} Date should work for Daylight Saving Time
1058
- // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
1059
- var prevDate = function prevDate(date) {
1060
- var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1061
-
1062
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
1063
- };
1064
-
1065
- var nextDate = function nextDate(date) {
1066
- var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1067
-
1068
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
1069
- };
1070
-
1071
- var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
1072
- var result = new Date(year, month, 1);
1073
- var day = result.getDay();
1074
-
1075
- if (day === 0) {
1076
- return prevDate(result, 7);
1077
- } else {
1078
- return prevDate(result, day);
1079
- }
1080
- };
1081
-
1082
- var getWeekNumber = function getWeekNumber(date) {
1083
- // 支持多种输入类型
1084
- if (!date || !isDate(date)) {
1085
- date = new Date();
1086
- }
1087
- if (typeof date === 'string') {
1088
- date = new Date(date);
1089
- }
1090
-
1091
- // 验证日期有效性
1092
- if (!isDate(date)) return null;
1093
-
1094
- var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
1095
- // 设置为最近的星期四:当前日期 + 4 - 当前星期数
1096
- // 将星期日的星期数设为7
1097
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
1098
- // 获取当年的第一天
1099
- var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
1100
- // 计算到最近的星期四的完整周数
1101
- var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
1102
- // 返回周数
1103
- return weekNo;
1104
- };
1105
-
1106
- var getRangeHours = function getRangeHours(ranges) {
1107
- var hours = [];
1108
- var disabledHours = [];
1109
-
1110
- (ranges || []).forEach(function (range) {
1111
- var value = range.map(function (date) {
1112
- return date.getHours();
1113
- });
1114
-
1115
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
1116
- });
1117
-
1118
- if (disabledHours.length) {
1119
- for (var i = 0; i < 24; i++) {
1120
- hours[i] = disabledHours.indexOf(i) === -1;
1121
- }
1122
- } else {
1123
- for (var _i = 0; _i < 24; _i++) {
1124
- hours[_i] = false;
1125
- }
1126
- }
1127
-
1128
- return hours;
1129
- };
1130
-
1131
- var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
1132
- if (amount <= 0) return [];
1133
- var temp = new Date(date.getTime());
1134
- temp.setDate(0);
1135
- var lastDay = temp.getDate();
1136
- return range(amount).map(function (_, index) {
1137
- return lastDay - (amount - index - 1);
1138
- });
1139
- };
1140
-
1141
- var getMonthDays = function getMonthDays(date) {
1142
- var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
1143
- var days = temp.getDate();
1144
- return range(days).map(function (_, index) {
1145
- return index + 1;
1146
- });
1147
- };
1148
-
1149
- function setRangeData(arr, start, end, value) {
1150
- for (var i = start; i < end; i++) {
1151
- arr[i] = value;
1152
- }
1153
- }
1154
-
1155
- var getRangeMinutes = function getRangeMinutes(ranges, hour) {
1156
- var minutes = new Array(60);
1157
-
1158
- if (ranges.length > 0) {
1159
- ranges.forEach(function (range) {
1160
- var start = range[0];
1161
- var end = range[1];
1162
- var startHour = start.getHours();
1163
- var startMinute = start.getMinutes();
1164
- var endHour = end.getHours();
1165
- var endMinute = end.getMinutes();
1166
- if (startHour === hour && endHour !== hour) {
1167
- setRangeData(minutes, startMinute, 60, true);
1168
- } else if (startHour === hour && endHour === hour) {
1169
- setRangeData(minutes, startMinute, endMinute + 1, true);
1170
- } else if (startHour !== hour && endHour === hour) {
1171
- setRangeData(minutes, 0, endMinute + 1, true);
1172
- } else if (startHour < hour && endHour > hour) {
1173
- setRangeData(minutes, 0, 60, true);
1174
- }
1175
- });
1176
- } else {
1177
- setRangeData(minutes, 0, 60, true);
1178
- }
1179
- return minutes;
1180
- };
1181
-
1182
- var range = function range(n) {
1183
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
1184
- return Array.apply(null, { length: n }).map(function (_, n) {
1185
- return n;
1186
- });
1187
- };
1188
-
1189
- var modifyDate = function modifyDate(date, y, m, d) {
1190
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
1191
- };
1192
-
1193
- var modifyTime = function modifyTime(date, h, m, s) {
1194
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
1195
- };
1196
-
1197
- var modifyWithTimeString = function modifyWithTimeString(date, time) {
1198
- if (date == null || !time) {
1199
- return date;
1200
- }
1201
- time = parseDate(time, 'HH:mm:ss');
1202
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
1203
- };
1204
-
1205
- var clearTime = function clearTime(date) {
1206
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
1207
- };
1208
-
1209
- var clearMilliseconds = function clearMilliseconds(date) {
1210
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
1211
- };
1212
-
1213
- var limitTimeRange = function limitTimeRange(date, ranges) {
1214
- var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
1215
-
1216
- // TODO: refactory a more elegant solution
1217
- if (ranges.length === 0) return date;
1218
- var normalizeDate = function normalizeDate(date) {
1219
- return fecha.parse(fecha.format(date, format), format);
1220
- };
1221
- var ndate = normalizeDate(date);
1222
- var nranges = ranges.map(function (range) {
1223
- return range.map(normalizeDate);
1224
- });
1225
- if (nranges.some(function (nrange) {
1226
- return ndate >= nrange[0] && ndate <= nrange[1];
1227
- })) return date;
1228
-
1229
- var minDate = nranges[0][0];
1230
- var maxDate = nranges[0][0];
1231
-
1232
- nranges.forEach(function (nrange) {
1233
- minDate = new Date(Math.min(nrange[0], minDate));
1234
- maxDate = new Date(Math.max(nrange[1], minDate));
1235
- });
1236
-
1237
- var ret = ndate < minDate ? minDate : maxDate;
1238
- // preserve Year/Month/Date
1239
- return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
1240
- };
1241
-
1242
- var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
1243
- var limitedDate = limitTimeRange(date, selectableRange, format);
1244
- return limitedDate.getTime() === date.getTime();
1245
- };
1246
-
1247
- var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
1248
- // clamp date to the number of days in `year`, `month`
1249
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
1250
- var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
1251
- return modifyDate(date, year, month, monthDate);
1252
- };
1253
-
1254
- var prevMonth = function prevMonth(date) {
1255
- var year = date.getFullYear();
1256
- var month = date.getMonth();
1257
- return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
1258
- };
1259
-
1260
- var nextMonth = function nextMonth(date) {
1261
- var year = date.getFullYear();
1262
- var month = date.getMonth();
1263
- return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
1264
- };
1265
-
1266
- var prevYear = function prevYear(date) {
1267
- var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1268
-
1269
- var year = date.getFullYear();
1270
- var month = date.getMonth();
1271
- return changeYearMonthAndClampDate(date, year - amount, month);
1272
- };
1273
-
1274
- var nextYear = function nextYear(date) {
1275
- var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1276
-
1277
- var year = date.getFullYear();
1278
- var month = date.getMonth();
1279
- return changeYearMonthAndClampDate(date, year + amount, month);
1280
- };
1281
-
1282
- var extractDateFormat = function extractDateFormat(format) {
1283
- return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
1284
- };
1285
-
1286
- var extractTimeFormat = function extractTimeFormat(format) {
1287
- return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
1288
- };
1289
-
1290
- var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
1291
- return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
1292
- };
1293
-
927
+ */
928
+ fecha.parse = function (dateStr, format) {
929
+ if (typeof format !== 'string') {
930
+ throw new Error('Invalid format in fecha.parse');
931
+ }
932
+
933
+ format = fecha.masks[format] || format;
934
+
935
+ // Avoid regular expression denial of service, fail early for really long strings
936
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
937
+ if (dateStr.length > 1000) {
938
+ return null;
939
+ }
940
+
941
+ const dateInfo = {};
942
+ const parseInfo = [];
943
+ const literals = [];
944
+ format = format.replace(literal, function($0, $1) {
945
+ literals.push($1);
946
+ return '@@@';
947
+ });
948
+ let newFormat = regexEscape(format).replace(token, function ($0) {
949
+ if (parseFlags[$0]) {
950
+ const info = parseFlags[$0];
951
+ parseInfo.push(info[1]);
952
+ return '(' + info[0] + ')';
953
+ }
954
+
955
+ return $0;
956
+ });
957
+ newFormat = newFormat.replace(/@@@/g, function() {
958
+ return literals.shift();
959
+ });
960
+ const matches = dateStr.match(new RegExp(newFormat, 'i'));
961
+ if (!matches) {
962
+ return null;
963
+ }
964
+
965
+ for (let i = 1; i < matches.length; i++) {
966
+ parseInfo[i - 1](dateInfo, matches[i]);
967
+ }
968
+
969
+ const today = new Date();
970
+ if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
971
+ dateInfo.hour = +dateInfo.hour + 12;
972
+ } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
973
+ dateInfo.hour = 0;
974
+ }
975
+
976
+ let date;
977
+ if (dateInfo.timezoneOffset != null) {
978
+ dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
979
+ date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
980
+ dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
981
+ } else {
982
+ date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
983
+ dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
984
+ }
985
+ return date;
986
+ };
987
+
988
+ // 导出fecha对象
989
+
990
+
991
+ // 以下是从date-util.js合并的函数
992
+ const newArray = function(start, end) {
993
+ let result = [];
994
+ for (let i = start; i <= end; i++) {
995
+ result.push(i);
996
+ }
997
+ return result;
998
+ };
999
+
1000
+ const getSettings = () => {
1001
+ return {
1002
+ dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
1003
+ dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
1004
+ monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
1005
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
1006
+ amPm: ['上午', '下午']
1007
+ };
1008
+ };
1009
+
1010
+ const toDate = function(date) {
1011
+ return isDate(date) ? new Date(date) : null;
1012
+ };
1013
+
1014
+ const isDate = function(date) {
1015
+ if (date === null || date === undefined) return false;
1016
+ if (isNaN(new Date(date).getTime())) return false;
1017
+ if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
1018
+ return true;
1019
+ };
1020
+
1021
+ const isDateObject = function(val) {
1022
+ return val instanceof Date;
1023
+ };
1024
+
1025
+ const formatDate = function (date, format = 'yyyy-MM-dd') {
1026
+ // 处理多种输入类型
1027
+ if (!date) return '';
1028
+
1029
+ // 如果是时间戳,转成日期对象
1030
+ if (typeof date === 'number') {
1031
+ date = new Date(date);
1032
+ }
1033
+ // 如果是字符串,转成日期对象
1034
+ if (typeof date === 'string') {
1035
+ date = new Date(date);
1036
+ }
1037
+
1038
+ // 调用toDate进一步验证和转换
1039
+ date = toDate(date);
1040
+ if (!date) return '';
1041
+
1042
+ // 兼容大写和小写的格式标记
1043
+ // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
1044
+ const lowercaseFormat = format
1045
+ .replace(/YYYY/g, 'yyyy')
1046
+ .replace(/D/g, 'd')
1047
+
1048
+ // 使用fecha库进行格式化,支持中文配置
1049
+ const str = fecha.format(date, lowercaseFormat, getSettings());
1050
+ return str;
1051
+ };
1052
+
1053
+ const parseDate = function(string, format) {
1054
+ return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
1055
+ };
1056
+
1057
+ const getDayCountOfMonth = function(year, month) {
1058
+ if (month === 3 || month === 5 || month === 8 || month === 10) {
1059
+ return 30;
1060
+ }
1061
+
1062
+ if (month === 1) {
1063
+ if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
1064
+ return 29;
1065
+ } else {
1066
+ return 28;
1067
+ }
1068
+ }
1069
+
1070
+ return 31;
1071
+ };
1072
+
1073
+ const getDayCountOfYear = function(year) {
1074
+ const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
1075
+ return isLeapYear ? 366 : 365;
1076
+ };
1077
+
1078
+ const getFirstDayOfMonth = function(date) {
1079
+ const temp = new Date(date.getTime());
1080
+ temp.setDate(1);
1081
+ return temp.getDay();
1082
+ };
1083
+
1084
+ // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
1085
+ // {prev, next} Date should work for Daylight Saving Time
1086
+ // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
1087
+ const prevDate = function(date, amount = 1) {
1088
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
1089
+ };
1090
+
1091
+ const nextDate = function(date, amount = 1) {
1092
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
1093
+ };
1094
+
1095
+ const getStartDateOfMonth = function(year, month) {
1096
+ const result = new Date(year, month, 1);
1097
+ const day = result.getDay();
1098
+
1099
+ if (day === 0) {
1100
+ return prevDate(result, 7);
1101
+ } else {
1102
+ return prevDate(result, day);
1103
+ }
1104
+ };
1105
+
1106
+ const getWeekNumber = function(date) {
1107
+ // 支持多种输入类型
1108
+ if (!date||!isDate(date)) {
1109
+ date = new Date();
1110
+ }
1111
+ if (typeof date === 'string') {
1112
+ date = new Date(date);
1113
+ }
1114
+
1115
+ // 验证日期有效性
1116
+ if (!isDate(date)) return null;
1117
+
1118
+ const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
1119
+ // 设置为最近的星期四:当前日期 + 4 - 当前星期数
1120
+ // 将星期日的星期数设为7
1121
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
1122
+ // 获取当年的第一天
1123
+ const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
1124
+ // 计算到最近的星期四的完整周数
1125
+ const weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
1126
+ // 返回周数
1127
+ return weekNo;
1128
+ };
1129
+
1130
+ const getRangeHours = function(ranges) {
1131
+ const hours = [];
1132
+ let disabledHours = [];
1133
+
1134
+ (ranges || []).forEach(range => {
1135
+ const value = range.map(date => date.getHours());
1136
+
1137
+ disabledHours = disabledHours.concat(newArray(value[0], value[1]));
1138
+ });
1139
+
1140
+ if (disabledHours.length) {
1141
+ for (let i = 0; i < 24; i++) {
1142
+ hours[i] = disabledHours.indexOf(i) === -1;
1143
+ }
1144
+ } else {
1145
+ for (let i = 0; i < 24; i++) {
1146
+ hours[i] = false;
1147
+ }
1148
+ }
1149
+
1150
+ return hours;
1151
+ };
1152
+
1153
+ const getPrevMonthLastDays = (date, amount) => {
1154
+ if (amount <= 0) return [];
1155
+ const temp = new Date(date.getTime());
1156
+ temp.setDate(0);
1157
+ const lastDay = temp.getDate();
1158
+ return range(amount).map((_, index) => lastDay - (amount - index - 1));
1159
+ };
1160
+
1161
+ const getMonthDays = (date) => {
1162
+ const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
1163
+ const days = temp.getDate();
1164
+ return range(days).map((_, index) => index + 1);
1165
+ };
1166
+
1167
+ function setRangeData(arr, start, end, value) {
1168
+ for (let i = start; i < end; i++) {
1169
+ arr[i] = value;
1170
+ }
1171
+ }
1172
+
1173
+ const getRangeMinutes = function(ranges, hour) {
1174
+ const minutes = new Array(60);
1175
+
1176
+ if (ranges.length > 0) {
1177
+ ranges.forEach(range => {
1178
+ const start = range[0];
1179
+ const end = range[1];
1180
+ const startHour = start.getHours();
1181
+ const startMinute = start.getMinutes();
1182
+ const endHour = end.getHours();
1183
+ const endMinute = end.getMinutes();
1184
+ if (startHour === hour && endHour !== hour) {
1185
+ setRangeData(minutes, startMinute, 60, true);
1186
+ } else if (startHour === hour && endHour === hour) {
1187
+ setRangeData(minutes, startMinute, endMinute + 1, true);
1188
+ } else if (startHour !== hour && endHour === hour) {
1189
+ setRangeData(minutes, 0, endMinute + 1, true);
1190
+ } else if (startHour < hour && endHour > hour) {
1191
+ setRangeData(minutes, 0, 60, true);
1192
+ }
1193
+ });
1194
+ } else {
1195
+ setRangeData(minutes, 0, 60, true);
1196
+ }
1197
+ return minutes;
1198
+ };
1199
+
1200
+ const range = function(n) {
1201
+ // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
1202
+ return Array.apply(null, {length: n}).map((_, n) => n);
1203
+ };
1204
+
1205
+ const modifyDate = function(date, y, m, d) {
1206
+ return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
1207
+ };
1208
+
1209
+ const modifyTime = function(date, h, m, s) {
1210
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
1211
+ };
1212
+
1213
+ const modifyWithTimeString = (date, time) => {
1214
+ if (date == null || !time) {
1215
+ return date;
1216
+ }
1217
+ time = parseDate(time, 'HH:mm:ss');
1218
+ return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
1219
+ };
1220
+
1221
+ const clearTime = function(date) {
1222
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
1223
+ };
1224
+
1225
+ const clearMilliseconds = function(date) {
1226
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
1227
+ };
1228
+
1229
+ const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
1230
+ // TODO: refactory a more elegant solution
1231
+ if (ranges.length === 0) return date;
1232
+ const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
1233
+ const ndate = normalizeDate(date);
1234
+ const nranges = ranges.map(range => range.map(normalizeDate));
1235
+ if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
1236
+
1237
+ let minDate = nranges[0][0];
1238
+ let maxDate = nranges[0][0];
1239
+
1240
+ nranges.forEach(nrange => {
1241
+ minDate = new Date(Math.min(nrange[0], minDate));
1242
+ maxDate = new Date(Math.max(nrange[1], minDate));
1243
+ });
1244
+
1245
+ const ret = ndate < minDate ? minDate : maxDate;
1246
+ // preserve Year/Month/Date
1247
+ return modifyDate(
1248
+ ret,
1249
+ date.getFullYear(),
1250
+ date.getMonth(),
1251
+ date.getDate()
1252
+ );
1253
+ };
1254
+
1255
+ const timeWithinRange = function(date, selectableRange, format) {
1256
+ const limitedDate = limitTimeRange(date, selectableRange, format);
1257
+ return limitedDate.getTime() === date.getTime();
1258
+ };
1259
+
1260
+ const changeYearMonthAndClampDate = function(date, year, month) {
1261
+ // clamp date to the number of days in `year`, `month`
1262
+ // eg: (2010-1-31, 2010, 2) => 2010-2-28
1263
+ const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
1264
+ return modifyDate(date, year, month, monthDate);
1265
+ };
1266
+
1267
+ const prevMonth = function(date) {
1268
+ const year = date.getFullYear();
1269
+ const month = date.getMonth();
1270
+ return month === 0
1271
+ ? changeYearMonthAndClampDate(date, year - 1, 11)
1272
+ : changeYearMonthAndClampDate(date, year, month - 1);
1273
+ };
1274
+
1275
+ const nextMonth = function(date) {
1276
+ const year = date.getFullYear();
1277
+ const month = date.getMonth();
1278
+ return month === 11
1279
+ ? changeYearMonthAndClampDate(date, year + 1, 0)
1280
+ : changeYearMonthAndClampDate(date, year, month + 1);
1281
+ };
1282
+
1283
+ const prevYear = function(date, amount = 1) {
1284
+ const year = date.getFullYear();
1285
+ const month = date.getMonth();
1286
+ return changeYearMonthAndClampDate(date, year - amount, month);
1287
+ };
1288
+
1289
+ const nextYear = function(date, amount = 1) {
1290
+ const year = date.getFullYear();
1291
+ const month = date.getMonth();
1292
+ return changeYearMonthAndClampDate(date, year + amount, month);
1293
+ };
1294
+
1295
+ const extractDateFormat = function(format) {
1296
+ return format
1297
+ .replace(/\W?m{1,2}|\W?ZZ/g, '')
1298
+ .replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
1299
+ .trim();
1300
+ };
1301
+
1302
+ const extractTimeFormat = function(format) {
1303
+ return format
1304
+ .replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
1305
+ .trim();
1306
+ };
1307
+
1308
+ const validateRangeInOneMonth = function(start, end) {
1309
+ return (start.getMonth() === end.getMonth()) && (start.getFullYear() === end.getFullYear());
1310
+ };
1311
+
1294
1312
  /**
1295
1313
  * 计算两个日期之间的工作日数量(不包括周末和节假日)
1296
1314
  * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
1297
1315
  * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
1298
1316
  * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
1299
1317
  * @returns {number} 工作日数量
1300
- */
1301
- var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
1302
- var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1303
-
1304
- if (typeof start_date !== 'string' || typeof end_date !== 'string') {
1305
- throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
1306
- }
1307
-
1308
- var startDateObj = new Date(start_date);
1309
- var endDateObj = new Date(end_date);
1310
-
1311
- if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
1312
- throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
1313
- }
1314
-
1315
- if (startDateObj > endDateObj) {
1316
- throw new Error('Start date should be earlier than or equal to end date.');
1317
- }
1318
-
1319
- var workdays = 0;
1320
-
1321
- // Iterate through each day in the date range
1322
-
1323
- var _loop = function _loop(currentDate) {
1324
- // Check if the current day is a weekend (Saturday or Sunday)
1325
- var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
1326
-
1327
- // Check if the current day is a holiday
1328
- var isHoliday = holidays.some(function (holiday) {
1329
- var holidayDate = new Date(holiday);
1330
- return currentDate.toDateString() === holidayDate.toDateString();
1331
- });
1332
-
1333
- // If it's a workday (not a weekend or holiday), increment the workdays count
1334
- if (!isWeekend && !isHoliday) {
1335
- workdays++;
1336
- }
1337
- };
1338
-
1339
- for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
1340
- _loop(currentDate);
1341
- }
1342
-
1343
- return workdays;
1344
- };
1345
-
1318
+ */
1319
+ const calculateNetworkDays = function (start_date, end_date, holidays = []) {
1320
+ if (typeof start_date !== 'string' || typeof end_date !== 'string') {
1321
+ throw new Error(
1322
+ "Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'."
1323
+ );
1324
+ }
1325
+
1326
+ const startDateObj = new Date(start_date);
1327
+ const endDateObj = new Date(end_date);
1328
+
1329
+ if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
1330
+ throw new Error(
1331
+ "Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'."
1332
+ );
1333
+ }
1334
+
1335
+ if (startDateObj > endDateObj) {
1336
+ throw new Error('Start date should be earlier than or equal to end date.');
1337
+ }
1338
+
1339
+ let workdays = 0;
1340
+
1341
+ // Iterate through each day in the date range
1342
+ for (
1343
+ let currentDate = new Date(startDateObj);
1344
+ currentDate <= endDateObj;
1345
+ currentDate.setDate(currentDate.getDate() + 1)
1346
+ ) {
1347
+ // Check if the current day is a weekend (Saturday or Sunday)
1348
+ const isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
1349
+
1350
+ // Check if the current day is a holiday
1351
+ const isHoliday = holidays.some((holiday) => {
1352
+ const holidayDate = new Date(holiday);
1353
+ return currentDate.toDateString() === holidayDate.toDateString();
1354
+ });
1355
+
1356
+ // If it's a workday (not a weekend or holiday), increment the workdays count
1357
+ if (!isWeekend && !isHoliday) {
1358
+ workdays++;
1359
+ }
1360
+ }
1361
+
1362
+ return workdays;
1363
+ };
1364
+
1346
1365
  /**
1347
1366
  * 日期加减天数
1348
1367
  * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
1349
1368
  * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
1350
1369
  * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
1351
- */
1352
- var dateAddDays = function dateAddDays(start_date, days) {
1353
- if (typeof start_date !== 'string' || !Number.isInteger(days)) {
1354
- 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.");
1355
- }
1356
-
1357
- var startDateObj = new Date(start_date);
1358
- if (isNaN(startDateObj.getTime())) {
1359
- throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
1360
- }
1361
-
1362
- var resultDateObj = new Date(startDateObj);
1363
- resultDateObj.setDate(resultDateObj.getDate() + days);
1364
-
1365
- var resultYear = resultDateObj.getFullYear();
1366
- var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
1367
- var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
1368
-
1369
- return resultYear + '-' + resultMonth + '-' + resultDay;
1370
- };
1371
-
1370
+ */
1371
+ const dateAddDays = function (start_date, days) {
1372
+ if (typeof start_date !== 'string' || !Number.isInteger(days)) {
1373
+ throw new Error(
1374
+ "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days."
1375
+ );
1376
+ }
1377
+
1378
+ const startDateObj = new Date(start_date);
1379
+ if (isNaN(startDateObj.getTime())) {
1380
+ throw new Error(
1381
+ "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
1382
+ );
1383
+ }
1384
+
1385
+ const resultDateObj = new Date(startDateObj);
1386
+ resultDateObj.setDate(resultDateObj.getDate() + days);
1387
+
1388
+ const resultYear = resultDateObj.getFullYear();
1389
+ const resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
1390
+ const resultDay = String(resultDateObj.getDate()).padStart(2, '0');
1391
+
1392
+ return `${resultYear}-${resultMonth}-${resultDay}`;
1393
+ };
1394
+
1372
1395
  /**
1373
1396
  * 计算两个日期之间的差值
1374
1397
  * @date 2023年12月14日
@@ -1376,180 +1399,182 @@ var dateAddDays = function dateAddDays(start_date, days) {
1376
1399
  * @param {String} end_date - 结束日期字符串
1377
1400
  * @param {String} unit - 单位:year/month/day
1378
1401
  * @returns {Number} 差值
1379
- */
1380
- var dateDiff = function dateDiff(start_date, end_date) {
1381
- var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
1382
-
1383
- // Assuming date strings are in "YYYY-MM-DD" format
1384
- var startDate = new Date(start_date);
1385
- var endDate = new Date(end_date);
1386
-
1387
- // If the date is invalid, return 0
1388
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
1389
- return 0;
1390
- }
1391
-
1392
- if (unit === 'year') {
1393
- return endDate.getFullYear() - startDate.getFullYear();
1394
- } else if (unit === 'month') {
1395
- return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
1396
- } else {
1397
- // Default to day
1398
- var timeDifference = endDate - startDate;
1399
- // Calculate days (86400000 milliseconds per day)
1400
- return Math.floor(timeDifference / 86400000);
1401
- }
1402
- };
1403
-
1402
+ */
1403
+ const dateDiff = function (start_date, end_date, unit = 'day') {
1404
+ // Assuming date strings are in "YYYY-MM-DD" format
1405
+ var startDate = new Date(start_date);
1406
+ var endDate = new Date(end_date);
1407
+
1408
+ // If the date is invalid, return 0
1409
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
1410
+ return 0;
1411
+ }
1412
+
1413
+ if (unit === 'year') {
1414
+ return endDate.getFullYear() - startDate.getFullYear();
1415
+ } else if (unit === 'month') {
1416
+ return (
1417
+ (endDate.getFullYear() - startDate.getFullYear()) * 12 +
1418
+ (endDate.getMonth() - startDate.getMonth())
1419
+ );
1420
+ } else {
1421
+ // Default to day
1422
+ var timeDifference = endDate - startDate;
1423
+ // Calculate days (86400000 milliseconds per day)
1424
+ return Math.floor(timeDifference / 86400000);
1425
+ }
1426
+ };
1427
+
1404
1428
  /**
1405
1429
  * 获取月份中的日期
1406
1430
  * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
1407
1431
  * @returns {number} 月份中的日期(1-31)
1408
- */
1409
- var dayOfMonth = function dayOfMonth(date) {
1410
- if (typeof date !== 'string') {
1411
- throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
1412
- }
1413
-
1414
- var dateObj = new Date(date);
1415
- if (isNaN(dateObj.getTime())) {
1416
- throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
1417
- }
1418
-
1419
- return dateObj.getDate();
1420
- };
1421
-
1432
+ */
1433
+ const dayOfMonth = function (date) {
1434
+ if (typeof date !== 'string') {
1435
+ throw new Error(
1436
+ "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'."
1437
+ );
1438
+ }
1439
+
1440
+ const dateObj = new Date(date);
1441
+ if (isNaN(dateObj.getTime())) {
1442
+ throw new Error(
1443
+ "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
1444
+ );
1445
+ }
1446
+
1447
+ return dateObj.getDate();
1448
+ };
1449
+
1422
1450
  /**
1423
1451
  * 获取当前日期
1424
1452
  * @date 2022年5月7日
1425
1453
  * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
1426
1454
  * @returns {string} 当前日期的格式化字符串
1427
- */
1428
- var getCurrentDate = function getCurrentDate() {
1429
- var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
1430
-
1431
- return formatDate(new Date(), format);
1432
- };
1433
-
1455
+ */
1456
+ const getCurrentDate = function (format = 'YYYY-MM-DD') {
1457
+ return formatDate(new Date(), format);
1458
+ };
1459
+
1434
1460
  /**
1435
1461
  * 获取当前日期时间
1436
1462
  * @date 2022年5月7日
1437
1463
  * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
1438
1464
  * @returns {string} 当前日期时间的格式化字符串
1439
- */
1440
- var getCurrentDateTime = function getCurrentDateTime() {
1441
- var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
1442
-
1443
- return formatDate(new Date(), format);
1444
- };
1445
-
1465
+ */
1466
+ const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
1467
+ return formatDate(new Date(), format);
1468
+ };
1469
+
1446
1470
  /**
1447
1471
  * 获取小时
1448
1472
  * @date 2022年5月7日
1449
1473
  * @param {Date|string} [date] - 日期对象或日期字符串
1450
1474
  * @returns {number} 小时数(0-23)
1451
- */
1452
- var getHour = function getHour(date) {
1453
- if (!date) {
1454
- return new Date().getHours();
1455
- }
1456
- if (typeof date === 'string') {
1457
- date = new Date(date);
1458
- }
1459
- return date.getHours();
1460
- };
1461
-
1475
+ */
1476
+ const getHour = function (date) {
1477
+ if (!date) {
1478
+ return new Date().getHours();
1479
+ }
1480
+ if (typeof date === 'string') {
1481
+ date = new Date(date);
1482
+ }
1483
+ return date.getHours();
1484
+ };
1485
+
1462
1486
  /**
1463
1487
  * 获取分钟
1464
1488
  * @date 2022年5月7日
1465
1489
  * @param {Date|string} [date] - 日期对象或日期字符串
1466
1490
  * @returns {number} 分钟数(0-59)
1467
- */
1468
- var getMinute = function getMinute(date) {
1469
- if (!date) {
1470
- return new Date().getMinutes();
1471
- }
1472
- if (typeof date === 'string') {
1473
- date = new Date(date);
1474
- }
1475
- return date.getMinutes();
1476
- };
1477
-
1491
+ */
1492
+ const getMinute = function (date) {
1493
+ if (!date) {
1494
+ return new Date().getMinutes();
1495
+ }
1496
+ if (typeof date === 'string') {
1497
+ date = new Date(date);
1498
+ }
1499
+ return date.getMinutes();
1500
+ };
1501
+
1478
1502
  /**
1479
1503
  * 获取月份
1480
1504
  * @date 2022年5月7日
1481
1505
  * @param {Date|string} [date] - 日期对象或日期字符串
1482
1506
  * @returns {number} 月份数(1-12)
1483
- */
1484
- var getMonth = function getMonth(date) {
1485
- if (!date) {
1486
- return new Date().getMonth() + 1;
1487
- }
1488
- if (typeof date === 'string') {
1489
- date = new Date(date);
1490
- }
1491
- return date.getMonth() + 1;
1492
- };
1493
-
1507
+ */
1508
+ const getMonth = function (date) {
1509
+ if (!date) {
1510
+ return new Date().getMonth() + 1;
1511
+ }
1512
+ if (typeof date === 'string') {
1513
+ date = new Date(date);
1514
+ }
1515
+ return date.getMonth() + 1;
1516
+ };
1517
+
1494
1518
  /**
1495
1519
  * 获取秒
1496
1520
  * @date 2022年5月7日
1497
1521
  * @param {Date|string} [date] - 日期对象或日期字符串
1498
1522
  * @returns {number} 秒数(0-59)
1499
- */
1500
- var getSecond = function getSecond(date) {
1501
- if (!date) {
1502
- return new Date().getSeconds();
1503
- }
1504
- if (typeof date === 'string') {
1505
- date = new Date(date);
1506
- }
1507
- return date.getSeconds();
1508
- };
1509
-
1523
+ */
1524
+ const getSecond = function (date) {
1525
+ if (!date) {
1526
+ return new Date().getSeconds();
1527
+ }
1528
+ if (typeof date === 'string') {
1529
+ date = new Date(date);
1530
+ }
1531
+ return date.getSeconds();
1532
+ };
1533
+
1510
1534
  /**
1511
1535
  * 获取星期几
1512
1536
  * @date 2022年5月7日
1513
1537
  * @param {Date|string} [date] - 日期对象或日期字符串
1514
1538
  * @returns {number} 星期几(0-6,0表示星期日)
1515
- */
1516
- var getWeekday = function getWeekday(date) {
1517
- if (!date) {
1518
- return new Date().getDay();
1519
- }
1520
- if (typeof date === 'string') {
1521
- date = new Date(date);
1522
- }
1523
- return date.getDay();
1524
- };
1525
-
1539
+ */
1540
+ const getWeekday = function (date) {
1541
+ if (!date) {
1542
+ return new Date().getDay();
1543
+ }
1544
+ if (typeof date === 'string') {
1545
+ date = new Date(date);
1546
+ }
1547
+ return date.getDay();
1548
+ };
1549
+
1550
+
1526
1551
  /**
1527
1552
  * @desc 获取上午/下午/晚上
1528
1553
  * @author huangbo
1529
1554
  * @date 2022年5月7日
1530
1555
  * @param {String} [time] - 时间
1531
- **/
1532
- var timeCycle = function timeCycle(time) {
1533
- var hour = 0;
1534
- if (!time) {
1535
- hour = new Date().getHours();
1536
- } else if (typeof time === 'string') {
1537
- // 从时间字符串中提取小时
1538
- var match = time.match(/^(\d{1,2})/);
1539
- if (match) {
1540
- hour = parseInt(match[1], 10);
1541
- }
1542
- } else if (typeof time === 'number') {
1543
- hour = time;
1544
- }
1545
- // 判断时间段
1546
- if (hour >= 5 && hour < 12) {
1547
- return '上午';
1548
- } else if (hour >= 12 && hour < 18) {
1549
- return '下午';
1550
- } else {
1551
- return '晚上';
1552
- }
1556
+ **/
1557
+ const timeCycle = function (time) {
1558
+ let hour = 0;
1559
+ if (!time) {
1560
+ hour = new Date().getHours();
1561
+ } else if (typeof time === 'string') {
1562
+ // 从时间字符串中提取小时
1563
+ const match = time.match(/^(\d{1,2})/);
1564
+ if (match) {
1565
+ hour = parseInt(match[1], 10);
1566
+ }
1567
+ } else if (typeof time === 'number') {
1568
+ hour = time;
1569
+ }
1570
+ // 判断时间段
1571
+ if (hour >= 5 && hour < 12) {
1572
+ return '上午';
1573
+ } else if (hour >= 12 && hour < 18) {
1574
+ return '下午';
1575
+ } else {
1576
+ return '晚上';
1577
+ }
1553
1578
  };
1554
1579
 
1555
1580
  /***/ }),
@@ -2254,7 +2279,7 @@ module.exports = require("vue");
2254
2279
 
2255
2280
  "use strict";
2256
2281
 
2257
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=template&id=7f01704e&
2282
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/date-picker/src/picker.vue?vue&type=template&id=684f520c&
2258
2283
  var render = function () {
2259
2284
  var _vm = this
2260
2285
  var _h = _vm.$createElement
@@ -2434,7 +2459,7 @@ var staticRenderFns = []
2434
2459
  render._withStripped = true
2435
2460
 
2436
2461
 
2437
- // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=template&id=7f01704e&
2462
+ // CONCATENATED MODULE: ./packages/date-picker/src/picker.vue?vue&type=template&id=684f520c&
2438
2463
 
2439
2464
  // EXTERNAL MODULE: external "vue"
2440
2465
  var external_vue_ = __webpack_require__(4);
@@ -2453,7 +2478,7 @@ var vue_popper = __webpack_require__(13);
2453
2478
  var emitter = __webpack_require__(10);
2454
2479
 
2455
2480
  // EXTERNAL MODULE: external "eoss/lib/input"
2456
- var input_ = __webpack_require__(17);
2481
+ var input_ = __webpack_require__(18);
2457
2482
  var input_default = /*#__PURE__*/__webpack_require__.n(input_);
2458
2483
 
2459
2484
  // EXTERNAL MODULE: ./src/utils/merge.js
@@ -2860,7 +2885,7 @@ var validator = function validator(val) {
2860
2885
  */
2861
2886
  clearIcon: {
2862
2887
  type: String,
2863
- default: 'es-icon-circle-close'
2888
+ default: 'es-icon-circle-guanbi'
2864
2889
  },
2865
2890
  /**
2866
2891
  * 原生属性
@@ -3643,9 +3668,7 @@ var component = Object(componentNormalizer["a" /* default */])(
3643
3668
  /***/ 42:
3644
3669
  /***/ (function(module, exports, __webpack_require__) {
3645
3670
 
3646
- 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; };
3647
-
3648
- /**
3671
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
3649
3672
  * @fileOverview Kickass library to create and place poppers near their reference elements.
3650
3673
  * @version {{version}}
3651
3674
  * @license
@@ -3668,60 +3691,68 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
3668
3691
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3669
3692
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3670
3693
  * SOFTWARE.
3671
- */
3672
-
3673
- //
3674
- // Cross module loader
3675
- // Supported: Node, AMD, Browser globals
3676
- //
3677
- (function (root, factory) {
3678
- if (true) {
3679
- // AMD. Register as an anonymous module.
3694
+ */
3695
+
3696
+ //
3697
+ // Cross module loader
3698
+ // Supported: Node, AMD, Browser globals
3699
+ //
3700
+ (function (root, factory) {
3701
+ if (true) {
3702
+ // AMD. Register as an anonymous module.
3680
3703
  !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
3681
3704
  __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
3682
3705
  (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
3683
3706
  __WEBPACK_AMD_DEFINE_FACTORY__),
3684
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
3685
- } else {}
3686
- })(this, function () {
3687
- 'use strict';
3688
-
3689
- var root = window;
3690
- // default options
3691
- var DEFAULTS = {
3692
- // placement of the popper
3693
- placement: 'bottom',
3694
-
3695
- gpuAcceleration: true,
3696
-
3697
- // shift popper from its origin by the given amount of pixels (can be negative)
3698
- offset: 0,
3699
-
3700
- // the element which will act as boundary of the popper
3701
- boundariesElement: 'viewport',
3702
-
3703
- // amount of pixel used to define a minimum distance between the boundaries and the popper
3704
- boundariesPadding: 5,
3705
-
3706
- // popper will try to prevent overflow following this order,
3707
- // by default, then, it could overflow on the left and on top of the boundariesElement
3708
- preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
3709
-
3710
- // the behavior used by flip to change the placement of the popper
3711
- flipBehavior: 'flip',
3712
-
3713
- arrowElement: '[x-arrow]',
3714
-
3715
- arrowOffset: 0,
3716
-
3717
- // list of functions used to modify the offsets before they are applied to the popper
3718
- modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
3719
-
3720
- modifiersIgnored: [],
3721
-
3722
- forceAbsolute: false
3723
- };
3724
-
3707
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
3708
+ } else {}
3709
+ })(this, function () {
3710
+ 'use strict';
3711
+
3712
+ var root = window;
3713
+ // default options
3714
+ var DEFAULTS = {
3715
+ // placement of the popper
3716
+ placement: 'bottom',
3717
+
3718
+ gpuAcceleration: true,
3719
+
3720
+ // shift popper from its origin by the given amount of pixels (can be negative)
3721
+ offset: 0,
3722
+
3723
+ // the element which will act as boundary of the popper
3724
+ boundariesElement: 'viewport',
3725
+
3726
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
3727
+ boundariesPadding: 5,
3728
+
3729
+ // popper will try to prevent overflow following this order,
3730
+ // by default, then, it could overflow on the left and on top of the boundariesElement
3731
+ preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
3732
+
3733
+ // the behavior used by flip to change the placement of the popper
3734
+ flipBehavior: 'flip',
3735
+
3736
+ arrowElement: '[x-arrow]',
3737
+
3738
+ arrowOffset: 0,
3739
+
3740
+ // list of functions used to modify the offsets before they are applied to the popper
3741
+ modifiers: [
3742
+ 'shift',
3743
+ 'offset',
3744
+ 'preventOverflow',
3745
+ 'keepTogether',
3746
+ 'arrow',
3747
+ 'flip',
3748
+ 'applyStyle'
3749
+ ],
3750
+
3751
+ modifiersIgnored: [],
3752
+
3753
+ forceAbsolute: false
3754
+ };
3755
+
3725
3756
  /**
3726
3757
  * Create a new Popper.js instance
3727
3758
  * @constructor Popper
@@ -3786,208 +3817,227 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
3786
3817
  *
3787
3818
  * @param {Boolean} [options.removeOnDestroy=false]
3788
3819
  * Set to true if you want to automatically remove the popper when you call the `destroy` method.
3789
- */
3790
- function Popper(reference, popper, options) {
3791
- this._reference = reference.jquery ? reference[0] : reference;
3792
- this.state = {};
3793
-
3794
- // if the popper variable is a configuration object, parse it to generate an HTMLElement
3795
- // generate a default popper if is not defined
3796
- var isNotDefined = typeof popper === 'undefined' || popper === null;
3797
- var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
3798
- if (isNotDefined || isConfig) {
3799
- this._popper = this.parse(isConfig ? popper : {});
3800
- }
3801
- // otherwise, use the given HTMLElement as popper
3802
- else {
3803
- this._popper = popper.jquery ? popper[0] : popper;
3804
- }
3805
-
3806
- // with {} we create a new object with the options inside it
3807
- this._options = Object.assign({}, DEFAULTS, options);
3808
-
3809
- // refactoring modifiers' list
3810
- this._options.modifiers = this._options.modifiers.map(function (modifier) {
3811
- // remove ignored modifiers
3812
- if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
3813
-
3814
- // set the x-placement attribute before everything else because it could be used to add margins to the popper
3815
- // margins needs to be calculated to get the correct popper offsets
3816
- if (modifier === 'applyStyle') {
3817
- this._popper.setAttribute('x-placement', this._options.placement);
3818
- }
3819
-
3820
- // return predefined modifier identified by string or keep the custom one
3821
- return this.modifiers[modifier] || modifier;
3822
- }.bind(this));
3823
-
3824
- // make sure to apply the popper position before any computation
3825
- this.state.position = this._getPosition(this._popper, this._reference);
3826
- setStyle(this._popper, { position: this.state.position, top: 0 });
3827
-
3828
- // fire the first update to position the popper in the right place
3829
- this.update();
3830
-
3831
- // setup event listeners, they will take care of update the position in specific situations
3832
- this._setupEventListeners();
3833
- return this;
3834
- }
3835
-
3836
- //
3837
- // Methods
3838
- //
3820
+ */
3821
+ function Popper(reference, popper, options) {
3822
+ this._reference = reference.jquery ? reference[0] : reference;
3823
+ this.state = {};
3824
+
3825
+ // if the popper variable is a configuration object, parse it to generate an HTMLElement
3826
+ // generate a default popper if is not defined
3827
+ var isNotDefined = typeof popper === 'undefined' || popper === null;
3828
+ var isConfig =
3829
+ popper && Object.prototype.toString.call(popper) === '[object Object]';
3830
+ if (isNotDefined || isConfig) {
3831
+ this._popper = this.parse(isConfig ? popper : {});
3832
+ }
3833
+ // otherwise, use the given HTMLElement as popper
3834
+ else {
3835
+ this._popper = popper.jquery ? popper[0] : popper;
3836
+ }
3837
+
3838
+ // with {} we create a new object with the options inside it
3839
+ this._options = Object.assign({}, DEFAULTS, options);
3840
+
3841
+ // refactoring modifiers' list
3842
+ this._options.modifiers = this._options.modifiers.map(
3843
+ function (modifier) {
3844
+ // remove ignored modifiers
3845
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
3846
+
3847
+ // set the x-placement attribute before everything else because it could be used to add margins to the popper
3848
+ // margins needs to be calculated to get the correct popper offsets
3849
+ if (modifier === 'applyStyle') {
3850
+ this._popper.setAttribute('x-placement', this._options.placement);
3851
+ }
3852
+
3853
+ // return predefined modifier identified by string or keep the custom one
3854
+ return this.modifiers[modifier] || modifier;
3855
+ }.bind(this)
3856
+ );
3857
+
3858
+ // make sure to apply the popper position before any computation
3859
+ this.state.position = this._getPosition(this._popper, this._reference);
3860
+ setStyle(this._popper, { position: this.state.position, top: 0 });
3861
+
3862
+ // fire the first update to position the popper in the right place
3863
+ this.update();
3864
+
3865
+ // setup event listeners, they will take care of update the position in specific situations
3866
+ this._setupEventListeners();
3867
+ return this;
3868
+ }
3869
+
3870
+ //
3871
+ // Methods
3872
+ //
3839
3873
  /**
3840
3874
  * Destroy the popper
3841
3875
  * @method
3842
3876
  * @memberof Popper
3843
- */
3844
- Popper.prototype.destroy = function () {
3845
- this._popper.removeAttribute('x-placement');
3846
- this._popper.style.left = '';
3847
- this._popper.style.position = '';
3848
- this._popper.style.top = '';
3849
- this._popper.style[getSupportedPropertyName('transform')] = '';
3850
- this._removeEventListeners();
3851
-
3852
- // remove the popper if user explicity asked for the deletion on destroy
3853
- if (this._options.removeOnDestroy) {
3854
- this._popper.remove();
3855
- }
3856
- return this;
3857
- };
3858
-
3877
+ */
3878
+ Popper.prototype.destroy = function () {
3879
+ this._popper.removeAttribute('x-placement');
3880
+ this._popper.style.left = '';
3881
+ this._popper.style.position = '';
3882
+ this._popper.style.top = '';
3883
+ this._popper.style[getSupportedPropertyName('transform')] = '';
3884
+ this._removeEventListeners();
3885
+
3886
+ // remove the popper if user explicity asked for the deletion on destroy
3887
+ if (this._options.removeOnDestroy) {
3888
+ this._popper.remove();
3889
+ }
3890
+ return this;
3891
+ };
3892
+
3859
3893
  /**
3860
3894
  * Updates the position of the popper, computing the new offsets and applying the new style
3861
3895
  * @method
3862
3896
  * @memberof Popper
3863
- */
3864
- Popper.prototype.update = function () {
3865
- var data = { instance: this, styles: {} };
3866
-
3867
- // store placement inside the data object, modifiers will be able to edit `placement` if needed
3868
- // and refer to _originalPlacement to know the original value
3869
- data.placement = this._options.placement;
3870
- data._originalPlacement = this._options.placement;
3871
-
3872
- // compute the popper and reference offsets and put them inside data.offsets
3873
- data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
3874
-
3875
- // get boundaries
3876
- data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
3877
-
3878
- data = this.runModifiers(data, this._options.modifiers);
3879
-
3880
- if (typeof this.state.updateCallback === 'function') {
3881
- this.state.updateCallback(data);
3882
- }
3883
- };
3884
-
3897
+ */
3898
+ Popper.prototype.update = function () {
3899
+ var data = { instance: this, styles: {} };
3900
+
3901
+ // store placement inside the data object, modifiers will be able to edit `placement` if needed
3902
+ // and refer to _originalPlacement to know the original value
3903
+ data.placement = this._options.placement;
3904
+ data._originalPlacement = this._options.placement;
3905
+
3906
+ // compute the popper and reference offsets and put them inside data.offsets
3907
+ data.offsets = this._getOffsets(
3908
+ this._popper,
3909
+ this._reference,
3910
+ data.placement
3911
+ );
3912
+
3913
+ // get boundaries
3914
+ data.boundaries = this._getBoundaries(
3915
+ data,
3916
+ this._options.boundariesPadding,
3917
+ this._options.boundariesElement
3918
+ );
3919
+
3920
+ data = this.runModifiers(data, this._options.modifiers);
3921
+
3922
+ if (typeof this.state.updateCallback === 'function') {
3923
+ this.state.updateCallback(data);
3924
+ }
3925
+ };
3926
+
3885
3927
  /**
3886
3928
  * If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
3887
3929
  * @method
3888
3930
  * @memberof Popper
3889
3931
  * @param {Function} callback
3890
- */
3891
- Popper.prototype.onCreate = function (callback) {
3892
- // the createCallbacks return as first argument the popper instance
3893
- callback(this);
3894
- return this;
3895
- };
3896
-
3932
+ */
3933
+ Popper.prototype.onCreate = function (callback) {
3934
+ // the createCallbacks return as first argument the popper instance
3935
+ callback(this);
3936
+ return this;
3937
+ };
3938
+
3897
3939
  /**
3898
3940
  * If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
3899
- * used to style popper and its arrow.
3900
- * NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
3901
- * @method
3902
- * @memberof Popper
3903
- * @param {Function} callback
3904
- */
3905
- Popper.prototype.onUpdate = function (callback) {
3906
- this.state.updateCallback = callback;
3907
- return this;
3908
- };
3909
-
3910
- /**
3911
- * Helper used to generate poppers from a configuration file
3912
- * @method
3913
- * @memberof Popper
3914
- * @param config {Object} configuration
3915
- * @returns {HTMLElement} popper
3916
- */
3917
- Popper.prototype.parse = function (config) {
3918
- var defaultConfig = {
3919
- tagName: 'div',
3920
- classNames: ['popper'],
3921
- attributes: [],
3922
- parent: root.document.body,
3923
- content: '',
3924
- contentType: 'text',
3925
- arrowTagName: 'div',
3926
- arrowClassNames: ['popper__arrow'],
3927
- arrowAttributes: ['x-arrow']
3928
- };
3929
- config = Object.assign({}, defaultConfig, config);
3930
-
3931
- var d = root.document;
3932
-
3933
- var popper = d.createElement(config.tagName);
3934
- addClassNames(popper, config.classNames);
3935
- addAttributes(popper, config.attributes);
3936
- if (config.contentType === 'node') {
3937
- popper.appendChild(config.content.jquery ? config.content[0] : config.content);
3938
- } else if (config.contentType === 'html') {
3939
- popper.innerHTML = config.content;
3940
- } else {
3941
- popper.textContent = config.content;
3942
- }
3943
-
3944
- if (config.arrowTagName) {
3945
- var arrow = d.createElement(config.arrowTagName);
3946
- addClassNames(arrow, config.arrowClassNames);
3947
- addAttributes(arrow, config.arrowAttributes);
3948
- popper.appendChild(arrow);
3949
- }
3950
-
3951
- var parent = config.parent.jquery ? config.parent[0] : config.parent;
3952
-
3953
- // if the given parent is a string, use it to match an element
3954
- // if more than one element is matched, the first one will be used as parent
3955
- // if no elements are matched, the script will throw an error
3956
- if (typeof parent === 'string') {
3957
- parent = d.querySelectorAll(config.parent);
3958
- if (parent.length > 1) {
3959
- console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
3960
- }
3961
- if (parent.length === 0) {
3962
- throw "ERROR: the given `parent` doesn't exists!";
3963
- }
3964
- parent = parent[0];
3965
- }
3966
- // if the given parent is a DOM nodes list or an array of nodes with more than one element,
3967
- // the first one will be used as parent
3968
- if (parent.length > 1 && parent instanceof Element === false) {
3969
- console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
3970
- parent = parent[0];
3971
- }
3972
-
3973
- // append the generated popper to its parent
3974
- parent.appendChild(popper);
3975
-
3976
- return popper;
3977
-
3941
+ * used to style popper and its arrow.
3942
+ * NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
3943
+ * @method
3944
+ * @memberof Popper
3945
+ * @param {Function} callback
3946
+ */
3947
+ Popper.prototype.onUpdate = function (callback) {
3948
+ this.state.updateCallback = callback;
3949
+ return this;
3950
+ };
3951
+
3952
+ /**
3953
+ * Helper used to generate poppers from a configuration file
3954
+ * @method
3955
+ * @memberof Popper
3956
+ * @param config {Object} configuration
3957
+ * @returns {HTMLElement} popper
3958
+ */
3959
+ Popper.prototype.parse = function (config) {
3960
+ var defaultConfig = {
3961
+ tagName: 'div',
3962
+ classNames: ['popper'],
3963
+ attributes: [],
3964
+ parent: root.document.body,
3965
+ content: '',
3966
+ contentType: 'text',
3967
+ arrowTagName: 'div',
3968
+ arrowClassNames: ['popper__arrow'],
3969
+ arrowAttributes: ['x-arrow']
3970
+ };
3971
+ config = Object.assign({}, defaultConfig, config);
3972
+
3973
+ var d = root.document;
3974
+
3975
+ var popper = d.createElement(config.tagName);
3976
+ addClassNames(popper, config.classNames);
3977
+ addAttributes(popper, config.attributes);
3978
+ if (config.contentType === 'node') {
3979
+ popper.appendChild(
3980
+ config.content.jquery ? config.content[0] : config.content
3981
+ );
3982
+ } else if (config.contentType === 'html') {
3983
+ popper.innerHTML = config.content;
3984
+ } else {
3985
+ popper.textContent = config.content;
3986
+ }
3987
+
3988
+ if (config.arrowTagName) {
3989
+ var arrow = d.createElement(config.arrowTagName);
3990
+ addClassNames(arrow, config.arrowClassNames);
3991
+ addAttributes(arrow, config.arrowAttributes);
3992
+ popper.appendChild(arrow);
3993
+ }
3994
+
3995
+ var parent = config.parent.jquery ? config.parent[0] : config.parent;
3996
+
3997
+ // if the given parent is a string, use it to match an element
3998
+ // if more than one element is matched, the first one will be used as parent
3999
+ // if no elements are matched, the script will throw an error
4000
+ if (typeof parent === 'string') {
4001
+ parent = d.querySelectorAll(config.parent);
4002
+ if (parent.length > 1) {
4003
+ console.warn(
4004
+ 'WARNING: the given `parent` query(' +
4005
+ config.parent +
4006
+ ') matched more than one element, the first one will be used'
4007
+ );
4008
+ }
4009
+ if (parent.length === 0) {
4010
+ throw "ERROR: the given `parent` doesn't exists!";
4011
+ }
4012
+ parent = parent[0];
4013
+ }
4014
+ // if the given parent is a DOM nodes list or an array of nodes with more than one element,
4015
+ // the first one will be used as parent
4016
+ if (parent.length > 1 && parent instanceof Element === false) {
4017
+ console.warn(
4018
+ 'WARNING: you have passed as parent a list of elements, the first one will be used'
4019
+ );
4020
+ parent = parent[0];
4021
+ }
4022
+
4023
+ // append the generated popper to its parent
4024
+ parent.appendChild(popper);
4025
+
4026
+ return popper;
4027
+
3978
4028
  /**
3979
4029
  * Adds class names to the given element
3980
4030
  * @function
3981
4031
  * @ignore
3982
4032
  * @param {HTMLElement} target
3983
4033
  * @param {Array} classes
3984
- */
3985
- function addClassNames(element, classNames) {
3986
- classNames.forEach(function (className) {
3987
- element.classList.add(className);
3988
- });
3989
- }
3990
-
4034
+ */
4035
+ function addClassNames(element, classNames) {
4036
+ classNames.forEach(function (className) {
4037
+ element.classList.add(className);
4038
+ });
4039
+ }
4040
+
3991
4041
  /**
3992
4042
  * Adds attributes to the given element
3993
4043
  * @function
@@ -3996,14 +4046,17 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
3996
4046
  * @param {Array} attributes
3997
4047
  * @example
3998
4048
  * addAttributes(element, [ 'data-info:foobar' ]);
3999
- */
4000
- function addAttributes(element, attributes) {
4001
- attributes.forEach(function (attribute) {
4002
- element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
4003
- });
4004
- }
4005
- };
4006
-
4049
+ */
4050
+ function addAttributes(element, attributes) {
4051
+ attributes.forEach(function (attribute) {
4052
+ element.setAttribute(
4053
+ attribute.split(':')[0],
4054
+ attribute.split(':')[1] || ''
4055
+ );
4056
+ });
4057
+ }
4058
+ };
4059
+
4007
4060
  /**
4008
4061
  * Helper used to get the position which will be applied to the popper
4009
4062
  * @method
@@ -4011,20 +4064,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4011
4064
  * @param config {HTMLElement} popper element
4012
4065
  * @param reference {HTMLElement} reference element
4013
4066
  * @returns {String} position
4014
- */
4015
- Popper.prototype._getPosition = function (popper, reference) {
4016
- var container = getOffsetParent(reference);
4017
-
4018
- if (this._options.forceAbsolute) {
4019
- return 'absolute';
4020
- }
4021
-
4022
- // Decide if the popper will be fixed
4023
- // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
4024
- var isParentFixed = isFixed(reference, container);
4025
- return isParentFixed ? 'fixed' : 'absolute';
4026
- };
4027
-
4067
+ */
4068
+ Popper.prototype._getPosition = function (popper, reference) {
4069
+ var container = getOffsetParent(reference);
4070
+
4071
+ if (this._options.forceAbsolute) {
4072
+ return 'absolute';
4073
+ }
4074
+
4075
+ // Decide if the popper will be fixed
4076
+ // If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
4077
+ var isParentFixed = isFixed(reference, container);
4078
+ return isParentFixed ? 'fixed' : 'absolute';
4079
+ };
4080
+
4028
4081
  /**
4029
4082
  * Get offsets to the popper
4030
4083
  * @method
@@ -4033,93 +4086,112 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4033
4086
  * @param {Element} popper - the popper element
4034
4087
  * @param {Element} reference - the reference element (the popper will be relative to this)
4035
4088
  * @returns {Object} An object containing the offsets which will be applied to the popper
4036
- */
4037
- Popper.prototype._getOffsets = function (popper, reference, placement) {
4038
- placement = placement.split('-')[0];
4039
- var popperOffsets = {};
4040
-
4041
- popperOffsets.position = this.state.position;
4042
- var isParentFixed = popperOffsets.position === 'fixed';
4043
-
4044
- //
4045
- // Get reference element position
4046
- //
4047
- var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
4048
-
4049
- //
4050
- // Get popper sizes
4051
- //
4052
- var popperRect = getOuterSizes(popper);
4053
-
4054
- //
4055
- // Compute offsets of popper
4056
- //
4057
-
4058
- // depending by the popper placement we have to compute its offsets slightly differently
4059
- if (['right', 'left'].indexOf(placement) !== -1) {
4060
- popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
4061
- if (placement === 'left') {
4062
- popperOffsets.left = referenceOffsets.left - popperRect.width;
4063
- } else {
4064
- popperOffsets.left = referenceOffsets.right;
4065
- }
4066
- } else {
4067
- popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
4068
- if (placement === 'top') {
4069
- popperOffsets.top = referenceOffsets.top - popperRect.height;
4070
- } else {
4071
- popperOffsets.top = referenceOffsets.bottom;
4072
- }
4073
- }
4074
-
4075
- // Add width and height to our offsets object
4076
- popperOffsets.width = popperRect.width;
4077
- popperOffsets.height = popperRect.height;
4078
-
4079
- return {
4080
- popper: popperOffsets,
4081
- reference: referenceOffsets
4082
- };
4083
- };
4084
-
4089
+ */
4090
+ Popper.prototype._getOffsets = function (popper, reference, placement) {
4091
+ placement = placement.split('-')[0];
4092
+ var popperOffsets = {};
4093
+
4094
+ popperOffsets.position = this.state.position;
4095
+ var isParentFixed = popperOffsets.position === 'fixed';
4096
+
4097
+ //
4098
+ // Get reference element position
4099
+ //
4100
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(
4101
+ reference,
4102
+ getOffsetParent(popper),
4103
+ isParentFixed
4104
+ );
4105
+
4106
+ //
4107
+ // Get popper sizes
4108
+ //
4109
+ var popperRect = getOuterSizes(popper);
4110
+
4111
+ //
4112
+ // Compute offsets of popper
4113
+ //
4114
+
4115
+ // depending by the popper placement we have to compute its offsets slightly differently
4116
+ if (['right', 'left'].indexOf(placement) !== -1) {
4117
+ popperOffsets.top =
4118
+ referenceOffsets.top +
4119
+ referenceOffsets.height / 2 -
4120
+ popperRect.height / 2;
4121
+ if (placement === 'left') {
4122
+ popperOffsets.left = referenceOffsets.left - popperRect.width;
4123
+ } else {
4124
+ popperOffsets.left = referenceOffsets.right;
4125
+ }
4126
+ } else {
4127
+ popperOffsets.left =
4128
+ referenceOffsets.left +
4129
+ referenceOffsets.width / 2 -
4130
+ popperRect.width / 2;
4131
+ if (placement === 'top') {
4132
+ popperOffsets.top = referenceOffsets.top - popperRect.height;
4133
+ } else {
4134
+ popperOffsets.top = referenceOffsets.bottom;
4135
+ }
4136
+ }
4137
+
4138
+ // Add width and height to our offsets object
4139
+ popperOffsets.width = popperRect.width;
4140
+ popperOffsets.height = popperRect.height;
4141
+
4142
+ return {
4143
+ popper: popperOffsets,
4144
+ reference: referenceOffsets
4145
+ };
4146
+ };
4147
+
4085
4148
  /**
4086
4149
  * Setup needed event listeners used to update the popper position
4087
4150
  * @method
4088
4151
  * @memberof Popper
4089
4152
  * @access private
4090
- */
4091
- Popper.prototype._setupEventListeners = function () {
4092
- // NOTE: 1 DOM access here
4093
- this.state.updateBound = this.update.bind(this);
4094
- root.addEventListener('resize', this.state.updateBound);
4095
- // if the boundariesElement is window we don't need to listen for the scroll event
4096
- if (this._options.boundariesElement !== 'window') {
4097
- var target = getScrollParent(this._reference);
4098
- // here it could be both `body` or `documentElement` thanks to Firefox, we then check both
4099
- if (target === root.document.body || target === root.document.documentElement) {
4100
- target = root;
4101
- }
4102
- target.addEventListener('scroll', this.state.updateBound);
4103
- this.state.scrollTarget = target;
4104
- }
4105
- };
4106
-
4153
+ */
4154
+ Popper.prototype._setupEventListeners = function () {
4155
+ // NOTE: 1 DOM access here
4156
+ this.state.updateBound = this.update.bind(this);
4157
+ root.addEventListener('resize', this.state.updateBound);
4158
+ // if the boundariesElement is window we don't need to listen for the scroll event
4159
+ if (this._options.boundariesElement !== 'window') {
4160
+ var target = getScrollParent(this._reference);
4161
+ // here it could be both `body` or `documentElement` thanks to Firefox, we then check both
4162
+ if (
4163
+ target === root.document.body ||
4164
+ target === root.document.documentElement
4165
+ ) {
4166
+ target = root;
4167
+ }
4168
+ target.addEventListener('scroll', this.state.updateBound);
4169
+ this.state.scrollTarget = target;
4170
+ }
4171
+ };
4172
+
4107
4173
  /**
4108
4174
  * Remove event listeners used to update the popper position
4109
4175
  * @method
4110
4176
  * @memberof Popper
4111
4177
  * @access private
4112
- */
4113
- Popper.prototype._removeEventListeners = function () {
4114
- // NOTE: 1 DOM access here
4115
- root.removeEventListener('resize', this.state.updateBound);
4116
- if (this._options.boundariesElement !== 'window' && this.state.scrollTarget) {
4117
- this.state.scrollTarget.removeEventListener('scroll', this.state.updateBound);
4118
- this.state.scrollTarget = null;
4119
- }
4120
- this.state.updateBound = null;
4121
- };
4122
-
4178
+ */
4179
+ Popper.prototype._removeEventListeners = function () {
4180
+ // NOTE: 1 DOM access here
4181
+ root.removeEventListener('resize', this.state.updateBound);
4182
+ if (
4183
+ this._options.boundariesElement !== 'window' &&
4184
+ this.state.scrollTarget
4185
+ ) {
4186
+ this.state.scrollTarget.removeEventListener(
4187
+ 'scroll',
4188
+ this.state.updateBound
4189
+ );
4190
+ this.state.scrollTarget = null;
4191
+ }
4192
+ this.state.updateBound = null;
4193
+ };
4194
+
4123
4195
  /**
4124
4196
  * Computed the boundaries limits and return them
4125
4197
  * @method
@@ -4129,66 +4201,98 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4129
4201
  * @param {Number} padding - Boundaries padding
4130
4202
  * @param {Element} boundariesElement - Element used to define the boundaries
4131
4203
  * @returns {Object} Coordinates of the boundaries
4132
- */
4133
- Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
4134
- // NOTE: 1 DOM access here
4135
- var boundaries = {};
4136
- var width, height;
4137
- if (boundariesElement === 'window') {
4138
- var body = root.document.body,
4139
- html = root.document.documentElement;
4140
-
4141
- height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
4142
- width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
4143
-
4144
- boundaries = {
4145
- top: 0,
4146
- right: width,
4147
- bottom: height,
4148
- left: 0
4149
- };
4150
- } else if (boundariesElement === 'viewport') {
4151
- var offsetParent = getOffsetParent(this._popper);
4152
- var scrollParent = getScrollParent(this._popper);
4153
- var offsetParentRect = getOffsetRect(offsetParent);
4154
-
4155
- // Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
4156
- var getScrollTopValue = function getScrollTopValue(element) {
4157
- return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
4158
- };
4159
- var getScrollLeftValue = function getScrollLeftValue(element) {
4160
- return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
4161
- };
4162
-
4163
- // if the popper is fixed we don't have to substract scrolling from the boundaries
4164
- var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
4165
- var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
4166
-
4167
- boundaries = {
4168
- top: 0 - (offsetParentRect.top - scrollTop),
4169
- right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
4170
- bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
4171
- left: 0 - (offsetParentRect.left - scrollLeft)
4172
- };
4173
- } else {
4174
- if (getOffsetParent(this._popper) === boundariesElement) {
4175
- boundaries = {
4176
- top: 0,
4177
- left: 0,
4178
- right: boundariesElement.clientWidth,
4179
- bottom: boundariesElement.clientHeight
4180
- };
4181
- } else {
4182
- boundaries = getOffsetRect(boundariesElement);
4183
- }
4184
- }
4185
- boundaries.left += padding;
4186
- boundaries.right -= padding;
4187
- boundaries.top = boundaries.top + padding;
4188
- boundaries.bottom = boundaries.bottom - padding;
4189
- return boundaries;
4190
- };
4191
-
4204
+ */
4205
+ Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
4206
+ // NOTE: 1 DOM access here
4207
+ var boundaries = {};
4208
+ var width, height;
4209
+ if (boundariesElement === 'window') {
4210
+ var body = root.document.body,
4211
+ html = root.document.documentElement;
4212
+
4213
+ height = Math.max(
4214
+ body.scrollHeight,
4215
+ body.offsetHeight,
4216
+ html.clientHeight,
4217
+ html.scrollHeight,
4218
+ html.offsetHeight
4219
+ );
4220
+ width = Math.max(
4221
+ body.scrollWidth,
4222
+ body.offsetWidth,
4223
+ html.clientWidth,
4224
+ html.scrollWidth,
4225
+ html.offsetWidth
4226
+ );
4227
+
4228
+ boundaries = {
4229
+ top: 0,
4230
+ right: width,
4231
+ bottom: height,
4232
+ left: 0
4233
+ };
4234
+ } else if (boundariesElement === 'viewport') {
4235
+ var offsetParent = getOffsetParent(this._popper);
4236
+ var scrollParent = getScrollParent(this._popper);
4237
+ var offsetParentRect = getOffsetRect(offsetParent);
4238
+
4239
+ // Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
4240
+ var getScrollTopValue = function (element) {
4241
+ return element == document.body
4242
+ ? Math.max(
4243
+ document.documentElement.scrollTop,
4244
+ document.body.scrollTop
4245
+ )
4246
+ : element.scrollTop;
4247
+ };
4248
+ var getScrollLeftValue = function (element) {
4249
+ return element == document.body
4250
+ ? Math.max(
4251
+ document.documentElement.scrollLeft,
4252
+ document.body.scrollLeft
4253
+ )
4254
+ : element.scrollLeft;
4255
+ };
4256
+
4257
+ // if the popper is fixed we don't have to substract scrolling from the boundaries
4258
+ var scrollTop =
4259
+ data.offsets.popper.position === 'fixed'
4260
+ ? 0
4261
+ : getScrollTopValue(scrollParent);
4262
+ var scrollLeft =
4263
+ data.offsets.popper.position === 'fixed'
4264
+ ? 0
4265
+ : getScrollLeftValue(scrollParent);
4266
+
4267
+ boundaries = {
4268
+ top: 0 - (offsetParentRect.top - scrollTop),
4269
+ right:
4270
+ root.document.documentElement.clientWidth -
4271
+ (offsetParentRect.left - scrollLeft),
4272
+ bottom:
4273
+ root.document.documentElement.clientHeight -
4274
+ (offsetParentRect.top - scrollTop),
4275
+ left: 0 - (offsetParentRect.left - scrollLeft)
4276
+ };
4277
+ } else {
4278
+ if (getOffsetParent(this._popper) === boundariesElement) {
4279
+ boundaries = {
4280
+ top: 0,
4281
+ left: 0,
4282
+ right: boundariesElement.clientWidth,
4283
+ bottom: boundariesElement.clientHeight
4284
+ };
4285
+ } else {
4286
+ boundaries = getOffsetRect(boundariesElement);
4287
+ }
4288
+ }
4289
+ boundaries.left += padding;
4290
+ boundaries.right -= padding;
4291
+ boundaries.top = boundaries.top + padding;
4292
+ boundaries.bottom = boundaries.bottom - padding;
4293
+ return boundaries;
4294
+ };
4295
+
4192
4296
  /**
4193
4297
  * Loop trough the list of modifiers and run them in order, each of them will then edit the data object
4194
4298
  * @method
@@ -4197,22 +4301,27 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4197
4301
  * @param {Object} data
4198
4302
  * @param {Array} modifiers
4199
4303
  * @param {Function} ends
4200
- */
4201
- Popper.prototype.runModifiers = function (data, modifiers, ends) {
4202
- var modifiersToRun = modifiers.slice();
4203
- if (ends !== undefined) {
4204
- modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
4205
- }
4206
-
4207
- modifiersToRun.forEach(function (modifier) {
4208
- if (isFunction(modifier)) {
4209
- data = modifier.call(this, data);
4210
- }
4211
- }.bind(this));
4212
-
4213
- return data;
4214
- };
4215
-
4304
+ */
4305
+ Popper.prototype.runModifiers = function (data, modifiers, ends) {
4306
+ var modifiersToRun = modifiers.slice();
4307
+ if (ends !== undefined) {
4308
+ modifiersToRun = this._options.modifiers.slice(
4309
+ 0,
4310
+ getArrayKeyIndex(this._options.modifiers, ends)
4311
+ );
4312
+ }
4313
+
4314
+ modifiersToRun.forEach(
4315
+ function (modifier) {
4316
+ if (isFunction(modifier)) {
4317
+ data = modifier.call(this, data);
4318
+ }
4319
+ }.bind(this)
4320
+ );
4321
+
4322
+ return data;
4323
+ };
4324
+
4216
4325
  /**
4217
4326
  * Helper used to know if the given modifier depends from another one.
4218
4327
  * @method
@@ -4220,191 +4329,204 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4220
4329
  * @param {String} requesting - name of requesting modifier
4221
4330
  * @param {String} requested - name of requested modifier
4222
4331
  * @returns {Boolean}
4223
- */
4224
- Popper.prototype.isModifierRequired = function (requesting, requested) {
4225
- var index = getArrayKeyIndex(this._options.modifiers, requesting);
4226
- return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
4227
- return modifier === requested;
4228
- }).length;
4229
- };
4230
-
4231
- //
4232
- // Modifiers
4233
- //
4234
-
4332
+ */
4333
+ Popper.prototype.isModifierRequired = function (requesting, requested) {
4334
+ var index = getArrayKeyIndex(this._options.modifiers, requesting);
4335
+ return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
4336
+ return modifier === requested;
4337
+ }).length;
4338
+ };
4339
+
4340
+ //
4341
+ // Modifiers
4342
+ //
4343
+
4235
4344
  /**
4236
4345
  * Modifiers list
4237
4346
  * @namespace Popper.modifiers
4238
4347
  * @memberof Popper
4239
4348
  * @type {Object}
4240
- */
4241
- Popper.prototype.modifiers = {};
4242
-
4349
+ */
4350
+ Popper.prototype.modifiers = {};
4351
+
4243
4352
  /**
4244
4353
  * Apply the computed styles to the popper element
4245
4354
  * @method
4246
4355
  * @memberof Popper.modifiers
4247
4356
  * @argument {Object} data - The data object generated by `update` method
4248
4357
  * @returns {Object} The same data object
4249
- */
4250
- Popper.prototype.modifiers.applyStyle = function (data) {
4251
- // apply the final offsets to the popper
4252
- // NOTE: 1 DOM access here
4253
- var styles = {
4254
- position: data.offsets.popper.position
4255
- };
4256
-
4257
- // round top and left to avoid blurry text
4258
- var left = Math.round(data.offsets.popper.left);
4259
- var top = Math.round(data.offsets.popper.top);
4260
-
4261
- // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
4262
- // we automatically use the supported prefixed version if needed
4263
- var prefixedProperty;
4264
- if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
4265
- styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
4266
- styles.top = 0;
4267
- styles.left = 0;
4268
- }
4269
- // othwerise, we use the standard `left` and `top` properties
4270
- else {
4271
- styles.left = left;
4272
- styles.top = top;
4273
- }
4274
-
4275
- // any property present in `data.styles` will be applied to the popper,
4276
- // in this way we can make the 3rd party modifiers add custom styles to it
4277
- // Be aware, modifiers could override the properties defined in the previous
4278
- // lines of this modifier!
4279
- Object.assign(styles, data.styles);
4280
-
4281
- setStyle(this._popper, styles);
4282
-
4283
- // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
4284
- // NOTE: 1 DOM access here
4285
- this._popper.setAttribute('x-placement', data.placement);
4286
-
4287
- // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
4288
- if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
4289
- setStyle(data.arrowElement, data.offsets.arrow);
4290
- }
4291
-
4292
- return data;
4293
- };
4294
-
4358
+ */
4359
+ Popper.prototype.modifiers.applyStyle = function (data) {
4360
+ // apply the final offsets to the popper
4361
+ // NOTE: 1 DOM access here
4362
+ var styles = {
4363
+ position: data.offsets.popper.position
4364
+ };
4365
+
4366
+ // round top and left to avoid blurry text
4367
+ var left = Math.round(data.offsets.popper.left);
4368
+ var top = Math.round(data.offsets.popper.top);
4369
+
4370
+ // if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
4371
+ // we automatically use the supported prefixed version if needed
4372
+ var prefixedProperty;
4373
+ if (
4374
+ this._options.gpuAcceleration &&
4375
+ (prefixedProperty = getSupportedPropertyName('transform'))
4376
+ ) {
4377
+ styles[prefixedProperty] =
4378
+ 'translate3d(' + left + 'px, ' + top + 'px, 0)';
4379
+ styles.top = 0;
4380
+ styles.left = 0;
4381
+ }
4382
+ // othwerise, we use the standard `left` and `top` properties
4383
+ else {
4384
+ styles.left = left;
4385
+ styles.top = top;
4386
+ }
4387
+
4388
+ // any property present in `data.styles` will be applied to the popper,
4389
+ // in this way we can make the 3rd party modifiers add custom styles to it
4390
+ // Be aware, modifiers could override the properties defined in the previous
4391
+ // lines of this modifier!
4392
+ Object.assign(styles, data.styles);
4393
+
4394
+ setStyle(this._popper, styles);
4395
+
4396
+ // set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
4397
+ // NOTE: 1 DOM access here
4398
+ this._popper.setAttribute('x-placement', data.placement);
4399
+
4400
+ // if the arrow modifier is required and the arrow style has been computed, apply the arrow style
4401
+ if (
4402
+ this.isModifierRequired(
4403
+ this.modifiers.applyStyle,
4404
+ this.modifiers.arrow
4405
+ ) &&
4406
+ data.offsets.arrow
4407
+ ) {
4408
+ setStyle(data.arrowElement, data.offsets.arrow);
4409
+ }
4410
+
4411
+ return data;
4412
+ };
4413
+
4295
4414
  /**
4296
4415
  * Modifier used to shift the popper on the start or end of its reference element side
4297
4416
  * @method
4298
4417
  * @memberof Popper.modifiers
4299
4418
  * @argument {Object} data - The data object generated by `update` method
4300
4419
  * @returns {Object} The data object, properly modified
4301
- */
4302
- Popper.prototype.modifiers.shift = function (data) {
4303
- var placement = data.placement;
4304
- var basePlacement = placement.split('-')[0];
4305
- var shiftVariation = placement.split('-')[1];
4306
-
4307
- // if shift shiftVariation is specified, run the modifier
4308
- if (shiftVariation) {
4309
- var reference = data.offsets.reference;
4310
- var popper = getPopperClientRect(data.offsets.popper);
4311
-
4312
- var shiftOffsets = {
4313
- y: {
4314
- start: { top: reference.top },
4315
- end: { top: reference.top + reference.height - popper.height }
4316
- },
4317
- x: {
4318
- start: { left: reference.left },
4319
- end: { left: reference.left + reference.width - popper.width }
4320
- }
4321
- };
4322
-
4323
- var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
4324
-
4325
- data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
4326
- }
4327
-
4328
- return data;
4329
- };
4330
-
4420
+ */
4421
+ Popper.prototype.modifiers.shift = function (data) {
4422
+ var placement = data.placement;
4423
+ var basePlacement = placement.split('-')[0];
4424
+ var shiftVariation = placement.split('-')[1];
4425
+
4426
+ // if shift shiftVariation is specified, run the modifier
4427
+ if (shiftVariation) {
4428
+ var reference = data.offsets.reference;
4429
+ var popper = getPopperClientRect(data.offsets.popper);
4430
+
4431
+ var shiftOffsets = {
4432
+ y: {
4433
+ start: { top: reference.top },
4434
+ end: { top: reference.top + reference.height - popper.height }
4435
+ },
4436
+ x: {
4437
+ start: { left: reference.left },
4438
+ end: { left: reference.left + reference.width - popper.width }
4439
+ }
4440
+ };
4441
+
4442
+ var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
4443
+
4444
+ data.offsets.popper = Object.assign(
4445
+ popper,
4446
+ shiftOffsets[axis][shiftVariation]
4447
+ );
4448
+ }
4449
+
4450
+ return data;
4451
+ };
4452
+
4331
4453
  /**
4332
4454
  * Modifier used to make sure the popper does not overflows from it's boundaries
4333
4455
  * @method
4334
4456
  * @memberof Popper.modifiers
4335
4457
  * @argument {Object} data - The data object generated by `update` method
4336
4458
  * @returns {Object} The data object, properly modified
4337
- */
4338
- Popper.prototype.modifiers.preventOverflow = function (data) {
4339
- var order = this._options.preventOverflowOrder;
4340
- var popper = getPopperClientRect(data.offsets.popper);
4341
-
4342
- var check = {
4343
- left: function left() {
4344
- var left = popper.left;
4345
- if (popper.left < data.boundaries.left) {
4346
- left = Math.max(popper.left, data.boundaries.left);
4347
- }
4348
- return { left: left };
4349
- },
4350
- right: function right() {
4351
- var left = popper.left;
4352
- if (popper.right > data.boundaries.right) {
4353
- left = Math.min(popper.left, data.boundaries.right - popper.width);
4354
- }
4355
- return { left: left };
4356
- },
4357
- top: function top() {
4358
- var top = popper.top;
4359
- if (popper.top < data.boundaries.top) {
4360
- top = Math.max(popper.top, data.boundaries.top);
4361
- }
4362
- return { top: top };
4363
- },
4364
- bottom: function bottom() {
4365
- var top = popper.top;
4366
- if (popper.bottom > data.boundaries.bottom) {
4367
- top = Math.min(popper.top, data.boundaries.bottom - popper.height);
4368
- }
4369
- return { top: top };
4370
- }
4371
- };
4372
-
4373
- order.forEach(function (direction) {
4374
- data.offsets.popper = Object.assign(popper, check[direction]());
4375
- });
4376
-
4377
- return data;
4378
- };
4379
-
4459
+ */
4460
+ Popper.prototype.modifiers.preventOverflow = function (data) {
4461
+ var order = this._options.preventOverflowOrder;
4462
+ var popper = getPopperClientRect(data.offsets.popper);
4463
+
4464
+ var check = {
4465
+ left: function () {
4466
+ var left = popper.left;
4467
+ if (popper.left < data.boundaries.left) {
4468
+ left = Math.max(popper.left, data.boundaries.left);
4469
+ }
4470
+ return { left: left };
4471
+ },
4472
+ right: function () {
4473
+ var left = popper.left;
4474
+ if (popper.right > data.boundaries.right) {
4475
+ left = Math.min(popper.left, data.boundaries.right - popper.width);
4476
+ }
4477
+ return { left: left };
4478
+ },
4479
+ top: function () {
4480
+ var top = popper.top;
4481
+ if (popper.top < data.boundaries.top) {
4482
+ top = Math.max(popper.top, data.boundaries.top);
4483
+ }
4484
+ return { top: top };
4485
+ },
4486
+ bottom: function () {
4487
+ var top = popper.top;
4488
+ if (popper.bottom > data.boundaries.bottom) {
4489
+ top = Math.min(popper.top, data.boundaries.bottom - popper.height);
4490
+ }
4491
+ return { top: top };
4492
+ }
4493
+ };
4494
+
4495
+ order.forEach(function (direction) {
4496
+ data.offsets.popper = Object.assign(popper, check[direction]());
4497
+ });
4498
+
4499
+ return data;
4500
+ };
4501
+
4380
4502
  /**
4381
4503
  * Modifier used to make sure the popper is always near its reference
4382
4504
  * @method
4383
4505
  * @memberof Popper.modifiers
4384
4506
  * @argument {Object} data - The data object generated by _update method
4385
4507
  * @returns {Object} The data object, properly modified
4386
- */
4387
- Popper.prototype.modifiers.keepTogether = function (data) {
4388
- var popper = getPopperClientRect(data.offsets.popper);
4389
- var reference = data.offsets.reference;
4390
- var f = Math.floor;
4391
-
4392
- if (popper.right < f(reference.left)) {
4393
- data.offsets.popper.left = f(reference.left) - popper.width;
4394
- }
4395
- if (popper.left > f(reference.right)) {
4396
- data.offsets.popper.left = f(reference.right);
4397
- }
4398
- if (popper.bottom < f(reference.top)) {
4399
- data.offsets.popper.top = f(reference.top) - popper.height;
4400
- }
4401
- if (popper.top > f(reference.bottom)) {
4402
- data.offsets.popper.top = f(reference.bottom);
4403
- }
4404
-
4405
- return data;
4406
- };
4407
-
4508
+ */
4509
+ Popper.prototype.modifiers.keepTogether = function (data) {
4510
+ var popper = getPopperClientRect(data.offsets.popper);
4511
+ var reference = data.offsets.reference;
4512
+ var f = Math.floor;
4513
+
4514
+ if (popper.right < f(reference.left)) {
4515
+ data.offsets.popper.left = f(reference.left) - popper.width;
4516
+ }
4517
+ if (popper.left > f(reference.right)) {
4518
+ data.offsets.popper.left = f(reference.right);
4519
+ }
4520
+ if (popper.bottom < f(reference.top)) {
4521
+ data.offsets.popper.top = f(reference.top) - popper.height;
4522
+ }
4523
+ if (popper.top > f(reference.bottom)) {
4524
+ data.offsets.popper.top = f(reference.bottom);
4525
+ }
4526
+
4527
+ return data;
4528
+ };
4529
+
4408
4530
  /**
4409
4531
  * Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
4410
4532
  * Requires the `preventOverflow` modifier before it in order to work.
@@ -4413,61 +4535,81 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4413
4535
  * @memberof Popper.modifiers
4414
4536
  * @argument {Object} data - The data object generated by _update method
4415
4537
  * @returns {Object} The data object, properly modified
4416
- */
4417
- Popper.prototype.modifiers.flip = function (data) {
4418
- // check if preventOverflow is in the list of modifiers before the flip modifier.
4419
- // otherwise flip would not work as expected.
4420
- if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
4421
- console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
4422
- return data;
4423
- }
4424
-
4425
- if (data.flipped && data.placement === data._originalPlacement) {
4426
- // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
4427
- return data;
4428
- }
4429
-
4430
- var placement = data.placement.split('-')[0];
4431
- var placementOpposite = getOppositePlacement(placement);
4432
- var variation = data.placement.split('-')[1] || '';
4433
-
4434
- var flipOrder = [];
4435
- if (this._options.flipBehavior === 'flip') {
4436
- flipOrder = [placement, placementOpposite];
4437
- } else {
4438
- flipOrder = this._options.flipBehavior;
4439
- }
4440
-
4441
- flipOrder.forEach(function (step, index) {
4442
- if (placement !== step || flipOrder.length === index + 1) {
4443
- return;
4444
- }
4445
-
4446
- placement = data.placement.split('-')[0];
4447
- placementOpposite = getOppositePlacement(placement);
4448
-
4449
- var popperOffsets = getPopperClientRect(data.offsets.popper);
4450
-
4451
- // this boolean is used to distinguish right and bottom from top and left
4452
- // they need different computations to get flipped
4453
- var a = ['right', 'bottom'].indexOf(placement) !== -1;
4454
-
4455
- // using Math.floor because the reference offsets may contain decimals we are not going to consider here
4456
- if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
4457
- // we'll use this boolean to detect any flip loop
4458
- data.flipped = true;
4459
- data.placement = flipOrder[index + 1];
4460
- if (variation) {
4461
- data.placement += '-' + variation;
4462
- }
4463
- data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
4464
-
4465
- data = this.runModifiers(data, this._options.modifiers, this._flip);
4466
- }
4467
- }.bind(this));
4468
- return data;
4469
- };
4470
-
4538
+ */
4539
+ Popper.prototype.modifiers.flip = function (data) {
4540
+ // check if preventOverflow is in the list of modifiers before the flip modifier.
4541
+ // otherwise flip would not work as expected.
4542
+ if (
4543
+ !this.isModifierRequired(
4544
+ this.modifiers.flip,
4545
+ this.modifiers.preventOverflow
4546
+ )
4547
+ ) {
4548
+ console.warn(
4549
+ 'WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!'
4550
+ );
4551
+ return data;
4552
+ }
4553
+
4554
+ if (data.flipped && data.placement === data._originalPlacement) {
4555
+ // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
4556
+ return data;
4557
+ }
4558
+
4559
+ var placement = data.placement.split('-')[0];
4560
+ var placementOpposite = getOppositePlacement(placement);
4561
+ var variation = data.placement.split('-')[1] || '';
4562
+
4563
+ var flipOrder = [];
4564
+ if (this._options.flipBehavior === 'flip') {
4565
+ flipOrder = [placement, placementOpposite];
4566
+ } else {
4567
+ flipOrder = this._options.flipBehavior;
4568
+ }
4569
+
4570
+ flipOrder.forEach(
4571
+ function (step, index) {
4572
+ if (placement !== step || flipOrder.length === index + 1) {
4573
+ return;
4574
+ }
4575
+
4576
+ placement = data.placement.split('-')[0];
4577
+ placementOpposite = getOppositePlacement(placement);
4578
+
4579
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
4580
+
4581
+ // this boolean is used to distinguish right and bottom from top and left
4582
+ // they need different computations to get flipped
4583
+ var a = ['right', 'bottom'].indexOf(placement) !== -1;
4584
+
4585
+ // using Math.floor because the reference offsets may contain decimals we are not going to consider here
4586
+ if (
4587
+ (a &&
4588
+ Math.floor(data.offsets.reference[placement]) >
4589
+ Math.floor(popperOffsets[placementOpposite])) ||
4590
+ (!a &&
4591
+ Math.floor(data.offsets.reference[placement]) <
4592
+ Math.floor(popperOffsets[placementOpposite]))
4593
+ ) {
4594
+ // we'll use this boolean to detect any flip loop
4595
+ data.flipped = true;
4596
+ data.placement = flipOrder[index + 1];
4597
+ if (variation) {
4598
+ data.placement += '-' + variation;
4599
+ }
4600
+ data.offsets.popper = this._getOffsets(
4601
+ this._popper,
4602
+ this._reference,
4603
+ data.placement
4604
+ ).popper;
4605
+
4606
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
4607
+ }
4608
+ }.bind(this)
4609
+ );
4610
+ return data;
4611
+ };
4612
+
4471
4613
  /**
4472
4614
  * Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
4473
4615
  * The offsets will shift the popper on the side of its reference element.
@@ -4475,23 +4617,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4475
4617
  * @memberof Popper.modifiers
4476
4618
  * @argument {Object} data - The data object generated by _update method
4477
4619
  * @returns {Object} The data object, properly modified
4478
- */
4479
- Popper.prototype.modifiers.offset = function (data) {
4480
- var offset = this._options.offset;
4481
- var popper = data.offsets.popper;
4482
-
4483
- if (data.placement.indexOf('left') !== -1) {
4484
- popper.top -= offset;
4485
- } else if (data.placement.indexOf('right') !== -1) {
4486
- popper.top += offset;
4487
- } else if (data.placement.indexOf('top') !== -1) {
4488
- popper.left -= offset;
4489
- } else if (data.placement.indexOf('bottom') !== -1) {
4490
- popper.left += offset;
4491
- }
4492
- return data;
4493
- };
4494
-
4620
+ */
4621
+ Popper.prototype.modifiers.offset = function (data) {
4622
+ var offset = this._options.offset;
4623
+ var popper = data.offsets.popper;
4624
+
4625
+ if (data.placement.indexOf('left') !== -1) {
4626
+ popper.top -= offset;
4627
+ } else if (data.placement.indexOf('right') !== -1) {
4628
+ popper.top += offset;
4629
+ } else if (data.placement.indexOf('top') !== -1) {
4630
+ popper.left -= offset;
4631
+ } else if (data.placement.indexOf('bottom') !== -1) {
4632
+ popper.left += offset;
4633
+ }
4634
+ return data;
4635
+ };
4636
+
4495
4637
  /**
4496
4638
  * 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
4497
4639
  * It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
@@ -4499,136 +4641,147 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4499
4641
  * @memberof Popper.modifiers
4500
4642
  * @argument {Object} data - The data object generated by _update method
4501
4643
  * @returns {Object} The data object, properly modified
4502
- */
4503
- Popper.prototype.modifiers.arrow = function (data) {
4504
- var arrow = this._options.arrowElement;
4505
- var arrowOffset = this._options.arrowOffset;
4506
-
4507
- // if the arrowElement is a string, suppose it's a CSS selector
4508
- if (typeof arrow === 'string') {
4509
- arrow = this._popper.querySelector(arrow);
4510
- }
4511
-
4512
- // if arrow element is not found, don't run the modifier
4513
- if (!arrow) {
4514
- return data;
4515
- }
4516
-
4517
- // the arrow element must be child of its popper
4518
- if (!this._popper.contains(arrow)) {
4519
- console.warn('WARNING: `arrowElement` must be child of its popper element!');
4520
- return data;
4521
- }
4522
-
4523
- // arrow depends on keepTogether in order to work
4524
- if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
4525
- console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
4526
- return data;
4527
- }
4528
-
4529
- var arrowStyle = {};
4530
- var placement = data.placement.split('-')[0];
4531
- var popper = getPopperClientRect(data.offsets.popper);
4532
- var reference = data.offsets.reference;
4533
- var isVertical = ['left', 'right'].indexOf(placement) !== -1;
4534
-
4535
- var len = isVertical ? 'height' : 'width';
4536
- var side = isVertical ? 'top' : 'left';
4537
- var translate = isVertical ? 'translateY' : 'translateX';
4538
- var altSide = isVertical ? 'left' : 'top';
4539
- var opSide = isVertical ? 'bottom' : 'right';
4540
- var arrowSize = getOuterSizes(arrow)[len];
4541
-
4542
- //
4543
- // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
4544
- //
4545
-
4546
- // top/left side
4547
- if (reference[opSide] - arrowSize < popper[side]) {
4548
- data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
4549
- }
4550
- // bottom/right side
4551
- if (reference[side] + arrowSize > popper[opSide]) {
4552
- data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
4553
- }
4554
-
4555
- // compute center of the popper
4556
- var center = reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
4557
-
4558
- var sideValue = center - popper[side];
4559
-
4560
- // prevent arrow from being placed not contiguously to its popper
4561
- sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
4562
- arrowStyle[side] = sideValue;
4563
- arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
4564
-
4565
- data.offsets.arrow = arrowStyle;
4566
- data.arrowElement = arrow;
4567
-
4568
- return data;
4569
- };
4570
-
4571
- //
4572
- // Helpers
4573
- //
4574
-
4644
+ */
4645
+ Popper.prototype.modifiers.arrow = function (data) {
4646
+ var arrow = this._options.arrowElement;
4647
+ var arrowOffset = this._options.arrowOffset;
4648
+
4649
+ // if the arrowElement is a string, suppose it's a CSS selector
4650
+ if (typeof arrow === 'string') {
4651
+ arrow = this._popper.querySelector(arrow);
4652
+ }
4653
+
4654
+ // if arrow element is not found, don't run the modifier
4655
+ if (!arrow) {
4656
+ return data;
4657
+ }
4658
+
4659
+ // the arrow element must be child of its popper
4660
+ if (!this._popper.contains(arrow)) {
4661
+ console.warn(
4662
+ 'WARNING: `arrowElement` must be child of its popper element!'
4663
+ );
4664
+ return data;
4665
+ }
4666
+
4667
+ // arrow depends on keepTogether in order to work
4668
+ if (
4669
+ !this.isModifierRequired(
4670
+ this.modifiers.arrow,
4671
+ this.modifiers.keepTogether
4672
+ )
4673
+ ) {
4674
+ console.warn(
4675
+ 'WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!'
4676
+ );
4677
+ return data;
4678
+ }
4679
+
4680
+ var arrowStyle = {};
4681
+ var placement = data.placement.split('-')[0];
4682
+ var popper = getPopperClientRect(data.offsets.popper);
4683
+ var reference = data.offsets.reference;
4684
+ var isVertical = ['left', 'right'].indexOf(placement) !== -1;
4685
+
4686
+ var len = isVertical ? 'height' : 'width';
4687
+ var side = isVertical ? 'top' : 'left';
4688
+ var translate = isVertical ? 'translateY' : 'translateX';
4689
+ var altSide = isVertical ? 'left' : 'top';
4690
+ var opSide = isVertical ? 'bottom' : 'right';
4691
+ var arrowSize = getOuterSizes(arrow)[len];
4692
+
4693
+ //
4694
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
4695
+ //
4696
+
4697
+ // top/left side
4698
+ if (reference[opSide] - arrowSize < popper[side]) {
4699
+ data.offsets.popper[side] -=
4700
+ popper[side] - (reference[opSide] - arrowSize);
4701
+ }
4702
+ // bottom/right side
4703
+ if (reference[side] + arrowSize > popper[opSide]) {
4704
+ data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
4705
+ }
4706
+
4707
+ // compute center of the popper
4708
+ var center =
4709
+ reference[side] + (arrowOffset || reference[len] / 2 - arrowSize / 2);
4710
+
4711
+ var sideValue = center - popper[side];
4712
+
4713
+ // prevent arrow from being placed not contiguously to its popper
4714
+ sideValue = Math.max(Math.min(popper[len] - arrowSize - 8, sideValue), 8);
4715
+ arrowStyle[side] = sideValue;
4716
+ arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
4717
+
4718
+ data.offsets.arrow = arrowStyle;
4719
+ data.arrowElement = arrow;
4720
+
4721
+ return data;
4722
+ };
4723
+
4724
+ //
4725
+ // Helpers
4726
+ //
4727
+
4575
4728
  /**
4576
4729
  * Get the outer sizes of the given element (offset size + margins)
4577
4730
  * @function
4578
4731
  * @ignore
4579
4732
  * @argument {Element} element
4580
4733
  * @returns {Object} object containing width and height properties
4581
- */
4582
- function getOuterSizes(element) {
4583
- // NOTE: 1 DOM access here
4584
- var _display = element.style.display,
4585
- _visibility = element.style.visibility;
4586
- element.style.display = 'block';
4587
- element.style.visibility = 'hidden';
4588
- var calcWidthToForceRepaint = element.offsetWidth;
4589
- // original method
4590
- var styles = root.getComputedStyle(element);
4591
- var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
4592
- var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
4593
- var result = {
4594
- width: element.offsetWidth + y,
4595
- height: element.offsetHeight + x
4596
- };
4597
-
4598
- // reset element styles
4599
- element.style.display = _display;
4600
- element.style.visibility = _visibility;
4601
- return result;
4602
- }
4603
-
4734
+ */
4735
+ function getOuterSizes(element) {
4736
+ // NOTE: 1 DOM access here
4737
+ var _display = element.style.display,
4738
+ _visibility = element.style.visibility;
4739
+ element.style.display = 'block';
4740
+ element.style.visibility = 'hidden';
4741
+ var calcWidthToForceRepaint = element.offsetWidth;
4742
+ // original method
4743
+ var styles = root.getComputedStyle(element);
4744
+ var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
4745
+ var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
4746
+ var result = {
4747
+ width: element.offsetWidth + y,
4748
+ height: element.offsetHeight + x
4749
+ };
4750
+
4751
+ // reset element styles
4752
+ element.style.display = _display;
4753
+ element.style.visibility = _visibility;
4754
+ return result;
4755
+ }
4756
+
4604
4757
  /**
4605
4758
  * Get the opposite placement of the given one/
4606
4759
  * @function
4607
4760
  * @ignore
4608
4761
  * @argument {String} placement
4609
4762
  * @returns {String} flipped placement
4610
- */
4611
- function getOppositePlacement(placement) {
4612
- var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
4613
- return placement.replace(/left|right|bottom|top/g, function (matched) {
4614
- return hash[matched];
4615
- });
4616
- }
4617
-
4763
+ */
4764
+ function getOppositePlacement(placement) {
4765
+ var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
4766
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
4767
+ return hash[matched];
4768
+ });
4769
+ }
4770
+
4618
4771
  /**
4619
4772
  * Given the popper offsets, generate an output similar to getBoundingClientRect
4620
4773
  * @function
4621
4774
  * @ignore
4622
4775
  * @argument {Object} popperOffsets
4623
4776
  * @returns {Object} ClientRect like output
4624
- */
4625
- function getPopperClientRect(popperOffsets) {
4626
- var offsets = Object.assign({}, popperOffsets);
4627
- offsets.right = offsets.left + offsets.width;
4628
- offsets.bottom = offsets.top + offsets.height;
4629
- return offsets;
4630
- }
4631
-
4777
+ */
4778
+ function getPopperClientRect(popperOffsets) {
4779
+ var offsets = Object.assign({}, popperOffsets);
4780
+ offsets.right = offsets.left + offsets.width;
4781
+ offsets.bottom = offsets.top + offsets.height;
4782
+ return offsets;
4783
+ }
4784
+
4632
4785
  /**
4633
4786
  * Given an array and the key to find, returns its index
4634
4787
  * @function
@@ -4636,76 +4789,88 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4636
4789
  * @argument {Array} arr
4637
4790
  * @argument keyToFind
4638
4791
  * @returns index or null
4639
- */
4640
- function getArrayKeyIndex(arr, keyToFind) {
4641
- var i = 0,
4642
- key;
4643
- for (key in arr) {
4644
- if (arr[key] === keyToFind) {
4645
- return i;
4646
- }
4647
- i++;
4648
- }
4649
- return null;
4650
- }
4651
-
4792
+ */
4793
+ function getArrayKeyIndex(arr, keyToFind) {
4794
+ var i = 0,
4795
+ key;
4796
+ for (key in arr) {
4797
+ if (arr[key] === keyToFind) {
4798
+ return i;
4799
+ }
4800
+ i++;
4801
+ }
4802
+ return null;
4803
+ }
4804
+
4652
4805
  /**
4653
4806
  * Get CSS computed property of the given element
4654
4807
  * @function
4655
4808
  * @ignore
4656
4809
  * @argument {Eement} element
4657
4810
  * @argument {String} property
4658
- */
4659
- function getStyleComputedProperty(element, property) {
4660
- // NOTE: 1 DOM access here
4661
- var css = root.getComputedStyle(element, null);
4662
- return css[property];
4663
- }
4811
+ */
4812
+ function getStyleComputedProperty(element, property) {
4813
+ // NOTE: 1 DOM access here
4814
+ var css = root.getComputedStyle(element, null);
4815
+ return css[property];
4816
+ }
4664
4817
  /**
4665
4818
  * Returns the offset parent of the given element
4666
4819
  * @function
4667
4820
  * @ignore
4668
4821
  * @argument {Element} element
4669
4822
  * @returns {Element} offset parent
4670
- */
4671
- function getOffsetParent(element) {
4672
- var offsetParent = element.offsetParent;
4673
- return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
4674
- }
4675
-
4823
+ */
4824
+ function getOffsetParent(element) {
4825
+ var offsetParent = element.offsetParent;
4826
+ return offsetParent === root.document.body || !offsetParent
4827
+ ? root.document.documentElement
4828
+ : offsetParent;
4829
+ }
4830
+
4676
4831
  /**
4677
4832
  * Returns the scrolling parent of the given element
4678
4833
  * @function
4679
4834
  * @ignore
4680
4835
  * @argument {Element} element
4681
4836
  * @returns {Element} offset parent
4682
- */
4683
- function getScrollParent(element) {
4684
- var parent = element.parentNode;
4685
- if (!parent || parent.nodeType !== 1) {
4686
- return element;
4687
- }
4688
-
4689
- if (parent === root.document) {
4690
- // Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
4691
- // greater than 0 and return the proper element
4692
- if (root.document.body.scrollTop || root.document.body.scrollLeft) {
4693
- return root.document.body;
4694
- } else {
4695
- return root.document.documentElement;
4696
- }
4697
- }
4698
-
4699
- // Firefox want us to check `-x` and `-y` variations as well
4700
- if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
4701
- // If the detected scrollParent is body, we perform an additional check on its parentNode
4702
- // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
4703
- // fixes issue #65
4704
- return parent;
4705
- }
4706
- return getScrollParent(element.parentNode);
4707
- }
4708
-
4837
+ */
4838
+ function getScrollParent(element) {
4839
+ var parent = element.parentNode;
4840
+ if (!parent || parent.nodeType !== 1) {
4841
+ return element;
4842
+ }
4843
+
4844
+ if (parent === root.document) {
4845
+ // Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
4846
+ // greater than 0 and return the proper element
4847
+ if (root.document.body.scrollTop || root.document.body.scrollLeft) {
4848
+ return root.document.body;
4849
+ } else {
4850
+ return root.document.documentElement;
4851
+ }
4852
+ }
4853
+
4854
+ // Firefox want us to check `-x` and `-y` variations as well
4855
+ if (
4856
+ ['scroll', 'auto'].indexOf(
4857
+ getStyleComputedProperty(parent, 'overflow')
4858
+ ) !== -1 ||
4859
+ ['scroll', 'auto'].indexOf(
4860
+ getStyleComputedProperty(parent, 'overflow-x')
4861
+ ) !== -1 ||
4862
+ ['scroll', 'auto'].indexOf(
4863
+ getStyleComputedProperty(parent, 'overflow-y')
4864
+ ) !== -1
4865
+ ) {
4866
+ // If the detected scrollParent is body, we perform an additional check on its parentNode
4867
+ // in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
4868
+ // fixes issue #65
4869
+ return parent;
4870
+ }
4871
+ return getScrollParent(element.parentNode);
4872
+ }
4873
+
4709
4874
  /**
4710
4875
  * Check if the given element is fixed or is inside a fixed parent
4711
4876
  * @function
@@ -4713,109 +4878,122 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4713
4878
  * @argument {Element} element
4714
4879
  * @argument {Element} customContainer
4715
4880
  * @returns {Boolean} answer to "isFixed?"
4716
- */
4717
- function isFixed(element) {
4718
- if (element === root.document.body) {
4719
- return false;
4720
- }
4721
- if (getStyleComputedProperty(element, 'position') === 'fixed') {
4722
- return true;
4723
- }
4724
- return element.parentNode && element.parentNode.nodeType === 1 ? isFixed(element.parentNode) : element;
4725
- }
4726
-
4881
+ */
4882
+ function isFixed(element) {
4883
+ if (element === root.document.body) {
4884
+ return false;
4885
+ }
4886
+ if (getStyleComputedProperty(element, 'position') === 'fixed') {
4887
+ return true;
4888
+ }
4889
+ return element.parentNode && element.parentNode.nodeType === 1
4890
+ ? isFixed(element.parentNode)
4891
+ : element;
4892
+ }
4893
+
4727
4894
  /**
4728
4895
  * Set the style to the given popper
4729
4896
  * @function
4730
4897
  * @ignore
4731
4898
  * @argument {Element} element - Element to apply the style to
4732
4899
  * @argument {Object} styles - Object with a list of properties and values which will be applied to the element
4733
- */
4734
- function setStyle(element, styles) {
4735
- function is_numeric(n) {
4736
- return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
4737
- }
4738
- Object.keys(styles).forEach(function (prop) {
4739
- var unit = '';
4740
- // add unit if the value is numeric and is one of the following
4741
- if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
4742
- unit = 'px';
4743
- }
4744
- element.style[prop] = styles[prop] + unit;
4745
- });
4746
- }
4747
-
4900
+ */
4901
+ function setStyle(element, styles) {
4902
+ function is_numeric(n) {
4903
+ return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
4904
+ }
4905
+ Object.keys(styles).forEach(function (prop) {
4906
+ var unit = '';
4907
+ // add unit if the value is numeric and is one of the following
4908
+ if (
4909
+ ['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !==
4910
+ -1 &&
4911
+ is_numeric(styles[prop])
4912
+ ) {
4913
+ unit = 'px';
4914
+ }
4915
+ element.style[prop] = styles[prop] + unit;
4916
+ });
4917
+ }
4918
+
4748
4919
  /**
4749
4920
  * Check if the given variable is a function
4750
4921
  * @function
4751
4922
  * @ignore
4752
4923
  * @argument {*} functionToCheck - variable to check
4753
4924
  * @returns {Boolean} answer to: is a function?
4754
- */
4755
- function isFunction(functionToCheck) {
4756
- var getType = {};
4757
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
4758
- }
4759
-
4925
+ */
4926
+ function isFunction(functionToCheck) {
4927
+ var getType = {};
4928
+ return (
4929
+ functionToCheck &&
4930
+ getType.toString.call(functionToCheck) === '[object Function]'
4931
+ );
4932
+ }
4933
+
4760
4934
  /**
4761
4935
  * Get the position of the given element, relative to its offset parent
4762
4936
  * @function
4763
4937
  * @ignore
4764
4938
  * @param {Element} element
4765
4939
  * @return {Object} position - Coordinates of the element and its `scrollTop`
4766
- */
4767
- function getOffsetRect(element) {
4768
- var transform = getStyle(element, 'transform').replace(/[^0-9\-,]/g, '').split(',');
4769
- var elementRect = {
4770
- width: element.offsetWidth,
4771
- height: element.offsetHeight,
4772
- left: element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
4773
- top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
4774
- };
4775
-
4776
- elementRect.right = elementRect.left + elementRect.width;
4777
- elementRect.bottom = elementRect.top + elementRect.height;
4778
-
4779
- // position
4780
- return elementRect;
4781
- }
4782
-
4940
+ */
4941
+ function getOffsetRect(element) {
4942
+ var transform = getStyle(element, 'transform')
4943
+ .replace(/[^0-9\-,]/g, '')
4944
+ .split(',');
4945
+ var elementRect = {
4946
+ width: element.offsetWidth,
4947
+ height: element.offsetHeight,
4948
+ left:
4949
+ element.offsetLeft + (transform[4] ? parseInt(transform[4], 10) : 0),
4950
+ top: element.offsetTop + (transform[5] ? parseInt(transform[5], 10) : 0)
4951
+ };
4952
+
4953
+ elementRect.right = elementRect.left + elementRect.width;
4954
+ elementRect.bottom = elementRect.top + elementRect.height;
4955
+
4956
+ // position
4957
+ return elementRect;
4958
+ }
4959
+
4783
4960
  /**
4784
4961
  * Get bounding client rect of given element
4785
4962
  * @function
4786
4963
  * @ignore
4787
4964
  * @param {HTMLElement} element
4788
4965
  * @return {Object} client rect
4789
- */
4790
- function getBoundingClientRect(element) {
4791
- var rect = element.getBoundingClientRect();
4792
-
4793
- // whether the IE version is lower than 11
4794
- var isIE = /MSIE|Trident/.test(navigator.userAgent);
4795
-
4796
- // fix ie document bounding top always 0 bug
4797
- var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
4798
-
4799
- return {
4800
- left: rect.left,
4801
- top: rectTop,
4802
- right: rect.right,
4803
- bottom: rect.bottom,
4804
- width: rect.right - rect.left,
4805
- height: rect.bottom - rectTop
4806
- };
4807
- }
4808
-
4809
- function getStyle(dom, attr) {
4810
- if (dom.style[attr]) {
4811
- return dom.style[attr];
4812
- }
4813
- if (window.getComputedStyle) {
4814
- return getComputedStyle(dom, null)[attr];
4815
- }
4816
- return dom.currentStyle[attr];
4817
- }
4818
-
4966
+ */
4967
+ function getBoundingClientRect(element) {
4968
+ var rect = element.getBoundingClientRect();
4969
+
4970
+ // whether the IE version is lower than 11
4971
+ var isIE = /MSIE|Trident/.test(navigator.userAgent);
4972
+
4973
+ // fix ie document bounding top always 0 bug
4974
+ var rectTop =
4975
+ isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
4976
+
4977
+ return {
4978
+ left: rect.left,
4979
+ top: rectTop,
4980
+ right: rect.right,
4981
+ bottom: rect.bottom,
4982
+ width: rect.right - rect.left,
4983
+ height: rect.bottom - rectTop
4984
+ };
4985
+ }
4986
+
4987
+ function getStyle(dom, attr) {
4988
+ if (dom.style[attr]) {
4989
+ return dom.style[attr];
4990
+ }
4991
+ if (window.getComputedStyle) {
4992
+ return getComputedStyle(dom, null)[attr];
4993
+ }
4994
+ return dom.currentStyle[attr];
4995
+ }
4996
+
4819
4997
  /**
4820
4998
  * Given an element and one of its parents, return the offset
4821
4999
  * @function
@@ -4823,49 +5001,51 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4823
5001
  * @param {HTMLElement} element
4824
5002
  * @param {HTMLElement} parent
4825
5003
  * @return {Object} rect
4826
- */
4827
- function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
4828
- var elementRect = getBoundingClientRect(element);
4829
- var parentRect = getBoundingClientRect(parent);
4830
-
4831
- if (fixed) {
4832
- var scrollParent = getScrollParent(parent);
4833
- parentRect.top += scrollParent.scrollTop;
4834
- parentRect.bottom += scrollParent.scrollTop;
4835
- parentRect.left += scrollParent.scrollLeft;
4836
- parentRect.right += scrollParent.scrollLeft;
4837
- }
4838
-
4839
- var rect = {
4840
- top: elementRect.top - parentRect.top,
4841
- left: elementRect.left - parentRect.left,
4842
- bottom: elementRect.top - parentRect.top + elementRect.height,
4843
- right: elementRect.left - parentRect.left + elementRect.width,
4844
- width: elementRect.width,
4845
- height: elementRect.height
4846
- };
4847
- return rect;
4848
- }
4849
-
5004
+ */
5005
+ function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
5006
+ var elementRect = getBoundingClientRect(element);
5007
+ var parentRect = getBoundingClientRect(parent);
5008
+
5009
+ if (fixed) {
5010
+ var scrollParent = getScrollParent(parent);
5011
+ parentRect.top += scrollParent.scrollTop;
5012
+ parentRect.bottom += scrollParent.scrollTop;
5013
+ parentRect.left += scrollParent.scrollLeft;
5014
+ parentRect.right += scrollParent.scrollLeft;
5015
+ }
5016
+
5017
+ var rect = {
5018
+ top: elementRect.top - parentRect.top,
5019
+ left: elementRect.left - parentRect.left,
5020
+ bottom: elementRect.top - parentRect.top + elementRect.height,
5021
+ right: elementRect.left - parentRect.left + elementRect.width,
5022
+ width: elementRect.width,
5023
+ height: elementRect.height
5024
+ };
5025
+ return rect;
5026
+ }
5027
+
4850
5028
  /**
4851
5029
  * Get the prefixed supported property name
4852
5030
  * @function
4853
5031
  * @ignore
4854
5032
  * @argument {String} property (camelCase)
4855
5033
  * @returns {String} prefixed property (camelCase)
4856
- */
4857
- function getSupportedPropertyName(property) {
4858
- var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
4859
-
4860
- for (var i = 0; i < prefixes.length; i++) {
4861
- var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
4862
- if (typeof root.document.body.style[toCheck] !== 'undefined') {
4863
- return toCheck;
4864
- }
4865
- }
4866
- return null;
4867
- }
4868
-
5034
+ */
5035
+ function getSupportedPropertyName(property) {
5036
+ var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
5037
+
5038
+ for (var i = 0; i < prefixes.length; i++) {
5039
+ var toCheck = prefixes[i]
5040
+ ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1)
5041
+ : property;
5042
+ if (typeof root.document.body.style[toCheck] !== 'undefined') {
5043
+ return toCheck;
5044
+ }
5045
+ }
5046
+ return null;
5047
+ }
5048
+
4869
5049
  /**
4870
5050
  * The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
4871
5051
  * objects to a target object. It will return the target object.
@@ -4873,41 +5053,46 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof =
4873
5053
  * Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
4874
5054
  * @function
4875
5055
  * @ignore
4876
- */
4877
- if (!Object.assign) {
4878
- Object.defineProperty(Object, 'assign', {
4879
- enumerable: false,
4880
- configurable: true,
4881
- writable: true,
4882
- value: function value(target) {
4883
- if (target === undefined || target === null) {
4884
- throw new TypeError('Cannot convert first argument to object');
4885
- }
4886
-
4887
- var to = Object(target);
4888
- for (var i = 1; i < arguments.length; i++) {
4889
- var nextSource = arguments[i];
4890
- if (nextSource === undefined || nextSource === null) {
4891
- continue;
4892
- }
4893
- nextSource = Object(nextSource);
4894
-
4895
- var keysArray = Object.keys(nextSource);
4896
- for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
4897
- var nextKey = keysArray[nextIndex];
4898
- var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
4899
- if (desc !== undefined && desc.enumerable) {
4900
- to[nextKey] = nextSource[nextKey];
4901
- }
4902
- }
4903
- }
4904
- return to;
4905
- }
4906
- });
4907
- }
5056
+ */
5057
+ if (!Object.assign) {
5058
+ Object.defineProperty(Object, 'assign', {
5059
+ enumerable: false,
5060
+ configurable: true,
5061
+ writable: true,
5062
+ value: function (target) {
5063
+ if (target === undefined || target === null) {
5064
+ throw new TypeError('Cannot convert first argument to object');
5065
+ }
5066
+
5067
+ var to = Object(target);
5068
+ for (var i = 1; i < arguments.length; i++) {
5069
+ var nextSource = arguments[i];
5070
+ if (nextSource === undefined || nextSource === null) {
5071
+ continue;
5072
+ }
5073
+ nextSource = Object(nextSource);
5074
+
5075
+ var keysArray = Object.keys(nextSource);
5076
+ for (
5077
+ var nextIndex = 0, len = keysArray.length;
5078
+ nextIndex < len;
5079
+ nextIndex++
5080
+ ) {
5081
+ var nextKey = keysArray[nextIndex];
5082
+ var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
5083
+ if (desc !== undefined && desc.enumerable) {
5084
+ to[nextKey] = nextSource[nextKey];
5085
+ }
5086
+ }
5087
+ }
5088
+ return to;
5089
+ }
5090
+ });
5091
+ }
5092
+
5093
+ return Popper;
5094
+ });
4908
5095
 
4909
- return Popper;
4910
- });
4911
5096
 
4912
5097
  /***/ }),
4913
5098