@bpmn-nova/studio 0.3.9-preview → 0.4.0
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 +2 -2
- package/dist/canvas.js +97 -25
- package/dist/config.js +13 -0
- package/dist/context-menu.js +41 -32
- package/dist/controller.js +45 -19
- package/dist/index.d.ts +47 -2
- package/dist/index.js +1 -0
- package/dist/interactions.js +6 -1
- package/dist/modules/bpmn-model/index.d.ts +2 -1
- package/dist/modules/bpmn-model/index.js +12 -10
- package/dist/modules/core/gateway.js +16 -13
- package/dist/modules/core/index.d.ts +6 -4
- package/dist/modules/core/model.js +12 -7
- package/dist/modules/designer/index.d.ts +5 -1
- package/dist/modules/designer/index.js +36 -15
- package/dist/modules/export-svg/index.d.ts +12 -5
- package/dist/modules/export-svg/preview.js +34 -24
- package/dist/modules/export-svg/render.js +102 -50
- package/dist/modules/i18n/index.d.ts +647 -0
- package/dist/modules/i18n/index.js +247 -0
- package/dist/modules/i18n/locales/en-US.js +823 -0
- package/dist/modules/i18n/locales/zh-CN.js +805 -0
- package/dist/modules/node-presentation/index.d.ts +3 -2
- package/dist/modules/node-presentation/index.js +14 -11
- package/dist/modules/palette/index.d.ts +6 -1
- package/dist/modules/palette/index.js +26 -8
- package/dist/modules/palette/panel.js +44 -6
- package/dist/modules/properties/index.d.ts +2 -1
- package/dist/modules/properties/index.js +2 -2
- package/dist/modules/properties-activiti/index.js +84 -59
- package/dist/modules/properties-bpmn/index.js +151 -128
- package/dist/modules/properties-core/index.d.ts +9 -3
- package/dist/modules/properties-core/index.js +16 -4
- package/dist/modules/properties-flowable/index.js +55 -34
- package/dist/modules/properties-renderer/index.d.ts +5 -1
- package/dist/modules/properties-renderer/index.js +110 -42
- package/dist/modules/renderer-svg/index.d.ts +6 -2
- package/dist/modules/renderer-svg/index.js +113 -38
- package/dist/modules/runtime/index.d.ts +33 -5
- package/dist/modules/runtime/index.js +97 -73
- package/dist/modules/runtime/time.js +89 -4
- package/dist/modules/runtime/visits.js +6 -4
- package/dist/modules/theme/index.d.ts +5 -2
- package/dist/modules/theme/index.js +8 -4
- package/dist/modules/viewer/index.d.ts +28 -7
- package/dist/modules/viewer/index.js +213 -56
- package/dist/modules/viewer/runtime-content.js +26 -20
- package/dist/modules/viewer/runtime-trace.js +43 -25
- package/dist/modules/viewer/timeline.js +103 -36
- package/dist/shell.js +258 -75
- package/dist/sidebars.js +3 -1
- package/dist/styles.css +3 -2
- package/llms-full.txt +241 -46
- package/llms.txt +4 -4
- package/package.json +2 -3
package/dist/sidebars.js
CHANGED
|
@@ -160,7 +160,9 @@ export class StudioSidebars {
|
|
|
160
160
|
panel.hidden = state[side].hidden;
|
|
161
161
|
button.hidden = buttonHidden;
|
|
162
162
|
button.setAttribute('aria-expanded', String(!state[side].collapsed));
|
|
163
|
-
const label =
|
|
163
|
+
const label = this.shell._t
|
|
164
|
+
? this.shell._t('shell.sidebar.toggle', { collapsed: state[side].collapsed, side })
|
|
165
|
+
: `${state[side].collapsed ? '展开' : '收起'}${side === 'left' ? '左侧节点面板' : '右侧面板'}`;
|
|
164
166
|
button.setAttribute('aria-label', label);
|
|
165
167
|
button.title = label;
|
|
166
168
|
button.textContent = (side === 'left') !== state[side].collapsed ? '‹' : '›';
|
package/dist/styles.css
CHANGED
|
@@ -926,8 +926,9 @@ button.mb-runtime-action-summary:hover, button.mb-runtime-action-summary:focus-v
|
|
|
926
926
|
.mb-runtime-asset-preview-state { color: var(--nova-color-text-muted, #7f899a); font-size: var(--nova-font-size-sm, 12px); }
|
|
927
927
|
|
|
928
928
|
/* Runtime timeline projection */
|
|
929
|
-
.mb-runtime-timeline-host { position: relative; width: 100%; height: 100%; min-height: 0; overflow
|
|
930
|
-
.mb-runtime-timeline-
|
|
929
|
+
.mb-runtime-timeline-host { position: relative; width: 100%; height: 100%; min-height: 0; overflow: hidden; background: var(--nova-color-surface-subtle, #f7f8fb); color: var(--mb-text); font-family: var(--nova-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif); }
|
|
930
|
+
.mb-runtime-timeline-scroll { width: 100%; height: 100%; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--nova-color-border-strong, #d9dee7) transparent; }
|
|
931
|
+
.mb-runtime-timeline-scroll::-webkit-scrollbar { width: 4px; }.mb-runtime-timeline-scroll::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--nova-color-border-strong, #d9dee7); }
|
|
931
932
|
.mb-runtime-timeline { width: 100%; min-height: 100%; box-sizing: border-box; margin: 0; padding: 18px 16px 40px; background: var(--nova-color-surface, #fff); }
|
|
932
933
|
.mb-runtime-timeline-header { display: grid; gap: 2px; padding: 0 0 16px; border-bottom: 1px solid var(--nova-color-divider, #edf0f5); }
|
|
933
934
|
.mb-runtime-timeline-header strong { font-size: var(--nova-font-size-lg, 16px); line-height: 22px; font-weight: var(--nova-font-weight-bold, 700); }.mb-runtime-timeline-header span { color: var(--mb-muted); font-size: var(--nova-font-size-sm, 12px); line-height: 18px; }
|
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
|
|
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.0`.
|
|
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
|
|
|
@@ -37,9 +37,9 @@ Preserve an already installed public package when it matches the target stack. D
|
|
|
37
37
|
Install with the application's existing package manager:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install @bpmn-nova/vue
|
|
41
|
-
pnpm add @bpmn-nova/vue
|
|
42
|
-
yarn add @bpmn-nova/vue
|
|
40
|
+
npm install @bpmn-nova/vue
|
|
41
|
+
pnpm add @bpmn-nova/vue
|
|
42
|
+
yarn add @bpmn-nova/vue
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Replace `vue` with `react` or `studio` only when the selected framework branch requires it. Run one installation command, not all three.
|
|
@@ -323,7 +323,7 @@ Before changing Nova package versions, publishing, or recovering a partial relea
|
|
|
323
323
|
- **流程展示**:只读 BPMN、实际审批路径、移动时间线和完整 BPMN 运行态。
|
|
324
324
|
- **嵌入与扩展**:宿主布局、业务属性、节点内容、主题、审批详情及纯 SVG 导出。
|
|
325
325
|
|
|
326
|
-
当前版本为 **`0.
|
|
326
|
+
当前版本为 **`0.4.0`**。组件负责建模、展示和交互;流程执行、审批提交及权限由宿主业务系统负责。完整能力与边界见[项目介绍](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/src/guide/overview.md)。
|
|
327
327
|
|
|
328
328
|
## 安装
|
|
329
329
|
|
|
@@ -331,9 +331,9 @@ Before changing Nova package versions, publishing, or recovering a partial relea
|
|
|
331
331
|
|
|
332
332
|
| 技术栈 | 安装命令 | 接入指南 |
|
|
333
333
|
| --- | --- | --- |
|
|
334
|
-
| JavaScript / TypeScript | `npm install @bpmn-nova/studio
|
|
335
|
-
| React 18+ | `npm install @bpmn-nova/react
|
|
336
|
-
| Vue 3.3+ | `npm install @bpmn-nova/vue
|
|
334
|
+
| JavaScript / TypeScript | `npm install @bpmn-nova/studio` | [Studio](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/src/guide/studio.md) |
|
|
335
|
+
| React 18+ | `npm install @bpmn-nova/react` | [React](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/src/guide/react.md) |
|
|
336
|
+
| Vue 3.3+ | `npm install @bpmn-nova/vue` | [Vue](https://github.com/daxiangme/bpmn-nova/blob/dev/docs/src/guide/vue.md) |
|
|
337
337
|
|
|
338
338
|
所有包提供 ESM 与 TypeScript 声明。React / Vue 会自动依赖匹配版本的 Studio;公共类型也从所选框架包导入,无需额外安装内部包。
|
|
339
339
|
|
|
@@ -412,7 +412,7 @@ npm run docs:ai:check
|
|
|
412
412
|
BPMN Nova 提供可嵌入的流程设计器、只读 Viewer、运行态审批轨迹、实例级主题、纯 SVG 导出,以及 React / Vue 适配。项目使用独立的 DOM / SVG 渲染实现,不依赖 `bpmn-js`,并为 Flowable 与 Activiti 提供 XML Profile 和属性扩展。
|
|
413
413
|
|
|
414
414
|
> [!IMPORTANT]
|
|
415
|
-
> 当前版本为 `0.
|
|
415
|
+
> 当前版本为 `0.4.0`。组件支持直接通过 npm 安装并嵌入 Vue、React 或原生 JavaScript/TypeScript 项目;在生产接入前请结合业务流程完成目标 BPMN XML 与引擎扩展验证。
|
|
416
416
|
|
|
417
417
|
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
418
|
|
|
@@ -558,9 +558,9 @@ BPMN Nova 不负责:
|
|
|
558
558
|
|
|
559
559
|
| 宿主 | 安装命令 | 选择规则 |
|
|
560
560
|
| --- | --- | --- |
|
|
561
|
-
| React 18+、Next.js、Remix 等 React 应用 | `npm install @bpmn-nova/react
|
|
562
|
-
| Vue 3.3+、Nuxt 等 Vue 应用 | `npm install @bpmn-nova/vue
|
|
563
|
-
| 已确认的其他 JavaScript / TypeScript Web 项目 | `npm install @bpmn-nova/studio
|
|
561
|
+
| React 18+、Next.js、Remix 等 React 应用 | `npm install @bpmn-nova/react` | 使用 React 组件、Hook 和 Ref |
|
|
562
|
+
| Vue 3.3+、Nuxt 等 Vue 应用 | `npm install @bpmn-nova/vue` | 使用 Vue 组件、Composable 和 Expose |
|
|
563
|
+
| 已确认的其他 JavaScript / TypeScript Web 项目 | `npm install @bpmn-nova/studio` | 使用框架无关 Interface |
|
|
564
564
|
|
|
565
565
|
已经安装三个公开包之一且与目标技术栈匹配时,沿用现有入口。React 和 Vue 同时存在但无法确定目标应用时先询问用户。`@bpmn-nova/core`、`designer`、`viewer`、`runtime`、`theme`、`export-svg`、`properties` 等历史入口不参与选择;这些能力已经收进 Studio,并通过根入口或受支持子路径提供。
|
|
566
566
|
|
|
@@ -689,7 +689,7 @@ viewer.destroy()
|
|
|
689
689
|
## 3. React 18+
|
|
690
690
|
|
|
691
691
|
```bash
|
|
692
|
-
npm install @bpmn-nova/react
|
|
692
|
+
npm install @bpmn-nova/react
|
|
693
693
|
```
|
|
694
694
|
|
|
695
695
|
```jsx
|
|
@@ -731,7 +731,7 @@ export function WorkflowEditor({ initialXml }) {
|
|
|
731
731
|
## 4. Vue 3.3+
|
|
732
732
|
|
|
733
733
|
```bash
|
|
734
|
-
npm install @bpmn-nova/vue
|
|
734
|
+
npm install @bpmn-nova/vue
|
|
735
735
|
```
|
|
736
736
|
|
|
737
737
|
```vue
|
|
@@ -1153,7 +1153,9 @@ import { xml, runtime } from './approval-data'
|
|
|
1153
1153
|
|
|
1154
1154
|
节点当前摘要只来自 **Effective Visit**。`latestAction` 是这些执行里真正的最新动作,即使没有意见;`latestNonEmptyComment` 是最近一条非空意见,可以来自历史轮次,供详情标注,不能覆盖本轮通过且未填意见的摘要。同一节点上仍有效的独立 Visit 会同时参与状态聚合:任一仍在处理中时,节点不能被另一个已完成 Visit 标成全部完成。会签/或签仍是同一 `visitId` 下的多个工作项,由显式 `approvalMode` 驱动。
|
|
1155
1155
|
|
|
1156
|
-
比较时间使用解析后的时间点,显示使用 `formatRuntimeInstant()`。带时区的 ISO 与 `Z` 按绝对时间比较;无时区旧输入仍可解析但会诊断歧义。缺失或非法时间不会被改成数组下标或补 `1ms
|
|
1156
|
+
比较时间使用解析后的时间点,显示使用 `formatRuntimeInstant()`。带时区的 ISO 与 `Z` 按绝对时间比较;无时区旧输入仍可解析但会诊断歧义。缺失或非法时间不会被改成数组下标或补 `1ms`。详情、驳回记录、Timeline 与 SVG 共用该格式化入口。
|
|
1157
|
+
|
|
1158
|
+
自 `0.4.0` 起,宿主可通过 `runtimeTimeFormat`(基于 `Intl.DateTimeFormat` 指定 `timeZone` / `locale` / `dateStyle` / `timeStyle` / `hour12`)或自定义 `formatRuntimeTime(instant, { surface, field, locale })` 覆盖全部四个运行态展示面(`details`、`transition`、`timeline`、`svg`)的时间显示,且不影响排序、访问归并与失效推断;`formatRuntimeTime` 优先于 `runtimeTimeFormat`。详细契约见 [API 文档](../api/index.md#运行态时间格式化)。
|
|
1157
1159
|
|
|
1158
1160
|
`inspectRuntime(snapshot, { model })` 自 `0.3.6-preview` 提供,返回 `{ runtime, diagnostics }`。诊断含 `code`、`level`、`message`、`fieldPath` 及相关 ID,不含审批正文、附件地址或凭证。未知引用会进入诊断,不会被静默丢弃后呈现完整轨迹。`activityState()` 的声明与实现均为访问状态对象,不是状态字符串。
|
|
1159
1161
|
|
|
@@ -1842,7 +1844,7 @@ export function createAssetResolver(resolveAssetUrl: ResolveAssetUrl): RuntimeAs
|
|
|
1842
1844
|
|
|
1843
1845
|
# BPMN Nova 快速开始
|
|
1844
1846
|
|
|
1845
|
-
本文面向通过 NPM 集成 BPMN Nova 的应用开发者。版本 `0.
|
|
1847
|
+
本文面向通过 NPM 集成 BPMN Nova 的应用开发者。版本 `0.4.0` 要求现代浏览器;Node.js 18+ 用于构建、SSR 和开发工具。
|
|
1846
1848
|
|
|
1847
1849
|
## 1. 按语言与框架选择入口
|
|
1848
1850
|
|
|
@@ -1850,11 +1852,11 @@ export function createAssetResolver(resolveAssetUrl: ResolveAssetUrl): RuntimeAs
|
|
|
1850
1852
|
|
|
1851
1853
|
| 项目环境 | 安装命令 | 后续章节 |
|
|
1852
1854
|
| --- | --- | --- |
|
|
1853
|
-
| Vanilla JavaScript / TypeScript 完整 Studio | `npm install @bpmn-nova/studio
|
|
1854
|
-
| 已有 React 18+ 工程 | `npm install @bpmn-nova/react
|
|
1855
|
-
| 已有 Vue 3.3+ 工程 | `npm install @bpmn-nova/vue
|
|
1855
|
+
| Vanilla JavaScript / TypeScript 完整 Studio | `npm install @bpmn-nova/studio` | 第 3 节 |
|
|
1856
|
+
| 已有 React 18+ 工程 | `npm install @bpmn-nova/react` | 第 7 节 |
|
|
1857
|
+
| 已有 Vue 3.3+ 工程 | `npm install @bpmn-nova/vue` | 第 8 节 |
|
|
1856
1858
|
|
|
1857
|
-
JavaScript 与 TypeScript 使用相同的包和导入方式。所有公开包都附带 `.d.ts`,TypeScript 项目无需额外安装类型包。React/Vue 的命令假定宿主工程已经由对应框架脚手架创建;适配包只声明框架 `peerDependencies
|
|
1859
|
+
JavaScript 与 TypeScript 使用相同的包和导入方式。所有公开包都附带 `.d.ts`,TypeScript 项目无需额外安装类型包。React/Vue 的命令假定宿主工程已经由对应框架脚手架创建;适配包只声明框架 `peerDependencies`,不会替宿主选择、安装或升级框架版本。
|
|
1858
1860
|
|
|
1859
1861
|
Core、Viewer、Runtime、Theme 等目录不再是可直接安装的 NPM 包。Vanilla 项目从 Studio 根入口或受支持子路径导入;React/Vue 项目使用对应 Adapter。
|
|
1860
1862
|
|
|
@@ -2085,7 +2087,7 @@ viewer.destroy()
|
|
|
2085
2087
|
本节面向已有 React 18+ 与 React DOM 18+ 工程,只安装 BPMN Nova 适配包:
|
|
2086
2088
|
|
|
2087
2089
|
```bash
|
|
2088
|
-
npm install @bpmn-nova/react
|
|
2090
|
+
npm install @bpmn-nova/react
|
|
2089
2091
|
```
|
|
2090
2092
|
|
|
2091
2093
|
```jsx
|
|
@@ -2135,7 +2137,7 @@ Ref 可访问 `studio`、`shell`、`actions`、实际 `mode`、`setMode()`、`va
|
|
|
2135
2137
|
本节面向已有 Vue 3.3+ 工程,只安装 BPMN Nova 适配包:
|
|
2136
2138
|
|
|
2137
2139
|
```bash
|
|
2138
|
-
npm install @bpmn-nova/vue
|
|
2140
|
+
npm install @bpmn-nova/vue
|
|
2139
2141
|
```
|
|
2140
2142
|
|
|
2141
2143
|
```vue
|
|
@@ -2318,7 +2320,7 @@ BPMN Nova 的 Vanilla JavaScript / TypeScript 完整入口,提供流程设计
|
|
|
2318
2320
|
|
|
2319
2321
|
> **English summary:** The complete framework-neutral BPMN Nova package for process design, viewing, approval traces, themes, properties, and pure SVG export.
|
|
2320
2322
|
|
|
2321
|
-
> 当前版本为 `0.
|
|
2323
|
+
> 当前版本为 `0.4.0`。在生产接入前请验证目标 BPMN XML 与引擎扩展。
|
|
2322
2324
|
|
|
2323
2325
|

|
|
2324
2326
|
|
|
@@ -2332,7 +2334,7 @@ BPMN Nova 的 Vanilla JavaScript / TypeScript 完整入口,提供流程设计
|
|
|
2332
2334
|
## 安装
|
|
2333
2335
|
|
|
2334
2336
|
```bash
|
|
2335
|
-
npm install @bpmn-nova/studio
|
|
2337
|
+
npm install @bpmn-nova/studio
|
|
2336
2338
|
```
|
|
2337
2339
|
|
|
2338
2340
|
```js
|
|
@@ -2699,6 +2701,32 @@ shell.setRuntimeAppearance({
|
|
|
2699
2701
|
|
|
2700
2702
|

|
|
2701
2703
|
|
|
2704
|
+
## 多语言与运行态时间格式(自 0.4.0 起)
|
|
2705
|
+
|
|
2706
|
+
内置 `zh-CN`(默认,保持既有文案不变)与 `en-US` 文案包,零第三方 i18n 依赖,支持局部键覆盖与运行中无重建切换:
|
|
2707
|
+
|
|
2708
|
+
```js
|
|
2709
|
+
const studio = createStudioController({
|
|
2710
|
+
model,
|
|
2711
|
+
locale: 'en-US',
|
|
2712
|
+
messages: { shell: { tools: { beautify: 'Auto Layout' } } },
|
|
2713
|
+
})
|
|
2714
|
+
const shell = createStudioShell({
|
|
2715
|
+
container,
|
|
2716
|
+
studio,
|
|
2717
|
+
config: {
|
|
2718
|
+
viewer: {
|
|
2719
|
+
runtimeTimeFormat: { timeZone: 'Asia/Shanghai', locale: 'zh-CN' },
|
|
2720
|
+
// 或提供自定义回调 formatRuntimeTime(instant, { surface, field, locale })
|
|
2721
|
+
},
|
|
2722
|
+
},
|
|
2723
|
+
})
|
|
2724
|
+
|
|
2725
|
+
shell.setLocale('zh-CN') // 不重建 Controller,保留撤销栈、选中项、视口、作用域与已有节点名称
|
|
2726
|
+
```
|
|
2727
|
+
|
|
2728
|
+
完整键名分区、回退规则与 `formatRuntimeTime` / `runtimeTimeFormat` 契约见 [API 文档](../api/index.md#多语言i18n)。
|
|
2729
|
+
|
|
2702
2730
|
## SVG 导出
|
|
2703
2731
|
|
|
2704
2732
|
```js
|
|
@@ -2765,14 +2793,14 @@ BPMN Nova 的 Vue 3.3+ Adapter,提供 Studio、Designer、Viewer、审批轨
|
|
|
2765
2793
|
|
|
2766
2794
|
> **English summary:** Vue 3.3+ components and exposed instance methods for BPMN Nova process design, viewing, approval traces, properties, themes, and SVG export.
|
|
2767
2795
|
|
|
2768
|
-
> 当前版本为 `0.
|
|
2796
|
+
> 当前版本为 `0.4.0`。Vue 由宿主工程提供,本包不会替应用选择或升级框架版本。
|
|
2769
2797
|
|
|
2770
2798
|

|
|
2771
2799
|
|
|
2772
2800
|
## 安装
|
|
2773
2801
|
|
|
2774
2802
|
```bash
|
|
2775
|
-
npm install @bpmn-nova/vue
|
|
2803
|
+
npm install @bpmn-nova/vue
|
|
2776
2804
|
```
|
|
2777
2805
|
|
|
2778
2806
|
```js
|
|
@@ -3188,6 +3216,22 @@ studioRef.value?.openSvgExportPreview({
|
|
|
3188
3216
|
|
|
3189
3217
|
主题属性变化会更新现有实例,不会重新挂载画布、清除选择或关闭详情。
|
|
3190
3218
|
|
|
3219
|
+
## 多语言与运行态时间格式(自 0.4.0 起)
|
|
3220
|
+
|
|
3221
|
+
所有 Vue 视觉组件接受响应式的 `locale`(默认 `'zh-CN'`,内置 `'en-US'`)与 `messages` 局部覆盖,切换时不重新挂载实例,保留撤销历史、选中项、视口、子流程作用域与已有节点名称;`BpmnStudio` 与 `BpmnViewer` 同时接受 `runtime-time-format` 与 `format-runtime-time`:
|
|
3222
|
+
|
|
3223
|
+
```vue
|
|
3224
|
+
<BpmnStudio
|
|
3225
|
+
ref="studioRef"
|
|
3226
|
+
:xml="xml"
|
|
3227
|
+
:locale="locale"
|
|
3228
|
+
:messages="{ shell: { tools: { validate: 'Check' } } }"
|
|
3229
|
+
:runtime-time-format="{ timeZone: 'Asia/Shanghai', locale }"
|
|
3230
|
+
/>
|
|
3231
|
+
```
|
|
3232
|
+
|
|
3233
|
+
Expose 同时提供 `setLocale(locale?, messages?)` 与 `getLocale()`,根入口同步重导出 `zhCN`、`enUS`、`createI18n` 及全部国际化与运行态时间格式化 TypeScript 类型。详细说明见 [API 文档](../api/index.md#多语言i18n)。
|
|
3234
|
+
|
|
3191
3235
|
## Properties 与自定义 Renderer
|
|
3192
3236
|
|
|
3193
3237
|
本包还导出:
|
|
@@ -3233,14 +3277,14 @@ BPMN Nova 的 React 18+ Adapter,提供 Studio、Designer、Viewer、审批轨
|
|
|
3233
3277
|
|
|
3234
3278
|
> **English summary:** React 18+ components and refs for BPMN Nova process design, viewing, approval traces, properties, themes, and SVG export.
|
|
3235
3279
|
|
|
3236
|
-
> 当前版本为 `0.
|
|
3280
|
+
> 当前版本为 `0.4.0`。React 与 React DOM 由宿主工程提供,本包不会替应用选择或升级框架版本。
|
|
3237
3281
|
|
|
3238
3282
|

|
|
3239
3283
|
|
|
3240
3284
|
## 安装
|
|
3241
3285
|
|
|
3242
3286
|
```bash
|
|
3243
|
-
npm install @bpmn-nova/react
|
|
3287
|
+
npm install @bpmn-nova/react
|
|
3244
3288
|
```
|
|
3245
3289
|
|
|
3246
3290
|
```jsx
|
|
@@ -3611,6 +3655,23 @@ studioRef.current?.openSvgExportPreview({
|
|
|
3611
3655
|
|
|
3612
3656
|
主题属性变化会更新现有实例,不会重新挂载画布、清除选择或关闭详情。
|
|
3613
3657
|
|
|
3658
|
+
## 多语言与运行态时间格式(自 0.4.0 起)
|
|
3659
|
+
|
|
3660
|
+
所有 React 视觉组件接受响应式的 `locale`(默认 `'zh-CN'`,内置 `'en-US'`)与 `messages` 局部覆盖,切换时不重新挂载实例,保留撤销历史、选中项、视口、子流程作用域与已有节点名称;`BpmnStudio` 与 `BpmnViewer` 同时接受 `runtimeTimeFormat` 与 `formatRuntimeTime`:
|
|
3661
|
+
|
|
3662
|
+
```jsx
|
|
3663
|
+
<BpmnStudio
|
|
3664
|
+
ref={studioRef}
|
|
3665
|
+
xml={xml}
|
|
3666
|
+
locale={locale}
|
|
3667
|
+
messages={{ shell: { tools: { validate: 'Check' } } }}
|
|
3668
|
+
runtimeTimeFormat={{ timeZone: 'Asia/Shanghai', locale }}
|
|
3669
|
+
// 或 formatRuntimeTime={(instant, { surface, field, locale }) => ...}
|
|
3670
|
+
/>
|
|
3671
|
+
```
|
|
3672
|
+
|
|
3673
|
+
Ref 同时暴露 `setLocale(locale?, messages?)` 与 `getLocale()`,根入口同步重导出 `zhCN`、`enUS`、`createI18n` 及全部国际化与运行态时间格式化 TypeScript 类型。详细说明见 [API 文档](../api/index.md#多语言i18n)。
|
|
3674
|
+
|
|
3614
3675
|
## Properties 与自定义 Renderer
|
|
3615
3676
|
|
|
3616
3677
|
本包还导出:
|
|
@@ -3652,7 +3713,7 @@ Apache-2.0. See [LICENSE](https://github.com/daxiangme/bpmn-nova/blob/dev/packag
|
|
|
3652
3713
|
|
|
3653
3714
|
# BPMN Nova 组件参数
|
|
3654
3715
|
|
|
3655
|
-
本手册记录 `0.
|
|
3716
|
+
本手册记录 `0.4.0` 的公开组件参数、回调和实例方法。所有视觉组件都需要具有实际尺寸的容器,并显式导入所属包的 `styles.css`。
|
|
3656
3717
|
|
|
3657
3718
|
## 在线体验
|
|
3658
3719
|
|
|
@@ -3696,6 +3757,8 @@ Controller 不创建 DOM,负责模型、命令、历史、选择与子流程
|
|
|
3696
3757
|
| `extensions` | `StudioExtension[]` | `[]` | Controller 扩展,`setup()` 可返回清理函数 |
|
|
3697
3758
|
| `allowedNodeTypes` | `Iterable<NodeType> \| null` | `null` | Deprecated 兼容别名;完整模型节点白名单 |
|
|
3698
3759
|
| `allowedEdgeTypes` | `Iterable<EdgeType> \| null` | `null` | Deprecated 兼容别名;完整模型连线白名单 |
|
|
3760
|
+
| `locale` | `NovaLocale` | `'zh-CN'` | 自 0.4.0 起;界面语言(内置 `'zh-CN'` / `'en-US'`) |
|
|
3761
|
+
| `messages` | `NovaMessagesOverride \| null` | `null` | 自 0.4.0 起;局部文案覆盖对象 |
|
|
3699
3762
|
|
|
3700
3763
|
常用方法:
|
|
3701
3764
|
|
|
@@ -3711,6 +3774,7 @@ Controller 不创建 DOM,负责模型、命令、历史、选择与子流程
|
|
|
3711
3774
|
| `exportXml(engine?)` | `string` | 导出 BPMN XML |
|
|
3712
3775
|
| `importXml(xml, engine?)` | `ProcessModel` | 导入并替换当前模型;类型白名单或 `nodeLimits` 不满足时抛错,且不改变当前模型与历史 |
|
|
3713
3776
|
| `validate()` | `StudioValidationIssue[]` | 返回结构化错误和警告,不触发宿主 UI |
|
|
3777
|
+
| `setLocale(locale?, messages?)` / `getLocale()` | `NovaI18nState` | 自 0.4.0 起;运行中无重建切换语言与局部文案 |
|
|
3714
3778
|
| `undo()` / `redo()` | `boolean` | 执行历史操作 |
|
|
3715
3779
|
| `destroy()` | `void` | 清理扩展和订阅 |
|
|
3716
3780
|
|
|
@@ -3751,6 +3815,8 @@ studio.changeNodeType('EndEvent_1', 'startEvent') // 返回 false
|
|
|
3751
3815
|
| `leftWidth` | `number` | `244` | Deprecated;使用 `config.ui.sidebarWidth.left` |
|
|
3752
3816
|
| `rightWidth` | `number` | `360` | Deprecated;使用 `config.ui.sidebarWidth.right` |
|
|
3753
3817
|
| `theme` | `NovaThemeInput` | `light` | 组件实例主题 |
|
|
3818
|
+
| `locale` / `messages` | `NovaLocale` / `NovaMessagesOverride` | `'zh-CN'` | 自 0.4.0 起;默认同步并共享 `studio.i18n`,支持 `setLocale()` / `getLocale()` 运行时切换 |
|
|
3819
|
+
| `formatRuntimeTime` / `runtimeTimeFormat` | `RuntimeTimeFormatter` / `RuntimeTimeFormatOptions` | 默认 `raw` 格式化 | 自 0.4.0 起;运行态时间展示配置,推荐放入 `config.viewer.*` |
|
|
3754
3820
|
| `runtimeAppearance` | `RuntimeAppearanceOptions` | 默认语义映射 | 状态、动作、转移的 Tone 映射 |
|
|
3755
3821
|
| `svgExport` | `SvgExportOptions & Renderer Adapters` | `{}` | Deprecated;使用 `config.export` |
|
|
3756
3822
|
| `iconRegistry` | `IconRegistry` | 默认 Registry | 图标覆盖入口 |
|
|
@@ -3837,9 +3903,11 @@ new BpmnDesigner(options)
|
|
|
3837
3903
|
| `onElementClick` | `(payload) => void` | 无 | 基础元素点击 |
|
|
3838
3904
|
| `onProjectionChange` | `({ requested, active }) => void` | 无 | 实际投影变化 |
|
|
3839
3905
|
| `theme` | `NovaThemeInput` | `light` | 实例主题 |
|
|
3906
|
+
| `locale` / `messages` | `NovaLocale` / `NovaMessagesOverride` | `'zh-CN'` | 自 0.4.0 起;界面语言与局部文案覆盖 |
|
|
3907
|
+
| `formatRuntimeTime` / `runtimeTimeFormat` | `RuntimeTimeFormatter` / `RuntimeTimeFormatOptions` | 默认格式 | 自 0.4.0 起;统一覆盖详情、驳回记录、时间线和 SVG 的时间显示 |
|
|
3840
3908
|
| `runtimeAppearance` | `RuntimeAppearanceOptions` | 默认映射 | Runtime 语义外观 |
|
|
3841
3909
|
|
|
3842
|
-
实例方法:`setModel()`、`setRuntime()`、`setProjection()`、`setDisplayOptions()`、`refreshPresentation()`、`setTheme()`、`setRuntimeAppearance()`、`fitView()`、`openRuntimeDetails()`、`openRuntimeTransitionDetails()`、`closeRuntimeDetails()` 和 `destroy()
|
|
3910
|
+
实例方法:`setModel()`、`setRuntime()`、`setProjection()`、`setDisplayOptions()`、`refreshPresentation()`、`setTheme()`、`setLocale()`、`getLocale()`、`setRuntimeAppearance()`、`fitView()`、`openRuntimeDetails()`、`openRuntimeTransitionDetails()`、`closeRuntimeDetails()` 和 `destroy()`。`refreshPresentation()` 在 `instance` 模式也会按最新格式化配置原地刷新并保留视口、滚动与已打开详情(自 0.4.0 起)。
|
|
3843
3911
|
|
|
3844
3912
|
## `BpmnCanvas`
|
|
3845
3913
|
|
|
@@ -3907,7 +3975,7 @@ canvas.setViewportState({ zoom: 0.8, pan: { x: 0, y: 0 } }) // 直
|
|
|
3907
3975
|
|
|
3908
3976
|
## React 组件
|
|
3909
3977
|
|
|
3910
|
-
所有 React 视觉组件支持 `className`、`style`、`theme` 和 `
|
|
3978
|
+
所有 React 视觉组件支持 `className`、`style`、`theme`、`onThemeChange`,以及 `locale`、`messages` Prop 与 `setLocale()` / `getLocale()` Ref 方法(自 0.4.0 起);`BpmnStudio` 与 `BpmnViewer` 同时支持 `formatRuntimeTime` 和 `runtimeTimeFormat`(`BpmnStudio` 也可通过 `config.viewer` 配置)。
|
|
3911
3979
|
|
|
3912
3980
|
### `BpmnStudio`
|
|
3913
3981
|
|
|
@@ -3997,6 +4065,7 @@ Vue 组件与 React 使用同一底层接口,主要差异为:
|
|
|
3997
4065
|
- Header Slot Context 的 `mode` 是响应式实际状态。Ref Expose 使用 `getStudio()`、`getShell()`、`getActions()`、`getMode()`、`setMode()`、`setAllowedModes()`、`validate()`、`refreshPresentation()`、`revealElement()` 或 `getInstance()`,不直接暴露可替换字段。`revealElement(id, options?)`(自 0.3.8-preview 起)与 React Ref 同语义;`BpmnCanvas` 的 Expose 另提供 `revealElement()` 与 `setViewportState()`。
|
|
3998
4066
|
- Studio Prop 与 `useBpmnStudio()` 支持 `config`;Expose 提供 `getConfig()` / `setConfig()`,Header Slot Context 提供响应式只读 `ui`。
|
|
3999
4067
|
- Studio Expose 提供与 React 相同的五个侧栏/面板选择方法;Header/Right Slot Context 共享响应式 `panelSelection`。
|
|
4068
|
+
- 全部 Vue 视觉组件支持响应式 `locale` / `messages` Prop 与 `setLocale()` / `getLocale()` Expose(自 0.4.0 起),无重建原地切换;`BpmnStudio` 与 `BpmnViewer` 同时支持响应式 `formatRuntimeTime` 与 `runtimeTimeFormat`。
|
|
4000
4069
|
|
|
4001
4070
|
Vue 提供 `BpmnStudio`、`BpmnDesigner`、`BpmnViewer`、`BpmnCanvas`、`BpmnPalettePanel`、`BpmnPropertiesPanel` 和 `useBpmnStudio()`。独立 `BpmnPalettePanel` 复用外部 Studio;传入 Registry 时不会隐式注册 Providers,未传 Registry 时才用 Providers 创建默认 Registry。
|
|
4002
4071
|
|
|
@@ -4062,6 +4131,8 @@ import type {
|
|
|
4062
4131
|
|
|
4063
4132
|
自 `0.3.6-preview` 起,Vue/React/Studio 额外导出 `inspectRuntime`、`formatRuntimeInstant`、`parseRuntimeInstant`、`activityState` 以及类型 `RuntimeDiagnostic`、`ActivityVisitState`、`RuntimeInstant`。旧 `0.3.5-preview` 包没有这些 JavaScript 出口。
|
|
4064
4133
|
|
|
4134
|
+
自 `0.4.0` 起,Studio / React / Vue 根入口新增国际化与运行态时间格式化出口:值导出 `zhCN`、`enUS`、`createI18n`、`resolveI18n`、`DEFAULT_LOCALE`;类型导出 `NovaLocale`、`NovaMessages`、`NovaMessagesOverride`、`NovaI18nOptions`、`NovaI18nState`、`I18nController`、`RuntimeTimeSurface`、`RuntimeTimeField`、`RuntimeTimeFormatContext`、`RuntimeTimeFormatter`、`RuntimeTimeFormatOptions`、`FormatRuntimeInstantOptions`。
|
|
4135
|
+
|
|
4065
4136
|
真实数据转换、ID 关联、完整场景与已发布版本的 Props 类型推导见[审批轨迹接入指南](../guide/runtime.md)。
|
|
4066
4137
|
|
|
4067
4138
|
## Studio Config Interface
|
|
@@ -4114,6 +4185,10 @@ interface BpmnStudioConfig {
|
|
|
4114
4185
|
timeline?: ViewerTimelineOptions
|
|
4115
4186
|
runtimeDetails?: RuntimeDetailsOptions
|
|
4116
4187
|
runtimeTraceOptions?: RuntimeTraceProjectionOptions
|
|
4188
|
+
/** 自 0.4.0 起:运行态时间自定义格式化回调,优先于 runtimeTimeFormat。 */
|
|
4189
|
+
formatRuntimeTime?: RuntimeTimeFormatter | null
|
|
4190
|
+
/** 自 0.4.0 起:运行态时间内置 Intl.DateTimeFormat 配置(时区/语言/样式)。 */
|
|
4191
|
+
runtimeTimeFormat?: RuntimeTimeFormatOptions | null
|
|
4117
4192
|
}
|
|
4118
4193
|
export?: StudioSvgExportOptions
|
|
4119
4194
|
}
|
|
@@ -4960,6 +5035,124 @@ console.log(role.status, role.topologyComplete, role.issues)
|
|
|
4960
5035
|
|
|
4961
5036
|
`resolveGatewayRole()` 会同时返回声明角色、线路推断角色、结构完成度及 `valid` / `incomplete` / `conflict` / `ambiguous` 状态。业务属性面板据此分别显示并行出口或汇聚入口/后续出口;角色切换和校验不会自动删除、改线或清空已有 Sequence Flow 数据。
|
|
4962
5037
|
|
|
5038
|
+
## 多语言(i18n)
|
|
5039
|
+
|
|
5040
|
+
自 `0.4.0` 起,内置零第三方依赖的 `zh-CN`(默认,保持与 `0.3.9-preview` 一致)和 `en-US` 文案包,支持初始化传入 `locale` / `messages` 局部覆盖,以及运行中通过 `setLocale(locale?, messages?)` 或框架响应式 Prop 无重建切换:
|
|
5041
|
+
|
|
5042
|
+
```ts
|
|
5043
|
+
type NovaLocale = 'zh-CN' | 'en-US' | (string & {})
|
|
5044
|
+
type NovaMessageValue<P = Record<string, any>> = string | ((params: P) => string)
|
|
5045
|
+
type NovaMessagesOverride = DeepPartial<NovaMessages>
|
|
5046
|
+
|
|
5047
|
+
interface NovaI18nState {
|
|
5048
|
+
readonly locale: string
|
|
5049
|
+
readonly resolvedLocale: string
|
|
5050
|
+
}
|
|
5051
|
+
```
|
|
5052
|
+
|
|
5053
|
+
```js
|
|
5054
|
+
import { createStudioController, createStudioShell, enUS, zhCN } from '@bpmn-nova/studio'
|
|
5055
|
+
|
|
5056
|
+
const studio = createStudioController({
|
|
5057
|
+
model,
|
|
5058
|
+
locale: 'en-US',
|
|
5059
|
+
messages: {
|
|
5060
|
+
shell: { tools: { beautify: 'Auto Arrange' } },
|
|
5061
|
+
},
|
|
5062
|
+
})
|
|
5063
|
+
|
|
5064
|
+
const shell = createStudioShell({ container, studio })
|
|
5065
|
+
|
|
5066
|
+
// 运行中无重建切换语言,保留撤销栈、选中项、视口、子流程作用域与已有节点名称
|
|
5067
|
+
shell.setLocale('zh-CN')
|
|
5068
|
+
shell.setLocale('en-US', { modeling: { nodeLimitExceeded: ({ max, label }) => `Max ${max} ${label}` } })
|
|
5069
|
+
console.log(shell.getLocale()) // { locale: 'en-US', resolvedLocale: 'en-US' }
|
|
5070
|
+
```
|
|
5071
|
+
|
|
5072
|
+
- **覆盖与回退**:`messages` 允许只覆盖单个键;未命中或缺失键自动回退到 `zh-CN` 对应项(开发模式仅 `console.warn` 一次,不抛异常)。
|
|
5073
|
+
- **已存在内容与新建节点**:切换语言不修改模型中已有元素名称、连线名称与 BPMN XML;之后新创建的节点按当前语言 `elementTypes` 生成默认名称(显式 `preset.name` 优先)。
|
|
5074
|
+
- **组件覆写入口**:`createStudioController`、`createStudioShell`、`BpmnCanvas`、`PalettePanel`、`PropertiesPanel`、`BpmnViewer`、`BpmnDesigner` 及 `@bpmn-nova/react` / `@bpmn-nova/vue` 对应组件均接受 `locale`、`messages` 并暴露 `setLocale()` / `getLocale()`。
|
|
5075
|
+
- **文案分域(`NovaMessages` 顶层键)**:
|
|
5076
|
+
|
|
5077
|
+
| 顶层键 | 覆盖范围 |
|
|
5078
|
+
| --- | --- |
|
|
5079
|
+
| `common` | 列表与问题分隔符 |
|
|
5080
|
+
| `elementTypes` / `edgeTypes` | 60 种 BPMN 节点、并行分支/汇聚、3 种连线类型名称 |
|
|
5081
|
+
| `actions` | 内置审批动作(`submit`、`approve`、`reject`、`return`、`add-sign`、`transfer`、`delegate`、`withdraw`、`comment`、`skip`、`cancel` 等) |
|
|
5082
|
+
| `shell` | 工作台 Header 模式/投影切换、工具栏、布局策略菜单、画布浮动头与面包屑、状态栏、侧栏折叠按钮、只读侧栏详情与导出提示 |
|
|
5083
|
+
| `palette` | 调色板分组标题、并行分支/汇聚说明、不可用原因 |
|
|
5084
|
+
| `contextMenu` | 画布/节点/连线/多选右键菜单分组与全部动作 |
|
|
5085
|
+
| `canvas` | 指针工具栏、选区工具栏、空子流程提示、连线编辑占位、端口与节点操作、快捷添加菜单、网关角色徽标、默认副标题 |
|
|
5086
|
+
| `modeling` | 节点数量上限提示(含英文单复数)、网关分支默认名、默认分组与未命名流程名 |
|
|
5087
|
+
| `validation` | 模型结构校验、并行网关拓扑校验、XML 导入错误前缀 |
|
|
5088
|
+
| `properties` | 属性面板头部、业务/开发者视图切换、通用表单控件、分支编辑器、ID 校验与 BPMN / Flowable / Activiti 字段 |
|
|
5089
|
+
| `runtime` | 运行态节点状态、摘要、驳回/退回文案、动作附件计数、诊断与失效提示、轨迹预测标签 |
|
|
5090
|
+
| `viewer` | 节点详情弹窗、驳回/退回记录弹窗、审批结果标签与附件/图片预览文案 |
|
|
5091
|
+
| `timeline` | 移动时间线默认标题/说明、轮次、参与者折叠、历史动作展开与并行组计数 |
|
|
5092
|
+
| `exportSvg` | SVG 默认视图名、确认预览弹窗与降级警告 |
|
|
5093
|
+
|
|
5094
|
+
## 运行态时间格式化
|
|
5095
|
+
|
|
5096
|
+
自 `0.4.0` 起,所有运行态展示面(节点详情 `details`、驳回/退回详情 `transition`、移动时间线 `timeline`、SVG 导出 `svg`)统一经 `formatRuntimeInstant()` 格式化显示时间,不影响排序、访问归并与失效推断:
|
|
5097
|
+
|
|
5098
|
+
```ts
|
|
5099
|
+
type RuntimeTimeSurface = 'details' | 'transition' | 'timeline' | 'svg'
|
|
5100
|
+
type RuntimeTimeField = 'start' | 'end' | 'occurred' | 'resolved'
|
|
5101
|
+
|
|
5102
|
+
interface RuntimeTimeFormatContext {
|
|
5103
|
+
surface: RuntimeTimeSurface
|
|
5104
|
+
field: RuntimeTimeField
|
|
5105
|
+
locale: string
|
|
5106
|
+
}
|
|
5107
|
+
|
|
5108
|
+
type RuntimeTimeFormatter = (
|
|
5109
|
+
instant: RuntimeInstant,
|
|
5110
|
+
context: RuntimeTimeFormatContext,
|
|
5111
|
+
) => string
|
|
5112
|
+
|
|
5113
|
+
interface RuntimeTimeFormatOptions {
|
|
5114
|
+
timeZone?: string
|
|
5115
|
+
locale?: string
|
|
5116
|
+
dateStyle?: 'full' | 'long' | 'medium' | 'short'
|
|
5117
|
+
timeStyle?: 'full' | 'long' | 'medium' | 'short'
|
|
5118
|
+
hour12?: boolean
|
|
5119
|
+
}
|
|
5120
|
+
```
|
|
5121
|
+
|
|
5122
|
+
```js
|
|
5123
|
+
// 方式 1:内置 Intl.DateTimeFormat 快捷配置(按租户/用户时区展示)
|
|
5124
|
+
const viewer = new BpmnViewer({
|
|
5125
|
+
container,
|
|
5126
|
+
model,
|
|
5127
|
+
runtime,
|
|
5128
|
+
runtimeTimeFormat: { timeZone: 'Asia/Shanghai', locale: 'zh-CN' },
|
|
5129
|
+
})
|
|
5130
|
+
|
|
5131
|
+
// 方式 2:自定义格式化函数(优先级高于 runtimeTimeFormat)
|
|
5132
|
+
viewer.setDisplayOptions({
|
|
5133
|
+
formatRuntimeTime(instant, { surface, field, locale }) {
|
|
5134
|
+
if (instant.kind === 'invalid') return instant.raw
|
|
5135
|
+
if (instant.kind === 'naive') return `${instant.raw} (local)`
|
|
5136
|
+
return new Intl.DateTimeFormat(locale, {
|
|
5137
|
+
timeZone: 'America/New_York',
|
|
5138
|
+
dateStyle: 'medium',
|
|
5139
|
+
timeStyle: 'short',
|
|
5140
|
+
}).format(new Date(instant.ms))
|
|
5141
|
+
},
|
|
5142
|
+
})
|
|
5143
|
+
|
|
5144
|
+
// Studio 通过 config.viewer(或顶层选项)配置,setConfig() 原地刷新且保留视口/滚动与已打开详情
|
|
5145
|
+
shell.setConfig({
|
|
5146
|
+
viewer: {
|
|
5147
|
+
runtimeTimeFormat: { timeZone: 'UTC', locale: 'en-US' },
|
|
5148
|
+
},
|
|
5149
|
+
})
|
|
5150
|
+
```
|
|
5151
|
+
|
|
5152
|
+
- **优先级**:同时提供 `formatRuntimeTime` 与 `runtimeTimeFormat` 时,`formatRuntimeTime` 优先;`exportSvg()` 也可单次覆盖。
|
|
5153
|
+
- **边界值与兜底**:`instant.kind === 'missing'` 直接返回 `''` 且不调用 `formatRuntimeTime`;`invalid` 与 `naive` 会继续透传给 `formatRuntimeTime` 由宿主决定兜底文案;自定义回调抛错或返回非字符串时,回退默认格式(`raw.trim().replace('T', ' ')`)并在开发模式仅告警一次。
|
|
5154
|
+
- **不破坏语义**:`parseRuntimeInstant()` 仍按绝对时间戳(`ms`)参与排序与回退失效判定;运行中调用 `setDisplayOptions()` / `setConfig()` / `refreshPresentation()` 仅刷新时间展示,保留视口、滚动位置和已打开详情。
|
|
5155
|
+
|
|
4963
5156
|
|
|
4964
5157
|
<!-- SOURCE: docs/src/customization/index.md -->
|
|
4965
5158
|
|
|
@@ -5911,7 +6104,7 @@ Default ●
|
|
|
5911
6104
|
|
|
5912
6105
|
# BPMN Nova NPM 包与发布
|
|
5913
6106
|
|
|
5914
|
-
版本:`0.
|
|
6107
|
+
版本:`0.4.0`。BPMN Nova 只发布三个 `@bpmn-nova` 公共包,均使用 ESM、附带 TypeScript 声明、采用 Apache-2.0 License,正式版通过默认 `latest` dist-tag 发布(带 `-` 后缀的预发布版本由守卫脚本要求显式使用 `--tag preview`)。
|
|
5915
6108
|
|
|
5916
6109
|
## 公共包
|
|
5917
6110
|
|
|
@@ -5919,9 +6112,9 @@ Default ●
|
|
|
5919
6112
|
|
|
5920
6113
|
| 项目环境 | 安装命令 | 说明 |
|
|
5921
6114
|
| --- | --- | --- |
|
|
5922
|
-
| Vanilla JavaScript / TypeScript | `npm install @bpmn-nova/studio
|
|
5923
|
-
| React 18+ | `npm install @bpmn-nova/react
|
|
5924
|
-
| Vue 3.3+ | `npm install @bpmn-nova/vue
|
|
6115
|
+
| Vanilla JavaScript / TypeScript | `npm install @bpmn-nova/studio` | 设计、展示、审批轨迹、主题与 SVG 导出 |
|
|
6116
|
+
| React 18+ | `npm install @bpmn-nova/react` | React 组件、Hook 与 Ref;依赖 Studio |
|
|
6117
|
+
| Vue 3.3+ | `npm install @bpmn-nova/vue` | Vue 组件、Composable 与 Expose;依赖 Studio |
|
|
5925
6118
|
|
|
5926
6119
|
Core、Model、Renderer、Runtime、Theme、Properties、Node Presentation 和引擎 Profile 是源码内部 Module,不再是可独立安装或独立发布的产品。`NodeSubtitleResolver` 类型从 Studio 根入口公开,但 `node-presentation` 没有 npm 子路径或独立版本。React/Vue 各自只依赖完全相同版本的 `@bpmn-nova/studio`,并通过 peer dependency 使用宿主框架。
|
|
5927
6120
|
|
|
@@ -5937,6 +6130,8 @@ React/Vue 的声明入口显式重导出宿主常用的 Core 类型:`BpmnEdge`
|
|
|
5937
6130
|
|
|
5938
6131
|
`0.3.9-preview` 新增 `config.ui.canvasHead`,可关闭画布左上角的“编辑模式”徽标、让作用域路径只在嵌套作用域显示;`allowedModes` 只有一种时默认 Header 不再显示模式切换;容器不超过 1120px 时 Header 保持单行。详见更新日志与组件参数。
|
|
5939
6132
|
|
|
6133
|
+
`0.4.0` 新增零第三方依赖的内置多语言(`zh-CN` / `en-US`、`locale` / `messages` 局部覆盖与运行中无重建 `setLocale()` 切换)、统一覆盖四个运行态展示面的时间格式化配置(`formatRuntimeTime` / `runtimeTimeFormat`),并修复移动时间线(`compact`)滚动后底部详情抽屉、大图预览与 SVG 导出预览浮层错位问题。详见更新日志与 API 文档。
|
|
6134
|
+
|
|
5940
6135
|
## Studio 子路径
|
|
5941
6136
|
|
|
5942
6137
|
Studio 根入口重新导出稳定的完整能力;以下子路径用于让导入意图更清晰:
|
|
@@ -6000,7 +6195,7 @@ node scripts/build-packages.mjs --package vue
|
|
|
6000
6195
|
|
|
6001
6196
|
发布前先查询三个包的 Registry 版本,选择统一且未被占用的目标版本,再一起更新上述版本和相关文档,执行 `npm run docs:ai` 生成 AI 文档。本地 `release:check-versions` 检查上述一致性,但不能替代发布后的远端检查。已发布版本不可覆盖;部分成功后的处理见本页“部分发布失败”。
|
|
6002
6197
|
|
|
6003
|
-
只有三个包的精确目标版本均可安装、Adapter 的 Studio 依赖精确一致、三个包的目标 dist-tag
|
|
6198
|
+
只有三个包的精确目标版本均可安装、Adapter 的 Studio 依赖精确一致、三个包的目标 dist-tag(正式版为 `latest`,预发布版为 `preview`)均解析到 `V`,才算本轮发布完成。预发布版本不得覆盖 `latest` 标签。
|
|
6004
6199
|
|
|
6005
6200
|
## 发布前验证
|
|
6006
6201
|
|
|
@@ -6033,15 +6228,15 @@ git diff --check
|
|
|
6033
6228
|
|
|
6034
6229
|
## 发布顺序
|
|
6035
6230
|
|
|
6036
|
-
每轮必须发布三个包。先发布 Studio,确认 Registry 已可解析后,再发布 React 和 Vue
|
|
6231
|
+
每轮必须发布三个包。先发布 Studio,确认 Registry 已可解析后,再发布 React 和 Vue(正式版走默认 `latest`;带 `-` 的预发布版本显式附加 `--tag preview`):
|
|
6037
6232
|
|
|
6038
6233
|
```bash
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6234
|
+
npm publish /Users/afeng/workspace/bpmn-nova/packages/studio --access public
|
|
6235
|
+
npm publish /Users/afeng/workspace/bpmn-nova/packages/react --access public
|
|
6236
|
+
npm publish /Users/afeng/workspace/bpmn-nova/packages/vue --access public
|
|
6042
6237
|
```
|
|
6043
6238
|
|
|
6044
|
-
三个 manifest
|
|
6239
|
+
三个 manifest 都保留了 Preview 发布守卫:带 `-` 后缀的预发布版本必须显式传 `--tag preview`,防止误发到 `latest`;正式版直接发布到 `latest`。
|
|
6045
6240
|
|
|
6046
6241
|
发布后从仓库根目录核对;下面所有版本输出都应等于根版本,两个依赖也应精确等于该值:
|
|
6047
6242
|
|
|
@@ -6050,9 +6245,9 @@ release_version=$(node -p "require('./package.json').version")
|
|
|
6050
6245
|
npm view "@bpmn-nova/studio@$release_version" version
|
|
6051
6246
|
npm view "@bpmn-nova/react@$release_version" version dependencies --json
|
|
6052
6247
|
npm view "@bpmn-nova/vue@$release_version" version dependencies --json
|
|
6053
|
-
npm view @bpmn-nova/studio@
|
|
6054
|
-
npm view @bpmn-nova/react@
|
|
6055
|
-
npm view @bpmn-nova/vue@
|
|
6248
|
+
npm view @bpmn-nova/studio@latest version
|
|
6249
|
+
npm view @bpmn-nova/react@latest version
|
|
6250
|
+
npm view @bpmn-nova/vue@latest version
|
|
6056
6251
|
```
|
|
6057
6252
|
|
|
6058
6253
|
同时比较发布前后三个包的 `dist-tags.latest`,并在临时消费工程中安装本轮产物验证入口和类型。尚未通过远端核对时,报告为“部分发布”或“待验证”,不能报告全部发布成功。
|
|
@@ -6077,7 +6272,7 @@ Registry 清理是不可逆的外部操作,不由构建脚本自动执行。
|
|
|
6077
6272
|
|
|
6078
6273
|
1. 使用 `npm view` 确认成功发布的包和版本。
|
|
6079
6274
|
2. 修复身份、网络或顺序问题。
|
|
6080
|
-
3.
|
|
6275
|
+
3. 已成功发布且内容正确的包无需重复发布;继续发布本轮尚未成功的包,直到三个包及其目标 dist-tag 均对齐。这是失败恢复,不是按源码改动跳过包。
|
|
6081
6276
|
4. 如果已发布 tarball 内容错误,停止本轮发布,修复后选择新的统一 Preview 版本,重新构建、验证并发布全部三个包,不能只提升一个包的版本。
|
|
6082
6277
|
|
|
6083
6278
|
## 文档
|
|
@@ -6814,7 +7009,7 @@ export function previewExampleSvg(shell) {
|
|
|
6814
7009
|
|
|
6815
7010
|
## 在 JavaScript 项目中使用
|
|
6816
7011
|
|
|
6817
|
-
安装 `@bpmn-nova/studio
|
|
7012
|
+
安装 `@bpmn-nova/studio`,把上面两个文件放在同一文件夹,准备一个具有明确高度的容器,然后挂载示例:
|
|
6818
7013
|
|
|
6819
7014
|
```js
|
|
6820
7015
|
import '@bpmn-nova/studio/styles.css';
|
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
|
|
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.0`.
|
|
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
|
|
|
@@ -29,9 +29,9 @@ Preserve an already installed public package when it matches the target stack. D
|
|
|
29
29
|
Install with the application's existing package manager:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
npm install @bpmn-nova/vue
|
|
33
|
-
pnpm add @bpmn-nova/vue
|
|
34
|
-
yarn add @bpmn-nova/vue
|
|
32
|
+
npm install @bpmn-nova/vue
|
|
33
|
+
pnpm add @bpmn-nova/vue
|
|
34
|
+
yarn add @bpmn-nova/vue
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
Replace `vue` with `react` or `studio` only when the selected framework branch requires it. Run one installation command, not all three.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bpmn-nova/studio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Complete BPMN Nova Studio with Designer, Viewer, Palette, Properties and runtime visualization.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bpmn",
|
|
@@ -87,7 +87,6 @@
|
|
|
87
87
|
},
|
|
88
88
|
"license": "Apache-2.0",
|
|
89
89
|
"publishConfig": {
|
|
90
|
-
"access": "public"
|
|
91
|
-
"tag": "preview"
|
|
90
|
+
"access": "public"
|
|
92
91
|
}
|
|
93
92
|
}
|