@directus/composables 10.0.7 → 10.1.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.
- package/dist/use-items.d.ts +2 -1
- package/dist/use-items.js +7 -4
- package/package.json +5 -5
package/dist/use-items.d.ts
CHANGED
|
@@ -18,11 +18,12 @@ export type UsableItems = {
|
|
|
18
18
|
};
|
|
19
19
|
export type ComputedQuery = {
|
|
20
20
|
fields: Ref<Query['fields']> | ComputedRef<Query['fields']> | WritableComputedRef<Query['fields']>;
|
|
21
|
-
alias?: Ref<Query['alias']> | ComputedRef<Query['alias']> | WritableComputedRef<Query['alias']>;
|
|
22
21
|
limit: Ref<Query['limit']> | ComputedRef<Query['limit']> | WritableComputedRef<Query['limit']>;
|
|
23
22
|
sort: Ref<Query['sort']> | ComputedRef<Query['sort']> | WritableComputedRef<Query['sort']>;
|
|
24
23
|
search: Ref<Query['search']> | ComputedRef<Query['search']> | WritableComputedRef<Query['search']>;
|
|
25
24
|
filter: Ref<Query['filter']> | ComputedRef<Query['filter']> | WritableComputedRef<Query['filter']>;
|
|
26
25
|
page: Ref<Query['page']> | WritableComputedRef<Query['page']>;
|
|
26
|
+
alias?: Ref<Query['alias']> | ComputedRef<Query['alias']> | WritableComputedRef<Query['alias']>;
|
|
27
|
+
deep?: Ref<Query['deep']> | ComputedRef<Query['deep']> | WritableComputedRef<Query['deep']>;
|
|
27
28
|
};
|
|
28
29
|
export declare function useItems(collection: Ref<string | null>, query: ComputedQuery): UsableItems;
|
package/dist/use-items.js
CHANGED
|
@@ -7,7 +7,9 @@ import { useApi } from './use-system.js';
|
|
|
7
7
|
export function useItems(collection, query) {
|
|
8
8
|
const api = useApi();
|
|
9
9
|
const { primaryKeyField } = useCollection(collection);
|
|
10
|
-
const { fields,
|
|
10
|
+
const { fields, limit, sort, search, filter, page, alias: queryAlias, deep: queryDeep } = query;
|
|
11
|
+
const alias = queryAlias ?? ref();
|
|
12
|
+
const deep = queryDeep ?? ref();
|
|
11
13
|
const endpoint = computed(() => {
|
|
12
14
|
if (!collection.value)
|
|
13
15
|
return null;
|
|
@@ -32,11 +34,11 @@ export function useItems(collection, query) {
|
|
|
32
34
|
};
|
|
33
35
|
let loadingTimeout = null;
|
|
34
36
|
const fetchItems = throttle(getItems, 500);
|
|
35
|
-
watch([collection, limit, sort, search, filter, fields, page], async (after, before) => {
|
|
37
|
+
watch([collection, limit, sort, search, filter, fields, page, alias, deep], async (after, before) => {
|
|
36
38
|
if (isEqual(after, before))
|
|
37
39
|
return;
|
|
38
|
-
const [newCollection, newLimit, newSort, newSearch, newFilter
|
|
39
|
-
const [oldCollection, oldLimit, oldSort, oldSearch, oldFilter
|
|
40
|
+
const [newCollection, newLimit, newSort, newSearch, newFilter] = after;
|
|
41
|
+
const [oldCollection, oldLimit, oldSort, oldSearch, oldFilter] = before;
|
|
40
42
|
if (!newCollection || !query)
|
|
41
43
|
return;
|
|
42
44
|
if (newCollection !== oldCollection) {
|
|
@@ -104,6 +106,7 @@ export function useItems(collection, query) {
|
|
|
104
106
|
page: unref(page),
|
|
105
107
|
search: unref(search),
|
|
106
108
|
filter: unref(filter),
|
|
109
|
+
deep: unref(deep),
|
|
107
110
|
},
|
|
108
111
|
signal: existingRequests.items.signal,
|
|
109
112
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/composables",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.1",
|
|
4
4
|
"description": "Shared Vue composables for Directus use",
|
|
5
5
|
"homepage": "https://directus.io",
|
|
6
6
|
"repository": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"lodash-es": "4.17.21",
|
|
27
27
|
"nanoid": "4.0.2",
|
|
28
28
|
"vue": "3.3.4",
|
|
29
|
-
"@directus/constants": "10.2.
|
|
30
|
-
"@directus/utils": "10.0.
|
|
29
|
+
"@directus/constants": "10.2.3",
|
|
30
|
+
"@directus/utils": "10.0.9"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/lodash-es": "4.17.7",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@vue/test-utils": "2.3.2",
|
|
36
36
|
"typescript": "5.0.4",
|
|
37
37
|
"vitest": "0.31.1",
|
|
38
|
-
"@directus/tsconfig": "0.0
|
|
39
|
-
"@directus/types": "10.1.
|
|
38
|
+
"@directus/tsconfig": "1.0.0",
|
|
39
|
+
"@directus/types": "10.1.5"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsc --project tsconfig.prod.json",
|