@cloudtower/eagle 0.31.19 → 0.31.21

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.
@@ -1,10 +1,6 @@
1
1
  import { parrotI18n } from '@cloudtower/parrot';
2
2
  import _message from '../core/message/index.js';
3
3
  import { antdKit } from '../legacy-antd.js';
4
- import enUS from 'antd/lib/locale/en_US';
5
- import zhCN from 'antd/lib/locale/zh_CN';
6
- import antd5enUS from 'antd5/lib/locale/en_US';
7
- import antd5zhCN from 'antd5/lib/locale/zh_CN';
8
4
  import React__default, { createContext, useMemo, useEffect, useContext } from 'react';
9
5
  import { ConfigProvider } from '../core/ConfigProvider/index.js';
10
6
  import { createBatchMessageMethods } from '../core/message-group/index.js';
@@ -55,14 +51,8 @@ const UIKitProvider = (props) => {
55
51
  return /* @__PURE__ */ React__default.createElement(kitContext.Provider, { value: _kit }, /* @__PURE__ */ React__default.createElement(MessageContext.Provider, { value: batchMessage != null ? batchMessage : _message }, /* @__PURE__ */ React__default.createElement(
56
52
  ConfigProvider,
57
53
  {
58
- antd4Configs: __spreadValues({
59
- autoInsertSpaceInButton: false,
60
- locale: lng === "zh-CN" ? zhCN : enUS
61
- }, config == null ? void 0 : config.antd4Configs),
62
- antd5Configs: __spreadValues({
63
- autoInsertSpaceInButton: false,
64
- locale: lng === "zh-CN" ? antd5zhCN : antd5enUS
65
- }, config == null ? void 0 : config.antd5Configs)
54
+ antd4Configs: __spreadValues({}, config == null ? void 0 : config.antd4Configs),
55
+ antd5Configs: __spreadValues({}, config == null ? void 0 : config.antd5Configs)
66
56
  },
67
57
  children
68
58
  )));
@@ -1,6 +1,13 @@
1
+ import useParrotTranslation from '../../hooks/useParrotTranslation.js';
1
2
  import { ConfigProvider as ConfigProvider$2 } from 'antd';
2
3
  import { ConfigProvider as ConfigProvider$1 } from 'antd5';
3
- import React__default from 'react';
4
+ import React__default, { useEffect } from 'react';
5
+ import enUS from 'antd/lib/locale/en_US';
6
+ import zhCN from 'antd/lib/locale/zh_CN';
7
+ import antd5enUS from 'antd5/lib/locale/en_US';
8
+ import antd5zhCN from 'antd5/lib/locale/zh_CN';
9
+ import moment from 'moment';
10
+ import dayjs from 'dayjs';
4
11
 
5
12
  var __defProp = Object.defineProperty;
6
13
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -23,7 +30,30 @@ const ConfigProvider = ({
23
30
  antd4Configs,
24
31
  children
25
32
  }) => {
26
- return /* @__PURE__ */ React__default.createElement(ConfigProvider$1, __spreadValues({}, antd5Configs), /* @__PURE__ */ React__default.createElement(ConfigProvider$2, __spreadValues({}, antd4Configs), children));
33
+ const { i18n } = useParrotTranslation();
34
+ useEffect(() => {
35
+ const adjustDateLocale = (lng) => {
36
+ moment.locale(lng === "zh-CN" ? "zh-cn" : "en");
37
+ dayjs.locale(lng === "zh-CN" ? "zh-cn" : "en");
38
+ };
39
+ i18n.on("languageChanged", adjustDateLocale);
40
+ adjustDateLocale(i18n.language);
41
+ }, []);
42
+ return /* @__PURE__ */ React__default.createElement(
43
+ ConfigProvider$1,
44
+ __spreadValues({
45
+ autoInsertSpaceInButton: false,
46
+ locale: i18n.language === "zh-CN" ? antd5zhCN : antd5enUS
47
+ }, antd5Configs),
48
+ /* @__PURE__ */ React__default.createElement(
49
+ ConfigProvider$2,
50
+ __spreadValues({
51
+ autoInsertSpaceInButton: false,
52
+ locale: i18n.language === "zh-CN" ? zhCN : enUS
53
+ }, antd4Configs),
54
+ children
55
+ )
56
+ );
27
57
  };
28
58
 
29
59
  export { ConfigProvider };
@@ -10,6 +10,8 @@ import dayjs from 'dayjs';
10
10
  import React__default, { useState, useEffect, useRef } from 'react';
11
11
  import { getDiffMonthAndDate, getTime, checkDateNotInRange, getClassNameForDateBlock } from './common.js';
12
12
  import { CalendarStyle } from './DateRangePicker.style.js';
13
+ import { parrotI18n } from '@cloudtower/parrot';
14
+ import { getCalendarTitle } from '../common/getCalendarTitle.js';
13
15
 
14
16
  const Year = (props) => {
15
17
  const { year, onChange } = props;
@@ -78,7 +80,7 @@ const MonthItem = (props) => {
78
80
  onRangeChange,
79
81
  onMouseEnter
80
82
  } = props;
81
- const { t } = useParrotTranslation();
83
+ useParrotTranslation();
82
84
  const containerRef = useRef(null);
83
85
  const datesContainerRef = useRef(null);
84
86
  const headerRef = useRef(null);
@@ -129,8 +131,7 @@ const MonthItem = (props) => {
129
131
  className: cx(Typo.Label.l1_bold, isPinned && "pinned"),
130
132
  ref: headerRef
131
133
  },
132
- initMonth.month,
133
- t("common.month")
134
+ getCalendarTitle(initMonth.month.toString(), parrotI18n.t, parrotI18n)
134
135
  ), /* @__PURE__ */ React__default.createElement("div", { className: "dates-in-month", ref: datesContainerRef }, new Array(initMonth.firstDateOfDay).fill(null).map((value, index) => /* @__PURE__ */ React__default.createElement("span", { key: `blank-date-${index}`, className: "blank" })), initMonth.dates.map((date) => {
135
136
  const _date = getTime(initYear, initMonth.month, date);
136
137
  const dateNotIncludeInRange = checkDateNotInRange(