@oceanbase/ui 0.4.6 → 0.4.7

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 (53) hide show
  1. package/dist/ui.min.css +1 -1
  2. package/dist/ui.min.js +1 -1
  3. package/es/Action/Group.d.ts +3 -2
  4. package/es/Action/Group.js +18 -12
  5. package/es/Action/Item.d.ts +1 -1
  6. package/es/Action/index.d.ts +2 -1
  7. package/es/Action/style/index.d.ts +9 -0
  8. package/es/Action/style/index.js +43 -0
  9. package/es/DateRanger/PickerPanel.d.ts +4 -6
  10. package/es/DateRanger/PickerPanel.js +42 -29
  11. package/es/DateRanger/Ranger.d.ts +4 -3
  12. package/es/DateRanger/Ranger.js +6 -4
  13. package/es/DateRanger/constant/index.d.ts +6 -2
  14. package/es/DateRanger/constant/index.js +35 -13
  15. package/es/DateRanger/index.d.ts +24 -1
  16. package/es/DateRanger/index.js +24 -23
  17. package/es/DateRanger/index.less +16 -1
  18. package/es/DateRanger/locale/en-US.js +7 -7
  19. package/es/Highlight/index.d.ts +1 -1
  20. package/es/ProCard/index.d.ts +5 -0
  21. package/es/ProCard/index.js +52 -0
  22. package/es/ProCard/style/index.d.ts +9 -0
  23. package/es/ProCard/style/index.js +40 -0
  24. package/es/TagSelect/style/index.d.ts +3 -2
  25. package/es/_util/genComponentStyleHook.js +1 -1
  26. package/es/index.d.ts +2 -0
  27. package/es/index.js +1 -0
  28. package/lib/Action/Group.d.ts +3 -2
  29. package/lib/Action/Group.js +56 -43
  30. package/lib/Action/Item.d.ts +1 -1
  31. package/lib/Action/index.d.ts +2 -1
  32. package/lib/Action/style/index.d.ts +9 -0
  33. package/lib/Action/style/index.js +78 -0
  34. package/lib/DateRanger/PickerPanel.d.ts +4 -6
  35. package/lib/DateRanger/PickerPanel.js +67 -29
  36. package/lib/DateRanger/Ranger.d.ts +4 -3
  37. package/lib/DateRanger/Ranger.js +4 -3
  38. package/lib/DateRanger/constant/index.d.ts +6 -2
  39. package/lib/DateRanger/constant/index.js +44 -12
  40. package/lib/DateRanger/index.d.ts +24 -1
  41. package/lib/DateRanger/index.js +23 -20
  42. package/lib/DateRanger/index.less +16 -1
  43. package/lib/DateRanger/locale/en-US.js +7 -7
  44. package/lib/Highlight/index.d.ts +1 -1
  45. package/lib/ProCard/index.d.ts +5 -0
  46. package/lib/ProCard/index.js +88 -0
  47. package/lib/ProCard/style/index.d.ts +9 -0
  48. package/lib/ProCard/style/index.js +92 -0
  49. package/lib/TagSelect/style/index.d.ts +3 -2
  50. package/lib/_util/genComponentStyleHook.js +1 -1
  51. package/lib/index.d.ts +2 -0
  52. package/lib/index.js +3 -0
  53. package/package.json +9 -9
@@ -1,7 +1,8 @@
1
- import type { ButtonSize } from '@oceanbase/design/es/button';
2
1
  import React from 'react';
2
+ import type { ButtonSize } from '@oceanbase/design/es/button';
3
3
  import type { BaseProps } from './Item';
4
4
  export interface GroupProps {
5
+ prefixCls?: string;
5
6
  size?: number;
6
7
  dropDownPlacement?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
7
8
  children: React.ReactElement<BaseProps> | React.ReactElement<BaseProps>[];
@@ -12,5 +13,5 @@ export interface GroupProps {
12
13
  moreType?: 'button' | 'link';
13
14
  buttonSize?: ButtonSize;
14
15
  }
15
- declare const _default: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, moreType, buttonSize, }: GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
16
+ declare const _default: ({ prefixCls: customizePrefixCls, size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, moreType, buttonSize, }: GroupProps) => React.JSX.Element;
16
17
  export default _default;
@@ -4,10 +4,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { Button, Dropdown, Menu, Space, Tooltip, Typography } from '@oceanbase/design';
7
+ import React, { useContext } from 'react';
8
+ import { Button, Dropdown, Menu, Space, Tooltip, Typography, ConfigProvider } from '@oceanbase/design';
8
9
  import { EllipsisOutlined, LoadingOutlined } from '@oceanbase/icons';
9
10
  import { isBoolean, max, omit } from 'lodash';
10
- import React from 'react';
11
+ import useStyle from "./style";
11
12
  import { jsx as _jsx } from "react/jsx-runtime";
