From e3a5dc73b7409ae651fd74d863530b38f2eff418 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 21 Apr 2021 23:05:10 +0800 Subject: [PATCH] docs: update docs --- docs/cores/packages/client.md | 194 ++++++++++++++++++++++++--- docs/cores/packages/migrator.md | 2 +- docs/plugins/packages/action-logs.md | 1 + docs/plugins/packages/automations.md | 1 + docs/plugins/packages/collections.md | 1 + docs/plugins/packages/pages.md | 1 + docs/plugins/packages/permissions.md | 1 + 7 files changed, 185 insertions(+), 16 deletions(-) diff --git a/docs/cores/packages/client.md b/docs/cores/packages/client.md index 0ae28f8f18..e5fe3b26e7 100644 --- a/docs/cores/packages/client.md +++ b/docs/cores/packages/client.md @@ -7,15 +7,29 @@ order: 6 ## 介绍 -### 路由 +提供适配 Ant Design 组件的 NocoBase 客户端。 -和众多框架类似,NocoBase 也提供了路由,可以根据 URL 找到对应的页面。为了适应无代码需求,NocoBase 提供了一套由服务端配置的 routes 表,routes 是一个大杂烩,如以下例子: + + +@nocobase/client 可以用于任意 React 框架中,不过还存在许多难点和细节未解决。 + + + +## Loaders + +### TemplateLoader 待完善 + +- routes:路由表,大杂烩。类型包括:layout、page、redirect、url、menuGroup,**页面就是 type=page 的 route** +- templates:模板 +- pathname:URL 路径 + +为了适应无代码需求,提供了一种 URL 和 Template 映射规则,如以下例子: ```ts -[ +const routes = [ { type: 'layout', - name: 'auth', // 因为 /login、/register 没有统一的前缀,所以这里没有配置 path + name: 'auth', // 因为 /login、/register 没有统一的前缀,所以这里没有配置 path template: 'AuthLayout', // 用于处理 login、register 等页面的布局 children: [ { @@ -35,7 +49,7 @@ order: 6 ] }, { - type: 'layout', + type: 'layout', name: 'admin', path: '/admin', // /admin 下的任意 uri 都转到这里 template: 'AdminLoader', @@ -44,7 +58,7 @@ order: 6 // 通过解析 /admin/:name,找到对应子页面 // 「菜单和页面配置」就是这部分的内容 children: [ - { + { type: 'page', name: 'welcome', template: 'BlockLoader', @@ -52,7 +66,7 @@ order: 6 blocks: [], }, { - type: 'url', + type: 'url', url: 'https://www.nocobase.com/', title: 'xxx', }, @@ -68,25 +82,175 @@ order: 6 path: '/', redirect: '/admin', }, -] +]; ``` -route 类型包括:layout、page、redirect、url、menuGroup,页面就是 type=page 的 route +
+
+
-NocoBase 会内置几种常用的 template 用于处理特定页面渲染,如果有特殊需求还可以自行扩展。 +### BlockLoader 未实现 -### 页面和区块 +区块驱动器。 -我们又进一步提炼了页面内部的各个块元素,抽象出 block(区块)的概念,就可以类似以下例子来配置页面和区块了。 +### AdminLoader 待完善 + +一种 top/left 菜单结构的 Admin 布局。菜单由其对应的 children 组成,通过 `/admin/:name` 映射到对应子页面,「菜单和页面配置」就是这部分的内容。 + +### ShareLoader 未实现 + +分享模块,细节待补充 + +## Blocks + +将页面内部的各个块元素进行提炼,抽象了 block(区块)的概念。 + +### Grid - 布局 ```ts { - type: 'page', + type: 'grid', + span: 12, blocks: [ { - type: 'table', - } + col: 1, + order: 1, + }, + { + col: 2, + order: 1, + }, + { + col: 1, + order: 2, + }, ], } ``` +### Descriptions - 详情 + +```ts +{ + type: 'descriptions', + fields: [], + actions: [], +} +``` + +### Form - 表单 + +```ts +{ + type: 'form', + fields: [], + // 表单提交反馈信息,细节待定 + returnType, + redirect, + message, +} +``` + +### Table - 表单 + +```ts +{ + type: 'table', + defaultPerPage: 20, + draggable: false, + filter: {}, + sort: [], + detailsOpenMode: 'drawer', + actions: [], + fields: [], + details: [], + labelField, +} +``` + +### Calendar - 日历 + +```ts +{ + type: 'calendar', + filter: {}, + detailsOpenMode: 'drawer', + actions: [], + details: [], + labelField, +} +``` + +### Kanban - 看板 + +```ts +{ + type: 'kanban', + groupField, + labelField, + fields, + filter, + actions, + detailsOpenMode, + details, +} +``` + +### Markdown + +```ts +{ + type: 'markdown', + content: '', +} +``` + +## Actions + +操作按钮 + +### create - 新增 + +### update - 编辑 + +### destroy - 删除 + +### filter - 筛选 + +### print - 打印 + +### export - 导出 + +## Fields + +字段控件 + +### boolean +### cascader +### checkbox +### checkboxes +### colorSelect +### date +### drawerSelect +### filter +### icon +### markdown +### number +### password +### percent +### radio +### remoteSelect +### string +### select +### subTable +### textarea +### time +### upload diff --git a/docs/cores/packages/migrator.md b/docs/cores/packages/migrator.md index a3a955bddf..4765564470 100644 --- a/docs/cores/packages/migrator.md +++ b/docs/cores/packages/migrator.md @@ -4,7 +4,7 @@ order: 8 # toc: menu --- -# @nocobase/migrate 未实现 +# @nocobase/migrator 未实现 NocoBase 的 Database 是基于 Sequelize,Sequelize 虽然提供了 sequelize-cli,包括 migrations 和 seeders 但是并不适用于 NocoBase。 diff --git a/docs/plugins/packages/action-logs.md b/docs/plugins/packages/action-logs.md index 9dbbc5eb77..7cd512e3e3 100644 --- a/docs/plugins/packages/action-logs.md +++ b/docs/plugins/packages/action-logs.md @@ -1,5 +1,6 @@ --- title: '@nocobase/plugin-action-logs' +order: 5 group: order: 3 title: 官方插件 diff --git a/docs/plugins/packages/automations.md b/docs/plugins/packages/automations.md index a70243b1aa..16b081d50a 100644 --- a/docs/plugins/packages/automations.md +++ b/docs/plugins/packages/automations.md @@ -1,5 +1,6 @@ --- title: '@nocobase/plugin-automations' +order: 4 --- # @nocobase/plugin-automations diff --git a/docs/plugins/packages/collections.md b/docs/plugins/packages/collections.md index d18b6e5202..5e07cab88c 100644 --- a/docs/plugins/packages/collections.md +++ b/docs/plugins/packages/collections.md @@ -1,5 +1,6 @@ --- title: '@nocobase/plugin-collections' +order: 1 --- # @nocobase/plugin-collections diff --git a/docs/plugins/packages/pages.md b/docs/plugins/packages/pages.md index e932819e9b..af8b2df2a4 100644 --- a/docs/plugins/packages/pages.md +++ b/docs/plugins/packages/pages.md @@ -1,5 +1,6 @@ --- title: '@nocobase/plugin-pages' +order: 1 --- # @nocobase/plugin-pages diff --git a/docs/plugins/packages/permissions.md b/docs/plugins/packages/permissions.md index 3afcd681fb..b868a64e58 100644 --- a/docs/plugins/packages/permissions.md +++ b/docs/plugins/packages/permissions.md @@ -1,5 +1,6 @@ --- title: '@nocobase/plugin-permissions' +order: 1 --- # @nocobase/plugin-permissions