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/flow.js CHANGED
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 182);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 189);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -4668,7 +4668,7 @@ var getRgb = function getRgb($color) {
4668
4668
 
4669
4669
  /***/ }),
4670
4670
 
4671
- /***/ 125:
4671
+ /***/ 129:
4672
4672
  /***/ (function(module, exports) {
4673
4673
 
4674
4674
  module.exports = require("eoss/lib/table-column");
@@ -4710,7 +4710,7 @@ module.exports = require("lodash/set");
4710
4710
 
4711
4711
  /***/ }),
4712
4712
 
4713
- /***/ 182:
4713
+ /***/ 189:
4714
4714
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4715
4715
 
4716
4716
  "use strict";
@@ -8200,11 +8200,11 @@ var button_ = __webpack_require__(13);
8200
8200
  var button_default = /*#__PURE__*/__webpack_require__.n(button_);
8201
8201
 
8202
8202
  // EXTERNAL MODULE: external "eoss/lib/table"
8203
- var table_ = __webpack_require__(92);
8203
+ var table_ = __webpack_require__(94);
8204
8204
  var table_default = /*#__PURE__*/__webpack_require__.n(table_);
8205
8205
 
8206
8206
  // EXTERNAL MODULE: external "eoss/lib/table-column"
8207
- var table_column_ = __webpack_require__(125);
8207
+ var table_column_ = __webpack_require__(129);
8208
8208
  var table_column_default = /*#__PURE__*/__webpack_require__.n(table_column_);
8209
8209
 
8210
8210
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/flow/src/table.vue?vue&type=script&lang=js&
@@ -8620,7 +8620,7 @@ var dialog_ = __webpack_require__(37);
8620
8620
  var dialog_default = /*#__PURE__*/__webpack_require__.n(dialog_);
8621
8621
 
8622
8622
  // EXTERNAL MODULE: external "eoss/lib/option"
8623
- var option_ = __webpack_require__(51);
8623
+ var option_ = __webpack_require__(52);
8624
8624
  var option_default = /*#__PURE__*/__webpack_require__.n(option_);
8625
8625
 
8626
8626
  // EXTERNAL MODULE: external "eoss/lib/select"
@@ -8628,7 +8628,7 @@ var select_ = __webpack_require__(41);
8628
8628
  var select_default = /*#__PURE__*/__webpack_require__.n(select_);
8629
8629
 
8630
8630
  // EXTERNAL MODULE: external "eoss/lib/tag"
8631
- var tag_ = __webpack_require__(68);
8631
+ var tag_ = __webpack_require__(69);
8632
8632
  var tag_default = /*#__PURE__*/__webpack_require__.n(tag_);
8633
8633
 
8634
8634
  // EXTERNAL MODULE: external "eoss/lib/tooltip"
@@ -10050,11 +10050,11 @@ var checkbox_group_ = __webpack_require__(40);
10050
10050
  var checkbox_group_default = /*#__PURE__*/__webpack_require__.n(checkbox_group_);
10051
10051
 
10052
10052
  // EXTERNAL MODULE: external "eoss/lib/radio"
10053
- var radio_ = __webpack_require__(48);
10053
+ var radio_ = __webpack_require__(49);
10054
10054
  var radio_default = /*#__PURE__*/__webpack_require__.n(radio_);
10055
10055
 
10056
10056
  // EXTERNAL MODULE: external "eoss/lib/selector"
10057
- var selector_ = __webpack_require__(66);
10057
+ var selector_ = __webpack_require__(67);
10058
10058
  var selector_default = /*#__PURE__*/__webpack_require__.n(selector_);
10059
10059
 
10060
10060
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/flow/src/selectUser.vue?vue&type=script&lang=js&
@@ -10736,11 +10736,11 @@ CustomPresetvue_type_template_id_a077d4d4_render._withStripped = true
10736
10736
  // CONCATENATED MODULE: ./packages/flow/src/component/CustomPreset.vue?vue&type=template&id=a077d4d4&
10737
10737
 
10738
10738
  // EXTERNAL MODULE: external "eoss/lib/collapse"
10739
- var collapse_ = __webpack_require__(78);
10739
+ var collapse_ = __webpack_require__(79);
10740
10740
  var collapse_default = /*#__PURE__*/__webpack_require__.n(collapse_);
10741
10741
 
10742
10742
  // EXTERNAL MODULE: external "eoss/lib/collapse-item"
10743
- var collapse_item_ = __webpack_require__(79);
10743
+ var collapse_item_ = __webpack_require__(80);
10744
10744
  var collapse_item_default = /*#__PURE__*/__webpack_require__.n(collapse_item_);
10745
10745
 
10746
10746
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/flow/src/component/CustomPreset.vue?vue&type=script&lang=js&
@@ -12928,7 +12928,7 @@ opinions_filevue_type_template_id_09bb75c1_render._withStripped = true
12928
12928
  // CONCATENATED MODULE: ./packages/flow/src/component/opinions-file.vue?vue&type=template&id=09bb75c1&
12929
12929
 
12930
12930
  // EXTERNAL MODULE: external "eoss/lib/upload"
12931
- var upload_ = __webpack_require__(49);
12931
+ var upload_ = __webpack_require__(50);
12932
12932
  var upload_default = /*#__PURE__*/__webpack_require__.n(upload_);
12933
12933
 
12934
12934
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/flow/src/component/opinions-file.vue?vue&type=script&lang=js&
@@ -13860,7 +13860,7 @@ TimeLimitvue_type_template_id_3c824632_render._withStripped = true
13860
13860
  // CONCATENATED MODULE: ./packages/flow/src/component/TimeLimit.vue?vue&type=template&id=3c824632&
13861
13861
 
13862
13862
  // EXTERNAL MODULE: external "eoss/lib/input-number"
13863
- var input_number_ = __webpack_require__(54);
13863
+ var input_number_ = __webpack_require__(56);
13864
13864
  var input_number_default = /*#__PURE__*/__webpack_require__.n(input_number_);
13865
13865
 
13866
13866
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/flow/src/component/TimeLimit.vue?vue&type=script&lang=js&
@@ -20540,19 +20540,19 @@ freeStartFlowvue_type_template_id_64190a68_render._withStripped = true
20540
20540
  // CONCATENATED MODULE: ./packages/flow/src/freeStartFlow.vue?vue&type=template&id=64190a68&
20541
20541
 
20542
20542
  // EXTERNAL MODULE: external "eoss/lib/button-group"
20543
- var button_group_ = __webpack_require__(53);
20543
+ var button_group_ = __webpack_require__(54);
20544
20544
  var button_group_default = /*#__PURE__*/__webpack_require__.n(button_group_);
20545
20545
 
20546
20546
  // EXTERNAL MODULE: external "eoss/lib/dropdown"
20547
- var dropdown_ = __webpack_require__(57);
20547
+ var dropdown_ = __webpack_require__(58);
20548
20548
  var dropdown_default = /*#__PURE__*/__webpack_require__.n(dropdown_);
20549
20549
 
20550
20550
  // EXTERNAL MODULE: external "eoss/lib/dropdown-item"
20551
- var dropdown_item_ = __webpack_require__(63);
20551
+ var dropdown_item_ = __webpack_require__(64);
20552
20552
  var dropdown_item_default = /*#__PURE__*/__webpack_require__.n(dropdown_item_);
20553
20553
 
20554
20554
  // EXTERNAL MODULE: external "eoss/lib/dropdown-menu"
20555
- var dropdown_menu_ = __webpack_require__(62);
20555
+ var dropdown_menu_ = __webpack_require__(63);
20556
20556
  var dropdown_menu_default = /*#__PURE__*/__webpack_require__.n(dropdown_menu_);
20557
20557
 
20558
20558
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/flow/src/freeStartFlow.vue?vue&type=script&lang=js&
@@ -29171,42 +29171,42 @@ module.exports = require("eoss/lib/radio-group");
29171
29171
 
29172
29172
  /***/ }),
29173
29173
 
29174
- /***/ 48:
29174
+ /***/ 49:
29175
29175
  /***/ (function(module, exports) {
29176
29176
 
29177
29177
  module.exports = require("eoss/lib/radio");
29178
29178
 
29179
29179
  /***/ }),
29180
29180
 
29181
- /***/ 49:
29181
+ /***/ 50:
29182
29182
  /***/ (function(module, exports) {
29183
29183
 
29184
29184
  module.exports = require("eoss/lib/upload");
29185
29185
 
29186
29186
  /***/ }),
29187
29187
 
29188
- /***/ 51:
29188
+ /***/ 52:
29189
29189
  /***/ (function(module, exports) {
29190
29190
 
29191
29191
  module.exports = require("eoss/lib/option");
29192
29192
 
29193
29193
  /***/ }),
29194
29194
 
29195
- /***/ 53:
29195
+ /***/ 54:
29196
29196
  /***/ (function(module, exports) {
29197
29197
 
29198
29198
  module.exports = require("eoss/lib/button-group");
29199
29199
 
29200
29200
  /***/ }),
29201
29201
 
29202
- /***/ 54:
29202
+ /***/ 56:
29203
29203
  /***/ (function(module, exports) {
29204
29204
 
29205
29205
  module.exports = require("eoss/lib/input-number");
29206
29206
 
29207
29207
  /***/ }),
29208
29208
 
29209
- /***/ 57:
29209
+ /***/ 58:
29210
29210
  /***/ (function(module, exports) {
29211
29211
 
29212
29212
  module.exports = require("eoss/lib/dropdown");
@@ -29786,28 +29786,28 @@ var changeInTime = '/baseIssueRules/changeInTime';
29786
29786
 
29787
29787
  /***/ }),
29788
29788
 
29789
- /***/ 62:
29789
+ /***/ 63:
29790
29790
  /***/ (function(module, exports) {
29791
29791
 
29792
29792
  module.exports = require("eoss/lib/dropdown-menu");
29793
29793
 
29794
29794
  /***/ }),
29795
29795
 
29796
- /***/ 63:
29796
+ /***/ 64:
29797
29797
  /***/ (function(module, exports) {
29798
29798
 
29799
29799
  module.exports = require("eoss/lib/dropdown-item");
29800
29800
 
29801
29801
  /***/ }),
29802
29802
 
29803
- /***/ 66:
29803
+ /***/ 67:
29804
29804
  /***/ (function(module, exports) {
29805
29805
 
29806
29806
  module.exports = require("eoss/lib/selector");
29807
29807
 
29808
29808
  /***/ }),
29809
29809
 
29810
- /***/ 68:
29810
+ /***/ 69:
29811
29811
  /***/ (function(module, exports) {
29812
29812
 
29813
29813
  module.exports = require("eoss/lib/tag");
@@ -29864,759 +29864,736 @@ module.exports = require("eoss/lib/tag");
29864
29864
  /* unused harmony export getSecond */
29865
29865
  /* unused harmony export getWeekday */
29866
29866
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
29867
- /* Modified from https://github.com/taylorhakes/fecha
29868
- *
29869
- * The MIT License (MIT)
29870
- *
29871
- * Copyright (c) 2015 Taylor Hakes
29872
- *
29873
- * Permission is hereby granted, free of charge, to any person obtaining a copy
29874
- * of this software and associated documentation files (the "Software"), to deal
29875
- * in the Software without restriction, including without limitation the rights
29876
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29877
- * copies of the Software, and to permit persons to whom the Software is
29878
- * furnished to do so, subject to the following conditions:
29879
- *
29880
- * The above copyright notice and this permission notice shall be included in all
29881
- * copies or substantial portions of the Software.
29882
- *
29883
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29884
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29885
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29886
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29887
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29888
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29889
- * SOFTWARE.
29890
- */
29891
-
29892
- /*eslint-disable*/
29893
- // 把 YYYY-MM-DD 改成了 yyyy-MM-dd
29894
-
29895
-
29867
+
29868
+
29896
29869
  /**
29897
29870
  * Parse or format dates
29898
29871
  * @class fecha
29899
- */
29900
- const fecha = {};
29901
- const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
29902
- const twoDigits = '\\d\\d?';
29903
- const threeDigits = '\\d{3}';
29904
- const fourDigits = '\\d{4}';
29905
- const word = '[^\\s]+';
29906
- const literal = /\[([^]*?)\]/gm;
29907
- const noop = function () {};
29908
-
29909
- function regexEscape(str) {
29910
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
29911
- }
29912
-
29913
- function shorten(arr, sLen) {
29914
- const newArr = [];
29915
- for (let i = 0, len = arr.length; i < len; i++) {
29916
- newArr.push(arr[i].substr(0, sLen));
29917
- }
29918
- return newArr;
29919
- }
29920
-
29921
- function monthUpdate() {
29922
- return function (d, v) {
29923
- const index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
29924
- if (~index) {
29925
- d.month = index;
29926
- }
29927
- };
29928
- }
29929
-
29930
- function pad(val, len) {
29931
- val = String(val);
29932
- len = len || 2;
29933
- while (val.length < len) {
29934
- val = '0' + val;
29935
- }
29936
- return val;
29937
- }
29938
-
29939
- // 直接使用中文日期名称常量
29940
- const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
29941
- const monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
29942
- const monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
29943
- const dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
29944
- const amPm = ['上午', '下午'];
29945
- const DoFn = function DoFn(D) {
29946
- return D + '日';
29947
- };
29948
-
29949
- const formatFlags = {
29950
- D: function(dateObj) {
29951
- return dateObj.getDay();
29952
- },
29953
- DD: function(dateObj) {
29954
- return pad(dateObj.getDay());
29955
- },
29956
- Do: function(dateObj) {
29957
- return DoFn(dateObj.getDate());
29958
- },
29959
- d: function(dateObj) {
29960
- return dateObj.getDate();
29961
- },
29962
- dd: function(dateObj) {
29963
- return pad(dateObj.getDate());
29964
- },
29965
- ddd: function(dateObj) {
29966
- return dayNamesShort[dateObj.getDay()];
29967
- },
29968
- dddd: function(dateObj) {
29969
- return dayNames[dateObj.getDay()];
29970
- },
29971
- M: function(dateObj) {
29972
- return dateObj.getMonth() + 1;
29973
- },
29974
- MM: function(dateObj) {
29975
- return pad(dateObj.getMonth() + 1);
29976
- },
29977
- MMM: function(dateObj) {
29978
- return monthNamesShort[dateObj.getMonth()];
29979
- },
29980
- MMMM: function(dateObj) {
29981
- return monthNames[dateObj.getMonth()];
29982
- },
29983
- yy: function(dateObj) {
29984
- return pad(String(dateObj.getFullYear()), 4).substr(2);
29985
- },
29986
- yyyy: function(dateObj) {
29987
- return pad(dateObj.getFullYear(), 4);
29988
- },
29989
- h: function(dateObj) {
29990
- return dateObj.getHours() % 12 || 12;
29991
- },
29992
- hh: function(dateObj) {
29993
- return pad(dateObj.getHours() % 12 || 12);
29994
- },
29995
- H: function(dateObj) {
29996
- return dateObj.getHours();
29997
- },
29998
- HH: function(dateObj) {
29999
- return pad(dateObj.getHours());
30000
- },
30001
- m: function(dateObj) {
30002
- return dateObj.getMinutes();
30003
- },
30004
- mm: function(dateObj) {
30005
- return pad(dateObj.getMinutes());
30006
- },
30007
- s: function(dateObj) {
30008
- return dateObj.getSeconds();
30009
- },
30010
- ss: function(dateObj) {
30011
- return pad(dateObj.getSeconds());
30012
- },
30013
- S: function(dateObj) {
30014
- return Math.round(dateObj.getMilliseconds() / 100);
30015
- },
30016
- SS: function(dateObj) {
30017
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
30018
- },
30019
- SSS: function(dateObj) {
30020
- return pad(dateObj.getMilliseconds(), 3);
30021
- },
30022
- a: function(dateObj) {
30023
- return dateObj.getHours() < 12 ? '上午' : '下午';
30024
- },
30025
- A: function(dateObj) {
30026
- return dateObj.getHours() < 12 ? '上午' : '下午';
30027
- },
30028
- ZZ: function(dateObj) {
30029
- const o = dateObj.getTimezoneOffset();
30030
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
30031
- }
30032
- };
30033
-
30034
- const parseFlags = {
30035
- d: [twoDigits, function (d, v) {
30036
- d.day = v;
30037
- }],
30038
- Do: [twoDigits + word, function (d, v) {
30039
- d.day = parseInt(v, 10);
30040
- }],
30041
- M: [twoDigits, function (d, v) {
30042
- d.month = v - 1;
30043
- }],
30044
- yy: [twoDigits, function (d, v) {
30045
- const da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
30046
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
30047
- }],
30048
- h: [twoDigits, function (d, v) {
30049
- d.hour = v;
30050
- }],
30051
- m: [twoDigits, function (d, v) {
30052
- d.minute = v;
30053
- }],
30054
- s: [twoDigits, function (d, v) {
30055
- d.second = v;
30056
- }],
30057
- yyyy: [fourDigits, function (d, v) {
30058
- d.year = v;
30059
- }],
30060
- S: ['\\d', function (d, v) {
30061
- d.millisecond = v * 100;
30062
- }],
30063
- SS: ['\\d{2}', function (d, v) {
30064
- d.millisecond = v * 10;
30065
- }],
30066
- SSS: [threeDigits, function (d, v) {
30067
- d.millisecond = v;
30068
- }],
30069
- D: [twoDigits, noop],
30070
- ddd: [word, noop],
30071
- MMM: [word, monthUpdate('monthNamesShort')],
30072
- MMMM: [word, monthUpdate('monthNames')],
30073
- a: [word, function (d, v) {
30074
- const val = v.toLowerCase();
30075
- if (val === '上午') {
30076
- d.isPm = false;
30077
- } else if (val === '下午') {
30078
- d.isPm = true;
30079
- }
30080
- }],
30081
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
30082
- let parts = (v + '').match(/([+-]|\d\d)/gi), minutes;
30083
-
30084
- if (parts) {
30085
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
30086
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
30087
- }
30088
- }]
30089
- };
30090
- parseFlags.dd = parseFlags.d;
30091
- parseFlags.dddd = parseFlags.ddd;
30092
- parseFlags.DD = parseFlags.D;
30093
- parseFlags.mm = parseFlags.m;
30094
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
30095
- parseFlags.MM = parseFlags.M;
30096
- parseFlags.ss = parseFlags.s;
30097
- parseFlags.A = parseFlags.a;
30098
-
30099
-
30100
- // Some common format strings
30101
- fecha.masks = {
30102
- default: 'ddd MMM dd yyyy HH:mm:ss',
30103
- shortDate: 'M/D/yy',
30104
- mediumDate: 'MMM d, yyyy',
30105
- longDate: 'MMMM d, yyyy',
30106
- fullDate: 'dddd, MMMM d, yyyy',
30107
- shortTime: 'HH:mm',
30108
- mediumTime: 'HH:mm:ss',
30109
- longTime: 'HH:mm:ss.SSS'
30110
- };
30111
-
29872
+ */
29873
+ var fecha = {};
29874
+ var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
29875
+ var twoDigits = '\\d\\d?';
29876
+ var threeDigits = '\\d{3}';
29877
+ var fourDigits = '\\d{4}';
29878
+ var word = '[^\\s]+';
29879
+ var literal = /\[([^]*?)\]/gm;
29880
+ var noop = function noop() {};
29881
+
29882
+ function regexEscape(str) {
29883
+ return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
29884
+ }
29885
+
29886
+ function shorten(arr, sLen) {
29887
+ var newArr = [];
29888
+ for (var i = 0, len = arr.length; i < len; i++) {
29889
+ newArr.push(arr[i].substr(0, sLen));
29890
+ }
29891
+ return newArr;
29892
+ }
29893
+
29894
+ function monthUpdate() {
29895
+ return function (d, v) {
29896
+ var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
29897
+ if (~index) {
29898
+ d.month = index;
29899
+ }
29900
+ };
29901
+ }
29902
+
29903
+ function pad(val, len) {
29904
+ val = String(val);
29905
+ len = len || 2;
29906
+ while (val.length < len) {
29907
+ val = '0' + val;
29908
+ }
29909
+ return val;
29910
+ }
29911
+
29912
+ // 直接使用中文日期名称常量
29913
+ var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
29914
+ var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
29915
+ var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
29916
+ var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
29917
+ var amPm = ['上午', '下午'];
29918
+ var DoFn = function DoFn(D) {
29919
+ return D + '日';
29920
+ };
29921
+
29922
+ var formatFlags = {
29923
+ D: function D(dateObj) {
29924
+ return dateObj.getDay();
29925
+ },
29926
+ DD: function DD(dateObj) {
29927
+ return pad(dateObj.getDay());
29928
+ },
29929
+ Do: function Do(dateObj) {
29930
+ return DoFn(dateObj.getDate());
29931
+ },
29932
+ d: function d(dateObj) {
29933
+ return dateObj.getDate();
29934
+ },
29935
+ dd: function dd(dateObj) {
29936
+ return pad(dateObj.getDate());
29937
+ },
29938
+ ddd: function ddd(dateObj) {
29939
+ return dayNamesShort[dateObj.getDay()];
29940
+ },
29941
+ dddd: function dddd(dateObj) {
29942
+ return dayNames[dateObj.getDay()];
29943
+ },
29944
+ M: function M(dateObj) {
29945
+ return dateObj.getMonth() + 1;
29946
+ },
29947
+ MM: function MM(dateObj) {
29948
+ return pad(dateObj.getMonth() + 1);
29949
+ },
29950
+ MMM: function MMM(dateObj) {
29951
+ return monthNamesShort[dateObj.getMonth()];
29952
+ },
29953
+ MMMM: function MMMM(dateObj) {
29954
+ return monthNames[dateObj.getMonth()];
29955
+ },
29956
+ yy: function yy(dateObj) {
29957
+ return pad(String(dateObj.getFullYear()), 4).substr(2);
29958
+ },
29959
+ yyyy: function yyyy(dateObj) {
29960
+ return pad(dateObj.getFullYear(), 4);
29961
+ },
29962
+ h: function h(dateObj) {
29963
+ return dateObj.getHours() % 12 || 12;
29964
+ },
29965
+ hh: function hh(dateObj) {
29966
+ return pad(dateObj.getHours() % 12 || 12);
29967
+ },
29968
+ H: function H(dateObj) {
29969
+ return dateObj.getHours();
29970
+ },
29971
+ HH: function HH(dateObj) {
29972
+ return pad(dateObj.getHours());
29973
+ },
29974
+ m: function m(dateObj) {
29975
+ return dateObj.getMinutes();
29976
+ },
29977
+ mm: function mm(dateObj) {
29978
+ return pad(dateObj.getMinutes());
29979
+ },
29980
+ s: function s(dateObj) {
29981
+ return dateObj.getSeconds();
29982
+ },
29983
+ ss: function ss(dateObj) {
29984
+ return pad(dateObj.getSeconds());
29985
+ },
29986
+ S: function S(dateObj) {
29987
+ return Math.round(dateObj.getMilliseconds() / 100);
29988
+ },
29989
+ SS: function SS(dateObj) {
29990
+ return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
29991
+ },
29992
+ SSS: function SSS(dateObj) {
29993
+ return pad(dateObj.getMilliseconds(), 3);
29994
+ },
29995
+ a: function a(dateObj) {
29996
+ return dateObj.getHours() < 12 ? '上午' : '下午';
29997
+ },
29998
+ A: function A(dateObj) {
29999
+ return dateObj.getHours() < 12 ? '上午' : '下午';
30000
+ },
30001
+ ZZ: function ZZ(dateObj) {
30002
+ var o = dateObj.getTimezoneOffset();
30003
+ return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
30004
+ }
30005
+ };
30006
+
30007
+ var parseFlags = {
30008
+ d: [twoDigits, function (d, v) {
30009
+ d.day = v;
30010
+ }],
30011
+ Do: [twoDigits + word, function (d, v) {
30012
+ d.day = parseInt(v, 10);
30013
+ }],
30014
+ M: [twoDigits, function (d, v) {
30015
+ d.month = v - 1;
30016
+ }],
30017
+ yy: [twoDigits, function (d, v) {
30018
+ var da = new Date(),
30019
+ cent = +('' + da.getFullYear()).substr(0, 2);
30020
+ d.year = '' + (v > 68 ? cent - 1 : cent) + v;
30021
+ }],
30022
+ h: [twoDigits, function (d, v) {
30023
+ d.hour = v;
30024
+ }],
30025
+ m: [twoDigits, function (d, v) {
30026
+ d.minute = v;
30027
+ }],
30028
+ s: [twoDigits, function (d, v) {
30029
+ d.second = v;
30030
+ }],
30031
+ yyyy: [fourDigits, function (d, v) {
30032
+ d.year = v;
30033
+ }],
30034
+ S: ['\\d', function (d, v) {
30035
+ d.millisecond = v * 100;
30036
+ }],
30037
+ SS: ['\\d{2}', function (d, v) {
30038
+ d.millisecond = v * 10;
30039
+ }],
30040
+ SSS: [threeDigits, function (d, v) {
30041
+ d.millisecond = v;
30042
+ }],
30043
+ D: [twoDigits, noop],
30044
+ ddd: [word, noop],
30045
+ MMM: [word, monthUpdate('monthNamesShort')],
30046
+ MMMM: [word, monthUpdate('monthNames')],
30047
+ a: [word, function (d, v) {
30048
+ var val = v.toLowerCase();
30049
+ if (val === '上午') {
30050
+ d.isPm = false;
30051
+ } else if (val === '下午') {
30052
+ d.isPm = true;
30053
+ }
30054
+ }],
30055
+ ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
30056
+ var parts = (v + '').match(/([+-]|\d\d)/gi),
30057
+ minutes = void 0;
30058
+
30059
+ if (parts) {
30060
+ minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
30061
+ d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
30062
+ }
30063
+ }]
30064
+ };
30065
+ parseFlags.dd = parseFlags.d;
30066
+ parseFlags.dddd = parseFlags.ddd;
30067
+ parseFlags.DD = parseFlags.D;
30068
+ parseFlags.mm = parseFlags.m;
30069
+ parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
30070
+ parseFlags.MM = parseFlags.M;
30071
+ parseFlags.ss = parseFlags.s;
30072
+ parseFlags.A = parseFlags.a;
30073
+
30074
+ // Some common format strings
30075
+ fecha.masks = {
30076
+ default: 'ddd MMM dd yyyy HH:mm:ss',
30077
+ shortDate: 'M/D/yy',
30078
+ mediumDate: 'MMM d, yyyy',
30079
+ longDate: 'MMMM d, yyyy',
30080
+ fullDate: 'dddd, MMMM d, yyyy',
30081
+ shortTime: 'HH:mm',
30082
+ mediumTime: 'HH:mm:ss',
30083
+ longTime: 'HH:mm:ss.SSS'
30084
+ };
30085
+
30112
30086
  /***
30113
30087
  * Format a date
30114
30088
  * @method format
30115
30089
  * @param {Date|number} dateObj
30116
30090
  * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
30117
- */
30118
- fecha.format = function (dateObj, mask) {
30119
- if (typeof dateObj === 'number') {
30120
- dateObj = new Date(dateObj);
30121
- }
30122
-
30123
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
30124
- throw new Error('Invalid Date in fecha.format');
30125
- }
30126
-
30127
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
30128
-
30129
- const literals = [];
30130
-
30131
- // Make literals inactive by replacing them with ??
30132
- mask = mask.replace(literal, function($0, $1) {
30133
- literals.push($1);
30134
- return '@@@';
30135
- });
30136
- // Apply formatting rules
30137
- mask = mask.replace(token, function ($0) {
30138
- return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
30139
- });
30140
- // Inline literal values back into the formatted value
30141
- return mask.replace(/@@@/g, function() {
30142
- return literals.shift();
30143
- });
30144
- };
30145
-
30091
+ */
30092
+ fecha.format = function (dateObj, mask) {
30093
+ if (typeof dateObj === 'number') {
30094
+ dateObj = new Date(dateObj);
30095
+ }
30096
+
30097
+ if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
30098
+ throw new Error('Invalid Date in fecha.format');
30099
+ }
30100
+
30101
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
30102
+
30103
+ var literals = [];
30104
+
30105
+ // Make literals inactive by replacing them with ??
30106
+ mask = mask.replace(literal, function ($0, $1) {
30107
+ literals.push($1);
30108
+ return '@@@';
30109
+ });
30110
+ // Apply formatting rules
30111
+ mask = mask.replace(token, function ($0) {
30112
+ return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
30113
+ });
30114
+ // Inline literal values back into the formatted value
30115
+ return mask.replace(/@@@/g, function () {
30116
+ return literals.shift();
30117
+ });
30118
+ };
30119
+
30146
30120
  /**
30147
30121
  * Parse a date string into an object, changes - into /
30148
30122
  * @method parse
30149
30123
  * @param {string} dateStr Date string
30150
30124
  * @param {string} format Date parse format
30151
30125
  * @returns {Date|boolean}
30152
- */
30153
- fecha.parse = function (dateStr, format) {
30154
- if (typeof format !== 'string') {
30155
- throw new Error('Invalid format in fecha.parse');
30156
- }
30157
-
30158
- format = fecha.masks[format] || format;
30159
-
30160
- // Avoid regular expression denial of service, fail early for really long strings
30161
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
30162
- if (dateStr.length > 1000) {
30163
- return null;
30164
- }
30165
-
30166
- const dateInfo = {};
30167
- const parseInfo = [];
30168
- const literals = [];
30169
- format = format.replace(literal, function($0, $1) {
30170
- literals.push($1);
30171
- return '@@@';
30172
- });
30173
- let newFormat = regexEscape(format).replace(token, function ($0) {
30174
- if (parseFlags[$0]) {
30175
- const info = parseFlags[$0];
30176
- parseInfo.push(info[1]);
30177
- return '(' + info[0] + ')';
30178
- }
30179
-
30180
- return $0;
30181
- });
30182
- newFormat = newFormat.replace(/@@@/g, function() {
30183
- return literals.shift();
30184
- });
30185
- const matches = dateStr.match(new RegExp(newFormat, 'i'));
30186
- if (!matches) {
30187
- return null;
30188
- }
30189
-
30190
- for (let i = 1; i < matches.length; i++) {
30191
- parseInfo[i - 1](dateInfo, matches[i]);
30192
- }
30193
-
30194
- const today = new Date();
30195
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
30196
- dateInfo.hour = +dateInfo.hour + 12;
30197
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
30198
- dateInfo.hour = 0;
30199
- }
30200
-
30201
- let date;
30202
- if (dateInfo.timezoneOffset != null) {
30203
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
30204
- date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
30205
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
30206
- } else {
30207
- date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
30208
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
30209
- }
30210
- return date;
30211
- };
30212
-
30213
- // 导出fecha对象
30214
-
30215
-
30216
- // 以下是从date-util.js合并的函数
30217
- const newArray = function(start, end) {
30218
- let result = [];
30219
- for (let i = start; i <= end; i++) {
30220
- result.push(i);
30221
- }
30222
- return result;
30223
- };
30224
-
30225
- const getSettings = () => {
30226
- return {
30227
- dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
30228
- dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
30229
- monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
30230
- monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
30231
- amPm: ['上午', '下午']
30232
- };
30233
- };
30234
-
30235
- const toDate = function(date) {
30236
- return isDate(date) ? new Date(date) : null;
30237
- };
30238
-
30239
- const isDate = function(date) {
30240
- if (date === null || date === undefined) return false;
30241
- if (isNaN(new Date(date).getTime())) return false;
30242
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
30243
- return true;
30244
- };
30245
-
30246
- const isDateObject = function(val) {
30247
- return val instanceof Date;
30248
- };
30249
-
30250
- const formatDate = function (date, format = 'yyyy-MM-dd') {
30251
- // 处理多种输入类型
30252
- if (!date) return '';
30253
-
30254
- // 如果是时间戳,转成日期对象
30255
- if (typeof date === 'number') {
30256
- date = new Date(date);
30257
- }
30258
- // 如果是字符串,转成日期对象
30259
- if (typeof date === 'string') {
30260
- date = new Date(date);
30261
- }
30262
-
30263
- // 调用toDate进一步验证和转换
30264
- date = toDate(date);
30265
- if (!date) return '';
30266
-
30267
- // 兼容大写和小写的格式标记
30268
- // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
30269
- const lowercaseFormat = format
30270
- .replace(/YYYY/g, 'yyyy')
30271
- .replace(/D/g, 'd')
30272
-
30273
- // 使用fecha库进行格式化,支持中文配置
30274
- const str = fecha.format(date, lowercaseFormat, getSettings());
30275
- return str;
30276
- };
30277
-
30278
- const parseDate = function(string, format) {
30279
- return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
30280
- };
30281
-
30282
- const getDayCountOfMonth = function(year, month) {
30283
- if (month === 3 || month === 5 || month === 8 || month === 10) {
30284
- return 30;
30285
- }
30286
-
30287
- if (month === 1) {
30288
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
30289
- return 29;
30290
- } else {
30291
- return 28;
30292
- }
30293
- }
30294
-
30295
- return 31;
30296
- };
30297
-
30298
- const getDayCountOfYear = function(year) {
30299
- const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
30300
- return isLeapYear ? 366 : 365;
30301
- };
30302
-
30303
- const getFirstDayOfMonth = function(date) {
30304
- const temp = new Date(date.getTime());
30305
- temp.setDate(1);
30306
- return temp.getDay();
30307
- };
30308
-
30309
- // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
30310
- // {prev, next} Date should work for Daylight Saving Time
30311
- // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
30312
- const prevDate = function(date, amount = 1) {
30313
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
30314
- };
30315
-
30316
- const nextDate = function(date, amount = 1) {
30317
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
30318
- };
30319
-
30320
- const getStartDateOfMonth = function(year, month) {
30321
- const result = new Date(year, month, 1);
30322
- const day = result.getDay();
30323
-
30324
- if (day === 0) {
30325
- return prevDate(result, 7);
30326
- } else {
30327
- return prevDate(result, day);
30328
- }
30329
- };
30330
-
30331
- const getWeekNumber = function(date) {
30332
- // 支持多种输入类型
30333
- if (!date||!isDate(date)) {
30334
- date = new Date();
30335
- }
30336
- if (typeof date === 'string') {
30337
- date = new Date(date);
30338
- }
30339
-
30340
- // 验证日期有效性
30341
- if (!isDate(date)) return null;
30342
-
30343
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
30344
- // 设置为最近的星期四:当前日期 + 4 - 当前星期数
30345
- // 将星期日的星期数设为7
30346
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
30347
- // 获取当年的第一天
30348
- const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
30349
- // 计算到最近的星期四的完整周数
30350
- const weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
30351
- // 返回周数
30352
- return weekNo;
30353
- };
30354
-
30355
- const getRangeHours = function(ranges) {
30356
- const hours = [];
30357
- let disabledHours = [];
30358
-
30359
- (ranges || []).forEach(range => {
30360
- const value = range.map(date => date.getHours());
30361
-
30362
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
30363
- });
30364
-
30365
- if (disabledHours.length) {
30366
- for (let i = 0; i < 24; i++) {
30367
- hours[i] = disabledHours.indexOf(i) === -1;
30368
- }
30369
- } else {
30370
- for (let i = 0; i < 24; i++) {
30371
- hours[i] = false;
30372
- }
30373
- }
30374
-
30375
- return hours;
30376
- };
30377
-
30378
- const getPrevMonthLastDays = (date, amount) => {
30379
- if (amount <= 0) return [];
30380
- const temp = new Date(date.getTime());
30381
- temp.setDate(0);
30382
- const lastDay = temp.getDate();
30383
- return range(amount).map((_, index) => lastDay - (amount - index - 1));
30384
- };
30385
-
30386
- const getMonthDays = (date) => {
30387
- const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
30388
- const days = temp.getDate();
30389
- return range(days).map((_, index) => index + 1);
30390
- };
30391
-
30392
- function setRangeData(arr, start, end, value) {
30393
- for (let i = start; i < end; i++) {
30394
- arr[i] = value;
30395
- }
30396
- }
30397
-
30398
- const getRangeMinutes = function(ranges, hour) {
30399
- const minutes = new Array(60);
30400
-
30401
- if (ranges.length > 0) {
30402
- ranges.forEach(range => {
30403
- const start = range[0];
30404
- const end = range[1];
30405
- const startHour = start.getHours();
30406
- const startMinute = start.getMinutes();
30407
- const endHour = end.getHours();
30408
- const endMinute = end.getMinutes();
30409
- if (startHour === hour && endHour !== hour) {
30410
- setRangeData(minutes, startMinute, 60, true);
30411
- } else if (startHour === hour && endHour === hour) {
30412
- setRangeData(minutes, startMinute, endMinute + 1, true);
30413
- } else if (startHour !== hour && endHour === hour) {
30414
- setRangeData(minutes, 0, endMinute + 1, true);
30415
- } else if (startHour < hour && endHour > hour) {
30416
- setRangeData(minutes, 0, 60, true);
30417
- }
30418
- });
30419
- } else {
30420
- setRangeData(minutes, 0, 60, true);
30421
- }
30422
- return minutes;
30423
- };
30424
-
30425
- const range = function(n) {
30426
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
30427
- return Array.apply(null, {length: n}).map((_, n) => n);
30428
- };
30429
-
30430
- const modifyDate = function(date, y, m, d) {
30431
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
30432
- };
30433
-
30434
- const modifyTime = function(date, h, m, s) {
30435
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
30436
- };
30437
-
30438
- const modifyWithTimeString = (date, time) => {
30439
- if (date == null || !time) {
30440
- return date;
30441
- }
30442
- time = parseDate(time, 'HH:mm:ss');
30443
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
30444
- };
30445
-
30446
- const clearTime = function(date) {
30447
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
30448
- };
30449
-
30450
- const clearMilliseconds = function(date) {
30451
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
30452
- };
30453
-
30454
- const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
30455
- // TODO: refactory a more elegant solution
30456
- if (ranges.length === 0) return date;
30457
- const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
30458
- const ndate = normalizeDate(date);
30459
- const nranges = ranges.map(range => range.map(normalizeDate));
30460
- if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
30461
-
30462
- let minDate = nranges[0][0];
30463
- let maxDate = nranges[0][0];
30464
-
30465
- nranges.forEach(nrange => {
30466
- minDate = new Date(Math.min(nrange[0], minDate));
30467
- maxDate = new Date(Math.max(nrange[1], minDate));
30468
- });
30469
-
30470
- const ret = ndate < minDate ? minDate : maxDate;
30471
- // preserve Year/Month/Date
30472
- return modifyDate(
30473
- ret,
30474
- date.getFullYear(),
30475
- date.getMonth(),
30476
- date.getDate()
30477
- );
30478
- };
30479
-
30480
- const timeWithinRange = function(date, selectableRange, format) {
30481
- const limitedDate = limitTimeRange(date, selectableRange, format);
30482
- return limitedDate.getTime() === date.getTime();
30483
- };
30484
-
30485
- const changeYearMonthAndClampDate = function(date, year, month) {
30486
- // clamp date to the number of days in `year`, `month`
30487
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
30488
- const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
30489
- return modifyDate(date, year, month, monthDate);
30490
- };
30491
-
30492
- const prevMonth = function(date) {
30493
- const year = date.getFullYear();
30494
- const month = date.getMonth();
30495
- return month === 0
30496
- ? changeYearMonthAndClampDate(date, year - 1, 11)
30497
- : changeYearMonthAndClampDate(date, year, month - 1);
30498
- };
30499
-
30500
- const nextMonth = function(date) {
30501
- const year = date.getFullYear();
30502
- const month = date.getMonth();
30503
- return month === 11
30504
- ? changeYearMonthAndClampDate(date, year + 1, 0)
30505
- : changeYearMonthAndClampDate(date, year, month + 1);
30506
- };
30507
-
30508
- const prevYear = function(date, amount = 1) {
30509
- const year = date.getFullYear();
30510
- const month = date.getMonth();
30511
- return changeYearMonthAndClampDate(date, year - amount, month);
30512
- };
30513
-
30514
- const nextYear = function(date, amount = 1) {
30515
- const year = date.getFullYear();
30516
- const month = date.getMonth();
30517
- return changeYearMonthAndClampDate(date, year + amount, month);
30518
- };
30519
-
30520
- const extractDateFormat = function(format) {
30521
- return format
30522
- .replace(/\W?m{1,2}|\W?ZZ/g, '')
30523
- .replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
30524
- .trim();
30525
- };
30526
-
30527
- const extractTimeFormat = function(format) {
30528
- return format
30529
- .replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
30530
- .trim();
30531
- };
30532
-
30533
- const validateRangeInOneMonth = function(start, end) {
30534
- return (start.getMonth() === end.getMonth()) && (start.getFullYear() === end.getFullYear());
30535
- };
30536
-
30126
+ */
30127
+ fecha.parse = function (dateStr, format) {
30128
+ if (typeof format !== 'string') {
30129
+ throw new Error('Invalid format in fecha.parse');
30130
+ }
30131
+
30132
+ format = fecha.masks[format] || format;
30133
+
30134
+ // Avoid regular expression denial of service, fail early for really long strings
30135
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
30136
+ if (dateStr.length > 1000) {
30137
+ return null;
30138
+ }
30139
+
30140
+ var dateInfo = {};
30141
+ var parseInfo = [];
30142
+ var literals = [];
30143
+ format = format.replace(literal, function ($0, $1) {
30144
+ literals.push($1);
30145
+ return '@@@';
30146
+ });
30147
+ var newFormat = regexEscape(format).replace(token, function ($0) {
30148
+ if (parseFlags[$0]) {
30149
+ var info = parseFlags[$0];
30150
+ parseInfo.push(info[1]);
30151
+ return '(' + info[0] + ')';
30152
+ }
30153
+
30154
+ return $0;
30155
+ });
30156
+ newFormat = newFormat.replace(/@@@/g, function () {
30157
+ return literals.shift();
30158
+ });
30159
+ var matches = dateStr.match(new RegExp(newFormat, 'i'));
30160
+ if (!matches) {
30161
+ return null;
30162
+ }
30163
+
30164
+ for (var i = 1; i < matches.length; i++) {
30165
+ parseInfo[i - 1](dateInfo, matches[i]);
30166
+ }
30167
+
30168
+ var today = new Date();
30169
+ if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
30170
+ dateInfo.hour = +dateInfo.hour + 12;
30171
+ } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
30172
+ dateInfo.hour = 0;
30173
+ }
30174
+
30175
+ var date = void 0;
30176
+ if (dateInfo.timezoneOffset != null) {
30177
+ dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
30178
+ 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));
30179
+ } else {
30180
+ 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);
30181
+ }
30182
+ return date;
30183
+ };
30184
+
30185
+ // 导出fecha对象
30186
+
30187
+
30188
+ // 以下是从date-util.js合并的函数
30189
+ var newArray = function newArray(start, end) {
30190
+ var result = [];
30191
+ for (var i = start; i <= end; i++) {
30192
+ result.push(i);
30193
+ }
30194
+ return result;
30195
+ };
30196
+
30197
+ var getSettings = function getSettings() {
30198
+ return {
30199
+ dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
30200
+ dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
30201
+ monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
30202
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
30203
+ amPm: ['上午', '下午']
30204
+ };
30205
+ };
30206
+
30207
+ var toDate = function toDate(date) {
30208
+ return isDate(date) ? new Date(date) : null;
30209
+ };
30210
+
30211
+ var isDate = function isDate(date) {
30212
+ if (date === null || date === undefined) return false;
30213
+ if (isNaN(new Date(date).getTime())) return false;
30214
+ if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
30215
+ return true;
30216
+ };
30217
+
30218
+ var isDateObject = function isDateObject(val) {
30219
+ return val instanceof Date;
30220
+ };
30221
+
30222
+ var formatDate = function formatDate(date) {
30223
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
30224
+
30225
+ // 处理多种输入类型
30226
+ if (!date) return '';
30227
+
30228
+ // 如果是时间戳,转成日期对象
30229
+ if (typeof date === 'number') {
30230
+ date = new Date(date);
30231
+ }
30232
+ // 如果是字符串,转成日期对象
30233
+ if (typeof date === 'string') {
30234
+ date = new Date(date);
30235
+ }
30236
+
30237
+ // 调用toDate进一步验证和转换
30238
+ date = toDate(date);
30239
+ if (!date) return '';
30240
+
30241
+ // 兼容大写和小写的格式标记
30242
+ // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
30243
+ var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
30244
+
30245
+ // 使用fecha库进行格式化,支持中文配置
30246
+ var str = fecha.format(date, lowercaseFormat, getSettings());
30247
+ return str;
30248
+ };
30249
+
30250
+ var parseDate = function parseDate(string, format) {
30251
+ return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
30252
+ };
30253
+
30254
+ var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
30255
+ if (month === 3 || month === 5 || month === 8 || month === 10) {
30256
+ return 30;
30257
+ }
30258
+
30259
+ if (month === 1) {
30260
+ if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
30261
+ return 29;
30262
+ } else {
30263
+ return 28;
30264
+ }
30265
+ }
30266
+
30267
+ return 31;
30268
+ };
30269
+
30270
+ var getDayCountOfYear = function getDayCountOfYear(year) {
30271
+ var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
30272
+ return isLeapYear ? 366 : 365;
30273
+ };
30274
+
30275
+ var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
30276
+ var temp = new Date(date.getTime());
30277
+ temp.setDate(1);
30278
+ return temp.getDay();
30279
+ };
30280
+
30281
+ // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
30282
+ // {prev, next} Date should work for Daylight Saving Time
30283
+ // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
30284
+ var prevDate = function prevDate(date) {
30285
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
30286
+
30287
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
30288
+ };
30289
+
30290
+ var nextDate = function nextDate(date) {
30291
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
30292
+
30293
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
30294
+ };
30295
+
30296
+ var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
30297
+ var result = new Date(year, month, 1);
30298
+ var day = result.getDay();
30299
+
30300
+ if (day === 0) {
30301
+ return prevDate(result, 7);
30302
+ } else {
30303
+ return prevDate(result, day);
30304
+ }
30305
+ };
30306
+
30307
+ var getWeekNumber = function getWeekNumber(date) {
30308
+ // 支持多种输入类型
30309
+ if (!date || !isDate(date)) {
30310
+ date = new Date();
30311
+ }
30312
+ if (typeof date === 'string') {
30313
+ date = new Date(date);
30314
+ }
30315
+
30316
+ // 验证日期有效性
30317
+ if (!isDate(date)) return null;
30318
+
30319
+ var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
30320
+ // 设置为最近的星期四:当前日期 + 4 - 当前星期数
30321
+ // 将星期日的星期数设为7
30322
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
30323
+ // 获取当年的第一天
30324
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
30325
+ // 计算到最近的星期四的完整周数
30326
+ var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
30327
+ // 返回周数
30328
+ return weekNo;
30329
+ };
30330
+
30331
+ var getRangeHours = function getRangeHours(ranges) {
30332
+ var hours = [];
30333
+ var disabledHours = [];
30334
+
30335
+ (ranges || []).forEach(function (range) {
30336
+ var value = range.map(function (date) {
30337
+ return date.getHours();
30338
+ });
30339
+
30340
+ disabledHours = disabledHours.concat(newArray(value[0], value[1]));
30341
+ });
30342
+
30343
+ if (disabledHours.length) {
30344
+ for (var i = 0; i < 24; i++) {
30345
+ hours[i] = disabledHours.indexOf(i) === -1;
30346
+ }
30347
+ } else {
30348
+ for (var _i = 0; _i < 24; _i++) {
30349
+ hours[_i] = false;
30350
+ }
30351
+ }
30352
+
30353
+ return hours;
30354
+ };
30355
+
30356
+ var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
30357
+ if (amount <= 0) return [];
30358
+ var temp = new Date(date.getTime());
30359
+ temp.setDate(0);
30360
+ var lastDay = temp.getDate();
30361
+ return range(amount).map(function (_, index) {
30362
+ return lastDay - (amount - index - 1);
30363
+ });
30364
+ };
30365
+
30366
+ var getMonthDays = function getMonthDays(date) {
30367
+ var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
30368
+ var days = temp.getDate();
30369
+ return range(days).map(function (_, index) {
30370
+ return index + 1;
30371
+ });
30372
+ };
30373
+
30374
+ function setRangeData(arr, start, end, value) {
30375
+ for (var i = start; i < end; i++) {
30376
+ arr[i] = value;
30377
+ }
30378
+ }
30379
+
30380
+ var getRangeMinutes = function getRangeMinutes(ranges, hour) {
30381
+ var minutes = new Array(60);
30382
+
30383
+ if (ranges.length > 0) {
30384
+ ranges.forEach(function (range) {
30385
+ var start = range[0];
30386
+ var end = range[1];
30387
+ var startHour = start.getHours();
30388
+ var startMinute = start.getMinutes();
30389
+ var endHour = end.getHours();
30390
+ var endMinute = end.getMinutes();
30391
+ if (startHour === hour && endHour !== hour) {
30392
+ setRangeData(minutes, startMinute, 60, true);
30393
+ } else if (startHour === hour && endHour === hour) {
30394
+ setRangeData(minutes, startMinute, endMinute + 1, true);
30395
+ } else if (startHour !== hour && endHour === hour) {
30396
+ setRangeData(minutes, 0, endMinute + 1, true);
30397
+ } else if (startHour < hour && endHour > hour) {
30398
+ setRangeData(minutes, 0, 60, true);
30399
+ }
30400
+ });
30401
+ } else {
30402
+ setRangeData(minutes, 0, 60, true);
30403
+ }
30404
+ return minutes;
30405
+ };
30406
+
30407
+ var range = function range(n) {
30408
+ // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
30409
+ return Array.apply(null, { length: n }).map(function (_, n) {
30410
+ return n;
30411
+ });
30412
+ };
30413
+
30414
+ var modifyDate = function modifyDate(date, y, m, d) {
30415
+ return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
30416
+ };
30417
+
30418
+ var modifyTime = function modifyTime(date, h, m, s) {
30419
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
30420
+ };
30421
+
30422
+ var modifyWithTimeString = function modifyWithTimeString(date, time) {
30423
+ if (date == null || !time) {
30424
+ return date;
30425
+ }
30426
+ time = parseDate(time, 'HH:mm:ss');
30427
+ return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
30428
+ };
30429
+
30430
+ var clearTime = function clearTime(date) {
30431
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
30432
+ };
30433
+
30434
+ var clearMilliseconds = function clearMilliseconds(date) {
30435
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
30436
+ };
30437
+
30438
+ var limitTimeRange = function limitTimeRange(date, ranges) {
30439
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
30440
+
30441
+ // TODO: refactory a more elegant solution
30442
+ if (ranges.length === 0) return date;
30443
+ var normalizeDate = function normalizeDate(date) {
30444
+ return fecha.parse(fecha.format(date, format), format);
30445
+ };
30446
+ var ndate = normalizeDate(date);
30447
+ var nranges = ranges.map(function (range) {
30448
+ return range.map(normalizeDate);
30449
+ });
30450
+ if (nranges.some(function (nrange) {
30451
+ return ndate >= nrange[0] && ndate <= nrange[1];
30452
+ })) return date;
30453
+
30454
+ var minDate = nranges[0][0];
30455
+ var maxDate = nranges[0][0];
30456
+
30457
+ nranges.forEach(function (nrange) {
30458
+ minDate = new Date(Math.min(nrange[0], minDate));
30459
+ maxDate = new Date(Math.max(nrange[1], minDate));
30460
+ });
30461
+
30462
+ var ret = ndate < minDate ? minDate : maxDate;
30463
+ // preserve Year/Month/Date
30464
+ return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
30465
+ };
30466
+
30467
+ var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
30468
+ var limitedDate = limitTimeRange(date, selectableRange, format);
30469
+ return limitedDate.getTime() === date.getTime();
30470
+ };
30471
+
30472
+ var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
30473
+ // clamp date to the number of days in `year`, `month`
30474
+ // eg: (2010-1-31, 2010, 2) => 2010-2-28
30475
+ var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
30476
+ return modifyDate(date, year, month, monthDate);
30477
+ };
30478
+
30479
+ var prevMonth = function prevMonth(date) {
30480
+ var year = date.getFullYear();
30481
+ var month = date.getMonth();
30482
+ return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
30483
+ };
30484
+
30485
+ var nextMonth = function nextMonth(date) {
30486
+ var year = date.getFullYear();
30487
+ var month = date.getMonth();
30488
+ return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
30489
+ };
30490
+
30491
+ var prevYear = function prevYear(date) {
30492
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
30493
+
30494
+ var year = date.getFullYear();
30495
+ var month = date.getMonth();
30496
+ return changeYearMonthAndClampDate(date, year - amount, month);
30497
+ };
30498
+
30499
+ var nextYear = function nextYear(date) {
30500
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
30501
+
30502
+ var year = date.getFullYear();
30503
+ var month = date.getMonth();
30504
+ return changeYearMonthAndClampDate(date, year + amount, month);
30505
+ };
30506
+
30507
+ var extractDateFormat = function extractDateFormat(format) {
30508
+ return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
30509
+ };
30510
+
30511
+ var extractTimeFormat = function extractTimeFormat(format) {
30512
+ return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
30513
+ };
30514
+
30515
+ var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
30516
+ return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
30517
+ };
30518
+
30537
30519
  /**
30538
30520
  * 计算两个日期之间的工作日数量(不包括周末和节假日)
30539
30521
  * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
30540
30522
  * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
30541
30523
  * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
30542
30524
  * @returns {number} 工作日数量
30543
- */
30544
- const calculateNetworkDays = function (start_date, end_date, holidays = []) {
30545
- if (typeof start_date !== 'string' || typeof end_date !== 'string') {
30546
- throw new Error(
30547
- "Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'."
30548
- );
30549
- }
30550
-
30551
- const startDateObj = new Date(start_date);
30552
- const endDateObj = new Date(end_date);
30553
-
30554
- if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
30555
- throw new Error(
30556
- "Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'."
30557
- );
30558
- }
30559
-
30560
- if (startDateObj > endDateObj) {
30561
- throw new Error('Start date should be earlier than or equal to end date.');
30562
- }
30563
-
30564
- let workdays = 0;
30565
-
30566
- // Iterate through each day in the date range
30567
- for (
30568
- let currentDate = new Date(startDateObj);
30569
- currentDate <= endDateObj;
30570
- currentDate.setDate(currentDate.getDate() + 1)
30571
- ) {
30572
- // Check if the current day is a weekend (Saturday or Sunday)
30573
- const isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
30574
-
30575
- // Check if the current day is a holiday
30576
- const isHoliday = holidays.some((holiday) => {
30577
- const holidayDate = new Date(holiday);
30578
- return currentDate.toDateString() === holidayDate.toDateString();
30579
- });
30580
-
30581
- // If it's a workday (not a weekend or holiday), increment the workdays count
30582
- if (!isWeekend && !isHoliday) {
30583
- workdays++;
30584
- }
30585
- }
30586
-
30587
- return workdays;
30588
- };
30589
-
30525
+ */
30526
+ var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
30527
+ var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
30528
+
30529
+ if (typeof start_date !== 'string' || typeof end_date !== 'string') {
30530
+ throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
30531
+ }
30532
+
30533
+ var startDateObj = new Date(start_date);
30534
+ var endDateObj = new Date(end_date);
30535
+
30536
+ if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
30537
+ throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
30538
+ }
30539
+
30540
+ if (startDateObj > endDateObj) {
30541
+ throw new Error('Start date should be earlier than or equal to end date.');
30542
+ }
30543
+
30544
+ var workdays = 0;
30545
+
30546
+ // Iterate through each day in the date range
30547
+
30548
+ var _loop = function _loop(currentDate) {
30549
+ // Check if the current day is a weekend (Saturday or Sunday)
30550
+ var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
30551
+
30552
+ // Check if the current day is a holiday
30553
+ var isHoliday = holidays.some(function (holiday) {
30554
+ var holidayDate = new Date(holiday);
30555
+ return currentDate.toDateString() === holidayDate.toDateString();
30556
+ });
30557
+
30558
+ // If it's a workday (not a weekend or holiday), increment the workdays count
30559
+ if (!isWeekend && !isHoliday) {
30560
+ workdays++;
30561
+ }
30562
+ };
30563
+
30564
+ for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
30565
+ _loop(currentDate);
30566
+ }
30567
+
30568
+ return workdays;
30569
+ };
30570
+
30590
30571
  /**
30591
30572
  * 日期加减天数
30592
30573
  * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
30593
30574
  * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
30594
30575
  * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
30595
- */
30596
- const dateAddDays = function (start_date, days) {
30597
- if (typeof start_date !== 'string' || !Number.isInteger(days)) {
30598
- throw new Error(
30599
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days."
30600
- );
30601
- }
30602
-
30603
- const startDateObj = new Date(start_date);
30604
- if (isNaN(startDateObj.getTime())) {
30605
- throw new Error(
30606
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
30607
- );
30608
- }
30609
-
30610
- const resultDateObj = new Date(startDateObj);
30611
- resultDateObj.setDate(resultDateObj.getDate() + days);
30612
-
30613
- const resultYear = resultDateObj.getFullYear();
30614
- const resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
30615
- const resultDay = String(resultDateObj.getDate()).padStart(2, '0');
30616
-
30617
- return `${resultYear}-${resultMonth}-${resultDay}`;
30618
- };
30619
-
30576
+ */
30577
+ var dateAddDays = function dateAddDays(start_date, days) {
30578
+ if (typeof start_date !== 'string' || !Number.isInteger(days)) {
30579
+ 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.");
30580
+ }
30581
+
30582
+ var startDateObj = new Date(start_date);
30583
+ if (isNaN(startDateObj.getTime())) {
30584
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
30585
+ }
30586
+
30587
+ var resultDateObj = new Date(startDateObj);
30588
+ resultDateObj.setDate(resultDateObj.getDate() + days);
30589
+
30590
+ var resultYear = resultDateObj.getFullYear();
30591
+ var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
30592
+ var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
30593
+
30594
+ return resultYear + '-' + resultMonth + '-' + resultDay;
30595
+ };
30596
+
30620
30597
  /**
30621
30598
  * 计算两个日期之间的差值
30622
30599
  * @date 2023年12月14日
@@ -30624,204 +30601,202 @@ const dateAddDays = function (start_date, days) {
30624
30601
  * @param {String} end_date - 结束日期字符串
30625
30602
  * @param {String} unit - 单位:year/month/day
30626
30603
  * @returns {Number} 差值
30627
- */
30628
- const dateDiff = function (start_date, end_date, unit = 'day') {
30629
- // Assuming date strings are in "YYYY-MM-DD" format
30630
- var startDate = new Date(start_date);
30631
- var endDate = new Date(end_date);
30632
-
30633
- // If the date is invalid, return 0
30634
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
30635
- return 0;
30636
- }
30637
-
30638
- if (unit === 'year') {
30639
- return endDate.getFullYear() - startDate.getFullYear();
30640
- } else if (unit === 'month') {
30641
- return (
30642
- (endDate.getFullYear() - startDate.getFullYear()) * 12 +
30643
- (endDate.getMonth() - startDate.getMonth())
30644
- );
30645
- } else {
30646
- // Default to day
30647
- var timeDifference = endDate - startDate;
30648
- // Calculate days (86400000 milliseconds per day)
30649
- return Math.floor(timeDifference / 86400000);
30650
- }
30651
- };
30652
-
30604
+ */
30605
+ var dateDiff = function dateDiff(start_date, end_date) {
30606
+ var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
30607
+
30608
+ // Assuming date strings are in "YYYY-MM-DD" format
30609
+ var startDate = new Date(start_date);
30610
+ var endDate = new Date(end_date);
30611
+
30612
+ // If the date is invalid, return 0
30613
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
30614
+ return 0;
30615
+ }
30616
+
30617
+ if (unit === 'year') {
30618
+ return endDate.getFullYear() - startDate.getFullYear();
30619
+ } else if (unit === 'month') {
30620
+ return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
30621
+ } else {
30622
+ // Default to day
30623
+ var timeDifference = endDate - startDate;
30624
+ // Calculate days (86400000 milliseconds per day)
30625
+ return Math.floor(timeDifference / 86400000);
30626
+ }
30627
+ };
30628
+
30653
30629
  /**
30654
30630
  * 获取月份中的日期
30655
30631
  * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
30656
30632
  * @returns {number} 月份中的日期(1-31)
30657
- */
30658
- const dayOfMonth = function (date) {
30659
- if (typeof date !== 'string') {
30660
- throw new Error(
30661
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'."
30662
- );
30663
- }
30664
-
30665
- const dateObj = new Date(date);
30666
- if (isNaN(dateObj.getTime())) {
30667
- throw new Error(
30668
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
30669
- );
30670
- }
30671
-
30672
- return dateObj.getDate();
30673
- };
30674
-
30633
+ */
30634
+ var dayOfMonth = function dayOfMonth(date) {
30635
+ if (typeof date !== 'string') {
30636
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
30637
+ }
30638
+
30639
+ var dateObj = new Date(date);
30640
+ if (isNaN(dateObj.getTime())) {
30641
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
30642
+ }
30643
+
30644
+ return dateObj.getDate();
30645
+ };
30646
+
30675
30647
  /**
30676
30648
  * 获取当前日期
30677
30649
  * @date 2022年5月7日
30678
30650
  * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
30679
30651
  * @returns {string} 当前日期的格式化字符串
30680
- */
30681
- const getCurrentDate = function (format = 'YYYY-MM-DD') {
30682
- return formatDate(new Date(), format);
30683
- };
30684
-
30652
+ */
30653
+ var getCurrentDate = function getCurrentDate() {
30654
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
30655
+
30656
+ return formatDate(new Date(), format);
30657
+ };
30658
+
30685
30659
  /**
30686
30660
  * 获取当前日期时间
30687
30661
  * @date 2022年5月7日
30688
30662
  * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
30689
30663
  * @returns {string} 当前日期时间的格式化字符串
30690
- */
30691
- const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
30692
- return formatDate(new Date(), format);
30693
- };
30694
-
30664
+ */
30665
+ var getCurrentDateTime = function getCurrentDateTime() {
30666
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
30667
+
30668
+ return formatDate(new Date(), format);
30669
+ };
30670
+
30695
30671
  /**
30696
30672
  * 获取小时
30697
30673
  * @date 2022年5月7日
30698
30674
  * @param {Date|string} [date] - 日期对象或日期字符串
30699
30675
  * @returns {number} 小时数(0-23)
30700
- */
30701
- const getHour = function (date) {
30702
- if (!date) {
30703
- return new Date().getHours();
30704
- }
30705
- if (typeof date === 'string') {
30706
- date = new Date(date);
30707
- }
30708
- return date.getHours();
30709
- };
30710
-
30676
+ */
30677
+ var getHour = function getHour(date) {
30678
+ if (!date) {
30679
+ return new Date().getHours();
30680
+ }
30681
+ if (typeof date === 'string') {
30682
+ date = new Date(date);
30683
+ }
30684
+ return date.getHours();
30685
+ };
30686
+
30711
30687
  /**
30712
30688
  * 获取分钟
30713
30689
  * @date 2022年5月7日
30714
30690
  * @param {Date|string} [date] - 日期对象或日期字符串
30715
30691
  * @returns {number} 分钟数(0-59)
30716
- */
30717
- const getMinute = function (date) {
30718
- if (!date) {
30719
- return new Date().getMinutes();
30720
- }
30721
- if (typeof date === 'string') {
30722
- date = new Date(date);
30723
- }
30724
- return date.getMinutes();
30725
- };
30726
-
30692
+ */
30693
+ var getMinute = function getMinute(date) {
30694
+ if (!date) {
30695
+ return new Date().getMinutes();
30696
+ }
30697
+ if (typeof date === 'string') {
30698
+ date = new Date(date);
30699
+ }
30700
+ return date.getMinutes();
30701
+ };
30702
+
30727
30703
  /**
30728
30704
  * 获取月份
30729
30705
  * @date 2022年5月7日
30730
30706
  * @param {Date|string} [date] - 日期对象或日期字符串
30731
30707
  * @returns {number} 月份数(1-12)
30732
- */
30733
- const getMonth = function (date) {
30734
- if (!date) {
30735
- return new Date().getMonth() + 1;
30736
- }
30737
- if (typeof date === 'string') {
30738
- date = new Date(date);
30739
- }
30740
- return date.getMonth() + 1;
30741
- };
30742
-
30708
+ */
30709
+ var getMonth = function getMonth(date) {
30710
+ if (!date) {
30711
+ return new Date().getMonth() + 1;
30712
+ }
30713
+ if (typeof date === 'string') {
30714
+ date = new Date(date);
30715
+ }
30716
+ return date.getMonth() + 1;
30717
+ };
30718
+
30743
30719
  /**
30744
30720
  * 获取秒
30745
30721
  * @date 2022年5月7日
30746
30722
  * @param {Date|string} [date] - 日期对象或日期字符串
30747
30723
  * @returns {number} 秒数(0-59)
30748
- */
30749
- const getSecond = function (date) {
30750
- if (!date) {
30751
- return new Date().getSeconds();
30752
- }
30753
- if (typeof date === 'string') {
30754
- date = new Date(date);
30755
- }
30756
- return date.getSeconds();
30757
- };
30758
-
30724
+ */
30725
+ var getSecond = function getSecond(date) {
30726
+ if (!date) {
30727
+ return new Date().getSeconds();
30728
+ }
30729
+ if (typeof date === 'string') {
30730
+ date = new Date(date);
30731
+ }
30732
+ return date.getSeconds();
30733
+ };
30734
+
30759
30735
  /**
30760
30736
  * 获取星期几
30761
30737
  * @date 2022年5月7日
30762
30738
  * @param {Date|string} [date] - 日期对象或日期字符串
30763
30739
  * @returns {number} 星期几(0-6,0表示星期日)
30764
- */
30765
- const getWeekday = function (date) {
30766
- if (!date) {
30767
- return new Date().getDay();
30768
- }
30769
- if (typeof date === 'string') {
30770
- date = new Date(date);
30771
- }
30772
- return date.getDay();
30773
- };
30774
-
30775
-
30740
+ */
30741
+ var getWeekday = function getWeekday(date) {
30742
+ if (!date) {
30743
+ return new Date().getDay();
30744
+ }
30745
+ if (typeof date === 'string') {
30746
+ date = new Date(date);
30747
+ }
30748
+ return date.getDay();
30749
+ };
30750
+
30776
30751
  /**
30777
30752
  * @desc 获取上午/下午/晚上
30778
30753
  * @author huangbo
30779
30754
  * @date 2022年5月7日
30780
30755
  * @param {String} [time] - 时间
30781
- **/
30782
- const timeCycle = function (time) {
30783
- let hour = 0;
30784
- if (!time) {
30785
- hour = new Date().getHours();
30786
- } else if (typeof time === 'string') {
30787
- // 从时间字符串中提取小时
30788
- const match = time.match(/^(\d{1,2})/);
30789
- if (match) {
30790
- hour = parseInt(match[1], 10);
30791
- }
30792
- } else if (typeof time === 'number') {
30793
- hour = time;
30794
- }
30795
- // 判断时间段
30796
- if (hour >= 5 && hour < 12) {
30797
- return '上午';
30798
- } else if (hour >= 12 && hour < 18) {
30799
- return '下午';
30800
- } else {
30801
- return '晚上';
30802
- }
30756
+ **/
30757
+ var timeCycle = function timeCycle(time) {
30758
+ var hour = 0;
30759
+ if (!time) {
30760
+ hour = new Date().getHours();
30761
+ } else if (typeof time === 'string') {
30762
+ // 从时间字符串中提取小时
30763
+ var match = time.match(/^(\d{1,2})/);
30764
+ if (match) {
30765
+ hour = parseInt(match[1], 10);
30766
+ }
30767
+ } else if (typeof time === 'number') {
30768
+ hour = time;
30769
+ }
30770
+ // 判断时间段
30771
+ if (hour >= 5 && hour < 12) {
30772
+ return '上午';
30773
+ } else if (hour >= 12 && hour < 18) {
30774
+ return '下午';
30775
+ } else {
30776
+ return '晚上';
30777
+ }
30803
30778
  };
30804
30779
 
30805
30780
  /***/ }),
30806
30781
 
30807
- /***/ 78:
30782
+ /***/ 79:
30808
30783
  /***/ (function(module, exports) {
30809
30784
 
30810
30785
  module.exports = require("eoss/lib/collapse");
30811
30786
 
30812
30787
  /***/ }),
30813
30788
 
30814
- /***/ 79:
30789
+ /***/ 8:
30815
30790
  /***/ (function(module, exports) {
30816
30791
 
30817
- module.exports = require("eoss/lib/collapse-item");
30792
+ module.exports = require("eoss/lib/message-box");
30818
30793
 
30819
30794
  /***/ }),
30820
30795
 
30821
- /***/ 8:
30796
+ /***/ 80:
30822
30797
  /***/ (function(module, exports) {
30823
30798
 
30824
- module.exports = require("eoss/lib/message-box");
30799
+ module.exports = require("eoss/lib/collapse-item");
30825
30800
 
30826
30801
  /***/ }),
30827
30802
 
@@ -30832,7 +30807,7 @@ module.exports = require("eoss/lib/message");
30832
30807
 
30833
30808
  /***/ }),
30834
30809
 
30835
- /***/ 92:
30810
+ /***/ 94:
30836
30811
  /***/ (function(module, exports) {
30837
30812
 
30838
30813
  module.exports = require("eoss/lib/table");