@directus/composables 10.0.0 → 10.0.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.
|
@@ -3,7 +3,7 @@ export type UsableCustomSelection = {
|
|
|
3
3
|
otherValue: Ref<string | null>;
|
|
4
4
|
usesOtherValue: ComputedRef<boolean>;
|
|
5
5
|
};
|
|
6
|
-
export declare function useCustomSelection(currentValue: Ref<string>, items: Ref<any[]>, emit: (event: string | null) => void): UsableCustomSelection;
|
|
6
|
+
export declare function useCustomSelection(currentValue: Ref<string | null>, items: Ref<any[]>, emit: (event: string | null) => void): UsableCustomSelection;
|
|
7
7
|
type OtherValue = {
|
|
8
8
|
key: string;
|
|
9
9
|
value: string;
|
|
@@ -13,5 +13,5 @@ type UsableCustomSelectionMultiple = {
|
|
|
13
13
|
addOtherValue: (value?: string) => void;
|
|
14
14
|
setOtherValue: (key: string, newValue: string | null) => void;
|
|
15
15
|
};
|
|
16
|
-
export declare function useCustomSelectionMultiple(currentValues: Ref<string[]>, items: Ref<any[]>, emit: (event: string[] | null) => void): UsableCustomSelectionMultiple;
|
|
16
|
+
export declare function useCustomSelectionMultiple(currentValues: Ref<string[] | null>, items: Ref<any[]>, emit: (event: string[] | null) => void): UsableCustomSelectionMultiple;
|
|
17
17
|
export {};
|
|
@@ -31,7 +31,7 @@ export function useCustomSelectionMultiple(currentValues, items, emit) {
|
|
|
31
31
|
watch(currentValues, (newValue) => {
|
|
32
32
|
if (newValue === null)
|
|
33
33
|
return;
|
|
34
|
-
if (Array.isArray(newValue)
|
|
34
|
+
if (!Array.isArray(newValue))
|
|
35
35
|
return;
|
|
36
36
|
if (items.value === null)
|
|
37
37
|
return;
|
|
@@ -39,11 +39,11 @@ export function useCustomSelectionMultiple(currentValues, items, emit) {
|
|
|
39
39
|
if (items.value === null)
|
|
40
40
|
return;
|
|
41
41
|
const values = items.value.map((item) => item.value);
|
|
42
|
-
const existsInValues = values.includes(value)
|
|
43
|
-
if (existsInValues
|
|
42
|
+
const existsInValues = values.includes(value);
|
|
43
|
+
if (!existsInValues) {
|
|
44
44
|
const other = otherValues.value.map((o) => o.value);
|
|
45
|
-
const existsInOtherValues = other.includes(value)
|
|
46
|
-
if (existsInOtherValues
|
|
45
|
+
const existsInOtherValues = other.includes(value);
|
|
46
|
+
if (!existsInOtherValues) {
|
|
47
47
|
addOtherValue(value);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -77,8 +77,12 @@ export function useCustomSelectionMultiple(currentValues, items, emit) {
|
|
|
77
77
|
otherValue.value = newValue;
|
|
78
78
|
return otherValue;
|
|
79
79
|
});
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
if (valueWithoutPrevious.length === currentValues.value?.length) {
|
|
81
|
+
emit(valueWithoutPrevious);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
emit([...valueWithoutPrevious, newValue]);
|
|
85
|
+
}
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/composables",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
5
6
|
"description": "Shared Vue composables for Directus use",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
@@ -17,8 +18,7 @@
|
|
|
17
18
|
},
|
|
18
19
|
"main": "dist/index.js",
|
|
19
20
|
"files": [
|
|
20
|
-
"dist"
|
|
21
|
-
"!**/*.test.{js,d.ts}"
|
|
21
|
+
"dist"
|
|
22
22
|
],
|
|
23
23
|
"publishConfig": {
|
|
24
24
|
"access": "public"
|
|
@@ -26,22 +26,22 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@directus/tsconfig": "0.0.7",
|
|
28
28
|
"@types/lodash-es": "4.17.7",
|
|
29
|
-
"@vitest/coverage-c8": "0.
|
|
29
|
+
"@vitest/coverage-c8": "0.31.0",
|
|
30
30
|
"@vue/test-utils": "2.3.2",
|
|
31
31
|
"axios": "1.3.6",
|
|
32
32
|
"typescript": "5.0.4",
|
|
33
|
-
"vitest": "0.
|
|
33
|
+
"vitest": "0.31.0",
|
|
34
34
|
"@directus/types": "10.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"lodash-es": "4.17.21",
|
|
38
38
|
"nanoid": "4.0.2",
|
|
39
39
|
"vue": "3.2.47",
|
|
40
|
-
"@directus/constants": "10.
|
|
41
|
-
"@directus/utils": "10.0.
|
|
40
|
+
"@directus/constants": "10.1.0",
|
|
41
|
+
"@directus/utils": "10.0.1"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "tsc --
|
|
44
|
+
"build": "tsc --project tsconfig.prod.json",
|
|
45
45
|
"dev": "tsc --watch",
|
|
46
46
|
"test": "vitest --watch=false"
|
|
47
47
|
}
|