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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/lib/0.js +1 -1
  2. package/lib/1.js +1 -1
  3. package/lib/10.js +1 -1
  4. package/lib/11.js +1 -1
  5. package/lib/12.js +1 -1
  6. package/lib/13.js +1 -1
  7. package/lib/14.js +1 -1
  8. package/lib/15.js +1 -1
  9. package/lib/16.js +1 -1
  10. package/lib/17.js +1 -1
  11. package/lib/18.js +1 -1
  12. package/lib/19.js +1 -1
  13. package/lib/20.js +1 -1
  14. package/lib/21.js +1 -1
  15. package/lib/22.js +1 -1
  16. package/lib/23.js +1 -1
  17. package/lib/24.js +1 -1
  18. package/lib/25.js +1 -1
  19. package/lib/26.js +1 -1
  20. package/lib/27.js +1 -1
  21. package/lib/28.js +1 -1
  22. package/lib/29.js +1 -1
  23. package/lib/3.js +1 -1
  24. package/lib/30.js +1 -1
  25. package/lib/31.js +1 -1
  26. package/lib/32.js +1 -1
  27. package/lib/33.js +1 -1
  28. package/lib/34.js +1 -1
  29. package/lib/35.js +1 -1
  30. package/lib/36.js +1 -1
  31. package/lib/37.js +1 -1
  32. package/lib/38.js +1 -1
  33. package/lib/39.js +1 -1
  34. package/lib/4.js +1 -1
  35. package/lib/40.js +1 -1
  36. package/lib/41.js +1 -1
  37. package/lib/42.js +1 -1
  38. package/lib/43.js +1 -1
  39. package/lib/44.js +1 -1
  40. package/lib/45.js +1 -1
  41. package/lib/46.js +1 -1
  42. package/lib/47.js +1 -1
  43. package/lib/48.js +1 -1
  44. package/lib/49.js +1 -1
  45. package/lib/5.js +1 -1
  46. package/lib/50.js +1 -1
  47. package/lib/51.js +1 -1
  48. package/lib/52.js +1 -1
  49. package/lib/53.js +1 -1
  50. package/lib/54.js +1 -1
  51. package/lib/55.js +1 -1
  52. package/lib/56.js +1 -1
  53. package/lib/57.js +1 -1
  54. package/lib/58.js +1 -1
  55. package/lib/59.js +1 -1
  56. package/lib/6.js +1 -1
  57. package/lib/60.js +1 -1
  58. package/lib/61.js +1 -1
  59. package/lib/62.js +1 -1
  60. package/lib/63.js +1 -1
  61. package/lib/64.js +1 -1
  62. package/lib/65.js +1 -1
  63. package/lib/66.js +1 -1
  64. package/lib/67.js +1 -1
  65. package/lib/68.js +1 -1
  66. package/lib/69.js +1 -1
  67. package/lib/7.js +1 -1
  68. package/lib/70.js +1 -1
  69. package/lib/71.js +1 -1
  70. package/lib/72.js +1 -1
  71. package/lib/73.js +1 -1
  72. package/lib/74.js +1 -1
  73. package/lib/75.js +1 -1
  74. package/lib/76.js +1 -1
  75. package/lib/77.js +1 -1
  76. package/lib/78.js +1 -1
  77. package/lib/79.js +1 -1
  78. package/lib/8.js +1 -1
  79. package/lib/80.js +1 -1
  80. package/lib/81.js +1 -1
  81. package/lib/9.js +1 -1
  82. package/lib/account-login.js +837 -862
  83. package/lib/alert.js +2 -2
  84. package/lib/aside.js +2 -2
  85. package/lib/audit-trajectory.js +4 -4
  86. package/lib/autocomplete.js +1813 -1988
  87. package/lib/avatar.js +2 -2
  88. package/lib/backtop.js +2 -2
  89. package/lib/badge.js +2 -2
  90. package/lib/breadcrumb-item.js +4 -4
  91. package/lib/breadcrumb.js +4 -4
  92. package/lib/button-group.js +4 -4
  93. package/lib/button.js +2 -2
  94. package/lib/ca-login.js +837 -862
  95. package/lib/calendar.js +839 -864
  96. package/lib/card.js +2 -2
  97. package/lib/carousel-item.js +846 -871
  98. package/lib/carousel.js +839 -864
  99. package/lib/cascader-panel.js +852 -877
  100. package/lib/cascader.js +2048 -2223
  101. package/lib/checkbox-button.js +4 -4
  102. package/lib/checkbox-group.js +859 -884
  103. package/lib/checkbox.js +4 -4
  104. package/lib/col.js +2 -2
  105. package/lib/collapse-item.js +1040 -1065
  106. package/lib/collapse.js +1040 -1065
  107. package/lib/color-picker.js +972 -1122
  108. package/lib/container.js +2 -2
  109. package/lib/cron.js +12 -12
  110. package/lib/data-table.js +843 -868
  111. package/lib/date-picker.js +10520 -10695
  112. package/lib/descriptions-item.js +4 -4
  113. package/lib/descriptions.js +4 -4
  114. package/lib/dialog.js +837 -862
  115. package/lib/divider.js +2 -2
  116. package/lib/drawer.js +2 -2
  117. package/lib/dropdown-item.js +4 -4
  118. package/lib/dropdown-menu.js +974 -1124
  119. package/lib/dropdown.js +841 -866
  120. package/lib/email-login.js +837 -862
  121. package/lib/empty.js +2 -2
  122. package/lib/eoss.common.js +4023 -2668
  123. package/lib/flip.js +2 -2
  124. package/lib/flow-group.js +853 -878
  125. package/lib/flow.js +868 -893
  126. package/lib/flows.js +854 -879
  127. package/lib/footer.js +2 -2
  128. package/lib/form-item.js +860 -885
  129. package/lib/form.js +933 -950
  130. package/lib/guide.js +2 -2
  131. package/lib/header.js +2 -2
  132. package/lib/icon.js +837 -862
  133. package/lib/icons.js +2 -2
  134. package/lib/image-viewer.js +837 -862
  135. package/lib/image.js +4 -4
  136. package/lib/index.js +1 -1
  137. package/lib/infinite-scroll.js +2 -2
  138. package/lib/input-number.js +6 -6
  139. package/lib/input.js +839 -864
  140. package/lib/link.js +2 -2
  141. package/lib/loading.js +2 -2
  142. package/lib/login.js +867 -891
  143. package/lib/lowcode-view.js +1843 -1185
  144. package/lib/lowcode.js +3050 -1569
  145. package/lib/main.js +970 -988
  146. package/lib/marquee.js +837 -862
  147. package/lib/menu-item-group.js +15 -15
  148. package/lib/menu-item.js +6 -6
  149. package/lib/menu.js +2227 -2368
  150. package/lib/message-box.js +843 -868
  151. package/lib/message.js +839 -864
  152. package/lib/notification.js +861 -886
  153. package/lib/option-group.js +4 -4
  154. package/lib/option.js +839 -864
  155. package/lib/page-header.js +2 -2
  156. package/lib/pagination.js +839 -864
  157. package/lib/phone-login.js +847 -866
  158. package/lib/popconfirm.js +4 -4
  159. package/lib/popover.js +1831 -2006
  160. package/lib/process-config.js +839 -864
  161. package/lib/process-module.js +846 -871
  162. package/lib/process-rule.js +905 -930
  163. package/lib/progress.js +2 -2
  164. package/lib/qr-code.js +4 -4
  165. package/lib/qrcode-login.js +839 -864
  166. package/lib/radio-button.js +4 -4
  167. package/lib/radio-group.js +850 -875
  168. package/lib/radio.js +4 -4
  169. package/lib/rate.js +837 -862
  170. package/lib/retrial-auth.js +837 -862
  171. package/lib/row.js +2 -2
  172. package/lib/scrollbar.js +839 -864
  173. package/lib/select.js +2139 -2314
  174. package/lib/selector-panel.js +940 -965
  175. package/lib/selector.js +852 -877
  176. package/lib/slider.js +4 -4
  177. package/lib/step.js +32 -32
  178. package/lib/steps.js +874 -899
  179. package/lib/submenu.js +1269 -1385
  180. package/lib/switch.js +839 -864
  181. package/lib/tab-pane.js +4 -4
  182. package/lib/table-column.js +840 -865
  183. package/lib/table.js +1825 -2000
  184. package/lib/tabs.js +846 -871
  185. package/lib/tag.js +2 -2
  186. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  187. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  188. package/lib/theme-chalk/index.css +1 -1
  189. package/lib/theme-chalk/lowcode.css +1 -1
  190. package/lib/time-picker.js +6471 -6646
  191. package/lib/time-select.js +5039 -5214
  192. package/lib/timeline-item.js +2 -2
  193. package/lib/timeline.js +2 -2
  194. package/lib/tips.js +837 -862
  195. package/lib/toolbar.js +4 -4
  196. package/lib/tooltip.js +1813 -1988
  197. package/lib/transfer.js +837 -862
  198. package/lib/tree-group.js +853 -878
  199. package/lib/tree.js +1026 -1051
  200. package/lib/update-history.js +4 -4
  201. package/lib/upload.js +859 -884
  202. package/lib/wujie.js +841 -866
  203. package/package.json +1 -1
  204. package/packages/flow-group/src/main.vue +2 -2
  205. package/packages/form/src/form-item-render.vue +1 -0
  206. package/packages/form/src/form-item.vue +12 -6
  207. package/packages/form/src/form.vue +5 -5
  208. package/packages/login/src/login.vue +1 -0
  209. package/packages/lowcode/src/attribute/function.vue +28 -9
  210. package/packages/lowcode/src/attribute/props.vue +202 -0
  211. package/packages/lowcode/src/attribute/styles.vue +79 -5
  212. package/packages/lowcode/src/attribute.vue +61 -4
  213. package/packages/lowcode/src/canvas.vue +159 -2
  214. package/packages/lowcode/src/form-render.vue +305 -0
  215. package/packages/lowcode/src/lowcode.vue +33 -13
  216. package/packages/lowcode/src/modules.vue +53 -37
  217. package/packages/lowcode/src/render.vue +80 -25
  218. package/packages/lowcode/src/util/components.js +100 -0
  219. package/packages/lowcode/src/util/props-util.js +67 -0
  220. package/packages/lowcode/src/util/source-generator.js +69 -9
  221. package/packages/lowcode/src/util/source-parser.js +64 -10
  222. package/packages/lowcode-view/src/render.vue +48 -18
  223. package/packages/main/src/components/userinfo.vue +0 -1
  224. package/packages/menu/src/menu-item-group.vue +1 -1
  225. package/packages/menu/src/mixins.js +8 -4
  226. package/packages/menu/src/submenu.vue +35 -5
  227. package/packages/phone-login/src/phone-login.vue +5 -2
  228. package/packages/theme-chalk/dist/fonts/iconfont.ttf +0 -0
  229. package/packages/theme-chalk/dist/fonts/iconfont.woff +0 -0
  230. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  231. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  232. package/packages/theme-chalk/src/lowcode.scss +21 -2
  233. package/src/index.js +336 -336
package/lib/collapse.js CHANGED
@@ -136,7 +136,7 @@ module.exports =
136
136
  /******/
137
137
  /******/
138
138
  /******/ // Load entry module and return exports
139
- /******/ return __webpack_require__(__webpack_require__.s = 228);
139
+ /******/ return __webpack_require__(__webpack_require__.s = 235);
140
140
  /******/ })
