@pisell/utils 1.0.71 → 1.0.73
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/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +11 -0
- package/es/arrayUtils.d.ts +4 -1
- package/es/arrayUtils.js +15 -24
- package/es/common/stateHelper.d.ts +6 -2
- package/es/common/stateHelper.js +22 -24
- package/es/common/types.d.ts +13 -10
- package/es/componentStorage.d.ts +27 -25
- package/es/componentStorage.js +94 -130
- package/es/constants/index.js +7 -9
- package/es/date.d.ts +6 -3
- package/es/date.js +36 -53
- package/es/document.d.ts +6 -3
- package/es/document.js +43 -67
- package/es/escPosPrinter/EscPosPrinter.js +353 -490
- package/es/escPosPrinter/index.d.ts +9 -9
- package/es/escPosPrinter/index.js +37 -52
- package/es/format.d.ts +12 -11
- package/es/format.js +90 -116
- package/es/image.d.ts +13 -10
- package/es/image.js +48 -60
- package/es/index.d.ts +38 -23
- package/es/index.js +39 -34
- package/es/jsBridge/index.d.ts +8 -4
- package/es/jsBridge/index.js +57 -56
- package/es/jsBridge/regDeviceApi.js +107 -149
- package/es/jsBridge/types.d.ts +95 -115
- package/es/locales.d.ts +11 -8
- package/es/locales.js +77 -96
- package/es/log.d.ts +11 -6
- package/es/log.js +37 -59
- package/es/miniRedux.d.ts +20 -13
- package/es/miniRedux.js +42 -78
- package/es/number-input/hooks/useNumberInputState.d.ts +6 -2
- package/es/number-input/hooks/useNumberInputState.js +71 -128
- package/es/number-input/types.d.ts +88 -88
- package/es/number-input/utils/formatter.d.ts +13 -10
- package/es/number-input/utils/formatter.js +51 -77
- package/es/number-input/utils/validation.d.ts +7 -2
- package/es/number-input/utils/validation.js +51 -66
- package/es/otherUtils.d.ts +12 -9
- package/es/otherUtils.js +71 -129
- package/es/platform.d.ts +17 -9
- package/es/platform.js +78 -85
- package/es/select/hooks/useDebouncedSearch.d.ts +4 -1
- package/es/select/hooks/useDebouncedSearch.js +39 -53
- package/es/select/hooks/useSelectState.d.ts +7 -7
- package/es/select/hooks/useSelectState.js +56 -113
- package/es/select/index.d.ts +7 -8
- package/es/select/types.d.ts +211 -211
- package/es/select/utils/filterOptions.d.ts +7 -6
- package/es/select/utils/filterOptions.js +26 -31
- package/es/select/utils/helpers.d.ts +10 -9
- package/es/select/utils/helpers.js +42 -52
- package/es/select/utils/index.d.ts +4 -7
- package/es/select/utils/sortOptions.d.ts +6 -5
- package/es/select/utils/sortOptions.js +19 -31
- package/es/select/utils/tagAggregation.d.ts +6 -6
- package/es/select/utils/tagAggregation.js +34 -47
- package/es/text-input/hooks/useTextInputState.d.ts +6 -2
- package/es/text-input/hooks/useTextInputState.js +69 -126
- package/es/text-input/types.d.ts +48 -48
- package/es/text-input/utils/validation.d.ts +7 -2
- package/es/text-input/utils/validation.js +50 -70
- package/es/typeUtils.d.ts +11 -8
- package/es/typeUtils.js +61 -84
- package/es/walletValidity.d.ts +36 -34
- package/es/walletValidity.js +332 -456
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +27 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +12 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +25 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +14 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +9 -0
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +16 -0
- package/lib/_virtual/_rolldown/runtime.js +23 -0
- package/lib/arrayUtils.d.ts +4 -1
- package/lib/arrayUtils.js +14 -39
- package/lib/common/stateHelper.d.ts +6 -2
- package/lib/common/stateHelper.js +21 -32
- package/lib/common/types.d.ts +13 -10
- package/lib/componentStorage.d.ts +27 -25
- package/lib/componentStorage.js +96 -126
- package/lib/constants/index.js +7 -36
- package/lib/date.d.ts +6 -3
- package/lib/date.js +43 -65
- package/lib/document.d.ts +6 -3
- package/lib/document.js +46 -62
- package/lib/escPosPrinter/EscPosPrinter.js +327 -403
- package/lib/escPosPrinter/index.d.ts +9 -9
- package/lib/escPosPrinter/index.js +38 -84
- package/lib/format.d.ts +12 -11
- package/lib/format.js +91 -99
- package/lib/image.d.ts +13 -10
- package/lib/image.js +48 -74
- package/lib/index.d.ts +38 -23
- package/lib/index.js +115 -78
- package/lib/jsBridge/index.d.ts +8 -4
- package/lib/jsBridge/index.js +58 -77
- package/lib/jsBridge/regDeviceApi.js +106 -153
- package/lib/jsBridge/types.d.ts +95 -115
- package/lib/locales.d.ts +11 -8
- package/lib/locales.js +79 -90
- package/lib/log.d.ts +11 -6
- package/lib/log.js +37 -61
- package/lib/miniRedux.d.ts +20 -13
- package/lib/miniRedux.js +43 -92
- package/lib/number-input/hooks/useNumberInputState.d.ts +6 -2
- package/lib/number-input/hooks/useNumberInputState.js +71 -81
- package/lib/number-input/types.d.ts +88 -88
- package/lib/number-input/utils/formatter.d.ts +13 -10
- package/lib/number-input/utils/formatter.js +52 -49
- package/lib/number-input/utils/validation.d.ts +7 -2
- package/lib/number-input/utils/validation.js +50 -52
- package/lib/otherUtils.d.ts +12 -9
- package/lib/otherUtils.js +86 -98
- package/lib/platform.d.ts +17 -9
- package/lib/platform.js +85 -122
- package/lib/select/hooks/useDebouncedSearch.d.ts +4 -1
- package/lib/select/hooks/useDebouncedSearch.js +40 -41
- package/lib/select/hooks/useSelectState.d.ts +7 -7
- package/lib/select/hooks/useSelectState.js +58 -93
- package/lib/select/index.d.ts +7 -8
- package/lib/select/types.d.ts +211 -211
- package/lib/select/utils/filterOptions.d.ts +7 -6
- package/lib/select/utils/filterOptions.js +26 -37
- package/lib/select/utils/helpers.d.ts +10 -9
- package/lib/select/utils/helpers.js +45 -41
- package/lib/select/utils/index.d.ts +4 -7
- package/lib/select/utils/sortOptions.d.ts +6 -5
- package/lib/select/utils/sortOptions.js +18 -39
- package/lib/select/utils/tagAggregation.d.ts +6 -6
- package/lib/select/utils/tagAggregation.js +33 -41
- package/lib/text-input/hooks/useTextInputState.d.ts +6 -2
- package/lib/text-input/hooks/useTextInputState.js +69 -79
- package/lib/text-input/types.d.ts +48 -48
- package/lib/text-input/utils/validation.d.ts +7 -2
- package/lib/text-input/utils/validation.js +49 -58
- package/lib/typeUtils.d.ts +11 -8
- package/lib/typeUtils.js +68 -73
- package/lib/walletValidity.d.ts +36 -34
- package/lib/walletValidity.js +345 -317
- package/package.json +1 -2
- package/es/common/index.d.ts +0 -5
- package/es/common/index.js +0 -5
- package/es/common/types.js +0 -1
- package/es/constants/index.d.ts +0 -7
- package/es/firebase/config/index.d.ts +0 -13
- package/es/firebase/config/index.js +0 -54
- package/es/firebase/index.d.ts +0 -28
- package/es/firebase/index.js +0 -232
- package/es/jsBridge/types.js +0 -1
- package/es/number-input/hooks/index.d.ts +0 -4
- package/es/number-input/hooks/index.js +0 -5
- package/es/number-input/index.d.ts +0 -14
- package/es/number-input/index.js +0 -21
- package/es/number-input/types.js +0 -1
- package/es/number-input/utils/index.d.ts +0 -7
- package/es/number-input/utils/index.js +0 -8
- package/es/select/hooks/index.d.ts +0 -5
- package/es/select/hooks/index.js +0 -6
- package/es/select/index.js +0 -13
- package/es/select/types.js +0 -1
- package/es/select/utils/index.js +0 -8
- package/es/text-input/hooks/index.d.ts +0 -4
- package/es/text-input/hooks/index.js +0 -5
- package/es/text-input/index.d.ts +0 -14
- package/es/text-input/index.js +0 -20
- package/es/text-input/types.js +0 -1
- package/es/text-input/utils/index.d.ts +0 -5
- package/es/text-input/utils/index.js +0 -7
- package/lib/common/index.d.ts +0 -5
- package/lib/common/index.js +0 -29
- package/lib/common/types.js +0 -17
- package/lib/constants/index.d.ts +0 -7
- package/lib/firebase/config/index.d.ts +0 -13
- package/lib/firebase/config/index.js +0 -79
- package/lib/firebase/index.d.ts +0 -28
- package/lib/firebase/index.js +0 -180
- package/lib/jsBridge/types.js +0 -17
- package/lib/number-input/hooks/index.d.ts +0 -4
- package/lib/number-input/hooks/index.js +0 -29
- package/lib/number-input/index.d.ts +0 -14
- package/lib/number-input/index.js +0 -41
- package/lib/number-input/types.js +0 -17
- package/lib/number-input/utils/index.d.ts +0 -7
- package/lib/number-input/utils/index.js +0 -39
- package/lib/select/hooks/index.d.ts +0 -5
- package/lib/select/hooks/index.js +0 -34
- package/lib/select/index.js +0 -53
- package/lib/select/types.js +0 -17
- package/lib/select/utils/index.js +0 -48
- package/lib/text-input/hooks/index.d.ts +0 -4
- package/lib/text-input/hooks/index.js +0 -29
- package/lib/text-input/index.d.ts +0 -14
- package/lib/text-input/index.js +0 -35
- package/lib/text-input/types.js +0 -17
- package/lib/text-input/utils/index.d.ts +0 -5
- package/lib/text-input/utils/index.js +0 -32
package/es/date.js
CHANGED
|
@@ -1,59 +1,42 @@
|
|
|
1
1
|
import dayjs from "dayjs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
'D MMM YYYY, hh:mma',
|
|
5
|
-
// 2023-07-19
|
|
6
|
-
'YYYY-MM-DD'];
|
|
7
|
-
|
|
2
|
+
//#region src/date.ts
|
|
3
|
+
const formatMaps = ["D MMM YYYY, hh:mma", "YYYY-MM-DD"];
|
|
8
4
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return date;
|
|
22
|
-
}
|
|
23
|
-
return dayjs(date).format(_format);
|
|
5
|
+
* @title: 格式化日期
|
|
6
|
+
* @description:
|
|
7
|
+
* @param {string} date
|
|
8
|
+
* @param {string} format
|
|
9
|
+
* @return {*}
|
|
10
|
+
* @Author: zhiwei.Wang
|
|
11
|
+
* @Date: 2023-07-21 10:49
|
|
12
|
+
*/
|
|
13
|
+
const formatDate = (date, format) => {
|
|
14
|
+
let _format = format || formatMaps[0];
|
|
15
|
+
if (!date) return date;
|
|
16
|
+
return dayjs(date).format(_format);
|
|
24
17
|
};
|
|
25
|
-
|
|
26
18
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var jsDate = formatDate(new Date(dateOffset), formatMaps[1]);
|
|
39
|
-
return jsDate;
|
|
19
|
+
* @title: excel日期 转 js日期
|
|
20
|
+
* @description:
|
|
21
|
+
* @param {number} excelDate
|
|
22
|
+
* @return {*}
|
|
23
|
+
* @Author: zhiwei.Wang
|
|
24
|
+
* @Date: 2023-07-21 10:49
|
|
25
|
+
*/
|
|
26
|
+
const excelDateToJSDate = (excelDate) => {
|
|
27
|
+
const dateOffset = (excelDate - 25569) * 864e5;
|
|
28
|
+
return formatDate(new Date(dateOffset), formatMaps[1]);
|
|
40
29
|
};
|
|
41
|
-
|
|
42
30
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var excelDate = dateOffset / 86400000 + 25569; // 将毫秒数转换回天数,并加上Excel的起始日期偏移量
|
|
57
|
-
|
|
58
|
-
return excelDate;
|
|
59
|
-
};
|
|
31
|
+
* @title: js日期 转 excel日期
|
|
32
|
+
* @description:
|
|
33
|
+
* @param {string} jsDate
|
|
34
|
+
* @return {*}
|
|
35
|
+
* @Author: zhiwei.Wang
|
|
36
|
+
* @Date: 2023-07-21 10:49
|
|
37
|
+
*/
|
|
38
|
+
const jsDateToExcelDate = (jsDate) => {
|
|
39
|
+
return (new Date(jsDate) - new Date(Date.UTC(1900, 0, 1))) / 864e5 + 25569;
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { excelDateToJSDate, formatDate, jsDateToExcelDate };
|
package/es/document.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
//#region src/document.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* @Title: 设置主题
|
|
3
4
|
* @Describe: 传入字符串键值对
|
|
4
5
|
* @Author: Wzw
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
declare const setTheme: (themes: {
|
|
8
|
+
[key: string]: string;
|
|
8
9
|
}) => void;
|
|
9
10
|
/**
|
|
10
11
|
* 复制到剪切板
|
|
11
12
|
* @param text
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
declare const copyToClipboard: (text: string) => Promise<void>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { copyToClipboard, setTheme };
|
package/es/document.js
CHANGED
|
@@ -1,71 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
1
|
+
import { _asyncToGenerator } from "./_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
2
|
+
//#region src/document.ts
|
|
5
3
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} catch (err) {
|
|
18
|
-
console.error(err);
|
|
19
|
-
}
|
|
4
|
+
* @Title: 设置主题
|
|
5
|
+
* @Describe: 传入字符串键值对
|
|
6
|
+
* @Author: Wzw
|
|
7
|
+
*/
|
|
8
|
+
const setTheme = (themes) => {
|
|
9
|
+
try {
|
|
10
|
+
let _themes = Object.entries(themes);
|
|
11
|
+
for (let item of _themes) document.documentElement.style.setProperty(item[0], item[1]);
|
|
12
|
+
} catch (err) {
|
|
13
|
+
console.error(err);
|
|
14
|
+
}
|
|
20
15
|
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
const httpCopyToClipboard = (text) => {
|
|
17
|
+
const textArea = document.createElement("textarea");
|
|
18
|
+
textArea.value = text;
|
|
19
|
+
textArea.style.position = "fixed";
|
|
20
|
+
textArea.style.top = "-10000px";
|
|
21
|
+
textArea.style.left = "-10000px";
|
|
22
|
+
document.body.appendChild(textArea);
|
|
23
|
+
textArea.focus();
|
|
24
|
+
textArea.select();
|
|
25
|
+
document.execCommand("copy");
|
|
26
|
+
document.body.removeChild(textArea);
|
|
32
27
|
};
|
|
33
|
-
|
|
34
28
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
_context.t0 = _context["catch"](1);
|
|
55
|
-
console.error(_context.t0);
|
|
56
|
-
return _context.abrupt("return", httpCopyToClipboard(text));
|
|
57
|
-
case 11:
|
|
58
|
-
_context.next = 14;
|
|
59
|
-
break;
|
|
60
|
-
case 13:
|
|
61
|
-
return _context.abrupt("return", httpCopyToClipboard(text));
|
|
62
|
-
case 14:
|
|
63
|
-
case "end":
|
|
64
|
-
return _context.stop();
|
|
65
|
-
}
|
|
66
|
-
}, _callee, null, [[1, 7]]);
|
|
67
|
-
}));
|
|
68
|
-
return function copyToClipboard(_x) {
|
|
69
|
-
return _ref.apply(this, arguments);
|
|
70
|
-
};
|
|
71
|
-
}();
|
|
29
|
+
* 复制到剪切板
|
|
30
|
+
* @param text
|
|
31
|
+
*/
|
|
32
|
+
const copyToClipboard = function() {
|
|
33
|
+
var _ref = _asyncToGenerator(function* (text) {
|
|
34
|
+
if (navigator.clipboard) try {
|
|
35
|
+
return yield navigator.clipboard.writeText(text);
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error(error);
|
|
38
|
+
return httpCopyToClipboard(text);
|
|
39
|
+
}
|
|
40
|
+
else return httpCopyToClipboard(text);
|
|
41
|
+
});
|
|
42
|
+
return function copyToClipboard(_x) {
|
|
43
|
+
return _ref.apply(this, arguments);
|
|
44
|
+
};
|
|
45
|
+
}();
|
|
46
|
+
//#endregion
|
|
47
|
+
export { copyToClipboard, setTheme };
|