feat(modeler): /process-modeler 页骨架(Modeler+标准属性面板+存量载入+设计中心入口)

阶段1 T1.5:admin 门 + 三栏布局(左画布/右上 EIP4 侧板占位/右下标准属性面板)
+ bpmn-js lib/Modeler 挂载(只载 activiti moddle、只引标准 BpmnPropertiesProvider,
严禁 Camunda provider)+ ?procDefId= 时 fetchProcDefSource→importXML(idMap 存 ref)
+ 无参时 process-select 存量流程选择器 + 设计中心「流程设计」入口。

api: processModeler.ts(fetchProcDefSource / fetchProcessOptions,裸 JSON 防御性默认)。
- procDefId 用 encodeURIComponent 进 path(真实库 id 形如「总包合同交底:3:<uuid>」中文+冒号)。
- found:false 先判后返,不解构 bpmnXml/idMap(后端此分支省略这些键)。
tsconfig.app.json 开 resolveJsonModule(首个 app 代码 import json)。
bpmn-js-properties-panel 补 ambient d.ts(包未发布类型)。

测试:ProcessModelerPage.test.tsx 5 例 + processModeler.test.ts 6 例(含中文+冒号
procDefId 断言 URL 已编码 / found:false 只返 found 键 / amis 信封解包);
DesignCenterPage.entrances 加 dc-process-modeler admin-only 断言。
全量 vitest 22 文件 112 例绿;tsc -b 干净;npm run build 成功(bpmn-js 进主 bundle)。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 10:34:47 +08:00
parent b391ee9f16
commit e131b8dee9
9 changed files with 539 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import { DesignCenterPage } from './pages/DesignCenterPage';
import { NewFeatureShell } from './pages/NewFeatureShell'; import { NewFeatureShell } from './pages/NewFeatureShell';
import { AiFeatureForm } from './pages/AiFeatureForm'; import { AiFeatureForm } from './pages/AiFeatureForm';
import { ModelerPage } from './pages/ModelerPage'; import { ModelerPage } from './pages/ModelerPage';
import { ProcessModelerPage } from './pages/ProcessModelerPage';
// 把 401 跳登录的 handler 注入 http 层(在路由上下文内,可用 navigate) // 把 401 跳登录的 handler 注入 http 层(在路由上下文内,可用 navigate)
function UnauthorizedBridge() { function UnauthorizedBridge() {
@@ -48,6 +49,8 @@ export default function App() {
<Route path="/ai-feature" element={<AiFeatureForm />} /> <Route path="/ai-feature" element={<AiFeatureForm />} />
{/* 建模器(五环第①环·元数据→表,仅管理员)*/} {/* 建模器(五环第①环·元数据→表,仅管理员)*/}
<Route path="/modeler" element={<ModelerPage />} /> <Route path="/modeler" element={<ModelerPage />} />
{/* 在线流程 Modeler(可编辑 BPMN 设计器,仅管理员)*/}
<Route path="/process-modeler" element={<ProcessModelerPage />} />
{/* 根路径默认跳工作台 */} {/* 根路径默认跳工作台 */}
<Route index element={<Navigate to="/workbench" replace />} /> <Route index element={<Navigate to="/workbench" replace />} />
</Route> </Route>

View File

@@ -0,0 +1,78 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
vi.mock('./http', () => ({ http: { get: vi.fn() } }));
import { http } from './http';
import { fetchProcDefSource, fetchProcessOptions } from './processModeler';
const mGet = vi.mocked(http.get);
beforeEach(() => {
mGet.mockReset();
});
describe('fetchProcDefSource', () => {
it('中文+冒号 procDefId 必须 encodeURIComponent 进 path', async () => {
mGet.mockResolvedValue({
data: { found: true, bpmnXml: '<x/>', idMap: {}, procDefKey: '总包合同交底', version: 3 },
});
// 真实库形态:中文流程名 + 冒号 + uuid
await fetchProcDefSource('总包合同交底:3:9b2f-uuid');
expect(mGet).toHaveBeenCalledTimes(1);
const url = mGet.mock.calls[0][0] as string;
expect(url).toBe(
'/api/workflow/process-definitions/' + encodeURIComponent('总包合同交底:3:9b2f-uuid') + '/source',
);
// 未编码的中文与裸冒号不得出现在 path segment 里
expect(url).not.toContain('总包合同交底');
expect(url).toContain('%E6%80%BB'); // 「总」的编码
});
it('found:false(后端省略 bpmnXml/idMap 键)不抛,只返回 found:false', async () => {
mGet.mockResolvedValue({ data: { found: false } });
const r = await fetchProcDefSource('PD-x');
expect(r).toEqual({ found: false });
expect('bpmnXml' in r).toBe(false);
});
it('found:true 时解构五字段', async () => {
mGet.mockResolvedValue({
data: { found: true, bpmnXml: '<def/>', idMap: { '总包合同交底': 'Proc_zbht' }, procDefKey: '总包合同交底', version: 5 },
});
const r = await fetchProcDefSource('PD-1');
expect(r).toEqual({
found: true,
bpmnXml: '<def/>',
idMap: { '总包合同交底': 'Proc_zbht' },
procDefKey: '总包合同交底',
version: 5,
});
});
});
describe('fetchProcessOptions', () => {
it('解 amis 信封 data.options 并映射字段', async () => {
mGet.mockResolvedValue({
data: {
status: 0,
msg: '',
data: { options: [{ label: '总包合同交底', value: '总包合同交底', id: 'PD:3:u', key: 'zbht', type: 'process' }] },
},
});
const opts = await fetchProcessOptions();
expect(opts).toEqual([{ label: '总包合同交底', value: '总包合同交底', id: 'PD:3:u', key: 'zbht' }]);
});
it('history 来源 id 为空时 id=undefined(前端据此过滤不可载入项)', async () => {
mGet.mockResolvedValue({
data: { data: { options: [{ label: '历史流程', value: '历史流程', id: null, key: null }] } },
});
const opts = await fetchProcessOptions();
expect(opts[0].id).toBeUndefined();
});
it('缺 options / 非数组时返回空数组不抛', async () => {
mGet.mockResolvedValue({ data: {} });
expect(await fetchProcessOptions()).toEqual([]);
});
});

90
src/api/processModeler.ts Normal file
View File

@@ -0,0 +1,90 @@
import { http } from './http';
/**
* 流程 Modeler(在线 BPMN 设计器)后端契约。
*
* 阶段 1 只用到「按 procDefId 取净化源 XML」。裸 JSON 派,防御性默认 found:false,
* 与 diagram.ts 同风格。网关端点由 T1.6 上线,本层照 design 契约先写。
*/
/** GET /api/workflow/process-definitions/{id}/source 的返回体。 */
export interface ProcDefSource {
/** 是否命中流程定义(无则 found:false,不抛)。 */
found: boolean;
/** BpmnIdSanitizer 净化后的 BPMN 2.0 XML(中文 id 已替换为 ASCII,供 moddle/Modeler 载入)。 */
bpmnXml?: string;
/** 净化映射 原id→净化id(发布时逆向还原用,本 task 仅存 ref,后续 task 用)。 */
idMap?: Record<string, string>;
/** 流程定义 key(存量多为中文,如「总包合同交底」)。 */
procDefKey?: string;
/** 流程定义版本号。 */
version?: number;
}
/**
* 按 procDefId 取净化后的存量流程源 XML(含可逆 idMap)。
*
* ⚠️ procDefId 必须编码进 path:真实库 1445 个流程的 id 形如「总包合同交底:3:<uuid>」
* (中文 + 冒号),不 encodeURIComponent 会破坏 path segment。
* found:false 时后端省略 bpmnXml/idMap 键——先判 found 再解构,不在 false 分支碰这些键。
*/
export async function fetchProcDefSource(procDefId: string): Promise<ProcDefSource> {
const { data } = await http.get<ProcDefSource>(
`/api/workflow/process-definitions/${encodeURIComponent(procDefId)}/source`,
);
if (!data?.found) {
return { found: false };
}
return {
found: true,
bpmnXml: data.bpmnXml ?? undefined,
idMap: data.idMap ?? undefined,
procDefKey: data.procDefKey ?? undefined,
version: data.version ?? undefined,
};
}
/**
* 存量流程选择器的一条选项。复用旧 ProcessSelectDialog 的数据源
* `/api/process-select/options`(amis 信封 {status,data:{options}})。
*
* - {@link id} 为 procDefId(source=processDefinition/model 时有值;history 来源为空,不可载入)。
* - {@link value}/{@link label} 均为流程名称(沿用旧口径 value==label==流程名)。
*/
export interface ProcessOption {
label: string;
value: string;
id?: string;
key?: string;
}
interface ProcessSelectEnvelope {
data?: { options?: unknown[] };
options?: unknown[];
}
interface RawOption {
label?: unknown;
value?: unknown;
id?: unknown;
key?: unknown;
}
/** GET /api/process-select/options —— 取存量流程选项(解 amis 信封,防御性返回数组)。 */
export async function fetchProcessOptions(q?: string): Promise<ProcessOption[]> {
const { data } = await http.get<ProcessSelectEnvelope>('/api/process-select/options', {
params: q ? { q } : undefined,
});
const raw = data?.data?.options ?? data?.options ?? [];
if (!Array.isArray(raw)) return [];
return raw.map((o) => {
const opt = (o ?? {}) as RawOption;
const label = opt.label != null ? String(opt.label) : opt.value != null ? String(opt.value) : '';
return {
label,
value: opt.value != null ? String(opt.value) : label,
id: opt.id != null && String(opt.id) !== '' ? String(opt.id) : undefined,
key: opt.key != null && String(opt.key) !== '' ? String(opt.key) : undefined,
};
});
}

View File

@@ -0,0 +1,6 @@
// bpmn-js-properties-panel 未随包发布类型声明(无 dist/*.d.ts、无 package.json types 字段)。
// 只声明本项目用到的两个标准模块(severe: 严禁引 Camunda provider,见 ProcessModelerPage)。
declare module 'bpmn-js-properties-panel' {
export const BpmnPropertiesPanelModule: unknown;
export const BpmnPropertiesProviderModule: unknown;
}

View File

@@ -30,10 +30,11 @@ describe('DesignCenterPage 入口按钮', () => {
profileMock.mockReset(); profileMock.mockReset();
}); });
it('admin 看到 [+ 新建功能] 与 [⚡ AI 建功能]', async () => { it('admin 看到 [流程设计] [+ 新建功能] 与 [⚡ AI 建功能]', async () => {
profileMock.mockReturnValue({ userId: 'ADMIN', account: 'admin', name: 'x', roles: [] }); profileMock.mockReturnValue({ userId: 'ADMIN', account: 'admin', name: 'x', roles: [] });
renderPage(); renderPage();
await waitFor(() => { await waitFor(() => {
expect(screen.getByTestId('dc-process-modeler')).toBeInTheDocument();
expect(screen.getByTestId('dc-new-feature')).toBeInTheDocument(); expect(screen.getByTestId('dc-new-feature')).toBeInTheDocument();
expect(screen.getByTestId('dc-ai-feature')).toBeInTheDocument(); expect(screen.getByTestId('dc-ai-feature')).toBeInTheDocument();
}); });
@@ -42,6 +43,7 @@ describe('DesignCenterPage 入口按钮', () => {
it('非 admin 不渲染入口(整页降级)', () => { it('非 admin 不渲染入口(整页降级)', () => {
profileMock.mockReturnValue({ userId: 'U1', account: 'zhangsan', name: 'z', roles: [] }); profileMock.mockReturnValue({ userId: 'U1', account: 'zhangsan', name: 'z', roles: [] });
renderPage(); renderPage();
expect(screen.queryByTestId('dc-process-modeler')).not.toBeInTheDocument();
expect(screen.queryByTestId('dc-new-feature')).not.toBeInTheDocument(); expect(screen.queryByTestId('dc-new-feature')).not.toBeInTheDocument();
expect(screen.queryByTestId('dc-ai-feature')).not.toBeInTheDocument(); expect(screen.queryByTestId('dc-ai-feature')).not.toBeInTheDocument();
}); });

View File

@@ -73,6 +73,14 @@ export function DesignCenterPage() {
</div> </div>
</div> </div>
<div style={{ flex: 1 }} /> <div style={{ flex: 1 }} />
<button
className="btn btn-sm"
data-testid="dc-process-modeler"
onClick={() => navigate('/process-modeler')}
title="在线流程设计器:可视化编辑存量 BPMN 流程 / 新建流程"
>
流程设计
</button>
<button <button
className="btn btn-sm" className="btn btn-sm"
data-testid="dc-new-feature" data-testid="dc-new-feature"

View File

@@ -0,0 +1,97 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, waitFor } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import { SYNTHETIC_BPMN } from '../modeler/moddle/fixtures/synthetic-full-surface.bpmn';
// bpmn-js Modeler:jsdom 跑不动真渲染,stub 成类(可断言 importXML/destroy 调用)。
const { importXMLMock, destroyMock, getMock, onMock, ModelerCtor } = vi.hoisted(() => {
const importXMLMock = vi.fn();
const destroyMock = vi.fn();
const getMock = vi.fn(() => ({}));
const onMock = vi.fn();
const ModelerCtor = vi.fn().mockImplementation(() => ({
importXML: importXMLMock,
destroy: destroyMock,
get: getMock,
on: onMock,
}));
return { importXMLMock, destroyMock, getMock, onMock, ModelerCtor };
});
vi.mock('bpmn-js/lib/Modeler', () => ({ default: ModelerCtor }));
// 标准属性面板模块只作为 additionalModules 配置项传入被 mock 的 Modeler,永不真正执行。
vi.mock('bpmn-js-properties-panel', () => ({
BpmnPropertiesPanelModule: {},
BpmnPropertiesProviderModule: {},
}));
vi.mock('../api/processModeler', () => ({
fetchProcDefSource: vi.fn(),
fetchProcessOptions: vi.fn(),
}));
vi.mock('../auth/token', async (importOriginal) => ({
...(await importOriginal<typeof import('../auth/token')>()),
getProfile: vi.fn(),
}));
import { ProcessModelerPage } from './ProcessModelerPage';
import { fetchProcDefSource, fetchProcessOptions } from '../api/processModeler';
import { getProfile } from '../auth/token';
const mSource = vi.mocked(fetchProcDefSource);
const mOptions = vi.mocked(fetchProcessOptions);
const mProfile = vi.mocked(getProfile);
function renderPage(initialPath = '/process-modeler') {
return render(
<MemoryRouter initialEntries={[initialPath]}>
<ProcessModelerPage />
</MemoryRouter>,
);
}
beforeEach(() => {
importXMLMock.mockReset().mockResolvedValue(undefined);
destroyMock.mockReset();
getMock.mockReset().mockReturnValue({});
onMock.mockReset();
ModelerCtor.mockClear();
mSource.mockReset().mockResolvedValue({ found: true, bpmnXml: SYNTHETIC_BPMN, idMap: { '总包合同交底': 'Proc_zbht' } });
mOptions.mockReset().mockResolvedValue([]);
mProfile.mockReset().mockReturnValue({ userId: 'ADMIN', account: 'admin', name: '管理员', roles: [] });
});
describe('ProcessModelerPage', () => {
it('admin 渲染画布容器与标准属性面板容器', () => {
renderPage();
expect(screen.getByTestId('process-modeler-canvas')).toBeInTheDocument();
expect(screen.getByTestId('process-modeler-props')).toBeInTheDocument();
});
it('非 admin 降级为「仅管理员可用」文案,不渲染画布', () => {
mProfile.mockReturnValue({ userId: 'U9', account: 'zhang', name: '张三', roles: [] });
renderPage();
expect(screen.getByText(/仅管理员可用/)).toBeInTheDocument();
expect(screen.queryByTestId('process-modeler-canvas')).not.toBeInTheDocument();
});
it('?procDefId= 时载入存量流程并把返回的 bpmnXml 交给 Modeler.importXML', async () => {
renderPage('/process-modeler?procDefId=PD-1');
await waitFor(() => expect(mSource).toHaveBeenCalledWith('PD-1'));
await waitFor(() => expect(importXMLMock).toHaveBeenCalledWith(SYNTHETIC_BPMN));
expect(ModelerCtor).toHaveBeenCalledTimes(1);
});
it('接口 found:false 时显示未找到文案且不 importXML', async () => {
mSource.mockResolvedValue({ found: false });
renderPage('/process-modeler?procDefId=PD-x');
await waitFor(() => expect(screen.getByText(/未找到|无 BPMN|加载失败/)).toBeInTheDocument());
expect(importXMLMock).not.toHaveBeenCalled();
});
it('无 procDefId 时展示「打开存量流程」选择器(数据源 process-select)', async () => {
mOptions.mockResolvedValue([{ label: '总包合同交底', value: '总包合同交底', id: 'PD-9', key: 'zbht' }]);
renderPage();
await waitFor(() => expect(mOptions).toHaveBeenCalled());
expect(screen.getByTestId('process-modeler-open-select')).toBeInTheDocument();
expect(await screen.findByText('总包合同交底')).toBeInTheDocument();
});
});

View File

@@ -0,0 +1,253 @@
// 在线流程 Modeler(B3)——可编辑 BPMN 设计器页骨架。
// 本阶段(T1.5)只做:admin 门 + 三栏布局 + bpmn-js Modeler 挂载 + 存量流程只读载入。
// EIP4 定制侧板(办理人/会签/formKey…)是 T2.4,本页右上只放占位容器;
// 「保存草稿」「发布」是 T2.5/T3.3,本页顶栏先放 disabled 占位按钮。
import { useEffect, useRef, useState } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import Modeler from 'bpmn-js/lib/Modeler';
import { BpmnPropertiesPanelModule, BpmnPropertiesProviderModule } from 'bpmn-js-properties-panel';
import 'bpmn-js/dist/assets/diagram-js.css';
import 'bpmn-js/dist/assets/bpmn-js.css';
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';
import '@bpmn-io/properties-panel/dist/assets/properties-panel.css';
import activitiModdle from '../modeler/moddle/activiti.json';
import { getProfile, isAdminProfile } from '../auth/token';
import { fetchProcDefSource, fetchProcessOptions, type ProcessOption } from '../api/processModeler';
// bpmn-js/lib/Modeler 自带类型,但选项对象里的标准面板模块(本项目无类型)与 moddle JSON
// 会与官方选项类型产生摩擦;照 ProcessDiagram 惯例把构造器收窄为本页用到的最小契约再实例化。
interface ModelerLike {
importXML(xml: string): Promise<unknown>;
destroy(): void;
get(service: string): unknown;
on(event: string, cb: (e: unknown) => void): void;
}
const ModelerCtor = Modeler as unknown as new (options: Record<string, unknown>) => ModelerLike;
type LoadState = 'idle' | 'loading' | 'ready' | 'error';
export function ProcessModelerPage() {
const profile = getProfile();
const isAdmin = isAdminProfile(profile);
const navigate = useNavigate();
const [params, setParams] = useSearchParams();
const procDefId = params.get('procDefId') ?? '';
const canvasRef = useRef<HTMLDivElement>(null);
const panelRef = useRef<HTMLDivElement>(null);
const modelerRef = useRef<ModelerLike | null>(null);
// 净化映射 原id→净化id:本阶段仅暂存,发布还原(T3.x)时用。
const idMapRef = useRef<Record<string, string>>({});
const [loadState, setLoadState] = useState<LoadState>('idle');
const [loadError, setLoadError] = useState('');
const [options, setOptions] = useState<ProcessOption[]>([]);
const [optionsError, setOptionsError] = useState('');
// 无参时拉存量流程选项(数据源复用旧 ProcessSelectDialog 端点)。
useEffect(() => {
if (!isAdmin || procDefId) return;
let alive = true;
fetchProcessOptions()
.then((opts) => alive && setOptions(opts))
.catch(() => alive && setOptionsError('存量流程列表加载失败'));
return () => {
alive = false;
};
}, [isAdmin, procDefId]);
// 有 procDefId 时挂载 Modeler 并载入净化后的存量 BPMN。
useEffect(() => {
if (!isAdmin || !procDefId) return;
let alive = true;
let modeler: ModelerLike | null = null;
setLoadState('loading');
setLoadError('');
(async () => {
try {
const src = await fetchProcDefSource(procDefId);
if (!alive) return;
if (!src.found || !src.bpmnXml) {
setLoadError('未找到该流程的 BPMN 源(可能未部署或无布局信息)');
setLoadState('error');
return;
}
if (!canvasRef.current) return;
modeler = new ModelerCtor({
container: canvasRef.current,
propertiesPanel: { parent: panelRef.current },
// ⚠️ 只载标准 BpmnPropertiesProviderModule,严禁引 Camunda provider——它会把
// camunda 描述符注进 moddle,与 activiti 描述符在 bpmn:UserTask 上同名扩展冲突
// (not allowed without redefines) 静默丢弃 userTask(T1.1 评审 M-3 实证)。
additionalModules: [BpmnPropertiesPanelModule, BpmnPropertiesProviderModule],
// ⚠️ moddleExtensions 只声明 activiti:语料 1509/3 两命名空间不混用,双载会因同名
// 扩展属性冲突静默丢弃 userTask;单载 activiti 时 flowable 文档经 moddle lax 往返零丢失。
moddleExtensions: { activiti: activitiModdle },
});
idMapRef.current = src.idMap ?? {};
await modeler.importXML(src.bpmnXml);
if (!alive) return;
modelerRef.current = modeler;
try {
const canvas = modeler.get('canvas') as { zoom(mode: string, point?: string): void };
canvas.zoom('fit-viewport', 'auto');
} catch {
/* stub / 无布局时忽略 */
}
setLoadState('ready');
} catch {
if (alive) {
setLoadError('流程加载失败');
setLoadState('error');
}
}
})();
return () => {
alive = false;
if (modeler) {
try {
modeler.destroy();
} catch {
/* 视图已卸载 */
}
}
modelerRef.current = null;
};
}, [isAdmin, procDefId]);
if (!isAdmin) {
return <div style={{ padding: 24, color: 'var(--text-3)' }}>流程设计器仅管理员可用。</div>;
}
function openProcess(id: string) {
if (id) setParams({ procDefId: id });
}
const loadableOptions = options.filter((o) => !!o.id);
return (
<div
data-testid="process-modeler-root"
style={{ display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' }}
>
{/* 顶栏 */}
<div
style={{
height: 48,
display: 'flex',
alignItems: 'center',
gap: 12,
padding: '0 16px',
borderBottom: '1px solid var(--line)',
flexShrink: 0,
}}
>
<span style={{ fontWeight: 600, fontSize: 15 }}>流程设计器</span>
<span className="muted" style={{ fontSize: 12, flex: 1 }}>
{procDefId ? `已打开:${procDefId}` : '在线编辑 BPMN 流程定义(可编辑存量 / 新建)'}
</span>
<button className="btn btn-sm" data-testid="process-modeler-save-draft" disabled title="保存草稿(下阶段)">
保存草稿
</button>
<button className="btn btn-sm btn-primary" data-testid="process-modeler-publish" disabled title="发布(下阶段)">
发布
</button>
<button className="btn btn-sm" data-testid="process-modeler-back" onClick={() => navigate('/design-center')}>
返回
</button>
</div>
{/* 主体:左画布 + 右栏(上=EIP4 侧板占位 / 下=标准属性面板) */}
<div style={{ flex: 1, display: 'flex', minHeight: 0 }}>
<div style={{ flex: 1, position: 'relative', minWidth: 0, background: '#fff' }}>
<div ref={canvasRef} data-testid="process-modeler-canvas" style={{ width: '100%', height: '100%' }} />
{/* 未打开任何流程:叠加「打开存量流程」选择器 + 新建占位 */}
{!procDefId ? (
<div
style={{
position: 'absolute',
inset: 0,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
gap: 12,
background: 'var(--surface, #fff)',
}}
>
<div style={{ color: 'var(--text-3)', fontSize: 13 }}>选择一个存量流程开始编辑</div>
<select
data-testid="process-modeler-open-select"
defaultValue=""
onChange={(e) => openProcess(e.target.value)}
style={{ minWidth: 280, padding: '6px 8px' }}
>
<option value="">打开存量流程…</option>
{loadableOptions.map((o) => (
<option key={o.id} value={o.id}>
{o.label}
</option>
))}
</select>
{optionsError ? (
<div style={{ color: 'var(--err)', fontSize: 12 }}>{optionsError}</div>
) : null}
<button className="btn btn-sm" data-testid="process-modeler-new" disabled title="新建流程(下阶段)">
+ 新建流程
</button>
</div>
) : null}
{/* 载入中 / 载入失败 */}
{procDefId && loadState === 'loading' ? (
<div style={overlayMsgStyle('var(--text-3)')} data-testid="process-modeler-loading">
加载流程中…
</div>
) : null}
{procDefId && loadState === 'error' ? (
<div style={overlayMsgStyle('var(--warn, #d48806)')} data-testid="process-modeler-error">
{loadError}
</div>
) : null}
</div>
<div
style={{
width: 360,
flexShrink: 0,
borderLeft: '1px solid var(--line)',
display: 'flex',
flexDirection: 'column',
minHeight: 0,
}}
>
{/* EIP4 定制侧板占位(办理人/会签/formKey…由 T2.4 接入) */}
<div
data-testid="process-modeler-eip4-panel"
style={{ padding: 12, borderBottom: '1px solid var(--line)', color: 'var(--text-3)', fontSize: 12 }}
>
EIP4 定制控件(办理人 / 会签 / formKey)将在此叠加,下阶段接入。
</div>
{/* 标准属性面板宿主(bpmn-js-properties-panel 渲染进此容器) */}
<div data-testid="process-modeler-props" style={{ flex: 1, overflow: 'auto', minHeight: 0 }} />
</div>
</div>
</div>
);
}
function overlayMsgStyle(color: string): React.CSSProperties {
return {
position: 'absolute',
top: 16,
left: 16,
padding: '8px 12px',
background: 'rgba(255,255,255,0.92)',
borderRadius: 4,
color,
fontSize: 13,
};
}

View File

@@ -8,6 +8,7 @@
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"moduleDetection": "force", "moduleDetection": "force",
"noEmit": true, "noEmit": true,