@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.
- package/dist/css/semi.css +40 -40
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +79 -23
- 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/collapse/collapse-context.d.ts +1 -0
- package/lib/cjs/collapse/index.d.ts +2 -0
- package/lib/cjs/collapse/index.js +9 -5
- package/lib/cjs/collapse/item.js +3 -1
- package/lib/cjs/collapsible/index.d.ts +1 -0
- package/lib/cjs/collapsible/index.js +6 -2
- 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/collapse/collapse-context.d.ts +1 -0
- package/lib/es/collapse/index.d.ts +2 -0
- package/lib/es/collapse/index.js +10 -6
- package/lib/es/collapse/item.js +3 -1
- package/lib/es/collapsible/index.d.ts +1 -0
- package/lib/es/collapsible/index.js +6 -2
- package/lib/es/descriptions/index.js +17 -2
- package/lib/es/descriptions/item.js +1 -1
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -48136,6 +48136,7 @@ class Collapsible extends BaseComponent {
|
|
|
48136
48136
|
constructor(props) {
|
|
48137
48137
|
super(props);
|
|
48138
48138
|
this.domRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
48139
|
+
this.hasBeenRendered = false;
|
|
48139
48140
|
this.handleResize = entryList => {
|
|
48140
48141
|
const entry = entryList[0];
|
|
48141
48142
|
if (entry) {
|
|
@@ -48232,7 +48233,10 @@ class Collapsible extends BaseComponent {
|
|
|
48232
48233
|
const wrapperCls = classnames_default()(`${collapsible_constants_cssClasses.PREFIX}-wrapper`, {
|
|
48233
48234
|
[`${collapsible_constants_cssClasses.PREFIX}-transition`]: this.props.motion && this.state.isTransitioning
|
|
48234
48235
|
}, this.props.className);
|
|
48235
|
-
const shouldRender = this.props.keepDOM &&
|
|
48236
|
+
const shouldRender = this.props.keepDOM && (this.props.lazyRender ? this.hasBeenRendered : true) || this.props.collapseHeight !== 0 || this.state.visible || this.props.isOpen;
|
|
48237
|
+
if (shouldRender && !this.hasBeenRendered) {
|
|
48238
|
+
this.hasBeenRendered = true;
|
|
48239
|
+
}
|
|
48236
48240
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", Object.assign({
|
|
48237
48241
|
className: wrapperCls,
|
|
48238
48242
|
style: wrapperStyle,
|
|
@@ -48260,7 +48264,7 @@ Collapsible.defaultProps = getDefaultPropsFromGlobalConfig(Collapsible.__SemiCom
|
|
|
48260
48264
|
duration: 250,
|
|
48261
48265
|
motion: true,
|
|
48262
48266
|
keepDOM: false,
|
|
48263
|
-
lazyRender:
|
|
48267
|
+
lazyRender: false,
|
|
48264
48268
|
collapseHeight: 0,
|
|
48265
48269
|
fade: false
|
|
48266
48270
|
});
|
|
@@ -48386,7 +48390,8 @@ class CollapsePanel extends external_root_React_commonjs2_react_commonjs_react_a
|
|
|
48386
48390
|
keepDOM,
|
|
48387
48391
|
expandIconPosition,
|
|
48388
48392
|
activeSet,
|
|
48389
|
-
motion
|
|
48393
|
+
motion,
|
|
48394
|
+
lazyRender
|
|
48390
48395
|
} = this.context;
|
|
48391
48396
|
const active = activeSet.has(itemKey);
|
|
48392
48397
|
const itemCls = classnames_default()(className, {
|
|
@@ -48411,6 +48416,7 @@ class CollapsePanel extends external_root_React_commonjs2_react_commonjs_react_a
|
|
|
48411
48416
|
"aria-owns": this.ariaID,
|
|
48412
48417
|
onClick: e => !disabled && this.handleClick(itemKey, e)
|
|
48413
48418
|
}, this.renderHeader(active, children !== undefined && !disabled)), children && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(collapsible_0, {
|
|
48419
|
+
lazyRender: lazyRender,
|
|
48414
48420
|
isOpen: active,
|
|
48415
48421
|
keepDOM: keepDOM,
|
|
48416
48422
|
motion: motion,
|
|
@@ -48503,6 +48509,7 @@ class Collapse extends BaseComponent {
|
|
|
48503
48509
|
const _a = this.props,
|
|
48504
48510
|
{
|
|
48505
48511
|
defaultActiveKey,
|
|
48512
|
+
lazyRender,
|
|
48506
48513
|
accordion,
|
|
48507
48514
|
style,
|
|
48508
48515
|
motion,
|
|
@@ -48514,7 +48521,7 @@ class Collapse extends BaseComponent {
|
|
|
48514
48521
|
children,
|
|
48515
48522
|
clickHeaderToExpand
|
|
48516
48523
|
} = _a,
|
|
48517
|
-
rest = collapse_rest(_a, ["defaultActiveKey", "accordion", "style", "motion", "className", "keepDOM", "expandIconPosition", "expandIcon", "collapseIcon", "children", "clickHeaderToExpand"]);
|
|
48524
|
+
rest = collapse_rest(_a, ["defaultActiveKey", "lazyRender", "accordion", "style", "motion", "className", "keepDOM", "expandIconPosition", "expandIcon", "collapseIcon", "children", "clickHeaderToExpand"]);
|
|
48518
48525
|
const clsPrefix = classnames_default()(collapse_constants_cssClasses.PREFIX, className);
|
|
48519
48526
|
const {
|
|
48520
48527
|
activeSet
|
|
@@ -48531,7 +48538,8 @@ class Collapse extends BaseComponent {
|
|
|
48531
48538
|
keepDOM,
|
|
48532
48539
|
expandIconPosition,
|
|
48533
48540
|
onClick: this.onChange,
|
|
48534
|
-
motion
|
|
48541
|
+
motion,
|
|
48542
|
+
lazyRender
|
|
48535
48543
|
}
|
|
48536
48544
|
}, children));
|
|
48537
48545
|
}
|
|
@@ -48549,14 +48557,16 @@ Collapse.propTypes = {
|
|
|
48549
48557
|
className: (prop_types_default()).string,
|
|
48550
48558
|
keepDOM: (prop_types_default()).bool,
|
|
48551
48559
|
motion: prop_types_default().oneOfType([(prop_types_default()).bool, (prop_types_default()).func, (prop_types_default()).object]),
|
|
48552
|
-
expandIconPosition: prop_types_default().oneOf(collapse_constants_strings.iconPosition)
|
|
48560
|
+
expandIconPosition: prop_types_default().oneOf(collapse_constants_strings.iconPosition),
|
|
48561
|
+
lazyRender: (prop_types_default()).bool
|
|
48553
48562
|
};
|
|
48554
|
-
Collapse.__SemiComponentName__ =
|
|
48563
|
+
Collapse.__SemiComponentName__ = 'Collapse';
|
|
48555
48564
|
Collapse.defaultProps = getDefaultPropsFromGlobalConfig(Collapse.__SemiComponentName__, {
|
|
48556
48565
|
defaultActiveKey: '',
|
|
48557
48566
|
clickHeaderToExpand: true,
|
|
48558
48567
|
onChange: function_noop,
|
|
48559
|
-
expandIconPosition: 'right'
|
|
48568
|
+
expandIconPosition: 'right',
|
|
48569
|
+
lazyRender: false
|
|
48560
48570
|
});
|
|
48561
48571
|
/* harmony default export */ const collapse_0 = (Collapse);
|
|
48562
48572
|
;// CONCATENATED MODULE: ./configProvider/index.tsx
|
|
@@ -60836,7 +60846,7 @@ class item_Item extends external_root_React_commonjs2_react_commonjs_react_amd_r
|
|
|
60836
60846
|
className: keyCls
|
|
60837
60847
|
}, itemKey)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("td", {
|
|
60838
60848
|
className: `${item_prefixCls}-item ${item_prefixCls}-item-td`,
|
|
60839
|
-
colSpan: span
|
|
60849
|
+
colSpan: span ? span * 2 - 1 : 1
|
|
60840
60850
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
60841
60851
|
className: valCls
|
|
60842
60852
|
}, typeof children === 'function' ? children() : children)));
|
|
@@ -60870,14 +60880,7 @@ class DescriptionsFoundation extends foundation {
|
|
|
60870
60880
|
data,
|
|
60871
60881
|
children
|
|
60872
60882
|
} = this.getProps();
|
|
60873
|
-
|
|
60874
|
-
if (data === null || data === void 0 ? void 0 : data.length) {
|
|
60875
|
-
columns = data || [];
|
|
60876
|
-
} else {
|
|
60877
|
-
columns = (children === null || children === void 0 ? void 0 : children.map(item => Object.assign({
|
|
60878
|
-
value: item.props.children
|
|
60879
|
-
}, item.props))) || [];
|
|
60880
|
-
}
|
|
60883
|
+
const columns = this._adapter.getColumns();
|
|
60881
60884
|
const horizontalList = [];
|
|
60882
60885
|
const curSpan = {
|
|
60883
60886
|
totalSpan: 0,
|
|
@@ -60892,7 +60895,19 @@ class DescriptionsFoundation extends foundation {
|
|
|
60892
60895
|
curSpan.totalSpan = 0;
|
|
60893
60896
|
}
|
|
60894
60897
|
}
|
|
60895
|
-
if (curSpan.itemList.length != 0)
|
|
60898
|
+
if (curSpan.itemList.length != 0) {
|
|
60899
|
+
const lastSpan = curSpan.itemList[curSpan.itemList.length - 1];
|
|
60900
|
+
if (isNaN(lastSpan.span)) {
|
|
60901
|
+
let total = 0;
|
|
60902
|
+
curSpan.itemList.forEach(item => {
|
|
60903
|
+
return total += !isNaN(item.span) ? item.span : 1;
|
|
60904
|
+
});
|
|
60905
|
+
if (total < column) {
|
|
60906
|
+
lastSpan.span = column - total + 1;
|
|
60907
|
+
}
|
|
60908
|
+
}
|
|
60909
|
+
horizontalList.push(curSpan.itemList);
|
|
60910
|
+
}
|
|
60896
60911
|
return horizontalList;
|
|
60897
60912
|
}
|
|
60898
60913
|
}
|
|
@@ -60949,7 +60964,22 @@ class Descriptions extends BaseComponent {
|
|
|
60949
60964
|
this.foundation = new DescriptionsFoundation(this.adapter);
|
|
60950
60965
|
}
|
|
60951
60966
|
get adapter() {
|
|
60952
|
-
return Object.assign({}, super.adapter)
|
|
60967
|
+
return Object.assign(Object.assign({}, super.adapter), {
|
|
60968
|
+
getColumns: () => {
|
|
60969
|
+
var _a, _b;
|
|
60970
|
+
if ((_a = this.props.data) === null || _a === void 0 ? void 0 : _a.length) {
|
|
60971
|
+
return this.props.data;
|
|
60972
|
+
}
|
|
60973
|
+
if (this.props.children) {
|
|
60974
|
+
return (_b = external_root_React_commonjs2_react_commonjs_react_amd_react_default().Children.toArray(this.props.children)) === null || _b === void 0 ? void 0 : _b.map(item => {
|
|
60975
|
+
return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(item) ? Object.assign({
|
|
60976
|
+
value: item.props.children
|
|
60977
|
+
}, item.props) : [];
|
|
60978
|
+
});
|
|
60979
|
+
}
|
|
60980
|
+
return [];
|
|
60981
|
+
}
|
|
60982
|
+
});
|
|
60953
60983
|
}
|
|
60954
60984
|
render() {
|
|
60955
60985
|
const _a = this.props,
|
|
@@ -76981,16 +77011,42 @@ class SplitButtonGroup extends BaseComponent {
|
|
|
76981
77011
|
constructor() {
|
|
76982
77012
|
super(...arguments);
|
|
76983
77013
|
this.containerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
77014
|
+
this.mutationObserver = null;
|
|
76984
77015
|
}
|
|
76985
77016
|
componentDidMount() {
|
|
76986
|
-
|
|
77017
|
+
const addClassName = () => {
|
|
76987
77018
|
const buttons = this.containerRef.current.querySelectorAll('button');
|
|
76988
77019
|
const firstButton = buttons[0];
|
|
76989
77020
|
const lastButton = buttons[buttons.length - 1];
|
|
76990
|
-
firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.
|
|
76991
|
-
|
|
77021
|
+
if (!(firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.contains(`${splitButtonGroup_prefixCls}-first`))) {
|
|
77022
|
+
firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.add(`${splitButtonGroup_prefixCls}-first`);
|
|
77023
|
+
}
|
|
77024
|
+
if (!(lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.contains(`${splitButtonGroup_prefixCls}-last`))) {
|
|
77025
|
+
lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.add(`${splitButtonGroup_prefixCls}-last`);
|
|
77026
|
+
}
|
|
77027
|
+
};
|
|
77028
|
+
if (this.containerRef.current) {
|
|
77029
|
+
addClassName();
|
|
77030
|
+
const mutationObserver = new MutationObserver((mutations, observer) => {
|
|
77031
|
+
for (const mutation of mutations) {
|
|
77032
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class' || mutation.type === 'childList' && Array.from(mutation.addedNodes).some(node => node.nodeName === 'BUTTON')) {
|
|
77033
|
+
addClassName();
|
|
77034
|
+
}
|
|
77035
|
+
}
|
|
77036
|
+
});
|
|
77037
|
+
mutationObserver.observe(this.containerRef.current, {
|
|
77038
|
+
attributes: true,
|
|
77039
|
+
childList: true,
|
|
77040
|
+
subtree: true
|
|
77041
|
+
});
|
|
77042
|
+
this.mutationObserver = mutationObserver;
|
|
76992
77043
|
}
|
|
76993
77044
|
}
|
|
77045
|
+
componentWillUnmount() {
|
|
77046
|
+
var _a;
|
|
77047
|
+
super.componentWillUnmount();
|
|
77048
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
77049
|
+
}
|
|
76994
77050
|
render() {
|
|
76995
77051
|
const {
|
|
76996
77052
|
children,
|
|
@@ -79425,7 +79481,7 @@ class TableFoundation extends foundation {
|
|
|
79425
79481
|
}
|
|
79426
79482
|
return true;
|
|
79427
79483
|
} else {
|
|
79428
|
-
const isAllSelected = allKeys.every(rowKey => selectedRowKeysSet.has(rowKey));
|
|
79484
|
+
const isAllSelected = allKeys.length && allKeys.every(rowKey => selectedRowKeysSet.has(rowKey));
|
|
79429
79485
|
return isAllSelected || false;
|
|
79430
79486
|
}
|
|
79431
79487
|
}
|