@oceanbase/ui 0.4.5 → 0.4.6

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.
@@ -8,9 +8,9 @@ export interface GroupProps {
8
8
  shouldVisible?: (key: string) => boolean;
9
9
  shouldDisabled?: (key: string) => boolean;
10
10
  enableLoading?: boolean;
11
- /** 更多操作的自定义展示 */
12
11
  moreText?: React.ReactNode;
12
+ moreType?: 'button' | 'link';
13
13
  buttonSize?: ButtonSize;
14
14
  }
15
- declare const _default: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, buttonSize, }: GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
15
+ declare const _default: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, moreType, buttonSize, }: GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
16
16
  export default _default;
@@ -36,6 +36,7 @@ export default (function (_ref2) {
36
36
  shouldDisabled = _ref2.shouldDisabled,
37
37
  enableLoading = _ref2.enableLoading,
38
38
  moreText = _ref2.moreText,
39
+ moreType = _ref2.moreType,
39
40
  buttonSize = _ref2.buttonSize;
40
41
  var visibleActions = Array.isArray(children) ? children.filter(function (c) {
41
42
  if (isBoolean(c.props.visible) && shouldVisible) return c.props.visible && shouldVisible(c.key);
@@ -57,19 +58,26 @@ export default (function (_ref2) {
57
58
  var ellipsisType = 'link';
58
59
 
59
60
  // @ts-ignore
60
- if (visibleActionsSort.every(function (action) {
61
+ if (visibleActionsSort.some(function (action) {
61
62
  return action.type.__DISPLAY_NAME === 'button';
62
63
  })) {
63
- ellipsisType = 'default';
64
+ ellipsisType = 'button';
64
65
  }
66
+
67
+ // @ts-ignore
68
+ if (visibleActionsSort.some(function (action) {
69
+ return action.type.__DISPLAY_NAME === 'link';
70
+ })) {
71
+ ellipsisType = 'link';
72
+ }
73
+ ellipsisType = moreType !== null && moreType !== void 0 ? moreType : ellipsisType;
65
74
  var getDefaultDisabled = function getDefaultDisabled(key) {
66
75
  var _shouldDisabled;
67
76
  return (_shouldDisabled = shouldDisabled === null || shouldDisabled === void 0 ? void 0 : shouldDisabled(key)) !== null && _shouldDisabled !== void 0 ? _shouldDisabled : false;
68
77
  };
69
78
  var moreDom;
70
- if (ellipsisType === 'default') {
79
+ if (ellipsisType === 'button') {
71
80
  moreDom = /*#__PURE__*/_jsx(Button, {
72
- type: ellipsisType,
73
81
  size: buttonSize,
74
82
  children: moreText !== null && moreText !== void 0 ? moreText : /*#__PURE__*/_jsx(EllipsisOutlined, {
75
83
  style: {
@@ -1,7 +1,7 @@
1
1
  import { ActionButton, ActionLink } from './Item';
2
2
  export type { GroupProps as ActionGroupProps } from './Group';
3
3
  declare const _default: {
4
- Group: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, buttonSize, }: import("./Group").GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
4
+ Group: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, moreType, buttonSize, }: import("./Group").GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
5
5
  Button: typeof ActionButton;
6
6
  Link: typeof ActionLink;
7
7
  };
@@ -30,7 +30,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
30
30
  import { jsxs as _jsxs } from "react/jsx-runtime";
31
31
  var prefix = getPrefix('date-ranger');
32
32
  var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
33
- var _selects$, _selects$find2, _selects$find3;
33
+ var _selects$;
34
34
  var _props$selects = props.selects,
35
35
  selects = _props$selects === void 0 ? [NEAR_1_MINUTES, NEAR_30_MINUTES, NEAR_1_HOURS, NEAR_3_HOURS, NEAR_6_HOURS, TODAY, LAST_3_DAYS] : _props$selects,
36
36
  value = props.value,
@@ -72,7 +72,8 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
72
72
  rest = _objectWithoutProperties(props, _excluded);
73
73
  var _theme$useToken = theme.useToken(),
74
74
  token = _theme$useToken.token;
75
- var isCn = locale.locale === 'zh_CN';
75
+ var isCn = locale.antLocale === 'zh-cn';
76
+ var isEN = locale.antLocale === 'en';
76
77
 
77
78
  // 是否为 moment 时间对象
78
79
  var isMoment = moment.isMoment(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue[0]) || moment.isMoment(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue[1]) || moment.isMoment(value === null || value === void 0 ? void 0 : value[0]) || moment.isMoment(value === null || value === void 0 ? void 0 : value[1]) || isMomentProps;
@@ -193,29 +194,21 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
193
194
  };
194
195
  var getCustomizeLabel = function getCustomizeLabel() {
195
196
  if (differenceYears > 0) {
196
- return "\u8FD1 ".concat(differenceYears, " \u5E74");
197
+ return isEN ? "Nearly ".concat(differenceYears, " years") : "\u8FD1 ".concat(differenceYears, " \u5E74");
197
198
  }
198
-
199
- // if (differenceQuarters > 0) {
200
- // return `近 ${differenceQuarters} 季度`;
201
- // }
202
-
203
199
  if (differenceMonths > 0) {
204
- return "\u8FD1 ".concat(differenceMonths, " \u6708");
200
+ return isEN ? "Nearly ".concat(differenceMonths, " months") : "\u8FD1 ".concat(differenceMonths, " \u6708");
205
201
  }
206
202
  if (differenceWeeks > 0) {
207
- return "\u8FD1 ".concat(differenceWeeks, " \u5468");
208
- }
209
- if (differenceDays > 0) {
210
- return "\u8FD1 ".concat(differenceDays, " \u5929");
203
+ return isEN ? "Nearly ".concat(differenceWeeks, " weeks") : "\u8FD1 ".concat(differenceWeeks, " \u5468");
211
204
  }
212
205
  if (differenceHours > 0) {
213
- return "\u8FD1 ".concat(differenceHours, " \u65F6");
206
+ return isEN ? "Nearly ".concat(differenceHours, " hours") : "\u8FD1 ".concat(differenceHours, " \u5C0F\u65F6");
214
207
  }
215
208
  if (differenceMinutes > 0) {
216
- return "\u8FD1 ".concat(differenceMinutes, " \u5206");
209
+ return isEN ? "Nearly ".concat(differenceMinutes, " minutes") : "\u8FD1 ".concat(differenceMinutes, " \u5206");
217
210
  }
218
- return "\u8FD1 ".concat(differenceSeconds, " \u79D2");
211
+ return isEN ? "Nearly ".concat(differenceSeconds, " seconds") : "\u8FD1 ".concat(differenceSeconds, " \u79D2");
219
212
  };
220
213
  var setNow = function setNow() {
221
214
  var selected = NEAR_TIME_LIST.find(function (item) {
@@ -234,12 +227,11 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
234
227
  updateCurrentTime: setNow
235
228
  };
236
229
  });
237
- var rangeLabel = rangeName === CUSTOMIZE ? getCustomizeRangeLabel() : (_selects$find2 = selects.find(function (_item) {
238
- return _item.name === rangeName;
239
- })) === null || _selects$find2 === void 0 ? void 0 : _selects$find2.rangeLabel;
240
- var label = rangeName === CUSTOMIZE ? getCustomizeLabel() : (_selects$find3 = selects.find(function (_item) {
230
+ var currentRange = selects.find(function (_item) {
241
231
  return _item.name === rangeName;
242
- })) === null || _selects$find3 === void 0 ? void 0 : _selects$find3.label;
232
+ });
233
+ var rangeLabel = rangeName === CUSTOMIZE ? getCustomizeRangeLabel() : currentRange === null || currentRange === void 0 ? void 0 : currentRange.rangeLabel;
234
+ var label = rangeName === CUSTOMIZE ? getCustomizeLabel() : isEN ? currentRange.enLabel || currentRange.label : currentRange.label;
243
235
  var thisYear = new Date().getFullYear();
244
236
  var isThisYear = (startTime === null || startTime === void 0 ? void 0 : startTime.year()) === thisYear && (endTime === null || endTime === void 0 ? void 0 : endTime.year()) === thisYear;
245
237
  var rangeNameIndex = findIndex(selects, function (item) {
@@ -341,7 +333,7 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
341
333
  children: [hasTagInPicker && /*#__PURE__*/_jsx("span", {
342
334
  className: "".concat(prefix, "-label"),
343
335
  children: item.rangeLabel
344
- }), locale[item.label] || item.label]
336
+ }), isEN ? item.enLabel || item.label : item.label]
345
337
  })
346
338
  };
347
339
  })
@@ -19,6 +19,7 @@ export var DATE_TIME_SECOND_FORMAT_CN = 'MM-DD HH:mm:ss';
19
19
  export var DATE_TIME_FORMAT_CN = 'MM-DD HH:mm';
20
20
  export var NEAR_1_MINUTES = {
21
21
  label: '近 1 分钟',
22
+ enLabel: 'Nearly 1 minute',
22
23
  rangeLabel: '1m',
23
24
  name: 'NEAR_1_MINUTES',
24
25
  range: function range() {
@@ -28,6 +29,7 @@ export var NEAR_1_MINUTES = {
28
29
  };
29
30
  export var NEAR_5_MINUTES = {
30
31
  label: '近 5 分钟',
32
+ enLabel: 'Nearly 5 minutes',
31
33
  rangeLabel: '5m',
32
34
  name: 'NEAR_5_MINUTES',
33
35
  range: function range() {
@@ -37,6 +39,7 @@ export var NEAR_5_MINUTES = {
37
39
  };
38
40
  export var NEAR_10_MINUTES = {
39
41
  label: '近 10 分钟',
42
+ enLabel: 'Nearly 10 minutes',
40
43
  rangeLabel: '10m',
41
44
  name: 'NEAR_10_MINUTES',
42
45
  range: function range() {
@@ -46,6 +49,7 @@ export var NEAR_10_MINUTES = {
46
49
  };
47
50
  export var NEAR_20_MINUTES = {
48
51
  label: '近 20 分钟',
52
+ enLabel: 'Nearly 20 minutes',
49
53
  rangeLabel: '20m',
50
54
  name: 'NEAR_20_MINUTES',
51
55
  range: function range() {
@@ -55,6 +59,7 @@ export var NEAR_20_MINUTES = {
55
59
  };
56
60
  export var NEAR_30_MINUTES = {
57
61
  label: '近 30 分钟',
62
+ enLabel: 'Nearly 30 minutes',
58
63
  rangeLabel: '30m',
59
64
  name: 'NEAR_30_MINUTES',
60
65
  range: function range() {
@@ -64,6 +69,7 @@ export var NEAR_30_MINUTES = {
64
69
  };
65
70
  export var NEAR_1_HOURS = {
66
71
  label: '近 1 小时',
72
+ enLabel: 'Nearly 1 hour',
67
73
  rangeLabel: '1h',
68
74
  name: 'NEAR_1_HOURS',
69
75
  range: function range() {
@@ -73,6 +79,7 @@ export var NEAR_1_HOURS = {
73
79
  };
74
80
  export var NEAR_2_HOURS = {
75
81
  label: '近 2 小时',
82
+ enLabel: 'Nearly 2 hours',
76
83
  rangeLabel: '2h',
77
84
  name: 'NEAR_2_HOURS',
78
85
  range: function range() {
@@ -82,6 +89,7 @@ export var NEAR_2_HOURS = {
82
89
  };
83
90
  export var NEAR_3_HOURS = {
84
91
  label: '近 3 小时',
92
+ enLabel: 'Nearly 3 hours',
85
93
  rangeLabel: '3h',
86
94
  name: 'NEAR_3_HOURS',
87
95
  range: function range() {
@@ -91,6 +99,7 @@ export var NEAR_3_HOURS = {
91
99
  };
92
100
  export var NEAR_6_HOURS = {
93
101
  label: '近 6 小时',
102
+ enLabel: 'Nearly 6 hours',
94
103
  rangeLabel: '6h',
95
104
  name: 'NEAR_6_HOURS',
96
105
  range: function range() {
@@ -100,6 +109,7 @@ export var NEAR_6_HOURS = {
100
109
  };
101
110
  export var TODAY = {
102
111
  label: '今天',
112
+ enLabel: 'Today',
103
113
  rangeLabel: '1d',
104
114
  name: 'TODAY',
105
115
  range: function range() {
@@ -109,6 +119,7 @@ export var TODAY = {
109
119
  };
110
120
  export var YESTERDAY = {
111
121
  label: '昨天',
122
+ enLabel: 'Yesterday',
112
123
  rangeLabel: '1d',
113
124
  name: 'YESTERDAY',
114
125
  range: function range() {
@@ -118,6 +129,7 @@ export var YESTERDAY = {
118
129
  };
119
130
  export var LAST_3_DAYS = {
120
131
  label: '近 3 天',
132
+ enLabel: 'Nearly 3 days',
121
133
  rangeLabel: '3d',
122
134
  name: 'LAST_3_DAYS',
123
135
  range: function range() {
@@ -127,6 +139,7 @@ export var LAST_3_DAYS = {
127
139
  };
128
140
  export var THIS_WEEK = {
129
141
  label: '近一周',
142
+ enLabel: 'Nearly a week',
130
143
  rangeLabel: '1w',
131
144
  name: 'THIS_WEEK',
132
145
  range: function range() {
@@ -136,6 +149,7 @@ export var THIS_WEEK = {
136
149
  };
137
150
  export var LAST_WEEK = {
138
151
  label: '上周',
152
+ enLabel: 'Last week',
139
153
  rangeLabel: 'last week',
140
154
  name: 'LAST_WEEK',
141
155
  range: function range() {
@@ -145,6 +159,7 @@ export var LAST_WEEK = {
145
159
  };
146
160
  export var THIS_MONTH = {
147
161
  label: '本月',
162
+ enLabel: 'This month',
148
163
  rangeLabel: '1mo',
149
164
  name: 'THIS_MONTH',
150
165
  range: function range() {
@@ -154,6 +169,7 @@ export var THIS_MONTH = {
154
169
  };
155
170
  export var LAST_MONTH = {
156
171
  label: '上月',
172
+ enLabel: 'Last month',
157
173
  rangeLabel: '1mo',
158
174
  name: 'LAST_MONTH',
159
175
  range: function range() {
@@ -163,6 +179,7 @@ export var LAST_MONTH = {
163
179
  };
164
180
  export var THIS_YEAR = {
165
181
  label: '今年',
182
+ enLabel: 'This year',
166
183
  rangeLabel: '1y',
167
184
  name: 'THIS_YEAR',
168
185
  range: function range() {
@@ -172,6 +189,7 @@ export var THIS_YEAR = {
172
189
  };
173
190
  export var LAST_YEAR = {
174
191
  label: '去年',
192
+ enLabel: 'Last year',
175
193
  rangeLabel: '1y',
176
194
  name: 'LAST_YEAR',
177
195
  range: function range() {
@@ -181,6 +199,7 @@ export var LAST_YEAR = {
181
199
  };
182
200
  export var NEXT_YEAR = {
183
201
  label: '明年',
202
+ enLabel: 'Next year',
184
203
  rangeLabel: '1y',
185
204
  name: 'NEXT_YEAR',
186
205
  range: function range() {
@@ -188,4 +207,4 @@ export var NEXT_YEAR = {
188
207
  return [current.clone().startOf(YEAR_UNIT).add(1, YEAR_UNIT), current.clone().endOf(YEAR_UNIT).add(1, YEAR_UNIT)];
189
208
  }
190
209
  };
191
- export var NEAR_TIME_LIST = [NEAR_1_MINUTES, NEAR_5_MINUTES, NEAR_10_MINUTES, NEAR_20_MINUTES, NEAR_30_MINUTES, NEAR_1_HOURS, NEAR_2_HOURS, NEAR_3_HOURS, NEAR_6_HOURS, LAST_3_DAYS, TODAY, YESTERDAY, THIS_MONTH, LAST_MONTH, THIS_YEAR, LAST_YEAR, NEXT_YEAR];
210
+ export var NEAR_TIME_LIST = [NEAR_1_MINUTES, NEAR_5_MINUTES, NEAR_10_MINUTES, NEAR_20_MINUTES, NEAR_30_MINUTES, NEAR_1_HOURS, NEAR_2_HOURS, NEAR_3_HOURS, NEAR_6_HOURS, LAST_3_DAYS, TODAY, YESTERDAY, THIS_WEEK, LAST_WEEK, THIS_MONTH, LAST_MONTH, THIS_YEAR, LAST_YEAR, NEXT_YEAR];
@@ -5,6 +5,10 @@ export interface RangeOption {
5
5
  * @description 选项展示名称
6
6
  */
7
7
  label: string;
8
+ /**
9
+ * @description 选项英文展示名称,用来兼容内部国际化,外部传入的选项直接对 label 做国际化即可
10
+ */
11
+ enLabel?: string;
8
12
  /**
9
13
  * @description 选项 key
10
14
  */
@@ -29,7 +29,7 @@ export declare const THEME_DARK = "dark";
29
29
  export declare const THEME_LIGHT = "light";
30
30
  declare const ThemeTypes: ["dark", "light"];
31
31
  export type ThemeType = (typeof ThemeTypes)[number];
32
- declare const supportedLanguages: ("go" | "ruby" | "css" | "javascript" | "typescript" | "groovy" | "java" | "python" | "bash" | "json" | "cpp" | "http" | "markdown" | "nginx" | "sql" | "xml" | "dockerfile" | "yaml" | "solidity" | "tsx" | "jsx")[];
32
+ declare const supportedLanguages: ("ruby" | "go" | "css" | "javascript" | "typescript" | "groovy" | "java" | "python" | "bash" | "json" | "cpp" | "http" | "markdown" | "nginx" | "sql" | "xml" | "dockerfile" | "yaml" | "solidity" | "tsx" | "jsx")[];
33
33
  export type LanguageType = (typeof supportedLanguages)[number] | 'html';
34
34
  export interface HighlightProps extends LocaleWrapperProps {
35
35
  /**
@@ -43,7 +43,10 @@ export default (function (_ref) {
43
43
  // @ts-ignore
44
44
  var antLocale = this.context.locale;
45
45
  var localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
46
- var localeData = _objectSpread(_objectSpread({}, defaultLocale), localeFromContext || {});
46
+ var localeData = _objectSpread(_objectSpread(_objectSpread({}, defaultLocale), localeFromContext || {}), {}, {
47
+ // 这里使用 antLocale,不能直接顶掉 locale 属性,有些组件内部会维护一个 locale 去做特殊判断
48
+ antLocale: (antLocale === null || antLocale === void 0 ? void 0 : antLocale.locale) || 'zh-cn'
49
+ });
47
50
  return (
48
51
  /*#__PURE__*/
49
52
  // @ts-ignore
@@ -8,9 +8,9 @@ export interface GroupProps {
8
8
  shouldVisible?: (key: string) => boolean;
9
9
  shouldDisabled?: (key: string) => boolean;
10
10
  enableLoading?: boolean;
11
- /** 更多操作的自定义展示 */
12
11
  moreText?: React.ReactNode;
12
+ moreType?: 'button' | 'link';
13
13
  buttonSize?: ButtonSize;
14
14
  }
15
- declare const _default: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, buttonSize, }: GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
15
+ declare const _default: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, moreType, buttonSize, }: GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
16
16
  export default _default;
@@ -55,6 +55,7 @@ var Group_default = ({
55
55
  shouldDisabled,
56
56
  enableLoading,
57
57
  moreText,
58
+ moreType,
58
59
  buttonSize
59
60
  }) => {
60
61
  const visibleActions = Array.isArray(children) ? children.filter((c) => {
@@ -79,13 +80,17 @@ var Group_default = ({
79
80
  const mainActions = visibleActionsSort.slice(0, realSize);
80
81
  const ellipsisActions = visibleActionsSort.slice(realSize);
81
82
  let ellipsisType = "link";
82
- if (visibleActionsSort.every((action) => action.type.__DISPLAY_NAME === "button")) {
83
- ellipsisType = "default";
83
+ if (visibleActionsSort.some((action) => action.type.__DISPLAY_NAME === "button")) {
84
+ ellipsisType = "button";
84
85
  }
86
+ if (visibleActionsSort.some((action) => action.type.__DISPLAY_NAME === "link")) {
87
+ ellipsisType = "link";
88
+ }
89
+ ellipsisType = moreType ?? ellipsisType;
85
90
  const getDefaultDisabled = (key) => (shouldDisabled == null ? void 0 : shouldDisabled(key)) ?? false;
86
91
  let moreDom;
87
- if (ellipsisType === "default") {
88
- moreDom = /* @__PURE__ */ import_react.default.createElement(import_design.Button, { type: ellipsisType, size: buttonSize }, moreText ?? /* @__PURE__ */ import_react.default.createElement(import_icons.EllipsisOutlined, { style: { cursor: "pointer" } }));
92
+ if (ellipsisType === "button") {
93
+ moreDom = /* @__PURE__ */ import_react.default.createElement(import_design.Button, { size: buttonSize }, moreText ?? /* @__PURE__ */ import_react.default.createElement(import_icons.EllipsisOutlined, { style: { cursor: "pointer" } }));
89
94
  } else {
90
95
  moreDom = /* @__PURE__ */ import_react.default.createElement(import_design.Typography.Link, null, moreText ?? /* @__PURE__ */ import_react.default.createElement(import_icons.EllipsisOutlined, { style: { cursor: "pointer" } }));
91
96
  }
@@ -1,7 +1,7 @@
1
1
  import { ActionButton, ActionLink } from './Item';
2
2
  export type { GroupProps as ActionGroupProps } from './Group';
3
3
  declare const _default: {
4
- Group: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, buttonSize, }: import("./Group").GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
4
+ Group: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, moreType, buttonSize, }: import("./Group").GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
5
5
  Button: typeof ActionButton;
6
6
  Link: typeof ActionLink;
7
7
  };
@@ -47,7 +47,7 @@ var import_zh_CN = __toESM(require("./locale/zh-CN"));
47
47
  var import_index = require("./index.less");
48
48
  var prefix = (0, import_util.getPrefix)("date-ranger");
49
49
  var Ranger = import_react.default.forwardRef((props, ref) => {
50
- var _a, _b, _c;
50
+ var _a;
51
51
  const {
52
52
  selects = [
53
53
  import_constant.NEAR_1_MINUTES,
@@ -85,7 +85,8 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
85
85
  ...rest
86
86
  } = props;
87
87
  const { token } = import_design.theme.useToken();
88
- const isCn = locale.locale === "zh_CN";
88
+ const isCn = locale.antLocale === "zh-cn";
89
+ const isEN = locale.antLocale === "en";
89
90
  const isMoment = import_moment.default.isMoment(defaultValue == null ? void 0 : defaultValue[0]) || import_moment.default.isMoment(defaultValue == null ? void 0 : defaultValue[1]) || import_moment.default.isMoment(value == null ? void 0 : value[0]) || import_moment.default.isMoment(value == null ? void 0 : value[1]) || isMomentProps;
90
91
  const defaultRangeName = value || defaultValue ? import_constant.CUSTOMIZE : defaultQuickValue ?? ((_a = selects == null ? void 0 : selects[0]) == null ? void 0 : _a.name);
91
92
  const [rangeName, setRangeName] = (0, import_react.useState)(defaultRangeName);
@@ -183,24 +184,21 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
183
184
  };
184
185
  const getCustomizeLabel = () => {
185
186
  if (differenceYears > 0) {
186
- return `近 ${differenceYears} 年`;
187
+ return isEN ? `Nearly ${differenceYears} years` : `近 ${differenceYears} 年`;
187
188
  }
188
189
  if (differenceMonths > 0) {
189
- return `近 ${differenceMonths} 月`;
190
+ return isEN ? `Nearly ${differenceMonths} months` : `近 ${differenceMonths} 月`;
190
191
  }
191
192
  if (differenceWeeks > 0) {
192
- return `近 ${differenceWeeks} 周`;
193
- }
194
- if (differenceDays > 0) {
195
- return `近 ${differenceDays} 天`;
193
+ return isEN ? `Nearly ${differenceWeeks} weeks` : `近 ${differenceWeeks} 周`;
196
194
  }
197
195
  if (differenceHours > 0) {
198
- return `近 ${differenceHours} 时`;
196
+ return isEN ? `Nearly ${differenceHours} hours` : `近 ${differenceHours} 小时`;
199
197
  }
200
198
  if (differenceMinutes > 0) {
201
- return `近 ${differenceMinutes} 分`;
199
+ return isEN ? `Nearly ${differenceMinutes} minutes` : `近 ${differenceMinutes} 分`;
202
200
  }
203
- return `近 ${differenceSeconds} 秒`;
201
+ return isEN ? `Nearly ${differenceSeconds} seconds` : `近 ${differenceSeconds} 秒`;
204
202
  };
205
203
  const setNow = () => {
206
204
  const selected = import_constant.NEAR_TIME_LIST.find((item) => item.name === rangeName);
@@ -215,8 +213,9 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
215
213
  (0, import_react.useImperativeHandle)(ref, () => ({
216
214
  updateCurrentTime: setNow
217
215
  }));
218
- const rangeLabel = rangeName === import_constant.CUSTOMIZE ? getCustomizeRangeLabel() : (_b = selects.find((_item) => _item.name === rangeName)) == null ? void 0 : _b.rangeLabel;
219
- const label = rangeName === import_constant.CUSTOMIZE ? getCustomizeLabel() : (_c = selects.find((_item) => _item.name === rangeName)) == null ? void 0 : _c.label;
216
+ const currentRange = selects.find((_item) => _item.name === rangeName);
217
+ const rangeLabel = rangeName === import_constant.CUSTOMIZE ? getCustomizeRangeLabel() : currentRange == null ? void 0 : currentRange.rangeLabel;
218
+ const label = rangeName === import_constant.CUSTOMIZE ? getCustomizeLabel() : isEN ? currentRange.enLabel || currentRange.label : currentRange.label;
220
219
  const thisYear = (/* @__PURE__ */ new Date()).getFullYear();
221
220
  const isThisYear = (startTime == null ? void 0 : startTime.year()) === thisYear && (endTime == null ? void 0 : endTime.year()) === thisYear;
222
221
  const rangeNameIndex = (0, import_lodash.findIndex)(selects, (item) => item.name === rangeName);
@@ -301,7 +300,7 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
301
300
  }).map((item) => {
302
301
  return {
303
302
  key: item.name,
304
- label: /* @__PURE__ */ import_react.default.createElement(import_design.Space, { size: 8, style: { minWidth: 100 } }, hasTagInPicker && /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefix}-label` }, item.rangeLabel), locale[item.label] || item.label)
303
+ label: /* @__PURE__ */ import_react.default.createElement(import_design.Space, { size: 8, style: { minWidth: 100 } }, hasTagInPicker && /* @__PURE__ */ import_react.default.createElement("span", { className: `${prefix}-label` }, item.rangeLabel), isEN ? item.enLabel || item.label : item.label)
305
304
  };
306
305
  })
307
306
  }
@@ -79,6 +79,7 @@ var DATE_TIME_SECOND_FORMAT_CN = "MM-DD HH:mm:ss";
79
79
  var DATE_TIME_FORMAT_CN = "MM-DD HH:mm";
80
80
  var NEAR_1_MINUTES = {
81
81
  label: "近 1 分钟",
82
+ enLabel: "Nearly 1 minute",
82
83
  rangeLabel: "1m",
83
84
  name: "NEAR_1_MINUTES",
84
85
  range: (current = (0, import_moment.default)()) => [
@@ -88,6 +89,7 @@ var NEAR_1_MINUTES = {
88
89
  };
89
90
  var NEAR_5_MINUTES = {
90
91
  label: "近 5 分钟",
92
+ enLabel: "Nearly 5 minutes",
91
93
  rangeLabel: "5m",
92
94
  name: "NEAR_5_MINUTES",
93
95
  range: (current = (0, import_moment.default)()) => [
@@ -97,6 +99,7 @@ var NEAR_5_MINUTES = {
97
99
  };
98
100
  var NEAR_10_MINUTES = {
99
101
  label: "近 10 分钟",
102
+ enLabel: "Nearly 10 minutes",
100
103
  rangeLabel: "10m",
101
104
  name: "NEAR_10_MINUTES",
102
105
  range: (current = (0, import_moment.default)()) => [
@@ -106,6 +109,7 @@ var NEAR_10_MINUTES = {
106
109
  };
107
110
  var NEAR_20_MINUTES = {
108
111
  label: "近 20 分钟",
112
+ enLabel: "Nearly 20 minutes",
109
113
  rangeLabel: "20m",
110
114
  name: "NEAR_20_MINUTES",
111
115
  range: (current = (0, import_moment.default)()) => [
@@ -115,6 +119,7 @@ var NEAR_20_MINUTES = {
115
119
  };
116
120
  var NEAR_30_MINUTES = {
117
121
  label: "近 30 分钟",
122
+ enLabel: "Nearly 30 minutes",
118
123
  rangeLabel: "30m",
119
124
  name: "NEAR_30_MINUTES",
120
125
  range: (current = (0, import_moment.default)()) => [
@@ -124,6 +129,7 @@ var NEAR_30_MINUTES = {
124
129
  };
125
130
  var NEAR_1_HOURS = {
126
131
  label: "近 1 小时",
132
+ enLabel: "Nearly 1 hour",
127
133
  rangeLabel: "1h",
128
134
  name: "NEAR_1_HOURS",
129
135
  range: (current = (0, import_moment.default)()) => [
@@ -133,6 +139,7 @@ var NEAR_1_HOURS = {
133
139
  };
134
140
  var NEAR_2_HOURS = {
135
141
  label: "近 2 小时",
142
+ enLabel: "Nearly 2 hours",
136
143
  rangeLabel: "2h",
137
144
  name: "NEAR_2_HOURS",
138
145
  range: (current = (0, import_moment.default)()) => [
@@ -142,6 +149,7 @@ var NEAR_2_HOURS = {
142
149
  };
143
150
  var NEAR_3_HOURS = {
144
151
  label: "近 3 小时",
152
+ enLabel: "Nearly 3 hours",
145
153
  rangeLabel: "3h",
146
154
  name: "NEAR_3_HOURS",
147
155
  range: (current = (0, import_moment.default)()) => [
@@ -151,6 +159,7 @@ var NEAR_3_HOURS = {
151
159
  };
152
160
  var NEAR_6_HOURS = {
153
161
  label: "近 6 小时",
162
+ enLabel: "Nearly 6 hours",
154
163
  rangeLabel: "6h",
155
164
  name: "NEAR_6_HOURS",
156
165
  range: (current = (0, import_moment.default)()) => [
@@ -160,6 +169,7 @@ var NEAR_6_HOURS = {
160
169
  };
161
170
  var TODAY = {
162
171
  label: "今天",
172
+ enLabel: "Today",
163
173
  rangeLabel: "1d",
164
174
  name: "TODAY",
165
175
  range: (current = (0, import_moment.default)()) => [
@@ -169,6 +179,7 @@ var TODAY = {
169
179
  };
170
180
  var YESTERDAY = {
171
181
  label: "昨天",
182
+ enLabel: "Yesterday",
172
183
  rangeLabel: "1d",
173
184
  name: "YESTERDAY",
174
185
  range: (current = (0, import_moment.default)()) => [
@@ -178,6 +189,7 @@ var YESTERDAY = {
178
189
  };
179
190
  var LAST_3_DAYS = {
180
191
  label: "近 3 天",
192
+ enLabel: "Nearly 3 days",
181
193
  rangeLabel: "3d",
182
194
  name: "LAST_3_DAYS",
183
195
  range: (current = (0, import_moment.default)()) => [
@@ -187,6 +199,7 @@ var LAST_3_DAYS = {
187
199
  };
188
200
  var THIS_WEEK = {
189
201
  label: "近一周",
202
+ enLabel: "Nearly a week",
190
203
  rangeLabel: "1w",
191
204
  name: "THIS_WEEK",
192
205
  range: (current = (0, import_moment.default)()) => [
@@ -196,6 +209,7 @@ var THIS_WEEK = {
196
209
  };
197
210
  var LAST_WEEK = {
198
211
  label: "上周",
212
+ enLabel: "Last week",
199
213
  rangeLabel: "last week",
200
214
  name: "LAST_WEEK",
201
215
  range: (current = (0, import_moment.default)()) => [
@@ -205,6 +219,7 @@ var LAST_WEEK = {
205
219
  };
206
220
  var THIS_MONTH = {
207
221
  label: "本月",
222
+ enLabel: "This month",
208
223
  rangeLabel: "1mo",
209
224
  name: "THIS_MONTH",
210
225
  range: (current = (0, import_moment.default)()) => [
@@ -214,6 +229,7 @@ var THIS_MONTH = {
214
229
  };
215
230
  var LAST_MONTH = {
216
231
  label: "上月",
232
+ enLabel: "Last month",
217
233
  rangeLabel: "1mo",
218
234
  name: "LAST_MONTH",
219
235
  range: (current = (0, import_moment.default)()) => [
@@ -223,6 +239,7 @@ var LAST_MONTH = {
223
239
  };
224
240
  var THIS_YEAR = {
225
241
  label: "今年",
242
+ enLabel: "This year",
226
243
  rangeLabel: "1y",
227
244
  name: "THIS_YEAR",
228
245
  range: (current = (0, import_moment.default)()) => [
@@ -232,6 +249,7 @@ var THIS_YEAR = {
232
249
  };
233
250
  var LAST_YEAR = {
234
251
  label: "去年",
252
+ enLabel: "Last year",
235
253
  rangeLabel: "1y",
236
254
  name: "LAST_YEAR",
237
255
  range: (current = (0, import_moment.default)()) => [
@@ -241,6 +259,7 @@ var LAST_YEAR = {
241
259
  };
242
260
  var NEXT_YEAR = {
243
261
  label: "明年",
262
+ enLabel: "Next year",
244
263
  rangeLabel: "1y",
245
264
  name: "NEXT_YEAR",
246
265
  range: (current = (0, import_moment.default)()) => [
@@ -261,6 +280,8 @@ var NEAR_TIME_LIST = [
261
280
  LAST_3_DAYS,
262
281
  TODAY,
263
282
  YESTERDAY,
283
+ THIS_WEEK,
284
+ LAST_WEEK,
264
285
  THIS_MONTH,
265
286
  LAST_MONTH,
266
287
  THIS_YEAR,
@@ -5,6 +5,10 @@ export interface RangeOption {
5
5
  * @description 选项展示名称
6
6
  */
7
7
  label: string;
8
+ /**
9
+ * @description 选项英文展示名称,用来兼容内部国际化,外部传入的选项直接对 label 做国际化即可
10
+ */
11
+ enLabel?: string;
8
12
  /**
9
13
  * @description 选项 key
10
14
  */
@@ -29,7 +29,7 @@ export declare const THEME_DARK = "dark";
29
29
  export declare const THEME_LIGHT = "light";
30
30
  declare const ThemeTypes: ["dark", "light"];
31
31
  export type ThemeType = (typeof ThemeTypes)[number];
32
- declare const supportedLanguages: ("go" | "ruby" | "css" | "javascript" | "typescript" | "groovy" | "java" | "python" | "bash" | "json" | "cpp" | "http" | "markdown" | "nginx" | "sql" | "xml" | "dockerfile" | "yaml" | "solidity" | "tsx" | "jsx")[];
32
+ declare const supportedLanguages: ("ruby" | "go" | "css" | "javascript" | "typescript" | "groovy" | "java" | "python" | "bash" | "json" | "cpp" | "http" | "markdown" | "nginx" | "sql" | "xml" | "dockerfile" | "yaml" | "solidity" | "tsx" | "jsx")[];
33
33
  export type LanguageType = (typeof supportedLanguages)[number] | 'html';
34
34
  export interface HighlightProps extends LocaleWrapperProps {
35
35
  /**
@@ -44,7 +44,9 @@ var LocaleWrapper_default = ({ componentName, defaultLocale }) => (BaseComponent
44
44
  const localeFromContext = componentName && antLocale ? antLocale[componentName] : {};
45
45
  const localeData = {
46
46
  ...defaultLocale,
47
- ...localeFromContext || {}
47
+ ...localeFromContext || {},
48
+ // 这里使用 antLocale,不能直接顶掉 locale 属性,有些组件内部会维护一个 locale 去做特殊判断
49
+ antLocale: (antLocale == null ? void 0 : antLocale.locale) || "zh-cn"
48
50
  };
49
51
  return (
50
52
  // @ts-ignore