bhd-components 0.10.10 → 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.
Files changed (116) hide show
  1. package/README.md +1 -1
  2. package/dist/index.esm.es5.development.css +0 -766
  3. package/dist/index.esm.es5.development.js +162 -3086
  4. package/dist/index.esm.es5.production.css +1 -1
  5. package/dist/index.esm.es5.production.js +1 -1
  6. package/dist/vendor.esm.es5.development.js +1100 -2515
  7. package/dist/vendor.esm.es5.production.js +136 -136
  8. package/es2017/customerService/index.js +3 -1
  9. package/es2017/index.d.ts +0 -1
  10. package/es2017/index.js +0 -1
  11. package/es2017/utils/Date.d.ts +1 -2
  12. package/es2017/utils/Date.js +1 -2
  13. package/es2017/utils/dom.d.ts +1 -4
  14. package/es2017/utils/dom.js +1 -44
  15. package/esm/customerService/index.js +3 -1
  16. package/esm/index.d.ts +0 -1
  17. package/esm/index.js +0 -1
  18. package/esm/utils/Date.d.ts +1 -2
  19. package/esm/utils/Date.js +1 -2
  20. package/esm/utils/dom.d.ts +1 -4
  21. package/esm/utils/dom.js +1 -45
  22. package/package.json +1 -2
  23. package/es2017/AIMessageList/components/content/index.d.ts +0 -4
  24. package/es2017/AIMessageList/components/content/index.js +0 -29
  25. package/es2017/AIMessageList/components/content/index.module.less +0 -8
  26. package/es2017/AIMessageList/components/copyIcon/index.d.ts +0 -7
  27. package/es2017/AIMessageList/components/copyIcon/index.js +0 -73
  28. package/es2017/AIMessageList/components/copyIcon/index.module.less +0 -22
  29. package/es2017/AIMessageList/components/errorCallback/index.d.ts +0 -3
  30. package/es2017/AIMessageList/components/errorCallback/index.js +0 -6
  31. package/es2017/AIMessageList/components/fileList/fileIcon.d.ts +0 -3
  32. package/es2017/AIMessageList/components/fileList/fileIcon.js +0 -970
  33. package/es2017/AIMessageList/components/fileList/index.d.ts +0 -4
  34. package/es2017/AIMessageList/components/fileList/index.js +0 -315
  35. package/es2017/AIMessageList/components/fileList/index.module.less +0 -95
  36. package/es2017/AIMessageList/components/footer/index.d.ts +0 -10
  37. package/es2017/AIMessageList/components/footer/index.js +0 -358
  38. package/es2017/AIMessageList/components/footer/index.module.less +0 -51
  39. package/es2017/AIMessageList/components/header/index.d.ts +0 -9
  40. package/es2017/AIMessageList/components/header/index.js +0 -94
  41. package/es2017/AIMessageList/components/header/index.module.less +0 -31
  42. package/es2017/AIMessageList/components/referencesIcon/index.d.ts +0 -9
  43. package/es2017/AIMessageList/components/referencesIcon/index.js +0 -63
  44. package/es2017/AIMessageList/components/referencesIcon/index.module.less +0 -13
  45. package/es2017/AIMessageList/components/refreshBtn/index.d.ts +0 -4
  46. package/es2017/AIMessageList/components/refreshBtn/index.js +0 -29
  47. package/es2017/AIMessageList/components/refreshBtn/index.module.less +0 -12
  48. package/es2017/AIMessageList/components/remarkBtn/index.d.ts +0 -4
  49. package/es2017/AIMessageList/components/remarkBtn/index.js +0 -51
  50. package/es2017/AIMessageList/components/remarkBtn/index.module.less +0 -13
  51. package/es2017/AIMessageList/components/renderReferrnce/index.d.ts +0 -10
  52. package/es2017/AIMessageList/components/renderReferrnce/index.js +0 -68
  53. package/es2017/AIMessageList/components/renderReferrnce/index.module.less +0 -64
  54. package/es2017/AIMessageList/components/sendBtn/index.d.ts +0 -4
  55. package/es2017/AIMessageList/components/sendBtn/index.js +0 -51
  56. package/es2017/AIMessageList/components/sendBtn/index.module.less +0 -25
  57. package/es2017/AIMessageList/components/uplodaFileBtn/index.d.ts +0 -4
  58. package/es2017/AIMessageList/components/uplodaFileBtn/index.js +0 -33
  59. package/es2017/AIMessageList/components/uplodaFileBtn/index.module.less +0 -5
  60. package/es2017/AIMessageList/components/virtuosoList/index.d.ts +0 -5
  61. package/es2017/AIMessageList/components/virtuosoList/index.js +0 -694
  62. package/es2017/AIMessageList/components/virtuosoList/index.module.less +0 -467
  63. package/es2017/AIMessageList/index.d.ts +0 -4
  64. package/es2017/AIMessageList/index.js +0 -58
  65. package/es2017/AIMessageList/index.module.less +0 -20
  66. package/es2017/AIMessageList/type.d.ts +0 -306
  67. package/es2017/images/loading2.js +0 -2
  68. package/es2017/utils/number.d.ts +0 -1
  69. package/es2017/utils/number.js +0 -9
  70. package/esm/AIMessageList/components/content/index.d.ts +0 -4
  71. package/esm/AIMessageList/components/content/index.js +0 -29
  72. package/esm/AIMessageList/components/content/index.module.less +0 -8
  73. package/esm/AIMessageList/components/copyIcon/index.d.ts +0 -7
  74. package/esm/AIMessageList/components/copyIcon/index.js +0 -76
  75. package/esm/AIMessageList/components/copyIcon/index.module.less +0 -22
  76. package/esm/AIMessageList/components/errorCallback/index.d.ts +0 -3
  77. package/esm/AIMessageList/components/errorCallback/index.js +0 -6
  78. package/esm/AIMessageList/components/fileList/fileIcon.d.ts +0 -3
  79. package/esm/AIMessageList/components/fileList/fileIcon.js +0 -970
  80. package/esm/AIMessageList/components/fileList/index.d.ts +0 -4
  81. package/esm/AIMessageList/components/fileList/index.js +0 -337
  82. package/esm/AIMessageList/components/fileList/index.module.less +0 -95
  83. package/esm/AIMessageList/components/footer/index.d.ts +0 -10
  84. package/esm/AIMessageList/components/footer/index.js +0 -372
  85. package/esm/AIMessageList/components/footer/index.module.less +0 -51
  86. package/esm/AIMessageList/components/header/index.d.ts +0 -9
  87. package/esm/AIMessageList/components/header/index.js +0 -96
  88. package/esm/AIMessageList/components/header/index.module.less +0 -31
  89. package/esm/AIMessageList/components/referencesIcon/index.d.ts +0 -9
  90. package/esm/AIMessageList/components/referencesIcon/index.js +0 -65
  91. package/esm/AIMessageList/components/referencesIcon/index.module.less +0 -13
  92. package/esm/AIMessageList/components/refreshBtn/index.d.ts +0 -4
  93. package/esm/AIMessageList/components/refreshBtn/index.js +0 -31
  94. package/esm/AIMessageList/components/refreshBtn/index.module.less +0 -12
  95. package/esm/AIMessageList/components/remarkBtn/index.d.ts +0 -4
  96. package/esm/AIMessageList/components/remarkBtn/index.js +0 -51
  97. package/esm/AIMessageList/components/remarkBtn/index.module.less +0 -13
  98. package/esm/AIMessageList/components/renderReferrnce/index.d.ts +0 -10
  99. package/esm/AIMessageList/components/renderReferrnce/index.js +0 -72
  100. package/esm/AIMessageList/components/renderReferrnce/index.module.less +0 -64
  101. package/esm/AIMessageList/components/sendBtn/index.d.ts +0 -4
  102. package/esm/AIMessageList/components/sendBtn/index.js +0 -53
  103. package/esm/AIMessageList/components/sendBtn/index.module.less +0 -25
  104. package/esm/AIMessageList/components/uplodaFileBtn/index.d.ts +0 -4
  105. package/esm/AIMessageList/components/uplodaFileBtn/index.js +0 -33
  106. package/esm/AIMessageList/components/uplodaFileBtn/index.module.less +0 -5
  107. package/esm/AIMessageList/components/virtuosoList/index.d.ts +0 -5
  108. package/esm/AIMessageList/components/virtuosoList/index.js +0 -671
  109. package/esm/AIMessageList/components/virtuosoList/index.module.less +0 -467
  110. package/esm/AIMessageList/index.d.ts +0 -4
  111. package/esm/AIMessageList/index.js +0 -58
  112. package/esm/AIMessageList/index.module.less +0 -20
  113. package/esm/AIMessageList/type.d.ts +0 -306
  114. package/esm/images/loading2.js +0 -2
  115. package/esm/utils/number.d.ts +0 -1
  116. package/esm/utils/number.js +0 -9
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import type { fileListProps, FileListRefProps } from "../../type";
3
- declare const FileList: React.ForwardRefExoticComponent<fileListProps & React.RefAttributes<FileListRefProps>>;
4
- export default FileList;
@@ -1,315 +0,0 @@
1
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
- import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
- import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
4
- import React, { useState, useEffect, useImperativeHandle, forwardRef, useRef } from "react";
5
- import styles from "./index.module.less";
6
- import { fileIconRender, statusRender } from "./fileIcon";
7
- import { CloseCircleFilled, DoubleRightOutlined } from "../../../icons";
8
- import { guidGenerator } from "../../../utils/number";
9
- import { Upload } from "antd";
10
- // 通过文件名 获取文件后缀
11
- const getSuffix = (fileName)=>{
12
- return fileName.split(".").pop().toLowerCase();
13
- };
14
- const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
15
- const { prefix, fileUpload, errorCallback, changeFileCanSending } = props;
16
- console.log("fileUpload", fileUpload);
17
- const [fileList, setFileList] = useState([]);
18
- const [page, setPage] = useState(1);
19
- const [pageSize, setPageSize] = useState(5);
20
- const recordObj = useRef({
21
- page: page,
22
- pageSize: pageSize,
23
- fileList: fileList
24
- });
25
- useEffect(()=>{
26
- recordObj.current.page = page;
27
- recordObj.current.pageSize = pageSize;
28
- recordObj.current.fileList = fileList;
29
- }, [
30
- page,
31
- pageSize,
32
- fileList
33
- ]);
34
- useEffect(()=>{
35
- let flag = fileList.some((item)=>[
36
- "waiting",
37
- "uploading",
38
- "uploadError",
39
- "waitParse",
40
- "parsing",
41
- "parsingError"
42
- ].includes(item.status));
43
- changeFileCanSending(!flag);
44
- }, [
45
- fileList
46
- ]);
47
- useImperativeHandle(ref, ()=>{
48
- return {
49
- addFile,
50
- changePage,
51
- deleteFile,
52
- updateFile,
53
- getFileList: ()=>recordObj.current.fileList,
54
- vaildFile,
55
- fileToCustomFile,
56
- clearFileList
57
- };
58
- });
59
- const getCls = (clsName)=>{
60
- return styles[clsName] + " " + prefix + "-" + clsName;
61
- };
62
- const clearFileList = ()=>{
63
- setFileList([]);
64
- };
65
- const vaildFile = (file, fileId)=>{
66
- if (fileUpload.maxCount > 0 && recordObj.current.fileList.length > fileUpload.maxCount) {
67
- errorCallback({
68
- type: "fileCountOver",
69
- message: "上传失败,文件数量超过限制"
70
- });
71
- return false;
72
- }
73
- // fileUpload
74
- let acceptList = fileUpload.accept.split(/[.,]/).filter((item)=>!!item);
75
- let suffix = getSuffix(file.name);
76
- if (!acceptList.includes(suffix)) {
77
- errorCallback({
78
- type: "fileAcceptError",
79
- message: "上传失败,文件格式错误"
80
- });
81
- return false;
82
- }
83
- if (file.size <= 0) {
84
- errorCallback({
85
- type: "fileSizeEmpty",
86
- message: "上传失败,不支持上传空内容文件"
87
- });
88
- return false;
89
- }
90
- if (file.size > fileUpload.maxSize) {
91
- errorCallback({
92
- type: "fileSizeOver",
93
- message: "上传失败,文件大小超过限制"
94
- });
95
- return false;
96
- }
97
- let flag = recordObj.current.fileList.some((item)=>{
98
- if (fileId) {
99
- return item.name === file.name && item.fileId !== fileId;
100
- } else {
101
- return item.name === file.name;
102
- }
103
- });
104
- // 判断是否有同名文件
105
- if (flag) {
106
- errorCallback({
107
- type: "fileNameExist",
108
- message: "上传失败,文件已存在"
109
- });
110
- return false;
111
- }
112
- return true;
113
- };
114
- const addFile = (file, fileId)=>{
115
- console.log("addFileaddFile", file, fileUpload);
116
- if (vaildFile(file, fileId)) {
117
- // 等待上传
118
- // 判断是否存在等待上传的文件
119
- setFileList((fileList)=>{
120
- let uploadingList = fileList.filter((item)=>item.status === "uploading");
121
- if (uploadingList.length >= fileUpload.mapUploadCount) {
122
- if (fileId) {
123
- return fileList.map((item)=>{
124
- if (item.fileId === fileId) {
125
- let obj = fileToCustomFile(file, {});
126
- return {
127
- name: obj.name,
128
- suffix: obj.suffix,
129
- fileId: fileId,
130
- url: "",
131
- status: "waiting",
132
- source: file,
133
- size: file.size
134
- };
135
- }
136
- return item;
137
- });
138
- } else {
139
- return [
140
- ...fileList,
141
- fileToCustomFile(file, {})
142
- ];
143
- }
144
- } else {
145
- uploadFile(file);
146
- if (fileId) {
147
- return fileList.map((item)=>{
148
- if (item.fileId === fileId) {
149
- let obj = fileToCustomFile(file, {});
150
- return {
151
- name: obj.name,
152
- suffix: obj.suffix,
153
- fileId: fileId,
154
- url: "",
155
- status: "uploading",
156
- source: file,
157
- size: file.size
158
- };
159
- }
160
- return item;
161
- });
162
- } else {
163
- return [
164
- ...fileList,
165
- fileToCustomFile(file, {
166
- status: "uploading"
167
- })
168
- ];
169
- }
170
- }
171
- });
172
- }
173
- };
174
- const uploadFile = (file)=>{
175
- fileUpload.customRequest(file).then((res)=>{
176
- setFileList((fileList)=>{
177
- let list = fileList.map((item)=>{
178
- if (item.source === file) {
179
- return _object_spread({}, item, res);
180
- }
181
- return item;
182
- });
183
- let waitList = list.filter((item)=>item.status === "waiting");
184
- if (waitList.length > 0) {
185
- list = list.map((item)=>{
186
- if (item.fileId === waitList[0].fileId) {
187
- return _object_spread_props(_object_spread({}, item), {
188
- status: "uploading"
189
- });
190
- }
191
- return item;
192
- });
193
- uploadFile(waitList[0].source);
194
- }
195
- return list;
196
- });
197
- });
198
- };
199
- // 删除文件
200
- const deleteFile = (fileId)=>{
201
- let fileObj = null;
202
- setFileList((fileList)=>{
203
- return fileList.filter((item)=>{
204
- if (item.fileId === fileId) {
205
- fileObj = item;
206
- return true;
207
- }
208
- return false;
209
- });
210
- });
211
- // 删除文件时如果删除的是最后一条 则page-1
212
- const { fileList, page, pageSize } = recordObj.current;
213
- let list = fileList.slice((page - 1) * pageSize, page * pageSize);
214
- list = list.filter((item)=>item.fileId !== fileId);
215
- if (list.length === 0 && page > 1) {
216
- changePage(page - 1);
217
- }
218
- fileUpload.deleteFileAjax && fileUpload.deleteFileAjax(fileId, fileObj);
219
- };
220
- // 更新文件状态
221
- const updateFile = (fileId, status)=>{
222
- setFileList((fileList)=>fileList.map((item)=>{
223
- if (item.fileId === fileId) {
224
- return _object_spread_props(_object_spread({}, item), {
225
- status: status
226
- });
227
- }
228
- return item;
229
- }));
230
- };
231
- // file to customFile
232
- const fileToCustomFile = (file, params)=>{
233
- let customFile = {
234
- name: file.name,
235
- suffix: getSuffix(file.name),
236
- fileId: params.fileId || guidGenerator(),
237
- url: params.url || "",
238
- status: params.status || "waiting",
239
- source: file,
240
- size: file.size
241
- };
242
- return customFile;
243
- };
244
- const changePage = (page)=>{
245
- setPage(page);
246
- setPageSize(pageSize);
247
- };
248
- const list = fileList.slice((page - 1) * pageSize, page * pageSize);
249
- if (list.length === 0) return null;
250
- return /*#__PURE__*/ _jsxs("div", {
251
- className: `${getCls("footer-fileList-wrapper")}`,
252
- children: [
253
- page !== 1 && /*#__PURE__*/ _jsx("div", {
254
- className: `${getCls("footer-fileList-pre")}`,
255
- onClick: ()=>changePage(page - 1),
256
- children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {
257
- onPointerEnterCapture: undefined,
258
- onPointerLeaveCapture: undefined
259
- })
260
- }),
261
- /*#__PURE__*/ _jsx("div", {
262
- className: `${getCls("footer-fileList-list")}`,
263
- children: list.map((item)=>{
264
- return /*#__PURE__*/ _jsxs("div", {
265
- className: `${getCls("footer-fileList-listItem")}`,
266
- children: [
267
- /*#__PURE__*/ _jsx("div", {
268
- className: `${getCls("footer-fileList-listItem-icon")}`,
269
- children: fileIconRender(item.suffix, fileUpload.iconFileRender)
270
- }),
271
- /*#__PURE__*/ _jsx("div", {
272
- className: `${getCls("footer-fileList-listItem-text")}`,
273
- title: item.name,
274
- children: item.name
275
- }),
276
- item.status === "uploadError" ? /*#__PURE__*/ _jsx(Upload, {
277
- fileList: [],
278
- accept: fileUpload.accept,
279
- customRequest: (options)=>addFile(options.file, item.fileId),
280
- multiple: false,
281
- children: /*#__PURE__*/ _jsx("div", {
282
- className: `${getCls("footer-fileList-listItem-status")}`,
283
- style: {
284
- cursor: "pointer"
285
- },
286
- children: statusRender(item.status, fileUpload.statusText)
287
- })
288
- }) : /*#__PURE__*/ _jsx("div", {
289
- className: `${getCls("footer-fileList-listItem-status")}`,
290
- children: statusRender(item.status, fileUpload.statusText)
291
- }),
292
- /*#__PURE__*/ _jsx("div", {
293
- className: `${getCls("footer-fileList-listItem-delete")}`,
294
- children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
295
- onPointerEnterCapture: undefined,
296
- onPointerLeaveCapture: undefined,
297
- onClick: ()=>deleteFile(item.fileId)
298
- })
299
- })
300
- ]
301
- }, item.fileId);
302
- })
303
- }),
304
- page * pageSize < fileList.length && /*#__PURE__*/ _jsx("div", {
305
- className: `${getCls("footer-fileList-next")}`,
306
- onClick: ()=>changePage(page + 1),
307
- children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {
308
- onPointerEnterCapture: undefined,
309
- onPointerLeaveCapture: undefined
310
- })
311
- })
312
- ]
313
- });
314
- });
315
- export default FileList;
@@ -1,95 +0,0 @@
1
- .footer-fileList-wrapper {
2
- width: 100%;
3
- position: relative;
4
- padding: 12px 16px;
5
- box-sizing: border-box;
6
- .footer-fileList-list {
7
- width: 100%;
8
- display: flex;
9
- flex-direction: column;
10
- gap: 8px;
11
- .footer-fileList-listItem {
12
- width: 100%;
13
- position: relative;
14
- display: flex;
15
- overflow: hidden;
16
- padding: 8px 12px;
17
- box-sizing: border-box;
18
- gap: 12px;
19
- border-radius: 8px;
20
- border: 1px solid #ebebeb;
21
- background: rgba(0, 0, 0, 0.02);
22
- align-items: center;
23
- .footer-fileList-listItem-icon {
24
- flex-shrink: 0;
25
- & > i {
26
- font-size: 24px;
27
- display: flex;
28
- }
29
- }
30
- .footer-fileList-listItem-text {
31
- flex: 1;
32
- overflow: hidden;
33
- width: 100%;
34
- overflow: hidden;
35
- text-overflow: ellipsis;
36
- color: rgba(0, 0, 0, 0.65);
37
- font-size: 14px;
38
- font-weight: 400;
39
- white-space: nowrap;
40
- }
41
- .footer-fileList-listItem-status {
42
- flex-shrink: 0;
43
- }
44
- .footer-fileList-listItem-delete {
45
- position: absolute;
46
- right: 0;
47
- top: 0;
48
- display: none;
49
- cursor: pointer;
50
- }
51
-
52
- &:hover {
53
- background: rgba(0, 0, 0, 0.06);
54
- .footer-fileList-listItem-delete {
55
- display: flex;
56
- }
57
- }
58
- }
59
- }
60
- .footer-fileList-pre {
61
- display: flex;
62
- justify-content: center;
63
- position: absolute;
64
- left: 50%;
65
- transform: translateX(-50%);
66
- top: -8px;
67
- z-index: 2;
68
- :global {
69
- .anticon-double-right {
70
- font-size: 16px;
71
- transform: rotate(-90deg);
72
- color: #595959;
73
- cursor: pointer;
74
- }
75
- }
76
- }
77
-
78
- .footer-fileList-next {
79
- display: flex;
80
- justify-content: center;
81
- position: absolute;
82
- left: 50%;
83
- transform: translateX(-50%);
84
- bottom: -8px;
85
- z-index: 2;
86
- :global {
87
- .anticon-double-right {
88
- font-size: 16px;
89
- transform: rotate(90deg);
90
- color: #595959;
91
- cursor: pointer;
92
- }
93
- }
94
- }
95
- }
@@ -1,10 +0,0 @@
1
- import React from "react";
2
- import type { footerConfigProps, footerRefProps, errorMessageProps, AIMessageListRefProps } from "../../type";
3
- interface IProps {
4
- footerConfig: footerConfigProps;
5
- prefix: string;
6
- errorCallback: (error: errorMessageProps) => void;
7
- apiRef: AIMessageListRefProps;
8
- }
9
- declare const Footer: React.ForwardRefExoticComponent<IProps & React.RefAttributes<footerRefProps>>;
10
- export default Footer;