/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/docs/dist/extensions/mobile/bootstrap-table-mobile.js |
@@ -0,0 +1,136 @@ |
/** |
* @author: Dennis Hernández |
* @webSite: http://djhvscf.github.io/Blog |
* @version: v1.1.0 |
*/ |
|
!function ($) { |
|
'use strict'; |
|
var showHideColumns = function (that, checked) { |
if (that.options.columnsHidden.length > 0 ) { |
$.each(that.columns, function (i, column) { |
if (that.options.columnsHidden.indexOf(column.field) !== -1) { |
if (column.visible !== checked) { |
that.toggleColumn($.fn.bootstrapTable.utils.getFieldIndex(that.columns, column.field), checked, true); |
} |
} |
}); |
} |
}; |
|
var resetView = function (that) { |
if (that.options.height || that.options.showFooter) { |
setTimeout(function(){ |
that.resetView.call(that); |
}, 1); |
} |
}; |
|
var changeView = function (that, width, height) { |
if (that.options.minHeight) { |
if ((width <= that.options.minWidth) && (height <= that.options.minHeight)) { |
conditionCardView(that); |
} else if ((width > that.options.minWidth) && (height > that.options.minHeight)) { |
conditionFullView(that); |
} |
} else { |
if (width <= that.options.minWidth) { |
conditionCardView(that); |
} else if (width > that.options.minWidth) { |
conditionFullView(that); |
} |
} |
|
resetView(that); |
}; |
|
var conditionCardView = function (that) { |
changeTableView(that, false); |
showHideColumns(that, false); |
}; |
|
var conditionFullView = function (that) { |
changeTableView(that, true); |
showHideColumns(that, true); |
}; |
|
var changeTableView = function (that, cardViewState) { |
that.options.cardView = cardViewState; |
that.toggleView(); |
}; |
|
var debounce = function(func,wait) { |
var timeout; |
return function() { |
var context = this, |
args = arguments; |
var later = function() { |
timeout = null; |
func.apply(context,args); |
}; |
clearTimeout(timeout); |
timeout = setTimeout(later, wait); |
}; |
}; |
|
$.extend($.fn.bootstrapTable.defaults, { |
mobileResponsive: false, |
minWidth: 562, |
minHeight: undefined, |
heightThreshold: 100, // just slightly larger than mobile chrome's auto-hiding toolbar |
checkOnInit: true, |
columnsHidden: [] |
}); |
|
var BootstrapTable = $.fn.bootstrapTable.Constructor, |
_init = BootstrapTable.prototype.init; |
|
BootstrapTable.prototype.init = function () { |
_init.apply(this, Array.prototype.slice.apply(arguments)); |
|
if (!this.options.mobileResponsive) { |
return; |
} |
|
if (!this.options.minWidth) { |
return; |
} |
|
if (this.options.minWidth < 100 && this.options.resizable) { |
console.log("The minWidth when the resizable extension is active should be greater or equal than 100"); |
this.options.minWidth = 100; |
} |
|
var that = this, |
old = { |
width: $(window).width(), |
height: $(window).height() |
}; |
|
$(window).on('resize orientationchange',debounce(function (evt) { |
// reset view if height has only changed by at least the threshold. |
var height = $(this).height(), |
width = $(this).width(); |
|
if (Math.abs(old.height - height) > that.options.heightThreshold || old.width != width) { |
changeView(that, width, height); |
old = { |
width: width, |
height: height |
}; |
} |
},200)); |
|
if (this.options.checkOnInit) { |
var height = $(window).height(), |
width = $(window).width(); |
changeView(this, width, height); |
old = { |
width: width, |
height: height |
}; |
} |
}; |
}(jQuery); |
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/docs/dist/extensions/mobile/bootstrap-table-mobile.min.js |
@@ -0,0 +1,7 @@ |
/* |
* bootstrap-table - v1.11.1 - 2017-02-22 |
* https://github.com/wenzhixin/bootstrap-table |
* Copyright (c) 2017 zhixin wen |
* Licensed MIT License |
*/ |
!function(a){"use strict";var b=function(b,c){b.options.columnsHidden.length>0&&a.each(b.columns,function(d,e){-1!==b.options.columnsHidden.indexOf(e.field)&&e.visible!==c&&b.toggleColumn(a.fn.bootstrapTable.utils.getFieldIndex(b.columns,e.field),c,!0)})},c=function(a){(a.options.height||a.options.showFooter)&&setTimeout(function(){a.resetView.call(a)},1)},d=function(a,b,d){a.options.minHeight?b<=a.options.minWidth&&d<=a.options.minHeight?e(a):b>a.options.minWidth&&d>a.options.minHeight&&f(a):b<=a.options.minWidth?e(a):b>a.options.minWidth&&f(a),c(a)},e=function(a){g(a,!1),b(a,!1)},f=function(a){g(a,!0),b(a,!0)},g=function(a,b){a.options.cardView=b,a.toggleView()},h=function(a,b){var c;return function(){var d=this,e=arguments,f=function(){c=null,a.apply(d,e)};clearTimeout(c),c=setTimeout(f,b)}};a.extend(a.fn.bootstrapTable.defaults,{mobileResponsive:!1,minWidth:562,minHeight:void 0,heightThreshold:100,checkOnInit:!0,columnsHidden:[]});var i=a.fn.bootstrapTable.Constructor,j=i.prototype.init;i.prototype.init=function(){if(j.apply(this,Array.prototype.slice.apply(arguments)),this.options.mobileResponsive&&this.options.minWidth){this.options.minWidth<100&&this.options.resizable&&(console.log("The minWidth when the resizable extension is active should be greater or equal than 100"),this.options.minWidth=100);var b=this,c={width:a(window).width(),height:a(window).height()};if(a(window).on("resize orientationchange",h(function(){var e=a(this).height(),f=a(this).width();(Math.abs(c.height-e)>b.options.heightThreshold||c.width!=f)&&(d(b,f,e),c={width:f,height:e})},200)),this.options.checkOnInit){var e=a(window).height(),f=a(window).width();d(this,f,e),c={width:f,height:e}}}}}(jQuery); |