@pisell/core 1.0.0 → 1.0.1
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 +122 -0
- package/es/app/app.js +166 -0
- package/es/app/const.d.ts +4 -0
- package/es/app/const.js +6 -0
- package/es/app/index.d.ts +14 -0
- package/es/app/index.js +54 -0
- package/es/applicationManager/application.d.ts +50 -0
- package/es/applicationManager/application.js +226 -0
- package/es/applicationManager/index.d.ts +13 -0
- package/es/applicationManager/index.js +190 -0
- package/es/config.d.ts +3 -3
- package/es/cookie/index.d.ts +13 -0
- package/es/cookie/index.js +47 -0
- package/es/css/global.less +73 -0
- package/es/css/index.less +31 -0
- package/es/css/variables.css +84 -0
- package/es/data/index.d.ts +29 -0
- package/es/data/index.js +8 -0
- package/es/history/config.d.ts +24 -0
- package/es/history/config.js +43 -0
- package/es/history/index.d.ts +20 -0
- package/es/history/index.js +41 -0
- package/es/history/type.d.ts +2 -0
- package/es/hooks/index.d.ts +12 -0
- package/es/hooks/index.js +13 -0
- package/es/hooks/useDelayedValue/index.d.ts +2 -0
- package/es/hooks/useDelayedValue/index.js +26 -0
- package/es/hooks/useDispatch/index.d.ts +2 -0
- package/es/hooks/useDispatch/index.js +2 -0
- package/es/hooks/useLowCode/index.d.ts +13 -0
- package/es/hooks/useLowCode/index.js +74 -0
- package/es/hooks/useStore/index.d.ts +6 -0
- package/es/hooks/useStore/index.js +11 -0
- package/es/index.d.ts +7 -1
- package/es/index.js +8 -2
- package/es/indexDB/index.d.ts +176 -0
- package/es/indexDB/index.js +536 -0
- package/es/locales/config.js +10 -8
- package/es/locales/en.d.ts +2 -1
- package/es/locales/en.js +5 -1
- package/es/locales/index.d.ts +44 -1
- package/es/locales/index.js +192 -8
- package/es/locales/original.d.ts +3 -0
- package/es/locales/original.js +7 -0
- package/es/locales/type.d.ts +15 -5
- package/es/locales/zh-CN.d.ts +2 -1
- package/es/locales/zh-CN.js +5 -1
- package/es/locales/zh-HK.d.ts +2 -1
- package/es/locales/zh-HK.js +5 -1
- package/es/logger/feishu.d.ts +11 -0
- package/es/logger/feishu.js +50 -0
- package/es/logger/index.d.ts +122 -0
- package/es/logger/index.js +531 -0
- package/es/menuManager/hooks.d.ts +8 -0
- package/es/menuManager/hooks.js +138 -0
- package/es/menuManager/index.d.ts +28 -0
- package/es/menuManager/index.js +142 -0
- package/es/models/global.d.ts +32 -0
- package/es/models/global.js +65 -0
- package/es/models/index.d.ts +45 -0
- package/es/models/index.js +66 -0
- package/es/models/tasks.d.ts +31 -0
- package/es/models/tasks.js +331 -0
- package/es/models/tasksUtils.d.ts +65 -0
- package/es/models/tasksUtils.js +179 -0
- package/es/models/type.d.ts +2 -0
- package/es/models/type.js +1 -0
- package/es/plugin/index.d.ts +0 -0
- package/es/plugin/index.js +0 -0
- package/es/pubsub/example.d.ts +5 -0
- package/es/pubsub/example.js +92 -0
- package/es/pubsub/index.d.ts +63 -0
- package/es/pubsub/index.js +144 -0
- package/es/request/cache.d.ts +46 -0
- package/es/request/cache.js +310 -0
- package/es/request/cancelToken.d.ts +38 -0
- package/es/request/cancelToken.js +59 -0
- package/es/request/config.d.ts +3 -0
- package/es/request/config.js +58 -0
- package/es/request/constants.d.ts +2 -0
- package/es/request/constants.js +6 -0
- package/es/request/index.d.ts +24 -0
- package/es/request/index.js +175 -0
- package/es/request/pisell2Request.d.ts +6 -0
- package/es/request/pisell2Request.js +62 -0
- package/es/request/type.d.ts +40 -0
- package/es/request/type.js +1 -0
- package/es/request/utils.d.ts +46 -0
- package/es/request/utils.js +145 -0
- package/es/routes/config.d.ts +7 -0
- package/es/routes/config.js +17 -0
- package/es/routes/index.d.ts +28 -0
- package/es/routes/index.js +154 -0
- package/es/socket/components/SocketMonitorPage.d.ts +6 -0
- package/es/socket/components/SocketMonitorPage.js +692 -0
- package/es/socket/components/index.d.ts +2 -0
- package/es/socket/components/index.js +2 -0
- package/es/socket/constants.d.ts +33 -0
- package/es/socket/constants.js +39 -0
- package/es/socket/events.d.ts +31 -0
- package/es/socket/events.js +19 -0
- package/es/socket/heartbeat.d.ts +66 -0
- package/es/socket/heartbeat.js +185 -0
- package/es/socket/index.d.ts +61 -0
- package/es/socket/index.js +246 -0
- package/es/socket/monitor.d.ts +169 -0
- package/es/socket/monitor.js +438 -0
- package/es/socket/reconnect.d.ts +61 -0
- package/es/socket/reconnect.js +199 -0
- package/es/socket/socket.d.ts +129 -0
- package/es/socket/socket.js +597 -0
- package/es/socket/types.d.ts +84 -0
- package/es/socket/types.js +19 -0
- package/es/storage/config.d.ts +3 -0
- package/es/{date → storage}/config.js +1 -6
- package/es/storage/index.d.ts +42 -0
- package/es/storage/index.js +62 -0
- package/es/storage/type.d.ts +5 -0
- package/es/storage/type.js +1 -0
- package/es/tasks/index.d.ts +77 -0
- package/es/tasks/index.js +719 -0
- package/es/tasks/type.d.ts +62 -0
- package/es/tasks/type.js +1 -0
- package/es/tasks/useTasks.d.ts +4 -0
- package/es/tasks/useTasks.js +25 -0
- package/es/type.d.ts +1 -1
- package/es/variables/VariablesProvider.d.ts +7 -0
- package/es/variables/VariablesProvider.js +14 -0
- package/es/variables/config.d.ts +3 -0
- package/es/{date/index.js → variables/config.js} +8 -14
- package/es/variables/index.d.ts +6 -0
- package/es/variables/index.js +5 -0
- package/es/variables/type.d.ts +2 -0
- package/es/variables/type.js +1 -0
- package/es/website/index.d.ts +6 -0
- package/es/website/index.js +65 -0
- package/lib/app/app.d.ts +122 -0
- package/lib/app/app.js +128 -0
- package/lib/app/const.d.ts +4 -0
- package/lib/app/const.js +33 -0
- package/lib/app/index.d.ts +14 -0
- package/lib/app/index.js +76 -0
- package/lib/applicationManager/application.d.ts +50 -0
- package/lib/applicationManager/application.js +110 -0
- package/lib/applicationManager/index.d.ts +13 -0
- package/lib/applicationManager/index.js +76 -0
- package/lib/config.d.ts +3 -3
- package/lib/cookie/index.d.ts +13 -0
- package/lib/cookie/index.js +64 -0
- package/lib/css/global.less +73 -0
- package/lib/css/index.less +31 -0
- package/lib/css/variables.css +84 -0
- package/lib/data/index.d.ts +29 -0
- package/lib/{date → data}/index.js +19 -20
- package/lib/history/config.d.ts +24 -0
- package/lib/history/config.js +41 -0
- package/lib/history/index.d.ts +20 -0
- package/lib/history/index.js +58 -0
- package/lib/history/type.d.ts +2 -0
- package/lib/history/type.js +17 -0
- package/lib/hooks/index.d.ts +12 -0
- package/lib/hooks/index.js +44 -0
- package/lib/hooks/useDelayedValue/index.d.ts +2 -0
- package/lib/hooks/useDelayedValue/index.js +36 -0
- package/lib/hooks/useDispatch/index.d.ts +2 -0
- package/lib/hooks/useDispatch/index.js +26 -0
- package/lib/hooks/useLowCode/index.d.ts +13 -0
- package/lib/hooks/useLowCode/index.js +75 -0
- package/lib/hooks/useStore/index.d.ts +6 -0
- package/lib/hooks/useStore/index.js +33 -0
- package/lib/index.d.ts +7 -1
- package/lib/index.js +23 -5
- package/lib/indexDB/index.d.ts +176 -0
- package/lib/indexDB/index.js +287 -0
- package/lib/locales/config.js +10 -7
- package/lib/locales/en.d.ts +2 -1
- package/lib/locales/en.js +5 -1
- package/lib/locales/index.d.ts +44 -1
- package/lib/locales/index.js +106 -4
- package/lib/locales/original.d.ts +3 -0
- package/lib/locales/original.js +31 -0
- package/lib/locales/type.d.ts +15 -5
- package/lib/locales/zh-CN.d.ts +2 -1
- package/lib/locales/zh-CN.js +5 -1
- package/lib/locales/zh-HK.d.ts +2 -1
- package/lib/locales/zh-HK.js +5 -1
- package/lib/logger/feishu.d.ts +11 -0
- package/lib/logger/feishu.js +52 -0
- package/lib/logger/index.d.ts +122 -0
- package/lib/logger/index.js +288 -0
- package/lib/menuManager/hooks.d.ts +8 -0
- package/lib/menuManager/hooks.js +135 -0
- package/lib/menuManager/index.d.ts +28 -0
- package/lib/menuManager/index.js +110 -0
- package/lib/models/global.d.ts +32 -0
- package/lib/models/global.js +62 -0
- package/lib/models/index.d.ts +45 -0
- package/lib/models/index.js +70 -0
- package/lib/models/tasks.d.ts +31 -0
- package/lib/models/tasks.js +199 -0
- package/lib/models/tasksUtils.d.ts +65 -0
- package/lib/models/tasksUtils.js +160 -0
- package/lib/models/type.d.ts +2 -0
- package/lib/models/type.js +17 -0
- package/lib/plugin/index.d.ts +0 -0
- package/lib/plugin/index.js +0 -0
- package/lib/pubsub/example.d.ts +5 -0
- package/lib/pubsub/example.js +61 -0
- package/lib/pubsub/index.d.ts +63 -0
- package/lib/pubsub/index.js +129 -0
- package/lib/request/cache.d.ts +46 -0
- package/lib/request/cache.js +159 -0
- package/lib/request/cancelToken.d.ts +38 -0
- package/lib/request/cancelToken.js +59 -0
- package/lib/request/config.d.ts +3 -0
- package/lib/request/config.js +74 -0
- package/lib/request/constants.d.ts +2 -0
- package/lib/request/constants.js +34 -0
- package/lib/request/index.d.ts +24 -0
- package/lib/request/index.js +143 -0
- package/lib/request/pisell2Request.d.ts +6 -0
- package/lib/request/pisell2Request.js +75 -0
- package/lib/request/type.d.ts +40 -0
- package/lib/request/type.js +17 -0
- package/lib/request/utils.d.ts +46 -0
- package/lib/request/utils.js +111 -0
- package/lib/routes/config.d.ts +7 -0
- package/lib/routes/config.js +50 -0
- package/lib/routes/index.d.ts +28 -0
- package/lib/routes/index.js +118 -0
- package/lib/socket/components/SocketMonitorPage.d.ts +6 -0
- package/lib/socket/components/SocketMonitorPage.js +346 -0
- package/lib/socket/components/index.d.ts +2 -0
- package/lib/socket/components/index.js +39 -0
- package/lib/socket/constants.d.ts +33 -0
- package/lib/socket/constants.js +62 -0
- package/lib/socket/events.d.ts +31 -0
- package/lib/socket/events.js +44 -0
- package/lib/socket/heartbeat.d.ts +66 -0
- package/lib/socket/heartbeat.js +152 -0
- package/lib/socket/index.d.ts +61 -0
- package/lib/socket/index.js +200 -0
- package/lib/socket/monitor.d.ts +169 -0
- package/lib/socket/monitor.js +346 -0
- package/lib/socket/reconnect.d.ts +61 -0
- package/lib/socket/reconnect.js +153 -0
- package/lib/socket/socket.d.ts +129 -0
- package/lib/socket/socket.js +410 -0
- package/lib/socket/types.d.ts +84 -0
- package/lib/socket/types.js +36 -0
- package/lib/storage/config.d.ts +3 -0
- package/lib/{date → storage}/config.js +2 -7
- package/lib/storage/index.d.ts +42 -0
- package/lib/storage/index.js +66 -0
- package/lib/storage/type.d.ts +5 -0
- package/lib/storage/type.js +17 -0
- package/lib/tasks/index.d.ts +77 -0
- package/lib/tasks/index.js +438 -0
- package/lib/tasks/type.d.ts +62 -0
- package/lib/{date → tasks}/type.js +1 -1
- package/lib/tasks/useTasks.d.ts +4 -0
- package/lib/tasks/useTasks.js +37 -0
- package/lib/type.d.ts +1 -1
- package/lib/variables/VariablesProvider.d.ts +7 -0
- package/lib/variables/VariablesProvider.js +51 -0
- package/lib/variables/config.d.ts +3 -0
- package/lib/variables/config.js +38 -0
- package/lib/variables/index.d.ts +6 -0
- package/lib/variables/index.js +29 -0
- package/lib/variables/type.d.ts +2 -0
- package/lib/variables/type.js +17 -0
- package/lib/website/index.d.ts +6 -0
- package/lib/website/index.js +75 -0
- package/package.json +13 -3
- package/es/date/config.d.ts +0 -3
- package/es/date/index.d.ts +0 -7
- package/es/date/type.d.ts +0 -7
- package/lib/date/config.d.ts +0 -3
- package/lib/date/index.d.ts +0 -7
- package/lib/date/type.d.ts +0 -7
- /package/es/{date → history}/type.js +0 -0
|
@@ -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: any;
|
|
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,58 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/history/index.ts
|
|
20
|
+
var history_exports = {};
|
|
21
|
+
__export(history_exports, {
|
|
22
|
+
History: () => History
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(history_exports);
|
|
25
|
+
var import_history = require("history");
|
|
26
|
+
var import_react_router_dom = require("react-router-dom");
|
|
27
|
+
var History = class {
|
|
28
|
+
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
|
+
this.app = app;
|
|
52
|
+
this.instance = (0, import_history.createBrowserHistory)({ basename: (options == null ? void 0 : options.basename) || "/" });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {
|
|
57
|
+
History
|
|
58
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/history/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
|
@@ -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;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/hooks/index.ts
|
|
30
|
+
var hooks_exports = {};
|
|
31
|
+
__export(hooks_exports, {
|
|
32
|
+
default: () => hooks_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
35
|
+
var import_useLowCode = __toESM(require("./useLowCode"));
|
|
36
|
+
var import_useDelayedValue = __toESM(require("./useDelayedValue"));
|
|
37
|
+
var import_useStore = __toESM(require("./useStore"));
|
|
38
|
+
var import_useDispatch = __toESM(require("./useDispatch"));
|
|
39
|
+
var hooks_default = {
|
|
40
|
+
useLowCode: import_useLowCode.default,
|
|
41
|
+
useDelayedValue: import_useDelayedValue.default,
|
|
42
|
+
useStore: import_useStore.default,
|
|
43
|
+
useDispatch: import_useDispatch.default
|
|
44
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useDelayedValue/index.ts
|
|
20
|
+
var useDelayedValue_exports = {};
|
|
21
|
+
__export(useDelayedValue_exports, {
|
|
22
|
+
default: () => useDelayedValue_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useDelayedValue_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
function useDelayedValue(value, timeout = 200) {
|
|
27
|
+
const [delayedValue, setDelayedValue] = (0, import_react.useState)(value);
|
|
28
|
+
(0, import_react.useEffect)(() => {
|
|
29
|
+
const timer = setTimeout(() => {
|
|
30
|
+
setDelayedValue(value);
|
|
31
|
+
}, timeout);
|
|
32
|
+
return () => clearTimeout(timer);
|
|
33
|
+
}, [value, timeout]);
|
|
34
|
+
return delayedValue;
|
|
35
|
+
}
|
|
36
|
+
var useDelayedValue_default = useDelayedValue;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useDispatch/index.ts
|
|
20
|
+
var useDispatch_exports = {};
|
|
21
|
+
__export(useDispatch_exports, {
|
|
22
|
+
default: () => useDispatch_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useDispatch_exports);
|
|
25
|
+
var import_react_redux = require("react-redux");
|
|
26
|
+
var useDispatch_default = import_react_redux.useDispatch;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface useLowCodeProps {
|
|
2
|
+
onChange: (e: any) => void;
|
|
3
|
+
onReady: (e: any) => void;
|
|
4
|
+
}
|
|
5
|
+
export interface useLowCodeResult {
|
|
6
|
+
lowcodeRef: {
|
|
7
|
+
onReady: (e: any) => void;
|
|
8
|
+
onChange: (e: any) => void;
|
|
9
|
+
};
|
|
10
|
+
setState: (values: any, callback?: any) => any;
|
|
11
|
+
}
|
|
12
|
+
declare const useLowCode: (props: Partial<useLowCodeProps>) => useLowCodeResult;
|
|
13
|
+
export default useLowCode;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useLowCode/index.tsx
|
|
20
|
+
var useLowCode_exports = {};
|
|
21
|
+
__export(useLowCode_exports, {
|
|
22
|
+
default: () => useLowCode_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useLowCode_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var useLowCode = (props) => {
|
|
27
|
+
const { onChange, onReady } = props;
|
|
28
|
+
const lowcodeRef = (0, import_react.useRef)(null);
|
|
29
|
+
const cacheState = (0, import_react.useRef)(null);
|
|
30
|
+
const _onReady = (e) => {
|
|
31
|
+
try {
|
|
32
|
+
lowcodeRef.current = e;
|
|
33
|
+
const val = onReady && onReady(e);
|
|
34
|
+
if (cacheState.current) {
|
|
35
|
+
_setState(cacheState.current.values, cacheState.current.callback);
|
|
36
|
+
cacheState.current = null;
|
|
37
|
+
}
|
|
38
|
+
return val;
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error(err);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const _onChange = (e) => {
|
|
44
|
+
onChange && onChange(e);
|
|
45
|
+
};
|
|
46
|
+
const _setState = (values, callback) => {
|
|
47
|
+
try {
|
|
48
|
+
if (lowcodeRef.current) {
|
|
49
|
+
lowcodeRef.current.setState(values, callback);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (cacheState.current) {
|
|
53
|
+
cacheState.current = {
|
|
54
|
+
values: {
|
|
55
|
+
...cacheState.current.values,
|
|
56
|
+
...values
|
|
57
|
+
},
|
|
58
|
+
callback
|
|
59
|
+
};
|
|
60
|
+
} else {
|
|
61
|
+
cacheState.current = { values, callback };
|
|
62
|
+
}
|
|
63
|
+
} catch (err) {
|
|
64
|
+
console.error(err);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
lowcodeRef: {
|
|
69
|
+
onReady: _onReady,
|
|
70
|
+
onChange: _onChange
|
|
71
|
+
},
|
|
72
|
+
setState: _setState
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
var useLowCode_default = useLowCode;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ModelsState } from "../../models";
|
|
2
|
+
declare const useStore: <T extends "tasks" | "global", D extends keyof ModelsState[T]>(props: {
|
|
3
|
+
models: T;
|
|
4
|
+
key?: D | undefined;
|
|
5
|
+
}) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
|
|
6
|
+
export default useStore;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useStore/index.ts
|
|
20
|
+
var useStore_exports = {};
|
|
21
|
+
__export(useStore_exports, {
|
|
22
|
+
default: () => useStore_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useStore_exports);
|
|
25
|
+
var import_react_redux = require("react-redux");
|
|
26
|
+
var useStore = (props) => {
|
|
27
|
+
const models = (0, import_react_redux.useSelector)((state) => state[props.models]);
|
|
28
|
+
if (props.key !== void 0) {
|
|
29
|
+
return models == null ? void 0 : models[props.key];
|
|
30
|
+
}
|
|
31
|
+
return models;
|
|
32
|
+
};
|
|
33
|
+
var useStore_default = useStore;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as storage } from './storage';
|
|
2
|
+
export { default as request } from './request';
|
|
3
|
+
export { default as hooks } from './hooks';
|
|
2
4
|
export { default as locales } from './locales';
|
|
5
|
+
export { default as models } from './models';
|
|
6
|
+
export { default as pubsub } from './pubsub';
|
|
7
|
+
export { default as socket } from './socket';
|
|
8
|
+
export * from './app';
|
package/lib/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
21
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
22
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -29,14 +30,31 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
30
|
// src/index.ts
|
|
30
31
|
var src_exports = {};
|
|
31
32
|
__export(src_exports, {
|
|
32
|
-
|
|
33
|
-
locales: () => import_locales.default
|
|
33
|
+
hooks: () => import_hooks.default,
|
|
34
|
+
locales: () => import_locales.default,
|
|
35
|
+
models: () => import_models.default,
|
|
36
|
+
pubsub: () => import_pubsub.default,
|
|
37
|
+
request: () => import_request.default,
|
|
38
|
+
socket: () => import_socket.default,
|
|
39
|
+
storage: () => import_storage.default
|
|
34
40
|
});
|
|
35
41
|
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
var
|
|
42
|
+
var import_storage = __toESM(require("./storage"));
|
|
43
|
+
var import_request = __toESM(require("./request"));
|
|
44
|
+
var import_hooks = __toESM(require("./hooks"));
|
|
37
45
|
var import_locales = __toESM(require("./locales"));
|
|
46
|
+
var import_models = __toESM(require("./models"));
|
|
47
|
+
var import_pubsub = __toESM(require("./pubsub"));
|
|
48
|
+
var import_socket = __toESM(require("./socket"));
|
|
49
|
+
__reExport(src_exports, require("./app"), module.exports);
|
|
38
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
51
|
0 && (module.exports = {
|
|
40
|
-
|
|
41
|
-
locales
|
|
52
|
+
hooks,
|
|
53
|
+
locales,
|
|
54
|
+
models,
|
|
55
|
+
pubsub,
|
|
56
|
+
request,
|
|
57
|
+
socket,
|
|
58
|
+
storage,
|
|
59
|
+
...require("./app")
|
|
42
60
|
});
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IndexDB 管理器模块
|
|
3
|
+
*
|
|
4
|
+
* 这个模块提供了对浏览器 IndexedDB 的简单封装,并在不支持 IndexedDB 的环境中
|
|
5
|
+
* 自动降级使用 localStorage 作为备选存储方案。
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 数据库配置选项接口
|
|
9
|
+
* @interface DBOptions
|
|
10
|
+
* @property {string} dbName - 数据库名称
|
|
11
|
+
* @property {number} version - 数据库版本号
|
|
12
|
+
* @property {Array} stores - 存储对象配置数组
|
|
13
|
+
* @property {string} stores[].name - 存储对象名称
|
|
14
|
+
* @property {string} stores[].keyPath - 主键路径
|
|
15
|
+
* @property {Array} [stores[].indexes] - 索引配置数组(可选)
|
|
16
|
+
* @property {string} stores[].indexes[].name - 索引名称
|
|
17
|
+
* @property {string} stores[].indexes[].keyPath - 索引键路径
|
|
18
|
+
* @property {IDBIndexParameters} [stores[].indexes[].options] - 索引选项(可选)
|
|
19
|
+
*/
|
|
20
|
+
export interface DBOptions {
|
|
21
|
+
dbName: string;
|
|
22
|
+
version: number;
|
|
23
|
+
stores: {
|
|
24
|
+
name: string;
|
|
25
|
+
keyPath: string;
|
|
26
|
+
indexes?: {
|
|
27
|
+
name: string;
|
|
28
|
+
keyPath: string;
|
|
29
|
+
options?: IDBIndexParameters;
|
|
30
|
+
}[];
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* IndexDB 管理器类
|
|
35
|
+
* 提供对 IndexedDB 的简单封装,支持自动降级到 localStorage
|
|
36
|
+
* @class IndexDBManager
|
|
37
|
+
*/
|
|
38
|
+
declare class IndexDBManager {
|
|
39
|
+
/**
|
|
40
|
+
* 检查环境是否支持 IndexedDB
|
|
41
|
+
* @returns {boolean} 是否支持 IndexedDB
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
private static isSupported;
|
|
45
|
+
private db;
|
|
46
|
+
private dbName;
|
|
47
|
+
private version;
|
|
48
|
+
private stores;
|
|
49
|
+
private useIndexDB;
|
|
50
|
+
/**
|
|
51
|
+
* 创建 IndexDBManager 实例
|
|
52
|
+
* @param {DBOptions} options - 数据库配置选项
|
|
53
|
+
*/
|
|
54
|
+
constructor(options: DBOptions);
|
|
55
|
+
/**
|
|
56
|
+
* 初始化数据库连接
|
|
57
|
+
* 如果环境不支持 IndexedDB,将自动使用 localStorage
|
|
58
|
+
* @returns {Promise<boolean>} 连接是否成功
|
|
59
|
+
*/
|
|
60
|
+
connect(): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* 生成用于 localStorage 的存储键
|
|
63
|
+
* @param {string} storeName - 存储对象名称
|
|
64
|
+
* @param {string|number} [key] - 可选的键值
|
|
65
|
+
* @returns {string} 格式化的存储键
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
private getStorageKey;
|
|
69
|
+
/**
|
|
70
|
+
* 添加数据到指定的存储对象
|
|
71
|
+
* @param {string} storeName - 存储对象名称
|
|
72
|
+
* @param {T} data - 要添加的数据
|
|
73
|
+
* @returns {Promise<T>} 添加的数据
|
|
74
|
+
* @template T
|
|
75
|
+
*/
|
|
76
|
+
add<T>(storeName: string, data: T): Promise<T>;
|
|
77
|
+
/**
|
|
78
|
+
* 获取指定存储对象中的数据
|
|
79
|
+
* @param {string} storeName - 存储对象名称
|
|
80
|
+
* @param {string|number} key - 数据主键
|
|
81
|
+
* @returns {Promise<T|null>} 获取的数据,不存在则返回 null
|
|
82
|
+
* @template T
|
|
83
|
+
*/
|
|
84
|
+
get<T>(storeName: string, key: string | number): Promise<T | null>;
|
|
85
|
+
/**
|
|
86
|
+
* 更新指定存储对象中的数据
|
|
87
|
+
* @param {string} storeName - 存储对象名称
|
|
88
|
+
* @param {T} data - 要更新的数据
|
|
89
|
+
* @returns {Promise<T>} 更新后的数据
|
|
90
|
+
* @template T
|
|
91
|
+
*/
|
|
92
|
+
update<T>(storeName: string, data: T): Promise<T>;
|
|
93
|
+
/**
|
|
94
|
+
* 删除指定存储对象中的数据
|
|
95
|
+
* @param {string} storeName - 存储对象名称
|
|
96
|
+
* @param {string|number} key - 数据主键
|
|
97
|
+
* @returns {Promise<boolean>} 删除是否成功
|
|
98
|
+
*/
|
|
99
|
+
delete(storeName: string, key: string | number): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* 获取指定存储对象中的所有数据
|
|
102
|
+
* @param {string} storeName - 存储对象名称
|
|
103
|
+
* @returns {Promise<T[]>} 数据数组
|
|
104
|
+
* @template T
|
|
105
|
+
*/
|
|
106
|
+
getAll<T>(storeName: string): Promise<T[]>;
|
|
107
|
+
/**
|
|
108
|
+
* 清空指定存储对象中的所有数据
|
|
109
|
+
* @param {string} storeName - 存储对象名称
|
|
110
|
+
* @returns {Promise<boolean>} 清空是否成功
|
|
111
|
+
*/
|
|
112
|
+
clear(storeName: string): Promise<boolean>;
|
|
113
|
+
/**
|
|
114
|
+
* 关闭数据库连接
|
|
115
|
+
* 在不再需要使用数据库时调用,释放资源
|
|
116
|
+
*/
|
|
117
|
+
close(): void;
|
|
118
|
+
/**
|
|
119
|
+
* 获取当前使用的存储方式
|
|
120
|
+
* @returns {'indexDB'|'localStorage'} 当前使用的存储方式
|
|
121
|
+
*/
|
|
122
|
+
getCurrentStorage(): 'indexDB' | 'localStorage';
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* 使用示例:
|
|
126
|
+
*
|
|
127
|
+
* // 1. 创建数据库配置
|
|
128
|
+
* const dbOptions: DBOptions = {
|
|
129
|
+
* dbName: 'myApp',
|
|
130
|
+
* version: 1,
|
|
131
|
+
* stores: [
|
|
132
|
+
* {
|
|
133
|
+
* name: 'users',
|
|
134
|
+
* keyPath: 'id',
|
|
135
|
+
* indexes: [
|
|
136
|
+
* { name: 'email', keyPath: 'email', options: { unique: true } }
|
|
137
|
+
* ]
|
|
138
|
+
* },
|
|
139
|
+
* {
|
|
140
|
+
* name: 'products',
|
|
141
|
+
* keyPath: 'id'
|
|
142
|
+
* }
|
|
143
|
+
* ]
|
|
144
|
+
* };
|
|
145
|
+
*
|
|
146
|
+
* // 2. 创建并连接数据库
|
|
147
|
+
* const db = new IndexDBManager(dbOptions);
|
|
148
|
+
* await db.connect();
|
|
149
|
+
*
|
|
150
|
+
* // 3. 添加数据
|
|
151
|
+
* const user = { id: '1', name: '张三', email: 'zhangsan@example.com' };
|
|
152
|
+
* await db.add('users', user);
|
|
153
|
+
*
|
|
154
|
+
* // 4. 获取数据
|
|
155
|
+
* const retrievedUser = await db.get('users', '1');
|
|
156
|
+
*
|
|
157
|
+
* // 5. 更新数据
|
|
158
|
+
* user.name = '张三 (已更新)';
|
|
159
|
+
* await db.update('users', user);
|
|
160
|
+
*
|
|
161
|
+
* // 6. 获取所有数据
|
|
162
|
+
* const allUsers = await db.getAll('users');
|
|
163
|
+
*
|
|
164
|
+
* // 7. 删除数据
|
|
165
|
+
* await db.delete('users', '1');
|
|
166
|
+
*
|
|
167
|
+
* // 8. 清空存储对象
|
|
168
|
+
* await db.clear('users');
|
|
169
|
+
*
|
|
170
|
+
* // 9. 关闭数据库连接
|
|
171
|
+
* db.close();
|
|
172
|
+
*
|
|
173
|
+
* // 10. 检查当前使用的存储方式
|
|
174
|
+
* const storageType = db.getCurrentStorage(); // 'indexDB' 或 'localStorage'
|
|
175
|
+
*/
|
|
176
|
+
export default IndexDBManager;
|