@oceanbase/design 1.0.0-alpha.0 → 1.0.0-alpha.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.
- package/dist/design.min.css +1 -1
- package/dist/design.min.js +1 -1
- package/dist/reset.css +2 -1
- package/dist/static/Inter-Medium.ea234620.woff2 +0 -0
- package/dist/static/Inter-Regular.34ba43c9.woff2 +0 -0
- package/dist/static/Inter-SemiBold.95439fb4.woff2 +0 -0
- package/es/_util/genComponentStyleHook.d.ts +21 -4
- package/es/_util/genComponentStyleHook.js +68 -20
- package/es/alert/index.d.ts +2 -2
- package/es/alert/index.js +22 -6
- package/es/alert/style/index.d.ts +2 -5
- package/es/alert/style/index.js +157 -67
- package/es/app/index.d.ts +8 -0
- package/es/app/index.js +43 -1
- package/es/app/style/index.d.ts +6 -0
- package/es/app/style/index.js +9 -0
- package/es/badge/index.js +15 -7
- package/es/badge/style/index.d.ts +2 -5
- package/es/badge/style/index.js +13 -18
- package/es/button/index.js +10 -4
- package/es/button/style/index.d.ts +4 -5
- package/es/button/style/index.js +40 -7
- package/es/card/index.d.ts +11 -0
- package/es/card/index.js +151 -9
- package/es/card/style/index.d.ts +2 -5
- package/es/card/style/index.js +83 -18
- package/es/checkbox/index.js +9 -2
- package/es/checkbox/style/index.d.ts +2 -5
- package/es/checkbox/style/index.js +14 -11
- package/es/config-provider/context.d.ts +11 -0
- package/es/config-provider/context.js +2 -1
- package/es/config-provider/index.d.ts +4 -3
- package/es/config-provider/index.js +92 -40
- package/es/descriptions/index.d.ts +10 -0
- package/es/descriptions/index.js +62 -5
- package/es/descriptions/style/index.d.ts +3 -6
- package/es/descriptions/style/index.js +70 -10
- package/es/drawer/index.js +10 -7
- package/es/drawer/style/index.d.ts +2 -5
- package/es/drawer/style/index.js +44 -17
- package/es/dropdown/dropdown-button.js +26 -6
- package/es/dropdown/style/index.d.ts +6 -0
- package/es/{_util/genStyle.js → dropdown/style/index.js} +14 -11
- package/es/empty/index.js +4 -3
- package/es/empty/style/index.d.ts +2 -5
- package/es/empty/style/index.js +10 -10
- package/es/fonts/Inter-Medium.woff2 +0 -0
- package/es/fonts/Inter-Regular.woff2 +0 -0
- package/es/fonts/Inter-SemiBold.woff2 +0 -0
- package/es/form/FormItem.d.ts +2 -1
- package/es/form/FormItem.js +26 -11
- package/es/form/index.js +9 -2
- package/es/form/style/index.d.ts +2 -5
- package/es/form/style/index.js +19 -8
- package/es/index.d.ts +4 -3
- package/es/index.js +1 -1
- package/es/input/Input.d.ts +2 -0
- package/es/input/Input.js +30 -7
- package/es/input/Password.js +24 -5
- package/es/input/Search.js +24 -5
- package/es/input/TextArea.js +24 -5
- package/es/input/style/index.d.ts +6 -0
- package/es/input/style/index.js +32 -0
- package/es/input-number/index.d.ts +2 -1
- package/es/input-number/index.js +18 -4
- package/es/input-number/style/index.d.ts +6 -0
- package/es/input-number/style/index.js +19 -0
- package/es/locale/en-US.js +4 -1
- package/es/locale/index.d.ts +2 -0
- package/es/locale/ja-JP.d.ts +3 -0
- package/es/locale/ja-JP.js +31 -0
- package/es/locale/zh-CN.js +4 -1
- package/es/locale/zh-TW.js +4 -1
- package/es/modal/Modal.js +29 -8
- package/es/modal/style/index.d.ts +2 -5
- package/es/modal/style/index.js +67 -26
- package/es/radio/index.js +9 -2
- package/es/radio/style/index.d.ts +2 -5
- package/es/radio/style/index.js +16 -10
- package/es/result/index.d.ts +2 -2
- package/es/result/index.js +14 -6
- package/es/result/style/index.d.ts +2 -5
- package/es/result/style/index.js +3 -6
- package/es/segmented/index.d.ts +1 -0
- package/es/segmented/index.js +24 -9
- package/es/segmented/style/index.d.ts +1 -4
- package/es/segmented/style/index.js +4 -6
- package/es/select/index.js +9 -2
- package/es/select/style/index.d.ts +2 -5
- package/es/select/style/index.js +6 -7
- package/es/slider/index.js +9 -2
- package/es/slider/style/index.d.ts +2 -5
- package/es/slider/style/index.js +11 -11
- package/es/space/index.js +9 -2
- package/es/space/style/index.d.ts +2 -5
- package/es/space/style/index.js +3 -6
- package/es/spin/index.js +9 -2
- package/es/spin/style/index.d.ts +2 -5
- package/es/spin/style/index.js +27 -27
- package/es/static-function/index.js +13 -4
- package/es/style/cssVariables.d.ts +25 -0
- package/es/style/cssVariables.js +48 -0
- package/es/style/cssVariablesMeta.d.ts +24 -0
- package/es/style/cssVariablesMeta.js +974 -0
- package/es/style/global.d.ts +8 -0
- package/es/style/global.js +121 -0
- package/es/style/reset.css +2 -1
- package/es/switch/index.js +9 -2
- package/es/switch/style/index.d.ts +2 -5
- package/es/switch/style/index.js +3 -6
- package/es/table/index.d.ts +1 -4
- package/es/table/index.js +67 -34
- package/es/table/style/index.d.ts +2 -5
- package/es/table/style/index.js +58 -36
- package/es/tabs/index.js +9 -2
- package/es/tabs/style/index.d.ts +2 -5
- package/es/tabs/style/index.js +10 -10
- package/es/tag/index.d.ts +1 -0
- package/es/tag/index.js +17 -4
- package/es/tag/style/index.d.ts +3 -8
- package/es/tag/style/index.js +39 -35
- package/es/theme/compact.d.ts +1 -1
- package/es/theme/compact.js +2 -6
- package/es/theme/dark.d.ts +1 -48
- package/es/theme/default.d.ts +48 -2
- package/es/theme/default.js +333 -78
- package/es/theme/index.d.ts +20 -57
- package/es/theme/interface.d.ts +130 -0
- package/es/theme/interface.js +4 -1
- package/es/theme/style/aliyun.less +86 -86
- package/es/theme/style/compact.less +199 -170
- package/es/theme/style/dark.less +103 -103
- package/es/theme/style/default.less +202 -173
- package/es/tooltip/index.js +4 -4
- package/es/tooltip/style/index.d.ts +2 -5
- package/es/tooltip/style/index.js +10 -13
- package/es/tree-select/index.js +9 -2
- package/es/tree-select/style/index.d.ts +2 -5
- package/es/tree-select/style/index.js +3 -6
- package/es/typography/Link.js +9 -2
- package/es/typography/Paragraph.js +9 -2
- package/es/typography/Text.d.ts +1 -0
- package/es/typography/Text.js +12 -4
- package/es/typography/Title.js +9 -2
- package/es/typography/hooks/useClassName.d.ts +1 -1
- package/es/typography/hooks/useClassName.js +2 -2
- package/es/typography/index.d.ts +12 -1
- package/es/typography/index.js +2 -1
- package/es/typography/style/index.d.ts +2 -5
- package/es/typography/style/index.js +36 -28
- package/lib/_util/genComponentStyleHook.d.ts +21 -4
- package/lib/_util/genComponentStyleHook.js +50 -31
- package/lib/alert/index.d.ts +2 -2
- package/lib/alert/index.js +20 -11
- package/lib/alert/style/index.d.ts +2 -5
- package/lib/alert/style/index.js +174 -79
- package/lib/app/index.d.ts +8 -0
- package/lib/app/index.js +36 -1
- package/lib/app/style/index.d.ts +6 -0
- package/lib/{_util/getWeakenBorderColor.js → app/style/index.js} +15 -10
- package/lib/badge/index.js +32 -23
- package/lib/badge/style/index.d.ts +2 -5
- package/lib/badge/style/index.js +14 -16
- package/lib/button/index.js +5 -4
- package/lib/button/style/index.d.ts +4 -5
- package/lib/button/style/index.js +48 -9
- package/lib/card/index.d.ts +11 -0
- package/lib/card/index.js +160 -12
- package/lib/card/style/index.d.ts +2 -5
- package/lib/card/style/index.js +132 -21
- package/lib/checkbox/index.js +4 -3
- package/lib/checkbox/style/index.d.ts +2 -5
- package/lib/checkbox/style/index.js +10 -8
- package/lib/config-provider/DefaultRenderEmpty.js +4 -3
- package/lib/config-provider/context.d.ts +11 -0
- package/lib/config-provider/index.d.ts +4 -3
- package/lib/config-provider/index.js +133 -30
- package/lib/descriptions/hooks/useItems.js +5 -4
- package/lib/descriptions/index.d.ts +10 -0
- package/lib/descriptions/index.js +54 -6
- package/lib/descriptions/style/index.d.ts +3 -6
- package/lib/descriptions/style/index.js +117 -7
- package/lib/drawer/index.js +46 -35
- package/lib/drawer/style/index.d.ts +2 -5
- package/lib/drawer/style/index.js +44 -14
- package/lib/dropdown/dropdown-button.js +26 -3
- package/lib/dropdown/index.js +2 -2
- package/lib/dropdown/style/index.d.ts +6 -0
- package/lib/dropdown/style/index.js +46 -0
- 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 +25 -20
- package/lib/empty/style/index.d.ts +2 -5
- package/lib/empty/style/index.js +9 -10
- package/lib/fonts/Inter-Medium.woff2 +0 -0
- package/lib/fonts/Inter-Regular.woff2 +0 -0
- package/lib/fonts/Inter-SemiBold.woff2 +0 -0
- package/lib/form/FormItem.d.ts +2 -1
- package/lib/form/FormItem.js +19 -8
- package/lib/form/index.js +8 -5
- package/lib/form/style/index.d.ts +2 -5
- package/lib/form/style/index.js +28 -7
- package/lib/grid/col.js +2 -1
- package/lib/grid/row.js +2 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.js +3 -1
- package/lib/input/Input.d.ts +2 -0
- package/lib/input/Input.js +37 -13
- package/lib/input/Password.js +22 -4
- package/lib/input/Search.js +32 -12
- package/lib/input/TextArea.js +22 -4
- package/lib/input/style/index.d.ts +6 -0
- package/lib/input/style/index.js +74 -0
- package/lib/input-number/index.d.ts +2 -1
- package/lib/input-number/index.js +19 -3
- package/lib/input-number/style/index.d.ts +6 -0
- package/lib/{_util/genStyle.js → input-number/style/index.js} +22 -17
- package/lib/list/index.js +3 -2
- package/lib/locale/en-US.js +3 -0
- package/lib/locale/index.d.ts +2 -0
- package/lib/locale/ja-JP.d.ts +3 -0
- package/lib/locale/ja-JP.js +63 -0
- package/lib/locale/zh-CN.js +3 -0
- package/lib/locale/zh-TW.js +3 -0
- package/lib/lottie/index.js +2 -1
- package/lib/modal/Modal.js +35 -11
- package/lib/modal/Progress.js +9 -5
- package/lib/modal/style/index.d.ts +2 -5
- package/lib/modal/style/index.js +81 -24
- package/lib/radio/index.js +4 -3
- package/lib/radio/style/index.d.ts +2 -5
- package/lib/radio/style/index.js +17 -8
- 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 +14 -13
- package/lib/result/style/index.d.ts +2 -5
- package/lib/result/style/index.js +3 -6
- package/lib/segmented/index.d.ts +1 -0
- package/lib/segmented/index.js +17 -6
- package/lib/segmented/style/index.d.ts +1 -4
- package/lib/segmented/style/index.js +4 -6
- package/lib/select/index.js +4 -3
- package/lib/select/style/index.d.ts +2 -5
- package/lib/select/style/index.js +7 -7
- package/lib/slider/index.js +4 -3
- package/lib/slider/style/index.d.ts +2 -5
- package/lib/slider/style/index.js +12 -11
- package/lib/space/index.js +3 -2
- package/lib/space/style/index.d.ts +2 -5
- package/lib/space/style/index.js +3 -6
- package/lib/spin/index.js +7 -6
- package/lib/spin/style/index.d.ts +2 -5
- package/lib/spin/style/index.js +26 -28
- package/lib/static-function/index.js +7 -1
- package/lib/style/cssVariables.d.ts +25 -0
- package/lib/style/cssVariables.js +261 -0
- package/lib/style/cssVariablesMeta.d.ts +24 -0
- package/lib/style/cssVariablesMeta.js +1059 -0
- package/lib/style/global.d.ts +8 -0
- package/lib/style/global.js +176 -0
- package/lib/style/reset.css +2 -1
- package/lib/switch/index.js +4 -3
- package/lib/switch/style/index.d.ts +2 -5
- package/lib/switch/style/index.js +3 -6
- package/lib/table/index.d.ts +1 -4
- package/lib/table/index.js +114 -68
- package/lib/table/style/index.d.ts +2 -5
- package/lib/table/style/index.js +68 -32
- package/lib/tabs/index.js +12 -7
- package/lib/tabs/style/index.d.ts +2 -5
- package/lib/tabs/style/index.js +12 -8
- package/lib/tag/index.d.ts +1 -0
- package/lib/tag/index.js +18 -8
- package/lib/tag/style/index.d.ts +3 -8
- package/lib/tag/style/index.js +45 -36
- package/lib/theme/compact.d.ts +1 -1
- package/lib/theme/compact.js +1 -5
- package/lib/theme/dark.d.ts +1 -48
- package/lib/theme/default.d.ts +48 -2
- package/lib/theme/default.js +412 -79
- package/lib/theme/index.d.ts +20 -57
- package/lib/theme/interface.d.ts +130 -0
- package/lib/theme/style/aliyun.less +86 -86
- package/lib/theme/style/compact.less +199 -170
- package/lib/theme/style/dark.less +103 -103
- package/lib/theme/style/default.less +202 -173
- package/lib/tooltip/MouseTooltip.js +43 -39
- package/lib/tooltip/ReactStickyMouseTooltip.js +5 -4
- package/lib/tooltip/index.js +17 -13
- package/lib/tooltip/style/index.d.ts +2 -5
- package/lib/tooltip/style/index.js +10 -13
- package/lib/tree-select/index.js +4 -3
- package/lib/tree-select/style/index.d.ts +2 -5
- package/lib/tree-select/style/index.js +3 -6
- package/lib/typography/Link.js +7 -6
- package/lib/typography/Paragraph.js +7 -6
- package/lib/typography/Text.d.ts +1 -0
- package/lib/typography/Text.js +9 -8
- package/lib/typography/Title.js +7 -6
- package/lib/typography/hooks/useClassName.d.ts +1 -1
- package/lib/typography/hooks/useClassName.js +3 -2
- package/lib/typography/index.d.ts +12 -1
- package/lib/typography/index.js +6 -5
- package/lib/typography/style/index.d.ts +2 -5
- package/lib/typography/style/index.js +34 -26
- package/package.json +11 -10
- package/dist/static/Inter.f6bcdfb6.woff2 +0 -0
- package/es/_util/genStyle.d.ts +0 -2
- package/es/_util/getWeakenBorderColor.d.ts +0 -1
- package/es/_util/getWeakenBorderColor.js +0 -4
- package/es/fonts/Inter.woff2 +0 -0
- package/es/global.css +0 -48
- package/lib/_util/genStyle.d.ts +0 -2
- package/lib/_util/getWeakenBorderColor.d.ts +0 -1
- package/lib/fonts/Inter.woff2 +0 -0
- package/lib/global.css +0 -48
|
@@ -2,21 +2,24 @@ 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
|
-
import {
|
|
5
|
+
import { unit } from '@ant-design/cssinjs';
|
|
6
|
+
import { genStyleHooks } from "../../_util/genComponentStyleHook";
|
|
6
7
|
export var genCheckboxStyle = function genCheckboxStyle(token) {
|
|
7
8
|
var componentCls = token.componentCls,
|
|
8
9
|
fontSize = token.fontSize,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
lineHeight = token.lineHeight,
|
|
11
|
+
lineWidth = token.lineWidth,
|
|
12
|
+
controlInteractiveSize = token.controlInteractiveSize,
|
|
13
|
+
calc = token.calc;
|
|
14
|
+
var translateY = calc(fontSize).mul(lineHeight).sub(controlInteractiveSize).sub(lineWidth).div(2).equal();
|
|
15
|
+
return _defineProperty({}, "".concat(componentCls, "-wrapper"), _defineProperty(_defineProperty({}, "".concat(componentCls), _defineProperty({
|
|
12
16
|
alignSelf: 'baseline'
|
|
13
17
|
}, "".concat(componentCls, "-inner"), {
|
|
14
|
-
transform: "translate(0px, ".concat((
|
|
15
|
-
})))
|
|
18
|
+
transform: "translate(0px, ".concat(unit(translateY), ")")
|
|
19
|
+
})), "&:hover ".concat(componentCls, ":not(").concat(componentCls, "-disabled):not(").concat(componentCls, "-checked) ").concat(componentCls, "-inner"), {
|
|
20
|
+
borderColor: token.gray7
|
|
21
|
+
}));
|
|
16
22
|
};
|
|
17
|
-
export default (function (
|
|
18
|
-
|
|
19
|
-
return [genCheckboxStyle(token)];
|
|
20
|
-
});
|
|
21
|
-
return useStyle(prefixCls);
|
|
23
|
+
export default genStyleHooks('Checkbox', function (token) {
|
|
24
|
+
return [genCheckboxStyle(token)];
|
|
22
25
|
});
|
|
@@ -1 +1,12 @@
|
|
|
1
|
+
import type { ThemeConfig as AntThemeConfig, MappingAlgorithm } from 'antd';
|
|
2
|
+
import type { AliasToken, OverrideToken } from '../theme/interface';
|
|
1
3
|
export * from 'antd/es/config-provider/context';
|
|
4
|
+
type ComponentsConfig = {
|
|
5
|
+
[key in keyof OverrideToken]?: OverrideToken[key] & {
|
|
6
|
+
algorithm?: boolean | MappingAlgorithm | MappingAlgorithm[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export interface ThemeConfig extends AntThemeConfig {
|
|
10
|
+
token?: Partial<AliasToken>;
|
|
11
|
+
components?: ComponentsConfig;
|
|
12
|
+
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from 'antd/es/config-provider/context';
|
|
1
|
+
export * from 'antd/es/config-provider/context';
|
|
2
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ConfigProvider as AntConfigProvider } from 'antd';
|
|
3
3
|
import type { ConfigProviderProps as AntConfigProviderProps, ConfigConsumerProps as AntConfigConsumerProps, ThemeConfig as AntThemeConfig } from 'antd/es/config-provider';
|
|
4
|
-
import type { ComponentStyleConfig, CardConfig as AntCardConfig } from 'antd/es/config-provider/context';
|
|
4
|
+
import type { ComponentStyleConfig, CardConfig as AntCardConfig, TableConfig as AntTableConfig } from 'antd/es/config-provider/context';
|
|
5
5
|
import type { AppProps } from 'antd/es/app';
|
|
6
6
|
import type { PaginationConfig } from 'antd/es/pagination';
|
|
7
7
|
import type { SpinIndicator } from 'antd/es/spin';
|
|
@@ -14,8 +14,9 @@ export * from 'antd/es/config-provider/SizeContext';
|
|
|
14
14
|
export * from 'antd/es/config-provider/DisabledContext';
|
|
15
15
|
export * from 'antd/es/config-provider';
|
|
16
16
|
export interface ThemeConfig extends AntThemeConfig {
|
|
17
|
-
isDark?: boolean;
|
|
18
17
|
isAliyun?: boolean;
|
|
18
|
+
isDark?: boolean;
|
|
19
|
+
isCompact?: boolean;
|
|
19
20
|
}
|
|
20
21
|
export type CardConfig = AntCardConfig & {
|
|
21
22
|
divided?: boolean;
|
|
@@ -23,7 +24,7 @@ export type CardConfig = AntCardConfig & {
|
|
|
23
24
|
export type SpinConfig = ComponentStyleConfig & {
|
|
24
25
|
indicator?: SpinIndicator;
|
|
25
26
|
};
|
|
26
|
-
export type TableConfig =
|
|
27
|
+
export type TableConfig = AntTableConfig & {
|
|
27
28
|
selectionColumnWidth?: number;
|
|
28
29
|
};
|
|
29
30
|
export interface ConfigConsumerProps extends AntConfigConsumerProps {
|
|
@@ -1,24 +1,34 @@
|
|
|
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
1
|
var _excluded = ["children", "theme", "locale", "navigate", "hideOnSinglePage", "card", "collapse", "form", "spin", "table", "tabs", "styleProviderProps", "appProps"];
|
|
2
|
+
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); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
6
|
+
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; }
|
|
7
|
+
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; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
3
9
|
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
10
|
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
13
|
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
14
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
15
|
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
16
|
import React from 'react';
|
|
11
|
-
import {
|
|
17
|
+
import { ConfigProvider as AntConfigProvider } from 'antd';
|
|
12
18
|
import { StyleProvider } from '@ant-design/cssinjs';
|
|
13
19
|
import StyleContext from '@ant-design/cssinjs/es/StyleContext';
|
|
14
20
|
import { CaretRightOutlined } from '@oceanbase/icons';
|
|
15
21
|
import aliyunTheme from '@oceanbase/aliyun-theme';
|
|
16
22
|
import { merge } from 'lodash';
|
|
23
|
+
import App from "../app";
|
|
17
24
|
import StaticFunction from "../static-function";
|
|
18
25
|
import themeConfig from "../theme";
|
|
19
|
-
import defaultTheme, { fontFamilyEn } from "../theme/default";
|
|
26
|
+
import defaultTheme, { fontFamilyEn, fontWeightWeakEn, fontWeightEn, fontWeightStrongEn } from "../theme/default";
|
|
20
27
|
import darkTheme from "../theme/dark";
|
|
28
|
+
import compactTheme from "../theme/compact";
|
|
21
29
|
import DefaultRenderEmpty from "./DefaultRenderEmpty";
|
|
30
|
+
import GlobalStyle from "../style/global";
|
|
31
|
+
import CssVariablesStyle from "../style/cssVariables";
|
|
22
32
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
33
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
34
|
export * from "./navigate";
|
|
@@ -31,33 +41,56 @@ var ExtendedConfigContext = /*#__PURE__*/React.createContext({
|
|
|
31
41
|
hideOnSinglePage: false,
|
|
32
42
|
injectStaticFunction: true
|
|
33
43
|
});
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
var getLocaleTokenValue = function getLocaleTokenValue(mergedThemeToken, locale, tokenKey, tokenValue, tokenValueEn) {
|
|
45
|
+
return tokenValue !== mergedThemeToken[tokenKey] ? _defineProperty({}, tokenKey, tokenValue) : ['en', 'en-gb'].includes(locale.locale) ? _defineProperty({}, tokenKey, tokenValueEn) : {};
|
|
46
|
+
};
|
|
47
|
+
var ConfigProvider = function ConfigProvider(_ref3) {
|
|
48
|
+
var _mergedTheme$token, _mergedTheme$token2, _mergedTheme$token3, _mergedTheme$token4, _parentContext$pagina;
|
|
49
|
+
var children = _ref3.children,
|
|
50
|
+
theme = _ref3.theme,
|
|
51
|
+
locale = _ref3.locale,
|
|
52
|
+
navigate = _ref3.navigate,
|
|
53
|
+
hideOnSinglePage = _ref3.hideOnSinglePage,
|
|
54
|
+
card = _ref3.card,
|
|
55
|
+
collapse = _ref3.collapse,
|
|
56
|
+
form = _ref3.form,
|
|
57
|
+
spin = _ref3.spin,
|
|
58
|
+
table = _ref3.table,
|
|
59
|
+
tabs = _ref3.tabs,
|
|
60
|
+
styleProviderProps = _ref3.styleProviderProps,
|
|
61
|
+
appProps = _ref3.appProps,
|
|
62
|
+
restProps = _objectWithoutProperties(_ref3, _excluded);
|
|
50
63
|
// inherit from parent ConfigProvider
|
|
51
64
|
var parentContext = React.useContext(AntConfigProvider.ConfigContext);
|
|
52
65
|
var parentExtendedContext = React.useContext(ExtendedConfigContext);
|
|
53
66
|
var _merge = merge({}, parentContext.theme, theme),
|
|
67
|
+
isAliyun = _merge.isAliyun,
|
|
54
68
|
isDark = _merge.isDark,
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
var
|
|
69
|
+
isCompact = _merge.isCompact;
|
|
70
|
+
var aliyunThemeConfig = isAliyun ? aliyunTheme : undefined;
|
|
71
|
+
var darkThemeConfig = isDark && !isAliyun ? isCompact ? darkTheme : _objectSpread(_objectSpread({}, darkTheme), {}, {
|
|
72
|
+
token: _objectSpread(_objectSpread({}, darkTheme.token), Object.fromEntries(Object.entries(defaultTheme.token).filter(function (_ref4) {
|
|
73
|
+
var _key$toLowerCase;
|
|
74
|
+
var _ref5 = _slicedToArray(_ref4, 1),
|
|
75
|
+
key = _ref5[0];
|
|
76
|
+
return !(key !== null && key !== void 0 && (_key$toLowerCase = key.toLowerCase()) !== null && _key$toLowerCase !== void 0 && _key$toLowerCase.startsWith('color'));
|
|
77
|
+
})))
|
|
78
|
+
}) : undefined;
|
|
79
|
+
var compactThemeConfig = isCompact && !isAliyun ? isDark ? compactTheme : _objectSpread(_objectSpread({}, compactTheme), {}, {
|
|
80
|
+
token: _objectSpread(_objectSpread({}, compactTheme.token), Object.fromEntries(Object.entries(defaultTheme.token).filter(function (_ref6) {
|
|
81
|
+
var _key$toLowerCase2;
|
|
82
|
+
var _ref7 = _slicedToArray(_ref6, 1),
|
|
83
|
+
key = _ref7[0];
|
|
84
|
+
return (key === null || key === void 0 || (_key$toLowerCase2 = key.toLowerCase()) === null || _key$toLowerCase2 === void 0 ? void 0 : _key$toLowerCase2.startsWith('color')) && !['colorBgBase', 'colorTextBase'].includes(key);
|
|
85
|
+
})))
|
|
86
|
+
}) : undefined;
|
|
87
|
+
var mergedTheme = merge({}, isAliyun ? {} : isDark || isCompact ? themeConfig.defaultSeed : defaultTheme, parentContext.theme, aliyunThemeConfig, darkThemeConfig, compactThemeConfig, theme);
|
|
58
88
|
var _themeConfig$useToken = themeConfig.useToken(),
|
|
59
89
|
token = _themeConfig$useToken.token;
|
|
60
90
|
var fontFamily = ((_mergedTheme$token = mergedTheme.token) === null || _mergedTheme$token === void 0 ? void 0 : _mergedTheme$token.fontFamily) || token.fontFamily;
|
|
91
|
+
var fontWeightWeak = ((_mergedTheme$token2 = mergedTheme.token) === null || _mergedTheme$token2 === void 0 ? void 0 : _mergedTheme$token2.fontWeightWeak) || token.fontWeightWeak;
|
|
92
|
+
var fontWeight = ((_mergedTheme$token3 = mergedTheme.token) === null || _mergedTheme$token3 === void 0 ? void 0 : _mergedTheme$token3.fontWeight) || token.fontWeight;
|
|
93
|
+
var fontWeightStrong = ((_mergedTheme$token4 = mergedTheme.token) === null || _mergedTheme$token4 === void 0 ? void 0 : _mergedTheme$token4.fontWeightStrong) || token.fontWeightStrong;
|
|
61
94
|
|
|
62
95
|
// inherit from parent StyleProvider
|
|
63
96
|
var parentStyleContext = React.useContext(StyleContext);
|
|
@@ -67,10 +100,14 @@ var ConfigProvider = function ConfigProvider(_ref) {
|
|
|
67
100
|
locale: mergedLocale,
|
|
68
101
|
card: merge({}, parentContext.card, card),
|
|
69
102
|
collapse: merge({}, {
|
|
70
|
-
expandIcon: function expandIcon(
|
|
71
|
-
var
|
|
103
|
+
expandIcon: function expandIcon(_ref8) {
|
|
104
|
+
var _mergedTheme$token5, _mergedTheme$token6;
|
|
105
|
+
var isActive = _ref8.isActive;
|
|
72
106
|
return /*#__PURE__*/_jsx(CaretRightOutlined, {
|
|
73
|
-
rotate: isActive ? 90 : 0
|
|
107
|
+
rotate: isActive ? 90 : 0,
|
|
108
|
+
style: {
|
|
109
|
+
color: ((_mergedTheme$token5 = mergedTheme.token) === null || _mergedTheme$token5 === void 0 ? void 0 : _mergedTheme$token5.colorIcon) || ((_mergedTheme$token6 = mergedTheme.token) === null || _mergedTheme$token6 === void 0 ? void 0 : _mergedTheme$token6.colorTextSecondary)
|
|
110
|
+
}
|
|
74
111
|
});
|
|
75
112
|
}
|
|
76
113
|
}, parentContext.collapse, collapse),
|
|
@@ -78,18 +115,31 @@ var ConfigProvider = function ConfigProvider(_ref) {
|
|
|
78
115
|
requiredMark: 'optional'
|
|
79
116
|
}, parentContext.form, form),
|
|
80
117
|
spin: merge({}, parentContext.spin, spin),
|
|
81
|
-
table: merge({},
|
|
118
|
+
table: merge({}, {
|
|
119
|
+
expandable: {
|
|
120
|
+
expandIcon: function expandIcon(_ref9) {
|
|
121
|
+
var _mergedTheme$token7, _mergedTheme$token8;
|
|
122
|
+
var expandable = _ref9.expandable,
|
|
123
|
+
expanded = _ref9.expanded,
|
|
124
|
+
onExpand = _ref9.onExpand,
|
|
125
|
+
record = _ref9.record;
|
|
126
|
+
return expandable && /*#__PURE__*/_jsx(CaretRightOutlined, {
|
|
127
|
+
onClick: function onClick(e) {
|
|
128
|
+
return onExpand(record, e);
|
|
129
|
+
},
|
|
130
|
+
style: {
|
|
131
|
+
// marginRight: mergedTheme.token?.marginXS || 8,
|
|
132
|
+
transition: "transform 0.2s",
|
|
133
|
+
transform: expanded ? 'rotate(90deg)' : undefined,
|
|
134
|
+
color: ((_mergedTheme$token7 = mergedTheme.token) === null || _mergedTheme$token7 === void 0 ? void 0 : _mergedTheme$token7.colorIcon) || ((_mergedTheme$token8 = mergedTheme.token) === null || _mergedTheme$token8 === void 0 ? void 0 : _mergedTheme$token8.colorTextSecondary)
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, parentContext.table, table),
|
|
82
140
|
tabs: merge({}, parentContext.tabs, tabs),
|
|
83
141
|
theme: merge({}, mergedTheme, {
|
|
84
|
-
token:
|
|
85
|
-
// custom fontFamily
|
|
86
|
-
fontFamily !== defaultTheme.token.fontFamily ? {
|
|
87
|
-
fontFamily: fontFamily
|
|
88
|
-
} :
|
|
89
|
-
// use fontFamilyEn for en
|
|
90
|
-
['en', 'en-gb'].includes(mergedLocale.locale) ? {
|
|
91
|
-
fontFamily: fontFamilyEn
|
|
92
|
-
} : {}
|
|
142
|
+
token: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontFamily', fontFamily, fontFamilyEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightWeak', fontWeightWeak, fontWeightWeakEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeight', fontWeight, fontWeightEn)), getLocaleTokenValue(mergedTheme.token || {}, mergedLocale, 'fontWeightStrong', fontWeightStrong, fontWeightStrongEn))
|
|
93
143
|
}),
|
|
94
144
|
renderEmpty: parentContext.renderEmpty || function (componentName) {
|
|
95
145
|
return /*#__PURE__*/_jsx(DefaultRenderEmpty, {
|
|
@@ -104,12 +154,14 @@ var ConfigProvider = function ConfigProvider(_ref) {
|
|
|
104
154
|
// inject static function to outermost ConfigProvider only
|
|
105
155
|
injectStaticFunction: false
|
|
106
156
|
},
|
|
107
|
-
children: /*#__PURE__*/
|
|
108
|
-
children: /*#__PURE__*/
|
|
157
|
+
children: /*#__PURE__*/_jsxs(StyleProvider, _objectSpread(_objectSpread({}, mergedStyleProviderProps), {}, {
|
|
158
|
+
children: [/*#__PURE__*/_jsx(CssVariablesStyle, {}), /*#__PURE__*/_jsx(GlobalStyle, {
|
|
159
|
+
prefixCls: restProps.prefixCls
|
|
160
|
+
}), /*#__PURE__*/_jsxs(App, _objectSpread(_objectSpread({
|
|
109
161
|
component: false
|
|
110
162
|
}, appProps), {}, {
|
|
111
163
|
children: [children, parentExtendedContext.injectStaticFunction && /*#__PURE__*/_jsx(StaticFunction, {})]
|
|
112
|
-
}))
|
|
164
|
+
}))]
|
|
113
165
|
}))
|
|
114
166
|
})
|
|
115
167
|
}));
|
|
@@ -9,6 +9,16 @@ export interface DescriptionsItemType extends AntDescriptionsItemType {
|
|
|
9
9
|
}
|
|
10
10
|
export interface DescriptionsProps extends AntDescriptionsProps {
|
|
11
11
|
items?: DescriptionsItemType[];
|
|
12
|
+
/** Whether the descriptions is collapsible */
|
|
13
|
+
collapsible?: boolean;
|
|
14
|
+
/** Whether the descriptions is collapsed (controlled mode) */
|
|
15
|
+
collapsed?: boolean;
|
|
16
|
+
/** Default collapsed state (uncontrolled mode) */
|
|
17
|
+
defaultCollapsed?: boolean;
|
|
18
|
+
/** Callback when collapsed state changes */
|
|
19
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
20
|
+
/** Content alignment, when set to 'left', all content values will be aligned to the left based on the longest label width */
|
|
21
|
+
contentAlign?: 'left';
|
|
12
22
|
}
|
|
13
23
|
type CompoundedComponent = React.FC<DescriptionsProps> & {
|
|
14
24
|
Item: typeof DescriptionsItem;
|
package/es/descriptions/index.js
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
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", "bordered", "layout", "colon", "items", "prefixCls", "className"];
|
|
2
|
+
var _excluded = ["children", "bordered", "layout", "colon", "items", "title", "prefixCls", "className", "column", "collapsible", "collapsed", "defaultCollapsed", "onCollapse", "contentAlign"];
|
|
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 { Descriptions as AntDescriptions } from 'antd';
|
|
11
17
|
import classNames from 'classnames';
|
|
12
|
-
import React, { useContext } from 'react';
|
|
18
|
+
import React, { useContext, useState, useCallback, useMemo } from 'react';
|
|
19
|
+
import { CaretRightFilled } from '@oceanbase/icons';
|
|
13
20
|
import ConfigProvider from "../config-provider";
|
|
21
|
+
import theme from "../theme";
|
|
14
22
|
import DescriptionsItem from "./Item";
|
|
15
23
|
import useItems from "./hooks/useItems";
|
|
16
24
|
import useStyle from "./style";
|
|
17
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
27
|
export * from 'antd/es/descriptions';
|
|
19
28
|
var Descriptions = function Descriptions(_ref) {
|
|
20
29
|
var children = _ref.children,
|
|
@@ -24,22 +33,70 @@ var Descriptions = function Descriptions(_ref) {
|
|
|
24
33
|
_ref$colon = _ref.colon,
|
|
25
34
|
colon = _ref$colon === void 0 ? layout === 'vertical' ? false : undefined : _ref$colon,
|
|
26
35
|
items = _ref.items,
|
|
36
|
+
title = _ref.title,
|
|
27
37
|
customizePrefixCls = _ref.prefixCls,
|
|
28
38
|
className = _ref.className,
|
|
39
|
+
_ref$column = _ref.column,
|
|
40
|
+
column = _ref$column === void 0 ? 3 : _ref$column,
|
|
41
|
+
collapsible = _ref.collapsible,
|
|
42
|
+
outerCollapsed = _ref.collapsed,
|
|
43
|
+
defaultCollapsed = _ref.defaultCollapsed,
|
|
44
|
+
onCollapse = _ref.onCollapse,
|
|
45
|
+
contentAlign = _ref.contentAlign,
|
|
29
46
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
30
47
|
var _useContext = useContext(ConfigProvider.ConfigContext),
|
|
31
48
|
getPrefixCls = _useContext.getPrefixCls;
|
|
49
|
+
var _theme$useToken = theme.useToken(),
|
|
50
|
+
token = _theme$useToken.token;
|
|
32
51
|
var prefixCls = getPrefixCls('descriptions', customizePrefixCls);
|
|
33
52
|
var typographyPrefixCls = getPrefixCls('typography', customizePrefixCls);
|
|
34
53
|
var _useStyle = useStyle(prefixCls, typographyPrefixCls),
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
_useStyle2 = _slicedToArray(_useStyle, 1),
|
|
55
|
+
wrapCSSVar = _useStyle2[0];
|
|
56
|
+
var _useState = useState(defaultCollapsed !== null && defaultCollapsed !== void 0 ? defaultCollapsed : false),
|
|
57
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
58
|
+
internalCollapsed = _useState2[0],
|
|
59
|
+
setInternalCollapsed = _useState2[1];
|
|
60
|
+
var collapsed = outerCollapsed !== undefined ? outerCollapsed : internalCollapsed;
|
|
61
|
+
var handleCollapse = useCallback(function () {
|
|
62
|
+
var newCollapsed = !collapsed;
|
|
63
|
+
if (outerCollapsed === undefined) {
|
|
64
|
+
setInternalCollapsed(newCollapsed);
|
|
65
|
+
}
|
|
66
|
+
onCollapse === null || onCollapse === void 0 || onCollapse(newCollapsed);
|
|
67
|
+
}, [collapsed, outerCollapsed, onCollapse]);
|
|
37
68
|
var newItems = useItems(items, children, bordered);
|
|
38
|
-
|
|
69
|
+
var descriptionsTitle = useMemo(function () {
|
|
70
|
+
if (!collapsible) {
|
|
71
|
+
return title;
|
|
72
|
+
}
|
|
73
|
+
if (!title) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
77
|
+
className: "".concat(prefixCls, "-title-wrapper"),
|
|
78
|
+
onClick: handleCollapse,
|
|
79
|
+
children: [/*#__PURE__*/_jsx(CaretRightFilled, {
|
|
80
|
+
className: "".concat(prefixCls, "-collapsible-icon"),
|
|
81
|
+
style: {
|
|
82
|
+
transition: "transform ".concat(token.motionDurationMid),
|
|
83
|
+
transform: collapsed ? undefined : 'rotate(90deg)',
|
|
84
|
+
color: token.colorIcon,
|
|
85
|
+
marginRight: token.marginXS
|
|
86
|
+
}
|
|
87
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
88
|
+
children: title
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
}, [collapsible, title, collapsed, prefixCls, token, handleCollapse]);
|
|
92
|
+
var descriptionsCls = classNames(className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-vertical"), layout === 'vertical'), "".concat(prefixCls, "-horizontal"), layout === 'horizontal'), "".concat(prefixCls, "-collapsible"), collapsible), "".concat(prefixCls, "-collapsed"), collapsible && collapsed), "".concat(prefixCls, "-content-align-left"), contentAlign === 'left'));
|
|
93
|
+
return wrapCSSVar( /*#__PURE__*/_jsx(AntDescriptions, _objectSpread({
|
|
39
94
|
layout: layout,
|
|
40
95
|
colon: colon,
|
|
41
96
|
bordered: bordered,
|
|
97
|
+
column: column,
|
|
42
98
|
items: newItems,
|
|
99
|
+
title: descriptionsTitle,
|
|
43
100
|
prefixCls: customizePrefixCls,
|
|
44
101
|
className: descriptionsCls
|
|
45
102
|
}, restProps)));
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CSSObject } from '@ant-design/cssinjs';
|
|
3
|
-
import type { FullToken, GenerateStyle } from '
|
|
3
|
+
import type { FullToken, GenerateStyle } from '../../theme/interface';
|
|
4
4
|
import type { DescriptionsProps } from '..';
|
|
5
|
-
export type DescriptionsToken = FullToken<'
|
|
5
|
+
export type DescriptionsToken = FullToken<'Descriptions'> & {
|
|
6
6
|
typographyPrefixCls: string;
|
|
7
7
|
typographyComponentCls: string;
|
|
8
8
|
};
|
|
9
9
|
export declare const genVerticalStyle: (size: DescriptionsProps['size'], token: Partial<DescriptionsToken>) => CSSObject;
|
|
10
10
|
export declare const genDescriptionsStyle: GenerateStyle<DescriptionsToken>;
|
|
11
|
-
declare const _default: (prefixCls: string, typographyPrefixCls: string) =>
|
|
12
|
-
wrapSSR: (node: import("react").ReactNode) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
13
|
-
hashId: string;
|
|
14
|
-
};
|
|
11
|
+
declare const _default: (prefixCls: string, typographyPrefixCls: string) => readonly [(node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>, string, string];
|
|
15
12
|
export default _default;
|
|
@@ -4,12 +4,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import {
|
|
7
|
+
import { genStyleHooks } from "../../_util/genComponentStyleHook";
|
|
8
8
|
export var genVerticalStyle = function genVerticalStyle(size, token) {
|
|
9
9
|
var componentCls = token.componentCls;
|
|
10
10
|
var paddingMap = {
|
|
11
11
|
default: {
|
|
12
|
-
paddingIn: token.
|
|
12
|
+
paddingIn: token.paddingXXS,
|
|
13
13
|
paddingOut: token.paddingLG
|
|
14
14
|
},
|
|
15
15
|
middle: {
|
|
@@ -22,28 +22,88 @@ export var genVerticalStyle = function genVerticalStyle(size, token) {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
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", {
|
|
25
|
+
return _defineProperty({}, "&".concat(componentCls).concat(componentCls, "-vertical:not(").concat(componentCls, "-bordered)"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-row:nth-child(2n + 1)"), _defineProperty({}, "& > th, & > td", {
|
|
26
26
|
paddingBottom: paddingConfig.paddingIn
|
|
27
27
|
})), "".concat(componentCls, "-row:nth-child(2n)"), _defineProperty({}, "& > th, & > td", {
|
|
28
28
|
paddingBottom: paddingConfig.paddingOut
|
|
29
|
+
})), "".concat(componentCls, "-item"), _defineProperty({}, "".concat(componentCls, "-item-label"), {
|
|
30
|
+
fontSize: token.fontSizeSM
|
|
29
31
|
})));
|
|
30
32
|
};
|
|
31
33
|
export var genDescriptionsStyle = function genDescriptionsStyle(token) {
|
|
32
34
|
var componentCls = token.componentCls,
|
|
33
|
-
typographyComponentCls = token.typographyComponentCls
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
typographyComponentCls = token.typographyComponentCls,
|
|
36
|
+
calc = token.calc;
|
|
37
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls), _objectSpread(_objectSpread(_defineProperty(_defineProperty({}, "".concat(componentCls, "-header"), {
|
|
38
|
+
marginBottom: token.margin
|
|
39
|
+
}), "".concat(componentCls, "-title-wrapper"), _defineProperty({
|
|
40
|
+
cursor: 'pointer',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
userSelect: 'none'
|
|
44
|
+
}, "".concat(componentCls, "-collapsible-icon"), {
|
|
45
|
+
fontSize: token.fontSizeLG
|
|
46
|
+
})), genVerticalStyle('default', token)), {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-row > th, ").concat(componentCls, "-row > td"), {
|
|
47
|
+
paddingRight: token.paddingLG
|
|
48
|
+
}), "".concat(componentCls, "-item-label"), _defineProperty({
|
|
49
|
+
fontWeight: token.fontWeightWeak
|
|
50
|
+
}, "&".concat(componentCls, "-item-no-colon::after"), {
|
|
51
|
+
display: 'none'
|
|
52
|
+
})), "".concat(componentCls, "-item-container"), _defineProperty({}, "".concat(componentCls, "-item-content"), _defineProperty({}, "".concat(typographyComponentCls, "-edit-content"), {
|
|
37
53
|
insetInlineStart: 0,
|
|
38
54
|
marginTop: 0,
|
|
39
55
|
marginBottom: 0
|
|
40
56
|
}))), "".concat(componentCls, "-item-container:has(", "".concat(typographyComponentCls, "-edit-content"), ")"), {
|
|
41
57
|
alignItems: 'center',
|
|
42
|
-
height: token.fontSize
|
|
43
|
-
}))), "".concat(componentCls).concat(componentCls, "-middle"),
|
|
58
|
+
height: calc(token.fontSize).mul(token.lineHeight).equal()
|
|
59
|
+
}))), "".concat(componentCls).concat(componentCls, "-middle"), _objectSpread(_defineProperty({}, "".concat(componentCls, "-header"), {
|
|
60
|
+
marginBottom: token.marginSM
|
|
61
|
+
}), genVerticalStyle('middle', token))), "".concat(componentCls).concat(componentCls, "-small"), _objectSpread(_defineProperty({}, "".concat(componentCls, "-header"), {
|
|
62
|
+
marginBottom: token.marginXS
|
|
63
|
+
}), genVerticalStyle('small', token))), "".concat(componentCls).concat(componentCls, "-collapsed"), _defineProperty({}, "".concat(componentCls, "-view"), {
|
|
64
|
+
display: 'none'
|
|
65
|
+
})), "".concat(componentCls).concat(componentCls, "-content-align-left:not(").concat(componentCls, "-bordered)"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-view"), {
|
|
66
|
+
display: 'block'
|
|
67
|
+
}), "".concat(componentCls, "-view > table"), {
|
|
68
|
+
display: 'grid',
|
|
69
|
+
gridTemplateColumns: 'auto 1fr'
|
|
70
|
+
}), "".concat(componentCls, "-view > table > tbody"), {
|
|
71
|
+
display: 'contents'
|
|
72
|
+
}), "".concat(componentCls, "-row"), {
|
|
73
|
+
display: 'contents'
|
|
74
|
+
}), "".concat(componentCls, "-row > td").concat(componentCls, "-item"), {
|
|
75
|
+
display: 'contents'
|
|
76
|
+
}), "".concat(componentCls, "-item-container"), {
|
|
77
|
+
display: 'contents'
|
|
78
|
+
}), "".concat(componentCls, "-item-label"), {
|
|
79
|
+
whiteSpace: 'nowrap',
|
|
80
|
+
paddingBottom: token.padding,
|
|
81
|
+
paddingInlineEnd: token.paddingLG
|
|
82
|
+
}), "".concat(componentCls, "-item-content"), {
|
|
83
|
+
paddingBottom: token.padding
|
|
84
|
+
}), "&".concat(componentCls, "-middle"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-item-label"), {
|
|
85
|
+
paddingBottom: token.paddingSM,
|
|
86
|
+
paddingInlineEnd: token.paddingLG
|
|
87
|
+
}), "".concat(componentCls, "-item-content"), {
|
|
88
|
+
paddingBottom: token.paddingSM
|
|
89
|
+
})), "&".concat(componentCls, "-small"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(componentCls, "-title"), {
|
|
90
|
+
fontSize: token.fontSize
|
|
91
|
+
}), "".concat(componentCls, "-item-label"), {
|
|
92
|
+
paddingBottom: token.paddingXS,
|
|
93
|
+
paddingInlineEnd: token.paddingLG
|
|
94
|
+
}), "".concat(componentCls, "-item-content"), {
|
|
95
|
+
paddingBottom: token.paddingXS
|
|
96
|
+
}))), "".concat(componentCls).concat(componentCls, "-content-align-left").concat(componentCls, "-bordered"), _defineProperty(_defineProperty({}, "".concat(componentCls, "-view > table"), {
|
|
97
|
+
tableLayout: 'auto'
|
|
98
|
+
}), "".concat(componentCls, "-row"), _defineProperty(_defineProperty({}, "& > th", {
|
|
99
|
+
whiteSpace: 'nowrap',
|
|
100
|
+
width: 1
|
|
101
|
+
}), "& > td", {
|
|
102
|
+
width: '100%'
|
|
103
|
+
})));
|
|
44
104
|
};
|
|
45
105
|
export default (function (prefixCls, typographyPrefixCls) {
|
|
46
|
-
var useStyle =
|
|
106
|
+
var useStyle = genStyleHooks('Descriptions', function (token) {
|
|
47
107
|
return [genDescriptionsStyle(_objectSpread(_objectSpread({}, token), {}, {
|
|
48
108
|
typographyPrefixCls: typographyPrefixCls,
|
|
49
109
|
typographyComponentCls: ".".concat(typographyPrefixCls)
|
package/es/drawer/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 = ["locale", "children", "onOk", "onClose", "onCancel", "okText", "cancelText", "okButtonProps", "confirmLoading", "footer", "footerExtra", "rootClassName", "bodyStyle", "styles", "prefixCls"];
|
|
2
|
+
var _excluded = ["locale", "children", "loading", "onOk", "onClose", "onCancel", "okText", "cancelText", "okButtonProps", "confirmLoading", "footer", "footerExtra", "rootClassName", "bodyStyle", "styles", "prefixCls"];
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
4
|
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."); }
|
|
5
5
|
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); }
|
|
@@ -28,6 +28,7 @@ export * from 'antd/es/drawer';
|
|
|
28
28
|
var Drawer = function Drawer(_ref) {
|
|
29
29
|
var customLocale = _ref.locale,
|
|
30
30
|
children = _ref.children,
|
|
31
|
+
loading = _ref.loading,
|
|
31
32
|
onOk = _ref.onOk,
|
|
32
33
|
onClose = _ref.onClose,
|
|
33
34
|
onCancel = _ref.onCancel,
|
|
@@ -49,7 +50,8 @@ var Drawer = function Drawer(_ref) {
|
|
|
49
50
|
getPrefixCls = _useContext.getPrefixCls;
|
|
50
51
|
var prefixCls = getPrefixCls('drawer', customizePrefixCls);
|
|
51
52
|
var _useStyle = useStyle(prefixCls),
|
|
52
|
-
|
|
53
|
+
_useStyle2 = _slicedToArray(_useStyle, 1),
|
|
54
|
+
wrapCSSVar = _useStyle2[0];
|
|
53
55
|
var _useState = useState(null),
|
|
54
56
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
57
|
contentElment = _useState2[0],
|
|
@@ -58,16 +60,17 @@ var Drawer = function Drawer(_ref) {
|
|
|
58
60
|
useSize(contentElment);
|
|
59
61
|
// useScroll for re-render when scroll
|
|
60
62
|
var scroll = useScroll(contentElment);
|
|
61
|
-
var isScroll = (contentElment === null || contentElment === void 0 ? void 0 : contentElment.scrollHeight) !== (contentElment === null || contentElment === void 0 ? void 0 : contentElment.clientHeight);
|
|
63
|
+
var isScroll = !loading && (contentElment === null || contentElment === void 0 ? void 0 : contentElment.scrollHeight) !== (contentElment === null || contentElment === void 0 ? void 0 : contentElment.clientHeight);
|
|
62
64
|
// start scroll
|
|
63
|
-
var isStartScroll = scroll.top > 0;
|
|
65
|
+
var isStartScroll = !loading && scroll.top > 0;
|
|
64
66
|
// Determine if an element has been totally scrolled
|
|
65
67
|
// ref: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#determine_if_an_element_has_been_totally_scrolled
|
|
66
|
-
var isTotalScroll = Math.abs(((contentElment === null || contentElment === void 0 ? void 0 : contentElment.scrollHeight) || 0) - ((contentElment === null || contentElment === void 0 ? void 0 : contentElment.clientHeight) || 0) - ((contentElment === null || contentElment === void 0 ? void 0 : contentElment.scrollTop) || 0)) < 1;
|
|
68
|
+
var isTotalScroll = !loading && Math.abs(((contentElment === null || contentElment === void 0 ? void 0 : contentElment.scrollHeight) || 0) - ((contentElment === null || contentElment === void 0 ? void 0 : contentElment.clientHeight) || 0) - ((contentElment === null || contentElment === void 0 ? void 0 : contentElment.scrollTop) || 0)) < 1;
|
|
67
69
|
var handleCancel = onCancel || onClose;
|
|
68
70
|
var showFooter = !!(footer || onOk) && footer !== false && footer !== null;
|
|
69
|
-
var drawerCls = classNames(
|
|
70
|
-
return
|
|
71
|
+
var drawerCls = classNames(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-loading"), loading), "".concat(prefixCls, "-with-footer"), showFooter), rootClassName);
|
|
72
|
+
return wrapCSSVar( /*#__PURE__*/_jsxs(AntDrawer, _objectSpread(_objectSpread({
|
|
73
|
+
loading: loading,
|
|
71
74
|
destroyOnClose: true,
|
|
72
75
|
onClose: handleCancel,
|
|
73
76
|
rootClassName: drawerCls,
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { FullToken, GenerateStyle } from '
|
|
2
|
+
import type { FullToken, GenerateStyle } from '../../theme/interface';
|
|
3
3
|
export type DrawerToken = FullToken<'Drawer'>;
|
|
4
4
|
export declare const genDrawerStyle: GenerateStyle<DrawerToken>;
|
|
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
|
-
};
|
|
5
|
+
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>, string, string];
|
|
9
6
|
export default _default;
|