@oceanbase/ui 0.4.19 → 0.4.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.
Files changed (136) hide show
  1. package/dist/ui.min.css +1 -1
  2. package/dist/ui.min.js +1 -1
  3. package/es/Action/Group.js +121 -15
  4. package/es/Action/style/index.js +8 -4
  5. package/es/BasicLayout/locale/ja-JP.d.ts +13 -0
  6. package/es/BasicLayout/locale/ja-JP.js +12 -0
  7. package/es/BatchOperationBar/locale/ja-JP.d.ts +7 -0
  8. package/es/BatchOperationBar/locale/ja-JP.js +6 -0
  9. package/es/Boundary/locale/ja-JP.d.ts +11 -0
  10. package/es/Boundary/locale/ja-JP.js +10 -0
  11. package/es/DateRanger/Ranger.d.ts +4 -0
  12. package/es/DateRanger/Ranger.js +158 -14
  13. package/es/DateRanger/constant/index.js +1 -1
  14. package/es/DateRanger/index.less +23 -0
  15. package/es/DateRanger/locale/ja-JP.d.ts +56 -0
  16. package/es/DateRanger/locale/ja-JP.js +20 -0
  17. package/es/Dialog/locale/ja-JP.d.ts +5 -0
  18. package/es/Dialog/locale/ja-JP.js +4 -0
  19. package/es/DocDialog/locale/ja-JP.d.ts +2 -0
  20. package/es/DocDialog/locale/ja-JP.js +1 -0
  21. package/es/FullscreenBox/locale/ja-JP.d.ts +2 -0
  22. package/es/FullscreenBox/locale/ja-JP.js +1 -0
  23. package/es/GraphToolbar/locale/ja-JP.d.ts +9 -0
  24. package/es/GraphToolbar/locale/ja-JP.js +8 -0
  25. package/es/Highlight/locale/ja-JP.d.ts +4 -0
  26. package/es/Highlight/locale/ja-JP.js +3 -0
  27. package/es/Login/locale/ja-JP.d.ts +28 -0
  28. package/es/Login/locale/ja-JP.js +27 -0
  29. package/es/PageContainer/locale/ja-JP.d.ts +4 -0
  30. package/es/PageContainer/locale/ja-JP.js +3 -0
  31. package/es/Password/locale/ja-JP.d.ts +13 -0
  32. package/es/Password/locale/ja-JP.js +12 -0
  33. package/es/ProTable/index.js +4 -1
  34. package/es/Ranger/locale/ja-JP.d.ts +28 -0
  35. package/es/Ranger/locale/ja-JP.js +29 -0
  36. package/es/SideTip/locale/ja-JP.d.ts +2 -0
  37. package/es/SideTip/locale/ja-JP.js +1 -0
  38. package/es/TaskGraph/locale/ja-JP.d.ts +13 -0
  39. package/es/TaskGraph/locale/ja-JP.js +12 -0
  40. package/es/Welcome/locale/ja-JP.d.ts +5 -0
  41. package/es/Welcome/locale/ja-JP.js +4 -0
  42. package/es/locale/ja-JP.d.ts +3 -0
  43. package/es/locale/ja-JP.js +42 -0
  44. package/lib/Action/Group.js +122 -46
  45. package/lib/Action/Item.js +14 -9
  46. package/lib/Action/style/index.js +16 -1
  47. package/lib/BackgroundTaskManager/RefreshMan.js +3 -12
  48. package/lib/BackgroundTaskManager/index.js +3 -12
  49. package/lib/BasicLayout/Header.js +120 -62
  50. package/lib/BasicLayout/index.js +166 -143
  51. package/lib/BasicLayout/locale/ja-JP.d.ts +13 -0
  52. package/lib/BasicLayout/locale/ja-JP.js +36 -0
  53. package/lib/BatchOperationBar/index.js +59 -44
  54. package/lib/BatchOperationBar/locale/ja-JP.d.ts +7 -0
  55. package/lib/BatchOperationBar/locale/ja-JP.js +30 -0
  56. package/lib/Boundary/Components/Code.js +11 -5
  57. package/lib/Boundary/Components/Exception.js +33 -23
  58. package/lib/Boundary/Components/Function.js +11 -5
  59. package/lib/Boundary/locale/ja-JP.d.ts +11 -0
  60. package/lib/Boundary/locale/ja-JP.js +34 -0
  61. package/lib/ContentWithIcon/index.js +30 -22
  62. package/lib/ContentWithQuestion/index.js +8 -3
  63. package/lib/DateRanger/PickerPanel.js +235 -217
  64. package/lib/DateRanger/Ranger.d.ts +4 -0
  65. package/lib/DateRanger/Ranger.js +396 -227
  66. package/lib/DateRanger/constant/index.js +1 -1
  67. package/lib/DateRanger/index.less +23 -0
  68. package/lib/DateRanger/locale/ja-JP.d.ts +56 -0
  69. package/lib/DateRanger/locale/ja-JP.js +49 -0
  70. package/lib/Dialog/Anchor.js +8 -5
  71. package/lib/Dialog/EventProxy.js +3 -12
  72. package/lib/Dialog/index.js +132 -108
  73. package/lib/Dialog/locale/ja-JP.d.ts +5 -0
  74. package/lib/Dialog/locale/ja-JP.js +28 -0
  75. package/lib/DocDialog/index.js +3 -2
  76. package/lib/DocDialog/locale/ja-JP.d.ts +2 -0
  77. package/lib/DocDialog/locale/ja-JP.js +25 -0
  78. package/lib/FooterToolbar/index.js +3 -2
  79. package/lib/FullscreenBox/index.js +16 -7
  80. package/lib/FullscreenBox/locale/ja-JP.d.ts +2 -0
  81. package/lib/FullscreenBox/locale/ja-JP.js +25 -0
  82. package/lib/GraphToolbar/index.js +70 -58
  83. package/lib/GraphToolbar/locale/ja-JP.d.ts +9 -0
  84. package/lib/GraphToolbar/locale/ja-JP.js +32 -0
  85. package/lib/Highlight/DiffView/DiffCells.js +17 -10
  86. package/lib/Highlight/DiffView/index.js +35 -31
  87. package/lib/Highlight/HighlightCell.js +13 -10
  88. package/lib/Highlight/JsonView.js +15 -14
  89. package/lib/Highlight/index.js +50 -45
  90. package/lib/Highlight/locale/ja-JP.d.ts +4 -0
  91. package/lib/Highlight/locale/ja-JP.js +27 -0
  92. package/lib/IconFont/index.js +2 -12
  93. package/lib/LightFilter/index.js +3 -2
  94. package/lib/LocaleDropdown/index.js +13 -20
  95. package/lib/Login/ActivateForm.js +53 -60
  96. package/lib/Login/LoginForm.js +118 -109
  97. package/lib/Login/RegisterForm.js +79 -86
  98. package/lib/Login/index.js +92 -64
  99. package/lib/Login/locale/ja-JP.d.ts +28 -0
  100. package/lib/Login/locale/ja-JP.js +51 -0
  101. package/lib/NavMenu/index.js +9 -8
  102. package/lib/PageContainer/ItemRender.js +5 -5
  103. package/lib/PageContainer/index.js +8 -4
  104. package/lib/PageContainer/locale/ja-JP.d.ts +4 -0
  105. package/lib/PageContainer/locale/ja-JP.js +27 -0
  106. package/lib/PageLoading/index.js +6 -16
  107. package/lib/Password/Content.js +38 -42
  108. package/lib/Password/index.js +83 -68
  109. package/lib/Password/locale/ja-JP.d.ts +13 -0
  110. package/lib/Password/locale/ja-JP.js +36 -0
  111. package/lib/ProCard/index.js +4 -3
  112. package/lib/ProTable/index.js +10 -5
  113. package/lib/Ranger/QuickPicker.js +24 -15
  114. package/lib/Ranger/Ranger.js +37 -34
  115. package/lib/Ranger/locale/ja-JP.d.ts +28 -0
  116. package/lib/Ranger/locale/ja-JP.js +53 -0
  117. package/lib/SideTip/Dragger.js +5 -4
  118. package/lib/SideTip/IconLoading.js +25 -25
  119. package/lib/SideTip/index.js +19 -10
  120. package/lib/SideTip/locale/ja-JP.d.ts +2 -0
  121. package/lib/SideTip/locale/ja-JP.js +25 -0
  122. package/lib/TagSelect/Group.js +9 -5
  123. package/lib/TagSelect/Item.js +22 -18
  124. package/lib/TaskGraph/Graph.js +29 -24
  125. package/lib/TaskGraph/index.js +56 -50
  126. package/lib/TaskGraph/locale/ja-JP.d.ts +13 -0
  127. package/lib/TaskGraph/locale/ja-JP.js +36 -0
  128. package/lib/TreeSearch/index.js +30 -35
  129. package/lib/Welcome/index.js +64 -37
  130. package/lib/Welcome/locale/ja-JP.d.ts +5 -0
  131. package/lib/Welcome/locale/ja-JP.js +28 -0
  132. package/lib/Welcome/step.js +11 -4
  133. package/lib/locale/LocaleWrapper.js +15 -14
  134. package/lib/locale/ja-JP.d.ts +3 -0
  135. package/lib/locale/ja-JP.js +71 -0
  136. package/package.json +5 -5
