@douyinfe/semi-ui 2.19.0-alpha.8 → 2.19.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/_utils/index.ts +9 -5
- package/anchor/index.tsx +39 -7
- package/anchor/link.tsx +11 -2
- package/avatar/index.tsx +3 -1
- package/calendar/_story/calendar.stories.js +20 -3
- package/checkbox/checkbox.tsx +3 -1
- package/dist/css/semi.css +7 -17
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +2987 -12956
- 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/dropdown/index.tsx +5 -1
- package/form/interface.ts +1 -1
- package/getBabelConfig.js +1 -13
- package/lib/cjs/_base/base.css +1 -0
- package/lib/cjs/_base/base.js +1 -3
- package/lib/cjs/_base/baseComponent.js +4 -9
- package/lib/cjs/_base/reactUtils.js +4 -9
- package/lib/cjs/_portal/index.js +4 -9
- package/lib/cjs/_utils/hooks/usePrevFocus.js +3 -6
- package/lib/cjs/_utils/index.js +13 -25
- package/lib/cjs/anchor/anchor-context.js +3 -6
- package/lib/cjs/anchor/index.d.ts +4 -0
- package/lib/cjs/anchor/index.js +50 -36
- package/lib/cjs/anchor/link.d.ts +2 -0
- package/lib/cjs/anchor/link.js +15 -18
- package/lib/cjs/autoComplete/index.js +13 -30
- package/lib/cjs/autoComplete/option.js +12 -25
- package/lib/cjs/avatar/avatarGroup.js +18 -49
- package/lib/cjs/avatar/index.d.ts +1 -0
- package/lib/cjs/avatar/index.js +25 -48
- package/lib/cjs/avatar/interface.js +1 -3
- package/lib/cjs/backtop/index.js +8 -17
- package/lib/cjs/badge/index.js +14 -31
- package/lib/cjs/banner/index.js +5 -14
- package/lib/cjs/breadcrumb/bread-context.js +3 -6
- package/lib/cjs/breadcrumb/index.js +13 -34
- package/lib/cjs/breadcrumb/item.js +8 -21
- package/lib/cjs/button/Button.js +13 -32
- package/lib/cjs/button/buttonGroup.js +12 -41
- package/lib/cjs/button/index.js +7 -12
- package/lib/cjs/button/splitButtonGroup.js +3 -6
- package/lib/cjs/calendar/dayCalendar.js +20 -37
- package/lib/cjs/calendar/dayCol.js +10 -25
- package/lib/cjs/calendar/index.js +9 -25
- package/lib/cjs/calendar/interface.js +1 -3
- package/lib/cjs/calendar/monthCalendar.js +20 -45
- package/lib/cjs/calendar/rangeCalendar.js +19 -44
- package/lib/cjs/calendar/timeCol.js +10 -25
- package/lib/cjs/calendar/weekCalendar.js +19 -44
- package/lib/cjs/card/cardGroup.js +9 -22
- package/lib/cjs/card/index.js +12 -33
- package/lib/cjs/card/meta.js +9 -22
- package/lib/cjs/carousel/CarouselArrow.js +8 -17
- package/lib/cjs/carousel/CarouselIndicator.js +11 -26
- package/lib/cjs/carousel/index.js +10 -29
- package/lib/cjs/carousel/interface.js +1 -3
- package/lib/cjs/cascader/index.js +37 -68
- package/lib/cjs/cascader/item.js +24 -49
- package/lib/cjs/checkbox/checkbox.d.ts +1 -0
- package/lib/cjs/checkbox/checkbox.js +9 -17
- package/lib/cjs/checkbox/checkboxGroup.js +13 -34
- package/lib/cjs/checkbox/checkboxInner.js +6 -15
- package/lib/cjs/checkbox/context.js +3 -6
- package/lib/cjs/checkbox/index.js +4 -8
- package/lib/cjs/collapse/collapse-context.js +3 -6
- package/lib/cjs/collapse/index.js +12 -29
- package/lib/cjs/collapse/item.js +9 -22
- package/lib/cjs/collapsible/index.js +7 -16
- package/lib/cjs/configProvider/context.js +3 -6
- package/lib/cjs/configProvider/index.js +7 -16
- package/lib/cjs/datePicker/dateInput.js +15 -34
- package/lib/cjs/datePicker/datePicker.js +22 -45
- package/lib/cjs/datePicker/footer.js +3 -6
- package/lib/cjs/datePicker/index.js +9 -20
- package/lib/cjs/datePicker/insetInput.js +4 -9
- package/lib/cjs/datePicker/month.js +15 -26
- package/lib/cjs/datePicker/monthsGrid.js +13 -32
- package/lib/cjs/datePicker/navigation.js +5 -12
- package/lib/cjs/datePicker/quickControl.js +18 -31
- package/lib/cjs/datePicker/yearAndMonth.js +13 -30
- package/lib/cjs/descriptions/descriptions-context.js +3 -6
- package/lib/cjs/descriptions/index.js +8 -23
- package/lib/cjs/descriptions/item.js +7 -18
- package/lib/cjs/divider/index.js +9 -22
- package/lib/cjs/dropdown/context.js +3 -6
- package/lib/cjs/dropdown/dropdownDivider.js +3 -6
- package/lib/cjs/dropdown/dropdownItem.js +8 -21
- package/lib/cjs/dropdown/dropdownMenu.js +8 -17
- package/lib/cjs/dropdown/dropdownTitle.js +5 -12
- package/lib/cjs/dropdown/index.js +17 -26
- package/lib/cjs/empty/index.js +5 -14
- package/lib/cjs/form/arrayField.js +28 -57
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/baseForm.js +18 -43
- package/lib/cjs/form/context.js +3 -6
- package/lib/cjs/form/errorMessage.js +7 -18
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/form/field.js +3 -6
- package/lib/cjs/form/group.js +16 -31
- package/lib/cjs/form/hoc/withField.js +26 -53
- package/lib/cjs/form/hoc/withFormApi.js +4 -9
- package/lib/cjs/form/hoc/withFormState.js +4 -9
- package/lib/cjs/form/hooks/index.js +11 -20
- package/lib/cjs/form/hooks/useArrayFieldState.js +1 -4
- package/lib/cjs/form/hooks/useFieldApi.js +3 -6
- package/lib/cjs/form/hooks/useFieldState.js +6 -15
- package/lib/cjs/form/hooks/useFormApi.js +1 -4
- package/lib/cjs/form/hooks/useFormState.js +1 -4
- package/lib/cjs/form/hooks/useFormUpdater.js +1 -4
- package/lib/cjs/form/hooks/useStateWithGetter.js +1 -4
- package/lib/cjs/form/index.js +15 -34
- package/lib/cjs/form/interface.d.ts +1 -1
- package/lib/cjs/form/interface.js +3 -10
- package/lib/cjs/form/label.js +5 -12
- package/lib/cjs/form/section.js +5 -12
- package/lib/cjs/form/slot.js +18 -35
- package/lib/cjs/grid/col.js +20 -37
- package/lib/cjs/grid/index.js +6 -10
- package/lib/cjs/grid/row.js +18 -45
- package/lib/cjs/iconButton/index.js +13 -30
- package/lib/cjs/icons/index.js +3 -6
- package/lib/cjs/index.js +94 -189
- package/lib/cjs/input/index.js +13 -26
- package/lib/cjs/input/inputGroup.js +11 -32
- package/lib/cjs/input/textarea.js +11 -24
- package/lib/cjs/inputNumber/index.js +12 -29
- package/lib/cjs/layout/Sider.js +11 -36
- package/lib/cjs/layout/index.js +13 -32
- package/lib/cjs/layout/layout-context.js +3 -6
- package/lib/cjs/list/index.js +9 -25
- package/lib/cjs/list/item.js +10 -27
- package/lib/cjs/list/list-context.js +3 -6
- package/lib/cjs/locale/context.js +3 -6
- package/lib/cjs/locale/interface.js +1 -3
- package/lib/cjs/locale/localeConsumer.js +5 -12
- package/lib/cjs/locale/localeProvider.js +5 -12
- package/lib/cjs/locale/source/ar.js +1 -4
- package/lib/cjs/locale/source/de.js +1 -4
- package/lib/cjs/locale/source/en_GB.js +1 -4
- package/lib/cjs/locale/source/en_US.js +1 -4
- package/lib/cjs/locale/source/es.js +1 -4
- package/lib/cjs/locale/source/fr.js +1 -4
- package/lib/cjs/locale/source/id_ID.js +1 -4
- package/lib/cjs/locale/source/it.js +1 -4
- package/lib/cjs/locale/source/ja_JP.js +1 -4
- package/lib/cjs/locale/source/ko_KR.js +1 -4
- package/lib/cjs/locale/source/ms_MY.js +1 -4
- package/lib/cjs/locale/source/pt_BR.js +1 -4
- package/lib/cjs/locale/source/ru_RU.js +1 -4
- package/lib/cjs/locale/source/th_TH.js +1 -4
- package/lib/cjs/locale/source/tr_TR.js +1 -4
- package/lib/cjs/locale/source/vi_VN.js +1 -4
- package/lib/cjs/locale/source/zh_CN.js +1 -4
- package/lib/cjs/locale/source/zh_TW.js +1 -4
- package/lib/cjs/modal/ConfirmModal.js +11 -28
- package/lib/cjs/modal/Modal.js +14 -33
- package/lib/cjs/modal/ModalContent.js +14 -35
- package/lib/cjs/modal/confirm.js +15 -21
- package/lib/cjs/modal/index.js +3 -6
- package/lib/cjs/modal/useModal/HookModal.js +10 -19
- package/lib/cjs/modal/useModal/index.js +4 -9
- package/lib/cjs/motions/Rotate.js +7 -18
- package/lib/cjs/navigation/CollapseButton.js +4 -9
- package/lib/cjs/navigation/Footer.js +6 -15
- package/lib/cjs/navigation/Header.js +6 -15
- package/lib/cjs/navigation/Item.js +9 -28
- package/lib/cjs/navigation/OpenIconTransition.js +6 -15
- package/lib/cjs/navigation/SubNav.js +10 -29
- package/lib/cjs/navigation/SubNavTransition.js +5 -12
- package/lib/cjs/navigation/index.js +25 -46
- package/lib/cjs/navigation/nav-context.js +3 -6
- package/lib/cjs/notification/NoticeTransition.js +4 -9
- package/lib/cjs/notification/index.js +24 -51
- package/lib/cjs/notification/notice.js +13 -30
- package/lib/cjs/notification/useNotification/HookNotice.js +9 -22
- package/lib/cjs/notification/useNotification/index.js +18 -41
- package/lib/cjs/overflowList/index.js +13 -28
- package/lib/cjs/overflowList/intersectionObserver.js +7 -18
- package/lib/cjs/pagination/index.js +15 -38
- package/lib/cjs/popconfirm/index.js +16 -25
- package/lib/cjs/popover/Arrow.js +10 -19
- package/lib/cjs/popover/index.js +8 -17
- package/lib/cjs/progress/index.js +7 -20
- package/lib/cjs/radio/context.js +3 -6
- package/lib/cjs/radio/index.js +4 -8
- package/lib/cjs/radio/radio.d.ts +1 -0
- package/lib/cjs/radio/radio.js +11 -19
- package/lib/cjs/radio/radioGroup.js +11 -26
- package/lib/cjs/radio/radioInner.js +7 -16
- package/lib/cjs/rating/index.js +10 -27
- package/lib/cjs/rating/item.js +10 -19
- package/lib/cjs/resizeObserver/index.js +3 -6
- package/lib/cjs/scrollList/index.js +3 -6
- package/lib/cjs/scrollList/scrollItem.js +13 -26
- package/lib/cjs/select/index.js +46 -91
- package/lib/cjs/select/option.js +12 -25
- package/lib/cjs/select/optionGroup.js +3 -6
- package/lib/cjs/select/utils.js +12 -29
- package/lib/cjs/select/virtualRow.js +1 -4
- package/lib/cjs/sideSheet/SideSheetContent.js +9 -22
- package/lib/cjs/sideSheet/SideSheetTransition.js +4 -9
- package/lib/cjs/sideSheet/index.js +15 -28
- package/lib/cjs/skeleton/index.js +9 -22
- package/lib/cjs/skeleton/item.js +13 -34
- package/lib/cjs/slider/index.js +18 -48
- package/lib/cjs/space/index.js +7 -20
- package/lib/cjs/space/utils.js +9 -24
- package/lib/cjs/spin/icon.js +7 -16
- package/lib/cjs/spin/index.js +5 -14
- package/lib/cjs/steps/basicStep.js +4 -11
- package/lib/cjs/steps/basicSteps.js +12 -29
- package/lib/cjs/steps/context.js +3 -6
- package/lib/cjs/steps/fillStep.js +4 -11
- package/lib/cjs/steps/fillSteps.js +12 -28
- package/lib/cjs/steps/index.js +11 -24
- package/lib/cjs/steps/navStep.js +3 -6
- package/lib/cjs/steps/navSteps.js +12 -28
- package/lib/cjs/steps/step.js +8 -17
- package/lib/cjs/switch/index.js +5 -10
- package/lib/cjs/table/Body/BaseRow.js +14 -27
- package/lib/cjs/table/Body/ExpandedRow.js +10 -23
- package/lib/cjs/table/Body/SectionRow.js +15 -36
- package/lib/cjs/table/Body/index.js +39 -64
- package/lib/cjs/table/ColGroup.js +4 -11
- package/lib/cjs/table/Column.js +4 -9
- package/lib/cjs/table/ColumnFilter.js +18 -41
- package/lib/cjs/table/ColumnSelection.js +6 -11
- package/lib/cjs/table/ColumnShape.js +3 -6
- package/lib/cjs/table/ColumnSorter.js +6 -15
- package/lib/cjs/table/CustomExpandIcon.js +5 -12
- package/lib/cjs/table/HeadTable.js +7 -14
- package/lib/cjs/table/ResizableHeaderCell.js +9 -22
- package/lib/cjs/table/ResizableTable.js +23 -40
- package/lib/cjs/table/Table.js +63 -96
- package/lib/cjs/table/TableCell.js +13 -26
- package/lib/cjs/table/TableContextProvider.js +5 -12
- package/lib/cjs/table/TableHeader.js +10 -27
- package/lib/cjs/table/TableHeaderRow.js +18 -33
- package/lib/cjs/table/TablePagination.js +6 -15
- package/lib/cjs/table/getColumns.js +8 -17
- package/lib/cjs/table/index.js +8 -20
- package/lib/cjs/table/interface.js +1 -3
- package/lib/cjs/table/table-context.js +3 -6
- package/lib/cjs/table/utils.js +5 -16
- package/lib/cjs/tabs/TabBar.js +21 -44
- package/lib/cjs/tabs/TabPane.js +14 -31
- package/lib/cjs/tabs/TabPaneTransition.js +5 -10
- package/lib/cjs/tabs/index.js +32 -73
- package/lib/cjs/tabs/interface.d.ts +3 -2
- package/lib/cjs/tabs/interface.js +1 -3
- package/lib/cjs/tabs/tabs-context.js +3 -6
- package/lib/cjs/tag/group.d.ts +1 -15
- package/lib/cjs/tag/group.js +23 -34
- package/lib/cjs/tag/index.d.ts +1 -1
- package/lib/cjs/tag/index.js +20 -48
- package/lib/cjs/tag/interface.d.ts +6 -3
- package/lib/cjs/tag/interface.js +1 -3
- package/lib/cjs/tagInput/index.js +13 -30
- package/lib/cjs/timePicker/Combobox.js +19 -40
- package/lib/cjs/timePicker/PanelShape.js +3 -6
- package/lib/cjs/timePicker/TimeInput.js +9 -20
- package/lib/cjs/timePicker/TimePicker.js +21 -38
- package/lib/cjs/timePicker/TimeShape.js +3 -6
- package/lib/cjs/timePicker/index.js +4 -9
- package/lib/cjs/timeline/index.js +21 -48
- package/lib/cjs/timeline/item.js +7 -20
- package/lib/cjs/toast/ToastTransition.js +4 -9
- package/lib/cjs/toast/index.js +20 -45
- package/lib/cjs/toast/toast.js +9 -20
- package/lib/cjs/toast/useToast/HookToast.js +9 -22
- package/lib/cjs/toast/useToast/index.js +14 -27
- package/lib/cjs/tooltip/ArrowBoundingShape.js +3 -6
- package/lib/cjs/tooltip/TooltipStyledTransition.js +4 -9
- package/lib/cjs/tooltip/TriangleArrow.js +7 -16
- package/lib/cjs/tooltip/TriangleArrowVertical.js +7 -16
- package/lib/cjs/tooltip/index.js +27 -48
- package/lib/cjs/transfer/index.js +30 -63
- package/lib/cjs/tree/autoSizer.js +7 -16
- package/lib/cjs/tree/collapse.js +7 -16
- package/lib/cjs/tree/index.js +46 -70
- package/lib/cjs/tree/interface.js +1 -3
- package/lib/cjs/tree/nodeList.js +11 -28
- package/lib/cjs/tree/treeContext.js +3 -6
- package/lib/cjs/tree/treeNode.js +20 -39
- package/lib/cjs/tree/treeUtil.js +3 -6
- package/lib/cjs/treeSelect/index.js +51 -80
- package/lib/cjs/trigger/index.js +7 -16
- package/lib/cjs/typography/base.js +24 -49
- package/lib/cjs/typography/copyable.js +5 -12
- package/lib/cjs/typography/index.js +5 -15
- package/lib/cjs/typography/interface.js +1 -3
- package/lib/cjs/typography/paragraph.js +6 -15
- package/lib/cjs/typography/text.js +6 -15
- package/lib/cjs/typography/title.d.ts +1 -1
- package/lib/cjs/typography/title.js +10 -25
- package/lib/cjs/typography/typography.js +9 -22
- package/lib/cjs/typography/util.js +8 -21
- package/lib/cjs/upload/fileCard.js +8 -17
- package/lib/cjs/upload/index.js +14 -25
- package/lib/cjs/upload/interface.js +1 -3
- package/lib/es/_base/base.css +1 -0
- package/lib/es/_base/baseComponent.js +1 -3
- package/lib/es/_portal/index.js +1 -2
- package/lib/es/_utils/index.js +9 -15
- package/lib/es/anchor/index.d.ts +4 -0
- package/lib/es/anchor/index.js +46 -31
- package/lib/es/anchor/link.d.ts +2 -0
- package/lib/es/anchor/link.js +12 -10
- package/lib/es/autoComplete/index.js +10 -21
- package/lib/es/autoComplete/option.js +7 -10
- package/lib/es/avatar/avatarGroup.js +13 -33
- package/lib/es/avatar/index.d.ts +1 -0
- package/lib/es/avatar/index.js +20 -31
- package/lib/es/backtop/index.js +5 -9
- package/lib/es/badge/index.js +7 -13
- package/lib/es/banner/index.js +2 -7
- package/lib/es/breadcrumb/index.js +10 -27
- package/lib/es/breadcrumb/item.js +3 -7
- package/lib/es/button/Button.js +8 -16
- package/lib/es/button/buttonGroup.js +7 -22
- package/lib/es/button/index.js +4 -6
- package/lib/es/calendar/dayCalendar.js +15 -30
- package/lib/es/calendar/dayCol.js +5 -16
- package/lib/es/calendar/index.js +4 -8
- package/lib/es/calendar/monthCalendar.js +15 -35
- package/lib/es/calendar/rangeCalendar.js +14 -36
- package/lib/es/calendar/timeCol.js +3 -12
- package/lib/es/calendar/weekCalendar.js +14 -36
- package/lib/es/card/cardGroup.js +4 -8
- package/lib/es/card/index.js +7 -15
- package/lib/es/card/meta.js +4 -8
- package/lib/es/carousel/CarouselArrow.js +5 -9
- package/lib/es/carousel/CarouselIndicator.js +8 -17
- package/lib/es/carousel/index.js +5 -13
- package/lib/es/cascader/index.js +30 -55
- package/lib/es/cascader/item.js +17 -33
- package/lib/es/checkbox/checkbox.d.ts +1 -0
- package/lib/es/checkbox/checkbox.js +4 -8
- package/lib/es/checkbox/checkboxGroup.js +8 -23
- package/lib/es/checkbox/checkboxInner.js +1 -2
- package/lib/es/collapse/index.js +9 -17
- package/lib/es/collapse/item.js +4 -8
- package/lib/es/collapsible/index.js +2 -4
- package/lib/es/configProvider/index.js +4 -8
- package/lib/es/datePicker/dateInput.js +12 -27
- package/lib/es/datePicker/datePicker.js +17 -35
- package/lib/es/datePicker/index.js +4 -10
- package/lib/es/datePicker/insetInput.js +1 -2
- package/lib/es/datePicker/month.js +12 -18
- package/lib/es/datePicker/monthsGrid.js +10 -26
- package/lib/es/datePicker/quickControl.js +13 -18
- package/lib/es/datePicker/yearAndMonth.js +10 -22
- package/lib/es/descriptions/index.js +3 -8
- package/lib/es/descriptions/item.js +2 -5
- package/lib/es/divider/index.js +6 -13
- package/lib/es/dropdown/dropdownItem.js +3 -10
- package/lib/es/dropdown/dropdownMenu.js +5 -9
- package/lib/es/dropdown/index.js +16 -17
- package/lib/es/empty/index.js +2 -6
- package/lib/es/form/arrayField.js +20 -42
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/baseForm.js +11 -28
- package/lib/es/form/errorMessage.js +2 -6
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/form/group.js +7 -16
- package/lib/es/form/hoc/withField.js +21 -41
- package/lib/es/form/hoc/withFormApi.js +1 -2
- package/lib/es/form/hoc/withFormState.js +1 -2
- package/lib/es/form/hooks/useFieldState.js +1 -2
- package/lib/es/form/interface.d.ts +1 -1
- package/lib/es/form/slot.js +11 -18
- package/lib/es/grid/col.js +17 -29
- package/lib/es/grid/row.js +15 -36
- package/lib/es/iconButton/index.js +8 -14
- package/lib/es/input/index.js +10 -17
- package/lib/es/input/inputGroup.js +8 -20
- package/lib/es/input/textarea.js +8 -15
- package/lib/es/inputNumber/index.js +9 -18
- package/lib/es/layout/Sider.js +8 -26
- package/lib/es/layout/index.js +10 -22
- package/lib/es/list/index.js +5 -18
- package/lib/es/list/item.js +5 -11
- package/lib/es/modal/ConfirmModal.js +6 -13
- package/lib/es/modal/Modal.js +9 -16
- package/lib/es/modal/ModalContent.js +9 -21
- package/lib/es/modal/confirm.js +11 -15
- package/lib/es/modal/useModal/HookModal.js +7 -10
- package/lib/es/modal/useModal/index.js +1 -2
- package/lib/es/motions/Rotate.js +2 -4
- package/lib/es/navigation/CollapseButton.js +1 -2
- package/lib/es/navigation/Footer.js +1 -2
- package/lib/es/navigation/Header.js +1 -2
- package/lib/es/navigation/Item.js +6 -19
- package/lib/es/navigation/OpenIconTransition.js +1 -2
- package/lib/es/navigation/SubNav.js +7 -20
- package/lib/es/navigation/index.js +20 -35
- package/lib/es/notification/NoticeTransition.js +1 -2
- package/lib/es/notification/index.js +19 -40
- package/lib/es/notification/notice.js +8 -17
- package/lib/es/notification/useNotification/HookNotice.js +4 -8
- package/lib/es/notification/useNotification/index.js +13 -26
- package/lib/es/overflowList/index.js +10 -18
- package/lib/es/overflowList/intersectionObserver.js +4 -10
- package/lib/es/pagination/index.js +10 -28
- package/lib/es/popconfirm/index.js +13 -16
- package/lib/es/popover/Arrow.js +7 -11
- package/lib/es/popover/index.js +5 -8
- package/lib/es/progress/index.js +2 -8
- package/lib/es/radio/radio.d.ts +1 -0
- package/lib/es/radio/radio.js +6 -9
- package/lib/es/radio/radioGroup.js +6 -15
- package/lib/es/radio/radioInner.js +2 -6
- package/lib/es/rating/index.js +5 -18
- package/lib/es/rating/item.js +7 -11
- package/lib/es/scrollList/scrollItem.js +8 -14
- package/lib/es/select/index.js +38 -76
- package/lib/es/select/option.js +7 -10
- package/lib/es/select/utils.js +9 -22
- package/lib/es/sideSheet/SideSheetContent.js +6 -12
- package/lib/es/sideSheet/SideSheetTransition.js +1 -2
- package/lib/es/sideSheet/index.js +10 -18
- package/lib/es/skeleton/index.js +4 -8
- package/lib/es/skeleton/item.js +8 -18
- package/lib/es/slider/index.js +15 -36
- package/lib/es/space/index.js +2 -8
- package/lib/es/space/utils.js +4 -11
- package/lib/es/spin/icon.js +4 -8
- package/lib/es/spin/index.js +2 -6
- package/lib/es/steps/basicStep.js +1 -4
- package/lib/es/steps/basicSteps.js +6 -17
- package/lib/es/steps/fillStep.js +1 -4
- package/lib/es/steps/fillSteps.js +5 -17
- package/lib/es/steps/index.js +6 -9
- package/lib/es/steps/navSteps.js +5 -17
- package/lib/es/steps/step.js +3 -4
- package/lib/es/switch/index.js +2 -3
- package/lib/es/table/Body/BaseRow.js +9 -14
- package/lib/es/table/Body/ExpandedRow.js +5 -8
- package/lib/es/table/Body/SectionRow.js +10 -18
- package/lib/es/table/Body/index.js +34 -56
- package/lib/es/table/ColGroup.js +1 -5
- package/lib/es/table/Column.js +1 -2
- package/lib/es/table/ColumnFilter.js +13 -30
- package/lib/es/table/ColumnSelection.js +3 -4
- package/lib/es/table/ColumnSorter.js +1 -2
- package/lib/es/table/HeadTable.js +4 -6
- package/lib/es/table/ResizableHeaderCell.js +6 -13
- package/lib/es/table/ResizableTable.js +18 -36
- package/lib/es/table/Table.js +56 -76
- package/lib/es/table/TableCell.js +8 -13
- package/lib/es/table/TableHeader.js +7 -18
- package/lib/es/table/TableHeaderRow.js +13 -21
- package/lib/es/table/TablePagination.js +1 -2
- package/lib/es/table/getColumns.js +3 -10
- package/lib/es/table/index.js +3 -4
- package/lib/es/table/utils.js +1 -7
- package/lib/es/tabs/TabBar.js +18 -36
- package/lib/es/tabs/TabPane.js +9 -18
- package/lib/es/tabs/TabPaneTransition.js +2 -3
- package/lib/es/tabs/index.js +22 -48
- package/lib/es/tabs/interface.d.ts +3 -2
- package/lib/es/tag/group.d.ts +1 -15
- package/lib/es/tag/group.js +18 -24
- package/lib/es/tag/index.d.ts +1 -1
- package/lib/es/tag/index.js +13 -24
- package/lib/es/tag/interface.d.ts +6 -3
- package/lib/es/tagInput/index.js +10 -21
- package/lib/es/timePicker/Combobox.js +14 -23
- package/lib/es/timePicker/TimeInput.js +6 -10
- package/lib/es/timePicker/TimePicker.js +16 -27
- package/lib/es/timePicker/index.js +1 -2
- package/lib/es/timeline/index.js +14 -32
- package/lib/es/timeline/item.js +2 -6
- package/lib/es/toast/ToastTransition.js +1 -2
- package/lib/es/toast/index.js +17 -37
- package/lib/es/toast/toast.js +4 -10
- package/lib/es/toast/useToast/HookToast.js +4 -8
- package/lib/es/toast/useToast/index.js +11 -18
- package/lib/es/tooltip/TooltipStyledTransition.js +1 -3
- package/lib/es/tooltip/TriangleArrow.js +4 -8
- package/lib/es/tooltip/TriangleArrowVertical.js +4 -8
- package/lib/es/tooltip/index.js +20 -31
- package/lib/es/transfer/index.js +24 -47
- package/lib/es/tree/autoSizer.js +2 -3
- package/lib/es/tree/collapse.js +2 -5
- package/lib/es/tree/index.js +41 -48
- package/lib/es/tree/nodeList.js +6 -17
- package/lib/es/tree/treeNode.js +15 -23
- package/lib/es/treeSelect/index.js +44 -62
- package/lib/es/trigger/index.js +4 -8
- package/lib/es/typography/base.js +19 -34
- package/lib/es/typography/copyable.js +2 -4
- package/lib/es/typography/paragraph.js +1 -2
- package/lib/es/typography/text.js +1 -2
- package/lib/es/typography/title.d.ts +1 -1
- package/lib/es/typography/title.js +5 -11
- package/lib/es/typography/typography.js +4 -8
- package/lib/es/typography/util.js +5 -15
- package/lib/es/upload/fileCard.js +3 -4
- package/lib/es/upload/index.js +11 -16
- package/package.json +7 -8
- package/popconfirm/_story/popconfirm.stories.js +1 -1
- package/popconfirm/index.tsx +6 -6
- package/radio/radio.tsx +2 -0
- package/tabs/_story/Demo.tsx +14 -5
- package/tabs/interface.ts +3 -2
- package/tag/_story/tag.stories.js +51 -1
- package/tag/group.tsx +14 -27
- package/tag/index.tsx +1 -1
- package/tag/interface.ts +9 -5
- package/tooltip/index.tsx +2 -1
- package/transfer/_story/transfer.stories.js +2 -2
- package/treeSelect/_story/treeSelect.stories.js +3 -0
package/lib/es/rating/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
2
|
-
import _keysInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/keys";
|
|
3
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
4
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
1
|
import React from 'react';
|
|
6
2
|
import ReactDOM from 'react-dom';
|
|
7
3
|
import BaseComponent from '../_base/baseComponent';
|
|
@@ -103,8 +99,6 @@ export default class Rating extends BaseComponent {
|
|
|
103
99
|
};
|
|
104
100
|
|
|
105
101
|
this.getItemList = ariaLabelPrefix => {
|
|
106
|
-
var _context, _context2;
|
|
107
|
-
|
|
108
102
|
const {
|
|
109
103
|
count,
|
|
110
104
|
allowHalf,
|
|
@@ -120,7 +114,7 @@ export default class Rating extends BaseComponent {
|
|
|
120
114
|
focused
|
|
121
115
|
} = this.state; // index == count is for Empty rating
|
|
122
116
|
|
|
123
|
-
const itemList =
|
|
117
|
+
const itemList = [...Array(count + 1).keys()].map(ind => {
|
|
124
118
|
const content = /*#__PURE__*/React.createElement(Item, {
|
|
125
119
|
ref: this.saveRef(ind),
|
|
126
120
|
index: ind,
|
|
@@ -141,21 +135,18 @@ export default class Rating extends BaseComponent {
|
|
|
141
135
|
});
|
|
142
136
|
|
|
143
137
|
if (tooltips) {
|
|
144
|
-
var _context3;
|
|
145
|
-
|
|
146
138
|
const text = tooltips[ind] ? tooltips[ind] : '';
|
|
147
139
|
const showTips = hoverValue - 1 === ind;
|
|
148
140
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
149
141
|
visible: showTips,
|
|
150
142
|
trigger: "custom",
|
|
151
143
|
content: text,
|
|
152
|
-
key:
|
|
144
|
+
key: "".concat(ind, "-").concat(showTips)
|
|
153
145
|
}, content);
|
|
154
146
|
}
|
|
155
147
|
|
|
156
148
|
return content;
|
|
157
149
|
});
|
|
158
|
-
|
|
159
150
|
return itemList;
|
|
160
151
|
};
|
|
161
152
|
|
|
@@ -173,7 +164,7 @@ export default class Rating extends BaseComponent {
|
|
|
173
164
|
|
|
174
165
|
static getDerivedStateFromProps(nextProps, state) {
|
|
175
166
|
if ('value' in nextProps && nextProps.value !== undefined) {
|
|
176
|
-
return
|
|
167
|
+
return Object.assign(Object.assign({}, state), {
|
|
177
168
|
value: nextProps.value
|
|
178
169
|
});
|
|
179
170
|
}
|
|
@@ -182,7 +173,7 @@ export default class Rating extends BaseComponent {
|
|
|
182
173
|
}
|
|
183
174
|
|
|
184
175
|
get adapter() {
|
|
185
|
-
return
|
|
176
|
+
return Object.assign(Object.assign({}, super.adapter), {
|
|
186
177
|
focus: () => {
|
|
187
178
|
const {
|
|
188
179
|
disabled,
|
|
@@ -274,8 +265,6 @@ export default class Rating extends BaseComponent {
|
|
|
274
265
|
}
|
|
275
266
|
|
|
276
267
|
render() {
|
|
277
|
-
var _context4, _context5, _context6;
|
|
278
|
-
|
|
279
268
|
const {
|
|
280
269
|
style,
|
|
281
270
|
prefixCls,
|
|
@@ -290,9 +279,7 @@ export default class Rating extends BaseComponent {
|
|
|
290
279
|
emptyStarFocusVisible
|
|
291
280
|
} = this.state;
|
|
292
281
|
const ariaLabelPrefix = this.getAriaLabelPrefix();
|
|
293
|
-
|
|
294
|
-
const ariaLabel = _concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = _concatInstanceProperty(_context6 = "Rating: ".concat(value, " of ")).call(_context6, count, " ")).call(_context5, ariaLabelPrefix)).call(_context4, value === 1 ? '' : 's', ",");
|
|
295
|
-
|
|
282
|
+
const ariaLabel = "Rating: ".concat(value, " of ").concat(count, " ").concat(ariaLabelPrefix).concat(value === 1 ? '' : 's', ",");
|
|
296
283
|
const itemList = this.getItemList(ariaLabelPrefix);
|
|
297
284
|
const listCls = cls(prefixCls, {
|
|
298
285
|
["".concat(prefixCls, "-disabled")]: disabled,
|
package/lib/es/rating/item.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import cls from 'classnames';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
@@ -91,7 +89,7 @@ export default class Item extends BaseComponent {
|
|
|
91
89
|
}
|
|
92
90
|
|
|
93
91
|
get adapter() {
|
|
94
|
-
return
|
|
92
|
+
return Object.assign(Object.assign({}, super.adapter), {
|
|
95
93
|
setFirstStarFocus: value => {
|
|
96
94
|
this.setState({
|
|
97
95
|
firstStarFocus: value
|
|
@@ -106,8 +104,6 @@ export default class Item extends BaseComponent {
|
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
render() {
|
|
109
|
-
var _context, _context2, _context3, _context4;
|
|
110
|
-
|
|
111
107
|
const {
|
|
112
108
|
index,
|
|
113
109
|
prefixCls,
|
|
@@ -134,7 +130,7 @@ export default class Item extends BaseComponent {
|
|
|
134
130
|
const starCls = cls(prefixCls, {
|
|
135
131
|
["".concat(prefixCls, "-half")]: isHalf,
|
|
136
132
|
["".concat(prefixCls, "-full")]: isFull,
|
|
137
|
-
[
|
|
133
|
+
["".concat(prefixCls, "-").concat(size)]: !isCustomSize
|
|
138
134
|
});
|
|
139
135
|
const sizeStyle = isCustomSize ? {
|
|
140
136
|
width: size,
|
|
@@ -167,7 +163,7 @@ export default class Item extends BaseComponent {
|
|
|
167
163
|
'aria-posinset': 2 * index + 1,
|
|
168
164
|
'aria-setsize': AriaSetSize,
|
|
169
165
|
'aria-disabled': disabled,
|
|
170
|
-
'aria-label':
|
|
166
|
+
'aria-label': "".concat(index + 0.5, " ").concat(ariaLabelPrefix, "s"),
|
|
171
167
|
'aria-labelledby': this.props['aria-describedby'],
|
|
172
168
|
'aria-describedby': this.props['aria-describedby'],
|
|
173
169
|
className: cls("".concat(prefixCls, "-first"), "".concat(cssClasses.PREFIX, "-no-focus")),
|
|
@@ -187,7 +183,7 @@ export default class Item extends BaseComponent {
|
|
|
187
183
|
'aria-posinset': allowHalf ? 2 * (index + 1) : index + 1,
|
|
188
184
|
'aria-setsize': AriaSetSize,
|
|
189
185
|
'aria-disabled': disabled,
|
|
190
|
-
'aria-label':
|
|
186
|
+
'aria-label': "".concat(isEmpty ? 0 : index + 1, " ").concat(ariaLabelPrefix).concat(index === 0 ? '' : 's'),
|
|
191
187
|
'aria-labelledby': this.props['aria-describedby'],
|
|
192
188
|
'aria-describedby': this.props['aria-describedby'],
|
|
193
189
|
className: cls("".concat(prefixCls, "-second"), "".concat(cssClasses.PREFIX, "-no-focus")),
|
|
@@ -201,13 +197,13 @@ export default class Item extends BaseComponent {
|
|
|
201
197
|
};
|
|
202
198
|
return /*#__PURE__*/React.createElement("li", {
|
|
203
199
|
className: starCls,
|
|
204
|
-
style:
|
|
200
|
+
style: Object.assign({}, sizeStyle),
|
|
205
201
|
key: index
|
|
206
|
-
}, /*#__PURE__*/React.createElement("div",
|
|
202
|
+
}, /*#__PURE__*/React.createElement("div", Object.assign({}, starWrapProps), allowHalf && !isEmpty && /*#__PURE__*/React.createElement("div", Object.assign({}, firstStarProps, {
|
|
207
203
|
style: {
|
|
208
204
|
width: "".concat(firstWidth * 100, "%")
|
|
209
205
|
}
|
|
210
|
-
}), content), /*#__PURE__*/React.createElement("div",
|
|
206
|
+
}), content), /*#__PURE__*/React.createElement("div", Object.assign({}, secondStarProps, {
|
|
211
207
|
"x-semi-prop": "character"
|
|
212
208
|
}), content)));
|
|
213
209
|
}
|
|
@@ -5,10 +5,6 @@ import _find from "lodash/find";
|
|
|
5
5
|
import _throttle from "lodash/throttle";
|
|
6
6
|
import _debounce from "lodash/debounce";
|
|
7
7
|
import _noop from "lodash/noop";
|
|
8
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
9
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
10
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
11
|
-
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
12
8
|
import React from 'react';
|
|
13
9
|
import BaseComponent from '../_base/baseComponent';
|
|
14
10
|
import PropTypes from 'prop-types';
|
|
@@ -95,7 +91,7 @@ export default class ScrollItem extends BaseComponent {
|
|
|
95
91
|
list
|
|
96
92
|
} = this.props;
|
|
97
93
|
|
|
98
|
-
if (
|
|
94
|
+
if (Array.isArray(list) && list.length && index > -1) {
|
|
99
95
|
const size = list.length;
|
|
100
96
|
const indexInData = index % size;
|
|
101
97
|
return this.isDisabledData(list[indexInData]);
|
|
@@ -273,7 +269,7 @@ export default class ScrollItem extends BaseComponent {
|
|
|
273
269
|
transform: commonTrans,
|
|
274
270
|
list
|
|
275
271
|
} = _this.props;
|
|
276
|
-
return
|
|
272
|
+
return list.map((item, index) => {
|
|
277
273
|
const {
|
|
278
274
|
transform: itemTrans
|
|
279
275
|
} = item;
|
|
@@ -306,7 +302,7 @@ export default class ScrollItem extends BaseComponent {
|
|
|
306
302
|
return (
|
|
307
303
|
/*#__PURE__*/
|
|
308
304
|
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
309
|
-
React.createElement("li",
|
|
305
|
+
React.createElement("li", Object.assign({
|
|
310
306
|
key: prefixKey + index
|
|
311
307
|
}, events, {
|
|
312
308
|
className: cls,
|
|
@@ -343,8 +339,6 @@ export default class ScrollItem extends BaseComponent {
|
|
|
343
339
|
|
|
344
340
|
|
|
345
341
|
this.renderInfiniteList = () => {
|
|
346
|
-
var _context, _context2;
|
|
347
|
-
|
|
348
342
|
const {
|
|
349
343
|
list,
|
|
350
344
|
cycled,
|
|
@@ -356,13 +350,13 @@ export default class ScrollItem extends BaseComponent {
|
|
|
356
350
|
appendCount
|
|
357
351
|
} = this.state;
|
|
358
352
|
|
|
359
|
-
const prependList =
|
|
353
|
+
const prependList = _times(prependCount).reduce((arr, num) => {
|
|
360
354
|
const items = this.renderItemList("pre_".concat(num, "_"));
|
|
361
355
|
arr.unshift(...items);
|
|
362
356
|
return arr;
|
|
363
357
|
}, []);
|
|
364
358
|
|
|
365
|
-
const appendList =
|
|
359
|
+
const appendList = _times(appendCount).reduce((arr, num) => {
|
|
366
360
|
const items = this.renderItemList("app_".concat(num, "_"));
|
|
367
361
|
arr.push(...items);
|
|
368
362
|
return arr;
|
|
@@ -426,8 +420,8 @@ export default class ScrollItem extends BaseComponent {
|
|
|
426
420
|
get adapter() {
|
|
427
421
|
var _this2 = this;
|
|
428
422
|
|
|
429
|
-
return
|
|
430
|
-
setState: (states, callback) => this.setState(
|
|
423
|
+
return Object.assign(Object.assign({}, super.adapter), {
|
|
424
|
+
setState: (states, callback) => this.setState(Object.assign({}, states), callback),
|
|
431
425
|
setPrependCount: prependCount => this.setState({
|
|
432
426
|
prependCount
|
|
433
427
|
}),
|
|
@@ -509,7 +503,7 @@ export default class ScrollItem extends BaseComponent {
|
|
|
509
503
|
list
|
|
510
504
|
} = this.props;
|
|
511
505
|
|
|
512
|
-
if (isElement(refNode) && isElement(listWrapper) && typeof offset === 'number' &&
|
|
506
|
+
if (isElement(refNode) && isElement(listWrapper) && typeof offset === 'number' && Array.isArray(list) && list.length) {
|
|
513
507
|
offset = offset % list.length;
|
|
514
508
|
const refIndex = this.getIndexByNode(refNode);
|
|
515
509
|
let targetIndex = refIndex + offset;
|
package/lib/es/select/index.js
CHANGED
|
@@ -3,18 +3,6 @@ import _get from "lodash/get";
|
|
|
3
3
|
import _noop from "lodash/noop";
|
|
4
4
|
import _isString from "lodash/isString";
|
|
5
5
|
import _isEqual from "lodash/isEqual";
|
|
6
|
-
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
7
|
-
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
8
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
9
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
10
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
11
|
-
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
12
|
-
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
13
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
14
|
-
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
15
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
16
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
17
|
-
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
|
|
18
6
|
|
|
19
7
|
/* eslint-disable max-len */
|
|
20
8
|
|
|
@@ -50,8 +38,6 @@ const key = 0; // Notes: Use the label of the option as the identifier, that is,
|
|
|
50
38
|
|
|
51
39
|
class Select extends BaseComponent {
|
|
52
40
|
constructor(props) {
|
|
53
|
-
var _context, _context2, _context3, _context4, _context5, _context6;
|
|
54
|
-
|
|
55
41
|
super(props);
|
|
56
42
|
|
|
57
43
|
this.setOptionContainerEl = node => this.optionContainerEl = {
|
|
@@ -64,7 +50,7 @@ class Select extends BaseComponent {
|
|
|
64
50
|
isOpen: false,
|
|
65
51
|
isFocus: false,
|
|
66
52
|
options: [],
|
|
67
|
-
selections: new
|
|
53
|
+
selections: new Map(),
|
|
68
54
|
dropdownMinWidth: null,
|
|
69
55
|
optionKey: key,
|
|
70
56
|
inputValue: '',
|
|
@@ -85,12 +71,12 @@ class Select extends BaseComponent {
|
|
|
85
71
|
this.optionsRef = /*#__PURE__*/React.createRef();
|
|
86
72
|
this.optionContainerEl = /*#__PURE__*/React.createRef();
|
|
87
73
|
this.clickOutsideHandler = null;
|
|
88
|
-
this.onSelect =
|
|
89
|
-
this.onClear =
|
|
90
|
-
this.onMouseEnter =
|
|
91
|
-
this.onMouseLeave =
|
|
92
|
-
this.renderOption =
|
|
93
|
-
this.onKeyPress =
|
|
74
|
+
this.onSelect = this.onSelect.bind(this);
|
|
75
|
+
this.onClear = this.onClear.bind(this);
|
|
76
|
+
this.onMouseEnter = this.onMouseEnter.bind(this);
|
|
77
|
+
this.onMouseLeave = this.onMouseLeave.bind(this);
|
|
78
|
+
this.renderOption = this.renderOption.bind(this);
|
|
79
|
+
this.onKeyPress = this.onKeyPress.bind(this);
|
|
94
80
|
this.foundation = new SelectFoundation(this.adapter);
|
|
95
81
|
warning('optionLabelProp' in this.props, '[Semi Select] \'optionLabelProp\' has already been deprecated, please use \'renderSelectedItem\' instead.');
|
|
96
82
|
warning('labelInValue' in this.props, '[Semi Select] \'labelInValue\' has already been deprecated, please use \'onChangeWithObject\' instead.');
|
|
@@ -185,7 +171,7 @@ class Select extends BaseComponent {
|
|
|
185
171
|
this.props.onDeselect(value, option);
|
|
186
172
|
}
|
|
187
173
|
};
|
|
188
|
-
return
|
|
174
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, super.adapter), keyboardAdapter), filterAdapter), multipleAdapter), {
|
|
189
175
|
// Collect all subitems, each item is visible by default when collected, and is not selected
|
|
190
176
|
getOptionsFromChildren: function () {
|
|
191
177
|
let children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.children;
|
|
@@ -196,7 +182,7 @@ class Select extends BaseComponent {
|
|
|
196
182
|
} = _this.props;
|
|
197
183
|
|
|
198
184
|
if (optionList && optionList.length) {
|
|
199
|
-
options =
|
|
185
|
+
options = optionList.map((itemOpt, index) => Object.assign({
|
|
200
186
|
_show: true,
|
|
201
187
|
_selected: false,
|
|
202
188
|
_scrollIndex: index
|
|
@@ -247,7 +233,7 @@ class Select extends BaseComponent {
|
|
|
247
233
|
});
|
|
248
234
|
},
|
|
249
235
|
// clone Map, important!!!, prevent unexpected modify on state
|
|
250
|
-
getSelections: () => new
|
|
236
|
+
getSelections: () => new Map(this.state.selections),
|
|
251
237
|
notifyChange: value => {
|
|
252
238
|
this.props.onChange(value);
|
|
253
239
|
},
|
|
@@ -321,20 +307,16 @@ class Select extends BaseComponent {
|
|
|
321
307
|
return this.state.isFocusInContainer;
|
|
322
308
|
},
|
|
323
309
|
updateScrollTop: index => {
|
|
324
|
-
var _context8, _context9;
|
|
325
|
-
|
|
326
310
|
// eslint-disable-next-line max-len
|
|
327
311
|
let optionClassName = ".".concat(prefixcls, "-option-selected");
|
|
328
312
|
|
|
329
313
|
if (index !== undefined) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
optionClassName = _concatInstanceProperty(_context7 = ".".concat(prefixcls, "-option:nth-child(")).call(_context7, index, ")");
|
|
314
|
+
optionClassName = ".".concat(prefixcls, "-option:nth-child(").concat(index, ")");
|
|
333
315
|
}
|
|
334
316
|
|
|
335
|
-
let destNode = document.querySelector(
|
|
317
|
+
let destNode = document.querySelector("#".concat(prefixcls, "-").concat(this.selectOptionListID, " ").concat(optionClassName));
|
|
336
318
|
|
|
337
|
-
if (
|
|
319
|
+
if (Array.isArray(destNode)) {
|
|
338
320
|
// eslint-disable-next-line prefer-destructuring
|
|
339
321
|
destNode = destNode[0];
|
|
340
322
|
}
|
|
@@ -362,12 +344,8 @@ class Select extends BaseComponent {
|
|
|
362
344
|
}
|
|
363
345
|
|
|
364
346
|
componentDidUpdate(prevProps, prevState) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const prevChildrenKeys = _mapInstanceProperty(_context10 = React.Children.toArray(prevProps.children)).call(_context10, child => child.key);
|
|
368
|
-
|
|
369
|
-
const nowChildrenKeys = _mapInstanceProperty(_context11 = React.Children.toArray(this.props.children)).call(_context11, child => child.key);
|
|
370
|
-
|
|
347
|
+
const prevChildrenKeys = React.Children.toArray(prevProps.children).map(child => child.key);
|
|
348
|
+
const nowChildrenKeys = React.Children.toArray(this.props.children).map(child => child.key);
|
|
371
349
|
let isOptionsChanged = false;
|
|
372
350
|
|
|
373
351
|
if (!_isEqual(prevChildrenKeys, nowChildrenKeys) || !_isEqual(prevProps.optionList, this.props.optionList)) {
|
|
@@ -386,8 +364,6 @@ class Select extends BaseComponent {
|
|
|
386
364
|
}
|
|
387
365
|
|
|
388
366
|
renderInput() {
|
|
389
|
-
var _context12;
|
|
390
|
-
|
|
391
367
|
const {
|
|
392
368
|
size,
|
|
393
369
|
multiple,
|
|
@@ -406,14 +382,12 @@ class Select extends BaseComponent {
|
|
|
406
382
|
inputValue,
|
|
407
383
|
focusIndex
|
|
408
384
|
} = this.state;
|
|
409
|
-
|
|
410
|
-
const selectInputProps = _Object$assign({
|
|
385
|
+
const selectInputProps = Object.assign({
|
|
411
386
|
value: inputValue,
|
|
412
387
|
disabled,
|
|
413
388
|
className: inputcls,
|
|
414
389
|
onChange: this.handleInputChange
|
|
415
390
|
}, inputProps);
|
|
416
|
-
|
|
417
391
|
let style = {}; // Multiple choice mode
|
|
418
392
|
|
|
419
393
|
if (multiple) {
|
|
@@ -423,10 +397,10 @@ class Select extends BaseComponent {
|
|
|
423
397
|
selectInputProps.style = style;
|
|
424
398
|
}
|
|
425
399
|
|
|
426
|
-
return /*#__PURE__*/React.createElement(Input,
|
|
400
|
+
return /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
427
401
|
ref: this.inputRef,
|
|
428
402
|
size: size,
|
|
429
|
-
"aria-activedescendant": focusIndex !== -1 ?
|
|
403
|
+
"aria-activedescendant": focusIndex !== -1 ? "".concat(this.selectID, "-option-").concat(focusIndex) : '',
|
|
430
404
|
onFocus: e => {
|
|
431
405
|
// if multiple and filter, when use tab key to let select get focus
|
|
432
406
|
// need to manual update state isFocus to let the focus style take effect
|
|
@@ -503,20 +477,18 @@ class Select extends BaseComponent {
|
|
|
503
477
|
let optionStyle = style || {};
|
|
504
478
|
|
|
505
479
|
if (option.style) {
|
|
506
|
-
optionStyle =
|
|
480
|
+
optionStyle = Object.assign(Object.assign({}, optionStyle), option.style);
|
|
507
481
|
}
|
|
508
482
|
|
|
509
483
|
if (option._inputCreateOnly) {
|
|
510
484
|
optionContent = this.renderCreateOption(option, isFocused, optionIndex, style);
|
|
511
485
|
} else {
|
|
512
|
-
var _context13;
|
|
513
|
-
|
|
514
486
|
// use another name to make sure that 'key' in optionList still exist when we call onChange
|
|
515
487
|
if ('key' in option) {
|
|
516
488
|
option._keyInOptionList = option.key;
|
|
517
489
|
}
|
|
518
490
|
|
|
519
|
-
optionContent = /*#__PURE__*/React.createElement(Option,
|
|
491
|
+
optionContent = /*#__PURE__*/React.createElement(Option, Object.assign({
|
|
520
492
|
showTick: true
|
|
521
493
|
}, option, {
|
|
522
494
|
selected: option._selected,
|
|
@@ -527,7 +499,7 @@ class Select extends BaseComponent {
|
|
|
527
499
|
key: option.key || option.label + option.value + optionIndex,
|
|
528
500
|
renderOptionItem: renderOptionItem,
|
|
529
501
|
inputValue: inputValue,
|
|
530
|
-
id:
|
|
502
|
+
id: "".concat(this.selectID, "-option-").concat(optionIndex)
|
|
531
503
|
}), option.label);
|
|
532
504
|
}
|
|
533
505
|
|
|
@@ -540,7 +512,7 @@ class Select extends BaseComponent {
|
|
|
540
512
|
} = this.props; // default render method
|
|
541
513
|
|
|
542
514
|
if (typeof renderCreateItem === 'undefined') {
|
|
543
|
-
const defaultCreateItem = /*#__PURE__*/React.createElement(Option,
|
|
515
|
+
const defaultCreateItem = /*#__PURE__*/React.createElement(Option, Object.assign({
|
|
544
516
|
key: option.key || option.label + option.value,
|
|
545
517
|
onSelect: (v, e) => this.onSelect(v, optionIndex, e),
|
|
546
518
|
onMouseEnter: () => this.onOptionHover(optionIndex),
|
|
@@ -575,15 +547,14 @@ class Select extends BaseComponent {
|
|
|
575
547
|
|
|
576
548
|
renderWithGroup(visibleOptions) {
|
|
577
549
|
const content = [];
|
|
578
|
-
const groupStatus = new
|
|
579
|
-
|
|
580
|
-
_forEachInstanceProperty(visibleOptions).call(visibleOptions, (option, optionIndex) => {
|
|
550
|
+
const groupStatus = new Map();
|
|
551
|
+
visibleOptions.forEach((option, optionIndex) => {
|
|
581
552
|
const parentGroup = option._parentGroup;
|
|
582
553
|
const optionContent = this.renderOption(option, optionIndex);
|
|
583
554
|
|
|
584
555
|
if (parentGroup && !groupStatus.has(parentGroup.label)) {
|
|
585
556
|
// when use with OptionGroup and group content not already insert
|
|
586
|
-
const groupContent = /*#__PURE__*/React.createElement(OptionGroup,
|
|
557
|
+
const groupContent = /*#__PURE__*/React.createElement(OptionGroup, Object.assign({}, parentGroup, {
|
|
587
558
|
key: parentGroup.label
|
|
588
559
|
}));
|
|
589
560
|
groupStatus.set(parentGroup.label, true);
|
|
@@ -592,7 +563,6 @@ class Select extends BaseComponent {
|
|
|
592
563
|
|
|
593
564
|
content.push(optionContent);
|
|
594
565
|
});
|
|
595
|
-
|
|
596
566
|
return content;
|
|
597
567
|
}
|
|
598
568
|
|
|
@@ -625,8 +595,6 @@ class Select extends BaseComponent {
|
|
|
625
595
|
}
|
|
626
596
|
|
|
627
597
|
renderOptions(children) {
|
|
628
|
-
var _context14;
|
|
629
|
-
|
|
630
598
|
const {
|
|
631
599
|
dropdownMinWidth,
|
|
632
600
|
options,
|
|
@@ -645,28 +613,26 @@ class Select extends BaseComponent {
|
|
|
645
613
|
multiple
|
|
646
614
|
} = this.props; // Do a filter first, instead of directly judging in forEach, so that the focusIndex can correspond to
|
|
647
615
|
|
|
648
|
-
const visibleOptions =
|
|
649
|
-
|
|
616
|
+
const visibleOptions = options.filter(item => item._show);
|
|
650
617
|
let listContent = this.renderWithGroup(visibleOptions);
|
|
651
618
|
|
|
652
619
|
if (virtualize) {
|
|
653
620
|
listContent = this.renderVirtualizeList(visibleOptions);
|
|
654
621
|
}
|
|
655
622
|
|
|
656
|
-
const style =
|
|
623
|
+
const style = Object.assign({
|
|
657
624
|
minWidth: dropdownMinWidth
|
|
658
625
|
}, dropdownStyle);
|
|
659
|
-
|
|
660
626
|
const optionListCls = cls({
|
|
661
627
|
["".concat(prefixcls, "-option-list")]: true,
|
|
662
628
|
["".concat(prefixcls, "-option-list-chosen")]: selections.size
|
|
663
629
|
});
|
|
664
|
-
const isEmpty = !options.length || !
|
|
630
|
+
const isEmpty = !options.length || !options.some(item => item._show);
|
|
665
631
|
return (
|
|
666
632
|
/*#__PURE__*/
|
|
667
633
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
668
634
|
React.createElement("div", {
|
|
669
|
-
id:
|
|
635
|
+
id: "".concat(prefixcls, "-").concat(this.selectOptionListID),
|
|
670
636
|
className: dropdownClassName,
|
|
671
637
|
style: style,
|
|
672
638
|
ref: this.setOptionContainerEl,
|
|
@@ -745,9 +711,9 @@ class Select extends BaseComponent {
|
|
|
745
711
|
});
|
|
746
712
|
}
|
|
747
713
|
|
|
748
|
-
const mapItems = maxTagCount ?
|
|
714
|
+
const mapItems = maxTagCount ? selectedItems.slice(0, maxTagCount) : selectedItems; // no need to render rest tag when maxTagCount is setting
|
|
749
715
|
|
|
750
|
-
const tags =
|
|
716
|
+
const tags = mapItems.map((item, i) => {
|
|
751
717
|
const label = item[0];
|
|
752
718
|
const {
|
|
753
719
|
value
|
|
@@ -780,7 +746,7 @@ class Select extends BaseComponent {
|
|
|
780
746
|
};
|
|
781
747
|
|
|
782
748
|
if (isRenderInTag) {
|
|
783
|
-
return /*#__PURE__*/React.createElement(Tag,
|
|
749
|
+
return /*#__PURE__*/React.createElement(Tag, Object.assign({}, basic, {
|
|
784
750
|
color: "white",
|
|
785
751
|
size: size || 'large',
|
|
786
752
|
key: value,
|
|
@@ -792,7 +758,6 @@ class Select extends BaseComponent {
|
|
|
792
758
|
}, content);
|
|
793
759
|
}
|
|
794
760
|
});
|
|
795
|
-
|
|
796
761
|
const contentWrapperCls = cls({
|
|
797
762
|
["".concat(prefixcls, "-content-wrapper")]: true,
|
|
798
763
|
["".concat(prefixcls, "-content-wrapper-one-line")]: maxTagCount,
|
|
@@ -850,8 +815,7 @@ class Select extends BaseComponent {
|
|
|
850
815
|
|
|
851
816
|
if (virtualize) {
|
|
852
817
|
let minItemIndex = -1;
|
|
853
|
-
|
|
854
|
-
_forEachInstanceProperty(selections).call(selections, item => {
|
|
818
|
+
selections.forEach(item => {
|
|
855
819
|
const itemIndex = _get(item, '_scrollIndex');
|
|
856
820
|
/* When the itemIndex is legal */
|
|
857
821
|
|
|
@@ -907,8 +871,6 @@ class Select extends BaseComponent {
|
|
|
907
871
|
}
|
|
908
872
|
|
|
909
873
|
renderSelection() {
|
|
910
|
-
var _context15, _context16;
|
|
911
|
-
|
|
912
874
|
const {
|
|
913
875
|
disabled,
|
|
914
876
|
multiple,
|
|
@@ -962,7 +924,7 @@ class Select extends BaseComponent {
|
|
|
962
924
|
className: "".concat(prefixcls, "-arrow-empty")
|
|
963
925
|
});
|
|
964
926
|
const inner = useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
|
|
965
|
-
value:
|
|
927
|
+
value: Array.from(selections.values()),
|
|
966
928
|
inputValue: inputValue,
|
|
967
929
|
onChange: this.handleInputChange,
|
|
968
930
|
onClear: this.onClear,
|
|
@@ -970,7 +932,7 @@ class Select extends BaseComponent {
|
|
|
970
932
|
triggerRender: triggerRender,
|
|
971
933
|
placeholder: placeholder,
|
|
972
934
|
componentName: "Select",
|
|
973
|
-
componentProps:
|
|
935
|
+
componentProps: Object.assign({}, this.props)
|
|
974
936
|
}) : [/*#__PURE__*/React.createElement(Fragment, {
|
|
975
937
|
key: "prefix"
|
|
976
938
|
}, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/React.createElement(Fragment, {
|
|
@@ -999,11 +961,11 @@ class Select extends BaseComponent {
|
|
|
999
961
|
/*#__PURE__*/
|
|
1000
962
|
|
|
1001
963
|
/* eslint-disable-next-line jsx-a11y/aria-activedescendant-has-tabindex */
|
|
1002
|
-
React.createElement("div",
|
|
964
|
+
React.createElement("div", Object.assign({
|
|
1003
965
|
role: "combobox",
|
|
1004
966
|
"aria-disabled": disabled,
|
|
1005
967
|
"aria-expanded": isOpen,
|
|
1006
|
-
"aria-controls":
|
|
968
|
+
"aria-controls": "".concat(prefixcls, "-").concat(this.selectOptionListID),
|
|
1007
969
|
"aria-haspopup": "listbox",
|
|
1008
970
|
"aria-label": selections.size ? 'selected' : '',
|
|
1009
971
|
"aria-invalid": this.props['aria-invalid'],
|
|
@@ -1017,7 +979,7 @@ class Select extends BaseComponent {
|
|
|
1017
979
|
style: style,
|
|
1018
980
|
id: this.selectID,
|
|
1019
981
|
tabIndex: tabIndex,
|
|
1020
|
-
"aria-activedescendant": focusIndex !== -1 ?
|
|
982
|
+
"aria-activedescendant": focusIndex !== -1 ? "".concat(this.selectID, "-option-").concat(focusIndex) : '',
|
|
1021
983
|
onMouseEnter: this.onMouseEnter,
|
|
1022
984
|
onMouseLeave: this.onMouseLeave,
|
|
1023
985
|
onFocus: e => this.foundation.handleTriggerFocus(e),
|
package/lib/es/select/option.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import _isString from "lodash/isString";
|
|
2
|
-
import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
|
|
3
|
-
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
4
|
-
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
5
2
|
|
|
6
3
|
var __rest = this && this.__rest || function (s, e) {
|
|
7
4
|
var t = {};
|
|
8
5
|
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
10
7
|
|
|
11
|
-
if (s != null && typeof
|
|
12
|
-
if (
|
|
8
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
13
10
|
}
|
|
14
11
|
return t;
|
|
15
12
|
};
|
|
@@ -39,7 +36,7 @@ class Option extends PureComponent {
|
|
|
39
36
|
const isDisabled = props.disabled;
|
|
40
37
|
|
|
41
38
|
if (!isDisabled) {
|
|
42
|
-
props.onSelect(
|
|
39
|
+
props.onSelect(Object.assign(Object.assign({}, rest), {
|
|
43
40
|
value,
|
|
44
41
|
label: label || children
|
|
45
42
|
}), event);
|
|
@@ -108,7 +105,7 @@ class Option extends PureComponent {
|
|
|
108
105
|
|
|
109
106
|
|
|
110
107
|
if (typeof renderOptionItem === 'function') {
|
|
111
|
-
return renderOptionItem(
|
|
108
|
+
return renderOptionItem(Object.assign({
|
|
112
109
|
disabled,
|
|
113
110
|
focused,
|
|
114
111
|
selected,
|
|
@@ -117,7 +114,7 @@ class Option extends PureComponent {
|
|
|
117
114
|
value,
|
|
118
115
|
inputValue,
|
|
119
116
|
onMouseEnter: e => onMouseEnter(e),
|
|
120
|
-
onClick: e => this.onClick(
|
|
117
|
+
onClick: e => this.onClick(Object.assign({
|
|
121
118
|
value,
|
|
122
119
|
label,
|
|
123
120
|
children
|
|
@@ -138,7 +135,7 @@ class Option extends PureComponent {
|
|
|
138
135
|
React.createElement("div", {
|
|
139
136
|
className: optionClassName,
|
|
140
137
|
onClick: e => {
|
|
141
|
-
this.onClick(
|
|
138
|
+
this.onClick(Object.assign({
|
|
142
139
|
value,
|
|
143
140
|
label,
|
|
144
141
|
children
|