@douyinfe/semi-ui 2.54.1 → 2.55.0
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/css/semi.css +40 -40
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +111 -93
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_base/base.css +40 -40
- package/lib/cjs/_sortable/index.d.ts +1 -1
- package/lib/cjs/_sortable/index.js +13 -19
- package/lib/cjs/button/splitButtonGroup.d.ts +2 -0
- package/lib/cjs/button/splitButtonGroup.js +29 -3
- package/lib/cjs/descriptions/index.js +19 -2
- package/lib/cjs/descriptions/item.js +1 -1
- package/lib/cjs/navigation/index.d.ts +2 -1
- package/lib/cjs/tabs/index.d.ts +1 -0
- package/lib/cjs/tabs/index.js +31 -54
- package/lib/es/_base/base.css +40 -40
- package/lib/es/_sortable/index.d.ts +1 -1
- package/lib/es/_sortable/index.js +13 -19
- package/lib/es/button/splitButtonGroup.d.ts +2 -0
- package/lib/es/button/splitButtonGroup.js +29 -3
- package/lib/es/descriptions/index.js +17 -2
- package/lib/es/descriptions/item.js +1 -1
- package/lib/es/navigation/index.d.ts +2 -1
- package/lib/es/tabs/index.d.ts +1 -0
- package/lib/es/tabs/index.js +31 -54
- package/package.json +8 -8
package/lib/cjs/_base/base.css
CHANGED
|
@@ -458,26 +458,26 @@ body, body[theme-mode=dark] .semi-always-light {
|
|
|
458
458
|
--semi-border-radius-full: 9999px;
|
|
459
459
|
--semi-color-highlight-bg: rgba(var(--semi-yellow-4), 1);
|
|
460
460
|
--semi-color-highlight: rgba(var(--semi-black), 1);
|
|
461
|
-
--semi-color-data-0:rgba(
|
|
462
|
-
--semi-color-data-1:rgba(
|
|
463
|
-
--semi-color-data-2:rgba(
|
|
464
|
-
--semi-color-data-3:rgba(
|
|
465
|
-
--semi-color-data-4:rgba(
|
|
466
|
-
--semi-color-data-5:rgba(
|
|
467
|
-
--semi-color-data-6:rgba(
|
|
468
|
-
--semi-color-data-7:rgba(
|
|
469
|
-
--semi-color-data-8:rgba(
|
|
470
|
-
--semi-color-data-9:rgba(
|
|
471
|
-
--semi-color-data-10:rgba(
|
|
472
|
-
--semi-color-data-11:rgba(
|
|
473
|
-
--semi-color-data-12:rgba(
|
|
474
|
-
--semi-color-data-13:rgba(
|
|
475
|
-
--semi-color-data-14:rgba(
|
|
476
|
-
--semi-color-data-15:rgba(
|
|
477
|
-
--semi-color-data-16:rgba(
|
|
478
|
-
--semi-color-data-17:rgba(
|
|
479
|
-
--semi-color-data-18:rgba(
|
|
480
|
-
--semi-color-data-19:rgba(
|
|
461
|
+
--semi-color-data-0: rgba(87, 105, 255, 1);
|
|
462
|
+
--semi-color-data-1: rgba(142, 212, 231, 1);
|
|
463
|
+
--semi-color-data-2: rgba(245, 135, 0, 1);
|
|
464
|
+
--semi-color-data-3: rgba(220, 183, 252, 1);
|
|
465
|
+
--semi-color-data-4: rgba(74, 156, 247, 1);
|
|
466
|
+
--semi-color-data-5: rgba(243, 204, 53, 1);
|
|
467
|
+
--semi-color-data-6: rgba(254, 128, 144, 1);
|
|
468
|
+
--semi-color-data-7: rgba(139, 215, 210, 1);
|
|
469
|
+
--semi-color-data-8: rgba(131, 176, 35, 1);
|
|
470
|
+
--semi-color-data-9: rgba(233, 165, 229, 1);
|
|
471
|
+
--semi-color-data-10: rgba(48, 167, 206, 1);
|
|
472
|
+
--semi-color-data-11: rgba(249, 192, 100, 1);
|
|
473
|
+
--semi-color-data-12: rgba(177, 113, 249, 1);
|
|
474
|
+
--semi-color-data-13: rgba(119, 182, 249, 1);
|
|
475
|
+
--semi-color-data-14: rgba(200, 143, 2, 1);
|
|
476
|
+
--semi-color-data-15: rgba(255, 170, 178, 1);
|
|
477
|
+
--semi-color-data-16: rgba(51, 176, 171, 1);
|
|
478
|
+
--semi-color-data-17: rgba(182, 215, 129, 1);
|
|
479
|
+
--semi-color-data-18: rgba(212, 88, 212, 1);
|
|
480
|
+
--semi-color-data-19: rgba(188, 198, 255, 1);
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
body[theme-mode=dark], body .semi-always-dark {
|
|
@@ -568,26 +568,26 @@ body[theme-mode=dark], body .semi-always-dark {
|
|
|
568
568
|
--semi-border-radius-full: 9999px;
|
|
569
569
|
--semi-color-highlight-bg: rgba(var(--semi-yellow-2), 1);
|
|
570
570
|
--semi-color-highlight: rgba(var(--semi-white), 1);
|
|
571
|
-
--semi-color-data-0:rgba(
|
|
572
|
-
--semi-color-data-1:rgba(
|
|
573
|
-
--semi-color-data-2:rgba(
|
|
574
|
-
--semi-color-data-3:rgba(
|
|
575
|
-
--semi-color-data-4:rgba(
|
|
576
|
-
--semi-color-data-5:rgba(
|
|
577
|
-
--semi-color-data-6:rgba(
|
|
578
|
-
--semi-color-data-7:rgba(
|
|
579
|
-
--semi-color-data-8:rgba(
|
|
580
|
-
--semi-color-data-9:rgba(
|
|
581
|
-
--semi-color-data-10:rgba(
|
|
582
|
-
--semi-color-data-11:rgba(
|
|
583
|
-
--semi-color-data-12:rgba(
|
|
584
|
-
--semi-color-data-13:rgba(
|
|
585
|
-
--semi-color-data-14:rgba(
|
|
586
|
-
--semi-color-data-15:rgba(
|
|
587
|
-
--semi-color-data-16:rgba(
|
|
588
|
-
--semi-color-data-17:rgba(
|
|
589
|
-
--semi-color-data-18:rgba(
|
|
590
|
-
--semi-color-data-19:rgba(
|
|
571
|
+
--semi-color-data-0: rgba(94, 109, 194, 1);
|
|
572
|
+
--semi-color-data-1: rgba(8, 104, 120, 1);
|
|
573
|
+
--semi-color-data-2: rgba(250, 173, 63, 1);
|
|
574
|
+
--semi-color-data-3: rgba(76, 43, 156, 1);
|
|
575
|
+
--semi-color-data-4: rgba(16, 125, 248, 1);
|
|
576
|
+
--semi-color-data-5: rgba(248, 202, 16, 1);
|
|
577
|
+
--semi-color-data-6: rgba(195, 30, 87, 1);
|
|
578
|
+
--semi-color-data-7: rgba(5, 119, 115, 1);
|
|
579
|
+
--semi-color-data-8: rgba(154, 207, 13, 1);
|
|
580
|
+
--semi-color-data-9: rgba(117, 29, 138, 1);
|
|
581
|
+
--semi-color-data-10: rgba(16, 162, 180, 1);
|
|
582
|
+
--semi-color-data-11: rgba(208, 110, 11, 1);
|
|
583
|
+
--semi-color-data-12: rgba(113, 66, 197, 1);
|
|
584
|
+
--semi-color-data-13: rgba(7, 100, 212, 1);
|
|
585
|
+
--semi-color-data-14: rgba(251, 232, 110, 1);
|
|
586
|
+
--semi-color-data-15: rgba(160, 19, 73, 1);
|
|
587
|
+
--semi-color-data-16: rgba(11, 179, 167, 1);
|
|
588
|
+
--semi-color-data-17: rgba(98, 138, 6, 1);
|
|
589
|
+
--semi-color-data-18: rgba(162, 48, 179, 1);
|
|
590
|
+
--semi-color-data-19: rgba(40, 51, 138, 1);
|
|
591
591
|
}
|
|
592
592
|
|
|
593
593
|
.semi-light-scrollbar::-webkit-scrollbar, .semi-light-scrollbar *::-webkit-scrollbar {
|
|
@@ -36,6 +36,6 @@ interface SortableItemProps {
|
|
|
36
36
|
prefix?: string;
|
|
37
37
|
transition?: SortableTransition | null;
|
|
38
38
|
}
|
|
39
|
-
export declare function Sortable({ items, onSortEnd, adjustScale, renderItem, transition,
|
|
39
|
+
export declare function Sortable({ items, onSortEnd, adjustScale, renderItem, transition, collisionDetection, strategy, useDragOverlay, dragOverlayCls, container: Container, prefix, }: SortableProps): JSX.Element;
|
|
40
40
|
export declare function SortableItem({ animateLayoutChanges, id, renderItem, prefix, transition: animation, }: SortableItemProps): JSX.Element;
|
|
41
41
|
export {};
|
|
@@ -16,10 +16,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
const defaultPrefix = 'semi-sortable';
|
|
19
|
-
const defaultConstraint = {
|
|
20
|
-
delay: 150,
|
|
21
|
-
tolerance: 5
|
|
22
|
-
};
|
|
23
19
|
function DefaultContainer(props) {
|
|
24
20
|
return /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
25
21
|
style: {
|
|
@@ -27,6 +23,9 @@ function DefaultContainer(props) {
|
|
|
27
23
|
}
|
|
28
24
|
}, props));
|
|
29
25
|
}
|
|
26
|
+
const defaultKeyBoardOptions = {
|
|
27
|
+
coordinateGetter: _sortable.sortableKeyboardCoordinates
|
|
28
|
+
};
|
|
30
29
|
function Sortable(_ref) {
|
|
31
30
|
let {
|
|
32
31
|
items,
|
|
@@ -34,7 +33,6 @@ function Sortable(_ref) {
|
|
|
34
33
|
adjustScale,
|
|
35
34
|
renderItem,
|
|
36
35
|
transition,
|
|
37
|
-
activationConstraint = defaultConstraint,
|
|
38
36
|
collisionDetection = _core.closestCenter,
|
|
39
37
|
strategy = _sortable.rectSortingStrategy,
|
|
40
38
|
useDragOverlay = true,
|
|
@@ -43,13 +41,7 @@ function Sortable(_ref) {
|
|
|
43
41
|
prefix = defaultPrefix
|
|
44
42
|
} = _ref;
|
|
45
43
|
const [activeId, setActiveId] = (0, _react.useState)(null);
|
|
46
|
-
const sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.MouseSensor,
|
|
47
|
-
activationConstraint
|
|
48
|
-
}), (0, _core.useSensor)(_core.TouchSensor, {
|
|
49
|
-
activationConstraint
|
|
50
|
-
}), (0, _core.useSensor)(_core.KeyboardSensor, {
|
|
51
|
-
coordinateGetter: _sortable.sortableKeyboardCoordinates
|
|
52
|
-
}));
|
|
44
|
+
const sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.MouseSensor), (0, _core.useSensor)(_core.TouchSensor), (0, _core.useSensor)(_core.KeyboardSensor, defaultKeyBoardOptions));
|
|
53
45
|
const getIndex = (0, _react.useCallback)(id => items.indexOf(id), [items]);
|
|
54
46
|
const activeIndex = (0, _react.useMemo)(() => activeId ? getIndex(activeId) : -1, [getIndex, activeId]);
|
|
55
47
|
const onDragStart = (0, _react.useCallback)(_ref2 => {
|
|
@@ -159,13 +151,15 @@ function SortableItem(_ref4) {
|
|
|
159
151
|
[`${prefix}-sortable-item-over`]: isOver,
|
|
160
152
|
[`${prefix}-sortable-item-active`]: (active === null || active === void 0 ? void 0 : active.id) === id
|
|
161
153
|
});
|
|
162
|
-
const wrapperStyle =
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
154
|
+
const wrapperStyle = (0, _react.useMemo)(() => {
|
|
155
|
+
return !(0, _isNull2.default)(animation) ? {
|
|
156
|
+
transform: _utilities.CSS.Transform.toString(Object.assign(Object.assign({}, transform), {
|
|
157
|
+
scaleX: 1,
|
|
158
|
+
scaleY: 1
|
|
159
|
+
})),
|
|
160
|
+
transition: transition
|
|
161
|
+
} : undefined;
|
|
162
|
+
}, [animation, transform, transition]);
|
|
169
163
|
return /*#__PURE__*/_react.default.createElement("div", Object.assign({
|
|
170
164
|
ref: setNodeRef,
|
|
171
165
|
style: wrapperStyle,
|
|
@@ -7,11 +7,13 @@ export interface SplitButtonGroupProps extends BaseProps {
|
|
|
7
7
|
}
|
|
8
8
|
export default class SplitButtonGroup extends BaseComponent<SplitButtonGroupProps> {
|
|
9
9
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
10
|
+
mutationObserver: MutationObserver | null;
|
|
10
11
|
static propTypes: {
|
|
11
12
|
style: PropTypes.Requireable<object>;
|
|
12
13
|
className: PropTypes.Requireable<string>;
|
|
13
14
|
'aria-label': PropTypes.Requireable<string>;
|
|
14
15
|
};
|
|
15
16
|
componentDidMount(): void;
|
|
17
|
+
componentWillUnmount(): void;
|
|
16
18
|
render(): JSX.Element;
|
|
17
19
|
}
|
|
@@ -16,16 +16,42 @@ class SplitButtonGroup extends _baseComponent.default {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
18
|
this.containerRef = /*#__PURE__*/_react.default.createRef();
|
|
19
|
+
this.mutationObserver = null;
|
|
19
20
|
}
|
|
20
21
|
componentDidMount() {
|
|
21
|
-
|
|
22
|
+
const addClassName = () => {
|
|
22
23
|
const buttons = this.containerRef.current.querySelectorAll('button');
|
|
23
24
|
const firstButton = buttons[0];
|
|
24
25
|
const lastButton = buttons[buttons.length - 1];
|
|
25
|
-
firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.
|
|
26
|
-
|
|
26
|
+
if (!(firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.contains(`${prefixCls}-first`))) {
|
|
27
|
+
firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.add(`${prefixCls}-first`);
|
|
28
|
+
}
|
|
29
|
+
if (!(lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.contains(`${prefixCls}-last`))) {
|
|
30
|
+
lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.add(`${prefixCls}-last`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
if (this.containerRef.current) {
|
|
34
|
+
addClassName();
|
|
35
|
+
const mutationObserver = new MutationObserver((mutations, observer) => {
|
|
36
|
+
for (const mutation of mutations) {
|
|
37
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class' || mutation.type === 'childList' && Array.from(mutation.addedNodes).some(node => node.nodeName === 'BUTTON')) {
|
|
38
|
+
addClassName();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
mutationObserver.observe(this.containerRef.current, {
|
|
43
|
+
attributes: true,
|
|
44
|
+
childList: true,
|
|
45
|
+
subtree: true
|
|
46
|
+
});
|
|
47
|
+
this.mutationObserver = mutationObserver;
|
|
27
48
|
}
|
|
28
49
|
}
|
|
50
|
+
componentWillUnmount() {
|
|
51
|
+
var _a;
|
|
52
|
+
super.componentWillUnmount();
|
|
53
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
54
|
+
}
|
|
29
55
|
render() {
|
|
30
56
|
const {
|
|
31
57
|
children,
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _isPlainObject2 = _interopRequireDefault(require("lodash/isPlainObject"));
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _constants = require("@douyinfe/semi-foundation/lib/cjs/descriptions/constants");
|
|
@@ -15,6 +15,8 @@ var _descriptionsContext = _interopRequireDefault(require("./descriptions-contex
|
|
|
15
15
|
var _item = _interopRequireDefault(require("./item"));
|
|
16
16
|
var _foundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/descriptions/foundation"));
|
|
17
17
|
var _baseComponent = _interopRequireDefault(require("../_base/baseComponent"));
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
20
22
|
var t = {};
|
|
@@ -57,7 +59,22 @@ class Descriptions extends _baseComponent.default {
|
|
|
57
59
|
this.foundation = new _foundation.default(this.adapter);
|
|
58
60
|
}
|
|
59
61
|
get adapter() {
|
|
60
|
-
return Object.assign({}, super.adapter)
|
|
62
|
+
return Object.assign(Object.assign({}, super.adapter), {
|
|
63
|
+
getColumns: () => {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
if ((_a = this.props.data) === null || _a === void 0 ? void 0 : _a.length) {
|
|
66
|
+
return this.props.data;
|
|
67
|
+
}
|
|
68
|
+
if (this.props.children) {
|
|
69
|
+
return (_b = _react.default.Children.toArray(this.props.children)) === null || _b === void 0 ? void 0 : _b.map(item => {
|
|
70
|
+
return /*#__PURE__*/(0, _react.isValidElement)(item) ? Object.assign({
|
|
71
|
+
value: item.props.children
|
|
72
|
+
}, item.props) : [];
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
61
78
|
}
|
|
62
79
|
render() {
|
|
63
80
|
const _a = this.props,
|
|
@@ -57,7 +57,7 @@ class Item extends _react.PureComponent {
|
|
|
57
57
|
className: keyCls
|
|
58
58
|
}, itemKey)), /*#__PURE__*/_react.default.createElement("td", {
|
|
59
59
|
className: `${prefixCls}-item ${prefixCls}-item-td`,
|
|
60
|
-
colSpan: span
|
|
60
|
+
colSpan: span ? span * 2 - 1 : 1
|
|
61
61
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
62
62
|
className: valCls
|
|
63
63
|
}, typeof children === 'function' ? children() : children)));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import BaseComponent, { BaseProps } from '../_base/baseComponent';
|
|
2
2
|
import React, { ReactElement, ReactNode } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { NavigationAdapter } from '@douyinfe/semi-foundation/lib/cjs/navigation/foundation';
|
|
4
|
+
import NavigationFoundation, { NavigationAdapter } from '@douyinfe/semi-foundation/lib/cjs/navigation/foundation';
|
|
5
5
|
import SubNav, { SubNavProps } from './SubNav';
|
|
6
6
|
import Item, { NavItemProps } from './Item';
|
|
7
7
|
import Footer, { NavFooterProps } from './Footer';
|
|
@@ -122,6 +122,7 @@ declare class Nav extends BaseComponent<NavProps, NavState> {
|
|
|
122
122
|
static __SemiComponentName__: string;
|
|
123
123
|
static defaultProps: any;
|
|
124
124
|
itemsChanged: boolean;
|
|
125
|
+
foundation: NavigationFoundation;
|
|
125
126
|
constructor(props: NavProps);
|
|
126
127
|
static getDerivedStateFromProps(props: NavProps, state: NavState): Partial<NavState>;
|
|
127
128
|
componentDidMount(): void;
|
package/lib/cjs/tabs/index.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ declare class Tabs extends BaseComponent<TabsProps, TabsState> {
|
|
|
48
48
|
static getDerivedStateFromProps(props: TabsProps, state: TabsState): Partial<TabsState>;
|
|
49
49
|
componentDidUpdate(prevProps: TabsProps, prevState: TabsState): void;
|
|
50
50
|
setContentRef: RefCallback<HTMLDivElement>;
|
|
51
|
+
getPanes: () => PlainTab[];
|
|
51
52
|
onTabClick: (activeKey: string, event: MouseEvent<HTMLDivElement>) => void;
|
|
52
53
|
rePosChildren: (children: ReactElement[], activeKey: string) => ReactElement[];
|
|
53
54
|
getActiveItem: () => ReactNode | ReactNode[];
|
package/lib/cjs/tabs/index.js
CHANGED
|
@@ -52,6 +52,34 @@ class Tabs extends _baseComponent.default {
|
|
|
52
52
|
current: ref
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
+
this.getPanes = () => {
|
|
56
|
+
const {
|
|
57
|
+
tabList,
|
|
58
|
+
children
|
|
59
|
+
} = this.props;
|
|
60
|
+
if (Array.isArray(tabList) && tabList.length) {
|
|
61
|
+
return tabList;
|
|
62
|
+
}
|
|
63
|
+
return _react.default.Children.map(children, child => {
|
|
64
|
+
if (child) {
|
|
65
|
+
const {
|
|
66
|
+
tab,
|
|
67
|
+
icon,
|
|
68
|
+
disabled,
|
|
69
|
+
itemKey,
|
|
70
|
+
closable
|
|
71
|
+
} = child.props;
|
|
72
|
+
return {
|
|
73
|
+
tab,
|
|
74
|
+
icon,
|
|
75
|
+
disabled,
|
|
76
|
+
itemKey,
|
|
77
|
+
closable
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
});
|
|
82
|
+
};
|
|
55
83
|
this.onTabClick = (activeKey, event) => {
|
|
56
84
|
this.foundation.handleTabClick(activeKey, event);
|
|
57
85
|
};
|
|
@@ -90,7 +118,7 @@ class Tabs extends _baseComponent.default {
|
|
|
90
118
|
this.foundation = new _foundation.default(this.adapter);
|
|
91
119
|
this.state = {
|
|
92
120
|
activeKey: this.foundation.getDefaultActiveKey(),
|
|
93
|
-
panes:
|
|
121
|
+
panes: this.getPanes(),
|
|
94
122
|
prevActiveKey: null,
|
|
95
123
|
forceDisableMotion: false
|
|
96
124
|
};
|
|
@@ -100,41 +128,12 @@ class Tabs extends _baseComponent.default {
|
|
|
100
128
|
get adapter() {
|
|
101
129
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
102
130
|
collectPane: () => {
|
|
103
|
-
const
|
|
104
|
-
tabList,
|
|
105
|
-
children
|
|
106
|
-
} = this.props;
|
|
107
|
-
if (Array.isArray(tabList) && tabList.length) {
|
|
108
|
-
this.setState({
|
|
109
|
-
panes: tabList
|
|
110
|
-
});
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const panes = _react.default.Children.map(children, child => {
|
|
114
|
-
if (child) {
|
|
115
|
-
const {
|
|
116
|
-
tab,
|
|
117
|
-
icon,
|
|
118
|
-
disabled,
|
|
119
|
-
itemKey,
|
|
120
|
-
closable
|
|
121
|
-
} = child.props;
|
|
122
|
-
return {
|
|
123
|
-
tab,
|
|
124
|
-
icon,
|
|
125
|
-
disabled,
|
|
126
|
-
itemKey,
|
|
127
|
-
closable
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
return undefined;
|
|
131
|
-
});
|
|
131
|
+
const panes = this.getPanes();
|
|
132
132
|
this.setState({
|
|
133
133
|
panes
|
|
134
134
|
});
|
|
135
135
|
},
|
|
136
136
|
collectActiveKey: () => {
|
|
137
|
-
let panes = [];
|
|
138
137
|
const {
|
|
139
138
|
tabList,
|
|
140
139
|
children,
|
|
@@ -146,29 +145,7 @@ class Tabs extends _baseComponent.default {
|
|
|
146
145
|
const {
|
|
147
146
|
activeKey
|
|
148
147
|
} = this.state;
|
|
149
|
-
|
|
150
|
-
panes = tabList;
|
|
151
|
-
} else {
|
|
152
|
-
panes = _react.default.Children.map(children, child => {
|
|
153
|
-
if (child) {
|
|
154
|
-
const {
|
|
155
|
-
tab,
|
|
156
|
-
icon,
|
|
157
|
-
disabled,
|
|
158
|
-
itemKey,
|
|
159
|
-
closable
|
|
160
|
-
} = child.props;
|
|
161
|
-
return {
|
|
162
|
-
tab,
|
|
163
|
-
icon,
|
|
164
|
-
disabled,
|
|
165
|
-
itemKey,
|
|
166
|
-
closable
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
return undefined;
|
|
170
|
-
});
|
|
171
|
-
}
|
|
148
|
+
const panes = this.getPanes();
|
|
172
149
|
if (panes.findIndex(p => p.itemKey === activeKey) === -1) {
|
|
173
150
|
if (panes.length > 0) {
|
|
174
151
|
this.setState({
|
package/lib/es/_base/base.css
CHANGED
|
@@ -458,26 +458,26 @@ body, body[theme-mode=dark] .semi-always-light {
|
|
|
458
458
|
--semi-border-radius-full: 9999px;
|
|
459
459
|
--semi-color-highlight-bg: rgba(var(--semi-yellow-4), 1);
|
|
460
460
|
--semi-color-highlight: rgba(var(--semi-black), 1);
|
|
461
|
-
--semi-color-data-0:rgba(
|
|
462
|
-
--semi-color-data-1:rgba(
|
|
463
|
-
--semi-color-data-2:rgba(
|
|
464
|
-
--semi-color-data-3:rgba(
|
|
465
|
-
--semi-color-data-4:rgba(
|
|
466
|
-
--semi-color-data-5:rgba(
|
|
467
|
-
--semi-color-data-6:rgba(
|
|
468
|
-
--semi-color-data-7:rgba(
|
|
469
|
-
--semi-color-data-8:rgba(
|
|
470
|
-
--semi-color-data-9:rgba(
|
|
471
|
-
--semi-color-data-10:rgba(
|
|
472
|
-
--semi-color-data-11:rgba(
|
|
473
|
-
--semi-color-data-12:rgba(
|
|
474
|
-
--semi-color-data-13:rgba(
|
|
475
|
-
--semi-color-data-14:rgba(
|
|
476
|
-
--semi-color-data-15:rgba(
|
|
477
|
-
--semi-color-data-16:rgba(
|
|
478
|
-
--semi-color-data-17:rgba(
|
|
479
|
-
--semi-color-data-18:rgba(
|
|
480
|
-
--semi-color-data-19:rgba(
|
|
461
|
+
--semi-color-data-0: rgba(87, 105, 255, 1);
|
|
462
|
+
--semi-color-data-1: rgba(142, 212, 231, 1);
|
|
463
|
+
--semi-color-data-2: rgba(245, 135, 0, 1);
|
|
464
|
+
--semi-color-data-3: rgba(220, 183, 252, 1);
|
|
465
|
+
--semi-color-data-4: rgba(74, 156, 247, 1);
|
|
466
|
+
--semi-color-data-5: rgba(243, 204, 53, 1);
|
|
467
|
+
--semi-color-data-6: rgba(254, 128, 144, 1);
|
|
468
|
+
--semi-color-data-7: rgba(139, 215, 210, 1);
|
|
469
|
+
--semi-color-data-8: rgba(131, 176, 35, 1);
|
|
470
|
+
--semi-color-data-9: rgba(233, 165, 229, 1);
|
|
471
|
+
--semi-color-data-10: rgba(48, 167, 206, 1);
|
|
472
|
+
--semi-color-data-11: rgba(249, 192, 100, 1);
|
|
473
|
+
--semi-color-data-12: rgba(177, 113, 249, 1);
|
|
474
|
+
--semi-color-data-13: rgba(119, 182, 249, 1);
|
|
475
|
+
--semi-color-data-14: rgba(200, 143, 2, 1);
|
|
476
|
+
--semi-color-data-15: rgba(255, 170, 178, 1);
|
|
477
|
+
--semi-color-data-16: rgba(51, 176, 171, 1);
|
|
478
|
+
--semi-color-data-17: rgba(182, 215, 129, 1);
|
|
479
|
+
--semi-color-data-18: rgba(212, 88, 212, 1);
|
|
480
|
+
--semi-color-data-19: rgba(188, 198, 255, 1);
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
body[theme-mode=dark], body .semi-always-dark {
|
|
@@ -568,26 +568,26 @@ body[theme-mode=dark], body .semi-always-dark {
|
|
|
568
568
|
--semi-border-radius-full: 9999px;
|
|
569
569
|
--semi-color-highlight-bg: rgba(var(--semi-yellow-2), 1);
|
|
570
570
|
--semi-color-highlight: rgba(var(--semi-white), 1);
|
|
571
|
-
--semi-color-data-0:rgba(
|
|
572
|
-
--semi-color-data-1:rgba(
|
|
573
|
-
--semi-color-data-2:rgba(
|
|
574
|
-
--semi-color-data-3:rgba(
|
|
575
|
-
--semi-color-data-4:rgba(
|
|
576
|
-
--semi-color-data-5:rgba(
|
|
577
|
-
--semi-color-data-6:rgba(
|
|
578
|
-
--semi-color-data-7:rgba(
|
|
579
|
-
--semi-color-data-8:rgba(
|
|
580
|
-
--semi-color-data-9:rgba(
|
|
581
|
-
--semi-color-data-10:rgba(
|
|
582
|
-
--semi-color-data-11:rgba(
|
|
583
|
-
--semi-color-data-12:rgba(
|
|
584
|
-
--semi-color-data-13:rgba(
|
|
585
|
-
--semi-color-data-14:rgba(
|
|
586
|
-
--semi-color-data-15:rgba(
|
|
587
|
-
--semi-color-data-16:rgba(
|
|
588
|
-
--semi-color-data-17:rgba(
|
|
589
|
-
--semi-color-data-18:rgba(
|
|
590
|
-
--semi-color-data-19:rgba(
|
|
571
|
+
--semi-color-data-0: rgba(94, 109, 194, 1);
|
|
572
|
+
--semi-color-data-1: rgba(8, 104, 120, 1);
|
|
573
|
+
--semi-color-data-2: rgba(250, 173, 63, 1);
|
|
574
|
+
--semi-color-data-3: rgba(76, 43, 156, 1);
|
|
575
|
+
--semi-color-data-4: rgba(16, 125, 248, 1);
|
|
576
|
+
--semi-color-data-5: rgba(248, 202, 16, 1);
|
|
577
|
+
--semi-color-data-6: rgba(195, 30, 87, 1);
|
|
578
|
+
--semi-color-data-7: rgba(5, 119, 115, 1);
|
|
579
|
+
--semi-color-data-8: rgba(154, 207, 13, 1);
|
|
580
|
+
--semi-color-data-9: rgba(117, 29, 138, 1);
|
|
581
|
+
--semi-color-data-10: rgba(16, 162, 180, 1);
|
|
582
|
+
--semi-color-data-11: rgba(208, 110, 11, 1);
|
|
583
|
+
--semi-color-data-12: rgba(113, 66, 197, 1);
|
|
584
|
+
--semi-color-data-13: rgba(7, 100, 212, 1);
|
|
585
|
+
--semi-color-data-14: rgba(251, 232, 110, 1);
|
|
586
|
+
--semi-color-data-15: rgba(160, 19, 73, 1);
|
|
587
|
+
--semi-color-data-16: rgba(11, 179, 167, 1);
|
|
588
|
+
--semi-color-data-17: rgba(98, 138, 6, 1);
|
|
589
|
+
--semi-color-data-18: rgba(162, 48, 179, 1);
|
|
590
|
+
--semi-color-data-19: rgba(40, 51, 138, 1);
|
|
591
591
|
}
|
|
592
592
|
|
|
593
593
|
.semi-light-scrollbar::-webkit-scrollbar, .semi-light-scrollbar *::-webkit-scrollbar {
|
|
@@ -36,6 +36,6 @@ interface SortableItemProps {
|
|
|
36
36
|
prefix?: string;
|
|
37
37
|
transition?: SortableTransition | null;
|
|
38
38
|
}
|
|
39
|
-
export declare function Sortable({ items, onSortEnd, adjustScale, renderItem, transition,
|
|
39
|
+
export declare function Sortable({ items, onSortEnd, adjustScale, renderItem, transition, collisionDetection, strategy, useDragOverlay, dragOverlayCls, container: Container, prefix, }: SortableProps): JSX.Element;
|
|
40
40
|
export declare function SortableItem({ animateLayoutChanges, id, renderItem, prefix, transition: animation, }: SortableItemProps): JSX.Element;
|
|
41
41
|
export {};
|
|
@@ -6,10 +6,6 @@ import cls from 'classnames';
|
|
|
6
6
|
import { closestCenter, DragOverlay, DndContext, MouseSensor, TouchSensor, useSensor, useSensors, KeyboardSensor, TraversalOrder } from '@dnd-kit/core';
|
|
7
7
|
import { useSortable, SortableContext, rectSortingStrategy, sortableKeyboardCoordinates } from '@dnd-kit/sortable';
|
|
8
8
|
const defaultPrefix = 'semi-sortable';
|
|
9
|
-
const defaultConstraint = {
|
|
10
|
-
delay: 150,
|
|
11
|
-
tolerance: 5
|
|
12
|
-
};
|
|
13
9
|
function DefaultContainer(props) {
|
|
14
10
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
15
11
|
style: {
|
|
@@ -17,6 +13,9 @@ function DefaultContainer(props) {
|
|
|
17
13
|
}
|
|
18
14
|
}, props));
|
|
19
15
|
}
|
|
16
|
+
const defaultKeyBoardOptions = {
|
|
17
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
18
|
+
};
|
|
20
19
|
export function Sortable(_ref) {
|
|
21
20
|
let {
|
|
22
21
|
items,
|
|
@@ -24,7 +23,6 @@ export function Sortable(_ref) {
|
|
|
24
23
|
adjustScale,
|
|
25
24
|
renderItem,
|
|
26
25
|
transition,
|
|
27
|
-
activationConstraint = defaultConstraint,
|
|
28
26
|
collisionDetection = closestCenter,
|
|
29
27
|
strategy = rectSortingStrategy,
|
|
30
28
|
useDragOverlay = true,
|
|
@@ -33,13 +31,7 @@ export function Sortable(_ref) {
|
|
|
33
31
|
prefix = defaultPrefix
|
|
34
32
|
} = _ref;
|
|
35
33
|
const [activeId, setActiveId] = useState(null);
|
|
36
|
-
const sensors = useSensors(useSensor(MouseSensor,
|
|
37
|
-
activationConstraint
|
|
38
|
-
}), useSensor(TouchSensor, {
|
|
39
|
-
activationConstraint
|
|
40
|
-
}), useSensor(KeyboardSensor, {
|
|
41
|
-
coordinateGetter: sortableKeyboardCoordinates
|
|
42
|
-
}));
|
|
34
|
+
const sensors = useSensors(useSensor(MouseSensor), useSensor(TouchSensor), useSensor(KeyboardSensor, defaultKeyBoardOptions));
|
|
43
35
|
const getIndex = useCallback(id => items.indexOf(id), [items]);
|
|
44
36
|
const activeIndex = useMemo(() => activeId ? getIndex(activeId) : -1, [getIndex, activeId]);
|
|
45
37
|
const onDragStart = useCallback(_ref2 => {
|
|
@@ -149,13 +141,15 @@ export function SortableItem(_ref4) {
|
|
|
149
141
|
[`${prefix}-sortable-item-over`]: isOver,
|
|
150
142
|
[`${prefix}-sortable-item-active`]: (active === null || active === void 0 ? void 0 : active.id) === id
|
|
151
143
|
});
|
|
152
|
-
const wrapperStyle =
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
144
|
+
const wrapperStyle = useMemo(() => {
|
|
145
|
+
return !_isNull(animation) ? {
|
|
146
|
+
transform: cssDndKit.Transform.toString(Object.assign(Object.assign({}, transform), {
|
|
147
|
+
scaleX: 1,
|
|
148
|
+
scaleY: 1
|
|
149
|
+
})),
|
|
150
|
+
transition: transition
|
|
151
|
+
} : undefined;
|
|
152
|
+
}, [animation, transform, transition]);
|
|
159
153
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
160
154
|
ref: setNodeRef,
|
|
161
155
|
style: wrapperStyle,
|
|
@@ -7,11 +7,13 @@ export interface SplitButtonGroupProps extends BaseProps {
|
|
|
7
7
|
}
|
|
8
8
|
export default class SplitButtonGroup extends BaseComponent<SplitButtonGroupProps> {
|
|
9
9
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
10
|
+
mutationObserver: MutationObserver | null;
|
|
10
11
|
static propTypes: {
|
|
11
12
|
style: PropTypes.Requireable<object>;
|
|
12
13
|
className: PropTypes.Requireable<string>;
|
|
13
14
|
'aria-label': PropTypes.Requireable<string>;
|
|
14
15
|
};
|
|
15
16
|
componentDidMount(): void;
|
|
17
|
+
componentWillUnmount(): void;
|
|
16
18
|
render(): JSX.Element;
|
|
17
19
|
}
|