bhd-components 0.8.1 → 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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/dist/{3f8529e7.esm.es5.development.js → 100c4e1e.esm.es5.development.js} +2985 -2009
  3. package/dist/{f460f54e.esm.es5.production.js → a4d5ce04.esm.es5.production.js} +1 -1
  4. package/dist/index.esm.es5.development.css +2789 -1232
  5. package/dist/index.esm.es5.development.js +7225 -172
  6. package/dist/index.esm.es5.production.css +1 -1
  7. package/dist/index.esm.es5.production.js +1 -1
  8. package/dist/vendor.esm.es5.development.esm.es5.development.css +84 -83
  9. package/dist/vendor.esm.es5.production.esm.es5.production.css +10 -8
  10. package/es2017/bhdDatePicker/index.d.ts +16 -0
  11. package/es2017/bhdDatePicker/index.js +427 -0
  12. package/es2017/bhdDatePicker/index.module.less +886 -0
  13. package/es2017/customerService/historyFun.d.ts +1 -1
  14. package/es2017/customerService/historyFun.js +2 -1
  15. package/es2017/customerService/html2canvas.test.js +1234 -1233
  16. package/es2017/customerService/index.d.ts +1 -1
  17. package/es2017/customerService/index.js +134 -32
  18. package/es2017/customerService/index.module.less +7 -5
  19. package/es2017/customerService/index2.module.less +7 -5
  20. package/es2017/customerService/screenShotPlugin.esm.js +6515 -0
  21. package/es2017/customerService/screenshotTool.d.ts +1 -0
  22. package/es2017/customerService/screenshotTool.js +23 -12
  23. package/es2017/index.d.ts +1 -0
  24. package/es2017/index.js +1 -0
  25. package/es2017/theme/variable.less +27 -0
  26. package/esm/bhdDatePicker/index.d.ts +16 -0
  27. package/esm/bhdDatePicker/index.js +434 -0
  28. package/esm/bhdDatePicker/index.module.less +886 -0
  29. package/esm/customerService/historyFun.d.ts +1 -1
  30. package/esm/customerService/historyFun.js +2 -1
  31. package/esm/customerService/html2canvas.test.js +34 -34
  32. package/esm/customerService/index.d.ts +1 -1
  33. package/esm/customerService/index.js +139 -36
  34. package/esm/customerService/index.module.less +7 -5
  35. package/esm/customerService/index2.module.less +7 -5
  36. package/esm/customerService/screenShotPlugin.esm.js +6516 -0
  37. package/esm/customerService/screenshotTool.d.ts +1 -0
  38. package/esm/customerService/screenshotTool.js +21 -10
  39. package/esm/index.d.ts +1 -0
  40. package/esm/index.js +1 -0
  41. package/esm/theme/variable.less +27 -0
  42. package/package.json +20 -2
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import "highlight.js/styles/default.css";
2
+ import "highlight.js/styles/github.css";
3
3
  interface Service {
4
4
  type: string;
5
5
  params: any;
@@ -4,7 +4,6 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runt
4
4
  import React, { useEffect, useState, useRef } from "react";
5
5
  import { Modal, Drawer, Input, Tooltip } from "antd";
6
6
  import ViewImage from "../viewImage";
7
- // import html2canvas from "html2canvas";
8
7
  import cssStyle from "./index.module.less";
9
8
  import cssStyleOnline from "./index2.module.less";
10
9
  let styles = cssStyle;
@@ -20,7 +19,7 @@ import TeacherList from "./teacherList";
20
19
  import { parseDate } from "../utils/Date";
21
20
  import { Remarkable } from "remarkable";
22
21
  import hljs from "highlight.js";
23
- import "highlight.js/styles/default.css";
22
+ import "highlight.js/styles/github.css";
24
23
  import { render } from "react-dom";
25
24
  import Provider from "../provider";
26
25
  const { TextArea } = Input;
@@ -28,6 +27,9 @@ const { TextArea } = Input;
28
27
  import knowledge_icon from "./images/knowledge_icon.png";
29
28
  // import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
30
29
  import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate } from "./function"; //一些方法
