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
@@ -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 = 160);
139
+ /******/ return __webpack_require__(__webpack_require__.s = 164);
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; }
@@ -4041,12 +4041,12 @@ module.exports = require("eoss/lib/loading");
4041
4041
 
4042
4042
  /***/ }),
4043
4043
 
4044
- /***/ 160:
4044
+ /***/ 164:
4045
4045
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4046
4046
 
4047
4047
  "use strict";
4048
4048
  __webpack_require__.r(__webpack_exports__);
4049
- /* harmony import */ var _collapse_src_collapse_item_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(106);
4049
+ /* harmony import */ var _collapse_src_collapse_item_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(108);
4050
4050
 
4051
4051
 
4052
4052
  /* istanbul ignore next */
@@ -4286,13 +4286,6 @@ module.exports = require("eoss/lib/radio-group");
4286
4286
 
4287
4287
  /***/ }),
4288
4288
 
4289
- /***/ 49:
4290
- /***/ (function(module, exports) {
4291
-
4292
- module.exports = require("eoss/lib/upload");
4293
-
4294
- /***/ }),
4295
-
4296
4289
  /***/ 5:
4297
4290
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4298
4291
 
@@ -4555,137 +4548,42 @@ function insertAfter(newEl, targetEl) {
4555
4548
  /***/ 50:
4556
4549
  /***/ (function(module, exports) {
4557
4550
 
4558
- module.exports = require("eoss/lib/tree");
4551
+ module.exports = require("eoss/lib/upload");
4559
4552
 
4560
4553
  /***/ }),
4561
4554
 
4562
- /***/ 54:
4555
+ /***/ 51:
4563
4556
  /***/ (function(module, exports) {
4564
4557
 
4565
- module.exports = require("eoss/lib/input-number");
4558
+ module.exports = require("eoss/lib/tree");
4566
4559
 
4567
4560
  /***/ }),
4568
4561
 
4569
- /***/ 64:
4562
+ /***/ 56:
4570
4563
  /***/ (function(module, exports) {
4571
4564
 
4572
- module.exports = require("eoss/lib/switch");
4565
+ module.exports = require("eoss/lib/input-number");
4573
4566
 
4574
4567
  /***/ }),
4575
4568
 
4576
4569
  /***/ 65:
4577
4570
  /***/ (function(module, exports) {
4578
4571
 
4579
- module.exports = require("eoss/lib/color-picker");
4572
+ module.exports = require("eoss/lib/switch");
4580
4573
 
4581
4574
  /***/ }),
4582
4575
 
4583
4576
  /***/ 66:
4584
4577
  /***/ (function(module, exports) {
4585
4578
 
4586
- module.exports = require("eoss/lib/selector");
4579
+ module.exports = require("eoss/lib/color-picker");
4587
4580
 
4588
4581
  /***/ }),
4589
4582
 
4590
- /***/ 69:
4591
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4592
-
4593
- "use strict";
4594
- /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
4595
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4596
-
4597
-
4598
-
4599
- var Transition = function () {
4600
- function Transition() {
4601
- _classCallCheck(this, Transition);
4602
- }
4603
-
4604
- Transition.prototype.beforeEnter = function beforeEnter(el) {
4605
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
4606
- if (!el.dataset) el.dataset = {};
4607
- if (el.dataset.state === 6 || !el.dataset.state) {
4608
- el.dataset.oldPaddingTop = el.style.paddingTop;
4609
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
4610
- }
4611
- el.dataset.state = 1;
4612
-
4613
- el.style.height = '0';
4614
- el.style.paddingTop = 0;
4615
- el.style.paddingBottom = 0;
4616
- };
4617
-
4618
- Transition.prototype.enter = function enter(el) {
4619
- el.dataset.oldOverflow = el.style.overflow;
4620
- if (el.scrollHeight !== 0) {
4621
- el.style.height = el.scrollHeight + 'px';
4622
- el.style.paddingTop = el.dataset.oldPaddingTop;
4623
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
4624
- } else {
4625
- el.style.height = '';
4626
- el.style.paddingTop = el.dataset.oldPaddingTop;
4627
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
4628
- }
4629
-
4630
- el.dataset.state = 2;
4631
- el.style.overflow = 'hidden';
4632
- };
4633
-
4634
- Transition.prototype.afterEnter = function afterEnter(el) {
4635
- // for safari: remove class then reset height is necessary
4636
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
4637
- el.style.height = '';
4638
- el.style.overflow = el.dataset.oldOverflow;
4639
- el.dataset.state = 3;
4640
- };
4641
-
4642
- Transition.prototype.beforeLeave = function beforeLeave(el) {
4643
- if (!el.dataset) el.dataset = {};
4644
- el.dataset.oldPaddingTop = el.style.paddingTop;
4645
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
4646
- el.dataset.oldOverflow = el.style.overflow;
4647
- el.dataset.state = 4;
4648
-
4649
- el.style.height = el.scrollHeight + 'px';
4650
- el.style.overflow = 'hidden';
4651
- };
4652
-
4653
- Transition.prototype.leave = function leave(el) {
4654
- if (el.scrollHeight !== 0) {
4655
- // for safari: add class after set height, or it will jump to zero height suddenly, weired
4656
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
4657
- el.style.height = 0;
4658
- el.style.paddingTop = 0;
4659
- el.style.paddingBottom = 0;
4660
- el.dataset.state = 5;
4661
- }
4662
- };
4663
-
4664
- Transition.prototype.afterLeave = function afterLeave(el) {
4665
- Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
4666
- el.style.height = '';
4667
- el.style.overflow = el.dataset.oldOverflow;
4668
- el.style.paddingTop = el.dataset.oldPaddingTop;
4669
- el.style.paddingBottom = el.dataset.oldPaddingBottom;
4670
- el.dataset.state = 6;
4671
- };
4672
-
4673
- return Transition;
4674
- }();
4675
-
4676
- /* harmony default export */ __webpack_exports__["a"] = ({
4677
- name: 'EsCollapseTransition',
4678
- functional: true,
4679
- render: function render(h, _ref) {
4680
- var children = _ref.children;
4681
-
4682
- var data = {
4683
- on: new Transition()
4684
- };
4583
+ /***/ 67:
4584
+ /***/ (function(module, exports) {
4685
4585
 
4686
- return h('transition', data, children);
4687
- }
4688
- });
4586
+ module.exports = require("eoss/lib/selector");
4689
4587
 
4690
4588
  /***/ }),
4691
4589
 
@@ -4739,996 +4637,1073 @@ var Transition = function () {
4739
4637
  /* unused harmony export getSecond */
4740
4638
  /* unused harmony export getWeekday */
4741
4639
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
4742
- /* Modified from https://github.com/taylorhakes/fecha
4743
- *
4744
- * The MIT License (MIT)
4745
- *
4746
- * Copyright (c) 2015 Taylor Hakes
4747
- *
4748
- * Permission is hereby granted, free of charge, to any person obtaining a copy
4749
- * of this software and associated documentation files (the "Software"), to deal
4750
- * in the Software without restriction, including without limitation the rights
4751
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4752
- * copies of the Software, and to permit persons to whom the Software is
4753
- * furnished to do so, subject to the following conditions:
4754
- *
4755
- * The above copyright notice and this permission notice shall be included in all
4756
- * copies or substantial portions of the Software.
4757
- *
4758
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4759
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4760
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4761
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4762
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4763
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
4764
- * SOFTWARE.
4765
- */
4766
-
4767
- /*eslint-disable*/
4768
- // 把 YYYY-MM-DD 改成了 yyyy-MM-dd
4769
-
4770
-
4640
+
4641
+
4771
4642
  /**
4772
4643
  * Parse or format dates
4773
4644
  * @class fecha
4774
- */
4775
- const fecha = {};
4776
- const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
4777
- const twoDigits = '\\d\\d?';
4778
- const threeDigits = '\\d{3}';
4779
- const fourDigits = '\\d{4}';
4780
- const word = '[^\\s]+';
4781
- const literal = /\[([^]*?)\]/gm;
4782
- const noop = function () {};
4783
-
4784
- function regexEscape(str) {
4785
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
4786
- }
4787
-
4788
- function shorten(arr, sLen) {
4789
- const newArr = [];
4790
- for (let i = 0, len = arr.length; i < len; i++) {
4791
- newArr.push(arr[i].substr(0, sLen));
4792
- }
4793
- return newArr;
4794
- }
4795
-
4796
- function monthUpdate() {
4797
- return function (d, v) {
4798
- const index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
4799
- if (~index) {
4800
- d.month = index;
4801
- }
4802
- };
4803
- }
4804
-
4805
- function pad(val, len) {
4806
- val = String(val);
4807
- len = len || 2;
4808
- while (val.length < len) {
4809
- val = '0' + val;
4810
- }
4811
- return val;
4812
- }
4813
-
4814
- // 直接使用中文日期名称常量
4815
- const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
4816
- const monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
4817
- const monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
4818
- const dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
4819
- const amPm = ['上午', '下午'];
4820
- const DoFn = function DoFn(D) {
4821
- return D + '日';
4822
- };
4823
-
4824
- const formatFlags = {
4825
- D: function(dateObj) {
4826
- return dateObj.getDay();
4827
- },
4828
- DD: function(dateObj) {
4829
- return pad(dateObj.getDay());
4830
- },
4831
- Do: function(dateObj) {
4832
- return DoFn(dateObj.getDate());
4833
- },
4834
- d: function(dateObj) {
4835
- return dateObj.getDate();
4836
- },
4837
- dd: function(dateObj) {
4838
- return pad(dateObj.getDate());
4839
- },
4840
- ddd: function(dateObj) {
4841
- return dayNamesShort[dateObj.getDay()];
4842
- },
4843
- dddd: function(dateObj) {
4844
- return dayNames[dateObj.getDay()];
4845
- },
4846
- M: function(dateObj) {
4847
- return dateObj.getMonth() + 1;
4848
- },
4849
- MM: function(dateObj) {
4850
- return pad(dateObj.getMonth() + 1);
4851
- },
4852
- MMM: function(dateObj) {
4853
- return monthNamesShort[dateObj.getMonth()];
4854
- },
4855
- MMMM: function(dateObj) {
4856
- return monthNames[dateObj.getMonth()];
4857
- },
4858
- yy: function(dateObj) {
4859
- return pad(String(dateObj.getFullYear()), 4).substr(2);
4860
- },
4861
- yyyy: function(dateObj) {
4862
- return pad(dateObj.getFullYear(), 4);
4863
- },
4864
- h: function(dateObj) {
4865
- return dateObj.getHours() % 12 || 12;
4866
- },
4867
- hh: function(dateObj) {
4868
- return pad(dateObj.getHours() % 12 || 12);
4869
- },
4870
- H: function(dateObj) {
4871
- return dateObj.getHours();
4872
- },
4873
- HH: function(dateObj) {
4874
- return pad(dateObj.getHours());
4875
- },
4876
- m: function(dateObj) {
4877
- return dateObj.getMinutes();
4878
- },
4879
- mm: function(dateObj) {
4880
- return pad(dateObj.getMinutes());
4881
- },
4882
- s: function(dateObj) {
4883
- return dateObj.getSeconds();
4884
- },
4885
- ss: function(dateObj) {
4886
- return pad(dateObj.getSeconds());
4887
- },
4888
- S: function(dateObj) {
4889
- return Math.round(dateObj.getMilliseconds() / 100);
4890
- },
4891
- SS: function(dateObj) {
4892
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
4893
- },
4894
- SSS: function(dateObj) {
4895
- return pad(dateObj.getMilliseconds(), 3);
4896
- },
4897
- a: function(dateObj) {
4898
- return dateObj.getHours() < 12 ? '上午' : '下午';
4899
- },
4900
- A: function(dateObj) {
4901
- return dateObj.getHours() < 12 ? '上午' : '下午';
4902
- },
4903
- ZZ: function(dateObj) {
4904
- const o = dateObj.getTimezoneOffset();
4905
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
4906
- }
4907
- };
4908
-
4909
- const parseFlags = {
4910
- d: [twoDigits, function (d, v) {
4911
- d.day = v;
4912
- }],
4913
- Do: [twoDigits + word, function (d, v) {
4914
- d.day = parseInt(v, 10);
4915
- }],
4916
- M: [twoDigits, function (d, v) {
4917
- d.month = v - 1;
4918
- }],
4919
- yy: [twoDigits, function (d, v) {
4920
- const da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
4921
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
4922
- }],
4923
- h: [twoDigits, function (d, v) {
4924
- d.hour = v;
4925
- }],
4926
- m: [twoDigits, function (d, v) {
4927
- d.minute = v;
4928
- }],
4929
- s: [twoDigits, function (d, v) {
4930
- d.second = v;
4931
- }],
4932
- yyyy: [fourDigits, function (d, v) {
4933
- d.year = v;
4934
- }],
4935
- S: ['\\d', function (d, v) {
4936
- d.millisecond = v * 100;
4937
- }],
4938
- SS: ['\\d{2}', function (d, v) {
4939
- d.millisecond = v * 10;
4940
- }],
4941
- SSS: [threeDigits, function (d, v) {
4942
- d.millisecond = v;
4943
- }],
4944
- D: [twoDigits, noop],
4945
- ddd: [word, noop],
4946
- MMM: [word, monthUpdate('monthNamesShort')],
4947
- MMMM: [word, monthUpdate('monthNames')],
4948
- a: [word, function (d, v) {
4949
- const val = v.toLowerCase();
4950
- if (val === '上午') {
4951
- d.isPm = false;
4952
- } else if (val === '下午') {
4953
- d.isPm = true;
4954
- }
4955
- }],
4956
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
4957
- let parts = (v + '').match(/([+-]|\d\d)/gi), minutes;
4958
-
4959
- if (parts) {
4960
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
4961
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
4962
- }
4963
- }]
4964
- };
4965
- parseFlags.dd = parseFlags.d;
4966
- parseFlags.dddd = parseFlags.ddd;
4967
- parseFlags.DD = parseFlags.D;
4968
- parseFlags.mm = parseFlags.m;
4969
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
4970
- parseFlags.MM = parseFlags.M;
4971
- parseFlags.ss = parseFlags.s;
4972
- parseFlags.A = parseFlags.a;
4973
-
4974
-
4975
- // Some common format strings
4976
- fecha.masks = {
4977
- default: 'ddd MMM dd yyyy HH:mm:ss',
4978
- shortDate: 'M/D/yy',
4979
- mediumDate: 'MMM d, yyyy',
4980
- longDate: 'MMMM d, yyyy',
4981
- fullDate: 'dddd, MMMM d, yyyy',
4982
- shortTime: 'HH:mm',
4983
- mediumTime: 'HH:mm:ss',
4984
- longTime: 'HH:mm:ss.SSS'
4985
- };
4986
-
4645
+ */
4646
+ var fecha = {};
4647
+ var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
4648
+ var twoDigits = '\\d\\d?';
4649
+ var threeDigits = '\\d{3}';
4650
+ var fourDigits = '\\d{4}';
4651
+ var word = '[^\\s]+';
4652
+ var literal = /\[([^]*?)\]/gm;
4653
+ var noop = function noop() {};
4654
+
4655
+ function regexEscape(str) {
4656
+ return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
4657
+ }
4658
+
4659
+ function shorten(arr, sLen) {
4660
+ var newArr = [];
4661
+ for (var i = 0, len = arr.length; i < len; i++) {
4662
+ newArr.push(arr[i].substr(0, sLen));
4663
+ }
4664
+ return newArr;
4665
+ }
4666
+
4667
+ function monthUpdate() {
4668
+ return function (d, v) {
4669
+ var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
4670
+ if (~index) {
4671
+ d.month = index;
4672
+ }
4673
+ };
4674
+ }
4675
+
4676
+ function pad(val, len) {
4677
+ val = String(val);
4678
+ len = len || 2;
4679
+ while (val.length < len) {
4680
+ val = '0' + val;
4681
+ }
4682
+ return val;
4683
+ }
4684
+
4685
+ // 直接使用中文日期名称常量
4686
+ var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
4687
+ var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
4688
+ var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
4689
+ var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
4690
+ var amPm = ['上午', '下午'];
4691
+ var DoFn = function DoFn(D) {
4692
+ return D + '日';
4693
+ };
4694
+
4695
+ var formatFlags = {
4696
+ D: function D(dateObj) {
4697
+ return dateObj.getDay();
4698
+ },
4699
+ DD: function DD(dateObj) {
4700
+ return pad(dateObj.getDay());
4701
+ },
4702
+ Do: function Do(dateObj) {
4703
+ return DoFn(dateObj.getDate());
4704
+ },
4705
+ d: function d(dateObj) {
4706
+ return dateObj.getDate();
4707
+ },
4708
+ dd: function dd(dateObj) {
4709
+ return pad(dateObj.getDate());
4710
+ },
4711
+ ddd: function ddd(dateObj) {
4712
+ return dayNamesShort[dateObj.getDay()];
4713
+ },
4714
+ dddd: function dddd(dateObj) {
4715
+ return dayNames[dateObj.getDay()];
4716
+ },
4717
+ M: function M(dateObj) {
4718
+ return dateObj.getMonth() + 1;
4719
+ },
4720
+ MM: function MM(dateObj) {
4721
+ return pad(dateObj.getMonth() + 1);
4722
+ },
4723
+ MMM: function MMM(dateObj) {
4724
+ return monthNamesShort[dateObj.getMonth()];
4725
+ },
4726
+ MMMM: function MMMM(dateObj) {
4727
+ return monthNames[dateObj.getMonth()];
4728
+ },
4729
+ yy: function yy(dateObj) {
4730
+ return pad(String(dateObj.getFullYear()), 4).substr(2);
4731
+ },
4732
+ yyyy: function yyyy(dateObj) {
4733
+ return pad(dateObj.getFullYear(), 4);
4734
+ },
4735
+ h: function h(dateObj) {
4736
+ return dateObj.getHours() % 12 || 12;
4737
+ },
4738
+ hh: function hh(dateObj) {
4739
+ return pad(dateObj.getHours() % 12 || 12);
4740
+ },
4741
+ H: function H(dateObj) {
4742
+ return dateObj.getHours();
4743
+ },
4744
+ HH: function HH(dateObj) {
4745
+ return pad(dateObj.getHours());
4746
+ },
4747
+ m: function m(dateObj) {
4748
+ return dateObj.getMinutes();
4749
+ },
4750
+ mm: function mm(dateObj) {
4751
+ return pad(dateObj.getMinutes());
4752
+ },
4753
+ s: function s(dateObj) {
4754
+ return dateObj.getSeconds();
4755
+ },
4756
+ ss: function ss(dateObj) {
4757
+ return pad(dateObj.getSeconds());
4758
+ },
4759
+ S: function S(dateObj) {
4760
+ return Math.round(dateObj.getMilliseconds() / 100);
4761
+ },
4762
+ SS: function SS(dateObj) {
4763
+ return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
4764
+ },
4765
+ SSS: function SSS(dateObj) {
4766
+ return pad(dateObj.getMilliseconds(), 3);
4767
+ },
4768
+ a: function a(dateObj) {
4769
+ return dateObj.getHours() < 12 ? '上午' : '下午';
4770
+ },
4771
+ A: function A(dateObj) {
4772
+ return dateObj.getHours() < 12 ? '上午' : '下午';
4773
+ },
4774
+ ZZ: function ZZ(dateObj) {
4775
+ var o = dateObj.getTimezoneOffset();
4776
+ return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
4777
+ }
4778
+ };
4779
+
4780
+ var parseFlags = {
4781
+ d: [twoDigits, function (d, v) {
4782
+ d.day = v;
4783
+ }],
4784
+ Do: [twoDigits + word, function (d, v) {
4785
+ d.day = parseInt(v, 10);
4786
+ }],
4787
+ M: [twoDigits, function (d, v) {
4788
+ d.month = v - 1;
4789
+ }],
4790
+ yy: [twoDigits, function (d, v) {
4791
+ var da = new Date(),
4792
+ cent = +('' + da.getFullYear()).substr(0, 2);
4793
+ d.year = '' + (v > 68 ? cent - 1 : cent) + v;
4794
+ }],
4795
+ h: [twoDigits, function (d, v) {
4796
+ d.hour = v;
4797
+ }],
4798
+ m: [twoDigits, function (d, v) {
4799
+ d.minute = v;
4800
+ }],
4801
+ s: [twoDigits, function (d, v) {
4802
+ d.second = v;
4803
+ }],
4804
+ yyyy: [fourDigits, function (d, v) {
4805
+ d.year = v;
4806
+ }],
4807
+ S: ['\\d', function (d, v) {
4808
+ d.millisecond = v * 100;
4809
+ }],
4810
+ SS: ['\\d{2}', function (d, v) {
4811
+ d.millisecond = v * 10;
4812
+ }],
4813
+ SSS: [threeDigits, function (d, v) {
4814
+ d.millisecond = v;
4815
+ }],
4816
+ D: [twoDigits, noop],
4817
+ ddd: [word, noop],
4818
+ MMM: [word, monthUpdate('monthNamesShort')],
4819
+ MMMM: [word, monthUpdate('monthNames')],
4820
+ a: [word, function (d, v) {
4821
+ var val = v.toLowerCase();
4822
+ if (val === '上午') {
4823
+ d.isPm = false;
4824
+ } else if (val === '下午') {
4825
+ d.isPm = true;
4826
+ }
4827
+ }],
4828
+ ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
4829
+ var parts = (v + '').match(/([+-]|\d\d)/gi),
4830
+ minutes = void 0;
4831
+
4832
+ if (parts) {
4833
+ minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
4834
+ d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
4835
+ }
4836
+ }]
4837
+ };
4838
+ parseFlags.dd = parseFlags.d;
4839
+ parseFlags.dddd = parseFlags.ddd;
4840
+ parseFlags.DD = parseFlags.D;
4841
+ parseFlags.mm = parseFlags.m;
4842
+ parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
4843
+ parseFlags.MM = parseFlags.M;
4844
+ parseFlags.ss = parseFlags.s;
4845
+ parseFlags.A = parseFlags.a;
4846
+
4847
+ // Some common format strings
4848
+ fecha.masks = {
4849
+ default: 'ddd MMM dd yyyy HH:mm:ss',
4850
+ shortDate: 'M/D/yy',
4851
+ mediumDate: 'MMM d, yyyy',
4852
+ longDate: 'MMMM d, yyyy',
4853
+ fullDate: 'dddd, MMMM d, yyyy',
4854
+ shortTime: 'HH:mm',
4855
+ mediumTime: 'HH:mm:ss',
4856
+ longTime: 'HH:mm:ss.SSS'
4857
+ };
4858
+
4987
4859
  /***
4988
4860
  * Format a date
4989
4861
  * @method format
4990
4862
  * @param {Date|number} dateObj
4991
4863
  * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
4992
- */
4993
- fecha.format = function (dateObj, mask) {
4994
- if (typeof dateObj === 'number') {
4995
- dateObj = new Date(dateObj);
4996
- }
4997
-
4998
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
4999
- throw new Error('Invalid Date in fecha.format');
5000
- }
5001
-
5002
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
5003
-
5004
- const literals = [];
5005
-
5006
- // Make literals inactive by replacing them with ??
5007
- mask = mask.replace(literal, function($0, $1) {
5008
- literals.push($1);
5009
- return '@@@';
5010
- });
5011
- // Apply formatting rules
5012
- mask = mask.replace(token, function ($0) {
5013
- return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
5014
- });
5015
- // Inline literal values back into the formatted value
5016
- return mask.replace(/@@@/g, function() {
5017
- return literals.shift();
5018
- });
5019
- };
5020
-
4864
+ */
4865
+ fecha.format = function (dateObj, mask) {
4866
+ if (typeof dateObj === 'number') {
4867
+ dateObj = new Date(dateObj);
4868
+ }
4869
+
4870
+ if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
4871
+ throw new Error('Invalid Date in fecha.format');
4872
+ }
4873
+
4874
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
4875
+
4876
+ var literals = [];
4877
+
4878
+ // Make literals inactive by replacing them with ??
4879
+ mask = mask.replace(literal, function ($0, $1) {
4880
+ literals.push($1);
4881
+ return '@@@';
4882
+ });
4883
+ // Apply formatting rules
4884
+ mask = mask.replace(token, function ($0) {
4885
+ return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
4886
+ });
4887
+ // Inline literal values back into the formatted value
4888
+ return mask.replace(/@@@/g, function () {
4889
+ return literals.shift();
4890
+ });
4891
+ };
4892
+
5021
4893
  /**
5022
4894
  * Parse a date string into an object, changes - into /
5023
4895
  * @method parse
5024
4896
  * @param {string} dateStr Date string
5025
4897
  * @param {string} format Date parse format
5026
4898
  * @returns {Date|boolean}
5027
- */
5028
- fecha.parse = function (dateStr, format) {
5029
- if (typeof format !== 'string') {
5030
- throw new Error('Invalid format in fecha.parse');
5031
- }
5032
-
5033
- format = fecha.masks[format] || format;
5034
-
5035
- // Avoid regular expression denial of service, fail early for really long strings
5036
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
5037
- if (dateStr.length > 1000) {
5038
- return null;
5039
- }
5040
-
5041
- const dateInfo = {};
5042
- const parseInfo = [];
5043
- const literals = [];
5044
- format = format.replace(literal, function($0, $1) {
5045
- literals.push($1);
5046
- return '@@@';
5047
- });
5048
- let newFormat = regexEscape(format).replace(token, function ($0) {
5049
- if (parseFlags[$0]) {
5050
- const info = parseFlags[$0];
5051
- parseInfo.push(info[1]);
5052
- return '(' + info[0] + ')';
5053
- }
5054
-
5055
- return $0;
5056
- });
5057
- newFormat = newFormat.replace(/@@@/g, function() {
5058
- return literals.shift();
5059
- });
5060
- const matches = dateStr.match(new RegExp(newFormat, 'i'));
5061
- if (!matches) {
5062
- return null;
5063
- }
5064
-
5065
- for (let i = 1; i < matches.length; i++) {
5066
- parseInfo[i - 1](dateInfo, matches[i]);
5067
- }
5068
-
5069
- const today = new Date();
5070
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
5071
- dateInfo.hour = +dateInfo.hour + 12;
5072
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
5073
- dateInfo.hour = 0;
5074
- }
5075
-
5076
- let date;
5077
- if (dateInfo.timezoneOffset != null) {
5078
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
5079
- date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
5080
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
5081
- } else {
5082
- date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
5083
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
5084
- }
5085
- return date;
5086
- };
5087
-
5088
- // 导出fecha对象
5089
-
5090
-
5091
- // 以下是从date-util.js合并的函数
5092
- const newArray = function(start, end) {
5093
- let result = [];
5094
- for (let i = start; i <= end; i++) {
5095
- result.push(i);
5096
- }
5097
- return result;
5098
- };
5099
-
5100
- const getSettings = () => {
5101
- return {
5102
- dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
5103
- dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
5104
- monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
5105
- monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
5106
- amPm: ['上午', '下午']
5107
- };
5108
- };
5109
-
5110
- const toDate = function(date) {
5111
- return isDate(date) ? new Date(date) : null;
5112
- };
5113
-
5114
- const isDate = function(date) {
5115
- if (date === null || date === undefined) return false;
5116
- if (isNaN(new Date(date).getTime())) return false;
5117
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
5118
- return true;
5119
- };
5120
-
5121
- const isDateObject = function(val) {
5122
- return val instanceof Date;
5123
- };
5124
-
5125
- const formatDate = function (date, format = 'yyyy-MM-dd') {
5126
- // 处理多种输入类型
5127
- if (!date) return '';
5128
-
5129
- // 如果是时间戳,转成日期对象
5130
- if (typeof date === 'number') {
5131
- date = new Date(date);
5132
- }
5133
- // 如果是字符串,转成日期对象
5134
- if (typeof date === 'string') {
5135
- date = new Date(date);
5136
- }
5137
-
5138
- // 调用toDate进一步验证和转换
5139
- date = toDate(date);
5140
- if (!date) return '';
5141
-
5142
- // 兼容大写和小写的格式标记
5143
- // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
5144
- const lowercaseFormat = format
5145
- .replace(/YYYY/g, 'yyyy')
5146
- .replace(/D/g, 'd')
5147
-
5148
- // 使用fecha库进行格式化,支持中文配置
5149
- const str = fecha.format(date, lowercaseFormat, getSettings());
5150
- return str;
5151
- };
5152
-
5153
- const parseDate = function(string, format) {
5154
- return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
5155
- };
5156
-
5157
- const getDayCountOfMonth = function(year, month) {
5158
- if (month === 3 || month === 5 || month === 8 || month === 10) {
5159
- return 30;
5160
- }
5161
-
5162
- if (month === 1) {
5163
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
5164
- return 29;
5165
- } else {
5166
- return 28;
5167
- }
5168
- }
5169
-
5170
- return 31;
5171
- };
5172
-
5173
- const getDayCountOfYear = function(year) {
5174
- const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
5175
- return isLeapYear ? 366 : 365;
5176
- };
5177
-
5178
- const getFirstDayOfMonth = function(date) {
5179
- const temp = new Date(date.getTime());
5180
- temp.setDate(1);
5181
- return temp.getDay();
5182
- };
5183
-
5184
- // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
5185
- // {prev, next} Date should work for Daylight Saving Time
5186
- // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
5187
- const prevDate = function(date, amount = 1) {
5188
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
5189
- };
5190
-
5191
- const nextDate = function(date, amount = 1) {
5192
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
5193
- };
5194
-
5195
- const getStartDateOfMonth = function(year, month) {
5196
- const result = new Date(year, month, 1);
5197
- const day = result.getDay();
5198
-
5199
- if (day === 0) {
5200
- return prevDate(result, 7);
5201
- } else {
5202
- return prevDate(result, day);
5203
- }
5204
- };
5205
-
5206
- const getWeekNumber = function(date) {
5207
- // 支持多种输入类型
5208
- if (!date||!isDate(date)) {
5209
- date = new Date();
5210
- }
5211
- if (typeof date === 'string') {
5212
- date = new Date(date);
5213
- }
5214
-
5215
- // 验证日期有效性
5216
- if (!isDate(date)) return null;
5217
-
5218
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
5219
- // 设置为最近的星期四:当前日期 + 4 - 当前星期数
5220
- // 将星期日的星期数设为7
5221
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
5222
- // 获取当年的第一天
5223
- const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
5224
- // 计算到最近的星期四的完整周数
5225
- const weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
5226
- // 返回周数
5227
- return weekNo;
5228
- };
5229
-
5230
- const getRangeHours = function(ranges) {
5231
- const hours = [];
5232
- let disabledHours = [];
5233
-
5234
- (ranges || []).forEach(range => {
5235
- const value = range.map(date => date.getHours());
5236
-
5237
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
5238
- });
5239
-
5240
- if (disabledHours.length) {
5241
- for (let i = 0; i < 24; i++) {
5242
- hours[i] = disabledHours.indexOf(i) === -1;
5243
- }
5244
- } else {
5245
- for (let i = 0; i < 24; i++) {
5246
- hours[i] = false;
5247
- }
5248
- }
5249
-
5250
- return hours;
5251
- };
5252
-
5253
- const getPrevMonthLastDays = (date, amount) => {
5254
- if (amount <= 0) return [];
5255
- const temp = new Date(date.getTime());
5256
- temp.setDate(0);
5257
- const lastDay = temp.getDate();
5258
- return range(amount).map((_, index) => lastDay - (amount - index - 1));
5259
- };
5260
-
5261
- const getMonthDays = (date) => {
5262
- const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
5263
- const days = temp.getDate();
5264
- return range(days).map((_, index) => index + 1);
5265
- };
5266
-
5267
- function setRangeData(arr, start, end, value) {
5268
- for (let i = start; i < end; i++) {
5269
- arr[i] = value;
5270
- }
5271
- }
5272
-
5273
- const getRangeMinutes = function(ranges, hour) {
5274
- const minutes = new Array(60);
5275
-
5276
- if (ranges.length > 0) {
5277
- ranges.forEach(range => {
5278
- const start = range[0];
5279
- const end = range[1];
5280
- const startHour = start.getHours();
5281
- const startMinute = start.getMinutes();
5282
- const endHour = end.getHours();
5283
- const endMinute = end.getMinutes();
5284
- if (startHour === hour && endHour !== hour) {
5285
- setRangeData(minutes, startMinute, 60, true);
5286
- } else if (startHour === hour && endHour === hour) {
5287
- setRangeData(minutes, startMinute, endMinute + 1, true);
5288
- } else if (startHour !== hour && endHour === hour) {
5289
- setRangeData(minutes, 0, endMinute + 1, true);
5290
- } else if (startHour < hour && endHour > hour) {
5291
- setRangeData(minutes, 0, 60, true);
5292
- }
5293
- });
5294
- } else {
5295
- setRangeData(minutes, 0, 60, true);
5296
- }
5297
- return minutes;
5298
- };
5299
-
5300
- const range = function(n) {
5301
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
5302
- return Array.apply(null, {length: n}).map((_, n) => n);
5303
- };
5304
-
5305
- const modifyDate = function(date, y, m, d) {
5306
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
5307
- };
5308
-
5309
- const modifyTime = function(date, h, m, s) {
5310
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
5311
- };
5312
-
5313
- const modifyWithTimeString = (date, time) => {
5314
- if (date == null || !time) {
5315
- return date;
5316
- }
5317
- time = parseDate(time, 'HH:mm:ss');
5318
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
5319
- };
5320
-
5321
- const clearTime = function(date) {
5322
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
5323
- };
5324
-
5325
- const clearMilliseconds = function(date) {
5326
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
5327
- };
5328
-
5329
- const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
5330
- // TODO: refactory a more elegant solution
5331
- if (ranges.length === 0) return date;
5332
- const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
5333
- const ndate = normalizeDate(date);
5334
- const nranges = ranges.map(range => range.map(normalizeDate));
5335
- if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
5336
-
5337
- let minDate = nranges[0][0];
5338
- let maxDate = nranges[0][0];
5339
-
5340
- nranges.forEach(nrange => {
5341
- minDate = new Date(Math.min(nrange[0], minDate));
5342
- maxDate = new Date(Math.max(nrange[1], minDate));
5343
- });
5344
-
5345
- const ret = ndate < minDate ? minDate : maxDate;
5346
- // preserve Year/Month/Date
5347
- return modifyDate(
5348
- ret,
5349
- date.getFullYear(),
5350
- date.getMonth(),
5351
- date.getDate()
5352
- );
5353
- };
5354
-
5355
- const timeWithinRange = function(date, selectableRange, format) {
5356
- const limitedDate = limitTimeRange(date, selectableRange, format);
5357
- return limitedDate.getTime() === date.getTime();
5358
- };
5359
-
5360
- const changeYearMonthAndClampDate = function(date, year, month) {
5361
- // clamp date to the number of days in `year`, `month`
5362
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
5363
- const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
5364
- return modifyDate(date, year, month, monthDate);
5365
- };
5366
-
5367
- const prevMonth = function(date) {
5368
- const year = date.getFullYear();
5369
- const month = date.getMonth();
5370
- return month === 0
5371
- ? changeYearMonthAndClampDate(date, year - 1, 11)
5372
- : changeYearMonthAndClampDate(date, year, month - 1);
5373
- };
5374
-
5375
- const nextMonth = function(date) {
5376
- const year = date.getFullYear();
5377
- const month = date.getMonth();
5378
- return month === 11
5379
- ? changeYearMonthAndClampDate(date, year + 1, 0)
5380
- : changeYearMonthAndClampDate(date, year, month + 1);
5381
- };
5382
-
5383
- const prevYear = function(date, amount = 1) {
5384
- const year = date.getFullYear();
5385
- const month = date.getMonth();
5386
- return changeYearMonthAndClampDate(date, year - amount, month);
5387
- };
5388
-
5389
- const nextYear = function(date, amount = 1) {
5390
- const year = date.getFullYear();
5391
- const month = date.getMonth();
5392
- return changeYearMonthAndClampDate(date, year + amount, month);
5393
- };
5394
-
5395
- const extractDateFormat = function(format) {
5396
- return format
5397
- .replace(/\W?m{1,2}|\W?ZZ/g, '')
5398
- .replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
5399
- .trim();
5400
- };
5401
-
5402
- const extractTimeFormat = function(format) {
5403
- return format
5404
- .replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
5405
- .trim();
5406
- };
5407
-
5408
- const validateRangeInOneMonth = function(start, end) {
5409
- return (start.getMonth() === end.getMonth()) && (start.getFullYear() === end.getFullYear());
5410
- };
5411
-
5412
- /**
5413
- * 计算两个日期之间的工作日数量(不包括周末和节假日)
5414
- * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
5415
- * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
5416
- * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
5417
- * @returns {number} 工作日数量
5418
- */
5419
- const calculateNetworkDays = function (start_date, end_date, holidays = []) {
5420
- if (typeof start_date !== 'string' || typeof end_date !== 'string') {
5421
- throw new Error(
5422
- "Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'."
5423
- );
5424
- }
5425
-
5426
- const startDateObj = new Date(start_date);
5427
- const endDateObj = new Date(end_date);
5428
-
5429
- if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
5430
- throw new Error(
5431
- "Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'."
5432
- );
5433
- }
5434
-
5435
- if (startDateObj > endDateObj) {
5436
- throw new Error('Start date should be earlier than or equal to end date.');
5437
- }
5438
-
5439
- let workdays = 0;
5440
-
5441
- // Iterate through each day in the date range
5442
- for (
5443
- let currentDate = new Date(startDateObj);
5444
- currentDate <= endDateObj;
5445
- currentDate.setDate(currentDate.getDate() + 1)
5446
- ) {
5447
- // Check if the current day is a weekend (Saturday or Sunday)
5448
- const isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
5449
-
5450
- // Check if the current day is a holiday
5451
- const isHoliday = holidays.some((holiday) => {
5452
- const holidayDate = new Date(holiday);
5453
- return currentDate.toDateString() === holidayDate.toDateString();
5454
- });
5455
-
5456
- // If it's a workday (not a weekend or holiday), increment the workdays count
5457
- if (!isWeekend && !isHoliday) {
5458
- workdays++;
5459
- }
5460
- }
5461
-
5462
- return workdays;
5463
- };
5464
-
5465
- /**
5466
- * 日期加减天数
5467
- * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
5468
- * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
5469
- * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
5470
- */
5471
- const dateAddDays = function (start_date, days) {
5472
- if (typeof start_date !== 'string' || !Number.isInteger(days)) {
5473
- throw new Error(
5474
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days."
5475
- );
5476
- }
5477
-
5478
- const startDateObj = new Date(start_date);
5479
- if (isNaN(startDateObj.getTime())) {
5480
- throw new Error(
5481
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
5482
- );
5483
- }
5484
-
5485
- const resultDateObj = new Date(startDateObj);
5486
- resultDateObj.setDate(resultDateObj.getDate() + days);
5487
-
5488
- const resultYear = resultDateObj.getFullYear();
5489
- const resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
5490
- const resultDay = String(resultDateObj.getDate()).padStart(2, '0');
5491
-
5492
- return `${resultYear}-${resultMonth}-${resultDay}`;
5493
- };
5494
-
5495
- /**
5496
- * 计算两个日期之间的差值
5497
- * @date 2023年12月14日
5498
- * @param {String} start_date - 起始日期字符串
5499
- * @param {String} end_date - 结束日期字符串
5500
- * @param {String} unit - 单位:year/month/day
5501
- * @returns {Number} 差值
5502
- */
5503
- const dateDiff = function (start_date, end_date, unit = 'day') {
5504
- // Assuming date strings are in "YYYY-MM-DD" format
5505
- var startDate = new Date(start_date);
5506
- var endDate = new Date(end_date);
5507
-
5508
- // If the date is invalid, return 0
5509
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
5510
- return 0;
5511
- }
5512
-
5513
- if (unit === 'year') {
5514
- return endDate.getFullYear() - startDate.getFullYear();
5515
- } else if (unit === 'month') {
5516
- return (
5517
- (endDate.getFullYear() - startDate.getFullYear()) * 12 +
5518
- (endDate.getMonth() - startDate.getMonth())
5519
- );
5520
- } else {
5521
- // Default to day
5522
- var timeDifference = endDate - startDate;
5523
- // Calculate days (86400000 milliseconds per day)
5524
- return Math.floor(timeDifference / 86400000);
5525
- }
5526
- };
5527
-
5528
- /**
5529
- * 获取月份中的日期
5530
- * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
5531
- * @returns {number} 月份中的日期(1-31)
5532
- */
5533
- const dayOfMonth = function (date) {
5534
- if (typeof date !== 'string') {
5535
- throw new Error(
5536
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'."
5537
- );
5538
- }
5539
-
5540
- const dateObj = new Date(date);
5541
- if (isNaN(dateObj.getTime())) {
5542
- throw new Error(
5543
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
5544
- );
5545
- }
5546
-
5547
- return dateObj.getDate();
5548
- };
5549
-
5550
- /**
5551
- * 获取当前日期
5552
- * @date 2022年5月7日
5553
- * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
5554
- * @returns {string} 当前日期的格式化字符串
5555
- */
5556
- const getCurrentDate = function (format = 'YYYY-MM-DD') {
5557
- return formatDate(new Date(), format);
5558
- };
5559
-
5560
- /**
5561
- * 获取当前日期时间
5562
- * @date 2022年5月7日
5563
- * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
5564
- * @returns {string} 当前日期时间的格式化字符串
5565
- */
5566
- const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
5567
- return formatDate(new Date(), format);
5568
- };
5569
-
5570
- /**
5571
- * 获取小时
5572
- * @date 2022年5月7日
5573
- * @param {Date|string} [date] - 日期对象或日期字符串
5574
- * @returns {number} 小时数(0-23)
5575
- */
5576
- const getHour = function (date) {
5577
- if (!date) {
5578
- return new Date().getHours();
5579
- }
5580
- if (typeof date === 'string') {
5581
- date = new Date(date);
5582
- }
5583
- return date.getHours();
5584
- };
5585
-
5586
- /**
5587
- * 获取分钟
5588
- * @date 2022年5月7日
5589
- * @param {Date|string} [date] - 日期对象或日期字符串
5590
- * @returns {number} 分钟数(0-59)
5591
- */
5592
- const getMinute = function (date) {
5593
- if (!date) {
5594
- return new Date().getMinutes();
5595
- }
5596
- if (typeof date === 'string') {
5597
- date = new Date(date);
5598
- }
5599
- return date.getMinutes();
5600
- };
5601
-
5602
- /**
5603
- * 获取月份
5604
- * @date 2022年5月7日
5605
- * @param {Date|string} [date] - 日期对象或日期字符串
5606
- * @returns {number} 月份数(1-12)
5607
- */
5608
- const getMonth = function (date) {
5609
- if (!date) {
5610
- return new Date().getMonth() + 1;
5611
- }
5612
- if (typeof date === 'string') {
5613
- date = new Date(date);
5614
- }
5615
- return date.getMonth() + 1;
5616
- };
5617
-
5618
- /**
5619
- * 获取秒
5620
- * @date 2022年5月7日
5621
- * @param {Date|string} [date] - 日期对象或日期字符串
5622
- * @returns {number} 秒数(0-59)
5623
- */
5624
- const getSecond = function (date) {
5625
- if (!date) {
5626
- return new Date().getSeconds();
5627
- }
5628
- if (typeof date === 'string') {
5629
- date = new Date(date);
5630
- }
5631
- return date.getSeconds();
5632
- };
5633
-
5634
- /**
5635
- * 获取星期几
5636
- * @date 2022年5月7日
5637
- * @param {Date|string} [date] - 日期对象或日期字符串
5638
- * @returns {number} 星期几(0-6,0表示星期日)
5639
- */
5640
- const getWeekday = function (date) {
5641
- if (!date) {
5642
- return new Date().getDay();
5643
- }
5644
- if (typeof date === 'string') {
5645
- date = new Date(date);
5646
- }
5647
- return date.getDay();
5648
- };
5649
-
5650
-
5651
- /**
5652
- * @desc 获取上午/下午/晚上
5653
- * @author huangbo
5654
- * @date 2022年5月7日
5655
- * @param {String} [time] - 时间
5656
- **/
5657
- const timeCycle = function (time) {
5658
- let hour = 0;
5659
- if (!time) {
5660
- hour = new Date().getHours();
5661
- } else if (typeof time === 'string') {
5662
- // 从时间字符串中提取小时
5663
- const match = time.match(/^(\d{1,2})/);
5664
- if (match) {
5665
- hour = parseInt(match[1], 10);
5666
- }
5667
- } else if (typeof time === 'number') {
5668
- hour = time;
5669
- }
5670
- // 判断时间段
5671
- if (hour >= 5 && hour < 12) {
5672
- return '上午';
5673
- } else if (hour >= 12 && hour < 18) {
5674
- return '下午';
5675
- } else {
5676
- return '晚上';
5677
- }
5678
- };
5679
-
5680
- /***/ }),
4899
+ */
4900
+ fecha.parse = function (dateStr, format) {
4901
+ if (typeof format !== 'string') {
4902
+ throw new Error('Invalid format in fecha.parse');
4903
+ }
5681
4904
 
5682
- /***/ 70:
5683
- /***/ (function(module, exports) {
4905
+ format = fecha.masks[format] || format;
5684
4906
 
5685
- module.exports = require("eoss/lib/cascader");
4907
+ // Avoid regular expression denial of service, fail early for really long strings
4908
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
4909
+ if (dateStr.length > 1000) {
4910
+ return null;
4911
+ }
4912
+
4913
+ var dateInfo = {};
4914
+ var parseInfo = [];
4915
+ var literals = [];
4916
+ format = format.replace(literal, function ($0, $1) {
4917
+ literals.push($1);
4918
+ return '@@@';
4919
+ });
4920
+ var newFormat = regexEscape(format).replace(token, function ($0) {
4921
+ if (parseFlags[$0]) {
4922
+ var info = parseFlags[$0];
4923
+ parseInfo.push(info[1]);
4924
+ return '(' + info[0] + ')';
4925
+ }
4926
+
4927
+ return $0;
4928
+ });
4929
+ newFormat = newFormat.replace(/@@@/g, function () {
4930
+ return literals.shift();
4931
+ });
4932
+ var matches = dateStr.match(new RegExp(newFormat, 'i'));
4933
+ if (!matches) {
4934
+ return null;
4935
+ }
4936
+
4937
+ for (var i = 1; i < matches.length; i++) {
4938
+ parseInfo[i - 1](dateInfo, matches[i]);
4939
+ }
4940
+
4941
+ var today = new Date();
4942
+ if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
4943
+ dateInfo.hour = +dateInfo.hour + 12;
4944
+ } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
4945
+ dateInfo.hour = 0;
4946
+ }
4947
+
4948
+ var date = void 0;
4949
+ if (dateInfo.timezoneOffset != null) {
4950
+ dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
4951
+ 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));
4952
+ } else {
4953
+ 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);
4954
+ }
4955
+ return date;
4956
+ };
4957
+
4958
+ // 导出fecha对象
4959
+
4960
+
4961
+ // 以下是从date-util.js合并的函数
4962
+ var newArray = function newArray(start, end) {
4963
+ var result = [];
4964
+ for (var i = start; i <= end; i++) {
4965
+ result.push(i);
4966
+ }
4967
+ return result;
4968
+ };
4969
+
4970
+ var getSettings = function getSettings() {
4971
+ return {
4972
+ dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
4973
+ dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
4974
+ monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
4975
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
4976
+ amPm: ['上午', '下午']
4977
+ };
4978
+ };
4979
+
4980
+ var toDate = function toDate(date) {
4981
+ return isDate(date) ? new Date(date) : null;
4982
+ };
4983
+
4984
+ var isDate = function isDate(date) {
4985
+ if (date === null || date === undefined) return false;
4986
+ if (isNaN(new Date(date).getTime())) return false;
4987
+ if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
4988
+ return true;
4989
+ };
4990
+
4991
+ var isDateObject = function isDateObject(val) {
4992
+ return val instanceof Date;
4993
+ };
4994
+
4995
+ var formatDate = function formatDate(date) {
4996
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
4997
+
4998
+ // 处理多种输入类型
4999
+ if (!date) return '';
5000
+
5001
+ // 如果是时间戳,转成日期对象
5002
+ if (typeof date === 'number') {
5003
+ date = new Date(date);
5004
+ }
5005
+ // 如果是字符串,转成日期对象
5006
+ if (typeof date === 'string') {
5007
+ date = new Date(date);
5008
+ }
5009
+
5010
+ // 调用toDate进一步验证和转换
5011
+ date = toDate(date);
5012
+ if (!date) return '';
5013
+
5014
+ // 兼容大写和小写的格式标记
5015
+ // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
5016
+ var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
5017
+
5018
+ // 使用fecha库进行格式化,支持中文配置
5019
+ var str = fecha.format(date, lowercaseFormat, getSettings());
5020
+ return str;
5021
+ };
5022
+
5023
+ var parseDate = function parseDate(string, format) {
5024
+ return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
5025
+ };
5026
+
5027
+ var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
5028
+ if (month === 3 || month === 5 || month === 8 || month === 10) {
5029
+ return 30;
5030
+ }
5031
+
5032
+ if (month === 1) {
5033
+ if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
5034
+ return 29;
5035
+ } else {
5036
+ return 28;
5037
+ }
5038
+ }
5039
+
5040
+ return 31;
5041
+ };
5042
+
5043
+ var getDayCountOfYear = function getDayCountOfYear(year) {
5044
+ var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
5045
+ return isLeapYear ? 366 : 365;
5046
+ };
5047
+
5048
+ var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
5049
+ var temp = new Date(date.getTime());
5050
+ temp.setDate(1);
5051
+ return temp.getDay();
5052
+ };
5053
+
5054
+ // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
5055
+ // {prev, next} Date should work for Daylight Saving Time
5056
+ // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
5057
+ var prevDate = function prevDate(date) {
5058
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5059
+
5060
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
5061
+ };
5062
+
5063
+ var nextDate = function nextDate(date) {
5064
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5065
+
5066
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
5067
+ };
5068
+
5069
+ var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
5070
+ var result = new Date(year, month, 1);
5071
+ var day = result.getDay();
5072
+
5073
+ if (day === 0) {
5074
+ return prevDate(result, 7);
5075
+ } else {
5076
+ return prevDate(result, day);
5077
+ }
5078
+ };
5079
+
5080
+ var getWeekNumber = function getWeekNumber(date) {
5081
+ // 支持多种输入类型
5082
+ if (!date || !isDate(date)) {
5083
+ date = new Date();
5084
+ }
5085
+ if (typeof date === 'string') {
5086
+ date = new Date(date);
5087
+ }
5088
+
5089
+ // 验证日期有效性
5090
+ if (!isDate(date)) return null;
5091
+
5092
+ var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
5093
+ // 设置为最近的星期四:当前日期 + 4 - 当前星期数
5094
+ // 将星期日的星期数设为7
5095
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
5096
+ // 获取当年的第一天
5097
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
5098
+ // 计算到最近的星期四的完整周数
5099
+ var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
5100
+ // 返回周数
5101
+ return weekNo;
5102
+ };
5103
+
5104
+ var getRangeHours = function getRangeHours(ranges) {
5105
+ var hours = [];
5106
+ var disabledHours = [];
5107
+
5108
+ (ranges || []).forEach(function (range) {
5109
+ var value = range.map(function (date) {
5110
+ return date.getHours();
5111
+ });
5112
+
5113
+ disabledHours = disabledHours.concat(newArray(value[0], value[1]));
5114
+ });
5115
+
5116
+ if (disabledHours.length) {
5117
+ for (var i = 0; i < 24; i++) {
5118
+ hours[i] = disabledHours.indexOf(i) === -1;
5119
+ }
5120
+ } else {
5121
+ for (var _i = 0; _i < 24; _i++) {
5122
+ hours[_i] = false;
5123
+ }
5124
+ }
5125
+
5126
+ return hours;
5127
+ };
5128
+
5129
+ var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
5130
+ if (amount <= 0) return [];
5131
+ var temp = new Date(date.getTime());
5132
+ temp.setDate(0);
5133
+ var lastDay = temp.getDate();
5134
+ return range(amount).map(function (_, index) {
5135
+ return lastDay - (amount - index - 1);
5136
+ });
5137
+ };
5138
+
5139
+ var getMonthDays = function getMonthDays(date) {
5140
+ var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
5141
+ var days = temp.getDate();
5142
+ return range(days).map(function (_, index) {
5143
+ return index + 1;
5144
+ });
5145
+ };
5146
+
5147
+ function setRangeData(arr, start, end, value) {
5148
+ for (var i = start; i < end; i++) {
5149
+ arr[i] = value;
5150
+ }
5151
+ }
5152
+
5153
+ var getRangeMinutes = function getRangeMinutes(ranges, hour) {
5154
+ var minutes = new Array(60);
5155
+
5156
+ if (ranges.length > 0) {
5157
+ ranges.forEach(function (range) {
5158
+ var start = range[0];
5159
+ var end = range[1];
5160
+ var startHour = start.getHours();
5161
+ var startMinute = start.getMinutes();
5162
+ var endHour = end.getHours();
5163
+ var endMinute = end.getMinutes();
5164
+ if (startHour === hour && endHour !== hour) {
5165
+ setRangeData(minutes, startMinute, 60, true);
5166
+ } else if (startHour === hour && endHour === hour) {
5167
+ setRangeData(minutes, startMinute, endMinute + 1, true);
5168
+ } else if (startHour !== hour && endHour === hour) {
5169
+ setRangeData(minutes, 0, endMinute + 1, true);
5170
+ } else if (startHour < hour && endHour > hour) {
5171
+ setRangeData(minutes, 0, 60, true);
5172
+ }
5173
+ });
5174
+ } else {
5175
+ setRangeData(minutes, 0, 60, true);
5176
+ }
5177
+ return minutes;
5178
+ };
5179
+
5180
+ var range = function range(n) {
5181
+ // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
5182
+ return Array.apply(null, { length: n }).map(function (_, n) {
5183
+ return n;
5184
+ });
5185
+ };
5186
+
5187
+ var modifyDate = function modifyDate(date, y, m, d) {
5188
+ return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
5189
+ };
5190
+
5191
+ var modifyTime = function modifyTime(date, h, m, s) {
5192
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
5193
+ };
5194
+
5195
+ var modifyWithTimeString = function modifyWithTimeString(date, time) {
5196
+ if (date == null || !time) {
5197
+ return date;
5198
+ }
5199
+ time = parseDate(time, 'HH:mm:ss');
5200
+ return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
5201
+ };
5202
+
5203
+ var clearTime = function clearTime(date) {
5204
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
5205
+ };
5206
+
5207
+ var clearMilliseconds = function clearMilliseconds(date) {
5208
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
5209
+ };
5210
+
5211
+ var limitTimeRange = function limitTimeRange(date, ranges) {
5212
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
5213
+
5214
+ // TODO: refactory a more elegant solution
5215
+ if (ranges.length === 0) return date;
5216
+ var normalizeDate = function normalizeDate(date) {
5217
+ return fecha.parse(fecha.format(date, format), format);
5218
+ };
5219
+ var ndate = normalizeDate(date);
5220
+ var nranges = ranges.map(function (range) {
5221
+ return range.map(normalizeDate);
5222
+ });
5223
+ if (nranges.some(function (nrange) {
5224
+ return ndate >= nrange[0] && ndate <= nrange[1];
5225
+ })) return date;
5226
+
5227
+ var minDate = nranges[0][0];
5228
+ var maxDate = nranges[0][0];
5229
+
5230
+ nranges.forEach(function (nrange) {
5231
+ minDate = new Date(Math.min(nrange[0], minDate));
5232
+ maxDate = new Date(Math.max(nrange[1], minDate));
5233
+ });
5234
+
5235
+ var ret = ndate < minDate ? minDate : maxDate;
5236
+ // preserve Year/Month/Date
5237
+ return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
5238
+ };
5239
+
5240
+ var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
5241
+ var limitedDate = limitTimeRange(date, selectableRange, format);
5242
+ return limitedDate.getTime() === date.getTime();
5243
+ };
5244
+
5245
+ var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
5246
+ // clamp date to the number of days in `year`, `month`
5247
+ // eg: (2010-1-31, 2010, 2) => 2010-2-28
5248
+ var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
5249
+ return modifyDate(date, year, month, monthDate);
5250
+ };
5251
+
5252
+ var prevMonth = function prevMonth(date) {
5253
+ var year = date.getFullYear();
5254
+ var month = date.getMonth();
5255
+ return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
5256
+ };
5257
+
5258
+ var nextMonth = function nextMonth(date) {
5259
+ var year = date.getFullYear();
5260
+ var month = date.getMonth();
5261
+ return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
5262
+ };
5263
+
5264
+ var prevYear = function prevYear(date) {
5265
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5266
+
5267
+ var year = date.getFullYear();
5268
+ var month = date.getMonth();
5269
+ return changeYearMonthAndClampDate(date, year - amount, month);
5270
+ };
5271
+
5272
+ var nextYear = function nextYear(date) {
5273
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5274
+
5275
+ var year = date.getFullYear();
5276
+ var month = date.getMonth();
5277
+ return changeYearMonthAndClampDate(date, year + amount, month);
5278
+ };
5279
+
5280
+ var extractDateFormat = function extractDateFormat(format) {
5281
+ return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
5282
+ };
5283
+
5284
+ var extractTimeFormat = function extractTimeFormat(format) {
5285
+ return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
5286
+ };
5287
+
5288
+ var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
5289
+ return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
5290
+ };
5291
+
5292
+ /**
5293
+ * 计算两个日期之间的工作日数量(不包括周末和节假日)
5294
+ * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
5295
+ * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
5296
+ * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
5297
+ * @returns {number} 工作日数量
5298
+ */
5299
+ var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
5300
+ var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
5301
+
5302
+ if (typeof start_date !== 'string' || typeof end_date !== 'string') {
5303
+ throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
5304
+ }
5305
+
5306
+ var startDateObj = new Date(start_date);
5307
+ var endDateObj = new Date(end_date);
5308
+
5309
+ if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
5310
+ throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
5311
+ }
5312
+
5313
+ if (startDateObj > endDateObj) {
5314
+ throw new Error('Start date should be earlier than or equal to end date.');
5315
+ }
5316
+
5317
+ var workdays = 0;
5318
+
5319
+ // Iterate through each day in the date range
5320
+
5321
+ var _loop = function _loop(currentDate) {
5322
+ // Check if the current day is a weekend (Saturday or Sunday)
5323
+ var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
5324
+
5325
+ // Check if the current day is a holiday
5326
+ var isHoliday = holidays.some(function (holiday) {
5327
+ var holidayDate = new Date(holiday);
5328
+ return currentDate.toDateString() === holidayDate.toDateString();
5329
+ });
5330
+
5331
+ // If it's a workday (not a weekend or holiday), increment the workdays count
5332
+ if (!isWeekend && !isHoliday) {
5333
+ workdays++;
5334
+ }
5335
+ };
5336
+
5337
+ for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
5338
+ _loop(currentDate);
5339
+ }
5340
+
5341
+ return workdays;
5342
+ };
5343
+
5344
+ /**
5345
+ * 日期加减天数
5346
+ * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
5347
+ * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
5348
+ * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
5349
+ */
5350
+ var dateAddDays = function dateAddDays(start_date, days) {
5351
+ if (typeof start_date !== 'string' || !Number.isInteger(days)) {
5352
+ 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.");
5353
+ }
5354
+
5355
+ var startDateObj = new Date(start_date);
5356
+ if (isNaN(startDateObj.getTime())) {
5357
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5358
+ }
5359
+
5360
+ var resultDateObj = new Date(startDateObj);
5361
+ resultDateObj.setDate(resultDateObj.getDate() + days);
5362
+
5363
+ var resultYear = resultDateObj.getFullYear();
5364
+ var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
5365
+ var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
5366
+
5367
+ return resultYear + '-' + resultMonth + '-' + resultDay;
5368
+ };
5369
+
5370
+ /**
5371
+ * 计算两个日期之间的差值
5372
+ * @date 2023年12月14日
5373
+ * @param {String} start_date - 起始日期字符串
5374
+ * @param {String} end_date - 结束日期字符串
5375
+ * @param {String} unit - 单位:year/month/day
5376
+ * @returns {Number} 差值
5377
+ */
5378
+ var dateDiff = function dateDiff(start_date, end_date) {
5379
+ var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
5380
+
5381
+ // Assuming date strings are in "YYYY-MM-DD" format
5382
+ var startDate = new Date(start_date);
5383
+ var endDate = new Date(end_date);
5384
+
5385
+ // If the date is invalid, return 0
5386
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
5387
+ return 0;
5388
+ }
5389
+
5390
+ if (unit === 'year') {
5391
+ return endDate.getFullYear() - startDate.getFullYear();
5392
+ } else if (unit === 'month') {
5393
+ return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
5394
+ } else {
5395
+ // Default to day
5396
+ var timeDifference = endDate - startDate;
5397
+ // Calculate days (86400000 milliseconds per day)
5398
+ return Math.floor(timeDifference / 86400000);
5399
+ }
5400
+ };
5401
+
5402
+ /**
5403
+ * 获取月份中的日期
5404
+ * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
5405
+ * @returns {number} 月份中的日期(1-31)
5406
+ */
5407
+ var dayOfMonth = function dayOfMonth(date) {
5408
+ if (typeof date !== 'string') {
5409
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5410
+ }
5411
+
5412
+ var dateObj = new Date(date);
5413
+ if (isNaN(dateObj.getTime())) {
5414
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5415
+ }
5416
+
5417
+ return dateObj.getDate();
5418
+ };
5419
+
5420
+ /**
5421
+ * 获取当前日期
5422
+ * @date 2022年5月7日
5423
+ * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
5424
+ * @returns {string} 当前日期的格式化字符串
5425
+ */
5426
+ var getCurrentDate = function getCurrentDate() {
5427
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
5428
+
5429
+ return formatDate(new Date(), format);
5430
+ };
5431
+
5432
+ /**
5433
+ * 获取当前日期时间
5434
+ * @date 2022年5月7日
5435
+ * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
5436
+ * @returns {string} 当前日期时间的格式化字符串
5437
+ */
5438
+ var getCurrentDateTime = function getCurrentDateTime() {
5439
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
5440
+
5441
+ return formatDate(new Date(), format);
5442
+ };
5443
+
5444
+ /**
5445
+ * 获取小时
5446
+ * @date 2022年5月7日
5447
+ * @param {Date|string} [date] - 日期对象或日期字符串
5448
+ * @returns {number} 小时数(0-23)
5449
+ */
5450
+ var getHour = function getHour(date) {
5451
+ if (!date) {
5452
+ return new Date().getHours();
5453
+ }
5454
+ if (typeof date === 'string') {
5455
+ date = new Date(date);
5456
+ }
5457
+ return date.getHours();
5458
+ };
5459
+
5460
+ /**
5461
+ * 获取分钟
5462
+ * @date 2022年5月7日
5463
+ * @param {Date|string} [date] - 日期对象或日期字符串
5464
+ * @returns {number} 分钟数(0-59)
5465
+ */
5466
+ var getMinute = function getMinute(date) {
5467
+ if (!date) {
5468
+ return new Date().getMinutes();
5469
+ }
5470
+ if (typeof date === 'string') {
5471
+ date = new Date(date);
5472
+ }
5473
+ return date.getMinutes();
5474
+ };
5475
+
5476
+ /**
5477
+ * 获取月份
5478
+ * @date 2022年5月7日
5479
+ * @param {Date|string} [date] - 日期对象或日期字符串
5480
+ * @returns {number} 月份数(1-12)
5481
+ */
5482
+ var getMonth = function getMonth(date) {
5483
+ if (!date) {
5484
+ return new Date().getMonth() + 1;
5485
+ }
5486
+ if (typeof date === 'string') {
5487
+ date = new Date(date);
5488
+ }
5489
+ return date.getMonth() + 1;
5490
+ };
5491
+
5492
+ /**
5493
+ * 获取秒
5494
+ * @date 2022年5月7日
5495
+ * @param {Date|string} [date] - 日期对象或日期字符串
5496
+ * @returns {number} 秒数(0-59)
5497
+ */
5498
+ var getSecond = function getSecond(date) {
5499
+ if (!date) {
5500
+ return new Date().getSeconds();
5501
+ }
5502
+ if (typeof date === 'string') {
5503
+ date = new Date(date);
5504
+ }
5505
+ return date.getSeconds();
5506
+ };
5507
+
5508
+ /**
5509
+ * 获取星期几
5510
+ * @date 2022年5月7日
5511
+ * @param {Date|string} [date] - 日期对象或日期字符串
5512
+ * @returns {number} 星期几(0-6,0表示星期日)
5513
+ */
5514
+ var getWeekday = function getWeekday(date) {
5515
+ if (!date) {
5516
+ return new Date().getDay();
5517
+ }
5518
+ if (typeof date === 'string') {
5519
+ date = new Date(date);
5520
+ }
5521
+ return date.getDay();
5522
+ };
5523
+
5524
+ /**
5525
+ * @desc 获取上午/下午/晚上
5526
+ * @author huangbo
5527
+ * @date 2022年5月7日
5528
+ * @param {String} [time] - 时间
5529
+ **/
5530
+ var timeCycle = function timeCycle(time) {
5531
+ var hour = 0;
5532
+ if (!time) {
5533
+ hour = new Date().getHours();
5534
+ } else if (typeof time === 'string') {
5535
+ // 从时间字符串中提取小时
5536
+ var match = time.match(/^(\d{1,2})/);
5537
+ if (match) {
5538
+ hour = parseInt(match[1], 10);
5539
+ }
5540
+ } else if (typeof time === 'number') {
5541
+ hour = time;
5542
+ }
5543
+ // 判断时间段
5544
+ if (hour >= 5 && hour < 12) {
5545
+ return '上午';
5546
+ } else if (hour >= 12 && hour < 18) {
5547
+ return '下午';
5548
+ } else {
5549
+ return '晚上';
5550
+ }
5551
+ };
5552
+
5553
+ /***/ }),
5554
+
5555
+ /***/ 70:
5556
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
5557
+
5558
+ "use strict";
5559
+ /* harmony import */ var eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
5560
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5561
+
5562
+
5563
+
5564
+ var Transition = function () {
5565
+ function Transition() {
5566
+ _classCallCheck(this, Transition);
5567
+ }
5568
+
5569
+ Transition.prototype.beforeEnter = function beforeEnter(el) {
5570
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
5571
+ if (!el.dataset) el.dataset = {};
5572
+ if (el.dataset.state === 6 || !el.dataset.state) {
5573
+ el.dataset.oldPaddingTop = el.style.paddingTop;
5574
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
5575
+ }
5576
+ el.dataset.state = 1;
5577
+
5578
+ el.style.height = '0';
5579
+ el.style.paddingTop = 0;
5580
+ el.style.paddingBottom = 0;
5581
+ };
5582
+
5583
+ Transition.prototype.enter = function enter(el) {
5584
+ el.dataset.oldOverflow = el.style.overflow;
5585
+ if (el.scrollHeight !== 0) {
5586
+ el.style.height = el.scrollHeight + 'px';
5587
+ el.style.paddingTop = el.dataset.oldPaddingTop;
5588
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
5589
+ } else {
5590
+ el.style.height = '';
5591
+ el.style.paddingTop = el.dataset.oldPaddingTop;
5592
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
5593
+ }
5594
+
5595
+ el.dataset.state = 2;
5596
+ el.style.overflow = 'hidden';
5597
+ };
5598
+
5599
+ Transition.prototype.afterEnter = function afterEnter(el) {
5600
+ // for safari: remove class then reset height is necessary
5601
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
5602
+ el.style.height = '';
5603
+ el.style.overflow = el.dataset.oldOverflow;
5604
+ el.dataset.state = 3;
5605
+ };
5606
+
5607
+ Transition.prototype.beforeLeave = function beforeLeave(el) {
5608
+ if (!el.dataset) el.dataset = {};
5609
+ el.dataset.oldPaddingTop = el.style.paddingTop;
5610
+ el.dataset.oldPaddingBottom = el.style.paddingBottom;
5611
+ el.dataset.oldOverflow = el.style.overflow;
5612
+ el.dataset.state = 4;
5613
+
5614
+ el.style.height = el.scrollHeight + 'px';
5615
+ el.style.overflow = 'hidden';
5616
+ };
5617
+
5618
+ Transition.prototype.leave = function leave(el) {
5619
+ if (el.scrollHeight !== 0) {
5620
+ // for safari: add class after set height, or it will jump to zero height suddenly, weired
5621
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* addClass */ "a"])(el, 'collapse-transition');
5622
+ el.style.height = 0;
5623
+ el.style.paddingTop = 0;
5624
+ el.style.paddingBottom = 0;
5625
+ el.dataset.state = 5;
5626
+ }
5627
+ };
5628
+
5629
+ Transition.prototype.afterLeave = function afterLeave(el) {
5630
+ Object(eoss_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__[/* removeClass */ "i"])(el, 'collapse-transition');
5631
+ el.style.height = '';
5632
+ el.style.overflow = el.dataset.oldOverflow;
5633
+ el.style.paddingTop = el.dataset.oldPaddingTop;
5634
+ el.style.paddingBottom = el.dataset.oldPaddingBottom;
5635
+ el.dataset.state = 6;
5636
+ };
5637
+
5638
+ return Transition;
5639
+ }();
5640
+
5641
+ /* harmony default export */ __webpack_exports__["a"] = ({
5642
+ name: 'EsCollapseTransition',
5643
+ functional: true,
5644
+ render: function render(h, _ref) {
5645
+ var children = _ref.children;
5646
+
5647
+ var data = {
5648
+ on: new Transition()
5649
+ };
5650
+
5651
+ return h('transition', data, children);
5652
+ }
5653
+ });
5686
5654
 
