@oceanbase/design 0.4.9 → 0.4.11

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 (49) 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/button/index.d.ts +1 -1
  5. package/es/card/index.js +5 -4
  6. package/es/card/style/index.js +9 -7
  7. package/es/descriptions/hooks/useItems.d.ts +2 -2
  8. package/es/descriptions/hooks/useItems.js +9 -1
  9. package/es/descriptions/index.js +3 -2
  10. package/es/descriptions/style/index.d.ts +3 -0
  11. package/es/descriptions/style/index.js +30 -3
  12. package/es/empty/colored.js +7 -4
  13. package/es/empty/database.js +7 -4
  14. package/es/empty/guide.js +7 -4
  15. package/es/form/FormItem.d.ts +13 -8
  16. package/es/form/FormItem.js +35 -8
  17. package/es/form/index.js +22 -12
  18. package/es/form/style/index.d.ts +9 -0
  19. package/es/form/style/index.js +20 -0
  20. package/es/result/404.js +14 -8
  21. package/es/result/500.js +7 -4
  22. package/es/result/Error.js +9 -5
  23. package/es/result/Processing.js +9 -5
  24. package/es/result/Success.js +39 -24
  25. package/es/result/Warning.js +9 -5
  26. package/es/table/index.d.ts +1 -0
  27. package/es/table/index.js +4 -1
  28. package/es/table/style/index.js +14 -5
  29. package/es/tree-select/index.d.ts +1 -1
  30. package/lib/_util/index.d.ts +1 -0
  31. package/lib/_util/index.js +49 -0
  32. package/lib/button/index.d.ts +1 -1
  33. package/lib/card/index.js +3 -3
  34. package/lib/card/style/index.js +15 -16
  35. package/lib/descriptions/hooks/useItems.d.ts +2 -2
  36. package/lib/descriptions/hooks/useItems.js +18 -2
  37. package/lib/descriptions/index.js +5 -2
  38. package/lib/descriptions/style/index.d.ts +3 -0
  39. package/lib/descriptions/style/index.js +47 -4
  40. package/lib/form/FormItem.d.ts +13 -8
  41. package/lib/form/FormItem.js +35 -12
  42. package/lib/form/index.js +15 -3
  43. package/lib/form/style/index.d.ts +9 -0
  44. package/lib/form/style/index.js +52 -0
  45. package/lib/table/index.d.ts +1 -0
  46. package/lib/table/index.js +5 -1
  47. package/lib/table/style/index.js +21 -0
  48. package/lib/tree-select/index.d.ts +1 -1
  49. package/package.json +10 -9
@@ -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
+ };
@@ -2,7 +2,7 @@ import type { ButtonProps as AntButtonProps } from 'antd/es/button';
2
2
  import React from 'react';
3
3
  export * from 'antd/es/button';
4
4
  export type ButtonProps = AntButtonProps;
5
- declare const _default: React.ForwardRefExoticComponent<AntButtonProps & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>> & {
5
+ declare const _default: React.ForwardRefExoticComponent<AntButtonProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & {
6
6
  Group: React.FC<import("antd/es/button").ButtonGroupProps>;
7
7
  __ANT_BUTTON: boolean;
8
8
  };
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) {
@@ -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/jsx-runtime").JSX.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;
@@ -12,9 +12,9 @@ export default function useItems(items?: DescriptionsItemType[], children?: Reac
12
12
  };
13
13
  label?: React.ReactNode;
14
14
  style?: React.CSSProperties;
15
+ key?: React.Key;
15
16
  className?: string;
16
17
  prefixCls?: string;
17
- key?: React.Key;
18
18
  classNames?: Partial<Record<"label" | "content", string>>;
19
19
  styles?: Partial<Record<"label" | "content", React.CSSProperties>>;
20
20
  labelStyle?: React.CSSProperties;
@@ -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) {
@@ -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?: "" | "success" | "warning" | "error" | "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;
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "tooltip"],
1
+ var _excluded = ["children", "label", "tooltip", "action", "layout", "prefixCls", "className"],
2
2
  _excluded2 = ["icon", "type", "overlayInnerStyle"];
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; }
@@ -8,17 +8,36 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
8
8
  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); }
9
9
  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
10
  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 React, { useContext } from 'react';
11
12
  import { Form as AntForm } from 'antd';
12
- import React from 'react';
13
- import { useTooltipTypeList } from "../tooltip/hooks/useTooltipTypeList";
13
+ import { FormContext } from 'antd/es/form/context';
14
14
  import { isPlainObject } from 'lodash';
15
+ import classNames from 'classnames';
16
+ import ConfigProvider from "../config-provider";
17
+ import { useTooltipTypeList } from "../tooltip/hooks/useTooltipTypeList";
18
+ import useStyle from "./style";
15
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { Fragment as _Fragment } from "react/jsx-runtime";
21
+ import { jsxs as _jsxs } from "react/jsx-runtime";
16
22
  var AntFormItem = AntForm.Item;
17
- var Item = function Item(_ref) {
23
+ var FormItem = function FormItem(_ref) {
18
24
  var _children$type;
19
25
  var children = _ref.children,
26
+ label = _ref.label,
20
27
  tooltip = _ref.tooltip,
28
+ action = _ref.action,
29
+ layout = _ref.layout,
30
+ customizePrefixCls = _ref.prefixCls,
31
+ className = _ref.className,
21
32
  restProps = _objectWithoutProperties(_ref, _excluded);
33
+ var _useContext = useContext(ConfigProvider.ConfigContext),
34
+ getPrefixCls = _useContext.getPrefixCls;
35
+ var prefixCls = getPrefixCls('form', customizePrefixCls);
36
+ var _useStyle = useStyle(prefixCls),
37
+ wrapSSR = _useStyle.wrapSSR;
38
+ var formItemCls = classNames(className);
39
+ var _useContext2 = useContext(FormContext),
40
+ vertical = _useContext2.vertical;
22
41
  var typeList = useTooltipTypeList();
23
42
  // tooltip config
24
43
  if (_typeof(tooltip) === 'object' && ! /*#__PURE__*/React.isValidElement(tooltip)) {
@@ -37,16 +56,24 @@ var Item = function Item(_ref) {
37
56
  }, overlayInnerStyle)
38
57
  }, restTooltipProps);
