@v-c/picker 1.2.1 → 1.3.0
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/PickerInput/Popup/index.d.ts +14 -2
- package/dist/PickerInput/Popup/index.js +10 -1
- package/dist/PickerInput/RangePicker.d.ts +1 -1
- package/dist/PickerInput/RangePicker.js +55 -72
- package/dist/PickerInput/Selector/ClearIcon.d.ts +11 -0
- package/dist/PickerInput/Selector/ClearIcon.js +53 -0
- package/dist/PickerInput/Selector/Icon.d.ts +1 -6
- package/dist/PickerInput/Selector/Icon.js +16 -57
- package/dist/PickerInput/Selector/Input.js +2 -5
- package/dist/PickerInput/Selector/RangeSelector.d.ts +1 -1
- package/dist/PickerInput/Selector/RangeSelector.js +9 -5
- package/dist/PickerInput/Selector/SingleSelector/MultipleDates.d.ts +1 -1
- package/dist/PickerInput/Selector/SingleSelector/index.d.ts +1 -1
- package/dist/PickerInput/Selector/SingleSelector/index.js +5 -8
- package/dist/PickerInput/Selector/hooks/useClearIcon.d.ts +1 -1
- package/dist/PickerInput/Selector/hooks/useInputHooks.d.ts +1 -1
- package/dist/PickerInput/SinglePicker.js +54 -39
- package/dist/PickerInput/hooks/useFocusEvents.d.ts +28 -0
- package/dist/PickerInput/hooks/useFocusEvents.js +36 -0
- package/dist/PickerInput/hooks/useFocusLock.d.ts +14 -0
- package/dist/PickerInput/hooks/useFocusLock.js +25 -0
- package/dist/PickerInput/hooks/useRangeDisabledDate.d.ts +1 -1
- package/dist/PickerInput/hooks/useRangeDisabledDate.js +3 -3
- package/dist/PickerInput/hooks/useRangePickerValue.d.ts +7 -1
- package/dist/PickerInput/hooks/useRangePickerValue.js +10 -16
- package/dist/PickerInput/hooks/useRangeValue.d.ts +3 -3
- package/dist/PickerInput/hooks/useRangeValue.js +15 -13
- package/dist/PickerInput/hooks/useRangeValueChange.d.ts +109 -0
- package/dist/PickerInput/hooks/useRangeValueChange.js +226 -0
- package/dist/PickerPanel/index.d.ts +1 -1
- package/dist/PickerTrigger/index.d.ts +1 -1
- package/dist/interface.d.ts +2 -2
- package/dist/locale/am_ET.js +4 -4
- package/dist/locale/ar_EG.js +4 -4
- package/dist/locale/az_AZ.js +4 -4
- package/dist/locale/bg_BG.js +4 -4
- package/dist/locale/bn_BD.js +4 -4
- package/dist/locale/by_BY.js +4 -4
- package/dist/locale/ca_ES.js +4 -4
- package/dist/locale/cs_CZ.js +4 -4
- package/dist/locale/da_DK.js +4 -4
- package/dist/locale/de_DE.js +4 -4
- package/dist/locale/el_GR.js +4 -4
- package/dist/locale/en_GB.js +4 -4
- package/dist/locale/en_US.js +4 -4
- package/dist/locale/es_ES.js +4 -4
- package/dist/locale/es_MX.js +4 -4
- package/dist/locale/et_EE.js +4 -4
- package/dist/locale/eu_ES.js +4 -4
- package/dist/locale/fa_IR.js +4 -4
- package/dist/locale/fi_FI.js +4 -4
- package/dist/locale/fr_BE.js +4 -4
- package/dist/locale/fr_CA.js +4 -4
- package/dist/locale/fr_FR.js +4 -4
- package/dist/locale/ga_IE.js +4 -4
- package/dist/locale/gl_ES.js +4 -4
- package/dist/locale/he_IL.js +4 -4
- package/dist/locale/hi_IN.js +4 -4
- package/dist/locale/hr_HR.js +4 -4
- package/dist/locale/hu_HU.js +4 -4
- package/dist/locale/id_ID.js +4 -4
- package/dist/locale/is_IS.js +4 -4
- package/dist/locale/it_IT.js +4 -4
- package/dist/locale/ja_JP.js +4 -4
- package/dist/locale/ka_GE.js +4 -4
- package/dist/locale/kk_KZ.js +4 -4
- package/dist/locale/km_KH.js +4 -4
- package/dist/locale/kmr_IQ.js +4 -4
- package/dist/locale/kn_IN.js +4 -4
- package/dist/locale/ko_KR.js +4 -4
- package/dist/locale/lt_LT.js +4 -4
- package/dist/locale/lv_LV.js +4 -4
- package/dist/locale/mk_MK.js +4 -4
- package/dist/locale/ml_IN.js +4 -4
- package/dist/locale/mn_MN.js +4 -4
- package/dist/locale/mr_IN.js +4 -4
- package/dist/locale/ms_MY.js +2 -2
- package/dist/locale/my_MM.js +4 -4
- package/dist/locale/nb_NO.js +4 -4
- package/dist/locale/ne_NP.js +4 -4
- package/dist/locale/nl_BE.js +4 -4
- package/dist/locale/nl_NL.js +4 -4
- package/dist/locale/pl_PL.js +4 -4
- package/dist/locale/pt_BR.js +4 -4
- package/dist/locale/pt_PT.js +4 -4
- package/dist/locale/ro_RO.js +4 -4
- package/dist/locale/ru_RU.js +4 -4
- package/dist/locale/si_LK.js +4 -4
- package/dist/locale/sk_SK.js +4 -4
- package/dist/locale/sl_SI.js +4 -4
- package/dist/locale/sr_Cyrl_RS.js +4 -4
- package/dist/locale/sr_RS.js +4 -4
- package/dist/locale/sv_SE.js +4 -4
- package/dist/locale/ta_IN.js +4 -4
- package/dist/locale/th_TH.js +4 -4
- package/dist/locale/tk_TK.js +4 -4
- package/dist/locale/tr_TR.js +4 -4
- package/dist/locale/ug_CN.js +4 -4
- package/dist/locale/uk_UA.js +4 -4
- package/dist/locale/ur_PK.js +4 -4
- package/dist/locale/uz_UZ.js +4 -4
- package/dist/locale/vi_VN.js +4 -4
- package/dist/locale/zh_CN.js +4 -4
- package/dist/locale/zh_TW.js +4 -4
- package/dist/utils/miscUtil.d.ts +1 -1
- package/dist/utils/miscUtil.js +3 -4
- package/package.json +5 -5
- package/dist/PickerInput/hooks/useRangeActive.d.ts +0 -9
- package/dist/PickerInput/hooks/useRangeActive.js +0 -59
package/dist/locale/th_TH.js
CHANGED
|
@@ -16,10 +16,10 @@ var locale = {
|
|
|
16
16
|
monthSelect: "เลือกเดือน",
|
|
17
17
|
yearSelect: "เลือกปี",
|
|
18
18
|
decadeSelect: "เลือกทศวรรษ",
|
|
19
|
-
previousMonth: "เดือนก่อนหน้า
|
|
20
|
-
nextMonth: "เดือนถัดไป
|
|
21
|
-
previousYear: "ปีก่อนหน้า
|
|
22
|
-
nextYear: "ปีถัดไป
|
|
19
|
+
previousMonth: "เดือนก่อนหน้า",
|
|
20
|
+
nextMonth: "เดือนถัดไป",
|
|
21
|
+
previousYear: "ปีก่อนหน้า",
|
|
22
|
+
nextYear: "ปีถัดไป",
|
|
23
23
|
previousDecade: "ทศวรรษก่อนหน้า",
|
|
24
24
|
nextDecade: "ทศวรรษถัดไป",
|
|
25
25
|
previousCentury: "ศตวรรษก่อนหน้า",
|
package/dist/locale/tk_TK.js
CHANGED
|
@@ -16,10 +16,10 @@ var locale = {
|
|
|
16
16
|
monthSelect: "Aý saýla",
|
|
17
17
|
yearSelect: "Ýyl saýla",
|
|
18
18
|
decadeSelect: "On ýyllygy saýla",
|
|
19
|
-
previousMonth: "Öňki aý
|
|
20
|
-
nextMonth: "Soňky aý
|
|
21
|
-
previousYear: "Öňki ýyl
|
|
22
|
-
nextYear: "Soňky ýyl
|
|
19
|
+
previousMonth: "Öňki aý",
|
|
20
|
+
nextMonth: "Soňky aý",
|
|
21
|
+
previousYear: "Öňki ýyl",
|
|
22
|
+
nextYear: "Soňky ýyl",
|
|
23
23
|
previousDecade: "Öňki on ýyl",
|
|
24
24
|
nextDecade: "Soňky on ýyl",
|
|
25
25
|
previousCentury: "Öňki asyr",
|
package/dist/locale/tr_TR.js
CHANGED
|
@@ -16,10 +16,10 @@ var locale = {
|
|
|
16
16
|
monthSelect: "Ay Seç",
|
|
17
17
|
yearSelect: "Yıl Seç",
|
|
18
18
|
decadeSelect: "On Yıl Seç",
|
|
19
|
-
previousMonth: "Önceki Ay
|
|
20
|
-
nextMonth: "Sonraki Ay
|
|
21
|
-
previousYear: "Önceki Yıl
|
|
22
|
-
nextYear: "Sonraki Yıl
|
|
19
|
+
previousMonth: "Önceki Ay",
|
|
20
|
+
nextMonth: "Sonraki Ay",
|
|
21
|
+
previousYear: "Önceki Yıl",
|
|
22
|
+
nextYear: "Sonraki Yıl",
|
|
23
23
|
previousDecade: "Önceki On Yıl",
|
|
24
24
|
nextDecade: "Sonraki On Yıl",
|
|
25
25
|
previousCentury: "Önceki Yüzyıl",
|
package/dist/locale/ug_CN.js
CHANGED
|
@@ -13,15 +13,15 @@ var locale = {
|
|
|
13
13
|
week: "ھەپتە",
|
|
14
14
|
month: "ئاي",
|
|
15
15
|
year: "يىل",
|
|
16
|
-
previousMonth: "ئالدىنقى ئاي
|
|
17
|
-
nextMonth: "
|
|
16
|
+
previousMonth: "ئالدىنقى ئاي",
|
|
17
|
+
nextMonth: "كېلەر ئاي",
|
|
18
18
|
monthSelect: "ئاي تاللاش",
|
|
19
19
|
yearSelect: "يىل تاللاش",
|
|
20
20
|
decadeSelect: "يىللارنى تاللاش",
|
|
21
21
|
yearFormat: "YYYY-يىلى",
|
|
22
22
|
dayFormat: "D-كۈنى",
|
|
23
|
-
previousYear: "ئالدىنقى يىلى
|
|
24
|
-
nextYear: "كېلەركى يىلى
|
|
23
|
+
previousYear: "ئالدىنقى يىلى",
|
|
24
|
+
nextYear: "كېلەركى يىلى",
|
|
25
25
|
previousDecade: "ئالدىنقى يىللار",
|
|
26
26
|
nextDecade: "كېيىنكى يىللار",
|
|
27
27
|
previousCentury: "ئالدىنقى ئەسىر",
|
package/dist/locale/uk_UA.js
CHANGED
|
@@ -16,10 +16,10 @@ var locale = {
|
|
|
16
16
|
monthSelect: "Обрати місяць",
|
|
17
17
|
yearSelect: "Обрати рік",
|
|
18
18
|
decadeSelect: "Обрати десятиріччя",
|
|
19
|
-
previousMonth: "Попередній місяць
|
|
20
|
-
nextMonth: "Наступний місяць
|
|
21
|
-
previousYear: "Попередній рік
|
|
22
|
-
nextYear: "Наступний рік
|
|
19
|
+
previousMonth: "Попередній місяць",
|
|
20
|
+
nextMonth: "Наступний місяць",
|
|
21
|
+
previousYear: "Попередній рік",
|
|
22
|
+
nextYear: "Наступний рік",
|
|
23
23
|
previousDecade: "Попереднє десятиріччя",
|
|
24
24
|
nextDecade: "Наступне десятиріччя",
|
|
25
25
|
previousCentury: "Попереднє століття",
|
package/dist/locale/ur_PK.js
CHANGED
|
@@ -17,10 +17,10 @@ var locale = {
|
|
|
17
17
|
monthSelect: "ایک مہینہ کا انتخاب کریں",
|
|
18
18
|
yearSelect: "ایک سال کا انتخاب کریں",
|
|
19
19
|
decadeSelect: "ایک دہائی کا انتخاب کریں",
|
|
20
|
-
previousMonth: "پچھلے مہینے
|
|
21
|
-
nextMonth: "اگلے مہینے
|
|
22
|
-
previousYear: "گزشتہ سال
|
|
23
|
-
nextYear: "اگلے سال
|
|
20
|
+
previousMonth: "پچھلے مہینے",
|
|
21
|
+
nextMonth: "اگلے مہینے",
|
|
22
|
+
previousYear: "گزشتہ سال",
|
|
23
|
+
nextYear: "اگلے سال",
|
|
24
24
|
previousDecade: "پچھلی دہائی",
|
|
25
25
|
nextDecade: "اگلی دہائی",
|
|
26
26
|
previousCentury: "پچھلی صدی",
|
package/dist/locale/uz_UZ.js
CHANGED
|
@@ -17,10 +17,10 @@ var locale = {
|
|
|
17
17
|
monthSelect: "Oyni tanlang",
|
|
18
18
|
yearSelect: "Yilni tanlang",
|
|
19
19
|
decadeSelect: "O'n yilni tanlang",
|
|
20
|
-
previousMonth: "Oldingi oy
|
|
21
|
-
nextMonth: "Keyingi oy
|
|
22
|
-
previousYear: "O'tgan yili
|
|
23
|
-
nextYear: "Keyingi yil
|
|
20
|
+
previousMonth: "Oldingi oy",
|
|
21
|
+
nextMonth: "Keyingi oy",
|
|
22
|
+
previousYear: "O'tgan yili",
|
|
23
|
+
nextYear: "Keyingi yil",
|
|
24
24
|
previousDecade: "Oxirgi o'n yil",
|
|
25
25
|
nextDecade: "Keyingi o'n yil",
|
|
26
26
|
previousCentury: "O'tgan asr",
|
package/dist/locale/vi_VN.js
CHANGED
|
@@ -17,10 +17,10 @@ var locale = {
|
|
|
17
17
|
monthSelect: "Chọn tháng",
|
|
18
18
|
yearSelect: "Chọn năm",
|
|
19
19
|
decadeSelect: "Chọn thập kỷ",
|
|
20
|
-
previousMonth: "Tháng trước
|
|
21
|
-
nextMonth: "Tháng sau
|
|
22
|
-
previousYear: "Năm trước
|
|
23
|
-
nextYear: "Năm sau
|
|
20
|
+
previousMonth: "Tháng trước",
|
|
21
|
+
nextMonth: "Tháng sau",
|
|
22
|
+
previousYear: "Năm trước",
|
|
23
|
+
nextYear: "Năm sau",
|
|
24
24
|
previousDecade: "Thập kỷ trước",
|
|
25
25
|
nextDecade: "Thập kỷ sau",
|
|
26
26
|
previousCentury: "Thế kỷ trước",
|
package/dist/locale/zh_CN.js
CHANGED
|
@@ -14,13 +14,13 @@ var locale = {
|
|
|
14
14
|
week: "周",
|
|
15
15
|
month: "月",
|
|
16
16
|
year: "年",
|
|
17
|
-
previousMonth: "上个月
|
|
18
|
-
nextMonth: "下个月
|
|
17
|
+
previousMonth: "上个月",
|
|
18
|
+
nextMonth: "下个月",
|
|
19
19
|
monthSelect: "选择月份",
|
|
20
20
|
yearSelect: "选择年份",
|
|
21
21
|
decadeSelect: "选择年代",
|
|
22
|
-
previousYear: "上一年
|
|
23
|
-
nextYear: "下一年
|
|
22
|
+
previousYear: "上一年",
|
|
23
|
+
nextYear: "下一年",
|
|
24
24
|
previousDecade: "上一年代",
|
|
25
25
|
nextDecade: "下一年代",
|
|
26
26
|
previousCentury: "上一世纪",
|
package/dist/locale/zh_TW.js
CHANGED
|
@@ -14,14 +14,14 @@ var locale = {
|
|
|
14
14
|
week: "週",
|
|
15
15
|
month: "月",
|
|
16
16
|
year: "年",
|
|
17
|
-
previousMonth: "上個月
|
|
18
|
-
nextMonth: "下個月
|
|
17
|
+
previousMonth: "上個月",
|
|
18
|
+
nextMonth: "下個月",
|
|
19
19
|
monthSelect: "選擇月份",
|
|
20
20
|
yearSelect: "選擇年份",
|
|
21
21
|
decadeSelect: "選擇年代",
|
|
22
22
|
yearFormat: "YYYY年",
|
|
23
|
-
previousYear: "上一年
|
|
24
|
-
nextYear: "下一年
|
|
23
|
+
previousYear: "上一年",
|
|
24
|
+
nextYear: "下一年",
|
|
25
25
|
previousDecade: "上一年代",
|
|
26
26
|
nextDecade: "下一年代",
|
|
27
27
|
previousCentury: "上一世紀",
|
package/dist/utils/miscUtil.d.ts
CHANGED
|
@@ -11,4 +11,4 @@ export declare function getRowFormat(picker: InternalMode, locale: Locale, forma
|
|
|
11
11
|
format: string;
|
|
12
12
|
type?: "mask";
|
|
13
13
|
} | import('../interface').FormatType<any> | import('../interface').FormatType<any>[] | undefined;
|
|
14
|
-
export declare function getFromDate<DateType>(calendarValues: DateType[],
|
|
14
|
+
export declare function getFromDate<DateType>(calendarValues: DateType[], triggeredFields: number[], activeIndex: number): DateType | undefined;
|
package/dist/utils/miscUtil.js
CHANGED
|
@@ -37,10 +37,9 @@ function getRowFormat(picker, locale, format) {
|
|
|
37
37
|
default: return locale.fieldDateFormat;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
function getFromDate(calendarValues,
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
return mergedActiveIndex !== firstValuedIndex ? calendarValues[firstValuedIndex] : void 0;
|
|
40
|
+
function getFromDate(calendarValues, triggeredFields, activeIndex) {
|
|
41
|
+
const firstValuedIndex = triggeredFields.find((index) => calendarValues[index]);
|
|
42
|
+
return activeIndex !== firstValuedIndex ? calendarValues[firstValuedIndex] : void 0;
|
|
44
43
|
}
|
|
45
44
|
//#endregion
|
|
46
45
|
export { fillIndex, getFromDate, getRowFormat, leftPad, pickProps, toArray };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/picker",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"description": "picker ui component for vue",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@v-c/overflow": "^1.1.
|
|
81
|
-
"@v-c/
|
|
82
|
-
"@v-c/trigger": "^1.0
|
|
83
|
-
"@v-c/
|
|
80
|
+
"@v-c/overflow": "^1.1.1",
|
|
81
|
+
"@v-c/resize-observer": "^1.1.3",
|
|
82
|
+
"@v-c/trigger": "^1.1.0",
|
|
83
|
+
"@v-c/util": "^1.1.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@types/luxon": "^3.7.2"
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ComputedRef, Ref } from 'vue';
|
|
2
|
-
export type OperationType = 'input' | 'panel';
|
|
3
|
-
export type NextActive<DateType> = (nextValue: [DateType | null | undefined, DateType | null | undefined]) => number | null;
|
|
4
|
-
/**
|
|
5
|
-
* When user first focus one input, any submit will trigger focus another one.
|
|
6
|
-
* When second time focus one input, submit will not trigger focus again.
|
|
7
|
-
* When click outside to close the panel, trigger event if it can trigger onChange.
|
|
8
|
-
*/
|
|
9
|
-
export default function useRangeActive<DateType>(disabled: Ref<(boolean | undefined)[]> | ComputedRef<(boolean | undefined)[]>, empty?: Ref<boolean[]>, mergedOpen?: Ref<boolean | undefined>): readonly [Ref<boolean, boolean>, (nextFocus: boolean) => void, (type?: OperationType) => OperationType, Ref<number, number>, (index: number) => void, NextActive<DateType>, Ref<number[], number[]>, (index: number | null) => void, (index: number) => boolean];
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import useLockEffect from "./useLockEffect.js";
|
|
2
|
-
import { computed, ref, watch } from "vue";
|
|
3
|
-
//#region src/PickerInput/hooks/useRangeActive.ts
|
|
4
|
-
/**
|
|
5
|
-
* When user first focus one input, any submit will trigger focus another one.
|
|
6
|
-
* When second time focus one input, submit will not trigger focus again.
|
|
7
|
-
* When click outside to close the panel, trigger event if it can trigger onChange.
|
|
8
|
-
*/
|
|
9
|
-
function useRangeActive(disabled, empty = ref([]), mergedOpen = ref(false)) {
|
|
10
|
-
const activeIndex = ref(0);
|
|
11
|
-
const focused = ref(false);
|
|
12
|
-
const activeListRef = ref([]);
|
|
13
|
-
const submitIndexRef = ref(null);
|
|
14
|
-
const lastOperationRef = ref(null);
|
|
15
|
-
const updateSubmitIndex = (index) => {
|
|
16
|
-
submitIndexRef.value = index;
|
|
17
|
-
};
|
|
18
|
-
const hasActiveSubmitValue = (index) => {
|
|
19
|
-
return submitIndexRef.value === index;
|
|
20
|
-
};
|
|
21
|
-
const triggerFocus = (nextFocus) => {
|
|
22
|
-
focused.value = nextFocus;
|
|
23
|
-
};
|
|
24
|
-
const lastOperation = (type) => {
|
|
25
|
-
if (type) lastOperationRef.value = type;
|
|
26
|
-
return lastOperationRef.value;
|
|
27
|
-
};
|
|
28
|
-
const nextActiveIndex = (nextValue) => {
|
|
29
|
-
const list = activeListRef.value;
|
|
30
|
-
const filledActiveSet = new Set(list.filter((index) => nextValue?.[index] || empty.value[index]));
|
|
31
|
-
const nextIndex = list[list.length - 1] === 0 ? 1 : 0;
|
|
32
|
-
if (filledActiveSet.size >= 2 || disabled.value[nextIndex]) return null;
|
|
33
|
-
return nextIndex;
|
|
34
|
-
};
|
|
35
|
-
useLockEffect(computed(() => focused.value || mergedOpen.value), () => {
|
|
36
|
-
if (!focused.value) {
|
|
37
|
-
activeListRef.value = [];
|
|
38
|
-
updateSubmitIndex(null);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
watch([focused, activeIndex], () => {
|
|
42
|
-
if (focused.value) activeListRef.value.push(activeIndex.value);
|
|
43
|
-
});
|
|
44
|
-
return [
|
|
45
|
-
focused,
|
|
46
|
-
triggerFocus,
|
|
47
|
-
lastOperation,
|
|
48
|
-
activeIndex,
|
|
49
|
-
(index) => {
|
|
50
|
-
activeIndex.value = index;
|
|
51
|
-
},
|
|
52
|
-
nextActiveIndex,
|
|
53
|
-
activeListRef,
|
|
54
|
-
updateSubmitIndex,
|
|
55
|
-
hasActiveSubmitValue
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
//#endregion
|
|
59
|
-
export { useRangeActive as default };
|