bhd-components 0.10.18 → 0.10.19

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.
@@ -13085,7 +13085,6 @@ var CopyIcon = function(props) {
13085
13085
  setCopySuccess(true);
13086
13086
  clearTimeout(timer.current);
13087
13087
  timer.current = setTimeout(function() {
13088
- console.log("定时器定时器");
13089
13088
  setCopySuccess(false);
13090
13089
  }, 2000);
13091
13090
  };
@@ -13129,9 +13128,7 @@ var ReferencesIcon = function(props) {
13129
13128
  return modules_63b47c51$7[clsName] + " " + prefix + "-" + clsName;
13130
13129
  };
13131
13130
  var clickFn = function() {
13132
- console.log("apiRef", apiRef);
13133
13131
  if (apiRef && apiRef.footerApi) {
13134
- console.log("itemitem", item);
13135
13132
  if (item.type === "file") {
13136
13133
  apiRef.footerApi.setReferences({
13137
13134
  type: "file",
@@ -13141,7 +13138,8 @@ var ReferencesIcon = function(props) {
13141
13138
  fileId: item.id,
13142
13139
  url: "",
13143
13140
  status: "success",
13144
- source: null
13141
+ source: null,
13142
+ size: 0
13145
13143
  },
13146
13144
  source: item
13147
13145
  });
@@ -14384,7 +14382,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
14384
14382
  }
14385
14383
  var list = [];
14386
14384
  if (msg.location === "right" && msg.fileList && msg.fileList.length > 0) {
14387
- console.log("fileList", msg, msg.fileList);
14388
14385
  msg.fileList.map(function(item) {
14389
14386
  list.push({
14390
14387
  type: "file",
@@ -14419,7 +14416,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
14419
14416
  setLoading(true);
14420
14417
  return getList(page, pageSize).then(function(listObj) {
14421
14418
  setLoading(false);
14422
- console.log("listObjlistObj", listObj);
14423
14419
  setDataSource(function(data) {
14424
14420
  return _to_consumable_array(data).concat(_to_consumable_array(listObj.dataSource));
14425
14421
  });
@@ -14559,7 +14555,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
14559
14555
  var topDom = dom.querySelector("." + modules_63b47c51$9["msgItem-action-popover-floatTop"]);
14560
14556
  var bottomDom = dom.querySelector("." + modules_63b47c51$9["msgItem-action-popover-floatBottom"]);
14561
14557
  if (!topDom || !bottomDom) return;
14562
- console.log("itemitem", dom, container);
14563
14558
  var con_obj = container.getBoundingClientRect(); // 外层盒子
14564
14559
  var dom_obj = dom.getBoundingClientRect(); // 鼠标滑过元素
14565
14560
  var y = dom_obj.y - con_obj.y;
@@ -14575,7 +14570,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
14575
14570
  topDom.style.cssText = "display:flex";
14576
14571
  }
14577
14572
  } else {
14578
- console.log("yyyy", y, dom_obj, con_obj, y + dom_obj.height < con_obj.height);
14579
14573
  // 元素top不在可视区域内
14580
14574
  if (y + dom_obj.height < con_obj.height) {
14581
14575
  // 底部在可视区域内
@@ -15006,10 +15000,10 @@ var getSuffix = function(fileName) {
15006
15000
  };
15007
15001
  var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15008
15002
  var prefix = props.prefix, fileUpload = props.fileUpload, errorCallback = props.errorCallback, changeFileCanSending = props.changeFileCanSending, onChange = props.onChange;
15009
- console.log("fileUpload", fileUpload);
15010
15003
  var _useState = _sliced_to_array(useState([]), 2), fileList = _useState[0], setFileList = _useState[1];
15011
15004
  var _useState1 = _sliced_to_array(useState(1), 2), page = _useState1[0], setPage = _useState1[1];
15012
15005
  var _useState2 = _sliced_to_array(useState(5), 2), pageSize = _useState2[0], setPageSize = _useState2[1];
15006
+ var recordListLength = useRef(0);
15013
15007
  var recordObj = useRef({
15014
15008
  page: page,
15015
15009
  pageSize: pageSize,
@@ -15062,10 +15056,11 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15062
15056
  return modules_63b47c51$1[clsName] + " " + prefix + "-" + clsName;
15063
15057
  };
15064
15058
  var clearFileList = function() {
15059
+ recordListLength.current = 0;
15065
15060
  setFileList([]);
15066
15061
  };
15067
15062
  var vaildFile = function(file, fileId) {
15068
- if (fileUpload.maxCount > 0 && recordObj.current.fileList.length > fileUpload.maxCount) {
15063
+ if (fileUpload.maxCount > 0 && recordListLength.current + 1 > fileUpload.maxCount) {
15069
15064
  errorCallback({
15070
15065
  type: "fileCountOver",
15071
15066
  message: "上传失败,文件数量超过限制"
@@ -15116,8 +15111,8 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15116
15111
  return true;
15117
15112
  };
15118
15113
  var addFile = function(file, fileId) {
15119
- console.log("addFileaddFile", file, fileUpload);
15120
15114
  if (vaildFile(file, fileId)) {
15115
+ recordListLength.current += 1;
15121
15116
  // 等待上传
15122
15117
  // 判断是否存在等待上传的文件
15123
15118
  setFileList(function(fileList) {
@@ -15205,13 +15200,14 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15205
15200
  // 删除文件
15206
15201
  var deleteFile = function(fileId) {
15207
15202
  var fileObj = null;
15203
+ recordListLength.current -= 0;
15208
15204
  setFileList(function(fileList) {
15209
15205
  return fileList.filter(function(item) {
15210
15206
  if (item.fileId === fileId) {
15211
15207
  fileObj = item;
15212
- return true;
15208
+ return false;
15213
15209
  }
15214
- return false;
15210
+ return true;
15215
15211
  });
15216
15212
  });
15217
15213
  // 删除文件时如果删除的是最后一条 则page-1
@@ -15255,6 +15251,24 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15255
15251
  setPage(page);
15256
15252
  setPageSize(pageSize);
15257
15253
  };
15254
+ var retryUploadFile = function(fileItem) {
15255
+ setFileList(function(fileList) {
15256
+ var uploadingList = fileList.filter(function(item) {
15257
+ return item.status === "uploading";
15258
+ });
15259
+ return fileList.map(function(item) {
15260
+ if (fileItem.fileId === item.fileId) {
15261
+ if (uploadingList.length >= fileUpload.mapUploadCount) {
15262
+ item.status = "waiting";
15263
+ } else {
15264
+ item.status = "uploading";
15265
+ uploadFile(item.source);
15266
+ }
15267
+ }
15268
+ return item;
15269
+ });
15270
+ });
15271
+ };
15258
15272
  var list = fileList.slice((page - 1) * pageSize, page * pageSize);
15259
15273
  if (list.length === 0) return null;
15260
15274
  return /*#__PURE__*/ jsxs("div", {
@@ -15265,10 +15279,7 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15265
15279
  onClick: function() {
15266
15280
  return changePage(page - 1);
15267
15281
  },
15268
- children: /*#__PURE__*/ jsx(DoubleRightOutlined, {
15269
- onPointerEnterCapture: undefined,
15270
- onPointerLeaveCapture: undefined
15271
- })
15282
+ children: /*#__PURE__*/ jsx(DoubleRightOutlined, {})
15272
15283
  }),
15273
15284
  /*#__PURE__*/ jsx("div", {
15274
15285
  className: "".concat(getCls("footer-fileList-list")),
@@ -15285,20 +15296,30 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15285
15296
  title: item.name,
15286
15297
  children: item.name
15287
15298
  }),
15288
- item.status === "uploadError" ? /*#__PURE__*/ jsx(Upload, {
15289
- fileList: [],
15290
- accept: fileUpload.accept,
15291
- customRequest: function(options) {
15292
- return addFile(options.file, item.fileId);
15299
+ item.status === "uploadError" ? // <Upload
15300
+ // fileList={[]}
15301
+ // accept={fileUpload.accept}
15302
+ // customRequest={(options: any) =>
15303
+ // addFile(options.file, item.fileId)
15304
+ // }
15305
+ // multiple={false}
15306
+ // >
15307
+ // <div
15308
+ // className={`${getCls("footer-fileList-listItem-status")}`}
15309
+ // style={{ cursor: "pointer" }}
15310
+ // >
15311
+ // {statusRender(item.status, fileUpload.statusText)}
15312
+ // </div>
15313
+ // </Upload>
15314
+ /*#__PURE__*/ jsx("div", {
15315
+ className: "".concat(getCls("footer-fileList-listItem-status")),
15316
+ style: {
15317
+ cursor: "pointer"
15293
15318
  },
15294
- multiple: false,
15295
- children: /*#__PURE__*/ jsx("div", {
15296
- className: "".concat(getCls("footer-fileList-listItem-status")),
15297
- style: {
15298
- cursor: "pointer"
15299
- },
15300
- children: statusRender(item.status, fileUpload.statusText)
15301
- })
15319
+ onClick: function() {
15320
+ return retryUploadFile(item);
15321
+ },
15322
+ children: statusRender(item.status, fileUpload.statusText)
15302
15323
  }) : /*#__PURE__*/ jsx("div", {
15303
15324
  className: "".concat(getCls("footer-fileList-listItem-status")),
15304
15325
  children: statusRender(item.status, fileUpload.statusText)
@@ -15306,8 +15327,6 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15306
15327
  /*#__PURE__*/ jsx("div", {
15307
15328
  className: "".concat(getCls("footer-fileList-listItem-delete")),
15308
15329
  children: /*#__PURE__*/ jsx(CloseCircleFilled, {
15309
- onPointerEnterCapture: undefined,
15310
- onPointerLeaveCapture: undefined,
15311
15330
  onClick: function() {
15312
15331
  return deleteFile(item.fileId);
15313
15332
  }
@@ -15322,10 +15341,7 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
15322
15341
  onClick: function() {
15323
15342
  return changePage(page + 1);
15324
15343
  },
15325
- children: /*#__PURE__*/ jsx(DoubleRightOutlined, {
15326
- onPointerEnterCapture: undefined,
15327
- onPointerLeaveCapture: undefined
15328
- })
15344
+ children: /*#__PURE__*/ jsx(DoubleRightOutlined, {})
15329
15345
  })
15330
15346
  ]
15331
15347
  });
@@ -15354,8 +15370,6 @@ var References = function(props) {
15354
15370
  /*#__PURE__*/ jsx("div", {
15355
15371
  className: "".concat(getCls("footerReferences_right")),
15356
15372
  children: /*#__PURE__*/ jsx(CloseCircleFilled, {
15357
- onPointerEnterCapture: undefined,
15358
- onPointerLeaveCapture: undefined,
15359
15373
  onClick: function() {
15360
15374
  return deleteReferences();
15361
15375
  }
@@ -15388,8 +15402,6 @@ var References = function(props) {
15388
15402
  /*#__PURE__*/ jsx("div", {
15389
15403
  className: "".concat(getCls("footerReferences_right")),
15390
15404
  children: /*#__PURE__*/ jsx(CloseCircleFilled, {
15391
- onPointerEnterCapture: undefined,
15392
- onPointerLeaveCapture: undefined,
15393
15405
  onClick: function() {
15394
15406
  return deleteReferences();
15395
15407
  }
@@ -15545,7 +15557,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
15545
15557
  fileUpload: fileUpload,
15546
15558
  customRequest: function(options) {
15547
15559
  var _fileListRef_current;
15548
- console.log("customRequestcustomRequest", options);
15549
15560
  (_fileListRef_current = fileListRef.current) === null || _fileListRef_current === void 0 ? void 0 : _fileListRef_current.addFile(options.file);
15550
15561
  }
15551
15562
  });
@@ -15594,7 +15605,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
15594
15605
  };
15595
15606
  // 发现消息
15596
15607
  var sendMsg = function(value) {
15597
- console.log("发送消息:", value);
15598
15608
  if (value.trim().length === 0) {
15599
15609
  throw new Error("消息不能为空");
15600
15610
  }
@@ -15639,7 +15649,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
15639
15649
  } : _sendMsgAjaxParams_beforeSendMsg;
15640
15650
  ctrl.current = new AbortController();
15641
15651
  // apiRef
15642
- console.log("apiRef", apiRef);
15643
15652
  var msgId = "inputing";
15644
15653
  var createTime = new Date().getTime();
15645
15654
  if (recordObj) {
@@ -15702,7 +15711,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
15702
15711
  apiRef.contentApi.recordMsg(recordMsgObj);
15703
15712
  }
15704
15713
  apiRef.contentApi.setSendingId("");
15705
- console.log("onclose: ", recordMsgObj);
15706
15714
  };
15707
15715
  fetchEventSource(url, _object_spread({
15708
15716
  method: method,
@@ -15754,7 +15762,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
15754
15762
  if (recordMsgObj.id) {
15755
15763
  apiRef.contentApi.recordMsg(recordMsgObj);
15756
15764
  }
15757
- console.log("onerror: ", err);
15758
15765
  }
15759
15766
  }, coverProps));
15760
15767
  };