@douyinfe/semi-ui 2.1.0-next.0 → 2.1.0-next.1
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 +44750 -42235
- 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/_utils/index.js +10 -6
- package/lib/cjs/anchor/index.js +11 -7
- package/lib/cjs/autoComplete/index.d.ts +36 -11
- package/lib/cjs/autoComplete/index.js +12 -10
- package/lib/cjs/avatar/avatarGroup.js +9 -5
- package/lib/cjs/badge/index.js +6 -4
- package/lib/cjs/breadcrumb/index.js +5 -5
- package/lib/cjs/breadcrumb/item.js +8 -4
- package/lib/cjs/button/index.d.ts +0 -1
- package/lib/cjs/button/index.js +1 -2
- package/lib/cjs/calendar/dayCalendar.js +4 -4
- package/lib/cjs/calendar/monthCalendar.js +4 -4
- package/lib/cjs/calendar/rangeCalendar.js +4 -4
- package/lib/cjs/calendar/weekCalendar.js +4 -4
- package/lib/cjs/card/index.js +6 -4
- package/lib/cjs/cascader/index.d.ts +1 -0
- package/lib/cjs/cascader/index.js +45 -23
- package/lib/cjs/cascader/item.js +3 -5
- package/lib/cjs/checkbox/checkbox.js +11 -7
- package/lib/cjs/checkbox/checkboxGroup.js +3 -3
- package/lib/cjs/checkbox/checkboxInner.js +4 -4
- package/lib/cjs/collapse/index.js +4 -8
- package/lib/cjs/collapsible/index.js +4 -1
- package/lib/cjs/datePicker/datePicker.js +29 -21
- package/lib/cjs/datePicker/footer.js +4 -4
- package/lib/cjs/datePicker/month.js +12 -8
- package/lib/cjs/datePicker/monthsGrid.js +6 -4
- package/lib/cjs/datePicker/navigation.js +7 -7
- package/lib/cjs/datePicker/yearAndMonth.d.ts +2 -2
- package/lib/cjs/datePicker/yearAndMonth.js +7 -5
- package/lib/cjs/descriptions/index.js +3 -3
- package/lib/cjs/dropdown/dropdownItem.js +5 -5
- package/lib/cjs/dropdown/index.js +6 -4
- package/lib/cjs/form/arrayField.js +7 -5
- package/lib/cjs/form/baseForm.d.ts +5 -11
- package/lib/cjs/form/baseForm.js +8 -9
- package/lib/cjs/form/field.d.ts +5 -23
- package/lib/cjs/form/field.js +2 -18
- package/lib/cjs/form/group.js +3 -3
- package/lib/cjs/form/hoc/withField.d.ts +1 -1
- package/lib/cjs/form/hoc/withField.js +0 -3
- package/lib/cjs/form/slot.js +10 -6
- package/lib/cjs/iconButton/index.d.ts +0 -1
- package/lib/cjs/iconButton/index.js +4 -5
- package/lib/cjs/input/index.js +20 -16
- package/lib/cjs/input/inputGroup.js +4 -4
- package/lib/cjs/input/textarea.js +16 -12
- package/lib/cjs/inputNumber/index.js +15 -13
- package/lib/cjs/list/index.js +4 -4
- package/lib/cjs/list/item.js +4 -4
- package/lib/cjs/locale/localeConsumer.d.ts +5 -5
- package/lib/cjs/locale/localeConsumer.js +4 -4
- package/lib/cjs/modal/Modal.js +6 -6
- package/lib/cjs/modal/ModalContent.js +4 -4
- package/lib/cjs/modal/confirm.js +3 -3
- package/lib/cjs/modal/useModal/HookModal.d.ts +3 -2
- package/lib/cjs/modal/useModal/HookModal.js +3 -3
- package/lib/cjs/navigation/CollapseButton.js +3 -3
- package/lib/cjs/navigation/Item.js +9 -7
- package/lib/cjs/navigation/SubNav.js +6 -4
- package/lib/cjs/navigation/index.d.ts +1 -1
- package/lib/cjs/navigation/index.js +15 -11
- package/lib/cjs/notification/index.d.ts +1 -1
- package/lib/cjs/notification/index.js +1 -1
- package/lib/cjs/notification/notice.js +6 -6
- package/lib/cjs/overflowList/index.js +15 -9
- package/lib/cjs/overflowList/intersectionObserver.js +6 -4
- package/lib/cjs/pagination/index.js +5 -5
- package/lib/cjs/popconfirm/index.d.ts +5 -1
- package/lib/cjs/popconfirm/index.js +18 -10
- package/lib/cjs/popover/Arrow.js +5 -5
- package/lib/cjs/popover/index.d.ts +3 -1
- package/lib/cjs/popover/index.js +5 -8
- package/lib/cjs/radio/context.d.ts +1 -1
- package/lib/cjs/radio/radio.d.ts +2 -2
- package/lib/cjs/radio/radio.js +4 -4
- package/lib/cjs/radio/radioGroup.d.ts +4 -4
- package/lib/cjs/radio/radioGroup.js +3 -3
- package/lib/cjs/radio/radioInner.js +3 -3
- package/lib/cjs/rating/index.d.ts +1 -1
- package/lib/cjs/resizeObserver/index.js +1 -0
- package/lib/cjs/scrollList/scrollItem.d.ts +12 -11
- package/lib/cjs/scrollList/scrollItem.js +34 -28
- package/lib/cjs/select/index.js +41 -26
- package/lib/cjs/select/option.js +5 -5
- package/lib/cjs/select/utils.d.ts +1 -1
- package/lib/cjs/select/utils.js +13 -7
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -1
- package/lib/cjs/sideSheet/SideSheetContent.js +3 -3
- package/lib/cjs/sideSheet/index.d.ts +3 -3
- package/lib/cjs/sideSheet/index.js +3 -3
- package/lib/cjs/slider/index.js +9 -7
- package/lib/cjs/space/index.js +13 -9
- package/lib/cjs/steps/basicStep.js +3 -3
- package/lib/cjs/steps/basicSteps.js +1 -1
- package/lib/cjs/steps/fillStep.js +3 -3
- package/lib/cjs/steps/fillSteps.js +2 -2
- package/lib/cjs/steps/index.js +3 -3
- package/lib/cjs/steps/navStep.js +3 -3
- package/lib/cjs/steps/navSteps.js +1 -1
- package/lib/cjs/switch/index.js +5 -5
- package/lib/cjs/table/Body/BaseRow.js +28 -16
- package/lib/cjs/table/Body/ExpandedRow.js +11 -7
- package/lib/cjs/table/Body/SectionRow.js +6 -4
- package/lib/cjs/table/Body/index.js +44 -32
- package/lib/cjs/table/ColGroup.js +4 -4
- package/lib/cjs/table/ColumnFilter.js +4 -4
- package/lib/cjs/table/ColumnSelection.js +3 -3
- package/lib/cjs/table/ColumnSorter.js +3 -3
- package/lib/cjs/table/CustomExpandIcon.js +8 -8
- package/lib/cjs/table/HeadTable.js +7 -5
- package/lib/cjs/table/ResizableTable.js +16 -12
- package/lib/cjs/table/Table.d.ts +1 -1
- package/lib/cjs/table/Table.js +76 -58
- package/lib/cjs/table/TableCell.js +28 -18
- package/lib/cjs/table/TableHeader.js +7 -5
- package/lib/cjs/table/TableHeaderRow.js +24 -18
- package/lib/cjs/table/TablePagination.js +7 -5
- package/lib/cjs/table/getColumns.js +6 -4
- package/lib/cjs/table/index.d.ts +1 -1
- package/lib/cjs/table/table-context.js +4 -4
- package/lib/cjs/table/utils.js +2 -2
- package/lib/cjs/tabs/TabBar.d.ts +4 -2
- package/lib/cjs/tabs/TabBar.js +14 -6
- package/lib/cjs/tabs/TabPane.d.ts +2 -1
- package/lib/cjs/tabs/TabPane.js +2 -1
- package/lib/cjs/tabs/TabPaneTransition.js +6 -6
- package/lib/cjs/tabs/index.d.ts +3 -1
- package/lib/cjs/tabs/index.js +95 -21
- package/lib/cjs/tabs/interface.d.ts +6 -1
- package/lib/cjs/tagInput/index.d.ts +3 -0
- package/lib/cjs/tagInput/index.js +34 -19
- package/lib/cjs/timePicker/Combobox.d.ts +10 -4
- package/lib/cjs/timePicker/Combobox.js +7 -6
- package/lib/cjs/timePicker/TimeInput.js +9 -9
- package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
- package/lib/cjs/timePicker/TimePicker.js +11 -9
- package/lib/cjs/timePicker/index.js +3 -3
- package/lib/cjs/toast/index.d.ts +1 -1
- package/lib/cjs/toast/toast.js +4 -4
- package/lib/cjs/tooltip/index.d.ts +3 -0
- package/lib/cjs/tooltip/index.js +30 -17
- package/lib/cjs/transfer/index.js +23 -15
- package/lib/cjs/tree/autoSizer.js +5 -5
- package/lib/cjs/tree/collapse.js +3 -3
- package/lib/cjs/tree/index.js +16 -10
- package/lib/cjs/tree/interface.d.ts +2 -2
- package/lib/cjs/tree/nodeList.js +3 -3
- package/lib/cjs/tree/treeNode.js +10 -6
- package/lib/cjs/tree/treeUtil.js +6 -4
- package/lib/cjs/treeSelect/index.d.ts +2 -11
- package/lib/cjs/treeSelect/index.js +31 -21
- package/lib/cjs/typography/base.d.ts +1 -1
- package/lib/cjs/typography/base.js +15 -9
- package/lib/cjs/typography/paragraph.d.ts +1 -1
- package/lib/cjs/typography/text.d.ts +1 -1
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/upload/fileCard.d.ts +3 -18
- package/lib/cjs/upload/index.d.ts +4 -57
- package/lib/cjs/upload/index.js +15 -15
- package/lib/cjs/upload/interface.d.ts +56 -0
- package/lib/cjs/upload/interface.js +7 -0
- package/lib/es/_utils/index.js +7 -5
- package/lib/es/anchor/index.js +8 -6
- package/lib/es/autoComplete/index.d.ts +36 -11
- package/lib/es/autoComplete/index.js +10 -9
- package/lib/es/avatar/avatarGroup.js +6 -4
- package/lib/es/badge/index.js +4 -3
- package/lib/es/breadcrumb/index.js +7 -4
- package/lib/es/breadcrumb/item.js +5 -3
- package/lib/es/button/index.d.ts +0 -1
- package/lib/es/button/index.js +1 -2
- package/lib/es/calendar/dayCalendar.js +3 -3
- package/lib/es/calendar/monthCalendar.js +3 -3
- package/lib/es/calendar/rangeCalendar.js +3 -3
- package/lib/es/calendar/weekCalendar.js +3 -3
- package/lib/es/card/index.js +5 -3
- package/lib/es/cascader/index.d.ts +1 -0
- package/lib/es/cascader/index.js +39 -22
- package/lib/es/cascader/item.js +2 -2
- package/lib/es/checkbox/checkbox.js +8 -6
- package/lib/es/checkbox/checkboxGroup.js +2 -2
- package/lib/es/checkbox/checkboxInner.js +4 -3
- package/lib/es/collapse/index.js +3 -7
- package/lib/es/collapsible/index.js +4 -1
- package/lib/es/datePicker/datePicker.js +26 -20
- package/lib/es/datePicker/footer.js +3 -3
- package/lib/es/datePicker/index.d.ts +1 -1
- package/lib/es/datePicker/month.js +11 -7
- package/lib/es/datePicker/monthsGrid.js +4 -3
- package/lib/es/datePicker/navigation.js +6 -6
- package/lib/es/datePicker/yearAndMonth.d.ts +2 -2
- package/lib/es/datePicker/yearAndMonth.js +5 -4
- package/lib/es/descriptions/index.js +2 -2
- package/lib/es/dropdown/dropdownItem.js +4 -4
- package/lib/es/dropdown/index.js +4 -3
- package/lib/es/form/arrayField.js +7 -4
- package/lib/es/form/baseForm.d.ts +5 -11
- package/lib/es/form/baseForm.js +7 -8
- package/lib/es/form/field.d.ts +5 -23
- package/lib/es/form/field.js +2 -18
- package/lib/es/form/group.js +2 -2
- package/lib/es/form/hoc/withField.d.ts +1 -1
- package/lib/es/form/hoc/withField.js +0 -3
- package/lib/es/form/slot.js +7 -5
- package/lib/es/iconButton/index.d.ts +0 -1
- package/lib/es/iconButton/index.js +3 -4
- package/lib/es/input/index.js +17 -15
- package/lib/es/input/inputGroup.js +3 -3
- package/lib/es/input/textarea.js +13 -11
- package/lib/es/inputNumber/index.js +13 -12
- package/lib/es/list/index.js +3 -3
- package/lib/es/list/item.js +3 -3
- package/lib/es/locale/localeConsumer.d.ts +5 -5
- package/lib/es/locale/localeConsumer.js +5 -3
- package/lib/es/modal/Modal.js +5 -5
- package/lib/es/modal/ModalContent.js +3 -3
- package/lib/es/modal/confirm.js +2 -2
- package/lib/es/modal/useModal/HookModal.d.ts +3 -2
- package/lib/es/modal/useModal/HookModal.js +3 -2
- package/lib/es/modal/useModal/index.js +1 -1
- package/lib/es/navigation/CollapseButton.js +2 -2
- package/lib/es/navigation/Item.js +7 -6
- package/lib/es/navigation/SubNav.js +4 -3
- package/lib/es/navigation/index.d.ts +1 -1
- package/lib/es/navigation/index.js +12 -10
- package/lib/es/notification/index.d.ts +1 -1
- package/lib/es/notification/index.js +1 -1
- package/lib/es/notification/notice.js +5 -5
- package/lib/es/overflowList/index.js +13 -8
- package/lib/es/overflowList/intersectionObserver.js +4 -3
- package/lib/es/pagination/index.js +4 -4
- package/lib/es/popconfirm/index.d.ts +5 -1
- package/lib/es/popconfirm/index.js +16 -9
- package/lib/es/popover/Arrow.js +7 -4
- 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/radio.js +3 -3
- package/lib/es/radio/radioGroup.d.ts +4 -4
- package/lib/es/radio/radioGroup.js +2 -2
- package/lib/es/radio/radioInner.js +2 -2
- package/lib/es/rating/index.d.ts +1 -1
- package/lib/es/resizeObserver/index.js +1 -0
- package/lib/es/scrollList/scrollItem.d.ts +12 -11
- package/lib/es/scrollList/scrollItem.js +32 -19
- package/lib/es/select/index.js +39 -27
- package/lib/es/select/option.js +6 -6
- package/lib/es/select/utils.d.ts +1 -1
- package/lib/es/select/utils.js +12 -8
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -1
- package/lib/es/sideSheet/SideSheetContent.js +2 -2
- package/lib/es/sideSheet/index.d.ts +3 -3
- package/lib/es/sideSheet/index.js +2 -2
- package/lib/es/slider/index.js +7 -6
- package/lib/es/space/index.js +10 -8
- package/lib/es/steps/basicStep.js +2 -2
- package/lib/es/steps/basicSteps.js +2 -2
- package/lib/es/steps/fillStep.js +2 -2
- package/lib/es/steps/fillSteps.js +3 -3
- package/lib/es/steps/index.js +2 -2
- package/lib/es/steps/navStep.js +2 -2
- package/lib/es/steps/navSteps.js +2 -2
- package/lib/es/switch/index.js +4 -4
- package/lib/es/table/Body/BaseRow.js +25 -15
- package/lib/es/table/Body/ExpandedRow.js +9 -6
- package/lib/es/table/Body/SectionRow.js +4 -3
- package/lib/es/table/Body/index.js +58 -31
- package/lib/es/table/ColGroup.js +4 -3
- package/lib/es/table/ColumnFilter.js +3 -3
- package/lib/es/table/ColumnSelection.js +2 -2
- package/lib/es/table/ColumnSorter.js +2 -2
- package/lib/es/table/CustomExpandIcon.js +8 -7
- package/lib/es/table/HeadTable.js +7 -4
- package/lib/es/table/ResizableTable.js +17 -9
- package/lib/es/table/Table.d.ts +1 -1
- package/lib/es/table/Table.js +69 -44
- package/lib/es/table/TableCell.js +24 -17
- package/lib/es/table/TableHeader.js +5 -4
- package/lib/es/table/TableHeaderRow.js +24 -11
- package/lib/es/table/TablePagination.js +7 -4
- package/lib/es/table/getColumns.js +5 -4
- package/lib/es/table/index.d.ts +1 -1
- package/lib/es/table/table-context.js +4 -3
- package/lib/es/table/utils.js +2 -2
- package/lib/es/tabs/TabBar.d.ts +4 -2
- package/lib/es/tabs/TabBar.js +14 -6
- package/lib/es/tabs/TabPane.d.ts +2 -1
- package/lib/es/tabs/TabPane.js +3 -2
- package/lib/es/tabs/TabPaneTransition.js +5 -5
- package/lib/es/tabs/index.d.ts +3 -1
- package/lib/es/tabs/index.js +90 -19
- package/lib/es/tabs/interface.d.ts +6 -1
- package/lib/es/tagInput/index.d.ts +3 -0
- package/lib/es/tagInput/index.js +28 -18
- package/lib/es/timePicker/Combobox.d.ts +10 -4
- package/lib/es/timePicker/Combobox.js +6 -5
- package/lib/es/timePicker/TimeInput.js +8 -8
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/timePicker/TimePicker.js +9 -8
- package/lib/es/timePicker/index.js +2 -2
- package/lib/es/toast/index.d.ts +1 -1
- package/lib/es/toast/toast.js +3 -3
- package/lib/es/tooltip/index.d.ts +3 -0
- package/lib/es/tooltip/index.js +35 -16
- package/lib/es/transfer/index.js +16 -11
- package/lib/es/tree/autoSizer.js +4 -4
- package/lib/es/tree/collapse.js +2 -2
- package/lib/es/tree/index.js +12 -9
- package/lib/es/tree/interface.d.ts +2 -2
- package/lib/es/tree/nodeList.js +2 -2
- package/lib/es/tree/treeNode.js +7 -5
- package/lib/es/tree/treeUtil.js +4 -3
- package/lib/es/treeSelect/index.d.ts +2 -11
- package/lib/es/treeSelect/index.js +28 -20
- package/lib/es/typography/base.d.ts +1 -1
- package/lib/es/typography/base.js +17 -8
- package/lib/es/typography/paragraph.d.ts +1 -1
- package/lib/es/typography/text.d.ts +1 -1
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/upload/fileCard.d.ts +3 -18
- package/lib/es/upload/index.d.ts +4 -57
- package/lib/es/upload/index.js +14 -14
- package/lib/es/upload/interface.d.ts +56 -0
- package/lib/es/upload/interface.js +1 -0
- package/package.json +12 -9
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import _isPlainObject from "lodash/isPlainObject";
|
|
2
|
+
import _cloneDeepWith from "lodash/cloneDeepWith";
|
|
1
3
|
import React from 'react';
|
|
2
|
-
import { cloneDeepWith, isPlainObject } from 'lodash-es';
|
|
3
4
|
export function cloneDeep(treeNodeList) {
|
|
4
|
-
return
|
|
5
|
+
return _cloneDeepWith(treeNodeList, val => {
|
|
5
6
|
// only clone treeNode inner data and skip user data
|
|
6
|
-
if (
|
|
7
|
+
if (_isPlainObject(val) && !val._innerDataTag) {
|
|
7
8
|
return val;
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -27,16 +27,7 @@ export declare type RenderSelectedItemInMultiple = (treeNode: TreeNodeData, othe
|
|
|
27
27
|
isRenderInTag: boolean;
|
|
28
28
|
content: React.ReactNode;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
31
|
-
(treeNode: TreeNodeData): React.ReactNode;
|
|
32
|
-
(treeNode: TreeNodeData, otherProps: {
|
|
33
|
-
index: number | string;
|
|
34
|
-
onClose: (tagContent: any, e: React.MouseEvent) => void;
|
|
35
|
-
}): {
|
|
36
|
-
isRenderInTag: boolean;
|
|
37
|
-
content: React.ReactNode;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
30
|
+
export declare type RenderSelectedItem = RenderSelectedItemInSingle | RenderSelectedItemInMultiple;
|
|
40
31
|
export declare type OverrideCommonProps = 'renderFullLabel' | 'renderLabel' | 'defaultValue' | 'emptyContent' | 'filterTreeNode' | 'style' | 'treeData' | 'value' | 'onExpand';
|
|
41
32
|
/**
|
|
42
33
|
* Type definition description:
|
|
@@ -205,7 +196,7 @@ declare class TreeSelect extends BaseComponent<TreeSelectProps, TreeSelectState>
|
|
|
205
196
|
renderArrow: () => JSX.Element;
|
|
206
197
|
renderClearBtn: () => JSX.Element;
|
|
207
198
|
renderSelection: () => JSX.Element;
|
|
208
|
-
renderTagItem: (key: string, idx: number) =>
|
|
199
|
+
renderTagItem: (key: string, idx: number) => React.ReactNode;
|
|
209
200
|
renderTagInput: () => JSX.Element;
|
|
210
201
|
renderInput: () => JSX.Element;
|
|
211
202
|
renderEmpty: () => JSX.Element;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import _isFunction from "lodash/isFunction";
|
|
2
|
+
import _get from "lodash/get";
|
|
3
|
+
import _noop from "lodash/noop";
|
|
4
|
+
import _isEmpty from "lodash/isEmpty";
|
|
5
|
+
import _isString from "lodash/isString";
|
|
6
|
+
import _isEqual from "lodash/isEqual";
|
|
1
7
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
8
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
3
9
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
@@ -9,7 +15,6 @@ import React, { Fragment } from 'react';
|
|
|
9
15
|
import ReactDOM from 'react-dom';
|
|
10
16
|
import cls from 'classnames';
|
|
11
17
|
import PropTypes from 'prop-types';
|
|
12
|
-
import { isEqual, isString, isEmpty, noop, get, isFunction } from 'lodash-es';
|
|
13
18
|
import TreeSelectFoundation from '@douyinfe/semi-foundation/lib/es/treeSelect/foundation';
|
|
14
19
|
import { convertDataToEntities, flattenTreeData, calcExpandedKeysForValues, calcMotionKeys, findKeysForValues, calcCheckedKeys, calcExpandedKeys, getValueOrKey, normalizeKeyList, calcDisabledKeys, normalizeValue } from '@douyinfe/semi-foundation/lib/es/tree/treeUtil';
|
|
15
20
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/treeSelect/constants';
|
|
@@ -47,7 +52,7 @@ class TreeSelect extends BaseComponent {
|
|
|
47
52
|
} = this.props;
|
|
48
53
|
const suffixWrapperCls = cls({
|
|
49
54
|
["".concat(prefixcls, "-suffix")]: true,
|
|
50
|
-
["".concat(prefixcls, "-suffix-text")]: suffix &&
|
|
55
|
+
["".concat(prefixcls, "-suffix-text")]: suffix && _isString(suffix),
|
|
51
56
|
["".concat(prefixcls, "-suffix-icon")]: isSemiIcon(suffix)
|
|
52
57
|
});
|
|
53
58
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -65,7 +70,7 @@ class TreeSelect extends BaseComponent {
|
|
|
65
70
|
["".concat(prefixcls, "-prefix")]: true,
|
|
66
71
|
// to be doublechecked
|
|
67
72
|
["".concat(prefixcls, "-inset-label")]: insetLabel,
|
|
68
|
-
["".concat(prefixcls, "-prefix-text")]: labelNode &&
|
|
73
|
+
["".concat(prefixcls, "-prefix-text")]: labelNode && _isString(labelNode),
|
|
69
74
|
["".concat(prefixcls, "-prefix-icon")]: isSemiIcon(labelNode)
|
|
70
75
|
});
|
|
71
76
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -139,9 +144,9 @@ class TreeSelect extends BaseComponent {
|
|
|
139
144
|
size,
|
|
140
145
|
renderSelectedItem: propRenderSelectedItem
|
|
141
146
|
} = this.props;
|
|
142
|
-
const renderSelectedItem =
|
|
147
|
+
const renderSelectedItem = _isFunction(propRenderSelectedItem) ? propRenderSelectedItem : item => ({
|
|
143
148
|
isRenderInTag: true,
|
|
144
|
-
content:
|
|
149
|
+
content: _get(item, treeNodeLabelProp, null)
|
|
145
150
|
});
|
|
146
151
|
const renderKeys = normalizeKeyList([...checkedKeys], keyEntities, leafOnly);
|
|
147
152
|
const tagList = []; // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
@@ -348,8 +353,10 @@ class TreeSelect extends BaseComponent {
|
|
|
348
353
|
onMouseLeave: e => this.handleMouseLeave(e)
|
|
349
354
|
} : {};
|
|
350
355
|
const isTriggerPositionSearch = searchPosition === strings.SEARCH_POSITION_TRIGGER && filterable;
|
|
351
|
-
|
|
352
|
-
const
|
|
356
|
+
|
|
357
|
+
const isEmptyTriggerSearch = isTriggerPositionSearch && _isEmpty(checkedKeys);
|
|
358
|
+
|
|
359
|
+
const isValueTriggerSearch = isTriggerPositionSearch && !_isEmpty(checkedKeys);
|
|
353
360
|
const classNames = useCustomTrigger ? cls(className) : cls(prefixcls, {
|
|
354
361
|
["".concat(prefixcls, "-focus")]: isOpen && !isInput,
|
|
355
362
|
["".concat(prefixcls, "-disabled")]: disabled,
|
|
@@ -370,7 +377,7 @@ class TreeSelect extends BaseComponent {
|
|
|
370
377
|
const inner = useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
|
|
371
378
|
inputValue: inputValue,
|
|
372
379
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
373
|
-
value: _mapInstanceProperty(triggerRenderKeys).call(triggerRenderKeys, key =>
|
|
380
|
+
value: _mapInstanceProperty(triggerRenderKeys).call(triggerRenderKeys, key => _get(keyEntities, [key, 'data'])),
|
|
374
381
|
disabled: disabled,
|
|
375
382
|
placeholder: placeholder,
|
|
376
383
|
onClear: this.handleClear,
|
|
@@ -422,7 +429,7 @@ class TreeSelect extends BaseComponent {
|
|
|
422
429
|
const tagCls = cls("".concat(prefixcls, "-selection-tag"), {
|
|
423
430
|
["".concat(prefixcls, "-selection-tag-disabled")]: disabled
|
|
424
431
|
});
|
|
425
|
-
const nodeHaveData = !
|
|
432
|
+
const nodeHaveData = !_isEmpty(nodes) && !_isEmpty(nodes[0]);
|
|
426
433
|
const isDisableStrictlyNode = disableStrictly && nodeHaveData && disabledKeys.has(nodes[0].key);
|
|
427
434
|
const closable = nodeHaveData && !nodes[0].disabled && !disabled && !isDisableStrictlyNode;
|
|
428
435
|
|
|
@@ -441,12 +448,12 @@ class TreeSelect extends BaseComponent {
|
|
|
441
448
|
onClose
|
|
442
449
|
};
|
|
443
450
|
const item = nodes[0];
|
|
444
|
-
const renderSelectedItem =
|
|
451
|
+
const renderSelectedItem = _isFunction(propRenderSelectedItem) ? propRenderSelectedItem : selectedItem => ({
|
|
445
452
|
isRenderInTag: true,
|
|
446
|
-
content:
|
|
453
|
+
content: _get(selectedItem, treeNodeLabelProp, null)
|
|
447
454
|
});
|
|
448
455
|
|
|
449
|
-
if (
|
|
456
|
+
if (_isFunction(renderSelectedItem)) {
|
|
450
457
|
const {
|
|
451
458
|
content,
|
|
452
459
|
isRenderInTag
|
|
@@ -676,7 +683,7 @@ class TreeSelect extends BaseComponent {
|
|
|
676
683
|
motionExpand
|
|
677
684
|
} = this.props;
|
|
678
685
|
|
|
679
|
-
if (!virtualize ||
|
|
686
|
+
if (!virtualize || _isEmpty(virtualize)) {
|
|
680
687
|
return /*#__PURE__*/React.createElement(NodeList, {
|
|
681
688
|
flattenNodes: flattenNodes,
|
|
682
689
|
flattenList: this._flattenNodes,
|
|
@@ -750,7 +757,7 @@ class TreeSelect extends BaseComponent {
|
|
|
750
757
|
["".concat(prefixTree, "-option-list-block")]: true
|
|
751
758
|
});
|
|
752
759
|
const searchNoRes = Boolean(inputValue) && !filteredKeys.size;
|
|
753
|
-
const noData =
|
|
760
|
+
const noData = _isEmpty(flattenNodes) || showFilteredOnly && searchNoRes;
|
|
754
761
|
const isDropdownPositionSearch = searchPosition === strings.SEARCH_POSITION_DROPDOWN;
|
|
755
762
|
return /*#__PURE__*/React.createElement(TreeContext.Provider, {
|
|
756
763
|
value: {
|
|
@@ -765,7 +772,7 @@ class TreeSelect extends BaseComponent {
|
|
|
765
772
|
onNodeClick: this.onNodeClick,
|
|
766
773
|
onNodeDoubleClick: this.onNodeDoubleClick,
|
|
767
774
|
// tree node will call this function when treeNode is right clicked
|
|
768
|
-
onNodeRightClick:
|
|
775
|
+
onNodeRightClick: _noop,
|
|
769
776
|
onNodeExpand: this.onNodeExpand,
|
|
770
777
|
onNodeSelect: this.onNodeSelect,
|
|
771
778
|
onNodeCheck: this.onNodeCheck,
|
|
@@ -828,7 +835,7 @@ class TreeSelect extends BaseComponent {
|
|
|
828
835
|
rePosKey
|
|
829
836
|
} = prevState;
|
|
830
837
|
|
|
831
|
-
const needUpdate = name => !prevProps && name in props || prevProps && !
|
|
838
|
+
const needUpdate = name => !prevProps && name in props || prevProps && !_isEqual(prevProps[name], props[name]);
|
|
832
839
|
|
|
833
840
|
let treeData;
|
|
834
841
|
const withObject = props.onChangeWithObject;
|
|
@@ -849,7 +856,7 @@ class TreeSelect extends BaseComponent {
|
|
|
849
856
|
} // if treeData keys changes, we won't show animation
|
|
850
857
|
|
|
851
858
|
|
|
852
|
-
if (treeData && props.motion && !
|
|
859
|
+
if (treeData && props.motion && !_isEqual(new _Set(_Object$keys(newState.keyEntities)), new _Set(_Object$keys(prevState.keyEntities)))) {
|
|
853
860
|
if (prevProps && props.motion) {
|
|
854
861
|
newState.motionKeys = new _Set([]);
|
|
855
862
|
newState.motionType = null;
|
|
@@ -952,7 +959,8 @@ class TreeSelect extends BaseComponent {
|
|
|
952
959
|
registerClickOutsideHandler: cb => {
|
|
953
960
|
const clickOutsideHandler = e => {
|
|
954
961
|
const optionInstance = this.optionsRef && this.optionsRef.current;
|
|
955
|
-
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
962
|
+
const triggerDom = this.triggerRef && this.triggerRef.current; // eslint-disable-next-line
|
|
963
|
+
|
|
956
964
|
const optionsDom = ReactDOM.findDOMNode(optionInstance);
|
|
957
965
|
const target = e.target;
|
|
958
966
|
|
|
@@ -995,7 +1003,7 @@ class TreeSelect extends BaseComponent {
|
|
|
995
1003
|
const {
|
|
996
1004
|
onLoad
|
|
997
1005
|
} = this.props;
|
|
998
|
-
|
|
1006
|
+
_isFunction(onLoad) && onLoad(newLoadedKeys, data);
|
|
999
1007
|
}
|
|
1000
1008
|
};
|
|
1001
1009
|
return _Object$assign(_Object$assign(_Object$assign(_Object$assign(_Object$assign({}, super.adapter), filterAdapter), treeSelectAdapter), treeAdapter), {
|
|
@@ -1213,7 +1221,7 @@ TreeSelect.defaultProps = {
|
|
|
1213
1221
|
defaultOpen: false,
|
|
1214
1222
|
showSearchClear: true,
|
|
1215
1223
|
showClear: false,
|
|
1216
|
-
onVisibleChange:
|
|
1224
|
+
onVisibleChange: _noop,
|
|
1217
1225
|
expandAction: false,
|
|
1218
1226
|
clickToHide: true,
|
|
1219
1227
|
searchAutoFocus: false
|
|
@@ -63,7 +63,7 @@ export default class Base extends Component<BaseTypographyProps, BaseTypographyS
|
|
|
63
63
|
link: PropTypes.Requireable<boolean | object>;
|
|
64
64
|
spacing: PropTypes.Requireable<"normal" | "extended">;
|
|
65
65
|
strong: PropTypes.Requireable<boolean>;
|
|
66
|
-
size: PropTypes.Requireable<"
|
|
66
|
+
size: PropTypes.Requireable<"small" | "normal">;
|
|
67
67
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
68
68
|
style: PropTypes.Requireable<object>;
|
|
69
69
|
className: PropTypes.Requireable<string>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import _isString from "lodash/isString";
|
|
2
|
+
import _merge from "lodash/merge";
|
|
3
|
+
import _omit from "lodash/omit";
|
|
4
|
+
import _isUndefined from "lodash/isUndefined";
|
|
1
5
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
6
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
7
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
@@ -24,7 +28,6 @@ import PropTypes from 'prop-types';
|
|
|
24
28
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/typography/constants';
|
|
25
29
|
import Typography from './typography';
|
|
26
30
|
import Copyable from './copyable';
|
|
27
|
-
import { isUndefined, omit, merge, isString } from 'lodash-es';
|
|
28
31
|
import Tooltip from '../tooltip/index';
|
|
29
32
|
import Popover from '../popover/index';
|
|
30
33
|
import getRenderText from './util';
|
|
@@ -94,7 +97,7 @@ export default class Base extends Component {
|
|
|
94
97
|
pos,
|
|
95
98
|
suffix
|
|
96
99
|
} = this.getEllipsisOpt();
|
|
97
|
-
return !expandable &&
|
|
100
|
+
return !expandable && _isUndefined(expandText) && !copyable && pos === 'end' && !suffix.length;
|
|
98
101
|
};
|
|
99
102
|
/**
|
|
100
103
|
* whether truncated
|
|
@@ -126,7 +129,9 @@ export default class Base extends Component {
|
|
|
126
129
|
expandText
|
|
127
130
|
} = this.getEllipsisOpt();
|
|
128
131
|
const overflowed = !expanded && (isOverflowed || isTruncated);
|
|
129
|
-
|
|
132
|
+
|
|
133
|
+
const noExpandText = !expandable && _isUndefined(expandText);
|
|
134
|
+
|
|
130
135
|
const show = noExpandText && overflowed && showTooltip;
|
|
131
136
|
|
|
132
137
|
if (!show) {
|
|
@@ -140,7 +145,7 @@ export default class Base extends Component {
|
|
|
140
145
|
|
|
141
146
|
if (typeof showTooltip === 'object') {
|
|
142
147
|
if (showTooltip.type && showTooltip.type.toLowerCase() === 'popover') {
|
|
143
|
-
return
|
|
148
|
+
return _merge({
|
|
144
149
|
opts: {
|
|
145
150
|
style: {
|
|
146
151
|
width: '240px'
|
|
@@ -214,8 +219,11 @@ export default class Base extends Component {
|
|
|
214
219
|
expanded,
|
|
215
220
|
first
|
|
216
221
|
} = this.state;
|
|
217
|
-
|
|
218
|
-
const
|
|
222
|
+
|
|
223
|
+
const noExpandText = !expandable && _isUndefined(expandText);
|
|
224
|
+
|
|
225
|
+
const noCollapseText = !collapsible && _isUndefined(collapseText);
|
|
226
|
+
|
|
219
227
|
let text;
|
|
220
228
|
|
|
221
229
|
if (!expanded && !noExpandText) {
|
|
@@ -544,8 +552,9 @@ export default class Base extends Component {
|
|
|
544
552
|
} = _a,
|
|
545
553
|
rest = __rest(_a, ["component", "children", "className", "type", "spacing", "disabled", "style", "ellipsis", "icon", "size", "link", "heading"]);
|
|
546
554
|
|
|
547
|
-
const textProps =
|
|
555
|
+
const textProps = _omit(rest, ['strong', 'editable', 'mark', 'copyable', 'underline', 'code', // 'link',
|
|
548
556
|
'delete']);
|
|
557
|
+
|
|
549
558
|
const iconNode = this.renderIcon();
|
|
550
559
|
const ellipsisOpt = this.getEllipsisOpt();
|
|
551
560
|
const {
|
|
@@ -568,7 +577,7 @@ export default class Base extends Component {
|
|
|
568
577
|
["".concat(prefixCls, "-link")]: link,
|
|
569
578
|
["".concat(prefixCls, "-disabled")]: disabled,
|
|
570
579
|
[_concatInstanceProperty(_context4 = "".concat(prefixCls, "-")).call(_context4, spacing)]: spacing,
|
|
571
|
-
[_concatInstanceProperty(_context5 = "".concat(prefixCls, "-")).call(_context5, heading)]:
|
|
580
|
+
[_concatInstanceProperty(_context5 = "".concat(prefixCls, "-")).call(_context5, heading)]: _isString(heading) && hTagReg.test(heading)
|
|
572
581
|
});
|
|
573
582
|
return /*#__PURE__*/React.createElement(Typography, _Object$assign({
|
|
574
583
|
className: wrapperCls,
|
|
@@ -30,7 +30,7 @@ export default class Paragraph extends PureComponent<ParagraphProps> {
|
|
|
30
30
|
underline: PropTypes.Requireable<boolean>;
|
|
31
31
|
strong: PropTypes.Requireable<boolean>;
|
|
32
32
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
33
|
-
size: PropTypes.Requireable<"
|
|
33
|
+
size: PropTypes.Requireable<"small" | "normal">;
|
|
34
34
|
spacing: PropTypes.Requireable<"normal" | "extended">;
|
|
35
35
|
style: PropTypes.Requireable<object>;
|
|
36
36
|
className: PropTypes.Requireable<string>;
|
|
@@ -33,7 +33,7 @@ export default class Text extends PureComponent<TextProps> {
|
|
|
33
33
|
link: PropTypes.Requireable<boolean | object>;
|
|
34
34
|
strong: PropTypes.Requireable<boolean>;
|
|
35
35
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
36
|
-
size: PropTypes.Requireable<"
|
|
36
|
+
size: PropTypes.Requireable<"small" | "normal">;
|
|
37
37
|
style: PropTypes.Requireable<object>;
|
|
38
38
|
className: PropTypes.Requireable<string>;
|
|
39
39
|
code: PropTypes.Requireable<boolean>;
|
|
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
|
|
|
37
37
|
underline: PropTypes.Requireable<boolean>;
|
|
38
38
|
strong: PropTypes.Requireable<boolean>;
|
|
39
39
|
type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
|
|
40
|
-
heading: PropTypes.Requireable<
|
|
40
|
+
heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
|
|
41
41
|
style: PropTypes.Requireable<object>;
|
|
42
42
|
className: PropTypes.Requireable<string>;
|
|
43
43
|
component: PropTypes.Requireable<string>;
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import { PureComponent, ReactNode,
|
|
1
|
+
import { PureComponent, ReactNode, MouseEvent, CSSProperties } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Locale } from '../locale/interface';
|
|
4
|
-
|
|
4
|
+
import { RenderFileItemProps } from './interface';
|
|
5
|
+
export interface FileCardProps extends RenderFileItemProps {
|
|
5
6
|
className?: string;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
listType?: 'picture' | 'list';
|
|
8
|
-
name?: string;
|
|
9
|
-
onPreviewClick?: MouseEventHandler<HTMLDivElement>;
|
|
10
|
-
onRemove?: (props: FileCardProps, e: MouseEvent) => void;
|
|
11
|
-
onReplace?: (props: FileCardProps, e: MouseEvent) => void;
|
|
12
|
-
onRetry?: (props: FileCardProps, e: MouseEvent) => void;
|
|
13
|
-
percent?: number;
|
|
14
|
-
preview?: boolean;
|
|
15
|
-
previewFile?: (props: FileCardProps) => ReactNode;
|
|
16
|
-
showReplace?: boolean;
|
|
17
|
-
showRetry?: boolean;
|
|
18
|
-
size?: string;
|
|
19
|
-
status?: string;
|
|
20
7
|
style?: CSSProperties;
|
|
21
|
-
url?: string;
|
|
22
|
-
validateMessage?: ReactNode;
|
|
23
8
|
}
|
|
24
9
|
declare class FileCard extends PureComponent<FileCardProps> {
|
|
25
10
|
static propTypes: {
|
package/lib/es/upload/index.d.ts
CHANGED
|
@@ -1,65 +1,12 @@
|
|
|
1
1
|
import { ReactNode, CSSProperties, RefObject, ChangeEvent, DragEvent } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import UploadFoundation, {
|
|
4
|
-
import { strings } from '@douyinfe/semi-foundation/lib/es/upload/constants';
|
|
3
|
+
import UploadFoundation, { UploadAdapter, BeforeUploadObjectResult, AfterUploadResult } from '@douyinfe/semi-foundation/lib/es/upload/foundation';
|
|
5
4
|
import FileCard from './fileCard';
|
|
6
5
|
import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
|
|
7
|
-
import {
|
|
6
|
+
import { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError } from './interface';
|
|
8
7
|
import { Locale } from '../locale/interface';
|
|
9
8
|
import '@douyinfe/semi-foundation/lib/es/upload/upload.css';
|
|
10
|
-
export { BeforeUploadObjectResult, AfterUploadResult };
|
|
11
|
-
export interface FileItem extends BaseFileItem {
|
|
12
|
-
validateMessage?: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
export declare type UploadListType = ArrayElement<typeof strings.LIST_TYPE>;
|
|
15
|
-
export declare type PromptPositionType = ArrayElement<typeof strings.PROMPT_POSITION>;
|
|
16
|
-
export interface RenderFileItemProps extends FileItem {
|
|
17
|
-
previewFile: (fileItem: FileItem) => ReactNode;
|
|
18
|
-
listType: UploadListType;
|
|
19
|
-
onRemove: () => void;
|
|
20
|
-
onRetry: () => void;
|
|
21
|
-
onReplace: () => void;
|
|
22
|
-
key: string;
|
|
23
|
-
showRetry: boolean;
|
|
24
|
-
showReplace: boolean;
|
|
25
|
-
style: CSSProperties;
|
|
26
|
-
disabled: boolean;
|
|
27
|
-
onPreviewClick: () => void;
|
|
28
|
-
}
|
|
29
|
-
export interface BeforeUploadProps {
|
|
30
|
-
file: FileItem;
|
|
31
|
-
fileList: Array<FileItem>;
|
|
32
|
-
}
|
|
33
|
-
export interface AfterUploadProps {
|
|
34
|
-
file: FileItem;
|
|
35
|
-
fileList: Array<FileItem>;
|
|
36
|
-
response: any;
|
|
37
|
-
}
|
|
38
|
-
export interface OnChangeProps {
|
|
39
|
-
fileList: Array<FileItem>;
|
|
40
|
-
currentFile: FileItem;
|
|
41
|
-
}
|
|
42
|
-
export interface customRequestArgs {
|
|
43
|
-
fileName: string;
|
|
44
|
-
data: Record<string, any>;
|
|
45
|
-
file: FileItem;
|
|
46
|
-
fileInstance: File;
|
|
47
|
-
onProgress: (event: {
|
|
48
|
-
total: number;
|
|
49
|
-
loaded: number;
|
|
50
|
-
}) => any;
|
|
51
|
-
onError: (userXhr: {
|
|
52
|
-
status?: number;
|
|
53
|
-
}, e: Event) => any;
|
|
54
|
-
onSuccess: (response: any, e: Event) => any;
|
|
55
|
-
withCredentials: boolean;
|
|
56
|
-
action: string;
|
|
57
|
-
}
|
|
58
|
-
export interface CustomError extends Error {
|
|
59
|
-
status: number;
|
|
60
|
-
method: string;
|
|
61
|
-
url: string;
|
|
62
|
-
}
|
|
9
|
+
export { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult };
|
|
63
10
|
export interface UploadProps {
|
|
64
11
|
accept?: string;
|
|
65
12
|
action: string;
|
|
@@ -103,7 +50,7 @@ export interface UploadProps {
|
|
|
103
50
|
onRetry?: (fileItem: FileItem) => void;
|
|
104
51
|
onSizeError?: (file: File, fileList: Array<FileItem>) => void;
|
|
105
52
|
onSuccess?: (responseBody: any, file: File, fileList: Array<FileItem>) => void;
|
|
106
|
-
previewFile?: (
|
|
53
|
+
previewFile?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
|
107
54
|
prompt?: ReactNode;
|
|
108
55
|
promptPosition?: PromptPositionType;
|
|
109
56
|
renderFileItem?: (renderFileItemProps: RenderFileItemProps) => ReactNode;
|
package/lib/es/upload/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _noop from "lodash/noop";
|
|
1
2
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
3
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
3
4
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
@@ -6,7 +7,6 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import cls from 'classnames';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
|
-
import { noop } from 'lodash-es';
|
|
10
10
|
import UploadFoundation from '@douyinfe/semi-foundation/lib/es/upload/foundation';
|
|
11
11
|
import { strings, cssClasses } from '@douyinfe/semi-foundation/lib/es/upload/constants';
|
|
12
12
|
import FileCard from './fileCard';
|
|
@@ -498,21 +498,21 @@ Upload.defaultProps = {
|
|
|
498
498
|
disabled: false,
|
|
499
499
|
listType: 'list',
|
|
500
500
|
multiple: false,
|
|
501
|
-
onAcceptInvalid:
|
|
502
|
-
onChange:
|
|
501
|
+
onAcceptInvalid: _noop,
|
|
502
|
+
onChange: _noop,
|
|
503
503
|
beforeRemove: () => true,
|
|
504
504
|
beforeClear: () => true,
|
|
505
|
-
onClear:
|
|
506
|
-
onDrop:
|
|
507
|
-
onError:
|
|
508
|
-
onExceed:
|
|
509
|
-
onFileChange:
|
|
510
|
-
onOpenFileDialog:
|
|
511
|
-
onProgress:
|
|
512
|
-
onRemove:
|
|
513
|
-
onRetry:
|
|
514
|
-
onSizeError:
|
|
515
|
-
onSuccess:
|
|
505
|
+
onClear: _noop,
|
|
506
|
+
onDrop: _noop,
|
|
507
|
+
onError: _noop,
|
|
508
|
+
onExceed: _noop,
|
|
509
|
+
onFileChange: _noop,
|
|
510
|
+
onOpenFileDialog: _noop,
|
|
511
|
+
onProgress: _noop,
|
|
512
|
+
onRemove: _noop,
|
|
513
|
+
onRetry: _noop,
|
|
514
|
+
onSizeError: _noop,
|
|
515
|
+
onSuccess: _noop,
|
|
516
516
|
promptPosition: 'right',
|
|
517
517
|
showClear: true,
|
|
518
518
|
showReplace: false,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ReactNode, CSSProperties, MouseEvent } from 'react';
|
|
2
|
+
import { BaseFileItem } from '@douyinfe/semi-foundation/lib/es/upload/foundation';
|
|
3
|
+
import { strings } from '@douyinfe/semi-foundation/lib/es/upload/constants';
|
|
4
|
+
import { ArrayElement } from '../_base/base';
|
|
5
|
+
export declare type PromptPositionType = ArrayElement<typeof strings.PROMPT_POSITION>;
|
|
6
|
+
export declare type UploadListType = ArrayElement<typeof strings.LIST_TYPE>;
|
|
7
|
+
export interface BeforeUploadProps {
|
|
8
|
+
file: FileItem;
|
|
9
|
+
fileList: Array<FileItem>;
|
|
10
|
+
}
|
|
11
|
+
export interface AfterUploadProps {
|
|
12
|
+
file: FileItem;
|
|
13
|
+
fileList: Array<FileItem>;
|
|
14
|
+
response: any;
|
|
15
|
+
}
|
|
16
|
+
export interface OnChangeProps {
|
|
17
|
+
fileList: Array<FileItem>;
|
|
18
|
+
currentFile: FileItem;
|
|
19
|
+
}
|
|
20
|
+
export interface customRequestArgs {
|
|
21
|
+
fileName: string;
|
|
22
|
+
data: Record<string, any>;
|
|
23
|
+
file: FileItem;
|
|
24
|
+
fileInstance: File;
|
|
25
|
+
onProgress: (event: {
|
|
26
|
+
total: number;
|
|
27
|
+
loaded: number;
|
|
28
|
+
}) => any;
|
|
29
|
+
onError: (userXhr: {
|
|
30
|
+
status?: number;
|
|
31
|
+
}, e: Event) => any;
|
|
32
|
+
onSuccess: (response: any, e: Event) => any;
|
|
33
|
+
withCredentials: boolean;
|
|
34
|
+
action: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CustomError extends Error {
|
|
37
|
+
status: number;
|
|
38
|
+
method: string;
|
|
39
|
+
url: string;
|
|
40
|
+
}
|
|
41
|
+
export interface FileItem extends BaseFileItem {
|
|
42
|
+
validateMessage?: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
export interface RenderFileItemProps extends FileItem {
|
|
45
|
+
previewFile?: (fileItem: RenderFileItemProps) => ReactNode;
|
|
46
|
+
listType: UploadListType;
|
|
47
|
+
onRemove: (props: RenderFileItemProps, e: MouseEvent) => void;
|
|
48
|
+
onRetry: (props: RenderFileItemProps, e: MouseEvent) => void;
|
|
49
|
+
onReplace: (props: RenderFileItemProps, e: MouseEvent) => void;
|
|
50
|
+
key: string;
|
|
51
|
+
showRetry: boolean;
|
|
52
|
+
showReplace: boolean;
|
|
53
|
+
style?: CSSProperties;
|
|
54
|
+
disabled: boolean;
|
|
55
|
+
onPreviewClick: () => void;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.1.0-next.
|
|
3
|
+
"version": "2.1.0-next.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -19,17 +19,18 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
22
|
-
"@douyinfe/semi-animation-react": "2.1.0-next.
|
|
23
|
-
"@douyinfe/semi-foundation": "2.1.0-next.
|
|
24
|
-
"@douyinfe/semi-icons": "2.1.0-next.
|
|
25
|
-
"@douyinfe/semi-illustrations": "2.1.0-next.
|
|
26
|
-
"@douyinfe/semi-theme-default": "2.
|
|
22
|
+
"@douyinfe/semi-animation-react": "2.1.0-next.1",
|
|
23
|
+
"@douyinfe/semi-foundation": "2.1.0-next.1",
|
|
24
|
+
"@douyinfe/semi-icons": "2.1.0-next.1",
|
|
25
|
+
"@douyinfe/semi-illustrations": "2.1.0-next.1",
|
|
26
|
+
"@douyinfe/semi-theme-default": "2.1.1",
|
|
27
|
+
"@types/react-window": "^1.8.2",
|
|
27
28
|
"async-validator": "^3.5.0",
|
|
28
29
|
"classnames": "^2.2.6",
|
|
29
30
|
"copy-text-to-clipboard": "^2.1.1",
|
|
30
31
|
"date-fns": "^2.9.0",
|
|
31
32
|
"date-fns-tz": "^1.0.10",
|
|
32
|
-
"lodash
|
|
33
|
+
"lodash": "^4.17.21",
|
|
33
34
|
"react-resizable": "^1.8.0",
|
|
34
35
|
"react-sortable-hoc": "^1.11.0",
|
|
35
36
|
"react-window": "^1.8.2",
|
|
@@ -64,15 +65,17 @@
|
|
|
64
65
|
],
|
|
65
66
|
"author": "",
|
|
66
67
|
"license": "MIT",
|
|
67
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "a3621f11541ff3fc91310ba0f3d89d50dd558678",
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
70
71
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
71
72
|
"@babel/preset-env": "^7.15.8",
|
|
72
73
|
"@babel/preset-react": "^7.14.5",
|
|
73
|
-
"@douyinfe/semi-scss-compile": "2.1.0-next.
|
|
74
|
+
"@douyinfe/semi-scss-compile": "2.1.0-next.1",
|
|
74
75
|
"@storybook/addon-knobs": "^6.3.1",
|
|
76
|
+
"@types/lodash": "^4.14.176",
|
|
75
77
|
"babel-loader": "^8.2.2",
|
|
78
|
+
"babel-plugin-lodash": "^3.3.4",
|
|
76
79
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
77
80
|
"del": "^6.0.0",
|
|
78
81
|
"enzyme": "^3.11.0",
|