@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.
- package/dist/index.full.js +191 -194
- package/dist/index.full.min.js +8 -8
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +11 -11
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +191 -194
- package/dist/locale/af.js +1 -1
- package/dist/locale/af.min.js +1 -1
- package/dist/locale/af.min.mjs +1 -1
- package/dist/locale/af.mjs +1 -1
- package/dist/locale/ar.js +1 -1
- package/dist/locale/ar.min.js +1 -1
- package/dist/locale/ar.min.mjs +1 -1
- package/dist/locale/ar.mjs +1 -1
- package/dist/locale/az.js +1 -1
- package/dist/locale/az.min.js +1 -1
- package/dist/locale/az.min.mjs +1 -1
- package/dist/locale/az.mjs +1 -1
- package/dist/locale/bg.js +1 -1
- package/dist/locale/bg.min.js +1 -1
- package/dist/locale/bg.min.mjs +1 -1
- package/dist/locale/bg.mjs +1 -1
- package/dist/locale/bn.js +1 -1
- package/dist/locale/bn.min.js +1 -1
- package/dist/locale/bn.min.mjs +1 -1
- package/dist/locale/bn.mjs +1 -1
- package/dist/locale/ca.js +1 -1
- package/dist/locale/ca.min.js +1 -1
- package/dist/locale/ca.min.mjs +1 -1
- package/dist/locale/ca.mjs +1 -1
- package/dist/locale/cs.js +1 -1
- package/dist/locale/cs.min.js +1 -1
- package/dist/locale/cs.min.mjs +1 -1
- package/dist/locale/cs.mjs +1 -1
- package/dist/locale/da.js +1 -1
- package/dist/locale/da.min.js +1 -1
- package/dist/locale/da.min.mjs +1 -1
- package/dist/locale/da.mjs +1 -1
- package/dist/locale/de.js +1 -1
- package/dist/locale/de.min.js +1 -1
- package/dist/locale/de.min.mjs +1 -1
- package/dist/locale/de.mjs +1 -1
- package/dist/locale/el.js +1 -1
- package/dist/locale/el.min.js +1 -1
- package/dist/locale/el.min.mjs +1 -1
- package/dist/locale/el.mjs +1 -1
- package/dist/locale/en.js +1 -1
- package/dist/locale/en.min.js +1 -1
- package/dist/locale/en.min.mjs +1 -1
- package/dist/locale/en.mjs +1 -1
- package/dist/locale/eo.js +1 -1
- package/dist/locale/eo.min.js +1 -1
- package/dist/locale/eo.min.mjs +1 -1
- package/dist/locale/eo.mjs +1 -1
- package/dist/locale/es.js +1 -1
- package/dist/locale/es.min.js +1 -1
- package/dist/locale/es.min.mjs +1 -1
- package/dist/locale/es.mjs +1 -1
- package/dist/locale/et.js +1 -1
- package/dist/locale/et.min.js +1 -1
- package/dist/locale/et.min.mjs +1 -1
- package/dist/locale/et.mjs +1 -1
- package/dist/locale/eu.js +1 -1
- package/dist/locale/eu.min.js +1 -1
- package/dist/locale/eu.min.mjs +1 -1
- package/dist/locale/eu.mjs +1 -1
- package/dist/locale/fa.js +1 -1
- package/dist/locale/fa.min.js +1 -1
- package/dist/locale/fa.min.mjs +1 -1
- package/dist/locale/fa.mjs +1 -1
- package/dist/locale/fi.js +1 -1
- package/dist/locale/fi.min.js +1 -1
- package/dist/locale/fi.min.mjs +1 -1
- package/dist/locale/fi.mjs +1 -1
- package/dist/locale/fr.js +1 -1
- package/dist/locale/fr.min.js +1 -1
- package/dist/locale/fr.min.mjs +1 -1
- package/dist/locale/fr.mjs +1 -1
- package/dist/locale/he.js +1 -1
- package/dist/locale/he.min.js +1 -1
- package/dist/locale/he.min.mjs +1 -1
- package/dist/locale/he.mjs +1 -1
- package/dist/locale/hr.js +1 -1
- package/dist/locale/hr.min.js +1 -1
- package/dist/locale/hr.min.mjs +1 -1
- package/dist/locale/hr.mjs +1 -1
- package/dist/locale/hu.js +1 -1
- package/dist/locale/hu.min.js +1 -1
- package/dist/locale/hu.min.mjs +1 -1
- package/dist/locale/hu.mjs +1 -1
- package/dist/locale/hy-am.js +1 -1
- package/dist/locale/hy-am.min.js +1 -1
- package/dist/locale/hy-am.min.mjs +1 -1
- package/dist/locale/hy-am.mjs +1 -1
- package/dist/locale/id.js +1 -1
- package/dist/locale/id.min.js +1 -1
- package/dist/locale/id.min.mjs +1 -1
- package/dist/locale/id.mjs +1 -1
- package/dist/locale/it.js +1 -1
- package/dist/locale/it.min.js +1 -1
- package/dist/locale/it.min.mjs +1 -1
- package/dist/locale/it.mjs +1 -1
- package/dist/locale/ja.js +1 -1
- package/dist/locale/ja.min.js +1 -1
- package/dist/locale/ja.min.mjs +1 -1
- package/dist/locale/ja.mjs +1 -1
- package/dist/locale/kk.js +1 -1
- package/dist/locale/kk.min.js +1 -1
- package/dist/locale/kk.min.mjs +1 -1
- package/dist/locale/kk.mjs +1 -1
- package/dist/locale/km.js +1 -1
- package/dist/locale/km.min.js +1 -1
- package/dist/locale/km.min.mjs +1 -1
- package/dist/locale/km.mjs +1 -1
- package/dist/locale/ko.js +1 -1
- package/dist/locale/ko.min.js +1 -1
- package/dist/locale/ko.min.mjs +1 -1
- package/dist/locale/ko.mjs +1 -1
- package/dist/locale/ku.js +1 -1
- package/dist/locale/ku.min.js +1 -1
- package/dist/locale/ku.min.mjs +1 -1
- package/dist/locale/ku.mjs +1 -1
- package/dist/locale/ky.js +1 -1
- package/dist/locale/ky.min.js +1 -1
- package/dist/locale/ky.min.mjs +1 -1
- package/dist/locale/ky.mjs +1 -1
- package/dist/locale/lt.js +1 -1
- package/dist/locale/lt.min.js +1 -1
- package/dist/locale/lt.min.mjs +1 -1
- package/dist/locale/lt.mjs +1 -1
- package/dist/locale/lv.js +1 -1
- package/dist/locale/lv.min.js +1 -1
- package/dist/locale/lv.min.mjs +1 -1
- package/dist/locale/lv.mjs +1 -1
- package/dist/locale/mg.js +1 -1
- package/dist/locale/mg.min.js +1 -1
- package/dist/locale/mg.min.mjs +1 -1
- package/dist/locale/mg.mjs +1 -1
- package/dist/locale/mn.js +1 -1
- package/dist/locale/mn.min.js +1 -1
- package/dist/locale/mn.min.mjs +1 -1
- package/dist/locale/mn.mjs +1 -1
- package/dist/locale/nb-no.js +1 -1
- package/dist/locale/nb-no.min.js +1 -1
- package/dist/locale/nb-no.min.mjs +1 -1
- package/dist/locale/nb-no.mjs +1 -1
- package/dist/locale/nl.js +1 -1
- package/dist/locale/nl.min.js +1 -1
- package/dist/locale/nl.min.mjs +1 -1
- package/dist/locale/nl.mjs +1 -1
- package/dist/locale/pa.js +1 -1
- package/dist/locale/pa.min.js +1 -1
- package/dist/locale/pa.min.mjs +1 -1
- package/dist/locale/pa.mjs +1 -1
- package/dist/locale/pl.js +1 -1
- package/dist/locale/pl.min.js +1 -1
- package/dist/locale/pl.min.mjs +1 -1
- package/dist/locale/pl.mjs +1 -1
- package/dist/locale/pt-br.js +1 -1
- package/dist/locale/pt-br.min.js +1 -1
- package/dist/locale/pt-br.min.mjs +1 -1
- package/dist/locale/pt-br.mjs +1 -1
- package/dist/locale/pt.js +1 -1
- package/dist/locale/pt.min.js +1 -1
- package/dist/locale/pt.min.mjs +1 -1
- package/dist/locale/pt.mjs +1 -1
- package/dist/locale/ro.js +1 -1
- package/dist/locale/ro.min.js +1 -1
- package/dist/locale/ro.min.mjs +1 -1
- package/dist/locale/ro.mjs +1 -1
- package/dist/locale/ru.js +1 -1
- package/dist/locale/ru.min.js +1 -1
- package/dist/locale/ru.min.mjs +1 -1
- package/dist/locale/ru.mjs +1 -1
- package/dist/locale/sk.js +1 -1
- package/dist/locale/sk.min.js +1 -1
- package/dist/locale/sk.min.mjs +1 -1
- package/dist/locale/sk.mjs +1 -1
- package/dist/locale/sl.js +1 -1
- package/dist/locale/sl.min.js +1 -1
- package/dist/locale/sl.min.mjs +1 -1
- package/dist/locale/sl.mjs +1 -1
- package/dist/locale/sr.js +1 -1
- package/dist/locale/sr.min.js +1 -1
- package/dist/locale/sr.min.mjs +1 -1
- package/dist/locale/sr.mjs +1 -1
- package/dist/locale/sv.js +1 -1
- package/dist/locale/sv.min.js +1 -1
- package/dist/locale/sv.min.mjs +1 -1
- package/dist/locale/sv.mjs +1 -1
- package/dist/locale/ta.js +1 -1
- package/dist/locale/ta.min.js +1 -1
- package/dist/locale/ta.min.mjs +1 -1
- package/dist/locale/ta.mjs +1 -1
- package/dist/locale/th.js +1 -1
- package/dist/locale/th.min.js +1 -1
- package/dist/locale/th.min.mjs +1 -1
- package/dist/locale/th.mjs +1 -1
- package/dist/locale/tk.js +1 -1
- package/dist/locale/tk.min.js +1 -1
- package/dist/locale/tk.min.mjs +1 -1
- package/dist/locale/tk.mjs +1 -1
- package/dist/locale/tr.js +1 -1
- package/dist/locale/tr.min.js +1 -1
- package/dist/locale/tr.min.mjs +1 -1
- package/dist/locale/tr.mjs +1 -1
- package/dist/locale/ug-cn.js +1 -1
- package/dist/locale/ug-cn.min.js +1 -1
- package/dist/locale/ug-cn.min.mjs +1 -1
- package/dist/locale/ug-cn.mjs +1 -1
- package/dist/locale/uk.js +1 -1
- package/dist/locale/uk.min.js +1 -1
- package/dist/locale/uk.min.mjs +1 -1
- package/dist/locale/uk.mjs +1 -1
- package/dist/locale/uz-uz.js +1 -1
- package/dist/locale/uz-uz.min.js +1 -1
- package/dist/locale/uz-uz.min.mjs +1 -1
- package/dist/locale/uz-uz.mjs +1 -1
- package/dist/locale/vi.js +1 -1
- package/dist/locale/vi.min.js +1 -1
- package/dist/locale/vi.min.mjs +1 -1
- package/dist/locale/vi.mjs +1 -1
- package/dist/locale/zh-cn.js +1 -1
- package/dist/locale/zh-cn.min.js +1 -1
- package/dist/locale/zh-cn.min.mjs +1 -1
- package/dist/locale/zh-cn.mjs +1 -1
- package/dist/locale/zh-tw.js +1 -1
- package/dist/locale/zh-tw.min.js +1 -1
- package/dist/locale/zh-tw.min.mjs +1 -1
- package/dist/locale/zh-tw.mjs +1 -1
- package/es/components/date-picker/src/date-picker-com/basic-year-table2.mjs +69 -75
- package/es/components/date-picker/src/date-picker-com/basic-year-table2.mjs.map +1 -1
- package/es/components/date-picker/src/date-picker-com/panel-date-pick2.mjs +56 -64
- package/es/components/date-picker/src/date-picker-com/panel-date-pick2.mjs.map +1 -1
- package/es/components/index.mjs +3 -3
- package/es/components/menu/src/menu-item4.mjs +1 -1
- package/es/components/popper/index.mjs +3 -3
- package/es/components/popper/index2.mjs +4 -4
- package/es/components/popper/src/arrow.mjs +1 -1
- package/es/components/popper/src/arrow3.mjs +37 -7
- package/es/components/popper/src/arrow3.mjs.map +1 -1
- package/es/components/popper/src/arrow4.mjs +7 -37
- package/es/components/popper/src/arrow4.mjs.map +1 -1
- package/es/components/popper/src/popper.mjs +1 -6
- package/es/components/popper/src/popper.mjs.map +1 -1
- package/es/components/popper/src/popper2.mjs +6 -1
- package/es/components/popper/src/popper2.mjs.map +1 -1
- package/es/components/popper/src/popper3.mjs +12 -32
- package/es/components/popper/src/popper3.mjs.map +1 -1
- package/es/components/popper/src/popper4.mjs +32 -12
- package/es/components/popper/src/popper4.mjs.map +1 -1
- package/es/components/table/src/table/defaults2.mjs.map +1 -1
- package/es/components/table/src/table-body/events-helper2.mjs +1 -1
- package/es/components/table/src/table-body/events-helper2.mjs.map +1 -1
- package/es/components/table/src/util2.mjs +17 -7
- package/es/components/table/src/util2.mjs.map +1 -1
- package/es/components/tooltip/src/tooltip4.mjs +3 -3
- package/es/index.mjs +3 -3
- package/es/packages/components/date-picker/src/date-picker-com/basic-year-table.vue.d.ts +26 -1
- package/es/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue.d.ts +64 -32
- package/es/packages/components/date-picker/src/utils.d.ts +40 -8
- package/es/packages/components/table/src/table/defaults.d.ts +1 -0
- package/es/packages/components/table/src/util.d.ts +1 -1
- package/es/packages/utils/dom/event.d.ts +2 -2
- package/es/packages/version.d.ts +1 -1
- package/es/utils/dom/event2.mjs.map +1 -1
- package/es/version2.mjs +1 -1
- package/es/version2.mjs.map +1 -1
- package/lib/components/date-picker/src/date-picker-com/basic-year-table2.js +68 -74
- package/lib/components/date-picker/src/date-picker-com/basic-year-table2.js.map +1 -1
- package/lib/components/date-picker/src/date-picker-com/panel-date-pick2.js +55 -63
- package/lib/components/date-picker/src/date-picker-com/panel-date-pick2.js.map +1 -1
- package/lib/components/index.js +3 -3
- package/lib/components/menu/src/menu-item4.js +1 -1
- package/lib/components/popper/index.js +3 -3
- package/lib/components/popper/index2.js +4 -4
- package/lib/components/popper/src/arrow.js +1 -1
- package/lib/components/popper/src/arrow3.js +37 -7
- package/lib/components/popper/src/arrow3.js.map +1 -1
- package/lib/components/popper/src/arrow4.js +7 -37
- package/lib/components/popper/src/arrow4.js.map +1 -1
- package/lib/components/popper/src/popper.js +4 -4
- package/lib/components/popper/src/popper.js.map +1 -1
- package/lib/components/popper/src/popper2.js +4 -4
- package/lib/components/popper/src/popper2.js.map +1 -1
- package/lib/components/popper/src/popper3.js +13 -32
- package/lib/components/popper/src/popper3.js.map +1 -1
- package/lib/components/popper/src/popper4.js +32 -13
- package/lib/components/popper/src/popper4.js.map +1 -1
- package/lib/components/table/src/table/defaults2.js.map +1 -1
- package/lib/components/table/src/table-body/events-helper2.js +1 -1
- package/lib/components/table/src/table-body/events-helper2.js.map +1 -1
- package/lib/components/table/src/util2.js +17 -7
- package/lib/components/table/src/util2.js.map +1 -1
- package/lib/components/tooltip/src/tooltip4.js +3 -3
- package/lib/index.js +3 -3
- package/lib/packages/components/date-picker/src/date-picker-com/basic-year-table.vue.d.ts +26 -1
- package/lib/packages/components/date-picker/src/date-picker-com/panel-date-pick.vue.d.ts +64 -32
- package/lib/packages/components/date-picker/src/utils.d.ts +40 -8
- package/lib/packages/components/table/src/table/defaults.d.ts +1 -0
- package/lib/packages/components/table/src/util.d.ts +1 -1
- package/lib/packages/utils/dom/event.d.ts +2 -2
- package/lib/packages/version.d.ts +1 -1
- package/lib/utils/dom/event2.js.map +1 -1
- package/lib/version2.js +1 -1
- package/lib/version2.js.map +1 -1
- package/package.json +2 -2
- 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
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
24
|
-
|
|
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
|
|
44
|
-
const
|
|
40
|
+
const getCellKls = (year) => {
|
|
41
|
+
const kls = {};
|
|
45
42
|
const today = dayjs().locale(lang.value);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return
|
|
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
|
-
|
|
58
|
+
emit("pick", Number(year));
|
|
62
59
|
}
|
|
63
60
|
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
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=\"
|
|
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":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, useAttrs, useSlots, inject, toRef, ref, computed,
|
|
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 = ["
|
|
31
|
-
const _hoisted_5 = ["
|
|
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
|
|
102
|
-
|
|
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
|
|
106
|
-
|
|
107
|
-
|
|
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
|
|
201
|
-
currentView.value =
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 (
|
|
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
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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:
|
|
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:
|
|
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(
|
|
532
|
-
onClick:
|
|
533
|
-
}, toDisplayString(unref(yearLabel)),
|
|
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(
|
|
543
|
-
onClick:
|
|
544
|
-
}, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)),
|
|
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:
|
|
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,
|
|
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:
|
|
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,
|
|
569
|
+
], 10, _hoisted_5)
|
|
578
570
|
], 2)
|
|
579
571
|
], 2), [
|
|
580
572
|
[vShow, currentView.value !== "time"]
|