docs: update docs
This commit is contained in:
parent
e6e84bc345
commit
b7be09efd7
@ -8,95 +8,3 @@ nav:
|
|||||||
---
|
---
|
||||||
|
|
||||||
# 介绍
|
# 介绍
|
||||||
|
|
||||||
NocoBase 核心主要围绕三点:
|
|
||||||
|
|
||||||
- 数据的结构
|
|
||||||
- 数据的行为
|
|
||||||
- 数据的形态
|
|
||||||
|
|
||||||
由此抽象了三类配置协议
|
|
||||||
|
|
||||||
- Collection:用于描述数据的结构和关系
|
|
||||||
- Resourcer:用于描述数据资源和操作方法
|
|
||||||
- UI Schema:用于描述用户界面(组件树结构)
|
|
||||||
|
|
||||||
## Collection
|
|
||||||
|
|
||||||
基于 Sequelize ModelOptions
|
|
||||||
|
|
||||||
```ts
|
|
||||||
{
|
|
||||||
name: 'posts',
|
|
||||||
fields: [
|
|
||||||
{type: 'string', name: 'title'},
|
|
||||||
{type: 'text', name: 'content'},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Resourcer
|
|
||||||
|
|
||||||
基于资源(resource)和操作方法(action)设计,将 REST 和 RPC 思想融合起来
|
|
||||||
|
|
||||||
```ts
|
|
||||||
{
|
|
||||||
name: 'posts',
|
|
||||||
actions: {
|
|
||||||
list: {
|
|
||||||
filter: {}, // 过滤
|
|
||||||
fields: [], // 输出哪些字段
|
|
||||||
sort: '-created_at', // 排序
|
|
||||||
page: 1,
|
|
||||||
perPage: 20,
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
get: {
|
|
||||||
filter: {},
|
|
||||||
fields: [],
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
create: {
|
|
||||||
fields: [],
|
|
||||||
values: {},
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
update: {
|
|
||||||
fields: [],
|
|
||||||
values: {},
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
destroy: {
|
|
||||||
filter: {},
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## UI Schema
|
|
||||||
|
|
||||||
基于 Formily Schema 2.0
|
|
||||||
|
|
||||||
```ts
|
|
||||||
{
|
|
||||||
type: 'object',
|
|
||||||
// 'x-component': 'Form',
|
|
||||||
properties: {
|
|
||||||
title: {
|
|
||||||
type: 'string',
|
|
||||||
title: '标题',
|
|
||||||
'x-component': 'Input',
|
|
||||||
},
|
|
||||||
content: {
|
|
||||||
type: 'string',
|
|
||||||
title: '标题',
|
|
||||||
'x-component': 'Input.TextArea',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
更进一步,构建了整个 NocoBase 架构:
|
|
||||||
|
|
||||||
<img src="https://nocobase.oss-cn-beijing.aliyuncs.com/60ffd9aff98871c643569219c2873749.png" style="max-width: 800px;width:100%"/>
|
|
Binary file not shown.
Before Width: | Height: | Size: 117 KiB |
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: '@nocobase/sdk'
|
title: '@nocobase/sdk'
|
||||||
order: 3
|
order: 5
|
||||||
# toc: menu
|
# toc: menu
|
||||||
---
|
---
|
||||||
|
|
||||||
|
13
docs/cores/packages/ui-schema.md
Normal file
13
docs/cores/packages/ui-schema.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
title: '@nocobase/ui-schema'
|
||||||
|
order: 4
|
||||||
|
---
|
||||||
|
|
||||||
|
# @nocobase/ui-schema <Badge>未实现</Badge>
|
||||||
|
|
||||||
|
v0.5 前端完全重构了,减少了对 umijs 的直接依赖,前端后续会拆分成四部分
|
||||||
|
|
||||||
|
- ui-schema 核心组件库
|
||||||
|
- ui-router 前端路由
|
||||||
|
- sdk 供客户端使用
|
||||||
|
- create-nocobase-app 项目脚手架,基于 umijs
|
@ -7,36 +7,42 @@ nav:
|
|||||||
order: 1
|
order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
## NocoBase 是什么?
|
## Nocude 是什么?
|
||||||
|
|
||||||
NocoBase 是一个开源免费的无代码、低代码开发平台。 无论是不懂编程的业务主管,还是精通编程的开发人员,都可以快速搭建各类定制化、私有部署的协作平台、管理系统。
|
Nocude 是一个开源免费的无代码、低代码开发平台。 无论是不懂编程的业务主管,还是精通编程的开发人员,都可以快速搭建各类定制化、私有部署的协作平台、管理系统。
|
||||||
|
|
||||||
## 架构
|
## 架构
|
||||||
|
|
||||||
<img src="https://nocobase.oss-cn-beijing.aliyuncs.com/60ffd9aff98871c643569219c2873749.png" style="max-width: 800px;width:100%"/>
|
<img src="../nocude.png" style="max-width: 800px;width:100%"/>
|
||||||
|
|
||||||
### 微内核
|
### 微内核
|
||||||
|
|
||||||
NocoBase 采用微内核架构,框架只保留核心的概念,具体各类功能都以插件的形式扩展。各个包可以拆出来单独或组合使用,可用于现有项目中,这也是渐进式框架的意义所在。除此之外,我们也非常注重与现有技术框架融合,做连接现有生态的桥梁,而不是闭门造车。
|
Nocude 采用微内核架构,框架只保留核心的概念,具体各类功能都以插件的形式扩展。各个包可以拆出来单独或组合使用,也可用于现有项目中。
|
||||||
|
|
||||||
### 插件化
|
### 插件化
|
||||||
|
|
||||||
所有的功能需求都通过插件形式扩展,除了现有的几个核心插件以外,开发者还可以自由的扩展,包括但不局限于:
|
所有的功能需求都通过插件形式扩展,除了现有的几个核心插件以外,开发者还可以自由的扩展,包括但不局限于:
|
||||||
|
|
||||||
- Collection - 数据
|
- Collection - 数据表
|
||||||
- Relationship - 相关数据
|
- CollectionField - 字段
|
||||||
- Field - 字段
|
- DataType - 存储类型
|
||||||
- Model - 模型
|
- UI Schema/Component - 组件
|
||||||
- Hook - 触发事件
|
- Template - 模板
|
||||||
- Resource - 资源
|
- Model/Repository - 模型
|
||||||
- Action - 操作方法
|
- Schema Builder - 构造器
|
||||||
- Middleware - 中间件
|
- Resource/Service - 资源/服务
|
||||||
- Block - 区块
|
- Action - 方法
|
||||||
- Page - 页面
|
- Hook/Event - 事件
|
||||||
|
- Middleware - 中间件
|
||||||
|
- Resource Middleware
|
||||||
|
- Action Middleware
|
||||||
|
- UI
|
||||||
|
- UI Schema/Component - 前端组件
|
||||||
|
- Router - 前端路由
|
||||||
|
|
||||||
### 配置化驱动
|
### 配置化
|
||||||
|
|
||||||
配置化是常见的无代码/低代码技术方案,NocoBase 也是基于配置驱动的,为了方便各类配置需求,配置有三类写法:
|
配置化驱动,为了方便各场景配置需求,配置有三种写法:
|
||||||
|
|
||||||
- 直接写在代码里,多用于处理动态配置
|
- 直接写在代码里,多用于处理动态配置
|
||||||
- 保存在文件里,多用于系统表配置或纯开发配置
|
- 保存在文件里,多用于系统表配置或纯开发配置
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 279 KiB |
BIN
docs/nocude.png
Normal file
BIN
docs/nocude.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 302 KiB |
@ -1,56 +0,0 @@
|
|||||||
---
|
|
||||||
title: Blocks - 区块
|
|
||||||
---
|
|
||||||
|
|
||||||
# Blocks - 区块
|
|
||||||
|
|
||||||
## 字段区块
|
|
||||||
|
|
||||||
```ts
|
|
||||||
export default {
|
|
||||||
name: 'examples',
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
name: 'content',
|
|
||||||
interface: 'string',
|
|
||||||
type: 'string',
|
|
||||||
block: {
|
|
||||||
type: 'textarea',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
],
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## 数据表区块
|
|
||||||
|
|
||||||
```ts
|
|
||||||
export default {
|
|
||||||
name: 'examples',
|
|
||||||
blocks: [
|
|
||||||
{
|
|
||||||
type: 'form',
|
|
||||||
name: 'form',
|
|
||||||
title: '表单',
|
|
||||||
fields: ['col1', 'col2'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
```
|
|
||||||
|
|
||||||
## 后台可配置
|
|
||||||
|
|
||||||
```ts
|
|
||||||
export const form = {
|
|
||||||
title: '表单',
|
|
||||||
options: {
|
|
||||||
// form blocks 配置项默认值
|
|
||||||
},
|
|
||||||
properties: {
|
|
||||||
// 需要开放配置的字段
|
|
||||||
},
|
|
||||||
linkages: {
|
|
||||||
// 字段联动
|
|
||||||
},
|
|
||||||
};
|
|
||||||
```
|
|
5
docs/plugins/concepts/collection-fields.md
Normal file
5
docs/plugins/concepts/collection-fields.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: Collection Fields - 数据表字段
|
||||||
|
---
|
||||||
|
|
||||||
|
# Collection Fields - 数据表字段
|
@ -1,117 +0,0 @@
|
|||||||
---
|
|
||||||
title: Fields - 字段
|
|
||||||
---
|
|
||||||
|
|
||||||
# Fields
|
|
||||||
|
|
||||||
一个完整的字段由「数据类型」和「区块类型」两部分参数组合而成。同一个数据类型可能对应多种区块类型,同一个区块类型的数据值也可能是多种数据类型。因此提炼了字段的接口(Interface)作为唯一标识。
|
|
||||||
|
|
||||||
字段的 Types 和 Blocks 就不赘述了,请查阅核心章节介绍
|
|
||||||
|
|
||||||
- [Field Types](/cores/packages/database#field-types)
|
|
||||||
- [Field Blocks](/cores/packages/blocks#fields---字段)
|
|
||||||
|
|
||||||
<Alert title="注意" type="warning">
|
|
||||||
在 NocoBase 里,普通用户概念上的字段类型指的是 interface;field type 只表示数据类型 - data type;field block 是 ui 组件,同一个组件也可能表示多种字段类型(interface)。
|
|
||||||
</Alert>
|
|
||||||
|
|
||||||
## Interfaces - 接口类型
|
|
||||||
|
|
||||||
```ts
|
|
||||||
{
|
|
||||||
// 多行文本框
|
|
||||||
interface: 'textarea',
|
|
||||||
// 长文本类型
|
|
||||||
type: 'text', // 也可以是 string
|
|
||||||
// 使用 多行文本框 区块渲染 UI
|
|
||||||
block: {
|
|
||||||
type: 'textarea',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// 电子邮箱
|
|
||||||
interface: 'email',
|
|
||||||
// 字符串
|
|
||||||
type: 'string',
|
|
||||||
format: 'email',
|
|
||||||
// 使用 String 区块渲染
|
|
||||||
block: {
|
|
||||||
type: 'string',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// 手机号
|
|
||||||
interface: 'phone',
|
|
||||||
// 字符串
|
|
||||||
type: 'string',
|
|
||||||
format: 'phone',
|
|
||||||
// 使用 String 区块渲染
|
|
||||||
block: {
|
|
||||||
type: 'string',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
分类有:
|
|
||||||
|
|
||||||
- basic
|
|
||||||
- media
|
|
||||||
- choices
|
|
||||||
- datetime
|
|
||||||
- relation
|
|
||||||
- systemInfo
|
|
||||||
- developerMode
|
|
||||||
- others
|
|
||||||
|
|
||||||
### basic
|
|
||||||
#### string
|
|
||||||
#### textarea
|
|
||||||
#### phone
|
|
||||||
#### email
|
|
||||||
#### number
|
|
||||||
#### percent
|
|
||||||
|
|
||||||
### media
|
|
||||||
#### markdown
|
|
||||||
#### wysiwyg
|
|
||||||
#### attachment
|
|
||||||
|
|
||||||
### choices
|
|
||||||
#### select
|
|
||||||
#### multipleSelect
|
|
||||||
#### radio
|
|
||||||
#### checkboxes
|
|
||||||
#### boolean
|
|
||||||
#### chinaRegion
|
|
||||||
|
|
||||||
### datetime
|
|
||||||
#### datetime
|
|
||||||
#### time
|
|
||||||
|
|
||||||
### relation
|
|
||||||
#### subTable
|
|
||||||
#### linkTo
|
|
||||||
|
|
||||||
### systemInfo
|
|
||||||
#### createdAt
|
|
||||||
#### createdBy
|
|
||||||
#### updatedAt
|
|
||||||
#### updatedBy
|
|
||||||
|
|
||||||
### developerMode
|
|
||||||
|
|
||||||
#### primaryKey
|
|
||||||
#### sort
|
|
||||||
#### password
|
|
||||||
#### icon
|
|
||||||
#### json
|
|
||||||
|
|
||||||
### Others
|
|
||||||
|
|
||||||
以下字段可能会被遗弃
|
|
||||||
|
|
||||||
#### description
|
|
||||||
#### group
|
|
||||||
#### status
|
|
@ -3,32 +3,3 @@ title: Locales - 国际化
|
|||||||
---
|
---
|
||||||
|
|
||||||
# Locales - 国际化 <Badge>未实现</Badge>
|
# Locales - 国际化 <Badge>未实现</Badge>
|
||||||
|
|
||||||
NocoBase 采用 [formatjs](https://formatjs.io/docs/getting-started/installation) 来处理国际化问题。
|
|
||||||
|
|
||||||
直接写在代码里,详情参考 formatjs 用例,NocoBase 会封装一个更易用的 `__` 函数来处理国际化,如:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
__('Hello, {name}');
|
|
||||||
```
|
|
||||||
|
|
||||||
在配置里有两种写法:
|
|
||||||
|
|
||||||
模板字符串:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
{
|
|
||||||
name: `{{ __('Hello, {name}') }}`
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
json 格式:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
{
|
|
||||||
name: {
|
|
||||||
'zh-CN': '{name},您好',
|
|
||||||
'en-US': 'Hello, {name}',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
5
docs/plugins/concepts/ui-schema.md
Normal file
5
docs/plugins/concepts/ui-schema.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: UI Schema - 组件
|
||||||
|
---
|
||||||
|
|
||||||
|
# UI Schema - 组件
|
5
docs/plugins/packages/china-region.md
Normal file
5
docs/plugins/packages/china-region.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: '@nocobase/plugin-china-region'
|
||||||
|
---
|
||||||
|
|
||||||
|
# @nocobase/plugin-china-region
|
5
docs/plugins/packages/system-settings.md
Normal file
5
docs/plugins/packages/system-settings.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: '@nocobase/plugin-system-settings'
|
||||||
|
---
|
||||||
|
|
||||||
|
# @nocobase/plugin-system-settings
|
5
docs/plugins/packages/ui-router.md
Normal file
5
docs/plugins/packages/ui-router.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: '@nocobase/plugin-ui-router'
|
||||||
|
---
|
||||||
|
|
||||||
|
# @nocobase/plugin-ui-router
|
5
docs/plugins/packages/ui-schema.md
Normal file
5
docs/plugins/packages/ui-schema.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: '@nocobase/plugin-ui-schema'
|
||||||
|
---
|
||||||
|
|
||||||
|
# @nocobase/plugin-ui-schema
|
Loading…
Reference in New Issue
Block a user