@anweb/nuxt-ancore 1.15.7 → 1.15.9
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 +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/composables/useAnData.d.ts +3 -2
- package/dist/runtime/composables/useAnData.js +3 -2
- package/dist/runtime/composables/useAnForm.js +5 -3
- package/dist/runtime/composables/useAnList.d.ts +2 -2
- package/dist/runtime/composables/useAnList.js +1 -3
- package/dist/runtime/types/global.d.ts +1 -1
- package/package.json +7 -7
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addComponentsDir, addImportsDir, addPlugin } from '@nuxt/kit';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
|
|
4
|
-
const module = defineNuxtModule({
|
|
4
|
+
const module$1 = defineNuxtModule({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "AnCore",
|
|
7
7
|
configKey: "ancore"
|
|
@@ -34,4 +34,4 @@ const module = defineNuxtModule({
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
export { module as default };
|
|
37
|
+
export { module$1 as default };
|
|
@@ -4,17 +4,18 @@ import { type AsyncDataRequestStatus } from '#app';
|
|
|
4
4
|
interface TConfig {
|
|
5
5
|
request: NitroFetchRequest;
|
|
6
6
|
apiConfig?: NitroFetchOptions<string>;
|
|
7
|
-
params
|
|
7
|
+
params: Record<string, unknown>;
|
|
8
8
|
}
|
|
9
9
|
interface TUseAnData<TData, TError> {
|
|
10
10
|
init: () => Promise<void>;
|
|
11
11
|
set: (data: TData) => void;
|
|
12
12
|
refresh: () => void;
|
|
13
13
|
config: Ref<TConfig>;
|
|
14
|
+
params: TConfig['params'];
|
|
14
15
|
data: ComputedRef<TData | undefined>;
|
|
15
16
|
status: ComputedRef<AsyncDataRequestStatus>;
|
|
16
17
|
loading: ComputedRef<boolean>;
|
|
17
18
|
error: ComputedRef<TError | undefined>;
|
|
18
19
|
}
|
|
19
|
-
export declare const useAnData: <TData = unknown, TError = unknown>(initConfig: TConfig) => TUseAnData<TData, TError>;
|
|
20
|
+
export declare const useAnData: <TData = unknown, TError = unknown>(initConfig: Omit<TConfig, "params"> & Partial<TConfig["params"]>) => TUseAnData<TData, TError>;
|
|
20
21
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed, ref, watch, onMounted, nextTick } from "vue";
|
|
2
2
|
import { useAsyncData } from "#app";
|
|
3
|
-
import { toQuery, userApi } from "
|
|
3
|
+
import { toQuery, userApi } from "#imports";
|
|
4
4
|
export const useAnData = (initConfig) => {
|
|
5
|
-
const config = ref({ ...initConfig });
|
|
5
|
+
const config = ref({ params: {}, ...initConfig });
|
|
6
6
|
const data = ref(void 0);
|
|
7
7
|
const error = ref(void 0);
|
|
8
8
|
const status = ref("idle");
|
|
@@ -69,6 +69,7 @@ export const useAnData = (initConfig) => {
|
|
|
69
69
|
refresh: () => time.value = Date.now(),
|
|
70
70
|
data,
|
|
71
71
|
config,
|
|
72
|
+
params: config.value.params,
|
|
72
73
|
status,
|
|
73
74
|
loading,
|
|
74
75
|
error
|
|
@@ -64,9 +64,11 @@ export const useAnForm = (params, data) => {
|
|
|
64
64
|
}
|
|
65
65
|
return changed;
|
|
66
66
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
Object.keys(state.value).forEach((key) => {
|
|
68
|
+
watch(() => state.value[key], () => {
|
|
69
|
+
errors.value[key] = void 0;
|
|
70
|
+
});
|
|
71
|
+
});
|
|
70
72
|
init();
|
|
71
73
|
return {
|
|
72
74
|
state,
|
|
@@ -4,7 +4,7 @@ interface TConfig<TFilter> {
|
|
|
4
4
|
request: NitroFetchRequest;
|
|
5
5
|
apiConfig?: NitroFetchOptions<string>;
|
|
6
6
|
filter?: TFilter;
|
|
7
|
-
params?: Record<string,
|
|
7
|
+
params?: Record<string, string>;
|
|
8
8
|
skipField?: string;
|
|
9
9
|
reverse?: boolean;
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ export declare const useAnList: <TData, TFilter extends object = {}>(initConfig:
|
|
|
12
12
|
init: () => Promise<void>;
|
|
13
13
|
infiniteScroll: (scrollConfig?: TInfiniteScroll) => () => void;
|
|
14
14
|
filter: TFilter;
|
|
15
|
-
params: Record<string,
|
|
15
|
+
params: Record<string, string> | undefined;
|
|
16
16
|
items: TData[];
|
|
17
17
|
count: import("vue").Ref<number | null, number | null>;
|
|
18
18
|
inited: import("vue").ComputedRef<boolean>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ref, reactive, watch, computed } from "vue";
|
|
2
2
|
import { useInfiniteScroll } from "@vueuse/core";
|
|
3
|
-
import { useAnData } from "
|
|
3
|
+
import { useAnData } from "#imports";
|
|
4
4
|
export const useAnList = (initConfig) => {
|
|
5
5
|
const config = ref(initConfig);
|
|
6
6
|
const items = reactive([]);
|
|
7
7
|
const count = ref(null);
|
|
8
|
-
let resetInfiniteScroll;
|
|
9
8
|
const init = async () => {
|
|
10
9
|
await data.init();
|
|
11
10
|
await refresh();
|
|
@@ -43,7 +42,6 @@ export const useAnList = (initConfig) => {
|
|
|
43
42
|
canLoadMore
|
|
44
43
|
}
|
|
45
44
|
);
|
|
46
|
-
resetInfiniteScroll = reset;
|
|
47
45
|
return reset;
|
|
48
46
|
};
|
|
49
47
|
const inited = computed(() => data.status.value !== "idle");
|
|
@@ -14,7 +14,7 @@ declare module 'nuxt/schema' {
|
|
|
14
14
|
interface PublicRuntimeConfig {
|
|
15
15
|
i18n?: InitOptions<unknown> & {
|
|
16
16
|
cookie?: string
|
|
17
|
-
resources?: Record<string, { translation:
|
|
17
|
+
resources?: Record<string, { translation: string }>
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anweb/nuxt-ancore",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.9",
|
|
4
4
|
"description": "AnCore Nuxt module",
|
|
5
5
|
"repository": "https://github.com/ANLTD/ancore",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
"release:major": "npm run prepack && changelogen --major --release && npm publish --access public && git push --follow-tags"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@
|
|
36
|
-
"@vueuse/
|
|
37
|
-
"@vueuse/integrations": "^14.1.0",
|
|
35
|
+
"@vueuse/core": "^14.2.0",
|
|
36
|
+
"@vueuse/integrations": "^14.2.0",
|
|
38
37
|
"async-validator": "^4.2.5",
|
|
39
|
-
"i18next": "^25.
|
|
38
|
+
"i18next": "^25.8.0",
|
|
40
39
|
"uuid": "^13.0.0"
|
|
41
40
|
},
|
|
42
41
|
"devDependencies": {
|
|
43
42
|
"@nuxt/devtools": "^3.1.1",
|
|
43
|
+
"@nuxt/kit": "^4.3.0",
|
|
44
44
|
"@nuxt/module-builder": "^1.0.2",
|
|
45
|
-
"@nuxt/schema": "^4.
|
|
45
|
+
"@nuxt/schema": "^4.3.0",
|
|
46
46
|
"@types/node": "latest",
|
|
47
47
|
"changelogen": "^0.6.2",
|
|
48
|
-
"nuxt": "^4.
|
|
48
|
+
"nuxt": "^4.3.0",
|
|
49
49
|
"typescript": "~5.9.3"
|
|
50
50
|
}
|
|
51
51
|
}
|