vueless 0.0.575 → 0.0.577
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts" generic="TModelValue extends DateValue">
|
|
2
|
-
import { computed, ref, watch, useTemplateRef
|
|
2
|
+
import { computed, ref, watch, useTemplateRef } from "vue";
|
|
3
3
|
import { merge } from "lodash-es";
|
|
4
4
|
|
|
5
5
|
import UButton from "../ui.button/UButton.vue";
|
|
@@ -333,19 +333,23 @@ watch(
|
|
|
333
333
|
},
|
|
334
334
|
);
|
|
335
335
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
336
|
+
watch(
|
|
337
|
+
selectedDate,
|
|
338
|
+
() => {
|
|
339
|
+
if (selectedDate.value && isTimepickerEnabled.value && isInputRefs.value && props.timepicker) {
|
|
340
|
+
hoursRef.value!.value = String(selectedDate.value.getHours()).padStart(2, "0");
|
|
341
|
+
minutesRef.value!.value = String(selectedDate.value.getMinutes()).padStart(2, "0");
|
|
342
|
+
secondsRef.value!.value = String(selectedDate.value.getSeconds()).padStart(2, "0");
|
|
341
343
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
emit("userDateChange", userFormattedDate.value);
|
|
345
|
+
}
|
|
344
346
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
347
|
+
if (selectedDate.value) {
|
|
348
|
+
emit("userDateChange", userFormattedDate.value);
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
{ immediate: true },
|
|
352
|
+
);
|
|
349
353
|
|
|
350
354
|
function getCurrentValueType(value: DateValue): DateValue {
|
|
351
355
|
if (props.range && value === null) {
|
|
@@ -59,7 +59,7 @@ export function parseDate<TLocale extends DateLocale>(
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
let timeless = false;
|
|
62
|
-
let parsedDate = null;
|
|
62
|
+
let parsedDate: Date | null = null;
|
|
63
63
|
const originalDate = date;
|
|
64
64
|
|
|
65
65
|
const isDateObject = date instanceof Date;
|
|
@@ -81,7 +81,7 @@ export function parseDate<TLocale extends DateLocale>(
|
|
|
81
81
|
parsedDate = new Date();
|
|
82
82
|
timeless = true;
|
|
83
83
|
} else {
|
|
84
|
-
parsedDate = parseStringDate(date, format, locale);
|
|
84
|
+
parsedDate = parseStringDate(date, format, locale) || null;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -154,6 +154,7 @@ function onPaste(event: ClipboardEvent) {
|
|
|
154
154
|
try {
|
|
155
155
|
const pasteContent = event.clipboardData ? event.clipboardData.getData("text/plain") : "";
|
|
156
156
|
const userFormat = props.timepicker ? props.userDateTimeFormat : props.userDateFormat;
|
|
157
|
+
const dateFormat = props.timepicker ? props.dateFormat : props.dateTimeFormat;
|
|
157
158
|
const relativeTokensAmount = Number(userFormat.match(/(?<!\\)r/g)?.length);
|
|
158
159
|
|
|
159
160
|
// Amount of tokens used in format string without decimeters.
|
|
@@ -195,7 +196,7 @@ function onPaste(event: ClipboardEvent) {
|
|
|
195
196
|
|
|
196
197
|
if (parsedDate) {
|
|
197
198
|
localValue.value = (
|
|
198
|
-
|
|
199
|
+
dateFormat ? formatDate(parsedDate, dateFormat, locale.value) : parsedDate
|
|
199
200
|
) as TModelValue;
|
|
200
201
|
}
|
|
201
202
|
} catch (error) {
|