@element-plus/nightly 0.0.20220601 → 0.0.20220602

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 (308) hide show
  1. package/dist/index.full.js +191 -194
  2. package/dist/index.full.min.js +8 -8
  3. package/dist/index.full.min.js.map +1 -1
  4. package/dist/index.full.min.mjs +11 -11
  5. package/dist/index.full.min.mjs.map +1 -1
  6. package/dist/index.full.mjs +191 -194
  7. package/dist/locale/af.js +1 -1
  8. package/dist/locale/af.min.js +1 -1
  9. package/dist/locale/af.min.mjs +1 -1
  10. package/dist/locale/af.mjs +1 -1
  11. package/dist/locale/ar.js +1 -1
  12. package/dist/locale/ar.min.js +1 -1
  13. package/dist/locale/ar.min.mjs +1 -1
  14. package/dist/locale/ar.mjs +1 -1
  15. package/dist/locale/az.js +1 -1
  16. package/dist/locale/az.min.js +1 -1
  17. package/dist/locale/az.min.mjs +1 -1
  18. package/dist/locale/az.mjs +1 -1
  19. package/dist/locale/bg.js +1 -1
  20. package/dist/locale/bg.min.js +1 -1
  21. package/dist/locale/bg.min.mjs +1 -1
  22. package/dist/locale/bg.mjs +1 -1
  23. package/dist/locale/bn.js +1 -1
  24. package/dist/locale/bn.min.js +1 -1
  25. package/dist/locale/bn.min.mjs +1 -1
  26. package/dist/locale/bn.mjs +1 -1
  27. package/dist/locale/ca.js +1 -1
  28. package/dist/locale/ca.min.js +1 -1
  29. package/dist/locale/ca.min.mjs +1 -1
  30. package/dist/locale/ca.mjs +1 -1
  31. package/dist/locale/cs.js +1 -1
  32. package/dist/locale/cs.min.js +1 -1
  33. package/dist/locale/cs.min.mjs +1 -1
  34. package/dist/locale/cs.mjs +1 -1
  35. package/dist/locale/da.js +1 -1
  36. package/dist/locale/da.min.js +1 -1
  37. package/dist/locale/da.min.mjs +1 -1
  38. package/dist/locale/da.mjs +1 -1
  39. package/dist/locale/de.js +1 -1
  40. package/dist/locale/de.min.js +1 -1
  41. package/dist/locale/de.min.mjs +1 -1
  42. package/dist/locale/de.mjs +1 -1
  43. package/dist/locale/el.js +1 -1
  44. package/dist/locale/el.min.js +1 -1
  45. package/dist/locale/el.min.mjs +1 -1
  46. package/dist/locale/el.mjs +1 -1
  47. package/dist/locale/en.js +1 -1
  48. package/dist/locale/en.min.js +1 -1
  49. package/dist/locale/en.min.mjs +1 -1
  50. package/dist/locale/en.mjs +1 -1
  51. package/dist/locale/eo.js +1 -1
  52. package/dist/locale/eo.min.js +1 -1
  53. package/dist/locale/eo.min.mjs +1 -1
  54. package/dist/locale/eo.mjs +1 -1
  55. package/dist/locale/es.js +1 -1
  56. package/dist/locale/es.min.js +1 -1
  57. package/dist/locale/es.min.mjs +1 -1
  58. package/dist/locale/es.mjs +1 -1
  59. package/dist/locale/et.js +1 -1
  60. package/dist/locale/et.min.js +1 -1
  61. package/dist/locale/et.min.mjs +1 -1
  62. package/dist/locale/et.mjs +1 -1
  63. package/dist/locale/eu.js +1 -1
  64. package/dist/locale/eu.min.js +1 -1
  65. package/dist/locale/eu.min.mjs +1 -1
  66. package/dist/locale/eu.mjs +1 -1
  67. package/dist/locale/fa.js +1 -1
  68. package/dist/locale/fa.min.js +1 -1
  69. package/dist/locale/fa.min.mjs +1 -1
  70. package/dist/locale/fa.mjs +1 -1
  71. package/dist/locale/fi.js +1 -1
  72. package/dist/locale/fi.min.js +1 -1
  73. package/dist/locale/fi.min.mjs +1 -1
  74. package/dist/locale/fi.mjs +1 -1
  75. package/dist/locale/fr.js +1 -1
  76. package/dist/locale/fr.min.js +1 -1
  77. package/dist/locale/fr.min.mjs +1 -1
  78. package/dist/locale/fr.mjs +1 -1
  79. package/dist/locale/he.js +1 -1
  80. package/dist/locale/he.min.js +1 -1
  81. package/dist/locale/he.min.mjs +1 -1
  82. package/dist/locale/he.mjs +1 -1
  83. package/dist/locale/hr.js +1 -1
  84. package/dist/locale/hr.min.js +1 -1
  85. package/dist/locale/hr.min.mjs +1 -1
  86. package/dist/locale/hr.mjs +1 -1
  87. package/dist/locale/hu.js +1 -1
  88. package/dist/locale/hu.min.js +1 -1
  89. package/dist/locale/hu.min.mjs +1 -1
  90. package/dist/locale/hu.mjs +1 -1
  91. package/dist/locale/hy-am.js +1 -1
  92. package/dist/locale/hy-am.min.js +1 -1
  93. package/dist/locale/hy-am.min.mjs +1 -1
  94. package/dist/locale/hy-am.mjs +1 -1
  95. package/dist/locale/id.js +1 -1
  96. package/dist/locale/id.min.js +1 -1
  97. package/dist/locale/id.min.mjs +1 -1
  98. package/dist/locale/id.mjs +1 -1
  99. package/dist/locale/it.js +1 -1
  100. package/dist/locale/it.min.js +1 -1
  101. package/dist/locale/it.min.mjs +1 -1
  102. package/dist/locale/it.mjs +1 -1
  103. package/dist/locale/ja.js +1 -1
  104. package/dist/locale/ja.min.js +1 -1
  105. package/dist/locale/ja.min.mjs +1 -1
  106. package/dist/locale/ja.mjs +1 -1
  107. package/dist/locale/kk.js +1 -1
  108. package/dist/locale/kk.min.js +1 -1
  109. package/dist/locale/kk.min.mjs +1 -1
  110. package/dist/locale/kk.mjs +1 -1
  111. package/dist/locale/km.js +1 -1
  112. package/dist/locale/km.min.js +1 -1
  113. package/dist/locale/km.min.mjs +1 -1
  114. package/dist/locale/km.mjs +1 -1
  115. package/dist/locale/ko.js +1 -1
  116. package/dist/locale/ko.min.js +1 -1
  117. package/dist/locale/ko.min.mjs +1 -1
  118. package/dist/locale/ko.mjs +1 -1
  119. package/dist/locale/ku.js +1 -1
  120. package/dist/locale/ku.min.js +1 -1
  121. package/dist/locale/ku.min.mjs +1 -1
  122. package/dist/locale/ku.mjs +1 -1
  123. package/dist/locale/ky.js +1 -1
  124. package/dist/locale/ky.min.js +1 -1
  125. package/dist/locale/ky.min.mjs +1 -1
  126. package/dist/locale/ky.mjs +1 -1
  127. package/dist/locale/lt.js +1 -1
  128. package/dist/locale/lt.min.js +1 -1
  129. package/dist/locale/lt.min.mjs +1 -1
  130. package/dist/locale/lt.mjs +1 -1
  131. package/dist/locale/lv.js +1 -1
  132. package/dist/locale/lv.min.js +1 -1
  133. package/dist/locale/lv.min.mjs +1 -1
  134. package/dist/locale/lv.mjs +1 -1
  135. package/dist/locale/mg.js +1 -1
  136. package/dist/locale/mg.min.js +1 -1
  137. package/dist/locale/mg.min.mjs +1 -1
  138. package/dist/locale/mg.mjs +1 -1
  139. package/dist/locale/mn.js +1 -1
  140. package/dist/locale/mn.min.js +1 -1
  141. package/dist/locale/mn.min.mjs +1 -1
  142. package/dist/locale/mn.mjs +1 -1
  143. package/dist/locale/nb-no.js +1 -1
  144. package/dist/locale/nb-no.min.js +1 -1
  145. package/dist/locale/nb-no.min.mjs +1 -1
  146. package/dist/locale/nb-no.mjs +1 -1
  147. package/dist/locale/nl.js +1 -1
  148. package/dist/locale/nl.min.js +1 -1
  149. package/dist/locale/nl.min.mjs +1 -1
  150. package/dist/locale/nl.mjs +1 -1
  151. package/dist/locale/pa.js +1 -1
  152. package/dist/locale/pa.min.js +1 -1
  153. package/dist/locale/pa.min.mjs +1 -1
  154. package/dist/locale/pa.mjs +1 -1
  155. package/dist/locale/pl.js +1 -1
  156. package/dist/locale/pl.min.js +1 -1
  157. package/dist/locale/pl.min.mjs +1 -1
  158. package/dist/locale/pl.mjs +1 -1
  159. package/dist/locale/pt-br.js +1 -1
  160. package/dist/locale/pt-br.min.js +1 -1
  161. package/dist/locale/pt-br.min.mjs +1 -1
  162. package/dist/locale/pt-br.mjs +1 -1
  163. package/dist/locale/pt.js +1 -1
  164. package/dist/locale/pt.min.js +1 -1
  165. package/dist/locale/pt.min.mjs +1 -1
  166. package/dist/locale/pt.mjs +1 -1
  167. package/dist/locale/ro.js +1 -1
  168. package/dist/locale/ro.min.js +1 -1
  169. package/dist/locale/ro.min.mjs +1 -1
  170. package/dist/locale/ro.mjs +1 -1
  171. package/dist/locale/ru.js +1 -1
  172. package/dist/locale/ru.min.js +1 -1
  173. package/dist/locale/ru.min.mjs +1 -1
  174. package/dist/locale/ru.mjs +1 -1
  175. package/dist/locale/sk.js +1 -1
  176. package/dist/locale/sk.min.js +1 -1
  177. package/dist/locale/sk.min.mjs +1 -1
  178. package/dist/locale/sk.mjs +1 -1
  179. package/dist/locale/sl.js +1 -1
  180. package/dist/locale/sl.min.js +1 -1
  181. package/dist/locale/sl.min.mjs +1 -1
  182. package/dist/locale/sl.mjs +1 -1
  183. package/dist/locale/sr.js +1 -1
  184. package/dist/locale/sr.min.js +1 -1
  185. package/dist/locale/sr.min.mjs +1 -1
  186. package/dist/locale/sr.mjs +1 -1
  187. package/dist/locale/sv.js +1 -1
  188. package/dist/locale/sv.min.js +1 -1
  189. package/dist/locale/sv.min.mjs +1 -1
  190. package/dist/locale/sv.mjs +1 -1
  191. package/dist/locale/ta.js +1 -1
  192. package/dist/locale/ta.min.js +1 -1
  193. package/dist/locale/ta.min.mjs +1 -1
  194. package/dist/locale/ta.mjs +1 -1
  195. package/dist/locale/th.js +1 -1
  196. package/dist/locale/th.min.js +1 -1
  197. package/dist/locale/th.min.mjs +1 -1
  198. package/dist/locale/th.mjs +1 -1
  199. package/dist/locale/tk.js +1 -1
  200. package/dist/locale/tk.min.js +1 -1
  201. package/dist/locale/tk.min.mjs +1 -1
  202. package/dist/locale/tk.mjs +1 -1
  203. package/dist/locale/tr.js +1 -1
  204. package/dist/locale/tr.min.js +1 -1
  205. package/dist/locale/tr.min.mjs +1 -1
  206. package/dist/locale/tr.mjs +1 -1
  207. package/dist/locale/ug-cn.js +1 -1
  208. package/dist/locale/ug-cn.min.js +1 -1
  209. package/dist/locale/ug-cn.min.mjs +1 -1
  210. package/dist/locale/ug-cn.mjs +1 -1
  211. package/dist/locale/uk.js +1 -1
  212. package/dist/locale/uk.min.js +1 -1
  213. package/dist/locale/uk.min.mjs +1 -1
  214. package/dist/locale/uk.mjs +1 -1
  215. package/dist/locale/uz-uz.js +1 -1
  216. package/dist/locale/uz-uz.min.js +1 -1
  217. package/dist/locale/uz-uz.min.mjs +1 -1
  218. package/dist/locale/uz-uz.mjs +1 -1
  219. package/dist/locale/vi.js +1 -1
  220. package/dist/locale/vi.min.js +1 -1
  221. package/dist/locale/vi.min.mjs +1 -1
  222. package/dist/locale/vi.mjs +1 -1
  223. package/dist/locale/zh-cn.js +1 -1
  224. package/dist/locale/zh-cn.min.js +1 -1
  225. package/dist/locale/zh-cn.min.mjs +1 -1
  226. package/dist/locale/zh-cn.mjs +1 -1
  227. package/dist/locale/zh-tw.js +1 -1
  228. package/dist/locale/zh-tw.min.js +1 -1
  229. package/dist/locale/zh-tw.min.mjs +1 -1
  230. package/dist/locale/zh-tw.mjs +1 -1
  231. package/es/components/date-picker/src/date-picker-com/basic-year-table2.mjs +69 -75
  232. package/es/components/date-picker/src/date-picker-com/basic-year-table2.mjs.map +1 -1
  233. package/es/components/date-picker/src/date-picker-com/panel-date-pick2.mjs +56 -64
  234. package/es/components/date-picker/src/date-picker-com/panel-date-pick2.mjs.map +1 -1
  235. package/es/components/index.mjs +3 -3
  236. package/es/components/menu/src/menu-item4.mjs +1 -1
  237. package/es/components/popper/index.mjs +3 -3
  238. package/es/components/popper/index2.mjs +4 -4
  239. package/es/components/popper/src/arrow.mjs +1 -1
  240. package/es/components/popper/src/arrow3.mjs +37 -7
  241. package/es/components/popper/src/arrow3.mjs.map +1 -1
  242. package/es/components/popper/src/arrow4.mjs +7 -37
  243. package/es/components/popper/src/arrow4.mjs.map +1 -1
  244. package/es/components/popper/src/popper.mjs +1 -6
  245. package/es/components/popper/src/popper.mjs.map +1 -1
  246. package/es/components/popper/src/popper2.mjs +6 -1
  247. package/es/components/popper/src/popper2.mjs.map +1 -1
  248. package/es/components/popper/src/popper3.mjs +12 -32
  249. package/es/components/popper/src/popper3.mjs.map +1 -1
  250. package/es/components/popper/src/popper4.mjs +32 -12
  251. package/es/components/popper/src/popper4.mjs.map +1 -1
  252. package/es/components/table/src/table/defaults2.mjs.map +1 -1
  253. package/es/components/table/src/table-body/events-helper2.mjs +1 -1
  254. package/es/components/table/src/table-body/events-helper2.mjs.map +1 -1
  255. package/es/components/table/src/util2.mjs +17 -7
  256. package/es/components/table/src/util2.mjs.map +1 -1
  257. package/es/components/tooltip/src/tooltip4.mjs +3 -3
  258. package/es/index.mjs +3 -3
  259. package/es/packages/components/date-picker/src/date-picker-com/basic-year-table.vue.d.ts +26 -1
  260. package/es/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue.d.ts +64 -32
  261. package/es/packages/components/date-picker/src/utils.d.ts +40 -8
  262. package/es/packages/components/table/src/table/defaults.d.ts +1 -0
  263. package/es/packages/components/table/src/util.d.ts +1 -1
  264. package/es/packages/utils/dom/event.d.ts +2 -2
  265. package/es/packages/version.d.ts +1 -1
  266. package/es/utils/dom/event2.mjs.map +1 -1
  267. package/es/version2.mjs +1 -1
  268. package/es/version2.mjs.map +1 -1
  269. package/lib/components/date-picker/src/date-picker-com/basic-year-table2.js +68 -74
  270. package/lib/components/date-picker/src/date-picker-com/basic-year-table2.js.map +1 -1
  271. package/lib/components/date-picker/src/date-picker-com/panel-date-pick2.js +55 -63
  272. package/lib/components/date-picker/src/date-picker-com/panel-date-pick2.js.map +1 -1
  273. package/lib/components/index.js +3 -3
  274. package/lib/components/menu/src/menu-item4.js +1 -1
  275. package/lib/components/popper/index.js +3 -3
  276. package/lib/components/popper/index2.js +4 -4
  277. package/lib/components/popper/src/arrow.js +1 -1
  278. package/lib/components/popper/src/arrow3.js +37 -7
  279. package/lib/components/popper/src/arrow3.js.map +1 -1
  280. package/lib/components/popper/src/arrow4.js +7 -37
  281. package/lib/components/popper/src/arrow4.js.map +1 -1
  282. package/lib/components/popper/src/popper.js +4 -4
  283. package/lib/components/popper/src/popper.js.map +1 -1
  284. package/lib/components/popper/src/popper2.js +4 -4
  285. package/lib/components/popper/src/popper2.js.map +1 -1
  286. package/lib/components/popper/src/popper3.js +13 -32
  287. package/lib/components/popper/src/popper3.js.map +1 -1
  288. package/lib/components/popper/src/popper4.js +32 -13
  289. package/lib/components/popper/src/popper4.js.map +1 -1
  290. package/lib/components/table/src/table/defaults2.js.map +1 -1
  291. package/lib/components/table/src/table-body/events-helper2.js +1 -1
  292. package/lib/components/table/src/table-body/events-helper2.js.map +1 -1
  293. package/lib/components/table/src/util2.js +17 -7
  294. package/lib/components/table/src/util2.js.map +1 -1
  295. package/lib/components/tooltip/src/tooltip4.js +3 -3
  296. package/lib/index.js +3 -3
  297. package/lib/packages/components/date-picker/src/date-picker-com/basic-year-table.vue.d.ts +26 -1
  298. package/lib/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue.d.ts +64 -32
  299. package/lib/packages/components/date-picker/src/utils.d.ts +40 -8
  300. package/lib/packages/components/table/src/table/defaults.d.ts +1 -0
  301. package/lib/packages/components/table/src/util.d.ts +1 -1
  302. package/lib/packages/utils/dom/event.d.ts +2 -2
  303. package/lib/packages/version.d.ts +1 -1
  304. package/lib/utils/dom/event2.js.map +1 -1
  305. package/lib/version2.js +1 -1
  306. package/lib/version2.js.map +1 -1
  307. package/package.json +2 -2
  308. package/web-types.json +1 -1
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, computed, watch, nextTick, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, withKeys, withModifiers, toDisplayString } from 'vue';
1
+ import { defineComponent, ref, computed, watch, nextTick, openBlock, createElementBlock, unref, normalizeClass, createElementVNode, Fragment, renderList, withKeys, withModifiers, toDisplayString } from 'vue';
2
2
  import dayjs from 'dayjs';
