@douyinfe/semi-ui 2.0.9-alpha.4 → 2.1.0-alpha.3
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 +14 -1
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +1625 -2525
- 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/es/_base/baseComponent.js +1 -5
- package/lib/es/_portal/index.js +7 -17
- package/lib/es/_utils/index.js +13 -16
- package/lib/es/breadcrumb/index.js +2 -4
- package/lib/es/breadcrumb/item.js +4 -6
- package/lib/es/button/index.d.ts +0 -1
- package/lib/es/button/index.js +2 -4
- package/lib/es/calendar/monthCalendar.js +9 -11
- package/lib/es/cascader/index.d.ts +1 -0
- package/lib/es/cascader/index.js +23 -14
- package/lib/es/cascader/item.js +1 -2
- package/lib/es/collapse/item.js +1 -2
- package/lib/es/collapsible/index.js +9 -9
- package/lib/es/datePicker/dateInput.js +9 -29
- package/lib/es/datePicker/datePicker.js +12 -49
- package/lib/es/datePicker/footer.js +1 -2
- package/lib/es/datePicker/index.js +12 -15
- package/lib/es/datePicker/yearAndMonth.js +17 -23
- package/lib/es/dropdown/dropdownDivider.js +1 -2
- package/lib/es/form/baseForm.d.ts +4 -10
- package/lib/es/form/field.d.ts +4 -22
- package/lib/es/form/field.js +2 -18
- package/lib/es/form/hoc/withField.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +3 -14
- package/lib/es/iconButton/index.d.ts +0 -1
- package/lib/es/iconButton/index.js +0 -1
- package/lib/es/inputNumber/index.js +4 -12
- package/lib/es/locale/localeConsumer.js +3 -6
- package/lib/es/modal/ConfirmModal.js +2 -2
- package/lib/es/modal/confirm.js +2 -2
- package/lib/es/modal/useModal/HookModal.js +2 -2
- package/lib/es/motions/Rotate.js +4 -6
- package/lib/es/navigation/CollapseButton.js +7 -9
- package/lib/es/navigation/Item.js +7 -33
- package/lib/es/navigation/OpenIconTransition.js +4 -6
- package/lib/es/navigation/SubNav.js +6 -33
- package/lib/es/navigation/SubNavTransition.js +5 -7
- package/lib/es/navigation/index.js +6 -24
- package/lib/es/notification/NoticeTransition.js +5 -7
- package/lib/es/notification/index.js +8 -16
- package/lib/es/notification/useNotification/index.js +7 -11
- package/lib/es/overflowList/index.js +4 -9
- package/lib/es/overflowList/intersectionObserver.js +1 -2
- package/lib/es/popconfirm/index.d.ts +5 -1
- package/lib/es/popconfirm/index.js +10 -4
- package/lib/es/popover/Arrow.js +1 -3
- package/lib/es/popover/index.d.ts +3 -1
- package/lib/es/popover/index.js +4 -8
- package/lib/es/radio/context.d.ts +1 -1
- package/lib/es/radio/radio.d.ts +2 -2
- package/lib/es/radio/radioGroup.d.ts +4 -4
- package/lib/es/resizeObserver/index.js +1 -2
- package/lib/es/scrollList/scrollItem.js +24 -40
- package/lib/es/select/index.js +19 -16
- package/lib/es/select/option.js +8 -10
- package/lib/es/select/utils.d.ts +1 -1
- package/lib/es/select/utils.js +10 -4
- package/lib/es/select/virtualRow.js +5 -6
- package/lib/es/sideSheet/SideSheetTransition.js +1 -3
- package/lib/es/slider/index.js +11 -23
- package/lib/es/spin/icon.js +1 -3
- package/lib/es/table/Body/BaseRow.js +8 -16
- package/lib/es/table/Body/SectionRow.js +3 -6
- package/lib/es/table/Body/index.js +32 -49
- package/lib/es/table/Column.js +1 -2
- package/lib/es/table/ColumnFilter.js +2 -6
- package/lib/es/table/ColumnSelection.js +1 -5
- package/lib/es/table/HeadTable.js +3 -4
- package/lib/es/table/ResizableTable.js +20 -31
- package/lib/es/table/Table.js +63 -160
- package/lib/es/table/TableCell.js +3 -5
- package/lib/es/table/TableContextProvider.js +15 -16
- package/lib/es/table/TableHeader.js +1 -4
- package/lib/es/table/utils.js +1 -3
- package/lib/es/tabs/TabBar.d.ts +4 -2
- package/lib/es/tabs/TabBar.js +12 -4
- package/lib/es/tabs/TabPane.d.ts +2 -1
- package/lib/es/tabs/TabPane.js +3 -2
- package/lib/es/tabs/TabPaneTransition.js +9 -12
- package/lib/es/tabs/index.d.ts +3 -1
- package/lib/es/tabs/index.js +83 -14
- package/lib/es/tabs/interface.d.ts +6 -1
- package/lib/es/tagInput/index.d.ts +3 -0
- package/lib/es/tagInput/index.js +6 -1
- package/lib/es/timePicker/Combobox.js +5 -6
- package/lib/es/timePicker/TimeInput.js +3 -11
- package/lib/es/timePicker/TimePicker.js +7 -21
- package/lib/es/timePicker/index.js +12 -15
- package/lib/es/toast/ToastTransition.js +8 -12
- package/lib/es/toast/useToast/index.js +3 -6
- package/lib/es/tooltip/TooltipStyledTransition.js +10 -14
- package/lib/es/tooltip/index.d.ts +3 -0
- package/lib/es/tooltip/index.js +22 -28
- package/lib/es/transfer/index.js +15 -18
- package/lib/es/tree/index.js +28 -38
- package/lib/es/tree/interface.d.ts +2 -2
- package/lib/es/treeSelect/index.d.ts +2 -11
- package/lib/es/treeSelect/index.js +32 -44
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/typography/util.js +3 -12
- package/lib/es/upload/fileCard.js +53 -62
- package/lib/es/upload/index.d.ts +1 -1
- package/lib/es/upload/index.js +23 -32
- package/package.json +8 -8
package/lib/es/select/utils.js
CHANGED
|
@@ -20,7 +20,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
20
20
|
import React from 'react';
|
|
21
21
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
22
22
|
|
|
23
|
-
const generateOption = (child, parent) => {
|
|
23
|
+
const generateOption = (child, parent, index) => {
|
|
24
24
|
const childProps = child.props;
|
|
25
25
|
|
|
26
26
|
if (!child || !childProps) {
|
|
@@ -32,7 +32,8 @@ const generateOption = (child, parent) => {
|
|
|
32
32
|
// Drop-down menu rendering priority label value, children, value in turn downgrade
|
|
33
33
|
label: childProps.label || childProps.children || childProps.value,
|
|
34
34
|
_show: true,
|
|
35
|
-
_selected: false
|
|
35
|
+
_selected: false,
|
|
36
|
+
_scrollIndex: index
|
|
36
37
|
}, childProps), {
|
|
37
38
|
_parentGroup: parent
|
|
38
39
|
});
|
|
@@ -53,11 +54,13 @@ const getOptionsFromGroup = selectChildren => {
|
|
|
53
54
|
let childNodes = React.Children.toArray(selectChildren);
|
|
54
55
|
childNodes = _filterInstanceProperty(childNodes).call(childNodes, childNode => childNode && childNode.props);
|
|
55
56
|
let type = '';
|
|
57
|
+
let optionIndex = -1;
|
|
56
58
|
|
|
57
59
|
_forEachInstanceProperty(childNodes).call(childNodes, child => {
|
|
58
60
|
if (child.type.isSelectOption) {
|
|
59
61
|
type = 'option';
|
|
60
|
-
|
|
62
|
+
optionIndex++;
|
|
63
|
+
const option = generateOption(child, undefined, optionIndex);
|
|
61
64
|
emptyGroup.children.push(option);
|
|
62
65
|
options.push(option);
|
|
63
66
|
} else if (child.type.isSelectOptionGroup) {
|
|
@@ -72,7 +75,10 @@ const getOptionsFromGroup = selectChildren => {
|
|
|
72
75
|
|
|
73
76
|
children = React.Children.toArray(children);
|
|
74
77
|
|
|
75
|
-
const childrenOption = _mapInstanceProperty(children).call(children, option =>
|
|
78
|
+
const childrenOption = _mapInstanceProperty(children).call(children, option => {
|
|
79
|
+
optionIndex++;
|
|
80
|
+
return generateOption(option, restGroupProps, optionIndex);
|
|
81
|
+
});
|
|
76
82
|
|
|
77
83
|
const group = _Object$assign(_Object$assign({}, child.props), {
|
|
78
84
|
children: childrenOption,
|
|
@@ -3,9 +3,7 @@ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign"
|
|
|
3
3
|
import { Transition } from '@douyinfe/semi-animation-react';
|
|
4
4
|
import React from 'react'; // eslint-disable-next-line max-len
|
|
5
5
|
|
|
6
|
-
const formatStyles = function formatStyles() {
|
|
7
|
-
let styles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8
|
-
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6
|
+
const formatStyles = function formatStyles(styles = {}, props = {}) {
|
|
9
7
|
const {
|
|
10
8
|
placement
|
|
11
9
|
} = props;
|
package/lib/es/slider/index.js
CHANGED
|
@@ -292,8 +292,6 @@ export default class Slider extends BaseComponent {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
get adapter() {
|
|
295
|
-
var _this = this;
|
|
296
|
-
|
|
297
295
|
return _Object$assign(_Object$assign({}, super.adapter), {
|
|
298
296
|
getSliderLengths: () => {
|
|
299
297
|
if (this.sliderEl && this.sliderEl.current) {
|
|
@@ -362,8 +360,7 @@ export default class Slider extends BaseComponent {
|
|
|
362
360
|
});
|
|
363
361
|
},
|
|
364
362
|
|
|
365
|
-
transNewPropsToState(stateObj) {
|
|
366
|
-
let callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
363
|
+
transNewPropsToState(stateObj, callback = noop) {
|
|
367
364
|
this.setState(stateObj, callback);
|
|
368
365
|
},
|
|
369
366
|
|
|
@@ -397,11 +394,8 @@ export default class Slider extends BaseComponent {
|
|
|
397
394
|
|
|
398
395
|
this._addEventListener(document.body, 'touchmove', this.foundation.onHandleTouchMove, false);
|
|
399
396
|
},
|
|
400
|
-
onHandleMove:
|
|
401
|
-
|
|
402
|
-
let clickTrack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
403
|
-
|
|
404
|
-
const sliderDOMIsInRenderTree = _this.foundation.checkAndUpdateIsInRenderTreeState();
|
|
397
|
+
onHandleMove: (mousePos, isMin, stateChangeCallback = noop, clickTrack = false) => {
|
|
398
|
+
const sliderDOMIsInRenderTree = this.foundation.checkAndUpdateIsInRenderTreeState();
|
|
405
399
|
|
|
406
400
|
if (!sliderDOMIsInRenderTree) {
|
|
407
401
|
return;
|
|
@@ -410,29 +404,27 @@ export default class Slider extends BaseComponent {
|
|
|
410
404
|
const {
|
|
411
405
|
value,
|
|
412
406
|
onChange
|
|
413
|
-
} =
|
|
414
|
-
|
|
415
|
-
const moveValue = _this.foundation.transPosToValue(mousePos, isMin);
|
|
407
|
+
} = this.props;
|
|
408
|
+
const moveValue = this.foundation.transPosToValue(mousePos, isMin);
|
|
416
409
|
|
|
417
410
|
if (moveValue === false) {
|
|
418
411
|
return;
|
|
419
412
|
}
|
|
420
413
|
|
|
421
|
-
const outPutValue =
|
|
422
|
-
|
|
414
|
+
const outPutValue = this.foundation.outPutValue(moveValue);
|
|
423
415
|
const {
|
|
424
416
|
currentValue
|
|
425
|
-
} =
|
|
417
|
+
} = this.state;
|
|
426
418
|
|
|
427
|
-
if (!isEqual(
|
|
419
|
+
if (!isEqual(this.foundation.outPutValue(currentValue), outPutValue)) {
|
|
428
420
|
onChange(outPutValue);
|
|
429
421
|
|
|
430
|
-
if (!clickTrack &&
|
|
422
|
+
if (!clickTrack && this.foundation.valueFormatIsCorrect(value)) {
|
|
431
423
|
// still require afterChangeCallback when click on the track directly, need skip here
|
|
432
424
|
return false;
|
|
433
425
|
}
|
|
434
426
|
|
|
435
|
-
|
|
427
|
+
this.setState({
|
|
436
428
|
currentValue: outPutValue
|
|
437
429
|
}, stateChangeCallback);
|
|
438
430
|
}
|
|
@@ -551,12 +543,8 @@ export default class Slider extends BaseComponent {
|
|
|
551
543
|
return slider;
|
|
552
544
|
}
|
|
553
545
|
|
|
554
|
-
_addEventListener(target, eventName, callback) {
|
|
546
|
+
_addEventListener(target, eventName, callback, ...rests) {
|
|
555
547
|
if (target.addEventListener) {
|
|
556
|
-
for (var _len = arguments.length, rests = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
557
|
-
rests[_key - 3] = arguments[_key];
|
|
558
|
-
}
|
|
559
|
-
|
|
560
548
|
target.addEventListener(eventName, callback, ...rests);
|
|
561
549
|
|
|
562
550
|
const clearSelf = () => {
|
package/lib/es/spin/icon.js
CHANGED
|
@@ -20,9 +20,7 @@ import isNullOrUndefined from '@douyinfe/semi-foundation/lib/es/utils/isNullOrUn
|
|
|
20
20
|
|
|
21
21
|
let _id = -1;
|
|
22
22
|
|
|
23
|
-
function Icon() {
|
|
24
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
25
|
-
|
|
23
|
+
function Icon(props = {}) {
|
|
26
24
|
const {
|
|
27
25
|
id: propsId,
|
|
28
26
|
className
|
|
@@ -75,24 +75,16 @@ export default class TableRow extends BaseComponent {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
get adapter() {
|
|
78
|
-
var _this = this;
|
|
79
|
-
|
|
80
78
|
return _Object$assign(_Object$assign({}, super.adapter), {
|
|
81
|
-
notifyClick:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
notifyClick: (...args) => this.props.onRowClick(...args),
|
|
80
|
+
notifyDoubleClick: (...args) => this.props.onRowDoubleClick(...args),
|
|
81
|
+
notifyMouseLeave: (...args) => {
|
|
82
|
+
this.props.onHover(false, this.props.rowKey);
|
|
83
|
+
this.props.onRowMouseEnter(...args);
|
|
86
84
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
_this.props.onRowMouseEnter(...arguments);
|
|
91
|
-
},
|
|
92
|
-
notifyMouseEnter: function () {
|
|
93
|
-
_this.props.onHover(true, _this.props.rowKey);
|
|
94
|
-
|
|
95
|
-
_this.props.onRowMouseEnter(...arguments);
|
|
85
|
+
notifyMouseEnter: (...args) => {
|
|
86
|
+
this.props.onHover(true, this.props.rowKey);
|
|
87
|
+
this.props.onRowMouseEnter(...args);
|
|
96
88
|
}
|
|
97
89
|
});
|
|
98
90
|
}
|
|
@@ -36,23 +36,20 @@ import TableContext from '../table-context';
|
|
|
36
36
|
|
|
37
37
|
class SectionRow extends PureComponent {
|
|
38
38
|
constructor() {
|
|
39
|
-
var _this;
|
|
40
|
-
|
|
41
39
|
super(...arguments);
|
|
42
|
-
_this = this;
|
|
43
40
|
|
|
44
|
-
this.onRow =
|
|
41
|
+
this.onRow = (...args) => {
|
|
45
42
|
const {
|
|
46
43
|
onGroupedRow,
|
|
47
44
|
clickGroupedRowToExpand,
|
|
48
45
|
onExpand,
|
|
49
46
|
groupKey,
|
|
50
47
|
expanded
|
|
51
|
-
} =
|
|
48
|
+
} = this.props;
|
|
52
49
|
const rowProps = {};
|
|
53
50
|
|
|
54
51
|
if (typeof onGroupedRow === 'function') {
|
|
55
|
-
_Object$assign(rowProps, onGroupedRow(...
|
|
52
|
+
_Object$assign(rowProps, onGroupedRow(...args));
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
return _Object$assign(_Object$assign({}, rowProps), {
|
|
@@ -46,10 +46,7 @@ import TableContext from '../table-context';
|
|
|
46
46
|
|
|
47
47
|
class Body extends BaseComponent {
|
|
48
48
|
constructor(props, context) {
|
|
49
|
-
var _this;
|
|
50
|
-
|
|
51
49
|
super(props);
|
|
52
|
-
_this = this;
|
|
53
50
|
|
|
54
51
|
this.forwardRef = node => {
|
|
55
52
|
const {
|
|
@@ -101,9 +98,8 @@ class Body extends BaseComponent {
|
|
|
101
98
|
handleRowExpanded(!expand, rowKey, e);
|
|
102
99
|
};
|
|
103
100
|
|
|
104
|
-
this.handleVirtualizedScroll =
|
|
105
|
-
|
|
106
|
-
const onScroll = get(_this.props.virtualized, 'onScroll');
|
|
101
|
+
this.handleVirtualizedScroll = (props = {}) => {
|
|
102
|
+
const onScroll = get(this.props.virtualized, 'onScroll');
|
|
107
103
|
|
|
108
104
|
if (typeof onScroll === 'function') {
|
|
109
105
|
onScroll(props);
|
|
@@ -187,21 +183,17 @@ class Body extends BaseComponent {
|
|
|
187
183
|
}; // virtualized List innerElementType
|
|
188
184
|
|
|
189
185
|
|
|
190
|
-
this.renderTbody = /*#__PURE__*/React.forwardRef(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
style: _Object$assign({}, props.style),
|
|
202
|
-
ref: ref
|
|
203
|
-
}));
|
|
204
|
-
}); // virtualized List outerElementType
|
|
186
|
+
this.renderTbody = /*#__PURE__*/React.forwardRef((props = {}, ref) => /*#__PURE__*/React.createElement("div", _Object$assign({}, props, {
|
|
187
|
+
onScroll: (...args) => {
|
|
188
|
+
if (props.onScroll) {
|
|
189
|
+
props.onScroll(...args);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
// eslint-disable-next-line react/no-this-in-sfc,react/destructuring-assignment
|
|
193
|
+
className: classnames(props.className, "".concat(this.props.prefixCls, "-tbody")),
|
|
194
|
+
style: _Object$assign({}, props.style),
|
|
195
|
+
ref: ref
|
|
196
|
+
}))); // virtualized List outerElementType
|
|
205
197
|
|
|
206
198
|
this.renderOuter = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
207
199
|
const {
|
|
@@ -221,21 +213,21 @@ class Body extends BaseComponent {
|
|
|
221
213
|
const tableCls = classnames("".concat(prefixCls), "".concat(prefixCls, "-fixed"));
|
|
222
214
|
return /*#__PURE__*/React.createElement("div", _Object$assign({}, rest, {
|
|
223
215
|
ref: ref,
|
|
224
|
-
onWheel:
|
|
216
|
+
onWheel: (...args) => {
|
|
225
217
|
if (handleWheel) {
|
|
226
|
-
handleWheel(...
|
|
218
|
+
handleWheel(...args);
|
|
227
219
|
}
|
|
228
220
|
|
|
229
221
|
if (rest.onWheel) {
|
|
230
|
-
rest.onWheel(...
|
|
222
|
+
rest.onWheel(...args);
|
|
231
223
|
}
|
|
232
224
|
},
|
|
233
|
-
onScroll:
|
|
225
|
+
onScroll: (...args) => {
|
|
234
226
|
// eslint-disable-next-line react/no-this-in-sfc
|
|
235
|
-
|
|
227
|
+
this.handleVirtualizedBodyScroll(...args);
|
|
236
228
|
|
|
237
229
|
if (rest.onScroll) {
|
|
238
|
-
rest.onScroll(...
|
|
230
|
+
rest.onScroll(...args);
|
|
239
231
|
}
|
|
240
232
|
}
|
|
241
233
|
}), /*#__PURE__*/React.createElement("div", {
|
|
@@ -314,12 +306,11 @@ class Body extends BaseComponent {
|
|
|
314
306
|
*/
|
|
315
307
|
|
|
316
308
|
|
|
317
|
-
this.renderSectionRow =
|
|
309
|
+
this.renderSectionRow = (props = {
|
|
310
|
+
groupKey: undefined
|
|
311
|
+
}) => {
|
|
318
312
|
var _context;
|
|
319
313
|
|
|
320
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
321
|
-
groupKey: undefined
|
|
322
|
-
};
|
|
323
314
|
const {
|
|
324
315
|
dataSource,
|
|
325
316
|
rowKey,
|
|
@@ -333,7 +324,7 @@ class Body extends BaseComponent {
|
|
|
333
324
|
const sectionRowProps = pick(props, sectionRowPickKeys);
|
|
334
325
|
const {
|
|
335
326
|
handleRowExpanded
|
|
336
|
-
} =
|
|
327
|
+
} = this.context;
|
|
337
328
|
return /*#__PURE__*/React.createElement(SectionRow, _Object$assign({}, sectionRowProps, {
|
|
338
329
|
record: {
|
|
339
330
|
groupKey,
|
|
@@ -346,10 +337,9 @@ class Body extends BaseComponent {
|
|
|
346
337
|
}));
|
|
347
338
|
};
|
|
348
339
|
|
|
349
|
-
this.renderExpandedRow =
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
};
|
|
340
|
+
this.renderExpandedRow = (props = {
|
|
341
|
+
renderExpandIcon: () => null
|
|
342
|
+
}) => {
|
|
353
343
|
const {
|
|
354
344
|
style,
|
|
355
345
|
components,
|
|
@@ -371,7 +361,7 @@ class Body extends BaseComponent {
|
|
|
371
361
|
const {
|
|
372
362
|
flattenedColumns,
|
|
373
363
|
getCellWidths
|
|
374
|
-
} =
|
|
364
|
+
} = this.context;
|
|
375
365
|
const cellWidths = getCellWidths(flattenedColumns);
|
|
376
366
|
return /*#__PURE__*/React.createElement(ExpandedRow, {
|
|
377
367
|
style: style,
|
|
@@ -659,8 +649,7 @@ class Body extends BaseComponent {
|
|
|
659
649
|
*/
|
|
660
650
|
|
|
661
651
|
|
|
662
|
-
renderBaseRow() {
|
|
663
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
652
|
+
renderBaseRow(props = {}) {
|
|
664
653
|
const {
|
|
665
654
|
rowKey,
|
|
666
655
|
columns,
|
|
@@ -716,10 +705,7 @@ class Body extends BaseComponent {
|
|
|
716
705
|
}));
|
|
717
706
|
}
|
|
718
707
|
|
|
719
|
-
renderBodyRows() {
|
|
720
|
-
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
721
|
-
let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
722
|
-
let renderedRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
708
|
+
renderBodyRows(data = [], level = 0, renderedRows = []) {
|
|
723
709
|
const {
|
|
724
710
|
rowKey,
|
|
725
711
|
expandedRowRender,
|
|
@@ -783,12 +769,9 @@ class Body extends BaseComponent {
|
|
|
783
769
|
const {
|
|
784
770
|
virtualized
|
|
785
771
|
} = this.props;
|
|
786
|
-
return /*#__PURE__*/React.createElement(ConfigContext.Consumer, null,
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
} = _ref;
|
|
790
|
-
return virtualized ? this.renderVirtualizedBody(direction) : this.renderBody(direction);
|
|
791
|
-
});
|
|
772
|
+
return /*#__PURE__*/React.createElement(ConfigContext.Consumer, null, ({
|
|
773
|
+
direction
|
|
774
|
+
}) => virtualized ? this.renderVirtualizedBody(direction) : this.renderBody(direction));
|
|
792
775
|
}
|
|
793
776
|
|
|
794
777
|
}
|
package/lib/es/table/Column.js
CHANGED
|
@@ -2,8 +2,7 @@ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign"
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import ColumnShape from './ColumnShape';
|
|
4
4
|
export default class Column extends React.PureComponent {
|
|
5
|
-
constructor() {
|
|
6
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
5
|
+
constructor(props = {}) {
|
|
7
6
|
super(props);
|
|
8
7
|
}
|
|
9
8
|
|
|
@@ -18,10 +18,7 @@ import Dropdown from '../dropdown';
|
|
|
18
18
|
import { Radio } from '../radio';
|
|
19
19
|
import { Checkbox } from '../checkbox';
|
|
20
20
|
|
|
21
|
-
function renderDropdown() {
|
|
22
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
|
-
let nestedElem = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
24
|
-
let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
21
|
+
function renderDropdown(props = {}, nestedElem = null, level = 0) {
|
|
25
22
|
const {
|
|
26
23
|
filterMultiple = true,
|
|
27
24
|
filters = [],
|
|
@@ -129,8 +126,7 @@ function renderDropdown() {
|
|
|
129
126
|
}), nestedElem);
|
|
130
127
|
}
|
|
131
128
|
|
|
132
|
-
export default function ColumnFilter() {
|
|
133
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
129
|
+
export default function ColumnFilter(props = {}) {
|
|
134
130
|
const {
|
|
135
131
|
prefixCls = cssClasses.PREFIX,
|
|
136
132
|
filteredValue,
|
|
@@ -23,12 +23,8 @@ export default class TableSelectionCell extends BaseComponent {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
get adapter() {
|
|
26
|
-
var _this = this;
|
|
27
|
-
|
|
28
26
|
return _Object$assign(_Object$assign({}, super.adapter), {
|
|
29
|
-
notifyChange:
|
|
30
|
-
return _this.props.onChange(...arguments);
|
|
31
|
-
}
|
|
27
|
+
notifyChange: (...args) => this.props.onChange(...args)
|
|
32
28
|
});
|
|
33
29
|
}
|
|
34
30
|
|
|
@@ -13,10 +13,9 @@ import TableHeader from './TableHeader';
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
class HeadTable extends React.PureComponent {
|
|
16
|
-
constructor(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
16
|
+
constructor(props = {
|
|
17
|
+
selectedRowKeysSet: new _Set()
|
|
18
|
+
}) {
|
|
20
19
|
super(props);
|
|
21
20
|
}
|
|
22
21
|
|
|
@@ -35,10 +35,7 @@ import { cloneDeep } from './utils';
|
|
|
35
35
|
import getColumns from './getColumns';
|
|
36
36
|
import ResizableHeaderCell from './ResizableHeaderCell';
|
|
37
37
|
|
|
38
|
-
const ResizableTable =
|
|
39
|
-
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
40
|
-
let ref = arguments.length > 1 ? arguments[1] : undefined;
|
|
41
|
-
|
|
38
|
+
const ResizableTable = (props = {}, ref) => {
|
|
42
39
|
const {
|
|
43
40
|
components: propComponents,
|
|
44
41
|
columns: propColumns,
|
|
@@ -100,10 +97,9 @@ const ResizableTable = function () {
|
|
|
100
97
|
}, propComponents), [propComponents]);
|
|
101
98
|
const handlerClassName = get(resizable, 'handlerClassName', 'resizing');
|
|
102
99
|
|
|
103
|
-
const handleResize = column => (e,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} = _ref;
|
|
100
|
+
const handleResize = column => (e, {
|
|
101
|
+
size
|
|
102
|
+
}) => {
|
|
107
103
|
const nextColumns = cloneDeep(columns);
|
|
108
104
|
const curColumn = findColumn(nextColumns, column, childrenColumnName);
|
|
109
105
|
|
|
@@ -151,33 +147,26 @@ const ResizableTable = function () {
|
|
|
151
147
|
setColumns(nextColumns);
|
|
152
148
|
};
|
|
153
149
|
|
|
154
|
-
const resizableRender =
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
})
|
|
163
|
-
});
|
|
164
|
-
};
|
|
150
|
+
const resizableRender = (col, index, level = 0) => _Object$assign(_Object$assign({}, col), {
|
|
151
|
+
onHeaderCell: column => ({
|
|
152
|
+
width: column.width,
|
|
153
|
+
onResize: handleResize(column),
|
|
154
|
+
onResizeStart: handleResizeStart(column),
|
|
155
|
+
onResizeStop: handleResizeStop(column)
|
|
156
|
+
})
|
|
157
|
+
});
|
|
165
158
|
|
|
166
|
-
const assignResizableRender =
|
|
167
|
-
|
|
168
|
-
let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
169
|
-
return _Array$isArray(columns) && columns.length ? _mapInstanceProperty(columns).call(columns, (col, index) => {
|
|
170
|
-
_Object$assign(col, resizableRender(col, index, level));
|
|
159
|
+
const assignResizableRender = (columns = [], level = 0) => _Array$isArray(columns) && columns.length ? _mapInstanceProperty(columns).call(columns, (col, index) => {
|
|
160
|
+
_Object$assign(col, resizableRender(col, index, level));
|
|
171
161
|
|
|
172
|
-
|
|
162
|
+
const children = col[childrenColumnName];
|
|
173
163
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
164
|
+
if (_Array$isArray(children) && children.length) {
|
|
165
|
+
col[childrenColumnName] = assignResizableRender(children, level + 1);
|
|
166
|
+
}
|
|
177
167
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
};
|
|
168
|
+
return col;
|
|
169
|
+
}) : [];
|
|
181
170
|
|
|
182
171
|
const finalColumns = useMemo(() => assignResizableRender(columns), [columns]);
|
|
183
172
|
return /*#__PURE__*/React.createElement(Table, _Object$assign({}, restProps, {
|