bhd-components 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{f8c2008a.esm.es5.development.js → 100c4e1e.esm.es5.development.js} +2992 -2025
- package/dist/{256789e0.esm.es5.production.js → a4d5ce04.esm.es5.production.js} +10 -10
- package/dist/index.esm.es5.development.css +1899 -1580
- package/dist/index.esm.es5.development.js +6909 -221
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/es2017/bhdDatePicker/index.d.ts +0 -1
- package/es2017/bhdDatePicker/index.js +238 -171
- package/es2017/bhdDatePicker/index.module.less +81 -46
- package/es2017/customerService/index.js +122 -23
- package/es2017/customerService/screenShotPlugin.esm.js +6515 -0
- package/es2017/customerService/screenshotTool.d.ts +1 -0
- package/es2017/customerService/screenshotTool.js +23 -15
- package/es2017/theme/variable.less +27 -0
- package/esm/bhdDatePicker/index.d.ts +0 -1
- package/esm/bhdDatePicker/index.js +242 -175
- package/esm/bhdDatePicker/index.module.less +81 -46
- package/esm/customerService/index.js +127 -27
- package/esm/customerService/screenShotPlugin.esm.js +6516 -0
- package/esm/customerService/screenshotTool.d.ts +1 -0
- package/esm/customerService/screenshotTool.js +21 -13
- package/esm/theme/variable.less +27 -0
- package/package.json +20 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
3
|
-
import React, { useState, forwardRef } from "react";
|
|
3
|
+
import React, { useState, forwardRef, useEffect } from "react";
|
|
4
4
|
import ReactCrop, { centerCrop, makeAspectCrop } from "react-image-crop";
|
|
5
5
|
import { CloseOutlined } from "@ant-design/icons";
|
|
6
6
|
import { CustomDuihao } from "../icons/index";
|
|
@@ -15,7 +15,7 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15
15
|
};
|
|
16
16
|
var onImageLoad = function onImageLoad(e) {
|
|
17
17
|
if (aspect) {
|
|
18
|
-
|
|
18
|
+
console.log(aspect, e, "dlvkdfmvlkdfmvdfkl");
|
|
19
19
|
// const { width, height } = e.currentTarget
|
|
20
20
|
var width = 100;
|
|
21
21
|
var height = 100 * (9 / 16);
|
|
@@ -34,10 +34,10 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
34
34
|
image.src = imgBese64; // 将'your_image_url'替换为你自己的图片URL
|
|
35
35
|
// 等待图片加载完成后再进行操作
|
|
36
36
|
image.onload = function() {
|
|
37
|
-
var x = completedCrop.x; // 起始点x坐标
|
|
38
|
-
var y = completedCrop.y; // 起始点y坐标
|
|
39
|
-
var width = completedCrop.width; // 需要裁剪的区域宽度
|
|
40
|
-
var height = completedCrop.height; // 需要裁剪的区域高度
|
|
37
|
+
var x = parseInt((completedCrop.x * devicePixelRatio).toString()); // 起始点x坐标
|
|
38
|
+
var y = parseInt((completedCrop.y * devicePixelRatio).toString()); // 起始点y坐标
|
|
39
|
+
var width = parseInt((completedCrop.width * devicePixelRatio).toString()); // 需要裁剪的区域宽度
|
|
40
|
+
var height = parseInt((completedCrop.height * devicePixelRatio).toString()); // 需要裁剪的区域高度
|
|
41
41
|
// 设置canvas大小与裁剪区域相同
|
|
42
42
|
canvas.width = width;
|
|
43
43
|
canvas.height = height;
|
|
@@ -52,21 +52,30 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
52
52
|
saveScreenshotBese64(croppedDataUrl);
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
var imgBese64 = props.imgBese64, saveScreenshotBese64 = props.saveScreenshotBese64, cancelScreenshot = props.cancelScreenshot;
|
|
55
|
+
var imgBese64 = props.imgBese64, screenShotType = props.screenShotType, saveScreenshotBese64 = props.saveScreenshotBese64, cancelScreenshot = props.cancelScreenshot;
|
|
56
56
|
var _useState = _sliced_to_array(useState(), 2), crop = _useState[0], setCrop = _useState[1];
|
|
57
57
|
var _useState1 = _sliced_to_array(useState(), 2), completedCrop = _useState1[0], setCompletedCrop = _useState1[1];
|
|
58
58
|
var _useState2 = _sliced_to_array(useState(16 / 9), 2), aspect = _useState2[0], setAspect = _useState2[1];
|
|
59
|
-
var _useState3 = _sliced_to_array(useState(
|
|
59
|
+
var _useState3 = _sliced_to_array(useState(1), 2), devicePixelRatio = _useState3[0], setDevicePixelRatio = _useState3[1];
|
|
60
|
+
var _useState4 = _sliced_to_array(useState(true), 2), isFirst = _useState4[0], setIsFirst = _useState4[1];
|
|
61
|
+
var _useState5 = _sliced_to_array(useState({
|
|
60
62
|
top: 0,
|
|
61
63
|
left: 0
|
|
62
|
-
}), 2), btnPosition =
|
|
63
|
-
var
|
|
64
|
+
}), 2), btnPosition = _useState5[0], setBtnPosition = _useState5[1];
|
|
65
|
+
var _useState6 = _sliced_to_array(useState(false), 2), showBtn = _useState6[0], setShowBtn = _useState6[1];
|
|
66
|
+
useEffect(function() {
|
|
67
|
+
setDevicePixelRatio(screenShotType === 1 ? window.devicePixelRatio || 1 : 1);
|
|
68
|
+
}, [
|
|
69
|
+
screenShotType
|
|
70
|
+
]);
|
|
64
71
|
var savePosition = function(e) {
|
|
65
72
|
// console.log(e,'位置位置');
|
|
66
73
|
var x = e.x;
|
|
67
74
|
var y = e.y;
|
|
68
75
|
var h = e.height;
|
|
69
76
|
var w = e.width;
|
|
77
|
+
// 新方案使用
|
|
78
|
+
//旧方案改成 let top = y + h + (isFirst ? 21 : 8);
|
|
70
79
|
var top = y + h + 8;
|
|
71
80
|
var left = x + w - 88;
|
|
72
81
|
if (top + 42 > window.innerHeight) {
|
|
@@ -77,6 +86,7 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
77
86
|
left: left
|
|
78
87
|
});
|
|
79
88
|
setShowBtn(true);
|
|
89
|
+
setIsFirst(false);
|
|
80
90
|
};
|
|
81
91
|
return /*#__PURE__*/ _jsxs("div", {
|
|
82
92
|
className: styles.screenshot_Modal,
|
|
@@ -102,9 +112,7 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
102
112
|
minWidth: 100,
|
|
103
113
|
children: /*#__PURE__*/ _jsx("img", {
|
|
104
114
|
alt: "Crop me",
|
|
105
|
-
style:
|
|
106
|
-
display: "none"
|
|
107
|
-
},
|
|
115
|
+
// style={{display:'none'}}
|
|
108
116
|
src: imgBese64,
|
|
109
117
|
onLoad: onImageLoad
|
|
110
118
|
})
|
package/esm/theme/variable.less
CHANGED
|
@@ -76,6 +76,8 @@
|
|
|
76
76
|
@Gray-09: #262626;
|
|
77
77
|
@Gray-10: #000000;
|
|
78
78
|
|
|
79
|
+
|
|
80
|
+
|
|
79
81
|
/* 变量色值 */
|
|
80
82
|
|
|
81
83
|
/* "color-background-layout": {
|
|
@@ -143,6 +145,16 @@
|
|
|
143
145
|
|
|
144
146
|
@color-background-quinary: @Gray-01;
|
|
145
147
|
|
|
148
|
+
|
|
149
|
+
/*
|
|
150
|
+
"color-background-Mask-Tr": {
|
|
151
|
+
"value": "{Gray-Tr-06}",
|
|
152
|
+
"type": "color",
|
|
153
|
+
"description": "蒙层颜色"
|
|
154
|
+
},
|
|
155
|
+
*/
|
|
156
|
+
|
|
157
|
+
@color-background-Mask-Tr:@Gray-Tr-06;
|
|
146
158
|
/*
|
|
147
159
|
"color-background-primary-base": {
|
|
148
160
|
"value": "{Red-06}",
|
|
@@ -246,6 +258,13 @@
|
|
|
246
258
|
"description": "二级边框色"
|
|
247
259
|
}, */
|
|
248
260
|
@color-border-secondary-Tr: @Gray-Tr-04;
|
|
261
|
+
|
|
262
|
+
/* "color-border-tertiary": {
|
|
263
|
+
"value": "{Gray-01}",
|
|
264
|
+
"type": "color",
|
|
265
|
+
"description": "三级边框色"
|
|
266
|
+
}, */
|
|
267
|
+
@color-border-tertiary:@Gray-01;
|
|
249
268
|
/* "color-border-primary": {
|
|
250
269
|
"value": "{Red-06}",
|
|
251
270
|
"type": "color",
|
|
@@ -525,6 +544,14 @@
|
|
|
525
544
|
}
|
|
526
545
|
*/
|
|
527
546
|
@color-icon-error: @Orange-06;
|
|
547
|
+
/*
|
|
548
|
+
"color-icon-base": {
|
|
549
|
+
"value": "$Blue-06",
|
|
550
|
+
"type": "color",
|
|
551
|
+
"description": "图标,一级填充色"
|
|
552
|
+
}
|
|
553
|
+
*/
|
|
554
|
+
@color-icon-base: @Blue-06;
|
|
528
555
|
/*
|
|
529
556
|
"color-icon-fill": {
|
|
530
557
|
"value": "$Gray-08",
|
package/package.json
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bhd-components",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "组件功能描述",
|
|
5
|
+
"config": {
|
|
6
|
+
"commitizen": {
|
|
7
|
+
"path": "cz-customizable"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"gitHooks": {
|
|
11
|
+
"pre-commit": "lint-staged",
|
|
12
|
+
"commit-msg": "commitlint -eV"
|
|
13
|
+
},
|
|
5
14
|
"files": [
|
|
6
15
|
"esm",
|
|
7
16
|
"es2017",
|
|
@@ -39,7 +48,9 @@
|
|
|
39
48
|
"eslint": "eslint --cache --ext .js,.jsx,.ts,.tsx ./",
|
|
40
49
|
"eslint:fix": "npm run eslint -- --fix",
|
|
41
50
|
"stylelint": "stylelint \"**/*.{css,scss,less}\"",
|
|
42
|
-
"lint": "npm run eslint && npm run stylelint"
|
|
51
|
+
"lint": "npm run eslint && npm run stylelint",
|
|
52
|
+
"prepare": "husky install",
|
|
53
|
+
"commit": "git add . && npx cz"
|
|
43
54
|
},
|
|
44
55
|
"keywords": [
|
|
45
56
|
"ice",
|
|
@@ -65,12 +76,19 @@
|
|
|
65
76
|
"remarkable": "^2.0.1"
|
|
66
77
|
},
|
|
67
78
|
"devDependencies": {
|
|
79
|
+
"@commitlint/cli": "^19.4.0",
|
|
80
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
68
81
|
"@ice/pkg": "^1.0.0",
|
|
69
82
|
"@ice/pkg-plugin-docusaurus": "^1.0.0",
|
|
70
83
|
"@iceworks/spec": "^1.0.0",
|
|
71
84
|
"@types/react": "^18.0.0",
|
|
72
85
|
"@types/react-dom": "^18.0.0",
|
|
86
|
+
"commitizen": "^4.3.0",
|
|
87
|
+
"commitlint": "^19.4.0",
|
|
88
|
+
"cz-customizable": "^7.0.0",
|
|
73
89
|
"eslint": "^7.0.0",
|
|
90
|
+
"husky": "^9.0.11",
|
|
91
|
+
"lint-staged": "^15.2.7",
|
|
74
92
|
"react": "^18.0.0",
|
|
75
93
|
"react-dom": "^18.0.0",
|
|
76
94
|
"rollup-plugin-terser": "^7.0.2",
|