maz-ui 4.0.0-beta.8 → 4.0.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/README.md +1 -1
- package/dist/assets/{MazAnimatedCounter.DkZNPRLp.css → MazAnimatedCounter.LK7oyUrl.css} +1 -1
- package/dist/assets/MazAnimatedText.CHvAudRU.css +1 -0
- package/dist/assets/MazBackdrop.09bziTPM.css +1 -0
- package/dist/assets/{MazBadge.DN8tdE8_.css → MazBadge.ChI2DaTU.css} +1 -1
- package/dist/assets/MazBtn.BvC8ftmc.css +1 -0
- package/dist/assets/MazCard.Dv02b2P6.css +1 -0
- package/dist/assets/MazCardSpotlight.B7lFD7Pi.css +1 -0
- package/dist/assets/MazCarousel.BLHpZIu5.css +1 -0
- package/dist/assets/MazCheckbox.Di88TJ3e.css +1 -0
- package/dist/assets/MazChecklist.Bu8wERn6.css +1 -0
- package/dist/assets/MazDatePicker.G6V7jjin.css +1 -0
- package/dist/assets/{MazDialog.DEmRfAv7.css → MazDialog.TS06kRcu.css} +1 -1
- package/dist/assets/MazDropdown.D90GEKDB.css +1 -0
- package/dist/assets/MazDropzone._2HwHowu.css +1 -0
- package/dist/assets/MazGallery.BTNB3D6k.css +1 -0
- package/dist/assets/MazInput.BvuxfP9k.css +1 -0
- package/dist/assets/MazInputCode.BYi64Mof.css +1 -0
- package/dist/assets/MazInputPhoneNumber.Baeyskod.css +1 -0
- package/dist/assets/MazInputTags.is2jSJk-.css +1 -0
- package/dist/assets/MazLazyImg.DO7a4PDm.css +1 -0
- package/dist/assets/MazLink.CFscNMFr.css +1 -0
- package/dist/assets/{MazPagination.C6cUh-p4.css → MazPagination.BUhf2Qr7.css} +1 -1
- package/dist/assets/MazPickerCalendar.e-eF8E7m.css +1 -0
- package/dist/assets/MazPickerCalendarMonth.DpijYq-O.css +1 -0
- package/dist/assets/{MazPickerCalendarSwitcher.uni8vJJv.css → MazPickerCalendarSwitcher.ByAVjy00.css} +1 -1
- package/dist/assets/{MazPickerContainer.k3DGjyHC.css → MazPickerContainer.DmHuaFqE.css} +1 -1
- package/dist/assets/{MazPickerHeader.ZYCJY5bX.css → MazPickerHeader.D7JXgA3q.css} +1 -1
- package/dist/assets/MazPickerMonthSwitcher.BJGGy53r.css +1 -0
- package/dist/assets/{MazPickerYearSwitcher.Cn-nS-Vv.css → MazPickerYearSwitcher.DPD1_dfz.css} +1 -1
- package/dist/assets/MazPopover.DIE65uVT.css +1 -0
- package/dist/assets/MazPullToRefresh.C0HGlupm.css +1 -0
- package/dist/assets/MazRadio.B0B3P1QS.css +1 -0
- package/dist/assets/MazRadioButtons.CfiHq8H9.css +1 -0
- package/dist/assets/MazReadingProgressBar.dzfwQFNg.css +1 -0
- package/dist/assets/MazSelect.DIwjMD31.css +1 -0
- package/dist/assets/{MazSelectCountry.CdNTQPhr.css → MazSelectCountry.B0tlbfgr.css} +1 -1
- package/dist/assets/MazSlider.WcnBC9zc.css +1 -0
- package/dist/assets/MazSpinner.CsiFJ1DS.css +1 -0
- package/dist/assets/MazStepper.C9R7g43I.css +1 -0
- package/dist/assets/MazSwitch.LCcK91L7.css +1 -0
- package/dist/assets/MazTable.Cq7FEz09.css +1 -0
- package/dist/assets/MazTableRow.C0Ko4yDk.css +1 -0
- package/dist/assets/{MazTabsBar.gcS2Fc-B.css → MazTabsBar.BRr1XiYu.css} +1 -1
- package/dist/assets/{MazTabsContentItem.CHfy19ZF.css → MazTabsContentItem.C84SDmj0.css} +1 -1
- package/dist/assets/MazTextarea.C9sZpRDZ.css +1 -0
- package/dist/assets/{PhoneInput.DBLH22G1.css → PhoneInput.DkOXlrI9.css} +1 -1
- package/dist/assets/{fullscreen-img.Bkuz1GOX.css → fullscreen-img.Br983fLC.css} +1 -1
- package/dist/assets/{toast.CC2VQab8.css → toast.BDNNJSjj.css} +1 -1
- package/dist/chunks/{MazDatePicker.De3Ltb2F.js → MazDatePicker.B1B6gUrC.js} +49 -37
- package/dist/chunks/{MazDialogConfirm.vue_vue_type_script_setup_true_lang.-K3NpiFL.js → MazDialogConfirm.vue_vue_type_script_setup_true_lang.DuEcluOw.js} +23 -13
- package/dist/chunks/{MazDropdown.vue_vue_type_style_index_0_lang.BES3jpuw.js → MazDropdown.vue_vue_type_style_index_0_lang.DULnKQ2W.js} +16 -10
- package/dist/chunks/{MazInputNumber.vue_vue_type_style_index_0_lang.B6DYpHfi.js → MazInputNumber.vue_vue_type_style_index_0_lang.B0D4Zzds.js} +2 -2
- package/dist/chunks/{MazInputPhoneNumber.DBncAmC5.js → MazInputPhoneNumber.CDy6n_Qj.js} +25 -17
- package/dist/chunks/{MazInputPrice.vue_vue_type_script_setup_true_lang.BA6TDX-T.js → MazInputPrice.vue_vue_type_script_setup_true_lang.3pKYuG8H.js} +18 -18
- package/dist/chunks/{MazPickerCalendar.DKXNI8O4.js → MazPickerCalendar.BSBQciuG.js} +8 -8
- package/dist/chunks/{MazPickerCalendarMonth.DKBqgrNp.js → MazPickerCalendarMonth.CFJHTFp5.js} +14 -14
- package/dist/chunks/{MazPickerCalendarSwitcher.CzIZol3Z.js → MazPickerCalendarSwitcher.DC21FpTy.js} +10 -10
- package/dist/chunks/{MazPickerContainer.Mrh-Q52I.js → MazPickerContainer.CRPzAbRt.js} +4 -6
- package/dist/chunks/{MazPickerHeader.Bm9vIrtB.js → MazPickerHeader.D7Tbm-yH.js} +14 -14
- package/dist/chunks/{MazPickerMonthSwitcher.BSD2GtY6.js → MazPickerMonthSwitcher.DzHOKbe4.js} +10 -10
- package/dist/chunks/{MazPickerTime.D0hilq5b.js → MazPickerTime.EZK1foEx.js} +1 -1
- package/dist/chunks/{MazPickerYearSwitcher.BIUYJMvj.js → MazPickerYearSwitcher.BcT8GENl.js} +4 -4
- package/dist/chunks/{MazSwitch.vue_vue_type_style_index_0_lang.CU43Y1ky.js → MazSwitch.vue_vue_type_style_index_0_lang.Dz7-dIc9.js} +1 -1
- package/dist/chunks/{MazTable.vue_vue_type_script_setup_true_lang.BcTw9Tyh.js → MazTable.vue_vue_type_script_setup_true_lang.Ct1Gtp2Q.js} +5 -5
- package/dist/chunks/{MazTabsContent.vue_vue_type_script_setup_true_lang.arGqYTL5.js → MazTabsContent.vue_vue_type_script_setup_true_lang.hIwO-24k.js} +2 -2
- package/dist/chunks/{PhoneInput.iFkRoIFk.js → PhoneInput.DukRZp5u.js} +20 -27
- package/dist/chunks/capitalize.CVQ1jDrh.js +6 -0
- package/dist/chunks/checkAvailability.UFZSC8-1.js +16 -0
- package/dist/chunks/debounce.DhXdop6X.js +11 -0
- package/dist/chunks/{dom-events.Bbe7wDQl.js → dom-events.H9KIOv83.js} +52 -52
- package/dist/chunks/{fullscreen-img.directive.Be383en8.js → fullscreen-img.directive.D9oQ3Gni.js} +4 -4
- package/dist/chunks/{isClient.WI4oSt66.js → isClient.8V3qjGdO.js} +2 -2
- package/dist/chunks/{mazUi.D6UdqpTO.js → mazUi.0b7z2u9g.js} +2 -2
- package/dist/chunks/{obsidian.Cy0R8RHy.js → obsidian.C6upWOVF.js} +2 -2
- package/dist/chunks/{ocean.pHrY5H_S.js → ocean.ehMlC0HV.js} +2 -2
- package/dist/chunks/pascalCase.BKTE3qqE.js +19 -0
- package/dist/chunks/{pristine.ylgbwjxO.js → pristine.DMG3eBuN.js} +6 -6
- package/dist/chunks/sleep.Ci7GE4BQ.js +6 -0
- package/dist/chunks/truthyFilter.DZvXmxeK.js +6 -0
- package/dist/chunks/types.D0Bp_UhS.js +6 -0
- package/dist/chunks/{useStringMatching.D5UvsCUS.js → useStringMatching.DzSigyZ7.js} +40 -14
- package/dist/chunks/{vClickOutside.DIOiluy0.js → vClickOutside.CJBKY5no.js} +6 -6
- package/dist/components/MazAccordion.vue.d.ts +36 -0
- package/dist/components/MazAnimatedCounter.js +5 -5
- package/dist/components/MazAnimatedCounter.vue.d.ts +59 -0
- package/dist/components/MazAnimatedElement.vue.d.ts +44 -0
- package/dist/components/MazAnimatedText.js +4 -4
- package/dist/components/MazAnimatedText.vue.d.ts +57 -0
- package/dist/components/MazAvatar.vue.d.ts +99 -0
- package/dist/components/MazBackdrop.js +70 -31
- package/dist/components/MazBackdrop.vue.d.ts +91 -0
- package/dist/components/MazBadge.js +5 -4
- package/dist/components/MazBadge.vue.d.ts +61 -0
- package/dist/components/MazBottomSheet.vue.d.ts +35 -0
- package/dist/components/MazBtn.js +6 -5
- package/dist/components/MazBtn.vue.d.ts +105 -0
- package/dist/components/MazCard.js +3 -3
- package/dist/components/MazCard.vue.d.ts +77 -0
- package/dist/components/MazCardSpotlight.js +2 -2
- package/dist/components/MazCardSpotlight.vue.d.ts +57 -0
- package/dist/components/MazCarousel.js +12 -9
- package/dist/components/MazCarousel.vue.d.ts +48 -0
- package/dist/components/MazChart.vue.d.ts +53 -0
- package/dist/components/MazCheckbox.js +2 -2
- package/dist/components/MazCheckbox.vue.d.ts +55 -0
- package/dist/components/MazChecklist.js +7 -7
- package/dist/components/MazChecklist.vue.d.ts +87 -0
- package/dist/components/MazCircularProgressBar.vue.d.ts +106 -0
- package/dist/components/MazDatePicker/MazPickerCalendar.vue.d.ts +27 -0
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarDays.vue.d.ts +20 -0
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarGrid.vue.d.ts +125 -0
- package/dist/components/MazDatePicker/MazPickerCalendarMonth/MazPickerCalendarMonth.vue.d.ts +134 -0
- package/dist/components/MazDatePicker/MazPickerCalendarSwitcher.vue.d.ts +42 -0
- package/dist/components/MazDatePicker/MazPickerContainer.vue.d.ts +38 -0
- package/dist/components/MazDatePicker/MazPickerHeader.vue.d.ts +15 -0
- package/dist/components/MazDatePicker/MazPickerMonthSwitcher.vue.d.ts +44 -0
- package/dist/components/MazDatePicker/MazPickerShortcuts.vue.d.ts +16 -0
- package/dist/components/MazDatePicker/MazPickerTime.vue.d.ts +107 -0
- package/dist/components/MazDatePicker/MazPickerYearSwitcher.vue.d.ts +36 -0
- package/dist/components/MazDatePicker/types.d.ts +14 -0
- package/dist/components/MazDatePicker/utils.d.ts +61 -0
- package/dist/components/MazDatePicker.js +1 -1
- package/dist/components/MazDatePicker.vue.d.ts +547 -0
- package/dist/components/MazDialog.js +9 -16
- package/dist/components/MazDialog.vue.d.ts +247 -0
- package/dist/components/MazDialogConfirm/useMazDialogConfirm.d.ts +47 -0
- package/dist/components/MazDialogConfirm.js +2 -2
- package/dist/components/MazDialogConfirm.vue.d.ts +270 -0
- package/dist/components/MazDrawer.vue.d.ts +52 -0
- package/dist/components/MazDropdown.js +1 -1
- package/dist/components/MazDropdown.vue.d.ts +249 -0
- package/dist/components/MazDropzone.js +6 -6
- package/dist/components/MazDropzone.vue.d.ts +305 -0
- package/dist/components/MazExpandAnimation.vue.d.ts +44 -0
- package/dist/components/MazFullscreenLoader.vue.d.ts +26 -0
- package/dist/components/MazGallery.js +4 -4
- package/dist/components/MazGallery.vue.d.ts +85 -0
- package/dist/components/MazIcon.vue.d.ts +26 -0
- package/dist/components/MazInput.js +4 -4
- package/dist/components/MazInput.vue.d.ts +225 -0
- package/dist/components/MazInputCode.js +2 -2
- package/dist/components/MazInputCode.vue.d.ts +49 -0
- package/dist/components/MazInputNumber.js +1 -1
- package/dist/components/MazInputNumber.vue.d.ts +125 -0
- package/dist/components/MazInputPhoneNumber/PhoneInput.vue.d.ts +29 -0
- package/dist/components/MazInputPhoneNumber/useLibphonenumber.d.ts +26 -0
- package/dist/components/MazInputPhoneNumber/useMazInputPhoneNumber.d.ts +26 -0
- package/dist/components/MazInputPhoneNumber.js +1 -1
- package/dist/components/MazInputPhoneNumber.vue.d.ts +421 -0
- package/dist/components/MazInputPrice.js +1 -1
- package/dist/components/MazInputPrice.vue.d.ts +48 -0
- package/dist/components/MazInputTags.js +6 -6
- package/dist/components/MazInputTags.vue.d.ts +51 -0
- package/dist/components/MazLazyImg.js +2 -2
- package/dist/components/MazLazyImg.vue.d.ts +78 -0
- package/dist/components/MazLink.js +2 -2
- package/dist/components/MazLink.vue.d.ts +115 -0
- package/dist/components/MazLoadingBar.vue.d.ts +12 -0
- package/dist/components/MazPagination.js +3 -3
- package/dist/components/MazPagination.vue.d.ts +83 -0
- package/dist/components/MazPopover.js +98 -222
- package/dist/components/MazPopover.vue.d.ts +256 -0
- package/dist/components/MazPullToRefresh.js +7 -7
- package/dist/components/MazPullToRefresh.vue.d.ts +52 -0
- package/dist/components/MazRadio.js +2 -2
- package/dist/components/MazRadio.vue.d.ts +55 -0
- package/dist/components/MazRadioButtons.js +8 -7
- package/dist/components/MazRadioButtons.vue.d.ts +69 -0
- package/dist/components/MazReadingProgressBar.js +8 -8
- package/dist/components/MazReadingProgressBar.vue.d.ts +55 -0
- package/dist/components/MazSelect.js +17 -14
- package/dist/components/MazSelect.vue.d.ts +178 -0
- package/dist/components/MazSelectCountry.js +19 -18
- package/dist/components/MazSelectCountry.vue.d.ts +171 -0
- package/dist/components/MazSlider/utils.d.ts +15 -0
- package/dist/components/MazSlider.js +36 -36
- package/dist/components/MazSlider.vue.d.ts +31 -0
- package/dist/components/MazSpinner.js +3 -4
- package/dist/components/MazSpinner.vue.d.ts +15 -0
- package/dist/components/MazStepper.js +2 -2
- package/dist/components/MazStepper.vue.d.ts +60 -0
- package/dist/components/MazSwitch.js +1 -1
- package/dist/components/MazSwitch.vue.d.ts +69 -0
- package/dist/components/MazTable.js +3 -3
- package/dist/components/MazTable.vue.d.ts +324 -0
- package/dist/components/MazTableCell.js +1 -1
- package/dist/components/MazTableCell.vue.d.ts +17 -0
- package/dist/components/MazTableRow.js +6 -5
- package/dist/components/MazTableRow.vue.d.ts +23 -0
- package/dist/components/MazTableTitle.js +1 -1
- package/dist/components/MazTableTitle.vue.d.ts +17 -0
- package/dist/components/MazTabs.vue.d.ts +30 -0
- package/dist/components/MazTabsBar.js +4 -4
- package/dist/components/MazTabsBar.vue.d.ts +96 -0
- package/dist/components/MazTabsContent.js +1 -1
- package/dist/components/MazTabsContent.vue.d.ts +17 -0
- package/dist/components/MazTabsContentItem.js +6 -7
- package/dist/components/MazTabsContentItem.vue.d.ts +31 -0
- package/dist/components/MazTextarea.js +6 -6
- package/dist/components/MazTextarea.vue.d.ts +88 -0
- package/dist/components/constantes.d.ts +2 -0
- package/dist/components/index.d.ts +109 -0
- package/dist/components/index.js +8 -8
- package/dist/components/types.d.ts +4 -0
- package/dist/composables/index.d.ts +21 -0
- package/dist/composables/index.js +3 -1
- package/dist/composables/useAos.d.ts +2 -0
- package/dist/composables/useBreakpoints.d.ts +38 -0
- package/dist/composables/useDialog.d.ts +2 -0
- package/dist/composables/useDisplayNames.d.ts +101 -0
- package/dist/composables/useDisplayNames.js +20 -28
- package/dist/composables/useDropzone.d.ts +27 -0
- package/dist/composables/useDropzone.js +6 -6
- package/dist/composables/useFormField.d.ts +16 -0
- package/dist/composables/useFormField.js +3 -3
- package/dist/composables/useFormValidator/config.d.ts +7 -0
- package/dist/composables/useFormValidator/dom-events.d.ts +19 -0
- package/dist/composables/useFormValidator/state-management.d.ts +72 -0
- package/dist/composables/useFormValidator/types.d.ts +98 -0
- package/dist/composables/useFormValidator/validation.d.ts +37 -0
- package/dist/composables/useFormValidator.d.ts +23 -0
- package/dist/composables/useFormValidator.js +19 -3
- package/dist/composables/useFreezeValue.d.ts +5 -0
- package/dist/composables/useIdleTimeout.d.ts +5 -0
- package/dist/composables/useIdleTimeout.js +27 -27
- package/dist/composables/useInjectStrict.d.ts +2 -0
- package/dist/composables/useInstanceUniqId.d.ts +4 -0
- package/dist/composables/useInstanceUniqId.js +3 -2
- package/dist/composables/useMountComponent.d.ts +14 -0
- package/dist/composables/useReadingTime.d.ts +25 -0
- package/dist/composables/useStringMatching.d.ts +5 -0
- package/dist/composables/useStringMatching.js +1 -1
- package/dist/composables/useSwipe.d.ts +14 -0
- package/dist/composables/useSwipe.js +22 -22
- package/dist/composables/useTimer.d.ts +30 -0
- package/dist/composables/useToast.d.ts +22 -0
- package/dist/composables/useUserVisibility.d.ts +5 -0
- package/dist/composables/useUserVisibility.js +8 -8
- package/dist/composables/useWait.d.ts +2 -0
- package/dist/composables/useWindowSize.d.ts +32 -0
- package/dist/composables/useWindowSize.js +2 -2
- package/dist/css/main.css +1 -1
- package/dist/directives/index.d.ts +5 -0
- package/dist/directives/index.js +2 -2
- package/dist/directives/vClickOutside.d.ts +36 -0
- package/dist/directives/vClickOutside.js +1 -1
- package/dist/directives/vFullscreenImg/MazFullscreenImg.vue.d.ts +50 -0
- package/dist/directives/vFullscreenImg/fullscreen-img.directive.d.ts +5 -0
- package/dist/directives/vFullscreenImg/fullscreen-img.handler.d.ts +36 -0
- package/dist/directives/vFullscreenImg.d.ts +11 -0
- package/dist/directives/vFullscreenImg.js +1 -1
- package/dist/directives/vLazyImg/lazy-img.directive.d.ts +5 -0
- package/dist/directives/vLazyImg/lazy-img.handler.d.ts +38 -0
- package/dist/directives/vLazyImg/types.d.ts +29 -0
- package/dist/directives/vLazyImg.d.ts +12 -0
- package/dist/directives/vTooltip.d.ts +54 -0
- package/dist/directives/vTooltip.js +15 -23
- package/dist/directives/vZoomImg/style.d.ts +1 -0
- package/dist/directives/vZoomImg/svgs.d.ts +3 -0
- package/dist/directives/vZoomImg/zoom-img.directive.d.ts +8 -0
- package/dist/directives/vZoomImg/zoom-img.handler.d.ts +46 -0
- package/dist/directives/vZoomImg.d.ts +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/plugins/aos.d.ts +81 -0
- package/dist/plugins/aos.js +5 -5
- package/dist/plugins/dialog/DialogHandler.d.ts +16 -0
- package/dist/plugins/dialog.d.ts +26 -0
- package/dist/plugins/dialog.js +1 -1
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/maz-ui.d.ts +43 -0
- package/dist/plugins/maz-ui.js +245 -371
- package/dist/plugins/toast/MazToast.vue.d.ts +34 -0
- package/dist/plugins/toast/ToastHandler.d.ts +29 -0
- package/dist/plugins/toast/types.d.ts +104 -0
- package/dist/plugins/toast.d.ts +25 -0
- package/dist/plugins/toast.js +8 -6
- package/dist/plugins/wait.d.ts +33 -0
- package/dist/resolvers/MazComponentsResolver.d.ts +10 -0
- package/dist/resolvers/MazComponentsResolver.js +516 -10
- package/dist/resolvers/MazDirectivesResolver.d.ts +11 -0
- package/dist/resolvers/MazDirectivesResolver.js +2 -2
- package/dist/resolvers/MazModulesResolver.d.ts +11 -0
- package/dist/resolvers/MazModulesResolver.js +8 -5
- package/dist/resolvers/index.d.ts +3 -0
- package/dist/tailwindcss/index.d.ts +6 -0
- package/dist/tailwindcss/tailwind.config.d.ts +89 -0
- package/dist/tailwindcss/utils/colors.d.ts +7 -0
- package/dist/tailwindcss/variables/breakpoints.d.ts +15 -0
- package/dist/tailwindcss/variables/colors.d.ts +20 -0
- package/dist/tailwindcss/variables/design-tokens.d.ts +35 -0
- package/dist/tailwindcss/variables/utilities.d.ts +17 -0
- package/dist/tailwindcss/variables/z-indexes.d.ts +14 -0
- package/dist/types/components/MazAnimatedCounter.vue.d.ts +1 -1
- package/dist/types/components/MazBackdrop.vue.d.ts +26 -6
- package/dist/types/components/MazCard.vue.d.ts +1 -1
- package/dist/types/components/MazCarousel.vue.d.ts +8 -5
- package/dist/types/components/MazChecklist.vue.d.ts +5 -5
- package/dist/types/components/MazDatePicker/utils.d.ts +7 -6
- package/dist/types/components/MazDatePicker.vue.d.ts +37 -33
- package/dist/types/components/MazDialog.vue.d.ts +10 -19
- package/dist/types/components/MazDialogConfirm/useMazDialogConfirm.d.ts +8 -6
- package/dist/types/components/MazDialogConfirm.vue.d.ts +18 -12
- package/dist/types/components/MazDropdown.vue.d.ts +10 -3
- package/dist/types/components/MazInputNumber.vue.d.ts +4 -4
- package/dist/types/components/MazInputPhoneNumber/PhoneInput.vue.d.ts +1 -1
- package/dist/types/components/MazInputPhoneNumber/useLibphonenumber.d.ts +1 -1
- package/dist/types/components/MazInputPhoneNumber/useMazInputPhoneNumber.d.ts +2 -0
- package/dist/types/components/MazInputPhoneNumber.vue.d.ts +11 -12
- package/dist/types/components/MazInputPrice.vue.d.ts +3 -3
- package/dist/types/components/MazInputTags.vue.d.ts +1 -1
- package/dist/types/components/MazLink.vue.d.ts +1 -1
- package/dist/types/components/MazPopover.vue.d.ts +13 -8
- package/dist/types/components/MazRadioButtons.vue.d.ts +9 -9
- package/dist/types/components/MazReadingProgressBar.vue.d.ts +1 -1
- package/dist/types/components/MazSelect.vue.d.ts +13 -6
- package/dist/types/components/MazSelectCountry.vue.d.ts +9 -9
- package/dist/types/components/MazTable.vue.d.ts +5 -5
- package/dist/types/components/MazTableRow.vue.d.ts +2 -0
- package/dist/types/components/types.d.ts +1 -0
- package/dist/types/composables/index.d.ts +1 -0
- package/dist/types/composables/useDisplayNames.d.ts +60 -6
- package/dist/types/composables/useFormField.d.ts +16 -18
- package/dist/types/composables/useFormValidator/config.d.ts +2 -2
- package/dist/types/composables/useFormValidator/dom-events.d.ts +4 -4
- package/dist/types/composables/useFormValidator/state-management.d.ts +40 -22
- package/dist/types/composables/useFormValidator/types.d.ts +15 -15
- package/dist/types/composables/useFormValidator/validation.d.ts +10 -16
- package/dist/types/composables/useFormValidator.d.ts +2 -2
- package/dist/types/composables/useIdleTimeout.d.ts +1 -1
- package/dist/types/composables/useSwipe.d.ts +1 -1
- package/dist/types/composables/useUserVisibility.d.ts +1 -1
- package/dist/types/directives/vFullscreenImg/MazFullscreenImg.vue.d.ts +2 -2
- package/dist/types/directives/vZoomImg.d.ts +1 -1
- package/dist/types/plugins/maz-ui.d.ts +5 -5
- package/package.json +46 -36
- package/dist/assets/MazAnimatedText.DDqCxrFX.css +0 -1
- package/dist/assets/MazBackdrop.BnhcmjbP.css +0 -1
- package/dist/assets/MazBtn.DUBbj2mt.css +0 -1
- package/dist/assets/MazCard.C6nDaeIC.css +0 -1
- package/dist/assets/MazCardSpotlight.IbPp_y0j.css +0 -1
- package/dist/assets/MazCarousel.BaqN4hLP.css +0 -1
- package/dist/assets/MazCheckbox.CFqw9ybT.css +0 -1
- package/dist/assets/MazChecklist.BzF5KtZ3.css +0 -1
- package/dist/assets/MazDatePicker.8GyrtM-j.css +0 -1
- package/dist/assets/MazDropdown.C6vjLIeN.css +0 -1
- package/dist/assets/MazDropzone.-8lzCrxJ.css +0 -1
- package/dist/assets/MazGallery.DZ3TyggM.css +0 -1
- package/dist/assets/MazInput.BcUsJg7p.css +0 -1
- package/dist/assets/MazInputCode.CG6EJBEk.css +0 -1
- package/dist/assets/MazInputPhoneNumber.CrXS7DOY.css +0 -1
- package/dist/assets/MazInputTags.DzTGy9z3.css +0 -1
- package/dist/assets/MazLazyImg.NlPRN3Nk.css +0 -1
- package/dist/assets/MazLink.wJoKRsCP.css +0 -1
- package/dist/assets/MazPickerCalendar.CHpWIzhL.css +0 -1
- package/dist/assets/MazPickerCalendarMonth.Boe_8k4x.css +0 -1
- package/dist/assets/MazPickerMonthSwitcher.CszcpCcY.css +0 -1
- package/dist/assets/MazPopover.DzCAfuWw.css +0 -1
- package/dist/assets/MazPullToRefresh.BQ64UvzA.css +0 -1
- package/dist/assets/MazRadio.XGYnbTuB.css +0 -1
- package/dist/assets/MazRadioButtons.BA4rjgK9.css +0 -1
- package/dist/assets/MazReadingProgressBar.CwBVXE3g.css +0 -1
- package/dist/assets/MazSelect.Cljh3PVV.css +0 -1
- package/dist/assets/MazSlider.y4qpnD0N.css +0 -1
- package/dist/assets/MazSpinner.CP85N7RJ.css +0 -1
- package/dist/assets/MazStepper.DtWZmm-f.css +0 -1
- package/dist/assets/MazSwitch.Bxmh2iFj.css +0 -1
- package/dist/assets/MazTable.DMlQdImb.css +0 -1
- package/dist/assets/MazTableRow.B78Bd4Kv.css +0 -1
- package/dist/assets/MazTextarea.DME7BHS5.css +0 -1
- package/dist/chunks/capitalize.BF6CDS_4.js +0 -6
- package/dist/chunks/checkAvailability.aTpZidex.js +0 -16
- package/dist/chunks/de.B15Maq8Z.js +0 -82
- package/dist/chunks/debounce.Brzkn9pm.js +0 -11
- package/dist/chunks/en.Q_4-KljL.js +0 -157
- package/dist/chunks/es.BV1TlfTw.js +0 -82
- package/dist/chunks/fr.BVPG-7Dk.js +0 -82
- package/dist/chunks/it.Be9xhI4P.js +0 -82
- package/dist/chunks/ja.CWU7KYEA.js +0 -82
- package/dist/chunks/pt.CfaFSxVt.js +0 -82
- package/dist/chunks/sleep.BLRH1qZG.js +0 -6
- package/dist/chunks/truthyFilter.C2WOKUCG.js +0 -6
- package/dist/chunks/useTranslations.D5aoYwD7.js +0 -10
- package/dist/chunks/zh-CN.CCkuvk-E.js +0 -82
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { r } from "../chunks/truthyFilter.DZvXmxeK.js";
|
|
1
2
|
import { toValue, computed } from "vue";
|
|
2
|
-
import { t as truthyFilter } from "../chunks/truthyFilter.C2WOKUCG.js";
|
|
3
3
|
const bcp47Codes = ["af-ZA", "sq-AL", "ar-DZ", "ar-BH", "ar-EG", "ar-IQ", "ar-JO", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-OM", "ar-QA", "ar-SA", "ar-SY", "ar-TN", "ar-AE", "ar-YE", "hy-AM", "Cy-az-AZ", "Lt-az-AZ", "eu-ES", "be-BY", "bg-BG", "ca-ES", "zh-CN", "zh-HK", "zh-MO", "zh-SG", "zh-TW", "zh-CHS", "zh-CHT", "hr-HR", "cs-CZ", "da-DK", "div-MV", "nl-BE", "nl-NL", "en-AU", "en-BZ", "en-CA", "en-CB", "en-IE", "en-JM", "en-NZ", "en-PH", "en-ZA", "en-TT", "en-GB", "en-US", "en-ZW", "et-EE", "fo-FO", "fa-IR", "fi-FI", "fr-BE", "fr-CA", "fr-FR", "fr-LU", "fr-MC", "fr-CH", "gl-ES", "ka-GE", "de-AT", "de-DE", "de-LI", "de-LU", "de-CH", "el-GR", "gu-IN", "he-IL", "hi-IN", "hu-HU", "is-IS", "id-ID", "it-IT", "it-CH", "ja-JP", "kn-IN", "kk-KZ", "kok-IN", "ko-KR", "ky-KZ", "lv-LV", "lt-LT", "mk-MK", "ms-BN", "ms-MY", "mr-IN", "mn-MN", "nb-NO", "nn-NO", "pl-PL", "pt-BR", "pt-PT", "pa-IN", "ro-RO", "ru-RU", "sa-IN", "Cy-sr-SP", "Lt-sr-SP", "sk-SK", "sl-SI", "es-AR", "es-BO", "es-CL", "es-CO", "es-CR", "es-DO", "es-EC", "es-SV", "es-GT", "es-HN", "es-MX", "es-NI", "es-PA", "es-PY", "es-PE", "es-PR", "es-ES", "es-UY", "es-VE", "sw-KE", "sv-FI", "sv-SE", "syr-SY", "ta-IN", "tt-RU", "te-IN", "th-TH", "tr-TR", "uk-UA", "ur-PK", "Cy-uz-UZ", "Lt-uz-UZ", "vi-VN"], countryCodes = ["AA", "AC", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GT", "GU", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TA", "TC", "TD", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW"], iso6391Codes = ["aa", "ab", "ae", "af", "ak", "am", "an", "ar", "as", "av", "ay", "az", "ba", "be", "bg", "bh", "bi", "bm", "bn", "bo", "br", "bs", "ca", "ce", "ch", "co", "cr", "cs", "cu", "cv", "cy", "da", "de", "dv", "dz", "ee", "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fj", "fo", "fr", "fy", "ga", "gd", "gl", "gn", "gu", "gv", "ha", "he", "hi", "ho", "hr", "ht", "hu", "hy", "hz", "ia", "id", "ie", "ig", "ii", "ik", "io", "is", "it", "iu", "ja", "jv", "ka", "kg", "ki", "kj", "kk", "kl", "km", "kn", "ko", "kr", "ks", "ku", "kv", "kw", "ky", "la", "lb", "lg", "li", "ln", "lo", "lt", "lu", "lv", "mg", "mh", "mi", "mk", "ml", "mn", "mr", "ms", "mt", "my", "na", "nb", "nd", "ne", "ng", "nl", "nn", "no", "nr", "nv", "ny", "oc", "oj", "om", "or", "os", "pa", "pi", "pl", "ps", "pt", "qu", "rm", "rn", "ro", "ru", "rw", "sa", "sc", "sd", "se", "sg", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "ss", "st", "su", "sv", "sw", "ta", "te", "tg", "th", "ti", "tk", "tl", "tn", "to", "tr", "ts", "tt", "tw", "ty", "ug", "uk", "ur", "uz", "ve", "vi", "vo", "wa", "wo", "xh", "yi", "yo", "za", "zh", "zu"], displayNamesCodes = [...iso6391Codes, ...bcp47Codes, ...countryCodes], DEFAULT_DISPLAY_NAMES_OPTIONS = {
|
|
4
4
|
type: "region",
|
|
5
5
|
languageDisplay: "standard",
|
|
@@ -9,9 +9,9 @@ const bcp47Codes = ["af-ZA", "sq-AL", "ar-DZ", "ar-BH", "ar-EG", "ar-IQ", "ar-JO
|
|
|
9
9
|
}, displayNamesCache = /* @__PURE__ */ new Map();
|
|
10
10
|
let cacheCleanupTimer = null;
|
|
11
11
|
function scheduleCacheCleanup() {
|
|
12
|
-
cacheCleanupTimer && clearTimeout(cacheCleanupTimer), cacheCleanupTimer = setTimeout(() => {
|
|
12
|
+
typeof globalThis.window > "u" || (cacheCleanupTimer && clearTimeout(cacheCleanupTimer), cacheCleanupTimer = setTimeout(() => {
|
|
13
13
|
displayNamesCache.size > 50 && displayNamesCache.clear(), cacheCleanupTimer = null;
|
|
14
|
-
},
|
|
14
|
+
}, 300 * 1e3));
|
|
15
15
|
}
|
|
16
16
|
function isSameLanguageThanCode(language, code) {
|
|
17
17
|
return !language || language?.toLocaleLowerCase() === code.toLocaleLowerCase();
|
|
@@ -69,7 +69,8 @@ function getAllDisplayNames(options) {
|
|
|
69
69
|
console.warn("[maz-ui] (useDisplayNames) locale is required");
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
const
|
|
72
|
+
const filteredCodes = (resolvedOnlyCodes ?? getDisplayNamesCodes(resolvedCodesType)).filter((code) => !resolvedExcludedCodes?.includes(code)), mappedResults = [];
|
|
73
|
+
for (const code of filteredCodes)
|
|
73
74
|
try {
|
|
74
75
|
const name = getName(code, resolvedLocale, {
|
|
75
76
|
type: resolvedType,
|
|
@@ -78,40 +79,31 @@ function getAllDisplayNames(options) {
|
|
|
78
79
|
style: resolvedStyle,
|
|
79
80
|
localeMatcher: resolvedLocaleMatcher
|
|
80
81
|
});
|
|
81
|
-
|
|
82
|
+
if (resolvedRemoveUnmatched && (!name || isSameLanguageThanCode(name, code)))
|
|
83
|
+
continue;
|
|
84
|
+
mappedResults.push({
|
|
82
85
|
name: name ?? code,
|
|
83
86
|
code
|
|
84
|
-
};
|
|
87
|
+
});
|
|
85
88
|
} catch {
|
|
86
|
-
return;
|
|
87
89
|
}
|
|
88
|
-
|
|
89
|
-
const aIndex = resolvedPreferredCodes?.indexOf(a
|
|
90
|
+
const result = mappedResults.filter(r).sort((a, b) => a.name && b.name ? a.name.localeCompare(b.name) : 0).sort((a, b) => {
|
|
91
|
+
const aIndex = resolvedPreferredCodes?.indexOf(a.code) ?? -1, bIndex = resolvedPreferredCodes?.indexOf(b.code) ?? -1;
|
|
90
92
|
return aIndex !== -1 && bIndex !== -1 ? aIndex - bIndex : aIndex !== -1 ? -1 : bIndex !== -1 ? 1 : 0;
|
|
91
|
-
})
|
|
93
|
+
});
|
|
92
94
|
return resolvedRemoveDuplicates ? result.filter((item, index, self) => self.findIndex((t) => t[resolvedRemoveDuplicates].toLowerCase() === item[resolvedRemoveDuplicates].toLowerCase()) === index) : result;
|
|
93
95
|
});
|
|
94
96
|
}
|
|
95
97
|
function useDisplayNames(mainLocale) {
|
|
96
98
|
return {
|
|
97
|
-
getDisplayName: (code, options) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const resolvedOptions = toValue(options);
|
|
106
|
-
return getAllDisplayNames({
|
|
107
|
-
...resolvedOptions,
|
|
108
|
-
locale: resolvedOptions?.locale || mainLocale
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
countryCodes,
|
|
112
|
-
iso6391Codes,
|
|
113
|
-
bcp47Codes,
|
|
114
|
-
normalizeCode
|
|
99
|
+
getDisplayName: (code, options) => getDisplayName(code, {
|
|
100
|
+
...toValue(options),
|
|
101
|
+
locale: toValue(options)?.locale || mainLocale
|
|
102
|
+
}),
|
|
103
|
+
getAllDisplayNames: (options) => getAllDisplayNames({
|
|
104
|
+
...toValue(options),
|
|
105
|
+
locale: toValue(options)?.locale || mainLocale
|
|
106
|
+
})
|
|
115
107
|
};
|
|
116
108
|
}
|
|
117
109
|
export {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { MaybeRef, MaybeRefOrGetter, Ref } from 'vue';
|
|
2
|
+
export interface UseDropzoneReturn {
|
|
3
|
+
files: Ref<File[] | null>;
|
|
4
|
+
isOverDropZone: Ref<boolean>;
|
|
5
|
+
isOverError: Ref<boolean>;
|
|
6
|
+
}
|
|
7
|
+
export interface UseDropzoneOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Allowed data types, if not set, all data types are allowed.
|
|
10
|
+
* Also can be a function to check the data types.
|
|
11
|
+
*/
|
|
12
|
+
dataTypes?: MaybeRef<string[]> | ((types: readonly string[]) => boolean);
|
|
13
|
+
onDrop?: (files: File[] | null, event: DragEvent) => unknown;
|
|
14
|
+
onEnter?: (files: File[] | null, event: DragEvent) => unknown;
|
|
15
|
+
onLeave?: (files: File[] | null, event: DragEvent) => unknown;
|
|
16
|
+
onOver?: (files: File[] | null, event: DragEvent) => unknown;
|
|
17
|
+
onError?: (files: File[] | null, event: DragEvent) => unknown;
|
|
18
|
+
/**
|
|
19
|
+
* Allow multiple files to be dropped. Defaults to true.
|
|
20
|
+
*/
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Prevent default behavior for unhandled events. Defaults to false.
|
|
24
|
+
*/
|
|
25
|
+
preventDefaultForUnhandled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function useDropzone(target: MaybeRefOrGetter<HTMLElement | null | undefined>, options?: UseDropzoneOptions | UseDropzoneOptions['onDrop']): UseDropzoneReturn;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e } from "../chunks/isClient.8V3qjGdO.js";
|
|
2
2
|
import { ref, shallowRef, watch, toValue, onBeforeUnmount, unref } from "vue";
|
|
3
3
|
function useDropzone(target, options = {}) {
|
|
4
4
|
const isOverDropZone = ref(!1), isOverError = ref(!1), files = shallowRef(null);
|
|
5
5
|
let counter = 0, isValid = !0;
|
|
6
|
-
if (
|
|
6
|
+
if (e()) {
|
|
7
7
|
let getFiles = function(event) {
|
|
8
8
|
const list = Array.from(event.dataTransfer?.files ?? []);
|
|
9
9
|
return list.length === 0 ? null : multiple ? list : [list[0]];
|
|
@@ -37,11 +37,11 @@ function useDropzone(target, options = {}) {
|
|
|
37
37
|
}
|
|
38
38
|
}, removeEventListeners = function() {
|
|
39
39
|
const targetElement = toValue(target);
|
|
40
|
-
targetElement && (targetElement.removeEventListener("dragenter",
|
|
40
|
+
targetElement && (targetElement.removeEventListener("dragenter", dragEnterHandler), targetElement.removeEventListener("dragover", dragOverHandler), targetElement.removeEventListener("dragleave", dragLeaveHandler), targetElement.removeEventListener("drop", dropHandler));
|
|
41
41
|
};
|
|
42
|
-
const _options = typeof options == "function" ? { onDrop: options } : options, multiple = _options.multiple ?? !0, preventDefaultForUnhandled = _options.preventDefaultForUnhandled ?? !1,
|
|
43
|
-
watch(() => toValue(target), (element) => {
|
|
44
|
-
element && (element.addEventListener("dragenter",
|
|
42
|
+
const _options = typeof options == "function" ? { onDrop: options } : options, multiple = _options.multiple ?? !0, preventDefaultForUnhandled = _options.preventDefaultForUnhandled ?? !1, dragEnterHandler = (event) => handleDragEvent(event, "enter"), dragOverHandler = (event) => handleDragEvent(event, "over"), dragLeaveHandler = (event) => handleDragEvent(event, "leave"), dropHandler = (event) => handleDragEvent(event, "drop");
|
|
43
|
+
watch(() => toValue(target), (element, oldElement) => {
|
|
44
|
+
oldElement && (oldElement.removeEventListener("dragenter", dragEnterHandler), oldElement.removeEventListener("dragover", dragOverHandler), oldElement.removeEventListener("dragleave", dragLeaveHandler), oldElement.removeEventListener("drop", dropHandler)), element && (element.addEventListener("dragenter", dragEnterHandler), element.addEventListener("dragover", dragOverHandler), element.addEventListener("dragleave", dragLeaveHandler), element.addEventListener("drop", dropHandler));
|
|
45
45
|
}, { immediate: !0 }), onBeforeUnmount(() => {
|
|
46
46
|
removeEventListeners();
|
|
47
47
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseFormPayload, ExtractModelKey, FormFieldOptions, FormSchema } from './useFormValidator/types';
|
|
2
|
+
export declare function useFormField<FieldType, Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(name: ModelKey, options?: FormFieldOptions<Model, ModelKey, FieldType>): {
|
|
3
|
+
hasError: import('vue').ComputedRef<boolean>;
|
|
4
|
+
errors: import('vue').ComputedRef<import('./useFormValidator/types').ValidationIssues>;
|
|
5
|
+
errorMessage: import('vue').ComputedRef<Record<ModelKey, string | undefined>[ModelKey]>;
|
|
6
|
+
isValid: import('vue').ComputedRef<boolean>;
|
|
7
|
+
isDirty: import('vue').ComputedRef<boolean>;
|
|
8
|
+
isBlurred: import('vue').ComputedRef<boolean>;
|
|
9
|
+
isValidated: import('vue').ComputedRef<boolean>;
|
|
10
|
+
isValidating: import('vue').ComputedRef<boolean>;
|
|
11
|
+
mode: import('vue').ComputedRef<"blur" | "eager" | "lazy" | "aggressive" | "progressive" | undefined>;
|
|
12
|
+
value: import('vue').WritableComputedRef<FieldType, FieldType>;
|
|
13
|
+
validationEvents: import('vue').ComputedRef<{
|
|
14
|
+
onBlur: () => void;
|
|
15
|
+
} | undefined>;
|
|
16
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as getContext, f as fieldHasValidation, i as updateFieldState, j as
|
|
1
|
+
import { e as getContext, f as fieldHasValidation, i as updateFieldState, j as s, k as setFieldValidationState, l as getValidationEvents, h as hasModeIncludes, r as removeEventFromInteractiveElements, m as findInteractiveElements, n as addEventToInteractiveElements, o as handleFieldBlur } from "../chunks/dom-events.H9KIOv83.js";
|
|
2
2
|
import { computed, onMounted, onUnmounted } from "vue";
|
|
3
3
|
import { useFreezeValue } from "./useFreezeValue.js";
|
|
4
4
|
function useFormField(name, options) {
|
|
@@ -21,7 +21,7 @@ function useFormField(name, options) {
|
|
|
21
21
|
payload: payload.value,
|
|
22
22
|
schema: internalSchema.value,
|
|
23
23
|
options: { ...formOptions, ...finalOpts }
|
|
24
|
-
}), finalOpts.defaultValue !== void 0 && !
|
|
24
|
+
}), finalOpts.defaultValue !== void 0 && !s(payload.value[name], finalOpts.defaultValue)) {
|
|
25
25
|
const initialValue = finalOpts.defaultValue;
|
|
26
26
|
payload.value[name] = initialValue, fieldsStates.value[name].initialValue = useFreezeValue(initialValue);
|
|
27
27
|
}
|
|
@@ -63,7 +63,7 @@ function useFormField(name, options) {
|
|
|
63
63
|
};
|
|
64
64
|
onMounted(() => {
|
|
65
65
|
const element = finalOpts.ref?.value, elementToBind = element instanceof HTMLElement ? element : element?.$el;
|
|
66
|
-
elementToBind instanceof HTMLElement ? handleInteractiveElements(elementToBind) : console.warn(`[maz-ui](useFormField) No element found for ref in field '${String(name)}'. Make sure the ref is properly bound to an HTMLElement or Vue component (form identifier: ${formOptions.identifier})`);
|
|
66
|
+
elementToBind instanceof HTMLElement ? handleInteractiveElements(elementToBind) : console.warn(`[maz-ui](useFormField) No element found for ref in field '${String(name)}'. Make sure the ref is properly bound to an HTMLElement or Vue component (form identifier: ${String(formOptions.identifier)})`);
|
|
67
67
|
}), onUnmounted(() => {
|
|
68
68
|
removeEventFromInteractiveElements({
|
|
69
69
|
interactiveElements,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseFormPayload, ExtractModelKey, FormSchema, StrictOptions } from './types';
|
|
2
|
+
export declare const CONFIG: {
|
|
3
|
+
mode: StrictOptions<BaseFormPayload, ExtractModelKey<FormSchema<BaseFormPayload>>>['mode'];
|
|
4
|
+
scrollToErrorSelector: string;
|
|
5
|
+
debounceTime: number;
|
|
6
|
+
throttleTime: number;
|
|
7
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseFormPayload, ExtractModelKey, FieldState, FormSchema, StrictOptions } from './types';
|
|
2
|
+
export declare function scrollToError(selector?: string): void;
|
|
3
|
+
export declare function findInteractiveElements(el: HTMLElement): HTMLElement[];
|
|
4
|
+
export declare function addEventToInteractiveElements({ interactiveElements, onBlur, mode, }: {
|
|
5
|
+
interactiveElements: HTMLElement[];
|
|
6
|
+
onBlur: () => void;
|
|
7
|
+
mode: StrictOptions<BaseFormPayload, ExtractModelKey<FormSchema<BaseFormPayload>>>['mode'];
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function removeEventFromInteractiveElements({ interactiveElements, onBlur, }: {
|
|
10
|
+
interactiveElements: HTMLElement[];
|
|
11
|
+
onBlur: () => void;
|
|
12
|
+
}): void;
|
|
13
|
+
export declare function getValidationEvents<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>, F extends FieldState<Model, ModelKey, Model[ModelKey]>>({ hasRef, fieldState, onBlur, }: {
|
|
14
|
+
hasRef?: boolean;
|
|
15
|
+
fieldState: F;
|
|
16
|
+
onBlur: () => void;
|
|
17
|
+
}): {
|
|
18
|
+
onBlur: () => void;
|
|
19
|
+
} | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { BaseFormPayload, CustomInstance, ExtractModelKey, FieldsStates, FieldState, FormContext, FormFieldOptions, FormSchema, StrictOptions } from './types';
|
|
3
|
+
export declare function getFieldState<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>, FieldType = Model[ModelKey]>({ name, schema, initialValue, fieldState, options, }: {
|
|
4
|
+
name: ModelKey;
|
|
5
|
+
schema?: FormSchema<Model>;
|
|
6
|
+
initialValue?: FieldType;
|
|
7
|
+
fieldState: FieldState<Model, ModelKey, FieldType>;
|
|
8
|
+
options?: Pick<StrictOptions<Model, ModelKey>, 'debouncedFields' | 'throttledFields' | 'mode'>;
|
|
9
|
+
}): FieldState<Model, ModelKey, FieldType>;
|
|
10
|
+
export declare function fieldHasValidation<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>>(field: ModelKey, schema: FormSchema<Model>): boolean;
|
|
11
|
+
export declare function getFieldsStates<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ schema, payload, options, }: {
|
|
12
|
+
schema: FormSchema<Model>;
|
|
13
|
+
payload: Partial<Model>;
|
|
14
|
+
options: StrictOptions<Model, ModelKey>;
|
|
15
|
+
}): FieldsStates<Model, ModelKey>;
|
|
16
|
+
export declare function updateFieldsStates<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ fieldsStates, payload, schema, options, updateMode, }: {
|
|
17
|
+
fieldsStates: FieldsStates<Model, ModelKey>;
|
|
18
|
+
payload: Model;
|
|
19
|
+
schema: FormSchema<Model>;
|
|
20
|
+
options: StrictOptions<Model, ModelKey>;
|
|
21
|
+
updateMode?: boolean;
|
|
22
|
+
}): void;
|
|
23
|
+
export declare function updateFieldState<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>, FieldType = Model[ModelKey]>({ name, fieldState, payload, schema, options, updateMode, }: {
|
|
24
|
+
name: ModelKey;
|
|
25
|
+
fieldState: FieldState<Model, ModelKey, FieldType>;
|
|
26
|
+
payload: Model;
|
|
27
|
+
schema: FormSchema<Model>;
|
|
28
|
+
options: FormFieldOptions<Model, ModelKey, FieldType> & StrictOptions<Model, ModelKey>;
|
|
29
|
+
updateMode?: boolean;
|
|
30
|
+
}): {
|
|
31
|
+
blurred: boolean;
|
|
32
|
+
dirty: boolean;
|
|
33
|
+
error: boolean;
|
|
34
|
+
errors: import('./types').ValidationIssues;
|
|
35
|
+
valid: boolean;
|
|
36
|
+
validating: boolean;
|
|
37
|
+
validated: boolean;
|
|
38
|
+
validateFunction: ((args_0: {
|
|
39
|
+
name: ModelKey;
|
|
40
|
+
fieldState: FieldState<Model, ModelKey, Model[ModelKey]>;
|
|
41
|
+
schema: FormSchema<Model>;
|
|
42
|
+
payload: Model;
|
|
43
|
+
setError?: boolean;
|
|
44
|
+
setErrorIfInvalidAndNotEmpty?: boolean;
|
|
45
|
+
}) => Promise<void>) | undefined;
|
|
46
|
+
initialValue: Readonly<FieldType> | undefined;
|
|
47
|
+
mode: "blur" | "eager" | "lazy" | "aggressive" | "progressive" | undefined;
|
|
48
|
+
};
|
|
49
|
+
export declare function canExecuteValidation<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>, FieldType = Model[ModelKey]>({ eventName, fieldState, isSubmitted, }: {
|
|
50
|
+
eventName: 'blur' | 'input';
|
|
51
|
+
fieldState: FieldState<Model, ModelKey, FieldType>;
|
|
52
|
+
isSubmitted: boolean;
|
|
53
|
+
}): boolean;
|
|
54
|
+
export declare function handleFieldBlur<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>, FieldType = Model[ModelKey]>({ name, force, payload, fieldState, schema, isSubmitted, }: {
|
|
55
|
+
name: ModelKey;
|
|
56
|
+
payload: Model;
|
|
57
|
+
fieldState: FieldState<Model, ModelKey, FieldType>;
|
|
58
|
+
schema: FormSchema<Model>;
|
|
59
|
+
isSubmitted: boolean;
|
|
60
|
+
force?: boolean;
|
|
61
|
+
}): Promise<void> | undefined;
|
|
62
|
+
export declare function handleFieldInput<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>, FieldType = Model[ModelKey]>({ name, payload, fieldState, schema, isSubmitted, forceValidation, }: {
|
|
63
|
+
name: ModelKey;
|
|
64
|
+
payload: Model;
|
|
65
|
+
fieldState: FieldState<Model, ModelKey, FieldType>;
|
|
66
|
+
schema: FormSchema<Model>;
|
|
67
|
+
isSubmitted: boolean;
|
|
68
|
+
forceValidation?: boolean;
|
|
69
|
+
}): Promise<void> | undefined;
|
|
70
|
+
export declare function hasModeIncludes<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(modes: StrictOptions<Model, ModelKey>['mode'][], value?: StrictOptions<Model, ModelKey>['mode']): value is StrictOptions<Model, ModelKey>['mode'];
|
|
71
|
+
export declare function getInstance<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(composableName: string): CustomInstance<Model, ModelKey>;
|
|
72
|
+
export declare function getContext<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(identifier: string | symbol | InjectionKey<FormContext<Model, ModelKey>>, composableName: string): FormContext<Model, ModelKey>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { BaseIssue, BaseSchema, BaseSchemaAsync, InferInput, InferIssue, InferOutput, objectAsync } from 'valibot';
|
|
2
|
+
import { ComponentInternalInstance, InjectionKey, Ref, TemplateRef } from 'vue';
|
|
3
|
+
import { getValidateFunction } from './validation';
|
|
4
|
+
export type Validation = BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>;
|
|
5
|
+
export type ValidationIssues = InferIssue<Validation>[];
|
|
6
|
+
export type ExtractModelKey<T> = Extract<keyof T, string>;
|
|
7
|
+
export type FormSchema<Model extends BaseFormPayload> = {
|
|
8
|
+
[K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? K : never]: Validation;
|
|
9
|
+
} & {
|
|
10
|
+
[K in Extract<keyof Model, string> as Model[K] extends Required<Model>[K] ? never : K]?: Validation;
|
|
11
|
+
};
|
|
12
|
+
export type CustomInstance<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>> = ComponentInternalInstance & {
|
|
13
|
+
formContexts?: Map<string | symbol | InjectionKey<FormContext<Model, ModelKey>>, FormContext<Model, ModelKey>>;
|
|
14
|
+
};
|
|
15
|
+
export interface FormValidatorOptions<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>> {
|
|
16
|
+
/**
|
|
17
|
+
* Validation mode
|
|
18
|
+
* - lazy: validate on input value change
|
|
19
|
+
* - aggressive: validate all fields immediately on form creation and on input value change
|
|
20
|
+
* - blur: validate on blur
|
|
21
|
+
* - eager: validate on blur at first (only if the field is not empty) and then on input value change
|
|
22
|
+
* - progressive: field becomes valid after the first validation and then validate on input value change. If invalid validate on blur.
|
|
23
|
+
* @default 'lazy'
|
|
24
|
+
*/
|
|
25
|
+
mode?: 'eager' | 'lazy' | 'aggressive' | 'blur' | 'progressive';
|
|
26
|
+
/**
|
|
27
|
+
* Fields to validate with throttling
|
|
28
|
+
* Useful for fields that require a network request to avoid spamming the server
|
|
29
|
+
* @example { name: 1000 } or { name: true } for the default throttle time (1000ms)
|
|
30
|
+
*/
|
|
31
|
+
throttledFields?: Partial<Record<ModelKey, number | true>> | null;
|
|
32
|
+
/**
|
|
33
|
+
* Fields to validate with debouncing
|
|
34
|
+
* Useful to wait for the user to finish typing before validating
|
|
35
|
+
* Useful for fields that require a network request to avoid spamming the server
|
|
36
|
+
* @example { name: 300 } or { name: true } for the default debounce time (300ms)
|
|
37
|
+
*/
|
|
38
|
+
debouncedFields?: Partial<Record<ModelKey, number | true>> | null;
|
|
39
|
+
/**
|
|
40
|
+
* Scroll to the first error found
|
|
41
|
+
* @default '.has-field-error'
|
|
42
|
+
*/
|
|
43
|
+
scrollToError?: string | false;
|
|
44
|
+
/**
|
|
45
|
+
* Identifier to use for the form
|
|
46
|
+
* Useful to have multiple forms on the same page
|
|
47
|
+
* @default `main-form-validator`
|
|
48
|
+
*/
|
|
49
|
+
identifier?: string | symbol;
|
|
50
|
+
}
|
|
51
|
+
export type StrictOptions<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>> = Required<FormValidatorOptions<Model, ModelKey>>;
|
|
52
|
+
export interface FormContext<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>> {
|
|
53
|
+
fieldsStates: Ref<FieldsStates<Model, ModelKey>>;
|
|
54
|
+
options: StrictOptions<Model, ModelKey>;
|
|
55
|
+
internalSchema: Ref<FormSchema<Model>>;
|
|
56
|
+
payload: Ref<Model>;
|
|
57
|
+
errorMessages: Ref<Record<ModelKey, string | undefined>>;
|
|
58
|
+
isSubmitted: Ref<boolean>;
|
|
59
|
+
}
|
|
60
|
+
export interface FieldState<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>, FieldType = Model[ModelKey]> {
|
|
61
|
+
blurred: boolean;
|
|
62
|
+
dirty: boolean;
|
|
63
|
+
error: boolean;
|
|
64
|
+
errors: ValidationIssues;
|
|
65
|
+
valid: boolean;
|
|
66
|
+
initialValue?: Readonly<FieldType>;
|
|
67
|
+
validating: boolean;
|
|
68
|
+
validated: boolean;
|
|
69
|
+
validateFunction: ReturnType<typeof getValidateFunction<Model, ModelKey>>;
|
|
70
|
+
mode?: StrictOptions<Model, ModelKey>['mode'];
|
|
71
|
+
}
|
|
72
|
+
export type FieldsStates<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>> = Record<ModelKey, FieldState<Model, ModelKey, Model[ModelKey]>>;
|
|
73
|
+
export type BaseFormPayload = Record<string, any>;
|
|
74
|
+
export interface FormFieldOptions<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>, FieldType> {
|
|
75
|
+
/**
|
|
76
|
+
* Default value of the field
|
|
77
|
+
* @default undefined
|
|
78
|
+
*/
|
|
79
|
+
defaultValue?: FieldType;
|
|
80
|
+
/**
|
|
81
|
+
* Validation mode
|
|
82
|
+
* To override the form validation mode
|
|
83
|
+
*/
|
|
84
|
+
mode?: StrictOptions<Model, ModelKey>['mode'];
|
|
85
|
+
/**
|
|
86
|
+
* Reference to the component or HTML element to associate and trigger validation events
|
|
87
|
+
* Necessary for 'eager', 'progressive' and 'blur' validation modes
|
|
88
|
+
*/
|
|
89
|
+
ref?: Ref | TemplateRef;
|
|
90
|
+
/**
|
|
91
|
+
* Identifier for the form
|
|
92
|
+
* Useful when you have multiple forms on the same component
|
|
93
|
+
* Should be the same as the one used in `useFormValidator`
|
|
94
|
+
*/
|
|
95
|
+
formIdentifier?: string | symbol;
|
|
96
|
+
}
|
|
97
|
+
export type InferSchemaFormValidator<T> = T extends Ref<infer U> ? U extends FormSchema<BaseFormPayload> ? Partial<InferInput<ReturnType<typeof objectAsync<U>>>> : never : T extends (...args: any[]) => FormSchema<BaseFormPayload> ? Partial<InferInput<ReturnType<typeof objectAsync<ReturnType<T>>>>> : T extends FormSchema<BaseFormPayload> ? Partial<InferInput<ReturnType<typeof objectAsync<T>>>> : never;
|
|
98
|
+
export type InferOutputSchemaFormValidator<T> = T extends Ref<infer U> ? U extends FormSchema<BaseFormPayload> ? InferOutput<ReturnType<typeof objectAsync<U>>> : never : T extends (...args: any[]) => FormSchema<BaseFormPayload> ? InferOutput<ReturnType<typeof objectAsync<ReturnType<T>>>> : T extends FormSchema<BaseFormPayload> ? InferOutput<ReturnType<typeof objectAsync<T>>> : never;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseFormPayload, ExtractModelKey, FieldsStates, FieldState, FormSchema, StrictOptions, ValidationIssues } from './types';
|
|
2
|
+
export declare function isEmptyValue(value: unknown): value is null | undefined | '';
|
|
3
|
+
export declare function getValibotValidationMethod<MethodName extends keyof typeof import('valibot')>(methodName: MethodName): Promise<(typeof import('valibot'))[MethodName]>;
|
|
4
|
+
export declare function getValidationSchema<Model extends BaseFormPayload>(formSchema: FormSchema<Model>): Promise<import('valibot').ObjectSchemaAsync<FormSchema<Model>, undefined>>;
|
|
5
|
+
export declare function getFieldValidationResult<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>>(name: ModelKey, schema: FormSchema<Model>, value: Model[ModelKey]): Promise<{
|
|
6
|
+
result: import('valibot').SafeParseResult<FormSchema<Model>[ModelKey]>;
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function setFieldValidationState<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>>>({ name, fieldState, schema, payload, setError, setErrorIfInvalidAndNotEmpty, }: {
|
|
10
|
+
name: ModelKey;
|
|
11
|
+
fieldState: FieldState<Model, ModelKey, Model[ModelKey]>;
|
|
12
|
+
schema: FormSchema<Model>;
|
|
13
|
+
payload: Model;
|
|
14
|
+
setError?: boolean;
|
|
15
|
+
setErrorIfInvalidAndNotEmpty?: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
export declare function validateForm<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ fieldsStates, payload, setErrors, schema, }: {
|
|
18
|
+
fieldsStates: FieldsStates<Model, ExtractModelKey<FormSchema<Model>>>;
|
|
19
|
+
setErrors?: boolean;
|
|
20
|
+
payload: Model;
|
|
21
|
+
schema: FormSchema<Model>;
|
|
22
|
+
}): Promise<void[]>;
|
|
23
|
+
export declare function getErrorMessages<Model extends BaseFormPayload = BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(errors: Record<ModelKey, ValidationIssues>, fieldsStates: FieldsStates<Model, ExtractModelKey<FormSchema<Model>>>): Record<ModelKey, string | undefined>;
|
|
24
|
+
export declare function getFieldsErrors<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>(fieldsStates: FieldsStates<Model, ExtractModelKey<FormSchema<Model>>>): Record<ModelKey, ValidationIssues>;
|
|
25
|
+
export declare function getValidateFunction<Model extends BaseFormPayload, ModelKey extends ExtractModelKey<FormSchema<Model>> = ExtractModelKey<FormSchema<Model>>>({ name, hasValidation, debouncedFields, throttledFields, }: {
|
|
26
|
+
name: ModelKey;
|
|
27
|
+
hasValidation: boolean;
|
|
28
|
+
debouncedFields?: StrictOptions<Model, ModelKey>['debouncedFields'];
|
|
29
|
+
throttledFields?: StrictOptions<Model, ModelKey>['throttledFields'];
|
|
30
|
+
}): ((args_0: {
|
|
31
|
+
name: ModelKey;
|
|
32
|
+
fieldState: FieldState<Model, ModelKey, Model[ModelKey]>;
|
|
33
|
+
schema: FormSchema<Model>;
|
|
34
|
+
payload: Model;
|
|
35
|
+
setError?: boolean;
|
|
36
|
+
setErrorIfInvalidAndNotEmpty?: boolean;
|
|
37
|
+
}) => Promise<void>) | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DeepPartial } from '@maz-ui/utils/ts-helpers/DeepPartial';
|
|
2
|
+
import { MaybeRefOrGetter, Ref } from 'vue';
|
|
3
|
+
import { BaseFormPayload, ExtractModelKey, FieldsStates, FormSchema, FormValidatorOptions, InferOutputSchemaFormValidator, InferSchemaFormValidator } from './useFormValidator/types';
|
|
4
|
+
import { scrollToError } from './useFormValidator/dom-events';
|
|
5
|
+
export declare function useFormValidator<TSchema extends MaybeRefOrGetter<FormSchema<BaseFormPayload>>>({ schema, defaultValues, model, options }: {
|
|
6
|
+
schema: TSchema;
|
|
7
|
+
defaultValues?: MaybeRefOrGetter<DeepPartial<InferSchemaFormValidator<TSchema>> | undefined | null>;
|
|
8
|
+
model?: Ref<DeepPartial<InferSchemaFormValidator<TSchema>> | undefined | null>;
|
|
9
|
+
options?: FormValidatorOptions<InferSchemaFormValidator<TSchema>>;
|
|
10
|
+
}): {
|
|
11
|
+
identifier: string | symbol;
|
|
12
|
+
isDirty: import('vue').ComputedRef<boolean>;
|
|
13
|
+
isSubmitting: Ref<boolean, boolean>;
|
|
14
|
+
isSubmitted: Ref<boolean, boolean>;
|
|
15
|
+
isValid: import('vue').ComputedRef<boolean>;
|
|
16
|
+
errors: import('vue').ComputedRef<Record<ExtractModelKey<FormSchema<InferSchemaFormValidator<TSchema>>>, import('./useFormValidator/types').ValidationIssues>>;
|
|
17
|
+
model: Ref<InferSchemaFormValidator<TSchema>, InferSchemaFormValidator<TSchema>>;
|
|
18
|
+
fieldsStates: Ref<FieldsStates<InferSchemaFormValidator<TSchema>, ExtractModelKey<FormSchema<InferSchemaFormValidator<TSchema>>>>, FieldsStates<InferSchemaFormValidator<TSchema>, ExtractModelKey<FormSchema<InferSchemaFormValidator<TSchema>>>>>;
|
|
19
|
+
validateForm: (setErrors?: boolean) => Promise<void[]>;
|
|
20
|
+
scrollToError: typeof scrollToError;
|
|
21
|
+
handleSubmit: <Func extends (model: InferOutputSchemaFormValidator<TSchema>) => Promise<Awaited<ReturnType<Func>>> | ReturnType<Func>>(successCallback: Func, enableScrollOrSelector?: FormValidatorOptions["scrollToError"]) => (event?: Event) => Promise<ReturnType<Func> | undefined>;
|
|
22
|
+
errorMessages: import('vue').ComputedRef<Record<ExtractModelKey<FormSchema<InferSchemaFormValidator<TSchema>>>, string | undefined>>;
|
|
23
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref, toValue, computed, watch, provide, nextTick } from "vue";
|
|
2
|
-
import { g as getInstance, a as getFieldsStates, b as getFieldsErrors, c as getErrorMessages, u as updateFieldsStates, v as validateForm, C as CONFIG, s as scrollToError, h as hasModeIncludes, d as handleFieldInput } from "../chunks/dom-events.
|
|
2
|
+
import { g as getInstance, a as getFieldsStates, b as getFieldsErrors, c as getErrorMessages, u as updateFieldsStates, v as validateForm, C as CONFIG, s as scrollToError, h as hasModeIncludes, d as handleFieldInput } from "../chunks/dom-events.H9KIOv83.js";
|
|
3
3
|
function createValidationProcessor(fieldsToValidate, fieldsStates, payload, internalSchema, isSubmitted) {
|
|
4
4
|
return () => {
|
|
5
5
|
fieldsToValidate.forEach((name) => {
|
|
@@ -29,7 +29,17 @@ function useFormValidator({ schema, defaultValues, model, options }) {
|
|
|
29
29
|
payload: payload.value,
|
|
30
30
|
options: opts
|
|
31
31
|
})
|
|
32
|
-
), isSubmitting = ref(!1), isSubmitted = ref(!1), isValid = computed(() =>
|
|
32
|
+
), isSubmitting = ref(!1), isSubmitted = ref(!1), isValid = computed(() => {
|
|
33
|
+
for (const key in fieldsStates.value)
|
|
34
|
+
if (!fieldsStates.value[key].valid)
|
|
35
|
+
return !1;
|
|
36
|
+
return !0;
|
|
37
|
+
}), isDirty = computed(() => {
|
|
38
|
+
for (const key in fieldsStates.value)
|
|
39
|
+
if (fieldsStates.value[key].dirty)
|
|
40
|
+
return !0;
|
|
41
|
+
return !1;
|
|
42
|
+
}), errors = computed(() => getFieldsErrors(fieldsStates.value)), errorMessages = computed(() => getErrorMessages(errors.value, fieldsStates.value));
|
|
33
43
|
model && watch(
|
|
34
44
|
payload,
|
|
35
45
|
(newModel) => {
|
|
@@ -79,7 +89,13 @@ function useFormValidator({ schema, defaultValues, model, options }) {
|
|
|
79
89
|
return fieldState && newSnapshot[name] !== oldSnapshot?.[name] && hasModeIncludes(["aggressive", "lazy", "progressive"], fieldState.mode);
|
|
80
90
|
});
|
|
81
91
|
if (fieldsToValidate.length > 0) {
|
|
82
|
-
const processValidations = createValidationProcessor(
|
|
92
|
+
const processValidations = createValidationProcessor(
|
|
93
|
+
fieldsToValidate,
|
|
94
|
+
fieldsStates,
|
|
95
|
+
payload,
|
|
96
|
+
internalSchema,
|
|
97
|
+
isSubmitted
|
|
98
|
+
);
|
|
83
99
|
typeof requestIdleCallback < "u" ? requestIdleCallback(processValidations, { timeout: 100 }) : nextTick(processValidations);
|
|
84
100
|
}
|
|
85
101
|
},
|