fineui是帆软报表和BI产品线所使用的前端框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 lines
211 KiB

8 years ago
/*! index 14-03-2017 */
BI.Action=BI.inherit(BI.OB,{_defaultConfig:function(){return BI.extend(BI.Action.superclass._defaultConfig.apply(this,arguments),{src:null,tar:null})},_init:function(){BI.Action.superclass._init.apply(this,arguments)},actionPerformed:function(a,b,c){},actionBack:function(a,b,c){}}),BI.ActionFactory={createAction:function(a,b){var c;switch(a){case"show":c=BI.ShowAction}return new c(b)}},BI.EffectShowAction=BI.inherit(BI.Action,{_defaultConfig:function(){return BI.extend(BI.EffectShowAction.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.EffectShowAction.superclass._init.apply(this,arguments)},_checkBrowser:function(){return!1},actionPerformed:function(a,b,c){if(a=a||this.options.src,b=b||this.options.tar||"body",this._checkBrowser()){var d=BI.createWidget({type:"bi.layout",cls:"bi-transfer-temp-el"});BI.createWidget({type:"bi.absolute",element:"body",items:[d]}),d.element.css({width:b.element.width(),height:b.element.height(),top:b.element.offset().top,left:b.element.offset().left}),a.element.effect("transfer",{to:d.element,className:"ui-effects-transfer"},400,function(){d.destroy(),b&&b.element.show(0,c)})}else b&&b.element.show(0,c)},actionBack:function(a,b,c){if(b=b||this.options.src||$("body"),a=a||this.options.tar,a&&a.element.hide(),this._checkBrowser()){var d=BI.createWidget({type:"bi.layout",cls:"bi-transfer-temp-el"});BI.createWidget({type:"bi.absolute",element:"body",items:[d]}),d.element.css({width:b.element.width(),height:b.element.height(),top:b.element.offset().top,left:b.element.offset().left}),a.element.effect("transfer",{to:d.element,className:"ui-effects-transfer"},400,function(){d.destroy(),c&&c()})}else c&&c()}}),BI.ShowAction=BI.inherit(BI.Action,{_defaultConfig:function(){return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.ShowAction.superclass._init.apply(this,arguments)},actionPerformed:function(a,b,c){b=b||this.options.tar,b&&b.element.show(0,c)},actionBack:function(a,b,c){a=a||this.options.tar,a.element.hide(0,c)}}),BI.ScaleShowAction=BI.inherit(BI.Action,{_defaultConfig:function(){return BI.extend(BI.ScaleShowAction.superclass._defaultConfig.apply(this,arguments),{})},_init:function(){BI.ScaleShowAction.superclass._init.apply(this,arguments)},_checkBrowser:function(){return!1},actionPerformed:function(a,b,c){b=b||this.options.tar,this._checkBrowser()?b.element.show("scale",{percent:110},200,c):b.element.show(0,c)},actionBack:function(a,b,c){a=a||this.options.tar,this._checkBrowser()?a.element.hide("scale",{percent:0},200,c):a.element.hide(0,c)}}),BI.Canvas=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Canvas.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-canvas"})},_init:function(){BI.Canvas.superclass._init.apply(this,arguments);var a=this.options,b=document.createElement("canvas");document.createElement("canvas").getContext||(b=window.G_vmlCanvasManager.initElement(b)),this.element.append(b),b.width=a.width,b.height=a.height,$(b).width("100%"),$(b).height("100%"),this.canvas=b,this._queue=[]},_getContext:function(){return this.ctx||(this.ctx=this.canvas.getContext("2d")),this.ctx},_attr:function(a,b){var c=this;if(!BI.isNull(a))return BI.isObject(a)?void BI.each(a,function(a,b){c._queue.push({k:a,v:b})}):void this._queue.push({k:a,v:b})},_line:function(a,b){var c=this,d=[].slice.call(arguments,2);BI.isOdd(d.length)&&(this._attr(BI.last(d)),d=BI.initial(d)),this._attr("moveTo",[a,b]);var e=BI.filter(d,function(a){return a%2===0}),f=BI.filter(d,function(a){return a%2!==0});d=BI.zip(e,f),BI.each(d,function(a,b){c._attr("lineTo",b)})},line:function(a,b,c,d){this._line.apply(this,arguments),this._attr("stroke",[])},rect:function(a,b,c,d,e){this._attr("fillStyle",e),this._attr("fillRect",[a,b,c,d])},circle:function(a,b,c,d){this._attr({fillStyle:d,beginPath:[],arc:[a,b,c,0,2*Math.PI,!0],closePath:[],fill:[]})},hollow:function(){this._attr("beginPath",[]),this._line.apply(this,arguments),this._attr("closePath",[]),this._attr("stroke",[])},solid:function(){this.hollow.apply(this,arguments)
return BI.extend(BI.Navigation.superclass._defaultConfig.apply(this,arguments),{direction:"bottom",logic:{dynamic:!1},defaultShowIndex:0,tab:{type:"bi.button_group",items:[],layouts:[]},cardCreator:function(a){return BI.createWidget()},afterCardCreated:BI.emptyFn,afterCardShow:BI.emptyFn})},_init:function(){BI.Navigation.superclass._init.apply(this,arguments);var a=this,b=this.options;this.tab=BI.createWidget(this.options.tab,{type:"bi.button_group"}),this.cardMap={},this.showIndex=0,this.layout=BI.createWidget({type:"bi.card"}),BI.createWidget(BI.extend({element:this.element},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(b.direction),BI.extend({},b.logic,{items:BI.LogicFactory.createLogicItemsByDirection(b.direction,this.tab,this.layout)})))),new BI.ShowListener({eventObj:this.tab,cardLayout:this.layout,cardNameCreator:function(b){return a.showIndex+b},cardCreator:function(c){var d=b.cardCreator(c);return a.cardMap[c]=d,d},afterCardCreated:BI.bind(this.afterCardCreated,this),afterCardShow:BI.bind(this.afterCardShow,this)}),b.defaultShowIndex!==!1&&this.setSelect(b.defaultShowIndex)},afterCardCreated:function(a){var b=this;this.cardMap[a].on(BI.Controller.EVENT_CHANGE,function(a,c,d){b.fireEvent(BI.Controller.EVENT_CHANGE,arguments),a===BI.Events.CLICK&&b.fireEvent(BI.Navigation.EVENT_CHANGE,d)}),this.options.afterCardCreated.apply(this,arguments)},afterCardShow:function(a){this.showIndex=a,this.options.afterCardShow.apply(this,arguments)},populate:function(){var a=this.layout.getShowingCard();if(a)return a.populate.apply(a,arguments)},setSelect:function(a){if(this.showIndex=a,!this.layout.isCardExisted(a)){var b=this.options.cardCreator(a);this.cardMap[a]=b,this.layout.addCardByName(a,b),this.afterCardCreated(a)}this.layout.showCardByName(a),BI.nextTick(BI.bind(this.afterCardShow,this,a))},getSelect:function(){return this.showIndex},getSelectedCard:function(){if(BI.isKey(this.showIndex))return this.cardMap[this.showIndex]},setValue:function(a){var b=this.layout.getShowingCard();b&&b.setValue(a)},getValue:function(){var a=this.layout.getShowingCard();if(a)return a.getValue()},empty:function(){this.layout.deleteAllCard(),this.cardMap={}},destroy:function(){BI.Navigation.superclass.destroy.apply(this,arguments)}}),BI.Navigation.EVENT_CHANGE="EVENT_CHANGE",$.shortcut("bi.navigation",BI.Navigation),BI.Searcher=BI.inherit(BI.Widget,{_defaultConfig:function(){return BI.extend(BI.Searcher.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-searcher",lgap:0,rgap:0,tgap:0,bgap:0,vgap:0,hgap:0,isDefaultInit:!1,isAutoSearch:!0,isAutoSync:!0,chooseType:BI.ButtonGroup.CHOOSE_TYPE_SINGLE,onSearch:function(a,b){b([])},el:{type:"bi.search_editor"},popup:{type:"bi.searcher_view"},adapter:null,masker:{offset:{}}})},_init:function(){BI.Searcher.superclass._init.apply(this,arguments);var a=this,b=this.options;this.editor=BI.createWidget(b.el,{type:"bi.search_editor"}),BI.createWidget({type:"bi.vertical",element:this.element,lgap:b.lgap,rgap:b.rgap,tgap:b.tgap,bgap:b.bgap,vgap:b.vgap,hgap:b.hgap,items:[this.editor]}),b.isDefaultInit&&this._assertPopupView();var c=BI.debounce(BI.bind(this._search,this),BI.EVENT_RESPONSE_TIME,!0);this.editor.on(BI.Controller.EVENT_CHANGE,function(b){switch(b){case BI.Events.STARTEDIT:a._startSearch();break;case BI.Events.EMPTY:a._stopSearch();break;case BI.Events.CHANGE:c();break;case BI.Events.PAUSE:a._pauseSearch()}})},_assertPopupView:function(){var a=this,b=this.options;BI.Maskers.has(this.getName())||(this.popupView=BI.createWidget(b.popup,{type:"bi.searcher_view",chooseType:b.chooseType}),BI.Maskers.create(this.getName(),b.adapter,{offset:b.masker.offset,container:this,render:this.popupView}),this.popupView.on(BI.Controller.EVENT_CHANGE,function(c,d,e){if(a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),c===BI.Events.CLICK){if(b.isAutoSync){var f=b.adapter.getValue();if(e.isSelected())switch(b.chooseType){case BI.ButtonGroup.CHOOSE_TYPE_SINGLE:b.adapter.setValue([e.getValue()]);break;case BI.ButtonGroup.CHOOSE_TYPE_MULTI:f.push(e.getValue()),b.adapter.setValue(f)}else
})},setEnable:function(a){BI.PopupView.superclass.setEnable.apply(this,arguments),this.view&&this.view.setEnable(a)},setValue:function(a){this.tab&&this.tab.setValue(a),this.button_group.setValue(a)},getValue:function(){return this.button_group.getValue()}}),BI.PopupView.EVENT_CHANGE="EVENT_CHANGE",$.shortcut("bi.popup_view",BI.PopupView),BI.ScrollView=BI.inherit(BI.Widget,{_const:{dropDownHeight:15,expandIcon:"column-next-page-h-font",collapseIcon:"column-pre-page-h-font"},_defaultConfig:function(){return BI.extend(BI.ScrollView.superclass._defaultConfig.apply(this,arguments),{baseCls:"bi-scroll-view",scrollHeight:50,maxHeight:300})},_init:function(){BI.ScrollView.superclass._init.apply(this,arguments),this.scrollUp=!1,this.scroll=BI.createWidget({type:"bi.vertical",cls:"scroll-container",scrolly:!0}),BI.createWidget({type:"bi.vertical",element:this.element,scrolly:!1,items:[this.scroll]}),this.dropdown=BI.createWidget({type:"bi.icon_button",height:this._const.dropDownHeight,cls:"scroll-drop-down-icon "+this._const.expandIcon,handler:BI.bind(this._dropDownOrUp,this)}),BI.createWidget({type:"bi.absolute",element:this.element,items:[{el:this.dropdown,left:0,right:0,bottom:-1*this._const.dropDownHeight}]}),this.populate(this.options.items)},_dropDownOrUp:function(){if(this.scrollUp){var a=this.element.height();a-=this.options.scrollHeight,a=Math.max(a,this.options.height),this.element.height(a),this._checkDropDownState()}else{var a=this.element.height();a+=this.options.scrollHeight,a=Math.min(a,this.scroll.element[0].scrollHeight,this.options.maxHeight),this.element.height(a),this._checkDropDownState()}},_checkDropDownState:function(){var a=this.element.height();!this._checkScroll()||a>=this.options.maxHeight?(this.scrollUp=!0,this.dropdown.element.removeClass(this._const.expandIcon).addClass(this._const.collapseIcon)):a<=this.options.height?(this.scrollUp=!1,this.dropdown.element.addClass(this._const.expandIcon)):this.dropdown.element.addClass(this.scrollUp?this._const.collapseIcon:this._const.expandIcon)},_checkScroll:function(){return this.scroll.element.height(this.element.height()),this.scroll.element[0].scrollHeight>this.scroll.element[0].clientHeight},_checkDropDown:function(){this._checkScroll()?(this.dropdown.visible(),this._checkDropDownState()):this.dropdown.invisible()},populate:function(){this.scroll.populate.apply(this.scroll,arguments),this.resize()},resize:function(){this.element.height(this.options.height),BI.nextTick(BI.bind(this._checkDropDown,this))},addItem:function(){this.scroll.addItem.apply(this.scroll,arguments),BI.nextTick(BI.bind(this._checkDropDown,this))}}),$.shortcut("bi.scroll_view",BI.ScrollView),BI.SearcherView=BI.inherit(BI.Pane,{_defaultConfig:function(){var a=BI.SearcherView.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-searcher-view",tipText:BI.i18nText("BI-No_Select"),chooseType:BI.Selection.Single,matcher:{type:"bi.button_group",behaviors:{redmark:function(){return!0}},items:[],layouts:[{type:"bi.vertical"}]},searcher:{type:"bi.button_group",behaviors:{redmark:function(){return!0}},items:[],layouts:[{type:"bi.vertical"}]}})},_init:function(){BI.SearcherView.superclass._init.apply(this,arguments);var a=this,b=this.options;this.matcher=BI.createWidget(b.matcher,{type:"bi.button_group",chooseType:b.chooseType,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}),this.matcher.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.SearcherView.EVENT_CHANGE,c,d)}),this.spliter=BI.createWidget({type:"bi.vertical",height:1,hgap:10,items:[{type:"bi.layout",height:1,cls:"searcher-view-spliter"}]}),this.searcher=BI.createWidget(b.searcher,{type:"bi.button_group",chooseType:b.chooseType,behaviors:{redmark:function(){return!0}},layouts:[{type:"bi.vertical"}]}),this.searcher.on(BI.Controller.EVENT_CHANGE,function(b,c,d){a.fireEvent(BI.Controller.EVENT_CHANGE,arguments),b===BI.Events.CLICK&&a.fireEvent(BI.SearcherView.EVENT_CHANGE,c,d)}),BI.createWidget
},_defaultConfig:function(){var a=BI.IconTextItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-icon-text-item",direction:BI.Direction.Left,logic:{dynamic:!1},iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.IconTextItem.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height}),this.icon=BI.createWidget({type:"bi.center_adapt",width:b.commonWidth,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),BI.createWidget(BI.extend({element:this.element},BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(a.direction),BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection(a.direction,this.icon,this.text)}))))},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()},doClick:function(){BI.IconTextItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.IconTextItem.EVENT_CHANGE,this.getValue(),this)},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)}}),BI.IconTextItem.EVENT_CHANGE="EVENT_CHANGE",$.shortcut("bi.icon_text_item",BI.IconTextItem),BI.TextIconItem=BI.inherit(BI.BasicButton,{_const:{commonWidth:25},_defaultConfig:function(){var a=BI.TextIconItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-icon-item",logic:{dynamic:!1},cls:"close-ha-font",iconHeight:null,iconWidth:null,textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.TextIconItem.superclass._init.apply(this,arguments);var a=this.options,b=this._const;this.text=BI.createWidget({type:"bi.label",cls:"list-item-text",textAlign:"left",hgap:a.textHgap,vgap:a.textVgap,lgap:a.textLgap,rgap:a.textRgap,text:a.text,value:a.value,keyword:a.keyword,height:a.height}),this.icon=BI.createWidget({type:"bi.center_adapt",width:b.commonWidth,items:[{el:{type:"bi.icon",width:a.iconWidth,height:a.iconHeight}}]}),BI.createWidget(BI.extend({element:this.element},BI.LogicFactory.createLogic("horizontal",BI.extend(a.logic,{items:BI.LogicFactory.createLogicItemsByDirection("left",this.text,this.icon)}))))},doClick:function(){BI.TextIconItem.superclass.doClick.apply(this,arguments),this.isValid()&&this.fireEvent(BI.TextIconItem.EVENT_CHANGE,this.getValue(),this)},setValue:function(){this.isReadOnly()||this.text.setValue.apply(this.text,arguments)},getValue:function(){return this.text.getValue()},setText:function(){this.text.setText.apply(this.text,arguments)},getText:function(){return this.text.getText()},doRedMark:function(){this.text.doRedMark.apply(this.text,arguments)},unRedMark:function(){this.text.unRedMark.apply(this.text,arguments)},doHighLight:function(){this.text.doHighLight.apply(this.text,arguments)},unHighLight:function(){this.text.unHighLight.apply(this.text,arguments)}}),BI.TextIconItem.EVENT_CHANGE="EVENT_CHANGE",$.shortcut("bi.text_icon_item",BI.TextIconItem),BI.TextItem=BI.inherit(BI.BasicButton,{_defaultConfig:function(){var a=BI.TextItem.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-text-item",textAlign:"left",whiteSpace:"nowrap",textHgap:0,textVgap:0,textLgap:0,textRgap:0})},_init:function(){BI.TextItem.superclass._init.apply(this,arguments);var a=this.options;this.text=BI.createWidget({type:"bi.label",element:this.element,textAlign:a.textAlign,whiteSpace:a.whiteSpace,textHeight:"nowrap"==a.whiteSpace?a.height:a.textHeight,height:a.height,hgap:a.textH
a.current++;return a.current=0,e&&a.files[0].fileSize!==-1?(a.file=a.files[a.current],sendFile(a,b,c,d).onload=function(h,i){a.onloadstart=null,a.sent+=a.files[a.current].fileSize||a.files[a.current].size,++a.current<e?(a.file=a.files[a.current],sendFile(a,b,c,d).onload=arguments.callee):f&&(a.onloadstart=g,a.onload=f,a.onload(h,i))}):e&&(a.total=100*e,a.file=a.files[a.current],sendFile(a,b,c,d).onload=function(h,i){var j=arguments.callee;a.onloadstart=null,a.sent+=100,++a.current<e?(/\b(chrome|safari)\b/i.test(navigator.userAgent)&&(a.iframe.parentNode.removeChild(a.iframe),a.iframe=null),setTimeout(function(){a.file=a.files[a.current],sendFile(a,b,c,d).onload=j},15)):f&&setTimeout(function(){a.iframe.parentNode.removeChild(a.iframe),a.iframe=null,a.onloadstart=g,a.onload=f,a.onload(h,i)},15)}),a};BI.File=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.File.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-file display-block",element:"<input type='file'>",name:"",url:"",multiple:!0,accept:"",maxSize:1048576})},_init:function(){var a=this,b=this.options;BI.File.superclass._init.apply(this,arguments),b.multiple===!0&&this.element.attr("multiple","multiple"),this.element.attr("name",b.name||this.getName()),BI.nextTick(function(){var c=a.wrap=a._wrap(a.element[0],b.maxSize);c.onloadstart=function(b,c){a.fireEvent(BI.File.EVENT_UPLOADSTART)},c.onprogress=function(b,c){this.file.fileSize!==-1&&b.simulation,a.fireEvent(BI.File.EVENT_PROGRESS,{file:this.file,total:b.total,loaded:b.loaded,simulation:b.simulation})},c.onerror=function(){a.fireEvent(BI.File.EVENT_ERROR)},c.onload=function(b,c){var d=this;setTimeout(function(){d.clean(),d.hide(),a.fireEvent(BI.File.EVENT_UPLOADED)},1e3)},c.url=b.url?b.url:BI.servletURL+"?op=fr_attach&cmd=ah_upload",c.fileType=b.accept,c.attach_array=[],c.attach_names=[],c.attachNum=0})},_events:function(a){var b=this;return event.add(a.dom.input,"change",function(){event.del(a.dom.input,"change",arguments.callee);for(var c=a.dom.input.cloneNode(!0),d=0,e=F(a.dom.input);d<e.length;d++){var f=e.item(d),g=f.value||f.name,h=f.fileName||(f.fileName=g.split("\\").pop()),i=-1!==h.indexOf(".")?h.split(".").pop().toLowerCase():"unknown",j=f.fileSize||f.size;a.fileType&&-1===a.fileType.indexOf("*."+i)?(BI.Msg.toast("文件类型不支持"),b.fireEvent(BI.File.EVENT_ERROR,{errorType:0,file:f})):a.maxSize!==-1&&j&&a.maxSize<j?(BI.Msg.toast("文件大小不支持"),b.fireEvent(BI.File.EVENT_ERROR,{errorType:1,file:f})):(a.files.unshift(f),b.fireEvent(BI.File.EVENT_CHANGE,{file:f}))}c.value="",a.dom.input.parentNode.replaceChild(c,a.dom.input),a.dom.input=c,event.add(a.dom.input,"change",arguments.callee)}),a},_wrap:function(){var a=this.options,b=this.element[0];return this.element.attr("multiple","multiple"),b.value="",this._events({dom:{input:b,disabled:!1},name:b.name,maxSize:a.maxSize?a.maxSize>>0:-1,files:[],clean:function(){this.files=[]},upload:function(a){if(a)for(var b in a)this[b]=a[b];return sendFiles(this,this.maxSize),this},hide:function(){this.dom.disabled&&(this.dom.disabled=!1,this.dom.input.removeAttribute("disabled"))},show:function(a,b,c,d){this.dom.disabled||(this.dom.disabled=!0,this.dom.input.setAttribute("disabled","disabled"))}})},select:function(){$(this.wrap.dom.input).click()},upload:function(a){this.wrap.upload(a)},getValue:function(){return this.wrap.attach_array},reset:function(){this.wrap.attach_array=[],this.wrap.attach_names=[],this.wrap.attachNum=0},setEnable:function(a){BI.MultiFile.superclass.setEnable.apply(this,arguments),a===!0?this.element.attr("disabled","disabled"):this.element.removeAttr("disabled")}}),BI.File.EVENT_CHANGE="BI.File.EVENT_CHANGE",BI.File.EVENT_UPLOADSTART="EVENT_UPLOADSTART",BI.File.EVENT_ERROR="EVENT_ERROR",BI.File.EVENT_PROGRESS="EVENT_PROGRESS",BI.File.EVENT_UPLOADED="EVENT_UPLOADED",$.shortcut("bi.file",BI.File)}(),BI.Input=BI.inherit(BI.Single,{_defaultConfig:function(){var a=BI.Input.superclass._defaultConfig.apply(this,arguments);return BI.extend(a,{baseCls:(a.baseCls||"")+" bi-input displa
width:"100%",height:"100%",scrollable:!d||null,scrollx:d,items:[i]}),this.topLeft=BI.createWidget({type:"bi.adaptive",cls:"top-left",scrollable:!1,items:[this.scrollTopLeft]}),this.topRight=BI.createWidget({type:"bi.adaptive",cls:"top-right",scrollable:!1,items:[this.scrollTopRight]}),this.bottomLeft=BI.createWidget({type:"bi.adaptive",cls:"bottom-left",items:[this.scrollBottomLeft]}),this.bottomRight=BI.createWidget({type:"bi.adaptive",cls:"bottom-right",items:[this.scrollBottomRight]});var j=c.header.length*((c.headerRowSize||c.rowSize)+1)+1,k=BI.sum(c.freezeCols,function(a,b){return c.columnSize[b]>1?c.columnSize[b]+1:c.columnSize[b]});if(c.isNeedResize){var l,m,n=function(a,c){var d=b.getCalculateRegionRowSize();l=BI.createWidget({type:"bi.layout",cls:"bi-resizer",width:a.width,height:d[0]+d[1]}),BI.createWidget({type:"bi.absolute",element:"body",items:[{el:l,left:c.left,top:c.top-d[0]}]})},o=function(a,c){var d=b.getCalculateRegionRowSize(),e=b.getCalculateRegionColumnSize(),f=d[0]+d[1],g=e[0]+e[1];a.width>g/5*4&&(a.width=g/5*4),a.width<g/5&&(a.width=g/5),l.element.css({left:c.left+"px",width:a.width+"px",height:f+"px"})},p=function(){l&&l.destroy(),l=null};if(c.freezeCols.length>0&&c.freezeCols.length<c.columnSize.length)if(d){var q={handles:"w",minWidth:15,helper:"clone",start:function(a,c){n(c.size,c.position),b.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE)},resize:function(a,c){o(c.size,c.position),b.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE),a.stopPropagation()},stop:function(a,d){if(p(),c.isResizeAdapt){var e=d.size.width-(BI.sum(b.columnRight)+b.columnRight.length);c.columnSize[b.columnLeft.length]+=e}else b.setRegionColumnSize(["fill",d.size.width]);b._resize(),d.element.css("left",""),b.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE)}};b.bottomRight.element.resizable(q),m=$(".ui-resizable-handle",this.bottomRight.element).css("top",-1*j)}else{var q={handles:"e",minWidth:15,helper:"clone",start:function(a,c){n(c.size,c.position),b.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE)},resize:function(a,c){o(c.size,c.position),b.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE),a.stopPropagation()},stop:function(a,d){if(p(),c.isResizeAdapt){var e=d.size.width-(BI.sum(b.columnLeft)+b.columnLeft.length);c.columnSize[b.columnLeft.length-1]+=e}else b.setRegionColumnSize([d.size.width,"fill"]);b._resize(),b.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE)}};b.bottomLeft.element.resizable(q),m=$(".ui-resizable-handle",this.bottomLeft.element).css("top",-1*j)}}var r=c.regionColumnSize;0===c.freezeCols.length?r=d?["fill",0]:[0,"fill"]:c.freezeCols.length>=c.columnSize.length&&(r=d?[0,"fill"]:["fill",0]),this.partitions=BI.createWidget(BI.extend({element:this.element},BI.LogicFactory.createLogic("table",BI.extend({},c.logic,{rows:2,columns:2,columnSize:r||(d?["fill",k]:[k,"fill"]),rowSize:[j,"fill"],items:[[{el:this.topLeft},{el:this.topRight}],[{el:this.bottomLeft},{el:this.bottomRight}]]})))),a(this.scrollBottomRight.element,this.scrollTopRight.element,this.scrollBottomLeft.element),a(this.scrollBottomLeft.element,this.scrollTopLeft.element,this.scrollBottomRight.element),this._resize=function(){b.scrollBottomLeft.element.is(":visible")&&(b.scrollBottomLeft.element.css({"overflow-x":"auto"}),b.scrollBottomRight.element.css({"overflow-x":"auto"}),b.setColumnSize(c.columnSize),d?b.scrollBottomLeft.element.css({"overflow-y":"auto"}):b.scrollBottomRight.element.css({"overflow-y":"auto"}),(b.scrollBottomLeft.element.hasHorizonScroll()||b.scrollBottomRight.element.hasHorizonScroll())&&(b.scrollBottomLeft.element.css("overflow-x","scroll"),b.scrollBottomRight.element.css("overflow-x","scroll")),b.scrollBottomRight.element.hasVerticalScroll()?b.scrollTopRight.element.css("overflow-y","scroll"):b.scrollTopRight.element.css("overflow-y","hidden"),b.scrollBottomLeft.element.hasVerticalScroll()?b.scrollTopLeft.element.css("overflow-y","scroll"):b.scrollTopLeft.element.css("overflow-y","hidden"),b.scrollTopLeft.element[0].scrollLeft=b.scrollBottomLeft.element[0].scrollLeft,b.scrollTopRight.element[0].scrollLeft=b.sc
rowSize:b.rowSize,regionColumnSize:b.regionColumnSize,header:e,footer:b.footer,items:f}),this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT,function(){a.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT,arguments)}),this.table.on(BI.Table.EVENT_TABLE_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_SCROLL,function(){a.fireEvent(BI.Table.EVENT_TABLE_SCROLL,arguments)}),this.table.on(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_REGION_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_COLUMN_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE,arguments)}),this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,function(){a.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE,arguments)})},resize:function(){this.table.resize()},setColumnSize:function(a){this.table.setColumnSize(a)},getColumnSize:function(){return this.table.getColumnSize()},getCalculateColumnSize:function(){return this.table.getCalculateColumnSize()},setHeaderColumnSize:function(a){this.table.setHeaderColumnSize(a)},setRegionColumnSize:function(a){this.table.setRegionColumnSize(a)},getRegionColumnSize:function(){return this.table.getRegionColumnSize()},getCalculateRegionColumnSize:function(){return this.table.getCalculateRegionColumnSize()},getCalculateRegionRowSize:function(){return this.table.getCalculateRegionRowSize()},getClientRegionColumnSize:function(){return this.table.getClientRegionColumnSize()},getScrollRegionColumnSize:function(){return this.table.getScrollRegionColumnSize()},getScrollRegionRowSize:function(){return this.table.getScrollRegionRowSize()},hasVerticalScroll:function(){return this.table.hasVerticalScroll()},setVerticalScroll:function(a){this.table.setVerticalScroll(a)},setLeftHorizontalScroll:function(a){this.table.setLeftHorizontalScroll(a)},setRightHorizontalScroll:function(a){this.table.setRightHorizontalScroll(a)},getVerticalScroll:function(){return this.table.getVerticalScroll()},getLeftHorizontalScroll:function(){return this.table.getLeftHorizontalScroll()},getRightHorizontalScroll:function(){return this.table.getRightHorizontalScroll()},getColumns:function(){return this.table.getColumns()},attr:function(){BI.TableTree.superclass.attr.apply(this,arguments),this.table.attr.apply(this.table,arguments)},populate:function(a,b,c,d){var e=this.options;e.items=a||[],b&&(e.header=b),c&&(e.crossItems=c),d&&(e.crossHeader=d);var f=this._getHDeep(),g=this._getVDeep(),b=this._createHeader(f,g);a=BI.TableTree.formatItems(e.items,f),this.table.populate(a,b)},destroy:function(){this.table.destroy(),BI.TableTree.superclass.destroy.apply(this,arguments)}}),BI.extend(BI.TableTree,{formatItems:function(a,b,c){function d(a,f){var g;if(BI.isArray(f.children)){if(BI.each(f.children,function(b,c){var e;a!=-1?(e=BI.clone(a),e.push(f)):e=[],d(e,c)}),a!=-1?(g=BI.clone(a),g.push(f)):g=[],BI.isNotEmptyArray(f.values)){for(var h=a===-1?" last":"",i=BI.UUID(),j=g.length;j<b;j++)g.push({text:BI.i18nText("BI-Summary_Values"),tag:i,cls:"summary-cell"+h});if(c||(g=g.concat(f.values)),g.length>0)if(c)for(var k=0,l=f.values.length;k<l;k++)e.push(g);else e.push(g)}}else{if(a!=-1){g=BI.clone(a);for(var j=g.length;j<b;j++)g.push(f)}else g=[];if(!c&&BI.isArray(f.values)&&(g=g.concat(f.values)),c&&BI.isArray(f.values))for(var j=0,m=f.values.length;j<m-1;j++)g.length>0&&e.push(g);g.length>0&&e.push(g)}}var e=[];return BI.each(a,function(a,b){d(-1,b)}),BI.each(e,function(a,c){for(var d=BI.last(c),a=c.length;a<b;a++)c.push(d)}),e},formatCrossItems:function(a,b){var c=BI.TableTree.formatItems(a,b,!0);return BI.unzip(c)},maxDeep:function(a){function b(a,c){var d=a;return BI.isNotEmptyArray