-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add product launch flow graph demo (#2727)
* refactor: extract node style calculation into a common function * feat: add product activation flow graph demo * docs: add demo * refactor: rename
- Loading branch information
Showing
8 changed files
with
521 additions
and
64 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
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,28 @@ | ||
import { memoize } from 'lodash'; | ||
import { measureTextSize } from './measure-text'; | ||
|
||
export const getLinearTextNodeStyle = memoize( | ||
(text: string, minWidth: number, maxWidth: number, depth: number = 0) => { | ||
const font = { | ||
fontWeight: 'bold', | ||
fontSize: depth === 0 ? 20 : 16, | ||
fontFamily: 'PingFang SC', | ||
}; | ||
const offset = depth === 0 ? [24, 36] : [12, 12]; | ||
const size = measureTextSize(text, offset, font, minWidth, maxWidth); | ||
return { font, size }; | ||
}, | ||
); | ||
|
||
export const getBoxedTextNodeStyle = memoize( | ||
(text: string, minWidth: number, maxWidth: number, depth: number = 0) => { | ||
const font = { | ||
fontWeight: 'bold', | ||
fontSize: depth === 0 ? 20 : depth === 1 ? 18 : 16, | ||
fontFamily: 'PingFang SC', | ||
}; | ||
const offset = depth === 0 ? [24, 36] : [12, 24]; | ||
const size = measureTextSize(text, offset, font, minWidth, maxWidth); | ||
return { font, size }; | ||
}, | ||
); |
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,56 @@ | ||
{ | ||
"nodes": [ | ||
{ | ||
"id": "start", | ||
"data": { "name": "流程开始" } | ||
}, | ||
{ | ||
"id": "submit-agreement", | ||
"data": { "name": "提交协议", "elapsed_time": "11秒" } | ||
}, | ||
{ | ||
"id": "contract-review", | ||
"data": { | ||
"name": "合约审核", | ||
"elapsed_time": "1.63分", | ||
"status": "running", | ||
"children": [ | ||
{ "name": "风控审核", "elapsed_time": "39秒" }, | ||
{ "name": "财务审核", "elapsed_time": "0秒" }, | ||
{ "name": "法务审核", "elapsed_time": "0秒" }, | ||
{ "name": "销售初评", "elapsed_time": "0秒" }, | ||
{ "name": "主管审核", "elapsed_time": "0秒" }, | ||
{ "name": "销售终审", "elapsed_time": "0秒" } | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "merchant-confirmation", | ||
"data": { "name": "商户确认", "elapsed_time": "0秒" } | ||
}, | ||
{ | ||
"id": "end", | ||
"data": { "name": "流程结束" } | ||
} | ||
], | ||
"edges": [ | ||
{ | ||
"source": "start", | ||
"target": "submit-agreement" | ||
}, | ||
{ | ||
"source": "submit-agreement", | ||
"target": "contract-review", | ||
"data": { "elapsed_time": "11秒" } | ||
}, | ||
{ | ||
"source": "contract-review", | ||
"target": "merchant-confirmation", | ||
"data": { "elapsed_time": "0秒" } | ||
}, | ||
{ | ||
"source": "merchant-confirmation", | ||
"target": "end" | ||
} | ||
] | ||
} |
Oops, something went wrong.