adata-ui 4.0.50 → 4.0.51
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/module.json
CHANGED
|
@@ -6,20 +6,11 @@ import { nextTick, ref, useI18n, computed } from "#imports";
|
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
placeholder: { type: String, required: false },
|
|
8
8
|
yearPicker: { type: Boolean, required: false },
|
|
9
|
-
menuTitle: { type: String, required: false }
|
|
9
|
+
menuTitle: { type: String, required: false },
|
|
10
|
+
format: { type: String, required: false }
|
|
10
11
|
});
|
|
11
12
|
const { t, locale } = useI18n();
|
|
12
13
|
const date = defineModel({ type: [Date, null], ...{ default: null } });
|
|
13
|
-
function format(date2) {
|
|
14
|
-
if (props.yearPicker) {
|
|
15
|
-
return date2.getFullYear().toString();
|
|
16
|
-
} else {
|
|
17
|
-
const day = date2.getDate().toString().padStart(2, "0");
|
|
18
|
-
const month = (date2.getMonth() + 1).toString().padStart(2, "0");
|
|
19
|
-
const year = date2.getFullYear();
|
|
20
|
-
return `${day}/${month}/${year}`;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
14
|
const datePicker = ref();
|
|
24
15
|
function closeDatePicker() {
|
|
25
16
|
datePicker.value?.closeMenu();
|
|
@@ -29,15 +20,6 @@ const currentLocale = computed(() => {
|
|
|
29
20
|
if (locale.value === "kk") return kk;
|
|
30
21
|
return ru;
|
|
31
22
|
});
|
|
32
|
-
function selectDate(data) {
|
|
33
|
-
if (props.yearPicker) return;
|
|
34
|
-
date.value = data;
|
|
35
|
-
}
|
|
36
|
-
function selectYear(data) {
|
|
37
|
-
if (props.yearPicker) {
|
|
38
|
-
date.value = data.year;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
23
|
function menuOpened() {
|
|
42
24
|
nextTick(() => {
|
|
43
25
|
const menu = document.querySelector(".dp__menu");
|
|
@@ -55,6 +37,7 @@ function menuOpened() {
|
|
|
55
37
|
<vue-date-picker
|
|
56
38
|
ref="datePicker"
|
|
57
39
|
v-model="date"
|
|
40
|
+
v-bind="$attrs"
|
|
58
41
|
:enable-time-picker="false"
|
|
59
42
|
:format="format"
|
|
60
43
|
:format-locale="currentLocale"
|
|
@@ -65,10 +48,10 @@ function menuOpened() {
|
|
|
65
48
|
navBtnPrev: 'hidden',
|
|
66
49
|
menu: 'p-2'
|
|
67
50
|
}"
|
|
51
|
+
model-type="format"
|
|
68
52
|
class="custom-date-picker"
|
|
53
|
+
auto-apply
|
|
69
54
|
@open="menuOpened"
|
|
70
|
-
@date-update="selectDate"
|
|
71
|
-
@update-month-year="selectYear"
|
|
72
55
|
>
|
|
73
56
|
<template #top-extra>
|
|
74
57
|
<div
|