@dckj-npm/lowcode-plugin-code-generator 1.3.31 → 1.3.33
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.
|
@@ -126,7 +126,7 @@ export function CodeGenActionBtn(_ref) {
|
|
|
126
126
|
}();
|
|
127
127
|
var handleClick = /*#__PURE__*/function () {
|
|
128
128
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
129
|
-
var _sanitizedSchemas$, name, resourceList, allSchema, hasEmptySchema, exported, invalidIndex, resource, emptyIndex, _resource, sanitizedSchemas, missingFileNameIndex, _resource2, primarySchema, originalPrimarySchema, result, error, _t2, _t3;
|
|
129
|
+
var _sanitizedSchemas$, name, resourceList, allSchema, hasEmptySchema, exported, invalidIndex, resource, emptyIndex, _resource, sanitizedSchemas, missingFileNameIndex, _resource2, primarySchema, originalPrimarySchema, safeSchemas, safeResourceList, result, error, _t2, _t3;
|
|
130
130
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
131
131
|
while (1) switch (_context2.prev = _context2.next) {
|
|
132
132
|
case 0:
|
|
@@ -237,13 +237,15 @@ export function CodeGenActionBtn(_ref) {
|
|
|
237
237
|
throw new Error("\u9875\u9762 \"" + ((_resource2 === null || _resource2 === void 0 ? void 0 : _resource2.title) || (_resource2 === null || _resource2 === void 0 ? void 0 : _resource2.id)) + "\" schema \u7F3A\u5C11 fileName \u5B57\u6BB5\uFF0C\u65E0\u6CD5\u51FA\u7801\u3002");
|
|
238
238
|
case 14:
|
|
239
239
|
primarySchema = (_sanitizedSchemas$ = sanitizedSchemas[0]) !== null && _sanitizedSchemas$ !== void 0 ? _sanitizedSchemas$ : null;
|
|
240
|
-
originalPrimarySchema = allSchema[0] ? deepClone(allSchema[0]) : null; //
|
|
240
|
+
originalPrimarySchema = allSchema[0] ? deepClone(allSchema[0]) : null; // 强制序列化,避免 Worker postMessage 结构化克隆 Promise/函数等不可序列化字段
|
|
241
|
+
safeSchemas = JSON.parse(JSON.stringify(sanitizedSchemas));
|
|
242
|
+
safeResourceList = JSON.parse(JSON.stringify(resourceList)); // 出码...
|
|
241
243
|
_context2.next = 15;
|
|
242
244
|
return CodeGenerator.generateCode({
|
|
243
245
|
solution: 'vuejs3',
|
|
244
|
-
schema:
|
|
246
|
+
schema: safeSchemas,
|
|
245
247
|
flattenResult: true,
|
|
246
|
-
resourceList:
|
|
248
|
+
resourceList: safeResourceList
|
|
247
249
|
});
|
|
248
250
|
case 15:
|
|
249
251
|
result = _context2.sent;
|
|
@@ -29,41 +29,58 @@ export function CodeGenResult(_ref) {
|
|
|
29
29
|
}
|
|
30
30
|
var sourcesViewHeight = paneState.expandedKeys.includes('preview') ? '40vh' : '80vh';
|
|
31
31
|
var gravityDemoHeight = paneState.expandedKeys.includes('sources') ? '40vh' : '80vh';
|
|
32
|
-
var
|
|
33
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(
|
|
34
|
-
var zip
|
|
32
|
+
var buildSourcesZip = /*#__PURE__*/function () {
|
|
33
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(code) {
|
|
34
|
+
var zip;
|
|
35
35
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
36
36
|
while (1) switch (_context.prev = _context.next) {
|
|
37
37
|
case 0:
|
|
38
|
-
_context.prev = 0;
|
|
39
|
-
e.preventDefault();
|
|
40
|
-
e.stopPropagation();
|
|
41
38
|
zip = new JSZip();
|
|
42
|
-
Object.values((
|
|
39
|
+
Object.values((code === null || code === void 0 ? void 0 : code.modules) || {}).forEach(function (file) {
|
|
43
40
|
zip.file(file.fpath.replace(/^\/+/, ''), file.code);
|
|
44
41
|
});
|
|
45
|
-
_context.
|
|
46
|
-
return zip.generateAsync({
|
|
42
|
+
return _context.abrupt("return", zip.generateAsync({
|
|
47
43
|
type: 'blob'
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
}));
|
|
45
|
+
case 1:
|
|
46
|
+
case "end":
|
|
47
|
+
return _context.stop();
|
|
48
|
+
}
|
|
49
|
+
}, _callee);
|
|
50
|
+
}));
|
|
51
|
+
return function buildSourcesZip(_x) {
|
|
52
|
+
return _ref2.apply(this, arguments);
|
|
53
|
+
};
|
|
54
|
+
}();
|
|
55
|
+
var handleDownloadSources = /*#__PURE__*/function () {
|
|
56
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(e) {
|
|
57
|
+
var zipBlob, _t;
|
|
58
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
59
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
60
|
+
case 0:
|
|
61
|
+
_context2.prev = 0;
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
_context2.next = 1;
|
|
65
|
+
return buildSourcesZip(gravityCode);
|
|
51
66
|
case 1:
|
|
52
|
-
|
|
67
|
+
zipBlob = _context2.sent;
|
|
68
|
+
FileSaver.saveAs(zipBlob, '51ymb-lowcode-generated-sources.zip');
|
|
69
|
+
_context2.next = 3;
|
|
53
70
|
break;
|
|
54
71
|
case 2:
|
|
55
|
-
|
|
56
|
-
_t =
|
|
72
|
+
_context2.prev = 2;
|
|
73
|
+
_t = _context2["catch"](0);
|
|
57
74
|
console.log('failed to download sources: ', _t);
|
|
58
75
|
Message.error('下载失败!');
|
|
59
76
|
case 3:
|
|
60
77
|
case "end":
|
|
61
|
-
return
|
|
78
|
+
return _context2.stop();
|
|
62
79
|
}
|
|
63
|
-
},
|
|
80
|
+
}, _callee2, null, [[0, 2]]);
|
|
64
81
|
}));
|
|
65
|
-
return function handleDownloadSources(
|
|
66
|
-
return
|
|
82
|
+
return function handleDownloadSources(_x2) {
|
|
83
|
+
return _ref3.apply(this, arguments);
|
|
67
84
|
};
|
|
68
85
|
}();
|
|
69
86
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -133,7 +133,7 @@ function CodeGenActionBtn(_ref) {
|
|
|
133
133
|
}();
|
|
134
134
|
var handleClick = /*#__PURE__*/function () {
|
|
135
135
|
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
136
|
-
var _sanitizedSchemas$, name, resourceList, allSchema, hasEmptySchema, exported, invalidIndex, resource, emptyIndex, _resource, sanitizedSchemas, missingFileNameIndex, _resource2, primarySchema, originalPrimarySchema, result, error, _t2, _t3;
|
|
136
|
+
var _sanitizedSchemas$, name, resourceList, allSchema, hasEmptySchema, exported, invalidIndex, resource, emptyIndex, _resource, sanitizedSchemas, missingFileNameIndex, _resource2, primarySchema, originalPrimarySchema, safeSchemas, safeResourceList, result, error, _t2, _t3;
|
|
137
137
|
return _regenerator["default"].wrap(function (_context2) {
|
|
138
138
|
while (1) switch (_context2.prev = _context2.next) {
|
|
139
139
|
case 0:
|
|
@@ -244,13 +244,15 @@ function CodeGenActionBtn(_ref) {
|
|
|
244
244
|
throw new Error("\u9875\u9762 \"" + ((_resource2 === null || _resource2 === void 0 ? void 0 : _resource2.title) || (_resource2 === null || _resource2 === void 0 ? void 0 : _resource2.id)) + "\" schema \u7F3A\u5C11 fileName \u5B57\u6BB5\uFF0C\u65E0\u6CD5\u51FA\u7801\u3002");
|
|
245
245
|
case 14:
|
|
246
246
|
primarySchema = (_sanitizedSchemas$ = sanitizedSchemas[0]) !== null && _sanitizedSchemas$ !== void 0 ? _sanitizedSchemas$ : null;
|
|
247
|
-
originalPrimarySchema = allSchema[0] ? deepClone(allSchema[0]) : null; //
|
|
247
|
+
originalPrimarySchema = allSchema[0] ? deepClone(allSchema[0]) : null; // 强制序列化,避免 Worker postMessage 结构化克隆 Promise/函数等不可序列化字段
|
|
248
|
+
safeSchemas = JSON.parse(JSON.stringify(sanitizedSchemas));
|
|
249
|
+
safeResourceList = JSON.parse(JSON.stringify(resourceList)); // 出码...
|
|
248
250
|
_context2.next = 15;
|
|
249
251
|
return CodeGenerator.generateCode({
|
|
250
252
|
solution: 'vuejs3',
|
|
251
|
-
schema:
|
|
253
|
+
schema: safeSchemas,
|
|
252
254
|
flattenResult: true,
|
|
253
|
-
resourceList:
|
|
255
|
+
resourceList: safeResourceList
|
|
254
256
|
});
|
|
255
257
|
case 15:
|
|
256
258
|
result = _context2.sent;
|
|
@@ -35,41 +35,58 @@ function CodeGenResult(_ref) {
|
|
|
35
35
|
}
|
|
36
36
|
var sourcesViewHeight = paneState.expandedKeys.includes('preview') ? '40vh' : '80vh';
|
|
37
37
|
var gravityDemoHeight = paneState.expandedKeys.includes('sources') ? '40vh' : '80vh';
|
|
38
|
-
var
|
|
39
|
-
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(
|
|
40
|
-
var zip
|
|
38
|
+
var buildSourcesZip = /*#__PURE__*/function () {
|
|
39
|
+
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(code) {
|
|
40
|
+
var zip;
|
|
41
41
|
return _regenerator["default"].wrap(function (_context) {
|
|
42
42
|
while (1) switch (_context.prev = _context.next) {
|
|
43
43
|
case 0:
|
|
44
|
-
_context.prev = 0;
|
|
45
|
-
e.preventDefault();
|
|
46
|
-
e.stopPropagation();
|
|
47
44
|
zip = new _jszip["default"]();
|
|
48
|
-
Object.values((
|
|
45
|
+
Object.values((code === null || code === void 0 ? void 0 : code.modules) || {}).forEach(function (file) {
|
|
49
46
|
zip.file(file.fpath.replace(/^\/+/, ''), file.code);
|
|
50
47
|
});
|
|
51
|
-
_context.
|
|
52
|
-
return zip.generateAsync({
|
|
48
|
+
return _context.abrupt("return", zip.generateAsync({
|
|
53
49
|
type: 'blob'
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
}));
|
|
51
|
+
case 1:
|
|
52
|
+
case "end":
|
|
53
|
+
return _context.stop();
|
|
54
|
+
}
|
|
55
|
+
}, _callee);
|
|
56
|
+
}));
|
|
57
|
+
return function buildSourcesZip(_x) {
|
|
58
|
+
return _ref2.apply(this, arguments);
|
|
59
|
+
};
|
|
60
|
+
}();
|
|
61
|
+
var handleDownloadSources = /*#__PURE__*/function () {
|
|
62
|
+
var _ref3 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(e) {
|
|
63
|
+
var zipBlob, _t;
|
|
64
|
+
return _regenerator["default"].wrap(function (_context2) {
|
|
65
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
66
|
+
case 0:
|
|
67
|
+
_context2.prev = 0;
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
_context2.next = 1;
|
|
71
|
+
return buildSourcesZip(gravityCode);
|
|
57
72
|
case 1:
|
|
58
|
-
|
|
73
|
+
zipBlob = _context2.sent;
|
|
74
|
+
_fileSaver["default"].saveAs(zipBlob, '51ymb-lowcode-generated-sources.zip');
|
|
75
|
+
_context2.next = 3;
|
|
59
76
|
break;
|
|
60
77
|
case 2:
|
|
61
|
-
|
|
62
|
-
_t =
|
|
78
|
+
_context2.prev = 2;
|
|
79
|
+
_t = _context2["catch"](0);
|
|
63
80
|
console.log('failed to download sources: ', _t);
|
|
64
81
|
_next.Message.error('下载失败!');
|
|
65
82
|
case 3:
|
|
66
83
|
case "end":
|
|
67
|
-
return
|
|
84
|
+
return _context2.stop();
|
|
68
85
|
}
|
|
69
|
-
},
|
|
86
|
+
}, _callee2, null, [[0, 2]]);
|
|
70
87
|
}));
|
|
71
|
-
return function handleDownloadSources(
|
|
72
|
-
return
|
|
88
|
+
return function handleDownloadSources(_x2) {
|
|
89
|
+
return _ref3.apply(this, arguments);
|
|
73
90
|
};
|
|
74
91
|
}();
|
|
75
92
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dckj-npm/lowcode-plugin-code-generator",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.33",
|
|
4
4
|
"description": "集团低代码引擎 - 浏览器出码插件",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@alilc/lowcode-code-generator": "^1.1.7",
|
|
36
36
|
"@alilc/lowcode-plugin-base-monaco-editor": "^1.1.2",
|
|
37
37
|
"@alilc/lowcode-types": "^1.3.4",
|
|
38
|
-
"@dckj-npm/lowcode-code-generator": "^1.2.
|
|
38
|
+
"@dckj-npm/lowcode-code-generator": "^1.2.49",
|
|
39
39
|
"@types/file-saver": "^2.0.7",
|
|
40
40
|
"@types/string-natural-compare": "^3.0.4",
|
|
41
41
|
"codesandbox": "^2.2.3",
|