@liujitcn/kratos-admin-core 0.0.73 → 0.0.75

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.
@@ -62,7 +62,7 @@ declare const __VLS_base: import("vue").DefineComponent<ProTableProps, {
62
62
  reset: () => void;
63
63
  handleSizeChange: (val: number) => void;
64
64
  handleCurrentChange: (val: number) => void;
65
- clearSelection: () => void;
65
+ clearSelection: () => void | undefined;
66
66
  getTotal: () => number;
67
67
  enumMap: globalThis.Ref<Map<string, {
68
68
  [key: string]: any;
@@ -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
  * */
@@ -239,8 +239,8 @@ const {
239
239
  handleCurrentChange
240
240
  } = useTable(props.requestApi, props.initParam, props.pagination, props.dataCallback, props.requestError);
241
241
 
242
- // 清空选中数据列表
243
- const clearSelection = () => tableRef.value!.clearSelection();
242
+ // 清空选中数据列表;表格卸载或未挂载完成时引用为空,跳过清空避免报错
243
+ const clearSelection = () => tableRef.value?.clearSelection();
244
244
 
245
245
  /** 请求表格数据;未启用跨刷新保留勾选时,同步清空随数据刷新而失效的多选状态。 */
246
246
  const getTableList = async () => {
@@ -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
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@liujitcn/kratos-admin-core",
3
3
  "private": false,
4
- "version": "0.0.73",
4
+ "version": "0.0.75",
5
5
  "type": "module",
6
6
  "description": "kratos-admin frontend runtime and base modules",
7
7
  "author": {