@douyinfe/semi-ui 2.55.0-beta.0 → 2.55.1

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.
@@ -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(22, 100, 255, 1);
462
- --semi-color-data-1:rgba(178, 207, 255, 1);
463
- --semi-color-data-2:rgba(26, 198, 255, 1);
464
- --semi-color-data-3:rgba(148, 239, 255, 1);
465
- --semi-color-data-4:rgba(255, 138, 0, 1);
466
- --semi-color-data-5:rgba(255, 206, 122, 1);
467
- --semi-color-data-6:rgba(60, 199, 128, 1);
468
- --semi-color-data-7:rgba(185, 237, 205, 1);
469
- --semi-color-data-8:rgba(116, 66, 212, 1);
470
- --semi-color-data-9:rgba(221, 197, 250, 1);
471
- --semi-color-data-10:rgba(255, 196, 0, 1);
472
- --semi-color-data-11:rgba(250, 232, 120, 1);
473
- --semi-color-data-12:rgba(48, 77, 119, 1);
474
- --semi-color-data-13:rgba(139, 149, 158, 1);
475
- --semi-color-data-14:rgba(180, 141, 235, 1);
476
- --semi-color-data-15:rgba(239, 227, 255, 1);
477
- --semi-color-data-16:rgba(0, 148, 136, 1);
478
- --semi-color-data-17:rgba(89, 186, 168, 1);
479
- --semi-color-data-18:rgba(255, 125, 218, 1);
480
- --semi-color-data-19:rgba(255, 207, 238, 1);
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(22, 100, 255, 1);
572
- --semi-color-data-1:rgba(178, 207, 255, 1);
573
- --semi-color-data-2:rgba(26, 198, 255, 1);
574
- --semi-color-data-3:rgba(148, 239, 255, 1);
575
- --semi-color-data-4:rgba(255, 138, 0, 1);
576
- --semi-color-data-5:rgba(255, 206, 122, 1);
577
- --semi-color-data-6:rgba(60, 199, 128, 1);
578
- --semi-color-data-7:rgba(185, 237, 205, 1);
579
- --semi-color-data-8:rgba(116, 66, 212, 1);
580
- --semi-color-data-9:rgba(221, 197, 250, 1);
581
- --semi-color-data-10:rgba(255, 196, 0, 1);
582
- --semi-color-data-11:rgba(250, 232, 120, 1);
583
- --semi-color-data-12:rgba(48, 77, 119, 1);
584
- --semi-color-data-13:rgba(139, 149, 158, 1);
585
- --semi-color-data-14:rgba(180, 141, 235, 1);
586
- --semi-color-data-15:rgba(239, 227, 255, 1);
587
- --semi-color-data-16:rgba(0, 148, 136, 1);
588
- --semi-color-data-17:rgba(89, 186, 168, 1);
589
- --semi-color-data-18:rgba(255, 125, 218, 1);
590
- --semi-color-data-19:rgba(255, 207, 238, 1);
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
- if (this.containerRef.current) {
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.add(`${prefixCls}-first`);
26
- lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.add(`${prefixCls}-last`);
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,
@@ -8,6 +8,7 @@ export interface CollapseContextType {
8
8
  expandIconPosition: 'left' | 'right';
9
9
  onClick: (activeKey: string, e: React.MouseEvent) => void;
10
10
  motion: boolean;
11
+ lazyRender: boolean;
11
12
  }
12
13
  declare const CollapseContext: React.Context<CollapseContextType>;
13
14
  export default CollapseContext;
@@ -11,6 +11,7 @@ export interface CollapseReactProps extends CollapseProps {
11
11
  children?: React.ReactNode;
12
12
  style?: CSSProperties;
13
13
  onChange?: (activeKey: CollapseProps['activeKey'], e: React.MouseEvent) => void;
14
+ lazyRender?: boolean;
14
15
  }
15
16
  export type { CollapseState };
16
17
  declare class Collapse extends BaseComponent<CollapseReactProps, CollapseState> {
@@ -28,6 +29,7 @@ declare class Collapse extends BaseComponent<CollapseReactProps, CollapseState>
28
29
  keepDOM: PropTypes.Requireable<boolean>;
29
30
  motion: PropTypes.Requireable<NonNullable<boolean | object>>;
30
31
  expandIconPosition: PropTypes.Requireable<string>;
32
+ lazyRender: PropTypes.Requireable<boolean>;
31
33
  };
32
34
  static __SemiComponentName__: string;
33
35
  static defaultProps: any;
@@ -66,6 +66,7 @@ class Collapse extends _baseComponent.default {
66
66
  const _a = this.props,
67
67
  {
68
68
  defaultActiveKey,
69
+ lazyRender,
69
70
  accordion,
70
71
  style,
71
72
  motion,
@@ -77,7 +78,7 @@ class Collapse extends _baseComponent.default {
77
78
  children,
78
79
  clickHeaderToExpand
79
80
  } = _a,
80
- rest = __rest(_a, ["defaultActiveKey", "accordion", "style", "motion", "className", "keepDOM", "expandIconPosition", "expandIcon", "collapseIcon", "children", "clickHeaderToExpand"]);
81
+ rest = __rest(_a, ["defaultActiveKey", "lazyRender", "accordion", "style", "motion", "className", "keepDOM", "expandIconPosition", "expandIcon", "collapseIcon", "children", "clickHeaderToExpand"]);
81
82
  const clsPrefix = (0, _classnames.default)(_constants.cssClasses.PREFIX, className);
82
83
  const {
83
84
  activeSet
@@ -94,7 +95,8 @@ class Collapse extends _baseComponent.default {
94
95
  keepDOM,
95
96
  expandIconPosition,
96
97
  onClick: this.onChange,
97
- motion
98
+ motion,
99
+ lazyRender
98
100
  }
99
101
  }, children));
100
102
  }
