@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,227 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import Cropper from "cropperjs";
|
|
3
|
-
import { ref, computed, watch, nextTick } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
|
-
import { VIcon, VBtn, VValidation, VSlider } from "vuetify/components";
|
|
6
|
-
import { ruleValidator } from "../../utils/ruleValidator";
|
|
7
|
-
import Modal from "../Modal.vue";
|
|
8
|
-
import { generateUniqueId } from "../../utils/utils";
|
|
9
|
-
import BaseButton from "./BaseButton.vue";
|
|
10
|
-
const props = defineProps({
|
|
11
|
-
validTypes: { type: Array, required: false, default: () => ["image/png", "image/jpeg", "image/jpg"] },
|
|
12
|
-
rules: { type: Array, required: false },
|
|
13
|
-
multiple: { type: Boolean, required: false, default: false },
|
|
14
|
-
modelValue: { type: [Object, Array, null], required: true },
|
|
15
|
-
sizeInMB: { type: Number, required: false, default: 3 },
|
|
16
|
-
showPreview: { type: Boolean, required: false, default: true },
|
|
17
|
-
cropWidth: { type: Number, required: false, default: 120 },
|
|
18
|
-
cropHeight: { type: Number, required: false, default: 40 }
|
|
19
|
-
});
|
|
20
|
-
const emit = defineEmits(["update:model-value"]);
|
|
21
|
-
const { locale } = useI18n();
|
|
22
|
-
const { fileValidator } = ruleValidator();
|
|
23
|
-
const imageUploadInput = ref(null);
|
|
24
|
-
const attachments = ref([]);
|
|
25
|
-
const cropperDialog = ref(false);
|
|
26
|
-
const cropImageSrc = ref(null);
|
|
27
|
-
const selectedFile = ref(null);
|
|
28
|
-
const cropperInstance = ref(null);
|
|
29
|
-
const zoomLevel = ref(1);
|
|
30
|
-
const initialZoom = ref(1);
|
|
31
|
-
const cropperImage = ref(null);
|
|
32
|
-
const allowMultipleAttachments = computed(
|
|
33
|
-
() => props.multiple || !props.showPreview ? true : attachments.value?.length === 0
|
|
34
|
-
);
|
|
35
|
-
const onImageChanged = (e) => {
|
|
36
|
-
const target = e.target;
|
|
37
|
-
const file = target.files?.[0];
|
|
38
|
-
const isValid = fileValidator(file, props.sizeInMB, props.validTypes);
|
|
39
|
-
if (isValid && file) {
|
|
40
|
-
selectedFile.value = file;
|
|
41
|
-
cropImageSrc.value = URL.createObjectURL(file);
|
|
42
|
-
cropperDialog.value = true;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const initCropper = () => {
|
|
46
|
-
if (cropperInstance.value) {
|
|
47
|
-
cropperInstance.value.destroy();
|
|
48
|
-
}
|
|
49
|
-
if (cropperImage.value) {
|
|
50
|
-
cropperInstance.value = new Cropper(cropperImage.value, {
|
|
51
|
-
viewMode: 1,
|
|
52
|
-
responsive: true,
|
|
53
|
-
zoomable: true,
|
|
54
|
-
scalable: false,
|
|
55
|
-
movable: true,
|
|
56
|
-
wheelZoomRatio: 0,
|
|
57
|
-
zoomOnWheel: false,
|
|
58
|
-
ready() {
|
|
59
|
-
const data = cropperInstance.value?.getImageData();
|
|
60
|
-
initialZoom.value = data ? Math.min(data.width / data.naturalWidth, data.height / data.naturalHeight) : 1;
|
|
61
|
-
zoomLevel.value = initialZoom.value;
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const closeCropper = () => {
|
|
67
|
-
cropperDialog.value = false;
|
|
68
|
-
selectedFile.value = null;
|
|
69
|
-
if (imageUploadInput.value) {
|
|
70
|
-
imageUploadInput.value.value = "";
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const resizeCanvas = (canvas, width, height) => {
|
|
74
|
-
const offscreenCanvas = document.createElement("canvas");
|
|
75
|
-
offscreenCanvas.width = width;
|
|
76
|
-
offscreenCanvas.height = height;
|
|
77
|
-
const ctx = offscreenCanvas.getContext("2d");
|
|
78
|
-
if (ctx) {
|
|
79
|
-
ctx.drawImage(canvas, 0, 0, width, height);
|
|
80
|
-
}
|
|
81
|
-
return offscreenCanvas;
|
|
82
|
-
};
|
|
83
|
-
const cropImage = () => {
|
|
84
|
-
if (!cropperInstance.value) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const targetWidth = props.cropWidth;
|
|
88
|
-
const targetHeight = props.cropHeight;
|
|
89
|
-
let canvas = cropperInstance.value.getCroppedCanvas();
|
|
90
|
-
if (!canvas) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
if (canvas.width !== targetWidth || canvas.height !== targetHeight) {
|
|
94
|
-
canvas = resizeCanvas(canvas, targetWidth, targetHeight);
|
|
95
|
-
}
|
|
96
|
-
canvas.toBlob((blob) => {
|
|
97
|
-
if (blob && selectedFile.value) {
|
|
98
|
-
const croppedFile = new File([blob], selectedFile.value.name, { type: selectedFile.value.type });
|
|
99
|
-
const attachment = {
|
|
100
|
-
id: generateUniqueId(),
|
|
101
|
-
src: URL.createObjectURL(croppedFile),
|
|
102
|
-
file: croppedFile
|
|
103
|
-
};
|
|
104
|
-
attachments.value.push(attachment);
|
|
105
|
-
emit("update:model-value", props.multiple ? attachments.value : attachment);
|
|
106
|
-
cropperDialog.value = false;
|
|
107
|
-
}
|
|
108
|
-
}, selectedFile.value?.type);
|
|
109
|
-
};
|
|
110
|
-
const removeImageCopy = (id) => {
|
|
111
|
-
const index = attachments.value.findIndex((attachment) => attachment.id === id);
|
|
112
|
-
if (index > -1) {
|
|
113
|
-
attachments.value.splice(index, 1);
|
|
114
|
-
emit("update:model-value", props.multiple ? attachments.value : attachments.value[0] || null);
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
watch(zoomLevel, async (newZoom) => {
|
|
118
|
-
await nextTick(() => {
|
|
119
|
-
if (cropperInstance.value) {
|
|
120
|
-
cropperInstance.value.zoomTo(newZoom);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
</script>
|
|
125
|
-
|
|
126
|
-
<template>
|
|
127
|
-
<div class="d-flex flex-column">
|
|
128
|
-
<div class="d-flex align-center gap-3">
|
|
129
|
-
<BaseButton
|
|
130
|
-
v-if="allowMultipleAttachments"
|
|
131
|
-
size="48"
|
|
132
|
-
color="gray-200"
|
|
133
|
-
elevation="0"
|
|
134
|
-
class="app-z-40"
|
|
135
|
-
@click="imageUploadInput?.click()"
|
|
136
|
-
>
|
|
137
|
-
<VIcon size="28" icon="tabler-upload" color="on-gray-200" />
|
|
138
|
-
</BaseButton>
|
|
139
|
-
|
|
140
|
-
<TransitionGroup
|
|
141
|
-
v-if="showPreview"
|
|
142
|
-
tag="div"
|
|
143
|
-
class="d-flex align-center flex-wrap sb-w-full gap-3"
|
|
144
|
-
enter-active-class="slide-in-right"
|
|
145
|
-
leave-active-class="slide-out-right"
|
|
146
|
-
mode="out-in"
|
|
147
|
-
>
|
|
148
|
-
<div
|
|
149
|
-
v-for="attachment in attachments"
|
|
150
|
-
:key="attachment.id"
|
|
151
|
-
class="app-w-48px app-h-48px bg-gray-50 app-rounded-6 position-relative d-flex align-center justify-center"
|
|
152
|
-
>
|
|
153
|
-
<img v-if="attachment.src" :src="attachment.src" class="app-rounded-6 overflow-hidden app-w-48px app-h-48px">
|
|
154
|
-
<VIcon v-else color="gray-600">
|
|
155
|
-
tabler-pdf
|
|
156
|
-
</VIcon>
|
|
157
|
-
<VBtn
|
|
158
|
-
icon="tabler-x"
|
|
159
|
-
size="20"
|
|
160
|
-
color="red"
|
|
161
|
-
small
|
|
162
|
-
class="d-flex align-center justify-center position-absolute app-top--8px app-z-10"
|
|
163
|
-
:class="locale === 'en' ? 'app-right--8px' : 'app-left--8px'"
|
|
164
|
-
@click="removeImageCopy(attachment.id)"
|
|
165
|
-
/>
|
|
166
|
-
</div>
|
|
167
|
-
</TransitionGroup>
|
|
168
|
-
</div>
|
|
169
|
-
|
|
170
|
-
<VValidation
|
|
171
|
-
v-slot="{ errorMessages: validationErrors, isValid }"
|
|
172
|
-
ref="attachmentInputRef"
|
|
173
|
-
v-model="attachments"
|
|
174
|
-
:rules="rules"
|
|
175
|
-
validate-on="submit lazy"
|
|
176
|
-
>
|
|
177
|
-
<div class="d-flex flex-column">
|
|
178
|
-
<input
|
|
179
|
-
ref="imageUploadInput"
|
|
180
|
-
class="d-none"
|
|
181
|
-
type="file"
|
|
182
|
-
:disabled="!allowMultipleAttachments"
|
|
183
|
-
:accept="validTypes?.join(',')"
|
|
184
|
-
@change="onImageChanged($event)"
|
|
185
|
-
>
|
|
186
|
-
<VMessages class="mt-1 d-block" :messages="validationErrors.value" :active="isValid.value === false" />
|
|
187
|
-
</div>
|
|
188
|
-
</VValidation>
|
|
189
|
-
|
|
190
|
-
<!-- Cropper Dialog -->
|
|
191
|
-
<Modal
|
|
192
|
-
v-model="cropperDialog"
|
|
193
|
-
persistent
|
|
194
|
-
width="500"
|
|
195
|
-
:has-icon="false"
|
|
196
|
-
@save="cropImage"
|
|
197
|
-
@cancel="closeCropper"
|
|
198
|
-
>
|
|
199
|
-
<img
|
|
200
|
-
v-if="cropImageSrc"
|
|
201
|
-
ref="cropperImage"
|
|
202
|
-
:src="cropImageSrc"
|
|
203
|
-
style="max-width: 100%; margin-bottom: 1px;"
|
|
204
|
-
@load="initCropper"
|
|
205
|
-
>
|
|
206
|
-
|
|
207
|
-
<template #additional-actions>
|
|
208
|
-
<VSlider
|
|
209
|
-
v-model="zoomLevel"
|
|
210
|
-
class="pa-3 mt-2 flex-grow-1"
|
|
211
|
-
:min="initialZoom"
|
|
212
|
-
:max="initialZoom * 3"
|
|
213
|
-
step="0.1"
|
|
214
|
-
density="comfortable"
|
|
215
|
-
track-size="6"
|
|
216
|
-
thumb-size="18"
|
|
217
|
-
prepend-icon="tabler-minus"
|
|
218
|
-
append-icon="tabler-plus"
|
|
219
|
-
/>
|
|
220
|
-
</template>
|
|
221
|
-
</Modal>
|
|
222
|
-
</div>
|
|
223
|
-
</template>
|
|
224
|
-
|
|
225
|
-
<style scoped>
|
|
226
|
-
@import "cropperjs/dist/cropper.css";:deep(.cropper-container){width:auto!important}:global(.cropper-line),:global(.cropper-point){background-color:rgb(var(--v-theme-primary))!important}:global(.cropper-view-box){outline-color:rgba(var(--v-theme-primary),.75)!important}
|
|
227
|
-
</style>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Attachment } from '../../types';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
validTypes?: string[];
|
|
4
|
-
rules?: ((value: unknown) => typeof value | string)[];
|
|
5
|
-
multiple?: boolean;
|
|
6
|
-
modelValue: Attachment | Attachment[] | null;
|
|
7
|
-
sizeInMB?: number;
|
|
8
|
-
showPreview?: boolean;
|
|
9
|
-
cropWidth?: number;
|
|
10
|
-
cropHeight?: number;
|
|
11
|
-
};
|
|
12
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
13
|
-
"update:model-value": (value: Attachment | Attachment[]) => any;
|
|
14
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
-
"onUpdate:model-value"?: ((value: Attachment | Attachment[]) => any) | undefined;
|
|
16
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
-
declare const _default: typeof __VLS_export;
|
|
18
|
-
export default _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Attachment } from '../../types';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
validTypes?: string[];
|
|
4
|
-
rules?: ((value: unknown) => typeof value | string)[];
|
|
5
|
-
multiple?: boolean;
|
|
6
|
-
modelValue: Attachment | Attachment[] | null;
|
|
7
|
-
sizeInMB?: number;
|
|
8
|
-
showPreview?: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
11
|
-
"update:model-value": (value: Attachment | Attachment[]) => any;
|
|
12
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
-
"onUpdate:model-value"?: ((value: Attachment | Attachment[]) => any) | undefined;
|
|
14
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
-
declare const _default: typeof __VLS_export;
|
|
16
|
-
export default _default;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { VBtn, VIcon, VValidation, VMessages } from "vuetify/components";
|
|
3
|
-
import { ref, computed } from "vue";
|
|
4
|
-
import { useI18n } from "vue-i18n";
|
|
5
|
-
import { generateUniqueId } from "../../utils/utils";
|
|
6
|
-
import { ruleValidator } from "../../utils/ruleValidator";
|
|
7
|
-
import BaseButton from "./BaseButton.vue";
|
|
8
|
-
const props = defineProps({
|
|
9
|
-
validTypes: { type: Array, required: false, default: () => ["image/png", "image/jpeg", "image/jpg"] },
|
|
10
|
-
rules: { type: Array, required: false },
|
|
11
|
-
multiple: { type: Boolean, required: false, default: false },
|
|
12
|
-
modelValue: { type: [Object, Array, null], required: true },
|
|
13
|
-
sizeInMB: { type: Number, required: false, default: 3 },
|
|
14
|
-
showPreview: { type: Boolean, required: false, default: true }
|
|
15
|
-
});
|
|
16
|
-
const emit = defineEmits(["update:model-value"]);
|
|
17
|
-
const { locale } = useI18n();
|
|
18
|
-
const { fileValidator } = ruleValidator();
|
|
19
|
-
const imageUploadInput = ref(null);
|
|
20
|
-
const attachments = ref([]);
|
|
21
|
-
const allowMultipleAttachments = computed(() => props.multiple || !props.showPreview ? true : attachments.value?.length === 0 && attachments.value?.length < 1);
|
|
22
|
-
const onImageChanged = (e, validate) => {
|
|
23
|
-
const target = e.target;
|
|
24
|
-
const file = target.files?.[0];
|
|
25
|
-
const isVaild = fileValidator(file, props.sizeInMB, props.validTypes);
|
|
26
|
-
if (isVaild && file) {
|
|
27
|
-
const attachment = {
|
|
28
|
-
id: generateUniqueId(),
|
|
29
|
-
src: file.type !== "application/pdf" ? createImageUrl(file) : "",
|
|
30
|
-
file
|
|
31
|
-
};
|
|
32
|
-
attachments.value.push(attachment);
|
|
33
|
-
validate();
|
|
34
|
-
emit("update:model-value", props.multiple ? attachments.value : attachments.value[attachments.value.length - 1]);
|
|
35
|
-
if (imageUploadInput.value) {
|
|
36
|
-
imageUploadInput.value.value = "";
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
function createImageUrl(file) {
|
|
41
|
-
const imageUrl = URL.createObjectURL(file);
|
|
42
|
-
return imageUrl;
|
|
43
|
-
}
|
|
44
|
-
const removeImageCopy = (id) => {
|
|
45
|
-
const attachmentIndex = attachments.value.findIndex((attachment) => attachment.id === id);
|
|
46
|
-
if (attachmentIndex > -1) {
|
|
47
|
-
attachments.value.splice(attachmentIndex, 1);
|
|
48
|
-
emit("update:model-value", props.multiple ? attachments.value : attachments.value[0]);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<template>
|
|
54
|
-
<div class="d-flex flex-column">
|
|
55
|
-
<div class="d-flex align-center gap-3">
|
|
56
|
-
<BaseButton
|
|
57
|
-
v-if="allowMultipleAttachments"
|
|
58
|
-
size="48"
|
|
59
|
-
color="gray-200"
|
|
60
|
-
elevation="0"
|
|
61
|
-
class="app-z-40"
|
|
62
|
-
@click="imageUploadInput?.click()"
|
|
63
|
-
>
|
|
64
|
-
<VIcon
|
|
65
|
-
size="28"
|
|
66
|
-
icon="tabler-upload"
|
|
67
|
-
color="on-gray-200"
|
|
68
|
-
/>
|
|
69
|
-
</BaseButton>
|
|
70
|
-
<TransitionGroup
|
|
71
|
-
v-if="showPreview"
|
|
72
|
-
tag="div"
|
|
73
|
-
class="d-flex align-center flex-wrap sb-w-full gap-3"
|
|
74
|
-
enter-active-class="slide-in-right"
|
|
75
|
-
leave-active-class="slide-out-right"
|
|
76
|
-
mode="out-in"
|
|
77
|
-
>
|
|
78
|
-
<div v-for="attachment in attachments" :key="attachment.id" class="app-w-48px app-h-48px bg-gray-50 app-rounded-6 position-relative d-flex align-center justify-center">
|
|
79
|
-
<img v-if="attachment.src" :src="attachment.src" class="app-rounded-6 overflow-hidden app-w-48px app-h-48px">
|
|
80
|
-
<VIcon v-else color="gray-600">
|
|
81
|
-
tabler-pdf
|
|
82
|
-
</VIcon>
|
|
83
|
-
<VBtn
|
|
84
|
-
icon="tabler-x"
|
|
85
|
-
size="20"
|
|
86
|
-
color="red"
|
|
87
|
-
small
|
|
88
|
-
class="d-flex align-center justify-center position-absolute app-top--8px app-z-10"
|
|
89
|
-
:class="locale === 'en' ? 'app-right--8px' : 'app-left--8px'"
|
|
90
|
-
@click="removeImageCopy(attachment.id)"
|
|
91
|
-
/>
|
|
92
|
-
</div>
|
|
93
|
-
</TransitionGroup>
|
|
94
|
-
</div>
|
|
95
|
-
<VValidation
|
|
96
|
-
v-slot="{ errorMessages: validationErrors, isValid, validate }"
|
|
97
|
-
ref="attachmentInputRef"
|
|
98
|
-
v-model="attachments"
|
|
99
|
-
:rules="rules"
|
|
100
|
-
validate-on="submit lazy"
|
|
101
|
-
>
|
|
102
|
-
<div class="d-flex flex-column">
|
|
103
|
-
<input
|
|
104
|
-
ref="imageUploadInput"
|
|
105
|
-
class="d-none"
|
|
106
|
-
type="file"
|
|
107
|
-
:disabled="!allowMultipleAttachments"
|
|
108
|
-
:accept="validTypes?.join(',')"
|
|
109
|
-
@change="onImageChanged($event, validate)"
|
|
110
|
-
>
|
|
111
|
-
|
|
112
|
-
<VMessages class="mt-1 d-block" :messages="validationErrors.value" :active="isValid.value === false" />
|
|
113
|
-
</div>
|
|
114
|
-
</VValidation>
|
|
115
|
-
</div>
|
|
116
|
-
</template>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Attachment } from '../../types';
|
|
2
|
-
type __VLS_Props = {
|
|
3
|
-
validTypes?: string[];
|
|
4
|
-
rules?: ((value: unknown) => typeof value | string)[];
|
|
5
|
-
multiple?: boolean;
|
|
6
|
-
modelValue: Attachment | Attachment[] | null;
|
|
7
|
-
sizeInMB?: number;
|
|
8
|
-
showPreview?: boolean;
|
|
9
|
-
};
|
|
10
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
11
|
-
"update:model-value": (value: Attachment | Attachment[]) => any;
|
|
12
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
-
"onUpdate:model-value"?: ((value: Attachment | Attachment[]) => any) | undefined;
|
|
14
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
-
declare const _default: typeof __VLS_export;
|
|
16
|
-
export default _default;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { type Ref } from 'vue';
|
|
2
|
-
import type { OptionItem, Params } from '../../types';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
options?: OptionItem[] | string[] | number[];
|
|
5
|
-
rules?: ((value: unknown) => typeof value | string)[];
|
|
6
|
-
multiple?: boolean;
|
|
7
|
-
searchable?: boolean;
|
|
8
|
-
searchInternally?: boolean;
|
|
9
|
-
querySearchParam?: string;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
required?: boolean;
|
|
12
|
-
grouped?: boolean;
|
|
13
|
-
returnObject?: boolean;
|
|
14
|
-
teleported?: boolean;
|
|
15
|
-
preselectFirst?: boolean;
|
|
16
|
-
hideSelected?: boolean;
|
|
17
|
-
error?: boolean;
|
|
18
|
-
modelValue?: unknown;
|
|
19
|
-
itemLabel?: string;
|
|
20
|
-
groupValues?: string;
|
|
21
|
-
groupLabel?: string;
|
|
22
|
-
trackBy?: string;
|
|
23
|
-
trackByValue?: string | number | string[];
|
|
24
|
-
placeholder?: string;
|
|
25
|
-
url?: string;
|
|
26
|
-
label?: string;
|
|
27
|
-
deselectLabel?: string;
|
|
28
|
-
selectLabel?: string;
|
|
29
|
-
selectedLabel?: string;
|
|
30
|
-
errorMessages?: string;
|
|
31
|
-
params?: Params;
|
|
32
|
-
hideDetails?: boolean;
|
|
33
|
-
fetchEnabled?: boolean;
|
|
34
|
-
isLoading?: boolean;
|
|
35
|
-
disableIfEmpty?: boolean;
|
|
36
|
-
clearable?: boolean;
|
|
37
|
-
};
|
|
38
|
-
declare var __VLS_68: string | number, __VLS_69: any, __VLS_133: string | number, __VLS_134: any;
|
|
39
|
-
type __VLS_Slots = {} & {
|
|
40
|
-
[K in NonNullable<typeof __VLS_68>]?: (props: typeof __VLS_69) => any;
|
|
41
|
-
} & {
|
|
42
|
-
[K in NonNullable<typeof __VLS_133>]?: (props: typeof __VLS_134) => any;
|
|
43
|
-
};
|
|
44
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
45
|
-
records: Ref<{
|
|
46
|
-
id?: string | number | boolean | undefined;
|
|
47
|
-
name?: string | number | undefined;
|
|
48
|
-
value?: string | number | boolean | undefined;
|
|
49
|
-
allowTranslate?: boolean | undefined;
|
|
50
|
-
svg_icon_url?: string | undefined;
|
|
51
|
-
png_icon_url?: string | undefined;
|
|
52
|
-
children?: /*elided*/ any[] | undefined;
|
|
53
|
-
}[], OptionItem[] | {
|
|
54
|
-
id?: string | number | boolean | undefined;
|
|
55
|
-
name?: string | number | undefined;
|
|
56
|
-
value?: string | number | boolean | undefined;
|
|
57
|
-
allowTranslate?: boolean | undefined;
|
|
58
|
-
svg_icon_url?: string | undefined;
|
|
59
|
-
png_icon_url?: string | undefined;
|
|
60
|
-
children?: /*elided*/ any[] | undefined;
|
|
61
|
-
}[]>;
|
|
62
|
-
internalOptions: import("vue").ComputedRef<({
|
|
63
|
-
id?: string | number | boolean | undefined;
|
|
64
|
-
name?: string | number | undefined;
|
|
65
|
-
value?: string | number | boolean | undefined;
|
|
66
|
-
allowTranslate?: boolean | undefined;
|
|
67
|
-
svg_icon_url?: string | undefined;
|
|
68
|
-
png_icon_url?: string | undefined;
|
|
69
|
-
children?: /*elided*/ any[] | undefined;
|
|
70
|
-
} | null)[]>;
|
|
71
|
-
loading: import("vue").ComputedRef<boolean>;
|
|
72
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
73
|
-
"update:model-value": (value: unknown) => any;
|
|
74
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
75
|
-
"onUpdate:model-value"?: ((value: unknown) => any) | undefined;
|
|
76
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
77
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
78
|
-
declare const _default: typeof __VLS_export;
|
|
79
|
-
export default _default;
|
|
80
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
81
|
-
new (): {
|
|
82
|
-
$slots: S;
|
|
83
|
-
};
|
|
84
|
-
};
|