@oceanbase/design 0.2.14 → 0.2.16

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.
@@ -30,6 +30,8 @@ var ConfigProvider = function ConfigProvider(_ref) {
30
30
  navigate = _ref.navigate,
31
31
  spin = _ref.spin,
32
32
  restProps = _objectWithoutProperties(_ref, _excluded);
33
+ // inherit from parent ConfigProvider
34
+ var parentContext = React.useContext(ExtendedConfigContext);
33
35
  return /*#__PURE__*/React.createElement(AntConfigProvider, _extends({
34
36
  spin: spin,
35
37
  theme: _objectSpread(_objectSpread({}, theme), {}, {
@@ -42,7 +44,7 @@ var ConfigProvider = function ConfigProvider(_ref) {
42
44
  })
43
45
  }, restProps), /*#__PURE__*/React.createElement(ExtendedConfigContext.Provider, {
44
46
  value: {
45
- navigate: navigate
47
+ navigate: navigate === undefined ? parentContext.navigate : navigate
46
48
  }
47
49
  }, /*#__PURE__*/React.createElement(App, null, children, /*#__PURE__*/React.createElement(StaticFunction, null))));
48
50
  };
@@ -0,0 +1,30 @@
1
+ import type { ModalProps } from 'antd/es/modal';
2
+ import React from 'react';
3
+ declare const Modal: {
4
+ ({ prefixCls: customizePrefixCls, className, ...restProps }: ModalProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
5
+ info(props: any): {
6
+ destroy: () => void;
7
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
8
+ };
9
+ success(props: any): {
10
+ destroy: () => void;
11
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
12
+ };
13
+ error(props: any): {
14
+ destroy: () => void;
15
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
16
+ };
17
+ warning(props: any): {
18
+ destroy: () => void;
19
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
20
+ };
21
+ confirm(props: any): {
22
+ destroy: () => void;
23
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
24
+ };
25
+ useModal: typeof import("antd/es/modal/useModal").default;
26
+ destroyAll: () => void;
27
+ config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
28
+ displayName: string;
29
+ };
30
+ export default Modal;
@@ -0,0 +1,50 @@
1
+ var _excluded = ["prefixCls", "className"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ import { Modal as AntModal } from 'antd';
6
+ import classNames from 'classnames';
7
+ import React, { useContext } from 'react';
8
+ import ConfigProvider from "../config-provider";
9
+ import { modal } from "../static-function";
10
+ import useStyle from "./style";
11
+ var Modal = function Modal(_ref) {
12
+ var customizePrefixCls = _ref.prefixCls,
13
+ className = _ref.className,
14
+ restProps = _objectWithoutProperties(_ref, _excluded);
15
+ var _useContext = useContext(ConfigProvider.ConfigContext),
16
+ getPrefixCls = _useContext.getPrefixCls;
17
+ var prefixCls = getPrefixCls('modal', customizePrefixCls);
18
+ var _useStyle = useStyle(prefixCls),
19
+ wrapSSR = _useStyle.wrapSSR;
20
+ var modalCls = classNames(className);
21
+ return wrapSSR( /*#__PURE__*/React.createElement(AntModal, _extends({
22
+ prefixCls: customizePrefixCls,
23
+ className: modalCls
24
+ }, restProps)));
25
+ };
26
+
27
+ // 替换 Modal 上的静态方法,支持消费 ConfigProvider 配置
28
+ // 注意: 不能使用 Modal.info = modal.info 进行属性赋值,需要新建函数赋值,否则仍然无法消费 ConfigProvider 配置
29
+ Modal.info = function (props) {
30
+ return modal.info(props);
31
+ };
32
+ Modal.success = function (props) {
33
+ return modal.success(props);
34
+ };
35
+ Modal.error = function (props) {
36
+ return modal.error(props);
37
+ };
38
+ Modal.warning = function (props) {
39
+ return modal.warning(props);
40
+ };
41
+ Modal.confirm = function (props) {
42
+ return modal.confirm(props);
43
+ };
44
+ Modal.useModal = AntModal.useModal;
45
+ Modal.destroyAll = AntModal.destroyAll;
46
+ Modal.config = AntModal.config;
47
+ if (process.env.NODE_ENV !== 'production') {
48
+ Modal.displayName = AntModal.displayName;
49
+ }
50
+ export default Modal;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { ModalProps } from 'antd/es/modal';
3
+ import type { ProgressProps } from 'antd/es/progress';
4
+ export interface ModalProgressProps extends ModalProps {
5
+ loading?: boolean;
6
+ progress?: ProgressProps;
7
+ description?: React.ReactNode;
8
+ }
9
+ declare const Progress: ({ prefixCls: customizePrefixCls, className, width, maskClosable, loading, progress, description, footer, ...restProps }: ModalProgressProps) => React.JSX.Element;
10
+ export default Progress;
@@ -0,0 +1,46 @@
1
+ var _excluded = ["prefixCls", "className", "width", "maskClosable", "loading", "progress", "description", "footer"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ import React, { useContext } from 'react';
6
+ import { Progress as AntProgress } from 'antd';
7
+ import classNames from 'classnames';
8
+ import ConfigProvider from "../config-provider";
9
+ import Modal from "./Modal";
10
+ import { LoadingOutlined } from '@oceanbase/icons';
11
+ var Progress = function Progress(_ref) {
12
+ var customizePrefixCls = _ref.prefixCls,
13
+ className = _ref.className,
14
+ _ref$width = _ref.width,
15
+ width = _ref$width === void 0 ? 567 : _ref$width,
16
+ _ref$maskClosable = _ref.maskClosable,
17
+ maskClosable = _ref$maskClosable === void 0 ? false : _ref$maskClosable,
18
+ loading = _ref.loading,
19
+ progress = _ref.progress,
20
+ description = _ref.description,
21
+ _ref$footer = _ref.footer,
22
+ footer = _ref$footer === void 0 ? null : _ref$footer,
23
+ restProps = _objectWithoutProperties(_ref, _excluded);
24
+ var _useContext = useContext(ConfigProvider.ConfigContext),
25
+ getPrefixCls = _useContext.getPrefixCls;
26
+ var prefixCls = getPrefixCls('modal', customizePrefixCls);
27
+ var progressModalCls = classNames("".concat(prefixCls, "-progress"), className);
28
+ return /*#__PURE__*/React.createElement(Modal, _extends({
29
+ prefixCls: customizePrefixCls,
30
+ className: progressModalCls,
31
+ width: width,
32
+ maskClosable: maskClosable,
33
+ footer: footer
34
+ }, restProps), /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement(LoadingOutlined, {
35
+ className: "".concat(prefixCls, "-progress-loading")
36
+ }) : /*#__PURE__*/React.createElement(AntProgress, _extends({
37
+ type: "circle",
38
+ size: 200
39
+ }, progress)), description && /*#__PURE__*/React.createElement("div", {
40
+ className: "".concat(prefixCls, "-progress-description")
41
+ }, description)));
42
+ };
43
+ if (process.env.NODE_ENV !== 'production') {
44
+ Modal.displayName = 'Modal.Progress';
45
+ }
46
+ export default Progress;
@@ -1,32 +1,9 @@
1
- import type { ModalProps as AntModalProps } from 'antd/es/modal';
2
- import React from 'react';
1
+ import Progress from './Progress';
2
+ import OriginModal from './Modal';
3
3
  export * from 'antd/es/modal';
4
- export type ModalProps = AntModalProps;
5
- declare const Modal: {
6
- ({ prefixCls: customizePrefixCls, className, rootClassName, title, footer, ...restProps }: ModalProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
7
- info(props: any): {
8
- destroy: () => void;
9
- update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
10
- };
11
- success(props: any): {
12
- destroy: () => void;
13
- update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
14
- };
15
- error(props: any): {
16
- destroy: () => void;
17
- update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
18
- };
19
- warning(props: any): {
20
- destroy: () => void;
21
- update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
22
- };
23
- confirm(props: any): {
24
- destroy: () => void;
25
- update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
26
- };
27
- useModal: typeof import("antd/es/modal/useModal").default;
28
- destroyAll: () => void;
29
- config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
30
- displayName: string;
4
+ export type { ModalProgressProps } from './Progress';
5
+ export type ModalType = typeof OriginModal & {
6
+ Progress: typeof Progress;
31
7
  };
32
- export default Modal;
8
+ declare const _default: ModalType;
9
+ export default _default;
package/es/modal/index.js CHANGED
@@ -1,57 +1,6 @@
1
- var _excluded = ["prefixCls", "className", "rootClassName", "title", "footer"];
2
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- import { Modal as AntModal } from 'antd';
6
- import classNames from 'classnames';
7
- import React, { useContext } from 'react';
8
- import ConfigProvider from "../config-provider";
9
- import { modal } from "../static-function";
10
- import useStyle from "./style";
1
+ import Progress from "./Progress";
2
+ import OriginModal from "./Modal";
11
3
  export * from 'antd/es/modal';
12
- var Modal = function Modal(_ref) {
13
- var customizePrefixCls = _ref.prefixCls,
14
- className = _ref.className,
15
- rootClassName = _ref.rootClassName,
16
- title = _ref.title,
17
- footer = _ref.footer,
18
- restProps = _objectWithoutProperties(_ref, _excluded);
19
- var _useContext = useContext(ConfigProvider.ConfigContext),
20
- getPrefixCls = _useContext.getPrefixCls;
21
- var prefixCls = getPrefixCls('modal', customizePrefixCls);
22
- var _useStyle = useStyle(prefixCls),
23
- wrapSSR = _useStyle.wrapSSR;
24
- var modalCls = classNames(className);
25
- return wrapSSR( /*#__PURE__*/React.createElement(AntModal, _extends({
26
- prefixCls: customizePrefixCls,
27
- className: modalCls,
28
- rootClassName: classNames(rootClassName),
29
- title: title,
30
- footer: footer
31
- }, restProps)));
32
- };
33
-
34
- // 替换 Modal 上的静态方法,支持消费 ConfigProvider 配置
35
- // 注意: 不能使用 Modal.info = modal.info 进行属性赋值,需要新建函数赋值,否则仍然无法消费 ConfigProvider 配置
36
- Modal.info = function (props) {
37
- return modal.info(props);
38
- };
39
- Modal.success = function (props) {
40
- return modal.success(props);
41
- };
42
- Modal.error = function (props) {
43
- return modal.error(props);
44
- };
45
- Modal.warning = function (props) {
46
- return modal.warning(props);
47
- };
48
- Modal.confirm = function (props) {
49
- return modal.confirm(props);
50
- };
51
- Modal.useModal = AntModal.useModal;
52
- Modal.destroyAll = AntModal.destroyAll;
53
- Modal.config = AntModal.config;
54
- if (process.env.NODE_ENV !== 'production') {
55
- Modal.displayName = AntModal.displayName;
56
- }
4
+ var Modal = OriginModal;
5
+ Modal.Progress = Progress;
57
6
  export default Modal;
@@ -4,8 +4,9 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
4
4
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
5
  import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
6
6
  export var genModalStyle = function genModalStyle(token) {
7
- var _$concat$concat, _$concat, _ref;
8
- var componentCls = token.componentCls,
7
+ var _$concat$concat, _$concat2, _$concat3, _$concat4, _ref;
8
+ var antCls = token.antCls,
9
+ componentCls = token.componentCls,
9
10
  marginSM = token.marginSM,
10
11
  marginLG = token.marginLG,
11
12
  paddingMD = token.paddingMD,
@@ -24,11 +25,30 @@ export var genModalStyle = function genModalStyle(token) {
24
25
  borderRadius: borderRadius
25
26
  }), _defineProperty(_$concat$concat, "".concat(componentCls, "-footer"), {
26
27
  marginTop: marginLG
27
- }), _$concat$concat)), _defineProperty(_ref, "".concat(componentCls, "-confirm"), (_$concat = {}, _defineProperty(_$concat, "".concat(componentCls, "-body ").concat(componentCls, "-confirm-title +").concat(componentCls, "-confirm-content"), {
28
+ }), _$concat$concat)), _defineProperty(_ref, "".concat(componentCls).concat(componentCls, "-progress"), _defineProperty({}, "".concat(componentCls, "-content"), (_$concat3 = {
29
+ padding: "".concat(token.paddingXL + token.padding, "px ").concat(token.paddingLG + token.padding, "px")
30
+ }, _defineProperty(_$concat3, "".concat(componentCls, "-header"), _defineProperty({
31
+ textAlign: 'center',
32
+ marginBottom: token.marginXXL
33
+ }, "".concat(componentCls, "-title"), {
34
+ fontSize: token.fontSizeHeading4
35
+ })), _defineProperty(_$concat3, "".concat(componentCls, "-body"), (_$concat2 = {
36
+ textAlign: 'center'
37
+ }, _defineProperty(_$concat2, "".concat(componentCls, "-progress-loading"), {
38
+ fontSize: 200,
39
+ color: token.colorInfo
40
+ }), _defineProperty(_$concat2, "".concat(componentCls, "-progress-description"), {
41
+ marginTop: token.marginXXL,
42
+ color: token.colorTextTertiary
43
+ }), _defineProperty(_$concat2, "".concat(antCls, "-alert"), {
44
+ textAlign: 'left'
45
+ }), _$concat2)), _defineProperty(_$concat3, "".concat(componentCls, "-footer"), {
46
+ textAlign: 'center'
47
+ }), _$concat3))), _defineProperty(_ref, "".concat(componentCls, "-confirm"), (_$concat4 = {}, _defineProperty(_$concat4, "".concat(componentCls, "-body ").concat(componentCls, "-confirm-title +").concat(componentCls, "-confirm-content"), {
28
48
  marginBlockStart: marginSM
29
- }), _defineProperty(_$concat, "".concat(componentCls, "-confirm-btns"), {
49
+ }), _defineProperty(_$concat4, "".concat(componentCls, "-confirm-btns"), {
30
50
  marginTop: marginLG
31
- }), _$concat)), _ref;
51
+ }), _$concat4)), _ref;
32
52
  };