39
58
  }
40
- return /*#__PURE__*/_jsx(AntFormItem, _objectSpread(_objectSpread({
59
+ return wrapSSR( /*#__PURE__*/_jsx(AntFormItem, _objectSpread(_objectSpread({
60
+ layout: layout,
61
+ label: action && (vertical || layout === 'vertical') ? /*#__PURE__*/_jsxs(_Fragment, {
62
+ children: [label, action && /*#__PURE__*/_jsx("span", {
63
+ className: "".concat(prefixCls, "-item-action"),
64
+ children: action
65
+ })]
66
+ }) : label,
41
67
  tooltip: tooltip
42
68
  // auto set required for Switch children to hide optional mark
43
69
  // @ts-ignore
44
70
  ,
45
- required: isPlainObject(children) && (_children$type = children.type) !== null && _children$type !== void 0 && _children$type.__ANT_SWITCH ? true : undefined
71
+ required: isPlainObject(children) && (_children$type = children.type) !== null && _children$type !== void 0 && _children$type.__ANT_SWITCH ? true : undefined,
72
+ prefixCls: customizePrefixCls,
73
+ className: formItemCls
46
74
  }, restProps), {}, {
47
75
  children: children
48
- }));
76
+ })));
49
77
  };
50
- var FormItem = Item;
51
78
  FormItem.useStatus = AntFormItem.useStatus;
52
79
  export default FormItem;
package/es/form/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 = ["hideRequiredMark"];
2
+ var _excluded = ["hideRequiredMark", "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; }
@@ -9,26 +9,36 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
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
10
  import React, { useContext } from 'react';
11
11
  import { Form as AntForm } from 'antd';
12
+ import classNames from 'classnames';
12
13
  import ConfigProvider from "../config-provider";
13
14
  import Item from "./FormItem";
15
+ import useStyle from "./style";
14
16
  import { jsx as _jsx } from "react/jsx-runtime";
15
17
  export * from 'antd/es/form';
16
18
  var Form = function Form(_ref) {
17
19
  var hideRequiredMark = _ref.hideRequiredMark,
20
+ customizePrefixCls = _ref.prefixCls,
21
+ className = _ref.className,
18
22
  restProps = _objectWithoutProperties(_ref, _excluded);
19
23
  var _useContext = useContext(ConfigProvider.ConfigContext),
24
+ getPrefixCls = _useContext.getPrefixCls,
20
25
  contextForm = _useContext.form;
21
- return (
22
- /*#__PURE__*/
23
- // @ts-ignore to ignore children type error
24
- _jsx(AntForm, _objectSpread({
25
- requiredMark:
26
- // could remove hideRequiredMark logic after https://github.com/ant-design/ant-design/pull/46299 is published
27
- hideRequiredMark ? false : (contextForm === null || contextForm === void 0 ? void 0 : contextForm.requiredMark) !== undefined ? contextForm === null || contextForm === void 0 ? void 0 : contextForm.requiredMark : 'optional',
28
- hideRequiredMark: hideRequiredMark,
29
- preserve: false
30
- }, restProps))
31
- );
26
+ var prefixCls = getPrefixCls('form', customizePrefixCls);
27
+ var _useStyle = useStyle(prefixCls),
28
+ wrapSSR = _useStyle.wrapSSR;
29
+ var formCls = classNames(className);
30
+ return wrapSSR(
31
+ /*#__PURE__*/
32
+ // @ts-ignore to ignore children type error
33
+ _jsx(AntForm, _objectSpread({
34
+ requiredMark:
35
+ // could remove hideRequiredMark logic after https://github.com/ant-design/ant-design/pull/46299 is published
36
+ hideRequiredMark ? false : (contextForm === null || contextForm === void 0 ? void 0 : contextForm.requiredMark) !== undefined ? contextForm === null || contextForm === void 0 ? void 0 : contextForm.requiredMark : 'optional',
37
+ hideRequiredMark: hideRequiredMark,
38
+ preserve: false,
39
+ prefixCls: customizePrefixCls,
40
+ className: formCls
41
+ }, restProps)));
32
42
  };
33
43
  Form.Item = Item;
34
44
  Form.List = AntForm.List;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { FullToken, GenerateStyle } from 'antd/es/theme/internal';
3
+ export type FormToken = FullToken<'Form'>;
4
+ export declare const genFormStyle: GenerateStyle<FormToken>;
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,20 @@
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 genFormStyle = function genFormStyle(token) {
7
+ var componentCls = token.componentCls;
8
+ return _defineProperty({}, "".concat(componentCls).concat(componentCls, "-vertical"), _defineProperty({}, "".concat(componentCls, "-item:not(").concat(componentCls, "-item-horizontal)"), _defineProperty({}, "".concat(componentCls, "-item-label > label"), _defineProperty({
9
+ width: '100%'
10
+ }, "".concat(componentCls, "-item-action"), {
11
+ position: 'absolute',
12
+ right: 0
13
+ }))));
14
+ };
15
+ export default (function (prefixCls) {
16
+ var useStyle = genComponentStyleHook('Form', function (token) {
17
+ return [genFormStyle(token)];
18
+ });
19
+ return useStyle(prefixCls);
20
+ });