eoss 0.1.0-alpha.23 → 0.1.0-alpha.25

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 (277) hide show
  1. package/lib/0.js +1 -0
  2. package/lib/1.js +1 -0
  3. package/lib/10.js +1 -0
  4. package/lib/11.js +1 -0
  5. package/lib/12.js +1 -0
  6. package/lib/13.js +1 -0
  7. package/lib/14.js +1 -0
  8. package/lib/15.js +1 -0
  9. package/lib/16.js +1 -0
  10. package/lib/17.js +1 -0
  11. package/lib/18.js +1 -0
  12. package/lib/19.js +1 -0
  13. package/lib/20.js +1 -0
  14. package/lib/21.js +1 -0
  15. package/lib/22.js +1 -0
  16. package/lib/23.js +1 -0
  17. package/lib/24.js +1 -0
  18. package/lib/25.js +1 -0
  19. package/lib/26.js +1 -0
  20. package/lib/27.js +1 -0
  21. package/lib/28.js +1 -0
  22. package/lib/29.js +1 -0
  23. package/lib/3.js +1 -0
  24. package/lib/30.js +1 -0
  25. package/lib/31.js +1 -0
  26. package/lib/32.js +1 -0
  27. package/lib/33.js +1 -0
  28. package/lib/34.js +1 -0
  29. package/lib/35.js +1 -0
  30. package/lib/36.js +1 -0
  31. package/lib/37.js +1 -0
  32. package/lib/38.js +1 -0
  33. package/lib/39.js +1 -0
  34. package/lib/4.js +1 -0
  35. package/lib/40.js +1 -0
  36. package/lib/41.js +1 -0
  37. package/lib/42.js +1 -0
  38. package/lib/43.js +1 -0
  39. package/lib/44.js +1 -0
  40. package/lib/45.js +1 -0
  41. package/lib/46.js +1 -0
  42. package/lib/47.js +1 -0
  43. package/lib/48.js +1 -0
  44. package/lib/49.js +1 -0
  45. package/lib/5.js +1 -0
  46. package/lib/50.js +1 -0
  47. package/lib/51.js +1 -0
  48. package/lib/52.js +1 -0
  49. package/lib/53.js +1 -0
  50. package/lib/54.js +1 -0
  51. package/lib/55.js +1 -0
  52. package/lib/56.js +1 -0
  53. package/lib/57.js +1 -0
  54. package/lib/58.js +1 -0
  55. package/lib/59.js +1 -0
  56. package/lib/6.js +1 -0
  57. package/lib/60.js +1 -0
  58. package/lib/61.js +1 -0
  59. package/lib/62.js +1 -0
  60. package/lib/63.js +1 -0
  61. package/lib/64.js +1 -0
  62. package/lib/65.js +1 -0
  63. package/lib/66.js +1 -0
  64. package/lib/67.js +1 -0
  65. package/lib/68.js +1 -0
  66. package/lib/69.js +1 -0
  67. package/lib/7.js +1 -0
  68. package/lib/70.js +1 -0
  69. package/lib/71.js +1 -0
  70. package/lib/72.js +1 -0
  71. package/lib/73.js +1 -0
  72. package/lib/74.js +1 -0
  73. package/lib/75.js +1 -0
  74. package/lib/76.js +1 -0
  75. package/lib/77.js +1 -0
  76. package/lib/78.js +1 -0
  77. package/lib/79.js +1 -0
  78. package/lib/8.js +1 -0
  79. package/lib/80.js +1 -0
  80. package/lib/81.js +1 -0
  81. package/lib/9.js +1 -0
  82. package/lib/account-login.js +1662 -1557
  83. package/lib/alert.js +2 -2
  84. package/lib/aside.js +2 -2
  85. package/lib/audit-trajectory.js +924 -0
  86. package/lib/autocomplete.js +2403 -2559
  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 +2 -2
  91. package/lib/breadcrumb.js +2 -2
  92. package/lib/button-group.js +13 -13
  93. package/lib/button.js +2 -2
  94. package/lib/ca-login.js +1299 -1295
  95. package/lib/calendar.js +972 -997
  96. package/lib/card.js +2 -2
  97. package/lib/carousel-item.js +1295 -1291
  98. package/lib/carousel.js +1297 -1293
  99. package/lib/cascader-panel.js +1317 -1313
  100. package/lib/cascader.js +2423 -2579
  101. package/lib/checkbox-button.js +2 -2
  102. package/lib/checkbox-group.js +1691 -1627
  103. package/lib/checkbox.js +9 -42
  104. package/lib/col.js +2 -2
  105. package/lib/collapse-item.js +2849 -2971
  106. package/lib/collapse.js +2853 -2971
  107. package/lib/color-picker.js +955 -1115
  108. package/lib/config/api.js +77 -1
  109. package/lib/container.js +2 -2
  110. package/lib/cron.js +2 -2
  111. package/lib/data-table.js +1800 -1693
  112. package/lib/date-picker.js +2412 -2568
  113. package/lib/dialog.js +1485 -1479
  114. package/lib/divider.js +2 -2
  115. package/lib/drawer.js +4 -4
  116. package/lib/dropdown-item.js +2 -2
  117. package/lib/dropdown-menu.js +944 -1104
  118. package/lib/dropdown.js +1507 -1503
  119. package/lib/email-login.js +1651 -1554
  120. package/lib/empty.js +2 -2
  121. package/lib/eoss.common.js +23671 -15705
  122. package/lib/flip.js +2 -2
  123. package/lib/flow-group.js +1305 -1301
  124. package/lib/flow.js +1807 -1710
  125. package/lib/flows.js +1653 -1556
  126. package/lib/footer.js +2 -2
  127. package/lib/form-item.js +1282 -1278
  128. package/lib/form.js +2869 -2982
  129. package/lib/header.js +2 -2
  130. package/lib/icon.js +1526 -1409
  131. package/lib/icons.js +2 -2
  132. package/lib/image-viewer.js +1369 -1365
  133. package/lib/image.js +71 -71
  134. package/lib/index.js +1 -1
  135. package/lib/infinite-scroll.js +71 -71
  136. package/lib/input-number.js +4 -4
  137. package/lib/input.js +1301 -1297
  138. package/lib/link.js +2 -2
  139. package/lib/loading.js +5 -5
  140. package/lib/login.js +1966 -1856
  141. package/lib/lowcode.js +9705 -4540
  142. package/lib/main.js +5414 -5317
  143. package/lib/marquee.js +1306 -1302
  144. package/lib/menu-item-group.js +2 -2
  145. package/lib/menu-item.js +2 -2
  146. package/lib/menu.js +2728 -2884
  147. package/lib/message-box.js +1370 -1366
  148. package/lib/message.js +1360 -1356
  149. package/lib/notification.js +1358 -1354
  150. package/lib/option-group.js +2 -2
  151. package/lib/option.js +1366 -1362
  152. package/lib/page-header.js +2 -2
  153. package/lib/pagination.js +1299 -1295
  154. package/lib/phone-login.js +1644 -1547
  155. package/lib/popconfirm.js +12 -12
  156. package/lib/popover.js +2289 -2445
  157. package/lib/process-config.js +7645 -0
  158. package/lib/process-module.js +7051 -0
  159. package/lib/process-rule.js +8217 -0
  160. package/lib/progress.js +2 -2
  161. package/lib/qr-code.js +7 -7
  162. package/lib/qrcode-login.js +1643 -1546
  163. package/lib/radio-button.js +10 -21
  164. package/lib/radio-group.js +1712 -1644
  165. package/lib/radio.js +10 -25
  166. package/lib/rate.js +1360 -1356
  167. package/lib/row.js +2 -2
  168. package/lib/scrollbar.js +1360 -1356
  169. package/lib/select.js +3138 -3200
  170. package/lib/selector-panel.js +1747 -1712
  171. package/lib/selector.js +1910 -1823
  172. package/lib/slider.js +2 -2
  173. package/lib/static/codicon.805fb6a.ttf +0 -0
  174. package/lib/step.js +2853 -2971
  175. package/lib/steps.js +1298 -1294
  176. package/lib/submenu.js +1454 -1614
  177. package/lib/switch.js +1297 -1293
  178. package/lib/tab-pane.js +2 -2
  179. package/lib/table-column.js +1332 -1328
  180. package/lib/table.js +3446 -3509
  181. package/lib/tabs.js +1297 -1293
  182. package/lib/tag.js +2 -2
  183. package/lib/theme-chalk/audit-trajectory.css +0 -0
  184. package/lib/theme-chalk/button-group.css +1 -1
  185. package/lib/theme-chalk/calendar.css +1 -1
  186. package/lib/theme-chalk/icons.css +1 -1
  187. package/lib/theme-chalk/index.css +1 -1
  188. package/lib/theme-chalk/lowcode.css +1 -1
  189. package/lib/theme-chalk/process-config.css +0 -0
  190. package/lib/theme-chalk/process-module.css +0 -0
  191. package/lib/theme-chalk/process-rule.css +1 -0
  192. package/lib/theme-chalk/tree.css +1 -1
  193. package/lib/theme-chalk/update-history.css +0 -0
  194. package/lib/time-picker.js +1953 -2138
  195. package/lib/time-select.js +1949 -2134
  196. package/lib/timeline-item.js +2 -2
  197. package/lib/timeline.js +2 -2
  198. package/lib/tips.js +1691 -1594
  199. package/lib/toolbar.js +6 -6
  200. package/lib/tooltip.js +2289 -2445
  201. package/lib/transfer.js +1312 -1308
  202. package/lib/tree-group.js +1526 -1409
  203. package/lib/tree.js +1721 -1624
  204. package/lib/update-history.js +879 -0
  205. package/lib/upload.js +1731 -1634
  206. package/lib/utils/ajax.js +85 -106
  207. package/lib/utils/util.js +33 -5
  208. package/package.json +1 -1
  209. package/packages/account-login/src/account-login.vue +20 -6
  210. package/packages/audit-trajectory/index.js +5 -0
  211. package/packages/audit-trajectory/src/main.vue +99 -0
  212. package/packages/button/src/button-group.vue +1 -1
  213. package/packages/checkbox/src/checkbox.vue +9 -14
  214. package/packages/data-table/src/data-table.vue +13 -4
  215. package/packages/dialog/src/dialog.vue +2 -0
  216. package/packages/form/src/form-item-render.vue +4 -0
  217. package/packages/form/src/form.vue +2 -2
  218. package/packages/login/src/login.vue +47 -46
  219. package/packages/lowcode/src/aside.vue +3 -1
  220. package/packages/lowcode/src/attribute/bind.vue +459 -233
  221. package/packages/lowcode/src/attribute/dependency.vue +492 -228
  222. package/packages/lowcode/src/attribute/function.vue +391 -48
  223. package/packages/lowcode/src/attribute/javascript.vue +380 -0
  224. package/packages/lowcode/src/attribute/property.vue +317 -228
  225. package/packages/lowcode/src/attribute/styles.vue +17 -4
  226. package/packages/lowcode/src/attribute.vue +787 -16
  227. package/packages/lowcode/src/canvas.vue +206 -27
  228. package/packages/lowcode/src/editor.vue +197 -32
  229. package/packages/lowcode/src/json.vue +63 -18
  230. package/packages/lowcode/src/lowcode.vue +253 -21
  231. package/packages/lowcode/src/mixins/history.js +132 -0
  232. package/packages/lowcode/src/pages.vue +0 -52
  233. package/packages/lowcode/src/render.vue +108 -8
  234. package/packages/lowcode/src/source.vue +72 -16
  235. package/packages/lowcode/src/toolbar.vue +43 -20
  236. package/packages/lowcode/src/util/json-repair.js +147 -0
  237. package/packages/lowcode/src/util/monaco-vue-completions.js +344 -0
  238. package/packages/lowcode/src/util/source-generator.js +535 -0
  239. package/packages/lowcode/src/util/source-parser.js +461 -0
  240. package/packages/lowcode/src/view.vue +187 -0
  241. package/packages/lowcode-view/index.js +5 -0
  242. package/packages/process-config/index.js +5 -0
  243. package/packages/process-config/src/FormList.vue +180 -0
  244. package/packages/process-config/src/NodeConfig.vue +212 -0
  245. package/packages/process-config/src/NodeForm.vue +237 -0
  246. package/packages/process-config/src/main.vue +257 -0
  247. package/packages/process-module/index.js +5 -0
  248. package/packages/process-module/src/FormList.vue +177 -0
  249. package/packages/process-module/src/main.vue +233 -0
  250. package/packages/process-rule/index.js +5 -0
  251. package/packages/process-rule/src/FormList.vue +614 -0
  252. package/packages/process-rule/src/companyReportDetail.vue +92 -0
  253. package/packages/process-rule/src/main.vue +749 -0
  254. package/packages/radio/src/radio-button.vue +12 -9
  255. package/packages/radio/src/radio-group.vue +10 -14
  256. package/packages/radio/src/radio.vue +12 -11
  257. package/packages/select/src/option-tree.vue +4 -4
  258. package/packages/select/src/option.vue +2 -2
  259. package/packages/select/src/select.vue +32 -36
  260. package/packages/selector/src/selector.vue +10 -12
  261. package/packages/theme-chalk/src/audit-trajectory.scss +0 -0
  262. package/packages/theme-chalk/src/button-group.scss +7 -0
  263. package/packages/theme-chalk/src/icons.scss +1 -1
  264. package/packages/theme-chalk/src/index.scss +5 -0
  265. package/packages/theme-chalk/src/lowcode.scss +90 -1
  266. package/packages/theme-chalk/src/process-config.scss +0 -0
  267. package/packages/theme-chalk/src/process-module.scss +0 -0
  268. package/packages/theme-chalk/src/process-rule.scss +57 -0
  269. package/packages/theme-chalk/src/tree.scss +1 -0
  270. package/packages/theme-chalk/src/update-history.scss +0 -0
  271. package/packages/update-history/index.js +5 -0
  272. package/packages/update-history/src/main.vue +54 -0
  273. package/src/components/field-render.vue +5 -0
  274. package/src/config/api.js +77 -0
  275. package/src/index.js +322 -307
  276. package/src/utils/ajax.js +90 -115
  277. package/src/utils/util.js +35 -4
