@oceanbase/design 0.4.8 → 0.4.10

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 (73) hide show
  1. package/dist/design.min.js +1 -1
  2. package/es/_util/index.d.ts +1 -0
  3. package/es/_util/index.js +25 -0
  4. package/es/alert/index.d.ts +2 -2
  5. package/es/alert/index.js +13 -3
  6. package/es/card/index.js +5 -4
  7. package/es/card/style/index.js +9 -7
  8. package/es/config-provider/index.d.ts +1 -1
  9. package/es/config-provider/index.js +7 -6
  10. package/es/descriptions/hooks/useItems.d.ts +6 -6
  11. package/es/descriptions/hooks/useItems.js +9 -1
  12. package/es/descriptions/index.js +3 -2
  13. package/es/descriptions/style/index.d.ts +3 -0
  14. package/es/descriptions/style/index.js +30 -3
  15. package/es/dropdown/dropdown-button.d.ts +8 -0
  16. package/es/dropdown/dropdown-button.js +23 -0
  17. package/es/dropdown/index.d.ts +10 -0
  18. package/es/dropdown/index.js +17 -1
  19. package/es/empty/colored.js +7 -4
  20. package/es/empty/database.js +7 -4
  21. package/es/empty/guide.js +7 -4
  22. package/es/form/FormItem.d.ts +13 -8
  23. package/es/form/FormItem.js +34 -8
  24. package/es/form/index.js +22 -12
  25. package/es/form/style/index.d.ts +9 -0
  26. package/es/form/style/index.js +20 -0
  27. package/es/index.d.ts +2 -0
  28. package/es/index.js +1 -0
  29. package/es/list/index.d.ts +1 -1
  30. package/es/modal/Progress.d.ts +1 -1
  31. package/es/result/404.js +14 -8
  32. package/es/result/500.js +7 -4
  33. package/es/result/Error.js +9 -5
  34. package/es/result/Processing.js +9 -5
  35. package/es/result/Success.js +39 -24
  36. package/es/result/Warning.js +9 -5
  37. package/es/table/index.d.ts +1 -0
  38. package/es/table/index.js +7 -2
  39. package/es/table/style/index.js +17 -6
  40. package/es/tooltip/ReactStickyMouseTooltip.d.ts +1 -1
  41. package/es/tree-select/index.d.ts +1 -1
  42. package/lib/_util/index.d.ts +1 -0
  43. package/lib/_util/index.js +49 -0
  44. package/lib/alert/index.d.ts +2 -2
  45. package/lib/alert/index.js +21 -2
  46. package/lib/card/index.js +3 -3
  47. package/lib/card/style/index.js +15 -16
  48. package/lib/config-provider/index.d.ts +1 -1
  49. package/lib/config-provider/index.js +6 -4
  50. package/lib/descriptions/hooks/useItems.d.ts +6 -6
  51. package/lib/descriptions/hooks/useItems.js +18 -2
  52. package/lib/descriptions/index.js +5 -2
  53. package/lib/descriptions/style/index.d.ts +3 -0
  54. package/lib/descriptions/style/index.js +47 -4
  55. package/lib/dropdown/dropdown-button.d.ts +8 -0
  56. package/lib/dropdown/dropdown-button.js +42 -0
  57. package/lib/dropdown/index.d.ts +10 -0
  58. package/lib/dropdown/index.js +27 -1
  59. package/lib/form/FormItem.d.ts +13 -8
  60. package/lib/form/FormItem.js +34 -12
  61. package/lib/form/index.js +15 -3
  62. package/lib/form/style/index.d.ts +9 -0
  63. package/lib/form/style/index.js +52 -0
  64. package/lib/index.d.ts +2 -0
  65. package/lib/index.js +3 -0
  66. package/lib/list/index.d.ts +1 -1
  67. package/lib/modal/Progress.d.ts +1 -1
  68. package/lib/table/index.d.ts +3 -2
  69. package/lib/table/index.js +8 -2
  70. package/lib/table/style/index.js +26 -3
  71. package/lib/tooltip/ReactStickyMouseTooltip.d.ts +1 -1
  72. package/lib/tree-select/index.d.ts +1 -1
  73. package/package.json +8 -7
