bhd-components 0.6.4 → 0.6.6

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 (36) hide show
  1. package/README.md +1 -1
  2. package/dist/{9674e68c.esm.es5.development.js → 869a16fb.esm.es5.development.js} +1402 -1140
  3. package/dist/{a57a24b2.esm.es5.production.js → c220442c.esm.es5.production.js} +1 -1
  4. package/dist/index.esm.es5.development.css +888 -753
  5. package/dist/index.esm.es5.development.js +786 -686
  6. package/dist/index.esm.es5.production.css +1 -1
  7. package/dist/index.esm.es5.production.js +1 -1
  8. package/es2017/bhdSelect/index.d.ts +3 -0
  9. package/es2017/bhdSelect/index.js +30 -14
  10. package/es2017/bhdSelect/index.module.less +4 -5
  11. package/es2017/customerService/contactsList.d.ts +1 -1
  12. package/es2017/customerService/contactsList.js +11 -145
  13. package/es2017/customerService/function.js +1 -1
  14. package/es2017/customerService/historyFun.js +325 -154
  15. package/es2017/customerService/index.js +412 -341
  16. package/es2017/customerService/index.module.less +169 -65
  17. package/es2017/customerService/index2.module.less +170 -65
  18. package/es2017/icons/components/custom-expand.d.ts +4 -0
  19. package/es2017/icons/components/custom-expand.js +22 -0
  20. package/es2017/icons/components/index.d.ts +1 -0
  21. package/es2017/icons/components/index.js +1 -0
  22. package/esm/bhdSelect/index.d.ts +3 -0
  23. package/esm/bhdSelect/index.js +30 -14
  24. package/esm/bhdSelect/index.module.less +4 -5
  25. package/esm/customerService/contactsList.d.ts +1 -1
  26. package/esm/customerService/contactsList.js +11 -158
  27. package/esm/customerService/function.js +1 -1
  28. package/esm/customerService/historyFun.js +329 -167
  29. package/esm/customerService/index.js +397 -348
  30. package/esm/customerService/index.module.less +169 -65
  31. package/esm/customerService/index2.module.less +170 -65
  32. package/esm/icons/components/custom-expand.d.ts +4 -0
  33. package/esm/icons/components/custom-expand.js +24 -0
  34. package/esm/icons/components/index.d.ts +1 -0
  35. package/esm/icons/components/index.js +1 -0
  36. package/package.json +1 -1
@@ -22,6 +22,9 @@ interface BhdSelectProps extends SelectProps {
22
22
  useType?: string;
23
23
  listHeight?: number;
24
24
  popupMatchSelectWidth?: number;
25
+ dropdownStyle?: {
26
+ width: number;
27
+ };
25
28
  }
