@gct-paas/core-web 0.1.6-dev.5 → 0.1.6-dev.6
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/dist/ColorPicker-DGQQb8I7.js +1 -0
- package/dist/{_plugin-vue_export-helper-59SbqtUR.js → _plugin-vue_export-helper-C9hXqKoS.js} +1 -1
- package/dist/{de_DE-BnwOalCV.js → de_DE-B3f8kAv-.js} +1 -1
- package/dist/diagram-config-item-C5Ha2XJq.js +1 -0
- package/dist/diagram-config-item-reverse-ChoxnW-Z.js +1 -0
- package/dist/diagram-config-item-virtual-Cbmggfwt.js +1 -0
- package/dist/{en_US-6Hw6WWah.js → en_US-BSG3Kz6v.js} +1 -1
- package/dist/{es_ES-tAqXFGrR.js → es_ES-BGP8IOmQ.js} +1 -1
- package/dist/{fr_FR-BkDgVS_P.js → fr_FR-Y-6CzjUq.js} +1 -1
- package/dist/hooks-yX21uJ6d.js +1 -0
- package/dist/index.min.css +1 -1
- package/dist/{ja_JP-AsmV92nC.js → ja_JP-CDlH1v8M.js} +1 -1
- package/dist/loader.esm.min.js +1 -1
- package/dist/{monaco-editor-CgESUPw_.js → monaco-editor-BTqXEIZI.js} +1 -1
- package/dist/{pt_PT-CCVWOJzE.js → pt_PT-N-iIoE2_.js} +1 -1
- package/dist/relationship-diagram-config-DstwwXCO.js +1 -0
- package/dist/{ru_RU-w4sUgbzL.js → ru_RU--ESLRHrj.js} +1 -1
- package/dist/template-1ZQd8Z1w.js +1 -0
- package/dist/{tr_TR-CGZch3eB.js → tr_TR-BOIykdZO.js} +1 -1
- package/dist/{vi_VN-DONxIDR7.js → vi_VN-CmVoM2Rw.js} +1 -1
- package/dist/{zh_CN-BxdD8hqG.js → zh_CN-DhsO5Qwx.js} +1 -1
- package/dist/{zh_TW-D5Y8j-oG.js → zh_TW-DWdp2kVo.js} +1 -1
- package/es/components/UserPick/src/user-pick.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/es/components/base-button/base-button.vue.mjs +1 -1
- package/es/components/field-cascader/src/hooks.d.ts +1 -0
- package/es/components/label-design/modal/template.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/es/components/label-design/panels/modals/diff-modal.vue_vue_type_script_setup_true_lang.mjs +2 -2
- package/es/components/label-design/panels/panel.vue_vue_type_script_setup_true_lang.mjs +1 -1
- package/es/components/label-design/panels/widget/controls/ImageData.vue.mjs +2 -2
- package/es/components/label-design/panels/widget/controls/ImageData.vue_vue_type_script_setup_true_name_image-data_lang.mjs +2 -2
- package/es/components/label-design/panels/widget/controls/ImageData.vue_vue_type_style_index_0_scoped_9232a443_lang.css +3 -0
- package/es/components/label-design/stage/stage.vue.d.ts +9 -0
- package/es/components/label-design/stage/stage.vue.mjs +2 -2
- package/es/components/label-design/stage/stage.vue_vue_type_script_setup_true_lang.mjs +2 -1
- package/es/components/label-design/stage/{stage.vue_vue_type_style_index_0_scoped_53b1f897_lang.css → stage.vue_vue_type_style_index_0_scoped_9275e9fb_lang.css} +8 -8
- package/es/components/layout/view-container/view-container.d.ts +1 -11
- package/es/components/layout/view-container/view-container.mjs +10 -14
- package/es/create-app-vue.mjs +4 -2
- package/es/index.d.ts +3 -2
- package/es/index.mjs +25 -24
- package/es/modules/color-picker/src/color-editor.vue.mjs +1 -1
- package/es/modules/gct-form/controller/form-item-basic/form-item-basic.controller.mjs +2 -0
- package/es/modules/gct-form/controller/gct-form/gct-form.controller.mjs +1 -0
- package/es/modules/gct-table/controller/gct-table/gct-table.controller.mjs +1 -0
- package/es/modules/gct-table/controller/table-item/table-item.controller.mjs +2 -0
- package/es/modules/gct-table/controller/table-row/table-row.controller.mjs +3 -0
- package/es/modules/global-modal/src/components/ModalWrapper.vue_vue_type_script_lang.mjs +1 -4
- package/es/modules/print-tmpl/print-tmpl-modal.vue_vue_type_script_setup_true_name_print-tmpl-modal_lang.mjs +2 -2
- package/es/modules/relationship-diagram-config/cache.controller.d.ts +70 -0
- package/es/modules/relationship-diagram-config/cache.controller.mjs +128 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item/diagram-config-item.css +123 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item/diagram-config-item.d.ts +381 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item/diagram-config-item.mjs +98 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-container/diagram-config-item-container.css +71 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-container/diagram-config-item-container.d.ts +28 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-container/diagram-config-item-container.mjs +53 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-info/diagram-config-item-info.d.ts +27 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-info/diagram-config-item-info.mjs +2 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-reverse/diagram-config-item-reverse.css +107 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-reverse/diagram-config-item-reverse.d.ts +34 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-reverse/diagram-config-item-reverse.mjs +198 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-virtual/diagram-config-item-virtual.css +68 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-virtual/diagram-config-item-virtual.d.ts +31 -0
- package/es/modules/relationship-diagram-config/components/diagram-config-item-virtual/diagram-config-item-virtual.mjs +53 -0
- package/es/modules/relationship-diagram-config/components/index.d.ts +5 -0
- package/es/modules/relationship-diagram-config/components/index.mjs +5 -0
- package/es/modules/relationship-diagram-config/constant/index.d.ts +72 -0
- package/es/modules/relationship-diagram-config/constant/index.mjs +70 -0
- package/es/modules/relationship-diagram-config/hooks/index.d.ts +10 -0
- package/es/modules/relationship-diagram-config/hooks/index.mjs +19 -0
- package/es/modules/relationship-diagram-config/index.d.ts +6 -0
- package/es/modules/relationship-diagram-config/index.mjs +28 -0
- package/es/modules/relationship-diagram-config/interface/i-link-provider/i-link-provider.d.ts +57 -0
- package/es/modules/relationship-diagram-config/interface/i-node-provider/i-node-provider.d.ts +18 -0
- package/es/modules/relationship-diagram-config/interface/i-relationship-diagram-link/i-relationship-diagram-link.d.ts +80 -0
- package/es/modules/relationship-diagram-config/interface/i-relationship-diagram-node/i-relationship-diagram-node.d.ts +82 -0
- package/es/modules/relationship-diagram-config/interface/i-relationship-diagram-options/i-relationship-diagram-options.d.ts +51 -0
- package/es/modules/relationship-diagram-config/interface/i-rule-config/i-rule-config.d.ts +135 -0
- package/es/modules/relationship-diagram-config/interface/index.d.ts +6 -0
- package/es/modules/relationship-diagram-config/link.controller.d.ts +75 -0
- package/es/modules/relationship-diagram-config/link.controller.mjs +121 -0
- package/es/modules/relationship-diagram-config/node.controller.d.ts +102 -0
- package/es/modules/relationship-diagram-config/node.controller.mjs +189 -0
- package/es/modules/relationship-diagram-config/plumb-plugin/arrow-endpoint.d.ts +23 -0
- package/es/modules/relationship-diagram-config/plumb-plugin/arrow-endpoint.mjs +33 -0
- package/es/modules/relationship-diagram-config/plumb-plugin/blank-endpoint-renderer.d.ts +1 -0
- package/es/modules/relationship-diagram-config/plumb-plugin/blank-endpoint-renderer.mjs +27 -0
- package/es/modules/relationship-diagram-config/plumb-plugin/index.d.ts +3 -0
- package/es/modules/relationship-diagram-config/plumb-plugin/index.mjs +2 -0
- package/es/modules/relationship-diagram-config/providers/default-link-provider/default-link-provider.css +132 -0
- package/es/modules/relationship-diagram-config/providers/default-link-provider/default-link-provider.d.ts +21 -0
- package/es/modules/relationship-diagram-config/providers/default-link-provider/default-link-provider.mjs +184 -0
- package/es/modules/relationship-diagram-config/providers/default-node-provider/default-node-provider.d.ts +14 -0
- package/es/modules/relationship-diagram-config/providers/default-node-provider/default-node-provider.mjs +17 -0
- package/es/modules/relationship-diagram-config/providers/index.d.ts +5 -0
- package/es/modules/relationship-diagram-config/providers/index.mjs +5 -0
- package/es/modules/relationship-diagram-config/providers/reverse-node-provider/reverse-node-provider.d.ts +14 -0
- package/es/modules/relationship-diagram-config/providers/reverse-node-provider/reverse-node-provider.mjs +17 -0
- package/es/modules/relationship-diagram-config/providers/virtual-link-provider/virtual-link-provider.d.ts +16 -0
- package/es/modules/relationship-diagram-config/providers/virtual-link-provider/virtual-link-provider.mjs +26 -0
- package/es/modules/relationship-diagram-config/providers/virtual-node-provider/virtual-node-provider.d.ts +14 -0
- package/es/modules/relationship-diagram-config/providers/virtual-node-provider/virtual-node-provider.mjs +17 -0
- package/es/modules/relationship-diagram-config/relationship-diagram-config.controller.d.ts +119 -0
- package/es/modules/relationship-diagram-config/relationship-diagram-config.controller.mjs +199 -0
- package/es/modules/relationship-diagram-config/relationship-diagram-config.css +113 -0
- package/es/modules/relationship-diagram-config/relationship-diagram-config.d.ts +102 -0
- package/es/modules/relationship-diagram-config/relationship-diagram-config.mjs +104 -0
- package/es/modules/relationship-diagram-config/relationship-diagram-config.state.d.ts +44 -0
- package/es/modules/relationship-diagram-config/relationship-diagram-config.state.mjs +46 -0
- package/es/modules/relationship-diagram-config/utils/index.d.ts +1 -0
- package/es/modules/relationship-diagram-config/utils/register/register.d.ts +71 -0
- package/es/modules/relationship-diagram-config/utils/register/register.mjs +81 -0
- package/es/utils/recursive.mjs +1 -0
- package/package.json +10 -9
- package/dist/components-Dw_doMp_.js +0 -1
- package/dist/template-tzWsbHZE.js +0 -1
- package/es/components/label-design/panels/widget/controls/ImageData.vue_vue_type_style_index_0_scoped_3c4a9733_lang.css +0 -3
- /package/dist/{JsBarcode-DlXSdlvD.js → JsBarcode-DY53cVJ6.js} +0 -0
- /package/dist/{cropper-tw7tUDDe.js → cropper-DK_hFgpO.js} +0 -0
- /package/dist/{icon-next-picker-B_S_yInJ.js → icon-next-picker-DYiHqnNR.js} +0 -0
- /package/dist/{objectSpread2-DxfE1S3_.js → objectSpread2-DARadIQB.js} +0 -0
- /package/dist/{overlayscrollbars-vue-DtKFrHnA.js → overlayscrollbars-vue-Df-3wShc.js} +0 -0
- /package/dist/{rich-editor-K2Pv0Uja.js → rich-editor-DVOriJH0.js} +0 -0
- /package/dist/{useMonacoEditor-BO2ALW-7.js → useMonacoEditor-DqSQTg7b.js} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { LinkType } from "./constant/index.mjs";
|
|
2
|
+
import "./relationship-diagram-config.controller.mjs";
|
|
3
|
+
import { uuid } from "@jsplumb/browser-ui";
|
|
4
|
+
//#region src/modules/relationship-diagram-config/link.controller.ts
|
|
5
|
+
/**
|
|
6
|
+
* 连线控制器
|
|
7
|
+
*
|
|
8
|
+
* @author zhanghanrui
|
|
9
|
+
* @date 2024-06-25 14:06:19
|
|
10
|
+
* @export
|
|
11
|
+
* @class LinkController
|
|
12
|
+
*/
|
|
13
|
+
var LinkController = class {
|
|
14
|
+
c;
|
|
15
|
+
constructor(c) {
|
|
16
|
+
this.c = c;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 创建连线
|
|
20
|
+
*
|
|
21
|
+
* @author zhanghanrui
|
|
22
|
+
* @date 2024-06-26 16:06:24
|
|
23
|
+
* @param {IData} data
|
|
24
|
+
* @return {*} {IRelationshipDiagramLink}
|
|
25
|
+
*/
|
|
26
|
+
create(data) {
|
|
27
|
+
const i = this.c.state.links.length;
|
|
28
|
+
const link = {
|
|
29
|
+
id: uuid(),
|
|
30
|
+
i,
|
|
31
|
+
type: LinkType.DEFAULT,
|
|
32
|
+
reverse: false,
|
|
33
|
+
return: (i + 1) % this.c.config.lineCount === 0,
|
|
34
|
+
startLine: Math.floor(i / 3) + 1,
|
|
35
|
+
dashed: false,
|
|
36
|
+
...data
|
|
37
|
+
};
|
|
38
|
+
this.c.state.links.push(link);
|
|
39
|
+
setTimeout(() => {
|
|
40
|
+
this.c.connect(link);
|
|
41
|
+
}, 0);
|
|
42
|
+
return link;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 更新连线数据
|
|
46
|
+
*
|
|
47
|
+
* @author zhanghanrui
|
|
48
|
+
* @date 2024-06-25 14:06:51
|
|
49
|
+
* @param {IRelationshipDiagramLink} link
|
|
50
|
+
*/
|
|
51
|
+
update(link) {
|
|
52
|
+
const data = this.get(link.id);
|
|
53
|
+
if (data) {
|
|
54
|
+
this.clearLinks([link]);
|
|
55
|
+
Object.assign(data, link);
|
|
56
|
+
this.c.connect(link);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* 获取连线数据
|
|
61
|
+
*
|
|
62
|
+
* @author zhanghanrui
|
|
63
|
+
* @date 2024-06-25 14:06:43
|
|
64
|
+
* @param {string} id
|
|
65
|
+
* @return {*} {(IRelationshipDiagramLink | null)}
|
|
66
|
+
*/
|
|
67
|
+
get(id) {
|
|
68
|
+
return this.c.state.links.find((link) => link.id === id) ?? null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 根据起始节点查找连线
|
|
72
|
+
*
|
|
73
|
+
* @author zhanghanrui
|
|
74
|
+
* @date 2024-06-25 14:06:19
|
|
75
|
+
* @param {string} source
|
|
76
|
+
* @return {*} {(IRelationshipDiagramLink | null)}
|
|
77
|
+
*/
|
|
78
|
+
getBySource(source) {
|
|
79
|
+
return this.c.state.links.find((link) => link.source === source) ?? null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 根据结束节点查找连线
|
|
83
|
+
*
|
|
84
|
+
* @author zhanghanrui
|
|
85
|
+
* @date 2024-06-25 14:06:50
|
|
86
|
+
* @param {string} target
|
|
87
|
+
* @return {*} {(IRelationshipDiagramLink | null)}
|
|
88
|
+
*/
|
|
89
|
+
getByTarget(target) {
|
|
90
|
+
return this.c.state.links.find((link) => link.target === target) ?? null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 删除连线数据,删除当前指定连线后所有数据
|
|
94
|
+
*
|
|
95
|
+
* @author zhanghanrui
|
|
96
|
+
* @date 2024-06-25 14:06:48
|
|
97
|
+
* @param {string} id
|
|
98
|
+
*/
|
|
99
|
+
delete(id) {
|
|
100
|
+
const i = this.c.state.links.findIndex((link) => link.id === id);
|
|
101
|
+
if (i !== -1) {
|
|
102
|
+
const links = this.c.state.links.splice(i, this.c.state.links.length);
|
|
103
|
+
this.clearLinks(links);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 清除已经绘制的连线
|
|
108
|
+
*
|
|
109
|
+
* @author zhanghanrui
|
|
110
|
+
* @date 2024-06-27 13:06:08
|
|
111
|
+
* @protected
|
|
112
|
+
* @param {IRelationshipDiagramLink[]} links
|
|
113
|
+
*/
|
|
114
|
+
clearLinks(links) {
|
|
115
|
+
this.c.plumb.getConnections().forEach((item) => {
|
|
116
|
+
if (links.find((_) => item.data.id === _.id)) this.c.plumb.deleteConnection(item);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
//#endregion
|
|
121
|
+
export { LinkController };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { IRelationshipDiagramNode } from './interface';
|
|
2
|
+
import { RelationshipDiagramConfigController } from './relationship-diagram-config.controller';
|
|
3
|
+
import { CacheController } from './cache.controller';
|
|
4
|
+
/**
|
|
5
|
+
* 节点控制器
|
|
6
|
+
*
|
|
7
|
+
* @author zhanghanrui
|
|
8
|
+
* @date 2024-06-25 14:06:28
|
|
9
|
+
* @export
|
|
10
|
+
* @class NodeController
|
|
11
|
+
*/
|
|
12
|
+
export declare class NodeController {
|
|
13
|
+
/**
|
|
14
|
+
* 节点切换缓存
|
|
15
|
+
*
|
|
16
|
+
* @author zhanghanrui
|
|
17
|
+
* @date 2024-06-30 12:06:00
|
|
18
|
+
* @type {CacheController}
|
|
19
|
+
*/
|
|
20
|
+
readonly cache: CacheController;
|
|
21
|
+
protected readonly c: RelationshipDiagramConfigController;
|
|
22
|
+
constructor(c: RelationshipDiagramConfigController);
|
|
23
|
+
/**
|
|
24
|
+
* 创建节点
|
|
25
|
+
*
|
|
26
|
+
* @author zhanghanrui
|
|
27
|
+
* @date 2024-06-28 15:06:36
|
|
28
|
+
* @param {IData} data
|
|
29
|
+
* @param {IData} [link={}] 创建节点时会同步创建连线
|
|
30
|
+
* @return {*} {(IRelationshipDiagramNode | null)}
|
|
31
|
+
*/
|
|
32
|
+
create(data: IData, link?: IData): IRelationshipDiagramNode | null;
|
|
33
|
+
/**
|
|
34
|
+
* 更新节点信息
|
|
35
|
+
*
|
|
36
|
+
* @author zhanghanrui
|
|
37
|
+
* @date 2024-06-29 15:06:40
|
|
38
|
+
* @param {IRelationshipDiagramNode} node
|
|
39
|
+
* @return {*} {void}
|
|
40
|
+
*/
|
|
41
|
+
update(node: IRelationshipDiagramNode): void;
|
|
42
|
+
/**
|
|
43
|
+
* 获取节点数据
|
|
44
|
+
*
|
|
45
|
+
* @author zhanghanrui
|
|
46
|
+
* @date 2024-06-28 13:06:48
|
|
47
|
+
* @param {string} id
|
|
48
|
+
* @param {number} [offset=0]
|
|
49
|
+
* @param {boolean} [isClone=true]
|
|
50
|
+
* @return {*} {(IRelationshipDiagramNode | null)}
|
|
51
|
+
*/
|
|
52
|
+
get(id: string, offset?: number, isClone?: boolean): IRelationshipDiagramNode | null;
|
|
53
|
+
/**
|
|
54
|
+
* 设置值,重新赋值一下,避免无法触发界面重绘
|
|
55
|
+
*
|
|
56
|
+
* @author zhanghanrui
|
|
57
|
+
* @date 2024-06-27 19:06:31
|
|
58
|
+
* @param {IRelationshipDiagramNode} node
|
|
59
|
+
*/
|
|
60
|
+
set(node: IRelationshipDiagramNode): void;
|
|
61
|
+
/**
|
|
62
|
+
* 删除节点数据,会删除节点以及之后所有的节点数据
|
|
63
|
+
*
|
|
64
|
+
* @author zhanghanrui
|
|
65
|
+
* @date 2024-06-28 13:06:06
|
|
66
|
+
* @param {string} id
|
|
67
|
+
* @param {boolean} [deleteLine=true] 默认同时删除连线
|
|
68
|
+
*/
|
|
69
|
+
delete(id: string, deleteLine?: boolean): void;
|
|
70
|
+
/**
|
|
71
|
+
* 节点绘制完毕
|
|
72
|
+
*
|
|
73
|
+
* @author zhanghanrui
|
|
74
|
+
* @date 2024-06-25 14:06:08
|
|
75
|
+
* @param {string} _id
|
|
76
|
+
*/
|
|
77
|
+
mounted(_id: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* 节点销毁
|
|
80
|
+
*
|
|
81
|
+
* @author zhanghanrui
|
|
82
|
+
* @date 2024-06-25 14:06:16
|
|
83
|
+
* @param {string} _id
|
|
84
|
+
*/
|
|
85
|
+
unmounted(_id: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* 设置节点
|
|
88
|
+
*
|
|
89
|
+
* @author zhanghanrui
|
|
90
|
+
* @date 2024-06-29 16:06:58
|
|
91
|
+
* @param {IRelationshipDiagramNode[]} nodes
|
|
92
|
+
*/
|
|
93
|
+
setNodes(nodes: IRelationshipDiagramNode[], isSetFirst?: boolean): void;
|
|
94
|
+
/**
|
|
95
|
+
* 当前所有节点引用
|
|
96
|
+
*
|
|
97
|
+
* @author zhanghanrui
|
|
98
|
+
* @date 2024-06-30 12:06:41
|
|
99
|
+
* @return {*} {IRelationshipDiagramNode[]}
|
|
100
|
+
*/
|
|
101
|
+
getNodes(): IRelationshipDiagramNode[];
|
|
102
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { LinkType, NodeType } from "./constant/index.mjs";
|
|
2
|
+
import { CacheController } from "./cache.controller.mjs";
|
|
3
|
+
import "./relationship-diagram-config.controller.mjs";
|
|
4
|
+
import { clone, uuid } from "@jsplumb/browser-ui";
|
|
5
|
+
//#region src/modules/relationship-diagram-config/node.controller.ts
|
|
6
|
+
/**
|
|
7
|
+
* 节点控制器
|
|
8
|
+
*
|
|
9
|
+
* @author zhanghanrui
|
|
10
|
+
* @date 2024-06-25 14:06:28
|
|
11
|
+
* @export
|
|
12
|
+
* @class NodeController
|
|
13
|
+
*/
|
|
14
|
+
var NodeController = class {
|
|
15
|
+
/**
|
|
16
|
+
* 节点切换缓存
|
|
17
|
+
*
|
|
18
|
+
* @author zhanghanrui
|
|
19
|
+
* @date 2024-06-30 12:06:00
|
|
20
|
+
* @type {CacheController}
|
|
21
|
+
*/
|
|
22
|
+
cache;
|
|
23
|
+
c;
|
|
24
|
+
constructor(c) {
|
|
25
|
+
this.c = c;
|
|
26
|
+
this.cache = new CacheController(c);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 创建节点
|
|
30
|
+
*
|
|
31
|
+
* @author zhanghanrui
|
|
32
|
+
* @date 2024-06-28 15:06:36
|
|
33
|
+
* @param {IData} data
|
|
34
|
+
* @param {IData} [link={}] 创建节点时会同步创建连线
|
|
35
|
+
* @return {*} {(IRelationshipDiagramNode | null)}
|
|
36
|
+
*/
|
|
37
|
+
create(data, link = {}) {
|
|
38
|
+
if (this.c.config.max != null && this.c.config.max <= this.c.state.nodes.length) {
|
|
39
|
+
console.warn("节点数量已达到最大值");
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (this.c.config.reverseMax != null) {
|
|
43
|
+
if (this.c.state.nodes.filter((node) => node.type === NodeType.REVERSE).length >= this.c.config.reverseMax) {
|
|
44
|
+
console.warn("反向节点数量已达到最大值");
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const node = {
|
|
49
|
+
id: uuid(),
|
|
50
|
+
type: NodeType.DEFAULT,
|
|
51
|
+
noSelectField: false,
|
|
52
|
+
reverse: false,
|
|
53
|
+
...data
|
|
54
|
+
};
|
|
55
|
+
const beforeNode = this.c.state.nodes[this.c.state.nodes.length - 1];
|
|
56
|
+
this.c.state.nodes.push(node);
|
|
57
|
+
setTimeout(() => {
|
|
58
|
+
this.c.link.create({
|
|
59
|
+
source: link.reverse ? node.id : beforeNode.id,
|
|
60
|
+
target: link.reverse ? beforeNode.id : node.id,
|
|
61
|
+
...link
|
|
62
|
+
});
|
|
63
|
+
}, 0);
|
|
64
|
+
return node;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 更新节点信息
|
|
68
|
+
*
|
|
69
|
+
* @author zhanghanrui
|
|
70
|
+
* @date 2024-06-29 15:06:40
|
|
71
|
+
* @param {IRelationshipDiagramNode} node
|
|
72
|
+
* @return {*} {void}
|
|
73
|
+
*/
|
|
74
|
+
update(node) {
|
|
75
|
+
const data = this.get(node.id, 0, false);
|
|
76
|
+
if (data) this.set(Object.assign(data, node));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 获取节点数据
|
|
80
|
+
*
|
|
81
|
+
* @author zhanghanrui
|
|
82
|
+
* @date 2024-06-28 13:06:48
|
|
83
|
+
* @param {string} id
|
|
84
|
+
* @param {number} [offset=0]
|
|
85
|
+
* @param {boolean} [isClone=true]
|
|
86
|
+
* @return {*} {(IRelationshipDiagramNode | null)}
|
|
87
|
+
*/
|
|
88
|
+
get(id, offset = 0, isClone = true) {
|
|
89
|
+
const i = this.c.state.nodes.findIndex((node) => node.id === id);
|
|
90
|
+
if (i !== -1 && this.c.state.nodes.length > i + offset) {
|
|
91
|
+
if (isClone) return clone(this.c.state.nodes[i + offset]);
|
|
92
|
+
return this.c.state.nodes[i + offset];
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 设置值,重新赋值一下,避免无法触发界面重绘
|
|
98
|
+
*
|
|
99
|
+
* @author zhanghanrui
|
|
100
|
+
* @date 2024-06-27 19:06:31
|
|
101
|
+
* @param {IRelationshipDiagramNode} node
|
|
102
|
+
*/
|
|
103
|
+
set(node) {
|
|
104
|
+
const i = this.c.state.nodes.findIndex((_) => _.id === node.id);
|
|
105
|
+
if (i !== -1) {
|
|
106
|
+
this.c.state.nodes[i] = node;
|
|
107
|
+
this.c.state.nodes = this.c.state.nodes;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 删除节点数据,会删除节点以及之后所有的节点数据
|
|
112
|
+
*
|
|
113
|
+
* @author zhanghanrui
|
|
114
|
+
* @date 2024-06-28 13:06:06
|
|
115
|
+
* @param {string} id
|
|
116
|
+
* @param {boolean} [deleteLine=true] 默认同时删除连线
|
|
117
|
+
*/
|
|
118
|
+
delete(id, deleteLine = true) {
|
|
119
|
+
const i = this.c.state.nodes.findIndex((node) => node.id === id);
|
|
120
|
+
if (i !== -1) {
|
|
121
|
+
this.c.state.nodes.splice(i, this.c.state.nodes.length);
|
|
122
|
+
if (deleteLine) {
|
|
123
|
+
const deleteLink = this.c.link.getBySource(id);
|
|
124
|
+
if (deleteLink) this.c.link.delete(deleteLink.id);
|
|
125
|
+
const deleteReverseLink = this.c.link.getByTarget(id);
|
|
126
|
+
if (deleteReverseLink) this.c.link.delete(deleteReverseLink.id);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 节点绘制完毕
|
|
132
|
+
*
|
|
133
|
+
* @author zhanghanrui
|
|
134
|
+
* @date 2024-06-25 14:06:08
|
|
135
|
+
* @param {string} _id
|
|
136
|
+
*/
|
|
137
|
+
mounted(_id) {
|
|
138
|
+
this.c.state.nodeCount += 1;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 节点销毁
|
|
142
|
+
*
|
|
143
|
+
* @author zhanghanrui
|
|
144
|
+
* @date 2024-06-25 14:06:16
|
|
145
|
+
* @param {string} _id
|
|
146
|
+
*/
|
|
147
|
+
unmounted(_id) {
|
|
148
|
+
this.c.state.nodeCount -= 1;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 设置节点
|
|
152
|
+
*
|
|
153
|
+
* @author zhanghanrui
|
|
154
|
+
* @date 2024-06-29 16:06:58
|
|
155
|
+
* @param {IRelationshipDiagramNode[]} nodes
|
|
156
|
+
*/
|
|
157
|
+
setNodes(nodes, isSetFirst = true) {
|
|
158
|
+
if (nodes.length > 0) {
|
|
159
|
+
if (isSetFirst) this.c.state.nodes.push(...nodes);
|
|
160
|
+
let before = nodes.shift();
|
|
161
|
+
if (!isSetFirst) this.c.state.nodes.push(...nodes);
|
|
162
|
+
nodes.forEach((_) => {
|
|
163
|
+
if (_.reverse) this.c.link.create({
|
|
164
|
+
source: _.id,
|
|
165
|
+
target: before.id,
|
|
166
|
+
reverse: true,
|
|
167
|
+
type: _.value ? LinkType.DEFAULT : LinkType.VIRTUAL
|
|
168
|
+
});
|
|
169
|
+
else this.c.link.create({
|
|
170
|
+
source: before.id,
|
|
171
|
+
target: _.id
|
|
172
|
+
});
|
|
173
|
+
before = _;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 当前所有节点引用
|
|
179
|
+
*
|
|
180
|
+
* @author zhanghanrui
|
|
181
|
+
* @date 2024-06-30 12:06:41
|
|
182
|
+
* @return {*} {IRelationshipDiagramNode[]}
|
|
183
|
+
*/
|
|
184
|
+
getNodes() {
|
|
185
|
+
return this.c.state.nodes;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
//#endregion
|
|
189
|
+
export { NodeController };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Endpoint, EndpointHandler, EndpointRepresentation, EndpointRepresentationParams } from '@jsplumb/browser-ui';
|
|
2
|
+
/**
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export interface ArrowEndpointParams extends EndpointRepresentationParams {
|
|
6
|
+
/**
|
|
7
|
+
* 箭头指向
|
|
8
|
+
*
|
|
9
|
+
* @default 'right'
|
|
10
|
+
* @author zhanghanrui
|
|
11
|
+
* @date 2024-04-14 14:04:09
|
|
12
|
+
* @type {('left' | 'right')}
|
|
13
|
+
*/
|
|
14
|
+
direction: 'left' | 'right';
|
|
15
|
+
}
|
|
16
|
+
export type ComputedArrowEndpoint = [number, number, number, number];
|
|
17
|
+
export declare class ArrowEndpoint extends EndpointRepresentation<ComputedArrowEndpoint> {
|
|
18
|
+
params?: ArrowEndpointParams;
|
|
19
|
+
constructor(endpoint: Endpoint, params?: ArrowEndpointParams);
|
|
20
|
+
static type: string;
|
|
21
|
+
type: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const ArrowEndpointHandler: EndpointHandler<ArrowEndpoint, ComputedArrowEndpoint>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EndpointRepresentation } from "@jsplumb/browser-ui";
|
|
2
|
+
//#region src/modules/relationship-diagram-config/plumb-plugin/arrow-endpoint.ts
|
|
3
|
+
var ArrowEndpoint = class ArrowEndpoint extends EndpointRepresentation {
|
|
4
|
+
params;
|
|
5
|
+
constructor(endpoint, params) {
|
|
6
|
+
super(endpoint, params);
|
|
7
|
+
this.params = params;
|
|
8
|
+
}
|
|
9
|
+
static type = "Arrow";
|
|
10
|
+
type = ArrowEndpoint.type;
|
|
11
|
+
};
|
|
12
|
+
var ArrowEndpointHandler = {
|
|
13
|
+
type: ArrowEndpoint.type,
|
|
14
|
+
cls: ArrowEndpoint,
|
|
15
|
+
compute: (ep, anchorPoint, _orientation, _endpointStyle) => {
|
|
16
|
+
const { direction } = ep.params || {};
|
|
17
|
+
ep.x = anchorPoint.curX - (direction === "left" ? 0 : 4);
|
|
18
|
+
ep.y = anchorPoint.curY - 2.6;
|
|
19
|
+
ep.w = 6;
|
|
20
|
+
ep.h = 6;
|
|
21
|
+
return [
|
|
22
|
+
anchorPoint.curX,
|
|
23
|
+
anchorPoint.curY,
|
|
24
|
+
0,
|
|
25
|
+
0
|
|
26
|
+
];
|
|
27
|
+
},
|
|
28
|
+
getParams: (_ep) => {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { ArrowEndpoint, ArrowEndpointHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const register: () => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ArrowEndpoint } from "./arrow-endpoint.mjs";
|
|
2
|
+
import { registerEndpointRenderer, svg } from "@jsplumb/browser-ui";
|
|
3
|
+
//#region src/modules/relationship-diagram-config/plumb-plugin/blank-endpoint-renderer.ts
|
|
4
|
+
var calcPoints = (direction) => {
|
|
5
|
+
if (direction === "left") return "0,3 6,0 6,6";
|
|
6
|
+
else return "0,0 6,3 0,6";
|
|
7
|
+
};
|
|
8
|
+
var register = () => {
|
|
9
|
+
registerEndpointRenderer(ArrowEndpoint.type, {
|
|
10
|
+
makeNode: (ep, _style) => {
|
|
11
|
+
const { direction } = ep.params || {};
|
|
12
|
+
return svg.node("polygon", {
|
|
13
|
+
points: calcPoints(direction),
|
|
14
|
+
"stroke-width": 1
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
updateNode: (ep, node) => {
|
|
18
|
+
const { direction } = ep.params || {};
|
|
19
|
+
svg.attr(node, {
|
|
20
|
+
points: calcPoints(direction),
|
|
21
|
+
"stroke-width": 1
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { register };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
3
|
+
/* bem('block', 'element', 'modifier') => 'ibiz-block__element--modifier' */
|
|
4
|
+
/**
|
|
5
|
+
* 定义 Block 块
|
|
6
|
+
* @param {String} $block - Block 块名称
|
|
7
|
+
* @example
|
|
8
|
+
* @include b('button') {
|
|
9
|
+
* padding: 10px;
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 定义 Element 元素
|
|
14
|
+
* @param {String|List} $element - Element 元素名称,支持单个或多个
|
|
15
|
+
* @example
|
|
16
|
+
* @include b('button') {
|
|
17
|
+
* @include e('text') {
|
|
18
|
+
* color: #000;
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* // 或传入多个元素
|
|
22
|
+
* @include b('button') {
|
|
23
|
+
* @include e(('text', 'icon')) {
|
|
24
|
+
* margin: 5px;
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* 定义 Modifier 修饰符
|
|
30
|
+
* @param {String|List} $modifier - Modifier 修饰符名称,支持单个或多个
|
|
31
|
+
* @example
|
|
32
|
+
* @include b('button') {
|
|
33
|
+
* @include m('primary') {
|
|
34
|
+
* background: blue;
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
37
|
+
* // 或传入多个修饰符
|
|
38
|
+
* @include b('button') {
|
|
39
|
+
* @include m(('primary', 'large')) {
|
|
40
|
+
* background: blue;
|
|
41
|
+
* font-size: 16px;
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* 定义状态选择器
|
|
47
|
+
* @param {String} $state - 状态名称
|
|
48
|
+
* @example
|
|
49
|
+
* @include b('button') {
|
|
50
|
+
* @include when('disabled') {
|
|
51
|
+
* opacity: 0.5;
|
|
52
|
+
* }
|
|
53
|
+
* }
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* 深色主题样式
|
|
57
|
+
* @param {String} $block - Block 块名称
|
|
58
|
+
* @example
|
|
59
|
+
* @include dark('button') {
|
|
60
|
+
* background: #333;
|
|
61
|
+
* color: #fff;
|
|
62
|
+
* }
|
|
63
|
+
*/
|
|
64
|
+
/* stylelint-disable scss/no-global-function-names */
|
|
65
|
+
.gct-diagram-config-default-link__line-hover {
|
|
66
|
+
color: red;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.gct-diagram-config-default-link-custom-overlay-line {
|
|
70
|
+
cursor: pointer;
|
|
71
|
+
}
|
|
72
|
+
.gct-diagram-config-default-link-custom-overlay-line__not-special-line {
|
|
73
|
+
width: 50px;
|
|
74
|
+
height: 10px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.gct-diagram-config-default-link-custom-overlay-line__special-line {
|
|
78
|
+
width: 10px;
|
|
79
|
+
height: 80px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.gct-diagram-config-default-link-custom-overlay {
|
|
83
|
+
position: relative;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
}
|
|
86
|
+
.gct-diagram-config-default-link-custom-overlay .iconfont {
|
|
87
|
+
display: none;
|
|
88
|
+
width: 16px;
|
|
89
|
+
height: 16px;
|
|
90
|
+
}
|
|
91
|
+
.gct-diagram-config-default-link-custom-overlay .iconfont.delete-action:hover {
|
|
92
|
+
color: #F54547;
|
|
93
|
+
}
|
|
94
|
+
.gct-diagram-config-default-link-custom-overlay .iconfont.reverse-action:hover {
|
|
95
|
+
color: #3168EC;
|
|
96
|
+
}
|
|
97
|
+
.gct-diagram-config-default-link-custom-overlay__not-special-line {
|
|
98
|
+
width: 16px;
|
|
99
|
+
height: 50px;
|
|
100
|
+
}
|
|
101
|
+
.gct-diagram-config-default-link-custom-overlay__not-special-line .iconfont.delete-action {
|
|
102
|
+
position: absolute;
|
|
103
|
+
bottom: 9px;
|
|
104
|
+
left: 50%;
|
|
105
|
+
transform: translateX(-50%);
|
|
106
|
+
}
|
|
107
|
+
.gct-diagram-config-default-link-custom-overlay__not-special-line .iconfont.reverse-action {
|
|
108
|
+
position: absolute;
|
|
109
|
+
top: 0;
|
|
110
|
+
left: 50%;
|
|
111
|
+
transform: translateX(-50%);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.gct-diagram-config-default-link-custom-overlay.jtk-hover .iconfont {
|
|
115
|
+
display: block;
|
|
116
|
+
}
|
|
117
|
+
.gct-diagram-config-default-link-custom-overlay__special-line {
|
|
118
|
+
width: 50px;
|
|
119
|
+
height: 16px;
|
|
120
|
+
}
|
|
121
|
+
.gct-diagram-config-default-link-custom-overlay__special-line .iconfont.delete-action {
|
|
122
|
+
position: absolute;
|
|
123
|
+
top: 50%;
|
|
124
|
+
left: 5px;
|
|
125
|
+
transform: translateY(-50%);
|
|
126
|
+
}
|
|
127
|
+
.gct-diagram-config-default-link-custom-overlay__special-line .iconfont.reverse-action {
|
|
128
|
+
position: absolute;
|
|
129
|
+
top: 50%;
|
|
130
|
+
right: 5px;
|
|
131
|
+
transform: translateY(-50%);
|
|
132
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ConnectParams } from '@jsplumb/browser-ui';
|
|
2
|
+
import { ILinkProvider, IRelationshipDiagramLink } from '../../interface';
|
|
3
|
+
import { RelationshipDiagramConfigController } from '../../relationship-diagram-config.controller';
|
|
4
|
+
/**
|
|
5
|
+
* 默认连线适配器
|
|
6
|
+
*
|
|
7
|
+
* @author zhanghanrui
|
|
8
|
+
* @date 2024-06-25 19:06:34
|
|
9
|
+
* @export
|
|
10
|
+
* @class DefaultLinkProvider
|
|
11
|
+
* @implements {ILinkProvider}
|
|
12
|
+
*/
|
|
13
|
+
export declare class DefaultLinkProvider implements ILinkProvider {
|
|
14
|
+
type: "default";
|
|
15
|
+
protected ns: import('@gct-paas/core').Namespace;
|
|
16
|
+
sourceHandle: string;
|
|
17
|
+
deleteMessage: string;
|
|
18
|
+
protected reverse(c: RelationshipDiagramConfigController, link: IRelationshipDiagramLink): void;
|
|
19
|
+
options(c: RelationshipDiagramConfigController, link: IRelationshipDiagramLink): ConnectParams<Element>;
|
|
20
|
+
click(c: RelationshipDiagramConfigController, link: IRelationshipDiagramLink): void;
|
|
21
|
+
}
|