eco-vue-js 0.4.14 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/dist/components/Button/WButtonAction.vue.js +1 -0
  2. package/dist/components/InfiniteList/WInfiniteList.vue.d.ts +16 -13
  3. package/dist/components/InfiniteList/WInfiniteList.vue.d.ts.map +1 -1
  4. package/dist/components/InfiniteList/WInfiniteList.vue.js +4 -2
  5. package/dist/components/InfiniteList/WInfiniteListPages.vue.d.ts +16 -13
  6. package/dist/components/InfiniteList/WInfiniteListPages.vue.d.ts.map +1 -1
  7. package/dist/components/InfiniteList/WInfiniteListPages.vue.js +4 -2
  8. package/dist/components/InfiniteList/components/InfiniteListPage.vue.d.ts +10 -7
  9. package/dist/components/InfiniteList/components/InfiniteListPage.vue.d.ts.map +1 -1
  10. package/dist/components/InfiniteList/components/InfiniteListPage.vue.js +5 -3
  11. package/dist/components/InfiniteList/components/InfiniteListPageTitle.vue.d.ts +29 -17
  12. package/dist/components/InfiniteList/components/InfiniteListPageTitle.vue.d.ts.map +1 -1
  13. package/dist/components/InfiniteList/components/InfiniteListPageTitle.vue.js +1 -1
  14. package/dist/components/InfiniteList/use/useInfiniteListHeader.js +1 -0
  15. package/dist/components/Select/WSelect.vue.d.ts +12 -12
  16. package/dist/components/Select/WSelect.vue.d.ts.map +1 -1
  17. package/dist/components/Select/WSelectAsync.vue.d.ts +7 -4
  18. package/dist/components/Select/WSelectAsync.vue.d.ts.map +1 -1
  19. package/dist/components/Select/WSelectAsync.vue.js +4 -2
  20. package/dist/components/Select/WSelectAsyncList.vue.d.ts +10 -7
  21. package/dist/components/Select/WSelectAsyncList.vue.d.ts.map +1 -1
  22. package/dist/components/Select/WSelectAsyncList.vue.js +4 -2
  23. package/dist/components/Select/WSelectAsyncSingle.vue.d.ts +7 -4
  24. package/dist/components/Select/WSelectAsyncSingle.vue.d.ts.map +1 -1
  25. package/dist/components/Select/WSelectAsyncSingle.vue.js +4 -2
  26. package/dist/components/Select/WSelectSingle.vue.d.ts +10 -10
  27. package/dist/components/Select/WSelectSingle.vue.d.ts.map +1 -1
  28. package/dist/components/Select/WSelectSingle.vue.js +1 -1
  29. package/dist/components/Select/components/SelectAsyncList.vue.d.ts +10 -7
  30. package/dist/components/Select/components/SelectAsyncList.vue.d.ts.map +1 -1
  31. package/dist/components/Select/components/SelectAsyncList.vue.js +4 -2
  32. package/dist/components/Select/components/SelectAsyncPrefix.vue.d.ts +7 -4
  33. package/dist/components/Select/components/SelectAsyncPrefix.vue.d.ts.map +1 -1
  34. package/dist/components/Select/components/SelectAsyncPrefix.vue.js +4 -2
  35. package/dist/components/Select/components/SelectAsyncPrefixPage.vue.d.ts +7 -4
  36. package/dist/components/Select/components/SelectAsyncPrefixPage.vue.d.ts.map +1 -1
  37. package/dist/components/Select/components/SelectAsyncPrefixPage.vue.js +3 -1
  38. package/dist/main.d.ts +1 -0
  39. package/dist/main.d.ts.map +1 -1
  40. package/dist/main.js +1 -0
  41. package/dist/types/global.d.ts +11 -9
  42. package/dist/utils/useDefaultQuery.d.ts +7 -0
  43. package/dist/utils/useDefaultQuery.d.ts.map +1 -0
  44. package/dist/utils/useDefaultQuery.js +12 -0
  45. package/package.json +5 -2
@@ -40,14 +40,16 @@ declare type DefaultData = {id: number, [key: string]: unknown}
40
40
 
41
41
  type Params = Parameters<import('@tanstack/vue-query').QueryClient['setQueriesData']>
42
42
 
43
- declare type QueryParams = Partial<Record<string, unknown> & {page?: number}>
43
+ declare type ApiErrorDefault = unknown
44
44
 
45
- declare type UseDefaultQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends import('@tanstack/vue-query').QueryKey = import('@tanstack/vue-query').QueryKey> =
46
- (...args: Parameters<typeof useQuery<TQueryFnData, TError, TData, TQueryKey>>) => import('@tanstack/vue-query').UseQueryReturnType<TData, TError> & {
47
- setData: (updater: TQueryFnData, options?: Params[2]) => ReturnType<import('@tanstack/vue-query').QueryClient['setQueriesData']>
48
- }
45
+ declare type UseQueryDefault<TQueryFnData = unknown, TError = ApiErrorDefault, TData = TQueryFnData, TQueryKey extends import('@tanstack/vue-query').QueryKey = import('@tanstack/vue-query').QueryKey> =
46
+ typeof import('../utils/useDefaultQuery').useDefaultQuery<TQueryFnData, TError, TData, TQueryKey>
49
47
 
50
- declare type UsePaginatedQuery<Data extends DefaultData = DefaultData> = (
51
- queryParams: import('vue').Ref<QueryParams>,
52
- options?: Partial<Parameters<UseDefaultQuery<PaginatedResponse<Data>>>[0]>
53
- ) => ReturnType<UseDefaultQuery<PaginatedResponse<Data>>>
48
+ declare type QueryOptions<Data, Error = ApiErrorDefault> = Partial<Parameters<typeof import('../utils/useDefaultQuery').useDefaultQuery<Data, Error>>[0]>
49
+
50
+ declare type UseQueryEmpty<Model, ApiError> = (options?: QueryOptions<Model, ApiError>) => ReturnType<typeof import('../utils/useDefaultQuery').useDefaultQuery<Model, ApiError>>
51
+
52
+ declare type UseQueryWithParams<Model, ApiError, QueryParams> =
53
+ (queryParams: import('vue').MaybeRef<QueryParams>, options?: QueryOptions<Model, ApiError>) => ReturnType<typeof import('../utils/useDefaultQuery').useDefaultQuery<Model, ApiError>>
54
+
55
+ declare type UseQueryPaginated<Model, ApiError, QueryParams> = UseQueryWithParams<PaginatedResponse<Model>, ApiError, QueryParams>
@@ -0,0 +1,7 @@
1
+ import { type QueryClient, type UseQueryReturnType, type QueryKey } from '@tanstack/vue-query';
2
+ type Params = Parameters<QueryClient['setQueriesData']>;
3
+ export declare const useDefaultQuery: <TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(options: import("@tanstack/vue-query").UseQueryOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, queryClient?: QueryClient | undefined) => UseQueryReturnType<TData, TError> & {
4
+ setData: (updater: TQueryFnData, options?: Params[2]) => ReturnType<QueryClient['setQueriesData']>;
5
+ };
6
+ export {};
7
+ //# sourceMappingURL=useDefaultQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDefaultQuery.d.ts","sourceRoot":"","sources":["../../src/utils/useDefaultQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,KAAK,QAAQ,EAAC,MAAM,qBAAqB,CAAA;AAEtH,KAAK,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAEvD,eAAO,MAAM,eAAe;uBAEL,YAAY,YAAY,MAAM,CAAC,CAAC,CAAC,KAAK,WAAW,WAAW,CAAC,gBAAgB,CAAC,CAAC;CAUrG,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { useQueryClient, useQuery } from '@tanstack/vue-query';
2
+
3
+ const useDefaultQuery = (...args) => {
4
+ const queryClient = args[1] ?? useQueryClient();
5
+ const setData = (updater, options) => queryClient.setQueriesData({ queryKey: "queryKey" in args[0] ? args[0].queryKey : void 0 }, updater, options);
6
+ return {
7
+ ...useQuery(...args),
8
+ setData
9
+ };
10
+ };
11
+
12
+ export { useDefaultQuery };
package/package.json CHANGED
@@ -4,14 +4,14 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.4.14",
7
+ "version": "0.5.0",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "build": "run-p type-check build-only",
11
11
  "preview": "vite preview",
12
12
  "test:unit": "vitest --environment jsdom --root src/",
13
13
  "build-only": "vite build",
14
- "type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
14
+ "type-check": "vue-tsc --noEmit -p tsconfig.vue.json --composite false",
15
15
  "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
16
16
  "lint:no-fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore",
17
17
  "write-imports": "node write-imports.js"
@@ -99,6 +99,9 @@
99
99
  "./dist/utils/Tooltip": {
100
100
  "import": "./dist/utils/Tooltip.js"
101
101
  },
102
+ "./dist/utils/useDefaultQuery": {
103
+ "import": "./dist/utils/useDefaultQuery.js"
104
+ },
102
105
  "./dist/components/ActionsBar/WActionsBar.vue": {
103
106
  "import": "./dist/components/ActionsBar/WActionsBar.vue.js"
104
107
  },