@v-c/picker 0.0.3 → 0.0.4
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/hooks/useTimeInfo.cjs +18 -17
- package/dist/hooks/useTimeInfo.js +18 -17
- package/package.json +3 -3
|
@@ -92,22 +92,23 @@ function useTimeInfo(generateConfig, props, date) {
|
|
|
92
92
|
];
|
|
93
93
|
}
|
|
94
94
|
function findValidateTime(nextTime, getHourUnits, getMinuteUnits, getSecondUnits, getMillisecondUnits, generateConfig) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
let nextDate = nextTime;
|
|
96
|
+
function alignValidate(getUnitValue, setUnitValue, units) {
|
|
97
|
+
let nextValue = Reflect.get(generateConfig, getUnitValue)(nextDate);
|
|
98
|
+
const nextUnit = units.find((unit) => unit.value === nextValue);
|
|
99
|
+
if (!nextUnit || nextUnit.disabled) {
|
|
100
|
+
const validateUnits = units.filter((unit) => !unit.disabled);
|
|
101
|
+
const validateUnit = [...validateUnits].reverse().find((unit) => unit.value <= nextValue) || validateUnits[0];
|
|
102
|
+
if (validateUnit) {
|
|
103
|
+
nextValue = validateUnit.value;
|
|
104
|
+
nextDate = Reflect.get(generateConfig, setUnitValue)(nextDate, nextValue);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return nextValue;
|
|
108
|
+
}
|
|
109
|
+
const nextHour = alignValidate("getHour", "setHour", getHourUnits());
|
|
110
|
+
const nextMinute = alignValidate("getMinute", "setMinute", getMinuteUnits(nextHour));
|
|
111
|
+
alignValidate("getMillisecond", "setMillisecond", getMillisecondUnits(nextHour, nextMinute, alignValidate("getSecond", "setSecond", getSecondUnits(nextHour, nextMinute))));
|
|
112
|
+
return nextDate;
|
|
112
113
|
}
|
|
113
114
|
exports.default = useTimeInfo;
|
|
@@ -87,22 +87,23 @@ function useTimeInfo(generateConfig, props, date) {
|
|
|
87
87
|
];
|
|
88
88
|
}
|
|
89
89
|
function findValidateTime(nextTime, getHourUnits, getMinuteUnits, getSecondUnits, getMillisecondUnits, generateConfig) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
90
|
+
let nextDate = nextTime;
|
|
91
|
+
function alignValidate(getUnitValue, setUnitValue, units) {
|
|
92
|
+
let nextValue = Reflect.get(generateConfig, getUnitValue)(nextDate);
|
|
93
|
+
const nextUnit = units.find((unit) => unit.value === nextValue);
|
|
94
|
+
if (!nextUnit || nextUnit.disabled) {
|
|
95
|
+
const validateUnits = units.filter((unit) => !unit.disabled);
|
|
96
|
+
const validateUnit = [...validateUnits].reverse().find((unit) => unit.value <= nextValue) || validateUnits[0];
|
|
97
|
+
if (validateUnit) {
|
|
98
|
+
nextValue = validateUnit.value;
|
|
99
|
+
nextDate = Reflect.get(generateConfig, setUnitValue)(nextDate, nextValue);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return nextValue;
|
|
103
|
+
}
|
|
104
|
+
const nextHour = alignValidate("getHour", "setHour", getHourUnits());
|
|
105
|
+
const nextMinute = alignValidate("getMinute", "setMinute", getMinuteUnits(nextHour));
|
|
106
|
+
alignValidate("getMillisecond", "setMillisecond", getMillisecondUnits(nextHour, nextMinute, alignValidate("getSecond", "setSecond", getSecondUnits(nextHour, nextMinute))));
|
|
107
|
+
return nextDate;
|
|
107
108
|
}
|
|
108
109
|
export { useTimeInfo as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/picker",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.4",
|
|
5
5
|
"description": "picker ui component for vue",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@v-c/overflow": "^1.0.1",
|
|
76
|
-
"@v-c/
|
|
77
|
-
"@v-c/
|
|
76
|
+
"@v-c/trigger": "^1.0.2",
|
|
77
|
+
"@v-c/util": "^1.0.6"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/luxon": "^3.7.1"
|