@dckj-npm/lowcode-plugin-code-generator 1.3.1 → 1.3.3

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.
Files changed (73) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +53 -52
  3. package/es/components/CodeGenActionBtn/CodeGenActionBtn.js +11 -14
  4. package/es/components/CodeGenActionBtn/CodeGenActionBtn.scss +13 -13
  5. package/es/components/CodeGenPreview/CodeGenPreview.scss +16 -16
  6. package/es/components/CodeGenPreview/useIsInIntranet.js +4 -4
  7. package/es/components/CodeGenResult/CodeGenResult.scss +7 -7
  8. package/es/components/CodeSandboxPreview/CodeSandboxPreview.scss +18 -18
  9. package/es/components/FileTypeIcon/FileTypeIcon.scss +36 -36
  10. package/es/components/SourcesView/SourcesView.scss +24 -24
  11. package/es/demo/index.scss +56 -56
  12. package/es/utils/utils.js +14 -17
  13. package/lib/components/CodeGenActionBtn/CodeGenActionBtn.js +11 -14
  14. package/lib/components/CodeGenActionBtn/CodeGenActionBtn.scss +13 -13
  15. package/lib/components/CodeGenPreview/CodeGenPreview.scss +16 -16
  16. package/lib/components/CodeGenPreview/useIsInIntranet.js +4 -4
  17. package/lib/components/CodeGenResult/CodeGenResult.scss +7 -7
  18. package/lib/components/CodeSandboxPreview/CodeSandboxPreview.scss +18 -18
  19. package/lib/components/FileTypeIcon/FileTypeIcon.scss +36 -36
  20. package/lib/components/SourcesView/SourcesView.scss +24 -24
  21. package/lib/demo/index.scss +56 -56
  22. package/lib/utils/utils.js +14 -17
  23. package/package.json +94 -94
  24. package/es/components/CodeGenActionBtn/CodeGenActionBtn.d.ts +0 -8
  25. package/es/components/CodeGenActionBtn/index.d.ts +0 -1
  26. package/es/components/CodeGenPreview/CodeGenPreview.d.ts +0 -8
  27. package/es/components/CodeGenPreview/fixPreviewCode.d.ts +0 -2
  28. package/es/components/CodeGenPreview/index.d.ts +0 -1
  29. package/es/components/CodeGenPreview/useIsInIntranet.d.ts +0 -4
  30. package/es/components/CodeGenResult/CodeGenResult.d.ts +0 -9
  31. package/es/components/CodeGenResult/index.d.ts +0 -1
  32. package/es/components/CodeSandboxPreview/CodeSandboxPreview.d.ts +0 -4
  33. package/es/components/CodeSandboxPreview/index.d.ts +0 -1
  34. package/es/components/FileTypeIcon/FileTypeIcon.d.ts +0 -6
  35. package/es/components/FileTypeIcon/index.d.ts +0 -1
  36. package/es/components/GravityCode/GravityCode.d.ts +0 -9
  37. package/es/components/GravityCode/index.d.ts +0 -1
  38. package/es/components/GravityPreview/ForceUpdate.d.ts +0 -6
  39. package/es/components/GravityPreview/GravityPreview.d.ts +0 -7
  40. package/es/components/GravityPreview/GravitySdk.d.ts +0 -10
  41. package/es/components/GravityPreview/index.d.ts +0 -1
  42. package/es/components/SourcesView/SourcesView.d.ts +0 -9
  43. package/es/components/SourcesView/index.d.ts +0 -1
  44. package/es/demo/index.d.ts +0 -1
  45. package/es/index.d.ts +0 -30
  46. package/es/types/SyncCodeGenResult.d.ts +0 -16
  47. package/es/types/index.d.ts +0 -1
  48. package/es/utils/utils.d.ts +0 -26
  49. package/lib/components/CodeGenActionBtn/CodeGenActionBtn.d.ts +0 -8
  50. package/lib/components/CodeGenActionBtn/index.d.ts +0 -1
  51. package/lib/components/CodeGenPreview/CodeGenPreview.d.ts +0 -8
  52. package/lib/components/CodeGenPreview/fixPreviewCode.d.ts +0 -2
  53. package/lib/components/CodeGenPreview/index.d.ts +0 -1
  54. package/lib/components/CodeGenPreview/useIsInIntranet.d.ts +0 -4
  55. package/lib/components/CodeGenResult/CodeGenResult.d.ts +0 -9
  56. package/lib/components/CodeGenResult/index.d.ts +0 -1
  57. package/lib/components/CodeSandboxPreview/CodeSandboxPreview.d.ts +0 -4
  58. package/lib/components/CodeSandboxPreview/index.d.ts +0 -1
  59. package/lib/components/FileTypeIcon/FileTypeIcon.d.ts +0 -6
  60. package/lib/components/FileTypeIcon/index.d.ts +0 -1
  61. package/lib/components/GravityCode/GravityCode.d.ts +0 -9
  62. package/lib/components/GravityCode/index.d.ts +0 -1
  63. package/lib/components/GravityPreview/ForceUpdate.d.ts +0 -6
  64. package/lib/components/GravityPreview/GravityPreview.d.ts +0 -7
  65. package/lib/components/GravityPreview/GravitySdk.d.ts +0 -10
  66. package/lib/components/GravityPreview/index.d.ts +0 -1
  67. package/lib/components/SourcesView/SourcesView.d.ts +0 -9
  68. package/lib/components/SourcesView/index.d.ts +0 -1
  69. package/lib/demo/index.d.ts +0 -1
  70. package/lib/index.d.ts +0 -30
  71. package/lib/types/SyncCodeGenResult.d.ts +0 -16
  72. package/lib/types/index.d.ts +0 -1
  73. package/lib/utils/utils.d.ts +0 -26
