@douyinfe/semi-ui 2.50.0-alpha.1 → 2.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/semi.css +3 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +523 -416
- 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/image/interface.d.ts +3 -3
- package/lib/cjs/image/previewFooter.js +5 -8
- package/lib/cjs/image/previewHeader.d.ts +2 -2
- package/lib/cjs/image/previewHeader.js +9 -8
- package/lib/cjs/image/previewImage.d.ts +1 -12
- package/lib/cjs/image/previewImage.js +23 -83
- package/lib/cjs/image/previewInner.d.ts +12 -3
- package/lib/cjs/image/previewInner.js +65 -44
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +14 -0
- package/lib/cjs/notification/index.js +6 -5
- package/lib/cjs/select/index.d.ts +1 -1
- package/lib/cjs/timePicker/TimePicker.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/image/interface.d.ts +3 -3
- package/lib/es/image/previewFooter.js +5 -8
- package/lib/es/image/previewHeader.d.ts +2 -2
- package/lib/es/image/previewHeader.js +4 -3
- package/lib/es/image/previewImage.d.ts +1 -12
- package/lib/es/image/previewImage.js +23 -83
- package/lib/es/image/previewInner.d.ts +12 -3
- package/lib/es/image/previewInner.js +65 -44
- package/lib/es/index.d.ts +2 -0
- package/lib/es/index.js +2 -0
- package/lib/es/notification/index.js +6 -5
- package/lib/es/select/index.d.ts +1 -1
- package/lib/es/timePicker/TimePicker.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
package/lib/cjs/index.js
CHANGED
|
@@ -51,6 +51,18 @@ Object.defineProperty(exports, "Banner", {
|
|
|
51
51
|
return _banner.default;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
+
Object.defineProperty(exports, "BaseComponent", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _baseComponent.default;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "BaseFoundation", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _foundation.default;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
54
66
|
Object.defineProperty(exports, "Breadcrumb", {
|
|
55
67
|
enumerable: true,
|
|
56
68
|
get: function () {
|
|
@@ -562,6 +574,8 @@ Object.defineProperty(exports, "withFormState", {
|
|
|
562
574
|
}
|
|
563
575
|
});
|
|
564
576
|
require("./_base/base.css");
|
|
577
|
+
var _foundation = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/base/foundation"));
|
|
578
|
+
var _baseComponent = _interopRequireDefault(require("./_base/baseComponent"));
|
|
565
579
|
var _anchor = _interopRequireDefault(require("./anchor"));
|
|
566
580
|
var _autoComplete = _interopRequireDefault(require("./autoComplete"));
|
|
567
581
|
var _avatar = _interopRequireDefault(require("./avatar"));
|
|
@@ -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;
|
|
@@ -63,7 +63,7 @@ export type TimePickerProps = {
|
|
|
63
63
|
secondStep?: number;
|
|
64
64
|
showClear?: boolean;
|
|
65
65
|
size?: InputSize;
|
|
66
|
-
stopPropagation
|
|
66
|
+
stopPropagation?: boolean;
|
|
67
67
|
style?: React.CSSProperties;
|
|
68
68
|
timeZone?: string | number;
|
|
69
69
|
triggerRender?: (props?: any) => React.ReactNode;
|
|
@@ -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;
|
|
@@ -191,7 +191,6 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
191
191
|
triggerRef: React.RefObject<HTMLDivElement>;
|
|
192
192
|
optionsRef: React.RefObject<any>;
|
|
193
193
|
clickOutsideHandler: any;
|
|
194
|
-
_flattenNodes: TreeState['flattenNodes'];
|
|
195
194
|
onNodeClick: any;
|
|
196
195
|
onNodeDoubleClick: any;
|
|
197
196
|
onMotionEnd: any;
|
|
@@ -248,6 +247,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
248
247
|
};
|
|
249
248
|
getTreeNodeKey: (treeNode: TreeNodeData) => string;
|
|
250
249
|
handlePopoverClose: (isVisible: any) => void;
|
|
250
|
+
afterClose: () => void;
|
|
251
251
|
renderTreeNode: (treeNode: FlattenNode, ind: number, style: React.CSSProperties) => JSX.Element;
|
|
252
252
|
itemKey: (index: number, data: Record<string, any>) => any;
|
|
253
253
|
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,
|
|
@@ -732,6 +746,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
732
746
|
this.renderNodeList = () => {
|
|
733
747
|
const {
|
|
734
748
|
flattenNodes,
|
|
749
|
+
cachedFlattenNodes,
|
|
735
750
|
motionKeys,
|
|
736
751
|
motionType,
|
|
737
752
|
filteredKeys
|
|
@@ -747,7 +762,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
747
762
|
if (!virtualize || (0, _isEmpty2.default)(virtualize)) {
|
|
748
763
|
return /*#__PURE__*/_react.default.createElement(_nodeList.default, {
|
|
749
764
|
flattenNodes: flattenNodes,
|
|
750
|
-
flattenList:
|
|
765
|
+
flattenList: cachedFlattenNodes,
|
|
751
766
|
motionKeys: motionExpand ? motionKeys : new Set([]),
|
|
752
767
|
motionType: motionType,
|
|
753
768
|
// When motionKeys is empty, but filteredKeys is not empty (that is, the search hits), this situation should be distinguished from ordinary motionKeys
|
|
@@ -866,6 +881,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
866
881
|
keyEntities: {},
|
|
867
882
|
treeData: [],
|
|
868
883
|
flattenNodes: [],
|
|
884
|
+
cachedFlattenNodes: undefined,
|
|
869
885
|
selectedKeys: [],
|
|
870
886
|
checkedKeys: new Set(),
|
|
871
887
|
halfCheckedKeys: new Set(),
|
|
@@ -895,6 +911,7 @@ class TreeSelect extends _baseComponent.default {
|
|
|
895
911
|
};
|
|
896
912
|
}
|
|
897
913
|
static getDerivedStateFromProps(props, prevState) {
|
|
914
|
+
var _a;
|
|
898
915
|
const {
|
|
899
916
|
prevProps,
|
|
900
917
|
rePosKey
|
|
@@ -912,6 +929,8 @@ class TreeSelect extends _baseComponent.default {
|
|
|
912
929
|
};
|
|
913
930
|
const needUpdateTreeData = needUpdate('treeData');
|
|
914
931
|
const needUpdateExpandedKeys = needUpdate('expandedKeys');
|
|
932
|
+
const isExpandControlled = ('expandedKeys' in props);
|
|
933
|
+
const isSearching = Boolean(props.filterTreeNode && prevState.inputValue && prevState.inputValue.length);
|
|
915
934
|
// TreeNode
|
|
916
935
|
if (needUpdateTreeData) {
|
|
917
936
|
treeData = props.treeData;
|
|
@@ -930,31 +949,97 @@ class TreeSelect extends _baseComponent.default {
|
|
|
930
949
|
}
|
|
931
950
|
}
|
|
932
951
|
const expandAllWhenDataChange = needUpdateTreeData && props.expandAll;
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
952
|
+
if (!isSearching) {
|
|
953
|
+
// expandedKeys
|
|
954
|
+
if (needUpdateExpandedKeys || prevProps && needUpdate('autoExpandParent')) {
|
|
955
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
|
|
956
|
+
// only show animation when treeData does not change
|
|
957
|
+
if (prevProps && props.motion && !treeData) {
|
|
958
|
+
const {
|
|
959
|
+
motionKeys,
|
|
960
|
+
motionType
|
|
961
|
+
} = (0, _treeUtil.calcMotionKeys)(prevState.expandedKeys, newState.expandedKeys, keyEntities);
|
|
962
|
+
newState.motionKeys = new Set(motionKeys);
|
|
963
|
+
newState.motionType = motionType;
|
|
964
|
+
if (motionType === 'hide') {
|
|
965
|
+
// cache flatten nodes: expandedKeys changed may not be triggered by interaction
|
|
966
|
+
newState.cachedFlattenNodes = (0, _treeUtil2.cloneDeep)(prevState.flattenNodes);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
} else if (!prevProps && (props.defaultExpandAll || props.expandAll) || expandAllWhenDataChange) {
|
|
970
|
+
newState.expandedKeys = new Set(Object.keys(keyEntities));
|
|
971
|
+
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
972
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.defaultExpandedKeys, keyEntities);
|
|
973
|
+
} else if (!prevProps && props.defaultValue) {
|
|
974
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.defaultValue, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
975
|
+
} else if (!prevProps && props.value) {
|
|
976
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
977
|
+
} else if (!isExpandControlled && needUpdateTreeData && props.value) {
|
|
978
|
+
// 当 treeData 已经设置具体的值,并且设置了 props.loadData ,则认为 treeData 的更新是因为 loadData 导致的
|
|
979
|
+
// 如果是因为 loadData 导致 treeData改变, 此时在这里重新计算 key 会导致为未选中的展开项目被收起
|
|
980
|
+
// 所以此时不需要重新计算 expandedKeys,因为在点击展开按钮时候已经把被展开的项添加到 expandedKeys 中
|
|
981
|
+
// When treeData has a specific value and props.loadData is set, it is considered that the update of treeData is caused by loadData
|
|
982
|
+
// If the treeData is changed because of loadData, recalculating the key here will cause the unselected expanded items to be collapsed
|
|
983
|
+
// 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
|
|
984
|
+
if (!(prevState.treeData && ((_a = prevState.treeData) === null || _a === void 0 ? void 0 : _a.length) > 0 && props.loadData)) {
|
|
985
|
+
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)(props.value, keyEntities, props.multiple, valueEntities);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
if (!newState.expandedKeys) {
|
|
989
|
+
delete newState.expandedKeys;
|
|
990
|
+
}
|
|
991
|
+
if (treeData || newState.expandedKeys) {
|
|
992
|
+
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, keyMaps);
|
|
993
|
+
newState.flattenNodes = flattenNodes;
|
|
994
|
+
}
|
|
995
|
+
} else {
|
|
996
|
+
let filteredState;
|
|
997
|
+
// treeData changed while searching
|
|
998
|
+
if (treeData) {
|
|
999
|
+
// Get filter data
|
|
1000
|
+
filteredState = (0, _treeUtil.filterTreeData)({
|
|
1001
|
+
treeData,
|
|
1002
|
+
inputValue: prevState.inputValue,
|
|
1003
|
+
filterTreeNode: props.filterTreeNode,
|
|
1004
|
+
filterProps: props.treeNodeFilterProp,
|
|
1005
|
+
showFilteredOnly: props.showFilteredOnly,
|
|
1006
|
+
keyEntities: newState.keyEntities,
|
|
1007
|
+
prevExpandedKeys: [...prevState.filteredExpandedKeys],
|
|
1008
|
+
keyMaps: keyMaps
|
|
1009
|
+
});
|
|
1010
|
+
newState.flattenNodes = filteredState.flattenNodes;
|
|
1011
|
+
newState.motionKeys = new Set([]);
|
|
1012
|
+
newState.filteredKeys = filteredState.filteredKeys;
|
|
1013
|
+
newState.filteredShownKeys = filteredState.filteredShownKeys;
|
|
1014
|
+
newState.filteredExpandedKeys = filteredState.filteredExpandedKeys;
|
|
1015
|
+
}
|
|
1016
|
+
// expandedKeys changed while searching
|
|
1017
|
+
if (props.expandedKeys) {
|
|
1018
|
+
newState.filteredExpandedKeys = (0, _treeUtil.calcExpandedKeys)(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
|
|
1019
|
+
if (prevProps && props.motion) {
|
|
1020
|
+
const prevKeys = prevState ? prevState.filteredExpandedKeys : new Set([]);
|
|
1021
|
+
// only show animation when treeData does not change
|
|
1022
|
+
if (!treeData) {
|
|
1023
|
+
const motionResult = (0, _treeUtil.calcMotionKeys)(prevKeys, newState.filteredExpandedKeys, keyEntities);
|
|
1024
|
+
let {
|
|
1025
|
+
motionKeys
|
|
1026
|
+
} = motionResult;
|
|
1027
|
+
const {
|
|
1028
|
+
motionType
|
|
1029
|
+
} = motionResult;
|
|
1030
|
+
if (props.showFilteredOnly) {
|
|
1031
|
+
motionKeys = motionKeys.filter(key => prevState.filteredShownKeys.has(key));
|
|
1032
|
+
}
|
|
1033
|
+
if (motionType === 'hide') {
|
|
1034
|
+
// cache flatten nodes: expandedKeys changed may not be triggered by interaction
|
|
1035
|
+
newState.cachedFlattenNodes = (0, _treeUtil2.cloneDeep)(prevState.flattenNodes);
|
|
1036
|
+
}
|
|
1037
|
+
newState.motionKeys = new Set(motionKeys);
|
|
1038
|
+
newState.motionType = motionType;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
newState.flattenNodes = (0, _treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.filteredExpandedKeys || prevState.filteredExpandedKeys, keyMaps, props.showFilteredOnly && prevState.filteredShownKeys);
|
|
944
1042
|
}
|
|
945
|
-
} else if (!prevProps && (props.defaultExpandAll || props.expandAll) || expandAllWhenDataChange) {
|
|
946
|
-
newState.expandedKeys = new Set(Object.keys(keyEntities));
|
|
947
|
-
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
948
|
-
newState.expandedKeys = (0, _treeUtil.calcExpandedKeys)(props.defaultExpandedKeys, keyEntities);
|
|
949
|
-
} else if (!prevProps && props.defaultValue) {
|
|
950
|
-
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.defaultValue, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
951
|
-
} else if (!prevProps && props.value) {
|
|
952
|
-
newState.expandedKeys = (0, _treeUtil.calcExpandedKeysForValues)((0, _treeUtil.normalizeValue)(props.value, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
953
|
-
}
|
|
954
|
-
// flattenNodes
|
|
955
|
-
if (treeData || needUpdateExpandedKeys) {
|
|
956
|
-
const flattenNodes = (0, _treeUtil.flattenTreeData)(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, keyMaps);
|
|
957
|
-
newState.flattenNodes = flattenNodes;
|
|
958
1043
|
}
|
|
959
1044
|
// selectedKeys: single mode controlled
|
|
960
1045
|
const isMultiple = props.multiple;
|
|
@@ -1061,7 +1146,9 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1061
1146
|
this.props.onSearch && this.props.onSearch(input, filteredExpandedKeys);
|
|
1062
1147
|
},
|
|
1063
1148
|
cacheFlattenNodes: bool => {
|
|
1064
|
-
this.
|
|
1149
|
+
this.setState({
|
|
1150
|
+
cachedFlattenNodes: bool ? (0, _treeUtil2.cloneDeep)(this.state.flattenNodes) : undefined
|
|
1151
|
+
});
|
|
1065
1152
|
},
|
|
1066
1153
|
notifyLoad: (newLoadedKeys, data) => {
|
|
1067
1154
|
const {
|
|
@@ -1206,7 +1293,8 @@ class TreeSelect extends _baseComponent.default {
|
|
|
1206
1293
|
autoAdjustOverflow: autoAdjustOverflow,
|
|
1207
1294
|
mouseLeaveDelay: mouseLeaveDelay,
|
|
1208
1295
|
mouseEnterDelay: mouseEnterDelay,
|
|
1209
|
-
onVisibleChange: this.handlePopoverClose
|
|
1296
|
+
onVisibleChange: this.handlePopoverClose,
|
|
1297
|
+
afterClose: this.afterClose
|
|
1210
1298
|
}, selection);
|
|
1211
1299
|
}
|
|
1212
1300
|
}
|
|
@@ -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;
|
|
@@ -53,6 +53,8 @@ export interface PreviewProps extends BaseProps {
|
|
|
53
53
|
zIndex?: number;
|
|
54
54
|
children?: ReactNode;
|
|
55
55
|
crossOrigin?: "anonymous" | "use-credentials";
|
|
56
|
+
maxZoom?: number;
|
|
57
|
+
minZoom?: number;
|
|
56
58
|
renderHeader?: (info: any) => ReactNode;
|
|
57
59
|
renderPreviewMenu?: (props: MenuProps) => ReactNode;
|
|
58
60
|
getPopupContainer?: () => HTMLElement;
|
|
@@ -138,14 +140,12 @@ export interface FooterProps extends SliderProps {
|
|
|
138
140
|
onRotate?: (direction: string) => void;
|
|
139
141
|
onDownload?: () => void;
|
|
140
142
|
renderPreviewMenu?: (props: MenuProps) => ReactNode;
|
|
143
|
+
forwardRef?: React.RefObject<HTMLElement>;
|
|
141
144
|
}
|
|
142
145
|
export interface PreviewImageProps {
|
|
143
146
|
src?: string;
|
|
144
147
|
rotation?: number;
|
|
145
148
|
style?: React.CSSProperties;
|
|
146
|
-
maxZoom?: number;
|
|
147
|
-
minZoom?: number;
|
|
148
|
-
zoomStep?: number;
|
|
149
149
|
zoom?: number;
|
|
150
150
|
ratio?: RatioType;
|
|
151
151
|
disableDownload?: boolean;
|
|
@@ -12,14 +12,9 @@ import PreviewFooterFoundation from '@douyinfe/semi-foundation/lib/es/image/prev
|
|
|
12
12
|
import LocaleConsumer from "../locale/localeConsumer";
|
|
13
13
|
const prefixCls = cssClasses.PREFIX;
|
|
14
14
|
const footerPrefixCls = `${cssClasses.PREFIX}-preview-footer`;
|
|
15
|
-
let mouseActiveTime = 0;
|
|
16
15
|
export default class Footer extends BaseComponent {
|
|
17
16
|
get adapter() {
|
|
18
|
-
return Object.assign(
|
|
19
|
-
setStartMouseOffset: time => {
|
|
20
|
-
mouseActiveTime = time;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
17
|
+
return Object.assign({}, super.adapter);
|
|
23
18
|
}
|
|
24
19
|
constructor(props) {
|
|
25
20
|
super(props);
|
|
@@ -259,13 +254,15 @@ export default class Footer extends BaseComponent {
|
|
|
259
254
|
render() {
|
|
260
255
|
const {
|
|
261
256
|
className,
|
|
262
|
-
renderPreviewMenu
|
|
257
|
+
renderPreviewMenu,
|
|
258
|
+
forwardRef
|
|
263
259
|
} = this.props;
|
|
264
260
|
const menuCls = cls(footerPrefixCls, `${footerPrefixCls}-wrapper`, className, {
|
|
265
261
|
[`${footerPrefixCls}-content`]: !Boolean(renderPreviewMenu)
|
|
266
262
|
});
|
|
267
263
|
return /*#__PURE__*/React.createElement("section", {
|
|
268
|
-
className: menuCls
|
|
264
|
+
className: menuCls,
|
|
265
|
+
ref: forwardRef
|
|
269
266
|
}, renderPreviewMenu ? this.customRenderViewMenu() : this.getFooterMenu());
|
|
270
267
|
}
|
|
271
268
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { HeaderProps } from "./interface";
|
|
3
|
-
declare const Header: React.
|
|
3
|
+
declare const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLElement>>;
|
|
4
4
|
export default Header;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
2
|
import { IconClose } from "@douyinfe/semi-icons";
|
|
3
3
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/image/constants';
|
|
4
4
|
import cls from "classnames";
|
|
5
5
|
import { PreviewContext } from "./previewContext";
|
|
6
6
|
const prefixCls = `${cssClasses.PREFIX}-preview-header`;
|
|
7
|
-
const Header = _ref => {
|
|
7
|
+
const Header = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
8
8
|
let {
|
|
9
9
|
onClose,
|
|
10
10
|
titleStyle,
|
|
@@ -21,6 +21,7 @@ const Header = _ref => {
|
|
|
21
21
|
title = titles[currentIndex];
|
|
22
22
|
}
|
|
23
23
|
return /*#__PURE__*/React.createElement("section", {
|
|
24
|
+
ref: ref,
|
|
24
25
|
className: cls(prefixCls, className)
|
|
25
26
|
}, /*#__PURE__*/React.createElement("section", {
|
|
26
27
|
className: `${prefixCls}-title`,
|
|
@@ -30,5 +31,5 @@ const Header = _ref => {
|
|
|
30
31
|
onMouseUp: onClose
|
|
31
32
|
}, /*#__PURE__*/React.createElement(IconClose, null)));
|
|
32
33
|
});
|
|
33
|
-
};
|
|
34
|
+
});
|
|
34
35
|
export default Header;
|
|
@@ -8,9 +8,6 @@ export default class PreviewImage extends BaseComponent<PreviewImageProps, Previ
|
|
|
8
8
|
src: PropTypes.Requireable<string>;
|
|
9
9
|
rotation: PropTypes.Requireable<number>;
|
|
10
10
|
style: PropTypes.Requireable<object>;
|
|
11
|
-
maxZoom: PropTypes.Requireable<number>;
|
|
12
|
-
minZoom: PropTypes.Requireable<number>;
|
|
13
|
-
zoomStep: PropTypes.Requireable<number>;
|
|
14
11
|
zoom: PropTypes.Requireable<number>;
|
|
15
12
|
ratio: PropTypes.Requireable<string>;
|
|
16
13
|
disableDownload: PropTypes.Requireable<boolean>;
|
|
@@ -21,29 +18,21 @@ export default class PreviewImage extends BaseComponent<PreviewImageProps, Previ
|
|
|
21
18
|
onError: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
19
|
};
|
|
23
20
|
static defaultProps: {
|
|
24
|
-
maxZoom: number;
|
|
25
|
-
minZoom: number;
|
|
26
|
-
zoomStep: number;
|
|
27
21
|
zoom: any;
|
|
28
22
|
};
|
|
29
23
|
get adapter(): PreviewImageAdapter<PreviewImageProps, PreviewImageStates>;
|
|
30
24
|
containerRef: React.RefObject<HTMLDivElement>;
|
|
31
|
-
imageRef: HTMLImageElement
|
|
25
|
+
imageRef: React.RefObject<HTMLImageElement>;
|
|
32
26
|
foundation: PreviewImageFoundation;
|
|
33
27
|
constructor(props: any);
|
|
34
28
|
componentDidMount(): void;
|
|
35
29
|
componentWillUnmount(): void;
|
|
36
30
|
componentDidUpdate(prevProps: PreviewImageProps, prevStates: PreviewImageStates): void;
|
|
37
31
|
onWindowResize: () => void;
|
|
38
|
-
handleZoomChange: (newZoom: any, e: any) => void;
|
|
39
32
|
handleRightClickImage: (e: any) => void;
|
|
40
|
-
handleWheel: (e: any) => void;
|
|
41
33
|
handleLoad: (e: any) => void;
|
|
42
34
|
handleError: (e: any) => void;
|
|
43
|
-
resizeImage: () => void;
|
|
44
35
|
handleMoveImage: (e: any) => void;
|
|
45
|
-
registryImageRef: (ref: any) => void;
|
|
46
36
|
onImageMouseDown: (e: React.MouseEvent<HTMLImageElement>) => void;
|
|
47
|
-
onImageMouseUp: () => void;
|
|
48
37
|
render(): JSX.Element;
|
|
49
38
|
}
|