@oceanbase/design 1.0.0-alpha.2 → 1.0.0-alpha.4
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.
- package/dist/design.min.js +1 -1
- package/es/_util/genComponentStyleHook.d.ts +2 -2
- package/es/_util/genComponentStyleHook.js +15 -2
- package/es/alert/index.d.ts +2 -2
- package/es/alert/index.js +13 -4
- package/es/alert/style/index.d.ts +1 -1
- package/es/alert/style/index.js +152 -58
- package/es/app/index.d.ts +8 -0
- package/es/app/index.js +36 -1
- package/es/app/style/index.d.ts +9 -0
- package/es/{_util/genStyle.js → app/style/index.js} +10 -11
- package/es/badge/index.js +2 -3
- package/es/badge/style/index.d.ts +1 -1
- package/es/badge/style/index.js +1 -3
- package/es/button/style/index.d.ts +1 -1
- package/es/card/index.d.ts +4 -0
- package/es/card/index.js +64 -7
- package/es/card/style/index.d.ts +1 -1
- package/es/card/style/index.js +32 -8
- package/es/checkbox/style/index.d.ts +1 -1
- package/es/config-provider/context.d.ts +11 -0
- package/es/config-provider/context.js +2 -1
- package/es/config-provider/index.d.ts +2 -2
- package/es/config-provider/index.js +57 -34
- package/es/descriptions/style/index.d.ts +1 -1
- package/es/drawer/index.js +7 -5
- package/es/drawer/style/index.d.ts +1 -1
- package/es/drawer/style/index.js +31 -9
- package/es/empty/index.js +1 -1
- package/es/empty/style/index.d.ts +1 -1
- package/es/form/FormItem.d.ts +2 -1
- package/es/form/FormItem.js +14 -4
- package/es/form/style/index.d.ts +1 -1
- package/es/form/style/index.js +13 -2
- package/es/index.d.ts +4 -2
- package/es/index.js +1 -0
- package/es/input-number/index.d.ts +2 -1
- package/es/locale/ja-JP.d.ts +3 -0
- package/es/locale/ja-JP.js +28 -0
- package/es/modal/Modal.js +20 -6
- package/es/modal/style/index.d.ts +1 -1
- package/es/modal/style/index.js +62 -19
- package/es/radio/style/index.d.ts +1 -1
- package/es/result/index.d.ts +2 -2
- package/es/result/index.js +5 -4
- package/es/result/style/index.d.ts +1 -1
- package/es/select/style/index.d.ts +1 -1
- package/es/slider/style/index.d.ts +1 -1
- package/es/space/style/index.d.ts +1 -1
- package/es/spin/style/index.d.ts +1 -1
- package/es/static-function/index.js +13 -4
- package/es/switch/style/index.d.ts +1 -1
- package/es/table/style/index.d.ts +1 -1
- package/es/table/style/index.js +3 -4
- package/es/tabs/style/index.d.ts +1 -1
- package/es/tabs/style/index.js +4 -2
- package/es/tag/index.d.ts +1 -0
- package/es/tag/index.js +3 -2
- package/es/tag/style/index.d.ts +2 -4
- package/es/tag/style/index.js +20 -31
- package/es/theme/dark.d.ts +1 -48
- package/es/theme/default.d.ts +4 -2
- package/es/theme/default.js +59 -28
- package/es/theme/index.d.ts +20 -57
- package/es/theme/interface.d.ts +66 -0
- package/es/theme/interface.js +4 -1
- package/es/theme/style/aliyun.less +40 -40
- package/es/theme/style/compact.less +79 -72
- package/es/theme/style/dark.less +53 -53
- package/es/theme/style/default.less +79 -72
- package/es/tooltip/style/index.d.ts +1 -1
- package/es/tree-select/style/index.d.ts +1 -1
- package/lib/_util/genComponentStyleHook.d.ts +2 -2
- package/lib/_util/genComponentStyleHook.js +20 -4
- package/lib/alert/index.d.ts +2 -2
- package/lib/alert/index.js +18 -9
- package/lib/alert/style/index.d.ts +1 -1
- package/lib/alert/style/index.js +170 -71
- package/lib/app/index.d.ts +8 -0
- package/lib/app/index.js +36 -1
- package/lib/app/style/index.d.ts +9 -0
- package/lib/{_util/getWeakenBorderColor.js → app/style/index.js} +20 -10
- package/lib/badge/index.js +23 -20
- package/lib/badge/style/index.d.ts +1 -1
- package/lib/badge/style/index.js +1 -3
- package/lib/button/index.js +2 -1
- package/lib/button/style/index.d.ts +1 -1
- package/lib/card/index.d.ts +4 -0
- package/lib/card/index.js +70 -9
- package/lib/card/style/index.d.ts +1 -1
- package/lib/card/style/index.js +56 -10
- package/lib/checkbox/index.js +2 -1
- package/lib/checkbox/style/index.d.ts +1 -1
- package/lib/config-provider/DefaultRenderEmpty.js +4 -3
- package/lib/config-provider/context.d.ts +11 -0
- package/lib/config-provider/index.d.ts +2 -2
- package/lib/config-provider/index.js +70 -26
- package/lib/descriptions/hooks/useItems.js +5 -4
- package/lib/descriptions/index.js +3 -2
- package/lib/descriptions/style/index.d.ts +1 -1
- package/lib/drawer/index.js +44 -33
- package/lib/drawer/style/index.d.ts +1 -1
- package/lib/drawer/style/index.js +33 -6
- package/lib/dropdown/dropdown-button.js +3 -13
- package/lib/dropdown/index.js +2 -2
- package/lib/empty/colored.js +413 -327
- package/lib/empty/database.js +267 -222
- package/lib/empty/default.js +16 -21
- package/lib/empty/guide.js +201 -184
- package/lib/empty/index.js +23 -18
- package/lib/empty/style/index.d.ts +1 -1
- package/lib/form/FormItem.d.ts +2 -1
- package/lib/form/FormItem.js +18 -6
- package/lib/form/index.js +6 -3
- package/lib/form/style/index.d.ts +1 -1
- package/lib/form/style/index.js +19 -0
- package/lib/grid/col.js +2 -1
- package/lib/grid/row.js +2 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +3 -0
- package/lib/input/Input.js +3 -2
- package/lib/input/Password.js +3 -2
- package/lib/input/Search.js +3 -2
- package/lib/input/TextArea.js +3 -2
- package/lib/input-number/index.d.ts +2 -1
- package/lib/input-number/index.js +2 -1
- package/lib/list/index.js +3 -2
- package/lib/locale/ja-JP.d.ts +3 -0
- package/lib/locale/ja-JP.js +60 -0
- package/lib/lottie/index.js +2 -1
- package/lib/modal/Modal.js +33 -9
- package/lib/modal/Progress.js +9 -5
- package/lib/modal/style/index.d.ts +1 -1
- package/lib/modal/style/index.js +76 -17
- package/lib/radio/index.js +2 -1
- package/lib/radio/style/index.d.ts +1 -1
- package/lib/result/403.js +156 -121
- package/lib/result/404.js +328 -267
- package/lib/result/500.js +295 -257
- package/lib/result/Error.js +127 -99
- package/lib/result/Processing.js +246 -213
- package/lib/result/Success.js +233 -169
- package/lib/result/Warning.js +611 -515
- package/lib/result/index.d.ts +2 -2
- package/lib/result/index.js +12 -11
- package/lib/result/style/index.d.ts +1 -1
- package/lib/segmented/index.js +8 -4
- package/lib/select/index.js +2 -1
- package/lib/select/style/index.d.ts +1 -1
- package/lib/slider/index.js +2 -1
- package/lib/slider/style/index.d.ts +1 -1
- package/lib/space/index.js +2 -1
- package/lib/space/style/index.d.ts +1 -1
- package/lib/spin/index.js +5 -4
- package/lib/spin/style/index.d.ts +1 -1
- package/lib/static-function/index.js +7 -1
- package/lib/switch/index.js +2 -1
- package/lib/switch/style/index.d.ts +1 -1
- package/lib/table/index.js +44 -31
- package/lib/table/style/index.d.ts +1 -1
- package/lib/table/style/index.js +3 -4
- package/lib/tabs/index.js +10 -5
- package/lib/tabs/style/index.d.ts +1 -1
- package/lib/tabs/style/index.js +5 -0
- package/lib/tag/index.d.ts +1 -0
- package/lib/tag/index.js +12 -6
- package/lib/tag/style/index.d.ts +2 -4
- package/lib/tag/style/index.js +20 -27
- package/lib/theme/dark.d.ts +1 -48
- package/lib/theme/default.d.ts +4 -2
- package/lib/theme/default.js +67 -27
- package/lib/theme/index.d.ts +20 -57
- package/lib/theme/interface.d.ts +66 -0
- package/lib/theme/style/aliyun.less +40 -40
- package/lib/theme/style/compact.less +79 -72
- package/lib/theme/style/dark.less +53 -53
- package/lib/theme/style/default.less +79 -72
- package/lib/tooltip/MouseTooltip.js +43 -39
- package/lib/tooltip/ReactStickyMouseTooltip.js +5 -4
- package/lib/tooltip/index.js +14 -10
- package/lib/tooltip/style/index.d.ts +1 -1
- package/lib/tree-select/index.js +2 -1
- package/lib/tree-select/style/index.d.ts +1 -1
- package/lib/typography/Link.js +5 -4
- package/lib/typography/Paragraph.js +5 -4
- package/lib/typography/Text.js +5 -4
- package/lib/typography/Title.js +5 -4
- package/package.json +7 -6
- package/es/_util/genStyle.d.ts +0 -2
- package/es/_util/getWeakenBorderColor.d.ts +0 -1
- package/es/_util/getWeakenBorderColor.js +0 -4
- package/lib/_util/genStyle.d.ts +0 -2
- package/lib/_util/genStyle.js +0 -43
- package/lib/_util/getWeakenBorderColor.d.ts +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CSSObject } from '@ant-design/cssinjs';
|
|
3
3
|
import type { ComponentTokenMap } from 'antd/es/theme/interface';
|
|
4
|
-
import type { FullToken, GenerateStyle } from '
|
|
5
|
-
|
|
4
|
+
import type { GlobalToken, FullToken, GenerateStyle } from '../theme/interface';
|
|
5
|
+
export declare const genSelectCommonStyle: (token: FullToken<'Select' | 'TreeSelect' | 'Cascader'>) => CSSObject;
|
|
6
6
|
export type ComponentName = keyof ComponentTokenMap;
|
|
7
7
|
export declare function genComponentStyleHook(componentName: ComponentName, styleFn: GenerateStyle<FullToken<ComponentName>>, getDefaultToken?: Partial<FullToken<ComponentName>> | ((token: GlobalToken) => Partial<FullToken<ComponentName>>)): (prefixCls: string) => {
|
|
8
8
|
wrapSSR: (node: React.ReactNode) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
@@ -1,15 +1,28 @@
|
|
|
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); }
|
|
1
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
3
|
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."); }
|
|
3
4
|
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); }
|
|
4
5
|
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; }
|
|
5
6
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
|
|
8
|
+
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
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); }
|
|
11
|
+
import { genComponentStyleHook as antGenComponentStyleHook } from "../theme/internal";
|
|
8
12
|
import theme from "../theme";
|
|
13
|
+
|
|
14
|
+
// work for Select, TreeSelect, Cascader
|
|
15
|
+
export var genSelectCommonStyle = function genSelectCommonStyle(token) {
|
|
16
|
+
var antCls = token.antCls;
|
|
17
|
+
var selectComponentCls = "".concat(antCls, "-select");
|
|
18
|
+
return _defineProperty({}, "".concat(selectComponentCls).concat(selectComponentCls, "-multiple"), _defineProperty({}, "".concat(selectComponentCls, "-selection-item"), {
|
|
19
|
+
borderRadius: token.borderRadius
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
9
22
|
export function genComponentStyleHook(componentName, styleFn, getDefaultToken) {
|
|
10
23
|
return function (prefixCls) {
|
|
11
24
|
var useStyle = antGenComponentStyleHook("OB-".concat(componentName), function (token) {
|
|
12
|
-
return [styleFn(token)];
|
|
25
|
+
return [genSelectCommonStyle(token), styleFn(token)];
|
|
13
26
|
}, getDefaultToken, {
|
|
14
27
|
resetStyle: false,
|
|
15
28
|
// antd style order is -999 and -998
|
package/es/alert/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ 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
|
+
mini?: boolean;
|
|
7
7
|
}
|
|
8
8
|
declare const Alert: {
|
|
9
|
-
({ type, ghost,
|
|
9
|
+
({ type: typeProp, showIcon, closable, ghost, mini, banner, 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 = ["type", "ghost", "
|
|
2
|
+
var _excluded = ["type", "showIcon", "closable", "ghost", "mini", "banner", "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; }
|
|
@@ -22,20 +22,29 @@ var iconMapOutlined = {
|
|
|
22
22
|
warning: /*#__PURE__*/_jsx(ExclamationCircleOutlined, {})
|
|
23
23
|
};
|
|
24
24
|
var Alert = function Alert(_ref) {
|
|
25
|
-
var
|
|
25
|
+
var typeProp = _ref.type,
|
|
26
|
+
_ref$showIcon = _ref.showIcon,
|
|
27
|
+
showIcon = _ref$showIcon === void 0 ? true : _ref$showIcon,
|
|
28
|
+
closable = _ref.closable,
|
|
26
29
|
ghost = _ref.ghost,
|
|
27
|
-
|
|
30
|
+
mini = _ref.mini,
|
|
31
|
+
banner = _ref.banner,
|
|
28
32
|
customizePrefixCls = _ref.prefixCls,
|
|
29
33
|
className = _ref.className,
|
|
30
34
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
+
// banner exists and type is empty, use warning type by default for correct icon
|
|
36
|
+
var type = banner && !typeProp ? 'warning' : typeProp;
|
|
31
37
|
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
32
38
|
getPrefixCls = _useContext.getPrefixCls;
|
|
33
39
|
var prefixCls = getPrefixCls('alert', customizePrefixCls);
|
|
34
40
|
var _useStyle = useStyle(prefixCls),
|
|
35
41
|
wrapSSR = _useStyle.wrapSSR;
|
|
36
|
-
var alertCls = classNames(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-ghost"), ghost), "".concat(prefixCls, "-
|
|
42
|
+
var alertCls = classNames(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-closable"), closable), "".concat(prefixCls, "-ghost"), ghost), "".concat(prefixCls, "-mini"), mini), className);
|
|
37
43
|
return wrapSSR( /*#__PURE__*/_jsx(AntAlert, _objectSpread({
|
|
38
44
|
type: type,
|
|
45
|
+
showIcon: showIcon,
|
|
46
|
+
closable: closable,
|
|
47
|
+
banner: banner,
|
|
39
48
|
icon: iconMapOutlined[type],
|
|
40
49
|
prefixCls: customizePrefixCls,
|
|
41
50
|
className: alertCls
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { FullToken, GenerateStyle } from '
|
|
2
|
+
import type { FullToken, GenerateStyle } from '../../theme/interface';
|
|
3
3
|
export type AlertToken = FullToken<'Alert'>;
|
|
4
4
|
export declare const genAlertStyle: GenerateStyle<AlertToken>;
|
|
5
5
|
declare const _default: (prefixCls: string) => {
|
package/es/alert/style/index.js
CHANGED
|
@@ -3,91 +3,185 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
3
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
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
5
|
import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
import { upperFirst } from 'lodash';
|
|
7
|
+
var genAlertTypeStyle = function genAlertTypeStyle(type, token) {
|
|
8
|
+
var componentCls = token.componentCls;
|
|
9
|
+
var textColor = token["color".concat(upperFirst(type), "Text")];
|
|
10
|
+
var hoverColor = token["color".concat(upperFirst(type), "TextHover")];
|
|
11
|
+
var activeColor = token["color".concat(upperFirst(type), "TextActive")];
|
|
12
|
+
var linkStyle = {
|
|
13
|
+
color: textColor,
|
|
14
|
+
textDecoration: 'underline',
|
|
15
|
+
'&:hover': {
|
|
16
|
+
color: hoverColor
|
|
17
|
+
},
|
|
18
|
+
'&:active': {
|
|
19
|
+
color: activeColor
|
|
20
|
+
}
|
|
21
21
|
};
|
|
22
|
-
};
|
|
23
|
-
var genColoredStyle = function genColoredStyle(color, colorHover, token) {
|
|
24
|
-
var componentCls = token.componentCls,
|
|
25
|
-
iconCls = token.iconCls;
|
|
26
22
|
return _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-message"), {
|
|
27
|
-
color:
|
|
23
|
+
color: textColor,
|
|
24
|
+
a: linkStyle
|
|
28
25
|
}), "".concat(componentCls, "-description"), {
|
|
29
|
-
|
|
30
|
-
}), "".concat(componentCls, "-
|
|
31
|
-
color:
|
|
32
|
-
|
|
33
|
-
color: colorHover
|
|
34
|
-
}
|
|
35
|
-
}), "".concat(componentCls, "-close-text"), {
|
|
36
|
-
color: color,
|
|
37
|
-
'&:hover': {
|
|
38
|
-
color: colorHover
|
|
39
|
-
}
|
|
40
|
-
}));
|
|
26
|
+
a: linkStyle
|
|
27
|
+
}), "".concat(componentCls, "-icon"), {
|
|
28
|
+
color: textColor
|
|
29
|
+
});
|
|
41
30
|
};
|
|
42
31
|
export var genAlertStyle = function genAlertStyle(token) {
|
|
43
32
|
var componentCls = token.componentCls,
|
|
44
|
-
colorSuccess = token.colorSuccess,
|
|
45
|
-
colorSuccessHover = token.colorSuccessHover,
|
|
46
|
-
colorInfo = token.colorInfo,
|
|
47
|
-
colorInfoHover = token.colorInfoHover,
|
|
48
|
-
colorWarning = token.colorWarning,
|
|
49
|
-
colorWarningHover = token.colorWarningHover,
|
|
50
|
-
colorError = token.colorError,
|
|
51
|
-
colorErrorHover = token.colorErrorHover,
|
|
52
33
|
colorIcon = token.colorIcon,
|
|
53
34
|
colorIconHover = token.colorIconHover,
|
|
54
35
|
motionDurationMid = token.motionDurationMid;
|
|
55
36
|
// height = fontSize * lineHeight
|
|
56
37
|
var height = token.fontSize * token.lineHeight;
|
|
57
|
-
|
|
38
|
+
// icon width = fontSizeLG (icon size)
|
|
39
|
+
var iconWidth = token.fontSizeLG;
|
|
40
|
+
// content and action start position = icon width + icon margin
|
|
41
|
+
var contentStartOffset = iconWidth + token.marginXS;
|
|
42
|
+
// close icon width (approximate)
|
|
43
|
+
var closeIconWidth = height;
|
|
44
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
58
45
|
// vertical align to flex-start
|
|
59
46
|
alignItems: 'flex-start !important',
|
|
60
|
-
|
|
47
|
+
paddingInline: token.padding,
|
|
48
|
+
position: 'relative'
|
|
61
49
|
}, "".concat(componentCls, "-icon"), {
|
|
62
|
-
height: height
|
|
50
|
+
height: height,
|
|
51
|
+
fontSize: token.fontSizeLG,
|
|
52
|
+
marginInlineEnd: token.marginXS,
|
|
53
|
+
flexShrink: 0
|
|
63
54
|
}), "".concat(componentCls, "-close-icon"), {
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
top: token.paddingXS,
|
|
57
|
+
insetInlineEnd: token.padding,
|
|
64
58
|
height: height,
|
|
65
59
|
color: colorIcon,
|
|
66
60
|
transition: "color ".concat(motionDurationMid),
|
|
61
|
+
flexShrink: 0,
|
|
62
|
+
display: 'flex',
|
|
63
|
+
alignItems: 'center',
|
|
67
64
|
'&:hover': {
|
|
68
65
|
color: colorIconHover
|
|
69
66
|
}
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
}), "".concat(componentCls, "-message"), {
|
|
68
|
+
a: {
|
|
69
|
+
textDecoration: 'underline'
|
|
70
|
+
}
|
|
71
|
+
}), "".concat(componentCls, "-description"), {
|
|
72
|
+
a: {
|
|
73
|
+
textDecoration: 'underline'
|
|
74
|
+
}
|
|
75
|
+
}), "&".concat(componentCls, "-success"), genAlertTypeStyle('success', token)), "&".concat(componentCls, "-info"), genAlertTypeStyle('info', token)), "&".concat(componentCls, "-warning"), genAlertTypeStyle('warning', token)), "&".concat(componentCls, "-error"), genAlertTypeStyle('error', token))), "".concat(componentCls, ":not(").concat(componentCls, "-with-description)"), _defineProperty(_defineProperty({
|
|
76
|
+
flexWrap: 'wrap'
|
|
77
|
+
}, "".concat(componentCls, "-content"), {
|
|
78
|
+
flex: "1 1 calc(100% - ".concat(contentStartOffset + closeIconWidth + token.padding, "px)"),
|
|
79
|
+
minWidth: 0,
|
|
80
|
+
maxWidth: "calc(100% - ".concat(contentStartOffset + closeIconWidth + token.padding, "px)"),
|
|
81
|
+
wordBreak: 'break-word'
|
|
82
|
+
}), "".concat(componentCls, "-action"), {
|
|
83
|
+
width: "calc(100% - ".concat(contentStartOffset + token.padding, "px)"),
|
|
84
|
+
marginInlineStart: contentStartOffset,
|
|
85
|
+
marginTop: token.marginXS
|
|
86
|
+
})), "".concat(componentCls).concat(componentCls, "-with-description"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
87
|
+
paddingBlock: token.paddingSM,
|
|
88
|
+
flexWrap: 'wrap'
|
|
74
89
|
}, "".concat(componentCls, "-message"), {
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
fontSize: token.fontSize,
|
|
91
|
+
fontWeight: token.fontWeightStrong,
|
|
92
|
+
marginBottom: token.marginXXS,
|
|
93
|
+
wordBreak: 'break-word'
|
|
77
94
|
}), "".concat(componentCls, "-description"), {
|
|
78
|
-
|
|
79
|
-
}), "".concat(componentCls, "-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
95
|
+
wordBreak: 'break-word'
|
|
96
|
+
}), "".concat(componentCls, "-content"), {
|
|
97
|
+
flex: "1 1 calc(100% - ".concat(contentStartOffset + closeIconWidth + token.padding, "px)"),
|
|
98
|
+
minWidth: 0,
|
|
99
|
+
maxWidth: "calc(100% - ".concat(contentStartOffset + closeIconWidth + token.padding, "px)"),
|
|
100
|
+
wordBreak: 'break-word'
|
|
83
101
|
}), "".concat(componentCls, "-action"), {
|
|
84
|
-
|
|
85
|
-
|
|
102
|
+
width: "calc(100% - ".concat(contentStartOffset + token.padding, "px)"),
|
|
103
|
+
marginInlineStart: contentStartOffset,
|
|
104
|
+
marginTop: token.marginSM
|
|
105
|
+
}), "".concat(componentCls, "-close-icon"), {
|
|
106
|
+
top: token.paddingSM
|
|
107
|
+
})), "".concat(componentCls).concat(componentCls, "-ghost"), {
|
|
86
108
|
backgroundColor: 'transparent',
|
|
87
109
|
border: 'none',
|
|
88
|
-
padding:
|
|
110
|
+
padding: '0px !important',
|
|
89
111
|
borderRadius: 0
|
|
90
|
-
}), "".concat(componentCls
|
|
112
|
+
}), "".concat(componentCls).concat(componentCls, "-mini"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
113
|
+
paddingBlock: token.paddingXXS,
|
|
114
|
+
paddingInline: token.paddingXS,
|
|
115
|
+
border: 'none',
|
|
116
|
+
width: 'fit-content',
|
|
117
|
+
display: 'inline-flex',
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
flexWrap: 'nowrap'
|
|
120
|
+
}, "".concat(componentCls, "-icon"), {
|
|
121
|
+
marginInlineEnd: token.paddingXS,
|
|
122
|
+
flexShrink: 0,
|
|
123
|
+
display: 'flex',
|
|
124
|
+
alignItems: 'center',
|
|
125
|
+
justifyContent: 'center',
|
|
126
|
+
lineHeight: 1
|
|
127
|
+
}), "".concat(componentCls, "-message"), {
|
|
128
|
+
whiteSpace: 'nowrap',
|
|
129
|
+
wordBreak: 'normal',
|
|
130
|
+
overflow: 'visible',
|
|
131
|
+
lineHeight: token.lineHeight,
|
|
132
|
+
display: 'flex',
|
|
133
|
+
alignItems: 'center'
|
|
134
|
+
}), "".concat(componentCls, "-content"), {
|
|
135
|
+
display: 'flex',
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
flex: '0 1 auto',
|
|
138
|
+
whiteSpace: 'nowrap',
|
|
139
|
+
minWidth: 0,
|
|
140
|
+
lineHeight: token.lineHeight
|
|
141
|
+
}), "".concat(componentCls, "-close-icon"), {
|
|
142
|
+
position: 'relative',
|
|
143
|
+
top: token.paddingXXS,
|
|
144
|
+
insetInlineEnd: 'auto',
|
|
145
|
+
height: 'auto',
|
|
146
|
+
flexShrink: 0,
|
|
147
|
+
marginInlineStart: 0
|
|
148
|
+
}), "&".concat(componentCls, "-closable"), _defineProperty({}, "".concat(componentCls, "-content"), {
|
|
149
|
+
paddingInlineEnd: token.paddingXS
|
|
150
|
+
})), "&:not(".concat(componentCls, "-with-description)"), _defineProperty({
|
|
151
|
+
flexWrap: 'nowrap'
|
|
152
|
+
}, "".concat(componentCls, "-content"), {
|
|
153
|
+
flex: '0 1 auto',
|
|
154
|
+
minWidth: 0,
|
|
155
|
+
maxWidth: 'none',
|
|
156
|
+
wordBreak: 'normal'
|
|
157
|
+
})), "&".concat(componentCls, "-with-description"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
158
|
+
paddingBlock: token.paddingXXS,
|
|
159
|
+
flexDirection: 'row',
|
|
160
|
+
alignItems: 'flex-start',
|
|
161
|
+
position: 'relative',
|
|
162
|
+
flexWrap: 'nowrap'
|
|
163
|
+
}, "".concat(componentCls, "-icon"), {
|
|
164
|
+
alignSelf: 'flex-start',
|
|
165
|
+
marginTop: 0
|
|
166
|
+
}), "".concat(componentCls, "-content"), {
|
|
167
|
+
flexDirection: 'column',
|
|
168
|
+
alignItems: 'flex-start',
|
|
169
|
+
flex: '0 1 auto',
|
|
170
|
+
minWidth: 0,
|
|
171
|
+
maxWidth: 'none',
|
|
172
|
+
wordBreak: 'normal'
|
|
173
|
+
}), "".concat(componentCls, "-message"), {
|
|
174
|
+
marginBottom: token.marginXXS,
|
|
175
|
+
whiteSpace: 'nowrap',
|
|
176
|
+
wordBreak: 'normal'
|
|
177
|
+
}), "".concat(componentCls, "-description"), {
|
|
178
|
+
whiteSpace: 'nowrap',
|
|
179
|
+
wordBreak: 'normal'
|
|
180
|
+
}), "".concat(componentCls, "-close-icon"), {
|
|
181
|
+
position: 'absolute',
|
|
182
|
+
top: token.paddingXXS,
|
|
183
|
+
insetInlineEnd: token.paddingXS
|
|
184
|
+
})));
|
|
91
185
|
};
|
|
92
186
|
export default (function (prefixCls) {
|
|
93
187
|
var useStyle = genComponentStyleHook('Alert', function (token) {
|
package/es/app/index.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { App as AntApp } from 'antd';
|
|
3
|
+
import type { AppProps } from 'antd/es/app';
|
|
1
4
|
export * from 'antd/es/app';
|
|
5
|
+
export type AppType = React.FC<AppProps> & {
|
|
6
|
+
useApp: typeof AntApp.useApp;
|
|
7
|
+
};
|
|
8
|
+
declare const App: AppType;
|
|
9
|
+
export default App;
|
package/es/app/index.js
CHANGED
|
@@ -1 +1,36 @@
|
|
|
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 = ["prefixCls", "className"];
|
|
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, { useContext } from 'react';
|
|
11
|
+
import { App as AntApp } from 'antd';
|
|
12
|
+
import classNames from 'classnames';
|
|
13
|
+
import ConfigProvider from "../config-provider";
|
|
14
|
+
import useStyle from "./style";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
export * from 'antd/es/app';
|
|
17
|
+
var App = function App(_ref) {
|
|
18
|
+
var customizePrefixCls = _ref.prefixCls,
|
|
19
|
+
className = _ref.className,
|
|
20
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
22
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
23
|
+
var prefixCls = getPrefixCls('app', customizePrefixCls);
|
|
24
|
+
var _useStyle = useStyle(prefixCls),
|
|
25
|
+
wrapSSR = _useStyle.wrapSSR;
|
|
26
|
+
var appCls = classNames(className);
|
|
27
|
+
return wrapSSR( /*#__PURE__*/_jsx(AntApp, _objectSpread({
|
|
28
|
+
prefixCls: customizePrefixCls,
|
|
29
|
+
className: appCls
|
|
30
|
+
}, restProps)));
|
|
31
|
+
};
|
|
32
|
+
App.useApp = AntApp.useApp;
|
|
33
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
34
|
+
App.displayName = AntApp.displayName;
|
|
35
|
+
}
|
|
36
|
+
export default App;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FullToken, GenerateStyle } from '../../theme/interface';
|
|
3
|
+
export type AppToken = FullToken<'App'>;
|
|
4
|
+
export declare const genAppStyle: GenerateStyle<AppToken>;
|
|
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;
|
|
@@ -2,15 +2,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
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
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
borderStartStartRadius: 0,
|
|
14
|
-
borderEndStartRadius: 0
|
|
5
|
+
import { genComponentStyleHook } from "../../_util/genComponentStyleHook";
|
|
6
|
+
export var genAppStyle = function genAppStyle(token) {
|
|
7
|
+
var componentCls = token.componentCls;
|
|
8
|
+
return _defineProperty({}, "".concat(componentCls), {});
|
|
9
|
+
};
|
|
10
|
+
export default (function (prefixCls) {
|
|
11
|
+
var useStyle = genComponentStyleHook('App', function (token) {
|
|
12
|
+
return [genAppStyle(token)];
|
|
15
13
|
});
|
|
16
|
-
|
|
14
|
+
return useStyle(prefixCls);
|
|
15
|
+
});
|
package/es/badge/index.js
CHANGED
|
@@ -25,8 +25,7 @@ var Badge = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
25
25
|
icon = _ref.icon,
|
|
26
26
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
27
27
|
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
28
|
-
getPrefixCls = _useContext.getPrefixCls
|
|
29
|
-
iconPrefixCls = _useContext.iconPrefixCls;
|
|
28
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
30
29
|
var prefixCls = getPrefixCls('badge', customizePrefixCls);
|
|
31
30
|
var _useStyle = useStyle(prefixCls),
|
|
32
31
|
wrapSSR = _useStyle.wrapSSR,
|
|
@@ -39,7 +38,7 @@ var Badge = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
39
38
|
style: {
|
|
40
39
|
display: 'inline-block'
|
|
41
40
|
},
|
|
42
|
-
|
|
41
|
+
spin: true
|
|
43
42
|
}),
|
|
44
43
|
success: /*#__PURE__*/_jsx(CheckCircleFilled, {}),
|
|
45
44
|
error: /*#__PURE__*/_jsx(CloseCircleFilled, {}),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { FullToken, GenerateStyle } from '
|
|
2
|
+
import type { FullToken, GenerateStyle } from '../../theme/interface';
|
|
3
3
|
export type BadgeToken = FullToken<'Badge'>;
|
|
4
4
|
export declare const genBadgeStyle: GenerateStyle<BadgeToken>;
|
|
5
5
|
declare const _default: (prefixCls: string) => {
|
package/es/badge/style/index.js
CHANGED
|
@@ -9,9 +9,7 @@ export var genBadgeStyle = function genBadgeStyle(token) {
|
|
|
9
9
|
// make status text inherit parent style
|
|
10
10
|
color: 'inherit',
|
|
11
11
|
fontSize: 'inherit'
|
|
12
|
-
}), "".concat(componentCls).concat(componentCls, "-status"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-status-dot"), _defineProperty({}, "&".concat(componentCls, "-status-default"), {
|
|
13
|
-
backgroundColor: token.colorFill
|
|
14
|
-
})), "".concat(componentCls, "-status-icon"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
12
|
+
}), "".concat(componentCls).concat(componentCls, "-status"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-status-dot"), _defineProperty({}, "&".concat(componentCls, "-status-default"), {})), "".concat(componentCls, "-status-icon"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
15
13
|
// remove dot style
|
|
16
14
|
backgroundColor: 'transparent'
|
|
17
15
|
}, '&::after', {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { FullToken, GenerateStyle } from '
|
|
2
|
+
import type { FullToken, GenerateStyle } from '../../theme/interface';
|
|
3
3
|
export type ButtonToken = FullToken<'Button'>;
|
|
4
4
|
export declare const genButtonStyle: GenerateStyle<ButtonToken>;
|
|
5
5
|
declare const _default: (prefixCls: string, isAliyun?: boolean) => {
|
package/es/card/index.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export interface CardTabListType extends AntCardTabListType {
|
|
|
8
8
|
export interface CardProps extends AntCardProps {
|
|
9
9
|
divided?: boolean;
|
|
10
10
|
tabList?: CardTabListType[];
|
|
11
|
+
collapsible?: boolean;
|
|
12
|
+
defaultCollapsed?: boolean;
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
11
15
|
}
|
|
12
16
|
declare const _default: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>> & {
|
|
13
17
|
Grid: React.FC<import("antd/es/card").CardGridProps>;
|
package/es/card/index.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
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", "size", "title", "tabList", "tabProps", "divided", "prefixCls", "bodyStyle", "styles", "className"];
|
|
2
|
+
var _excluded = ["children", "size", "title", "tabList", "tabProps", "divided", "prefixCls", "bodyStyle", "styles", "className", "collapsible", "defaultCollapsed", "collapsed", "onCollapse", "extra"];
|
|
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; }
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
14
|
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
15
|
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
16
|
import { isNullValue } from '@oceanbase/util';
|
|
11
17
|
import { Card as AntCard, Space, Tag } from 'antd';
|
|
12
18
|
import classNames from 'classnames';
|
|
13
|
-
import React, { useContext } from 'react';
|
|
19
|
+
import React, { useContext, useState, useMemo, useCallback } from 'react';
|
|
20
|
+
import { CaretRightFilled } from '@oceanbase/icons';
|
|
14
21
|
import ConfigProvider from "../config-provider";
|
|
15
22
|
import { isHorizontalPaddingZero } from "../_util";
|
|
23
|
+
import theme from "../theme";
|
|
16
24
|
import useStyle, { genTableStyle } from "./style";
|
|
17
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -30,19 +38,67 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
30
38
|
bodyStyle = _ref.bodyStyle,
|
|
31
39
|
styles = _ref.styles,
|
|
32
40
|
className = _ref.className,
|
|
41
|
+
collapsible = _ref.collapsible,
|
|
42
|
+
defaultCollapsed = _ref.defaultCollapsed,
|
|
43
|
+
outerCollapsed = _ref.collapsed,
|
|
44
|
+
onCollapse = _ref.onCollapse,
|
|
45
|
+
extra = _ref.extra,
|
|
33
46
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
34
47
|
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
35
48
|
getPrefixCls = _useContext.getPrefixCls,
|
|
36
|
-
contextCard = _useContext.card
|
|
49
|
+
contextCard = _useContext.card,
|
|
50
|
+
iconPrefixCls = _useContext.iconPrefixCls;
|
|
51
|
+
var _theme$useToken = theme.useToken(),
|
|
52
|
+
token = _theme$useToken.token;
|
|
37
53
|
var divided = (_ref2 = outerDivided !== null && outerDivided !== void 0 ? outerDivided : contextCard === null || contextCard === void 0 ? void 0 : contextCard.divided) !== null && _ref2 !== void 0 ? _ref2 : true;
|
|
38
54
|
var prefixCls = getPrefixCls('card', customizePrefixCls);
|
|
39
55
|
var tabsPrefixCls = getPrefixCls('tabs', customizePrefixCls);
|
|
40
56
|
var _useStyle = useStyle(prefixCls, tabsPrefixCls),
|
|
41
57
|
wrapSSR = _useStyle.wrapSSR;
|
|
58
|
+
var _useState = useState(defaultCollapsed !== null && defaultCollapsed !== void 0 ? defaultCollapsed : false),
|
|
59
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
60
|
+
internalCollapsed = _useState2[0],
|
|
61
|
+
setInternalCollapsed = _useState2[1];
|
|
62
|
+
var collapsed = outerCollapsed !== undefined ? outerCollapsed : internalCollapsed;
|
|
63
|
+
var handleCollapse = useCallback(function () {
|
|
64
|
+
var newCollapsed = !collapsed;
|
|
65
|
+
if (outerCollapsed === undefined) {
|
|
66
|
+
setInternalCollapsed(newCollapsed);
|
|
67
|
+
}
|
|
68
|
+
onCollapse === null || onCollapse === void 0 || onCollapse(newCollapsed);
|
|
69
|
+
}, [collapsed, outerCollapsed, onCollapse]);
|
|
70
|
+
var cardTitle = useMemo(function () {
|
|
71
|
+
if (!collapsible) {
|
|
72
|
+
return title;
|
|
73
|
+
}
|
|
74
|
+
if (!title) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
78
|
+
className: "".concat(prefixCls, "-title-wrapper"),
|
|
79
|
+
onClick: handleCollapse,
|
|
80
|
+
style: {
|
|
81
|
+
cursor: 'pointer',
|
|
82
|
+
display: 'flex',
|
|
83
|
+
alignItems: 'center'
|
|
84
|
+
},
|
|
85
|
+
children: [/*#__PURE__*/_jsx(CaretRightFilled, {
|
|
86
|
+
className: "".concat(prefixCls, "-collapsible-icon"),
|
|
87
|
+
style: {
|
|
88
|
+
transition: "transform ".concat(token.motionDurationMid),
|
|
89
|
+
transform: collapsed ? undefined : 'rotate(90deg)',
|
|
90
|
+
color: token.colorIcon,
|
|
91
|
+
marginRight: token.marginXS
|
|
92
|
+
}
|
|
93
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
94
|
+
children: title
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
97
|
+
}, [collapsible, title, collapsed, prefixCls, token, handleCollapse]);
|
|
42
98
|
|
|
43
99
|
// card body no horizontal padding
|
|
44
100
|
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);
|
|
45
|
-
var cardCls = classNames(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-has-title"), !!title), "".concat(prefixCls, "-no-divider"), !divided), "".concat(prefixCls, "-no-body-horizontal-padding"), noBodyHorizontalPadding), className);
|
|
101
|
+
var cardCls = classNames(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-has-title"), !!title), "".concat(prefixCls, "-no-divider"), !divided), "".concat(prefixCls, "-no-body-horizontal-padding"), noBodyHorizontalPadding), "".concat(prefixCls, "-collapsible"), collapsible), "".concat(prefixCls, "-collapsed"), collapsed), className);
|
|
46
102
|
var newTabList = tabList === null || tabList === void 0 ? void 0 : tabList.map(function (item) {
|
|
47
103
|
if (!isNullValue(item.tag)) {
|
|
48
104
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -61,15 +117,16 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
61
117
|
return wrapSSR( /*#__PURE__*/_jsx(AntCard, _objectSpread(_objectSpread({
|
|
62
118
|
ref: ref,
|
|
63
119
|
size: size,
|
|
64
|
-
title:
|
|
120
|
+
title: cardTitle,
|
|
65
121
|
tabList: newTabList,
|
|
66
122
|
tabProps: _objectSpread({
|
|
67
123
|
size: 'middle'
|
|
68
124
|
}, tabProps),
|
|
69
125
|
prefixCls: customizePrefixCls,
|
|
70
|
-
bodyStyle: bodyStyle,
|
|
126
|
+
bodyStyle: _objectSpread({}, bodyStyle),
|
|
71
127
|
styles: styles,
|
|
72
|
-
className: cardCls
|
|
128
|
+
className: cardCls,
|
|
129
|
+
extra: extra
|
|
73
130
|
}, restProps), {}, {
|
|
74
131
|
children: children
|
|
75
132
|
})));
|