@varlet/ui 3.8.2 → 3.8.3

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 (321) hide show
  1. package/es/action-sheet/ActionItem.mjs +4 -4
  2. package/es/action-sheet/ActionSheet.mjs +9 -9
  3. package/es/action-sheet/index.mjs +2 -2
  4. package/es/action-sheet/props.mjs +1 -1
  5. package/es/action-sheet/style/index.mjs +1 -1
  6. package/es/alert/Alert.mjs +3 -3
  7. package/es/alert/index.mjs +1 -1
  8. package/es/app-bar/AppBar.mjs +5 -5
  9. package/es/app-bar/index.mjs +1 -1
  10. package/es/auto-complete/AutoComplete.mjs +23 -27
  11. package/es/auto-complete/index.mjs +1 -1
  12. package/es/auto-complete/props.mjs +1 -1
  13. package/es/avatar/Avatar.mjs +5 -5
  14. package/es/avatar/index.mjs +1 -1
  15. package/es/avatar-group/AvatarGroup.mjs +2 -2
  16. package/es/avatar-group/index.mjs +1 -1
  17. package/es/back-top/BackTop.mjs +7 -7
  18. package/es/back-top/index.mjs +1 -1
  19. package/es/badge/Badge.mjs +3 -3
  20. package/es/badge/index.mjs +1 -1
  21. package/es/badge/props.mjs +1 -1
  22. package/es/bottom-navigation/BottomNavigation.mjs +8 -9
  23. package/es/bottom-navigation/index.mjs +1 -1
  24. package/es/bottom-navigation-item/BottomNavigationItem.mjs +4 -4
  25. package/es/bottom-navigation-item/index.mjs +1 -1
  26. package/es/bottom-navigation-item/provide.mjs +1 -1
  27. package/es/breadcrumb/Breadcrumb.mjs +3 -3
  28. package/es/breadcrumb/index.mjs +1 -1
  29. package/es/breadcrumb/provide.mjs +1 -1
  30. package/es/breadcrumbs/Breadcrumbs.mjs +2 -2
  31. package/es/breadcrumbs/index.mjs +1 -1
  32. package/es/button/Button.mjs +6 -6
  33. package/es/button/index.mjs +1 -1
  34. package/es/button-group/ButtonGroup.mjs +1 -1
  35. package/es/button-group/index.mjs +1 -1
  36. package/es/card/Card.mjs +39 -39
  37. package/es/card/index.mjs +1 -1
  38. package/es/cell/Cell.mjs +3 -3
  39. package/es/cell/index.mjs +1 -1
  40. package/es/cell/props.mjs +1 -1
  41. package/es/checkbox/Checkbox.mjs +7 -7
  42. package/es/checkbox/index.mjs +1 -1
  43. package/es/checkbox-group/CheckboxGroup.mjs +5 -5
  44. package/es/checkbox-group/index.mjs +1 -1
  45. package/es/chip/Chip.mjs +4 -4
  46. package/es/chip/index.mjs +1 -1
  47. package/es/chip/props.mjs +1 -1
  48. package/es/code/Code.mjs +1 -1
  49. package/es/code/index.mjs +1 -1
  50. package/es/col/Col.mjs +4 -4
  51. package/es/col/index.mjs +1 -1
  52. package/es/collapse/Collapse.mjs +6 -4
  53. package/es/collapse/index.mjs +1 -1
  54. package/es/collapse-item/CollapseItem.mjs +4 -4
  55. package/es/collapse-item/index.mjs +1 -1
  56. package/es/collapse-item/provide.mjs +1 -1
  57. package/es/collapse-transition/CollapseTransition.mjs +2 -2
  58. package/es/collapse-transition/index.mjs +1 -1
  59. package/es/collapse-transition/useCollapseTransition.mjs +1 -1
  60. package/es/context/lock.mjs +1 -1
  61. package/es/context/stack.mjs +1 -1
  62. package/es/context/zIndex.mjs +1 -1
  63. package/es/count-to/CountTo.mjs +4 -4
  64. package/es/count-to/index.mjs +1 -1
  65. package/es/countdown/Countdown.mjs +2 -2
  66. package/es/countdown/index.mjs +1 -1
  67. package/es/counter/Counter.mjs +8 -8
  68. package/es/counter/index.mjs +1 -1
  69. package/es/date-picker/DatePicker.mjs +92 -43
  70. package/es/date-picker/index.mjs +1 -1
  71. package/es/date-picker/src/day-picker-panel.mjs +59 -27
  72. package/es/date-picker/src/month-picker-panel.mjs +57 -23
  73. package/es/date-picker/src/panel-header.mjs +12 -6
  74. package/es/date-picker/src/year-picker-panel.mjs +53 -23
  75. package/es/dialog/Dialog.mjs +5 -5
  76. package/es/dialog/index.mjs +3 -3
  77. package/es/dialog/props.mjs +1 -1
  78. package/es/divider/Divider.mjs +4 -4
  79. package/es/divider/index.mjs +1 -1
  80. package/es/drag/Drag.mjs +21 -42
  81. package/es/drag/index.mjs +1 -1
  82. package/es/ellipsis/Ellipsis.mjs +2 -2
  83. package/es/ellipsis/index.mjs +1 -1
  84. package/es/fab/Fab.mjs +4 -5
  85. package/es/fab/index.mjs +1 -1
  86. package/es/fab/props.mjs +1 -1
  87. package/es/field-decorator/FieldDecorator.mjs +5 -5
  88. package/es/field-decorator/index.mjs +1 -1
  89. package/es/floating-panel/FloatingPanel.mjs +6 -6
  90. package/es/floating-panel/index.mjs +1 -1
  91. package/es/form/Form.mjs +4 -4
  92. package/es/form/index.mjs +2 -2
  93. package/es/form/provide.mjs +1 -1
  94. package/es/form-details/index.mjs +1 -1
  95. package/es/highlighter-provider/HighlighterProvider.mjs +2 -2
  96. package/es/highlighter-provider/index.mjs +1 -1
  97. package/es/highlighter-provider/provide.mjs +1 -1
  98. package/es/hover/index.mjs +12 -7
  99. package/es/hover-overlay/HoverOverlay.mjs +2 -2
  100. package/es/hover-overlay/index.mjs +2 -2
  101. package/es/icon/Icon.mjs +3 -3
  102. package/es/icon/index.mjs +1 -1
  103. package/es/image/Image.mjs +5 -5
  104. package/es/image/index.mjs +1 -1
  105. package/es/image-preview/ImagePreview.mjs +13 -14
  106. package/es/image-preview/index.mjs +2 -2
  107. package/es/image-preview/props.mjs +2 -2
  108. package/es/index-anchor/IndexAnchor.mjs +5 -5
  109. package/es/index-anchor/index.mjs +1 -1
  110. package/es/index-anchor/provide.mjs +1 -1
  111. package/es/index-bar/IndexBar.mjs +17 -13
  112. package/es/index-bar/index.mjs +1 -1
  113. package/es/index.bundle.mjs +1 -1
  114. package/es/index.mjs +1 -1
  115. package/es/input/Input.mjs +12 -12
  116. package/es/input/index.mjs +1 -1
  117. package/es/input/props.mjs +1 -1
  118. package/es/lazy/index.mjs +1 -1
  119. package/es/link/Link.mjs +2 -2
  120. package/es/link/index.mjs +1 -1
  121. package/es/list/List.mjs +10 -10
  122. package/es/list/index.mjs +1 -1
  123. package/es/list/provide.mjs +1 -1
  124. package/es/loading/Loading.mjs +2 -2
  125. package/es/loading/index.mjs +1 -1
  126. package/es/loading-bar/LoadingBar.mjs +1 -2
  127. package/es/loading-bar/index.mjs +1 -1
  128. package/es/locale/index.mjs +5 -5
  129. package/es/locale-provider/LocaleProvider.mjs +11 -8
  130. package/es/locale-provider/index.mjs +1 -1
  131. package/es/locale-provider/provide.mjs +1 -1
  132. package/es/menu/Menu.mjs +2 -2
  133. package/es/menu/index.mjs +1 -1
  134. package/es/menu/usePopover.mjs +6 -6
  135. package/es/menu-option/MenuOption.mjs +9 -9
  136. package/es/menu-option/index.mjs +1 -1
  137. package/es/menu-option/provide.mjs +1 -1
  138. package/es/menu-select/MenuChildren.mjs +21 -21
  139. package/es/menu-select/MenuSelect.mjs +9 -9
  140. package/es/menu-select/index.mjs +1 -1
  141. package/es/option/Option.mjs +5 -5
  142. package/es/option/index.mjs +1 -1
  143. package/es/option/provide.mjs +1 -1
  144. package/es/overlay/Overlay.mjs +4 -4
  145. package/es/overlay/index.mjs +1 -1
  146. package/es/pagination/Pagination.mjs +26 -18
  147. package/es/pagination/index.mjs +1 -1
  148. package/es/paper/Paper.mjs +3 -3
  149. package/es/paper/index.mjs +1 -1
  150. package/es/picker/Picker.mjs +9 -9
  151. package/es/picker/index.mjs +2 -2
  152. package/es/picker/props.mjs +1 -1
  153. package/es/popup/Popup.mjs +6 -6
  154. package/es/popup/index.mjs +1 -1
  155. package/es/progress/Progress.mjs +4 -4
  156. package/es/progress/index.mjs +1 -1
  157. package/es/pull-refresh/PullRefresh.mjs +10 -12
  158. package/es/pull-refresh/index.mjs +1 -1
  159. package/es/radio/Radio.mjs +10 -9
  160. package/es/radio/index.mjs +1 -1
  161. package/es/radio-group/RadioGroup.mjs +7 -6
  162. package/es/radio-group/index.mjs +1 -1
  163. package/es/rate/Rate.mjs +8 -8
  164. package/es/rate/index.mjs +1 -1
  165. package/es/rate/props.mjs +1 -1
  166. package/es/result/Result.mjs +7 -7
  167. package/es/result/index.mjs +1 -1
  168. package/es/ripple/index.mjs +1 -1
  169. package/es/row/Row.mjs +4 -4
  170. package/es/row/index.mjs +1 -1
  171. package/es/select/Select.mjs +13 -13
  172. package/es/select/index.mjs +1 -1
  173. package/es/select/props.mjs +1 -1
  174. package/es/skeleton/Skeleton.mjs +3 -3
  175. package/es/skeleton/index.mjs +1 -1
  176. package/es/slider/Slider.mjs +9 -9
  177. package/es/slider/index.mjs +1 -1
  178. package/es/snackbar/Snackbar.mjs +1 -1
  179. package/es/snackbar/core.mjs +8 -8
  180. package/es/snackbar/index.mjs +9 -8
  181. package/es/snackbar/props.mjs +1 -1
  182. package/es/space/Space.mjs +2 -2
  183. package/es/space/index.mjs +1 -1
  184. package/es/step/Step.mjs +3 -3
  185. package/es/step/index.mjs +1 -1
  186. package/es/step/provide.mjs +1 -1
  187. package/es/steps/Steps.mjs +3 -3
  188. package/es/steps/index.mjs +1 -1
  189. package/es/sticky/Sticky.mjs +7 -7
  190. package/es/sticky/index.mjs +1 -1
  191. package/es/style-provider/StyleProvider.mjs +2 -2
  192. package/es/style-provider/index.mjs +2 -2
  193. package/es/swipe/Swipe.mjs +10 -10
  194. package/es/swipe/index.mjs +1 -1
  195. package/es/swipe-item/SwipeItem.mjs +1 -1
  196. package/es/swipe-item/index.mjs +1 -1
  197. package/es/swipe-item/provide.mjs +1 -1
  198. package/es/switch/Switch.mjs +6 -6
  199. package/es/switch/index.mjs +1 -1
  200. package/es/tab/Tab.mjs +4 -4
  201. package/es/tab/index.mjs +1 -1
  202. package/es/tab/provide.mjs +1 -1
  203. package/es/tab-item/TabItem.mjs +3 -3
  204. package/es/tab-item/index.mjs +1 -1
  205. package/es/tab-item/provide.mjs +1 -1
  206. package/es/table/Table.mjs +1 -1
  207. package/es/table/index.mjs +1 -1
  208. package/es/tabs/Tabs.mjs +9 -7
  209. package/es/tabs/index.mjs +1 -1
  210. package/es/tabs/props.mjs +1 -1
  211. package/es/tabs-items/TabsItems.mjs +4 -4
  212. package/es/tabs-items/index.mjs +1 -1
  213. package/es/themes/dark/index.mjs +33 -33
  214. package/es/themes/index.mjs +1 -1
  215. package/es/themes/md3-dark/index.mjs +45 -45
  216. package/es/themes/md3-light/index.mjs +39 -39
  217. package/es/time-picker/TimePicker.mjs +48 -24
  218. package/es/time-picker/clock.mjs +41 -19
  219. package/es/time-picker/index.mjs +1 -1
  220. package/es/time-picker/utils.mjs +13 -5
  221. package/es/tooltip/Tooltip.mjs +2 -2
  222. package/es/tooltip/index.mjs +1 -1
  223. package/es/uploader/Uploader.mjs +14 -14
  224. package/es/uploader/index.mjs +1 -1
  225. package/es/utils/components.mjs +5 -5
  226. package/es/utils/elements.mjs +9 -9
  227. package/es/utils/test.mjs +1 -1
  228. package/es/varlet.esm.js +20946 -20941
  229. package/es/watermark/Watermark.mjs +15 -17
  230. package/es/watermark/index.mjs +1 -1
  231. package/highlight/web-types.en-US.json +1 -1
  232. package/highlight/web-types.zh-CN.json +1 -1
  233. package/lib/varlet.cjs.js +25205 -25003
  234. package/package.json +34 -34
  235. package/types/actionSheet.d.ts +2 -2
  236. package/types/alert.d.ts +1 -1
  237. package/types/appBar.d.ts +1 -1
  238. package/types/autoComplete.d.ts +4 -4
  239. package/types/avatar.d.ts +1 -1
  240. package/types/avatarGroup.d.ts +1 -1
  241. package/types/backTop.d.ts +1 -1
  242. package/types/badge.d.ts +1 -1
  243. package/types/bottomNavigation.d.ts +2 -2
  244. package/types/bottomNavigationItem.d.ts +2 -2
  245. package/types/breadcrumb.d.ts +1 -1
  246. package/types/breadcrumbs.d.ts +1 -1
  247. package/types/button.d.ts +5 -5
  248. package/types/buttonGroup.d.ts +2 -2
  249. package/types/card.d.ts +1 -1
  250. package/types/cell.d.ts +1 -1
  251. package/types/checkbox.d.ts +1 -1
  252. package/types/checkboxGroup.d.ts +2 -2
  253. package/types/chip.d.ts +3 -3
  254. package/types/code.d.ts +1 -1
  255. package/types/col.d.ts +1 -1
  256. package/types/collapse.d.ts +1 -1
  257. package/types/collapseItem.d.ts +1 -1
  258. package/types/collapseTransition.d.ts +1 -1
  259. package/types/countTo.d.ts +1 -1
  260. package/types/countdown.d.ts +1 -1
  261. package/types/counter.d.ts +1 -1
  262. package/types/datePicker.d.ts +1 -1
  263. package/types/dialog.d.ts +1 -1
  264. package/types/divider.d.ts +1 -1
  265. package/types/drag.d.ts +1 -1
  266. package/types/ellipsis.d.ts +1 -1
  267. package/types/fab.d.ts +2 -2
  268. package/types/floatingPanel.d.ts +2 -2
  269. package/types/form.d.ts +1 -1
  270. package/types/formDetails.d.ts +1 -1
  271. package/types/highlighterProvider.d.ts +1 -1
  272. package/types/hover.d.ts +1 -1
  273. package/types/hoverOverlay.d.ts +1 -1
  274. package/types/icon.d.ts +1 -1
  275. package/types/image.d.ts +2 -2
  276. package/types/imagePreview.d.ts +2 -2
  277. package/types/indexAnchor.d.ts +1 -1
  278. package/types/indexBar.d.ts +1 -1
  279. package/types/input.d.ts +4 -4
  280. package/types/link.d.ts +1 -1
  281. package/types/list.d.ts +1 -1
  282. package/types/loading.d.ts +1 -1
  283. package/types/localeProvider.d.ts +2 -2
  284. package/types/menu.d.ts +2 -2
  285. package/types/menuOption.d.ts +1 -1
  286. package/types/menuSelect.d.ts +2 -2
  287. package/types/option.d.ts +1 -1
  288. package/types/overlay.d.ts +2 -2
  289. package/types/pagination.d.ts +1 -1
  290. package/types/paper.d.ts +1 -1
  291. package/types/picker.d.ts +3 -3
  292. package/types/popup.d.ts +2 -2
  293. package/types/progress.d.ts +1 -1
  294. package/types/pullRefresh.d.ts +1 -1
  295. package/types/radio.d.ts +1 -1
  296. package/types/radioGroup.d.ts +3 -3
  297. package/types/rate.d.ts +1 -1
  298. package/types/result.d.ts +1 -1
  299. package/types/row.d.ts +1 -1
  300. package/types/select.d.ts +3 -3
  301. package/types/skeleton.d.ts +1 -1
  302. package/types/slider.d.ts +4 -4
  303. package/types/snackbar.d.ts +2 -2
  304. package/types/space.d.ts +1 -1
  305. package/types/step.d.ts +1 -1
  306. package/types/steps.d.ts +3 -3
  307. package/types/sticky.d.ts +1 -1
  308. package/types/styleProvider.d.ts +2 -2
  309. package/types/swipe.d.ts +1 -1
  310. package/types/swipeItem.d.ts +1 -1
  311. package/types/switch.d.ts +1 -1
  312. package/types/tab.d.ts +1 -1
  313. package/types/tabItem.d.ts +1 -1
  314. package/types/table.d.ts +1 -1
  315. package/types/tabs.d.ts +3 -3
  316. package/types/tabsItems.d.ts +2 -2
  317. package/types/timePicker.d.ts +1 -1
  318. package/types/tooltip.d.ts +2 -2
  319. package/types/uploader.d.ts +2 -2
  320. package/types/watermark.d.ts +1 -1
  321. package/umd/varlet.js +7 -7
