{"size": 10216, "ext": "js", "max_stars_repo_path": "docs/js/12.247a552ed0042d197bac.js", "max_stars_repo_name": "pwcong/rc-component-x", "max_stars_repo_stars_event_min_datetime": "2019-04-26T07:04:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-25T06:20:48.000Z", "max_issues_repo_path": "docs/js/12.247a552ed0042d197bac.js", "max_issues_repo_name": "pwcong/rc-component-x", "max_issues_repo_issues_event_min_datetime": "2021-03-09T02:51:27.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T10:29:18.000Z", "max_forks_repo_path": "docs/js/12.247a552ed0042d197bac.js", "max_forks_repo_name": "pwcong/rc-component-x", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": 7, "max_forks_count": null, "avg_line_length": 10216.0, "max_line_length": 10216, "alphanum_fraction": 0.6965544244}
(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{36:function(e,t,a){},41:function(e,t,a){"use strict";var r=a(13),n=a(0),l=a.n(n),o=a(6),i=a(34),c=(a(36),Object(o.c)("input")),s=function(e){function t(t){var a=e.call(this,t)||this;a.handleChange=function(e){var t=a.props.onChange,r=e.target.value;a.setState({value:r},function(){t&&t(r)})},a.handleClear=function(e){var t=a.props.onChange;a.setState({value:""},function(){t&&t("")})},a.renderInput=function(){var e,t=a.props,r=t.id,n=t.name,i=t.className,s=t.htmlType,u=t.size,d=t.disabled,p=t.forwardedRef,f=t.onPressEnter,m=a.state.value;return l.a.createElement("input",{id:r,name:n,ref:p,className:Object(o.a)(c,i,c+"-"+u,(e={},e[c+"-disabled"]=d,e)),type:s,value:m,onKeyPress:function(e){"Enter"===e.key&&f&&f(e)},onChange:a.handleChange})},a.renderAddon=function(e,t){var a=Object(o.c)("addon",c);return l.a.createElement("div",{className:Object(o.a)(a,Object(o.c)(t,a))},e)};var r=a.props.defaultValue;return a.state={value:void 0!==r?r:""},a}return Object(r.b)(t,e),t.getDerivedStateFromProps=function(e,t){return void 0!==e.value&&e.value!==t.value?Object.assign({},t,{value:e.value}):t},t.prototype.render=function(){var e,t,a=this.props,n=a.prefix,s=a.suffix,u=a.slot,d=a.addonBefore,p=a.addonAfter,f=a.allowClear,m=a.size,h=a.wrapperClassName,v=a.innerClassName,b=Object(o.d)(this.props);if(n||s||d||p||f||u){var w=Object(o.c)("wrapper",c),g=Object(o.c)("inner",c);return l.a.createElement("div",Object(r.a)({},b,{className:Object(o.a)(h,w,w+"-"+m,(e={},e[""+Object(o.c)("has-addon",w)]=d||p,e[""+Object(o.c)("has-addon-before",w)]=d,e[""+Object(o.c)("has-addon-after",w)]=p,e))}),d&&this.renderAddon(d,"before"),n||s||f||u?l.a.createElement("div",{className:Object(o.a)(v,g,(t={},t[""+Object(o.c)("has-prefix",g)]=n,t[""+Object(o.c)("has-suffix",g)]=s,t[""+Object(o.c)("has-clear",g)]=f,t))},this.renderInput(),n&&l.a.createElement("div",{className:Object(o.c)("prefix",c)},"string"==typeof n?l.a.createElement(i.a,{type:n}):n),s||f?l.a.createElement("div",{className:Object(o.c)("suffix",c)},s&&"string"==typeof s?l.a.createElement(i.a,{type:s}):s,f&&void 0!==this.state.value&&""!==this.state.value&&l.a.createElement(i.a,{onClick:this.handleClear,className:Object(o.c)("clear",c),type:"x-circle"})):void 0,u&&l.a.createElement("div",{className:Object(o.c)("slot",c)},u)):this.renderInput(),p&&this.renderAddon(p,"after"))}return l.a.cloneElement(this.renderInput(),Object(r.a)({},b))},t.defaultProps={size:"default",htmlType:"text"},t}(n.PureComponent),u=l.a.forwardRef(function(e,t){return l.a.createElement(s,Object(r.a)({},e,{forwardedRef:t}))}),d=Object(o.c)("input-password"),p=function(e){var t=e.defaultVisibled,a=void 0===t||t,c=e.className,s=e.forwardedRef,p=e.wrapperClassName,f=e.innerClassName,m=Object(n.useState)(a),h=m[0],v=m[1];return l.a.createElement(u,Object(r.a)({},e,{ref:s,className:Object(o.a)(d,c),wrapperClassName:Object(o.a)(Object(o.c)("wrapper",d),p),innerClassName:Object(o.a)(Object(o.c)("inner",d),f),htmlType:h?"text":"password",suffix:l.a.createElement(i.a,{className:Object(o.c)("toggle",d),type:h?"eye":"eye-off",onClick:function(){v(!h)}})}))};p.defaultProps={defaultVisibled:!0};var f=l.a.forwardRef(function(e,t){return l.a.createElement(p,Object(r.a)({},e,{forwardedRef:t}))}),m=Object(o.c)("input-search"),h=function(e){var t=e.className,a=e.onChange,c=e.onSearch,s=e.onPressEnter,d=e.defaultValue,p=e.forwardedRef,f=e.wrapperClassName,h=e.innerClassName,v=e.value,b=Object(n.useState)(d||""),w=b[0],g=b[1];return l.a.createElement(u,Object(r.a)({},e,{value:v||w,ref:p,className:Object(o.a)(m,t),wrapperClassName:Object(o.a)(Object(o.c)("wrapper",m),f),innerClassName:Object(o.a)(Object(o.c)("inner",m),h),onChange:function(e){g(e),a&&a(e)},onPressEnter:function(e){s&&s(e),c&&c(v||w)},suffix:l.a.createElement(i.a,{className:Object(o.c)("enter",m),type:"search",onClick:function(){c&&c(v||w)}})}))},v=l.a.forwardRef(function(e,t){return l.a.createElement(h,Object(r.a)({},e,{forwardedRef:t}))});var b=Object(o.c)("textarea"),w=function(e){function t(t){var a=e.call(this,t)||this;a.ref=l.a.createRef(),a.getRef=function(){return a.props.forwardedRef||a.ref},a.getComputedStyle=function(){var e=a.getRef();return e&&e.current&&window.getComputedStyle(e.current)||{}},a.handleChange=function(e){var t=a.props.onChange;a.setState({value:e.target.value},function(){t&&t(e.target.value)})},a.handleClear=function(e){var t=a.props.onChange;a.setState({value:""},function(){t&&t("")})},a.renderTextarea=function(){var e,t=a.props,r=t.id,n=t.name,i=t.className,c=t.disabled,s=t.limit,u=a.state,d=u.value,p=u.rowHeight,f=u.rowOuterHeight,m=u.minRow,h=u.maxRow,v=u.height;return l.a.createElement("textarea",{id:r,name:n,ref:a.getRef(),className:Object(o.a)(b,i,(e={},e[b+"-disabled"]=c,e[b+"-overflow"]=void 0!==s&&d.length>s,e)),value:d,style:{height:v,minHeight:m>0?m*p+f:"unset",maxHeight:h>0?h*p+f:"unset"},onChange:a.handleChange})},a.renderClear=function(){var e=a.props.allowClear,t=a.state.value;return e&&t.length>0?l.a.createElement("div",{className:Object(o.c)("clear",b)},l.a.createElement(i.a,{type:"x-circle",onClick:a.handleClear})):null},a.renderCounter=function(){var e=a.props,t=e.counter,r=e.limit,n=a.state.value,i=Object(o.c)("counter",b);if(void 0!==t){if("boolean"!=typeof t)return l.a.createElement("div",{className:i},t(n,r));if(t)return l.a.createElement("div",{className:i},l.a.createElement("span",null,n.length),void 0!==r&&r>=0&&[l.a.createElement("span",{key:i+"-sep"},"/"),l.a.createElement("span",{key:i+"-limit"},r)])}return null};var r=t.row,n=3,c=-1,s=-1;if(void 0!==r)if("number"==typeof r)n=r;else{var u=r,d=u.min,p=void 0===d?-1:d,f=u.max,m=void 0===f?-1:f;s=m>0?m:-1,n=c=p>0?p:-1,Object(o.e)(c<0,"Textarea","defaultRow has been set to be 1 because minRow without custom setting",function(){n=1}),Object(o.e)(s<c,"Textarea","maxRow should not be smaller than minRow",function(){s=c})}return a.state={value:t.defaultValue||"",row:n,minRow:c,maxRow:s,rowHeight:16.8,rowBorderHeight:2,rowPaddingHeight:12,rowOuterHeight:14,height:16.8*n+2+2},a}return Object(r.b)(t,e),t.prototype.componentDidMount=function(){var e=function(e){var t=e.paddingTop,a=void 0===t?"6px":t,r=e.paddingBottom,n=void 0===r?"6px":r,l=e.fontSize,o=void 0===l?"14px":l,i=e.lineHeight,c=void 0===i?"normal":i,s=e.borderTopWidth,u=void 0===s?"1px":s,d=e.borderBottomWidth,p=void 0===d?"1px":d,f=parseFloat(a||"6px"),m=parseFloat(n||"6px"),h=parseFloat(o||"14px"),v="normal"===c?1.2:parseFloat(c||"1.2"),b=parseFloat(u||"1px"),w=parseFloat(p||"1px"),g=(b>=0?b:1)+(w>=0?w:1),O=(f>=0?f:6)+(m>=0?m:6);return{rowHeight:h*(v>=0?v:1.2),rowBorderHeight:g,rowPaddingHeight:O,rowOuterHeight:g+O}}(this.getComputedStyle()),t=e.rowHeight,a=e.rowOuterHeight,r=e.rowBorderHeight,n=e.rowPaddingHeight;this.setState(function(e){var l=e.row;return{rowHeight:t,rowOuterHeight:a,rowBorderHeight:r,rowPaddingHeight:n,height:l*t+a}})},t.prototype.componentDidUpdate=function(){var e=this.state.height,t=this.getRef();if(t&&t.current){var a=t.current.scrollHeight;a>e&&this.setState(function(e){var t=e.rowHeight;return{height:a+3*t}})}},t.getDerivedStateFromProps=function(e,t){return void 0!==e.value&&e.value!==t.value?Object.assign({},t,{value:e.value}):t},t.prototype.render=function(){var e=this.props,t=e.allowClear,a=e.counter,n=Object(o.d)(this.props);return t||a?l.a.createElement("div",Object(r.a)({},n,{className:Object(o.c)("wrapper",b)}),l.a.createElement("div",{className:Object(o.c)("inner",b)},this.renderTextarea(),this.renderCounter(),this.renderClear())):l.a.cloneElement(this.renderTextarea(),Object(r.a)({},n))},t}(n.PureComponent),g=l.a.forwardRef(function(e,t){return l.a.createElement(w,Object(r.a)({},e,{forwardedRef:t}))});a.d(t,"a",function(){return f}),a.d(t,"b",function(){return v}),a.d(t,"c",function(){return g});t.d=u},59:function(e){e.exports=JSON.parse('{"name":"@rc-x/input","version":"0.0.1","description":"Input","author":"Pwcong <pwcong@foxmail.com>","main":"dist/bundle.min.js","module":"dist/bundle.es.js","types":"dist/bundle.d.ts","keywords":["rc-x-input"],"license":"MIT","dependencies":{"@rc-x/icon":"^0.0.1","@rc-x/style":"^0.0.1","@rc-x/utils":"^0.0.1"},"devDependencies":{"@rc-x/test":"^0.0.1"},"gitHead":"56ef5fc17a78c9aaaf5dfde8b6ed6b5fb779bd51"}')},79:function(e,t,a){"use strict";a.r(t);var r=a(13),n=a(0),l=a.n(n),o=a(33),i=a(41),c=a(59),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.inputRef=l.a.createRef(),t.searchRef=l.a.createRef(),t.passwordRef=l.a.createRef(),t.textareaRef=l.a.createRef(),t}return Object(r.b)(t,e),t.prototype.componentDidMount=function(){this.inputRef.current&&console.log(this.inputRef.current.value)},t.prototype.render=function(){return l.a.createElement(o.a,{component:[i.d,i.a,i.b,i.c],componentName:["Input","Password","Search","Textarea"],componentProps:[{ref:this.inputRef},{ref:this.passwordRef},{ref:this.searchRef,onSearch:function(e){alert("Search: "+e)}},{ref:this.textareaRef,row:{max:12,min:1}}],componentTestProps:[{defaultValue:{type:"input",value:"Hello World!",label:"默认值"},disabled:{type:"switch",value:!1,label:"是否禁用"},size:{type:"radio",value:"default",label:"大小",options:[{label:"default",value:"default"},{label:"large",value:"large"},{label:"small",value:"small"}]},htmlType:{type:"radio",value:"text",label:"HTML类型",options:[{label:"text",value:"text"},{label:"number",value:"number"},{label:"password",value:"password"}]},prefix:{type:"input",label:"前缀图标",value:"user"},suffix:{type:"input",label:"后缀图标",value:"info"},allowClear:{type:"switch",value:!0,label:"允许清除"}},{defaultValue:{type:"input",value:"Hello World!",label:"默认值"},defaultVisibled:{type:"switch",value:!0,label:"是否默认可见"}},{defaultValue:{type:"input",value:"Hello World!",label:"默认值"}},{defaultValue:{type:"input",value:"Hello World!",label:"默认值"},counter:{type:"switch",value:!0,label:"计数器"},limit:{type:"inputNumber",value:100,label:"长度限制"},allowClear:{type:"switch",value:!0,label:"允许清除"}}],componentPackageJson:c},l.a.createElement(i.d,{defaultValue:"Yeah!",addonBefore:l.a.createElement("div",null,"Before"),addonAfter:l.a.createElement("div",null,"After"),size:"large"}))},t}(l.a.PureComponent);t.default=s}}]);