@oceanbase/design 1.0.0-alpha.7 → 1.0.0-alpha.9
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/card/index.d.ts +2 -0
- package/es/card/index.js +33 -13
- package/es/card/style/index.js +36 -20
- package/es/checkbox/style/index.js +5 -3
- package/es/config-provider/index.js +13 -11
- package/es/descriptions/hooks/useItems.d.ts +9 -9
- package/es/descriptions/index.d.ts +10 -0
- package/es/descriptions/index.js +59 -3
- package/es/descriptions/style/index.js +48 -5
- package/es/drawer/style/index.js +11 -5
- package/es/form/FormItem.d.ts +1 -1
- package/es/form/FormItem.js +7 -9
- package/es/form/style/index.js +9 -9
- package/es/slider/style/index.js +3 -2
- 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.js +4 -4
- package/es/table/index.js +8 -0
- package/es/table/style/index.js +9 -3
- package/es/tag/style/index.js +1 -1
- package/es/theme/default.d.ts +44 -0
- package/es/theme/default.js +159 -40
- package/es/theme/interface.d.ts +43 -0
- package/es/theme/style/compact.less +43 -24
- package/es/theme/style/default.less +43 -24
- package/lib/card/index.d.ts +2 -0
- package/lib/card/index.js +27 -12
- package/lib/card/style/index.js +61 -29
- package/lib/checkbox/style/index.js +4 -3
- package/lib/config-provider/index.js +15 -4
- package/lib/descriptions/hooks/useItems.d.ts +9 -9
- package/lib/descriptions/index.d.ts +10 -0
- package/lib/descriptions/index.js +49 -2
- package/lib/descriptions/style/index.js +85 -4
- package/lib/drawer/style/index.js +9 -4
- package/lib/form/FormItem.d.ts +1 -1
- package/lib/form/FormItem.js +5 -6
- package/lib/form/style/index.js +13 -11
- package/lib/slider/style/index.js +5 -2
- 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.js +4 -4
- package/lib/table/index.js +7 -0
- package/lib/table/style/index.js +10 -1
- package/lib/tag/style/index.js +1 -1
- package/lib/theme/default.d.ts +44 -0
- package/lib/theme/default.js +232 -42
- package/lib/theme/interface.d.ts +43 -0
- package/lib/theme/style/compact.less +43 -24
- package/lib/theme/style/default.less +43 -24
- package/package.json +2 -2
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
@wireframe: false;
|
|
46
46
|
@motion: true;
|
|
47
47
|
@blue-1: #e6f4ff;
|
|
48
|
-
@blue1: #
|
|
48
|
+
@blue1: #f3f8fe;
|
|
49
49
|
@blue-2: #b0dbff;
|
|
50
|
-
@blue2: #
|
|
50
|
+
@blue2: #b3d3ff;
|
|
51
51
|
@blue-3: #87c5ff;
|
|
52
|
-
@blue3: #
|
|
52
|
+
@blue3: #619ef3;
|
|
53
53
|
@blue-4: #5eacff;
|
|
54
|
-
@blue4: #
|
|
54
|
+
@blue4: #0d6cf2;
|
|
55
55
|
@blue-5: #3690ff;
|
|
56
|
-
@blue5: #
|
|
56
|
+
@blue5: #0852bb;
|
|
57
57
|
@blue-6: #0d6cf2;
|
|
58
|
-
@blue6: #
|
|
58
|
+
@blue6: #0d3c80;
|
|
59
59
|
@blue-7: #004ecc;
|
|
60
60
|
@blue7: #004ecc;
|
|
61
61
|
@blue-8: #003aa6;
|
|
@@ -105,17 +105,17 @@
|
|
|
105
105
|
@cyan-10: #002329;
|
|
106
106
|
@cyan10: #002329;
|
|
107
107
|
@green-1: #e4f7ed;
|
|
108
|
-
@green1: #
|
|
108
|
+
@green1: #f5faf8;
|
|
109
109
|
@green-2: #b2ebd0;
|
|
110
|
-
@green2: #
|
|
110
|
+
@green2: #b3e6d5;
|
|
111
111
|
@green-3: #85deb7;
|
|
112
|
-
@green3: #
|
|
112
|
+
@green3: #79d1b4;
|
|
113
113
|
@green-4: #5cd1a2;
|
|
114
|
-
@green4: #
|
|
114
|
+
@green4: #16b882;
|
|
115
115
|
@green-5: #37c491;
|
|
116
|
-
@green5: #
|
|
116
|
+
@green5: #0a8c61;
|
|
117
117
|
@green-6: #16b882;
|
|
118
|
-
@green6: #
|
|
118
|
+
@green6: #09593f;
|
|
119
119
|
@green-7: #0a9169;
|
|
120
120
|
@green7: #0a9169;
|
|
121
121
|
@green-8: #026b4f;
|
|
@@ -165,17 +165,17 @@
|
|
|
165
165
|
@pink-10: #520339;
|
|
166
166
|
@pink10: #520339;
|
|
167
167
|
@red-1: #fff2f0;
|
|
168
|
-
@red1: #
|
|
168
|
+
@red1: #fff2f2;
|
|
169
169
|
@red-2: #ffedeb;
|
|
170
|
-
@red2: #
|
|
170
|
+
@red2: #ffd6d6;
|
|
171
171
|
@red-3: #ffc8c2;
|
|
172
|
-
@red3: #
|
|
172
|
+
@red3: #f69898;
|
|
173
173
|
@red-4: #ffa099;
|
|
174
|
-
@red4: #
|
|
174
|
+
@red4: #eb4242;
|
|
175
175
|
@red-5: #f7716d;
|
|
176
|
-
@red5: #
|
|
176
|
+
@red5: #b52727;
|
|
177
177
|
@red-6: #eb4242;
|
|
178
|
-
@red6: #
|
|
178
|
+
@red6: #8a1b1b;
|
|
179
179
|
@red-7: #c42d32;
|
|
180
180
|
@red7: #c42d32;
|
|
181
181
|
@red-8: #9e1c25;
|
|
@@ -185,17 +185,17 @@
|
|
|
185
185
|
@red-10: #520a13;
|
|
186
186
|
@red10: #520a13;
|
|
187
187
|
@orange-1: #fff7e6;
|
|
188
|
-
@orange1: #
|
|
188
|
+
@orange1: #fff9ee;
|
|
189
189
|
@orange-2: #ffe7ba;
|
|
190
|
-
@orange2: #
|
|
190
|
+
@orange2: #ffe7c2;
|
|
191
191
|
@orange-3: #ffd591;
|
|
192
|
-
@orange3: #
|
|
192
|
+
@orange3: #fac373;
|
|
193
193
|
@orange-4: #ffc069;
|
|
194
|
-
@orange4: #
|
|
194
|
+
@orange4: #f49f25;
|
|
195
195
|
@orange-5: #ffa940;
|
|
196
|
-
@orange5: #
|
|
196
|
+
@orange5: #ac690b;
|
|
197
197
|
@orange-6: #fa8c16;
|
|
198
|
-
@orange6: #
|
|
198
|
+
@orange6: #6c4408;
|
|
199
199
|
@orange-7: #d46b08;
|
|
200
200
|
@orange7: #d46b08;
|
|
201
201
|
@orange-8: #ad4e00;
|
|
@@ -426,6 +426,25 @@
|
|
|
426
426
|
@boxShadowSecondary: 0 6px 16px 0 rgba(54, 69, 99, 0.08), 0 3px 6px -4px rgba(54, 69, 99, 0.12), 0 9px 28px 8px rgba(54, 69, 99, 0.05);
|
|
427
427
|
@boxShadowTertiary: 0 1px 2px 0 rgba(54, 69, 99, 0.03), 0 1px 6px -1px rgba(54, 69, 99, 0.02), 0 2px 4px 0 rgba(54, 69, 99, 0.02);
|
|
428
428
|
@lineWidthFocus: 3px;
|
|
429
|
+
@white: #ffffff;
|
|
430
|
+
@black: #000000;
|
|
431
|
+
@gray1: #fbfcfe;
|
|
432
|
+
@gray2: #f5f7fc;
|
|
433
|
+
@gray3: #ebeff7;
|
|
434
|
+
@gray4: #e2e8f3;
|
|
435
|
+
@gray5: #cdd5e4;
|
|
436
|
+
@gray6: #b6c0d4;
|
|
437
|
+
@gray7: #8592ad;
|
|
438
|
+
@gray8: #5c6b8a;
|
|
439
|
+
@gray9: #3b4a69;
|
|
440
|
+
@fuchsia1: #faf0fc;
|
|
441
|
+
@fuchsia2: #e8caee;
|
|
442
|
+
@fuchsia3: #d88ee7;
|
|
443
|
+
@fuchsia4: #b04ec4;
|
|
444
|
+
@fuchsia5: #802792;
|
|
445
|
+
@fuchsia6: #580e67;
|
|
446
|
+
@colorNaviBg: #f1f6ff;
|
|
447
|
+
@colorNaviBgHover: #e8effb;
|
|
429
448
|
@colorFillContent: #e2e8f3;
|
|
430
449
|
@colorFillContentHover: #cdd5e4;
|
|
431
450
|
@colorFillAlter: #f5f7fc;
|
package/lib/card/index.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ export interface CardTabListType extends AntCardTabListType {
|
|
|
6
6
|
tag?: React.ReactNode;
|
|
7
7
|
}
|
|
8
8
|
export interface CardProps extends AntCardProps {
|
|
9
|
+
subTitle?: React.ReactNode;
|
|
9
10
|
divided?: boolean;
|
|
11
|
+
gray?: boolean;
|
|
10
12
|
tabList?: CardTabListType[];
|
|
11
13
|
collapsible?: boolean;
|
|
12
14
|
defaultCollapsed?: boolean;
|
package/lib/card/index.js
CHANGED
|
@@ -50,9 +50,13 @@ var Card = import_react.default.forwardRef(
|
|
|
50
50
|
children,
|
|
51
51
|
size,
|
|
52
52
|
title,
|
|
53
|
+
subTitle,
|
|
54
|
+
extra,
|
|
53
55
|
tabList,
|
|
54
56
|
tabProps,
|
|
57
|
+
tabBarExtraContent,
|
|
55
58
|
divided: outerDivided,
|
|
59
|
+
gray,
|
|
56
60
|
prefixCls: customizePrefixCls,
|
|
57
61
|
bodyStyle,
|
|
58
62
|
styles,
|
|
@@ -61,15 +65,10 @@ var Card = import_react.default.forwardRef(
|
|
|
61
65
|
defaultCollapsed,
|
|
62
66
|
collapsed: outerCollapsed,
|
|
63
67
|
onCollapse,
|
|
64
|
-
extra,
|
|
65
68
|
...restProps
|
|
66
69
|
}, ref) => {
|
|
67
70
|
var _a;
|
|
68
|
-
const {
|
|
69
|
-
getPrefixCls,
|
|
70
|
-
card: contextCard,
|
|
71
|
-
iconPrefixCls
|
|
72
|
-
} = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
71
|
+
const { getPrefixCls, card: contextCard } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
73
72
|
const { token } = import_theme.default.useToken();
|
|
74
73
|
const divided = outerDivided ?? (contextCard == null ? void 0 : contextCard.divided) ?? true;
|
|
75
74
|
const prefixCls = getPrefixCls("card", customizePrefixCls);
|
|
@@ -85,12 +84,26 @@ var Card = import_react.default.forwardRef(
|
|
|
85
84
|
onCollapse == null ? void 0 : onCollapse(newCollapsed);
|
|
86
85
|
}, [collapsed, outerCollapsed, onCollapse]);
|
|
87
86
|
const cardTitle = (0, import_react.useMemo)(() => {
|
|
88
|
-
if (!collapsible) {
|
|
87
|
+
if (!collapsible && !subTitle) {
|
|
89
88
|
return title;
|
|
90
89
|
}
|
|
91
90
|
if (!title) {
|
|
92
91
|
return null;
|
|
93
92
|
}
|
|
93
|
+
const titleContent = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title }),
|
|
95
|
+
subTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${prefixCls}-sub-title`, children: subTitle })
|
|
96
|
+
] });
|
|
97
|
+
if (!collapsible) {
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: `${prefixCls}-title-wrapper`,
|
|
102
|
+
style: { display: "flex", alignItems: "center" },
|
|
103
|
+
children: titleContent
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
94
107
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
95
108
|
"div",
|
|
96
109
|
{
|
|
@@ -110,16 +123,17 @@ var Card = import_react.default.forwardRef(
|
|
|
110
123
|
}
|
|
111
124
|
}
|
|
112
125
|
),
|
|
113
|
-
|
|
126
|
+
titleContent
|
|
114
127
|
]
|
|
115
128
|
}
|
|
116
129
|
);
|
|
117
|
-
}, [collapsible, title, collapsed, prefixCls, token, handleCollapse]);
|
|
130
|
+
}, [collapsible, title, subTitle, collapsed, prefixCls, token, handleCollapse]);
|
|
118
131
|
const noBodyHorizontalPadding = (0, import_util2.isHorizontalPaddingZero)(bodyStyle == null ? void 0 : bodyStyle.padding) || (0, import_util2.isHorizontalPaddingZero)((_a = styles == null ? void 0 : styles.body) == null ? void 0 : _a.padding);
|
|
119
132
|
const cardCls = (0, import_classnames.default)(
|
|
120
133
|
{
|
|
121
|
-
[`${prefixCls}-has-
|
|
134
|
+
[`${prefixCls}-has-head`]: !!(title || extra || tabList || tabBarExtraContent),
|
|
122
135
|
[`${prefixCls}-no-divider`]: !divided,
|
|
136
|
+
[`${prefixCls}-gray`]: gray,
|
|
123
137
|
[`${prefixCls}-no-body-horizontal-padding`]: noBodyHorizontalPadding,
|
|
124
138
|
[`${prefixCls}-collapsible`]: collapsible,
|
|
125
139
|
[`${prefixCls}-collapsed`]: collapsed
|
|
@@ -145,9 +159,11 @@ var Card = import_react.default.forwardRef(
|
|
|
145
159
|
ref,
|
|
146
160
|
size,
|
|
147
161
|
title: cardTitle,
|
|
162
|
+
extra,
|
|
148
163
|
tabList: newTabList,
|
|
164
|
+
tabBarExtraContent,
|
|
149
165
|
tabProps: {
|
|
150
|
-
size: "middle",
|
|
166
|
+
size: size === "small" ? "small" : "middle",
|
|
151
167
|
...tabProps
|
|
152
168
|
},
|
|
153
169
|
prefixCls: customizePrefixCls,
|
|
@@ -156,7 +172,6 @@ var Card = import_react.default.forwardRef(
|
|
|
156
172
|
},
|
|
157
173
|
styles,
|
|
158
174
|
className: cardCls,
|
|
159
|
-
extra,
|
|
160
175
|
...restProps,
|
|
161
176
|
children
|
|
162
177
|
}
|
package/lib/card/style/index.js
CHANGED
|
@@ -24,7 +24,6 @@ __export(style_exports, {
|
|
|
24
24
|
genTableStyle: () => genTableStyle
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(style_exports);
|
|
27
|
-
var import_cssinjs = require("@ant-design/cssinjs");
|
|
28
27
|
var import_style = require("../../tabs/style");
|
|
29
28
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
30
29
|
var genTableStyle = (padding, token) => {
|
|
@@ -60,6 +59,23 @@ var genCardStyle = (token) => {
|
|
|
60
59
|
const tableComponentCls = `${antCls}-table`;
|
|
61
60
|
return {
|
|
62
61
|
[`${componentCls}`]: {
|
|
62
|
+
[`${componentCls}-head`]: {
|
|
63
|
+
// subTitle style
|
|
64
|
+
[`${componentCls}-sub-title`]: {
|
|
65
|
+
marginInlineStart: token.marginXS,
|
|
66
|
+
fontWeight: "normal",
|
|
67
|
+
fontSize: token.fontSize,
|
|
68
|
+
color: token.colorTextDescription
|
|
69
|
+
},
|
|
70
|
+
// remove divider for top and bottom tabs
|
|
71
|
+
[tabsComponentCls]: {
|
|
72
|
+
[`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
|
|
73
|
+
[`${tabsComponentCls}-nav::before`]: {
|
|
74
|
+
border: "none"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
63
79
|
[`${componentCls}-body`]: {
|
|
64
80
|
paddingTop: token.padding
|
|
65
81
|
},
|
|
@@ -78,35 +94,42 @@ var genCardStyle = (token) => {
|
|
|
78
94
|
}
|
|
79
95
|
}
|
|
80
96
|
},
|
|
97
|
+
[`${componentCls}${componentCls}-has-head${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
98
|
+
[`${componentCls}-body`]: {
|
|
99
|
+
paddingTop: 0
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[`${componentCls}:not(${componentCls}-has-head)`]: {
|
|
103
|
+
[`${componentCls}-body`]: {
|
|
104
|
+
paddingTop: paddingLG
|
|
105
|
+
}
|
|
106
|
+
},
|
|
81
107
|
[`${componentCls}${componentCls}-no-divider`]: {
|
|
82
108
|
[`${componentCls}-head`]: {
|
|
83
|
-
//
|
|
84
|
-
borderBottomColor: "transparent"
|
|
85
|
-
paddingTop: token.paddingLG,
|
|
86
|
-
paddingBottom: token.padding,
|
|
87
|
-
// remove divider for top and bottom tabs
|
|
88
|
-
[tabsComponentCls]: {
|
|
89
|
-
[`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
|
|
90
|
-
[`${tabsComponentCls}-nav::before`]: {
|
|
91
|
-
border: "none"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
109
|
+
// hide bottom border by setting borderBottomColor to transparent
|
|
110
|
+
borderBottomColor: "transparent"
|
|
95
111
|
}
|
|
96
112
|
},
|
|
97
113
|
[`${componentCls}${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
98
|
-
[`${componentCls}-
|
|
99
|
-
|
|
114
|
+
[`${componentCls}-head`]: {
|
|
115
|
+
paddingTop: token.paddingLG,
|
|
116
|
+
paddingBottom: token.padding
|
|
100
117
|
}
|
|
101
118
|
},
|
|
102
|
-
[`${componentCls}-small`]: {
|
|
119
|
+
[`${componentCls}${componentCls}-small:not(${componentCls}-has-head)`]: {
|
|
103
120
|
[`${componentCls}-body`]: {
|
|
104
|
-
paddingTop:
|
|
121
|
+
paddingTop: paddingSM
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
[`${componentCls}${componentCls}-small${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
125
|
+
[`${componentCls}-head`]: {
|
|
126
|
+
paddingTop: token.paddingSM,
|
|
127
|
+
paddingBottom: token.paddingXS
|
|
105
128
|
}
|
|
106
129
|
},
|
|
107
|
-
[`${componentCls}-small
|
|
130
|
+
[`${componentCls}-small`]: {
|
|
108
131
|
[`${componentCls}-body`]: {
|
|
109
|
-
|
|
132
|
+
paddingTop: token.paddingXS
|
|
110
133
|
}
|
|
111
134
|
},
|
|
112
135
|
[`${componentCls}-small${componentCls}-contain-tabs >${componentCls}-head`]: {
|
|
@@ -120,14 +143,7 @@ var genCardStyle = (token) => {
|
|
|
120
143
|
...token,
|
|
121
144
|
componentCls: tabsComponentCls,
|
|
122
145
|
prefixCls: tabsPrefixCls
|
|
123
|
-
})
|
|
124
|
-
[tabsComponentCls]: {
|
|
125
|
-
[`&${tabsComponentCls}-top, &${tabsComponentCls}-bottom`]: {
|
|
126
|
-
[`${tabsComponentCls}-tab`]: {
|
|
127
|
-
paddingBlock: token.padding
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
146
|
+
})
|
|
131
147
|
}
|
|
132
148
|
},
|
|
133
149
|
[`${componentCls}${componentCls}-contain-grid`]: {
|
|
@@ -143,7 +159,7 @@ var genCardStyle = (token) => {
|
|
|
143
159
|
}
|
|
144
160
|
},
|
|
145
161
|
// reduce margin between card title and table
|
|
146
|
-
[`&${componentCls}-has-
|
|
162
|
+
[`&${componentCls}-has-head${componentCls}-no-divider:not(${componentCls}-contain-tabs)`]: {
|
|
147
163
|
[`${componentCls}-body`]: {
|
|
148
164
|
[`& > ${tableComponentCls}-wrapper ${tableComponentCls}:not(${tableComponentCls}-bordered):first-child`]: {
|
|
149
165
|
marginTop: calc(token.marginSM).mul(-1).equal()
|
|
@@ -178,8 +194,24 @@ var genCardStyle = (token) => {
|
|
|
178
194
|
},
|
|
179
195
|
// hide bottom border of head when collapsed, avoid double border
|
|
180
196
|
[`${componentCls}-head`]: {
|
|
181
|
-
|
|
197
|
+
borderBottomColor: "transparent"
|
|
198
|
+
},
|
|
199
|
+
[`&${componentCls}-no-divider`]: {
|
|
200
|
+
[`${componentCls}-head`]: {
|
|
201
|
+
paddingBottom: paddingLG
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
[`&${componentCls}-no-divider${componentCls}-small`]: {
|
|
205
|
+
[`${componentCls}-head`]: {
|
|
206
|
+
paddingBottom: paddingSM
|
|
207
|
+
}
|
|
182
208
|
}
|
|
209
|
+
},
|
|
210
|
+
// gray background card style
|
|
211
|
+
[`${componentCls}${componentCls}-gray`]: {
|
|
212
|
+
boxShadow: "none",
|
|
213
|
+
borderRadius: token.borderRadiusMD,
|
|
214
|
+
backgroundColor: token.colorFillQuaternary
|
|
183
215
|
}
|
|
184
216
|
};
|
|
185
217
|
};
|
|
@@ -23,16 +23,17 @@ __export(style_exports, {
|
|
|
23
23
|
genCheckboxStyle: () => genCheckboxStyle
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(style_exports);
|
|
26
|
+
var import_cssinjs = require("@ant-design/cssinjs");
|
|
26
27
|
var import_genComponentStyleHook = require("../../_util/genComponentStyleHook");
|
|
27
28
|
var genCheckboxStyle = (token) => {
|
|
28
|
-
const { componentCls, fontSize,
|
|
29
|
-
const translateY = calc(
|
|
29
|
+
const { componentCls, fontSize, lineHeight, lineWidth, controlInteractiveSize, calc } = token;
|
|
30
|
+
const translateY = calc(fontSize).mul(lineHeight).sub(controlInteractiveSize).sub(lineWidth).div(2).equal();
|
|
30
31
|
return {
|
|
31
32
|
[`${componentCls}-wrapper`]: {
|
|
32
33
|
[`${componentCls}`]: {
|
|
33
34
|
alignSelf: "baseline",
|
|
34
35
|
[`${componentCls}-inner`]: {
|
|
35
|
-
transform: `translate(0px, ${translateY})`
|
|
36
|
+
transform: `translate(0px, ${(0, import_cssinjs.unit)(translateY)})`
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -48,6 +48,7 @@ var import_dark = __toESM(require("../theme/dark"));
|
|
|
48
48
|
var import_compact = __toESM(require("../theme/compact"));
|
|
49
49
|
var import_DefaultRenderEmpty = __toESM(require("./DefaultRenderEmpty"));
|
|
50
50
|
var import_global = __toESM(require("../style/global"));
|
|
51
|
+
var import_cssVariables = __toESM(require("../style/cssVariables"));
|
|
51
52
|
__reExport(config_provider_exports, require("./navigate"), module.exports);
|
|
52
53
|
__reExport(config_provider_exports, require("antd/es/config-provider/context"), module.exports);
|
|
53
54
|
__reExport(config_provider_exports, require("antd/es/config-provider/SizeContext"), module.exports);
|
|
@@ -78,7 +79,7 @@ var ConfigProvider = ({
|
|
|
78
79
|
appProps,
|
|
79
80
|
...restProps
|
|
80
81
|
}) => {
|
|
81
|
-
var _a, _b, _c, _d;
|
|
82
|
+
var _a, _b, _c, _d, _e;
|
|
82
83
|
const parentContext = import_react.default.useContext(import_antd.ConfigProvider.ConfigContext);
|
|
83
84
|
const parentExtendedContext = import_react.default.useContext(ExtendedConfigContext);
|
|
84
85
|
const { isAliyun, isDark, isCompact } = (0, import_lodash.merge)({}, parentContext.theme, theme);
|
|
@@ -122,8 +123,9 @@ var ConfigProvider = ({
|
|
|
122
123
|
);
|
|
123
124
|
const { token } = import_theme.default.useToken();
|
|
124
125
|
const fontFamily = ((_a = mergedTheme.token) == null ? void 0 : _a.fontFamily) || token.fontFamily;
|
|
125
|
-
const
|
|
126
|
-
const
|
|
126
|
+
const fontWeightWeak = ((_b = mergedTheme.token) == null ? void 0 : _b.fontWeightWeak) || token.fontWeightWeak;
|
|
127
|
+
const fontWeight = ((_c = mergedTheme.token) == null ? void 0 : _c.fontWeight) || token.fontWeight;
|
|
128
|
+
const fontWeightStrong = ((_d = mergedTheme.token) == null ? void 0 : _d.fontWeightStrong) || token.fontWeightStrong;
|
|
127
129
|
const parentStyleContext = import_react.default.useContext(import_StyleContext.default);
|
|
128
130
|
const mergedStyleProviderProps = (0, import_lodash.merge)({}, parentStyleContext, styleProviderProps);
|
|
129
131
|
const mergedLocale = (0, import_lodash.merge)({}, parentContext.locale, locale);
|
|
@@ -171,6 +173,7 @@ var ConfigProvider = ({
|
|
|
171
173
|
{
|
|
172
174
|
onClick: (e) => onExpand(record, e),
|
|
173
175
|
style: {
|
|
176
|
+
// marginRight: mergedTheme.token?.marginXS || 8,
|
|
174
177
|
transition: `transform 0.2s`,
|
|
175
178
|
transform: expanded ? "rotate(90deg)" : void 0,
|
|
176
179
|
color: ((_a2 = mergedTheme.token) == null ? void 0 : _a2.colorIcon) || ((_b2 = mergedTheme.token) == null ? void 0 : _b2.colorTextSecondary)
|
|
@@ -193,6 +196,13 @@ var ConfigProvider = ({
|
|
|
193
196
|
fontFamily,
|
|
194
197
|
import_default.fontFamilyEn
|
|
195
198
|
),
|
|
199
|
+
...getLocaleTokenValue(
|
|
200
|
+
mergedTheme.token || {},
|
|
201
|
+
mergedLocale,
|
|
202
|
+
"fontWeightWeak",
|
|
203
|
+
fontWeightWeak,
|
|
204
|
+
import_default.fontWeightWeakEn
|
|
205
|
+
),
|
|
196
206
|
...getLocaleTokenValue(
|
|
197
207
|
mergedTheme.token || {},
|
|
198
208
|
mergedLocale,
|
|
@@ -216,11 +226,12 @@ var ConfigProvider = ({
|
|
|
216
226
|
{
|
|
217
227
|
value: {
|
|
218
228
|
navigate: navigate === void 0 ? parentExtendedContext.navigate : navigate,
|
|
219
|
-
hideOnSinglePage: ((
|
|
229
|
+
hideOnSinglePage: ((_e = parentContext.pagination) == null ? void 0 : _e.showSizeChanger) ? false : hideOnSinglePage !== void 0 ? hideOnSinglePage : parentExtendedContext.hideOnSinglePage,
|
|
220
230
|
// inject static function to outermost ConfigProvider only
|
|
221
231
|
injectStaticFunction: false
|
|
222
232
|
},
|
|
223
233
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_cssinjs.StyleProvider, { ...mergedStyleProviderProps, children: [
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_cssVariables.default, {}),
|
|
224
235
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_global.default, { prefixCls: restProps.prefixCls }),
|
|
225
236
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_app.default, { component: false, ...appProps, children: [
|
|
226
237
|
children,
|
|
@@ -3,19 +3,19 @@ import type { DescriptionsItemType } from '..';
|
|
|
3
3
|
export default function useItems(items?: DescriptionsItemType[], children?: React.ReactNode, bordered?: boolean): {
|
|
4
4
|
children: string | number | boolean | Iterable<React.ReactNode> | import("@emotion/react/jsx-runtime").JSX.Element;
|
|
5
5
|
key?: React.Key;
|
|
6
|
+
classNames?: Partial<Record<"content" | "label", string>>;
|
|
7
|
+
styles?: Partial<Record<"content" | "label", React.CSSProperties>>;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: React.CSSProperties;
|
|
6
10
|
label?: React.ReactNode;
|
|
7
11
|
span?: number | "filled" | {
|
|
8
|
-
xs?: number;
|
|
9
|
-
sm?: number;
|
|
10
|
-
md?: number;
|
|
11
|
-
lg?: number;
|
|
12
|
-
xl?: number;
|
|
13
12
|
xxl?: number;
|
|
13
|
+
xl?: number;
|
|
14
|
+
lg?: number;
|
|
15
|
+
md?: number;
|
|
16
|
+
sm?: number;
|
|
17
|
+
xs?: number;
|
|
14
18
|
};
|
|
15
|
-
style?: React.CSSProperties;
|
|
16
|
-
classNames?: Partial<Record<"label" | "content", string>>;
|
|
17
|
-
styles?: Partial<Record<"label" | "content", React.CSSProperties>>;
|
|
18
|
-
className?: string;
|
|
19
19
|
labelStyle?: React.CSSProperties;
|
|
20
20
|
contentStyle?: React.CSSProperties;
|
|
21
21
|
}[];
|
|
@@ -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;
|
|
@@ -36,7 +36,9 @@ module.exports = __toCommonJS(descriptions_exports);
|
|
|
36
36
|
var import_antd = require("antd");
|
|
37
37
|
var import_classnames = __toESM(require("classnames"));
|
|
38
38
|
var import_react = require("react");
|
|
39
|
+
var import_icons = require("@oceanbase/icons");
|
|
39
40
|
var import_config_provider = __toESM(require("../config-provider"));
|
|
41
|
+
var import_theme = __toESM(require("../theme"));
|
|
40
42
|
var import_Item = __toESM(require("./Item"));
|
|
41
43
|
var import_useItems = __toESM(require("./hooks/useItems"));
|
|
42
44
|
var import_style = __toESM(require("./style"));
|
|
@@ -48,19 +50,62 @@ var Descriptions = ({
|
|
|
48
50
|
layout = "horizontal",
|
|
49
51
|
colon = layout === "vertical" ? false : void 0,
|
|
50
52
|
items,
|
|
53
|
+
title,
|
|
51
54
|
prefixCls: customizePrefixCls,
|
|
52
55
|
className,
|
|
56
|
+
column = 3,
|
|
57
|
+
collapsible,
|
|
58
|
+
collapsed: outerCollapsed,
|
|
59
|
+
defaultCollapsed,
|
|
60
|
+
onCollapse,
|
|
61
|
+
contentAlign,
|
|
53
62
|
...restProps
|
|
54
63
|
}) => {
|
|
55
64
|
const { getPrefixCls } = (0, import_react.useContext)(import_config_provider.default.ConfigContext);
|
|
65
|
+
const { token } = import_theme.default.useToken();
|
|
56
66
|
const prefixCls = getPrefixCls("descriptions", customizePrefixCls);
|
|
57
67
|
const typographyPrefixCls = getPrefixCls("typography", customizePrefixCls);
|
|
58
68
|
const { wrapSSR } = (0, import_style.default)(prefixCls, typographyPrefixCls);
|
|
69
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react.useState)(defaultCollapsed ?? false);
|
|
70
|
+
const collapsed = outerCollapsed !== void 0 ? outerCollapsed : internalCollapsed;
|
|
71
|
+
const handleCollapse = (0, import_react.useCallback)(() => {
|
|
72
|
+
const newCollapsed = !collapsed;
|
|
73
|
+
if (outerCollapsed === void 0) {
|
|
74
|
+
setInternalCollapsed(newCollapsed);
|
|
75
|
+
}
|
|
76
|
+
onCollapse == null ? void 0 : onCollapse(newCollapsed);
|
|
77
|
+
}, [collapsed, outerCollapsed, onCollapse]);
|
|
78
|
+
const newItems = (0, import_useItems.default)(items, children, bordered);
|
|
79
|
+
const descriptionsTitle = (0, import_react.useMemo)(() => {
|
|
80
|
+
if (!collapsible) {
|
|
81
|
+
return title;
|
|
82
|
+
}
|
|
83
|
+
if (!title) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${prefixCls}-title-wrapper`, onClick: handleCollapse, children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
import_icons.CaretRightFilled,
|
|
89
|
+
{
|
|
90
|
+
className: `${prefixCls}-collapsible-icon`,
|
|
91
|
+
style: {
|
|
92
|
+
transition: `transform ${token.motionDurationMid}`,
|
|
93
|
+
transform: collapsed ? void 0 : "rotate(90deg)",
|
|
94
|
+
color: token.colorIcon,
|
|
95
|
+
marginRight: token.marginXS
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title })
|
|
100
|
+
] });
|
|
101
|
+
}, [collapsible, title, collapsed, prefixCls, token, handleCollapse]);
|
|
59
102
|
const descriptionsCls = (0, import_classnames.default)(className, {
|
|
60
103
|
[`${prefixCls}-vertical`]: layout === "vertical",
|
|
61
|
-
[`${prefixCls}-horizontal`]: layout === "horizontal"
|
|
104
|
+
[`${prefixCls}-horizontal`]: layout === "horizontal",
|
|
105
|
+
[`${prefixCls}-collapsible`]: collapsible,
|
|
106
|
+
[`${prefixCls}-collapsed`]: collapsible && collapsed,
|
|
107
|
+
[`${prefixCls}-content-align-left`]: contentAlign === "left"
|
|
62
108
|
});
|
|
63
|
-
const newItems = (0, import_useItems.default)(items, children, bordered);
|
|
64
109
|
return wrapSSR(
|
|
65
110
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
111
|
import_antd.Descriptions,
|
|
@@ -68,7 +113,9 @@ var Descriptions = ({
|
|
|
68
113
|
layout,
|
|
69
114
|
colon,
|
|
70
115
|
bordered,
|
|
116
|
+
column,
|
|
71
117
|
items: newItems,
|
|
118
|
+
title: descriptionsTitle,
|
|
72
119
|
prefixCls: customizePrefixCls,
|
|
73
120
|
className: descriptionsCls,
|
|
74
121
|
...restProps
|