@pisell/core 1.0.6 → 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/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/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.js +95 -94
- 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 +3 -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/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/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
|
}
|
package/lib/data/index.js
CHANGED
package/lib/history/index.js
CHANGED
|
@@ -25,32 +25,34 @@ module.exports = __toCommonJS(history_exports);
|
|
|
25
25
|
var import_history = require("history");
|
|
26
26
|
var import_react_router_dom = require("react-router-dom");
|
|
27
27
|
var History = class {
|
|
28
|
+
instance;
|
|
29
|
+
useHistory = import_react_router_dom.useHistory;
|
|
30
|
+
useLocation = import_react_router_dom.useLocation;
|
|
31
|
+
useParams = import_react_router_dom.useParams;
|
|
32
|
+
app;
|
|
28
33
|
constructor(app, options) {
|
|
29
|
-
this.useHistory = import_react_router_dom.useHistory;
|
|
30
|
-
this.useLocation = import_react_router_dom.useLocation;
|
|
31
|
-
this.useParams = import_react_router_dom.useParams;
|
|
32
|
-
this.push = (path, state) => {
|
|
33
|
-
this.instance.push(path, state);
|
|
34
|
-
};
|
|
35
|
-
this.replace = (path, state) => {
|
|
36
|
-
this.instance.replace(path, state);
|
|
37
|
-
};
|
|
38
|
-
this.reload = () => {
|
|
39
|
-
window.location.reload();
|
|
40
|
-
};
|
|
41
|
-
this.reloadTo = (path) => {
|
|
42
|
-
window.location.href = path;
|
|
43
|
-
};
|
|
44
|
-
this.externalPage = (path) => {
|
|
45
|
-
window.open(path);
|
|
46
|
-
};
|
|
47
|
-
this.goLogin = () => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
return (_b = (_a = this.app.applicationManager.get("login")) == null ? void 0 : _a.runFunction) == null ? void 0 : _b.call(_a, "goLogin");
|
|
50
|
-
};
|
|
51
34
|
this.app = app;
|
|
52
35
|
this.instance = (0, import_history.createBrowserHistory)({ basename: (options == null ? void 0 : options.basename) || "/" });
|
|
53
36
|
}
|
|
37
|
+
push = (path, state) => {
|
|
38
|
+
this.instance.push(path, state);
|
|
39
|
+
};
|
|
40
|
+
replace = (path, state) => {
|
|
41
|
+
this.instance.replace(path, state);
|
|
42
|
+
};
|
|
43
|
+
reload = () => {
|
|
44
|
+
window.location.reload();
|
|
45
|
+
};
|
|
46
|
+
reloadTo = (path) => {
|
|
47
|
+
window.location.href = path;
|
|
48
|
+
};
|
|
49
|
+
externalPage = (path) => {
|
|
50
|
+
window.open(path);
|
|
51
|
+
};
|
|
52
|
+
goLogin = () => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
return (_b = (_a = this.app.applicationManager.get("login")) == null ? void 0 : _a.runFunction) == null ? void 0 : _b.call(_a, "goLogin");
|
|
55
|
+
};
|
|
54
56
|
};
|
|
55
57
|
// Annotate the CommonJS export names for ESM import in node:
|
|
56
58
|
0 && (module.exports = {
|
|
@@ -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/lib/indexDB/index.js
CHANGED
|
@@ -22,26 +22,31 @@ __export(indexDB_exports, {
|
|
|
22
22
|
default: () => indexDB_default
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(indexDB_exports);
|
|
25
|
-
var IndexDBManager = class {
|
|
25
|
+
var IndexDBManager = class _IndexDBManager {
|
|
26
|
+
/**
|
|
27
|
+
* 检查环境是否支持 IndexedDB
|
|
28
|
+
* @returns {boolean} 是否支持 IndexedDB
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
static isSupported() {
|
|
32
|
+
return window && "indexedDB" in window;
|
|
33
|
+
}
|
|
34
|
+
db = null;
|
|
35
|
+
dbName;
|
|
36
|
+
version;
|
|
37
|
+
stores;
|
|
38
|
+
useIndexDB;
|
|
39
|
+
app;
|
|
26
40
|
/**
|
|
27
41
|
* 创建 IndexDBManager 实例
|
|
28
42
|
* @param {DBOptions} options - 数据库配置选项
|
|
29
43
|
*/
|
|
30
44
|
constructor(app, options) {
|
|
31
|
-
this.db = null;
|
|
32
45
|
this.app = app;
|
|
33
46
|
this.dbName = options.dbName;
|
|
34
47
|
this.version = options.version;
|
|
35
48
|
this.stores = options.stores;
|
|
36
|
-
this.useIndexDB =
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* 检查环境是否支持 IndexedDB
|
|
40
|
-
* @returns {boolean} 是否支持 IndexedDB
|
|
41
|
-
* @private
|
|
42
|
-
*/
|
|
43
|
-
static isSupported() {
|
|
44
|
-
return window && "indexedDB" in window;
|
|
49
|
+
this.useIndexDB = _IndexDBManager.isSupported();
|
|
45
50
|
}
|
|
46
51
|
/**
|
|
47
52
|
* 初始化数据库连接
|