@winchsa/ui 0.1.30 → 0.1.33
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/package.json +1 -1
- package/dist/components/Breadcrumbs.d.vue.ts +0 -7
- package/dist/components/Breadcrumbs.vue +0 -46
- package/dist/components/Breadcrumbs.vue.d.ts +0 -7
- package/dist/components/CustomizerSection.d.vue.ts +0 -17
- package/dist/components/CustomizerSection.vue +0 -19
- package/dist/components/CustomizerSection.vue.d.ts +0 -17
- package/dist/components/DialogCloseBtn.d.vue.ts +0 -7
- package/dist/components/DialogCloseBtn.vue +0 -20
- package/dist/components/DialogCloseBtn.vue.d.ts +0 -7
- package/dist/components/Drawer.d.vue.ts +0 -28
- package/dist/components/Drawer.vue +0 -60
- package/dist/components/Drawer.vue.d.ts +0 -28
- package/dist/components/IconBtn.d.vue.ts +0 -18
- package/dist/components/IconBtn.vue +0 -24
- package/dist/components/IconBtn.vue.d.ts +0 -18
- package/dist/components/LoadingBar.d.vue.ts +0 -6
- package/dist/components/LoadingBar.vue +0 -31
- package/dist/components/LoadingBar.vue.d.ts +0 -6
- package/dist/components/LoadingDialog.d.vue.ts +0 -12
- package/dist/components/LoadingDialog.vue +0 -41
- package/dist/components/LoadingDialog.vue.d.ts +0 -12
- package/dist/components/LoadingItem.d.vue.ts +0 -25
- package/dist/components/LoadingItem.vue +0 -66
- package/dist/components/LoadingItem.vue.d.ts +0 -25
- package/dist/components/Modal.d.vue.ts +0 -50
- package/dist/components/Modal.vue +0 -155
- package/dist/components/Modal.vue.d.ts +0 -50
- package/dist/components/MoreBtn.d.vue.ts +0 -17
- package/dist/components/MoreBtn.vue +0 -28
- package/dist/components/MoreBtn.vue.d.ts +0 -17
- package/dist/components/ScrollToTop.d.vue.ts +0 -3
- package/dist/components/ScrollToTop.vue +0 -39
- package/dist/components/ScrollToTop.vue.d.ts +0 -3
- package/dist/components/SiteTitle.d.vue.ts +0 -3
- package/dist/components/SiteTitle.vue +0 -14
- package/dist/components/SiteTitle.vue.d.ts +0 -3
- package/dist/components/Toaster.d.vue.ts +0 -6
- package/dist/components/Toaster.vue +0 -19
- package/dist/components/Toaster.vue.d.ts +0 -6
- package/dist/components/cards/AppCard.d.vue.ts +0 -18
- package/dist/components/cards/AppCard.vue +0 -45
- package/dist/components/cards/AppCard.vue.d.ts +0 -18
- package/dist/components/cards/AppCardActions.d.vue.ts +0 -33
- package/dist/components/cards/AppCardActions.vue +0 -126
- package/dist/components/cards/AppCardActions.vue.d.ts +0 -33
- package/dist/components/cards/CardStatisticsHorizontal.d.vue.ts +0 -9
- package/dist/components/cards/CardStatisticsHorizontal.vue +0 -29
- package/dist/components/cards/CardStatisticsHorizontal.vue.d.ts +0 -9
- package/dist/components/cards/CheckboxesCard.d.vue.ts +0 -18
- package/dist/components/cards/CheckboxesCard.vue +0 -108
- package/dist/components/cards/CheckboxesCard.vue.d.ts +0 -18
- package/dist/components/cards/HeaderCard.d.vue.ts +0 -9
- package/dist/components/cards/HeaderCard.vue +0 -31
- package/dist/components/cards/HeaderCard.vue.d.ts +0 -9
- package/dist/components/cards/ImageCard.d.vue.ts +0 -33
- package/dist/components/cards/ImageCard.vue +0 -73
- package/dist/components/cards/ImageCard.vue.d.ts +0 -33
- package/dist/components/cards/InputCard.d.vue.ts +0 -21
- package/dist/components/cards/InputCard.vue +0 -60
- package/dist/components/cards/InputCard.vue.d.ts +0 -21
- package/dist/components/cards/StaticCard.d.vue.ts +0 -21
- package/dist/components/cards/StaticCard.vue +0 -37
- package/dist/components/cards/StaticCard.vue.d.ts +0 -21
- package/dist/components/forms/Accordion.d.vue.ts +0 -19
- package/dist/components/forms/Accordion.vue +0 -43
- package/dist/components/forms/Accordion.vue.d.ts +0 -19
- package/dist/components/forms/AppBarSearch.d.vue.ts +0 -43
- package/dist/components/forms/AppBarSearch.vue +0 -345
- package/dist/components/forms/AppBarSearch.vue.d.ts +0 -43
- package/dist/components/forms/AppCombobox.d.vue.ts +0 -13
- package/dist/components/forms/AppCombobox.vue +0 -67
- package/dist/components/forms/AppCombobox.vue.d.ts +0 -13
- package/dist/components/forms/AppDrawerHeaderSection.d.vue.ts +0 -20
- package/dist/components/forms/AppDrawerHeaderSection.vue +0 -21
- package/dist/components/forms/AppDrawerHeaderSection.vue.d.ts +0 -20
- package/dist/components/forms/AppLabel.d.vue.ts +0 -24
- package/dist/components/forms/AppLabel.vue +0 -47
- package/dist/components/forms/AppLabel.vue.d.ts +0 -24
- package/dist/components/forms/AppLink.d.vue.ts +0 -19
- package/dist/components/forms/AppLink.vue +0 -50
- package/dist/components/forms/AppLink.vue.d.ts +0 -19
- package/dist/components/forms/AppNumberField.d.vue.ts +0 -20
- package/dist/components/forms/AppNumberField.vue +0 -85
- package/dist/components/forms/AppNumberField.vue.d.ts +0 -20
- package/dist/components/forms/AppOtpInput.d.vue.ts +0 -13
- package/dist/components/forms/AppOtpInput.vue +0 -84
- package/dist/components/forms/AppOtpInput.vue.d.ts +0 -13
- package/dist/components/forms/AppSearchHeader.d.vue.ts +0 -8
- package/dist/components/forms/AppSearchHeader.vue +0 -72
- package/dist/components/forms/AppSearchHeader.vue.d.ts +0 -8
- package/dist/components/forms/AppSelect.d.vue.ts +0 -17
- package/dist/components/forms/AppSelect.vue +0 -98
- package/dist/components/forms/AppSelect.vue.d.ts +0 -17
- package/dist/components/forms/AppStepper.d.vue.ts +0 -21
- package/dist/components/forms/AppStepper.vue +0 -232
- package/dist/components/forms/AppStepper.vue.d.ts +0 -21
- package/dist/components/forms/AppSwitch.d.vue.ts +0 -16
- package/dist/components/forms/AppSwitch.vue +0 -59
- package/dist/components/forms/AppSwitch.vue.d.ts +0 -16
- package/dist/components/forms/AppTextField.d.vue.ts +0 -13
- package/dist/components/forms/AppTextField.vue +0 -66
- package/dist/components/forms/AppTextField.vue.d.ts +0 -13
- package/dist/components/forms/AppTextarea.d.vue.ts +0 -13
- package/dist/components/forms/AppTextarea.vue +0 -69
- package/dist/components/forms/AppTextarea.vue.d.ts +0 -13
- package/dist/components/forms/AttachmentCropperInput.d.vue.ts +0 -18
- package/dist/components/forms/AttachmentCropperInput.vue +0 -227
- package/dist/components/forms/AttachmentCropperInput.vue.d.ts +0 -18
- package/dist/components/forms/AttachmentInput.d.vue.ts +0 -16
- package/dist/components/forms/AttachmentInput.vue +0 -116
- package/dist/components/forms/AttachmentInput.vue.d.ts +0 -16
- package/dist/components/forms/AutocompleteInput.d.vue.ts +0 -84
- package/dist/components/forms/AutocompleteInput.vue +0 -760
- package/dist/components/forms/AutocompleteInput.vue.d.ts +0 -84
- package/dist/components/forms/BankSelect.d.vue.ts +0 -21
- package/dist/components/forms/BankSelect.vue +0 -43
- package/dist/components/forms/BankSelect.vue.d.ts +0 -21
- package/dist/components/forms/BaseButton.d.vue.ts +0 -20
- package/dist/components/forms/BaseButton.vue +0 -42
- package/dist/components/forms/BaseButton.vue.d.ts +0 -20
- package/dist/components/forms/CounterInput.d.vue.ts +0 -13
- package/dist/components/forms/CounterInput.vue +0 -71
- package/dist/components/forms/CounterInput.vue.d.ts +0 -13
- package/dist/components/forms/CustomCheckboxes.d.vue.ts +0 -25
- package/dist/components/forms/CustomCheckboxes.vue +0 -69
- package/dist/components/forms/CustomCheckboxes.vue.d.ts +0 -25
- package/dist/components/forms/CustomCheckboxesWithIcon.d.vue.ts +0 -25
- package/dist/components/forms/CustomCheckboxesWithIcon.vue +0 -80
- package/dist/components/forms/CustomCheckboxesWithIcon.vue.d.ts +0 -25
- package/dist/components/forms/CustomCheckboxesWithImage.d.vue.ts +0 -16
- package/dist/components/forms/CustomCheckboxesWithImage.vue +0 -67
- package/dist/components/forms/CustomCheckboxesWithImage.vue.d.ts +0 -16
- package/dist/components/forms/CustomRadios.d.vue.ts +0 -25
- package/dist/components/forms/CustomRadios.vue +0 -69
- package/dist/components/forms/CustomRadios.vue.d.ts +0 -25
- package/dist/components/forms/CustomRadiosWithIcon.d.vue.ts +0 -28
- package/dist/components/forms/CustomRadiosWithIcon.vue +0 -98
- package/dist/components/forms/CustomRadiosWithIcon.vue.d.ts +0 -28
- package/dist/components/forms/CustomRadiosWithImage.d.vue.ts +0 -35
- package/dist/components/forms/CustomRadiosWithImage.vue +0 -69
- package/dist/components/forms/CustomRadiosWithImage.vue.d.ts +0 -35
- package/dist/components/forms/DatePicker.d.vue.ts +0 -29
- package/dist/components/forms/DatePicker.vue +0 -400
- package/dist/components/forms/DatePicker.vue.d.ts +0 -29
- package/dist/components/forms/DatePickerRange.d.vue.ts +0 -24
- package/dist/components/forms/DatePickerRange.vue +0 -127
- package/dist/components/forms/DatePickerRange.vue.d.ts +0 -24
- package/dist/components/forms/DraggedUploadFile.d.vue.ts +0 -11
- package/dist/components/forms/DraggedUploadFile.vue +0 -120
- package/dist/components/forms/DraggedUploadFile.vue.d.ts +0 -11
- package/dist/components/forms/ImageCardInput.d.vue.ts +0 -35
- package/dist/components/forms/ImageCardInput.vue +0 -234
- package/dist/components/forms/ImageCardInput.vue.d.ts +0 -35
- package/dist/components/forms/InputValidationWrapper.d.vue.ts +0 -26
- package/dist/components/forms/InputValidationWrapper.vue +0 -24
- package/dist/components/forms/InputValidationWrapper.vue.d.ts +0 -26
- package/dist/components/forms/LicensePlateInput.d.vue.ts +0 -21
- package/dist/components/forms/LicensePlateInput.vue +0 -175
- package/dist/components/forms/LicensePlateInput.vue.d.ts +0 -21
- package/dist/components/forms/ManualDate.d.vue.ts +0 -20
- package/dist/components/forms/ManualDate.vue +0 -264
- package/dist/components/forms/ManualDate.vue.d.ts +0 -20
- package/dist/components/forms/MobileInput.d.vue.ts +0 -25
- package/dist/components/forms/MobileInput.vue +0 -118
- package/dist/components/forms/MobileInput.vue.d.ts +0 -25
- package/dist/components/forms/PasswordInput.d.vue.ts +0 -11
- package/dist/components/forms/PasswordInput.vue +0 -29
- package/dist/components/forms/PasswordInput.vue.d.ts +0 -11
- package/dist/components/forms/RangeInput.d.vue.ts +0 -10
- package/dist/components/forms/RangeInput.vue +0 -48
- package/dist/components/forms/RangeInput.vue.d.ts +0 -10
- package/dist/components/forms/Tabs.d.vue.ts +0 -23
- package/dist/components/forms/Tabs.vue +0 -35
- package/dist/components/forms/Tabs.vue.d.ts +0 -23
- package/dist/components/forms/TimePicker.d.vue.ts +0 -18
- package/dist/components/forms/TimePicker.vue +0 -370
- package/dist/components/forms/TimePicker.vue.d.ts +0 -18
- package/dist/components/table/DataTable.d.vue.ts +0 -70
- package/dist/components/table/DataTable.vue +0 -361
- package/dist/components/table/DataTable.vue.d.ts +0 -70
- package/dist/components/table/EditableDataTable.d.vue.ts +0 -21
- package/dist/components/table/EditableDataTable.vue +0 -328
- package/dist/components/table/EditableDataTable.vue.d.ts +0 -21
- package/dist/components/table/EditableDataTableRow.d.vue.ts +0 -20
- package/dist/components/table/EditableDataTableRow.vue +0 -253
- package/dist/components/table/EditableDataTableRow.vue.d.ts +0 -20
- package/dist/components/table/FilterGenerator.d.vue.ts +0 -13
- package/dist/components/table/FilterGenerator.vue +0 -231
- package/dist/components/table/FilterGenerator.vue.d.ts +0 -13
- package/dist/components/table/StaticTable.d.vue.ts +0 -34
- package/dist/components/table/StaticTable.vue +0 -152
- package/dist/components/table/StaticTable.vue.d.ts +0 -34
- package/dist/components/table/TablePagination.d.vue.ts +0 -15
- package/dist/components/table/TablePagination.vue +0 -73
- package/dist/components/table/TablePagination.vue.d.ts +0 -15
- package/dist/composables/useIsMobile.d.ts +0 -1
- package/dist/composables/useIsMobile.js +0 -10
- package/dist/composables/useIsMobile.mjs +0 -4
- package/dist/composables/useTableFilters.d.ts +0 -23
- package/dist/composables/useTableFilters.js +0 -197
- package/dist/composables/useTableFilters.mjs +0 -184
- package/dist/images/avatar.png +0 -0
- package/dist/images/sa.svg +0 -1
- package/dist/index.d.ts +0 -65
- package/dist/index.js +0 -454
- package/dist/index.mjs +0 -130
- package/dist/lang/ar.json +0 -54
- package/dist/lang/en.json +0 -54
- package/dist/styles/assets/scss/variables/_template.scss +0 -1
- package/dist/styles/assets/scss/variables/_vuetify.scss +0 -1
- package/dist/styles/core/base/_components.scss +0 -164
- package/dist/styles/core/base/_dark.scss +0 -16
- package/dist/styles/core/base/_default-layout-w-vertical-nav.scss +0 -106
- package/dist/styles/core/base/_default-layout.scss +0 -16
- package/dist/styles/core/base/_index.scss +0 -47
- package/dist/styles/core/base/_layouts.scss +0 -63
- package/dist/styles/core/base/_misc.scss +0 -20
- package/dist/styles/core/base/_mixins.scss +0 -84
- package/dist/styles/core/base/_route-transitions.scss +0 -70
- package/dist/styles/core/base/_utilities.scss +0 -418
- package/dist/styles/core/base/_utils.scss +0 -100
- package/dist/styles/core/base/_variables.scss +0 -190
- package/dist/styles/core/base/_vertical-nav.scss +0 -264
- package/dist/styles/core/base/libs/_perfect-scrollbar.scss +0 -35
- package/dist/styles/core/base/libs/vuetify/_index.scss +0 -1
- package/dist/styles/core/base/libs/vuetify/_overrides.scss +0 -380
- package/dist/styles/core/base/libs/vuetify/_variables.scss +0 -48
- package/dist/styles/core/base/placeholders/_default-layout-vertical-nav.scss +0 -48
- package/dist/styles/core/base/placeholders/_default-layout.scss +0 -3
- package/dist/styles/core/base/placeholders/_index.scss +0 -5
- package/dist/styles/core/base/placeholders/_misc.scss +0 -7
- package/dist/styles/core/base/placeholders/_nav.scss +0 -26
- package/dist/styles/core/base/placeholders/_vertical-nav.scss +0 -84
- package/dist/styles/core/base/skins/_bordered.scss +0 -60
- package/dist/styles/core/base/skins/_index.scss +0 -1
- package/dist/styles/core/template/_components.scss +0 -1035
- package/dist/styles/core/template/_default-layout-w-vertical-nav.scss +0 -20
- package/dist/styles/core/template/_utilities.scss +0 -20
- package/dist/styles/core/template/_variables.scss +0 -67
- package/dist/styles/core/template/_vertical-nav.scss +0 -41
- package/dist/styles/core/template/index.css +0 -18779
- package/dist/styles/core/template/index.scss +0 -15
- package/dist/styles/core/template/libs/vuetify/_variables.scss +0 -464
- package/dist/styles/core/template/libs/vuetify/index.css +0 -739
- package/dist/styles/core/template/libs/vuetify/index.scss +0 -1
- package/dist/styles/core/template/pages/misc.css +0 -16
- package/dist/styles/core/template/pages/misc.scss +0 -20
- package/dist/styles/core/template/placeholders/_default-layout-vertical-nav.scss +0 -9
- package/dist/styles/core/template/placeholders/_index.scss +0 -3
- package/dist/styles/core/template/placeholders/_nav.scss +0 -15
- package/dist/styles/core/template/placeholders/_vertical-nav.scss +0 -18
- package/dist/styles/core/template/skins/_bordered.scss +0 -36
- package/dist/styles/core/template/skins/_index.scss +0 -1
- package/dist/styles/layouts/_classes.scss +0 -3
- package/dist/styles/layouts/_dashboard-layout.scss +0 -43
- package/dist/styles/layouts/_global.scss +0 -10
- package/dist/styles/layouts/_mixins.scss +0 -28
- package/dist/styles/layouts/_placeholders.scss +0 -53
- package/dist/styles/layouts/_rtl.scss +0 -7
- package/dist/styles/layouts/_variables.scss +0 -22
- package/dist/styles/layouts/index.css +0 -14
- package/dist/styles/layouts/index.scss +0 -2
- package/dist/types.d.ts +0 -218
- package/dist/utils/apiUrl.d.ts +0 -1
- package/dist/utils/apiUrl.js +0 -15
- package/dist/utils/apiUrl.mjs +0 -8
- package/dist/utils/client.d.ts +0 -9
- package/dist/utils/client.js +0 -53
- package/dist/utils/client.mjs +0 -39
- package/dist/utils/files.d.ts +0 -2
- package/dist/utils/files.js +0 -35
- package/dist/utils/files.mjs +0 -22
- package/dist/utils/formValidation.d.ts +0 -7
- package/dist/utils/formValidation.js +0 -20
- package/dist/utils/formValidation.mjs +0 -13
- package/dist/utils/formatters.d.ts +0 -12
- package/dist/utils/formatters.js +0 -84
- package/dist/utils/formatters.mjs +0 -56
- package/dist/utils/hijriDate.d.ts +0 -58
- package/dist/utils/hijriDate.js +0 -168
- package/dist/utils/hijriDate.mjs +0 -1951
- package/dist/utils/i18n.d.ts +0 -8
- package/dist/utils/i18n.js +0 -36
- package/dist/utils/i18n.mjs +0 -27
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.js +0 -115
- package/dist/utils/index.mjs +0 -10
- package/dist/utils/queryParams.d.ts +0 -4
- package/dist/utils/queryParams.js +0 -26
- package/dist/utils/queryParams.mjs +0 -18
- package/dist/utils/ruleValidator.d.ts +0 -41
- package/dist/utils/ruleValidator.js +0 -210
- package/dist/utils/ruleValidator.mjs +0 -195
- package/dist/utils/toaster.d.ts +0 -12
- package/dist/utils/toaster.js +0 -68
- package/dist/utils/toaster.mjs +0 -58
- package/dist/utils/utils.d.ts +0 -9
- package/dist/utils/utils.js +0 -84
- package/dist/utils/utils.mjs +0 -67
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { ref, nextTick } from "vue";
|
|
2
|
-
import { useI18n } from "vue-i18n";
|
|
3
|
-
import { toaster } from "./toaster.mjs";
|
|
4
|
-
import { isEmpty, isEmptyArray, isNullOrUndefined } from "./utils.mjs";
|
|
5
|
-
export const ruleValidator = () => {
|
|
6
|
-
const { t } = useI18n();
|
|
7
|
-
const requiredValidator = (value) => {
|
|
8
|
-
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false) {
|
|
9
|
-
return t("validation.required");
|
|
10
|
-
}
|
|
11
|
-
return !!String(value).trim().length || t("validation.required");
|
|
12
|
-
};
|
|
13
|
-
const requiredLocationValidator = (locations) => {
|
|
14
|
-
const locationArray = Array.isArray(locations) ? locations : [locations];
|
|
15
|
-
if (!locationArray || locationArray.length === 0) {
|
|
16
|
-
return t("validation.required");
|
|
17
|
-
}
|
|
18
|
-
for (const location of locationArray) {
|
|
19
|
-
if (!location || !location.address || !String(location.address).trim() || location.lat === null || typeof location.lat !== "number" || location.lng === null || typeof location.lng !== "number") {
|
|
20
|
-
return t("validation.required");
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
};
|
|
25
|
-
const ibanValidator = (value) => {
|
|
26
|
-
if (isNullOrUndefined(value) || isEmptyArray(value) || value === false || String(value).length !== 24) {
|
|
27
|
-
return t("validation.iban");
|
|
28
|
-
}
|
|
29
|
-
return !!String(value).trim().length || t("validation.iban");
|
|
30
|
-
};
|
|
31
|
-
const idNumberValidator = (value) => {
|
|
32
|
-
const str = value?.toString() || "";
|
|
33
|
-
const validStarts = ["1", "2", "3", "4"];
|
|
34
|
-
if (str.length !== 10 || !validStarts.includes(str[0])) {
|
|
35
|
-
return t("validation.invalid");
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const requiredManualDateValidator = (value) => {
|
|
39
|
-
if (isEmpty(value?.day) || isEmpty(value?.month) || isEmpty(value?.year)) {
|
|
40
|
-
return t("validation.required");
|
|
41
|
-
}
|
|
42
|
-
return true;
|
|
43
|
-
};
|
|
44
|
-
const emailValidator = (value) => {
|
|
45
|
-
if (isEmpty(value)) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
const re = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/;
|
|
49
|
-
if (Array.isArray(value)) {
|
|
50
|
-
return value.every((val) => re.test(String(val))) || t("validation.email");
|
|
51
|
-
}
|
|
52
|
-
return re.test(String(value)) || t("validation.email");
|
|
53
|
-
};
|
|
54
|
-
const confirmedValidator = (value, target) => value === target || t("validation.confirmed");
|
|
55
|
-
const betweenValidator = (value, min, max) => {
|
|
56
|
-
const valueAsNumber = Number(value);
|
|
57
|
-
return Number(min) <= valueAsNumber && Number(max) >= valueAsNumber || t("validation.between", { min, max });
|
|
58
|
-
};
|
|
59
|
-
const integerValidator = (value) => {
|
|
60
|
-
if (isEmpty(value)) {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
if (Array.isArray(value)) {
|
|
64
|
-
return value.every((val) => /^-?[0-9]+$/.test(String(val))) || t("validation.integer");
|
|
65
|
-
}
|
|
66
|
-
return /^-?[0-9]+$/.test(String(value)) || t("validation.integer");
|
|
67
|
-
};
|
|
68
|
-
const numberValidator = (value) => {
|
|
69
|
-
if (isEmpty(value)) {
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
return /^\d+(\.\d+)?$/.test(String(value)) || t("validation.number");
|
|
73
|
-
};
|
|
74
|
-
const alphaValidator = (value) => {
|
|
75
|
-
if (isEmpty(value)) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
return /^[A-Za-z\u0600-\u06FF\s]*$/i.test(String(value)) || t("validation.alphabetic");
|
|
79
|
-
};
|
|
80
|
-
const alphaWithNumberValidator = (value) => {
|
|
81
|
-
if (isEmpty(value)) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
return /^[A-Za-z\u0600-\u06FF0-9\s]*$/.test(String(value)) || t("validation.alphabetic");
|
|
85
|
-
};
|
|
86
|
-
const urlValidator = (value) => {
|
|
87
|
-
if (isEmpty(value)) {
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
const re = /^(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9.-]+\.[a-zA-Z]{2,5}[.]?/;
|
|
91
|
-
return re.test(String(value)) || t("validation.url");
|
|
92
|
-
};
|
|
93
|
-
const lengthValidator = (value, length) => {
|
|
94
|
-
if (isEmpty(value)) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
return String(value).length === length || t("validation.length", { length });
|
|
98
|
-
};
|
|
99
|
-
const alphaDashValidator = (value) => {
|
|
100
|
-
if (isEmpty(value)) {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
const valueAsString = String(value);
|
|
104
|
-
return /^[0-9A-Z_-]*$/i.test(valueAsString) || t("validation.alpha_dash");
|
|
105
|
-
};
|
|
106
|
-
const fileValidator = (file, maxSizeInMB, types) => {
|
|
107
|
-
if (!file) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
if (file.size > maxSizeInMB * 1024 * 1024) {
|
|
111
|
-
toaster().error(
|
|
112
|
-
t("validation.file_size_limit_exceeded", { size: maxSizeInMB })
|
|
113
|
-
);
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
if (!types.includes(file.type)) {
|
|
117
|
-
toaster().error(
|
|
118
|
-
t("validation.file_type_not_allowed", {
|
|
119
|
-
types: types.map((type) => type.split("/")[1]).join(", ")
|
|
120
|
-
})
|
|
121
|
-
);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
return true;
|
|
125
|
-
};
|
|
126
|
-
const requiredPlateValidator = (value) => {
|
|
127
|
-
if (!value || !value?.every((val) => val !== "")) {
|
|
128
|
-
return t("validation.required");
|
|
129
|
-
}
|
|
130
|
-
return true;
|
|
131
|
-
};
|
|
132
|
-
const dateValidator = (value) => {
|
|
133
|
-
if (isEmpty(value)) {
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
const dateString = String(value);
|
|
137
|
-
const datePattern = /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/(\d{4})$/;
|
|
138
|
-
if (!datePattern.test(dateString)) {
|
|
139
|
-
return t("validation.date", { format: "DD/MM/YYYY" });
|
|
140
|
-
}
|
|
141
|
-
return true;
|
|
142
|
-
};
|
|
143
|
-
const regexValidator = (value, regex, message) => {
|
|
144
|
-
return regex.test(value) || message || t("validation.invalid");
|
|
145
|
-
};
|
|
146
|
-
return {
|
|
147
|
-
fileValidator,
|
|
148
|
-
requiredValidator,
|
|
149
|
-
requiredLocationValidator,
|
|
150
|
-
emailValidator,
|
|
151
|
-
alphaValidator,
|
|
152
|
-
alphaDashValidator,
|
|
153
|
-
alphaWithNumberValidator,
|
|
154
|
-
betweenValidator,
|
|
155
|
-
integerValidator,
|
|
156
|
-
numberValidator,
|
|
157
|
-
confirmedValidator,
|
|
158
|
-
urlValidator,
|
|
159
|
-
lengthValidator,
|
|
160
|
-
ibanValidator,
|
|
161
|
-
dateValidator,
|
|
162
|
-
regexValidator,
|
|
163
|
-
idNumberValidator,
|
|
164
|
-
requiredManualDateValidator,
|
|
165
|
-
requiredPlateValidator
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
export const useFormValidation = () => {
|
|
169
|
-
const validationType = ref("submit");
|
|
170
|
-
const validateAndScroll = async (refVForm) => {
|
|
171
|
-
const isValid = await refVForm?.validate();
|
|
172
|
-
await scrollToError();
|
|
173
|
-
if (isValid?.valid === false) {
|
|
174
|
-
await scrollToError();
|
|
175
|
-
validationType.value = "input";
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
return true;
|
|
179
|
-
};
|
|
180
|
-
const scrollToError = async () => {
|
|
181
|
-
validationType.value = "input";
|
|
182
|
-
await nextTick(() => {
|
|
183
|
-
const el = document.querySelector(".v-messages__message:first-of-type");
|
|
184
|
-
el?.scrollIntoView({
|
|
185
|
-
behavior: "smooth",
|
|
186
|
-
block: "center"
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
return {
|
|
191
|
-
validateAndScroll,
|
|
192
|
-
validationType,
|
|
193
|
-
scrollToError
|
|
194
|
-
};
|
|
195
|
-
};
|
package/dist/utils/toaster.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { FetchError } from 'ofetch';
|
|
2
|
-
import type { ErrorResponse } from '../types';
|
|
3
|
-
export declare const toaster: () => {
|
|
4
|
-
success: (message?: string) => void;
|
|
5
|
-
error: (message?: string) => void;
|
|
6
|
-
successLang: (message: string) => void;
|
|
7
|
-
errorLang: (message: string) => void;
|
|
8
|
-
};
|
|
9
|
-
export declare function responseAlert(): {
|
|
10
|
-
showAlert: (response?: FetchError<ErrorResponse>) => void;
|
|
11
|
-
showValidationAlert: (response?: FetchError<ErrorResponse>) => void;
|
|
12
|
-
};
|
package/dist/utils/toaster.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.responseAlert = responseAlert;
|
|
7
|
-
exports.toaster = void 0;
|
|
8
|
-
var _vueSonner = require("vue-sonner");
|
|
9
|
-
var _i18n = require("./i18n");
|
|
10
|
-
const toaster = () => {
|
|
11
|
-
const success = message => {
|
|
12
|
-
_vueSonner.toast.success(message ?? (0, _i18n.i18n)().global.t("success"));
|
|
13
|
-
};
|
|
14
|
-
const error = message => {
|
|
15
|
-
_vueSonner.toast.error(message ?? (0, _i18n.i18n)().global.t("error"));
|
|
16
|
-
};
|
|
17
|
-
const successLang = message => {
|
|
18
|
-
_vueSonner.toast.success((0, _i18n.i18n)().global.t(message));
|
|
19
|
-
};
|
|
20
|
-
const errorLang = message => {
|
|
21
|
-
_vueSonner.toast.error((0, _i18n.i18n)().global.t(message));
|
|
22
|
-
};
|
|
23
|
-
return {
|
|
24
|
-
success,
|
|
25
|
-
error,
|
|
26
|
-
successLang,
|
|
27
|
-
errorLang
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
exports.toaster = toaster;
|
|
31
|
-
function responseAlert() {
|
|
32
|
-
const {
|
|
33
|
-
error: showError
|
|
34
|
-
} = toaster();
|
|
35
|
-
const getErrorMessage = response => {
|
|
36
|
-
const errorResponse = response?.response?._data;
|
|
37
|
-
const error = errorResponse?.status.errors_list?.find(e => e.field == "0");
|
|
38
|
-
const message = errorResponse?.status.message;
|
|
39
|
-
if (!error && !message) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
if (response?.data?.status.code === 422) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
return error ? error.message : message;
|
|
46
|
-
};
|
|
47
|
-
const showAlert = response => {
|
|
48
|
-
const message = getErrorMessage(response);
|
|
49
|
-
if (message) {
|
|
50
|
-
showError(message);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const showValidationAlert = response => {
|
|
54
|
-
const errorResponse = response?.response?._data;
|
|
55
|
-
if (response?.data?.status.code === 422) {
|
|
56
|
-
const validationErrors = errorResponse?.status.errors_list?.map(error => error.message).join(" ,");
|
|
57
|
-
if (validationErrors) {
|
|
58
|
-
showError(validationErrors);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
showAlert(response);
|
|
63
|
-
};
|
|
64
|
-
return {
|
|
65
|
-
showAlert,
|
|
66
|
-
showValidationAlert
|
|
67
|
-
};
|
|
68
|
-
}
|
package/dist/utils/toaster.mjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { toast as sonnerToast } from "vue-sonner";
|
|
2
|
-
import { i18n } from "./i18n.mjs";
|
|
3
|
-
export const toaster = () => {
|
|
4
|
-
const success = (message) => {
|
|
5
|
-
sonnerToast.success(message ?? i18n().global.t("success"));
|
|
6
|
-
};
|
|
7
|
-
const error = (message) => {
|
|
8
|
-
sonnerToast.error(message ?? i18n().global.t("error"));
|
|
9
|
-
};
|
|
10
|
-
const successLang = (message) => {
|
|
11
|
-
sonnerToast.success(i18n().global.t(message));
|
|
12
|
-
};
|
|
13
|
-
const errorLang = (message) => {
|
|
14
|
-
sonnerToast.error(i18n().global.t(message));
|
|
15
|
-
};
|
|
16
|
-
return {
|
|
17
|
-
success,
|
|
18
|
-
error,
|
|
19
|
-
successLang,
|
|
20
|
-
errorLang
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export function responseAlert() {
|
|
24
|
-
const { error: showError } = toaster();
|
|
25
|
-
const getErrorMessage = (response) => {
|
|
26
|
-
const errorResponse = response?.response?._data;
|
|
27
|
-
const error = errorResponse?.status.errors_list?.find((e) => e.field == "0");
|
|
28
|
-
const message = errorResponse?.status.message;
|
|
29
|
-
if (!error && !message) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
if (response?.data?.status.code === 422) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return error ? error.message : message;
|
|
36
|
-
};
|
|
37
|
-
const showAlert = (response) => {
|
|
38
|
-
const message = getErrorMessage(response);
|
|
39
|
-
if (message) {
|
|
40
|
-
showError(message);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const showValidationAlert = (response) => {
|
|
44
|
-
const errorResponse = response?.response?._data;
|
|
45
|
-
if (response?.data?.status.code === 422) {
|
|
46
|
-
const validationErrors = errorResponse?.status.errors_list?.map((error) => error.message).join(" ,");
|
|
47
|
-
if (validationErrors) {
|
|
48
|
-
showError(validationErrors);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
showAlert(response);
|
|
53
|
-
};
|
|
54
|
-
return {
|
|
55
|
-
showAlert,
|
|
56
|
-
showValidationAlert
|
|
57
|
-
};
|
|
58
|
-
}
|
package/dist/utils/utils.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const generateRandomId: (length: number) => string;
|
|
2
|
-
export declare const generateUniqueId: () => string;
|
|
3
|
-
export declare const isEmpty: (value: unknown) => boolean;
|
|
4
|
-
export declare const isNullOrUndefined: (value: unknown) => value is undefined | null;
|
|
5
|
-
export declare const isEmptyArray: (arr: unknown) => boolean;
|
|
6
|
-
export declare const buildFormData: <T>(data: T | T[], excludedKeys?: string[], formData?: FormData, parentKey?: string) => FormData;
|
|
7
|
-
export declare const stripLeadingZero: (mobile: string) => string;
|
|
8
|
-
export declare const cloneObjectDeep: <T>(obj: T) => T;
|
|
9
|
-
export declare const mergeDeep: (target: any, source: any) => any;
|
package/dist/utils/utils.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.stripLeadingZero = exports.mergeDeep = exports.isNullOrUndefined = exports.isEmptyArray = exports.isEmpty = exports.generateUniqueId = exports.generateRandomId = exports.cloneObjectDeep = exports.buildFormData = void 0;
|
|
7
|
-
const generateRandomId = length => {
|
|
8
|
-
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
9
|
-
let result = "";
|
|
10
|
-
for (let i = 0; i < length; i++) {
|
|
11
|
-
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
12
|
-
}
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
exports.generateRandomId = generateRandomId;
|
|
16
|
-
const generateUniqueId = () => {
|
|
17
|
-
const timestamp = (/* @__PURE__ */new Date()).getTime().toString(36);
|
|
18
|
-
const randomPart = generateRandomId(6);
|
|
19
|
-
return `${timestamp}-${randomPart}`;
|
|
20
|
-
};
|
|
21
|
-
exports.generateUniqueId = generateUniqueId;
|
|
22
|
-
const isEmpty = value => {
|
|
23
|
-
if (value === null || value === void 0 || value === "") {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return !!(Array.isArray(value) && value.length === 0);
|
|
27
|
-
};
|
|
28
|
-
exports.isEmpty = isEmpty;
|
|
29
|
-
const isNullOrUndefined = value => {
|
|
30
|
-
return value === null || value === void 0;
|
|
31
|
-
};
|
|
32
|
-
exports.isNullOrUndefined = isNullOrUndefined;
|
|
33
|
-
const isEmptyArray = arr => {
|
|
34
|
-
return Array.isArray(arr) && arr.length === 0;
|
|
35
|
-
};
|
|
36
|
-
exports.isEmptyArray = isEmptyArray;
|
|
37
|
-
const buildFormData = (data, excludedKeys = [], formData = new FormData(), parentKey = "") => {
|
|
38
|
-
if (Array.isArray(data)) {
|
|
39
|
-
data.forEach((item, index) => {
|
|
40
|
-
buildFormData(item, excludedKeys, formData, `${parentKey}[${index}]`);
|
|
41
|
-
});
|
|
42
|
-
return formData;
|
|
43
|
-
}
|
|
44
|
-
if (data && typeof data === "object" && !(data instanceof File)) {
|
|
45
|
-
Object.keys(data).forEach(key => {
|
|
46
|
-
if (excludedKeys.includes(key)) return;
|
|
47
|
-
const value = data[key];
|
|
48
|
-
const newKey = parentKey ? `${parentKey}[${key}]` : key;
|
|
49
|
-
buildFormData(value, excludedKeys, formData, newKey);
|
|
50
|
-
});
|
|
51
|
-
return formData;
|
|
52
|
-
}
|
|
53
|
-
if (data instanceof File) {
|
|
54
|
-
formData.append(parentKey, data);
|
|
55
|
-
} else if (typeof data === "boolean") {
|
|
56
|
-
formData.append(parentKey, data ? "1" : "0");
|
|
57
|
-
} else if (data != null) {
|
|
58
|
-
formData.append(parentKey, data.toString());
|
|
59
|
-
}
|
|
60
|
-
return formData;
|
|
61
|
-
};
|
|
62
|
-
exports.buildFormData = buildFormData;
|
|
63
|
-
const stripLeadingZero = mobile => {
|
|
64
|
-
return mobile.replace(/^0+/, "");
|
|
65
|
-
};
|
|
66
|
-
exports.stripLeadingZero = stripLeadingZero;
|
|
67
|
-
const cloneObjectDeep = obj => {
|
|
68
|
-
return JSON.parse(JSON.stringify(obj));
|
|
69
|
-
};
|
|
70
|
-
exports.cloneObjectDeep = cloneObjectDeep;
|
|
71
|
-
const mergeDeep = (target, source) => {
|
|
72
|
-
const output = {
|
|
73
|
-
...target
|
|
74
|
-
};
|
|
75
|
-
for (const key in source) {
|
|
76
|
-
if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) {
|
|
77
|
-
output[key] = mergeDeep(target[key] || {}, source[key]);
|
|
78
|
-
} else {
|
|
79
|
-
output[key] = source[key];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return output;
|
|
83
|
-
};
|
|
84
|
-
exports.mergeDeep = mergeDeep;
|
package/dist/utils/utils.mjs
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
export const generateRandomId = (length) => {
|
|
2
|
-
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
3
|
-
let result = "";
|
|
4
|
-
for (let i = 0; i < length; i++) {
|
|
5
|
-
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
6
|
-
}
|
|
7
|
-
return result;
|
|
8
|
-
};
|
|
9
|
-
export const generateUniqueId = () => {
|
|
10
|
-
const timestamp = (/* @__PURE__ */ new Date()).getTime().toString(36);
|
|
11
|
-
const randomPart = generateRandomId(6);
|
|
12
|
-
return `${timestamp}-${randomPart}`;
|
|
13
|
-
};
|
|
14
|
-
export const isEmpty = (value) => {
|
|
15
|
-
if (value === null || value === void 0 || value === "") {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
return !!(Array.isArray(value) && value.length === 0);
|
|
19
|
-
};
|
|
20
|
-
export const isNullOrUndefined = (value) => {
|
|
21
|
-
return value === null || value === void 0;
|
|
22
|
-
};
|
|
23
|
-
export const isEmptyArray = (arr) => {
|
|
24
|
-
return Array.isArray(arr) && arr.length === 0;
|
|
25
|
-
};
|
|
26
|
-
export const buildFormData = (data, excludedKeys = [], formData = new FormData(), parentKey = "") => {
|
|
27
|
-
if (Array.isArray(data)) {
|
|
28
|
-
data.forEach((item, index) => {
|
|
29
|
-
buildFormData(item, excludedKeys, formData, `${parentKey}[${index}]`);
|
|
30
|
-
});
|
|
31
|
-
return formData;
|
|
32
|
-
}
|
|
33
|
-
if (data && typeof data === "object" && !(data instanceof File)) {
|
|
34
|
-
Object.keys(data).forEach((key) => {
|
|
35
|
-
if (excludedKeys.includes(key)) return;
|
|
36
|
-
const value = data[key];
|
|
37
|
-
const newKey = parentKey ? `${parentKey}[${key}]` : key;
|
|
38
|
-
buildFormData(value, excludedKeys, formData, newKey);
|
|
39
|
-
});
|
|
40
|
-
return formData;
|
|
41
|
-
}
|
|
42
|
-
if (data instanceof File) {
|
|
43
|
-
formData.append(parentKey, data);
|
|
44
|
-
} else if (typeof data === "boolean") {
|
|
45
|
-
formData.append(parentKey, data ? "1" : "0");
|
|
46
|
-
} else if (data != null) {
|
|
47
|
-
formData.append(parentKey, data.toString());
|
|
48
|
-
}
|
|
49
|
-
return formData;
|
|
50
|
-
};
|
|
51
|
-
export const stripLeadingZero = (mobile) => {
|
|
52
|
-
return mobile.replace(/^0+/, "");
|
|
53
|
-
};
|
|
54
|
-
export const cloneObjectDeep = (obj) => {
|
|
55
|
-
return JSON.parse(JSON.stringify(obj));
|
|
56
|
-
};
|
|
57
|
-
export const mergeDeep = (target, source) => {
|
|
58
|
-
const output = { ...target };
|
|
59
|
-
for (const key in source) {
|
|
60
|
-
if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) {
|
|
61
|
-
output[key] = mergeDeep(target[key] || {}, source[key]);
|
|
62
|
-
} else {
|
|
63
|
-
output[key] = source[key];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return output;
|
|
67
|
-
};
|