12
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
14
  var getOrder = function getOrder(_ref) {
@@ -28,7 +29,8 @@ var getOrder = function getOrder(_ref) {
28
29
  return order;
29
30
  };
30
31
  export default (function (_ref2) {
31
- var _ref2$size = _ref2.size,
32
+ var customizePrefixCls = _ref2.prefixCls,
33
+ _ref2$size = _ref2.size,
32
34
  size = _ref2$size === void 0 ? 3 : _ref2$size,
33
35
  children = _ref2.children,
34
36
  dropDownPlacement = _ref2.dropDownPlacement,
@@ -38,6 +40,11 @@ export default (function (_ref2) {
38
40
  moreText = _ref2.moreText,
39
41
  moreType = _ref2.moreType,
40
42
  buttonSize = _ref2.buttonSize;
43
+ var _useContext = useContext(ConfigProvider.ConfigContext),
44
+ getPrefixCls = _useContext.getPrefixCls;
45
+ var prefixCls = getPrefixCls('action', customizePrefixCls);
46
+ var _useStyle = useStyle(prefixCls),
47
+ wrapSSR = _useStyle.wrapSSR;
41
48
  var visibleActions = Array.isArray(children) ? children.filter(function (c) {
42
49
  if (isBoolean(c.props.visible) && shouldVisible) return c.props.visible && shouldVisible(c.key);
43
50
  if (isBoolean(c.props.visible)) return c.props.visible;else if (shouldVisible) return shouldVisible(c.key);
@@ -79,11 +86,12 @@ export default (function (_ref2) {
79
86
  if (ellipsisType === 'button') {
80
87
  moreDom = /*#__PURE__*/_jsx(Button, {
81
88
  size: buttonSize,
82
- children: moreText !== null && moreText !== void 0 ? moreText : /*#__PURE__*/_jsx(EllipsisOutlined, {
89
+ icon: moreText ? undefined : /*#__PURE__*/_jsx(EllipsisOutlined, {
83
90
  style: {
84
91
  cursor: 'pointer'
85
92
  }
86
- })
93
+ }),
94
+ children: moreText
87
95
  });
88
96
  } else {
89
97
  moreDom = /*#__PURE__*/_jsx(Typography.Link, {
@@ -94,8 +102,8 @@ export default (function (_ref2) {
94
102
  })
95
103
  });
96
104
  }
97
- return /*#__PURE__*/_jsxs(Space, {
98
- size: 8,
105
+ return wrapSSR( /*#__PURE__*/_jsxs(Space, {
106
+ size: ellipsisType === 'button' ? 8 : 16,
99
107
  children: [mainActions.map(function (action) {
100
108
  return /*#__PURE__*/React.cloneElement(action, _objectSpread(_objectSpread({
101
109
  // size should be covered by action props
@@ -108,6 +116,7 @@ export default (function (_ref2) {
108
116
  }), ellipsisActions.length > 0 && /*#__PURE__*/_jsx(Dropdown, {
109
117
  placement: dropDownPlacement,
110
118
  overlay: /*#__PURE__*/_jsx(Menu, {
119
+ className: "".concat(prefixCls, "-more-menu"),
111
120
  children: ellipsisActions.map(function (action, index) {
112
121
  var _ref3;
113
122
  var actionKey = action.key;
@@ -124,15 +133,12 @@ export default (function (_ref2) {
124
133
  var _action$props$onClick, _action$props;
125
134
  var domEvent = _ref4.domEvent;
126
135
  (_action$props$onClick = (_action$props = action.props).onClick) === null || _action$props$onClick === void 0 || _action$props$onClick.call(_action$props, domEvent);
127
- },
128
- style: {
129
- minWidth: 120
130
136
  }
131
137
  }, omit(action.props, 'disabled')), {}, {
132
138
  disabled: actionDisabled,
133
139
  children: /*#__PURE__*/_jsxs(Tooltip, {
134
140
  title: action.props.tooltip,
135
- children: [action.props.loading && /*#__PURE__*/_jsx(LoadingOutlined, {}), " ", action.props.children]
141
+ children: [action.props.loading && /*#__PURE__*/_jsx(LoadingOutlined, {}), ' ', action.props.children || action]
136
142
  })
137
143
  }), (_ref3 = actionKey) !== null && _ref3 !== void 0 ? _ref3 : index.toString())
138
144
  );
@@ -140,5 +146,5 @@ export default (function (_ref2) {
140
146
  }),
141
147
  children: moreDom
142
148
  })]
143
- });
149
+ }));
144
150
  });
@@ -6,7 +6,7 @@ export interface BaseProps extends ButtonProps {
6
6
  /** 固定展示、不会被折叠 */
7
7
  fixed?: boolean;
8
8
  onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void> | void;
9
- children?: React.ReactElement | string;
9
+ children?: React.ReactElement | React.ReactNode | string;
10
10
  enableLoading?: boolean;
11
11
  tooltip?: string;
12
12
  loading?: boolean;
@@ -1,7 +1,8 @@
1
+ /// <reference types="react" />
1
2
  import { ActionButton, ActionLink } from './Item';
2
3
  export type { GroupProps as ActionGroupProps } from './Group';
3
4
  declare const _default: {
4
- Group: ({ size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, moreType, buttonSize, }: import("./Group").GroupProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
5
+ Group: ({ prefixCls: customizePrefixCls, size, children, dropDownPlacement, shouldVisible, shouldDisabled, enableLoading, moreText, moreType, buttonSize, }: import("./Group").GroupProps) => import("react").JSX.Element;
5
6
  Button: typeof ActionButton;
6
7
  Link: typeof ActionLink;
7
8
  };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { GenerateStyle } from '@oceanbase/design/es/theme';
3
+ import type { OBToken } from '../../_util/genComponentStyleHook';
4
+ export declare const genActionStyle: GenerateStyle<OBToken>;
5
+ declare const _default: (prefixCls: string) => {
6
+ wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
7
+ hashId: string;
8
+ };
9
+ export default _default;
@@ -0,0 +1,43 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
6
+ export var genActionStyle = function genActionStyle(token) {
7
+ var componentCls = token.componentCls,
8
+ antCls = token.antCls;
9
+ var paddingVertical = (token.controlHeight - token.fontSize * token.lineHeight) / 2;
10
+ var paddingHorizontal = token.paddingSM;
11
+ var padding = "".concat(paddingVertical, "px ").concat(paddingHorizontal, "px");
12
+ var margin = "-".concat(paddingVertical, "px -").concat(paddingHorizontal, "px");
13
+ return _defineProperty({}, "".concat(componentCls, "-more-menu"), _defineProperty({
14
+ background: 'red'
15
+ }, "".concat(antCls, "-dropdown-menu-item"), _defineProperty(_defineProperty({}, "".concat(antCls, "-typography"), _defineProperty({
16
+ display: 'block',
17
+ margin: margin,
18
+ padding: "".concat(padding, " !important")
19
+ }, "&:not(".concat(antCls, "-typography-disabled)"), {
20
+ color: token.colorText
21
+ })), "".concat(antCls, "-btn"), _defineProperty(_defineProperty({
22
+ padding: padding,
23
+ margin: margin,
24
+ border: 'none',
25
+ display: 'block',
26
+ width: "calc(100% + ".concat(paddingHorizontal * 2, "px)"),
27
+ textAlign: 'left',
28
+ height: 'inherit',
29
+ background: 'transparent'
30
+ }, "&:not(:disabled):not(".concat(antCls, "-btn-disabled)"), _defineProperty({
31
+ color: token.colorText
32
+ }, "&:hover", {
33
+ background: 'transparent'
34
+ })), "".concat(antCls, "-wave"), {
35
+ display: 'none'
36
+ }))));
37
+ };
38
+ export default (function (prefixCls) {
39
+ var useStyle = genComponentStyleHook('Action', function (token) {
40
+ return [genActionStyle(token)];
41
+ });
42
+ return useStyle(prefixCls);
43
+ });
@@ -1,18 +1,16 @@
1
- import type { Dayjs } from 'dayjs';
2
- import type { Moment } from 'moment';
3
- type RangeValue = [Moment, Moment] | [Dayjs, Dayjs];
1
+ import type { RangeValue } from './Ranger';
4
2
  type ValidateTrigger = 'submit' | 'valueChange';
5
3
  type MaybeArray<T> = T | T[];
6
- type ErrorType = 'endDate' | 'startDate' | 'endTime' | 'startTime';
4
+ type ErrorType = 'endDate' | 'startDate' | 'endTime' | 'startTime' | 'all';
7
5
  export type Rule = {
8
6
  message: string;
9
- validate: (value: string) => MaybeArray<ErrorType>;
7
+ validator: (value: [string, string] | []) => MaybeArray<ErrorType> | null | undefined;
10
8
  };
11
9
  export interface PickerPanelProps {
12
10
  value?: RangeValue;
13
11
  defaultValue?: RangeValue;
14
12
  tip?: string;
15
- require?: boolean;
13
+ required?: boolean;
16
14
  rules?: Rule[];
17
15
  validateTrigger?: ValidateTrigger;
18
16
  onCancel: () => void;
@@ -20,21 +20,21 @@ import { noop } from 'lodash';
20
20
  import moment from 'moment';
21
21
  import dayjs from 'dayjs';
22
22
  import { getPrefix } from "../_util";
23
+ import { DATE_TIME_MONTH_FORMAT, DATE_TIME_MONTH_FORMAT_CN } from "./constant";
23
24
  import { jsx as _jsx } from "react/jsx-runtime";
24
25
  import { jsxs as _jsxs } from "react/jsx-runtime";
26
+ var ALL_ERROR_TYPE_LIST = ['endDate', 'startDate', 'endTime', 'startTime'];
25
27
  var prefix = getPrefix('ranger-picker-panel');
26
28
  var prefixCls = 'ant-picker';
27
- var DATE_FORMAT = 'YYYY-MM-DD';
28
29
  var TIME_FORMAT = 'HH:mm:ss';
29
30
  var InternalPickerPanel = function InternalPickerPanel(props) {
30
- var _props$defaultValue = props.defaultValue,
31
- defaultValue = _props$defaultValue === void 0 ? [] : _props$defaultValue,
31
+ var defaultValue = props.defaultValue,
32
32
  isMoment = props.isMoment,
33
33
  locale = props.locale,
34
34
  tip = props.tip,
35
35
  rules = props.rules,
36
- _props$require = props.require,
37
- require = _props$require === void 0 ? true : _props$require,
36
+ _props$required = props.required,
37
+ required = _props$required === void 0 ? true : _props$required,
38
38
  _props$onOk = props.onOk,
39
39
  onOk = _props$onOk === void 0 ? noop : _props$onOk,
40
40
  _props$onCancel = props.onCancel,
@@ -61,6 +61,10 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
61
61
  _React$useState6 = _slicedToArray(_React$useState5, 2),
62
62
  activeIndex = _React$useState6[0],
63
63
  setActiveIndex = _React$useState6[1];
64
+ var isEn = (locale === null || locale === void 0 ? void 0 : locale.antLocale) === 'en';
65
+
66
+ //
67
+ var DATE_FORMAT = isEn ? DATE_TIME_MONTH_FORMAT : DATE_TIME_MONTH_FORMAT_CN;
64
68
  var getDateInstance = useCallback(function (v, format, strict) {
65
69
  return isMoment ? moment(v, format, strict) : dayjs(v, format, strict);
66
70
  }, [isMoment]);
@@ -247,6 +251,9 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
247
251
  style: {
248
252
  marginBottom: 8
249
253
  },
254
+ rules: [{
255
+ required: true
256
+ }],
250
257
  children: /*#__PURE__*/_jsx(Input, {
251
258
  size: "middle",
252
259
  onBlur: function onBlur(e) {
@@ -283,6 +290,9 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
283
290
  },
284
291
  validateStatus: errorTypeMap['startTime'],
285
292
  initialValue: defaultS || defaultTime,
293
+ rules: [{
294
+ required: true
295
+ }],
286
296
  children: /*#__PURE__*/_jsx(TimePicker, {
287
297
  allowClear: false,
288
298
  suffixIcon: null,
@@ -316,6 +326,9 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
316
326
  marginBottom: 0
317
327
  },
318
328
  validateStatus: errorTypeMap['endDate'],
329
+ rules: [{
330
+ required: true
331
+ }],
319
332
  children: /*#__PURE__*/_jsx(Input, {
320
333
  onBlur: function onBlur(e) {
321
334
  var v = validateInputDate(e);
@@ -351,6 +364,9 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
351
364
  },
352
365
  validateStatus: errorTypeMap['endTime'],
353
366
  initialValue: defaultE || defaultTime,
367
+ rules: [{
368
+ required: true
369
+ }],
354
370
  children: /*#__PURE__*/_jsx(TimePicker, {
355
371
  allowClear: false,
356
372
  suffixIcon: null,
@@ -448,30 +464,27 @@ var InternalPickerPanel = function InternalPickerPanel(props) {
448
464
  endTime = values.endTime;
449
465
  var start = "".concat(startDate, " ").concat(startTime.format(TIME_FORMAT));
450
466
  var end = "".concat(endDate, " ").concat(endTime.format(TIME_FORMAT));
451
- onOk([start, end]);
452
-
453
- // let errorList = [];
454
- // let message = '';
455
- // rules?.some(item => {
456
- // if (typeof item?.validator === 'function') {
457
- // const errorType = item.validator(start, end);
458
- // if (errorType) {
459
- // errorList = toArray(errorType);
460
- // message = item.message;
461
- // return true;
462
- // }
463
- // }
464
- // return false;
465
- // });
466
-
467
- // if (errorList.length > 0) {
468
- // setErrorTypeList(errorList);
469
- // setErrorMessage(message);
470
- // } else {
471
- // setErrorMessage('');
472
- // setErrorTypeList([]);
473
- // onOk([start, end]);
474
- // }
467
+ var errorList = [];
468
+ var message = '';
469
+ rules === null || rules === void 0 || rules.some(function (item) {
470
+ if (typeof (item === null || item === void 0 ? void 0 : item.validator) === 'function') {
471
+ var errorType = item.validator([start, end]);
472
+ if (errorType) {
473
+ errorList = Array.isArray(errorType) ? errorType : [errorType];
474
+ message = item.message;
475
+ return true;
476
+ }
477
+ }
478
+ return false;
479
+ });
480
+ if (errorList.length > 0) {
481
+ setErrorTypeList(errorList.includes('all') ? ALL_ERROR_TYPE_LIST : errorList);
482
+ setErrorMessage(message);
483
+ } else {
484
+ setErrorMessage('');
485
+ setErrorTypeList([]);
486
+ onOk([start, end]);
487
+ }
475
488
  });
476
489
  },
477
490
  children: locale.confirm
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { TooltipProps } from '@oceanbase/design';
2
3
  import type { RangePickerProps } from '@oceanbase/design/es/date-picker';
3
4
  import type { Dayjs } from 'dayjs';
@@ -6,7 +7,7 @@ import type { RangeOption } from './typing';
6
7
  import type { Rule } from './PickerPanel';
7
8
  import './index.less';
8
9
  export type RangeName = 'customize' | string;
9
- export type RangeValue = [Moment, Moment] | [Dayjs, Dayjs];
10
+ export type RangeValue = [Moment, Moment] | [Dayjs, Dayjs] | [] | null;
10
11
  export type RangeDateValue = {
11
12
  name: RangeName;
12
13
  range: RangeValue;
@@ -34,7 +35,7 @@ export interface DateRangerProps extends Omit<RangePickerProps, 'mode' | 'picker
34
35
  defaultValue?: RangeValue;
35
36
  size?: 'small' | 'large' | 'middle';
36
37
  tooltipProps?: TooltipProps;
37
- locale: any;
38
+ locale?: any;
38
39
  }
39
- declare const _default: any;
40
+ declare const _default: React.ForwardRefExoticComponent<DateRangerProps & React.RefAttributes<unknown>>;
40
41
  export default _default;
@@ -277,7 +277,7 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
277
277
  margin: '0px 4px 0px 0px'
278
278
  }
279
279
  }), /*#__PURE__*/_jsx(InternalPickerPanel, {
280
- defaultValue: innerValue
280
+ defaultValue: innerValue || []
281
281
  // @ts-ignore
282
282
  ,
283
283
  locale: locale,
@@ -355,10 +355,10 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
355
355
  onClick: function onClick() {
356
356
  setOpen(true);
357
357
  },
358
- children: /*#__PURE__*/_jsx(DatePicker.RangePicker, _objectSpread({
358
+ children: /*#__PURE__*/_jsx(DatePicker.RangePicker, _objectSpread(_objectSpread({
359
359
  className: classNames("".concat(prefix, "-picker")),
360
360
  style: {
361
- pointerEvents: 'none',
361
+ // pointerEvents: 'none',
362
362
  border: 0
363
363
  },
364
364
  format: function format(v) {
@@ -376,7 +376,9 @@ var Ranger = /*#__PURE__*/React.forwardRef(function (props, ref) {
376
376
  size: size,
377
377
  suffixIcon: null
378
378
  // 透传 props 到 antd Ranger
379
- }, omit(rest, 'value', 'onChange')))
379
+ }, omit(rest, 'value', 'onChange')), {}, {
380
+ open: false
381
+ }))
380
382
  })]
381
383
  }), /*#__PURE__*/_jsxs(Radio.Group, {
382
384
  value: isPlay ? 'play' : '',
@@ -1,11 +1,13 @@
1
1
  import type { RangeOption } from '../typing';
2
2
  export declare const CUSTOMIZE = "customize";
3
- export declare const YEAR_DATE_TIME_SECOND_FORMAT = "YYYY/MM/DD HH:mm:ss";
4
- export declare const YEAR_DATE_TIME_FORMAT = "YYYY/MM/DD HH:mm";
3
+ export declare const YEAR_DATE_TIME_SECOND_FORMAT = "MM/DD/YYYY HH:mm:ss";
4
+ export declare const YEAR_DATE_TIME_FORMAT = "MM/DD/YYYY HH:mm";
5
5
  export declare const DATE_TIME_SECOND_FORMAT = "MM/DD HH:mm:ss";
6
6
  export declare const DATE_TIME_FORMAT = "MM/DD HH:mm";
7
+ export declare const DATE_TIME_MONTH_FORMAT = "MM/DD/YYYY";
7
8
  export declare const YEAR_DATE_TIME_SECOND_FORMAT_CN = "YYYY-MM-DD HH:mm:ss";
8
9
  export declare const YEAR_DATE_TIME_FORMAT_CN = "YYYY-MM-DD HH:mm";
10
+ export declare const DATE_TIME_MONTH_FORMAT_CN = "YYYY-MM-DD";
9
11
  export declare const DATE_TIME_SECOND_FORMAT_CN = "MM-DD HH:mm:ss";
10
12
  export declare const DATE_TIME_FORMAT_CN = "MM-DD HH:mm";
11
13
  export declare const NEAR_1_MINUTES: RangeOption;
@@ -17,8 +19,10 @@ export declare const NEAR_1_HOURS: RangeOption;
17
19
  export declare const NEAR_2_HOURS: RangeOption;
18
20
  export declare const NEAR_3_HOURS: RangeOption;
19
21
  export declare const NEAR_6_HOURS: RangeOption;
22
+ export declare const NEAR_12_HOURS: RangeOption;
20
23
  export declare const TODAY: RangeOption;
21
24
  export declare const YESTERDAY: RangeOption;
25
+ export declare const LAST_1_DAY: RangeOption;
22
26
  export declare const LAST_3_DAYS: RangeOption;
23
27
  export declare const THIS_WEEK: RangeOption;
24
28
  export declare const LAST_WEEK: RangeOption;
@@ -9,17 +9,19 @@ var DAY_UNIT = 'day';
9
9
  var WEEK_UNIT = 'week';
10
10
  var MONTH_UNIT = 'month';
11
11
  var YEAR_UNIT = 'year';
12
- export var YEAR_DATE_TIME_SECOND_FORMAT = 'YYYY/MM/DD HH:mm:ss';
13
- export var YEAR_DATE_TIME_FORMAT = 'YYYY/MM/DD HH:mm';
12
+ export var YEAR_DATE_TIME_SECOND_FORMAT = 'MM/DD/YYYY HH:mm:ss';
13
+ export var YEAR_DATE_TIME_FORMAT = 'MM/DD/YYYY HH:mm';
14
14
  export var DATE_TIME_SECOND_FORMAT = 'MM/DD HH:mm:ss';
15
15
  export var DATE_TIME_FORMAT = 'MM/DD HH:mm';
16
+ export var DATE_TIME_MONTH_FORMAT = 'MM/DD/YYYY';
16
17
  export var YEAR_DATE_TIME_SECOND_FORMAT_CN = 'YYYY-MM-DD HH:mm:ss';
17
18
  export var YEAR_DATE_TIME_FORMAT_CN = 'YYYY-MM-DD HH:mm';
19
+ export var DATE_TIME_MONTH_FORMAT_CN = 'YYYY-MM-DD';
18
20
  export var DATE_TIME_SECOND_FORMAT_CN = 'MM-DD HH:mm:ss';
19
21
  export var DATE_TIME_FORMAT_CN = 'MM-DD HH:mm';
20
22
  export var NEAR_1_MINUTES = {
21
23
  label: '近 1 分钟',
22
- enLabel: 'Nearly 1 minute',
24
+ enLabel: 'Last 1 Minute',
23
25
  rangeLabel: '1m',
24
26
  name: 'NEAR_1_MINUTES',
25
27
  range: function range() {
@@ -29,7 +31,7 @@ export var NEAR_1_MINUTES = {
29
31
  };
30
32
  export var NEAR_5_MINUTES = {
31
33
  label: '近 5 分钟',
32
- enLabel: 'Nearly 5 minutes',
34
+ enLabel: 'Last 5 Minutes',
33
35
  rangeLabel: '5m',
34
36
  name: 'NEAR_5_MINUTES',
35
37
  range: function range() {
@@ -39,7 +41,7 @@ export var NEAR_5_MINUTES = {
39
41
  };
40
42
  export var NEAR_10_MINUTES = {
41
43
  label: '近 10 分钟',
42
- enLabel: 'Nearly 10 minutes',
44
+ enLabel: 'Last 10 Minutes',
43
45
  rangeLabel: '10m',
44
46
  name: 'NEAR_10_MINUTES',
45
47
  range: function range() {
@@ -49,7 +51,7 @@ export var NEAR_10_MINUTES = {
49
51
  };
50
52
  export var NEAR_20_MINUTES = {
51
53
  label: '近 20 分钟',
52
- enLabel: 'Nearly 20 minutes',
54
+ enLabel: 'Last 20 Minutes',
53
55
  rangeLabel: '20m',
54
56
  name: 'NEAR_20_MINUTES',
55
57
  range: function range() {
@@ -59,7 +61,7 @@ export var NEAR_20_MINUTES = {
59
61
  };
60
62
  export var NEAR_30_MINUTES = {
61
63
  label: '近 30 分钟',
62
- enLabel: 'Nearly 30 minutes',
64
+ enLabel: 'Last 30 Minutes',
63
65
  rangeLabel: '30m',
64
66
  name: 'NEAR_30_MINUTES',
65
67
  range: function range() {
@@ -69,7 +71,7 @@ export var NEAR_30_MINUTES = {
69
71
  };
70
72
  export var NEAR_1_HOURS = {
71
73
  label: '近 1 小时',
72
- enLabel: 'Nearly 1 hour',
74
+ enLabel: 'Last 1 Hour',
73
75
  rangeLabel: '1h',
74
76
  name: 'NEAR_1_HOURS',
75
77
  range: function range() {
@@ -79,7 +81,7 @@ export var NEAR_1_HOURS = {
79
81
  };
80
82
  export var NEAR_2_HOURS = {
81
83
  label: '近 2 小时',
82
- enLabel: 'Nearly 2 hours',
84
+ enLabel: 'Last 2 Hours',
83
85
  rangeLabel: '2h',
84
86
  name: 'NEAR_2_HOURS',
85
87
  range: function range() {
@@ -89,7 +91,7 @@ export var NEAR_2_HOURS = {
89
91
  };
90
92
  export var NEAR_3_HOURS = {
91
93
  label: '近 3 小时',
92
- enLabel: 'Nearly 3 hours',
94
+ enLabel: 'Last 3 Hours',
93
95
  rangeLabel: '3h',
94
96
  name: 'NEAR_3_HOURS',
95
97
  range: function range() {
@@ -99,7 +101,7 @@ export var NEAR_3_HOURS = {
99
101
  };
100
102
  export var NEAR_6_HOURS = {
101
103
  label: '近 6 小时',
102
- enLabel: 'Nearly 6 hours',
104
+ enLabel: 'Last 6 Hours',
103
105
  rangeLabel: '6h',
104
106
  name: 'NEAR_6_HOURS',
105
107
  range: function range() {
@@ -107,6 +109,16 @@ export var NEAR_6_HOURS = {
107
109
  return [current.clone().subtract(6, 'hour'), current.clone()];
108
110
  }
109
111
  };
112
+ export var NEAR_12_HOURS = {
113
+ label: '近 12 小时',
114
+ enLabel: 'Last 12 Hours',
115
+ rangeLabel: '12h',
116
+ name: 'NEAR_12_HOURS',
117
+ range: function range() {
118
+ var current = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : moment();
119
+ return [current.clone().subtract(12, 'hour'), current.clone()];
120
+ }
121
+ };
110
122
  export var TODAY = {
111
123
  label: '今天',
112
124
  enLabel: 'Today',
@@ -127,9 +139,19 @@ export var YESTERDAY = {
127
139
  return [current.clone().startOf(DAY_UNIT).add(-1, DAY_UNIT), current.clone().endOf(DAY_UNIT).add(-1, DAY_UNIT)];
128
140
  }
129
141
  };
142
+ export var LAST_1_DAY = {
143
+ label: '近 1 天',
144
+ enLabel: 'Last 1 Day',
145
+ rangeLabel: '1d',
146
+ name: 'LAST_1_DAY',
147
+ range: function range() {
148
+ var current = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : moment();
149
+ return [current.clone().subtract(1, 'days'), current.clone()];
150
+ }
151
+ };
130
152
  export var LAST_3_DAYS = {
131
153
  label: '近 3 天',
132
- enLabel: 'Nearly 3 days',
154
+ enLabel: 'Last 3 Days',
133
155
  rangeLabel: '3d',
134
156
  name: 'LAST_3_DAYS',
135
157
  range: function range() {
@@ -207,4 +229,4 @@ export var NEXT_YEAR = {
207
229
  return [current.clone().startOf(YEAR_UNIT).add(1, YEAR_UNIT), current.clone().endOf(YEAR_UNIT).add(1, YEAR_UNIT)];
208
230
  }
209
231
  };
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];
232
+ 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, NEAR_12_HOURS, LAST_1_DAY, LAST_3_DAYS, TODAY, YESTERDAY, THIS_WEEK, LAST_WEEK, THIS_MONTH, LAST_MONTH, THIS_YEAR, LAST_YEAR, NEXT_YEAR];
@@ -1,3 +1,26 @@
1
+ /// <reference types="react" />
1
2
  export * from './Ranger';
2
- declare const DateRanger: any;
3
+ declare const DateRanger: import("react").ForwardRefExoticComponent<import("./Ranger").DateRangerProps & import("react").RefAttributes<unknown>> & {
4
+ NEAR_1_MINUTES: import("./typing").RangeOption;
5
+ NEAR_5_MINUTES: import("./typing").RangeOption;
6
+ NEAR_10_MINUTES: import("./typing").RangeOption;
7
+ NEAR_20_MINUTES: import("./typing").RangeOption;
8
+ NEAR_30_MINUTES: import("./typing").RangeOption;
9
+ NEAR_1_HOURS: import("./typing").RangeOption;
10
+ NEAR_2_HOURS: import("./typing").RangeOption;
11
+ NEAR_3_HOURS: import("./typing").RangeOption;
12
+ NEAR_6_HOURS: import("./typing").RangeOption;
13
+ NEAR_12_HOURS: import("./typing").RangeOption;
14
+ TODAY: import("./typing").RangeOption;
15
+ LAST_1_DAY: import("./typing").RangeOption;
16
+ LAST_3_DAYS: import("./typing").RangeOption;
17
+ YESTERDAY: import("./typing").RangeOption;
18
+ THIS_WEEK: import("./typing").RangeOption;
19
+ LAST_WEEK: import("./typing").RangeOption;
20
+ THIS_MONTH: import("./typing").RangeOption;
21
+ LAST_MONTH: import("./typing").RangeOption;
22
+ THIS_YEAR: import("./typing").RangeOption;
23
+ LAST_YEAR: import("./typing").RangeOption;
24
+ NEXT_YEAR: import("./typing").RangeOption;
25
+ };
3
26
  export default DateRanger;
@@ -1,26 +1,27 @@
1
- import { LAST_3_DAYS, LAST_MONTH, LAST_WEEK, LAST_YEAR, NEAR_10_MINUTES, NEAR_1_HOURS, NEAR_1_MINUTES, NEAR_20_MINUTES, NEAR_2_HOURS, NEAR_30_MINUTES, NEAR_3_HOURS, NEAR_5_MINUTES, NEAR_6_HOURS, NEXT_YEAR, THIS_MONTH, THIS_WEEK, THIS_YEAR, TODAY, YESTERDAY } from "./constant";
1
+ import { LAST_1_DAY, LAST_3_DAYS, LAST_MONTH, LAST_WEEK, LAST_YEAR, NEAR_10_MINUTES, NEAR_12_HOURS, NEAR_1_HOURS, NEAR_1_MINUTES, NEAR_20_MINUTES, NEAR_2_HOURS, NEAR_30_MINUTES, NEAR_3_HOURS, NEAR_5_MINUTES, NEAR_6_HOURS, NEXT_YEAR, THIS_MONTH, THIS_WEEK, THIS_YEAR, TODAY, YESTERDAY } from "./constant";
2
2
  import InternalDateRanger from "./Ranger";
3
3
  export * from "./Ranger";
4
- var DateRanger = InternalDateRanger;
5
-
6
- // 内置 ranges
7
- DateRanger.NEAR_1_MINUTES = NEAR_1_MINUTES;
8
- DateRanger.NEAR_5_MINUTES = NEAR_5_MINUTES;
9
- DateRanger.NEAR_10_MINUTES = NEAR_10_MINUTES;
10
- DateRanger.NEAR_20_MINUTES = NEAR_20_MINUTES;
11
- DateRanger.NEAR_30_MINUTES = NEAR_30_MINUTES;
12
- DateRanger.NEAR_1_HOURS = NEAR_1_HOURS;
13
- DateRanger.NEAR_2_HOURS = NEAR_2_HOURS;
14
- DateRanger.NEAR_3_HOURS = NEAR_3_HOURS;
15
- DateRanger.NEAR_6_HOURS = NEAR_6_HOURS;
16
- DateRanger.TODAY = TODAY;
17
- DateRanger.LAST_3_DAYS = LAST_3_DAYS;
18
- DateRanger.YESTERDAY = YESTERDAY;
19
- DateRanger.THIS_WEEK = THIS_WEEK;
20
- DateRanger.LAST_WEEK = LAST_WEEK;
21
- DateRanger.THIS_MONTH = THIS_MONTH;
22
- DateRanger.LAST_MONTH = LAST_MONTH;
23
- DateRanger.THIS_YEAR = THIS_YEAR;
24
- DateRanger.LAST_YEAR = LAST_YEAR;
25
- DateRanger.NEXT_YEAR = NEXT_YEAR;
4
+ var DateRanger = Object.assign(InternalDateRanger, {
5
+ NEAR_1_MINUTES: NEAR_1_MINUTES,
6
+ NEAR_5_MINUTES: NEAR_5_MINUTES,
7
+ NEAR_10_MINUTES: NEAR_10_MINUTES,
8
+ NEAR_20_MINUTES: NEAR_20_MINUTES,
9
+ NEAR_30_MINUTES: NEAR_30_MINUTES,
10
+ NEAR_1_HOURS: NEAR_1_HOURS,
11
+ NEAR_2_HOURS: NEAR_2_HOURS,
12
+ NEAR_3_HOURS: NEAR_3_HOURS,
13
+ NEAR_6_HOURS: NEAR_6_HOURS,
14
+ NEAR_12_HOURS: NEAR_12_HOURS,
15
+ TODAY: TODAY,
16
+ LAST_1_DAY: LAST_1_DAY,
17
+ LAST_3_DAYS: LAST_3_DAYS,
18
+ YESTERDAY: YESTERDAY,
19
+ THIS_WEEK: THIS_WEEK,
20
+ LAST_WEEK: LAST_WEEK,
21
+ THIS_MONTH: THIS_MONTH,
22
+ LAST_MONTH: LAST_MONTH,
23
+ THIS_YEAR: THIS_YEAR,
24
+ LAST_YEAR: LAST_YEAR,
25
+ NEXT_YEAR: NEXT_YEAR
26
+ });
26
27
  export default DateRanger;