@zhubangyun/lowcode-core 1.1.12 → 1.1.14
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/es/components/schema-render/components/schema-render-base.d.ts +2 -2
- package/es/components/schema-render/components/schema-render-base.js +17 -55
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/utils/common/LoadPlugins.js +22 -16
- package/es/utils/designer/assets/assets.typing.d.ts +42 -11
- package/es/utils/designer/engine/index.d.ts +2 -1
- package/es/utils/designer/engine/index.js +2 -0
- package/lib/components/schema-render/components/schema-render-base.d.ts +2 -2
- package/lib/components/schema-render/components/schema-render-base.js +17 -55
- package/lib/index.d.ts +1 -0
- package/lib/index.js +15 -0
- package/lib/utils/common/LoadPlugins.js +22 -16
- package/lib/utils/designer/assets/assets.typing.d.ts +42 -11
- package/lib/utils/designer/engine/index.d.ts +2 -1
- package/lib/utils/designer/engine/index.js +2 -0
- package/package.json +1 -1
|
@@ -23,7 +23,8 @@ export interface FormProps {
|
|
|
23
23
|
onInit?: (values: any, form: FormInstance) => Promise<void>;
|
|
24
24
|
}
|
|
25
25
|
export interface SchemaBaseRenderProps {
|
|
26
|
-
|
|
26
|
+
components: any;
|
|
27
|
+
loadSchema: (props: SchemaBaseRenderProps) => Promise<void>;
|
|
27
28
|
params?: FormProps;
|
|
28
29
|
}
|
|
29
30
|
export interface SchemaBaseRenderState {
|
|
@@ -36,7 +37,6 @@ export declare class SchemaRenderBase extends Component<SchemaBaseRenderProps, S
|
|
|
36
37
|
constructor(props: Readonly<SchemaBaseRenderProps> | SchemaBaseRenderProps);
|
|
37
38
|
componentDidMount(): Promise<void>;
|
|
38
39
|
page: any;
|
|
39
|
-
loadSchema: () => Promise<void>;
|
|
40
40
|
components: any;
|
|
41
41
|
loadComponent: () => Promise<void>;
|
|
42
42
|
render(): JSX.Element;
|
|
@@ -9,7 +9,6 @@ import ReactRenderer, { adapter } from "@zhubangyun/lowcode-renderer-core";
|
|
|
9
9
|
import { createFetchHandler } from "@alilc/lowcode-datasource-fetch-handler";
|
|
10
10
|
import utils from "../../../utils";
|
|
11
11
|
import assets from "./assets";
|
|
12
|
-
import demoSchema from "./demo-schema";
|
|
13
12
|
import zhCN from "antd/locale/zh_CN";
|
|
14
13
|
// @ts-ignore
|
|
15
14
|
adapter.setConfigProvider(((_window$antd = window.antd) === null || _window$antd === void 0 ? void 0 : _window$antd.ConfigProvider) || _ConfigProvider);
|
|
@@ -23,79 +22,42 @@ export var SchemaRenderBase = /*#__PURE__*/function (_Component) {
|
|
|
23
22
|
result: undefined
|
|
24
23
|
};
|
|
25
24
|
_this.page = void 0;
|
|
26
|
-
_this.
|
|
27
|
-
|
|
25
|
+
_this.components = void 0;
|
|
26
|
+
_this.loadComponent = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
27
|
+
var _yield$utils$designer, components;
|
|
28
28
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
29
29
|
while (1) switch (_context.prev = _context.next) {
|
|
30
30
|
case 0:
|
|
31
31
|
_context.next = 2;
|
|
32
|
-
return
|
|
33
|
-
case 2:
|
|
34
|
-
schemaId = _this.props.schemaId;
|
|
35
|
-
if (!(schemaId == "test")) {
|
|
36
|
-
_context.next = 6;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
_this.setState({
|
|
40
|
-
schema: demoSchema
|
|
41
|
-
});
|
|
42
|
-
return _context.abrupt("return");
|
|
43
|
-
case 6:
|
|
44
|
-
_context.next = 8;
|
|
45
|
-
return utils.schemaCache.get(schemaId);
|
|
46
|
-
case 8:
|
|
47
|
-
schema = _context.sent;
|
|
48
|
-
_this.setState({
|
|
49
|
-
schema: schema,
|
|
50
|
-
result: schema ? undefined : {
|
|
51
|
-
status: 404,
|
|
52
|
-
title: "404",
|
|
53
|
-
subTitle: "\u89C6\u56FE:" + schemaId + "\u4E0D\u5B58\u5728!"
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
case 10:
|
|
57
|
-
case "end":
|
|
58
|
-
return _context.stop();
|
|
59
|
-
}
|
|
60
|
-
}, _callee);
|
|
61
|
-
}));
|
|
62
|
-
_this.components = void 0;
|
|
63
|
-
_this.loadComponent = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
64
|
-
var _yield$utils$lowcode$, components;
|
|
65
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
66
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
67
|
-
case 0:
|
|
68
|
-
_context2.next = 2;
|
|
69
|
-
return utils.lowcode.parseAssets(assets);
|
|
32
|
+
return utils.designer.assetsParse(assets);
|
|
70
33
|
case 2:
|
|
71
|
-
_yield$utils$
|
|
72
|
-
components = _yield$utils$
|
|
34
|
+
_yield$utils$designer = _context.sent;
|
|
35
|
+
components = _yield$utils$designer.components;
|
|
73
36
|
_this.components = components;
|
|
74
37
|
case 5:
|
|
75
38
|
case "end":
|
|
76
|
-
return
|
|
39
|
+
return _context.stop();
|
|
77
40
|
}
|
|
78
|
-
},
|
|
41
|
+
}, _callee);
|
|
79
42
|
}));
|
|
80
43
|
_this.setState({
|
|
81
|
-
key: utils.uuid("key.")
|
|
44
|
+
key: utils.common.uuid("key.")
|
|
82
45
|
});
|
|
83
46
|
return _this;
|
|
84
47
|
}
|
|
85
48
|
_inheritsLoose(SchemaRenderBase, _Component);
|
|
86
49
|
var _proto = SchemaRenderBase.prototype;
|
|
87
50
|
_proto.componentDidMount = /*#__PURE__*/function () {
|
|
88
|
-
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
89
|
-
return _regeneratorRuntime.wrap(function
|
|
90
|
-
while (1) switch (
|
|
51
|
+
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
52
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
91
54
|
case 0:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
case 2:
|
|
55
|
+
this.components = this.props.components;
|
|
56
|
+
case 1:
|
|
95
57
|
case "end":
|
|
96
|
-
return
|
|
58
|
+
return _context2.stop();
|
|
97
59
|
}
|
|
98
|
-
},
|
|
60
|
+
}, _callee2, this);
|
|
99
61
|
}));
|
|
100
62
|
function componentDidMount() {
|
|
101
63
|
return _componentDidMount.apply(this, arguments);
|
|
@@ -104,7 +66,7 @@ export var SchemaRenderBase = /*#__PURE__*/function (_Component) {
|
|
|
104
66
|
}();
|
|
105
67
|
_proto.render = function render() {
|
|
106
68
|
var _this2 = this;
|
|
107
|
-
var components = this.components;
|
|
69
|
+
var components = this.props.components;
|
|
108
70
|
var _this$state = this.state,
|
|
109
71
|
key = _this$state.key,
|
|
110
72
|
result = _this$state.result,
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -23,7 +23,7 @@ function _loadPlugins() {
|
|
|
23
23
|
_context.next = 5;
|
|
24
24
|
return loadStyle(plugin);
|
|
25
25
|
case 5:
|
|
26
|
-
console.debug("loadStyle", plugin);
|
|
26
|
+
console.debug("loadStyle", plugin, Date.now().toString(36));
|
|
27
27
|
case 6:
|
|
28
28
|
_context.next = 1;
|
|
29
29
|
break;
|
|
@@ -38,7 +38,7 @@ function _loadPlugins() {
|
|
|
38
38
|
_context.next = 13;
|
|
39
39
|
return loadScript(_plugin);
|
|
40
40
|
case 13:
|
|
41
|
-
console.debug("loadScript", _plugin);
|
|
41
|
+
console.debug("loadScript", _plugin, Date.now().toString(36));
|
|
42
42
|
case 14:
|
|
43
43
|
_context.next = 9;
|
|
44
44
|
break;
|
|
@@ -66,10 +66,15 @@ function _loadStyle() {
|
|
|
66
66
|
case 2:
|
|
67
67
|
return _context3.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
68
68
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(resolve) {
|
|
69
|
-
var target;
|
|
69
|
+
var callback, target;
|
|
70
70
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
71
71
|
while (1) switch (_context2.prev = _context2.next) {
|
|
72
72
|
case 0:
|
|
73
|
+
callback = function _callback(status) {
|
|
74
|
+
setTimeout(function () {
|
|
75
|
+
resolve(status);
|
|
76
|
+
}, 10);
|
|
77
|
+
};
|
|
73
78
|
//加载式样
|
|
74
79
|
target = doc.querySelector("link[href='" + src + "']");
|
|
75
80
|
if (!target) {
|
|
@@ -77,18 +82,16 @@ function _loadStyle() {
|
|
|
77
82
|
target.href = src;
|
|
78
83
|
target.rel = "stylesheet";
|
|
79
84
|
target.onload = function () {
|
|
80
|
-
return
|
|
81
|
-
resolve(true);
|
|
82
|
-
}, 1);
|
|
85
|
+
return callback(true);
|
|
83
86
|
};
|
|
84
87
|
target.onerror = function () {
|
|
85
|
-
return
|
|
88
|
+
return callback(false);
|
|
86
89
|
};
|
|
87
90
|
doc.head.appendChild(target);
|
|
88
91
|
} else {
|
|
89
|
-
|
|
92
|
+
callback(true);
|
|
90
93
|
}
|
|
91
|
-
case
|
|
94
|
+
case 3:
|
|
92
95
|
case "end":
|
|
93
96
|
return _context2.stop();
|
|
94
97
|
}
|
|
@@ -122,10 +125,15 @@ function _loadScript() {
|
|
|
122
125
|
case 2:
|
|
123
126
|
return _context5.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
124
127
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(resolve, reject) {
|
|
125
|
-
var target;
|
|
128
|
+
var callback, target;
|
|
126
129
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
127
130
|
while (1) switch (_context4.prev = _context4.next) {
|
|
128
131
|
case 0:
|
|
132
|
+
callback = function _callback2(status) {
|
|
133
|
+
setTimeout(function () {
|
|
134
|
+
resolve(status);
|
|
135
|
+
}, 10);
|
|
136
|
+
};
|
|
129
137
|
//加载脚本
|
|
130
138
|
target = doc.querySelector("script[src='" + src + "']");
|
|
131
139
|
if (!target) {
|
|
@@ -135,18 +143,16 @@ function _loadScript() {
|
|
|
135
143
|
}
|
|
136
144
|
target.src = src;
|
|
137
145
|
target.onload = function () {
|
|
138
|
-
return
|
|
139
|
-
resolve(true);
|
|
140
|
-
}, 1);
|
|
146
|
+
return callback(true);
|
|
141
147
|
};
|
|
142
148
|
target.onerror = function () {
|
|
143
|
-
return
|
|
149
|
+
return callback(false);
|
|
144
150
|
};
|
|
145
151
|
doc.body.appendChild(target);
|
|
146
152
|
} else {
|
|
147
|
-
|
|
153
|
+
callback(true);
|
|
148
154
|
}
|
|
149
|
-
case
|
|
155
|
+
case 3:
|
|
150
156
|
case "end":
|
|
151
157
|
return _context4.stop();
|
|
152
158
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPublicTypeUtilsMap } from "@alilc/lowcode-types/lib/shell/type/project-schema";
|
|
2
2
|
import { IPublicTypeConfigure, IPublicTypeNpmInfo } from "@alilc/lowcode-types";
|
|
3
|
+
import { IPublicTypeI18nMap, IPublicTypeJSONObject, IPublicTypeNodeSchema, IPublicTypeRootSchema } from "@alilc/lowcode-types/lib/shell/type";
|
|
4
|
+
import { InterpretDataSource as DataSource } from "@alilc/lowcode-datasource-types/es/data-source-interpret";
|
|
3
5
|
/**
|
|
4
6
|
* 资产包协议
|
|
5
7
|
*/
|
|
@@ -57,6 +59,7 @@ export interface Package {
|
|
|
57
59
|
* 唯一标识
|
|
58
60
|
*/
|
|
59
61
|
id?: string;
|
|
62
|
+
componentId?: string;
|
|
60
63
|
/**
|
|
61
64
|
* 包名
|
|
62
65
|
*/
|
|
@@ -88,7 +91,7 @@ export interface Package {
|
|
|
88
91
|
/**
|
|
89
92
|
* 低代码组件的 schema 内容
|
|
90
93
|
*/
|
|
91
|
-
schema?:
|
|
94
|
+
schema?: IPublicTypePackageSchema;
|
|
92
95
|
/**
|
|
93
96
|
* 当前资源所依赖的其他资源包的 id 列表
|
|
94
97
|
*/
|
|
@@ -248,25 +251,26 @@ export interface Snippet {
|
|
|
248
251
|
* 组件低代码描述
|
|
249
252
|
*/
|
|
250
253
|
export interface ComponentDescription {
|
|
254
|
+
componentId?: string;
|
|
251
255
|
componentName: string;
|
|
252
256
|
title: string;
|
|
253
257
|
description?: string;
|
|
254
|
-
docUrl
|
|
255
|
-
screenshot
|
|
258
|
+
docUrl?: string;
|
|
259
|
+
screenshot?: string;
|
|
256
260
|
icon?: string;
|
|
257
261
|
tags?: string[];
|
|
258
262
|
keywords?: string[];
|
|
259
263
|
devMode?: 'proCode' | 'lowCode';
|
|
260
|
-
npm
|
|
261
|
-
configure
|
|
262
|
-
snippets
|
|
263
|
-
group
|
|
264
|
-
category
|
|
265
|
-
priority
|
|
264
|
+
npm?: IPublicTypeNpmInfo;
|
|
265
|
+
configure?: IPublicTypeConfigure;
|
|
266
|
+
snippets?: Snippet[];
|
|
267
|
+
group?: string;
|
|
268
|
+
category?: string;
|
|
269
|
+
priority?: number;
|
|
266
270
|
/**
|
|
267
271
|
* 组件引用的资源信息
|
|
268
272
|
*/
|
|
269
|
-
reference
|
|
273
|
+
reference?: Reference;
|
|
270
274
|
}
|
|
271
275
|
/**
|
|
272
276
|
* 远程物料描述
|
|
@@ -296,3 +300,30 @@ export interface MultiModeUrl {
|
|
|
296
300
|
default: string;
|
|
297
301
|
[index: string]: string;
|
|
298
302
|
}
|
|
303
|
+
interface IPublicTypePackageSchema<T = IPublicTypeRootSchema> extends IPublicTypeNodeSchema {
|
|
304
|
+
/**
|
|
305
|
+
* 当前应用协议版本号
|
|
306
|
+
*/
|
|
307
|
+
version: string;
|
|
308
|
+
/**
|
|
309
|
+
* 国际化语料
|
|
310
|
+
*/
|
|
311
|
+
i18n?: IPublicTypeI18nMap;
|
|
312
|
+
/**
|
|
313
|
+
* 应用范围内的全局自定义函数或第三方工具类扩展
|
|
314
|
+
*/
|
|
315
|
+
utils?: IPublicTypeUtilsMap;
|
|
316
|
+
/**
|
|
317
|
+
* 应用范围内的全局常量
|
|
318
|
+
*/
|
|
319
|
+
constants?: IPublicTypeJSONObject;
|
|
320
|
+
/**
|
|
321
|
+
* 应用范围内的全局样式
|
|
322
|
+
*/
|
|
323
|
+
css?: string;
|
|
324
|
+
/**
|
|
325
|
+
* 当前应用的公共数据源
|
|
326
|
+
*/
|
|
327
|
+
dataSource?: DataSource;
|
|
328
|
+
}
|
|
329
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Project, Material, Plugins } from "@alilc/lowcode-shell";
|
|
1
|
+
import { Project, Material, Plugins, Skeleton } from "@alilc/lowcode-shell";
|
|
2
2
|
import { DefaultAssertsType, DesignerAssets } from "../assets";
|
|
3
3
|
import { IPublicTypeAssetsJson } from "@alilc/lowcode-utils";
|
|
4
4
|
import { IPublicTypePlugin, IPublicTypePluginRegisterOptions } from "@alilc/lowcode-types";
|
|
@@ -7,6 +7,7 @@ export declare class Engine {
|
|
|
7
7
|
plugins: Plugins;
|
|
8
8
|
assets: DesignerAssets;
|
|
9
9
|
material: Material;
|
|
10
|
+
skeleton: Skeleton;
|
|
10
11
|
_engine: any;
|
|
11
12
|
constructor();
|
|
12
13
|
/**
|
|
@@ -9,6 +9,7 @@ export var Engine = function Engine() {
|
|
|
9
9
|
this.plugins = void 0;
|
|
10
10
|
this.assets = void 0;
|
|
11
11
|
this.material = void 0;
|
|
12
|
+
this.skeleton = void 0;
|
|
12
13
|
this._engine = void 0;
|
|
13
14
|
/**
|
|
14
15
|
* 注入资产
|
|
@@ -134,5 +135,6 @@ export var Engine = function Engine() {
|
|
|
134
135
|
this.project = this._engine.project;
|
|
135
136
|
this.material = this._engine.material;
|
|
136
137
|
this.plugins = this._engine.plugins;
|
|
138
|
+
this.skeleton = this._engine.skeleton;
|
|
137
139
|
this.assets = new DesignerAssets();
|
|
138
140
|
};
|
|
@@ -23,7 +23,8 @@ export interface FormProps {
|
|
|
23
23
|
onInit?: (values: any, form: FormInstance) => Promise<void>;
|
|
24
24
|
}
|
|
25
25
|
export interface SchemaBaseRenderProps {
|
|
26
|
-
|
|
26
|
+
components: any;
|
|
27
|
+
loadSchema: (props: SchemaBaseRenderProps) => Promise<void>;
|
|
27
28
|
params?: FormProps;
|
|
28
29
|
}
|
|
29
30
|
export interface SchemaBaseRenderState {
|
|
@@ -36,7 +37,6 @@ export declare class SchemaRenderBase extends Component<SchemaBaseRenderProps, S
|
|
|
36
37
|
constructor(props: Readonly<SchemaBaseRenderProps> | SchemaBaseRenderProps);
|
|
37
38
|
componentDidMount(): Promise<void>;
|
|
38
39
|
page: any;
|
|
39
|
-
loadSchema: () => Promise<void>;
|
|
40
40
|
components: any;
|
|
41
41
|
loadComponent: () => Promise<void>;
|
|
42
42
|
render(): JSX.Element;
|
|
@@ -13,7 +13,6 @@ var _lowcodeRendererCore = _interopRequireWildcard(require("@zhubangyun/lowcode-
|
|
|
13
13
|
var _lowcodeDatasourceFetchHandler = require("@alilc/lowcode-datasource-fetch-handler");
|
|
14
14
|
var _utils = _interopRequireDefault(require("../../../utils"));
|
|
15
15
|
var _assets = _interopRequireDefault(require("./assets"));
|
|
16
|
-
var _demoSchema = _interopRequireDefault(require("./demo-schema"));
|
|
17
16
|
var _zh_CN = _interopRequireDefault(require("antd/locale/zh_CN"));
|
|
18
17
|
var _window$antd, _window$antd2;
|
|
19
18
|
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); }
|
|
@@ -30,79 +29,42 @@ var SchemaRenderBase = exports.SchemaRenderBase = /*#__PURE__*/function (_Compon
|
|
|
30
29
|
result: undefined
|
|
31
30
|
};
|
|
32
31
|
_this.page = void 0;
|
|
33
|
-
_this.
|
|
34
|
-
|
|
32
|
+
_this.components = void 0;
|
|
33
|
+
_this.loadComponent = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
34
|
+
var _yield$utils$designer, components;
|
|
35
35
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
36
36
|
while (1) switch (_context.prev = _context.next) {
|
|
37
37
|
case 0:
|
|
38
38
|
_context.next = 2;
|
|
39
|
-
return
|
|
40
|
-
case 2:
|
|
41
|
-
schemaId = _this.props.schemaId;
|
|
42
|
-
if (!(schemaId == "test")) {
|
|
43
|
-
_context.next = 6;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
_this.setState({
|
|
47
|
-
schema: _demoSchema["default"]
|
|
48
|
-
});
|
|
49
|
-
return _context.abrupt("return");
|
|
50
|
-
case 6:
|
|
51
|
-
_context.next = 8;
|
|
52
|
-
return _utils["default"].schemaCache.get(schemaId);
|
|
53
|
-
case 8:
|
|
54
|
-
schema = _context.sent;
|
|
55
|
-
_this.setState({
|
|
56
|
-
schema: schema,
|
|
57
|
-
result: schema ? undefined : {
|
|
58
|
-
status: 404,
|
|
59
|
-
title: "404",
|
|
60
|
-
subTitle: "\u89C6\u56FE:" + schemaId + "\u4E0D\u5B58\u5728!"
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
case 10:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
66
|
-
}
|
|
67
|
-
}, _callee);
|
|
68
|
-
}));
|
|
69
|
-
_this.components = void 0;
|
|
70
|
-
_this.loadComponent = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
71
|
-
var _yield$utils$lowcode$, components;
|
|
72
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
73
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
74
|
-
case 0:
|
|
75
|
-
_context2.next = 2;
|
|
76
|
-
return _utils["default"].lowcode.parseAssets(_assets["default"]);
|
|
39
|
+
return _utils["default"].designer.assetsParse(_assets["default"]);
|
|
77
40
|
case 2:
|
|
78
|
-
_yield$utils$
|
|
79
|
-
components = _yield$utils$
|
|
41
|
+
_yield$utils$designer = _context.sent;
|
|
42
|
+
components = _yield$utils$designer.components;
|
|
80
43
|
_this.components = components;
|
|
81
44
|
case 5:
|
|
82
45
|
case "end":
|
|
83
|
-
return
|
|
46
|
+
return _context.stop();
|
|
84
47
|
}
|
|
85
|
-
},
|
|
48
|
+
}, _callee);
|
|
86
49
|
}));
|
|
87
50
|
_this.setState({
|
|
88
|
-
key: _utils["default"].uuid("key.")
|
|
51
|
+
key: _utils["default"].common.uuid("key.")
|
|
89
52
|
});
|
|
90
53
|
return _this;
|
|
91
54
|
}
|
|
92
55
|
(0, _inheritsLoose2["default"])(SchemaRenderBase, _Component);
|
|
93
56
|
var _proto = SchemaRenderBase.prototype;
|
|
94
57
|
_proto.componentDidMount = /*#__PURE__*/function () {
|
|
95
|
-
var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
96
|
-
return _regenerator["default"].wrap(function
|
|
97
|
-
while (1) switch (
|
|
58
|
+
var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
59
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
60
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
98
61
|
case 0:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
case 2:
|
|
62
|
+
this.components = this.props.components;
|
|
63
|
+
case 1:
|
|
102
64
|
case "end":
|
|
103
|
-
return
|
|
65
|
+
return _context2.stop();
|
|
104
66
|
}
|
|
105
|
-
},
|
|
67
|
+
}, _callee2, this);
|
|
106
68
|
}));
|
|
107
69
|
function componentDidMount() {
|
|
108
70
|
return _componentDidMount.apply(this, arguments);
|
|
@@ -111,7 +73,7 @@ var SchemaRenderBase = exports.SchemaRenderBase = /*#__PURE__*/function (_Compon
|
|
|
111
73
|
}();
|
|
112
74
|
_proto.render = function render() {
|
|
113
75
|
var _this2 = this;
|
|
114
|
-
var components = this.components;
|
|
76
|
+
var components = this.props.components;
|
|
115
77
|
var _this$state = this.state,
|
|
116
78
|
key = _this$state.key,
|
|
117
79
|
result = _this$state.result,
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,9 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
+
var _exportNames = {
|
|
6
|
+
RestApi: true,
|
|
7
|
+
RestFormApi: true,
|
|
8
|
+
ClientCache: true,
|
|
9
|
+
Layout: true,
|
|
10
|
+
SchemaRender: true,
|
|
11
|
+
utils: true
|
|
12
|
+
};
|
|
5
13
|
exports.SchemaRender = exports.RestFormApi = exports.RestApi = exports.Layout = exports.ClientCache = void 0;
|
|
6
14
|
var _utils = _interopRequireDefault(require("./utils"));
|
|
7
15
|
exports.utils = _utils["default"];
|
|
16
|
+
var _lowcodeRendererCore = require("@zhubangyun/lowcode-renderer-core");
|
|
17
|
+
Object.keys(_lowcodeRendererCore).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
20
|
+
if (key in exports && exports[key] === _lowcodeRendererCore[key]) return;
|
|
21
|
+
exports[key] = _lowcodeRendererCore[key];
|
|
22
|
+
});
|
|
8
23
|
var _RestApi = require("./utils/common/RestApi");
|
|
9
24
|
exports.RestApi = _RestApi.RestApi;
|
|
10
25
|
var _RestFormApi = require("./utils/common/RestFormApi");
|
|
@@ -28,7 +28,7 @@ function _loadPlugins() {
|
|
|
28
28
|
_context.next = 5;
|
|
29
29
|
return loadStyle(plugin);
|
|
30
30
|
case 5:
|
|
31
|
-
console.debug("loadStyle", plugin);
|
|
31
|
+
console.debug("loadStyle", plugin, Date.now().toString(36));
|
|
32
32
|
case 6:
|
|
33
33
|
_context.next = 1;
|
|
34
34
|
break;
|
|
@@ -43,7 +43,7 @@ function _loadPlugins() {
|
|
|
43
43
|
_context.next = 13;
|
|
44
44
|
return loadScript(_plugin);
|
|
45
45
|
case 13:
|
|
46
|
-
console.debug("loadScript", _plugin);
|
|
46
|
+
console.debug("loadScript", _plugin, Date.now().toString(36));
|
|
47
47
|
case 14:
|
|
48
48
|
_context.next = 9;
|
|
49
49
|
break;
|
|
@@ -71,10 +71,15 @@ function _loadStyle() {
|
|
|
71
71
|
case 2:
|
|
72
72
|
return _context3.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
73
73
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(resolve) {
|
|
74
|
-
var target;
|
|
74
|
+
var callback, target;
|
|
75
75
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
76
76
|
while (1) switch (_context2.prev = _context2.next) {
|
|
77
77
|
case 0:
|
|
78
|
+
callback = function _callback(status) {
|
|
79
|
+
setTimeout(function () {
|
|
80
|
+
resolve(status);
|
|
81
|
+
}, 10);
|
|
82
|
+
};
|
|
78
83
|
//加载式样
|
|
79
84
|
target = doc.querySelector("link[href='" + src + "']");
|
|
80
85
|
if (!target) {
|
|
@@ -82,18 +87,16 @@ function _loadStyle() {
|
|
|
82
87
|
target.href = src;
|
|
83
88
|
target.rel = "stylesheet";
|
|
84
89
|
target.onload = function () {
|
|
85
|
-
return
|
|
86
|
-
resolve(true);
|
|
87
|
-
}, 1);
|
|
90
|
+
return callback(true);
|
|
88
91
|
};
|
|
89
92
|
target.onerror = function () {
|
|
90
|
-
return
|
|
93
|
+
return callback(false);
|
|
91
94
|
};
|
|
92
95
|
doc.head.appendChild(target);
|
|
93
96
|
} else {
|
|
94
|
-
|
|
97
|
+
callback(true);
|
|
95
98
|
}
|
|
96
|
-
case
|
|
99
|
+
case 3:
|
|
97
100
|
case "end":
|
|
98
101
|
return _context2.stop();
|
|
99
102
|
}
|
|
@@ -127,10 +130,15 @@ function _loadScript() {
|
|
|
127
130
|
case 2:
|
|
128
131
|
return _context5.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
129
132
|
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(resolve, reject) {
|
|
130
|
-
var target;
|
|
133
|
+
var callback, target;
|
|
131
134
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
132
135
|
while (1) switch (_context4.prev = _context4.next) {
|
|
133
136
|
case 0:
|
|
137
|
+
callback = function _callback2(status) {
|
|
138
|
+
setTimeout(function () {
|
|
139
|
+
resolve(status);
|
|
140
|
+
}, 10);
|
|
141
|
+
};
|
|
134
142
|
//加载脚本
|
|
135
143
|
target = doc.querySelector("script[src='" + src + "']");
|
|
136
144
|
if (!target) {
|
|
@@ -140,18 +148,16 @@ function _loadScript() {
|
|
|
140
148
|
}
|
|
141
149
|
target.src = src;
|
|
142
150
|
target.onload = function () {
|
|
143
|
-
return
|
|
144
|
-
resolve(true);
|
|
145
|
-
}, 1);
|
|
151
|
+
return callback(true);
|
|
146
152
|
};
|
|
147
153
|
target.onerror = function () {
|
|
148
|
-
return
|
|
154
|
+
return callback(false);
|
|
149
155
|
};
|
|
150
156
|
doc.body.appendChild(target);
|
|
151
157
|
} else {
|
|
152
|
-
|
|
158
|
+
callback(true);
|
|
153
159
|
}
|
|
154
|
-
case
|
|
160
|
+
case 3:
|
|
155
161
|
case "end":
|
|
156
162
|
return _context4.stop();
|
|
157
163
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPublicTypeUtilsMap } from "@alilc/lowcode-types/lib/shell/type/project-schema";
|
|
2
2
|
import { IPublicTypeConfigure, IPublicTypeNpmInfo } from "@alilc/lowcode-types";
|
|
3
|
+
import { IPublicTypeI18nMap, IPublicTypeJSONObject, IPublicTypeNodeSchema, IPublicTypeRootSchema } from "@alilc/lowcode-types/lib/shell/type";
|
|
4
|
+
import { InterpretDataSource as DataSource } from "@alilc/lowcode-datasource-types/es/data-source-interpret";
|
|
3
5
|
/**
|
|
4
6
|
* 资产包协议
|
|
5
7
|
*/
|
|
@@ -57,6 +59,7 @@ export interface Package {
|
|
|
57
59
|
* 唯一标识
|
|
58
60
|
*/
|
|
59
61
|
id?: string;
|
|
62
|
+
componentId?: string;
|
|
60
63
|
/**
|
|
61
64
|
* 包名
|
|
62
65
|
*/
|
|
@@ -88,7 +91,7 @@ export interface Package {
|
|
|
88
91
|
/**
|
|
89
92
|
* 低代码组件的 schema 内容
|
|
90
93
|
*/
|
|
91
|
-
schema?:
|
|
94
|
+
schema?: IPublicTypePackageSchema;
|
|
92
95
|
/**
|
|
93
96
|
* 当前资源所依赖的其他资源包的 id 列表
|
|
94
97
|
*/
|
|
@@ -248,25 +251,26 @@ export interface Snippet {
|
|
|
248
251
|
* 组件低代码描述
|
|
249
252
|
*/
|
|
250
253
|
export interface ComponentDescription {
|
|
254
|
+
componentId?: string;
|
|
251
255
|
componentName: string;
|
|
252
256
|
title: string;
|
|
253
257
|
description?: string;
|
|
254
|
-
docUrl
|
|
255
|
-
screenshot
|
|
258
|
+
docUrl?: string;
|
|
259
|
+
screenshot?: string;
|
|
256
260
|
icon?: string;
|
|
257
261
|
tags?: string[];
|
|
258
262
|
keywords?: string[];
|
|
259
263
|
devMode?: 'proCode' | 'lowCode';
|
|
260
|
-
npm
|
|
261
|
-
configure
|
|
262
|
-
snippets
|
|
263
|
-
group
|
|
264
|
-
category
|
|
265
|
-
priority
|
|
264
|
+
npm?: IPublicTypeNpmInfo;
|
|
265
|
+
configure?: IPublicTypeConfigure;
|
|
266
|
+
snippets?: Snippet[];
|
|
267
|
+
group?: string;
|
|
268
|
+
category?: string;
|
|
269
|
+
priority?: number;
|
|
266
270
|
/**
|
|
267
271
|
* 组件引用的资源信息
|
|
268
272
|
*/
|
|
269
|
-
reference
|
|
273
|
+
reference?: Reference;
|
|
270
274
|
}
|
|
271
275
|
/**
|
|
272
276
|
* 远程物料描述
|
|
@@ -296,3 +300,30 @@ export interface MultiModeUrl {
|
|
|
296
300
|
default: string;
|
|
297
301
|
[index: string]: string;
|
|
298
302
|
}
|
|
303
|
+
interface IPublicTypePackageSchema<T = IPublicTypeRootSchema> extends IPublicTypeNodeSchema {
|
|
304
|
+
/**
|
|
305
|
+
* 当前应用协议版本号
|
|
306
|
+
*/
|
|
307
|
+
version: string;
|
|
308
|
+
/**
|
|
309
|
+
* 国际化语料
|
|
310
|
+
*/
|
|
311
|
+
i18n?: IPublicTypeI18nMap;
|
|
312
|
+
/**
|
|
313
|
+
* 应用范围内的全局自定义函数或第三方工具类扩展
|
|
314
|
+
*/
|
|
315
|
+
utils?: IPublicTypeUtilsMap;
|
|
316
|
+
/**
|
|
317
|
+
* 应用范围内的全局常量
|
|
318
|
+
*/
|
|
319
|
+
constants?: IPublicTypeJSONObject;
|
|
320
|
+
/**
|
|
321
|
+
* 应用范围内的全局样式
|
|
322
|
+
*/
|
|
323
|
+
css?: string;
|
|
324
|
+
/**
|
|
325
|
+
* 当前应用的公共数据源
|
|
326
|
+
*/
|
|
327
|
+
dataSource?: DataSource;
|
|
328
|
+
}
|
|
329
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Project, Material, Plugins } from "@alilc/lowcode-shell";
|
|
1
|
+
import { Project, Material, Plugins, Skeleton } from "@alilc/lowcode-shell";
|
|
2
2
|
import { DefaultAssertsType, DesignerAssets } from "../assets";
|
|
3
3
|
import { IPublicTypeAssetsJson } from "@alilc/lowcode-utils";
|
|
4
4
|
import { IPublicTypePlugin, IPublicTypePluginRegisterOptions } from "@alilc/lowcode-types";
|
|
@@ -7,6 +7,7 @@ export declare class Engine {
|
|
|
7
7
|
plugins: Plugins;
|
|
8
8
|
assets: DesignerAssets;
|
|
9
9
|
material: Material;
|
|
10
|
+
skeleton: Skeleton;
|
|
10
11
|
_engine: any;
|
|
11
12
|
constructor();
|
|
12
13
|
/**
|
|
@@ -14,6 +14,7 @@ var Engine = exports.Engine = function Engine() {
|
|
|
14
14
|
this.plugins = void 0;
|
|
15
15
|
this.assets = void 0;
|
|
16
16
|
this.material = void 0;
|
|
17
|
+
this.skeleton = void 0;
|
|
17
18
|
this._engine = void 0;
|
|
18
19
|
/**
|
|
19
20
|
* 注入资产
|
|
@@ -139,5 +140,6 @@ var Engine = exports.Engine = function Engine() {
|
|
|
139
140
|
this.project = this._engine.project;
|
|
140
141
|
this.material = this._engine.material;
|
|
141
142
|
this.plugins = this._engine.plugins;
|
|
143
|
+
this.skeleton = this._engine.skeleton;
|
|
142
144
|
this.assets = new _assets.DesignerAssets();
|
|
143
145
|
};
|