141
141
  /************************************************************************/
142
142
  /******/ ({
@@ -3339,7 +3339,7 @@ var warning = function warning(content, _callback3) {
3339
3339
 
3340
3340
  /***/ }),
3341
3341
 
3342
- /***/ 106:
3342
+ /***/ 108:
3343
3343
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3344
3344
 
3345
3345
  "use strict";
@@ -3519,7 +3519,7 @@ render._withStripped = true
3519
3519
  // CONCATENATED MODULE: ./packages/collapse/src/collapse-item.vue?vue&type=template&id=3e44a2c5&
3520
3520
 
3521
3521
  // EXTERNAL MODULE: ./src/transitions/collapse-transition.js
3522
- var collapse_transition = __webpack_require__(69);
3522
+ var collapse_transition = __webpack_require__(70);
3523
3523
 
3524
3524
  // EXTERNAL MODULE: ./src/mixins/emitter.js
3525
3525
  var emitter = __webpack_require__(15);
@@ -3532,7 +3532,7 @@ var icon_ = __webpack_require__(26);
3532
3532
  var icon_default = /*#__PURE__*/__webpack_require__.n(icon_);
3533
3533
 
3534
3534
  // EXTERNAL MODULE: ./src/components/field-render.vue + 4 modules
3535
- var field_render = __webpack_require__(77);
3535
+ var field_render = __webpack_require__(78);
3536
3536
 
3537
3537
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/collapse/src/collapse-item.vue?vue&type=script&lang=js&
3538
3538
  function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
@@ -4069,7 +4069,7 @@ module.exports = require("vue");
4069
4069
 
4070
4070
  /***/ }),
4071
4071
 
4072
- /***/ 228:
4072
+ /***/ 235:
4073
4073
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4074
4074
 
4075
4075
  "use strict";
@@ -4120,7 +4120,7 @@ render._withStripped = true
4120
4120
  // CONCATENATED MODULE: ./packages/collapse/src/collapse.vue?vue&type=template&id=6ef216cc&
4121
4121
 
4122
4122
  // EXTERNAL MODULE: ./packages/collapse/src/collapse-item.vue + 4 modules
4123
- var collapse_item = __webpack_require__(106);
4123
+ var collapse_item = __webpack_require__(108);
4124
4124
 
4125
4125
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/collapse/src/collapse.vue?vue&type=script&lang=js&
4126
4126
  //
@@ -4492,13 +4492,6 @@ module.exports = require("eoss/lib/radio-group");
4492
4492
 
4493
4493
  /***/ }),
4494
4494
 
4495
- /***/ 49:
4496
- /***/ (function(module, exports) {
4497
-
4498
- module.exports = require("eoss/lib/upload");
4499
-
4500
- /***/ }),
4501
-
4502
4495
  /***/ 5:
4503
4496
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4504
4497
 
