@dckj-npm/lowcode-plugin-code-generator 1.2.8 → 1.3.0

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.
@@ -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 name, resourceList, allSchema, result;
26
+ var name, resourceList, allSchema, resultSchema, result;
27
27
  return _regeneratorRuntime.wrap(function _callee$(_context) {
28
28
  while (1) switch (_context.prev = _context.next) {
29
29
  case 0:
@@ -44,16 +44,19 @@ export function CodeGenActionBtn(_ref) {
44
44
  return getResourceListFromLocalStorage(name);
45
45
  case 5:
46
46
  resourceList = _context.sent;
47
- _context.next = 8;
47
+ console.log('resourceList', resourceList);
48
+ _context.next = 9;
48
49
  return getAllSchemaByResourceList(name, resourceList);
49
- case 8:
50
+ case 9:
50
51
  allSchema = _context.sent;
51
- _context.next = 11;
52
+ _context.next = 12;
52
53
  return Promise.all(allSchema.map(function (item) {
53
54
  return fixSchema(item);
54
55
  }));
55
- case 11:
56
- allSchema = _context.sent;
56
+ case 12:
57
+ resultSchema = _context.sent;
58
+ console.log('allSchema', allSchema);
59
+ console.log('resultSchema', resultSchema);
57
60
  // console.log('ctx ', ctx)
58
61
  // console.log('isActive ', ctx.workspace.isActive)
59
62
  // console.log('window.exportSchema ', ctx.workspace.window.exportSchema())
@@ -61,7 +64,7 @@ export function CodeGenActionBtn(_ref) {
61
64
  // console.log('windows ', ctx.workspace.windows)
62
65
  // const originalSchema2 = await ctx.project.exportSchema();
63
66
  // const schema = await fixSchema(originalSchema);
64
- console.log('got schema:222222 ', schema);
67
+ // console.log('got schema:222222 ', schema);
65
68
  // console.log('got schema:33333333 ', originalSchema2);
66
69
 
67
70
  setState(function (prev) {
@@ -69,14 +72,14 @@ export function CodeGenActionBtn(_ref) {
69
72
  });
70
73
 
71
74
  // 出码...
72
- _context.next = 16;
75
+ _context.next = 18;
73
76
  return CodeGenerator.generateCode({
74
77
  solution: 'vuejs3',
75
- schema: allSchema,
78
+ schema: resultSchema,
76
79
  flattenResult: true,
77
80
  resourceList: resourceList
78
81
  });
79
- case 16:
82
+ case 18:
80
83
  result = _context.sent;
81
84
  console.log('generated: ', result);
82
85
  setState(function (prev) {
@@ -85,10 +88,10 @@ export function CodeGenActionBtn(_ref) {
85
88
  result: result
86
89
  });
87
90
  });
88
- _context.next = 25;
91
+ _context.next = 27;
89
92
  break;
90
- case 21:
91
- _context.prev = 21;
93
+ case 23:
94
+ _context.prev = 23;
92
95
  _context.t0 = _context["catch"](0);
93
96
  console.error('failed to run code generator: ', _context.t0);
94
97
  setState(function (prev) {
@@ -97,11 +100,11 @@ export function CodeGenActionBtn(_ref) {
97
100
  error: _context.t0 instanceof Error ? _context.t0 : new Error("" + ((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || _context.t0))
98
101
  });
99
102
  });
100
- case 25:
103
+ case 27:
101
104
  case "end":
102
105
  return _context.stop();
103
106
  }
104
- }, _callee, null, [[0, 21]]);
107
+ }, _callee, null, [[0, 23]]);
105
108
  }));
