fix: 修改最终版本

This commit is contained in:
NICE CODE BY DEV 2023-12-21 14:38:13 +08:00
parent c79df9aea1
commit 11d003d630
95 changed files with 2737 additions and 136 deletions

View File

@ -1,8 +0,0 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

View File

@ -5,7 +5,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"baseBranch": "origin/master",
"updateInternalDependencies": "patch",
"ignore": []
}

View File

@ -2,16 +2,25 @@ import { defineConfig } from 'dumi';
import path from 'path';
export default defineConfig({
logo: '/logo.jpg',
favicons: ['/logo.jpg'],
history: { type: 'hash' },
outputPath: 'docs-dist',
themeConfig: {
name: 'zhst前端库',
},
alias: {
'@zhst/hooks': path.join(__dirname, 'packages/demo/src'),
'@zhst/hooks': path.join(__dirname, 'packages/hooks/src'),
'@zhst/func': path.join(__dirname, 'packages/utils/src'),
'@zhst/biz': path.join(__dirname, 'packages/biz/src'),
},
resolve: {
docDirs: ['docs'],
atomDirs: [{ type: 'demo', dir: 'packages/demo/src' }],
atomDirs: [
{ type: 'hooks', dir: 'packages/hooks/src' },
{ type: 'utils', dir: 'packages/utils/src' },
{ type: 'biz', dir: 'packages/biz/src' },
],
},
monorepoRedirect: {
srcDir: ['packages', 'src'],

View File

@ -1,3 +1,7 @@
module.exports = {
extends: require.resolve('@umijs/lint/dist/config/eslint'),
ignorePatterns: ['/docs-dist', '/packages/**'],
rules: {
'@typescript-eslint/no-unused-expressions': 0,
},
};

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ node_modules
.dumi/tmp-test
.dumi/tmp-production
.DS_Store
/docs-dist

View File

@ -1,2 +1,4 @@
/dist
*.yaml
/docs-dist
/packages

View File

@ -4,15 +4,15 @@ hero:
description: 前端工具库合集
actions:
- text: 快速上手
link: /
link: /hooks
features:
- title: 快速
emoji: 💎
description: Put hello description here
- title: 高效
- title: biz
emoji: 🌈
description: Put world description here
- title: 先进
emoji: 🚀
description: Put ! description here
description: 业务库
- title: hooks
emoji: 💎
description: hooks
- title: func
emoji: 🌈
description: 常用函数库
---

View File

@ -5,7 +5,8 @@
"npmClient": "pnpm",
"command": {
"publish": {
"registry": "https://registry.npmjs.org/"
"registry": "https://registry.npmjs.org/",
"@zhst:registry": "http://10.0.0.77:4874"
},
"version": {
"conventionalCommits": true,

View File

@ -10,6 +10,7 @@
"dist"
],
"scripts": {
"add": "pnpm run build && pnpm changeset add",
"build": "pnpm --filter=@zhst/* run build",
"build:watch": "father dev",
"dev": "dumi dev",
@ -20,7 +21,9 @@
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
"prepare": "husky install && dumi setup",
"prepublishOnly": "father doctor && npm run build",
"start": "npm run dev"
"pub": "pnpm changeset publish",
"start": "npm run dev",
"v": "pnpm changeset version"
},
"commitlint": {
"extends": [

View File

@ -0,0 +1,7 @@
import { defineConfig } from 'father';
export default defineConfig({
// more father config: https://github.com/umijs/father/blob/master/docs/config.md
esm: { output: 'es' },
cjs: { output: 'lib' },
});

View File

@ -0,0 +1,9 @@
# @zhst/biz
## 0.2.3
### Patch Changes
- fix: 调试包 link
- Updated dependencies
- @zhst/hooks@0.2.3

7
packages/biz/README.md Normal file
View File

@ -0,0 +1,7 @@
## 介绍
业务库
## 安装
> pnpm install @zhst/biz

0
packages/biz/es/index.d.ts vendored Normal file
View File

0
packages/biz/es/index.js Normal file
View File

0
packages/biz/lib/index.d.ts vendored Normal file
View File

View File

35
packages/biz/package.json Normal file
View File

@ -0,0 +1,35 @@
{
"name": "@zhst/biz",
"version": "0.2.3",
"description": "业务库",
"keywords": [
"business",
"biz",
"zhst"
],
"license": "ISC",
"author": "dev",
"sideEffects": [
"dist/*",
"es/**/style/*",
"lib/**/style/*",
"*.less"
],
"main": "lib/index.tsx",
"module": "es/index.js",
"typings": "es/index.d.ts",
"files": [
"es",
"lib"
],
"scripts": {
"build": "father build"
},
"publishConfig": {
"access": "public",
"registry": "http://10.0.0.77:4874"
},
"dependencies": {
"@zhst/hooks": "workspace:^"
}
}

10
packages/biz/src/index.md Normal file
View File

@ -0,0 +1,10 @@
---
nav:
title: biz
order: 1
title: 快速上手
---
<embed src="../README.md" ></embed>
<embed src="../CHANGELOG.md" ></embed>

View File

View File

@ -0,0 +1,19 @@
# @zhst/hooks
## 0.2.3
### Patch Changes
- fix: 调试包 link
## 0.2.2
### Patch Changes
- fix: 修改源
## 0.2.1
### Patch Changes
- fix: 修改版本号

7
packages/hooks/README.md Normal file
View File

@ -0,0 +1,7 @@
## 介绍
业务中常用函数方法
## 安装
> pnpm install @zhst/hooks

View File

@ -1,5 +0,0 @@
import { type FC } from 'react';
declare const Foo: FC<{
title: string;
}>;
export default Foo;

View File

@ -1,5 +0,0 @@
import React from 'react';
let Foo = function Foo(props) {
return /*#__PURE__*/React.createElement("h4", null, "\u6D4B\u8BD5\uFF1A", props.title);
};
export default Foo;

View File

@ -1,2 +1,2 @@
import Foo from './Foo';
export { Foo };
export * from 'ahooks';
export { default as useRafLoop } from './useRafLoop';

View File

@ -1,2 +1,2 @@
import Foo from "./Foo";
export { Foo };
export * from 'ahooks';
export { default as useRafLoop } from "./useRafLoop";

2
packages/hooks/es/useRafLoop.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export type RafLoopReturns = [() => void, () => void, () => boolean];
export default function useRafLoop(callback: FrameRequestCallback, initiallyActive?: boolean): RafLoopReturns;

View File

@ -0,0 +1,40 @@
import { useCallback, useEffect, useMemo, useRef } from 'react';
export default function useRafLoop(callback) {
var initiallyActive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var raf = useRef(null);
var rafActivity = useRef(false);
var rafCallback = useRef(callback);
rafCallback.current = callback;
var step = useCallback(function (time) {
if (rafActivity.current) {
rafCallback.current(time);
raf.current = requestAnimationFrame(step);
}
}, []);
var result = useMemo(function () {
return [function () {
// stop
if (rafActivity.current) {
rafActivity.current = false;
// @ts-ignore
raf.current && cancelAnimationFrame(raf.current);
}
}, function () {
// start
if (!rafActivity.current) {
rafActivity.current = true;
raf.current = requestAnimationFrame(step);
}
}, function () {
return rafActivity.current;
} // isActive
];
}, []);
useEffect(function () {
if (initiallyActive) {
result[1]();
}
return result[0];
}, []);
return result;
}

View File

@ -1,5 +0,0 @@
import { type FC } from 'react';
declare const Foo: FC<{
title: string;
}>;
export default Foo;

View File

@ -1,37 +0,0 @@
let __create = Object.create;
let __defProp = Object.defineProperty;
let __getOwnPropDesc = Object.getOwnPropertyDescriptor;
let __getOwnPropNames = Object.getOwnPropertyNames;
let __getProtoOf = Object.getPrototypeOf;
let __hasOwnProp = Object.prototype.hasOwnProperty;
let __export = (target, all) => {
for (let name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
let __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
let __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
let __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/Foo/index.tsx
let Foo_exports = {};
__export(Foo_exports, {
default: () => Foo_default
});
module.exports = __toCommonJS(Foo_exports);
let import_react = __toESM(require("react"));
let Foo = (props) => /* @__PURE__ */ import_react.default.createElement("h4", null, "测试:", props.title);
var Foo_default = Foo;

View File

@ -1,2 +1,2 @@
import Foo from './Foo';
export { Foo };
export * from 'ahooks';
export { default as useRafLoop } from './useRafLoop';

View File

@ -1,14 +1,14 @@
let __create = Object.create;
let __defProp = Object.defineProperty;
let __getOwnPropDesc = Object.getOwnPropertyDescriptor;
let __getOwnPropNames = Object.getOwnPropertyNames;
let __getProtoOf = Object.getPrototypeOf;
let __hasOwnProp = Object.prototype.hasOwnProperty;
let __export = (target, all) => {
for (let name in all)
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
let __copyProps = (to, from, except, desc) => {
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
@ -16,7 +16,8 @@ let __copyProps = (to, from, except, desc) => {
}
return to;
};
let __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
@ -24,16 +25,18 @@ let __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
let __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.tsx
let src_exports = {};
var src_exports = {};
__export(src_exports, {
Foo: () => import_Foo.default
useRafLoop: () => import_useRafLoop.default
});
module.exports = __toCommonJS(src_exports);
var import_Foo = __toESM(require("./Foo"));
__reExport(src_exports, require("ahooks"), module.exports);
var import_useRafLoop = __toESM(require("./useRafLoop"));
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Foo
useRafLoop,
...require("ahooks")
});

2
packages/hooks/lib/useRafLoop.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
export type RafLoopReturns = [() => void, () => void, () => boolean];
export default function useRafLoop(callback: FrameRequestCallback, initiallyActive?: boolean): RafLoopReturns;

View File

@ -0,0 +1,63 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/useRafLoop.ts
var useRafLoop_exports = {};
__export(useRafLoop_exports, {
default: () => useRafLoop
});
module.exports = __toCommonJS(useRafLoop_exports);
var import_react = require("react");
function useRafLoop(callback, initiallyActive = true) {
const raf = (0, import_react.useRef)(null);
const rafActivity = (0, import_react.useRef)(false);
const rafCallback = (0, import_react.useRef)(callback);
rafCallback.current = callback;
const step = (0, import_react.useCallback)((time) => {
if (rafActivity.current) {
rafCallback.current(time);
raf.current = requestAnimationFrame(step);
}
}, []);
const result = (0, import_react.useMemo)(
() => [
() => {
if (rafActivity.current) {
rafActivity.current = false;
raf.current && cancelAnimationFrame(raf.current);
}
},
() => {
if (!rafActivity.current) {
rafActivity.current = true;
raf.current = requestAnimationFrame(step);
}
},
() => rafActivity.current
// isActive
],
[]
);
(0, import_react.useEffect)(() => {
if (initiallyActive) {
result[1]();
}
return result[0];
}, []);
return result;
}

View File

@ -1,6 +1,6 @@
{
"name": "@zhst/hooks",
"version": "0.0.1",
"version": "0.2.3",
"description": "hooks合集",
"keywords": [
"hooks"
@ -24,6 +24,11 @@
"build": "father build"
},
"publishConfig": {
"access": "public"
"access": "public",
"registry": "http://10.0.0.77:4874"
},
"dependencies": {
"ahooks": "^3.7.8",
"react": "^18.0.0"
}
}

View File

@ -1,10 +0,0 @@
# Foo
This is an example component.
```jsx
import React from 'react';
import { Foo } from '@zhst/hooks';
export default () => <Foo title="Hello dumi!" />;
```

View File

@ -1,5 +0,0 @@
import React, { type FC } from 'react';
const Foo: FC<{ title: string }> = (props) => <h4>{props.title}</h4>;
export default Foo;

View File

@ -0,0 +1,12 @@
---
nav:
title: hooks
order: 2
title: 示例
---
## useRafLoop
```js
import { useRafLoop } from '@zhst/hooks'
```

View File

@ -0,0 +1,14 @@
---
nav:
title: hooks
order: 1
title: 快速上手
---
<embed src="../README.md" ></embed>
<embed src="../CHANGELOG.md" ></embed>
## 参考文档
[ahooks](https://ahooks.js.org/zh-CN)

View File

@ -1,5 +1,2 @@
import Foo from './Foo'
export {
Foo
}
export * from 'ahooks'
export { default as useRafLoop } from './useRafLoop';

View File

@ -0,0 +1,53 @@
import { useCallback, useEffect, useMemo, useRef } from 'react';
export type RafLoopReturns = [() => void, () => void, () => boolean];
export default function useRafLoop(
callback: FrameRequestCallback,
initiallyActive = true
): RafLoopReturns {
const raf = useRef<number | null>(null);
const rafActivity = useRef<boolean>(false);
const rafCallback = useRef(callback);
rafCallback.current = callback;
const step = useCallback((time: number) => {
if (rafActivity.current) {
rafCallback.current(time);
raf.current = requestAnimationFrame(step);
}
}, []);
const result = useMemo(
() =>
[
() => {
// stop
if (rafActivity.current) {
rafActivity.current = false;
// @ts-ignore
raf.current && cancelAnimationFrame(raf.current);
}
},
() => {
// start
if (!rafActivity.current) {
rafActivity.current = true;
raf.current = requestAnimationFrame(step);
}
},
(): boolean => rafActivity.current, // isActive
] as RafLoopReturns,
[]
);
useEffect(() => {
if (initiallyActive) {
result[1]();
}
return result[0];
}, []);
return result;
}

View File

@ -0,0 +1,7 @@
import { defineConfig } from 'father';
export default defineConfig({
// more father config: https://github.com/umijs/father/blob/master/docs/config.md
esm: { output: 'es' },
cjs: { output: 'lib' },
});

View File

@ -0,0 +1,19 @@
# @zhst/utils
## 0.2.3
### Patch Changes
- fix: 调试包 link
## 0.2.2
### Patch Changes
- fix: 修改源
## 0.2.1
### Patch Changes
- fix: 修改版本号

7
packages/utils/README.md Normal file
View File

@ -0,0 +1,7 @@
## 介绍
收录了业务中常用函数方法
## 安装
> pnpm install @zhst/utils

View File

@ -0,0 +1,3 @@
export default function addEventListener(target: any, eventType: string, cb: any, option: any): {
remove: () => void;
};

View File

@ -0,0 +1,17 @@
import ReactDOM from 'react-dom';
export default function addEventListener(target, eventType, cb, option) {
/* eslint camelcase: 2 */
var callback = ReactDOM.unstable_batchedUpdates ? function run(e) {
ReactDOM.unstable_batchedUpdates(cb, e);
} : cb;
if (target.addEventListener) {
target.addEventListener(eventType, callback, option);
}
return {
remove: function remove() {
if (target.removeEventListener) {
target.removeEventListener(eventType, callback);
}
}
};
}

54
packages/utils/es/file/index.d.ts vendored Normal file
View File

@ -0,0 +1,54 @@
/**
*
* @param url
* @returns dom
*/
export declare const urlToImg: (url: string) => Promise<HTMLImageElement>;
export declare const base64DecodeImageKey: (base64ImgKey: string) => string;
/**
* url获取图片的base64字符串
* @param src
* @param outputFormat
* @returns base64 @string
*/
export declare const getBase64ByUrl: (src: string | URL, outputFormat?: string) => Promise<unknown>;
/**
* base64
* @param file @file
* @returns @string
*/
export declare const fileToBase64: (file: any) => Promise<string>;
/**
*
* @param image @file
* @param width @number
* @param height @number
* @returns @string base64
*/
export declare const getBase64Image: (image: any, width?: any, height?: any) => string;
/**
* base64
* @param src
* @returns @string
*/
export declare const getBase64ByImage: (src: string) => Promise<unknown>;
/**
* url转base64
* @param {String} url - url地址
*/
export declare const urlToBase64V2: (url: string) => Promise<unknown>;
/**
* base64转Blob
* @param {String} base64 - base64
*/
export declare function base64toBlob(base64: string): Blob | undefined;
/**
*
* 1. url -> base64 -> blob
* 2. blob加入jsZip文件夹内file-saver保存
* @param {Array<{url:string,name:string}>} imgDataList
* @param {string} zipName
*/
export declare const downloadPackageImages: (imgDataList: string | any[], zipName: string) => Promise<void>;
export declare function getFileSize(size: number): string;
export declare const dataURLToBlob: (dataurl: string) => Blob;

File diff suppressed because one or more lines are too long

7
packages/utils/es/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export * from './file';
export * from './map';
export * from './performance';
export * from './string';
export * from './number';
export * from './time';
export * from './utils';

View File

@ -0,0 +1,7 @@
export * from "./file";
export * from "./map";
export * from "./performance";
export * from "./string";
export * from "./number";
export * from "./time";
export * from "./utils";

10
packages/utils/es/map/index.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
/**
*
* @param lngLat
* @returns @object { long, lat }
*/
export declare const fixedLngLat: (lngLat?: string) => string;
export declare const transformLngLat: (lngLat?: string) => {
longitude: number;
latitude: number;
} | null;

View File

@ -0,0 +1,32 @@
/**
* 获取经纬信息
* @param lngLat 位置信息
* @returns @object { long, lat }
*/
export var fixedLngLat = function fixedLngLat(lngLat) {
if (!lngLat) {
return '';
}
var lngLatArr = lngLat.split(',');
var longitude = Number(lngLatArr[0]).toFixed(6);
var latitude = Number(lngLatArr[1]).toFixed(6);
if (lngLatArr.length < 2) {
return '';
}
return "".concat(longitude, ",").concat(latitude);
};
export var transformLngLat = function transformLngLat(lngLat) {
if (lngLat) {
var lngLatArr = lngLat ? lngLat.split(',') : [];
var longitude = Number(lngLatArr[0]);
var latitude = Number(lngLatArr[1]);
if (lngLatArr.length < 2) {
return null;
}
return {
longitude: longitude,
latitude: latitude
};
}
return null;
};

8
packages/utils/es/number/index.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
/**
*
* @param originNumber
* @param accuracy
* @param isCeil
* @returns number
*/
export declare const setNumberAccuracy: (originNumber: number, accuracy?: number, isCeil?: boolean) => number;

View File

@ -0,0 +1,27 @@
/**
* 设置数据的精度
* @param originNumber
* @param accuracy 精度 以原点为中心向左为正向右为负
* @param isCeil 是否为向上取整
* @returns number
*/
export var setNumberAccuracy = function setNumberAccuracy(originNumber) {
var accuracy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var isCeil = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
if (originNumber === 0) {
return 0;
}
var returnData = 0;
if (isCeil) {
returnData = Math.ceil(originNumber / Math.pow(10, accuracy)) * Math.pow(10, accuracy);
} else {
returnData = Math.floor(originNumber / Math.pow(10, accuracy)) * Math.pow(10, accuracy);
}
//设置精度
if (accuracy < 0) {
returnData = Number(returnData.toFixed(-accuracy));
} else {
returnData = Number(returnData.toFixed(0));
}
return returnData;
};

View File

@ -0,0 +1 @@
export declare const speedConvert: (bps: number, contertUnit?: number) => string;

View File

@ -0,0 +1,14 @@
// 1.bps KB/s or MB/s or GB/s 2.保留两位小数 3.默认是bps
export var speedConvert = function speedConvert(bps) {
var contertUnit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
if (bps === undefined) return "0KB/s";
var byte = bps / contertUnit;
if (bps > 1024 * 1024 * 1024) {
return "".concat((byte / 1024 / 1024 / 1024).toFixed(2), "GB/s");
} else if (byte > 1024 * 1024) {
return "".concat((byte / 1024 / 1024).toFixed(2), "MB/s");
} else if (byte > 1024) {
return "".concat((byte / 1024).toFixed(2), "KB/s");
}
return "".concat(byte, "KB/s");
};

7
packages/utils/es/string/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export declare const getStrLength: (str: string) => number;
/**
* js截取字符串
* @param str
* @param len: 需要截取的长度
*/
export declare const cutStr: (str: string, len: number) => string | String | undefined;

View File

@ -0,0 +1,45 @@
///<summary>获得字符串实际长度中文2英文1</summary>
///<param name="str">要获得长度的字符串</param>
export var getStrLength = function getStrLength(str) {
var realLength = 0,
len = str.length,
charCode = -1;
for (var i = 0; i < len; i++) {
charCode = str.charCodeAt(i);
if (charCode >= 0 && charCode <= 128) realLength += 1;else realLength += 2;
}
return realLength;
};
//js截取字符串中英文都能用
//如果给定的字符串大于指定长度,截取指定长度返回,否者返回源字符串。
//字符串,长度
/**
* js截取字符串中英文都能用
* @param str需要截取的字符串
* @param len: 需要截取的长度
*/
export var cutStr = function cutstr(str, len) {
var str_length = 0;
var str_len = 0;
var str_cut = new String();
str_len = str.length;
for (var i = 0; i < str_len; i++) {
var a = str.charAt(i);
str_length++;
if (escape(a).length > 4) {
//中文字符的长度经编码之后大于4
str_length++;
}
str_cut = str_cut.concat(a);
if (str_length >= len) {
str_cut = str_cut.concat('...');
return str_cut;
}
}
//如果给定字符串小于指定长度,则返回源字符串;
if (str_length < len) {
return str;
}
};

5
packages/utils/es/time/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export declare const formateDuration: (diff: number) => string;
export declare function generateTime(): {
startDateTime: number;
endDateTime: number;
};

View File

@ -0,0 +1,49 @@
//时间差计算
import dayjs from "dayjs";
/*
* startDate==>开始时间
* endDate==>结束时间
* 事例diffTime(data.createTime,new Date())
*
* */
export var formateDuration = function formateDuration(diff) {
//计算出相差天数
var days = Math.floor(diff / (24 * 3600 * 1000));
//计算出小时数
var leave1 = diff % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
var hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数
var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
var minutes = Math.floor(leave2 / (60 * 1000));
//计算相差秒数
var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
var seconds = Math.round(leave3 / 1000);
var returnStr = seconds + '秒';
if (minutes > 0) {
returnStr = minutes + '分'; //+ returnStr;
}
if (hours > 0) {
returnStr = hours + '小时'; // + returnStr;
}
if (days > 0) {
returnStr = days + '天'; //+ returnStr;
}
return returnStr;
};
//检索默认时间
export function generateTime() {
var endDateTime = dayjs().endOf('day').unix();
var startDateTime = dayjs().startOf('day').unix();
return {
startDateTime: startDateTime,
endDateTime: endDateTime
};
}

15
packages/utils/es/utils/index.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
export declare const matchS3Prefix: (str: string) => boolean;
/**
*
* @param fileName
* @returns
*/
export declare const getFileSuffix: (fileName: string) => string;
/**
*
* @param type
* @returns
*/
export declare const getImageSuffixByFileType: (type: string) => string;
export declare function getChromeVersion(): number | false;
export declare const nextTick: (func: (value: void) => void | PromiseLike<void>) => void;

View File

@ -0,0 +1,76 @@
export var matchS3Prefix = function matchS3Prefix(str) {
return /^v[0-9]_/.test(str);
};
/**
* 通过文件名获取文件类型
* @param fileName 文件名称
* @returns 文件类型
*/
export var getFileSuffix = function getFileSuffix(fileName) {
var splitArr = fileName.split('.');
return splitArr.length < 2 ? '' : splitArr[splitArr.length - 1];
};
/**
* 通过类型获取文件名
* @param type 类型
* @returns
*/
export var getImageSuffixByFileType = function getImageSuffixByFileType(type) {
var imageSuffix = '';
switch (type) {
case 'jpeg':
{
imageSuffix = '.jpg';
break;
}
case 'gif':
{
imageSuffix = '.gif';
break;
}
case 'png':
{
imageSuffix = '.png';
break;
}
case 'vnd.wap.wbmp':
{
imageSuffix = '.wbmp';
break;
}
case 'x-up-wpng':
{
imageSuffix = '.wpng';
break;
}
case 'nbmp':
{
imageSuffix = '.nbmp';
break;
}
}
return imageSuffix;
};
// 获取谷歌浏览器版本
export function getChromeVersion() {
var arr = navigator.userAgent.split(' ');
var chromeVersion = '';
for (var i = 0; i < arr.length; i++) {
if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
}
if (chromeVersion) {
return Number(chromeVersion.split('/')[1].split('.')[0]);
} else {
return false;
}
}
export var nextTick = function nextTick(func) {
if (queueMicrotask) {
queueMicrotask(func);
return;
}
Promise.resolve().then(func);
};

View File

@ -0,0 +1,3 @@
export default function addEventListener(target: any, eventType: string, cb: any, option: any): {
remove: () => void;
};

View File

@ -0,0 +1,50 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/addEventListener/index.ts
var addEventListener_exports = {};
__export(addEventListener_exports, {
default: () => addEventListener
});
module.exports = __toCommonJS(addEventListener_exports);
var import_react_dom = __toESM(require("react-dom"));
function addEventListener(target, eventType, cb, option) {
const callback = import_react_dom.default.unstable_batchedUpdates ? function run(e) {
import_react_dom.default.unstable_batchedUpdates(cb, e);
} : cb;
if (target.addEventListener) {
target.addEventListener(eventType, callback, option);
}
return {
remove: () => {
if (target.removeEventListener) {
target.removeEventListener(eventType, callback);
}
}
};
}

54
packages/utils/lib/file/index.d.ts vendored Normal file
View File

@ -0,0 +1,54 @@
/**
*
* @param url
* @returns dom
*/
export declare const urlToImg: (url: string) => Promise<HTMLImageElement>;
export declare const base64DecodeImageKey: (base64ImgKey: string) => string;
/**
* url获取图片的base64字符串
* @param src
* @param outputFormat
* @returns base64 @string
*/
export declare const getBase64ByUrl: (src: string | URL, outputFormat?: string) => Promise<unknown>;
/**
* base64
* @param file @file
* @returns @string
*/
export declare const fileToBase64: (file: any) => Promise<string>;
/**
*
* @param image @file
* @param width @number
* @param height @number
* @returns @string base64
*/
export declare const getBase64Image: (image: any, width?: any, height?: any) => string;
/**
* base64
* @param src
* @returns @string
*/
export declare const getBase64ByImage: (src: string) => Promise<unknown>;
/**
* url转base64
* @param {String} url - url地址
*/
export declare const urlToBase64V2: (url: string) => Promise<unknown>;
/**
* base64转Blob
* @param {String} base64 - base64
*/
export declare function base64toBlob(base64: string): Blob | undefined;
/**
*
* 1. url -> base64 -> blob
* 2. blob加入jsZip文件夹内file-saver保存
* @param {Array<{url:string,name:string}>} imgDataList
* @param {string} zipName
*/
export declare const downloadPackageImages: (imgDataList: string | any[], zipName: string) => Promise<void>;
export declare function getFileSize(size: number): string;
export declare const dataURLToBlob: (dataurl: string) => Blob;

View File

@ -0,0 +1,252 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/file/index.ts
var file_exports = {};
__export(file_exports, {
base64DecodeImageKey: () => base64DecodeImageKey,
base64toBlob: () => base64toBlob,
dataURLToBlob: () => dataURLToBlob,
downloadPackageImages: () => downloadPackageImages,
fileToBase64: () => fileToBase64,
getBase64ByImage: () => getBase64ByImage,
getBase64ByUrl: () => getBase64ByUrl,
getBase64Image: () => getBase64Image,
getFileSize: () => getFileSize,
urlToBase64V2: () => urlToBase64V2,
urlToImg: () => urlToImg
});
module.exports = __toCommonJS(file_exports);
var import_base_64 = __toESM(require("base-64"));
var import_jszip = __toESM(require("jszip"));
var import_file_saver = __toESM(require("file-saver"));
var import_utils = require("../utils");
var import_lodash_es = require("lodash-es");
var urlToImg = (url) => {
const resImage = new Promise((resolve) => {
const image = new Image();
image.crossOrigin = "";
image.src = url;
image.onload = () => {
resolve(image);
};
});
return resImage;
};
var base64DecodeImageKey = (base64ImgKey) => {
let tempStr = base64ImgKey;
if ((0, import_utils.matchS3Prefix)(tempStr)) {
tempStr = tempStr.replace(/^v[0-9]_/, "");
tempStr = import_base_64.default.decode(tempStr);
}
const [bucket, ...pathArr] = tempStr.split("_");
return tempStr = `${bucket}/${pathArr.join("_")}`;
};
var getBase64ByUrl = function(src, outputFormat = "image/png") {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open("GET", src, true);
xhr.responseType = "arraybuffer";
xhr.onload = function(e) {
if (Number(xhr.status) === 200) {
const uInt8Array = new Uint8Array(xhr.response);
let i = uInt8Array.length;
const binaryString = new Array(i);
while (i--) {
binaryString[i] = String.fromCharCode(uInt8Array[i]);
}
const data = binaryString.join("");
const base64 = window.btoa(data);
const dataUrl = "data:" + (outputFormat || "image/png") + ";base64," + base64;
resolve(dataUrl);
} else {
reject(e);
}
};
xhr.onerror = (e) => {
reject(e);
};
xhr.send();
});
};
var fileToBase64 = (file) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function(e) {
resolve(e == null ? void 0 : e.target.result);
};
reader.onerror = function(e) {
reject(e);
};
});
};
var getBase64Image = (image, width, height) => {
const canvas = document.createElement("canvas");
canvas.width = width !== void 0 ? width : image.width;
canvas.height = height !== void 0 ? height : image.height;
const ctx = canvas.getContext("2d");
ctx == null ? void 0 : ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
const ext = image.src.substring(image.src.lastIndexOf(".") + 1).toLowerCase();
const dataURL = canvas.toDataURL("image/" + ext);
return dataURL;
};
var getBase64ByImage = function(src) {
return new Promise((resolve, reject) => {
const image = new Image();
const timestamp = (/* @__PURE__ */ new Date()).getTime();
const imgUrl = src + "?" + timestamp;
image.src = imgUrl;
image.onload = function() {
function getBase64Image2(img) {
const canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
const ctx = canvas.getContext("2d");
ctx == null ? void 0 : ctx.drawImage(img, 0, 0, img.width, img.height);
const ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase();
const dataURL = canvas.toDataURL("image/" + ext);
return dataURL;
}
const base64 = getBase64Image2(image);
resolve(base64);
};
image.onerror = (e) => {
reject(e);
};
});
};
var urlToBase64V2 = (url) => {
return new Promise((resolve, reject) => {
let image = new Image();
image.onload = function() {
var _a;
let canvas = document.createElement("canvas");
canvas.width = image.naturalWidth;
canvas.height = image.naturalHeight;
(_a = canvas == null ? void 0 : canvas.getContext("2d")) == null ? void 0 : _a.drawImage(image, 0, 0);
let result = canvas.toDataURL("image/png");
resolve(result);
};
const imgUrl = url;
image.setAttribute("crossOrigin", "Anonymous");
image.src = imgUrl;
image.onerror = () => {
reject(new Error("Images fail to load"));
};
}).catch((error) => {
throw new Error(error);
});
};
function base64toBlob(base64) {
if (!base64)
return;
var arr = base64.split(","), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], { type: mime });
}
var downloadPackageImages = async (imgDataList, zipName) => {
let imgDataDownLoadList = [];
let imgBlobList = [];
let imageSuffix = [];
let zip = new import_jszip.default();
let img = zip.folder(zipName);
try {
for (let i2 = 0; i2 < imgDataList.length; i2++) {
let src = imgDataList[i2].url;
let suffix = src.substring(src.lastIndexOf("."));
let base64ByUrl = await urlToBase64V2(imgDataList[i2].url);
if (!base64ByUrl)
continue;
let blob = base64toBlob(base64ByUrl);
imgDataDownLoadList.push(imgDataList[i2]);
imgBlobList.push(blob);
imageSuffix.push(suffix);
}
if (imgBlobList.length === 0)
throw new Error("The number of pictures is zero !");
if (imgBlobList.length > 0) {
for (var i = 0; i < imgBlobList.length; i++) {
img == null ? void 0 : img.file(
imgDataDownLoadList[i].name + (0, import_lodash_es.get)(imageSuffix, `.${i}`, imageSuffix[0]),
// @ts-ignore
imgBlobList[i],
{
base64: true
}
);
}
}
zip.generateAsync({ type: "blob" }).then(function(content) {
import_file_saver.default.saveAs(content, zipName + ".zip");
});
} catch (error) {
throw new Error(error);
}
};
function getFileSize(size) {
if (!size)
return "";
var num = 1024;
if (size < num)
return size + "B";
if (size < Math.pow(num, 2))
return (size / num).toFixed(2) + "K";
if (size < Math.pow(num, 3))
return (size / Math.pow(num, 2)).toFixed(2) + "M";
if (size < Math.pow(num, 4))
return (size / Math.pow(num, 3)).toFixed(2) + "G";
return (size / Math.pow(num, 4)).toFixed(2) + "T";
}
var dataURLToBlob = (dataurl) => {
const arr = dataurl.split(",");
const mime = arr[0].match(/:(.*?);/)[1];
const bstr = atob(arr[1]);
let n = bstr.length;
const u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], { type: mime });
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
base64DecodeImageKey,
base64toBlob,
dataURLToBlob,
downloadPackageImages,
fileToBase64,
getBase64ByImage,
getBase64ByUrl,
getBase64Image,
getFileSize,
urlToBase64V2,
urlToImg
});