@@ -4761,137 +4754,42 @@ function insertAfter(newEl, targetEl) {
4761
4754
  /***/ 50:
4762
4755
  /***/ (function(module, exports) {
4763
4756
 
4764
- module.exports = require("eoss/lib/tree");
4757
+ module.exports = require("eoss/lib/upload");
4765
4758
 
4766
4759
  /***/ }),
4767
4760
 
4768
- /***/ 54:
4761
+ /***/ 51:
4769
4762
  /***/ (function(module, exports) {
4770
4763
 
4771
- module.exports = require("eoss/lib/input-number");
4764
+ module.exports = require("eoss/lib/tree");
4772
4765
 
4773
4766
  /***/ }),
4774
4767
 
4775
- /***/ 64:
4768
+ /***/ 56:
4776
4769
  /***/ (function(module, exports) {
4777
4770
 
4778
- module.exports = require("eoss/lib/switch");
4771
+ module.exports = require("eoss/lib/input-number");
4779
4772
 
4780
4773
  /***/ }),
4781
4774
 
4782
4775
  /***/ 65:
4783
4776
  /***/ (function(module, exports) {
4784
4777
 
4785
- module.exports = require("eoss/lib/color-picker");
4778
+ module.exports = require("eoss/lib/switch");
4786
4779
 
4787
4780
  /***/ }),
4788
4781
 
4789
4782
  /***/ 66:
4790
4783
  /***/ (function(module, exports) {
4791
4784
 
4792
- module.exports = require("eoss/lib/selector");
4785
+ module.exports = require("eoss/lib/color-picker");
4793
4786
 
4794
4787
  /***/ }),
4795
4788
 
4796
- /***/ 69:
4797
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4798
-
4799
- "use strict";
4800
- /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
4801
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4802
-
4803
-
4804
-
4805
- var Transition = function () {
4806
- function Transition() {
4807
- _classCallCheck(this, Transition);
4808
- }
4809
-
4810
- Transition.prototype.beforeEnter = function beforeEnter(el) {
4811
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
4812
- if (!el.dataset) el.dataset = {};
4813
- if (el.dataset.state === 6 || !el.dataset.state) {
4814
- el.dataset.oldPaddingTop = el.style.paddingTop;
4815
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
4816
- }
4817
- el.dataset.state = 1;
4818
-
4819
- el.style.height = '0';
4820
- el.style.paddingTop = 0;
4821
- el.style.paddingBottom = 0;
4822
- };
4823
-
4824
- Transition.prototype.enter = function enter(el) {
4825
- el.dataset.oldOverflow = el.style.overflow;
4826
- if (el.scrollHeight !== 0) {
4827
- el.style.height = el.scrollHeight + 'px';
4828
- el.style.paddingTop = el.dataset.oldPaddingTop;
4829
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
4830
- } else {
4831
- el.style.height = '';
4832
- el.style.paddingTop = el.dataset.oldPaddingTop;
4833
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
4834
- }
4835
-
4836
- el.dataset.state = 2;
4837
- el.style.overflow = 'hidden';
4838
- };
4839
-
4840
- Transition.prototype.afterEnter = function afterEnter(el) {
4841
- // for safari: remove class then reset height is necessary
4842
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
4843
- el.style.height = '';
4844
- el.style.overflow = el.dataset.oldOverflow;
4845
- el.dataset.state = 3;
4846
- };
4847
-
4848
- Transition.prototype.beforeLeave = function beforeLeave(el) {
4849
- if (!el.dataset) el.dataset = {};
4850
- el.dataset.oldPaddingTop = el.style.paddingTop;
4851
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
4852
- el.dataset.oldOverflow = el.style.overflow;
4853
- el.dataset.state = 4;
4854
-
4855
- el.style.height = el.scrollHeight + 'px';
4856
- el.style.overflow = 'hidden';
4857
- };
4858
-
4859
- Transition.prototype.leave = function leave(el) {
4860
- if (el.scrollHeight !== 0) {
4861
- // for safari: add class after set height, or it will jump to zero height suddenly, weired
4862
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
4863
- el.style.height = 0;
4864
- el.style.paddingTop = 0;
4865
- el.style.paddingBottom = 0;
4866
- el.dataset.state = 5;
4867
- }
4868
- };
4869
-
4870
- Transition.prototype.afterLeave = function afterLeave(el) {
4871
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
4872
- el.style.height = '';
4873
- el.style.overflow = el.dataset.oldOverflow;
4874
- el.style.paddingTop = el.dataset.oldPaddingTop;
4875
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
4876
- el.dataset.state = 6;
4877
- };
4878
-
4879
- return Transition;
4880
- }();
4881
-
4882
- /* harmony default export */ __webpack_exports__["a"] = ({
4883
- name: 'EsCollapseTransition',
4884
- functional: true,
4885
- render: function render(h, _ref) {
4886
- var children = _ref.children;
4887
-
4888
- var data = {
4889
- on: new Transition()
4890
- };
4789
+ /***/ 67:
4790
+ /***/ (function(module, exports) {
4891
4791
 
4892
- return h('transition', data, children);
4893
- }
4894
- });
4792
+ module.exports = require("eoss/lib/selector");
4895
4793
 
4896
4794
  /***/ }),
4897
4795
 
@@ -4945,996 +4843,1073 @@ var Transition = function () {
4945
4843
  /* unused harmony export getSecond */
4946
4844
  /* unused harmony export getWeekday */
4947
4845
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
4948
- /* Modified from https://github.com/taylorhakes/fecha
4949
- *
4950
- * The MIT License (MIT)
4951
- *
4952
- * Copyright (c) 2015 Taylor Hakes
4953
- *
4954
- * Permission is hereby granted, free of charge, to any person obtaining a copy
4955
- * of this software and associated documentation files (the "Software"), to deal
4956
- * in the Software without restriction, including without limitation the rights
4957
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4958
- * copies of the Software, and to permit persons to whom the Software is
4959
- * furnished to do so, subject to the following conditions:
4960
- *
4961
- * The above copyright notice and this permission notice shall be included in all
4962
- * copies or substantial portions of the Software.
4963
- *
4964
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4965
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4966
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4967
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4968
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4969
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4970
- * SOFTWARE.
4971
- */
4972
-
4973
- /*eslint-disable*/
4974
- // 把 YYYY-MM-DD 改成了 yyyy-MM-dd
4975
-
4976
-
4846
+
4847
+
4977
4848
  /**
4978
4849
  * Parse or format dates
4979
4850
  * @class fecha
4980
- */
4981
- const fecha = {};
4982
- const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
4983
- const twoDigits = '\\d\\d?';
4984
- const threeDigits = '\\d{3}';
4985
- const fourDigits = '\\d{4}';
4986
- const word = '[^\\s]+';
4987
- const literal = /\[([^]*?)\]/gm;
4988
- const noop = function () {};
4989
-
4990
- function regexEscape(str) {
4991
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
4992
- }
4993
-
4994
- function shorten(arr, sLen) {
4995
- const newArr = [];
4996
- for (let i = 0, len = arr.length; i < len; i++) {
4997
- newArr.push(arr[i].substr(0, sLen));
4998
- }
4999
- return newArr;
5000
- }
5001
-
5002
- function monthUpdate() {
5003
- return function (d, v) {
5004
- const index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
5005
- if (~index) {
5006
- d.month = index;
5007
- }
5008
- };
5009
- }
5010
-
5011
- function pad(val, len) {
5012
- val = String(val);
5013
- len = len || 2;
5014
- while (val.length < len) {
5015
- val = '0' + val;
5016
- }
5017
- return val;
5018
- }
5019
-
5020
- // 直接使用中文日期名称常量
5021
- const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
5022
- const monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
5023
- const monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
5024
- const dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
5025
- const amPm = ['上午', '下午'];
5026
- const DoFn = function DoFn(D) {
5027
- return D + '日';
5028
- };
5029
-
5030
- const formatFlags = {
5031
- D: function(dateObj) {
5032
- return dateObj.getDay();
5033
- },
5034
- DD: function(dateObj) {
5035
- return pad(dateObj.getDay());
5036
- },
5037
- Do: function(dateObj) {
5038
- return DoFn(dateObj.getDate());
5039
- },
5040
- d: function(dateObj) {
5041
- return dateObj.getDate();
5042
- },
5043
- dd: function(dateObj) {
5044
- return pad(dateObj.getDate());
5045
- },
5046
- ddd: function(dateObj) {
5047
- return dayNamesShort[dateObj.getDay()];
5048
- },
5049
- dddd: function(dateObj) {
5050
- return dayNames[dateObj.getDay()];
5051
- },
5052
- M: function(dateObj) {
5053
- return dateObj.getMonth() + 1;
5054
- },
5055
- MM: function(dateObj) {
5056
- return pad(dateObj.getMonth() + 1);
5057
- },
5058
- MMM: function(dateObj) {
5059
- return monthNamesShort[dateObj.getMonth()];
5060
- },
5061
- MMMM: function(dateObj) {
5062
- return monthNames[dateObj.getMonth()];
5063
- },
5064
- yy: function(dateObj) {
5065
- return pad(String(dateObj.getFullYear()), 4).substr(2);
5066
- },
5067
- yyyy: function(dateObj) {
5068
- return pad(dateObj.getFullYear(), 4);
5069
- },
5070
- h: function(dateObj) {
5071
- return dateObj.getHours() % 12 || 12;
5072
- },
5073
- hh: function(dateObj) {
5074
- return pad(dateObj.getHours() % 12 || 12);
5075
- },
5076
- H: function(dateObj) {
5077
- return dateObj.getHours();
5078
- },
5079
- HH: function(dateObj) {
5080
- return pad(dateObj.getHours());
5081
- },
5082
- m: function(dateObj) {
5083
- return dateObj.getMinutes();
5084
- },
5085
- mm: function(dateObj) {
5086
- return pad(dateObj.getMinutes());
5087
- },
5088
- s: function(dateObj) {
5089
- return dateObj.getSeconds();
5090
- },
5091
- ss: function(dateObj) {
5092
- return pad(dateObj.getSeconds());
5093
- },
5094
- S: function(dateObj) {
5095
- return Math.round(dateObj.getMilliseconds() / 100);
5096
- },
5097
- SS: function(dateObj) {
5098
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
5099
- },
5100
- SSS: function(dateObj) {
5101
- return pad(dateObj.getMilliseconds(), 3);
5102
- },
5103
- a: function(dateObj) {
5104
- return dateObj.getHours() < 12 ? '上午' : '下午';
5105
- },
5106
- A: function(dateObj) {
5107
- return dateObj.getHours() < 12 ? '上午' : '下午';
5108
- },
5109
- ZZ: function(dateObj) {
5110
- const o = dateObj.getTimezoneOffset();
5111
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
5112
- }
5113
- };
5114
-
5115
- const parseFlags = {
5116
- d: [twoDigits, function (d, v) {
5117
- d.day = v;
5118
- }],
5119
- Do: [twoDigits + word, function (d, v) {
5120
- d.day = parseInt(v, 10);
5121
- }],
5122
- M: [twoDigits, function (d, v) {
5123
- d.month = v - 1;
5124
- }],
5125
- yy: [twoDigits, function (d, v) {
5126
- const da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
5127
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
5128
- }],
5129
- h: [twoDigits, function (d, v) {
5130
- d.hour = v;
5131
- }],
5132
- m: [twoDigits, function (d, v) {
5133
- d.minute = v;
5134
- }],
5135
- s: [twoDigits, function (d, v) {
5136
- d.second = v;
5137
- }],
5138
- yyyy: [fourDigits, function (d, v) {
5139
- d.year = v;
5140
- }],
5141
- S: ['\\d', function (d, v) {
5142
- d.millisecond = v * 100;
5143
- }],
5144
- SS: ['\\d{2}', function (d, v) {
5145
- d.millisecond = v * 10;
5146
- }],
5147
- SSS: [threeDigits, function (d, v) {
5148
- d.millisecond = v;
5149
- }],
5150
- D: [twoDigits, noop],
5151
- ddd: [word, noop],
5152
- MMM: [word, monthUpdate('monthNamesShort')],
5153
- MMMM: [word, monthUpdate('monthNames')],
5154
- a: [word, function (d, v) {
5155
- const val = v.toLowerCase();
5156
- if (val === '上午') {
5157
- d.isPm = false;
5158
- } else if (val === '下午') {
5159
- d.isPm = true;
5160
- }
5161
- }],
5162
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
5163
- let parts = (v + '').match(/([+-]|\d\d)/gi), minutes;
5164
-
5165
- if (parts) {
5166
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
5167
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
5168
- }
5169
- }]
5170
- };
5171
- parseFlags.dd = parseFlags.d;
5172
- parseFlags.dddd = parseFlags.ddd;
5173
- parseFlags.DD = parseFlags.D;
5174
- parseFlags.mm = parseFlags.m;
5175
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
5176
- parseFlags.MM = parseFlags.M;
5177
- parseFlags.ss = parseFlags.s;
5178
- parseFlags.A = parseFlags.a;
5179
-
5180
-
5181
- // Some common format strings
5182
- fecha.masks = {
5183
- default: 'ddd MMM dd yyyy HH:mm:ss',
5184
- shortDate: 'M/D/yy',
5185
- mediumDate: 'MMM d, yyyy',
5186
- longDate: 'MMMM d, yyyy',
5187
- fullDate: 'dddd, MMMM d, yyyy',
5188
- shortTime: 'HH:mm',
5189
- mediumTime: 'HH:mm:ss',
5190
- longTime: 'HH:mm:ss.SSS'
5191
- };
5192
-
4851
+ */
4852
+ var fecha = {};
4853
+ var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
4854
+ var twoDigits = '\\d\\d?';
4855
+ var threeDigits = '\\d{3}';
4856
+ var fourDigits = '\\d{4}';
4857
+ var word = '[^\\s]+';
4858
+ var literal = /\[([^]*?)\]/gm;
4859
+ var noop = function noop() {};
4860
+
4861
+ function regexEscape(str) {
4862
+ return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
4863
+ }
4864
+
4865
+ function shorten(arr, sLen) {
4866
+ var newArr = [];
4867
+ for (var i = 0, len = arr.length; i < len; i++) {
4868
+ newArr.push(arr[i].substr(0, sLen));
4869
+ }
4870
+ return newArr;
4871
+ }
4872
+
4873
+ function monthUpdate() {
4874
+ return function (d, v) {
4875
+ var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
4876
+ if (~index) {
4877
+ d.month = index;
4878
+ }
4879
+ };
4880
+ }
4881
+
4882
+ function pad(val, len) {
4883
+ val = String(val);
4884
+ len = len || 2;
4885
+ while (val.length < len) {
4886
+ val = '0' + val;
4887
+ }
4888
+ return val;
4889
+ }
4890
+
4891
+ // 直接使用中文日期名称常量
4892
+ var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
4893
+ var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
4894
+ var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
4895
+ var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
4896
+ var amPm = ['上午', '下午'];
4897
+ var DoFn = function DoFn(D) {
4898
+ return D + '日';
4899
+ };
4900
+
4901
+ var formatFlags = {
4902
+ D: function D(dateObj) {
4903
+ return dateObj.getDay();
4904
+ },
4905
+ DD: function DD(dateObj) {
4906
+ return pad(dateObj.getDay());
4907
+ },
4908
+ Do: function Do(dateObj) {
4909
+ return DoFn(dateObj.getDate());
4910
+ },
4911
+ d: function d(dateObj) {
4912
+ return dateObj.getDate();
4913
+ },
4914
+ dd: function dd(dateObj) {
4915
+ return pad(dateObj.getDate());
4916
+ },
4917
+ ddd: function ddd(dateObj) {
4918
+ return dayNamesShort[dateObj.getDay()];
4919
+ },
4920
+ dddd: function dddd(dateObj) {
4921
+ return dayNames[dateObj.getDay()];
4922
+ },
4923
+ M: function M(dateObj) {
4924
+ return dateObj.getMonth() + 1;
4925
+ },
4926
+ MM: function MM(dateObj) {
4927
+ return pad(dateObj.getMonth() + 1);
4928
+ },
4929
+ MMM: function MMM(dateObj) {
4930
+ return monthNamesShort[dateObj.getMonth()];
4931
+ },
4932
+ MMMM: function MMMM(dateObj) {
4933
+ return monthNames[dateObj.getMonth()];
4934
+ },
4935
+ yy: function yy(dateObj) {
4936
+ return pad(String(dateObj.getFullYear()), 4).substr(2);
4937
+ },
4938
+ yyyy: function yyyy(dateObj) {
4939
+ return pad(dateObj.getFullYear(), 4);
4940
+ },
4941
+ h: function h(dateObj) {
4942
+ return dateObj.getHours() % 12 || 12;
4943
+ },
4944
+ hh: function hh(dateObj) {
4945
+ return pad(dateObj.getHours() % 12 || 12);
4946
+ },
4947
+ H: function H(dateObj) {
4948
+ return dateObj.getHours();
4949
+ },
4950
+ HH: function HH(dateObj) {
4951
+ return pad(dateObj.getHours());
4952
+ },
4953
+ m: function m(dateObj) {
4954
+ return dateObj.getMinutes();
4955
+ },
4956
+ mm: function mm(dateObj) {
4957
+ return pad(dateObj.getMinutes());
4958
+ },
4959
+ s: function s(dateObj) {
4960
+ return dateObj.getSeconds();
4961
+ },
4962
+ ss: function ss(dateObj) {
4963
+ return pad(dateObj.getSeconds());
4964
+ },
4965
+ S: function S(dateObj) {
4966
+ return Math.round(dateObj.getMilliseconds() / 100);
4967
+ },
4968
+ SS: function SS(dateObj) {
4969
+ return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
4970
+ },
4971
+ SSS: function SSS(dateObj) {
4972
+ return pad(dateObj.getMilliseconds(), 3);
4973
+ },
4974
+ a: function a(dateObj) {
4975
+ return dateObj.getHours() < 12 ? '上午' : '下午';
4976
+ },
4977
+ A: function A(dateObj) {
4978
+ return dateObj.getHours() < 12 ? '上午' : '下午';
4979
+ },
4980
+ ZZ: function ZZ(dateObj) {
4981
+ var o = dateObj.getTimezoneOffset();
4982
+ return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
4983
+ }
4984
+ };
4985
+
4986
+ var parseFlags = {
4987
+ d: [twoDigits, function (d, v) {
4988
+ d.day = v;
4989
+ }],
4990
+ Do: [twoDigits + word, function (d, v) {
4991
+ d.day = parseInt(v, 10);
4992
+ }],
4993
+ M: [twoDigits, function (d, v) {
4994
+ d.month = v - 1;
4995
+ }],
4996
+ yy: [twoDigits, function (d, v) {
4997
+ var da = new Date(),
4998
+ cent = +('' + da.getFullYear()).substr(0, 2);
4999
+ d.year = '' + (v > 68 ? cent - 1 : cent) + v;
5000
+ }],
5001
+ h: [twoDigits, function (d, v) {
5002
+ d.hour = v;
5003
+ }],
5004
+ m: [twoDigits, function (d, v) {
5005
+ d.minute = v;
5006
+ }],
5007
+ s: [twoDigits, function (d, v) {
5008
+ d.second = v;
5009
+ }],
5010
+ yyyy: [fourDigits, function (d, v) {
5011
+ d.year = v;
5012
+ }],
5013
+ S: ['\\d', function (d, v) {
5014
+ d.millisecond = v * 100;
5015
+ }],
5016
+ SS: ['\\d{2}', function (d, v) {
5017
+ d.millisecond = v * 10;
5018
+ }],
5019
+ SSS: [threeDigits, function (d, v) {
5020
+ d.millisecond = v;
5021
+ }],
5022
+ D: [twoDigits, noop],
5023
+ ddd: [word, noop],
5024
+ MMM: [word, monthUpdate('monthNamesShort')],
5025
+ MMMM: [word, monthUpdate('monthNames')],
5026
+ a: [word, function (d, v) {
5027
+ var val = v.toLowerCase();
5028
+ if (val === '上午') {
5029
+ d.isPm = false;
5030
+ } else if (val === '下午') {
5031
+ d.isPm = true;
5032
+ }
5033
+ }],
5034
+ ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
5035
+ var parts = (v + '').match(/([+-]|\d\d)/gi),
5036
+ minutes = void 0;
5037
+
5038
+ if (parts) {
5039
+ minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
5040
+ d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
5041
+ }
5042
+ }]
5043
+ };
5044
+ parseFlags.dd = parseFlags.d;
5045
+ parseFlags.dddd = parseFlags.ddd;
5046
+ parseFlags.DD = parseFlags.D;
5047
+ parseFlags.mm = parseFlags.m;
5048
+ parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
5049
+ parseFlags.MM = parseFlags.M;
5050
+ parseFlags.ss = parseFlags.s;
5051
+ parseFlags.A = parseFlags.a;
5052
+
5053
+ // Some common format strings
5054
+ fecha.masks = {
5055
+ default: 'ddd MMM dd yyyy HH:mm:ss',
5056
+ shortDate: 'M/D/yy',
5057
+ mediumDate: 'MMM d, yyyy',
5058
+ longDate: 'MMMM d, yyyy',
5059
+ fullDate: 'dddd, MMMM d, yyyy',
5060
+ shortTime: 'HH:mm',
5061
+ mediumTime: 'HH:mm:ss',
5062
+ longTime: 'HH:mm:ss.SSS'
5063
+ };
5064
+
5193
5065
  /***
5194
5066
  * Format a date
5195
5067
  * @method format
5196
5068
  * @param {Date|number} dateObj
5197
5069
  * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
5198
- */
5199
- fecha.format = function (dateObj, mask) {
5200
- if (typeof dateObj === 'number') {
5201
- dateObj = new Date(dateObj);
5202
- }
5203
-
5204
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
5205
- throw new Error('Invalid Date in fecha.format');
5206
- }
5207
-
5208
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
5209
-
5210
- const literals = [];
5211
-
5212
- // Make literals inactive by replacing them with ??
5213
- mask = mask.replace(literal, function($0, $1) {
5214
- literals.push($1);
5215
- return '@@@';
5216
- });
5217
- // Apply formatting rules
5218
- mask = mask.replace(token, function ($0) {
5219
- return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
5220
- });
5221
- // Inline literal values back into the formatted value
5222
- return mask.replace(/@@@/g, function() {
5223
- return literals.shift();
5224
- });
5225
- };
5226
-
5070
+ */
5071
+ fecha.format = function (dateObj, mask) {
5072
+ if (typeof dateObj === 'number') {
5073
+ dateObj = new Date(dateObj);
5074
+ }
5075
+
5076
+ if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
5077
+ throw new Error('Invalid Date in fecha.format');
5078
+ }
5079
+
5080
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
5081
+
5082
+ var literals = [];
5083
+
5084
+ // Make literals inactive by replacing them with ??
5085
+ mask = mask.replace(literal, function ($0, $1) {
5086
+ literals.push($1);
5087
+ return '@@@';
5088
+ });
5089
+ // Apply formatting rules
5090
+ mask = mask.replace(token, function ($0) {
5091
+ return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
5092
+ });
5093
+ // Inline literal values back into the formatted value
5094
+ return mask.replace(/@@@/g, function () {
5095
+ return literals.shift();
5096
+ });
5097
+ };
5098
+
5227
5099
  /**
5228
5100
  * Parse a date string into an object, changes - into /
5229
5101
  * @method parse
5230
5102
  * @param {string} dateStr Date string
5231
5103
  * @param {string} format Date parse format
5232
5104
  * @returns {Date|boolean}
5233
- */
5234
- fecha.parse = function (dateStr, format) {
5235
- if (typeof format !== 'string') {
5236
- throw new Error('Invalid format in fecha.parse');
5237
- }
5238
-
5239
- format = fecha.masks[format] || format;
5240
-
5241
- // Avoid regular expression denial of service, fail early for really long strings
5242
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
5243
- if (dateStr.length > 1000) {
5244
- return null;
5245
- }
5246
-
5247
- const dateInfo = {};
5248
- const parseInfo = [];
5249
- const literals = [];
5250
- format = format.replace(literal, function($0, $1) {
5251
- literals.push($1);
5252
- return '@@@';
5253
- });
5254
- let newFormat = regexEscape(format).replace(token, function ($0) {
5255
- if (parseFlags[$0]) {
5256
- const info = parseFlags[$0];
5257
- parseInfo.push(info[1]);
5258
- return '(' + info[0] + ')';
5259
- }
5260
-
5261
- return $0;
5262
- });
5263
- newFormat = newFormat.replace(/@@@/g, function() {
5264
- return literals.shift();
5265
- });
5266
- const matches = dateStr.match(new RegExp(newFormat, 'i'));
5267
- if (!matches) {
5268
- return null;
5269
- }
5270
-
5271
- for (let i = 1; i < matches.length; i++) {
5272
- parseInfo[i - 1](dateInfo, matches[i]);
5273
- }
5274
-
5275
- const today = new Date();
5276
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
5277
- dateInfo.hour = +dateInfo.hour + 12;
5278
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
5279
- dateInfo.hour = 0;
5280
- }
5281
-
5282
- let date;
5283
- if (dateInfo.timezoneOffset != null) {
5284
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
5285
- date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
5286
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
5287
- } else {
5288
- date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
5289
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
5290
- }
5291
- return date;
5292
- };
5293
-
5294
- // 导出fecha对象
5295
-
5296
-
5297
- // 以下是从date-util.js合并的函数
5298
- const newArray = function(start, end) {
5299
- let result = [];
5300
- for (let i = start; i <= end; i++) {
5301
- result.push(i);
5302
- }
5303
- return result;
5304
- };
5305
-
5306
- const getSettings = () => {
5307
- return {
5308
- dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
5309
- dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
5310
- monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
5311
- monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
5312
- amPm: ['上午', '下午']
5313
- };
5314
- };
5315
-
5316
- const toDate = function(date) {
5317
- return isDate(date) ? new Date(date) : null;
5318
- };
5319
-
5320
- const isDate = function(date) {
5321
- if (date === null || date === undefined) return false;
5322
- if (isNaN(new Date(date).getTime())) return false;
5323
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
5324
- return true;
5325
- };
5326
-
5327
- const isDateObject = function(val) {
5328
- return val instanceof Date;
5329
- };
5330
-
5331
- const formatDate = function (date, format = 'yyyy-MM-dd') {
5332
- // 处理多种输入类型
5333
- if (!date) return '';
5334
-
5335
- // 如果是时间戳,转成日期对象
5336
- if (typeof date === 'number') {
5337
- date = new Date(date);
5338
- }
5339
- // 如果是字符串,转成日期对象
5340
- if (typeof date === 'string') {
5341
- date = new Date(date);
5342
- }
5343
-
5344
- // 调用toDate进一步验证和转换
5345
- date = toDate(date);
5346
- if (!date) return '';
5347
-
5348
- // 兼容大写和小写的格式标记
5349
- // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
5350
- const lowercaseFormat = format
5351
- .replace(/YYYY/g, 'yyyy')
5352
- .replace(/D/g, 'd')
5353
-
5354
- // 使用fecha库进行格式化,支持中文配置
5355
- const str = fecha.format(date, lowercaseFormat, getSettings());
5356
- return str;
5357
- };
5358
-
5359
- const parseDate = function(string, format) {
5360
- return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
5361
- };
5362
-
5363
- const getDayCountOfMonth = function(year, month) {
5364
- if (month === 3 || month === 5 || month === 8 || month === 10) {
5365
- return 30;
5366
- }
5367
-
5368
- if (month === 1) {
5369
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
5370
- return 29;
5371
- } else {
5372
- return 28;
5373
- }
5374
- }
5375
-
5376
- return 31;
5377
- };
5378
-
5379
- const getDayCountOfYear = function(year) {
5380
- const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
5381
- return isLeapYear ? 366 : 365;
5382
- };
5383
-
5384
- const getFirstDayOfMonth = function(date) {
5385
- const temp = new Date(date.getTime());
5386
- temp.setDate(1);
5387
- return temp.getDay();
5388
- };
5389
-
5390
- // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
5391
- // {prev, next} Date should work for Daylight Saving Time
5392
- // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
5393
- const prevDate = function(date, amount = 1) {
5394
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
5395
- };
5396
-
5397
- const nextDate = function(date, amount = 1) {
5398
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
5399
- };
5400
-
5401
- const getStartDateOfMonth = function(year, month) {
5402
- const result = new Date(year, month, 1);
5403
- const day = result.getDay();
5404
-
5405
- if (day === 0) {
5406
- return prevDate(result, 7);
5407
- } else {
5408
- return prevDate(result, day);
5409
- }
5410
- };
5411
-
5412
- const getWeekNumber = function(date) {
5413
- // 支持多种输入类型
5414
- if (!date||!isDate(date)) {
5415
- date = new Date();
5416
- }
5417
- if (typeof date === 'string') {
5418
- date = new Date(date);
5419
- }
5420
-
5421
- // 验证日期有效性
5422
- if (!isDate(date)) return null;
5423
-
5424
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
5425
- // 设置为最近的星期四:当前日期 + 4 - 当前星期数
5426
- // 将星期日的星期数设为7
5427
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
5428
- // 获取当年的第一天
5429
- const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
5430
- // 计算到最近的星期四的完整周数
5431
- const weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
5432
- // 返回周数
5433
- return weekNo;
5434
- };
5435
-
5436
- const getRangeHours = function(ranges) {
5437
- const hours = [];
5438
- let disabledHours = [];
5439
-
5440
- (ranges || []).forEach(range => {
5441
- const value = range.map(date => date.getHours());
5442
-
5443
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
5444
- });
5445
-
5446
- if (disabledHours.length) {
5447
- for (let i = 0; i < 24; i++) {
5448
- hours[i] = disabledHours.indexOf(i) === -1;
5449
- }
5450
- } else {
5451
- for (let i = 0; i < 24; i++) {
5452
- hours[i] = false;
5453
- }
5454
- }
5455
-
5456
- return hours;
5457
- };
5458
-
5459
- const getPrevMonthLastDays = (date, amount) => {
5460
- if (amount <= 0) return [];
5461
- const temp = new Date(date.getTime());
5462
- temp.setDate(0);
5463
- const lastDay = temp.getDate();
5464
- return range(amount).map((_, index) => lastDay - (amount - index - 1));
5465
- };
5466
-
5467
- const getMonthDays = (date) => {
5468
- const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
5469
- const days = temp.getDate();
5470
- return range(days).map((_, index) => index + 1);
5471
- };
5472
-
5473
- function setRangeData(arr, start, end, value) {
5474
- for (let i = start; i < end; i++) {
5475
- arr[i] = value;
5476
- }
5477
- }
5478
-
5479
- const getRangeMinutes = function(ranges, hour) {
5480
- const minutes = new Array(60);
5481
-
5482
- if (ranges.length > 0) {
5483
- ranges.forEach(range => {
5484
- const start = range[0];
5485
- const end = range[1];
5486
- const startHour = start.getHours();
5487
- const startMinute = start.getMinutes();
5488
- const endHour = end.getHours();
5489
- const endMinute = end.getMinutes();
5490
- if (startHour === hour && endHour !== hour) {
5491
- setRangeData(minutes, startMinute, 60, true);
5492
- } else if (startHour === hour && endHour === hour) {
5493
- setRangeData(minutes, startMinute, endMinute + 1, true);
5494
- } else if (startHour !== hour && endHour === hour) {
5495
- setRangeData(minutes, 0, endMinute + 1, true);
5496
- } else if (startHour < hour && endHour > hour) {
5497
- setRangeData(minutes, 0, 60, true);
5498
- }
5499
- });
5500
- } else {
5501
- setRangeData(minutes, 0, 60, true);
5502
- }
5503
- return minutes;
5504
- };
5505
-
5506
- const range = function(n) {
5507
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
5508
- return Array.apply(null, {length: n}).map((_, n) => n);
5509
- };
5510
-
5511
- const modifyDate = function(date, y, m, d) {
5512
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
5513
- };
5514
-
5515
- const modifyTime = function(date, h, m, s) {
5516
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
5517
- };
5518
-
5519
- const modifyWithTimeString = (date, time) => {
5520
- if (date == null || !time) {
5521
- return date;
5522
- }
5523
- time = parseDate(time, 'HH:mm:ss');
5524
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
5525
- };
5526
-
5527
- const clearTime = function(date) {
5528
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
5529
- };
5530
-
5531
- const clearMilliseconds = function(date) {
5532
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
5533
- };
5534
-
5535
- const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
5536
- // TODO: refactory a more elegant solution
5537
- if (ranges.length === 0) return date;
5538
- const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
5539
- const ndate = normalizeDate(date);
5540
- const nranges = ranges.map(range => range.map(normalizeDate));
5541
- if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
5542
-
5543
- let minDate = nranges[0][0];
5544
- let maxDate = nranges[0][0];
5545
-
5546
- nranges.forEach(nrange => {
5547
- minDate = new Date(Math.min(nrange[0], minDate));
5548
- maxDate = new Date(Math.max(nrange[1], minDate));
5549
- });
5550
-
5551
- const ret = ndate < minDate ? minDate : maxDate;
5552
- // preserve Year/Month/Date
5553
- return modifyDate(
5554
- ret,
5555
- date.getFullYear(),
5556
- date.getMonth(),
5557
- date.getDate()
5558
- );
5559
- };
5560
-
5561
- const timeWithinRange = function(date, selectableRange, format) {
5562
- const limitedDate = limitTimeRange(date, selectableRange, format);
5563
- return limitedDate.getTime() === date.getTime();
5564
- };
5565
-
5566
- const changeYearMonthAndClampDate = function(date, year, month) {
5567
- // clamp date to the number of days in `year`, `month`
5568
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
5569
- const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
5570
- return modifyDate(date, year, month, monthDate);
5571
- };
5572
-
5573
- const prevMonth = function(date) {
5574
- const year = date.getFullYear();
5575
- const month = date.getMonth();
5576
- return month === 0
5577
- ? changeYearMonthAndClampDate(date, year - 1, 11)
5578
- : changeYearMonthAndClampDate(date, year, month - 1);
5579
- };
5580
-
5581
- const nextMonth = function(date) {
5582
- const year = date.getFullYear();
5583
- const month = date.getMonth();
5584
- return month === 11
5585
- ? changeYearMonthAndClampDate(date, year + 1, 0)
5586
- : changeYearMonthAndClampDate(date, year, month + 1);
5587
- };
5588
-
5589
- const prevYear = function(date, amount = 1) {
5590
- const year = date.getFullYear();
5591
- const month = date.getMonth();
5592
- return changeYearMonthAndClampDate(date, year - amount, month);
5593
- };
5594
-
5595
- const nextYear = function(date, amount = 1) {
5596
- const year = date.getFullYear();
5597
- const month = date.getMonth();
5598
- return changeYearMonthAndClampDate(date, year + amount, month);
5599
- };
5600
-
5601
- const extractDateFormat = function(format) {
5602
- return format
5603
- .replace(/\W?m{1,2}|\W?ZZ/g, '')
5604
- .replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
5605
- .trim();
5606
- };
5607
-
5608
- const extractTimeFormat = function(format) {
5609
- return format
5610
- .replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
5611
- .trim();
5612
- };
5613
-
5614
- const validateRangeInOneMonth = function(start, end) {
5615
- return (start.getMonth() === end.getMonth()) && (start.getFullYear() === end.getFullYear());
5616
- };
5617
-
5618
- /**
5619
- * 计算两个日期之间的工作日数量(不包括周末和节假日)
5620
- * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
5621
- * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
5622
- * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
5623
- * @returns {number} 工作日数量
5624
- */
5625
- const calculateNetworkDays = function (start_date, end_date, holidays = []) {
5626
- if (typeof start_date !== 'string' || typeof end_date !== 'string') {
5627
- throw new Error(
5628
- "Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'."
5629
- );
5630
- }
5631
-
5632
- const startDateObj = new Date(start_date);
5633
- const endDateObj = new Date(end_date);
5634
-
5635
- if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
5636
- throw new Error(
5637
- "Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'."
5638
- );
5639
- }
5640
-
5641
- if (startDateObj > endDateObj) {
5642
- throw new Error('Start date should be earlier than or equal to end date.');
5643
- }
5644
-
5645
- let workdays = 0;
5646
-
5647
- // Iterate through each day in the date range
5648
- for (
5649
- let currentDate = new Date(startDateObj);
5650
- currentDate <= endDateObj;
5651
- currentDate.setDate(currentDate.getDate() + 1)
5652
- ) {
5653
- // Check if the current day is a weekend (Saturday or Sunday)
5654
- const isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
5655
-
5656
- // Check if the current day is a holiday
5657
- const isHoliday = holidays.some((holiday) => {
5658
- const holidayDate = new Date(holiday);
5659
- return currentDate.toDateString() === holidayDate.toDateString();
5660
- });
5661
-
5662
- // If it's a workday (not a weekend or holiday), increment the workdays count
5663
- if (!isWeekend && !isHoliday) {
5664
- workdays++;
5665
- }
5666
- }
5667
-
5668
- return workdays;
5669
- };
5670
-
5671
- /**
5672
- * 日期加减天数
5673
- * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
5674
- * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
5675
- * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
5676
- */
5677
- const dateAddDays = function (start_date, days) {
5678
- if (typeof start_date !== 'string' || !Number.isInteger(days)) {
5679
- throw new Error(
5680
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days."
5681
- );
5682
- }
5683
-
5684
- const startDateObj = new Date(start_date);
5685
- if (isNaN(startDateObj.getTime())) {
5686
- throw new Error(
5687
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
5688
- );
5689
- }
5690
-
5691
- const resultDateObj = new Date(startDateObj);
5692
- resultDateObj.setDate(resultDateObj.getDate() + days);
5693
-
5694
- const resultYear = resultDateObj.getFullYear();
5695
- const resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
5696
- const resultDay = String(resultDateObj.getDate()).padStart(2, '0');
5697
-
5698
- return `${resultYear}-${resultMonth}-${resultDay}`;
5699
- };
5700
-
5701
- /**
5702
- * 计算两个日期之间的差值
5703
- * @date 2023年12月14日
5704
- * @param {String} start_date - 起始日期字符串
5705
- * @param {String} end_date - 结束日期字符串
5706
- * @param {String} unit - 单位:year/month/day
5707
- * @returns {Number} 差值
5708
- */
5709
- const dateDiff = function (start_date, end_date, unit = 'day') {
5710
- // Assuming date strings are in "YYYY-MM-DD" format
5711
- var startDate = new Date(start_date);
5712
- var endDate = new Date(end_date);
5713
-
5714
- // If the date is invalid, return 0
5715
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
5716
- return 0;
5717
- }
5718
-
5719
- if (unit === 'year') {
5720
- return endDate.getFullYear() - startDate.getFullYear();
5721
- } else if (unit === 'month') {
5722
- return (
5723
- (endDate.getFullYear() - startDate.getFullYear()) * 12 +
5724
- (endDate.getMonth() - startDate.getMonth())
5725
- );
5726
- } else {
5727
- // Default to day
5728
- var timeDifference = endDate - startDate;
5729
- // Calculate days (86400000 milliseconds per day)
5730
- return Math.floor(timeDifference / 86400000);
5731
- }
5732
- };
5733
-
5734
- /**
5735
- * 获取月份中的日期
5736
- * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
5737
- * @returns {number} 月份中的日期(1-31)
5738
- */
5739
- const dayOfMonth = function (date) {
5740
- if (typeof date !== 'string') {
5741
- throw new Error(
5742
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'."
5743
- );
5744
- }
5745
-
5746
- const dateObj = new Date(date);
5747
- if (isNaN(dateObj.getTime())) {
5748
- throw new Error(
5749
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
5750
- );
5751
- }
5752
-
5753
- return dateObj.getDate();
5754
- };
5755
-
5756
- /**
5757
- * 获取当前日期
5758
- * @date 2022年5月7日
5759
- * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
5760
- * @returns {string} 当前日期的格式化字符串
5761
- */
5762
- const getCurrentDate = function (format = 'YYYY-MM-DD') {
5763
- return formatDate(new Date(), format);
5764
- };
5765
-
5766
- /**
5767
- * 获取当前日期时间
5768
- * @date 2022年5月7日
5769
- * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
5770
- * @returns {string} 当前日期时间的格式化字符串
5771
- */
5772
- const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
5773
- return formatDate(new Date(), format);
5774
- };
5775
-
5776
- /**
5777
- * 获取小时
5778
- * @date 2022年5月7日
5779
- * @param {Date|string} [date] - 日期对象或日期字符串
5780
- * @returns {number} 小时数(0-23)
5781
- */
5782
- const getHour = function (date) {
5783
- if (!date) {
5784
- return new Date().getHours();
5785
- }
5786
- if (typeof date === 'string') {
5787
- date = new Date(date);
5788
- }
5789
- return date.getHours();
5790
- };
5791
-
5792
- /**
5793
- * 获取分钟
5794
- * @date 2022年5月7日
5795
- * @param {Date|string} [date] - 日期对象或日期字符串
5796
- * @returns {number} 分钟数(0-59)
5797
- */
5798
- const getMinute = function (date) {
5799
- if (!date) {
5800
- return new Date().getMinutes();
5801
- }
5802
- if (typeof date === 'string') {
5803
- date = new Date(date);
5804
- }
5805
- return date.getMinutes();
5806
- };
5807
-
5808
- /**
5809
- * 获取月份
5810
- * @date 2022年5月7日
5811
- * @param {Date|string} [date] - 日期对象或日期字符串
5812
- * @returns {number} 月份数(1-12)
5813
- */
5814
- const getMonth = function (date) {
5815
- if (!date) {
5816
- return new Date().getMonth() + 1;
5817
- }
5818
- if (typeof date === 'string') {
5819
- date = new Date(date);
5820
- }
5821
- return date.getMonth() + 1;
5822
- };
5823
-
5824
- /**
5825
- * 获取秒
5826
- * @date 2022年5月7日
5827
- * @param {Date|string} [date] - 日期对象或日期字符串
5828
- * @returns {number} 秒数(0-59)
5829
- */
5830
- const getSecond = function (date) {
5831
- if (!date) {
5832
- return new Date().getSeconds();
5833
- }
5834
- if (typeof date === 'string') {
5835
- date = new Date(date);
5836
- }
5837
- return date.getSeconds();
5838
- };
5839
-
5840
- /**
5841
- * 获取星期几
5842
- * @date 2022年5月7日
5843
- * @param {Date|string} [date] - 日期对象或日期字符串
5844
- * @returns {number} 星期几(0-6,0表示星期日)
5845
- */
5846
- const getWeekday = function (date) {
5847
- if (!date) {
5848
- return new Date().getDay();
5849
- }
5850
- if (typeof date === 'string') {
5851
- date = new Date(date);
5852
- }
5853
- return date.getDay();
5854
- };
5855
-
5856
-
5857
- /**
5858
- * @desc 获取上午/下午/晚上
5859
- * @author huangbo
5860
- * @date 2022年5月7日
5861
- * @param {String} [time] - 时间
5862
- **/
5863
- const timeCycle = function (time) {
5864
- let hour = 0;
5865
- if (!time) {
5866
- hour = new Date().getHours();
5867
- } else if (typeof time === 'string') {
5868
- // 从时间字符串中提取小时
5869
- const match = time.match(/^(\d{1,2})/);
5870
- if (match) {
5871
- hour = parseInt(match[1], 10);
5872
- }
5873
- } else if (typeof time === 'number') {
5874
- hour = time;
5875
- }
5876
- // 判断时间段
5877
- if (hour >= 5 && hour < 12) {
5878
- return '上午';
5879
- } else if (hour >= 12 && hour < 18) {
5880
- return '下午';
5881
- } else {
5882
- return '晚上';
5883
- }
5884
- };
5885
-
5886
- /***/ }),
5105
+ */
5106
+ fecha.parse = function (dateStr, format) {
5107
+ if (typeof format !== 'string') {
5108
+ throw new Error('Invalid format in fecha.parse');
5109
+ }
5887
5110
 
5888
- /***/ 70:
5889
- /***/ (function(module, exports) {
5111
+ format = fecha.masks[format] || format;
5890
5112
 
5891
- module.exports = require("eoss/lib/cascader");
5113
+ // Avoid regular expression denial of service, fail early for really long strings
5114
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
5115
+ if (dateStr.length > 1000) {
5116
+ return null;
5117
+ }
5118
+
5119
+ var dateInfo = {};
5120
+ var parseInfo = [];
5121
+ var literals = [];
5122
+ format = format.replace(literal, function ($0, $1) {
5123
+ literals.push($1);
5124
+ return '@@@';
5125
+ });
5126
+ var newFormat = regexEscape(format).replace(token, function ($0) {
5127
+ if (parseFlags[$0]) {
5128
+ var info = parseFlags[$0];
5129
+ parseInfo.push(info[1]);
5130
+ return '(' + info[0] + ')';
5131
+ }
5132
+
5133
+ return $0;
5134
+ });
5135
+ newFormat = newFormat.replace(/@@@/g, function () {
5136
+ return literals.shift();
5137
+ });
5138
+ var matches = dateStr.match(new RegExp(newFormat, 'i'));
5139
+ if (!matches) {
5140
+ return null;
5141
+ }
5142
+
5143
+ for (var i = 1; i < matches.length; i++) {
5144
+ parseInfo[i - 1](dateInfo, matches[i]);
5145
+ }
5146
+
5147
+ var today = new Date();
5148
+ if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
5149
+ dateInfo.hour = +dateInfo.hour + 12;
5150
+ } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
5151
+ dateInfo.hour = 0;
5152
+ }
5153
+
5154
+ var date = void 0;
5155
+ if (dateInfo.timezoneOffset != null) {
5156
+ dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
5157
+ 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));
5158
+ } else {
5159
+ 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);
5160
+ }
5161
+ return date;
5162
+ };
5163
+
5164
+ // 导出fecha对象
5165
+
5166
+
5167
+ // 以下是从date-util.js合并的函数
5168
+ var newArray = function newArray(start, end) {
5169
+ var result = [];
5170
+ for (var i = start; i <= end; i++) {
5171
+ result.push(i);
5172
+ }
5173
+ return result;
5174
+ };
5175
+
5176
+ var getSettings = function getSettings() {
5177
+ return {
5178
+ dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
5179
+ dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
5180
+ monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
5181
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
5182
+ amPm: ['上午', '下午']
5183
+ };
5184
+ };
5185
+
5186
+ var toDate = function toDate(date) {
5187
+ return isDate(date) ? new Date(date) : null;
5188
+ };
5189
+
5190
+ var isDate = function isDate(date) {
5191
+ if (date === null || date === undefined) return false;
5192
+ if (isNaN(new Date(date).getTime())) return false;
5193
+ if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
5194
+ return true;
5195
+ };
5196
+
5197
+ var isDateObject = function isDateObject(val) {
5198
+ return val instanceof Date;
5199
+ };
5200
+
5201
+ var formatDate = function formatDate(date) {
5202
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
5203
+
5204
+ // 处理多种输入类型
5205
+ if (!date) return '';
5206
+
5207
+ // 如果是时间戳,转成日期对象
5208
+ if (typeof date === 'number') {
5209
+ date = new Date(date);
5210
+ }
5211
+ // 如果是字符串,转成日期对象
5212
+ if (typeof date === 'string') {
5213
+ date = new Date(date);
5214
+ }
5215
+
5216
+ // 调用toDate进一步验证和转换
5217
+ date = toDate(date);
5218
+ if (!date) return '';
5219
+
5220
+ // 兼容大写和小写的格式标记
5221
+ // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
5222
+ var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
5223
+
5224
+ // 使用fecha库进行格式化,支持中文配置
5225
+ var str = fecha.format(date, lowercaseFormat, getSettings());
5226
+ return str;
5227
+ };
5228
+
5229
+ var parseDate = function parseDate(string, format) {
5230
+ return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
5231
+ };
5232
+
5233
+ var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
5234
+ if (month === 3 || month === 5 || month === 8 || month === 10) {
5235
+ return 30;
5236
+ }
5237
+
5238
+ if (month === 1) {
5239
+ if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
5240
+ return 29;
5241
+ } else {
5242
+ return 28;
5243
+ }
5244
+ }
5245
+
5246
+ return 31;
5247
+ };
5248
+
5249
+ var getDayCountOfYear = function getDayCountOfYear(year) {
5250
+ var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
5251
+ return isLeapYear ? 366 : 365;
5252
+ };
5253
+
5254
+ var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
5255
+ var temp = new Date(date.getTime());
5256
+ temp.setDate(1);
5257
+ return temp.getDay();
5258
+ };
5259
+
5260
+ // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
5261
+ // {prev, next} Date should work for Daylight Saving Time
5262
+ // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
5263
+ var prevDate = function prevDate(date) {
5264
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5265
+
5266
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
5267
+ };
5268
+
5269
+ var nextDate = function nextDate(date) {
5270
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5271
+
5272
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
5273
+ };
5274
+
5275
+ var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
5276
+ var result = new Date(year, month, 1);
5277
+ var day = result.getDay();
5278
+
5279
+ if (day === 0) {
5280
+ return prevDate(result, 7);
5281
+ } else {
5282
+ return prevDate(result, day);
5283
+ }
5284
+ };
5285
+
5286
+ var getWeekNumber = function getWeekNumber(date) {
5287
+ // 支持多种输入类型
5288
+ if (!date || !isDate(date)) {
5289
+ date = new Date();
5290
+ }
5291
+ if (typeof date === 'string') {
5292
+ date = new Date(date);
5293
+ }
5294
+
5295
+ // 验证日期有效性
5296
+ if (!isDate(date)) return null;
5297
+
5298
+ var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
5299
+ // 设置为最近的星期四:当前日期 + 4 - 当前星期数
5300
+ // 将星期日的星期数设为7
5301
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
5302
+ // 获取当年的第一天
5303
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
5304
+ // 计算到最近的星期四的完整周数
5305
+ var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
5306
+ // 返回周数
5307
+ return weekNo;
5308
+ };
5309
+
5310
+ var getRangeHours = function getRangeHours(ranges) {
5311
+ var hours = [];
5312
+ var disabledHours = [];
5313
+
5314
+ (ranges || []).forEach(function (range) {
5315
+ var value = range.map(function (date) {
5316
+ return date.getHours();
5317
+ });
5318
+
5319
+ disabledHours = disabledHours.concat(newArray(value[0], value[1]));
5320
+ });
5321
+
5322
+ if (disabledHours.length) {
5323
+ for (var i = 0; i < 24; i++) {
5324
+ hours[i] = disabledHours.indexOf(i) === -1;
5325
+ }
5326
+ } else {
5327
+ for (var _i = 0; _i < 24; _i++) {
5328
+ hours[_i] = false;
5329
+ }
5330
+ }
5331
+
5332
+ return hours;
5333
+ };
5334
+
5335
+ var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
5336
+ if (amount <= 0) return [];
5337
+ var temp = new Date(date.getTime());
5338
+ temp.setDate(0);
5339
+ var lastDay = temp.getDate();
5340
+ return range(amount).map(function (_, index) {
5341
+ return lastDay - (amount - index - 1);
5342
+ });
5343
+ };
5344
+
5345
+ var getMonthDays = function getMonthDays(date) {
5346
+ var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
5347
+ var days = temp.getDate();
5348
+ return range(days).map(function (_, index) {
5349
+ return index + 1;
5350
+ });
5351
+ };
5352
+
5353
+ function setRangeData(arr, start, end, value) {
5354
+ for (var i = start; i < end; i++) {
5355
+ arr[i] = value;
5356
+ }
5357
+ }
5358
+
5359
+ var getRangeMinutes = function getRangeMinutes(ranges, hour) {
5360
+ var minutes = new Array(60);
5361
+
5362
+ if (ranges.length > 0) {
5363
+ ranges.forEach(function (range) {
5364
+ var start = range[0];
5365
+ var end = range[1];
5366
+ var startHour = start.getHours();
5367
+ var startMinute = start.getMinutes();
5368
+ var endHour = end.getHours();
5369
+ var endMinute = end.getMinutes();
5370
+ if (startHour === hour && endHour !== hour) {
5371
+ setRangeData(minutes, startMinute, 60, true);
5372
+ } else if (startHour === hour && endHour === hour) {
5373
+ setRangeData(minutes, startMinute, endMinute + 1, true);
5374
+ } else if (startHour !== hour && endHour === hour) {
5375
+ setRangeData(minutes, 0, endMinute + 1, true);
5376
+ } else if (startHour < hour && endHour > hour) {
5377
+ setRangeData(minutes, 0, 60, true);
5378
+ }
5379
+ });
5380
+ } else {
5381
+ setRangeData(minutes, 0, 60, true);
5382
+ }
5383
+ return minutes;
5384
+ };
5385
+
5386
+ var range = function range(n) {
5387
+ // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
5388
+ return Array.apply(null, { length: n }).map(function (_, n) {
5389
+ return n;
5390
+ });
5391
+ };
5392
+
5393
+ var modifyDate = function modifyDate(date, y, m, d) {
5394
+ return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
5395
+ };
5396
+
5397
+ var modifyTime = function modifyTime(date, h, m, s) {
5398
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
5399
+ };
5400
+
5401
+ var modifyWithTimeString = function modifyWithTimeString(date, time) {
5402
+ if (date == null || !time) {
5403
+ return date;
5404
+ }
5405
+ time = parseDate(time, 'HH:mm:ss');
5406
+ return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
5407
+ };
5408
+
5409
+ var clearTime = function clearTime(date) {
5410
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
5411
+ };
5412
+
5413
+ var clearMilliseconds = function clearMilliseconds(date) {
5414
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
5415
+ };
5416
+
5417
+ var limitTimeRange = function limitTimeRange(date, ranges) {
5418
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
5419
+
5420
+ // TODO: refactory a more elegant solution
5421
+ if (ranges.length === 0) return date;
5422
+ var normalizeDate = function normalizeDate(date) {
5423
+ return fecha.parse(fecha.format(date, format), format);
5424
+ };
5425
+ var ndate = normalizeDate(date);
5426
+ var nranges = ranges.map(function (range) {
5427
+ return range.map(normalizeDate);
5428
+ });
5429
+ if (nranges.some(function (nrange) {
5430
+ return ndate >= nrange[0] && ndate <= nrange[1];
5431
+ })) return date;
5432
+
5433
+ var minDate = nranges[0][0];
5434
+ var maxDate = nranges[0][0];
5435
+
5436
+ nranges.forEach(function (nrange) {
5437
+ minDate = new Date(Math.min(nrange[0], minDate));
5438
+ maxDate = new Date(Math.max(nrange[1], minDate));
5439
+ });
5440
+
5441
+ var ret = ndate < minDate ? minDate : maxDate;
5442
+ // preserve Year/Month/Date
5443
+ return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
5444
+ };
5445
+
5446
+ var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
5447
+ var limitedDate = limitTimeRange(date, selectableRange, format);
5448
+ return limitedDate.getTime() === date.getTime();
5449
+ };
5450
+
5451
+ var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
5452
+ // clamp date to the number of days in `year`, `month`
5453
+ // eg: (2010-1-31, 2010, 2) => 2010-2-28
5454
+ var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
5455
+ return modifyDate(date, year, month, monthDate);
5456
+ };
5457
+
5458
+ var prevMonth = function prevMonth(date) {
5459
+ var year = date.getFullYear();
5460
+ var month = date.getMonth();
5461
+ return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
5462
+ };
5463
+
5464
+ var nextMonth = function nextMonth(date) {
5465
+ var year = date.getFullYear();
5466
+ var month = date.getMonth();
5467
+ return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
5468
+ };
5469
+
5470
+ var prevYear = function prevYear(date) {
5471
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5472
+
5473
+ var year = date.getFullYear();
5474
+ var month = date.getMonth();
5475
+ return changeYearMonthAndClampDate(date, year - amount, month);
5476
+ };
5477
+
5478
+ var nextYear = function nextYear(date) {
5479
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5480
+
5481
+ var year = date.getFullYear();
5482
+ var month = date.getMonth();
5483
+ return changeYearMonthAndClampDate(date, year + amount, month);
5484
+ };
5485
+
5486
+ var extractDateFormat = function extractDateFormat(format) {
5487
+ return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
5488
+ };
5489
+
5490
+ var extractTimeFormat = function extractTimeFormat(format) {
5491
+ return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
5492
+ };
5493
+
5494
+ var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
5495
+ return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
5496
+ };
5497
+
5498
+ /**
5499
+ * 计算两个日期之间的工作日数量(不包括周末和节假日)
5500
+ * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
5501
+ * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
5502
+ * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
5503
+ * @returns {number} 工作日数量
5504
+ */
5505
+ var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
5506
+ var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
5507
+
5508
+ if (typeof start_date !== 'string' || typeof end_date !== 'string') {
5509
+ throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
5510
+ }
5511
+
5512
+ var startDateObj = new Date(start_date);
5513
+ var endDateObj = new Date(end_date);
5514
+
5515
+ if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
5516
+ throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
5517
+ }
5518
+
5519
+ if (startDateObj > endDateObj) {
5520
+ throw new Error('Start date should be earlier than or equal to end date.');
5521
+ }
5522
+
5523
+ var workdays = 0;
5524
+
5525
+ // Iterate through each day in the date range
5526
+
5527
+ var _loop = function _loop(currentDate) {
5528
+ // Check if the current day is a weekend (Saturday or Sunday)
5529
+ var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
5530
+
5531
+ // Check if the current day is a holiday
5532
+ var isHoliday = holidays.some(function (holiday) {
5533
+ var holidayDate = new Date(holiday);
5534
+ return currentDate.toDateString() === holidayDate.toDateString();
5535
+ });
5536
+
5537
+ // If it's a workday (not a weekend or holiday), increment the workdays count
5538
+ if (!isWeekend && !isHoliday) {
5539
+ workdays++;
5540
+ }
5541
+ };
5542
+
5543
+ for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
5544
+ _loop(currentDate);
5545
+ }
5546
+
5547
+ return workdays;
5548
+ };
5549
+
5550
+ /**
5551
+ * 日期加减天数
5552
+ * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
5553
+ * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
5554
+ * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
5555
+ */
5556
+ var dateAddDays = function dateAddDays(start_date, days) {
5557
+ if (typeof start_date !== 'string' || !Number.isInteger(days)) {
5558
+ 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.");
5559
+ }
5560
+
5561
+ var startDateObj = new Date(start_date);
5562
+ if (isNaN(startDateObj.getTime())) {
5563
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5564
+ }
5565
+
5566
+ var resultDateObj = new Date(startDateObj);
5567
+ resultDateObj.setDate(resultDateObj.getDate() + days);
5568
+
5569
+ var resultYear = resultDateObj.getFullYear();
5570
+ var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
5571
+ var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
5572
+
5573
+ return resultYear + '-' + resultMonth + '-' + resultDay;
5574
+ };
5575
+
5576
+ /**
5577
+ * 计算两个日期之间的差值
5578
+ * @date 2023年12月14日
5579
+ * @param {String} start_date - 起始日期字符串
5580
+ * @param {String} end_date - 结束日期字符串
5581
+ * @param {String} unit - 单位:year/month/day
5582
+ * @returns {Number} 差值
5583
+ */
5584
+ var dateDiff = function dateDiff(start_date, end_date) {
5585
+ var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
5586
+
5587
+ // Assuming date strings are in "YYYY-MM-DD" format
5588
+ var startDate = new Date(start_date);
5589
+ var endDate = new Date(end_date);
5590
+
5591
+ // If the date is invalid, return 0
5592
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
5593
+ return 0;
5594
+ }
5595
+
5596
+ if (unit === 'year') {
5597
+ return endDate.getFullYear() - startDate.getFullYear();
5598
+ } else if (unit === 'month') {
5599
+ return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
5600
+ } else {
5601
+ // Default to day
5602
+ var timeDifference = endDate - startDate;
5603
+ // Calculate days (86400000 milliseconds per day)
5604
+ return Math.floor(timeDifference / 86400000);
5605
+ }
5606
+ };
5607
+
5608
+ /**
5609
+ * 获取月份中的日期
5610
+ * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
5611
+ * @returns {number} 月份中的日期(1-31)
5612
+ */
5613
+ var dayOfMonth = function dayOfMonth(date) {
5614
+ if (typeof date !== 'string') {
5615
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5616
+ }
5617
+
5618
+ var dateObj = new Date(date);
5619
+ if (isNaN(dateObj.getTime())) {
5620
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5621
+ }
5622
+
5623
+ return dateObj.getDate();
5624
+ };
5625
+
5626
+ /**
5627
+ * 获取当前日期
5628
+ * @date 2022年5月7日
5629
+ * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
5630
+ * @returns {string} 当前日期的格式化字符串
5631
+ */
5632
+ var getCurrentDate = function getCurrentDate() {
5633
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
5634
+
5635
+ return formatDate(new Date(), format);
5636
+ };
5637
+
5638
+ /**
5639
+ * 获取当前日期时间
5640
+ * @date 2022年5月7日
5641
+ * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
5642
+ * @returns {string} 当前日期时间的格式化字符串
5643
+ */
5644
+ var getCurrentDateTime = function getCurrentDateTime() {
5645
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
5646
+
5647
+ return formatDate(new Date(), format);
5648
+ };
5649
+
5650
+ /**
5651
+ * 获取小时
5652
+ * @date 2022年5月7日
5653
+ * @param {Date|string} [date] - 日期对象或日期字符串
5654
+ * @returns {number} 小时数(0-23)
5655
+ */
5656
+ var getHour = function getHour(date) {
5657
+ if (!date) {
5658
+ return new Date().getHours();
5659
+ }
5660
+ if (typeof date === 'string') {
5661
+ date = new Date(date);
5662
+ }
5663
+ return date.getHours();
5664
+ };
5665
+
5666
+ /**
5667
+ * 获取分钟
5668
+ * @date 2022年5月7日
5669
+ * @param {Date|string} [date] - 日期对象或日期字符串
5670
+ * @returns {number} 分钟数(0-59)
5671
+ */
5672
+ var getMinute = function getMinute(date) {
5673
+ if (!date) {
5674
+ return new Date().getMinutes();
5675
+ }
5676
+ if (typeof date === 'string') {
5677
+ date = new Date(date);
5678
+ }
5679
+ return date.getMinutes();
5680
+ };
5681
+
5682
+ /**
5683
+ * 获取月份
5684
+ * @date 2022年5月7日
5685
+ * @param {Date|string} [date] - 日期对象或日期字符串
5686
+ * @returns {number} 月份数(1-12)
5687
+ */
5688
+ var getMonth = function getMonth(date) {
5689
+ if (!date) {
5690
+ return new Date().getMonth() + 1;
5691
+ }
5692
+ if (typeof date === 'string') {
5693
+ date = new Date(date);
5694
+ }
5695
+ return date.getMonth() + 1;
5696
+ };
5697
+
5698
+ /**
5699
+ * 获取秒
5700
+ * @date 2022年5月7日
5701
+ * @param {Date|string} [date] - 日期对象或日期字符串
5702
+ * @returns {number} 秒数(0-59)
5703
+ */
5704
+ var getSecond = function getSecond(date) {
5705
+ if (!date) {
5706
+ return new Date().getSeconds();
5707
+ }
5708
+ if (typeof date === 'string') {
5709
+ date = new Date(date);
5710
+ }
5711
+ return date.getSeconds();
5712
+ };
5713
+
5714
+ /**
5715
+ * 获取星期几
5716
+ * @date 2022年5月7日
5717
+ * @param {Date|string} [date] - 日期对象或日期字符串
5718
+ * @returns {number} 星期几(0-6,0表示星期日)
5719
+ */
5720
+ var getWeekday = function getWeekday(date) {
5721
+ if (!date) {
5722
+ return new Date().getDay();
5723
+ }
5724
+ if (typeof date === 'string') {
5725
+ date = new Date(date);
5726
+ }
5727
+ return date.getDay();
5728
+ };
5729
+
5730
+ /**
5731
+ * @desc 获取上午/下午/晚上
5732
+ * @author huangbo
5733
+ * @date 2022年5月7日
5734
+ * @param {String} [time] - 时间
5735
+ **/
5736
+ var timeCycle = function timeCycle(time) {
5737
+ var hour = 0;
5738
+ if (!time) {
5739
+ hour = new Date().getHours();
5740
+ } else if (typeof time === 'string') {
5741
+ // 从时间字符串中提取小时
5742
+ var match = time.match(/^(\d{1,2})/);
5743
+ if (match) {
5744
+ hour = parseInt(match[1], 10);
5745
+ }
5746
+ } else if (typeof time === 'number') {
5747
+ hour = time;
5748
+ }
5749
+ // 判断时间段
5750
+ if (hour >= 5 && hour < 12) {
5751
+ return '上午';
5752
+ } else if (hour >= 12 && hour < 18) {
5753
+ return '下午';
5754
+ } else {
5755
+ return '晚上';
5756
+ }
5757
+ };
5758
+
5759
+ /***/ }),
5760
+
5761
+ /***/ 70:
5762
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
5763
+
5764
+ "use strict";
5765
+ /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
5766
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5767
+
5768
+
5769
+
5770
+ var Transition = function () {
5771
+ function Transition() {
5772
+ _classCallCheck(this, Transition);
5773
+ }
5774
+
5775
+ Transition.prototype.beforeEnter = function beforeEnter(el) {
5776
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
5777
+ if (!el.dataset) el.dataset = {};
5778
+ if (el.dataset.state === 6 || !el.dataset.state) {
5779
+ el.dataset.oldPaddingTop = el.style.paddingTop;
5780
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
5781
+ }
5782
+ el.dataset.state = 1;
5783
+
5784
+ el.style.height = '0';
5785
+ el.style.paddingTop = 0;
5786
+ el.style.paddingBottom = 0;
5787
+ };
5788
+
5789
+ Transition.prototype.enter = function enter(el) {
5790
+ el.dataset.oldOverflow = el.style.overflow;
5791
+ if (el.scrollHeight !== 0) {
5792
+ el.style.height = el.scrollHeight + 'px';
5793
+ el.style.paddingTop = el.dataset.oldPaddingTop;
5794
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
5795
+ } else {
5796
+ el.style.height = '';
5797
+ el.style.paddingTop = el.dataset.oldPaddingTop;
5798
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
5799
+ }
5800
+
5801
+ el.dataset.state = 2;
5802
+ el.style.overflow = 'hidden';
5803
+ };
5804
+
5805
+ Transition.prototype.afterEnter = function afterEnter(el) {
5806
+ // for safari: remove class then reset height is necessary
5807
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
5808
+ el.style.height = '';
5809
+ el.style.overflow = el.dataset.oldOverflow;
5810
+ el.dataset.state = 3;
5811
+ };
5812
+
5813
+ Transition.prototype.beforeLeave = function beforeLeave(el) {
5814
+ if (!el.dataset) el.dataset = {};
5815
+ el.dataset.oldPaddingTop = el.style.paddingTop;
5816
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
5817
+ el.dataset.oldOverflow = el.style.overflow;
5818
+ el.dataset.state = 4;
5819
+
5820
+ el.style.height = el.scrollHeight + 'px';
5821
+ el.style.overflow = 'hidden';
5822
+ };
5823
+
5824
+ Transition.prototype.leave = function leave(el) {
5825
+ if (el.scrollHeight !== 0) {
5826
+ // for safari: add class after set height, or it will jump to zero height suddenly, weired
5827
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
5828
+ el.style.height = 0;
5829
+ el.style.paddingTop = 0;
5830
+ el.style.paddingBottom = 0;
5831
+ el.dataset.state = 5;
5832
+ }
5833
+ };
5834
+
5835
+ Transition.prototype.afterLeave = function afterLeave(el) {
5836
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
5837
+ el.style.height = '';
5838
+ el.style.overflow = el.dataset.oldOverflow;
5839
+ el.style.paddingTop = el.dataset.oldPaddingTop;
5840
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
5841
+ el.dataset.state = 6;
5842
+ };
5843
+
5844
+ return Transition;
5845
+ }();
5846
+
5847
+ /* harmony default export */ __webpack_exports__["a"] = ({
5848
+ name: 'EsCollapseTransition',
5849
+ functional: true,
5850
+ render: function render(h, _ref) {
5851
+ var children = _ref.children;
5852
+
5853
+ var data = {
5854
+ on: new Transition()
5855
+ };
5856
+
5857
+ return h('transition', data, children);
5858
+ }
5859
+ });
5892
5860
 