106
109
  return function handleClick() {
107
110
  return _ref2.apply(this, arguments);
package/es/utils/utils.js CHANGED
@@ -46,7 +46,11 @@ export var getAllSchemaByResourceList = /*#__PURE__*/function () {
46
46
  return _context2.abrupt("return");
47
47
  case 3:
48
48
  return _context2.abrupt("return", ResourceList.map(function (item) {
49
- return JSON.parse(window.localStorage.getItem(getLSName(scenarioName, item.id)) || '{}');
49
+ console.log('ResourceList.map', item);
50
+ console.log('getLSName(scenarioName, item.id)', getLSName(scenarioName, item.id));
51
+ var localSchema = window.localStorage.getItem(getLSName(scenarioName, item.id)) || '{}';
52
+ console.log('localSchema', localSchema);
53
+ return JSON.parse(localSchema);
50
54
  }));
51
55
  case 4:
52
56
  case "end":
@@ -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 name, resourceList, allSchema, result;
34
+ var name, resourceList, allSchema, resultSchema, result;
35
35
  return _regenerator["default"].wrap(function _callee$(_context) {
36
36
  while (1) switch (_context.prev = _context.next) {
37
37
  case 0:
@@ -52,16 +52,19 @@ function CodeGenActionBtn(_ref) {
52
52
  return (0, _utils.getResourceListFromLocalStorage)(name);
53
53
  case 5:
54
54
  resourceList = _context.sent;
55
- _context.next = 8;
55
+ console.log('resourceList', resourceList);
56
+ _context.next = 9;
56
57
  return (0, _utils.getAllSchemaByResourceList)(name, resourceList);
57
- case 8:
58
+ case 9:
58
59
  allSchema = _context.sent;
59
- _context.next = 11;
60
+ _context.next = 12;
60
61
  return Promise.all(allSchema.map(function (item) {
61
62
  return fixSchema(item);
62
63
  }));
63
- case 11:
64
- allSchema = _context.sent;
64
+ case 12:
65
+ resultSchema = _context.sent;
66
+ console.log('allSchema', allSchema);
67
+ console.log('resultSchema', resultSchema);
65
68
  // console.log('ctx ', ctx)
66
69
  // console.log('isActive ', ctx.workspace.isActive)
67
70
  // console.log('window.exportSchema ', ctx.workspace.window.exportSchema())
@@ -69,7 +72,7 @@ function CodeGenActionBtn(_ref) {
69
72
  // console.log('windows ', ctx.workspace.windows)
70
73
  // const originalSchema2 = await ctx.project.exportSchema();
71
74
  // const schema = await fixSchema(originalSchema);
72
- console.log('got schema:222222 ', schema);
75
+ // console.log('got schema:222222 ', schema);
73
76
  // console.log('got schema:33333333 ', originalSchema2);
74
77
 
75
78
  setState(function (prev) {
@@ -77,14 +80,14 @@ function CodeGenActionBtn(_ref) {
77
80
  });
78
81
 
79
82
  // 出码...
80
- _context.next = 16;
83
+ _context.next = 18;
81
84
  return CodeGenerator.generateCode({
82
85
  solution: 'vuejs3',
83
- schema: allSchema,
86
+ schema: resultSchema,
84
87
  flattenResult: true,
85
88
  resourceList: resourceList
86
89
  });
87
- case 16:
90
+ case 18:
88
91
  result = _context.sent;
89
92
  console.log('generated: ', result);
90
93
  setState(function (prev) {
@@ -93,10 +96,10 @@ function CodeGenActionBtn(_ref) {
93
96
  result: result
94
97
  });
95
98
  });
96
- _context.next = 25;
99
+ _context.next = 27;
97
100
  break;
98
- case 21:
99
- _context.prev = 21;
101
+ case 23:
102
+ _context.prev = 23;
100
103
  _context.t0 = _context["catch"](0);
101
104
  console.error('failed to run code generator: ', _context.t0);
102
105
  setState(function (prev) {
@@ -105,11 +108,11 @@ function CodeGenActionBtn(_ref) {
105
108
  error: _context.t0 instanceof Error ? _context.t0 : new Error("" + ((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || _context.t0))
106
109
  });
107
110
  });
108
- case 25:
111
+ case 27:
109
112
  case "end":
110
113
  return _context.stop();
111
114
  }
112
- }, _callee, null, [[0, 21]]);
115
+ }, _callee, null, [[0, 23]]);
113
116
  }));
114
117
  return function handleClick() {
115
118
  return _ref2.apply(this, arguments);
@@ -54,7 +54,11 @@ var getAllSchemaByResourceList = exports.getAllSchemaByResourceList = /*#__PURE_
54
54
  return _context2.abrupt("return");
55
55
  case 3:
56
56
  return _context2.abrupt("return", ResourceList.map(function (item) {
57
- return JSON.parse(window.localStorage.getItem(getLSName(scenarioName, item.id)) || '{}');
57
+ console.log('ResourceList.map', item);
58
+ console.log('getLSName(scenarioName, item.id)', getLSName(scenarioName, item.id));
59
+ var localSchema = window.localStorage.getItem(getLSName(scenarioName, item.id)) || '{}';
60
+ console.log('localSchema', localSchema);
61
+ return JSON.parse(localSchema);
58
62
  }));
59
63
  case 4:
60
64
  case "end":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dckj-npm/lowcode-plugin-code-generator",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "集团低代码引擎 - 浏览器出码插件",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",