@pisell/core 1.0.14 → 1.0.16
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/app/app.d.ts +87 -0
- package/es/app/const.d.ts +4 -0
- package/es/app/index.d.ts +14 -0
- package/es/applicationManager/application.d.ts +202 -0
- package/es/applicationManager/application.js +258 -33
- package/es/applicationManager/index.d.ts +18 -0
- package/es/applicationManager/index.js +22 -7
- package/es/aws/index.d.ts +16 -0
- package/es/cmd/const.d.ts +11 -0
- package/es/cmd/index.d.ts +13 -0
- package/es/cmd/type.d.ts +5 -0
- package/es/config.d.ts +3 -0
- package/es/cookie/index.d.ts +13 -0
- package/es/data/index.d.ts +8 -0
- package/es/history/config.d.ts +24 -0
- package/es/history/index.d.ts +20 -0
- package/es/history/type.d.ts +2 -0
- package/es/hooks/index.d.ts +12 -0
- package/es/hooks/useDelayedValue/index.d.ts +2 -0
- package/es/hooks/useDispatch/index.d.ts +2 -0
- package/es/hooks/useLowCode/index.d.ts +13 -0
- package/es/hooks/useStore/index.d.ts +6 -0
- package/es/index.d.ts +6 -0
- package/es/indexDB/index.d.ts +248 -0
- package/es/indexDB/index.js +453 -70
- package/es/locales/en.d.ts +3 -0
- package/es/locales/index.d.ts +39 -0
- package/es/locales/original.d.ts +3 -0
- package/es/locales/type.d.ts +19 -0
- package/es/locales/zh-CN.d.ts +3 -0
- package/es/locales/zh-HK.d.ts +3 -0
- package/es/logger/feishu.d.ts +11 -0
- package/es/logger/index.d.ts +134 -0
- package/es/menuManager/hooks.d.ts +17 -0
- package/es/menuManager/index.d.ts +28 -0
- package/es/models/global.d.ts +32 -0
- package/es/models/index.d.ts +45 -0
- package/es/models/type.d.ts +2 -0
- package/es/plugin/index.d.ts +0 -0
- package/es/pubsub/example.d.ts +5 -0
- package/es/pubsub/index.d.ts +63 -0
- package/es/render/index.d.ts +0 -0
- package/es/render/index.js +0 -0
- package/es/request/cache.d.ts +46 -0
- package/es/request/cancelToken.d.ts +38 -0
- package/es/request/config.d.ts +3 -0
- package/es/request/constants.d.ts +2 -0
- package/es/request/index.d.ts +24 -0
- package/es/request/pisell2Request.d.ts +6 -0
- package/es/request/type.d.ts +41 -0
- package/es/request/utils.d.ts +46 -0
- package/es/routes/config.d.ts +7 -0
- package/es/routes/index.d.ts +28 -0
- package/es/socket/components/SocketMonitorPage.d.ts +6 -0
- package/es/socket/components/index.d.ts +2 -0
- package/es/socket/constants.d.ts +33 -0
- package/es/socket/events.d.ts +31 -0
- package/es/socket/heartbeat.d.ts +66 -0
- package/es/socket/index.d.ts +61 -0
- package/es/socket/monitor.d.ts +169 -0
- package/es/socket/reconnect.d.ts +61 -0
- package/es/socket/socket.d.ts +130 -0
- package/es/socket/types.d.ts +84 -0
- package/es/storage/index.d.ts +17 -0
- package/es/tasks/index.d.ts +83 -0
- package/es/tasks/type.d.ts +62 -0
- package/es/tasks/useTasks.d.ts +5 -0
- package/es/type.d.ts +2 -0
- package/es/variables/VariablesProvider.d.ts +7 -0
- package/es/variables/config.d.ts +3 -0
- package/es/variables/index.d.ts +6 -0
- package/es/variables/type.d.ts +2 -0
- package/es/website/index.d.ts +6 -0
- package/lib/app/app.d.ts +87 -0
- package/lib/app/const.d.ts +4 -0
- package/lib/app/index.d.ts +14 -0
- package/lib/applicationManager/application.d.ts +202 -0
- package/lib/applicationManager/application.js +142 -9
- package/lib/applicationManager/index.d.ts +18 -0
- package/lib/applicationManager/index.js +12 -5
- package/lib/aws/index.d.ts +16 -0
- package/lib/cmd/const.d.ts +11 -0
- package/lib/cmd/index.d.ts +13 -0
- package/lib/cmd/type.d.ts +5 -0
- package/lib/config.d.ts +3 -0
- package/lib/cookie/index.d.ts +13 -0
- package/lib/data/index.d.ts +8 -0
- package/lib/history/config.d.ts +24 -0
- package/lib/history/index.d.ts +20 -0
- package/lib/history/type.d.ts +2 -0
- package/lib/hooks/index.d.ts +12 -0
- package/lib/hooks/useDelayedValue/index.d.ts +2 -0
- package/lib/hooks/useDispatch/index.d.ts +2 -0
- package/lib/hooks/useLowCode/index.d.ts +13 -0
- package/lib/hooks/useStore/index.d.ts +6 -0
- package/lib/index.d.ts +6 -0
- package/lib/indexDB/index.d.ts +248 -0
- package/lib/indexDB/index.js +159 -0
- package/lib/locales/en.d.ts +3 -0
- package/lib/locales/index.d.ts +39 -0
- package/lib/locales/original.d.ts +3 -0
- package/lib/locales/type.d.ts +19 -0
- package/lib/locales/zh-CN.d.ts +3 -0
- package/lib/locales/zh-HK.d.ts +3 -0
- package/lib/logger/feishu.d.ts +11 -0
- package/lib/logger/index.d.ts +134 -0
- package/lib/menuManager/hooks.d.ts +17 -0
- package/lib/menuManager/index.d.ts +28 -0
- package/lib/models/global.d.ts +32 -0
- package/lib/models/index.d.ts +45 -0
- package/lib/models/type.d.ts +2 -0
- package/lib/plugin/index.d.ts +0 -0
- package/lib/pubsub/example.d.ts +5 -0
- package/lib/pubsub/index.d.ts +63 -0
- package/lib/render/index.d.ts +0 -0
- package/lib/render/index.js +0 -0
- package/lib/request/cache.d.ts +46 -0
- package/lib/request/cancelToken.d.ts +38 -0
- package/lib/request/config.d.ts +3 -0
- package/lib/request/constants.d.ts +2 -0
- package/lib/request/index.d.ts +24 -0
- package/lib/request/pisell2Request.d.ts +6 -0
- package/lib/request/type.d.ts +41 -0
- package/lib/request/utils.d.ts +46 -0
- package/lib/routes/config.d.ts +7 -0
- package/lib/routes/index.d.ts +28 -0
- package/lib/socket/components/SocketMonitorPage.d.ts +6 -0
- package/lib/socket/components/index.d.ts +2 -0
- package/lib/socket/constants.d.ts +33 -0
- package/lib/socket/events.d.ts +31 -0
- package/lib/socket/heartbeat.d.ts +66 -0
- package/lib/socket/index.d.ts +61 -0
- package/lib/socket/monitor.d.ts +169 -0
- package/lib/socket/reconnect.d.ts +61 -0
- package/lib/socket/socket.d.ts +130 -0
- package/lib/socket/types.d.ts +84 -0
- package/lib/storage/index.d.ts +17 -0
- package/lib/tasks/index.d.ts +83 -0
- package/lib/tasks/type.d.ts +62 -0
- package/lib/tasks/useTasks.d.ts +5 -0
- package/lib/type.d.ts +2 -0
- package/lib/variables/VariablesProvider.d.ts +7 -0
- package/lib/variables/config.d.ts +3 -0
- package/lib/variables/index.d.ts +6 -0
- package/lib/variables/type.d.ts +2 -0
- package/lib/website/index.d.ts +6 -0
- package/package.json +7 -7
|
@@ -10,17 +10,42 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
10
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
12
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
/**
|
|
14
|
+
* 应用接口类型定义
|
|
15
|
+
* @description 描述应用中单个页面、组件或功能的接口结构
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 应用数据类型定义
|
|
20
|
+
* @description 描述完整应用的数据结构,包含应用的基本信息、接口、功能等
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 应用管理类
|
|
25
|
+
* @description 负责管理单个应用的生命周期,包括接口、组件、功能的初始化和管理
|
|
26
|
+
* @class Application
|
|
27
|
+
* @author zhiwei.Wang
|
|
28
|
+
*/
|
|
13
29
|
export var Application = /*#__PURE__*/function () {
|
|
30
|
+
/**
|
|
31
|
+
* 构造函数
|
|
32
|
+
* @description 初始化应用实例,设置基本属性并初始化接口和功能
|
|
33
|
+
* @param {ApplicationData} options - 应用配置数据
|
|
34
|
+
* @param {App} app - 应用实例引用
|
|
35
|
+
*/
|
|
14
36
|
function Application(options, app) {
|
|
15
37
|
_classCallCheck(this, Application);
|
|
38
|
+
/** 应用配置数据 */
|
|
16
39
|
_defineProperty(this, "options", void 0);
|
|
40
|
+
/** 应用名称 */
|
|
17
41
|
_defineProperty(this, "name", void 0);
|
|
18
|
-
|
|
42
|
+
/** 应用内的页面接口映射表,以页面名称为键 */
|
|
19
43
|
_defineProperty(this, "interfaces", new Map());
|
|
20
|
-
|
|
44
|
+
/** 应用内的组件映射表,以组件编码为键 */
|
|
21
45
|
_defineProperty(this, "components", new Map());
|
|
22
|
-
|
|
46
|
+
/** 应用内的功能函数映射表,比如跳转登录页面的方法等 */
|
|
23
47
|
_defineProperty(this, "functions", new Map());
|
|
48
|
+
/** 应用实例引用 */
|
|
24
49
|
_defineProperty(this, "app", void 0);
|
|
25
50
|
this.options = options;
|
|
26
51
|
this.name = options.app_name;
|
|
@@ -28,67 +53,127 @@ export var Application = /*#__PURE__*/function () {
|
|
|
28
53
|
this.initInterfaces(options.interfaces);
|
|
29
54
|
this.initFunctions(options.functions);
|
|
30
55
|
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 应用添加后的内部处理方法
|
|
59
|
+
* @description 在应用被添加到应用管理器后执行的内部逻辑,包括加载多语言配置和执行用户自定义的afterAdd方法
|
|
60
|
+
* @param {Application} application - 被添加的应用实例
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
31
64
|
_createClass(Application, [{
|
|
32
|
-
key: "
|
|
33
|
-
value: function () {
|
|
34
|
-
var
|
|
65
|
+
key: "_afterAdd",
|
|
66
|
+
value: (function () {
|
|
67
|
+
var _afterAdd2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(application) {
|
|
35
68
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
36
69
|
while (1) switch (_context.prev = _context.next) {
|
|
37
70
|
case 0:
|
|
38
71
|
if (application.options.locales) {
|
|
39
72
|
this.app.locales.loadLibraryByUrl(application.options.locales);
|
|
40
73
|
}
|
|
41
|
-
|
|
74
|
+
_context.prev = 1;
|
|
75
|
+
_context.next = 4;
|
|
76
|
+
return this.afterAdd(this);
|
|
77
|
+
case 4:
|
|
78
|
+
_context.next = 9;
|
|
79
|
+
break;
|
|
80
|
+
case 6:
|
|
81
|
+
_context.prev = 6;
|
|
82
|
+
_context.t0 = _context["catch"](1);
|
|
83
|
+
console.log(_context.t0);
|
|
84
|
+
case 9:
|
|
42
85
|
case "end":
|
|
43
86
|
return _context.stop();
|
|
44
87
|
}
|
|
45
|
-
}, _callee, this);
|
|
88
|
+
}, _callee, this, [[1, 6]]);
|
|
46
89
|
}));
|
|
47
|
-
function
|
|
48
|
-
return
|
|
90
|
+
function _afterAdd(_x) {
|
|
91
|
+
return _afterAdd2.apply(this, arguments);
|
|
49
92
|
}
|
|
50
|
-
return
|
|
93
|
+
return _afterAdd;
|
|
51
94
|
}()
|
|
95
|
+
/**
|
|
96
|
+
* 应用加载前的内部处理方法
|
|
97
|
+
* @description 在应用开始加载前执行的内部逻辑,调用用户自定义的beforeLoad方法
|
|
98
|
+
* @returns {Promise<void>}
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
)
|
|
52
102
|
}, {
|
|
53
|
-
key: "
|
|
54
|
-
value: function () {
|
|
55
|
-
var
|
|
103
|
+
key: "_beforeLoad",
|
|
104
|
+
value: (function () {
|
|
105
|
+
var _beforeLoad2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
56
106
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
57
107
|
while (1) switch (_context2.prev = _context2.next) {
|
|
58
108
|
case 0:
|
|
109
|
+
_context2.prev = 0;
|
|
110
|
+
_context2.next = 3;
|
|
111
|
+
return this.beforeLoad(this);
|
|
112
|
+
case 3:
|
|
113
|
+
_context2.next = 8;
|
|
114
|
+
break;
|
|
115
|
+
case 5:
|
|
116
|
+
_context2.prev = 5;
|
|
117
|
+
_context2.t0 = _context2["catch"](0);
|
|
118
|
+
console.log(_context2.t0);
|
|
119
|
+
case 8:
|
|
59
120
|
case "end":
|
|
60
121
|
return _context2.stop();
|
|
61
122
|
}
|
|
62
|
-
}, _callee2);
|
|
123
|
+
}, _callee2, this, [[0, 5]]);
|
|
63
124
|
}));
|
|
64
|
-
function
|
|
65
|
-
return
|
|
125
|
+
function _beforeLoad() {
|
|
126
|
+
return _beforeLoad2.apply(this, arguments);
|
|
66
127
|
}
|
|
67
|
-
return
|
|
128
|
+
return _beforeLoad;
|
|
68
129
|
}()
|
|
130
|
+
/**
|
|
131
|
+
* 应用加载的内部处理方法
|
|
132
|
+
* @description 执行应用的实际加载逻辑,将应用中的所有接口注册为路由
|
|
133
|
+
* @returns {Promise<void>}
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
)
|
|
69
137
|
}, {
|
|
70
|
-
key: "
|
|
71
|
-
value: function () {
|
|
72
|
-
var
|
|
138
|
+
key: "_load",
|
|
139
|
+
value: (function () {
|
|
140
|
+
var _load2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
73
141
|
var _this = this;
|
|
74
142
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
75
143
|
while (1) switch (_context3.prev = _context3.next) {
|
|
76
144
|
case 0:
|
|
145
|
+
_context3.prev = 0;
|
|
77
146
|
// 将interface 生成路由
|
|
78
147
|
this.interfaces.forEach(function (item, key) {
|
|
79
|
-
_this.app.router.add(item.router, item);
|
|
148
|
+
_this.app.router.add((item === null || item === void 0 ? void 0 : item.router) || '', item);
|
|
80
149
|
});
|
|
81
|
-
|
|
150
|
+
_context3.next = 4;
|
|
151
|
+
return this.load(this);
|
|
152
|
+
case 4:
|
|
153
|
+
_context3.next = 9;
|
|
154
|
+
break;
|
|
155
|
+
case 6:
|
|
156
|
+
_context3.prev = 6;
|
|
157
|
+
_context3.t0 = _context3["catch"](0);
|
|
158
|
+
console.log(_context3.t0);
|
|
159
|
+
case 9:
|
|
82
160
|
case "end":
|
|
83
161
|
return _context3.stop();
|
|
84
162
|
}
|
|
85
|
-
}, _callee3, this);
|
|
163
|
+
}, _callee3, this, [[0, 6]]);
|
|
86
164
|
}));
|
|
87
|
-
function
|
|
88
|
-
return
|
|
165
|
+
function _load() {
|
|
166
|
+
return _load2.apply(this, arguments);
|
|
89
167
|
}
|
|
90
|
-
return
|
|
168
|
+
return _load;
|
|
91
169
|
}()
|
|
170
|
+
/**
|
|
171
|
+
* 初始化应用接口
|
|
172
|
+
* @description 遍历应用配置中的接口列表,根据类别将它们分别设置到对应的映射表中
|
|
173
|
+
* @param {ApplicationData['interfaces']} interfaces - 接口配置数组
|
|
174
|
+
* @returns {void}
|
|
175
|
+
*/
|
|
176
|
+
)
|
|
92
177
|
}, {
|
|
93
178
|
key: "initInterfaces",
|
|
94
179
|
value: function initInterfaces(interfaces) {
|
|
@@ -103,13 +188,13 @@ export var Application = /*#__PURE__*/function () {
|
|
|
103
188
|
return _this2.loadInterface(interfaceItem);
|
|
104
189
|
case 2:
|
|
105
190
|
_interface = _context4.sent;
|
|
106
|
-
if (interfaceItem.category ===
|
|
191
|
+
if (interfaceItem.category === 'page') {
|
|
107
192
|
_this2.setInterface(interfaceItem.page_code, _interface);
|
|
108
193
|
}
|
|
109
|
-
if (interfaceItem.category ===
|
|
194
|
+
if (interfaceItem.category === 'component') {
|
|
110
195
|
_this2.setComponent(interfaceItem.page_code, _interface);
|
|
111
196
|
}
|
|
112
|
-
if (interfaceItem.category ===
|
|
197
|
+
if (interfaceItem.category === 'function') {
|
|
113
198
|
_this2.setFunction(interfaceItem.page_code, _interface);
|
|
114
199
|
}
|
|
115
200
|
case 6:
|
|
@@ -123,6 +208,13 @@ export var Application = /*#__PURE__*/function () {
|
|
|
123
208
|
};
|
|
124
209
|
}());
|
|
125
210
|
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* 初始化应用功能函数
|
|
214
|
+
* @description 遍历应用配置中的功能列表,将它们设置到功能映射表中
|
|
215
|
+
* @param {ApplicationData['functions']} functions - 功能配置数组,可选
|
|
216
|
+
* @returns {void}
|
|
217
|
+
*/
|
|
126
218
|
}, {
|
|
127
219
|
key: "initFunctions",
|
|
128
220
|
value: function initFunctions(functions) {
|
|
@@ -144,9 +236,16 @@ export var Application = /*#__PURE__*/function () {
|
|
|
144
236
|
};
|
|
145
237
|
}());
|
|
146
238
|
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* 加载接口组件
|
|
242
|
+
* @description 根据接口类型加载对应的组件,支持低代码和普通代码两种类型
|
|
243
|
+
* @param {ApplicationInterface} interfaceItem - 接口配置项
|
|
244
|
+
* @returns {Promise<ApplicationInterface>} 加载后的接口配置
|
|
245
|
+
*/
|
|
147
246
|
}, {
|
|
148
247
|
key: "loadInterface",
|
|
149
|
-
value: function () {
|
|
248
|
+
value: (function () {
|
|
150
249
|
var _loadInterface = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(interfaceItem) {
|
|
151
250
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
152
251
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -157,10 +256,10 @@ export var Application = /*#__PURE__*/function () {
|
|
|
157
256
|
}
|
|
158
257
|
return _context6.abrupt("return", interfaceItem);
|
|
159
258
|
case 2:
|
|
160
|
-
if (interfaceItem.page_type ===
|
|
259
|
+
if (interfaceItem.page_type === 'low_code') {
|
|
161
260
|
// TODO: load low code interface
|
|
162
261
|
}
|
|
163
|
-
if (interfaceItem.page_type ===
|
|
262
|
+
if (interfaceItem.page_type === 'code') {
|
|
164
263
|
// TODO: load code interface
|
|
165
264
|
}
|
|
166
265
|
return _context6.abrupt("return", interfaceItem);
|
|
@@ -175,36 +274,89 @@ export var Application = /*#__PURE__*/function () {
|
|
|
175
274
|
}
|
|
176
275
|
return loadInterface;
|
|
177
276
|
}()
|
|
277
|
+
/**
|
|
278
|
+
* 设置页面
|
|
279
|
+
* @description 将页面接口添加到接口映射表中
|
|
280
|
+
* @param {string} code - 页面编码
|
|
281
|
+
* @param {ApplicationInterface} interfaceItem - 接口配置项
|
|
282
|
+
* @returns {void}
|
|
283
|
+
*/
|
|
284
|
+
)
|
|
178
285
|
}, {
|
|
179
286
|
key: "setInterface",
|
|
180
287
|
value: function setInterface(code, interfaceItem) {
|
|
181
288
|
this.interfaces.set(code, interfaceItem);
|
|
182
289
|
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 设置组件
|
|
293
|
+
* @description 将组件添加到组件映射表中
|
|
294
|
+
* @param {string} code - 组件编码
|
|
295
|
+
* @param {ApplicationInterface} component - 组件配置项
|
|
296
|
+
* @returns {void}
|
|
297
|
+
*/
|
|
183
298
|
}, {
|
|
184
299
|
key: "setComponent",
|
|
185
300
|
value: function setComponent(code, component) {
|
|
186
301
|
this.components.set(code, component);
|
|
187
302
|
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* 设置功能函数
|
|
306
|
+
* @description 将功能函数添加到功能映射表中
|
|
307
|
+
* @param {string} code - 功能编码
|
|
308
|
+
* @param {ApplicationInterface} functionItem - 功能配置项
|
|
309
|
+
* @returns {void}
|
|
310
|
+
*/
|
|
188
311
|
}, {
|
|
189
312
|
key: "setFunction",
|
|
190
313
|
value: function setFunction(code, functionItem) {
|
|
191
314
|
this.functions.set(code, functionItem);
|
|
192
315
|
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* 获取页面
|
|
319
|
+
* @description 根据编码从接口映射表中获取页面接口
|
|
320
|
+
* @param {string} code - 页面编码
|
|
321
|
+
* @returns {ApplicationInterface | undefined} 接口配置项或undefined
|
|
322
|
+
*/
|
|
193
323
|
}, {
|
|
194
324
|
key: "getInterface",
|
|
195
325
|
value: function getInterface(code) {
|
|
196
326
|
return this.interfaces.get(code);
|
|
197
327
|
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* 获取组件
|
|
331
|
+
* @description 根据编码从组件映射表中获取组件
|
|
332
|
+
* @param {string} code - 组件编码
|
|
333
|
+
* @returns {any | undefined} 组件或undefined
|
|
334
|
+
*/
|
|
198
335
|
}, {
|
|
199
336
|
key: "getComponent",
|
|
200
337
|
value: function getComponent(code) {
|
|
201
338
|
return this.components.get(code);
|
|
202
339
|
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* 获取功能函数
|
|
343
|
+
* @description 根据编码从功能映射表中获取功能函数
|
|
344
|
+
* @param {string} code - 功能编码
|
|
345
|
+
* @returns {any | undefined} 功能函数或undefined
|
|
346
|
+
*/
|
|
203
347
|
}, {
|
|
204
348
|
key: "getFunction",
|
|
205
349
|
value: function getFunction(code) {
|
|
206
350
|
return this.functions.get(code);
|
|
207
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* 执行功能函数
|
|
354
|
+
* @description 根据编码执行对应的功能函数,自动注入应用实例并合并参数
|
|
355
|
+
* @param {string} code - 功能编码
|
|
356
|
+
* @param {any} params - 传递给功能函数的参数对象,可选
|
|
357
|
+
* @param {...any} args - 传递给功能函数的其他参数
|
|
358
|
+
* @returns {any} 功能函数的执行结果
|
|
359
|
+
*/
|
|
208
360
|
}, {
|
|
209
361
|
key: "runFunction",
|
|
210
362
|
value: function runFunction(code, params) {
|
|
@@ -218,6 +370,79 @@ export var Application = /*#__PURE__*/function () {
|
|
|
218
370
|
}
|
|
219
371
|
return (_this$getFunction = this.getFunction(code)) === null || _this$getFunction === void 0 ? void 0 : _this$getFunction.code.apply(_this$getFunction, [_params].concat(args));
|
|
220
372
|
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* 应用添加后触发的钩子函数
|
|
376
|
+
* @description 在应用被添加到应用管理器后触发,可被子类覆盖以实现自定义逻辑
|
|
377
|
+
* @param {Application} application - 被添加的应用实例
|
|
378
|
+
* @returns {Promise<void>}
|
|
379
|
+
* @author zhiwei.Wang
|
|
380
|
+
*/
|
|
381
|
+
}, {
|
|
382
|
+
key: "afterAdd",
|
|
383
|
+
value: (function () {
|
|
384
|
+
var _afterAdd3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(application) {
|
|
385
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
386
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
387
|
+
case 0:
|
|
388
|
+
case "end":
|
|
389
|
+
return _context7.stop();
|
|
390
|
+
}
|
|
391
|
+
}, _callee7);
|
|
392
|
+
}));
|
|
393
|
+
function afterAdd(_x5) {
|
|
394
|
+
return _afterAdd3.apply(this, arguments);
|
|
395
|
+
}
|
|
396
|
+
return afterAdd;
|
|
397
|
+
}()
|
|
398
|
+
/**
|
|
399
|
+
* 应用加载前触发的钩子函数
|
|
400
|
+
* @description 在应用开始加载前触发,可被子类覆盖以实现自定义预处理逻辑
|
|
401
|
+
* @returns {Promise<void>}
|
|
402
|
+
* @author zhiwei.Wang
|
|
403
|
+
*/
|
|
404
|
+
)
|
|
405
|
+
}, {
|
|
406
|
+
key: "beforeLoad",
|
|
407
|
+
value: (function () {
|
|
408
|
+
var _beforeLoad3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(application) {
|
|
409
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
410
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
411
|
+
case 0:
|
|
412
|
+
case "end":
|
|
413
|
+
return _context8.stop();
|
|
414
|
+
}
|
|
415
|
+
}, _callee8);
|
|
416
|
+
}));
|
|
417
|
+
function beforeLoad(_x6) {
|
|
418
|
+
return _beforeLoad3.apply(this, arguments);
|
|
419
|
+
}
|
|
420
|
+
return beforeLoad;
|
|
421
|
+
}()
|
|
422
|
+
/**
|
|
423
|
+
* 应用加载完成后触发的钩子函数
|
|
424
|
+
* @description 在应用完成加载后触发,可被子类覆盖以实现自定义后处理逻辑
|
|
425
|
+
* @returns {Promise<void>}
|
|
426
|
+
* @author zhiwei.Wang
|
|
427
|
+
*/
|
|
428
|
+
)
|
|
429
|
+
}, {
|
|
430
|
+
key: "load",
|
|
431
|
+
value: (function () {
|
|
432
|
+
var _load3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(application) {
|
|
433
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
434
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
435
|
+
case 0:
|
|
436
|
+
case "end":
|
|
437
|
+
return _context9.stop();
|
|
438
|
+
}
|
|
439
|
+
}, _callee9);
|
|
440
|
+
}));
|
|
441
|
+
function load(_x7) {
|
|
442
|
+
return _load3.apply(this, arguments);
|
|
443
|
+
}
|
|
444
|
+
return load;
|
|
445
|
+
}())
|
|
221
446
|
}]);
|
|
222
447
|
return Application;
|
|
223
448
|
}();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import APP from '../app';
|
|
2
|
+
import { Application, ApplicationData } from './application';
|
|
3
|
+
export declare class ApplicationManager {
|
|
4
|
+
applicationList: Application[];
|
|
5
|
+
protected app: APP;
|
|
6
|
+
applications: Map<string, Application>;
|
|
7
|
+
constructor(applicationList: Application[], app: APP);
|
|
8
|
+
init(applicationList: Application[] | ApplicationData[]): Promise<unknown>;
|
|
9
|
+
add(application: Application): Promise<void>;
|
|
10
|
+
get(appName: Application['name']): Application | undefined;
|
|
11
|
+
remove(appName: Application['name']): void;
|
|
12
|
+
load(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* 循环所有的应用, 找出所有的components进行渲染
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
getAllComponents(): any[];
|
|
18
|
+
}
|
|
@@ -43,7 +43,7 @@ export var ApplicationManager = /*#__PURE__*/function () {
|
|
|
43
43
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
44
44
|
while (1) switch (_context.prev = _context.next) {
|
|
45
45
|
case 0:
|
|
46
|
-
if (_typeof(application) ===
|
|
46
|
+
if (_typeof(application) === 'object') {
|
|
47
47
|
application = new Application(application, _this.app);
|
|
48
48
|
}
|
|
49
49
|
_context.next = 3;
|
|
@@ -92,7 +92,7 @@ export var ApplicationManager = /*#__PURE__*/function () {
|
|
|
92
92
|
case 0:
|
|
93
93
|
this.applications.set(application.name, application);
|
|
94
94
|
_context4.next = 3;
|
|
95
|
-
return application.
|
|
95
|
+
return application._afterAdd(application);
|
|
96
96
|
case 3:
|
|
97
97
|
case "end":
|
|
98
98
|
return _context4.stop();
|
|
@@ -119,7 +119,7 @@ export var ApplicationManager = /*#__PURE__*/function () {
|
|
|
119
119
|
key: "load",
|
|
120
120
|
value: function () {
|
|
121
121
|
var _load = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
122
|
-
var _iterator, _step,
|
|
122
|
+
var _iterator, _step, application, _iterator2, _step2, _application;
|
|
123
123
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
124
124
|
while (1) switch (_context5.prev = _context5.next) {
|
|
125
125
|
case 0:
|
|
@@ -131,9 +131,9 @@ export var ApplicationManager = /*#__PURE__*/function () {
|
|
|
131
131
|
_context5.next = 9;
|
|
132
132
|
break;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
application = _step.value;
|
|
135
135
|
_context5.next = 7;
|
|
136
|
-
return
|
|
136
|
+
return application._beforeLoad();
|
|
137
137
|
case 7:
|
|
138
138
|
_context5.next = 3;
|
|
139
139
|
break;
|
|
@@ -157,9 +157,9 @@ export var ApplicationManager = /*#__PURE__*/function () {
|
|
|
157
157
|
_context5.next = 26;
|
|
158
158
|
break;
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
_application = _step2.value;
|
|
161
161
|
_context5.next = 24;
|
|
162
|
-
return
|
|
162
|
+
return _application._load();
|
|
163
163
|
case 24:
|
|
164
164
|
_context5.next = 20;
|
|
165
165
|
break;
|
|
@@ -185,6 +185,21 @@ export var ApplicationManager = /*#__PURE__*/function () {
|
|
|
185
185
|
}
|
|
186
186
|
return load;
|
|
187
187
|
}()
|
|
188
|
+
/**
|
|
189
|
+
* 循环所有的应用, 找出所有的components进行渲染
|
|
190
|
+
* @returns
|
|
191
|
+
*/
|
|
192
|
+
}, {
|
|
193
|
+
key: "getAllComponents",
|
|
194
|
+
value: function getAllComponents() {
|
|
195
|
+
return Array.from(this.applications.values()).flatMap(function (application) {
|
|
196
|
+
return Array.from(application.components.values());
|
|
197
|
+
}).filter(function (component) {
|
|
198
|
+
return component.autoRender;
|
|
199
|
+
}).map(function (component) {
|
|
200
|
+
return component.Component;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
188
203
|
}]);
|
|
189
204
|
return ApplicationManager;
|
|
190
205
|
}();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { S3ClientConfig, PutObjectCommandInput } from '@aws-sdk/client-s3';
|
|
2
|
+
import App from '../app';
|
|
3
|
+
export interface AWSOptions extends S3ClientConfig {
|
|
4
|
+
s3Config: S3ClientConfig;
|
|
5
|
+
bucketName?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UploadParams extends PutObjectCommandInput {
|
|
8
|
+
}
|
|
9
|
+
declare class AWS {
|
|
10
|
+
private s3Client?;
|
|
11
|
+
private app;
|
|
12
|
+
private config?;
|
|
13
|
+
constructor(app: App, options?: AWSOptions);
|
|
14
|
+
upload(params: UploadParams): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput | undefined>;
|
|
15
|
+
}
|
|
16
|
+
export default AWS;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import App from "../app";
|
|
2
|
+
import { CMDCoreEnum } from "./const";
|
|
3
|
+
export interface CMDOptions {
|
|
4
|
+
socketUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
declare class CMD {
|
|
7
|
+
private app;
|
|
8
|
+
private options?;
|
|
9
|
+
constructor(app: App, options?: CMDOptions);
|
|
10
|
+
init(): void;
|
|
11
|
+
}
|
|
12
|
+
export { CMDCoreEnum };
|
|
13
|
+
export default CMD;
|
package/es/cmd/type.d.ts
ADDED
package/es/config.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function setCookie(name: string, value: string, domain?: string): void;
|
|
2
|
+
declare function getCookie(name: string): string | null;
|
|
3
|
+
declare function deleteCookie(name: string, domain?: string): void;
|
|
4
|
+
declare function checkCookie(name: string): boolean;
|
|
5
|
+
declare function updateCookie(name: string, value: string, domain?: string): void;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
setCookie: typeof setCookie;
|
|
8
|
+
getCookie: typeof getCookie;
|
|
9
|
+
deleteCookie: typeof deleteCookie;
|
|
10
|
+
checkCookie: typeof checkCookie;
|
|
11
|
+
updateCookie: typeof updateCookie;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { HistoryConfig } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* @title: 默认配置
|
|
4
|
+
* @description:
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: zhiwei.Wang
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultConfig: HistoryConfig;
|
|
9
|
+
/**
|
|
10
|
+
* @title: 设置配置
|
|
11
|
+
* @description:
|
|
12
|
+
* @param {Partial} newConfig
|
|
13
|
+
* @return {*}
|
|
14
|
+
* @Author: zhiwei.Wang
|
|
15
|
+
*/
|
|
16
|
+
export declare const setConfig: (newConfig: Partial<HistoryConfig>) => HistoryConfig;
|
|
17
|
+
/**
|
|
18
|
+
* @title: 获取配置
|
|
19
|
+
* @description:
|
|
20
|
+
* @param {*} HistoryConfig
|
|
21
|
+
* @return {*}
|
|
22
|
+
* @Author: zhiwei.Wang
|
|
23
|
+
*/
|
|
24
|
+
export declare const getConfig: () => HistoryConfig;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { History as HistoryType } from "history";
|
|
2
|
+
import { useHistory, useLocation, useParams } from "react-router-dom";
|
|
3
|
+
import App from "../app";
|
|
4
|
+
export interface HistoryOptions {
|
|
5
|
+
basename?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class History {
|
|
8
|
+
instance: HistoryType<unknown>;
|
|
9
|
+
useHistory: typeof useHistory;
|
|
10
|
+
useLocation: typeof useLocation;
|
|
11
|
+
useParams: typeof useParams;
|
|
12
|
+
app: App;
|
|
13
|
+
constructor(app: App, options?: HistoryOptions);
|
|
14
|
+
push: HistoryType["push"];
|
|
15
|
+
replace: HistoryType["replace"];
|
|
16
|
+
reload: () => void;
|
|
17
|
+
reloadTo: (path: string) => void;
|
|
18
|
+
externalPage: (path: string) => void;
|
|
19
|
+
goLogin: () => any;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import useLowCode from './useLowCode';
|
|
2
|
+
import useDelayedValue from './useDelayedValue';
|
|
3
|
+
import useStore from './useStore';
|
|
4
|
+
import useDispatch from './useDispatch';
|
|
5
|
+
export interface HooksExport {
|
|
6
|
+
useLowCode: typeof useLowCode;
|
|
7
|
+
useDelayedValue: typeof useDelayedValue;
|
|
8
|
+
useStore: typeof useStore;
|
|
9
|
+
useDispatch: typeof useDispatch;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: HooksExport;
|
|
12
|
+
export default _default;
|