@@ -52,19 +52,16 @@ function CodeGenActionBtn(_ref) {
52
52
  return (0, _utils.getResourceListFromLocalStorage)(name);
53
53
  case 5:
54
54
  resourceList = _context.sent;
55
- console.log('resourceList', resourceList);
56
- _context.next = 9;
55
+ _context.next = 8;
57
56
  return (0, _utils.getAllSchemaByResourceList)(name, resourceList);
58
- case 9:
57
+ case 8:
59
58
  allSchema = _context.sent;
60
- _context.next = 12;
59
+ _context.next = 11;
61
60
  return Promise.all(allSchema.map(function (item) {
62
61
  return fixSchema(item);
63
62
  }));
64
- case 12:
63
+ case 11:
65
64
  resultSchema = _context.sent;
66
- console.log('allSchema', allSchema);
67
- console.log('resultSchema', resultSchema);
68
65
  // console.log('ctx ', ctx)
69
66
  // console.log('isActive ', ctx.workspace.isActive)
70
67
  // console.log('window.exportSchema ', ctx.workspace.window.exportSchema())
@@ -80,14 +77,14 @@ function CodeGenActionBtn(_ref) {
80
77
  });
81
78
 
82
79
  // 出码...
83
- _context.next = 18;
80
+ _context.next = 15;
84
81
  return CodeGenerator.generateCode({
85
82
  solution: 'vuejs3',
86
83
  schema: resultSchema,
87
84
  flattenResult: true,
88
85
  resourceList: resourceList
89
86
  });
90
- case 18:
87
+ case 15:
91
88
  result = _context.sent;
92
89
  console.log('generated: ', result);
93
90
  setState(function (prev) {
@@ -96,10 +93,10 @@ function CodeGenActionBtn(_ref) {
96
93
  result: result
97
94
  });
98
95
  });
99
- _context.next = 27;
96
+ _context.next = 24;
100
97
  break;
101
- case 23:
102
- _context.prev = 23;
98
+ case 20:
99
+ _context.prev = 20;
103
100
  _context.t0 = _context["catch"](0);
104
101
  console.error('failed to run code generator: ', _context.t0);
105
102
  setState(function (prev) {
@@ -108,11 +105,11 @@ function CodeGenActionBtn(_ref) {
108
105
  error: _context.t0 instanceof Error ? _context.t0 : new Error("" + ((_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || _context.t0))
109
106
  });
110
107
  });
111
- case 27:
108
+ case 24:
112
109
  case "end":
113
110
  return _context.stop();
114
111
  }
115
- }, _callee, null, [[0, 23]]);
112
+ }, _callee, null, [[0, 20]]);
116
113
  }));