26
29
  declare const BhdSelect: {
27
30
  (props: BhdSelectProps): React.JSX.Element;
@@ -26,7 +26,7 @@ const BhdSelect = (props)=>{
26
26
  const [optionHei, setOptionHei] = useState(0); //option的宽度
27
27
  const [filterValue, setFilterValue] = useState(""); //下拉搜索的内容
28
28
  const [filterChildren, setfilterChildren] = useState([]);
29
- // const [selectWidth,setSelectWidth] = useState(0);//下拉框的宽度
29
+ const [selectWidth, setSelectWidth] = useState(0); //下拉框的宽度
30
30
  const renderSuffixIcon = ()=>{
31
31
  switch(arrowType){
32
32
  case "table":
@@ -197,11 +197,11 @@ const BhdSelect = (props)=>{
197
197
  };
198
198
  useEffect(()=>{
199
199
  // console.log(34343434,props);
200
- // if(props.popupMatchSelectWidth){
201
- // setSelectWidth(props.popupMatchSelectWidth);
202
- // }else{
203
- // // console.log(bhdSelectRef.current.getBoundingClientRect(),555555555);
204
- // }
200
+ if (props.popupMatchSelectWidth) {
201
+ setSelectWidth(props.popupMatchSelectWidth);
202
+ } else {
203
+ // console.log(bhdSelectRef.current.getBoundingClientRect(),555555555);
204
+ }
205
205
  filterOption();
206
206
  window.addEventListener("resize", initHeight);
207
207
  return ()=>{
@@ -217,7 +217,11 @@ const BhdSelect = (props)=>{
217
217
  let config = _object_spread_props(_object_spread({}, props), {
218
218
  listHeight: optionHei,
219
219
  popupClassName: `${styles.bhdSelect_option} ${popupClassName || ""} `,
220
- suffixIcon: suffixIcon ? suffixIcon : renderSuffixIcon()
220
+ suffixIcon: suffixIcon ? suffixIcon : renderSuffixIcon(),
221
+ popupMatchSelectWidth: selectWidth,
222
+ dropdownStyle: _object_spread_props(_object_spread({}, props.dropdownStyle), {
223
+ width: selectWidth
224
+ })
221
225
  });
222
226
  delete config.mask;
223
227
  delete config.className;
@@ -261,13 +265,25 @@ const BhdSelect = (props)=>{
261
265
  }
262
266
  }
263
267
  //表格中使用下拉列表,定义下拉列表宽度
264
- // console.log(props.dropdownStyle,'sdsddfdfdf');
265
- // if(props.dropdownStyle != undefined && props.dropdownStyle.width != undefined){
266
- // setSelectWidth(props.dropdownStyle.width)
267
- // }else if( (props.dropdownStyle == undefined || props.dropdownStyle.width == undefined) && useType === 'table'){
268
- // console.log(bhdSelectRef.current.parentNode.getBoundingClientRect().width-4,33333);
269
- // setSelectWidth(bhdSelectRef.current.parentNode.getBoundingClientRect().width-4)
270
- // }
268
+ //表格中使用下拉列表,定义下拉列表宽度
269
+ if (props.dropdownStyle != undefined && props.dropdownStyle.width != undefined) {
270
+ setSelectWidth(props.dropdownStyle.width);
271
+ } else if (useType === "table") {
272
+ try {
273
+ let width = bhdSelectRef.current.parentNode.getBoundingClientRect().width + 14;
274
+ let minWidth = props.popupMatchSelectWidth;
275
+ //设置了最小宽度
276
+ if (minWidth != undefined && minWidth >= width) {
277
+ setSelectWidth(minWidth);
278
+ } else if (minWidth != undefined && minWidth < width) {
279
+ setSelectWidth(width);
280
+ } else if (minWidth == undefined && width < 60) {
281
+ setSelectWidth(60);
282
+ } else {
283
+ setSelectWidth(width);
284
+ }
285
+ } catch (error) {}
286
+ }
271
287
  props.onMouseEnter && props.onMouseEnter(e);
272
288
  },
273
289
  children: filterChildren
@@ -105,14 +105,13 @@
105
105
  width: 14px;
106
106
  .bhd-btn {
107
107
  border: none;
108
- // height: 16px;
109
- height: 10px;
108
+ height: 16px;
110
109
  line-height: 16px;
111
110
  width: 14px;
112
111
  }
113
- // .bhd-btn-default{
114
- // box-shadow: none !important;
115
- // }
112
+ .bhd-btn-default{
113
+ box-shadow: none !important;
114
+ }
116
115
  }
117
116
 
118
117
  }
@@ -7,7 +7,7 @@ interface data {
7
7
  urllocation: String;
8
8
  onClose: any;
9
9
  switchChatRoom: any;
10
- saveContactsList: any;
10
+ contactsList: any;
11
11
  ref: any;
12
12
  }
13
13
  declare const ContactsList: import("react").ForwardRefExoticComponent<Omit<data, "ref"> & import("react").RefAttributes<unknown>>;
@@ -1,116 +1,24 @@
1
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
- import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
1
  import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
4
- import React, { useEffect, useState, useRef, useImperativeHandle, forwardRef } from "react";
2
+ import React, { forwardRef } from "react";
5
3
  import styles from "./index.module.less";
6
4
  import { Tooltip } from "antd";
7
5
  import { CustomAiIcon, CustomRetract } from "../icons/index";
8
6
  import { CloseOutlined } from "@ant-design/icons";
9
7
  import { getDataTime, getByteLen } from "./function"; //录音使用文件
10
8
  const ContactsList = /*#__PURE__*/ forwardRef((props, ref)=>{
11
- let { type , roomId , userData , http , urllocation , onClose , switchChatRoom , saveContactsList } = props;
12
- const [contactsList, setContactsList] = useState([]); //老师列表
13
- let timer = useRef(null); //文本框输入时
14
- //获取聊天室列表
15
- useEffect(()=>{
16
- roomsListTimer();
17
- return ()=>{
18
- clearTimeout(timer.current);
19
- };
20
- }, []);
21
- // //获取聊天室列表
22
- // useEffect(() => {
23
- // roomsListTimer();
24
- // }, [contactsList]);
25
- useImperativeHandle(ref, ()=>({
26
- roomsListTimer: ()=>{
27
- return roomsListTimer();
28
- }
29
- }));
30
- const roomsListTimer = ()=>{
31
- if (timer != null) clearTimeout(timer.current);
32
- timer.current = setTimeout(()=>roomsListTimer(), 60000);
33
- http.get(`${urllocation}/chat-service/public/v1.0/rooms`, {
34
- params: {
35
- page: 1,
36
- maxPageSize: 100002
37
- },
38
- headers: {
39
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
40
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
41
- }
42
- }).then((res)=>{
43
- if (res.data) {
44
- let list = res.data.contacts;
45
- setContactsList((contactsList)=>{
46
- list = list.map((item, index)=>{
47
- let c_list = contactsList.filter((e)=>e.sender == item.sender);
48
- let obj = {};
49
- if (c_list.length > 0) {
50
- obj = c_list[0];
51
- }
52
- return _object_spread({}, obj, item);
53
- });
54
- return list;
55
- });
56
- getUserInfo(list);
57
- saveContactsList(list);
58
- }
59
- });
60
- };
9
+ let { type , roomId , userData , http , urllocation , onClose , switchChatRoom , contactsList } = props;
10
+ // useImperativeHandle(ref, () => ({
11
+ // roomsListTimer: () => {
12
+ // return roomsListTimer();
13
+ // },
14
+ // roomsList:contactsList,
15
+ // }),[contactsList]);
61
16
  //删除聊天室
62
17
  const deleteRoom = (roomId)=>{
63
- let contactsList;
64
- setContactsList((list)=>{
65
- contactsList = list.filter((e)=>e.roomId != roomId);
66
- //切换到AI聊天窗口
67
- if (roomId == props.roomId) {
68
- switchChatRoom(contactsList[0].roomId, "");
69
- }
70
- saveContactsList(contactsList);
71
- return contactsList;
72
- });
73
18
  http.delete(`${urllocation}/chat-service/public/v1.0/rooms/${roomId}`, {
74
- headers: {
75
- "x-module-id": userData.modules.find((ele)=>ele.short == "IntelligentCustomerService").id,
76
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
77
- }
78
19
  }).then((res)=>{
79
- roomsListTimer();
80
- });
81
- };
82
- //获取老师的信息等
83
- const getUserInfo = (list)=>{
84
- list.map((item, i)=>{
85
- if (!item.name && !item.headImg && item.sender != "AI") {
86
- getUserName(item.sender).then((res)=>{
87
- if (res.data) {
88
- let list;
89
- setContactsList((contactsList)=>{
90
- list = contactsList.map((item, index)=>{
91
- if (item.sender == res.data.uid) {
92
- return _object_spread({}, item, res.data);
93
- } else {
94
- return item;
95
- }
96
- });
97
- return list;
98
- });
99
- saveContactsList(list);
100
- }
101
- });
102
- }
103
- });
104
- };
105
- const getUserName = (uid)=>{
106
- return http.get(`${urllocation}/chat-service/public/v1.0/userinfo`, {
107
- params: {
108
- uid: uid
109
- },
110
- headers: {
111
- "x-module-id": userData.modules.find((ele)=>ele.short == "TeacherAnswer").id,
112
- "x-auth-jwt": window.localStorage.getItem("usertoken") || ""
113
- }
20
+ // roomsListTimer();
21
+ switchChatRoom(roomId, '1');
114
22
  });
115
23
  };
116
24
  return type == 2 || type == 4 ? //联系人展开
@@ -121,10 +29,7 @@ const ContactsList = /*#__PURE__*/ forwardRef((props, ref)=>{
121
29
  className: styles.top,
122
30
  children: /*#__PURE__*/ _jsxs("div", {
123
31
  className: `${styles.ai} ${contactsList.length > 0 && contactsList[0].roomId != undefined && roomId != "" && contactsList[0].roomId == roomId || contactsList.length == 0 ? styles.active : ""}`,
124
- onClick: ()=>{
125
- switchChatRoom(contactsList[0].roomId, "");
126
- // roomsListTimer();
127
- },
32
+ onClick: ()=>switchChatRoom(contactsList[0].roomId, ""),
128
33
  children: [
129
34
  /*#__PURE__*/ _jsx(CustomAiIcon, {}),
130
35
  /*#__PURE__*/ _jsxs("div", {
@@ -165,25 +70,6 @@ const ContactsList = /*#__PURE__*/ forwardRef((props, ref)=>{
165
70
  className: `${styles.ai} ${item.roomId != undefined && roomId != "" && item.roomId == roomId ? styles.active : ""}`,
166
71
  onClick: ()=>{
167
72
  switchChatRoom(item.roomId, "");
168
- // roomsListTimer();
169
- let newList = [];
170
- setContactsList((list)=>{
171
- newList = list;
172
- newList = newList.map((v)=>{
173
- if (v.roomId == item.roomId) {
174
- return _object_spread_props(_object_spread({}, v), {
175
- unreadCount: 0
176
- });
177
- } else {
178
- return v;
179
- }
180
- });
181
- return newList;
182
- });
183
- // console.log(newList,9999999999)
184
- setTimeout(()=>{
185
- saveContactsList(newList);
186
- }, 100);
187
73
  },
188
74
  children: [
189
75
  /*#__PURE__*/ _jsx("img", {
@@ -272,26 +158,6 @@ const ContactsList = /*#__PURE__*/ forwardRef((props, ref)=>{
272
158
  className: `${styles.ai} ${item.roomId != undefined && roomId != "" && item.roomId == roomId ? styles.active : ""}`,
273
159
  onClick: ()=>{
274
160
  switchChatRoom(item.roomId, "");
275
- // roomsListTimer();
276
- //消息更改为已读
277
- let newList = [];
278
- setContactsList((list)=>{
279
- newList = list;
280
- newList = newList.map((v)=>{
281
- if (v.roomId == item.roomId) {
282
- return _object_spread_props(_object_spread({}, v), {
283
- unreadCount: 0
284
- });
285
- } else {
286
- return v;
287
- }
288
- });
289
- return newList;
290
- });
291
- // console.log(newList,9999999999)
292
- setTimeout(()=>{
293
- saveContactsList(newList);
294
- }, 100);
295
161
  },
296
162
  children: [
297
163
  /*#__PURE__*/ _jsx("img", {
@@ -65,7 +65,7 @@ const getDataTime = (time, type = -1)=>{
65
65
  const hours = String(now.getHours()).padStart(2, "0");
66
66
  const minutes = String(now.getMinutes()).padStart(2, "0");
67
67
  const seconds = String(now.getSeconds()).padStart(2, "0");
68
- const currentDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
68
+ const currentDateTime = `${year}-${month}-${day} ${hours}:${minutes}`;
69
69
  if (type == 1) {
70
70
  return `${year}-${month}-${day}`;
71
71
  } else if (type == 2) {