@douyinfe/semi-ui 2.55.0-beta.0 → 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 +61 -15
- 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/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/es/_base/base.css +40 -40
- 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/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 {
|
|
@@ -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)));
|
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 {
|
|
@@ -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
|
}
|
|
@@ -9,16 +9,42 @@ export default class SplitButtonGroup extends BaseComponent {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.containerRef = /*#__PURE__*/React.createRef();
|
|
12
|
+
this.mutationObserver = null;
|
|
12
13
|
}
|
|
13
14
|
componentDidMount() {
|
|
14
|
-
|
|
15
|
+
const addClassName = () => {
|
|
15
16
|
const buttons = this.containerRef.current.querySelectorAll('button');
|
|
16
17
|
const firstButton = buttons[0];
|
|
17
18
|
const lastButton = buttons[buttons.length - 1];
|
|
18
|
-
firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.
|
|
19
|
-
|
|
19
|
+
if (!(firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.contains(`${prefixCls}-first`))) {
|
|
20
|
+
firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.add(`${prefixCls}-first`);
|
|
21
|
+
}
|
|
22
|
+
if (!(lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.contains(`${prefixCls}-last`))) {
|
|
23
|
+
lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.add(`${prefixCls}-last`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
if (this.containerRef.current) {
|
|
27
|
+
addClassName();
|
|
28
|
+
const mutationObserver = new MutationObserver((mutations, observer) => {
|
|
29
|
+
for (const mutation of mutations) {
|
|
30
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class' || mutation.type === 'childList' && Array.from(mutation.addedNodes).some(node => node.nodeName === 'BUTTON')) {
|
|
31
|
+
addClassName();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
mutationObserver.observe(this.containerRef.current, {
|
|
36
|
+
attributes: true,
|
|
37
|
+
childList: true,
|
|
38
|
+
subtree: true
|
|
39
|
+
});
|
|
40
|
+
this.mutationObserver = mutationObserver;
|
|
20
41
|
}
|
|
21
42
|
}
|
|
43
|
+
componentWillUnmount() {
|
|
44
|
+
var _a;
|
|
45
|
+
super.componentWillUnmount();
|
|
46
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
47
|
+
}
|
|
22
48
|
render() {
|
|
23
49
|
const {
|
|
24
50
|
children,
|
|
@@ -7,7 +7,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
7
7
|
}
|
|
8
8
|
return t;
|
|
9
9
|
};
|
|
10
|
-
import React from 'react';
|
|
10
|
+
import React, { isValidElement } from 'react';
|
|
11
11
|
import cls from 'classnames';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
13
|
import { strings, cssClasses } from '@douyinfe/semi-foundation/lib/es/descriptions/constants';
|
|
@@ -50,7 +50,22 @@ class Descriptions extends BaseComponent {
|
|
|
50
50
|
this.foundation = new DescriptionsFoundation(this.adapter);
|
|
51
51
|
}
|
|
52
52
|
get adapter() {
|
|
53
|
-
return Object.assign({}, super.adapter)
|
|
53
|
+
return Object.assign(Object.assign({}, super.adapter), {
|
|
54
|
+
getColumns: () => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
if ((_a = this.props.data) === null || _a === void 0 ? void 0 : _a.length) {
|
|
57
|
+
return this.props.data;
|
|
58
|
+
}
|
|
59
|
+
if (this.props.children) {
|
|
60
|
+
return (_b = React.Children.toArray(this.props.children)) === null || _b === void 0 ? void 0 : _b.map(item => {
|
|
61
|
+
return /*#__PURE__*/isValidElement(item) ? Object.assign({
|
|
62
|
+
value: item.props.children
|
|
63
|
+
}, item.props) : [];
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
54
69
|
}
|
|
55
70
|
render() {
|
|
56
71
|
const _a = this.props,
|
|
@@ -48,7 +48,7 @@ export default class Item extends PureComponent {
|
|
|
48
48
|
className: keyCls
|
|
49
49
|
}, itemKey)), /*#__PURE__*/React.createElement("td", {
|
|
50
50
|
className: `${prefixCls}-item ${prefixCls}-item-td`,
|
|
51
|
-
colSpan: span
|
|
51
|
+
colSpan: span ? span * 2 - 1 : 1
|
|
52
52
|
}, /*#__PURE__*/React.createElement("span", {
|
|
53
53
|
className: valCls
|
|
54
54
|
}, typeof children === 'function' ? children() : children)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.55.0
|
|
3
|
+
"version": "2.55.0",
|
|
4
4
|
"description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"@dnd-kit/core": "^6.0.8",
|
|
21
21
|
"@dnd-kit/sortable": "^7.0.2",
|
|
22
22
|
"@dnd-kit/utilities": "^3.2.1",
|
|
23
|
-
"@douyinfe/semi-animation": "2.55.0
|
|
24
|
-
"@douyinfe/semi-animation-react": "2.55.0
|
|
25
|
-
"@douyinfe/semi-foundation": "2.55.0
|
|
26
|
-
"@douyinfe/semi-icons": "2.55.0
|
|
27
|
-
"@douyinfe/semi-illustrations": "2.55.0
|
|
28
|
-
"@douyinfe/semi-theme-default": "2.55.0
|
|
23
|
+
"@douyinfe/semi-animation": "2.55.0",
|
|
24
|
+
"@douyinfe/semi-animation-react": "2.55.0",
|
|
25
|
+
"@douyinfe/semi-foundation": "2.55.0",
|
|
26
|
+
"@douyinfe/semi-icons": "2.55.0",
|
|
27
|
+
"@douyinfe/semi-illustrations": "2.55.0",
|
|
28
|
+
"@douyinfe/semi-theme-default": "2.55.0",
|
|
29
29
|
"async-validator": "^3.5.0",
|
|
30
30
|
"classnames": "^2.2.6",
|
|
31
31
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
],
|
|
76
76
|
"author": "",
|
|
77
77
|
"license": "MIT",
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "21f02cad422b2d15d9f5d9b7b1ca96b0d21bb545",
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
81
81
|
"@babel/plugin-transform-runtime": "^7.15.8",
|