3
3
  import '../../../../hooks/index2.mjs';
4
4
  import '../../../time-picker/index2.mjs';
@@ -11,17 +11,21 @@ import { useLocale } from '../../../../hooks/use-locale/index2.mjs';
11
11
  import { castArray } from '../../../../utils/arrays2.mjs';
12
12
  import { hasClass } from '../../../../utils/dom/style2.mjs';
13
13
 
14
- const datesInYear = (year, lang) => {
15
- const firstDay = dayjs(String(year)).locale(lang).startOf("year");
16
- const lastDay = firstDay.endOf("year");
17
- const numOfDays = lastDay.dayOfYear();
18
- return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
19
- };
20
- const _sfc_main = defineComponent({
14
+ const _hoisted_1 = ["aria-label"];
15
+ const _hoisted_2 = ["aria-selected", "tabindex", "onKeydown"];
16
+ const _hoisted_3 = { class: "cell" };
17
+ const _hoisted_4 = { key: 1 };
18
+ const _sfc_main = /* @__PURE__ */ defineComponent({
21
19
  props: basicYearTableProps,
22
20
  emits: ["pick"],
23
- expose: ["focus"],
24
- setup(props, ctx) {
21
+ setup(__props, { expose, emit }) {
22
+ const props = __props;
23
+ const datesInYear = (year, lang2) => {
24
+ const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
25
+ const lastDay = firstDay.endOf("year");
26
+ const numOfDays = lastDay.dayOfYear();
27
+ return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
28
+ };
25
29
  const ns = useNamespace("year-table");
26
30
  const { t, lang } = useLocale();
27
31
  const tbodyRef = ref();
@@ -29,24 +33,17 @@ const _sfc_main = defineComponent({
29
33
  const startYear = computed(() => {
30
34
  return Math.floor(props.date.year() / 10) * 10;
31
35
  });
32
- watch(() => props.date, async () => {
33
- var _a, _b;
34
- if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
35
- await nextTick();
36
- (_b = currentCellRef.value) == null ? void 0 : _b.focus();
37
- }
38
- });
39
36
  const focus = () => {
40
37
  var _a;
41
38
  (_a = currentCellRef.value) == null ? void 0 : _a.focus();
42
39
  };
43
- const getCellStyle = (year) => {
44
- const style = {};
40
+ const getCellKls = (year) => {
41
+ const kls = {};
45
42
  const today = dayjs().locale(lang.value);
46
- style.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
47
- style.current = castArray(props.parsedValue).findIndex((_) => _.year() === year) >= 0;
48
- style.today = today.year() === year;
49
- return style;
43
+ kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
44
+ kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
45
+ kls.today = today.year() === year;
46
+ return kls;
50
47
  };
51
48
  const isSelectedCell = (year) => {
52
49
  return year === startYear.value && props.date.year() < startYear.value && props.date.year() > startYear.value + 9 || castArray(props.date).findIndex((date) => date.year() === year) >= 0;
@@ -58,63 +55,60 @@ const _sfc_main = defineComponent({
58
55
  if (hasClass(target.parentNode, "disabled"))
59
56
  return;
60
57
  const year = target.textContent || target.innerText;
61
- ctx.emit("pick", Number(year));
58
+ emit("pick", Number(year));
62
59
  }
63
60
  };
64
- return {
65
- ns,
66
- t,
67
- tbodyRef,
68
- currentCellRef,
69
- startYear,
70
- focus,
71
- isSelectedCell,
72
- getCellStyle,
73
- handleYearTableClick
61
+ watch(() => props.date, async () => {
62
+ var _a, _b;
63
+ if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
64
+ await nextTick();
65
+ (_b = currentCellRef.value) == null ? void 0 : _b.focus();
66
+ }
67
+ });
68
+ expose({
69
+ focus
70
+ });
71
+ return (_ctx, _cache) => {
72
+ return openBlock(), createElementBlock("table", {
73
+ role: "grid",
74
+ "aria-label": unref(t)("el.datepicker.yearTablePrompt"),
75
+ class: normalizeClass(unref(ns).b()),
76
+ onClick: handleYearTableClick
77
+ }, [
78
+ createElementVNode("tbody", {
79
+ ref_key: "tbodyRef",
80
+ ref: tbodyRef
81
+ }, [
82
+ (openBlock(), createElementBlock(Fragment, null, renderList(3, (_, i) => {
83
+ return createElementVNode("tr", { key: i }, [
84
+ (openBlock(), createElementBlock(Fragment, null, renderList(4, (__, j) => {
85
+ return openBlock(), createElementBlock(Fragment, {
86
+ key: i + "_" + j
87
+ }, [
88
+ i * 4 + j < 10 ? (openBlock(), createElementBlock("td", {
89
+ key: 0,
90
+ ref_for: true,
91
+ ref: (el) => isSelectedCell(unref(startYear) + i * 4 + j) && (currentCellRef.value = el),
92
+ class: normalizeClass(["available", getCellKls(unref(startYear) + i * 4 + j)]),
93
+ "aria-selected": `${isSelectedCell(unref(startYear) + i * 4 + j)}`,
94
+ tabindex: isSelectedCell(unref(startYear) + i * 4 + j) ? 0 : -1,
95
+ onKeydown: [
96
+ withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
97
+ withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
98
+ ]
99
+ }, [
100
+ createElementVNode("span", _hoisted_3, toDisplayString(unref(startYear) + i * 4 + j), 1)
101
+ ], 42, _hoisted_2)) : (openBlock(), createElementBlock("td", _hoisted_4))
102
+ ], 64);
103
+ }), 64))
104
+ ]);
105
+ }), 64))
106
+ ], 512)
107
+ ], 10, _hoisted_1);
74
108
  };
75
109
  }
76
110
  });
77
- const _hoisted_1 = ["aria-label"];
78
- const _hoisted_2 = { ref: "tbodyRef" };
79
- const _hoisted_3 = ["aria-selected", "tabindex"];
80
- const _hoisted_4 = { class: "cell" };
81
- const _hoisted_5 = { key: 1 };
82
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
83
- return openBlock(), createElementBlock("table", {
84
- role: "grid",
85
- "aria-label": _ctx.t("el.datepicker.yearTablePrompt"),
86
- class: normalizeClass(_ctx.ns.b()),
87
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args))
88
- }, [
89
- createElementVNode("tbody", _hoisted_2, [
90
- (openBlock(), createElementBlock(Fragment, null, renderList(3, (_, i) => {
91
- return createElementVNode("tr", { key: i }, [
92
- (openBlock(), createElementBlock(Fragment, null, renderList(4, (__, j) => {
93
- return openBlock(), createElementBlock(Fragment, {
94
- key: i + "_" + j
95
- }, [
96
- i * 4 + j < 10 ? (openBlock(), createElementBlock("td", {
97
- key: 0,
98
- ref_for: true,
99
- ref: (el) => _ctx.isSelectedCell(_ctx.startYear + i * 4 + j) && (_ctx.currentCellRef = el),
100
- class: normalizeClass(["available", _ctx.getCellStyle(_ctx.startYear + i * 4 + j)]),
101
- "aria-selected": `${_ctx.isSelectedCell(_ctx.startYear + i * 4 + j)}`,
102
- tabindex: _ctx.isSelectedCell(_ctx.startYear + i * 4 + j) ? 0 : -1,
103
- onKeydown: [
104
- _cache[0] || (_cache[0] = withKeys(withModifiers((...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args), ["prevent", "stop"]), ["space"])),
105
- _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => _ctx.handleYearTableClick && _ctx.handleYearTableClick(...args), ["prevent", "stop"]), ["enter"]))
106
- ]
107
- }, [
108
- createElementVNode("span", _hoisted_4, toDisplayString(_ctx.startYear + i * 4 + j), 1)
109
- ], 42, _hoisted_3)) : (openBlock(), createElementBlock("td", _hoisted_5))
110
- ], 64);
111
- }), 64))
112
- ]);
113
- }), 64))
114
- ], 512)
115
- ], 10, _hoisted_1);
116
- }
117
- var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
111
+ var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/date-picker/src/date-picker-com/basic-year-table.vue"]]);
118
112
 
