mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
🔱: [client] sync upgrade with 8 commits [trident-sync]
perf: 增加自定义组件示例 Merge remote-tracking branch 'origin/main' refactor: fs-bpmn refactor: integration fs-bpmn refactor: 集成fs-bpmn refactor: refactor: 优化i18n
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
import "@fast-crud/fast-bpmn/dist/style.css";
|
||||
import FastBpmn, { FsBpmnSetupOptions, PanelComponentItem, Base, Shape } from "@fast-crud/fast-bpmn";
|
||||
|
||||
const fsBpmnOpts: FsBpmnSetupOptions = {
|
||||
// 注册panel公共组件
|
||||
// @ts-ignore
|
||||
registerPanelComponents(element: Base): Record<string, PanelComponentItem> {
|
||||
return {};
|
||||
},
|
||||
//自定义增强contextPad
|
||||
createEnhancementContextPadActions(provider) {
|
||||
const actions: Record<string, any> = {};
|
||||
const appendUserTask = (event: Event, element: Shape) => {
|
||||
const shape = provider.elementFactory.createShape({ type: "bpmn:UserTask" });
|
||||
provider.create.start(event, shape, {
|
||||
source: element
|
||||
});
|
||||
};
|
||||
|
||||
const append = provider.autoPlace
|
||||
? // @ts-ignore
|
||||
(event: Event, element: Shape) => {
|
||||
const shape = provider.elementFactory.createShape({ type: "bpmn:UserTask" });
|
||||
provider.autoPlace.append(element, shape);
|
||||
}
|
||||
: appendUserTask;
|
||||
|
||||
// 添加创建用户任务按钮
|
||||
actions["append.append-user-task"] = {
|
||||
group: "model",
|
||||
className: "bpmn-icon-user-task",
|
||||
title: "用户任务",
|
||||
action: {
|
||||
dragstart: appendUserTask,
|
||||
click: append
|
||||
}
|
||||
};
|
||||
|
||||
// 添加一个与edit一组的按钮
|
||||
actions["enhancement-op-1"] = {
|
||||
group: "edit",
|
||||
className: "enhancement-op",
|
||||
title: "扩展操作1",
|
||||
action: {
|
||||
// @ts-ignore
|
||||
click: function (e: Event) {
|
||||
alert("点击 扩展操作1");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 添加一个新分组的自定义按钮
|
||||
actions["enhancement-op"] = {
|
||||
group: "enhancement",
|
||||
className: "enhancement-op",
|
||||
title: "扩展操作2",
|
||||
action: {
|
||||
// @ts-ignore
|
||||
click: function (e: Event) {
|
||||
alert("点击 扩展操作2");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return actions;
|
||||
},
|
||||
|
||||
//自定义重写contextPad
|
||||
// @ts-ignore
|
||||
createRewriteContextPadActions(provider: any, element: Base) {
|
||||
const actions: Record<string, any> = {};
|
||||
|
||||
// 添加一个与edit一组的按钮
|
||||
actions["enhancement-op-1"] = {
|
||||
group: "edit",
|
||||
className: "enhancement-op",
|
||||
title: "扩展操作1",
|
||||
action: {
|
||||
// @ts-ignore
|
||||
click: function (e: Event) {
|
||||
alert("点击 扩展操作1");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 添加一个新分组的自定义按钮
|
||||
actions["enhancement-op"] = {
|
||||
group: "enhancement",
|
||||
className: "enhancement-op",
|
||||
title: "扩展操作2",
|
||||
action: {
|
||||
// @ts-ignore
|
||||
click: function (e: Event) {
|
||||
alert("点击 扩展操作2");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return actions;
|
||||
}
|
||||
} as FsBpmnSetupOptions;
|
||||
|
||||
export default function (app: any, i18n: any) {
|
||||
fsBpmnOpts.i18n = i18n.global;
|
||||
app.use(FastBpmn, fsBpmnOpts);
|
||||
}
|
||||
@@ -2,9 +2,12 @@ import "./iconify";
|
||||
import "./iconfont";
|
||||
import FastCrud from "./fast-crud";
|
||||
import permission from "./permission";
|
||||
import FsBpmn from "./bpmn";
|
||||
|
||||
function install(app: any, options: any = {}) {
|
||||
app.use(FastCrud, options);
|
||||
app.use(permission);
|
||||
app.use(FsBpmn, options.i18n);
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
Reference in New Issue
Block a user