bhd-components 0.10.25 → 0.10.27

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.
@@ -201,6 +201,7 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
201
201
  ...list
202
202
  ];
203
203
  });
204
+ setFirstItemIndex((num)=>num + 1);
204
205
  // timerRef.current.scrollTimer = setTimeout(() => {
205
206
  scrollToBottom();
206
207
  // }, 100);
@@ -219,14 +220,18 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
219
220
  setLoading(false);
220
221
  setDataSource((data)=>{
221
222
  return [
222
- ...data,
223
- ...listObj.dataSource
223
+ ...listObj.dataSource,
224
+ ...data
224
225
  ];
225
226
  });
226
227
  setTotal(listObj.total);
227
228
  setPage(page);
228
229
  setPageSize(pageSize);
229
- setFirstItemIndex(listObj.total - pageSize * (page - 1));
230
+ if (page === 1) {
231
+ setFirstItemIndex(listObj.total);
232
+ } else {
233
+ setFirstItemIndex((prev)=>prev - listObj.dataSource.length);
234
+ }
230
235
  });
231
236
  };
232
237
  const getCls = (clsName)=>{
@@ -512,7 +517,10 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
512
517
  // 只有最后一条才显示底部操作啦 且是左侧消息 且不是招呼语
513
518
  }
514
519
  if (location === "floatTop" || location === "floatBottom") {
515
- if (item.location === "left" && item.id !== "helloMsg" && item.id !== "inputing" && index === recordRef.current.dataSource.length - 1) return null;
520
+ if (item.location === "left" && item.id !== "helloMsg" && item.id !== "inputing" && index === recordRef.current.dataSource.length - 1) // return null;
521
+ return /*#__PURE__*/ _jsx("div", {
522
+ className: `${getCls("msgItem-action-empty")}`
523
+ });
516
524
  // 浮框
517
525
  return /*#__PURE__*/ _jsx("div", {
518
526
  className: `${getCls("msgItem-action-operate")}`,
@@ -204,6 +204,9 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
204
204
  setDataSource(function(data) {
205
205
  return _to_consumable_array(data).concat(_to_consumable_array(list));
206
206
  });
207
+ setFirstItemIndex(function(num) {
208
+ return num + 1;
209
+ });
207
210
  // timerRef.current.scrollTimer = setTimeout(() => {
208
211
  scrollToBottom();
209
212
  // }, 100);
@@ -221,12 +224,18 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
221
224
  return getList(page, pageSize).then(function(listObj) {
222
225
  setLoading(false);
223
226
  setDataSource(function(data) {
224
- return _to_consumable_array(data).concat(_to_consumable_array(listObj.dataSource));
227
+ return _to_consumable_array(listObj.dataSource).concat(_to_consumable_array(data));
225
228
  });
226
229
  setTotal(listObj.total);
227
230
  setPage(page);
228
231
  setPageSize(pageSize);
229
- setFirstItemIndex(listObj.total - pageSize * (page - 1));
232
+ if (page === 1) {
233
+ setFirstItemIndex(listObj.total);
234
+ } else {
235
+ setFirstItemIndex(function(prev) {
236
+ return prev - listObj.dataSource.length;
237
+ });
238
+ }
230
239
  });
231
240
  };
232
241
  var getCls = function(clsName) {
@@ -520,7 +529,10 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
520
529
  // 只有最后一条才显示底部操作啦 且是左侧消息 且不是招呼语
521
530
  }
522
531
  if (location === "floatTop" || location === "floatBottom") {
523
- if (item.location === "left" && item.id !== "helloMsg" && item.id !== "inputing" && index === recordRef.current.dataSource.length - 1) return null;
532
+ if (item.location === "left" && item.id !== "helloMsg" && item.id !== "inputing" && index === recordRef.current.dataSource.length - 1) // return null;
533
+ return /*#__PURE__*/ _jsx("div", {
534
+ className: "".concat(getCls("msgItem-action-empty"))
535
+ });
524
536
  // 浮框
525
537
  return /*#__PURE__*/ _jsx("div", {
526
538
  className: "".concat(getCls("msgItem-action-operate")),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.10.25",
3
+ "version": "0.10.27",
4
4
  "description": "组件功能描述",
5
5
  "config": {
6
6
  "commitizen": {