@anweb/nuxt-ancore 1.8.3 → 1.8.5

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": "AnCore",
3
3
  "configKey": "ancore",
4
- "version": "1.8.3",
4
+ "version": "1.8.5",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
@@ -1,27 +1,18 @@
1
1
  import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
2
2
  import { type Ref, type ComputedRef } from 'vue';
3
3
  import { useAsyncData } from '#app';
4
- import type { UseEventBusReturn } from '@vueuse/core';
5
- interface TEventBase {
6
- event: string;
7
- payload: unknown;
8
- }
9
- interface TConfig<TData, TEvents extends TEventBase> {
4
+ interface TConfig {
10
5
  request: NitroFetchRequest;
11
6
  apiConfig?: NitroFetchOptions<string>;
12
- events?: {
13
- bus: UseEventBusReturn<TEvents['event'], TEvents['payload']>;
14
- callback: (target: TData, event: TEvents['event'], payload: TEvents['payload'], set: (value: TData) => void) => void;
15
- }[];
16
7
  }
17
8
  interface TUseAnData<TData, TError> {
18
9
  init: () => Promise<void>;
19
10
  set: (data: TData) => void;
20
11
  loading: ComputedRef<boolean>;
21
12
  request: Ref<NitroFetchRequest>;
22
- data: ComputedRef<TData>;
13
+ data: ComputedRef;
23
14
  error: ComputedRef<TError>;
24
15
  status: ReturnType<typeof useAsyncData>['status'];
25
16
  }
26
- export declare const useAnData: <TData = unknown, TError = unknown, TEvents extends TEventBase = TEventBase>(config: TConfig<TData, TEvents>) => TUseAnData<TData, TError>;
17
+ export declare const useAnData: <TData = unknown, TError = unknown>(config: TConfig) => TUseAnData<TData, TError>;
27
18
  export {};
@@ -22,13 +22,6 @@ export const useAnData = (config) => {
22
22
  () => userApi(request.value, { method: "GET", ...config.apiConfig || {} }),
23
23
  { immediate: false }
24
24
  );
25
- if (config.events) {
26
- for (const event of config.events) {
27
- event.bus.on((event_type, payload) => {
28
- event.callback(data.value, event_type, payload, set);
29
- });
30
- }
31
- }
32
25
  return {
33
26
  init: execute,
34
27
  set,
@@ -1,20 +1,11 @@
1
1
  import type { NitroFetchOptions, NitroFetchRequest } from 'nitropack';
2
- import { type UseEventBusReturn } from '@vueuse/core';
3
- interface TEventBase {
4
- event: string;
5
- payload: unknown;
6
- }
7
- interface TConfig<TData, TFilter, TEvents extends TEventBase> {
2
+ interface TConfig<TFilter> {
8
3
  request: NitroFetchRequest;
9
4
  filter?: TFilter;
10
5
  reverse?: boolean;
11
- events?: {
12
- bus: UseEventBusReturn<TEvents['event'], TEvents['payload']>;
13
- callback: (list: TData[], count: number, event: TEvents['event'], payload: TEvents['payload'], setCount?: (value: number) => void) => void;
14
- }[];
15
6
  apiConfig?: NitroFetchOptions<string>;
16
7
  }
17
- declare const _default: <TData, TFilter = unknown, TEvents extends TEventBase = TEventBase>(config: TConfig<TData, TFilter, TEvents>) => {
8
+ declare const _default: <TData, TFilter = unknown>(config: TConfig<TFilter>) => {
18
9
  init: (newFilter?: TFilter) => Promise<void>;
19
10
  inited: import("vue").Ref<boolean, boolean>;
20
11
  filter: [Partial<TFilter>] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & Partial<TFilter>, import("vue").Ref<import("vue").Ref<any, any> & Partial<TFilter>, import("vue").Ref<any, any> & Partial<TFilter>>, import("vue").Ref<any, any> & Partial<TFilter>> : import("vue").Ref<import("vue").UnwrapRef<Partial<TFilter>>, Partial<TFilter> | import("vue").UnwrapRef<Partial<TFilter>>>;
@@ -14,13 +14,6 @@ export default (config) => {
14
14
  }
15
15
  await execute();
16
16
  refresh();
17
- if (config.events) {
18
- for (const event of config.events) {
19
- event.bus.on((event_type, payload) => {
20
- event.callback(items, count.value || 0, event_type, payload, setCount);
21
- });
22
- }
23
- }
24
17
  inited.value = true;
25
18
  };
26
19
  const refresh = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anweb/nuxt-ancore",
3
- "version": "1.8.3",
3
+ "version": "1.8.5",
4
4
  "description": "AnCore Nuxt module",
5
5
  "repository": "https://github.com/ANLTD/ancore",
6
6
  "license": "MIT",