erp-blocks 1.0.5 → 1.0.7

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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "erp-blocks",
3
3
  "configKey": "erp",
4
- "version": "1.0.5",
4
+ "version": "1.0.7",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -14,5 +14,7 @@
14
14
 
15
15
  <script setup>
16
16
  import { useCookie } from "#app";
17
- const sidebarOpen = useCookie("sidebarOpen");
17
+ const sidebarOpen = useCookie("sidebarOpen", {
18
+ default: () => true
19
+ });
18
20
  </script>
@@ -1,4 +1,4 @@
1
- import { type UseFetchOptions, type AsyncData } from '#app';
1
+ import { useFetch, type UseFetchOptions } from '#app';
2
2
  import type { Ref } from 'vue';
3
3
  export type CountFetchOptions<T> = UseFetchOptions<T> & {
4
4
  count?: {
@@ -6,6 +6,8 @@ export type CountFetchOptions<T> = UseFetchOptions<T> & {
6
6
  name: string;
7
7
  };
8
8
  };
9
- export declare function useCountFetch<T>(url: string | (() => string), options: CountFetchOptions<T>): AsyncData<T, Error | null> & {
9
+ interface extendedFetchReturn<T> extends Pick<ReturnType<typeof useFetch<T>>, 'data' | 'refresh' | 'execute' | 'clear' | 'error' | 'status'> {
10
10
  count: Ref<number | undefined>;
11
- };
11
+ }
12
+ export declare function useCountFetch<T>(url: string | (() => string), options: CountFetchOptions<T>): Promise<extendedFetchReturn<T>>;
13
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { useFetch, useState } from "#app";
2
- export function useCountFetch(url, options) {
2
+ export async function useCountFetch(url, options) {
3
3
  const defaultCount = options.count ?? {
4
4
  source: "header",
5
5
  name: "X-Total-Count"
@@ -11,7 +11,7 @@ export function useCountFetch(url, options) {
11
11
  const { count: countOpt, ...fetchOptions } = mergedOptions;
12
12
  const count = useState(() => void 0);
13
13
  const userOnResponse = mergedOptions.onResponse;
14
- const fetch = useFetch(url, {
14
+ const fetch = await useFetch(url, {
15
15
  ...fetchOptions,
16
16
  onResponse(ctx) {
17
17
  const { response } = ctx;
@@ -33,8 +33,9 @@ export function useCountFetch(url, options) {
33
33
  }
34
34
  }
35
35
  });
36
- return {
36
+ const result = {
37
37
  ...fetch,
38
38
  count
39
39
  };
40
+ return result;
40
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "erp-blocks",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Ready-to-use UI layouts and components designed as ERP system elements ",
5
5
  "repository": {
6
6
  "type": "git",