@v-c/picker 1.1.2 → 1.1.3
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.
|
@@ -2,6 +2,7 @@ import { toArray } from "../../utils/miscUtil.js";
|
|
|
2
2
|
import { parseValue } from "../../utils/valueUtil.js";
|
|
3
3
|
import useLocale from "../../hooks/useLocale.js";
|
|
4
4
|
import { fillShowTimeConfig, getTimeProps } from "../../hooks/useTimeConfig.js";
|
|
5
|
+
import { isSameTimestamp } from "../../utils/dateUtil.js";
|
|
5
6
|
import { fillClearIcon } from "../Selector/hooks/useClearIcon.js";
|
|
6
7
|
import useDisabledBoundary from "./useDisabledBoundary.js";
|
|
7
8
|
import { useFieldFormat } from "./useFieldFormat.js";
|
|
@@ -10,15 +11,18 @@ import useInvalidate from "./useInvalidate.js";
|
|
|
10
11
|
import { computed } from "vue";
|
|
11
12
|
import { warning } from "@v-c/util";
|
|
12
13
|
//#region src/PickerInput/hooks/useFilledProps.ts
|
|
13
|
-
function useList(value, fillMode = false, transform) {
|
|
14
|
+
function useList(value, fillMode = false, transform, isSameItem) {
|
|
15
|
+
let cache;
|
|
14
16
|
return computed(() => {
|
|
15
17
|
const val = value.value;
|
|
16
|
-
|
|
18
|
+
let list = val === null || val === void 0 ? val : toArray(val).map((item) => transform ? transform(item) : item);
|
|
17
19
|
if (fillMode && list && Array.isArray(list)) {
|
|
18
20
|
const clone = [...list];
|
|
19
21
|
clone[1] = clone[1] || clone[0];
|
|
20
|
-
|
|
22
|
+
list = clone;
|
|
21
23
|
}
|
|
24
|
+
if (isSameItem && cache && Array.isArray(list) && cache.length === list.length && list.every((item, index) => item === cache[index] || isSameItem(cache[index], item))) return cache;
|
|
25
|
+
cache = Array.isArray(list) ? list : void 0;
|
|
22
26
|
return list;
|
|
23
27
|
});
|
|
24
28
|
}
|
|
@@ -60,10 +64,11 @@ function useFilledProps(props, updater) {
|
|
|
60
64
|
valueFormat: valueFormat.value
|
|
61
65
|
});
|
|
62
66
|
const mergedShowTime = computed(() => fillShowTimeConfig(internalPicker.value, showTimeFormat.value, propFormat.value, timeProps.value, mergedLocale.value));
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
+
const isSameParsedDate = (prev, next) => isSameTimestamp(props.value.generateConfig, prev, next);
|
|
68
|
+
const values = useList(computed(() => props.value.value), false, parseByValueFormat, isSameParsedDate);
|
|
69
|
+
const defaultValues = useList(computed(() => props.value.defaultValue), false, parseByValueFormat, isSameParsedDate);
|
|
70
|
+
const pickerValues = useList(computed(() => props.value.pickerValue), false, parseByValueFormat, isSameParsedDate);
|
|
71
|
+
const defaultPickerValues = useList(computed(() => props.value.defaultPickerValue), false, parseByValueFormat, isSameParsedDate);
|
|
67
72
|
if (process.env.NODE_ENV !== "production") {
|
|
68
73
|
if (mergedPicker.value === "time") {
|
|
69
74
|
if ([
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/picker",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"description": "picker ui component for vue",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@v-c/
|
|
75
|
+
"@v-c/resize-observer": "^1.1.0",
|
|
76
76
|
"@v-c/util": "^1.0.19",
|
|
77
77
|
"@v-c/overflow": "^1.1.0",
|
|
78
|
-
"@v-c/
|
|
78
|
+
"@v-c/trigger": "^1.0.16"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@types/luxon": "^3.7.1"
|