@directus/composables 11.0.0 → 11.1.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/index.d.ts +2 -0
- package/dist/index.js +13 -9
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,8 @@ type ComputedQuery = {
|
|
|
113
113
|
search: Ref<Query['search']> | ComputedRef<Query['search']> | WritableComputedRef<Query['search']>;
|
|
114
114
|
filter: Ref<Query['filter']> | ComputedRef<Query['filter']> | WritableComputedRef<Query['filter']>;
|
|
115
115
|
page: Ref<Query['page']> | WritableComputedRef<Query['page']>;
|
|
116
|
+
/** System filter applied to total item count. */
|
|
117
|
+
filterSystem?: Ref<Query['filter']> | ComputedRef<Query['filter']> | WritableComputedRef<Query['filter']>;
|
|
116
118
|
alias?: Ref<Query['alias']> | ComputedRef<Query['alias']> | WritableComputedRef<Query['alias']>;
|
|
117
119
|
deep?: Ref<Query['deep']> | ComputedRef<Query['deep']> | WritableComputedRef<Query['deep']>;
|
|
118
120
|
};
|
package/dist/index.js
CHANGED
|
@@ -345,13 +345,11 @@ function useGroupableParent(state = {}, options = {}, group = "item-group") {
|
|
|
345
345
|
import { getEndpoint, moveInArray } from "@directus/utils";
|
|
346
346
|
import axios from "axios";
|
|
347
347
|
import { isEqual as isEqual2, throttle } from "lodash-es";
|
|
348
|
-
import { computed as computed5, ref as ref5, unref, watch as watch3 } from "vue";
|
|
348
|
+
import { computed as computed5, ref as ref5, toRef, unref, watch as watch3 } from "vue";
|
|
349
349
|
function useItems(collection, query) {
|
|
350
350
|
const api = useApi();
|
|
351
351
|
const { primaryKeyField } = useCollection(collection);
|
|
352
|
-
const { fields, limit, sort, search, filter, page, alias
|
|
353
|
-
const alias = queryAlias ?? ref5();
|
|
354
|
-
const deep = queryDeep ?? ref5();
|
|
352
|
+
const { fields, limit, sort, search, filter, page, filterSystem, alias, deep } = query;
|
|
355
353
|
const endpoint = computed5(() => {
|
|
356
354
|
if (!collection.value) return null;
|
|
357
355
|
return getEndpoint(collection.value);
|
|
@@ -374,7 +372,7 @@ function useItems(collection, query) {
|
|
|
374
372
|
let loadingTimeout = null;
|
|
375
373
|
const fetchItems = throttle(getItems, 500);
|
|
376
374
|
watch3(
|
|
377
|
-
[collection, limit, sort, search, filter, fields, page, alias, deep],
|
|
375
|
+
[collection, limit, sort, search, filter, fields, page, toRef(alias), toRef(deep)],
|
|
378
376
|
async (after, before) => {
|
|
379
377
|
if (isEqual2(after, before)) return;
|
|
380
378
|
const [newCollection, newLimit, newSort, newSearch, newFilter] = after;
|
|
@@ -395,6 +393,14 @@ function useItems(collection, query) {
|
|
|
395
393
|
},
|
|
396
394
|
{ deep: true, immediate: true }
|
|
397
395
|
);
|
|
396
|
+
watch3(
|
|
397
|
+
[collection, toRef(filterSystem)],
|
|
398
|
+
async (after, before) => {
|
|
399
|
+
if (isEqual2(after, before)) return;
|
|
400
|
+
getTotalCount();
|
|
401
|
+
},
|
|
402
|
+
{ deep: true, immediate: true }
|
|
403
|
+
);
|
|
398
404
|
return {
|
|
399
405
|
itemCount,
|
|
400
406
|
totalCount,
|
|
@@ -419,9 +425,6 @@ function useItems(collection, query) {
|
|
|
419
425
|
loadingTimeout = setTimeout(() => {
|
|
420
426
|
loading.value = true;
|
|
421
427
|
}, 150);
|
|
422
|
-
if (unref(totalCount) === null) {
|
|
423
|
-
getTotalCount();
|
|
424
|
-
}
|
|
425
428
|
let fieldsToFetch = [...unref(fields) ?? []];
|
|
426
429
|
if (!unref(fields)?.includes("*") && primaryKeyField.value && fieldsToFetch.includes(primaryKeyField.value.field) === false) {
|
|
427
430
|
fieldsToFetch.push(primaryKeyField.value.field);
|
|
@@ -493,7 +496,8 @@ function useItems(collection, query) {
|
|
|
493
496
|
};
|
|
494
497
|
const response = await api.get(endpoint.value, {
|
|
495
498
|
params: {
|
|
496
|
-
aggregate
|
|
499
|
+
aggregate,
|
|
500
|
+
filter: unref(filterSystem)
|
|
497
501
|
},
|
|
498
502
|
signal: existingRequests.total.signal
|
|
499
503
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/composables",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "Shared Vue composables for Directus use",
|
|
5
5
|
"homepage": "https://directus.io",
|
|
6
6
|
"repository": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"axios": "1.7.3",
|
|
26
26
|
"lodash-es": "4.17.21",
|
|
27
27
|
"nanoid": "5.0.7",
|
|
28
|
-
"@directus/
|
|
29
|
-
"@directus/
|
|
28
|
+
"@directus/utils": "12.0.0",
|
|
29
|
+
"@directus/constants": "12.0.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/lodash-es": "4.17.12",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"vue": "3.4.27",
|
|
39
39
|
"@directus/extensions": "2.0.0",
|
|
40
40
|
"@directus/sdk": "17.0.0",
|
|
41
|
-
"@directus/
|
|
42
|
-
"@directus/
|
|
41
|
+
"@directus/tsconfig": "2.0.0",
|
|
42
|
+
"@directus/types": "12.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"vue": "^3.4"
|