@nmorph/nmorph-ui-kit 2.2.38 → 2.2.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/basic/nmorph-button/NmorphButton.vue2.js +4 -4
- package/dist/components/basic/nmorph-layout/NmorphLayout.vue2.js +12 -10
- package/dist/components/basic/nmorph-link/NmorphLink.vue2.js +19 -16
- package/dist/components/data/nmorph-badge/NmorphBadge.css +1 -1
- package/dist/components/data/nmorph-badge/NmorphBadge.vue2.js +30 -26
- package/dist/components/data/nmorph-calendar/NmorphCalendar.vue2.js +42 -40
- package/dist/components/data/nmorph-card/NmorphCard.vue2.js +6 -6
- package/dist/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue2.js +24 -21
- package/dist/components/data/nmorph-empty/NmorphEmpty.vue2.js +23 -21
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue.js +43 -42
- package/dist/components/data/nmorph-image-preview/NmorphImagePreview.vue2.js +47 -45
- package/dist/components/data/nmorph-progress/NmorphProgress.vue2.js +18 -14
- package/dist/components/data/nmorph-qr-code/NmorphQRCode.vue2.js +15 -11
- package/dist/components/data/nmorph-skeleton/NmorphSkeleton.vue2.js +15 -12
- package/dist/components/data/nmorph-table/NmorphTable.vue2.js +44 -40
- package/dist/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue2.js +1 -1
- package/dist/components/data/nmorph-virtual-list/NmorphVirtualList.vue2.js +21 -19
- package/dist/components/feedback/nmorph-alert/NmorphAlert.vue2.js +27 -24
- package/dist/components/feedback/nmorph-callout/NmorphCallout.vue2.js +19 -15
- package/dist/components/feedback/nmorph-drawer/NmorphDrawer.vue2.js +10 -8
- package/dist/components/feedback/nmorph-tooltip/NmorphTooltip.vue2.js +25 -23
- package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +8 -8
- package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +4 -4
- package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue.js +18 -22
- package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +42 -33
- package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +32 -32
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.css +1 -1
- package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +77 -106
- package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.css +1 -1
- package/dist/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue2.js +4 -4
- package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +7 -7
- package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +6 -6
- package/dist/components/form/nmorph-radio/NmorphRadio.vue2.js +1 -1
- package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +51 -49
- package/dist/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue2.js +21 -18
- package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +28 -24
- package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +30 -30
- package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +34 -32
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +16 -16
- package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +37 -35
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +12 -12
- package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +34 -32
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +16 -16
- package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +64 -57
- package/dist/components/navigation/nmorph-dropdown/NmorphDropdown.vue2.js +25 -23
- package/dist/hooks/use-field-validation.js +50 -66
- package/dist/hooks/use-focusable-input.js +27 -0
- package/dist/hooks/use-nmorph-translation.js +4 -4
- package/dist/index.es.js +842 -837
- package/dist/index.umd.js +32 -32
- package/dist/package.json.js +1 -1
- package/dist/plugin.js +47 -42
- package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +4 -17
- package/dist/src/components/basic/nmorph-button/types.d.ts +13 -0
- package/dist/src/components/basic/nmorph-icon/NmorphIcon.vue.d.ts +3 -9
- package/dist/src/components/basic/nmorph-icon/types.d.ts +6 -0
- package/dist/src/components/basic/nmorph-layout/NmorphLayout.vue.d.ts +2 -9
- package/dist/src/components/basic/nmorph-layout/types.d.ts +8 -0
- package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +3 -14
- package/dist/src/components/basic/nmorph-link/types.d.ts +11 -0
- package/dist/src/components/basic/nmorph-scroll/NmorphScroll.vue.d.ts +2 -2
- package/dist/src/components/basic/nmorph-scroll/types.d.ts +5 -0
- package/dist/src/components/basic/nmorph-space/NmorphSpace.vue.d.ts +2 -15
- package/dist/src/components/basic/nmorph-space/types.d.ts +14 -0
- package/dist/src/components/data/nmorph-avatar/NmorphAvatar.vue.d.ts +5 -20
- package/dist/src/components/data/nmorph-avatar/types.d.ts +21 -0
- package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +5 -40
- package/dist/src/components/data/nmorph-badge/types.d.ts +34 -0
- package/dist/src/components/data/nmorph-calendar/NmorphCalendar.vue.d.ts +4 -12
- package/dist/src/components/data/nmorph-calendar/inner-components/nmorph-calendar-header/NmorphCalendarHeader.vue.d.ts +3 -9
- package/dist/src/components/data/nmorph-calendar/inner-components/nmorph-calendar-header/types.d.ts +12 -0
- package/dist/src/components/data/nmorph-calendar/types.d.ts +13 -0
- package/dist/src/components/data/nmorph-card/NmorphCard.vue.d.ts +2 -10
- package/dist/src/components/data/nmorph-card/types.d.ts +9 -0
- package/dist/src/components/data/nmorph-carousel/NmorphCarousel.vue.d.ts +3 -5
- package/dist/src/components/data/nmorph-carousel/components/nmorph-carousel-item/NmorphCarouselItem.vue.d.ts +2 -4
- package/dist/src/components/data/nmorph-carousel/components/nmorph-carousel-item/types.d.ts +3 -0
- package/dist/src/components/data/nmorph-carousel/types.d.ts +6 -0
- package/dist/src/components/data/nmorph-collapse/NmorphCollapse.vue.d.ts +3 -7
- package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/NmorphCollapseItem.vue.d.ts +4 -10
- package/dist/src/components/data/nmorph-collapse/components/nmorph-collapse-item/types.d.ts +13 -0
- package/dist/src/components/data/nmorph-collapse/types.d.ts +7 -0
- package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +3 -12
- package/dist/src/components/data/nmorph-empty/types.d.ts +11 -0
- package/dist/src/components/data/nmorph-image/NmorphImage.vue.d.ts +3 -8
- package/dist/src/components/data/nmorph-image/types.d.ts +10 -0
- package/dist/src/components/data/nmorph-image-preview/NmorphImagePreview.vue.d.ts +3 -18
- package/dist/src/components/data/nmorph-image-preview/types.d.ts +19 -0
- package/dist/src/components/data/nmorph-pagination/NmorphPagination.vue.d.ts +3 -13
- package/dist/src/components/data/nmorph-pagination/types.d.ts +14 -0
- package/dist/src/components/data/nmorph-progress/NmorphProgress.vue.d.ts +3 -15
- package/dist/src/components/data/nmorph-progress/types.d.ts +12 -0
- package/dist/src/components/data/nmorph-qr-code/NmorphQRCode.vue.d.ts +5 -15
- package/dist/src/components/data/nmorph-qr-code/types.d.ts +12 -0
- package/dist/src/components/data/nmorph-skeleton/NmorphSkeleton.vue.d.ts +2 -7
- package/dist/src/components/data/nmorph-skeleton/components/NmorphSkeletonItem.vue.d.ts +3 -9
- package/dist/src/components/data/nmorph-skeleton/components/types.d.ts +8 -0
- package/dist/src/components/data/nmorph-skeleton/types.d.ts +6 -0
- package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +4 -18
- package/dist/src/components/data/nmorph-table/components/nmorph-table-cell/NmorphTableCell.vue.d.ts +2 -4
- package/dist/src/components/data/nmorph-table/components/nmorph-table-cell/types.d.ts +3 -0
- package/dist/src/components/data/nmorph-table/components/nmorph-table-column/NmorphTableColumn.vue.d.ts +4 -5
- package/dist/src/components/data/nmorph-table/components/nmorph-table-column/types.d.ts +3 -0
- package/dist/src/components/data/nmorph-table/inner-components/nmorph-sort-button/NmorphSortButton.vue.d.ts +4 -6
- package/dist/src/components/data/nmorph-table/inner-components/nmorph-sort-button/types.d.ts +7 -0
- package/dist/src/components/data/nmorph-table/types.d.ts +15 -0
- package/dist/src/components/data/nmorph-tag-list/NmorphTagList.vue.d.ts +5 -8
- package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/NmorphTagItem.vue.d.ts +3 -5
- package/dist/src/components/data/nmorph-tag-list/components/nmorph-tag-item/types.d.ts +6 -0
- package/dist/src/components/data/nmorph-tag-list/types.d.ts +7 -0
- package/dist/src/components/data/nmorph-virtual-list/NmorphVirtualList.vue.d.ts +3 -14
- package/dist/src/components/data/nmorph-virtual-list/types.d.ts +15 -0
- package/dist/src/components/feedback/nmorph-alert/NmorphAlert.vue.d.ts +5 -7
- package/dist/src/components/feedback/nmorph-alert/types.d.ts +5 -0
- package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +4 -16
- package/dist/src/components/feedback/nmorph-callout/types.d.ts +12 -0
- package/dist/src/components/feedback/nmorph-dialog/NmorphDialog.vue.d.ts +4 -19
- package/dist/src/components/feedback/nmorph-dialog/types.d.ts +20 -0
- package/dist/src/components/feedback/nmorph-drawer/NmorphDrawer.vue.d.ts +4 -17
- package/dist/src/components/feedback/nmorph-drawer/types.d.ts +18 -0
- package/dist/src/components/feedback/nmorph-tooltip/NmorphTooltip.vue.d.ts +5 -14
- package/dist/src/components/feedback/nmorph-tooltip/types.d.ts +11 -0
- package/dist/src/components/form/nmorph-autocomplete/NmorphAutocomplete.vue.d.ts +6 -19
- package/dist/src/components/form/nmorph-autocomplete/types.d.ts +18 -0
- package/dist/src/components/form/nmorph-checkbox/NmorphCheckbox.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-checkbox/types.d.ts +3 -0
- package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +4 -10
- package/dist/src/components/form/nmorph-checkbox-group/types.d.ts +11 -0
- package/dist/src/components/form/nmorph-color-picker/NmorphColorPicker.vue.d.ts +6 -11
- package/dist/src/components/form/nmorph-color-picker/types.d.ts +11 -0
- package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +4 -20
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-clear-button/types.d.ts +3 -0
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.d.ts +3 -8
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-content/types.d.ts +10 -0
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-header/NmorphDatePickerHeader.vue.d.ts +3 -6
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-date-picker-header/types.d.ts +12 -0
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/NmorphYearMonthPicker.vue.d.ts +3 -6
- package/dist/src/components/form/nmorph-date-picker/inner-components/nmorph-year-month-picker/types.d.ts +9 -0
- package/dist/src/components/form/nmorph-date-picker/types.d.ts +21 -0
- package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +5 -13
- package/dist/src/components/form/nmorph-file-upload/types.d.ts +17 -0
- package/dist/src/components/form/nmorph-form/NmorphForm.vue.d.ts +4 -8
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue.d.ts +3 -12
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/NmorphErrorBox.vue.d.ts +3 -8
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-error-box/types.d.ts +7 -0
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-validation-icon/NmorphValidationIcon.vue.d.ts +3 -6
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/inner-components/nmorph-validation-icon/types.d.ts +5 -0
- package/dist/src/components/form/nmorph-form/components/nmorph-form-item/types.d.ts +10 -0
- package/dist/src/components/form/nmorph-form/types.d.ts +6 -1
- package/dist/src/components/form/nmorph-number-input/NmorphNumberInput.vue.d.ts +3 -10
- package/dist/src/components/form/nmorph-number-input/types.d.ts +11 -0
- package/dist/src/components/form/nmorph-otp-input/NmorphOTPInput.vue.d.ts +5 -13
- package/dist/src/components/form/nmorph-otp-input/types.d.ts +21 -0
- package/dist/src/components/form/nmorph-radio/NmorphRadio.vue.d.ts +4 -9
- package/dist/src/components/form/nmorph-radio/types.d.ts +6 -0
- package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +3 -11
- package/dist/src/components/form/nmorph-radio-group/types.d.ts +12 -0
- package/dist/src/components/form/nmorph-select/NmorphSelect.vue.d.ts +3 -21
- package/dist/src/components/form/nmorph-select/components/nmorph-select-option/NmorphSelectOption.vue.d.ts +1 -1
- package/dist/src/components/form/nmorph-select/components/nmorph-select-option/types.d.ts +3 -0
- package/dist/src/components/form/nmorph-select/types.d.ts +21 -0
- package/dist/src/components/form/nmorph-select-button/NmorphSelectButton.vue.d.ts +4 -12
- package/dist/src/components/form/nmorph-select-button/components/nmorph-select-button-item/NmorphSelectButtonItem.vue.d.ts +3 -6
- package/dist/src/components/form/nmorph-select-button/components/nmorph-select-button-item/types.d.ts +4 -0
- package/dist/src/components/form/nmorph-select-button/types.d.ts +12 -0
- package/dist/src/components/form/nmorph-slider/NmorphSlider.vue.d.ts +111 -0
- package/dist/src/components/form/nmorph-slider/types.d.ts +3 -0
- package/dist/src/components/form/nmorph-switch/NmorphSwitch.vue.d.ts +3 -14
- package/dist/src/components/form/nmorph-switch/types.d.ts +15 -0
- package/dist/src/components/form/nmorph-text-input/NmorphTextInput.vue.d.ts +6 -14
- package/dist/src/components/form/nmorph-text-input/types.d.ts +16 -0
- package/dist/src/components/form/nmorph-textarea/NmorphTextarea.vue.d.ts +6 -18
- package/dist/src/components/form/nmorph-textarea/types.d.ts +20 -0
- package/dist/src/components/form/nmorph-time-picker/NmorphTimePicker.vue.d.ts +6 -20
- package/dist/src/components/form/nmorph-time-picker/types.d.ts +24 -0
- package/dist/src/components/navigation/index.d.ts +1 -1
- package/dist/src/components/navigation/nmorph-backtop/NmorphBacktop.vue.d.ts +4 -12
- package/dist/src/components/navigation/nmorph-backtop/types.d.ts +14 -0
- package/dist/src/components/navigation/nmorph-breadcrumb/NmorphBreadcrumb.vue.d.ts +2 -4
- package/dist/src/components/navigation/nmorph-breadcrumb/components/nmorph-breadcrumb-item/NmorphBreadcrumbItem.vue.d.ts +2 -4
- package/dist/src/components/navigation/nmorph-breadcrumb/components/nmorph-breadcrumb-item/types.d.ts +3 -0
- package/dist/src/components/navigation/nmorph-breadcrumb/types.d.ts +3 -0
- package/dist/src/components/navigation/nmorph-context-menu/NmorphContextMenu.vue.d.ts +10 -31
- package/dist/src/components/navigation/nmorph-context-menu/types.d.ts +42 -0
- package/dist/src/components/navigation/nmorph-dropdown/NmorphDropdown.vue.d.ts +6 -24
- package/dist/src/components/navigation/nmorph-dropdown/types.d.ts +24 -0
- package/dist/src/components/navigation/nmorph-tabs/NmorphTabs.vue.d.ts +4 -8
- package/dist/src/components/navigation/nmorph-tabs/components/nmorph-tab-pane/NmorphTabPane.vue.d.ts +4 -5
- package/dist/src/components/navigation/nmorph-tabs/components/nmorph-tab-pane/types.d.ts +3 -0
- package/dist/src/components/navigation/nmorph-tabs/{type.d.ts → types.d.ts} +9 -0
- package/dist/src/components/navigation/nmorph-tabs/utils.d.ts +1 -1
- package/dist/src/components/others/nmorph-divider/NmorphDivider.vue.d.ts +2 -5
- package/dist/src/components/others/nmorph-divider/types.d.ts +3 -0
- package/dist/src/components/others/nmorph-overlay/NmorphOverlay.vue.d.ts +3 -12
- package/dist/src/components/others/nmorph-overlay/types.d.ts +14 -0
- package/dist/src/components/providers/nmorph-notification-provider/NmorphNotificationProvider.vue.d.ts +2 -8
- package/dist/src/components/providers/nmorph-notification-provider/types.d.ts +9 -0
- package/dist/src/hooks/use-focusable-input.d.ts +16 -0
- package/dist/src/hooks/use-form-validation.d.ts +1 -2
- package/dist/src/plugin.d.ts +4 -1
- package/dist/src/types/app.types.d.ts +21 -0
- package/dist/src/types/common.types.d.ts +62 -0
- package/dist/src/types/date.types.d.ts +7 -0
- package/dist/src/types/image.types.d.ts +17 -0
- package/dist/src/types/index.d.ts +8 -206
- package/dist/src/types/selection.types.d.ts +26 -0
- package/dist/src/types/table.types.d.ts +5 -0
- package/dist/src/types/theme.types.d.ts +55 -0
- package/dist/src/types/translation.types.d.ts +20 -0
- package/dist/src/utils/common.d.ts +3 -0
- package/dist/src/utils/file-types.d.ts +8 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/types/common.types.js +14 -0
- package/dist/types/date.types.js +4 -0
- package/dist/types/image.types.js +5 -0
- package/dist/types/selection.types.js +4 -0
- package/dist/types/table.types.js +4 -0
- package/dist/types/translation.types.js +4 -0
- package/dist/utils/common.js +16 -6
- package/dist/utils/file-types.js +41 -0
- package/package.json +1 -1
- package/dist/src/components/data/nmorph-calendar/hooks/index.d.ts +0 -2
- package/dist/src/hooks/index.d.ts +0 -9
- package/dist/src/outside-hooks/index.d.ts +0 -5
- package/dist/types/index.js +0 -20
|
@@ -1,103 +1,87 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isFileAllowedByTypes as z } from "../utils/file-types.js";
|
|
2
2
|
import { ref as h } from "vue";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
I(t.type),
|
|
11
|
-
B(t.name),
|
|
12
|
-
z(t.type)
|
|
13
|
-
].filter(Boolean).map((o) => o.toLowerCase())
|
|
14
|
-
)
|
|
15
|
-
), w = (t) => typeof File < "u" && t instanceof File, q = (t) => !!t && typeof t == "object" && "data" in t && w(t.data), E = (t) => {
|
|
16
|
-
if (w(t)) return [t];
|
|
17
|
-
if (!Array.isArray(t)) return null;
|
|
18
|
-
const o = t;
|
|
19
|
-
return o.length === 0 ? [] : o.every(w) ? o : o.every(q) ? o.map((s) => s.data) : null;
|
|
20
|
-
}, j = (t, o) => {
|
|
21
|
-
if (o.length === 0) return !0;
|
|
22
|
-
const s = M(t);
|
|
23
|
-
return o.some((c) => s.includes(String(c).toLowerCase()));
|
|
24
|
-
}, P = (t) => {
|
|
25
|
-
const { inputValue: o, rules: s } = t, c = h([]), y = h(!1), m = h(!1);
|
|
3
|
+
const v = (n) => typeof File < "u" && n instanceof File, S = (n) => !!n && typeof n == "object" && "data" in n && v(n.data), I = (n) => {
|
|
4
|
+
if (v(n)) return [n];
|
|
5
|
+
if (!Array.isArray(n)) return null;
|
|
6
|
+
const u = n;
|
|
7
|
+
return u.length === 0 ? [] : u.every(v) ? u : u.every(S) ? u.map((l) => l.data) : null;
|
|
8
|
+
}, D = (n) => {
|
|
9
|
+
const { inputValue: u, rules: l } = n, p = h([]), y = h(!1), m = h(!1);
|
|
26
10
|
return {
|
|
27
11
|
touched: m,
|
|
28
12
|
valid: y,
|
|
29
|
-
errors:
|
|
13
|
+
errors: p,
|
|
30
14
|
validate: () => {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
15
|
+
const F = l?.length > 0;
|
|
16
|
+
if (p.value = [], !F) {
|
|
33
17
|
y.value = !0;
|
|
34
18
|
return;
|
|
35
19
|
}
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
20
|
+
if (u === null) return;
|
|
21
|
+
const o = u, a = (s) => F && l.some((r) => s in r), T = typeof o == "string" && a("pattern"), g = typeof o == "number" && a("numberCompareType"), x = (typeof o == "string" || typeof o == "boolean") && a("booleanCompareType"), b = Array.isArray(o) && a("arrayCompareType"), w = a("fileMaxSize") || a("maxFileSize") || a("fileAllowedTypes") || a("allowedTypes") || a("fileMaxCount") || a("maxFiles"), A = w ? I(o) : null, C = w && A !== null;
|
|
22
|
+
if (!g && !T && !x && !b && !C) {
|
|
39
23
|
console.warn("The input value and the provided rules do not match");
|
|
40
24
|
return;
|
|
41
25
|
}
|
|
42
|
-
if (m.value || (m.value = !0),
|
|
43
|
-
const
|
|
44
|
-
|
|
26
|
+
if (m.value || (m.value = !0), T) {
|
|
27
|
+
const s = l;
|
|
28
|
+
p.value = s.reduce((r, t) => (o.match(t.pattern) || r.push(t.error), r), []);
|
|
45
29
|
}
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
switch (
|
|
30
|
+
if (g) {
|
|
31
|
+
const s = (t, e, i) => {
|
|
32
|
+
switch (i) {
|
|
49
33
|
case "eq":
|
|
50
|
-
return
|
|
34
|
+
return t === e;
|
|
51
35
|
case "gt":
|
|
52
|
-
return
|
|
36
|
+
return t > e;
|
|
53
37
|
case "lt":
|
|
54
|
-
return
|
|
38
|
+
return t < e;
|
|
55
39
|
case "lte":
|
|
56
|
-
return
|
|
40
|
+
return t <= e;
|
|
57
41
|
case "gte":
|
|
58
|
-
return
|
|
42
|
+
return t >= e;
|
|
59
43
|
}
|
|
60
|
-
}, r =
|
|
61
|
-
|
|
44
|
+
}, r = l;
|
|
45
|
+
p.value = r.reduce((t, e) => (s(o, e.compareValue, e.numberCompareType) && t.push(e.error), t), []);
|
|
62
46
|
}
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
|
|
47
|
+
if (x) {
|
|
48
|
+
const s = l;
|
|
49
|
+
p.value = s.reduce((r, t) => {
|
|
66
50
|
let e = !1;
|
|
67
|
-
const { compareValue:
|
|
68
|
-
return f === "not-eq" && (e =
|
|
51
|
+
const { compareValue: i, booleanCompareType: f } = t;
|
|
52
|
+
return f === "not-eq" && (e = o === i), f === "eq" && (e = o !== i), e || r.push(t.error), r;
|
|
69
53
|
}, []);
|
|
70
54
|
}
|
|
71
|
-
if (
|
|
72
|
-
const
|
|
73
|
-
switch (
|
|
55
|
+
if (b) {
|
|
56
|
+
const s = l, r = (t, e, i) => {
|
|
57
|
+
switch (i) {
|
|
74
58
|
case "contains-one":
|
|
75
|
-
return
|
|
59
|
+
return t.some((c) => e.includes(c));
|
|
76
60
|
case "full-eq":
|
|
77
|
-
if (
|
|
78
|
-
const f = [...
|
|
79
|
-
return f.every((
|
|
61
|
+
if (t.length !== e.length) return !1;
|
|
62
|
+
const f = [...t].sort(), d = [...e].sort();
|
|
63
|
+
return f.every((c, R) => c === d[R]);
|
|
80
64
|
case "not-contains":
|
|
81
|
-
return !
|
|
65
|
+
return !t.some((c) => e.includes(c));
|
|
82
66
|
}
|
|
83
67
|
};
|
|
84
|
-
|
|
85
|
-
|
|
68
|
+
p.value = s.reduce((t, e) => (r(
|
|
69
|
+
o.map((f) => String(f)),
|
|
86
70
|
e.compareValue,
|
|
87
71
|
e.arrayCompareType
|
|
88
|
-
) ||
|
|
72
|
+
) || t.push(e.error), t), []);
|
|
89
73
|
}
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
return typeof
|
|
74
|
+
if (C) {
|
|
75
|
+
const s = l, r = A || [];
|
|
76
|
+
p.value = s.reduce((t, e) => {
|
|
77
|
+
const i = e.fileMaxSize ?? e.maxFileSize, f = e.fileAllowedTypes ?? e.allowedTypes, d = e.fileMaxCount ?? e.maxFiles;
|
|
78
|
+
return typeof i == "number" && r.some((c) => c.size > i) && t.push(e.error), f && r.some((c) => !z(c, f)) && t.push(e.error), typeof d == "number" && r.length > d && t.push(e.error), t;
|
|
95
79
|
}, []);
|
|
96
80
|
}
|
|
97
|
-
y.value =
|
|
81
|
+
y.value = p.value.length === 0;
|
|
98
82
|
}
|
|
99
83
|
};
|
|
100
84
|
};
|
|
101
85
|
export {
|
|
102
|
-
|
|
86
|
+
D as useFieldValidation
|
|
103
87
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ref as c } from "vue";
|
|
2
|
+
const d = (s = {}) => {
|
|
3
|
+
const e = c(null), u = c(!1);
|
|
4
|
+
return {
|
|
5
|
+
elementRef: e,
|
|
6
|
+
focused: u,
|
|
7
|
+
handleFocus: () => {
|
|
8
|
+
u.value = !0, s.onFocus?.();
|
|
9
|
+
},
|
|
10
|
+
handleBlur: () => {
|
|
11
|
+
u.value = !1, s.onBlur?.();
|
|
12
|
+
},
|
|
13
|
+
focus: () => {
|
|
14
|
+
e.value?.focus();
|
|
15
|
+
},
|
|
16
|
+
blur: () => {
|
|
17
|
+
e.value?.blur();
|
|
18
|
+
},
|
|
19
|
+
select: () => {
|
|
20
|
+
const l = e.value;
|
|
21
|
+
l && "select" in l && typeof l.select == "function" && l.select();
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
d as useFocusableInput
|
|
27
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Locale as o } from "../types/index.js";
|
|
2
1
|
import { createI18n as c } from "vue-i18n";
|
|
3
|
-
import
|
|
2
|
+
import o from "../locales/en.js";
|
|
3
|
+
import { Locale as s } from "../types/translation.types.js";
|
|
4
4
|
const f = (e) => {
|
|
5
|
-
const l = e && e.messages ? { ...e.messages, en:
|
|
5
|
+
const l = e && e.messages ? { ...e.messages, en: o } : { en: o }, r = e && e.locale ? e.locale : s.en;
|
|
6
6
|
return c({
|
|
7
7
|
legacy: !1,
|
|
8
8
|
locale: r,
|
|
9
|
-
fallbackLocale:
|
|
9
|
+
fallbackLocale: s.en,
|
|
10
10
|
messages: l
|
|
11
11
|
});
|
|
12
12
|
};
|