5687
5655
  /***/ }),
5688
5656
 
5689
5657
  /***/ 71:
5690
5658
  /***/ (function(module, exports) {
5691
5659
 
5692
- module.exports = require("eoss/lib/date-picker");
5660
+ module.exports = require("eoss/lib/cascader");
5693
5661
 
5694
5662
  /***/ }),
5695
5663
 
5696
5664
  /***/ 72:
5697
5665
  /***/ (function(module, exports) {
5698
5666
 
5699
- module.exports = require("eoss/lib/time-picker");
5667
+ module.exports = require("eoss/lib/date-picker");
5700
5668
 
5701
5669
  /***/ }),
5702
5670
 
5703
5671
  /***/ 73:
5704
5672
  /***/ (function(module, exports) {
5705
5673
 
5706
- module.exports = require("eoss/lib/time-select");
5674
+ module.exports = require("eoss/lib/time-picker");
5707
5675
 
5708
5676
  /***/ }),
5709
5677
 
5710
5678
  /***/ 74:
5711
5679
  /***/ (function(module, exports) {
5712
5680
 
5713
- module.exports = require("eoss/lib/rate");
5681
+ module.exports = require("eoss/lib/time-select");
5714
5682
 
5715
5683
  /***/ }),
5716
5684
 
5717
5685
  /***/ 75:
