x-next 1.1.0 → 1.3.0

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 (206) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/_hooks/use-form-item.d.ts +5 -0
  3. package/dist/_hooks/use-picker-focus.d.ts +17 -0
  4. package/dist/components/_components/feedback-icon/index.vue.d.ts +4 -4
  5. package/dist/components/_components/picker/input-range.vue.d.ts +10 -6
  6. package/dist/components/_components/picker/input.vue.d.ts +9 -5
  7. package/dist/components/alert/Alert.vue.d.ts +5 -5
  8. package/dist/components/alert/index.d.ts +10 -10
  9. package/dist/components/date-picker/DatePanel.vue.d.ts +5 -0
  10. package/dist/components/date-picker/DatePicker.vue.d.ts +36 -16
  11. package/dist/components/date-picker/index.d.ts +77 -33
  12. package/dist/components/dialog/Dialog.d.ts +1 -1
  13. package/dist/components/dialog/index.d.ts +3 -3
  14. package/dist/components/drawer/index.d.ts +3 -3
  15. package/dist/components/drawer/src/Drawer.vue.d.ts +1 -1
  16. package/dist/components/dropdown/Dropdown.vue.d.ts +30 -4
  17. package/dist/components/dropdown/DropdownButton.vue.d.ts +31 -5
  18. package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
  19. package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +162 -5
  20. package/dist/components/dropdown/context.d.ts +14 -1
  21. package/dist/components/dropdown/dropdown-panel.vue.d.ts +7 -1
  22. package/dist/components/dropdown/index.d.ts +610 -28
  23. package/dist/components/dropdown/use-keyboard.d.ts +10 -0
  24. package/dist/components/form/FormItem.vue.d.ts +12 -4
  25. package/dist/components/form/context.d.ts +6 -0
  26. package/dist/components/form/form-item-label.vue.d.ts +4 -4
  27. package/dist/components/form/form-item-message.vue.d.ts +2 -0
  28. package/dist/components/form/index.d.ts +30 -8
  29. package/dist/components/form/interface.d.ts +2 -2
  30. package/dist/components/form-input/InputPassword.vue.d.ts +20 -2
  31. package/dist/components/form-input/index.d.ts +22 -4
  32. package/dist/components/form-select/Select.d.ts +3 -3
  33. package/dist/components/form-select/hooks/use-select.d.ts +2 -1
  34. package/dist/components/form-select/index.d.ts +6 -6
  35. package/dist/components/form-slider/Slider.vue.d.ts +10 -3
  36. package/dist/components/form-slider/index.d.ts +26 -6
  37. package/dist/components/form-slider/slider-button.vue.d.ts +4 -3
  38. package/dist/components/form-switch/Switch.vue.d.ts +2 -1
  39. package/dist/components/form-switch/index.d.ts +5 -2
  40. package/dist/components/form-textarea/Textarea.vue.d.ts +2 -2
  41. package/dist/components/form-textarea/index.d.ts +5 -5
  42. package/dist/components/image/Image.vue.d.ts +10 -9
  43. package/dist/components/image/ImagePreview.vue.d.ts +8 -7
  44. package/dist/components/image/ImagePreviewAction.d.ts +3 -3
  45. package/dist/components/image/ImagePreviewGroup.vue.d.ts +8 -7
  46. package/dist/components/image/index.d.ts +59 -52
  47. package/dist/components/image/preview-arrow.vue.d.ts +2 -2
  48. package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
  49. package/dist/components/layout/LayoutSidebar.vue.d.ts +2 -2
  50. package/dist/components/layout/index.d.ts +4 -4
  51. package/dist/components/link/Link.vue.d.ts +2 -2
  52. package/dist/components/link/index.d.ts +4 -4
  53. package/dist/components/menu/Menu.d.ts +2 -2
  54. package/dist/components/menu/base-menu.vue.d.ts +2 -2
  55. package/dist/components/menu/index.d.ts +4 -4
  56. package/dist/components/menu/sub-menu-pop.vue.d.ts +5 -5
  57. package/dist/components/message/index.d.ts +17 -17
  58. package/dist/components/message/message.vue.d.ts +8 -8
  59. package/dist/components/notification/Notification.d.ts +1 -1
  60. package/dist/components/notification/index.d.ts +3 -3
  61. package/dist/components/pagination/page-item-ellipsis.vue.d.ts +1 -1
  62. package/dist/components/pagination/page-item-step.vue.d.ts +2 -2
  63. package/dist/components/pagination/page-options.vue.d.ts +6 -6
  64. package/dist/components/popconfirm/src/popup.vue.d.ts +1 -1
  65. package/dist/components/popover/Popover.d.ts +1 -1
  66. package/dist/components/popover/index.d.ts +3 -3
  67. package/dist/components/popup/Popup.d.ts +1 -1
  68. package/dist/components/popup/index.d.ts +3 -3
  69. package/dist/components/progress/Progress.vue.d.ts +4 -4
  70. package/dist/components/progress/circle.vue.d.ts +2 -2
  71. package/dist/components/progress/index.d.ts +8 -8
  72. package/dist/components/progress/line.vue.d.ts +1 -1
  73. package/dist/components/progress/steps.vue.d.ts +1 -1
  74. package/dist/components/steps/Step.vue.d.ts +2 -2
  75. package/dist/components/steps/index.d.ts +4 -4
  76. package/dist/components/tabs/Tabs.d.ts +1 -1
  77. package/dist/components/tabs/index.d.ts +3 -3
  78. package/dist/components/tabs/tabs-tab.vue.d.ts +1 -1
  79. package/dist/components/tag/Tag.vue.d.ts +2 -2
  80. package/dist/components/tag/index.d.ts +4 -4
  81. package/dist/components/time-picker/TimeColumn.vue.d.ts +3 -0
  82. package/dist/components/time-picker/TimePanel.vue.d.ts +3 -0
  83. package/dist/components/time-picker/TimePicker.vue.d.ts +33 -17
  84. package/dist/components/time-picker/index.d.ts +73 -36
  85. package/dist/components/time-range-selector/TimeRangeSelector.vue.d.ts +8 -0
  86. package/dist/components/time-range-selector/index.d.ts +22 -0
  87. package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
  88. package/dist/components/tooltip/index.d.ts +3 -3
  89. package/dist/components/trigger/Trigger.d.ts +1 -1
  90. package/dist/components/trigger/index.d.ts +3 -3
  91. package/dist/es/_hooks/use-form-item.js +36 -10
  92. package/dist/es/_hooks/use-overflow.js +45 -40
  93. package/dist/es/_hooks/use-picker-focus.js +57 -0
  94. package/dist/es/_utils/constant.js +17 -5
  95. package/dist/es/components/_components/picker/input-range.vue.js +45 -55
  96. package/dist/es/components/_components/picker/input-range.vue2.js +105 -70
  97. package/dist/es/components/_components/picker/input.vue.js +22 -25
  98. package/dist/es/components/_components/picker/input.vue2.js +58 -43
  99. package/dist/es/components/_components/select-view/select-view.js +61 -66
  100. package/dist/es/components/date-picker/DatePanel.vue.js +102 -94
  101. package/dist/es/components/date-picker/DatePanel.vue2.js +97 -44
  102. package/dist/es/components/date-picker/DatePicker.vue.js +71 -58
  103. package/dist/es/components/date-picker/DatePicker.vue2.js +285 -231
  104. package/dist/es/components/dialog/Dialog.js +159 -128
  105. package/dist/es/components/dropdown/Dropdown.vue.js +18 -15
  106. package/dist/es/components/dropdown/Dropdown.vue2.js +52 -31
  107. package/dist/es/components/dropdown/DropdownOption.vue.js +22 -21
  108. package/dist/es/components/dropdown/DropdownOption.vue2.js +23 -19
  109. package/dist/es/components/dropdown/DropdownSubmenu.vue.js +49 -36
  110. package/dist/es/components/dropdown/DropdownSubmenu.vue2.js +45 -24
  111. package/dist/es/components/dropdown/context.js +3 -2
  112. package/dist/es/components/dropdown/dropdown-panel.vue.js +24 -21
  113. package/dist/es/components/dropdown/dropdown-panel.vue2.js +83 -31
  114. package/dist/es/components/dropdown/use-keyboard.js +45 -0
  115. package/dist/es/components/form/Form.vue2.js +113 -101
  116. package/dist/es/components/form/FormItem.vue.js +26 -22
  117. package/dist/es/components/form/FormItem.vue2.js +162 -125
  118. package/dist/es/components/form/form-item-message.vue.js +31 -24
  119. package/dist/es/components/form/form-item-message.vue2.js +4 -2
  120. package/dist/es/components/form-checkbox/Checkbox.js +80 -76
  121. package/dist/es/components/form-checkbox/CheckboxGroup.js +43 -38
  122. package/dist/es/components/form-input/Input.js +83 -79
  123. package/dist/es/components/form-input/InputPassword.vue.js +19 -16
  124. package/dist/es/components/form-input/InputPassword.vue2.js +39 -29
  125. package/dist/es/components/form-input/InputSearch.js +47 -37
  126. package/dist/es/components/form-input-number/InputNumber.js +134 -133
  127. package/dist/es/components/form-input-tag/InputTag.js +173 -162
  128. package/dist/es/components/form-radio/Radio.js +74 -71
  129. package/dist/es/components/form-radio/RadioGroup.js +55 -49
  130. package/dist/es/components/form-select/Select.js +116 -114
  131. package/dist/es/components/form-select/hooks/use-select.js +128 -128
  132. package/dist/es/components/form-slider/Slider.vue.js +28 -28
  133. package/dist/es/components/form-slider/Slider.vue2.js +139 -132
  134. package/dist/es/components/form-slider/slider-button.vue.js +6 -6
  135. package/dist/es/components/form-slider/slider-button.vue2.js +39 -34
  136. package/dist/es/components/form-switch/Switch.vue.js +9 -9
  137. package/dist/es/components/form-switch/Switch.vue2.js +81 -74
  138. package/dist/es/components/form-textarea/Textarea.vue2.js +123 -108
  139. package/dist/es/components/image/Image.vue2.js +77 -76
  140. package/dist/es/components/image/ImagePreview.vue.js +13 -12
  141. package/dist/es/components/image/ImagePreview.vue2.js +141 -136
  142. package/dist/es/components/image/ImagePreviewGroup.vue.js +1 -1
  143. package/dist/es/components/image/ImagePreviewGroup.vue2.js +82 -83
  144. package/dist/es/components/rate/Rate.js +106 -103
  145. package/dist/es/components/time-picker/TimeColumn.vue.js +34 -23
  146. package/dist/es/components/time-picker/TimeColumn.vue2.js +37 -28
  147. package/dist/es/components/time-picker/TimePicker.vue.js +83 -64
  148. package/dist/es/components/time-picker/TimePicker.vue2.js +192 -156
  149. package/dist/es/components/time-range-selector/TimeRangeSelector.vue.js +327 -193
  150. package/dist/es/locale/en-US.js +6 -0
  151. package/dist/es/locale/zh-CN.js +6 -0
  152. package/dist/es/style.css +1 -1
  153. package/dist/icons/_self/down.d.ts +1 -1
  154. package/dist/icons/_self/dropdown/more.d.ts +1 -1
  155. package/dist/icons/_self/empty-better.d.ts +1 -1
  156. package/dist/icons/_self/empty.d.ts +1 -1
  157. package/dist/icons/_self/eye-invisible.d.ts +1 -1
  158. package/dist/icons/_self/eye.d.ts +1 -1
  159. package/dist/icons/_self/full-screen.d.ts +1 -1
  160. package/dist/icons/_self/left.d.ts +1 -1
  161. package/dist/icons/_self/menu/down.d.ts +1 -1
  162. package/dist/icons/_self/minus.d.ts +1 -1
  163. package/dist/icons/_self/more-dot.d.ts +1 -1
  164. package/dist/icons/_self/next.d.ts +1 -1
  165. package/dist/icons/_self/original-size.d.ts +1 -1
  166. package/dist/icons/_self/plus.d.ts +1 -1
  167. package/dist/icons/_self/prev.d.ts +1 -1
  168. package/dist/icons/_self/question-message.d.ts +1 -1
  169. package/dist/icons/_self/right.d.ts +1 -1
  170. package/dist/icons/_self/rotate-left.d.ts +1 -1
  171. package/dist/icons/_self/rotate-right.d.ts +1 -1
  172. package/dist/icons/_self/search.d.ts +1 -1
  173. package/dist/icons/_self/up.d.ts +1 -1
  174. package/dist/icons/_self/zoom-in.d.ts +1 -1
  175. package/dist/icons/_self/zoom-out.d.ts +1 -1
  176. package/dist/icons/_ui/alone-left.d.ts +1 -1
  177. package/dist/icons/_ui/alone-margin-left.d.ts +1 -1
  178. package/dist/icons/_ui/alone-margin-right.d.ts +1 -1
  179. package/dist/icons/_ui/alone-right.d.ts +1 -1
  180. package/dist/icons/_ui/calendar.d.ts +1 -1
  181. package/dist/icons/_ui/time.d.ts +1 -1
  182. package/dist/icons/animation/animation-loading.d.ts +1 -1
  183. package/dist/icons/default/check-circle-fill.d.ts +1 -1
  184. package/dist/icons/default/check.d.ts +1 -1
  185. package/dist/icons/default/close-circle-fill.d.ts +1 -1
  186. package/dist/icons/default/close.d.ts +1 -1
  187. package/dist/icons/default/exclamation-circle-fill.d.ts +1 -1
  188. package/dist/icons/default/exclamation.d.ts +1 -1
  189. package/dist/icons/default/filter.d.ts +1 -1
  190. package/dist/icons/default/info-circle-fill.d.ts +1 -1
  191. package/dist/icons/default/link.d.ts +1 -1
  192. package/dist/icons/default/logo-simple.d.ts +1 -1
  193. package/dist/icons/default/minus-circle-fill.d.ts +1 -1
  194. package/dist/icons/icon.d.ts +2 -2
  195. package/dist/icons/index.d.ts +3 -3
  196. package/dist/index.cjs +4 -4
  197. package/dist/index.d.ts +1 -1
  198. package/dist/index.umd.js +4 -4
  199. package/dist/locale/interface.d.ts +6 -0
  200. package/dist/style/base.css +1 -1
  201. package/dist/style/date-picker.css +1 -1
  202. package/dist/style/form.css +1 -1
  203. package/dist/style/image.css +1 -1
  204. package/dist/style/time-range-selector.css +1 -1
  205. package/dist/style.css +1 -1
  206. package/package.json +2 -2