117
114
  return function handleClick() {
118
115
  return _ref2.apply(this, arguments);
@@ -1,13 +1,13 @@
1
- .code-gen-plugin-loading {
2
- width: 100%;
3
- margin: 2em auto;
4
- }
5
-
6
- .code-gen-plugin-result {
7
- width: 100%;
8
- .next-message-error {
9
- .next-message-content {
10
- white-space: pre-wrap;
11
- }
12
- }
13
- }
1
+ .code-gen-plugin-loading {
2
+ width: 100%;
3
+ margin: 2em auto;
4
+ }
5
+
6
+ .code-gen-plugin-result {
7
+ width: 100%;
8
+ .next-message-error {
9
+ .next-message-content {
10
+ white-space: pre-wrap;
11
+ }
12
+ }
13
+ }
@@ -1,16 +1,16 @@
1
- .code-gen-preview-tabs {
2
- display: flex;
3
- flex-direction: column;
4
- height: 100%;
5
-
6
- .next-tabs-bar {
7
- flex-shrink: 0;
8
- }
9
-
10
- .next-tabs-content {
11
- flex: 1;
12
- .next-tabs-tabpane {
13
- height: 100%;
14
- }
15
- }
16
- }
1
+ .code-gen-preview-tabs {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100%;
5
+
6
+ .next-tabs-bar {
7
+ flex-shrink: 0;
8
+ }
9
+
10
+ .next-tabs-content {
11
+ flex: 1;
12
+ .next-tabs-tabpane {
13
+ height: 100%;
14
+ }
15
+ }
16
+ }
@@ -11,8 +11,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
11
11
  // 预先检测下是否在内网环境中
12
12
  var isInIntranetPromise = detectIsInIntranet();
13
13
 
14
- /**
15
- * 判断是否在内网环境中中
14
+ /**
15
+ * 判断是否在内网环境中中
16
16
  */
17
17
  function useIsInIntranet() {
18
18
  var _React$useState = _react["default"].useState({
@@ -34,8 +34,8 @@ function useIsInIntranet() {
34
34
  return state.isInIntranet;
35
35
  }
36
36
 
37
- /**
38
- * 判断是否在内网环境中中
37
+ /**
38
+ * 判断是否在内网环境中中
39
39
  */
40
40
  function detectIsInIntranet() {
41
41
  return _detectIsInIntranet.apply(this, arguments);
@@ -1,7 +1,7 @@
1
- .code-gen-result {
2
- .code-gen-result-gravity-demo {
3
- iframe {
4
- height: 100%;
5
- }
6
- }
7
- }
1
+ .code-gen-result {
2
+ .code-gen-result-gravity-demo {
3
+ iframe {
4
+ height: 100%;
5
+ }
6
+ }
7
+ }
@@ -1,18 +1,18 @@
1
- .code-gen-plugin-code-sandbox-preview {
2
- display: flex;
3
- flex-direction: row;
4
- align-items: center;
5
- align-content: center;
6
- justify-content: center;
7
- justify-items: center;
8
- height: 100%;
9
-
10
- iframe {
11
- width: 100%;
12
- height: 100%;
13
- min-height: 300px;
14
- border: 0;
15
- border-radius: 0;
16
- overflow: hidden;
17
- }
18
- }
1
+ .code-gen-plugin-code-sandbox-preview {
2
+ display: flex;
3
+ flex-direction: row;
4
+ align-items: center;
5
+ align-content: center;
6
+ justify-content: center;
7
+ justify-items: center;
8
+ height: 100%;
9
+
10
+ iframe {
11
+ width: 100%;
12
+ height: 100%;
13
+ min-height: 300px;
14
+ border: 0;
15
+ border-radius: 0;
16
+ overflow: hidden;
17
+ }
18
+ }
@@ -1,36 +1,36 @@
1
- // source: https://at.alicdn.com/t/font_2997782_rtal7ux80t.css
2
-
3
- @font-face {
4
- font-family: "file-types-iconfont"; /* Project id 2997782 */
5
- src: url('//at.alicdn.com/t/font_2997782_rtal7ux80t.woff2?t=1638951976966') format('woff2'),
6
- url('//at.alicdn.com/t/font_2997782_rtal7ux80t.woff?t=1638951976966') format('woff'),
7
- url('//at.alicdn.com/t/font_2997782_rtal7ux80t.ttf?t=1638951976966') format('truetype');
8
- }
9
-
10
- .file-types-iconfont {
11
- font-family: "file-types-iconfont" !important;
12
- font-size: 16px;
13
- font-style: normal;
14
- -webkit-font-smoothing: antialiased;
15
- -moz-osx-font-smoothing: grayscale;
16
- }
17
-
18
- .file-types-icon-folder:before {
19
- content: "\e6e9";
20
- }
21
-
22
- .file-types-icon-text:before {
23
- content: "\e6a7";
24
- }
25
-
26
- .file-types-icon-jsx:before {
27
- content: "\e63b";
28
- }
29
-
30
- .file-types-icon-js:before {
31
- content: "\e618";
32
- }
33
-
34
- .file-types-icon-json:before {
35
- content: "\e642";
36
- }
1
+ // source: https://at.alicdn.com/t/font_2997782_rtal7ux80t.css
2
+
3
+ @font-face {
4
+ font-family: "file-types-iconfont"; /* Project id 2997782 */
5
+ src: url('//at.alicdn.com/t/font_2997782_rtal7ux80t.woff2?t=1638951976966') format('woff2'),
6
+ url('//at.alicdn.com/t/font_2997782_rtal7ux80t.woff?t=1638951976966') format('woff'),
7
+ url('//at.alicdn.com/t/font_2997782_rtal7ux80t.ttf?t=1638951976966') format('truetype');
8
+ }
9
+
10
+ .file-types-iconfont {
11
+ font-family: "file-types-iconfont" !important;
12
+ font-size: 16px;
13
+ font-style: normal;
14
+ -webkit-font-smoothing: antialiased;
15
+ -moz-osx-font-smoothing: grayscale;
16
+ }
17
+
18
+ .file-types-icon-folder:before {
19
+ content: "\e6e9";
20
+ }
21
+
22
+ .file-types-icon-text:before {
23
+ content: "\e6a7";
24
+ }
25
+
26
+ .file-types-icon-jsx:before {
27
+ content: "\e63b";
28
+ }
29
+
30
+ .file-types-icon-js:before {
31
+ content: "\e618";
32
+ }
33
+
34
+ .file-types-icon-json:before {
35
+ content: "\e642";
36
+ }
@@ -1,24 +1,24 @@
1
- .code-gen-sources-view {
2
- height: 100%;
3
- .sources-panes {
4
- display: flex;
5
- flex-direction: row;
6
- height: 100%;
7
- }
8
- .file-tree-pane {
9
- width: 230px;
10
- overflow-y: auto;
11
- height: 100%;
12
- border-right: 1px solid #e0e0e0;
13
- .file-types-iconfont {
14
- font-size: 12px;
15
- margin-right: 4px;
16
- margin-left: -10px;
17
- }
18
- }
19
- .source-code-pane {
20
- flex: 1;
21
- overflow-y: auto;
22
- height: 100%;
23
- }
24
- }
1
+ .code-gen-sources-view {
2
+ height: 100%;
3
+ .sources-panes {
4
+ display: flex;
5
+ flex-direction: row;
6
+ height: 100%;
7
+ }
8
+ .file-tree-pane {
9
+ width: 230px;
10
+ overflow-y: auto;
11
+ height: 100%;
12
+ border-right: 1px solid #e0e0e0;
13
+ .file-types-iconfont {
14
+ font-size: 12px;
15
+ margin-right: 4px;
16
+ margin-left: -10px;
17
+ }
18
+ }
19
+ .source-code-pane {
20
+ flex: 1;
21
+ overflow-y: auto;
22
+ height: 100%;
23
+ }
24
+ }
@@ -1,56 +1,56 @@
1
- body {
2
- font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma, Arial, PingFang SC-Light, Microsoft YaHei;
3
- font-size: 12px;
4
- * {
5
- box-sizing: border-box;
6
- }
7
- }
8
-
9
- body,
10
- #lce-container {
11
- position: fixed;
12
- left: 0;
13
- right: 0;
14
- bottom: 0;
15
- top: 0;
16
- box-sizing: border-box;
17
- padding: 0;
18
- margin: 0;
19
- overflow: hidden;
20
- text-rendering: optimizeLegibility;
21
- -webkit-user-select: none;
22
- -webkit-user-drag: none;
23
- -webkit-text-size-adjust: none;
24
- -webkit-touch-callout: none;
25
- -webkit-font-smoothing: antialiased;
26
- #engine {
27
- width: 100%;
28
- height: 100%;
29
- }
30
- }
31
-
32
- html {
33
- min-width: 1024px;
34
- }
35
-
36
- .save-sample {
37
- width: 80px;
38
- height: 30px;
39
- background-color: #5584ff;
40
- border: none;
41
- outline: none;
42
- border-radius: 4px;
43
- color: white;
44
- cursor: pointer;
45
- }
46
-
47
- .load-assets {
48
- width: 100px;
49
- height: 30px;
50
- background-color: #5584ff;
51
- border: none;
52
- outline: none;
53
- border-radius: 4px;
54
- color: white;
55
- cursor: pointer;
56
- }
1
+ body {
2
+ font-family: PingFangSC-Regular, Roboto, Helvetica Neue, Helvetica, Tahoma, Arial, PingFang SC-Light, Microsoft YaHei;
3
+ font-size: 12px;
4
+ * {
5
+ box-sizing: border-box;
6
+ }
7
+ }
8
+
9
+ body,
10
+ #lce-container {
11
+ position: fixed;
12
+ left: 0;
13
+ right: 0;
14
+ bottom: 0;
15
+ top: 0;
16
+ box-sizing: border-box;
17
+ padding: 0;
18
+ margin: 0;
19
+ overflow: hidden;
20
+ text-rendering: optimizeLegibility;
21
+ -webkit-user-select: none;
22
+ -webkit-user-drag: none;
23
+ -webkit-text-size-adjust: none;
24
+ -webkit-touch-callout: none;
25
+ -webkit-font-smoothing: antialiased;
26
+ #engine {
27
+ width: 100%;
28
+ height: 100%;
29
+ }
30
+ }
31
+
32
+ html {
33
+ min-width: 1024px;
34
+ }
35
+
36
+ .save-sample {
37
+ width: 80px;
38
+ height: 30px;
39
+ background-color: #5584ff;
40
+ border: none;
41
+ outline: none;
42
+ border-radius: 4px;
43
+ color: white;
44
+ cursor: pointer;
45
+ }
46
+
47
+ .load-assets {
48
+ width: 100px;
49
+ height: 30px;
50
+ background-color: #5584ff;
51
+ border: none;
52
+ outline: none;
53
+ border-radius: 4px;
54
+ color: white;
55
+ cursor: pointer;
56
+ }
@@ -8,9 +8,9 @@ exports.getResourceName = exports.getResourceListFromLocalStorage = void 0;
8
8
  exports.getValueFromQueryByName = getValueFromQueryByName;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- /**
12
- * 从缓存获取ResourceList
13
- * @param scenarioName
11
+ /**
12
+ * 从缓存获取ResourceList
13
+ * @param scenarioName
14
14
  */
15
15
  var getResourceListFromLocalStorage = exports.getResourceListFromLocalStorage = /*#__PURE__*/function () {
16
16
  var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(scenarioName) {
@@ -36,10 +36,10 @@ var getResourceListFromLocalStorage = exports.getResourceListFromLocalStorage =
36
36
  };
37
37
  }();
38
38
 
39
- /**
40
- * 根据ResourceList获取所有schema
41
- * @param scenarioName
42
- * @param ResourceList
39
+ /**
40
+ * 根据ResourceList获取所有schema
41
+ * @param scenarioName
42
+ * @param ResourceList
43
43
  */
44
44
  var getAllSchemaByResourceList = exports.getAllSchemaByResourceList = /*#__PURE__*/function () {
45
45
  var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(scenarioName, ResourceList) {
@@ -54,10 +54,7 @@ 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
- console.log('ResourceList.map', item);
58
- console.log('getLSName(scenarioName, item.id)', getLSName(scenarioName, item.id));
59
57
  var localSchema = window.localStorage.getItem(getLSName(scenarioName, item.id)) || '{}';
60
- console.log('localSchema', localSchema);
61
58
  return JSON.parse(localSchema);
62
59
  }));
63
60
  case 4:
@@ -77,18 +74,18 @@ var getResourceName = exports.getResourceName = function getResourceName(scenari
77
74
  return scenarioName + ":" + ns;
78
75
  };
79
76
 
80
- /**
81
- * 获取项目id
77
+ /**
78
+ * 获取项目id
82
79
  */
83
80
  function getProjectId() {
84
81
  return getValueFromQueryByName('projectId', 'general');
85
82
  }
86
83
 
87
- /**
88
- * 获取地址栏参数值
89
- * @param queryName
90
- * @param defaultValue
91
- * @returns {string}
84
+ /**
85
+ * 获取地址栏参数值
86
+ * @param queryName
87
+ * @param defaultValue
88
+ * @returns {string}
92
89
  */
93
90
  function getValueFromQueryByName(queryName, defaultValue) {
94
91
  if (defaultValue === void 0) {