@bpmn-nova/studio 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/flow-tree.d.ts +4 -0
- package/dist/flow-tree.js +14 -0
- package/dist/modules/flow-tree/controller.js +364 -0
- package/dist/modules/flow-tree/index.d.ts +248 -0
- package/dist/modules/flow-tree/index.js +5 -0
- package/dist/modules/flow-tree/operations.js +484 -0
- package/dist/modules/flow-tree/sample.js +445 -0
- package/dist/modules/flow-tree/schema.js +588 -0
- package/dist/modules/flow-tree/validate.js +125 -0
- package/dist/modules/flow-tree-bpmn/compiler.js +547 -0
- package/dist/modules/flow-tree-bpmn/decompiler.js +524 -0
- package/dist/modules/flow-tree-bpmn/expression.js +135 -0
- package/dist/modules/flow-tree-bpmn/index.d.ts +53 -0
- package/dist/modules/flow-tree-bpmn/index.js +14 -0
- package/dist/modules/flow-tree-renderer/canvas.js +1003 -0
- package/dist/modules/flow-tree-renderer/export-svg.js +325 -0
- package/dist/modules/flow-tree-renderer/index.d.ts +143 -0
- package/dist/modules/flow-tree-renderer/index.js +3 -0
- package/dist/modules/flow-tree-renderer/shell.js +970 -0
- package/dist/modules/i18n/locales/en-US.js +399 -0
- package/dist/modules/i18n/locales/zh-CN.js +399 -0
- package/dist/modules/icons/index.js +23 -0
- package/dist/modules/properties-flow-tree/index.d.ts +56 -0
- package/dist/modules/properties-flow-tree/index.js +2 -0
- package/dist/modules/properties-flow-tree/panel.js +1136 -0
- package/dist/modules/properties-flow-tree/widgets.js +625 -0
- package/dist/modules/viewer/index.js +10 -2
- package/dist/styles.css +2368 -0
- package/llms-full.txt +353 -9
- package/llms.txt +3 -2
- package/package.json +6 -1
package/llms-full.txt
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
# BPMN Nova integration runbook
|
|
10
10
|
|
|
11
|
-
> BPMN Nova is a framework-neutral BPMN 2.0 design, viewing, approval-trace, theme, and pure SVG export toolkit for Flowable and Activiti applications. The current release is `0.4.
|
|
11
|
+
> BPMN Nova is a framework-neutral BPMN 2.0 design, structured approval-tree (FlowTree), viewing, approval-trace, theme, and pure SVG export toolkit for Flowable and Activiti applications. The current release is `0.4.1`.
|
|
12
12
|
|
|
13
13
|
Use this file as the executable starting point for installing BPMN Nova. Complete the steps in order. Read the co-located `llms-full.txt` only when the selected branch needs advanced customization or complete Interface reference.
|
|
14
14
|
|
|
@@ -32,7 +32,7 @@ This step is complete only when one application root, one framework branch, and
|
|
|
32
32
|
| React, Next.js, or Remix | `@bpmn-nova/react` | React 18 |
|
|
33
33
|
| Another confirmed browser JavaScript/TypeScript stack | `@bpmn-nova/studio` | Node 18 for installation/build |
|
|
34
34
|
|
|
35
|
-
Preserve an already installed public package when it matches the target stack. Do not install historical internal packages such as Core, Designer, Viewer, Runtime, Theme, Export SVG, Properties, or engine profiles. Studio exposes supported `/designer`, `/viewer`, `/runtime`, `/theme`, `/export-svg`, `/flowable`, and `/
|
|
35
|
+
Preserve an already installed public package when it matches the target stack. Do not install historical internal packages such as Core, Designer, Viewer, Runtime, Theme, Export SVG, Properties, or engine profiles. Studio exposes supported `/designer`, `/viewer`, `/runtime`, `/theme`, `/export-svg`, `/flowable`, `/activiti`, and (unreleased) `/flow-tree` subpaths.
|
|
36
36
|
|
|
37
37
|
Install with the application's existing package manager:
|
|
38
38
|
|
|
@@ -70,6 +70,7 @@ Choose the smallest Interface that owns the required experience:
|
|
|
70
70
|
| Embeddable design canvas without the complete workbench | `BpmnDesigner` |
|
|
71
71
|
| Read-only BPMN, approval path, or mobile timeline | `BpmnViewer` |
|
|
72
72
|
| Custom host layout with official Controller, Canvas, Palette, and Properties modules | external Studio Controller plus adapter components/registries |
|
|
73
|
+
| Structured DingTalk/Feishu-style approval tree compiled to Flowable/Activiti BPMN 2.0 XML (unreleased) | `FlowTreeStudio` (Vue/React) or `FlowTreeShell` (`@bpmn-nova/studio/flow-tree`) |
|
|
73
74
|
|
|
74
75
|
Use `engine="flowable"` or `engine="activiti"` explicitly from the host workflow engine. Do not infer the engine from BPMN XML namespace declarations alone.
|
|
75
76
|
|
|
@@ -323,7 +324,7 @@ Before changing Nova package versions, publishing, or recovering a partial relea
|
|
|
323
324
|
- **流程展示**:只读 BPMN、实际审批路径、移动时间线和完整 BPMN 运行态。
|
|
324
325
|
- **嵌入与扩展**:宿主布局、业务属性、节点内容、主题、审批详情及纯 SVG 导出。
|
|
325
326
|
|
|
326
|
-
当前版本为 **`0.4.
|
|
327
|
+
当前版本为 **`0.4.1`**。组件负责建模、展示和交互;流程执行、审批提交及权限由宿主业务系统负责。完整能力与边界见[项目介绍](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/src/guide/overview.md)。
|
|
327
328
|
|
|
328
329
|
## 安装
|
|
329
330
|
|
|
@@ -412,7 +413,7 @@ npm run docs:ai:check
|
|
|
412
413
|
BPMN Nova 提供可嵌入的流程设计器、只读 Viewer、运行态审批轨迹、实例级主题、纯 SVG 导出,以及 React / Vue 适配。项目使用独立的 DOM / SVG 渲染实现,不依赖 `bpmn-js`,并为 Flowable 与 Activiti 提供 XML Profile 和属性扩展。
|
|
413
414
|
|
|
414
415
|
> [!IMPORTANT]
|
|
415
|
-
> 当前版本为 `0.4.
|
|
416
|
+
> 当前版本为 `0.4.1`。组件支持直接通过 npm 安装并嵌入 Vue、React 或原生 JavaScript/TypeScript 项目;在生产接入前请结合业务流程完成目标 BPMN XML 与引擎扩展验证。
|
|
416
417
|
|
|
417
418
|
AI 或代码生成工具接入必须从 [`llms.txt`](https://github.com/daxiangme/bpmn-nova/blob/dev/llms.txt) 的完整安装流程开始;需要全部接口与定制上下文时再读取 [`llms-full.txt`](https://github.com/daxiangme/bpmn-nova/blob/dev/llms-full.txt)。这两份文件也会随三个公开 npm 包发布。
|
|
418
419
|
|
|
@@ -1844,7 +1845,7 @@ export function createAssetResolver(resolveAssetUrl: ResolveAssetUrl): RuntimeAs
|
|
|
1844
1845
|
|
|
1845
1846
|
# BPMN Nova 快速开始
|
|
1846
1847
|
|
|
1847
|
-
本文面向通过 NPM 集成 BPMN Nova 的应用开发者。版本 `0.4.
|
|
1848
|
+
本文面向通过 NPM 集成 BPMN Nova 的应用开发者。版本 `0.4.1` 要求现代浏览器;Node.js 18+ 用于构建、SSR 和开发工具。
|
|
1848
1849
|
|
|
1849
1850
|
## 1. 按语言与框架选择入口
|
|
1850
1851
|
|
|
@@ -2320,7 +2321,7 @@ BPMN Nova 的 Vanilla JavaScript / TypeScript 完整入口,提供流程设计
|
|
|
2320
2321
|
|
|
2321
2322
|
> **English summary:** The complete framework-neutral BPMN Nova package for process design, viewing, approval traces, themes, properties, and pure SVG export.
|
|
2322
2323
|
|
|
2323
|
-
> 当前版本为 `0.4.
|
|
2324
|
+
> 当前版本为 `0.4.1`。在生产接入前请验证目标 BPMN XML 与引擎扩展。
|
|
2324
2325
|
|
|
2325
2326
|

|
|
2326
2327
|
|
|
@@ -2793,7 +2794,7 @@ BPMN Nova 的 Vue 3.3+ Adapter,提供 Studio、Designer、Viewer、审批轨
|
|
|
2793
2794
|
|
|
2794
2795
|
> **English summary:** Vue 3.3+ components and exposed instance methods for BPMN Nova process design, viewing, approval traces, properties, themes, and SVG export.
|
|
2795
2796
|
|
|
2796
|
-
> 当前版本为 `0.4.
|
|
2797
|
+
> 当前版本为 `0.4.1`。Vue 由宿主工程提供,本包不会替应用选择或升级框架版本。
|
|
2797
2798
|
|
|
2798
2799
|

|
|
2799
2800
|
|
|
@@ -3277,7 +3278,7 @@ BPMN Nova 的 React 18+ Adapter,提供 Studio、Designer、Viewer、审批轨
|
|
|
3277
3278
|
|
|
3278
3279
|
> **English summary:** React 18+ components and refs for BPMN Nova process design, viewing, approval traces, properties, themes, and SVG export.
|
|
3279
3280
|
|
|
3280
|
-
> 当前版本为 `0.4.
|
|
3281
|
+
> 当前版本为 `0.4.1`。React 与 React DOM 由宿主工程提供,本包不会替应用选择或升级框架版本。
|
|
3281
3282
|
|
|
3282
3283
|

|
|
3283
3284
|
|
|
@@ -3709,11 +3710,200 @@ Ref 同时暴露 `setLocale(locale?, messages?)` 与 `getLocale()`,根入口
|
|
|
3709
3710
|
Apache-2.0. See [LICENSE](https://github.com/daxiangme/bpmn-nova/blob/dev/packages/react/LICENSE).
|
|
3710
3711
|
|
|
3711
3712
|
|
|
3713
|
+
<!-- SOURCE: docs/src/guide/flow-tree.md -->
|
|
3714
|
+
|
|
3715
|
+
# 审批树设计器(钉钉 / 飞书风)
|
|
3716
|
+
|
|
3717
|
+
> [!NOTE]
|
|
3718
|
+
> **适用版本:自 `0.4.1` 起**。本能力作为独立组件集成在 `@bpmn-nova/studio/flow-tree`、`@bpmn-nova/vue` 和 `@bpmn-nova/react` 中,不改变现有自由画布 `BpmnStudio` 的默认行为。
|
|
3719
|
+
|
|
3720
|
+
`FlowTreeStudio` 提供类似钉钉、飞书的**结构化卡片树**审批流程设计体验:无需手工连线或摆放坐标,通过节点下方的 `+` 按钮即可插入审批、抄送、办理、条件分支、并行分支、包容分支、延迟等待、触发器与子流程,并可一键编译为 **Flowable / Activiti 可执行的标准 BPMN 2.0 XML**。
|
|
3721
|
+
|
|
3722
|
+
## 适用场景与定位
|
|
3723
|
+
|
|
3724
|
+
- **面向业务管理员**:采用单入单出的块树结构(SP-Graph),自动排版、自动汇合,零悬空边与交叉线;
|
|
3725
|
+
- **面向 Flowable / Activiti 后端**:所有 11 类业务节点与可视化条件组均可确定性编译为标准 BPMN 2.0 XML(含多实例会签/或签/依次审批、优先级顺序出边、默认流与 BPMN DI 坐标);
|
|
3726
|
+
- **统一运行态**:编译后的 BPMN 元素保留与审批树卡片一致的稳定节点 ID,同一份 `Runtime Snapshot` 可直接在 **审批树 / BPMN 图 / 垂直审批时间轴** 三种视图之间无缝切换。
|
|
3727
|
+
|
|
3728
|
+
## 全量 11 类内置节点与 BPMN 2.0 映射
|
|
3729
|
+
|
|
3730
|
+
| 节点类型 (`type`) | 业务用途 | 默认编译目标(BPMN 2.0 + Flowable / Activiti) |
|
|
3731
|
+
| --- | --- | --- |
|
|
3732
|
+
| `starter` | 发起人(固定根节点) | 默认编译为 `StartEvent → UserTask(assignee="${initiator}")`(支持驳回重提),也可切换为仅 `StartEvent` |
|
|
3733
|
+
| `approver` | 审批人(9 种选人、会签/或签/依次/按比例、空处理、去重、超时、按钮与表单权限) | `UserTask` + `multiInstanceLoopCharacteristics` + `<nova:nodeConfig>` |
|
|
3734
|
+
| `cc` | 抄送人(固定抄送 / 允许发起人自选) | `ServiceTask`(`nova:nodeKind="cc"`,`delegateExpression="${novaCcDelegate}"`) |
|
|
3735
|
+
| `handler` | 办理人 / 填写人(补充字段或线下办理) | `UserTask`(`nova:nodeKind="handler"`) |
|
|
3736
|
+
| `conditionRoute` | 条件分支(有序优先级 + 末尾锁定默认兜底分支) | 成对 `ExclusiveGateway`(Diverging / Converging)+ 按优先级排序的 `SequenceFlow` 与 `default` |
|
|
3737
|
+
| `parallelRoute` | 并行分支(全部同时执行并汇合) | 成对 `ParallelGateway`(Diverging / Converging) |
|
|
3738
|
+
| `inclusiveRoute` | 包容分支 / 多条件并行 | 成对 `InclusiveGateway`(Diverging / Converging);Activiti 引擎下自动给出兼容性校验提醒 |
|
|
3739
|
+
| `delay` | 延迟等待(相对时长 / 指定日期 / Cron) | `IntermediateCatchEvent` + `timerEventDefinition`(`PT2H` / `P1D` / `timeDate` / `timeCycle`) |
|
|
3740
|
+
| `trigger` | 触发器(HTTP Webhook / Java Class / Delegate / Expression) | `ServiceTask`(含异步、失败重试周期与 Field Injection) |
|
|
3741
|
+
| `subFlow` | 子流程(调用外部流程 / 内嵌子步骤) | `CallActivity`(含输入/输出参数映射)或 `SubProcess` |
|
|
3742
|
+
| `end` | 流程结束(固定尾节点) | `EndEvent` |
|
|
3743
|
+
|
|
3744
|
+
此外,可通过 `customNodes` 或 `createDefaultFlowTreeNodeRegistry()` 注册宿主自定义业务卡片及自定义 BPMN 编译逻辑。
|
|
3745
|
+
|
|
3746
|
+
## 快速接入
|
|
3747
|
+
|
|
3748
|
+
|
|
3749
|
+
**Vue**
|
|
3750
|
+
|
|
3751
|
+
```vue
|
|
3752
|
+
<script setup>
|
|
3753
|
+
import { ref } from 'vue';
|
|
3754
|
+
import {
|
|
3755
|
+
FlowTreeStudio,
|
|
3756
|
+
createSampleFlowTree,
|
|
3757
|
+
createSampleFlowTreeDataProviders,
|
|
3758
|
+
createSampleFlowTreeRuntime,
|
|
3759
|
+
} from '@bpmn-nova/vue';
|
|
3760
|
+
import '@bpmn-nova/vue/styles.css';
|
|
3761
|
+
|
|
3762
|
+
const studioRef = ref(null);
|
|
3763
|
+
const initialDoc = createSampleFlowTree('flowable');
|
|
3764
|
+
const dataProviders = createSampleFlowTreeDataProviders();
|
|
3765
|
+
const runtime = createSampleFlowTreeRuntime(initialDoc);
|
|
3766
|
+
|
|
3767
|
+
function handleChange({ exportXml }) {
|
|
3768
|
+
const bpmnXml = exportXml('flowable');
|
|
3769
|
+
console.log('Compiled BPMN 2.0 XML length:', bpmnXml.length);
|
|
3770
|
+
}
|
|
3771
|
+
</script>
|
|
3772
|
+
|
|
3773
|
+
<template>
|
|
3774
|
+
<div style="height: 680px">
|
|
3775
|
+
<FlowTreeStudio
|
|
3776
|
+
ref="studioRef"
|
|
3777
|
+
:document="initialDoc"
|
|
3778
|
+
engine="flowable"
|
|
3779
|
+
:data-providers="dataProviders"
|
|
3780
|
+
:runtime="runtime"
|
|
3781
|
+
@change="handleChange"
|
|
3782
|
+
/>
|
|
3783
|
+
</div>
|
|
3784
|
+
</template>
|
|
3785
|
+
```
|
|
3786
|
+
|
|
3787
|
+
**React**
|
|
3788
|
+
|
|
3789
|
+
```jsx
|
|
3790
|
+
import { useRef } from 'react';
|
|
3791
|
+
import {
|
|
3792
|
+
FlowTreeStudio,
|
|
3793
|
+
createSampleFlowTree,
|
|
3794
|
+
createSampleFlowTreeDataProviders,
|
|
3795
|
+
createSampleFlowTreeRuntime,
|
|
3796
|
+
} from '@bpmn-nova/react';
|
|
3797
|
+
import '@bpmn-nova/react/styles.css';
|
|
3798
|
+
|
|
3799
|
+
const initialDoc = createSampleFlowTree('flowable');
|
|
3800
|
+
const dataProviders = createSampleFlowTreeDataProviders();
|
|
3801
|
+
const runtime = createSampleFlowTreeRuntime(initialDoc);
|
|
3802
|
+
|
|
3803
|
+
export default function ApprovalFlowPage() {
|
|
3804
|
+
const studioRef = useRef(null);
|
|
3805
|
+
|
|
3806
|
+
return (
|
|
3807
|
+
<div style={{ height: 680 }}>
|
|
3808
|
+
<FlowTreeStudio
|
|
3809
|
+
ref={studioRef}
|
|
3810
|
+
document={initialDoc}
|
|
3811
|
+
engine="flowable"
|
|
3812
|
+
dataProviders={dataProviders}
|
|
3813
|
+
runtime={runtime}
|
|
3814
|
+
onChange={({ exportXml }) => {
|
|
3815
|
+
const bpmnXml = exportXml('flowable');
|
|
3816
|
+
console.log('Compiled BPMN 2.0 XML length:', bpmnXml.length);
|
|
3817
|
+
}}
|
|
3818
|
+
/>
|
|
3819
|
+
</div>
|
|
3820
|
+
);
|
|
3821
|
+
}
|
|
3822
|
+
```
|
|
3823
|
+
|
|
3824
|
+
**JavaScript**
|
|
3825
|
+
|
|
3826
|
+
```js
|
|
3827
|
+
import {
|
|
3828
|
+
FlowTreeShell,
|
|
3829
|
+
createFlowTreeController,
|
|
3830
|
+
createSampleFlowTree,
|
|
3831
|
+
createSampleFlowTreeDataProviders,
|
|
3832
|
+
createSampleFlowTreeRuntime,
|
|
3833
|
+
} from '@bpmn-nova/studio/flow-tree';
|
|
3834
|
+
|
|
3835
|
+
export function mountFlowTreeExample(container, theme = 'light') {
|
|
3836
|
+
const document = createSampleFlowTree('flowable');
|
|
3837
|
+
const controller = createFlowTreeController({ document });
|
|
3838
|
+
const shell = new FlowTreeShell({
|
|
3839
|
+
container,
|
|
3840
|
+
controller,
|
|
3841
|
+
mode: 'design',
|
|
3842
|
+
runtime: createSampleFlowTreeRuntime(document),
|
|
3843
|
+
dataProviders: createSampleFlowTreeDataProviders(),
|
|
3844
|
+
theme: { mode: theme },
|
|
3845
|
+
rightWidth: 336,
|
|
3846
|
+
});
|
|
3847
|
+
|
|
3848
|
+
return {
|
|
3849
|
+
controller,
|
|
3850
|
+
shell,
|
|
3851
|
+
destroy() {
|
|
3852
|
+
shell.destroy();
|
|
3853
|
+
controller.destroy();
|
|
3854
|
+
},
|
|
3855
|
+
};
|
|
3856
|
+
}
|
|
3857
|
+
```
|
|
3858
|
+
|
|
3859
|
+
|
|
3860
|
+
## 宿主业务数据接入(`dataProviders`)
|
|
3861
|
+
|
|
3862
|
+
审批人、角色、部门、表单字段 Schema 与外部子流程列表均通过 `dataProviders` 注入,支持同步返回或 `Promise` 异步检索;未配置时自动降级为自由输入,开箱即可使用:
|
|
3863
|
+
|
|
3864
|
+
```ts
|
|
3865
|
+
const dataProviders = {
|
|
3866
|
+
users: { search: (query) => api.searchUsers(query) },
|
|
3867
|
+
roles: { list: (query) => api.listRoles(query) },
|
|
3868
|
+
departments: { list: (query) => api.listDepartments(query) },
|
|
3869
|
+
formFields: { list: () => api.getFormFieldSchema(formId) },
|
|
3870
|
+
subProcesses: { list: (query) => api.listSubProcesses(query) },
|
|
3871
|
+
};
|
|
3872
|
+
```
|
|
3873
|
+
|
|
3874
|
+
## BPMN 2.0 编译与反编译
|
|
3875
|
+
|
|
3876
|
+
```js
|
|
3877
|
+
import {
|
|
3878
|
+
compileFlowTreeToBpmn,
|
|
3879
|
+
exportFlowTreeBpmnXml,
|
|
3880
|
+
decompileBpmnToFlowTree,
|
|
3881
|
+
createSampleFlowTree,
|
|
3882
|
+
} from '@bpmn-nova/studio/flow-tree';
|
|
3883
|
+
|
|
3884
|
+
const doc = createSampleFlowTree('flowable');
|
|
3885
|
+
// 1. 编译为 ProcessModel 或直接导出可执行 BPMN 2.0 XML
|
|
3886
|
+
const bpmnModel = compileFlowTreeToBpmn(doc, { engine: 'flowable' });
|
|
3887
|
+
const xml = exportFlowTreeBpmnXml(doc, 'flowable');
|
|
3888
|
+
|
|
3889
|
+
// 2. 反编译回 FlowTree(L1 无损回显 / L2 通用块结构归约)
|
|
3890
|
+
const result = decompileBpmnToFlowTree(xml, 'flowable');
|
|
3891
|
+
if (result.compatible) {
|
|
3892
|
+
console.log(result.restorationLevel, result.document);
|
|
3893
|
+
} else {
|
|
3894
|
+
console.warn('包含非树形自由拓扑:', result.diagnostics);
|
|
3895
|
+
}
|
|
3896
|
+
```
|
|
3897
|
+
|
|
3898
|
+
- 审批增强配置(选人策略、空处理、去重、按钮权限、表单权限矩阵、可视化条件组)保存在自定义命名空间 `xmlns:nova="urn:bpmn-nova:approval"` 下的 `<nova:nodeConfig>` 与 `<nova:flowTreeMeta>` 中,不影响 Flowable / Activiti 原生引擎属性解析。
|
|
3899
|
+
- 需要体验交互式画布、可视化条件构造器、表单权限矩阵与实时 XML 编译预览,请前往[审批树设计器示例](../examples/flow-tree)。
|
|
3900
|
+
|
|
3901
|
+
|
|
3712
3902
|
<!-- SOURCE: docs/src/components/index.md -->
|
|
3713
3903
|
|
|
3714
3904
|
# BPMN Nova 组件参数
|
|
3715
3905
|
|
|
3716
|
-
本手册记录 `0.4.
|
|
3906
|
+
本手册记录 `0.4.1` 的公开组件参数、回调和实例方法。所有视觉组件都需要具有实际尺寸的容器,并显式导入所属包的 `styles.css`。
|
|
3717
3907
|
|
|
3718
3908
|
## 在线体验
|
|
3719
3909
|
|
|
@@ -4086,6 +4276,20 @@ interface PropertyComponentProps {
|
|
|
4086
4276
|
|
|
4087
4277
|
Runtime Details、Timeline 和 Transition Details 组件通过对应 `createReact*Component()` / `createVue*Component()` 适配器注册。完整上下文见类型声明和[自定义指南](../customization/index.md)。
|
|
4088
4278
|
|
|
4279
|
+
## FlowTree 审批树组件(自 0.4.1 起)
|
|
4280
|
+
|
|
4281
|
+
面向钉钉 / 飞书式结构化审批流设计的独立组件族,由 `@bpmn-nova/studio/flow-tree`、`@bpmn-nova/vue` 和 `@bpmn-nova/react` 导出,与自由画布 `BpmnStudio` 相互独立:
|
|
4282
|
+
|
|
4283
|
+
| 组件 / 入口 | 适用包 | 说明 |
|
|
4284
|
+
| --- | --- | --- |
|
|
4285
|
+
| `FlowTreeShell` / `createFlowTreeController` | `@bpmn-nova/studio/flow-tree` | Vanilla JS 完整审批树工作台与控制器 |
|
|
4286
|
+
| `FlowTreeStudio` / `useFlowTree` | `@bpmn-nova/vue`、`@bpmn-nova/react` | 开箱即用的审批树工作台(含三态模式、BPMN 图与时间轴视图、内置完整业务属性面板、XML 预览与 SVG 导出) |
|
|
4287
|
+
| `FlowTreeCanvas` | `@bpmn-nova/studio/flow-tree`、`@bpmn-nova/vue`、`@bpmn-nova/react` | 独立树形画布(支持缩放平移、`+` 插入、分支优先级排序、子树折叠、拖拽移动与运行态叠加) |
|
|
4288
|
+
| `FlowTreePropertiesPanel` | `@bpmn-nova/studio/flow-tree`、`@bpmn-nova/vue`、`@bpmn-nova/react` | 独立内置业务属性面板(审批策略、可视化条件规则构造器、表单字段权限矩阵、按钮/延迟/触发器/子流程配置) |
|
|
4289
|
+
|
|
4290
|
+
- `FlowTreeStudio` 支持 `header` / `headerStart`(Vue `#header-start`)/ `headerActions`(Vue `#header-actions`)/ `right` 原生插槽,宿主可用自定义抽屉或企业组织架构选人器局部或整体接管配置面板。
|
|
4291
|
+
- 完整接入指南见[审批树设计器](../guide/flow-tree.md)。
|
|
4292
|
+
|
|
4089
4293
|
|
|
4090
4294
|
<!-- SOURCE: docs/src/api/index.md -->
|
|
4091
4295
|
|
|
@@ -5153,6 +5357,16 @@ shell.setConfig({
|
|
|
5153
5357
|
- **边界值与兜底**:`instant.kind === 'missing'` 直接返回 `''` 且不调用 `formatRuntimeTime`;`invalid` 与 `naive` 会继续透传给 `formatRuntimeTime` 由宿主决定兜底文案;自定义回调抛错或返回非字符串时,回退默认格式(`raw.trim().replace('T', ' ')`)并在开发模式仅告警一次。
|
|
5154
5358
|
- **不破坏语义**:`parseRuntimeInstant()` 仍按绝对时间戳(`ms`)参与排序与回退失效判定;运行中调用 `setDisplayOptions()` / `setConfig()` / `refreshPresentation()` 仅刷新时间展示,保留视口、滚动位置和已打开详情。
|
|
5155
5359
|
|
|
5360
|
+
## FlowTree 审批树子路径 API(自 0.4.1 起)
|
|
5361
|
+
|
|
5362
|
+
子路径入口:`@bpmn-nova/studio/flow-tree`(Vue / React 包已直接 re-export 同名核心函数与组件)。
|
|
5363
|
+
|
|
5364
|
+
- **模型与控制器**:`createFlowTreeController(options)`、`createEmptyFlowTree(engine)`、`createSampleFlowTree(engine)`、`createSampleFlowTreeRuntime(doc)`、`createSampleFlowTreeDataProviders()`、`createDefaultFlowTreeNodeRegistry(customNodes)`、`validateFlowTree(doc)`、`formatFlowTreeNodeSummary(node)`。
|
|
5365
|
+
- **BPMN 2.0 编译与反编译**:`compileFlowTreeToBpmn(doc, options)`、`exportFlowTreeBpmnXml(doc, engine, options)`、`decompileBpmnToFlowTree(modelOrXml, engineHint, options)`、`compileConditionGroups(groups, options)`、`compileBranchCondition(branch, options)`、`createFlowTreeBpmnCompiler(defaultOptions)`。
|
|
5366
|
+
- **可视化与导出**:`FlowTreeShell`、`FlowTreeCanvas`、`FlowTreePropertiesPanel`、`exportFlowTreeSvg(context, options)`。
|
|
5367
|
+
|
|
5368
|
+
详细节点字段与编译规则见[审批树设计器指南](../guide/flow-tree.md)。
|
|
5369
|
+
|
|
5156
5370
|
|
|
5157
5371
|
<!-- SOURCE: docs/src/customization/index.md -->
|
|
5158
5372
|
|
|
@@ -6614,6 +6828,135 @@ export function createApprovalProcess({ complete = true } = {}) {
|
|
|
6614
6828
|
- [宿主布局定制](../customization/)
|
|
6615
6829
|
|
|
6616
6830
|
|
|
6831
|
+
<!-- SOURCE: docs/src/examples/flow-tree.md -->
|
|
6832
|
+
|
|
6833
|
+
# 审批树设计器
|
|
6834
|
+
|
|
6835
|
+
> [!NOTE]
|
|
6836
|
+
> **适用版本:自 `0.4.1` 起**。
|
|
6837
|
+
|
|
6838
|
+
体验钉钉 / 飞书风格的结构化审批流设计器:点击节点下方 `+` 号插入全量 11 类业务节点,拖动卡片到其他 `+` 槽位重排,点击条件分支编辑可视化规则组,点击审批节点配置会签/或签与表单字段权限矩阵,并可在顶部一键查看编译后的 **Flowable / Activiti BPMN 2.0 XML** 或切换至 **审批轨迹(审批树 / BPMN 图 / 垂直时间轴)**。
|
|
6839
|
+
|
|
6840
|
+
|
|
6841
|
+
## 示例挂载源码
|
|
6842
|
+
|
|
6843
|
+
本页画布与下方代码共用同一份示例源码:
|
|
6844
|
+
|
|
6845
|
+
```js
|
|
6846
|
+
import {
|
|
6847
|
+
FlowTreeShell,
|
|
6848
|
+
createFlowTreeController,
|
|
6849
|
+
createSampleFlowTree,
|
|
6850
|
+
createSampleFlowTreeDataProviders,
|
|
6851
|
+
createSampleFlowTreeRuntime,
|
|
6852
|
+
} from '@bpmn-nova/studio/flow-tree';
|
|
6853
|
+
|
|
6854
|
+
export function mountFlowTreeExample(container, theme = 'light') {
|
|
6855
|
+
const document = createSampleFlowTree('flowable');
|
|
6856
|
+
const controller = createFlowTreeController({ document });
|
|
6857
|
+
const shell = new FlowTreeShell({
|
|
6858
|
+
container,
|
|
6859
|
+
controller,
|
|
6860
|
+
mode: 'design',
|
|
6861
|
+
runtime: createSampleFlowTreeRuntime(document),
|
|
6862
|
+
dataProviders: createSampleFlowTreeDataProviders(),
|
|
6863
|
+
theme: { mode: theme },
|
|
6864
|
+
rightWidth: 336,
|
|
6865
|
+
});
|
|
6866
|
+
|
|
6867
|
+
return {
|
|
6868
|
+
controller,
|
|
6869
|
+
shell,
|
|
6870
|
+
destroy() {
|
|
6871
|
+
shell.destroy();
|
|
6872
|
+
controller.destroy();
|
|
6873
|
+
},
|
|
6874
|
+
};
|
|
6875
|
+
}
|
|
6876
|
+
```
|
|
6877
|
+
|
|
6878
|
+
## 在 Vue / React 中使用
|
|
6879
|
+
|
|
6880
|
+
|
|
6881
|
+
**Vue**
|
|
6882
|
+
|
|
6883
|
+
```vue
|
|
6884
|
+
<script setup>
|
|
6885
|
+
import { ref } from 'vue';
|
|
6886
|
+
import {
|
|
6887
|
+
FlowTreeStudio,
|
|
6888
|
+
createSampleFlowTree,
|
|
6889
|
+
createSampleFlowTreeDataProviders,
|
|
6890
|
+
createSampleFlowTreeRuntime,
|
|
6891
|
+
} from '@bpmn-nova/vue';
|
|
6892
|
+
import '@bpmn-nova/vue/styles.css';
|
|
6893
|
+
|
|
6894
|
+
const studioRef = ref(null);
|
|
6895
|
+
const initialDoc = createSampleFlowTree('flowable');
|
|
6896
|
+
const dataProviders = createSampleFlowTreeDataProviders();
|
|
6897
|
+
const runtime = createSampleFlowTreeRuntime(initialDoc);
|
|
6898
|
+
|
|
6899
|
+
function handleChange({ exportXml }) {
|
|
6900
|
+
const bpmnXml = exportXml('flowable');
|
|
6901
|
+
console.log('Compiled BPMN 2.0 XML length:', bpmnXml.length);
|
|
6902
|
+
}
|
|
6903
|
+
</script>
|
|
6904
|
+
|
|
6905
|
+
<template>
|
|
6906
|
+
<div style="height: 680px">
|
|
6907
|
+
<FlowTreeStudio
|
|
6908
|
+
ref="studioRef"
|
|
6909
|
+
:document="initialDoc"
|
|
6910
|
+
engine="flowable"
|
|
6911
|
+
:data-providers="dataProviders"
|
|
6912
|
+
:runtime="runtime"
|
|
6913
|
+
@change="handleChange"
|
|
6914
|
+
/>
|
|
6915
|
+
</div>
|
|
6916
|
+
</template>
|
|
6917
|
+
```
|
|
6918
|
+
|
|
6919
|
+
**React**
|
|
6920
|
+
|
|
6921
|
+
```jsx
|
|
6922
|
+
import { useRef } from 'react';
|
|
6923
|
+
import {
|
|
6924
|
+
FlowTreeStudio,
|
|
6925
|
+
createSampleFlowTree,
|
|
6926
|
+
createSampleFlowTreeDataProviders,
|
|
6927
|
+
createSampleFlowTreeRuntime,
|
|
6928
|
+
} from '@bpmn-nova/react';
|
|
6929
|
+
import '@bpmn-nova/react/styles.css';
|
|
6930
|
+
|
|
6931
|
+
const initialDoc = createSampleFlowTree('flowable');
|
|
6932
|
+
const dataProviders = createSampleFlowTreeDataProviders();
|
|
6933
|
+
const runtime = createSampleFlowTreeRuntime(initialDoc);
|
|
6934
|
+
|
|
6935
|
+
export default function ApprovalFlowPage() {
|
|
6936
|
+
const studioRef = useRef(null);
|
|
6937
|
+
|
|
6938
|
+
return (
|
|
6939
|
+
<div style={{ height: 680 }}>
|
|
6940
|
+
<FlowTreeStudio
|
|
6941
|
+
ref={studioRef}
|
|
6942
|
+
document={initialDoc}
|
|
6943
|
+
engine="flowable"
|
|
6944
|
+
dataProviders={dataProviders}
|
|
6945
|
+
runtime={runtime}
|
|
6946
|
+
onChange={({ exportXml }) => {
|
|
6947
|
+
const bpmnXml = exportXml('flowable');
|
|
6948
|
+
console.log('Compiled BPMN 2.0 XML length:', bpmnXml.length);
|
|
6949
|
+
}}
|
|
6950
|
+
/>
|
|
6951
|
+
</div>
|
|
6952
|
+
);
|
|
6953
|
+
}
|
|
6954
|
+
```
|
|
6955
|
+
|
|
6956
|
+
|
|
6957
|
+
进一步了解 BPMN 2.0 节点映射、条件编译与宿主业务数据接入,请参阅[审批树设计器指南](../guide/flow-tree)。
|
|
6958
|
+
|
|
6959
|
+
|
|
6617
6960
|
<!-- SOURCE: docs/src/examples/index.md -->
|
|
6618
6961
|
|
|
6619
6962
|
# 在真实画布上,试一试
|
|
@@ -6623,6 +6966,7 @@ export function createApprovalProcess({ complete = true } = {}) {
|
|
|
6623
6966
|
| 示例 | 可以体验什么 |
|
|
6624
6967
|
| --- | --- |
|
|
6625
6968
|
| [流程设计](./designer) | 拖动、添加、连线与 XML 导出 |
|
|
6969
|
+
| [审批树设计器](./flow-tree) | 钉钉 / 飞书风卡片树、可视化条件与权限矩阵、编译 BPMN 2.0 XML(自 `0.4.1` 起) |
|
|
6626
6970
|
| [审批运行态](./runtime) | 已完成节点、当前审批人与流程进度 |
|
|
6627
6971
|
| [宿主嵌入](./embedded) | 隐藏默认区域,用自己的页面承载画布 |
|
|
6628
6972
|
| [自定义属性](./properties) | 为审批节点加入业务策略 |
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# BPMN Nova integration runbook
|
|
2
2
|
|
|
3
|
-
> BPMN Nova is a framework-neutral BPMN 2.0 design, viewing, approval-trace, theme, and pure SVG export toolkit for Flowable and Activiti applications. The current release is `0.4.
|
|
3
|
+
> BPMN Nova is a framework-neutral BPMN 2.0 design, structured approval-tree (FlowTree), viewing, approval-trace, theme, and pure SVG export toolkit for Flowable and Activiti applications. The current release is `0.4.1`.
|
|
4
4
|
|
|
5
5
|
Use this file as the executable starting point for installing BPMN Nova. Complete the steps in order. Read the co-located `llms-full.txt` only when the selected branch needs advanced customization or complete Interface reference.
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ This step is complete only when one application root, one framework branch, and
|
|
|
24
24
|
| React, Next.js, or Remix | `@bpmn-nova/react` | React 18 |
|
|
25
25
|
| Another confirmed browser JavaScript/TypeScript stack | `@bpmn-nova/studio` | Node 18 for installation/build |
|
|
26
26
|
|
|
27
|
-
Preserve an already installed public package when it matches the target stack. Do not install historical internal packages such as Core, Designer, Viewer, Runtime, Theme, Export SVG, Properties, or engine profiles. Studio exposes supported `/designer`, `/viewer`, `/runtime`, `/theme`, `/export-svg`, `/flowable`, and `/
|
|
27
|
+
Preserve an already installed public package when it matches the target stack. Do not install historical internal packages such as Core, Designer, Viewer, Runtime, Theme, Export SVG, Properties, or engine profiles. Studio exposes supported `/designer`, `/viewer`, `/runtime`, `/theme`, `/export-svg`, `/flowable`, `/activiti`, and (unreleased) `/flow-tree` subpaths.
|
|
28
28
|
|
|
29
29
|
Install with the application's existing package manager:
|
|
30
30
|
|
|
@@ -62,6 +62,7 @@ Choose the smallest Interface that owns the required experience:
|
|
|
62
62
|
| Embeddable design canvas without the complete workbench | `BpmnDesigner` |
|
|
63
63
|
| Read-only BPMN, approval path, or mobile timeline | `BpmnViewer` |
|
|
64
64
|
| Custom host layout with official Controller, Canvas, Palette, and Properties modules | external Studio Controller plus adapter components/registries |
|
|
65
|
+
| Structured DingTalk/Feishu-style approval tree compiled to Flowable/Activiti BPMN 2.0 XML (unreleased) | `FlowTreeStudio` (Vue/React) or `FlowTreeShell` (`@bpmn-nova/studio/flow-tree`) |
|
|
65
66
|
|
|
66
67
|
Use `engine="flowable"` or `engine="activiti"` explicitly from the host workflow engine. Do not infer the engine from BPMN XML namespace declarations alone.
|
|
67
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-nova/studio",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Complete BPMN Nova Studio with Designer, Viewer, Palette, Properties and runtime visualization.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bpmn",
|
|
@@ -57,6 +57,11 @@
|
|
|
57
57
|
"import": "./dist/modules/engine-activiti/index.js",
|
|
58
58
|
"default": "./dist/modules/engine-activiti/index.js"
|
|
59
59
|
},
|
|
60
|
+
"./flow-tree": {
|
|
61
|
+
"types": "./dist/flow-tree.d.ts",
|
|
62
|
+
"import": "./dist/flow-tree.js",
|
|
63
|
+
"default": "./dist/flow-tree.js"
|
|
64
|
+
},
|
|
60
65
|
"./styles.css": "./dist/styles.css"
|
|
61
66
|
},
|
|
62
67
|
"files": [
|