5893
5861
  /***/ }),
5894
5862
 
5895
5863
  /***/ 71:
5896
5864
  /***/ (function(module, exports) {
5897
5865
 
5898
- module.exports = require("eoss/lib/date-picker");
5866
+ module.exports = require("eoss/lib/cascader");
5899
5867
 
5900
5868
  /***/ }),
5901
5869
 
5902
5870
  /***/ 72:
5903
5871
  /***/ (function(module, exports) {
5904
5872
 
5905
- module.exports = require("eoss/lib/time-picker");
5873
+ module.exports = require("eoss/lib/date-picker");
5906
5874
 
5907
5875
  /***/ }),
5908
5876
 
5909
5877
  /***/ 73:
5910
5878
  /***/ (function(module, exports) {
5911
5879
 
5912
- module.exports = require("eoss/lib/time-select");
5880
+ module.exports = require("eoss/lib/time-picker");
5913
5881
 
5914
5882
  /***/ }),
5915
5883
 
5916
5884
  /***/ 74:
5917
5885
  /***/ (function(module, exports) {
5918
5886
 
5919
- module.exports = require("eoss/lib/rate");
5887
+ module.exports = require("eoss/lib/time-select");
5920
5888
 
5921
5889
  /***/ }),
5922
5890
 
5923
5891
  /***/ 75:
5924
5892
  /***/ (function(module, exports) {
5925
5893
 
5926
- module.exports = require("eoss/lib/slider");
5894
+ module.exports = require("eoss/lib/rate");
5927
5895
 
5928
5896
  /***/ }),
5929
5897
 
5930
5898
  /***/ 76:
5931
5899
  /***/ (function(module, exports) {
5932
5900
 
5933
- module.exports = require("eoss/lib/transfer");
5901
+ module.exports = require("eoss/lib/slider");
5934
5902
 
5935
5903
  /***/ }),
5936
5904
 
5937
5905
  /***/ 77:
5906
+ /***/ (function(module, exports) {
5907
+
5908
+ module.exports = require("eoss/lib/transfer");
5909
+
5910
+ /***/ }),
5911
+
5912
+ /***/ 78:
5938
5913
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5939
5914
 
5940
5915
  "use strict";
@@ -5986,7 +5961,7 @@ render._withStripped = true
5986
5961
  // CONCATENATED MODULE: ./src/components/field-render.vue?vue&type=template&id=0751ef51&
5987
5962
 
5988
5963
  // EXTERNAL MODULE: external "eoss/lib/input-number"
5989
- var input_number_ = __webpack_require__(54);
5964
+ var input_number_ = __webpack_require__(56);
5990
5965
  var input_number_default = /*#__PURE__*/__webpack_require__.n(input_number_);