@@ -1,139 +1,147 @@
1
- import b from "./DatePanel.vue2.js";
2
- import { openBlock as s, createElementBlock as n, withKeys as N, normalizeClass as l, createElementVNode as i, createCommentVNode as o, toDisplayString as r, Fragment as d, renderList as u, renderSlot as k, createTextVNode as y } from "vue";
3
- import p from "../../_virtual/_plugin-vue_export-helper.js";
4
- const v = ["aria-label"], w = ["aria-label"], $ = ["aria-label"], g = ["aria-label"], C = { key: 0 }, P = ["title", "disabled", "aria-selected", "onMouseenter", "onClick"], f = ["onClick"];
5
- function h(e, t, L, S, E, M) {
1
+ import p from "./DatePanel.vue2.js";
2
+ import { openBlock as s, createElementBlock as n, withKeys as w, normalizeClass as l, createElementVNode as m, createCommentVNode as r, toDisplayString as i, Fragment as u, renderList as b, renderSlot as N, createTextVNode as v } from "vue";
3
+ import $ from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const g = ["aria-label"], C = ["aria-label"], f = ["aria-label"], P = ["aria-label"], h = { key: 0 }, L = ["title", "aria-label", "role", "tabindex", "disabled", "aria-selected", "onMouseenter", "onFocus", "onKeydown", "onClick"], S = ["onClick"];
5
+ function E(e, t, M, T, R, K) {
6
6
  return s(), n("div", {
7
+ ref: "panelRef",
7
8
  class: l([
8
9
  e.className.element("panel"),
9
10
  e.className.modifier(`mode-${e.mode}`),
10
11
  { [e.className.is("show-lunar")]: e.showLunar && e.mode === "date" }
11
12
  ]),
12
- onKeydown: t[8] || (t[8] = N((a) => e.$emit("cancel"), ["esc"]))
13
+ onKeydown: t[8] || (t[8] = w((o) => e.$emit("cancel"), ["esc"]))
13
14
  }, [
14
- i("div", {
15
- class: l([
16
- e.className.element("header"),
17
- e.className.element(`header-${e.panelPosition}`)
18
- ])
15
+ m("div", {
16
+ class: l([e.className.element("header"), e.className.element(`header-${e.panelPosition}`)])
19
17
  }, [
20
18
  e.panelPosition !== "right" ? (s(), n("button", {
21
19
  key: 0,
22
20
  type: "button",
23
21
  class: l(e.className.element("header-btn")),
24
22
  "aria-label": e.t("datePicker.prevPage"),
25
- onClick: t[0] || (t[0] = (a) => e.movePanel(-1, !0))
26
- }, " « ", 10, v)) : o("", !0),
23
+ onClick: t[0] || (t[0] = (o) => e.movePanel(-1, !0))
24
+ }, " « ", 10, g)) : r("", !0),
27
25
  e.panelPosition !== "right" ? (s(), n("button", {
28
26
  key: 1,
29
27
  type: "button",
30
28
  class: l(e.className.element("header-btn")),
31
29
  "aria-label": e.t("datePicker.prevItem"),
32
- onClick: t[1] || (t[1] = (a) => e.movePanel(-1))
33
- }, " ‹ ", 10, w)) : o("", !0),
34
- i("button", {
30
+ onClick: t[1] || (t[1] = (o) => e.movePanel(-1))
31
+ }, " ‹ ", 10, C)) : r("", !0),
32
+ m("button", {
35
33
  type: "button",
36
34
  class: l(e.className.element("header-label")),
37
- onClick: t[2] || (t[2] = (...a) => e.zoomHeader && e.zoomHeader(...a))
38
- }, r(e.headerLabel), 3),
35
+ onClick: t[2] || (t[2] = (...o) => e.zoomHeader && e.zoomHeader(...o))
36
+ }, i(e.headerLabel), 3),
39
37
  e.panelPosition !== "left" ? (s(), n("button", {
40
38
  key: 2,
41
39
  type: "button",
42
40
  class: l(e.className.element("header-btn")),
43
41
  "aria-label": e.t("datePicker.nextItem"),
44
- onClick: t[3] || (t[3] = (a) => e.movePanel(1))
45
- }, " › ", 10, $)) : o("", !0),
42
+ onClick: t[3] || (t[3] = (o) => e.movePanel(1))
43
+ }, " › ", 10, f)) : r("", !0),
46
44
  e.panelPosition !== "left" ? (s(), n("button", {
47
45
  key: 3,
48
46
  type: "button",
49
47
  class: l(e.className.element("header-btn")),
50
48
  "aria-label": e.t("datePicker.nextPage"),
51
- onClick: t[4] || (t[4] = (a) => e.movePanel(1, !0))
52
- }, " » ", 10, g)) : o("", !0)
49
+ onClick: t[4] || (t[4] = (o) => e.movePanel(1, !0))
50
+ }, " » ", 10, P)) : r("", !0)
53
51
  ], 2),