@@ -46,6 +46,9 @@ var import_PickerPanel = __toESM(require("./PickerPanel"));
46
46
  var import_zh_CN = __toESM(require("./locale/zh-CN"));
47
47
  var import_index = require("./index.less");
48
48
  var import_ahooks = require("ahooks");
49
+ var import_util2 = require("@oceanbase/util");
50
+ var import_jsx_runtime = require("react/jsx-runtime");
51
+ var DefaultMaxHistoryCapacity = 20;
49
52
  var prefix = (0, import_util.getPrefix)("date-ranger");
50
53
  var Ranger = import_react.default.forwardRef((props, ref) => {
51
54
  var _a;
@@ -73,6 +76,7 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
73
76
  hideYear = false,
74
77
  hideSecond = false,
75
78
  autoCalcRange = false,
79
+ history: historyProp = false,
76
80
  onChange = import_lodash.noop,
77
81
  disabledDate,
78
82
  locale,
@@ -106,10 +110,47 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
106
110
  const [open, setOpen] = (0, import_react.useState)(false);
107
111
  const [tooltipOpen, setTooltipOpen] = (0, import_react.useState)(false);
108
112
  const [backRadioFocused, setBackRadioFocused] = (0, import_react.useState)(false);
113
+ const [historyMenuVisible, setHistoryMenuVisible] = (0, import_react.useState)(false);
109
114
  const rangeRef = (0, import_react.useRef)(null);
110
115
  const popRef = (0, import_react.useRef)(null);
111
116
  const labelRef = (0, import_react.useRef)(null);
112
117
  const [isPlay, setIsPlay] = (0, import_react.useState)(rangeName !== import_constant.CUSTOMIZE);
118
+ const history = (0, import_react.useMemo)(() => {
119
+ if (historyProp) {
120
+ return {
121
+ capacity: typeof historyProp === "object" ? historyProp.capacity : DefaultMaxHistoryCapacity
122
+ };
123
+ }
124
+ return false;
125
+ }, [historyProp]);
126
+ const [rangeHistory, setRangeHistory] = (0, import_util2.useLocalStorageState)(
127
+ "ob-design-date-ranger-local-storage-range-history-state",
128
+ { defaultValue: [], listenStorageChange: true }
129
+ );
130
+ const updateRangeHistory = (range) => {
131
+ if (!range) {
132
+ return;
133
+ }
134
+ if (range.length < 2 || !history) {
135
+ return;
136
+ }
137
+ const formattedValue = [
138
+ range[0].format(import_constant.YEAR_DATE_TIME_SECOND_FORMAT_CN),
139
+ range[1].format(import_constant.YEAR_DATE_TIME_SECOND_FORMAT_CN)
140
+ ];
141
+ if (rangeHistory.find((item) => (0, import_lodash.isEqual)(item, formattedValue))) {
142
+ return;
143
+ }
144
+ const updatedValue = [formattedValue, ...rangeHistory];
145
+ if (updatedValue.length > history.capacity) {
146
+ updatedValue.splice(0, history.capacity);
147
+ }
148
+ setRangeHistory(updatedValue);
149
+ };
150
+ const delRangeHistory = (range) => {
151
+ const updatedValue = rangeHistory.filter((item) => !(0, import_lodash.isEqual)(item, range));
152
+ setRangeHistory(updatedValue);
153
+ };
113
154
  const compare = (m1, m2) => {
114
155
  if (Array.isArray(m1) && !Array.isArray(m2))
115
156
  return false;
@@ -151,6 +192,7 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
151
192
  const rangeChange = (range) => {
152
193
  setInnerValue(range);
153
194
  onChange(range);
195
+ updateRangeHistory(range);
154
196
  };
155
197
  const datePickerChange = (range) => {
156
198
  rangeChange(range);
@@ -212,6 +254,9 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
212
254
  }
213
255
  return isEN ? `Nearly ${differenceSeconds} seconds` : `近 ${differenceSeconds} 秒`;
214
256
  };
257
+ const getHistoryTitle = () => {
258
+ return isEN ? "History records" : "历史记录";
259
+ };
215
260
  const setNow = () => {
216
261
  const selected = selects.find((item) => item.name === rangeName);
217
262
  if (selected == null ? void 0 : selected.range) {
@@ -236,7 +281,7 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
236
281
  const diffMs = e.diff(s);
237
282
  return diffMs > differenceMs;
238
283
  }) : selects[rangeNameIndex + 1];
239
- return /* @__PURE__ */ import_react.default.createElement(
284
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
240
285
  import_design.Space,
241
286
  {
242
287
  className: (0, import_classnames.default)(rest.className, {
@@ -244,244 +289,368 @@ var Ranger = import_react.default.forwardRef((props, ref) => {
244
289
  [`${prefix}-show-range`]: true,
245
290
  [`${prefix}-back-radio-focused`]: backRadioFocused
246
291
  }),
247
- style: rest.style
248
- },
249
- /* @__PURE__ */ import_react.default.createElement(import_design.Space, { size: 0 }, /* @__PURE__ */ import_react.default.createElement(
250
- "div",
251
- {
252
- className: (0, import_classnames.default)(`${prefix}-wrapper`, {
253
- [`${prefix}-wrapper-has-jumper`]: hasRewind || hasForward
254
- })
255
- },
256
- /* @__PURE__ */ import_react.default.createElement(
257
- import_design.Dropdown,
258
- {
259
- trigger: ["click"],
260
- open,
261
- placement: rest.placement,
262
- autoAdjustOverflow,
263
- getPopupContainer,
264
- destroyOnHidden: true,
265
- onOpenChange: (o) => {
266
- if (o === false && tooltipOpen) {
267
- return;
268
- }
269
- setOpen(o);
270
- },
271
- popupRender: (originNode) => {
272
- return /* @__PURE__ */ import_react.default.createElement(
273
- "div",
274
- {
275
- ref: popRef,
276
- className: (0, import_classnames.default)(`${prefix}-dropdown-picker`, overlayClassName),
277
- style: overlayStyle
278
- },
279
- originNode,
280
- /* @__PURE__ */ import_react.default.createElement(import_design.Divider, { type: "vertical", style: { height: "auto", margin: "0px 4px 0px 0px" } }),
281
- /* @__PURE__ */ import_react.default.createElement(
282
- import_PickerPanel.default,
283
- {
284
- defaultValue: innerValue || [],
285
- locale,
286
- disabledDate: pastOnly ? disabledFuture : disabledDate,
287
- tip,
288
- isMoment,
289
- rules,
290
- hideSecond,
291
- onOk: (vList) => {
292
- setIsPlay(false);
293
- handleNameChange(import_constant.CUSTOMIZE);
294
- rangeChange(
295
- vList.map((v) => {
296
- return isMoment ? (0, import_moment.default)(v) : (0, import_dayjs.default)(v);
292
+ style: rest.style,
293
+ children: [
294
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design.Space, { size: 0, children: [
295
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
296
+ "div",
297
+ {
298
+ className: (0, import_classnames.default)(`${prefix}-wrapper`, {
299
+ [`${prefix}-wrapper-has-jumper`]: hasRewind || hasForward
300
+ }),
301
+ children: [
302
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
303
+ import_design.Dropdown,
304
+ {
305
+ trigger: ["click"],
306
+ open,
307
+ placement: rest.placement,
308
+ autoAdjustOverflow,
309
+ getPopupContainer,
310
+ destroyOnHidden: true,
311
+ onOpenChange: (o) => {
312
+ if (o === false && tooltipOpen) {
313
+ return;
314
+ }
315
+ setOpen(o);
316
+ },
317
+ popupRender: (originNode) => {
318
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
319
+ "div",
320
+ {
321
+ ref: popRef,
322
+ className: (0, import_classnames.default)(`${prefix}-dropdown-picker`, overlayClassName),
323
+ style: overlayStyle,
324
+ children: [
325
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design.Flex, { vertical: true, justify: "space-between", children: [
326
+ !historyMenuVisible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "options", children: originNode }),
327
+ history && historyMenuVisible && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "history", children: [
328
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
329
+ import_design.Button,
330
+ {
331
+ type: "link",
332
+ style: { paddingLeft: 8, color: token.colorTextBase },
333
+ onClick: (e) => {
334
+ setHistoryMenuVisible(false);
335
+ e.stopPropagation();
336
+ },
337
+ children: [
338
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowLeftOutlined, { color: token.colorTextLabel }),
339
+ getHistoryTitle()
340
+ ]
341
+ }
342
+ ),
343
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
344
+ import_design.Menu,
345
+ {
346
+ onClick: ({ key: rangeString }) => {
347
+ const vList = rangeString.split(",").map((v) => v.trim());
348
+ rangeChange(
349
+ vList.map((v) => {
350
+ return isMoment ? (0, import_moment.default)(v) : (0, import_dayjs.default)(v);
351
+ })
352
+ );
353
+ handleNameChange(import_constant.CUSTOMIZE);
354
+ },
355
+ style: { maxHeight: 480, overflowY: "auto" },
356
+ items: rangeHistory.map((range) => {
357
+ return {
358
+ key: String(range),
359
+ label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
360
+ import_design.Flex,
361
+ {
362
+ className: `${prefix}-history-menu-item`,
363
+ vertical: true,
364
+ children: [
365
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
366
+ (isMoment ? (0, import_moment.default)(range[0]) : (0, import_dayjs.default)(range[0])).format(
367
+ import_constant.YEAR_DATE_TIME_SECOND_FORMAT_CN
368
+ ),
369
+ "~"
370
+ ] }),
371
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: (isMoment ? (0, import_moment.default)(range[1]) : (0, import_dayjs.default)(range[1])).format(
372
+ import_constant.YEAR_DATE_TIME_SECOND_FORMAT_CN
373
+ ) }),
374
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design.Space, { className: `${prefix}-menu-text-btn-wrapper`, children: [
375
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
376
+ import_design.Button,
377
+ {
378
+ className: `${prefix}-menu-text-btn`,
379
+ type: "text",
380
+ color: "default",
381
+ variant: "filled",
382
+ size: "small",
383
+ onClick: (e) => {
384
+ e.stopPropagation();
385
+ const vList = range.map((v) => v);
386
+ const text = `${vList.join("~")}`;
387
+ navigator.clipboard.writeText(text);
388
+ import_design.message.success(text);
389
+ },
390
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CopyOutlined, {})
391
+ }
392
+ ),
393
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
394
+ import_design.Button,
395
+ {
396
+ className: `${prefix}-menu-text-btn`,
397
+ type: "text",
398
+ color: "default",
399
+ variant: "filled",
400
+ size: "small",
401
+ onClick: (e) => {
402
+ e.stopPropagation();
403
+ delRangeHistory(range);
404
+ },
405
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.DeleteOutlined, {})
406
+ }
407
+ )
408
+ ] })
409
+ ]
410
+ },
411
+ String(range)
412
+ )
413
+ };
414
+ })
415
+ }
416
+ )
417
+ ] }),
418
+ history && !historyMenuVisible && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
419
+ import_design.Button,
420
+ {
421
+ type: "link",
422
+ style: { width: "max-content" },
423
+ onClick: (e) => {
424
+ setHistoryMenuVisible(true);
425
+ e.stopPropagation();
426
+ },
427
+ children: [
428
+ getHistoryTitle(),
429
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.RightOutlined, {})
430
+ ]
431
+ }
432
+ )
433
+ ] }),
434
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_design.Divider, { type: "vertical", style: { height: "auto", margin: "0px 4px 0px 0px" } }),
435
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
436
+ import_PickerPanel.default,
437
+ {
438
+ defaultValue: innerValue || [],
439
+ locale,
440
+ disabledDate: pastOnly ? disabledFuture : disabledDate,
441
+ tip,
442
+ isMoment,
443
+ rules,
444
+ hideSecond,
445
+ onOk: (vList) => {
446
+ setIsPlay(false);
447
+ handleNameChange(import_constant.CUSTOMIZE);
448
+ rangeChange(
449
+ vList.map((v) => {
450
+ return isMoment ? (0, import_moment.default)(v) : (0, import_dayjs.default)(v);
451
+ })
452
+ );
453
+ closeTooltip();
454
+ },
455
+ onCancel: () => {
456
+ closeTooltip();
457
+ }
458
+ }
459
+ )
460
+ ]
461
+ }
462
+ );
463
+ },
464
+ menu: {
465
+ selectable: true,
466
+ defaultSelectedKeys: [rangeName],
467
+ onClick: ({ key, domEvent }) => {
468
+ const selected = selects.find((_item) => _item.name === key);
469
+ if (selected == null ? void 0 : selected.range) {
470
+ handleNameChange(key);
471
+ setIsPlay(true);
472
+ rangeChange(selected.range(isMoment ? (0, import_moment.default)() : (0, import_dayjs.default)()));
473
+ }
474
+ },
475
+ items: selects.filter((item) => {
476
+ return !!item;
477
+ }).map((item) => {
478
+ return {
479
+ key: item.name,
480
+ label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_design.Space, { size: 8, style: { minWidth: 100 }, children: [
481
+ hasTagInPicker && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefix}-label`, children: item.rangeLabel }),
482
+ isEN ? item.enLabel || item.label : item.label
483
+ ] })
484
+ };
297
485
  })
298
- );
299
- closeTooltip();
300
- },
301
- onCancel: () => {
302
- closeTooltip();
486
+ },
487
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
488
+ import_design.Space,
489
+ {
490
+ ref: labelRef,
491
+ size: 0,
492
+ onClick: () => {
493
+ setOpen(true);
494
+ setTooltipOpen(true);
495
+ },
496
+ children: [
497
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
498
+ "span",
499
+ {
500
+ className: `${prefix}-label`,
501
+ style: {
502
+ marginLeft: 8
503
+ },
504
+ children: rangeLabel
505
+ }
506
+ ),
507
+ simpleMode && isPlay && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${prefix}-play`, children: label })
508
+ ]
509
+ }
510
+ )
303
511
  }