package/lib/form-item.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 = 172);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 180);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -91,32 +91,32 @@ module.exports =
91
91
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
92
92
 
93
93
  "use strict";
94
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return noop; });
95
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return hasOwn; });
96
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return toObject; });
97
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return getValueByPath; });
98
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return getPropByPath; });
94
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return noop; });
95
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return hasOwn; });
96
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return toObject; });
97
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return getValueByPath; });
98
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return getPropByPath; });
99
99
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return generateId; });
100
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return valueEquals; });
100
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return valueEquals; });
101
101
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return escapeRegexpString; });
102
102
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return arrayFindIndex; });
103
103
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return arrayFind; });
104
104
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return coerceTruthyValueToArray; });
105
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return isIE; });
106
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return isEdge; });
107
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return isFirefox; });
105
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return isIE; });
106
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return isEdge; });
107
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return isFirefox; });
108
108
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return autoprefixer; });
109
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return kebabCase; });
109
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return kebabCase; });
110
110
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return capitalize; });
111
111
  /* unused harmony export looseEqual */
112
112
  /* unused harmony export arrayEquals */
113
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return isEqual; });
114
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return rafThrottle; });
113
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return isEqual; });
114
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return rafThrottle; });
115
115
  /* unused harmony export objToArray */
116
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return requestAnimationFrame; });
116
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return requestAnimationFrame; });
117
117
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return cancelAnimationFrame; });
118
118
  /* unused harmony export debounce */
119
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return throttle; });
119
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return throttle; });
120
120
  /* unused harmony export guid */
121
121
  /* unused harmony export uid */
122
122
  /* unused harmony export get */
@@ -124,7 +124,7 @@ module.exports =
124
124
  /* unused harmony export cloneDeep */
125
125
  /* unused harmony export grouping */
126
126
  /* unused harmony export pager */
127
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return getWinTop; });
127
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return getWinTop; });
128
128
  /* unused harmony export getFileType */
129
129
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return arrUnique; });
130
130
  /* unused harmony export average */
@@ -142,59 +142,60 @@ module.exports =
142
142
  /* unused harmony export exportXls */
143
143
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return extend; });
144
144
  /* unused harmony export getObjectType */
145
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return getParams; });
145
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return getParams; });
146
146
  /* unused harmony export getScript */
147
147
  /* unused harmony export getStyle */
148
148
  /* unused harmony export getTypeName */
149
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return getTypePrefix; });
149
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return getTypePrefix; });
150
150
  /* unused harmony export getValues */
151
151
  /* unused harmony export getZoom */
152
152
  /* unused harmony export getLength */
153
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return timestampUrl; });
153
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return timestampUrl; });
154
154
  /* unused harmony export hasChars */
155
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return identical; });
156
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return indexOfObj; });
157
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return isEmpty; });
158
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return isExist; });
155
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return identical; });
156
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return indexOfObj; });
157
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return isEmpty; });
158
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return isExist; });
159
159
  /* unused harmony export isFunction */
160
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return isObjectEqual; });
161
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return joinUrl; });
162
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return layoutWaterfall; });
160
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return isObjectEqual; });
161
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return joinUrl; });
162
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return getHorizontalMargin; });
163
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return layoutWaterfall; });
163
164
  /* unused harmony export loadJs */
164
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return loading; });
165
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return loading; });
165
166
  /* unused harmony export lowerCase */
166
167
  /* unused harmony export overbrim */
167
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return queryParams; });
168
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return queryParams; });
168
169
  /* unused harmony export receiveMessage */
169
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return renderIcon; });
170
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return renderIcon; });
170
171
  /* unused harmony export replenish */
171
172
  /* unused harmony export rmbToCapital */
172
173
  /* unused harmony export setScale */
173
174
  /* unused harmony export sendMessage */
174
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return setFavicon; });
175
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return setFavicon; });
175
176
  /* unused harmony export sum */
176
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return startWith; });
177
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return startWith; });
177
178
  /* unused harmony export takeLeft */
178
179
  /* unused harmony export takeRight */
179
180
  /* unused harmony export trimWhitespace */
180
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return toFixed; });
181
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return toFixed; });
181
182
  /* unused harmony export toFunction */
182
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return updateTheme; });
183
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return updateTheme; });
183
184
  /* unused harmony export upperType */
184
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return urlJoinParams; });
185
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return uuid; });
186
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bb", function() { return watermark; });
185
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return urlJoinParams; });
186
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return uuid; });
187
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cb", function() { return watermark; });
187
188
  /* unused harmony export winTopOpen */
188
189
  /* unused harmony export confirm */
189
190
  /* unused harmony export success */
190
191
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return error; });
191
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ab", function() { return warning; });
192
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bb", function() { return warning; });
192
193
  /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
193
194
  /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
194
195
  /* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
195
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
196
- /* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
197
- /* harmony import */ var _date__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1);
196
+ /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
197
+ /* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
198
+ /* harmony import */ var _date__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2);
198
199
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
199
200
 
200
201
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
@@ -204,9 +205,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
204
205
 
205
206
 
206
207
 
207
- var _get = __webpack_require__(20);
208
- var _set = __webpack_require__(21);
209
- var _cloneDeep = __webpack_require__(22);
208
+ var _get = __webpack_require__(19);
209
+ var _set = __webpack_require__(20);
210
+ var _cloneDeep = __webpack_require__(21);
210
211
  var hasOwnProperty = Object.prototype.hasOwnProperty;
211
212
 
212
213
  // 导入date中的formatDate函数
@@ -2014,13 +2015,38 @@ var joinUrl = function joinUrl(_ref8) {
2014
2015
  // 如果前缀类型无效,直接返回URL
2015
2016
  return url;
2016
2017
  };
2018
+ /**
2019
+ * 解析节点 style 里的 margin,返回左右水平总占用(px)
2020
+ * 支持 marginLeft/marginRight 分项、'20px' 单值简写、'10px 20px' 两值简写
2021
+ **/
2022
+ var getHorizontalMargin = function getHorizontalMargin(style) {
2023
+ if (!style) return 0;
2024
+ var toPx = function toPx(val) {
2025
+ return val ? parseFloat(val) || 0 : 0;
2026
+ };
2027
+ // 驼峰(marginLeft)和连字符(margin-left)两种键名都兼容
2028
+ var left = toPx(style.marginLeft || style['margin-left']);
2029
+ var right = toPx(style.marginRight || style['margin-right']);
2030
+ if (left || right) {
2031
+ return left + right;
2032
+ }
2033
+ if (style.margin) {
2034
+ var parts = String(style.margin).trim().split(/\s+/).map(toPx);
2035
+ if (parts.length === 1) {
2036
+ return parts[0] * 2;
2037
+ }
2038
+ if (parts.length >= 2) {
2039
+ return parts[1] * 2;
2040
+ }
2041
+ }
2042
+ return 0;
2043
+ };
2044
+
2017
2045
  /**
2018
2046
  * layoutWaterfall
2019
- * @desc 布布流布局计算
2047
+ * @desc 瀑布流布局计算
2020
2048
  * @author huangbo
2021
2049
  * @date 2022年5月7日
2022
- * @param {String} url - JS文件地址
2023
- * @param {Function} [callback] - 回调函数
2024
2050
  **/
