From 3df19c2b730c336b23c4742281af3c44308e3fd2 Mon Sep 17 00:00:00 2001 From: Rati Wannapanop Date: Fri, 16 Dec 2016 16:48:43 +0700 Subject: [PATCH] v1.5.8 --- dist/vue-table.js | 37 +++++++++++++++++++++++++++---------- dist/vue-table.min.js | 2 +- package.json | 2 +- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/dist/vue-table.js b/dist/vue-table.js index dc07db6..4e7719a 100644 --- a/dist/vue-table.js +++ b/dist/vue-table.js @@ -893,10 +893,12 @@ exports.default = { console.warn('You did not provide reference id column with "__checkbox:" field!'); return; } + + var key = dataItem[idColumn]; if (isChecked) { - this.selectedTo.push(dataItem[idColumn]); + this.selectId(key); } else { - this.selectedTo.$remove(dataItem[idColumn]); + this.unselectId(key); } }, toggleAllCheckboxes: function toggleAllCheckboxes(isChecked, fieldName) { @@ -905,26 +907,41 @@ exports.default = { if (isChecked) { this.tableData.forEach(function (dataItem) { - if (!self.isSelectedRow(dataItem, fieldName)) { - self.selectedTo.push(dataItem[idColumn]); - } + self.selectId(dataItem[idColumn]); }); } else { this.tableData.forEach(function (dataItem) { - self.selectedTo.$remove(dataItem[idColumn]); + self.unselectId(dataItem[idColumn]); }); } }, + selectId: function selectId(key) { + if (!this.isSelectedRow(key)) { + this.selectedTo.push(key); + } + }, + unselectId: function unselectId(key) { + this.selectedTo.$remove(key); + // this.selectedTo = this.selectedTo.filter(function(item) { + // return item !== key + // }) + }, isSelectedRow: function isSelectedRow(dataItem, fieldName) { - return this.selectedTo.indexOf(dataItem[this.extractArgs(fieldName)]) >= 0; + return this.selectedTo.indexOf(key) >= 0; + }, + rowSelected: function rowSelected(dataItem, fieldName) { + var idColumn = this.extractArgs(fieldName); + var key = dataItem[idColumn]; + + return this.isSelectedRow(key); }, checkCheckboxesState: function checkCheckboxesState(fieldName) { if (this.selectedTo.length === 0) return false; var self = this; - var selector = 'th.checkbox_' + this.extractArgs(fieldName) + ' input[type=checkbox]'; - var els = document.querySelectorAll(selector); var idColumn = this.extractArgs(fieldName); + var selector = 'th.checkbox_' + idColumn + ' input[type=checkbox]'; + var els = document.querySelectorAll(selector); // count how many checkbox row in the current page has been checked var selected = this.tableData.filter(function (item) { @@ -1095,7 +1112,7 @@ exports.default = { } }; if (module.exports.__esModule) module.exports = module.exports.default -;(typeof module.exports === "function"? module.exports.options: module.exports).template = "\n
\n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
1\" class=\"vuetable-pagination-component {{paginationComponentClass}}\">\n \n
\n
\n
\n" +;(typeof module.exports === "function"? module.exports.options: module.exports).template = "\n
\n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
1\" class=\"vuetable-pagination-component {{paginationComponentClass}}\">\n \n
\n
\n
\n" if (module.hot) {(function () { module.hot.accept() var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), true) diff --git a/dist/vue-table.min.js b/dist/vue-table.min.js index a1a4b75..f2468bd 100644 --- a/dist/vue-table.min.js +++ b/dist/vue-table.min.js @@ -1 +1 @@ -!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o0&&(params+="&"+this.appendParams.join("&")),params},showLoadingAnimation:function(wrapper){null!==wrapper&&this.addClass(wrapper,this.loadingClass),this.dispatchEvent("loading")},hideLoadingAnimation:function(wrapper){null!==wrapper&&this.removeClass(wrapper,this.loadingClass),this.dispatchEvent("loaded")},transform:function(data){var func="transform";return this.parentFunctionExists(func)?this.$parent[func].call(this.$parent,data):data},parentFunctionExists:function(func){return""!==func&&"function"==typeof this.$parent[func]},getTitle:function(field){return"undefined"==typeof field.title?field.name.replace("."," "):field.title},getSortParam:function(){return this.sortOrder&&""!=this.sortOrder.field?"function"==typeof this.$parent.getSortParam?this.$parent.getSortParam.call(this.$parent,this.sortOrder):this.getDefaultSortParam():""},getDefaultSortParam:function(){for(var result="",i=0;i1&&(this.currentPage--,this.loadData())},gotoNextPage:function(){this.currentPage0&&page<=this.tablePagination.last_page&&(this.currentPage=page,this.loadData())},isSpecialField:function(fieldName){return"__"===fieldName.slice(0,2)},hasCallback:function(item){return!!item.callback},callCallback:function(field,item){if(this.hasCallback(field)){var args=field.callback.split("|"),func=args.shift();return"function"==typeof this.$parent[func]?args.length>0?this.$parent[func].apply(this.$parent,[this.getObjectValue(item,field.name)].concat(args)):this.$parent[func].call(this.$parent,this.getObjectValue(item,field.name)):null}},getObjectValue:function(object,path,defaultValue){defaultValue="undefined"==typeof defaultValue?null:defaultValue;var obj=object;if(""!=path.trim()){var keys=path.split(".");keys.forEach(function(key){return null===obj||"undefined"==typeof obj[key]||null===obj[key]?void(obj=defaultValue):void(obj=obj[key])})}return obj},callAction:function(action,data){this.$dispatch(this.eventPrefix+"action",action,data)},addParam:function(param){this.appendParams.push(param)},toggleCheckbox:function(isChecked,dataItem,fieldName){var idColumn=this.extractArgs(fieldName);return void 0===idColumn?void console.warn('You did not provide reference id column with "__checkbox:" field!'):void(isChecked?this.selectedTo.push(dataItem[idColumn]):this.selectedTo.$remove(dataItem[idColumn]))},toggleAllCheckboxes:function(isChecked,fieldName){var self=this,idColumn=this.extractArgs(fieldName);isChecked?this.tableData.forEach(function(dataItem){self.isSelectedRow(dataItem,fieldName)||self.selectedTo.push(dataItem[idColumn])}):this.tableData.forEach(function(dataItem){self.selectedTo.$remove(dataItem[idColumn])})},isSelectedRow:function(dataItem,fieldName){return this.selectedTo.indexOf(dataItem[this.extractArgs(fieldName)])>=0},checkCheckboxesState:function(fieldName){if(0===this.selectedTo.length)return!1;var self=this,selector="th.checkbox_"+this.extractArgs(fieldName)+" input[type=checkbox]",els=document.querySelectorAll(selector),idColumn=this.extractArgs(fieldName),selected=this.tableData.filter(function(item){return self.selectedTo.indexOf(item[idColumn])>=0});return selected.length<=0?(els.forEach(function(el){el.indeterminate=!1}),!1):selected.length=0},showDetailRow:function(rowId){this.isVisibleDetailRow(rowId)||this.visibleDetailRows.push(rowId)},hideDetailRow:function(rowId){this.isVisibleDetailRow(rowId)&&this.visibleDetailRows.$remove(rowId)},toggleDetailRow:function(rowId){this.isVisibleDetailRow(rowId)?this.hideDetailRow(rowId):this.showDetailRow(rowId)},onRowClass:function(dataItem,index){var func=this.rowClassCallback.trim();return""!==func&&"function"==typeof this.$parent[func]?this.$parent[func].call(this.$parent,dataItem,index):""},onRowChanged:function(dataItem){return this.dispatchEvent("row-changed",dataItem),!0},onRowClicked:function(dataItem,event){return this.$dispatch(this.eventPrefix+"row-clicked",dataItem,event),!0},onRowDoubleClicked:function(dataItem,event){this.$dispatch(this.eventPrefix+"row-dblclicked",dataItem,event)},onCellClicked:function(dataItem,field,event){this.$dispatch(this.eventPrefix+"cell-clicked",dataItem,field,event)},onCellDoubleClicked:function(dataItem,field,event){this.$dispatch(this.eventPrefix+"cell-dblclicked",dataItem,field,event)},onDetailRowClick:function(dataItem,event){this.$dispatch(this.eventPrefix+"detail-row-clicked",dataItem,event)},callPaginationConfig:function(){"function"==typeof this.$parent[this.paginationConfigCallback]&&this.$parent[this.paginationConfigCallback].call(this.$parent,this.$refs.pagination.$options.name)},logDeprecatedMessage:function(name,replacer){var msg='"{name}" prop is being deprecated and will be removed in the future. Please use "{replacer}" instead.';console.warn(msg.replace("{name}",name).replace("{replacer}",replacer))},checkForDeprecatedProps:function(){"paginationConfig"!==this.paginationConfig&&this.logDeprecatedMessage("paginationConfig","paginationConfigCallback"),""!==this.detailRow&&this.logDeprecatedMessage("detail-row","detail-row-callback"),""!==this.detailRowCallback&&this.logDeprecatedMessage("detail-row-callback","detail-row-component")}},watch:{multiSort:function(newVal,oldVal){newVal===!1&&this.sortOrder.length>1&&(this.sortOrder.splice(1),this.loadData())}},events:{"vuetable-pagination:change-page":function(page){"prev"==page?this.gotoPreviousPage():"next"==page?this.gotoNextPage():this.gotoPage(page)},"vuetable:reload":function(){this.loadData()},"vuetable:refresh":function(){this.currentPage=1,this.loadData()},"vuetable:goto-page":function(page){this.$emit("vuetable-pagination:change-page",page)},"vuetable:set-options":function(options){for(var n in options)this.$set(n,options[n])},"vuetable:toggle-detail":function(dataItem){this.toggleDetailRow(dataItem)},"vuetable:show-detail":function(dataItem){this.showDetailRow(dataItem)},"vuetable:hide-detail":function(dataItem){this.hideDetailRow(dataItem)}},created:function(){this.checkForDeprecatedProps(),this.normalizeFields(),this.loadOnStart&&this.loadData(),this.$nextTick(function(){this.callPaginationConfig()})}},module.exports.__esModule&&(module.exports=module.exports.default),("function"==typeof module.exports?module.exports.options:module.exports).template='
'},{"vueify/lib/insert-css":1}],3:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _VuetablePaginationMixin=require("./VuetablePaginationMixin.vue"),_VuetablePaginationMixin2=_interopRequireDefault(_VuetablePaginationMixin);exports.default={mixins:[_VuetablePaginationMixin2.default]},module.exports.__esModule&&(module.exports=module.exports.default),("function"==typeof module.exports?module.exports.options:module.exports).template=''},{"./VuetablePaginationMixin.vue":5}],4:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _VuetablePaginationMixin=require("./VuetablePaginationMixin.vue"),_VuetablePaginationMixin2=_interopRequireDefault(_VuetablePaginationMixin);exports.default={mixins:[_VuetablePaginationMixin2.default],props:{dropdownClass:{type:String,default:function(){return"ui search dropdown"}},pageText:{type:String,default:function(){return"Page"}}},methods:{loadPage:function(page){"prev"!=page||this.isOnFirstPage?"next"!=page||this.isOnLastPage||this.setDropdownToPage(this.tablePagination.current_page+1):this.setDropdownToPage(this.tablePagination.current_page-1),this.$dispatch("vuetable-pagination:change-page",page)},setDropdownToPage:function(page){this.$nextTick(function(){document.getElementById("vuetable-pagination-dropdown").value=page})},selectPage:function(event){this.$dispatch("vuetable-pagination:change-page",event.target.selectedIndex+1)}},events:{"vuetable:load-success":function(tablePagination){this.tablePagination=tablePagination,this.setDropdownToPage(tablePagination.current_page)}}},module.exports.__esModule&&(module.exports=module.exports.default),("function"==typeof module.exports?module.exports.options:module.exports).template='
'},{"./VuetablePaginationMixin.vue":5}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={props:{wrapperClass:{type:String,default:function(){return"ui right floated pagination menu"}},activeClass:{type:String,default:function(){return"active large"}},disabledClass:{type:String,default:function(){return"disabled"}},pageClass:{type:String,default:function(){return"item"}},linkClass:{type:String,default:function(){return"icon item"}},icons:{type:Object,default:function(){return{first:"angle double left icon",prev:"left chevron icon",next:"right chevron icon",last:"angle double right icon"}}},onEachSide:{type:Number,coerce:function(value){return parseInt(value)},default:function(){return 2}}},data:function(){return{tablePagination:null}},computed:{totalPage:function(){return null==this.tablePagination?0:this.tablePagination.last_page},isOnFirstPage:function(){return null!=this.tablePagination&&1==this.tablePagination.current_page},isOnLastPage:function(){return null!=this.tablePagination&&this.tablePagination.current_page==this.tablePagination.last_page},notEnoughPages:function(){return this.totalPage<2*this.onEachSide+4},windowSize:function(){return 2*this.onEachSide+1},windowStart:function(){return!this.tablePagination||this.tablePagination.current_page<=this.onEachSide?1:this.tablePagination.current_page>=this.totalPage-this.onEachSide?this.totalPage-2*this.onEachSide:this.tablePagination.current_page-this.onEachSide}},methods:{loadPage:function(page){this.$dispatch("vuetable-pagination:change-page",page)},isCurrentPage:function(page){return page==this.tablePagination.current_page}},events:{"vuetable:load-success":function(tablePagination){this.tablePagination=tablePagination},"vuetable-pagination:set-options":function(options){for(var n in options)this.$set(n,options[n])}}},module.exports.__esModule&&(module.exports=module.exports.default)},{}],6:[function(require,module,exports){Vue.component("vuetable-pagination",require("./components/VuetablePagination.vue")),Vue.component("vuetable-pagination-dropdown",require("./components/VuetablePaginationDropdown.vue")),Vue.component("vuetable",require("./components/Vuetable.vue"))},{"./components/Vuetable.vue":2,"./components/VuetablePagination.vue":3,"./components/VuetablePaginationDropdown.vue":4}]},{},[6]); +!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o0&&(params+="&"+this.appendParams.join("&")),params},showLoadingAnimation:function(wrapper){null!==wrapper&&this.addClass(wrapper,this.loadingClass),this.dispatchEvent("loading")},hideLoadingAnimation:function(wrapper){null!==wrapper&&this.removeClass(wrapper,this.loadingClass),this.dispatchEvent("loaded")},transform:function(data){var func="transform";return this.parentFunctionExists(func)?this.$parent[func].call(this.$parent,data):data},parentFunctionExists:function(func){return""!==func&&"function"==typeof this.$parent[func]},getTitle:function(field){return"undefined"==typeof field.title?field.name.replace("."," "):field.title},getSortParam:function(){return this.sortOrder&&""!=this.sortOrder.field?"function"==typeof this.$parent.getSortParam?this.$parent.getSortParam.call(this.$parent,this.sortOrder):this.getDefaultSortParam():""},getDefaultSortParam:function(){for(var result="",i=0;i1&&(this.currentPage--,this.loadData())},gotoNextPage:function(){this.currentPage0&&page<=this.tablePagination.last_page&&(this.currentPage=page,this.loadData())},isSpecialField:function(fieldName){return"__"===fieldName.slice(0,2)},hasCallback:function(item){return!!item.callback},callCallback:function(field,item){if(this.hasCallback(field)){var args=field.callback.split("|"),func=args.shift();return"function"==typeof this.$parent[func]?args.length>0?this.$parent[func].apply(this.$parent,[this.getObjectValue(item,field.name)].concat(args)):this.$parent[func].call(this.$parent,this.getObjectValue(item,field.name)):null}},getObjectValue:function(object,path,defaultValue){defaultValue="undefined"==typeof defaultValue?null:defaultValue;var obj=object;if(""!=path.trim()){var keys=path.split(".");keys.forEach(function(key){return null===obj||"undefined"==typeof obj[key]||null===obj[key]?void(obj=defaultValue):void(obj=obj[key])})}return obj},callAction:function(action,data){this.$dispatch(this.eventPrefix+"action",action,data)},addParam:function(param){this.appendParams.push(param)},toggleCheckbox:function(isChecked,dataItem,fieldName){var idColumn=this.extractArgs(fieldName);if(void 0===idColumn)return void console.warn('You did not provide reference id column with "__checkbox:" field!');var key=dataItem[idColumn];isChecked?this.selectId(key):this.unselectId(key)},toggleAllCheckboxes:function(isChecked,fieldName){var self=this,idColumn=this.extractArgs(fieldName);isChecked?this.tableData.forEach(function(dataItem){self.selectId(dataItem[idColumn])}):this.tableData.forEach(function(dataItem){self.unselectId(dataItem[idColumn])})},selectId:function(key){this.isSelectedRow(key)||this.selectedTo.push(key)},unselectId:function(key){this.selectedTo.$remove(key)},isSelectedRow:function(dataItem,fieldName){return this.selectedTo.indexOf(key)>=0},rowSelected:function(dataItem,fieldName){var idColumn=this.extractArgs(fieldName),key=dataItem[idColumn];return this.isSelectedRow(key)},checkCheckboxesState:function(fieldName){if(0===this.selectedTo.length)return!1;var self=this,idColumn=this.extractArgs(fieldName),selector="th.checkbox_"+idColumn+" input[type=checkbox]",els=document.querySelectorAll(selector),selected=this.tableData.filter(function(item){return self.selectedTo.indexOf(item[idColumn])>=0});return selected.length<=0?(els.forEach(function(el){el.indeterminate=!1}),!1):selected.length=0},showDetailRow:function(rowId){this.isVisibleDetailRow(rowId)||this.visibleDetailRows.push(rowId)},hideDetailRow:function(rowId){this.isVisibleDetailRow(rowId)&&this.visibleDetailRows.$remove(rowId)},toggleDetailRow:function(rowId){this.isVisibleDetailRow(rowId)?this.hideDetailRow(rowId):this.showDetailRow(rowId)},onRowClass:function(dataItem,index){var func=this.rowClassCallback.trim();return""!==func&&"function"==typeof this.$parent[func]?this.$parent[func].call(this.$parent,dataItem,index):""},onRowChanged:function(dataItem){return this.dispatchEvent("row-changed",dataItem),!0},onRowClicked:function(dataItem,event){return this.$dispatch(this.eventPrefix+"row-clicked",dataItem,event),!0},onRowDoubleClicked:function(dataItem,event){this.$dispatch(this.eventPrefix+"row-dblclicked",dataItem,event)},onCellClicked:function(dataItem,field,event){this.$dispatch(this.eventPrefix+"cell-clicked",dataItem,field,event)},onCellDoubleClicked:function(dataItem,field,event){this.$dispatch(this.eventPrefix+"cell-dblclicked",dataItem,field,event)},onDetailRowClick:function(dataItem,event){this.$dispatch(this.eventPrefix+"detail-row-clicked",dataItem,event)},callPaginationConfig:function(){"function"==typeof this.$parent[this.paginationConfigCallback]&&this.$parent[this.paginationConfigCallback].call(this.$parent,this.$refs.pagination.$options.name)},logDeprecatedMessage:function(name,replacer){var msg='"{name}" prop is being deprecated and will be removed in the future. Please use "{replacer}" instead.';console.warn(msg.replace("{name}",name).replace("{replacer}",replacer))},checkForDeprecatedProps:function(){"paginationConfig"!==this.paginationConfig&&this.logDeprecatedMessage("paginationConfig","paginationConfigCallback"),""!==this.detailRow&&this.logDeprecatedMessage("detail-row","detail-row-callback"),""!==this.detailRowCallback&&this.logDeprecatedMessage("detail-row-callback","detail-row-component")}},watch:{multiSort:function(newVal,oldVal){newVal===!1&&this.sortOrder.length>1&&(this.sortOrder.splice(1),this.loadData())}},events:{"vuetable-pagination:change-page":function(page){"prev"==page?this.gotoPreviousPage():"next"==page?this.gotoNextPage():this.gotoPage(page)},"vuetable:reload":function(){this.loadData()},"vuetable:refresh":function(){this.currentPage=1,this.loadData()},"vuetable:goto-page":function(page){this.$emit("vuetable-pagination:change-page",page)},"vuetable:set-options":function(options){for(var n in options)this.$set(n,options[n])},"vuetable:toggle-detail":function(dataItem){this.toggleDetailRow(dataItem)},"vuetable:show-detail":function(dataItem){this.showDetailRow(dataItem)},"vuetable:hide-detail":function(dataItem){this.hideDetailRow(dataItem)}},created:function(){this.checkForDeprecatedProps(),this.normalizeFields(),this.loadOnStart&&this.loadData(),this.$nextTick(function(){this.callPaginationConfig()})}},module.exports.__esModule&&(module.exports=module.exports.default),("function"==typeof module.exports?module.exports.options:module.exports).template='
'},{"vueify/lib/insert-css":1}],3:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _VuetablePaginationMixin=require("./VuetablePaginationMixin.vue"),_VuetablePaginationMixin2=_interopRequireDefault(_VuetablePaginationMixin);exports.default={mixins:[_VuetablePaginationMixin2.default]},module.exports.__esModule&&(module.exports=module.exports.default),("function"==typeof module.exports?module.exports.options:module.exports).template=''},{"./VuetablePaginationMixin.vue":5}],4:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _VuetablePaginationMixin=require("./VuetablePaginationMixin.vue"),_VuetablePaginationMixin2=_interopRequireDefault(_VuetablePaginationMixin);exports.default={mixins:[_VuetablePaginationMixin2.default],props:{dropdownClass:{type:String,default:function(){return"ui search dropdown"}},pageText:{type:String,default:function(){return"Page"}}},methods:{loadPage:function(page){"prev"!=page||this.isOnFirstPage?"next"!=page||this.isOnLastPage||this.setDropdownToPage(this.tablePagination.current_page+1):this.setDropdownToPage(this.tablePagination.current_page-1),this.$dispatch("vuetable-pagination:change-page",page)},setDropdownToPage:function(page){this.$nextTick(function(){document.getElementById("vuetable-pagination-dropdown").value=page})},selectPage:function(event){this.$dispatch("vuetable-pagination:change-page",event.target.selectedIndex+1)}},events:{"vuetable:load-success":function(tablePagination){this.tablePagination=tablePagination,this.setDropdownToPage(tablePagination.current_page)}}},module.exports.__esModule&&(module.exports=module.exports.default),("function"==typeof module.exports?module.exports.options:module.exports).template='
'},{"./VuetablePaginationMixin.vue":5}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={props:{wrapperClass:{type:String,default:function(){return"ui right floated pagination menu"}},activeClass:{type:String,default:function(){return"active large"}},disabledClass:{type:String,default:function(){return"disabled"}},pageClass:{type:String,default:function(){return"item"}},linkClass:{type:String,default:function(){return"icon item"}},icons:{type:Object,default:function(){return{first:"angle double left icon",prev:"left chevron icon",next:"right chevron icon",last:"angle double right icon"}}},onEachSide:{type:Number,coerce:function(value){return parseInt(value)},default:function(){return 2}}},data:function(){return{tablePagination:null}},computed:{totalPage:function(){return null==this.tablePagination?0:this.tablePagination.last_page},isOnFirstPage:function(){return null!=this.tablePagination&&1==this.tablePagination.current_page},isOnLastPage:function(){return null!=this.tablePagination&&this.tablePagination.current_page==this.tablePagination.last_page},notEnoughPages:function(){return this.totalPage<2*this.onEachSide+4},windowSize:function(){return 2*this.onEachSide+1},windowStart:function(){return!this.tablePagination||this.tablePagination.current_page<=this.onEachSide?1:this.tablePagination.current_page>=this.totalPage-this.onEachSide?this.totalPage-2*this.onEachSide:this.tablePagination.current_page-this.onEachSide}},methods:{loadPage:function(page){this.$dispatch("vuetable-pagination:change-page",page)},isCurrentPage:function(page){return page==this.tablePagination.current_page}},events:{"vuetable:load-success":function(tablePagination){this.tablePagination=tablePagination},"vuetable-pagination:set-options":function(options){for(var n in options)this.$set(n,options[n])}}},module.exports.__esModule&&(module.exports=module.exports.default)},{}],6:[function(require,module,exports){Vue.component("vuetable-pagination",require("./components/VuetablePagination.vue")),Vue.component("vuetable-pagination-dropdown",require("./components/VuetablePaginationDropdown.vue")),Vue.component("vuetable",require("./components/Vuetable.vue"))},{"./components/Vuetable.vue":2,"./components/VuetablePagination.vue":3,"./components/VuetablePaginationDropdown.vue":4}]},{},[6]); diff --git a/package.json b/package.json index 7ff314e..68c6a03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vuetable", - "version": "1.5.7", + "version": "1.5.8", "description": "vue.js table component that will automatically request JSON data from server and display them nicely in HTML table with swap-able/extensible pagination component", "main": "dist/vue-table.js", "dependencies": {