vdrag-topo-utils 1.1.0 → 1.4.0
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/es/index.d.ts +1 -0
- package/dist/es/index.js +66 -60
- package/dist/es/src/app.d.ts +33 -0
- package/dist/es/src/app.js +184 -0
- package/dist/es/src/browser.d.ts +1 -9
- package/dist/es/src/browser.js +25 -29
- package/dist/es/src/http.d.ts +3 -0
- package/dist/es/src/image.d.ts +2 -0
- package/dist/es/src/string.d.ts +2 -2
- package/dist/es/src/time.d.ts +3 -3
- package/dist/es/src/time.js +3 -3
- package/dist/es/src/type.d.ts +3 -0
- package/dist/es/types/global.d.ts +9 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -1
- package/dist/lib/src/app.d.ts +33 -0
- package/dist/lib/src/app.js +1 -0
- package/dist/lib/src/browser.d.ts +1 -9
- package/dist/lib/src/browser.js +1 -1
- package/dist/lib/src/http.d.ts +3 -0
- package/dist/lib/src/image.d.ts +2 -0
- package/dist/lib/src/string.d.ts +2 -2
- package/dist/lib/src/time.d.ts +3 -3
- package/dist/lib/src/time.js +1 -1
- package/dist/lib/src/type.d.ts +3 -0
- package/dist/lib/types/global.d.ts +9 -0
- package/package.json +1 -1
package/dist/es/index.d.ts
CHANGED
package/dist/es/index.js
CHANGED
|
@@ -1,72 +1,78 @@
|
|
|
1
1
|
import { default as r } from "./src/withinstall.js";
|
|
2
2
|
import { default as a } from "./src/bus.js";
|
|
3
|
-
import { UA as l, _global as m, _support as s,
|
|
4
|
-
import { addBigBraceToStr as
|
|
5
|
-
import { formatDate as
|
|
6
|
-
import { isExistProperty as
|
|
7
|
-
import { replaceAop as
|
|
8
|
-
import { fromHttpStatus as
|
|
9
|
-
import { addEventListener as
|
|
10
|
-
import { formatDecimal as ge, random as
|
|
11
|
-
import { imgError as
|
|
3
|
+
import { UA as l, _global as m, _support as s, customizeSetInterval as n, debounce as p, getClientHeight as g, getGlobal as d, getGlobalSupport as f, getLocationHref as c, getScrollHeight as x, getScrollTop as S, getUrlParam as h, htmlElementAsString as u, inBrowser as v, is360zhushou as D, isAndroid as E, isChrome as y, isEdge as b, isIE as I, isIE9 as T, isIOS as B, isMobile as C, isWeiXin as F, matchUrlFileName as P, nativeTryCatch as U, parseUrlToObj as w, supportsHistory as H, throttle as _, throttle_02 as A } from "./src/browser.js";
|
|
4
|
+
import { addBigBraceToStr as L, addMiddleBraceToStr as M, extractStrFromCurlyBrace as k, extractStrFromMiddleBrace as z, interceptStr as N, unknownToString as O, validateEmail as j, validateFixedPhone as W, validatePhone as X, validateSpecialString_01 as q } from "./src/string.js";
|
|
5
|
+
import { formatDate as K, formatDate_02 as Q, generateUUID as R, getDaysDiffBetweenDates as V, getDaysDiffFromNow as Y, getTimestamp as Z } from "./src/time.js";
|
|
6
|
+
import { isExistProperty as ee, variableTypeDetection as te } from "./src/type.js";
|
|
7
|
+
import { replaceAop as oe } from "./src/object.js";
|
|
8
|
+
import { fromHttpStatus as ie } from "./src/http.js";
|
|
9
|
+
import { addEventListener as me, removeEventListener as se, triggerDragEvent as ne } from "./src/dom.js";
|
|
10
|
+
import { formatDecimal as ge, random as de } from "./src/number.js";
|
|
11
|
+
import { imgError as ce, preloadImage as xe } from "./src/image.js";
|
|
12
|
+
import { galleryImg as he, getContacts as ue, savePicture as ve, scanCode as De, scanFromGallery as Ee, takePhoto as ye } from "./src/app.js";
|
|
12
13
|
export {
|
|
13
14
|
l as UA,
|
|
14
15
|
m as _global,
|
|
15
16
|
s as _support,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
G as addMiddleBraceToStr,
|
|
17
|
+
L as addBigBraceToStr,
|
|
18
|
+
me as addEventListener,
|
|
19
|
+
M as addMiddleBraceToStr,
|
|
20
20
|
a as bus,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
n as customizeSetInterval,
|
|
22
|
+
p as debounce,
|
|
23
|
+
k as extractStrFromCurlyBrace,
|
|
24
|
+
z as extractStrFromMiddleBrace,
|
|
25
|
+
K as formatDate,
|
|
26
|
+
Q as formatDate_02,
|
|
27
27
|
ge as formatDecimal,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
ie as fromHttpStatus,
|
|
29
|
+
he as galleryImg,
|
|
30
|
+
R as generateUUID,
|
|
30
31
|
g as getClientHeight,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
y as
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
I as
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
ue as getContacts,
|
|
33
|
+
V as getDaysDiffBetweenDates,
|
|
34
|
+
Y as getDaysDiffFromNow,
|
|
35
|
+
d as getGlobal,
|
|
36
|
+
f as getGlobalSupport,
|
|
37
|
+
c as getLocationHref,
|
|
38
|
+
x as getScrollHeight,
|
|
39
|
+
S as getScrollTop,
|
|
40
|
+
Z as getTimestamp,
|
|
41
|
+
h as getUrlParam,
|
|
42
|
+
u as htmlElementAsString,
|
|
43
|
+
ce as imgError,
|
|
44
|
+
v as inBrowser,
|
|
45
|
+
N as interceptStr,
|
|
46
|
+
D as is360zhushou,
|
|
47
|
+
E as isAndroid,
|
|
48
|
+
y as isChrome,
|
|
49
|
+
b as isEdge,
|
|
50
|
+
ee as isExistProperty,
|
|
51
|
+
I as isIE,
|
|
52
|
+
T as isIE9,
|
|
53
|
+
B as isIOS,
|
|
54
|
+
C as isMobile,
|
|
53
55
|
F as isWeiXin,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
P as matchUrlFileName,
|
|
57
|
+
U as nativeTryCatch,
|
|
58
|
+
w as parseUrlToObj,
|
|
59
|
+
xe as preloadImage,
|
|
60
|
+
de as random,
|
|
61
|
+
se as removeEventListener,
|
|
62
|
+
oe as replaceAop,
|
|
63
|
+
ve as savePicture,
|
|
64
|
+
De as scanCode,
|
|
65
|
+
Ee as scanFromGallery,
|
|
66
|
+
H as supportsHistory,
|
|
67
|
+
ye as takePhoto,
|
|
68
|
+
_ as throttle,
|
|
69
|
+
A as throttle_02,
|
|
70
|
+
ne as triggerDragEvent,
|
|
71
|
+
O as unknownToString,
|
|
72
|
+
j as validateEmail,
|
|
73
|
+
W as validateFixedPhone,
|
|
74
|
+
X as validatePhone,
|
|
75
|
+
q as validateSpecialString_01,
|
|
76
|
+
te as variableTypeDetection,
|
|
71
77
|
r as withInstall
|
|
72
78
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare interface IParamsType {
|
|
2
|
+
style?: any;
|
|
3
|
+
count?: any;
|
|
4
|
+
filePath?: any;
|
|
5
|
+
success: () => void;
|
|
6
|
+
fail: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 开启扫码功能
|
|
10
|
+
*/
|
|
11
|
+
export declare const scanCode: (params: IParamsType) => any;
|
|
12
|
+
/**
|
|
13
|
+
* 从相册中扫码
|
|
14
|
+
*/
|
|
15
|
+
export declare const scanFromGallery: (params: IParamsType) => void;
|
|
16
|
+
/**
|
|
17
|
+
* 拍照
|
|
18
|
+
*/
|
|
19
|
+
export declare const takePhoto: (params: IParamsType) => void;
|
|
20
|
+
/**
|
|
21
|
+
* 从相册中选选取照片
|
|
22
|
+
*/
|
|
23
|
+
export declare const galleryImg: (params: IParamsType) => void;
|
|
24
|
+
/**
|
|
25
|
+
* 保存图片到相册中
|
|
26
|
+
*/
|
|
27
|
+
export declare const savePicture: (params: IParamsType) => false | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* 调用户的通信录
|
|
30
|
+
* @param params
|
|
31
|
+
*/
|
|
32
|
+
export declare const getContacts: (params: IParamsType) => void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
function l(e, t) {
|
|
2
|
+
try {
|
|
3
|
+
return typeof e.success == "function" ? (e.success(t), !0) : !1;
|
|
4
|
+
} catch (n) {
|
|
5
|
+
alert("回调函数异常:"), alert(n);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
function c(e, t) {
|
|
9
|
+
return typeof e.fail == "function" ? (e.fail(t), !0) : !1;
|
|
10
|
+
}
|
|
11
|
+
const d = (e) => {
|
|
12
|
+
let t;
|
|
13
|
+
e = e || {};
|
|
14
|
+
const n = {
|
|
15
|
+
background: "#000",
|
|
16
|
+
frameColor: "#07c160",
|
|
17
|
+
scanbarColor: "#07c160",
|
|
18
|
+
top: "100px",
|
|
19
|
+
left: "0px",
|
|
20
|
+
width: "100%",
|
|
21
|
+
height: "500px",
|
|
22
|
+
position: "static"
|
|
23
|
+
}, o = e.style || {};
|
|
24
|
+
for (const i in o)
|
|
25
|
+
n[i] = o[i];
|
|
26
|
+
return t || (t = window.plus.barcode.create(
|
|
27
|
+
"barcode",
|
|
28
|
+
[window.plus.barcode.QR],
|
|
29
|
+
n
|
|
30
|
+
), t.onmarked = function(i, u) {
|
|
31
|
+
l(e, u), t || alert("尚未开始扫码"), t.close(), t = null;
|
|
32
|
+
}, t.onerror = function(i) {
|
|
33
|
+
c(e, i), t || alert("尚未开始扫码"), t.close(), t = null;
|
|
34
|
+
}, window.plus.webview.currentWebview().append(t)), t.start(), t;
|
|
35
|
+
}, w = (e) => {
|
|
36
|
+
e = e || {}, window.plus.gallery.pick(
|
|
37
|
+
function(t) {
|
|
38
|
+
window.plus.barcode.scan(
|
|
39
|
+
t,
|
|
40
|
+
function(n, o) {
|
|
41
|
+
l(e, o);
|
|
42
|
+
},
|
|
43
|
+
function(n) {
|
|
44
|
+
c(e, n);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
function(t) {
|
|
49
|
+
c(e, t);
|
|
50
|
+
},
|
|
51
|
+
{ filter: "image", system: !1 }
|
|
52
|
+
);
|
|
53
|
+
}, a = (e) => {
|
|
54
|
+
e = e || {};
|
|
55
|
+
const t = window.plus.camera.getCamera(), n = t.supportedImageResolutions[0], o = t.supportedImageFormats[0];
|
|
56
|
+
t.captureImage(
|
|
57
|
+
function(i) {
|
|
58
|
+
l(e, i);
|
|
59
|
+
},
|
|
60
|
+
function(i) {
|
|
61
|
+
c(e, i);
|
|
62
|
+
},
|
|
63
|
+
{ resolution: n, format: o }
|
|
64
|
+
);
|
|
65
|
+
}, g = (e) => {
|
|
66
|
+
e = e || {}, e.count = e.count || "Infinity", window.plus.gallery.pick(
|
|
67
|
+
function(t) {
|
|
68
|
+
const n = t.files;
|
|
69
|
+
n && n.length == 1 ? l(e, n[0]) : l(e, n);
|
|
70
|
+
},
|
|
71
|
+
function(t) {
|
|
72
|
+
c(e, t);
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
filter: "image",
|
|
76
|
+
multiple: !0,
|
|
77
|
+
maximum: e.count,
|
|
78
|
+
system: !1,
|
|
79
|
+
onmaxed: function() {
|
|
80
|
+
window.plus.nativeUI.alert("最多只能选择" + e.count + "张图片");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}, y = (e) => {
|
|
85
|
+
e = e || {};
|
|
86
|
+
const t = e.filePath;
|
|
87
|
+
if (!t)
|
|
88
|
+
return alert("请传入要下载的图片路径"), !1;
|
|
89
|
+
t.indexOf("data:image/") == 0 ? s(t, e, function(n) {
|
|
90
|
+
window.plus.gallery.save(
|
|
91
|
+
n,
|
|
92
|
+
function(o) {
|
|
93
|
+
l(e, o.file);
|
|
94
|
+
},
|
|
95
|
+
function(o) {
|
|
96
|
+
c(e, o);
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}) : r({
|
|
100
|
+
url: t,
|
|
101
|
+
success: function(n) {
|
|
102
|
+
window.plus.gallery.save(
|
|
103
|
+
n,
|
|
104
|
+
function(o) {
|
|
105
|
+
l(e, o.file);
|
|
106
|
+
},
|
|
107
|
+
function(o) {
|
|
108
|
+
c(e, o);
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
},
|
|
112
|
+
fail: function(n) {
|
|
113
|
+
c(e, n);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
function s(e, t, n) {
|
|
118
|
+
const o = new window.plus.nativeObj.Bitmap();
|
|
119
|
+
o.loadBase64Data(e);
|
|
120
|
+
const i = e.indexOf("png") > -1 ? ".png" : ".jpeg", u = (/* @__PURE__ */ new Date()).getTime() + i;
|
|
121
|
+
o.save(
|
|
122
|
+
"_www/" + u,
|
|
123
|
+
{ overwrite: !0 },
|
|
124
|
+
function() {
|
|
125
|
+
n("_www/" + u);
|
|
126
|
+
},
|
|
127
|
+
function(f) {
|
|
128
|
+
c(t, f);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
function r(e) {
|
|
133
|
+
e = e || {};
|
|
134
|
+
const t = e.url;
|
|
135
|
+
if (!t)
|
|
136
|
+
return alert("请输入下载文件的链接"), !1;
|
|
137
|
+
const n = window.plus.downloader.createDownload(t, {}, function(o, i) {
|
|
138
|
+
i == 200 ? l(e, o.filename) : c(e, o);
|
|
139
|
+
});
|
|
140
|
+
return n.addEventListener(
|
|
141
|
+
"statechanged",
|
|
142
|
+
function(o, i) {
|
|
143
|
+
if (o.state == 3) {
|
|
144
|
+
const u = parseFloat(
|
|
145
|
+
o.downloadedSize / o.totalSize * 100
|
|
146
|
+
).toFixed(2);
|
|
147
|
+
typeof e.onProgress == "function" && e.onProgress(
|
|
148
|
+
n.downloadedSize,
|
|
149
|
+
n.totalSize,
|
|
150
|
+
u + "%"
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
!1
|
|
155
|
+
), n.start(), n;
|
|
156
|
+
}
|
|
157
|
+
const b = (e) => {
|
|
158
|
+
e = e || {}, window.plus.contacts.getAddressBook(
|
|
159
|
+
window.plus.contacts.ADDRESSBOOK_PHONE,
|
|
160
|
+
function(t) {
|
|
161
|
+
t.find(
|
|
162
|
+
["displayName", "phoneNumbers"],
|
|
163
|
+
function(n) {
|
|
164
|
+
l(e, n);
|
|
165
|
+
},
|
|
166
|
+
function(n) {
|
|
167
|
+
c(e, n);
|
|
168
|
+
},
|
|
169
|
+
{ multiple: !0 }
|
|
170
|
+
);
|
|
171
|
+
},
|
|
172
|
+
function(t) {
|
|
173
|
+
c(e, t);
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
export {
|
|
178
|
+
g as galleryImg,
|
|
179
|
+
b as getContacts,
|
|
180
|
+
y as savePicture,
|
|
181
|
+
d as scanCode,
|
|
182
|
+
w as scanFromGallery,
|
|
183
|
+
a as takePhoto
|
|
184
|
+
};
|
package/dist/es/src/browser.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Window } from "../types";
|
|
2
2
|
export declare const inBrowser: boolean;
|
|
3
3
|
export declare const UA: any;
|
|
4
4
|
export declare const isIE: any;
|
|
@@ -14,14 +14,6 @@ export declare const is360zhushou: any;
|
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
export declare const isMobile: () => any;
|
|
17
|
-
/**
|
|
18
|
-
* 给节点添加监听事件
|
|
19
|
-
* @param target
|
|
20
|
-
* @param eventName
|
|
21
|
-
* @param handler
|
|
22
|
-
* @param options
|
|
23
|
-
*/
|
|
24
|
-
export declare function addEventListenter(target: any, eventName: string, handler: Callback, options?: boolean): void;
|
|
25
17
|
/**
|
|
26
18
|
* 获取全局事件
|
|
27
19
|
* @returns window
|
package/dist/es/src/browser.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
const f = typeof window < "u", r = f && window.navigator.userAgent.toLowerCase(), y = r && /msie|trident/.test(r), w = r && r.indexOf("msie 9.0") > 0, p = r && r.indexOf("edge/") > 0, T = r && r.indexOf("android") > 0, b = r && /iphone|ipad|ipod|ios/.test(r),
|
|
1
|
+
const f = typeof window < "u", r = f && window.navigator.userAgent.toLowerCase(), y = r && /msie|trident/.test(r), w = r && r.indexOf("msie 9.0") > 0, p = r && r.indexOf("edge/") > 0, T = r && r.indexOf("android") > 0, b = r && /iphone|ipad|ipod|ios/.test(r), H = r && /chrome\/\d+/.test(r) && !p, E = r && /micromessenger/.test(r), _ = r && /360appstore/.test(r), x = () => r.match(
|
|
2
2
|
/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
|
|
3
3
|
);
|
|
4
|
-
function S(t, e, n, o = !1) {
|
|
5
|
-
t.addEventListener(e, n, o);
|
|
6
|
-
}
|
|
7
4
|
function h() {
|
|
8
5
|
return window;
|
|
9
6
|
}
|
|
10
7
|
function g() {
|
|
11
8
|
return m.__vdrag_topo_error__ || {};
|
|
12
9
|
}
|
|
13
|
-
const m = h(),
|
|
10
|
+
const m = h(), S = g();
|
|
14
11
|
function A(t, e) {
|
|
15
12
|
try {
|
|
16
13
|
t();
|
|
@@ -18,21 +15,21 @@ function A(t, e) {
|
|
|
18
15
|
e && e(n);
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
|
-
function
|
|
18
|
+
function v() {
|
|
22
19
|
return typeof document > "u" || document.location == null ? "" : document.location.href;
|
|
23
20
|
}
|
|
24
|
-
function
|
|
21
|
+
function O(t, e = ".js") {
|
|
25
22
|
if (t.endsWith(e))
|
|
26
23
|
return t.substring(t.lastIndexOf("/") + 1);
|
|
27
24
|
}
|
|
28
|
-
function
|
|
25
|
+
function $(t, e = window.location.href) {
|
|
29
26
|
const n = decodeURI(e), o = {}, i = n.split("?").length > 1 ? n.split("?")[1] : null;
|
|
30
27
|
return i ? (i.split("&").forEach(function(c) {
|
|
31
28
|
const [l, a] = c.split("=");
|
|
32
29
|
o[l] = a;
|
|
33
30
|
}), o[t]) : null;
|
|
34
31
|
}
|
|
35
|
-
function
|
|
32
|
+
function C(t) {
|
|
36
33
|
if (!t)
|
|
37
34
|
return {};
|
|
38
35
|
const e = t.match(
|
|
@@ -49,7 +46,7 @@ function D(t) {
|
|
|
49
46
|
relative: e[5] + n + o
|
|
50
47
|
};
|
|
51
48
|
}
|
|
52
|
-
function
|
|
49
|
+
function D(t) {
|
|
53
50
|
const e = t.tagName.toLowerCase();
|
|
54
51
|
if (e === "body")
|
|
55
52
|
return "";
|
|
@@ -58,14 +55,14 @@ function I(t) {
|
|
|
58
55
|
const o = t.id ? ` id="${t.id}"` : "", i = t.innerText;
|
|
59
56
|
return `<${e}${o}${n !== "" ? n : ""}>${i}</${e}>`;
|
|
60
57
|
}
|
|
61
|
-
const
|
|
58
|
+
const I = (t, e) => {
|
|
62
59
|
let n = !0;
|
|
63
60
|
return function(...o) {
|
|
64
61
|
n && (t.apply(this, o), n = !1, setTimeout(() => {
|
|
65
62
|
n = !0;
|
|
66
63
|
}, e));
|
|
67
64
|
};
|
|
68
|
-
},
|
|
65
|
+
}, M = function(t, e, n) {
|
|
69
66
|
let o, i, s, c, l;
|
|
70
67
|
const a = function() {
|
|
71
68
|
const u = (/* @__PURE__ */ new Date()).getTime() - c;
|
|
@@ -76,7 +73,7 @@ const M = (t, e) => {
|
|
|
76
73
|
const u = n && !o;
|
|
77
74
|
return o || (o = setTimeout(a, e)), u && (l = t.apply(s, i), s = i = null), l;
|
|
78
75
|
};
|
|
79
|
-
},
|
|
76
|
+
}, B = function(t, e, n) {
|
|
80
77
|
let o, i, s, c = null, l = 0;
|
|
81
78
|
n || (n = {});
|
|
82
79
|
const a = function() {
|
|
@@ -105,11 +102,11 @@ const P = () => {
|
|
|
105
102
|
document.body.clientHeight,
|
|
106
103
|
document.documentElement.clientHeight
|
|
107
104
|
), t;
|
|
108
|
-
},
|
|
105
|
+
}, L = () => Math.max(
|
|
109
106
|
document.body.scrollHeight,
|
|
110
107
|
document.documentElement.scrollHeight
|
|
111
108
|
);
|
|
112
|
-
function
|
|
109
|
+
function W(t, e) {
|
|
113
110
|
let n = Date.now(), o = 0;
|
|
114
111
|
const i = () => {
|
|
115
112
|
let s = Date.now();
|
|
@@ -120,32 +117,31 @@ function k(t, e) {
|
|
|
120
117
|
export {
|
|
121
118
|
r as UA,
|
|
122
119
|
m as _global,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
B as debounce,
|
|
120
|
+
S as _support,
|
|
121
|
+
W as customizeSetInterval,
|
|
122
|
+
M as debounce,
|
|
127
123
|
U as getClientHeight,
|
|
128
124
|
h as getGlobal,
|
|
129
125
|
g as getGlobalSupport,
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
v as getLocationHref,
|
|
127
|
+
L as getScrollHeight,
|
|
132
128
|
P as getScrollTop,
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
$ as getUrlParam,
|
|
130
|
+
D as htmlElementAsString,
|
|
135
131
|
f as inBrowser,
|
|
136
132
|
_ as is360zhushou,
|
|
137
133
|
T as isAndroid,
|
|
138
|
-
|
|
134
|
+
H as isChrome,
|
|
139
135
|
p as isEdge,
|
|
140
136
|
y as isIE,
|
|
141
137
|
w as isIE9,
|
|
142
138
|
b as isIOS,
|
|
143
139
|
x as isMobile,
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
E as isWeiXin,
|
|
141
|
+
O as matchUrlFileName,
|
|
146
142
|
A as nativeTryCatch,
|
|
147
|
-
|
|
143
|
+
C as parseUrlToObj,
|
|
148
144
|
N as supportsHistory,
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
I as throttle,
|
|
146
|
+
B as throttle_02
|
|
151
147
|
};
|
package/dist/es/src/http.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { SpanStatus } from "../types/index";
|
|
2
|
+
/**
|
|
3
|
+
* http请求的状态码进行转换
|
|
4
|
+
*/
|
|
2
5
|
export declare function fromHttpStatus(httpStatus: any): SpanStatus.Ok | SpanStatus.DeadlineExceeded | SpanStatus.Unauthenticated | SpanStatus.PermissionDenied | SpanStatus.NotFound | SpanStatus.ResourceExhausted | SpanStatus.InvalidArgument | SpanStatus.Unimplemented | SpanStatus.Unavailable | SpanStatus.InternalError | SpanStatus.UnknownError | SpanStatus.AlreadyExists | SpanStatus.FailedPrecondition;
|
package/dist/es/src/image.d.ts
CHANGED
package/dist/es/src/string.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* unknown
|
|
2
|
+
* unknown转成字符串
|
|
3
3
|
* @param target
|
|
4
4
|
* @returns
|
|
5
5
|
*/
|
|
@@ -48,7 +48,7 @@ export declare function addBigBraceToStr(str: string): string;
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function validateEmail(str: string): boolean;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* 验证手机号
|
|
52
52
|
* @param num
|
|
53
53
|
* @returns
|
|
54
54
|
*/
|
package/dist/es/src/time.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export declare function getTimestamp(): number;
|
|
|
9
9
|
* @param {number} timestamp - 时间戳
|
|
10
10
|
* @return {string}
|
|
11
11
|
*/
|
|
12
|
-
export declare const formatDate: (
|
|
12
|
+
export declare const formatDate: (timestamp?: number, format?: string) => string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* 数值格式化为两位数
|
|
15
15
|
* @author beth
|
|
16
|
-
* @DateTime
|
|
16
|
+
* @DateTime 5 => 05
|
|
17
17
|
* @return {Number} s
|
|
18
18
|
*/
|
|
19
19
|
export declare const formatDate_02: (str: string) => string;
|
package/dist/es/src/time.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
function c() {
|
|
2
2
|
return Date.now();
|
|
3
3
|
}
|
|
4
|
-
const D = (e = "Y-M-D h:m:s"
|
|
5
|
-
const n = new Date(
|
|
4
|
+
const D = (e = Date.now(), a = "Y-M-D h:m:s") => {
|
|
5
|
+
const n = new Date(e || Date.now()), t = {
|
|
6
6
|
Y: `${n.getFullYear()}`,
|
|
7
7
|
M: `${n.getMonth() + 1}`,
|
|
8
8
|
D: `${n.getDate()}`,
|
|
@@ -10,7 +10,7 @@ const D = (e = "Y-M-D h:m:s", a = Date.now()) => {
|
|
|
10
10
|
m: n.getMinutes(),
|
|
11
11
|
s: n.getSeconds()
|
|
12
12
|
}, o = (r) => r > 10 ? r : "0" + r;
|
|
13
|
-
return (
|
|
13
|
+
return (a || "Y-M-D h:m:s").replace("Y", t.Y).replace("M", t.M).replace("D", t.D).replace("h", o(t.h)).replace("m", o(t.m)).replace("s", o(t.s));
|
|
14
14
|
}, s = (e) => Number(e) >= 10 ? e : "0" + e;
|
|
15
15
|
function u() {
|
|
16
16
|
let e = (/* @__PURE__ */ new Date()).getTime();
|
package/dist/es/src/type.d.ts
CHANGED
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./src/withinstall.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./src/withinstall.js"),c=require("./src/bus.js"),e=require("./src/browser.js"),t=require("./src/string.js"),r=require("./src/time.js"),o=require("./src/type.js"),g=require("./src/object.js"),m=require("./src/http.js"),i=require("./src/dom.js"),l=require("./src/number.js"),s=require("./src/image.js"),a=require("./src/app.js");exports.withInstall=n;exports.bus=c;exports.UA=e.UA;exports._global=e._global;exports._support=e._support;exports.customizeSetInterval=e.customizeSetInterval;exports.debounce=e.debounce;exports.getClientHeight=e.getClientHeight;exports.getGlobal=e.getGlobal;exports.getGlobalSupport=e.getGlobalSupport;exports.getLocationHref=e.getLocationHref;exports.getScrollHeight=e.getScrollHeight;exports.getScrollTop=e.getScrollTop;exports.getUrlParam=e.getUrlParam;exports.htmlElementAsString=e.htmlElementAsString;exports.inBrowser=e.inBrowser;exports.is360zhushou=e.is360zhushou;exports.isAndroid=e.isAndroid;exports.isChrome=e.isChrome;exports.isEdge=e.isEdge;exports.isIE=e.isIE;exports.isIE9=e.isIE9;exports.isIOS=e.isIOS;exports.isMobile=e.isMobile;exports.isWeiXin=e.isWeiXin;exports.matchUrlFileName=e.matchUrlFileName;exports.nativeTryCatch=e.nativeTryCatch;exports.parseUrlToObj=e.parseUrlToObj;exports.supportsHistory=e.supportsHistory;exports.throttle=e.throttle;exports.throttle_02=e.throttle_02;exports.addBigBraceToStr=t.addBigBraceToStr;exports.addMiddleBraceToStr=t.addMiddleBraceToStr;exports.extractStrFromCurlyBrace=t.extractStrFromCurlyBrace;exports.extractStrFromMiddleBrace=t.extractStrFromMiddleBrace;exports.interceptStr=t.interceptStr;exports.unknownToString=t.unknownToString;exports.validateEmail=t.validateEmail;exports.validateFixedPhone=t.validateFixedPhone;exports.validatePhone=t.validatePhone;exports.validateSpecialString_01=t.validateSpecialString_01;exports.formatDate=r.formatDate;exports.formatDate_02=r.formatDate_02;exports.generateUUID=r.generateUUID;exports.getDaysDiffBetweenDates=r.getDaysDiffBetweenDates;exports.getDaysDiffFromNow=r.getDaysDiffFromNow;exports.getTimestamp=r.getTimestamp;exports.isExistProperty=o.isExistProperty;exports.variableTypeDetection=o.variableTypeDetection;exports.replaceAop=g.replaceAop;exports.fromHttpStatus=m.fromHttpStatus;exports.addEventListener=i.addEventListener;exports.removeEventListener=i.removeEventListener;exports.triggerDragEvent=i.triggerDragEvent;exports.formatDecimal=l.formatDecimal;exports.random=l.random;exports.imgError=s.imgError;exports.preloadImage=s.preloadImage;exports.galleryImg=a.galleryImg;exports.getContacts=a.getContacts;exports.savePicture=a.savePicture;exports.scanCode=a.scanCode;exports.scanFromGallery=a.scanFromGallery;exports.takePhoto=a.takePhoto;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare interface IParamsType {
|
|
2
|
+
style?: any;
|
|
3
|
+
count?: any;
|
|
4
|
+
filePath?: any;
|
|
5
|
+
success: () => void;
|
|
6
|
+
fail: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 开启扫码功能
|
|
10
|
+
*/
|
|
11
|
+
export declare const scanCode: (params: IParamsType) => any;
|
|
12
|
+
/**
|
|
13
|
+
* 从相册中扫码
|
|
14
|
+
*/
|
|
15
|
+
export declare const scanFromGallery: (params: IParamsType) => void;
|
|
16
|
+
/**
|
|
17
|
+
* 拍照
|
|
18
|
+
*/
|
|
19
|
+
export declare const takePhoto: (params: IParamsType) => void;
|
|
20
|
+
/**
|
|
21
|
+
* 从相册中选选取照片
|
|
22
|
+
*/
|
|
23
|
+
export declare const galleryImg: (params: IParamsType) => void;
|
|
24
|
+
/**
|
|
25
|
+
* 保存图片到相册中
|
|
26
|
+
*/
|
|
27
|
+
export declare const savePicture: (params: IParamsType) => false | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* 调用户的通信录
|
|
30
|
+
* @param params
|
|
31
|
+
*/
|
|
32
|
+
export declare const getContacts: (params: IParamsType) => void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(e,t){try{return typeof e.success=="function"?(e.success(t),!0):!1}catch(n){alert("回调函数异常:"),alert(n)}}function c(e,t){return typeof e.fail=="function"?(e.fail(t),!0):!1}const s=e=>{let t;e=e||{};const n={background:"#000",frameColor:"#07c160",scanbarColor:"#07c160",top:"100px",left:"0px",width:"100%",height:"500px",position:"static"},o=e.style||{};for(const i in o)n[i]=o[i];return t||(t=window.plus.barcode.create("barcode",[window.plus.barcode.QR],n),t.onmarked=function(i,u){l(e,u),t||alert("尚未开始扫码"),t.close(),t=null},t.onerror=function(i){c(e,i),t||alert("尚未开始扫码"),t.close(),t=null},window.plus.webview.currentWebview().append(t)),t.start(),t},r=e=>{e=e||{},window.plus.gallery.pick(function(t){window.plus.barcode.scan(t,function(n,o){l(e,o)},function(n){c(e,n)})},function(t){c(e,t)},{filter:"image",system:!1})},d=e=>{e=e||{};const t=window.plus.camera.getCamera(),n=t.supportedImageResolutions[0],o=t.supportedImageFormats[0];t.captureImage(function(i){l(e,i)},function(i){c(e,i)},{resolution:n,format:o})},w=e=>{e=e||{},e.count=e.count||"Infinity",window.plus.gallery.pick(function(t){const n=t.files;n&&n.length==1?l(e,n[0]):l(e,n)},function(t){c(e,t)},{filter:"image",multiple:!0,maximum:e.count,system:!1,onmaxed:function(){window.plus.nativeUI.alert("最多只能选择"+e.count+"张图片")}})},a=e=>{e=e||{};const t=e.filePath;if(!t)return alert("请传入要下载的图片路径"),!1;t.indexOf("data:image/")==0?g(t,e,function(n){window.plus.gallery.save(n,function(o){l(e,o.file)},function(o){c(e,o)})}):y({url:t,success:function(n){window.plus.gallery.save(n,function(o){l(e,o.file)},function(o){c(e,o)})},fail:function(n){c(e,n)}})};function g(e,t,n){const o=new window.plus.nativeObj.Bitmap;o.loadBase64Data(e);const i=e.indexOf("png")>-1?".png":".jpeg",u=new Date().getTime()+i;o.save("_www/"+u,{overwrite:!0},function(){n("_www/"+u)},function(f){c(t,f)})}function y(e){e=e||{};const t=e.url;if(!t)return alert("请输入下载文件的链接"),!1;const n=window.plus.downloader.createDownload(t,{},function(o,i){i==200?l(e,o.filename):c(e,o)});return n.addEventListener("statechanged",function(o,i){if(o.state==3){const u=parseFloat(o.downloadedSize/o.totalSize*100).toFixed(2);typeof e.onProgress=="function"&&e.onProgress(n.downloadedSize,n.totalSize,u+"%")}},!1),n.start(),n}const b=e=>{e=e||{},window.plus.contacts.getAddressBook(window.plus.contacts.ADDRESSBOOK_PHONE,function(t){t.find(["displayName","phoneNumbers"],function(n){l(e,n)},function(n){c(e,n)},{multiple:!0})},function(t){c(e,t)})};exports.galleryImg=w;exports.getContacts=b;exports.savePicture=a;exports.scanCode=s;exports.scanFromGallery=r;exports.takePhoto=d;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Window } from "../types";
|
|
2
2
|
export declare const inBrowser: boolean;
|
|
3
3
|
export declare const UA: any;
|
|
4
4
|
export declare const isIE: any;
|
|
@@ -14,14 +14,6 @@ export declare const is360zhushou: any;
|
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
export declare const isMobile: () => any;
|
|
17
|
-
/**
|
|
18
|
-
* 给节点添加监听事件
|
|
19
|
-
* @param target
|
|
20
|
-
* @param eventName
|
|
21
|
-
* @param handler
|
|
22
|
-
* @param options
|
|
23
|
-
*/
|
|
24
|
-
export declare function addEventListenter(target: any, eventName: string, handler: Callback, options?: boolean): void;
|
|
25
17
|
/**
|
|
26
18
|
* 获取全局事件
|
|
27
19
|
* @returns window
|
package/dist/lib/src/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=typeof window<"u",r=f&&window.navigator.userAgent.toLowerCase(),y=r&&/msie|trident/.test(r),b=r&&r.indexOf("msie 9.0")>0,h=r&&r.indexOf("edge/")>0,w=r&&r.indexOf("android")>0,T=r&&/iphone|ipad|ipod|ios/.test(r),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=typeof window<"u",r=f&&window.navigator.userAgent.toLowerCase(),y=r&&/msie|trident/.test(r),b=r&&r.indexOf("msie 9.0")>0,h=r&&r.indexOf("edge/")>0,w=r&&r.indexOf("android")>0,T=r&&/iphone|ipad|ipod|ios/.test(r),S=r&&/chrome\/\d+/.test(r)&&!h,H=r&&/micromessenger/.test(r),E=r&&/360appstore/.test(r),_=()=>r.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);function p(){return window}function g(){return m.__vdrag_topo_error__||{}}const m=p(),A=g();function v(t,e){try{t()}catch(n){e&&e(n)}}function I(){return typeof document>"u"||document.location==null?"":document.location.href}function O(t,e=".js"){if(t.endsWith(e))return t.substring(t.lastIndexOf("/")+1)}function x(t,e=window.location.href){const n=decodeURI(e),o={},i=n.split("?").length>1?n.split("?")[1]:null;return i?(i.split("&").forEach(function(s){const[c,a]=s.split("=");o[c]=a}),o[t]):null}function C(t){if(!t)return{};const e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",o=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],relative:e[5]+n+o}}function U(t){const e=t.tagName.toLowerCase();if(e==="body")return"";let n=t.classList.value;n=n!==""?` class='${n}'`:"";const o=t.id?` id="${t.id}"`:"",i=t.innerText;return`<${e}${o}${n!==""?n:""}>${i}</${e}>`}const M=(t,e)=>{let n=!0;return function(...o){n&&(t.apply(this,o),n=!1,setTimeout(()=>{n=!0},e))}},P=function(t,e,n){let o,i,l,s,c;const a=function(){const u=new Date().getTime()-s;u<e&&u>=0?o=setTimeout(a,e-u):(o=null,n||(c=t.apply(l,i),o||(l=i=null)))};return function(){l=this,i=arguments,s=new Date().getTime();const u=n&&!o;return o||(o=setTimeout(a,e)),u&&(c=t.apply(l,i),l=i=null),c}},$=function(t,e,n){let o,i,l,s=null,c=0;n||(n={});const a=function(){c=n.leading===!1?0:new Date().getTime(),s=null,l=t.apply(o,i),s||(o=i=null)};return function(){const u=new Date().getTime();!c&&n.leading===!1&&(c=u);const d=e-(u-c);return o=this,i=arguments,d<=0||d>e?(s&&(clearTimeout(s),s=null),c=u,l=t.apply(o,i),s||(o=i=null)):!s&&n.trailing!==!1&&(s=setTimeout(a,d)),l}};function B(){const t=m.chrome,e=t&&t.app&&t.app.runtime,n="history"in m&&!!m.history.pushState&&!!m.history.replaceState;return!e&&n}const D=()=>{let t=0;return document.documentElement&&document.documentElement.scrollTop?t=document.documentElement.scrollTop:document.body&&(t=document.body.scrollTop),t},N=()=>{let t=0;return document.body.clientHeight&&document.documentElement.clientHeight?t=Math.min(document.body.clientHeight,document.documentElement.clientHeight):t=Math.max(document.body.clientHeight,document.documentElement.clientHeight),t},G=()=>Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);function L(t,e){let n=Date.now(),o=0;const i=()=>{let l=Date.now();l-n>=e&&(n=l=Date.now(),t()),cancelAnimationFrame(o),o=window.requestAnimationFrame(i)};return i(),o}exports.UA=r;exports._global=m;exports._support=A;exports.customizeSetInterval=L;exports.debounce=P;exports.getClientHeight=N;exports.getGlobal=p;exports.getGlobalSupport=g;exports.getLocationHref=I;exports.getScrollHeight=G;exports.getScrollTop=D;exports.getUrlParam=x;exports.htmlElementAsString=U;exports.inBrowser=f;exports.is360zhushou=E;exports.isAndroid=w;exports.isChrome=S;exports.isEdge=h;exports.isIE=y;exports.isIE9=b;exports.isIOS=T;exports.isMobile=_;exports.isWeiXin=H;exports.matchUrlFileName=O;exports.nativeTryCatch=v;exports.parseUrlToObj=C;exports.supportsHistory=B;exports.throttle=M;exports.throttle_02=$;
|
package/dist/lib/src/http.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { SpanStatus } from "../types/index";
|
|
2
|
+
/**
|
|
3
|
+
* http请求的状态码进行转换
|
|
4
|
+
*/
|
|
2
5
|
export declare function fromHttpStatus(httpStatus: any): SpanStatus.Ok | SpanStatus.DeadlineExceeded | SpanStatus.Unauthenticated | SpanStatus.PermissionDenied | SpanStatus.NotFound | SpanStatus.ResourceExhausted | SpanStatus.InvalidArgument | SpanStatus.Unimplemented | SpanStatus.Unavailable | SpanStatus.InternalError | SpanStatus.UnknownError | SpanStatus.AlreadyExists | SpanStatus.FailedPrecondition;
|
package/dist/lib/src/image.d.ts
CHANGED
package/dist/lib/src/string.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* unknown
|
|
2
|
+
* unknown转成字符串
|
|
3
3
|
* @param target
|
|
4
4
|
* @returns
|
|
5
5
|
*/
|
|
@@ -48,7 +48,7 @@ export declare function addBigBraceToStr(str: string): string;
|
|
|
48
48
|
*/
|
|
49
49
|
export declare function validateEmail(str: string): boolean;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* 验证手机号
|
|
52
52
|
* @param num
|
|
53
53
|
* @returns
|
|
54
54
|
*/
|
package/dist/lib/src/time.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export declare function getTimestamp(): number;
|
|
|
9
9
|
* @param {number} timestamp - 时间戳
|
|
10
10
|
* @return {string}
|
|
11
11
|
*/
|
|
12
|
-
export declare const formatDate: (
|
|
12
|
+
export declare const formatDate: (timestamp?: number, format?: string) => string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* 数值格式化为两位数
|
|
15
15
|
* @author beth
|
|
16
|
-
* @DateTime
|
|
16
|
+
* @DateTime 5 => 05
|
|
17
17
|
* @return {Number} s
|
|
18
18
|
*/
|
|
19
19
|
export declare const formatDate_02: (str: string) => string;
|
package/dist/lib/src/time.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function D(){return Date.now()}const x=(e="Y-M-D h:m:s"
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function D(){return Date.now()}const x=(e=Date.now(),a="Y-M-D h:m:s")=>{const n=new Date(e||Date.now()),t={Y:`${n.getFullYear()}`,M:`${n.getMonth()+1}`,D:`${n.getDate()}`,h:n.getHours(),m:n.getMinutes(),s:n.getSeconds()},o=r=>r>10?r:"0"+r;return(a||"Y-M-D h:m:s").replace("Y",t.Y).replace("M",t.M).replace("D",t.D).replace("h",o(t.h)).replace("m",o(t.m)).replace("s",o(t.s))},s=e=>Number(e)>=10?e:"0"+e;function c(){let e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){const t=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(n=="x"?t:t&3|8).toString(16)})}function m(e){const a=new Date;let t=new Date(e).getTime()-a.getTime();return t<=0&&(t=0),Math.ceil(t/(60*60*24*1e3))}const u=(e,a)=>(a-e)/(1e3*3600*24);exports.formatDate=x;exports.formatDate_02=s;exports.generateUUID=c;exports.getDaysDiffBetweenDates=u;exports.getDaysDiffFromNow=m;exports.getTimestamp=D;
|
package/dist/lib/src/type.d.ts
CHANGED