| 123 |
- !function e(t,s,o){function n(i,l){if(!s[i]){if(!t[i]){var r="function"==typeof require&&require;if(!l&&r)return r(i,!0);if(a)return a(i,!0);var p=new Error("Cannot find module '"+i+"'");throw p.code="MODULE_NOT_FOUND",p}var c=s[i]={exports:{}};t[i][0].call(c.exports,function(e){var s=t[i][1][e];return n(s?s:e)},c,c.exports,e,t,s,o)}return s[i].exports}for(var a="function"==typeof require&&require,i=0;i<o.length;i++)n(o[i]);return n}({1:[function(e,t,s){var o=e("react"),n=e("classnames"),a=o.createClass({displayName:"Option",propTypes:{addLabelText:o.PropTypes.string,className:o.PropTypes.string,mouseDown:o.PropTypes.func,mouseEnter:o.PropTypes.func,mouseLeave:o.PropTypes.func,option:o.PropTypes.object.isRequired,renderFunc:o.PropTypes.func},blockEvent:function(e){e.preventDefault(),"A"===e.target.tagName&&"href"in e.target&&(e.target.target?window.open(e.target.href):window.location.href=e.target.href)},render:function(){var e=this.props.option,t=e.create?this.props.addLabelText.replace("{label}",e.label):this.props.renderFunc(e),s=n(this.props.className,e.className);return e.disabled?o.createElement("div",{className:s,onMouseDown:this.blockEvent,onClick:this.blockEvent},t):o.createElement("div",{className:s,style:e.style,onMouseEnter:this.props.mouseEnter,onMouseLeave:this.props.mouseLeave,onMouseDown:this.props.mouseDown,onClick:this.props.mouseDown,title:e.title},t)}});t.exports=a},{classnames:"classnames",react:"react"}],2:[function(e,t,s){var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},n=e("react"),a=e("react-dom"),i=e("react-input-autosize"),l=e("classnames"),r=e("./Value"),p=e("./SingleValue"),c=e("./Option"),u=0,d=n.createClass({displayName:"Select",propTypes:{addLabelText:n.PropTypes.string,allowCreate:n.PropTypes.bool,asyncOptions:n.PropTypes.func,autoload:n.PropTypes.bool,backspaceRemoves:n.PropTypes.bool,cacheAsyncResults:n.PropTypes.bool,className:n.PropTypes.string,clearAllText:n.PropTypes.string,clearValueText:n.PropTypes.string,clearable:n.PropTypes.bool,delimiter:n.PropTypes.string,disabled:n.PropTypes.bool,filterOption:n.PropTypes.func,filterOptions:n.PropTypes.func,ignoreCase:n.PropTypes.bool,inputProps:n.PropTypes.object,isLoading:n.PropTypes.bool,labelKey:n.PropTypes.string,matchPos:n.PropTypes.string,matchProp:n.PropTypes.string,multi:n.PropTypes.bool,name:n.PropTypes.string,newOptionCreator:n.PropTypes.func,noResultsText:n.PropTypes.string,onBlur:n.PropTypes.func,onChange:n.PropTypes.func,onFocus:n.PropTypes.func,onInputChange:n.PropTypes.func,onOptionLabelClick:n.PropTypes.func,optionComponent:n.PropTypes.func,optionRenderer:n.PropTypes.func,options:n.PropTypes.array,placeholder:n.PropTypes.string,searchable:n.PropTypes.bool,searchingText:n.PropTypes.string,searchPromptText:n.PropTypes.string,singleValueComponent:n.PropTypes.func,value:n.PropTypes.any,valueComponent:n.PropTypes.func,valueKey:n.PropTypes.string,valueRenderer:n.PropTypes.func},getDefaultProps:function(){return{addLabelText:'Add "{label}"?',allowCreate:!1,asyncOptions:void 0,autoload:!0,backspaceRemoves:!0,cacheAsyncResults:!0,className:void 0,clearAllText:"Clear all",clearValueText:"Clear value",clearable:!0,delimiter:",",disabled:!1,ignoreCase:!0,inputProps:{},isLoading:!1,labelKey:"label",matchPos:"any",matchProp:"any",name:void 0,newOptionCreator:void 0,noResultsText:"No results found",onChange:void 0,onInputChange:void 0,onOptionLabelClick:void 0,optionComponent:c,options:void 0,placeholder:"Select...",searchable:!0,searchingText:"Searching...",searchPromptText:"Type to search",singleValueComponent:p,value:void 0,valueComponent:r,valueKey:"value"}},getInitialState:function(){return{isFocused:!1,isLoading:!1,isOpen:!1,options:this.props.options}},componentWillMount:function(){var e=this;this._optionsCache={},this._optionsFilterString="",this._closeMenuIfClickedOutside=function(t){if(e.state.isOpen){var s=a.findDOMNode(e.refs.selectMenuContainer),o=a.findDOMNode(e.refs.control),n=e.clickedOutsideElement(s,t),i=e.clickedOutsideElement(o,t);n&&i&&e.setState({isOpen:!1},e._unbindCloseMenuIfClickedOutside)}},this._bindCloseMenuIfClickedOutside=function(){!document.addEventListener&&document.attachEvent?document.attachEvent("onclick",e._closeMenuIfClickedOutside):document.addEventListener("click",e._closeMenuIfClickedOutside)},this._unbindCloseMenuIfClickedOutside=function(){!document.removeEventListener&&document.detachEvent?document.detachEvent("onclick",e._closeMenuIfClickedOutside):document.removeEventListener("click",e._closeMenuIfClickedOutside)},this.setState(this.getStateFromValue(this.props.value))},componentDidMount:function(){this.props.asyncOptions&&this.props.autoload&&this.autoloadAsyncOptions()},componentWillUnmount:function(){clearTimeout(this._blurTimeout),clearTimeout(this._focusTimeout),this.state.isOpen&&this._unbindCloseMenuIfClickedOutside()},componentWillReceiveProps:function(e){var t=this,s=!1;if(JSON.stringify(e.options)!==JSON.stringify(this.props.options)&&(s=!0,this.setState({options:e.options,filteredOptions:this.filterOptions(e.options)})),e.value!==this.state.value||e.placeholder!==this.props.placeholder||s){var o=function(s){t.setState(t.getStateFromValue(e.value,s&&s.options||e.options,e.placeholder))};this.props.asyncOptions?this.loadAsyncOptions(e.value,{},o):o()}},componentDidUpdate:function(){var e=this;if(!this.props.disabled&&this._focusAfterUpdate&&(clearTimeout(this._blurTimeout),clearTimeout(this._focusTimeout),this._focusTimeout=setTimeout(function(){e.isMounted()&&(e.getInputNode().focus(),e._focusAfterUpdate=!1)},50)),this._focusedOptionReveal){if(this.refs.focused&&this.refs.menu){var t=a.findDOMNode(this.refs.focused),s=a.findDOMNode(this.refs.menu),o=t.getBoundingClientRect(),n=s.getBoundingClientRect();(o.bottom>n.bottom||o.top<n.top)&&(s.scrollTop=t.offsetTop+t.clientHeight-s.offsetHeight)}this._focusedOptionReveal=!1}},focus:function(){this.getInputNode().focus()},clickedOutsideElement:function(e,t){for(var s=t.target?t.target:t.srcElement;null!=s;){if(s===e)return!1;s=s.offsetParent}return!0},getStateFromValue:function(e,t,s){var o=this;t||(t=this.state.options),s||(s=this.props.placeholder),this._optionsFilterString="";var n,a=this.initValuesArray(e,t),i=this.filterOptions(t,a),l=null;return!this.props.multi&&a.length?(n=a[0],l=a[0][this.props.valueKey]):(n=this.getFirstFocusableOption(i),l=a.map(function(e){return e[o.props.valueKey]}).join(this.props.delimiter)),{value:l,values:a,inputValue:"",filteredOptions:i,placeholder:!this.props.multi&&a.length?a[0][this.props.labelKey]:s,focusedOption:n}},getFirstFocusableOption:function(e){for(var t=0;t<e.length;++t)if(!e[t].disabled)return e[t]},initValuesArray:function(e,t){var s=this;return Array.isArray(e)||(e="string"==typeof e?""===e?[]:this.props.multi?e.split(this.props.delimiter):[e]:void 0!==e&&null!==e?[e]:[]),e.map(function(e){if("string"==typeof e||"number"==typeof e){for(var o in t)if(t.hasOwnProperty(o)&&t[o]&&(t[o][s.props.valueKey]===e||"number"==typeof t[o][s.props.valueKey]&&t[o][s.props.valueKey].toString()===e))return t[o];return{value:e,label:e}}return e})},setValue:function(e,t){(t||void 0===t)&&(this._focusAfterUpdate=!0);var s=this.getStateFromValue(e);s.isOpen=!1,this.fireChangeEvent(s),this.setState(s)},selectValue:function(e){this.props.multi?e&&this.addValue(e):this.setValue(e),this._unbindCloseMenuIfClickedOutside()},addValue:function(e){this.setValue(this.state.values.concat(e))},popValue:function(){this.setValue(this.state.values.slice(0,this.state.values.length-1))},removeValue:function(e){this.setValue(this.state.values.filter(function(t){return t!==e}))},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(null))},resetValue:function(){this.setValue(""===this.state.value?null:this.state.value)},getInputNode:function(){var e=this.refs.input;return this.props.searchable?e:a.findDOMNode(e)},fireChangeEvent:function(e){e.value!==this.state.value&&this.props.onChange&&this.props.onChange(e.value,e.values)},handleMouseDown:function(e){return this.props.disabled||"mousedown"===e.type&&0!==e.button?void 0:(e.stopPropagation(),e.preventDefault(),this.state.isOpen&&!this.props.searchable?void this.setState({isOpen:!1},this._unbindCloseMenuIfClickedOutside):void(this.state.isFocused?this.setState({isOpen:!0},this._bindCloseMenuIfClickedOutside):(this._openAfterFocus=!0,this.getInputNode().focus())))},handleMouseDownOnMenu:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault())},handleMouseDownOnArrow:function(e){this.props.disabled||"mousedown"===e.type&&0!==e.button||this.state.isOpen&&(e.stopPropagation(),e.preventDefault(),this.setState({isOpen:!1},this._unbindCloseMenuIfClickedOutside))},handleInputFocus:function(e){var t=this,s=this.state.isOpen||this._openAfterFocus;this.setState({isFocused:!0,isOpen:s},function(){s?t._bindCloseMenuIfClickedOutside():t._unbindCloseMenuIfClickedOutside()}),this._openAfterFocus=!1,this.props.onFocus&&this.props.onFocus(e)},handleInputBlur:function(e){var t=this,s=a.findDOMNode(this.refs.menu);document.activeElement.isEqualNode(s)||(this._blurTimeout=setTimeout(function(){!t._focusAfterUpdate&&t.isMounted()&&t.setState({isFocused:!1,isOpen:!1})},50),this.props.onBlur&&this.props.onBlur(e))},handleKeyDown:function(e){if(!this.props.disabled){switch(e.keyCode){case 8:return void(!this.state.inputValue&&this.props.backspaceRemoves&&(e.preventDefault(),this.popValue()));case 9:if(e.shiftKey||!this.state.isOpen||!this.state.focusedOption)return;this.selectFocusedOption();break;case 13:if(!this.state.isOpen)return;this.selectFocusedOption();break;case 27:this.state.isOpen?this.resetValue():this.props.clearable&&this.clearValue(e);break;case 38:this.focusPreviousOption();break;case 40:this.focusNextOption();break;case 188:if(!this.props.allowCreate||!this.props.multi)return;e.preventDefault(),e.stopPropagation(),this.selectFocusedOption();break;default:return}e.preventDefault()}},_getNewFocusedOption:function(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t]===this.state.focusedOption)return e[t];return this.getFirstFocusableOption(e)},handleInputChange:function(e){if(this._optionsFilterString=e.target.value,this.props.onInputChange&&this.props.onInputChange(e.target.value),this.props.asyncOptions)this.setState({isLoading:!0,inputValue:e.target.value}),this.loadAsyncOptions(e.target.value,{isLoading:!1,isOpen:!0},this._bindCloseMenuIfClickedOutside);else{var t=this.filterOptions(this.state.options);this.setState({isOpen:!0,inputValue:e.target.value,filteredOptions:t,focusedOption:this._getNewFocusedOption(t)},this._bindCloseMenuIfClickedOutside)}},autoloadAsyncOptions:function(){var e=this;this.setState({isLoading:!0}),this.loadAsyncOptions(this.props.value||"",{isLoading:!1},function(){e.setValue(e.props.value,!1)})},loadAsyncOptions:function(e,t,s){void 0===e&&(e="");var o=this,n=this._currentRequestId=u++;if(this.props.cacheAsyncResults)for(var a=0;a<=e.length;a++){var i=e.slice(0,a);if(this._optionsCache[i]&&(e===i||this._optionsCache[i].complete)){var l=this._optionsCache[i].options,r=this.filterOptions(l),p={options:l,filteredOptions:r,focusedOption:this._getNewFocusedOption(r)};for(var c in t)t.hasOwnProperty(c)&&(p[c]=t[c]);return this.setState(p),void(s&&s.call(this,p))}}var d=function(a,i){if(a)throw a;if(o.props.cacheAsyncResults&&(o._optionsCache[e]=i),n===o._currentRequestId){var l=o.filterOptions(i.options),r={options:i.options,filteredOptions:l,focusedOption:o._getNewFocusedOption(l)};for(var p in t)t.hasOwnProperty(p)&&(r[p]=t[p]);o.setState(r),s&&s.call(o,r)}},h=this.props.asyncOptions(e,d);h&&"function"==typeof h.then&&h.then(function(e){d(null,e)},function(e){d(e)})},filterOptions:function(e,t){var s=this._optionsFilterString,o=(t||this.state.values).map(function(e){return e.value});if(this.props.filterOptions)return this.props.filterOptions.call(this,e,s,o);var n=function(e){if(this.props.multi&&o.indexOf(e[this.props.valueKey])>-1)return!1;if(this.props.filterOption)return this.props.filterOption.call(this,e,s);var t=String(e[this.props.valueKey]),n=String(e[this.props.labelKey]);return this.props.ignoreCase&&(t=t.toLowerCase(),n=n.toLowerCase(),s=s.toLowerCase()),s&&"start"!==this.props.matchPos?"label"!==this.props.matchProp&&t.indexOf(s)>=0||"value"!==this.props.matchProp&&n.indexOf(s)>=0:"label"!==this.props.matchProp&&t.substr(0,s.length)===s||"value"!==this.props.matchProp&&n.substr(0,s.length)===s};return(e||[]).filter(n,this)},selectFocusedOption:function(){return this.props.allowCreate&&!this.state.focusedOption?this.selectValue(this.state.inputValue):this.state.focusedOption?this.selectValue(this.state.focusedOption):void 0},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusAdjacentOption:function(e){this._focusedOptionReveal=!0;var t=this.state.filteredOptions.filter(function(e){return!e.disabled});if(!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this.state.focusedOption||t["next"===e?0:t.length-1]},this._bindCloseMenuIfClickedOutside);if(t.length){for(var s=-1,o=0;o<t.length;o++)if(this.state.focusedOption===t[o]){s=o;break}var n=t[0];"next"===e&&s>-1&&s<t.length-1?n=t[s+1]:"previous"===e&&(n=s>0?t[s-1]:t[t.length-1]),this.setState({focusedOption:n})}},unfocusOption:function(e){this.state.focusedOption===e&&this.setState({focusedOption:null})},buildMenu:function(){var e=this,t=this.state.focusedOption?this.state.focusedOption[this.props.valueKey]:null,s=this.props.optionRenderer;s||(s=function(t){return t[e.props.labelKey]}),this.state.filteredOptions.length>0&&(t=null==t?this.state.filteredOptions[0]:t);var o=this.state.filteredOptions;if(this.props.allowCreate&&this.state.inputValue.trim()){var a=this.state.inputValue;o=o.slice();var i=this.props.newOptionCreator?this.props.newOptionCreator(a):{value:a,label:a,create:!0};o.unshift(i)}var r=Object.keys(o).map(function(e){var a=o[e],i=this.state.value===a[this.props.valueKey],r=t===a[this.props.valueKey],p=l({"Select-option":!0,"is-selected":i,"is-focused":r,"is-disabled":a.disabled}),c=r?"focused":null,u=this.focusOption.bind(this,a),d=this.unfocusOption.bind(this,a),h=this.selectValue.bind(this,a),f=n.createElement(this.props.optionComponent,{key:"option-"+a[this.props.valueKey],className:p,renderFunc:s,mouseEnter:u,mouseLeave:d,mouseDown:h,click:h,addLabelText:this.props.addLabelText,option:a,ref:c});return f},this);if(r.length)return r;var p,c;return this.isLoading()?(c="Select-searching",p=this.props.searchingText):this.state.inputValue||!this.props.asyncOptions?(c="Select-noresults",p=this.props.noResultsText):(c="Select-search-prompt",p=this.props.searchPromptText),n.createElement("div",{className:c},p)},handleOptionLabelClick:function(e,t){this.props.onOptionLabelClick&&this.props.onOptionLabelClick(e,t)},isLoading:function(){return this.props.isLoading||this.state.isLoading},render:function(){var e=l("Select",this.props.className,{"Select--multi":this.props.multi,"is-searchable":this.props.searchable,"is-open":this.state.isOpen,"is-focused":this.state.isFocused,"is-loading":this.isLoading(),"is-disabled":this.props.disabled,"has-value":this.state.value}),t=[];if(this.props.multi&&this.state.values.forEach(function(e){var s=this.handleOptionLabelClick.bind(this,e),o=this.removeValue.bind(this,e),a=n.createElement(this.props.valueComponent,{key:e.value,option:e,renderer:this.props.valueRenderer,optionLabelClick:!!this.props.onOptionLabelClick,onOptionLabelClick:s,onRemove:o,disabled:this.props.disabled});t.push(a)},this),!(this.state.inputValue||this.props.multi&&t.length)){var s=this.state.values[0]||null;if(this.props.valueRenderer&&this.state.values.length)t.push(n.createElement(r,{key:0,option:s,renderer:this.props.valueRenderer,disabled:this.props.disabled}));else{var a=n.createElement(this.props.singleValueComponent,{key:"placeholder",value:s,placeholder:this.state.placeholder});t.push(a)}}var p,c,u=this.isLoading()?n.createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},n.createElement("span",{className:"Select-loading"})):null,d=this.props.clearable&&this.state.value&&!this.props.disabled&&!this.isLoading()?n.createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchEnd:this.clearValue,onClick:this.clearValue},n.createElement("span",{className:"Select-clear",dangerouslySetInnerHTML:{__html:"×"}})):null,h=n.createElement("span",{className:"Select-arrow-zone",onMouseDown:this.handleMouseDownOnArrow},n.createElement("span",{className:"Select-arrow",onMouseDown:this.handleMouseDownOnArrow}));this.state.isOpen&&(c={ref:"menu",className:"Select-menu",onMouseDown:this.handleMouseDownOnMenu},p=n.createElement("div",{ref:"selectMenuContainer",className:"Select-menu-outer"},n.createElement("div",c,this.buildMenu())));var f,m={ref:"input",className:"Select-input "+(this.props.inputProps.className||""),tabIndex:this.props.tabIndex||0,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur};for(var g in this.props.inputProps)this.props.inputProps.hasOwnProperty(g)&&"className"!==g&&(m[g]=this.props.inputProps[g]);return this.props.disabled?this.props.multi&&this.state.values.length||(f=n.createElement("div",{className:"Select-input"}," ")):f=this.props.searchable?n.createElement(i,o({value:this.state.inputValue,onChange:this.handleInputChange,minWidth:"5"},m)):n.createElement("div",m," "),n.createElement("div",{ref:"wrapper",className:e},n.createElement("input",{type:"hidden",ref:"value",name:this.props.name,value:this.state.value,disabled:this.props.disabled}),n.createElement("div",{className:"Select-control",ref:"control",onKeyDown:this.handleKeyDown,onMouseDown:this.handleMouseDown,onTouchEnd:this.handleMouseDown},t,f,u,d,h),p)}});t.exports=d},{"./Option":1,"./SingleValue":3,"./Value":4,classnames:"classnames",react:"react","react-dom":"react-dom","react-input-autosize":5}],3:[function(e,t,s){var o=e("react"),n=e("classnames"),a=o.createClass({displayName:"SingleValue",propTypes:{placeholder:o.PropTypes.string,value:o.PropTypes.object},render:function(){var e=n("Select-placeholder",this.props.value&&this.props.value.className);return o.createElement("div",{className:e,style:this.props.value&&this.props.value.style,title:this.props.value&&this.props.value.title},this.props.placeholder)}});t.exports=a},{classnames:"classnames",react:"react"}],4:[function(e,t,s){var o=e("react"),n=e("classnames"),a=o.createClass({displayName:"Value",propTypes:{disabled:o.PropTypes.bool,onOptionLabelClick:o.PropTypes.func,onRemove:o.PropTypes.func,option:o.PropTypes.object.isRequired,optionLabelClick:o.PropTypes.bool,renderer:o.PropTypes.func},blockEvent:function(e){e.stopPropagation()},handleOnRemove:function(e){this.props.disabled||this.props.onRemove(e)},render:function(){var e=this.props.option.label;return this.props.renderer&&(e=this.props.renderer(this.props.option)),this.props.onRemove||this.props.optionLabelClick?(this.props.optionLabelClick&&(e=o.createElement("a",{className:n("Select-item-label__a",this.props.option.className),onMouseDown:this.blockEvent,onTouchEnd:this.props.onOptionLabelClick,onClick:this.props.onOptionLabelClick,style:this.props.option.style,title:this.props.option.title},e)),o.createElement("div",{className:n("Select-item",this.props.option.className),style:this.props.option.style,title:this.props.option.title},o.createElement("span",{className:"Select-item-icon",onMouseDown:this.blockEvent,onClick:this.handleOnRemove,onTouchEnd:this.handleOnRemove},"×"),o.createElement("span",{className:"Select-item-label"},e))):o.createElement("div",{className:n("Select-value",this.props.option.className),style:this.props.option.style,title:this.props.option.title},e)}});t.exports=a},{classnames:"classnames",react:"react"}],5:[function(e,t,s){var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},n=e("react"),a={position:"absolute",visibility:"hidden",height:0,width:0,overflow:"scroll",whiteSpace:"nowrap"},i=n.createClass({displayName:"AutosizeInput",propTypes:{value:n.PropTypes.any,defaultValue:n.PropTypes.any,onChange:n.PropTypes.func,style:n.PropTypes.object,className:n.PropTypes.string,minWidth:n.PropTypes.oneOfType([n.PropTypes.number,n.PropTypes.string]),inputStyle:n.PropTypes.object,inputClassName:n.PropTypes.string},getDefaultProps:function(){return{minWidth:1}},getInitialState:function(){return{inputWidth:this.props.minWidth}},componentDidMount:function(){this.copyInputStyles(),this.updateInputWidth()},componentDidUpdate:function(){this.updateInputWidth()},copyInputStyles:function(){if(this.isMounted()&&window.getComputedStyle){var e=window.getComputedStyle(this.refs.input),t=this.refs.sizer;if(t.style.fontSize=e.fontSize,t.style.fontFamily=e.fontFamily,t.style.letterSpacing=e.letterSpacing,this.props.placeholder){var s=this.refs.placeholderSizer;s.style.fontSize=e.fontSize,s.style.fontFamily=e.fontFamily,s.style.letterSpacing=e.letterSpacing}}},updateInputWidth:function(){if(this.isMounted()&&"undefined"!=typeof this.refs.sizer.scrollWidth){var e;e=this.props.placeholder?Math.max(this.refs.sizer.scrollWidth,this.refs.placeholderSizer.scrollWidth)+2:this.refs.sizer.scrollWidth+2,e<this.props.minWidth&&(e=this.props.minWidth),e!==this.state.inputWidth&&this.setState({inputWidth:e})}},getInput:function(){return this.refs.input},focus:function(){this.refs.input.focus()},select:function(){this.refs.input.select()},render:function(){var e=(this.props.value||"").replace(/\&/g,"&").replace(/ /g," ").replace(/\</g,"<").replace(/\>/g,">"),t=this.props.style||{};t.display||(t.display="inline-block");var s=o({},this.props.inputStyle);s.width=this.state.inputWidth,s.boxSizing="content-box";var i=this.props.placeholder?n.createElement("div",{ref:"placeholderSizer",style:a},this.props.placeholder):null;return n.createElement("div",{className:this.props.className,style:t},n.createElement("input",o({},this.props,{ref:"input",className:this.props.inputClassName,style:s})),n.createElement("div",{ref:"sizer",style:a,dangerouslySetInnerHTML:{__html:e}}),i)}});t.exports=i},{react:"react"}],6:[function(e,t,s){function o(e){return e&&e.__esModule?e:{"default":e}}function n(){var e=this,t=this.props.dbg||this.props.dbg,s=this.props.treeLevelLimit,o=[],n=[];this._closeMonthsPickerDropdownIfClickedOutside=function(t){if(e.state.monthsPicker__opened){var s=x["default"].findDOMNode(e.refs.monthsPicker),o=e.clickedOutsideElement(s,t);o&&e.setState({monthsPicker__opened:!1},e._unbindCloseMonthsPickerDropdownIfClickedOutside)}},this._bindCloseMonthsPickerDropdownIfClickedOutside=function(){!document.addEventListener&&document.attachEvent?document.attachEvent("onclick",e._closeMonthsPickerDropdownIfClickedOutside):document.addEventListener("click",e._closeMonthsPickerDropdownIfClickedOutside)},this._unbindCloseMonthsPickerDropdownIfClickedOutside=function(){!document.removeEventListener&&document.detachEvent?document.detachEvent("onclick",e._closeMonthsPickerDropdownIfClickedOutside):document.removeEventListener("click",e._closeMonthsPickerDropdownIfClickedOutside)},this._closeModalKorespInfoIfClickedOutside=function(t){if(e.state.modalKorespInfo__opened){var s=x["default"].findDOMNode(e.refs.modalKorespInfo),o=e.clickedOutsideElement(s,t);o&&e.setState({modalKorespInfo__opened:!1},e._unbindCloseModalKorespInfoActions)}},this._closeModalKorespInfoIfHitEscape=function(t){e.state.modalKorespInfo__opened&&27===t.keyCode&&e.setState({modalKorespInfo__opened:!1},e._unbindCloseModalKorespInfoActions)},this._bindCloseModalKorespInfoActions=function(){!document.addEventListener&&document.attachEvent?(document.attachEvent("onclick",e._closeModalKorespInfoIfClickedOutside),document.attachEvent("keydown",e._closeModalKorespInfoIfHitEscape)):(document.addEventListener("click",e._closeModalKorespInfoIfClickedOutside),document.addEventListener("keydown",e._closeModalKorespInfoIfHitEscape)),t&&console.log("Budget::_bindCloseModalKorespInfoActions. document.body.className",document.body.className),-1===document.body.className.indexOf("modal-open")&&(document.body.className+=document.body.className.length>0?" modal-open":"modal-open")},this._unbindCloseModalKorespInfoActions=function(){if(!document.removeEventListener&&document.detachEvent?(document.detachEvent("onclick",e._closeModalKorespInfoIfClickedOutside),document.detachEvent("keydown",e._closeModalKorespInfoIfHitEscape)):(document.removeEventListener("click",e._closeModalKorespInfoIfClickedOutside),document.removeEventListener("keydown",e._closeModalKorespInfoIfHitEscape)),document.body.className&&-1!==document.body.className.indexOf("modal-open")){var t=new RegExp("(\\s|^)modal-open(\\s|$)");document.body.className=document.body.className.replace(t,"")}},o=[],this.props.projectPathsOrder.map(function(e){if(e){var t=e.split("-").pop();o[t]=!1}}.bind(this)),this.props.projectPathsOrder.map(function(e){if(e){var t=e.split("-");t.length>2&&(t.pop(),t.map(function(e){o[e]=!0}))}}.bind(this)),this.props.projectPathsOrder.map(function(e){if(e){var t=e.split("-");t.pop();t.length<=s&&t.map(function(e){n[e]=!0})}}.bind(this)),this.setState({treeLevelLimit:s,treeHasChildren:o,treeExpanded:n})}function a(){this.props.dbg&&console.log("Budget::componentDidMount.")}function i(e,t){for(var s=t.target?t.target:t.srcElement;null!=s;){if(s===e)return!1;s=s.offsetParent}return!0}function l(e){this.state.monthsPicker__opened?this.setState({monthsPicker__opened:!1},this._unbindCloseMonthsPickerDropdownIfClickedOutside):this.setState({monthsPicker__opened:!0},this._bindCloseMonthsPickerDropdownIfClickedOutside)}function r(e,t){this.props.dbg&&console.log("Budget::showModalKorespInfo. idProject:",e,"month:",t),this.setState({modalKorespInfo__opened:!0,modalKorespInfo__idProject:e,modalKorespInfo__month:t},this._bindCloseModalKorespInfoActions)}function p(){this.props.dbg&&console.log("Budget::hideModalKorespInfo."),this.setState({modalKorespInfo__opened:!1},this._unbindCloseModalKorespInfoActions)}function c(e,t){var s=e.target,o=s.getBoundingClientRect();this.props.dbg&&console.log("Budget::showTooltipKorespInfoTitle. pos:",o),this.setState({tooltipKorespInfoTitle__opened:!0})}function u(e){this.props.dbg&&console.log("Budget::hideTooltipKorespInfoTitle."),this.setState({tooltipKorespInfoTitle__opened:!1})}function d(e){this.props.dbg&&console.log("Budget::toggleOnlySelected. e.target.checked",e.target.checked),this.setState({showOnlySelected:!this.state.showOnlySelected})}function h(e){var t=this.props.projectInfo[e].path,s=t.split("-"),o=this.state.treeLevelLimit,n=this.state.treeExpanded,a=!0;return t?(s.pop(),s.length<=o?!0:(a=!0,s.map(function(e){var t=this.props.projectInfo[e];return t&&t.hasAccess?t.filteredByGroups?null:void(e>0&&!n[e]&&(a=!1)):null}.bind(this)),a)):!1}function f(e){var t=this.state.treeExpanded;t[e]=!t[e],this.setState({treeExpanded:t})}function m(e){var t=this.state.monthsPicker__hiddenMonths,s=t.indexOf(e);this.props.dbg&&console.log("Budget::toggleMonth. month",e,"monthsPicker__hiddenMonths(idx="+s+")",t),-1!==s?t.splice(s,1):t.push(e),this.setState({monthsPicker__hiddenMonths:t})}function g(e){this.setState({monthsPicker__hiddenMonths:[],monthsPicker__opened:!1},this._unbindCloseMonthsPickerDropdownIfClickedOutside)}function y(e,t,s){var o=this.state.selectedProjects,n=this.props.projectPathsMap,a=e.target.checked;this.props.dbg&&console.log("Budget::selectProject. idProj:",t,"path:",s,"e.target.checked:",e.target.checked),this.props.projectPathsOrder.map(function(e){var e=e||"",t=n[e];e&&t&&(s===e||s+"-"===e.substr(0,s.length+1))&&(a?-1===o.indexOf(t)&&o.push(t):-1!==(idx=o.indexOf(t))&&o.splice(idx,1))}),this.setState({selectedProjects:o})}function v(e,t){if(!this.props.costs)return null;if(!this.props.costs[e])return null;if(!this.props.costs[e].costsByMonth)return null;if(!this.props.costs[e].costsByMonth[t])return null;var s=this.props.costs[e].costsByMonth[t];return s?(s.COST_CHILD=(0,A["default"])(s.COST_CHILD),s.COST_SELF=(0,A["default"])(s.COST_SELF),s.COST_TOTAL=(0,A["default"])(s.COST_TOTAL),s.INCOME_CHILD=(0,A["default"])(s.INCOME_CHILD),s.INCOME_SELF=(0,A["default"])(s.INCOME_SELF),s.INCOME_TOTAL=(0,A["default"])(s.INCOME_TOTAL),s):null}function b(e,t){if(!this.props.plan)return 0;if(!this.props.plan[e])return 0;if(!this.props.plan[e][t])return 0;var s=this.props.plan[e][t];return(0,A["default"])(s)}function _(e,t){if(!this.props.costs)return null;if(!this.props.costs[e])return null;if(!this.props.costs[e].korespByMonth)return null;if(!this.props.costs[e].korespByMonth[t])return null;var s=this.props.costs[e].korespByMonth[t];return s&&s.length?s=s.map(function(e){return e.COST=(0,A["default"])(e.COST),e}):null}function O(e,t){var s=this,e=this.state.modalKorespInfo__idProject,t=this.state.modalKorespInfo__month,o=null,n=this.state.modalKorespInfo__opened,a=(0,R["default"])({modal:!0,fade:!0,"in":n}),i={display:n?"block":"none"},l=null,r=0,p=0,c=0,u="",d=0,h=[],f=null,m=0;return this.props.dbg&&console.log("Budget::renderProjectMonthCostDetails."),e&&t?(o="Koszty projektu nr "+this.state.modalKorespInfo__idProject,o+=" w miesiącu "+this.props.year+"-",o+=this.state.modalKorespInfo__month<10?"0":"",o+=this.state.modalKorespInfo__month,this.props.projectInfo[e]?(u=this.props.projectInfo[e].path,d=u.length,h=this.props.projectPathsOrder.filter(function(e){return u+"-"===(""+e).substr(0,d+1)}.bind(this)),this.props.dbg&&console.log("Budget::renderProjectMonthCostDetails. idsProject(paths):",h),h=h.map(function(e){return this.props.projectPathsMap[e]}.bind(this)),h.unshift(e),this.props.dbg&&console.log("Budget::renderProjectMonthCostDetails. idsProject:",h),f=h.map(function(e){var s=this.props.projectInfo[e].path,o=this.props.projectInfo[e].M_DIST_DESC,n=null,a=[];return(n=this.getMonthCostDetails(e,t))?(p+=1,c+=n.length,a.push(N["default"].createElement("tr",{key:e},N["default"].createElement("td",{style:{padding:"3px",fontSize:"1em",background:"#eee",whiteSpace:"nowrap"}},s),N["default"].createElement("td",{colSpan:"3",style:{padding:"3px",fontSize:"1.1em",background:"#eee",maxWidth:"500px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:o},o))),n.map(function(e){var t={maxWidth:"400px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},s=e.TRANSFER_OPPOSITE_ID_PROJECT_TO||0,o=e.TRANSFER_OPPOSITE_ID_PROJECT_FROM||0,n=null;m+=e.COST,s&&(t.fontStyle="italic",t.color="#bbb"),n=o>0?N["default"].createElement("td",{className:"p2 cell-transfer_opposite_id_project"},"Transfer z projektu nr ",o):s>0?N["default"].createElement("td",{className:"p2 cell-transfer_opposite_id_project"},"Transfer do projektu nr ",s):N["default"].createElement("td",{className:"p2 cell-transfer_opposite_id_project"}),a.push(N["default"].createElement("tr",{key:e.ID},N["default"].createElement("td",{className:"p2 l nr"},"nr: ",e.ID,", data: ",e.K_DATA_OTRZYMANEJ_KORESP,N["default"].createElement("br",null),"obcy nr: ",e.K_NR_OTRZYM_KORESP),N["default"].createElement("td",{className:"p2",style:t},N["default"].createElement("span",{title:e.K_ZAWARTOS},e.K_ZAWARTOS),N["default"].createElement("br",null),N["default"].createElement("em",{title:e.K_OD_KOGO},e.K_OD_KOGO)),N["default"].createElement("td",{className:"cell-cost cell-cost-only_child"},(0,F["default"])(e.COST)),n))}.bind(this)),a):null}.bind(this)),f.push(N["default"].createElement("tr",{key:"suma"},N["default"].createElement("td",{
- colSpan:"2",className:"p2",colSpan:"2",style:{textAlign:"right"}},"Suma:"),N["default"].createElement("td",{className:"cell-cost",style:{textAlign:"right"}},(0,F["default"])(m)))),n&&(r+=60,r+=56,r+=65,r+=30,r+=25*p,r+=41*c,r+=20,this.props.dbg&&console.log("Budget::renderProjectMonthCostDetails. modalBackdropHeight:",r," window.innerHeight:",window.innerHeight),r=Math.max(r,window.innerHeight),l=N["default"].createElement("div",{className:"modal-backdrop fade in",style:{height:r+"px"}})),N["default"].createElement("div",{className:a,style:i,tabIndex:"-1",role:"dialog","aria-labelledby":"projectCostDMonthetailsLabel"},l,N["default"].createElement("div",{ref:"modalKorespInfo",className:"modal-dialog",role:"document",style:{minWidth:"900px"}},N["default"].createElement("div",{className:"modal-content"},N["default"].createElement("div",{className:"modal-header"},N["default"].createElement("button",{onClick:function(){return s.hideModalKorespInfo()},type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},N["default"].createElement("span",{"aria-hidden":"true"},"×")),N["default"].createElement("h4",{className:"modal-title",id:"projectCostDMonthetailsLabel"},o)),N["default"].createElement("div",{className:"modal-body"},N["default"].createElement("table",{className:"zestawienie-kosztow-tbl",style:{width:"100%"}},N["default"].createElement("tbody",null,f))),N["default"].createElement("div",{className:"modal-footer"},N["default"].createElement("button",{onClick:function(){return s.hideModalKorespInfo()},type:"button",className:"btn btn-default","data-dismiss":"modal"},"Close")))))):null):null}function C(e){var t=this.state.monthsPicker__hiddenMonths;this.props.dbg;return e.map(function(e){var s=this,o="c col_month_"+e+" thead_col_month",n=""+(10>e?"0"+e:e);return-1!==t.indexOf(e)?null:N["default"].createElement("th",{className:o,colSpan:"3",key:e},n,N["default"].createElement("i",{className:"pull-right glyphicon glyphicon-remove col_month_remove",onClick:function(){return s.toggleMonth(e)},style:{padding:"2px",cursor:"pointer",color:"red"}}))}.bind(this))}function E(e){var t=this.state.monthsPicker__hiddenMonths;this.props.dbg;return e.map(function(e){var s=[],o="c col_month_"+e;return-1!==t.indexOf(e)?null:(s.push(N["default"].createElement("th",{className:o,title:"Koszty wprowadzone do korespondencji"},"Koszty")),s.push(N["default"].createElement("th",{className:o,title:"Plan budżetu"},"Plan")),s.push(N["default"].createElement("th",{className:o,title:"Procent przekroczenia planu"},"%")),s)})}function T(e){var t=this,s=this.state.monthsPicker__hiddenMonths;this.props.dbg;return reactMonthPickerDropdownList=e.map(function(e){var t=this,o=-1===s.indexOf(e);return N["default"].createElement("li",{className:"checkbox",style:{margin:"0 10px"},key:e},N["default"].createElement("label",{style:{width:"100%"}},N["default"].createElement("input",{onChange:function(){return t.toggleMonth(e)},checked:o,type:"checkbox",title:e,value:e}),e))}.bind(this)),s.length&&reactMonthPickerDropdownList.push(N["default"].createElement("li",{className:"checkbox",style:{margin:"0 10px"},key:999},N["default"].createElement("button",{className:"btn btn-link",onClick:function(){return t.showAllMonths()},style:{width:"100%"}},"pokaż wszystkie"))),reactMonthPickerDropdownList}function k(e){var t=0,s=this.state.monthsPicker__hiddenMonths,o=this.state.treeHasChildren,n=this.state.treeExpanded;this.props.dbg;return this.props.projectPathsOrder.map(function(a,i){var l=this,r=this.props.projectPathsMap[a],p=this.props.projectInfo[r],c=p.M_DIST_DESC,u=-1!==this.state.selectedProjects.indexOf(r),d=(0,R["default"])({"row-selected":u}),h=null,f=[],m=null,g=0,y=0;if(!p.hasAccess)return null;if(p.filteredByGroups)return null;if(!this.treeIsVisible(r))return null;if(o[r]){var v="glyphicon";v+=n[r]?" glyphicon-minus":" glyphicon-plus";var b=n[r]?"zwiń":"rozwiń";m=N["default"].createElement("i",{className:v,style:{cursor:"pointer"},title:b,onClick:function(){return l.toggleTreeNode(r)}})}return h=e.map(function(e){var t=this,o=[],n="cell-cost col_month_"+e,a="cell-plan col_month_"+e,i="cell-procent col_month_"+e,l="",p=this.getCost(r,e),c=this.getPlan(r,e),u="",d="",h="";return-1!==s.indexOf(e)?null:(p&&(g+=p.COST_TOTAL),c&&(y+=c),p&&(u=(0,F["default"])(p.COST_TOTAL),n+=p.COST_CHILD>0?p.COST_SELF>0?" cell-cost-self_and_child":" cell-cost-only_child":" cell-cost-only_self",vCostSelfOut=(0,F["default"])(p.COST_SELF),vCostChildOut=(0,F["default"])(p.COST_CHILD),l="Koszt projektu "+vCostSelfOut+" / koszt podprojektów "+vCostChildOut),o.push(N["default"].createElement("td",{className:n},N["default"].createElement("span",{style:{cursor:"pointer"},title:l,onClick:function(){return t.showModalKorespInfo(r,e)}},u))),d=(0,F["default"])(c),o.push(N["default"].createElement("td",{className:a,title:"Plan budżetu"},d)),c>0&&p&&p.COST_TOTAL>0&&(h=Math.round(100*p.COST_TOTAL/c),i=h>150?"cell-procent-over150":h>100?"cell-procent-over100":100==h?"cell-procent-100":"cell-procent-below100"),o.push(N["default"].createElement("td",{className:i,title:"Procent przekroczenia planu"},h)),o)}.bind(this)),f.push(N["default"].createElement("td",{key:"totalCost",className:"row__summary__cost r"},(0,F["default"])(g))),f.push(N["default"].createElement("td",{key:"totalPlan",className:"row__summary__plan r"},(0,F["default"])(y))),t++,N["default"].createElement("tr",{className:d,key:i,"data-lp":t},N["default"].createElement("td",{className:"p2 r nr"},N["default"].createElement("input",{type:"checkbox",onChange:function(e){return l.selectProject(e,r,a)},value:r,checked:u})),N["default"].createElement("td",{className:"p2 l nr",style:{whiteSpace:"nowrap"}},a," ",m),N["default"].createElement("td",{className:"p2",style:{maxWidth:"300px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:c},c),h,f)}.bind(this))}function M(e){var t=this.state.monthsPicker__hiddenMonths,s=(this.state.treeHasChildren,this.state.treeExpanded,41),o=0,n=0,a=[],i=[],l={},r={};this.props.dbg;return e.map(function(e){l[e]=0,r[e]=0}),this.props.projectPathsOrder.map(function(s,o){var n=this.props.projectPathsMap[s],a=this.props.projectInfo[n],i=-1!==this.state.selectedProjects.indexOf(n);return this.state.showOnlySelected&&this.state.selectedProjects.length>0&&!i?null:a.hasAccess?a.filteredByGroups?null:void e.map(function(e){var s=this.getCost(n,e),o=this.getPlan(n,e);return-1!==t.indexOf(e)?null:(s&&(l[e]+=s.COST_SELF),void(o&&(r[e]+=o)))}.bind(this)):null}.bind(this)),this.props.projectPathsOrder.map(function(e,t){var s=this.props.projectPathsMap[e],a=this.props.projectInfo[s];return o+=1,a.hasAccess?a.filteredByGroups?null:void(n+=1):null}.bind(this)),reactProjMonthCols=e.map(function(e){var s=[],o="cell-cost row__summary__cost",n="cell-plan row__summary__plan",a=(0,F["default"])(l[e]),i=(0,F["default"])(r[e]);return-1!==t.indexOf(e)?null:(s.push(N["default"].createElement("td",{className:o},a)),s.push(N["default"].createElement("td",{className:n,title:"Plan budżetu - Suma"},i)),s.push(N["default"].createElement("td",{className:"row__summary__cost"})),s)}.bind(this)),i.push(N["default"].createElement("td",{key:"totalCost",className:"row__summary__cost r"})),i.push(N["default"].createElement("td",{key:"totalPlan",className:"row__summary__plan r"})),a.push(N["default"].createElement("tr",{className:"row__summary__cost",key:"sum"},N["default"].createElement("td",{colSpan:"3",className:"p2",style:{textAlign:"right"}},"Suma:"),reactProjMonthCols,i)),a.push(N["default"].createElement("tr",{key:"total"},N["default"].createElement("td",{colSpan:s},o," projektów (dostęp do ",n,")"))),a}function P(){var e=this,t=[1,2,3,4,5,6,7,8,9,10,11,12];return reactTheadMonthCols=null,reactTheadMonthSubCols=null,reactMonthPickerDropdownList=null,reactTbodyRows=null,reactTfootRows=null,reactProjectMonthCostDetails=null,monthsPickerClassName=(0,R["default"])({"btn-group":!0,"pull-right":!0,dropdown:!0,month_cols_picker:!0,open:this.state.monthsPicker__opened}),monthsPicker__hiddenMonths=this.state.monthsPicker__hiddenMonths,tbodyClassNames=(0,R["default"])({showOnlySelected:this.state.showOnlySelected}),dbg=this.props.dbg,this.props.dbg&&console.log("Budget::render."),reactTheadMonthCols=this.renderTheadMonthCols(t),reactTheadMonthSubCols=this.renderTheadMonthSubCols(t),reactMonthPickerDropdownList=this.renderMonthPickerDropdownList(t),reactTbodyRows=this.renderTbodyRows(t),reactTfootRows=this.renderTfootRows(t),this.state.modalKorespInfo__opened&&(reactProjectMonthCostDetails=this.renderProjectMonthCostDetails()),N["default"].createElement("div",null,N["default"].createElement("div",{className:"container"},N["default"].createElement("div",{style:{"float":"right",color:"#aaa"}},this.props.today),N["default"].createElement("h1",null,"Zestawienie kosztów projektów na rok ",this.props.year)),N["default"].createElement("table",{cellSpacing:"0",cellPadding:"0",border:"0",id:"zestawienie-kosztow-projektow",className:"table-striped zestawienie-kosztow-tbl"},N["default"].createElement("thead",null,N["default"].createElement("tr",null,N["default"].createElement("td",{colSpan:"3",className:"p2"},N["default"].createElement("span",{className:"pull-right"},N["default"].createElement("b",null,"miesiąc "),N["default"].createElement("div",{className:monthsPickerClassName,ref:"monthsPicker"},N["default"].createElement("button",{className:"btn btn-sm btn-link dropdown-toggle",onClick:function(t){return e.toggleMonthsPicker(t)},style:{padding:"0px 10px"}},"wybierz ",N["default"].createElement("span",{className:"caret"})),N["default"].createElement("ul",{className:"dropdown-menu"},reactMonthPickerDropdownList)))),reactTheadMonthCols,N["default"].createElement("th",{colSpan:"2",className:"thead__cols_summary c"},"Suma")),N["default"].createElement("tr",null,N["default"].createElement("td",{colSpan:"3",className:"p2"},N["default"].createElement("span",{className:"pull-left",style:{whiteSpace:"nowrap"}},N["default"].createElement("input",{type:"checkbox",onClick:function(t){return e.toggleOnlySelected(t)}})," pokaż tylko zaznaczone")),reactTheadMonthSubCols,N["default"].createElement("th",{className:"thead__cols_summary c"},"Koszty"),N["default"].createElement("th",{className:"thead__cols_summary c"},"Plan"))),N["default"].createElement("tbody",{className:tbodyClassNames},reactTbodyRows),N["default"].createElement("tfoot",null,reactTfootRows)),reactProjectMonthCostDetails)}function w(e,t){return(0,D["default"])({},N["default"].Component.prototype,{props:e,context:t,state:W,componentWillMount:n,componentDidMount:a,clickedOutsideElement:i,toggleMonthsPicker:l,toggleMonth:m,showAllMonths:g,toggleOnlySelected:d,selectProject:y,getCost:v,getPlan:b,showModalKorespInfo:r,hideModalKorespInfo:p,showTooltipKorespInfoTitle:c,hideTooltipKorespInfoTitle:u,toggleTreeNode:f,treeIsVisible:h,getMonthCostDetails:_,renderProjectMonthCostDetails:O,renderTheadMonthCols:C,renderTheadMonthSubCols:E,renderMonthPickerDropdownList:T,renderTbodyRows:k,renderTfootRows:M,render:P})}Object.defineProperty(s,"__esModule",{value:!0});var S=e("react"),N=o(S),I=e("react-dom"),x=o(I),j=e("object-assign"),D=o(j),L=e("classnames"),R=o(L),K=e("./utils/parseFloatOrZero.js"),A=o(K),z=e("./utils/pricePrint.js"),F=o(z),V=e("./Msg.jsx"),B=(o(V),e("./MsgReply.jsx")),W=(o(B),{monthsPicker__opened:!1,monthsPicker__hiddenMonths:[],showOnlySelected:!1,selectedProjects:[],modalKorespInfo__opened:!1,modalKorespInfo__idProject:0,modalKorespInfo__month:0,treeLevelLimit:1,treeExpanded:[],treeHasChildren:[],dbg:!1});s["default"]=w,t.exports=s["default"]},{"./Msg.jsx":7,"./MsgReply.jsx":8,"./utils/parseFloatOrZero.js":10,"./utils/pricePrint.js":11,classnames:"classnames","object-assign":"object-assign",react:"react","react-dom":"react-dom"}],7:[function(e,t,s){function o(e){return e&&e.__esModule?e:{"default":e}}function n(){this.props.dbg&&console.log("Msg: Component mounted.")}function a(e){e.preventDefault(),this.props.dbg&&console.log("Msg: onClick. msg._read:",this.props.msg._read," msg._readByUser:",this.props.msg._readByUser),this.props.msg._readByUser||this.props.markAsRead(this.props.msg)}function i(e){e.preventDefault(),this.props.onClickReply(e,this.props.msg)}function l(){var e=this,t=this.props.msg,s=0,o="",n=null,a=null,i=null,l=[],r={borderTop:"1px solid #ddd",paddingTop:"10px"},p=(0,f["default"])({row:!0,message:!0,"message-read":!1});if(this.props.dbg&&console.log("Msg: render. msg:",t),"user"===t.toType?(o=" do ",n=c["default"].createElement("strong",null,t.to)):"group"===t.toType?(o=" do grupy ",n=c["default"].createElement("strong",null,t.to)):"everyone"===t.toType&&(o=" do ",n=c["default"].createElement("strong",null,"Wszystkich")),t._readByUser){var u=t.message.split("\n").map(function(e){return c["default"].createElement("div",{key:s++},e)});a=c["default"].createElement("div",{style:{marginBottom:"10px"}},u),i=c["default"].createElement("button",{className:"btn btn-xs btn-default",onClick:function(t){return e.handleClickReply(t)}},"odpisz")}else r.backgroundColor="#eee",a=c["default"].createElement("div",{style:{marginBottom:"10px",color:"#aaa",fontStyle:"italic",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"}},t.message),i=c["default"].createElement("button",{className:"btn btn-xs btn-default disabled",onClick:function(t){return e.handleClickReply(t)}},"odpisz");return t._readByUser?t._readDate?(l.push(c["default"].createElement("em",{key:"read_cofirmed",style:{display:"block"}},"przeczytana ",t._readDate)),t._readBy&&l.push(c["default"].createElement("em",{key:"read_by",style:{display:"block"}},"przez ",t._readBy))):t._read?l.push(c["default"].createElement("em",{key:"read_uncofirmed",style:{display:"block"}},"przeczytana")):l.push(c["default"].createElement("em",{key:"sent",style:{display:"block"}},"nieprzeczytana")):l.push(c["default"].createElement("em",{key:"unread",style:{display:"block"}},"nieprzeczytana")),c["default"].createElement("div",{className:p,"data-messageid":t.id,style:r,onClick:function(t){return e.handleClick(t)}},c["default"].createElement("div",{className:"col-md-1",style:{width:"60px"}},c["default"].createElement("a",{className:"user_avatar",href:"#",title:t.author},t.author.toUpperCase().substr(0,2))),c["default"].createElement("div",{className:"col-md-8"},c["default"].createElement("div",{style:{marginBottom:"10px"}},c["default"].createElement("strong",null,t.author),c["default"].createElement("span",{style:{margin:"0 4px"}},o),n,c["default"].createElement("span",{className:"pull-right"},c["default"].createElement("span",{style:{margin:"0 4px"}},t.created),i)),a),c["default"].createElement("div",{className:"col-md-3",style:{borderLeft:"1px dashed #ddd",textAlign:"right",color:"#ccc"}},l))}function r(e,t){return(0,d["default"])({},c["default"].Component.prototype,{props:e,context:t,state:m,componentDidMount:n,handleClick:a,handleClickReply:i,render:l})}Object.defineProperty(s,"__esModule",{value:!0});var p=e("react"),c=o(p),u=e("object-assign"),d=o(u),h=e("classnames"),f=o(h),m={someState:"Default state value."};s["default"]=r,t.exports=s["default"]},{classnames:"classnames","object-assign":"object-assign",react:"react"}],8:[function(e,t,s){function o(e){return e&&e.__esModule?e:{"default":e}}function n(){if(this.props.dbg&&console.log("MsgReply: Component mounted."),this.props.replyToMsg){var e=this.props.replyToMsg.id,t=document.getElementById("msgReplyTo"+e),s=t?t.offsetTop:0;s>0&&window.scroll(window.scrollX,s)}}function a(e,t){var s=this.state,o=this.props,n=!0;return s.to!=t.to&&(n=!1,this.props.dbg&&console.log("MsgReply: nextState",t,"state",this.state),Object.keys(s).forEach(function(e){"to"!=e&&s[e]!=t[e]&&(n=!0)}),Object.keys(o).forEach(function(t){o[t]!=e[t]&&(n=!0)})),n}function i(e){var t=this,s={isLoadingSaveResult:!1},o=this.props.dbg,n={message:this.state.message,to:this.state.to,toType:this.state.toType,idReplyTo:this.props.replyToMsg.id};e.preventDefault();var a=[];if(this.state.to||a.push("Proszę wybrać adresata wiadomości"),this.state.message?this.state.message.length<3&&a.push("Wiadomość jest za krótka"):a.push("Proszę wprowadzić treść wiadomości"),a.length>0)return void this.setState({errorMsgs:a});var i=function(e,n){if(e)throw e;var a={},i=t.state.errorMsgs;"success"===n.type?(a.successMsg=n.msg||"Wysłano wiadomość",n.record&&t.props.addMessage(n.record)):(i.push(n.msg||"Wystąpiły błędy"),a.errorMsgs=i);for(var l in s)s.hasOwnProperty(l)&&(a[l]=s[l]);o&&console.log("MsgReply: saveReplyResponseHandler setState",a),t.setState(a)};this.setState({isLoadingSaveResult:!0,errorMsgs:[]}),this.props.onSendReply(n,i)}function l(e){e.preventDefault(),this.props.onCancel(e)}function r(e){this.props.dbg&&console.log("MsgReply: TODO: handleChangeMsg",e.target.value),this.setState({message:e.target.value,errorMsgs:[]})}function p(e){this.props.dbg&&console.log("MsgReply: TODO: handleChangeToType",e.target.value),this.setState({toType:e.target.value,to:"",errorMsgs:[]})}function c(e){this.props.dbg&&console.log("MsgReply: TODO: handleChangeTo",e.target.value),this.setState({to:e.target.value,errorMsgs:[]})}function u(){var e=this,t=this.props.replyToMsg,s=this.props.dbg,o=this.props.usrLogin,n=this.state.toType,a=null,i=null,l=null,r=function(e,t){s&&console.log("MsgReply: this_handleChangeTo: val("+e+") objects("+t.length+"):",t),this.setState({to:e})}.bind(this),p=null,c=null;if(s&&console.log("MsgReply: render:1 ... {toType:"+n+"}"),this.state.errorMsgs.length>0){var u=0;p=this.state.errorMsgs.map(function(e){return f["default"].createElement("div",{key:"errorMsg"+u++,className:"alert alert-danger"},e)})}if(this.state.successMsg)return f["default"].createElement("div",{className:"row",style:{marginTop:"15px",paddingTop:"10px",borderTop:"1px solid #ddd"}},f["default"].createElement("div",{className:"col-md-8",style:{marginLeft:"60px"}},f["default"].createElement("div",{className:"alert alert-success"},this.state.successMsg)));if(c=this.state.isLoadingSaveResult?f["default"].createElement("button",{className:"btn btn-md btn-primary",onClick:function(t){return e.handleClickSend(t)}},"Wyślij ..."):f["default"].createElement("button",{className:"btn btn-md btn-primary",onClick:function(t){return e.handleClickSend(t)}},"Wyślij"),"everyone"==n)a=f["default"].createElement("input",{type:"text",className:"form-control",disabled:"disabled"});else if("user"==n){var d=function(e,t){var o=this.state._userTimerId;s&&console.log("MsgReply: getOptions("+e+"):1 (_userTimerId:"+o+") ..."),o&&(s&&console.log("MsgReply: getOptions("+e+"):2 (_userTimerId:"+o+") clear _userTimerId"),clearTimeout(o),this.state._userTimerId=!0);var n=this.props.fetchOptionsForUser;o=setTimeout(function(){n(e,t),o=null},400),this.state._userTimerId=o}.bind(this);s&&console.log("MsgReply: render:2 (_userTimerId) ..."),i=f["default"].createElement(v["default"],{name:"replyToUser",value:this.state.to,placeholder:"Użytkownik...",onChange:r,allowCreate:!1,multi:!1,autoload:!0,asyncOptions:d,cacheAsyncResults:!1})}else if("group"==n){var h=function(e,t){var o=this.state._groupTimerId;s&&console.log("MsgReply: getOptions("+e+"):1 (_groupTimerId:"+o+") ..."),o&&(s&&console.log("MsgReply: getOptions("+e+"):2 (_groupTimerId:"+o+") clear _groupTimerId"),clearTimeout(o),this.state._groupTimerId=null);var n=this.props.fetchOptionsForGroup;o=setTimeout(function(){n(e,t),o=null},400),this.state._groupTimerId=o}.bind(this);s&&console.log("MsgReply: render:2 (_groupTimerId) ..."),l=f["default"].createElement(v["default"],{name:"replyToGroup",value:this.state.to,placeholder:"Grupa...",onChange:r,allowCreate:!1,multi:!1,autoload:!0,asyncOptions:h,cacheAsyncResults:!1})}return f["default"].createElement("div",{className:"row",style:{overflow:"visible",borderTop:"1px solid #ddd",paddingTop:"10px"},id:"msgReplyTo"+t.id},f["default"].createElement("div",{className:"col-md-1"},f["default"].createElement("a",{className:"user_avatar",href:"#",title:o},o.toUpperCase().substr(0,2))),f["default"].createElement("div",{className:"col-md-8",style:{overflow:"visible"}},f["default"].createElement("div",{style:{minHeight:"40px"}},f["default"].createElement("div",{className:"row"},f["default"].createElement("label",{className:"col-sm-1 control-label",style:{lineHeight:"32px"}},"Do:"),f["default"].createElement("div",{className:"col-sm-3"},f["default"].createElement("select",{name:"to_type",className:"form-control",onChange:function(t){return e.handleChangeToType(t)},value:this.state.toType},f["default"].createElement("option",{value:"everyone"},"Wszyscy"),f["default"].createElement("option",{value:"user"},"Użytkownik"),f["default"].createElement("option",{value:"group"},"Grupa"))),f["default"].createElement("div",{className:"col-sm-8",style:{display:"everyone"==n?"block":"none"}},a),f["default"].createElement("div",{className:"col-sm-8",style:{display:"user"==n?"block":"none"}},i),f["default"].createElement("div",{className:"col-sm-8",style:{display:"group"==n?"block":"none"}},l))),f["default"].createElement("div",{className:"row"},f["default"].createElement("div",{className:"col-sm-12",style:{marginBottom:"5px"}},f["default"].createElement("textarea",{className:"form-control",onChange:function(t){return e.handleChangeMsg(t)},value:this.state.message}))),f["default"].createElement("div",{className:"row"},f["default"].createElement("div",{className:"col-sm-12",style:{marginBottom:"5px"}},p)),c,f["default"].createElement("button",{className:"pull-right btn btn-md btn-default",onClick:function(t){return e.handleClickCancel(t)}},"Anuluj")))}function d(e,t){return(0,g["default"])({},f["default"].Component.prototype,{props:e,context:t,state:b,componentDidMount:n,shouldComponentUpdate:a,handleClickSend:i,handleClickCancel:l,handleChangeMsg:r,handleChangeToType:p,handleChangeTo:c,render:u})}Object.defineProperty(s,"__esModule",{value:!0});var h=e("react"),f=o(h),m=e("object-assign"),g=o(m),y=e("react-select"),v=o(y),b={_groupTimerId:null,_userTimerId:null,message:"",to:"",toType:"user",errorMsgs:[],successMsg:"",isLoadingSaveResult:!1};s["default"]=d,t.exports=s["default"]},{"object-assign":"object-assign",react:"react","react-select":2}],9:[function(e,t,s){function o(e){return e&&e.__esModule?e:{"default":e}}var n=e("react"),a=o(n),i=e("react-dom"),l=o(i),r=e("./Budget"),p=o(r);!function(e){function t(){var t={},s={},o={},n={year:void 0,today:void 0,usrLogin:void 0,idThread:void 0,treeLevelLimit:1,projectPathsOrder:[],projectPathsMap:{},projectInfo:{},costs:{},plan:{},dbg:!1};return s.options={},s.init=function(){o.reactNode=l["default"].render(a["default"].createElement(p["default"],s.options),s.options.rootNode),s.options.dbg&&console.log("Budget_priv_init _state:",o),jQuery(".ttip").tooltip({container:"body"})},s.testMethod=function(e){var e=e||{};s.options.dbg&&console.log("Budget_priv_testMethod: args:",e)},t.run=function(e,t){if(s.options.dbg&&console.log('Budget_publ_run: typeof options === "'+typeof e+'"; options:',e),"string"==typeof e){var o=e;if(!s[o]||"function"!=typeof s[o])throw"Error method '"+o+"' not set!";s[o](t)}},t.init=function(o){return s.options.dbg&&console.log("Budget initialization...",o),e.extend(s.options,n,o),s.init(),t},t}if(!e||!e.fn)throw"Error: no jQuery!";e.fn.Budget=function(s,o){return s=s||{},o=o||{},this.each(function(){var n=e(this).data("Budget");n?n.run(s,o):(s.rootNode=this,e(this).data("Budget",(new t).init(s)))})}}(window.jQuery)},{"./Budget":6,react:"react","react-dom":"react-dom"}],10:[function(e,t,s){"use strict";function o(e){if(!e)return 0;var t=parseFloat(e);return isNaN(t)?0:t}Object.defineProperty(s,"__esModule",{value:!0}),s["default"]=o,t.exports=s["default"]},{}],11:[function(e,t,s){"use strict";function o(e,t){if(void 0===t&&(t=""),!e)return t;if("number"==typeof e);else if(e=parseFloat(e),isNaN(e))return t;var s=e.toFixed(2).split("."),o=s[0],n=s[1],a=[],i="";"-"===o.substr(0,1)&&(i="-",o=o.substr(1));for(var l=o.length,r=o,p=0;l>3;)a.unshift(r.substr(-3)),l-=3,r=r.substr(0,l),p++;return l>0&&a.unshift(r),""+i+a.join(",")+"."+n}Object.defineProperty(s,"__esModule",{value:!0}),s["default"]=o,t.exports=s["default"]},{}]},{},[9]);
- //# sourceMappingURL=bundle.se_route_budget.js.map
|