119
113
  export { YearTable as default };
120
114
  //# sourceMappingURL=basic-year-table2.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"basic-year-table2.mjs","sources":["../../../../../../../packages/components/date-picker/src/date-picker-com/basic-year-table.vue"],"sourcesContent":["<template>\n <table\n role=\"grid\"\n :aria-label=\"t('el.datepicker.yearTablePrompt')\"\n :class=\"ns.b()\"\n @click=\"handleYearTableClick\"\n >\n <tbody ref=\"tbodyRef\">\n <tr v-for=\"(_, i) in 3\" :key=\"i\">\n <template v-for=\"(__, j) in 4\" :key=\"i + '_' + j\">\n <td\n v-if=\"i * 4 + j < 10\"\n :ref=\"\n (el) =>\n isSelectedCell(startYear + i * 4 + j) && (currentCellRef = el as HTMLElement)\n \"\n class=\"available\"\n :class=\"getCellStyle(startYear + i * 4 + j)\"\n :aria-selected=\"`${isSelectedCell(startYear + i * 4 + j)}`\"\n :tabindex=\"isSelectedCell(startYear + i * 4 + j) ? 0 : -1\"\n @keydown.space.prevent.stop=\"handleYearTableClick\"\n @keydown.enter.prevent.stop=\"handleYearTableClick\"\n >\n <span class=\"cell\">{{ startYear + i * 4 + j }}</span>\n </td>\n <td v-else />\n </template>\n </tr>\n </tbody>\n </table>\n</template>\n\n<script lang=\"ts\">\nimport { computed, defineComponent, nextTick, ref, watch } from 'vue'\nimport dayjs from 'dayjs'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { rangeArr } from '@element-plus/components/time-picker'\nimport { castArray, hasClass } from '@element-plus/utils'\nimport { basicYearTableProps } from '../props/basic-year-table'\n\nconst datesInYear = (year: number, lang: string) => {\n const firstDay = dayjs(String(year)).locale(lang).startOf('year')\n const lastDay = firstDay.endOf('year')\n const numOfDays = lastDay.dayOfYear()\n return rangeArr(numOfDays).map((n) => firstDay.add(n, 'day').toDate())\n}\n\nexport default defineComponent({\n props: basicYearTableProps,\n\n emits: ['pick'],\n expose: ['focus'],\n\n setup(props, ctx) {\n const ns = useNamespace('year-table')\n\n const { t, lang } = useLocale()\n const tbodyRef = ref<HTMLElement>()\n const currentCellRef = ref<HTMLElement>()\n const startYear = computed(() => {\n return Math.floor(props.date.year() / 10) * 10\n })\n\n watch(\n () => props.date,\n async () => {\n if (tbodyRef.value?.contains(document.activeElement)) {\n await nextTick()\n currentCellRef.value?.focus()\n }\n }\n )\n\n const focus = () => {\n currentCellRef.value?.focus()\n }\n\n const getCellStyle = (year: number) => {\n const style: Record<string, boolean> = {}\n const today = dayjs().locale(lang.value)\n\n style.disabled = props.disabledDate\n ? datesInYear(year, lang.value).every(props.disabledDate)\n : false\n\n style.current =\n castArray(props.parsedValue).findIndex((_) => _.year() === year) >= 0\n\n style.today = today.year() === year\n\n return style\n }\n\n const isSelectedCell = (year: number) => {\n return (\n (year === startYear.value &&\n props.date.year() < startYear.value &&\n props.date.year() > startYear.value + 9) ||\n castArray(props.date).findIndex((date) => date.year() === year) >= 0\n )\n }\n\n const handleYearTableClick = (event: MouseEvent | KeyboardEvent) => {\n const clickTarget = event.target as HTMLDivElement\n const target = clickTarget.closest('td')\n if (target) {\n if (hasClass((target as any).parentNode, 'disabled')) return\n const year = target.textContent || target.innerText\n ctx.emit('pick', Number(year))\n }\n }\n return {\n ns,\n t,\n tbodyRef,\n currentCellRef,\n startYear,\n focus,\n isSelectedCell,\n getCellStyle,\n handleYearTableClick,\n }\n },\n})\n</script>\n"],"names":["_createElementBlock","_normalizeClass","_openBlock","_Fragment","_renderList","_withKeys","_withModifiers","_createElementVNode","_toDisplayString"],"mappings":";;;;;;;;;;;;;AAwCA,MAAM,WAAA,GAAc,CAAC,IAAA,EAAc,IAAiB,KAAA;AAClD,EAAM,MAAA,QAAA,GAAW,KAAM,CAAA,MAAA,CAAO,IAAI,CAAC,EAAE,MAAO,CAAA,IAAI,CAAE,CAAA,OAAA,CAAQ,MAAM,CAAA,CAAA;AAChE,EAAM,MAAA,OAAA,GAAU,QAAS,CAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AACrC,EAAM,MAAA,SAAA,GAAY,QAAQ,SAAU,EAAA,CAAA;AACpC,EAAA,OAAO,QAAS,CAAA,SAAS,CAAE,CAAA,GAAA,CAAI,CAAC,CAAA,KAAM,QAAS,CAAA,GAAA,CAAI,CAAG,EAAA,KAAK,CAAE,CAAA,MAAA,EAAQ,CAAA,CAAA;AACvE,CAAA,CAAA;AAEA,MAAK,YAAa,eAAa,CAAA;AAAA,EAC7B,KAAO,EAAA,mBAAA;AAAA,EAEP,KAAA,EAAO,CAAC,MAAM,CAAA;AAAA,EACd,MAAA,EAAQ,CAAC,OAAO,CAAA;AAAA,EAEhB,KAAA,CAAM,OAAO,GAAK,EAAA;AAChB,IAAM,MAAA,EAAA,GAAK,aAAa,YAAY,CAAA,CAAA;AAEpC,IAAM,MAAA,EAAE,CAAG,EAAA,IAAA,EAAA,GAAS,SAAU,EAAA,CAAA;AAC9B,IAAA,MAAM,WAAW,GAAiB,EAAA,CAAA;AAClC,IAAA,MAAM,iBA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A,CAAA,GAAA,CAAA,GAAA,CAAA,CAAA,KAAQ,IAAC,CAAA,cAAA,GAAA,EAAA,CAAA;AAAA,gBACtD,KAAU,EAAAF,cAAA,CAAA,CAAA,WAA2B,EAAA,IAAA,CAAA,aAAQ,IAAC,CAAA,SAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,gBAC9C,eAAO,EAAA,CAAA,EAAA,IAAA,CAAA,cAAA,CAAA,IAAA,CAAA,SAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA;AAAA,gBAAA,QAAA,EAAA,IAAA,CAAA,cAAA,CAAA,IAAA,CAAA,SAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,CAAA,GAAA,CAAA,GAAA,CAAA,CAAqB;AAAoB,gBAAA,SAAA,EAAA;AACA,kBAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAI,QAAA,CAAAC,aAAA,CAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,oBAAA,IAAA,IAAA,CAAA,oBAAA,CAAA,GAAA,IAAA,CAAA,EAAA,CAAA,SAAA,EAAA,MAAA,CAAA,CAAA,EAAA,CAAA,OAAA,CAAA,CAAA,CAAA;;AAEjD,iBAAA;AAA2C,eAAA,EAAA;AAEhC,gBAAAC,kBAAA,CAAA,MAAA,EAAA,UAAA,EAAAC,eAAA,CAAA,IAAA,CAAA,SAAA,GAAA,CAAA,GAAA,CAAA,GAAA,CAAA,CAAA,EAAA,CAAA,CAAA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"basic-year-table2.mjs","sources":["../../../../../../../packages/components/date-picker/src/date-picker-com/basic-year-table.vue"],"sourcesContent":["<template>\n <table\n role=\"grid\"\n :aria-label=\"t('el.datepicker.yearTablePrompt')\"\n :class=\"ns.b()\"\n @click=\"handleYearTableClick\"\n >\n <tbody ref=\"tbodyRef\">\n <tr v-for=\"(_, i) in 3\" :key=\"i\">\n <template v-for=\"(__, j) in 4\" :key=\"i + '_' + j\">\n <td\n v-if=\"i * 4 + j < 10\"\n :ref=\"\n (el) =>\n isSelectedCell(startYear + i * 4 + j) && (currentCellRef = el as HTMLElement)\n \"\n class=\"available\"\n :class=\"getCellKls(startYear + i * 4 + j)\"\n :aria-selected=\"`${isSelectedCell(startYear + i * 4 + j)}`\"\n :tabindex=\"isSelectedCell(startYear + i * 4 + j) ? 0 : -1\"\n @keydown.space.prevent.stop=\"handleYearTableClick\"\n @keydown.enter.prevent.stop=\"handleYearTableClick\"\n >\n <span class=\"cell\">{{ startYear + i * 4 + j }}</span>\n </td>\n <td v-else />\n </template>\n </tr>\n </tbody>\n </table>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, nextTick, ref, watch } from 'vue'\nimport dayjs from 'dayjs'\nimport { useLocale, useNamespace } from '@element-plus/hooks'\nimport { rangeArr } from '@element-plus/components/time-picker'\nimport { castArray, hasClass } from '@element-plus/utils'\nimport { basicYearTableProps } from '../props/basic-year-table'\n\nconst datesInYear = (year: number, lang: string) => {\n const firstDay = dayjs(String(year)).locale(lang).startOf('year')\n const lastDay = firstDay.endOf('year')\n const numOfDays = lastDay.dayOfYear()\n return rangeArr(numOfDays).map((n) => firstDay.add(n, 'day').toDate())\n}\n\nconst props = defineProps(basicYearTableProps)\nconst emit = defineEmits(['pick'])\n\nconst ns = useNamespace('year-table')\n\nconst { t, lang } = useLocale()\nconst tbodyRef = ref<HTMLElement>()\nconst currentCellRef = ref<HTMLElement>()\nconst startYear = computed(() => {\n return Math.floor(props.date.year() / 10) * 10\n})\n\nconst focus = () => {\n currentCellRef.value?.focus()\n}\n\nconst getCellKls = (year: number) => {\n const kls: Record<string, boolean> = {}\n const today = dayjs().locale(lang.value)\n\n kls.disabled = props.disabledDate\n ? datesInYear(year, lang.value).every(props.disabledDate)\n : false\n\n kls.current =\n castArray(props.parsedValue).findIndex((d) => d!.year() === year) >= 0\n\n kls.today = today.year() === year\n\n return kls\n}\n\nconst isSelectedCell = (year: number) => {\n return (\n (year === startYear.value &&\n props.date.year() < startYear.value &&\n props.date.year() > startYear.value + 9) ||\n castArray(props.date).findIndex((date) => date.year() === year) >= 0\n )\n}\n\nconst handleYearTableClick = (event: MouseEvent | KeyboardEvent) => {\n const clickTarget = event.target as HTMLDivElement\n const target = clickTarget.closest('td')\n if (target) {\n if (hasClass((target as any).parentNode, 'disabled')) return\n const year = target.textContent || target.innerText\n emit('pick', Number(year))\n }\n}\n\nwatch(\n () => props.date,\n async () => {\n if (tbodyRef.value?.contains(document.activeElement)) {\n await nextTick()\n currentCellRef.value?.focus()\n }\n }\n)\n\ndefineExpose({\n /**\n * @description focus on the current cell\n */\n focus,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,MAAA,WAAA,GAAc,CAAC,IAAA,EAAc,KAAiB,KAAA;AAClD,MAAM,MAAA,QAAA,GAAW,KAAM,CAAA,MAAA,CAAO,IAAI,CAAC,EAAE,MAAO,CAAA,KAAI,CAAE,CAAA,OAAA,CAAQ,MAAM,CAAA,CAAA;AAChE,MAAM,MAAA,OAAA,GAAU,QAAS,CAAA,KAAA,CAAM,MAAM,CAAA,CAAA;AACrC,MAAM,MAAA,SAAA,GAAY,QAAQ,SAAU,EAAA,CAAA;AACpC,MAAA,OAAO,QAAS,CAAA,SAAS,CAAE,CAAA,GAAA,CAAI,CAAC,CAAA,KAAM,QAAS,CAAA,GAAA,CAAI,CAAG,EAAA,KAAK,CAAE,CAAA,MAAA,EAAQ,CAAA,CAAA;AAAA,KACvE,CAAA;AAKA,IAAM,MAAA,EAAA,GAAK,aAAa,YAAY,CAAA,CAAA;AAEpC,IAAM,MAAA,EAAE,CAAG,EAAA,IAAA,EAAA,GAAS,SAAU,EAAA,CAAA;AAC9B,IAAA,MAAM,WAAW,GAAiB,EAAA,CAAA;AAClC,IAAA,MAAM,iBAAiB,GAAiB,EAAA,CAAA;AACxC,IAAM,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lock, normalizeClass, unref, createElementVNode, renderSlot, Fragment, renderList, toDisplayString, createCommentVNode, createVNode, withDirectives, withCtx, vShow, withKeys, createBlock, createTextVNode } from 'vue';
