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.
@@ -3,35 +3,58 @@
3
3
  .bhdDatePicker {
4
4
  width: 100%;
5
5
 
6
- .pickerLabel {
7
- display: flex;
8
- gap: 5px;
9
- }
10
6
  :global {
11
7
  .bhd-picker {
12
- &.hide {
13
- position: absolute;
8
+ // table 模式下显示样式
9
+ &.table-date-picker {
10
+ * {
11
+ background: transparent;
12
+ border: none;
13
+ }
14
+ position: relative;
14
15
  top: 0;
15
16
  left: 0;
16
- // z-index: -1;
17
- opacity: 0;
18
- // width: 0;
19
- // padding: 0;
20
- // height: 0;
21
- // border: none;
22
- // & * {
23
- // display: none !important;
24
- // }
25
- // .bhd-picker-range-separator {
26
- // display: none !important;
27
- // }
17
+ border: none;
18
+ box-shadow: none;
19
+ background: transparent;
20
+ padding: 0;
21
+ margin-left: -78px;
22
+ cursor: pointer;
23
+ .bhd-picker-input {
24
+ &:nth-child(1) {
25
+ width: 78px;
26
+ opacity: 0;
27
+ & > input {
28
+ cursor: pointer;
29
+ &::placeholder {
30
+ display: none !important;
31
+ opacity: 0;
32
+ }
33
+ }
34
+ }
35
+ &:nth-child(3) {
36
+ display: none;
37
+ }
38
+ }
39
+ .bhd-picker-range-separator {
40
+ display: none;
41
+ }
42
+ .bhd-picker-active-bar {
43
+ display: none;
44
+ }
45
+ .bhd-picker-suffix {
46
+ color: @color-text-Tr;
47
+ }
48
+ .bhd-picker-clear {
49
+ display: none;
50
+ }
28
51
  }
29
52
  }
30
53
  }
31
54
  }
32
- // 额外的弹出日历样式
55
+ // 弹出日历样式
33
56
  .bhdDatePickerPopup {
34
- // 单选、范围、带额外文字
57
+ // 单选、范围、日程安排
35
58
  &.singlePicker,
36
59
  &.rangePicker,
37
60
  &.extraPicker {
@@ -103,6 +126,22 @@
103
126
  line-height: 32px;
104
127
  }
105
128
  }
129
+
130
+ & .bhd-picker-body {
131
+ position: relative;
132
+
133
+ // 设置标题背景色
134
+ &::before {
135
+ content: "";
136
+ width: 100%;
137
+ height: 32px;
138
+ border-radius: 4px;
139
+ position: absolute;
140
+ top: 0;
141
+ left: 0;
142
+ background-color: @color-background-filltertiary-Tr;
143
+ }
144
+ }
106
145
  }
107
146
 
108
147
  //周
@@ -245,6 +284,7 @@
245
284
  line-height: 30px;
246
285
  height: 30px;
247
286
  gap: 10px;
287
+ align-items: center;
248
288
 
249
289
  & .bhd-picker-now {
250
290
  color: @color-background-primary-base;
@@ -292,6 +332,9 @@
292
332
  height: 30px;
293
333
  padding: 0 16px;
294
334
  // line-height: 30px;
335
+ border: none;
336
+ box-shadow: none;
337
+ line-height: 21px;
295
338
 
296
339
  &:disabled,
297
340
  &.disabled {
@@ -313,10 +356,19 @@
313
356
  // }
314
357
  }
315
358
 
359
+ // 默认
360
+ .bhd-picker-cell-in-view {
361
+ color: @color-text-Secondary-Tr;
362
+ }
363
+
316
364
  .bhd-picker-cell-disabled.bhd-picker-cell-today
317
365
  .bhd-picker-cell-inner::before {
318
366
  border-color: @color-background-primary-base !important;
319
367
  }
368
+ // 禁用
369
+ .bhd-picker-cell-disabled {
370
+ color: @color-text-quaternary-Tr !important;
371
+ }
320
372
  }
321
373
  }
322
374
 
@@ -475,7 +527,7 @@
475
527
  }
476
528
  .bhd-picker-year-panel .bhd-picker-cell::before,
477
529
  .bhd-picker-year-panel .bhd-picker-cell::before {
478
- left: 8px;
530
+ left: 0;
479
531
  border-radius: 4px;
480
532
  }
481
533
 
@@ -535,7 +587,7 @@
535
587
  }
536
588
  }
537
589
 
538
- // 带有额外文字场景
590
+ // 日程安排
539
591
  &.extraPicker {
540
592
  :global {
541
593
  .extraText {
@@ -557,7 +609,7 @@
557
609
  }
558
610
  .bhd-picker-date-panel {
559
611
  width: 416px;
560
- padding: 24px 24px 16px 24px;
612
+ padding: 16px 24px 16px 24px;
561
613
  & .bhd-picker-content {
562
614
  width: 336px;
563
615
  margin: 0 auto;
@@ -669,6 +721,10 @@
669
721
  border: none !important;
670
722
  }
671
723
  }
724
+ .bhd-picker-cell-in-view {
725
+ pointer-events: none;
726
+ color: @color-text-Secondary-Tr;
727
+ }
672
728
  }
673
729
  }
