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 data {
4
4
  type: number;
5
5
  roomId: String | number;
@@ -4,7 +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/default.css";
7
+ //import "highlight.js/styles/default.css";
8
+ import "highlight.js/styles/github.css";
8
9
  import { Input } from "antd";
9
10
  import { CustomClose, CustomExpand, CustomAiIcon } from "../icons/index";
10
11
  import { SearchOutlined } from "@ant-design/icons";
@@ -1,4 +1,4 @@
1
- import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
1
+ var _instanceof = require("@swc/helpers/cjs/_instanceof.cjs")._;
2
2
  /*!
3
3
  * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
4
4
  * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
@@ -8,66 +8,50 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
8
8
  })(this, function() {
9
9
  "use strict";
10
10
  var __extends = function __extends(d, b) {
11
+ var __ = function __() {
12
+ this.constructor = d;
13
+ };
11
14
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
15
  extendStatics(d, b);
13
- function __() {
14
- this.constructor = d;
15
- }
16
16
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17
17
  };
18
18
  var __awaiter = function __awaiter(thisArg, _arguments, P, generator) {
19
- function adopt(value) {
19
+ var adopt = function adopt(value) {
20
20
  return _instanceof(value, P) ? value : new P(function(resolve) {
21
21
  resolve(value);
22
22
  });
23
- }
23
+ };
24
24
  return new (P || (P = Promise))(function(resolve, reject) {
25
- function fulfilled(value) {
25
+ var fulfilled = function fulfilled(value) {
26
26
  try {
27
27
  step(generator.next(value));
28
28
  } catch (e) {
29
29
  reject(e);
30
30
  }
31
- }
32
- function rejected(value) {
31
+ };
32
+ var rejected = function rejected(value) {
33
33
  try {
34
34
  step(generator["throw"](value));
35
35
  } catch (e) {
36
36
  reject(e);
37
37
  }
38
- }
39
- function step(result) {
38
+ };
39
+ var step = function step(result) {
40
40
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
41
- }
41
+ };
42
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
43
43
  });
44
44
  };
45
45
  var __generator = function __generator(thisArg, body) {
46
- var _ = {
47
- label: 0,
48
- sent: function sent() {
49
- if (t[0] & 1) throw t[1];
50
- return t[1];
51
- },
52
- trys: [],
53
- ops: []
54
- }, f, y, t, g;
55
- return g = {
56
- next: verb(0),
57
- "throw": verb(1),
58
- "return": verb(2)
59
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
60
- return this;
61
- }), g;
62
- function verb(n) {
46
+ var verb = function verb(n) {
63
47
  return function(v) {
64
48
  return step([
65
49
  n,
66
50
  v
67
51
  ]);
68
52
  };
69
- }
70
- function step(op) {
53
+ };
54
+ var step = function step(op) {
71
55
  if (f) throw new TypeError("Generator is already executing.");
72
56
  while(_)try {
73
57
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
@@ -135,7 +119,23 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
135
119
  value: op[0] ? op[1] : void 0,
136
120
  done: true
137
121
  };
138
- }
122
+ };
123
+ var _ = {
124
+ label: 0,
125
+ sent: function sent() {
126
+ if (t[0] & 1) throw t[1];
127
+ return t[1];
128
+ },
129
+ trys: [],
130
+ ops: []
131
+ }, f, y, t, g;
132
+ return g = {
133
+ next: verb(0),
134
+ "throw": verb(1),
135
+ "return": verb(2)
136
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
137
+ return this;
138
+ }), g;
139
139
  };
140
140
  var __spreadArray = function __spreadArray(to, from, pack) {
141
141
  if (pack || arguments.length === 2) for(var i = 0, l = from.length, ar; i < l; i++){
@@ -824,8 +824,7 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
824
824
  return BREAK_NOT_ALLOWED$1;
825
825
  }
826
826
  // LB25 Do not break between the following pairs of classes relevant to numbers:
827
- if (// (PR | PO) × ( OP | HY )? NU
828
- [
827
+ if ([
829
828
  PR,
830
829
  PO
831
830
  ].indexOf(current) !== -1 && (next === NU || [
@@ -8579,3 +8578,4 @@ import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
8579
8578
  };
8580
8579
  return html2canvas;
8581
8580
  }); //# sourceMappingURL=html2canvas.js.map
8581
+ //# sourceMappingURL=html2canvas.test.js.map
@@ -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;
@@ -6,7 +6,6 @@ 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";
10
9
  import cssStyle from "./index.module.less";
11
10
  import cssStyleOnline from "./index2.module.less";
12
11
  var styles = cssStyle;
@@ -22,7 +21,7 @@ import TeacherList from "./teacherList";
22
21
  import { parseDate } from "../utils/Date";
23
22
  import { Remarkable } from "remarkable";
24
23
  import hljs from "highlight.js";
25
- import "highlight.js/styles/default.css";
24
+ import "highlight.js/styles/github.css";
26
25
  import { render } from "react-dom";
27
26
  import Provider from "../provider";
28
27
  var TextArea = Input.TextArea;
@@ -30,6 +29,9 @@ var TextArea = Input.TextArea;
30
29
  import knowledge_icon from "./images/knowledge_icon.png";
31
30
  // import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
32
31
  import { readMessage, getByteLen, serverUrl, copyText, getDataTime, getQuery, resetStyles, findParent, delegate } from "./function"; //一些方法
32
+ // import html2canvas from "html2canvas";
33
+ // const screenShot = require('./screenShotPlugin.esm')
34
+ import ScreenShot from "./screenShotPlugin.esm.js";
33
35
  var CustomerService = function(props) {
34
36
  var userData = props.userData, http = props.http, urllocation = props.urllocation, onCancel = props.onCancel, serverName = props.serverName, fetchEventSource = props.fetchEventSource, initShowType = props.initShowType, onEvent = props.onEvent, stepIds = props.stepIds, stepId = props.stepId, screenshotAreaId = props.screenshotAreaId, config = props.config;
35
37
  // const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
@@ -98,6 +100,8 @@ var CustomerService = function(props) {
98
100
  return ""; // use external default escaping
99
101
  }
100
102
  });
103
+ var _useState33 //1是 screenShotPlugin 2是html2canvas
104
+ = _sliced_to_array(useState(0), 2), screenShotType = _useState33[0], setScreenShotType = _useState33[1];
101
105
  useEffect(function() {
102
106
  // if(config && config.type == 'video'){
103
107
  // //获取热门推荐
@@ -108,6 +112,120 @@ var CustomerService = function(props) {
108
112
  initShowType
109
113
  ]);
110
114
  useEffect(function() {
115
+ var handlerHtml2canvas = function handlerHtml2canvas() {
116
+ console.log("kkkkkkkkkkk");
117
+ try {
118
+ newShowType.current = true;
119
+ setImgBese64("");
120
+ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
121
+ setScreenShotType(1);
122
+ console.log("看看变了没有1213133");
123
+ console.log("截图方式:【screenShotPlugin】", ScreenShot);
124
+ var plugin = new ScreenShot({
125
+ clickCutFullScreen: true,
126
+ enableWebRtc: true,
127
+ loadCrossImg: true,
128
+ canvasWidth: window.innerWidth,
129
+ canvasHeight: window.innerHeight,
130
+ level: -1,
131
+ hiddenToolIco: true,
132
+ screenShotDom: document.body,
133
+ cropBoxInfo: {
134
+ x: 0,
135
+ y: 0,
136
+ w: window.innerWidth,
137
+ h: window.innerHeight
138
+ },
139
+ wrcReplyTime: 500,
140
+ wrcWindowMode: true,
141
+ curTabState: false,
142
+ hiddenScrollBar: {
143
+ state: true
144
+ },
145
+ completeCallback: function(param) {
146
+ var base64 = param.base64;
147
+ // console.log(
148
+ // "截图组件加载完毕调用此方法来完成框选区域的截图",
149
+ // base64
150
+ // );
151
+ setImgBese64(base64);
152
+ },
153
+ triggerCallback: function() {
154
+ // 截图组件加载完毕调用此方法来完成框选区域的截图
155
+ plugin.completeScreenshot();
156
+ },
157
+ cancelCallback: function(err) {
158
+ if (err.code === -1) {
159
+ console.log(err);
160
+ newShowType.current = false;
161
+ if (saveShowType != -1) {
162
+ setShowType(saveShowType);
163
+ } else {
164
+ setShowType(1);
165
+ }
166
+ setShowScreenshot(false);
167
+ onCancel();
168
+ }
169
+ }
170
+ });
171
+ } else {
172
+ setScreenShotType(2);
173
+ console.log("截图方式:【html2canvas】");
174
+ html2canvas(screenshotAreaId, {
175
+ useCORS: true,
176
+ allowTaint: true,
177
+ scale: 1,
178
+ logging: false,
179
+ // foreignObjectRendering:true,
180
+ ignoreElements: function(element) {
181
+ if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
182
+ return false;
183
+ },
184
+ windowWidth: window.innerWidth,
185
+ windowHeight: window.innerHeight
186
+ }).then(function(canvas) {
187
+ // document.body.appendChild(canvas);
188
+ // console.log(canvas,99999);
189
+ // var base64URL = canvas.toDataURL('image/jpeg')
190
+ var base64URL = canvas.toDataURL("image/jpg", 1.0);
191
+ // console.log(base64URL);
192
+ setImgBese64(base64URL);
193
+ // svgNodesToRemove.forEach(item=>{
194
+ // item.remove()
195
+ // })
196
+ });
197
+ }
198
+ // modernScreenshot
199
+ // .domToPng(document.querySelector("body"))
200
+ // .then((dataUrl:any) => {
201
+ // console.log(dataUrl);
202
+ // setImgBese64(dataUrl);
203
+ // });
204
+ // domtoimage
205
+ // .toPng(document.body)
206
+ // .then(function (dataUrl:any) {
207
+ // setImgBese64(dataUrl);
208
+ // })
209
+ // .catch(function (error:any) {
210
+ // console.error("oops, something went wrong!", error);
211
+ // });
212
+ // //排除
213
+ // new screenShotPlugin({
214
+ // enableWebRtc: true,
215
+ // canvasWidth:window.innerWidth,
216
+ // canvasHeight:window.innerHeight,
217
+ // level:9999999,
218
+ // completeCallback: function (info:any) {
219
+ // console.log(info);
220
+ // setImgBese64(info.base64);
221
+ // },
222
+ // closeCallback: function () {
223
+ // },
224
+ // });
225
+ } catch (error) {
226
+ console.log(error);
227
+ }
228
+ };
111
229
  var handleScroll = function handleScroll() {
112
230
  var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
113
231
  var scrollTop = container.scrollTop;
@@ -156,30 +274,9 @@ var CustomerService = function(props) {
156
274
  };
157
275
  //|| showScreenshot
158
276
  if (showType == 5 || showScreenshot) {
159
- try {
160
- newShowType.current = true;
161
- setImgBese64("");
162
- // let dom = document.getElementById(screenshotAreaId);
163
- html2canvas(screenshotAreaId, {
164
- useCORS: true,
165
- // allowTaint: true, // 污染处理
166
- scale: 1,
167
- // logging:true,
168
- ignoreElements: function(element) {
169
- if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
170
- return false;
171
- }
172
- }).then(function(canvas) {
173
- // document.body.appendChild(canvas);
174
- console.log(canvas, 99999);
175
- // var base64URL = canvas.toDataURL('image/jpeg')
176
- var base64URL = canvas.toDataURL("image/jpg", 1.0);
177
- console.log(base64URL);
178
- setImgBese64(base64URL);
179
- });
180
- } catch (error) {
181
- console.log(error);
182
- }
277
+ console.log("bbbbbbbbbbbbbb");
278
+ handlerHtml2canvas();
279
+ // window.addEventListener('resize',handlerHtml2canvas)
183
280
  }
184
281
  if (showType != 1 && !firstLoad && pageCount > 0) {
185
282
  setFirstLoad(true);
@@ -194,6 +291,7 @@ var CustomerService = function(props) {
194
291
  if (content) {
195
292
  content.removeEventListener("scroll", handleScroll);
196
293
  }
294
+ window.removeEventListener("resize", handlerHtml2canvas);
197
295
  };
198
296
  }, [
199
297
  historyMessageList,
@@ -1722,11 +1820,18 @@ var CustomerService = function(props) {
1722
1820
  /*#__PURE__*/ _jsxs("div", {
1723
1821
  className: styles.operate,
1724
1822
  children: [
1725
- /*#__PURE__*/ _jsx("i", {
1823
+ /*#__PURE__*/ _jsxs("i", {
1824
+ className: styles.popover_main,
1726
1825
  onClick: function() {
1727
1826
  setShowHistory(true);
1728
1827
  },
1729
- children: /*#__PURE__*/ _jsx(CustomRecord, {})
1828
+ children: [
1829
+ /*#__PURE__*/ _jsx(CustomRecord, {}),
1830
+ /*#__PURE__*/ _jsx("span", {
1831
+ className: styles.popover,
1832
+ children: "历史记录"
1833
+ })
1834
+ ]
1730
1835
  }),
1731
1836
  /*#__PURE__*/ _jsx("span", {
1732
1837
  className: styles.line
@@ -1746,20 +1851,14 @@ var CustomerService = function(props) {
1746
1851
  })
1747
1852
  ]
1748
1853
  }),
1749
- /*#__PURE__*/ _jsxs("i", {
1854
+ /*#__PURE__*/ _jsx("i", {
1750
1855
  className: styles.popover_main,
1751
1856
  onClick: function() {
1752
1857
  onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
1753
1858
  setShowType(3);
1754
1859
  setFirstLoad(false); //重启滚动条在最上方
1755
1860
  },
1756
- children: [
1757
- /*#__PURE__*/ _jsx(CloseOutlined, {}),
1758
- /*#__PURE__*/ _jsx("span", {
1759
- className: styles.popover,
1760
- children: "退出全屏"
1761
- })
1762
- ]
1861
+ children: /*#__PURE__*/ _jsx(CloseOutlined, {})
1763
1862
  })
1764
1863
  ]
1765
1864
  })
@@ -3450,6 +3549,9 @@ var CustomerService = function(props) {
3450
3549
  }),
3451
3550
  (showType == 4 || showType == 5) && /*#__PURE__*/ _jsxs("div", {
3452
3551
  className: "".concat(styles.ChatWindow_Drawer),
3552
+ style: {
3553
+ display: "".concat(!showScreenshot ? "none" : "flex")
3554
+ },
3453
3555
  id: "",
3454
3556
  children: [
3455
3557
  /*#__PURE__*/ _jsx("div", {
@@ -3549,6 +3651,7 @@ var CustomerService = function(props) {
3549
3651
  }),
3550
3652
  (showType == 5 || showScreenshot) && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
3551
3653
  imgBese64: imgBese64,
3654
+ screenShotType: screenShotType,
3552
3655
  saveScreenshotBese64: function(base64) {
3553
3656
  newShowType.current = false;
3554
3657
  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
  }