@befe/brick-comp-tabs 0.2.94 → 0.2.96
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 +16 -0
- package/es/tab-pane.js +6 -9
- package/es/tabs.js +30 -33
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.96](https://icode.baidu.com:8235/baidu/be-fe/brick//%40befe%2Fbrick-comp-tabs%400.2.95...%40befe%2Fbrick-comp-tabs%400.2.96) (2025-08-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @befe/brick-comp-tabs
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.2.95](https://icode.baidu.com/repos/baidu/be-fe/brick/merge/%40befe%2Fbrick-comp-tabs%400.2.94...%40befe%2Fbrick-comp-tabs%400.2.95) (2025-06-30)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @befe/brick-comp-tabs
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.2.94](https://icode.baidu.com:8235/baidu/be-fe/brick//%40befe%2Fbrick-comp-tabs%400.2.93...%40befe%2Fbrick-comp-tabs%400.2.94) (2025-06-05)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @befe/brick-comp-tabs
|
package/es/tab-pane.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
2
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
6
4
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
7
5
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
8
7
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
9
8
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
10
|
-
function
|
|
9
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
11
|
import { Component } from 'react';
|
|
13
12
|
// import * as PropTypes from 'prop-types'
|
|
@@ -16,8 +15,6 @@ import { isUndefined } from 'lodash-es';
|
|
|
16
15
|
import { TabsContext } from './tabs-context';
|
|
17
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
17
|
export var TabPane = /*#__PURE__*/function (_Component) {
|
|
19
|
-
_inherits(TabPane, _Component);
|
|
20
|
-
var _super = _createSuper(TabPane);
|
|
21
18
|
function TabPane() {
|
|
22
19
|
var _context;
|
|
23
20
|
var _this;
|
|
@@ -25,11 +22,12 @@ export var TabPane = /*#__PURE__*/function (_Component) {
|
|
|
25
22
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
23
|
args[_key] = arguments[_key];
|
|
27
24
|
}
|
|
28
|
-
_this =
|
|
29
|
-
_defineProperty(
|
|
25
|
+
_this = _callSuper(this, TabPane, _concatInstanceProperty(_context = []).call(_context, args));
|
|
26
|
+
_defineProperty(_this, "context", void 0);
|
|
30
27
|
return _this;
|
|
31
28
|
}
|
|
32
|
-
|
|
29
|
+
_inherits(TabPane, _Component);
|
|
30
|
+
return _createClass(TabPane, [{
|
|
33
31
|
key: "className",
|
|
34
32
|
get: function get() {
|
|
35
33
|
var _ref = this.props,
|
|
@@ -56,7 +54,6 @@ export var TabPane = /*#__PURE__*/function (_Component) {
|
|
|
56
54
|
});
|
|
57
55
|
}
|
|
58
56
|
}]);
|
|
59
|
-
return TabPane;
|
|
60
57
|
}(Component);
|
|
61
58
|
_defineProperty(TabPane, "displayName", 'TabPane');
|
|
62
59
|
// static propTypes = {}
|
package/es/tabs.js
CHANGED
|
@@ -10,14 +10,13 @@ import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWitho
|
|
|
10
10
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
11
11
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
12
12
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
13
|
-
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
|
|
14
|
-
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
15
13
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
16
14
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
15
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
17
16
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
18
17
|
var _excluded = ["content"];
|
|
19
18
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context12, _context13; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context12 = ownKeys(Object(t), !0)).call(_context12, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context13 = ownKeys(Object(t))).call(_context13, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
20
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
22
21
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
23
22
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
@@ -27,7 +26,7 @@ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
|
|
|
27
26
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
28
27
|
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
29
28
|
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
30
|
-
function
|
|
29
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
31
30
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
32
31
|
import { Component, createRef, Children, isValidElement } from 'react';
|
|
33
32
|
// import * as PropTypes from 'prop-types'
|
|
@@ -47,8 +46,6 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
47
46
|
var BORDER_WIDTH = 1;
|
|
48
47
|
var SIZED_TYPES = ['plain', 'tag'];
|
|
49
48
|
export var Tabs = /*#__PURE__*/function (_Component) {
|
|
50
|
-
_inherits(Tabs, _Component);
|
|
51
|
-
var _super = _createSuper(Tabs);
|
|
52
49
|
function Tabs() {
|
|
53
50
|
var _context;
|
|
54
51
|
var _this;
|
|
@@ -56,27 +53,27 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
56
53
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
57
54
|
args[_key] = arguments[_key];
|
|
58
55
|
}
|
|
59
|
-
_this =
|
|
60
|
-
_defineProperty(
|
|
61
|
-
_defineProperty(
|
|
62
|
-
_defineProperty(
|
|
63
|
-
_defineProperty(
|
|
56
|
+
_this = _callSuper(this, Tabs, _concatInstanceProperty(_context = []).call(_context, args));
|
|
57
|
+
_defineProperty(_this, "context", void 0);
|
|
58
|
+
_defineProperty(_this, "windowResizeHandler", void 0);
|
|
59
|
+
_defineProperty(_this, "tabsWheelHandler", null);
|
|
60
|
+
_defineProperty(_this, "state", {
|
|
64
61
|
activeId: (isUndefined(_this.props.activeId) ? _this.props.defaultActiveId : _this.props.activeId) || null,
|
|
65
62
|
visibleFrom: 0,
|
|
66
63
|
visibleTo: 0,
|
|
67
64
|
isEllipsisPopperVisible: false
|
|
68
65
|
});
|
|
69
|
-
_defineProperty(
|
|
70
|
-
_defineProperty(
|
|
71
|
-
_defineProperty(
|
|
72
|
-
_defineProperty(
|
|
73
|
-
_defineProperty(
|
|
74
|
-
_defineProperty(
|
|
75
|
-
_defineProperty(
|
|
66
|
+
_defineProperty(_this, "refTabsWrap", /*#__PURE__*/createRef());
|
|
67
|
+
_defineProperty(_this, "refTabs", /*#__PURE__*/createRef());
|
|
68
|
+
_defineProperty(_this, "tabsWrapWidth", 0);
|
|
69
|
+
_defineProperty(_this, "tabsWidth", []);
|
|
70
|
+
_defineProperty(_this, "tabsWrapMaxScrollLeft", 0);
|
|
71
|
+
_defineProperty(_this, "tabsWrapScrollLeft", 0);
|
|
72
|
+
_defineProperty(_this, "handleClickAdd", function (e) {
|
|
76
73
|
var activeId = safeInvoke(_this.props.onClickAdd, e);
|
|
77
74
|
activeId && _this.changeActive(activeId);
|
|
78
75
|
});
|
|
79
|
-
_defineProperty(
|
|
76
|
+
_defineProperty(_this, "handleClickTab", function (e, id) {
|
|
80
77
|
var $removeBtn = e.currentTarget.querySelector('.brick-tabs-tab-delete');
|
|
81
78
|
if ($removeBtn && ifNodeContains($removeBtn, e.target)) {
|
|
82
79
|
_this.deleteTab(id);
|
|
@@ -87,15 +84,15 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
87
84
|
safeInvoke(_this.props.onClickTab, e, id);
|
|
88
85
|
}
|
|
89
86
|
});
|
|
90
|
-
_defineProperty(
|
|
87
|
+
_defineProperty(_this, "handleChangeRadioGroup", function (value) {
|
|
91
88
|
value && _this.changeActive(value);
|
|
92
89
|
});
|
|
93
|
-
_defineProperty(
|
|
90
|
+
_defineProperty(_this, "handleMenuPopperChange", function (status) {
|
|
94
91
|
_this.setState({
|
|
95
92
|
isEllipsisPopperVisible: status
|
|
96
93
|
});
|
|
97
94
|
});
|
|
98
|
-
_defineProperty(
|
|
95
|
+
_defineProperty(_this, "handleWheelTabsWrap", function (e) {
|
|
99
96
|
if (!_this.withEllipsis) {
|
|
100
97
|
return;
|
|
101
98
|
}
|
|
@@ -105,7 +102,7 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
105
102
|
_this.scrollTabsWrap(_this.tabsWrapScrollLeft + scrollLeft);
|
|
106
103
|
e.preventDefault();
|
|
107
104
|
});
|
|
108
|
-
_defineProperty(
|
|
105
|
+
_defineProperty(_this, "renderTab", function (tab) {
|
|
109
106
|
var tabClass = c('brick-tabs-tab', _defineProperty({
|
|
110
107
|
'brick-tabs-tab-active': _this.state.activeId === tab.id,
|
|
111
108
|
'brick-tabs-tab-disabled': tab.disabled,
|
|
@@ -134,7 +131,8 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
134
131
|
});
|
|
135
132
|
return _this;
|
|
136
133
|
}
|
|
137
|
-
|
|
134
|
+
_inherits(Tabs, _Component);
|
|
135
|
+
return _createClass(Tabs, [{
|
|
138
136
|
key: "className",
|
|
139
137
|
get: function get() {
|
|
140
138
|
var _ref = this.props,
|
|
@@ -321,7 +319,7 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
321
319
|
}, {
|
|
322
320
|
key: "scrollTabsWrapToTab",
|
|
323
321
|
value: function scrollTabsWrapToTab(id) {
|
|
324
|
-
var _context8, _context9,
|
|
322
|
+
var _context8, _context9, _context0;
|
|
325
323
|
var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
326
324
|
if (!this.refTabs.current || !this.canEllipsis) {
|
|
327
325
|
return;
|
|
@@ -366,7 +364,7 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
366
364
|
totalWidth = _tempWidth;
|
|
367
365
|
}
|
|
368
366
|
}
|
|
369
|
-
var scrollLeftTo = _reduceInstanceProperty(_context9 = _sliceInstanceProperty(
|
|
367
|
+
var scrollLeftTo = _reduceInstanceProperty(_context9 = _sliceInstanceProperty(_context0 = this.tabsWidth).call(_context0, 0, from)).call(_context9, function (accumulator, currentValue) {
|
|
370
368
|
return accumulator + currentValue;
|
|
371
369
|
}, 0);
|
|
372
370
|
this.scrollTabsWrap(scrollLeftTo);
|
|
@@ -411,26 +409,26 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
411
409
|
}, {
|
|
412
410
|
key: "renderTabs",
|
|
413
411
|
value: function renderTabs() {
|
|
414
|
-
var
|
|
412
|
+
var _context1;
|
|
415
413
|
return /*#__PURE__*/_jsx("div", {
|
|
416
414
|
className: 'brick-tabs-wrap',
|
|
417
415
|
ref: this.refTabsWrap,
|
|
418
416
|
children: /*#__PURE__*/_jsx("ul", {
|
|
419
417
|
ref: this.refTabs,
|
|
420
|
-
children: _mapInstanceProperty(
|
|
418
|
+
children: _mapInstanceProperty(_context1 = this.tabsAll).call(_context1, this.renderTab)
|
|
421
419
|
})
|
|
422
420
|
});
|
|
423
421
|
}
|
|
424
422
|
}, {
|
|
425
423
|
key: "renderTabsEllipsisMenu",
|
|
426
424
|
value: function renderTabsEllipsisMenu() {
|
|
427
|
-
var
|
|
425
|
+
var _context10,
|
|
428
426
|
_this2 = this;
|
|
429
427
|
// 只有 type card 支持状态
|
|
430
428
|
var isTypeCard = this.props.type === 'card';
|
|
431
429
|
return /*#__PURE__*/_jsx(Menu, {
|
|
432
430
|
type: 'common',
|
|
433
|
-
children: _mapInstanceProperty(
|
|
431
|
+
children: _mapInstanceProperty(_context10 = this.tabsEllipsis).call(_context10, function (tab) {
|
|
434
432
|
var className = c('brick-tabs-ellipsis-item', isTypeCard && tab.status && "brick-tabs-ellipsis-item-status-".concat(tab.status));
|
|
435
433
|
return /*#__PURE__*/_jsx(MenuItem, {
|
|
436
434
|
className: className,
|
|
@@ -492,10 +490,10 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
492
490
|
}, {
|
|
493
491
|
key: "renderButtonGroupTabs",
|
|
494
492
|
value: function renderButtonGroupTabs() {
|
|
495
|
-
var
|
|
493
|
+
var _context11;
|
|
496
494
|
var type = this.props.type;
|
|
497
495
|
var value = this.state.activeId;
|
|
498
|
-
var options = _mapInstanceProperty(
|
|
496
|
+
var options = _mapInstanceProperty(_context11 = this.tabsAll).call(_context11, function (child) {
|
|
499
497
|
var id = child.id,
|
|
500
498
|
label = child.label,
|
|
501
499
|
disabled = child.disabled;
|
|
@@ -620,7 +618,6 @@ export var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
620
618
|
return pickDerivedStateFromProps(nextProps, ['activeId']);
|
|
621
619
|
}
|
|
622
620
|
}]);
|
|
623
|
-
return Tabs;
|
|
624
621
|
}(Component);
|
|
625
622
|
_defineProperty(Tabs, "displayName", 'Tabs');
|
|
626
623
|
// static propTypes = {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@befe/brick-comp-tabs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.96",
|
|
4
4
|
"description": "@befe/brick component Tabs",
|
|
5
5
|
"main": "es",
|
|
6
6
|
"module": "es",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"test": "node ../../scripts/test",
|
|
14
|
-
"clean": "rm -rf es lib
|
|
14
|
+
"clean": "rm -rf es lib types",
|
|
15
15
|
"build": "npm run clean && npm run build:js && npm run build:dts && npm run build:style",
|
|
16
16
|
"build:dts": "node ../../scripts/build-dts",
|
|
17
17
|
"build:js": "node ../../scripts/build-js",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"author": "wujun07",
|
|
21
21
|
"license": "ISC",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@befe/brick-comp-button": "^0.2.
|
|
24
|
-
"@befe/brick-comp-close-x": "^0.2.
|
|
25
|
-
"@befe/brick-comp-icon": "^0.2.
|
|
26
|
-
"@befe/brick-comp-menu": "^0.2.
|
|
27
|
-
"@befe/brick-comp-radio": "^0.2.
|
|
28
|
-
"@befe/brick-core": "^0.2.
|
|
29
|
-
"@befe/brick-icon": "^0.2.
|
|
23
|
+
"@befe/brick-comp-button": "^0.2.84",
|
|
24
|
+
"@befe/brick-comp-close-x": "^0.2.84",
|
|
25
|
+
"@befe/brick-comp-icon": "^0.2.81",
|
|
26
|
+
"@befe/brick-comp-menu": "^0.2.96",
|
|
27
|
+
"@befe/brick-comp-radio": "^0.2.82",
|
|
28
|
+
"@befe/brick-core": "^0.2.46",
|
|
29
|
+
"@befe/brick-icon": "^0.2.23",
|
|
30
30
|
"@befe/brick-style": "^0.2.54",
|
|
31
|
-
"@befe/brick-utils": "^0.2.
|
|
31
|
+
"@befe/brick-utils": "^0.2.20"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"classnames": "^2.0.0",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"react": "^16.9.0 || ^17.0.0",
|
|
37
37
|
"react-dom": "^16.9.0 || ^17.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "3d3c0f63c2f4eb173858eee802401e7ce5492123"
|
|
40
40
|
}
|