33
53
  export default (function (prefixCls) {
34
54
  var useStyle = genComponentStyleHook('Modal', function (token) {
@@ -6,21 +6,21 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
6
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
7
  import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
8
8
  var genSizeStyle = function genSizeStyle(spinDotSize, token) {
9
- var _ref;
9
+ var _$concat;
10
10
  var componentCls = token.componentCls,
11
11
  colorText = token.colorText;
12
12
  var spinDotWidth = spinDotSize;
13
13
  var spinDotHight = spinDotWidth * (295 / 397);
14
- return _ref = {}, _defineProperty(_ref, "".concat(componentCls, "-dot"), {
14
+ return _defineProperty({}, "&".concat(componentCls, "-oceanbase"), (_$concat = {}, _defineProperty(_$concat, "".concat(componentCls, "-dot"), {
15
15
  width: spinDotWidth,
16
16
  height: spinDotHight
17
- }), _defineProperty(_ref, "".concat(componentCls, "-text"), {
17
+ }), _defineProperty(_$concat, "".concat(componentCls, "-text"), {
18
18
  width: spinDotWidth,
19
19
  color: colorText
20
- }), _ref;
20
+ }), _$concat));
21
21
  };
22
22
  var genNestedSizeStyle = function genNestedSizeStyle(spinDotSize, token) {
23
- var _$concat;
23
+ var _$concat2;
24
24
  var componentCls = token.componentCls,
25
25
  fontSize = token.fontSize;
26
26
  var spinDotWidth = spinDotSize;
@@ -31,22 +31,22 @@ var genNestedSizeStyle = function genNestedSizeStyle(spinDotSize, token) {
31
31
  var dotMarginLeft = -spinDotWidth / 2;
32
32
  var dotMarginTop = -spinDotHight / 2;
33
33
  var textPaddingTop = (spinDotHight - fontSize) / 2 + 2;
34
- return _defineProperty({}, "&".concat(componentCls, "-oceanbase"), (_$concat = {}, _defineProperty(_$concat, "".concat(componentCls, "-dot"), {
34
+ return _defineProperty({}, "&".concat(componentCls, "-oceanbase"), (_$concat2 = {}, _defineProperty(_$concat2, "".concat(componentCls, "-dot"), {
35
35
  marginLeft: dotMarginLeft,
36
36
  marginTop: dotMarginTop
37
- }), _defineProperty(_$concat, "".concat(componentCls, "-text"), {
37
+ }), _defineProperty(_$concat2, "".concat(componentCls, "-text"), {
38
38
  paddingTop: textPaddingTop
39
- }), _defineProperty(_$concat, "&".concat(componentCls, "-show-text ").concat(componentCls, "-dot"), {
39
+ }), _defineProperty(_$concat2, "&".concat(componentCls, "-show-text ").concat(componentCls, "-dot"), {
40
40
  marginTop: dotMarginTop - 10
41
- }), _$concat));
41
+ }), _$concat2));
42
42
  };
43
43
  export var genSpinStyle = function genSpinStyle(token) {
44
- var _$concat2, _div$concat, _ref3;
44
+ var _$concat3, _div$concat, _ref3;
45
45
  var componentCls = token.componentCls,
46
46
  spinDotSize = token.spinDotSize,
47
47
  spinDotSizeSM = token.spinDotSizeSM,
48
48
  spinDotSizeLG = token.spinDotSizeLG;
49
- return _ref3 = {}, _defineProperty(_ref3, "".concat(componentCls), (_$concat2 = {}, _defineProperty(_$concat2, "&-oceanbase", genSizeStyle(spinDotSize, token)), _defineProperty(_$concat2, "&-sm&-oceanbase", genSizeStyle(spinDotSizeSM, token)), _defineProperty(_$concat2, "&-lg&-oceanbase", genSizeStyle(spinDotSizeLG, token)), _$concat2)), _defineProperty(_ref3, "".concat(componentCls, "-nested-loading"), _defineProperty({}, "> div > ".concat(componentCls), (_div$concat = {}, _defineProperty(_div$concat, "&", genNestedSizeStyle(spinDotSize, token)), _defineProperty(_div$concat, "&-sm", genNestedSizeStyle(spinDotSizeSM, token)), _defineProperty(_div$concat, "&-lg", genNestedSizeStyle(spinDotSizeLG, token)), _div$concat))), _ref3;
49
+ return _ref3 = {}, _defineProperty(_ref3, "".concat(componentCls), (_$concat3 = {}, _defineProperty(_$concat3, "&", genSizeStyle(spinDotSize, token)), _defineProperty(_$concat3, "&-sm", genSizeStyle(spinDotSizeSM, token)), _defineProperty(_$concat3, "&-lg", genSizeStyle(spinDotSizeLG, token)), _$concat3)), _defineProperty(_ref3, "".concat(componentCls, "-nested-loading"), _defineProperty({}, "> div > ".concat(componentCls), (_div$concat = {}, _defineProperty(_div$concat, "&", genNestedSizeStyle(spinDotSize, token)), _defineProperty(_div$concat, "&-sm", genNestedSizeStyle(spinDotSizeSM, token)), _defineProperty(_div$concat, "&-lg", genNestedSizeStyle(spinDotSizeLG, token)), _div$concat))), _ref3;
50
50
  };
51
51
  export default (function (prefixCls) {
52
52
  var useStyle = genComponentStyleHook('Spin', function (token) {
@@ -5,6 +5,8 @@ export type TooltipType = 'default' | 'light' | 'success' | 'info' | 'warning' |
5
5
  export interface TooltipProps extends AntTooltipPropsWithTitle {
6
6
  type?: TooltipType;
7
7
  mouseFollow?: boolean;
8
+ closeIcon?: boolean | React.ReactNode;
9
+ onClose?: (e: React.MouseEvent<HTMLElement>) => void;
8
10
  }
9
11
  export declare const getTooltipTypeList: () => {
10
12
  type: string;
@@ -1,17 +1,28 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["children", "type", "color", "overlayInnerStyle", "mouseFollow"];
2
+ var _excluded = ["children", "type", "color", "overlayInnerStyle", "mouseFollow", "closeIcon", "onClose", "title", "className", "open"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  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; }
7
7
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
8
8
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
14
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
- import { Tooltip as AntTooltip } from 'antd';
12
- import React from 'react';
17
+ import { Tooltip as AntTooltip, Space } from 'antd';
18
+ import React, { useContext, useMemo, useState } from 'react';
19
+ import { CloseOutlined } from '@oceanbase/icons';
20
+ import { isNil } from 'lodash';
13
21
  import { token } from "../static-function";
14
22
  import MouseTooltip from "./MouseTooltip";
23
+ import ConfigProvider from "../config-provider";
24
+ import useStyle from "./style";
25
+ import classNames from 'classnames';
15
26
  export * from 'antd/es/tooltip';
16
27
  export var getTooltipTypeList = function getTooltipTypeList() {
17
28
  return [{
@@ -43,22 +54,74 @@ var Tooltip = function Tooltip(_ref) {
43
54
  color = _ref.color,
44
55
  overlayInnerStyle = _ref.overlayInnerStyle,
45
56
  mouseFollow = _ref.mouseFollow,
57
+ _ref$closeIcon = _ref.closeIcon,
58
+ closeIcon = _ref$closeIcon === void 0 ? false : _ref$closeIcon,
59
+ onClose = _ref.onClose,
60
+ title = _ref.title,
61
+ className = _ref.className,
62
+ propOpen = _ref.open,
46
63
  restProps = _objectWithoutProperties(_ref, _excluded);
64
+ var _useContext = useContext(ConfigProvider.ConfigContext),
65
+ getPrefixCls = _useContext.getPrefixCls;
66
+ var customizePrefixCls = restProps.prefixCls;
67
+ var prefixCls = getPrefixCls('tooltip', customizePrefixCls);
68
+ var _useStyle = useStyle(prefixCls),
69
+ wrapSSR = _useStyle.wrapSSR,
70
+ hashId = _useStyle.hashId;
71
+ var tooltipCls = classNames(className, hashId);
72
+ var _useState = useState(undefined),
73
+ _useState2 = _slicedToArray(_useState, 2),
74
+ innerOpen = _useState2[0],
75
+ setInnerOpen = _useState2[1];
76
+ var open = isNil(propOpen) ? innerOpen : propOpen;
77
+ var handleCloseClick = function handleCloseClick(e) {
78
+ e.stopPropagation();
79
+ onClose === null || onClose === void 0 ? void 0 : onClose(e);
80
+ if (e.defaultPrevented) {
81
+ return;
82
+ }
83
+ setInnerOpen(false);
84
+ };
85
+ var hasCloseIcon = !!closeIcon;
86
+ var CloseIconNode = useMemo(function () {
87
+ if (!hasCloseIcon) {
88
+ return null;
89
+ }
90
+ return closeIcon === true ? /*#__PURE__*/React.createElement(CloseOutlined, {
91
+ className: "".concat(prefixCls, "-close-icon"),
92
+ onClick: handleCloseClick
93
+ }) : /*#__PURE__*/React.createElement("span", {
94
+ className: "".concat(prefixCls, "-close-icon"),
95
+ onClick: handleCloseClick
96
+ }, closeIcon);
97
+ }, [closeIcon]);
98
+ var titleNode = typeof title === 'function' ? title() : title;
99
+ var titleWithCloseIcon = /*#__PURE__*/React.createElement(Space, {
100
+ className: "".concat(prefixCls, "-close-icon-wrap")
101
+ }, titleNode, CloseIconNode);
47
102
  var typeList = getTooltipTypeList();
48
103
  var typeItem = typeList.find(function (item) {
49
104
  return item.type === type;
50
105
  });
51
- return mouseFollow ? /*#__PURE__*/React.createElement(MouseTooltip, _extends({
106
+ return wrapSSR(mouseFollow ? /*#__PURE__*/React.createElement(MouseTooltip, _extends({
107
+ title: title,
52
108
  color: color || (typeItem === null || typeItem === void 0 ? void 0 : typeItem.backgroundColor),
53
109
  overlayInnerStyle: _objectSpread({
54
110
  color: typeItem === null || typeItem === void 0 ? void 0 : typeItem.color
55
- }, overlayInnerStyle)
111
+ }, overlayInnerStyle),
112
+ className: tooltipCls
56
113
  }, restProps), children) : /*#__PURE__*/React.createElement(AntTooltip, _extends({
114
+ title: hasCloseIcon ? titleWithCloseIcon : title,
57
115
  color: color || (typeItem === null || typeItem === void 0 ? void 0 : typeItem.backgroundColor),
116
+ open: open,
117
+ onOpenChange: function onOpenChange(open) {
118
+ setInnerOpen(open);
119
+ },
58
120
  overlayInnerStyle: _objectSpread({
59
121
  color: typeItem === null || typeItem === void 0 ? void 0 : typeItem.color
60
- }, overlayInnerStyle)
61
- }, restProps), children);
122
+ }, overlayInnerStyle),
123
+ className: tooltipCls
124
+ }, restProps), children));
62
125
  };
63
126
  if (process.env.NODE_ENV !== 'production') {
64
127
  Tooltip.displayName = AntTooltip.displayName;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
3
+ export type TooltipToken = FullToken<'Tooltip'>;
4
+ export declare const genTooltipStyle: GenerateStyle<TooltipToken>;
5
+ declare const _default: (prefixCls: string) => {
6
+ wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
7
+ hashId: string;
8
+ };
9
+ export default _default;
@@ -0,0 +1,29 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
6
+ export var genTooltipStyle = function genTooltipStyle(token) {
7
+ var componentCls = token.componentCls;
8
+ return _defineProperty({}, componentCls, _defineProperty({}, "".concat(componentCls, "-close-icon-wrap"), _defineProperty({
9
+ display: 'flex',
10
+ justifyContent: 'space-between',
11
+ alignItems: 'flex-start',
12
+ wordBreak: 'break-all'
13
+ }, "".concat(componentCls, "-close-icon"), {
14
+ cursor: 'pointer'
15
+ })));
16
+ };
17
+ export default (function (prefixCls) {
18
+ var useStyle = genComponentStyleHook('Tooltip', function (token) {
19
+ return [genTooltipStyle(token)];
20
+ }, function (_ref2) {
21
+ var zIndexPopupBase = _ref2.zIndexPopupBase,
22
+ colorBgSpotlight = _ref2.colorBgSpotlight;
23
+ return {
24
+ zIndexPopup: zIndexPopupBase + 70,
25
+ colorBgDefault: colorBgSpotlight
26
+ };
27
+ });
28
+ return useStyle(prefixCls);
29
+ });
@@ -46,6 +46,7 @@ var ExtendedConfigContext = import_react.default.createContext({
46
46
  var { defaultSeed, components } = import_theme.default;
47
47
  var ConfigProvider = ({ children, theme, navigate, spin, ...restProps }) => {
48
48
  var _a;
49
+ const parentContext = import_react.default.useContext(ExtendedConfigContext);
49
50
  return /* @__PURE__ */ import_react.default.createElement(
50
51
  import_antd.ConfigProvider,
51
52
  {
@@ -77,7 +78,7 @@ var ConfigProvider = ({ children, theme, navigate, spin, ...restProps }) => {
77
78
  ExtendedConfigContext.Provider,
78
79
  {
79
80
  value: {
80
- navigate
81
+ navigate: navigate === void 0 ? parentContext.navigate : navigate
81
82
  }
82
83
  },
83
84
  /* @__PURE__ */ import_react.default.createElement(import_antd.App, null, children, /* @__PURE__ */ import_react.default.createElement(import_static_function.default, null))
@@ -0,0 +1,30 @@
1
+ import type { ModalProps } from 'antd/es/modal';
2
+ import React from 'react';
3
+ declare const Modal: {
4
+ ({ prefixCls: customizePrefixCls, className, ...restProps }: ModalProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
5
+ info(props: any): {
6
+ destroy: () => void;
7
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
8
+ };
9
+ success(props: any): {
10
+ destroy: () => void;
11
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
12
+ };
13
+ error(props: any): {
14
+ destroy: () => void;
15
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
16
+ };
17
+ warning(props: any): {
18
+ destroy: () => void;
19
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
20
+ };
21
+ confirm(props: any): {
22
+ destroy: () => void;
23
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
24
+ };
25
+ useModal: typeof import("antd/es/modal/useModal").default;
26
+ destroyAll: () => void;
27
+ config: typeof import("antd/es/modal/confirm").modalGlobalConfig;
28
+ displayName: string;
29
+ };
30
+ export default Modal;