@dckj-npm/lowcode-plugin-code-generator 1.0.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.
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/es/components/CodeGenActionBtn/CodeGenActionBtn.d.ts +8 -0
- package/es/components/CodeGenActionBtn/CodeGenActionBtn.js +196 -0
- package/es/components/CodeGenActionBtn/CodeGenActionBtn.scss +13 -0
- package/es/components/CodeGenActionBtn/index.d.ts +1 -0
- package/es/components/CodeGenActionBtn/index.js +1 -0
- package/es/components/CodeGenPreview/CodeGenPreview.d.ts +8 -0
- package/es/components/CodeGenPreview/CodeGenPreview.js +40 -0
- package/es/components/CodeGenPreview/CodeGenPreview.scss +16 -0
- package/es/components/CodeGenPreview/fixPreviewCode.d.ts +2 -0
- package/es/components/CodeGenPreview/fixPreviewCode.js +101 -0
- package/es/components/CodeGenPreview/index.d.ts +1 -0
- package/es/components/CodeGenPreview/index.js +1 -0
- package/es/components/CodeGenPreview/useIsInIntranet.d.ts +4 -0
- package/es/components/CodeGenPreview/useIsInIntranet.js +66 -0
- package/es/components/CodeGenResult/CodeGenResult.d.ts +9 -0
- package/es/components/CodeGenResult/CodeGenResult.js +162 -0
- package/es/components/CodeGenResult/CodeGenResult.scss +7 -0
- package/es/components/CodeGenResult/index.d.ts +1 -0
- package/es/components/CodeGenResult/index.js +1 -0
- package/es/components/CodeSandboxPreview/CodeSandboxPreview.d.ts +4 -0
- package/es/components/CodeSandboxPreview/CodeSandboxPreview.js +186 -0
- package/es/components/CodeSandboxPreview/CodeSandboxPreview.scss +18 -0
- package/es/components/CodeSandboxPreview/index.d.ts +1 -0
- package/es/components/CodeSandboxPreview/index.js +1 -0
- package/es/components/FileTypeIcon/FileTypeIcon.d.ts +6 -0
- package/es/components/FileTypeIcon/FileTypeIcon.js +12 -0
- package/es/components/FileTypeIcon/FileTypeIcon.scss +36 -0
- package/es/components/FileTypeIcon/index.d.ts +1 -0
- package/es/components/FileTypeIcon/index.js +1 -0
- package/es/components/GravityCode/GravityCode.d.ts +9 -0
- package/es/components/GravityCode/GravityCode.js +1 -0
- package/es/components/GravityCode/index.d.ts +1 -0
- package/es/components/GravityCode/index.js +1 -0
- package/es/components/GravityPreview/ForceUpdate.d.ts +6 -0
- package/es/components/GravityPreview/ForceUpdate.js +12 -0
- package/es/components/GravityPreview/GravityPreview.d.ts +7 -0
- package/es/components/GravityPreview/GravityPreview.js +37 -0
- package/es/components/GravityPreview/GravitySdk.d.ts +10 -0
- package/es/components/GravityPreview/GravitySdk.js +183 -0
- package/es/components/GravityPreview/index.d.ts +1 -0
- package/es/components/GravityPreview/index.js +1 -0
- package/es/components/SourcesView/SourcesView.d.ts +9 -0
- package/es/components/SourcesView/SourcesView.js +197 -0
- package/es/components/SourcesView/SourcesView.scss +24 -0
- package/es/components/SourcesView/index.d.ts +1 -0
- package/es/components/SourcesView/index.js +1 -0
- package/es/demo/index.d.ts +1 -0
- package/es/demo/index.js +223 -0
- package/es/demo/index.scss +56 -0
- package/es/index.d.ts +30 -0
- package/es/index.js +67 -0
- package/es/style.js +2 -0
- package/es/types/SyncCodeGenResult.d.ts +7 -0
- package/es/types/SyncCodeGenResult.js +1 -0
- package/es/types/index.d.ts +1 -0
- package/es/types/index.js +1 -0
- package/es/typings.d.js +0 -0
- package/lib/components/CodeGenActionBtn/CodeGenActionBtn.d.ts +8 -0
- package/lib/components/CodeGenActionBtn/CodeGenActionBtn.js +204 -0
- package/lib/components/CodeGenActionBtn/CodeGenActionBtn.scss +13 -0
- package/lib/components/CodeGenActionBtn/index.d.ts +1 -0
- package/lib/components/CodeGenActionBtn/index.js +9 -0
- package/lib/components/CodeGenPreview/CodeGenPreview.d.ts +8 -0
- package/lib/components/CodeGenPreview/CodeGenPreview.js +45 -0
- package/lib/components/CodeGenPreview/CodeGenPreview.scss +16 -0
- package/lib/components/CodeGenPreview/fixPreviewCode.d.ts +2 -0
- package/lib/components/CodeGenPreview/fixPreviewCode.js +106 -0
- package/lib/components/CodeGenPreview/index.d.ts +1 -0
- package/lib/components/CodeGenPreview/index.js +9 -0
- package/lib/components/CodeGenPreview/useIsInIntranet.d.ts +4 -0
- package/lib/components/CodeGenPreview/useIsInIntranet.js +72 -0
- package/lib/components/CodeGenResult/CodeGenResult.d.ts +9 -0
- package/lib/components/CodeGenResult/CodeGenResult.js +169 -0
- package/lib/components/CodeGenResult/CodeGenResult.scss +7 -0
- package/lib/components/CodeGenResult/index.d.ts +1 -0
- package/lib/components/CodeGenResult/index.js +9 -0
- package/lib/components/CodeSandboxPreview/CodeSandboxPreview.d.ts +4 -0
- package/lib/components/CodeSandboxPreview/CodeSandboxPreview.js +193 -0
- package/lib/components/CodeSandboxPreview/CodeSandboxPreview.scss +18 -0
- package/lib/components/CodeSandboxPreview/index.d.ts +1 -0
- package/lib/components/CodeSandboxPreview/index.js +9 -0
- package/lib/components/FileTypeIcon/FileTypeIcon.d.ts +6 -0
- package/lib/components/FileTypeIcon/FileTypeIcon.js +17 -0
- package/lib/components/FileTypeIcon/FileTypeIcon.scss +36 -0
- package/lib/components/FileTypeIcon/index.d.ts +1 -0
- package/lib/components/FileTypeIcon/index.js +9 -0
- package/lib/components/GravityCode/GravityCode.d.ts +9 -0
- package/lib/components/GravityCode/GravityCode.js +3 -0
- package/lib/components/GravityCode/index.d.ts +1 -0
- package/lib/components/GravityCode/index.js +9 -0
- package/lib/components/GravityPreview/ForceUpdate.d.ts +6 -0
- package/lib/components/GravityPreview/ForceUpdate.js +17 -0
- package/lib/components/GravityPreview/GravityPreview.d.ts +7 -0
- package/lib/components/GravityPreview/GravityPreview.js +44 -0
- package/lib/components/GravityPreview/GravitySdk.d.ts +10 -0
- package/lib/components/GravityPreview/GravitySdk.js +196 -0
- package/lib/components/GravityPreview/index.d.ts +1 -0
- package/lib/components/GravityPreview/index.js +9 -0
- package/lib/components/SourcesView/SourcesView.d.ts +9 -0
- package/lib/components/SourcesView/SourcesView.js +204 -0
- package/lib/components/SourcesView/SourcesView.scss +24 -0
- package/lib/components/SourcesView/index.d.ts +1 -0
- package/lib/components/SourcesView/index.js +9 -0
- package/lib/demo/index.d.ts +1 -0
- package/lib/demo/index.js +228 -0
- package/lib/demo/index.scss +56 -0
- package/lib/index.d.ts +30 -0
- package/lib/index.js +74 -0
- package/lib/style.js +2 -0
- package/lib/types/SyncCodeGenResult.d.ts +7 -0
- package/lib/types/SyncCodeGenResult.js +3 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +9 -0
- package/lib/typings.d.js +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
require("./index.scss");
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _lowcodeEngine = require("@alilc/lowcode-engine");
|
|
9
|
+
var _lowcodePluginComponentsPane = _interopRequireDefault(require("@alilc/lowcode-plugin-components-pane"));
|
|
10
|
+
var _lowcodePluginInject = _interopRequireWildcard(require("@alilc/lowcode-plugin-inject"));
|
|
11
|
+
var _ = _interopRequireDefault(require("../"));
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
var preference = new Map();
|
|
15
|
+
preference.set('DataSourcePane', {
|
|
16
|
+
importPlugins: [],
|
|
17
|
+
dataSourceTypes: [{
|
|
18
|
+
type: 'fetch'
|
|
19
|
+
}, {
|
|
20
|
+
type: 'jsonp'
|
|
21
|
+
}]
|
|
22
|
+
});
|
|
23
|
+
(function () {
|
|
24
|
+
var _main = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
25
|
+
var setterRegistry;
|
|
26
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
27
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
28
|
+
case 0:
|
|
29
|
+
_context4.next = 2;
|
|
30
|
+
return _lowcodeEngine.plugins.register(_lowcodePluginInject["default"]);
|
|
31
|
+
case 2:
|
|
32
|
+
_context4.next = 4;
|
|
33
|
+
return _lowcodeEngine.plugins.register(Object.assign(function (ctx) {
|
|
34
|
+
return {
|
|
35
|
+
name: 'editor-init',
|
|
36
|
+
init: function init() {
|
|
37
|
+
return (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
38
|
+
var assets, schema;
|
|
39
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
40
|
+
while (1) switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
_context.next = 2;
|
|
43
|
+
return fetchJSON('/assets.json');
|
|
44
|
+
case 2:
|
|
45
|
+
assets = _context.sent;
|
|
46
|
+
_context.t0 = ctx.material;
|
|
47
|
+
_context.next = 6;
|
|
48
|
+
return (0, _lowcodePluginInject.injectAssets)(assets);
|
|
49
|
+
case 6:
|
|
50
|
+
_context.t1 = _context.sent;
|
|
51
|
+
_context.t0.setAssets.call(_context.t0, _context.t1);
|
|
52
|
+
_context.next = 10;
|
|
53
|
+
return fetchJSON('/schema.json');
|
|
54
|
+
case 10:
|
|
55
|
+
schema = _context.sent;
|
|
56
|
+
// 加载 schema
|
|
57
|
+
ctx.project.openDocument(schema);
|
|
58
|
+
case 12:
|
|
59
|
+
case "end":
|
|
60
|
+
return _context.stop();
|
|
61
|
+
}
|
|
62
|
+
}, _callee);
|
|
63
|
+
}))();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}, {
|
|
67
|
+
pluginName: 'editorInit'
|
|
68
|
+
}));
|
|
69
|
+
case 4:
|
|
70
|
+
_context4.next = 6;
|
|
71
|
+
return _lowcodeEngine.plugins.register(Object.assign(function (ctx) {
|
|
72
|
+
return {
|
|
73
|
+
name: 'builtin-plugin-registry',
|
|
74
|
+
init: function init() {
|
|
75
|
+
return (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
76
|
+
var _componentsPane$disab;
|
|
77
|
+
var skeleton, project, componentsPane;
|
|
78
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
79
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
80
|
+
case 0:
|
|
81
|
+
skeleton = ctx.skeleton, project = ctx.project; // 注册组件面板
|
|
82
|
+
componentsPane = skeleton.add({
|
|
83
|
+
area: 'leftArea',
|
|
84
|
+
type: 'PanelDock',
|
|
85
|
+
name: 'componentsPane',
|
|
86
|
+
content: _lowcodePluginComponentsPane["default"],
|
|
87
|
+
contentProps: {},
|
|
88
|
+
props: {
|
|
89
|
+
align: 'top',
|
|
90
|
+
icon: 'zujianku',
|
|
91
|
+
description: '组件库'
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
componentsPane === null || componentsPane === void 0 ? void 0 : (_componentsPane$disab = componentsPane.disable) === null || _componentsPane$disab === void 0 ? void 0 : _componentsPane$disab.call(componentsPane);
|
|
95
|
+
project.onSimulatorRendererReady(function () {
|
|
96
|
+
var _componentsPane$enabl;
|
|
97
|
+
componentsPane === null || componentsPane === void 0 ? void 0 : (_componentsPane$enabl = componentsPane.enable) === null || _componentsPane$enabl === void 0 ? void 0 : _componentsPane$enabl.call(componentsPane);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// 注册 logo 面板
|
|
101
|
+
skeleton.add({
|
|
102
|
+
area: 'topArea',
|
|
103
|
+
type: 'Widget',
|
|
104
|
+
name: 'logo',
|
|
105
|
+
content: /*#__PURE__*/_react["default"].createElement("div", {
|
|
106
|
+
className: "editor-logo"
|
|
107
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
108
|
+
width: "137",
|
|
109
|
+
height: "26",
|
|
110
|
+
src: "https://img.alicdn.com/imgextra/i4/O1CN013w2bmQ25WAIha4Hx9_!!6000000007533-55-tps-137-26.svg"
|
|
111
|
+
}), /*#__PURE__*/_react["default"].createElement("strong", {
|
|
112
|
+
style: {
|
|
113
|
+
lineHeight: '26px',
|
|
114
|
+
fontSize: '20px',
|
|
115
|
+
verticalAlign: '6px',
|
|
116
|
+
marginLeft: '4px'
|
|
117
|
+
}
|
|
118
|
+
}, "\u51FA\u7801\u793A\u4F8B")),
|
|
119
|
+
props: {
|
|
120
|
+
align: 'left'
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
case 5:
|
|
124
|
+
case "end":
|
|
125
|
+
return _context2.stop();
|
|
126
|
+
}
|
|
127
|
+
}, _callee2);
|
|
128
|
+
}))();
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}, {
|
|
132
|
+
pluginName: 'builtinPluginRegistry'
|
|
133
|
+
}));
|
|
134
|
+
case 6:
|
|
135
|
+
_context4.next = 8;
|
|
136
|
+
return _lowcodeEngine.plugins.register(_["default"]);
|
|
137
|
+
case 8:
|
|
138
|
+
// 设置内置 setter 和事件绑定、插件绑定面板
|
|
139
|
+
setterRegistry = function setterRegistry(ctx) {
|
|
140
|
+
var _AliLowCodeEngineExt = window.AliLowCodeEngineExt,
|
|
141
|
+
setterMap = _AliLowCodeEngineExt.setterMap,
|
|
142
|
+
pluginMap = _AliLowCodeEngineExt.pluginMap;
|
|
143
|
+
return {
|
|
144
|
+
name: 'ext-setters-registry',
|
|
145
|
+
init: function init() {
|
|
146
|
+
return (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
147
|
+
var setters, skeleton;
|
|
148
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
149
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
setters = ctx.setters, skeleton = ctx.skeleton; // 注册setterMap
|
|
152
|
+
setters.registerSetter(setterMap);
|
|
153
|
+
// 注册插件
|
|
154
|
+
// 注册事件绑定面板
|
|
155
|
+
skeleton.add({
|
|
156
|
+
area: 'centerArea',
|
|
157
|
+
type: 'Widget',
|
|
158
|
+
content: pluginMap.EventBindDialog,
|
|
159
|
+
name: 'eventBindDialog',
|
|
160
|
+
props: {}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// 注册变量绑定面板
|
|
164
|
+
skeleton.add({
|
|
165
|
+
area: 'centerArea',
|
|
166
|
+
type: 'Widget',
|
|
167
|
+
content: pluginMap.VariableBindDialog,
|
|
168
|
+
name: 'variableBindDialog',
|
|
169
|
+
props: {}
|
|
170
|
+
});
|
|
171
|
+
case 4:
|
|
172
|
+
case "end":
|
|
173
|
+
return _context3.stop();
|
|
174
|
+
}
|
|
175
|
+
}, _callee3);
|
|
176
|
+
}))();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
setterRegistry.pluginName = 'setterRegistry';
|
|
181
|
+
_context4.next = 12;
|
|
182
|
+
return _lowcodeEngine.plugins.register(setterRegistry);
|
|
183
|
+
case 12:
|
|
184
|
+
// 初始化设计器
|
|
185
|
+
(0, _lowcodeEngine.init)(document.getElementById('lce-container'), {
|
|
186
|
+
// designMode: 'live',
|
|
187
|
+
// locale: 'zh-CN',
|
|
188
|
+
enableCondition: true,
|
|
189
|
+
enableCanvasLock: true,
|
|
190
|
+
// 默认绑定变量
|
|
191
|
+
supportVariableGlobally: true,
|
|
192
|
+
// simulatorUrl 在当 engine-core.js 同一个路径下时是不需要配置的!!!
|
|
193
|
+
// 这里因为用的是 unpkg,在不同 npm 包,engine-core.js 和 react-simulator-renderer.js 是不同路径
|
|
194
|
+
simulatorUrl: ['https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@beta/dist/css/react-simulator-renderer.css', 'https://alifd.alicdn.com/npm/@alilc/lowcode-react-simulator-renderer@beta/dist/js/react-simulator-renderer.js']
|
|
195
|
+
}, preference);
|
|
196
|
+
case 13:
|
|
197
|
+
case "end":
|
|
198
|
+
return _context4.stop();
|
|
199
|
+
}
|
|
200
|
+
}, _callee4);
|
|
201
|
+
}));
|
|
202
|
+
function main() {
|
|
203
|
+
return _main.apply(this, arguments);
|
|
204
|
+
}
|
|
205
|
+
return main;
|
|
206
|
+
})()();
|
|
207
|
+
function fetchJSON(_x) {
|
|
208
|
+
return _fetchJSON.apply(this, arguments);
|
|
209
|
+
}
|
|
210
|
+
function _fetchJSON() {
|
|
211
|
+
_fetchJSON = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee5(url) {
|
|
212
|
+
var res;
|
|
213
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
214
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
215
|
+
case 0:
|
|
216
|
+
_context5.next = 2;
|
|
217
|
+
return fetch(url);
|
|
218
|
+
case 2:
|
|
219
|
+
res = _context5.sent;
|
|
220
|
+
return _context5.abrupt("return", res.json());
|
|
221
|
+
case 4:
|
|
222
|
+
case "end":
|
|
223
|
+
return _context5.stop();
|
|
224
|
+
}
|
|
225
|
+
}, _callee5);
|
|
226
|
+
}));
|
|
227
|
+
return _fetchJSON.apply(this, arguments);
|
|
228
|
+
}
|
|
@@ -0,0 +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
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as CodeGenerator from '@dckj-npm/lowcode-code-generator/standalone-loader';
|
|
2
|
+
export interface ICodeGenPlugin {
|
|
3
|
+
generateCode: typeof CodeGenerator.generateCode;
|
|
4
|
+
}
|
|
5
|
+
export declare type CodeGenPluginOptions = {
|
|
6
|
+
/** 是否要禁用出码的动作按钮(默认: 否) */
|
|
7
|
+
disableCodeGenActionBtn?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const codeGeneratorPlugin: {
|
|
10
|
+
(ctx: any, options?: CodeGenPluginOptions): {
|
|
11
|
+
exports(): {
|
|
12
|
+
generateCode: typeof CodeGenerator.generateCode;
|
|
13
|
+
};
|
|
14
|
+
init(): Promise<void>;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
};
|
|
17
|
+
pluginName: string;
|
|
18
|
+
meta: {
|
|
19
|
+
dependencies: any[];
|
|
20
|
+
preferenceDeclaration: {
|
|
21
|
+
title: string;
|
|
22
|
+
properties: {
|
|
23
|
+
key: string;
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export default codeGeneratorPlugin;
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports["default"] = void 0;
|
|
6
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
+
var CodeGenerator = _interopRequireWildcard(require("@dckj-npm/lowcode-code-generator/standalone-loader"));
|
|
9
|
+
var _CodeGenActionBtn = require("./components/CodeGenActionBtn");
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
var codeGeneratorPlugin = function codeGeneratorPlugin(ctx, options) {
|
|
13
|
+
return {
|
|
14
|
+
// 插件对外暴露的数据和方法
|
|
15
|
+
exports: function exports() {
|
|
16
|
+
return {
|
|
17
|
+
generateCode: CodeGenerator.generateCode
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
// 插件的初始化函数,在引擎初始化之后会立刻调用
|
|
21
|
+
init: function init() {
|
|
22
|
+
return (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
23
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
24
|
+
while (1) switch (_context.prev = _context.next) {
|
|
25
|
+
case 0:
|
|
26
|
+
_context.prev = 0;
|
|
27
|
+
if (!(options !== null && options !== void 0 && options.disableCodeGenActionBtn)) {
|
|
28
|
+
ctx.skeleton.add({
|
|
29
|
+
type: 'Custom',
|
|
30
|
+
name: 'code-generator',
|
|
31
|
+
area: 'topArea',
|
|
32
|
+
props: {
|
|
33
|
+
align: 'right',
|
|
34
|
+
width: 100
|
|
35
|
+
},
|
|
36
|
+
content: _CodeGenActionBtn.CodeGenActionBtn,
|
|
37
|
+
contentProps: {
|
|
38
|
+
ctx: ctx
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 提前初始化下,这样后面用的时候更快
|
|
44
|
+
CodeGenerator.init();
|
|
45
|
+
_context.next = 9;
|
|
46
|
+
break;
|
|
47
|
+
case 5:
|
|
48
|
+
_context.prev = 5;
|
|
49
|
+
_context.t0 = _context["catch"](0);
|
|
50
|
+
console.error('[plugin-code-geneator] failed to init: ', _context.t0);
|
|
51
|
+
throw _context.t0;
|
|
52
|
+
case 9:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
55
|
+
}
|
|
56
|
+
}, _callee, null, [[0, 5]]);
|
|
57
|
+
}))();
|
|
58
|
+
},
|
|
59
|
+
destroy: function destroy() {}
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
codeGeneratorPlugin.pluginName = 'codeGenerator';
|
|
63
|
+
codeGeneratorPlugin.meta = {
|
|
64
|
+
dependencies: [],
|
|
65
|
+
preferenceDeclaration: {
|
|
66
|
+
title: 'codeGenerator 的参数定义',
|
|
67
|
+
properties: [{
|
|
68
|
+
key: 'disableCodeGenActionBtn',
|
|
69
|
+
type: 'boolean',
|
|
70
|
+
description: '是否要禁用出码的动作按钮'
|
|
71
|
+
}]
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var _default = exports["default"] = codeGeneratorPlugin;
|
package/lib/style.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SyncCodeGenResult';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
var _SyncCodeGenResult = require("./SyncCodeGenResult");
|
|
5
|
+
Object.keys(_SyncCodeGenResult).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _SyncCodeGenResult[key]) return;
|
|
8
|
+
exports[key] = _SyncCodeGenResult[key];
|
|
9
|
+
});
|
package/lib/typings.d.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dckj-npm/lowcode-plugin-code-generator",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "集团低代码引擎 - 浏览器出码插件",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"module": "es/index.js",
|
|
7
|
+
"types": "es/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"lib",
|
|
10
|
+
"es",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "npm run dev",
|
|
15
|
+
"dev": "cross-env NODE_ENV=development build-scripts start --config build.dev.json --host localhost",
|
|
16
|
+
"build": "build-scripts build --skip-demo",
|
|
17
|
+
"clean": "rimraf es lib dist",
|
|
18
|
+
"prettier": "prettier --write 'src/**/*.{js,jsx,tsx,ts,less,md,json}'",
|
|
19
|
+
"prepablishOnly": "npm run clean && npm run build"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git@gitlab.alibaba-inc.com:ali-lowcode/code-generator-demo.git"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"出码"
|
|
27
|
+
],
|
|
28
|
+
"authors": [
|
|
29
|
+
{
|
|
30
|
+
"name": "zgm"
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@alilc/lowcode-code-generator": "^1.0.4",
|
|
36
|
+
"@alilc/lowcode-plugin-base-monaco-editor": "^1.0.0",
|
|
37
|
+
"@alilc/lowcode-types": "^1.0.0",
|
|
38
|
+
"@dckj-npm/lowcode-code-generator": "^1.0.3",
|
|
39
|
+
"@types/file-saver": "^2.0.4",
|
|
40
|
+
"@types/js-base64": "^3.3.1",
|
|
41
|
+
"@types/string-natural-compare": "^3.0.2",
|
|
42
|
+
"codesandbox": "^2.2.3",
|
|
43
|
+
"file-saver": "^2.0.5",
|
|
44
|
+
"js-base64": "^3.6.1",
|
|
45
|
+
"jszip": "^3.7.1",
|
|
46
|
+
"semver": "^7.3.5",
|
|
47
|
+
"string-natural-compare": "^3.0.1",
|
|
48
|
+
"tslib": "^2.3.1"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@alilc/lowcode-engine": "^1.0.0",
|
|
52
|
+
"react": "16.x || 17.x"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@alib/build-scripts": "^0.1.18",
|
|
56
|
+
"@alifd/theme-lowcode-light": "^0.2.1",
|
|
57
|
+
"@alilc/lowcode-engine": "^1.0.0",
|
|
58
|
+
"@alilc/lowcode-engine-ext": "^1.0.0",
|
|
59
|
+
"@alilc/lowcode-plugin-code-editor": "^1.0.1",
|
|
60
|
+
"@alilc/lowcode-plugin-components-pane": "^1.0.2",
|
|
61
|
+
"@alilc/lowcode-plugin-datasource-pane": "^1.0.3",
|
|
62
|
+
"@alilc/lowcode-plugin-inject": "^1.0.0",
|
|
63
|
+
"@alilc/lowcode-plugin-manual": "^1.0.3",
|
|
64
|
+
"@alilc/lowcode-plugin-schema": "^1.0.0",
|
|
65
|
+
"@alilc/lowcode-plugin-simulator-select": "^1.0.0",
|
|
66
|
+
"@alilc/lowcode-plugin-undo-redo": "^1.0.0",
|
|
67
|
+
"@alilc/lowcode-plugin-zh-en": "^1.0.0",
|
|
68
|
+
"@alilc/lowcode-react-renderer": "^1.0.0",
|
|
69
|
+
"@alilc/lowcode-setter-behavior": "^1.0.0",
|
|
70
|
+
"@alilc/lowcode-setter-title": "^1.0.2",
|
|
71
|
+
"@alilc/lowcode-types": "^1.0.0",
|
|
72
|
+
"@types/classnames": "^2.2.7",
|
|
73
|
+
"@types/events": "^3.0.0",
|
|
74
|
+
"@types/node": "^13.7.1",
|
|
75
|
+
"@types/react": "^16.8.3",
|
|
76
|
+
"@types/react-dom": "^16.8.2",
|
|
77
|
+
"@types/streamsaver": "^2.0.0",
|
|
78
|
+
"build-plugin-component": "^0.2.10",
|
|
79
|
+
"build-plugin-fusion": "^0.1.0",
|
|
80
|
+
"build-plugin-moment-locales": "^0.1.0",
|
|
81
|
+
"build-plugin-react-app": "^1.1.2",
|
|
82
|
+
"cross-env": "^7.0.3",
|
|
83
|
+
"prettier": "^2.5.1",
|
|
84
|
+
"react": "^16.8.3",
|
|
85
|
+
"react-dom": "^16.8.3",
|
|
86
|
+
"rimraf": "^3.0.2",
|
|
87
|
+
"tsconfig-paths-webpack-plugin": "^3.2.0",
|
|
88
|
+
"typescript": "^4.5.4"
|
|
89
|
+
},
|
|
90
|
+
"publishConfig": {
|
|
91
|
+
"access": "public",
|
|
92
|
+
"registry": "https://registry.npmjs.org/"
|
|
93
|
+
}
|
|
94
|
+
}
|