@logicflow/extension 2.1.13 → 2.1.15
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +13 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/bpmn-elements-adapter/json2xml.d.ts +2 -1
- package/es/bpmn-elements-adapter/json2xml.js +18 -4
- package/es/bpmn-elements-adapter/xml2json.js +2 -7
- package/lib/bpmn-elements-adapter/json2xml.d.ts +2 -1
- package/lib/bpmn-elements-adapter/json2xml.js +19 -4
- package/lib/bpmn-elements-adapter/xml2json.js +2 -7
- package/package.json +4 -4
- package/src/bpmn-elements-adapter/json2xml.ts +18 -4
- package/src/bpmn-elements-adapter/xml2json.ts +2 -8
- package/stats.html +1 -1
|
@@ -21,6 +21,17 @@ function handleAttributes(obj) {
|
|
|
21
21
|
}
|
|
22
22
|
return obj;
|
|
23
23
|
}
|
|
24
|
+
function escapeXml(text) {
|
|
25
|
+
if (text == null)
|
|
26
|
+
return '';
|
|
27
|
+
return text
|
|
28
|
+
.toString()
|
|
29
|
+
.replace(/&/g, '&')
|
|
30
|
+
.replace(/</g, '<')
|
|
31
|
+
.replace(/>/g, '>')
|
|
32
|
+
.replace(/"/g, '"')
|
|
33
|
+
.replace(/'/g, ''');
|
|
34
|
+
}
|
|
24
35
|
function getAttributes(obj) {
|
|
25
36
|
var tmp = obj;
|
|
26
37
|
try {
|
|
@@ -31,7 +42,7 @@ function getAttributes(obj) {
|
|
|
31
42
|
catch (error) {
|
|
32
43
|
tmp = JSON.stringify(handleAttributes(obj)).replace(/"/g, "'");
|
|
33
44
|
}
|
|
34
|
-
return tmp;
|
|
45
|
+
return escapeXml(String(tmp));
|
|
35
46
|
}
|
|
36
47
|
var tn = '\t\n';
|
|
37
48
|
// @see issue https://github.com/didi/LogicFlow/issues/718, refactoring of function toXml
|
|
@@ -42,7 +53,7 @@ function toXml(obj, name, depth) {
|
|
|
42
53
|
if (name === '-json')
|
|
43
54
|
return '';
|
|
44
55
|
if (name === '#text') {
|
|
45
|
-
return prefix + obj;
|
|
56
|
+
return prefix + escapeXml(String(obj));
|
|
46
57
|
}
|
|
47
58
|
if (name === '#cdata-section') {
|
|
48
59
|
return "".concat(prefix, "<![CDATA[").concat(obj, "]]>");
|
|
@@ -50,6 +61,9 @@ function toXml(obj, name, depth) {
|
|
|
50
61
|
if (name === '#comment') {
|
|
51
62
|
return "".concat(prefix, "<!--").concat(obj, "-->");
|
|
52
63
|
}
|
|
64
|
+
if (obj !== 0 && obj !== false && !obj) {
|
|
65
|
+
return "".concat(prefix, "<").concat(name, " />");
|
|
66
|
+
}
|
|
53
67
|
if ("".concat(name).charAt(0) === '-') {
|
|
54
68
|
return " ".concat(name.substring(1), "=\"").concat(getAttributes(obj), "\"");
|
|
55
69
|
}
|
|
@@ -70,7 +84,7 @@ function toXml(obj, name, depth) {
|
|
|
70
84
|
attributes_1 + (children_1 !== '' ? ">".concat(children_1).concat(prefix, "</").concat(name, ">") : ' />');
|
|
71
85
|
}
|
|
72
86
|
else {
|
|
73
|
-
str += "".concat(prefix, "<").concat(name, ">").concat(obj
|
|
87
|
+
str += "".concat(prefix, "<").concat(name, ">").concat(escapeXml(String(obj)), "</").concat(name, ">");
|
|
74
88
|
}
|
|
75
89
|
return str;
|
|
76
90
|
}
|
|
@@ -81,4 +95,4 @@ function lfJson2Xml(obj) {
|
|
|
81
95
|
}
|
|
82
96
|
return xmlStr;
|
|
83
97
|
}
|
|
84
|
-
export { lfJson2Xml, handleAttributes };
|
|
98
|
+
export { lfJson2Xml, handleAttributes, escapeXml };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/* eslint-disable func-names */
|
|
6
6
|
// @ts-nocheck
|
|
7
7
|
import { has } from 'lodash-es';
|
|
8
|
+
import { escapeXml } from './json2xml';
|
|
8
9
|
// ========================================================================
|
|
9
10
|
// XML.ObjTree -- XML source code from/to JavaScript object like E4X
|
|
10
11
|
// ========================================================================
|
|
@@ -295,13 +296,7 @@ XML.ObjTree.prototype.scalar_to_xml = function (name, text) {
|
|
|
295
296
|
return "<".concat(name, ">").concat(this.xml_escape(text), "</").concat(name, ">\n");
|
|
296
297
|
};
|
|
297
298
|
// method: xml_escape( text )
|
|
298
|
-
XML.ObjTree.prototype.xml_escape =
|
|
299
|
-
return text
|
|
300
|
-
.replace(/&/g, '&')
|
|
301
|
-
.replace(/</g, '<')
|
|
302
|
-
.replace(/>/g, '>')
|
|
303
|
-
.replace(/"/g, '"');
|
|
304
|
-
};
|
|
299
|
+
XML.ObjTree.prototype.xml_escape = escapeXml;
|
|
305
300
|
/*
|
|
306
301
|
// ========================================================================
|
|
307
302
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleAttributes = exports.lfJson2Xml = void 0;
|
|
3
|
+
exports.escapeXml = exports.handleAttributes = exports.lfJson2Xml = void 0;
|
|
4
4
|
/* eslint-disable guard-for-in */
|
|
5
5
|
function type(obj) {
|
|
6
6
|
return Object.prototype.toString.call(obj);
|
|
@@ -25,6 +25,18 @@ function handleAttributes(obj) {
|
|
|
25
25
|
return obj;
|
|
26
26
|
}
|
|
27
27
|
exports.handleAttributes = handleAttributes;
|
|
28
|
+
function escapeXml(text) {
|
|
29
|
+
if (text == null)
|
|
30
|
+
return '';
|
|
31
|
+
return text
|
|
32
|
+
.toString()
|
|
33
|
+
.replace(/&/g, '&')
|
|
34
|
+
.replace(/</g, '<')
|
|
35
|
+
.replace(/>/g, '>')
|
|
36
|
+
.replace(/"/g, '"')
|
|
37
|
+
.replace(/'/g, ''');
|
|
38
|
+
}
|
|
39
|
+
exports.escapeXml = escapeXml;
|
|
28
40
|
function getAttributes(obj) {
|
|
29
41
|
var tmp = obj;
|
|
30
42
|
try {
|
|
@@ -35,7 +47,7 @@ function getAttributes(obj) {
|
|
|
35
47
|
catch (error) {
|
|
36
48
|
tmp = JSON.stringify(handleAttributes(obj)).replace(/"/g, "'");
|
|
37
49
|
}
|
|
38
|
-
return tmp;
|
|
50
|
+
return escapeXml(String(tmp));
|
|
39
51
|
}
|
|
40
52
|
var tn = '\t\n';
|
|
41
53
|
// @see issue https://github.com/didi/LogicFlow/issues/718, refactoring of function toXml
|
|
@@ -46,7 +58,7 @@ function toXml(obj, name, depth) {
|
|
|
46
58
|
if (name === '-json')
|
|
47
59
|
return '';
|
|
48
60
|
if (name === '#text') {
|
|
49
|
-
return prefix + obj;
|
|
61
|
+
return prefix + escapeXml(String(obj));
|
|
50
62
|
}
|
|
51
63
|
if (name === '#cdata-section') {
|
|
52
64
|
return "".concat(prefix, "<![CDATA[").concat(obj, "]]>");
|
|
@@ -54,6 +66,9 @@ function toXml(obj, name, depth) {
|
|
|
54
66
|
if (name === '#comment') {
|
|
55
67
|
return "".concat(prefix, "<!--").concat(obj, "-->");
|
|
56
68
|
}
|
|
69
|
+
if (obj !== 0 && obj !== false && !obj) {
|
|
70
|
+
return "".concat(prefix, "<").concat(name, " />");
|
|
71
|
+
}
|
|
57
72
|
if ("".concat(name).charAt(0) === '-') {
|
|
58
73
|
return " ".concat(name.substring(1), "=\"").concat(getAttributes(obj), "\"");
|
|
59
74
|
}
|
|
@@ -74,7 +89,7 @@ function toXml(obj, name, depth) {
|
|
|
74
89
|
attributes_1 + (children_1 !== '' ? ">".concat(children_1).concat(prefix, "</").concat(name, ">") : ' />');
|
|
75
90
|
}
|
|
76
91
|
else {
|
|
77
|
-
str += "".concat(prefix, "<").concat(name, ">").concat(obj
|
|
92
|
+
str += "".concat(prefix, "<").concat(name, ">").concat(escapeXml(String(obj)), "</").concat(name, ">");
|
|
78
93
|
}
|
|
79
94
|
return str;
|
|
80
95
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.lfXml2Json = void 0;
|
|
10
10
|
var lodash_es_1 = require("lodash-es");
|
|
11
|
+
var json2xml_1 = require("./json2xml");
|
|
11
12
|
// ========================================================================
|
|
12
13
|
// XML.ObjTree -- XML source code from/to JavaScript object like E4X
|
|
13
14
|
// ========================================================================
|
|
@@ -298,13 +299,7 @@ XML.ObjTree.prototype.scalar_to_xml = function (name, text) {
|
|
|
298
299
|
return "<".concat(name, ">").concat(this.xml_escape(text), "</").concat(name, ">\n");
|
|
299
300
|
};
|
|
300
301
|
// method: xml_escape( text )
|
|
301
|
-
XML.ObjTree.prototype.xml_escape =
|
|
302
|
-
return text
|
|
303
|
-
.replace(/&/g, '&')
|
|
304
|
-
.replace(/</g, '<')
|
|
305
|
-
.replace(/>/g, '>')
|
|
306
|
-
.replace(/"/g, '"');
|
|
307
|
-
};
|
|
302
|
+
XML.ObjTree.prototype.xml_escape = json2xml_1.escapeXml;
|
|
308
303
|
/*
|
|
309
304
|
// ========================================================================
|
|
310
305
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/extension",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.15",
|
|
4
4
|
"description": "LogicFlow Extensions",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"author": "Logicflow-Team",
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@logicflow/
|
|
24
|
-
"@logicflow/
|
|
23
|
+
"@logicflow/vue-node-registry": "1.1.13",
|
|
24
|
+
"@logicflow/core": "2.1.11"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@antv/hierarchy": "^0.6.11",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"rangy": "^1.3.1",
|
|
34
34
|
"vanilla-picker": "^2.12.3",
|
|
35
35
|
"@logicflow/core": "2.1.11",
|
|
36
|
-
"@logicflow/vue-node-registry": "1.1.
|
|
36
|
+
"@logicflow/vue-node-registry": "1.1.13"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"less": "^4.1.1",
|
|
@@ -24,6 +24,17 @@ function handleAttributes(obj: any): any {
|
|
|
24
24
|
return obj
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
function escapeXml(text: string) {
|
|
28
|
+
if (text == null) return ''
|
|
29
|
+
return text
|
|
30
|
+
.toString()
|
|
31
|
+
.replace(/&/g, '&')
|
|
32
|
+
.replace(/</g, '<')
|
|
33
|
+
.replace(/>/g, '>')
|
|
34
|
+
.replace(/"/g, '"')
|
|
35
|
+
.replace(/'/g, ''')
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
function getAttributes(obj: any) {
|
|
28
39
|
let tmp = obj
|
|
29
40
|
try {
|
|
@@ -33,7 +44,7 @@ function getAttributes(obj: any) {
|
|
|
33
44
|
} catch (error) {
|
|
34
45
|
tmp = JSON.stringify(handleAttributes(obj)).replace(/"/g, "'")
|
|
35
46
|
}
|
|
36
|
-
return tmp
|
|
47
|
+
return escapeXml(String(tmp))
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
const tn = '\t\n'
|
|
@@ -45,7 +56,7 @@ function toXml(obj: any, name: string, depth: number) {
|
|
|
45
56
|
const prefix = tn + frontSpace
|
|
46
57
|
if (name === '-json') return ''
|
|
47
58
|
if (name === '#text') {
|
|
48
|
-
return prefix + obj
|
|
59
|
+
return prefix + escapeXml(String(obj))
|
|
49
60
|
}
|
|
50
61
|
if (name === '#cdata-section') {
|
|
51
62
|
return `${prefix}<![CDATA[${obj}]]>`
|
|
@@ -53,6 +64,9 @@ function toXml(obj: any, name: string, depth: number) {
|
|
|
53
64
|
if (name === '#comment') {
|
|
54
65
|
return `${prefix}<!--${obj}-->`
|
|
55
66
|
}
|
|
67
|
+
if (obj !== 0 && obj !== false && !obj) {
|
|
68
|
+
return `${prefix}<${name} />`
|
|
69
|
+
}
|
|
56
70
|
if (`${name}`.charAt(0) === '-') {
|
|
57
71
|
return ` ${name.substring(1)}="${getAttributes(obj)}"`
|
|
58
72
|
}
|
|
@@ -74,7 +88,7 @@ function toXml(obj: any, name: string, depth: number) {
|
|
|
74
88
|
str +=
|
|
75
89
|
attributes + (children !== '' ? `>${children}${prefix}</${name}>` : ' />')
|
|
76
90
|
} else {
|
|
77
|
-
str += `${prefix}<${name}>${obj
|
|
91
|
+
str += `${prefix}<${name}>${escapeXml(String(obj))}</${name}>`
|
|
78
92
|
}
|
|
79
93
|
|
|
80
94
|
return str
|
|
@@ -88,4 +102,4 @@ function lfJson2Xml(obj: any) {
|
|
|
88
102
|
return xmlStr
|
|
89
103
|
}
|
|
90
104
|
|
|
91
|
-
export { lfJson2Xml, handleAttributes }
|
|
105
|
+
export { lfJson2Xml, handleAttributes, escapeXml }
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// @ts-nocheck
|
|
7
7
|
|
|
8
8
|
import { has } from 'lodash-es'
|
|
9
|
+
import { escapeXml } from './json2xml'
|
|
9
10
|
// ========================================================================
|
|
10
11
|
// XML.ObjTree -- XML source code from/to JavaScript object like E4X
|
|
11
12
|
// ========================================================================
|
|
@@ -287,14 +288,7 @@ XML.ObjTree.prototype.scalar_to_xml = function (name, text) {
|
|
|
287
288
|
}
|
|
288
289
|
|
|
289
290
|
// method: xml_escape( text )
|
|
290
|
-
|
|
291
|
-
XML.ObjTree.prototype.xml_escape = function (text) {
|
|
292
|
-
return text
|
|
293
|
-
.replace(/&/g, '&')
|
|
294
|
-
.replace(/</g, '<')
|
|
295
|
-
.replace(/>/g, '>')
|
|
296
|
-
.replace(/"/g, '"')
|
|
297
|
-
}
|
|
291
|
+
XML.ObjTree.prototype.xml_escape = escapeXml
|
|
298
292
|
|
|
299
293
|
/*
|
|
300
294
|
// ========================================================================
|