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
  }
@@ -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,6 @@ 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";
24
22
  import "highlight.js/styles/github.css";
25
23
  import { render } from "react-dom";
26
24
  import Provider from "../provider";
@@ -29,6 +27,9 @@ const { TextArea } = Input;
29
27
  import knowledge_icon from "./images/knowledge_icon.png";
30
28
  // import { useMediaRecorder } from "./useMediaRecorder"; //录音使用文件
31
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";
32
33
  const CustomerService = (props)=>{
33
34
  let { userData , http , urllocation , onCancel , serverName , fetchEventSource , initShowType , onEvent , stepIds , stepId , screenshotAreaId , config } = props;
34
35
  // const { bese64String, startRecord, stopRecord } = useMediaRecorder(); //语音转文字
@@ -97,6 +98,8 @@ const CustomerService = (props)=>{
97
98
  return ""; // use external default escaping
98
99
  }
99
100
  });
101
+ const [screenShotType, setScreenShotType] = useState(0) //1是 screenShotPlugin 2是html2canvas
102
+ ;
100
103
  useEffect(()=>{
101
104
  // if(config && config.type == 'video'){
102
105
  // //获取热门推荐
@@ -107,33 +110,125 @@ const CustomerService = (props)=>{
107
110
  initShowType
108
111
  ]);
109
112
  useEffect(()=>{
110
- //|| showScreenshot
111
- if (showType == 5 || showScreenshot) {
113
+ function handlerHtml2canvas() {
114
+ console.log('kkkkkkkkkkk');
112
115
  try {
113
116
  newShowType.current = true;
114
117
  setImgBese64('');
115
- // let dom = document.getElementById(screenshotAreaId);
116
- html2canvas(screenshotAreaId, {
117
- useCORS: true,
118
- // allowTaint: true, // 污染处理
119
- scale: 1,
120
- // logging:true,
121
- ignoreElements: (element)=>{
122
- if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
123
- return false;
124
- }
125
- }).then(function(canvas) {
126
- // document.body.appendChild(canvas);
127
- console.log(canvas, 99999);
128
- // var base64URL = canvas.toDataURL('image/jpeg')
129
- let base64URL = canvas.toDataURL("image/jpg", 1.0);
130
- console.log(base64URL);
131
- setImgBese64(base64URL);
132
- });
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
+ // });
133
222
  } catch (error) {
134
223
  console.log(error);
135
224
  }
136
225
  }
226
+ //|| showScreenshot
227
+ if (showType == 5 || showScreenshot) {
228
+ console.log('bbbbbbbbbbbbbb');
229
+ handlerHtml2canvas();
230
+ // window.addEventListener('resize',handlerHtml2canvas)
231
+ }
137
232
  if (showType != 1 && !firstLoad && pageCount > 0) {
138
233
  setFirstLoad(true);
139
234
  scrollToBottom();
@@ -193,7 +288,7 @@ const CustomerService = (props)=>{
193
288
  if (content) {
194
289
  content.removeEventListener("scroll", handleScroll);
195
290
  }
196
- // window.removeEventListener('resize',handlerHtml2canvas)
291
+ window.removeEventListener('resize', handlerHtml2canvas);
197
292
  };
198
293
  }, [
199
294
  historyMessageList,
@@ -3388,6 +3483,9 @@ const CustomerService = (props)=>{
3388
3483
  }),
3389
3484
  (showType == 4 || showType == 5) && /*#__PURE__*/ _jsxs("div", {
3390
3485
  className: `${styles.ChatWindow_Drawer}`,
3486
+ style: {
3487
+ display: `${!showScreenshot ? "none" : "flex"}`
3488
+ },
3391
3489
  id: "",
3392
3490
  children: [
3393
3491
  /*#__PURE__*/ _jsx("div", {
@@ -3487,6 +3585,7 @@ const CustomerService = (props)=>{
3487
3585
  }),
3488
3586
  (showType == 5 || showScreenshot) && imgBese64 && /*#__PURE__*/ _jsx(ScreenshotTool, {
3489
3587
  imgBese64: imgBese64,
3588
+ screenShotType: screenShotType,
3490
3589
  saveScreenshotBese64: (base64)=>{
3491
3590
  newShowType.current = false;
3492
3591
  setScreenshotBese64(base64);