@@ -112,14 +114,16 @@ Collapse.propTypes = {
112
114
  className: _propTypes.default.string,
113
115
  keepDOM: _propTypes.default.bool,
114
116
  motion: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.func, _propTypes.default.object]),
115
- expandIconPosition: _propTypes.default.oneOf(_constants.strings.iconPosition)
117
+ expandIconPosition: _propTypes.default.oneOf(_constants.strings.iconPosition),
118
+ lazyRender: _propTypes.default.bool
116
119
  };
117
- Collapse.__SemiComponentName__ = "Collapse";
120
+ Collapse.__SemiComponentName__ = 'Collapse';
118
121
  Collapse.defaultProps = (0, _utils.getDefaultPropsFromGlobalConfig)(Collapse.__SemiComponentName__, {
119
122
  defaultActiveKey: '',
120
123
  clickHeaderToExpand: true,
121
124
  onChange: _function.noop,
122
- expandIconPosition: 'right'
125
+ expandIconPosition: 'right',
126
+ lazyRender: false
123
127
  });
124
128
  var _default = Collapse;
125
129
  exports.default = _default;
@@ -92,7 +92,8 @@ class CollapsePanel extends _react.PureComponent {
92
92
  keepDOM,
93
93
  expandIconPosition,
94
94
  activeSet,
95
- motion
95
+ motion,
96
+ lazyRender
96
97
  } = this.context;
97
98
  const active = activeSet.has(itemKey);