674
730
  }
@@ -738,22 +794,9 @@
738
794
  .bhd-picker-date-panel,
739
795
  .bhd-picker-time-panel {
740
796
  padding: 16px;
741
- gap: 24px;
797
+ gap: 16px;
742
798
  & .bhd-picker-body {
743
799
  padding: 0 !important;
744
- position: relative;
745
-
746
- // 设置标题背景色
747
- &::before {
748
- content: "";
749
- width: 100%;
750
- height: 32px;
751
- border-radius: 4px;
752
- position: absolute;
753
- top: 0;
754
- left: 0;
755
- background-color: @color-background-filltertiary-Tr;
756
- }
757
800
  }
758
801
 
759
802
  // 设置头部圆角
@@ -769,6 +812,7 @@
769
812
  }
770
813
  }
771
814
  }
815
+
772
816
  // 头部
773
817
  .bhd-picker-header {
774
818
  padding: 0 !important;
@@ -813,11 +857,6 @@
813
857
  justify-content: center;
814
858
  }
815
859
 
816
- // 默认
817
- .bhd-picker-cell-in-view {
818
- color: @color-text-Secondary-Tr !important;
819
- }
820
-
821
860
  //当天
822
861
  .bhd-picker-cell-today {
823
862
  color: @color-background-primary-base !important;
@@ -843,9 +882,5 @@
843
882
  }
844
883
  }
845
884
  }
846
- // 禁用
847
- .bhd-picker-cell-disabled {
848
- color: rgba(0, 0, 0, 0.25) !important;
849
- }
850
885
  }
851
886
  }
@@ -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,6 @@ 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";
26
24
  import "highlight.js/styles/github.css";
27
25
  import { render } from "react-dom";
28
26
  import Provider from "../provider";
@@ -31,6 +29,9 @@ var TextArea = Input.TextArea;
31
29
  import knowledge_icon from "./images/knowledge_icon.png";
32
30
  // import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
33
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";
34
35
  var CustomerService = function(props) {
35
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;
36
37
  // const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
@@ -99,6 +100,8 @@ var CustomerService = function(props) {
99
100
  return ""; // use external default escaping
100
101
  }
101
102
  });
103
+ var _useState33 //1是 screenShotPlugin 2是html2canvas
104
+ = _sliced_to_array(useState(0), 2), screenShotType = _useState33[0], setScreenShotType = _useState33[1];
102
105
  useEffect(function() {
103
106
  // if(config && config.type == 'video'){
104
107
  // //获取热门推荐
@@ -109,6 +112,120 @@ var CustomerService = function(props) {
109
112
  initShowType
110
113
  ]);
111
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
+ };
112
229
  var handleScroll = function handleScroll() {
113
230
  var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
114
231
  var scrollTop = container.scrollTop;
@@ -157,30 +274,9 @@ var CustomerService = function(props) {
157
274
  };
158
275
  //|| showScreenshot
159
276
  if (showType == 5 || showScreenshot) {
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
- }
277
+ console.log("bbbbbbbbbbbbbb");
278
+ handlerHtml2canvas();
279
+ // window.addEventListener('resize',handlerHtml2canvas)
184
280
  }
185
281
  if (showType != 1 && !firstLoad && pageCount > 0) {
186
282
  setFirstLoad(true);
@@ -195,7 +291,7 @@ var CustomerService = function(props) {
195
291
  if (content) {
196
292
  content.removeEventListener("scroll", handleScroll);
197
293
  }
198
- // window.removeEventListener('resize',handlerHtml2canvas)
294
+ window.removeEventListener("resize", handlerHtml2canvas);
199
295
  };
200
296
  }, [
201
297
  historyMessageList,
@@ -3453,6 +3549,9 @@ var CustomerService = function(props) {
3453
3549
  }),
3454
3550
  (showType == 4 || showType == 5) && /*#__PURE__*/ _jsxs("div", {
3455
3551
  className: "".concat(styles.ChatWindow_Drawer),
3552
+ style: {
3553
+ display: "".concat(!showScreenshot ? "none" : "flex")
3554
+ },
3456
3555
  id: "",
3457
3556
  children: [
3458
3557
  /*#__PURE__*/ _jsx("div", {
@@ -3552,6 +3651,7 @@ var CustomerService = function(props) {
3552
3651
  }),
3553
3652
  (showType == 5 || showScreenshot) && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
3554
3653
  imgBese64: imgBese64,
3654
+ screenShotType: screenShotType,
3555
3655
  saveScreenshotBese64: function(base64) {
3556
3656
  newShowType.current = false;
3557
3657
  setScreenshotBese64(base64);