vueless 0.0.582 → 0.0.584
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
|
@@ -42,10 +42,12 @@ import defaultConfig from "./config.ts";
|
|
|
42
42
|
import type { UCalendarProps, DateValue, RangeDate, Locale, Config } from "./types.ts";
|
|
43
43
|
import type { ComputedRef, Ref } from "vue";
|
|
44
44
|
import type { DateLocale } from "./utilFormatting.ts";
|
|
45
|
+
import type { ComponentExposed } from "../types.ts";
|
|
45
46
|
|
|
46
47
|
import DayView from "./UCalendarDayView.vue";
|
|
47
48
|
import MonthView from "./UCalendarMonthView.vue";
|
|
48
49
|
import YearView from "./UCalendarYearView.vue";
|
|
50
|
+
import { nextTick } from "process";
|
|
49
51
|
|
|
50
52
|
type DefaultLocale = typeof defaultConfig.i18n;
|
|
51
53
|
|
|
@@ -97,6 +99,7 @@ const wrapperRef = useTemplateRef<HTMLDivElement>("wrapper");
|
|
|
97
99
|
const hoursRef = useTemplateRef<HTMLInputElement>("hours-input");
|
|
98
100
|
const minutesRef = useTemplateRef<HTMLInputElement>("minutes-input");
|
|
99
101
|
const secondsRef = useTemplateRef<HTMLInputElement>("seconds-input");
|
|
102
|
+
const okButton = useTemplateRef<ComponentExposed<typeof UButton>>("ok-button");
|
|
100
103
|
|
|
101
104
|
const activeDate: Ref<Date | null> = ref(null);
|
|
102
105
|
const activeMonth: Ref<Date | null> = ref(null);
|
|
@@ -319,13 +322,13 @@ watch(
|
|
|
319
322
|
watch(
|
|
320
323
|
selectedDate,
|
|
321
324
|
() => {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
}
|
|
325
|
+
nextTick(() => {
|
|
326
|
+
if (selectedDate.value && isTimepickerEnabled.value && isInputRefs.value) {
|
|
327
|
+
hoursRef.value!.value = String(selectedDate.value.getHours()).padStart(2, "0");
|
|
328
|
+
minutesRef.value!.value = String(selectedDate.value.getMinutes()).padStart(2, "0");
|
|
329
|
+
secondsRef.value!.value = String(selectedDate.value.getSeconds()).padStart(2, "0");
|
|
330
|
+
}
|
|
331
|
+
});
|
|
329
332
|
|
|
330
333
|
if (selectedDate.value) {
|
|
331
334
|
emit("userDateChange", userFormattedDate.value);
|
|
@@ -557,6 +560,24 @@ function onClickSubmit() {
|
|
|
557
560
|
emit("submit");
|
|
558
561
|
}
|
|
559
562
|
|
|
563
|
+
function onClickTimeInput(event: MouseEvent) {
|
|
564
|
+
const input = event.target as HTMLInputElement;
|
|
565
|
+
|
|
566
|
+
selectTimeInput(input);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
function onFocusTimeInput(event: FocusEvent) {
|
|
570
|
+
const input = event.target as HTMLInputElement;
|
|
571
|
+
|
|
572
|
+
selectTimeInput(input);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
function selectTimeInput(input: HTMLInputElement) {
|
|
576
|
+
const value = input.value;
|
|
577
|
+
|
|
578
|
+
input.setSelectionRange(0, value.length, "backward");
|
|
579
|
+
}
|
|
580
|
+
|
|
560
581
|
function onTimeInput(event: InputEvent, type: InputType) {
|
|
561
582
|
const input = event.target as HTMLInputElement;
|
|
562
583
|
const value = input.value;
|
|
@@ -586,22 +607,38 @@ function onTimeInput(event: InputEvent, type: InputType) {
|
|
|
586
607
|
|
|
587
608
|
if (event.data !== null && !isNumeric(event.data)) {
|
|
588
609
|
if (isHours) {
|
|
589
|
-
input.value = String(lastValidHourValue);
|
|
610
|
+
input.value = String(lastValidHourValue).padStart(2, "0");
|
|
590
611
|
}
|
|
591
612
|
|
|
592
613
|
if (isMinutes) {
|
|
593
|
-
input.value = String(lastValidMinuteValue);
|
|
614
|
+
input.value = String(lastValidMinuteValue).padStart(2, "0");
|
|
594
615
|
}
|
|
595
616
|
|
|
596
617
|
if (isSeconds) {
|
|
597
|
-
input.value = String(lastValidSecondValue);
|
|
618
|
+
input.value = String(lastValidSecondValue).padStart(2, "0");
|
|
598
619
|
}
|
|
599
620
|
|
|
600
621
|
return;
|
|
601
622
|
}
|
|
602
623
|
|
|
603
624
|
if (numericValue > maxValue || numericValue < minValue) {
|
|
604
|
-
|
|
625
|
+
if (isHours && minutesRef.value) {
|
|
626
|
+
input.value = String(lastValidHourValue).padStart(2, "0");
|
|
627
|
+
|
|
628
|
+
minutesRef.value.focus();
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (isMinutes && secondsRef.value) {
|
|
632
|
+
input.value = String(lastValidMinuteValue).padStart(2, "0");
|
|
633
|
+
|
|
634
|
+
secondsRef.value.focus();
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (isSeconds && okButton.value) {
|
|
638
|
+
input.value = String(lastValidSecondValue).padStart(2, "0");
|
|
639
|
+
|
|
640
|
+
okButton.value.buttonRef?.focus();
|
|
641
|
+
}
|
|
605
642
|
|
|
606
643
|
return;
|
|
607
644
|
}
|
|
@@ -759,6 +796,8 @@ const {
|
|
|
759
796
|
type="text"
|
|
760
797
|
v-bind="timepickerInputHoursAttrs"
|
|
761
798
|
@input.prevent="onTimeInput($event as InputEvent, InputType.Hours)"
|
|
799
|
+
@click.prevent="onClickTimeInput"
|
|
800
|
+
@focus.prevent="onFocusTimeInput"
|
|
762
801
|
@keydown="onTimeKeydown"
|
|
763
802
|
/>
|
|
764
803
|
⁚
|
|
@@ -768,6 +807,8 @@ const {
|
|
|
768
807
|
type="text"
|
|
769
808
|
v-bind="timepickerInputMinutesAttrs"
|
|
770
809
|
@input.prevent="onTimeInput($event as InputEvent, InputType.Minutes)"
|
|
810
|
+
@click.prevent="onClickTimeInput"
|
|
811
|
+
@focus.prevent="onFocusTimeInput"
|
|
771
812
|
@keydown="onTimeKeydown"
|
|
772
813
|
/>
|
|
773
814
|
⁚
|
|
@@ -777,11 +818,14 @@ const {
|
|
|
777
818
|
type="text"
|
|
778
819
|
v-bind="timepickerInputSecondsAttrs"
|
|
779
820
|
@input.prevent="onTimeInput($event as InputEvent, InputType.Seconds)"
|
|
821
|
+
@click.prevent="onClickTimeInput"
|
|
822
|
+
@focus.prevent="onFocusTimeInput"
|
|
780
823
|
@keydown="onTimeKeydown"
|
|
781
824
|
/>
|
|
782
825
|
</div>
|
|
783
826
|
|
|
784
827
|
<UButton
|
|
828
|
+
ref="ok-button"
|
|
785
829
|
variant="thirdary"
|
|
786
830
|
size="sm"
|
|
787
831
|
filled
|
package/ui.form-select/config.js
CHANGED
|
@@ -127,7 +127,7 @@ export default /*tw*/ {
|
|
|
127
127
|
},
|
|
128
128
|
},
|
|
129
129
|
},
|
|
130
|
-
dropdownList: "{UDropdownList} group-[]/top:bottom-full group-[]/top:top-auto top-full",
|
|
130
|
+
dropdownList: "{UDropdownList} group-[]/top:bottom-full group-[]/top:top-auto top-full w-full",
|
|
131
131
|
i18n: {
|
|
132
132
|
listIsEmpty: "List is empty.",
|
|
133
133
|
noDataToShow: "No data to show.",
|