5991
5966
 
5992
5967
  // EXTERNAL MODULE: external "eoss/lib/radio-group"
@@ -6002,11 +5977,11 @@ var select_ = __webpack_require__(41);
6002
5977
  var select_default = /*#__PURE__*/__webpack_require__.n(select_);
6003
5978
 
6004
5979
  // EXTERNAL MODULE: external "eoss/lib/cascader"
6005
- var cascader_ = __webpack_require__(70);
5980
+ var cascader_ = __webpack_require__(71);
6006
5981
  var cascader_default = /*#__PURE__*/__webpack_require__.n(cascader_);
6007
5982
 
6008
5983
  // EXTERNAL MODULE: external "eoss/lib/switch"
6009
- var switch_ = __webpack_require__(64);
5984
+ var switch_ = __webpack_require__(65);
6010
5985
  var switch_default = /*#__PURE__*/__webpack_require__.n(switch_);
6011
5986
 
6012
5987
  // EXTERNAL MODULE: external "eoss/lib/input"
@@ -6014,39 +5989,39 @@ var input_ = __webpack_require__(14);
6014
5989
  var input_default = /*#__PURE__*/__webpack_require__.n(input_);
6015
5990
 
6016
5991
  // EXTERNAL MODULE: external "eoss/lib/date-picker"
