@gant-lowcode/plugin-code-generator 1.0.5 → 1.0.7

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,10 +4,12 @@ import * as __WEBPACK_EXTERNAL_MODULE__gant_lowcode_code_generator_standalone_lo
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__gant_lowcode_lowcode_types__ from "@gant-lowcode/lowcode-types";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE_semver_functions_coerce_js__ from "semver/functions/coerce.js";
7
+ import * as __WEBPACK_EXTERNAL_MODULE_semver_functions_compare_js__ from "semver/functions/compare.js";
7
8
  import * as __WEBPACK_EXTERNAL_MODULE__code_gen_result_index_js__ from "../code-gen-result/index.js";
8
9
  import "./index.css";
9
10
  import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
10
11
  import * as __WEBPACK_EXTERNAL_MODULE_file_saver__ from "file-saver";
12
+ import * as __WEBPACK_EXTERNAL_MODULE_ahooks__ from "ahooks";
11
13
  function CodeGenActionBtn({ ctx }) {
12
14
  const [state, setState] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({
13
15
  open: false,
@@ -70,10 +72,8 @@ function CodeGenActionBtn({ ctx }) {
70
72
  }));
71
73
  }
72
74
  };
73
- const handleDownload = async (e)=>{
75
+ const { run, loading: downloading } = (0, __WEBPACK_EXTERNAL_MODULE_ahooks__.useRequest)(async ()=>{
74
76
  try {
75
- e.preventDefault();
76
- e.stopPropagation();
77
77
  const codeGen = codeGenResultRef.current;
78
78
  if (!codeGen) return;
79
79
  const content = await codeGen.codeZip();
@@ -82,8 +82,15 @@ function CodeGenActionBtn({ ctx }) {
82
82
  console.log("failed to download sources: ", e);
83
83
  __WEBPACK_EXTERNAL_MODULE_antd__.message.error("下载失败!");
84
84
  }
85
+ }, {
86
+ manual: true
87
+ });
88
+ const handleDownload = async (e)=>{
89
+ e.preventDefault();
90
+ e.stopPropagation();
91
+ run();
85
92
  };
86
- const handleUpload = async (e)=>{
93
+ const { run: handleUpload, loading: uploading } = (0, __WEBPACK_EXTERNAL_MODULE_ahooks__.useRequest)(async ()=>{
87
94
  const codeGen = codeGenResultRef.current;
88
95
  if (!codeGen) return;
89
96
  try {
@@ -93,10 +100,12 @@ function CodeGenActionBtn({ ctx }) {
93
100
  zipFile: blob
94
101
  });
95
102
  } catch (error) {
96
- console.log("failed to git push: ", e);
97
- __WEBPACK_EXTERNAL_MODULE_antd__.message.error("下载失败!");
103
+ console.log("failed to git push: ", error);
104
+ __WEBPACK_EXTERNAL_MODULE_antd__.message.error("上传失败!");
98
105
  }
99
- };
106
+ }, {
107
+ manual: true
108
+ });
100
109
  let drawerChildren = null;
101
110
  if (state.hasError) drawerChildren = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Alert, {
102
111
  type: "error",
@@ -131,12 +140,14 @@ function CodeGenActionBtn({ ctx }) {
131
140
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
132
141
  type: "link",
133
142
  onClick: handleUpload,
143
+ loading: uploading,
134
144
  children: "上传git"
135
145
  }),
136
146
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
137
147
  type: "link",
138
148
  onClick: handleDownload,
139
- children: "源代码导出/下载 zip 包"
149
+ loading: downloading,
150
+ children: "下载源代码"
140
151
  })
141
152
  ]
142
153
  }),
@@ -164,6 +175,11 @@ async function fixSchema(schema) {
164
175
  version: "latest"
165
176
  };
166
177
  }
178
+ // 修正 gantd-lowcode-materials 的版本,最小为1.0.6
179
+ if ('gantd-lowcode-materials' === c.package && (0, __WEBPACK_EXTERNAL_MODULE_semver_functions_compare_js__["default"])((0, __WEBPACK_EXTERNAL_MODULE_semver_functions_coerce_js__["default"])(c.version) || '', '1.0.6') <= 0) return {
180
+ ...c,
181
+ version: '1.0.6'
182
+ };
167
183
  return c;
168
184
  })
169
185
  });
@@ -75,7 +75,6 @@ const FileTree = (props)=>{
75
75
  const onSelect = (e, node)=>{
76
76
  //e.stopPropagation();
77
77
  if (node.folder) return;
78
- console.log("---node", e, node);
79
78
  props.onSelect?.(node.id);
80
79
  };
81
80
  const flattenedData = createFlattenTree(modules, openedNodeIds);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gant-lowcode/plugin-code-generator",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -14,9 +14,6 @@
14
14
  "dist"
15
15
  ],
16
16
  "devDependencies": {
17
- "@rsbuild/plugin-less": "^1.1.0",
18
- "@rsbuild/plugin-react": "^1.0.7",
19
- "@rslib/core": "^0.1.3",
20
17
  "@types/file-saver": "^2.0.7",
21
18
  "@types/react": "^18.3.12",
22
19
  "@types/react-window": "^1.8.8",
@@ -35,6 +32,7 @@
35
32
  "@gant-lowcode/lowcode-plugin-base-monaco-editor": "^2.1.3",
36
33
  "@gant-lowcode/lowcode-plugin-code-editor": "^2.1.3",
37
34
  "@gant-lowcode/lowcode-types": "^1.3.7",
35
+ "ahooks": "^3.8.4",
38
36
  "antd": "^5.22.4",
39
37
  "classnames": "^2.5.1",
40
38
  "file-saver": "^2.0.5",
@@ -44,7 +42,9 @@
44
42
  "react-window": "^1.8.10",
45
43
  "semver": "^7.6.3",
46
44
  "string-natural-compare": "^3.0.1",
47
- "@gant-lowcode/code-generator": "0.0.4"
45
+ "@gant-lowcode/eslint-config": "0.0.0",
46
+ "@gant-lowcode/typescript-config": "0.0.0",
47
+ "@gant-lowcode/code-generator": "0.0.5"
48
48
  },
49
49
  "publishConfig": {
50
50
  "registry": "https://registry.npmjs.org/",