UNPKG

@alifd/meet-react

Version:

Fusion Mobile React UI System Component

52 lines 3.06 kB
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } import React, { createElement, forwardRef, Children, cloneElement, isValidElement } from "react"; import classNames from 'classnames'; import { ScrollView } from "@alifd/meet-react-component-one"; import View from '../view'; import { isStrictWechatMiniProgram } from '../utils'; var BreadCrumb = function BreadCrumb(props, ref) { var _props$className = props.className, className = _props$className === void 0 ? '' : _props$className, _props$prefix = props.prefix, prefix = _props$prefix === void 0 ? 'mt-' : _props$prefix, _props$size = props.size, size = _props$size === void 0 ? 'medium' : _props$size, _props$maxNode = props.maxNode, maxNode = _props$maxNode === void 0 ? 100 : _props$maxNode, _props$disabled = props.disabled, disabled = _props$disabled === void 0 ? false : _props$disabled, _props$onClick = props.onClick, onClick = _props$onClick === void 0 ? function () {} : _props$onClick, separator = props.separator, children = props.children; var count = Children.count(children); var clsPrefix = "".concat(prefix, "breadcrumb"); return /*#__PURE__*/React.createElement(ScrollView, { ref: ref, className: classNames(className, clsPrefix, _defineProperty({}, "".concat(clsPrefix, "--").concat(size), isStrictWechatMiniProgram)), showsHorizontalScrollIndicator: false, horizontal: true }, /*#__PURE__*/React.createElement(View, { className: classNames("".concat(clsPrefix, "-container"), _defineProperty({}, "".concat(clsPrefix, "-container--").concat(size), isStrictWechatMiniProgram)) }, Children.map(children, function (child, index) { if (!isValidElement(child)) { return null; } return cloneElement(child, { key: index, index: index, size: size, last: index === count - 1 && isValidElement(child), disabledAll: disabled, maxNode: maxNode, count: count, onClick: onClick, separator: separator }); }))); }; BreadCrumb.displayName = 'BreadCrumb'; export default /*#__PURE__*/forwardRef(BreadCrumb);