bhd-components 0.10.11 → 0.10.12
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/README.md +1 -1
- package/dist/index.esm.es5.development.css +0 -766
- package/dist/index.esm.es5.development.js +162 -3085
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +1100 -2515
- package/dist/vendor.esm.es5.production.js +136 -136
- package/es2017/customerService/index.js +3 -1
- package/es2017/index.d.ts +0 -1
- package/es2017/index.js +0 -1
- package/es2017/utils/Date.d.ts +1 -2
- package/es2017/utils/Date.js +1 -2
- package/es2017/utils/dom.d.ts +1 -4
- package/es2017/utils/dom.js +1 -44
- package/esm/customerService/index.js +3 -1
- package/esm/index.d.ts +0 -1
- package/esm/index.js +0 -1
- package/esm/utils/Date.d.ts +1 -2
- package/esm/utils/Date.js +1 -2
- package/esm/utils/dom.d.ts +1 -4
- package/esm/utils/dom.js +1 -45
- package/package.json +1 -2
- package/es2017/AIMessageList/components/content/index.d.ts +0 -4
- package/es2017/AIMessageList/components/content/index.js +0 -29
- package/es2017/AIMessageList/components/content/index.module.less +0 -8
- package/es2017/AIMessageList/components/copyIcon/index.d.ts +0 -7
- package/es2017/AIMessageList/components/copyIcon/index.js +0 -73
- package/es2017/AIMessageList/components/copyIcon/index.module.less +0 -22
- package/es2017/AIMessageList/components/errorCallback/index.d.ts +0 -3
- package/es2017/AIMessageList/components/errorCallback/index.js +0 -6
- package/es2017/AIMessageList/components/fileList/fileIcon.d.ts +0 -3
- package/es2017/AIMessageList/components/fileList/fileIcon.js +0 -970
- package/es2017/AIMessageList/components/fileList/index.d.ts +0 -4
- package/es2017/AIMessageList/components/fileList/index.js +0 -315
- package/es2017/AIMessageList/components/fileList/index.module.less +0 -95
- package/es2017/AIMessageList/components/footer/index.d.ts +0 -10
- package/es2017/AIMessageList/components/footer/index.js +0 -360
- package/es2017/AIMessageList/components/footer/index.module.less +0 -51
- package/es2017/AIMessageList/components/header/index.d.ts +0 -9
- package/es2017/AIMessageList/components/header/index.js +0 -94
- package/es2017/AIMessageList/components/header/index.module.less +0 -31
- package/es2017/AIMessageList/components/referencesIcon/index.d.ts +0 -9
- package/es2017/AIMessageList/components/referencesIcon/index.js +0 -63
- package/es2017/AIMessageList/components/referencesIcon/index.module.less +0 -13
- package/es2017/AIMessageList/components/refreshBtn/index.d.ts +0 -4
- package/es2017/AIMessageList/components/refreshBtn/index.js +0 -29
- package/es2017/AIMessageList/components/refreshBtn/index.module.less +0 -12
- package/es2017/AIMessageList/components/remarkBtn/index.d.ts +0 -4
- package/es2017/AIMessageList/components/remarkBtn/index.js +0 -51
- package/es2017/AIMessageList/components/remarkBtn/index.module.less +0 -13
- package/es2017/AIMessageList/components/renderReferrnce/index.d.ts +0 -10
- package/es2017/AIMessageList/components/renderReferrnce/index.js +0 -68
- package/es2017/AIMessageList/components/renderReferrnce/index.module.less +0 -64
- package/es2017/AIMessageList/components/sendBtn/index.d.ts +0 -4
- package/es2017/AIMessageList/components/sendBtn/index.js +0 -51
- package/es2017/AIMessageList/components/sendBtn/index.module.less +0 -25
- package/es2017/AIMessageList/components/uplodaFileBtn/index.d.ts +0 -4
- package/es2017/AIMessageList/components/uplodaFileBtn/index.js +0 -33
- package/es2017/AIMessageList/components/uplodaFileBtn/index.module.less +0 -5
- package/es2017/AIMessageList/components/virtuosoList/index.d.ts +0 -5
- package/es2017/AIMessageList/components/virtuosoList/index.js +0 -689
- package/es2017/AIMessageList/components/virtuosoList/index.module.less +0 -467
- package/es2017/AIMessageList/index.d.ts +0 -4
- package/es2017/AIMessageList/index.js +0 -58
- package/es2017/AIMessageList/index.module.less +0 -20
- package/es2017/AIMessageList/type.d.ts +0 -306
- package/es2017/images/loading2.js +0 -2
- package/es2017/utils/number.d.ts +0 -1
- package/es2017/utils/number.js +0 -9
- package/esm/AIMessageList/components/content/index.d.ts +0 -4
- package/esm/AIMessageList/components/content/index.js +0 -29
- package/esm/AIMessageList/components/content/index.module.less +0 -8
- package/esm/AIMessageList/components/copyIcon/index.d.ts +0 -7
- package/esm/AIMessageList/components/copyIcon/index.js +0 -76
- package/esm/AIMessageList/components/copyIcon/index.module.less +0 -22
- package/esm/AIMessageList/components/errorCallback/index.d.ts +0 -3
- package/esm/AIMessageList/components/errorCallback/index.js +0 -6
- package/esm/AIMessageList/components/fileList/fileIcon.d.ts +0 -3
- package/esm/AIMessageList/components/fileList/fileIcon.js +0 -970
- package/esm/AIMessageList/components/fileList/index.d.ts +0 -4
- package/esm/AIMessageList/components/fileList/index.js +0 -337
- package/esm/AIMessageList/components/fileList/index.module.less +0 -95
- package/esm/AIMessageList/components/footer/index.d.ts +0 -10
- package/esm/AIMessageList/components/footer/index.js +0 -376
- package/esm/AIMessageList/components/footer/index.module.less +0 -51
- package/esm/AIMessageList/components/header/index.d.ts +0 -9
- package/esm/AIMessageList/components/header/index.js +0 -96
- package/esm/AIMessageList/components/header/index.module.less +0 -31
- package/esm/AIMessageList/components/referencesIcon/index.d.ts +0 -9
- package/esm/AIMessageList/components/referencesIcon/index.js +0 -65
- package/esm/AIMessageList/components/referencesIcon/index.module.less +0 -13
- package/esm/AIMessageList/components/refreshBtn/index.d.ts +0 -4
- package/esm/AIMessageList/components/refreshBtn/index.js +0 -31
- package/esm/AIMessageList/components/refreshBtn/index.module.less +0 -12
- package/esm/AIMessageList/components/remarkBtn/index.d.ts +0 -4
- package/esm/AIMessageList/components/remarkBtn/index.js +0 -51
- package/esm/AIMessageList/components/remarkBtn/index.module.less +0 -13
- package/esm/AIMessageList/components/renderReferrnce/index.d.ts +0 -10
- package/esm/AIMessageList/components/renderReferrnce/index.js +0 -72
- package/esm/AIMessageList/components/renderReferrnce/index.module.less +0 -64
- package/esm/AIMessageList/components/sendBtn/index.d.ts +0 -4
- package/esm/AIMessageList/components/sendBtn/index.js +0 -53
- package/esm/AIMessageList/components/sendBtn/index.module.less +0 -25
- package/esm/AIMessageList/components/uplodaFileBtn/index.d.ts +0 -4
- package/esm/AIMessageList/components/uplodaFileBtn/index.js +0 -33
- package/esm/AIMessageList/components/uplodaFileBtn/index.module.less +0 -5
- package/esm/AIMessageList/components/virtuosoList/index.d.ts +0 -5
- package/esm/AIMessageList/components/virtuosoList/index.js +0 -666
- package/esm/AIMessageList/components/virtuosoList/index.module.less +0 -467
- package/esm/AIMessageList/index.d.ts +0 -4
- package/esm/AIMessageList/index.js +0 -58
- package/esm/AIMessageList/index.module.less +0 -20
- package/esm/AIMessageList/type.d.ts +0 -306
- package/esm/images/loading2.js +0 -2
- package/esm/utils/number.d.ts +0 -1
- package/esm/utils/number.js +0 -9
|
@@ -110,6 +110,7 @@ const CustomerService = (props)=>{
|
|
|
110
110
|
const mid = props.userData.mid;
|
|
111
111
|
const renderAiAnswerTimer = useRef(null);
|
|
112
112
|
const remarkable = new Remarkable({
|
|
113
|
+
html: true,
|
|
113
114
|
highlight: function(str, lang) {
|
|
114
115
|
if (lang && hljs.getLanguage(lang)) {
|
|
115
116
|
try {
|
|
@@ -124,6 +125,7 @@ const CustomerService = (props)=>{
|
|
|
124
125
|
});
|
|
125
126
|
const remarkReplaceKey = (message, keyWordProblem)=>{
|
|
126
127
|
let newRemarkable = new Remarkable({
|
|
128
|
+
html: true,
|
|
127
129
|
highlight: function(str, lang) {
|
|
128
130
|
if (lang && hljs.getLanguage(lang)) {
|
|
129
131
|
try {
|
|
@@ -469,7 +471,6 @@ const CustomerService = (props)=>{
|
|
|
469
471
|
message.replaceAll(new RegExp(/```(?:.|\n)*?```/, "ig"), (con)=>{
|
|
470
472
|
i++;
|
|
471
473
|
if (i == position) {
|
|
472
|
-
con = con.replace(/^```[\s\S]*?\n/, '').replace(/\n```$/, '');
|
|
473
474
|
codeConment = con;
|
|
474
475
|
return con;
|
|
475
476
|
} else {
|
|
@@ -1171,6 +1172,7 @@ const CustomerService = (props)=>{
|
|
|
1171
1172
|
console.log('返回中', msg);
|
|
1172
1173
|
content = content + msg.message;
|
|
1173
1174
|
// isPosition.current = true;
|
|
1175
|
+
clearTimeout(renderAiAnswerTimer.current);
|
|
1174
1176
|
renderAiAnswerTimer.current = setTimeout(()=>{
|
|
1175
1177
|
if (!finishedRef.current) {
|
|
1176
1178
|
renderAiAnswer(msg, id, type);
|
package/es2017/index.d.ts
CHANGED
|
@@ -83,4 +83,3 @@ export { default as CustomerService } from "./customerService";
|
|
|
83
83
|
export { default as BhdDatePicker } from "./bhdDatePicker";
|
|
84
84
|
export { default as BhdEnterInput } from "./bhdEnterInput";
|
|
85
85
|
export { default as BhdModalCropper } from "./bhdModalCropper";
|
|
86
|
-
export { default as AIMessageList } from "./AIMessageList";
|
package/es2017/index.js
CHANGED
|
@@ -88,4 +88,3 @@ export { default as CustomerService } from "./customerService"; //封装 智能
|
|
|
88
88
|
export { default as BhdDatePicker } from "./bhdDatePicker"; //封装 日历组件
|
|
89
89
|
export { default as BhdEnterInput } from "./bhdEnterInput"; //封装 Input
|
|
90
90
|
export { default as BhdModalCropper } from "./bhdModalCropper"; //裁剪头像
|
|
91
|
-
export { default as AIMessageList } from "./AIMessageList"; //AI 对话列表
|
package/es2017/utils/Date.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
declare const parseDate: (dateStr: string
|
|
1
|
+
declare const parseDate: (dateStr: string) => {
|
|
2
2
|
year: string;
|
|
3
3
|
month: string;
|
|
4
4
|
day: string;
|
|
5
5
|
hours: string;
|
|
6
6
|
minutes: string;
|
|
7
7
|
seconds: string;
|
|
8
|
-
timestamp: number;
|
|
9
8
|
};
|
|
10
9
|
export { parseDate };
|
package/es2017/utils/Date.js
CHANGED
package/es2017/utils/dom.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
declare var getStyle: (dom: any, key: any) => number;
|
|
2
|
-
|
|
3
|
-
declare const findParent: (e: any, className: string) => any;
|
|
4
|
-
declare const copyText: (text: string) => boolean;
|
|
5
|
-
export { getStyle, copyText, findParent, delegate };
|
|
2
|
+
export { getStyle };
|
package/es2017/utils/dom.js
CHANGED
|
@@ -2,47 +2,4 @@
|
|
|
2
2
|
var getStyle = function(dom, key) {
|
|
3
3
|
return dom.currentStyle ? parseFloat(dom.currentStyle[key]) : parseFloat(document.defaultView.getComputedStyle(dom)[key]);
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
const delegate = (element, eventType, selector, callback)=>{
|
|
7
|
-
if (!(element instanceof HTMLElement)) {
|
|
8
|
-
throw new Error("第一个参数必须是一个HTMLElement");
|
|
9
|
-
}
|
|
10
|
-
if (typeof eventType !== "string") {
|
|
11
|
-
throw new Error("第二个参数必须是字符串");
|
|
12
|
-
}
|
|
13
|
-
if (typeof selector !== "string") {
|
|
14
|
-
throw new Error("第三个参数必须是字符串");
|
|
15
|
-
}
|
|
16
|
-
if (typeof callback !== "function") {
|
|
17
|
-
throw new Error("第四个参数必须是一个函数");
|
|
18
|
-
}
|
|
19
|
-
const fn = (event)=>{
|
|
20
|
-
const possibleTargets = element.querySelectorAll(selector);
|
|
21
|
-
for(let i = 0; i < possibleTargets.length; i++){
|
|
22
|
-
if (possibleTargets[i] === event.target || possibleTargets[i].contains(event.target)) {
|
|
23
|
-
callback.call(possibleTargets[i], event, possibleTargets[i]);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
element.addEventListener(eventType, fn);
|
|
28
|
-
return ()=>{
|
|
29
|
-
element.removeEventListener(eventType, fn);
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
const findParent = (e, className)=>{
|
|
33
|
-
while(e && !e.classList.contains(className)){
|
|
34
|
-
e = e.parentElement;
|
|
35
|
-
}
|
|
36
|
-
return e;
|
|
37
|
-
};
|
|
38
|
-
//复制内容
|
|
39
|
-
const copyText = (text)=>{
|
|
40
|
-
var tempInput = document.createElement("textarea");
|
|
41
|
-
document.body.appendChild(tempInput);
|
|
42
|
-
tempInput.value = text;
|
|
43
|
-
tempInput.select();
|
|
44
|
-
document.execCommand("copy");
|
|
45
|
-
document.body.removeChild(tempInput);
|
|
46
|
-
return true;
|
|
47
|
-
};
|
|
48
|
-
export { getStyle, copyText, findParent, delegate };
|
|
5
|
+
export { getStyle };
|
|
@@ -114,6 +114,7 @@ var CustomerService = function(props) {
|
|
|
114
114
|
var mid = props.userData.mid;
|
|
115
115
|
var renderAiAnswerTimer = useRef(null);
|
|
116
116
|
var remarkable = new Remarkable({
|
|
117
|
+
html: true,
|
|
117
118
|
highlight: function highlight(str, lang) {
|
|
118
119
|
if (lang && hljs.getLanguage(lang)) {
|
|
119
120
|
try {
|
|
@@ -128,6 +129,7 @@ var CustomerService = function(props) {
|
|
|
128
129
|
});
|
|
129
130
|
var remarkReplaceKey = function(message, keyWordProblem) {
|
|
130
131
|
var newRemarkable = new Remarkable({
|
|
132
|
+
html: true,
|
|
131
133
|
highlight: function highlight(str, lang) {
|
|
132
134
|
if (lang && hljs.getLanguage(lang)) {
|
|
133
135
|
try {
|
|
@@ -476,7 +478,6 @@ var CustomerService = function(props) {
|
|
|
476
478
|
message.replaceAll(new RegExp(/```(?:.|\n)*?```/, "ig"), function(con) {
|
|
477
479
|
i++;
|
|
478
480
|
if (i == position) {
|
|
479
|
-
con = con.replace(/^```[\s\S]*?\n/, "").replace(/\n```$/, "");
|
|
480
481
|
codeConment = con;
|
|
481
482
|
return con;
|
|
482
483
|
} else {
|
|
@@ -1262,6 +1263,7 @@ var CustomerService = function(props) {
|
|
|
1262
1263
|
console.log("返回中", msg);
|
|
1263
1264
|
content = content + msg.message;
|
|
1264
1265
|
// isPosition.current = true;
|
|
1266
|
+
clearTimeout(renderAiAnswerTimer.current);
|
|
1265
1267
|
renderAiAnswerTimer.current = setTimeout(function() {
|
|
1266
1268
|
if (!finishedRef.current) {
|
|
1267
1269
|
renderAiAnswer(msg, id, type);
|
package/esm/index.d.ts
CHANGED
|
@@ -83,4 +83,3 @@ export { default as CustomerService } from "./customerService";
|
|
|
83
83
|
export { default as BhdDatePicker } from "./bhdDatePicker";
|
|
84
84
|
export { default as BhdEnterInput } from "./bhdEnterInput";
|
|
85
85
|
export { default as BhdModalCropper } from "./bhdModalCropper";
|
|
86
|
-
export { default as AIMessageList } from "./AIMessageList";
|
package/esm/index.js
CHANGED
|
@@ -88,4 +88,3 @@ export { default as CustomerService } from "./customerService"; //封装 智能
|
|
|
88
88
|
export { default as BhdDatePicker } from "./bhdDatePicker"; //封装 日历组件
|
|
89
89
|
export { default as BhdEnterInput } from "./bhdEnterInput"; //封装 Input
|
|
90
90
|
export { default as BhdModalCropper } from "./bhdModalCropper"; //裁剪头像
|
|
91
|
-
export { default as AIMessageList } from "./AIMessageList"; //AI 对话列表
|
package/esm/utils/Date.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
declare const parseDate: (dateStr: string
|
|
1
|
+
declare const parseDate: (dateStr: string) => {
|
|
2
2
|
year: string;
|
|
3
3
|
month: string;
|
|
4
4
|
day: string;
|
|
5
5
|
hours: string;
|
|
6
6
|
minutes: string;
|
|
7
7
|
seconds: string;
|
|
8
|
-
timestamp: number;
|
|
9
8
|
};
|
|
10
9
|
export { parseDate };
|
package/esm/utils/Date.js
CHANGED
package/esm/utils/dom.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
declare var getStyle: (dom: any, key: any) => number;
|
|
2
|
-
|
|
3
|
-
declare const findParent: (e: any, className: string) => any;
|
|
4
|
-
declare const copyText: (text: string) => boolean;
|
|
5
|
-
export { getStyle, copyText, findParent, delegate };
|
|
2
|
+
export { getStyle };
|
package/esm/utils/dom.js
CHANGED
|
@@ -1,49 +1,5 @@
|
|
|
1
1
|
//获取css样式
|
|
2
|
-
import { _ as _instanceof } from "@swc/helpers/_/_instanceof";
|
|
3
2
|
var getStyle = function getStyle(dom, key) {
|
|
4
3
|
return dom.currentStyle ? parseFloat(dom.currentStyle[key]) : parseFloat(document.defaultView.getComputedStyle(dom)[key]);
|
|
5
4
|
};
|
|
6
|
-
|
|
7
|
-
var delegate = function(element, eventType, selector, callback) {
|
|
8
|
-
if (!_instanceof(element, HTMLElement)) {
|
|
9
|
-
throw new Error("第一个参数必须是一个HTMLElement");
|
|
10
|
-
}
|
|
11
|
-
if (typeof eventType !== "string") {
|
|
12
|
-
throw new Error("第二个参数必须是字符串");
|
|
13
|
-
}
|
|
14
|
-
if (typeof selector !== "string") {
|
|
15
|
-
throw new Error("第三个参数必须是字符串");
|
|
16
|
-
}
|
|
17
|
-
if (typeof callback !== "function") {
|
|
18
|
-
throw new Error("第四个参数必须是一个函数");
|
|
19
|
-
}
|
|
20
|
-
var fn = function(event) {
|
|
21
|
-
var possibleTargets = element.querySelectorAll(selector);
|
|
22
|
-
for(var i = 0; i < possibleTargets.length; i++){
|
|
23
|
-
if (possibleTargets[i] === event.target || possibleTargets[i].contains(event.target)) {
|
|
24
|
-
callback.call(possibleTargets[i], event, possibleTargets[i]);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
element.addEventListener(eventType, fn);
|
|
29
|
-
return function() {
|
|
30
|
-
element.removeEventListener(eventType, fn);
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
var findParent = function(e, className) {
|
|
34
|
-
while(e && !e.classList.contains(className)){
|
|
35
|
-
e = e.parentElement;
|
|
36
|
-
}
|
|
37
|
-
return e;
|
|
38
|
-
};
|
|
39
|
-
//复制内容
|
|
40
|
-
var copyText = function(text) {
|
|
41
|
-
var tempInput = document.createElement("textarea");
|
|
42
|
-
document.body.appendChild(tempInput);
|
|
43
|
-
tempInput.value = text;
|
|
44
|
-
tempInput.select();
|
|
45
|
-
document.execCommand("copy");
|
|
46
|
-
document.body.removeChild(tempInput);
|
|
47
|
-
return true;
|
|
48
|
-
};
|
|
49
|
-
export { getStyle, copyText, findParent, delegate };
|
|
5
|
+
export { getStyle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bhd-components",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.12",
|
|
4
4
|
"description": "组件功能描述",
|
|
5
5
|
"config": {
|
|
6
6
|
"commitizen": {
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
"raw-loader": "^4.0.2",
|
|
80
80
|
"react-cropper": "^2.3.3",
|
|
81
81
|
"react-image-crop": "^11.0.5",
|
|
82
|
-
"react-virtuoso": "^3.1.5",
|
|
83
82
|
"remarkable": "^2.0.1"
|
|
84
83
|
},
|
|
85
84
|
"devDependencies": {
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
-
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
3
|
-
import React, { useRef, useImperativeHandle, forwardRef } from "react";
|
|
4
|
-
import styles from "./index.module.less";
|
|
5
|
-
import VirtuosoList from "../virtuosoList";
|
|
6
|
-
const Content = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
7
|
-
const { prefix, contentConfig, apiRef } = props;
|
|
8
|
-
const { className = "" } = contentConfig;
|
|
9
|
-
const listRef = useRef(null);
|
|
10
|
-
useImperativeHandle(ref, ()=>{
|
|
11
|
-
return _object_spread({}, listRef.current);
|
|
12
|
-
});
|
|
13
|
-
const getCls = (clsName)=>{
|
|
14
|
-
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
15
|
-
};
|
|
16
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
17
|
-
className: `${getCls("content")} ${className}`,
|
|
18
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
19
|
-
className: `${getCls("contentList")}`,
|
|
20
|
-
children: /*#__PURE__*/ _jsx(VirtuosoList, {
|
|
21
|
-
ref: listRef,
|
|
22
|
-
prefix: prefix,
|
|
23
|
-
contentConfig: contentConfig,
|
|
24
|
-
apiRef: apiRef
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
export default Content;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
-
import React, { useEffect, useState, useRef } from "react";
|
|
3
|
-
import styles from "./index.module.less";
|
|
4
|
-
import { copyText } from "../../../utils/dom";
|
|
5
|
-
const copyIconSvg = /*#__PURE__*/ _jsx("i", {
|
|
6
|
-
children: /*#__PURE__*/ _jsxs("svg", {
|
|
7
|
-
width: "1em",
|
|
8
|
-
height: "1em",
|
|
9
|
-
viewBox: "0 0 14 14",
|
|
10
|
-
shapeRendering: "geometricPrecision",
|
|
11
|
-
fill: "currentColor",
|
|
12
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
-
children: [
|
|
14
|
-
/*#__PURE__*/ _jsx("g", {
|
|
15
|
-
clipPath: "url(#clip0_518_8403)",
|
|
16
|
-
children: /*#__PURE__*/ _jsx("path", {
|
|
17
|
-
d: "M6.16666 1.66666H13.1667C13.4761 1.66666 13.7728 1.78957 13.9916 2.00837C14.2104 2.22716 14.3333 2.5239 14.3333 2.83332V9.83332C14.3333 10.1427 14.2104 10.4395 13.9916 10.6583C13.7728 10.8771 13.4761 11 13.1667 11H6.16666C5.85724 11 5.5605 10.8771 5.34171 10.6583C5.12291 10.4395 5 10.1427 5 9.83332V2.83332C5 2.5239 5.12291 2.22716 5.34171 2.00837C5.5605 1.78957 5.85724 1.66666 6.16666 1.66666ZM6.16666 2.66666C6.12246 2.66666 6.08007 2.68422 6.04881 2.71547C6.01756 2.74673 6 2.78912 6 2.83332V9.83332C6 9.85521 6.00431 9.87688 6.01268 9.8971C6.02106 9.91732 6.03334 9.9357 6.04881 9.95117C6.06429 9.96665 6.08266 9.97893 6.10288 9.9873C6.1231 9.99568 6.14478 9.99999 6.16666 9.99999H13.1667C13.2109 9.99999 13.2533 9.98243 13.2845 9.95117C13.3158 9.91992 13.3333 9.87753 13.3333 9.83332V2.83332C13.3333 2.78912 13.3158 2.74673 13.2845 2.71547C13.2533 2.68422 13.2109 2.66666 13.1667 2.66666H6.16666ZM10 12C10 11.8674 10.0527 11.7402 10.1464 11.6464C10.2402 11.5527 10.3674 11.5 10.5 11.5C10.6326 11.5 10.7598 11.5527 10.8536 11.6464C10.9473 11.7402 11 11.8674 11 12V13.1667C11 13.4761 10.8771 13.7728 10.6583 13.9916C10.4395 14.2104 10.1427 14.3333 9.83333 14.3333H2.83333C2.52391 14.3333 2.22717 14.2104 2.00837 13.9916C1.78958 13.7728 1.66666 13.4761 1.66666 13.1667V6.16666C1.66666 5.85724 1.78958 5.56049 2.00837 5.3417C2.22717 5.12291 2.52391 4.99999 2.83333 4.99999H4C4.13261 4.99999 4.25978 5.05267 4.35355 5.14644C4.44732 5.2402 4.5 5.36738 4.5 5.49999C4.5 5.6326 4.44732 5.75978 4.35355 5.85354C4.25978 5.94731 4.13261 5.99999 4 5.99999H2.83333C2.78913 5.99999 2.74674 6.01755 2.71548 6.04881C2.68422 6.08006 2.66666 6.12245 2.66666 6.16666V13.1667C2.66666 13.2109 2.68422 13.2533 2.71548 13.2845C2.74674 13.3158 2.78913 13.3333 2.83333 13.3333H9.83333C9.87753 13.3333 9.91993 13.3158 9.95118 13.2845C9.98244 13.2533 10 13.2109 10 13.1667V12Z"
|
|
18
|
-
})
|
|
19
|
-
}),
|
|
20
|
-
/*#__PURE__*/ _jsx("defs", {
|
|
21
|
-
children: /*#__PURE__*/ _jsx("clipPath", {
|
|
22
|
-
id: "clip0_518_8403",
|
|
23
|
-
children: /*#__PURE__*/ _jsx("rect", {
|
|
24
|
-
width: "16",
|
|
25
|
-
height: "16"
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
]
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
const copySuccessSvg = /*#__PURE__*/ _jsx("i", {
|
|
33
|
-
children: /*#__PURE__*/ _jsx("svg", {
|
|
34
|
-
width: "1em",
|
|
35
|
-
height: "1em",
|
|
36
|
-
shapeRendering: "geometricPrecision",
|
|
37
|
-
fill: "currentColor",
|
|
38
|
-
viewBox: "0 0 12 7",
|
|
39
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
40
|
-
children: /*#__PURE__*/ _jsx("path", {
|
|
41
|
-
d: "M11.2242 0.375687C11.4586 0.610002 11.4586 0.989901 11.2242 1.22422L4.82424 7.62422C4.58992 7.85853 4.21003 7.85853 3.97571 7.62422L0.775712 4.42422C0.541397 4.1899 0.541397 3.81 0.775712 3.57569C1.01003 3.34137 1.38993 3.34137 1.62424 3.57569L4.39998 6.35142L10.3757 0.375687C10.61 0.141373 10.9899 0.141373 11.2242 0.375687Z"
|
|
42
|
-
})
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
const CopyIcon = (props)=>{
|
|
46
|
-
const { prefix, content } = props;
|
|
47
|
-
const [copySuccess, setCopySuccess] = useState(false);
|
|
48
|
-
const timer = useRef(null);
|
|
49
|
-
useEffect(()=>{
|
|
50
|
-
return ()=>{
|
|
51
|
-
clearTimeout(timer.current);
|
|
52
|
-
};
|
|
53
|
-
}, []);
|
|
54
|
-
const getCls = (clsName)=>{
|
|
55
|
-
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
56
|
-
};
|
|
57
|
-
const copyTextClick = ()=>{
|
|
58
|
-
if (copySuccess) return;
|
|
59
|
-
copyText(content);
|
|
60
|
-
setCopySuccess(true);
|
|
61
|
-
clearTimeout(timer.current);
|
|
62
|
-
timer.current = setTimeout(()=>{
|
|
63
|
-
console.log("定时器定时器");
|
|
64
|
-
setCopySuccess(false);
|
|
65
|
-
}, 2000);
|
|
66
|
-
};
|
|
67
|
-
return /*#__PURE__*/ _jsx("div", {
|
|
68
|
-
onClick: ()=>copyTextClick(),
|
|
69
|
-
className: `${getCls("msgItem-action-copy")} ${copySuccess ? getCls("msgItem-action-copy-success") : ""}`,
|
|
70
|
-
children: copySuccess ? copySuccessSvg : copyIconSvg
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
export default CopyIcon;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.msgItem-action-copy {
|
|
2
|
-
cursor: pointer;
|
|
3
|
-
border-radius: 2px;
|
|
4
|
-
display: flex;
|
|
5
|
-
line-height: 1;
|
|
6
|
-
&.msgItem-action-copy-success {
|
|
7
|
-
color: #f4523b;
|
|
8
|
-
background-color: transparent;
|
|
9
|
-
&>i{
|
|
10
|
-
color: #f4523b;
|
|
11
|
-
font-size: 16px;
|
|
12
|
-
transform:scale(0.8);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
& > i {
|
|
16
|
-
color: rgba(140, 140, 140, 1);
|
|
17
|
-
font-size: 16px;
|
|
18
|
-
}
|
|
19
|
-
&:hover {
|
|
20
|
-
background-color: rgba(0, 0, 0, 0.04);
|
|
21
|
-
}
|
|
22
|
-
}
|