@cge-app/topo-core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ import type { Cell as AntVCellInterface } from '@antv/x6';
2
+ import { Cell as AntVCell } from '@antv/x6';
3
+ /**
4
+ * @description Cell基类
5
+ */
6
+ export default class Cell extends AntVCell {
7
+ constructor(config: AntVCellInterface.Config);
8
+ }
@@ -0,0 +1,5 @@
1
+ import { Edge as AntVEdge } from '@antv/x6';
2
+ import type { EdgeInterface } from '../../Types/Base/edge';
3
+ export default class Edge extends AntVEdge {
4
+ constructor(config: EdgeInterface);
5
+ }
@@ -0,0 +1,23 @@
1
+ import type { Model as AntVModel } from '@antv/x6';
2
+ import { Graph as AntVGraph } from '@antv/x6';
3
+ import { Dnd } from '@antv/x6-plugin-dnd';
4
+ import type { GraphConfigInterface } from '../../Types/Base/graph';
5
+ export default class Graph extends AntVGraph {
6
+ private readonly beforeDestroy;
7
+ private readonly afterDestroy;
8
+ dnd: Dnd | null;
9
+ constructor(antVConfig: GraphConfigInterface);
10
+ /**
11
+ * @description 初始化
12
+ * @params container 容器
13
+ */
14
+ init(container: HTMLDivElement, options: GraphConfigInterface): AntVGraph;
15
+ /**
16
+ * @description 销毁画布
17
+ */
18
+ destroy(): void;
19
+ /**
20
+ * @description 从JSON导入节点数据
21
+ */
22
+ loadData(data: AntVModel.FromJSONData, options?: AntVModel.FromJSONOptions): this;
23
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @description: group基类, 继承Node, 用于描述批量节点
3
+ */
4
+ import type { Node as AntVNode } from '@antv/x6';
5
+ import Node from './node';
6
+ export default class Group extends Node {
7
+ constructor(config: AntVNode.Config);
8
+ }
@@ -0,0 +1,5 @@
1
+ import Cell from './cell';
2
+ import Edge from './edge';
3
+ import Graph from './graph';
4
+ import Node from './node';
5
+ export { Cell, Edge, Graph, Node };
@@ -0,0 +1,8 @@
1
+ import type { Node as AntVNodeInterface } from '@antv/x6';
2
+ import { Node as AntVNode } from '@antv/x6';
3
+ /**
4
+ * @description: 节点基类
5
+ */
6
+ export default class Node extends AntVNode {
7
+ constructor(config: AntVNodeInterface.Config);
8
+ }
@@ -0,0 +1,2 @@
1
+ import type { GraphConfigInterface } from '../../../../../core/Object/index';
2
+ export declare const defaultConfig: GraphConfigInterface;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @description:电力拓扑编辑器
3
+ */
4
+ import { Graph } from '../../../../../core';
5
+ import type { ElectricTopoGraphConfigInterface } from './types';
6
+ declare class ElectricTopoGraph extends Graph {
7
+ constructor(config: ElectricTopoGraphConfigInterface);
8
+ }
9
+ export { ElectricTopoGraph };
@@ -0,0 +1,5 @@
1
+ import type { GraphConfigInterface } from '../../../../../../core/Types/index';
2
+ export interface ElectricTopoGraphConfigInterface extends GraphConfigInterface {
3
+ default?: boolean;
4
+ exportImg?: boolean;
5
+ }
@@ -0,0 +1 @@
1
+ export * from './electricTopo/index';
@@ -0,0 +1 @@
1
+ export * from './editor';
@@ -0,0 +1,3 @@
1
+ export * from './Base';
2
+ export * from './Business';
3
+ export type * from '../Types';
@@ -0,0 +1,3 @@
1
+ import type { Cell as AntVCell } from '@antv/x6';
2
+ export interface Cell extends AntVCell {
3
+ }
@@ -0,0 +1,3 @@
1
+ import type { Edge as AntVEdge } from '@antv/x6';
2
+ export interface EdgeInterface extends AntVEdge {
3
+ }
@@ -0,0 +1,150 @@
1
+ import type { Graph as AntVGraph, Model as AntVModel, Node as AntVNode } from '@antv/x6';
2
+ import type { Selection } from '@antv/x6-plugin-selection';
3
+ import type { Snapline } from '@antv/x6-plugin-snapline';
4
+ export interface GraphInterface extends AntVGraph {
5
+ }
6
+ export interface GraphConfigInterface extends AntVGraph.Options {
7
+ /**
8
+ * @description: 生命周期beforeInit, 创建画布之前执行
9
+ * @param: Function
10
+ */
11
+ beforeInit?: () => unknown;
12
+ /**
13
+ * @description: 生命周期afterInit, 创建画布之后执行
14
+ * @param graph
15
+ * @returns
16
+ */
17
+ afterInit?: (graph: AntVGraph) => unknown;
18
+ /**
19
+ * @description: 生命周期beforeDestroy钩子函数, 销毁画布之前执行
20
+ * @param: Function
21
+ */
22
+ beforeDestroy?: (graph: AntVGraph) => unknown;
23
+ /**
24
+ * @description: 生命周期afterDestroy钩子函数,画布销毁之后执行
25
+ * @param graph
26
+ */
27
+ afterDestroy?: () => unknown;
28
+ /**
29
+ * @description: 小地图插件配置,默认不开启
30
+ */
31
+ miniMap?: {
32
+ show: boolean;
33
+ container?: HTMLElement | null;
34
+ width?: number;
35
+ height?: number;
36
+ padding?: number;
37
+ scalable?: boolean;
38
+ miniScale?: number;
39
+ maxScale?: number;
40
+ graphOption?: AntVGraph.Options;
41
+ };
42
+ /**
43
+ *@description: 对齐线插件,默认开启
44
+ */
45
+ alignGrid?: {
46
+ enabled: boolean;
47
+ className?: string;
48
+ tolerance?: number;
49
+ sharp?: boolean;
50
+ resizing?: boolean;
51
+ clean?: boolean | number;
52
+ filter?: Selection.Filter;
53
+ showNodeSelectionBox?: boolean;
54
+ showEdgeSelectionBox?: boolean;
55
+ pointEvent?: 'node' | 'auto';
56
+ eventTypes?: Array<'leftMouseDown' | 'mouseWheelDown'>;
57
+ };
58
+ /**
59
+ * @description: 是否开启剪切板, 默认开启localStorage缓存,浏览器刷新或者关闭后重新打开,复制/粘贴也能正常工作
60
+ */
61
+ clipboard?: boolean;
62
+ /**
63
+ *@description: 是否开启键盘快捷键, 默认开启
64
+ *@constant: 本期暂时默认开启 ctrl + c, ctrl + v和 ctrl + z 快捷键,同时支持用户自定义绑定快捷键事件
65
+ */
66
+ keyboard?: boolean;
67
+ /**
68
+ * @description 滚动画布配置, 当同时使用 Scroller 插件的时候请不要同时开启画布的 panning 配置,因为两种形式在交互上有冲突。
69
+ */
70
+ scroller?: {
71
+ enabled: boolean;
72
+ pannable?: boolean;
73
+ className?: string;
74
+ width?: number;
75
+ height?: number;
76
+ modifiers?: ModifierKey;
77
+ pageWidth?: number;
78
+ pageHeight?: number;
79
+ pageVisible?: boolean;
80
+ pageBreak?: boolean;
81
+ autoResize?: boolean;
82
+ minVisibleWidth?: number;
83
+ minVisibleHeight?: number;
84
+ padding?: number | Padding;
85
+ };
86
+ /**
87
+ * @description: 是否开启撤销, 默认开启
88
+ */
89
+ history?: boolean;
90
+ /**
91
+ * @description: 是否开启框选,默认不开启
92
+ */
93
+ selection?: {
94
+ enabled: boolean;
95
+ className?: string;
96
+ multiple?: boolean;
97
+ multipleSelectionModifiers?: ModifierKey;
98
+ rubberband?: boolean;
99
+ modifiers?: ModifierKey;
100
+ strict?: boolean;
101
+ movable?: boolean;
102
+ content?: string;
103
+ filter?: Snapline.Filter;
104
+ };
105
+ /**
106
+ * @description: 是否开启导出,默认不开启
107
+ */
108
+ exportImg?: boolean;
109
+ /**
110
+ * @description: 是否使用dnd, 默认不开启
111
+ */
112
+ dnd?: DND_OPTIONS;
113
+ }
114
+ type ModifierKey = string | ('alt' | 'ctrl' | 'meta' | 'shift')[] | null;
115
+ type Padding = {
116
+ top: number;
117
+ right: number;
118
+ bottom: number;
119
+ left: number;
120
+ };
121
+ interface DND_OPTIONS {
122
+ enabled: boolean;
123
+ target?: AntVGraph;
124
+ /**
125
+ * Should scale the dragging node or not.
126
+ */
127
+ scaled?: boolean;
128
+ delegateGraphOptions?: AntVGraph.Options;
129
+ draggingContainer?: HTMLElement;
130
+ /**
131
+ * dnd tool box container.
132
+ */
133
+ dndContainer?: HTMLElement;
134
+ getDragNode?: (sourceNode: AntVNode, options: GetDragNodeOptions) => AntVNode;
135
+ getDropNode?: (draggingNode: AntVNode, options: GetDropNodeOptions) => AntVNode;
136
+ validateNode?: (droppingNode: AntVNode, options: ValidateNodeOptions) => boolean | Promise<boolean>;
137
+ }
138
+ interface GetDragNodeOptions {
139
+ sourceNode: AntVNode;
140
+ targetGraph: AntVGraph;
141
+ draggingGraph: AntVGraph;
142
+ }
143
+ interface GetDropNodeOptions extends GetDragNodeOptions {
144
+ draggingNode: AntVNode;
145
+ }
146
+ interface ValidateNodeOptions extends GetDropNodeOptions {
147
+ droppingNode: AntVNode;
148
+ }
149
+ export type GraphJsonData = AntVModel.FromJSONData;
150
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './edge';
2
+ export * from './graph';
3
+ export * from './node';
@@ -0,0 +1,3 @@
1
+ import type { Node as AntVNode } from '@antv/x6';
2
+ export interface NodeInterface extends AntVNode {
3
+ }
@@ -0,0 +1 @@
1
+ export * from './Base';
File without changes
@@ -0,0 +1 @@
1
+ export * from './Object';
@@ -0,0 +1 @@
1
+ export * from './core';
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@cge-app/topo-core",
3
+ "version": "0.0.1",
4
+ "publishConfig": { "access": "public" },
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "types": "dist/types/index.d.ts",
8
+ "scripts": {
9
+ "type": "npx tsc -p tsconfig.build.json --pretty && npx tsc-alias -p tsconfig.build.json",
10
+ "build": "npx vite build && npm run type",
11
+ "dev-build": "npx vite build --sourcemap=true --mode=development && npm run type",
12
+ "dev": "npx nodemon -w src/ -i dist/ -i node_modules/ -C -e ts,js --debug -x npm run dev-build",
13
+ "prepub": "npm run build",
14
+ "pub": "npm login --registry=https://registry.npmjs.org/ && npm publish --registry=https://registry.npmjs.org/",
15
+ "postpub": "npm logout --registry=https://registry.npmjs.org/",
16
+ "doc": "npx typedoc --plugin typedoc-plugin-markdown",
17
+ "release": "npm run docs:md && npm run changelog && npm run pub"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "author": "",
23
+ "license": "ISC",
24
+ "keywords": [],
25
+ "description": "",
26
+ "dependencies": {
27
+ "@antv/x6": "^2.18.1",
28
+ "@antv/x6-plugin-clipboard": "^2.1.6",
29
+ "@antv/x6-plugin-dnd": "^2.1.1",
30
+ "@antv/x6-plugin-export": "^2.1.6",
31
+ "@antv/x6-plugin-history": "^2.2.4",
32
+ "@antv/x6-plugin-keyboard": "^2.2.3",
33
+ "@antv/x6-plugin-minimap": "^2.0.7",
34
+ "@antv/x6-plugin-scroller": "^2.0.10",
35
+ "@antv/x6-plugin-selection": "^2.2.2",
36
+ "@antv/x6-plugin-snapline": "^2.1.7",
37
+ "@antv/x6-plugin-transform": "^2.1.8"
38
+ }
39
+ }