@douyinfe/semi-ui 2.36.0-beta.0 → 2.36.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/semi-ui.js +45174 -59754
- 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.LICENSE.txt +3 -3
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/_base/base.d.ts +3 -3
- package/lib/cjs/_base/baseComponent.d.ts +1 -1
- package/lib/cjs/_base/baseComponent.js +5 -16
- package/lib/cjs/_base/reactUtils.js +3 -9
- package/lib/cjs/_cssAnimation/index.js +4 -25
- package/lib/cjs/_portal/index.js +0 -31
- package/lib/cjs/_utils/hooks/usePrevFocus.js +0 -6
- package/lib/cjs/_utils/index.js +6 -45
- package/lib/cjs/anchor/anchor-context.d.ts +1 -1
- package/lib/cjs/anchor/anchor-context.js +0 -4
- package/lib/cjs/anchor/index.js +2 -48
- package/lib/cjs/anchor/link.js +4 -36
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.js +3 -42
- package/lib/cjs/autoComplete/option.js +26 -54
- package/lib/cjs/avatar/avatarGroup.js +9 -42
- package/lib/cjs/avatar/index.js +15 -56
- package/lib/cjs/avatar/interface.d.ts +6 -6
- package/lib/cjs/backtop/index.js +9 -34
- package/lib/cjs/badge/index.d.ts +3 -3
- package/lib/cjs/badge/index.js +16 -38
- package/lib/cjs/banner/index.d.ts +1 -1
- package/lib/cjs/banner/index.js +3 -31
- package/lib/cjs/breadcrumb/bread-context.js +0 -4
- package/lib/cjs/breadcrumb/index.d.ts +1 -1
- package/lib/cjs/breadcrumb/index.js +1 -45
- package/lib/cjs/breadcrumb/item.d.ts +1 -1
- package/lib/cjs/breadcrumb/item.js +16 -56
- package/lib/cjs/button/Button.d.ts +4 -4
- package/lib/cjs/button/Button.js +18 -37
- package/lib/cjs/button/buttonGroup.d.ts +1 -1
- package/lib/cjs/button/buttonGroup.js +10 -35
- package/lib/cjs/button/index.js +0 -9
- package/lib/cjs/button/splitButtonGroup.js +0 -11
- package/lib/cjs/calendar/dayCalendar.js +0 -29
- package/lib/cjs/calendar/dayCol.js +1 -28
- package/lib/cjs/calendar/index.js +4 -22
- package/lib/cjs/calendar/interface.d.ts +5 -5
- package/lib/cjs/calendar/monthCalendar.js +6 -62
- package/lib/cjs/calendar/rangeCalendar.js +1 -34
- package/lib/cjs/calendar/timeCol.js +0 -20
- package/lib/cjs/calendar/weekCalendar.js +0 -35
- package/lib/cjs/card/cardGroup.d.ts +1 -1
- package/lib/cjs/card/cardGroup.js +8 -24
- package/lib/cjs/card/index.d.ts +1 -1
- package/lib/cjs/card/index.js +7 -38
- package/lib/cjs/card/meta.d.ts +1 -1
- package/lib/cjs/card/meta.js +8 -27
- package/lib/cjs/carousel/CarouselArrow.d.ts +2 -2
- package/lib/cjs/carousel/CarouselArrow.js +1 -13
- package/lib/cjs/carousel/CarouselIndicator.js +9 -33
- package/lib/cjs/carousel/index.js +1 -49
- package/lib/cjs/cascader/index.d.ts +2 -2
- package/lib/cjs/cascader/index.js +12 -144
- package/lib/cjs/cascader/item.js +2 -63
- package/lib/cjs/checkbox/checkbox.d.ts +1 -1
- package/lib/cjs/checkbox/checkbox.js +21 -55
- package/lib/cjs/checkbox/checkboxGroup.d.ts +4 -4
- package/lib/cjs/checkbox/checkboxGroup.js +9 -29
- package/lib/cjs/checkbox/checkboxInner.js +1 -15
- package/lib/cjs/checkbox/context.d.ts +1 -1
- package/lib/cjs/checkbox/context.js +0 -4
- package/lib/cjs/checkbox/index.js +0 -5
- package/lib/cjs/collapse/collapse-context.js +0 -4
- package/lib/cjs/collapse/index.js +14 -42
- package/lib/cjs/collapse/item.js +13 -41
- package/lib/cjs/collapsible/index.js +0 -34
- package/lib/cjs/configProvider/context.js +0 -4
- package/lib/cjs/configProvider/index.js +5 -21
- package/lib/cjs/datePicker/dateInput.js +39 -93
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.js +11 -119
- package/lib/cjs/datePicker/footer.js +0 -6
- package/lib/cjs/datePicker/index.js +2 -17
- package/lib/cjs/datePicker/insetInput.js +0 -9
- package/lib/cjs/datePicker/month.d.ts +1 -1
- package/lib/cjs/datePicker/month.js +25 -90
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.js +21 -96
- package/lib/cjs/datePicker/navigation.js +7 -24
- package/lib/cjs/datePicker/quickControl.js +1 -17
- package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.js +6 -52
- package/lib/cjs/descriptions/descriptions-context.d.ts +1 -1
- package/lib/cjs/descriptions/descriptions-context.js +0 -4
- package/lib/cjs/descriptions/index.d.ts +1 -1
- package/lib/cjs/descriptions/index.js +0 -15
- package/lib/cjs/descriptions/item.js +0 -14
- package/lib/cjs/divider/index.js +9 -23
- package/lib/cjs/dropdown/context.js +0 -4
- package/lib/cjs/dropdown/dropdownDivider.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownDivider.js +0 -8
- package/lib/cjs/dropdown/dropdownItem.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownItem.js +0 -21
- package/lib/cjs/dropdown/dropdownMenu.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownMenu.js +6 -24
- package/lib/cjs/dropdown/dropdownTitle.d.ts +1 -1
- package/lib/cjs/dropdown/dropdownTitle.js +0 -12
- package/lib/cjs/dropdown/index.d.ts +1 -1
- package/lib/cjs/dropdown/index.js +21 -62
- package/lib/cjs/empty/index.js +0 -20
- package/lib/cjs/form/arrayField.js +15 -47
- package/lib/cjs/form/baseForm.js +26 -72
- package/lib/cjs/form/context.js +1 -10
- package/lib/cjs/form/errorMessage.d.ts +1 -1
- package/lib/cjs/form/errorMessage.js +1 -20
- package/lib/cjs/form/field.js +4 -23
- package/lib/cjs/form/group.js +11 -48
- package/lib/cjs/form/hoc/withField.js +69 -144
- package/lib/cjs/form/hoc/withFormApi.js +0 -7
- package/lib/cjs/form/hoc/withFormState.js +0 -7
- package/lib/cjs/form/hooks/index.js +0 -8
- package/lib/cjs/form/hooks/useArrayFieldState.js +0 -4
- package/lib/cjs/form/hooks/useFieldApi.js +0 -5
- package/lib/cjs/form/hooks/useFieldState.js +0 -8
- package/lib/cjs/form/hooks/useFormApi.js +0 -3
- package/lib/cjs/form/hooks/useFormState.js +0 -4
- package/lib/cjs/form/hooks/useFormUpdater.js +0 -3
- package/lib/cjs/form/hooks/useStateWithGetter.js +0 -5
- package/lib/cjs/form/index.js +0 -9
- package/lib/cjs/form/interface.d.ts +4 -4
- package/lib/cjs/form/interface.js +1 -8
- package/lib/cjs/form/label.js +0 -16
- package/lib/cjs/form/section.js +1 -11
- package/lib/cjs/form/slot.js +10 -51
- package/lib/cjs/grid/col.js +10 -29
- package/lib/cjs/grid/index.js +0 -3
- package/lib/cjs/grid/row.d.ts +2 -2
- package/lib/cjs/grid/row.js +10 -34
- package/lib/cjs/highlight/index.js +0 -11
- package/lib/cjs/iconButton/index.d.ts +1 -1
- package/lib/cjs/iconButton/index.js +18 -42
- package/lib/cjs/icons/index.js +0 -3
- package/lib/cjs/image/image.d.ts +0 -3
- package/lib/cjs/image/image.js +19 -88
- package/lib/cjs/image/index.js +0 -6
- package/lib/cjs/image/interface.d.ts +1 -1
- package/lib/cjs/image/preview.d.ts +4 -0
- package/lib/cjs/image/preview.js +53 -61
- package/lib/cjs/image/previewContext.js +0 -2
- package/lib/cjs/image/previewFooter.js +9 -62
- package/lib/cjs/image/previewHeader.js +0 -13
- package/lib/cjs/image/previewImage.js +46 -79
- package/lib/cjs/image/previewInner.js +70 -126
- package/lib/cjs/index.js +0 -86
- package/lib/cjs/input/index.d.ts +3 -3
- package/lib/cjs/input/index.js +35 -103
- package/lib/cjs/input/inputGroup.d.ts +1 -1
- package/lib/cjs/input/inputGroup.js +20 -44
- package/lib/cjs/input/textarea.d.ts +1 -1
- package/lib/cjs/input/textarea.js +33 -77
- package/lib/cjs/inputNumber/index.js +127 -199
- package/lib/cjs/layout/Sider.js +7 -32
- package/lib/cjs/layout/index.js +16 -40
- package/lib/cjs/layout/layout-context.js +0 -5
- package/lib/cjs/list/index.js +0 -26
- package/lib/cjs/list/item.js +6 -30
- package/lib/cjs/list/list-context.js +0 -4
- package/lib/cjs/locale/context.js +0 -4
- package/lib/cjs/locale/localeConsumer.d.ts +1 -1
- package/lib/cjs/locale/localeConsumer.js +0 -16
- package/lib/cjs/locale/localeProvider.js +0 -11
- package/lib/cjs/locale/source/ar.js +2 -4
- package/lib/cjs/locale/source/de.js +2 -4
- package/lib/cjs/locale/source/en_GB.js +2 -4
- package/lib/cjs/locale/source/en_US.js +2 -4
- package/lib/cjs/locale/source/es.js +0 -2
- package/lib/cjs/locale/source/fr.js +2 -4
- package/lib/cjs/locale/source/id_ID.js +2 -4
- package/lib/cjs/locale/source/it.js +2 -4
- package/lib/cjs/locale/source/ja_JP.js +2 -4
- package/lib/cjs/locale/source/ko_KR.js +2 -4
- package/lib/cjs/locale/source/ms_MY.js +2 -4
- package/lib/cjs/locale/source/nl_NL.js +0 -2
- package/lib/cjs/locale/source/pl_PL.js +0 -2
- package/lib/cjs/locale/source/pt_BR.js +2 -4
- package/lib/cjs/locale/source/ro.js +0 -2
- package/lib/cjs/locale/source/ru_RU.js +2 -4
- package/lib/cjs/locale/source/sv_SE.js +0 -2
- package/lib/cjs/locale/source/th_TH.js +2 -4
- package/lib/cjs/locale/source/tr_TR.js +2 -4
- package/lib/cjs/locale/source/vi_VN.js +2 -4
- package/lib/cjs/locale/source/zh_CN.js +2 -4
- package/lib/cjs/locale/source/zh_TW.js +2 -4
- package/lib/cjs/modal/ConfirmModal.js +9 -29
- package/lib/cjs/modal/Modal.d.ts +2 -2
- package/lib/cjs/modal/Modal.js +17 -80
- package/lib/cjs/modal/ModalContent.js +13 -72
- package/lib/cjs/modal/confirm.d.ts +9 -3
- package/lib/cjs/modal/confirm.js +4 -28
- package/lib/cjs/modal/index.d.ts +1 -1
- package/lib/cjs/modal/index.js +0 -4
- package/lib/cjs/modal/useModal/HookModal.js +4 -18
- package/lib/cjs/modal/useModal/index.d.ts +1 -1
- package/lib/cjs/modal/useModal/index.js +4 -18
- package/lib/cjs/navigation/CollapseButton.js +0 -11
- package/lib/cjs/navigation/Footer.js +0 -20
- package/lib/cjs/navigation/Header.d.ts +1 -1
- package/lib/cjs/navigation/Header.js +0 -18
- package/lib/cjs/navigation/Item.js +3 -51
- package/lib/cjs/navigation/SubNav.js +7 -67
- package/lib/cjs/navigation/index.d.ts +2 -2
- package/lib/cjs/navigation/index.js +5 -60
- package/lib/cjs/navigation/nav-context.js +0 -4
- package/lib/cjs/notification/index.d.ts +1 -1
- package/lib/cjs/notification/index.js +4 -56
- package/lib/cjs/notification/notice.js +24 -58
- package/lib/cjs/notification/useNotification/HookNotice.js +3 -18
- package/lib/cjs/notification/useNotification/index.js +4 -25
- package/lib/cjs/overflowList/index.d.ts +41 -24
- package/lib/cjs/overflowList/index.js +7 -65
- package/lib/cjs/overflowList/intersectionObserver.js +2 -21
- package/lib/cjs/pagination/index.d.ts +2 -2
- package/lib/cjs/pagination/index.js +7 -59
- package/lib/cjs/popconfirm/index.js +9 -54
- package/lib/cjs/popover/Arrow.js +6 -19
- package/lib/cjs/popover/index.js +11 -38
- package/lib/cjs/progress/index.js +8 -48
- package/lib/cjs/radio/context.d.ts +2 -2
- package/lib/cjs/radio/context.js +0 -4
- package/lib/cjs/radio/index.js +0 -5
- package/lib/cjs/radio/radio.d.ts +3 -3
- package/lib/cjs/radio/radio.js +1 -36
- package/lib/cjs/radio/radioGroup.d.ts +2 -2
- package/lib/cjs/radio/radioGroup.js +0 -24
- package/lib/cjs/radio/radioInner.d.ts +1 -1
- package/lib/cjs/radio/radioInner.js +0 -21
- package/lib/cjs/rating/index.js +4 -51
- package/lib/cjs/rating/item.d.ts +1 -1
- package/lib/cjs/rating/item.js +2 -27
- package/lib/cjs/resizeObserver/index.js +4 -28
- package/lib/cjs/scrollList/index.js +0 -13
- package/lib/cjs/scrollList/scrollItem.js +15 -113
- package/lib/cjs/select/index.d.ts +6 -6
- package/lib/cjs/select/index.js +27 -164
- package/lib/cjs/select/option.js +27 -55
- package/lib/cjs/select/optionGroup.js +0 -12
- package/lib/cjs/select/utils.js +8 -24
- package/lib/cjs/select/virtualRow.js +0 -2
- package/lib/cjs/sideSheet/SideSheetContent.js +2 -40
- package/lib/cjs/sideSheet/index.js +21 -66
- package/lib/cjs/skeleton/index.js +9 -28
- package/lib/cjs/skeleton/item.d.ts +2 -2
- package/lib/cjs/skeleton/item.js +8 -29
- package/lib/cjs/slider/index.js +7 -68
- package/lib/cjs/space/index.d.ts +3 -3
- package/lib/cjs/space/index.js +0 -20
- package/lib/cjs/space/utils.js +0 -9
- package/lib/cjs/spin/icon.js +4 -17
- package/lib/cjs/spin/index.d.ts +1 -1
- package/lib/cjs/spin/index.js +0 -20
- package/lib/cjs/steps/basicStep.d.ts +2 -2
- package/lib/cjs/steps/basicStep.js +0 -22
- package/lib/cjs/steps/basicSteps.d.ts +3 -3
- package/lib/cjs/steps/basicSteps.js +0 -15
- package/lib/cjs/steps/context.js +0 -4
- package/lib/cjs/steps/fillStep.d.ts +1 -1
- package/lib/cjs/steps/fillStep.js +0 -19
- package/lib/cjs/steps/fillSteps.d.ts +2 -2
- package/lib/cjs/steps/fillSteps.js +0 -17
- package/lib/cjs/steps/index.d.ts +1 -1
- package/lib/cjs/steps/index.js +4 -26
- package/lib/cjs/steps/navStep.js +0 -11
- package/lib/cjs/steps/navSteps.d.ts +1 -1
- package/lib/cjs/steps/navSteps.js +0 -13
- package/lib/cjs/steps/step.d.ts +1 -1
- package/lib/cjs/steps/step.js +0 -15
- package/lib/cjs/switch/index.js +1 -22
- package/lib/cjs/table/Body/BaseRow.d.ts +1 -1
- package/lib/cjs/table/Body/BaseRow.js +37 -101
- package/lib/cjs/table/Body/ExpandedRow.d.ts +1 -1
- package/lib/cjs/table/Body/ExpandedRow.js +5 -30
- package/lib/cjs/table/Body/SectionRow.js +8 -46
- package/lib/cjs/table/Body/index.js +38 -153
- package/lib/cjs/table/ColGroup.js +2 -14
- package/lib/cjs/table/Column.js +0 -7
- package/lib/cjs/table/ColumnFilter.js +4 -30
- package/lib/cjs/table/ColumnSelection.js +5 -24
- package/lib/cjs/table/ColumnShape.js +0 -4
- package/lib/cjs/table/ColumnSorter.js +0 -13
- package/lib/cjs/table/CustomExpandIcon.js +0 -16
- package/lib/cjs/table/HeadTable.js +0 -23
- package/lib/cjs/table/ResizableHeaderCell.d.ts +1 -1
- package/lib/cjs/table/ResizableHeaderCell.js +9 -20
- package/lib/cjs/table/ResizableTable.js +5 -47
- package/lib/cjs/table/Table.d.ts +2 -2
- package/lib/cjs/table/Table.js +534 -771
- package/lib/cjs/table/TableCell.js +20 -81
- package/lib/cjs/table/TableContextProvider.js +0 -7
- package/lib/cjs/table/TableHeader.js +5 -33
- package/lib/cjs/table/TableHeaderRow.js +8 -45
- package/lib/cjs/table/TablePagination.js +1 -12
- package/lib/cjs/table/getColumns.js +0 -11
- package/lib/cjs/table/index.js +2 -20
- package/lib/cjs/table/interface.d.ts +58 -58
- package/lib/cjs/table/table-context.js +1 -5
- package/lib/cjs/table/utils.js +6 -30
- package/lib/cjs/tabs/TabBar.js +13 -61
- package/lib/cjs/tabs/TabItem.js +18 -31
- package/lib/cjs/tabs/TabPane.js +10 -35
- package/lib/cjs/tabs/index.js +20 -83
- package/lib/cjs/tabs/interface.d.ts +3 -3
- package/lib/cjs/tabs/tabs-context.js +0 -4
- package/lib/cjs/tag/group.js +0 -27
- package/lib/cjs/tag/index.js +23 -60
- package/lib/cjs/tag/interface.d.ts +5 -5
- package/lib/cjs/tagInput/index.d.ts +3 -3
- package/lib/cjs/tagInput/index.js +2 -77
- package/lib/cjs/timePicker/Combobox.d.ts +2 -2
- package/lib/cjs/timePicker/Combobox.js +7 -54
- package/lib/cjs/timePicker/PanelShape.js +0 -3
- package/lib/cjs/timePicker/TimeInput.d.ts +1 -1
- package/lib/cjs/timePicker/TimeInput.js +32 -64
- package/lib/cjs/timePicker/TimePicker.d.ts +3 -3
- package/lib/cjs/timePicker/TimePicker.js +39 -99
- package/lib/cjs/timePicker/TimeShape.js +0 -5
- package/lib/cjs/timePicker/index.d.ts +1 -1
- package/lib/cjs/timePicker/index.js +0 -9
- package/lib/cjs/timeline/index.js +0 -27
- package/lib/cjs/timeline/item.js +0 -13
- package/lib/cjs/toast/index.js +5 -59
- package/lib/cjs/toast/toast.js +1 -29
- package/lib/cjs/toast/useToast/HookToast.js +3 -18
- package/lib/cjs/toast/useToast/index.js +2 -17
- package/lib/cjs/tooltip/ArrowBoundingShape.js +0 -4
- package/lib/cjs/tooltip/TriangleArrow.js +4 -12
- package/lib/cjs/tooltip/TriangleArrowVertical.js +4 -12
- package/lib/cjs/tooltip/index.d.ts +2 -2
- package/lib/cjs/tooltip/index.js +24 -134
- package/lib/cjs/transfer/index.d.ts +5 -5
- package/lib/cjs/transfer/index.js +10 -93
- package/lib/cjs/tree/autoSizer.js +4 -24
- package/lib/cjs/tree/index.js +31 -122
- package/lib/cjs/tree/interface.d.ts +2 -2
- package/lib/cjs/tree/nodeCollapsible.js +4 -15
- package/lib/cjs/tree/nodeList.js +0 -22
- package/lib/cjs/tree/treeContext.js +0 -4
- package/lib/cjs/tree/treeNode.js +21 -94
- package/lib/cjs/tree/treeUtil.js +0 -6
- package/lib/cjs/treeSelect/index.d.ts +6 -6
- package/lib/cjs/treeSelect/index.js +46 -196
- package/lib/cjs/trigger/index.js +5 -16
- package/lib/cjs/typography/base.d.ts +1 -2
- package/lib/cjs/typography/base.js +52 -135
- package/lib/cjs/typography/copyable.js +2 -30
- package/lib/cjs/typography/index.d.ts +1 -1
- package/lib/cjs/typography/index.js +0 -9
- package/lib/cjs/typography/interface.d.ts +11 -10
- package/lib/cjs/typography/numeral.d.ts +1 -1
- package/lib/cjs/typography/numeral.js +4 -20
- package/lib/cjs/typography/paragraph.d.ts +1 -1
- package/lib/cjs/typography/paragraph.js +0 -12
- package/lib/cjs/typography/text.d.ts +1 -1
- package/lib/cjs/typography/text.js +0 -10
- package/lib/cjs/typography/title.d.ts +2 -2
- package/lib/cjs/typography/title.js +6 -20
- package/lib/cjs/typography/typography.js +7 -23
- package/lib/cjs/typography/util.js +22 -50
- package/lib/cjs/upload/fileCard.js +2 -52
- package/lib/cjs/upload/index.js +1 -70
- package/lib/cjs/upload/interface.d.ts +5 -5
- package/lib/es/_base/base.d.ts +3 -3
- package/lib/es/_base/baseComponent.d.ts +1 -1
- package/lib/es/_base/baseComponent.js +4 -11
- package/lib/es/_base/reactUtils.js +4 -8
- package/lib/es/_cssAnimation/index.js +4 -22
- package/lib/es/_portal/index.js +0 -23
- package/lib/es/_utils/hooks/usePrevFocus.js +0 -2
- package/lib/es/_utils/index.js +6 -28
- package/lib/es/anchor/anchor-context.d.ts +1 -1
- package/lib/es/anchor/index.js +2 -32
- package/lib/es/anchor/link.js +4 -24
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/autoComplete/index.js +3 -25
- package/lib/es/autoComplete/option.js +26 -45
- package/lib/es/avatar/avatarGroup.js +9 -28
- package/lib/es/avatar/index.js +15 -41
- package/lib/es/avatar/interface.d.ts +6 -6
- package/lib/es/backtop/index.js +9 -22
- package/lib/es/badge/index.d.ts +3 -3
- package/lib/es/badge/index.js +16 -24
- package/lib/es/banner/index.d.ts +1 -1
- package/lib/es/banner/index.js +2 -15
- package/lib/es/breadcrumb/index.d.ts +1 -1
- package/lib/es/breadcrumb/index.js +0 -31
- package/lib/es/breadcrumb/item.d.ts +1 -1
- package/lib/es/breadcrumb/item.js +16 -38
- package/lib/es/button/Button.d.ts +4 -4
- package/lib/es/button/Button.js +18 -27
- package/lib/es/button/buttonGroup.d.ts +1 -1
- package/lib/es/button/buttonGroup.js +10 -24
- package/lib/es/button/index.js +0 -5
- package/lib/es/button/splitButtonGroup.js +0 -1
- package/lib/es/calendar/dayCalendar.js +0 -13
- package/lib/es/calendar/dayCol.js +0 -14
- package/lib/es/calendar/index.js +6 -12
- package/lib/es/calendar/interface.d.ts +5 -5
- package/lib/es/calendar/monthCalendar.js +6 -41
- package/lib/es/calendar/rangeCalendar.js +2 -18
- package/lib/es/calendar/timeCol.js +0 -7
- package/lib/es/calendar/weekCalendar.js +0 -17
- package/lib/es/card/cardGroup.d.ts +1 -1
- package/lib/es/card/cardGroup.js +8 -15
- package/lib/es/card/index.d.ts +1 -1
- package/lib/es/card/index.js +7 -23
- package/lib/es/card/meta.d.ts +1 -1
- package/lib/es/card/meta.js +8 -15
- package/lib/es/carousel/CarouselArrow.d.ts +2 -2
- package/lib/es/carousel/CarouselArrow.js +0 -8
- package/lib/es/carousel/CarouselIndicator.js +9 -27
- package/lib/es/carousel/index.js +0 -34
- package/lib/es/cascader/index.d.ts +2 -2
- package/lib/es/cascader/index.js +12 -105
- package/lib/es/cascader/item.js +2 -44
- package/lib/es/checkbox/checkbox.d.ts +1 -1
- package/lib/es/checkbox/checkbox.js +20 -42
- package/lib/es/checkbox/checkboxGroup.d.ts +4 -4
- package/lib/es/checkbox/checkboxGroup.js +8 -20
- package/lib/es/checkbox/checkboxInner.js +0 -6
- package/lib/es/checkbox/context.d.ts +1 -1
- package/lib/es/checkbox/index.js +0 -2
- package/lib/es/collapse/index.js +14 -31
- package/lib/es/collapse/item.js +13 -27
- package/lib/es/collapsible/index.js +0 -25
- package/lib/es/configProvider/index.js +5 -13
- package/lib/es/datePicker/dateInput.js +41 -81
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/datePicker.js +10 -103
- package/lib/es/datePicker/index.js +2 -8
- package/lib/es/datePicker/insetInput.js +0 -6
- package/lib/es/datePicker/month.d.ts +1 -1
- package/lib/es/datePicker/month.js +24 -78
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.js +20 -76
- package/lib/es/datePicker/navigation.js +8 -13
- package/lib/es/datePicker/quickControl.js +0 -6
- package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.js +5 -36
- package/lib/es/descriptions/descriptions-context.d.ts +1 -1
- package/lib/es/descriptions/index.d.ts +1 -1
- package/lib/es/descriptions/index.js +0 -3
- package/lib/es/descriptions/item.js +0 -3
- package/lib/es/divider/index.js +9 -17
- package/lib/es/dropdown/dropdownDivider.d.ts +1 -1
- package/lib/es/dropdown/dropdownDivider.js +0 -2
- package/lib/es/dropdown/dropdownItem.d.ts +1 -1
- package/lib/es/dropdown/dropdownItem.js +0 -11
- package/lib/es/dropdown/dropdownMenu.d.ts +1 -1
- package/lib/es/dropdown/dropdownMenu.js +6 -15
- package/lib/es/dropdown/dropdownTitle.d.ts +1 -1
- package/lib/es/dropdown/dropdownTitle.js +0 -3
- package/lib/es/dropdown/index.d.ts +1 -1
- package/lib/es/dropdown/index.js +21 -47
- package/lib/es/empty/index.js +0 -10
- package/lib/es/form/arrayField.js +14 -41
- package/lib/es/form/baseForm.js +26 -49
- package/lib/es/form/errorMessage.d.ts +1 -1
- package/lib/es/form/errorMessage.js +0 -9
- package/lib/es/form/field.js +4 -4
- package/lib/es/form/group.js +11 -29
- package/lib/es/form/hoc/withField.js +68 -125
- package/lib/es/form/hoc/withFormApi.js +0 -3
- package/lib/es/form/hoc/withFormState.js +0 -3
- package/lib/es/form/hooks/index.js +2 -2
- package/lib/es/form/hooks/useArrayFieldState.js +0 -2
- package/lib/es/form/hooks/useFieldApi.js +0 -3
- package/lib/es/form/hooks/useFieldState.js +0 -3
- package/lib/es/form/hooks/useFormState.js +0 -2
- package/lib/es/form/hooks/useStateWithGetter.js +2 -5
- package/lib/es/form/index.js +4 -4
- package/lib/es/form/interface.d.ts +4 -4
- package/lib/es/form/interface.js +0 -1
- package/lib/es/form/label.js +0 -1
- package/lib/es/form/section.js +0 -1
- package/lib/es/form/slot.js +10 -39
- package/lib/es/grid/col.js +10 -23
- package/lib/es/grid/row.d.ts +2 -2
- package/lib/es/grid/row.js +10 -25
- package/lib/es/highlight/index.js +0 -3
- package/lib/es/iconButton/index.d.ts +1 -1
- package/lib/es/iconButton/index.js +18 -31
- package/lib/es/image/image.d.ts +0 -3
- package/lib/es/image/image.js +19 -70
- package/lib/es/image/interface.d.ts +1 -1
- package/lib/es/image/preview.d.ts +4 -0
- package/lib/es/image/preview.js +51 -48
- package/lib/es/image/previewFooter.js +9 -34
- package/lib/es/image/previewHeader.js +0 -4
- package/lib/es/image/previewImage.js +46 -69
- package/lib/es/image/previewInner.js +69 -110
- package/lib/es/index.js +0 -1
- package/lib/es/input/index.d.ts +3 -3
- package/lib/es/input/index.js +35 -88
- package/lib/es/input/inputGroup.d.ts +1 -1
- package/lib/es/input/inputGroup.js +20 -33
- package/lib/es/input/textarea.d.ts +1 -1
- package/lib/es/input/textarea.js +34 -65
- package/lib/es/inputNumber/index.js +127 -181
- package/lib/es/layout/Sider.js +7 -23
- package/lib/es/layout/index.js +16 -31
- package/lib/es/list/index.js +0 -11
- package/lib/es/list/item.js +6 -18
- package/lib/es/locale/localeConsumer.d.ts +1 -1
- package/lib/es/locale/localeConsumer.js +0 -7
- package/lib/es/locale/localeProvider.js +0 -2
- package/lib/es/locale/source/ar.js +2 -2
- package/lib/es/locale/source/de.js +2 -2
- package/lib/es/locale/source/en_GB.js +2 -2
- package/lib/es/locale/source/en_US.js +2 -2
- package/lib/es/locale/source/es.js +0 -1
- package/lib/es/locale/source/fr.js +2 -2
- package/lib/es/locale/source/id_ID.js +2 -2
- package/lib/es/locale/source/it.js +2 -2
- package/lib/es/locale/source/ja_JP.js +2 -2
- package/lib/es/locale/source/ko_KR.js +2 -2
- package/lib/es/locale/source/ms_MY.js +2 -2
- package/lib/es/locale/source/nl_NL.js +0 -1
- package/lib/es/locale/source/pl_PL.js +0 -1
- package/lib/es/locale/source/pt_BR.js +2 -2
- package/lib/es/locale/source/ro.js +0 -1
- package/lib/es/locale/source/ru_RU.js +2 -2
- package/lib/es/locale/source/sv_SE.js +0 -1
- package/lib/es/locale/source/th_TH.js +2 -2
- package/lib/es/locale/source/tr_TR.js +2 -2
- package/lib/es/locale/source/vi_VN.js +2 -2
- package/lib/es/locale/source/zh_CN.js +2 -2
- package/lib/es/locale/source/zh_TW.js +2 -2
- package/lib/es/modal/ConfirmModal.js +9 -20
- package/lib/es/modal/Modal.d.ts +2 -2
- package/lib/es/modal/Modal.js +17 -63
- package/lib/es/modal/ModalContent.js +14 -54
- package/lib/es/modal/confirm.d.ts +9 -3
- package/lib/es/modal/confirm.js +4 -11
- package/lib/es/modal/index.d.ts +1 -1
- package/lib/es/modal/useModal/HookModal.js +6 -14
- package/lib/es/modal/useModal/index.d.ts +1 -1
- package/lib/es/modal/useModal/index.js +4 -9
- package/lib/es/navigation/CollapseButton.js +0 -4
- package/lib/es/navigation/Footer.js +0 -7
- package/lib/es/navigation/Header.d.ts +1 -1
- package/lib/es/navigation/Header.js +0 -5
- package/lib/es/navigation/Item.js +2 -35
- package/lib/es/navigation/SubNav.js +6 -45
- package/lib/es/navigation/index.d.ts +2 -2
- package/lib/es/navigation/index.js +5 -38
- package/lib/es/notification/index.d.ts +1 -1
- package/lib/es/notification/index.js +4 -39
- package/lib/es/notification/notice.js +24 -46
- package/lib/es/notification/useNotification/HookNotice.js +3 -11
- package/lib/es/notification/useNotification/index.js +6 -16
- package/lib/es/overflowList/index.d.ts +41 -24
- package/lib/es/overflowList/index.js +6 -46
- package/lib/es/overflowList/intersectionObserver.js +2 -13
- package/lib/es/pagination/index.d.ts +2 -2
- package/lib/es/pagination/index.js +7 -37
- package/lib/es/popconfirm/index.js +9 -37
- package/lib/es/popover/Arrow.js +6 -18
- package/lib/es/popover/index.js +11 -27
- package/lib/es/progress/index.js +8 -37
- package/lib/es/radio/context.d.ts +2 -2
- package/lib/es/radio/index.js +0 -2
- package/lib/es/radio/radio.d.ts +3 -3
- package/lib/es/radio/radio.js +0 -23
- package/lib/es/radio/radioGroup.d.ts +2 -2
- package/lib/es/radio/radioGroup.js +0 -14
- package/lib/es/radio/radioInner.d.ts +1 -1
- package/lib/es/radio/radioInner.js +0 -11
- package/lib/es/rating/index.js +4 -36
- package/lib/es/rating/item.d.ts +1 -1
- package/lib/es/rating/item.js +2 -16
- package/lib/es/resizeObserver/index.js +4 -19
- package/lib/es/scrollList/index.js +2 -5
- package/lib/es/scrollList/scrollItem.js +15 -104
- package/lib/es/select/index.d.ts +6 -6
- package/lib/es/select/index.js +27 -123
- package/lib/es/select/option.js +27 -46
- package/lib/es/select/optionGroup.js +0 -5
- package/lib/es/select/utils.js +8 -19
- package/lib/es/select/virtualRow.js +0 -1
- package/lib/es/sideSheet/SideSheetContent.js +2 -28
- package/lib/es/sideSheet/index.js +21 -52
- package/lib/es/skeleton/index.js +9 -18
- package/lib/es/skeleton/item.d.ts +2 -2
- package/lib/es/skeleton/item.js +8 -17
- package/lib/es/slider/index.js +6 -53
- package/lib/es/space/index.d.ts +3 -3
- package/lib/es/space/index.js +0 -6
- package/lib/es/space/utils.js +0 -2
- package/lib/es/spin/icon.js +4 -15
- package/lib/es/spin/index.d.ts +1 -1
- package/lib/es/spin/index.js +0 -10
- package/lib/es/steps/basicStep.d.ts +2 -2
- package/lib/es/steps/basicStep.js +0 -15
- package/lib/es/steps/basicSteps.d.ts +3 -3
- package/lib/es/steps/basicSteps.js +0 -6
- package/lib/es/steps/fillStep.d.ts +1 -1
- package/lib/es/steps/fillStep.js +0 -13
- package/lib/es/steps/fillSteps.d.ts +2 -2
- package/lib/es/steps/fillSteps.js +0 -6
- package/lib/es/steps/index.d.ts +1 -1
- package/lib/es/steps/index.js +4 -15
- package/lib/es/steps/navStep.js +0 -5
- package/lib/es/steps/navSteps.d.ts +1 -1
- package/lib/es/steps/navSteps.js +0 -3
- package/lib/es/steps/step.d.ts +1 -1
- package/lib/es/steps/step.js +0 -7
- package/lib/es/switch/index.js +0 -13
- package/lib/es/table/Body/BaseRow.d.ts +1 -1
- package/lib/es/table/Body/BaseRow.js +37 -85
- package/lib/es/table/Body/ExpandedRow.d.ts +1 -1
- package/lib/es/table/Body/ExpandedRow.js +5 -18
- package/lib/es/table/Body/SectionRow.js +8 -35
- package/lib/es/table/Body/index.js +38 -149
- package/lib/es/table/ColGroup.js +2 -7
- package/lib/es/table/Column.js +0 -2
- package/lib/es/table/ColumnFilter.js +3 -20
- package/lib/es/table/ColumnSelection.js +5 -15
- package/lib/es/table/ColumnSorter.js +0 -1
- package/lib/es/table/CustomExpandIcon.js +0 -6
- package/lib/es/table/HeadTable.js +0 -15
- package/lib/es/table/ResizableHeaderCell.d.ts +1 -1
- package/lib/es/table/ResizableHeaderCell.js +9 -17
- package/lib/es/table/ResizableTable.js +5 -37
- package/lib/es/table/Table.d.ts +2 -2
- package/lib/es/table/Table.js +457 -664
- package/lib/es/table/TableCell.js +19 -65
- package/lib/es/table/TableContextProvider.js +0 -2
- package/lib/es/table/TableHeader.js +4 -23
- package/lib/es/table/TableHeaderRow.js +8 -39
- package/lib/es/table/TablePagination.js +0 -4
- package/lib/es/table/getColumns.js +0 -4
- package/lib/es/table/index.js +2 -10
- package/lib/es/table/interface.d.ts +58 -58
- package/lib/es/table/table-context.js +0 -1
- package/lib/es/table/utils.js +6 -19
- package/lib/es/tabs/TabBar.js +13 -46
- package/lib/es/tabs/TabItem.js +18 -24
- package/lib/es/tabs/TabPane.js +10 -25
- package/lib/es/tabs/index.js +20 -59
- package/lib/es/tabs/interface.d.ts +3 -3
- package/lib/es/tag/group.js +0 -14
- package/lib/es/tag/index.js +23 -45
- package/lib/es/tag/interface.d.ts +5 -5
- package/lib/es/tagInput/index.d.ts +3 -3
- package/lib/es/tagInput/index.js +2 -54
- package/lib/es/timePicker/Combobox.d.ts +2 -2
- package/lib/es/timePicker/Combobox.js +6 -42
- package/lib/es/timePicker/TimeInput.d.ts +1 -1
- package/lib/es/timePicker/TimeInput.js +32 -56
- package/lib/es/timePicker/TimePicker.d.ts +3 -3
- package/lib/es/timePicker/TimePicker.js +39 -80
- package/lib/es/timePicker/TimeShape.js +0 -1
- package/lib/es/timePicker/index.d.ts +1 -1
- package/lib/es/timePicker/index.js +0 -1
- package/lib/es/timeline/index.js +0 -16
- package/lib/es/timeline/item.js +0 -1
- package/lib/es/toast/index.js +4 -41
- package/lib/es/toast/toast.js +0 -17
- package/lib/es/toast/useToast/HookToast.js +3 -11
- package/lib/es/toast/useToast/index.js +4 -13
- package/lib/es/tooltip/TriangleArrow.js +4 -10
- package/lib/es/tooltip/TriangleArrowVertical.js +4 -10
- package/lib/es/tooltip/index.d.ts +2 -2
- package/lib/es/tooltip/index.js +24 -112
- package/lib/es/transfer/index.d.ts +5 -5
- package/lib/es/transfer/index.js +10 -67
- package/lib/es/tree/autoSizer.js +4 -13
- package/lib/es/tree/index.js +30 -96
- package/lib/es/tree/interface.d.ts +2 -2
- package/lib/es/tree/nodeCollapsible.js +4 -10
- package/lib/es/tree/nodeList.js +0 -14
- package/lib/es/tree/treeNode.js +21 -76
- package/lib/es/tree/treeUtil.js +0 -1
- package/lib/es/treeSelect/index.d.ts +6 -6
- package/lib/es/treeSelect/index.js +46 -156
- package/lib/es/trigger/index.js +5 -13
- package/lib/es/typography/base.d.ts +1 -2
- package/lib/es/typography/base.js +52 -118
- package/lib/es/typography/copyable.js +2 -14
- package/lib/es/typography/index.d.ts +1 -1
- package/lib/es/typography/interface.d.ts +11 -10
- package/lib/es/typography/numeral.d.ts +1 -1
- package/lib/es/typography/numeral.js +4 -10
- package/lib/es/typography/paragraph.d.ts +1 -1
- package/lib/es/typography/paragraph.js +0 -1
- package/lib/es/typography/text.d.ts +1 -1
- package/lib/es/typography/text.js +0 -1
- package/lib/es/typography/title.d.ts +2 -2
- package/lib/es/typography/title.js +6 -11
- package/lib/es/typography/typography.js +7 -14
- package/lib/es/typography/util.js +22 -45
- package/lib/es/upload/fileCard.js +2 -31
- package/lib/es/upload/index.js +0 -57
- package/lib/es/upload/interface.d.ts +5 -5
- package/package.json +8 -8
|
@@ -4,41 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
9
|
var _constants = require("@douyinfe/semi-foundation/lib/cjs/form/constants");
|
|
13
|
-
|
|
14
10
|
var _utils = require("@douyinfe/semi-foundation/lib/cjs/form/utils");
|
|
15
|
-
|
|
16
11
|
var ObjectUtil = _interopRequireWildcard(require("@douyinfe/semi-foundation/lib/cjs/utils/object"));
|
|
17
|
-
|
|
18
12
|
var _isPromise = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/utils/isPromise"));
|
|
19
|
-
|
|
20
13
|
var _warning = _interopRequireDefault(require("@douyinfe/semi-foundation/lib/cjs/utils/warning"));
|
|
21
|
-
|
|
22
14
|
var _index = require("../hooks/index");
|
|
23
|
-
|
|
24
15
|
var _errorMessage = _interopRequireDefault(require("../errorMessage"));
|
|
25
|
-
|
|
26
16
|
var _reactUtils = require("../../_base/reactUtils");
|
|
27
|
-
|
|
28
17
|
var _label = _interopRequireDefault(require("../label"));
|
|
29
|
-
|
|
30
18
|
var _grid = require("../../grid");
|
|
31
|
-
|
|
32
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
-
|
|
34
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
-
|
|
36
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
-
|
|
38
22
|
/* eslint-disable max-lines-per-function, react-hooks/rules-of-hooks, prefer-const, max-len */
|
|
39
|
-
const prefix = _constants.cssClasses.PREFIX; // To avoid useLayoutEffect warning when ssr, refer: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
40
|
-
// Fix issue 1140
|
|
41
23
|
|
|
24
|
+
const prefix = _constants.cssClasses.PREFIX;
|
|
25
|
+
// To avoid useLayoutEffect warning when ssr, refer: https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
26
|
+
// Fix issue 1140
|
|
42
27
|
const useIsomorphicEffect = typeof window !== 'undefined' ? _react.useLayoutEffect : _react.useEffect;
|
|
43
28
|
/**
|
|
44
29
|
* withFiled is used to inject components
|
|
@@ -46,7 +31,6 @@ const useIsomorphicEffect = typeof window !== 'undefined' ? _react.useLayoutEffe
|
|
|
46
31
|
* 2. Insert <Label>
|
|
47
32
|
* 3. Insert <ErrorMessage>
|
|
48
33
|
*/
|
|
49
|
-
|
|
50
34
|
function withField(Component, opts) {
|
|
51
35
|
let SemiField = (props, ref) => {
|
|
52
36
|
let {
|
|
@@ -88,60 +72,51 @@ function withField(Component, opts) {
|
|
|
88
72
|
options,
|
|
89
73
|
shouldInject
|
|
90
74
|
} = (0, _utils.mergeOptions)(opts, props);
|
|
91
|
-
(0, _warning.default)(typeof field === 'undefined' && options.shouldInject, "[Semi Form]: 'field' is required, please check your props of Field Component");
|
|
75
|
+
(0, _warning.default)(typeof field === 'undefined' && options.shouldInject, "[Semi Form]: 'field' is required, please check your props of Field Component");
|
|
76
|
+
// 无需注入的直接返回,eg:Group内的checkbox、radio
|
|
92
77
|
// Return without injection, eg: <Checkbox> / <Radio> inside CheckboxGroup/RadioGroup
|
|
93
|
-
|
|
94
78
|
if (!shouldInject) {
|
|
95
79
|
return /*#__PURE__*/_react.default.createElement(Component, Object.assign({}, rest, {
|
|
96
80
|
ref: ref
|
|
97
81
|
}));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
82
|
+
}
|
|
83
|
+
// grab formState from context
|
|
84
|
+
const formState = (0, _index.useFormState)();
|
|
85
|
+
// grab formUpdater (the api for field to read/modify FormState) from context
|
|
103
86
|
const updater = (0, _index.useFormUpdater)();
|
|
104
|
-
|
|
105
87
|
if (!updater.getFormProps) {
|
|
106
88
|
(0, _warning.default)(true, '[Semi Form]: Field Component must be use inside the Form, please check your dom declaration');
|
|
107
89
|
return null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
}
|
|
91
|
+
// To prevent user forgetting to pass the field, use undefined as the key, and updater.getValue will get the wrong value.
|
|
111
92
|
let initValueInFormOpts = typeof field !== 'undefined' ? updater.getValue(field) : undefined; // Get the init value of form from formP rops.init Values Get the initial value set in the initValues of Form
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
93
|
+
let initVal = typeof initValue !== 'undefined' ? initValue : initValueInFormOpts;
|
|
94
|
+
// use arrayFieldState to fix issue 615
|
|
115
95
|
let arrayFieldState;
|
|
116
|
-
|
|
117
96
|
try {
|
|
118
97
|
arrayFieldState = (0, _index.useArrayFieldState)();
|
|
119
|
-
|
|
120
98
|
if (arrayFieldState) {
|
|
121
99
|
initVal = arrayFieldState.shouldUseInitValue && typeof initValue !== 'undefined' ? initValue : initValueInFormOpts;
|
|
122
100
|
}
|
|
123
|
-
} catch (err) {}
|
|
124
|
-
|
|
125
|
-
|
|
101
|
+
} catch (err) {}
|
|
102
|
+
// FIXME typeof initVal
|
|
126
103
|
const [value, setValue, getVal] = (0, _index.useStateWithGetter)(typeof initVal !== undefined ? initVal : null);
|
|
127
104
|
const validateOnMount = trigger.includes('mount');
|
|
128
|
-
allowEmpty = allowEmpty || updater.getFormProps().allowEmpty;
|
|
129
|
-
|
|
105
|
+
allowEmpty = allowEmpty || updater.getFormProps().allowEmpty;
|
|
106
|
+
// Error information: Array, String, undefined
|
|
130
107
|
const [error, setError, getError] = (0, _index.useStateWithGetter)();
|
|
131
108
|
const [touched, setTouched] = (0, _react.useState)();
|
|
132
109
|
const [cursor, setCursor, getCursor] = (0, _index.useStateWithGetter)(0);
|
|
133
110
|
const [status, setStatus] = (0, _react.useState)(validateStatus); // use props.validateStatus to init
|
|
134
|
-
|
|
135
111
|
const rulesRef = (0, _react.useRef)(rules);
|
|
136
112
|
const validateRef = (0, _react.useRef)(validate);
|
|
137
|
-
const validatePromise = (0, _react.useRef)(null);
|
|
113
|
+
const validatePromise = (0, _react.useRef)(null);
|
|
114
|
+
// notNotify is true means that the onChange of the Form does not need to be triggered
|
|
138
115
|
// notUpdate is true means that this operation does not need to trigger the forceUpdate
|
|
139
|
-
|
|
140
116
|
const updateTouched = (isTouched, callOpts) => {
|
|
141
117
|
setTouched(isTouched);
|
|
142
118
|
updater.updateStateTouched(field, isTouched, callOpts);
|
|
143
119
|
};
|
|
144
|
-
|
|
145
120
|
const updateError = (errors, callOpts) => {
|
|
146
121
|
if (errors === getError()) {
|
|
147
122
|
// When the inspection result is unchanged, no need to update, saving a forceUpdate overhead
|
|
@@ -150,17 +125,14 @@ function withField(Component, opts) {
|
|
|
150
125
|
// errors为数组时,不做deepEqual,始终当做需要更新处理
|
|
151
126
|
return;
|
|
152
127
|
}
|
|
153
|
-
|
|
154
128
|
setError(errors);
|
|
155
129
|
updater.updateStateError(field, errors, callOpts);
|
|
156
|
-
|
|
157
130
|
if (!(0, _utils.isValid)(errors)) {
|
|
158
131
|
setStatus('error');
|
|
159
132
|
} else {
|
|
160
133
|
setStatus('success');
|
|
161
134
|
}
|
|
162
135
|
};
|
|
163
|
-
|
|
164
136
|
const updateValue = (val, callOpts) => {
|
|
165
137
|
setValue(val);
|
|
166
138
|
let newOpts = Object.assign(Object.assign({}, callOpts), {
|
|
@@ -168,20 +140,18 @@ function withField(Component, opts) {
|
|
|
168
140
|
});
|
|
169
141
|
updater.updateStateValue(field, val, newOpts);
|
|
170
142
|
};
|
|
171
|
-
|
|
172
143
|
const reset = () => {
|
|
173
144
|
let callOpts = {
|
|
174
145
|
notNotify: true,
|
|
175
146
|
notUpdate: true
|
|
176
|
-
};
|
|
177
|
-
|
|
147
|
+
};
|
|
148
|
+
// reset is called by the FormFoundaion uniformly. The field level does not need to trigger notify and update.
|
|
178
149
|
updateValue(initVal !== null ? initVal : undefined, callOpts);
|
|
179
150
|
updateError(undefined, callOpts);
|
|
180
151
|
updateTouched(undefined, callOpts);
|
|
181
152
|
setStatus('default');
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
|
|
153
|
+
};
|
|
154
|
+
// Execute the validation rules specified by rules
|
|
185
155
|
const _validateInternal = (val, callOpts) => {
|
|
186
156
|
let latestRules = rulesRef.current || [];
|
|
187
157
|
const validator = (0, _utils.generateValidatesFromRules)(field, latestRules);
|
|
@@ -191,13 +161,13 @@ function withField(Component, opts) {
|
|
|
191
161
|
const rootPromise = new Promise((resolve, reject) => {
|
|
192
162
|
validator.validate(model, {
|
|
193
163
|
first: stopValidateWithError
|
|
194
|
-
},
|
|
164
|
+
},
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
195
166
|
(errors, fields) => {}).then(res => {
|
|
196
167
|
if (validatePromise.current !== rootPromise) {
|
|
197
168
|
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
169
|
+
}
|
|
170
|
+
// validation passed
|
|
201
171
|
setStatus('success');
|
|
202
172
|
updateError(undefined, callOpts);
|
|
203
173
|
resolve({});
|
|
@@ -205,22 +175,17 @@ function withField(Component, opts) {
|
|
|
205
175
|
if (validatePromise.current !== rootPromise) {
|
|
206
176
|
return;
|
|
207
177
|
}
|
|
208
|
-
|
|
209
178
|
let {
|
|
210
179
|
errors,
|
|
211
180
|
fields
|
|
212
181
|
} = err;
|
|
213
|
-
|
|
214
182
|
if (errors && fields) {
|
|
215
183
|
let messages = errors.map(e => e.message);
|
|
216
|
-
|
|
217
184
|
if (messages.length === 1) {
|
|
218
185
|
// eslint-disable-next-line prefer-destructuring
|
|
219
186
|
messages = messages[0];
|
|
220
187
|
}
|
|
221
|
-
|
|
222
188
|
updateError(messages, callOpts);
|
|
223
|
-
|
|
224
189
|
if (!(0, _utils.isValid)(messages)) {
|
|
225
190
|
setStatus('error');
|
|
226
191
|
resolve(errors);
|
|
@@ -236,20 +201,18 @@ function withField(Component, opts) {
|
|
|
236
201
|
});
|
|
237
202
|
validatePromise.current = rootPromise;
|
|
238
203
|
return rootPromise;
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
|
|
204
|
+
};
|
|
205
|
+
// execute custom validate function
|
|
242
206
|
const _validate = (val, values, callOpts) => {
|
|
243
207
|
const rootPromise = new Promise(resolve => {
|
|
244
|
-
let maybePromisedErrors;
|
|
245
|
-
|
|
208
|
+
let maybePromisedErrors;
|
|
209
|
+
// let errorThrowSync;
|
|
246
210
|
try {
|
|
247
211
|
maybePromisedErrors = validateRef.current(val, values);
|
|
248
212
|
} catch (err) {
|
|
249
213
|
// error throw by syncValidate
|
|
250
214
|
maybePromisedErrors = err;
|
|
251
215
|
}
|
|
252
|
-
|
|
253
216
|
if (maybePromisedErrors === undefined) {
|
|
254
217
|
resolve({});
|
|
255
218
|
updateError(undefined, callOpts);
|
|
@@ -259,7 +222,6 @@ function withField(Component, opts) {
|
|
|
259
222
|
if (validatePromise.current !== rootPromise) {
|
|
260
223
|
return;
|
|
261
224
|
}
|
|
262
|
-
|
|
263
225
|
if ((0, _utils.isValid)(result)) {
|
|
264
226
|
// validate success,no need to do anything with result
|
|
265
227
|
updateError(undefined, callOpts);
|
|
@@ -283,21 +245,17 @@ function withField(Component, opts) {
|
|
|
283
245
|
validatePromise.current = rootPromise;
|
|
284
246
|
return rootPromise;
|
|
285
247
|
};
|
|
286
|
-
|
|
287
248
|
const fieldValidate = (val, callOpts) => {
|
|
288
249
|
let finalVal = val;
|
|
289
250
|
let latestRules = rulesRef.current;
|
|
290
|
-
|
|
291
251
|
if (transform) {
|
|
292
252
|
finalVal = transform(val);
|
|
293
253
|
}
|
|
294
|
-
|
|
295
254
|
if (validateRef.current) {
|
|
296
255
|
return _validate(finalVal, updater.getValue(), callOpts);
|
|
297
256
|
} else if (latestRules) {
|
|
298
257
|
return _validateInternal(finalVal, callOpts);
|
|
299
258
|
}
|
|
300
|
-
|
|
301
259
|
return null;
|
|
302
260
|
};
|
|
303
261
|
/**
|
|
@@ -305,32 +263,26 @@ function withField(Component, opts) {
|
|
|
305
263
|
* validate when trigger
|
|
306
264
|
*
|
|
307
265
|
*/
|
|
308
|
-
|
|
309
|
-
|
|
310
266
|
const handleChange = function (newValue, e) {
|
|
311
267
|
let fnKey = options.onKeyChangeFnName;
|
|
312
|
-
|
|
313
268
|
if (fnKey in props && typeof props[options.onKeyChangeFnName] === 'function') {
|
|
314
269
|
for (var _len = arguments.length, other = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
315
270
|
other[_key - 2] = arguments[_key];
|
|
316
271
|
}
|
|
317
|
-
|
|
318
272
|
props[options.onKeyChangeFnName](newValue, e, ...other);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
273
|
+
}
|
|
274
|
+
// support various type component
|
|
322
275
|
let val;
|
|
323
|
-
|
|
324
276
|
if (!options.valuePath) {
|
|
325
277
|
val = newValue;
|
|
326
278
|
} else {
|
|
327
279
|
val = ObjectUtil.get(newValue, options.valuePath);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
280
|
+
}
|
|
281
|
+
// User can use convert function to updateValue before Component UI render
|
|
331
282
|
if (typeof convert === 'function') {
|
|
332
283
|
val = convert(val);
|
|
333
|
-
}
|
|
284
|
+
}
|
|
285
|
+
// TODO: allowEmptyString split into allowEmpty, emptyValue
|
|
334
286
|
// Added abandonment warning
|
|
335
287
|
// if (process.env.NODE_ENV !== 'production') {
|
|
336
288
|
// warning(allowEmptyString, `'allowEmptyString' will be de deprecated in next version, please replace with 'allowEmpty' & 'emptyValue'
|
|
@@ -338,44 +290,38 @@ function withField(Component, opts) {
|
|
|
338
290
|
// }
|
|
339
291
|
// set value to undefined if it's an empty string
|
|
340
292
|
// allowEmptyString={true} is equivalent to allowEmpty = {true} emptyValue = "
|
|
341
|
-
|
|
342
|
-
|
|
343
293
|
if (allowEmptyString || allowEmpty) {
|
|
344
|
-
if (val === '') {
|
|
294
|
+
if (val === '') {
|
|
295
|
+
// do nothing
|
|
345
296
|
}
|
|
346
297
|
} else {
|
|
347
298
|
if (val === emptyValue) {
|
|
348
299
|
val = undefined;
|
|
349
300
|
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
301
|
+
}
|
|
302
|
+
// maintain compoent cursor if needed
|
|
353
303
|
try {
|
|
354
304
|
if (e && e.target && e.target.selectionStart) {
|
|
355
305
|
setCursor(e.target.selectionStart);
|
|
356
306
|
}
|
|
357
307
|
} catch (err) {}
|
|
358
|
-
|
|
359
308
|
updateTouched(true, {
|
|
360
309
|
notNotify: true,
|
|
361
310
|
notUpdate: true
|
|
362
311
|
});
|
|
363
|
-
updateValue(val);
|
|
364
|
-
|
|
312
|
+
updateValue(val);
|
|
313
|
+
// only validate when trigger includes change
|
|
365
314
|
if (trigger.includes('change')) {
|
|
366
315
|
fieldValidate(val);
|
|
367
316
|
}
|
|
368
317
|
};
|
|
369
|
-
|
|
370
318
|
const handleBlur = function () {
|
|
371
319
|
if (props.onBlur) {
|
|
372
320
|
props.onBlur(...arguments);
|
|
373
321
|
}
|
|
374
|
-
|
|
375
322
|
if (!touched) {
|
|
376
323
|
updateTouched(true);
|
|
377
324
|
}
|
|
378
|
-
|
|
379
325
|
if (trigger.includes('blur')) {
|
|
380
326
|
let val = getVal();
|
|
381
327
|
fieldValidate(val);
|
|
@@ -383,8 +329,6 @@ function withField(Component, opts) {
|
|
|
383
329
|
};
|
|
384
330
|
/** Field level maintains a separate layer of data, which is convenient for Form to control Field to update the UI */
|
|
385
331
|
// The field level maintains a separate layer of data, which is convenient for the Form to control the Field for UI updates.
|
|
386
|
-
|
|
387
|
-
|
|
388
332
|
const fieldApi = {
|
|
389
333
|
setValue: updateValue,
|
|
390
334
|
setTouched: updateTouched,
|
|
@@ -397,30 +341,29 @@ function withField(Component, opts) {
|
|
|
397
341
|
error,
|
|
398
342
|
touched,
|
|
399
343
|
status
|
|
400
|
-
};
|
|
401
|
-
|
|
344
|
+
};
|
|
345
|
+
// avoid hooks capture value, fixed issue 346
|
|
402
346
|
useIsomorphicEffect(() => {
|
|
403
347
|
rulesRef.current = rules;
|
|
404
348
|
validateRef.current = validate;
|
|
405
|
-
}, [rules, validate]);
|
|
406
|
-
|
|
349
|
+
}, [rules, validate]);
|
|
350
|
+
// exec validate once when trigger inlcude 'mount'
|
|
407
351
|
useIsomorphicEffect(() => {
|
|
408
352
|
if (validateOnMount) {
|
|
409
353
|
fieldValidate(value);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
}, []);
|
|
354
|
+
}
|
|
355
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
356
|
+
}, []);
|
|
357
|
+
// register when mounted,unregister when unmounted
|
|
413
358
|
// register again when field change
|
|
414
|
-
|
|
415
359
|
useIsomorphicEffect(() => {
|
|
416
360
|
// register
|
|
417
361
|
if (typeof field === 'undefined') {
|
|
418
362
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
419
363
|
return () => {};
|
|
420
|
-
}
|
|
364
|
+
}
|
|
365
|
+
// log('register: ' + field);
|
|
421
366
|
// field value may change after field component mounted, we use ref value here to get changed value
|
|
422
|
-
|
|
423
|
-
|
|
424
367
|
const refValue = getVal();
|
|
425
368
|
updater.register(field, {
|
|
426
369
|
value: refValue,
|
|
@@ -432,11 +375,13 @@ function withField(Component, opts) {
|
|
|
432
375
|
fieldApi,
|
|
433
376
|
keepState,
|
|
434
377
|
allowEmpty: allowEmpty || allowEmptyString
|
|
435
|
-
});
|
|
436
|
-
|
|
378
|
+
});
|
|
379
|
+
// return unRegister cb
|
|
437
380
|
return () => {
|
|
438
|
-
updater.unRegister(field);
|
|
439
|
-
|
|
381
|
+
updater.unRegister(field);
|
|
382
|
+
// log('unRegister: ' + field);
|
|
383
|
+
};
|
|
384
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
440
385
|
}, [field]);
|
|
441
386
|
let formProps = updater.getFormProps(['labelPosition', 'labelWidth', 'labelAlign', 'labelCol', 'wrapperCol', 'disabled', 'showValidateIcon', 'extraTextPosition']);
|
|
442
387
|
let mergeLabelPos = labelPosition || formProps.labelPosition;
|
|
@@ -444,14 +389,13 @@ function withField(Component, opts) {
|
|
|
444
389
|
let mergeLabelAlign = labelAlign || formProps.labelAlign;
|
|
445
390
|
let mergeLabelCol = labelCol || formProps.labelCol;
|
|
446
391
|
let mergeWrapperCol = wrapperCol || formProps.wrapperCol;
|
|
447
|
-
let mergeExtraPos = extraTextPosition || formProps.extraTextPosition || 'bottom';
|
|
448
|
-
|
|
392
|
+
let mergeExtraPos = extraTextPosition || formProps.extraTextPosition || 'bottom';
|
|
393
|
+
// id attribute to improve a11y
|
|
449
394
|
const a11yId = id ? id : field;
|
|
450
395
|
const labelId = `${a11yId}-label`;
|
|
451
396
|
const helpTextId = `${a11yId}-helpText`;
|
|
452
397
|
const extraTextId = `${a11yId}-extraText`;
|
|
453
398
|
const errorMessageId = `${a11yId}-errormessage`;
|
|
454
|
-
|
|
455
399
|
const FieldComponent = () => {
|
|
456
400
|
// prefer to use validateStatus which pass by user throught props
|
|
457
401
|
let blockStatus = validateStatus ? validateStatus : status;
|
|
@@ -477,24 +421,19 @@ function withField(Component, opts) {
|
|
|
477
421
|
'aria-required': required,
|
|
478
422
|
'aria-labelledby': labelId
|
|
479
423
|
});
|
|
480
|
-
|
|
481
424
|
if (name) {
|
|
482
425
|
newProps['name'] = name;
|
|
483
426
|
}
|
|
484
|
-
|
|
485
427
|
if (helpText) {
|
|
486
428
|
newProps['aria-describedby'] = extraText ? `${helpTextId} ${extraTextId}` : helpTextId;
|
|
487
429
|
}
|
|
488
|
-
|
|
489
430
|
if (extraText) {
|
|
490
431
|
newProps['aria-describedby'] = helpText ? `${helpTextId} ${extraTextId}` : extraTextId;
|
|
491
432
|
}
|
|
492
|
-
|
|
493
433
|
if (status === 'error') {
|
|
494
434
|
newProps['aria-errormessage'] = errorMessageId;
|
|
495
435
|
newProps['aria-invalid'] = true;
|
|
496
436
|
}
|
|
497
|
-
|
|
498
437
|
const fieldCls = (0, _classnames.default)({
|
|
499
438
|
[`${prefix}-field`]: true,
|
|
500
439
|
[`${prefix}-field-${name}`]: Boolean(name),
|
|
@@ -503,24 +442,19 @@ function withField(Component, opts) {
|
|
|
503
442
|
const fieldMaincls = (0, _classnames.default)({
|
|
504
443
|
[`${prefix}-field-main`]: true
|
|
505
444
|
});
|
|
506
|
-
|
|
507
445
|
if (mergeLabelPos === 'inset' && !noLabel) {
|
|
508
446
|
newProps.insetLabel = label || field;
|
|
509
447
|
newProps.insetLabelId = labelId;
|
|
510
|
-
|
|
511
448
|
if (typeof label === 'object' && !(0, _reactUtils.isElement)(label)) {
|
|
512
449
|
newProps.insetLabel = label.text;
|
|
513
450
|
newProps.insetLabelId = labelId;
|
|
514
451
|
}
|
|
515
452
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
453
|
+
const com = /*#__PURE__*/_react.default.createElement(Component, Object.assign({}, newProps));
|
|
454
|
+
// when use in InputGroup, no need to insert <Label>、<ErrorMessage> inside Field, just add it at Group
|
|
520
455
|
if (isInInputGroup) {
|
|
521
456
|
return com;
|
|
522
457
|
}
|
|
523
|
-
|
|
524
458
|
if (pure) {
|
|
525
459
|
let pureCls = (0, _classnames.default)(rest.className, {
|
|
526
460
|
[`${prefix}-field-pure`]: true,
|
|
@@ -530,12 +464,10 @@ function withField(Component, opts) {
|
|
|
530
464
|
newProps.className = pureCls;
|
|
531
465
|
return /*#__PURE__*/_react.default.createElement(Component, Object.assign({}, newProps));
|
|
532
466
|
}
|
|
533
|
-
|
|
534
467
|
let withCol = mergeLabelCol && mergeWrapperCol;
|
|
535
|
-
const labelColCls = mergeLabelAlign ? `${prefix}-col-${mergeLabelAlign}` : '';
|
|
536
|
-
|
|
468
|
+
const labelColCls = mergeLabelAlign ? `${prefix}-col-${mergeLabelAlign}` : '';
|
|
469
|
+
// get label
|
|
537
470
|
let labelContent = null;
|
|
538
|
-
|
|
539
471
|
if (!noLabel && mergeLabelPos !== 'inset') {
|
|
540
472
|
let needSpread = typeof label === 'object' && !(0, _reactUtils.isElement)(label) ? label : {};
|
|
541
473
|
labelContent = /*#__PURE__*/_react.default.createElement(_label.default, Object.assign({
|
|
@@ -547,7 +479,6 @@ function withField(Component, opts) {
|
|
|
547
479
|
align: mergeLabelAlign
|
|
548
480
|
}, needSpread));
|
|
549
481
|
}
|
|
550
|
-
|
|
551
482
|
const fieldMainContent = /*#__PURE__*/_react.default.createElement("div", {
|
|
552
483
|
className: fieldMaincls
|
|
553
484
|
}, mergeExtraPos === 'middle' ? extraContent : null, com, !noErrorMessage ? /*#__PURE__*/_react.default.createElement(_errorMessage.default, {
|
|
@@ -558,7 +489,6 @@ function withField(Component, opts) {
|
|
|
558
489
|
errorMessageId: errorMessageId,
|
|
559
490
|
showValidateIcon: formProps.showValidateIcon
|
|
560
491
|
}) : null, mergeExtraPos === 'bottom' ? extraContent : null);
|
|
561
|
-
|
|
562
492
|
const withColContent = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, mergeLabelPos === 'top' ? /*#__PURE__*/_react.default.createElement("div", {
|
|
563
493
|
style: {
|
|
564
494
|
overflow: 'hidden'
|
|
@@ -568,7 +498,6 @@ function withField(Component, opts) {
|
|
|
568
498
|
}), labelContent)) : /*#__PURE__*/_react.default.createElement(_grid.Col, Object.assign({}, mergeLabelCol, {
|
|
569
499
|
className: labelColCls
|
|
570
500
|
}), labelContent), /*#__PURE__*/_react.default.createElement(_grid.Col, Object.assign({}, mergeWrapperCol), fieldMainContent));
|
|
571
|
-
|
|
572
501
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
573
502
|
className: fieldCls,
|
|
574
503
|
style: fieldStyle,
|
|
@@ -576,11 +505,9 @@ function withField(Component, opts) {
|
|
|
576
505
|
"x-field-id": field,
|
|
577
506
|
"x-extra-pos": mergeExtraPos
|
|
578
507
|
}, withCol ? withColContent : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, labelContent, fieldMainContent));
|
|
579
|
-
};
|
|
580
|
-
|
|
581
|
-
|
|
508
|
+
};
|
|
509
|
+
// !important optimization
|
|
582
510
|
const shouldUpdate = [...Object.values(fieldState), ...Object.values(props), field, mergeLabelPos, mergeLabelAlign, formProps.disabled];
|
|
583
|
-
|
|
584
511
|
if (options.shouldMemo) {
|
|
585
512
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
586
513
|
return (0, _react.useMemo)(FieldComponent, [...shouldUpdate]);
|
|
@@ -589,12 +516,10 @@ function withField(Component, opts) {
|
|
|
589
516
|
return FieldComponent();
|
|
590
517
|
}
|
|
591
518
|
};
|
|
592
|
-
|
|
593
519
|
SemiField = /*#__PURE__*/(0, _react.forwardRef)(SemiField);
|
|
594
520
|
SemiField.displayName = (0, _utils.getDisplayName)(Component);
|
|
595
521
|
return SemiField;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
|
|
522
|
+
}
|
|
523
|
+
// eslint-disable-next-line
|
|
599
524
|
var _default = withField;
|
|
600
525
|
exports.default = _default;
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _context = require("../context");
|
|
11
|
-
|
|
12
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
11
|
function withFormApi(Component) {
|
|
17
12
|
let WithApiCom = (props, ref) => {
|
|
18
13
|
return /*#__PURE__*/_react.default.createElement(_context.FormApiContext.Consumer, null, formApi => /*#__PURE__*/_react.default.createElement(Component, Object.assign({
|
|
@@ -20,10 +15,8 @@ function withFormApi(Component) {
|
|
|
20
15
|
ref: ref
|
|
21
16
|
}, props)));
|
|
22
17
|
};
|
|
23
|
-
|
|
24
18
|
WithApiCom = /*#__PURE__*/(0, _react.forwardRef)(WithApiCom);
|
|
25
19
|
return WithApiCom;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
var _default = withFormApi;
|
|
29
22
|
exports.default = _default;
|
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _context = require("../context");
|
|
11
|
-
|
|
12
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
|
|
14
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
-
|
|
16
11
|
function withFormState(Component) {
|
|
17
12
|
let WithStateCom = (props, ref) => {
|
|
18
13
|
return /*#__PURE__*/_react.default.createElement(_context.FormStateContext.Consumer, null, formState => /*#__PURE__*/_react.default.createElement(Component, Object.assign({
|
|
@@ -20,10 +15,8 @@ function withFormState(Component) {
|
|
|
20
15
|
ref: ref
|
|
21
16
|
}, props)));
|
|
22
17
|
};
|
|
23
|
-
|
|
24
18
|
WithStateCom = /*#__PURE__*/(0, _react.forwardRef)(WithStateCom);
|
|
25
19
|
return WithStateCom;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
var _default = withFormState;
|
|
29
22
|
exports.default = _default;
|
|
@@ -45,19 +45,11 @@ Object.defineProperty(exports, "useStateWithGetter", {
|
|
|
45
45
|
return _useStateWithGetter.default;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
|
|
49
48
|
var _useFormApi = _interopRequireDefault(require("./useFormApi"));
|
|
50
|
-
|
|
51
49
|
var _useFormState = _interopRequireDefault(require("./useFormState"));
|
|
52
|
-
|
|
53
50
|
var _useFieldState = _interopRequireDefault(require("./useFieldState"));
|
|
54
|
-
|
|
55
51
|
var _useFieldApi = _interopRequireDefault(require("./useFieldApi"));
|
|
56
|
-
|
|
57
52
|
var _useFormUpdater = _interopRequireDefault(require("./useFormUpdater"));
|
|
58
|
-
|
|
59
53
|
var _useStateWithGetter = _interopRequireDefault(require("./useStateWithGetter"));
|
|
60
|
-
|
|
61
54
|
var _useArrayFieldState = _interopRequireDefault(require("./useArrayFieldState"));
|
|
62
|
-
|
|
63
55
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -4,15 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = require("react");
|
|
9
|
-
|
|
10
8
|
var _context = require("../context");
|
|
11
|
-
|
|
12
9
|
function useArrayFieldState() {
|
|
13
10
|
const arrayFieldContext = (0, _react.useContext)(_context.ArrayFieldContext);
|
|
14
11
|
return arrayFieldContext;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
var _default = useArrayFieldState;
|
|
18
14
|
exports.default = _default;
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _useFormApi = _interopRequireDefault(require("./useFormApi"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
const buildFieldApi = (formApi, field) => ({
|
|
13
10
|
getError: () => formApi.getError(field),
|
|
14
11
|
setError: error => formApi.setError(field, error),
|
|
@@ -17,12 +14,10 @@ const buildFieldApi = (formApi, field) => ({
|
|
|
17
14
|
getValue: () => formApi.getValue(field),
|
|
18
15
|
setValue: value => formApi.setValue(field, value)
|
|
19
16
|
});
|
|
20
|
-
|
|
21
17
|
function useFieldApi(field) {
|
|
22
18
|
const formApi = (0, _useFormApi.default)();
|
|
23
19
|
const fieldApi = buildFieldApi(formApi, field);
|
|
24
20
|
return fieldApi;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
var _default = useFieldApi;
|
|
28
23
|
exports.default = _default;
|