vueless 1.3.5-beta.0 → 1.3.5-beta.1
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
|
@@ -90,6 +90,12 @@ const emit = defineEmits([
|
|
|
90
90
|
* @property {string} value
|
|
91
91
|
*/
|
|
92
92
|
"userDateChange",
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Triggers when range date values (from or to) change.
|
|
96
|
+
* @property {object} value
|
|
97
|
+
*/
|
|
98
|
+
"change-range",
|
|
93
99
|
]);
|
|
94
100
|
|
|
95
101
|
const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
|
|
@@ -253,6 +259,7 @@ const localValue = computed({
|
|
|
253
259
|
if (newDate && newDateTo) {
|
|
254
260
|
tempRangeValue.value = null;
|
|
255
261
|
emit("update:modelValue", newRangeDate);
|
|
262
|
+
emit("change-range", newRangeDate);
|
|
256
263
|
}
|
|
257
264
|
} else {
|
|
258
265
|
emit("update:modelValue", newDate);
|
|
@@ -453,15 +460,11 @@ function onInputDate(newDate: Date | null) {
|
|
|
453
460
|
}
|
|
454
461
|
|
|
455
462
|
if (props.range && isRangeDate(localValue.value)) {
|
|
456
|
-
const localFromTime =
|
|
457
|
-
localValue.value?.from instanceof Date ? localValue.value?.from.getTime() : 0;
|
|
458
|
-
|
|
459
|
-
const isSameAsFrom = newDate.getTime() === localFromTime;
|
|
460
463
|
const isNewDateLessFromDate = localValue.value.from && newDate < localValue.value.from;
|
|
461
464
|
const areToAndFromDateExists = localValue.value.to && localValue.value.from;
|
|
462
465
|
const hasFrom = localValue.value.from;
|
|
463
466
|
|
|
464
|
-
const isFullReset =
|
|
467
|
+
const isFullReset = isNewDateLessFromDate || areToAndFromDateExists || !hasFrom;
|
|
465
468
|
|
|
466
469
|
const updatedValue = isFullReset
|
|
467
470
|
? { from: newDate, to: null }
|
|
@@ -472,8 +475,10 @@ function onInputDate(newDate: Date | null) {
|
|
|
472
475
|
localValue.value = updatedValue;
|
|
473
476
|
|
|
474
477
|
emit("input", updatedValue);
|
|
478
|
+
emit("change-range", updatedValue);
|
|
475
479
|
} else {
|
|
476
480
|
tempRangeValue.value = updatedValue;
|
|
481
|
+
emit("change-range", updatedValue);
|
|
477
482
|
}
|
|
478
483
|
} else {
|
|
479
484
|
localValue.value = newDate;
|