@oceanbase/design 0.2.20 → 0.2.22
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.js +7 -3
- package/es/card/index.d.ts +1 -1
- package/es/card/index.js +2 -35
- package/es/config-provider/index.d.ts +3 -1
- package/es/config-provider/index.js +7 -1
- package/es/index.js +1 -4
- package/es/menu/index.d.ts +1 -0
- package/es/menu/index.js +1 -0
- package/es/tabs/index.d.ts +1 -1
- package/es/tabs/index.js +3 -47
- package/es/theme/default.d.ts +0 -1
- package/es/theme/default.js +4 -5
- package/es/theme/index.d.ts +3 -0
- package/lib/_util/genComponentStyleHook.js +13 -1
- package/lib/card/index.d.ts +1 -1
- package/lib/card/index.js +1 -36
- package/lib/config-provider/index.d.ts +3 -1
- package/lib/config-provider/index.js +15 -1
- package/lib/index.js +2 -2
- package/lib/menu/index.d.ts +1 -0
- package/lib/menu/index.js +2 -0
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/index.js +0 -32
- package/lib/theme/default.d.ts +0 -1
- package/lib/theme/default.js +4 -5
- package/lib/theme/index.d.ts +3 -0
- package/package.json +8 -8
- package/es/tabs/hooks/useInkBar.d.ts +0 -12
- package/es/tabs/hooks/useInkBar.js +0 -41
- package/lib/tabs/hooks/useInkBar.d.ts +0 -12
- package/lib/tabs/hooks/useInkBar.js +0 -62
package/lib/theme/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanbase/design",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
4
4
|
"description": "The Design System of OceanBase",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"oceanbase",
|
|
@@ -35,26 +35,26 @@
|
|
|
35
35
|
"postbuild": "cp src/style/reset.css dist/"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ant-design/cssinjs": "^1.17.
|
|
39
|
-
"@oceanbase/icons": "^0.2.
|
|
40
|
-
"@oceanbase/util": "^0.2.
|
|
38
|
+
"@ant-design/cssinjs": "^1.17.2",
|
|
39
|
+
"@oceanbase/icons": "^0.2.8",
|
|
40
|
+
"@oceanbase/util": "^0.2.10",
|
|
41
41
|
"ahooks": "^2.10.14",
|
|
42
|
-
"antd": "^5.
|
|
42
|
+
"antd": "^5.10.1",
|
|
43
43
|
"classnames": "^2.3.2",
|
|
44
44
|
"lodash": "^4.17.21",
|
|
45
45
|
"lottie-web": "^5.12.2",
|
|
46
46
|
"prop-types": "^15.8.1",
|
|
47
|
-
"rc-util": "^5.
|
|
47
|
+
"rc-util": "^5.38.0",
|
|
48
48
|
"react-sticky-mouse-tooltip": "^0.0.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@babel/cli": "^7.23.0",
|
|
52
|
-
"@babel/preset-env": "^7.
|
|
52
|
+
"@babel/preset-env": "^7.23.2",
|
|
53
53
|
"antd-token-previewer": "^1.1.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": ">=16.9.0",
|
|
57
57
|
"react-dom": ">=16.9.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "265c33e6cc878f7b00c14518850c93c91749353b"
|
|
60
60
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
2
|
-
import type { TabsPosition, TabsType } from 'antd/es/tabs';
|
|
3
|
-
import type { MutableRefObject } from 'react';
|
|
4
|
-
declare const _default: ({ prefixCls, activeKey, size, type, tabPosition, containerRef, }: {
|
|
5
|
-
prefixCls: string;
|
|
6
|
-
activeKey: string;
|
|
7
|
-
size: SizeType;
|
|
8
|
-
type: TabsType;
|
|
9
|
-
tabPosition: TabsPosition;
|
|
10
|
-
containerRef: MutableRefObject<HTMLDivElement>;
|
|
11
|
-
}) => void;
|
|
12
|
-
export default _default;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
export default (function (_ref) {
|
|
3
|
-
var prefixCls = _ref.prefixCls,
|
|
4
|
-
activeKey = _ref.activeKey,
|
|
5
|
-
size = _ref.size,
|
|
6
|
-
type = _ref.type,
|
|
7
|
-
tabPosition = _ref.tabPosition,
|
|
8
|
-
containerRef = _ref.containerRef;
|
|
9
|
-
var isHorizontal = !tabPosition || tabPosition === 'top' || tabPosition === 'bottom';
|
|
10
|
-
var isVertical = tabPosition === 'left' || tabPosition === 'right';
|
|
11
|
-
useEffect(function () {
|
|
12
|
-
var _containerNode$getEle;
|
|
13
|
-
// Tabs 容器节点
|
|
14
|
-
var containerNode = containerRef.current;
|
|
15
|
-
// inkbar 节点
|
|
16
|
-
var inkBarNode = containerNode === null || containerNode === void 0 ? void 0 : (_containerNode$getEle = containerNode.getElementsByClassName("".concat(prefixCls, "-ink-bar"))) === null || _containerNode$getEle === void 0 ? void 0 : _containerNode$getEle[0];
|
|
17
|
-
// 当前选中的 Tab 节点
|
|
18
|
-
var activeTabNode = containerNode === null || containerNode === void 0 ? void 0 : containerNode.querySelector("[data-node-key=\"".concat(activeKey, "\"]"));
|
|
19
|
-
// 当前选中的 Tab 下的 btn 节点
|
|
20
|
-
var activeTabBtnNode = containerNode === null || containerNode === void 0 ? void 0 : containerNode.querySelector("[data-node-key=\"".concat(activeKey, "\"]>.").concat(prefixCls, "-tab-btn"));
|
|
21
|
-
|
|
22
|
-
// 水平布局下 inkbar 的偏移量
|
|
23
|
-
var horizontalOffset = 8;
|
|
24
|
-
setTimeout(function () {
|
|
25
|
-
if ((!type || type === 'line') && inkBarNode) {
|
|
26
|
-
// 水平布局,如果 inkbar 宽度 >= 24,则两侧各减去 8px,并保持水平居中
|
|
27
|
-
if (isHorizontal && (activeTabNode === null || activeTabNode === void 0 ? void 0 : activeTabNode.offsetWidth) >= 24) {
|
|
28
|
-
inkBarNode.style.width = "".concat((activeTabNode === null || activeTabNode === void 0 ? void 0 : activeTabNode.offsetWidth) - horizontalOffset * 2, "px");
|
|
29
|
-
inkBarNode.style.marginLeft = "".concat(horizontalOffset, "px");
|
|
30
|
-
inkBarNode.style.marginTop = '0px';
|
|
31
|
-
}
|
|
32
|
-
// 垂直布局,inkbar 高度始终与 Tab btn 相同,并保持垂直居中
|
|
33
|
-
if (isVertical) {
|
|
34
|
-
inkBarNode.style.height = "".concat(activeTabBtnNode === null || activeTabBtnNode === void 0 ? void 0 : activeTabBtnNode.offsetHeight, "px");
|
|
35
|
-
inkBarNode.style.marginTop = "".concat(((activeTabNode === null || activeTabNode === void 0 ? void 0 : activeTabNode.offsetHeight) - (activeTabBtnNode === null || activeTabBtnNode === void 0 ? void 0 : activeTabBtnNode.offsetHeight)) / 2, "px");
|
|
36
|
-
inkBarNode.style.marginLeft = '0px';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}, 100);
|
|
40
|
-
}, [prefixCls, activeKey, size, type, isHorizontal, isVertical, containerRef]);
|
|
41
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { SizeType } from 'antd/es/config-provider/SizeContext';
|
|
2
|
-
import type { TabsPosition, TabsType } from 'antd/es/tabs';
|
|
3
|
-
import type { MutableRefObject } from 'react';
|
|
4
|
-
declare const _default: ({ prefixCls, activeKey, size, type, tabPosition, containerRef, }: {
|
|
5
|
-
prefixCls: string;
|
|
6
|
-
activeKey: string;
|
|
7
|
-
size: SizeType;
|
|
8
|
-
type: TabsType;
|
|
9
|
-
tabPosition: TabsPosition;
|
|
10
|
-
containerRef: MutableRefObject<HTMLDivElement>;
|
|
11
|
-
}) => void;
|
|
12
|
-
export default _default;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/tabs/hooks/useInkBar.ts
|
|
20
|
-
var useInkBar_exports = {};
|
|
21
|
-
__export(useInkBar_exports, {
|
|
22
|
-
default: () => useInkBar_default
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(useInkBar_exports);
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
var useInkBar_default = ({
|
|
27
|
-
prefixCls,
|
|
28
|
-
activeKey,
|
|
29
|
-
size,
|
|
30
|
-
type,
|
|
31
|
-
tabPosition,
|
|
32
|
-
containerRef
|
|
33
|
-
}) => {
|
|
34
|
-
const isHorizontal = !tabPosition || tabPosition === "top" || tabPosition === "bottom";
|
|
35
|
-
const isVertical = tabPosition === "left" || tabPosition === "right";
|
|
36
|
-
(0, import_react.useEffect)(() => {
|
|
37
|
-
var _a;
|
|
38
|
-
const containerNode = containerRef.current;
|
|
39
|
-
const inkBarNode = (_a = containerNode == null ? void 0 : containerNode.getElementsByClassName(
|
|
40
|
-
`${prefixCls}-ink-bar`
|
|
41
|
-
)) == null ? void 0 : _a[0];
|
|
42
|
-
const activeTabNode = containerNode == null ? void 0 : containerNode.querySelector(`[data-node-key="${activeKey}"]`);
|
|
43
|
-
const activeTabBtnNode = containerNode == null ? void 0 : containerNode.querySelector(
|
|
44
|
-
`[data-node-key="${activeKey}"]>.${prefixCls}-tab-btn`
|
|
45
|
-
);
|
|
46
|
-
const horizontalOffset = 8;
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
if ((!type || type === "line") && inkBarNode) {
|
|
49
|
-
if (isHorizontal && (activeTabNode == null ? void 0 : activeTabNode.offsetWidth) >= 24) {
|
|
50
|
-
inkBarNode.style.width = `${(activeTabNode == null ? void 0 : activeTabNode.offsetWidth) - horizontalOffset * 2}px`;
|
|
51
|
-
inkBarNode.style.marginLeft = `${horizontalOffset}px`;
|
|
52
|
-
inkBarNode.style.marginTop = "0px";
|
|
53
|
-
}
|
|
54
|
-
if (isVertical) {
|
|
55
|
-
inkBarNode.style.height = `${activeTabBtnNode == null ? void 0 : activeTabBtnNode.offsetHeight}px`;
|
|
56
|
-
inkBarNode.style.marginTop = `${((activeTabNode == null ? void 0 : activeTabNode.offsetHeight) - (activeTabBtnNode == null ? void 0 : activeTabBtnNode.offsetHeight)) / 2}px`;
|
|
57
|
-
inkBarNode.style.marginLeft = "0px";
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}, 100);
|
|
61
|
-
}, [prefixCls, activeKey, size, type, isHorizontal, isVertical, containerRef]);
|
|
62
|
-
};
|