5718
5686
  /***/ (function(module, exports) {
5719
5687
 
5720
- module.exports = require("eoss/lib/slider");
5688
+ module.exports = require("eoss/lib/rate");
5721
5689
 
5722
5690
  /***/ }),
5723
5691
 
5724
5692
  /***/ 76:
5725
5693
  /***/ (function(module, exports) {
5726
5694
 
5727
- module.exports = require("eoss/lib/transfer");
5695
+ module.exports = require("eoss/lib/slider");
5728
5696
 
5729
5697
  /***/ }),
5730
5698
 
5731
5699
  /***/ 77:
5700
+ /***/ (function(module, exports) {
5701
+
5702
+ module.exports = require("eoss/lib/transfer");
5703
+
5704
+ /***/ }),
5705
+
5706
+ /***/ 78:
5732
5707
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5733
5708
 
5734
5709
  "use strict";
@@ -5780,7 +5755,7 @@ render._withStripped = true
5780
5755
  // CONCATENATED MODULE: ./src/components/field-render.vue?vue&type=template&id=0751ef51&
5781
5756
 
5782
5757
  // EXTERNAL MODULE: external "eoss/lib/input-number"
5783
- var input_number_ = __webpack_require__(54);
5758
+ var input_number_ = __webpack_require__(56);
5784
5759
  var input_number_default = /*#__PURE__*/__webpack_require__.n(input_number_);
