bhd-components 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,8 +4,8 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
4
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
5
5
  import React, { useEffect, useState, useRef } from "react";
6
6
  import styles from "./index.module.less";
7
- import "highlight.js/styles/github.css";
8
7
  //import "highlight.js/styles/default.css";
8
+ import "highlight.js/styles/github.css";
9
9
  import { Input } from "antd";
10
10
  import { CustomClose, CustomExpand, CustomAiIcon } from "../icons/index";
11
11
  import { SearchOutlined } from "@ant-design/icons";
@@ -6,6 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runt
6
6
  import React, { useEffect, useState, useRef } from "react";
7
7
  import { Modal, Drawer, Input, Tooltip } from "antd";
8
8
  import ViewImage from "../viewImage";
9
+ // import html2canvas from "html2canvas";
9
10
  import cssStyle from "./index.module.less";
10
11
  import cssStyleOnline from "./index2.module.less";
11
12
  var styles = cssStyle;
@@ -21,6 +22,7 @@ import TeacherList from "./teacherList";
21
22
  import { parseDate } from "../utils/Date";
22
23
  import { Remarkable } from "remarkable";
23
24
  import hljs from "highlight.js";
25
+ //import "highlight.js/styles/default.css";
24
26
  import "highlight.js/styles/github.css";
25
27
  import { render } from "react-dom";
26
28
  import Provider from "../provider";
@@ -107,112 +109,6 @@ var CustomerService = function(props) {
107
109
  initShowType
108
110
  ]);
