@douyinfe/semi-ui 2.32.4 → 2.32.6
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/umd/semi-ui.js +130 -112
- 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/carousel/index.d.ts +1 -1
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +15 -15
- package/lib/cjs/overflowList/index.js +4 -1
- package/lib/cjs/tree/index.js +6 -4
- package/lib/cjs/treeSelect/index.js +29 -16
- package/lib/es/carousel/index.d.ts +1 -1
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +15 -15
- package/lib/es/overflowList/index.js +4 -1
- package/lib/es/tree/index.js +6 -4
- package/lib/es/treeSelect/index.js +29 -16
- package/package.json +8 -8
|
@@ -14,7 +14,7 @@ export interface CarouselState {
|
|
|
14
14
|
declare class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
15
15
|
static propTypes: {
|
|
16
16
|
activeIndex: PropTypes.Requireable<number>;
|
|
17
|
-
animation: PropTypes.Requireable<"
|
|
17
|
+
animation: PropTypes.Requireable<"fade" | "slide">;
|
|
18
18
|
arrowProps: PropTypes.Requireable<object>;
|
|
19
19
|
autoPlay: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
20
20
|
className: PropTypes.Requireable<string>;
|
|
@@ -29,7 +29,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
29
29
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
30
|
value: PropTypes.Requireable<any[]>;
|
|
31
31
|
disabled: PropTypes.Requireable<boolean>;
|
|
32
|
-
type: PropTypes.Requireable<"
|
|
32
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
33
33
|
showClear: PropTypes.Requireable<boolean>;
|
|
34
34
|
format: PropTypes.Requireable<string>;
|
|
35
35
|
inputStyle: PropTypes.Requireable<object>;
|
|
@@ -57,7 +57,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
57
57
|
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
58
58
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
59
59
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
60
|
-
type: PropTypes.Requireable<"
|
|
60
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
61
61
|
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
62
62
|
clearIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
63
63
|
density: PropTypes.Requireable<"default" | "compact">;
|
|
@@ -19,7 +19,7 @@ export interface MonthsGridProps extends MonthsGridFoundationProps, BaseProps {
|
|
|
19
19
|
export declare type MonthsGridState = MonthsGridFoundationState;
|
|
20
20
|
export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGridState> {
|
|
21
21
|
static propTypes: {
|
|
22
|
-
type: PropTypes.Requireable<"
|
|
22
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
23
23
|
defaultValue: PropTypes.Requireable<any[]>;
|
|
24
24
|
defaultPickerValue: PropTypes.Requireable<NonNullable<string | number | object>>;
|
|
25
25
|
multiple: PropTypes.Requireable<boolean>;
|
|
@@ -24,7 +24,7 @@ declare class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonth
|
|
|
24
24
|
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
25
25
|
renderQuickControls: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
26
|
renderDateInput: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
27
|
-
type: PropTypes.Requireable<"
|
|
27
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
28
28
|
};
|
|
29
29
|
static defaultProps: {
|
|
30
30
|
disabledDate: {
|
|
@@ -146,16 +146,16 @@ export declare function withError(props: ModalReactProps): {
|
|
|
146
146
|
size?: import("@douyinfe/semi-foundation/lib/cjs/modal/modalFoundation").Size;
|
|
147
147
|
style?: React.CSSProperties;
|
|
148
148
|
className?: string;
|
|
149
|
-
|
|
150
|
-
height?: string | number;
|
|
149
|
+
getPopupContainer?: () => HTMLElement;
|
|
151
150
|
footer?: React.ReactNode;
|
|
152
151
|
header?: React.ReactNode;
|
|
152
|
+
direction?: any;
|
|
153
|
+
width?: string | number;
|
|
154
|
+
height?: string | number;
|
|
153
155
|
mask?: boolean;
|
|
154
156
|
visible?: boolean;
|
|
155
157
|
content?: React.ReactNode;
|
|
156
158
|
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
157
|
-
getPopupContainer?: () => HTMLElement;
|
|
158
|
-
direction?: any;
|
|
159
159
|
zIndex?: number;
|
|
160
160
|
closeOnEsc?: boolean;
|
|
161
161
|
preventScroll?: boolean;
|
|
@@ -210,12 +210,22 @@ export declare function withError(props: ModalReactProps): {
|
|
|
210
210
|
slot?: string;
|
|
211
211
|
hidden?: boolean;
|
|
212
212
|
color?: string;
|
|
213
|
+
onChange?: React.FormEventHandler<HTMLButtonElement>;
|
|
214
|
+
defaultChecked?: boolean;
|
|
213
215
|
defaultValue?: string | number | readonly string[];
|
|
216
|
+
suppressContentEditableWarning?: boolean;
|
|
217
|
+
suppressHydrationWarning?: boolean;
|
|
214
218
|
accessKey?: string;
|
|
219
|
+
autoFocus?: boolean;
|
|
220
|
+
formAction?: string;
|
|
221
|
+
formEncType?: string;
|
|
222
|
+
formMethod?: string;
|
|
223
|
+
formNoValidate?: boolean;
|
|
224
|
+
formTarget?: string;
|
|
215
225
|
dir?: string;
|
|
216
226
|
draggable?: boolean | "false" | "true";
|
|
217
227
|
lang?: string;
|
|
218
|
-
translate?: "
|
|
228
|
+
translate?: "no" | "yes";
|
|
219
229
|
prefix?: string;
|
|
220
230
|
contentEditable?: "inherit" | (boolean | "false" | "true");
|
|
221
231
|
inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal";
|
|
@@ -230,9 +240,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
230
240
|
'aria-haspopup'?: boolean | "dialog" | "menu" | "listbox" | "grid" | "false" | "true" | "tree";
|
|
231
241
|
'aria-controls'?: string;
|
|
232
242
|
'aria-describedby'?: string;
|
|
233
|
-
defaultChecked?: boolean;
|
|
234
|
-
suppressContentEditableWarning?: boolean;
|
|
235
|
-
suppressHydrationWarning?: boolean;
|
|
236
243
|
contextMenu?: string;
|
|
237
244
|
placeholder?: string;
|
|
238
245
|
spellCheck?: boolean | "false" | "true";
|
|
@@ -316,7 +323,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
316
323
|
onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLButtonElement>;
|
|
317
324
|
onFocusCapture?: React.FocusEventHandler<HTMLButtonElement>;
|
|
318
325
|
onBlurCapture?: React.FocusEventHandler<HTMLButtonElement>;
|
|
319
|
-
onChange?: React.FormEventHandler<HTMLButtonElement>;
|
|
320
326
|
onChangeCapture?: React.FormEventHandler<HTMLButtonElement>;
|
|
321
327
|
onBeforeInput?: React.FormEventHandler<HTMLButtonElement>;
|
|
322
328
|
onBeforeInputCapture?: React.FormEventHandler<HTMLButtonElement>;
|
|
@@ -451,12 +457,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
451
457
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
452
458
|
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement>;
|
|
453
459
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement>;
|
|
454
|
-
autoFocus?: boolean;
|
|
455
|
-
formAction?: string;
|
|
456
|
-
formEncType?: string;
|
|
457
|
-
formMethod?: string;
|
|
458
|
-
formNoValidate?: boolean;
|
|
459
|
-
formTarget?: string;
|
|
460
460
|
};
|
|
461
461
|
};
|
|
462
462
|
export declare function withConfirm(props: ModalReactProps): {
|
|
@@ -290,7 +290,10 @@ class OverflowList extends _baseComponent.default {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
componentDidUpdate(prevProps, prevState) {
|
|
293
|
-
|
|
293
|
+
const prevItemsKeys = prevProps.items.map(item => item.key);
|
|
294
|
+
const nowItemsKeys = this.props.items.map(item => item.key); // Determine whether to update by comparing key values
|
|
295
|
+
|
|
296
|
+
if (!(0, _isEqual2.default)(prevItemsKeys, nowItemsKeys)) {
|
|
294
297
|
this.itemRefs = {};
|
|
295
298
|
this.setState({
|
|
296
299
|
visibleState: new Map()
|
package/lib/cjs/tree/index.js
CHANGED
|
@@ -293,10 +293,12 @@ class Tree extends _baseComponent.default {
|
|
|
293
293
|
const firstInProps = !prevProps && 'treeData' in props;
|
|
294
294
|
const treeDataHasChange = prevProps && prevProps.treeData !== props.treeData;
|
|
295
295
|
return firstInProps || treeDataHasChange;
|
|
296
|
-
};
|
|
296
|
+
};
|
|
297
297
|
|
|
298
|
+
const needUpdateTreeData = needUpdate('treeData');
|
|
299
|
+
const needUpdateSimpleJson = needUpdate('treeDataSimpleJson'); // Update the data of tree in state
|
|
298
300
|
|
|
299
|
-
if (
|
|
301
|
+
if (needUpdateTreeData || props.draggable && needUpdateData()) {
|
|
300
302
|
// eslint-disable-next-line prefer-destructuring
|
|
301
303
|
treeData = props.treeData;
|
|
302
304
|
newState.treeData = treeData;
|
|
@@ -305,7 +307,7 @@ class Tree extends _baseComponent.default {
|
|
|
305
307
|
keyEntities = newState.keyEntities;
|
|
306
308
|
newState.cachedKeyValuePairs = Object.assign({}, entitiesMap.valueEntities);
|
|
307
309
|
valueEntities = newState.cachedKeyValuePairs;
|
|
308
|
-
} else if (
|
|
310
|
+
} else if (needUpdateSimpleJson) {
|
|
309
311
|
// Convert treeDataSimpleJson to treeData
|
|
310
312
|
treeData = (0, _treeUtil.convertJsonToData)(props.treeDataSimpleJson);
|
|
311
313
|
newState.treeData = treeData;
|
|
@@ -324,7 +326,7 @@ class Tree extends _baseComponent.default {
|
|
|
324
326
|
}
|
|
325
327
|
}
|
|
326
328
|
|
|
327
|
-
const dataUpdated =
|
|
329
|
+
const dataUpdated = needUpdateSimpleJson || needUpdateTreeData;
|
|
328
330
|
const expandAllWhenDataChange = dataUpdated && props.expandAll;
|
|
329
331
|
|
|
330
332
|
if (!isSeaching) {
|
|
@@ -102,10 +102,14 @@ class TreeSelect extends _baseComponent.default {
|
|
|
102
102
|
[`${prefixcls}-suffix-text`]: suffix && (0, _isString2.default)(suffix),
|
|
103
103
|
[`${prefixcls}-suffix-icon`]: (0, _utils.isSemiIcon)(suffix)
|
|
104
104
|
});
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
return (
|
|
106
|
+
/*#__PURE__*/
|
|
107
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
108
|
+
_react.default.createElement("div", {
|
|
109
|
+
className: suffixWrapperCls,
|
|
110
|
+
"x-semi-prop": "suffix"
|
|
111
|
+
}, suffix)
|
|
112
|
+
);
|
|
109
113
|
};
|
|
110
114
|
|
|
111
115
|
this.renderPrefix = () => {
|
|
@@ -122,11 +126,15 @@ class TreeSelect extends _baseComponent.default {
|
|
|
122
126
|
[`${prefixcls}-prefix-text`]: labelNode && (0, _isString2.default)(labelNode),
|
|
123
127
|
[`${prefixcls}-prefix-icon`]: (0, _utils.isSemiIcon)(labelNode)
|
|
124
128
|
});
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
|
|
129
|
+
return (
|
|
130
|
+
/*#__PURE__*/
|
|
131
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
132
|
+
_react.default.createElement("div", {
|
|
133
|
+
className: prefixWrapperCls,
|
|
134
|
+
id: insetLabelId,
|
|
135
|
+
"x-semi-prop": "prefix,insetLabel"
|
|
136
|
+
}, labelNode)
|
|
137
|
+
);
|
|
130
138
|
};
|
|
131
139
|
|
|
132
140
|
this.renderContent = () => {
|
|
@@ -398,7 +406,10 @@ class TreeSelect extends _baseComponent.default {
|
|
|
398
406
|
return null;
|
|
399
407
|
}
|
|
400
408
|
|
|
401
|
-
return arrowIcon ?
|
|
409
|
+
return arrowIcon ?
|
|
410
|
+
/*#__PURE__*/
|
|
411
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
412
|
+
_react.default.createElement("div", {
|
|
402
413
|
className: (0, _classnames.default)(`${prefixcls}-arrow`),
|
|
403
414
|
"x-semi-prop": "arrowIcon"
|
|
404
415
|
}, arrowIcon) : null;
|
|
@@ -1014,9 +1025,11 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1014
1025
|
let valueEntities = prevState.cachedKeyValuePairs || {};
|
|
1015
1026
|
const newState = {
|
|
1016
1027
|
prevProps: props
|
|
1017
|
-
};
|
|
1028
|
+
};
|
|
1029
|
+
const needUpdateTreeData = needUpdate('treeData');
|
|
1030
|
+
const needUpdateExpandedKeys = needUpdate('expandedKeys'); // TreeNode
|
|
1018
1031
|
|
|
1019
|
-
if (
|
|
1032
|
+
if (needUpdateTreeData) {
|
|
1020
1033
|
treeData = props.treeData;
|
|
1021
1034
|
newState.treeData = treeData;
|
|
1022
1035
|
const entitiesMap = (0, _treeUtil.convertDataToEntities)(treeData);
|
|
@@ -1034,9 +1047,9 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1034
1047
|
}
|
|
1035
1048
|
}
|
|
1036
1049
|
|
|
1037
|
-
const expandAllWhenDataChange =
|
|
1050
|
+
const expandAllWhenDataChange = needUpdateTreeData && props.expandAll; // expandedKeys
|
|
1038
1051
|
|
|
1039
|
-
if (
|
|
1052
|
+
if (needUpdateExpandedKeys || prevProps && needUpdate('autoExpandParent')) {
|
|
1040
1053
|
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps); // only show animation when treeData does not change
|
|
1041
1054
|
|
|
1042
1055
|
if (prevProps && props.motion && !treeData) {
|
|
@@ -1058,7 +1071,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1058
1071
|
} // flattenNodes
|
|
1059
1072
|
|
|
1060
1073
|
|
|
1061
|
-
if (treeData ||
|
|
1074
|
+
if (treeData || needUpdateExpandedKeys) {
|
|
1062
1075
|
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys);
|
|
1063
1076
|
newState.flattenNodes = flattenNodes;
|
|
1064
1077
|
} // selectedKeys: single mode controlled
|
|
@@ -1116,7 +1129,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1116
1129
|
} // ================== rePosKey ==================
|
|
1117
1130
|
|
|
1118
1131
|
|
|
1119
|
-
if (
|
|
1132
|
+
if (needUpdateTreeData || needUpdate('value')) {
|
|
1120
1133
|
newState.rePosKey = rePosKey + 1;
|
|
1121
1134
|
} // ================ disableStrictly =================
|
|
1122
1135
|
|
|
@@ -14,7 +14,7 @@ export interface CarouselState {
|
|
|
14
14
|
declare class Carousel extends BaseComponent<CarouselProps, CarouselState> {
|
|
15
15
|
static propTypes: {
|
|
16
16
|
activeIndex: PropTypes.Requireable<number>;
|
|
17
|
-
animation: PropTypes.Requireable<"
|
|
17
|
+
animation: PropTypes.Requireable<"fade" | "slide">;
|
|
18
18
|
arrowProps: PropTypes.Requireable<object>;
|
|
19
19
|
autoPlay: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
20
20
|
className: PropTypes.Requireable<string>;
|
|
@@ -29,7 +29,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
29
29
|
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
30
|
value: PropTypes.Requireable<any[]>;
|
|
31
31
|
disabled: PropTypes.Requireable<boolean>;
|
|
32
|
-
type: PropTypes.Requireable<"
|
|
32
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
33
33
|
showClear: PropTypes.Requireable<boolean>;
|
|
34
34
|
format: PropTypes.Requireable<string>;
|
|
35
35
|
inputStyle: PropTypes.Requireable<object>;
|
|
@@ -57,7 +57,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
57
57
|
'aria-invalid': PropTypes.Requireable<boolean>;
|
|
58
58
|
'aria-labelledby': PropTypes.Requireable<string>;
|
|
59
59
|
'aria-required': PropTypes.Requireable<boolean>;
|
|
60
|
-
type: PropTypes.Requireable<"
|
|
60
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
61
61
|
size: PropTypes.Requireable<"small" | "default" | "large">;
|
|
62
62
|
clearIcon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
63
63
|
density: PropTypes.Requireable<"default" | "compact">;
|
|
@@ -19,7 +19,7 @@ export interface MonthsGridProps extends MonthsGridFoundationProps, BaseProps {
|
|
|
19
19
|
export declare type MonthsGridState = MonthsGridFoundationState;
|
|
20
20
|
export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGridState> {
|
|
21
21
|
static propTypes: {
|
|
22
|
-
type: PropTypes.Requireable<"
|
|
22
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
23
23
|
defaultValue: PropTypes.Requireable<any[]>;
|
|
24
24
|
defaultPickerValue: PropTypes.Requireable<NonNullable<string | number | object>>;
|
|
25
25
|
multiple: PropTypes.Requireable<boolean>;
|
|
@@ -24,7 +24,7 @@ declare class YearAndMonth extends BaseComponent<YearAndMonthProps, YearAndMonth
|
|
|
24
24
|
presetPosition: PropTypes.Requireable<"left" | "top" | "right" | "bottom">;
|
|
25
25
|
renderQuickControls: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
26
26
|
renderDateInput: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
27
|
-
type: PropTypes.Requireable<"
|
|
27
|
+
type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "monthRange" | "dateTimeRange">;
|
|
28
28
|
};
|
|
29
29
|
static defaultProps: {
|
|
30
30
|
disabledDate: {
|
|
@@ -146,16 +146,16 @@ export declare function withError(props: ModalReactProps): {
|
|
|
146
146
|
size?: import("@douyinfe/semi-foundation/lib/es/modal/modalFoundation").Size;
|
|
147
147
|
style?: React.CSSProperties;
|
|
148
148
|
className?: string;
|
|
149
|
-
|
|
150
|
-
height?: string | number;
|
|
149
|
+
getPopupContainer?: () => HTMLElement;
|
|
151
150
|
footer?: React.ReactNode;
|
|
152
151
|
header?: React.ReactNode;
|
|
152
|
+
direction?: any;
|
|
153
|
+
width?: string | number;
|
|
154
|
+
height?: string | number;
|
|
153
155
|
mask?: boolean;
|
|
154
156
|
visible?: boolean;
|
|
155
157
|
content?: React.ReactNode;
|
|
156
158
|
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
157
|
-
getPopupContainer?: () => HTMLElement;
|
|
158
|
-
direction?: any;
|
|
159
159
|
zIndex?: number;
|
|
160
160
|
closeOnEsc?: boolean;
|
|
161
161
|
preventScroll?: boolean;
|
|
@@ -210,12 +210,22 @@ export declare function withError(props: ModalReactProps): {
|
|
|
210
210
|
slot?: string;
|
|
211
211
|
hidden?: boolean;
|
|
212
212
|
color?: string;
|
|
213
|
+
onChange?: React.FormEventHandler<HTMLButtonElement>;
|
|
214
|
+
defaultChecked?: boolean;
|
|
213
215
|
defaultValue?: string | number | readonly string[];
|
|
216
|
+
suppressContentEditableWarning?: boolean;
|
|
217
|
+
suppressHydrationWarning?: boolean;
|
|
214
218
|
accessKey?: string;
|
|
219
|
+
autoFocus?: boolean;
|
|
220
|
+
formAction?: string;
|
|
221
|
+
formEncType?: string;
|
|
222
|
+
formMethod?: string;
|
|
223
|
+
formNoValidate?: boolean;
|
|
224
|
+
formTarget?: string;
|
|
215
225
|
dir?: string;
|
|
216
226
|
draggable?: boolean | "false" | "true";
|
|
217
227
|
lang?: string;
|
|
218
|
-
translate?: "
|
|
228
|
+
translate?: "no" | "yes";
|
|
219
229
|
prefix?: string;
|
|
220
230
|
contentEditable?: "inherit" | (boolean | "false" | "true");
|
|
221
231
|
inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal";
|
|
@@ -230,9 +240,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
230
240
|
'aria-haspopup'?: boolean | "dialog" | "menu" | "listbox" | "grid" | "false" | "true" | "tree";
|
|
231
241
|
'aria-controls'?: string;
|
|
232
242
|
'aria-describedby'?: string;
|
|
233
|
-
defaultChecked?: boolean;
|
|
234
|
-
suppressContentEditableWarning?: boolean;
|
|
235
|
-
suppressHydrationWarning?: boolean;
|
|
236
243
|
contextMenu?: string;
|
|
237
244
|
placeholder?: string;
|
|
238
245
|
spellCheck?: boolean | "false" | "true";
|
|
@@ -316,7 +323,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
316
323
|
onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLButtonElement>;
|
|
317
324
|
onFocusCapture?: React.FocusEventHandler<HTMLButtonElement>;
|
|
318
325
|
onBlurCapture?: React.FocusEventHandler<HTMLButtonElement>;
|
|
319
|
-
onChange?: React.FormEventHandler<HTMLButtonElement>;
|
|
320
326
|
onChangeCapture?: React.FormEventHandler<HTMLButtonElement>;
|
|
321
327
|
onBeforeInput?: React.FormEventHandler<HTMLButtonElement>;
|
|
322
328
|
onBeforeInputCapture?: React.FormEventHandler<HTMLButtonElement>;
|
|
@@ -451,12 +457,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
451
457
|
onAnimationIterationCapture?: React.AnimationEventHandler<HTMLButtonElement>;
|
|
452
458
|
onTransitionEnd?: React.TransitionEventHandler<HTMLButtonElement>;
|
|
453
459
|
onTransitionEndCapture?: React.TransitionEventHandler<HTMLButtonElement>;
|
|
454
|
-
autoFocus?: boolean;
|
|
455
|
-
formAction?: string;
|
|
456
|
-
formEncType?: string;
|
|
457
|
-
formMethod?: string;
|
|
458
|
-
formNoValidate?: boolean;
|
|
459
|
-
formTarget?: string;
|
|
460
460
|
};
|
|
461
461
|
};
|
|
462
462
|
export declare function withConfirm(props: ModalReactProps): {
|
|
@@ -264,7 +264,10 @@ class OverflowList extends BaseComponent {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
componentDidUpdate(prevProps, prevState) {
|
|
267
|
-
|
|
267
|
+
const prevItemsKeys = prevProps.items.map(item => item.key);
|
|
268
|
+
const nowItemsKeys = this.props.items.map(item => item.key); // Determine whether to update by comparing key values
|
|
269
|
+
|
|
270
|
+
if (!_isEqual(prevItemsKeys, nowItemsKeys)) {
|
|
268
271
|
this.itemRefs = {};
|
|
269
272
|
this.setState({
|
|
270
273
|
visibleState: new Map()
|
package/lib/es/tree/index.js
CHANGED
|
@@ -248,10 +248,12 @@ class Tree extends BaseComponent {
|
|
|
248
248
|
const firstInProps = !prevProps && 'treeData' in props;
|
|
249
249
|
const treeDataHasChange = prevProps && prevProps.treeData !== props.treeData;
|
|
250
250
|
return firstInProps || treeDataHasChange;
|
|
251
|
-
};
|
|
251
|
+
};
|
|
252
252
|
|
|
253
|
+
const needUpdateTreeData = needUpdate('treeData');
|
|
254
|
+
const needUpdateSimpleJson = needUpdate('treeDataSimpleJson'); // Update the data of tree in state
|
|
253
255
|
|
|
254
|
-
if (
|
|
256
|
+
if (needUpdateTreeData || props.draggable && needUpdateData()) {
|
|
255
257
|
// eslint-disable-next-line prefer-destructuring
|
|
256
258
|
treeData = props.treeData;
|
|
257
259
|
newState.treeData = treeData;
|
|
@@ -260,7 +262,7 @@ class Tree extends BaseComponent {
|
|
|
260
262
|
keyEntities = newState.keyEntities;
|
|
261
263
|
newState.cachedKeyValuePairs = Object.assign({}, entitiesMap.valueEntities);
|
|
262
264
|
valueEntities = newState.cachedKeyValuePairs;
|
|
263
|
-
} else if (
|
|
265
|
+
} else if (needUpdateSimpleJson) {
|
|
264
266
|
// Convert treeDataSimpleJson to treeData
|
|
265
267
|
treeData = convertJsonToData(props.treeDataSimpleJson);
|
|
266
268
|
newState.treeData = treeData;
|
|
@@ -279,7 +281,7 @@ class Tree extends BaseComponent {
|
|
|
279
281
|
}
|
|
280
282
|
}
|
|
281
283
|
|
|
282
|
-
const dataUpdated =
|
|
284
|
+
const dataUpdated = needUpdateSimpleJson || needUpdateTreeData;
|
|
283
285
|
const expandAllWhenDataChange = dataUpdated && props.expandAll;
|
|
284
286
|
|
|
285
287
|
if (!isSeaching) {
|
|
@@ -52,10 +52,14 @@ class TreeSelect extends BaseComponent {
|
|
|
52
52
|
[`${prefixcls}-suffix-text`]: suffix && _isString(suffix),
|
|
53
53
|
[`${prefixcls}-suffix-icon`]: isSemiIcon(suffix)
|
|
54
54
|
});
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
return (
|
|
56
|
+
/*#__PURE__*/
|
|
57
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
58
|
+
React.createElement("div", {
|
|
59
|
+
className: suffixWrapperCls,
|
|
60
|
+
"x-semi-prop": "suffix"
|
|
61
|
+
}, suffix)
|
|
62
|
+
);
|
|
59
63
|
};
|
|
60
64
|
|
|
61
65
|
this.renderPrefix = () => {
|
|
@@ -72,11 +76,15 @@ class TreeSelect extends BaseComponent {
|
|
|
72
76
|
[`${prefixcls}-prefix-text`]: labelNode && _isString(labelNode),
|
|
73
77
|
[`${prefixcls}-prefix-icon`]: isSemiIcon(labelNode)
|
|
74
78
|
});
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
|
|
79
|
+
return (
|
|
80
|
+
/*#__PURE__*/
|
|
81
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
82
|
+
React.createElement("div", {
|
|
83
|
+
className: prefixWrapperCls,
|
|
84
|
+
id: insetLabelId,
|
|
85
|
+
"x-semi-prop": "prefix,insetLabel"
|
|
86
|
+
}, labelNode)
|
|
87
|
+
);
|
|
80
88
|
};
|
|
81
89
|
|
|
82
90
|
this.renderContent = () => {
|
|
@@ -348,7 +356,10 @@ class TreeSelect extends BaseComponent {
|
|
|
348
356
|
return null;
|
|
349
357
|
}
|
|
350
358
|
|
|
351
|
-
return arrowIcon ?
|
|
359
|
+
return arrowIcon ?
|
|
360
|
+
/*#__PURE__*/
|
|
361
|
+
// eslint-disable-next-line react/no-unknown-property
|
|
362
|
+
React.createElement("div", {
|
|
352
363
|
className: cls(`${prefixcls}-arrow`),
|
|
353
364
|
"x-semi-prop": "arrowIcon"
|
|
354
365
|
}, arrowIcon) : null;
|
|
@@ -966,9 +977,11 @@ class TreeSelect extends BaseComponent {
|
|
|
966
977
|
let valueEntities = prevState.cachedKeyValuePairs || {};
|
|
967
978
|
const newState = {
|
|
968
979
|
prevProps: props
|
|
969
|
-
};
|
|
980
|
+
};
|
|
981
|
+
const needUpdateTreeData = needUpdate('treeData');
|
|
982
|
+
const needUpdateExpandedKeys = needUpdate('expandedKeys'); // TreeNode
|
|
970
983
|
|
|
971
|
-
if (
|
|
984
|
+
if (needUpdateTreeData) {
|
|
972
985
|
treeData = props.treeData;
|
|
973
986
|
newState.treeData = treeData;
|
|
974
987
|
const entitiesMap = convertDataToEntities(treeData);
|
|
@@ -986,9 +999,9 @@ class TreeSelect extends BaseComponent {
|
|
|
986
999
|
}
|
|
987
1000
|
}
|
|
988
1001
|
|
|
989
|
-
const expandAllWhenDataChange =
|
|
1002
|
+
const expandAllWhenDataChange = needUpdateTreeData && props.expandAll; // expandedKeys
|
|
990
1003
|
|
|
991
|
-
if (
|
|
1004
|
+
if (needUpdateExpandedKeys || prevProps && needUpdate('autoExpandParent')) {
|
|
992
1005
|
newState.expandedKeys = calcExpandedKeys(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps); // only show animation when treeData does not change
|
|
993
1006
|
|
|
994
1007
|
if (prevProps && props.motion && !treeData) {
|
|
@@ -1010,7 +1023,7 @@ class TreeSelect extends BaseComponent {
|
|
|
1010
1023
|
} // flattenNodes
|
|
1011
1024
|
|
|
1012
1025
|
|
|
1013
|
-
if (treeData ||
|
|
1026
|
+
if (treeData || needUpdateExpandedKeys) {
|
|
1014
1027
|
const flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys);
|
|
1015
1028
|
newState.flattenNodes = flattenNodes;
|
|
1016
1029
|
} // selectedKeys: single mode controlled
|
|
@@ -1068,7 +1081,7 @@ class TreeSelect extends BaseComponent {
|
|
|
1068
1081
|
} // ================== rePosKey ==================
|
|
1069
1082
|
|
|
1070
1083
|
|
|
1071
|
-
if (
|
|
1084
|
+
if (needUpdateTreeData || needUpdate('value')) {
|
|
1072
1085
|
newState.rePosKey = rePosKey + 1;
|
|
1073
1086
|
} // ================ disableStrictly =================
|
|
1074
1087
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.32.
|
|
3
|
+
"version": "2.32.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"lib/*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@douyinfe/semi-animation": "2.32.
|
|
21
|
-
"@douyinfe/semi-animation-react": "2.32.
|
|
22
|
-
"@douyinfe/semi-foundation": "2.32.
|
|
23
|
-
"@douyinfe/semi-icons": "2.32.
|
|
24
|
-
"@douyinfe/semi-illustrations": "2.32.
|
|
25
|
-
"@douyinfe/semi-theme-default": "2.32.
|
|
20
|
+
"@douyinfe/semi-animation": "2.32.6",
|
|
21
|
+
"@douyinfe/semi-animation-react": "2.32.6",
|
|
22
|
+
"@douyinfe/semi-foundation": "2.32.6",
|
|
23
|
+
"@douyinfe/semi-icons": "2.32.6",
|
|
24
|
+
"@douyinfe/semi-illustrations": "2.32.6",
|
|
25
|
+
"@douyinfe/semi-theme-default": "2.32.6",
|
|
26
26
|
"async-validator": "^3.5.0",
|
|
27
27
|
"classnames": "^2.2.6",
|
|
28
28
|
"copy-text-to-clipboard": "^2.1.1",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "dff8e286754f4b66cbeffd623f9bf6fb3fc09ef2",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|