vft 0.0.506 → 0.0.509

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 (161) hide show
  1. package/dist/index.css +1 -1
  2. package/es/components/cascader/cascader.vue2.js +203 -202
  3. package/es/components/cascader-panel/menu.vue2.js +50 -49
  4. package/es/components/clamp-toggle/clamp-toggle.vue2.js +21 -17
  5. package/es/components/color-picker/color-picker.vue2.js +134 -133
  6. package/es/components/config-provider/config-provider.vue.d.ts +2 -0
  7. package/es/components/config-provider/config-provider.vue2.js +5 -4
  8. package/es/components/config-provider/constants.d.ts +1 -0
  9. package/es/components/config-provider/constants.js +3 -2
  10. package/es/components/config-provider/hooks/use-global-config.js +33 -30
  11. package/es/components/config-provider/index.d.ts +9 -0
  12. package/es/components/config-provider/index.js +6 -5
  13. package/es/components/date-picker/composables/use-basic-date-table.d.ts +1 -1
  14. package/es/components/date-picker/composables/use-basic-date-table.js +124 -123
  15. package/es/components/date-picker/composables/use-month-range-header.js +15 -14
  16. package/es/components/date-picker/composables/use-panel-date-range.js +24 -23
  17. package/es/components/date-picker/date-picker-com/basic-month-table.vue2.js +39 -38
  18. package/es/components/date-picker/date-picker-com/basic-year-table.vue2.js +39 -38
  19. package/es/components/date-picker/date-picker-com/panel-date-pick.vue2.js +179 -178
  20. package/es/components/date-picker/date-picker-com/panel-date-range.vue2.js +225 -224
  21. package/es/components/date-time-select/date-time-select.vue2.js +39 -36
  22. package/es/components/dropdown/dropdown.vue2.js +68 -67
  23. package/es/components/empty/empty.vue2.js +39 -38
  24. package/es/components/full-screen/full-screen.vue2.js +18 -17
  25. package/es/components/image/image.vue2.js +60 -59
  26. package/es/components/image-viewer/image-viewer.vue2.js +45 -44
  27. package/es/components/index.js +161 -160
  28. package/es/components/input/index.d.ts +5 -0
  29. package/es/components/input/input.vue.d.ts +2 -0
  30. package/es/components/input/input.vue2.js +42 -41
  31. package/es/components/md-container/md-container.vue2.js +75 -74
  32. package/es/components/md-container/toc.js +37 -36
  33. package/es/components/modal/modal-footer-action.vue2.js +25 -24
  34. package/es/components/multiple-tabs/multiple-tabs.vue2.js +16 -15
  35. package/es/components/multiple-tabs/use/use-tab-dropdown.js +54 -53
  36. package/es/components/pagination/components/jumper.vue2.js +29 -28
  37. package/es/components/pagination/components/sizes.vue2.js +21 -20
  38. package/es/components/pagination/components/total.vue2.js +11 -10
  39. package/es/components/popconfirm/popconfirm.vue2.js +40 -39
  40. package/es/components/search/search.vue2.js +79 -77
  41. package/es/components/select/useSelect.js +232 -231
  42. package/es/components/super-form/super-form-action.vue2.js +41 -40
  43. package/es/components/super-form/super-form-item.vue2.js +206 -203
  44. package/es/components/super-form/use/helper.d.ts +1 -1
  45. package/es/components/super-form/use/helper.js +62 -62
  46. package/es/components/table/field.js +130 -110
  47. package/es/components/table/table.vue2.js +152 -150
  48. package/es/components/table/use/use-columns.js +29 -26
  49. package/es/components/table/use/use-data-source.js +87 -86
  50. package/es/components/time-picker/time-picker-com/panel-time-pick.vue2.js +66 -65
  51. package/es/components/time-picker/time-picker-com/panel-time-range.vue2.js +134 -133
  52. package/es/components/transfer/transfer-panel.vue2.js +57 -56
  53. package/es/components/transfer/transfer.vue2.js +70 -69
  54. package/es/components/tree/tree.vue2.js +60 -59
  55. package/es/components/upload/index.d.ts +3 -3
  56. package/es/components/upload/upload-content.vue.d.ts +2 -2
  57. package/es/components/upload/upload-content.vue2.js +78 -75
  58. package/es/components/upload/upload-list.vue2.js +46 -45
  59. package/es/components/upload/upload.vue.d.ts +2 -2
  60. package/es/components/upload/upload.vue2.js +87 -85
  61. package/es/components/upload/utils.js +29 -29
  62. package/es/constants/date.d.ts +1 -1
  63. package/es/constants/date.js +9 -1
  64. package/es/hooks/use-z-index/index.js +3 -3
  65. package/es/index.d.ts +1 -0
  66. package/es/index.js +5 -1
  67. package/es/locale/index.d.js +1 -0
  68. package/es/locale/index.d.ts +26 -0
  69. package/es/locale/index.js +10 -0
  70. package/es/locale/lang/en.d.ts +183 -0
  71. package/es/locale/lang/en.js +241 -0
  72. package/es/locale/lang/zh-cn.d.ts +183 -0
  73. package/es/locale/lang/zh-cn.js +241 -0
  74. package/es/locale/lang/zh-tw.d.ts +183 -0
  75. package/es/locale/lang/zh-tw.js +241 -0
  76. package/es/locale/use-locale.d.ts +17 -0
  77. package/es/locale/use-locale.js +56 -0
  78. package/es/package.json.d.ts +1 -1
  79. package/es/package.json.js +1 -1
  80. package/lib/components/cascader/cascader.vue2.cjs +1 -1
  81. package/lib/components/cascader-panel/menu.vue2.cjs +4 -4
  82. package/lib/components/clamp-toggle/clamp-toggle.vue2.cjs +1 -1
  83. package/lib/components/color-picker/color-picker.vue2.cjs +1 -1
  84. package/lib/components/config-provider/config-provider.vue.d.ts +2 -0
  85. package/lib/components/config-provider/config-provider.vue2.cjs +1 -1
  86. package/lib/components/config-provider/constants.cjs +1 -1
  87. package/lib/components/config-provider/constants.d.ts +1 -0
  88. package/lib/components/config-provider/hooks/use-global-config.cjs +1 -1
  89. package/lib/components/config-provider/index.cjs +1 -1
  90. package/lib/components/config-provider/index.d.ts +9 -0
  91. package/lib/components/date-picker/composables/use-basic-date-table.cjs +1 -1
  92. package/lib/components/date-picker/composables/use-basic-date-table.d.ts +1 -1
  93. package/lib/components/date-picker/composables/use-month-range-header.cjs +1 -1
  94. package/lib/components/date-picker/composables/use-panel-date-range.cjs +1 -1
  95. package/lib/components/date-picker/date-picker-com/basic-month-table.vue2.cjs +1 -1
  96. package/lib/components/date-picker/date-picker-com/basic-year-table.vue2.cjs +1 -1
  97. package/lib/components/date-picker/date-picker-com/panel-date-pick.vue2.cjs +1 -1
  98. package/lib/components/date-picker/date-picker-com/panel-date-range.vue2.cjs +1 -1
  99. package/lib/components/date-time-select/date-time-select.vue2.cjs +1 -1
  100. package/lib/components/dropdown/dropdown.vue2.cjs +1 -1
  101. package/lib/components/empty/empty.vue2.cjs +1 -1
  102. package/lib/components/full-screen/full-screen.vue2.cjs +1 -1
  103. package/lib/components/image/image.vue2.cjs +1 -1
  104. package/lib/components/image-viewer/image-viewer.vue2.cjs +1 -1
  105. package/lib/components/index.cjs +1 -1
  106. package/lib/components/input/index.d.ts +5 -0
  107. package/lib/components/input/input.vue.d.ts +2 -0
  108. package/lib/components/input/input.vue2.cjs +1 -1
  109. package/lib/components/md-container/md-container.vue2.cjs +1 -1
  110. package/lib/components/md-container/toc.cjs +1 -1
  111. package/lib/components/modal/modal-footer-action.vue2.cjs +1 -1
  112. package/lib/components/multiple-tabs/multiple-tabs.vue2.cjs +1 -1
  113. package/lib/components/multiple-tabs/use/use-tab-dropdown.cjs +1 -1
  114. package/lib/components/pagination/components/jumper.vue2.cjs +1 -1
  115. package/lib/components/pagination/components/sizes.vue2.cjs +1 -1
  116. package/lib/components/pagination/components/total.vue2.cjs +1 -1
  117. package/lib/components/popconfirm/popconfirm.vue2.cjs +1 -1
  118. package/lib/components/search/search.vue2.cjs +1 -1
  119. package/lib/components/select/useSelect.cjs +1 -1
  120. package/lib/components/super-form/super-form-action.vue2.cjs +1 -1
  121. package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
  122. package/lib/components/super-form/use/helper.cjs +1 -1
  123. package/lib/components/super-form/use/helper.d.ts +1 -1
  124. package/lib/components/table/field.cjs +1 -1
  125. package/lib/components/table/table.vue2.cjs +1 -1
  126. package/lib/components/table/use/use-columns.cjs +1 -1
  127. package/lib/components/table/use/use-data-source.cjs +1 -1
  128. package/lib/components/time-picker/time-picker-com/panel-time-pick.vue2.cjs +1 -1
  129. package/lib/components/time-picker/time-picker-com/panel-time-range.vue2.cjs +1 -1
  130. package/lib/components/transfer/transfer-panel.vue2.cjs +1 -1
  131. package/lib/components/transfer/transfer.vue2.cjs +1 -1
  132. package/lib/components/tree/tree.vue2.cjs +1 -1
  133. package/lib/components/upload/index.d.ts +3 -3
  134. package/lib/components/upload/upload-content.vue.d.ts +2 -2
  135. package/lib/components/upload/upload-content.vue2.cjs +1 -1
  136. package/lib/components/upload/upload-list.vue2.cjs +1 -1
  137. package/lib/components/upload/upload.vue.d.ts +2 -2
  138. package/lib/components/upload/upload.vue2.cjs +1 -1
  139. package/lib/components/upload/utils.cjs +1 -1
  140. package/lib/constants/date.cjs +1 -1
  141. package/lib/constants/date.d.ts +1 -1
  142. package/lib/index.cjs +1 -1
  143. package/lib/index.d.ts +1 -0
  144. package/lib/locale/index.cjs +1 -0
  145. package/lib/locale/index.d.cjs +1 -0
  146. package/lib/locale/index.d.ts +26 -0
  147. package/lib/locale/lang/en.cjs +1 -0
  148. package/lib/locale/lang/en.d.ts +183 -0
  149. package/lib/locale/lang/zh-cn.cjs +1 -0
  150. package/lib/locale/lang/zh-cn.d.ts +183 -0
  151. package/lib/locale/lang/zh-tw.cjs +1 -0
  152. package/lib/locale/lang/zh-tw.d.ts +183 -0
  153. package/lib/locale/use-locale.cjs +1 -0
  154. package/lib/locale/use-locale.d.ts +17 -0
  155. package/lib/package.json.cjs +1 -1
  156. package/lib/package.json.d.ts +1 -1
  157. package/package.json +2 -2
  158. package/theme-style/index.css +1 -1
  159. package/theme-style/src/super-form.scss +0 -1
  160. package/theme-style/vft-super-form.css +1 -1
  161. package/web-types.json +1 -1
