@zhubangyun/lowcode-core 1.1.8 → 1.1.10

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.
@@ -16,29 +16,33 @@ function _loadPlugins() {
16
16
  _iterator = _createForOfIteratorHelperLoose(plugins);
17
17
  case 1:
18
18
  if ((_step = _iterator()).done) {
19
- _context.next = 7;
19
+ _context.next = 8;
20
20
  break;
21
21
  }
22
22
  plugin = _step.value;
23
23
  _context.next = 5;
24
24
  return loadStyle(plugin);
25
25
  case 5:
26
+ console.debug("loadStyle", plugin);
27
+ case 6:
26
28
  _context.next = 1;
27
29
  break;
28
- case 7:
29
- _iterator2 = _createForOfIteratorHelperLoose(plugins);
30
30
  case 8:
31
+ _iterator2 = _createForOfIteratorHelperLoose(plugins);
32
+ case 9:
31
33
  if ((_step2 = _iterator2()).done) {
32
- _context.next = 14;
34
+ _context.next = 16;
33
35
  break;
34
36
  }
35
37
  _plugin = _step2.value;
36
- _context.next = 12;
38
+ _context.next = 13;
37
39
  return loadScript(_plugin);
38
- case 12:
39
- _context.next = 8;
40
- break;
40
+ case 13:
41
+ console.debug("loadScript", _plugin);
41
42
  case 14:
43
+ _context.next = 9;
44
+ break;
45
+ case 16:
42
46
  case "end":
43
47
  return _context.stop();
44
48
  }
@@ -73,7 +77,9 @@ function _loadStyle() {
73
77
  target.href = src;
74
78
  target.rel = "stylesheet";
75
79
  target.onload = function () {
76
- return resolve(true);
80
+ return setTimeout(function () {
81
+ resolve(true);
82
+ }, 1);
77
83
  };
78
84
  target.onerror = function () {
79
85
  return resolve(false);
@@ -129,7 +135,9 @@ function _loadScript() {
129
135
  }
130
136
  target.src = src;
131
137
  target.onload = function () {
132
- return resolve(true);
138
+ return setTimeout(function () {
139
+ resolve(true);
140
+ }, 1);
133
141
  };
134
142
  target.onerror = function () {
135
143
  return resolve(false);
@@ -1,14 +1,20 @@
1
- import { Project } from "@alilc/lowcode-shell";
1
+ import { Project, Material, Plugins } from "@alilc/lowcode-shell";
2
2
  import { DefaultAssertsType, DesignerAssets } from "../assets";
3
+ import { IPublicTypeAssetsJson } from "@alilc/lowcode-utils";
4
+ import { IPublicTypePlugin, IPublicTypePluginRegisterOptions } from "@alilc/lowcode-types";
3
5
  export declare class Engine {
4
6
  project: Project;
7
+ plugins: Plugins;
5
8
  assets: DesignerAssets;
9
+ material: Material;
6
10
  _engine: any;
7
11
  constructor();
8
12
  /**
9
13
  * 注入资产
10
14
  */
11
15
  injectAssets: (types?: DefaultAssertsType[]) => Promise<void>;
16
+ loadIncrementalAssets: (incrementalAssets: IPublicTypeAssetsJson) => Promise<void>;
17
+ registerPlugin: (pluginModel: IPublicTypePlugin, options?: any, registerOptions?: IPublicTypePluginRegisterOptions) => Promise<void>;
12
18
  /**
13
19
  * 初始化
14
20
  * @param container
@@ -6,7 +6,9 @@ import { createFetchHandler } from "@alilc/lowcode-datasource-fetch-handler";
6
6
  export var Engine = function Engine() {
7
7
  var _this = this;
8
8
  this.project = void 0;
9
+ this.plugins = void 0;
9
10
  this.assets = void 0;
11
+ this.material = void 0;
10
12
  this._engine = void 0;
11
13
  /**
12
14
  * 注入资产
@@ -43,17 +45,49 @@ export var Engine = function Engine() {
43
45
  return _ref.apply(this, arguments);
44
46
  };
45
47
  }();
48
+ this.loadIncrementalAssets = /*#__PURE__*/function () {
49
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(incrementalAssets) {
50
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
51
+ while (1) switch (_context2.prev = _context2.next) {
52
+ case 0:
53
+ return _context2.abrupt("return", _this.material.loadIncrementalAssets(incrementalAssets));
54
+ case 1:
55
+ case "end":
56
+ return _context2.stop();
57
+ }
58
+ }, _callee2);
59
+ }));
60
+ return function (_x2) {
61
+ return _ref2.apply(this, arguments);
62
+ };
63
+ }();
64
+ this.registerPlugin = /*#__PURE__*/function () {
65
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(pluginModel, options, registerOptions) {
66
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
67
+ while (1) switch (_context3.prev = _context3.next) {
68
+ case 0:
69
+ return _context3.abrupt("return", _this.plugins.register(pluginModel, options, registerOptions));
70
+ case 1:
71
+ case "end":
72
+ return _context3.stop();
73
+ }
74
+ }, _callee3);
75
+ }));
76
+ return function (_x3, _x4, _x5) {
77
+ return _ref3.apply(this, arguments);
78
+ };
79
+ }();
46
80
  /**
47
81
  * 初始化
48
82
  * @param container
49
83
  * @param schema
50
84
  */
51
85
  this.init = /*#__PURE__*/function () {
52
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(container, schema) {
53
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
54
- while (1) switch (_context2.prev = _context2.next) {
86
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(container, schema) {
87
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
88
+ while (1) switch (_context4.prev = _context4.next) {
55
89
  case 0:
56
- _context2.next = 2;
90
+ _context4.next = 2;
57
91
  return _this._engine.init(container, {
58
92
  designMode: "design",
59
93
  enableCondition: true,
@@ -64,22 +98,22 @@ export var Engine = function Engine() {
64
98
  }
65
99
  });
66
100
  case 2:
67
- _context2.next = 4;
101
+ _context4.next = 4;
68
102
  return _this.openDocument(schema);
69
103
  case 4:
70
104
  case "end":
71
- return _context2.stop();
105
+ return _context4.stop();
72
106
  }
73
- }, _callee2);
107
+ }, _callee4);
74
108
  }));
75
- return function (_x2, _x3) {
76
- return _ref2.apply(this, arguments);
109
+ return function (_x6, _x7) {
110
+ return _ref4.apply(this, arguments);
77
111
  };
78
112
  }();
79
113
  this.openDocument = /*#__PURE__*/function () {
80
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(schema) {
81
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
82
- while (1) switch (_context3.prev = _context3.next) {
114
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(schema) {
115
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
116
+ while (1) switch (_context5.prev = _context5.next) {
83
117
  case 0:
84
118
  if (schema === void 0) {
85
119
  schema = {};
@@ -87,16 +121,18 @@ export var Engine = function Engine() {
87
121
  _this._engine.project.openDocument(schema);
88
122
  case 2:
89
123
  case "end":
90
- return _context3.stop();
124
+ return _context5.stop();
91
125
  }
92
- }, _callee3);
126
+ }, _callee5);
93
127
  }));
94
- return function (_x4) {
95
- return _ref3.apply(this, arguments);
128
+ return function (_x8) {
129
+ return _ref5.apply(this, arguments);
96
130
  };
97
131
  }();
98
132
  // @ts-ignore
99
133
  this._engine = window.AliLowCodeEngine;
100
134
  this.project = this._engine.project;
135
+ this.material = this._engine.material;
136
+ this.plugins = this._engine.plugins;
101
137
  this.assets = new DesignerAssets();
102
138
  };