7
packages/utils/lib/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export * from './file';
export * from './map';
export * from './performance';
export * from './string';
export * from './number';
export * from './time';
export * from './utils';

View File

@ -0,0 +1,35 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
module.exports = __toCommonJS(src_exports);
__reExport(src_exports, require("./file"), module.exports);
__reExport(src_exports, require("./map"), module.exports);
__reExport(src_exports, require("./performance"), module.exports);
__reExport(src_exports, require("./string"), module.exports);
__reExport(src_exports, require("./number"), module.exports);
__reExport(src_exports, require("./time"), module.exports);
__reExport(src_exports, require("./utils"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./file"),
...require("./map"),
...require("./performance"),
...require("./string"),
...require("./number"),
...require("./time"),
...require("./utils")
});

10
packages/utils/lib/map/index.d.ts vendored Normal file
View File

@ -0,0 +1,10 @@
/**
*
* @param lngLat
* @returns @object { long, lat }
*/
export declare const fixedLngLat: (lngLat?: string) => string;
export declare const transformLngLat: (lngLat?: string) => {
longitude: number;
latitude: number;
} | null;

View File

@ -0,0 +1,54 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/map/index.ts
var map_exports = {};
__export(map_exports, {
fixedLngLat: () => fixedLngLat,
transformLngLat: () => transformLngLat
});
module.exports = __toCommonJS(map_exports);
var fixedLngLat = (lngLat) => {
if (!lngLat) {
return "";
}
const lngLatArr = lngLat.split(",");
const longitude = Number(lngLatArr[0]).toFixed(6);
const latitude = Number(lngLatArr[1]).toFixed(6);
if (lngLatArr.length < 2) {
return "";
}
return `${longitude},${latitude}`;
};
var transformLngLat = (lngLat) => {
if (lngLat) {
const lngLatArr = lngLat ? lngLat.split(",") : [];
const longitude = Number(lngLatArr[0]);
const latitude = Number(lngLatArr[1]);
if (lngLatArr.length < 2) {
return null;
}
return { longitude, latitude };
}
return null;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
fixedLngLat,
transformLngLat
});