5785
5760
 
5786
5761
  // EXTERNAL MODULE: external "eoss/lib/radio-group"
@@ -5796,11 +5771,11 @@ var select_ = __webpack_require__(41);
5796
5771
  var select_default = /*#__PURE__*/__webpack_require__.n(select_);
5797
5772
 
5798
5773
  // EXTERNAL MODULE: external "eoss/lib/cascader"
5799
- var cascader_ = __webpack_require__(70);
5774
+ var cascader_ = __webpack_require__(71);
5800
5775
  var cascader_default = /*#__PURE__*/__webpack_require__.n(cascader_);
5801
5776
 
5802
5777
  // EXTERNAL MODULE: external "eoss/lib/switch"
5803
- var switch_ = __webpack_require__(64);
5778
+ var switch_ = __webpack_require__(65);
5804
5779
  var switch_default = /*#__PURE__*/__webpack_require__.n(switch_);
5805
5780
 
5806
5781
  // EXTERNAL MODULE: external "eoss/lib/input"
@@ -5808,39 +5783,39 @@ var input_ = __webpack_require__(14);
5808
5783
  var input_default = /*#__PURE__*/__webpack_require__.n(input_);
5809
5784
 
5810
5785
  // EXTERNAL MODULE: external "eoss/lib/date-picker"