@@ -1,46 +1,47 @@
1
- import { ref as i, inject as O, computed as o, nextTick as Y } from "vue";
1
+ import { ref as i, inject as _, computed as o, nextTick as Y } from "vue";
2
2
  import "../../time-picker/index.js";
3
- import { getValidDateOfYear as _, getValidDateOfMonth as j } from "../utils.js";
4
- import { PICKER_BASE_INJECTION_KEY as x } from "../../time-picker/constants.js";
5
- const D = (R, $, c, u) => {
6
- const l = i("date"), h = i(), s = i("date"), v = i(), p = O(x), { disabledDate: d } = p.props, m = i("zh-cn"), w = o(() => c.value.year()), C = o(() => c.value.month()), P = o(() => u.value.year()), L = o(() => u.value.month());
7
- function g(e, a) {
8
- const n = "年";
3
+ import { useLocale as j } from "../../../locale/use-locale.js";
4
+ import { getValidDateOfYear as x, getValidDateOfMonth as K } from "../utils.js";
5
+ import { PICKER_BASE_INJECTION_KEY as N } from "../../time-picker/constants.js";
6
+ const T = (R, p, c, u) => {
7
+ const { t: L } = j(), l = i("date"), h = i(), s = i("date"), v = i(), $ = _(N), { disabledDate: d } = $.props, m = i("zh-cn"), P = o(() => c.value.year()), C = o(() => c.value.month()), w = o(() => u.value.year()), b = o(() => u.value.month());
8
+ function y(e, a) {
9
+ const n = L("vft.datePicker.year");
9
10
  if (e.value === "year") {
10
11
  const t = Math.floor(a.value / 10) * 10;
11
12
  return n ? `${t} ${n} - ${t + 9} ${n}` : `${t} - ${t + 9}`;
12
13
  }
13
14
  return `${a.value} ${n}`;
14
15
  }
15
- function y(e) {
16
+ function g(e) {
16
17
  e?.focus();
17
18
  }
18
19
  async function k(e, a) {
19
20
  const n = e === "left" ? l : s, t = e === "left" ? h : v;
20
- n.value = a, await Y(), y(t.value);
21
+ n.value = a, await Y(), g(t.value);
21
22
  }
22
23
  async function f(e, a, n) {
23
- const t = a === "left", r = t ? c : u, M = t ? u : c, E = t ? l : s, B = t ? h : v;
24
+ const t = a === "left", r = t ? c : u, E = t ? u : c, B = t ? l : s, I = t ? h : v;
24
25
  if (e === "year") {
25
- const I = r.value.year(n);
26
- r.value = _(I, m.value, d);
26
+ const O = r.value.year(n);
27
+ r.value = x(O, m.value, d);
27
28
  }
28
- e === "month" && (r.value = j(
29
+ e === "month" && (r.value = K(
29
30
  r.value,
30
31
  r.value.year(),
31
32
  n,
32
33
  m.value,
33
34
  d
34
- )), R.unlinkPanels || (M.value = a === "left" ? r.value.add(1, "month") : r.value.subtract(1, "month")), E.value = e === "year" ? "month" : "date", await Y(), y(B.value), V(e);
35
+ )), R.unlinkPanels || (E.value = a === "left" ? r.value.add(1, "month") : r.value.subtract(1, "month")), B.value = e === "year" ? "month" : "date", await Y(), g(I.value), V(e);
35
36
  }
36
37
  function V(e) {
37
- $(
38
+ p(
38
39
  "panel-change",
39
40
  [c.value.toDate(), u.value.toDate()],
40
41
  e
41
42
  );
42
43
  }
43
- function b(e, a, n) {
44
+ function M(e, a, n) {
44
45
  const t = n ? "add" : "subtract";
45
46
  return e === "year" ? a[t](10, "year") : a[t](1, "year");
46
47
  }
@@ -49,13 +50,13 @@ const D = (R, $, c, u) => {
49
50
  rightCurrentView: s,
50
51
  leftCurrentViewRef: h,
51
52
  rightCurrentViewRef: v,
52
- leftYear: w,
53
- rightYear: P,
53
+ leftYear: P,
54
+ rightYear: w,
54
55
  leftMonth: C,
55
- rightMonth: L,
56
- leftYearLabel: o(() => g(l, w)),
56
+ rightMonth: b,
57
+ leftYearLabel: o(() => y(l, P)),
57
58
  rightYearLabel: o(
58
- () => g(s, P)
59
+ () => y(s, w)
59
60
  ),
60
61
  showLeftPicker: (e) => k("left", e),
61
62
  showRightPicker: (e) => k("right", e),
@@ -64,9 +65,9 @@ const D = (R, $, c, u) => {
64
65
  handleLeftMonthPick: (e) => f("month", "left", e),
65
66
  handleRightMonthPick: (e) => f("month", "right", e),
66
67
  handlePanelChange: V,
67
- adjustDateByView: b
68
+ adjustDateByView: M
68
69
  };
69
70
  };
70
71
  export {
71
- D as usePanelDateRange
72
+ T as usePanelDateRange
72
73
  };
@@ -1,30 +1,31 @@
1
- import { defineComponent as P, ref as d, computed as F, watch as L, nextTick as Y, createElementBlock as f, openBlock as u, normalizeClass as k, unref as N, createElementVNode as $, Fragment as M, renderList as C, withKeys as O, withModifiers as _, createVNode as q } from "vue";
2
- import b from "dayjs";
1
+ import { defineComponent as K, ref as d, computed as F, watch as Y, nextTick as $, createElementBlock as f, openBlock as u, normalizeClass as N, unref as b, createElementVNode as q, Fragment as M, renderList as _, withKeys as C, withModifiers as O, createVNode as G } from "vue";
2
+ import w from "dayjs";
3
3
  import "@vueuse/core";
4
4
  import { hasClass as T } from "@vft/utils";
5
5
  import { castArray as p } from "../../../utils/helper.js";
6
6
  import "lodash-es";
7
7
  import "../../form/index.js";
8
- import { useNamespace as G } from "../../../hooks/use-namespace/index.js";
8
+ import { useNamespace as H } from "../../../hooks/use-namespace/index.js";
9
9
  import "../../../hooks/use-model-toggle/index.js";
10
10
  import "@popperjs/core";
11
11
  import "../../../hooks/use-z-index/index.js";
12
- import { basicMonthTableProps as H } from "../props/basic-month-table.js";
13
- import { datesInMonth as J, getValidDateOfMonth as Q } from "../utils.js";
14
- import U from "./basic-cell-render.js";
15
- const W = ["aria-selected", "tabindex", "onKeydown"], ue = /* @__PURE__ */ P({
12
+ import { useLocale as J } from "../../../locale/use-locale.js";
13
+ import { basicMonthTableProps as Q } from "../props/basic-month-table.js";
14
+ import { datesInMonth as U, getValidDateOfMonth as W } from "../utils.js";
15
+ import X from "./basic-cell-render.js";
16
+ const Z = ["aria-label"], ee = ["aria-selected", "tabindex", "onKeydown"], ye = /* @__PURE__ */ K({
16
17
  __name: "basic-month-table",
17
- props: H,
18
+ props: Q,
18
19
  emits: ["changerange", "pick", "select"],
19
20
  setup(V, { expose: I, emit: R }) {
20
- const e = V, c = R, E = G("month-table"), h = d("zh-cn"), w = d(), D = d(), A = d(
21
+ const e = V, c = R, A = H("month-table"), { t: E } = J(), h = d("zh-cn"), x = d(), D = d(), B = d(
21
22
  e.date.locale("zh-cn").localeData().monthsShort().map((r) => r.toLowerCase())
22
- ), B = d([
23
+ ), L = d([
23
24
  [],
24
25
  [],
25
26
  []
26
- ]), x = d(), v = d(), S = F(() => {
27
- const r = B.value, t = b().locale(h.value).startOf("month");
27
+ ]), v = d(), S = d(), k = F(() => {
28
+ const r = L.value, t = w().locale(h.value).startOf("month");
28
29
  for (let a = 0; a < 3; a++) {
29
30
  const s = r[a];
30
31
  for (let n = 0; n < 4; n++) {
@@ -44,26 +45,26 @@ const W = ["aria-selected", "tabindex", "onKeydown"], ue = /* @__PURE__ */ P({
44
45
  }
45
46
  }
46
47
  return r;
47
- }), j = () => {
48
+ }), P = () => {
48
49
  D.value?.focus();
49
- }, z = (r) => {
50
+ }, j = (r) => {
50
51
  const t = {}, a = e.date.year(), s = /* @__PURE__ */ new Date(), n = r.text;
51
- return t.disabled = e.disabledDate ? J(e.date, a, n, h.value).every(
52
+ return t.disabled = e.disabledDate ? U(e.date, a, n, h.value).every(
52
53
  e.disabledDate
53
54
  ) : !1, t.current = p(e.parsedValue).findIndex(
54
- (o) => b.isDayjs(o) && o.year() === a && o.month() === n
55
+ (o) => w.isDayjs(o) && o.year() === a && o.month() === n
55
56
  ) >= 0, t.today = s.getFullYear() === a && s.getMonth() === n, r.inRange && (t["in-range"] = !0, r.start && (t["start-date"] = !0), r.end && (t["end-date"] = !0)), t;
56
57
  }, y = (r) => {
57
58
  const t = e.date.year(), a = r.text;
58
59
  return p(e.date).findIndex(
59
60
  (s) => s.year() === t && s.month() === a
60
61
  ) >= 0;
61
- }, K = (r) => {
62
+ }, z = (r) => {
62
63
  if (!e.rangeState.selecting) return;
63
64
  let t = r.target;
64
65
  if (t.tagName === "SPAN" && (t = t.parentNode?.parentNode), t.tagName === "DIV" && (t = t.parentNode), t.tagName !== "TD") return;
65
66
  const a = t.parentNode.rowIndex, s = t.cellIndex;
66
- S.value[a][s].disabled || (a !== x.value || s !== v.value) && (x.value = a, v.value = s, c("changerange", {
67
+ k.value[a][s].disabled || (a !== v.value || s !== S.value) && (v.value = a, S.value = s, c("changerange", {
67
68
  selecting: !0,
68
69
  endDate: e.date.startOf("year").month(a * 4 + s)
69
70
  }));
@@ -78,7 +79,7 @@ const W = ["aria-selected", "tabindex", "onKeydown"], ue = /* @__PURE__ */ P({
78
79
  c("pick", p(e.parsedValue), !1);
79
80
  return;
80
81
  }
81
- const m = Q(
82
+ const m = W(
82
83
  e.date,
83
84
  e.date.year(),
84
85
  n,
@@ -90,56 +91,56 @@ const W = ["aria-selected", "tabindex", "onKeydown"], ue = /* @__PURE__ */ P({
90
91
  // This allows remove same months from different years #20019
91
92
  l?.year() !== m.year() || l?.month() !== m.month()
92
93
  )
93
- ) : p(e.parsedValue).concat([b(m)]);
94
+ ) : p(e.parsedValue).concat([w(m)]);
94
95
  c("pick", i);
95
96
  } else e.selectionMode === "range" ? e.rangeState.selecting ? (e.minDate && o >= e.minDate ? c("pick", { minDate: e.minDate, maxDate: o }) : c("pick", { minDate: o, maxDate: e.minDate }), c("select", !1)) : (c("pick", { minDate: o, maxDate: null }), c("select", !0)) : c("pick", n);
96
97
  };
97
- return L(
98
+ return Y(
98
99
  () => e.date,
99
100
  async () => {
100
- w.value?.contains(document.activeElement) && (await Y(), D.value?.focus());
101
+ x.value?.contains(document.activeElement) && (await $(), D.value?.focus());
101
102
  }
102
103
  ), I({
103
104
  /**
104
105
  * @description focus current cell
105
106
  */
106
- focus: j
107
+ focus: P
107
108
  }), (r, t) => (u(), f("table", {
108
109
  role: "grid",
109
- "aria-label": "使用方向键与 Enter 键可选择月份",
110
- class: k(N(E).b()),
110
+ "aria-label": b(E)("vft.datePicker.monthTableLabel"),
111
+ class: N(b(A).b()),
111
112
  onClick: g,
112
- onMousemove: K
113
+ onMousemove: z
113
114
  }, [
114
- $("tbody", {
115
+ q("tbody", {
115
116
  ref_key: "tbodyRef",
116
- ref: w
117
+ ref: x
117
118
  }, [
118
- (u(!0), f(M, null, C(S.value, (a, s) => (u(), f("tr", { key: s }, [
119
- (u(!0), f(M, null, C(a, (n, o) => (u(), f("td", {
119
+ (u(!0), f(M, null, _(k.value, (a, s) => (u(), f("tr", { key: s }, [
120
+ (u(!0), f(M, null, _(a, (n, o) => (u(), f("td", {
120
121
  key: o,
121
122
  ref_for: !0,
122
123
  ref: (m) => y(n) && (D.value = m),
123
- class: k(z(n)),
124
+ class: N(j(n)),
124
125
  "aria-selected": `${y(n)}`,
125
126
  tabindex: y(n) ? 0 : -1,
126
127
  onKeydown: [
127
- O(_(g, ["prevent", "stop"]), ["space"]),
128
- O(_(g, ["prevent", "stop"]), ["enter"])
128
+ C(O(g, ["prevent", "stop"]), ["space"]),
129
+ C(O(g, ["prevent", "stop"]), ["enter"])
129
130
  ]
130
131
  }, [
131
- q(N(U), {
132
+ G(b(X), {
132
133
  cell: {
133
134
  ...n,
134
- renderText: A.value[n.text]
135
+ renderText: B.value[n.text]
135
136
  }
136
137
  }, null, 8, ["cell"])
137
- ], 42, W))), 128))
138
+ ], 42, ee))), 128))
138
139
  ]))), 128))
139
140
  ], 512)
140
- ], 34));
141
+ ], 42, Z));
141
142
  }
142
143
  });
143
144
  export {
144
- ue as default
145
+ ye as default
145
146
  };
@@ -1,29 +1,30 @@
1
- import { defineComponent as F, ref as m, computed as O, watch as L, nextTick as q, createElementBlock as u, openBlock as y, normalizeClass as C, unref as _, createElementVNode as G, Fragment as R, renderList as V, withKeys as Y, withModifiers as I, createVNode as H } from "vue";
1
+ import { defineComponent as F, ref as m, computed as O, watch as q, nextTick as G, createElementBlock as u, openBlock as y, normalizeClass as C, unref as k, createElementVNode as H, Fragment as R, renderList as V, withKeys as Y, withModifiers as I, createVNode as J } from "vue";
2
2
  import f from "dayjs";
3
3
  import "@vueuse/core";
4
4
  import { hasClass as M } from "@vft/utils";
5
5
  import { castArray as p } from "../../../utils/helper.js";
6
6
  import "lodash-es";
7
7
  import "../../form/index.js";
8
- import { useNamespace as J } from "../../../hooks/use-namespace/index.js";
8
+ import { useNamespace as Q } from "../../../hooks/use-namespace/index.js";
9
9
  import "../../../hooks/use-model-toggle/index.js";
10
10
  import "@popperjs/core";
11
11
  import "../../../hooks/use-z-index/index.js";
12
+ import { useLocale as U } from "../../../locale/use-locale.js";
12
13
  import "../../time-picker/index.js";
13
- import { basicYearTableProps as Q } from "../props/basic-year-table.js";
14
- import { getValidDateOfYear as U } from "../utils.js";
15
- import W from "./basic-cell-render.js";
16
- import { rangeArr as X } from "../../time-picker/utils.js";
17
- const Z = ["aria-selected", "aria-label", "tabindex", "onKeydown"], be = /* @__PURE__ */ F({
14
+ import { basicYearTableProps as W } from "../props/basic-year-table.js";
15
+ import { getValidDateOfYear as X } from "../utils.js";
16
+ import Z from "./basic-cell-render.js";
17
+ import { rangeArr as ee } from "../../time-picker/utils.js";
18
+ const te = ["aria-label"], ae = ["aria-selected", "aria-label", "tabindex", "onKeydown"], ke = /* @__PURE__ */ F({
18
19
  __name: "basic-year-table",
19
- props: Q,
20
+ props: W,
20
21
  emits: ["changerange", "pick", "select"],
21
- setup(E, { expose: T, emit: A }) {
22
- const e = E, c = A, N = (s, t) => {
22
+ setup(T, { expose: A, emit: E }) {
23
+ const e = T, c = E, { t: N } = U(), B = (s, t) => {
23
24
  const a = f(String(s)).locale(t).startOf("year"), r = a.endOf("year").dayOfYear();
24
- return X(r).map((n) => a.add(n, "day").toDate());
25
- }, B = J("year-table"), D = m("zh-cn"), w = m(), b = m(), g = O(() => Math.floor(e.date.year() / 10) * 10), K = m([[], [], []]), k = m(), S = m(), h = O(() => {
26
- const s = K.value, t = f().locale(D.value).startOf("year");
25
+ return ee(r).map((n) => a.add(n, "day").toDate());
26
+ }, K = Q("year-table"), D = m("zh-cn"), w = m(), b = m(), g = O(() => Math.floor(e.date.year() / 10) * 10), L = m([[], [], []]), S = m(), h = m(), _ = O(() => {
27
+ const s = L.value, t = f().locale(D.value).startOf("year");
27
28
  for (let a = 0; a < 3; a++) {
28
29
  const o = s[a];
29
30
  for (let r = 0; r < 4 && !(a * 4 + r >= 10); r++) {
@@ -38,18 +39,18 @@ const Z = ["aria-selected", "aria-label", "tabindex", "onKeydown"], be = /* @__P
38
39
  text: -1,
39
40
  disabled: !1
40
41
  }), n.type = "normal";
41
- const d = a * 4 + r + g.value, i = f().year(d), l = e.rangeState.endDate || e.maxDate || e.rangeState.selecting && e.minDate || null;
42
- n.inRange = !!(e.minDate && i.isSameOrAfter(e.minDate, "year") && l && i.isSameOrBefore(l, "year")) || !!(e.minDate && i.isSameOrBefore(e.minDate, "year") && l && i.isSameOrAfter(l, "year")), e.minDate?.isSameOrAfter(l) ? (n.start = !!(l && i.isSame(l, "year")), n.end = !!(e.minDate && i.isSame(e.minDate, "year"))) : (n.start = !!(e.minDate && i.isSame(e.minDate, "year")), n.end = !!(l && i.isSame(l, "year"))), t.isSame(i) && (n.type = "today"), n.text = d;
43
- const $ = i.toDate();
42
+ const d = a * 4 + r + g.value, l = f().year(d), i = e.rangeState.endDate || e.maxDate || e.rangeState.selecting && e.minDate || null;
43
+ n.inRange = !!(e.minDate && l.isSameOrAfter(e.minDate, "year") && i && l.isSameOrBefore(i, "year")) || !!(e.minDate && l.isSameOrBefore(e.minDate, "year") && i && l.isSameOrAfter(i, "year")), e.minDate?.isSameOrAfter(i) ? (n.start = !!(i && l.isSame(i, "year")), n.end = !!(e.minDate && l.isSame(e.minDate, "year"))) : (n.start = !!(e.minDate && l.isSame(e.minDate, "year")), n.end = !!(i && l.isSame(i, "year"))), t.isSame(l) && (n.type = "today"), n.text = d;
44
+ const $ = l.toDate();
44
45
  n.disabled = e.disabledDate && e.disabledDate($) || !1, o[r] = n;
45
46
  }
46
47
  }
47
48
  return s;
48
- }), j = () => {
49
+ }), P = () => {
49
50
  b.value?.focus();
50
- }, z = (s) => {
51
+ }, j = (s) => {
51
52
  const t = {}, a = f().locale(D.value), o = s.text;
52
- return t.disabled = e.disabledDate ? N(o, D.value).every(e.disabledDate) : !1, t.today = a.year() === o, t.current = p(e.parsedValue).findIndex((r) => r.year() === o) >= 0, s.inRange && (t["in-range"] = !0, s.start && (t["start-date"] = !0), s.end && (t["end-date"] = !0)), t;
53
+ return t.disabled = e.disabledDate ? B(o, D.value).every(e.disabledDate) : !1, t.today = a.year() === o, t.current = p(e.parsedValue).findIndex((r) => r.year() === o) >= 0, s.inRange && (t["in-range"] = !0, s.start && (t["start-date"] = !0), s.end && (t["end-date"] = !0)), t;
53
54
  }, v = (s) => {
54
55
  const t = s.text;
55
56
  return p(e.date).findIndex((a) => a.year() === t) >= 0;
@@ -66,53 +67,53 @@ const Z = ["aria-selected", "aria-label", "tabindex", "onKeydown"], be = /* @__P
66
67
  c("pick", p(e.parsedValue), !1);
67
68
  return;
68
69
  }
69
- const d = U(
70
+ const d = X(
70
71
  n.startOf("year"),
71
72
  D.value,
72
73
  e.disabledDate
73
- ), i = M(t, "current") ? p(e.parsedValue).filter((l) => l?.year() !== r) : p(e.parsedValue).concat([d]);
74
- c("pick", i);
74
+ ), l = M(t, "current") ? p(e.parsedValue).filter((i) => i?.year() !== r) : p(e.parsedValue).concat([d]);
75
+ c("pick", l);
75
76
  } else
76
77
  c("pick", r);
77
- }, P = (s) => {
78
+ }, z = (s) => {
78
79
  if (!e.rangeState.selecting) return;
79
80
  const t = s.target?.closest(
80
81
  "td"
81
82
  );
82
83
  if (!t) return;
83
84
  const a = t.parentNode.rowIndex, o = t.cellIndex;
84
- h.value[a][o].disabled || (a !== k.value || o !== S.value) && (k.value = a, S.value = o, c("changerange", {
85
+ _.value[a][o].disabled || (a !== S.value || o !== h.value) && (S.value = a, h.value = o, c("changerange", {
85
86
  selecting: !0,
86
87
  endDate: f().year(g.value).add(a * 4 + o, "year")
87
88
  }));
88
89
  };
89
- return L(
90
+ return q(
90
91
  () => e.date,
91
92
  async () => {
92
- w.value?.contains(document.activeElement) && (await q(), b.value?.focus());
93
+ w.value?.contains(document.activeElement) && (await G(), b.value?.focus());
93
94
  }
94
- ), T({
95
+ ), A({
95
96
  /**
96
97
  * @description focus on the current cell
97
98
  */
98
- focus: j
99
+ focus: P
99
100
  }), (s, t) => (y(), u("table", {
100
101
  role: "grid",
101
- "aria-label": "使用方向键与 Enter 键以选择年份",
102
- class: C(_(B).b()),
102
+ "aria-label": k(N)("vft.datePicker.yearTableLabel"),
103
+ class: C(k(K).b()),
103
104
  onClick: x,
104
- onMousemove: P
105
+ onMousemove: z
105
106
  }, [
106
- G("tbody", {
107
+ H("tbody", {
107
108
  ref_key: "tbodyRef",
108
109
  ref: w
109
110
  }, [
110
- (y(!0), u(R, null, V(h.value, (a, o) => (y(), u("tr", { key: o }, [
111
+ (y(!0), u(R, null, V(_.value, (a, o) => (y(), u("tr", { key: o }, [
111
112
  (y(!0), u(R, null, V(a, (r, n) => (y(), u("td", {
112
113
  key: `${o}_${n}`,
113
114
  ref_for: !0,
114
115
  ref: (d) => v(r) && (b.value = d),
115
- class: C(["available", z(r)]),
116
+ class: C(["available", j(r)]),
116
117
  "aria-selected": v(r),
117
118
  "aria-label": String(r.text),
118
119
  tabindex: v(r) ? 0 : -1,
@@ -121,13 +122,13 @@ const Z = ["aria-selected", "aria-label", "tabindex", "onKeydown"], be = /* @__P
121
122
  Y(I(x, ["prevent", "stop"]), ["enter"])
122
123
  ]
123
124
  }, [
124
- H(_(W), { cell: r }, null, 8, ["cell"])
125
- ], 42, Z))), 128))
125
+ J(k(Z), { cell: r }, null, 8, ["cell"])
126
+ ], 42, ae))), 128))
126
127
  ]))), 128))
127
128
  ], 512)
128
- ], 34));
129
+ ], 42, te));
129
130
  }
130
131
  });
131
132
  export {
132
- be as default
133
+ ke as default
133
134
  };