8
packages/utils/lib/number/index.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
/**
*
* @param originNumber
* @param accuracy
* @param isCeil
* @returns number
*/
export declare const setNumberAccuracy: (originNumber: number, accuracy?: number, isCeil?: boolean) => number;

View File

@ -0,0 +1,45 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/number/index.ts
var number_exports = {};
__export(number_exports, {
setNumberAccuracy: () => setNumberAccuracy
});
module.exports = __toCommonJS(number_exports);
var setNumberAccuracy = (originNumber, accuracy = 0, isCeil = true) => {
if (originNumber === 0) {
return 0;
}
let returnData = 0;
if (isCeil) {
returnData = Math.ceil(originNumber / Math.pow(10, accuracy)) * Math.pow(10, accuracy);
} else {
returnData = Math.floor(originNumber / Math.pow(10, accuracy)) * Math.pow(10, accuracy);
}
if (accuracy < 0) {
returnData = Number(returnData.toFixed(-accuracy));
} else {
returnData = Number(returnData.toFixed(0));
}
return returnData;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
setNumberAccuracy
});

View File

@ -0,0 +1 @@
export declare const speedConvert: (bps: number, contertUnit?: number) => string;

View File

@ -0,0 +1,41 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/performance/index.ts
var performance_exports = {};
__export(performance_exports, {
speedConvert: () => speedConvert
});
module.exports = __toCommonJS(performance_exports);
var speedConvert = (bps, contertUnit = 8) => {
if (bps === void 0)
return `0KB/s`;
const byte = bps / contertUnit;
if (bps > 1024 * 1024 * 1024) {
return `${(byte / 1024 / 1024 / 1024).toFixed(2)}GB/s`;
} else if (byte > 1024 * 1024) {
return `${(byte / 1024 / 1024).toFixed(2)}MB/s`;
} else if (byte > 1024) {
return `${(byte / 1024).toFixed(2)}KB/s`;
}
return `${byte}KB/s`;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
speedConvert
});

