@lm_fe/utils 0.1.201
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/README.md +31 -0
- package/dist/constant/base_number.d.ts +6 -0
- package/dist/constant/index.d.ts +17 -0
- package/dist/constant/modal_template_types.d.ts +4 -0
- package/dist/helper/AppEnv.d.ts +42 -0
- package/dist/helper/BaseWsService.d.ts +18 -0
- package/dist/helper/Browser.d.ts +20 -0
- package/dist/helper/EnumItem.d.ts +15 -0
- package/dist/helper/Event.d.ts +26 -0
- package/dist/helper/EventStore.d.ts +18 -0
- package/dist/helper/Request/Request.d.ts +41 -0
- package/dist/helper/Request/constant.d.ts +17 -0
- package/dist/helper/Request/index.d.ts +9 -0
- package/dist/helper/Request/types.d.ts +25 -0
- package/dist/helper/happyParse.d.ts +11 -0
- package/dist/helper/index.d.ts +13 -0
- package/dist/helper/json-helper.d.ts +1 -0
- package/dist/helper/log.d.ts +1 -0
- package/dist/helper/moment-help.d.ts +11 -0
- package/dist/helper/protocolCheck.d.ts +4 -0
- package/dist/helper/small-fn-old.d.ts +71 -0
- package/dist/helper/small-fn.d.ts +1 -0
- package/dist/helper/storage.d.ts +9 -0
- package/dist/helper/temp_reander.d.ts +6 -0
- package/dist/helper/typeHelper.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4698 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +1303 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# yargs-parser
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
The mighty option parser used by.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm i yargs-parser --save
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
**Node.js:**
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import parser from 'yargs-parser'
|
|
21
|
+
|
|
22
|
+
const argv = parser('--foo=99 --bar=9987930', {
|
|
23
|
+
string: ['bar']
|
|
24
|
+
})
|
|
25
|
+
console.log(argv)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
ISC
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const TOKEN_KEY = "\u03A3(\u3063 \u00B0\u0414 \u00B0;)\u3063";
|
|
2
|
+
export declare const EMPTY_PLACEHOLDER = "-";
|
|
3
|
+
export declare const ARG_URS1_KEY = "usr1";
|
|
4
|
+
export declare const ARG_URS2_KEY = "usr2";
|
|
5
|
+
export declare const ROMAN_NUMERALS: {
|
|
6
|
+
1: string;
|
|
7
|
+
2: string;
|
|
8
|
+
3: string;
|
|
9
|
+
4: string;
|
|
10
|
+
5: string;
|
|
11
|
+
6: string;
|
|
12
|
+
7: string;
|
|
13
|
+
8: string;
|
|
14
|
+
9: string;
|
|
15
|
+
10: string;
|
|
16
|
+
};
|
|
17
|
+
export * from './modal_template_types';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AnyObject, MyLog } from "@noah-libjs/utils";
|
|
2
|
+
export declare class AppEnv<T = string> {
|
|
3
|
+
static get singleton(): AppEnv;
|
|
4
|
+
_appName?: T;
|
|
5
|
+
_globalCache: {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
};
|
|
8
|
+
defineGlobalCacheProperty(k: string, d: PropertyDescriptor): void;
|
|
9
|
+
getGlobalCache<C extends Object>(k: string): any;
|
|
10
|
+
setGlobalCache(k: string, v: any): void;
|
|
11
|
+
tail_global_cache(k: string): AnyObject | null;
|
|
12
|
+
push_global_cache(k: string, v: AnyObject): number;
|
|
13
|
+
pop_global_cache(k: string): AnyObject | undefined;
|
|
14
|
+
_isDev?: boolean;
|
|
15
|
+
is(type: T): boolean;
|
|
16
|
+
in(types: T[]): boolean;
|
|
17
|
+
get isSp(): boolean;
|
|
18
|
+
get isDev(): boolean;
|
|
19
|
+
set isDev(value: boolean);
|
|
20
|
+
get appName(): T | undefined;
|
|
21
|
+
set appName(value: T | undefined);
|
|
22
|
+
logger: MyLog;
|
|
23
|
+
get store(): StoreJsAPI;
|
|
24
|
+
get tokenKey(): string;
|
|
25
|
+
get loginRememberKey(): string;
|
|
26
|
+
constructor(appName?: T);
|
|
27
|
+
get loginRemember(): AnyObject | undefined | null;
|
|
28
|
+
set loginRemember(value: AnyObject | undefined | null);
|
|
29
|
+
get token(): string | null;
|
|
30
|
+
set token(value: string | null);
|
|
31
|
+
get rawToken(): string | string[];
|
|
32
|
+
reload(path?: string): void;
|
|
33
|
+
open(url?: string | URL, target?: string, features?: string): Window | null;
|
|
34
|
+
logout(path?: string): void;
|
|
35
|
+
logout_clean(path?: string): void;
|
|
36
|
+
getToken(): string | null;
|
|
37
|
+
getTokenFromSearchParam(): string | null;
|
|
38
|
+
setTokenToSearchParam(url: URL): URL;
|
|
39
|
+
removeToken(): void;
|
|
40
|
+
get is_fullscreen(): boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const appEnv: AppEnv<"mchc_env">;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EventEmitter, MyLog } from "@noah-libjs/utils";
|
|
2
|
+
import ReconnectingWebSocket from "reconnecting-websocket";
|
|
3
|
+
import { WebSocketEventListenerMap } from "reconnecting-websocket/dist/events";
|
|
4
|
+
export declare class BaseWsService<T = any> extends EventEmitter<{
|
|
5
|
+
[x in keyof WebSocketEventListenerMap]: Parameters<WebSocketEventListenerMap[x]>;
|
|
6
|
+
} & {
|
|
7
|
+
data: [T];
|
|
8
|
+
}> {
|
|
9
|
+
wsService?: ReconnectingWebSocket;
|
|
10
|
+
protected _url: string;
|
|
11
|
+
protected _logger: MyLog;
|
|
12
|
+
constructor(url: string);
|
|
13
|
+
get isOpen(): boolean;
|
|
14
|
+
protected _send(data: any): void;
|
|
15
|
+
send(data: any): void;
|
|
16
|
+
protected _messageHandler(e: WebSocketEventMap['message']): void;
|
|
17
|
+
connect(): Promise<BaseWsService<T>>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const Browser: {
|
|
2
|
+
client: {
|
|
3
|
+
version: string;
|
|
4
|
+
clientHeight: number;
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
shell: () => string;
|
|
8
|
+
agent: string;
|
|
9
|
+
isIE: boolean;
|
|
10
|
+
isGecko: boolean;
|
|
11
|
+
isWebkit: boolean;
|
|
12
|
+
isStrict: boolean;
|
|
13
|
+
supportSubTitle: () => boolean;
|
|
14
|
+
supportScope: () => boolean;
|
|
15
|
+
ieVersion: () => any;
|
|
16
|
+
operaVersion: () => string | undefined;
|
|
17
|
+
versionFilter: (arg: any) => any;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const isIE: () => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface IGlobalEnumItem<T = string> {
|
|
2
|
+
label: T;
|
|
3
|
+
value: number;
|
|
4
|
+
}
|
|
5
|
+
export declare class EnumItem<T, V = any> extends Array<IGlobalEnumItem<T>> {
|
|
6
|
+
t: T;
|
|
7
|
+
v: V;
|
|
8
|
+
constructor(...data: any[]);
|
|
9
|
+
getValue(label?: T): number;
|
|
10
|
+
getValues(labels?: T[]): number[];
|
|
11
|
+
getLabel(value?: number): T;
|
|
12
|
+
getLabels(value2?: number[]): T[];
|
|
13
|
+
getMultiLabel(value?: string): T[];
|
|
14
|
+
}
|
|
15
|
+
export declare function genEnum<T extends Object>(data: T): EnumItem<keyof T, T[keyof T]>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { EventEmitter } from "@noah-libjs/utils";
|
|
2
|
+
export type EventCallback_Old = (data: any) => void;
|
|
3
|
+
export declare class EventEmitter_Old {
|
|
4
|
+
/**
|
|
5
|
+
* 事件集
|
|
6
|
+
*/
|
|
7
|
+
private static events;
|
|
8
|
+
private static getCb;
|
|
9
|
+
/**
|
|
10
|
+
* 分发事件
|
|
11
|
+
* @param event
|
|
12
|
+
* @param data
|
|
13
|
+
*/
|
|
14
|
+
static dispatch: (event: string, data?: any) => void;
|
|
15
|
+
/**
|
|
16
|
+
* 订阅事件
|
|
17
|
+
*/
|
|
18
|
+
static subscribe: (event: string, callback: EventCallback_Old) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 取消事件订阅
|
|
21
|
+
*/
|
|
22
|
+
static unSubscribe: (event: string, callback: EventCallback_Old) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const event: EventEmitter<{
|
|
25
|
+
[x: string]: any[];
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AnyObject, EventEmitter } from '@noah-libjs/utils';
|
|
2
|
+
export type TEventBus<T extends AnyObject> = {
|
|
3
|
+
bus: EventBus<T>;
|
|
4
|
+
};
|
|
5
|
+
export type TEventStore<T extends AnyObject> = TEventBus<T> & T;
|
|
6
|
+
export declare class EventBus<T extends AnyObject> extends EventEmitter<{
|
|
7
|
+
change: any;
|
|
8
|
+
}> {
|
|
9
|
+
private _data;
|
|
10
|
+
get data(): T;
|
|
11
|
+
set data(value: T);
|
|
12
|
+
key?: string;
|
|
13
|
+
constructor(key?: string, data?: T);
|
|
14
|
+
timeId?: NodeJS.Timeout;
|
|
15
|
+
private persisitEventStore;
|
|
16
|
+
private get genStorePersistKey();
|
|
17
|
+
}
|
|
18
|
+
export declare function makeEventStore<T extends AnyObject>(key?: string, data?: T): TEventStore<T>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AxiosError, AxiosInstance, AxiosResponse } from 'axios';
|
|
2
|
+
import { IRequest_ResponseError, IRequest_SpawnConfig, TRequest_PreReq, TRequest_SimpleReq } from './types';
|
|
3
|
+
import { EventEmitter, MyLog } from '@noah-libjs/utils';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export declare class Request extends EventEmitter<{
|
|
6
|
+
beforeRequest: any;
|
|
7
|
+
afterResponse: any;
|
|
8
|
+
responseErr: any;
|
|
9
|
+
message: [boolean, string, any];
|
|
10
|
+
}> {
|
|
11
|
+
ins: AxiosInstance;
|
|
12
|
+
constructor(config?: IRequest_SpawnConfig);
|
|
13
|
+
static CONFIG: {
|
|
14
|
+
successCode: number[];
|
|
15
|
+
};
|
|
16
|
+
static logger: MyLog;
|
|
17
|
+
static checkRTCode(res?: AxiosResponse<any>): boolean;
|
|
18
|
+
static genErrMsg(res?: AxiosResponse<any>, error?: AxiosError): string;
|
|
19
|
+
static createErr(res?: AxiosResponse<any>, error?: AxiosError): IRequest_ResponseError;
|
|
20
|
+
static getMsg(res?: AxiosResponse<{
|
|
21
|
+
data?: any;
|
|
22
|
+
code?: number;
|
|
23
|
+
msg?: string;
|
|
24
|
+
message?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
}>): any;
|
|
27
|
+
static getRemoteMessage(res?: AxiosResponse<any>): any;
|
|
28
|
+
static getHeaderMessage(res?: AxiosResponse<any>): string | undefined;
|
|
29
|
+
displayMsg(res: AxiosResponse<{
|
|
30
|
+
data?: any;
|
|
31
|
+
code?: number;
|
|
32
|
+
msg?: string;
|
|
33
|
+
}>): void;
|
|
34
|
+
spawn(spawnConfig?: IRequest_SpawnConfig): AxiosInstance;
|
|
35
|
+
gen(spawnConfig?: IRequest_SpawnConfig): AxiosInstance;
|
|
36
|
+
get: TRequest_SimpleReq;
|
|
37
|
+
delete: TRequest_SimpleReq;
|
|
38
|
+
head: TRequest_SimpleReq;
|
|
39
|
+
post: TRequest_PreReq;
|
|
40
|
+
put: TRequest_PreReq;
|
|
41
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const codeMessage: {
|
|
2
|
+
200: string;
|
|
3
|
+
201: string;
|
|
4
|
+
202: string;
|
|
5
|
+
204: string;
|
|
6
|
+
400: string;
|
|
7
|
+
401: string;
|
|
8
|
+
403: string;
|
|
9
|
+
404: string;
|
|
10
|
+
406: string;
|
|
11
|
+
410: string;
|
|
12
|
+
422: string;
|
|
13
|
+
500: string;
|
|
14
|
+
502: string;
|
|
15
|
+
503: string;
|
|
16
|
+
504: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { Request } from './Request';
|
|
3
|
+
export * from './types';
|
|
4
|
+
export { codeMessage } from './constant';
|
|
5
|
+
export { Request };
|
|
6
|
+
export declare const request: Request;
|
|
7
|
+
export declare const rawRequest: AxiosInstance;
|
|
8
|
+
export declare const asRequest: Request;
|
|
9
|
+
export declare const fubaoRequest: Request;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
export interface IRequest_AxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
|
|
3
|
+
logger?: boolean;
|
|
4
|
+
unboxing?: boolean;
|
|
5
|
+
showMsg?: boolean;
|
|
6
|
+
successText?: string;
|
|
7
|
+
errText?: string;
|
|
8
|
+
ignore_usr?: boolean;
|
|
9
|
+
ignore_env?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface IRequest_ResponseError<D = any> {
|
|
12
|
+
msg: string;
|
|
13
|
+
data?: D;
|
|
14
|
+
status?: number;
|
|
15
|
+
url?: string;
|
|
16
|
+
error?: AxiosError<any, any>;
|
|
17
|
+
}
|
|
18
|
+
export interface IRequest_SpawnConfig {
|
|
19
|
+
config?: IRequest_AxiosRequestConfig;
|
|
20
|
+
onRequest?(value: IRequest_AxiosRequestConfig): IRequest_AxiosRequestConfig;
|
|
21
|
+
onResponse?(value: AxiosResponse): any;
|
|
22
|
+
onRejected?(err: IRequest_ResponseError): Promise<any>;
|
|
23
|
+
}
|
|
24
|
+
export type TRequest_SimpleReq = <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: IRequest_AxiosRequestConfig<D>) => Promise<R>;
|
|
25
|
+
export type TRequest_PreReq = <T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: IRequest_AxiosRequestConfig<D>) => Promise<R>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function getHappyConfig(pathname?: string): {
|
|
2
|
+
path: string;
|
|
3
|
+
args: string[];
|
|
4
|
+
search: string;
|
|
5
|
+
usr1: string;
|
|
6
|
+
usr2: string;
|
|
7
|
+
} | null;
|
|
8
|
+
export declare function genHappyPath(path: string, arg?: string[], search?: string): string;
|
|
9
|
+
export declare function get_global_happy_arg(key: 'usr1' | 'usr2'): any;
|
|
10
|
+
export declare function transmit_happy(path: string, search?: string): string;
|
|
11
|
+
export declare function transmit_happy_pre(url: string, pre?: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './Event';
|
|
2
|
+
export * from './EventStore';
|
|
3
|
+
export * from "./AppEnv";
|
|
4
|
+
export * from "./Request";
|
|
5
|
+
export * from "./EnumItem";
|
|
6
|
+
export * from "./moment-help";
|
|
7
|
+
export * from "./BaseWsService";
|
|
8
|
+
export * from './small-fn';
|
|
9
|
+
export * from './small-fn-old';
|
|
10
|
+
export * from './Browser';
|
|
11
|
+
export * from './happyParse';
|
|
12
|
+
export * from './protocolCheck';
|
|
13
|
+
export * from './temp_reander';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
export declare function formatRangeDate(data: {
|
|
3
|
+
[x: string]: Dayjs[] | null;
|
|
4
|
+
}, cKeys?: string[]): {
|
|
5
|
+
[x: string]: string | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function formatRangeDateTime(data: {
|
|
8
|
+
[x: string]: Dayjs[] | null;
|
|
9
|
+
}, cKeys?: string[]): {
|
|
10
|
+
[x: string]: string | null;
|
|
11
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import dayjs, { Dayjs } from "dayjs";
|
|
2
|
+
/**
|
|
3
|
+
* 计算BMI
|
|
4
|
+
*/
|
|
5
|
+
export declare function getBMI(weight: number, height: number): string | 0;
|
|
6
|
+
/**
|
|
7
|
+
* 计算孕周
|
|
8
|
+
* gesDate:预产期-B超
|
|
9
|
+
* date:产检/报告日期
|
|
10
|
+
*/
|
|
11
|
+
export declare function getGesWeek(gesDate: string, date: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* 计算停经孕周
|
|
14
|
+
* @param checkData 当前日期
|
|
15
|
+
* @param lmp 末次月经
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare const menopauseWeek: (checkData: string, lmp: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* 计算孕周对应的天数
|
|
21
|
+
*/
|
|
22
|
+
export declare function getGestationalDays(gestationalWeek: string): number;
|
|
23
|
+
/**
|
|
24
|
+
* 获取本周五、下周五、下下周五时间
|
|
25
|
+
*/
|
|
26
|
+
export declare function getOrderTime(orderDate: '本周五' | '下周五' | '下下周五'): dayjs.Dayjs;
|
|
27
|
+
/**
|
|
28
|
+
* 根据末次月经计算预产期B超
|
|
29
|
+
*/
|
|
30
|
+
export declare function getExpected(date: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* 计算两个日期相隔的年数
|
|
33
|
+
*/
|
|
34
|
+
export declare function getDiffYears(date: string, preDate: string): number;
|
|
35
|
+
/**
|
|
36
|
+
* 获取两个字符串日期 YYYY-MM-dd 间隔的天数
|
|
37
|
+
* 始终返回一个正数
|
|
38
|
+
*/
|
|
39
|
+
export declare const getDays: (str1: string, str2: string) => number;
|
|
40
|
+
/**
|
|
41
|
+
* 根据 预产期B超 日期获取孕周
|
|
42
|
+
* 得出 ${孕周周数}+${孕周天数}
|
|
43
|
+
* 预产期B超
|
|
44
|
+
*/
|
|
45
|
+
export declare const getGestationalWeekBySureEdd: (sureEdd: string) => string;
|
|
46
|
+
/**
|
|
47
|
+
* 根据末次月经计算预产期B超
|
|
48
|
+
*/
|
|
49
|
+
export declare function calEddByLmp(lmp: Dayjs): dayjs.Dayjs;
|
|
50
|
+
/**根据出生日期计算年龄 */
|
|
51
|
+
export declare function GetAgeByBirthDay(strBirthday: string): number | null;
|
|
52
|
+
export declare const getDataSource: (url: string, params: object, processFromApi?: (v: any) => any) => Promise<{
|
|
53
|
+
count: string;
|
|
54
|
+
data: any;
|
|
55
|
+
}>;
|
|
56
|
+
export declare function gen_id_form_item_config(name?: string): {
|
|
57
|
+
inputType: "id";
|
|
58
|
+
dataIndex: string;
|
|
59
|
+
name: string;
|
|
60
|
+
};
|
|
61
|
+
export declare const calGestationalWeekByLmp: (lmp: Dayjs, defaultDate?: dayjs.Dayjs) => string;
|
|
62
|
+
export declare const calGestationalWeekBySureEdd: (sureEdd: any, defaultDate?: dayjs.Dayjs) => string | number;
|
|
63
|
+
export declare function format_gp(data: {
|
|
64
|
+
gravidity?: any;
|
|
65
|
+
parity?: any;
|
|
66
|
+
}): string;
|
|
67
|
+
export declare function unmarshalGestationWeek(weekStr?: string): {
|
|
68
|
+
week: number;
|
|
69
|
+
day: number;
|
|
70
|
+
};
|
|
71
|
+
export declare function marshalGestationWeek(week?: string | number, day?: string | number): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTimeSlice(hour?: number, isShowSecond?: boolean): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED