@unicom-cloud/utils 0.1.10 → 0.1.11
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/caseName.js +11 -0
- package/className.js +5 -0
- package/clipboardCopy.js +6 -0
- package/constant.js +4 -0
- package/contentDisposition.js +7 -0
- package/convert-time/index.js +61 -0
- package/convertTime.js +4 -0
- package/cookie.js +7 -0
- package/dayjs.js +5 -0
- package/decimal.js +5 -0
- package/eventEmitter.js +4 -0
- package/file.js +6 -0
- package/filesize.js +8 -0
- package/index.js +38 -30
- package/invariant.js +4 -0
- package/is.js +92 -0
- package/lunar-converter/index.js +641 -0
- package/lunarConverter.js +4 -0
- package/math.js +9 -0
- package/md5.js +4 -0
- package/mock.js +8 -0
- package/normalizeWheel.js +6 -0
- package/number-to-chinese/index.js +72 -0
- package/numberToChinese.js +4 -0
- package/nzh.js +4 -0
- package/object-keys-sort/index.js +7 -0
- package/objectKeysSort.js +2 -5
- package/package.json +1 -1
- package/random.js +15 -0
- package/screenfull.js +4 -0
- package/search-tree/index.js +54 -0
- package/searchTree.js +4 -0
- package/snapdom.js +6 -0
- package/tree.js +11 -0
- package/turboStream.js +6 -0
- package/types/case-name/index.d.ts +11 -0
- package/types/class-name/index.d.ts +2 -0
- package/types/clipboard-copy/index.d.ts +2 -0
- package/types/constant/address.d.ts +14 -0
- package/types/constant/chineseCharacters.d.ts +2 -0
- package/types/constant/constellations.d.ts +2 -0
- package/types/constant/domain.d.ts +2 -0
- package/types/constant/identity.d.ts +2 -0
- package/types/constant/index.d.ts +1 -0
- package/types/constant/keyboardCode.d.ts +158 -0
- package/types/constant/licensePlate.d.ts +2 -0
- package/types/constant/name.d.ts +4 -0
- package/types/constant/platform.d.ts +11 -0
- package/types/constant/protocol.d.ts +2 -0
- package/types/constant/ui.d.ts +14 -0
- package/types/content-disposition/index.d.ts +10 -0
- package/types/convert-time/index.d.ts +32 -0
- package/types/cookie/index.d.ts +4 -0
- package/types/cookie/src/index.d.ts +114 -0
- package/types/dayjs/index.d.ts +1 -0
- package/types/decimal/decimal.d.ts +4 -0
- package/types/decimal/index.d.ts +1 -0
- package/types/event-emitter/index.d.ts +17 -0
- package/types/file/fileToURL.d.ts +2 -0
- package/types/file/index.d.ts +3 -0
- package/types/file/saveAs.d.ts +2 -0
- package/types/filesize/index.d.ts +2 -0
- package/types/filesize/src/constants.d.ts +42 -0
- package/types/filesize/src/filesize.d.ts +47 -0
- package/types/index.d.ts +24 -0
- package/types/invariant/index.d.ts +2 -0
- package/types/is/index.d.ts +53 -0
- package/types/lunar-converter/index.d.ts +113 -0
- package/types/math/index.d.ts +11 -0
- package/types/md5/index.d.ts +2 -0
- package/types/mock/MockWebSocket.d.ts +17 -0
- package/types/mock/MockXMLHttpRequest.d.ts +17 -0
- package/types/mock/index.d.ts +2 -0
- package/types/normalize-wheel/ExecutionEnvironment.d.ts +9 -0
- package/types/normalize-wheel/UserAgent_DEPRECATED.d.ts +86 -0
- package/types/normalize-wheel/index.d.ts +115 -0
- package/types/normalize-wheel/isEventSupported.d.ts +16 -0
- package/types/number-to-chinese/index.d.ts +11 -0
- package/types/nzh/cn.d.ts +8 -0
- package/types/nzh/hk.d.ts +8 -0
- package/types/nzh/index.d.ts +1 -0
- package/types/nzh/nzh.d.ts +36 -0
- package/types/nzh/src/autoGet.d.ts +8 -0
- package/types/nzh/src/index.d.ts +34 -0
- package/types/nzh/src/langs/cn_b.d.ts +10 -0
- package/types/nzh/src/langs/cn_s.d.ts +7 -0
- package/types/nzh/src/langs/hk_b.d.ts +10 -0
- package/types/nzh/src/langs/hk_s.d.ts +7 -0
- package/types/nzh/src/utils.d.ts +65 -0
- package/types/object-keys-sort/index.d.ts +4 -0
- package/types/random/address.d.ts +8 -0
- package/types/random/constellation.d.ts +2 -0
- package/types/random/image.d.ts +5 -0
- package/types/random/index.d.ts +40 -0
- package/types/random/licensePlate.d.ts +2 -0
- package/types/random/name.d.ts +9 -0
- package/types/random/number.d.ts +6 -0
- package/types/random/text.d.ts +13 -0
- package/types/random/time.d.ts +2 -0
- package/types/random/web.d.ts +11 -0
- package/types/screenfull/index.d.ts +10 -0
- package/types/search-tree/index.d.ts +20 -0
- package/types/snapdom/index.d.ts +1 -0
- package/types/snapdom/src/api/preCache.d.ts +8 -0
- package/types/snapdom/src/api/snapdom.d.ts +26 -0
- package/types/snapdom/src/core/cache.d.ts +11 -0
- package/types/snapdom/src/core/capture.d.ts +17 -0
- package/types/snapdom/src/core/clone.d.ts +11 -0
- package/types/snapdom/src/core/prepare.d.ts +8 -0
- package/types/snapdom/src/index.browser.d.ts +1 -0
- package/types/snapdom/src/index.d.ts +2 -0
- package/types/snapdom/src/modules/background.d.ts +10 -0
- package/types/snapdom/src/modules/fonts.d.ts +25 -0
- package/types/snapdom/src/modules/images.d.ts +8 -0
- package/types/snapdom/src/modules/pseudo.d.ts +12 -0
- package/types/snapdom/src/modules/styles.d.ts +10 -0
- package/types/snapdom/src/utils/cssTools.d.ts +38 -0
- package/types/snapdom/src/utils/helpers.d.ts +71 -0
- package/types/tree/index.d.ts +8 -0
- package/types/turbo-stream/index.d.ts +1 -0
- package/types/turbo-stream/src/decode.d.ts +7 -0
- package/types/turbo-stream/src/encode.d.ts +27 -0
- package/types/turbo-stream/src/shared.d.ts +107 -0
- package/types/turbo-stream/src/turbo-stream.d.ts +4 -0
- package/types/url-toolkit/index.d.ts +2 -0
- package/types/url-toolkit/src/url-toolkit.d.ts +18 -0
- package/urlToolkit.js +8 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const h = (i) => {
|
|
2
|
+
const t = {
|
|
3
|
+
normal: {
|
|
4
|
+
digits: ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
|
|
5
|
+
units: ["", "十", "百", "千"],
|
|
6
|
+
bigUnits: ["", "万", "亿", "万亿"],
|
|
7
|
+
decimalUnits: ["点"]
|
|
8
|
+
// 普通模式小数单位
|
|
9
|
+
},
|
|
10
|
+
money: {
|
|
11
|
+
digits: ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"],
|
|
12
|
+
units: ["", "拾", "佰", "仟"],
|
|
13
|
+
bigUnits: ["", "万", "亿", "万亿"],
|
|
14
|
+
decimalUnits: ["元", "角", "分", "厘"],
|
|
15
|
+
// 金额模式小数单位
|
|
16
|
+
suffix: "整"
|
|
17
|
+
// 金额后缀
|
|
18
|
+
}
|
|
19
|
+
}[i.mode], d = (r) => {
|
|
20
|
+
let s = "";
|
|
21
|
+
const l = Math.floor(r).toString(), n = [];
|
|
22
|
+
for (let e = l.length; e > 0; e -= 4)
|
|
23
|
+
n.push(l.slice(Math.max(0, e - 4), e));
|
|
24
|
+
return n.forEach((e, c) => {
|
|
25
|
+
let a = "", o = !1;
|
|
26
|
+
for (let g = 0; g < e.length; g++) {
|
|
27
|
+
const m = parseInt(e[g]), u = e.length - 1 - g;
|
|
28
|
+
m === 0 ? o = !0 : (o && (a += t.digits[0], o = !1), a += t.digits[m] + t.units[u]);
|
|
29
|
+
}
|
|
30
|
+
a !== "" && (a += t.bigUnits[c], s = a + s);
|
|
31
|
+
}), i.mode === "money" && s && (s += t.decimalUnits[0]), s;
|
|
32
|
+
}, f = (r) => {
|
|
33
|
+
if (r <= 0) return "";
|
|
34
|
+
let s = r.toString().padStart(i.decimalDigits, "0").substring(0, i.decimalDigits);
|
|
35
|
+
i.trailingZeros || (s = s.replace(/0+$/, ""));
|
|
36
|
+
let l = "";
|
|
37
|
+
for (let n = 0; n < s.length; n++) {
|
|
38
|
+
const e = parseInt(s[n]);
|
|
39
|
+
e !== 0 && (l += t.digits[e] + (t.decimalUnits[n + 1] || ""));
|
|
40
|
+
}
|
|
41
|
+
return l;
|
|
42
|
+
};
|
|
43
|
+
return (r) => {
|
|
44
|
+
if (isNaN(r)) return "无效数字";
|
|
45
|
+
if (r === 0)
|
|
46
|
+
return i.mode === "money" ? t.digits[0] + t.decimalUnits[0] + t.suffix : t.digits[0];
|
|
47
|
+
let s = "";
|
|
48
|
+
r < 0 && (s = i.negativeSymbol, r = Math.abs(r));
|
|
49
|
+
const l = Math.floor(r), n = Math.round(
|
|
50
|
+
(r - l) * Math.pow(10, i.decimalDigits)
|
|
51
|
+
);
|
|
52
|
+
let e = s;
|
|
53
|
+
const c = d(l), a = f(n);
|
|
54
|
+
return e += c, c === "" && i.mode === "money" && (e += t.digits[0] + t.decimalUnits[0]), e += a, i.mode === "money" && a === "" && c && (e += t.suffix), i.mode === "normal" ? e.startsWith(t.digits[1] + t.units[1]) && (e = e.substring(1)) : e = e.replace(/(零[仟佰拾])+/g, "零").replace(/零+/g, "零").replace(
|
|
55
|
+
new RegExp(`${t.digits[0]}${t.decimalUnits[0]}`),
|
|
56
|
+
t.decimalUnits[0]
|
|
57
|
+
), e || t.digits[0];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
function U(i, t = {}) {
|
|
61
|
+
const d = {
|
|
62
|
+
mode: "normal",
|
|
63
|
+
negativeSymbol: "负",
|
|
64
|
+
decimalDigits: 4,
|
|
65
|
+
trailingZeros: !1,
|
|
66
|
+
...t
|
|
67
|
+
};
|
|
68
|
+
return h(d)(i);
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
U as default
|
|
72
|
+
};
|
package/nzh.js
ADDED
package/objectKeysSort.js
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@unicom-cloud/utils","version":"0.1.
|
|
1
|
+
{"name":"@unicom-cloud/utils","version":"0.1.11","dependencies":{},"peerDependencies":{"lodash":"^4.17.21"},"main":"./index.js","type":"module","types":"types/index.d.ts","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
|
package/random.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "lodash/sample";
|
|
2
|
+
import "uuid";
|
|
3
|
+
import "./random/address.js";
|
|
4
|
+
import "./random/constellation.js";
|
|
5
|
+
import "./random/image.js";
|
|
6
|
+
import "./random/licensePlate.js";
|
|
7
|
+
import "./random/name.js";
|
|
8
|
+
import "./random/number.js";
|
|
9
|
+
import "./random/text.js";
|
|
10
|
+
import "./random/time.js";
|
|
11
|
+
import "./random/web.js";
|
|
12
|
+
import { default as b } from "./random/index.js";
|
|
13
|
+
export {
|
|
14
|
+
b as default
|
|
15
|
+
};
|
package/screenfull.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function p(o, i, a = {}) {
|
|
2
|
+
const {
|
|
3
|
+
strategy: f = "BFS",
|
|
4
|
+
childrenKey: c = "children",
|
|
5
|
+
strict: u = !1
|
|
6
|
+
} = a;
|
|
7
|
+
if (!Array.isArray(o))
|
|
8
|
+
throw new TypeError("treeData must be an array");
|
|
9
|
+
if (typeof i != "object" || i === null)
|
|
10
|
+
throw new TypeError("searchCondition must be an object");
|
|
11
|
+
const t = [...o], l = (e) => {
|
|
12
|
+
for (const r in i) {
|
|
13
|
+
if (!Object.prototype.hasOwnProperty.call(e, r))
|
|
14
|
+
return !1;
|
|
15
|
+
const n = i[r], s = e[r];
|
|
16
|
+
if (u) {
|
|
17
|
+
if (s !== n)
|
|
18
|
+
return !1;
|
|
19
|
+
} else if (n instanceof RegExp) {
|
|
20
|
+
if (typeof s != "string" || !n.test(s))
|
|
21
|
+
return !1;
|
|
22
|
+
} else if (typeof n == "function") {
|
|
23
|
+
if (!n(s))
|
|
24
|
+
return !1;
|
|
25
|
+
} else if (s != n)
|
|
26
|
+
return !1;
|
|
27
|
+
}
|
|
28
|
+
return !0;
|
|
29
|
+
};
|
|
30
|
+
if (f === "BFS")
|
|
31
|
+
for (; t.length > 0; ) {
|
|
32
|
+
const e = t.shift();
|
|
33
|
+
if (!e) continue;
|
|
34
|
+
if (l(e))
|
|
35
|
+
return e;
|
|
36
|
+
const r = e[c];
|
|
37
|
+
Array.isArray(r) && t.push(...r);
|
|
38
|
+
}
|
|
39
|
+
else if (f === "DFS")
|
|
40
|
+
for (; t.length > 0; ) {
|
|
41
|
+
const e = t.pop();
|
|
42
|
+
if (!e) continue;
|
|
43
|
+
if (l(e))
|
|
44
|
+
return e;
|
|
45
|
+
const r = e[c];
|
|
46
|
+
Array.isArray(r) && t.push(...r.slice().reverse());
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
throw new Error('Invalid strategy. Use "BFS" or "DFS"');
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
p as default
|
|
54
|
+
};
|
package/searchTree.js
ADDED
package/snapdom.js
ADDED
package/tree.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getItemBy as y, findNodeBy as B, getChildWithParentBy as g, getItemBy as m, getItemBy2 as a, getItemBy3 as I, getItemByID as i, getLabelFromDictionaryByValue as o } from "./tree/index.js";
|
|
2
|
+
export {
|
|
3
|
+
y as default,
|
|
4
|
+
B as findNodeBy,
|
|
5
|
+
g as getChildWithParentBy,
|
|
6
|
+
m as getItemBy,
|
|
7
|
+
a as getItemBy2,
|
|
8
|
+
I as getItemBy3,
|
|
9
|
+
i as getItemByID,
|
|
10
|
+
o as getLabelFromDictionaryByValue
|
|
11
|
+
};
|
package/turboStream.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default caseName;
|
|
2
|
+
declare function caseName(name: any): {
|
|
3
|
+
kebabCaseName: string;
|
|
4
|
+
snakeCaseName: string;
|
|
5
|
+
camelCaseName: string;
|
|
6
|
+
capitalizeName: string;
|
|
7
|
+
startCaseName: string;
|
|
8
|
+
lowerFirstCaseName: Uncapitalize<any>;
|
|
9
|
+
upperFirstCaseName: Capitalize<any>;
|
|
10
|
+
ComponentCaseName: Capitalize<string>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export default CHINESE_CHARACTERS;
|
|
2
|
+
declare const CHINESE_CHARACTERS: "\u7684\u4E00\u662F\u5728\u4E0D\u4E86\u6709\u548C\u4EBA\u8FD9\u4E2D\u5927\u4E3A\u4E0A\u4E2A\u56FD\u6211\u4EE5\u8981\u4ED6\u65F6\u6765\u7528\u4EEC\u751F\u5230\u4F5C\u5730\u4E8E\u51FA\u5C31\u5206\u5BF9\u6210\u4F1A\u53EF\u4E3B\u53D1\u5E74\u52A8\u540C\u5DE5\u4E5F\u80FD\u4E0B\u8FC7\u5B50\u8BF4\u4EA7\u79CD\u9762\u800C\u65B9\u540E\u591A\u5B9A\u884C\u5B66\u6CD5\u6240\u6C11\u5F97\u7ECF\u5341\u4E09\u4E4B\u8FDB\u7740\u7B49\u90E8\u5EA6\u5BB6\u7535\u529B\u91CC\u5982\u6C34\u5316\u9AD8\u81EA\u4E8C\u7406\u8D77\u5C0F\u7269\u73B0\u5B9E\u52A0\u91CF\u90FD\u4E24\u4F53\u5236\u673A\u5F53\u4F7F\u70B9\u4ECE\u4E1A\u672C\u53BB\u628A\u6027\u597D\u5E94\u5F00\u5B83\u5408\u8FD8\u56E0\u7531\u5176\u4E9B\u7136\u524D\u5916\u5929\u653F\u56DB\u65E5\u90A3\u793E\u4E49\u4E8B\u5E73\u5F62\u76F8\u5168\u8868\u95F4\u6837\u4E0E\u5173\u5404\u91CD\u65B0\u7EBF\u5185\u6570\u6B63\u5FC3\u53CD\u4F60\u660E\u770B\u539F\u53C8\u4E48\u5229\u6BD4\u6216\u4F46\u8D28\u6C14\u7B2C\u5411\u9053\u547D\u6B64\u53D8\u6761\u53EA\u6CA1\u7ED3\u89E3\u95EE\u610F\u5EFA\u6708\u516C\u65E0\u7CFB\u519B\u5F88\u60C5\u8005\u6700\u7ACB\u4EE3\u60F3\u5DF2\u901A\u5E76\u63D0\u76F4\u9898\u515A\u7A0B\u5C55\u4E94\u679C\u6599\u8C61\u5458\u9769\u4F4D\u5165\u5E38\u6587\u603B\u6B21\u54C1\u5F0F\u6D3B\u8BBE\u53CA\u7BA1\u7279\u4EF6\u957F\u6C42\u8001\u5934\u57FA\u8D44\u8FB9\u6D41\u8DEF\u7EA7\u5C11\u56FE\u5C71\u7EDF\u63A5\u77E5\u8F83\u5C06\u7EC4\u89C1\u8BA1\u522B\u5979\u624B\u89D2\u671F\u6839\u8BBA\u8FD0\u519C\u6307\u51E0\u4E5D\u533A\u5F3A\u653E\u51B3\u897F\u88AB\u5E72\u505A\u5FC5\u6218\u5148\u56DE\u5219\u4EFB\u53D6\u636E\u5904\u961F\u5357\u7ED9\u8272\u5149\u95E8\u5373\u4FDD\u6CBB\u5317\u9020\u767E\u89C4\u70ED\u9886\u4E03\u6D77\u53E3\u4E1C\u5BFC\u5668\u538B\u5FD7\u4E16\u91D1\u589E\u4E89\u6D4E\u9636\u6CB9\u601D\u672F\u6781\u4EA4\u53D7\u8054\u4EC0\u8BA4\u516D\u5171\u6743\u6536\u8BC1\u6539\u6E05\u5DF1\u7F8E\u518D\u91C7\u8F6C\u66F4\u5355\u98CE\u5207\u6253\u767D\u6559\u901F\u82B1\u5E26\u5B89\u573A\u8EAB\u8F66\u4F8B\u771F\u52A1\u5177\u4E07\u6BCF\u76EE\u81F3\u8FBE\u8D70\u79EF\u793A\u8BAE\u58F0\u62A5\u6597\u5B8C\u7C7B\u516B\u79BB\u534E\u540D\u786E\u624D\u79D1\u5F20\u4FE1\u9A6C\u8282\u8BDD\u7C73\u6574\u7A7A\u5143\u51B5\u4ECA\u96C6\u6E29\u4F20\u571F\u8BB8\u6B65\u7FA4\u5E7F\u77F3\u8BB0\u9700\u6BB5\u7814\u754C\u62C9\u6797\u5F8B\u53EB\u4E14\u7A76\u89C2\u8D8A\u7EC7\u88C5\u5F71\u7B97\u4F4E\u6301\u97F3\u4F17\u4E66\u5E03\u590D\u5BB9\u513F\u987B\u9645\u5546\u975E\u9A8C\u8FDE\u65AD\u6DF1\u96BE\u8FD1\u77FF\u5343\u5468\u59D4\u7D20\u6280\u5907\u534A\u529E\u9752\u7701\u5217\u4E60\u54CD\u7EA6\u652F\u822C\u53F2\u611F\u52B3\u4FBF\u56E2\u5F80\u9178\u5386\u5E02\u514B\u4F55\u9664\u6D88\u6784\u5E9C\u79F0\u592A\u51C6\u7CBE\u503C\u53F7\u7387\u65CF\u7EF4\u5212\u9009\u6807\u5199\u5B58\u5019\u6BDB\u4EB2\u5FEB\u6548\u65AF\u9662\u67E5\u6C5F\u578B\u773C\u738B\u6309\u683C\u517B\u6613\u7F6E\u6D3E\u5C42\u7247\u59CB\u5374\u4E13\u72B6\u80B2\u5382\u4EAC\u8BC6\u9002\u5C5E\u5706\u5305\u706B\u4F4F\u8C03\u6EE1\u53BF\u5C40\u7167\u53C2\u7EA2\u7EC6\u5F15\u542C\u8BE5\u94C1\u4EF7\u4E25\u9F99\u98DE";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MATCH_MEDIA_PREFERS_COLOR_SCHEME_DARK: MediaQueryList;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export namespace Enter {
|
|
2
|
+
let key: string;
|
|
3
|
+
let code: string;
|
|
4
|
+
let keyCode: number;
|
|
5
|
+
}
|
|
6
|
+
export namespace Esc {
|
|
7
|
+
let key_1: string;
|
|
8
|
+
export { key_1 as key };
|
|
9
|
+
let code_1: string;
|
|
10
|
+
export { code_1 as code };
|
|
11
|
+
let keyCode_1: number;
|
|
12
|
+
export { keyCode_1 as keyCode };
|
|
13
|
+
}
|
|
14
|
+
export namespace Escape { }
|
|
15
|
+
export namespace Backspace {
|
|
16
|
+
let key_2: string;
|
|
17
|
+
export { key_2 as key };
|
|
18
|
+
let code_2: string;
|
|
19
|
+
export { code_2 as code };
|
|
20
|
+
let keyCode_2: number;
|
|
21
|
+
export { keyCode_2 as keyCode };
|
|
22
|
+
}
|
|
23
|
+
export namespace Tab {
|
|
24
|
+
let key_3: string;
|
|
25
|
+
export { key_3 as key };
|
|
26
|
+
let code_3: string;
|
|
27
|
+
export { code_3 as code };
|
|
28
|
+
let keyCode_3: number;
|
|
29
|
+
export { keyCode_3 as keyCode };
|
|
30
|
+
}
|
|
31
|
+
export namespace Space {
|
|
32
|
+
let key_4: string;
|
|
33
|
+
export { key_4 as key };
|
|
34
|
+
let code_4: string;
|
|
35
|
+
export { code_4 as code };
|
|
36
|
+
let keyCode_4: number;
|
|
37
|
+
export { keyCode_4 as keyCode };
|
|
38
|
+
}
|
|
39
|
+
export namespace ArrowLeft {
|
|
40
|
+
let key_5: string;
|
|
41
|
+
export { key_5 as key };
|
|
42
|
+
let code_5: string;
|
|
43
|
+
export { code_5 as code };
|
|
44
|
+
let keyCode_5: number;
|
|
45
|
+
export { keyCode_5 as keyCode };
|
|
46
|
+
}
|
|
47
|
+
export namespace ArrowUp {
|
|
48
|
+
let key_6: string;
|
|
49
|
+
export { key_6 as key };
|
|
50
|
+
let code_6: string;
|
|
51
|
+
export { code_6 as code };
|
|
52
|
+
let keyCode_6: number;
|
|
53
|
+
export { keyCode_6 as keyCode };
|
|
54
|
+
}
|
|
55
|
+
export namespace ArrowRight {
|
|
56
|
+
let key_7: string;
|
|
57
|
+
export { key_7 as key };
|
|
58
|
+
let code_7: string;
|
|
59
|
+
export { code_7 as code };
|
|
60
|
+
let keyCode_7: number;
|
|
61
|
+
export { keyCode_7 as keyCode };
|
|
62
|
+
}
|
|
63
|
+
export namespace ArrowDown {
|
|
64
|
+
let key_8: string;
|
|
65
|
+
export { key_8 as key };
|
|
66
|
+
let code_8: string;
|
|
67
|
+
export { code_8 as code };
|
|
68
|
+
let keyCode_8: number;
|
|
69
|
+
export { keyCode_8 as keyCode };
|
|
70
|
+
}
|
|
71
|
+
export namespace CapsLock {
|
|
72
|
+
let key_9: string;
|
|
73
|
+
export { key_9 as key };
|
|
74
|
+
let code_9: string;
|
|
75
|
+
export { code_9 as code };
|
|
76
|
+
let keyCode_9: number;
|
|
77
|
+
export { keyCode_9 as keyCode };
|
|
78
|
+
}
|
|
79
|
+
export namespace Meta {
|
|
80
|
+
let key_10: string;
|
|
81
|
+
export { key_10 as key };
|
|
82
|
+
}
|
|
83
|
+
export namespace MetaLeft {
|
|
84
|
+
let key_11: string;
|
|
85
|
+
export { key_11 as key };
|
|
86
|
+
let code_10: string;
|
|
87
|
+
export { code_10 as code };
|
|
88
|
+
let keyCode_10: number;
|
|
89
|
+
export { keyCode_10 as keyCode };
|
|
90
|
+
}
|
|
91
|
+
export namespace MetaRight {
|
|
92
|
+
let key_12: string;
|
|
93
|
+
export { key_12 as key };
|
|
94
|
+
let code_11: string;
|
|
95
|
+
export { code_11 as code };
|
|
96
|
+
let keyCode_11: number;
|
|
97
|
+
export { keyCode_11 as keyCode };
|
|
98
|
+
}
|
|
99
|
+
export namespace Control {
|
|
100
|
+
let key_13: string;
|
|
101
|
+
export { key_13 as key };
|
|
102
|
+
}
|
|
103
|
+
export namespace ControlLeft {
|
|
104
|
+
let key_14: string;
|
|
105
|
+
export { key_14 as key };
|
|
106
|
+
let code_12: string;
|
|
107
|
+
export { code_12 as code };
|
|
108
|
+
let keyCode_12: number;
|
|
109
|
+
export { keyCode_12 as keyCode };
|
|
110
|
+
}
|
|
111
|
+
export namespace ControlRight {
|
|
112
|
+
let key_15: string;
|
|
113
|
+
export { key_15 as key };
|
|
114
|
+
let code_13: string;
|
|
115
|
+
export { code_13 as code };
|
|
116
|
+
let keyCode_13: number;
|
|
117
|
+
export { keyCode_13 as keyCode };
|
|
118
|
+
}
|
|
119
|
+
export namespace Alt {
|
|
120
|
+
let key_16: string;
|
|
121
|
+
export { key_16 as key };
|
|
122
|
+
}
|
|
123
|
+
export namespace AltLeft {
|
|
124
|
+
let key_17: string;
|
|
125
|
+
export { key_17 as key };
|
|
126
|
+
let code_14: string;
|
|
127
|
+
export { code_14 as code };
|
|
128
|
+
let keyCode_14: number;
|
|
129
|
+
export { keyCode_14 as keyCode };
|
|
130
|
+
}
|
|
131
|
+
export namespace AltRight {
|
|
132
|
+
let key_18: string;
|
|
133
|
+
export { key_18 as key };
|
|
134
|
+
let code_15: string;
|
|
135
|
+
export { code_15 as code };
|
|
136
|
+
let keyCode_15: number;
|
|
137
|
+
export { keyCode_15 as keyCode };
|
|
138
|
+
}
|
|
139
|
+
export namespace Shift {
|
|
140
|
+
let key_19: string;
|
|
141
|
+
export { key_19 as key };
|
|
142
|
+
}
|
|
143
|
+
export namespace ShiftLeft {
|
|
144
|
+
let key_20: string;
|
|
145
|
+
export { key_20 as key };
|
|
146
|
+
let code_16: string;
|
|
147
|
+
export { code_16 as code };
|
|
148
|
+
let keyCode_16: number;
|
|
149
|
+
export { keyCode_16 as keyCode };
|
|
150
|
+
}
|
|
151
|
+
export namespace ShiftRight {
|
|
152
|
+
let key_21: string;
|
|
153
|
+
export { key_21 as key };
|
|
154
|
+
let code_17: string;
|
|
155
|
+
export { code_17 as code };
|
|
156
|
+
let keyCode_17: number;
|
|
157
|
+
export { keyCode_17 as keyCode };
|
|
158
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const isWeChatMiniProgram: boolean;
|
|
2
|
+
export const isWeChatBrowser: boolean;
|
|
3
|
+
export const isDingtalkBrowser: boolean;
|
|
4
|
+
export const isAlipayBrowser: boolean;
|
|
5
|
+
export const isIOS_OS: boolean;
|
|
6
|
+
export const isAndroidOS: boolean;
|
|
7
|
+
export const isHarmony: boolean;
|
|
8
|
+
export const isMacOS: boolean;
|
|
9
|
+
export const isWindowsOS: boolean;
|
|
10
|
+
export const isMobileDevice: boolean;
|
|
11
|
+
export const isPWA: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const PC_KEY: "pc";
|
|
2
|
+
export const MOBILE_KEY: "mobile";
|
|
3
|
+
export const UI_COMMON_PREFIX: "pqbc";
|
|
4
|
+
export const UI_COMMON_KEY: "pqb-common";
|
|
5
|
+
export const UI_COMMON_THEME_LIGHT_CLASS_NAME: "pqbc-theme-light";
|
|
6
|
+
export const UI_COMMON_THEME_DARK_CLASS_NAME: "pqbc-theme-dark";
|
|
7
|
+
export const UI_PC_PREFIX: "pqb";
|
|
8
|
+
export const UI_PC_KEY: "pqb-pc";
|
|
9
|
+
export const UI_PC_THEME_LIGHT_CLASS_NAME: "pqb-theme-light";
|
|
10
|
+
export const UI_PC_THEME_DARK_CLASS_NAME: "pqb-theme-dark";
|
|
11
|
+
export const UI_MOBILE_PREFIX: "pqbm";
|
|
12
|
+
export const UI_MOBILE_KEY: "pqb-mobile";
|
|
13
|
+
export const UI_MOBILE_THEME_LIGHT_CLASS_NAME: "pqbm-theme-light";
|
|
14
|
+
export const UI_MOBILE_THEME_DARK_CLASS_NAME: "pqbm-theme-dark";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default parseContentDisposition;
|
|
2
|
+
export function getContentDispositionFromHeader(params: any): Object | undefined;
|
|
3
|
+
export function getContentDispositionParametersFilenameFromHeader(params: any): any;
|
|
4
|
+
export function getContentDispositionParametersFromHeader(params: any): any;
|
|
5
|
+
/**
|
|
6
|
+
* 解析 Content-Disposition 头部
|
|
7
|
+
* @param {string} contentDisposition - Content-Disposition 头部字符串
|
|
8
|
+
* @returns {Object} 包含 disposition 类型和参数的对象
|
|
9
|
+
*/
|
|
10
|
+
declare function parseContentDisposition(contentDisposition: string): Object;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 时间单位定义
|
|
3
|
+
* @property name - 单位名称(如 "秒"、"分钟")
|
|
4
|
+
* @property seconds - 该单位对应的秒数
|
|
5
|
+
* @property max - 该单位的最大值(例如月份最大为12,小时最大为24),可选
|
|
6
|
+
*/
|
|
7
|
+
interface TimeUnit {
|
|
8
|
+
name: string;
|
|
9
|
+
seconds: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 支持的输入单位类型
|
|
14
|
+
*/
|
|
15
|
+
type InputTimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week';
|
|
16
|
+
/**
|
|
17
|
+
* 时间单位转换函数
|
|
18
|
+
* @param inputValue 输入的时间值
|
|
19
|
+
* @param options 配置选项
|
|
20
|
+
* @param options.inputUnit 输入单位(默认为 'second')
|
|
21
|
+
* @param options.units 自定义输出单位(默认为 DEFAULT_TIME_UNITS)
|
|
22
|
+
* @param options.maxUnitCount 最多显示几个单位(默认为全部)
|
|
23
|
+
* @param options.keepZero 是否保留0值单位(如 "0小时1分钟")
|
|
24
|
+
* @returns 格式化后的时间字符串(如 "2小时30分钟")
|
|
25
|
+
*/
|
|
26
|
+
declare function convertTime(inputValue: number, options?: {
|
|
27
|
+
inputUnit?: InputTimeUnit;
|
|
28
|
+
units?: TimeUnit[];
|
|
29
|
+
maxUnitCount?: number;
|
|
30
|
+
keepZero?: boolean;
|
|
31
|
+
}): string;
|
|
32
|
+
export default convertTime;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse options.
|
|
3
|
+
*/
|
|
4
|
+
export interface ParseOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
|
|
7
|
+
* Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode
|
|
8
|
+
* a previously-encoded cookie value into a JavaScript string.
|
|
9
|
+
*
|
|
10
|
+
* The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error
|
|
11
|
+
* is thrown it will return the cookie's original value. If you provide your own encode/decode
|
|
12
|
+
* scheme you must ensure errors are appropriately handled.
|
|
13
|
+
*
|
|
14
|
+
* @default decode
|
|
15
|
+
*/
|
|
16
|
+
decode?: (str: string) => string | undefined;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parse a cookie header.
|
|
20
|
+
*
|
|
21
|
+
* Parse the given cookie header string into an object
|
|
22
|
+
* The object has the various cookies as keys(names) => values
|
|
23
|
+
*/
|
|
24
|
+
export declare function parse(str: string, options?: ParseOptions): Record<string, string | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Serialize options.
|
|
27
|
+
*/
|
|
28
|
+
export interface SerializeOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).
|
|
31
|
+
* Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode
|
|
32
|
+
* a value into a string suited for a cookie's value, and should mirror `decode` when parsing.
|
|
33
|
+
*
|
|
34
|
+
* @default encodeURIComponent
|
|
35
|
+
*/
|
|
36
|
+
encode?: (str: string) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).
|
|
39
|
+
*
|
|
40
|
+
* The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
|
|
41
|
+
* `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
|
|
42
|
+
* so if both are set, they should point to the same date and time.
|
|
43
|
+
*/
|
|
44
|
+
maxAge?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).
|
|
47
|
+
* When no expiration is set clients consider this a "non-persistent cookie" and delete it the current session is over.
|
|
48
|
+
*
|
|
49
|
+
* The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and
|
|
50
|
+
* `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,
|
|
51
|
+
* so if both are set, they should point to the same date and time.
|
|
52
|
+
*/
|
|
53
|
+
expires?: Date;
|
|
54
|
+
/**
|
|
55
|
+
* Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).
|
|
56
|
+
* When no domain is set clients consider the cookie to apply to the current domain only.
|
|
57
|
+
*/
|
|
58
|
+
domain?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).
|
|
61
|
+
* When no path is set, the path is considered the ["default path"](https://tools.ietf.org/html/rfc6265#section-5.1.4).
|
|
62
|
+
*/
|
|
63
|
+
path?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).
|
|
66
|
+
* When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.
|
|
67
|
+
*/
|
|
68
|
+
httpOnly?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).
|
|
71
|
+
* When enabled, clients will only send the cookie back if the browser has a HTTPS connection.
|
|
72
|
+
*/
|
|
73
|
+
secure?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).
|
|
76
|
+
* When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.
|
|
77
|
+
*
|
|
78
|
+
* This is an attribute that has not yet been fully standardized, and may change in the future.
|
|
79
|
+
* This also means clients may ignore this attribute until they understand it. More information
|
|
80
|
+
* about can be found in [the proposal](https://github.com/privacycg/CHIPS).
|
|
81
|
+
*/
|
|
82
|
+
partitioned?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
|
|
85
|
+
*
|
|
86
|
+
* - `'low'` will set the `Priority` attribute to `Low`.
|
|
87
|
+
* - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.
|
|
88
|
+
* - `'high'` will set the `Priority` attribute to `High`.
|
|
89
|
+
*
|
|
90
|
+
* More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).
|
|
91
|
+
*/
|
|
92
|
+
priority?: 'low' | 'medium' | 'high';
|
|
93
|
+
/**
|
|
94
|
+
* Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
|
|
95
|
+
*
|
|
96
|
+
* - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
|
|
97
|
+
* - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
|
|
98
|
+
* - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.
|
|
99
|
+
* - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
|
|
100
|
+
*
|
|
101
|
+
* More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).
|
|
102
|
+
*/
|
|
103
|
+
sameSite?: boolean | 'lax' | 'strict' | 'none';
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Serialize data into a cookie header.
|
|
107
|
+
*
|
|
108
|
+
* Serialize a name value pair into a cookie string suitable for
|
|
109
|
+
* http headers. An optional options object specifies cookie parameters.
|
|
110
|
+
*
|
|
111
|
+
* serialize('foo', 'bar', { httpOnly: true })
|
|
112
|
+
* => "foo=bar; httpOnly"
|
|
113
|
+
*/
|
|
114
|
+
export declare function serialize(name: string, val: string, options?: SerializeOptions): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function convertToDurationBasedOnTimeUnits(duration: any, unit: any): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Decimal, default } from "./decimal";
|