54
52
  e.mode === "date" || e.mode === "week" ? (s(), n("div", {
55
53
  key: 0,
56
- class: l([
57
- e.className.element("weekdays"),
58
- { [e.className.is("week-mode")]: e.mode === "week" }
59
- ])
54
+ class: l([e.className.element("weekdays"), { [e.className.is("week-mode")]: e.mode === "week" }])
60
55
  }, [
61
- e.mode === "week" ? (s(), n("span", C, r(e.t("datePicker.weekColumn")), 1)) : o("", !0),
62
- (s(!0), n(d, null, u(e.weekdayLabels, (a) => (s(), n("span", { key: a }, r(a), 1))), 128))
63
- ], 2)) : o("", !0),
64
- i("div", {
65
- class: l([
66
- e.className.element("body"),
67
- e.className.element(`body-${e.mode}`)
68
- ]),
56
+ e.mode === "week" ? (s(), n("span", h, i(e.t("datePicker.weekColumn")), 1)) : r("", !0),
57
+ (s(!0), n(u, null, b(e.weekdayLabels, (o) => (s(), n("span", { key: o }, i(o), 1))), 128))
58
+ ], 2)) : r("", !0),
59
+ m("div", {
60
+ class: l([e.className.element("body"), e.className.element(`body-${e.mode}`)]),
69
61
  role: "grid"
70
62
  }, [
71
- (s(!0), n(d, null, u(e.cells, (a) => (s(), n("button", {
72
- key: a.title,
73
- type: "button",
74
- title: a.title,
75
- disabled: a.isWeekLabel || a.disabled || !a.inView,
76
- "aria-selected": !a.isWeekLabel && (a.selected || a.rangeStart || a.rangeEnd),
77
- onMouseenter: (m) => e.handleCellMouseEnter(a),
78
- onMouseleave: t[5] || (t[5] = (...m) => e.handleCellMouseLeave && e.handleCellMouseLeave(...m)),
79
- class: l([
80
- e.className.element("cell"),
81
- {
82
- [e.className.is("out-view")]: a.outView,
83
- [e.className.is("today")]: a.today,
84
- [e.className.is("selected")]: a.selected,
85
- [e.className.is("range-start")]: a.rangeStart,
86
- [e.className.is("range-end")]: a.rangeEnd,
87
- [e.className.is("in-range")]: a.inRange,
88
- [e.className.is("preview-range-start")]: a.previewRangeStart,
89
- [e.className.is("preview-range-end")]: a.previewRangeEnd,
90
- [e.className.is("in-preview-range")]: a.inPreviewRange,
91
- [e.className.is("disabled")]: a.disabled,
92
- [e.className.is("week-label")]: a.isWeekLabel,
93
- [e.className.is("week-start")]: a.weekStart,
94
- [e.className.is("week-end")]: a.weekEnd,
95
- [e.className.is("week-selected")]: a.weekSelected
96
- }
97
- ]),
98
- onClick: (m) => e.handleSelect(a)
63
+ (s(!0), n(u, null, b(e.cellRows, (o, k) => (s(), n("div", {
64
+ key: k,
65
+ role: "row",
66
+ class: l(e.className.element("row"))
99
67
  }, [
100
- i("span", {
101
- class: l(e.className.element("cell-date"))
102
- }, [
103
- i("span", {
104
- class: l(e.className.element("cell-inner"))
68
+ (s(!0), n(u, null, b(o, (a) => {
69
+ var y;
70
+ return s(), n("button", {
71
+ key: a.title,
72
+ type: "button",
73
+ title: a.title,
74
+ "aria-label": a.title,
75
+ role: a.isWeekLabel ? "rowheader" : "gridcell",
76
+ tabindex: a.title === ((y = e.activeCell) == null ? void 0 : y.title) ? 0 : -1,
77
+ disabled: a.isWeekLabel || a.disabled || !a.inView,
78
+ "aria-selected": !a.isWeekLabel && (a.selected || a.rangeStart || a.rangeEnd),
79
+ onMouseenter: (d) => e.handleCellMouseEnter(a),
80
+ onMouseleave: t[5] || (t[5] = (...d) => e.handleCellMouseLeave && e.handleCellMouseLeave(...d)),
81
+ onFocus: (d) => {
82
+ e.activeTitle = a.title, e.handleCellMouseEnter(a);
83
+ },
84
+ onKeydown: (d) => e.handleCellKeydown(d, a),
85
+ class: l([
86
+ e.className.element("cell"),
87
+ {
88
+ [e.className.is("out-view")]: a.outView,
89
+ [e.className.is("today")]: a.today,
90
+ [e.className.is("selected")]: a.selected,
91
+ [e.className.is("range-start")]: a.rangeStart,
92
+ [e.className.is("range-end")]: a.rangeEnd,
93
+ [e.className.is("in-range")]: a.inRange,
94
+ [e.className.is("preview-range-start")]: a.previewRangeStart,
95
+ [e.className.is("preview-range-end")]: a.previewRangeEnd,
96
+ [e.className.is("in-preview-range")]: a.inPreviewRange,
97
+ [e.className.is("disabled")]: a.disabled,
98
+ [e.className.is("week-label")]: a.isWeekLabel,
99
+ [e.className.is("week-start")]: a.weekStart,
100
+ [e.className.is("week-end")]: a.weekEnd,
101
+ [e.className.is("week-selected")]: a.weekSelected
102
+ }
103
+ ]),
104
+ onClick: (d) => e.handleSelect(a)
105
105
  }, [
106
- k(e.$slots, "cell", {
107
- date: a.value.toDate(),
108
- label: a.label
109
- }, () => [
110
- y(r(a.label), 1)
111
- ])
112
- ], 2)
113
- ], 2),
114
- a.lunar && !e.$slots.cell ? (s(), n("span", {
115
- key: 0,
116
- class: l(e.className.element("cell-lunar"))
117
- }, r(a.lunar.displayText), 3)) : o("", !0)
118
- ], 42, P))), 128))
106
+ m("span", {
107
+ class: l(e.className.element("cell-date"))
108
+ }, [
109
+ m("span", {
110
+ class: l(e.className.element("cell-inner"))
111
+ }, [
112
+ N(e.$slots, "cell", {
113
+ date: a.value.toDate(),
114
+ label: a.label
115
+ }, () => [
116
+ v(i(a.label), 1)
117
+ ])
118
+ ], 2)
119
+ ], 2),
120
+ a.lunar && !e.$slots.cell ? (s(), n("span", {
121
+ key: 0,
122
+ class: l(e.className.element("cell-lunar"))
123
+ }, i(a.lunar.displayText), 3)) : r("", !0)
124
+ ], 42, L);
125
+ }), 128))
126
+ ], 2))), 128))
119
127
  ], 2),