30
+ // import html2canvas from "html2canvas";
31
+ // const screenShot = require('./screenShotPlugin.esm')
32
+ import ScreenShot from "./screenShotPlugin.esm.js";
31
33
  const CustomerService = (props)=>{
32
34
  let { userData , http , urllocation , onCancel , serverName , fetchEventSource , initShowType , onEvent , stepIds , stepId , screenshotAreaId , config } = props;
33
35
  // const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
@@ -96,6 +98,8 @@ const CustomerService = (props)=>{
96
98
  return ""; // use external default escaping
97
99
  }
98
100
  });
101
+ const [screenShotType, setScreenShotType] = useState(0) //1是 screenShotPlugin 2是html2canvas
102
+ ;
99
103
  useEffect(()=>{
100
104
  // if(config && config.type == 'video'){
101
105
  // //获取热门推荐
@@ -106,33 +110,125 @@ const CustomerService = (props)=>{
106
110
  initShowType
107
111
  ]);
108
112
  useEffect(()=>{
109
- //|| showScreenshot
110
- if (showType == 5 || showScreenshot) {
113
+ function handlerHtml2canvas() {
114
+ console.log('kkkkkkkkkkk');
111
115
  try {
112
116
  newShowType.current = true;
113
117
  setImgBese64('');
114
- // let dom = document.getElementById(screenshotAreaId);
115
- html2canvas(screenshotAreaId, {
116
- useCORS: true,
117
- // allowTaint: true, // 污染处理
118
- scale: 1,
119
- // logging:true,
120
- ignoreElements: (element)=>{
121
- if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
122
- return false;
123
- }
124
- }).then(function(canvas) {
125
- // document.body.appendChild(canvas);
126
- console.log(canvas, 99999);
127
- // var base64URL = canvas.toDataURL('image/jpeg')
128
- let base64URL = canvas.toDataURL("image/jpg", 1.0);
129
- console.log(base64URL);
130
- setImgBese64(base64URL);
131
- });
118
+ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
119
+ setScreenShotType(1);
120
+ console.log('看看变了没有1213133');
121
+ console.log('截图方式:【screenShotPlugin】', ScreenShot);
122
+ const plugin = new ScreenShot({
123
+ clickCutFullScreen: true,
124
+ enableWebRtc: true,
125
+ loadCrossImg: true,
126
+ canvasWidth: window.innerWidth,
127
+ canvasHeight: window.innerHeight,
128
+ level: -1,
129
+ hiddenToolIco: true,
130
+ screenShotDom: document.body,
131
+ cropBoxInfo: {
132
+ x: 0,
133
+ y: 0,
134
+ w: window.innerWidth,
135
+ h: window.innerHeight
136
+ },
137
+ wrcReplyTime: 500,
138
+ wrcWindowMode: true,
139
+ curTabState: false,
140
+ hiddenScrollBar: {
141
+ state: true
142
+ },
143
+ completeCallback: ({ base64 })=>{
144
+ // console.log(
145
+ // "截图组件加载完毕调用此方法来完成框选区域的截图",
146
+ // base64
147
+ // );
148
+ setImgBese64(base64);
149
+ },
150
+ triggerCallback: ()=>{
151
+ // 截图组件加载完毕调用此方法来完成框选区域的截图
152
+ plugin.completeScreenshot();
153
+ },
154
+ cancelCallback: (err)=>{
155
+ if (err.code === -1) {
156
+ console.log(err);
157
+ newShowType.current = false;
158
+ if (saveShowType != -1) {
159
+ setShowType(saveShowType);
160
+ } else {
161
+ setShowType(1);
162
+ }
163
+ setShowScreenshot(false);
164
+ onCancel();
165
+ }
166
+ }
167
+ });
168
+ } else {
169
+ setScreenShotType(2);
170
+ console.log('截图方式:【html2canvas】');
171
+ html2canvas(screenshotAreaId, {
172
+ useCORS: true,
173
+ allowTaint: true,
174
+ scale: 1,
175
+ logging: false,
176
+ // foreignObjectRendering:true,
177
+ ignoreElements: (element)=>{
178
+ if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
179
+ return false;
180
+ },
181
+ windowWidth: window.innerWidth,
182
+ windowHeight: window.innerHeight
183
+ }).then(function(canvas) {
184
+ // document.body.appendChild(canvas);
185
+ // console.log(canvas,99999);
186
+ // var base64URL = canvas.toDataURL('image/jpeg')
187
+ let base64URL = canvas.toDataURL("image/jpg", 1.0);
188
+ // console.log(base64URL);
189
+ setImgBese64(base64URL);
190
+ // svgNodesToRemove.forEach(item=>{
191
+ // item.remove()
192
+ // })
193
+ });
194
+ }
195
+ // modernScreenshot
196
+ // .domToPng(document.querySelector("body"))
197
+ // .then((dataUrl:any) => {
198
+ // console.log(dataUrl);
199
+ // setImgBese64(dataUrl);
200
+ // });
201
+ // domtoimage
202
+ // .toPng(document.body)
203
+ // .then(function (dataUrl:any) {
204
+ // setImgBese64(dataUrl);
205
+ // })
206
+ // .catch(function (error:any) {
207
+ // console.error("oops, something went wrong!", error);
208
+ // });
209
+ // //排除
210
+ // new screenShotPlugin({
211
+ // enableWebRtc: true,
212
+ // canvasWidth:window.innerWidth,
213
+ // canvasHeight:window.innerHeight,
214
+ // level:9999999,
215
+ // completeCallback: function (info:any) {
216
+ // console.log(info);
217
+ // setImgBese64(info.base64);
218
+ // },
219
+ // closeCallback: function () {
220
+ // },
221
+ // });
132
222
  } catch (error) {
133
223
  console.log(error);
134
224
  }
135
225
  }
226
+ //|| showScreenshot
227
+ if (showType == 5 || showScreenshot) {
228
+ console.log('bbbbbbbbbbbbbb');
229
+ handlerHtml2canvas();
230
+ // window.addEventListener('resize',handlerHtml2canvas)
231
+ }
136
232
  if (showType != 1 && !firstLoad && pageCount > 0) {
137
233
  setFirstLoad(true);
138
234
  scrollToBottom();
@@ -192,6 +288,7 @@ const CustomerService = (props)=>{
192
288
  if (content) {
193
289
  content.removeEventListener("scroll", handleScroll);
194
290
  }
291
+ window.removeEventListener('resize', handlerHtml2canvas);
195
292
  };
196
293
  }, [
197
294
  historyMessageList,
@@ -1668,11 +1765,18 @@ const CustomerService = (props)=>{
1668
1765
  /*#__PURE__*/ _jsxs("div", {
1669
1766
  className: styles.operate,
1670
1767
  children: [
1671
- /*#__PURE__*/ _jsx("i", {
1768
+ /*#__PURE__*/ _jsxs("i", {
1769
+ className: styles.popover_main,
1672
1770
  onClick: ()=>{
1673
1771
  setShowHistory(true);
1674
1772
  },
1675
- children: /*#__PURE__*/ _jsx(CustomRecord, {})
1773
+ children: [
1774
+ /*#__PURE__*/ _jsx(CustomRecord, {}),
1775
+ /*#__PURE__*/ _jsx("span", {
1776
+ className: styles.popover,
1777
+ children: "历史记录"
1778
+ })
1779
+ ]
1676
1780
  }),
1677
1781
  /*#__PURE__*/ _jsx("span", {
1678
1782
  className: styles.line
@@ -1692,20 +1796,14 @@ const CustomerService = (props)=>{
1692
1796
  })
1693
1797
  ]
1694
1798
  }),
1695
- /*#__PURE__*/ _jsxs("i", {
1799
+ /*#__PURE__*/ _jsx("i", {
1696
1800
  className: styles.popover_main,
1697
1801
  onClick: ()=>{
1698
1802
  onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
1699
1803
  setShowType(3);
1700
1804
  setFirstLoad(false); //重启滚动条在最上方
1701
1805
  },
1702
- children: [
1703
- /*#__PURE__*/ _jsx(CloseOutlined, {}),
1704
- /*#__PURE__*/ _jsx("span", {
1705
- className: styles.popover,
1706
- children: "退出全屏"
1707
- })
1708
- ]
1806
+ children: /*#__PURE__*/ _jsx(CloseOutlined, {})
1709
1807
  })
1710
1808
  ]
1711
1809
  })
@@ -3385,6 +3483,9 @@ const CustomerService = (props)=>{
3385
3483
  }),
3386
3484
  (showType == 4 || showType == 5) && /*#__PURE__*/ _jsxs("div", {
3387
3485
  className: `${styles.ChatWindow_Drawer}`,
3486
+ style: {
3487
+ display: `${!showScreenshot ? "none" : "flex"}`
3488
+ },
3388
3489
  id: "",
3389
3490
  children: [
3390
3491
  /*#__PURE__*/ _jsx("div", {
@@ -3484,6 +3585,7 @@ const CustomerService = (props)=>{
3484
3585
  }),
3485
3586
  (showType == 5 || showScreenshot) && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
3486
3587
  imgBese64: imgBese64,
3588
+ screenShotType: screenShotType,
3487
3589
  saveScreenshotBese64: (base64)=>{
3488
3590
  newShowType.current = false;
3489
3591
  setScreenshotBese64(base64);
@@ -1177,8 +1177,8 @@
1177
1177
  max-height: 36px;
1178
1178
  word-break: break-all;
1179
1179
 
1180
- display: flex;
1181
- align-items: center;
1180
+ //display: flex;
1181
+ //align-items: center;
1182
1182
  img{
1183
1183
  margin-right: 8px;
1184
1184
  width: 60px;
@@ -1866,7 +1866,7 @@
1866
1866
  width: 417px;
1867
1867
  height: calc(100% - 48px);
1868
1868
  right: 0;
1869
- top: 48px;
1869
+ top: 38px;
1870
1870
  border-radius: 0;
1871
1871
  background: transparent;
1872
1872
  overflow: visible;
@@ -1918,7 +1918,7 @@
1918
1918
  background-color: transparent !important;
1919
1919
  // background-color: burlywood;
1920
1920
  .ReactCrop{
1921
-
1921
+ cursor: default !important;
1922
1922
  }
1923
1923
  :global{
1924
1924
  .ReactCrop__child-wrapper{
@@ -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{
@@ -1935,6 +1936,7 @@
1935
1936
  height: 100% !important;
1936
1937
  top: 0 !important;
1937
1938
  left: 0 !important;
1939
+ cursor: default !important;
1938
1940
  }
1939
1941
 
1940
1942
  }
@@ -1175,8 +1175,8 @@
1175
1175
  max-height: 36px;
1176
1176
  word-break: break-all;
1177
1177
 
1178
- display: flex;
1179
- align-items: center;
1178
+ //display: flex;
1179
+ //align-items: center;
1180
1180
  img{
1181
1181
  margin-right: 8px;
1182
1182
  width: 60px;
@@ -1860,7 +1860,7 @@
1860
1860
  width: 417px;
1861
1861
  height: calc(100% - 48px);
1862
1862
  right: 0;
1863
- top: 48px;
1863
+ top: 38px;
1864
1864
  border-radius: 0;
1865
1865
  background: transparent;
1866
1866
  overflow: visible;
@@ -1904,7 +1904,7 @@
1904
1904
  background-color: transparent !important;
1905
1905
  // background-color: burlywood;
1906
1906
  .ReactCrop{
1907
-
1907
+ cursor: default !important;
1908
1908
  }
1909
1909
  :global{
1910
1910
  .ReactCrop__child-wrapper{
@@ -1912,7 +1912,8 @@
1912
1912
  width: 100% !important;
1913
1913
  height: 100% !important;
1914
1914
  top: 0 !important;
1915
- left: 0 !important
1915
+ left: 0 !important;
1916
+ cursor: default !important;
1916
1917
  }
1917
1918
  }
1918
1919
  :global{
@@ -1921,6 +1922,7 @@
1921
1922
  height: 100% !important;
1922
1923
  top: 0 !important;
1923
1924
  left: 0 !important;
1925
+ cursor: default !important;
1924
1926
  }
1925
1927
 
1926
1928
  }