5811
- var date_picker_ = __webpack_require__(71);
5786
+ var date_picker_ = __webpack_require__(72);
5812
5787
  var date_picker_default = /*#__PURE__*/__webpack_require__.n(date_picker_);
5813
5788
 
5814
5789
  // EXTERNAL MODULE: external "eoss/lib/time-picker"
5815
- var time_picker_ = __webpack_require__(72);
5790
+ var time_picker_ = __webpack_require__(73);
5816
5791
  var time_picker_default = /*#__PURE__*/__webpack_require__.n(time_picker_);
5817
5792
 
5818
5793
  // EXTERNAL MODULE: external "eoss/lib/time-select"
5819
- var time_select_ = __webpack_require__(73);
5794
+ var time_select_ = __webpack_require__(74);
5820
5795
  var time_select_default = /*#__PURE__*/__webpack_require__.n(time_select_);
5821
5796
 
5822
5797
  // EXTERNAL MODULE: external "eoss/lib/upload"
5823
- var upload_ = __webpack_require__(49);
5798
+ var upload_ = __webpack_require__(50);
5824
5799
  var upload_default = /*#__PURE__*/__webpack_require__.n(upload_);
5825
5800
 
5826
5801
  // EXTERNAL MODULE: external "eoss/lib/rate"
5827
- var rate_ = __webpack_require__(74);
5802
+ var rate_ = __webpack_require__(75);
5828
5803
  var rate_default = /*#__PURE__*/__webpack_require__.n(rate_);
