@jdcfe/yep-react
Version:
一套移动端的React组件库
87 lines (73 loc) • 3.14 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import * as React from 'react';
import MultiPicker from './MultiPicker';
import Picker from './Picker';
;
var PickerView = /*#__PURE__*/function (_React$PureComponent) {
_inherits(PickerView, _React$PureComponent);
var _super = _createSuper(PickerView);
function PickerView() {
var _this;
_classCallCheck(this, PickerView);
_this = _super.apply(this, arguments);
_this.getCol = function () {
var _this$props = _this.props,
data = _this$props.data,
pickerPrefixCls = _this$props.pickerPrefixCls,
indicatorStyle = _this$props.indicatorStyle,
itemStyle = _this$props.itemStyle; //@ts-ignore
return data.map(function (col, index) {
return /*#__PURE__*/React.createElement(Picker, {
key: index,
prefixCls: pickerPrefixCls,
style: {
flex: 1
},
indicatorStyle: indicatorStyle,
itemStyle: itemStyle
}, col.map(function (item) {
return /*#__PURE__*/React.createElement(Picker.Item, {
key: item.value,
value: item.value
}, item.label);
}));
});
};
return _this;
}
_createClass(PickerView, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
prefixCls = _this$props2.prefixCls,
value = _this$props2.value,
onChange = _this$props2.onChange,
onScrollChange = _this$props2.onScrollChange;
return /*#__PURE__*/React.createElement(MultiPicker, {
prefixCls: prefixCls,
selectedValue: value,
onValueChange: onChange,
onScrollChange: onScrollChange,
style: {
flexDirection: 'row'
}
}, this.getCol());
}
}]);
return PickerView;
}(React.PureComponent);
export { PickerView as default };
PickerView.defaultProps = {
prefixCls: 'Yep-picker',
pickerPrefixCls: 'Yep-picker-col',
cols: 3,
cascade: true,
value: [],
onChange: function onChange() {}
};