vueless 1.3.4 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "1.3.4",
3
+ "version": "1.3.5-beta.1",
4
4
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
5
5
  "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
6
6
  "homepage": "https://vueless.com",
@@ -57,7 +57,7 @@
57
57
  "@vue/eslint-config-typescript": "^14.6.0",
58
58
  "@vue/test-utils": "^2.4.6",
59
59
  "@vue/tsconfig": "^0.7.0",
60
- "@vueless/storybook": "^1.2.11",
60
+ "@vueless/storybook": "^1.2.13",
61
61
  "eslint": "^9.32.0",
62
62
  "eslint-plugin-storybook": "^10.0.2",
63
63
  "eslint-plugin-vue": "^10.3.0",
@@ -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 = isSameAsFrom || isNewDateLessFromDate || areToAndFromDateExists || !hasFrom;
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;
@@ -764,7 +764,7 @@ watchEffect(() => {
764
764
  v-bind="datepickerCalendarAttrs as KeyAttrsWithConfig<UCalendarConfig>"
765
765
  range
766
766
  :data-test="getDataTest('calendar')"
767
- @input="onInputCalendar"
767
+ @change-range="onInputCalendar"
768
768
  />
769
769
  </div>
770
770
  </Transition>
@@ -96,16 +96,9 @@ export function getWeekDateList(date: Date, monthShortLocales: string[] = []) {
96
96
  const firstDayOfWeek = startOfWeekDate.getDate();
97
97
  const lastDayOfWeek = endOfWeekDate.getDate();
98
98
 
99
- const isDayInPreviousMonth = week === 0 && firstDayOfWeek > 1;
100
- const isLastWeek = week + day === weeksInMonth;
101
-
102
- let monthFirstDayOfWeek = 0;
99
+ const monthFirstDayOfWeek = startOfWeekDate.getMonth();
103
100
  const monthLastDayOfWeek = endOfWeekDate.getMonth();
104
101
 
105
- if (isDayInPreviousMonth || isLastWeek) {
106
- monthFirstDayOfWeek = startOfWeekDate.getMonth();
107
- }
108
-
109
102
  const title = `${firstDayOfWeek} ${
110
103
  monthShortLocales[monthFirstDayOfWeek] || ""
111
104
  } – ${lastDayOfWeek} ${monthShortLocales[monthLastDayOfWeek]}`;