mirror of https://github.com/certd/certd
🔱: [client] sync upgrade with 6 commits [trident-sync]
chore: chore: fix: 修复无法嵌套路由的bug build: publish success build: publish successpull/14/head
parent
adce70a5e5
commit
ed08ef1604
|
@ -3,6 +3,14 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.16.7](https://github.com/fast-crud/fast-crud/compare/v1.16.6...v1.16.7) (2023-08-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @fast-crud/fs-admin-antdv
|
||||||
|
|
||||||
|
## [1.16.6](https://github.com/fast-crud/fast-crud/compare/v1.16.5...v1.16.6) (2023-08-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @fast-crud/fs-admin-antdv
|
||||||
|
|
||||||
## [1.16.5](https://github.com/fast-crud/fast-crud/compare/v1.16.4...v1.16.5) (2023-08-20)
|
## [1.16.5](https://github.com/fast-crud/fast-crud/compare/v1.16.4...v1.16.5) (2023-08-20)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@fast-crud/fs-admin-antdv",
|
"name": "@fast-crud/fs-admin-antdv",
|
||||||
"version": "1.16.5",
|
"version": "1.16.7",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
@ -26,10 +26,10 @@
|
||||||
"@ant-design/icons-vue": "^6.1.0",
|
"@ant-design/icons-vue": "^6.1.0",
|
||||||
"@aws-sdk/client-s3": "^3.383.0",
|
"@aws-sdk/client-s3": "^3.383.0",
|
||||||
"@aws-sdk/s3-request-presigner": "^3.383.0",
|
"@aws-sdk/s3-request-presigner": "^3.383.0",
|
||||||
"@fast-crud/fast-crud": "^1.16.5",
|
"@fast-crud/fast-crud": "^1.16.7",
|
||||||
"@fast-crud/fast-extends": "^1.16.5",
|
"@fast-crud/fast-extends": "^1.16.7",
|
||||||
"@fast-crud/ui-antdv": "^1.16.5",
|
"@fast-crud/ui-antdv": "^1.16.7",
|
||||||
"@fast-crud/ui-interface": "^1.16.5",
|
"@fast-crud/ui-interface": "^1.16.7",
|
||||||
"@iconify/iconify": "^3.1.1",
|
"@iconify/iconify": "^3.1.1",
|
||||||
"@iconify/json": "^2.2.98",
|
"@iconify/json": "^2.2.98",
|
||||||
"@purge-icons/generated": "^0.9.0",
|
"@purge-icons/generated": "^0.9.0",
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { frameworkResource } from "./source/framework";
|
||||||
const modules = import.meta.glob("/src/views/**/*.vue");
|
const modules = import.meta.glob("/src/views/**/*.vue");
|
||||||
|
|
||||||
let index = 0;
|
let index = 0;
|
||||||
function transformOneResource(resource: any) {
|
function transformOneResource(resource: any, parent: any) {
|
||||||
let menu: any = null;
|
let menu: any = null;
|
||||||
if (resource.meta == null) {
|
if (resource.meta == null) {
|
||||||
resource.meta = {};
|
resource.meta = {};
|
||||||
|
@ -21,10 +21,14 @@ function transformOneResource(resource: any) {
|
||||||
} else {
|
} else {
|
||||||
menu = _.cloneDeep(resource);
|
menu = _.cloneDeep(resource);
|
||||||
delete menu.component;
|
delete menu.component;
|
||||||
|
if (menu.path?.startsWith("/")) {
|
||||||
|
menu.fullPath = menu.path;
|
||||||
|
} else {
|
||||||
|
menu.fullPath = (parent?.fullPath || "") + "/" + menu.path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let route;
|
let route;
|
||||||
if (resource.type !== "menu") {
|
if (meta.isRoute === false || resource.path == null || resource.path.startsWith("https://") || resource.path.startsWith("http://")) {
|
||||||
if (resource.path == null || resource.path.startsWith("https://") || resource.path.startsWith("http://")) {
|
|
||||||
//没有route
|
//没有route
|
||||||
route = null;
|
route = null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -36,43 +40,39 @@ function transformOneResource(resource: any) {
|
||||||
if (route.component == null) {
|
if (route.component == null) {
|
||||||
route.component = LayoutPass;
|
route.component = LayoutPass;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
menu,
|
|
||||||
route
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const buildMenusAndRouters = (resources: any) => {
|
|
||||||
const routes: Array<any> = [];
|
|
||||||
const menus: Array<any> = [];
|
|
||||||
for (const item of resources) {
|
|
||||||
const { menu, route } = transformOneResource(item);
|
|
||||||
let menuChildren;
|
|
||||||
let routeChildren;
|
|
||||||
if (item.children) {
|
|
||||||
if (item.children.length > 0) {
|
|
||||||
const ret = buildMenusAndRouters(item.children);
|
|
||||||
menuChildren = ret.menus;
|
|
||||||
routeChildren = ret.routes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (menu) {
|
|
||||||
menus.push(menu);
|
|
||||||
menu.children = menuChildren;
|
|
||||||
}
|
|
||||||
if (route) {
|
|
||||||
if (route?.meta?.cache !== false) {
|
if (route?.meta?.cache !== false) {
|
||||||
if (route.meta == null) {
|
if (route.meta == null) {
|
||||||
route.meta = {};
|
route.meta = {};
|
||||||
}
|
}
|
||||||
route.meta.cache = true;
|
route.meta.cache = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (resource.children) {
|
||||||
|
const { menus, routes } = buildMenusAndRouters(resource.children, resource);
|
||||||
|
if (menu) {
|
||||||
|
menu.children = menus;
|
||||||
|
}
|
||||||
|
if (route) {
|
||||||
|
route.children = routes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
menu,
|
||||||
|
route
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const buildMenusAndRouters = (resources: any, parent: any = null) => {
|
||||||
|
const routes: Array<any> = [];
|
||||||
|
const menus: Array<any> = [];
|
||||||
|
for (const item of resources) {
|
||||||
|
const { menu, route } = transformOneResource(item, parent);
|
||||||
|
|
||||||
|
if (menu) {
|
||||||
|
menus.push(menu);
|
||||||
|
}
|
||||||
|
if (route) {
|
||||||
routes.push(route);
|
routes.push(route);
|
||||||
route.children = routeChildren;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ const outsideRet = buildMenusAndRouters(outsideResource);
|
||||||
const headerRet = buildMenusAndRouters(headerResource);
|
const headerRet = buildMenusAndRouters(headerResource);
|
||||||
|
|
||||||
const outsideRoutes = outsideRet.routes;
|
const outsideRoutes = outsideRet.routes;
|
||||||
const frameworkRoutes = flatSubRouters(frameworkRet.routes);
|
const frameworkRoutes = frameworkRet.routes;
|
||||||
const routes = [...outsideRoutes, ...frameworkRoutes];
|
const routes = [...outsideRoutes, ...frameworkRoutes];
|
||||||
const frameworkMenus = frameworkRet.menus;
|
const frameworkMenus = frameworkRet.menus;
|
||||||
const headerMenus = headerRet.menus;
|
const headerMenus = headerRet.menus;
|
||||||
|
|
|
@ -48,18 +48,18 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
|
||||||
search: {
|
search: {
|
||||||
//控制查询字段顺序
|
//控制查询字段顺序
|
||||||
show: true,
|
show: true,
|
||||||
//字段默认order为100,比100大的放最后面
|
//字段默认order为1,比1大的放最后面
|
||||||
order: 101
|
order: 101
|
||||||
},
|
},
|
||||||
type: "text",
|
type: "text",
|
||||||
column: {
|
column: {
|
||||||
//控制列字段顺序
|
//控制列字段顺序
|
||||||
//字段默认order为100,比100大的放最后面
|
//字段默认order为1,比1大的放最后面
|
||||||
order: 101
|
order: 101
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
//控制表单字段顺序
|
//控制表单字段顺序
|
||||||
//字段默认order为100,比100大的放最后面
|
//字段默认order为1,比1大的放最后面
|
||||||
order: 101
|
order: 101
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue