@pisell/pisellos 3.0.56 → 3.0.57
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/dist/core/index.js +2 -1
- package/dist/effects/index.d.ts +4 -3
- package/dist/effects/index.js +15 -6
- package/dist/modules/AccountList/index.d.ts +7 -1
- package/dist/modules/AccountList/index.js +81 -14
- package/dist/modules/AccountList/types.d.ts +28 -0
- package/dist/modules/AccountList/types.js +8 -0
- package/dist/modules/Cart/index.js +1 -1
- package/dist/modules/Cart/utils/changePrice.d.ts +2 -2
- package/dist/modules/Cart/utils/changePrice.js +1 -1
- package/dist/modules/Customer/constants.d.ts +7 -0
- package/dist/modules/Customer/constants.js +12 -0
- package/dist/modules/Customer/index.d.ts +122 -0
- package/dist/modules/Customer/index.js +697 -0
- package/dist/modules/Customer/types.d.ts +146 -0
- package/dist/modules/Customer/types.js +41 -0
- package/dist/modules/Payment/cash.d.ts +11 -0
- package/dist/modules/Payment/cash.js +78 -0
- package/dist/modules/Payment/eftpos.d.ts +11 -0
- package/dist/modules/Payment/eftpos.js +80 -0
- package/dist/modules/Payment/index.d.ts +273 -9
- package/dist/modules/Payment/index.js +2525 -109
- package/dist/modules/Payment/types.d.ts +382 -30
- package/dist/modules/Payment/types.js +116 -14
- package/dist/modules/Payment/wallet.d.ts +11 -0
- package/dist/modules/Payment/wallet.js +78 -0
- package/dist/modules/Payment/walletpass.d.ts +0 -0
- package/dist/modules/Payment/walletpass.js +0 -0
- package/dist/modules/ProductList/index.d.ts +13 -3
- package/dist/modules/ProductList/index.js +52 -42
- package/dist/modules/ProductList/types.d.ts +0 -1
- package/dist/modules/Rules/index.js +27 -14
- package/dist/modules/Rules/types.d.ts +1 -0
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/plugins/app-types/app/app.d.ts +83 -0
- package/dist/plugins/app-types/app/const.d.ts +4 -0
- package/dist/plugins/app-types/app/index.d.ts +14 -0
- package/dist/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/dist/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/dist/plugins/app-types/config.d.ts +3 -0
- package/dist/plugins/app-types/cookie/index.d.ts +13 -0
- package/dist/plugins/app-types/data/index.d.ts +8 -0
- package/dist/plugins/app-types/history/config.d.ts +24 -0
- package/dist/plugins/app-types/history/index.d.ts +20 -0
- package/dist/plugins/app-types/history/type.d.ts +2 -0
- package/dist/plugins/app-types/hooks/index.d.ts +12 -0
- package/dist/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/dist/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/dist/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/dist/plugins/app-types/index.d.ts +6 -0
- package/dist/plugins/app-types/indexDB/index.d.ts +178 -0
- package/dist/plugins/app-types/locales/en.d.ts +3 -0
- package/dist/plugins/app-types/locales/index.d.ts +37 -0
- package/dist/plugins/app-types/locales/original.d.ts +3 -0
- package/dist/plugins/app-types/locales/type.d.ts +19 -0
- package/dist/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/dist/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/dist/plugins/app-types/logger/feishu.d.ts +11 -0
- package/dist/plugins/app-types/logger/index.d.ts +122 -0
- package/dist/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/dist/plugins/app-types/menuManager/index.d.ts +28 -0
- package/dist/plugins/app-types/models/global.d.ts +32 -0
- package/dist/plugins/app-types/models/index.d.ts +45 -0
- package/dist/plugins/app-types/models/type.d.ts +2 -0
- package/dist/plugins/app-types/package.json +15 -0
- package/dist/plugins/app-types/plugin/index.d.ts +0 -0
- package/dist/plugins/app-types/pubsub/example.d.ts +5 -0
- package/dist/plugins/app-types/pubsub/index.d.ts +63 -0
- package/dist/plugins/app-types/request/cache.d.ts +46 -0
- package/dist/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/dist/plugins/app-types/request/config.d.ts +3 -0
- package/dist/plugins/app-types/request/constants.d.ts +2 -0
- package/dist/plugins/app-types/request/index.d.ts +24 -0
- package/dist/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/dist/plugins/app-types/request/type.d.ts +41 -0
- package/dist/plugins/app-types/request/utils.d.ts +46 -0
- package/dist/plugins/app-types/routes/config.d.ts +7 -0
- package/dist/plugins/app-types/routes/index.d.ts +28 -0
- package/dist/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/dist/plugins/app-types/socket/components/index.d.ts +2 -0
- package/dist/plugins/app-types/socket/constants.d.ts +33 -0
- package/dist/plugins/app-types/socket/events.d.ts +31 -0
- package/dist/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/dist/plugins/app-types/socket/index.d.ts +61 -0
- package/dist/plugins/app-types/socket/monitor.d.ts +169 -0
- package/dist/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/dist/plugins/app-types/socket/socket.d.ts +129 -0
- package/dist/plugins/app-types/socket/types.d.ts +85 -0
- package/dist/plugins/app-types/storage/index.d.ts +17 -0
- package/dist/plugins/app-types/tasks/index.d.ts +77 -0
- package/dist/plugins/app-types/tasks/type.d.ts +62 -0
- package/dist/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/dist/plugins/app-types/type.d.ts +2 -0
- package/dist/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/dist/plugins/app-types/variables/config.d.ts +3 -0
- package/dist/plugins/app-types/variables/index.d.ts +6 -0
- package/dist/plugins/app-types/variables/type.d.ts +2 -0
- package/dist/plugins/app-types/website/index.d.ts +6 -0
- package/dist/plugins/app.d.ts +8 -0
- package/dist/plugins/app.js +1 -0
- package/dist/plugins/window.d.ts +1 -0
- package/dist/solution/BookingByStep/index.js +59 -35
- package/dist/solution/BookingByStep/types.d.ts +3 -2
- package/dist/solution/BookingTicket/index.d.ts +172 -0
- package/dist/solution/BookingTicket/index.js +665 -0
- package/dist/solution/BookingTicket/types.d.ts +68 -0
- package/dist/solution/BookingTicket/types.js +43 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/dist/solution/BookingTicket/utils/scan/cloudSearch.js +159 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
- package/dist/solution/BookingTicket/utils/scan/handleScan.js +174 -0
- package/dist/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/dist/solution/BookingTicket/utils/scan/index.js +285 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.js +305 -0
- package/dist/solution/BuyTickets/index.d.ts +2 -2
- package/dist/solution/BuyTickets/index.js +1 -1
- package/dist/solution/Checkout/appointmentDemo.json +1 -0
- package/dist/solution/Checkout/index.d.ts +181 -0
- package/dist/solution/Checkout/index.js +1596 -0
- package/dist/solution/Checkout/types.d.ts +550 -0
- package/dist/solution/Checkout/types.js +132 -0
- package/dist/solution/Checkout/utils/index.d.ts +73 -0
- package/dist/solution/Checkout/utils/index.js +371 -0
- package/dist/solution/ShopDiscount/index.js +4 -2
- package/dist/solution/index.d.ts +2 -0
- package/dist/solution/index.js +3 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/utils/task.d.ts +40 -0
- package/dist/utils/task.js +171 -0
- package/dist/utils/watch.d.ts +102 -0
- package/dist/utils/watch.js +294 -0
- package/lib/core/index.js +1 -1
- package/lib/effects/index.d.ts +4 -3
- package/lib/effects/index.js +4 -1
- package/lib/modules/AccountList/index.d.ts +7 -1
- package/lib/modules/AccountList/index.js +27 -0
- package/lib/modules/AccountList/types.d.ts +28 -0
- package/lib/modules/Cart/index.js +1 -1
- package/lib/modules/Cart/utils/changePrice.d.ts +2 -2
- package/lib/modules/Cart/utils/changePrice.js +1 -1
- package/lib/modules/Customer/constants.d.ts +7 -0
- package/lib/modules/Customer/constants.js +39 -0
- package/lib/modules/Customer/index.d.ts +122 -0
- package/lib/modules/Customer/index.js +440 -0
- package/lib/modules/Customer/types.d.ts +146 -0
- package/lib/modules/Customer/types.js +37 -0
- package/lib/modules/Payment/cash.d.ts +11 -0
- package/lib/modules/Payment/cash.js +51 -0
- package/lib/modules/Payment/eftpos.d.ts +11 -0
- package/lib/modules/Payment/eftpos.js +51 -0
- package/lib/modules/Payment/index.d.ts +273 -9
- package/lib/modules/Payment/index.js +1285 -50
- package/lib/modules/Payment/types.d.ts +382 -30
- package/lib/modules/Payment/types.js +41 -6
- package/lib/modules/Payment/wallet.d.ts +11 -0
- package/lib/modules/Payment/wallet.js +51 -0
- package/lib/modules/Payment/walletpass.d.ts +0 -0
- package/lib/modules/Payment/walletpass.js +0 -0
- package/lib/modules/ProductList/index.d.ts +13 -3
- package/lib/modules/ProductList/index.js +37 -26
- package/lib/modules/ProductList/types.d.ts +0 -1
- package/lib/modules/Rules/index.js +20 -12
- package/lib/modules/Rules/types.d.ts +1 -0
- package/lib/modules/index.d.ts +1 -0
- package/lib/modules/index.js +2 -0
- package/lib/plugins/app-types/app/app.d.ts +83 -0
- package/lib/plugins/app-types/app/const.d.ts +4 -0
- package/lib/plugins/app-types/app/index.d.ts +14 -0
- package/lib/plugins/app-types/applicationManager/application.d.ts +50 -0
- package/lib/plugins/app-types/applicationManager/index.d.ts +13 -0
- package/lib/plugins/app-types/config.d.ts +3 -0
- package/lib/plugins/app-types/cookie/index.d.ts +13 -0
- package/lib/plugins/app-types/data/index.d.ts +8 -0
- package/lib/plugins/app-types/history/config.d.ts +24 -0
- package/lib/plugins/app-types/history/index.d.ts +20 -0
- package/lib/plugins/app-types/history/type.d.ts +2 -0
- package/lib/plugins/app-types/hooks/index.d.ts +12 -0
- package/lib/plugins/app-types/hooks/useDelayedValue/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useDispatch/index.d.ts +2 -0
- package/lib/plugins/app-types/hooks/useLowCode/index.d.ts +13 -0
- package/lib/plugins/app-types/hooks/useStore/index.d.ts +6 -0
- package/lib/plugins/app-types/index.d.ts +6 -0
- package/lib/plugins/app-types/indexDB/index.d.ts +178 -0
- package/lib/plugins/app-types/locales/en.d.ts +3 -0
- package/lib/plugins/app-types/locales/index.d.ts +37 -0
- package/lib/plugins/app-types/locales/original.d.ts +3 -0
- package/lib/plugins/app-types/locales/type.d.ts +19 -0
- package/lib/plugins/app-types/locales/zh-CN.d.ts +3 -0
- package/lib/plugins/app-types/locales/zh-HK.d.ts +3 -0
- package/lib/plugins/app-types/logger/feishu.d.ts +11 -0
- package/lib/plugins/app-types/logger/index.d.ts +122 -0
- package/lib/plugins/app-types/menuManager/hooks.d.ts +17 -0
- package/lib/plugins/app-types/menuManager/index.d.ts +28 -0
- package/lib/plugins/app-types/models/global.d.ts +32 -0
- package/lib/plugins/app-types/models/index.d.ts +45 -0
- package/lib/plugins/app-types/models/type.d.ts +2 -0
- package/lib/plugins/app-types/package.json +15 -0
- package/lib/plugins/app-types/plugin/index.d.ts +0 -0
- package/lib/plugins/app-types/pubsub/example.d.ts +5 -0
- package/lib/plugins/app-types/pubsub/index.d.ts +63 -0
- package/lib/plugins/app-types/request/cache.d.ts +46 -0
- package/lib/plugins/app-types/request/cancelToken.d.ts +38 -0
- package/lib/plugins/app-types/request/config.d.ts +3 -0
- package/lib/plugins/app-types/request/constants.d.ts +2 -0
- package/lib/plugins/app-types/request/index.d.ts +24 -0
- package/lib/plugins/app-types/request/pisell2Request.d.ts +6 -0
- package/lib/plugins/app-types/request/type.d.ts +41 -0
- package/lib/plugins/app-types/request/utils.d.ts +46 -0
- package/lib/plugins/app-types/routes/config.d.ts +7 -0
- package/lib/plugins/app-types/routes/index.d.ts +28 -0
- package/lib/plugins/app-types/socket/components/SocketMonitorPage.d.ts +6 -0
- package/lib/plugins/app-types/socket/components/index.d.ts +2 -0
- package/lib/plugins/app-types/socket/constants.d.ts +33 -0
- package/lib/plugins/app-types/socket/events.d.ts +31 -0
- package/lib/plugins/app-types/socket/heartbeat.d.ts +66 -0
- package/lib/plugins/app-types/socket/index.d.ts +61 -0
- package/lib/plugins/app-types/socket/monitor.d.ts +169 -0
- package/lib/plugins/app-types/socket/reconnect.d.ts +61 -0
- package/lib/plugins/app-types/socket/socket.d.ts +129 -0
- package/lib/plugins/app-types/socket/types.d.ts +85 -0
- package/lib/plugins/app-types/storage/index.d.ts +17 -0
- package/lib/plugins/app-types/tasks/index.d.ts +77 -0
- package/lib/plugins/app-types/tasks/type.d.ts +62 -0
- package/lib/plugins/app-types/tasks/useTasks.d.ts +5 -0
- package/lib/plugins/app-types/type.d.ts +2 -0
- package/lib/plugins/app-types/variables/VariablesProvider.d.ts +7 -0
- package/lib/plugins/app-types/variables/config.d.ts +3 -0
- package/lib/plugins/app-types/variables/index.d.ts +6 -0
- package/lib/plugins/app-types/variables/type.d.ts +2 -0
- package/lib/plugins/app-types/website/index.d.ts +6 -0
- package/lib/plugins/app.d.ts +8 -0
- package/lib/plugins/app.js +17 -0
- package/lib/plugins/window.d.ts +1 -0
- package/lib/solution/BookingByStep/index.js +40 -29
- package/lib/solution/BookingByStep/types.d.ts +3 -2
- package/lib/solution/BookingTicket/index.d.ts +172 -0
- package/lib/solution/BookingTicket/index.js +399 -0
- package/lib/solution/BookingTicket/types.d.ts +68 -0
- package/lib/solution/BookingTicket/types.js +72 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.d.ts +22 -0
- package/lib/solution/BookingTicket/utils/scan/cloudSearch.js +117 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.d.ts +16 -0
- package/lib/solution/BookingTicket/utils/scan/handleScan.js +125 -0
- package/lib/solution/BookingTicket/utils/scan/index.d.ts +81 -0
- package/lib/solution/BookingTicket/utils/scan/index.js +210 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.js +231 -0
- package/lib/solution/BuyTickets/index.d.ts +2 -2
- package/lib/solution/BuyTickets/index.js +1 -1
- package/lib/solution/Checkout/appointmentDemo.json +1 -0
- package/lib/solution/Checkout/index.d.ts +181 -0
- package/lib/solution/Checkout/index.js +864 -0
- package/lib/solution/Checkout/types.d.ts +550 -0
- package/lib/solution/Checkout/types.js +75 -0
- package/lib/solution/Checkout/utils/index.d.ts +73 -0
- package/lib/solution/Checkout/utils/index.js +266 -0
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/lib/solution/index.d.ts +2 -0
- package/lib/solution/index.js +5 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/utils/task.d.ts +40 -0
- package/lib/utils/task.js +109 -0
- package/lib/utils/watch.d.ts +102 -0
- package/lib/utils/watch.js +217 -0
- package/package.json +4 -2
|
@@ -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;
|
|
@@ -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,178 @@
|
|
|
1
|
+
import App from "../app";
|
|
2
|
+
/**
|
|
3
|
+
* IndexDB 管理器模块
|
|
4
|
+
*
|
|
5
|
+
* 这个模块提供了对浏览器 IndexedDB 的简单封装,并在不支持 IndexedDB 的环境中
|
|
6
|
+
* 自动降级使用 localStorage 作为备选存储方案。
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* 数据库配置选项接口
|
|
10
|
+
* @interface DBOptions
|
|
11
|
+
* @property {string} dbName - 数据库名称
|
|
12
|
+
* @property {number} version - 数据库版本号
|
|
13
|
+
* @property {Array} stores - 存储对象配置数组
|
|
14
|
+
* @property {string} stores[].name - 存储对象名称
|
|
15
|
+
* @property {string} stores[].keyPath - 主键路径
|
|
16
|
+
* @property {Array} [stores[].indexes] - 索引配置数组(可选)
|
|
17
|
+
* @property {string} stores[].indexes[].name - 索引名称
|
|
18
|
+
* @property {string} stores[].indexes[].keyPath - 索引键路径
|
|
19
|
+
* @property {IDBIndexParameters} [stores[].indexes[].options] - 索引选项(可选)
|
|
20
|
+
*/
|
|
21
|
+
export interface DBOptions {
|
|
22
|
+
dbName: string;
|
|
23
|
+
version: number;
|
|
24
|
+
stores: {
|
|
25
|
+
name: string;
|
|
26
|
+
keyPath: string;
|
|
27
|
+
indexes?: {
|
|
28
|
+
name: string;
|
|
29
|
+
keyPath: string;
|
|
30
|
+
options?: IDBIndexParameters;
|
|
31
|
+
}[];
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* IndexDB 管理器类
|
|
36
|
+
* 提供对 IndexedDB 的简单封装,支持自动降级到 localStorage
|
|
37
|
+
* @class IndexDBManager
|
|
38
|
+
*/
|
|
39
|
+
declare class IndexDBManager {
|
|
40
|
+
/**
|
|
41
|
+
* 检查环境是否支持 IndexedDB
|
|
42
|
+
* @returns {boolean} 是否支持 IndexedDB
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private static isSupported;
|
|
46
|
+
private db;
|
|
47
|
+
private dbName;
|
|
48
|
+
private version;
|
|
49
|
+
private stores;
|
|
50
|
+
private useIndexDB;
|
|
51
|
+
private app;
|
|
52
|
+
/**
|
|
53
|
+
* 创建 IndexDBManager 实例
|
|
54
|
+
* @param {DBOptions} options - 数据库配置选项
|
|
55
|
+
*/
|
|
56
|
+
constructor(app: App, options: DBOptions);
|
|
57
|
+
/**
|
|
58
|
+
* 初始化数据库连接
|
|
59
|
+
* 如果环境不支持 IndexedDB,将自动使用 localStorage
|
|
60
|
+
* @returns {Promise<boolean>} 连接是否成功
|
|
61
|
+
*/
|
|
62
|
+
connect(): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* 生成用于 localStorage 的存储键
|
|
65
|
+
* @param {string} storeName - 存储对象名称
|
|
66
|
+
* @param {string|number} [key] - 可选的键值
|
|
67
|
+
* @returns {string} 格式化的存储键
|
|
68
|
+
* @private
|
|
69
|
+
*/
|
|
70
|
+
private getStorageKey;
|
|
71
|
+
/**
|
|
72
|
+
* 添加数据到指定的存储对象
|
|
73
|
+
* @param {string} storeName - 存储对象名称
|
|
74
|
+
* @param {T} data - 要添加的数据
|
|
75
|
+
* @returns {Promise<T>} 添加的数据
|
|
76
|
+
* @template T
|
|
77
|
+
*/
|
|
78
|
+
add<T>(storeName: string, data: T): Promise<T>;
|
|
79
|
+
/**
|
|
80
|
+
* 获取指定存储对象中的数据
|
|
81
|
+
* @param {string} storeName - 存储对象名称
|
|
82
|
+
* @param {string|number} key - 数据主键
|
|
83
|
+
* @returns {Promise<T|null>} 获取的数据,不存在则返回 null
|
|
84
|
+
* @template T
|
|
85
|
+
*/
|
|
86
|
+
get<T>(storeName: string, key: string | number): Promise<T | null>;
|
|
87
|
+
/**
|
|
88
|
+
* 更新指定存储对象中的数据
|
|
89
|
+
* @param {string} storeName - 存储对象名称
|
|
90
|
+
* @param {T} data - 要更新的数据
|
|
91
|
+
* @returns {Promise<T>} 更新后的数据
|
|
92
|
+
* @template T
|
|
93
|
+
*/
|
|
94
|
+
update<T>(storeName: string, data: T): Promise<T>;
|
|
95
|
+
/**
|
|
96
|
+
* 删除指定存储对象中的数据
|
|
97
|
+
* @param {string} storeName - 存储对象名称
|
|
98
|
+
* @param {string|number} key - 数据主键
|
|
99
|
+
* @returns {Promise<boolean>} 删除是否成功
|
|
100
|
+
*/
|
|
101
|
+
delete(storeName: string, key: string | number): Promise<boolean>;
|
|
102
|
+
/**
|
|
103
|
+
* 获取指定存储对象中的所有数据
|
|
104
|
+
* @param {string} storeName - 存储对象名称
|
|
105
|
+
* @returns {Promise<T[]>} 数据数组
|
|
106
|
+
* @template T
|
|
107
|
+
*/
|
|
108
|
+
getAll<T>(storeName: string): Promise<T[]>;
|
|
109
|
+
/**
|
|
110
|
+
* 清空指定存储对象中的所有数据
|
|
111
|
+
* @param {string} storeName - 存储对象名称
|
|
112
|
+
* @returns {Promise<boolean>} 清空是否成功
|
|
113
|
+
*/
|
|
114
|
+
clear(storeName: string): Promise<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* 关闭数据库连接
|
|
117
|
+
* 在不再需要使用数据库时调用,释放资源
|
|
118
|
+
*/
|
|
119
|
+
close(): void;
|
|
120
|
+
/**
|
|
121
|
+
* 获取当前使用的存储方式
|
|
122
|
+
* @returns {'indexDB'|'localStorage'} 当前使用的存储方式
|
|
123
|
+
*/
|
|
124
|
+
getCurrentStorage(): 'indexDB' | 'localStorage';
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* 使用示例:
|
|
128
|
+
*
|
|
129
|
+
* // 1. 创建数据库配置
|
|
130
|
+
* const dbOptions: DBOptions = {
|
|
131
|
+
* dbName: 'myApp',
|
|
132
|
+
* version: 1,
|
|
133
|
+
* stores: [
|
|
134
|
+
* {
|
|
135
|
+
* name: 'users',
|
|
136
|
+
* keyPath: 'id',
|
|
137
|
+
* indexes: [
|
|
138
|
+
* { name: 'email', keyPath: 'email', options: { unique: true } }
|
|
139
|
+
* ]
|
|
140
|
+
* },
|
|
141
|
+
* {
|
|
142
|
+
* name: 'products',
|
|
143
|
+
* keyPath: 'id'
|
|
144
|
+
* }
|
|
145
|
+
* ]
|
|
146
|
+
* };
|
|
147
|
+
*
|
|
148
|
+
* // 2. 创建并连接数据库
|
|
149
|
+
* const db = new IndexDBManager(dbOptions);
|
|
150
|
+
* await db.connect();
|
|
151
|
+
*
|
|
152
|
+
* // 3. 添加数据
|
|
153
|
+
* const user = { id: '1', name: '张三', email: 'zhangsan@example.com' };
|
|
154
|
+
* await db.add('users', user);
|
|
155
|
+
*
|
|
156
|
+
* // 4. 获取数据
|
|
157
|
+
* const retrievedUser = await db.get('users', '1');
|
|
158
|
+
*
|
|
159
|
+
* // 5. 更新数据
|
|
160
|
+
* user.name = '张三 (已更新)';
|
|
161
|
+
* await db.update('users', user);
|
|
162
|
+
*
|
|
163
|
+
* // 6. 获取所有数据
|
|
164
|
+
* const allUsers = await db.getAll('users');
|
|
165
|
+
*
|
|
166
|
+
* // 7. 删除数据
|
|
167
|
+
* await db.delete('users', '1');
|
|
168
|
+
*
|
|
169
|
+
* // 8. 清空存储对象
|
|
170
|
+
* await db.clear('users');
|
|
171
|
+
*
|
|
172
|
+
* // 9. 关闭数据库连接
|
|
173
|
+
* db.close();
|
|
174
|
+
*
|
|
175
|
+
* // 10. 检查当前使用的存储方式
|
|
176
|
+
* const storageType = db.getCurrentStorage(); // 'indexDB' 或 'localStorage'
|
|
177
|
+
*/
|
|
178
|
+
export default IndexDBManager;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Locale, LibraryItem, LoadLibraryByUrlParams } from "./type";
|
|
2
|
+
import App from "../app";
|
|
3
|
+
export interface LocalesOptions {
|
|
4
|
+
locale?: Locale;
|
|
5
|
+
library?: {
|
|
6
|
+
[key in Locale]: LibraryItem;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare class Locales {
|
|
10
|
+
private app;
|
|
11
|
+
locale: string;
|
|
12
|
+
library: {
|
|
13
|
+
[key in Locale]: LibraryItem;
|
|
14
|
+
};
|
|
15
|
+
constructor(app: App, options?: LocalesOptions);
|
|
16
|
+
getLocale: () => string;
|
|
17
|
+
getCurrentTexts: (locale?: Locale) => {
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
};
|
|
20
|
+
setLocale: (locale: Locale, reload?: boolean) => void;
|
|
21
|
+
getText: (id: string, locale?: Locale) => string;
|
|
22
|
+
isCN: () => boolean;
|
|
23
|
+
loadLibraryByUrl: (urls: LoadLibraryByUrlParams) => Promise<{
|
|
24
|
+
[x: string]: LibraryItem;
|
|
25
|
+
}>;
|
|
26
|
+
loadLibraryByItems(libraryList: LibraryItem[]): void;
|
|
27
|
+
loadLibrary: (urls: LoadLibraryByUrlParams) => Promise<{
|
|
28
|
+
[x: string]: LibraryItem;
|
|
29
|
+
}>;
|
|
30
|
+
translation: (text: string | {
|
|
31
|
+
[key: Locale]: string;
|
|
32
|
+
}, locale?: Locale) => string | number;
|
|
33
|
+
getLibraryByData: (data: LibraryItem[]) => LibraryItem;
|
|
34
|
+
createTextsByLibrary: (id: string, library?: { [key in Locale]: LibraryItem; }) => {
|
|
35
|
+
[x: string]: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type Locale = 'original' | 'en' | 'zh-CN' | 'zh-HK' | string;
|
|
2
|
+
export type MultiLanguage = {
|
|
3
|
+
[key in Locale]: string;
|
|
4
|
+
};
|
|
5
|
+
export interface LibraryItem {
|
|
6
|
+
locale: Locale;
|
|
7
|
+
name: string;
|
|
8
|
+
translations: {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export interface LocaleConfig {
|
|
14
|
+
locale: Locale;
|
|
15
|
+
library: {
|
|
16
|
+
[key in Locale]: LibraryItem;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export type LoadLibraryByUrlParams = (string | Promise<LibraryItem> | (() => Promise<LibraryItem>) | LibraryItem)[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface contentItem {
|
|
2
|
+
key: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
interface sendWebhookProps {
|
|
6
|
+
title: string;
|
|
7
|
+
content: contentItem[];
|
|
8
|
+
webhook: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const sendWarningLog: ({ title, content, webhook }: sendWebhookProps) => Promise<any>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import App from "../app";
|
|
2
|
+
export type LogConsoleType = "info" | "warning" | "error" | "debug";
|
|
3
|
+
/**
|
|
4
|
+
* 日志项接口
|
|
5
|
+
*/
|
|
6
|
+
interface LogItem {
|
|
7
|
+
type: LogConsoleType;
|
|
8
|
+
title: string;
|
|
9
|
+
date?: string;
|
|
10
|
+
metadata?: any;
|
|
11
|
+
}
|
|
12
|
+
interface LogFile {
|
|
13
|
+
fileName: string;
|
|
14
|
+
date: string;
|
|
15
|
+
fileContent: LogFileContent;
|
|
16
|
+
}
|
|
17
|
+
interface LogFileContent {
|
|
18
|
+
metadata: any;
|
|
19
|
+
logs: LogItem[];
|
|
20
|
+
}
|
|
21
|
+
export interface LoggerOptions {
|
|
22
|
+
prefix?: string;
|
|
23
|
+
checkInterval?: number;
|
|
24
|
+
feishuConfig?: any;
|
|
25
|
+
retentionDays?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 日志管理器类
|
|
29
|
+
*/
|
|
30
|
+
declare class LoggerManager {
|
|
31
|
+
private logBuffer;
|
|
32
|
+
private timer;
|
|
33
|
+
private checkInterval;
|
|
34
|
+
private prefix;
|
|
35
|
+
private metadata;
|
|
36
|
+
private db;
|
|
37
|
+
private app;
|
|
38
|
+
private feishuConfig;
|
|
39
|
+
private retentionDays;
|
|
40
|
+
private metadataFunction;
|
|
41
|
+
/**
|
|
42
|
+
* 构造函数
|
|
43
|
+
* @param prefix 日志前缀
|
|
44
|
+
* @param checkInterval 检查间隔时间,默认5分钟
|
|
45
|
+
*/
|
|
46
|
+
constructor(app: App, options?: LoggerOptions);
|
|
47
|
+
init(): void;
|
|
48
|
+
/**
|
|
49
|
+
* 初始化 IndexDB
|
|
50
|
+
*/
|
|
51
|
+
private initDB;
|
|
52
|
+
/**
|
|
53
|
+
* 设置元数据
|
|
54
|
+
* @param metadata 元数据
|
|
55
|
+
*/
|
|
56
|
+
setMetadata(metadata: any): void;
|
|
57
|
+
setMetadataFunction(metadataFunction: () => any): void;
|
|
58
|
+
/**
|
|
59
|
+
* 初始化定时器
|
|
60
|
+
*/
|
|
61
|
+
initTimer(): void;
|
|
62
|
+
/**
|
|
63
|
+
* 添加日志
|
|
64
|
+
* @param log 日志项
|
|
65
|
+
*/
|
|
66
|
+
addLog(log: LogItem): void;
|
|
67
|
+
/**
|
|
68
|
+
* 发送飞书通知
|
|
69
|
+
* @param log 日志项
|
|
70
|
+
*/
|
|
71
|
+
private sendFeishuNotification;
|
|
72
|
+
/**
|
|
73
|
+
* 创建日志文件名
|
|
74
|
+
* @returns 日志文件名
|
|
75
|
+
*/
|
|
76
|
+
private createFileName;
|
|
77
|
+
/**
|
|
78
|
+
* 创建日志文件
|
|
79
|
+
* @param _fileName 文件名
|
|
80
|
+
* @returns 日志文件对象
|
|
81
|
+
*/
|
|
82
|
+
private createFile;
|
|
83
|
+
/**
|
|
84
|
+
* 存储日志到持久化存储
|
|
85
|
+
*/
|
|
86
|
+
private storeLog;
|
|
87
|
+
/**
|
|
88
|
+
* 清理旧日志,只保留最近指定天数的日志
|
|
89
|
+
*/
|
|
90
|
+
private cleanupOldLogs;
|
|
91
|
+
/**
|
|
92
|
+
* 获取日志文件列表
|
|
93
|
+
* @returns 日志文件列表
|
|
94
|
+
*/
|
|
95
|
+
getLogFiles(): Promise<LogFile[]>;
|
|
96
|
+
/**
|
|
97
|
+
* 获取指定日志文件的内容
|
|
98
|
+
* @param fileName 日志文件名
|
|
99
|
+
* @returns 日志文件内容
|
|
100
|
+
*/
|
|
101
|
+
getLogFile(fileName: string): Promise<LogFile | null>;
|
|
102
|
+
/**
|
|
103
|
+
* 清空指定日志文件
|
|
104
|
+
* @param fileName 日志文件名,不指定则清空所有日志
|
|
105
|
+
* @returns 是否成功
|
|
106
|
+
*/
|
|
107
|
+
clearLogs(fileName?: string): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* 设置日志保留天数
|
|
110
|
+
* @param days 保留天数
|
|
111
|
+
*/
|
|
112
|
+
setRetentionDays(days: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* 手动触发清理旧日志
|
|
115
|
+
*/
|
|
116
|
+
manualCleanup(): Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* 销毁实例
|
|
119
|
+
*/
|
|
120
|
+
destroy(): void;
|
|
121
|
+
}
|
|
122
|
+
export default LoggerManager;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MenuItem } from "./index";
|
|
3
|
+
export declare const isHttp: (url: string) => boolean;
|
|
4
|
+
export interface MenuContextType {
|
|
5
|
+
selectedKeys: string[];
|
|
6
|
+
openKeys: string[];
|
|
7
|
+
setOpenKeys: (keys: string[]) => void;
|
|
8
|
+
handleClick: (key: string) => void;
|
|
9
|
+
menuItems: MenuItem[];
|
|
10
|
+
getShowChildren: (children: MenuItem[]) => MenuItem[];
|
|
11
|
+
setMenuItems: (items: MenuItem[]) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const MenuProvider: React.FC<{
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
menus: MenuItem[];
|
|
16
|
+
}>;
|
|
17
|
+
export declare const useMenu: () => MenuContextType;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import App from '../app';
|
|
3
|
+
export interface MenuItem {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
path: string;
|
|
7
|
+
children?: MenuItem[];
|
|
8
|
+
icon?: string | React.ReactNode;
|
|
9
|
+
hide?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class MenuManager {
|
|
12
|
+
private menuItems;
|
|
13
|
+
private menuMaps;
|
|
14
|
+
private app;
|
|
15
|
+
useMenu: () => import("./hooks").MenuContextType;
|
|
16
|
+
MenuProvider: React.FC<{
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
menus: MenuItem[];
|
|
19
|
+
}>;
|
|
20
|
+
constructor(items: MenuItem[], app: App);
|
|
21
|
+
set(items: MenuItem[]): void;
|
|
22
|
+
getMenus(): MenuItem[];
|
|
23
|
+
getMenuMaps(): void;
|
|
24
|
+
findMenuItemByPath(items: MenuItem[], path: string): MenuItem | null;
|
|
25
|
+
findParent(items: MenuItem[], key: string, parent?: MenuItem | null): MenuItem | null;
|
|
26
|
+
getShowChildren(items: MenuItem[]): MenuItem[];
|
|
27
|
+
findMenuItemByKey(items: MenuItem[], key: string): MenuItem | null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Effect, Subscription } from 'dva';
|
|
2
|
+
import { Reducer } from 'redux';
|
|
3
|
+
export interface GlobalModal {
|
|
4
|
+
namespace: 'global';
|
|
5
|
+
state: {
|
|
6
|
+
isLogin: boolean;
|
|
7
|
+
account: any;
|
|
8
|
+
core: any;
|
|
9
|
+
isInstallAPP: boolean;
|
|
10
|
+
app: {
|
|
11
|
+
status: {
|
|
12
|
+
login: boolean;
|
|
13
|
+
storage: boolean;
|
|
14
|
+
network: boolean;
|
|
15
|
+
materials: boolean;
|
|
16
|
+
pisell2: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
effects: {
|
|
21
|
+
init: Effect;
|
|
22
|
+
};
|
|
23
|
+
reducers: {
|
|
24
|
+
saveGlobalState: Reducer<any>;
|
|
25
|
+
setInit: Reducer<any>;
|
|
26
|
+
};
|
|
27
|
+
subscriptions: {
|
|
28
|
+
_init: Subscription;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare const modal: GlobalModal;
|
|
32
|
+
export default modal;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import hooks from '../hooks';
|
|
2
|
+
import { Provider as StoreProvider } from "react-redux";
|
|
3
|
+
declare const models: import("./global").GlobalModal[];
|
|
4
|
+
type ModalsType = (typeof models[number]);
|
|
5
|
+
export interface Store {
|
|
6
|
+
getDataByModel: typeof getDataByModel;
|
|
7
|
+
useStore: typeof hooks.useStore;
|
|
8
|
+
useDispatch: typeof hooks.useDispatch;
|
|
9
|
+
setDataByModel: typeof setDataByModel;
|
|
10
|
+
dispatch: any;
|
|
11
|
+
getState: any;
|
|
12
|
+
}
|
|
13
|
+
export type ModelsNames = ModalsType['namespace'];
|
|
14
|
+
export type ModelsState = {
|
|
15
|
+
[K in (ModalsType['namespace'])]: Extract<ModalsType, {
|
|
16
|
+
namespace: K;
|
|
17
|
+
}>['state'];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @title: 从store内获取数据
|
|
21
|
+
* @description:
|
|
22
|
+
* @param {string} model
|
|
23
|
+
* @param {string} key
|
|
24
|
+
* @return {*}
|
|
25
|
+
* @Author: zhiwei.Wang
|
|
26
|
+
* @Date: 2024-09-03 11:07
|
|
27
|
+
*/
|
|
28
|
+
declare const getDataByModel: <T extends keyof ModelsState, D extends keyof ModelsState[T]>(model: string, key?: D) => D extends undefined ? ModelsState[T] : ModelsState[T][D];
|
|
29
|
+
/**
|
|
30
|
+
* @title: 设置数据到store
|
|
31
|
+
* @description:
|
|
32
|
+
* @param {string} model
|
|
33
|
+
* @param {string} key
|
|
34
|
+
* @param {string} value
|
|
35
|
+
* @return {*}
|
|
36
|
+
* @Author: zhiwei.Wang
|
|
37
|
+
* @Date: 2024-09-08 15:17
|
|
38
|
+
*/
|
|
39
|
+
declare const setDataByModel: <T extends keyof ModelsState, D extends keyof ModelsState[T]>(model: string, key: any, value: any) => void;
|
|
40
|
+
declare const _default: {
|
|
41
|
+
getStore: () => Store;
|
|
42
|
+
StoreProvider: typeof StoreProvider;
|
|
43
|
+
setConfig: (models: any[]) => void;
|
|
44
|
+
};
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pisell/core-types",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "TypeScript type definitions for @pisell/core",
|
|
5
|
+
"main": "index.d.ts",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"typings": "index.d.ts",
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
10
|
+
},
|
|
11
|
+
"files": ["**/*.d.ts"],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
File without changes
|