bhd-components 0.11.9 → 0.11.11

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.
@@ -10767,7 +10767,15 @@ var CustomerService = function(props) {
10767
10767
  if (beforeTimeStr !== curTimeStr) {
10768
10768
  // 跨天
10769
10769
  // 显示日期+时间
10770
- time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
10770
+ // time = `${timeObj.year}-${timeObj.month}-${timeObj.day} ${timeObj.hours}:${timeObj.minutes}`; //当天第一条展示年月日时分秒
10771
+ //判断是否当天
10772
+ if (curTimeStr === nowTimeStr) {
10773
+ // 当天,显示时间
10774
+ time = "".concat(timeObj.hours, ":").concat(timeObj.minutes);
10775
+ } else {
10776
+ // 非当天,显示日期+时间
10777
+ time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
10778
+ }
10771
10779
  } else {
10772
10780
  //没有跨天 判断是否相隔超过10分钟
10773
10781
  if (new Date(item.createdAt).valueOf() - new Date(beforeTime).valueOf() > 10 * 60 * 1000) {
@@ -15045,7 +15053,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
15045
15053
  sendingId: "",
15046
15054
  isSending: isSending
15047
15055
  });
15048
- var timeRenderCache = useRef(new Map()).current;
15056
+ // const timeRenderCache = useRef(new Map<string, React.ReactNode>()).current;
15049
15057
  // const htmlRenderCache = useRef(new Map<string, React.ReactNode>()).current;
15050
15058
  useImperativeHandle(ref, function() {
15051
15059
  return {
@@ -15560,49 +15568,42 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
15560
15568
  var renderTime = function(item) {
15561
15569
  if (!showTime) return null;
15562
15570
  // 生成缓存键
15563
- var cacheKey = "".concat(item.id);
15571
+ // const cacheKey = `${item.id}`;
15564
15572
  // 检查缓存中是否已有结果
15565
- if (timeRenderCache.has(cacheKey)) {
15566
- return timeRenderCache.get(cacheKey);
15567
- }
15573
+ // if (timeRenderCache.has(cacheKey)) {
15574
+ // return timeRenderCache.get(cacheKey);
15575
+ // }
15568
15576
  var index = recordRef.current.dataSource.findIndex(function(i) {
15569
15577
  return i.id == item.id;
15570
15578
  });
15571
15579
  var timeObj = parseDate(item.createTime);
15572
15580
  var time = null;
15573
15581
  var nowObj = parseDate(new Date().valueOf());
15582
+ var prevItem = recordRef.current.dataSource[index - 1];
15574
15583
  if (timeObj.year === nowObj.year && timeObj.month === nowObj.month && timeObj.day === nowObj.day) {
15575
- time = "".concat(timeObj.hours, ":").concat(timeObj.minutes);
15576
- } else if (index === 0) {
15577
- // 第一项 显示年月日 时分
15578
- // time = "";
15579
- time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
15580
- } else {
15581
- // 非第一项 与上一项进行对比
15582
- var prevItem = recordRef.current.dataSource[index - 1];
15584
+ // 当天显示 时分
15583
15585
  if (prevItem) {
15584
15586
  var beforeTime = prevItem.createTime;
15585
15587
  var beforeTimeObj = parseDate(beforeTime);
15586
- // 判断与上一条数据 是否跨天
15587
- if (timeObj.year !== beforeTimeObj.year || timeObj.month !== beforeTimeObj.month || timeObj.day !== beforeTimeObj.day) {
15588
- // 显示 年月日 时分
15588
+ // 判断与上一条数据 是否超过10分钟
15589
+ if (timeObj.timestamp - beforeTimeObj.timestamp > 10 * 60 * 1000) {
15590
+ time = "".concat(timeObj.hours, ":").concat(timeObj.minutes);
15591
+ }
15592
+ } else {
15593
+ time = "".concat(timeObj.hours, ":").concat(timeObj.minutes);
15594
+ }
15595
+ } else {
15596
+ // 非当天 显示年月日 时分
15597
+ var prevItem1 = recordRef.current.dataSource[index - 1];
15598
+ if (prevItem1) {
15599
+ var beforeTime1 = prevItem1.createTime;
15600
+ var beforeTimeObj1 = parseDate(beforeTime1);
15601
+ // 判断与上一条数据 是否超过10分钟
15602
+ if (timeObj.timestamp - beforeTimeObj1.timestamp > 10 * 60 * 1000) {
15589
15603
  time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
15590
- } else {
15591
- // 没有跨天 判断是否相隔超过10分钟
15592
- if (timeObj.timestamp - beforeTimeObj.timestamp > 10 * 60 * 1000) {
15593
- // 超过10分钟 显示
15594
- var now = new Date();
15595
- // 当天的日期
15596
- var nowTimeStr = "".concat(now.getFullYear(), "-").concat(String(now.getMonth() + 1).padStart(2, "0"), "-").concat(String(now.getDate()).padStart(2, "0"));
15597
- if (nowTimeStr === "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day)) {
15598
- // 是当天 显示 时分
15599
- time = "".concat(timeObj.hours, ":").concat(timeObj.minutes);
15600
- } else {
15601
- // 不是当天 显示 年月日 时分
15602
- time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
15603
- }
15604
- }
15605
15604
  }
15605
+ } else {
15606
+ time = "".concat(timeObj.year, "-").concat(timeObj.month, "-").concat(timeObj.day, " ").concat(timeObj.hours, ":").concat(timeObj.minutes);
15606
15607
  }
15607
15608
  }
15608
15609
  var result = time ? /*#__PURE__*/ jsx("div", {
@@ -15610,7 +15611,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
15610
15611
  children: time
15611
15612
  }) : null;
15612
15613
  // 将结果存入缓存
15613
- timeRenderCache.set(cacheKey, result);
15614
+ // timeRenderCache.set(cacheKey, result);
15614
15615
  return result;
15615
15616
  };
15616
15617
  var findCopyContent = function(e) {