mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-08 23:19:26 +08:00
* create-nocobase-app template from [develop] * change create-nocobase-app package.json config * feat: load configuration from directory * feat: configuration repository toObject * feat: create application from configuration dir * feat: application factory with plugins options * export type * feat: read application config & application with plugins options * feat: release command * fix: database release * chore: workflow package.json * feat: nocobase cli package * feat: console command * chore: load application in command * fix: load packages from process.cwd * feat: cli load env file * feat: create-nocobase-app * fix: gitignore create-nocobase-app lib * fix: sqlite path * feat: create plugin * chore: plugin files template * chore: move cli into application * chore: create-nocobase-app * fix: create plugin * chore: app-client && app-server * chore: package.json * feat: create-nocobase-app download template from npm * chore: create-nocobase-app template * fix: config of plugin-users * fix: yarn.lock * fix: database build error * fix: yarn.lock * fix: resourcer config * chore: cross-env * chore: app-client dependents * fix: env * chore: v0.6.0-alpha.1 * chore: verdaccio * chore(versions): 😊 publish v0.6.0 * chore(versions): 😊 publish v0.6.1-alpha.0 * chore(versions): 😊 publish v0.6.2-alpha.0 * chore(versions): 😊 publish v0.6.2-alpha.1 * chore: 0.6.2-alpha.2 * feat: workspaces * chore(versions): 😊 publish v0.6.2-alpha.3 * chore(versions): 😊 publish v0.6.2-alpha.4 * chore: create-nocobase-app * chore: create-nocobase-app lib * fix: update tsconfig.jest.json * chore: .env * chore(versions): 😊 publish v0.6.2-alpha.5 * chore(versions): 😊 publish v0.6.2-alpha.6 * feat: improve code * chore(versions): 😊 publish v0.6.2-alpha.7 * fix: cleanup * chore(versions): 😊 publish v0.6.2-alpha.8 * chore: tsconfig for app server package * fix: move files * fix: move files Co-authored-by: chenos <chenlinxh@gmail.com>
3.1 KiB
3.1 KiB
nav, group
nav | group | ||||
---|---|---|---|---|---|
|
|
SchemaComponent
Components
SchemaComponentProvider
<SchemaComponentProvider>
<SchemaComponent schema={{}}/>
</SchemaComponentProvider>
SchemaComponentOptions
提供 SchemaComponent 所需的 scope 和 components,可以嵌套,当 inherit={true}
时,继承父级的 scope 和 components。
<SchemaComponentOptions scope={{}} components={{}}>
</SchemaComponentOptions>
<SchemaComponentOptions scope={{}} components={{}}>
{/* 继承父级的 scope 和 components */}
<SchemaComponentOptions inherit scope={{}} components={{}}>
</SchemaComponentOptions>
</SchemaComponentOptions>
例如将 useTranslation 的 t 附加给 scope
import { useTranslation } from 'react-i18next';
function TranslationProvider(props) {
const { t } = useTranslation();
return (
<SchemaComponentOptions inherit scope={{ t }}>
{ props.children }
</SchemaComponentOptions>
);
}
SchemaComponent
Hooks
useSchemaComponentContext()
获取 SchemaComponent 的上下文
const { refresh, reset } = useSchemaComponentContext();
useDesignable()
获取当前 schema 节点设计器的 API
const {
designable, // 是否可以配置
patch, // 更新当前节点配置
remove, // 移除当前节点
insertAdjacent, // 在某位置插入,四个位置:beforeBegin、afterBegin、beforeEnd、afterEnd
insertBeforeBegin, // 在当前节点的前面插入
insertAfterBegin, // 在当前节点的第一个子节点前面插入
insertBeforeEnd, // 在当前节点的最后一个子节点后面
insertAfterEnd, // 在当前节点的后面
} = useDesignable();
const schema = {
name: uid(),
'x-component': 'Hello',
};
// 在当前节点的前面插入
insertBeforeBegin(schema);
// 等同于
insertAdjacent('beforeBegin', schema);
// 在当前节点的第一个子节点前面插入
insertAfterBegin(schema);
// 等同于
insertAdjacent('afterBegin', schema);
// 在当前节点的最后一个子节点后面
insertBeforeEnd(schema);
// 等同于
insertAdjacent('beforeEnd', schema);
// 在当前节点的后面
insertAfterEnd(schema);
// 等同于
insertAdjacent('afterEnd', schema);
几个插入的位置:
{
properties: {
// beforeBegin 在当前节点的前面插入
node1: {
properties: {
// afterBegin 在当前节点的第一个子节点前面插入
// ...
// beforeEnd 在当前节点的最后一个子节点后面
},
},
// afterEnd 在当前节点的后面
},
}
扩展的 Formily Schema 属性
x-uid
可缺失,前端无感。主要用于插件plugin-ui-schema-storage
,用于后端 schema 的增删改查x-designer
schema 设计器x-initializer
schema 初始化器x-collection-field
用来标记 CollectionFieldx-action
用来标记 Actionx-align
ActionBar 里用于 action 的布局,包括left
和right
Examples