ronds-metadata 1.3.25 → 1.3.26
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/es/comps/DynamicPorts/graph.js +8 -10
- package/es/comps/DynamicPorts/utils.d.ts +4 -0
- package/es/comps/DynamicPorts/utils.js +29 -1
- package/es/utils.d.ts +3 -0
- package/es/utils.js +23 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
|
16
16
|
/*
|
|
17
17
|
* @Author: wangxian
|
|
18
18
|
* @Date: 2022-05-24 14:31:01
|
|
19
|
-
* @LastEditTime: 2023-12-
|
|
19
|
+
* @LastEditTime: 2023-12-05 09:54:43
|
|
20
20
|
*/
|
|
21
21
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
22
22
|
import produce from 'immer';
|
|
@@ -30,7 +30,7 @@ import { GraphCore } from '../../framework/graph';
|
|
|
30
30
|
import NodeElement from './comps/NodeElement';
|
|
31
31
|
import { DPEdge } from './comps/shape/edge';
|
|
32
32
|
import { DPNode } from './comps/shape/node';
|
|
33
|
-
import { formatGraphData, formatNodeInfoToNodeMeta, formattedEdgesToEdgeMeta } from './utils';
|
|
33
|
+
import { formatGraphData, copy, formatNodeInfoToNodeMeta, formattedEdgesToEdgeMeta, isClipboardEmpty, cleanClipboard } from './utils';
|
|
34
34
|
import { deepClone, guid } from '../../utils';
|
|
35
35
|
import { MetadataService } from '../../framework/metadata/MetadataService';
|
|
36
36
|
import { tr } from '../../framework/locale';
|
|
@@ -734,8 +734,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
734
734
|
}, {
|
|
735
735
|
key: "onAddCopyCells",
|
|
736
736
|
value: function onAddCopyCells(nodes, edges) {
|
|
737
|
-
var _this2 = this
|
|
738
|
-
_this$graph;
|
|
737
|
+
var _this2 = this;
|
|
739
738
|
var cells = [];
|
|
740
739
|
var randomId = guid().substring(0, 4);
|
|
741
740
|
nodes.map(function (cell) {
|
|
@@ -759,7 +758,7 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
759
758
|
var newEdge = formattedEdgesToEdgeMeta(_edge);
|
|
760
759
|
_this2.addEdge(newEdge);
|
|
761
760
|
});
|
|
762
|
-
|
|
761
|
+
cleanClipboard();
|
|
763
762
|
// 回显选中复制的之后的节点
|
|
764
763
|
nodes.map(function (cell) {
|
|
765
764
|
var _this2$graph;
|
|
@@ -779,14 +778,13 @@ var DPGraph = /*#__PURE__*/function (_GraphCore) {
|
|
|
779
778
|
switch (action) {
|
|
780
779
|
case 'command+c':
|
|
781
780
|
case 'ctrl+c':
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
}
|
|
785
|
-
_message.success(tr('复制成功'));
|
|
781
|
+
if (selectedCells && selectedCells.length > 0) {
|
|
782
|
+
copy(selectedCells, this.graph);
|
|
783
|
+
}
|
|
786
784
|
break;
|
|
787
785
|
case 'command+v':
|
|
788
786
|
case 'ctrl+v':
|
|
789
|
-
if (
|
|
787
|
+
if (isClipboardEmpty()) {
|
|
790
788
|
_message.info(tr('剪切板为空,不可粘贴'));
|
|
791
789
|
} else {
|
|
792
790
|
var clipboardCells = this.graph.getCellsInClipboard();
|
|
@@ -147,3 +147,7 @@ export declare function formatGraphData(graphData: NDPGraph.GraphData): {
|
|
|
147
147
|
color?: string;
|
|
148
148
|
}[];
|
|
149
149
|
};
|
|
150
|
+
export declare function isClipboardEmpty(): boolean;
|
|
151
|
+
export declare function getCellsInClipboard(): unknown;
|
|
152
|
+
export declare function cleanClipboard(): void;
|
|
153
|
+
export declare function copy(selectedCells: any, graph: Graph): void;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import "antd/es/message/style";
|
|
2
|
+
import _message from "antd/es/message";
|
|
1
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
5
|
/*
|
|
4
6
|
* @Author: wangxian
|
|
5
7
|
* @Date: 2022-05-24 16:40:49
|
|
6
|
-
* @LastEditTime: 2023-
|
|
8
|
+
* @LastEditTime: 2023-12-05 09:56:52
|
|
7
9
|
*/
|
|
8
10
|
import { sortBy } from 'lodash-es';
|
|
9
11
|
import { NODE_HEIGHT, NODE_WIDTH } from './constant';
|
|
12
|
+
import { delFromLS, getFromLS, saveToLS } from '../../utils';
|
|
13
|
+
import { tr } from '../../framework/locale';
|
|
10
14
|
// 将画布上的点转换成相对于 offset parent 的点
|
|
11
15
|
export function graphPointToOffsetPoint(graph, graphPoint, containerElem) {
|
|
12
16
|
if (graph) {
|
|
@@ -134,4 +138,28 @@ export function formatGraphData(graphData) {
|
|
|
134
138
|
nodes: _toConsumableArray(formattedNodes),
|
|
135
139
|
edges: formattedEdges
|
|
136
140
|
};
|
|
141
|
+
}
|
|
142
|
+
var CLIPBOARD_KEY = 'x6.clipboard.cells';
|
|
143
|
+
var CLIPBOARD_KEY_NEW = 'my.clipboard.cells';
|
|
144
|
+
export function isClipboardEmpty() {
|
|
145
|
+
var cells = getFromLS(CLIPBOARD_KEY_NEW);
|
|
146
|
+
return cells ? false : true;
|
|
147
|
+
}
|
|
148
|
+
export function getCellsInClipboard() {
|
|
149
|
+
var cells = getFromLS(CLIPBOARD_KEY_NEW);
|
|
150
|
+
return cells;
|
|
151
|
+
}
|
|
152
|
+
export function cleanClipboard() {
|
|
153
|
+
delFromLS(CLIPBOARD_KEY_NEW);
|
|
154
|
+
}
|
|
155
|
+
export function copy(selectedCells, graph) {
|
|
156
|
+
graph.copy(selectedCells, {
|
|
157
|
+
useLocalStorage: true
|
|
158
|
+
});
|
|
159
|
+
var cells = getFromLS(CLIPBOARD_KEY);
|
|
160
|
+
if (cells) {
|
|
161
|
+
saveToLS(CLIPBOARD_KEY_NEW, cells);
|
|
162
|
+
delFromLS(CLIPBOARD_KEY);
|
|
163
|
+
_message.success(tr('复制成功'));
|
|
164
|
+
}
|
|
137
165
|
}
|
package/es/utils.d.ts
CHANGED
|
@@ -30,3 +30,6 @@ export declare function getConstantValue(array: any[], key: string | number, str
|
|
|
30
30
|
* @param fileName string
|
|
31
31
|
*/
|
|
32
32
|
export declare function handleMd2Doc(mdText: string, fileName: string, isFirstLineCenter?: boolean): Promise<void>;
|
|
33
|
+
export declare function getFromLS<T>(key: string): T | null;
|
|
34
|
+
export declare function saveToLS<T>(key: string, value: T | null | undefined): void;
|
|
35
|
+
export declare function delFromLS(key: string): void;
|
package/es/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
6
6
|
/*
|
|
7
7
|
* @Author: wangxian
|
|
8
8
|
* @Date: 2021-09-18 14:15:04
|
|
9
|
-
* @LastEditTime: 2023-
|
|
9
|
+
* @LastEditTime: 2023-12-05 09:05:07
|
|
10
10
|
*/
|
|
11
11
|
import saveAs from 'file-saver';
|
|
12
12
|
import { asBlob } from 'html-docx-js-typescript';
|
|
@@ -283,4 +283,26 @@ function convertImagePathToBase64(imagePath) {
|
|
|
283
283
|
|
|
284
284
|
return uint8Array;
|
|
285
285
|
}
|
|
286
|
+
}
|
|
287
|
+
export function getFromLS(key) {
|
|
288
|
+
if (window.localStorage) {
|
|
289
|
+
try {
|
|
290
|
+
return JSON.parse(window.localStorage.getItem(key) || '');
|
|
291
|
+
} catch (e) {
|
|
292
|
+
/*Ignore*/
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
export function saveToLS(key, value) {
|
|
298
|
+
if (window.localStorage) {
|
|
299
|
+
if (value === null || value === undefined) {
|
|
300
|
+
window.localStorage.removeItem(key);
|
|
301
|
+
} else {
|
|
302
|
+
window.localStorage.setItem(key, JSON.stringify(value));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
export function delFromLS(key) {
|
|
307
|
+
window.localStorage.removeItem(key);
|
|
286
308
|
}
|