1
+ import { defineComponent, useAttrs, useSlots, inject, toRef, ref, computed, nextTick, watch, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, renderSlot, Fragment, renderList, toDisplayString, createCommentVNode, createVNode, withDirectives, withCtx, vShow, withKeys, createBlock, createTextVNode } from 'vue';
2
2
  import dayjs from 'dayjs';
3
3
  import { ElButton } from '../../../button/index2.mjs';
4
4
  import '../../../../directives/index2.mjs';
@@ -27,10 +27,8 @@ import ClickOutside from '../../../../directives/click-outside/index2.mjs';
27
27
  const _hoisted_1 = ["onClick"];
28
28
  const _hoisted_2 = ["aria-label"];
29
29
  const _hoisted_3 = ["aria-label"];
30
- const _hoisted_4 = ["onKeydown"];
31
- const _hoisted_5 = ["onKeydown"];
32
- const _hoisted_6 = ["aria-label"];
33
- const _hoisted_7 = ["aria-label"];
30
+ const _hoisted_4 = ["aria-label"];
31
+ const _hoisted_5 = ["aria-label"];
34
32
  const _sfc_main = /* @__PURE__ */ defineComponent({
35
33
  props: panelDatePickProps,
36
34
  emits: ["pick", "set-picker-option", "panel-change"],
@@ -98,28 +96,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
98
96
  emit(value, true);
99
97
  }
100
98
  };
101
- const prevMonth_ = () => {
102
- innerDate.value = innerDate.value.subtract(1, "month");
99
+ const moveByMonth = (forward) => {
100
+ const action = forward ? "add" : "subtract";
101
+ innerDate.value = innerDate.value[action](1, "month");
103
102
  handlePanelChange("month");
104
103
  };
105
- const nextMonth_ = () => {
106
- innerDate.value = innerDate.value.add(1, "month");
107
- handlePanelChange("month");
108
- };
109
- const prevYear_ = () => {
110
- if (currentView.value === "year") {
111
- innerDate.value = innerDate.value.subtract(10, "year");
112
- } else {
113
- innerDate.value = innerDate.value.subtract(1, "year");
114
- }
115
- handlePanelChange("year");
116
- };
117
- const nextYear_ = () => {
118
- if (currentView.value === "year") {
119
- innerDate.value = innerDate.value.add(10, "year");
120
- } else {
121
- innerDate.value = innerDate.value.add(1, "year");
122
- }
104
+ const moveByYear = (forward) => {
105
+ const currentDate = innerDate.value;
106
+ const action = forward ? "add" : "subtract";
107
+ innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
123
108
  handlePanelChange("year");
124
109
  };
125
110
  const currentView = ref("date");
@@ -157,16 +142,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
157
142
  const keyboardMode = computed(() => {
158
143
  return selectionMode.value === "date" ? currentView.value : selectionMode.value;
159
144
  });
160
- watch(() => selectionMode.value, (val) => {
161
- if (["month", "year"].includes(val)) {
162
- currentView.value = val;
163
- return;
164
- }
165
- currentView.value = "date";
166
- }, { immediate: true });
167
- watch(() => currentView.value, () => {
168
- popper == null ? void 0 : popper.updatePopper();
169
- });
170
145
  const hasShortcuts = computed(() => !!shortcuts.length);
171
146
  const handleMonthPick = async (month2) => {
172
147
  innerDate.value = innerDate.value.startOf("month").month(month2);
@@ -197,13 +172,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
197
172
  }
198
173
  handlePanelChange("year");
199
174
  };
200
- const showMonthPicker = async () => {
201
- currentView.value = "month";
202
- await nextTick();
203
- handleFocusPicker();
204
- };
205
- const showYearPicker = async () => {
206
- currentView.value = "year";
175
+ const showPicker = async (view) => {
176
+ currentView.value = view;
207
177
  await nextTick();
208
178
  handleFocusPicker();
209
179
  };
@@ -260,8 +230,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
260
230
  const handleTimePickClose = () => {
261
231
  timePickerVisible.value = false;
262
232
  };
233
+ const getUnits = (date) => {
234
+ return {
235
+ hour: date.hour(),
236
+ minute: date.minute(),
237
+ second: date.second(),
238
+ year: date.year(),
239
+ month: date.month(),
240
+ date: date.date()
241
+ };
242
+ };
263
243
  const handleTimePick = (value, visible, first) => {
264
- const newDate = props.parsedValue ? props.parsedValue.hour(value.hour()).minute(value.minute()).second(value.second()) : value;
244
+ const { hour, minute, second } = getUnits(value);
245
+ const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
265
246
  innerDate.value = newDate;
266
247
  emit(innerDate.value, true);
267
248
  if (!first) {
@@ -271,7 +252,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
271
252
  const handleVisibleTimeChange = (value) => {
272
253
  const newDate = dayjs(value, timeFormat.value).locale(lang.value);
273
254
  if (newDate.isValid() && checkDateWithinRange(newDate)) {
274
- innerDate.value = newDate.year(innerDate.value.year()).month(innerDate.value.month()).date(innerDate.value.date());
255
+ const { year: year2, month: month2, date } = getUnits(innerDate.value);
256
+ innerDate.value = newDate.year(year2).month(month2).date(date);
275
257
  userInputTime.value = null;
276
258
  timePickerVisible.value = false;
277
259
  emit(innerDate.value, true);
@@ -283,7 +265,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
283
265
  if (disabledDate && disabledDate(newDate.toDate())) {
284
266
  return;
285
267
  }
286
- innerDate.value = newDate.hour(innerDate.value.hour()).minute(innerDate.value.minute()).second(innerDate.value.second());
268
+ const { hour, minute, second } = getUnits(innerDate.value);
269
+ innerDate.value = newDate.hour(hour).minute(minute).second(second);
287
270
  userInputDate.value = null;
288
271
  emit(innerDate.value, true);
289
272
  }
@@ -311,7 +294,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
311
294
  const handleFocusPicker = async () => {
312
295
  var _a;
313
296
  if (["week", "month", "year", "date"].includes(selectionMode.value)) {
314
- ;
315
297
  (_a = currentViewRef.value) == null ? void 0 : _a.focus();
316
298
  if (selectionMode.value === "week") {
317
299
  handleKeyControl(EVENT_CODE.down);
@@ -320,7 +302,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
320
302
  };
321
303
  const handleKeydownTable = (event) => {
322
304
  const { code } = event;
323
- const list = [
305
+ const validCode = [
324
306
  EVENT_CODE.up,
325
307
  EVENT_CODE.down,
326
308
  EVENT_CODE.left,
@@ -330,7 +312,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
330
312
  EVENT_CODE.pageUp,
331
313
  EVENT_CODE.pageDown
332
314
  ];
333
- if (list.includes(code)) {
315
+ if (validCode.includes(code)) {
334
316
  handleKeyControl(code);
335
317
  event.stopPropagation();
336
318
  event.preventDefault();
@@ -395,10 +377,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
395
377
  const handlePanelChange = (mode) => {
396
378
  contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
397
379
  };
398
- contextEmit("set-picker-option", ["isValidValue", isValidValue]);
399
- contextEmit("set-picker-option", ["formatToString", formatToString]);
400
- contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
401
- contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
380
+ watch(() => selectionMode.value, (val) => {
381
+ if (["month", "year"].includes(val)) {
382
+ currentView.value = val;
383
+ return;
384
+ }
385
+ currentView.value = "date";
386
+ }, { immediate: true });
387
+ watch(() => currentView.value, () => {
388
+ popper == null ? void 0 : popper.updatePopper();
389
+ });
402
390
  watch(() => defaultValue.value, (val) => {
403
391
  if (val) {
404
392
  innerDate.value = getDefaultValue();
@@ -415,6 +403,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
415
403
  innerDate.value = getDefaultValue();
416
404
  }
417
405
  }, { immediate: true });
406
+ contextEmit("set-picker-option", ["isValidValue", isValidValue]);
407
+ contextEmit("set-picker-option", ["formatToString", formatToString]);
408
+ contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
409
+ contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
418
410
  return (_ctx, _cache) => {
419
411
  return openBlock(), createElementBlock("div", {
420
412
  class: normalizeClass([
@@ -498,7 +490,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
498
490
  type: "button",
499
491
  "aria-label": unref(t)(`el.datepicker.prevYear`),
500
492
  class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
501
- onClick: prevYear_
493
+ onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
502
494
  }, [
503
495
  createVNode(unref(ElIcon), null, {
504
496
  default: withCtx(() => [
@@ -511,7 +503,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
511
503
  type: "button",
512
504
  "aria-label": unref(t)(`el.datepicker.prevMonth`),
513
505
  class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
514
- onClick: prevMonth_
506
+ onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
515
507
  }, [
516
508
  createVNode(unref(ElIcon), null, {
517
509
  default: withCtx(() => [
@@ -528,9 +520,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
528
520
  class: normalizeClass(unref(dpNs).e("header-label")),
529
521
  "aria-live": "polite",
530
522
  tabindex: "0",
531
- onKeydown: withKeys(showYearPicker, ["enter"]),
532
- onClick: showYearPicker
533
- }, toDisplayString(unref(yearLabel)), 43, _hoisted_4),
523
+ onKeydown: _cache[4] || (_cache[4] = withKeys(($event) => showPicker("year"), ["enter"])),
524
+ onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
525
+ }, toDisplayString(unref(yearLabel)), 35),
534
526
  withDirectives(createElementVNode("span", {
535
527
  role: "button",
536
528
  "aria-live": "polite",
@@ -539,9 +531,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
539
531
  unref(dpNs).e("header-label"),
540
532
  { active: currentView.value === "month" }
541
533
  ]),
542
- onKeydown: withKeys(showMonthPicker, ["enter"]),
543
- onClick: showMonthPicker
544
- }, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 43, _hoisted_5), [
534
+ onKeydown: _cache[6] || (_cache[6] = withKeys(($event) => showPicker("month"), ["enter"])),
535
+ onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
536
+ }, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 35), [
545
537
  [vShow, currentView.value === "date"]
546
538
  ]),
547
539
  createElementVNode("span", {
@@ -551,7 +543,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
551
543
  type: "button",
552
544
  "aria-label": unref(t)(`el.datepicker.nextMonth`),
553
545
  class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
554
- onClick: nextMonth_
546
+ onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
555
547
  }, [
556
548
  createVNode(unref(ElIcon), null, {
557
549
  default: withCtx(() => [
@@ -559,14 +551,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
559
551
  ]),
560
552
  _: 1
561
553
  })
562
- ], 10, _hoisted_6), [
554
+ ], 10, _hoisted_4), [
563
555
  [vShow, currentView.value === "date"]
564
556
  ]),
565
557
  createElementVNode("button", {
566
558
  type: "button",
567
559
  "aria-label": unref(t)(`el.datepicker.nextYear`),
568
560
  class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
569
- onClick: nextYear_
561
+ onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
570
562
  }, [
571
563
  createVNode(unref(ElIcon), null, {
572
564
  default: withCtx(() => [
@@ -574,7 +566,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
574
566
  ]),
575
567
  _: 1
576
568
  })
577
- ], 10, _hoisted_7)
569
+ ], 10, _hoisted_5)
578
570
  ], 2)
579
571
  ], 2), [
580
572
  [vShow, currentView.value !== "time"]