2025
2051
  var layoutWaterfall = function layoutWaterfall(self, container, pages, columns, gap) {
2026
2052
  if (!container) return;
@@ -2070,7 +2096,10 @@ var layoutWaterfall = function layoutWaterfall(self, container, pages, columns,
2070
2096
  // 计算元素宽度和位置
2071
2097
  var existingWidth = item.style && item.style.width ? parseInt(item.style.width, 10) : null;
2072
2098
  var hasSpan = item.style && item.style.span || item.span;
2073
- var calculatedWidth = columnWidth * span + gap * (span - 1);
2099
+ // margin 在盒模型之外也要占列槽,槽内可用宽度需扣除水平 margin,
2100
+ // 保证 width + margin 刚好填满 span 个列槽(border-box 下 border 已含在 width 里)
2101
+ var marginH = getHorizontalMargin(item.style);
2102
+ var calculatedWidth = columnWidth * span + gap * (span - 1) - marginH;
2074
2103
  var useCustomWidth = !hasSpan && existingWidth;
2075
2104
  var elementWidth = useCustomWidth ? existingWidth : calculatedWidth;
2076
2105
 
@@ -3011,1038 +3040,286 @@ var warning = function warning(content, _callback3) {
3011
3040
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3012
3041
 
3013
3042
  "use strict";
3014
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return fecha; });
3015
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return getSettings; });
3016
- /* unused harmony export toDate */
3017
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return isDate; });
3018
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return isDateObject; });
3019
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return formatDate; });
3020
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return parseDate; });
3021
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getDayCountOfMonth; });
3022
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getDayCountOfYear; });
3023
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return getFirstDayOfMonth; });
3024
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return prevDate; });
3025
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return nextDate; });
3026
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return getStartDateOfMonth; });
3027
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return getWeekNumber; });
3028
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return getRangeHours; });
3029
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return getPrevMonthLastDays; });
3030
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return getMonthDays; });
3031
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return getRangeMinutes; });
3032
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return range; });
3033
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return modifyDate; });
3034
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return modifyTime; });
3035
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return modifyWithTimeString; });
3036
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return clearTime; });
3037
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return clearMilliseconds; });
3038
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return limitTimeRange; });
3039
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return timeWithinRange; });
3040
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return changeYearMonthAndClampDate; });
3041
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return prevMonth; });
3042
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return nextMonth; });
3043
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return prevYear; });
3044
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return nextYear; });
3045
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return extractDateFormat; });
3046
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return extractTimeFormat; });
3047
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return validateRangeInOneMonth; });
3048
- /* unused harmony export calculateNetworkDays */
3049
- /* unused harmony export dateAddDays */
3050
- /* unused harmony export dateDiff */
3051
- /* unused harmony export dayOfMonth */
3052
- /* unused harmony export getCurrentDate */
3053
- /* unused harmony export getCurrentDateTime */
3054
- /* unused harmony export getHour */
3055
- /* unused harmony export getMinute */
3056
- /* unused harmony export getMonth */
3057
- /* unused harmony export getSecond */
3058
- /* unused harmony export getWeekday */
3059
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
3060
- /* Modified from https://github.com/taylorhakes/fecha
3061
- *
3062
- * The MIT License (MIT)
3063
- *
3064
- * Copyright (c) 2015 Taylor Hakes
3065
- *
3066
- * Permission is hereby granted, free of charge, to any person obtaining a copy
3067
- * of this software and associated documentation files (the "Software"), to deal
3068
- * in the Software without restriction, including without limitation the rights
3069
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3070
- * copies of the Software, and to permit persons to whom the Software is
3071
- * furnished to do so, subject to the following conditions:
3072
- *
3073
- * The above copyright notice and this permission notice shall be included in all
3074
- * copies or substantial portions of the Software.
3075
- *
3076
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3077
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3078
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3079
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3080
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3081
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3082
- * SOFTWARE.
3083
- */
3084
-
3085
- /*eslint-disable*/
3086
- // 把 YYYY-MM-DD 改成了 yyyy-MM-dd
3087
-
3088
-
3089
- /**
3090
- * Parse or format dates
3091
- * @class fecha
3092
- */
3093
- const fecha = {};
3094
- const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
3095
- const twoDigits = '\\d\\d?';
3096
- const threeDigits = '\\d{3}';
3097
- const fourDigits = '\\d{4}';
3098
- const word = '[^\\s]+';
3099
- const literal = /\[([^]*?)\]/gm;
3100
- const noop = function () {};
3101
-
3102
- function regexEscape(str) {
3103
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
3104
- }
3105
-
3106
- function shorten(arr, sLen) {
3107
- const newArr = [];
3108
- for (let i = 0, len = arr.length; i < len; i++) {
3109
- newArr.push(arr[i].substr(0, sLen));
3110
- }
3111
- return newArr;
3112
- }
3113
-
3114
- function monthUpdate() {
3115
- return function (d, v) {
3116
- const index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
3117
- if (~index) {
3118
- d.month = index;
3119
- }
3120
- };
3121
- }
3122
-
3123
- function pad(val, len) {
3124
- val = String(val);
3125
- len = len || 2;
3126
- while (val.length < len) {
3127
- val = '0' + val;
3128
- }
3129
- return val;
3130
- }
3131
-
3132
- // 直接使用中文日期名称常量
3133
- const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
3134
- const monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
3135
- const monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
3136
- const dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
3137
- const amPm = ['上午', '下午'];
3138
- const DoFn = function DoFn(D) {
3139
- return D + '日';
3140
- };
3141
-
3142
- const formatFlags = {
3143
- D: function(dateObj) {
3144
- return dateObj.getDay();
3145
- },
3146
- DD: function(dateObj) {
3147
- return pad(dateObj.getDay());
3148
- },
3149
- Do: function(dateObj) {
3150
- return DoFn(dateObj.getDate());
3151
- },
3152
- d: function(dateObj) {
3153
- return dateObj.getDate();
3154
- },
3155
- dd: function(dateObj) {
3156
- return pad(dateObj.getDate());
3157
- },
3158
- ddd: function(dateObj) {
3159
- return dayNamesShort[dateObj.getDay()];
3160
- },
3161
- dddd: function(dateObj) {
3162
- return dayNames[dateObj.getDay()];
3163
- },
3164
- M: function(dateObj) {
3165
- return dateObj.getMonth() + 1;
3166
- },
3167
- MM: function(dateObj) {
3168
- return pad(dateObj.getMonth() + 1);
3169
- },
3170
- MMM: function(dateObj) {
3171
- return monthNamesShort[dateObj.getMonth()];
3172
- },
3173
- MMMM: function(dateObj) {
3174
- return monthNames[dateObj.getMonth()];
3175
- },
3176
- yy: function(dateObj) {
3177
- return pad(String(dateObj.getFullYear()), 4).substr(2);
3178
- },
3179
- yyyy: function(dateObj) {
3180
- return pad(dateObj.getFullYear(), 4);
3181
- },
3182
- h: function(dateObj) {
3183
- return dateObj.getHours() % 12 || 12;
3184
- },
3185
- hh: function(dateObj) {
3186
- return pad(dateObj.getHours() % 12 || 12);
3187
- },
3188
- H: function(dateObj) {
3189
- return dateObj.getHours();
3190
- },
3191
- HH: function(dateObj) {
3192
- return pad(dateObj.getHours());
3193
- },
3194
- m: function(dateObj) {
3195
- return dateObj.getMinutes();
3196
- },
3197
- mm: function(dateObj) {
3198
- return pad(dateObj.getMinutes());
3199
- },
3200
- s: function(dateObj) {
3201
- return dateObj.getSeconds();
3202
- },
3203
- ss: function(dateObj) {
3204
- return pad(dateObj.getSeconds());
3205
- },
3206
- S: function(dateObj) {
3207
- return Math.round(dateObj.getMilliseconds() / 100);
3208
- },
3209
- SS: function(dateObj) {
3210
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
3211
- },
3212
- SSS: function(dateObj) {
3213
- return pad(dateObj.getMilliseconds(), 3);
3214
- },
3215
- a: function(dateObj) {
3216
- return dateObj.getHours() < 12 ? '上午' : '下午';
3217
- },
3218
- A: function(dateObj) {
3219
- return dateObj.getHours() < 12 ? '上午' : '下午';
3220
- },
3221
- ZZ: function(dateObj) {
3222
- const o = dateObj.getTimezoneOffset();
3223
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
3224
- }
3225
- };
3226
-
3227
- const parseFlags = {
3228
- d: [twoDigits, function (d, v) {
3229
- d.day = v;
3230
- }],
3231
- Do: [twoDigits + word, function (d, v) {
3232
- d.day = parseInt(v, 10);
3233
- }],
3234
- M: [twoDigits, function (d, v) {
3235
- d.month = v - 1;
3236
- }],
3237
- yy: [twoDigits, function (d, v) {
3238
- const da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
3239
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
3240
- }],
3241
- h: [twoDigits, function (d, v) {
3242
- d.hour = v;
3243
- }],
3244
- m: [twoDigits, function (d, v) {
3245
- d.minute = v;
3246
- }],
3247
- s: [twoDigits, function (d, v) {
3248
- d.second = v;
3249
- }],
3250
- yyyy: [fourDigits, function (d, v) {
3251
- d.year = v;
3252
- }],
3253
- S: ['\\d', function (d, v) {
3254
- d.millisecond = v * 100;
3255
- }],
3256
- SS: ['\\d{2}', function (d, v) {
3257
- d.millisecond = v * 10;
3258
- }],
3259
- SSS: [threeDigits, function (d, v) {
3260
- d.millisecond = v;
3261
- }],
3262
- D: [twoDigits, noop],
3263
- ddd: [word, noop],
3264
- MMM: [word, monthUpdate('monthNamesShort')],
3265
- MMMM: [word, monthUpdate('monthNames')],
3266
- a: [word, function (d, v) {
3267
- const val = v.toLowerCase();
3268
- if (val === '上午') {
3269
- d.isPm = false;
3270
- } else if (val === '下午') {
3271
- d.isPm = true;
3272
- }
3273
- }],
3274
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
3275
- let parts = (v + '').match(/([+-]|\d\d)/gi), minutes;
3276
-
3277
- if (parts) {
3278
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
3279
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
3280
- }
3281
- }]
3282
- };
3283
- parseFlags.dd = parseFlags.d;
3284
- parseFlags.dddd = parseFlags.ddd;
3285
- parseFlags.DD = parseFlags.D;
3286
- parseFlags.mm = parseFlags.m;
3287
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
3288
- parseFlags.MM = parseFlags.M;
3289
- parseFlags.ss = parseFlags.s;
3290
- parseFlags.A = parseFlags.a;
3291
-
3292
-
3293
- // Some common format strings
3294
- fecha.masks = {
3295
- default: 'ddd MMM dd yyyy HH:mm:ss',
3296
- shortDate: 'M/D/yy',
3297
- mediumDate: 'MMM d, yyyy',
3298
- longDate: 'MMMM d, yyyy',
3299
- fullDate: 'dddd, MMMM d, yyyy',
3300
- shortTime: 'HH:mm',
3301
- mediumTime: 'HH:mm:ss',
3302
- longTime: 'HH:mm:ss.SSS'
3303
- };
3304
-
3305
- /***
3306
- * Format a date
3307
- * @method format
3308
- * @param {Date|number} dateObj
3309
- * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
3310
- */
3311
- fecha.format = function (dateObj, mask) {
3312
- if (typeof dateObj === 'number') {
3313
- dateObj = new Date(dateObj);
3314
- }
3315
-
3316
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
3317
- throw new Error('Invalid Date in fecha.format');
3318
- }
3319
-
3320
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
3321
-
3322
- const literals = [];
3323
-
3324
- // Make literals inactive by replacing them with ??
3325
- mask = mask.replace(literal, function($0, $1) {
3326
- literals.push($1);
3327
- return '@@@';
3328
- });
3329
- // Apply formatting rules
3330
- mask = mask.replace(token, function ($0) {
3331
- return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
3332
- });
3333
- // Inline literal values back into the formatted value
3334
- return mask.replace(/@@@/g, function() {
3335
- return literals.shift();
3336
- });
3337
- };
3338
-
3339
- /**
3340
- * Parse a date string into an object, changes - into /
3341
- * @method parse
3342
- * @param {string} dateStr Date string
3343
- * @param {string} format Date parse format
3344
- * @returns {Date|boolean}
3345
- */
3346
- fecha.parse = function (dateStr, format) {
3347
- if (typeof format !== 'string') {
3348
- throw new Error('Invalid format in fecha.parse');
3349
- }
3350
-
3351
- format = fecha.masks[format] || format;
3352
-
3353
- // Avoid regular expression denial of service, fail early for really long strings
3354
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
3355
- if (dateStr.length > 1000) {
3356
- return null;
3357
- }
3358
-
3359
- const dateInfo = {};
3360
- const parseInfo = [];
3361
- const literals = [];
3362
- format = format.replace(literal, function($0, $1) {
3363
- literals.push($1);
3364
- return '@@@';
3365
- });
3366
- let newFormat = regexEscape(format).replace(token, function ($0) {
3367
- if (parseFlags[$0]) {
3368
- const info = parseFlags[$0];
3369
- parseInfo.push(info[1]);
3370
- return '(' + info[0] + ')';
3371
- }
3372
-
3373
- return $0;
3374
- });
3375
- newFormat = newFormat.replace(/@@@/g, function() {
3376
- return literals.shift();
3377
- });
3378
- const matches = dateStr.match(new RegExp(newFormat, 'i'));
3379
- if (!matches) {
3380
- return null;
3381
- }
3382
-
3383
- for (let i = 1; i < matches.length; i++) {
3384
- parseInfo[i - 1](dateInfo, matches[i]);
3385
- }
3386
-
3387
- const today = new Date();
3388
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
3389
- dateInfo.hour = +dateInfo.hour + 12;
3390
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
3391
- dateInfo.hour = 0;
3392
- }
3393
-
3394
- let date;
3395
- if (dateInfo.timezoneOffset != null) {
3396
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
3397
- date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
3398
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
3399
- } else {
3400
- date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
3401
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
3402
- }
3403
- return date;
3404
- };
3405
-
3406
- // 导出fecha对象
3407
-
3408
-
3409
- // 以下是从date-util.js合并的函数
3410
- const newArray = function(start, end) {
3411
- let result = [];
3412
- for (let i = start; i <= end; i++) {
3413
- result.push(i);
3414
- }
3415
- return result;
3416
- };
3417
-
3418
- const getSettings = () => {
3419
- return {
3420
- dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
3421
- dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
3422
- monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
3423
- monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
3424
- amPm: ['上午', '下午']
3425
- };
3426
- };
3427
-
3428
- const toDate = function(date) {
3429
- return isDate(date) ? new Date(date) : null;
3430
- };
3431
-
3432
- const isDate = function(date) {
3433
- if (date === null || date === undefined) return false;
3434
- if (isNaN(new Date(date).getTime())) return false;
3435
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
3436
- return true;
3437
- };
3438
-
3439
- const isDateObject = function(val) {
3440
- return val instanceof Date;
3441
- };
3442
-
3443
- const formatDate = function (date, format = 'yyyy-MM-dd') {
3444
- // 处理多种输入类型
3445
- if (!date) return '';
3446
-
3447
- // 如果是时间戳,转成日期对象
3448
- if (typeof date === 'number') {
3449
- date = new Date(date);
3450
- }
3451
- // 如果是字符串,转成日期对象
3452
- if (typeof date === 'string') {
3453
- date = new Date(date);
3454
- }
3455
-
3456
- // 调用toDate进一步验证和转换
3457
- date = toDate(date);
3458
- if (!date) return '';
3459
-
3460
- // 兼容大写和小写的格式标记
3461
- // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
3462
- const lowercaseFormat = format
3463
- .replace(/YYYY/g, 'yyyy')
3464
- .replace(/D/g, 'd')
3465
-
3466
- // 使用fecha库进行格式化,支持中文配置
3467
- const str = fecha.format(date, lowercaseFormat, getSettings());
3468
- return str;
3469
- };
3470
-
3471
- const parseDate = function(string, format) {
3472
- return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
3473
- };
3474
-
3475
- const getDayCountOfMonth = function(year, month) {
3476
- if (month === 3 || month === 5 || month === 8 || month === 10) {
3477
- return 30;
3478
- }
3479
-
3480
- if (month === 1) {
3481
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
3482
- return 29;
3483
- } else {
3484
- return 28;
3485
- }
3486
- }
3487
-
3488
- return 31;
3489
- };
3490
-
3491
- const getDayCountOfYear = function(year) {
3492
- const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
3493
- return isLeapYear ? 366 : 365;
3494
- };
3495
-
3496
- const getFirstDayOfMonth = function(date) {
3497
- const temp = new Date(date.getTime());
3498
- temp.setDate(1);
3499
- return temp.getDay();
3500
- };
3501
-
3502
- // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
3503
- // {prev, next} Date should work for Daylight Saving Time
3504
- // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
3505
- const prevDate = function(date, amount = 1) {
3506
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
3507
- };
3508
-
3509
- const nextDate = function(date, amount = 1) {
3510
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
3511
- };
3512
-
3513
- const getStartDateOfMonth = function(year, month) {
3514
- const result = new Date(year, month, 1);
3515
- const day = result.getDay();
3516
-
3517
- if (day === 0) {
3518
- return prevDate(result, 7);
3519
- } else {
3520
- return prevDate(result, day);
3521
- }
3522
- };
3523
-
3524
- const getWeekNumber = function(date) {
3525
- // 支持多种输入类型
3526
- if (!date||!isDate(date)) {
3527
- date = new Date();
3528
- }
3529
- if (typeof date === 'string') {
3530
- date = new Date(date);
3531
- }
3532
-
3533
- // 验证日期有效性
3534
- if (!isDate(date)) return null;
3535
-
3536
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
3537
- // 设置为最近的星期四:当前日期 + 4 - 当前星期数
3538
- // 将星期日的星期数设为7
3539
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
3540
- // 获取当年的第一天
3541
- const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
3542
- // 计算到最近的星期四的完整周数
3543
- const weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
3544
- // 返回周数
3545
- return weekNo;
3546
- };
3547
-
3548
- const getRangeHours = function(ranges) {
3549
- const hours = [];
3550
- let disabledHours = [];
3551
-
3552
- (ranges || []).forEach(range => {
3553
- const value = range.map(date => date.getHours());
3554
-
3555
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
3556
- });
3557
-
3558
- if (disabledHours.length) {
3559
- for (let i = 0; i < 24; i++) {
3560
- hours[i] = disabledHours.indexOf(i) === -1;
3561
- }
3562
- } else {
3563
- for (let i = 0; i < 24; i++) {
3564
- hours[i] = false;
3565
- }
3566
- }
3567
-
3568
- return hours;
3569
- };
3570
-
3571
- const getPrevMonthLastDays = (date, amount) => {
3572
- if (amount <= 0) return [];
3573
- const temp = new Date(date.getTime());
3574
- temp.setDate(0);
3575
- const lastDay = temp.getDate();
3576
- return range(amount).map((_, index) => lastDay - (amount - index - 1));
3577
- };
3578
-
3579
- const getMonthDays = (date) => {
3580
- const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
3581
- const days = temp.getDate();
3582
- return range(days).map((_, index) => index + 1);
3583
- };
3584
-
3585
- function setRangeData(arr, start, end, value) {
3586
- for (let i = start; i < end; i++) {
3587
- arr[i] = value;
3588
- }
3589
- }
3590
-
3591
- const getRangeMinutes = function(ranges, hour) {
3592
- const minutes = new Array(60);
3593
-
3594
- if (ranges.length > 0) {
3595
- ranges.forEach(range => {
3596
- const start = range[0];
3597
- const end = range[1];
3598
- const startHour = start.getHours();
3599
- const startMinute = start.getMinutes();
3600
- const endHour = end.getHours();
3601
- const endMinute = end.getMinutes();
3602
- if (startHour === hour && endHour !== hour) {
3603
- setRangeData(minutes, startMinute, 60, true);
3604
- } else if (startHour === hour && endHour === hour) {
3605
- setRangeData(minutes, startMinute, endMinute + 1, true);
3606
- } else if (startHour !== hour && endHour === hour) {
3607
- setRangeData(minutes, 0, endMinute + 1, true);
3608
- } else if (startHour < hour && endHour > hour) {
3609
- setRangeData(minutes, 0, 60, true);
3610
- }
3611
- });
3612
- } else {
3613
- setRangeData(minutes, 0, 60, true);
3614
- }
3615
- return minutes;
3616
- };
3617
-
3618
- const range = function(n) {
3619
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
3620
- return Array.apply(null, {length: n}).map((_, n) => n);
3621
- };
3622
-
3623
- const modifyDate = function(date, y, m, d) {
3624
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
3625
- };
3626
-
3627
- const modifyTime = function(date, h, m, s) {
3628
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
3629
- };
3630
-
3631
- const modifyWithTimeString = (date, time) => {
3632
- if (date == null || !time) {
3633
- return date;
3634
- }
3635
- time = parseDate(time, 'HH:mm:ss');
3636
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
3637
- };
3638
-
3639
- const clearTime = function(date) {
3640
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
3641
- };
3642
-
3643
- const clearMilliseconds = function(date) {
3644
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
3645
- };
3646
-
3647
- const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
3648
- // TODO: refactory a more elegant solution
3649
- if (ranges.length === 0) return date;
3650
- const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
3651
- const ndate = normalizeDate(date);
3652
- const nranges = ranges.map(range => range.map(normalizeDate));
3653
- if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
3654
-
3655
- let minDate = nranges[0][0];
3656
- let maxDate = nranges[0][0];
3657
-
3658
- nranges.forEach(nrange => {
3659
- minDate = new Date(Math.min(nrange[0], minDate));
3660
- maxDate = new Date(Math.max(nrange[1], minDate));
3661
- });
3662
-
3663
- const ret = ndate < minDate ? minDate : maxDate;
3664
- // preserve Year/Month/Date
3665
- return modifyDate(
3666
- ret,
3667
- date.getFullYear(),
3668
- date.getMonth(),
3669
- date.getDate()
3670
- );
3671
- };
3672
-
3673
- const timeWithinRange = function(date, selectableRange, format) {
3674
- const limitedDate = limitTimeRange(date, selectableRange, format);
3675
- return limitedDate.getTime() === date.getTime();
3676
- };
3677
-
3678
- const changeYearMonthAndClampDate = function(date, year, month) {
3679
- // clamp date to the number of days in `year`, `month`
3680
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
3681
- const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
3682
- return modifyDate(date, year, month, monthDate);
3683
- };
3684
-
3685
- const prevMonth = function(date) {
3686
- const year = date.getFullYear();
3687
- const month = date.getMonth();
3688
- return month === 0
3689
- ? changeYearMonthAndClampDate(date, year - 1, 11)
3690
- : changeYearMonthAndClampDate(date, year, month - 1);
3691
- };
3692
-
3693
- const nextMonth = function(date) {
3694
- const year = date.getFullYear();
3695
- const month = date.getMonth();
3696
- return month === 11
3697
- ? changeYearMonthAndClampDate(date, year + 1, 0)
3698
- : changeYearMonthAndClampDate(date, year, month + 1);
3699
- };
3700
-
3701
- const prevYear = function(date, amount = 1) {
3702
- const year = date.getFullYear();
3703
- const month = date.getMonth();
3704
- return changeYearMonthAndClampDate(date, year - amount, month);
3705
- };
3706
-
3707
- const nextYear = function(date, amount = 1) {
3708
- const year = date.getFullYear();
3709
- const month = date.getMonth();
3710
- return changeYearMonthAndClampDate(date, year + amount, month);
3711
- };
3712
-
3713
- const extractDateFormat = function(format) {
3714
- return format
3715
- .replace(/\W?m{1,2}|\W?ZZ/g, '')
3716
- .replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
3717
- .trim();
3718
- };
3719
-
3720
- const extractTimeFormat = function(format) {
3721
- return format
3722
- .replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
3723
- .trim();
3724
- };
3725
-
3726
- const validateRangeInOneMonth = function(start, end) {
3727
- return (start.getMonth() === end.getMonth()) && (start.getFullYear() === end.getFullYear());
3728
- };
3729
-
3730
- /**
3731
- * 计算两个日期之间的工作日数量(不包括周末和节假日)
3732
- * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
3733
- * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
3734
- * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
3735
- * @returns {number} 工作日数量
3736
- */
3737
- const calculateNetworkDays = function (start_date, end_date, holidays = []) {
3738
- if (typeof start_date !== 'string' || typeof end_date !== 'string') {
3739
- throw new Error(
3740
- "Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'."
3741
- );
3742
- }
3743
-
3744
- const startDateObj = new Date(start_date);
3745
- const endDateObj = new Date(end_date);
3746
-
3747
- if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
3748
- throw new Error(
3749
- "Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'."
3750
- );
3751
- }
3752
-
3753
- if (startDateObj > endDateObj) {
3754
- throw new Error('Start date should be earlier than or equal to end date.');
3755
- }
3756
-
3757
- let workdays = 0;
3758
-
3759
- // Iterate through each day in the date range
3760
- for (
3761
- let currentDate = new Date(startDateObj);
3762
- currentDate <= endDateObj;
3763
- currentDate.setDate(currentDate.getDate() + 1)
3764
- ) {
3765
- // Check if the current day is a weekend (Saturday or Sunday)
3766
- const isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
3767
-
3768
- // Check if the current day is a holiday
3769
- const isHoliday = holidays.some((holiday) => {
3770
- const holidayDate = new Date(holiday);
3771
- return currentDate.toDateString() === holidayDate.toDateString();
3772
- });
3773
-
3774
- // If it's a workday (not a weekend or holiday), increment the workdays count
3775
- if (!isWeekend && !isHoliday) {
3776
- workdays++;
3777
- }
3778
- }
3779
-
3780
- return workdays;
3781
- };
3782
-
3783
- /**
3784
- * 日期加减天数
3785
- * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
3786
- * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
3787
- * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
3788
- */
3789
- const dateAddDays = function (start_date, days) {
3790
- if (typeof start_date !== 'string' || !Number.isInteger(days)) {
3791
- throw new Error(
3792
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days."
3793
- );
3794
- }
3795
-
3796
- const startDateObj = new Date(start_date);
3797
- if (isNaN(startDateObj.getTime())) {
3798
- throw new Error(
3799
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
3800
- );
3801
- }
3802
-
3803
- const resultDateObj = new Date(startDateObj);
3804
- resultDateObj.setDate(resultDateObj.getDate() + days);
3805
-
3806
- const resultYear = resultDateObj.getFullYear();
3807
- const resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
3808
- const resultDay = String(resultDateObj.getDate()).padStart(2, '0');
3809
-
3810
- return `${resultYear}-${resultMonth}-${resultDay}`;
3811
- };
3812
-
3813
- /**
3814
- * 计算两个日期之间的差值
3815
- * @date 2023年12月14日
3816
- * @param {String} start_date - 起始日期字符串
3817
- * @param {String} end_date - 结束日期字符串
3818
- * @param {String} unit - 单位:year/month/day
3819
- * @returns {Number} 差值
3820
- */
3821
- const dateDiff = function (start_date, end_date, unit = 'day') {
3822
- // Assuming date strings are in "YYYY-MM-DD" format
3823
- var startDate = new Date(start_date);
3824
- var endDate = new Date(end_date);
3825
-
3826
- // If the date is invalid, return 0
3827
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
3828
- return 0;
3829
- }
3830
-
3831
- if (unit === 'year') {
3832
- return endDate.getFullYear() - startDate.getFullYear();
3833
- } else if (unit === 'month') {
3834
- return (
3835
- (endDate.getFullYear() - startDate.getFullYear()) * 12 +
3836
- (endDate.getMonth() - startDate.getMonth())
3837
- );
3838
- } else {
3839
- // Default to day
3840
- var timeDifference = endDate - startDate;
3841
- // Calculate days (86400000 milliseconds per day)
3842
- return Math.floor(timeDifference / 86400000);
3843
- }
3844
- };
3845
-
3846
- /**
3847
- * 获取月份中的日期
3848
- * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
3849
- * @returns {number} 月份中的日期(1-31)
3850
- */
3851
- const dayOfMonth = function (date) {
3852
- if (typeof date !== 'string') {
3853
- throw new Error(
3854
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'."
3855
- );
3856
- }
3857
-
3858
- const dateObj = new Date(date);
3859
- if (isNaN(dateObj.getTime())) {
3860
- throw new Error(
3861
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
3862
- );
3863
- }
3864
-
3865
- return dateObj.getDate();
3866
- };
3867
-
3868
- /**
3869
- * 获取当前日期
3870
- * @date 2022年5月7日
3871
- * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
3872
- * @returns {string} 当前日期的格式化字符串
3873
- */
3874
- const getCurrentDate = function (format = 'YYYY-MM-DD') {
3875
- return formatDate(new Date(), format);
3876
- };
3877
-
3878
- /**
3879
- * 获取当前日期时间
3880
- * @date 2022年5月7日
3881
- * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
3882
- * @returns {string} 当前日期时间的格式化字符串
3883
- */
3884
- const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
3885
- return formatDate(new Date(), format);
3886
- };
3887
-
3888
- /**
3889
- * 获取小时
3890
- * @date 2022年5月7日
3891
- * @param {Date|string} [date] - 日期对象或日期字符串
3892
- * @returns {number} 小时数(0-23)
3893
- */
3894
- const getHour = function (date) {
3895
- if (!date) {
3896
- return new Date().getHours();
3897
- }
3898
- if (typeof date === 'string') {
3899
- date = new Date(date);
3900
- }
3901
- return date.getHours();
3902
- };
3903
-
3904
- /**
3905
- * 获取分钟
3906
- * @date 2022年5月7日
3907
- * @param {Date|string} [date] - 日期对象或日期字符串
3908
- * @returns {number} 分钟数(0-59)
3909
- */
3910
- const getMinute = function (date) {
3911
- if (!date) {
3912
- return new Date().getMinutes();
3913
- }
3914
- if (typeof date === 'string') {
3915
- date = new Date(date);
3916
- }
3917
- return date.getMinutes();
3918
- };
3919
-
3920
- /**
3921
- * 获取月份
3922
- * @date 2022年5月7日
3923
- * @param {Date|string} [date] - 日期对象或日期字符串
3924
- * @returns {number} 月份数(1-12)
3925
- */
3926
- const getMonth = function (date) {
3927
- if (!date) {
3928
- return new Date().getMonth() + 1;
3929
- }
3930
- if (typeof date === 'string') {
3931
- date = new Date(date);
3932
- }
3933
- return date.getMonth() + 1;
3934
- };
3935
-
3936
- /**
3937
- * 获取秒
3938
- * @date 2022年5月7日
3939
- * @param {Date|string} [date] - 日期对象或日期字符串
3940
- * @returns {number} 秒数(0-59)
3941
- */
3942
- const getSecond = function (date) {
3943
- if (!date) {
3944
- return new Date().getSeconds();
3945
- }
3946
- if (typeof date === 'string') {
3947
- date = new Date(date);
3948
- }
3949
- return date.getSeconds();
3950
- };
3951
-
3952
- /**
3953
- * 获取星期几
3954
- * @date 2022年5月7日
3955
- * @param {Date|string} [date] - 日期对象或日期字符串
3956
- * @returns {number} 星期几(0-6,0表示星期日)
3957
- */
3958
- const getWeekday = function (date) {
3959
- if (!date) {
3960
- return new Date().getDay();
3961
- }
3962
- if (typeof date === 'string') {
3963
- date = new Date(date);
3964
- }
3965
- return date.getDay();
3966
- };
3967
-
3968
-
3969
- /**
3970
- * @desc 获取上午/下午/晚上
3971
- * @author huangbo
3972
- * @date 2022年5月7日
3973
- * @param {String} [time] - 时间
3974
- **/
3975
- const timeCycle = function (time) {
3976
- let hour = 0;
3977
- if (!time) {
3978
- hour = new Date().getHours();
3979
- } else if (typeof time === 'string') {
3980
- // 从时间字符串中提取小时
3981
- const match = time.match(/^(\d{1,2})/);
3982
- if (match) {
3983
- hour = parseInt(match[1], 10);
3984
- }
3985
- } else if (typeof time === 'number') {
3986
- hour = time;
3987
- }
3988
- // 判断时间段
3989
- if (hour >= 5 && hour < 12) {
3990
- return '上午';
3991
- } else if (hour >= 12 && hour < 18) {
3992
- return '下午';
3993
- } else {
3994
- return '晚上';
3995
- }
3996
- };
3997
-
3998
- /***/ }),
3043
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setStorage; });
3044
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getStorage; });
3045
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return removeStorage; });
3046
+ /* unused harmony export setCookie */
3047
+ /* unused harmony export getCookie */
3048
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
3999
3049
 
