@dckj-npm/lowcode-plugin-code-generator 1.0.2 → 1.0.4
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.
|
@@ -4,9 +4,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import './CodeGenActionBtn.scss';
|
|
5
5
|
import React, { useState } from 'react';
|
|
6
6
|
import * as CodeGenerator from '@dckj-npm/lowcode-code-generator/standalone-loader';
|
|
7
|
-
import { TransformStage } from '@alilc/lowcode-types';
|
|
8
7
|
import { Button, Drawer, Loading, Message } from '@alifd/next';
|
|
9
8
|
import coerce from 'semver/functions/coerce';
|
|
9
|
+
import { project } from '@alilc/lowcode-engine';
|
|
10
10
|
import { CodeGenResult } from '../CodeGenResult';
|
|
11
11
|
export function CodeGenActionBtn(_ref) {
|
|
12
12
|
var ctx = _ref.ctx;
|
|
@@ -23,7 +23,7 @@ export function CodeGenActionBtn(_ref) {
|
|
|
23
23
|
setState = _useState[1];
|
|
24
24
|
var handleClick = /*#__PURE__*/function () {
|
|
25
25
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
26
|
-
var originalSchema,
|
|
26
|
+
var originalSchema, schema, result;
|
|
27
27
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
28
28
|
while (1) switch (_context.prev = _context.next) {
|
|
29
29
|
case 0:
|
|
@@ -39,26 +39,22 @@ export function CodeGenActionBtn(_ref) {
|
|
|
39
39
|
|
|
40
40
|
// 获取 schema,并修正
|
|
41
41
|
_context.next = 4;
|
|
42
|
-
return
|
|
42
|
+
return project.exportSchema();
|
|
43
43
|
case 4:
|
|
44
44
|
originalSchema = _context.sent;
|
|
45
45
|
console.log('ctx ', ctx);
|
|
46
|
-
console.log('isActive ', ctx.workspace.isActive)
|
|
47
|
-
console.log('window ', ctx.workspace.window)
|
|
48
|
-
console.log('skeleton ', ctx.workspace.skeleton)
|
|
49
|
-
console.log('windows ', ctx.workspace.windows)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_context.next = 14;
|
|
53
|
-
return ctx.project.exportSchema();
|
|
54
|
-
case 14:
|
|
55
|
-
originalSchema2 = _context.sent;
|
|
56
|
-
_context.next = 17;
|
|
46
|
+
// console.log('isActive ', ctx.workspace.isActive)
|
|
47
|
+
// console.log('window.exportSchema ', ctx.workspace.window.exportSchema())
|
|
48
|
+
// console.log('skeleton ', ctx.workspace.skeleton)
|
|
49
|
+
// console.log('windows ', ctx.workspace.windows)
|
|
50
|
+
// const originalSchema2 = await ctx.project.exportSchema();
|
|
51
|
+
_context.next = 8;
|
|
57
52
|
return fixSchema(originalSchema);
|
|
58
|
-
case
|
|
53
|
+
case 8:
|
|
59
54
|
schema = _context.sent;
|
|
60
55
|
console.log('got schema:222222 ', schema);
|
|
61
|
-
console.log('got schema:33333333 ', originalSchema2);
|
|
56
|
+
// console.log('got schema:33333333 ', originalSchema2);
|
|
57
|
+
|
|
62
58
|
setState(function (prev) {
|
|
63
59
|
return _extends({}, prev, {
|
|
64
60
|
schema: schema,
|
|
@@ -67,13 +63,13 @@ export function CodeGenActionBtn(_ref) {
|
|
|
67
63
|
});
|
|
68
64
|
|
|
69
65
|
// 出码...
|
|
70
|
-
_context.next =
|
|
66
|
+
_context.next = 13;
|
|
71
67
|
return CodeGenerator.generateCode({
|
|
72
68
|
solution: 'vuejs3',
|
|
73
69
|
schema: schema,
|
|
74
70
|
flattenResult: true
|
|
75
71
|
});
|
|
76
|
-
case
|
|
72
|
+
case 13:
|
|
77
73
|
result = _context.sent;
|
|
78
74
|
console.log('generated: ', result);
|
|
79
75
|
setState(function (prev) {
|
|
@@ -82,10 +78,10 @@ export function CodeGenActionBtn(_ref) {
|
|
|
82
78
|
result: result
|
|
83
79
|
});
|
|
84
80
|
});
|
|
85
|
-
_context.next =
|
|
81
|
+
_context.next = 22;
|
|
86
82
|
break;
|
|
87
|
-
case
|
|
88
|
-
_context.prev =
|
|
83
|
+
case 18:
|
|
84
|
+
_context.prev = 18;
|
|
89
85
|
_context.t0 = _context["catch"](0);
|
|
90
86
|
console.error('failed to run code generator: ', _context.t0);
|
|
91
87
|
setState(function (prev) {
|
|
@@ -94,11 +90,11 @@ export function CodeGenActionBtn(_ref) {
|
|
|
94
90
|
error: _context.t0 instanceof Error ? _context.t0 : new Error("" + ((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || _context.t0))
|
|
95
91
|
});
|
|
96
92
|
});
|
|
97
|
-
case
|
|
93
|
+
case 22:
|
|
98
94
|
case "end":
|
|
99
95
|
return _context.stop();
|
|
100
96
|
}
|
|
101
|
-
}, _callee, null, [[0,
|
|
97
|
+
}, _callee, null, [[0, 18]]);
|
|
102
98
|
}));
|
|
103
99
|
return function handleClick() {
|
|
104
100
|
return _ref2.apply(this, arguments);
|
|
@@ -10,9 +10,9 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
10
10
|
require("./CodeGenActionBtn.scss");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var CodeGenerator = _interopRequireWildcard(require("@dckj-npm/lowcode-code-generator/standalone-loader"));
|
|
13
|
-
var _lowcodeTypes = require("@alilc/lowcode-types");
|
|
14
13
|
var _next = require("@alifd/next");
|
|
15
14
|
var _coerce = _interopRequireDefault(require("semver/functions/coerce"));
|
|
15
|
+
var _lowcodeEngine = require("@alilc/lowcode-engine");
|
|
16
16
|
var _CodeGenResult = require("../CodeGenResult");
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
@@ -31,7 +31,7 @@ function CodeGenActionBtn(_ref) {
|
|
|
31
31
|
setState = _useState[1];
|
|
32
32
|
var handleClick = /*#__PURE__*/function () {
|
|
33
33
|
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
34
|
-
var originalSchema,
|
|
34
|
+
var originalSchema, schema, result;
|
|
35
35
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
36
36
|
while (1) switch (_context.prev = _context.next) {
|
|
37
37
|
case 0:
|
|
@@ -47,26 +47,22 @@ function CodeGenActionBtn(_ref) {
|
|
|
47
47
|
|
|
48
48
|
// 获取 schema,并修正
|
|
49
49
|
_context.next = 4;
|
|
50
|
-
return
|
|
50
|
+
return _lowcodeEngine.project.exportSchema();
|
|
51
51
|
case 4:
|
|
52
52
|
originalSchema = _context.sent;
|
|
53
53
|
console.log('ctx ', ctx);
|
|
54
|
-
console.log('isActive ', ctx.workspace.isActive)
|
|
55
|
-
console.log('window ', ctx.workspace.window)
|
|
56
|
-
console.log('skeleton ', ctx.workspace.skeleton)
|
|
57
|
-
console.log('windows ', ctx.workspace.windows)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
_context.next = 14;
|
|
61
|
-
return ctx.project.exportSchema();
|
|
62
|
-
case 14:
|
|
63
|
-
originalSchema2 = _context.sent;
|
|
64
|
-
_context.next = 17;
|
|
54
|
+
// console.log('isActive ', ctx.workspace.isActive)
|
|
55
|
+
// console.log('window.exportSchema ', ctx.workspace.window.exportSchema())
|
|
56
|
+
// console.log('skeleton ', ctx.workspace.skeleton)
|
|
57
|
+
// console.log('windows ', ctx.workspace.windows)
|
|
58
|
+
// const originalSchema2 = await ctx.project.exportSchema();
|
|
59
|
+
_context.next = 8;
|
|
65
60
|
return fixSchema(originalSchema);
|
|
66
|
-
case
|
|
61
|
+
case 8:
|
|
67
62
|
schema = _context.sent;
|
|
68
63
|
console.log('got schema:222222 ', schema);
|
|
69
|
-
console.log('got schema:33333333 ', originalSchema2);
|
|
64
|
+
// console.log('got schema:33333333 ', originalSchema2);
|
|
65
|
+
|
|
70
66
|
setState(function (prev) {
|
|
71
67
|
return (0, _extends2["default"])({}, prev, {
|
|
72
68
|
schema: schema,
|
|
@@ -75,13 +71,13 @@ function CodeGenActionBtn(_ref) {
|
|
|
75
71
|
});
|
|
76
72
|
|
|
77
73
|
// 出码...
|
|
78
|
-
_context.next =
|
|
74
|
+
_context.next = 13;
|
|
79
75
|
return CodeGenerator.generateCode({
|
|
80
76
|
solution: 'vuejs3',
|
|
81
77
|
schema: schema,
|
|
82
78
|
flattenResult: true
|
|
83
79
|
});
|
|
84
|
-
case
|
|
80
|
+
case 13:
|
|
85
81
|
result = _context.sent;
|
|
86
82
|
console.log('generated: ', result);
|
|
87
83
|
setState(function (prev) {
|
|
@@ -90,10 +86,10 @@ function CodeGenActionBtn(_ref) {
|
|
|
90
86
|
result: result
|
|
91
87
|
});
|
|
92
88
|
});
|
|
93
|
-
_context.next =
|
|
89
|
+
_context.next = 22;
|
|
94
90
|
break;
|
|
95
|
-
case
|
|
96
|
-
_context.prev =
|
|
91
|
+
case 18:
|
|
92
|
+
_context.prev = 18;
|
|
97
93
|
_context.t0 = _context["catch"](0);
|
|
98
94
|
console.error('failed to run code generator: ', _context.t0);
|
|
99
95
|
setState(function (prev) {
|
|
@@ -102,11 +98,11 @@ function CodeGenActionBtn(_ref) {
|
|
|
102
98
|
error: _context.t0 instanceof Error ? _context.t0 : new Error("" + ((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || _context.t0))
|
|
103
99
|
});
|
|
104
100
|
});
|
|
105
|
-
case
|
|
101
|
+
case 22:
|
|
106
102
|
case "end":
|
|
107
103
|
return _context.stop();
|
|
108
104
|
}
|
|
109
|
-
}, _callee, null, [[0,
|
|
105
|
+
}, _callee, null, [[0, 18]]);
|
|
110
106
|
}));
|
|
111
107
|
return function handleClick() {
|
|
112
108
|
return _ref2.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dckj-npm/lowcode-plugin-code-generator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "集团低代码引擎 - 浏览器出码插件",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@alifd/build-plugin-lowcode": "^0.4.0",
|
|
36
|
+
"@alilc/build-plugin-alt": "^1.3.4",
|
|
35
37
|
"@alilc/lowcode-code-generator": "^1.0.4",
|
|
36
38
|
"@alilc/lowcode-plugin-base-monaco-editor": "^1.0.0",
|
|
37
39
|
"@alilc/lowcode-types": "^1.0.0",
|