Skip to content

Commit 33ed67a

Browse files
JackLianliujuping
authored andcommitted
docs: api文档基础优化
1 parent 56e9f04 commit 33ed67a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2430
-1511
lines changed

docs/config/navbar.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ module.exports = {
3333
position: 'left',
3434
label: 'FAQ',
3535
},
36-
{
37-
type: 'doc',
38-
docId: 'participate/index',
39-
position: 'left',
40-
label: '参与贡献',
41-
},
4236
{
4337
type: 'doc',
4438
docId: 'article/index',
@@ -51,16 +45,6 @@ module.exports = {
5145
position: 'left',
5246
label: 'Demo 使用文档',
5347
},
54-
{
55-
position: 'left',
56-
href: 'https://developer.aliyun.com/ebook/7507',
57-
label: '技术白皮书',
58-
},
59-
{
60-
position: 'left',
61-
href: 'https://github.com/alibaba/lowcode-engine/releases',
62-
label: '更新日志',
63-
},
6448
{
6549
to: '/community/issue',
6650
position: 'left',
@@ -80,6 +64,12 @@ module.exports = {
8064
className: 'header-github-link',
8165
'aria-label': 'GitHub repository',
8266
},
67+
{
68+
type: 'doc',
69+
docId: 'participate/index',
70+
position: 'right',
71+
label: '参与贡献',
72+
},
8373
{
8474
type: 'search',
8575
position: 'right',

docs/config/sidebars.js

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,56 @@ module.exports = {
2222
* 根据当前目录自动生成导航配置
2323
*/
2424
guide: [
25-
{
26-
type: 'autogenerated',
27-
dirName: 'guide', // '.' 即当前的文档文件夹
28-
},
25+
[
26+
{
27+
type: 'category',
28+
label: '入门',
29+
collapsed: false,
30+
items: getDocsFromDir('guide/quickStart'),
31+
},
32+
{
33+
type: 'category',
34+
label: '创建编辑器',
35+
collapsed: false,
36+
items: getDocsFromDir('guide/create'),
37+
},
38+
{
39+
type: 'category',
40+
label: '扩展编辑器',
41+
collapsed: false,
42+
items: getDocsFromDir('guide/expand/editor'),
43+
},
44+
{
45+
type: 'category',
46+
label: '扩展运行时',
47+
collapsed: false,
48+
items: getDocsFromDir('guide/expand/runtime'),
49+
},
50+
{
51+
type: 'category',
52+
label: '设计原理',
53+
collapsed: false,
54+
items: getDocsFromDir('guide/design'),
55+
},
56+
{
57+
type: 'category',
58+
label: '附录',
59+
collapsed: false,
60+
items: [
61+
{
62+
type: 'link',
63+
label: '更新日志',
64+
href: 'https://github.com/alibaba/lowcode-engine/releases',
65+
},
66+
...getDocsFromDir('guide/appendix'),
67+
],
68+
},
69+
{
70+
type: 'link',
71+
label: '技术白皮书',
72+
href: 'https://developer.aliyun.com/ebook/7507',
73+
},
74+
],
2975
],
3076
api: [
3177
{
@@ -57,5 +103,4 @@ module.exports = {
57103
dirName: 'demoUsage',
58104
},
59105
],
60-
// api: getDocsFromDir('api'),
61106
};

docs/docs/api/canvas.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
---
2+
title: cavas - 画布 API
3+
sidebar_position: 12
4+
---
5+
6+
> **@types** [IPublicApiCanvas](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/canvas.ts)<br/>
7+
> **@since** v1.1.0
8+
9+
10+
## 模块简介
11+
12+
通过该模块可以触达对画布拖拽相关的一些能力。
13+
14+
## 变量
15+
16+
### dragon
17+
18+
获取拖拽操作对象的实例
19+
20+
```typescript
21+
/**
22+
* 获取拖拽操作对象的实例
23+
* get dragon instance, you can use this to obtain draging related abilities and lifecycle hooks
24+
* @since v1.1.0
25+
*/
26+
get dragon(): IPublicModelDragon | null;
27+
```
28+
关联模型 [IPublicModelDragon](./model/dragon)
29+
30+
### activeTracker
31+
32+
获取活动追踪器实例
33+
34+
```typescript
35+
/**
36+
* 获取活动追踪器实例
37+
* get activeTracker instance, which is a singleton running in engine.
38+
* it tracks document`s current focusing node/node[], and notify it`s subscribers that when
39+
* focusing node/node[] changed.
40+
* @since v1.1.0
41+
*/
42+
get activeTracker(): IPublicModelActiveTracker | null;
43+
```
44+
45+
## 方法签名
46+
47+
### createLocation
48+
创建一个文档插入位置对象,该对象用来描述一个即将插入的节点在文档中的位置
49+
50+
```typescript
51+
/**
52+
* 创建一个文档插入位置对象,该对象用来描述一个即将插入的节点在文档中的位置
53+
* create a drop location for document, drop location describes a location in document
54+
* @since v1.1.0
55+
*/
56+
createLocation(locationData: IPublicTypeLocationData): IPublicModelDropLocation;
57+
```
58+
59+
### createScroller
60+
创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力,
61+
```typescript
62+
/**
63+
* 创建一个滚动控制器 Scroller,赋予一个视图滚动的基本能力,
64+
* a Scroller is a controller that gives a view (IPublicModelScrollable) the ability scrolling
65+
* to some cordination by api scrollTo.
66+
*
67+
* when a scroller is inited, will need to pass is a scrollable, which has a scrollTarget.
68+
* and when scrollTo(options: { left?: number; top?: number }) is called, scroller will
69+
* move scrollTarget`s top-left corner to (options.left, options.top) that passed in.
70+
* @since v1.1.0
71+
*/
72+
createScroller(scrollable: IPublicModelScrollable): IPublicModelScroller;
73+
74+
```
75+
76+
### createScrollTarget
77+
创建一个 ScrollTarget,与 Scroller 一起发挥作用,详见 [createScroller](#createscroller) 中的描述
78+
79+
```typescript
80+
/**
81+
* 创建一个 ScrollTarget,与 Scroller 一起发挥作用,详见 createScroller 中的描述
82+
* this works with Scroller, refer to createScroller`s description
83+
* @since v1.1.0
84+
*/
85+
createScrollTarget(shell: HTMLDivElement): IPublicModelScrollTarget;
86+
```

docs/docs/api/common.md

Lines changed: 103 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,87 @@
22
title: common - 通用 API
33
sidebar_position: 11
44
---
5-
# 模块简介
6-
通用模块里包含除了 9 大核心模块 API 之外的所有 API,比如通用 utils、面板扩展相关 等。
5+
6+
> **@types** [IPublicApiCommon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts)<br/>
7+
> **@since** v1.0.0
8+
9+
10+
## 模块简介
11+
通用模块里包含除了几大核心模块 API 之外的所有 API,比如通用 utils、面板扩展相关 等。
712
> 高能预警:之所以叫 skeletonCabin / designerCabin 跟兼容上一个版本的引擎有关系。若有必要,后面将用更有意义的命名空间来组织这些 API。
813
9-
# 变量(variables)
10-
### utils
14+
## 变量
15+
#### utils
1116
通用 utils,详见下方方法签名
1217

13-
### designerCabin
14-
设计器扩展相关,详见下方方法签名
18+
相关类型:[IPublicApiCommonUtils](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts)
1519

16-
### skeletonCabin
20+
#### skeletonCabin
1721
面板扩展相关,详见下方方法签名
1822

19-
# 方法签名(functions)
20-
## utils
21-
### isNodeSchema
23+
## 方法签名
24+
### utils
25+
#### isNodeSchema
2226
是否为合法的 schema 结构
2327

24-
### isFormEvent
28+
```typscript
29+
/**
30+
* 是否为合法的 schema 结构
31+
* check if data is valid NodeSchema
32+
*
33+
* @param {*} data
34+
* @returns {boolean}
35+
*/
36+
isNodeSchema(data: any): boolean;
37+
```
38+
39+
#### isFormEvent
2540
是否为表单事件类型
2641

27-
### getNodeSchemaById
42+
```typescript
43+
/**
44+
* 是否为表单事件类型
45+
* check if e is a form event
46+
* @param {(KeyboardEvent | MouseEvent)} e
47+
* @returns {boolean}
48+
*/
49+
isFormEvent(e: KeyboardEvent | MouseEvent): boolean;
50+
```
51+
52+
#### getNodeSchemaById
2853
从 schema 结构中查找指定 id 节点
54+
```typescript
55+
/**
56+
* 从 schema 结构中查找指定 id 节点
57+
* get node schema from a larger schema with node id
58+
* @param {IPublicTypeNodeSchema} schema
59+
* @param {string} nodeId
60+
* @returns {(IPublicTypeNodeSchema | undefined)}
61+
*/
62+
getNodeSchemaById(
63+
schema: IPublicTypeNodeSchema,
64+
nodeId: string,
65+
): IPublicTypeNodeSchema | undefined;
66+
```
67+
相关类型:[IPublicTypeNodeSchema](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/node-schema.ts)
2968

30-
### executeTransaction
69+
#### executeTransaction
3170
批处理事务,用于优化特定场景的性能
32-
*引擎版本 >= 1.0.16
71+
72+
```typescript
73+
/**
74+
* 批处理事务,用于优化特定场景的性能
75+
* excute something in a transaction for performence
76+
*
77+
* @param {() => void} fn
78+
* @param {IPublicEnumTransitionType} type
79+
* @since v1.0.16
80+
*/
81+
executeTransaction(fn: () => void, type: IPublicEnumTransitionType): void;
82+
```
83+
**@since v1.0.16**
84+
85+
##### 示例
3386
```typescript
3487
import { common } from '@alilc/lowcode-engine';
3588
import { IPublicEnumTransitionType } from '@alilc/lowcode-types';
@@ -42,9 +95,33 @@ common.utils.startTransaction(() => {
4295
}, IPublicEnumTransitionType.repaint);
4396
```
4497

45-
### createIntl
98+
#### createIntl
4699
i18n 相关工具
47-
*引擎版本 >= 1.0.17
100+
```typescript
101+
/**
102+
* i18n 相关工具
103+
* i18n tools
104+
*
105+
* @param {(string | object)} instance
106+
* @returns {{
107+
* intlNode(id: string, params?: object): ReactNode;
108+
* intl(id: string, params?: object): string;
109+
* getLocale(): string;
110+
* setLocale(locale: string): void;
111+
* }}
112+
* @since v1.0.17
113+
*/
114+
createIntl(instance: string | object): {
115+
intlNode(id: string, params?: object): ReactNode;
116+
intl(id: string, params?: object): string;
117+
getLocale(): string;
118+
setLocale(locale: string): void;
119+
};
120+
```
121+
122+
**@since v1.0.17**
123+
124+
##### 示例
48125
```typescript
49126
import { common } from '@alilc/lowcode-engine';
50127
import enUS from './en-US.json';
@@ -56,16 +133,15 @@ const { intl, getLocale, setLocale } = common.utils.createIntl({
56133
});
57134

58135
```
59-
## designerCabin
60-
### isSettingField
61-
是否是 SettingField 实例
62-
63-
### TransformStage
64-
转换类型枚举对象,包含 init / upgrade / render 等类型,参考 [TransformStage](https://github.com/alibaba/lowcode-engine/blob/4f4ac5115d18357a7399632860808f6cffc33fad/packages/types/src/transform-stage.ts#L1)
65-
##
66-
## skeletonCabin
67-
### Workbench
136+
137+
### skeletonCabin
138+
#### Workbench
68139
编辑器框架 View
69140

70-
# 事件(events)
71-
141+
```typescript
142+
/**
143+
* 编辑器框架 View
144+
* get Workbench Component
145+
*/
146+
get Workbench(): Component;
147+
```

0 commit comments

Comments
 (0)