7
packages/utils/lib/string/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
export declare const getStrLength: (str: string) => number;
/**
* js截取字符串
* @param str
* @param len: 需要截取的长度
*/
export declare const cutStr: (str: string, len: number) => string | String | undefined;

View File

@ -0,0 +1,62 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/string/index.ts
var string_exports = {};
__export(string_exports, {
cutStr: () => cutStr,
getStrLength: () => getStrLength
});
module.exports = __toCommonJS(string_exports);
var getStrLength = function(str) {
var realLength = 0, len = str.length, charCode = -1;
for (var i = 0; i < len; i++) {
charCode = str.charCodeAt(i);
if (charCode >= 0 && charCode <= 128)
realLength += 1;
else
realLength += 2;
}
return realLength;
};
var cutStr = function cutstr(str, len) {
var str_length = 0;
var str_len = 0;
let str_cut = new String();
str_len = str.length;
for (var i = 0; i < str_len; i++) {
let a = str.charAt(i);
str_length++;
if (escape(a).length > 4) {
str_length++;
}
str_cut = str_cut.concat(a);
if (str_length >= len) {
str_cut = str_cut.concat("...");
return str_cut;
}
}
if (str_length < len) {
return str;
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
cutStr,
getStrLength
});

5
packages/utils/lib/time/index.d.ts vendored Normal file
View File

