UNPKG

mobile-more

Version:

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

42 lines 1.76 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 = ["block", "icon", "options", "fieldNames", "spaceProps", "checkboxProps", "checkboxGroupProps"]; import React from 'react'; import { Checkbox, Space } from 'antd-mobile'; var SuperCheckbox = function SuperCheckbox(_ref) { var block = _ref.block, icon = _ref.icon, options = _ref.options, fieldNames = _ref.fieldNames, spaceProps = _ref.spaceProps, checkboxProps = _ref.checkboxProps, checkboxGroupProps = _ref.checkboxGroupProps, restProps = _objectWithoutProperties(_ref, _excluded); var _label$value$disabled = _objectSpread({ label: 'label', value: 'value', disabled: 'disabled' }, fieldNames), labelKey = _label$value$disabled.label, valueKey = _label$value$disabled.value, disabledKey = _label$value$disabled.disabled; return /*#__PURE__*/React.createElement(Checkbox.Group, _extends({}, checkboxGroupProps, restProps), /*#__PURE__*/React.createElement(Space, _extends({ direction: block ? 'vertical' : 'horizontal', block: block, wrap: true }, spaceProps, { style: _objectSpread({ width: block ? '100%' : 'auto' }, spaceProps === null || spaceProps === void 0 ? void 0 : spaceProps.style) }), options.map(function (item, index) { return /*#__PURE__*/React.createElement(Checkbox, _extends({ key: item[valueKey] + '' + index, value: item[valueKey], disabled: item[disabledKey], icon: icon, block: block }, checkboxProps), item[labelKey]); }))); }; export default SuperCheckbox;