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,4 +1,4 @@
1
- import { defineComponent as s, watch as m, computed as l, onActivated as u, onDeactivated as h, onBeforeUnmount as g, getCurrentInstance as p, createElementBlock as v, openBlock as b, normalizeStyle as k, normalizeClass as C, unref as V, renderSlot as y } from "vue";
1
+ import { defineComponent as s, watch as m, computed as d, onActivated as u, onDeactivated as h, onBeforeUnmount as g, getCurrentInstance as p, createElementBlock as v, openBlock as b, normalizeStyle as k, normalizeClass as C, unref as V, renderSlot as y } from "vue";
2
2
  import { inBrowser as S, kebabCase as B } from "@vft/utils";
3
3
  import "@vueuse/core";
4
4
  import { provideGlobalConfig as E } from "./hooks/use-global-config.js";
@@ -22,6 +22,7 @@ const z = s({
22
22
  iconifyPrefixClass: { default: "ico-" },
23
23
  namespace: { default: "vft" },
24
24
  zIndex: {},
25
+ locale: {},
25
26
  message: {},
26
27
  dialog: {},
27
28
  projectCfg: {},
@@ -40,7 +41,7 @@ const z = s({
40
41
  },
41
42
  { immediate: !0, deep: !0 }
42
43
  );
43
- const c = l(() => {
44
+ const c = d(() => {
44
45
  const e = t.theme === "dark";
45
46
  return f({
46
47
  ...t.themeVars,
@@ -67,8 +68,8 @@ const z = s({
67
68
  a[`--${t.namespace}-${B(o)}`] = e[o];
68
69
  }), a;
69
70
  }
70
- const d = p();
71
- return E(d.props), (e, a) => (b(), v("div", {
71
+ const l = p();
72
+ return E(l.props), (e, a) => (b(), v("div", {
72
73
  class: C([V(i).b(), { "vft-dark": t.theme === "dark" }]),
73
74
  style: k(c.value)
74
75
  }, [
@@ -3,4 +3,5 @@ import type { InjectionKey, Ref } from 'vue';
3
3
  import type { ConfigProviderProps } from './config-provider.vue';
4
4
  export type ConfigProviderContext = Partial<ConfigProviderProps>;
5
5
  export declare const configProviderContextKey: InjectionKey<Ref<ConfigProviderContext>>;
6
+ export declare const localeContextKey: InjectionKey<Ref<any>>;
6
7
  export declare const messageConfig: MessageConfigContext;
@@ -1,5 +1,6 @@
1
- const o = Symbol(), e = {};
1
+ const o = Symbol(), e = Symbol("vftLocale"), t = {};
2
2
  export {
3
3
  o as configProviderContextKey,
4
- e as messageConfig
4
+ e as localeContextKey,
5
+ t as messageConfig
5
6
  };
@@ -1,59 +1,62 @@
1
- import { keysOf as f } from "@vft/utils";
1
+ import { keysOf as c } from "@vft/utils";
2
2
  import "@vueuse/core";
3
3
  import { debugWarn as v } from "../../../utils/error.js";
4
- import { ref as g, getCurrentInstance as l, computed as i, unref as p, provide as C, inject as x } from "vue";
4
+ import { ref as g, getCurrentInstance as f, computed as t, unref as p, provide as C, inject as x } from "vue";
5
5
  import "lodash-es";
6
6
  import "../../form/index.js";
7
7
  import { namespaceContextKey as I, useNamespace as b, defaultNamespace as y } from "../../../hooks/use-namespace/index.js";
8
8
  import "../../../hooks/use-model-toggle/index.js";
9
9
  import "@popperjs/core";
10
10
  import { zIndexContextKey as G, useZIndex as z, defaultInitialZIndex as K } from "../../../hooks/use-z-index/index.js";
11
- import { configProviderContextKey as m } from "../constants.js";
12
- const a = g();
11
+ import { configProviderContextKey as m, localeContextKey as S } from "../constants.js";
12
+ const s = g();
13
13
  function d(o, e = void 0) {
14
- const n = l() ? x(m, a) : a;
15
- return o ? i(() => n?.value?.[o] ?? e) : n;
14
+ const n = f() ? x(m, s) : s;
15
+ return o ? t(() => n?.value?.[o] ?? e) : n;
16
16
  }
17
- function B(o) {
17
+ function D(o) {
18
18
  const e = d(), n = b(
19
19
  o,
20
- i(() => e.value?.namespace || y)
21
- ), t = z(
22
- i(() => e.value?.zIndex || K)
20
+ t(() => e.value?.namespace || y)
21
+ ), r = z(
22
+ t(() => e.value?.zIndex || K)
23
23
  );
24
- return S(i(() => p(e) || {})), {
24
+ return j(t(() => p(e) || {})), {
25
25
  ns: n,
26
- zIndex: t
26
+ zIndex: r
27
27
  };
28
28
  }
29
- const S = (o, e, n = !1) => {
30
- const t = !!l(), r = t ? d() : void 0, u = e?.provide ?? (t ? C : void 0);
31
- if (!u) {
29
+ const j = (o, e, n = !1) => {
30
+ const r = !!f(), i = r ? d() : void 0, l = e?.provide ?? (r ? C : void 0);
31
+ if (!l) {
32
32
  v(
33
33
  "provideGlobalConfig",
34
34
  "provideGlobalConfig() can only be used inside setup()."
35
35
  );
36
36
  return;
37
37
  }
38
- const s = i(() => {
39
- const c = p(o);
40
- return r?.value ? j(r.value, c) : c;
38
+ const a = t(() => {
39
+ const u = p(o);
40
+ return i?.value ? k(i.value, u) : u;
41
41
  });
42
- return u(m, s), u(
42
+ return l(m, a), l(
43
43
  I,
44
- i(() => s.value.namespace)
45
- ), u(
44
+ t(() => a.value.namespace)
45
+ ), l(
46
46
  G,
47
- i(() => s.value.zIndex)
48
- ), (n || !a.value) && (a.value = s.value), s;
49
- }, j = (o, e) => {
50
- const n = [.../* @__PURE__ */ new Set([...f(o), ...f(e)])], t = {};
51
- for (const r of n)
52
- t[r] = e[r] !== void 0 ? e[r] : o[r];
53
- return t;
47
+ t(() => a.value.zIndex)
48
+ ), l(
49
+ S,
50
+ t(() => a.value.locale)
51
+ ), (n || !s.value) && (s.value = a.value), a;
52
+ }, k = (o, e) => {
53
+ const n = [.../* @__PURE__ */ new Set([...c(o), ...c(e)])], r = {};
54
+ for (const i of n)
55
+ r[i] = e[i] !== void 0 ? e[i] : o[i];
56
+ return r;
54
57
  };
55
58
  export {
56
- S as provideGlobalConfig,
57
- B as useGlobalComponentSettings,
59
+ j as provideGlobalConfig,
60
+ D as useGlobalComponentSettings,
58
61
  d as useGlobalConfig
59
62
  };
@@ -24,6 +24,9 @@ export declare const VftConfigProvider: import("vft/es/utils").SFCWithInstall<{
24
24
  zIndex: {
25
25
  type: import("vue").PropType<number>;
26
26
  };
27
+ locale: {
28
+ type: import("vue").PropType<any>;
29
+ };
27
30
  message: {
28
31
  type: import("vue").PropType<import("vft/es/vft").MessageConfigContext>;
29
32
  };
@@ -74,6 +77,9 @@ export declare const VftConfigProvider: import("vft/es/utils").SFCWithInstall<{
74
77
  zIndex: {
75
78
  type: import("vue").PropType<number>;
76
79
  };
80
+ locale: {
81
+ type: import("vue").PropType<any>;
82
+ };
77
83
  message: {
78
84
  type: import("vue").PropType<import("vft/es/vft").MessageConfigContext>;
79
85
  };
@@ -121,6 +127,9 @@ export declare const VftConfigProvider: import("vft/es/utils").SFCWithInstall<{
121
127
  zIndex: {
122
128
  type: import("vue").PropType<number>;
123
129
  };
130
+ locale: {
131
+ type: import("vue").PropType<any>;
132
+ };
124
133
  message: {
125
134
  type: import("vue").PropType<import("vft/es/vft").MessageConfigContext>;
126
135
  };
@@ -1,19 +1,20 @@
1
1
  import "@vueuse/core";
2
2
  import "@vft/utils";
3
- import { provideGlobalConfig as g, useGlobalComponentSettings as C, useGlobalConfig as d } from "./hooks/use-global-config.js";
3
+ import { provideGlobalConfig as g, useGlobalComponentSettings as C, useGlobalConfig as x } from "./hooks/use-global-config.js";
4
4
  import "vue";
5
5
  import { withInstall as o } from "../../utils/vue/install.js";
6
6
  import "lodash-es";
7
7
  import "../form/index.js";
8
8
  import t from "./config-provider.vue2.js";
9
- import { configProviderContextKey as b, messageConfig as c } from "./constants.js";
9
+ import { configProviderContextKey as d, localeContextKey as b, messageConfig as u } from "./constants.js";
10
10
  const l = o(t);
11
11
  export {
12
12
  l as VftConfigProvider,
13
- b as configProviderContextKey,
13
+ d as configProviderContextKey,
14
14
  l as default,
15
- c as messageConfig,
15
+ b as localeContextKey,
16
+ u as messageConfig,
16
17
  g as provideGlobalConfig,
17
18
  C as useGlobalComponentSettings,
18
- d as useGlobalConfig
19
+ x as useGlobalConfig
19
20
  };
@@ -179,7 +179,7 @@ export declare const useBasicDateTableDOM: (props: BasicDateTableProps, { isCurr
179
179
  tableKls: import("vue").ComputedRef<(string | {
180
180
  'is-week-mode': boolean;
181
181
  })[]>;
182
- tableLabel: import("vue").ComputedRef<string>;
182
+ tableLabel: import("vue").ComputedRef<any>;
183
183
  weekHeaderClass: string;
184
184
  getCellClasses: (cell: DateCell) => string;
185
185
  getRowKls: (cell: DateCell) => (string | {
@@ -1,183 +1,184 @@
1
- import { ref as k, computed as m, unref as r, watch as Y, nextTick as Z } from "vue";
2
- import P from "dayjs";
3
- import { flatten as p, isArray as ee } from "lodash-es";
1
+ import { ref as b, computed as h, unref as r, watch as Z, nextTick as ee } from "vue";
2
+ import E from "dayjs";
3
+ import { flatten as te, isArray as ae } from "lodash-es";
4
4
  import "@vueuse/core";
5
5
  import "@vft/utils";
6
- import { castArray as x } from "../../../utils/helper.js";
6
+ import { castArray as N } from "../../../utils/helper.js";
7
7
  import "../../form/index.js";
8
- import { useNamespace as te } from "../../../hooks/use-namespace/index.js";
8
+ import { useNamespace as se } 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 { buildPickerTable as ae } from "../utils.js";
13
- const N = (a = "") => ["normal", "today"].includes(a), ye = (a, f) => {
14
- const D = k("zh-cn"), y = k(), b = k(), g = k(), w = k(), C = k([[], [], [], [], [], []]);
15
- let o = !1;
16
- const c = a.date.$locale().weekStart || 7, S = a.date.locale("zh-cn").localeData().weekdaysShort().map((e) => e.toLowerCase()), O = m(() => c > 3 ? 7 - c : -c), v = m(() => {
17
- const e = a.date.startOf("month");
12
+ import { useLocale as ne } from "../../../locale/use-locale.js";
13
+ import { buildPickerTable as oe } from "../utils.js";
14
+ const v = (s = "") => ["normal", "today"].includes(s), ge = (s, l) => {
15
+ const { t: S } = ne(), k = b("zh-cn"), g = b(), w = b(), M = b(), C = b(), c = b([[], [], [], [], [], []]);
16
+ let d = !1;
17
+ const D = s.date.$locale().weekStart || 7, R = s.date.locale("zh-cn").localeData().weekdaysShort().map((e) => e.toLowerCase()), x = h(() => D > 3 ? 7 - D : -D), V = h(() => {
18
+ const e = s.date.startOf("month");
18
19
  return e.subtract(e.day() || 7, "day");
19
- }), j = m(() => S.concat(S).slice(
20
- c,
21
- c + 7
22
- )), R = m(() => p(r(M)).some((e) => e.isCurrent)), A = m(() => {
23
- const e = a.date.startOf("month"), t = e.day() || 7, n = e.daysInMonth(), s = e.subtract(1, "month").daysInMonth();
20
+ }), L = h(() => R.concat(R).slice(
21
+ D,
22
+ D + 7
23
+ )), T = h(() => te(r(O)).some((e) => e.isCurrent)), K = h(() => {
24
+ const e = s.date.startOf("month"), a = e.day() || 7, n = e.daysInMonth(), o = e.subtract(1, "month").daysInMonth();
24
25
  return {
25
- startOfMonthDay: t,
26
+ startOfMonthDay: a,
26
27
  dateCountOfMonth: n,
27
- dateCountOfLastMonth: s
28
+ dateCountOfLastMonth: o
28
29
  };
29
- }), K = m(() => a.selectionMode === "dates" ? x(a.parsedValue) : []), L = (e, { count: t, rowIndex: n, columnIndex: s }) => {
30
- const { startOfMonthDay: l, dateCountOfMonth: i, dateCountOfLastMonth: u } = r(A), h = r(O);
30
+ }), F = h(() => s.selectionMode === "dates" ? N(s.parsedValue) : []), _ = (e, { count: a, rowIndex: n, columnIndex: o }) => {
31
+ const { startOfMonthDay: m, dateCountOfMonth: u, dateCountOfLastMonth: f } = r(K), y = r(x);
31
32
  if (n >= 0 && n <= 1) {
32
- const d = l + h < 0 ? 7 + l + h : l + h;
33
- if (s + n * 7 >= d)
34
- return e.text = t, !0;
35
- e.text = u - (d - s % 7) + 1 + n * 7, e.type = "prev-month";
33
+ const i = m + y < 0 ? 7 + m + y : m + y;
34
+ if (o + n * 7 >= i)
35
+ return e.text = a, !0;
36
+ e.text = f - (i - o % 7) + 1 + n * 7, e.type = "prev-month";
36
37
  } else
37
- return t <= i ? e.text = t : (e.text = t - i, e.type = "next-month"), !0;
38
+ return a <= u ? e.text = a : (e.text = a - u, e.type = "next-month"), !0;
38
39
  return !1;
39
- }, F = (e, { columnIndex: t, rowIndex: n }, s) => {
40
- const { disabledDate: l, cellClassName: i } = a, u = r(K), h = L(e, { count: s, rowIndex: n, columnIndex: t }), d = e.dayjs.toDate();
41
- return e.selected = u.find((X) => X.isSame(e.dayjs, "day")), e.isSelected = !!e.selected, e.isCurrent = W(e), e.disabled = l?.(d), e.customClass = i?.(d), h;
42
- }, _ = (e) => {
43
- if (a.selectionMode === "week") {
44
- const [t, n] = a.showWeekNumber ? [1, 7] : [0, 6], s = I(e[t + 1]);
45
- e[t].inRange = s, e[t].start = s, e[n].inRange = s, e[n].end = s;
40
+ }, $ = (e, { columnIndex: a, rowIndex: n }, o) => {
41
+ const { disabledDate: m, cellClassName: u } = s, f = r(F), y = _(e, { count: o, rowIndex: n, columnIndex: a }), i = e.dayjs.toDate();
42
+ return e.selected = f.find((Y) => Y.isSame(e.dayjs, "day")), e.isSelected = !!e.selected, e.isCurrent = P(e), e.disabled = m?.(i), e.customClass = u?.(i), y;
43
+ }, z = (e) => {
44
+ if (s.selectionMode === "week") {
45
+ const [a, n] = s.showWeekNumber ? [1, 7] : [0, 6], o = A(e[a + 1]);
46
+ e[a].inRange = o, e[a].start = o, e[n].inRange = o, e[n].end = o;
46
47
  }
47
- }, M = m(() => {
48
- const { minDate: e, maxDate: t, rangeState: n, showWeekNumber: s } = a, l = r(O), i = r(C), u = "day";
49
- let h = 1;
50
- if (ae({ row: 6, column: 7 }, i, {
48
+ }, O = h(() => {
49
+ const { minDate: e, maxDate: a, rangeState: n, showWeekNumber: o } = s, m = r(x), u = r(c), f = "day";
50
+ let y = 1;
51
+ if (oe({ row: 6, column: 7 }, u, {
51
52
  startDate: e,
52
- columnIndexOffset: s ? 1 : 0,
53
- nextEndDate: n.endDate || t || n.selecting && e || null,
54
- now: P().locale(r(D)).startOf(u),
55
- unit: u,
56
- relativeDateGetter: (d) => r(v).add(d - l, u),
57
- setCellMetadata: (...d) => {
58
- F(...d, h) && (h += 1);
53
+ columnIndexOffset: o ? 1 : 0,
54
+ nextEndDate: n.endDate || a || n.selecting && e || null,
55
+ now: E().locale(r(k)).startOf(f),
56
+ unit: f,
57
+ relativeDateGetter: (i) => r(V).add(i - m, f),
58
+ setCellMetadata: (...i) => {
59
+ $(...i, y) && (y += 1);
59
60
  },
60
- setRowMetadata: _
61
- }), s)
62
- for (let d = 0; d < 6; d++)
63
- i[d][1].dayjs && (i[d][0] = {
61
+ setRowMetadata: z
62
+ }), o)
63
+ for (let i = 0; i < 6; i++)
64
+ u[i][1].dayjs && (u[i][0] = {
64
65
  type: "week",
65
- text: i[d][1].dayjs.week()
66
+ text: u[i][1].dayjs.week()
66
67
  });
67
- return i;
68
+ return u;
68
69
  });
69
- Y(
70
- () => a.date,
70
+ Z(
71
+ () => s.date,
71
72
  async () => {
72
- r(y)?.contains(document.activeElement) && (await Z(), await V());
73
+ r(g)?.contains(document.activeElement) && (await ee(), await W());
73
74
  }
74
75
  );
75
- const V = async () => r(b)?.focus(), W = (e) => a.selectionMode === "date" && N(e.type) && $(e, a.parsedValue), $ = (e, t) => t ? P(t).locale(r(D)).isSame(a.date.date(Number(e.text)), "day") : !1, T = (e, t) => {
76
- const n = e * 7 + (t - (a.showWeekNumber ? 1 : 0)) - r(O);
77
- return r(v).add(n, "day");
78
- }, z = (e) => {
79
- if (!a.rangeState.selecting) return;
80
- let t = e.target;
81
- if (t.tagName === "SPAN" && (t = t.parentNode?.parentNode), t.tagName === "DIV" && (t = t.parentNode), t.tagName !== "TD") return;
82
- const n = t.parentNode.rowIndex - 1, s = t.cellIndex;
83
- r(M)[n][s].disabled || (n !== r(g) || s !== r(w)) && (g.value = n, w.value = s, f("changerange", {
76
+ const W = async () => r(w)?.focus(), P = (e) => s.selectionMode === "date" && v(e.type) && B(e, s.parsedValue), B = (e, a) => a ? E(a).locale(r(k)).isSame(s.date.date(Number(e.text)), "day") : !1, I = (e, a) => {
77
+ const n = e * 7 + (a - (s.showWeekNumber ? 1 : 0)) - r(x);
78
+ return r(V).add(n, "day");
79
+ }, U = (e) => {
80
+ if (!s.rangeState.selecting) return;
81
+ let a = e.target;
82
+ if (a.tagName === "SPAN" && (a = a.parentNode?.parentNode), a.tagName === "DIV" && (a = a.parentNode), a.tagName !== "TD") return;
83
+ const n = a.parentNode.rowIndex - 1, o = a.cellIndex;
84
+ r(O)[n][o].disabled || (n !== r(M) || o !== r(C)) && (M.value = n, C.value = o, l("changerange", {
84
85
  selecting: !0,
85
- endDate: T(n, s)
86
+ endDate: I(n, o)
86
87
  }));
87
- }, B = (e) => !r(R) && e?.text === 1 && e.type === "normal" || e.isCurrent, U = (e) => {
88
- o || r(R) || a.selectionMode !== "date" || E(e, !0);
89
- }, G = (e) => {
90
- e.target.closest("td") && (o = !0);
91
- }, H = (e) => {
92
- e.target.closest("td") && (o = !1);
88
+ }, G = (e) => !r(T) && e?.text === 1 && e.type === "normal" || e.isCurrent, H = (e) => {
89
+ d || r(T) || s.selectionMode !== "date" || j(e, !0);
90
+ }, p = (e) => {
91
+ e.target.closest("td") && (d = !0);
93
92
  }, q = (e) => {
94
- !a.rangeState.selecting || !a.minDate ? (f("pick", { minDate: e, maxDate: null }), f("select", !0)) : (e >= a.minDate ? f("pick", { minDate: a.minDate, maxDate: e }) : f("pick", { minDate: e, maxDate: a.minDate }), f("select", !1));
93
+ e.target.closest("td") && (d = !1);
95
94
  }, J = (e) => {
96
- const t = e.week(), n = `${e.year()}w${t}`;
97
- f("pick", {
95
+ !s.rangeState.selecting || !s.minDate ? (l("pick", { minDate: e, maxDate: null }), l("select", !0)) : (e >= s.minDate ? l("pick", { minDate: s.minDate, maxDate: e }) : l("pick", { minDate: e, maxDate: s.minDate }), l("select", !1));
96
+ }, Q = (e) => {
97
+ const a = e.week(), n = `${e.year()}w${a}`;
98
+ l("pick", {
98
99
  year: e.year(),
99
- week: t,
100
+ week: a,
100
101
  value: n,
101
102
  date: e.startOf("week")
102
103
  });
103
- }, Q = (e, t) => {
104
- const n = t ? x(a.parsedValue).filter(
105
- (s) => s?.valueOf() !== e.valueOf()
106
- ) : x(a.parsedValue).concat([e]);
107
- f("pick", n);
108
- }, E = (e, t = !1) => {
104
+ }, X = (e, a) => {
105
+ const n = a ? N(s.parsedValue).filter(
106
+ (o) => o?.valueOf() !== e.valueOf()
107
+ ) : N(s.parsedValue).concat([e]);
108
+ l("pick", n);
109
+ }, j = (e, a = !1) => {
109
110
  const n = e.target.closest("td");
110
111
  if (!n) return;
111
- const s = n.parentNode.rowIndex - 1, l = n.cellIndex, i = r(M)[s][l];
112
- if (i.disabled || i.type === "week") return;
113
- const u = T(s, l);
114
- switch (a.selectionMode) {
112
+ const o = n.parentNode.rowIndex - 1, m = n.cellIndex, u = r(O)[o][m];
113
+ if (u.disabled || u.type === "week") return;
114
+ const f = I(o, m);
115
+ switch (s.selectionMode) {
115
116
  case "range": {
116
- q(u);
117
+ J(f);
117
118
  break;
118
119
  }
119
120
  case "date": {
120
- f("pick", u, t);
121
+ l("pick", f, a);
121
122
  break;
122
123
  }
123
124
  case "week": {
124
- J(u);
125
+ Q(f);
125
126
  break;
126
127
  }
127
128
  case "dates": {
128
- Q(u, !!i.selected);
129
+ X(f, !!u.selected);
129
130
  break;
130
131
  }
131
132
  }
132
- }, I = (e) => {
133
- if (a.selectionMode !== "week") return !1;
134
- let t = a.date.startOf("day");
135
- if (e.type === "prev-month" && (t = t.subtract(1, "month")), e.type === "next-month" && (t = t.add(1, "month")), t = t.date(Number.parseInt(e.text, 10)), a.parsedValue && !ee(a.parsedValue)) {
136
- const n = (a.parsedValue.day() - c + 7) % 7 - 1;
137
- return a.parsedValue.subtract(n, "day").isSame(t, "day");
133
+ }, A = (e) => {
134
+ if (s.selectionMode !== "week") return !1;
135
+ let a = s.date.startOf("day");
136
+ if (e.type === "prev-month" && (a = a.subtract(1, "month")), e.type === "next-month" && (a = a.add(1, "month")), a = a.date(Number.parseInt(e.text, 10)), s.parsedValue && !ae(s.parsedValue)) {
137
+ const n = (s.parsedValue.day() - D + 7) % 7 - 1;
138
+ return s.parsedValue.subtract(n, "day").isSame(a, "day");
138
139
  }
139
140
  return !1;
140
141
  };
141
142
  return {
142
- WEEKS: j,
143
- rows: M,
144
- tbodyRef: y,
145
- currentCellRef: b,
143
+ WEEKS: L,
144
+ rows: O,
145
+ tbodyRef: g,
146
+ currentCellRef: w,
146
147
  // cellMatchesDate,
147
148
  // getDateOfCell,
148
- focus: V,
149
- isCurrent: W,
150
- isWeekActive: I,
151
- isSelectedCell: B,
152
- handlePickDate: E,
153
- handleMouseUp: H,
154
- handleMouseDown: G,
155
- handleMouseMove: z,
156
- handleFocus: U
149
+ focus: W,
150
+ isCurrent: P,
151
+ isWeekActive: A,
152
+ isSelectedCell: G,
153
+ handlePickDate: j,
154
+ handleMouseUp: q,
155
+ handleMouseDown: p,
156
+ handleMouseMove: U,
157
+ handleFocus: H
157
158
  };
158
- }, ke = (a, {
159
- isCurrent: f,
160
- isWeekActive: D
159
+ }, we = (s, {
160
+ isCurrent: l,
161
+ isWeekActive: S
161
162
  }) => {
162
- const y = te("date-table"), b = m(() => [
163
- y.b(),
164
- { "is-week-mode": a.selectionMode === "week" }
165
- ]), g = m(() => "使用方向键与 Enter 键可选择日期"), w = (o) => {
166
- const c = [];
167
- return N(o.type) && !o.disabled ? (c.push("available"), o.type === "today" && c.push("today")) : c.push(o.type), f(o) && c.push("current"), o.inRange && (N(o.type) || a.selectionMode === "week") && (c.push("in-range"), o.start && c.push("start-date"), o.end && c.push("end-date")), o.disabled && c.push("disabled"), o.selected && c.push("selected"), o.customClass && c.push(o.customClass), c.join(" ");
168
- }, C = (o) => [
169
- y.e("row"),
170
- { current: D(o) }
163
+ const k = se("date-table"), g = h(() => [
164
+ k.b(),
165
+ { "is-week-mode": s.selectionMode === "week" }
166
+ ]), w = h(() => t("vft.datePicker.dateTableLabel")), M = (c) => {
167
+ const d = [];
168
+ return v(c.type) && !c.disabled ? (d.push("available"), c.type === "today" && d.push("today")) : d.push(c.type), l(c) && d.push("current"), c.inRange && (v(c.type) || s.selectionMode === "week") && (d.push("in-range"), c.start && d.push("start-date"), c.end && d.push("end-date")), c.disabled && d.push("disabled"), c.selected && d.push("selected"), c.customClass && d.push(c.customClass), d.join(" ");
169
+ }, C = (c) => [
170
+ k.e("row"),
171
+ { current: S(c) }
171
172
  ];
172
173
  return {
173
- tableKls: b,
174
- tableLabel: g,
175
- weekHeaderClass: y.e("week-header"),
176
- getCellClasses: w,
174
+ tableKls: g,
175
+ tableLabel: w,
176
+ weekHeaderClass: k.e("week-header"),
177
+ getCellClasses: M,
177
178
  getRowKls: C
178
179
  };
179
180
  };
180
181
  export {
181
- ye as useBasicDateTable,
182
- ke as useBasicDateTableDOM
182
+ ge as useBasicDateTable,
183
+ we as useBasicDateTableDOM
183
184
  };
@@ -1,29 +1,30 @@
1
1
  import { computed as a } from "vue";
2
- const b = ({
2
+ import { useLocale as Y } from "../../../locale/use-locale.js";
3
+ const p = ({
3
4
  unlinkPanels: u,
4
5
  leftDate: e,
5
6
  rightDate: r
6
7
  }) => {
7
- const v = () => {
8
+ const { t: v } = Y(), o = () => {
8
9
  e.value = e.value.subtract(1, "year"), u.value || (r.value = r.value.subtract(1, "year"));
9
- }, l = () => {
10
+ }, c = () => {
10
11
  u.value || (e.value = e.value.add(1, "year")), r.value = r.value.add(1, "year");
11
- }, o = () => {
12
+ }, l = () => {
12
13
  e.value = e.value.add(1, "year");
13
- }, c = () => {
14
+ }, y = () => {
14
15
  r.value = r.value.subtract(1, "year");
15
- }, n = a(() => `${e.value.year()} 年`), y = a(() => `${r.value.year()} 年`), s = a(() => e.value.year()), d = a(() => r.value.year() === e.value.year() ? e.value.year() + 1 : r.value.year());
16
+ }, n = a(() => `${e.value.year()} ${v("vft.datePicker.year")}`), s = a(() => `${r.value.year()} ${v("vft.datePicker.year")}`), d = a(() => e.value.year()), t = a(() => r.value.year() === e.value.year() ? e.value.year() + 1 : r.value.year());
16
17
  return {
17
- leftPrevYear: v,
18
- rightNextYear: l,
19
- leftNextYear: o,
20
- rightPrevYear: c,
18
+ leftPrevYear: o,
19
+ rightNextYear: c,
20
+ leftNextYear: l,
21
+ rightPrevYear: y,
21
22
  leftLabel: n,
22
- rightLabel: y,
23
- leftYear: s,
24
- rightYear: d
23
+ rightLabel: s,
24
+ leftYear: d,
25
+ rightYear: t
25
26
  };
26
27
  };
27
28
  export {
28
- b as useMonthRangeHeader
29
+ p as useMonthRangeHeader
29
30
  };