@ -0,0 +1,5 @@
export declare const formateDuration: (diff: number) => string;
export declare function generateTime(): {
startDateTime: number;
endDateTime: number;
};

View File

@ -0,0 +1,66 @@
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/time/index.ts
var time_exports = {};
__export(time_exports, {
formateDuration: () => formateDuration,
generateTime: () => generateTime
});
module.exports = __toCommonJS(time_exports);
var import_dayjs = __toESM(require("dayjs"));
var formateDuration = (diff) => {
var days = Math.floor(diff / (24 * 3600 * 1e3));
var leave1 = diff % (24 * 3600 * 1e3);
var hours = Math.floor(leave1 / (3600 * 1e3));
var leave2 = leave1 % (3600 * 1e3);
var minutes = Math.floor(leave2 / (60 * 1e3));
var leave3 = leave2 % (60 * 1e3);
var seconds = Math.round(leave3 / 1e3);
var returnStr = seconds + "秒";
if (minutes > 0) {
returnStr = minutes + "分";
}
if (hours > 0) {
returnStr = hours + "小时";
}
if (days > 0) {
returnStr = days + "天";
}
return returnStr;
};
function generateTime() {
let endDateTime = (0, import_dayjs.default)().endOf("day").unix();
let startDateTime = (0, import_dayjs.default)().startOf("day").unix();
return { startDateTime, endDateTime };
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
formateDuration,
generateTime
});

15
packages/utils/lib/utils/index.d.ts vendored Normal file
View File

@ -0,0 +1,15 @@
export declare const matchS3Prefix: (str: string) => boolean;
/**
*
* @param fileName
* @returns
*/
export declare const getFileSuffix: (fileName: string) => string;
/**
*
* @param type
* @returns
*/
export declare const getImageSuffixByFileType: (type: string) => string;
export declare function getChromeVersion(): number | false;
export declare const nextTick: (func: (value: void) => void | PromiseLike<void>) => void;

View File

@ -0,0 +1,93 @@
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/utils/index.ts
var utils_exports = {};
__export(utils_exports, {
getChromeVersion: () => getChromeVersion,
getFileSuffix: () => getFileSuffix,
getImageSuffixByFileType: () => getImageSuffixByFileType,
matchS3Prefix: () => matchS3Prefix,
nextTick: () => nextTick
});
module.exports = __toCommonJS(utils_exports);
var matchS3Prefix = (str) => {
return /^v[0-9]_/.test(str);
};
var getFileSuffix = (fileName) => {
const splitArr = fileName.split(".");
return splitArr.length < 2 ? "" : splitArr[splitArr.length - 1];
};
var getImageSuffixByFileType = (type) => {
let imageSuffix = "";
switch (type) {
case "jpeg": {
imageSuffix = ".jpg";
break;
}
case "gif": {
imageSuffix = ".gif";
break;
}
case "png": {
imageSuffix = ".png";
break;
}
case "vnd.wap.wbmp": {
imageSuffix = ".wbmp";
break;
}
case "x-up-wpng": {
imageSuffix = ".wpng";
break;
}
case "nbmp": {
imageSuffix = ".nbmp";
break;
}
}
return imageSuffix;
};
function getChromeVersion() {
const arr = navigator.userAgent.split(" ");
let chromeVersion = "";
for (let i = 0; i < arr.length; i++) {
if (/chrome/i.test(arr[i]))
chromeVersion = arr[i];
}
if (chromeVersion) {
return Number(chromeVersion.split("/")[1].split(".")[0]);
} else {
return false;
}
}
var nextTick = (func) => {
if (queueMicrotask) {
queueMicrotask(func);
return;
}
Promise.resolve().then(func);
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getChromeVersion,
getFileSuffix,
getImageSuffixByFileType,
matchS3Prefix,
nextTick
});

View File

@ -0,0 +1,42 @@
{
"name": "@zhst/func",
"version": "0.2.3",
"description": "函数合集",
"keywords": [
"hooks"
],
"license": "ISC",
"author": "dev",
"sideEffects": [
"dist/*",
"es/**/style/*",
"lib/**/style/*",
"*.less"
],
"main": "lib/index.tsx",
"module": "es/index.js",
"typings": "es/index.d.ts",
"files": [
"es",
"lib"
],
"scripts": {
"build": "father build"
},
"publishConfig": {
"access": "public",
"registry": "http://10.0.0.77:4874"
},
"dependencies": {
"base-64": "^1.0.0",
"dayjs": "^1.11.10",
"file-saver": "^2.0.5",
"jszip": "^3.10.1",
"lodash-es": "^4.17.21"
},
"devDependencies": {
"@types/base-64": "^1.0.2",
"@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.12"
}
}

View File

@ -0,0 +1,21 @@
import ReactDOM from 'react-dom';
export default function addEventListener(target: any, eventType: string, cb: any, option: any) {
/* eslint camelcase: 2 */
const callback = ReactDOM.unstable_batchedUpdates
? function run(e: any) {
ReactDOM.unstable_batchedUpdates(cb, e);
}
: cb;
if (target.addEventListener) {
target.addEventListener(eventType, callback, option);
}
return {
remove: () => {
if (target.removeEventListener) {
target.removeEventListener(eventType, callback);
}
},
};
}

View File

@ -0,0 +1,48 @@
---
nav:
title: func
title: 其它
order: 4
---
## 获取谷歌浏览器版本
```js
import { getChromeVersion } from '@zhst/func'
const version = getChromeVersion()
```
## 检索默认时间
```jsx
import React from 'react'
import { generateTime } from '@zhst/func'
const obj = generateTime()
export default () => <div>{JSON.stringify(obj)}</div>
```
## 获取字符串实际长度
```jsx
import React from 'react'
import { getStrLength } from '@zhst/func'
const str = getStrLength('测试手动阀手动阀213123dfads')
export default () => <div>实际长度为:{str}</div>
```
## 截取字符串
```jsx
import React from 'react'
import { cutStr } from '@zhst/func'
const oldStr = '测试手动阀手动阀213123dfads'
const str = cutStr(oldStr, 6)
export default () => <div>原始数据:{oldStr}<br/> 截取后:{str}</div>
```

View File

@ -0,0 +1,57 @@
---
nav:
title: func
order: 2
title: 文件处理
---
## url转Img
```js
import { urlToImg } from '@zhst/func'
const img = urlToImg('http://example.com/images.png')
```
## 获取图片base64
通过 url 获取图片的 base64
```js
import { getBase64ByUrl } from '@zhst/func'
const base64 = getBase64ByUrl('http://example.com/images.png')
```
## url转base64(跨域加强版)
```js
import React from 'react'
import { urlToBase64V2 } from '@zhst/func'
const base64 = urlToBase64V2('http://example.com/img.png')
```
## 文件转 base64
```js
import { fileToBase64 } from '@zhst/func'
const base64 = fileToBase64(file)
```
## 获取文件后缀
```js
import { getFileSuffix } from '@zhst/func'
const fileType = getFileSuffix('http://example.com/img.png')
```
## 图片打包压缩下载
```js
import { downloadPackageImages } from '@zhst/func'
const zip = downloadPackageImages([file1, file2, file3])
```

View File

@ -0,0 +1,263 @@
import Base64 from 'base-64'
import JSZip from 'jszip';
import FileSaver from 'file-saver';
import { matchS3Prefix } from '../utils'
import { get } from 'lodash-es';
/**
*
* @param url
* @returns dom
*/
export const urlToImg = (url: string) => {
const resImage: Promise<HTMLImageElement> = new Promise((resolve) => {
const image = new Image();
image.crossOrigin = '';
image.src = url;
image.onload = () => {
resolve(image);
};
});
return resImage;
}
export const base64DecodeImageKey = (base64ImgKey: string) => {
let tempStr = base64ImgKey;
if (matchS3Prefix(tempStr)) {
tempStr = tempStr.replace(/^v[0-9]_/, '');
tempStr = Base64.decode(tempStr);
}
//分离bucket
const [bucket, ...pathArr] = tempStr.split('_');
return (tempStr = `${bucket}/${pathArr.join('_')}`);
};
/**
* url获取图片的base64字符串
* @param src
* @param outputFormat
* @returns base64 @string
*/
export const getBase64ByUrl = function (src: string | URL, outputFormat = 'image/png') {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.open('GET', src, true);
xhr.responseType = 'arraybuffer';
xhr.onload = function (e) {
if (Number(xhr.status) === 200) {
const uInt8Array = new Uint8Array(xhr.response);
let i = uInt8Array.length;
const binaryString = new Array(i);
while (i--) {
binaryString[i] = String.fromCharCode(uInt8Array[i]);
}
const data = binaryString.join('');
const base64 = window.btoa(data);
const dataUrl = 'data:' + (outputFormat || 'image/png') + ';base64,' + base64;
resolve(dataUrl);
} else {
reject(e);
}
};
xhr.onerror = (e) => {
reject(e);
};
xhr.send();
});
};
/**
* base64
* @param file @file
* @returns @string
*/
export const fileToBase64 = (file: any): Promise<string> => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
// 传入一个参数对象即可得到基于该参数对象的文本内容
reader.readAsDataURL(file);
reader.onload = function (e: any) {
// target.result 该属性表示目标对象的DataURL
resolve(e?.target.result as string);
};
reader.onerror = function (e) {
reject(e);
};
});
};
/**
*
* @param image @file
* @param width @number
* @param height @number
* @returns @string base64
*/
export const getBase64Image = (image: any, width?: any, height?: any) => {
// width、height调用时传入具体像素值控制大小 ,不传则默认图像大小
const canvas = document.createElement('canvas');
canvas.width = width !== undefined ? width : image.width;
canvas.height = height !== undefined ? height : image.height;
const ctx = canvas.getContext('2d');
ctx?.drawImage(image, 0, 0, canvas.width, canvas.height);
const ext = image.src.substring(image.src.lastIndexOf('.') + 1).toLowerCase();
const dataURL = canvas.toDataURL('image/' + ext);
return dataURL;
};
/**
* base64
* @param src
* @returns @string
*/
export const getBase64ByImage = function (src: string) {
return new Promise((resolve, reject) => {
const image = new Image();
const timestamp = new Date().getTime();
const imgUrl = src + '?' + timestamp;
image.src = imgUrl;
image.onload = function () {
function getBase64Image(img: any) {
const canvas = document.createElement('canvas');
canvas.width = img.width;
canvas.height = img.height;
const ctx = canvas.getContext('2d');
ctx?.drawImage(img, 0, 0, img.width, img.height);
const ext = img.src.substring(img.src.lastIndexOf('.') + 1).toLowerCase();
const dataURL = canvas.toDataURL('image/' + ext);
return dataURL;
}
const base64 = getBase64Image(image);
resolve(base64);
};
image.onerror = (e) => {
reject(e);
};
});
};
/**
* url转base64
* @param {String} url - url地址
*/
export const urlToBase64V2 = (url: string) => {
return new Promise((resolve, reject) => {
let image = new Image();
image.onload = function () {
let canvas = document.createElement('canvas');
canvas.width = image.naturalWidth;
canvas.height = image.naturalHeight;
// 将图片插入画布并开始绘制
canvas?.getContext('2d')?.drawImage(image, 0, 0);
// result
let result = canvas.toDataURL('image/png');
resolve(result);
};
// CORS 策略会存在跨域问题https://stackoverflow.com/questions/20424279/canvas-todataurl-securityerror
const imgUrl = url;
image.setAttribute('crossOrigin', 'Anonymous');
image.src = imgUrl;
// 图片加载失败的错误处理
image.onerror = () => {
reject(new Error('Images fail to load'));
};
}).catch((error) => {
throw new Error(error);
});
};
/**
* base64转Blob
* @param {String} base64 - base64
*/
export function base64toBlob(base64: string) {
if (!base64) return
var arr = base64.split(','),
// @ts-ignore
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], { type: mime });
}
/**
*
* 1. url -> base64 -> blob
* 2. blob加入jsZip文件夹内file-saver保存
* @param {Array<{url:string,name:string}>} imgDataList
* @param {string} zipName
*/
export const downloadPackageImages = async (imgDataList: string | any[], zipName: string) => {
let imgDataDownLoadList = []; // 传入列表中可下载图片的集合
let imgBlobList = []; // 图片转blob的集合
let imageSuffix = []; // 图片后缀集
let zip = new JSZip();
let img = zip.folder(zipName);
try {
for (let i = 0; i < imgDataList.length; i++) {
let src = imgDataList[i].url;
let suffix = src.substring(src.lastIndexOf('.'));
let base64ByUrl = await urlToBase64V2(imgDataList[i].url);
if (!base64ByUrl) continue;
// @ts-ignore
let blob = base64toBlob(base64ByUrl);
imgDataDownLoadList.push(imgDataList[i]);
imgBlobList.push(blob);
imageSuffix.push(suffix);
}
if (imgBlobList.length === 0) throw new Error('The number of pictures is zero !');
if (imgBlobList.length > 0) {
for (var i = 0; i < imgBlobList.length; i++) {
img?.file(
imgDataDownLoadList[i].name + get(imageSuffix, `.${i}`, imageSuffix[0]),
// @ts-ignore
imgBlobList[i],
{
base64: true,
}
);
}
}
zip.generateAsync({ type: 'blob' }).then(function (content) {
FileSaver.saveAs(content, zipName + '.zip'); // 利用file-saver保存文件
});
} catch (error: any) {
throw new Error(error);
}
};
//文件size转单位
export function getFileSize(size: number) {
if (!size) return '';
var num = 1024.0; //byte
if (size < num) return size + 'B';
if (size < Math.pow(num, 2)) return (size / num).toFixed(2) + 'K'; //kb
if (size < Math.pow(num, 3)) return (size / Math.pow(num, 2)).toFixed(2) + 'M'; //M
if (size < Math.pow(num, 4)) return (size / Math.pow(num, 3)).toFixed(2) + 'G'; //G
return (size / Math.pow(num, 4)).toFixed(2) + 'T'; //T
}
// Base64转Blob
export const dataURLToBlob = (dataurl: string) => {
const arr = dataurl.split(',');
const mime = arr[0].match(/:(.*?);/)![1];
const bstr = atob(arr[1]);
let n = bstr.length;
const u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new Blob([u8arr], { type: mime });
};

View File

