🔱: [client] sync upgrade with 6 commits [trident-sync]

chore:
chore:
fix: 修复无法嵌套路由的bug
build: publish success
build: publish success
pull/14/head
GitHub Actions Bot 2023-08-21 19:24:03 +00:00
parent adce70a5e5
commit ed08ef1604
4 changed files with 52 additions and 44 deletions

View File

@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
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)
### Bug Fixes

View File

@ -1,6 +1,6 @@
{
"name": "@fast-crud/fs-admin-antdv",
"version": "1.16.5",
"version": "1.16.7",
"private": true,
"scripts": {
"dev": "vite",
@ -26,10 +26,10 @@
"@ant-design/icons-vue": "^6.1.0",
"@aws-sdk/client-s3": "^3.383.0",
"@aws-sdk/s3-request-presigner": "^3.383.0",
"@fast-crud/fast-crud": "^1.16.5",
"@fast-crud/fast-extends": "^1.16.5",
"@fast-crud/ui-antdv": "^1.16.5",
"@fast-crud/ui-interface": "^1.16.5",
"@fast-crud/fast-crud": "^1.16.7",
"@fast-crud/fast-extends": "^1.16.7",
"@fast-crud/ui-antdv": "^1.16.7",
"@fast-crud/ui-interface": "^1.16.7",
"@iconify/iconify": "^3.1.1",
"@iconify/json": "^2.2.98",
"@purge-icons/generated": "^0.9.0",

View File

@ -6,7 +6,7 @@ import { frameworkResource } from "./source/framework";
const modules = import.meta.glob("/src/views/**/*.vue");
let index = 0;
function transformOneResource(resource: any) {
function transformOneResource(resource: any, parent: any) {
let menu: any = null;
if (resource.meta == null) {
resource.meta = {};
@ -21,58 +21,58 @@ function transformOneResource(resource: any) {
} else {
menu = _.cloneDeep(resource);
delete menu.component;
}
let route;
if (resource.type !== "menu") {
if (resource.path == null || resource.path.startsWith("https://") || resource.path.startsWith("http://")) {
//没有route
route = null;
if (menu.path?.startsWith("/")) {
menu.fullPath = menu.path;
} else {
route = _.cloneDeep(resource);
if (route.component && typeof route.component === "string") {
const path = "/src/views" + route.component;
route.component = modules[path];
}
if (route.component == null) {
route.component = LayoutPass;
}
menu.fullPath = (parent?.fullPath || "") + "/" + menu.path;
}
}
let route;
if (meta.isRoute === false || resource.path == null || resource.path.startsWith("https://") || resource.path.startsWith("http://")) {
//没有route
route = null;
} else {
route = _.cloneDeep(resource);
if (route.component && typeof route.component === "string") {
const path = "/src/views" + route.component;
route.component = modules[path];
}
if (route.component == null) {
route.component = LayoutPass;
}
if (route?.meta?.cache !== false) {
if (route.meta == null) {
route.meta = {};
}
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) => {
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);
let menuChildren;
let routeChildren;
if (item.children) {
if (item.children.length > 0) {
const ret = buildMenusAndRouters(item.children);
menuChildren = ret.menus;
routeChildren = ret.routes;
}
}
const { menu, route } = transformOneResource(item, parent);
if (menu) {
menus.push(menu);
menu.children = menuChildren;
}
if (route) {
if (route?.meta?.cache !== false) {
if (route.meta == null) {
route.meta = {};
}
route.meta.cache = true;
}
routes.push(route);
route.children = routeChildren;
}
}
@ -147,7 +147,7 @@ const outsideRet = buildMenusAndRouters(outsideResource);
const headerRet = buildMenusAndRouters(headerResource);
const outsideRoutes = outsideRet.routes;
const frameworkRoutes = flatSubRouters(frameworkRet.routes);
const frameworkRoutes = frameworkRet.routes;
const routes = [...outsideRoutes, ...frameworkRoutes];
const frameworkMenus = frameworkRet.menus;
const headerMenus = headerRet.menus;

View File

@ -48,18 +48,18 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
search: {
//控制查询字段顺序
show: true,
//字段默认order为100比100大的放最后面
//字段默认order为1比1大的放最后面
order: 101
},
type: "text",
column: {
//控制列字段顺序
//字段默认order为100比100大的放最后面
//字段默认order为1比1大的放最后面
order: 101
},
form: {
//控制表单字段顺序
//字段默认order为100比100大的放最后面
//字段默认order为1比1大的放最后面
order: 101
}
},