@pisell/core 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/app/app.d.ts +7 -7
- package/es/app/index.d.ts +1 -1
- package/es/applicationManager/application.d.ts +2 -2
- package/es/hooks/useStore/index.d.ts +1 -1
- package/es/locales/index.d.ts +13 -13
- package/es/locales/index.js +50 -68
- package/es/locales/type.d.ts +3 -3
- package/es/logger/index.d.ts +1 -1
- package/es/models/index.d.ts +4 -4
- package/es/pubsub/index.d.ts +1 -1
- package/es/request/cache.d.ts +1 -1
- package/es/request/pisell2Request.d.ts +1 -1
- package/es/routes/index.d.ts +2 -2
- package/es/routes/index.js +4 -1
- package/es/socket/types.d.ts +1 -1
- package/es/tasks/index.js +7 -6
- package/es/tasks/type.d.ts +4 -4
- package/es/variables/index.d.ts +3 -3
- package/lib/app/app.d.ts +7 -7
- package/lib/app/app.js +45 -21
- package/lib/app/index.d.ts +1 -1
- package/lib/applicationManager/application.d.ts +2 -2
- package/lib/applicationManager/application.js +9 -6
- package/lib/applicationManager/index.js +1 -1
- package/lib/cookie/index.js +2 -4
- package/lib/data/index.js +3 -0
- package/lib/history/index.js +24 -22
- package/lib/hooks/useStore/index.d.ts +1 -1
- package/lib/indexDB/index.js +16 -11
- package/lib/locales/index.d.ts +13 -13
- package/lib/locales/index.js +56 -55
- package/lib/locales/type.d.ts +3 -3
- package/lib/logger/index.d.ts +1 -1
- package/lib/logger/index.js +17 -7
- package/lib/menuManager/index.js +9 -12
- package/lib/models/index.d.ts +4 -4
- package/lib/pubsub/index.d.ts +1 -1
- package/lib/pubsub/index.js +1 -3
- package/lib/request/cache.d.ts +1 -1
- package/lib/request/pisell2Request.d.ts +1 -1
- package/lib/routes/index.d.ts +2 -2
- package/lib/routes/index.js +4 -1
- package/lib/socket/components/SocketMonitorPage.js +6 -12
- package/lib/socket/heartbeat.js +10 -5
- package/lib/socket/index.js +1 -3
- package/lib/socket/monitor.js +26 -24
- package/lib/socket/reconnect.js +10 -3
- package/lib/socket/socket.js +12 -10
- package/lib/socket/types.d.ts +1 -1
- package/lib/storage/index.js +25 -24
- package/lib/tasks/index.js +163 -157
- package/lib/tasks/type.d.ts +4 -4
- package/lib/variables/index.d.ts +3 -3
- package/package.json +2 -2
package/es/app/app.d.ts
CHANGED
|
@@ -37,13 +37,13 @@ declare class App {
|
|
|
37
37
|
setConfig: (models: any[]) => void;
|
|
38
38
|
};
|
|
39
39
|
request: {
|
|
40
|
-
get: (url: string, data: any, config: import("
|
|
41
|
-
post: (url: string, data: any, config: import("
|
|
42
|
-
put: (url: string, data: any, config: import("
|
|
43
|
-
remove: (url: string, data: any, config: import("
|
|
44
|
-
custom: (url: string, config: import("
|
|
45
|
-
setConfig: (newConfig: Partial<import("
|
|
46
|
-
getConfig: () => import("
|
|
40
|
+
get: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
41
|
+
post: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
42
|
+
put: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
43
|
+
remove: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
44
|
+
custom: (url: string, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
45
|
+
setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
|
|
46
|
+
getConfig: () => import("../request").RequestConfig;
|
|
47
47
|
};
|
|
48
48
|
storage: Storage;
|
|
49
49
|
menuManager: MenuManager;
|
package/es/app/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import App from "../app";
|
|
2
2
|
import { LoadLibraryByUrlParams } from "../locales/type";
|
|
3
3
|
import { MenuItem } from "../menuManager/index";
|
|
4
|
-
export type ApplicationInterface = {
|
|
4
|
+
export declare type ApplicationInterface = {
|
|
5
5
|
page_type: "low_code" | "code";
|
|
6
6
|
page_id: number | string;
|
|
7
7
|
page_code: string;
|
|
@@ -14,7 +14,7 @@ export type ApplicationInterface = {
|
|
|
14
14
|
layout?: string;
|
|
15
15
|
originalUrl?: string;
|
|
16
16
|
};
|
|
17
|
-
export type ApplicationData = {
|
|
17
|
+
export declare type ApplicationData = {
|
|
18
18
|
app_id: number;
|
|
19
19
|
app_name: string;
|
|
20
20
|
app_type: "system" | "custom";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModelsState } from "../../models";
|
|
2
2
|
declare const useStore: <T extends "global", D extends keyof ModelsState[T]>(props: {
|
|
3
3
|
models: T;
|
|
4
|
-
key?: D;
|
|
4
|
+
key?: D | undefined;
|
|
5
5
|
}) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
|
|
6
6
|
export default useStore;
|
package/es/locales/index.d.ts
CHANGED
|
@@ -13,27 +13,27 @@ export declare class Locales {
|
|
|
13
13
|
[key in Locale]: LibraryItem;
|
|
14
14
|
};
|
|
15
15
|
constructor(app: App, options?: LocalesOptions);
|
|
16
|
-
getLocale()
|
|
17
|
-
getCurrentTexts(locale?: Locale)
|
|
16
|
+
getLocale: () => string;
|
|
17
|
+
getCurrentTexts: (locale?: Locale) => {
|
|
18
18
|
[key: string]: string;
|
|
19
19
|
};
|
|
20
|
-
setLocale(locale: Locale, reload?: boolean)
|
|
21
|
-
getText(id: string, locale?: Locale)
|
|
22
|
-
isCN()
|
|
20
|
+
setLocale: (locale: Locale, reload?: boolean) => void;
|
|
21
|
+
getText: (id: string, locale?: Locale) => string;
|
|
22
|
+
isCN: () => boolean;
|
|
23
23
|
loadLibraryByUrl: (urls: LoadLibraryByUrlParams) => Promise<{
|
|
24
24
|
[x: string]: LibraryItem;
|
|
25
25
|
}>;
|
|
26
26
|
loadLibraryByItems(libraryList: LibraryItem[]): void;
|
|
27
|
-
loadLibrary(urls: LoadLibraryByUrlParams)
|
|
27
|
+
loadLibrary: (urls: LoadLibraryByUrlParams) => Promise<{
|
|
28
28
|
[x: string]: LibraryItem;
|
|
29
29
|
}>;
|
|
30
|
-
translation(text: string | {
|
|
31
|
-
[key:
|
|
32
|
-
}, locale?: Locale)
|
|
33
|
-
getLibraryByData(data: LibraryItem[])
|
|
34
|
-
createTextsByLibrary(id: string, library?: {
|
|
35
|
-
[
|
|
36
|
-
})
|
|
30
|
+
translation: (text: string | {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
}, locale?: Locale) => string | number;
|
|
33
|
+
getLibraryByData: (data: LibraryItem[]) => LibraryItem;
|
|
34
|
+
createTextsByLibrary: (id: string, library?: {
|
|
35
|
+
[x: string]: LibraryItem;
|
|
36
|
+
} | undefined) => {
|
|
37
37
|
[x: string]: string;
|
|
38
38
|
};
|
|
39
39
|
}
|
package/es/locales/index.js
CHANGED
|
@@ -32,6 +32,28 @@ export var Locales = /*#__PURE__*/function () {
|
|
|
32
32
|
pre[cur.locale] = cur;
|
|
33
33
|
return pre;
|
|
34
34
|
}, {}));
|
|
35
|
+
_defineProperty(this, "getLocale", function () {
|
|
36
|
+
return _this.locale;
|
|
37
|
+
});
|
|
38
|
+
_defineProperty(this, "getCurrentTexts", function (locale) {
|
|
39
|
+
return _this.library[locale || _this.locale].translations;
|
|
40
|
+
});
|
|
41
|
+
_defineProperty(this, "setLocale", function (locale) {
|
|
42
|
+
var reload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
43
|
+
_this.locale = locale;
|
|
44
|
+
if (reload) {
|
|
45
|
+
window.location.reload();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
_defineProperty(this, "getText", function (id, locale) {
|
|
50
|
+
var _this$getCurrentTexts;
|
|
51
|
+
return ((_this$getCurrentTexts = _this.getCurrentTexts(locale)) === null || _this$getCurrentTexts === void 0 ? void 0 : _this$getCurrentTexts[id]) || id;
|
|
52
|
+
});
|
|
53
|
+
_defineProperty(this, "isCN", function () {
|
|
54
|
+
var locale = _this.getLocale();
|
|
55
|
+
return locale === "zh-CN" || locale === "zh-HK";
|
|
56
|
+
});
|
|
35
57
|
_defineProperty(this, "loadLibraryByUrl", /*#__PURE__*/function () {
|
|
36
58
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(urls) {
|
|
37
59
|
var fetchList, res, library, _iterator, _step, item, _item;
|
|
@@ -121,87 +143,29 @@ export var Locales = /*#__PURE__*/function () {
|
|
|
121
143
|
return _ref.apply(this, arguments);
|
|
122
144
|
};
|
|
123
145
|
}());
|
|
124
|
-
this
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return pre;
|
|
129
|
-
}, {});
|
|
130
|
-
}
|
|
131
|
-
_createClass(Locales, [{
|
|
132
|
-
key: "getLocale",
|
|
133
|
-
value: function getLocale() {
|
|
134
|
-
return this.locale;
|
|
135
|
-
}
|
|
136
|
-
}, {
|
|
137
|
-
key: "getCurrentTexts",
|
|
138
|
-
value: function getCurrentTexts(locale) {
|
|
139
|
-
return this.library[locale || this.locale].translations;
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
key: "setLocale",
|
|
143
|
-
value: function setLocale(locale) {
|
|
144
|
-
var reload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
145
|
-
this.locale = locale;
|
|
146
|
-
if (reload) {
|
|
147
|
-
window.location.reload();
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}, {
|
|
152
|
-
key: "getText",
|
|
153
|
-
value: function getText(id, locale) {
|
|
154
|
-
var _this$getCurrentTexts;
|
|
155
|
-
return ((_this$getCurrentTexts = this.getCurrentTexts(locale)) === null || _this$getCurrentTexts === void 0 ? void 0 : _this$getCurrentTexts[id]) || id;
|
|
156
|
-
}
|
|
157
|
-
}, {
|
|
158
|
-
key: "isCN",
|
|
159
|
-
value: function isCN() {
|
|
160
|
-
var locale = this.getLocale();
|
|
161
|
-
return locale === "zh-CN" || locale === "zh-HK";
|
|
162
|
-
}
|
|
163
|
-
}, {
|
|
164
|
-
key: "loadLibraryByItems",
|
|
165
|
-
value: function loadLibraryByItems(libraryList) {
|
|
166
|
-
var library = _objectSpread({}, this.library);
|
|
167
|
-
libraryList.forEach(function (item) {
|
|
168
|
-
library = _objectSpread(_objectSpread({}, library), {}, _defineProperty({}, item.locale, _.mergeWith(library[item.locale] || {}, item)));
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
// 设置
|
|
172
|
-
this.library = library;
|
|
173
|
-
}
|
|
174
|
-
}, {
|
|
175
|
-
key: "loadLibrary",
|
|
176
|
-
value: function loadLibrary(urls) {
|
|
177
|
-
return this.loadLibraryByUrl(urls);
|
|
178
|
-
}
|
|
179
|
-
}, {
|
|
180
|
-
key: "translation",
|
|
181
|
-
value: function translation(text, locale) {
|
|
146
|
+
_defineProperty(this, "loadLibrary", function (urls) {
|
|
147
|
+
return _this.loadLibraryByUrl(urls);
|
|
148
|
+
});
|
|
149
|
+
_defineProperty(this, "translation", function (text, locale) {
|
|
182
150
|
if (!text) {
|
|
183
151
|
return "";
|
|
184
152
|
}
|
|
185
153
|
if (isString(text) || isNumber(text)) {
|
|
186
154
|
return text;
|
|
187
155
|
}
|
|
188
|
-
var primary = locale ||
|
|
156
|
+
var primary = locale || _this.getLocale();
|
|
189
157
|
if (typeof text === 'string') {
|
|
190
158
|
return text;
|
|
191
159
|
}
|
|
192
160
|
return text[primary] || text["original"] || text["en"] || text["zh-CN"] || text["zh-HK"];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
key: "getLibraryByData",
|
|
196
|
-
value: function getLibraryByData(data) {
|
|
161
|
+
});
|
|
162
|
+
_defineProperty(this, "getLibraryByData", function (data) {
|
|
197
163
|
return data.reduce(function (pre, next) {
|
|
198
164
|
return _objectSpread(_objectSpread({}, pre), {}, _defineProperty({}, next.locale, next));
|
|
199
165
|
}, {});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
value: function createTextsByLibrary(id, library) {
|
|
204
|
-
var _library = library || this.library;
|
|
166
|
+
});
|
|
167
|
+
_defineProperty(this, "createTextsByLibrary", function (id, library) {
|
|
168
|
+
var _library = library || _this.library;
|
|
205
169
|
return Object.keys(_library).reduce(function (pre, next) {
|
|
206
170
|
var _library$next$transla;
|
|
207
171
|
var _pre = _objectSpread({}, pre);
|
|
@@ -211,6 +175,24 @@ export var Locales = /*#__PURE__*/function () {
|
|
|
211
175
|
}
|
|
212
176
|
return _pre;
|
|
213
177
|
}, {});
|
|
178
|
+
});
|
|
179
|
+
this.app = app;
|
|
180
|
+
this.locale = (options === null || options === void 0 ? void 0 : options.locale) || this.app.storage.getStorage('locale') || en.locale;
|
|
181
|
+
this.library = (options === null || options === void 0 ? void 0 : options.library) || [original, en, zhCN, zhHK].reduce(function (pre, cur) {
|
|
182
|
+
pre[cur.locale] = cur;
|
|
183
|
+
return pre;
|
|
184
|
+
}, {});
|
|
185
|
+
}
|
|
186
|
+
_createClass(Locales, [{
|
|
187
|
+
key: "loadLibraryByItems",
|
|
188
|
+
value: function loadLibraryByItems(libraryList) {
|
|
189
|
+
var library = _objectSpread({}, this.library);
|
|
190
|
+
libraryList.forEach(function (item) {
|
|
191
|
+
library = _objectSpread(_objectSpread({}, library), {}, _defineProperty({}, item.locale, _.mergeWith(library[item.locale] || {}, item)));
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// 设置
|
|
195
|
+
this.library = library;
|
|
214
196
|
}
|
|
215
197
|
}]);
|
|
216
198
|
return Locales;
|
package/es/locales/type.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type Locale = 'original' | 'en' | 'zh-CN' | 'zh-HK' | string;
|
|
2
|
-
export type MultiLanguage = {
|
|
1
|
+
export declare type Locale = 'original' | 'en' | 'zh-CN' | 'zh-HK' | string;
|
|
2
|
+
export declare type MultiLanguage = {
|
|
3
3
|
[key in Locale]: string;
|
|
4
4
|
};
|
|
5
5
|
export interface LibraryItem {
|
|
@@ -16,4 +16,4 @@ export interface LocaleConfig {
|
|
|
16
16
|
[key in Locale]: LibraryItem;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
export type LoadLibraryByUrlParams = (string | Promise<LibraryItem> | (() => Promise<LibraryItem>) | LibraryItem)[];
|
|
19
|
+
export declare type LoadLibraryByUrlParams = (string | Promise<LibraryItem> | (() => Promise<LibraryItem>) | LibraryItem)[];
|
package/es/logger/index.d.ts
CHANGED
package/es/models/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import hooks from '../hooks';
|
|
2
2
|
import { Provider as StoreProvider } from "react-redux";
|
|
3
3
|
declare const models: import("./global").GlobalModal[];
|
|
4
|
-
type ModalsType = (typeof models[number]);
|
|
4
|
+
declare type ModalsType = (typeof models[number]);
|
|
5
5
|
export interface Store {
|
|
6
6
|
getDataByModel: typeof getDataByModel;
|
|
7
7
|
useStore: typeof hooks.useStore;
|
|
@@ -10,8 +10,8 @@ export interface Store {
|
|
|
10
10
|
dispatch: any;
|
|
11
11
|
getState: any;
|
|
12
12
|
}
|
|
13
|
-
export type ModelsNames = ModalsType['namespace'];
|
|
14
|
-
export type ModelsState = {
|
|
13
|
+
export declare type ModelsNames = ModalsType['namespace'];
|
|
14
|
+
export declare type ModelsState = {
|
|
15
15
|
[K in (ModalsType['namespace'])]: Extract<ModalsType, {
|
|
16
16
|
namespace: K;
|
|
17
17
|
}>['state'];
|
|
@@ -25,7 +25,7 @@ export type ModelsState = {
|
|
|
25
25
|
* @Author: zhiwei.Wang
|
|
26
26
|
* @Date: 2024-09-03 11:07
|
|
27
27
|
*/
|
|
28
|
-
declare const getDataByModel: <T extends "global", D extends keyof ModelsState[T]>(model: string, key?: D) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
|
|
28
|
+
declare const getDataByModel: <T extends "global", D extends keyof ModelsState[T]>(model: string, key?: D | undefined) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
|
|
29
29
|
/**
|
|
30
30
|
* @title: 设置数据到store
|
|
31
31
|
* @description:
|
package/es/pubsub/index.d.ts
CHANGED
package/es/request/cache.d.ts
CHANGED
package/es/routes/index.d.ts
CHANGED
|
@@ -20,9 +20,9 @@ export declare class RouterManager {
|
|
|
20
20
|
get(name: string): RouteType;
|
|
21
21
|
has(name: string): boolean;
|
|
22
22
|
remove(name: string): void;
|
|
23
|
-
renderComponent(item: RouteType, children?: React.ReactNode): string | number | boolean |
|
|
23
|
+
renderComponent(item: RouteType, children?: React.ReactNode): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
|
|
24
24
|
getPageByRoute(route: string): ApplicationInterface | undefined;
|
|
25
25
|
getRouterComponent({ fallback }: {
|
|
26
26
|
fallback?: React.ReactNode;
|
|
27
|
-
}):
|
|
27
|
+
}): JSX.Element[];
|
|
28
28
|
}
|
package/es/routes/index.js
CHANGED
|
@@ -121,7 +121,10 @@ export var RouterManager = /*#__PURE__*/function () {
|
|
|
121
121
|
firstRoute = path;
|
|
122
122
|
}
|
|
123
123
|
var component = this.renderComponent(item);
|
|
124
|
-
routes.push(
|
|
124
|
+
routes.push(
|
|
125
|
+
/*#__PURE__*/
|
|
126
|
+
//@ts-ignore
|
|
127
|
+
React.createElement(Route, {
|
|
125
128
|
path: path,
|
|
126
129
|
key: path,
|
|
127
130
|
exact: true
|
package/es/socket/types.d.ts
CHANGED
package/es/tasks/index.js
CHANGED
|
@@ -287,9 +287,10 @@ export var TasksManager = /*#__PURE__*/function () {
|
|
|
287
287
|
}, payload);
|
|
288
288
|
});
|
|
289
289
|
_defineProperty(this, "getTaskQueue", function (payload) {
|
|
290
|
+
var _this$tasks$module;
|
|
290
291
|
var queueId = payload.queueId,
|
|
291
292
|
module = payload.module;
|
|
292
|
-
return _this.tasks[module][queueId].tasks;
|
|
293
|
+
return (_this$tasks$module = _this.tasks[module]) === null || _this$tasks$module === void 0 || (_this$tasks$module = _this$tasks$module[queueId]) === null || _this$tasks$module === void 0 ? void 0 : _this$tasks$module.tasks;
|
|
293
294
|
});
|
|
294
295
|
_defineProperty(this, "timeout", function (ms) {
|
|
295
296
|
return new Promise(function (resolve) {
|
|
@@ -594,7 +595,7 @@ export var TasksManager = /*#__PURE__*/function () {
|
|
|
594
595
|
}, {
|
|
595
596
|
key: "addTask",
|
|
596
597
|
value: function addTask(payload) {
|
|
597
|
-
var _this$tasks$
|
|
598
|
+
var _this$tasks$module2,
|
|
598
599
|
_tasks$map,
|
|
599
600
|
_this3 = this;
|
|
600
601
|
var queueId = payload.queueId,
|
|
@@ -602,7 +603,7 @@ export var TasksManager = /*#__PURE__*/function () {
|
|
|
602
603
|
tasks = payload.tasks;
|
|
603
604
|
|
|
604
605
|
//@ts-ignore 当前任务队列
|
|
605
|
-
var taskQueue = (_this$tasks$
|
|
606
|
+
var taskQueue = (_this$tasks$module2 = this.tasks[module]) === null || _this$tasks$module2 === void 0 || (_this$tasks$module2 = _this$tasks$module2[queueId]) === null || _this$tasks$module2 === void 0 ? void 0 : _this$tasks$module2.tasks;
|
|
606
607
|
var _tasks = _toConsumableArray(taskQueue || []);
|
|
607
608
|
|
|
608
609
|
// 创建新任务
|
|
@@ -627,13 +628,13 @@ export var TasksManager = /*#__PURE__*/function () {
|
|
|
627
628
|
}, {
|
|
628
629
|
key: "updateTask",
|
|
629
630
|
value: function updateTask(payload) {
|
|
630
|
-
var _this$tasks$
|
|
631
|
+
var _this$tasks$module3, _this$tasks$module4;
|
|
631
632
|
var queueId = payload.queueId,
|
|
632
633
|
taskId = payload.taskId,
|
|
633
634
|
other = payload.other,
|
|
634
635
|
module = payload.module;
|
|
635
636
|
var newTask = null;
|
|
636
|
-
var taskQueue = ((_this$tasks$
|
|
637
|
+
var taskQueue = ((_this$tasks$module3 = this.tasks[module]) === null || _this$tasks$module3 === void 0 || (_this$tasks$module3 = _this$tasks$module3[queueId]) === null || _this$tasks$module3 === void 0 ? void 0 : _this$tasks$module3.tasks) || [];
|
|
637
638
|
var updatedTasks = taskQueue.map(function (task) {
|
|
638
639
|
if (task.id === taskId) {
|
|
639
640
|
newTask = _objectSpread(_objectSpread({}, task), other); // 更新任务状态
|
|
@@ -641,7 +642,7 @@ export var TasksManager = /*#__PURE__*/function () {
|
|
|
641
642
|
}
|
|
642
643
|
return task;
|
|
643
644
|
});
|
|
644
|
-
var newState = _objectSpread(_objectSpread({}, this.tasks), {}, _defineProperty({}, module, _objectSpread(_objectSpread({}, this.tasks[module]), {}, _defineProperty({}, queueId, _objectSpread(_objectSpread({}, (_this$tasks$
|
|
645
|
+
var newState = _objectSpread(_objectSpread({}, this.tasks), {}, _defineProperty({}, module, _objectSpread(_objectSpread({}, this.tasks[module]), {}, _defineProperty({}, queueId, _objectSpread(_objectSpread({}, (_this$tasks$module4 = this.tasks[module]) === null || _this$tasks$module4 === void 0 ? void 0 : _this$tasks$module4[queueId]), {}, {
|
|
645
646
|
status: updatedTasks.some(function (task) {
|
|
646
647
|
return task.status === "failure";
|
|
647
648
|
}) ? "uncompleted" : "completed",
|
package/es/tasks/type.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TaskRunStatus = "pending" | "in-progress" | "success" | "failure";
|
|
1
|
+
export declare type TaskRunStatus = "pending" | "in-progress" | "success" | "failure";
|
|
2
2
|
export interface Task {
|
|
3
3
|
id?: string;
|
|
4
4
|
type?: "local" | "cloud";
|
|
@@ -25,9 +25,9 @@ export interface Task {
|
|
|
25
25
|
export interface TaskConfig {
|
|
26
26
|
tasks: Task[];
|
|
27
27
|
}
|
|
28
|
-
type TaskModuleName = string;
|
|
29
|
-
type TaskQueueName = string;
|
|
30
|
-
type TaskStatus = "uncompleted" | "completed";
|
|
28
|
+
declare type TaskModuleName = string;
|
|
29
|
+
declare type TaskQueueName = string;
|
|
30
|
+
declare type TaskStatus = "uncompleted" | "completed";
|
|
31
31
|
export interface TaskQueue {
|
|
32
32
|
status: TaskStatus;
|
|
33
33
|
tasks: Task[];
|
package/es/variables/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type VariableMap = Record<string, string>;
|
|
1
|
+
export declare type VariableMap = Record<string, string>;
|
|
2
2
|
declare const _default: {
|
|
3
|
-
setConfig: (newConfig: Partial<import("
|
|
4
|
-
getConfig: () => import("
|
|
3
|
+
setConfig: (newConfig: Partial<import("./type").VariablesConfig>) => void;
|
|
4
|
+
getConfig: () => import("./type").VariablesConfig;
|
|
5
5
|
};
|
|
6
6
|
export default _default;
|
package/lib/app/app.d.ts
CHANGED
|
@@ -37,13 +37,13 @@ declare class App {
|
|
|
37
37
|
setConfig: (models: any[]) => void;
|
|
38
38
|
};
|
|
39
39
|
request: {
|
|
40
|
-
get: (url: string, data: any, config: import("
|
|
41
|
-
post: (url: string, data: any, config: import("
|
|
42
|
-
put: (url: string, data: any, config: import("
|
|
43
|
-
remove: (url: string, data: any, config: import("
|
|
44
|
-
custom: (url: string, config: import("
|
|
45
|
-
setConfig: (newConfig: Partial<import("
|
|
46
|
-
getConfig: () => import("
|
|
40
|
+
get: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
41
|
+
post: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
42
|
+
put: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
43
|
+
remove: (url: string, data: any, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
44
|
+
custom: (url: string, config: import("../request").RequestSetting | undefined) => Promise<any>;
|
|
45
|
+
setConfig: (newConfig: Partial<import("../request").RequestConfig>) => void;
|
|
46
|
+
getConfig: () => import("../request").RequestConfig;
|
|
47
47
|
};
|
|
48
48
|
storage: Storage;
|
|
49
49
|
menuManager: MenuManager;
|
package/lib/app/app.js
CHANGED
|
@@ -49,24 +49,48 @@ var import_tasks = require("../tasks");
|
|
|
49
49
|
var import_indexDB = __toESM(require("../indexDB"));
|
|
50
50
|
var import_pubsub = __toESM(require("../pubsub"));
|
|
51
51
|
var import_const = require("./const");
|
|
52
|
-
var App = class {
|
|
52
|
+
var App = class _App {
|
|
53
|
+
// 实例
|
|
54
|
+
static instance;
|
|
55
|
+
// 插件管理
|
|
56
|
+
plugins;
|
|
57
|
+
// 全局数据
|
|
58
|
+
globalData;
|
|
59
|
+
// 路由管理
|
|
60
|
+
router;
|
|
61
|
+
// 应用管理
|
|
62
|
+
applicationManager;
|
|
63
|
+
// History
|
|
64
|
+
history;
|
|
65
|
+
// 数据存储
|
|
66
|
+
data;
|
|
67
|
+
// hooks
|
|
68
|
+
hooks = import_hooks.default;
|
|
69
|
+
// 多语言
|
|
70
|
+
locales;
|
|
71
|
+
// dva
|
|
72
|
+
models = import_models.default;
|
|
73
|
+
// 请求
|
|
74
|
+
request = import_request.default;
|
|
75
|
+
// 存储
|
|
76
|
+
storage;
|
|
77
|
+
// 菜单管理
|
|
78
|
+
menuManager;
|
|
79
|
+
// cookie
|
|
80
|
+
cookie = import_cookie.default;
|
|
81
|
+
// 网站信息
|
|
82
|
+
website = import_website.default;
|
|
83
|
+
// 日志
|
|
84
|
+
logger;
|
|
85
|
+
// 发布订阅
|
|
86
|
+
pubsub = import_pubsub.default;
|
|
87
|
+
// 任务管理
|
|
88
|
+
tasksManager;
|
|
89
|
+
dbManager = null;
|
|
90
|
+
constants = {
|
|
91
|
+
channel: ""
|
|
92
|
+
};
|
|
53
93
|
constructor(options) {
|
|
54
|
-
// hooks
|
|
55
|
-
this.hooks = import_hooks.default;
|
|
56
|
-
// dva
|
|
57
|
-
this.models = import_models.default;
|
|
58
|
-
// 请求
|
|
59
|
-
this.request = import_request.default;
|
|
60
|
-
// cookie
|
|
61
|
-
this.cookie = import_cookie.default;
|
|
62
|
-
// 网站信息
|
|
63
|
-
this.website = import_website.default;
|
|
64
|
-
// 发布订阅
|
|
65
|
-
this.pubsub = import_pubsub.default;
|
|
66
|
-
this.dbManager = null;
|
|
67
|
-
this.constants = {
|
|
68
|
-
channel: ""
|
|
69
|
-
};
|
|
70
94
|
this.plugins = /* @__PURE__ */ new Map();
|
|
71
95
|
this.globalData = {};
|
|
72
96
|
this.router = new import_routes.RouterManager({}, this);
|
|
@@ -87,11 +111,11 @@ var App = class {
|
|
|
87
111
|
}
|
|
88
112
|
// 单例模式
|
|
89
113
|
static getInstance(options) {
|
|
90
|
-
if (!
|
|
91
|
-
|
|
92
|
-
window.app =
|
|
114
|
+
if (!_App.instance) {
|
|
115
|
+
_App.instance = new _App(options);
|
|
116
|
+
window.app = _App.instance;
|
|
93
117
|
}
|
|
94
|
-
return
|
|
118
|
+
return _App.instance;
|
|
95
119
|
}
|
|
96
120
|
// 初始化配置
|
|
97
121
|
setGlobalData(globalData) {
|
package/lib/app/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import App from "../app";
|
|
2
2
|
import { LoadLibraryByUrlParams } from "../locales/type";
|
|
3
3
|
import { MenuItem } from "../menuManager/index";
|
|
4
|
-
export type ApplicationInterface = {
|
|
4
|
+
export declare type ApplicationInterface = {
|
|
5
5
|
page_type: "low_code" | "code";
|
|
6
6
|
page_id: number | string;
|
|
7
7
|
page_code: string;
|
|
@@ -14,7 +14,7 @@ export type ApplicationInterface = {
|
|
|
14
14
|
layout?: string;
|
|
15
15
|
originalUrl?: string;
|
|
16
16
|
};
|
|
17
|
-
export type ApplicationData = {
|
|
17
|
+
export declare type ApplicationData = {
|
|
18
18
|
app_id: number;
|
|
19
19
|
app_name: string;
|
|
20
20
|
app_type: "system" | "custom";
|
|
@@ -23,13 +23,16 @@ __export(application_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(application_exports);
|
|
25
25
|
var Application = class {
|
|
26
|
+
options;
|
|
27
|
+
name;
|
|
28
|
+
// 应用内的interface
|
|
29
|
+
interfaces = /* @__PURE__ */ new Map();
|
|
30
|
+
// 应用内的组件
|
|
31
|
+
components = /* @__PURE__ */ new Map();
|
|
32
|
+
// 应用内的函数, 比如跳转登录页面的方法
|
|
33
|
+
functions = /* @__PURE__ */ new Map();
|
|
34
|
+
app;
|
|
26
35
|
constructor(options, app) {
|
|
27
|
-
// 应用内的interface
|
|
28
|
-
this.interfaces = /* @__PURE__ */ new Map();
|
|
29
|
-
// 应用内的组件
|
|
30
|
-
this.components = /* @__PURE__ */ new Map();
|
|
31
|
-
// 应用内的函数, 比如跳转登录页面的方法
|
|
32
|
-
this.functions = /* @__PURE__ */ new Map();
|
|
33
36
|
this.options = options;
|
|
34
37
|
this.name = options.app_name;
|
|
35
38
|
this.app = app;
|
|
@@ -27,12 +27,12 @@ var ApplicationManager = class {
|
|
|
27
27
|
constructor(applicationList = [], app) {
|
|
28
28
|
this.applicationList = applicationList;
|
|
29
29
|
this.app = app;
|
|
30
|
-
this.applications = /* @__PURE__ */ new Map();
|
|
31
30
|
this.app = app;
|
|
32
31
|
if (applicationList == null ? void 0 : applicationList.length) {
|
|
33
32
|
this.init(applicationList);
|
|
34
33
|
}
|
|
35
34
|
}
|
|
35
|
+
applications = /* @__PURE__ */ new Map();
|
|
36
36
|
async init(applicationList) {
|
|
37
37
|
return new Promise(async (res, req) => {
|
|
38
38
|
applicationList.forEach(
|
package/lib/cookie/index.js
CHANGED
|
@@ -35,10 +35,8 @@ function getCookie(name) {
|
|
|
35
35
|
const ca = document.cookie.split(";");
|
|
36
36
|
for (let i = 0; i < ca.length; i++) {
|
|
37
37
|
let c = ca[i];
|
|
38
|
-
while (c.charAt(0) === " ")
|
|
39
|
-
|
|
40
|
-
if (c.indexOf(nameEQ) === 0)
|
|
41
|
-
return c.substring(nameEQ.length, c.length);
|
|
38
|
+
while (c.charAt(0) === " ") c = c.substring(1, c.length);
|
|
39
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
42
40
|
}
|
|
43
41
|
return null;
|
|
44
42
|
}
|