304
- }
305
- )
306
- );
307
- },
308
- menu: {
309
- selectable: true,
310
- defaultSelectedKeys: [rangeName],
311
- onClick: ({ key, domEvent }) => {
312
- const selected = selects.find((_item) => _item.name === key);
313
- if (selected == null ? void 0 : selected.range) {
314
- handleNameChange(key);
315
- setIsPlay(true);
316
- rangeChange(selected.range(isMoment ? (0, import_moment.default)() : (0, import_dayjs.default)()));
317
- }
318
- },
319
- items: selects.filter((item) => {
320
- return !!item;
321
- }).map((item) => {
322
- return {
323
- key: item.name,
324
- 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)
325
- };
326
- })
327
- }
328
- },
329
- /* @__PURE__ */ import_react.default.createElement(
330
- import_design.Space,
331
- {
332
- ref: labelRef,
333
- size: 0,
334
- onClick: () => {
335
- setOpen(true);
336
- setTooltipOpen(true);
512
+ ),
513
+ (!simpleMode || !isPlay) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
514
+ "span",
515
+ {
516
+ ref: rangeRef,
517
+ onClick: () => {
518
+ setOpen(true);
519
+ setTooltipOpen(true);
520
+ },
521
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
522
+ import_design.DatePicker.RangePicker,
523
+ {
524
+ className: (0, import_classnames.default)(`${prefix}-picker`),
525
+ style: {
526
+ // pointerEvents: 'none',
527
+ border: 0
528
+ },
529
+ format: (v) => {
530
+ if (hideYear && isThisYear) {
531
+ return hideSecond ? v.format(isCn ? import_constant.DATE_TIME_FORMAT_CN : import_constant.DATE_TIME_FORMAT) : v.format(isCn ? import_constant.DATE_TIME_SECOND_FORMAT_CN : import_constant.DATE_TIME_SECOND_FORMAT);
532
+ }
533
+ return hideSecond ? v.format(isCn ? import_constant.YEAR_DATE_TIME_FORMAT_CN : import_constant.YEAR_DATE_TIME_FORMAT) : v.format(
534
+ isCn ? import_constant.YEAR_DATE_TIME_SECOND_FORMAT_CN : import_constant.YEAR_DATE_TIME_SECOND_FORMAT
535
+ );
536
+ },
537
+ value: innerValue,
538
+ onChange: datePickerChange,
539
+ allowClear: false,
540
+ size,
541
+ suffixIcon: null,
542
+ ...(0, import_lodash.omit)(rest, "value", "onChange", "style", "className"),
543
+ open: false
544
+ }
545
+ )
546
+ }
547
+ )
548
+ ]
337
549
  }