98
99
  const itemCls = (0, _classnames.default)(className, {
@@ -117,6 +118,7 @@ class CollapsePanel extends _react.PureComponent {
117
118
  "aria-owns": this.ariaID,
118
119
  onClick: e => !disabled && this.handleClick(itemKey, e)
119
120
  }, this.renderHeader(active, children !== undefined && !disabled)), children && /*#__PURE__*/_react.default.createElement(_collapsible.default, {
121
+ lazyRender: lazyRender,
120
122
  isOpen: active,
121
123
  keepDOM: keepDOM,
122
124
  motion: motion,
@@ -29,6 +29,7 @@ declare class Collapsible extends BaseComponent<CollapsibleProps, CollapsibleSta
29
29
  foundation: CollapsibleFoundation;
30
30
  private domRef;
31
31
  private resizeObserver;
32
+ private hasBeenRendered;
32
33
  constructor(props: CollapsibleProps);
33
34
  get adapter(): CollapsibleAdapter<CollapsibleProps, CollapsibleState>;
34
35
  static getEntryInfo: (entry: ResizeObserverEntry) => {
@@ -18,6 +18,7 @@ class Collapsible extends _baseComponent.default {
18
18
  constructor(props) {
19
19
  super(props);
20
20
  this.domRef = /*#__PURE__*/_react.default.createRef();
21
+ this.hasBeenRendered = false;
21
22
  this.handleResize = entryList => {
22
23
  const entry = entryList[0];
23
24
  if (entry) {
@@ -114,7 +115,10 @@ class Collapsible extends _baseComponent.default {
114
115
  const wrapperCls = (0, _classnames.default)(`${_constants.cssClasses.PREFIX}-wrapper`, {
115
116
  [`${_constants.cssClasses.PREFIX}-transition`]: this.props.motion && this.state.isTransitioning
116
117
  }, this.props.className);
117
- const shouldRender = this.props.keepDOM && !this.props.lazyRender || this.props.collapseHeight !== 0 || this.state.visible || this.props.isOpen;
118
+ const shouldRender = this.props.keepDOM && (this.props.lazyRender ? this.hasBeenRendered : true) || this.props.collapseHeight !== 0 || this.state.visible || this.props.isOpen;
119
+ if (shouldRender && !this.hasBeenRendered) {
120
+ this.hasBeenRendered = true;
121
+ }
118
122
  return /*#__PURE__*/_react.default.createElement("div", Object.assign({
119
123
  className: wrapperCls,
120
124
  style: wrapperStyle,
@@ -142,7 +146,7 @@ Collapsible.defaultProps = (0, _utils.getDefaultPropsFromGlobalConfig)(Collapsib
142
146
  duration: 250,
143
147
  motion: true,
144
148
  keepDOM: false,
145
- lazyRender: true,
149
+ lazyRender: false,
146
150
  collapseHeight: 0,
147
151
  fade: false
148
152
  });
@@ -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 = _interopRequireDefault(require("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 || 1
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)));
@@ -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(22, 100, 255, 1);
462
- --semi-color-data-1:rgba(178, 207, 255, 1);
463
- --semi-color-data-2:rgba(26, 198, 255, 1);
464
- --semi-color-data-3:rgba(148, 239, 255, 1);
465
- --semi-color-data-4:rgba(255, 138, 0, 1);
466
- --semi-color-data-5:rgba(255, 206, 122, 1);
467
- --semi-color-data-6:rgba(60, 199, 128, 1);
468
- --semi-color-data-7:rgba(185, 237, 205, 1);
469
- --semi-color-data-8:rgba(116, 66, 212, 1);
470
- --semi-color-data-9:rgba(221, 197, 250, 1);
471
- --semi-color-data-10:rgba(255, 196, 0, 1);
472
- --semi-color-data-11:rgba(250, 232, 120, 1);
473
- --semi-color-data-12:rgba(48, 77, 119, 1);
474
- --semi-color-data-13:rgba(139, 149, 158, 1);
475
- --semi-color-data-14:rgba(180, 141, 235, 1);
476
- --semi-color-data-15:rgba(239, 227, 255, 1);
477
- --semi-color-data-16:rgba(0, 148, 136, 1);
478
- --semi-color-data-17:rgba(89, 186, 168, 1);
479
- --semi-color-data-18:rgba(255, 125, 218, 1);
480
- --semi-color-data-19:rgba(255, 207, 238, 1);
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(22, 100, 255, 1);
572
- --semi-color-data-1:rgba(178, 207, 255, 1);
573
- --semi-color-data-2:rgba(26, 198, 255, 1);
574
- --semi-color-data-3:rgba(148, 239, 255, 1);
575
- --semi-color-data-4:rgba(255, 138, 0, 1);
576
- --semi-color-data-5:rgba(255, 206, 122, 1);
577
- --semi-color-data-6:rgba(60, 199, 128, 1);
578
- --semi-color-data-7:rgba(185, 237, 205, 1);
579
- --semi-color-data-8:rgba(116, 66, 212, 1);
580
- --semi-color-data-9:rgba(221, 197, 250, 1);
581
- --semi-color-data-10:rgba(255, 196, 0, 1);
582
- --semi-color-data-11:rgba(250, 232, 120, 1);
583
- --semi-color-data-12:rgba(48, 77, 119, 1);
584
- --semi-color-data-13:rgba(139, 149, 158, 1);
585
- --semi-color-data-14:rgba(180, 141, 235, 1);
586
- --semi-color-data-15:rgba(239, 227, 255, 1);
587
- --semi-color-data-16:rgba(0, 148, 136, 1);
588
- --semi-color-data-17:rgba(89, 186, 168, 1);
589
- --semi-color-data-18:rgba(255, 125, 218, 1);
590
- --semi-color-data-19:rgba(255, 207, 238, 1);
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
- if (this.containerRef.current) {
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.add(`${prefixCls}-first`);
19
- lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.add(`${prefixCls}-last`);
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,
@@ -8,6 +8,7 @@ export interface CollapseContextType {
8
8
  expandIconPosition: 'left' | 'right';
9
9
  onClick: (activeKey: string, e: React.MouseEvent) => void;
10
10
  motion: boolean;
11
+ lazyRender: boolean;
11
12
  }
12
13
  declare const CollapseContext: React.Context<CollapseContextType>;
13
14
  export default CollapseContext;
@@ -11,6 +11,7 @@ export interface CollapseReactProps extends CollapseProps {
11
11
  children?: React.ReactNode;
12
12
  style?: CSSProperties;
13
13
  onChange?: (activeKey: CollapseProps['activeKey'], e: React.MouseEvent) => void;
14
+ lazyRender?: boolean;
14
15
  }
15
16
  export type { CollapseState };
16
17
  declare class Collapse extends BaseComponent<CollapseReactProps, CollapseState> {
@@ -28,6 +29,7 @@ declare class Collapse extends BaseComponent<CollapseReactProps, CollapseState>
28
29
  keepDOM: PropTypes.Requireable<boolean>;
29
30
  motion: PropTypes.Requireable<NonNullable<boolean | object>>;
30
31
  expandIconPosition: PropTypes.Requireable<string>;
32
+ lazyRender: PropTypes.Requireable<boolean>;
31
33
  };
32
34
  static __SemiComponentName__: string;
33
35
  static defaultProps: any;
@@ -17,7 +17,7 @@ import CollapsePanel from './item';
17
17
  import '@douyinfe/semi-foundation/lib/es/collapse/collapse.css';
18
18
  import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
19
19
  import CollapseContext from './collapse-context';
20
- import { getDefaultPropsFromGlobalConfig } from "../_utils";
20
+ import { getDefaultPropsFromGlobalConfig } from '../_utils';
21
21
  class Collapse extends BaseComponent {
22
22
  constructor(props) {
23
23
  super(props);
@@ -59,6 +59,7 @@ class Collapse extends BaseComponent {
59
59
  const _a = this.props,
60
60
  {
61
61
  defaultActiveKey,
62
+ lazyRender,
62
63
  accordion,
63
64
  style,
64
65
  motion,
@@ -70,7 +71,7 @@ class Collapse extends BaseComponent {
70
71
  children,
71
72
  clickHeaderToExpand
72
73
  } = _a,
73
- rest = __rest(_a, ["defaultActiveKey", "accordion", "style", "motion", "className", "keepDOM", "expandIconPosition", "expandIcon", "collapseIcon", "children", "clickHeaderToExpand"]);
74
+ rest = __rest(_a, ["defaultActiveKey", "lazyRender", "accordion", "style", "motion", "className", "keepDOM", "expandIconPosition", "expandIcon", "collapseIcon", "children", "clickHeaderToExpand"]);
74
75
  const clsPrefix = cls(cssClasses.PREFIX, className);
75
76
  const {
76
77
  activeSet
@@ -87,7 +88,8 @@ class Collapse extends BaseComponent {
87
88
  keepDOM,
88
89
  expandIconPosition,
89
90
  onClick: this.onChange,
90
- motion
91
+ motion,
92
+ lazyRender
91
93
  }
92
94
  }, children));
93
95
  }
@@ -105,13 +107,15 @@ Collapse.propTypes = {
105
107
  className: PropTypes.string,
106
108
  keepDOM: PropTypes.bool,
107
109
  motion: PropTypes.oneOfType([PropTypes.bool, PropTypes.func, PropTypes.object]),
108
- expandIconPosition: PropTypes.oneOf(strings.iconPosition)
110
+ expandIconPosition: PropTypes.oneOf(strings.iconPosition),
111
+ lazyRender: PropTypes.bool
109
112
  };
110
- Collapse.__SemiComponentName__ = "Collapse";
113
+ Collapse.__SemiComponentName__ = 'Collapse';
111
114
  Collapse.defaultProps = getDefaultPropsFromGlobalConfig(Collapse.__SemiComponentName__, {
112
115
  defaultActiveKey: '',
113
116
  clickHeaderToExpand: true,
114
117
  onChange: noop,
115
- expandIconPosition: 'right'
118
+ expandIconPosition: 'right',
119
+ lazyRender: false
116
120
  });
117
121
  export default Collapse;
@@ -83,7 +83,8 @@ export default class CollapsePanel extends PureComponent {
83
83
  keepDOM,
84
84
  expandIconPosition,
85
85
  activeSet,
86
- motion
86
+ motion,
87
+ lazyRender
87
88
  } = this.context;
88
89
  const active = activeSet.has(itemKey);
89
90
  const itemCls = cls(className, {
@@ -108,6 +109,7 @@ export default class CollapsePanel extends PureComponent {
108
109
  "aria-owns": this.ariaID,
109
110
  onClick: e => !disabled && this.handleClick(itemKey, e)
110
111
  }, this.renderHeader(active, children !== undefined && !disabled)), children && /*#__PURE__*/React.createElement(Collapsible, {
112
+ lazyRender: lazyRender,
111
113
  isOpen: active,
112
114
  keepDOM: keepDOM,
113
115
  motion: motion,
@@ -29,6 +29,7 @@ declare class Collapsible extends BaseComponent<CollapsibleProps, CollapsibleSta
29
29
  foundation: CollapsibleFoundation;
30
30
  private domRef;
31
31
  private resizeObserver;
32
+ private hasBeenRendered;
32
33
  constructor(props: CollapsibleProps);
33
34
  get adapter(): CollapsibleAdapter<CollapsibleProps, CollapsibleState>;
34
35
  static getEntryInfo: (entry: ResizeObserverEntry) => {
@@ -11,6 +11,7 @@ class Collapsible extends BaseComponent {
11
11
  constructor(props) {
12
12
  super(props);
13
13
  this.domRef = /*#__PURE__*/React.createRef();
14
+ this.hasBeenRendered = false;
14
15
  this.handleResize = entryList => {
15
16
  const entry = entryList[0];
16
17
  if (entry) {
@@ -107,7 +108,10 @@ class Collapsible extends BaseComponent {
107
108
  const wrapperCls = cls(`${cssClasses.PREFIX}-wrapper`, {
108
109
  [`${cssClasses.PREFIX}-transition`]: this.props.motion && this.state.isTransitioning
109
110
  }, this.props.className);
110
- const shouldRender = this.props.keepDOM && !this.props.lazyRender || this.props.collapseHeight !== 0 || this.state.visible || this.props.isOpen;
111
+ const shouldRender = this.props.keepDOM && (this.props.lazyRender ? this.hasBeenRendered : true) || this.props.collapseHeight !== 0 || this.state.visible || this.props.isOpen;
112
+ if (shouldRender && !this.hasBeenRendered) {
113
+ this.hasBeenRendered = true;
114
+ }
111
115
  return /*#__PURE__*/React.createElement("div", Object.assign({
112
116
  className: wrapperCls,
113
117
  style: wrapperStyle,
@@ -135,7 +139,7 @@ Collapsible.defaultProps = getDefaultPropsFromGlobalConfig(Collapsible.__SemiCom
135
139
  duration: 250,
136
140
  motion: true,
137
141
  keepDOM: false,
138
- lazyRender: true,
142
+ lazyRender: false,
139
143
  collapseHeight: 0,
140
144
  fade: false
141
145
  });