@varlet/ui 3.2.15-alpha.1718191007402 → 3.2.15-alpha.1718197171675

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.
@@ -48,7 +48,7 @@ function __render__(_ctx, _cache) {
48
48
  {
49
49
  class: _normalizeClass(_ctx.n("title"))
50
50
  },
51
- _toDisplayString((_a = _ctx.title) != null ? _a : _ctx.t("actionSheetTitle", { locale: _ctx.locale })),
51
+ _toDisplayString((_a = _ctx.title) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("actionSheetTitle")),
52
52
  3
53
53
  /* TEXT, CLASS */
54
54
  )
@@ -94,7 +94,7 @@ const __sfc__ = defineComponent({
94
94
  props,
95
95
  setup(props2) {
96
96
  const show = useVModel(props2, "show");
97
- const { locale } = injectLocaleProvider();
97
+ const { t: pt } = injectLocaleProvider();
98
98
  function handleSelect(action) {
99
99
  if (action.disabled) {
100
100
  return;
@@ -107,7 +107,7 @@ const __sfc__ = defineComponent({
107
107
  }
108
108
  return {
109
109
  show,
110
- locale,
110
+ pt,
111
111
  t,
112
112
  n,
113
113
  classes,
@@ -3,5 +3,5 @@ import '../../icon/icon.css'
3
3
  import '../../ripple/ripple.css'
4
4
  import '../../popup/popup.css'
5
5
  import '../actionSheet.css'
6
- import '../ActionSheetSfc.css'
7
6
  import '../ActionItemSfc.css'
7
+ import '../ActionSheetSfc.css'
@@ -64,7 +64,7 @@ function __render__(_ctx, _cache) {
64
64
  {
65
65
  class: _normalizeClass(_ctx.n("title-hint"))
66
66
  },
67
- _toDisplayString((_a = _ctx.hint) != null ? _a : _ctx.t("datePickerHint", { locale: _ctx.locale })),
67
+ _toDisplayString((_a = _ctx.hint) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("datePickerHint")),
68
68
  3
69
69
  /* TEXT, CLASS */
70
70
  ),
@@ -288,7 +288,7 @@ const __sfc__ = defineComponent({
288
288
  },
289
289
  props,
290
290
  setup(props2) {
291
- const { locale } = injectLocaleProvider();
291
+ const { t: pt } = injectLocaleProvider();
292
292
  const currentDate = dayjs().format("YYYY-MM-D");
293
293
  const [currentYear, currentMonth] = currentDate.split("-");
294
294
  const monthDes = MONTH_LIST.find((month) => month === currentMonth);
@@ -343,7 +343,7 @@ const __sfc__ = defineComponent({
343
343
  if (range) {
344
344
  return chooseRangeYear.value.length ? `${chooseRangeYear.value[0]} ~ ${chooseRangeYear.value[1]}` : "";
345
345
  }
346
- return multiple ? `${chooseYears.value.length}${t("datePickerSelected", { locale: locale.value })}` : (_a = chooseYear.value) != null ? _a : "";
346
+ return multiple ? `${chooseYears.value.length}${(pt || t)("datePickerSelected")}` : (_a = chooseYear.value) != null ? _a : "";
347
347
  });
348
348
  const getMonthTitle = computed(() => {
349
349
  var _a, _b;
@@ -353,9 +353,9 @@ const __sfc__ = defineComponent({
353
353
  }
354
354
  let monthName = "";
355
355
  if (chooseMonth.value) {
356
- monthName = (_b = (_a = t("datePickerMonthDict", { locale: locale.value })) == null ? void 0 : _a[chooseMonth.value].name) != null ? _b : "";
356
+ monthName = (_b = (_a = (pt || t)("datePickerMonthDict")) == null ? void 0 : _a[chooseMonth.value].name) != null ? _b : "";
357
357
  }
358
- return multiple ? `${chooseMonths.value.length}${t("datePickerSelected", { locale: locale.value })}` : monthName;
358
+ return multiple ? `${chooseMonths.value.length}${(pt || t)("datePickerSelected")}` : monthName;
359
359
  });
360
360
  const getDateTitle = computed(() => {
361
361
  var _a, _b, _c, _d;
@@ -365,15 +365,15 @@ const __sfc__ = defineComponent({
365
365
  return formatRangeDays.length ? `${formatRangeDays[0]} ~ ${formatRangeDays[1]}` : "";
366
366
  }
367
367
  if (multiple)
368
- return `${chooseDays.value.length}${t("datePickerSelected", { locale: locale.value })}`;
368
+ return `${chooseDays.value.length}${(pt || t)("datePickerSelected")}`;
369
369
  if (!chooseYear.value || !chooseMonth.value || !chooseDay.value)
370
370
  return "";
371
371
  const weekIndex = dayjs(`${chooseYear.value}-${chooseMonth.value}-${chooseDay.value}`).day();
372
372
  const week = WEEK_HEADER.find((value) => value === `${weekIndex}`);
373
- const weekName = (_b = (_a = t("datePickerWeekDict", { locale: locale.value })) == null ? void 0 : _a[week].name) != null ? _b : "";
374
- const monthName = (_d = (_c = t("datePickerMonthDict", { locale: locale.value })) == null ? void 0 : _c[chooseMonth.value].name) != null ? _d : "";
373
+ const weekName = (_b = (_a = (pt || t)("datePickerWeekDict")) == null ? void 0 : _a[week].name) != null ? _b : "";
374
+ const monthName = (_d = (_c = (pt || t)("datePickerMonthDict")) == null ? void 0 : _c[chooseMonth.value].name) != null ? _d : "";
375
375
  const showDay = padStart(chooseDay.value, 2, "0");
376
- if (t("lang") === "zh-CN")
376
+ if ((pt || t)("lang") === "zh-CN")
377
377
  return `${chooseMonth.value}-${showDay} ${weekName.slice(0, 3)}`;
378
378
  return `${weekName.slice(0, 3)}, ${monthName.slice(0, 3)} ${chooseDay.value}`;
379
379
  });
@@ -665,7 +665,7 @@ const __sfc__ = defineComponent({
665
665
  componentProps,
666
666
  slotProps,
667
667
  formatRange,
668
- locale,
668
+ pt,
669
669
  t,
670
670
  n,
671
671
  classes,
@@ -65,7 +65,7 @@ function __render__(_ctx, _cache) {
65
65
  var _a;
66
66
  return [
67
67
  _createTextVNode(
68
- _toDisplayString((_a = _ctx.title) != null ? _a : _ctx.t("dialogTitle", { locale: _ctx.locale })),
68
+ _toDisplayString((_a = _ctx.title) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("dialogTitle")),
69
69
  1
70
70
  /* TEXT */
71
71
  )
@@ -112,7 +112,7 @@ function __render__(_ctx, _cache) {
112
112
  var _a;
113
113
  return [
114
114
  _createTextVNode(
115
- _toDisplayString((_a = _ctx.cancelButtonText) != null ? _a : _ctx.t("dialogCancelButtonText", { locale: _ctx.locale })),
115
+ _toDisplayString((_a = _ctx.cancelButtonText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("dialogCancelButtonText")),
116
116
  1
117
117
  /* TEXT */
118
118
  )
@@ -134,7 +134,7 @@ function __render__(_ctx, _cache) {
134
134
  var _a;
135
135
  return [
136
136
  _createTextVNode(
137
- _toDisplayString((_a = _ctx.confirmButtonText) != null ? _a : _ctx.t("dialogConfirmButtonText", { locale: _ctx.locale })),
137
+ _toDisplayString((_a = _ctx.confirmButtonText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("dialogConfirmButtonText")),
138
138
  1
139
139
  /* TEXT */
140
140
  )
@@ -167,7 +167,7 @@ const __sfc__ = defineComponent({
167
167
  setup(props2) {
168
168
  const popupShow = ref(false);
169
169
  const popupCloseOnClickOverlay = ref(false);
170
- const { locale } = injectLocaleProvider();
170
+ const { t: pt } = injectLocaleProvider();
171
171
  watch(
172
172
  () => props2.show,
173
173
  (newValue) => {
@@ -227,10 +227,10 @@ const __sfc__ = defineComponent({
227
227
  cancel();
228
228
  }
229
229
  return {
230
- t,
231
- locale,
232
230
  popupShow,
233
231
  popupCloseOnClickOverlay,
232
+ pt,
233
+ t,
234
234
  n,
235
235
  classes,
236
236
  handleClickOverlay,
@@ -265,7 +265,7 @@ import './tooltip/style/index.mjs'
265
265
  import './uploader/style/index.mjs'
266
266
  import './watermark/style/index.mjs'
267
267
 
268
- const version = '3.2.15-alpha.1718191007402'
268
+ const version = '3.2.15-alpha.1718197171675'
269
269
 
270
270
  function install(app) {
271
271
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -176,7 +176,7 @@ export * from './tooltip/index.mjs'
176
176
  export * from './uploader/index.mjs'
177
177
  export * from './watermark/index.mjs'
178
178
 
179
- const version = '3.2.15-alpha.1718191007402'
179
+ const version = '3.2.15-alpha.1718197171675'
180
180
 
181
181
  function install(app) {
182
182
  ActionSheet.install && app.use(ActionSheet)
package/es/list/List.mjs CHANGED
@@ -56,7 +56,7 @@ function __render__(_ctx, _cache) {
56
56
  {
57
57
  class: _normalizeClass(_ctx.n("loading-text"))
58
58
  },
59
- _toDisplayString((_a = _ctx.loadingText) != null ? _a : _ctx.t("listLoadingText", { locale: _ctx.locale })),
59
+ _toDisplayString((_a = _ctx.loadingText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("listLoadingText")),
60
60
  3
61
61
  /* TEXT, CLASS */
62
62
  ),
@@ -78,7 +78,7 @@ function __render__(_ctx, _cache) {
78
78
  {
79
79
  class: _normalizeClass(_ctx.n("finished"))
80
80
  },
81
- _toDisplayString((_a = _ctx.finishedText) != null ? _a : _ctx.t("listFinishedText", { locale: _ctx.locale })),
81
+ _toDisplayString((_a = _ctx.finishedText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("listFinishedText")),
82
82
  3
83
83
  /* TEXT, CLASS */
84
84
  )
@@ -95,7 +95,7 @@ function __render__(_ctx, _cache) {
95
95
  },
96
96
  [
97
97
  _createTextVNode(
98
- _toDisplayString((_a = _ctx.errorText) != null ? _a : _ctx.t("listErrorText", { locale: _ctx.locale })),
98
+ _toDisplayString((_a = _ctx.errorText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("listErrorText")),
99
99
  1
100
100
  /* TEXT */
101
101
  )
@@ -131,7 +131,7 @@ const __sfc__ = defineComponent({
131
131
  const listEl = ref(null);
132
132
  const detectorEl = ref(null);
133
133
  const { tabItem, bindTabItem } = useTabItem();
134
- const { locale } = injectLocaleProvider();
134
+ const { t: pt } = injectLocaleProvider();
135
135
  let scroller;
136
136
  call(bindTabItem, {});
137
137
  if (tabItem) {
@@ -173,8 +173,8 @@ const __sfc__ = defineComponent({
173
173
  }
174
174
  return {
175
175
  listEl,
176
- locale,
177
176
  detectorEl,
177
+ pt,
178
178
  t,
179
179
  isNumber,
180
180
  load,
@@ -43,17 +43,10 @@ function useLocale() {
43
43
  messages2.value[lang] = __spreadValues(__spreadValues({}, messages2.value[lang]), message);
44
44
  use2(lang);
45
45
  };
46
- const t2 = (id, options = {}) => {
47
- const { locale } = options;
48
- if (locale == null && hasOwn(currentMessage2.value, id)) {
46
+ const t2 = (id) => {
47
+ if (hasOwn(currentMessage2.value, id)) {
49
48
  return currentMessage2.value[id];
50
49
  }
51
- if (locale != null && hasOwn(messages2.value, locale)) {
52
- const targetMessage = messages2.value[locale];
53
- if (hasOwn(targetMessage, id)) {
54
- return targetMessage[id];
55
- }
56
- }
57
50
  };
58
51
  return {
59
52
  messages: messages2,
@@ -67,7 +60,20 @@ function useLocale() {
67
60
  const { messages, currentMessage, add, use, merge, t } = useLocale();
68
61
  add("zh-CN", zhCN);
69
62
  use("zh-CN");
70
- const _LocaleComponent = { zhCN, enUS, messages, currentMessage, add, use, merge, t, useLocale };
63
+ const _LocaleComponent = {
64
+ zhCN,
65
+ enUS,
66
+ zhTW,
67
+ zhHK,
68
+ faIR,
69
+ messages,
70
+ currentMessage,
71
+ add,
72
+ use,
73
+ merge,
74
+ t,
75
+ useLocale
76
+ };
71
77
  var stdin_default = {
72
78
  zhCN,
73
79
  enUS,
@@ -88,10 +94,13 @@ export {
88
94
  currentMessage,
89
95
  stdin_default as default,
90
96
  enUS,
97
+ faIR,
91
98
  merge,
92
99
  messages,
93
100
  t,
94
101
  use,
95
102
  useLocale,
96
- zhCN
103
+ zhCN,
104
+ zhHK,
105
+ zhTW
97
106
  };
@@ -1,16 +1,51 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1
20
  import { computed, defineComponent, h } from "vue";
2
21
  import { props } from "./props.mjs";
3
22
  import { createNamespace } from "../utils/components.mjs";
4
- import { call } from "@varlet/shared";
23
+ import { call, hasOwn } from "@varlet/shared";
5
24
  import { provideLocaleProvider } from "./provide.mjs";
6
25
  const { name, n } = createNamespace("locale-provider");
7
26
  const __sfc__ = defineComponent({
8
27
  name,
9
28
  props,
10
29
  setup(props2, { slots }) {
30
+ const messages = computed(
31
+ () => {
32
+ var _a;
33
+ return Object.entries((_a = props2.messages) != null ? _a : {}).reduce((messages2, [key, value]) => {
34
+ messages2[key] = __spreadProps(__spreadValues({}, value), {
35
+ lang: key
36
+ });
37
+ return messages2;
38
+ }, {});
39
+ }
40
+ );
11
41
  provideLocaleProvider({
12
- locale: computed(() => props2.locale)
42
+ t
13
43
  });
44
+ function t(id) {
45
+ if (hasOwn(messages.value, props2.locale) && hasOwn(messages.value[props2.locale], id)) {
46
+ return messages.value[props2.locale][id];
47
+ }
48
+ }
14
49
  return () => h(
15
50
  props2.tag,
16
51
  {
@@ -6,6 +6,9 @@ const props = {
6
6
  locale: {
7
7
  type: String,
8
8
  default: "zh-CN"
9
+ },
10
+ messages: {
11
+ type: Object
9
12
  }
10
13
  };
11
14
  export {
@@ -1,12 +1,12 @@
1
1
  import { keyInProvides } from "@varlet/use";
2
- import { computed, inject, provide } from "vue";
2
+ import { inject, provide } from "vue";
3
3
  const LOCALE_PROVIDER_KEY = Symbol("LOCALE_PROVIDER_KEY");
4
4
  function provideLocaleProvider(localeProvider) {
5
5
  provide(LOCALE_PROVIDER_KEY, localeProvider);
6
6
  }
7
7
  function injectLocaleProvider() {
8
8
  if (!keyInProvides(LOCALE_PROVIDER_KEY)) {
9
- return { locale: computed(() => void 0) };
9
+ return { t: null };
10
10
  }
11
11
  return inject(LOCALE_PROVIDER_KEY);
12
12
  }
@@ -162,7 +162,7 @@ function __render__(_ctx, _cache) {
162
162
  }, {
163
163
  default: _withCtx(() => [
164
164
  _createTextVNode(
165
- _toDisplayString(option) + _toDisplayString(_ctx.t("paginationItem", { locale: _ctx.locale })) + " / " + _toDisplayString(_ctx.t("paginationPage", { locale: _ctx.locale })),
165
+ _toDisplayString(option) + _toDisplayString((_ctx.pt ? _ctx.pt : _ctx.t)("paginationItem")) + " / " + _toDisplayString((_ctx.pt ? _ctx.pt : _ctx.t)("paginationPage")),
166
166
  1
167
167
  /* TEXT */
168
168
  )
@@ -185,7 +185,7 @@ function __render__(_ctx, _cache) {
185
185
  _createElementVNode(
186
186
  "span",
187
187
  null,
188
- _toDisplayString(_ctx.size) + _toDisplayString(_ctx.t("paginationItem", { locale: _ctx.locale })) + " / " + _toDisplayString(_ctx.t("paginationPage", { locale: _ctx.locale })),
188
+ _toDisplayString(_ctx.size) + _toDisplayString((_ctx.pt ? _ctx.pt : _ctx.t)("paginationItem")) + " / " + _toDisplayString((_ctx.pt ? _ctx.pt : _ctx.t)("paginationPage")),
189
189
  1
190
190
  /* TEXT */
191
191
  ),
@@ -214,7 +214,7 @@ function __render__(_ctx, _cache) {
214
214
  },
215
215
  [
216
216
  _createTextVNode(
217
- _toDisplayString(_ctx.t("paginationJump", { locale: _ctx.locale })) + " ",
217
+ _toDisplayString((_ctx.pt ? _ctx.pt : _ctx.t)("paginationJump")) + " ",
218
218
  1
219
219
  /* TEXT */
220
220
  ),
@@ -277,7 +277,7 @@ const __sfc__ = defineComponent({
277
277
  }
278
278
  return props2.showTotal(toNumber(props2.total), range.value);
279
279
  });
280
- const { locale } = injectLocaleProvider();
280
+ const { t: pt } = injectLocaleProvider();
281
281
  watch([() => props2.current, () => props2.size], ([newCurrent, newSize]) => {
282
282
  current.value = toNumber(newCurrent) || 1;
283
283
  size.value = toNumber(newSize || 10);
@@ -397,7 +397,7 @@ const __sfc__ = defineComponent({
397
397
  quickJumperValue,
398
398
  simpleCurrentValue,
399
399
  totalText,
400
- locale,
400
+ pt,
401
401
  t,
402
402
  n,
403
403
  classes,
@@ -70,7 +70,7 @@ function __render__(_ctx, _cache) {
70
70
  var _a;
71
71
  return [
72
72
  _createTextVNode(
73
- _toDisplayString((_a = _ctx.cancelButtonText) != null ? _a : _ctx.t("pickerCancelButtonText", { locale: _ctx.locale })),
73
+ _toDisplayString((_a = _ctx.cancelButtonText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("pickerCancelButtonText")),
74
74
  1
75
75
  /* TEXT */
76
76
  )
@@ -88,7 +88,7 @@ function __render__(_ctx, _cache) {
88
88
  {
89
89
  class: _normalizeClass(_ctx.n("title"))
90
90
  },
91
- _toDisplayString((_a = _ctx.title) != null ? _a : _ctx.t("pickerTitle", { locale: _ctx.locale })),
91
+ _toDisplayString((_a = _ctx.title) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("pickerTitle")),
92
92
  3
93
93
  /* TEXT, CLASS */
94
94
  )
@@ -106,7 +106,7 @@ function __render__(_ctx, _cache) {
106
106
  var _a;
107
107
  return [
108
108
  _createTextVNode(
109
- _toDisplayString((_a = _ctx.confirmButtonText) != null ? _a : _ctx.t("pickerConfirmButtonText", { locale: _ctx.locale })),
109
+ _toDisplayString((_a = _ctx.confirmButtonText) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("pickerConfirmButtonText")),
110
110
  1
111
111
  /* TEXT */
112
112
  )
@@ -234,7 +234,7 @@ const __sfc__ = defineComponent({
234
234
  const center = computed(() => optionCount.value * optionHeight.value / 2 - optionHeight.value / 2);
235
235
  const columnHeight = computed(() => optionCount.value * optionHeight.value);
236
236
  const { prevY, moveY, dragging, startTouch, moveTouch, endTouch } = useTouch();
237
- const { locale } = injectLocaleProvider();
237
+ const { t: pt } = injectLocaleProvider();
238
238
  let prevIndexes = [];
239
239
  initScrollColumns();
240
240
  watch(() => props2.columns, initScrollColumns, { deep: true });
@@ -474,7 +474,7 @@ const __sfc__ = defineComponent({
474
474
  columnHeight,
475
475
  center,
476
476
  Transition,
477
- locale,
477
+ pt,
478
478
  t,
479
479
  n,
480
480
  classes,
@@ -7,6 +7,7 @@ import { createNamespace, formatElevation } from "../utils/components.mjs";
7
7
  import { padStart } from "../utils/shared.mjs";
8
8
  import { getNumberTime, getIsDisableMinute, getIsDisableSecond } from "./utils.mjs";
9
9
  import { t } from "../locale/index.mjs";
10
+ import { injectLocaleProvider } from "../locale-provider/provide.mjs";
10
11
  const { name, n, classes } = createNamespace("time-picker");
11
12
  import { toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, resolveComponent as _resolveComponent, createBlock as _createBlock, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot } from "vue";
12
13
  function __render__(_ctx, _cache) {
@@ -31,7 +32,7 @@ function __render__(_ctx, _cache) {
31
32
  {
32
33
  class: _normalizeClass(_ctx.n("title-hint"))
33
34
  },
34
- _toDisplayString((_a = _ctx.hint) != null ? _a : _ctx.t("timePickerHint")),
35
+ _toDisplayString((_a = _ctx.hint) != null ? _a : (_ctx.pt ? _ctx.pt : _ctx.t)("timePickerHint")),
35
36
  3
36
37
  /* TEXT, CLASS */
37
38
  ),
@@ -247,6 +248,7 @@ const __sfc__ = defineComponent({
247
248
  return minuteRad.value;
248
249
  return secondRad.value;
249
250
  });
251
+ const { t: pt } = injectLocaleProvider();
250
252
  watch(
251
253
  () => props2.modelValue,
252
254
  (value) => {
@@ -441,6 +443,7 @@ const __sfc__ = defineComponent({
441
443
  n,
442
444
  classes,
443
445
  t,
446
+ pt,
444
447
  moveHand,
445
448
  checkPanel,
446
449
  checkAmpm,