@@ -21,29 +21,33 @@ function _loadPlugins() {
21
21
  _iterator = _createForOfIteratorHelperLoose(plugins);
22
22
  case 1:
23
23
  if ((_step = _iterator()).done) {
24
- _context.next = 7;
24
+ _context.next = 8;
25
25
  break;
26
26
  }
27
27
  plugin = _step.value;
28
28
  _context.next = 5;
29
29
  return loadStyle(plugin);
30
30
  case 5:
31
+ console.debug("loadStyle", plugin);
32
+ case 6:
31
33
  _context.next = 1;
32
34
  break;
33
- case 7:
34
- _iterator2 = _createForOfIteratorHelperLoose(plugins);
35
35
  case 8:
36
+ _iterator2 = _createForOfIteratorHelperLoose(plugins);
37
+ case 9:
36
38
  if ((_step2 = _iterator2()).done) {
37
- _context.next = 14;
39
+ _context.next = 16;
38
40
  break;
39
41
  }
40
42
  _plugin = _step2.value;
41
- _context.next = 12;
43
+ _context.next = 13;
42
44
  return loadScript(_plugin);
43
- case 12:
44
- _context.next = 8;
45
- break;
45
+ case 13:
46
+ console.debug("loadScript", _plugin);
46
47
  case 14:
48
+ _context.next = 9;
49
+ break;
50
+ case 16:
47
51
  case "end":
48
52
  return _context.stop();
49
53
  }
@@ -78,7 +82,9 @@ function _loadStyle() {
78
82
  target.href = src;
79
83
  target.rel = "stylesheet";
80
84
  target.onload = function () {
81
- return resolve(true);
85
+ return setTimeout(function () {
86
+ resolve(true);
87
+ }, 1);
82
88
  };
83
89
  target.onerror = function () {
84
90
  return resolve(false);
@@ -134,7 +140,9 @@ function _loadScript() {
134
140
  }
135
141
  target.src = src;
136
142
  target.onload = function () {
137
- return resolve(true);
143
+ return setTimeout(function () {
144
+ resolve(true);
145
+ }, 1);
138
146
  };
139
147
  target.onerror = function () {
140
148
  return resolve(false);
@@ -1,14 +1,20 @@
1
- import { Project } from "@alilc/lowcode-shell";
1
+ import { Project, Material, Plugins } from "@alilc/lowcode-shell";
2
2
  import { DefaultAssertsType, DesignerAssets } from "../assets";
3
+ import { IPublicTypeAssetsJson } from "@alilc/lowcode-utils";
4
+ import { IPublicTypePlugin, IPublicTypePluginRegisterOptions } from "@alilc/lowcode-types";
3
5
  export declare class Engine {
4
6
  project: Project;
7
+ plugins: Plugins;
5
8
  assets: DesignerAssets;
9
+ material: Material;
6
10
  _engine: any;
7
11
  constructor();
8
12
  /**
9
13
  * 注入资产
10
14
  */
11
15
  injectAssets: (types?: DefaultAssertsType[]) => Promise<void>;
16
+ loadIncrementalAssets: (incrementalAssets: IPublicTypeAssetsJson) => Promise<void>;
17
+ registerPlugin: (pluginModel: IPublicTypePlugin, options?: any, registerOptions?: IPublicTypePluginRegisterOptions) => Promise<void>;
12
18
  /**
13
19
  * 初始化
14
20
  * @param container
@@ -11,7 +11,9 @@ var _lowcodeDatasourceFetchHandler = require("@alilc/lowcode-datasource-fetch-ha
11
11
  var Engine = exports.Engine = function Engine() {
12
12
  var _this = this;
13
13
  this.project = void 0;
14
+ this.plugins = void 0;
14
15
  this.assets = void 0;
16
+ this.material = void 0;
15
17
  this._engine = void 0;
16
18
  /**
17
19
  * 注入资产
@@ -48,17 +50,49 @@ var Engine = exports.Engine = function Engine() {
48
50
  return _ref.apply(this, arguments);
49
51
  };
50
52
  }();
53
+ this.loadIncrementalAssets = /*#__PURE__*/function () {
54
+ var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(incrementalAssets) {
55
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
56
+ while (1) switch (_context2.prev = _context2.next) {
57
+ case 0:
58
+ return _context2.abrupt("return", _this.material.loadIncrementalAssets(incrementalAssets));
59
+ case 1:
60
+ case "end":
61
+ return _context2.stop();
62
+ }
63
+ }, _callee2);
64
+ }));
65
+ return function (_x2) {
66
+ return _ref2.apply(this, arguments);
67
+ };
68
+ }();
69
+ this.registerPlugin = /*#__PURE__*/function () {
70
+ var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(pluginModel, options, registerOptions) {
71
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
72
+ while (1) switch (_context3.prev = _context3.next) {
73
+ case 0:
74
+ return _context3.abrupt("return", _this.plugins.register(pluginModel, options, registerOptions));
75
+ case 1:
76
+ case "end":
77
+ return _context3.stop();
78
+ }
79
+ }, _callee3);
80
+ }));
81
+ return function (_x3, _x4, _x5) {
82
+ return _ref3.apply(this, arguments);
83
+ };
84
+ }();
51
85
  /**
52
86
  * 初始化
53
87
  * @param container
54
88
  * @param schema
55
89
  */
56
90
  this.init = /*#__PURE__*/function () {
57
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(container, schema) {
58
- return _regenerator["default"].wrap(function _callee2$(_context2) {
59
- while (1) switch (_context2.prev = _context2.next) {
91
+ var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(container, schema) {
92
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
93
+ while (1) switch (_context4.prev = _context4.next) {
60
94
  case 0:
61
- _context2.next = 2;
95
+ _context4.next = 2;
62
96
  return _this._engine.init(container, {
63
97
  designMode: "design",
64
98
  enableCondition: true,
@@ -69,22 +103,22 @@ var Engine = exports.Engine = function Engine() {
69
103
  }
70
104
  });
71
105
  case 2:
72
- _context2.next = 4;
106
+ _context4.next = 4;
73
107
  return _this.openDocument(schema);
74
108
  case 4:
75
109
  case "end":
76
- return _context2.stop();
110
+ return _context4.stop();
77
111
  }
78
- }, _callee2);
112
+ }, _callee4);
79
113
  }));
80
- return function (_x2, _x3) {
81
- return _ref2.apply(this, arguments);
114
+ return function (_x6, _x7) {
115
+ return _ref4.apply(this, arguments);
82
116
  };
83
117
  }();
84
118
  this.openDocument = /*#__PURE__*/function () {
85
- var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(schema) {
86
- return _regenerator["default"].wrap(function _callee3$(_context3) {
87
- while (1) switch (_context3.prev = _context3.next) {
119
+ var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(schema) {
120
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
121
+ while (1) switch (_context5.prev = _context5.next) {
88
122
  case 0:
89
123
  if (schema === void 0) {
90
124
  schema = {};
@@ -92,16 +126,18 @@ var Engine = exports.Engine = function Engine() {
92
126
  _this._engine.project.openDocument(schema);
93
127
  case 2:
94
128
  case "end":
95
- return _context3.stop();
129
+ return _context5.stop();
96
130
  }
97
- }, _callee3);
131
+ }, _callee5);
98
132
  }));
99
- return function (_x4) {
100
- return _ref3.apply(this, arguments);
133
+ return function (_x8) {
134
+ return _ref5.apply(this, arguments);
101
135
  };
102
136
  }();
103
137
  // @ts-ignore
104
138
  this._engine = window.AliLowCodeEngine;
105
139
  this.project = this._engine.project;
140
+ this.material = this._engine.material;
141
+ this.plugins = this._engine.plugins;
106
142
  this.assets = new _assets.DesignerAssets();
107
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhubangyun/lowcode-core",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "低代码核心",
5
5
  "files": [
6
6
  "lib",