-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 解决 git config core.ignorecase 为 true 导致修改文件夹名大小写不生效的问题
- 重命名 BPMN -> bpmn; Control -> control - 命名规范:文件夹名小写(name or name1-name2-name3);.js or .ts 小驼峰;.tsx or .jsx 大驼峰 - 新增 Vue3-memory-leak demo 用于定位内存泄漏的问题,后续基于此 demo 增加 LogicFlow destroy 的方法 - 优化 properties 类型定义为 Record<string, any>,避免 unknow 引起的问题,后续再优化 - 解决 graph demo 中发现 BezierEdge 初始化 path 为空的问题,可以看 -> BezierEdgeModel.ts 的改动
- Loading branch information
1 parent
4802f1e
commit f9ea036
Showing
72 changed files
with
3,907 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
# developer tips | ||
|
||
## Start | ||
|
||
我们选用 fork 仓库,然后提交 PR 的形式进行开发。 | ||
|
||
### clone 自己 fork 后的仓库 | ||
|
||
```shell | ||
git clone <your forked repository> | ||
``` | ||
|
||
### 安装项目依赖 | ||
|
||
> 需要提前安装 yarn | ||
```shell | ||
npm run bootstrap | ||
``` | ||
|
||
### 构建 types 并打包 | ||
|
||
LF 使用 monorepo 的形式进行管理,各个 package 之间存在依赖关系,所以需要先构建一次类型和源码才能进行开发。 | ||
|
||
```shell | ||
npm run build:types | ||
|
||
npm run build | ||
``` | ||
|
||
### 启动本地开发 | ||
|
||
开发 core 包 | ||
|
||
```shell | ||
cd packages/core | ||
npm run dev | ||
|
||
# 或跳过以上“构建部分”直接运行 | ||
npm run dev:core | ||
``` | ||
|
||
开发 extension | ||
|
||
```shell | ||
cd packages/extension | ||
npm run dev | ||
|
||
# 或跳过以上“构建部分”直接运行 | ||
npm run dev:extension | ||
``` | ||
|
||
### 项目配置修改 | ||
|
||
windows 和 mac 平台的换行不一致,windows 下是 CRLF,mac 下是 LF,因此 windows 系统下需要修改 eslint 规则: | ||
(如果 widows 配置了转换为 LF,此条不适用) | ||
|
||
```js | ||
{ | ||
rules: { | ||
'linebreak-style': ['error', 'unix'], | ||
// ... | ||
} | ||
} | ||
|
||
// 改为 | ||
{ | ||
rules: { | ||
'linebreak-style': ['error', process.env.NODE_ENV === 'production' ? 'unix' : 'windows'], | ||
// ... | ||
} | ||
} | ||
``` | ||
|
||
## Publish | ||
|
||
### clone 源码仓库 | ||
|
||
```shell | ||
git clone [email protected]:didi/LogicFlow.git | ||
``` | ||
|
||
### 源码打包 | ||
|
||
```shell | ||
# 安装依赖 | ||
npm run bootstrap | ||
|
||
# 构建 types | ||
npm run build:types | ||
|
||
# 打包 | ||
npm run build | ||
``` | ||
|
||
### 更改 npm 官方源 | ||
|
||
```shell | ||
npm config set registry https://registry.npmjs.org/ | ||
``` | ||
|
||
### 本地登陆 npm | ||
|
||
```shell | ||
npm login | ||
|
||
# 查看是否已经登陆 | ||
npm whoami | ||
``` | ||
|
||
### 为项目添加 tags | ||
|
||
```shell | ||
lerna version patch | ||
``` | ||
|
||
lerna version 的详细使用方式见[这里](https://github.com/lerna/lerna/tree/main/libs/commands/version#readme) | ||
|
||
### 发布版本 | ||
|
||
```shell | ||
npm run lerna:publish | ||
``` | ||
|
||
### 推 tag 到远端 | ||
|
||
```shell | ||
git push origin --tags | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
examples/engine-browser-examples/src/pages/graph/nodes/ReactNode.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import ReactDOM from 'react-dom/client' | ||
import { ColorPicker, Space, Tooltip } from 'antd' | ||
import { CheckCircleTwoTone } from '@ant-design/icons' | ||
import { HtmlNode, HtmlNodeModel } from '@logicflow/core' | ||
|
||
export class CustomReactNodeModel extends HtmlNodeModel { | ||
createId() { | ||
return Math.random() + '_react_node' | ||
} | ||
|
||
setAttributes() { | ||
const width = 200 | ||
const height = 130 | ||
this.width = width | ||
this.height = height | ||
this.textHeight = 60 | ||
this.text = { | ||
...this.text, | ||
y: this.y - this.height / 2, | ||
} | ||
|
||
this.anchorsOffset = [ | ||
{ | ||
x: width / 2, | ||
y: 0, | ||
isSourceAnchor: false, | ||
isTargetAnchor: true, | ||
}, | ||
] | ||
// this.anchorsOffset = [ | ||
// [width / 2, 0], | ||
// [0, height / 2], | ||
// [-width / 2, 0], | ||
// [0, -height / 2], | ||
// ] | ||
} | ||
} | ||
|
||
export class CustomReactNode extends HtmlNode { | ||
setHtml(rootEl: SVGForeignObjectElement) { | ||
const { properties } = this.props.model | ||
console.log('properties', properties) | ||
|
||
const el = document.createElement('div') | ||
el.className = 'custom-react-node-wrapper' | ||
ReactDOM.createRoot(el).render( | ||
<Space direction="vertical"> | ||
<CheckCircleTwoTone twoToneColor="#52c41a" style={{ fontSize: 40 }} /> | ||
<ColorPicker defaultValue="#1677ff" size="large" showText /> | ||
<Tooltip title="prompt text"> | ||
<span>Show Tooltip</span> | ||
</Tooltip> | ||
</Space>, | ||
) | ||
rootEl.appendChild(el) | ||
} | ||
} | ||
|
||
export default { | ||
type: 'custom-react-node', | ||
view: CustomReactNode, | ||
model: CustomReactNodeModel, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.