@liujitcn/kratos-admin-core 0.0.74 → 0.0.76
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/package/declarations/src/utils/index.d.ts +1 -1
- package/dist/package/src/locales/index.ts +6 -0
- package/dist/package/src/rpc/base/v1/config.ts +1 -1
- package/dist/package/src/rpc/base/v1/file.ts +1 -1
- package/dist/package/src/rpc/base/v1/language.ts +1 -1
- package/dist/package/src/rpc/base/v1/login.ts +1 -1
- package/dist/package/src/rpc/base/v1/mfa.ts +1 -1
- package/dist/package/src/rpc/base/v1/oauth.ts +1 -1
- package/dist/package/src/rpc/base/v1/oauth_client.ts +1 -1
- package/dist/package/src/rpc/base/v1/secret_crypto.ts +1 -1
- package/dist/package/src/rpc/common/v1/common.ts +1 -1
- package/dist/package/src/rpc/common/v1/enum.ts +1 -1
- package/dist/package/src/rpc/common/v1/types.ts +1 -1
- package/dist/package/src/rpc/google/protobuf/empty.ts +1 -1
- package/dist/package/src/rpc/google/protobuf/struct.ts +1 -1
- package/dist/package/src/rpc/google/protobuf/wrappers.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/auth.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_dict.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_i18n.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/base_tenant.ts +1 -1
- package/dist/package/src/rpc/system/admin/v1/common.ts +1 -1
- package/dist/package/src/rpc/system/common/v1/common.ts +1 -1
- package/dist/package/src/utils/index.ts +3 -1
- package/package.json +1 -1
|
@@ -112,7 +112,7 @@ export declare function isRouteMenuActive(item: RouteItem, currentPath: string):
|
|
|
112
112
|
*/
|
|
113
113
|
export declare function getFlatMenuList(menuList: RouteItem[]): RouteItem[];
|
|
114
114
|
/**
|
|
115
|
-
* @description 使用递归过滤出需要渲染在左侧菜单的列表 (需剔除 hide == true
|
|
115
|
+
* @description 使用递归过滤出需要渲染在左侧菜单的列表 (需剔除 hide == true 的菜单,目录下无可见子菜单时目录一并隐藏)
|
|
116
116
|
* @param {Array} menuList 菜单列表
|
|
117
117
|
* @returns {Array}
|
|
118
118
|
* */
|
|
@@ -40,6 +40,8 @@ const mutableLanguageOptions = ref<LocaleOption[]>([]);
|
|
|
40
40
|
const localeChangeHandlers = new Set<() => void | Promise<void>>();
|
|
41
41
|
const defaultLocaleMessages = new Map<SupportedLocale, LocaleMessages>();
|
|
42
42
|
const customLocaleMessages = new Map<SupportedLocale, LocaleMessages>();
|
|
43
|
+
// 语言包版本号:数据库自定义翻译热应用时递增,让缓存 t() 结果的 computed 依赖失效。
|
|
44
|
+
const localeMessagesVersion = ref(0);
|
|
43
45
|
|
|
44
46
|
/** 管理端 Vue I18n 实例。 */
|
|
45
47
|
export const adminI18n = createI18n({
|
|
@@ -109,6 +111,7 @@ export function registerLocaleMessages(modules: AdminModule[]): void {
|
|
|
109
111
|
customLocaleMessages.set(locale, messages);
|
|
110
112
|
adminI18n.global.setLocaleMessage(locale, messages);
|
|
111
113
|
});
|
|
114
|
+
localeMessagesVersion.value += 1;
|
|
112
115
|
}
|
|
113
116
|
|
|
114
117
|
/** 应用全部语言的数据库自定义翻译覆盖项。 */
|
|
@@ -122,6 +125,7 @@ export function applyCustomLocaleMessages(customs: Array<{ locale?: string; key?
|
|
|
122
125
|
customLocaleMessages.set(locale, messages);
|
|
123
126
|
adminI18n.global.setLocaleMessage(locale, messages);
|
|
124
127
|
});
|
|
128
|
+
localeMessagesVersion.value += 1;
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
/** 初始化持久化语言偏好并同步日期库。 */
|
|
@@ -188,6 +192,8 @@ export function registerLocaleChangeHandler(handler: () => void | Promise<void>)
|
|
|
188
192
|
|
|
189
193
|
/** 在非组件代码中翻译稳定语言键。 */
|
|
190
194
|
export function t(key: string, params: LocaleParams = {}): string {
|
|
195
|
+
// 读取版本号建立响应式依赖,自定义翻译热应用后缓存文案的 computed 能自动重算。
|
|
196
|
+
void localeMessagesVersion.value;
|
|
191
197
|
return String(adminI18n.global.t(key, params));
|
|
192
198
|
}
|
|
193
199
|
|
|
@@ -230,7 +230,7 @@ export function getFlatMenuList(menuList: RouteItem[]): RouteItem[] {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
* @description 使用递归过滤出需要渲染在左侧菜单的列表 (需剔除 hide == true
|
|
233
|
+
* @description 使用递归过滤出需要渲染在左侧菜单的列表 (需剔除 hide == true 的菜单,目录下无可见子菜单时目录一并隐藏)
|
|
234
234
|
* @param {Array} menuList 菜单列表
|
|
235
235
|
* @returns {Array}
|
|
236
236
|
* */
|
|
@@ -238,6 +238,8 @@ export function getShowMenuList(menuList: RouteItem[]) {
|
|
|
238
238
|
let newMenuList: RouteItem[] = JSON.parse(JSON.stringify(menuList));
|
|
239
239
|
return newMenuList.filter(item => {
|
|
240
240
|
item.children?.length && (item.children = getShowMenuList(item.children));
|
|
241
|
+
// 子菜单全部隐藏的空目录不再渲染,避免侧边栏出现无子项的可展开目录。
|
|
242
|
+
if (item.type === BaseMenuType.BASE_MENU_TYPE_FOLDER && !item.children?.length) return false;
|
|
241
243
|
return !getRouteMetaHidden(item.meta);
|
|
242
244
|
});
|
|
243
245
|
}
|