120
128
  e.shortcuts.length || e.$slots.extra ? (s(), n("div", {
121
129
  key: 1,
122
130
  class: l(e.className.element("shortcuts"))
123
131
  }, [
124
- (s(!0), n(d, null, u(e.shortcuts, (a) => (s(), n("button", {
125
- key: String(a.label),
132
+ (s(!0), n(u, null, b(e.shortcuts, (o) => (s(), n("button", {
133
+ key: String(o.label),
126
134
  type: "button",
127
135
  class: l(e.className.element("shortcut")),
128
- onClick: (m) => e.$emit("shortcut", a)
129
- }, r(a.label), 11, f))), 128)),
136
+ onClick: (k) => e.$emit("shortcut", o)
137
+ }, i(o.label), 11, S))), 128)),
130
138
  e.$slots.extra ? (s(), n("div", {
131
139
  key: 0,
132
140
  class: l(e.className.element("extra"))
133
141
  }, [
134
- k(e.$slots, "extra")
135
- ], 2)) : o("", !0)
136
- ], 2)) : o("", !0),
142
+ N(e.$slots, "extra")
143
+ ], 2)) : r("", !0)
144
+ ], 2)) : r("", !0),
137
145
  e.showToday || e.showConfirmBtn ? (s(), n("div", {
138
146
  key: 2,
139
147
  class: l(e.className.element("footer"))
@@ -142,18 +150,18 @@ function h(e, t, L, S, E, M) {
142
150
  key: 0,
143
151
  type: "button",
144
152
  class: l([e.className.element("footer-btn"), e.className.element("today")]),
145
- onClick: t[6] || (t[6] = (...a) => e.selectToday && e.selectToday(...a))
146
- }, r(e.todayLabel), 3)) : o("", !0),
153
+ onClick: t[6] || (t[6] = (...o) => e.selectToday && e.selectToday(...o))
154
+ }, i(e.todayLabel), 3)) : r("", !0),
147
155
  e.showConfirmBtn ? (s(), n("button", {
148
156
  key: 1,
149
157
  type: "button",
150
158
  class: l([e.className.element("footer-btn"), e.className.element("confirm")]),
151
- onClick: t[7] || (t[7] = (a) => e.$emit("confirm"))
152
- }, r(e.t("datePicker.ok")), 3)) : o("", !0)
153
- ], 2)) : o("", !0)
159
+ onClick: t[7] || (t[7] = (o) => e.$emit("confirm"))
160
+ }, i(e.t("datePicker.ok")), 3)) : r("", !0)
161
+ ], 2)) : r("", !0)
154
162
  ], 34);
