{"size": 18377, "ext": "js", "max_stars_repo_path": "dist/react-picker.js", "max_stars_repo_name": "smalleast/react-picker", "max_stars_repo_stars_event_min_datetime": "2019-07-20T17:04:05.000Z", "max_stars_repo_stars_event_max_datetime": "2019-07-20T17:04:05.000Z", "max_issues_repo_path": "dist/react-picker.js", "max_issues_repo_name": "smalleast/react-picker", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/react-picker.js", "max_forks_repo_name": "smalleast/react-picker", "max_forks_repo_forks_event_min_datetime": "2019-07-20T17:04:07.000Z", "max_forks_repo_forks_event_max_datetime": "2019-07-20T17:04:07.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 9188.5, "max_line_length": 18336, "alphanum_fraction": 0.7354845731}
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("classnames"),require("react")):"function"==typeof define&&define.amd?define(["classnames","react"],t):"object"==typeof exports?exports.ReactPicker=t(require("classnames"),require("react")):e.ReactPicker=t(e.classnames,e.react)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="/",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var a=n(5),o=r(a),i=n(3),s=r(i);e.exports={ReactPicker:o.default,PickerGroup:s.default}},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(2),u=r(l),c=n(1),f=r(c),p=function(e){function t(e){a(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={touching:!1,ogY:0,ogTranslate:0,touchId:void 0,translate:0,totalHeight:0,selected:0,animating:n.props.animation},n.handleTouchStart=n.handleTouchStart.bind(n),n.handleTouchMove=n.handleTouchMove.bind(n),n.handleTouchEnd=n.handleTouchEnd.bind(n),n.updateSelected=n.updateSelected.bind(n),n}return i(t,e),s(t,[{key:"componentDidMount",value:function(){this.adjustPosition(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.adjustPosition(e)}},{key:"adjustPosition",value:function(e){var t=this,n=e.items,r=e.itemHeight,a=e.indicatorTop,o=e.defaultIndex,i=n.length*r,s=i<=a?a:0;if(o>-1)if(0===s){var l=Math.floor(a/r);if(o>l){var u=o-l;s-=u*r}else o===l?s=0:s+=Math.abs(l-o)*r}else s-=r*o;this.setState({selected:o,ogTranslate:s,totalHeight:i,translate:s},function(){return o>-1?t.updateSelected(!1):t.updateSelected()})}},{key:"updateSelected",value:function(e){var t=this,n=this.props,r=n.items,a=n.itemHeight,o=n.indicatorTop,i=n.indicatorHeight,s=n.onChange,l=n.groupIndex,u=0;if(r.forEach(function(e,n){!e.disabled&&t.state.translate+a*n>=o&&t.state.translate+a*n+a<=o+i&&(u=n)}),s&&e){var c={item:r[u],selectedIndex:u,groupIndex:l};s(c)}}},{key:"handleTouchStart",value:function(e){this.state.touching||this.props.items.length<=1||this.setState({touching:!0,ogTranslate:this.state.translate,touchId:e.targetTouches[0].identifier,ogY:0===this.state.translate?e.targetTouches[0].pageY:e.targetTouches[0].pageY-this.state.translate,animating:!1})}},{key:"handleTouchMove",value:function(e){if(this.state.touching&&!(this.props.items.length<=1)&&e.targetTouches[0].identifier===this.state.touchId){e.preventDefault();var t=e.targetTouches[0].pageY,n=t-this.state.ogY;this.setState({translate:n})}}},{key:"handleTouchEnd",value:function(e){var t=this;if(this.state.touching&&!(this.props.items.length<=1)){var n=this.props,r=n.indicatorTop,a=n.indicatorHeight,o=n.itemHeight,i=this.state.translate;if(Math.abs(i-this.state.ogTranslate)<.51*o)i=this.state.ogTranslate;else if(i>r)i=r;else if(i+this.state.totalHeight<r+a)i=r+a-this.state.totalHeight;else{var s=0,l=0,u=(i-this.state.ogTranslate)/o;Math.abs(u)<1?s=u>0?1:-1:(l=Math.abs(u%1*100)>50?1:0,s=u>0?Math.floor(u)+l:Math.ceil(u)-l),i=this.state.ogTranslate+s*o}this.setState({touching:!1,ogY:0,touchId:void 0,ogTranslate:0,animating:!0,translate:i},function(){return t.updateSelected(!0)})}}},{key:"render",value:function(){var e=this,t=this.props,n=t.items,r=t.className,a=(t.height,t.itemHeight,t.indicatorTop,t.indicatorHeight,t.onChange,t.aniamtion,t.groupIndex,t.defaultIndex,t.mapKeys,t.others,(0,f.default)("weui-picker__group",r)),o={transform:"translate(0, "+this.state.translate+"px)",transition:this.state.animating?"transform .3s":"none"};return u.default.createElement("div",{className:a,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},u.default.createElement("div",{className:"weui-picker__mask"}),u.default.createElement("div",{className:"weui-picker__indicator"}),u.default.createElement("div",{className:"weui-picker__content",style:o,ref:"content"},n.map(function(t,n){var r=t[e.props.mapKeys.label],a=(0,f.default)("weui-picker__item",{"weui-picker__item_disabled":t.disabled});return u.default.createElement("div",{key:n,className:a},r)})))}}]),t}(u.default.Component);p.propTypes={height:u.default.PropTypes.number,itemHeight:u.default.PropTypes.number,indicatorTop:u.default.PropTypes.number,indicatorHeight:u.default.PropTypes.number,onChange:u.default.PropTypes.func,aniamtion:u.default.PropTypes.bool,groupIndex:u.default.PropTypes.number,defaultIndex:u.default.PropTypes.number},p.defaultProps={height:238,itemHeight:34,indicatorTop:102,indicatorHeight:34,aniamtion:!0,groupIndex:-1,defaultIndex:-1,mapKeys:{label:"text"}},t.default=p},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(2),c=r(u),f=n(1),p=r(f),d=function(e){function t(){return a(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),l(t,[{key:"render",value:function(){var e=this.props,t=e.transparent,n=e.className,r=e.others,a=(0,p.default)({"weui-mask":!t,"weui-mask_transparent":t},n);return c.default.createElement("div",s({className:a},r))}}]),t}(c.default.Component);d.propTypes={transparent:c.default.PropTypes.bool},d.defaultProps={transparent:!1},t.default=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(2),c=r(u),f=n(3),p=r(f),d=n(1),h=r(d),m=n(4),b=r(m);n(9);var g=function(e){function t(e){a(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={selectedItem:null,selected:n.props.defaultSelect?n.props.defaultSelect:Array(n.props.groups.length).fill(-1),actions:[{label:n.props.lang.leftBtn,onClick:function(e){return n.handleClose(function(){n.props.onCancel&&n.props.onCancel(e)})}},{label:n.props.lang.rightBtn,onClick:function(e){return n.handleChanges()}}],closing:!1},n.handleChanges=n.handleChanges.bind(n),n.handleChange=n.handleChange.bind(n),n.handleClose=n.handleClose.bind(n),n}return i(t,e),l(t,[{key:"handleChanges",value:function(){var e=this;this.handleClose(function(){e.props.onChange&&e.props.onChange(e.state.selectedItem,e.state.selected,e)})}},{key:"handleChange",value:function(e){var t=this,n=e.item,r=e.selectedIndex,a=e.groupIndex,o=this.state.selected;o[a]=r,this.setState({selected:o,selectedItem:n},function(){t.props.onGroupChange&&t.props.onGroupChange(e,t.state.selected,t)})}},{key:"handleClose",value:function(e){var t=this;this.setState({closing:!0},function(){return setTimeout(function(){t.setState({closing:!1}),e()},300)})}},{key:"renderActions",value:function(){var e=this,t=this.state.actions.map(function(t,n){var r=t.label,a=t.onClick;return c.default.createElement("a",{onClick:a.bind(e),key:n,className:"weui-picker__action"}," ",r)});return c.default.createElement("div",{className:"weui-picker__hd"},t)}},{key:"renderGroups",value:function(){var e=this;return this.props.groups.map(function(t,n){return c.default.createElement(p.default,s({key:n},t,{onChange:e.handleChange,groupIndex:n,defaultIndex:e.state.selected[n]}))})}},{key:"render",value:function(){var e=this,t=this.props,n=t.className,r=t.show,a=(0,h.default)("weui-picker",{"weui-animate-slide-up":r&&!this.state.closing,"weui-animate-slide-down":this.state.closing},n),o=(0,h.default)({"weui-animate-fade-in":r&&!this.state.closing,"weui-animate-fade-out":this.state.closing});return!!this.props.show&&c.default.createElement("div",null,c.default.createElement(b.default,{className:o,onClick:function(t){return e.handleClose(function(){e.props.onCancel&&e.props.onCancel(t)})}}),c.default.createElement("div",{className:a},this.renderActions(),c.default.createElement("div",{className:"weui-picker__bd"},this.renderGroups())))}}]),t}(u.Component);g.propTypes={actions:u.PropTypes.array,groups:u.PropTypes.array,defaultSelect:u.PropTypes.array,onGroupChange:u.PropTypes.func,onChange:u.PropTypes.func,onCancel:u.PropTypes.func,show:u.PropTypes.bool,lang:u.PropTypes.object},g.defaultProps={actions:[],groups:[],show:!1,lang:{leftBtn:"取消",rightBtn:"确定"}},t.default=g},function(e,t,n){t=e.exports=n(7)(),t.push([e.id,'.weui-picker{position:fixed;width:100%;left:0;bottom:0;z-index:5000;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transform:translateY(100%);transform:translateY(100%);transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.weui-picker__hd{display:-webkit-box;display:-ms-flexbox;display:flex;padding:9px 15px;background-color:#fff;position:relative;text-align:center;font-size:14px}.weui-picker__hd:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1px solid #e5e5e5;color:#e5e5e5;-webkit-transform-origin:0 100%;transform-origin:0 100%;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.weui-picker__action{display:block;-webkit-box-flex:1;-ms-flex:1;flex:1;color:#a72e23}.weui-picker__action:first-child{text-align:left;color:#888}.weui-picker__action:last-child{text-align:right}.weui-picker__bd{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;background-color:#fff;height:238px;overflow:hidden}.weui-picker__group{-webkit-box-flex:1;-ms-flex:1;flex:1;position:relative;height:100%}.weui-picker__mask{top:0;height:100%;margin:0 auto;background:linear-gradient(180deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6)),linear-gradient(0deg,hsla(0,0%,100%,.95),hsla(0,0%,100%,.6));background-position:top,bottom;background-size:100% 102px;background-repeat:no-repeat;-webkit-transform:translateZ(0);transform:translateZ(0)}.weui-picker__indicator,.weui-picker__mask{position:absolute;left:0;width:100%;z-index:3}.weui-picker__indicator{height:34px;top:102px}.weui-picker__indicator:before{top:0;border-top:1px solid #e5e5e5;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.weui-picker__indicator:after,.weui-picker__indicator:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#e5e5e5}.weui-picker__indicator:after{bottom:0;border-bottom:1px solid #e5e5e5;-webkit-transform-origin:0 100%;transform-origin:0 100%;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.weui-picker__content{position:absolute;top:0;left:0;width:100%}.weui-picker__item{padding:0;height:34px;line-height:34px;text-align:center;color:#000;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.weui-picker__item_disabled{color:#999}@-webkit-keyframes slideUp{0%{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{-webkit-transform:translateZ(0);transform:translateZ(0)}}@keyframes slideUp{0%{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{-webkit-transform:translateZ(0);transform:translateZ(0)}}.weui-animate-slide-up{-webkit-animation:slideUp ease .3s forwards;animation:slideUp ease .3s forwards}@-webkit-keyframes slideDown{0%{-webkit-transform:translateZ(0);transform:translateZ(0)}to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}@keyframes slideDown{0%{-webkit-transform:translateZ(0);transform:translateZ(0)}to{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}}.weui-animate-slide-down{-webkit-animation:slideDown ease .3s forwards;animation:slideDown ease .3s forwards}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.weui-animate-fade-in{-webkit-animation:fadeIn ease .3s forwards;animation:fadeIn ease .3s forwards}@-webkit-keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}.weui-mask{background:rgba(0,0,0,.6)}.weui-mask,.weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}',""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},a=0;a<this.length;a++){var o=this[a][0];"number"==typeof o&&(r[o]=!0)}for(a=0;a<t.length;a++){var i=t[a];"number"==typeof i[0]&&r[i[0]]||(n&&!i[2]?i[2]=n:n&&(i[2]="("+i[2]+") and ("+n+")"),e.push(i))}},e}},function(e,t,n){function r(e,t){for(var n=0;n<e.length;n++){var r=e[n],a=d[r.id];if(a){a.refs++;for(var o=0;o<a.parts.length;o++)a.parts[o](r.parts[o]);for(;o<r.parts.length;o++)a.parts.push(u(r.parts[o],t))}else{for(var i=[],o=0;o<r.parts.length;o++)i.push(u(r.parts[o],t));d[r.id]={id:r.id,refs:1,parts:i}}}}function a(e){for(var t=[],n={},r=0;r<e.length;r++){var a=e[r],o=a[0],i=a[1],s=a[2],l=a[3],u={css:i,media:s,sourceMap:l};n[o]?n[o].parts.push(u):t.push(n[o]={id:o,parts:[u]})}return t}function o(e,t){var n=b(),r=v[v.length-1];if("top"===e.insertAt)r?r.nextSibling?n.insertBefore(t,r.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),v.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(t)}}function i(e){e.parentNode.removeChild(e);var t=v.indexOf(e);t>=0&&v.splice(t,1)}function s(e){var t=document.createElement("style");return t.type="text/css",o(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",o(e,t),t}function u(e,t){var n,r,a;if(t.singleton){var o=y++;n=g||(g=s(t)),r=c.bind(null,n,o,!1),a=c.bind(null,n,o,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(t),r=p.bind(null,n),a=function(){i(n),n.href&&URL.revokeObjectURL(n.href)}):(n=s(t),r=f.bind(null,n),a=function(){i(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else a()}}function c(e,t,n,r){var a=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=w(t,a);else{var o=document.createTextNode(a),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(o,i[t]):e.appendChild(o)}}function f(e,t){var n=t.css,r=t.media;if(r&&e.setAttribute("media",r),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function p(e,t){var n=t.css,r=t.sourceMap;r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([n],{type:"text/css"}),o=e.href;e.href=URL.createObjectURL(a),o&&URL.revokeObjectURL(o)}var d={},h=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},m=h(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),b=h(function(){return document.head||document.getElementsByTagName("head")[0]}),g=null,y=0,v=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=m()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=a(e);return r(n,t),function(e){for(var o=[],i=0;i<n.length;i++){var s=n[i],l=d[s.id];l.refs--,o.push(l)}if(e){var u=a(e);r(u,t)}for(var i=0;i<o.length;i++){var l=o[i];if(0===l.refs){for(var c=0;c<l.parts.length;c++)l.parts[c]();delete d[l.id]}}}};var w=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t,n){var r=n(6);"string"==typeof r&&(r=[[e.id,r,""]]);n(8)(r,{});r.locals&&(e.exports=r.locals)}])});
//# sourceMappingURL=react-picker.js.map