@wzyjs/utils 0.2.20 → 0.2.26
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/cjs/common/dayjs.d.ts +19 -0
- package/dist/esm/common/dayjs.d.ts +19 -0
- package/package.json +3 -3
- package/dist/cjs/browser/element.d.ts +0 -9
- package/dist/cjs/browser/other.d.ts +0 -1
- package/dist/cjs/browser/style.d.ts +0 -10
- package/dist/cjs/common/array.d.ts +0 -2
- package/dist/cjs/common/classs.d.ts +0 -5
- package/dist/cjs/common/number.d.ts +0 -4
- package/dist/cjs/common/object.d.ts +0 -10
- package/dist/cjs/common/other.d.ts +0 -25
- package/dist/cjs/common/string.d.ts +0 -21
- package/dist/cjs/node/index.d.ts +0 -4
- package/dist/cjs/node/jsonFile/config.json +0 -8
- package/dist/cjs/node/jsonFile/index.d.ts +0 -7
- package/dist/cjs/node/mail/index.d.ts +0 -1
- package/dist/esm/browser/element.d.ts +0 -9
- package/dist/esm/browser/other.d.ts +0 -1
- package/dist/esm/browser/style.d.ts +0 -10
- package/dist/esm/common/array.d.ts +0 -2
- package/dist/esm/common/classs.d.ts +0 -5
- package/dist/esm/common/number.d.ts +0 -4
- package/dist/esm/common/object.d.ts +0 -10
- package/dist/esm/common/other.d.ts +0 -25
- package/dist/esm/common/string.d.ts +0 -21
- package/dist/esm/node/index.d.ts +0 -4
- package/dist/esm/node/jsonFile/index.d.ts +0 -7
- package/dist/esm/node/mail/index.d.ts +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import isBetween from 'dayjs/plugin/isBetween';
|
|
3
|
+
import updateLocale from 'dayjs/plugin/updateLocale';
|
|
4
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
5
|
+
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
6
|
+
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
7
|
+
import 'dayjs/locale/zh-cn';
|
|
8
|
+
export declare enum Timezone {
|
|
9
|
+
AsiaShanghai = "Asia/Shanghai"
|
|
10
|
+
}
|
|
11
|
+
export { Dayjs } from 'dayjs';
|
|
12
|
+
declare const _default: typeof dayjs & {
|
|
13
|
+
isBetween: typeof isBetween;
|
|
14
|
+
isSameOrAfter: typeof isSameOrAfter;
|
|
15
|
+
isSameOrBefore: typeof isSameOrBefore;
|
|
16
|
+
tz: typeof timezone;
|
|
17
|
+
updateLocale: typeof updateLocale;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import isBetween from 'dayjs/plugin/isBetween';
|
|
3
|
+
import updateLocale from 'dayjs/plugin/updateLocale';
|
|
4
|
+
import timezone from 'dayjs/plugin/timezone';
|
|
5
|
+
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
|
|
6
|
+
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
7
|
+
import 'dayjs/locale/zh-cn';
|
|
8
|
+
export declare enum Timezone {
|
|
9
|
+
AsiaShanghai = "Asia/Shanghai"
|
|
10
|
+
}
|
|
11
|
+
export { Dayjs } from 'dayjs';
|
|
12
|
+
declare const _default: typeof dayjs & {
|
|
13
|
+
isBetween: typeof isBetween;
|
|
14
|
+
isSameOrAfter: typeof isSameOrAfter;
|
|
15
|
+
isSameOrBefore: typeof isSameOrBefore;
|
|
16
|
+
tz: typeof timezone;
|
|
17
|
+
updateLocale: typeof updateLocale;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzyjs/utils",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"description": "description",
|
|
5
5
|
"author": "wzy",
|
|
6
6
|
"scripts": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"classnames": "^2.3.2",
|
|
37
37
|
"consola": "^2.15.3",
|
|
38
38
|
"copy-to-clipboard": "^3.3.3",
|
|
39
|
-
"dayjs": "^1.11.
|
|
39
|
+
"dayjs": "^1.11.12",
|
|
40
40
|
"fs-extra": "^11.2.0",
|
|
41
41
|
"localforage": "^1.10.0",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"type": "git",
|
|
65
65
|
"url": "https://gitee.com/wang-zhenyu/app.git"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "495360e8f5a4e726be716ca842c769fa3ca3a6b2"
|
|
68
68
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const scrollIntoView: (el: Element, option?: ScrollIntoViewOptions) => void;
|
|
2
|
-
export declare const getElement: (el: string | Element) => {
|
|
3
|
-
element: null;
|
|
4
|
-
originalStyle: {};
|
|
5
|
-
} | {
|
|
6
|
-
element: Element;
|
|
7
|
-
originalStyle: CSSStyleDeclaration;
|
|
8
|
-
};
|
|
9
|
-
export declare const isElementInViewport: (el: string | Element) => boolean | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const readClipboard: () => Promise<string>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const hexToRgba: (hexColor: string, a?: number) => {
|
|
2
|
-
nums: {
|
|
3
|
-
red: number;
|
|
4
|
-
green: number;
|
|
5
|
-
blue: number;
|
|
6
|
-
};
|
|
7
|
-
text: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const flashBackground: (el: string | Element, color: string, a?: number) => void;
|
|
10
|
-
export declare const flashBorder: (el: string | Element, color: string, a?: number) => void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const getRandomNum: (min: number, max: number) => number;
|
|
2
|
-
export declare const limitDecimals: (v: string, num: number | undefined, isForce: boolean) => string;
|
|
3
|
-
export declare const getFileSize: (size: number) => string;
|
|
4
|
-
export declare const isValidNumber: (value: any) => boolean;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const findItem: <I>(list: I[], attr: keyof I, value?: I[keyof I] | undefined) => I | undefined;
|
|
2
|
-
export declare const filterParams: (params: {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}) => any;
|
|
5
|
-
export declare const watch: {
|
|
6
|
-
observe(obj: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}, key: string, watchFun: (value: any, val: any) => undefined): void;
|
|
9
|
-
setWatcher(data?: {}, watch?: any): void;
|
|
10
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { FilterParams, Order, Pagination, SortParams, Where } from '@wzyjs/types';
|
|
2
|
-
export declare const handleParams: <I>(params: Pagination & I, sort: SortParams, filter: FilterParams, additional?: Where) => {
|
|
3
|
-
where?: Where | undefined;
|
|
4
|
-
order?: Order | undefined;
|
|
5
|
-
pagination?: Pagination | undefined;
|
|
6
|
-
};
|
|
7
|
-
export declare const handleRes2List: <D>(reqPromise: any) => Promise<{
|
|
8
|
-
label: string;
|
|
9
|
-
value: string;
|
|
10
|
-
}[]>;
|
|
11
|
-
export declare const executePromise: (promise: Promise<any>) => Promise<{
|
|
12
|
-
result: any;
|
|
13
|
-
time: number;
|
|
14
|
-
}>;
|
|
15
|
-
export declare const locationFn: {
|
|
16
|
-
url2Params: (url?: string) => {
|
|
17
|
-
[key: string]: string;
|
|
18
|
-
};
|
|
19
|
-
params2Url: (params: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}) => string;
|
|
22
|
-
setUrlParams: (key: string, value: any, keepName: string) => void;
|
|
23
|
-
urlGetPath: (url?: string) => string;
|
|
24
|
-
};
|
|
25
|
-
export declare const delay: (time?: number) => Promise<unknown>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare const getChineseByStr: (str: string) => string;
|
|
2
|
-
export declare const getStrLength: (value: string) => number;
|
|
3
|
-
export declare const replaceAll: (str: string, searchValue: string, replaceValue: string) => string;
|
|
4
|
-
export declare const replaceByRules: (str: string, rules: [
|
|
5
|
-
string,
|
|
6
|
-
string
|
|
7
|
-
][]) => string;
|
|
8
|
-
export declare const getType: (value: any) => string;
|
|
9
|
-
export declare const amount: (str: string) => string;
|
|
10
|
-
export declare const jsonParse: (value: string | object) => object;
|
|
11
|
-
export declare const isJson: (str: string) => boolean;
|
|
12
|
-
export declare const toString: (value: any) => string;
|
|
13
|
-
export declare const getRandomColor: () => string;
|
|
14
|
-
export declare const getRandomString: (length?: number) => string;
|
|
15
|
-
export declare const getChinese: (str: string) => string;
|
|
16
|
-
export declare const getSliceStr: (str: string, before: string, after: string) => string;
|
|
17
|
-
export declare const getProxyUrl: (url: string) => string;
|
|
18
|
-
export declare const getLength: (value: string) => number;
|
|
19
|
-
export declare const getCookie: (name: string) => string | null;
|
|
20
|
-
export declare const generateAlphabetArray: (n: number) => string[];
|
|
21
|
-
export declare const levenshteinDistance: (a: string, b: string) => number;
|
package/dist/cjs/node/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sendMail: (toEmail: string, title: string, content?: string) => Promise<string>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const scrollIntoView: (el: Element, option?: ScrollIntoViewOptions) => void;
|
|
2
|
-
export declare const getElement: (el: string | Element) => {
|
|
3
|
-
element: null;
|
|
4
|
-
originalStyle: {};
|
|
5
|
-
} | {
|
|
6
|
-
element: Element;
|
|
7
|
-
originalStyle: CSSStyleDeclaration;
|
|
8
|
-
};
|
|
9
|
-
export declare const isElementInViewport: (el: string | Element) => boolean | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const readClipboard: () => Promise<string>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const hexToRgba: (hexColor: string, a?: number) => {
|
|
2
|
-
nums: {
|
|
3
|
-
red: number;
|
|
4
|
-
green: number;
|
|
5
|
-
blue: number;
|
|
6
|
-
};
|
|
7
|
-
text: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const flashBackground: (el: string | Element, color: string, a?: number) => void;
|
|
10
|
-
export declare const flashBorder: (el: string | Element, color: string, a?: number) => void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const getRandomNum: (min: number, max: number) => number;
|
|
2
|
-
export declare const limitDecimals: (v: string, num: number | undefined, isForce: boolean) => string;
|
|
3
|
-
export declare const getFileSize: (size: number) => string;
|
|
4
|
-
export declare const isValidNumber: (value: any) => boolean;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const findItem: <I>(list: I[], attr: keyof I, value?: I[keyof I] | undefined) => I | undefined;
|
|
2
|
-
export declare const filterParams: (params: {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}) => any;
|
|
5
|
-
export declare const watch: {
|
|
6
|
-
observe(obj: {
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}, key: string, watchFun: (value: any, val: any) => undefined): void;
|
|
9
|
-
setWatcher(data?: {}, watch?: any): void;
|
|
10
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { FilterParams, Order, Pagination, SortParams, Where } from '@wzyjs/types';
|
|
2
|
-
export declare const handleParams: <I>(params: Pagination & I, sort: SortParams, filter: FilterParams, additional?: Where) => {
|
|
3
|
-
where?: Where | undefined;
|
|
4
|
-
order?: Order | undefined;
|
|
5
|
-
pagination?: Pagination | undefined;
|
|
6
|
-
};
|
|
7
|
-
export declare const handleRes2List: <D>(reqPromise: any) => Promise<{
|
|
8
|
-
label: string;
|
|
9
|
-
value: string;
|
|
10
|
-
}[]>;
|
|
11
|
-
export declare const executePromise: (promise: Promise<any>) => Promise<{
|
|
12
|
-
result: any;
|
|
13
|
-
time: number;
|
|
14
|
-
}>;
|
|
15
|
-
export declare const locationFn: {
|
|
16
|
-
url2Params: (url?: string) => {
|
|
17
|
-
[key: string]: string;
|
|
18
|
-
};
|
|
19
|
-
params2Url: (params: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
}) => string;
|
|
22
|
-
setUrlParams: (key: string, value: any, keepName: string) => void;
|
|
23
|
-
urlGetPath: (url?: string) => string;
|
|
24
|
-
};
|
|
25
|
-
export declare const delay: (time?: number) => Promise<unknown>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare const getChineseByStr: (str: string) => string;
|
|
2
|
-
export declare const getStrLength: (value: string) => number;
|
|
3
|
-
export declare const replaceAll: (str: string, searchValue: string, replaceValue: string) => string;
|
|
4
|
-
export declare const replaceByRules: (str: string, rules: [
|
|
5
|
-
string,
|
|
6
|
-
string
|
|
7
|
-
][]) => string;
|
|
8
|
-
export declare const getType: (value: any) => string;
|
|
9
|
-
export declare const amount: (str: string) => string;
|
|
10
|
-
export declare const jsonParse: (value: string | object) => object;
|
|
11
|
-
export declare const isJson: (str: string) => boolean;
|
|
12
|
-
export declare const toString: (value: any) => string;
|
|
13
|
-
export declare const getRandomColor: () => string;
|
|
14
|
-
export declare const getRandomString: (length?: number) => string;
|
|
15
|
-
export declare const getChinese: (str: string) => string;
|
|
16
|
-
export declare const getSliceStr: (str: string, before: string, after: string) => string;
|
|
17
|
-
export declare const getProxyUrl: (url: string) => string;
|
|
18
|
-
export declare const getLength: (value: string) => number;
|
|
19
|
-
export declare const getCookie: (name: string) => string | null;
|
|
20
|
-
export declare const generateAlphabetArray: (n: number) => string[];
|
|
21
|
-
export declare const levenshteinDistance: (a: string, b: string) => number;
|
package/dist/esm/node/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sendMail: (toEmail: string, title: string, content?: string) => Promise<string>;
|