eco-vue-js 0.10.11 → 0.10.12
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/main.js
CHANGED
@@ -93,7 +93,7 @@ export { SemanticType } from './utils/SemanticType.js';
|
|
93
93
|
export { HorizontalAlign } from './utils/HorizontalAlign.js';
|
94
94
|
export { Month, WeekDay, addDay, addMonth, addYear, dateFormat, dateFormatter, dateRegexp, dateToQueryString, datetimeFormat, durationHumanize, getDurationRound, getStartOfDay, getStartOfMonth, getStartOfNextDay, getStartOfWeek, isSameDate, isSameMonth, isSameYear, monthShortFormatter, parseDate, timeFormat, weekdayShortFormatter } from './utils/dateTime.js';
|
95
95
|
export { getIsMobile, getIsTouchDevice, useIsMobile } from './utils/mobile.js';
|
96
|
-
export { PAGE_LENGTH, makeQueryPaginated, useDefaultQuery } from './utils/useDefaultQuery.js';
|
96
|
+
export { PAGE_LENGTH, makeQueryPaginated, useDefaultQuery, wrapUseQueryPaginated } from './utils/useDefaultQuery.js';
|
97
97
|
export { paginatedResponseUpdater, useQueryUpdater } from './utils/useQueryUpdater.js';
|
98
98
|
export { useCopy } from './utils/useCopy.js';
|
99
99
|
export { ListMode, debounce, genId, get, getAllScrollParents, getDefaultFieldConfigMap, getScrollParent, hasParent, isClientSide, isEqualArr, isEqualObj, isId, isIdArray, isIndex, isPage, numberCompactFormatter, numberFormatter, parseId, parseIndex, percentCompactFormatter, percentFormatter, set, throttle } from './utils/utils.js';
|
@@ -13,5 +13,8 @@ export declare const PAGE_LENGTH = 24;
|
|
13
13
|
export declare const makeQueryPaginated: <Data, QueryParams extends {
|
14
14
|
page?: number;
|
15
15
|
}>(key: string, getter: (queryParams: QueryParams) => Data[], setter?: (data: Data[]) => void, pageLength?: number) => UseQueryPaginated<Data, QueryParams>;
|
16
|
+
export declare const wrapUseQueryPaginated: <Data, QueryParams extends {
|
17
|
+
page?: number;
|
18
|
+
}>(key: string, queryFn: UseQueryDefault<Data[]>) => UseQueryPaginated<Data, QueryParams>;
|
16
19
|
export {};
|
17
20
|
//# sourceMappingURL=useDefaultQuery.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useDefaultQuery.d.ts","sourceRoot":"","sources":["../../src/utils/useDefaultQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EAA2B,MAAM,qBAAqB,CAAA;AAGtH,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAA;AAE9B,KAAK,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAEvD,KAAK,OAAO,CAAC,YAAY,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAEhI,KAAK,yBAAyB,CAAC,YAAY,GAAG,OAAO,EAAE,KAAK,GAAG,YAAY,IAAI,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG;IACnH,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,YAAY,YACZ,KAAK,iBACL,SAAS,SAAS,QAAQ;;;+EACuD,yBAAyB,CAAC,YAAY,EAAE,KAAK,CAO/H,CAAA;AAED,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B,eAAO,MAAM,kBAAkB,GAAI,IAAI,EAAE,WAAW,SAAS;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,OAAO,MAAM,UAAU,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,0BAA6B,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAsDvO,CAAA"}
|
1
|
+
{"version":3,"file":"use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iBAAiB,CAAC,IAAI,EAAE,WAAW,CAYnK,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useQuery, useQueryClient } from '@tanstack/vue-query';
|
2
|
-
import { unref } from 'vue';
|
2
|
+
import { unref, watch } from 'vue';
|
3
3
|
import { ApiError } from './api.js';
|
4
4
|
|
5
5
|
const useDefaultQuery = (...args) => {
|
@@ -54,5 +54,15 @@ const makeQueryPaginated = (key, getter, setter, pageLength = PAGE_LENGTH) => {
|
|
54
54
|
return query;
|
55
55
|
};
|
56
56
|
};
|
57
|
+
const wrapUseQueryPaginated = (key, queryFn) => {
|
58
|
+
return (queryParams, options = {}) => {
|
59
|
+
const query = queryFn(options);
|
60
|
+
const newQuery = makeQueryPaginated(key, () => query.data.value ?? [], query.setData)(queryParams, options);
|
61
|
+
watch(query.data, () => {
|
62
|
+
newQuery.refetch();
|
63
|
+
});
|
64
|
+
return newQuery;
|
65
|
+
};
|
66
|
+
};
|
57
67
|
|
58
|
-
export { PAGE_LENGTH, makeQueryPaginated, useDefaultQuery };
|
68
|
+
export { PAGE_LENGTH, makeQueryPaginated, useDefaultQuery, wrapUseQueryPaginated };
|