vaeThink2/public/static/admin_static/lib/jquery.bsgrid/builds/merged/grid.simple.min.js

10 lines
37 KiB
JavaScript
Raw Normal View History

2020-04-01 11:45:12 +08:00
/**
* jQuery.bsgrid v1.38 by @Baishui2004
* Copyright 2014 Apache v2 License
* https://github.com/baishui2004/jquery.bsgrid
*/
String.prototype.startWith=function(a){if(a==null||a==""||this.length==0||a.length>this.length){return false}else{return this.substr(0,a.length)==a}};String.prototype.endWith=function(a){if(a==null||a==""||this.length==0||a.length>this.length){return false}else{return this.substring(this.length-a.length)==a}};String.prototype.replaceAll=function(a,b){return this.replace(new RegExp(a,"gm"),b)};function StringBuilder(){if(arguments.length){this.append.apply(this,arguments)}}StringBuilder.prototype=function(){var c=Array.prototype.join,d=Array.prototype.slice,a=/\{(\d+)\}/g,b=function(){return c.call(this,"")};return{constructor:StringBuilder,length:0,append:Array.prototype.push,appendFormat:function(e){var g=0,f=d.call(arguments,1);this.append(a.test(e)?e.replace(a,function(h,j){return f[j]}):e.replace(/\?/g,function(){return f[g++]}));return this},size:function(){return this.toString().length},toString:b,valueOf:b}}();
(function(a){a.fn.bsgrid_paging={defaults:{loopback:false,pageSize:20,pageSizeSelect:false,pageSizeForGrid:[5,10,20,25,50,100,200,500],pageIncorrectTurnAlert:true,pagingLittleToolbar:false,pagingBtnClass:"pagingBtn",pagingMinWidth:"auto",pagingBtnShowState:{select:true,first:true,prev:true,next:true,last:true,gotoBtn:true,refresh:true}},pagingObjs:{},init:function(h,g){var d={settings:a.extend(true,{},a.fn.bsgrid_paging.defaults,g),pagingId:h,totalRowsId:h+"_totalRows",totalPagesId:h+"_totalPages",curPageId:h+"_curPage",gotoPageInputId:h+"_gotoPageInput",gotoPageId:h+"_gotoPage",refreshPageId:h+"_refreshPage",pageSizeId:h+"_pageSize",firstPageId:h+"_firstPage",prevPageId:h+"_prevPage",nextPageId:h+"_nextPage",lastPageId:h+"_lastPage",startRowId:h+"_startRow",endRowId:h+"_endRow",totalRows:0,totalPages:0,curPage:1,curPageRowsNum:0,startRow:0,endRow:0};if(g.pageSizeForGrid!=undefined){d.settings.pageSizeForGrid=g.pageSizeForGrid}var b={options:d,page:function(i){a.fn.bsgrid_paging.page(i,d)},getCurPage:function(){return a.fn.bsgrid_paging.getCurPage(d)},refreshPage:function(){a.fn.bsgrid_paging.refreshPage(d)},firstPage:function(){a.fn.bsgrid_paging.firstPage(d)},prevPage:function(){a.fn.bsgrid_paging.prevPage(d)},nextPage:function(){a.fn.bsgrid_paging.nextPage(d)},lastPage:function(){a.fn.bsgrid_paging.lastPage(d)},gotoPage:function(i){a.fn.bsgrid_paging.gotoPage(d,i)},createPagingToolbar:function(){return a.fn.bsgrid_paging.createPagingToolbar(d)},setPagingToolbarEvents:function(){a.fn.bsgrid_paging.setPagingToolbarEvents(d)},dynamicChangePagingButtonStyle:function(){a.fn.bsgrid_paging.dynamicChangePagingButtonStyle(d)},setPagingValues:function(j,i){a.fn.bsgrid_paging.setPagingValues(j,i,d)}};a.fn.bsgrid_paging.pagingObjs[h]=b;a("#"+h).append(b.createPagingToolbar());if(d.settings.pageSizeSelect){if(a.inArray(d.settings.pageSize,d.settings.pageSizeForGrid)==-1){d.settings.pageSizeForGrid.push(d.settings.pageSize)}d.settings.pageSizeForGrid.sort(function(j,i){return j-i});var f=new StringBuilder();for(var e=0;e<d.settings.pageSizeForGrid.length;e++){var c=d.settings.pageSizeForGrid[e];f.append('<option value="'+c+'">'+c+"</option>")}a("#"+d.pageSizeId).html(f.toString()).val(d.settings.pageSize)}b.setPagingToolbarEvents();return b},getPagingObj:function(c){var b=a.fn.bsgrid_paging.pagingObjs[c];return b?b:null},page:function(c,b){var d=a.fn.bsgrid.getGridObj(b.settings.gridId);d.options.settings.pageSize=b.settings.pageSize;a.fn.bsgrid.page(c,d.options)},getCurPage:function(b){var c=a("#"+b.curPageId).html();return c==""?1:c},refreshPage:function(b){a.fn.bsgrid_paging.page(a.fn.bsgrid_paging.getCurPage(b),b)},firstPage:function(b){var c=a.fn.bsgrid_paging.getCurPage(b);if(c<=1){a.fn.bsgrid_paging.incorrectTurnAlert(b,a.bsgridLanguage.isFirstPage);return}a.fn.bsgrid_paging.page(1,b)},prevPage:function(b){var c=a.fn.bsgrid_paging.getCurPage(b);if(c<=1){if(b.settings.loopback&&b.totalPages>0){a.fn.bsgrid_paging.page(b.totalPages,b);return}else{a.fn.bsgrid_paging.incorrectTurnAlert(b,a.bsgridLanguage.isFirstPage);return}}a.fn.bsgrid_paging.page(parseInt(c)-1,b)},nextPage:function(b){var c=a.fn.bsgrid_paging.getCurPage(b);if(c>=b.totalPages){if(b.settings.loopback&&c>0){a.fn.bsgrid_paging.page(1,b);return}else{a.fn.bsgrid_paging.incorrectTurnAlert(b,a.bsgridLanguage.isLastPage);return}}a.fn.bsgrid_paging.page(parseInt(c)+1,b)},lastPage:function(b){var c=a.fn.bsgrid_paging.getCurPage(b);if(c>=b.totalPages){a.fn.bsgrid_paging.incorrectTurnAlert(b,a.bsgridLanguage.isLastPage);return}a.fn.bsgrid_paging.page(b.totalPages,b)},gotoPage:function(b,c){if(c==undefined){c=a("#"+b.gotoPageInputId).val()}if(a.trim(c)==""||isNaN(c)){a.fn.bsgrid_paging.alert(a.bsgridLanguage.needInteger)}else{if(parseInt(c)<1||parseInt(c)>b.totalPages){a.fn.bsgrid_paging.alert(a.bsgridLanguage.needRange(1,b.totalPages))}else{a("#"+b.gotoPageInputId).val(c);a.fn.bsgrid_paging.page(parseInt(c),b)}}},incorrectTurnAlert:function(b,c){if(b.settings.pageIncorrectTurnAlert){a.fn.bsgrid_paging.alert(c)}},alert:function(c){try{a.bsgrid.alert(c)}catch(b){alert(c)}},c
(function($){$.fn.bsgrid={version:"1.38-preview",defaults:{dataType:"json",dataTrim:true,ajaxType:"post",localData:false,url:"",otherParames:false,autoLoad:true,pageAll:false,showPageToolbar:true,pageSize:20,pageSizeSelect:false,pageSizeForGrid:[5,10,20,25,50,100,200,500],pageIncorrectTurnAlert:true,multiSort:false,displayBlankRows:true,lineWrap:false,stripeRows:false,rowHoverColor:false,rowSelectedColor:true,pagingLittleToolbar:false,pagingToolbarAlign:"right",pagingBtnClass:"pagingBtn",displayPagingToolbarOnlyMultiPages:false,isProcessLockScreen:true,longLengthAotoSubAndTip:true,colsProperties:{align:"center",maxLength:40,indexAttr:"w_index",sortAttr:"w_sort",alignAttr:"w_align",lengthAttr:"w_length",renderAttr:"w_render",hiddenAttr:"w_hidden",tipAttr:"w_tip"},requestParamsName:{pageSize:"pageSize",curPage:"curPage",sortName:"sortName",sortOrder:"sortOrder"},beforeSend:function(options,XMLHttpRequest){},complete:function(options,XMLHttpRequest,textStatus){},processUserdata:function(userdata,options){},event:{selectRowEvent:false,unselectRowEvent:false,customRowEvents:{},customCellEvents:{}},extend:{initGridMethods:{},beforeRenderGridMethods:{},renderPerColumnMethods:{},renderPerRowMethods:{},afterRenderGridMethods:{}},additionalBeforeRenderGrid:function(parseSuccess,gridData,options){},additionalRenderPerColumn:function(record,rowIndex,colIndex,tdObj,trObj,options){},additionalRenderPerRow:function(record,rowIndex,trObj,options){},additionalAfterRenderGrid:function(parseSuccess,gridData,options){}},gridObjs:{},init:function(gridId,settings){if(!$("#"+gridId).hasClass("bsgrid")){$("#"+gridId).addClass("bsgrid")}var options={settings:$.extend(true,{},$.fn.bsgrid.defaults,settings),gridId:gridId,noPagingationId:gridId+"_no_pagination",pagingOutTabId:gridId+"_pt_outTab",pagingId:gridId+"_pt",sortName:"",sortOrder:"",otherParames:settings.otherParames,totalRows:0,totalPages:0,curPage:1,curPageRowsNum:0,startRow:0,endRow:0};if($("#"+gridId).find("thead").length==0){$("#"+gridId).prepend("<thead></thead>");$("#"+gridId).find("tr:lt("+($("#"+gridId+" tr").length-$("#"+gridId+" tfoot tr").length)+")").appendTo($("#"+gridId+" thead"))}if($("#"+gridId).find("tbody").length==0){$("#"+gridId+" thead").after("<tbody></tbody>")}if($("#"+gridId).find("tfoot").length==0){$("#"+gridId).append('<tfoot style="display: none;"></tfoot>')}options.columnsModel=$.fn.bsgrid.initColumnsModel(options);if(settings.pageSizeForGrid!=undefined){options.settings.pageSizeForGrid=settings.pageSizeForGrid}options.settings.dataType=options.settings.dataType.toLowerCase();if(options.settings.pageSizeSelect){if($.inArray(options.settings.pageSize,options.settings.pageSizeForGrid)==-1){options.settings.pageSizeForGrid.push(options.settings.pageSize)}options.settings.pageSizeForGrid.sort(function(a,b){return a-b})}var gridObj={options:options,getCondition:function(){return $.fn.bsgrid.getPageCondition(options.curPage,options)},getPageCondition:function(curPage){return $.fn.bsgrid.getPageCondition(curPage,options)},page:function(curPage){$.fn.bsgrid.page(curPage,options)},search:function(params){$.fn.bsgrid.search(options,params)},loadGridData:function(dataType,gridData){$.fn.bsgrid.loadGridData(dataType,gridData,options)},loadRowData:function(record,rowIndex,trObj){$.fn.bsgrid.loadRowData(options,record,rowIndex,trObj)},reloadLocalData:function(localData){$.fn.bsgrid.reloadLocalData(localData,options)},getPageSize:function(){return options.settings.pageSize},getTotalRows:function(){return options.totalRows},getTotalPages:function(){return options.totalPages},getCurPage:function(){return options.curPage},getCurPageRowsNum:function(){return options.curPageRowsNum},getStartRow:function(){return options.startRow},getEndRow:function(){return options.endRow},getSortName:function(){return options.sortName},getSortOrder:function(){return options.sortOrder},getRows:function(){return $.fn.bsgrid.getRows(options)},getRow:function(row){return $.fn.bsgrid.getRow(row,options)},getRowCells:function(row){return $.fn.bsgrid.getRowCells(row,options)},getColCells:function(col)