6017
- var date_picker_ = __webpack_require__(71);
5992
+ var date_picker_ = __webpack_require__(72);
6018
5993
  var date_picker_default = /*#__PURE__*/__webpack_require__.n(date_picker_);
6019
5994
 
6020
5995
  // EXTERNAL MODULE: external "eoss/lib/time-picker"
6021
- var time_picker_ = __webpack_require__(72);
5996
+ var time_picker_ = __webpack_require__(73);
6022
5997
  var time_picker_default = /*#__PURE__*/__webpack_require__.n(time_picker_);
6023
5998
 
6024
5999
  // EXTERNAL MODULE: external "eoss/lib/time-select"
6025
- var time_select_ = __webpack_require__(73);
6000
+ var time_select_ = __webpack_require__(74);
6026
6001
  var time_select_default = /*#__PURE__*/__webpack_require__.n(time_select_);
6027
6002
 
6028
6003
  // EXTERNAL MODULE: external "eoss/lib/upload"
6029
- var upload_ = __webpack_require__(49);
6004
+ var upload_ = __webpack_require__(50);
6030
6005
  var upload_default = /*#__PURE__*/__webpack_require__.n(upload_);
6031
6006
 
6032
6007
  // EXTERNAL MODULE: external "eoss/lib/rate"
6033
- var rate_ = __webpack_require__(74);
6008
+ var rate_ = __webpack_require__(75);
6034
6009
  var rate_default = /*#__PURE__*/__webpack_require__.n(rate_);
