UNPKG

mobile-more

Version:

基于 antd-mobile v5 扩展移动端 UI 组件

44 lines (41 loc) 1.98 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; var _excluded = ["loading", "error", "done", "showLoadingIcon", "text", "className"]; import React from 'react'; import { DotLoading } from 'antd-mobile'; import classnames from 'classnames'; import { prefixClass } from "../../config"; import { useConfig } from "../BizConfigProvider"; import "./index.css"; var prefixCls = "".concat(prefixClass, "-scrollLoadView"); var BizScrollLoadView = /*#__PURE__*/React.forwardRef(function (_ref, ref) { var _ref$loading = _ref.loading, loading = _ref$loading === void 0 ? false : _ref$loading, _ref$error = _ref.error, error = _ref$error === void 0 ? false : _ref$error, _ref$done = _ref.done, done = _ref$done === void 0 ? false : _ref$done, _ref$showLoadingIcon = _ref.showLoadingIcon, showLoadingIcon = _ref$showLoadingIcon === void 0 ? true : _ref$showLoadingIcon, text = _ref.text, className = _ref.className, restProps = _objectWithoutProperties(_ref, _excluded); var _useConfig = useConfig(), locale = _useConfig.locale; var textObj = _objectSpread(_objectSpread({}, locale.scrollLoadView), text); var status = loading ? 'loading' : error ? 'error' : done ? 'done' : 'default'; return /*#__PURE__*/React.createElement("div", _extends({ className: classnames(prefixCls, "".concat(prefixCls, "-").concat(status), className), ref: ref }, restProps), textObj[status], loading && showLoadingIcon && /*#__PURE__*/React.createElement(DotLoading, null)); }); BizScrollLoadView.displayName = 'BizScrollLoadView'; /** * @deprecated 即将废弃,请使用 `BizScrollLoadView` 替代。 */ export var ScrollLoadView = BizScrollLoadView; /** * @deprecated 即将废弃,请使用 `BizScrollLoadViewProps` 替代。 */ export default BizScrollLoadView;