bhd-components 0.10.5 → 0.10.7
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.
- package/dist/index.esm.es5.development.css +1244 -1202
- package/dist/index.esm.es5.development.js +490 -256
- package/dist/index.esm.es5.production.css +2 -2
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +2 -2
- package/dist/vendor.esm.es5.production.js +2 -2
- package/es2017/AIMessageList/components/copyIcon/index.js +23 -8
- package/es2017/AIMessageList/components/copyIcon/index.module.less +2 -2
- package/es2017/AIMessageList/components/fileList/index.js +16 -3
- package/es2017/AIMessageList/components/footer/index.js +61 -42
- package/es2017/AIMessageList/components/header/index.js +4 -4
- package/es2017/AIMessageList/components/referencesIcon/index.js +19 -8
- package/es2017/AIMessageList/components/referencesIcon/index.module.less +1 -1
- package/es2017/AIMessageList/components/refreshBtn/index.d.ts +4 -0
- package/es2017/AIMessageList/components/refreshBtn/index.js +29 -0
- package/es2017/AIMessageList/components/refreshBtn/index.module.less +12 -0
- package/es2017/AIMessageList/components/remarkBtn/index.d.ts +4 -0
- package/es2017/AIMessageList/components/remarkBtn/index.js +51 -0
- package/es2017/AIMessageList/components/remarkBtn/index.module.less +13 -0
- package/es2017/AIMessageList/components/virtuosoList/index.js +109 -19
- package/es2017/AIMessageList/components/virtuosoList/index.module.less +10 -1
- package/es2017/AIMessageList/type.d.ts +45 -11
- package/es2017/customerService/historyFun.js +7 -1
- package/es2017/customerService/index.module.less +1 -0
- package/es2017/customerService/index2.module.less +1 -0
- package/esm/AIMessageList/components/copyIcon/index.js +23 -8
- package/esm/AIMessageList/components/copyIcon/index.module.less +2 -2
- package/esm/AIMessageList/components/fileList/index.js +12 -3
- package/esm/AIMessageList/components/footer/index.js +65 -44
- package/esm/AIMessageList/components/header/index.js +4 -4
- package/esm/AIMessageList/components/referencesIcon/index.js +19 -8
- package/esm/AIMessageList/components/referencesIcon/index.module.less +1 -1
- package/esm/AIMessageList/components/refreshBtn/index.d.ts +4 -0
- package/esm/AIMessageList/components/refreshBtn/index.js +31 -0
- package/esm/AIMessageList/components/refreshBtn/index.module.less +12 -0
- package/esm/AIMessageList/components/remarkBtn/index.d.ts +4 -0
- package/esm/AIMessageList/components/remarkBtn/index.js +51 -0
- package/esm/AIMessageList/components/remarkBtn/index.module.less +13 -0
- package/esm/AIMessageList/components/virtuosoList/index.js +111 -19
- package/esm/AIMessageList/components/virtuosoList/index.module.less +10 -1
- package/esm/AIMessageList/type.d.ts +45 -11
- package/esm/customerService/historyFun.js +7 -1
- package/esm/customerService/index.module.less +1 -0
- package/esm/customerService/index2.module.less +1 -0
- package/package.json +1 -1
|
@@ -29,11 +29,11 @@ var defaultProps = {
|
|
|
29
29
|
gradientUnits: "userSpaceOnUse",
|
|
30
30
|
children: [
|
|
31
31
|
/*#__PURE__*/ _jsx("stop", {
|
|
32
|
-
|
|
32
|
+
stopColor: "#F87AFD"
|
|
33
33
|
}),
|
|
34
34
|
/*#__PURE__*/ _jsx("stop", {
|
|
35
35
|
offset: "1",
|
|
36
|
-
|
|
36
|
+
stopColor: "#41DAF8"
|
|
37
37
|
})
|
|
38
38
|
]
|
|
39
39
|
}),
|
|
@@ -46,11 +46,11 @@ var defaultProps = {
|
|
|
46
46
|
gradientUnits: "userSpaceOnUse",
|
|
47
47
|
children: [
|
|
48
48
|
/*#__PURE__*/ _jsx("stop", {
|
|
49
|
-
|
|
49
|
+
stopColor: "#F87AFD"
|
|
50
50
|
}),
|
|
51
51
|
/*#__PURE__*/ _jsx("stop", {
|
|
52
52
|
offset: "1",
|
|
53
|
-
|
|
53
|
+
stopColor: "#41DAF8"
|
|
54
54
|
})
|
|
55
55
|
]
|
|
56
56
|
})
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import styles from "./index.module.less";
|
|
4
4
|
var referencesIcon = /*#__PURE__*/ _jsx("i", {
|
|
5
|
-
children: /*#__PURE__*/
|
|
6
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
7
6
|
width: "1em",
|
|
8
7
|
height: "1em",
|
|
9
|
-
|
|
8
|
+
shapeRendering: "geometricPrecision",
|
|
10
9
|
fill: "currentColor",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
viewBox: "0 0 14 14",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ _jsx("path", {
|
|
14
|
+
"fill-rule": "evenodd",
|
|
15
|
+
"clip-rule": "evenodd",
|
|
16
|
+
d: "M6.28443 3.03861C3.77423 4.65069 2.37971 6.52702 2.10085 8.66759C1.66674 12 4.6468 13.6311 6.15677 12.1655C7.66673 10.7 6.7616 8.83982 5.66823 8.33136C4.57487 7.82286 3.90623 7.99996 4.02287 7.32046C4.1395 6.64099 5.69503 4.75706 7.06163 3.87969C7.1523 3.80259 7.1868 3.65299 7.0995 3.53949C7.04207 3.46486 6.92943 3.31847 6.7616 3.10033C6.61483 2.90957 6.47423 2.91671 6.28443 3.03861Z"
|
|
17
|
+
}),
|
|
18
|
+
/*#__PURE__*/ _jsx("path", {
|
|
19
|
+
"fill-rule": "evenodd",
|
|
20
|
+
"clip-rule": "evenodd",
|
|
21
|
+
d: "M12.893 3.03861C10.3828 4.65069 8.98827 6.52702 8.7094 8.66759C8.2753 12 11.2554 13.6311 12.7653 12.1655C14.2753 10.7 13.3702 8.83982 12.2768 8.33136C11.1834 7.82286 10.5148 7.99996 10.6314 7.32046C10.7481 6.64099 12.3036 4.75706 13.6702 3.87969C13.7609 3.80259 13.7954 3.65299 13.708 3.53949C13.6506 3.46486 13.538 3.31847 13.3702 3.10033C13.2234 2.90957 13.0828 2.91671 12.893 3.03861Z"
|
|
22
|
+
})
|
|
23
|
+
]
|
|
14
24
|
})
|
|
15
25
|
});
|
|
16
26
|
var ReferencesIcon = function(props) {
|
|
@@ -24,7 +34,8 @@ var ReferencesIcon = function(props) {
|
|
|
24
34
|
console.log("itemitem", item);
|
|
25
35
|
apiRef.footerApi.setReferences({
|
|
26
36
|
type: "text",
|
|
27
|
-
value: item.content
|
|
37
|
+
value: item.content,
|
|
38
|
+
source: item
|
|
28
39
|
});
|
|
29
40
|
}
|
|
30
41
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styles from "./index.module.less";
|
|
4
|
+
var refreshSvg = /*#__PURE__*/ _jsx("svg", {
|
|
5
|
+
viewBox: "0 0 14 14",
|
|
6
|
+
version: "1.1",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
"p-id": "8340",
|
|
9
|
+
width: "1em",
|
|
10
|
+
height: "1em",
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
shapeRendering: "geometricPrecision",
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
15
|
+
d: "M8 3.80001C7.27938 3.80001 6.60141 3.97512 6.00464 4.2846C5.71048 4.43715 5.34834 4.32235 5.19579 4.02818C5.04324 3.73401 5.15804 3.37187 5.4522 3.21932C6.21563 2.82342 7.0826 2.60001 8 2.60001C11.0603 2.60001 13.5412 5.08088 13.5412 8.14118C13.5412 8.40936 13.5221 8.67343 13.4851 8.93202C13.4737 9.01141 13.4607 9.09026 13.446 9.16853L13.7175 9.02364C14.0098 8.86759 14.3733 8.97808 14.5293 9.27041C14.6854 9.56274 14.5749 9.92622 14.2825 10.0823L12.6718 10.9421C12.3819 11.0968 12.0215 10.9896 11.8633 10.7016L11.0035 9.13588C10.844 8.84542 10.9501 8.48065 11.2406 8.32115C11.5311 8.16164 11.8958 8.2678 12.0553 8.55825L12.2672 8.94405C12.2784 8.88383 12.2885 8.82318 12.2972 8.76211C12.3261 8.55962 12.3412 8.35233 12.3412 8.14118C12.3412 5.74362 10.3976 3.80001 8 3.80001ZM3.32824 5.34029C3.61811 5.18556 3.97853 5.29278 4.13669 5.58079L4.99651 7.14649C5.15601 7.43694 5.04986 7.80171 4.7594 7.96122C4.46895 8.12072 4.10418 8.01457 3.94467 7.72411L3.73281 7.33832C3.72156 7.39853 3.71155 7.45919 3.70282 7.52026C3.67386 7.72275 3.65883 7.93003 3.65883 8.14118C3.65883 10.5387 5.60244 12.4824 8 12.4824C8.72063 12.4824 9.39859 12.3072 9.99536 11.9978C10.2895 11.8452 10.6517 11.96 10.8042 12.2542C10.9568 12.5484 10.842 12.9105 10.5478 13.063C9.78437 13.4589 8.9174 13.6824 8 13.6824C4.93969 13.6824 2.45883 11.2015 2.45883 8.14118C2.45883 7.87301 2.47792 7.60894 2.51491 7.35034C2.52627 7.27095 2.5393 7.19211 2.55399 7.11384L2.28254 7.25873C1.99021 7.41477 1.62673 7.30429 1.47069 7.01196C1.31465 6.71963 1.42513 6.35615 1.71746 6.20011L3.32824 5.34029Z"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
var RefreshBtn = function(props) {
|
|
19
|
+
var prefix = props.prefix, clickFn = props.clickFn;
|
|
20
|
+
var getCls = function(clsName) {
|
|
21
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/ _jsx("i", {
|
|
24
|
+
className: "".concat(getCls("refreshBtn")),
|
|
25
|
+
onClick: function() {
|
|
26
|
+
return clickFn();
|
|
27
|
+
},
|
|
28
|
+
children: refreshSvg
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export default RefreshBtn;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styles from "./index.module.less";
|
|
4
|
+
var upvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
5
|
+
width: "1em",
|
|
6
|
+
height: "1em",
|
|
7
|
+
viewBox: "0 0 16 16",
|
|
8
|
+
shapeRendering: "geometricPrecision",
|
|
9
|
+
fill: "currentColor",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
12
|
+
d: "M14.9948 7.82355C14.999 7.88679 14.9948 7.95002 14.978 8.01326L13.7172 13.4046C13.7003 13.4699 13.6709 13.527 13.633 13.58C13.4983 13.8411 13.292 14.0716 13.0205 14.2409C12.7321 14.4184 12.4122 14.5 12.0944 14.5V14.4959L4.00144 14.4918C3.97408 14.4959 3.94461 14.498 3.91514 14.498C3.88568 14.498 3.85621 14.4959 3.82885 14.4918H1.67564C1.64617 14.4959 1.6146 14.5 1.58303 14.5C1.26099 14.5 1 14.2471 1 13.935L1.00631 7.1504C1.00631 6.8383 1.26731 6.58536 1.58934 6.58536C1.6125 6.58536 1.63775 6.5874 1.66091 6.58944L3.59522 6.58536V6.57516C5.37587 6.45073 6.78609 5.03711 6.8366 3.29303C6.83239 3.24408 6.82818 3.19512 6.82818 3.14412C6.82818 2.23639 7.58802 1.5 8.52465 1.5C9.32868 1.5 10.0022 2.04464 10.1769 2.77287L10.1853 2.77083C10.2801 3.18696 10.3327 3.61941 10.3327 4.06206C10.3327 4.74745 10.2127 5.40428 9.99169 6.0142L13.2457 6.01828C13.2752 6.01828 13.3046 6.02032 13.3341 6.02644C13.8898 6.04684 14.4244 6.32426 14.7401 6.8179C14.9422 7.13204 15.0222 7.4829 14.9948 7.82355ZM2.16816 13.3618H3.33422L3.33843 7.71544L2.17448 7.71748L2.16816 13.3618ZM13.7572 7.40946C13.6456 7.23403 13.4478 7.14224 13.2478 7.15244V7.1504H13.2457L9.13294 7.14632C8.8109 7.14632 8.54991 6.89338 8.54991 6.58128C8.54991 6.49153 8.57306 6.40585 8.61095 6.33038L8.60463 6.3263C8.83827 5.90609 9.00665 5.44712 9.10347 4.96367H9.10979C9.10979 4.96367 9.18766 4.6577 9.18556 4.0743C9.18556 3.61125 9.09716 3.18696 9.09716 3.18696H9.09295C9.09295 3.1788 9.09505 3.17064 9.09505 3.16248C9.09505 2.87078 8.85089 2.63416 8.54991 2.63416C8.24892 2.63416 8.00477 2.87078 8.00477 3.16248C8.00477 3.17472 8.00687 3.18696 8.00687 3.1992H7.99845C7.99845 3.1992 8.00687 3.63981 7.91636 4.09878C7.87848 4.29256 7.82375 4.47411 7.77324 4.6169C7.77324 4.6169 7.77113 4.6169 7.77113 4.61486C7.28072 6.06928 6.0473 7.19528 4.50449 7.57673L4.49817 13.3638L12.0965 13.3658C12.1217 13.3658 12.147 13.3679 12.1723 13.372C12.248 13.3618 12.3238 13.3373 12.3912 13.2944C12.488 13.2353 12.5595 13.1496 12.6016 13.0517H12.6037L13.8161 7.86231L13.8119 7.86027C13.8624 7.71544 13.8477 7.55021 13.7572 7.40946Z"
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
var downvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
16
|
+
width: "1em",
|
|
17
|
+
height: "1em",
|
|
18
|
+
shapeRendering: "geometricPrecision",
|
|
19
|
+
fill: "currentColor",
|
|
20
|
+
viewBox: "0 0 16 16",
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
22
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
23
|
+
d: "M1.0052 8.17645C1.00099 8.11321 1.0052 8.04998 1.02204 7.98674L2.28281 2.5954C2.29965 2.53013 2.32912 2.47301 2.36701 2.41998C2.50171 2.15887 2.70798 1.92837 2.9795 1.75906C3.26786 1.58159 3.58779 1.5 3.90561 1.5V1.50408L11.9986 1.50816C12.0259 1.50408 12.0554 1.50204 12.0849 1.50204C12.1143 1.50204 12.1438 1.50408 12.1712 1.50816H14.3244C14.3538 1.50408 14.3854 1.5 14.417 1.5C14.739 1.5 15 1.75294 15 2.06504L14.9937 8.8496C14.9937 9.1617 14.7327 9.41464 14.4107 9.41464C14.3875 9.41464 14.3622 9.4126 14.3391 9.41056L12.4048 9.41464V9.42484C10.6241 9.54927 9.21391 10.9629 9.1634 12.707C9.16761 12.7559 9.17182 12.8049 9.17182 12.8559C9.17182 13.7636 8.41198 14.5 7.47535 14.5C6.67132 14.5 5.99778 13.9554 5.82308 13.2271L5.81466 13.2292C5.71995 12.813 5.66733 12.3806 5.66733 11.9379C5.66733 11.2526 5.7873 10.5957 6.00831 9.9858L2.75429 9.98172C2.72482 9.98172 2.69535 9.97968 2.66589 9.97356C2.11022 9.95316 1.5756 9.67574 1.25988 9.1821C1.05782 8.86796 0.977839 8.5171 1.0052 8.17645ZM13.8318 2.63824H12.6658L12.6616 8.28456L13.8255 8.28252L13.8318 2.63824ZM2.24282 8.59054C2.35438 8.76597 2.55223 8.85776 2.75218 8.84756V8.8496H2.75429L6.86706 8.85368C7.1891 8.85368 7.45009 9.10662 7.45009 9.41872C7.45009 9.50847 7.42694 9.59415 7.38905 9.66962L7.39537 9.6737C7.16173 10.0939 6.99335 10.5529 6.89653 11.0363H6.89021C6.89021 11.0363 6.81234 11.3423 6.81444 11.9257C6.81444 12.3887 6.90284 12.813 6.90284 12.813H6.90705C6.90705 12.8212 6.90495 12.8294 6.90495 12.8375C6.90495 13.1292 7.14911 13.3658 7.45009 13.3658C7.75108 13.3658 7.99523 13.1292 7.99523 12.8375C7.99523 12.8253 7.99313 12.813 7.99313 12.8008H8.00155C8.00155 12.8008 7.99313 12.3602 8.08364 11.9012C8.12152 11.7074 8.17625 11.5259 8.22676 11.3831C8.22676 11.3831 8.22887 11.3831 8.22887 11.3851C8.71928 9.93072 9.9527 8.80472 11.4955 8.42327L11.5018 2.6362L3.90351 2.63416C3.87825 2.63416 3.85299 2.63212 3.82773 2.62804C3.75196 2.63824 3.67619 2.66272 3.60884 2.70555C3.51201 2.76471 3.44045 2.85038 3.39836 2.9483H3.39625L2.18389 8.13769L2.1881 8.13973C2.13758 8.28456 2.15232 8.44979 2.24282 8.59054Z"
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
export var UpVoteBtn = function(props) {
|
|
27
|
+
var prefix = props.prefix, isActive = props.isActive, clickFn = props.clickFn;
|
|
28
|
+
var getCls = function(clsName) {
|
|
29
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
30
|
+
};
|
|
31
|
+
return /*#__PURE__*/ _jsx("i", {
|
|
32
|
+
onClick: function() {
|
|
33
|
+
clickFn();
|
|
34
|
+
},
|
|
35
|
+
className: "".concat(getCls("upVoteBtn"), " ").concat(isActive ? getCls("active") : ""),
|
|
36
|
+
children: upvoteBtnSvg
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export var DownVoteBtn = function(props) {
|
|
40
|
+
var prefix = props.prefix, isActive = props.isActive, clickFn = props.clickFn;
|
|
41
|
+
var getCls = function(clsName) {
|
|
42
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
43
|
+
};
|
|
44
|
+
return /*#__PURE__*/ _jsx("i", {
|
|
45
|
+
onClick: function() {
|
|
46
|
+
clickFn();
|
|
47
|
+
},
|
|
48
|
+
className: "".concat(getCls("downVoteBtn"), " ").concat(isActive ? getCls("active") : ""),
|
|
49
|
+
children: downvoteBtnSvg
|
|
50
|
+
});
|
|
51
|
+
};
|
|
@@ -14,6 +14,8 @@ import hljs from "highlight.js";
|
|
|
14
14
|
import "highlight.js/styles/github.css";
|
|
15
15
|
import CopyIcon from "../copyIcon";
|
|
16
16
|
import ReferencesIcon from "../referencesIcon";
|
|
17
|
+
import { UpVoteBtn, DownVoteBtn } from "../remarkBtn";
|
|
18
|
+
import RefreshBtn from "../refreshBtn";
|
|
17
19
|
var Header = function(param) {
|
|
18
20
|
var context = param.context;
|
|
19
21
|
var prefix = context.prefix, loading = context.loading;
|
|
@@ -47,7 +49,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
47
49
|
var getList = contentConfig.getList, coverRenderText = contentConfig.coverRenderText, _contentConfig_msgAction = contentConfig.msgAction, msgAction = _contentConfig_msgAction === void 0 ? [
|
|
48
50
|
"copy",
|
|
49
51
|
"references"
|
|
50
|
-
] : _contentConfig_msgAction, coverRenderReferences = contentConfig.coverRenderReferences, _contentConfig_onRecordMessage = contentConfig.onRecordMessage, onRecordMessage = _contentConfig_onRecordMessage === void 0 ? function() {} : _contentConfig_onRecordMessage;
|
|
52
|
+
] : _contentConfig_msgAction, coverRenderReferences = contentConfig.coverRenderReferences, _contentConfig_onRecordMessage = contentConfig.onRecordMessage, onRecordMessage = _contentConfig_onRecordMessage === void 0 ? function() {} : _contentConfig_onRecordMessage, _contentConfig_onVoteChange = contentConfig.onVoteChange, onVoteChange = _contentConfig_onVoteChange === void 0 ? function() {} : _contentConfig_onVoteChange, _contentConfig_onRefresh = contentConfig.onRefresh, onRefresh = _contentConfig_onRefresh === void 0 ? function() {} : _contentConfig_onRefresh;
|
|
51
53
|
var loadMoreProps = contentConfig.loadMore || true;
|
|
52
54
|
var virtuosoRef = useRef(null);
|
|
53
55
|
var _useState = _sliced_to_array(useState(false), 2), loading = _useState[0], setLoading = _useState[1]; // 是否加载中
|
|
@@ -69,6 +71,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
69
71
|
maxPage: Math.ceil(total / pageSize)
|
|
70
72
|
});
|
|
71
73
|
var timeRenderCache = useRef(new Map()).current;
|
|
74
|
+
var htmlRenderCache = useRef(new Map()).current;
|
|
72
75
|
useImperativeHandle(ref, function() {
|
|
73
76
|
return {
|
|
74
77
|
addMsg: function(msg) {
|
|
@@ -101,6 +104,29 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
101
104
|
},
|
|
102
105
|
recordMsg: function(msg) {
|
|
103
106
|
onRecordMessage(msg);
|
|
107
|
+
},
|
|
108
|
+
getDataSource: function() {
|
|
109
|
+
return recordRef.current.dataSource;
|
|
110
|
+
},
|
|
111
|
+
upateDataSource: function(id, obj) {
|
|
112
|
+
setDataSource(function(list) {
|
|
113
|
+
return list.map(function(item) {
|
|
114
|
+
if (item.id === id) {
|
|
115
|
+
return _object_spread({}, item, obj);
|
|
116
|
+
}
|
|
117
|
+
return item;
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
changeDataSource: function(data) {
|
|
122
|
+
setDataSource(data);
|
|
123
|
+
},
|
|
124
|
+
scrollToBottom: function scrollToBottom() {
|
|
125
|
+
if (!virtuosoRef.current) return;
|
|
126
|
+
virtuosoRef.current.scrollToIndex({
|
|
127
|
+
index: "LAST",
|
|
128
|
+
behavior: "auto"
|
|
129
|
+
});
|
|
104
130
|
}
|
|
105
131
|
};
|
|
106
132
|
});
|
|
@@ -117,18 +143,18 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
117
143
|
}, []);
|
|
118
144
|
useEffect(function() {
|
|
119
145
|
if (!virtuosoRef.current) return;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
146
|
+
// virtuosoRef.current.scrollToIndex({
|
|
147
|
+
// index: "LAST", // 或者使用 dataSource.length - 1
|
|
148
|
+
// behavior: "auto", // 可以是 "smooth" 实现平滑滚动
|
|
149
|
+
// });
|
|
150
|
+
// clearTimeout(timerRef.current.scrollTimer);
|
|
151
|
+
// timerRef.current.scrollTimer = setTimeout(() => {
|
|
152
|
+
// virtuosoRef.current.scrollToIndex({
|
|
153
|
+
// index: "LAST", // 或者使用 dataSource.length - 1
|
|
154
|
+
// behavior: "auto", // 可以是 "smooth" 实现平滑滚动
|
|
155
|
+
// align: "end",
|
|
156
|
+
// });
|
|
157
|
+
// }, 500);
|
|
132
158
|
}, [
|
|
133
159
|
dataSource
|
|
134
160
|
]);
|
|
@@ -175,8 +201,20 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
175
201
|
]);
|
|
176
202
|
var itemContent = function(index, item) {
|
|
177
203
|
var timeNode = renderTime(item);
|
|
204
|
+
var cahceKey = item.id + "-" + item.content;
|
|
205
|
+
var contentNode = null;
|
|
206
|
+
// if (htmlRenderCache.has(cahceKey)) {
|
|
207
|
+
// contentNode = htmlRenderCache.get(cahceKey);
|
|
208
|
+
// } else {
|
|
209
|
+
// const html = markToHtml(item.content, item.id);
|
|
210
|
+
// contentNode = <div dangerouslySetInnerHTML={{ __html: html }}></div>;
|
|
211
|
+
// if (coverRenderText) {
|
|
212
|
+
// contentNode = coverRenderText(item, html);
|
|
213
|
+
// }
|
|
214
|
+
// htmlRenderCache.set(cahceKey, contentNode);
|
|
215
|
+
// }
|
|
178
216
|
var html = markToHtml(item.content, item.id);
|
|
179
|
-
|
|
217
|
+
contentNode = /*#__PURE__*/ _jsx("div", {
|
|
180
218
|
dangerouslySetInnerHTML: {
|
|
181
219
|
__html: html
|
|
182
220
|
}
|
|
@@ -292,11 +330,53 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
292
330
|
apiRef: apiRef,
|
|
293
331
|
item: item
|
|
294
332
|
});
|
|
333
|
+
var UpVoteNode = /*#__PURE__*/ _jsx(UpVoteBtn, {
|
|
334
|
+
prefix: prefix,
|
|
335
|
+
isActive: item.vote === "up",
|
|
336
|
+
clickFn: function() {
|
|
337
|
+
setDataSource(function(data) {
|
|
338
|
+
return data.map(function(ite) {
|
|
339
|
+
if (item.id === ite.id) {
|
|
340
|
+
ite.vote = item.vote === "up" ? "" : "up";
|
|
341
|
+
}
|
|
342
|
+
return ite;
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
onVoteChange(item.vote === "up" ? "" : "up", item);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
var DownVoteNode = /*#__PURE__*/ _jsx(DownVoteBtn, {
|
|
349
|
+
prefix: prefix,
|
|
350
|
+
isActive: item.vote === "down",
|
|
351
|
+
clickFn: function() {
|
|
352
|
+
setDataSource(function(data) {
|
|
353
|
+
return data.map(function(ite) {
|
|
354
|
+
if (item.id === ite.id) {
|
|
355
|
+
ite.vote = ite.vote === "down" ? "" : "down";
|
|
356
|
+
}
|
|
357
|
+
return ite;
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
onVoteChange(item.vote === "down" ? "" : "down", item);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
var RefreshNode = /*#__PURE__*/ _jsx(RefreshBtn, {
|
|
364
|
+
prefix: prefix,
|
|
365
|
+
clickFn: function() {
|
|
366
|
+
return onRefresh(item);
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
if (item.location === "right") {
|
|
370
|
+
UpVoteNode = null;
|
|
371
|
+
DownVoteNode = null;
|
|
372
|
+
}
|
|
295
373
|
var leftNodes = null;
|
|
296
374
|
var rightNodes = /*#__PURE__*/ _jsxs(_Fragment, {
|
|
297
375
|
children: [
|
|
298
376
|
copyNode,
|
|
299
|
-
referencesNode
|
|
377
|
+
referencesNode,
|
|
378
|
+
UpVoteNode,
|
|
379
|
+
DownVoteNode
|
|
300
380
|
]
|
|
301
381
|
});
|
|
302
382
|
if (_instanceof(msgAction, Array)) {
|
|
@@ -308,12 +388,21 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
308
388
|
if (!msgAction.includes("references")) {
|
|
309
389
|
referencesNode = null;
|
|
310
390
|
}
|
|
391
|
+
if (!msgAction.includes("upVite")) {
|
|
392
|
+
UpVoteNode = null;
|
|
393
|
+
}
|
|
394
|
+
if (!msgAction.includes("downVote")) {
|
|
395
|
+
DownVoteNode = null;
|
|
396
|
+
}
|
|
397
|
+
if (!msgAction.includes("refresh")) {
|
|
398
|
+
RefreshNode = null;
|
|
399
|
+
}
|
|
311
400
|
} else if (typeof msgAction === "object") {
|
|
312
401
|
if (msgAction.renderLeft) {
|
|
313
|
-
leftNodes = msgAction.renderLeft(copyNode, referencesNode);
|
|
402
|
+
leftNodes = msgAction.renderLeft(copyNode, referencesNode, UpVoteNode, DownVoteNode, RefreshNode);
|
|
314
403
|
}
|
|
315
404
|
if (msgAction.renderRight) {
|
|
316
|
-
rightNodes = msgAction.renderRight(copyNode, referencesNode);
|
|
405
|
+
rightNodes = msgAction.renderRight(copyNode, referencesNode, UpVoteNode, DownVoteNode, RefreshNode);
|
|
317
406
|
}
|
|
318
407
|
}
|
|
319
408
|
var index = recordRef.current.dataSource.findIndex(function(ite) {
|
|
@@ -329,9 +418,12 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
329
418
|
className: "".concat(getCls("msgItem-action-left")),
|
|
330
419
|
children: leftNodes
|
|
331
420
|
}),
|
|
332
|
-
/*#__PURE__*/
|
|
421
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
333
422
|
className: "".concat(getCls("msgItem-action-right")),
|
|
334
|
-
children:
|
|
423
|
+
children: [
|
|
424
|
+
RefreshNode,
|
|
425
|
+
rightNodes
|
|
426
|
+
]
|
|
335
427
|
})
|
|
336
428
|
]
|
|
337
429
|
});
|
|
@@ -274,7 +274,10 @@
|
|
|
274
274
|
display: flex;
|
|
275
275
|
align-items: center;
|
|
276
276
|
justify-content: space-between;
|
|
277
|
-
.msgItem-action-
|
|
277
|
+
.msgItem-action-left {
|
|
278
|
+
display: flex;
|
|
279
|
+
align-items: center;
|
|
280
|
+
gap: 8px;
|
|
278
281
|
}
|
|
279
282
|
.msgItem-action-right {
|
|
280
283
|
display: flex;
|
|
@@ -294,8 +297,14 @@
|
|
|
294
297
|
line-height: 1;
|
|
295
298
|
z-index: 9;
|
|
296
299
|
padding: 4px 8px;
|
|
300
|
+
.msgItem-action-left {
|
|
301
|
+
display: flex;
|
|
302
|
+
align-items: center;
|
|
303
|
+
gap: 8px;
|
|
304
|
+
}
|
|
297
305
|
.msgItem-action-right {
|
|
298
306
|
display: flex;
|
|
307
|
+
align-items: center;
|
|
299
308
|
gap: 8px;
|
|
300
309
|
}
|
|
301
310
|
&.msgItem-action-popover-floatTop {
|
|
@@ -26,11 +26,17 @@ export interface headerConfigProps {
|
|
|
26
26
|
export interface msgActionProps {
|
|
27
27
|
renderLeft?: (
|
|
28
28
|
copyNode: React.ReactNode,
|
|
29
|
-
referencesNode: React.ReactNode
|
|
29
|
+
referencesNode: React.ReactNode,
|
|
30
|
+
upVoteNode: React.ReactNode,
|
|
31
|
+
downVoteNode: React.ReactNode,
|
|
32
|
+
refreshNode:React.ReactNode,
|
|
30
33
|
) => React.ReactNode;
|
|
31
34
|
renderRight?: (
|
|
32
35
|
copyNode: React.ReactNode,
|
|
33
|
-
referencesNode: React.ReactNode
|
|
36
|
+
referencesNode: React.ReactNode,
|
|
37
|
+
upVoteNode: React.ReactNode,
|
|
38
|
+
downVoteNode: React.ReactNode,
|
|
39
|
+
refreshNode:React.ReactNode,
|
|
34
40
|
) => React.ReactNode;
|
|
35
41
|
}
|
|
36
42
|
|
|
@@ -54,6 +60,8 @@ export interface contentConfigProps {
|
|
|
54
60
|
referenceNode: React.ReactNode
|
|
55
61
|
) => React.ReactNode; //覆盖引用内容
|
|
56
62
|
onRecordMessage?: (item: dataItemType) => void; // 发送和接收的消息记录
|
|
63
|
+
onVoteChange?: (type:string,item: dataItemType) => void; // 点赞 或踩
|
|
64
|
+
onRefresh?: (item:dataItemType) => void;// 刷新
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
// content props
|
|
@@ -76,20 +84,26 @@ export interface footerConfigProps {
|
|
|
76
84
|
) => React.ReactNode; // 自定义渲染操作栏
|
|
77
85
|
fileUpload?: boolean | fileUploadProps; // 默认为false
|
|
78
86
|
sendMsgAjaxParams: sendMsgAjaxParams;
|
|
87
|
+
onClickStop?: () => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface onOpenProps {
|
|
91
|
+
retryFetch: () => void; // 重试
|
|
92
|
+
stopMessage: () => void;
|
|
79
93
|
}
|
|
80
94
|
|
|
81
95
|
export interface sendMsgAjaxParams {
|
|
82
96
|
url: string;
|
|
83
97
|
method?: string;
|
|
84
|
-
headers?: object;
|
|
98
|
+
headers?: () => object;
|
|
85
99
|
params: (
|
|
86
100
|
value: string,
|
|
87
101
|
refereces: referenceType,
|
|
88
102
|
fileList: fileCustomProps[],
|
|
89
|
-
beforeInfo:any
|
|
103
|
+
beforeInfo: any
|
|
90
104
|
) => string;
|
|
91
|
-
onOpen?: (res: Response) => void;
|
|
92
|
-
onMessage?: (ev: EventSourceMessage) => { id: string; content: string };
|
|
105
|
+
onOpen?: (res: Response, onOpenProps: onOpenProps) => void;
|
|
106
|
+
onMessage?: (ev: EventSourceMessage,closeCallback:()=>void) => { id: string; content: string };
|
|
93
107
|
onClose?: () => void;
|
|
94
108
|
onError?: (err: any) => void;
|
|
95
109
|
coverProps?: object;
|
|
@@ -107,16 +121,17 @@ export interface fileUploadProps {
|
|
|
107
121
|
maxCount?: number; // 上传文件数量限制 -1为不限制 默认为10
|
|
108
122
|
maxSize?: number; // 默认为50Mb 目前不考虑切片上传 业务上不要设置太大
|
|
109
123
|
multiple?: boolean; // 是否允许多选
|
|
110
|
-
customRequest: (
|
|
111
|
-
file: File
|
|
112
|
-
) => Promise<{
|
|
124
|
+
customRequest: (file: File) => Promise<{
|
|
113
125
|
url: string;
|
|
114
126
|
fileId: string;
|
|
115
127
|
source: File;
|
|
116
128
|
status: fileStatus;
|
|
117
129
|
}>; // 自定义上传方法
|
|
118
130
|
mapUploadCount?: number; // 并发上传的数量 默认为1
|
|
119
|
-
deleteFileAjax?: (
|
|
131
|
+
deleteFileAjax?: (
|
|
132
|
+
fileId: string,
|
|
133
|
+
file: fileCustomProps
|
|
134
|
+
) => Promise<{ fileId: string }>; // 删除文件的ajax 返回删除文件的fileId
|
|
120
135
|
statusText?: (status: fileStatus) => React.ReactNode; // 自定义状态显示
|
|
121
136
|
parseFileAjax?: (fileId: string) => { status: fileStatus; fileId; string }; //文件解析的 ajax 请求 如不存在解析过程,可在此函数内直接返回上传成功的状态
|
|
122
137
|
iconFileRender?: (suffix: string) => React.ReactNode; // 文件上传的 icon。参数 文件对象file 返回值为图标
|
|
@@ -161,6 +176,17 @@ export interface uploadFileBtnProps {
|
|
|
161
176
|
customRequest: (options: any) => void;
|
|
162
177
|
}
|
|
163
178
|
|
|
179
|
+
export interface VoteBtnProps {
|
|
180
|
+
prefix: string;
|
|
181
|
+
clickFn: () => void;
|
|
182
|
+
isActive: boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface refreshBtnProps{
|
|
186
|
+
prefix:string;
|
|
187
|
+
clickFn:()=>void;
|
|
188
|
+
}
|
|
189
|
+
|
|
164
190
|
// fileList Props
|
|
165
191
|
|
|
166
192
|
export interface fileListProps {
|
|
@@ -190,7 +216,8 @@ export interface FileListRefProps {
|
|
|
190
216
|
updateFile: (fileId: string, status: fileStatus) => void;
|
|
191
217
|
getFileList: () => fileCustomProps[];
|
|
192
218
|
vaildFile: (file: File, fileId?: string) => boolean; // 校验文件是否合规
|
|
193
|
-
fileToCustomFile: (file: File) => fileCustomProps;
|
|
219
|
+
fileToCustomFile: (file: File, params: any) => fileCustomProps;
|
|
220
|
+
clearFileList: () => void;
|
|
194
221
|
}
|
|
195
222
|
|
|
196
223
|
// error Message
|
|
@@ -220,11 +247,13 @@ export type referenceType = referenceTypeText | referenceTypeFile;
|
|
|
220
247
|
export type referenceTypeText = {
|
|
221
248
|
type: "text";
|
|
222
249
|
value: string;
|
|
250
|
+
source:any;
|
|
223
251
|
};
|
|
224
252
|
|
|
225
253
|
export type referenceTypeFile = {
|
|
226
254
|
type: "file";
|
|
227
255
|
value: fileCustomProps;
|
|
256
|
+
source:any;
|
|
228
257
|
};
|
|
229
258
|
|
|
230
259
|
export interface VirtuosoListProps {
|
|
@@ -238,6 +267,10 @@ export interface VirtuosoListRefProps {
|
|
|
238
267
|
updateMsg: (id: string, obj: any) => void;
|
|
239
268
|
clearInputing: () => void; //清楚正在输入的inputing
|
|
240
269
|
recordMsg: (item: dataItemType) => void;
|
|
270
|
+
getDataSource: () => dataItemType[];
|
|
271
|
+
upateDataSource:(id:string,obj:dataItemType)=>void;
|
|
272
|
+
changeDataSource:(list:dataItemType[])=>void;
|
|
273
|
+
scrollToBottom: () => void;
|
|
241
274
|
}
|
|
242
275
|
|
|
243
276
|
export interface contentRefProps extends VirtuosoListRefProps {}
|
|
@@ -256,4 +289,5 @@ export interface dataItemType {
|
|
|
256
289
|
location: "left" | "right"; // 消息显示在左边还是右边
|
|
257
290
|
reference: referenceType | null; // 引用数据
|
|
258
291
|
source: any; //原消息对象
|
|
292
|
+
vote?:string;// "up":点赞。"down":踩
|
|
259
293
|
}
|
|
@@ -467,7 +467,13 @@ var HistoryFun = function(props) {
|
|
|
467
467
|
return /*#__PURE__*/ _jsxs("div", {
|
|
468
468
|
className: styles.list,
|
|
469
469
|
onClick: function() {
|
|
470
|
-
calculationData(item.roomId, list.id, list.receiver);
|
|
470
|
+
calculationData(item.roomId, list.id, props.userData.mid == list.sender ? list.receiver : list.sender);
|
|
471
|
+
console.log("答应一下111111", {
|
|
472
|
+
roomId: item.roomId,
|
|
473
|
+
id: list.id,
|
|
474
|
+
sender: list.sender
|
|
475
|
+
});
|
|
476
|
+
// calculationData(item.roomId, list.id, list.sender);
|
|
471
477
|
},
|
|
472
478
|
children: [
|
|
473
479
|
/*#__PURE__*/ _jsxs("div", {
|