@ -0,0 +1,10 @@
---
nav:
title: utils
order: 1
title: 快速上手
---
<embed src="../README.md" ></embed>
<embed src="../CHANGELOG.md" ></embed>

View File

@ -0,0 +1,9 @@
export * from './file'
export * from './map'
export * from './performance'
export * from './string'
export * from './number'
export * from './time'
export * from './utils'

View File

@ -0,0 +1,30 @@
---
nav:
title: func
order: 3
title: 地图相关
---
## 格式化经纬度信息
```js
import { fixedLngLat } from '@zhst/func'
const str = fixedLngLat('12.23131233123,23.32132312')
```
## 把经纬信息转为对象
```js
import { transformLngLat } from '@zhst/func'
const obj = transformLngLat('12.23131233123,23.32132312')
```
## 把经纬信息转为对象
```js
import { transformLngLat } from '@zhst/func'
const obj = transformLngLat('12.23131233123,23.32132312')
```

View File

@ -0,0 +1,30 @@
/**
*
* @param lngLat
* @returns @object { long, lat }
*/
export const fixedLngLat = (lngLat?: string) => {
if (!lngLat) {
return '';
}
const lngLatArr = lngLat.split(',');
const longitude = Number(lngLatArr[0]).toFixed(6);
const latitude = Number(lngLatArr[1]).toFixed(6);
if (lngLatArr.length < 2) {
return '';
}
return `${longitude},${latitude}`;
};
export const transformLngLat = (lngLat?: string) => {
if (lngLat) {
const lngLatArr = lngLat ? lngLat.split(',') : [];
const longitude = Number(lngLatArr[0]);
const latitude = Number(lngLatArr[1]);
if (lngLatArr.length < 2) {
return null;
}
return { longitude, latitude };
}
return null;
};

View File

@ -0,0 +1,27 @@
/**
*
* @param originNumber
* @param accuracy
* @param isCeil
* @returns number
*/
export const setNumberAccuracy = (originNumber: number, accuracy = 0, isCeil = true) => {
if (originNumber === 0) {
return 0;
}
let returnData = 0;
if (isCeil) {
returnData = Math.ceil(originNumber / Math.pow(10, accuracy)) * Math.pow(10, accuracy);
} else {
returnData = Math.floor(originNumber / Math.pow(10, accuracy)) * Math.pow(10, accuracy);
}
//设置精度
if (accuracy < 0) {
returnData = Number(returnData.toFixed(-accuracy));
} else {
returnData = Number(returnData.toFixed(0));
}
return returnData;
};

View File

@ -0,0 +1,17 @@
// 1.bps KB/s or MB/s or GB/s 2.保留两位小数 3.默认是bps
export const speedConvert = (bps: number, contertUnit = 8) => {
if (bps === undefined) return `0KB/s`;
const byte = bps / contertUnit;
if (bps > 1024 * 1024 * 1024) {
return `${(byte / 1024 / 1024 / 1024).toFixed(2)}GB/s`;
} else if (byte > 1024 * 1024) {
return `${(byte / 1024 / 1024).toFixed(2)}MB/s`;
} else if (byte > 1024) {
return `${(byte / 1024).toFixed(2)}KB/s`;
}
return `${byte}KB/s`;
};

View File

@ -0,0 +1,49 @@
///<summary>获得字符串实际长度中文2英文1</summary>
///<param name="str">要获得长度的字符串</param>
export const getStrLength = function (str: string) {
var realLength = 0,
len = str.length,
charCode = -1;
for (var i = 0; i < len; i++) {
charCode = str.charCodeAt(i);
if (charCode >= 0 && charCode <= 128) realLength += 1;
else realLength += 2;
}
return realLength;
};
//js截取字符串中英文都能用
//如果给定的字符串大于指定长度,截取指定长度返回,否者返回源字符串。
//字符串,长度
/**
* js截取字符串
* @param str
* @param len: 需要截取的长度
*/
export const cutStr = function cutstr(str: string, len: number) {
var str_length = 0;
var str_len = 0;
let str_cut = new String();
str_len = str.length;
for (var i = 0; i < str_len; i++) {
let a = str.charAt(i);
str_length++;
if (escape(a).length > 4) {
//中文字符的长度经编码之后大于4
str_length++;
}
str_cut = str_cut.concat(a);
if (str_length >= len) {
str_cut = str_cut.concat('...');
return str_cut;
}
}
//如果给定字符串小于指定长度,则返回源字符串;
if (str_length < len) {
return str;
}
};

View File

@ -0,0 +1,49 @@
//时间差计算
import dayjs from "dayjs";
/*
* startDate==>
* endDate==>
* diffTime(data.createTime,new Date())
*
* */
export const formateDuration = (diff: number) => {
//计算出相差天数
var days = Math.floor(diff / (24 * 3600 * 1000));
//计算出小时数
var leave1 = diff % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
var hours = Math.floor(leave1 / (3600 * 1000));
//计算相差分钟数
var leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
var minutes = Math.floor(leave2 / (60 * 1000));
//计算相差秒数
var leave3 = leave2 % (60 * 1000); //计算分钟数后剩余的毫秒数
var seconds = Math.round(leave3 / 1000);
var returnStr = seconds + '秒';
if (minutes > 0) {
returnStr = minutes + '分'; //+ returnStr;
}
if (hours > 0) {
returnStr = hours + '小时'; // + returnStr;
}
if (days > 0) {
returnStr = days + '天'; //+ returnStr;
}
return returnStr;
}
//检索默认时间
export function generateTime() {
let endDateTime = dayjs().endOf('day').unix();
let startDateTime = dayjs().startOf('day').unix();
return { startDateTime, endDateTime };
}

View File

@ -0,0 +1,73 @@
export const matchS3Prefix = (str: string) => {
return /^v[0-9]_/.test(str);
};
/**
*
* @param fileName
* @returns
*/
export const getFileSuffix = (fileName: string) => {
const splitArr = fileName.split('.');
return splitArr.length < 2 ? '' : splitArr[splitArr.length - 1];
};
/**
*
* @param type
* @returns
*/
export const getImageSuffixByFileType = (type: string) => {
let imageSuffix = '';
switch (type) {
case 'jpeg': {
imageSuffix = '.jpg';
break;
}
case 'gif': {
imageSuffix = '.gif';
break;
}
case 'png': {
imageSuffix = '.png';
break;
}
case 'vnd.wap.wbmp': {
imageSuffix = '.wbmp';
break;
}
case 'x-up-wpng': {
imageSuffix = '.wpng';
break;
}
case 'nbmp': {
imageSuffix = '.nbmp';
break;
}
}
return imageSuffix;
};
// 获取谷歌浏览器版本
export function getChromeVersion() {
const arr = navigator.userAgent.split(' ');
let chromeVersion = '';
for (let i = 0; i < arr.length; i++) {
if (/chrome/i.test(arr[i])) chromeVersion = arr[i];
}
if (chromeVersion) {
return Number(chromeVersion.split('/')[1].split('.')[0]);
} else {
return false;
}
}
export const nextTick = (func: (value: void) => void | PromiseLike<void>) => {
if (queueMicrotask) {
queueMicrotask(func);
return;
}
Promise.resolve().then(func);
};

View File