4000
- /***/ 10:
4001
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
3050
+ /**
3051
+ * setStorage
3052
+ * @desc:设置本地储存数据
3053
+ * @author huangbo
3054
+ * @date 2022年5月7日
3055
+ * @param {String|Object} [key] - 数据的名称或包含type、key、value的对象
3056
+ * @param {String} [value] - 数据的值(当第一个参数为字符串时使用)
3057
+ **/
3058
+ var setStorage = function setStorage(key, value) {
3059
+ // 解析参数,支持两种调用方式:setStorage(key, value) 和 setStorage({type, key, value})
3060
+ var type = void 0,
3061
+ finalKey = void 0,
3062
+ finalValue = void 0;
4002
3063
 
4003
- "use strict";
4004
- function _broadcast(componentName, eventName, params) {
4005
- this.$children.forEach(function (child) {
4006
- var name = child.$options.componentName;
3064
+ if ((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object' && key !== null) {
3065
+ // 对象调用方式:setStorage({type, key, value})
3066
+ type = key.type;
3067
+ finalKey = key.key;
3068
+ finalValue = key.value;
3069
+ } else {
3070
+ // 字符串调用方式:setStorage(key, value)
3071
+ type = getStorage('storageType');
3072
+ finalKey = key;
3073
+ finalValue = value;
3074
+ }
4007
3075
 
4008
- if (name === componentName) {
4009
- child.$emit.apply(child, [eventName].concat(params));
4010
- } else {
4011
- _broadcast.apply(child, [componentName, eventName].concat([params]));
4012
- }
4013
- });
4014
- }
4015
- /* harmony default export */ __webpack_exports__["a"] = ({
4016
- methods: {
4017
- dispatch: function dispatch(componentName, eventName, params) {
4018
- var parent = this.$parent || this.$root;
4019
- var name = parent.$options.componentName;
3076
+ // 使用默认存储类型如果未指定
3077
+ type = type || getStorage('storageType');
4020
3078
 
4021
- while (parent && (!name || name !== componentName)) {
4022
- parent = parent.$parent;
3079
+ // 获取存储对象
3080
+ var storage = type === 'localStorage' ? localStorage : sessionStorage;
4023
3081
 
4024
- if (parent) {
4025
- name = parent.$options.componentName;
4026
- }
3082
+ // 处理不同类型的key
3083
+ if (typeof finalKey === 'string') {
3084
+ // 单个字符串key
3085
+ var storedValue = (typeof finalValue === 'undefined' ? 'undefined' : _typeof(finalValue)) === 'object' ? JSON.stringify(finalValue) : finalValue;
3086
+ storage.setItem(finalKey, storedValue);
3087
+ if (finalKey === 'token') {
3088
+ setCookie('token', storedValue);
3089
+ }
3090
+ } else if (Array.isArray(finalKey)) {
3091
+ // 数组key,为多个key设置同一个value
3092
+ var _storedValue = (typeof finalValue === 'undefined' ? 'undefined' : _typeof(finalValue)) === 'object' ? JSON.stringify(finalValue) : finalValue;
3093
+ for (var i = 0; i < finalKey.length; i++) {
3094
+ storage.setItem(finalKey[i], _storedValue);
3095
+ if (finalKey[i] === 'token') {
3096
+ setCookie('token', _storedValue);
4027
3097
  }
4028
- if (parent) {
4029
- parent.$emit.apply(parent, [eventName].concat(params));
3098
+ }
3099
+ } else if ((typeof finalKey === 'undefined' ? 'undefined' : _typeof(finalKey)) === 'object' && finalKey !== null) {
3100
+ // 对象key,对象的属性名称作为key,属性值作为value
3101
+ for (var k in finalKey) {
3102
+ if (Object.prototype.hasOwnProperty.call(finalKey, k)) {
3103
+ var _storedValue2 = _typeof(finalKey[k]) === 'object' ? JSON.stringify(finalKey[k]) : finalKey[k];
3104
+ storage.setItem(k, _storedValue2);
3105
+ if (k === 'token') {
3106
+ setCookie('token', _storedValue2);
3107
+ }
4030
3108
  }
4031
- },
4032
- broadcast: function broadcast(componentName, eventName, params) {
4033
- _broadcast.call(this, componentName, eventName, params);
4034
3109
  }
4035
3110
  }
4036
- });
4037
-
4038
- /***/ }),
4039
-
4040
- /***/ 102:
4041
- /***/ (function(module, exports) {
3111
+ };
4042
3112
 
4043
- module.exports = require("async-validator");
3113
+ /**
3114
+ * getStorage
3115
+ * @desc:获取本地储存数据
3116
+ * @author huangbo
3117
+ * @date 2022年5月7日
3118
+ * @param {String} [key] - 获取的名称
3119
+ **/
3120
+ var getStorage = function getStorage(key) {
3121
+ if (key) {
3122
+ var res = sessionStorage.getItem(key) || localStorage.getItem(key);
3123
+ if (!res && key === 'token') {
3124
+ res = getCookie('token');
3125
+ }
3126
+ if (key === 'host' && !res) {
3127
+ res = '';
3128
+ }
3129
+ return res;
3130
+ }
3131
+ var defaults = {};
3132
+ var token = sessionStorage.getItem('token') || localStorage.getItem('token') || getCookie('token');
3133
+ var ssId = sessionStorage.getItem('ssId') || localStorage.getItem('ssId') || getCookie('ssId');
4044
3134
 
4045
- /***/ }),
3135
+ var deviceUnique = sessionStorage.getItem('deviceUnique') || localStorage.getItem('deviceUnique') || getCookie('deviceUnique');
3136
+ if (token) {
3137
+ defaults.Authorization = token;
3138
+ }
3139
+ if (ssId) {
3140
+ defaults.ssId = ssId;
3141
+ }
3142
+ if (deviceUnique) {
3143
+ defaults.deviceUnique = deviceUnique;
3144
+ }
3145
+ return defaults;
3146
+ };
3147
+
3148
+ /**
3149
+ * removeStorage
3150
+ * @desc:删除本地储存数据
3151
+ * @author huangbo
3152
+ * @date 2022年5月7日
3153
+ * @param {String, Array} [key] - 获取的名称
3154
+ **/
3155
+ var removeStorage = function removeStorage(key) {
3156
+ if (Array.isArray(key)) {
3157
+ for (var i = 0; i < key.length; i++) {
3158
+ sessionStorage.removeItem(key[i]);
3159
+ localStorage.removeItem(key[i]);
3160
+ if (key[i] === 'token') {
3161
+ removeCookie('token');
3162
+ }
3163
+ }
3164
+ } else if (key) {
3165
+ sessionStorage.removeItem(key);
3166
+ localStorage.removeItem(key);
3167
+ if (key === 'token') {
3168
+ removeCookie('token');
3169
+ }
3170
+ } else {
3171
+ sessionStorage.clear();
3172
+ localStorage.clear();
3173
+ removeCookie('token');
3174
+ }
3175
+ };
3176
+
3177
+ /**
3178
+ * setCookie
3179
+ * @desc 设置cookie
3180
+ * @author huangbo
3181
+ * @param {string} [name] cookie名称
3182
+ * @param {string} [value] cookie值
3183
+ * @param {boolean} [isSession] 是否是会话cookie
3184
+ **/
3185
+ var setCookie = function setCookie(name, value) {
3186
+ var isSession = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
3187
+ var time = arguments[3];
3188
+
3189
+ try {
3190
+ var cookieParts = [encodeURIComponent(name) + '=' + encodeURIComponent(value), 'path=/' // 仅保留path设置,确保全站访问
3191
+ ];
3192
+ // 会话/持久Cookie设置
3193
+ if (!isSession) {
3194
+ if (/MSIE|Trident/.test(navigator.userAgent)) {
3195
+ // IE使用expires
3196
+ var date = new Date();
3197
+ date.setTime(date.getTime() + (time || 7 * 24 * 60 * 60 * 1000));
3198
+ cookieParts.push('expires=' + date.toUTCString());
3199
+ } else {
3200
+ // 其他浏览器使用max-age
3201
+ cookieParts.push('max-age=' + (time || 7 * 24 * 60 * 60));
3202
+ }
3203
+ }
3204
+ // 内核兼容处理
3205
+ if (/MSIE|Trident/.test(navigator.userAgent)) {
3206
+ // IE特殊处理:添加P3P协议头
3207
+ cookieParts.push('P3P=CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
3208
+ } else {
3209
+ // 现代浏览器设置
3210
+ cookieParts.push('samesite=lax');
3211
+ if (window.location.protocol === 'https:') {
3212
+ cookieParts.push('secure');
3213
+ }
3214
+ }
3215
+
3216
+ // 设置Cookie
3217
+ document.cookie = cookieParts.join('; ');
3218
+ return true;
3219
+ } catch (e) {
3220
+ console.error('Cookie设置失败:', e);
3221
+ return false;
3222
+ }
3223
+ };
3224
+
3225
+ /**
3226
+ * getCookie
3227
+ * @desc 获取cookie中指定名称的值
3228
+ * @author huangbo
3229
+ * @param {string} [name] cookie名称
3230
+ **/
3231
+ var getCookie = function getCookie(name) {
3232
+ var cookies = document.cookie.split(';');
3233
+ for (var _iterator = cookies, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
3234
+ var _ref;
3235
+
3236
+ if (_isArray) {
3237
+ if (_i >= _iterator.length) break;
3238
+ _ref = _iterator[_i++];
3239
+ } else {
3240
+ _i = _iterator.next();
3241
+ if (_i.done) break;
3242
+ _ref = _i.value;
3243
+ }
3244
+
3245
+ var cookie = _ref;
3246
+
3247
+ var _cookie$trim$split = cookie.trim().split('='),
3248
+ cookieName = _cookie$trim$split[0],
3249
+ cookieValue = _cookie$trim$split[1];
3250
+
3251
+ if (decodeURIComponent(cookieName) === name) {
3252
+ return decodeURIComponent(cookieValue);
3253
+ }
3254
+ }
3255
+ return null;
3256
+ };
3257
+
3258
+ /**
3259
+ * removeCookie
3260
+ * @desc:删除cookie
3261
+ * @author huangbo
3262
+ * @date 2022年5月7日
3263
+ * @param {String, Array} [key] - 获取的名称
3264
+ **/
3265
+ var removeCookie = function removeCookie(key) {
3266
+ if (Array.isArray(key)) {
3267
+ for (var i = 0; i < key.length; i++) {
3268
+ document.cookie = encodeURIComponent(key[i]) + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
3269
+ }
3270
+ } else {
3271
+ document.cookie = encodeURIComponent(key) + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
3272
+ }
3273
+ };
3274
+
3275
+ /***/ }),
3276
+
3277
+ /***/ 10:
3278
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
3279
+
3280
+ "use strict";
3281
+ function _broadcast(componentName, eventName, params) {
3282
+ this.$children.forEach(function (child) {
3283
+ var name = child.$options.componentName;
3284
+
3285
+ if (name === componentName) {
3286
+ child.$emit.apply(child, [eventName].concat(params));
3287
+ } else {
3288
+ _broadcast.apply(child, [componentName, eventName].concat([params]));
3289
+ }
3290
+ });
3291
+ }
3292
+ /* harmony default export */ __webpack_exports__["a"] = ({
3293
+ methods: {
3294
+ dispatch: function dispatch(componentName, eventName, params) {
3295
+ var parent = this.$parent || this.$root;
3296
+ var name = parent.$options.componentName;
3297
+
3298
+ while (parent && (!name || name !== componentName)) {
3299
+ parent = parent.$parent;
3300
+
3301
+ if (parent) {
3302
+ name = parent.$options.componentName;
3303
+ }
3304
+ }
3305
+ if (parent) {
3306
+ parent.$emit.apply(parent, [eventName].concat(params));
3307
+ }
3308
+ },
3309
+ broadcast: function broadcast(componentName, eventName, params) {
3310
+ _broadcast.call(this, componentName, eventName, params);
3311
+ }
3312
+ }
3313
+ });
3314
+
3315
+ /***/ }),
3316
+
3317
+ /***/ 107:
3318
+ /***/ (function(module, exports) {
3319
+
3320
+ module.exports = require("async-validator");
3321
+
3322
+ /***/ }),
4046
3323
 
4047
3324
  /***/ 12:
4048
3325
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -4107,7 +3384,7 @@ var getColor = function getColor($color, $n) {
4107
3384
  var getLightness = function getLightness($v, $i, $isLight) {
4108
3385
  var $value = $isLight ? $v + $brightnessStep1 * $i : $v - $brightnessStep2 * $i;
4109
3386
  $value = $value < 1 ? $value : 1;
4110
- return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "U"])($value, 2);
3387
+ return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "V"])($value, 2);
4111
3388
  };
4112
3389
 
4113
3390
  /**
@@ -4131,7 +3408,7 @@ var getSaturation = function getSaturation($s, $i, $isLight) {
4131
3408
  $saturation = 0.1;
4132
3409
  }
4133
3410
  $saturation = $saturation > 0.06 ? $saturation : 0.06;
4134
- return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "U"])($saturation, 2);
3411
+ return Object(_util__WEBPACK_IMPORTED_MODULE_0__[/* toFixed */ "V"])($saturation, 2);
4135
3412
  };
4136
3413
 
4137
3414
  /**
@@ -4267,7 +3544,14 @@ var getRgb = function getRgb($color) {
4267
3544
 
4268
3545
  /***/ }),
4269
3546
 
4270
- /***/ 172:
3547
+ /***/ 18:
3548
+ /***/ (function(module, exports) {
3549
+
3550
+ module.exports = require("eoss/lib/loading");
3551
+
3552
+ /***/ }),
3553
+
3554
+ /***/ 180:
4271
3555
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4272
3556
 
4273
3557
  "use strict";
@@ -4378,7 +3662,7 @@ render._withStripped = true
4378
3662
  // CONCATENATED MODULE: ./packages/form/src/form-item.vue?vue&type=template&id=5f256888&
4379
3663
 
4380
3664
  // EXTERNAL MODULE: external "async-validator"
4381
- var external_async_validator_ = __webpack_require__(102);
3665
+ var external_async_validator_ = __webpack_require__(107);
4382
3666
  var external_async_validator_default = /*#__PURE__*/__webpack_require__.n(external_async_validator_);
4383
3667
 
4384
3668
  // EXTERNAL MODULE: ./src/mixins/emitter.js
@@ -4957,7 +4241,7 @@ function debounce(fn) {
4957
4241
  // 优化路径解析逻辑
4958
4242
  var target = this.index === undefined ? model : this.name ? model[this.name] && model[this.name][this.index] : model[this.index];
4959
4243
 
4960
- return target ? Object(util["t" /* getPropByPath */])(target, path, true).v : undefined;
4244
+ return target ? Object(util["u" /* getPropByPath */])(target, path, true).v : undefined;
4961
4245
  },
4962
4246
  isRequired: function isRequired() {
4963
4247
  // 缓存规则计算结果
@@ -5009,7 +4293,7 @@ function debounce(fn) {
5009
4293
  validate: function validate(trigger) {
5010
4294
  var _this2 = this;
5011
4295
 
5012
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : util["L" /* noop */];
4296
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : util["M" /* noop */];
5013
4297
 
5014
4298
  this.validateDisabled = false;
5015
4299
  var rules = this.getFilteredRule(trigger);
@@ -5065,7 +4349,7 @@ function debounce(fn) {
5065
4349
 
5066
4350
  var prop = void 0;
5067
4351
  try {
5068
- prop = Object(util["t" /* getPropByPath */])(model, normalizedPath, true);
4352
+ prop = Object(util["u" /* getPropByPath */])(model, normalizedPath, true);
5069
4353
  } catch (error) {
5070
4354
  console.error('获取属性路径失败:', error);
5071
4355
  return;
@@ -5110,7 +4394,7 @@ function debounce(fn) {
5110
4394
  var formFieldRules = [];
5111
4395
  if (formRules && this.prop) {
5112
4396
  try {
5113
- var prop = Object(util["t" /* getPropByPath */])(formRules, this.prop);
4397
+ var prop = Object(util["u" /* getPropByPath */])(formRules, this.prop);
5114
4398
  formFieldRules = prop.o[this.prop] || prop.v || [];
5115
4399
  } catch (error) {
5116
4400
  console.warn('\u83B7\u53D6\u8868\u5355\u89C4\u5219\u5931\u8D25: ' + this.prop, error);
@@ -5259,10 +4543,10 @@ form_item.install = function (Vue) {
5259
4543
 
5260
4544
  /***/ }),
5261
4545
 
5262
- /***/ 18:
4546
+ /***/ 19:
5263
4547
  /***/ (function(module, exports) {
5264
4548
 
5265
- module.exports = require("eoss/lib/loading");
4549
+ module.exports = require("lodash/get");
5266
4550
 
5267
4551
  /***/ }),
5268
4552
 
@@ -5270,235 +4554,962 @@ module.exports = require("eoss/lib/loading");
5270
4554
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5271
4555
 
5272
4556
  "use strict";
5273
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return setStorage; });
5274
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getStorage; });
5275
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return removeStorage; });
5276
- /* unused harmony export setCookie */
5277
- /* unused harmony export getCookie */
5278
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4557
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return fecha; });
4558
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return getSettings; });
4559
+ /* unused harmony export toDate */
4560
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return isDate; });
4561
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return isDateObject; });
4562
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return formatDate; });
4563
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return parseDate; });
4564
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getDayCountOfMonth; });
4565
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getDayCountOfYear; });
4566
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return getFirstDayOfMonth; });
4567
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return prevDate; });
4568
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return nextDate; });
4569
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return getStartDateOfMonth; });
4570
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return getWeekNumber; });
4571
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return getRangeHours; });
4572
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return getPrevMonthLastDays; });
4573
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return getMonthDays; });
4574
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return getRangeMinutes; });
4575
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return range; });
4576
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return modifyDate; });
4577
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return modifyTime; });
4578
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return modifyWithTimeString; });
4579
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return clearTime; });
4580
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return clearMilliseconds; });
4581
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return limitTimeRange; });
4582
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return timeWithinRange; });
4583
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return changeYearMonthAndClampDate; });
4584
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return prevMonth; });
4585
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return nextMonth; });
4586
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return prevYear; });
4587
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return nextYear; });
4588
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return extractDateFormat; });
4589
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return extractTimeFormat; });
4590
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return validateRangeInOneMonth; });
4591
+ /* unused harmony export calculateNetworkDays */
4592
+ /* unused harmony export dateAddDays */
4593
+ /* unused harmony export dateDiff */
4594
+ /* unused harmony export dayOfMonth */
4595
+ /* unused harmony export getCurrentDate */
4596
+ /* unused harmony export getCurrentDateTime */
4597
+ /* unused harmony export getHour */
4598
+ /* unused harmony export getMinute */
4599
+ /* unused harmony export getMonth */
4600
+ /* unused harmony export getSecond */
4601
+ /* unused harmony export getWeekday */
4602
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
5279
4603
 
5280
- /**
5281
- * setStorage
5282
- * @desc:设置本地储存数据
5283
- * @author huangbo
5284
- * @date 2022年5月7日
5285
- * @param {String|Object} [key] - 数据的名称或包含type、key、value的对象
5286
- * @param {String} [value] - 数据的值(当第一个参数为字符串时使用)
5287
- **/
5288
- var setStorage = function setStorage(key, value) {
5289
- // 解析参数,支持两种调用方式:setStorage(key, value) 和 setStorage({type, key, value})
5290
- var type = void 0,
5291
- finalKey = void 0,
5292
- finalValue = void 0;
5293
4604
 
5294
- if ((typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object' && key !== null) {
5295
- // 对象调用方式:setStorage({type, key, value})
5296
- type = key.type;
5297
- finalKey = key.key;
5298
- finalValue = key.value;
4605
+ /**
4606
+ * Parse or format dates
4607
+ * @class fecha
4608
+ */
4609
+ var fecha = {};
4610
+ var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
4611
+ var twoDigits = '\\d\\d?';
4612
+ var threeDigits = '\\d{3}';
4613
+ var fourDigits = '\\d{4}';
4614
+ var word = '[^\\s]+';
4615
+ var literal = /\[([^]*?)\]/gm;
4616
+ var noop = function noop() {};
4617
+
4618
+ function regexEscape(str) {
4619
+ return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
4620
+ }
4621
+
4622
+ function shorten(arr, sLen) {
4623
+ var newArr = [];
4624
+ for (var i = 0, len = arr.length; i < len; i++) {
4625
+ newArr.push(arr[i].substr(0, sLen));
4626
+ }
4627
+ return newArr;
4628
+ }
4629
+
4630
+ function monthUpdate() {
4631
+ return function (d, v) {
4632
+ var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
4633
+ if (~index) {
4634
+ d.month = index;
4635
+ }
4636
+ };
4637
+ }
4638
+
4639
+ function pad(val, len) {
4640
+ val = String(val);
4641
+ len = len || 2;
4642
+ while (val.length < len) {
4643
+ val = '0' + val;
4644
+ }
4645
+ return val;
4646
+ }
4647
+
4648
+ // 直接使用中文日期名称常量
4649
+ var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
4650
+ var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
4651
+ var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
4652
+ var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
4653
+ var amPm = ['上午', '下午'];
4654
+ var DoFn = function DoFn(D) {
4655
+ return D + '日';
4656
+ };
4657
+
4658
+ var formatFlags = {
4659
+ D: function D(dateObj) {
4660
+ return dateObj.getDay();
4661
+ },
4662
+ DD: function DD(dateObj) {
4663
+ return pad(dateObj.getDay());
4664
+ },
4665
+ Do: function Do(dateObj) {
4666
+ return DoFn(dateObj.getDate());
4667
+ },
4668
+ d: function d(dateObj) {
4669
+ return dateObj.getDate();
4670
+ },
4671
+ dd: function dd(dateObj) {
4672
+ return pad(dateObj.getDate());
4673
+ },
4674
+ ddd: function ddd(dateObj) {
4675
+ return dayNamesShort[dateObj.getDay()];
4676
+ },
4677
+ dddd: function dddd(dateObj) {
4678
+ return dayNames[dateObj.getDay()];
4679
+ },
4680
+ M: function M(dateObj) {
4681
+ return dateObj.getMonth() + 1;
4682
+ },
4683
+ MM: function MM(dateObj) {
4684
+ return pad(dateObj.getMonth() + 1);
4685
+ },
4686
+ MMM: function MMM(dateObj) {
4687
+ return monthNamesShort[dateObj.getMonth()];
4688
+ },
4689
+ MMMM: function MMMM(dateObj) {
4690
+ return monthNames[dateObj.getMonth()];
4691
+ },
4692
+ yy: function yy(dateObj) {
4693
+ return pad(String(dateObj.getFullYear()), 4).substr(2);
4694
+ },
4695
+ yyyy: function yyyy(dateObj) {
4696
+ return pad(dateObj.getFullYear(), 4);
4697
+ },
4698
+ h: function h(dateObj) {
4699
+ return dateObj.getHours() % 12 || 12;
4700
+ },
4701
+ hh: function hh(dateObj) {
4702
+ return pad(dateObj.getHours() % 12 || 12);
4703
+ },
4704
+ H: function H(dateObj) {
4705
+ return dateObj.getHours();
4706
+ },
4707
+ HH: function HH(dateObj) {
4708
+ return pad(dateObj.getHours());
4709
+ },
4710
+ m: function m(dateObj) {
4711
+ return dateObj.getMinutes();
4712
+ },
4713
+ mm: function mm(dateObj) {
4714
+ return pad(dateObj.getMinutes());
4715
+ },
4716
+ s: function s(dateObj) {
4717
+ return dateObj.getSeconds();
4718
+ },
4719
+ ss: function ss(dateObj) {
4720
+ return pad(dateObj.getSeconds());
4721
+ },
4722
+ S: function S(dateObj) {
4723
+ return Math.round(dateObj.getMilliseconds() / 100);
4724
+ },
4725
+ SS: function SS(dateObj) {
4726
+ return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
4727
+ },
4728
+ SSS: function SSS(dateObj) {
4729
+ return pad(dateObj.getMilliseconds(), 3);
4730
+ },
4731
+ a: function a(dateObj) {
4732
+ return dateObj.getHours() < 12 ? '上午' : '下午';
4733
+ },
4734
+ A: function A(dateObj) {
4735
+ return dateObj.getHours() < 12 ? '上午' : '下午';
4736
+ },
4737
+ ZZ: function ZZ(dateObj) {
4738
+ var o = dateObj.getTimezoneOffset();
4739
+ return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
4740
+ }
4741
+ };
4742
+
4743
+ var parseFlags = {
4744
+ d: [twoDigits, function (d, v) {
4745
+ d.day = v;
4746
+ }],
4747
+ Do: [twoDigits + word, function (d, v) {
4748
+ d.day = parseInt(v, 10);
4749
+ }],
4750
+ M: [twoDigits, function (d, v) {
4751
+ d.month = v - 1;
4752
+ }],
4753
+ yy: [twoDigits, function (d, v) {
4754
+ var da = new Date(),
4755
+ cent = +('' + da.getFullYear()).substr(0, 2);
4756
+ d.year = '' + (v > 68 ? cent - 1 : cent) + v;
4757
+ }],
4758
+ h: [twoDigits, function (d, v) {
4759
+ d.hour = v;
4760
+ }],
4761
+ m: [twoDigits, function (d, v) {
4762
+ d.minute = v;
4763
+ }],
4764
+ s: [twoDigits, function (d, v) {
4765
+ d.second = v;
4766
+ }],
4767
+ yyyy: [fourDigits, function (d, v) {
4768
+ d.year = v;
4769
+ }],
4770
+ S: ['\\d', function (d, v) {
4771
+ d.millisecond = v * 100;
4772
+ }],
4773
+ SS: ['\\d{2}', function (d, v) {
4774
+ d.millisecond = v * 10;
4775
+ }],
4776
+ SSS: [threeDigits, function (d, v) {
4777
+ d.millisecond = v;
4778
+ }],
4779
+ D: [twoDigits, noop],
4780
+ ddd: [word, noop],
4781
+ MMM: [word, monthUpdate('monthNamesShort')],
4782
+ MMMM: [word, monthUpdate('monthNames')],
4783
+ a: [word, function (d, v) {
4784
+ var val = v.toLowerCase();
4785
+ if (val === '上午') {
4786
+ d.isPm = false;
4787
+ } else if (val === '下午') {
4788
+ d.isPm = true;
4789
+ }
4790
+ }],
4791
+ ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
4792
+ var parts = (v + '').match(/([+-]|\d\d)/gi),
4793
+ minutes = void 0;
4794
+
4795
+ if (parts) {
4796
+ minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
4797
+ d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
4798
+ }
4799
+ }]
4800
+ };
4801
+ parseFlags.dd = parseFlags.d;
4802
+ parseFlags.dddd = parseFlags.ddd;
4803
+ parseFlags.DD = parseFlags.D;
4804
+ parseFlags.mm = parseFlags.m;
4805
+ parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
4806
+ parseFlags.MM = parseFlags.M;
4807
+ parseFlags.ss = parseFlags.s;
4808
+ parseFlags.A = parseFlags.a;
4809
+
4810
+ // Some common format strings
4811
+ fecha.masks = {
4812
+ default: 'ddd MMM dd yyyy HH:mm:ss',
4813
+ shortDate: 'M/D/yy',
4814
+ mediumDate: 'MMM d, yyyy',
4815
+ longDate: 'MMMM d, yyyy',
4816
+ fullDate: 'dddd, MMMM d, yyyy',
4817
+ shortTime: 'HH:mm',
4818
+ mediumTime: 'HH:mm:ss',
4819
+ longTime: 'HH:mm:ss.SSS'
4820
+ };
4821
+
4822
+ /***
4823
+ * Format a date
4824
+ * @method format
4825
+ * @param {Date|number} dateObj
4826
+ * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
4827
+ */
4828
+ fecha.format = function (dateObj, mask) {
4829
+ if (typeof dateObj === 'number') {
4830
+ dateObj = new Date(dateObj);
4831
+ }
4832
+
4833
+ if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
4834
+ throw new Error('Invalid Date in fecha.format');
4835
+ }
4836
+
4837
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
4838
+
4839
+ var literals = [];
4840
+
4841
+ // Make literals inactive by replacing them with ??
4842
+ mask = mask.replace(literal, function ($0, $1) {
4843
+ literals.push($1);
4844
+ return '@@@';
4845
+ });
4846
+ // Apply formatting rules
4847
+ mask = mask.replace(token, function ($0) {
4848
+ return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
4849
+ });
4850
+ // Inline literal values back into the formatted value
4851
+ return mask.replace(/@@@/g, function () {
4852
+ return literals.shift();
4853
+ });
4854
+ };
4855
+
4856
+ /**
4857
+ * Parse a date string into an object, changes - into /
4858
+ * @method parse
4859
+ * @param {string} dateStr Date string
4860
+ * @param {string} format Date parse format
4861
+ * @returns {Date|boolean}
4862
+ */
4863
+ fecha.parse = function (dateStr, format) {
4864
+ if (typeof format !== 'string') {
4865
+ throw new Error('Invalid format in fecha.parse');
4866
+ }
4867
+
4868
+ format = fecha.masks[format] || format;
4869
+
4870
+ // Avoid regular expression denial of service, fail early for really long strings
4871
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
4872
+ if (dateStr.length > 1000) {
4873
+ return null;
4874
+ }
4875
+
4876
+ var dateInfo = {};
4877
+ var parseInfo = [];
4878
+ var literals = [];
4879
+ format = format.replace(literal, function ($0, $1) {
4880
+ literals.push($1);
4881
+ return '@@@';
4882
+ });
4883
+ var newFormat = regexEscape(format).replace(token, function ($0) {
4884
+ if (parseFlags[$0]) {
4885
+ var info = parseFlags[$0];
4886
+ parseInfo.push(info[1]);
4887
+ return '(' + info[0] + ')';
4888
+ }
4889
+
4890
+ return $0;
4891
+ });
4892
+ newFormat = newFormat.replace(/@@@/g, function () {
4893
+ return literals.shift();
4894
+ });
4895
+ var matches = dateStr.match(new RegExp(newFormat, 'i'));
4896
+ if (!matches) {
4897
+ return null;
4898
+ }
4899
+
4900
+ for (var i = 1; i < matches.length; i++) {
4901
+ parseInfo[i - 1](dateInfo, matches[i]);
4902
+ }
4903
+
4904
+ var today = new Date();
4905
+ if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
4906
+ dateInfo.hour = +dateInfo.hour + 12;
4907
+ } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
4908
+ dateInfo.hour = 0;
4909
+ }
4910
+
4911
+ var date = void 0;
4912
+ if (dateInfo.timezoneOffset != null) {
4913
+ dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
4914
+ 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));
5299
4915
  } else {
5300
- // 字符串调用方式:setStorage(key, value)
5301
- type = getStorage('storageType');
5302
- finalKey = key;
5303
- finalValue = value;
4916
+ 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);
5304
4917
  }