5829
5804
 
5830
5805
  // EXTERNAL MODULE: external "eoss/lib/slider"
5831
- var slider_ = __webpack_require__(75);
5806
+ var slider_ = __webpack_require__(76);
5832
5807
  var slider_default = /*#__PURE__*/__webpack_require__.n(slider_);
5833
5808
 
5834
5809
  // EXTERNAL MODULE: external "eoss/lib/color-picker"
5835
- var color_picker_ = __webpack_require__(65);
5810
+ var color_picker_ = __webpack_require__(66);
5836
5811
  var color_picker_default = /*#__PURE__*/__webpack_require__.n(color_picker_);
5837
5812
 
5838
5813
  // EXTERNAL MODULE: external "eoss/lib/transfer"
5839
- var transfer_ = __webpack_require__(76);
5814
+ var transfer_ = __webpack_require__(77);
5840
5815
  var transfer_default = /*#__PURE__*/__webpack_require__.n(transfer_);
5841
5816
 
5842
5817
  // EXTERNAL MODULE: external "eoss/lib/tree"
5843
- var tree_ = __webpack_require__(50);
5818
+ var tree_ = __webpack_require__(51);
5844
5819
  var tree_default = /*#__PURE__*/__webpack_require__.n(tree_);
5845
5820
 
5846
5821
  // EXTERNAL MODULE: external "eoss/lib/button"
@@ -5972,7 +5947,7 @@ var CLASS_INLINE_MAP = {
5972
5947
  EsCascader: cascader_default.a,
5973
5948
  // 异步加载:断开 form → field-render → selector → selector-panel → form 的循环依赖
5974
5949
  EsSelector: function EsSelector() {
5975
- return Promise.resolve(/* import() */).then(__webpack_require__.t.bind(null, 66, 7));
5950
+ return Promise.resolve(/* import() */).then(__webpack_require__.t.bind(null, 67, 7));
5976
5951
  },
5977
5952
  EsSwitch: switch_default.a,
5978
5953
  EsInput: input_default.a,