109
111
  useEffect(function() {
110
- var handlerHtml2canvas = function handlerHtml2canvas() {
111
- console.log("kkkkkkkkkkk");
112
- try {
113
- newShowType.current = true;
114
- setImgBese64("");
115
- var plugin = new screenShotPlugin({
116
- clickCutFullScreen: true,
117
- enableWebRtc: true,
118
- loadCrossImg: true,
119
- canvasWidth: window.innerWidth,
120
- canvasHeight: window.innerHeight,
121
- level: -1,
122
- hiddenToolIco: true,
123
- screenShotDom: document.body,
124
- cropBoxInfo: {
125
- x: 0,
126
- y: 0,
127
- w: window.innerWidth,
128
- h: window.innerHeight
129
- },
130
- wrcReplyTime: 20,
131
- wrcWindowMode: true,
132
- hiddenScrollBar: {
133
- state: true
134
- },
135
- completeCallback: function(param) {
136
- var base64 = param.base64;
137
- // console.log(
138
- // "截图组件加载完毕调用此方法来完成框选区域的截图",
139
- // base64
140
- // );
141
- setImgBese64(base64);
142
- },
143
- triggerCallback: function() {
144
- // 截图组件加载完毕调用此方法来完成框选区域的截图
145
- plugin.completeScreenshot();
146
- },
147
- cancelCallback: function(err) {
148
- if (err.code === -1) {
149
- console.log(err);
150
- newShowType.current = false;
151
- if (saveShowType != -1) {
152
- setShowType(saveShowType);
153
- } else {
154
- setShowType(1);
155
- }
156
- setShowScreenshot(false);
157
- onCancel();
158
- }
159
- }
160
- });
161
- // modernScreenshot
162
- // .domToPng(document.querySelector("body"))
163
- // .then((dataUrl:any) => {
164
- // console.log(dataUrl);
165
- // setImgBese64(dataUrl);
166
- // });
167
- // domtoimage
168
- // .toPng(document.body)
169
- // .then(function (dataUrl:any) {
170
- // setImgBese64(dataUrl);
171
- // })
172
- // .catch(function (error:any) {
173
- // console.error("oops, something went wrong!", error);
174
- // });
175
- // //排除
176
- // new screenShotPlugin({
177
- // enableWebRtc: true,
178
- // canvasWidth:window.innerWidth,
179
- // canvasHeight:window.innerHeight,
180
- // level:9999999,
181
- // completeCallback: function (info:any) {
182
- // console.log(info);
183
- // setImgBese64(info.base64);
184
- // },
185
- // closeCallback: function () {
186
- // },
187
- // });
188
- // html2canvas(document.body,{//__docusaurus
189
- // useCORS: true, // 支持跨域图片截图
190
- // allowTaint: true, // 污染处理
191
- // scale: 1 ,// 图片比例
192
- // logging:false,
193
- // // foreignObjectRendering:true,
194
- // ignoreElements:(element: { compareDocumentPosition: (arg0: string) => number; })=>{
195
- // if(element.compareDocumentPosition(screenshotAreaId)===2)return true
196
- // return false
197
- // },
198
- // windowWidth:window.innerWidth,
199
- // windowHeight:window.innerHeight
200
- // })
201
- // .then(function (canvas:any) {
202
- // // document.body.appendChild(canvas);
203
- // // console.log(canvas,99999);
204
- // // var base64URL = canvas.toDataURL('image/jpeg')
205
- // let base64URL = canvas.toDataURL("image/jpg", 1.0)
206
- // // console.log(base64URL);
207
- // setImgBese64(base64URL);
208
- // // svgNodesToRemove.forEach(item=>{
209
- // // item.remove()
210
- // // })
211
- // });
212
- } catch (error) {
213
- console.log(error);
214
- }
215
- };
216
112
  var handleScroll = function handleScroll() {
217
113
  var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
218
114
  var scrollTop = container.scrollTop;
@@ -261,9 +157,30 @@ var CustomerService = function(props) {
261
157
  };
262
158
  //|| showScreenshot
263
159
  if (showType == 5 || showScreenshot) {
264
- console.log("bbbbbbbbbbbbbb");
265
- handlerHtml2canvas();
266
- // window.addEventListener('resize',handlerHtml2canvas)
160
+ try {
161
+ newShowType.current = true;
162
+ setImgBese64("");
163
+ // let dom = document.getElementById(screenshotAreaId);
164
+ html2canvas(screenshotAreaId, {
165
+ useCORS: true,
166
+ // allowTaint: true, // 污染处理
167
+ scale: 1,
168
+ // logging:true,
169
+ ignoreElements: function(element) {
170
+ if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
171
+ return false;
172
+ }
173
+ }).then(function(canvas) {
174
+ // document.body.appendChild(canvas);
175
+ console.log(canvas, 99999);
176
+ // var base64URL = canvas.toDataURL('image/jpeg')
177
+ var base64URL = canvas.toDataURL("image/jpg", 1.0);
178
+ console.log(base64URL);
179
+ setImgBese64(base64URL);
180
+ });
181
+ } catch (error) {
182
+ console.log(error);
183
+ }
267
184
  }
268
185
  if (showType != 1 && !firstLoad && pageCount > 0) {
269
186
  setFirstLoad(true);
@@ -278,7 +195,7 @@ var CustomerService = function(props) {
278
195
  if (content) {
279
196
  content.removeEventListener("scroll", handleScroll);
280
197
  }
281
- window.removeEventListener("resize", handlerHtml2canvas);
198
+ // window.removeEventListener('resize',handlerHtml2canvas)
282
199
  };
283
200
  }, [
284
201
  historyMessageList,
@@ -3536,9 +3453,6 @@ var CustomerService = function(props) {
3536
3453
  }),
3537
3454
  (showType == 4 || showType == 5) && /*#__PURE__*/ _jsxs("div", {
3538
3455
  className: "".concat(styles.ChatWindow_Drawer),
3539
- style: {
3540
- display: "".concat(!showScreenshot ? "none" : "flex")
3541
- },
3542
3456
  id: "",
3543
3457
  children: [
3544
3458
  /*#__PURE__*/ _jsx("div", {
@@ -1926,7 +1926,8 @@
1926
1926
  width: 100% !important;
1927
1927
  height: 100% !important;
1928
1928
  top: 0 !important;
1929
- left: 0 !important
1929
+ left: 0 !important;
1930
+ cursor: default !important;
1930
1931
  }
1931
1932
  }
1932
1933
  :global{
@@ -1922,6 +1922,7 @@
1922
1922
  height: 100% !important;
1923
1923
  top: 0 !important;
1924
1924
  left: 0 !important;
1925
+ cursor: default !important;
1925
1926
  }
1926
1927
 
1927
1928
  }
@@ -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 = 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()); // 需要裁剪的区域高度
37
+ var x = completedCrop.x; // 起始点x坐标
38
+ var y = completedCrop.y; // 起始点y坐标
39
+ var width = completedCrop.width; // 需要裁剪的区域宽度
40
+ var height = completedCrop.height; // 需要裁剪的区域高度
41
41
  // 设置canvas大小与裁剪区域相同
42
42
  canvas.width = width;
43
43
  canvas.height = height;
@@ -56,20 +56,18 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
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(window.devicePixelRatio), 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({
59
+ var _useState3 = _sliced_to_array(useState({
62
60
  top: 0,
63
61
  left: 0
64
- }), 2), btnPosition = _useState5[0], setBtnPosition = _useState5[1];
65
- var _useState6 = _sliced_to_array(useState(false), 2), showBtn = _useState6[0], setShowBtn = _useState6[1];
62
+ }), 2), btnPosition = _useState3[0], setBtnPosition = _useState3[1];
63
+ var _useState4 = _sliced_to_array(useState(false), 2), showBtn = _useState4[0], setShowBtn = _useState4[1];
66
64
  var savePosition = function(e) {
67
65
  // console.log(e,'位置位置');
68
66
  var x = e.x;
69
67
  var y = e.y;
70
68
  var h = e.height;
71
69
  var w = e.width;
72
- var top = y + h + (isFirst ? 21 : 8);
70
+ var top = y + h + 8;
73
71
  var left = x + w - 88;
74
72
  if (top + 42 > window.innerHeight) {
75
73
  top = top - 50;
@@ -79,7 +77,6 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
79
77
  left: left
80
78
  });
81
79
  setShowBtn(true);
82
- setIsFirst(false);
83
80
  };
84
81
  return /*#__PURE__*/ _jsxs("div", {
85
82
  className: styles.screenshot_Modal,
package/esm/index.d.ts CHANGED
@@ -80,3 +80,4 @@ export { default as BhdTipModal } from "./bhdTipModal";
80
80
  export { default as BhdSelect } from "./bhdSelect";
81
81
  export { default as BhdAppLayout } from "./bhdAppLayout";
82
82
  export { default as CustomerService } from "./customerService";
83
+ export { default as BhdDatePicker } from "./bhdDatePicker";
package/esm/index.js CHANGED
@@ -85,3 +85,4 @@ export { default as BhdTipModal } from "./bhdTipModal/index"; //提示框
85
85
  export { default as BhdSelect } from "./bhdSelect/index"; //封装 bhdSelect
86
86
  export { default as BhdAppLayout } from "./bhdAppLayout/index"; //封装 BhdAppLayout
87
87
  export { default as CustomerService } from "./customerService/index"; //封装 智能客服
88
+ export { default as BhdDatePicker } from "./bhdDatePicker/index"; //封装 日历组件
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",