4918
+ return date;
4919
+ };
5305
4920
 
5306
- // 使用默认存储类型如果未指定
5307
- type = type || getStorage('storageType');
4921
+ // 导出fecha对象
5308
4922
 
5309
- // 获取存储对象
5310
- var storage = type === 'localStorage' ? localStorage : sessionStorage;
5311
4923
 
5312
- // 处理不同类型的key
5313
- if (typeof finalKey === 'string') {
5314
- // 单个字符串key
5315
- var storedValue = (typeof finalValue === 'undefined' ? 'undefined' : _typeof(finalValue)) === 'object' ? JSON.stringify(finalValue) : finalValue;
5316
- storage.setItem(finalKey, storedValue);
5317
- if (finalKey === 'token') {
5318
- setCookie('token', storedValue);
4924
+ // 以下是从date-util.js合并的函数
4925
+ var newArray = function newArray(start, end) {
4926
+ var result = [];
4927
+ for (var i = start; i <= end; i++) {
4928
+ result.push(i);
4929
+ }
4930
+ return result;
4931
+ };
4932
+
4933
+ var getSettings = function getSettings() {
4934
+ return {
4935
+ dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
4936
+ dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
4937
+ monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
4938
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
4939
+ amPm: ['上午', '下午']
4940
+ };
4941
+ };
4942
+
4943
+ var toDate = function toDate(date) {
4944
+ return isDate(date) ? new Date(date) : null;
4945
+ };
4946
+
4947
+ var isDate = function isDate(date) {
4948
+ if (date === null || date === undefined) return false;
4949
+ if (isNaN(new Date(date).getTime())) return false;
4950
+ if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
4951
+ return true;
4952
+ };
4953
+
4954
+ var isDateObject = function isDateObject(val) {
4955
+ return val instanceof Date;
4956
+ };
4957
+
4958
+ var formatDate = function formatDate(date) {
4959
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
4960
+
4961
+ // 处理多种输入类型
4962
+ if (!date) return '';
4963
+
4964
+ // 如果是时间戳,转成日期对象
4965
+ if (typeof date === 'number') {
4966
+ date = new Date(date);
4967
+ }
4968
+ // 如果是字符串,转成日期对象
4969
+ if (typeof date === 'string') {
4970
+ date = new Date(date);
4971
+ }
4972
+
4973
+ // 调用toDate进一步验证和转换
4974
+ date = toDate(date);
4975
+ if (!date) return '';
4976
+
4977
+ // 兼容大写和小写的格式标记
4978
+ // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
4979
+ var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
4980
+
4981
+ // 使用fecha库进行格式化,支持中文配置
4982
+ var str = fecha.format(date, lowercaseFormat, getSettings());
4983
+ return str;
4984
+ };
4985
+
4986
+ var parseDate = function parseDate(string, format) {
4987
+ return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
4988
+ };
4989
+
4990
+ var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
4991
+ if (month === 3 || month === 5 || month === 8 || month === 10) {
4992
+ return 30;
4993
+ }
4994
+
4995
+ if (month === 1) {
4996
+ if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
4997
+ return 29;
4998
+ } else {
4999
+ return 28;
5319
5000
  }
5320
- } else if (Array.isArray(finalKey)) {
5321
- // 数组key,为多个key设置同一个value
5322
- var _storedValue = (typeof finalValue === 'undefined' ? 'undefined' : _typeof(finalValue)) === 'object' ? JSON.stringify(finalValue) : finalValue;
5323
- for (var i = 0; i < finalKey.length; i++) {
5324
- storage.setItem(finalKey[i], _storedValue);
5325
- if (finalKey[i] === 'token') {
5326
- setCookie('token', _storedValue);
5327
- }
5001
+ }
5002
+
5003
+ return 31;
5004
+ };
5005
+
5006
+ var getDayCountOfYear = function getDayCountOfYear(year) {
5007
+ var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
5008
+ return isLeapYear ? 366 : 365;
5009
+ };
5010
+
5011
+ var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
5012
+ var temp = new Date(date.getTime());
5013
+ temp.setDate(1);
5014
+ return temp.getDay();
5015
+ };
5016
+
5017
+ // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
5018
+ // {prev, next} Date should work for Daylight Saving Time
5019
+ // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
5020
+ var prevDate = function prevDate(date) {
5021
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5022
+
5023
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
5024
+ };
5025
+
5026
+ var nextDate = function nextDate(date) {
5027
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5028
+
5029
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
5030
+ };
5031
+
5032
+ var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
5033
+ var result = new Date(year, month, 1);
5034
+ var day = result.getDay();
5035
+
5036
+ if (day === 0) {
5037
+ return prevDate(result, 7);
5038
+ } else {
5039
+ return prevDate(result, day);
5040
+ }
5041
+ };
5042
+
5043
+ var getWeekNumber = function getWeekNumber(date) {
5044
+ // 支持多种输入类型
5045
+ if (!date || !isDate(date)) {
5046
+ date = new Date();
5047
+ }
5048
+ if (typeof date === 'string') {
5049
+ date = new Date(date);
5050
+ }
5051
+
5052
+ // 验证日期有效性
5053
+ if (!isDate(date)) return null;
5054
+
5055
+ var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
5056
+ // 设置为最近的星期四:当前日期 + 4 - 当前星期数
5057
+ // 将星期日的星期数设为7
5058
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
5059
+ // 获取当年的第一天
5060
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
5061
+ // 计算到最近的星期四的完整周数
5062
+ var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
5063
+ // 返回周数
5064
+ return weekNo;
5065
+ };
5066
+
5067
+ var getRangeHours = function getRangeHours(ranges) {
5068
+ var hours = [];
5069
+ var disabledHours = [];
5070
+
5071
+ (ranges || []).forEach(function (range) {
5072
+ var value = range.map(function (date) {
5073
+ return date.getHours();
5074
+ });
5075
+
5076
+ disabledHours = disabledHours.concat(newArray(value[0], value[1]));
5077
+ });
5078
+
5079
+ if (disabledHours.length) {
5080
+ for (var i = 0; i < 24; i++) {
5081
+ hours[i] = disabledHours.indexOf(i) === -1;
5328
5082
  }
5329
- } else if ((typeof finalKey === 'undefined' ? 'undefined' : _typeof(finalKey)) === 'object' && finalKey !== null) {
5330
- // 对象key,对象的属性名称作为key,属性值作为value
5331
- for (var k in finalKey) {
5332
- if (Object.prototype.hasOwnProperty.call(finalKey, k)) {
5333
- var _storedValue2 = _typeof(finalKey[k]) === 'object' ? JSON.stringify(finalKey[k]) : finalKey[k];
5334
- storage.setItem(k, _storedValue2);
5335
- if (k === 'token') {
5336
- setCookie('token', _storedValue2);
5337
- }
5083
+ } else {
5084
+ for (var _i = 0; _i < 24; _i++) {
5085
+ hours[_i] = false;
5086
+ }
5087
+ }
5088
+
5089
+ return hours;
5090
+ };
5091
+
5092
+ var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
5093
+ if (amount <= 0) return [];
5094
+ var temp = new Date(date.getTime());
5095
+ temp.setDate(0);
5096
+ var lastDay = temp.getDate();
5097
+ return range(amount).map(function (_, index) {
5098
+ return lastDay - (amount - index - 1);
5099
+ });
5100
+ };
5101
+
5102
+ var getMonthDays = function getMonthDays(date) {
5103
+ var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
5104
+ var days = temp.getDate();
5105
+ return range(days).map(function (_, index) {
5106
+ return index + 1;
5107
+ });
5108
+ };
5109
+
5110
+ function setRangeData(arr, start, end, value) {
5111
+ for (var i = start; i < end; i++) {
5112
+ arr[i] = value;
5113
+ }
5114
+ }
5115
+
5116
+ var getRangeMinutes = function getRangeMinutes(ranges, hour) {
5117
+ var minutes = new Array(60);
5118
+
5119
+ if (ranges.length > 0) {
5120
+ ranges.forEach(function (range) {
5121
+ var start = range[0];
5122
+ var end = range[1];
5123
+ var startHour = start.getHours();
5124
+ var startMinute = start.getMinutes();
5125
+ var endHour = end.getHours();
5126
+ var endMinute = end.getMinutes();
5127
+ if (startHour === hour && endHour !== hour) {
5128
+ setRangeData(minutes, startMinute, 60, true);
5129
+ } else if (startHour === hour && endHour === hour) {
5130
+ setRangeData(minutes, startMinute, endMinute + 1, true);
5131
+ } else if (startHour !== hour && endHour === hour) {
5132
+ setRangeData(minutes, 0, endMinute + 1, true);
5133
+ } else if (startHour < hour && endHour > hour) {
5134
+ setRangeData(minutes, 0, 60, true);
5338
5135
  }
5136
+ });
5137
+ } else {
5138
+ setRangeData(minutes, 0, 60, true);
5139
+ }
5140
+ return minutes;
5141
+ };
5142
+
5143
+ var range = function range(n) {
5144
+ // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
5145
+ return Array.apply(null, { length: n }).map(function (_, n) {
5146
+ return n;
5147
+ });
5148
+ };
5149
+
5150
+ var modifyDate = function modifyDate(date, y, m, d) {
5151
+ return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
5152
+ };
5153
+
5154
+ var modifyTime = function modifyTime(date, h, m, s) {
5155
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
5156
+ };
5157
+
5158
+ var modifyWithTimeString = function modifyWithTimeString(date, time) {
5159
+ if (date == null || !time) {
5160
+ return date;
5161
+ }
5162
+ time = parseDate(time, 'HH:mm:ss');
5163
+ return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
5164
+ };
5165
+
5166
+ var clearTime = function clearTime(date) {
5167
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
5168
+ };
5169
+
5170
+ var clearMilliseconds = function clearMilliseconds(date) {
5171
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
5172
+ };
5173
+
5174
+ var limitTimeRange = function limitTimeRange(date, ranges) {
5175
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
5176
+
5177
+ // TODO: refactory a more elegant solution
5178
+ if (ranges.length === 0) return date;
5179
+ var normalizeDate = function normalizeDate(date) {
5180
+ return fecha.parse(fecha.format(date, format), format);
5181
+ };
5182
+ var ndate = normalizeDate(date);
5183
+ var nranges = ranges.map(function (range) {
5184
+ return range.map(normalizeDate);
5185
+ });
5186
+ if (nranges.some(function (nrange) {
5187
+ return ndate >= nrange[0] && ndate <= nrange[1];
5188
+ })) return date;
5189
+
5190
+ var minDate = nranges[0][0];
5191
+ var maxDate = nranges[0][0];
5192
+
5193
+ nranges.forEach(function (nrange) {
5194
+ minDate = new Date(Math.min(nrange[0], minDate));
5195
+ maxDate = new Date(Math.max(nrange[1], minDate));
5196
+ });
5197
+
5198
+ var ret = ndate < minDate ? minDate : maxDate;
5199
+ // preserve Year/Month/Date
5200
+ return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
5201
+ };
5202
+
5203
+ var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
5204
+ var limitedDate = limitTimeRange(date, selectableRange, format);
5205
+ return limitedDate.getTime() === date.getTime();
5206
+ };
5207
+
5208
+ var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
5209
+ // clamp date to the number of days in `year`, `month`
5210
+ // eg: (2010-1-31, 2010, 2) => 2010-2-28
5211
+ var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
5212
+ return modifyDate(date, year, month, monthDate);
5213
+ };
5214
+
5215
+ var prevMonth = function prevMonth(date) {
5216
+ var year = date.getFullYear();
5217
+ var month = date.getMonth();
5218
+ return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
5219
+ };
5220
+
5221
+ var nextMonth = function nextMonth(date) {
5222
+ var year = date.getFullYear();
5223
+ var month = date.getMonth();
5224
+ return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
5225
+ };
5226
+
5227
+ var prevYear = function prevYear(date) {
5228
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5229
+
5230
+ var year = date.getFullYear();
5231
+ var month = date.getMonth();
5232
+ return changeYearMonthAndClampDate(date, year - amount, month);
5233
+ };
5234
+
5235
+ var nextYear = function nextYear(date) {
5236
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
5237
+
5238
+ var year = date.getFullYear();
5239
+ var month = date.getMonth();
5240
+ return changeYearMonthAndClampDate(date, year + amount, month);
5241
+ };
5242
+
5243
+ var extractDateFormat = function extractDateFormat(format) {
5244
+ return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
5245
+ };
5246
+
5247
+ var extractTimeFormat = function extractTimeFormat(format) {
5248
+ return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
5249
+ };
5250
+
5251
+ var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
5252
+ return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
5253
+ };
5254
+
5255
+ /**
5256
+ * 计算两个日期之间的工作日数量(不包括周末和节假日)
5257
+ * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
5258
+ * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
5259
+ * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
5260
+ * @returns {number} 工作日数量
5261
+ */
5262
+ var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
5263
+ var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
5264
+
5265
+ if (typeof start_date !== 'string' || typeof end_date !== 'string') {
5266
+ throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
5267
+ }
5268
+
5269
+ var startDateObj = new Date(start_date);
5270
+ var endDateObj = new Date(end_date);
5271
+
5272
+ if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
5273
+ throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
5274
+ }
5275
+
5276
+ if (startDateObj > endDateObj) {
5277
+ throw new Error('Start date should be earlier than or equal to end date.');
5278
+ }
5279
+
5280
+ var workdays = 0;
5281
+
5282
+ // Iterate through each day in the date range
5283
+
5284
+ var _loop = function _loop(currentDate) {
5285
+ // Check if the current day is a weekend (Saturday or Sunday)
5286
+ var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
5287
+
5288
+ // Check if the current day is a holiday
5289
+ var isHoliday = holidays.some(function (holiday) {
5290
+ var holidayDate = new Date(holiday);
5291
+ return currentDate.toDateString() === holidayDate.toDateString();
5292
+ });
5293
+
5294
+ // If it's a workday (not a weekend or holiday), increment the workdays count
5295
+ if (!isWeekend && !isHoliday) {
5296
+ workdays++;
5339
5297
  }
5298
+ };
5299
+
5300
+ for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
5301
+ _loop(currentDate);
5340
5302
  }
