demo20230512/Scripts/kendo/2014.2.716/kendo.pager.min.js

16 lines
6.3 KiB
JavaScript
Raw Normal View History

2023-05-12 10:20:28 +08:00
/**
* Copyright 2014 Telerik AD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(e,define){define(["./kendo.data.min"],e)}(function(){return function(e,t){function n(e,t,n,i,r){return e({idx:t,text:n,ns:u.ns,numeric:i,title:r||""})}function i(e,t,n){return x({className:e.substring(1),text:t,wrapClassName:n||""})}function r(e,t,n,i){e.find(t).parent().attr(u.attr("page"),n).attr("tabindex",-1).toggleClass("k-state-disabled",i)}function o(e,t){r(e,h,1,1>=t)}function a(e,t){r(e,g,Math.max(1,t-1),1>=t)}function s(e,t,n){r(e,m,Math.min(n,t+1),t>=n)}function l(e,t,n){r(e,p,n,t>=n)}var u=window.kendo,d=u.ui,c=d.Widget,f=e.proxy,h=".k-i-seek-w",p=".k-i-seek-e",g=".k-i-arrow-w",m=".k-i-arrow-e",v="change",_=".kendoPager",y="click",b="keydown",w="disabled",x=u.template('<a href="\\#" title="#=text#" class="k-link k-pager-nav #= wrapClassName #"><span class="k-icon #= className #">#=text#</span></a>'),k=c.extend({init:function(t,n){var r,d,w=this;c.fn.init.call(w,t,n),n=w.options,w.dataSource=u.data.DataSource.create(n.dataSource),w.linkTemplate=u.template(w.options.linkTemplate),w.selectTemplate=u.template(w.options.selectTemplate),r=w.page(),d=w.totalPages(),w._refreshHandler=f(w.refresh,w),w.dataSource.bind(v,w._refreshHandler),n.previousNext&&(w.element.find(h).length||(w.element.append(i(h,n.messages.first,"k-pager-first")),o(w.element,r,d)),w.element.find(g).length||(w.element.append(i(g,n.messages.previous)),a(w.element,r,d))),n.numeric&&(w.list=w.element.find(".k-pager-numbers"),w.list.length||(w.list=e('<ul class="k-pager-numbers k-reset" />').appendTo(w.element))),n.input&&(w.element.find(".k-pager-input").length||w.element.append('<span class="k-pager-input k-label">'+n.messages.page+'<input class="k-textbox">'+u.format(n.messages.of,d)+"</span>"),w.element.on(b+_,".k-pager-input input",f(w._keydown,w))),n.previousNext&&(w.element.find(m).length||(w.element.append(i(m,n.messages.next)),s(w.element,r,d)),w.element.find(p).length||(w.element.append(i(p,n.messages.last,"k-pager-last")),l(w.element,r,d))),n.pageSizes&&(w.element.find(".k-pager-sizes").length||e('<span class="k-pager-sizes k-label"><select/>'+n.messages.itemsPerPage+"</span>").appendTo(w.element).find("select").html(e.map(e.isArray(n.pageSizes)?n.pageSizes:[5,10,20],function(e){return"<option>"+e+"</option>"}).join("")).end().appendTo(w.element),w.element.find(".k-pager-sizes select").val(w.pageSize()),u.ui.DropDownList&&w.element.find(".k-pager-sizes select").show().kendoDropDownList(),w.element.on(v+_,".k-pager-sizes select",f(w._change,w))),n.refresh&&(w.element.find(".k-pager-refresh").length||w.element.append('<a href="#" class="k-pager-refresh k-link" title="'+n.messages.refresh+'"><span class="k-icon k-i-refresh">'+n.messages.refresh+"</span></a>"),w.element.on(y+_,".k-pager-refresh",f(w._refreshClick,w))),n.info&&(w.element.find(".k-pager-info").length||w.element.append('<span class="k-pager-info k-label" />')),w.element.on(y+_,"a",f(w._click,w)).addClass("k-pager-wrap k-widget"),n.autoBind&&w.refresh(),u.notify(w)},destroy:function(){var e=this;c.fn.destroy.call(e),e.element.off(_),e.dataSource.unbind(v,e._refreshHandler),e._refreshHandler=null,u.destroy(e.element),e.element=e.list=null},events:[v],options:{name:"Pager",selectTemplate:'<li><span class="k-state-selected">#=text#</span></li>',linkTemplate:'<li><a tabindex="-1" href="\\#" class="k-link" data-#=ns#page="#=idx#" #if (title !== "") {# title="#=title#" #}#>#=text#</a></li>',buttonCount:10,autoBind:!0,numeric:!0,info:!0,input:!1,previousNext:!0,pageSizes:!1,refresh:!1,messages:{display:"{0} - {1} of {2} items",empty:"No items to display",page:"Page",of:"of {0}",itemsPerPage:"items per page",first:"Go to the first page",previous:"Go to the previous page",next:"Go to the next page",last:"Go to the last page",refresh:"Refresh",morePages:"More pages"}},setDataSource:function(e){var t=this;t.dataSource.unbind(v,t._refreshHandler),t.dataSource=t.options.dataSource=e,e.bind(v,t._refreshHandler),t.options.autoBind&&e.fetch()},refresh:function(e){var t,i,r,d=this,c=1,f="",h=d.page(),p=d.options,g=d.pageSize(),m=d.dataSource.total(),v=d.totalPages(),_=d.linkTemplate,y=p