@anweb/nuxt-ancore 1.16.11 → 1.16.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/module.json +1 -1
- package/dist/runtime/components/An/Dialogs/Dialogs.vue.d.ts +2 -1
- package/dist/runtime/components/An/Dialogs/Item.vue.d.ts +6 -1
- package/dist/runtime/components/An/Dropdown.vue.d.ts +24 -1
- package/dist/runtime/composables/useAnForm.d.ts +4 -4
- package/dist/runtime/composables/useAnForm.js +15 -4
- package/dist/runtime/composables/useAnI18n.d.ts +6 -6
- package/dist/runtime/composables/useAnI18n.js +43 -30
- package/dist/runtime/composables/useAnList.d.ts +2 -1
- package/dist/runtime/composables/useAnList.js +4 -0
- package/package.json +5 -4
package/dist/module.json
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
2
3
|
export default _default;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { TDialog } from '#ancore/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
dialog: TDialog;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
2
7
|
export default _default;
|
|
@@ -1,2 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
area?: string;
|
|
3
|
+
};
|
|
4
|
+
declare var __VLS_1: {
|
|
5
|
+
toggle: (value?: boolean) => void;
|
|
6
|
+
}, __VLS_9: {
|
|
7
|
+
close: () => void;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_Slots = {} & {
|
|
10
|
+
button?: (props: typeof __VLS_1) => any;
|
|
11
|
+
} & {
|
|
12
|
+
menu?: (props: typeof __VLS_9) => any;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
15
|
+
toggle: (value?: boolean) => void;
|
|
16
|
+
close: () => void;
|
|
17
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
2
20
|
export default _default;
|
|
21
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -5,15 +5,15 @@ interface TStructureItem<TData> {
|
|
|
5
5
|
rules?: RuleItem[];
|
|
6
6
|
}
|
|
7
7
|
export declare const useAnForm: <TForm extends object, TData extends Partial<TForm> | null | (Record<string, unknown> & Partial<TForm>) = Partial<TForm> | null>(params: Record<keyof TForm, TStructureItem<TForm[keyof TForm]>>, data?: TData) => {
|
|
8
|
-
state:
|
|
9
|
-
diff:
|
|
8
|
+
state: TForm;
|
|
9
|
+
readonly diff: Partial<TForm>;
|
|
10
10
|
merge: (data: Partial<TForm>, commit?: true) => void;
|
|
11
11
|
validator: {
|
|
12
12
|
check: () => Promise<UseAsyncValidatorExecuteReturn>;
|
|
13
|
-
errors:
|
|
13
|
+
readonly errors: any;
|
|
14
14
|
};
|
|
15
15
|
history: {
|
|
16
|
-
isChanged:
|
|
16
|
+
readonly isChanged: boolean;
|
|
17
17
|
reset: () => void;
|
|
18
18
|
commit: () => void;
|
|
19
19
|
};
|
|
@@ -71,17 +71,28 @@ export const useAnForm = (params, data) => {
|
|
|
71
71
|
});
|
|
72
72
|
init();
|
|
73
73
|
return {
|
|
74
|
-
state
|
|
75
|
-
|
|
74
|
+
get state() {
|
|
75
|
+
return state.value;
|
|
76
|
+
},
|
|
77
|
+
set state(val) {
|
|
78
|
+
state.value = val;
|
|
79
|
+
},
|
|
80
|
+
get diff() {
|
|
81
|
+
return diff.value;
|
|
82
|
+
},
|
|
76
83
|
merge,
|
|
77
84
|
validator: {
|
|
78
85
|
check: () => {
|
|
79
86
|
return validatorExecute();
|
|
80
87
|
},
|
|
81
|
-
errors
|
|
88
|
+
get errors() {
|
|
89
|
+
return errors.value;
|
|
90
|
+
}
|
|
82
91
|
},
|
|
83
92
|
history: {
|
|
84
|
-
isChanged
|
|
93
|
+
get isChanged() {
|
|
94
|
+
return isChanged.value;
|
|
95
|
+
},
|
|
85
96
|
reset: () => {
|
|
86
97
|
state.value = first.value;
|
|
87
98
|
void nextTick(History.clear);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const useAnI18n: (resources?: Record<string, Record<string, string>>) => {
|
|
2
|
-
lang: string;
|
|
3
|
-
set: (lang: string) => void;
|
|
4
|
-
t: import("i18next").TFunction<["translation", ...string[]], undefined>;
|
|
5
|
-
} | {
|
|
6
|
-
lang: string;
|
|
7
|
-
set: (lang: string) => void;
|
|
8
2
|
t: (key: string, options?: {}) => string;
|
|
3
|
+
readonly lang: string;
|
|
4
|
+
set: (value: string) => void;
|
|
5
|
+
} | {
|
|
6
|
+
t: import("i18next").TFunction<["translation", ...string[]], undefined>;
|
|
7
|
+
readonly lang: string;
|
|
8
|
+
set: (value: string) => void;
|
|
9
9
|
};
|
|
@@ -1,42 +1,55 @@
|
|
|
1
1
|
import i18next from "i18next";
|
|
2
|
+
import { ref } from "vue";
|
|
2
3
|
import { useRuntimeConfig, useCookie } from "#app";
|
|
3
4
|
const nsMap = /* @__PURE__ */ new WeakMap();
|
|
4
5
|
let nsId = 0;
|
|
6
|
+
const lang = ref(i18next.language);
|
|
5
7
|
export const useAnI18n = (resources) => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
cookie.value = lang;
|
|
21
|
-
}
|
|
22
|
-
} catch (e) {
|
|
23
|
-
console.error("[AnI18n] Failed to set language:", e);
|
|
8
|
+
const set = (value) => {
|
|
9
|
+
try {
|
|
10
|
+
i18next.changeLanguage(value);
|
|
11
|
+
lang.value = value;
|
|
12
|
+
const config = useRuntimeConfig().public.i18n;
|
|
13
|
+
if (config?.cookie) {
|
|
14
|
+
const cookie = useCookie(config?.cookie, {
|
|
15
|
+
maxAge: 60 * 60 * 24 * 365,
|
|
16
|
+
path: "/",
|
|
17
|
+
sameSite: "lax",
|
|
18
|
+
secure: true
|
|
19
|
+
});
|
|
20
|
+
cookie.value = value;
|
|
24
21
|
}
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error("[AnI18n] Failed to set language:", e);
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
if (resources) {
|
|
27
|
+
let ns = nsMap.get(resources);
|
|
28
|
+
if (!ns) {
|
|
29
|
+
ns = `c${nsId++}`;
|
|
30
|
+
nsMap.set(resources, ns);
|
|
31
|
+
for (const l in resources) {
|
|
32
|
+
try {
|
|
33
|
+
i18next.addResourceBundle(l, ns, resources[l]);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.error(`[AnI18n] Failed to add resource bundle for ${l}:`, e);
|
|
36
|
+
}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
const nsRef = ns;
|
|
40
|
+
return {
|
|
41
|
+
t: (key, options = {}) => i18next.t(key, { ns: [nsRef, "translation"], ...options }),
|
|
42
|
+
get lang() {
|
|
43
|
+
return lang.value;
|
|
44
|
+
},
|
|
45
|
+
set
|
|
46
|
+
};
|
|
39
47
|
}
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
return {
|
|
49
|
+
t: i18next.t,
|
|
50
|
+
get lang() {
|
|
51
|
+
return lang.value;
|
|
52
|
+
},
|
|
53
|
+
set
|
|
54
|
+
};
|
|
42
55
|
};
|
|
@@ -12,11 +12,12 @@ interface TConfig<TFilter, Route extends NitroFetchRequest = NitroFetchRequest>
|
|
|
12
12
|
}
|
|
13
13
|
interface TUseAnList<TData, TFilter> {
|
|
14
14
|
init: () => Promise<void>;
|
|
15
|
+
refresh: () => void;
|
|
15
16
|
infiniteScroll: (scrollConfig?: TInfiniteScroll) => () => void;
|
|
16
17
|
filter: TFilter;
|
|
17
18
|
params: Record<string, string> | undefined;
|
|
18
19
|
items: TData[];
|
|
19
|
-
|
|
20
|
+
count: number | null;
|
|
20
21
|
readonly status: AsyncDataRequestStatus;
|
|
21
22
|
readonly loading: boolean;
|
|
22
23
|
readonly error: unknown | undefined;
|
|
@@ -52,6 +52,7 @@ export const useAnList = (initConfig) => {
|
|
|
52
52
|
watch(() => data.data, refresh);
|
|
53
53
|
return {
|
|
54
54
|
init,
|
|
55
|
+
refresh: data.refresh,
|
|
55
56
|
infiniteScroll,
|
|
56
57
|
get filter() {
|
|
57
58
|
return config.value.filter;
|
|
@@ -67,6 +68,9 @@ export const useAnList = (initConfig) => {
|
|
|
67
68
|
get count() {
|
|
68
69
|
return count.value;
|
|
69
70
|
},
|
|
71
|
+
set count(val) {
|
|
72
|
+
count.value = val;
|
|
73
|
+
},
|
|
70
74
|
get status() {
|
|
71
75
|
return data.status;
|
|
72
76
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anweb/nuxt-ancore",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.12",
|
|
4
4
|
"description": "AnCore Nuxt module",
|
|
5
5
|
"repository": "https://github.com/ANLTD/ancore",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,16 +36,17 @@
|
|
|
36
36
|
"@vueuse/core": "^14.2.1",
|
|
37
37
|
"@vueuse/integrations": "^14.2.1",
|
|
38
38
|
"async-validator": "^4.2.5",
|
|
39
|
-
"i18next": "^25.
|
|
39
|
+
"i18next": "^25.10.10"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@nuxt/devtools": "^3.2.
|
|
42
|
+
"@nuxt/devtools": "^3.2.4",
|
|
43
43
|
"@nuxt/kit": "^4.4.2",
|
|
44
44
|
"@nuxt/module-builder": "^1.0.2",
|
|
45
45
|
"@nuxt/schema": "^4.4.2",
|
|
46
46
|
"@types/node": "latest",
|
|
47
47
|
"changelogen": "^0.6.2",
|
|
48
48
|
"nuxt": "^4.4.2",
|
|
49
|
-
"typescript": "~5.9.3"
|
|
49
|
+
"typescript": "~5.9.3",
|
|
50
|
+
"vue-tsc": "^3.2.6"
|
|
50
51
|
}
|
|
51
52
|
}
|