@befe/brick-comp-tabs 0.2.127 → 0.2.128
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/CHANGELOG.md +11 -0
- package/es/index.css +42 -1
- package/es/style.css +5 -0
- package/es/tab-pane.js +23 -62
- package/es/tabs.js +610 -573
- package/package.json +11 -13
- package/src/style.scss +2 -2
- package/src/tab-pane.tsx +25 -41
- package/src/tabs.tsx +516 -440
- package/types/tab-pane.d.ts +11 -13
- package/types/tabs.d.ts +6 -70
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.2.128](https://icode.baidu.com/repos/baidu/be-fe/brick/merge/%40befe%2Fbrick-comp-tabs%400.2.127...%40befe%2Fbrick-comp-tabs%400.2.128) (2026-11-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **components/tabs:** resize 订阅句柄判空 ([892fa05](https://icode.baidu.com/repos/baidu/be-fe/brick/commits/892fa0535961f192d5cb1c43374110b6b054db44))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.2.127](https://icode.baidu.com:8235/baidu/be-fe/brick//%40befe%2Fbrick-comp-tabs%400.2.126...%40befe%2Fbrick-comp-tabs%400.2.127) (2026-09-11)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @befe/brick-comp-tabs
|
package/es/index.css
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
.brick-tabs * {
|
|
3
3
|
box-sizing: border-box;
|
|
4
4
|
}
|
|
5
|
+
.brick-tabs,
|
|
6
|
+
.brick-tabs * {
|
|
7
|
+
scrollbar-width: thin;
|
|
8
|
+
scrollbar-color: rgb(224.4, 224.4, 224.4) transparent;
|
|
9
|
+
}
|
|
5
10
|
.brick-tabs {
|
|
6
11
|
position: relative;
|
|
7
12
|
}
|
|
@@ -317,6 +322,11 @@
|
|
|
317
322
|
.brick-button * {
|
|
318
323
|
box-sizing: border-box;
|
|
319
324
|
}
|
|
325
|
+
.brick-button,
|
|
326
|
+
.brick-button * {
|
|
327
|
+
scrollbar-width: thin;
|
|
328
|
+
scrollbar-color: rgb(224.4, 224.4, 224.4) transparent;
|
|
329
|
+
}
|
|
320
330
|
.brick-button {
|
|
321
331
|
display: inline-block;
|
|
322
332
|
border-radius: 4px;
|
|
@@ -1028,6 +1038,11 @@ a:not(.brick-button-type-plain).brick-button-disabled {
|
|
|
1028
1038
|
.brick-icon * {
|
|
1029
1039
|
box-sizing: border-box;
|
|
1030
1040
|
}
|
|
1041
|
+
.brick-icon,
|
|
1042
|
+
.brick-icon * {
|
|
1043
|
+
scrollbar-width: thin;
|
|
1044
|
+
scrollbar-color: rgb(224.4, 224.4, 224.4) transparent;
|
|
1045
|
+
}
|
|
1031
1046
|
.brick-icon {
|
|
1032
1047
|
display: inline-block;
|
|
1033
1048
|
color: rgb(153, 153, 153);
|
|
@@ -1049,13 +1064,19 @@ a:not(.brick-button-type-plain).brick-button-disabled {
|
|
|
1049
1064
|
box-sizing: border-box;
|
|
1050
1065
|
}
|
|
1051
1066
|
|
|
1067
|
+
.brick-menu,
|
|
1068
|
+
.brick-menu * {
|
|
1069
|
+
scrollbar-width: thin;
|
|
1070
|
+
scrollbar-color: rgb(224.4, 224.4, 224.4) transparent;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1052
1073
|
.brick-menu {
|
|
1053
1074
|
*zoom: 1;
|
|
1054
1075
|
}
|
|
1055
1076
|
|
|
1056
1077
|
.brick-menu::before, .brick-menu::after {
|
|
1057
1078
|
display: table;
|
|
1058
|
-
content: "
|
|
1079
|
+
content: "";
|
|
1059
1080
|
}
|
|
1060
1081
|
|
|
1061
1082
|
.brick-menu::after {
|
|
@@ -2526,6 +2547,11 @@ a:not(.brick-button-type-plain).brick-button-disabled {
|
|
|
2526
2547
|
.brick-popper * {
|
|
2527
2548
|
box-sizing: border-box;
|
|
2528
2549
|
}
|
|
2550
|
+
.brick-popper,
|
|
2551
|
+
.brick-popper * {
|
|
2552
|
+
scrollbar-width: thin;
|
|
2553
|
+
scrollbar-color: rgb(224.4, 224.4, 224.4) transparent;
|
|
2554
|
+
}
|
|
2529
2555
|
.brick-popper-wrap {
|
|
2530
2556
|
position: absolute;
|
|
2531
2557
|
z-index: 1030;
|
|
@@ -2635,6 +2661,11 @@ body > .brick-popper .brick-popper-wrap {
|
|
|
2635
2661
|
.brick-popup * {
|
|
2636
2662
|
box-sizing: border-box;
|
|
2637
2663
|
}
|
|
2664
|
+
.brick-popup,
|
|
2665
|
+
.brick-popup * {
|
|
2666
|
+
scrollbar-width: thin;
|
|
2667
|
+
scrollbar-color: rgb(224.4, 224.4, 224.4) transparent;
|
|
2668
|
+
}
|
|
2638
2669
|
.brick-popup-visible {
|
|
2639
2670
|
display: block;
|
|
2640
2671
|
}
|
|
@@ -2646,6 +2677,11 @@ body > .brick-popper .brick-popper-wrap {
|
|
|
2646
2677
|
.brick-checkbox * {
|
|
2647
2678
|
box-sizing: border-box;
|
|
2648
2679
|
}
|
|
2680
|
+
.brick-checkbox,
|
|
2681
|
+
.brick-checkbox * {
|
|
2682
|
+
scrollbar-width: thin;
|
|
2683
|
+
scrollbar-color: rgb(224.4, 224.4, 224.4) transparent;
|
|
2684
|
+
}
|
|
2649
2685
|
.brick-checkbox {
|
|
2650
2686
|
display: inline-block;
|
|
2651
2687
|
cursor: pointer;
|
|
@@ -3014,6 +3050,11 @@ body > .brick-popper .brick-popper-wrap {
|
|
|
3014
3050
|
.brick-radio * {
|
|
3015
3051
|
box-sizing: border-box;
|
|
3016
3052
|
}
|
|
3053
|
+
.brick-radio,
|
|
3054
|
+
.brick-radio * {
|
|
3055
|
+
scrollbar-width: thin;
|
|
3056
|
+
scrollbar-color: rgb(224.4, 224.4, 224.4) transparent;
|
|
3057
|
+
}
|
|
3017
3058
|
.brick-radio {
|
|
3018
3059
|
display: inline-block;
|
|
3019
3060
|
cursor: pointer;
|
package/es/style.css
CHANGED
package/es/tab-pane.js
CHANGED
|
@@ -1,64 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
6
|
-
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
7
|
-
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
8
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
9
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
-
import { Component } from 'react';
|
|
12
|
-
// import * as PropTypes from 'prop-types'
|
|
13
|
-
import c from 'classnames';
|
|
14
|
-
import { isUndefined } from 'lodash-es';
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { cx, isUndefined } from '@befe/brick-utils';
|
|
15
3
|
import { TabsContext } from './tabs-context';
|
|
16
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, {
|
|
39
|
-
key: "isActive",
|
|
40
|
-
get: function get() {
|
|
41
|
-
var activeId = this.context.activeId;
|
|
42
|
-
var id = this.props.id;
|
|
43
|
-
if (isUndefined(id) || isUndefined(activeId) || activeId === null) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return id === activeId;
|
|
47
|
-
}
|
|
48
|
-
}, {
|
|
49
|
-
key: "render",
|
|
50
|
-
value: function render() {
|
|
51
|
-
return /*#__PURE__*/_jsx("div", {
|
|
52
|
-
className: this.className,
|
|
53
|
-
children: this.props.children
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}]);
|
|
57
|
-
}(Component);
|
|
58
|
-
_defineProperty(TabPane, "displayName", 'TabPane');
|
|
59
|
-
// static propTypes = {}
|
|
60
|
-
_defineProperty(TabPane, "defaultProps", {
|
|
61
|
-
className: '',
|
|
62
|
-
status: 'normal'
|
|
63
|
-
});
|
|
64
|
-
_defineProperty(TabPane, "contextType", TabsContext);
|
|
5
|
+
/**
|
|
6
|
+
* TabPane `status` 默认值;父组件 `Tabs.getTabsAll` 读取 `child.props.status` 时也用它兜底
|
|
7
|
+
* (默认参数不进 element.props,故父子两处共用此常量,避免字面量各写一份而漂移)
|
|
8
|
+
*/
|
|
9
|
+
export var TAB_PANE_DEFAULT_STATUS = 'normal';
|
|
10
|
+
export function TabPane(props) {
|
|
11
|
+
var className = props.className,
|
|
12
|
+
id = props.id,
|
|
13
|
+
_props$status = props.status,
|
|
14
|
+
status = _props$status === void 0 ? TAB_PANE_DEFAULT_STATUS : _props$status,
|
|
15
|
+
children = props.children;
|
|
16
|
+
var _useContext = useContext(TabsContext),
|
|
17
|
+
activeId = _useContext.activeId;
|
|
18
|
+
var isActive = !isUndefined(id) && !isUndefined(activeId) && activeId !== null && id === activeId;
|
|
19
|
+
var paneClassName = cx('brick-tabs-tab-pane', "brick-tabs-tab-pane-".concat(isActive ? 'active' : 'inactive'), "brick-tabs-tab-pane-status-".concat(status), className);
|
|
20
|
+
return /*#__PURE__*/_jsx("div", {
|
|
21
|
+
className: paneClassName,
|
|
22
|
+
children: children
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
TabPane.displayName = 'TabPane';
|