338
- },
339
- /* @__PURE__ */ import_react.default.createElement(
340
- "span",
341
- {
342
- className: `${prefix}-label`,
343
- style: {
344
- marginLeft: 8
345
- }
346
- },
347
- rangeLabel
348
550
  ),
349
- simpleMode && isPlay && /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}-play` }, label)
350
- )
351
- ),
352
- (!simpleMode || !isPlay) && /* @__PURE__ */ import_react.default.createElement(
353
- "span",
354
- {
355
- ref: rangeRef,
356
- onClick: () => {
357
- setOpen(true);
358
- setTooltipOpen(true);
359
- }
360
- },
361
- /* @__PURE__ */ import_react.default.createElement(
362
- import_design.DatePicker.RangePicker,
551
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
552
+ import_design.Radio.Group,
553
+ {
554
+ value: isPlay ? "play" : "",
555
+ className: `${prefix}-playback-control`,
556
+ buttonStyle: "solid",
557
+ children: [
558
+ hasRewind && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
559
+ import_design.Tooltip,
560
+ {
561
+ title: locale.jumpBack,
562
+ getPopupContainer: (trigger) => trigger.parentNode,
563
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
564
+ import_design.Radio.Button,
565
+ {
566
+ value: "stepBack",
567
+ style: {
568
+ paddingInline: 8,
569
+ borderInlineStart: 0,
570
+ borderTopLeftRadius: 0,
571
+ borderBottomLeftRadius: 0
572
+ },
573
+ onMouseEnter: () => setBackRadioFocused(true),
574
+ onMouseLeave: () => setBackRadioFocused(false),
575
+ onClick: () => {
576
+ if (isPlay) {
577
+ setIsPlay(false);
578
+ }
579
+ if (startTime && endTime) {
580
+ const newStartTime = startTime.clone().subtract(differenceMs, "milliseconds");
581
+ const newEndTime = startTime == null ? void 0 : startTime.clone();
582
+ rangeChange([newStartTime, newEndTime]);
583
+ }
584
+ },
585
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.LeftOutlined, {})
586
+ }
587
+ )
588
+ }
589
+ ),
590
+ hasForward && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
591
+ import_design.Tooltip,
592
+ {
593
+ title: locale.jumpForward,
594
+ getPopupContainer: (trigger) => trigger.parentNode,
595
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
596
+ import_design.Radio.Button,
597
+ {
598
+ value: "stepForward",
599
+ style: {
600
+ paddingInline: 8,
601
+ borderInlineStart: 0,
602
+ borderTopLeftRadius: 0,
603
+ borderBottomLeftRadius: 0
604
+ },
605
+ onClick: () => {
606
+ if (startTime && endTime) {
607
+ const newStartTime = endTime.clone();
608
+ const newEndTime = endTime.clone().add(differenceMs);
609
+ if (newEndTime.isBefore(/* @__PURE__ */ new Date())) {
610
+ rangeChange([newStartTime, newEndTime]);
611
+ } else {
612
+ setIsPlay(true);
613
+ setNow();
614
+ }
615
+ }
616
+ },
617
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.RightOutlined, {})
618
+ }
619
+ )
620
+ }
621
+ )
622
+ ]
623
+ }
624
+ )
625
+ ] }),
626
+ hasSync && rangeName !== import_constant.CUSTOMIZE && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
627
+ import_design.Button,
363
628
  {
364
- className: (0, import_classnames.default)(`${prefix}-picker`),
365
- style: {
366
- // pointerEvents: 'none',
367
- border: 0
368
- },
369
- format: (v) => {
370
- if (hideYear && isThisYear) {
371
- return hideSecond ? v.format(isCn ? import_constant.DATE_TIME_FORMAT_CN : import_constant.DATE_TIME_FORMAT) : v.format(isCn ? import_constant.DATE_TIME_SECOND_FORMAT_CN : import_constant.DATE_TIME_SECOND_FORMAT);
372
- }
373
- return hideSecond ? v.format(isCn ? import_constant.YEAR_DATE_TIME_FORMAT_CN : import_constant.YEAR_DATE_TIME_FORMAT) : v.format(
374
- isCn ? import_constant.YEAR_DATE_TIME_SECOND_FORMAT_CN : import_constant.YEAR_DATE_TIME_SECOND_FORMAT
375
- );
629
+ style: { paddingInline: 8, color: token.colorTextSecondary },
630
+ onClick: () => {
631
+ setNow();
376
632
  },
377
- value: innerValue,
378
- onChange: datePickerChange,
379
- allowClear: false,
380
- size,
381
- suffixIcon: null,
382
- ...(0, import_lodash.omit)(rest, "value", "onChange", "style", "className"),
383
- open: false
633
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.SyncOutlined, {})
384
634
  }
385
- )
386
- )
387
- ), /* @__PURE__ */ import_react.default.createElement(
388
- import_design.Radio.Group,
389
- {
390
- value: isPlay ? "play" : "",
391
- className: `${prefix}-playback-control`,
392
- buttonStyle: "solid"
393
- },
394
- hasRewind && /* @__PURE__ */ import_react.default.createElement(
395
- import_design.Tooltip,
396
- {
397
- title: locale.jumpBack,
398
- getPopupContainer: (trigger) => trigger.parentNode
399
- },
400
- /* @__PURE__ */ import_react.default.createElement(
401
- import_design.Radio.Button,
635
+ ),
636
+ hasZoomOut && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
637
+ import_design.Button,
402
638
  {
403
- value: "stepBack",
404
- style: {
405
- paddingInline: 8,
406
- borderInlineStart: 0,
407
- borderTopLeftRadius: 0,
408
- borderBottomLeftRadius: 0
409
- },
410
- onMouseEnter: () => setBackRadioFocused(true),
411
- onMouseLeave: () => setBackRadioFocused(false),
639
+ disabled: !nextRangeItem,
640
+ style: { color: token.colorTextSecondary },
412
641
  onClick: () => {
413
- if (isPlay) {
414
- setIsPlay(false);
642
+ setIsPlay(true);
643
+ if (nextRangeItem) {
644
+ setRangeName(nextRangeItem.name);
645
+ rangeChange(nextRangeItem.range(isMoment ? (0, import_moment.default)() : (0, import_dayjs.default)()));
646
+ return;
415
647
  }
416
- if (startTime && endTime) {
417
- const newStartTime = startTime.clone().subtract(differenceMs, "milliseconds");
418
- const newEndTime = startTime == null ? void 0 : startTime.clone();
419
- rangeChange([newStartTime, newEndTime]);
420
- }
421
- }
422
- },
423
- /* @__PURE__ */ import_react.default.createElement(import_icons.LeftOutlined, null)
424
- )
425
- ),
426
- hasForward && /* @__PURE__ */ import_react.default.createElement(
427
- import_design.Tooltip,
428
- {
429
- title: locale.jumpForward,
430
- getPopupContainer: (trigger) => trigger.parentNode
431
- },
432
- /* @__PURE__ */ import_react.default.createElement(
433
- import_design.Radio.Button,
434
- {
435
- value: "stepForward",
436
- style: {
437
- paddingInline: 8,
438
- borderInlineStart: 0,
439
- borderTopLeftRadius: 0,
440
- borderBottomLeftRadius: 0
441
648
  },
442
- onClick: () => {
443
- if (startTime && endTime) {
444
- const newStartTime = endTime.clone();
445
- const newEndTime = endTime.clone().add(differenceMs);
446
- if (newEndTime.isBefore(/* @__PURE__ */ new Date())) {
447
- rangeChange([newStartTime, newEndTime]);
448
- } else {
449
- setIsPlay(true);
450
- setNow();
451
- }
452
- }
453
- }
454
- },
455
- /* @__PURE__ */ import_react.default.createElement(import_icons.RightOutlined, null)
456
- )
457
- )
458
- )),
459
- hasSync && rangeName !== import_constant.CUSTOMIZE && /* @__PURE__ */ import_react.default.createElement(
460
- import_design.Button,
461
- {
462
- style: { paddingInline: 8, color: token.colorTextSecondary },
463
- onClick: () => {
464
- setNow();
465
- }
466
- },
467
- /* @__PURE__ */ import_react.default.createElement(import_icons.SyncOutlined, null)
468
- ),
469
- hasZoomOut && /* @__PURE__ */ import_react.default.createElement(
470
- import_design.Button,
471
- {
472
- disabled: !nextRangeItem,
473
- style: { color: token.colorTextSecondary },
474
- onClick: () => {
475
- setIsPlay(true);
476
- if (nextRangeItem) {
477
- setRangeName(nextRangeItem.name);
478
- rangeChange(nextRangeItem.range(isMoment ? (0, import_moment.default)() : (0, import_dayjs.default)()));
479
- return;
649
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ZoomOutOutlined, {})
480
650
  }
481
- },
482
- icon: /* @__PURE__ */ import_react.default.createElement(import_icons.ZoomOutOutlined, null)
483
- }
484
- )
651
+ )
652
+ ]
653
+ }
485
654
  );
486
655
  });
487
656
  var Ranger_default = (0, import_LocaleWrapper.default)({