Files
everything/EveryThing/wwwroot/vendor/libs/bootstrap-table/extensions/pipeline/pipeline.js
David Štaleker db0cc8d3de prvi
2025-07-18 05:33:16 +02:00

1 line
5.9 KiB
JavaScript

!function(t,e){var i=function(t){var e={};function i(o){if(e[o])return e[o].exports;var s=e[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(o,s,function(e){return t[e]}.bind(null,s));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=431)}({431:function(t,e,i){i(432)},432:function(t,e){!function(t){"use strict";var e=t.fn.bootstrapTable.utils;t.extend(t.fn.bootstrapTable.defaults,{usePipeline:!1,pipelineSize:1e3,onCachedDataHit:function(t){return!1},onCachedDataReset:function(t){return!1}}),t.extend(t.fn.bootstrapTable.Constructor.EVENTS,{"cached-data-hit.bs.table":"onCachedDataHit","cached-data-reset.bs.table":"onCachedDataReset"});var i=t.fn.bootstrapTable.Constructor,o=i.prototype.init,s=(i.prototype.initServer,i.prototype.onSearch),r=i.prototype.onSort,n=i.prototype.onPageListChange;i.prototype.init=function(){this.initPipeline(),o.apply(this,Array.prototype.slice.apply(arguments))},i.prototype.initPipeline=function(){this.cacheRequestJSON={},this.cacheWindows=[],this.currWindow=0,this.resetCache=!0},i.prototype.onSearch=function(t){this.options.usePipeline&&(this.resetCache=!0),s.apply(this,Array.prototype.slice.apply(arguments))},i.prototype.onSort=function(t){this.options.usePipeline&&(this.resetCache=!0),r.apply(this,Array.prototype.slice.apply(arguments))},i.prototype.onPageListChange=function(e){var i=t(e.currentTarget),o=parseInt(i.text());this.options.pipelineSize=this.calculatePipelineSize(this.options.pipelineSize,o),this.resetCache=!0,n.apply(this,Array.prototype.slice.apply(arguments))},i.prototype.calculatePipelineSize=function(t,e){return 0==e?0:Math.ceil(t/e)*e},i.prototype.setCacheWindows=function(){this.cacheWindows=[];for(var t=this.options.totalRows/this.options.pipelineSize,e=0;e<=t;e++){var i=e*this.options.pipelineSize;this.cacheWindows[e]={lower:i,upper:i+this.options.pipelineSize-1}}},i.prototype.setCurrWindow=function(t){this.currWindow=0;for(var e=0;e<this.cacheWindows.length;e++)if(this.cacheWindows[e].lower<=t&&t<=this.cacheWindows[e].upper){this.currWindow=e;break}},i.prototype.drawFromCache=function(e,i){var o=t.extend(!0,{},this.cacheRequestJSON),s=e-this.cacheWindows[this.currWindow].lower,r=s+i;return o.rows=o.rows.slice(s,r),o},i.prototype.initServer=function(i,o,s){var r={},n=this.header.fields.indexOf(this.options.sortName),a={searchText:this.searchText,sortName:this.options.sortName,sortOrder:this.options.sortOrder},p=null;if(this.header.sortNames[n]&&(a.sortName=this.header.sortNames[n]),this.options.pagination&&"server"===this.options.sidePagination&&(a.pageSize=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,a.pageNumber=this.options.pageNumber),s||this.options.url||this.options.ajax){var h=!0;if("limit"===this.options.queryParamsType&&(a={searchText:a.searchText,sortName:a.sortName,sortOrder:a.sortOrder},this.options.pagination&&"server"===this.options.sidePagination))if(a.limit=this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize,a.offset=(this.options.pageSize===this.options.formatAllRows()?this.options.totalRows:this.options.pageSize)*(this.options.pageNumber-1),this.options.usePipeline)if(this.cacheWindows.length){var l=this.cacheWindows[this.currWindow];this.resetCache||a.offset<l.lower||a.offset>l.upper?(h=!0,this.setCurrWindow(a.offset),a.drawOffset=a.offset,a.offset=this.cacheWindows[this.currWindow].lower):h=!1}else h=!0,a.drawOffset=a.offset;else 0===a.limit&&delete a.limit;if(this.resetCache&&(h=!0,this.resetCache=!1),this.options.usePipeline&&h&&(a.drawLimit=a.limit,a.limit=this.options.pipelineSize),!h){var c=this.drawFromCache(a.offset,a.limit);return this.load(c),this.trigger("load-success",c),void this.trigger("cached-data-hit",c)}if(t.isEmptyObject(this.filterColumnsPartial)||(a.filter=JSON.stringify(this.filterColumnsPartial,null)),r=e.calculateObjectValue(this.options,this.options.queryParams,[a],r),t.extend(r,o||{}),!1!==r){i||this.$tableLoading.show();var u=this;p=t.extend({},e.calculateObjectValue(null,this.options.ajaxOptions),{type:this.options.method,url:s||this.options.url,data:"application/json"===this.options.contentType&&"post"===this.options.method?JSON.stringify(r):r,cache:this.options.cache,contentType:this.options.contentType,dataType:this.options.dataType,success:function(o){o=e.calculateObjectValue(u.options,u.options.responseHandler,[o],o),u.options.usePipeline&&(u.cacheRequestJSON=t.extend(!0,{},o),u.options.totalRows=o[u.options.totalField],u.setCacheWindows(),u.setCurrWindow(a.drawOffset),o=u.drawFromCache(a.drawOffset,a.drawLimit),u.trigger("cached-data-reset",o)),u.load(o),u.trigger("load-success",o),i||u.$tableLoading.hide()},error:function(t){var e=[];"server"===u.options.sidePagination&&((e={})[u.options.totalField]=0,e[u.options.dataField]=[]),u.load(e),u.trigger("load-error",t.status,t),i||u.$tableLoading.hide()}}),this.options.ajax?e.calculateObjectValue(this,this.options.ajax,[p],null):(this._xhr&&4!==this._xhr.readyState&&this._xhr.abort(),this._xhr=t.ajax(p))}}},t.fn.bootstrapTable.methods.push()}(jQuery)}});if("object"==typeof i){var o=["object"==typeof module&&"object"==typeof module.exports?module.exports:null,"undefined"!=typeof window?window:null,t&&t!==window?t:null];for(var s in i)o[0]&&(o[0][s]=i[s]),o[1]&&"__esModule"!==s&&(o[1][s]=i[s]),o[2]&&(o[2][s]=i[s])}}(this);