6035
6010
 
6036
6011
  // EXTERNAL MODULE: external "eoss/lib/slider"
6037
- var slider_ = __webpack_require__(75);
6012
+ var slider_ = __webpack_require__(76);
6038
6013
  var slider_default = /*#__PURE__*/__webpack_require__.n(slider_);
6039
6014
 
6040
6015
  // EXTERNAL MODULE: external "eoss/lib/color-picker"
6041
- var color_picker_ = __webpack_require__(65);
6016
+ var color_picker_ = __webpack_require__(66);
6042
6017
  var color_picker_default = /*#__PURE__*/__webpack_require__.n(color_picker_);
6043
6018
 
6044
6019
  // EXTERNAL MODULE: external "eoss/lib/transfer"
6045
- var transfer_ = __webpack_require__(76);
6020
+ var transfer_ = __webpack_require__(77);
6046
6021
  var transfer_default = /*#__PURE__*/__webpack_require__.n(transfer_);
6047
6022
 
6048
6023
  // EXTERNAL MODULE: external "eoss/lib/tree"
6049
- var tree_ = __webpack_require__(50);
6024
+ var tree_ = __webpack_require__(51);
6050
6025
  var tree_default = /*#__PURE__*/__webpack_require__.n(tree_);
6051
6026
 
6052
6027
  // EXTERNAL MODULE: external "eoss/lib/button"
@@ -6178,7 +6153,7 @@ var CLASS_INLINE_MAP = {
6178
6153
  EsCascader: cascader_default.a,
6179
6154
  // 异步加载:断开 form → field-render → selector → selector-panel → form 的循环依赖
6180
6155
  EsSelector: function EsSelector() {
6181
- return Promise.resolve(/* import() */).then(__webpack_require__.t.bind(null, 66, 7));
6156
+ return Promise.resolve(/* import() */).then(__webpack_require__.t.bind(null, 67, 7));
6182
6157
  },
6183
6158
  EsSwitch: switch_default.a,
6184
6159
  EsInput: input_default.a,