@douyinfe/semi-ui 2.49.1 → 2.49.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 +3 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +142 -48
- 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/datePicker/yearAndMonth.js +1 -5
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +6 -6
- package/lib/cjs/notification/index.js +6 -5
- package/lib/cjs/select/index.d.ts +1 -1
- package/lib/cjs/treeSelect/index.d.ts +2 -2
- package/lib/cjs/treeSelect/index.js +117 -29
- package/lib/es/datePicker/yearAndMonth.js +1 -5
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +6 -6
- package/lib/es/notification/index.js +6 -5
- package/lib/es/select/index.d.ts +1 -1
- package/lib/es/treeSelect/index.d.ts +2 -2
- package/lib/es/treeSelect/index.js +118 -30
- package/package.json +8 -8
|
@@ -131,11 +131,7 @@ class YearAndMonth extends _baseComponent.default {
|
|
|
131
131
|
const right = _constants2.strings.PANEL_TYPE_RIGHT;
|
|
132
132
|
const needDisabled = year => {
|
|
133
133
|
if (panelType === right && currentYear[left]) {
|
|
134
|
-
|
|
135
|
-
return currentYear[left] > year;
|
|
136
|
-
} else {
|
|
137
|
-
return currentYear[left] >= year;
|
|
138
|
-
}
|
|
134
|
+
return currentYear[left] > year;
|
|
139
135
|
}
|
|
140
136
|
return false;
|
|
141
137
|
};
|
|
@@ -130,7 +130,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
130
130
|
onDeselect?: (value: string | number | any[] | Record<string, any>, option: Record<string, any>) => void;
|
|
131
131
|
onSelect?: (value: string | number | any[] | Record<string, any>, option: Record<string, any>) => void;
|
|
132
132
|
allowCreate?: boolean;
|
|
133
|
-
triggerRender?: (props
|
|
133
|
+
triggerRender?: (props: import("../select").TriggerRenderProps) => React.ReactNode;
|
|
134
134
|
onClear?: () => void;
|
|
135
135
|
virtualize?: import("../select").virtualListProps;
|
|
136
136
|
onFocus?: (e: React.FocusEvent<Element, Element>) => void;
|
package/lib/cjs/form/field.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
76
76
|
onDeselect?: (value: string | number | any[] | Record<string, any>, option: Record<string, any>) => void;
|
|
77
77
|
onSelect?: (value: string | number | any[] | Record<string, any>, option: Record<string, any>) => void;
|
|
78
78
|
allowCreate?: boolean;
|
|
79
|
-
triggerRender?: (props
|
|
79
|
+
triggerRender?: (props: import("../select/index").TriggerRenderProps) => import("react").ReactNode;
|
|
80
80
|
onClear?: () => void;
|
|
81
81
|
virtualize?: import("../select/index").virtualListProps;
|
|
82
82
|
onFocus?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
@@ -157,13 +157,13 @@ export declare function withError(props: ModalReactProps): {
|
|
|
157
157
|
height?: string | number;
|
|
158
158
|
content?: React.ReactNode;
|
|
159
159
|
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
160
|
+
onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
160
161
|
closeOnEsc?: boolean;
|
|
161
162
|
preventScroll?: boolean;
|
|
162
163
|
afterClose?: () => void;
|
|
163
164
|
keepDOM?: boolean;
|
|
164
165
|
cancelText?: string;
|
|
165
166
|
okText?: string;
|
|
166
|
-
onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
167
167
|
closeIcon?: React.ReactNode;
|
|
168
168
|
bodyStyle?: React.CSSProperties;
|
|
169
169
|
closable?: boolean;
|
|
@@ -377,6 +377,11 @@ export declare function withError(props: ModalReactProps): {
|
|
|
377
377
|
accessKey?: string;
|
|
378
378
|
autoFocus?: boolean;
|
|
379
379
|
content?: string;
|
|
380
|
+
formAction?: string;
|
|
381
|
+
formEncType?: string;
|
|
382
|
+
formMethod?: string;
|
|
383
|
+
formNoValidate?: boolean;
|
|
384
|
+
formTarget?: string;
|
|
380
385
|
contextMenu?: string;
|
|
381
386
|
dir?: string;
|
|
382
387
|
draggable?: boolean | "true" | "false";
|
|
@@ -458,11 +463,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
458
463
|
'aria-valuemin'?: number;
|
|
459
464
|
'aria-valuenow'?: number;
|
|
460
465
|
'aria-valuetext'?: string;
|
|
461
|
-
formAction?: string;
|
|
462
|
-
formEncType?: string;
|
|
463
|
-
formMethod?: string;
|
|
464
|
-
formNoValidate?: boolean;
|
|
465
|
-
formTarget?: string;
|
|
466
466
|
};
|
|
467
467
|
};
|
|
468
468
|
export declare function withConfirm(props: ModalReactProps): {
|
|
@@ -117,6 +117,7 @@ class NotificationList extends _baseComponent.default {
|
|
|
117
117
|
}
|
|
118
118
|
static addNotice(notice) {
|
|
119
119
|
var _a;
|
|
120
|
+
notice = Object.assign(Object.assign({}, defaultConfig), notice);
|
|
120
121
|
const id = (_a = notice.id) !== null && _a !== void 0 ? _a : (0, _uuid.default)('notification');
|
|
121
122
|
if (!ref) {
|
|
122
123
|
const {
|
|
@@ -160,27 +161,27 @@ class NotificationList extends _baseComponent.default {
|
|
|
160
161
|
return id;
|
|
161
162
|
}
|
|
162
163
|
static info(opts) {
|
|
163
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
164
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
164
165
|
type: 'info'
|
|
165
166
|
}));
|
|
166
167
|
}
|
|
167
168
|
static success(opts) {
|
|
168
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
169
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
169
170
|
type: 'success'
|
|
170
171
|
}));
|
|
171
172
|
}
|
|
172
173
|
static error(opts) {
|
|
173
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
174
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
174
175
|
type: 'error'
|
|
175
176
|
}));
|
|
176
177
|
}
|
|
177
178
|
static warning(opts) {
|
|
178
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
179
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
179
180
|
type: 'warning'
|
|
180
181
|
}));
|
|
181
182
|
}
|
|
182
183
|
static open(opts) {
|
|
183
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
184
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
184
185
|
type: 'default'
|
|
185
186
|
}));
|
|
186
187
|
}
|
|
@@ -139,7 +139,7 @@ export type SelectProps = {
|
|
|
139
139
|
onDeselect?: (value: SelectProps['value'], option: Record<string, any>) => void;
|
|
140
140
|
onSelect?: (value: SelectProps['value'], option: Record<string, any>) => void;
|
|
141
141
|
allowCreate?: boolean;
|
|
142
|
-
triggerRender?: (props
|
|
142
|
+
triggerRender?: (props: TriggerRenderProps) => React.ReactNode;
|
|
143
143
|
onClear?: () => void;
|
|
144
144
|
virtualize?: virtualListProps;
|
|
145
145
|
onFocus?: (e: React.FocusEvent) => void;
|
|
@@ -77,7 +77,7 @@ export interface TreeSelectProps extends Omit<BasicTreeSelectProps, OverrideComm
|
|
|
77
77
|
onSelect?: (selectedKey: string, selected: boolean, selectedNode: TreeNodeData) => void;
|
|
78
78
|
renderSelectedItem?: RenderSelectedItem;
|
|
79
79
|
getPopupContainer?: () => HTMLElement;
|
|
80
|
-
triggerRender?: (props
|
|
80
|
+
triggerRender?: (props: TriggerRenderProps) => React.ReactNode;
|
|
81
81
|
onBlur?: (e: React.MouseEvent) => void;
|
|
82
82
|
onChange?: OnChange;
|
|
83
83
|
onFocus?: (e: React.MouseEvent) => void;
|
|
@@ -190,7 +190,6 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
190
190
|
triggerRef: React.RefObject<HTMLDivElement>;
|
|
191
191
|
optionsRef: React.RefObject<any>;
|
|
192
192
|
clickOutsideHandler: any;
|
|
193
|
-
_flattenNodes: TreeState['flattenNodes'];
|
|
194
193
|
onNodeClick: any;
|
|
195
194
|
onNodeDoubleClick: any;
|
|
196
195
|
onMotionEnd: any;
|
|
@@ -247,6 +246,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
247
246
|
};
|
|
248
247
|
getTreeNodeKey: (treeNode: TreeNodeData) => string;
|
|
249
248
|
handlePopoverClose: (isVisible: any) => void;
|
|
249
|
+
afterClose: () => void;
|
|
250
250
|
renderTreeNode: (treeNode: FlattenNode, ind: number, style: React.CSSProperties) => JSX.Element;
|
|
251
251
|
itemKey: (index: number, data: Record<string, any>) => any;
|
|
252
252
|
renderNodeList: () => JSX.Element;
|
|
@@ -689,13 +689,27 @@ class TreeSelect extends _baseComponent.default {
|
|
|
689
689
|
searchAutoFocus,
|
|
690
690
|
searchPosition
|
|
691
691
|
} = this.props;
|
|
692
|
-
|
|
693
|
-
|
|
692
|
+
// 将 inputValue 清空,如果有选中值的话,选中项能够快速回显
|
|
693
|
+
// Clear the inputValue. If there is a selected value, the selected item can be quickly echoed.
|
|
694
|
+
if (isVisible === false && filterTreeNode) {
|
|
695
|
+
this.foundation.clearInputValue();
|
|
694
696
|
}
|
|
695
697
|
if (filterTreeNode && searchPosition === _constants.strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
|
|
696
698
|
this.foundation.focusInput(true);
|
|
697
699
|
}
|
|
698
700
|
};
|
|
701
|
+
this.afterClose = () => {
|
|
702
|
+
// flattenNode 的变化将导致弹出层面板中的选项数目变化
|
|
703
|
+
// 在弹层完全收起之后,再通过 clearInput 重新计算 state 中的 expandedKey, flattenNode
|
|
704
|
+
// 防止在弹出层未收起时弹层面板中选项数目变化导致视觉上出现弹层闪动问题
|
|
705
|
+
// Changes to flattenNode will cause the number of options in the popup panel to change
|
|
706
|
+
// After the pop-up layer is completely closed, recalculate the expandedKey and flattenNode in the state through clearInput.
|
|
707
|
+
// Prevent the pop-up layer from flickering visually due to changes in the number of options in the pop-up panel when the pop-up layer is not collapsed.
|
|
708
|
+
const {
|
|
709
|
+
filterTreeNode
|
|
710
|
+
} = this.props;
|
|
711
|
+
filterTreeNode && this.foundation.clearInput();
|
|
712
|
+
};
|
|
699
713
|
this.renderTreeNode = (treeNode, ind, style) => {
|
|
700
714
|
const {
|
|
701
715
|
data,
|
|
@@ -728,6 +742,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
728
742
|
this.renderNodeList = () => {
|
|
729
743
|
const {
|
|
730
744
|
flattenNodes,
|
|
745
|
+
cachedFlattenNodes,
|
|
731
746
|
motionKeys,
|
|
732
747
|
motionType,
|
|
733
748
|
filteredKeys
|
|
@@ -743,7 +758,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
743
758
|
if (!virtualize || (0, _isEmpty2.default)(virtualize)) {
|
|
744
759
|
return /*#__PURE__*/_react.default.createElement(_nodeList.default, {
|
|
745
760
|
flattenNodes: flattenNodes,
|
|
746
|
-
flattenList:
|
|
761
|
+
flattenList: cachedFlattenNodes,
|
|
747
762
|
motionKeys: motionExpand ? motionKeys : new Set([]),
|
|
748
763
|
motionType: motionType,
|
|
749
764
|
// When motionKeys is empty, but filteredKeys is not empty (that is, the search hits), this situation should be distinguished from ordinary motionKeys
|
|
@@ -862,6 +877,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
862
877
|
keyEntities: {},
|
|
863
878
|
treeData: [],
|
|
864
879
|
flattenNodes: [],
|
|
880
|
+
cachedFlattenNodes: undefined,
|
|
865
881
|
selectedKeys: [],
|
|
866
882
|
checkedKeys: new Set(),
|
|
867
883
|
halfCheckedKeys: new Set(),
|
|
@@ -891,6 +907,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
891
907
|
};
|
|
892
908
|
}
|
|
893
909
|
static getDerivedStateFromProps(props, prevState) {
|
|
910
|
+
var _a;
|
|
894
911
|
const {
|
|
895
912
|
prevProps,
|
|
896
913
|
rePosKey
|
|
@@ -908,6 +925,8 @@ class TreeSelect extends _baseComponent.default {
|
|
|
908
925
|
};
|
|
909
926
|
const needUpdateTreeData = needUpdate('treeData');
|
|
910
927
|
const needUpdateExpandedKeys = needUpdate('expandedKeys');
|
|
928
|
+
const isExpandControlled = ('expandedKeys' in props);
|
|
929
|
+
const isSearching = Boolean(props.filterTreeNode && prevState.inputValue && prevState.inputValue.length);
|
|
911
930
|
// TreeNode
|
|
912
931
|
if (needUpdateTreeData) {
|
|
913
932
|
treeData = props.treeData;
|
|
@@ -926,31 +945,97 @@ class TreeSelect extends _baseComponent.default {
|
|
|
926
945
|
}
|
|
927
946
|
}
|
|
928
947
|
const expandAllWhenDataChange = needUpdateTreeData && props.expandAll;
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
948
|
+
if (!isSearching) {
|
|
949
|
+
// expandedKeys
|
|
950
|
+
if (needUpdateExpandedKeys || prevProps && needUpdate('autoExpandParent')) {
|
|
951
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
|
|
952
|
+
// only show animation when treeData does not change
|
|
953
|
+
if (prevProps && props.motion && !treeData) {
|
|
954
|
+
const {
|
|
955
|
+
motionKeys,
|
|
956
|
+
motionType
|
|
957
|
+
} = (0, _treeUtil.calcMotionKeys)(prevState.expandedKeys, newState.expandedKeys, keyEntities);
|
|
958
|
+
newState.motionKeys = new Set(motionKeys);
|
|
959
|
+
newState.motionType = motionType;
|
|
960
|
+
if (motionType === 'hide') {
|
|
961
|
+
// cache flatten nodes: expandedKeys changed may not be triggered by interaction
|
|
962
|
+
newState.cachedFlattenNodes = (0, _treeUtil2.cloneDeep)(prevState.flattenNodes);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
} else if (!prevProps && (props.defaultExpandAll || props.expandAll) || expandAllWhenDataChange) {
|
|
966
|
+
newState.expandedKeys = new Set(Object.keys(keyEntities));
|
|
967
|
+
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
968
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.defaultExpandedKeys, keyEntities);
|
|
969
|
+
} else if (!prevProps && props.defaultValue) {
|
|
970
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.defaultValue, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
971
|
+
} else if (!prevProps && props.value) {
|
|
972
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
973
|
+
} else if (!isExpandControlled && needUpdateTreeData && props.value) {
|
|
974
|
+
// 当 treeData 已经设置具体的值,并且设置了 props.loadData ,则认为 treeData 的更新是因为 loadData 导致的
|
|
975
|
+
// 如果是因为 loadData 导致 treeData改变, 此时在这里重新计算 key 会导致为未选中的展开项目被收起
|
|
976
|
+
// 所以此时不需要重新计算 expandedKeys,因为在点击展开按钮时候已经把被展开的项添加到 expandedKeys 中
|
|
977
|
+
// When treeData has a specific value and props.loadData is set, it is considered that the update of treeData is caused by loadData
|
|
978
|
+
// If the treeData is changed because of loadData, recalculating the key here will cause the unselected expanded items to be collapsed
|
|
979
|
+
// So there is no need to recalculate expandedKeys at this time, because the expanded item has been added to expandedKeys when the expand button is clicked
|
|
980
|
+
if (!(prevState.treeData && ((_a = prevState.treeData) === null || _a === void 0 ? void 0 : _a.length) > 0 && props.loadData)) {
|
|
981
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)(props.value, keyEntities, props.multiple, valueEntities);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
if (!newState.expandedKeys) {
|
|
985
|
+
delete newState.expandedKeys;
|
|
986
|
+
}
|
|
987
|
+
if (treeData || newState.expandedKeys) {
|
|
988
|
+
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, keyMaps);
|
|
989
|
+
newState.flattenNodes = flattenNodes;
|
|
990
|
+
}
|
|
991
|
+
} else {
|
|
992
|
+
let filteredState;
|
|
993
|
+
// treeData changed while searching
|
|
994
|
+
if (treeData) {
|
|
995
|
+
// Get filter data
|
|
996
|
+
filteredState = (0, _treeUtil.filterTreeData)({
|
|
997
|
+
treeData,
|
|
998
|
+
inputValue: prevState.inputValue,
|
|
999
|
+
filterTreeNode: props.filterTreeNode,
|
|
1000
|
+
filterProps: props.treeNodeFilterProp,
|
|
1001
|
+
showFilteredOnly: props.showFilteredOnly,
|
|
1002
|
+
keyEntities: newState.keyEntities,
|
|
1003
|
+
prevExpandedKeys: [...prevState.filteredExpandedKeys],
|
|
1004
|
+
keyMaps: keyMaps
|
|
1005
|
+
});
|
|
1006
|
+
newState.flattenNodes = filteredState.flattenNodes;
|
|
1007
|
+
newState.motionKeys = new Set([]);
|
|
1008
|
+
newState.filteredKeys = filteredState.filteredKeys;
|
|
1009
|
+
newState.filteredShownKeys = filteredState.filteredShownKeys;
|
|
1010
|
+
newState.filteredExpandedKeys = filteredState.filteredExpandedKeys;
|
|
1011
|
+
}
|
|
1012
|
+
// expandedKeys changed while searching
|
|
1013
|
+
if (props.expandedKeys) {
|
|
1014
|
+
newState.filteredExpandedKeys = (0, _treeUtil.calcExpandedKeys)(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
|
|
1015
|
+
if (prevProps && props.motion) {
|
|
1016
|
+
const prevKeys = prevState ? prevState.filteredExpandedKeys : new Set([]);
|
|
1017
|
+
// only show animation when treeData does not change
|
|
1018
|
+
if (!treeData) {
|
|
1019
|
+
const motionResult = (0, _treeUtil.calcMotionKeys)(prevKeys, newState.filteredExpandedKeys, keyEntities);
|
|
1020
|
+
let {
|
|
1021
|
+
motionKeys
|
|
1022
|
+
} = motionResult;
|
|
1023
|
+
const {
|
|
1024
|
+
motionType
|
|
1025
|
+
} = motionResult;
|
|
1026
|
+
if (props.showFilteredOnly) {
|
|
1027
|
+
motionKeys = motionKeys.filter(key => prevState.filteredShownKeys.has(key));
|
|
1028
|
+
}
|
|
1029
|
+
if (motionType === 'hide') {
|
|
1030
|
+
// cache flatten nodes: expandedKeys changed may not be triggered by interaction
|
|
1031
|
+
newState.cachedFlattenNodes = (0, _treeUtil2.cloneDeep)(prevState.flattenNodes);
|
|
1032
|
+
}
|
|
1033
|
+
newState.motionKeys = new Set(motionKeys);
|
|
1034
|
+
newState.motionType = motionType;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
newState.flattenNodes = (0, _treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.filteredExpandedKeys || prevState.filteredExpandedKeys, keyMaps, props.showFilteredOnly && prevState.filteredShownKeys);
|
|
940
1038
|
}
|
|
941
|
-
} else if (!prevProps && (props.defaultExpandAll || props.expandAll) || expandAllWhenDataChange) {
|
|
942
|
-
newState.expandedKeys = new Set(Object.keys(keyEntities));
|
|
943
|
-
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
944
|
-
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.defaultExpandedKeys, keyEntities);
|
|
945
|
-
} else if (!prevProps && props.defaultValue) {
|
|
946
|
-
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.defaultValue, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
947
|
-
} else if (!prevProps && props.value) {
|
|
948
|
-
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
949
|
-
}
|
|
950
|
-
// flattenNodes
|
|
951
|
-
if (treeData || needUpdateExpandedKeys) {
|
|
952
|
-
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, keyMaps);
|
|
953
|
-
newState.flattenNodes = flattenNodes;
|
|
954
1039
|
}
|
|
955
1040
|
// selectedKeys: single mode controlled
|
|
956
1041
|
const isMultiple = props.multiple;
|
|
@@ -1057,7 +1142,9 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1057
1142
|
this.props.onSearch && this.props.onSearch(input, filteredExpandedKeys);
|
|
1058
1143
|
},
|
|
1059
1144
|
cacheFlattenNodes: bool => {
|
|
1060
|
-
this.
|
|
1145
|
+
this.setState({
|
|
1146
|
+
cachedFlattenNodes: bool ? (0, _treeUtil2.cloneDeep)(this.state.flattenNodes) : undefined
|
|
1147
|
+
});
|
|
1061
1148
|
},
|
|
1062
1149
|
notifyLoad: (newLoadedKeys, data) => {
|
|
1063
1150
|
const {
|
|
@@ -1202,7 +1289,8 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1202
1289
|
autoAdjustOverflow: autoAdjustOverflow,
|
|
1203
1290
|
mouseLeaveDelay: mouseLeaveDelay,
|
|
1204
1291
|
mouseEnterDelay: mouseEnterDelay,
|
|
1205
|
-
onVisibleChange: this.handlePopoverClose
|
|
1292
|
+
onVisibleChange: this.handlePopoverClose,
|
|
1293
|
+
afterClose: this.afterClose
|
|
1206
1294
|
}, selection);
|
|
1207
1295
|
}
|
|
1208
1296
|
}
|
|
@@ -124,11 +124,7 @@ class YearAndMonth extends BaseComponent {
|
|
|
124
124
|
const right = strings.PANEL_TYPE_RIGHT;
|
|
125
125
|
const needDisabled = year => {
|
|
126
126
|
if (panelType === right && currentYear[left]) {
|
|
127
|
-
|
|
128
|
-
return currentYear[left] > year;
|
|
129
|
-
} else {
|
|
130
|
-
return currentYear[left] >= year;
|
|
131
|
-
}
|
|
127
|
+
return currentYear[left] > year;
|
|
132
128
|
}
|
|
133
129
|
return false;
|
|
134
130
|
};
|
|
@@ -130,7 +130,7 @@ declare class Form<Values extends Record<string, any> = any> extends BaseCompone
|
|
|
130
130
|
onDeselect?: (value: string | number | any[] | Record<string, any>, option: Record<string, any>) => void;
|
|
131
131
|
onSelect?: (value: string | number | any[] | Record<string, any>, option: Record<string, any>) => void;
|
|
132
132
|
allowCreate?: boolean;
|
|
133
|
-
triggerRender?: (props
|
|
133
|
+
triggerRender?: (props: import("../select").TriggerRenderProps) => React.ReactNode;
|
|
134
134
|
onClear?: () => void;
|
|
135
135
|
virtualize?: import("../select").virtualListProps;
|
|
136
136
|
onFocus?: (e: React.FocusEvent<Element, Element>) => void;
|
package/lib/es/form/field.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
|
|
|
76
76
|
onDeselect?: (value: string | number | any[] | Record<string, any>, option: Record<string, any>) => void;
|
|
77
77
|
onSelect?: (value: string | number | any[] | Record<string, any>, option: Record<string, any>) => void;
|
|
78
78
|
allowCreate?: boolean;
|
|
79
|
-
triggerRender?: (props
|
|
79
|
+
triggerRender?: (props: import("../select/index").TriggerRenderProps) => import("react").ReactNode;
|
|
80
80
|
onClear?: () => void;
|
|
81
81
|
virtualize?: import("../select/index").virtualListProps;
|
|
82
82
|
onFocus?: (e: import("react").FocusEvent<Element, Element>) => void;
|
|
@@ -157,13 +157,13 @@ export declare function withError(props: ModalReactProps): {
|
|
|
157
157
|
height?: string | number;
|
|
158
158
|
content?: React.ReactNode;
|
|
159
159
|
icon: string | number | boolean | React.ReactFragment | JSX.Element;
|
|
160
|
+
onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
160
161
|
closeOnEsc?: boolean;
|
|
161
162
|
preventScroll?: boolean;
|
|
162
163
|
afterClose?: () => void;
|
|
163
164
|
keepDOM?: boolean;
|
|
164
165
|
cancelText?: string;
|
|
165
166
|
okText?: string;
|
|
166
|
-
onCancel?: (e: React.MouseEvent<Element, MouseEvent>) => void | Promise<any>;
|
|
167
167
|
closeIcon?: React.ReactNode;
|
|
168
168
|
bodyStyle?: React.CSSProperties;
|
|
169
169
|
closable?: boolean;
|
|
@@ -377,6 +377,11 @@ export declare function withError(props: ModalReactProps): {
|
|
|
377
377
|
accessKey?: string;
|
|
378
378
|
autoFocus?: boolean;
|
|
379
379
|
content?: string;
|
|
380
|
+
formAction?: string;
|
|
381
|
+
formEncType?: string;
|
|
382
|
+
formMethod?: string;
|
|
383
|
+
formNoValidate?: boolean;
|
|
384
|
+
formTarget?: string;
|
|
380
385
|
contextMenu?: string;
|
|
381
386
|
dir?: string;
|
|
382
387
|
draggable?: boolean | "true" | "false";
|
|
@@ -458,11 +463,6 @@ export declare function withError(props: ModalReactProps): {
|
|
|
458
463
|
'aria-valuemin'?: number;
|
|
459
464
|
'aria-valuenow'?: number;
|
|
460
465
|
'aria-valuetext'?: string;
|
|
461
|
-
formAction?: string;
|
|
462
|
-
formEncType?: string;
|
|
463
|
-
formMethod?: string;
|
|
464
|
-
formNoValidate?: boolean;
|
|
465
|
-
formTarget?: string;
|
|
466
466
|
};
|
|
467
467
|
};
|
|
468
468
|
export declare function withConfirm(props: ModalReactProps): {
|
|
@@ -110,6 +110,7 @@ class NotificationList extends BaseComponent {
|
|
|
110
110
|
}
|
|
111
111
|
static addNotice(notice) {
|
|
112
112
|
var _a;
|
|
113
|
+
notice = Object.assign(Object.assign({}, defaultConfig), notice);
|
|
113
114
|
const id = (_a = notice.id) !== null && _a !== void 0 ? _a : getUuid('notification');
|
|
114
115
|
if (!ref) {
|
|
115
116
|
const {
|
|
@@ -153,27 +154,27 @@ class NotificationList extends BaseComponent {
|
|
|
153
154
|
return id;
|
|
154
155
|
}
|
|
155
156
|
static info(opts) {
|
|
156
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
157
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
157
158
|
type: 'info'
|
|
158
159
|
}));
|
|
159
160
|
}
|
|
160
161
|
static success(opts) {
|
|
161
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
162
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
162
163
|
type: 'success'
|
|
163
164
|
}));
|
|
164
165
|
}
|
|
165
166
|
static error(opts) {
|
|
166
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
167
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
167
168
|
type: 'error'
|
|
168
169
|
}));
|
|
169
170
|
}
|
|
170
171
|
static warning(opts) {
|
|
171
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
172
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
172
173
|
type: 'warning'
|
|
173
174
|
}));
|
|
174
175
|
}
|
|
175
176
|
static open(opts) {
|
|
176
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
177
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
177
178
|
type: 'default'
|
|
178
179
|
}));
|
|
179
180
|
}
|
package/lib/es/select/index.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ export type SelectProps = {
|
|
|
139
139
|
onDeselect?: (value: SelectProps['value'], option: Record<string, any>) => void;
|
|
140
140
|
onSelect?: (value: SelectProps['value'], option: Record<string, any>) => void;
|
|
141
141
|
allowCreate?: boolean;
|
|
142
|
-
triggerRender?: (props
|
|
142
|
+
triggerRender?: (props: TriggerRenderProps) => React.ReactNode;
|
|
143
143
|
onClear?: () => void;
|
|
144
144
|
virtualize?: virtualListProps;
|
|
145
145
|
onFocus?: (e: React.FocusEvent) => void;
|
|
@@ -77,7 +77,7 @@ export interface TreeSelectProps extends Omit<BasicTreeSelectProps, OverrideComm
|
|
|
77
77
|
onSelect?: (selectedKey: string, selected: boolean, selectedNode: TreeNodeData) => void;
|
|
78
78
|
renderSelectedItem?: RenderSelectedItem;
|
|
79
79
|
getPopupContainer?: () => HTMLElement;
|
|
80
|
-
triggerRender?: (props
|
|
80
|
+
triggerRender?: (props: TriggerRenderProps) => React.ReactNode;
|
|
81
81
|
onBlur?: (e: React.MouseEvent) => void;
|
|
82
82
|
onChange?: OnChange;
|
|
83
83
|
onFocus?: (e: React.MouseEvent) => void;
|
|
@@ -190,7 +190,6 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
190
190
|
triggerRef: React.RefObject<HTMLDivElement>;
|
|
191
191
|
optionsRef: React.RefObject<any>;
|
|
192
192
|
clickOutsideHandler: any;
|
|
193
|
-
_flattenNodes: TreeState['flattenNodes'];
|
|
194
193
|
onNodeClick: any;
|
|
195
194
|
onNodeDoubleClick: any;
|
|
196
195
|
onMotionEnd: any;
|
|
@@ -247,6 +246,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
247
246
|
};
|
|
248
247
|
getTreeNodeKey: (treeNode: TreeNodeData) => string;
|
|
249
248
|
handlePopoverClose: (isVisible: any) => void;
|
|
249
|
+
afterClose: () => void;
|
|
250
250
|
renderTreeNode: (treeNode: FlattenNode, ind: number, style: React.CSSProperties) => JSX.Element;
|
|
251
251
|
itemKey: (index: number, data: Record<string, any>) => any;
|
|
252
252
|
renderNodeList: () => JSX.Element;
|