155
163
  }
156
- const R = /* @__PURE__ */ p(b, [["render", h]]);
164
+ const z = /* @__PURE__ */ $(p, [["render", E]]);
157
165
  export {
158
- R as default
166
+ z as default
159
167
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as w, ref as V, watch as o, computed as u } from "vue";
2
- import { getClassNameMixin as k } from "../../_utils/config.js";
3
- import { useLocale as g } from "../../locale/index.js";
4
- import { getWeekdayLabels as b, getHeaderLabel as D, createDateCells as L, moveViewDate as P, normalizePanelValue as i } from "./utils.js";
5
- import { dayjs as c } from "../../_utils/date.js";
6
- const z = w({
1
+ import { defineComponent as K, ref as L, watch as B, computed as i, nextTick as F } from "vue";
2
+ import { getClassNameMixin as Q } from "../../_utils/config.js";
3
+ import { useLocale as Y } from "../../locale/index.js";
4
+ import { getWeekdayLabels as G, getHeaderLabel as J, createDateCells as X, moveViewDate as M, normalizePanelValue as g } from "./utils.js";
5
+ import { dayjs as R } from "../../_utils/date.js";
6
+ const ne = K({
7
7
  name: "DatePanel",
8
8
  props: {
9
9
  mode: {
@@ -69,27 +69,27 @@ const z = w({
69
69
  confirm: () => !0,
70
70
  cancel: () => !0
71
71
  },
72
- setup(e, { emit: n }) {
73
- const f = k("date-picker"), { t: l, locale: r } = g(), t = V(e.viewDate || e.value || e.rangeValue[0] || c());
74
- o(
72
+ setup(e, { emit: s }) {
73
+ const x = Q("date-picker"), { t: o, locale: P } = Y(), d = L(e.viewDate || e.value || e.rangeValue[0] || R()), W = L(), v = L("");
74
+ B(
75
75
  () => e.viewDate,
76
- (a) => {
77
- a && (t.value = a);
76
+ (t) => {
77
+ t && (d.value = t);
78
78
  }
79
- ), o(
79
+ ), B(
80
80
  () => [e.value, e.rangeValue[0], e.rangeValue[1], e.mode],
81
81
  () => {
82
82
  if (e.viewDate) return;
83
- const a = e.value || e.rangeValue[0] || e.rangeValue[1];
84
- a && (t.value = a);
83
+ const t = e.value || e.rangeValue[0] || e.rangeValue[1];
84
+ t && (d.value = t);
85
85
  }
86
86
  );
87
- const s = u(
88
- () => b(e.dayStartOfWeek, r.value.datePicker)
89
- ), m = u(() => D(t.value, e.mode)), y = u(() => e.mode === "month" ? l("datePicker.thisMonth") : e.mode === "year" ? l("datePicker.thisYear") : e.mode === "quarter" ? l("datePicker.thisQuarter") : e.mode === "week" ? l("datePicker.thisWeek") : l("datePicker.today")), v = u(
90
- () => L({
87
+ const H = i(
88
+ () => G(e.dayStartOfWeek, P.value.datePicker)
89
+ ), _ = i(() => J(d.value, e.mode)), N = i(() => e.mode === "month" ? o("datePicker.thisMonth") : e.mode === "year" ? o("datePicker.thisYear") : e.mode === "quarter" ? o("datePicker.thisQuarter") : e.mode === "week" ? o("datePicker.thisWeek") : o("datePicker.today")), r = i(
90
+ () => X({
91
91
  mode: e.mode,
92
- viewDate: t.value,
92
+ viewDate: d.value,
93
93
  selectedValue: e.value,
94
94
  rangeValue: e.rangeValue,
95
95
  previewRangeValue: e.previewRangeValue,
@@ -97,40 +97,93 @@ const z = w({
97
97
  hideNotInViewDates: e.hideNotInViewDates,
98
98
  disabledDate: e.disabledDate,
99
99
  showLunar: e.showLunar,
100
- locale: r.value.datePicker
100
+ locale: P.value.datePicker
101
101
  })
102
- ), d = (a) => {
103
- t.value = a, n("view-date-change", a);
102
+ ), c = i(
103
+ () => e.mode === "date" || e.mode === "week" ? 7 : e.mode === "quarter" ? 2 : 3
104
+ ), T = i(() => {
105
+ const t = e.mode === "week" ? 8 : c.value;
106
+ return Array.from(
107
+ { length: Math.ceil(r.value.length / t) },
108
+ (a, l) => r.value.slice(l * t, (l + 1) * t)
109
+ );
110
+ }), k = (t) => !t.isWeekLabel && !t.disabled && t.inView, U = i(() => {
111
+ const t = r.value.filter(k);
112
+ return t.find((a) => a.title === v.value) ?? t.find((a) => a.selected || a.rangeStart || a.rangeEnd) ?? t.find((a) => a.today && !a.outView) ?? t.find((a) => !a.outView) ?? t[0];
113
+ }), j = () => {
114
+ F(() => {
115
+ var t, a;
116
+ (a = (t = W.value) == null ? void 0 : t.querySelector('[role="gridcell"][tabindex="0"]')) == null || a.focus();
117
+ });
118
+ }, y = (t) => {
119
+ d.value = t, s("view-date-change", t);
120
+ }, q = (t, a = !1) => {
121
+ y(M(d.value, e.mode, t, a)), v.value = "";
122
+ }, E = (t, a) => {
123
+ var C;
124
+ if (!k(a)) return;
125
+ const l = t.key;
126
+ if (![
127
+ "ArrowLeft",
128
+ "ArrowRight",
129
+ "ArrowUp",
130
+ "ArrowDown",
131
+ "Home",
132
+ "End",
133
+ "PageUp",
134
+ "PageDown"
135
+ ].includes(l))
136
+ return;
137
+ t.preventDefault();
138
+ const m = e.mode === "date" || e.mode === "week" ? "day" : e.mode === "year" ? "year" : "month", S = e.mode === "quarter" ? 3 : 1;
139
+ let f = l === "ArrowLeft" ? -1 : l === "ArrowRight" ? 1 : l === "ArrowUp" ? -c.value : c.value, n = a.value, w;
140
+ if (l === "Home" || l === "End") {
141
+ const u = r.value.filter((D) => !D.isWeekLabel), b = u.findIndex((D) => D.title === a.title), V = Math.floor(b / c.value) * c.value, O = Math.min(V + c.value - 1, u.length - 1);
142
+ n = u[l === "Home" ? V : O].value, w = u[l === "Home" ? O : V].value, f = l === "Home" ? 1 : -1;
143
+ } else l === "PageUp" || l === "PageDown" ? (f = l === "PageUp" ? -1 : 1, n = M(a.value, e.mode, f, t.shiftKey)) : n = n.add(f * S, m);
144
+ for (let u = 0; u < 366; u++) {
145
+ const b = g(n, e.mode);
146
+ if (!((C = e.disabledDate) != null && C.call(e, b.toDate()))) break;
147
+ if (n = n.add(f * S, m), w && (f > 0 ? n.isAfter(w, m) : n.isBefore(w, m)) || u === 365) return;
148
+ }
149
+ y(n);
150
+ const h = r.value.find(
151
+ (u) => !u.isWeekLabel && u.value.isSame(n, m)
152
+ );
153
+ h && k(h) && (v.value = h.title, A(h), j());
154
+ }, I = () => {
155
+ e.mode === "date" && y(d.value.startOf("year"));
156
+ }, z = (t) => {
157
+ t.isWeekLabel || t.disabled || !t.inView || s("select", g(t.value, e.mode, e.dayStartOfWeek));
158
+ }, A = (t) => {
159
+ t.isWeekLabel || t.disabled || !t.inView || s("cell-mouse-enter", g(t.value, e.mode, e.dayStartOfWeek));
104
160
  };
105
161
  return {
106
- t: l,
107
- className: f,
108
- cells: v,
109
- headerLabel: m,
110
- todayLabel: y,
111
- weekdayLabels: s,
112
- movePanel: (a, h = !1) => {
113
- d(P(t.value, e.mode, a, h));
114
- },
115
- zoomHeader: () => {
116
- e.mode === "date" && d(t.value.startOf("year"));
117
- },
118
- handleSelect: (a) => {
119
- a.isWeekLabel || a.disabled || !a.inView || n("select", i(a.value, e.mode, e.dayStartOfWeek));
120
- },
121
- handleCellMouseEnter: (a) => {
122
- a.isWeekLabel || a.disabled || !a.inView || n("cell-mouse-enter", i(a.value, e.mode, e.dayStartOfWeek));
123
- },
162
+ t: o,
163
+ className: x,
164
+ cells: r,
165
+ cellRows: T,
166
+ panelRef: W,
167
+ activeTitle: v,
168
+ activeCell: U,
169
+ handleCellKeydown: E,
170
+ headerLabel: _,
171
+ todayLabel: N,
172
+ weekdayLabels: H,
173
+ movePanel: q,
174
+ zoomHeader: I,
175
+ handleSelect: z,
176
+ handleCellMouseEnter: A,
124
177
  handleCellMouseLeave: () => {
125
- n("cell-mouse-leave");
178
+ s("cell-mouse-leave");
126
179
  },
127
180
  selectToday: () => {
128
- const a = c();
129
- n("select", i(a, e.mode, e.dayStartOfWeek)), d(a);
181
+ const t = R();
182
+ s("select", g(t, e.mode, e.dayStartOfWeek)), y(t);
130
183
  }
131
184
  };
132
185
  }
133
186
  });
134
187
  export {
135
- z as default
188
+ ne as default
136
189
  };