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.
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 -3085
  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 -360
  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 -689
  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 -376
  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 -666
  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,337 +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 { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
- import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
- import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
6
- import React, { useState, useEffect, useImperativeHandle, forwardRef, useRef } from "react";
7
- import styles from "./index.module.less";
8
- import { fileIconRender, statusRender } from "./fileIcon";
9
- import { CloseCircleFilled, DoubleRightOutlined } from "../../../icons";
10
- import { guidGenerator } from "../../../utils/number";
11
- import { Upload } from "antd";
12
- // 通过文件名 获取文件后缀
13
- var getSuffix = function(fileName) {
14
- return fileName.split(".").pop().toLowerCase();
15
- };
16
- var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
17
- var prefix = props.prefix, fileUpload = props.fileUpload, errorCallback = props.errorCallback, changeFileCanSending = props.changeFileCanSending;
18
- console.log("fileUpload", fileUpload);
19
- var _useState = _sliced_to_array(useState([]), 2), fileList = _useState[0], setFileList = _useState[1];
20
- var _useState1 = _sliced_to_array(useState(1), 2), page = _useState1[0], setPage = _useState1[1];
21
- var _useState2 = _sliced_to_array(useState(5), 2), pageSize = _useState2[0], setPageSize = _useState2[1];
22
- var recordObj = useRef({
23
- page: page,
24
- pageSize: pageSize,
25
- fileList: fileList
26
- });
27
- useEffect(function() {
28
- recordObj.current.page = page;
29
- recordObj.current.pageSize = pageSize;
30
- recordObj.current.fileList = fileList;
31
- }, [
32
- page,
33
- pageSize,
34
- fileList
35
- ]);
36
- useEffect(function() {
37
- var flag = fileList.some(function(item) {
38
- return [
39
- "waiting",
40
- "uploading",
41
- "uploadError",
42
- "waitParse",
43
- "parsing",
44
- "parsingError"
45
- ].includes(item.status);
46
- });
47
- changeFileCanSending(!flag);
48
- }, [
49
- fileList
50
- ]);
51
- useImperativeHandle(ref, function() {
52
- return {
53
- addFile: addFile,
54
- changePage: changePage,
55
- deleteFile: deleteFile,
56
- updateFile: updateFile,
57
- getFileList: function() {
58
- return recordObj.current.fileList;
59
- },
60
- vaildFile: vaildFile,
61
- fileToCustomFile: fileToCustomFile,
62
- clearFileList: clearFileList
63
- };
64
- });
65
- var getCls = function(clsName) {
66
- return styles[clsName] + " " + prefix + "-" + clsName;
67
- };
68
- var clearFileList = function() {
69
- setFileList([]);
70
- };
71
- var vaildFile = function(file, fileId) {
72
- if (fileUpload.maxCount > 0 && recordObj.current.fileList.length > fileUpload.maxCount) {
73
- errorCallback({
74
- type: "fileCountOver",
75
- message: "上传失败,文件数量超过限制"
76
- });
77
- return false;
78
- }
79
- // fileUpload
80
- var acceptList = fileUpload.accept.split(/[.,]/).filter(function(item) {
81
- return !!item;
82
- });
83
- var suffix = getSuffix(file.name);
84
- if (!acceptList.includes(suffix)) {
85
- errorCallback({
86
- type: "fileAcceptError",
87
- message: "上传失败,文件格式错误"
88
- });
89
- return false;
90
- }
91
- if (file.size <= 0) {
92
- errorCallback({
93
- type: "fileSizeEmpty",
94
- message: "上传失败,不支持上传空内容文件"
95
- });
96
- return false;
97
- }
98
- if (file.size > fileUpload.maxSize) {
99
- errorCallback({
100
- type: "fileSizeOver",
101
- message: "上传失败,文件大小超过限制"
102
- });
103
- return false;
104
- }
105
- var flag = recordObj.current.fileList.some(function(item) {
106
- if (fileId) {
107
- return item.name === file.name && item.fileId !== fileId;
108
- } else {
109
- return item.name === file.name;
110
- }
111
- });
112
- // 判断是否有同名文件
113
- if (flag) {
114
- errorCallback({
115
- type: "fileNameExist",
116
- message: "上传失败,文件已存在"
117
- });
118
- return false;
119
- }
120
- return true;
121
- };
122
- var addFile = function(file, fileId) {
123
- console.log("addFileaddFile", file, fileUpload);
124
- if (vaildFile(file, fileId)) {
125
- // 等待上传
126
- // 判断是否存在等待上传的文件
127
- setFileList(function(fileList) {
128
- var uploadingList = fileList.filter(function(item) {
129
- return item.status === "uploading";
130
- });
131
- if (uploadingList.length >= fileUpload.mapUploadCount) {
132
- if (fileId) {
133
- return fileList.map(function(item) {
134
- if (item.fileId === fileId) {
135
- var obj = fileToCustomFile(file, {});
136
- return {
137
- name: obj.name,
138
- suffix: obj.suffix,
139
- fileId: fileId,
140
- url: "",
141
- status: "waiting",
142
- source: file,
143
- size: file.size
144
- };
145
- }
146
- return item;
147
- });
148
- } else {
149
- return _to_consumable_array(fileList).concat([
150
- fileToCustomFile(file, {})
151
- ]);
152
- }
153
- } else {
154
- uploadFile(file);
155
- if (fileId) {
156
- return fileList.map(function(item) {
157
- if (item.fileId === fileId) {
158
- var obj = fileToCustomFile(file, {});
159
- return {
160
- name: obj.name,
161
- suffix: obj.suffix,
162
- fileId: fileId,
163
- url: "",
164
- status: "uploading",
165
- source: file,
166
- size: file.size
167
- };
168
- }
169
- return item;
170
- });
171
- } else {
172
- return _to_consumable_array(fileList).concat([
173
- fileToCustomFile(file, {
174
- status: "uploading"
175
- })
176
- ]);
177
- }
178
- }
179
- });
180
- }
181
- };
182
- var uploadFile = function(file) {
183
- fileUpload.customRequest(file).then(function(res) {
184
- setFileList(function(fileList) {
185
- var list = fileList.map(function(item) {
186
- if (item.source === file) {
187
- return _object_spread({}, item, res);
188
- }
189
- return item;
190
- });
191
- var waitList = list.filter(function(item) {
192
- return item.status === "waiting";
193
- });
194
- if (waitList.length > 0) {
195
- list = list.map(function(item) {
196
- if (item.fileId === waitList[0].fileId) {
197
- return _object_spread_props(_object_spread({}, item), {
198
- status: "uploading"
199
- });
200
- }
201
- return item;
202
- });
203
- uploadFile(waitList[0].source);
204
- }
205
- return list;
206
- });
207
- });
208
- };
209
- // 删除文件
210
- var deleteFile = function(fileId) {
211
- var fileObj = null;
212
- setFileList(function(fileList) {
213
- return fileList.filter(function(item) {
214
- if (item.fileId === fileId) {
215
- fileObj = item;
216
- return true;
217
- }
218
- return false;
219
- });
220
- });
221
- // 删除文件时如果删除的是最后一条 则page-1
222
- var _recordObj_current = recordObj.current, fileList = _recordObj_current.fileList, page = _recordObj_current.page, pageSize = _recordObj_current.pageSize;
223
- var list = fileList.slice((page - 1) * pageSize, page * pageSize);
224
- list = list.filter(function(item) {
225
- return item.fileId !== fileId;
226
- });
227
- if (list.length === 0 && page > 1) {
228
- changePage(page - 1);
229
- }
230
- fileUpload.deleteFileAjax && fileUpload.deleteFileAjax(fileId, fileObj);
231
- };
232
- // 更新文件状态
233
- var updateFile = function(fileId, status) {
234
- setFileList(function(fileList) {
235
- return fileList.map(function(item) {
236
- if (item.fileId === fileId) {
237
- return _object_spread_props(_object_spread({}, item), {
238
- status: status
239
- });
240
- }
241
- return item;
242
- });
243
- });
244
- };
245
- // file to customFile
246
- var fileToCustomFile = function(file, params) {
247
- var customFile = {
248
- name: file.name,
249
- suffix: getSuffix(file.name),
250
- fileId: params.fileId || guidGenerator(),
251
- url: params.url || "",
252
- status: params.status || "waiting",
253
- source: file,
254
- size: file.size
255
- };
256
- return customFile;
257
- };
258
- var changePage = function(page) {
259
- setPage(page);
260
- setPageSize(pageSize);
261
- };
262
- var list = fileList.slice((page - 1) * pageSize, page * pageSize);
263
- if (list.length === 0) return null;
264
- return /*#__PURE__*/ _jsxs("div", {
265
- className: "".concat(getCls("footer-fileList-wrapper")),
266
- children: [
267
- page !== 1 && /*#__PURE__*/ _jsx("div", {
268
- className: "".concat(getCls("footer-fileList-pre")),
269
- onClick: function() {
270
- return changePage(page - 1);
271
- },
272
- children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {
273
- onPointerEnterCapture: undefined,
274
- onPointerLeaveCapture: undefined
275
- })
276
- }),
277
- /*#__PURE__*/ _jsx("div", {
278
- className: "".concat(getCls("footer-fileList-list")),
279
- children: list.map(function(item) {
280
- return /*#__PURE__*/ _jsxs("div", {
281
- className: "".concat(getCls("footer-fileList-listItem")),
282
- children: [
283
- /*#__PURE__*/ _jsx("div", {
284
- className: "".concat(getCls("footer-fileList-listItem-icon")),
285
- children: fileIconRender(item.suffix, fileUpload.iconFileRender)
286
- }),
287
- /*#__PURE__*/ _jsx("div", {
288
- className: "".concat(getCls("footer-fileList-listItem-text")),
289
- title: item.name,
290
- children: item.name
291
- }),
292
- item.status === "uploadError" ? /*#__PURE__*/ _jsx(Upload, {
293
- fileList: [],
294
- accept: fileUpload.accept,
295
- customRequest: function(options) {
296
- return addFile(options.file, item.fileId);
297
- },
298
- multiple: false,
299
- children: /*#__PURE__*/ _jsx("div", {
300
- className: "".concat(getCls("footer-fileList-listItem-status")),
301
- style: {
302
- cursor: "pointer"
303
- },
304
- children: statusRender(item.status, fileUpload.statusText)
305
- })
306
- }) : /*#__PURE__*/ _jsx("div", {
307
- className: "".concat(getCls("footer-fileList-listItem-status")),
308
- children: statusRender(item.status, fileUpload.statusText)
309
- }),
310
- /*#__PURE__*/ _jsx("div", {
311
- className: "".concat(getCls("footer-fileList-listItem-delete")),
312
- children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
313
- onPointerEnterCapture: undefined,
314
- onPointerLeaveCapture: undefined,
315
- onClick: function() {
316
- return deleteFile(item.fileId);
317
- }
318
- })
319
- })
320
- ]
321
- }, item.fileId);
322
- })
323
- }),
324
- page * pageSize < fileList.length && /*#__PURE__*/ _jsx("div", {
325
- className: "".concat(getCls("footer-fileList-next")),
326
- onClick: function() {
327
- return changePage(page + 1);
328
- },
329
- children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {
330
- onPointerEnterCapture: undefined,
331
- onPointerLeaveCapture: undefined
332
- })
333
- })
334
- ]
335
- });
336
- });
337
- 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;