5303
+
5304
+ return workdays;
5341
5305
  };
5342
5306
 
5343
- /**
5344
- * getStorage
5345
- * @desc:获取本地储存数据
5346
- * @author huangbo
5347
- * @date 2022年5月7日
5348
- * @param {String} [key] - 获取的名称
5349
- **/
5350
- var getStorage = function getStorage(key) {
5351
- if (key) {
5352
- var res = sessionStorage.getItem(key) || localStorage.getItem(key);
5353
- if (!res && key === 'token') {
5354
- res = getCookie('token');
5355
- }
5356
- if (key === 'host' && !res) {
5357
- res = '';
5358
- }
5359
- return res;
5307
+ /**
5308
+ * 日期加减天数
5309
+ * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
5310
+ * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
5311
+ * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
5312
+ */
5313
+ var dateAddDays = function dateAddDays(start_date, days) {
5314
+ if (typeof start_date !== 'string' || !Number.isInteger(days)) {
5315
+ 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.");
5360
5316
  }
5361
- var defaults = {};
5362
- var token = sessionStorage.getItem('token') || localStorage.getItem('token') || getCookie('token');
5363
- var ssId = sessionStorage.getItem('ssId') || localStorage.getItem('ssId') || getCookie('ssId');
5364
5317
 
5365
- var deviceUnique = sessionStorage.getItem('deviceUnique') || localStorage.getItem('deviceUnique') || getCookie('deviceUnique');
5366
- if (token) {
5367
- defaults.Authorization = token;
5318
+ var startDateObj = new Date(start_date);
5319
+ if (isNaN(startDateObj.getTime())) {
5320
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5368
5321
  }
5369
- if (ssId) {
5370
- defaults.ssId = ssId;
5322
+
5323
+ var resultDateObj = new Date(startDateObj);
5324
+ resultDateObj.setDate(resultDateObj.getDate() + days);
5325
+
5326
+ var resultYear = resultDateObj.getFullYear();
5327
+ var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
5328
+ var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
5329
+
5330
+ return resultYear + '-' + resultMonth + '-' + resultDay;
5331
+ };
5332
+
5333
+ /**
5334
+ * 计算两个日期之间的差值
5335
+ * @date 2023年12月14日
5336
+ * @param {String} start_date - 起始日期字符串
5337
+ * @param {String} end_date - 结束日期字符串
5338
+ * @param {String} unit - 单位:year/month/day
5339
+ * @returns {Number} 差值
5340
+ */
5341
+ var dateDiff = function dateDiff(start_date, end_date) {
5342
+ var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
5343
+
5344
+ // Assuming date strings are in "YYYY-MM-DD" format
5345
+ var startDate = new Date(start_date);
5346
+ var endDate = new Date(end_date);
5347
+
5348
+ // If the date is invalid, return 0
5349
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
5350
+ return 0;
5371
5351
  }
5372
- if (deviceUnique) {
5373
- defaults.deviceUnique = deviceUnique;
5352
+
5353
+ if (unit === 'year') {
5354
+ return endDate.getFullYear() - startDate.getFullYear();
5355
+ } else if (unit === 'month') {
5356
+ return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
5357
+ } else {
5358
+ // Default to day
5359
+ var timeDifference = endDate - startDate;
5360
+ // Calculate days (86400000 milliseconds per day)
5361
+ return Math.floor(timeDifference / 86400000);
5374
5362
  }
5375
- return defaults;
5376
5363
  };
5377
5364
 
5378
- /**
5379
- * removeStorage
5380
- * @desc:删除本地储存数据
5381
- * @author huangbo
5382
- * @date 2022年5月7日
5383
- * @param {String, Array} [key] - 获取的名称
5384
- **/
5385
- var removeStorage = function removeStorage(key) {
5386
- if (Array.isArray(key)) {
5387
- for (var i = 0; i < key.length; i++) {
5388
- sessionStorage.removeItem(key[i]);
5389
- localStorage.removeItem(key[i]);
5390
- if (key[i] === 'token') {
5391
- removeCookie('token');
5392
- }
5393
- }
5394
- } else if (key) {
5395
- sessionStorage.removeItem(key);
5396
- localStorage.removeItem(key);
5397
- if (key === 'token') {
5398
- removeCookie('token');
5399
- }
5400
- } else {
5401
- sessionStorage.clear();
5402
- localStorage.clear();
5403
- removeCookie('token');
5365
+ /**
5366
+ * 获取月份中的日期
5367
+ * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
5368
+ * @returns {number} 月份中的日期(1-31)
5369
+ */
5370
+ var dayOfMonth = function dayOfMonth(date) {
5371
+ if (typeof date !== 'string') {
5372
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5373
+ }
5374
+
5375
+ var dateObj = new Date(date);
5376
+ if (isNaN(dateObj.getTime())) {
5377
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
5404
5378
  }
5379
+
5380
+ return dateObj.getDate();
5405
5381
  };
5406
5382
 
5407
- /**
5408
- * setCookie
5409
- * @desc 设置cookie
5410
- * @author huangbo
5411
- * @param {string} [name] cookie名称
5412
- * @param {string} [value] cookie值
5413
- * @param {boolean} [isSession] 是否是会话cookie
5414
- **/
5415
- var setCookie = function setCookie(name, value) {
5416
- var isSession = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
5417
- var time = arguments[3];
5383
+ /**
5384
+ * 获取当前日期
5385
+ * @date 2022年5月7日
5386
+ * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
5387
+ * @returns {string} 当前日期的格式化字符串
5388
+ */
5389
+ var getCurrentDate = function getCurrentDate() {
5390
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
5418
5391
 
5419
- try {
5420
- var cookieParts = [encodeURIComponent(name) + '=' + encodeURIComponent(value), 'path=/' // 仅保留path设置,确保全站访问
5421
- ];
5422
- // 会话/持久Cookie设置
5423
- if (!isSession) {
5424
- if (/MSIE|Trident/.test(navigator.userAgent)) {
5425
- // IE使用expires
5426
- var date = new Date();
5427
- date.setTime(date.getTime() + (time || 7 * 24 * 60 * 60 * 1000));
5428
- cookieParts.push('expires=' + date.toUTCString());
5429
- } else {
5430
- // 其他浏览器使用max-age
5431
- cookieParts.push('max-age=' + (time || 7 * 24 * 60 * 60));
5432
- }
5433
- }
5434
- // 内核兼容处理
5435
- if (/MSIE|Trident/.test(navigator.userAgent)) {
5436
- // IE特殊处理:添加P3P协议头
5437
- cookieParts.push('P3P=CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
5438
- } else {
5439
- // 现代浏览器设置
5440
- cookieParts.push('samesite=lax');
5441
- if (window.location.protocol === 'https:') {
5442
- cookieParts.push('secure');
5443
- }
5444
- }
5392
+ return formatDate(new Date(), format);
5393
+ };
5445
5394
 
5446
- // 设置Cookie
5447
- document.cookie = cookieParts.join('; ');
5448
- return true;
5449
- } catch (e) {
5450
- console.error('Cookie设置失败:', e);
5451
- return false;
5452
- }
5395
+ /**
5396
+ * 获取当前日期时间
5397
+ * @date 2022年5月7日
5398
+ * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
5399
+ * @returns {string} 当前日期时间的格式化字符串
5400
+ */
5401
+ var getCurrentDateTime = function getCurrentDateTime() {
5402
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
5403
+
5404
+ return formatDate(new Date(), format);
5453
5405
  };
5454
5406
 
5455
- /**
5456
- * getCookie
5457
- * @desc 获取cookie中指定名称的值
5458
- * @author huangbo
5459
- * @param {string} [name] cookie名称
5460
- **/
5461
- var getCookie = function getCookie(name) {
5462
- var cookies = document.cookie.split(';');
5463
- for (var _iterator = cookies, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
5464
- var _ref;
5407
+ /**
5408
+ * 获取小时
5409
+ * @date 2022年5月7日
5410
+ * @param {Date|string} [date] - 日期对象或日期字符串
5411
+ * @returns {number} 小时数(0-23)
5412
+ */
5413
+ var getHour = function getHour(date) {
5414
+ if (!date) {
5415
+ return new Date().getHours();
5416
+ }
5417
+ if (typeof date === 'string') {
5418
+ date = new Date(date);
5419
+ }
5420
+ return date.getHours();
5421
+ };
5465
5422
 
5466
- if (_isArray) {
5467
- if (_i >= _iterator.length) break;
5468
- _ref = _iterator[_i++];
5469
- } else {
5470
- _i = _iterator.next();
5471
- if (_i.done) break;
5472
- _ref = _i.value;
5473
- }
5423
+ /**
5424
+ * 获取分钟
5425
+ * @date 2022年5月7日
5426
+ * @param {Date|string} [date] - 日期对象或日期字符串
5427
+ * @returns {number} 分钟数(0-59)
5428
+ */
5429
+ var getMinute = function getMinute(date) {
5430
+ if (!date) {
5431
+ return new Date().getMinutes();
5432
+ }
5433
+ if (typeof date === 'string') {
5434
+ date = new Date(date);
5435
+ }
5436
+ return date.getMinutes();
5437
+ };
5474
5438
 
5475
- var cookie = _ref;
5439
+ /**
5440
+ * 获取月份
5441
+ * @date 2022年5月7日
5442
+ * @param {Date|string} [date] - 日期对象或日期字符串
5443
+ * @returns {number} 月份数(1-12)
5444
+ */
5445
+ var getMonth = function getMonth(date) {
5446
+ if (!date) {
5447
+ return new Date().getMonth() + 1;
5448
+ }
5449
+ if (typeof date === 'string') {
5450
+ date = new Date(date);
5451
+ }
5452
+ return date.getMonth() + 1;
5453
+ };
5476
5454
 
5477
- var _cookie$trim$split = cookie.trim().split('='),
5478
- cookieName = _cookie$trim$split[0],
5479
- cookieValue = _cookie$trim$split[1];
5455
+ /**
5456
+ * 获取秒
5457
+ * @date 2022年5月7日
5458
+ * @param {Date|string} [date] - 日期对象或日期字符串
5459
+ * @returns {number} 秒数(0-59)
5460
+ */
5461
+ var getSecond = function getSecond(date) {
5462
+ if (!date) {
5463
+ return new Date().getSeconds();
5464
+ }
5465
+ if (typeof date === 'string') {
5466
+ date = new Date(date);
5467
+ }
5468
+ return date.getSeconds();
5469
+ };
5480
5470
 
5481
- if (decodeURIComponent(cookieName) === name) {
5482
- return decodeURIComponent(cookieValue);
5483
- }
5471
+ /**
5472
+ * 获取星期几
5473
+ * @date 2022年5月7日
5474
+ * @param {Date|string} [date] - 日期对象或日期字符串
5475
+ * @returns {number} 星期几(0-6,0表示星期日)
5476
+ */
5477
+ var getWeekday = function getWeekday(date) {
5478
+ if (!date) {
5479
+ return new Date().getDay();
5484
5480
  }
5485
- return null;
5481
+ if (typeof date === 'string') {
5482
+ date = new Date(date);
5483
+ }
5484
+ return date.getDay();
5486
5485
  };
5487
5486
 
5488
- /**
5489
- * removeCookie
5490
- * @desc:删除cookie
5491
- * @author huangbo
5492
- * @date 2022年5月7日
5493
- * @param {String, Array} [key] - 获取的名称
5487
+ /**
5488
+ * @desc 获取上午/下午/晚上
5489
+ * @author huangbo
5490
+ * @date 2022年5月7日
5491
+ * @param {String} [time] - 时间
5494
5492
  **/
5495
- var removeCookie = function removeCookie(key) {
5496
- if (Array.isArray(key)) {
5497
- for (var i = 0; i < key.length; i++) {
5498
- document.cookie = encodeURIComponent(key[i]) + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
5493
+ var timeCycle = function timeCycle(time) {
5494
+ var hour = 0;
5495
+ if (!time) {
5496
+ hour = new Date().getHours();
5497
+ } else if (typeof time === 'string') {
5498
+ // 从时间字符串中提取小时
5499
+ var match = time.match(/^(\d{1,2})/);
5500
+ if (match) {
5501
+ hour = parseInt(match[1], 10);
5499
5502
  }
5503
+ } else if (typeof time === 'number') {
5504
+ hour = time;
5505
+ }
5506
+ // 判断时间段
5507
+ if (hour >= 5 && hour < 12) {
5508
+ return '上午';
5509
+ } else if (hour >= 12 && hour < 18) {
5510
+ return '下午';
5500
5511
  } else {
5501
- document.cookie = encodeURIComponent(key) + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
5512
+ return '晚上';
5502
5513
  }
5503
5514
  };
5504
5515
 
@@ -5507,18 +5518,11 @@ var removeCookie = function removeCookie(key) {
5507
5518
  /***/ 20:
5508
5519
  /***/ (function(module, exports) {
5509
5520
 
5510
- module.exports = require("lodash/get");
5511
-
5512
- /***/ }),
5513
-
5514
- /***/ 21:
5515
- /***/ (function(module, exports) {
5516
-
5517
5521
  module.exports = require("lodash/set");
5518
5522
 
5519
5523
  /***/ }),
5520
5524
 
5521
- /***/ 22:
5525
+ /***/ 21:
5522
5526
  /***/ (function(module, exports) {
5523
5527
 
5524
5528
  module.exports = require("lodash/cloneDeep");
@@ -5637,7 +5641,7 @@ module.exports = require("vue");
5637
5641
 
5638
5642
  /***/ }),
5639
5643
 
5640
- /***/ 6:
5644
+ /***/ 5:
5641
5645
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
5642
5646
 
5643
5647
  "use strict";