forked from Gitlink/forgeplus
1 line
27 KiB
JavaScript
1 line
27 KiB
JavaScript
(this.webpackJsonp=this.webpackJsonp||[]).push([[22],{"+hnl":function(e,t,n){},MKzF:function(e,t,n){"use strict";n.r(t);n("SchZ"),n("+hnl")},QCje:function(e,t,n){"use strict";n.r(t);n("SchZ"),n("xaim")},fyUT:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return W}));var r=n("q1tI"),o=n.n(r),a=n("TSYQ"),i=n.n(a),u=n("jo6Y"),s=n.n(u),c=n("QbLZ"),l=n.n(c),p=n("iCc5"),f=n.n(p),h=n("FYw3"),d=n.n(h),v=n("mRg0"),y=n.n(v),b=n("17x9"),m=n.n(b),g=n("4IlW"),C=n("V7oC"),O=n.n(C),x=function(e){function t(){f()(this,t);var e=d()(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.state={active:!1},e.onTouchStart=function(t){e.triggerEvent("TouchStart",!0,t)},e.onTouchMove=function(t){e.triggerEvent("TouchMove",!1,t)},e.onTouchEnd=function(t){e.triggerEvent("TouchEnd",!1,t)},e.onTouchCancel=function(t){e.triggerEvent("TouchCancel",!1,t)},e.onMouseDown=function(t){e.triggerEvent("MouseDown",!0,t)},e.onMouseUp=function(t){e.triggerEvent("MouseUp",!1,t)},e.onMouseLeave=function(t){e.triggerEvent("MouseLeave",!1,t)},e}return y()(t,e),O()(t,[{key:"componentDidUpdate",value:function(){this.props.disabled&&this.state.active&&this.setState({active:!1})}},{key:"triggerEvent",value:function(e,t,n){var r="on"+e,o=this.props.children;o.props[r]&&o.props[r](n),t!==this.state.active&&this.setState({active:t})}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.disabled,r=e.activeClassName,a=e.activeStyle,u=n?void 0:{onTouchStart:this.onTouchStart,onTouchMove:this.onTouchMove,onTouchEnd:this.onTouchEnd,onTouchCancel:this.onTouchCancel,onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onMouseLeave:this.onMouseLeave},s=o.a.Children.only(t);if(!n&&this.state.active){var c=s.props,p=c.style,f=c.className;return!1!==a&&(a&&(p=l()({},p,a)),f=i()(f,r)),o.a.cloneElement(s,l()({className:f,style:p},u))}return o.a.cloneElement(s,u)}}]),t}(o.a.Component),w=x;x.defaultProps={disabled:!1};var S=function(e){function t(){return f()(this,t),d()(this,e.apply(this,arguments))}return y()(t,e),t.prototype.render=function(){var e=this.props,t=e.prefixCls,n=e.disabled,r=s()(e,["prefixCls","disabled"]);return o.a.createElement(w,{disabled:n,activeClassName:t+"-handler-active"},o.a.createElement("span",r))},t}(r.Component);S.propTypes={prefixCls:m.a.string,disabled:m.a.bool,onTouchStart:m.a.func,onTouchEnd:m.a.func,onMouseDown:m.a.func,onMouseUp:m.a.func,onMouseLeave:m.a.func};var E=S;function N(){}function P(e){e.preventDefault()}var M=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,V=function(e){return null!=e},k=function(e,t){return t===e||"number"==typeof t&&"number"==typeof e&&isNaN(t)&&isNaN(e)},T=function(e){function t(n){f()(this,t);var r=d()(this,e.call(this,n));j.call(r);var o=void 0;o="value"in n?n.value:n.defaultValue,r.state={focused:n.autoFocus};var a=r.getValidValue(r.toNumber(o));return r.state=l()({},r.state,{inputValue:r.toPrecisionAsStep(a),value:a}),r}return y()(t,e),t.prototype.componentDidMount=function(){this.componentDidUpdate()},t.prototype.componentDidUpdate=function(e){var t=this.props,n=t.value,r=t.onChange,o=t.max,a=t.min,i=this.state.focused;if(e){if(!k(e.value,n)||!k(e.max,o)||!k(e.min,a)){var u=i?n:this.getValidValue(n),s=void 0;s=this.pressingUpOrDown?u:this.inputting?this.rawInput:this.toPrecisionAsStep(u),this.setState({value:u,inputValue:s})}var c="value"in this.props?n:this.state.value;"max"in this.props&&e.max!==o&&"number"==typeof c&&c>o&&r&&r(o),"min"in this.props&&e.min!==a&&"number"==typeof c&&c<a&&r&&r(a)}try{if(void 0!==this.cursorStart&&this.state.focused)if(this.partRestoreByAfter(this.cursorAfter)||this.state.value===this.props.value){if(this.currentValue===this.input.value)switch(this.lastKeyCode){case g.a.BACKSPACE:this.fixCaret(this.cursorStart-1,this.cursorStart-1);break;case g.a.DELETE:this.fixCaret(this.cursorStart+1,this.cursorStart+1)}}else{var l=this.cursorStart+1;this.cursorAfter?this.lastKeyCode===g.a.BACKSPACE?l=this.cursorStart-1:this.lastKeyCode===g.a.DELETE&&(l=this.cursorStart):l=this.input.value.length,this.fixCaret(l,l)}}catch(e){}this.lastKeyCode=null,this.pressingUpOrDown&&(this.props.focusOnUpDown&&this.state.focused&&document.activeElement!==this.input&&this.focus(),this.pressingUpOrDown=!1)},t.prototype.componentWillUnmount=function(){this.stop()},t.prototype.getCurrentValidValue=function(e){var t=e;return t=""===t?"":this.isNotCompleteNumber(parseFloat(t,10))?this.state.value:this.getValidValue(t),this.toNumber(t)},t.prototype.getRatio=function(e){var t=1;return e.metaKey||e.ctrlKey?t=.1:e.shiftKey&&(t=10),t},t.prototype.getValueFromEvent=function(e){var t=e.target.value.trim().replace(/。/g,".");return V(this.props.decimalSeparator)&&(t=t.replace(this.props.decimalSeparator,".")),t},t.prototype.getValidValue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.props.min,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.props.max,r=parseFloat(e,10);return isNaN(r)?e:(r<t&&(r=t),r>n&&(r=n),r)},t.prototype.setValue=function(e,t){var n=this.props.precision,r=this.isNotCompleteNumber(parseFloat(e,10))?null:parseFloat(e,10),o=this.state,a=o.value,i=void 0===a?null:a,u=o.inputValue,s=void 0===u?null:u,c="number"==typeof r?r.toFixed(n):""+r,l=r!==i||c!==""+s;return"value"in this.props?this.setState({inputValue:this.toPrecisionAsStep(this.state.value)},t):this.setState({value:r,inputValue:this.toPrecisionAsStep(e)},t),l&&this.props.onChange(r),r},t.prototype.getPrecision=function(e){if(V(this.props.precision))return this.props.precision;var t=e.toString();if(t.indexOf("e-")>=0)return parseInt(t.slice(t.indexOf("e-")+2),10);var n=0;return t.indexOf(".")>=0&&(n=t.length-t.indexOf(".")-1),n},t.prototype.getMaxPrecision=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.props,r=n.precision,o=n.step;if(V(r))return r;var a=this.getPrecision(t),i=this.getPrecision(o),u=this.getPrecision(e);return e?Math.max(u,a+i):a+i},t.prototype.getPrecisionFactor=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.getMaxPrecision(e,t);return Math.pow(10,n)},t.prototype.fixCaret=function(e,t){if(void 0!==e&&void 0!==t&&this.input&&this.input.value)try{var n=this.input.selectionStart,r=this.input.selectionEnd;e===n&&t===r||this.input.setSelectionRange(e,t)}catch(e){}},t.prototype.focus=function(){this.input.focus(),this.recordCursorPosition()},t.prototype.blur=function(){this.input.blur()},t.prototype.select=function(){this.input.select()},t.prototype.formatWrapper=function(e){return this.props.formatter?this.props.formatter(e):e},t.prototype.toPrecisionAsStep=function(e){if(this.isNotCompleteNumber(e)||""===e)return e;var t=Math.abs(this.getMaxPrecision(e));return isNaN(t)?e.toString():Number(e).toFixed(t)},t.prototype.isNotCompleteNumber=function(e){return isNaN(e)||""===e||null===e||e&&e.toString().indexOf(".")===e.toString().length-1},t.prototype.toNumber=function(e){var t=this.props.precision,n=this.state.focused,r=e&&e.length>16&&n;return this.isNotCompleteNumber(e)||r?e:V(t)?Math.round(e*Math.pow(10,t))/Math.pow(10,t):Number(e)},t.prototype.upStep=function(e,t){var n=this.props.step,r=this.getPrecisionFactor(e,t),o=Math.abs(this.getMaxPrecision(e,t)),a=((r*e+r*n*t)/r).toFixed(o);return this.toNumber(a)},t.prototype.downStep=function(e,t){var n=this.props.step,r=this.getPrecisionFactor(e,t),o=Math.abs(this.getMaxPrecision(e,t)),a=((r*e-r*n*t)/r).toFixed(o);return this.toNumber(a)},t.prototype.step=function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments[3];this.stop(),t&&(t.persist(),t.preventDefault());var a=this.props;if(!a.disabled){var i=this.getCurrentValidValue(this.state.inputValue)||0;if(!this.isNotCompleteNumber(i)){var u=this[e+"Step"](i,r),s=u>a.max||u<a.min;u>a.max?u=a.max:u<a.min&&(u=a.min),this.setValue(u),this.setState({focused:!0}),s||(this.autoStepTimer=setTimeout((function(){n[e](t,r,!0)}),o?200:600))}}},t.prototype.render=function(){var e,t=l()({},this.props),n=t.prefixCls,r=t.disabled,a=t.readOnly,u=t.useTouch,c=t.autoComplete,p=t.upHandler,f=t.downHandler,h=(s()(t,["prefixCls","disabled","readOnly","useTouch","autoComplete","upHandler","downHandler"]),i()(((e={})[n]=!0,e[t.className]=!!t.className,e[n+"-disabled"]=r,e[n+"-focused"]=this.state.focused,e))),d="",v="",y=this.state,b=y.value,m=y.inputValue;if(b||0===b)if(isNaN(b))d=n+"-handler-up-disabled",v=n+"-handler-down-disabled";else{var g=Number(b);g>=t.max&&(d=n+"-handler-up-disabled"),g<=t.min&&(v=n+"-handler-down-disabled")}var C={};for(var O in t)!t.hasOwnProperty(O)||"data-"!==O.substr(0,5)&&"aria-"!==O.substr(0,5)&&"role"!==O||(C[O]=t[O]);var x=!t.readOnly&&!t.disabled,w=this.composing?m:this.getInputDisplayValue(),S=void 0,M=void 0;u?(S={onTouchStart:x&&!d?this.up:N,onTouchEnd:this.stop},M={onTouchStart:x&&!v?this.down:N,onTouchEnd:this.stop}):(S={onMouseDown:x&&!d?this.up:N,onMouseUp:this.stop,onMouseLeave:this.stop},M={onMouseDown:x&&!v?this.down:N,onMouseUp:this.stop,onMouseLeave:this.stop});var V=!!d||r||a,k=!!v||r||a;return o.a.createElement("div",{className:h,style:t.style,title:t.title,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onMouseOver:t.onMouseOver,onMouseOut:t.onMouseOut,onCompositionStart:this.onComposition,onCompositionEnd:this.onComposition},o.a.createElement("div",{className:n+"-handler-wrap"},o.a.createElement(E,l()({ref:this.saveUp,disabled:V,prefixCls:n,unselectable:"unselectable"},S,{role:"button","aria-label":"Increase Value","aria-disabled":!!V,className:n+"-handler "+n+"-handler-up "+d}),p||o.a.createElement("span",{unselectable:"unselectable",className:n+"-handler-up-inner",onClick:P})),o.a.createElement(E,l()({ref:this.saveDown,disabled:k,prefixCls:n,unselectable:"unselectable"},M,{role:"button","aria-label":"Decrease Value","aria-disabled":!!k,className:n+"-handler "+n+"-handler-down "+v}),f||o.a.createElement("span",{unselectable:"unselectable",className:n+"-handler-down-inner",onClick:P}))),o.a.createElement("div",{className:n+"-input-wrap"},o.a.createElement("input",l()({role:"spinbutton","aria-valuemin":t.min,"aria-valuemax":t.max,"aria-valuenow":b,required:t.required,type:t.type,placeholder:t.placeholder,onClick:t.onClick,onMouseUp:this.onMouseUp,className:n+"-input",tabIndex:t.tabIndex,autoComplete:c,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:x?this.onKeyDown:N,onKeyUp:x?this.onKeyUp:N,autoFocus:t.autoFocus,maxLength:t.maxLength,readOnly:t.readOnly,disabled:t.disabled,max:t.max,min:t.min,step:t.step,name:t.name,title:t.title,id:t.id,onChange:this.onChange,ref:this.saveInput,value:w,pattern:t.pattern,inputMode:t.inputMode},C))))},t}(o.a.Component);T.propTypes={value:m.a.oneOfType([m.a.number,m.a.string]),defaultValue:m.a.oneOfType([m.a.number,m.a.string]),focusOnUpDown:m.a.bool,autoFocus:m.a.bool,onChange:m.a.func,onPressEnter:m.a.func,onKeyDown:m.a.func,onKeyUp:m.a.func,prefixCls:m.a.string,tabIndex:m.a.oneOfType([m.a.string,m.a.number]),disabled:m.a.bool,onFocus:m.a.func,onBlur:m.a.func,readOnly:m.a.bool,max:m.a.number,min:m.a.number,step:m.a.oneOfType([m.a.number,m.a.string]),upHandler:m.a.node,downHandler:m.a.node,useTouch:m.a.bool,formatter:m.a.func,parser:m.a.func,onMouseEnter:m.a.func,onMouseLeave:m.a.func,onMouseOver:m.a.func,onMouseOut:m.a.func,onMouseUp:m.a.func,precision:m.a.number,required:m.a.bool,pattern:m.a.string,decimalSeparator:m.a.string,inputMode:m.a.string},T.defaultProps={focusOnUpDown:!0,useTouch:!1,prefixCls:"rc-input-number",min:-M,step:1,style:{},onChange:N,onKeyDown:N,onPressEnter:N,onFocus:N,onBlur:N,parser:function(e){return e.replace(/[^\w\.-]+/g,"")},required:!1,autoComplete:"off"};var j=function(){var e=this;this.onKeyDown=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var a=e.props,i=a.onKeyDown,u=a.onPressEnter;if(t.keyCode===g.a.UP){var s=e.getRatio(t);e.up(t,s),e.stop()}else if(t.keyCode===g.a.DOWN){var c=e.getRatio(t);e.down(t,c),e.stop()}else t.keyCode===g.a.ENTER&&u&&u(t);e.recordCursorPosition(),e.lastKeyCode=t.keyCode,i&&i.apply(void 0,[t].concat(r))},this.onKeyUp=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];var a=e.props.onKeyUp;e.stop(),e.recordCursorPosition(),a&&a.apply(void 0,[t].concat(r))},this.onChange=function(t){var n=e.props.onChange;e.state.focused&&(e.inputting=!0),e.rawInput=e.props.parser(e.getValueFromEvent(t)),e.composing?e.setState({inputValue:e.getValueFromEvent(t)}):(e.setState({inputValue:e.rawInput}),n(e.toNumber(e.rawInput)))},this.onMouseUp=function(){var t=e.props.onMouseUp;e.recordCursorPosition(),t&&t.apply(void 0,arguments)},this.onFocus=function(){var t;e.setState({focused:!0}),(t=e.props).onFocus.apply(t,arguments)},this.onBlur=function(){var t=e.props.onBlur;e.inputting=!1,e.setState({focused:!1});var n=e.getCurrentValidValue(e.state.inputValue),r=e.setValue(n);if(t){var o=e.input.value,a=e.getInputDisplayValue({focus:!1,value:r});e.input.value=a,t.apply(void 0,arguments),e.input.value=o}},this.onComposition=function(t){"compositionstart"===t.type?e.composing=!0:"compositionend"===t.type&&(e.composing=!1,e.onChange(t))},this.getInputDisplayValue=function(t){var n=t||e.state,r=n.focused,o=n.inputValue,a=n.value,i=void 0;null==(i=r?o:e.toPrecisionAsStep(a))&&(i="");var u=e.formatWrapper(i);return V(e.props.decimalSeparator)&&(u=u.toString().replace(".",e.props.decimalSeparator)),u},this.recordCursorPosition=function(){try{e.cursorStart=e.input.selectionStart,e.cursorEnd=e.input.selectionEnd,e.currentValue=e.input.value,e.cursorBefore=e.input.value.substring(0,e.cursorStart),e.cursorAfter=e.input.value.substring(e.cursorEnd)}catch(e){}},this.restoreByAfter=function(t){if(void 0===t)return!1;var n=e.input.value,r=n.lastIndexOf(t);if(-1===r)return!1;var o=e.cursorBefore.length;return e.lastKeyCode===g.a.DELETE&&e.cursorBefore.charAt(o-1)===t[0]?(e.fixCaret(o,o),!0):r+t.length===n.length&&(e.fixCaret(r,r),!0)},this.partRestoreByAfter=function(t){return void 0!==t&&Array.prototype.some.call(t,(function(n,r){var o=t.substring(r);return e.restoreByAfter(o)}))},this.stop=function(){e.autoStepTimer&&clearTimeout(e.autoStepTimer)},this.down=function(t,n,r){e.pressingUpOrDown=!0,e.step("down",t,n,r)},this.up=function(t,n,r){e.pressingUpOrDown=!0,e.step("up",t,n,r)},this.saveUp=function(t){e.upHandler=t},this.saveDown=function(t){e.downHandler=t},this.saveInput=function(t){e.input=t}},D=T,U=n("CtXQ"),_=n("H84U");function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function A(){return(A=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}).apply(this,arguments)}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function K(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)}}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function B(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=H(e);if(t){var o=H(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return G(this,n)}}function G(e,t){return!t||"object"!==R(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function H(e){return(H=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var q=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},W=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}(u,e);var t,n,o,a=B(u);function u(){var e;return F(this,u),(e=a.apply(this,arguments)).saveInputNumber=function(t){e.inputNumberRef=t},e.renderInputNumber=function(t){var n,o=t.getPrefixCls,a=e.props,u=a.className,s=a.size,c=a.prefixCls,l=q(a,["className","size","prefixCls"]),p=o("input-number",c),f=i()((I(n={},"".concat(p,"-lg"),"large"===s),I(n,"".concat(p,"-sm"),"small"===s),n),u),h=r.createElement(U.default,{type:"up",className:"".concat(p,"-handler-up-inner")}),d=r.createElement(U.default,{type:"down",className:"".concat(p,"-handler-down-inner")});return r.createElement(D,A({ref:e.saveInputNumber,className:f,upHandler:h,downHandler:d,prefixCls:p},l))},e}return t=u,(n=[{key:"focus",value:function(){this.inputNumberRef.focus()}},{key:"blur",value:function(){this.inputNumberRef.blur()}},{key:"render",value:function(){return r.createElement(_.a,null,this.renderInputNumber)}}])&&K(t.prototype,n),o&&K(t,o),u}(r.Component);W.defaultProps={step:1}},kaz8:function(e,t,n){"use strict";n.r(t);var r=n("q1tI"),o=n("17x9"),a=n("VCL8"),i=n("TSYQ"),u=n.n(i),s=n("x1Ya"),c=n("Gytx"),l=n.n(c),p=n("H84U"),f=n("6CfX");function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(){return(v=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}).apply(this,arguments)}function y(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(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)}}function m(e,t){return(m=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=x(e);if(t){var o=x(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return C(this,n)}}function C(e,t){return!t||"object"!==h(t)&&"function"!=typeof t?O(e):t}function O(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e){return(x=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},S=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&m(e,t)}(i,e);var t,n,o,a=g(i);function i(){var e;return y(this,i),(e=a.apply(this,arguments)).saveCheckbox=function(t){e.rcCheckbox=t},e.renderCheckbox=function(t){var n,o=t.getPrefixCls,a=O(e),i=a.props,c=a.context,l=i.prefixCls,p=i.className,f=i.children,h=i.indeterminate,y=i.style,b=i.onMouseEnter,m=i.onMouseLeave,g=w(i,["prefixCls","className","children","indeterminate","style","onMouseEnter","onMouseLeave"]),C=c.checkboxGroup,x=o("checkbox",l),S=v({},g);C&&(S.onChange=function(){g.onChange&&g.onChange.apply(g,arguments),C.toggleOption({label:f,value:i.value})},S.name=C.name,S.checked=-1!==C.value.indexOf(i.value),S.disabled=i.disabled||C.disabled);var E=u()(p,(d(n={},"".concat(x,"-wrapper"),!0),d(n,"".concat(x,"-wrapper-checked"),S.checked),d(n,"".concat(x,"-wrapper-disabled"),S.disabled),n)),N=u()(d({},"".concat(x,"-indeterminate"),h));return r.createElement("label",{className:E,style:y,onMouseEnter:b,onMouseLeave:m},r.createElement(s.a,v({},S,{prefixCls:x,className:N,ref:e.saveCheckbox})),void 0!==f&&r.createElement("span",null,f))},e}return t=i,(n=[{key:"componentDidMount",value:function(){var e=this.props.value,t=(this.context||{}).checkboxGroup,n=void 0===t?{}:t;n.registerValue&&n.registerValue(e),Object(f.a)("checked"in this.props||(this.context||{}).checkboxGroup||!("value"in this.props),"Checkbox","`value` is not validate prop, do you mean `checked`?")}},{key:"shouldComponentUpdate",value:function(e,t,n){return!l()(this.props,e)||!l()(this.state,t)||!l()(this.context.checkboxGroup,n.checkboxGroup)}},{key:"componentDidUpdate",value:function(e){var t=e.value,n=this.props.value,r=(this.context||{}).checkboxGroup,o=void 0===r?{}:r;n!==t&&o.registerValue&&o.cancelValue&&(o.cancelValue(t),o.registerValue(n))}},{key:"componentWillUnmount",value:function(){var e=this.props.value,t=(this.context||{}).checkboxGroup,n=void 0===t?{}:t;n.cancelValue&&n.cancelValue(e)}},{key:"focus",value:function(){this.rcCheckbox.focus()}},{key:"blur",value:function(){this.rcCheckbox.blur()}},{key:"render",value:function(){return r.createElement(p.a,null,this.renderCheckbox)}}])&&b(t.prototype,n),o&&b(t,o),i}(r.Component);S.__ANT_CHECKBOX=!0,S.defaultProps={indeterminate:!1},S.contextTypes={checkboxGroup:o.any},Object(a.polyfill)(S);var E=S,N=n("BGR+");function P(e){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function M(){return(M=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}).apply(this,arguments)}function V(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function T(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)}}function j(e,t){return(j=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=R(e);if(t){var o=R(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return U(this,n)}}function U(e,t){return!t||"object"!==P(t)&&"function"!=typeof t?_(e):t}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var A=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},I=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&j(e,t)}(i,e);var t,n,o,a=D(i);function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=a.call(this,e)).cancelValue=function(e){t.setState((function(t){return{registeredValues:t.registeredValues.filter((function(t){return t!==e}))}}))},t.registerValue=function(e){t.setState((function(t){var n=t.registeredValues;return{registeredValues:[].concat(V(n),[e])}}))},t.toggleOption=function(e){var n=t.state.registeredValues,r=t.state.value.indexOf(e.value),o=V(t.state.value);-1===r?o.push(e.value):o.splice(r,1),"value"in t.props||t.setState({value:o});var a=t.props.onChange;if(a){var i=t.getOptions();a(o.filter((function(e){return-1!==n.indexOf(e)})).sort((function(e,t){return i.findIndex((function(t){return t.value===e}))-i.findIndex((function(e){return e.value===t}))})))}},t.renderGroup=function(e){var n=e.getPrefixCls,o=_(t),a=o.props,i=o.state,s=a.prefixCls,c=a.className,l=a.style,p=a.options,f=A(a,["prefixCls","className","style","options"]),h=n("checkbox",s),d="".concat(h,"-group"),v=Object(N.a)(f,["children","defaultValue","value","onChange","disabled"]),y=a.children;p&&p.length>0&&(y=t.getOptions().map((function(e){return r.createElement(E,{prefixCls:h,key:e.value.toString(),disabled:"disabled"in e?e.disabled:a.disabled,value:e.value,checked:-1!==i.value.indexOf(e.value),onChange:e.onChange,className:"".concat(d,"-item")},e.label)})));var b=u()(d,c);return r.createElement("div",M({className:b,style:l},v),y)},t.state={value:e.value||e.defaultValue||[],registeredValues:[]},t}return t=i,o=[{key:"getDerivedStateFromProps",value:function(e){return"value"in e?{value:e.value||[]}:null}}],(n=[{key:"getChildContext",value:function(){return{checkboxGroup:{toggleOption:this.toggleOption,value:this.state.value,disabled:this.props.disabled,name:this.props.name,registerValue:this.registerValue,cancelValue:this.cancelValue}}}},{key:"shouldComponentUpdate",value:function(e,t){return!l()(this.props,e)||!l()(this.state,t)}},{key:"getOptions",value:function(){return this.props.options.map((function(e){return"string"==typeof e?{label:e,value:e}:e}))}},{key:"render",value:function(){return r.createElement(p.a,null,this.renderGroup)}}])&&T(t.prototype,n),o&&T(t,o),i}(r.Component);I.defaultProps={options:[]},I.propTypes={defaultValue:o.array,value:o.array,options:o.array.isRequired,onChange:o.func},I.childContextTypes={checkboxGroup:o.any},Object(a.polyfill)(I);var F=I;E.Group=F;t.default=E},xaim:function(e,t,n){}}]); |