ht-components-taro-v3 1.0.6 → 1.0.8

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.
package/README.md CHANGED
@@ -19,4 +19,6 @@ h5使用esm,小程序使用cjs
19
19
  | limit | number | 每次请求的数据条数,默认10 | - | 10 |
20
20
  | dealReqDataFn | function | 请求回来的数据处理函数 | - | - |
21
21
  | onReqErrorFn | function | 请求失败回调函数 | - | - |
22
+ | renderEmptyFn | function | 无数据时的空状态渲染函数 | - | - |
23
+
22
24
 
@@ -1 +1 @@
1
- .ht-scroll-component-view{height:100%;width:100%}.ht-scroll-component-view .ht-scroll-component-inner{box-sizing:border-box;display:flex;flex-wrap:wrap;width:100%}.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view{align-items:center;color:#9a9b9c;display:flex;font-family:PingFangSC-Regular,PingFang SC;font-size:40px;font-weight:400;justify-content:center;width:100%}@keyframes rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view .request-loading-icon{animation:rotate 3s linear infinite;display:block;height:40px;margin-right:8px;width:40px}.ht-scroll-component-view .ht-scroll-component-inner .no-more-data-tip{color:#9a9b9c;font-family:PingFangSC-Regular,PingFang SC;font-size:40px;font-weight:400;line-height:58px;text-align:center;width:100%}
1
+ .ht-scroll-component-view{height:100%;width:100%}.ht-scroll-component-view .ht-scroll-component-inner{box-sizing:border-box;display:flex;flex-wrap:wrap;width:100%}.ht-scroll-component-view .ht-scroll-component-inner .blank-data-view{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;padding:200px 0;text-align:center;width:100%}.ht-scroll-component-view .ht-scroll-component-inner .blank-data-view .blank-data-img{display:block;height:220px;margin-bottom:20px;width:220px}.ht-scroll-component-view .ht-scroll-component-inner .blank-data-view .blank-data-label,.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view{color:#9a9b9c;font-family:PingFangSC-Regular,PingFang SC;font-size:40px;font-weight:400}.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view{align-items:center;display:flex;justify-content:center;width:100%}@keyframes rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view .request-loading-icon{animation:rotate 3s linear infinite;display:block;height:40px;margin-right:8px;width:40px}.ht-scroll-component-view .ht-scroll-component-inner .no-more-data-tip{color:#9a9b9c;font-family:PingFangSC-Regular,PingFang SC;font-size:40px;font-weight:400;line-height:58px;text-align:center;width:100%}
package/dist/cjs/index.js CHANGED
@@ -2426,9 +2426,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2426
2426
  // dealReqDataFn Fn 请求回来的数据处理函数
2427
2427
  // onReqErrorFn Fn 请求失败回调函数
2428
2428
  // renderItemFn Fn 列表项渲染函数,必传,函数参数为item和index
2429
+ // renderEmptyFn Fn 无数据时的空状态渲染函数
2429
2430
  var HTScrollView = function HTScrollView(props) {
2430
2431
  var className = props.className,
2431
2432
  scrollClassName = props.scrollClassName,
2433
+ renderItemFn = props.renderItemFn,
2434
+ renderEmptyFn = props.renderEmptyFn,
2432
2435
  _props$isShowNoMoreDa = props.isShowNoMoreDataTips,
2433
2436
  isShowNoMoreDataTips = _props$isShowNoMoreDa === void 0 ? true : _props$isShowNoMoreDa,
2434
2437
  _props$noMoreDataTips = props.noMoreDataTipsText,
@@ -2538,6 +2541,21 @@ var HTScrollView = function HTScrollView(props) {
2538
2541
  onReqErrorFn && onReqErrorFn(err);
2539
2542
  setIsRequesting(false);
2540
2543
  };
2544
+
2545
+ // 空状态的默认渲染界面
2546
+ var renderEmptyDefaultFn = function renderEmptyDefaultFn() {
2547
+ return /*#__PURE__*/React__default["default"].createElement(components.View, {
2548
+ className: "blank-data-view"
2549
+ }, /*#__PURE__*/React__default["default"].createElement(components.Image, {
2550
+ className: "blank-data-img",
2551
+ src: "https://xiaobangkj.oss-cn-hangzhou.aliyuncs.com/mini-live/taroComponentsV3/scroll-list-empty-icon.png"
2552
+ }), /*#__PURE__*/React__default["default"].createElement(components.View, {
2553
+ className: "blank-data-label"
2554
+ }, "\u6682\u65E0\u6570\u636E"));
2555
+ };
2556
+
2557
+ // 是否为空列表
2558
+ var isEmpty = !isRequesting && !dataList.length;
2541
2559
  return /*#__PURE__*/React__default["default"].createElement(components.ScrollView, {
2542
2560
  className: "ht-scroll-component-view ".concat(scrollClassName || ''),
2543
2561
  scrollY: true,
@@ -2546,13 +2564,13 @@ var HTScrollView = function HTScrollView(props) {
2546
2564
  }, /*#__PURE__*/React__default["default"].createElement(components.View, {
2547
2565
  className: "ht-scroll-component-inner ".concat(className || '')
2548
2566
  }, dataList.map(function (item, index) {
2549
- return props.renderItemFn(item, index);
2550
- }), isRequesting && /*#__PURE__*/React__default["default"].createElement(components.View, {
2567
+ return renderItemFn(item, index);
2568
+ }), isEmpty ? renderEmptyFn ? renderEmptyFn() : renderEmptyDefaultFn() : '', isRequesting && /*#__PURE__*/React__default["default"].createElement(components.View, {
2551
2569
  className: "request-loading-view"
2552
2570
  }, /*#__PURE__*/React__default["default"].createElement(components.Image, {
2553
2571
  className: "request-loading-icon",
2554
2572
  src: "https://xiaobangkj.oss-cn-hangzhou.aliyuncs.com/mini-live/taroComponentsV3/scroll-bottom-loading-icon.png"
2555
- }), "\u6B63\u5728\u52A0\u8F7D\u4E2D..."), isCompleteAllData && !!isShowNoMoreDataTips && /*#__PURE__*/React__default["default"].createElement(components.View, {
2573
+ }), "\u6B63\u5728\u52A0\u8F7D\u4E2D..."), !isEmpty && isCompleteAllData && !!isShowNoMoreDataTips && /*#__PURE__*/React__default["default"].createElement(components.View, {
2556
2574
  className: "no-more-data-tip"
2557
2575
  }, noMoreDataTipsText)));
2558
2576
  };
@@ -1 +1 @@
1
- .ht-scroll-component-view{height:100%;width:100%}.ht-scroll-component-view .ht-scroll-component-inner{box-sizing:border-box;display:flex;flex-wrap:wrap;width:100%}.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view{align-items:center;color:#9a9b9c;display:flex;font-family:PingFangSC-Regular,PingFang SC;font-size:40px;font-weight:400;justify-content:center;width:100%}@keyframes rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view .request-loading-icon{animation:rotate 3s linear infinite;display:block;height:40px;margin-right:8px;width:40px}.ht-scroll-component-view .ht-scroll-component-inner .no-more-data-tip{color:#9a9b9c;font-family:PingFangSC-Regular,PingFang SC;font-size:40px;font-weight:400;line-height:58px;text-align:center;width:100%}
1
+ .ht-scroll-component-view{height:100%;width:100%}.ht-scroll-component-view .ht-scroll-component-inner{box-sizing:border-box;display:flex;flex-wrap:wrap;width:100%}.ht-scroll-component-view .ht-scroll-component-inner .blank-data-view{align-items:center;box-sizing:border-box;display:flex;flex-direction:column;padding:200px 0;text-align:center;width:100%}.ht-scroll-component-view .ht-scroll-component-inner .blank-data-view .blank-data-img{display:block;height:220px;margin-bottom:20px;width:220px}.ht-scroll-component-view .ht-scroll-component-inner .blank-data-view .blank-data-label,.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view{color:#9a9b9c;font-family:PingFangSC-Regular,PingFang SC;font-size:40px;font-weight:400}.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view{align-items:center;display:flex;justify-content:center;width:100%}@keyframes rotate{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.ht-scroll-component-view .ht-scroll-component-inner .request-loading-view .request-loading-icon{animation:rotate 3s linear infinite;display:block;height:40px;margin-right:8px;width:40px}.ht-scroll-component-view .ht-scroll-component-inner .no-more-data-tip{color:#9a9b9c;font-family:PingFangSC-Regular,PingFang SC;font-size:40px;font-weight:400;line-height:58px;text-align:center;width:100%}
package/dist/esm/index.js CHANGED
@@ -2417,9 +2417,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
2417
2417
  // dealReqDataFn Fn 请求回来的数据处理函数
2418
2418
  // onReqErrorFn Fn 请求失败回调函数
2419
2419
  // renderItemFn Fn 列表项渲染函数,必传,函数参数为item和index
2420
+ // renderEmptyFn Fn 无数据时的空状态渲染函数
2420
2421
  var HTScrollView = function HTScrollView(props) {
2421
2422
  var className = props.className,
2422
2423
  scrollClassName = props.scrollClassName,
2424
+ renderItemFn = props.renderItemFn,
2425
+ renderEmptyFn = props.renderEmptyFn,
2423
2426
  _props$isShowNoMoreDa = props.isShowNoMoreDataTips,
2424
2427
  isShowNoMoreDataTips = _props$isShowNoMoreDa === void 0 ? true : _props$isShowNoMoreDa,
2425
2428
  _props$noMoreDataTips = props.noMoreDataTipsText,
@@ -2529,6 +2532,21 @@ var HTScrollView = function HTScrollView(props) {
2529
2532
  onReqErrorFn && onReqErrorFn(err);
2530
2533
  setIsRequesting(false);
2531
2534
  };
2535
+
2536
+ // 空状态的默认渲染界面
2537
+ var renderEmptyDefaultFn = function renderEmptyDefaultFn() {
2538
+ return /*#__PURE__*/React.createElement(View, {
2539
+ className: "blank-data-view"
2540
+ }, /*#__PURE__*/React.createElement(Image, {
2541
+ className: "blank-data-img",
2542
+ src: "https://xiaobangkj.oss-cn-hangzhou.aliyuncs.com/mini-live/taroComponentsV3/scroll-list-empty-icon.png"
2543
+ }), /*#__PURE__*/React.createElement(View, {
2544
+ className: "blank-data-label"
2545
+ }, "\u6682\u65E0\u6570\u636E"));
2546
+ };
2547
+
2548
+ // 是否为空列表
2549
+ var isEmpty = !isRequesting && !dataList.length;
2532
2550
  return /*#__PURE__*/React.createElement(ScrollView, {
2533
2551
  className: "ht-scroll-component-view ".concat(scrollClassName || ''),
2534
2552
  scrollY: true,
@@ -2537,13 +2555,13 @@ var HTScrollView = function HTScrollView(props) {
2537
2555
  }, /*#__PURE__*/React.createElement(View, {
2538
2556
  className: "ht-scroll-component-inner ".concat(className || '')
2539
2557
  }, dataList.map(function (item, index) {
2540
- return props.renderItemFn(item, index);
2541
- }), isRequesting && /*#__PURE__*/React.createElement(View, {
2558
+ return renderItemFn(item, index);
2559
+ }), isEmpty ? renderEmptyFn ? renderEmptyFn() : renderEmptyDefaultFn() : '', isRequesting && /*#__PURE__*/React.createElement(View, {
2542
2560
  className: "request-loading-view"
2543
2561
  }, /*#__PURE__*/React.createElement(Image, {
2544
2562
  className: "request-loading-icon",
2545
2563
  src: "https://xiaobangkj.oss-cn-hangzhou.aliyuncs.com/mini-live/taroComponentsV3/scroll-bottom-loading-icon.png"
2546
- }), "\u6B63\u5728\u52A0\u8F7D\u4E2D..."), isCompleteAllData && !!isShowNoMoreDataTips && /*#__PURE__*/React.createElement(View, {
2564
+ }), "\u6B63\u5728\u52A0\u8F7D\u4E2D..."), !isEmpty && isCompleteAllData && !!isShowNoMoreDataTips && /*#__PURE__*/React.createElement(View, {
2547
2565
  className: "no-more-data-tip"
2548
2566
  }, noMoreDataTipsText)));
2549
2567
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ht-components-taro-v3",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "基于 Rollup 构建的 Taro 多端组件库",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",