@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/dist/umd/semi-ui.js
CHANGED
|
@@ -60836,7 +60836,7 @@ class item_Item extends external_root_React_commonjs2_react_commonjs_react_amd_r
|
|
|
60836
60836
|
className: keyCls
|
|
60837
60837
|
}, itemKey)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("td", {
|
|
60838
60838
|
className: `${item_prefixCls}-item ${item_prefixCls}-item-td`,
|
|
60839
|
-
colSpan: span
|
|
60839
|
+
colSpan: span ? span * 2 - 1 : 1
|
|
60840
60840
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
60841
60841
|
className: valCls
|
|
60842
60842
|
}, typeof children === 'function' ? children() : children)));
|
|
@@ -60870,14 +60870,7 @@ class DescriptionsFoundation extends foundation {
|
|
|
60870
60870
|
data,
|
|
60871
60871
|
children
|
|
60872
60872
|
} = 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
|
-
}
|
|
60873
|
+
const columns = this._adapter.getColumns();
|
|
60881
60874
|
const horizontalList = [];
|
|
60882
60875
|
const curSpan = {
|
|
60883
60876
|
totalSpan: 0,
|
|
@@ -60892,7 +60885,19 @@ class DescriptionsFoundation extends foundation {
|
|
|
60892
60885
|
curSpan.totalSpan = 0;
|
|
60893
60886
|
}
|
|
60894
60887
|
}
|
|
60895
|
-
if (curSpan.itemList.length != 0)
|
|
60888
|
+
if (curSpan.itemList.length != 0) {
|
|
60889
|
+
const lastSpan = curSpan.itemList[curSpan.itemList.length - 1];
|
|
60890
|
+
if (isNaN(lastSpan.span)) {
|
|
60891
|
+
let total = 0;
|
|
60892
|
+
curSpan.itemList.forEach(item => {
|
|
60893
|
+
return total += !isNaN(item.span) ? item.span : 1;
|
|
60894
|
+
});
|
|
60895
|
+
if (total < column) {
|
|
60896
|
+
lastSpan.span = column - total + 1;
|
|
60897
|
+
}
|
|
60898
|
+
}
|
|
60899
|
+
horizontalList.push(curSpan.itemList);
|
|
60900
|
+
}
|
|
60896
60901
|
return horizontalList;
|
|
60897
60902
|
}
|
|
60898
60903
|
}
|
|
@@ -60949,7 +60954,22 @@ class Descriptions extends BaseComponent {
|
|
|
60949
60954
|
this.foundation = new DescriptionsFoundation(this.adapter);
|
|
60950
60955
|
}
|
|
60951
60956
|
get adapter() {
|
|
60952
|
-
return Object.assign({}, super.adapter)
|
|
60957
|
+
return Object.assign(Object.assign({}, super.adapter), {
|
|
60958
|
+
getColumns: () => {
|
|
60959
|
+
var _a, _b;
|
|
60960
|
+
if ((_a = this.props.data) === null || _a === void 0 ? void 0 : _a.length) {
|
|
60961
|
+
return this.props.data;
|
|
60962
|
+
}
|
|
60963
|
+
if (this.props.children) {
|
|
60964
|
+
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 => {
|
|
60965
|
+
return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(item) ? Object.assign({
|
|
60966
|
+
value: item.props.children
|
|
60967
|
+
}, item.props) : [];
|
|
60968
|
+
});
|
|
60969
|
+
}
|
|
60970
|
+
return [];
|
|
60971
|
+
}
|
|
60972
|
+
});
|
|
60953
60973
|
}
|
|
60954
60974
|
render() {
|
|
60955
60975
|
const _a = this.props,
|
|
@@ -76981,16 +77001,42 @@ class SplitButtonGroup extends BaseComponent {
|
|
|
76981
77001
|
constructor() {
|
|
76982
77002
|
super(...arguments);
|
|
76983
77003
|
this.containerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
77004
|
+
this.mutationObserver = null;
|
|
76984
77005
|
}
|
|
76985
77006
|
componentDidMount() {
|
|
76986
|
-
|
|
77007
|
+
const addClassName = () => {
|
|
76987
77008
|
const buttons = this.containerRef.current.querySelectorAll('button');
|
|
76988
77009
|
const firstButton = buttons[0];
|
|
76989
77010
|
const lastButton = buttons[buttons.length - 1];
|
|
76990
|
-
firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.
|
|
76991
|
-
|
|
77011
|
+
if (!(firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.contains(`${splitButtonGroup_prefixCls}-first`))) {
|
|
77012
|
+
firstButton === null || firstButton === void 0 ? void 0 : firstButton.classList.add(`${splitButtonGroup_prefixCls}-first`);
|
|
77013
|
+
}
|
|
77014
|
+
if (!(lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.contains(`${splitButtonGroup_prefixCls}-last`))) {
|
|
77015
|
+
lastButton === null || lastButton === void 0 ? void 0 : lastButton.classList.add(`${splitButtonGroup_prefixCls}-last`);
|
|
77016
|
+
}
|
|
77017
|
+
};
|
|
77018
|
+
if (this.containerRef.current) {
|
|
77019
|
+
addClassName();
|
|
77020
|
+
const mutationObserver = new MutationObserver((mutations, observer) => {
|
|
77021
|
+
for (const mutation of mutations) {
|
|
77022
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'class' || mutation.type === 'childList' && Array.from(mutation.addedNodes).some(node => node.nodeName === 'BUTTON')) {
|
|
77023
|
+
addClassName();
|
|
77024
|
+
}
|
|
77025
|
+
}
|
|
77026
|
+
});
|
|
77027
|
+
mutationObserver.observe(this.containerRef.current, {
|
|
77028
|
+
attributes: true,
|
|
77029
|
+
childList: true,
|
|
77030
|
+
subtree: true
|
|
77031
|
+
});
|
|
77032
|
+
this.mutationObserver = mutationObserver;
|
|
76992
77033
|
}
|
|
76993
77034
|
}
|
|
77035
|
+
componentWillUnmount() {
|
|
77036
|
+
var _a;
|
|
77037
|
+
super.componentWillUnmount();
|
|
77038
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
77039
|
+
}
|
|
76994
77040
|
render() {
|
|
76995
77041
|
const {
|
|
76996
77042
|
children,
|
|
@@ -79425,7 +79471,7 @@ class TableFoundation extends foundation {
|
|
|
79425
79471
|
}
|
|
79426
79472
|
return true;
|
|
79427
79473
|
} else {
|
|
79428
|
-
const isAllSelected = allKeys.every(rowKey => selectedRowKeysSet.has(rowKey));
|
|
79474
|
+
const isAllSelected = allKeys.length && allKeys.every(rowKey => selectedRowKeysSet.has(rowKey));
|
|
79429
79475
|
return isAllSelected || false;
|
|
79430
79476
|
}
|
|
79431
79477
|
}
|