@@ -18,21 +18,21 @@ var __async = (__this, __arguments, generator) => {
18
18
  step((generator = generator.apply(__this, __arguments)).next());
19
19
  });
20
20
  };
21
+ import { computed, defineComponent, ref, watch } from "vue";
22
+ import { call, doubleRaf, error, isArray, toNumber } from "@varlet/shared";
21
23
  import dayjs from "dayjs/esm/index.js";
22
- import MonthPickerPanel from "./src/month-picker-panel.mjs";
23
- import YearPickerPanel from "./src/year-picker-panel.mjs";
24
- import DayPickerPanel from "./src/day-picker-panel.mjs";
25
- import { defineComponent, ref, computed, watch } from "vue";
24
+ import { t } from "../locale/index.mjs";
25
+ import { injectLocaleProvider } from "../locale-provider/provide.mjs";
26
+ import { createNamespace, formatElevation } from "../utils/components.mjs";
27
+ import { padStart } from "../utils/shared.mjs";
26
28
  import {
27
- props,
28
29
  MONTH_LIST,
30
+ props,
29
31
  WEEK_HEADER
30
32
  } from "./props.mjs";
31
- import { isArray, toNumber, doubleRaf, call, error } from "@varlet/shared";
32
- import { createNamespace, formatElevation } from "../utils/components.mjs";
33
- import { padStart } from "../utils/shared.mjs";
34
- import { t } from "../locale/index.mjs";
35
- import { injectLocaleProvider } from "../locale-provider/provide.mjs";
33
+ import DayPickerPanel from "./src/day-picker-panel.mjs";
34
+ import MonthPickerPanel from "./src/month-picker-panel.mjs";
35
+ import YearPickerPanel from "./src/year-picker-panel.mjs";
36
36
  const { name, n, classes } = createNamespace("date-picker");