@@ -0,0 +1 @@
1
+ export declare const isHorizontalPaddingZero: (padding?: string | number) => boolean;
@@ -0,0 +1,25 @@
1
+ export var isHorizontalPaddingZero = function isHorizontalPaddingZero(padding) {
2
+ if (typeof padding === 'number') {
3
+ return padding === 0;
4
+ }
5
+ if (typeof padding === 'string') {
6
+ var parts = padding.trim().split(/\s+/);
7
+ switch (parts.length) {
8
+ case 1:
9
+ // padding: 0;
10
+ return parseFloat(parts[0]) === 0;
11
+ case 2:
12
+ // padding: 0 10px;
13
+ return parseFloat(parts[1]) === 0;
14
+ case 3:
15
+ // padding: 0 10px 5px;
16
+ return parseFloat(parts[1]) === 0;
17
+ case 4:
18
+ // padding: 0 1px 2px 3px;
19
+ return parseFloat(parts[1]) === 0 && parseFloat(parts[3]) === 0;
20
+ default:
21
+ return false;
22
+ }
23
+ }
24
+ return false;
25
+ };
@@ -1,12 +1,12 @@
1
- import type { AlertProps as AntAlertProps } from 'antd/es/alert';
2
1
  import React from 'react';
2
+ import type { AlertProps as AntAlertProps } from 'antd/es/alert';
3
3
  export * from 'antd/es/alert';
4
4
  export interface AlertProps extends AntAlertProps {
5
5
  ghost?: boolean;
6
6
  colored?: boolean;
7
7
  }
8
8
  declare const Alert: {
9
- ({ ghost, colored, prefixCls: customizePrefixCls, className, ...restProps }: AlertProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
9
+ ({ type, ghost, colored, prefixCls: customizePrefixCls, className, ...restProps }: AlertProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
10
  ErrorBoundary: typeof import("antd/es/alert/ErrorBoundary").default;
11
11
  displayName: string;
12
12
  };
package/es/alert/index.js CHANGED
@@ -1,5 +1,5 @@
1
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
- var _excluded = ["ghost", "colored", "prefixCls", "className"];
2
+ var _excluded = ["type", "ghost", "colored", "prefixCls", "className"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  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,15 +7,23 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
7
7
  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); }
8
8
  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; }
9
9
  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; }
10
+ import React, { useContext } from 'react';
10
11
  import { Alert as AntAlert } from 'antd';
12
+ import { CheckCircleOutlined, CloseCircleOutlined, ExclamationCircleOutlined, InfoCircleOutlined } from '@oceanbase/icons';
11
13
  import classNames from 'classnames';
12
- import React, { useContext } from 'react';
13
14
  import ConfigProvider from "../config-provider";
14
15
  import useStyle from "./style";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  export * from 'antd/es/alert';
