@douyinfe/semi-ui 2.25.0 → 2.25.2
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 +18 -11
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +216 -108
- 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/overflowList/index.d.ts +805 -6
- package/lib/cjs/overflowList/index.js +145 -60
- package/lib/cjs/select/index.js +7 -2
- package/lib/cjs/tag/index.js +2 -2
- package/lib/cjs/tagInput/index.js +5 -6
- package/lib/es/overflowList/index.d.ts +805 -6
- package/lib/es/overflowList/index.js +143 -62
- package/lib/es/select/index.js +7 -2
- package/lib/es/tag/index.js +2 -2
- package/lib/es/tagInput/index.js +5 -6
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -19114,7 +19114,7 @@ class foundation_Tooltip extends foundation {
|
|
|
19114
19114
|
}
|
|
19115
19115
|
|
|
19116
19116
|
if (shouldReverseLeftSide && widthIsBigger) {
|
|
19117
|
-
position = this._adjustPos(position
|
|
19117
|
+
position = this._adjustPos(position);
|
|
19118
19118
|
}
|
|
19119
19119
|
|
|
19120
19120
|
if (isWidthOverFlow && (isViewXEnoughSideHalf || isContainerXEnoughSideHalf)) {
|
|
@@ -41293,9 +41293,9 @@ class tag_Tag extends external_root_React_commonjs2_react_commonjs_react_amd_rea
|
|
|
41293
41293
|
})) : null;
|
|
41294
41294
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", Object.assign({
|
|
41295
41295
|
"aria-label": this.props['aria-label'] || isString_default()(children) ? "".concat(closable ? 'Closable ' : '', "Tag: ").concat(children) : ''
|
|
41296
|
-
}, wrapProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
41296
|
+
}, wrapProps), avatarSrc ? this.renderAvatar() : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
41297
41297
|
className: "".concat(tag_prefixCls, "-content")
|
|
41298
|
-
},
|
|
41298
|
+
}, children), closeIcon);
|
|
41299
41299
|
}
|
|
41300
41300
|
|
|
41301
41301
|
}
|
|
@@ -43555,16 +43555,14 @@ function sortableElement(WrappedComponent) {
|
|
|
43555
43555
|
|
|
43556
43556
|
|
|
43557
43557
|
|
|
43558
|
+
const tagInput_prefixCls = tagInput_constants_cssClasses.PREFIX;
|
|
43558
43559
|
const SortableItem = sortableElement(props => props.item);
|
|
43559
43560
|
const SortableList = sortableContainer(_ref => {
|
|
43560
43561
|
let {
|
|
43561
43562
|
items
|
|
43562
43563
|
} = _ref;
|
|
43563
43564
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
43564
|
-
|
|
43565
|
-
display: 'flex',
|
|
43566
|
-
flexFlow: 'row wrap'
|
|
43567
|
-
}
|
|
43565
|
+
className: "".concat(tagInput_prefixCls, "-sortable-list")
|
|
43568
43566
|
}, items.map((item, index) =>
|
|
43569
43567
|
/*#__PURE__*/
|
|
43570
43568
|
// @ts-ignore skip SortableItem type check
|
|
@@ -43574,7 +43572,6 @@ const SortableList = sortableContainer(_ref => {
|
|
|
43574
43572
|
item: item.item
|
|
43575
43573
|
})));
|
|
43576
43574
|
});
|
|
43577
|
-
const tagInput_prefixCls = tagInput_constants_cssClasses.PREFIX;
|
|
43578
43575
|
|
|
43579
43576
|
class tagInput_TagInput extends baseComponent_BaseComponent {
|
|
43580
43577
|
constructor(props) {
|
|
@@ -43680,13 +43677,15 @@ class tagInput_TagInput extends baseComponent_BaseComponent {
|
|
|
43680
43677
|
key: elementKey,
|
|
43681
43678
|
visible: true,
|
|
43682
43679
|
"aria-label": "".concat(!disabled ? 'Closable ' : '', "Tag: ").concat(value)
|
|
43680
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
43681
|
+
className: "".concat(tagInput_prefixCls, "-tag-content-wrapper")
|
|
43683
43682
|
}, showIconHandler && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(DragHandle, null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(paragraph_Paragraph, {
|
|
43684
43683
|
className: typoCls,
|
|
43685
43684
|
ellipsis: {
|
|
43686
43685
|
showTooltip: showContentTooltip,
|
|
43687
43686
|
rows: 1
|
|
43688
43687
|
}
|
|
43689
|
-
}, value));
|
|
43688
|
+
}, value)));
|
|
43690
43689
|
}
|
|
43691
43690
|
});
|
|
43692
43691
|
};
|
|
@@ -66974,7 +66973,9 @@ const overflowList_constants_strings = {
|
|
|
66974
66973
|
BOUNDARY_MAP,
|
|
66975
66974
|
OVERFLOW_DIR
|
|
66976
66975
|
};
|
|
66977
|
-
const overflowList_constants_numbers = {
|
|
66976
|
+
const overflowList_constants_numbers = {
|
|
66977
|
+
MINIMUM_HTML_ELEMENT_WIDTH: 4
|
|
66978
|
+
};
|
|
66978
66979
|
|
|
66979
66980
|
// EXTERNAL MODULE: /home/runner/work/semi-design/semi-design/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js
|
|
66980
66981
|
var ResizeObserver_es = __webpack_require__("LaGA");
|
|
@@ -67193,6 +67194,13 @@ class foundation_OverflowListFoundation extends foundation {
|
|
|
67193
67194
|
} = this.getProps();
|
|
67194
67195
|
return renderMode === 'scroll';
|
|
67195
67196
|
};
|
|
67197
|
+
|
|
67198
|
+
this.getReversedItems = () => {
|
|
67199
|
+
const {
|
|
67200
|
+
items
|
|
67201
|
+
} = this.getProps();
|
|
67202
|
+
return cloneDeep_default()(items).reverse();
|
|
67203
|
+
};
|
|
67196
67204
|
}
|
|
67197
67205
|
|
|
67198
67206
|
getOverflowItem() {
|
|
@@ -67261,54 +67269,68 @@ class foundation_OverflowListFoundation extends foundation {
|
|
|
67261
67269
|
this._adapter.notifyIntersect(res);
|
|
67262
67270
|
}
|
|
67263
67271
|
|
|
67264
|
-
|
|
67272
|
+
handleCollapseOverflow() {
|
|
67265
67273
|
const {
|
|
67266
|
-
|
|
67267
|
-
|
|
67268
|
-
|
|
67269
|
-
|
|
67274
|
+
minVisibleItems,
|
|
67275
|
+
collapseFrom
|
|
67276
|
+
} = this.getProps();
|
|
67277
|
+
const {
|
|
67278
|
+
overflowWidth,
|
|
67279
|
+
containerWidth,
|
|
67280
|
+
pivot: statePivot,
|
|
67281
|
+
overflowStatus
|
|
67270
67282
|
} = this.getStates();
|
|
67271
67283
|
const {
|
|
67272
|
-
|
|
67273
|
-
|
|
67274
|
-
items
|
|
67284
|
+
items,
|
|
67285
|
+
onOverflow
|
|
67275
67286
|
} = this.getProps();
|
|
67276
|
-
let
|
|
67287
|
+
let itemWidths = overflowWidth,
|
|
67288
|
+
_pivot = 0;
|
|
67289
|
+
let overflowed = false;
|
|
67277
67290
|
|
|
67278
|
-
|
|
67279
|
-
|
|
67280
|
-
direction: OverflowDirection.NONE
|
|
67281
|
-
};
|
|
67282
|
-
}
|
|
67291
|
+
for (const size of this._adapter.getItemSizeMap().values()) {
|
|
67292
|
+
itemWidths += size; // 触发overflow
|
|
67283
67293
|
|
|
67284
|
-
|
|
67285
|
-
|
|
67286
|
-
|
|
67287
|
-
|
|
67288
|
-
lastOverflowCount: updatedOverflowCount,
|
|
67289
|
-
overflow: [],
|
|
67290
|
-
visible: items
|
|
67291
|
-
};
|
|
67292
|
-
}
|
|
67294
|
+
if (itemWidths > containerWidth) {
|
|
67295
|
+
overflowed = true;
|
|
67296
|
+
break;
|
|
67297
|
+
} // 顺利遍历完整个列表,说明不存在overflow,直接渲染全部
|
|
67293
67298
|
|
|
67294
|
-
if (growing === OverflowDirection.SHRINK && visible.length > minVisibleItems) {
|
|
67295
|
-
const collapseFromStart = collapseFrom === Boundary.START;
|
|
67296
|
-
const newVisible = visible.slice();
|
|
67297
|
-
const next = collapseFromStart ? newVisible.shift() : newVisible.pop();
|
|
67298
67299
|
|
|
67299
|
-
if (
|
|
67300
|
-
|
|
67301
|
-
|
|
67302
|
-
|
|
67303
|
-
|
|
67304
|
-
|
|
67305
|
-
|
|
67306
|
-
|
|
67307
|
-
|
|
67300
|
+
if (_pivot === items.length - 1) {
|
|
67301
|
+
this._adapter.updateStates({
|
|
67302
|
+
overflowStatus: "normal",
|
|
67303
|
+
pivot: items.length - 1,
|
|
67304
|
+
visible: items,
|
|
67305
|
+
overflow: []
|
|
67306
|
+
});
|
|
67307
|
+
|
|
67308
|
+
break;
|
|
67308
67309
|
}
|
|
67310
|
+
|
|
67311
|
+
_pivot++;
|
|
67309
67312
|
}
|
|
67310
67313
|
|
|
67311
|
-
|
|
67314
|
+
if (overflowed) {
|
|
67315
|
+
const pivot = Math.max(minVisibleItems, _pivot);
|
|
67316
|
+
const isCollapseFromStart = collapseFrom === Boundary.START;
|
|
67317
|
+
const visible = isCollapseFromStart ? this.getReversedItems().slice(0, pivot).reverse() : items.slice(0, pivot);
|
|
67318
|
+
const overflow = isCollapseFromStart ? this.getReversedItems().slice(pivot).reverse() : items.slice(pivot);
|
|
67319
|
+
|
|
67320
|
+
this._adapter.updateStates({
|
|
67321
|
+
overflowStatus: "overflowed",
|
|
67322
|
+
pivot: pivot,
|
|
67323
|
+
visible,
|
|
67324
|
+
overflow
|
|
67325
|
+
}); // trigger onOverflow
|
|
67326
|
+
|
|
67327
|
+
|
|
67328
|
+
if (statePivot !== pivot) {
|
|
67329
|
+
onOverflow(overflow);
|
|
67330
|
+
}
|
|
67331
|
+
|
|
67332
|
+
return;
|
|
67333
|
+
}
|
|
67312
67334
|
}
|
|
67313
67335
|
|
|
67314
67336
|
}
|
|
@@ -67322,7 +67344,6 @@ var overflowList = __webpack_require__("O1Tx");
|
|
|
67322
67344
|
|
|
67323
67345
|
|
|
67324
67346
|
|
|
67325
|
-
|
|
67326
67347
|
/* eslint-disable arrow-body-style */
|
|
67327
67348
|
|
|
67328
67349
|
|
|
@@ -67356,26 +67377,15 @@ class overflowList_OverflowList extends baseComponent_BaseComponent {
|
|
|
67356
67377
|
|
|
67357
67378
|
this.resize = function () {
|
|
67358
67379
|
let entries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
67359
|
-
// if any parent is growing, assume we have more room than before
|
|
67360
|
-
const growing = entries.some(entry => {
|
|
67361
|
-
const previousWidth = _this.previousWidths.get(entry.target) || 0;
|
|
67362
|
-
return entry.contentRect.width > previousWidth;
|
|
67363
|
-
});
|
|
67364
|
-
|
|
67365
|
-
_this.repartition(growing);
|
|
67366
67380
|
|
|
67367
|
-
|
|
67368
|
-
};
|
|
67369
|
-
|
|
67370
|
-
this.repartition = growing => {
|
|
67371
|
-
// if not mounted or scroll mode, we do not
|
|
67372
|
-
if (isNull_default()(this.spacer) || isUndefined_default()(this.spacer) || this.isScrollMode()) {
|
|
67373
|
-
return;
|
|
67374
|
-
} // spacer has flex-shrink and width 1px so if it's much smaller then we know to shrink
|
|
67381
|
+
var _a;
|
|
67375
67382
|
|
|
67383
|
+
const containerWidth = (_a = entries[0]) === null || _a === void 0 ? void 0 : _a.target.clientWidth;
|
|
67376
67384
|
|
|
67377
|
-
|
|
67378
|
-
|
|
67385
|
+
_this.setState({
|
|
67386
|
+
containerWidth,
|
|
67387
|
+
overflowStatus: 'calculating'
|
|
67388
|
+
});
|
|
67379
67389
|
};
|
|
67380
67390
|
|
|
67381
67391
|
this.reintersect = entries => {
|
|
@@ -67397,6 +67407,18 @@ class overflowList_OverflowList extends baseComponent_BaseComponent {
|
|
|
67397
67407
|
return this.props.overflowRenderer(overflow);
|
|
67398
67408
|
};
|
|
67399
67409
|
|
|
67410
|
+
this.getItemKey = (item, defalutKey) => {
|
|
67411
|
+
const {
|
|
67412
|
+
itemKey
|
|
67413
|
+
} = this.props;
|
|
67414
|
+
|
|
67415
|
+
if (isFunction_default()(itemKey)) {
|
|
67416
|
+
return itemKey(item);
|
|
67417
|
+
}
|
|
67418
|
+
|
|
67419
|
+
return get_default()(item, itemKey || 'key', defalutKey);
|
|
67420
|
+
};
|
|
67421
|
+
|
|
67400
67422
|
this.renderItemList = () => {
|
|
67401
67423
|
const {
|
|
67402
67424
|
className,
|
|
@@ -67408,9 +67430,32 @@ class overflowList_OverflowList extends baseComponent_BaseComponent {
|
|
|
67408
67430
|
collapseFrom
|
|
67409
67431
|
} = this.props;
|
|
67410
67432
|
const {
|
|
67411
|
-
visible
|
|
67433
|
+
visible,
|
|
67434
|
+
overflowStatus
|
|
67412
67435
|
} = this.state;
|
|
67413
|
-
|
|
67436
|
+
let overflow = this.renderOverflow();
|
|
67437
|
+
|
|
67438
|
+
if (!this.isScrollMode()) {
|
|
67439
|
+
if (Array.isArray(overflow)) {
|
|
67440
|
+
overflow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Fragment, null, overflow);
|
|
67441
|
+
}
|
|
67442
|
+
|
|
67443
|
+
if ( /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.isValidElement(overflow)) {
|
|
67444
|
+
const child = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.cloneElement(overflow);
|
|
67445
|
+
overflow = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(resizeObserver_ReactResizeObserver, {
|
|
67446
|
+
onResize: _ref => {
|
|
67447
|
+
let [entry] = _ref;
|
|
67448
|
+
this.setState({
|
|
67449
|
+
overflowWidth: entry.target.clientWidth,
|
|
67450
|
+
overflowStatus: 'calculating'
|
|
67451
|
+
});
|
|
67452
|
+
}
|
|
67453
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
67454
|
+
className: "".concat(overflowList_prefixCls, "-overflow")
|
|
67455
|
+
}, child));
|
|
67456
|
+
}
|
|
67457
|
+
}
|
|
67458
|
+
|
|
67414
67459
|
const inner = renderMode === RenderMode.SCROLL ? [overflow[0], /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
67415
67460
|
className: classnames_default()(wrapperClassName, "".concat(overflowList_prefixCls, "-scroll-wrapper")),
|
|
67416
67461
|
ref: ref => {
|
|
@@ -67418,7 +67463,7 @@ class overflowList_OverflowList extends baseComponent_BaseComponent {
|
|
|
67418
67463
|
},
|
|
67419
67464
|
style: Object.assign({}, wrapperStyle),
|
|
67420
67465
|
key: "".concat(overflowList_prefixCls, "-scroll-wrapper")
|
|
67421
|
-
}, visible.map(visibleItemRenderer).map(
|
|
67466
|
+
}, visible.map(visibleItemRenderer).map(item => {
|
|
67422
67467
|
const {
|
|
67423
67468
|
forwardRef,
|
|
67424
67469
|
key
|
|
@@ -67428,24 +67473,71 @@ class overflowList_OverflowList extends baseComponent_BaseComponent {
|
|
|
67428
67473
|
'data-scrollkey': "".concat(key),
|
|
67429
67474
|
key
|
|
67430
67475
|
});
|
|
67431
|
-
})), overflow[1]] : [collapseFrom === overflowList_Boundary.START ? overflow : null, visible.map(
|
|
67432
|
-
|
|
67433
|
-
|
|
67434
|
-
|
|
67435
|
-
|
|
67476
|
+
})), overflow[1]] : [collapseFrom === overflowList_Boundary.START ? overflow : null, visible.map((item, idx) => {
|
|
67477
|
+
const {
|
|
67478
|
+
key
|
|
67479
|
+
} = item;
|
|
67480
|
+
const element = visibleItemRenderer(item, idx);
|
|
67481
|
+
const child = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.cloneElement(element);
|
|
67482
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(resizeObserver_ReactResizeObserver, {
|
|
67483
|
+
key: key,
|
|
67484
|
+
onResize: _ref2 => {
|
|
67485
|
+
let [entry] = _ref2;
|
|
67486
|
+
return this.onItemResize(entry, item, idx);
|
|
67487
|
+
}
|
|
67488
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
67489
|
+
key: key,
|
|
67490
|
+
className: "".concat(overflowList_prefixCls, "-item")
|
|
67491
|
+
}, child));
|
|
67492
|
+
}), collapseFrom === overflowList_Boundary.END ? overflow : null];
|
|
67436
67493
|
const list = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement('div', {
|
|
67437
67494
|
className: classnames_default()("".concat(overflowList_prefixCls), className),
|
|
67438
|
-
style
|
|
67495
|
+
style: Object.assign(Object.assign({}, style), renderMode === RenderMode.COLLAPSE ? {
|
|
67496
|
+
maxWidth: '100%',
|
|
67497
|
+
visibility: overflowStatus === "calculating" ? "hidden" : "visible"
|
|
67498
|
+
} : null)
|
|
67439
67499
|
}, ...inner);
|
|
67440
67500
|
return list;
|
|
67441
67501
|
};
|
|
67442
67502
|
|
|
67503
|
+
this.onItemResize = (entry, item, idx) => {
|
|
67504
|
+
const key = this.getItemKey(item, idx);
|
|
67505
|
+
const width = this.itemSizeMap.get(key);
|
|
67506
|
+
|
|
67507
|
+
if (!width) {
|
|
67508
|
+
this.itemSizeMap.set(key, entry.target.clientWidth);
|
|
67509
|
+
} else if (width !== entry.target.clientWidth) {
|
|
67510
|
+
// 某个item发生resize后,重新计算
|
|
67511
|
+
this.itemSizeMap.set(key, entry.target.clientWidth);
|
|
67512
|
+
this.setState({
|
|
67513
|
+
overflowStatus: 'calculating'
|
|
67514
|
+
});
|
|
67515
|
+
}
|
|
67516
|
+
|
|
67517
|
+
const {
|
|
67518
|
+
maxCount
|
|
67519
|
+
} = this.state; // 已经按照最大值maxCount渲染完毕,触发真正的渲染。(-1 是overflow部分会占1)
|
|
67520
|
+
// Already rendered maxCount items, trigger the real rendering. (-1 for the overflow part)
|
|
67521
|
+
|
|
67522
|
+
if (this.itemSizeMap.size === maxCount - 1) {
|
|
67523
|
+
this.setState({
|
|
67524
|
+
overflowStatus: 'calculating'
|
|
67525
|
+
});
|
|
67526
|
+
}
|
|
67527
|
+
};
|
|
67528
|
+
|
|
67443
67529
|
this.state = {
|
|
67444
67530
|
direction: overflowList_OverflowDirection.GROW,
|
|
67445
67531
|
lastOverflowCount: 0,
|
|
67446
67532
|
overflow: [],
|
|
67447
|
-
visible:
|
|
67448
|
-
|
|
67533
|
+
visible: [],
|
|
67534
|
+
containerWidth: 0,
|
|
67535
|
+
visibleState: new Map(),
|
|
67536
|
+
itemSizeMap: new Map(),
|
|
67537
|
+
overflowStatus: "calculating",
|
|
67538
|
+
pivot: 0,
|
|
67539
|
+
overflowWidth: 0,
|
|
67540
|
+
maxCount: 0
|
|
67449
67541
|
};
|
|
67450
67542
|
this.foundation = new overflowList_foundation(this.adapter);
|
|
67451
67543
|
this.previousWidths = new Map();
|
|
@@ -67468,8 +67560,18 @@ class overflowList_OverflowList extends baseComponent_BaseComponent {
|
|
|
67468
67560
|
// reset visible state if the above props change.
|
|
67469
67561
|
newState.direction = overflowList_OverflowDirection.GROW;
|
|
67470
67562
|
newState.lastOverflowCount = 0;
|
|
67471
|
-
|
|
67472
|
-
|
|
67563
|
+
|
|
67564
|
+
if (props.renderMode === RenderMode.SCROLL) {
|
|
67565
|
+
newState.visible = props.items;
|
|
67566
|
+
newState.overflow = [];
|
|
67567
|
+
} else {
|
|
67568
|
+
newState.visible = [];
|
|
67569
|
+
newState.overflow = [];
|
|
67570
|
+
}
|
|
67571
|
+
|
|
67572
|
+
newState.pivot = 0;
|
|
67573
|
+
newState.maxCount = 0;
|
|
67574
|
+
newState.overflowStatus = "calculating";
|
|
67473
67575
|
}
|
|
67474
67576
|
|
|
67475
67577
|
return newState;
|
|
@@ -67487,45 +67589,45 @@ class overflowList_OverflowList extends baseComponent_BaseComponent {
|
|
|
67487
67589
|
},
|
|
67488
67590
|
notifyIntersect: res => {
|
|
67489
67591
|
this.props.onIntersect && this.props.onIntersect(res);
|
|
67490
|
-
}
|
|
67592
|
+
},
|
|
67593
|
+
getItemSizeMap: () => this.itemSizeMap
|
|
67491
67594
|
});
|
|
67492
67595
|
}
|
|
67493
67596
|
|
|
67494
|
-
componentDidMount() {
|
|
67495
|
-
this.repartition(false);
|
|
67496
|
-
}
|
|
67497
|
-
|
|
67498
|
-
shouldComponentUpdate(_nextProps, nextState) {
|
|
67499
|
-
// We want this component to always re-render, even when props haven't changed, so that
|
|
67500
|
-
// changes in the renderers' behavior can be reflected.
|
|
67501
|
-
// The following statement prevents re-rendering only in the case where the state changes
|
|
67502
|
-
// identity (i.e. setState was called), but the state is still the same when
|
|
67503
|
-
// shallow-compared to the previous state.
|
|
67504
|
-
const currState = omit_default()(this.state, 'prevProps');
|
|
67505
|
-
|
|
67506
|
-
const comingState = omit_default()(nextState, 'prevProps');
|
|
67507
|
-
|
|
67508
|
-
return !(currState !== comingState && isEqual_default()(currState, comingState));
|
|
67509
|
-
}
|
|
67510
|
-
|
|
67511
67597
|
componentDidUpdate(prevProps, prevState) {
|
|
67512
67598
|
if (!isEqual_default()(prevProps.items, this.props.items)) {
|
|
67513
67599
|
this.itemRefs = {};
|
|
67514
67600
|
}
|
|
67515
67601
|
|
|
67516
|
-
if (!isEqual_default()(omit_default()(prevState, 'prevProps'), omit_default()(this.state, 'prevProps'))) {
|
|
67517
|
-
this.repartition(false);
|
|
67518
|
-
}
|
|
67519
|
-
|
|
67520
67602
|
const {
|
|
67521
|
-
direction,
|
|
67522
67603
|
overflow,
|
|
67523
|
-
|
|
67604
|
+
containerWidth,
|
|
67605
|
+
visible,
|
|
67606
|
+
overflowStatus
|
|
67524
67607
|
} = this.state;
|
|
67525
67608
|
|
|
67526
|
-
if (
|
|
67527
|
-
|
|
67528
|
-
|
|
67609
|
+
if (this.isScrollMode() || overflowStatus !== "calculating") {
|
|
67610
|
+
return;
|
|
67611
|
+
}
|
|
67612
|
+
|
|
67613
|
+
if (visible.length === 0 && overflow.length === 0 && this.props.items.length !== 0) {
|
|
67614
|
+
// 推测container最多能渲染的数量
|
|
67615
|
+
// Figure out the maximum number of items in this container
|
|
67616
|
+
const maxCount = Math.min(this.props.items.length, Math.floor(containerWidth / overflowList_constants_numbers.MINIMUM_HTML_ELEMENT_WIDTH)); // 如果collapseFrom是start, 第一次用来计算容量时,倒转列表顺序渲染
|
|
67617
|
+
// If collapseFrom === start, render item from end to start. Figuring out how many items in the end could fit in container.
|
|
67618
|
+
|
|
67619
|
+
const isCollapseFromStart = this.props.collapseFrom === overflowList_Boundary.START;
|
|
67620
|
+
const visible = isCollapseFromStart ? this.foundation.getReversedItems().slice(0, maxCount) : this.props.items.slice(0, maxCount);
|
|
67621
|
+
const overflow = isCollapseFromStart ? this.foundation.getReversedItems().slice(maxCount) : this.props.items.slice(maxCount);
|
|
67622
|
+
this.setState({
|
|
67623
|
+
overflowStatus: 'calculating',
|
|
67624
|
+
visible,
|
|
67625
|
+
overflow,
|
|
67626
|
+
maxCount: maxCount
|
|
67627
|
+
});
|
|
67628
|
+
this.itemSizeMap.clear();
|
|
67629
|
+
} else {
|
|
67630
|
+
this.foundation.handleCollapseOverflow();
|
|
67529
67631
|
}
|
|
67530
67632
|
}
|
|
67531
67633
|
|
|
@@ -67557,7 +67659,8 @@ overflowList_OverflowList.defaultProps = {
|
|
|
67557
67659
|
overflowRenderer: () => null,
|
|
67558
67660
|
renderMode: 'collapse',
|
|
67559
67661
|
threshold: 0.75,
|
|
67560
|
-
visibleItemRenderer: () => null
|
|
67662
|
+
visibleItemRenderer: () => null,
|
|
67663
|
+
onOverflow: () => null
|
|
67561
67664
|
};
|
|
67562
67665
|
overflowList_OverflowList.propTypes = {
|
|
67563
67666
|
// if render in scroll mode, key is required in items
|
|
@@ -72536,7 +72639,8 @@ class select_Select extends baseComponent_BaseComponent {
|
|
|
72536
72639
|
innerBottomSlot,
|
|
72537
72640
|
loading,
|
|
72538
72641
|
virtualize,
|
|
72539
|
-
multiple
|
|
72642
|
+
multiple,
|
|
72643
|
+
emptyContent
|
|
72540
72644
|
} = this.props; // Do a filter first, instead of directly judging in forEach, so that the focusIndex can correspond to
|
|
72541
72645
|
|
|
72542
72646
|
const visibleOptions = options.filter(item => item._show);
|
|
@@ -72559,7 +72663,11 @@ class select_Select extends baseComponent_BaseComponent {
|
|
|
72559
72663
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
72560
72664
|
external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
72561
72665
|
id: "".concat(select_prefixcls, "-").concat(this.selectOptionListID),
|
|
72562
|
-
className: classnames_default()(
|
|
72666
|
+
className: classnames_default()({
|
|
72667
|
+
// When emptyContent is null and the option is empty, there is no need for the drop-down option for the user,
|
|
72668
|
+
// so there is no need to set padding through this className
|
|
72669
|
+
["".concat(select_prefixcls, "-option-list-wrapper")]: !(isEmpty && emptyContent === null)
|
|
72670
|
+
}, dropdownClassName),
|
|
72563
72671
|
style: style,
|
|
72564
72672
|
ref: this.setOptionContainerEl,
|
|
72565
72673
|
onKeyDown: e => this.foundation.handleContainerKeyDown(e)
|