37
37
  import { toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, renderSlot as _renderSlot, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, normalizeProps as _normalizeProps, mergeProps as _mergeProps, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, normalizeStyle as _normalizeStyle, resolveComponent as _resolveComponent, createBlock as _createBlock } from "vue";
38
38
  function __render__(_ctx, _cache) {
@@ -364,20 +364,32 @@ const __sfc__ = defineComponent({
364
364
  const formatRangeDays = chooseRangeDay.value.map((date) => dayjs(date).format("YYYY-MM-DD"));
365
365
  return formatRangeDays.length ? `${formatRangeDays[0]} ~ ${formatRangeDays[1]}` : "";
366
366
  }
367
- if (multiple) return `${chooseDays.value.length}${(pt || t)("datePickerSelected")}`;
368
- if (!chooseYear.value || !chooseMonth.value || !chooseDay.value) return "";
367
+ if (multiple) {
368
+ return `${chooseDays.value.length}${(pt || t)("datePickerSelected")}`;
369
+ }
370
+ if (!chooseYear.value || !chooseMonth.value || !chooseDay.value) {
371
+ return "";
372
+ }
369
373
  const weekIndex = dayjs(`${chooseYear.value}-${chooseMonth.value}-${chooseDay.value}`).day();
370
374
  const week = WEEK_HEADER.find((value) => value === `${weekIndex}`);
371
375
  const weekName = (_b = (_a = (pt || t)("datePickerWeekDict")) == null ? void 0 : _a[week].name) != null ? _b : "";
372
376
  const monthName = (_d = (_c = (pt || t)("datePickerMonthDict")) == null ? void 0 : _c[chooseMonth.value].name) != null ? _d : "";
373
377
  const showDay = padStart(chooseDay.value, 2, "0");
374
- if ((pt || t)("lang") === "zh-CN") return `${chooseMonth.value}-${showDay} ${weekName.slice(0, 3)}`;
378
+ if ((pt || t)("lang") === "zh-CN") {
379
+ return `${chooseMonth.value}-${showDay} ${weekName.slice(0, 3)}`;
380
+ }
375
381
  return `${weekName.slice(0, 3)}, ${monthName.slice(0, 3)} ${chooseDay.value}`;
376
382
  });