18
+ var iconMapOutlined = {
19
+ success: /*#__PURE__*/_jsx(CheckCircleOutlined, {}),
20
+ info: /*#__PURE__*/_jsx(InfoCircleOutlined, {}),
21
+ error: /*#__PURE__*/_jsx(CloseCircleOutlined, {}),
22
+ warning: /*#__PURE__*/_jsx(ExclamationCircleOutlined, {})
23
+ };
17
24
  var Alert = function Alert(_ref) {
18
- var ghost = _ref.ghost,
25
+ var type = _ref.type,
26
+ ghost = _ref.ghost,
19
27
  colored = _ref.colored,
20
28
  customizePrefixCls = _ref.prefixCls,
21
29
  className = _ref.className,
@@ -27,6 +35,8 @@ var Alert = function Alert(_ref) {
27
35
  wrapSSR = _useStyle.wrapSSR;
28
36
  var alertCls = classNames(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-ghost"), ghost), "".concat(prefixCls, "-colored"), colored), className);
29
37
  return wrapSSR( /*#__PURE__*/_jsx(AntAlert, _objectSpread({
38
+ type: type,
39
+ icon: iconMapOutlined[type],
30
40
  prefixCls: customizePrefixCls,
31
41
  className: alertCls
32
42
  }, restProps)));
package/es/card/index.js CHANGED
@@ -12,6 +12,7 @@ import { Card as AntCard, Space, Tag } from 'antd';
12
12
  import classNames from 'classnames';
13
13
  import React, { useContext } from 'react';
14
14
  import ConfigProvider from "../config-provider";
15
+ import { isHorizontalPaddingZero } from "../_util";
15
16
  import useStyle, { genTableStyle } from "./style";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -37,10 +38,10 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
37
38
  var tabsPrefixCls = getPrefixCls('tabs', customizePrefixCls);
38
39
  var _useStyle = useStyle(prefixCls, tabsPrefixCls),
39
40
  wrapSSR = _useStyle.wrapSSR;
40
- var zeroPaddingList = [0, '0', '0px'];
41
- // card body has no padding
42
- var noBodyPadding = zeroPaddingList.includes(bodyStyle === null || bodyStyle === void 0 ? void 0 : bodyStyle.padding) || zeroPaddingList.includes(styles === null || styles === void 0 || (_styles$body = styles.body) === null || _styles$body === void 0 ? void 0 : _styles$body.padding);
43
- var cardCls = classNames(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-has-title"), !!title), "".concat(prefixCls, "-no-divider"), !divided), "".concat(prefixCls, "-no-body-padding"), noBodyPadding), className);
41
+
42
+ // card body no horizontal padding
43
+ var noBodyHorizontalPadding = isHorizontalPaddingZero(bodyStyle === null || bodyStyle === void 0 ? void 0 : bodyStyle.padding) || isHorizontalPaddingZero(styles === null || styles === void 0 || (_styles$body = styles.body) === null || _styles$body === void 0 ? void 0 : _styles$body.padding);
44
+ var cardCls = classNames(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-has-title"), !!title), "".concat(prefixCls, "-no-divider"), !divided), "".concat(prefixCls, "-no-body-horizontal-padding"), noBodyHorizontalPadding), className);
44
45
  var newTabList = tabList === null || tabList === void 0 ? void 0 : tabList.map(function (item) {
45
46
  if (!isNullValue(item.tag)) {
46
47
  return _objectSpread(_objectSpread({}, item), {}, {
@@ -7,10 +7,9 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
7
7
  import { genTabsStyle } from "../../tabs/style";
8
8
  import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
9
9
  export var genTableStyle = function genTableStyle(padding, token) {
10
- var componentCls = token.componentCls,
11
- antCls = token.antCls;
10
+ var antCls = token.antCls;
12
11
  var tableComponentCls = "".concat(antCls, "-table");
13
- return _defineProperty(_defineProperty({}, "".concat(tableComponentCls, "-wrapper"), _defineProperty(_defineProperty({}, "".concat(tableComponentCls), _defineProperty(_defineProperty({}, "".concat(tableComponentCls, "-thead > tr > th:first-child, ").concat(tableComponentCls, "-tbody > tr > td:first-child"), {
12
+ return _defineProperty({}, "".concat(tableComponentCls, "-wrapper"), _defineProperty(_defineProperty({}, "".concat(tableComponentCls), _defineProperty(_defineProperty({}, "".concat(tableComponentCls, "-thead > tr > th:first-child, ").concat(tableComponentCls, "-tbody > tr > td:first-child"), {
14
13
  paddingLeft: padding
15
14
  }), "".concat(tableComponentCls, "-thead > tr > th:last-child, ").concat(tableComponentCls, "-tbody > tr > td:last-child"), {
16
15
  paddingRight: padding
@@ -18,17 +17,18 @@ export var genTableStyle = function genTableStyle(padding, token) {
18
17
  marginLeft: padding
19
18
  }), "& > li:last-child", {
20
19
  marginRight: padding
21
- }))), "&".concat(componentCls, "-has-title").concat(componentCls, "-no-divider:not(").concat(componentCls, "-contain-tabs)"), _defineProperty({}, "".concat(componentCls, "-body"), _defineProperty({}, "& > ".concat(tableComponentCls, "-wrapper ").concat(tableComponentCls, ":not(").concat(tableComponentCls, "-bordered):first-child"), {
22
- marginTop: -token.marginSM
23
20
  })));
24
21
  };
25
22
  export var genCardStyle = function genCardStyle(token) {
23
+ var _ref2;
26
24
  var componentCls = token.componentCls,
25
+ antCls = token.antCls,
27
26
  tabsComponentCls = token.tabsComponentCls,
28
27
  tabsPrefixCls = token.tabsPrefixCls,
29
28
  paddingSM = token.paddingSM,
30
29
  paddingLG = token.paddingLG;
31
- return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls), _defineProperty({}, "".concat(componentCls, ":not(").concat(componentCls, "-bordered):not(").concat(componentCls, "-type-inner)"), {
30
+ var tableComponentCls = "".concat(antCls, "-table");
31
+ return _ref2 = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref2, "".concat(componentCls), _defineProperty({}, "".concat(componentCls, ":not(").concat(componentCls, "-bordered):not(").concat(componentCls, "-type-inner)"), {
32
32
  boxShadow: 'none'
33
33
  })), "".concat(componentCls).concat(componentCls, "-no-divider"), _defineProperty({}, "".concat(componentCls, "-head"), {
34
34
  // should not remove border-bottom to avoid tabs inkbar display correctly
@@ -48,7 +48,9 @@ export var genCardStyle = function genCardStyle(token) {
48
48
  })), "".concat(componentCls, ":not(").concat(componentCls, "-contain-grid)"), _defineProperty({}, "".concat(componentCls, "-head"), {
49
49
  // work for Card not containing Card.Grid
50
50
  marginBottom: 0
51
- })), "".concat(componentCls).concat(componentCls, "-no-body-padding"), genTableStyle(paddingLG, token)), "".concat(componentCls).concat(componentCls, "-no-body-padding").concat(componentCls, "-small"), genTableStyle(paddingSM, token));
51
+ })), "&".concat(componentCls, "-has-title").concat(componentCls, "-no-divider:not(").concat(componentCls, "-contain-tabs)"), _defineProperty({}, "".concat(componentCls, "-body"), _defineProperty({}, "& > ".concat(tableComponentCls, "-wrapper ").concat(tableComponentCls, ":not(").concat(tableComponentCls, "-bordered):first-child"), {
52
+ marginTop: -token.marginSM
53
+ }))), "".concat(componentCls).concat(componentCls, "-no-body-horizontal-padding"), genTableStyle(paddingLG, token)), _defineProperty(_ref2, "".concat(componentCls).concat(componentCls, "-no-body-horizontal-padding").concat(componentCls, "-small"), genTableStyle(paddingSM, token));
52
54
  };
53
55
  export default (function (prefixCls, tabsPrefixCls) {
54
56
  var useStyle = genComponentStyleHook('Card', function (token) {
@@ -45,13 +45,13 @@ export interface ConfigProviderProps extends AntConfigProviderProps {
45
45
  pagination?: PaginationConfig;
46
46
  spin?: SpinConfig;
47
47
  table?: TableConfig;
48
- injectStaticFunction?: boolean;
49
48
  styleProviderProps?: StyleProviderProps;
50
49
  appProps?: AppProps;
51
50
  }
52
51
  export interface ExtendedConfigConsumerProps {
53
52
  navigate?: NavigateFunction;
54
53
  hideOnSinglePage?: boolean;
54
+ injectStaticFunction?: boolean;
55
55
  }
56
56
  declare const ExtendedConfigContext: React.Context<ExtendedConfigConsumerProps>;
57
57
  export type ConfigProviderType = React.FC<ConfigProviderProps> & {
@@ -1,5 +1,5 @@
1
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
- var _excluded = ["children", "theme", "locale", "navigate", "hideOnSinglePage", "card", "collapse", "form", "spin", "table", "tabs", "injectStaticFunction", "styleProviderProps", "appProps"];
2
+ var _excluded = ["children", "theme", "locale", "navigate", "hideOnSinglePage", "card", "collapse", "form", "spin", "table", "tabs", "styleProviderProps", "appProps"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  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; }
@@ -28,7 +28,8 @@ export * from 'antd/es/config-provider/DisabledContext';
28
28
  export * from 'antd/es/config-provider';
29
29
  var ExtendedConfigContext = /*#__PURE__*/React.createContext({
30
30
  navigate: undefined,
31
- hideOnSinglePage: false
31
+ hideOnSinglePage: false,
32
+ injectStaticFunction: true
32
33
  });
33
34
  var ConfigProvider = function ConfigProvider(_ref) {
34
35
  var _mergedTheme$token, _parentContext$pagina;
@@ -43,8 +44,6 @@ var ConfigProvider = function ConfigProvider(_ref) {
43
44
  spin = _ref.spin,
44
45
  table = _ref.table,
45
46
  tabs = _ref.tabs,
46
- _ref$injectStaticFunc = _ref.injectStaticFunction,
47
- injectStaticFunction = _ref$injectStaticFunc === void 0 ? true : _ref$injectStaticFunc,
48
47
  styleProviderProps = _ref.styleProviderProps,
49
48
  appProps = _ref.appProps,
50
49
  restProps = _objectWithoutProperties(_ref, _excluded);
@@ -105,13 +104,15 @@ var ConfigProvider = function ConfigProvider(_ref) {
105
104
  children: /*#__PURE__*/_jsx(ExtendedConfigContext.Provider, {
106
105
  value: {
107
106
  navigate: navigate === undefined ? parentExtendedContext.navigate : navigate,
108
- hideOnSinglePage: (_parentContext$pagina = parentContext.pagination) !== null && _parentContext$pagina !== void 0 && _parentContext$pagina.showSizeChanger ? false : hideOnSinglePage !== undefined ? hideOnSinglePage : parentExtendedContext.hideOnSinglePage
107
+ hideOnSinglePage: (_parentContext$pagina = parentContext.pagination) !== null && _parentContext$pagina !== void 0 && _parentContext$pagina.showSizeChanger ? false : hideOnSinglePage !== undefined ? hideOnSinglePage : parentExtendedContext.hideOnSinglePage,
108
+ // inject static function to outermost ConfigProvider only
109
+ injectStaticFunction: false
109
110
  },
110
111
  children: /*#__PURE__*/_jsx(StyleProvider, _objectSpread(_objectSpread({}, mergedStyleProviderProps), {}, {
111
112
  children: /*#__PURE__*/_jsxs(App, _objectSpread(_objectSpread({
112
113
  component: false
113
114
  }, appProps), {}, {
114
- children: [children, injectStaticFunction && /*#__PURE__*/_jsx(StaticFunction, {})]
115
+ children: [children, parentExtendedContext.injectStaticFunction && /*#__PURE__*/_jsx(StaticFunction, {})]
115
116
  }))
116
117
  }))
117
118
  })
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { DescriptionsItemType } from '..';
3
3
  export default function useItems(items?: DescriptionsItemType[], children?: React.ReactNode, bordered?: boolean): {
4
- children: string | number | boolean | import("@emotion/react/types/jsx-namespace").EmotionJSX.Element | Iterable<React.ReactNode>;
4
+ children: string | number | boolean | Iterable<React.ReactNode> | import("@emotion/react/jsx-runtime").JSX.Element;
5
5
  span?: number | "filled" | {
6
6
  xxl?: number;
7
7
  xl?: number;
@@ -10,13 +10,13 @@ export default function useItems(items?: DescriptionsItemType[], children?: Reac
10
10
  sm?: number;
11
11
  xs?: number;
12
12
  };
13
- prefixCls?: string;
14
- className?: string;
13
+ label?: React.ReactNode;
15
14
  style?: React.CSSProperties;
16
- styles?: Partial<Record<"content" | "label", React.CSSProperties>>;
17
- classNames?: Partial<Record<"content" | "label", string>>;
18
15
  key?: React.Key;
19
- label?: React.ReactNode;
16
+ className?: string;
17
+ prefixCls?: string;
18
+ classNames?: Partial<Record<"label" | "content", string>>;
19
+ styles?: Partial<Record<"label" | "content", React.CSSProperties>>;
20
20
  labelStyle?: React.CSSProperties;
21
21
  contentStyle?: React.CSSProperties;
22
22
  }[];
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["children", "contentProps"],
2
- _excluded2 = ["ellipsis"];
2
+ _excluded2 = ["ellipsis", "editable"];
3
3
  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); }
4
4
  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; }
5
5
  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; }
@@ -44,11 +44,19 @@ function convertItem(props, bordered) {
44
44
  var _ref = contentProps || {},
45
45
  _ref$ellipsis = _ref.ellipsis,
46
46
  ellipsis = _ref$ellipsis === void 0 ? defaultEllipsis : _ref$ellipsis,
47
+ editable = _ref.editable,
47
48
  restContentProps = _objectWithoutProperties(_ref, _excluded2);
48
49
  return _objectSpread(_objectSpread({}, restItemProps), {}, {
49
50
  // 仅无边框时定制 children
50
51
  children: bordered ? itemChildren : /*#__PURE__*/_jsx(Typography.Text, _objectSpread(_objectSpread({}, restContentProps), {}, {
51
52
  ellipsis: getEllipsisConfig(ellipsis, itemChildren),
53
+ editable:
54
+ // disable autoSize by default to avoid over height
55
+ _typeof(editable) === 'object' ? _objectSpread({
56
+ autoSize: false
57
+ }, editable) : editable === true ? {
58
+ autoSize: false
59
+ } : editable,
52
60
  children: itemChildren
53
61
  }))
54
62
  });
@@ -19,7 +19,8 @@ export * from 'antd/es/descriptions';
19
19
  var Descriptions = function Descriptions(_ref) {
20
20
  var children = _ref.children,
21
21
  bordered = _ref.bordered,
22
- layout = _ref.layout,
22
+ _ref$layout = _ref.layout,
23
+ layout = _ref$layout === void 0 ? 'horizontal' : _ref$layout,
23
24
  _ref$colon = _ref.colon,
24
25
  colon = _ref$colon === void 0 ? layout === 'vertical' ? false : undefined : _ref$colon,
25
26
  items = _ref.items,
@@ -32,7 +33,7 @@ var Descriptions = function Descriptions(_ref) {
32
33
  var typographyPrefixCls = getPrefixCls('typography', customizePrefixCls);
33
34
  var _useStyle = useStyle(prefixCls, typographyPrefixCls),
34
35
  wrapSSR = _useStyle.wrapSSR;
35
- var descriptionsCls = classNames(className);
36
+ var descriptionsCls = classNames(className, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-vertical"), layout === 'vertical'), "".concat(prefixCls, "-horizontal"), layout === 'horizontal'));
36
37
  var newItems = useItems(items, children, bordered);
37
38
  return wrapSSR( /*#__PURE__*/_jsx(AntDescriptions, _objectSpread({
38
39
  layout: layout,
@@ -1,9 +1,12 @@
1
1
  /// <reference types="react" />
2
+ import type { CSSObject } from '@ant-design/cssinjs';
2
3
  import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
4
+ import type { DescriptionsProps } from '..';
3
5
  export type DescriptionsToken = FullToken<'Alert'> & {
4
6
  typographyPrefixCls: string;
5
7
  typographyComponentCls: string;
6
8
  };
9
+ export declare const genVerticalStyle: (size: DescriptionsProps['size'], token: Partial<DescriptionsToken>) => CSSObject;
7
10
  export declare const genDescriptionsStyle: GenerateStyle<DescriptionsToken>;
8
11
  declare const _default: (prefixCls: string, typographyPrefixCls: string) => {
9
12
  wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -5,17 +5,44 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
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
7
  import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
8
+ export var genVerticalStyle = function genVerticalStyle(size, token) {
9
+ var componentCls = token.componentCls;
10
+ var paddingMap = {
11
+ default: {
12
+ paddingIn: token.paddingXS,
13
+ paddingOut: token.paddingLG
14
+ },
15
+ middle: {
16
+ paddingIn: token.paddingXXS,
17
+ paddingOut: token.padding
18
+ },
19
+ small: {
20
+ paddingIn: token.paddingXXS,
21
+ paddingOut: token.paddingSM
22
+ }
23
+ };
24
+ var paddingConfig = paddingMap[size];
25
+ return _defineProperty({}, "&".concat(componentCls).concat(componentCls, "-vertical:not(").concat(componentCls, "-bordered)"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-row:nth-child(2n + 1)"), _defineProperty({}, "& > th, & > td", {
26
+ paddingBottom: paddingConfig.paddingIn
27
+ })), "".concat(componentCls, "-row:nth-child(2n)"), _defineProperty({}, "& > th, & > td", {
28
+ paddingBottom: paddingConfig.paddingOut
29
+ })));
30
+ };
8
31
  export var genDescriptionsStyle = function genDescriptionsStyle(token) {
9
32
  var componentCls = token.componentCls,
10
33
  typographyComponentCls = token.typographyComponentCls;
11
- return _defineProperty({}, "".concat(componentCls), _defineProperty({}, "".concat(componentCls, "-item-container"), _defineProperty({}, "".concat(componentCls, "-item-content"), _defineProperty({
34
+ return _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls), _objectSpread(_objectSpread({}, genVerticalStyle('default', token)), {}, _defineProperty(_defineProperty({}, "".concat(componentCls, "-item-container"), _defineProperty({}, "".concat(componentCls, "-item-content"), _defineProperty({
12
35
  paddingRight: 12,
13
36
  // 为了保证内部的 Text ellipsis 生效
14
37
  overflow: 'hidden'
15
38
  }, "".concat(typographyComponentCls, "-edit-content"), {
16
39
  insetInlineStart: 0,
17
- marginTop: 0
18
- }))));
40
+ marginTop: 0,
41
+ marginBottom: 0
42
+ }))), "".concat(componentCls, "-item-container:has(", "".concat(typographyComponentCls, "-edit-content"), ")"), {
43
+ alignItems: 'center',
44
+ height: token.fontSize * token.lineHeight
45
+ }))), "".concat(componentCls).concat(componentCls, "-middle"), genVerticalStyle('middle', token)), "".concat(componentCls).concat(componentCls, "-small"), genVerticalStyle('small', token));
19
46
  };
20
47
  export default (function (prefixCls, typographyPrefixCls) {
21
48
  var useStyle = genComponentStyleHook('Descriptions', function (token) {
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { DropdownButtonProps } from 'antd/es/dropdown';
3
+ type CompoundedComponent = React.FC<DropdownButtonProps> & {
4
+ /** @internal */
5
+ __ANT_BUTTON: boolean;
6
+ };
7
+ declare const DropdownButton: CompoundedComponent;
8
+ export default DropdownButton;
@@ -0,0 +1,23 @@
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
+ var _excluded = ["icon"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ 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; }
9
+ 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; }
10
+ import React from 'react';
11
+ import { Dropdown } from 'antd';
12
+ import { DownOutlined } from '@oceanbase/icons';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ var DropdownButton = function DropdownButton(_ref) {
15
+ var _ref$icon = _ref.icon,
16
+ icon = _ref$icon === void 0 ? /*#__PURE__*/_jsx(DownOutlined, {}) : _ref$icon,
17
+ restProps = _objectWithoutProperties(_ref, _excluded);
18
+ return /*#__PURE__*/_jsx(Dropdown.Button, _objectSpread({
19
+ icon: icon
20
+ }, restProps));
21
+ };
22
+ DropdownButton.__ANT_BUTTON = true;
23
+ export default DropdownButton;
@@ -1 +1,11 @@
1
+ import React from 'react';
2
+ import { Dropdown as AntDropdown } from 'antd';
3
+ import type { DropDownProps } from 'antd/es/dropdown';
4
+ import DropdownButton from './dropdown-button';
1
5
  export * from 'antd/es/dropdown';
6
+ type CompoundedComponent = React.FC<DropDownProps> & {
7
+ Button: typeof DropdownButton;
8
+ _InternalPanelDoNotUseOrYouWillBeFired: typeof AntDropdown._InternalPanelDoNotUseOrYouWillBeFired;
9
+ };
10
+ declare const Dropdown: CompoundedComponent;
11
+ export default Dropdown;
@@ -1 +1,17 @@
1
- export * from 'antd/es/dropdown';
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
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 React from 'react';
8
+ import { Dropdown as AntDropdown } from 'antd';
9
+ import DropdownButton from "./dropdown-button";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ export * from 'antd/es/dropdown';
12
+ var Dropdown = function Dropdown(props) {
13
+ return /*#__PURE__*/_jsx(AntDropdown, _objectSpread({}, props));
14
+ };
15
+ Dropdown._InternalPanelDoNotUseOrYouWillBeFired = AntDropdown._InternalPanelDoNotUseOrYouWillBeFired;
16
+ Dropdown.Button = DropdownButton;
17
+ export default Dropdown;
@@ -1,7 +1,10 @@
1
+ import { useUniqueInlineId } from '@inline-svg-unique-id/react';
1
2
  import React from 'react';
2
3
  import { jsx as _jsx } from "react/jsx-runtime";
3
4
  import { jsxs as _jsxs } from "react/jsx-runtime";
4
5
  var ColoredEmptyImg = function ColoredEmptyImg(props) {
6
+ var _id2 = useUniqueInlineId();
7
+ var _id = useUniqueInlineId();
5
8
  return /*#__PURE__*/_jsxs("svg", {
6
9
  width: "160px",
7
10
  height: "160px",
@@ -10,7 +13,7 @@ var ColoredEmptyImg = function ColoredEmptyImg(props) {
10
13
  xmlns: "http://www.w3.org/2000/svg",
11
14
  children: [/*#__PURE__*/_jsx("defs", {
12
15
  children: /*#__PURE__*/_jsx("circle", {
13
- id: "oceanbase-design-empty-colored-path-1",
16
+ id: _id,
14
17
  cx: "75",
15
18
  cy: "75",
16
19
  r: "75"
@@ -40,15 +43,15 @@ var ColoredEmptyImg = function ColoredEmptyImg(props) {
40
43
  }), /*#__PURE__*/_jsxs("g", {
41
44
  transform: "translate(0, 0)",
42
45
  children: [/*#__PURE__*/_jsx("mask", {
43
- id: "oceanbase-design-empty-colored-mask-2",
46
+ id: _id2,
44
47
  fill: "white",
45
48
  children: /*#__PURE__*/_jsx("use", {
46
- xlinkHref: "#oceanbase-design-empty-colored-path-1"
49
+ xlinkHref: "#".concat(_id)
47
50
  })
48
51
  }), /*#__PURE__*/_jsx("g", {}), /*#__PURE__*/_jsx("ellipse", {
49
52
  fill: "#349AFD",
50
53
  fillRule: "nonzero",
51
- mask: "url(#oceanbase-design-empty-colored-mask-2)",
54
+ mask: "url(#".concat(_id2, ")"),
52
55
  cx: "75",
53
56
  cy: "158.659491",
54
57
  rx: "133.855186",
@@ -1,7 +1,10 @@
1
+ import { useUniqueInlineId } from '@inline-svg-unique-id/react';
1
2
  import React from 'react';
2
3
  import { jsx as _jsx } from "react/jsx-runtime";
3
4
  import { jsxs as _jsxs } from "react/jsx-runtime";
4
5
  var DatabaseEmptyImg = function DatabaseEmptyImg(props) {
6
+ var _id2 = useUniqueInlineId();
7
+ var _id = useUniqueInlineId();
5
8
  return /*#__PURE__*/_jsxs("svg", {
6
9
  width: "160px",
7
10
  height: "160px",
@@ -10,7 +13,7 @@ var DatabaseEmptyImg = function DatabaseEmptyImg(props) {
10
13
  xmlns: "http://www.w3.org/2000/svg",
11
14
  children: [/*#__PURE__*/_jsx("defs", {
12
15
  children: /*#__PURE__*/_jsx("circle", {
13
- id: "oceanbase-design-empty-database-path-1",
16
+ id: _id,
14
17
  cx: "75",
15
18
  cy: "75",
16
19
  r: "75"
@@ -41,15 +44,15 @@ var DatabaseEmptyImg = function DatabaseEmptyImg(props) {
41
44
  }), /*#__PURE__*/_jsxs("g", {
42
45
  transform: "translate(-0, 0)",
43
46
  children: [/*#__PURE__*/_jsx("mask", {
44
- id: "oceanbase-design-empty-database-mask-2",
47
+ id: _id2,
45
48
  fill: "white",
46
49
  children: /*#__PURE__*/_jsx("use", {
47
- xlinkHref: "#oceanbase-design-empty-database-path-1"
50
+ xlinkHref: "#".concat(_id)
48
51
  })
49
52
  }), /*#__PURE__*/_jsx("g", {}), /*#__PURE__*/_jsx("ellipse", {
50
53
  fill: "#349AFD",
51
54
  fillRule: "nonzero",
52
- mask: "url(#oceanbase-design-empty-database-mask-2)",
55
+ mask: "url(#".concat(_id2, ")"),
53
56
  cx: "75",
54
57
  cy: "158.588942",
55
58
  rx: "133.855186",
package/es/empty/guide.js CHANGED
@@ -1,7 +1,10 @@
1
+ import { useUniqueInlineId } from '@inline-svg-unique-id/react';
1
2
  import React from 'react';
2
3
  import { jsx as _jsx } from "react/jsx-runtime";
3
4
  import { jsxs as _jsxs } from "react/jsx-runtime";
4
5
  var GuideEmptyImg = function GuideEmptyImg(props) {
6
+ var _id2 = useUniqueInlineId();
7
+ var _id = useUniqueInlineId();
5
8
  return /*#__PURE__*/_jsxs("svg", {
6
9
  width: "164.217482px",
7
10
  height: "101.022957px",
@@ -11,7 +14,7 @@ var GuideEmptyImg = function GuideEmptyImg(props) {
11
14
  children: [/*#__PURE__*/_jsx("defs", {
12
15
  children: /*#__PURE__*/_jsx("path", {
13
16
  d: "M0,0.515265579 L168,0 L168,92.2208281 C114.353827,84.8197407 88.4617315,118.112923 21.8636554,110.957758 L21.8636554,80.9669594 L0,0.515265579 Z",
14
- id: "oceanbase-design-empty-guide-path-1"
17
+ id: _id
15
18
  })
16
19
  }), /*#__PURE__*/_jsx("g", {
17
20
  stroke: "none",
@@ -28,13 +31,13 @@ var GuideEmptyImg = function GuideEmptyImg(props) {
28
31
  fillRule: "nonzero"
29
32
  }), /*#__PURE__*/_jsxs("g", {
30
33
  children: [/*#__PURE__*/_jsx("mask", {
31
- id: "oceanbase-design-empty-guide-mask-2",
34
+ id: _id2,
32
35
  fill: "white",
33
36
  children: /*#__PURE__*/_jsx("use", {
34
- xlinkHref: "#oceanbase-design-empty-guide-path-1"
37
+ xlinkHref: "#".concat(_id)
35
38
  })
36
39
  }), /*#__PURE__*/_jsx("g", {}), /*#__PURE__*/_jsx("g", {
37
- mask: "url(#oceanbase-design-empty-guide-mask-2)",
40
+ mask: "url(#".concat(_id2, ")"),
38
41
  children: /*#__PURE__*/_jsxs("g", {
39
42
  transform: "translate(3.7825, 10.9494)",
40
43
  children: [/*#__PURE__*/_jsxs("g", {
@@ -1,19 +1,24 @@
1
- import type { FormItemProps as AntFormItemProps } from 'antd/es/form';
2
- import type { ReactNode } from 'react';
3
1
  import React from 'react';
2
+ import type { ReactNode } from 'react';
3
+ import type { FormItemProps as AntFormItemProps } from 'antd/es/form';
4
4
  import type { TooltipProps } from '../tooltip';
5
+ declare const AntFormItem: (<Values = any>(props: AntFormItemProps<Values>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
6
+ useStatus: () => {
7
+ status?: "" | "success" | "error" | "warning" | "validating";
8
+ errors: React.ReactNode[];
9
+ warnings: React.ReactNode[];
10
+ };
11
+ };
5
12
  export type WrapperTooltipProps = Omit<TooltipProps, 'mouseFollow'> & {
6
13
  icon?: React.ReactElement;
7
14
  };
8
15
  export type LabelTooltipType = WrapperTooltipProps | React.ReactNode;
9
16
  export interface FormItemProps extends AntFormItemProps {
10
17
  tooltip?: WrapperTooltipProps | ReactNode;
18
+ action?: ReactNode;
11
19
  }
12
- declare const FormItem: (<Values = any>(props: AntFormItemProps<Values>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
13
- useStatus: () => {
14
- status?: "" | "warning" | "error" | "success" | "validating";
15
- errors: ReactNode[];
16
- warnings: ReactNode[];
17
- };
20
+ type CompoundedComponent = React.FC<FormItemProps> & {
21
+ useStatus: typeof AntFormItem.useStatus;
18
22
  };
23
+ declare const FormItem: CompoundedComponent;
19
24
  export default FormItem;