@aifuxi/semi-ui-vue 0.1.0-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/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/Button-RCaDTqHh.js +249 -0
- package/dist/Collapsible-DeV0aJ4n.js +199 -0
- package/dist/Cropper-Dy1LPBDN.js +587 -0
- package/dist/Divider-BQmwhGfH.js +57 -0
- package/dist/Input-BYWFIgNn.js +593 -0
- package/dist/InputNumber-BaeViVtG.js +856 -0
- package/dist/Modal-BhmFYVFw.js +975 -0
- package/dist/Pagination-4JvS-gHR.js +572 -0
- package/dist/Progress-BulSV_JR.js +523 -0
- package/dist/SBOM.spdx.json +165 -0
- package/dist/SelectOption-Ce-Lst-e.js +1473 -0
- package/dist/Slider-w9sbxzBw.js +707 -0
- package/dist/Spin-CuFLkqev.js +222 -0
- package/dist/THIRD_PARTY_LICENSES/Semi-Design.txt +83 -0
- package/dist/THIRD_PARTY_LICENSES/async-validator.txt +9 -0
- package/dist/THIRD_PARTY_LICENSES/bezier-easing.txt +22 -0
- package/dist/THIRD_PARTY_LICENSES/date-fns-tz.txt +21 -0
- package/dist/THIRD_PARTY_LICENSES/date-fns.txt +21 -0
- package/dist/THIRD_PARTY_LICENSES/lodash.txt +47 -0
- package/dist/THIRD_PARTY_LICENSES/scroll-into-view-if-needed.txt +21 -0
- package/dist/THIRD_PARTY_NOTICES.md +23 -0
- package/dist/Tooltip-Bq7HZwnS.js +1321 -0
- package/dist/Tree-tqy5xBYJ.js +1275 -0
- package/dist/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/anchor/Anchor.vue.d.ts +29 -0
- package/dist/anchor/AnchorLink.vue.d.ts +16 -0
- package/dist/anchor/AnchorNodeRenderer.d.ts +15 -0
- package/dist/anchor/anchor-context.d.ts +18 -0
- package/dist/anchor/index.d.ts +11 -0
- package/dist/anchor/index.js +2 -0
- package/dist/anchor/types.d.ts +43 -0
- package/dist/anchor-DW0p2t-I.js +503 -0
- package/dist/arrayMove-ByVCXfhS.js +7 -0
- package/dist/auto-complete/AutoComplete.vue.d.ts +33 -0
- package/dist/auto-complete/AutoCompleteNodeRenderer.d.ts +15 -0
- package/dist/auto-complete/AutoCompleteOption.vue.d.ts +19 -0
- package/dist/auto-complete/index.d.ts +10 -0
- package/dist/auto-complete/index.js +2 -0
- package/dist/auto-complete/types.d.ts +117 -0
- package/dist/auto-complete/use-auto-complete-foundation.d.ts +40 -0
- package/dist/auto-complete-BeahBlt9.js +765 -0
- package/dist/avatar/Avatar.vue.d.ts +26 -0
- package/dist/avatar/AvatarGroup.d.ts +54 -0
- package/dist/avatar/AvatarNodeRenderer.d.ts +15 -0
- package/dist/avatar/TopSlotSvg.vue.d.ts +7 -0
- package/dist/avatar/index.d.ts +10 -0
- package/dist/avatar/index.js +2 -0
- package/dist/avatar/types.d.ts +86 -0
- package/dist/avatar-B00xjEzD.js +551 -0
- package/dist/back-top/BackTop.vue.d.ts +19 -0
- package/dist/back-top/index.d.ts +3 -0
- package/dist/back-top/index.js +2 -0
- package/dist/back-top/types.d.ts +15 -0
- package/dist/back-top-C2XqUzoN.js +123 -0
- package/dist/badge/Badge.vue.d.ts +23 -0
- package/dist/badge/BadgeNodeRenderer.d.ts +15 -0
- package/dist/badge/index.d.ts +6 -0
- package/dist/badge/index.js +2 -0
- package/dist/badge/types.d.ts +29 -0
- package/dist/badge-gWsDkzyt.js +120 -0
- package/dist/banner/Banner.vue.d.ts +19 -0
- package/dist/banner/BannerNodeRenderer.d.ts +15 -0
- package/dist/banner/index.d.ts +6 -0
- package/dist/banner/index.js +2 -0
- package/dist/banner/types.d.ts +25 -0
- package/dist/banner-B3O4uDoR.js +220 -0
- package/dist/breadcrumb/Breadcrumb.d.ts +129 -0
- package/dist/breadcrumb/BreadcrumbIconRenderer.d.ts +23 -0
- package/dist/breadcrumb/BreadcrumbItem.vue.d.ts +19 -0
- package/dist/breadcrumb/BreadcrumbNodeRenderer.d.ts +15 -0
- package/dist/breadcrumb/BreadcrumbPopover.vue.d.ts +17 -0
- package/dist/breadcrumb/BreadcrumbPopoverArrow.vue.d.ts +3 -0
- package/dist/breadcrumb/breadcrumb-context.d.ts +9 -0
- package/dist/breadcrumb/index.d.ts +11 -0
- package/dist/breadcrumb/index.js +2 -0
- package/dist/breadcrumb/types.d.ts +72 -0
- package/dist/breadcrumb-BmBbFmGK.js +451 -0
- package/dist/button/Button.vue.d.ts +34 -0
- package/dist/button/ButtonAiLoadingIcon.vue.d.ts +3 -0
- package/dist/button/ButtonGroup.d.ts +69 -0
- package/dist/button/ButtonIconRenderer.d.ts +28 -0
- package/dist/button/ButtonLoadingIcon.vue.d.ts +3 -0
- package/dist/button/SplitButtonGroup.vue.d.ts +16 -0
- package/dist/button/index.d.ts +5 -0
- package/dist/button/index.js +3 -0
- package/dist/button/types.d.ts +57 -0
- package/dist/button-Rcn5pYGh.js +134 -0
- package/dist/calendar/Calendar.vue.d.ts +29 -0
- package/dist/calendar/CalendarDay.vue.d.ts +3 -0
- package/dist/calendar/CalendarMonth.vue.d.ts +3 -0
- package/dist/calendar/CalendarNodeRenderer.d.ts +15 -0
- package/dist/calendar/CalendarTimeColumn.vue.d.ts +6 -0
- package/dist/calendar/CalendarWeek.vue.d.ts +8 -0
- package/dist/calendar/index.d.ts +6 -0
- package/dist/calendar/index.js +2 -0
- package/dist/calendar/types.d.ts +67 -0
- package/dist/calendar-CJTrr4y5.js +1172 -0
- package/dist/card/Card.vue.d.ts +16 -0
- package/dist/card/CardGroup.vue.d.ts +13 -0
- package/dist/card/CardMeta.vue.d.ts +11 -0
- package/dist/card/CardNodeRenderer.d.ts +15 -0
- package/dist/card/CardSkeleton.vue.d.ts +3 -0
- package/dist/card/card-content.d.ts +2 -0
- package/dist/card/index.d.ts +11 -0
- package/dist/card/index.js +2 -0
- package/dist/card/types.d.ts +56 -0
- package/dist/card-DwMOFi6_.js +348 -0
- package/dist/carousel/Carousel.vue.d.ts +29 -0
- package/dist/carousel/CarouselArrow.vue.d.ts +15 -0
- package/dist/carousel/CarouselIndicator.vue.d.ts +17 -0
- package/dist/carousel/CarouselItemRenderer.d.ts +34 -0
- package/dist/carousel/CarouselNodeRenderer.d.ts +15 -0
- package/dist/carousel/index.d.ts +6 -0
- package/dist/carousel/index.js +2 -0
- package/dist/carousel/types.d.ts +70 -0
- package/dist/carousel/use-carousel-foundation.d.ts +19 -0
- package/dist/carousel-B4WlIRJH.js +458 -0
- package/dist/cascader/Cascader.vue.d.ts +71 -0
- package/dist/cascader/CascaderNodeRenderer.d.ts +15 -0
- package/dist/cascader/CascaderPanel.vue.d.ts +36 -0
- package/dist/cascader/index.d.ts +6 -0
- package/dist/cascader/index.js +2 -0
- package/dist/cascader/types.d.ts +192 -0
- package/dist/cascader-Ch6clCeh.js +1525 -0
- package/dist/checkbox/Checkbox.vue.d.ts +19 -0
- package/dist/checkbox/CheckboxGroup.d.ts +161 -0
- package/dist/checkbox/CheckboxNodeRenderer.d.ts +15 -0
- package/dist/checkbox/checkbox-context.d.ts +11 -0
- package/dist/checkbox/index.d.ts +10 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/checkbox/types.d.ts +92 -0
- package/dist/checkbox-mJD1ou6k.js +479 -0
- package/dist/collapse/Collapse.vue.d.ts +140 -0
- package/dist/collapse/CollapseNodeRenderer.d.ts +15 -0
- package/dist/collapse/CollapsePanel.vue.d.ts +99 -0
- package/dist/collapse/collapse-context.d.ts +14 -0
- package/dist/collapse/index.d.ts +10 -0
- package/dist/collapse/index.js +2 -0
- package/dist/collapse/types.d.ts +50 -0
- package/dist/collapse-7YtQLWqt.js +278 -0
- package/dist/collapsible/Collapsible.vue.d.ts +136 -0
- package/dist/collapsible/index.d.ts +5 -0
- package/dist/collapsible/index.js +5 -0
- package/dist/collapsible/types.d.ts +28 -0
- package/dist/color-picker/AlphaSlider.vue.d.ts +14 -0
- package/dist/color-picker/ColorChooseArea.vue.d.ts +20 -0
- package/dist/color-picker/ColorDataPart.vue.d.ts +15 -0
- package/dist/color-picker/ColorPicker.vue.d.ts +28 -0
- package/dist/color-picker/ColorPickerNodeRenderer.d.ts +17 -0
- package/dist/color-picker/ColorPickerPanel.vue.d.ts +37 -0
- package/dist/color-picker/ColorSlider.vue.d.ts +13 -0
- package/dist/color-picker/index.d.ts +10 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/color-picker/types.d.ts +67 -0
- package/dist/color-picker-ChC7qsx0.js +885 -0
- package/dist/config-context-CyynTtDb.js +4 -0
- package/dist/config-provider/ConfigConsumer.vue.d.ts +11 -0
- package/dist/config-provider/ConfigProvider.vue.d.ts +16 -0
- package/dist/config-provider/config-context.d.ts +3 -0
- package/dist/config-provider/constants.d.ts +4 -0
- package/dist/config-provider/index.d.ts +13 -0
- package/dist/config-provider/index.js +3 -0
- package/dist/config-provider/semi-global.d.ts +6 -0
- package/dist/config-provider/types.d.ts +74 -0
- package/dist/config-provider/use-responsive-observe.d.ts +6 -0
- package/dist/config-provider-VMfNNSF1.js +188 -0
- package/dist/constants-BF9bZJyc.js +45 -0
- package/dist/constants-BNwzO87W.js +9 -0
- package/dist/cropper/Cropper.vue.d.ts +18 -0
- package/dist/cropper/index.d.ts +4 -0
- package/dist/cropper/index.js +5 -0
- package/dist/cropper/types.d.ts +51 -0
- package/dist/date-picker/DatePicker.vue.d.ts +41 -0
- package/dist/date-picker/DatePickerMonth.vue.d.ts +25 -0
- package/dist/date-picker/DatePickerNodeRenderer.d.ts +17 -0
- package/dist/date-picker/DatePickerPanel.vue.d.ts +33 -0
- package/dist/date-picker/index.d.ts +5 -0
- package/dist/date-picker/index.js +2 -0
- package/dist/date-picker/types.d.ts +211 -0
- package/dist/date-picker-B2lhlKHD.js +2207 -0
- package/dist/descriptions/Descriptions.vue.d.ts +96 -0
- package/dist/descriptions/DescriptionsItem.vue.d.ts +96 -0
- package/dist/descriptions/DescriptionsNodeRenderer.d.ts +15 -0
- package/dist/descriptions/descriptions-context.d.ts +7 -0
- package/dist/descriptions/index.d.ts +10 -0
- package/dist/descriptions/index.js +2 -0
- package/dist/descriptions/types.d.ts +45 -0
- package/dist/descriptions-BU6ahbge.js +272 -0
- package/dist/divider/Divider.vue.d.ts +15 -0
- package/dist/divider/DividerContentRenderer.d.ts +17 -0
- package/dist/divider/index.d.ts +3 -0
- package/dist/divider/index.js +3 -0
- package/dist/divider/types.d.ts +13 -0
- package/dist/divider-DA9U4uOl.js +8 -0
- package/dist/dropdown/Dropdown.vue.d.ts +23 -0
- package/dist/dropdown/DropdownDivider.vue.d.ts +4 -0
- package/dist/dropdown/DropdownItem.vue.d.ts +28 -0
- package/dist/dropdown/DropdownMenu.vue.d.ts +11 -0
- package/dist/dropdown/DropdownNodeRenderer.d.ts +15 -0
- package/dist/dropdown/DropdownTitle.vue.d.ts +11 -0
- package/dist/dropdown/DropdownTriggerRenderer.d.ts +45 -0
- package/dist/dropdown/dropdown-context.d.ts +8 -0
- package/dist/dropdown/index.d.ts +17 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/dropdown/types.d.ts +98 -0
- package/dist/dropdown-D0-UWd65.js +665 -0
- package/dist/empty/Empty.vue.d.ts +13 -0
- package/dist/empty/EmptyNodeRenderer.d.ts +15 -0
- package/dist/empty/index.d.ts +6 -0
- package/dist/empty/index.js +2 -0
- package/dist/empty/types.d.ts +27 -0
- package/dist/empty-Bpms8Z5w.js +152 -0
- package/dist/env-BeIzjQx7.js +4 -0
- package/dist/es-CAWQuPuV.js +93 -0
- package/dist/float-button/FloatButton.vue.d.ts +20 -0
- package/dist/float-button/FloatButtonBadge.vue.d.ts +18 -0
- package/dist/float-button/FloatButtonGroup.vue.d.ts +17 -0
- package/dist/float-button/FloatButtonNodeRenderer.d.ts +17 -0
- package/dist/float-button/index.d.ts +4 -0
- package/dist/float-button/index.js +2 -0
- package/dist/float-button/types.d.ts +59 -0
- package/dist/float-button-qU3b0WBX.js +190 -0
- package/dist/form/ArrayField.d.ts +24 -0
- package/dist/form/Form.vue.d.ts +38 -0
- package/dist/form/FormErrorMessage.vue.d.ts +4 -0
- package/dist/form/FormField.d.ts +9 -0
- package/dist/form/FormInputGroup.d.ts +62 -0
- package/dist/form/FormLabel.vue.d.ts +18 -0
- package/dist/form/FormNodeRenderer.d.ts +15 -0
- package/dist/form/FormSection.vue.d.ts +16 -0
- package/dist/form/FormSlot.d.ts +3 -0
- package/dist/form/form-context.d.ts +4 -0
- package/dist/form/index.d.ts +68 -0
- package/dist/form/index.js +3 -0
- package/dist/form/internal-types.d.ts +67 -0
- package/dist/form/types.d.ts +273 -0
- package/dist/form/use-form.d.ts +11 -0
- package/dist/form/with-form.d.ts +3 -0
- package/dist/form-CLhGuORQ.js +2030 -0
- package/dist/foundation-Cawx37mp.js +1819 -0
- package/dist/grid/Col.vue.d.ts +13 -0
- package/dist/grid/Row.vue.d.ts +14 -0
- package/dist/grid/grid-context.d.ts +6 -0
- package/dist/grid/index.d.ts +5 -0
- package/dist/grid/index.js +2 -0
- package/dist/grid/media-query.d.ts +2 -0
- package/dist/grid/types.d.ts +44 -0
- package/dist/grid-Cn2uBhRd.js +161 -0
- package/dist/highlight/Highlight.vue.d.ts +10 -0
- package/dist/highlight/HighlightNodeRenderer.d.ts +49 -0
- package/dist/highlight/index.d.ts +4 -0
- package/dist/highlight/index.js +2 -0
- package/dist/highlight/internal-types.d.ts +8 -0
- package/dist/highlight/types.d.ts +17 -0
- package/dist/highlight-DHX3RV0C.js +158 -0
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/image/Image.vue.d.ts +21 -0
- package/dist/image/ImageNodeRenderer.d.ts +15 -0
- package/dist/image/ImagePreview.vue.d.ts +56 -0
- package/dist/image/ImagePreviewFooter.vue.d.ts +38 -0
- package/dist/image/ImagePreviewHeader.vue.d.ts +17 -0
- package/dist/image/ImagePreviewImage.vue.d.ts +27 -0
- package/dist/image/ImagePreviewInner.vue.d.ts +54 -0
- package/dist/image/image-context.d.ts +14 -0
- package/dist/image/index.d.ts +6 -0
- package/dist/image/index.js +2 -0
- package/dist/image/types.d.ts +183 -0
- package/dist/image-C-ifCh_9.js +1615 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +75 -0
- package/dist/input/Input.vue.d.ts +58 -0
- package/dist/input/InputGroup.d.ts +69 -0
- package/dist/input/InputNodeRenderer.d.ts +15 -0
- package/dist/input/TextArea.vue.d.ts +50 -0
- package/dist/input/index.d.ts +11 -0
- package/dist/input/index.js +2 -0
- package/dist/input/types.d.ts +168 -0
- package/dist/input-number/InputNumber.vue.d.ts +52 -0
- package/dist/input-number/index.d.ts +10 -0
- package/dist/input-number/index.js +5 -0
- package/dist/input-number/types.d.ts +56 -0
- package/dist/input-wf0nZCRS.js +747 -0
- package/dist/isBefore-BG1hiM9f.js +37 -0
- package/dist/isElement-Cx0AsIov.js +11 -0
- package/dist/isEnterPress-HTy0eCBp.js +8 -0
- package/dist/isNullOrUndefined-Cg6MZ8r3.js +6 -0
- package/dist/isPromise-D2v3Ejff.js +11 -0
- package/dist/keyCode-DMNg63wX.js +110 -0
- package/dist/layout/Layout.vue.d.ts +14 -0
- package/dist/layout/LayoutContent.vue.d.ts +14 -0
- package/dist/layout/LayoutFooter.vue.d.ts +14 -0
- package/dist/layout/LayoutHeader.vue.d.ts +14 -0
- package/dist/layout/LayoutSection.vue.d.ts +17 -0
- package/dist/layout/LayoutSider.vue.d.ts +18 -0
- package/dist/layout/index.d.ts +17 -0
- package/dist/layout/index.js +2 -0
- package/dist/layout/layout-context.d.ts +6 -0
- package/dist/layout/media-query.d.ts +4 -0
- package/dist/layout/types.d.ts +31 -0
- package/dist/layout-tq-_l_O3.js +171 -0
- package/dist/list/List.vue.d.ts +22 -0
- package/dist/list/ListItem.vue.d.ts +88 -0
- package/dist/list/ListNodeRenderer.d.ts +15 -0
- package/dist/list/ListSpin.vue.d.ts +16 -0
- package/dist/list/index.d.ts +10 -0
- package/dist/list/index.js +2 -0
- package/dist/list/list-context.d.ts +8 -0
- package/dist/list/types.d.ts +66 -0
- package/dist/list-DHIOE2Y-.js +387 -0
- package/dist/modal/ConfirmModal.vue.d.ts +14 -0
- package/dist/modal/Modal.vue.d.ts +15 -0
- package/dist/modal/ModalDefaultFooter.vue.d.ts +22 -0
- package/dist/modal/ModalDialog.vue.d.ts +53 -0
- package/dist/modal/ModalInnerContent.vue.d.ts +38 -0
- package/dist/modal/ModalNodeRenderer.d.ts +15 -0
- package/dist/modal/imperative.d.ts +9 -0
- package/dist/modal/index.d.ts +8 -0
- package/dist/modal/index.js +2 -0
- package/dist/modal/types.d.ts +92 -0
- package/dist/modal/use-modal.d.ts +2 -0
- package/dist/modal-YVolL7Hz.js +221 -0
- package/dist/navigation/CollapseButton.vue.d.ts +12 -0
- package/dist/navigation/NavFooter.vue.d.ts +15 -0
- package/dist/navigation/NavHeader.vue.d.ts +13 -0
- package/dist/navigation/NavItem.d.ts +177 -0
- package/dist/navigation/Navigation.vue.d.ts +29 -0
- package/dist/navigation/NavigationContextProvider.d.ts +16 -0
- package/dist/navigation/NavigationIconRenderer.d.ts +45 -0
- package/dist/navigation/NavigationItemTree.vue.d.ts +8 -0
- package/dist/navigation/NavigationNodeRenderer.d.ts +18 -0
- package/dist/navigation/SubNav.vue.d.ts +18 -0
- package/dist/navigation/index.d.ts +14 -0
- package/dist/navigation/index.js +2 -0
- package/dist/navigation/navigation-context.d.ts +35 -0
- package/dist/navigation/types.d.ts +177 -0
- package/dist/navigation-DF8R5jFK.js +1479 -0
- package/dist/notification/NotificationHost.vue.d.ts +7 -0
- package/dist/notification/NotificationNodeRenderer.d.ts +15 -0
- package/dist/notification/NotificationNotice.vue.d.ts +16 -0
- package/dist/notification/imperative.d.ts +12 -0
- package/dist/notification/index.d.ts +6 -0
- package/dist/notification/index.js +2 -0
- package/dist/notification/notification-store.d.ts +24 -0
- package/dist/notification/types.d.ts +63 -0
- package/dist/notification/use-notification.d.ts +2 -0
- package/dist/notification-DIsvgiIO.js +445 -0
- package/dist/overflow-list/OverflowList.vue.d.ts +131 -0
- package/dist/overflow-list/OverflowListNodeRenderer.d.ts +35 -0
- package/dist/overflow-list/index.d.ts +5 -0
- package/dist/overflow-list/index.js +2 -0
- package/dist/overflow-list/types.d.ts +35 -0
- package/dist/overflow-list-Df6ixrtB.js +413 -0
- package/dist/pagination/Pagination.vue.d.ts +25 -0
- package/dist/pagination/PaginationNodeRenderer.d.ts +15 -0
- package/dist/pagination/PaginationPopover.vue.d.ts +25 -0
- package/dist/pagination/PaginationRestList.vue.d.ts +11 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/index.js +2 -0
- package/dist/pagination/types.d.ts +46 -0
- package/dist/pin-code/PinCode.vue.d.ts +20 -0
- package/dist/pin-code/index.d.ts +10 -0
- package/dist/pin-code/index.js +2 -0
- package/dist/pin-code/types.d.ts +25 -0
- package/dist/pin-code-wY5g0KLD.js +193 -0
- package/dist/popconfirm/Popconfirm.vue.d.ts +25 -0
- package/dist/popconfirm/PopconfirmNodeRenderer.d.ts +15 -0
- package/dist/popconfirm/index.d.ts +4 -0
- package/dist/popconfirm/index.js +2 -0
- package/dist/popconfirm/types.d.ts +57 -0
- package/dist/popconfirm-DQUtvI0A.js +389 -0
- package/dist/popover/Popover.vue.d.ts +23 -0
- package/dist/popover/PopoverArrow.vue.d.ts +10 -0
- package/dist/popover/index.d.ts +4 -0
- package/dist/popover/index.js +2 -0
- package/dist/popover/types.d.ts +35 -0
- package/dist/popover-hD77YpUM.js +292 -0
- package/dist/progress/Progress.vue.d.ts +24 -0
- package/dist/progress/ProgressCircle.vue.d.ts +26 -0
- package/dist/progress/ProgressLine.vue.d.ts +23 -0
- package/dist/progress/ProgressNodeRenderer.d.ts +15 -0
- package/dist/progress/index.d.ts +6 -0
- package/dist/progress/index.js +2 -0
- package/dist/progress/types.d.ts +44 -0
- package/dist/progress-DIIyWKKD.js +9 -0
- package/dist/radio/Radio.vue.d.ts +30 -0
- package/dist/radio/RadioGroup.d.ts +201 -0
- package/dist/radio/RadioNodeRenderer.d.ts +15 -0
- package/dist/radio/index.d.ts +10 -0
- package/dist/radio/index.js +2 -0
- package/dist/radio/radio-context.d.ts +15 -0
- package/dist/radio/types.d.ts +100 -0
- package/dist/radio-y9iAI359.js +565 -0
- package/dist/rating/Rating.vue.d.ts +39 -0
- package/dist/rating/RatingItem.vue.d.ts +33 -0
- package/dist/rating/RatingNodeRenderer.d.ts +17 -0
- package/dist/rating/index.d.ts +6 -0
- package/dist/rating/index.js +2 -0
- package/dist/rating/types.d.ts +57 -0
- package/dist/rating-CJkb4pkD.js +542 -0
- package/dist/resizable/Resizable.vue.d.ts +31 -0
- package/dist/resizable/ResizableNodeRenderer.d.ts +17 -0
- package/dist/resizable/ResizeGroup.vue.d.ts +13 -0
- package/dist/resizable/ResizeHandler.vue.d.ts +11 -0
- package/dist/resizable/ResizeItem.vue.d.ts +19 -0
- package/dist/resizable/SingleResizeHandle.vue.d.ts +21 -0
- package/dist/resizable/index.d.ts +6 -0
- package/dist/resizable/index.js +2 -0
- package/dist/resizable/resizable-context.d.ts +27 -0
- package/dist/resizable/types.d.ts +87 -0
- package/dist/resizable/use-resize-group.d.ts +21 -0
- package/dist/resizable/use-single-resize.d.ts +30 -0
- package/dist/resizable-CEB0ZdGT.js +814 -0
- package/dist/scroll-list/ScrollItem.vue.d.ts +21 -0
- package/dist/scroll-list/ScrollList.vue.d.ts +11 -0
- package/dist/scroll-list/ScrollListNodeRenderer.d.ts +15 -0
- package/dist/scroll-list/index.d.ts +10 -0
- package/dist/scroll-list/index.js +2 -0
- package/dist/scroll-list/types.d.ts +54 -0
- package/dist/scroll-list-BSXksNOR.js +466 -0
- package/dist/select/Select.vue.d.ts +39 -0
- package/dist/select/SelectFragment.d.ts +4 -0
- package/dist/select/SelectNodeRenderer.d.ts +15 -0
- package/dist/select/SelectOption.vue.d.ts +13 -0
- package/dist/select/SelectOptionCollector.d.ts +13 -0
- package/dist/select/SelectOptionGroup.vue.d.ts +14 -0
- package/dist/select/index.d.ts +12 -0
- package/dist/select/index.js +3 -0
- package/dist/select/types.d.ts +165 -0
- package/dist/select/use-select-foundation.d.ts +64 -0
- package/dist/select-BeM6gxAU.js +40 -0
- package/dist/side-sheet/SideSheet.vue.d.ts +19 -0
- package/dist/side-sheet/SideSheetContent.vue.d.ts +37 -0
- package/dist/side-sheet/SideSheetNodeRenderer.d.ts +15 -0
- package/dist/side-sheet/index.d.ts +4 -0
- package/dist/side-sheet/index.js +2 -0
- package/dist/side-sheet/types.d.ts +46 -0
- package/dist/side-sheet-9CBTk23r.js +542 -0
- package/dist/skeleton/Skeleton.vue.d.ts +15 -0
- package/dist/skeleton/SkeletonAvatar.vue.d.ts +9 -0
- package/dist/skeleton/SkeletonButton.vue.d.ts +7 -0
- package/dist/skeleton/SkeletonImage.vue.d.ts +7 -0
- package/dist/skeleton/SkeletonNodeRenderer.d.ts +15 -0
- package/dist/skeleton/SkeletonParagraph.vue.d.ts +8 -0
- package/dist/skeleton/SkeletonTitle.vue.d.ts +7 -0
- package/dist/skeleton/index.d.ts +18 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/skeleton/types.d.ts +36 -0
- package/dist/skeleton-p61lfhoz.js +302 -0
- package/dist/slider/Slider.vue.d.ts +32 -0
- package/dist/slider/SliderFragment.d.ts +4 -0
- package/dist/slider/index.d.ts +5 -0
- package/dist/slider/index.js +5 -0
- package/dist/slider/types.d.ts +57 -0
- package/dist/slider/use-slider-foundation.d.ts +47 -0
- package/dist/space/Space.vue.d.ts +16 -0
- package/dist/space/index.d.ts +3 -0
- package/dist/space/index.js +2 -0
- package/dist/space/types.d.ts +15 -0
- package/dist/space-DVnFbkCz.js +63 -0
- package/dist/spin/Spin.vue.d.ts +105 -0
- package/dist/spin/SpinNodeRenderer.d.ts +15 -0
- package/dist/spin/index.d.ts +6 -0
- package/dist/spin/index.js +2 -0
- package/dist/spin/types.d.ts +20 -0
- package/dist/spin-D-1P0WMW.js +9 -0
- package/dist/src-DNBBthjO.js +490 -0
- package/dist/steps/Step.vue.d.ts +22 -0
- package/dist/steps/Steps.vue.d.ts +24 -0
- package/dist/steps/StepsNodeRenderer.d.ts +17 -0
- package/dist/steps/index.d.ts +9 -0
- package/dist/steps/index.js +2 -0
- package/dist/steps/steps-context.d.ts +6 -0
- package/dist/steps/types.d.ts +54 -0
- package/dist/steps-6p04q-Lz.js +303 -0
- package/dist/switch/Switch.vue.d.ts +27 -0
- package/dist/switch/SwitchNodeRenderer.d.ts +15 -0
- package/dist/switch/SwitchSpin.vue.d.ts +7 -0
- package/dist/switch/index.d.ts +7 -0
- package/dist/switch/index.js +2 -0
- package/dist/switch/types.d.ts +28 -0
- package/dist/switch-Dte2Fl3l.js +284 -0
- package/dist/table/Table.vue.d.ts +29 -0
- package/dist/table/TableBody.vue.d.ts +70 -0
- package/dist/table/TableCell.vue.d.ts +37 -0
- package/dist/table/TableColumn.d.ts +81 -0
- package/dist/table/TableFilterMenu.vue.d.ts +18 -0
- package/dist/table/TableHeader.vue.d.ts +46 -0
- package/dist/table/TableNativeElement.d.ts +9 -0
- package/dist/table/TableNodeRenderer.d.ts +13 -0
- package/dist/table/TableSpin.vue.d.ts +16 -0
- package/dist/table/index.d.ts +13 -0
- package/dist/table/index.js +2 -0
- package/dist/table/table-utils.d.ts +43 -0
- package/dist/table/types.d.ts +323 -0
- package/dist/table-jZkHjf-W.js +2097 -0
- package/dist/tabs/TabBar.vue.d.ts +38 -0
- package/dist/tabs/TabItem.vue.d.ts +26 -0
- package/dist/tabs/TabPane.vue.d.ts +13 -0
- package/dist/tabs/Tabs.vue.d.ts +36 -0
- package/dist/tabs/TabsDropdown.vue.d.ts +27 -0
- package/dist/tabs/TabsNodeRenderer.d.ts +15 -0
- package/dist/tabs/index.d.ts +6 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs-context.d.ts +12 -0
- package/dist/tabs/types.d.ts +110 -0
- package/dist/tabs-CezuYzIu.js +874 -0
- package/dist/tag/SplitTagGroup.d.ts +36 -0
- package/dist/tag/Tag.vue.d.ts +33 -0
- package/dist/tag/TagGroup.d.ts +115 -0
- package/dist/tag/TagNodeRenderer.d.ts +15 -0
- package/dist/tag/index.d.ts +8 -0
- package/dist/tag/index.js +2 -0
- package/dist/tag/types.d.ts +82 -0
- package/dist/tag-BPD0bELU.js +348 -0
- package/dist/tag-input/TagInput.vue.d.ts +51 -0
- package/dist/tag-input/TagInputNodeRenderer.d.ts +17 -0
- package/dist/tag-input/TagInputRestPopover.vue.d.ts +19 -0
- package/dist/tag-input/TagInputTag.vue.d.ts +27 -0
- package/dist/tag-input/index.d.ts +5 -0
- package/dist/tag-input/index.js +2 -0
- package/dist/tag-input/types.d.ts +95 -0
- package/dist/tag-input/use-tag-input-foundation.d.ts +47 -0
- package/dist/tag-input-SxUfNqF0.js +784 -0
- package/dist/time-picker/TimePicker.vue.d.ts +27 -0
- package/dist/time-picker/TimePickerColumn.vue.d.ts +29 -0
- package/dist/time-picker/TimePickerNodeRenderer.d.ts +17 -0
- package/dist/time-picker/TimePickerPanel.vue.d.ts +32 -0
- package/dist/time-picker/index.d.ts +5 -0
- package/dist/time-picker/index.js +2 -0
- package/dist/time-picker/types.d.ts +146 -0
- package/dist/time-picker/use-time-picker-foundation.d.ts +36 -0
- package/dist/time-picker-D6p36ea8.js +3587 -0
- package/dist/timeline/Timeline.vue.d.ts +69 -0
- package/dist/timeline/TimelineItem.vue.d.ts +100 -0
- package/dist/timeline/TimelineNodeRenderer.d.ts +15 -0
- package/dist/timeline/index.d.ts +10 -0
- package/dist/timeline/index.js +2 -0
- package/dist/timeline/types.d.ts +43 -0
- package/dist/timeline-2D5xCZsU.js +191 -0
- package/dist/toast/ToastHost.vue.d.ts +7 -0
- package/dist/toast/ToastIconRenderer.d.ts +17 -0
- package/dist/toast/ToastNodeRenderer.d.ts +15 -0
- package/dist/toast/ToastNotice.vue.d.ts +20 -0
- package/dist/toast/imperative.d.ts +3 -0
- package/dist/toast/index.d.ts +6 -0
- package/dist/toast/index.js +2 -0
- package/dist/toast/toast-store.d.ts +30 -0
- package/dist/toast/types.d.ts +65 -0
- package/dist/toast/use-toast.d.ts +2 -0
- package/dist/toast-s8nFLf8t.js +523 -0
- package/dist/tooltip/Tooltip.vue.d.ts +23 -0
- package/dist/tooltip/TooltipArrow.vue.d.ts +8 -0
- package/dist/tooltip/TooltipNodeRenderer.d.ts +15 -0
- package/dist/tooltip/TooltipPortal.vue.d.ts +44 -0
- package/dist/tooltip/TooltipTriggerRenderer.d.ts +66 -0
- package/dist/tooltip/index.d.ts +5 -0
- package/dist/tooltip/index.js +3 -0
- package/dist/tooltip/types.d.ts +117 -0
- package/dist/tooltip/use-tooltip-foundation.d.ts +25 -0
- package/dist/tooltip-en9bvXRp.js +28 -0
- package/dist/transfer/Transfer.vue.d.ts +35 -0
- package/dist/transfer/TransferNodeRenderer.d.ts +15 -0
- package/dist/transfer/index.d.ts +5 -0
- package/dist/transfer/index.js +2 -0
- package/dist/transfer/types.d.ts +159 -0
- package/dist/transfer-Doq1sI9z.js +695 -0
- package/dist/tree/Tree.vue.d.ts +73 -0
- package/dist/tree/TreeNode.vue.d.ts +77 -0
- package/dist/tree/TreeNodeMotion.vue.d.ts +20 -0
- package/dist/tree/TreeNodeRenderer.d.ts +15 -0
- package/dist/tree/index.d.ts +9 -0
- package/dist/tree/index.js +5 -0
- package/dist/tree/types.d.ts +180 -0
- package/dist/tree-select/TreeSelect.vue.d.ts +76 -0
- package/dist/tree-select/TreeSelectNodeRenderer.d.ts +15 -0
- package/dist/tree-select/index.d.ts +6 -0
- package/dist/tree-select/index.js +2 -0
- package/dist/tree-select/types.d.ts +156 -0
- package/dist/tree-select-BIu6Owuq.js +1237 -0
- package/dist/treeUtil-IUdRJ6Ws.js +277 -0
- package/dist/typography/Numeral.vue.d.ts +32 -0
- package/dist/typography/Paragraph.vue.d.ts +30 -0
- package/dist/typography/Text.vue.d.ts +30 -0
- package/dist/typography/Title.vue.d.ts +28 -0
- package/dist/typography/Typography.vue.d.ts +13 -0
- package/dist/typography/TypographyBase.vue.d.ts +40 -0
- package/dist/typography/TypographyCopyable.vue.d.ts +29 -0
- package/dist/typography/TypographyDecorations.d.ts +34 -0
- package/dist/typography/TypographyNodeRenderer.d.ts +17 -0
- package/dist/typography/index.d.ts +17 -0
- package/dist/typography/index.js +2 -0
- package/dist/typography/types.d.ts +108 -0
- package/dist/typography/typography-locale.d.ts +5 -0
- package/dist/typography/typography-utils.d.ts +4 -0
- package/dist/typography-DF8KwKuL.js +914 -0
- package/dist/upload/Upload.vue.d.ts +69 -0
- package/dist/upload/UploadFileCard.vue.d.ts +4 -0
- package/dist/upload/UploadNodeRenderer.d.ts +15 -0
- package/dist/upload/index.d.ts +10 -0
- package/dist/upload/index.js +2 -0
- package/dist/upload/types.d.ts +250 -0
- package/dist/upload-BzdpoGJX.js +1777 -0
- package/dist/uuid-BUHV1G8U.js +21 -0
- package/dist/warning-naSiE8G7.js +6 -0
- package/dist/zh-CN-CCu7YvUA.js +1623 -0
- package/package.json +336 -0
|
@@ -0,0 +1,2030 @@
|
|
|
1
|
+
import { n as e, r as t } from "./src-DNBBthjO.js";
|
|
2
|
+
import { C as n, F as r, M as i, O as a, c as o, g as s, h as c, j as l, p as u, s as d, t as f, v as p } from "./foundation-Cawx37mp.js";
|
|
3
|
+
import { t as m } from "./es-CAWQuPuV.js";
|
|
4
|
+
import { t as h } from "./date-picker-B2lhlKHD.js";
|
|
5
|
+
import { t as g } from "./time-picker-D6p36ea8.js";
|
|
6
|
+
import { t as _ } from "./cascader-Ch6clCeh.js";
|
|
7
|
+
import { t as v } from "./isPromise-D2v3Ejff.js";
|
|
8
|
+
import { n as y, t as b } from "./auto-complete-BeahBlt9.js";
|
|
9
|
+
import { n as x, t as S } from "./checkbox-mJD1ou6k.js";
|
|
10
|
+
import { n as C, r as ee, t as te } from "./input-wf0nZCRS.js";
|
|
11
|
+
import { t as ne } from "./pin-code-wY5g0KLD.js";
|
|
12
|
+
import { n as re, t as w } from "./radio-y9iAI359.js";
|
|
13
|
+
import { t as ie } from "./rating-CJkb4pkD.js";
|
|
14
|
+
import { t as ae } from "./SelectOption-Ce-Lst-e.js";
|
|
15
|
+
import { t as T } from "./switch-Dte2Fl3l.js";
|
|
16
|
+
import { t as oe } from "./tag-input-SxUfNqF0.js";
|
|
17
|
+
import { t as se } from "./tree-select-BIu6Owuq.js";
|
|
18
|
+
import { t as ce } from "./upload-BzdpoGJX.js";
|
|
19
|
+
import { t as le } from "./config-context-CyynTtDb.js";
|
|
20
|
+
import { InputNumber as E } from "./input-number/index.js";
|
|
21
|
+
import { n as ue, t as de } from "./select-BeM6gxAU.js";
|
|
22
|
+
import { Slider as fe } from "./slider/index.js";
|
|
23
|
+
import { n as D, t as pe } from "./grid-Cn2uBhRd.js";
|
|
24
|
+
import { Comment as me, Fragment as he, cloneVNode as ge, computed as O, createBlock as k, createCommentVNode as A, createElementBlock as j, createElementVNode as _e, createVNode as ve, defineComponent as M, getCurrentInstance as ye, guardReactiveProps as be, h as N, inject as P, isVNode as F, markRaw as xe, mergeProps as Se, normalizeClass as Ce, normalizeProps as we, normalizeStyle as Te, onBeforeUnmount as Ee, onMounted as De, openBlock as I, provide as Oe, reactive as ke, ref as L, renderSlot as R, resolveDynamicComponent as Ae, shallowRef as je, toDisplayString as Me, unref as z, useAttrs as Ne, useId as Pe, watch as Fe, withCtx as Ie } from "vue";
|
|
25
|
+
import { IconAlertCircle as Le, IconAlertTriangle as Re } from "@aifuxi/semi-icons-vue";
|
|
26
|
+
//#region bundled-foundation
|
|
27
|
+
var ze = (e) => {
|
|
28
|
+
let t = (0, a.default)(e);
|
|
29
|
+
return (0, c.default)(e) && t.length === 1 ? !1 : Number.isInteger(+t[t.length - 1]);
|
|
30
|
+
};
|
|
31
|
+
function Be(e) {
|
|
32
|
+
if ((0, s.default)(e)) {
|
|
33
|
+
let t = (0, i.default)(e);
|
|
34
|
+
return !t.length || t.every((e) => e === void 0);
|
|
35
|
+
}
|
|
36
|
+
return !1;
|
|
37
|
+
}
|
|
38
|
+
function Ve(e, t, n = !0) {
|
|
39
|
+
if (t.length === 0) return;
|
|
40
|
+
let r = (0, d.default)(e, t);
|
|
41
|
+
(Array.isArray(r) && r.length > 0 && r.every((e) => e == null) || Be(r)) && (0, l.default)(e, t), Ve(e, t.slice(0, t.length - 1), n);
|
|
42
|
+
}
|
|
43
|
+
function He(e) {
|
|
44
|
+
return (0, i.default)(e).length === 0;
|
|
45
|
+
}
|
|
46
|
+
function B(e, t) {
|
|
47
|
+
return (0, d.default)(e, t);
|
|
48
|
+
}
|
|
49
|
+
function Ue(e, t) {
|
|
50
|
+
(0, l.default)(e, t);
|
|
51
|
+
let n = (0, a.default)(t);
|
|
52
|
+
n = n.slice(0, n.length - 1), Ve(e, n, !1);
|
|
53
|
+
}
|
|
54
|
+
function We(e, t, r, i) {
|
|
55
|
+
if (i || r !== void 0) return (0, n.default)(e, t, r);
|
|
56
|
+
if (ze(t) && B(e, t) !== void 0) {
|
|
57
|
+
(0, n.default)(e, t, void 0);
|
|
58
|
+
let r = (0, a.default)(t);
|
|
59
|
+
r = r.slice(0, r.length - 1), Ve(e, r, !1);
|
|
60
|
+
} else !ze(t) && B(e, t) !== void 0 && Ue(e, t);
|
|
61
|
+
}
|
|
62
|
+
function Ge(e, t) {
|
|
63
|
+
return (0, o.default)(e, t);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region ../../node_modules/.pnpm/async-validator@3.5.2/node_modules/async-validator/dist-web/index.js
|
|
67
|
+
function V() {
|
|
68
|
+
return V = Object.assign || function(e) {
|
|
69
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
70
|
+
var n = arguments[t];
|
|
71
|
+
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
72
|
+
}
|
|
73
|
+
return e;
|
|
74
|
+
}, V.apply(this, arguments);
|
|
75
|
+
}
|
|
76
|
+
function Ke(e, t) {
|
|
77
|
+
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, H(e, t);
|
|
78
|
+
}
|
|
79
|
+
function qe(e) {
|
|
80
|
+
return qe = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
|
|
81
|
+
return e.__proto__ || Object.getPrototypeOf(e);
|
|
82
|
+
}, qe(e);
|
|
83
|
+
}
|
|
84
|
+
function H(e, t) {
|
|
85
|
+
return H = Object.setPrototypeOf || function(e, t) {
|
|
86
|
+
return e.__proto__ = t, e;
|
|
87
|
+
}, H(e, t);
|
|
88
|
+
}
|
|
89
|
+
function Je() {
|
|
90
|
+
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
|
|
91
|
+
if (typeof Proxy == "function") return !0;
|
|
92
|
+
try {
|
|
93
|
+
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0;
|
|
94
|
+
} catch {
|
|
95
|
+
return !1;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function Ye(e, t, n) {
|
|
99
|
+
return Ye = Je() ? Reflect.construct : function(e, t, n) {
|
|
100
|
+
var r = [null];
|
|
101
|
+
r.push.apply(r, t);
|
|
102
|
+
var i = new (Function.bind.apply(e, r))();
|
|
103
|
+
return n && H(i, n.prototype), i;
|
|
104
|
+
}, Ye.apply(null, arguments);
|
|
105
|
+
}
|
|
106
|
+
function Xe(e) {
|
|
107
|
+
return Function.toString.call(e).indexOf("[native code]") !== -1;
|
|
108
|
+
}
|
|
109
|
+
function Ze(e) {
|
|
110
|
+
var t = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
111
|
+
return Ze = function(e) {
|
|
112
|
+
if (e === null || !Xe(e)) return e;
|
|
113
|
+
if (typeof e != "function") throw TypeError("Super expression must either be null or a function");
|
|
114
|
+
if (t !== void 0) {
|
|
115
|
+
if (t.has(e)) return t.get(e);
|
|
116
|
+
t.set(e, n);
|
|
117
|
+
}
|
|
118
|
+
function n() {
|
|
119
|
+
return Ye(e, arguments, qe(this).constructor);
|
|
120
|
+
}
|
|
121
|
+
return n.prototype = Object.create(e.prototype, { constructor: {
|
|
122
|
+
value: n,
|
|
123
|
+
enumerable: !1,
|
|
124
|
+
writable: !0,
|
|
125
|
+
configurable: !0
|
|
126
|
+
} }), H(n, e);
|
|
127
|
+
}, Ze(e);
|
|
128
|
+
}
|
|
129
|
+
var Qe = /%[sdj%]/g, $e = function() {};
|
|
130
|
+
typeof process < "u" && process.env && process.env.NODE_ENV !== "production" && typeof window < "u" && typeof document < "u" && ($e = function(e, t) {
|
|
131
|
+
typeof console < "u" && console.warn && t.every(function(e) {
|
|
132
|
+
return typeof e == "string";
|
|
133
|
+
}) && console.warn(e, t);
|
|
134
|
+
});
|
|
135
|
+
function et(e) {
|
|
136
|
+
if (!e || !e.length) return null;
|
|
137
|
+
var t = {};
|
|
138
|
+
return e.forEach(function(e) {
|
|
139
|
+
var n = e.field;
|
|
140
|
+
t[n] = t[n] || [], t[n].push(e);
|
|
141
|
+
}), t;
|
|
142
|
+
}
|
|
143
|
+
function U() {
|
|
144
|
+
var e = [...arguments], t = 1, n = e[0], r = e.length;
|
|
145
|
+
return typeof n == "function" ? n.apply(null, e.slice(1)) : typeof n == "string" ? String(n).replace(Qe, function(n) {
|
|
146
|
+
if (n === "%%") return "%";
|
|
147
|
+
if (t >= r) return n;
|
|
148
|
+
switch (n) {
|
|
149
|
+
case "%s": return String(e[t++]);
|
|
150
|
+
case "%d": return Number(e[t++]);
|
|
151
|
+
case "%j": try {
|
|
152
|
+
return JSON.stringify(e[t++]);
|
|
153
|
+
} catch {
|
|
154
|
+
return "[Circular]";
|
|
155
|
+
}
|
|
156
|
+
default: return n;
|
|
157
|
+
}
|
|
158
|
+
}) : n;
|
|
159
|
+
}
|
|
160
|
+
function tt(e) {
|
|
161
|
+
return e === "string" || e === "url" || e === "hex" || e === "email" || e === "date" || e === "pattern";
|
|
162
|
+
}
|
|
163
|
+
function W(e, t) {
|
|
164
|
+
return !!(e == null || t === "array" && Array.isArray(e) && !e.length || tt(t) && typeof e == "string" && !e);
|
|
165
|
+
}
|
|
166
|
+
function nt(e, t, n) {
|
|
167
|
+
var r = [], i = 0, a = e.length;
|
|
168
|
+
function o(e) {
|
|
169
|
+
r.push.apply(r, e), i++, i === a && n(r);
|
|
170
|
+
}
|
|
171
|
+
e.forEach(function(e) {
|
|
172
|
+
t(e, o);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function rt(e, t, n) {
|
|
176
|
+
var r = 0, i = e.length;
|
|
177
|
+
function a(o) {
|
|
178
|
+
if (o && o.length) {
|
|
179
|
+
n(o);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
var s = r;
|
|
183
|
+
r += 1, s < i ? t(e[s], a) : n([]);
|
|
184
|
+
}
|
|
185
|
+
a([]);
|
|
186
|
+
}
|
|
187
|
+
function it(e) {
|
|
188
|
+
var t = [];
|
|
189
|
+
return Object.keys(e).forEach(function(n) {
|
|
190
|
+
t.push.apply(t, e[n]);
|
|
191
|
+
}), t;
|
|
192
|
+
}
|
|
193
|
+
var at = /*#__PURE__*/ function(e) {
|
|
194
|
+
Ke(t, e);
|
|
195
|
+
function t(t, n) {
|
|
196
|
+
var r = e.call(this, "Async Validation Error") || this;
|
|
197
|
+
return r.errors = t, r.fields = n, r;
|
|
198
|
+
}
|
|
199
|
+
return t;
|
|
200
|
+
}(/*#__PURE__*/ Ze(Error));
|
|
201
|
+
function ot(e, t, n, r) {
|
|
202
|
+
if (t.first) {
|
|
203
|
+
var i = new Promise(function(t, i) {
|
|
204
|
+
rt(it(e), n, function(e) {
|
|
205
|
+
return r(e), e.length ? i(new at(e, et(e))) : t();
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
return i.catch(function(e) {
|
|
209
|
+
return e;
|
|
210
|
+
}), i;
|
|
211
|
+
}
|
|
212
|
+
var a = t.firstFields || [];
|
|
213
|
+
a === !0 && (a = Object.keys(e));
|
|
214
|
+
var o = Object.keys(e), s = o.length, c = 0, l = [], u = new Promise(function(t, i) {
|
|
215
|
+
var u = function(e) {
|
|
216
|
+
if (l.push.apply(l, e), c++, c === s) return r(l), l.length ? i(new at(l, et(l))) : t();
|
|
217
|
+
};
|
|
218
|
+
o.length || (r(l), t()), o.forEach(function(t) {
|
|
219
|
+
var r = e[t];
|
|
220
|
+
a.indexOf(t) === -1 ? nt(r, n, u) : rt(r, n, u);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
return u.catch(function(e) {
|
|
224
|
+
return e;
|
|
225
|
+
}), u;
|
|
226
|
+
}
|
|
227
|
+
function st(e) {
|
|
228
|
+
return function(t) {
|
|
229
|
+
return t && t.message ? (t.field = t.field || e.fullField, t) : {
|
|
230
|
+
message: typeof t == "function" ? t() : t,
|
|
231
|
+
field: t.field || e.fullField
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function ct(e, t) {
|
|
236
|
+
if (t) {
|
|
237
|
+
for (var n in t) if (t.hasOwnProperty(n)) {
|
|
238
|
+
var r = t[n];
|
|
239
|
+
e[n] = typeof r == "object" && typeof e[n] == "object" ? V({}, e[n], r) : r;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return e;
|
|
243
|
+
}
|
|
244
|
+
function lt(e, t, n, r, i, a) {
|
|
245
|
+
e.required && (!n.hasOwnProperty(e.field) || W(t, a || e.type)) && r.push(U(i.messages.required, e.fullField));
|
|
246
|
+
}
|
|
247
|
+
function ut(e, t, n, r, i) {
|
|
248
|
+
(/^\s+$/.test(t) || t === "") && r.push(U(i.messages.whitespace, e.fullField));
|
|
249
|
+
}
|
|
250
|
+
var dt = {
|
|
251
|
+
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
252
|
+
url: /* @__PURE__ */ RegExp("^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$", "i"),
|
|
253
|
+
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
254
|
+
}, G = {
|
|
255
|
+
integer: function(e) {
|
|
256
|
+
return G.number(e) && parseInt(e, 10) === e;
|
|
257
|
+
},
|
|
258
|
+
float: function(e) {
|
|
259
|
+
return G.number(e) && !G.integer(e);
|
|
260
|
+
},
|
|
261
|
+
array: function(e) {
|
|
262
|
+
return Array.isArray(e);
|
|
263
|
+
},
|
|
264
|
+
regexp: function(e) {
|
|
265
|
+
if (e instanceof RegExp) return !0;
|
|
266
|
+
try {
|
|
267
|
+
return !!new RegExp(e);
|
|
268
|
+
} catch {
|
|
269
|
+
return !1;
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
date: function(e) {
|
|
273
|
+
return typeof e.getTime == "function" && typeof e.getMonth == "function" && typeof e.getYear == "function" && !isNaN(e.getTime());
|
|
274
|
+
},
|
|
275
|
+
number: function(e) {
|
|
276
|
+
return !isNaN(e) && typeof e == "number";
|
|
277
|
+
},
|
|
278
|
+
object: function(e) {
|
|
279
|
+
return typeof e == "object" && !G.array(e);
|
|
280
|
+
},
|
|
281
|
+
method: function(e) {
|
|
282
|
+
return typeof e == "function";
|
|
283
|
+
},
|
|
284
|
+
email: function(e) {
|
|
285
|
+
return typeof e == "string" && !!e.match(dt.email) && e.length < 255;
|
|
286
|
+
},
|
|
287
|
+
url: function(e) {
|
|
288
|
+
return typeof e == "string" && !!e.match(dt.url);
|
|
289
|
+
},
|
|
290
|
+
hex: function(e) {
|
|
291
|
+
return typeof e == "string" && !!e.match(dt.hex);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
function ft(e, t, n, r, i) {
|
|
295
|
+
if (e.required && t === void 0) {
|
|
296
|
+
lt(e, t, n, r, i);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
var a = [
|
|
300
|
+
"integer",
|
|
301
|
+
"float",
|
|
302
|
+
"array",
|
|
303
|
+
"regexp",
|
|
304
|
+
"object",
|
|
305
|
+
"method",
|
|
306
|
+
"email",
|
|
307
|
+
"number",
|
|
308
|
+
"date",
|
|
309
|
+
"url",
|
|
310
|
+
"hex"
|
|
311
|
+
], o = e.type;
|
|
312
|
+
a.indexOf(o) > -1 ? G[o](t) || r.push(U(i.messages.types[o], e.fullField, e.type)) : o && typeof t !== e.type && r.push(U(i.messages.types[o], e.fullField, e.type));
|
|
313
|
+
}
|
|
314
|
+
function pt(e, t, n, r, i) {
|
|
315
|
+
var a = typeof e.len == "number", o = typeof e.min == "number", s = typeof e.max == "number", c = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, l = t, u = null, d = typeof t == "number", f = typeof t == "string", p = Array.isArray(t);
|
|
316
|
+
if (d ? u = "number" : f ? u = "string" : p && (u = "array"), !u) return !1;
|
|
317
|
+
p && (l = t.length), f && (l = t.replace(c, "_").length), a ? l !== e.len && r.push(U(i.messages[u].len, e.fullField, e.len)) : o && !s && l < e.min ? r.push(U(i.messages[u].min, e.fullField, e.min)) : s && !o && l > e.max ? r.push(U(i.messages[u].max, e.fullField, e.max)) : o && s && (l < e.min || l > e.max) && r.push(U(i.messages[u].range, e.fullField, e.min, e.max));
|
|
318
|
+
}
|
|
319
|
+
var K = "enum";
|
|
320
|
+
function mt(e, t, n, r, i) {
|
|
321
|
+
e[K] = Array.isArray(e[K]) ? e[K] : [], e[K].indexOf(t) === -1 && r.push(U(i.messages[K], e.fullField, e[K].join(", ")));
|
|
322
|
+
}
|
|
323
|
+
function ht(e, t, n, r, i) {
|
|
324
|
+
e.pattern && (e.pattern instanceof RegExp ? (e.pattern.lastIndex = 0, e.pattern.test(t) || r.push(U(i.messages.pattern.mismatch, e.fullField, t, e.pattern))) : typeof e.pattern == "string" && (new RegExp(e.pattern).test(t) || r.push(U(i.messages.pattern.mismatch, e.fullField, t, e.pattern))));
|
|
325
|
+
}
|
|
326
|
+
var q = {
|
|
327
|
+
required: lt,
|
|
328
|
+
whitespace: ut,
|
|
329
|
+
type: ft,
|
|
330
|
+
range: pt,
|
|
331
|
+
enum: mt,
|
|
332
|
+
pattern: ht
|
|
333
|
+
};
|
|
334
|
+
function gt(e, t, n, r, i) {
|
|
335
|
+
var a = [];
|
|
336
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
337
|
+
if (W(t, "string") && !e.required) return n();
|
|
338
|
+
q.required(e, t, r, a, i, "string"), W(t, "string") || (q.type(e, t, r, a, i), q.range(e, t, r, a, i), q.pattern(e, t, r, a, i), e.whitespace === !0 && q.whitespace(e, t, r, a, i));
|
|
339
|
+
}
|
|
340
|
+
n(a);
|
|
341
|
+
}
|
|
342
|
+
function _t(e, t, n, r, i) {
|
|
343
|
+
var a = [];
|
|
344
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
345
|
+
if (W(t) && !e.required) return n();
|
|
346
|
+
q.required(e, t, r, a, i), t !== void 0 && q.type(e, t, r, a, i);
|
|
347
|
+
}
|
|
348
|
+
n(a);
|
|
349
|
+
}
|
|
350
|
+
function vt(e, t, n, r, i) {
|
|
351
|
+
var a = [];
|
|
352
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
353
|
+
if (t === "" && (t = void 0), W(t) && !e.required) return n();
|
|
354
|
+
q.required(e, t, r, a, i), t !== void 0 && (q.type(e, t, r, a, i), q.range(e, t, r, a, i));
|
|
355
|
+
}
|
|
356
|
+
n(a);
|
|
357
|
+
}
|
|
358
|
+
function yt(e, t, n, r, i) {
|
|
359
|
+
var a = [];
|
|
360
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
361
|
+
if (W(t) && !e.required) return n();
|
|
362
|
+
q.required(e, t, r, a, i), t !== void 0 && q.type(e, t, r, a, i);
|
|
363
|
+
}
|
|
364
|
+
n(a);
|
|
365
|
+
}
|
|
366
|
+
function bt(e, t, n, r, i) {
|
|
367
|
+
var a = [];
|
|
368
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
369
|
+
if (W(t) && !e.required) return n();
|
|
370
|
+
q.required(e, t, r, a, i), W(t) || q.type(e, t, r, a, i);
|
|
371
|
+
}
|
|
372
|
+
n(a);
|
|
373
|
+
}
|
|
374
|
+
function xt(e, t, n, r, i) {
|
|
375
|
+
var a = [];
|
|
376
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
377
|
+
if (W(t) && !e.required) return n();
|
|
378
|
+
q.required(e, t, r, a, i), t !== void 0 && (q.type(e, t, r, a, i), q.range(e, t, r, a, i));
|
|
379
|
+
}
|
|
380
|
+
n(a);
|
|
381
|
+
}
|
|
382
|
+
function St(e, t, n, r, i) {
|
|
383
|
+
var a = [];
|
|
384
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
385
|
+
if (W(t) && !e.required) return n();
|
|
386
|
+
q.required(e, t, r, a, i), t !== void 0 && (q.type(e, t, r, a, i), q.range(e, t, r, a, i));
|
|
387
|
+
}
|
|
388
|
+
n(a);
|
|
389
|
+
}
|
|
390
|
+
function Ct(e, t, n, r, i) {
|
|
391
|
+
var a = [];
|
|
392
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
393
|
+
if (t == null && !e.required) return n();
|
|
394
|
+
q.required(e, t, r, a, i, "array"), t != null && (q.type(e, t, r, a, i), q.range(e, t, r, a, i));
|
|
395
|
+
}
|
|
396
|
+
n(a);
|
|
397
|
+
}
|
|
398
|
+
function wt(e, t, n, r, i) {
|
|
399
|
+
var a = [];
|
|
400
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
401
|
+
if (W(t) && !e.required) return n();
|
|
402
|
+
q.required(e, t, r, a, i), t !== void 0 && q.type(e, t, r, a, i);
|
|
403
|
+
}
|
|
404
|
+
n(a);
|
|
405
|
+
}
|
|
406
|
+
var Tt = "enum";
|
|
407
|
+
function Et(e, t, n, r, i) {
|
|
408
|
+
var a = [];
|
|
409
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
410
|
+
if (W(t) && !e.required) return n();
|
|
411
|
+
q.required(e, t, r, a, i), t !== void 0 && q[Tt](e, t, r, a, i);
|
|
412
|
+
}
|
|
413
|
+
n(a);
|
|
414
|
+
}
|
|
415
|
+
function Dt(e, t, n, r, i) {
|
|
416
|
+
var a = [];
|
|
417
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
418
|
+
if (W(t, "string") && !e.required) return n();
|
|
419
|
+
q.required(e, t, r, a, i), W(t, "string") || q.pattern(e, t, r, a, i);
|
|
420
|
+
}
|
|
421
|
+
n(a);
|
|
422
|
+
}
|
|
423
|
+
function Ot(e, t, n, r, i) {
|
|
424
|
+
var a = [];
|
|
425
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
426
|
+
if (W(t, "date") && !e.required) return n();
|
|
427
|
+
if (q.required(e, t, r, a, i), !W(t, "date")) {
|
|
428
|
+
var o = t instanceof Date ? t : new Date(t);
|
|
429
|
+
q.type(e, o, r, a, i), o && q.range(e, o.getTime(), r, a, i);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
n(a);
|
|
433
|
+
}
|
|
434
|
+
function kt(e, t, n, r, i) {
|
|
435
|
+
var a = [], o = Array.isArray(t) ? "array" : typeof t;
|
|
436
|
+
q.required(e, t, r, a, i, o), n(a);
|
|
437
|
+
}
|
|
438
|
+
function At(e, t, n, r, i) {
|
|
439
|
+
var a = e.type, o = [];
|
|
440
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
441
|
+
if (W(t, a) && !e.required) return n();
|
|
442
|
+
q.required(e, t, r, o, i, a), W(t, a) || q.type(e, t, r, o, i);
|
|
443
|
+
}
|
|
444
|
+
n(o);
|
|
445
|
+
}
|
|
446
|
+
function jt(e, t, n, r, i) {
|
|
447
|
+
var a = [];
|
|
448
|
+
if (e.required || !e.required && r.hasOwnProperty(e.field)) {
|
|
449
|
+
if (W(t) && !e.required) return n();
|
|
450
|
+
q.required(e, t, r, a, i);
|
|
451
|
+
}
|
|
452
|
+
n(a);
|
|
453
|
+
}
|
|
454
|
+
var J = {
|
|
455
|
+
string: gt,
|
|
456
|
+
method: _t,
|
|
457
|
+
number: vt,
|
|
458
|
+
boolean: yt,
|
|
459
|
+
regexp: bt,
|
|
460
|
+
integer: xt,
|
|
461
|
+
float: St,
|
|
462
|
+
array: Ct,
|
|
463
|
+
object: wt,
|
|
464
|
+
enum: Et,
|
|
465
|
+
pattern: Dt,
|
|
466
|
+
date: Ot,
|
|
467
|
+
url: At,
|
|
468
|
+
hex: At,
|
|
469
|
+
email: At,
|
|
470
|
+
required: kt,
|
|
471
|
+
any: jt
|
|
472
|
+
};
|
|
473
|
+
function Mt() {
|
|
474
|
+
return {
|
|
475
|
+
default: "Validation error on field %s",
|
|
476
|
+
required: "%s is required",
|
|
477
|
+
enum: "%s must be one of %s",
|
|
478
|
+
whitespace: "%s cannot be empty",
|
|
479
|
+
date: {
|
|
480
|
+
format: "%s date %s is invalid for format %s",
|
|
481
|
+
parse: "%s date could not be parsed, %s is invalid ",
|
|
482
|
+
invalid: "%s date %s is invalid"
|
|
483
|
+
},
|
|
484
|
+
types: {
|
|
485
|
+
string: "%s is not a %s",
|
|
486
|
+
method: "%s is not a %s (function)",
|
|
487
|
+
array: "%s is not an %s",
|
|
488
|
+
object: "%s is not an %s",
|
|
489
|
+
number: "%s is not a %s",
|
|
490
|
+
date: "%s is not a %s",
|
|
491
|
+
boolean: "%s is not a %s",
|
|
492
|
+
integer: "%s is not an %s",
|
|
493
|
+
float: "%s is not a %s",
|
|
494
|
+
regexp: "%s is not a valid %s",
|
|
495
|
+
email: "%s is not a valid %s",
|
|
496
|
+
url: "%s is not a valid %s",
|
|
497
|
+
hex: "%s is not a valid %s"
|
|
498
|
+
},
|
|
499
|
+
string: {
|
|
500
|
+
len: "%s must be exactly %s characters",
|
|
501
|
+
min: "%s must be at least %s characters",
|
|
502
|
+
max: "%s cannot be longer than %s characters",
|
|
503
|
+
range: "%s must be between %s and %s characters"
|
|
504
|
+
},
|
|
505
|
+
number: {
|
|
506
|
+
len: "%s must equal %s",
|
|
507
|
+
min: "%s cannot be less than %s",
|
|
508
|
+
max: "%s cannot be greater than %s",
|
|
509
|
+
range: "%s must be between %s and %s"
|
|
510
|
+
},
|
|
511
|
+
array: {
|
|
512
|
+
len: "%s must be exactly %s in length",
|
|
513
|
+
min: "%s cannot be less than %s in length",
|
|
514
|
+
max: "%s cannot be greater than %s in length",
|
|
515
|
+
range: "%s must be between %s and %s in length"
|
|
516
|
+
},
|
|
517
|
+
pattern: { mismatch: "%s value %s does not match pattern %s" },
|
|
518
|
+
clone: function() {
|
|
519
|
+
var e = JSON.parse(JSON.stringify(this));
|
|
520
|
+
return e.clone = this.clone, e;
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
var Nt = Mt();
|
|
525
|
+
function Y(e) {
|
|
526
|
+
this.rules = null, this._messages = Nt, this.define(e);
|
|
527
|
+
}
|
|
528
|
+
Y.prototype = {
|
|
529
|
+
messages: function(e) {
|
|
530
|
+
return e && (this._messages = ct(Mt(), e)), this._messages;
|
|
531
|
+
},
|
|
532
|
+
define: function(e) {
|
|
533
|
+
if (!e) throw Error("Cannot configure a schema with no rules");
|
|
534
|
+
if (typeof e != "object" || Array.isArray(e)) throw Error("Rules must be an object");
|
|
535
|
+
this.rules = {};
|
|
536
|
+
var t, n;
|
|
537
|
+
for (t in e) e.hasOwnProperty(t) && (n = e[t], this.rules[t] = Array.isArray(n) ? n : [n]);
|
|
538
|
+
},
|
|
539
|
+
validate: function(e, t, n) {
|
|
540
|
+
var r = this;
|
|
541
|
+
t === void 0 && (t = {}), n === void 0 && (n = function() {});
|
|
542
|
+
var i = e, a = t, o = n;
|
|
543
|
+
if (typeof a == "function" && (o = a, a = {}), !this.rules || Object.keys(this.rules).length === 0) return o && o(), Promise.resolve();
|
|
544
|
+
function s(e) {
|
|
545
|
+
var t, n = [], r = {};
|
|
546
|
+
function i(e) {
|
|
547
|
+
if (Array.isArray(e)) {
|
|
548
|
+
var t;
|
|
549
|
+
n = (t = n).concat.apply(t, e);
|
|
550
|
+
} else n.push(e);
|
|
551
|
+
}
|
|
552
|
+
for (t = 0; t < e.length; t++) i(e[t]);
|
|
553
|
+
n.length ? r = et(n) : (n = null, r = null), o(n, r);
|
|
554
|
+
}
|
|
555
|
+
if (a.messages) {
|
|
556
|
+
var c = this.messages();
|
|
557
|
+
c === Nt && (c = Mt()), ct(c, a.messages), a.messages = c;
|
|
558
|
+
} else a.messages = this.messages();
|
|
559
|
+
var l, u, d = {};
|
|
560
|
+
(a.keys || Object.keys(this.rules)).forEach(function(t) {
|
|
561
|
+
l = r.rules[t], u = i[t], l.forEach(function(n) {
|
|
562
|
+
var a = n;
|
|
563
|
+
typeof a.transform == "function" && (i === e && (i = V({}, i)), u = i[t] = a.transform(u)), a = typeof a == "function" ? { validator: a } : V({}, a), a.validator = r.getValidationMethod(a), a.field = t, a.fullField = a.fullField || t, a.type = r.getType(a), a.validator && (d[t] = d[t] || [], d[t].push({
|
|
564
|
+
rule: a,
|
|
565
|
+
value: u,
|
|
566
|
+
source: i,
|
|
567
|
+
field: t
|
|
568
|
+
}));
|
|
569
|
+
});
|
|
570
|
+
});
|
|
571
|
+
var f = {};
|
|
572
|
+
return ot(d, a, function(e, t) {
|
|
573
|
+
var n = e.rule, r = (n.type === "object" || n.type === "array") && (typeof n.fields == "object" || typeof n.defaultField == "object");
|
|
574
|
+
r &&= n.required || !n.required && e.value, n.field = e.field;
|
|
575
|
+
function i(e, t) {
|
|
576
|
+
return V({}, t, { fullField: n.fullField + "." + e });
|
|
577
|
+
}
|
|
578
|
+
function o(o) {
|
|
579
|
+
o === void 0 && (o = []);
|
|
580
|
+
var s = o;
|
|
581
|
+
if (Array.isArray(s) || (s = [s]), !a.suppressWarning && s.length && Y.warning("async-validator:", s), s.length && n.message !== void 0 && (s = [].concat(n.message)), s = s.map(st(n)), a.first && s.length) return f[n.field] = 1, t(s);
|
|
582
|
+
if (!r) t(s);
|
|
583
|
+
else {
|
|
584
|
+
if (n.required && !e.value) return n.message === void 0 ? a.error && (s = [a.error(n, U(a.messages.required, n.field))]) : s = [].concat(n.message).map(st(n)), t(s);
|
|
585
|
+
var c = {};
|
|
586
|
+
if (n.defaultField) for (var l in e.value) e.value.hasOwnProperty(l) && (c[l] = n.defaultField);
|
|
587
|
+
for (var u in c = V({}, c, e.rule.fields), c) if (c.hasOwnProperty(u)) {
|
|
588
|
+
var d = Array.isArray(c[u]) ? c[u] : [c[u]];
|
|
589
|
+
c[u] = d.map(i.bind(null, u));
|
|
590
|
+
}
|
|
591
|
+
var p = new Y(c);
|
|
592
|
+
p.messages(a.messages), e.rule.options && (e.rule.options.messages = a.messages, e.rule.options.error = a.error), p.validate(e.value, e.rule.options || a, function(e) {
|
|
593
|
+
var n = [];
|
|
594
|
+
s && s.length && n.push.apply(n, s), e && e.length && n.push.apply(n, e), t(n.length ? n : null);
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
var s;
|
|
599
|
+
n.asyncValidator ? s = n.asyncValidator(n, e.value, o, e.source, a) : n.validator && (s = n.validator(n, e.value, o, e.source, a), s === !0 ? o() : s === !1 ? o(n.message || n.field + " fails") : s instanceof Array ? o(s) : s instanceof Error && o(s.message)), s && s.then && s.then(function() {
|
|
600
|
+
return o();
|
|
601
|
+
}, function(e) {
|
|
602
|
+
return o(e);
|
|
603
|
+
});
|
|
604
|
+
}, function(e) {
|
|
605
|
+
s(e);
|
|
606
|
+
});
|
|
607
|
+
},
|
|
608
|
+
getType: function(e) {
|
|
609
|
+
if (e.type === void 0 && e.pattern instanceof RegExp && (e.type = "pattern"), typeof e.validator != "function" && e.type && !J.hasOwnProperty(e.type)) throw Error(U("Unknown rule type %s", e.type));
|
|
610
|
+
return e.type || "string";
|
|
611
|
+
},
|
|
612
|
+
getValidationMethod: function(e) {
|
|
613
|
+
if (typeof e.validator == "function") return e.validator;
|
|
614
|
+
var t = Object.keys(e), n = t.indexOf("message");
|
|
615
|
+
return n !== -1 && t.splice(n, 1), t.length === 1 && t[0] === "required" ? J.required : J[this.getType(e)] || !1;
|
|
616
|
+
}
|
|
617
|
+
}, Y.register = function(e, t) {
|
|
618
|
+
if (typeof t != "function") throw Error("Cannot register a validator by type, validator is not a function");
|
|
619
|
+
J[e] = t;
|
|
620
|
+
}, Y.warning = $e, Y.messages = Nt, Y.validators = J;
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region bundled-foundation
|
|
623
|
+
function Pt(e) {
|
|
624
|
+
let t = !0;
|
|
625
|
+
return typeof e == "string" && e.length ? t = !1 : Array.isArray(e) && e.length ? t = e.every((e) => Pt(e)) : typeof e == "boolean" ? t = e : e && typeof e.$$typeof == "symbol" && e.$$typeof.toString() === "Symbol(react.element)" && (t = !1), t;
|
|
626
|
+
}
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region bundled-foundation
|
|
629
|
+
var Ft = class extends f {
|
|
630
|
+
constructor(e) {
|
|
631
|
+
super({ ...e });
|
|
632
|
+
let { initValues: t } = this._adapter.getProps();
|
|
633
|
+
t = this._adapter.cloneDeep(t), this.data = {
|
|
634
|
+
values: t || {},
|
|
635
|
+
errors: {},
|
|
636
|
+
touched: {}
|
|
637
|
+
}, this.fields = /* @__PURE__ */ new Map(), this.registered = {}, this.registeredArrayField = /* @__PURE__ */ new Map(), this.register = this.register.bind(this), this.unRegister = this.unRegister.bind(this), this.registerArrayField = this.registerArrayField.bind(this), this.unRegisterArrayField = this.unRegisterArrayField.bind(this), this.getArrayField = this.getArrayField.bind(this), this.updateArrayField = this.updateArrayField.bind(this), this.getField = this.getField.bind(this), this.setValues = this.setValues.bind(this), this.updateStateValue = this.updateStateValue.bind(this), this.updateStateError = this.updateStateError.bind(this), this.updateStateTouched = this.updateStateTouched.bind(this), this.getFormState = this.getFormState.bind(this), this.getValue = this.getValue.bind(this), this.getError = this.getError.bind(this), this.getTouched = this.getTouched.bind(this), this.getInitValues = this.getInitValues.bind(this), this.getInitValue = this.getInitValue.bind(this), this.getFormProps = this.getFormProps.bind(this), this.getFieldExist = this.getFieldExist.bind(this), this.scrollToField = this.scrollToField.bind(this), this.scrollToError = this.scrollToError.bind(this);
|
|
638
|
+
}
|
|
639
|
+
init() {
|
|
640
|
+
this._adapter.initFormId();
|
|
641
|
+
}
|
|
642
|
+
getField(e) {
|
|
643
|
+
return this.fields.get(e);
|
|
644
|
+
}
|
|
645
|
+
register(e, t, n) {
|
|
646
|
+
let r = this.registered[e];
|
|
647
|
+
if (this.registered[e] = !0, this.fields.set(e, n), n.keepState && r) {
|
|
648
|
+
let r = Ge(this.data.values, e), i = B(this.data.values, e), a = Ge(this.data.errors, e), o = B(this.data.errors, e), s = Ge(this.data.touched, e), c = B(this.data.touched, e), l = n.allowEmpty || !1, u = {
|
|
649
|
+
notNotify: !0,
|
|
650
|
+
notUpdate: !1,
|
|
651
|
+
fieldAllowEmpty: l
|
|
652
|
+
};
|
|
653
|
+
if (r) this.updateStateValue(e, i, u), n.fieldApi.setValue(i, {
|
|
654
|
+
...u,
|
|
655
|
+
notUpdate: !0
|
|
656
|
+
});
|
|
657
|
+
else {
|
|
658
|
+
let n = t.value;
|
|
659
|
+
!l && n === "" && (n = void 0), this.updateStateValue(e, n, u);
|
|
660
|
+
}
|
|
661
|
+
a && (this.updateStateError(e, o, u), n.fieldApi.setError(o, {
|
|
662
|
+
...u,
|
|
663
|
+
notUpdate: !0
|
|
664
|
+
})), s && (this.updateStateTouched(e, c, u), n.fieldApi.setTouched(c, {
|
|
665
|
+
...u,
|
|
666
|
+
notUpdate: !0
|
|
667
|
+
}));
|
|
668
|
+
} else {
|
|
669
|
+
let r = n.allowEmpty || !1, i = {
|
|
670
|
+
notNotify: !0,
|
|
671
|
+
notUpdate: !1,
|
|
672
|
+
fieldAllowEmpty: r
|
|
673
|
+
}, a = t.value;
|
|
674
|
+
!r && a === "" && (a = void 0), this.updateStateValue(e, a, i), t.error && this.updateStateError(e, t.error, i);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
unRegister(e) {
|
|
678
|
+
let t = this.fields.get(e);
|
|
679
|
+
try {
|
|
680
|
+
t.keepState || (Ue(this.data.values, e), Ue(this.data.errors, e), Ue(this.data.touched, e));
|
|
681
|
+
} catch {
|
|
682
|
+
console.error(`some thing wrong when unregister field:${e}`);
|
|
683
|
+
}
|
|
684
|
+
this.fields.delete(e), this._adapter.notifyChange(this.data), this._adapter.forceUpdate();
|
|
685
|
+
}
|
|
686
|
+
registerArrayField(e, t) {
|
|
687
|
+
this.updateArrayField(e, {
|
|
688
|
+
updateKey: (/* @__PURE__ */ new Date()).valueOf(),
|
|
689
|
+
initValue: t
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
unRegisterArrayField(e) {
|
|
693
|
+
this.registeredArrayField.delete(e);
|
|
694
|
+
}
|
|
695
|
+
getArrayField(e) {
|
|
696
|
+
return this.registeredArrayField.get(e);
|
|
697
|
+
}
|
|
698
|
+
updateArrayField(e, t) {
|
|
699
|
+
let n = {
|
|
700
|
+
...this.registeredArrayField.get(e),
|
|
701
|
+
...t
|
|
702
|
+
};
|
|
703
|
+
this.registeredArrayField.set(e, n);
|
|
704
|
+
}
|
|
705
|
+
validate(e) {
|
|
706
|
+
let t = this.getProps(), n = t.validator || t.validateFields, r, i = !1;
|
|
707
|
+
if (e && !Array.isArray(e)) {
|
|
708
|
+
let t = e;
|
|
709
|
+
r = t.fields, i = t.silent || !1;
|
|
710
|
+
} else r = e;
|
|
711
|
+
return n && (0, u.default)(n) ? this._formValidate(i) : this._fieldsValidate(r, i);
|
|
712
|
+
}
|
|
713
|
+
_formValidate(e = !1) {
|
|
714
|
+
let { values: t } = this.data, n = this.getProps(), r = n.validator || n.validateFields;
|
|
715
|
+
return new Promise((n, i) => {
|
|
716
|
+
let a;
|
|
717
|
+
try {
|
|
718
|
+
a = r(t);
|
|
719
|
+
} catch (e) {
|
|
720
|
+
a = e;
|
|
721
|
+
}
|
|
722
|
+
a ? v(a) ? a.then((r) => {
|
|
723
|
+
r ? (e || (this.data.errors = r, this._adapter.notifyChange(this.data), this.injectErrorToField(r), this._adapter.forceUpdate(), this._autoScroll(100)), i(r)) : (n(this._adapter.cloneDeep(t)), e || this.injectErrorToField({}));
|
|
724
|
+
}, (t) => {
|
|
725
|
+
e || this._autoScroll(100), i(t);
|
|
726
|
+
}) : (e || (this.data.errors = a, this.injectErrorToField(a), this._adapter.notifyChange(this.data), this._adapter.forceUpdate(), this._autoScroll(100)), i(a)) : (n(this._adapter.cloneDeep(t)), e || this.injectErrorToField({}));
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
_fieldsValidate(e, t = !1) {
|
|
730
|
+
let { values: n } = this.data;
|
|
731
|
+
return new Promise((r, i) => {
|
|
732
|
+
let a = [], o = this._getOperateFieldMap(e);
|
|
733
|
+
o.forEach((e, n) => {
|
|
734
|
+
let r = this.getValue(n), i = {
|
|
735
|
+
notNotify: !0,
|
|
736
|
+
notUpdate: !0,
|
|
737
|
+
silent: t
|
|
738
|
+
}, o = e.fieldApi.validate(r, i);
|
|
739
|
+
a.push(o), t || e.fieldApi.setTouched(!0, {
|
|
740
|
+
notNotify: !0,
|
|
741
|
+
notUpdate: !0
|
|
742
|
+
});
|
|
743
|
+
}), Promise.all(a).then(() => {
|
|
744
|
+
t || (this._adapter.notifyChange(this.data), this._adapter.forceUpdate());
|
|
745
|
+
let e = this.getError();
|
|
746
|
+
this._isValid(o) ? r(this._adapter.cloneDeep(n)) : (t || this._autoScroll(), i(e));
|
|
747
|
+
});
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
submit(e) {
|
|
751
|
+
let { values: t } = this.data;
|
|
752
|
+
this.validate().then((t) => {
|
|
753
|
+
let n = this._adapter.cloneDeep(t);
|
|
754
|
+
this._adapter.notifySubmit(n, e);
|
|
755
|
+
}).catch((n) => {
|
|
756
|
+
let r = this._adapter.cloneDeep(n), i = this._adapter.cloneDeep(t);
|
|
757
|
+
this._adapter.notifySubmitFail(r, i, e);
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
_getNestedField(e) {
|
|
761
|
+
let t = this.fields, n = [...t].map((e) => e[0]), r = /* @__PURE__ */ new Map();
|
|
762
|
+
return n.forEach((n) => {
|
|
763
|
+
let i = (0, a.default)(n), o = (0, a.default)(e);
|
|
764
|
+
if (o.every((e, t) => o[t] === i[t])) {
|
|
765
|
+
let e = t.get(n);
|
|
766
|
+
r.set(n, e);
|
|
767
|
+
}
|
|
768
|
+
}), r;
|
|
769
|
+
}
|
|
770
|
+
_getOperateFieldMap(e) {
|
|
771
|
+
let t = /* @__PURE__ */ new Map();
|
|
772
|
+
return (0, p.default)(e) ? t = this.fields : e.forEach((e) => {
|
|
773
|
+
let n = this.fields.get(e);
|
|
774
|
+
if ((0, p.default)(n)) {
|
|
775
|
+
let n = this._getNestedField(e);
|
|
776
|
+
t = new Map([...t, ...n]);
|
|
777
|
+
} else t.set(e, n);
|
|
778
|
+
}), t;
|
|
779
|
+
}
|
|
780
|
+
reset(e) {
|
|
781
|
+
this._getOperateFieldMap(e).forEach((e) => {
|
|
782
|
+
e.fieldApi.reset();
|
|
783
|
+
}), this.registeredArrayField.size && this._resetArrayField(), this._adapter.notifyChange(this.data), this._adapter.forceUpdate(), this._adapter.notifyReset();
|
|
784
|
+
}
|
|
785
|
+
_resetArrayField() {
|
|
786
|
+
[...this.registeredArrayField.keys()].forEach((e) => {
|
|
787
|
+
let t = this.registeredArrayField.get(e).initValue;
|
|
788
|
+
this.updateStateValue(e, t, {
|
|
789
|
+
notNotify: !0,
|
|
790
|
+
notUpdate: !0
|
|
791
|
+
}), this.updateArrayField(e, { updateKey: (/* @__PURE__ */ new Date()).valueOf() });
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
injectErrorToField(e) {
|
|
795
|
+
this.fields.forEach((t) => {
|
|
796
|
+
let n = B(e, t.field);
|
|
797
|
+
t.fieldApi.setError(n, {
|
|
798
|
+
notNotify: !0,
|
|
799
|
+
notUpdate: !0
|
|
800
|
+
});
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
getValue(e, t) {
|
|
804
|
+
let n = e === void 0, r = t && t.needClone, i, a;
|
|
805
|
+
switch (!0) {
|
|
806
|
+
case !n && !r:
|
|
807
|
+
i = B(this.data.values, e);
|
|
808
|
+
break;
|
|
809
|
+
case !n && r:
|
|
810
|
+
a = B(this.data.values, e), i = this._adapter.cloneDeep(a);
|
|
811
|
+
break;
|
|
812
|
+
case n && !r:
|
|
813
|
+
i = { ...this.data.values };
|
|
814
|
+
break;
|
|
815
|
+
case n && r: i = this._adapter.cloneDeep(this.data.values);
|
|
816
|
+
}
|
|
817
|
+
return i;
|
|
818
|
+
}
|
|
819
|
+
setValues(e, { isOverride: t = !1 }) {
|
|
820
|
+
let n = this._adapter.cloneDeep(e);
|
|
821
|
+
this.fields.forEach((e) => {
|
|
822
|
+
let t = B(n, e.field);
|
|
823
|
+
e.fieldApi.setValue(t, {
|
|
824
|
+
notNotify: !0,
|
|
825
|
+
notUpdate: !0
|
|
826
|
+
});
|
|
827
|
+
}), this.registeredArrayField.size && [...this.registeredArrayField.keys()].forEach((e) => {
|
|
828
|
+
this.updateArrayField(e, { updateKey: (/* @__PURE__ */ new Date()).valueOf() });
|
|
829
|
+
}), t && (this.data.values = n), this._adapter.notifyChange(this.data), this._adapter.notifyValueChange(this.data.values, { ...e }), this._adapter.forceUpdate();
|
|
830
|
+
}
|
|
831
|
+
updateStateValue(e, t, n, r) {
|
|
832
|
+
let i = n && n.notNotify, a = n && n.notUpdate, o = n && n.fieldAllowEmpty, s = this.getProp("allowEmpty"), c = o || s;
|
|
833
|
+
We(this.data.values, e, t, c), i || (this._adapter.notifyChange(this.data), this._adapter.notifyValueChange(this.data.values, { [e]: t })), a || this._adapter.forceUpdate(r);
|
|
834
|
+
}
|
|
835
|
+
getTouched(e) {
|
|
836
|
+
return e === void 0 ? this.data.touched : B(this.data.touched, e);
|
|
837
|
+
}
|
|
838
|
+
updateStateTouched(e, t, n, r) {
|
|
839
|
+
let i = n && n.notNotify, a = n && n.notUpdate;
|
|
840
|
+
We(this.data.touched, e, t), i || this._adapter.notifyChange(this.data), a || this._adapter.forceUpdate(r);
|
|
841
|
+
}
|
|
842
|
+
getError(e) {
|
|
843
|
+
return e === void 0 ? this.data.errors : B(this.data.errors, e);
|
|
844
|
+
}
|
|
845
|
+
updateStateError(e, t, n, r) {
|
|
846
|
+
let i = n && n.notNotify, a = n && n.notUpdate;
|
|
847
|
+
We(this.data.errors, e, t), i || this._adapter.notifyChange(this.data), this._adapter.notifyErrorChange(this.data.errors, { [e]: t }), a || this._adapter.forceUpdate(r);
|
|
848
|
+
}
|
|
849
|
+
getFieldSetterApi() {
|
|
850
|
+
return {
|
|
851
|
+
setValue: (e, t, n) => {
|
|
852
|
+
let r = this.fields.get(e) ? this.fields.get(e).fieldApi : void 0, i = this._adapter.cloneDeep(t);
|
|
853
|
+
r ? r.setValue(i, n) : (this.updateStateValue(e, i, n, () => {
|
|
854
|
+
let t = this._getNestedField(e);
|
|
855
|
+
t.size && t.forEach((e) => {
|
|
856
|
+
let t = e.field, n = B(this.data.values, t);
|
|
857
|
+
e.fieldApi.setValue(n, {
|
|
858
|
+
notNotify: !0,
|
|
859
|
+
notUpdate: !0
|
|
860
|
+
});
|
|
861
|
+
});
|
|
862
|
+
}), this.getArrayField(e) && this.updateArrayField(e, { updateKey: (/* @__PURE__ */ new Date()).valueOf() }));
|
|
863
|
+
},
|
|
864
|
+
setError: (e, t, n) => {
|
|
865
|
+
let r = this.fields.get(e) ? this.fields.get(e).fieldApi : void 0, i = this._adapter.cloneDeep(t);
|
|
866
|
+
r ? r.setError(i, n) : (this.updateStateError(e, i, n, () => {
|
|
867
|
+
let t = this._getNestedField(e);
|
|
868
|
+
t.size && t.forEach((e) => {
|
|
869
|
+
let t = e.field, n = B(this.data.errors, t);
|
|
870
|
+
e.fieldApi.setError(n, {
|
|
871
|
+
notNotify: !0,
|
|
872
|
+
notUpdate: !0
|
|
873
|
+
});
|
|
874
|
+
});
|
|
875
|
+
}), this.getArrayField(e) && this.updateArrayField(e, { updateKey: (/* @__PURE__ */ new Date()).valueOf() }));
|
|
876
|
+
},
|
|
877
|
+
setTouched: (e, t, n) => {
|
|
878
|
+
let r = this.fields.get(e) ? this.fields.get(e).fieldApi : void 0;
|
|
879
|
+
r ? r.setTouched(t, n) : (this.updateStateTouched(e, t, n, () => {
|
|
880
|
+
let t = this._getNestedField(e);
|
|
881
|
+
t.size && t.forEach((e) => {
|
|
882
|
+
let t = e.field, n = B(this.data.touched, t);
|
|
883
|
+
e.fieldApi.setTouched(n, {
|
|
884
|
+
notNotify: !0,
|
|
885
|
+
notUpdate: !0
|
|
886
|
+
});
|
|
887
|
+
});
|
|
888
|
+
}), this.getArrayField(e) && this.updateArrayField(e, { updateKey: (/* @__PURE__ */ new Date()).valueOf() }));
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
getModifyFormStateApi() {
|
|
893
|
+
return {
|
|
894
|
+
register: this.register,
|
|
895
|
+
unRegister: this.unRegister,
|
|
896
|
+
updateStateValue: this.updateStateValue,
|
|
897
|
+
updateStateError: this.updateStateError,
|
|
898
|
+
updateStateTouched: this.updateStateTouched,
|
|
899
|
+
getValue: this.getValue,
|
|
900
|
+
getError: this.getError,
|
|
901
|
+
getTouched: this.getTouched,
|
|
902
|
+
getInitValues: this.getInitValues,
|
|
903
|
+
getInitValue: this.getInitValue,
|
|
904
|
+
getFormProps: this.getFormProps,
|
|
905
|
+
getField: this.getField,
|
|
906
|
+
registerArrayField: this.registerArrayField,
|
|
907
|
+
unRegisterArrayField: this.unRegisterArrayField,
|
|
908
|
+
getArrayField: this.getArrayField,
|
|
909
|
+
updateArrayField: this.updateArrayField
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
getFormApi() {
|
|
913
|
+
return {
|
|
914
|
+
...this.getFieldSetterApi(),
|
|
915
|
+
reset: (e) => this.reset(e),
|
|
916
|
+
validate: (e) => this.validate(e),
|
|
917
|
+
getValue: (e) => this.getValue(e, { needClone: !0 }),
|
|
918
|
+
getValues: () => this.getValue(void 0, { needClone: !0 }),
|
|
919
|
+
getFormState: () => this.getFormState(!0),
|
|
920
|
+
getFormProps: (e) => this.getFormProps(e),
|
|
921
|
+
getInitValue: (e) => this.getInitValue(e),
|
|
922
|
+
getInitValues: () => this.getInitValues(),
|
|
923
|
+
getTouched: (e) => this.getTouched(e),
|
|
924
|
+
getError: (e) => this.getError(e),
|
|
925
|
+
setValues: (e, t) => this.setValues(e, t || { isOverride: !1 }),
|
|
926
|
+
submitForm: () => this.submit(),
|
|
927
|
+
getFieldExist: (e) => this.getFieldExist(e),
|
|
928
|
+
scrollToField: (e, t) => this.scrollToField(e, t),
|
|
929
|
+
scrollToError: (e) => this.scrollToError(e)
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
getFormState(e = !1) {
|
|
933
|
+
return e ? this._adapter.cloneDeep(this.data) : { ...this.data };
|
|
934
|
+
}
|
|
935
|
+
_isValid(e) {
|
|
936
|
+
let t = !0;
|
|
937
|
+
return e ? [...e.keys()].forEach((e) => {
|
|
938
|
+
Pt(B(this.data.errors, e)) || (t = !1);
|
|
939
|
+
}) : t = !!He(this.data.errors), t;
|
|
940
|
+
}
|
|
941
|
+
getInitValues() {
|
|
942
|
+
return this._adapter.getInitValues();
|
|
943
|
+
}
|
|
944
|
+
getInitValue(e) {
|
|
945
|
+
return e === void 0 ? this._adapter.getInitValues() : B(this._adapter.getInitValues(), e);
|
|
946
|
+
}
|
|
947
|
+
getFormProps(e) {
|
|
948
|
+
return this._adapter.getFormProps(e);
|
|
949
|
+
}
|
|
950
|
+
getFieldExist(e) {
|
|
951
|
+
return !!this.fields.has(e);
|
|
952
|
+
}
|
|
953
|
+
_autoScroll(e) {
|
|
954
|
+
let { autoScrollToError: t } = this.getFormProps();
|
|
955
|
+
if (!t) return;
|
|
956
|
+
let n = {
|
|
957
|
+
behavior: "smooth",
|
|
958
|
+
block: "start"
|
|
959
|
+
};
|
|
960
|
+
typeof t == "object" && (n = t), e ? setTimeout(() => this._getErrorFieldAndScroll(n), 100) : this._getErrorFieldAndScroll(n);
|
|
961
|
+
}
|
|
962
|
+
_getErrorFieldAndScroll(e) {
|
|
963
|
+
let t = this._adapter.getAllErrorDOM();
|
|
964
|
+
if (t && t.length) try {
|
|
965
|
+
let n = t[0].parentNode.parentNode;
|
|
966
|
+
m(n, e);
|
|
967
|
+
} catch {}
|
|
968
|
+
}
|
|
969
|
+
scrollToField(e, t = {
|
|
970
|
+
behavior: "smooth",
|
|
971
|
+
block: "start"
|
|
972
|
+
}) {
|
|
973
|
+
if (this.getFieldExist(e)) {
|
|
974
|
+
let n = this._adapter.getFieldDOM(e);
|
|
975
|
+
m(n, t);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
scrollToError(e) {
|
|
979
|
+
let t = e && e.scrollOpts ? e.scrollOpts : {
|
|
980
|
+
behavior: "smooth",
|
|
981
|
+
block: "start"
|
|
982
|
+
}, n = e && e.field, r = e && e.index, i, a;
|
|
983
|
+
if (typeof r == "number") {
|
|
984
|
+
let e = this._adapter.getAllErrorDOM()[r];
|
|
985
|
+
e && (i = e.parentNode.parentNode);
|
|
986
|
+
} else if (n) a = this._adapter.getFieldErrorDOM(n), a && (i = a.parentNode.parentNode);
|
|
987
|
+
else if (n === void 0) {
|
|
988
|
+
let e = this._adapter.getAllErrorDOM();
|
|
989
|
+
e && e.length && (i = e[0].parentNode.parentNode);
|
|
990
|
+
}
|
|
991
|
+
i && m(i, t);
|
|
992
|
+
}
|
|
993
|
+
}, X = /* @__PURE__ */ t((/* @__PURE__ */ e(((e, t) => {
|
|
994
|
+
var n = r(), i = 1, a = 4;
|
|
995
|
+
function o(e) {
|
|
996
|
+
return n(e, i | a);
|
|
997
|
+
}
|
|
998
|
+
t.exports = o;
|
|
999
|
+
})))(), 1), Z = Symbol("semi-form"), It = Symbol("semi-form-array-field"), Lt = M({
|
|
1000
|
+
name: "ArrayField",
|
|
1001
|
+
props: {
|
|
1002
|
+
field: {
|
|
1003
|
+
type: String,
|
|
1004
|
+
required: !0
|
|
1005
|
+
},
|
|
1006
|
+
initValue: {
|
|
1007
|
+
type: Array,
|
|
1008
|
+
default: void 0
|
|
1009
|
+
}
|
|
1010
|
+
},
|
|
1011
|
+
setup(e, { slots: t }) {
|
|
1012
|
+
let n = e, r = P(Z);
|
|
1013
|
+
if (!r) return console.warn("[Semi Form]: ArrayField must be used inside Form"), () => null;
|
|
1014
|
+
let i = Pe().replaceAll(":", ""), a = 0, o = () => `${i}-${a++}`, s = r.updater.getArrayField(n.field), c = r.updater.getValue(n.field), l = Array.isArray(n.initValue) ? (0, X.default)(n.initValue) : Array.isArray(c) ? (0, X.default)(c) : [], u = L(l.map(o)), d = s?.updateKey, f = ke({
|
|
1015
|
+
inArrayField: !0,
|
|
1016
|
+
shouldUseInitValue: !s
|
|
1017
|
+
});
|
|
1018
|
+
r.updater.registerArrayField(n.field, (0, X.default)(l)), r.updater.updateStateValue(n.field, (0, X.default)(l), {
|
|
1019
|
+
notNotify: !0,
|
|
1020
|
+
notUpdate: !0
|
|
1021
|
+
}), Oe(It, f), Fe(r.state, () => {
|
|
1022
|
+
let e = r.updater.getArrayField(n.field)?.updateKey, t = r.updater.getValue(n.field);
|
|
1023
|
+
if (!(e === d && Array.isArray(t) && t.length === u.value.length)) {
|
|
1024
|
+
if (e !== d && (f.shouldUseInitValue = !1), d = e, !Array.isArray(t)) {
|
|
1025
|
+
u.value = [];
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
u.value = t.map((e, t) => u.value[t] ?? o());
|
|
1029
|
+
}
|
|
1030
|
+
}, { flush: "sync" });
|
|
1031
|
+
let p = () => {
|
|
1032
|
+
let e = Date.now() + a / 1e3;
|
|
1033
|
+
d = e, r.updater.updateArrayField(n.field, { updateKey: e });
|
|
1034
|
+
}, m = (e) => {
|
|
1035
|
+
f.shouldUseInitValue = !0;
|
|
1036
|
+
let t = o(), i = typeof e == "number" ? Math.max(0, Math.min(e, u.value.length)) : u.value.length;
|
|
1037
|
+
u.value.splice(i, 0, t);
|
|
1038
|
+
let a = r.updater.getValue(n.field), s = Array.isArray(a) ? [...a] : [];
|
|
1039
|
+
return s.splice(i, 0, void 0), r.updater.updateStateValue(n.field, s, {}), p(), t;
|
|
1040
|
+
}, h = (e, t) => {
|
|
1041
|
+
f.shouldUseInitValue = !1;
|
|
1042
|
+
let i = r.updater.getValue(n.field), a = Array.isArray(i) ? (0, X.default)(i) : [], s = typeof t == "number" ? Math.max(0, Math.min(t, a.length)) : a.length;
|
|
1043
|
+
a.splice(s, 0, (0, X.default)(e)), u.value.splice(s, 0, o()), r.updater.updateStateValue(n.field, a, {}), p();
|
|
1044
|
+
}, g = (e) => {
|
|
1045
|
+
u.value.splice(e, 1);
|
|
1046
|
+
let t = r.updater.getValue(n.field), i = Array.isArray(t) ? [...t] : [];
|
|
1047
|
+
i.splice(e, 1);
|
|
1048
|
+
let a = r.updater.getError(n.field);
|
|
1049
|
+
if (Array.isArray(a)) {
|
|
1050
|
+
let t = [...a];
|
|
1051
|
+
t.splice(e, 1), r.updater.updateStateError(n.field, t, {
|
|
1052
|
+
notNotify: !0,
|
|
1053
|
+
notUpdate: !0
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
r.updater.updateStateValue(n.field, i, {}), p();
|
|
1057
|
+
};
|
|
1058
|
+
return Ee(() => r.updater.unRegisterArrayField(n.field)), () => {
|
|
1059
|
+
let e = {
|
|
1060
|
+
add: m,
|
|
1061
|
+
addWithInitValue: h,
|
|
1062
|
+
arrayFields: u.value.map((e, t) => ({
|
|
1063
|
+
key: e,
|
|
1064
|
+
field: `${n.field}[${t}]`,
|
|
1065
|
+
remove: () => g(t)
|
|
1066
|
+
}))
|
|
1067
|
+
};
|
|
1068
|
+
return t.default?.(e);
|
|
1069
|
+
};
|
|
1070
|
+
}
|
|
1071
|
+
}), Q = M({
|
|
1072
|
+
name: "FormNodeRenderer",
|
|
1073
|
+
props: { content: {
|
|
1074
|
+
type: null,
|
|
1075
|
+
default: void 0
|
|
1076
|
+
} },
|
|
1077
|
+
setup(e) {
|
|
1078
|
+
return () => e.content;
|
|
1079
|
+
}
|
|
1080
|
+
}), Rt = [
|
|
1081
|
+
"id",
|
|
1082
|
+
"aria-label",
|
|
1083
|
+
"x-form-id"
|
|
1084
|
+
], zt = [
|
|
1085
|
+
"id",
|
|
1086
|
+
"aria-label",
|
|
1087
|
+
"x-form-id"
|
|
1088
|
+
], Bt = /* @__PURE__ */ M({
|
|
1089
|
+
name: "Form",
|
|
1090
|
+
inheritAttrs: !1,
|
|
1091
|
+
__name: "Form",
|
|
1092
|
+
props: {
|
|
1093
|
+
allowEmpty: {
|
|
1094
|
+
type: Boolean,
|
|
1095
|
+
default: !1
|
|
1096
|
+
},
|
|
1097
|
+
ariaLabel: {},
|
|
1098
|
+
autoScrollToError: {
|
|
1099
|
+
type: [Boolean, Object],
|
|
1100
|
+
default: !1
|
|
1101
|
+
},
|
|
1102
|
+
className: { type: [
|
|
1103
|
+
Boolean,
|
|
1104
|
+
null,
|
|
1105
|
+
String,
|
|
1106
|
+
Object,
|
|
1107
|
+
Array
|
|
1108
|
+
] },
|
|
1109
|
+
component: {},
|
|
1110
|
+
disabled: { type: Boolean },
|
|
1111
|
+
extraTextPosition: { default: "bottom" },
|
|
1112
|
+
form: {},
|
|
1113
|
+
getFormApi: {},
|
|
1114
|
+
id: {},
|
|
1115
|
+
initValues: {},
|
|
1116
|
+
labelAlign: { default: "left" },
|
|
1117
|
+
labelCol: {},
|
|
1118
|
+
labelPosition: { default: "top" },
|
|
1119
|
+
labelWidth: {},
|
|
1120
|
+
layout: { default: "vertical" },
|
|
1121
|
+
render: {},
|
|
1122
|
+
showValidateIcon: {
|
|
1123
|
+
type: Boolean,
|
|
1124
|
+
default: !0
|
|
1125
|
+
},
|
|
1126
|
+
stopPropagation: {},
|
|
1127
|
+
stopValidateWithError: {
|
|
1128
|
+
type: Boolean,
|
|
1129
|
+
default: !1
|
|
1130
|
+
},
|
|
1131
|
+
style: {},
|
|
1132
|
+
trigger: { default: "change" },
|
|
1133
|
+
validateFields: {},
|
|
1134
|
+
validator: {},
|
|
1135
|
+
wrapperCol: {}
|
|
1136
|
+
},
|
|
1137
|
+
emits: [
|
|
1138
|
+
"change",
|
|
1139
|
+
"errorChange",
|
|
1140
|
+
"reset",
|
|
1141
|
+
"submit",
|
|
1142
|
+
"submitFail",
|
|
1143
|
+
"valueChange"
|
|
1144
|
+
],
|
|
1145
|
+
setup(e, { expose: t, emit: n }) {
|
|
1146
|
+
let r = e, i = n, a = Ne(), o = `semi-form-${Pe().replaceAll(":", "")}`, s = L(r.id ?? o), c = L(), l = /* @__PURE__ */ new Map(), u = je({
|
|
1147
|
+
values: {},
|
|
1148
|
+
errors: {},
|
|
1149
|
+
touched: {}
|
|
1150
|
+
}), d = O(() => ({
|
|
1151
|
+
...r,
|
|
1152
|
+
initValues: r.initValues ?? {}
|
|
1153
|
+
})), f;
|
|
1154
|
+
f = xe(new Ft({
|
|
1155
|
+
getContext: () => void 0,
|
|
1156
|
+
getContexts: () => ({}),
|
|
1157
|
+
getProp: (e) => d.value[e],
|
|
1158
|
+
getProps: () => d.value,
|
|
1159
|
+
getState: () => void 0,
|
|
1160
|
+
getStates: () => ({}),
|
|
1161
|
+
setState: (e, t) => t?.(),
|
|
1162
|
+
getCache: (e) => l.get(e),
|
|
1163
|
+
getCaches: () => l,
|
|
1164
|
+
setCache: (e, t) => (l.set(e, t), t),
|
|
1165
|
+
stopPropagation: (e) => e?.stopPropagation?.(),
|
|
1166
|
+
persistEvent: () => void 0,
|
|
1167
|
+
cloneDeep: X.default,
|
|
1168
|
+
getInitValues: () => (0, X.default)(r.initValues ?? {}),
|
|
1169
|
+
getFormProps: (e) => e ? Object.fromEntries(e.map((e) => [e, d.value[e]])) : d.value,
|
|
1170
|
+
notifySubmit: (e, t) => i("submit", e, t),
|
|
1171
|
+
notifySubmitFail: (e, t, n) => i("submitFail", e, t, n),
|
|
1172
|
+
notifyChange: (e) => i("change", y(e)),
|
|
1173
|
+
notifyValueChange: (e, t) => i("valueChange", (0, X.default)(e), (0, X.default)(t)),
|
|
1174
|
+
notifyErrorChange: (e, t) => i("errorChange", (0, X.default)(e), (0, X.default)(t)),
|
|
1175
|
+
notifyReset: () => i("reset"),
|
|
1176
|
+
forceUpdate: (e) => {
|
|
1177
|
+
u.value = y(f.getFormState()), r.form?.__updateState?.((0, X.default)(u.value)), e?.();
|
|
1178
|
+
},
|
|
1179
|
+
initFormId: () => {
|
|
1180
|
+
s.value = r.id ?? o;
|
|
1181
|
+
},
|
|
1182
|
+
getFormDOM: () => c.value ?? null,
|
|
1183
|
+
getAllErrorDOM: () => c.value?.querySelectorAll(".semi-form-field-error-message") ?? [],
|
|
1184
|
+
getFieldDOM: (e) => b(e),
|
|
1185
|
+
getFieldErrorDOM: (e) => b(e)?.querySelector(".semi-form-field-error-message") ?? null
|
|
1186
|
+
}));
|
|
1187
|
+
let p = xe(f.getFormApi()), m = xe(f.getModifyFormStateApi());
|
|
1188
|
+
u.value = y(f.getFormState()), Oe(Z, {
|
|
1189
|
+
api: p,
|
|
1190
|
+
props: r,
|
|
1191
|
+
state: u,
|
|
1192
|
+
updater: m
|
|
1193
|
+
});
|
|
1194
|
+
let h = O(() => [
|
|
1195
|
+
"semi-form",
|
|
1196
|
+
`semi-form-${r.layout}`,
|
|
1197
|
+
r.className,
|
|
1198
|
+
a.class
|
|
1199
|
+
]), g = O(() => Object.fromEntries(Object.entries(a).filter(([e]) => e !== "class" && e !== "style"))), _ = O(() => ({
|
|
1200
|
+
formApi: p,
|
|
1201
|
+
formState: u.value,
|
|
1202
|
+
values: u.value.values
|
|
1203
|
+
})), v = O(() => r.render?.(_.value));
|
|
1204
|
+
function y(e) {
|
|
1205
|
+
return (0, X.default)(e);
|
|
1206
|
+
}
|
|
1207
|
+
function b(e) {
|
|
1208
|
+
let t = c.value;
|
|
1209
|
+
return t ? Array.from(t.querySelectorAll("[x-field-id]")).find((t) => t.getAttribute("x-field-id") === e) ?? null : null;
|
|
1210
|
+
}
|
|
1211
|
+
function x(e) {
|
|
1212
|
+
e.preventDefault(), r.stopPropagation?.submit && e.stopPropagation(), f.submit(e);
|
|
1213
|
+
}
|
|
1214
|
+
function S(e) {
|
|
1215
|
+
e.preventDefault(), r.stopPropagation?.reset && e.stopPropagation(), f.reset();
|
|
1216
|
+
}
|
|
1217
|
+
return De(() => {
|
|
1218
|
+
f.init(), u.value = y(f.getFormState()), r.getFormApi?.(p), r.form?.__bind?.(p);
|
|
1219
|
+
}), Ee(() => {
|
|
1220
|
+
f.destroy(), r.form?.__unbind?.();
|
|
1221
|
+
}), t({ formApi: p }), (e, t) => r.labelCol && r.wrapperCol ? (I(), k(Ae(r.labelCol && r.wrapperCol ? z(pe) : "div"), { key: 0 }, {
|
|
1222
|
+
default: Ie(() => [_e("form", Se(g.value, {
|
|
1223
|
+
id: s.value,
|
|
1224
|
+
ref_key: "formElement",
|
|
1225
|
+
ref: c,
|
|
1226
|
+
class: h.value,
|
|
1227
|
+
style: [r.style, z(a).style],
|
|
1228
|
+
"aria-label": r.ariaLabel,
|
|
1229
|
+
"x-form-id": s.value,
|
|
1230
|
+
onSubmit: x,
|
|
1231
|
+
onReset: S
|
|
1232
|
+
}), [r.component ? (I(), k(Ae(r.component), we(Se({ key: 0 }, _.value)), null, 16)) : r.render ? (I(), k(z(Q), {
|
|
1233
|
+
key: 1,
|
|
1234
|
+
content: v.value
|
|
1235
|
+
}, null, 8, ["content"])) : R(e.$slots, "default", we(be(_.value)), void 0, void 0, 2)], 16, Rt)]),
|
|
1236
|
+
_: 3
|
|
1237
|
+
})) : (I(), j("form", Se({ key: 1 }, g.value, {
|
|
1238
|
+
id: s.value,
|
|
1239
|
+
ref_key: "formElement",
|
|
1240
|
+
ref: c,
|
|
1241
|
+
class: h.value,
|
|
1242
|
+
style: [r.style, z(a).style],
|
|
1243
|
+
"aria-label": r.ariaLabel,
|
|
1244
|
+
"x-form-id": s.value,
|
|
1245
|
+
onSubmit: x,
|
|
1246
|
+
onReset: S
|
|
1247
|
+
}), [r.component ? (I(), k(Ae(r.component), we(Se({ key: 0 }, _.value)), null, 16)) : r.render ? (I(), k(z(Q), {
|
|
1248
|
+
key: 1,
|
|
1249
|
+
content: v.value
|
|
1250
|
+
}, null, 8, ["content"])) : R(e.$slots, "default", we(be(_.value)), void 0, void 0, 2)], 16, zt));
|
|
1251
|
+
}
|
|
1252
|
+
}), Vt = ["id"], Ht = /* @__PURE__ */ M({
|
|
1253
|
+
name: "FormErrorMessage",
|
|
1254
|
+
__name: "FormErrorMessage",
|
|
1255
|
+
props: {
|
|
1256
|
+
className: { type: [
|
|
1257
|
+
Boolean,
|
|
1258
|
+
null,
|
|
1259
|
+
String,
|
|
1260
|
+
Object,
|
|
1261
|
+
Array
|
|
1262
|
+
] },
|
|
1263
|
+
error: { type: [
|
|
1264
|
+
Boolean,
|
|
1265
|
+
String,
|
|
1266
|
+
Array,
|
|
1267
|
+
Object,
|
|
1268
|
+
Number,
|
|
1269
|
+
null
|
|
1270
|
+
] },
|
|
1271
|
+
errorMessageId: {},
|
|
1272
|
+
helpText: { type: [
|
|
1273
|
+
Object,
|
|
1274
|
+
String,
|
|
1275
|
+
Number,
|
|
1276
|
+
Boolean,
|
|
1277
|
+
null,
|
|
1278
|
+
Array
|
|
1279
|
+
] },
|
|
1280
|
+
helpTextId: {},
|
|
1281
|
+
isInInputGroup: { type: Boolean },
|
|
1282
|
+
showValidateIcon: { type: Boolean },
|
|
1283
|
+
style: {},
|
|
1284
|
+
validateStatus: {}
|
|
1285
|
+
},
|
|
1286
|
+
setup(e) {
|
|
1287
|
+
let t = e, n = O(() => !!t.error), r = O(() => n.value ? t.error : t.helpText), i = O(() => t.error === "" && t.validateStatus === "error" || Array.isArray(t.error) && !t.error.some(Boolean) && !t.helpText ? !1 : !!t.error || !!t.helpText), a = O(() => {
|
|
1288
|
+
let e = r.value;
|
|
1289
|
+
if (Array.isArray(e)) {
|
|
1290
|
+
let t = e.filter(Boolean);
|
|
1291
|
+
return t.length ? t.join(", ") : void 0;
|
|
1292
|
+
}
|
|
1293
|
+
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
1294
|
+
}), o = O(() => n.value ? t.errorMessageId : t.helpTextId);
|
|
1295
|
+
return (e, s) => i.value ? (I(), j("div", {
|
|
1296
|
+
key: 0,
|
|
1297
|
+
class: Ce([
|
|
1298
|
+
n.value ? "semi-form-field-error-message" : void 0,
|
|
1299
|
+
t.helpText ? "semi-form-field-help-text" : void 0,
|
|
1300
|
+
t.className
|
|
1301
|
+
]),
|
|
1302
|
+
style: Te(t.style)
|
|
1303
|
+
}, [t.showValidateIcon && r.value ? (I(), j(he, { key: 0 }, [t.isInInputGroup || t.validateStatus === "error" ? (I(), k(z(Le), {
|
|
1304
|
+
key: 0,
|
|
1305
|
+
class: "semi-form-field-validate-status-icon"
|
|
1306
|
+
})) : t.validateStatus === "warning" ? (I(), k(z(Re), {
|
|
1307
|
+
key: 1,
|
|
1308
|
+
class: "semi-form-field-validate-status-icon"
|
|
1309
|
+
})) : A("", !0)], 64)) : A("", !0), a.value === void 0 ? F(r.value) ? (I(), k(z(Q), {
|
|
1310
|
+
key: 2,
|
|
1311
|
+
content: r.value
|
|
1312
|
+
}, null, 8, ["content"])) : A("", !0) : (I(), j("span", {
|
|
1313
|
+
key: 1,
|
|
1314
|
+
id: o.value
|
|
1315
|
+
}, Me(a.value), 9, Vt))], 6)) : A("", !0);
|
|
1316
|
+
}
|
|
1317
|
+
}), Ut = ["id", "for"], Wt = {
|
|
1318
|
+
class: "semi-form-field-label-text",
|
|
1319
|
+
"x-semi-prop": "label"
|
|
1320
|
+
}, Gt = {
|
|
1321
|
+
key: 0,
|
|
1322
|
+
class: "semi-form-field-label-optional-text"
|
|
1323
|
+
}, Kt = {
|
|
1324
|
+
key: 0,
|
|
1325
|
+
class: "semi-form-field-label-extra"
|
|
1326
|
+
}, qt = /* @__PURE__ */ M({
|
|
1327
|
+
name: "FormLabel",
|
|
1328
|
+
__name: "FormLabel",
|
|
1329
|
+
props: {
|
|
1330
|
+
align: { default: "left" },
|
|
1331
|
+
className: { type: [
|
|
1332
|
+
Boolean,
|
|
1333
|
+
null,
|
|
1334
|
+
String,
|
|
1335
|
+
Object,
|
|
1336
|
+
Array
|
|
1337
|
+
] },
|
|
1338
|
+
disabled: { type: Boolean },
|
|
1339
|
+
extra: { type: [
|
|
1340
|
+
Object,
|
|
1341
|
+
String,
|
|
1342
|
+
Number,
|
|
1343
|
+
Boolean,
|
|
1344
|
+
null,
|
|
1345
|
+
Array
|
|
1346
|
+
] },
|
|
1347
|
+
id: {},
|
|
1348
|
+
name: {},
|
|
1349
|
+
optional: {
|
|
1350
|
+
type: Boolean,
|
|
1351
|
+
default: !1
|
|
1352
|
+
},
|
|
1353
|
+
required: {
|
|
1354
|
+
type: Boolean,
|
|
1355
|
+
default: !1
|
|
1356
|
+
},
|
|
1357
|
+
style: {},
|
|
1358
|
+
text: { type: [
|
|
1359
|
+
Object,
|
|
1360
|
+
String,
|
|
1361
|
+
Number,
|
|
1362
|
+
Boolean,
|
|
1363
|
+
null,
|
|
1364
|
+
Array
|
|
1365
|
+
] },
|
|
1366
|
+
width: {}
|
|
1367
|
+
},
|
|
1368
|
+
setup(e) {
|
|
1369
|
+
let t = e, n = P(le, void 0), r = O(() => {
|
|
1370
|
+
let e = n?.value.locale.Form;
|
|
1371
|
+
return typeof e?.optional == "string" ? e.optional : "(可选)";
|
|
1372
|
+
}), i = O(() => [
|
|
1373
|
+
"semi-form-field-label",
|
|
1374
|
+
`semi-form-field-label-${t.align}`,
|
|
1375
|
+
t.required ? "semi-form-field-label-required" : void 0,
|
|
1376
|
+
t.disabled ? "semi-form-field-label-disabled" : void 0,
|
|
1377
|
+
t.extra ? "semi-form-field-label-with-extra" : void 0,
|
|
1378
|
+
t.className
|
|
1379
|
+
]);
|
|
1380
|
+
return (e, n) => (I(), j("label", {
|
|
1381
|
+
id: t.id,
|
|
1382
|
+
for: t.name,
|
|
1383
|
+
class: Ce(i.value),
|
|
1384
|
+
style: Te([t.style, t.width === void 0 ? void 0 : { width: t.width }])
|
|
1385
|
+
}, [_e("div", Wt, [R(e.$slots, "default", {}, () => [ve(z(Q), { content: t.text }, null, 8, ["content"])]), t.optional ? (I(), j("span", Gt, Me(r.value), 1)) : A("", !0)]), t.extra ? (I(), j("div", Kt, [ve(z(Q), { content: t.extra }, null, 8, ["content"])])) : A("", !0)], 14, Ut));
|
|
1386
|
+
}
|
|
1387
|
+
}), Jt = {
|
|
1388
|
+
allowEmptyString: {
|
|
1389
|
+
type: Boolean,
|
|
1390
|
+
default: void 0
|
|
1391
|
+
},
|
|
1392
|
+
convert: {
|
|
1393
|
+
type: Function,
|
|
1394
|
+
default: void 0
|
|
1395
|
+
},
|
|
1396
|
+
emptyValue: {
|
|
1397
|
+
type: null,
|
|
1398
|
+
default: ""
|
|
1399
|
+
},
|
|
1400
|
+
extraText: {
|
|
1401
|
+
type: null,
|
|
1402
|
+
default: void 0
|
|
1403
|
+
},
|
|
1404
|
+
extraTextPosition: {
|
|
1405
|
+
type: String,
|
|
1406
|
+
default: void 0
|
|
1407
|
+
},
|
|
1408
|
+
field: {
|
|
1409
|
+
type: String,
|
|
1410
|
+
default: void 0
|
|
1411
|
+
},
|
|
1412
|
+
fieldClassName: {
|
|
1413
|
+
type: null,
|
|
1414
|
+
default: void 0
|
|
1415
|
+
},
|
|
1416
|
+
fieldStyle: {
|
|
1417
|
+
type: null,
|
|
1418
|
+
default: void 0
|
|
1419
|
+
},
|
|
1420
|
+
helpText: {
|
|
1421
|
+
type: null,
|
|
1422
|
+
default: void 0
|
|
1423
|
+
},
|
|
1424
|
+
initValue: {
|
|
1425
|
+
type: null,
|
|
1426
|
+
default: void 0
|
|
1427
|
+
},
|
|
1428
|
+
isInInputGroup: {
|
|
1429
|
+
type: Boolean,
|
|
1430
|
+
default: !1
|
|
1431
|
+
},
|
|
1432
|
+
keepState: {
|
|
1433
|
+
type: Boolean,
|
|
1434
|
+
default: !1
|
|
1435
|
+
},
|
|
1436
|
+
label: {
|
|
1437
|
+
type: null,
|
|
1438
|
+
default: void 0
|
|
1439
|
+
},
|
|
1440
|
+
labelAlign: {
|
|
1441
|
+
type: String,
|
|
1442
|
+
default: void 0
|
|
1443
|
+
},
|
|
1444
|
+
labelCol: {
|
|
1445
|
+
type: Object,
|
|
1446
|
+
default: void 0
|
|
1447
|
+
},
|
|
1448
|
+
labelPosition: {
|
|
1449
|
+
type: String,
|
|
1450
|
+
default: void 0
|
|
1451
|
+
},
|
|
1452
|
+
labelWidth: {
|
|
1453
|
+
type: [Number, String],
|
|
1454
|
+
default: void 0
|
|
1455
|
+
},
|
|
1456
|
+
name: {
|
|
1457
|
+
type: String,
|
|
1458
|
+
default: void 0
|
|
1459
|
+
},
|
|
1460
|
+
noErrorMessage: {
|
|
1461
|
+
type: Boolean,
|
|
1462
|
+
default: !1
|
|
1463
|
+
},
|
|
1464
|
+
noLabel: {
|
|
1465
|
+
type: Boolean,
|
|
1466
|
+
default: !1
|
|
1467
|
+
},
|
|
1468
|
+
pure: {
|
|
1469
|
+
type: Boolean,
|
|
1470
|
+
default: !1
|
|
1471
|
+
},
|
|
1472
|
+
required: {
|
|
1473
|
+
type: Boolean,
|
|
1474
|
+
default: void 0
|
|
1475
|
+
},
|
|
1476
|
+
rules: {
|
|
1477
|
+
type: Array,
|
|
1478
|
+
default: void 0
|
|
1479
|
+
},
|
|
1480
|
+
stopValidateWithError: {
|
|
1481
|
+
type: Boolean,
|
|
1482
|
+
default: void 0
|
|
1483
|
+
},
|
|
1484
|
+
transform: {
|
|
1485
|
+
type: Function,
|
|
1486
|
+
default: void 0
|
|
1487
|
+
},
|
|
1488
|
+
trigger: {
|
|
1489
|
+
type: [String, Array],
|
|
1490
|
+
default: void 0
|
|
1491
|
+
},
|
|
1492
|
+
validate: {
|
|
1493
|
+
type: Function,
|
|
1494
|
+
default: void 0
|
|
1495
|
+
},
|
|
1496
|
+
validator: {
|
|
1497
|
+
type: Function,
|
|
1498
|
+
default: void 0
|
|
1499
|
+
},
|
|
1500
|
+
validateStatus: {
|
|
1501
|
+
type: String,
|
|
1502
|
+
default: void 0
|
|
1503
|
+
},
|
|
1504
|
+
wrapperCol: {
|
|
1505
|
+
type: Object,
|
|
1506
|
+
default: void 0
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
function Yt(e, t) {
|
|
1510
|
+
let n = t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
1511
|
+
return !!(e.props && (Object.prototype.hasOwnProperty.call(e.props, t) || Object.prototype.hasOwnProperty.call(e.props, n)));
|
|
1512
|
+
}
|
|
1513
|
+
function Xt(e, t) {
|
|
1514
|
+
return t ? t.replaceAll("[", ".").replaceAll("]", "").split(".").filter(Boolean).reduce((e, t) => {
|
|
1515
|
+
if (!(typeof e != "object" || !e)) return e[t];
|
|
1516
|
+
}, e) : e;
|
|
1517
|
+
}
|
|
1518
|
+
function Zt(e, t) {
|
|
1519
|
+
if (Array.isArray(e)) for (let n of e) Zt(n, t);
|
|
1520
|
+
else typeof e == "function" && e(...t);
|
|
1521
|
+
}
|
|
1522
|
+
function Qt(e) {
|
|
1523
|
+
return Array.isArray(e) ? e.filter(Boolean).length === 0 : e == null || e === !1 || e === "";
|
|
1524
|
+
}
|
|
1525
|
+
function $t(e) {
|
|
1526
|
+
return e && typeof e == "object" && !F(e) ? e : { text: e };
|
|
1527
|
+
}
|
|
1528
|
+
function $(e, t = {}) {
|
|
1529
|
+
let n = t.valueProp ?? "value", r = t.onUpdateEvent ?? "onChange", i = M({
|
|
1530
|
+
name: `FormField${typeof e == "object" && "name" in e ? String(e.name) : ""}`,
|
|
1531
|
+
inheritAttrs: !1,
|
|
1532
|
+
props: Jt,
|
|
1533
|
+
setup(i, { attrs: a, slots: o, expose: s }) {
|
|
1534
|
+
let c = ye(), l = P(Z, void 0), u = P(It, void 0), d = O(() => !!i.field || t.shouldInjectByDefault !== !1), f = L();
|
|
1535
|
+
if (!l) return d.value ? (console.warn("[Semi Form]: Field Component must be used inside the Form"), () => null) : () => N(e, {
|
|
1536
|
+
...a,
|
|
1537
|
+
ref: f
|
|
1538
|
+
}, o);
|
|
1539
|
+
let p = O(() => i.field ?? ""), m = p.value ? l.updater.getValue(p.value) : void 0, h = i.initValue !== void 0 && (!u || u.shouldUseInitValue) ? i.initValue : m, g = L(h), _ = L(), v = L(), y = L(i.validateStatus ?? "default"), b = 0, x = !1, S = O(() => l.props), C = O(() => i.labelPosition ?? S.value.labelPosition ?? "top"), ee = O(() => i.labelWidth ?? S.value.labelWidth), te = O(() => i.labelAlign ?? S.value.labelAlign ?? "left"), ne = O(() => i.labelCol ?? S.value.labelCol), re = O(() => i.wrapperCol ?? S.value.wrapperCol), w = O(() => i.extraTextPosition ?? S.value.extraTextPosition ?? "bottom"), ie = O(() => {
|
|
1540
|
+
let e = i.trigger ?? S.value.trigger ?? "change";
|
|
1541
|
+
return Array.isArray(e) ? e : [e];
|
|
1542
|
+
}), ae = O(() => Yt(c.vnode, "stopValidateWithError") ? i.stopValidateWithError === !0 : S.value.stopValidateWithError ?? !1), T = O(() => i.allowEmptyString === !0 || S.value.allowEmpty === !0), oe = O(() => i.required === !0 || i.rules?.some((e) => e.required === !0) === !0), se = (e, t = {}) => {
|
|
1543
|
+
t.silent || (_.value = e, y.value = Qt(e) ? "success" : "error"), l.updater.updateStateError(p.value, e, t);
|
|
1544
|
+
}, ce = (e, t = {}) => {
|
|
1545
|
+
v.value = e, l.updater.updateStateTouched(p.value, e, t);
|
|
1546
|
+
}, le = (e, t = {}) => {
|
|
1547
|
+
g.value = e, l.updater.updateStateValue(p.value, e, {
|
|
1548
|
+
...t,
|
|
1549
|
+
fieldAllowEmpty: T.value
|
|
1550
|
+
});
|
|
1551
|
+
}, E = async (e, t = {}) => {
|
|
1552
|
+
let n = ++b, r = i.transform ? i.transform(e) : e, a = i.validator ?? i.validate, o;
|
|
1553
|
+
if (!a && !i.rules?.length) return null;
|
|
1554
|
+
if (a) try {
|
|
1555
|
+
o = await a(r, l.updater.getValue());
|
|
1556
|
+
} catch (e) {
|
|
1557
|
+
o = e instanceof Error ? e.message : e;
|
|
1558
|
+
}
|
|
1559
|
+
else if (i.rules?.length) {
|
|
1560
|
+
let e = new Y({ [p.value]: i.rules });
|
|
1561
|
+
try {
|
|
1562
|
+
await e.validate({ [p.value]: r }, { first: ae.value }), o = void 0;
|
|
1563
|
+
} catch (e) {
|
|
1564
|
+
let t = e.errors?.map((e) => e.message) ?? [e];
|
|
1565
|
+
o = t.length === 1 ? t[0] : t;
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
return n === b && se(Qt(o) ? void 0 : o, t), o;
|
|
1569
|
+
}, ue = {
|
|
1570
|
+
setValue: le,
|
|
1571
|
+
setError: se,
|
|
1572
|
+
setTouched: ce,
|
|
1573
|
+
reset: () => {
|
|
1574
|
+
let e = i.initValue === void 0 ? l.updater.getInitValue(p.value) : i.initValue;
|
|
1575
|
+
le(e, {
|
|
1576
|
+
notNotify: !0,
|
|
1577
|
+
notUpdate: !0
|
|
1578
|
+
}), se(void 0, {
|
|
1579
|
+
notNotify: !0,
|
|
1580
|
+
notUpdate: !0
|
|
1581
|
+
}), ce(void 0, {
|
|
1582
|
+
notNotify: !0,
|
|
1583
|
+
notUpdate: !0
|
|
1584
|
+
}), y.value = "default";
|
|
1585
|
+
},
|
|
1586
|
+
validate: E
|
|
1587
|
+
}, de = (...e) => {
|
|
1588
|
+
let n = Xt(e[0], t.valuePath);
|
|
1589
|
+
i.convert && (n = i.convert(n)), !T.value && n === i.emptyValue && (n = void 0);
|
|
1590
|
+
let o = g.value, s = l.updater.getValue(p.value, { needClone: !0 });
|
|
1591
|
+
try {
|
|
1592
|
+
g.value = n, l.updater.updateStateValue(p.value, n, {
|
|
1593
|
+
notNotify: !0,
|
|
1594
|
+
notUpdate: !0,
|
|
1595
|
+
fieldAllowEmpty: T.value
|
|
1596
|
+
}), Zt(a[r], [...e, l.updater.getValue()]), v.value = !0, l.updater.updateStateTouched(p.value, !0, {
|
|
1597
|
+
notNotify: !0,
|
|
1598
|
+
notUpdate: !0
|
|
1599
|
+
}), l.updater.updateStateValue(p.value, n, { fieldAllowEmpty: T.value }), ie.value.includes("change") && E(n);
|
|
1600
|
+
} catch (e) {
|
|
1601
|
+
throw g.value = o, l.updater.updateStateValue(p.value, s, {
|
|
1602
|
+
notNotify: !0,
|
|
1603
|
+
notUpdate: !0,
|
|
1604
|
+
fieldAllowEmpty: T.value
|
|
1605
|
+
}), e;
|
|
1606
|
+
}
|
|
1607
|
+
}, fe = (...e) => {
|
|
1608
|
+
Zt(a.onBlur, e), v.value || ce(!0), ie.value.includes("blur") && E(g.value);
|
|
1609
|
+
};
|
|
1610
|
+
De(() => {
|
|
1611
|
+
!d.value || !p.value || (i.keepState && u?.inArrayField && console.warn(`[Semi Form]: 'keepState' is not supported on Field "${p.value}" inside <ArrayField/>.`), l.updater.register(p.value, {
|
|
1612
|
+
value: g.value,
|
|
1613
|
+
error: _.value,
|
|
1614
|
+
touched: v.value,
|
|
1615
|
+
status: y.value
|
|
1616
|
+
}, {
|
|
1617
|
+
field: p.value,
|
|
1618
|
+
fieldApi: ue,
|
|
1619
|
+
keepState: !u?.inArrayField && i.keepState,
|
|
1620
|
+
allowEmpty: T.value
|
|
1621
|
+
}), x = !0, ie.value.includes("mount") && E(g.value));
|
|
1622
|
+
}), Ee(() => {
|
|
1623
|
+
b += 1, x && l.updater.unRegister(p.value);
|
|
1624
|
+
}), s(new Proxy({}, { get: (e, t) => f.value?.[t] }));
|
|
1625
|
+
let pe = () => {
|
|
1626
|
+
if (!d.value) return N(e, {
|
|
1627
|
+
...a,
|
|
1628
|
+
ref: f
|
|
1629
|
+
}, o);
|
|
1630
|
+
let t = a.id ?? p.value, s = `${t}-label`, l = `${t}-helpText`, u = `${t}-extraText`, m = `${t}-errormessage`, h = Yt(c.vnode, "disabled"), _ = {
|
|
1631
|
+
...a,
|
|
1632
|
+
ref: f,
|
|
1633
|
+
id: t,
|
|
1634
|
+
name: i.name,
|
|
1635
|
+
[n]: g.value,
|
|
1636
|
+
validateStatus: i.validateStatus ?? y.value,
|
|
1637
|
+
ariaRequired: oe.value,
|
|
1638
|
+
ariaLabelledby: s,
|
|
1639
|
+
onBlur: fe,
|
|
1640
|
+
[r]: de
|
|
1641
|
+
};
|
|
1642
|
+
return !h && S.value.disabled !== void 0 && (_.disabled = S.value.disabled), (i.helpText || i.extraText) && (_.ariaDescribedby = [i.helpText ? l : void 0, i.extraText ? u : void 0].filter(Boolean).join(" ")), y.value === "error" && (_.ariaErrormessage = m, _.ariaInvalid = !0), C.value === "inset" && !i.noLabel && (_.insetLabel = $t(i.label ?? p.value).text, _.insetLabelId = s), N(e, _, o);
|
|
1643
|
+
}, me = () => {
|
|
1644
|
+
if (i.noLabel || C.value === "inset") return;
|
|
1645
|
+
let e = $t(i.label ?? p.value);
|
|
1646
|
+
return N(qt, {
|
|
1647
|
+
...e,
|
|
1648
|
+
id: `${a.id ?? p.value}-label`,
|
|
1649
|
+
required: e.required ?? oe.value,
|
|
1650
|
+
disabled: e.disabled ?? !!S.value.disabled,
|
|
1651
|
+
name: e.name ?? (a.id || i.name || p.value),
|
|
1652
|
+
width: e.width ?? ee.value,
|
|
1653
|
+
align: e.align ?? te.value
|
|
1654
|
+
});
|
|
1655
|
+
}, he = () => i.extraText ? N("div", {
|
|
1656
|
+
id: `${a.id ?? p.value}-extraText`,
|
|
1657
|
+
class: [
|
|
1658
|
+
"semi-form-field-extra",
|
|
1659
|
+
typeof i.extraText == "string" ? "semi-form-field-extra-string" : void 0,
|
|
1660
|
+
`semi-form-field-extra-${w.value}`
|
|
1661
|
+
],
|
|
1662
|
+
"x-semi-prop": "extraText"
|
|
1663
|
+
}, [N(Q, { content: i.extraText })]) : void 0;
|
|
1664
|
+
return () => {
|
|
1665
|
+
if (!d.value) return N(e, {
|
|
1666
|
+
...a,
|
|
1667
|
+
ref: f
|
|
1668
|
+
}, o);
|
|
1669
|
+
let t = pe();
|
|
1670
|
+
if (i.isInInputGroup) return t;
|
|
1671
|
+
if (i.pure) return N(e, {
|
|
1672
|
+
...a,
|
|
1673
|
+
ref: f,
|
|
1674
|
+
class: [
|
|
1675
|
+
a.class,
|
|
1676
|
+
"semi-form-field-pure",
|
|
1677
|
+
i.fieldClassName
|
|
1678
|
+
],
|
|
1679
|
+
[n]: g.value,
|
|
1680
|
+
[r]: de,
|
|
1681
|
+
onBlur: fe
|
|
1682
|
+
}, o);
|
|
1683
|
+
let s = me(), c = he(), l = N("div", { class: "semi-form-field-main" }, [
|
|
1684
|
+
w.value === "middle" ? c : void 0,
|
|
1685
|
+
t,
|
|
1686
|
+
i.noErrorMessage ? void 0 : N(Ht, {
|
|
1687
|
+
error: _.value,
|
|
1688
|
+
validateStatus: i.validateStatus ?? y.value,
|
|
1689
|
+
helpText: i.helpText,
|
|
1690
|
+
helpTextId: `${a.id ?? p.value}-helpText`,
|
|
1691
|
+
errorMessageId: `${a.id ?? p.value}-errormessage`,
|
|
1692
|
+
showValidateIcon: S.value.showValidateIcon
|
|
1693
|
+
}),
|
|
1694
|
+
w.value === "bottom" ? c : void 0
|
|
1695
|
+
]), u = ne.value && re.value ? [C.value === "top" ? N("div", { style: { overflow: "hidden" } }, [N(D, {
|
|
1696
|
+
...ne.value,
|
|
1697
|
+
class: `semi-form-col-${te.value}`
|
|
1698
|
+
}, () => s)]) : N(D, {
|
|
1699
|
+
...ne.value,
|
|
1700
|
+
class: `semi-form-col-${te.value}`
|
|
1701
|
+
}, () => s), N(D, re.value, () => l)] : [s, l];
|
|
1702
|
+
return N("div", {
|
|
1703
|
+
class: [
|
|
1704
|
+
"semi-form-field",
|
|
1705
|
+
i.name ? `semi-form-field-${i.name}` : void 0,
|
|
1706
|
+
i.fieldClassName
|
|
1707
|
+
],
|
|
1708
|
+
style: i.fieldStyle,
|
|
1709
|
+
"x-label-pos": C.value,
|
|
1710
|
+
"x-field-id": p.value,
|
|
1711
|
+
"x-extra-pos": w.value
|
|
1712
|
+
}, u);
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
});
|
|
1716
|
+
return Object.defineProperty(i, "__semiFormField", { value: !0 }), i;
|
|
1717
|
+
}
|
|
1718
|
+
function en(e) {
|
|
1719
|
+
return F(e) && e.type !== me && typeof e.type == "object" && !!e.type.__semiFormField;
|
|
1720
|
+
}
|
|
1721
|
+
var tn = $;
|
|
1722
|
+
//#endregion
|
|
1723
|
+
//#region src/form/FormInputGroup.ts
|
|
1724
|
+
function nn(e, t = []) {
|
|
1725
|
+
for (let n of e) Array.isArray(n) ? nn(n, t) : F(n) && n.type === he && Array.isArray(n.children) ? nn(n.children, t) : t.push(n);
|
|
1726
|
+
return t;
|
|
1727
|
+
}
|
|
1728
|
+
function rn(e, t) {
|
|
1729
|
+
return t.replaceAll("[", ".").replaceAll("]", "").split(".").filter(Boolean).reduce((e, t) => {
|
|
1730
|
+
if (!(typeof e != "object" || !e)) return e[t];
|
|
1731
|
+
}, e);
|
|
1732
|
+
}
|
|
1733
|
+
var an = M({
|
|
1734
|
+
name: "FormInputGroup",
|
|
1735
|
+
inheritAttrs: !1,
|
|
1736
|
+
props: {
|
|
1737
|
+
disabled: {
|
|
1738
|
+
type: Boolean,
|
|
1739
|
+
default: void 0
|
|
1740
|
+
},
|
|
1741
|
+
extraText: {
|
|
1742
|
+
type: null,
|
|
1743
|
+
default: void 0
|
|
1744
|
+
},
|
|
1745
|
+
extraTextPosition: {
|
|
1746
|
+
type: String,
|
|
1747
|
+
default: "bottom"
|
|
1748
|
+
},
|
|
1749
|
+
label: {
|
|
1750
|
+
type: null,
|
|
1751
|
+
default: void 0
|
|
1752
|
+
},
|
|
1753
|
+
labelPosition: {
|
|
1754
|
+
type: String,
|
|
1755
|
+
default: void 0
|
|
1756
|
+
},
|
|
1757
|
+
size: {
|
|
1758
|
+
type: String,
|
|
1759
|
+
default: "default"
|
|
1760
|
+
}
|
|
1761
|
+
},
|
|
1762
|
+
setup(e, { attrs: t, slots: n }) {
|
|
1763
|
+
let r = P(Z);
|
|
1764
|
+
if (!r) return console.warn("[Semi Form]: InputGroup must be used inside Form"), () => null;
|
|
1765
|
+
let i = O(() => nn(n.default?.() ?? []).filter(en).map((e) => e.props?.field).filter((e) => typeof e == "string")), a = O(() => i.value.map((e) => rn(r.state.value.errors, e)).filter(Boolean)), o = () => {
|
|
1766
|
+
if (!e.label) return;
|
|
1767
|
+
let t = e.label && typeof e.label == "object" && !F(e.label) ? e.label : { text: e.label };
|
|
1768
|
+
return N(qt, {
|
|
1769
|
+
align: r.props.labelAlign ?? "left",
|
|
1770
|
+
width: r.props.labelWidth,
|
|
1771
|
+
disabled: r.props.disabled,
|
|
1772
|
+
...t
|
|
1773
|
+
});
|
|
1774
|
+
}, s = () => nn(n.default?.() ?? []).filter(en).map((e) => ge(e, { isInInputGroup: !0 })), c = () => e.extraText ? N("div", {
|
|
1775
|
+
class: [
|
|
1776
|
+
"semi-form-field-extra",
|
|
1777
|
+
typeof e.extraText == "string" ? "semi-form-field-extra-string" : void 0,
|
|
1778
|
+
`semi-form-field-extra-${e.extraTextPosition}`
|
|
1779
|
+
],
|
|
1780
|
+
"x-semi-prop": "extraText"
|
|
1781
|
+
}, [N(Q, { content: e.extraText })]) : void 0;
|
|
1782
|
+
return () => {
|
|
1783
|
+
let n = o(), i = c(), l = N(C, {
|
|
1784
|
+
...t,
|
|
1785
|
+
disabled: e.disabled ?? r.props.disabled,
|
|
1786
|
+
size: e.size
|
|
1787
|
+
}, () => s()), u = N(Ht, {
|
|
1788
|
+
error: a.value,
|
|
1789
|
+
showValidateIcon: r.props.showValidateIcon,
|
|
1790
|
+
isInInputGroup: !0,
|
|
1791
|
+
validateStatus: a.value.length ? "error" : "default"
|
|
1792
|
+
}), d = N("div", null, [
|
|
1793
|
+
e.extraTextPosition === "middle" ? i : void 0,
|
|
1794
|
+
l,
|
|
1795
|
+
e.extraTextPosition === "bottom" ? i : void 0,
|
|
1796
|
+
u
|
|
1797
|
+
]), f = e.labelPosition ?? r.props.labelPosition ?? "top", p = r.props.labelCol && r.props.wrapperCol ? [f === "top" ? N("div", { style: { overflow: "hidden" } }, [N(D, {
|
|
1798
|
+
...r.props.labelCol,
|
|
1799
|
+
class: `semi-form-col-${r.props.labelAlign}`
|
|
1800
|
+
}, () => n)]) : N(D, {
|
|
1801
|
+
...r.props.labelCol,
|
|
1802
|
+
class: `semi-form-col-${r.props.labelAlign}`
|
|
1803
|
+
}, () => n), N(D, r.props.wrapperCol, () => d)] : [n, d];
|
|
1804
|
+
return N("div", {
|
|
1805
|
+
class: "semi-form-field-group",
|
|
1806
|
+
"x-label-pos": f
|
|
1807
|
+
}, p);
|
|
1808
|
+
};
|
|
1809
|
+
}
|
|
1810
|
+
}), on = { class: "semi-form-section-text" }, sn = /* @__PURE__ */ M({
|
|
1811
|
+
name: "FormSection",
|
|
1812
|
+
__name: "FormSection",
|
|
1813
|
+
props: {
|
|
1814
|
+
className: { type: [
|
|
1815
|
+
Boolean,
|
|
1816
|
+
null,
|
|
1817
|
+
String,
|
|
1818
|
+
Object,
|
|
1819
|
+
Array
|
|
1820
|
+
] },
|
|
1821
|
+
style: {},
|
|
1822
|
+
text: { type: [
|
|
1823
|
+
Object,
|
|
1824
|
+
String,
|
|
1825
|
+
Number,
|
|
1826
|
+
Boolean,
|
|
1827
|
+
null,
|
|
1828
|
+
Array
|
|
1829
|
+
] }
|
|
1830
|
+
},
|
|
1831
|
+
setup(e) {
|
|
1832
|
+
let t = e;
|
|
1833
|
+
return (e, n) => (I(), j("section", {
|
|
1834
|
+
class: Ce(["semi-form-section", t.className]),
|
|
1835
|
+
style: Te(t.style)
|
|
1836
|
+
}, [_e("h5", on, [R(e.$slots, "text", {}, () => [ve(z(Q), { content: t.text }, null, 8, ["content"])])]), R(e.$slots, "default")], 6));
|
|
1837
|
+
}
|
|
1838
|
+
}), cn = M({
|
|
1839
|
+
name: "FormSlot",
|
|
1840
|
+
inheritAttrs: !1,
|
|
1841
|
+
props: {
|
|
1842
|
+
className: {
|
|
1843
|
+
type: null,
|
|
1844
|
+
default: void 0
|
|
1845
|
+
},
|
|
1846
|
+
error: {
|
|
1847
|
+
type: null,
|
|
1848
|
+
default: void 0
|
|
1849
|
+
},
|
|
1850
|
+
label: {
|
|
1851
|
+
type: null,
|
|
1852
|
+
default: void 0
|
|
1853
|
+
},
|
|
1854
|
+
labelPosition: {
|
|
1855
|
+
type: String,
|
|
1856
|
+
default: void 0
|
|
1857
|
+
},
|
|
1858
|
+
noLabel: {
|
|
1859
|
+
type: Boolean,
|
|
1860
|
+
default: !1
|
|
1861
|
+
},
|
|
1862
|
+
style: {
|
|
1863
|
+
type: null,
|
|
1864
|
+
default: void 0
|
|
1865
|
+
}
|
|
1866
|
+
},
|
|
1867
|
+
setup(e, { attrs: t, slots: n }) {
|
|
1868
|
+
let r = P(Z, void 0);
|
|
1869
|
+
return () => {
|
|
1870
|
+
let i = e.labelPosition ?? r?.props.labelPosition ?? "top", a = e.label && typeof e.label == "object" && !F(e.label) ? e.label : { text: e.label }, o = e.noLabel ? void 0 : N(qt, {
|
|
1871
|
+
align: r?.props.labelAlign ?? "left",
|
|
1872
|
+
width: r?.props.labelWidth,
|
|
1873
|
+
...a
|
|
1874
|
+
}), s = e.error && typeof e.error == "object" && !F(e.error) ? e.error : { error: e.error }, c = N("div", { class: ["semi-form-field-main", "semi-form-slot-main"] }, [...n.default?.() ?? [], e.error === void 0 ? void 0 : N(Ht, s)]), l = r?.props.labelCol && r.props.wrapperCol ? [i === "top" ? N("div", { style: { overflow: "hidden" } }, [N(D, r.props.labelCol, () => o)]) : N(D, r.props.labelCol, () => o), N(D, r.props.wrapperCol, () => c)] : [o, c];
|
|
1875
|
+
return N("div", {
|
|
1876
|
+
...t,
|
|
1877
|
+
class: [
|
|
1878
|
+
"semi-form-field",
|
|
1879
|
+
"semi-form-slot",
|
|
1880
|
+
e.className,
|
|
1881
|
+
t.class
|
|
1882
|
+
],
|
|
1883
|
+
style: [e.style, t.style],
|
|
1884
|
+
"x-label-pos": i
|
|
1885
|
+
}, l);
|
|
1886
|
+
};
|
|
1887
|
+
}
|
|
1888
|
+
});
|
|
1889
|
+
//#endregion
|
|
1890
|
+
//#region src/form/use-form.ts
|
|
1891
|
+
function ln() {
|
|
1892
|
+
return {
|
|
1893
|
+
values: {},
|
|
1894
|
+
errors: {},
|
|
1895
|
+
touched: {}
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
function un() {
|
|
1899
|
+
let e = je(ln()), t;
|
|
1900
|
+
return [
|
|
1901
|
+
new Proxy({
|
|
1902
|
+
__bind(n) {
|
|
1903
|
+
t = n, e.value = n.getFormState();
|
|
1904
|
+
},
|
|
1905
|
+
__unbind() {
|
|
1906
|
+
t = void 0, e.value = ln();
|
|
1907
|
+
},
|
|
1908
|
+
__updateState(t) {
|
|
1909
|
+
e.value = t;
|
|
1910
|
+
}
|
|
1911
|
+
}, { get(e, n) {
|
|
1912
|
+
if (typeof n == "string" && n.startsWith("__")) return Reflect.get(e, n);
|
|
1913
|
+
let r = t?.[n];
|
|
1914
|
+
return typeof r == "function" ? r.bind(t) : !t && typeof n == "string" ? () => {
|
|
1915
|
+
console.warn(`[Semi Form] FormApi.${n}() is called before Form component is mounted. Please ensure the Form component is rendered first.`);
|
|
1916
|
+
} : r;
|
|
1917
|
+
} }),
|
|
1918
|
+
e,
|
|
1919
|
+
O(() => e.value.values)
|
|
1920
|
+
];
|
|
1921
|
+
}
|
|
1922
|
+
function dn() {
|
|
1923
|
+
let e = P(Z);
|
|
1924
|
+
if (!e) throw Error("[Semi Form]: useFormApi must be used inside Form");
|
|
1925
|
+
return e.api;
|
|
1926
|
+
}
|
|
1927
|
+
function fn() {
|
|
1928
|
+
let e = P(Z);
|
|
1929
|
+
if (!e) throw Error("[Semi Form]: useFormState must be used inside Form");
|
|
1930
|
+
return e.state;
|
|
1931
|
+
}
|
|
1932
|
+
function pn(e) {
|
|
1933
|
+
let t = dn();
|
|
1934
|
+
return {
|
|
1935
|
+
getError: () => t.getError(e),
|
|
1936
|
+
setError: (n) => t.setError(e, n),
|
|
1937
|
+
getTouched: () => t.getTouched(e),
|
|
1938
|
+
setTouched: (n) => t.setTouched(e, n),
|
|
1939
|
+
getValue: () => t.getValue(e),
|
|
1940
|
+
setValue: (n) => t.setValue(e, n)
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
function mn(e) {
|
|
1944
|
+
let t = fn();
|
|
1945
|
+
return O(() => ({
|
|
1946
|
+
value: hn(t.value.values, e),
|
|
1947
|
+
error: hn(t.value.errors, e),
|
|
1948
|
+
touched: hn(t.value.touched, e)
|
|
1949
|
+
}));
|
|
1950
|
+
}
|
|
1951
|
+
function hn(e, t) {
|
|
1952
|
+
return t.replaceAll("[", ".").replaceAll("]", "").split(".").filter(Boolean).reduce((e, t) => {
|
|
1953
|
+
if (!(typeof e != "object" || !e)) return e[t];
|
|
1954
|
+
}, e);
|
|
1955
|
+
}
|
|
1956
|
+
//#endregion
|
|
1957
|
+
//#region src/form/with-form.ts
|
|
1958
|
+
function gn(e) {
|
|
1959
|
+
return M({
|
|
1960
|
+
name: "WithFormApi",
|
|
1961
|
+
inheritAttrs: !1,
|
|
1962
|
+
setup(t, { attrs: n, slots: r }) {
|
|
1963
|
+
let i = P(Z);
|
|
1964
|
+
if (!i) throw Error("[Semi Form]: withFormApi component must be used inside Form");
|
|
1965
|
+
return () => N(e, {
|
|
1966
|
+
...n,
|
|
1967
|
+
formApi: i.api
|
|
1968
|
+
}, r);
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
}
|
|
1972
|
+
function _n(e) {
|
|
1973
|
+
return M({
|
|
1974
|
+
name: "WithFormState",
|
|
1975
|
+
inheritAttrs: !1,
|
|
1976
|
+
setup(t, { attrs: n, slots: r }) {
|
|
1977
|
+
let i = P(Z);
|
|
1978
|
+
if (!i) throw Error("[Semi Form]: withFormState component must be used inside Form");
|
|
1979
|
+
return () => N(e, {
|
|
1980
|
+
...n,
|
|
1981
|
+
formState: i.state.value
|
|
1982
|
+
}, r);
|
|
1983
|
+
}
|
|
1984
|
+
});
|
|
1985
|
+
}
|
|
1986
|
+
//#endregion
|
|
1987
|
+
//#region src/form/index.ts
|
|
1988
|
+
var vn = $(te, { maintainCursor: !0 }), yn = $(E, { maintainCursor: !0 }), bn = $(ee, { maintainCursor: !0 }), xn = $(de), Sn = Object.assign(xn, {
|
|
1989
|
+
Option: ae,
|
|
1990
|
+
OptGroup: ue
|
|
1991
|
+
}), Cn = $(x), wn = $(S, {
|
|
1992
|
+
valueProp: "checked",
|
|
1993
|
+
valuePath: "target.checked",
|
|
1994
|
+
shouldInjectByDefault: !1
|
|
1995
|
+
}), Tn = $(re, { valuePath: "target.value" }), En = $(w, {
|
|
1996
|
+
valueProp: "checked",
|
|
1997
|
+
valuePath: "target.checked",
|
|
1998
|
+
shouldInjectByDefault: !1
|
|
1999
|
+
}), Dn = $(h), On = $(T, { valueProp: "checked" }), kn = $(fe), An = $(g), jn = $(se), Mn = $(_), Nn = $(ie), Pn = $(b), Fn = Object.assign(Pn, { Option: y }), In = $(ce, {
|
|
2000
|
+
valueProp: "fileList",
|
|
2001
|
+
valuePath: "fileList"
|
|
2002
|
+
}), Ln = $(oe), Rn = $(ne), zn = Lt, Bn = Object.assign(Bt, {
|
|
2003
|
+
AutoComplete: Fn,
|
|
2004
|
+
Cascader: Mn,
|
|
2005
|
+
Checkbox: wn,
|
|
2006
|
+
CheckboxGroup: Cn,
|
|
2007
|
+
DatePicker: Dn,
|
|
2008
|
+
ErrorMessage: Ht,
|
|
2009
|
+
Input: vn,
|
|
2010
|
+
InputGroup: an,
|
|
2011
|
+
InputNumber: yn,
|
|
2012
|
+
Label: qt,
|
|
2013
|
+
PinCode: Rn,
|
|
2014
|
+
Radio: En,
|
|
2015
|
+
RadioGroup: Tn,
|
|
2016
|
+
Rating: Nn,
|
|
2017
|
+
Section: sn,
|
|
2018
|
+
Select: Sn,
|
|
2019
|
+
Slider: kn,
|
|
2020
|
+
Slot: cn,
|
|
2021
|
+
Switch: On,
|
|
2022
|
+
TagInput: Ln,
|
|
2023
|
+
TextArea: bn,
|
|
2024
|
+
TimePicker: An,
|
|
2025
|
+
TreeSelect: jn,
|
|
2026
|
+
Upload: In,
|
|
2027
|
+
useForm: un
|
|
2028
|
+
}), Vn = $;
|
|
2029
|
+
//#endregion
|
|
2030
|
+
export { $ as A, gn as C, un as D, mn as E, dn as O, In as S, pn as T, On as _, Mn as a, An as b, Dn as c, Rn as d, En as f, kn as g, Sn as h, Fn as i, tn as j, fn as k, vn as l, Nn as m, Vn as n, wn as o, Tn as p, Bn as r, Cn as s, zn as t, yn as u, Ln as v, _n as w, jn as x, bn as y };
|