@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _noop from "lodash/noop";
|
|
1
2
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
2
3
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
3
4
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
@@ -11,7 +12,6 @@ import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
|
11
12
|
import React from 'react';
|
|
12
13
|
import PropTypes from 'prop-types';
|
|
13
14
|
import { format as dateFnsFormat } from 'date-fns';
|
|
14
|
-
import { noop } from 'lodash-es';
|
|
15
15
|
import BaseComponent from '../_base/baseComponent';
|
|
16
16
|
import { strings } from '@douyinfe/semi-foundation/lib/es/timePicker/constants';
|
|
17
17
|
import ScrollList from '../scrollList/index';
|
|
@@ -44,7 +44,8 @@ class Combobox extends BaseComponent {
|
|
|
44
44
|
this.onItemChange = _ref => {
|
|
45
45
|
let {
|
|
46
46
|
type,
|
|
47
|
-
value
|
|
47
|
+
value,
|
|
48
|
+
disabled
|
|
48
49
|
} = _ref;
|
|
49
50
|
// eslint-disable-next-line prefer-const
|
|
50
51
|
let {
|
|
@@ -302,9 +303,9 @@ Combobox.propTypes = {
|
|
|
302
303
|
scrollItemProps: PropTypes.object
|
|
303
304
|
};
|
|
304
305
|
Combobox.defaultProps = {
|
|
305
|
-
disabledHours:
|
|
306
|
-
disabledMinutes:
|
|
307
|
-
disabledSeconds:
|
|
306
|
+
disabledHours: _noop,
|
|
307
|
+
disabledMinutes: _noop,
|
|
308
|
+
disabledSeconds: _noop,
|
|
308
309
|
format: strings.DEFAULT_FORMAT
|
|
309
310
|
};
|
|
310
311
|
export default Combobox;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _noop from "lodash/noop";
|
|
1
2
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
3
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
4
|
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
@@ -20,7 +21,6 @@ import React from 'react';
|
|
|
20
21
|
import PropTypes from 'prop-types';
|
|
21
22
|
import classNames from 'classnames';
|
|
22
23
|
import { strings } from '@douyinfe/semi-foundation/lib/es/timePicker/constants';
|
|
23
|
-
import { noop } from 'lodash-es';
|
|
24
24
|
import Input from '../input';
|
|
25
25
|
import BaseComponent from '../_base/baseComponent';
|
|
26
26
|
import InputFoundation from '@douyinfe/semi-foundation/lib/es/timePicker/inputFoundation';
|
|
@@ -190,13 +190,13 @@ TimeInput.propTypes = {
|
|
|
190
190
|
};
|
|
191
191
|
TimeInput.defaultProps = {
|
|
192
192
|
inputReadOnly: false,
|
|
193
|
-
onChange:
|
|
194
|
-
onBlur:
|
|
195
|
-
onFocus:
|
|
196
|
-
onClick:
|
|
197
|
-
disabledHours:
|
|
198
|
-
disabledMinutes:
|
|
199
|
-
disabledSeconds:
|
|
193
|
+
onChange: _noop,
|
|
194
|
+
onBlur: _noop,
|
|
195
|
+
onFocus: _noop,
|
|
196
|
+
onClick: _noop,
|
|
197
|
+
disabledHours: _noop,
|
|
198
|
+
disabledMinutes: _noop,
|
|
199
|
+
disabledSeconds: _noop,
|
|
200
200
|
format: strings.DEFAULT_FORMAT
|
|
201
201
|
};
|
|
202
202
|
export default TimeInput;
|
|
@@ -49,7 +49,7 @@ export declare type TimePickerProps = {
|
|
|
49
49
|
position?: Position;
|
|
50
50
|
prefixCls?: string;
|
|
51
51
|
rangeSeparator?: string;
|
|
52
|
-
scrollItemProps?: ScrollItemProps
|
|
52
|
+
scrollItemProps?: ScrollItemProps<any>;
|
|
53
53
|
secondStep?: number;
|
|
54
54
|
showClear?: boolean;
|
|
55
55
|
size?: InputSize;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import _get from "lodash/get";
|
|
2
|
+
import _noop from "lodash/noop";
|
|
1
3
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
4
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
5
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
@@ -20,7 +22,6 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
20
22
|
import React from 'react';
|
|
21
23
|
import PropTypes from 'prop-types';
|
|
22
24
|
import classNames from 'classnames';
|
|
23
|
-
import { noop, get } from 'lodash-es';
|
|
24
25
|
import ConfigContext from '../configProvider/context';
|
|
25
26
|
import BaseComponent from '../_base/baseComponent';
|
|
26
27
|
import { strings, cssClasses } from '@douyinfe/semi-foundation/lib/es/timePicker/constants';
|
|
@@ -69,8 +70,8 @@ export default class TimePicker extends BaseComponent {
|
|
|
69
70
|
0: locale.begin,
|
|
70
71
|
1: locale.end
|
|
71
72
|
};
|
|
72
|
-
panelProps.panelHeader =
|
|
73
|
-
panelProps.panelFooter =
|
|
73
|
+
panelProps.panelHeader = _get(panels, index, isNullOrUndefined(panelHeader) ? _get(defaultHeaderMap, index, null) : panelHeader);
|
|
74
|
+
panelProps.panelFooter = _get(panels, index, panelFooter);
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
return panelProps;
|
|
@@ -441,7 +442,7 @@ TimePicker.defaultProps = _Object$assign({
|
|
|
441
442
|
showClear: true,
|
|
442
443
|
zIndex: popoverNumbers.DEFAULT_Z_INDEX,
|
|
443
444
|
rangeSeparator: strings.DEFAULT_RANGE_SEPARATOR,
|
|
444
|
-
onOpenChange:
|
|
445
|
+
onOpenChange: _noop,
|
|
445
446
|
clearText: 'clear',
|
|
446
447
|
prefixCls: cssClasses.PREFIX,
|
|
447
448
|
inputReadOnly: false,
|
|
@@ -457,12 +458,12 @@ TimePicker.defaultProps = _Object$assign({
|
|
|
457
458
|
disabledSeconds: () => [],
|
|
458
459
|
hideDisabledOptions: false,
|
|
459
460
|
// position: 'bottomLeft',
|
|
460
|
-
onFocus:
|
|
461
|
-
onBlur:
|
|
462
|
-
onChange:
|
|
461
|
+
onFocus: _noop,
|
|
462
|
+
onBlur: _noop,
|
|
463
|
+
onChange: _noop,
|
|
463
464
|
use12Hours: false,
|
|
464
465
|
focusOnOpen: false,
|
|
465
|
-
onKeyDown:
|
|
466
|
+
onKeyDown: _noop,
|
|
466
467
|
size: 'default',
|
|
467
468
|
type: strings.DEFAULT_TYPE
|
|
468
469
|
}, PanelShapeDefaults);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import _get from "lodash/get";
|
|
1
2
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import LocaleConsumer from '../locale/localeConsumer';
|
|
4
5
|
import BaseTimePicker from './TimePicker';
|
|
5
6
|
import ConfigContext from '../configProvider/context';
|
|
6
|
-
import { get } from 'lodash-es';
|
|
7
7
|
export default class LocaleTimePicker extends React.PureComponent {
|
|
8
8
|
render() {
|
|
9
9
|
const {
|
|
@@ -17,7 +17,7 @@ export default class LocaleTimePicker extends React.PureComponent {
|
|
|
17
17
|
componentName: "TimePicker"
|
|
18
18
|
}, (locale, localeCode, dateFnsLocale) => /*#__PURE__*/React.createElement(BaseTimePicker, _Object$assign({
|
|
19
19
|
timeZone: timeZone,
|
|
20
|
-
placeholder:
|
|
20
|
+
placeholder: _get(locale, ['placeholder', type])
|
|
21
21
|
}, this.props, {
|
|
22
22
|
locale: locale,
|
|
23
23
|
localeCode: localeCode,
|
package/lib/es/toast/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ToastListAdapter, ToastListProps, ToastListState } from '@douyinfe/semi
|
|
|
4
4
|
import '@douyinfe/semi-foundation/lib/es/toast/toast.css';
|
|
5
5
|
import useToast from './useToast';
|
|
6
6
|
import { ConfigProps, ToastInstance, ToastProps, ToastState } from '@douyinfe/semi-foundation/lib/es/toast/toastFoundation';
|
|
7
|
-
import { Motion } from '_base/base';
|
|
7
|
+
import { Motion } from '../_base/base';
|
|
8
8
|
export { ToastTransitionProps } from './ToastTransition';
|
|
9
9
|
export interface ToastReactProps extends ToastProps {
|
|
10
10
|
style?: CSSProperties;
|
package/lib/es/toast/toast.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
|
|
|
@@ -11,7 +12,6 @@ import { numbers, cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/t
|
|
|
11
12
|
import BaseComponent from '../_base/baseComponent';
|
|
12
13
|
import Button from '../iconButton/index';
|
|
13
14
|
import { IconClose, IconAlertTriangle, IconInfoCircle, IconTickCircle, IconAlertCircle } from '@douyinfe/semi-icons';
|
|
14
|
-
import { noop } from 'lodash-es';
|
|
15
15
|
import { isSemiIcon } from '../_utils';
|
|
16
16
|
const prefixCls = cssClasses.PREFIX;
|
|
17
17
|
|
|
@@ -149,9 +149,9 @@ Toast.propTypes = {
|
|
|
149
149
|
direction: PropTypes.oneOf(strings.directions)
|
|
150
150
|
};
|
|
151
151
|
Toast.defaultProps = {
|
|
152
|
-
onClose:
|
|
152
|
+
onClose: _noop,
|
|
153
153
|
content: '',
|
|
154
|
-
close:
|
|
154
|
+
close: _noop,
|
|
155
155
|
duration: numbers.duration,
|
|
156
156
|
textMaxWidth: 450,
|
|
157
157
|
showClose: true,
|
|
@@ -31,6 +31,7 @@ export interface TooltipProps extends BaseProps {
|
|
|
31
31
|
content?: React.ReactNode;
|
|
32
32
|
prefixCls?: string;
|
|
33
33
|
onVisibleChange?: (visible: boolean) => void;
|
|
34
|
+
onClickOutSide?: (e: React.MouseEvent) => void;
|
|
34
35
|
spacing?: number;
|
|
35
36
|
showArrow?: boolean | React.ReactNode;
|
|
36
37
|
zIndex?: number;
|
|
@@ -77,6 +78,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
77
78
|
content: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
78
79
|
prefixCls: PropTypes.Requireable<string>;
|
|
79
80
|
onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
81
|
+
onClickOutSide: PropTypes.Requireable<(...args: any[]) => any>;
|
|
80
82
|
spacing: PropTypes.Requireable<number>;
|
|
81
83
|
showArrow: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
82
84
|
zIndex: PropTypes.Requireable<number>;
|
|
@@ -105,6 +107,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
105
107
|
mouseEnterDelay: 50;
|
|
106
108
|
mouseLeaveDelay: 50;
|
|
107
109
|
onVisibleChange: (...args: any[]) => void;
|
|
110
|
+
onClickOutSide: (...args: any[]) => void;
|
|
108
111
|
spacing: 8;
|
|
109
112
|
showArrow: boolean;
|
|
110
113
|
arrowBounding: {
|
package/lib/es/tooltip/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import _isEmpty from "lodash/isEmpty";
|
|
2
|
+
import _each from "lodash/each";
|
|
3
|
+
import _omit from "lodash/omit";
|
|
4
|
+
import _get from "lodash/get";
|
|
5
|
+
import _noop from "lodash/noop";
|
|
6
|
+
import _throttle from "lodash/throttle";
|
|
1
7
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
8
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
9
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
@@ -20,7 +26,6 @@ import React, { isValidElement, cloneElement } from 'react';
|
|
|
20
26
|
import ReactDOM from 'react-dom';
|
|
21
27
|
import classNames from 'classnames';
|
|
22
28
|
import PropTypes from 'prop-types';
|
|
23
|
-
import { throttle, noop, get, omit, each, isEmpty } from 'lodash-es';
|
|
24
29
|
import { BASE_CLASS_PREFIX } from '@douyinfe/semi-foundation/lib/es/base/constants';
|
|
25
30
|
import warning from '@douyinfe/semi-foundation/lib/es/utils/warning';
|
|
26
31
|
import Event from '@douyinfe/semi-foundation/lib/es/utils/Event';
|
|
@@ -56,16 +61,17 @@ export default class Tooltip extends BaseComponent {
|
|
|
56
61
|
if (isHTMLElement(elem)) {
|
|
57
62
|
return Boolean(elem.disabled);
|
|
58
63
|
} else if ( /*#__PURE__*/isValidElement(elem)) {
|
|
59
|
-
const disabled =
|
|
64
|
+
const disabled = _get(elem, 'props.disabled');
|
|
60
65
|
|
|
61
66
|
if (disabled) {
|
|
62
67
|
return strings.STATUS_DISABLED;
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
const loading =
|
|
70
|
+
const loading = _get(elem, 'props.loading');
|
|
66
71
|
/* Only judge the loading state of the Button, and no longer judge other components */
|
|
67
72
|
|
|
68
|
-
|
|
73
|
+
|
|
74
|
+
const isButton = !_isEmpty(elem) && !_isEmpty(elem.type) && elem.type.name === 'Button' || elem.type.name === 'IconButton';
|
|
69
75
|
|
|
70
76
|
if (loading && isButton) {
|
|
71
77
|
return strings.STATUS_LOADING;
|
|
@@ -104,7 +110,9 @@ export default class Tooltip extends BaseComponent {
|
|
|
104
110
|
} = this.props;
|
|
105
111
|
let icon = null;
|
|
106
112
|
const triangleCls = classNames(["".concat(prefixCls, "-icon-arrow")]);
|
|
107
|
-
|
|
113
|
+
|
|
114
|
+
const bgColor = _get(style, 'backgroundColor');
|
|
115
|
+
|
|
108
116
|
const iconComponent = _includesInstanceProperty(placement).call(placement, 'left') || _includesInstanceProperty(placement).call(placement, 'right') ? /*#__PURE__*/React.createElement(TriangleArrowVertical, null) : /*#__PURE__*/React.createElement(TriangleArrow, null);
|
|
109
117
|
|
|
110
118
|
if (showArrow) {
|
|
@@ -161,8 +169,11 @@ export default class Tooltip extends BaseComponent {
|
|
|
161
169
|
["".concat(prefixCls, "-rtl")]: direction === 'rtl'
|
|
162
170
|
});
|
|
163
171
|
const icon = this.renderIcon();
|
|
164
|
-
|
|
165
|
-
const
|
|
172
|
+
|
|
173
|
+
const portalInnerStyle = _omit(containerStyle, motion ? ['transformOrigin'] : undefined);
|
|
174
|
+
|
|
175
|
+
const transformOrigin = _get(containerStyle, 'transformOrigin');
|
|
176
|
+
|
|
166
177
|
const inner = motion ? /*#__PURE__*/React.createElement(TooltipTransition, {
|
|
167
178
|
position: placement,
|
|
168
179
|
willEnter: this.willEnter,
|
|
@@ -207,8 +218,11 @@ export default class Tooltip extends BaseComponent {
|
|
|
207
218
|
const {
|
|
208
219
|
wrapperClassName
|
|
209
220
|
} = this.props;
|
|
210
|
-
|
|
211
|
-
const
|
|
221
|
+
|
|
222
|
+
const display = _get(elem, 'props.style.display');
|
|
223
|
+
|
|
224
|
+
const block = _get(elem, 'props.block');
|
|
225
|
+
|
|
212
226
|
const style = {
|
|
213
227
|
display: 'inline-block'
|
|
214
228
|
};
|
|
@@ -225,7 +239,8 @@ export default class Tooltip extends BaseComponent {
|
|
|
225
239
|
|
|
226
240
|
this.mergeEvents = (rawEvents, events) => {
|
|
227
241
|
const mergedEvents = {};
|
|
228
|
-
|
|
242
|
+
|
|
243
|
+
_each(events, (handler, key) => {
|
|
229
244
|
if (typeof handler === 'function') {
|
|
230
245
|
mergedEvents[key] = function () {
|
|
231
246
|
handler(...arguments);
|
|
@@ -236,6 +251,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
236
251
|
};
|
|
237
252
|
}
|
|
238
253
|
});
|
|
254
|
+
|
|
239
255
|
return mergedEvents;
|
|
240
256
|
};
|
|
241
257
|
|
|
@@ -423,6 +439,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
423
439
|
popupEl = ReactDOM.findDOMNode(popupEl);
|
|
424
440
|
|
|
425
441
|
if (el && !el.contains(e.target) && popupEl && !popupEl.contains(e.target) || this.props.clickTriggerToHide) {
|
|
442
|
+
this.props.onClickOutSide(e);
|
|
426
443
|
cb();
|
|
427
444
|
}
|
|
428
445
|
};
|
|
@@ -440,7 +457,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
440
457
|
this.adapter.unregisterResizeHandler();
|
|
441
458
|
}
|
|
442
459
|
|
|
443
|
-
this.resizeHandler =
|
|
460
|
+
this.resizeHandler = _throttle(e => {
|
|
444
461
|
if (!this.mounted) {
|
|
445
462
|
return false;
|
|
446
463
|
}
|
|
@@ -463,7 +480,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
463
480
|
this.adapter.unregisterScrollHandler();
|
|
464
481
|
}
|
|
465
482
|
|
|
466
|
-
this.scrollHandler =
|
|
483
|
+
this.scrollHandler = _throttle(e => {
|
|
467
484
|
if (!this.mounted) {
|
|
468
485
|
return false;
|
|
469
486
|
}
|
|
@@ -549,7 +566,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
549
566
|
children
|
|
550
567
|
} = this.props;
|
|
551
568
|
|
|
552
|
-
const childrenStyle = _Object$assign({},
|
|
569
|
+
const childrenStyle = _Object$assign({}, _get(children, 'props.style'));
|
|
553
570
|
|
|
554
571
|
const extraStyle = {};
|
|
555
572
|
|
|
@@ -576,8 +593,8 @@ export default class Tooltip extends BaseComponent {
|
|
|
576
593
|
|
|
577
594
|
|
|
578
595
|
const newChild = /*#__PURE__*/React.cloneElement(children, _Object$assign(_Object$assign(_Object$assign({}, children.props), this.mergeEvents(children.props, triggerEventSet)), {
|
|
579
|
-
style: _Object$assign(_Object$assign({},
|
|
580
|
-
className: classNames(
|
|
596
|
+
style: _Object$assign(_Object$assign({}, _get(children, 'props.style')), extraStyle),
|
|
597
|
+
className: classNames(_get(children, 'props.className') // `${prefixCls}-trigger`
|
|
581
598
|
),
|
|
582
599
|
// to maintain refs with callback
|
|
583
600
|
ref: node => {
|
|
@@ -621,6 +638,7 @@ Tooltip.propTypes = {
|
|
|
621
638
|
content: PropTypes.node,
|
|
622
639
|
prefixCls: PropTypes.string,
|
|
623
640
|
onVisibleChange: PropTypes.func,
|
|
641
|
+
onClickOutSide: PropTypes.func,
|
|
624
642
|
spacing: PropTypes.number,
|
|
625
643
|
showArrow: PropTypes.oneOfType([PropTypes.bool, PropTypes.node]),
|
|
626
644
|
zIndex: PropTypes.number,
|
|
@@ -645,7 +663,8 @@ Tooltip.defaultProps = {
|
|
|
645
663
|
autoAdjustOverflow: true,
|
|
646
664
|
mouseEnterDelay: numbers.MOUSE_ENTER_DELAY,
|
|
647
665
|
mouseLeaveDelay: numbers.MOUSE_LEAVE_DELAY,
|
|
648
|
-
onVisibleChange:
|
|
666
|
+
onVisibleChange: _noop,
|
|
667
|
+
onClickOutSide: _noop,
|
|
649
668
|
spacing: numbers.SPACING,
|
|
650
669
|
showArrow: true,
|
|
651
670
|
arrowBounding: numbers.ARROW_BOUNDING
|
package/lib/es/transfer/index.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import _isArray from "lodash/isArray";
|
|
2
|
+
import _isEmpty from "lodash/isEmpty";
|
|
3
|
+
import _omit from "lodash/omit";
|
|
4
|
+
import _noop from "lodash/noop";
|
|
5
|
+
import _isEqual from "lodash/isEqual";
|
|
1
6
|
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
2
7
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
3
8
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
@@ -13,7 +18,6 @@ import React from 'react';
|
|
|
13
18
|
import cls from 'classnames';
|
|
14
19
|
import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc';
|
|
15
20
|
import PropTypes from 'prop-types';
|
|
16
|
-
import { isEqual, noop, omit, isEmpty, isArray } from 'lodash-es';
|
|
17
21
|
import TransferFoundation from '@douyinfe/semi-foundation/lib/es/transfer/foundation';
|
|
18
22
|
import { _generateDataByType, _generateSelectedItems } from '@douyinfe/semi-foundation/lib/es/transfer/transferUtlls';
|
|
19
23
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/transfer/constants';
|
|
@@ -47,13 +51,13 @@ class Transfer extends BaseComponent {
|
|
|
47
51
|
inputValue: ''
|
|
48
52
|
};
|
|
49
53
|
|
|
50
|
-
if (Boolean(dataSource) &&
|
|
54
|
+
if (Boolean(dataSource) && _isArray(dataSource)) {
|
|
51
55
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
56
|
// @ts-ignore Avoid reporting errors this.state.xxx is read-only
|
|
53
57
|
this.state.data = _generateDataByType(dataSource, type);
|
|
54
58
|
}
|
|
55
59
|
|
|
56
|
-
if (Boolean(defaultValue) &&
|
|
60
|
+
if (Boolean(defaultValue) && _isArray(defaultValue)) {
|
|
57
61
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
58
62
|
// @ts-ignore Avoid reporting errors this.state.xxx is read-only
|
|
59
63
|
this.state.selectedItems = _generateSelectedItems(defaultValue, this.state.data);
|
|
@@ -85,7 +89,7 @@ class Transfer extends BaseComponent {
|
|
|
85
89
|
mergedState.selectedItems = newSelectedItems;
|
|
86
90
|
}
|
|
87
91
|
|
|
88
|
-
if (!
|
|
92
|
+
if (!_isEqual(state.data, newData)) {
|
|
89
93
|
if (typeof state.inputValue === 'string' && state.inputValue !== '') {
|
|
90
94
|
const filterFunc = typeof filter === 'function' ? item => filter(state.inputValue, item) : item => {
|
|
91
95
|
var _context4;
|
|
@@ -100,7 +104,7 @@ class Transfer extends BaseComponent {
|
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
|
|
103
|
-
return
|
|
107
|
+
return _isEmpty(mergedState) ? null : mergedState;
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
get adapter() {
|
|
@@ -350,7 +354,8 @@ class Transfer extends BaseComponent {
|
|
|
350
354
|
this.foundation.handleSelect(value);
|
|
351
355
|
};
|
|
352
356
|
|
|
353
|
-
const restTreeProps =
|
|
357
|
+
const restTreeProps = _omit(treeProps, ['value', 'ref', 'onChange']);
|
|
358
|
+
|
|
354
359
|
return /*#__PURE__*/React.createElement(Tree, _Object$assign({
|
|
355
360
|
disabled: disabled,
|
|
356
361
|
treeData: dataSource,
|
|
@@ -606,11 +611,11 @@ Transfer.propTypes = {
|
|
|
606
611
|
Transfer.defaultProps = {
|
|
607
612
|
type: strings.TYPE_LIST,
|
|
608
613
|
dataSource: [],
|
|
609
|
-
onSearch:
|
|
610
|
-
onChange:
|
|
611
|
-
onSelect:
|
|
612
|
-
onDeselect:
|
|
613
|
-
onClear:
|
|
614
|
+
onSearch: _noop,
|
|
615
|
+
onChange: _noop,
|
|
616
|
+
onSelect: _noop,
|
|
617
|
+
onDeselect: _noop,
|
|
618
|
+
onClear: _noop,
|
|
614
619
|
defaultValue: [],
|
|
615
620
|
emptyContent: {},
|
|
616
621
|
showPath: false
|
package/lib/es/tree/autoSizer.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import _get from "lodash/get";
|
|
1
2
|
import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
|
|
2
3
|
import React, { PureComponent } from 'react';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/tree/constants';
|
|
5
6
|
import ResizeObserver from '../resizeObserver';
|
|
6
|
-
import { get } from 'lodash-es';
|
|
7
7
|
const prefixcls = cssClasses.PREFIX;
|
|
8
8
|
export default class AutoSizer extends PureComponent {
|
|
9
9
|
constructor(props) {
|
|
@@ -14,10 +14,10 @@ export default class AutoSizer extends PureComponent {
|
|
|
14
14
|
const target = entries && entries[1] && entries[1].target;
|
|
15
15
|
|
|
16
16
|
if (target) {
|
|
17
|
-
const height =
|
|
17
|
+
const height = _get(target, 'offsetHeight') || 0;
|
|
18
18
|
const style = window.getComputedStyle(target) || {};
|
|
19
|
-
const paddingTop = _parseInt(
|
|
20
|
-
const paddingBottom = _parseInt(
|
|
19
|
+
const paddingTop = _parseInt(_get(style, 'paddingTop'), 10) || 0;
|
|
20
|
+
const paddingBottom = _parseInt(_get(style, 'paddingBottom'), 10) || 0;
|
|
21
21
|
const newHeight = height - paddingTop - paddingBottom;
|
|
22
22
|
|
|
23
23
|
if (this.state.height !== newHeight) {
|
package/lib/es/tree/collapse.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import _noop from "lodash/noop";
|
|
1
2
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
3
|
|
|
3
4
|
/* eslint-disable arrow-body-style */
|
|
4
5
|
import React, { useRef, useState, useEffect, useCallback } from 'react';
|
|
5
6
|
import { Transition } from '@douyinfe/semi-animation-react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { noop } from 'lodash-es';
|
|
8
8
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/collapsible/constants';
|
|
9
9
|
import getMotionObjFromProps from '@douyinfe/semi-foundation/lib/es/utils/getMotionObjFromProps';
|
|
10
10
|
const ease = 'cubicBezier(.25,.1,.25,1)';
|
|
@@ -134,6 +134,6 @@ Collapse.propType = {
|
|
|
134
134
|
Collapse.defaultProps = {
|
|
135
135
|
duration: 250,
|
|
136
136
|
motion: true,
|
|
137
|
-
onMotionEnd:
|
|
137
|
+
onMotionEnd: _noop
|
|
138
138
|
};
|
|
139
139
|
export default Collapse;
|
package/lib/es/tree/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import _isFunction from "lodash/isFunction";
|
|
2
|
+
import _get from "lodash/get";
|
|
3
|
+
import _isEqual from "lodash/isEqual";
|
|
4
|
+
import _isEmpty from "lodash/isEmpty";
|
|
1
5
|
import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
|
|
2
6
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
3
7
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
@@ -13,7 +17,6 @@ import TreeFoundation from '@douyinfe/semi-foundation/lib/es/tree/foundation';
|
|
|
13
17
|
import { convertDataToEntities, flattenTreeData, calcExpandedKeysForValues, calcMotionKeys, convertJsonToData, findKeysForValues, calcCheckedKeys, calcExpandedKeys, filterTreeData, normalizeValue, updateKeys, calcDisabledKeys } from '@douyinfe/semi-foundation/lib/es/tree/treeUtil';
|
|
14
18
|
import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/tree/constants';
|
|
15
19
|
import BaseComponent from '../_base/baseComponent';
|
|
16
|
-
import { isEmpty, isEqual, get, isFunction } from 'lodash-es';
|
|
17
20
|
import { cloneDeep } from './treeUtil';
|
|
18
21
|
import Input from '../input/index';
|
|
19
22
|
import { FixedSizeList as VirtualList } from 'react-window';
|
|
@@ -50,7 +53,7 @@ class Tree extends BaseComponent {
|
|
|
50
53
|
componentName: "Tree"
|
|
51
54
|
}, locale => /*#__PURE__*/React.createElement(TreeNode, {
|
|
52
55
|
empty: true,
|
|
53
|
-
emptyContent:
|
|
56
|
+
emptyContent: _get(locale, 'emptyText')
|
|
54
57
|
}));
|
|
55
58
|
}
|
|
56
59
|
};
|
|
@@ -155,7 +158,7 @@ class Tree extends BaseComponent {
|
|
|
155
158
|
return /*#__PURE__*/React.createElement(TreeNode, _Object$assign({}, treeNodeProps, data, {
|
|
156
159
|
key: key,
|
|
157
160
|
data: data,
|
|
158
|
-
style:
|
|
161
|
+
style: _isEmpty(style) ? {} : style
|
|
159
162
|
}));
|
|
160
163
|
};
|
|
161
164
|
|
|
@@ -216,7 +219,7 @@ class Tree extends BaseComponent {
|
|
|
216
219
|
|
|
217
220
|
const needUpdate = name => {
|
|
218
221
|
const firstInProps = !prevProps && name in props;
|
|
219
|
-
const nameHasChange = prevProps && !
|
|
222
|
+
const nameHasChange = prevProps && !_isEqual(prevProps[name], props[name]);
|
|
220
223
|
return firstInProps || nameHasChange;
|
|
221
224
|
}; // Determine whether treeData has changed
|
|
222
225
|
|
|
@@ -490,9 +493,9 @@ class Tree extends BaseComponent {
|
|
|
490
493
|
}, /*#__PURE__*/React.createElement(LocaleConsumer, {
|
|
491
494
|
componentName: "Tree"
|
|
492
495
|
}, locale => {
|
|
493
|
-
inputProps.placeholder = searchPlaceholder ||
|
|
496
|
+
inputProps.placeholder = searchPlaceholder || _get(locale, 'searchPlaceholder');
|
|
494
497
|
|
|
495
|
-
if (
|
|
498
|
+
if (_isFunction(searchRender)) {
|
|
496
499
|
return searchRender(_Object$assign({}, inputProps));
|
|
497
500
|
}
|
|
498
501
|
|
|
@@ -521,11 +524,11 @@ class Tree extends BaseComponent {
|
|
|
521
524
|
direction
|
|
522
525
|
} = this.context;
|
|
523
526
|
|
|
524
|
-
if (
|
|
527
|
+
if (_isEmpty(flattenNodes)) {
|
|
525
528
|
return undefined;
|
|
526
529
|
}
|
|
527
530
|
|
|
528
|
-
if (!virtualize ||
|
|
531
|
+
if (!virtualize || _isEmpty(virtualize)) {
|
|
529
532
|
return /*#__PURE__*/React.createElement(NodeList, {
|
|
530
533
|
flattenNodes: flattenNodes,
|
|
531
534
|
flattenList: cachedFlattenNodes,
|
|
@@ -602,7 +605,7 @@ class Tree extends BaseComponent {
|
|
|
602
605
|
["".concat(prefixcls, "-option-list-block")]: blockNode
|
|
603
606
|
});
|
|
604
607
|
const searchNoRes = Boolean(inputValue) && !filteredKeys.size;
|
|
605
|
-
const noData =
|
|
608
|
+
const noData = _isEmpty(keyEntities) || showFilteredOnly && searchNoRes;
|
|
606
609
|
return /*#__PURE__*/React.createElement(TreeContext.Provider, {
|
|
607
610
|
value: {
|
|
608
611
|
treeDisabled: disabled,
|
|
@@ -22,7 +22,7 @@ export interface OnDragProps extends BasicOnDragProps {
|
|
|
22
22
|
export interface DragEnterProps extends DragProps {
|
|
23
23
|
expandedKeys?: string[];
|
|
24
24
|
}
|
|
25
|
-
export interface
|
|
25
|
+
export interface ExpandedOtherProps extends BasicExpandedOtherProps {
|
|
26
26
|
node: TreeNodeData;
|
|
27
27
|
}
|
|
28
28
|
export interface RenderFullLabelProps extends BasicRenderFullLabelProps {
|
|
@@ -57,7 +57,7 @@ export interface TreeProps extends BasicTreeProps {
|
|
|
57
57
|
onDragStart?: (dragProps: DragProps) => void;
|
|
58
58
|
onDragEnter?: (dragEnterProps: DragEnterProps) => void;
|
|
59
59
|
onDrop?: (onDragProps: OnDragProps) => void;
|
|
60
|
-
onExpand?: (expandedKeys: string[],
|
|
60
|
+
onExpand?: (expandedKeys: string[], expandedOtherProps: ExpandedOtherProps) => void;
|
|
61
61
|
onLoad?: (loadedKeys?: Set<string>, treeNode?: TreeNodeData) => void;
|
|
62
62
|
onContextMenu?: (e: MouseEvent, node: TreeNodeData) => void;
|
|
63
63
|
onSelect?: (selectedKeys: string, selected: boolean, selectedNode: TreeNodeData) => void;
|
package/lib/es/tree/nodeList.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import _isEqual from "lodash/isEqual";
|
|
1
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
2
3
|
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
3
4
|
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/splice";
|
|
4
5
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
5
6
|
import React, { PureComponent } from 'react';
|
|
6
|
-
import { isEqual } from 'lodash-es';
|
|
7
7
|
import TreeContext from './treeContext';
|
|
8
8
|
import Collapse from './collapse';
|
|
9
9
|
|
|
@@ -41,7 +41,7 @@ export default class NodeList extends PureComponent {
|
|
|
41
41
|
motionType,
|
|
42
42
|
flattenList = []
|
|
43
43
|
} = props;
|
|
44
|
-
const hasChanged = !
|
|
44
|
+
const hasChanged = !_isEqual(prevState.cachedMotionKeys, motionKeys) || !_isEqual(_mapInstanceProperty(_context = prevState.cachedData).call(_context, i => i.key), _mapInstanceProperty(flattenNodes).call(flattenNodes, i => i.key));
|
|
45
45
|
const motionArr = [...motionKeys];
|
|
46
46
|
|
|
47
47
|
if (!hasChanged || !motionArr.length) {
|
package/lib/es/tree/treeNode.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _isString from "lodash/isString";
|
|
2
|
+
import _isFunction from "lodash/isFunction";
|
|
3
|
+
import _debounce from "lodash/debounce";
|
|
1
4
|
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
2
5
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
3
6
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
@@ -19,7 +22,6 @@ import React, { PureComponent } from 'react';
|
|
|
19
22
|
import cls from 'classnames';
|
|
20
23
|
import PropTypes from 'prop-types';
|
|
21
24
|
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/tree/constants';
|
|
22
|
-
import { debounce, isFunction, isString } from 'lodash-es';
|
|
23
25
|
import { IconTreeTriangleDown, IconFile, IconFolder, IconFolderOpen } from '@douyinfe/semi-icons';
|
|
24
26
|
import { Checkbox } from '../checkbox';
|
|
25
27
|
import TreeContext from './treeContext';
|
|
@@ -92,7 +94,7 @@ export default class TreeNode extends PureComponent {
|
|
|
92
94
|
e.stopPropagation();
|
|
93
95
|
e.nativeEvent.stopImmediatePropagation();
|
|
94
96
|
|
|
95
|
-
if (
|
|
97
|
+
if (_isFunction(onNodeDoubleClick)) {
|
|
96
98
|
onNodeDoubleClick(e, this.props);
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -222,9 +224,9 @@ export default class TreeNode extends PureComponent {
|
|
|
222
224
|
treeNodeFilterProp
|
|
223
225
|
} = this.props;
|
|
224
226
|
|
|
225
|
-
if (
|
|
227
|
+
if (_isFunction(renderLabel)) {
|
|
226
228
|
return renderLabel(label, data);
|
|
227
|
-
} else if (
|
|
229
|
+
} else if (_isString(label) && filtered && keyword && treeNodeFilterProp === 'label') {
|
|
228
230
|
var _context;
|
|
229
231
|
|
|
230
232
|
const content = [];
|
|
@@ -251,7 +253,7 @@ export default class TreeNode extends PureComponent {
|
|
|
251
253
|
};
|
|
252
254
|
|
|
253
255
|
this.state = {};
|
|
254
|
-
this.debounceSelect =
|
|
256
|
+
this.debounceSelect = _debounce(this.onSelect, 500, {
|
|
255
257
|
leading: true,
|
|
256
258
|
trailing: false
|
|
257
259
|
});
|