377
383
  const getPanelType = computed(() => {
378
- if (props2.type === "year" || isYearPanel.value) return "year";
379
- if (props2.type === "month" || isMonthPanel.value) return "month";
380
- if (props2.type === "date") return "date";
384
+ if (props2.type === "year" || isYearPanel.value) {
385
+ return "year";
386
+ }
387
+ if (props2.type === "month" || isMonthPanel.value) {
388
+ return "month";
389
+ }
390
+ if (props2.type === "date") {
391
+ return "date";
392
+ }
381
393
  return "";
382
394
  });
383
395
  const isUntouchable = computed(() => !props2.touchable || !getPanelType.value);
@@ -404,13 +416,19 @@ const __sfc__ = defineComponent({
404
416
  watch(
405
417
  () => props2.modelValue,
406
418
  (value) => {
407
- if (!checkValue() || invalidFormatDate(value)) return;
419
+ if (!checkValue() || invalidFormatDate(value)) {
420
+ return;
421
+ }
408
422
  if (props2.range) {
409
- if (!isArray(value)) return;
423
+ if (!isArray(value)) {
424
+ return;
425
+ }
410
426
  rangeDone.value = value.length !== 1;
411
427
  rangeInit(value, props2.type);
412
428
  } else if (props2.multiple) {
413
- if (!isArray(value)) return;
429
+ if (!isArray(value)) {
430
+ return;
431
+ }
414
432
  multipleInit(value, props2.type);
415
433
  } else {
416
434
  dateInit(value);
@@ -420,15 +438,19 @@ const __sfc__ = defineComponent({
420
438
  );
421
439
  watch(getPanelType, resetState);
422
440
  function clickEl(type) {
423
- if (type === "year") isYearPanel.value = true;
424
- else if (type === "month") isMonthPanel.value = true;
425
- else {
441
+ if (type === "year") {
442
+ isYearPanel.value = true;
443
+ } else if (type === "month") {
444
+ isMonthPanel.value = true;
445
+ } else {
426
446
  isYearPanel.value = false;
427
447
  isMonthPanel.value = false;
428
448
  }
429
449
  }
430
450
  function handleTouchstart(event) {
431
- if (isUntouchable.value) return;
451
+ if (isUntouchable.value) {
452
+ return;
453
+ }
432
454
  const { clientX, clientY } = event.touches[0];
433
455
  startX = clientX;
434
456
  startY = clientY;
@@ -437,7 +459,9 @@ const __sfc__ = defineComponent({
437
459
  return x >= y && x > 20 ? "x" : "y";
438
460
  }
439
461
  function handleTouchmove(event) {
440
- if (isUntouchable.value) return;
462
+ if (isUntouchable.value) {
463
+ return;
464
+ }
441
465
  const { clientX, clientY } = event.touches[0];
442
466
  const x = clientX - startX;
443
467
  const y = clientY - startY;
@@ -446,7 +470,9 @@ const __sfc__ = defineComponent({
446
470
  }
447
471
  function handleTouchend() {
448
472
  return __async(this, null, function* () {
449
- if (isUntouchable.value || touchDirection !== "x") return;
473
+ if (isUntouchable.value || touchDirection !== "x") {
474
+ return;
475
+ }
450
476
  const componentRef = getPanelType.value === "year" ? yearPanelEl : getPanelType.value === "month" ? monthPanelEl : dayPanelEl;
451
477
  yield doubleRaf();
452
478
  componentRef.value.forwardRef(checkType);
@@ -469,27 +495,42 @@ const __sfc__ = defineComponent({
469
495
  const formatType = type === "year" ? "YYYY" : type === "month" ? "YYYY-MM" : "YYYY-MM-DD";
470
496
  const formatDates = multipleDates.value.map((date2) => dayjs(date2).format(formatType));
471
497
  const index = formatDates.findIndex((choose) => choose === date);
472
- if (index === -1) formatDates.push(date);
473
- else formatDates.splice(index, 1);
498
+ if (index === -1) {
499
+ formatDates.push(date);
500
+ } else {
501
+ formatDates.splice(index, 1);
502
+ }
474
503
  call(props2["onUpdate:modelValue"], formatDates);
475
504
  call(props2.onChange, formatDates);
476
505
  }
477
506
  function getReverse(dateType, date) {
478
- if (!chooseYear.value || !chooseMonth.value) return false;
479
- if (!isSameYear.value) return chooseYear.value > previewYear.value;
480
- if (dateType === "year") return date < toNumber(chooseYear.value);
481
- if (dateType === "month") return date < chooseMonth.value;
507
+ if (!chooseYear.value || !chooseMonth.value) {
508
+ return false;
509
+ }
510
+ if (!isSameYear.value) {
511
+ return chooseYear.value > previewYear.value;
512
+ }
513
+ if (dateType === "year") {
514
+ return date < toNumber(chooseYear.value);
515
+ }
516
+ if (dateType === "month") {
517
+ return date < chooseMonth.value;
518
+ }
482
519
  return isSameMonth.value ? date < toNumber(chooseDay.value) : chooseMonth.value > previewMonth.value;
483
520
  }
484
521
  function getChooseDay(day) {
485
522
  const { readonly, range, multiple, onChange, "onUpdate:modelValue": updateModelValue } = props2;
486
- if (day < 0 || readonly) return;
523
+ if (day < 0 || readonly) {
524
+ return;
525
+ }
487
526
  reverse.value = getReverse("day", day);
488
527
  const date = `${previewYear.value}-${previewMonth.value}-${day}`;
489
528
  const formatDate = dayjs(date).format("YYYY-MM-DD");
490
- if (range) updateRange(formatDate, "day");
491
- else if (multiple) updateMultiple(formatDate, "day");
492
- else {
529
+ if (range) {
530
+ updateRange(formatDate, "day");
531
+ } else if (multiple) {
532
+ updateMultiple(formatDate, "day");
533
+ } else {
493
534
  call(updateModelValue, formatDate);
494
535
  call(onChange, formatDate);
495
536
  }
@@ -499,9 +540,11 @@ const __sfc__ = defineComponent({
499
540
  reverse.value = getReverse("month", month);
500
541
  if (type === "month" && !readonly) {
501
542
  const date = `${previewYear.value}-${month}`;
502
- if (range) updateRange(date, "month");
503
- else if (multiple) updateMultiple(date, "month");
504
- else {
543
+ if (range) {
544
+ updateRange(date, "month");
545
+ } else if (multiple) {
546
+ updateMultiple(date, "month");
547
+ } else {
505
548
  call(updateModelValue, date);
506
549
  call(onChange, date);
507
550
  }
@@ -520,9 +563,11 @@ const __sfc__ = defineComponent({
520
563
  const { type, readonly, range, multiple, onChange, onPreview, "onUpdate:modelValue": updateModelValue } = props2;
521
564
  reverse.value = getReverse("year", year);
522
565
  if (type === "year" && !readonly) {
523
- if (range) updateRange(`${year}`, "year");
524
- else if (multiple) updateMultiple(`${year}`, "year");
525
- else {
566
+ if (range) {
567
+ updateRange(`${year}`, "year");
568
+ } else if (multiple) {
569
+ updateMultiple(`${year}`, "year");
570
+ } else {
526
571
  call(updateModelValue, `${year}`);
527
572
  call(onChange, `${year}`);
528
573
  }
@@ -586,7 +631,9 @@ const __sfc__ = defineComponent({
586
631
  const formatType = type === "year" ? "YYYY" : type === "month" ? "YYYY-MM" : "YYYY-MM-D";
587
632
  const formatDateList = value.map((choose) => dayjs(choose).format(formatType)).slice(0, 2);
588
633
  const isValid = rangeDate.value.some((date) => invalidFormatDate(date));
589
- if (isValid) return;
634
+ if (isValid) {
635
+ return;
636
+ }
590
637
  rangeDate.value = formatDateList;
591
638
  const isChangeOrder = dayjs(rangeDate.value[0]).isAfter(rangeDate.value[1]);
592
639
  if (rangeDate.value.length === 2 && isChangeOrder) {
@@ -602,7 +649,9 @@ const __sfc__ = defineComponent({
602
649
  function dateInit(value) {
603
650
  const handleValue = value ? dayjs(value) : dayjs();
604
651
  const formatDate = handleValue.format("YYYY-MM-D");
605
- if (invalidFormatDate(formatDate)) return;
652
+ if (invalidFormatDate(formatDate)) {
653
+ return;
654
+ }
606
655
  const [yearValue, monthValue, dayValue] = formatDate.split("-");
607
656
  const monthDes2 = MONTH_LIST.find((month) => month === monthValue);
608
657
  chooseMonth.value = monthDes2;
@@ -1,5 +1,5 @@
1
- import DatePicker from "./DatePicker.mjs";
2
1
  import { withInstall, withPropsDefaultsSetter } from "../utils/components.mjs";
2
+ import DatePicker from "./DatePicker.mjs";
3
3
  import { props as datePickerProps } from "./props.mjs";
4
4
  withInstall(DatePicker);
5
5
  withPropsDefaultsSetter(DatePicker, datePickerProps);
@@ -14,24 +14,24 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
- import dayjs from "dayjs/esm/index.js";
18
- import isSameOrBefore from "dayjs/esm/plugin/isSameOrBefore/index.js";
19
- import isSameOrAfter from "dayjs/esm/plugin/isSameOrAfter/index.js";
20
- import PanelHeader from "./panel-header.mjs";
21
- import VarButton from "../../button/index.mjs";
22
17
  import {
18
+ computed,
23
19
  defineComponent,
20
+ reactive,
24
21
  ref,
25
- computed,
26
- watch,
27
- reactive
22
+ watch
28
23
  } from "vue";
29
- import { WEEK_HEADER } from "../props.mjs";
30
24
  import { toNumber } from "@varlet/shared";
31
- import { createNamespace } from "../../utils/components.mjs";
32
- import { t } from "../../locale/index.mjs";
33
25
  import { onSmartMounted } from "@varlet/use";
26
+ import dayjs from "dayjs/esm/index.js";
27
+ import isSameOrAfter from "dayjs/esm/plugin/isSameOrAfter/index.js";
28
+ import isSameOrBefore from "dayjs/esm/plugin/isSameOrBefore/index.js";
29
+ import VarButton from "../../button/index.mjs";
30
+ import { t } from "../../locale/index.mjs";
34
31
  import { injectLocaleProvider } from "../../locale-provider/provide.mjs";
32
+ import { createNamespace } from "../../utils/components.mjs";
33
+ import { WEEK_HEADER } from "../props.mjs";
34
+ import PanelHeader from "./panel-header.mjs";
35
35
  dayjs.extend(isSameOrBefore);
36
36
  dayjs.extend(isSameOrAfter);
37
37
  const { n, classes } = createNamespace("day-picker");
@@ -233,8 +233,12 @@ const __sfc__ = defineComponent({
233
233
  let isBeforeMax = true;
234
234
  let isAfterMin = true;
235
235
  const previewDate = `${previewYear}-${previewMonth}-${day}`;
236
- if (max) isBeforeMax = dayjs(previewDate).isSameOrBefore(dayjs(max), "day");
237
- if (min) isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "day");
236
+ if (max) {
237
+ isBeforeMax = dayjs(previewDate).isSameOrBefore(dayjs(max), "day");
238
+ }
239
+ if (min) {
240
+ isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "day");
241
+ }
238
242
  return isBeforeMax && isAfterMin;
239
243
  };
240
244
  const shouldChoose = (val) => {
@@ -243,7 +247,9 @@ const __sfc__ = defineComponent({
243
247
  componentProps: { range }
244
248
  } = props;
245
249
  if (range) {
246
- if (!chooseRangeDay.length) return false;
250
+ if (!chooseRangeDay.length) {
251
+ return false;
252
+ }
247
253
  const isBeforeMax = dayjs(val).isSameOrBefore(dayjs(chooseRangeDay[1]), "day");
248
254
  const isAfterMin = dayjs(val).isSameOrAfter(dayjs(chooseRangeDay[0]), "day");
249
255
  return isBeforeMax && isAfterMin;
@@ -267,31 +273,55 @@ const __sfc__ = defineComponent({
267
273
  } = props;
268
274
  const val = `${previewYear}-${previewMonth}-${day}`;
269
275
  const dayExist = () => {
270
- if (range || multiple) return shouldChoose(val);
276
+ if (range || multiple) {
277
+ return shouldChoose(val);
278
+ }
271
279
  return toNumber(chooseDay2) === day && isSame.value;
272
280
  };
273
281
  const computeDisabled = () => {
274
- if (!inRange(day)) return true;
275
- if (!allowedDates) return false;
282
+ if (!inRange(day)) {
283
+ return true;
284
+ }
285
+ if (!allowedDates) {
286
+ return false;
287
+ }
276
288
  return !allowedDates(val);
277
289
  };
278
290
  const disabled = computeDisabled();
279
291
  const computeText = () => {
280
- if (disabled) return true;
281
- if (range || multiple) return !shouldChoose(val);
292
+ if (disabled) {
293
+ return true;
294
+ }
295
+ if (range || multiple) {
296
+ return !shouldChoose(val);
297
+ }
282
298
  return !isSame.value || toNumber(chooseDay2) !== day;
283
299
  };
284
300
  const computeOutline = () => {
285
- if (!(isCurrent.value && toNumber(currentDay) === day && props.componentProps.showCurrent)) return false;
286
- if ((range || multiple || isSame.value) && disabled) return true;
287
- if (range || multiple) return !shouldChoose(val);
288
- if (isSame.value) return chooseDay2 !== currentDay;
301
+ if (!(isCurrent.value && toNumber(currentDay) === day && props.componentProps.showCurrent)) {
302
+ return false;
303
+ }
304
+ if ((range || multiple || isSame.value) && disabled) {
305
+ return true;
306
+ }
307
+ if (range || multiple) {
308
+ return !shouldChoose(val);
309
+ }
310
+ if (isSame.value) {
311
+ return chooseDay2 !== currentDay;
312
+ }
289
313
  return true;
290
314
  };
291
315
  const textColorOrCover = () => {
292
- if (disabled) return "";
293
- if (computeOutline()) return color != null ? color : "";
294
- if (dayExist()) return "";
316
+ if (disabled) {
317
+ return "";
318
+ }
319
+ if (computeOutline()) {
320
+ return color != null ? color : "";
321
+ }
322
+ if (dayExist()) {
323
+ return "";
324
+ }
295
325
  return `${nDate()}-color-cover`;
296
326
  };
297
327
  const isCover = textColorOrCover().startsWith(nDate());
@@ -311,7 +341,9 @@ const __sfc__ = defineComponent({
311
341
  };
312
342
  const chooseDay = (day, event) => {
313
343
  const buttonEl = event.currentTarget;
314
- if (buttonEl.classList.contains(n("button--disabled"))) return;
344
+ if (buttonEl.classList.contains(n("button--disabled"))) {
345
+ return;
346
+ }
315
347
  emit("choose-day", day);
316
348
  };
317
349
  const forwardRef = (checkType) => {
@@ -14,17 +14,17 @@ var __spreadValues = (a, b) => {
14
14
  }
15
15
  return a;
16
16
  };
17
- import { defineComponent, ref, computed, reactive, watch } from "vue";
17
+ import { computed, defineComponent, reactive, ref, watch } from "vue";
18
+ import { toNumber } from "@varlet/shared";
18
19
  import dayjs from "dayjs/esm/index.js";
19
- import isSameOrBefore from "dayjs/esm/plugin/isSameOrBefore/index.js";
20
20
  import isSameOrAfter from "dayjs/esm/plugin/isSameOrAfter/index.js";
21
- import { MONTH_LIST } from "../props.mjs";
22
- import PanelHeader from "./panel-header.mjs";
21
+ import isSameOrBefore from "dayjs/esm/plugin/isSameOrBefore/index.js";
23
22
  import VarButton from "../../button/index.mjs";
24
- import { toNumber } from "@varlet/shared";
25
- import { createNamespace } from "../../utils/components.mjs";
26
23
  import { t } from "../../locale/index.mjs";
27
24
  import { injectLocaleProvider } from "../../locale-provider/provide.mjs";
25
+ import { createNamespace } from "../../utils/components.mjs";
26
+ import { MONTH_LIST } from "../props.mjs";
27
+ import PanelHeader from "./panel-header.mjs";
28
28
  dayjs.extend(isSameOrBefore);
29
29
  dayjs.extend(isSameOrAfter);
30
30
  const { n, classes } = createNamespace("month-picker");
@@ -154,8 +154,12 @@ const __sfc__ = defineComponent({
154
154
  let isBeforeMax = true;
155
155
  let isAfterMin = true;
156
156
  const previewDate = `${previewYear}-${key}`;
157
- if (max) isBeforeMax = dayjs(previewDate).isSameOrBefore(dayjs(max), "month");
158
- if (min) isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "month");
157
+ if (max) {
158
+ isBeforeMax = dayjs(previewDate).isSameOrBefore(dayjs(max), "month");
159
+ }
160
+ if (min) {
161
+ isAfterMin = dayjs(previewDate).isSameOrAfter(dayjs(min), "month");
162
+ }
159
163
  return isBeforeMax && isAfterMin;
160
164
  };
161
165
  const shouldChoose = (val) => {
@@ -164,12 +168,16 @@ const __sfc__ = defineComponent({
164
168
  componentProps: { type, range }
165
169
  } = props;
166
170
  if (range) {
167
- if (!chooseRangeMonth.length) return false;
171
+ if (!chooseRangeMonth.length) {
172
+ return false;
173
+ }
168
174
  const isBeforeMax = dayjs(val).isSameOrBefore(dayjs(chooseRangeMonth[1]), "month");
169
175
  const isAfterMin = dayjs(val).isSameOrAfter(dayjs(chooseRangeMonth[0]), "month");
170
176
  return isBeforeMax && isAfterMin;
171
177
  }
172
- if (type === "month") return chooseMonths.includes(val);
178
+ if (type === "month") {
179
+ return chooseMonths.includes(val);
180
+ }
173
181
  return chooseDays.some((value) => value.includes(val));
174
182
  };
175
183
  const buttonProps = (key) => {
@@ -180,31 +188,55 @@ const __sfc__ = defineComponent({
180
188
  } = props;
181
189
  const val = `${previewYear}-${key}`;
182
190
  const monthExist = () => {
183
- if (range || multiple) return shouldChoose(val);
191
+ if (range || multiple) {
192
+ return shouldChoose(val);
193
+ }
184
194
  return chooseMonth2 === key && isSameYear.value;
185
195
  };
186
196
  const computeDisabled = () => {
187
- if (!inRange(key)) return true;
188
- if (!allowedDates) return false;
197
+ if (!inRange(key)) {
198
+ return true;
199
+ }
200
+ if (!allowedDates) {
201
+ return false;
202
+ }
189
203
  return !allowedDates(val);
190
204
  };
191
205
  const disabled = computeDisabled();
192
206
  const computeText = () => {
193
- if (disabled) return true;
194
- if (range || multiple) return !shouldChoose(val);
207
+ if (disabled) {
208
+ return true;
209
+ }
210
+ if (range || multiple) {
211
+ return !shouldChoose(val);
212
+ }
195
213
  return !isSameYear.value || chooseMonth2 !== key;
196
214
  };
197
215
  const computeOutline = () => {
198
- if (!(isCurrentYear.value && currentMonth === key && props.componentProps.showCurrent)) return false;
199
- if ((range || multiple || isSameYear.value) && disabled) return true;
200
- if (range || multiple) return !shouldChoose(val);
201
- if (isSameYear.value) return chooseMonth2 !== currentMonth;
216
+ if (!(isCurrentYear.value && currentMonth === key && props.componentProps.showCurrent)) {
217
+ return false;
218
+ }
219
+ if ((range || multiple || isSameYear.value) && disabled) {
220
+ return true;
221
+ }
222
+ if (range || multiple) {
223
+ return !shouldChoose(val);
224
+ }
225
+ if (isSameYear.value) {
226
+ return chooseMonth2 !== currentMonth;
227
+ }
202
228
  return true;
203
229
  };
204
230
  const textColorOrCover = () => {
205
- if (disabled) return "";
206
- if (computeOutline()) return color != null ? color : "";
207
- if (monthExist()) return "";
231
+ if (disabled) {
232
+ return "";
233
+ }
234
+ if (computeOutline()) {
235
+ return color != null ? color : "";
236
+ }
237
+ if (monthExist()) {
238
+ return "";
239
+ }
208
240
  return `${nDate()}-color-cover`;
209
241
  };
210
242
  const isCover = textColorOrCover().startsWith(nDate());
@@ -220,7 +252,9 @@ const __sfc__ = defineComponent({
220
252
  };
221
253
  const chooseMonth = (month, event) => {
222
254
  const buttonEl = event.currentTarget;
223
- if (buttonEl.classList.contains(n("button--disabled"))) return;
255
+ if (buttonEl.classList.contains(n("button--disabled"))) {
256
+ return;
257
+ }
224
258
  emit("choose-month", month);
225
259
  };
226
260
  const checkDate = (checkType) => {
@@ -1,10 +1,10 @@
1
+ import { computed, defineComponent, ref, watch } from "vue";
2
+ import { toNumber } from "@varlet/shared";
1
3
  import VarButton from "../../button/index.mjs";
2
4
  import VarIcon from "../../icon/index.mjs";
3
- import { defineComponent, ref, computed, watch } from "vue";
4
- import { toNumber } from "@varlet/shared";
5
- import { createNamespace } from "../../utils/components.mjs";
6
5
  import { t } from "../../locale/index.mjs";
7
6
  import { injectLocaleProvider } from "../../locale-provider/provide.mjs";
7
+ import { createNamespace } from "../../utils/components.mjs";
8
8
  const { n } = createNamespace("date-picker-header");
9
9
  import { resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, withCtx as _withCtx, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, Transition as _Transition, createElementVNode as _createElementVNode } from "vue";
10
10
  function __render__(_ctx, _cache) {
@@ -104,13 +104,19 @@ const __sfc__ = defineComponent({
104
104
  var _a;
105
105
  const { date, type } = props;
106
106
  const { previewMonth, previewYear } = date;
107
- if (type === "year") return previewYear;
108
- if (type === "month") return toNumber(previewYear) + forwardOrBackNum.value;
107
+ if (type === "year") {
108
+ return previewYear;
109
+ }
110
+ if (type === "month") {
111
+ return toNumber(previewYear) + forwardOrBackNum.value;
112
+ }
109
113
  const monthName = (_a = (pt || t)("datePickerMonthDict")) == null ? void 0 : _a[previewMonth].name;
110
114
  return (pt || t)("lang") === "zh-CN" ? `${previewYear} ${monthName}` : `${monthName} ${previewYear}`;
111
115
  });
112
116
  const checkDate = (checkType) => {
113
- if (checkType === "prev" && props.disabled.left || checkType === "next" && props.disabled.right) return;
117
+ if (checkType === "prev" && props.disabled.left || checkType === "next" && props.disabled.right) {
118
+ return;
119
+ }
114
120
  emit("check-date", checkType);
115
121
  reverse.value = checkType === "prev";
116
122
  forwardOrBackNum.value += checkType === "prev" ? -1 : 1;