@ -63,7 +63,48 @@ importers:
specifier: ^14.9.1
version: 14.16.1
packages/hooks: {}
packages/biz:
dependencies:
'@zhst/hooks':
specifier: workspace:^
version: link:../hooks
packages/hooks:
dependencies:
ahooks:
specifier: ^3.7.8
version: 3.7.8(react@18.2.0)
react:
specifier: ^18.0.0
version: 18.2.0
packages/utils:
dependencies:
base-64:
specifier: ^1.0.0
version: 1.0.0
dayjs:
specifier: ^1.11.10
version: 1.11.10
file-saver:
specifier: ^2.0.5
version: 2.0.5
jszip:
specifier: ^3.10.1
version: 3.10.1
lodash-es:
specifier: ^4.17.21
version: 4.17.21
devDependencies:
'@types/base-64':
specifier: ^1.0.2
version: 1.0.2
'@types/file-saver':
specifier: ^2.0.7
version: 2.0.7
'@types/lodash-es':
specifier: ^4.17.12
version: 4.17.12
packages:
@ -459,7 +500,6 @@ packages:
engines: {node: '>=6.9.0'}
dependencies:
regenerator-runtime: 0.14.0
dev: true
/@babel/template@7.22.15:
resolution: {integrity: sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==}
@ -2681,6 +2721,10 @@ packages:
'@babel/types': 7.23.4
dev: true
/@types/base-64@1.0.2:
resolution: {integrity: sha512-uPgKMmM9fmn7I+Zi6YBqctOye4SlJsHKcisjHIMWpb2YKZRc36GpKyNuQ03JcT+oNXg1m7Uv4wU94EVltn8/cw==}
dev: true
/@types/debug@4.1.12:
resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==}
dependencies:
@ -2711,6 +2755,10 @@ packages:
resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==}
dev: true
/@types/file-saver@2.0.7:
resolution: {integrity: sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A==}
dev: true
/@types/fs-extra@11.0.1:
resolution: {integrity: sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==}
dependencies:
@ -2761,6 +2809,10 @@ packages:
'@types/istanbul-lib-report': 3.0.3
dev: true
/@types/js-cookie@2.2.7:
resolution: {integrity: sha512-aLkWa0C0vO5b4Sr798E26QgOkss68Un0bLjs7u9qxzPT5CG+8DuNTffWES58YzJs3hrVAOs1wonycqEBqNJubA==}
dev: false
/@types/json-schema@7.0.15:
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
dev: true
@ -2777,6 +2829,16 @@ packages:
'@types/node': 20.10.0
dev: true
/@types/lodash-es@4.17.12:
resolution: {integrity: sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==}
dependencies:
'@types/lodash': 4.14.202
dev: true
/@types/lodash@4.14.202:
resolution: {integrity: sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==}
dev: true
/@types/mdast@3.0.15:
resolution: {integrity: sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==}
dependencies:
@ -3741,6 +3803,29 @@ packages:
indent-string: 4.0.0
dev: true
/ahooks-v3-count@1.0.0:
resolution: {integrity: sha512-V7uUvAwnimu6eh/PED4mCDjE7tokeZQLKlxg9lCTMPhN+NjsSbtdacByVlR1oluXQzD3MOw55wylDmQo4+S9ZQ==}
dev: false
/ahooks@3.7.8(react@18.2.0):
resolution: {integrity: sha512-e/NMlQWoCjaUtncNFIZk3FG1ImSkV/JhScQSkTqnftakRwdfZWSw6zzoWSG9OMYqPNs2MguDYBUFFC6THelWXA==}
engines: {node: '>=8.0.0'}
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
dependencies:
'@babel/runtime': 7.23.4
'@types/js-cookie': 2.2.7
ahooks-v3-count: 1.0.0
dayjs: 1.11.10
intersection-observer: 0.12.2
js-cookie: 2.2.1
lodash: 4.17.21
react: 18.2.0
resize-observer-polyfill: 1.5.1
screenfull: 5.2.0
tslib: 2.6.2
dev: false
/ajv-keywords@3.5.2(ajv@6.12.6):
resolution: {integrity: sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==}
peerDependencies:
@ -4193,6 +4278,10 @@ packages:
resolution: {integrity: sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==}
dev: true
/base-64@1.0.0:
resolution: {integrity: sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==}
dev: false
/base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
dev: true
@ -5145,7 +5234,6 @@ packages:
/core-util-is@1.0.3:
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
dev: true
/cors@2.8.5:
resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==}
@ -5465,6 +5553,10 @@ packages:
resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==}
dev: true
/dayjs@1.11.10:
resolution: {integrity: sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==}
dev: false
/debug@3.1.0:
resolution: {integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==}
peerDependencies:
@ -6734,6 +6826,10 @@ packages:
engines: {node: '>=0.10.0'}
dev: true
/file-saver@2.0.5:
resolution: {integrity: sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==}
dev: false
/file-system-cache@2.0.0:
resolution: {integrity: sha512-QlYut2ZtxRgdW/dboSmiKZWM8FsnpLaLI549hN/RWgwn3FawSil7Jc2n7nFHheclvYxa4LJqwEOvNUYv9VsCXg==}
dependencies:
@ -8051,6 +8147,10 @@ packages:
queue: 6.0.1
dev: true
/immediate@3.0.6:
resolution: {integrity: sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==}
dev: false
/immutable@4.3.4:
resolution: {integrity: sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA==}
dev: true
@ -8109,7 +8209,6 @@ packages:
/inherits@2.0.4:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
dev: true
/ini@1.3.8:
resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
@ -8181,6 +8280,10 @@ packages:
side-channel: 1.0.4
dev: true
/intersection-observer@0.12.2:
resolution: {integrity: sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg==}
dev: false
/intl-messageformat@10.5.8:
resolution: {integrity: sha512-NRf0jpBWV0vd671G5b06wNofAN8tp7WWDogMZyaU8GUAsmbouyvgwmFJI7zLjfAMpm3zK+vSwRP3jzaoIcMbaA==}
dependencies:
@ -8646,7 +8749,6 @@ packages:
/isarray@1.0.0:
resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==}
dev: true
/isarray@2.0.5:
resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==}
@ -8816,9 +8918,12 @@ packages:
resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==}
dev: true
/js-cookie@2.2.1:
resolution: {integrity: sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==}
dev: false
/js-tokens@4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
dev: true
/js-yaml@3.14.1:
resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==}
@ -8924,6 +9029,15 @@ packages:
object.values: 1.1.7
dev: true
/jszip@3.10.1:
resolution: {integrity: sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==}
dependencies:
lie: 3.3.0
pako: 1.0.11
readable-stream: 2.3.8
setimmediate: 1.0.5
dev: false
/keyv@4.5.4:
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
dependencies:
@ -9119,6 +9233,12 @@ packages:
- supports-color
dev: true
/lie@3.3.0:
resolution: {integrity: sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==}
dependencies:
immediate: 3.0.6
dev: false
/lightningcss-darwin-arm64@1.19.0:
resolution: {integrity: sha512-wIJmFtYX0rXHsXHSr4+sC5clwblEMji7HHQ4Ub1/CznVRxtCFha6JIt5JZaNf8vQrfdZnBxLLC6R8pC818jXqg==}
engines: {node: '>= 12.0.0'}
@ -9342,6 +9462,10 @@ packages:
p-locate: 5.0.0
dev: true
/lodash-es@4.17.21:
resolution: {integrity: sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==}
dev: false
/lodash.camelcase@4.3.0:
resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==}
dev: true
@ -9404,7 +9528,6 @@ packages:
/lodash@4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: true
/log-symbols@2.2.0:
resolution: {integrity: sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==}
@ -9441,7 +9564,6 @@ packages:
hasBin: true
dependencies:
js-tokens: 4.0.0
dev: true
/lower-case@2.0.2:
resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==}
@ -11255,7 +11377,6 @@ packages:
/pako@1.0.11:
resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==}
dev: true
/parallel-transform@1.2.0:
resolution: {integrity: sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==}
@ -12110,7 +12231,6 @@ packages:
/process-nextick-args@2.0.1:
resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==}
dev: true
/process-warning@1.0.0:
resolution: {integrity: sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q==}
@ -12624,7 +12744,6 @@ packages:
engines: {node: '>=0.10.0'}
dependencies:
loose-envify: 1.4.0
dev: true
/read-cmd-shim@4.0.0:
resolution: {integrity: sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q==}
@ -12712,7 +12831,6 @@ packages:
safe-buffer: 5.1.2
string_decoder: 1.1.1
util-deprecate: 1.0.2
dev: true
/readable-stream@3.6.2:
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
@ -12772,7 +12890,6 @@ packages:
/regenerator-runtime@0.14.0:
resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==}
dev: true
/regexp.prototype.flags@1.5.1:
resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==}
@ -12930,7 +13047,6 @@ packages:
/resize-observer-polyfill@1.5.1:
resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==}
dev: true
/resolve-cwd@3.0.0:
resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==}
@ -13144,7 +13260,6 @@ packages:
/safe-buffer@5.1.2:
resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
dev: true
/safe-buffer@5.2.1:
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
@ -13206,6 +13321,11 @@ packages:
ajv-keywords: 3.5.2(ajv@6.12.6)
dev: true
/screenfull@5.2.0:
resolution: {integrity: sha512-9BakfsO2aUQN2K9Fdbj87RJIEZ82Q9IGim7FqM5OsebfoFC6ZHXgDq/KvniuLTPdeM8wY2o6Dj3WQ7KeQCj3cA==}
engines: {node: '>=0.10.0'}
dev: false
/selderee@0.11.0:
resolution: {integrity: sha512-5TF+l7p4+OsnP8BCCvSyZiSPc4x4//p5uPwK8TCnVPJYRmU2aYKMpOXvw8zM5a5JvuuCGN1jmsMwuU2W02ukfA==}
dependencies:
@ -13280,7 +13400,6 @@ packages:
/setimmediate@1.0.5:
resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==}
dev: true
/sha.js@2.4.11:
resolution: {integrity: sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==}
@ -13777,7 +13896,6 @@ packages:
resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==}
dependencies:
safe-buffer: 5.1.2
dev: true
/string_decoder@1.3.0:
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
@ -14347,7 +14465,6 @@ packages:
/tslib@2.6.2:
resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}
dev: true
/tsutils@3.21.0(typescript@5.3.2):
resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
@ -14797,7 +14914,6 @@ packages:
/util-deprecate@1.0.2:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
dev: true
/util.promisify@1.0.1:
resolution: {integrity: sha512-g9JpC/3He3bm38zsLupWryXHoEcS22YHthuPQSJdMy6KNrzIRzWqcsHzD/WUnqe45whVou4VIsPew37DoXWNrA==}

BIN
public/logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB