Socket
Socket
Sign inDemoInstall

tui-pagination

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tui-pagination - npm Package Compare versions

Comparing version 3.3.1 to 3.3.2

6

dist/tui-pagination.js
/*!
* tui-pagination.js
* @version 3.3.1
* @author NHNEnt FE Development Team <dl_javascript@nhnent.com>
* @version 3.3.2
* @author NHN FE Development Team <dl_javascript@nhn.com>
* @license MIT

@@ -65,3 +65,3 @@ */

* @fileoverview The entry file of Pagination components
* @author NHN Ent. FE Development Team
* @author NHN. FE Development Lab <dl_javascript@nhn.com>
*/

@@ -68,0 +68,0 @@

/*!
* tui-pagination.min.js
* @version 3.3.1
* @author NHNEnt FE Development Team <dl_javascript@nhnent.com>
* @version 3.3.2
* @author NHN FE Development Team <dl_javascript@nhn.com>
* @license MIT
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("tui-code-snippet")):"function"==typeof define&&define.amd?define(["tui-code-snippet"],e):"object"==typeof exports?exports.Pagination=e(require("tui-code-snippet")):(t.tui=t.tui||{},t.tui.Pagination=e(t.tui&&t.tui.util))}(this,function(t){return function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={exports:{},id:i,loaded:!1};return t[i].call(s.exports,s,s.exports,e),s.loaded=!0,s.exports}var n={};return e.m=t,e.c=n,e.p="dist",e(0)}([function(t,e,n){"use strict";n(5),t.exports=n(3)},function(e,n){e.exports=t},function(t,e,n){"use strict";var i=n(1),s={addEventListener:function(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)},preventDefault:function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},getTargetElement:function(t){return t.target||t.srcElement},addClass:function(t,e){t&&(""===t.className?t.className=e:s.hasClass(t,e)||(t.className+=" "+e))},hasClass:function(t,e){var n=s.getClass(t);return n.indexOf(e)>-1},getClass:function(t){return t&&t.getAttribute&&(t.getAttribute("class")||t.getAttribute("className")||"")},capitalizeFirstLetter:function(t){return t.substring(0,1).toUpperCase()+t.substring(1,t.length)},isContained:function(t,e){return!!e&&(t===e||e.contains(t))},replaceTemplate:function(t,e){var n=t.replace(/\{\{(\w*)\}\}/g,function(t,n){return e.hasOwnProperty(n)?e[n]:""});return n},changeTemplateToElement:function(t,e){var n;return n=i.isFunction(t)?t(e):s.replaceTemplate(t,e),s.getElementFromTemplate(n)},getElementFromTemplate:function(t){var e=document.createElement("div");return e.innerHTML=t,e.children[0]},sendHostNameToGA:function(){i.sendHostname("pagination","UA-129987462-1")}};t.exports=s},function(t,e,n){"use strict";var i=n(1),s=n(4),a=n(2),o={totalItems:10,itemsPerPage:10,visiblePages:10,page:1,centerAlign:!1,firstItemClassName:"tui-first-child",lastItemClassName:"tui-last-child",usageStatistics:!0},r=i.defineClass({init:function(t,e){this._options=i.extend({},o,e),this._currentPage=0,this._view=new s(t,this._options,i.bind(this._onClickHandler,this)),this._paginate(),this._options.usageStatistics&&a.sendHostNameToGA()},_setCurrentPage:function(t){this._currentPage=t||this._options.page},_getLastPage:function(){var t=Math.ceil(this._options.totalItems/this._options.itemsPerPage);return t?t:1},_getPageIndex:function(t){var e,n;return this._options.centerAlign?(e=Math.floor(this._options.visiblePages/2),n=t-e,n=Math.max(n,1),n=Math.min(n,this._getLastPage()-this._options.visiblePages+1)):Math.ceil(t/this._options.visiblePages)},_getRelativePage:function(t){var e="prev"===t,n=this.getCurrentPage();return e?n-1:n+1},_getMorePageIndex:function(t){var e,n=this._getPageIndex(this.getCurrentPage()),i=this._options.visiblePages,s="prev"===t;return e=this._options.centerAlign?s?n-1:n+i:s?(n-1)*i:n*i+1},_convertToValidPage:function(t){var e=this._getLastPage();return t=Math.max(t,1),t=Math.min(t,e)},_paginate:function(t){var e=this._makeViewData(t||this._options.page);this._setCurrentPage(t),this._view.update(e)},_makeViewData:function(t){var e={},n=this._getLastPage(),i=this._getPageIndex(t),s=this._getPageIndex(n),a=this._getEdge(t);return e.leftPageNumber=a.left,e.rightPageNumber=a.right,e.prevMore=i>1,e.nextMore=i<s,e.page=t,e.currentPageIndex=t,e.lastPage=n,e.lastPageListIndex=n,e},_getEdge:function(t){var e,n,i,s=this._getLastPage(),a=this._options.visiblePages,o=this._getPageIndex(t);return this._options.centerAlign?(i=Math.floor(a/2),e=Math.max(t-i,1),n=e+a-1,n>s&&(e=Math.max(s-a+1,1),n=s)):(e=(o-1)*a+1,n=o*a,n=Math.min(n,s)),{left:e,right:n}},_onClickHandler:function(t,e){switch(t){case"first":e=1;break;case"prev":e=this._getRelativePage("prev");break;case"next":e=this._getRelativePage("next");break;case"prevMore":e=this._getMorePageIndex("prev");break;case"nextMore":e=this._getMorePageIndex("next");break;case"last":e=this._getLastPage();break;default:if(!e)return}this.movePageTo(e)},reset:function(t){i.isUndefined(t)&&(t=this._options.totalItems),this._options.totalItems=t,this._paginate(1)},movePageTo:function(t){t=this._convertToValidPage(t),this.invoke("beforeMove",{page:t})&&(this._paginate(t),this.fire("afterMove",{page:t}))},setTotalItems:function(t){this._options.totalItems=t},setItemsPerPage:function(t){this._options.itemsPerPage=t},getCurrentPage:function(){return this._currentPage||this._options.page}});i.CustomEvents.mixin(r),t.exports=r},function(t,e,n){"use strict";var i=n(1),s=n(2),a=i.extend,o=i.forEach,r=i.isString,u=i.bind,l=i.isHTMLNode,p={page:'<a href="#" class="tui-page-btn">{{page}}</a>',currentPage:'<strong class="tui-page-btn tui-is-selected">{{page}}</strong>',moveButton:'<a href="#" class="tui-page-btn tui-{{type}}"><span class="tui-ico-{{type}}">{{type}}</span></a>',disabledMoveButton:'<span class="tui-page-btn tui-is-disabled tui-{{type}}"><span class="tui-ico-{{type}}">{{type}}</span></span>',moreButton:'<a href="#" class="tui-page-btn tui-{{type}}-is-ellip"><span class="tui-ico-ellip">...</span></a>'},h=["first","prev","next","last"],g=["prev","next"],c="The container element is invalid.",d=i.defineClass({init:function(t,e,n){this._containerElement=null,this._firstItemClassName=e.firstItemClassName,this._lastItemClassName=e.lastItemClassName,this._template=a({},p,e.template),this._buttons={},this._enabledPageElements=[],this._setRootElement(t),this._setMoveButtons(),this._setDisabledMoveButtons(),this._setMoreButtons(),this._attachClickEvent(n)},_setRootElement:function(t){if(r(t)?t=document.getElementById(t):t.jquery&&(t=t[0]),!l(t))throw new Error(c);this._containerElement=t},_setMoveButtons:function(){var t=this._template.moveButton;o(h,function(e){this._buttons[e]=s.changeTemplateToElement(t,{type:e})},this)},_setDisabledMoveButtons:function(){var t,e=this._template.disabledMoveButton;o(h,function(n){t="disabled"+s.capitalizeFirstLetter(n),this._buttons[t]=s.changeTemplateToElement(e,{type:n})},this)},_setMoreButtons:function(){var t,e=this._template.moreButton;o(g,function(n){t=n+"More",this._buttons[t]=s.changeTemplateToElement(e,{type:n})},this)},_getContainerElement:function(){return this._containerElement},_appendFirstButton:function(t){var e;e=t.page>1?this._buttons.first:this._buttons.disabledFirst,this._getContainerElement().appendChild(e)},_appendPrevButton:function(t){var e;e=t.currentPageIndex>1?this._buttons.prev:this._buttons.disabledPrev,this._getContainerElement().appendChild(e)},_appendNextButton:function(t){var e;e=t.currentPageIndex<t.lastPageListIndex?this._buttons.next:this._buttons.disabledNext,this._getContainerElement().appendChild(e)},_appendLastButton:function(t){var e;e=t.page<t.lastPage?this._buttons.last:this._buttons.disabledLast,this._getContainerElement().appendChild(e)},_appendPrevMoreButton:function(t){var e;t.prevMore&&(e=this._buttons.prevMore,s.addClass(e,this._firstItemClassName),this._getContainerElement().appendChild(e))},_appendNextMoreButton:function(t){var e;t.nextMore&&(e=this._buttons.nextMore,s.addClass(e,this._lastItemClassName),this._getContainerElement().appendChild(e))},_appendPages:function(t){var e,n,i=this._template,a=t.leftPageNumber,o=t.rightPageNumber;for(n=a;n<=o;n+=1)n===t.page?e=s.changeTemplateToElement(i.currentPage,{page:n}):(e=s.changeTemplateToElement(i.page,{page:n}),this._enabledPageElements.push(e)),n!==a||t.prevMore||s.addClass(e,this._firstItemClassName),n!==o||t.nextMore||s.addClass(e,this._lastItemClassName),this._getContainerElement().appendChild(e)},_attachClickEvent:function(t){var e=this._getContainerElement();s.addEventListener(e,"click",u(function(e){var n,i,a=s.getTargetElement(e);s.preventDefault(e),i=this._getButtonType(a),i||(n=this._getPageNumber(a)),t(i,n)},this))},_getButtonType:function(t){var e,n=this._buttons;return o(n,function(n,i){return!s.isContained(t,n)||(e=i,!1)},this),e},_getPageNumber:function(t){var e,n=this._findPageElement(t);return n&&(e=parseInt(n.innerText,10)),e},_findPageElement:function(t){var e,n,i;for(e=0,n=this._enabledPageElements.length;e<n;e+=1)if(i=this._enabledPageElements[e],s.isContained(t,i))return i;return null},_empty:function(){this._enabledPageElements=[],o(this._buttons,function(t,e){this._buttons[e]=t.cloneNode(!0)},this),this._getContainerElement().innerHTML=""},update:function(t){this._empty(),this._appendFirstButton(t),this._appendPrevButton(t),this._appendPrevMoreButton(t),this._appendPages(t),this._appendNextMoreButton(t),this._appendNextButton(t),this._appendLastButton(t)}});t.exports=d},function(t,e){}])});
{
"name": "tui-pagination",
"version": "3.3.1",
"version": "3.3.2",
"description": "TOAST UI Components: Pagination",

@@ -27,5 +27,6 @@ "main": "dist/tui-pagination",

"pagination",
"tui-pagination"
"tui-pagination",
"nhn"
],
"author": "NHNEnt FE Development Team <dl_javascript@nhnent.com>",
"author": "NHN FE Development Team <dl_javascript@nhn.com>",
"license": "MIT",

@@ -32,0 +33,0 @@ "devDependencies": {

@@ -8,3 +8,3 @@ # TOAST UI Component : Pagination

[![PRs welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](https://github.com/nhnent/tui.project-name/labels/help%20wanted)
[![code with hearth by NHN Entertainment](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-NHN%20Entertainment-ff1414.svg)](https://github.com/nhnent)
[![code with hearth by NHN](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-NHN-ff1414.svg)](https://github.com/nhnent)

@@ -235,2 +235,2 @@

This software is licensed under the [MIT](https://github.com/nhnent/tui.pagination/blob/production/LICENSE) © [NHN Entertainment](https://github.com/nhnent).
This software is licensed under the [MIT](https://github.com/nhnent/tui.pagination/blob/production/LICENSE) © [NHN](https://github.com/nhnent).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc