corrade-nucleus-nucleons

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 19  →  ?path2? @ 20
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/dist/extensions/reorder-columns/bootstrap-table-reorder-columns.js
@@ -0,0 +1,181 @@
/**
* @author: Dennis Hernández
* @webSite: http://djhvscf.github.io/Blog
* @version: v1.1.0
*/
 
!function ($) {
 
'use strict';
 
//From MDN site, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
var filterFn = function () {
if (!Array.prototype.filter) {
Array.prototype.filter = function(fun/*, thisArg*/) {
'use strict';
 
if (this === void 0 || this === null) {
throw new TypeError();
}
 
var t = Object(this);
var len = t.length >>> 0;
if (typeof fun !== 'function') {
throw new TypeError();
}
 
var res = [];
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
for (var i = 0; i < len; i++) {
if (i in t) {
var val = t[i];
 
// NOTE: Technically this should Object.defineProperty at
// the next index, as push can be affected by
// properties on Object.prototype and Array.prototype.
// But that method's new, and collisions should be
// rare, so use the more-compatible alternative.
if (fun.call(thisArg, val, i, t)) {
res.push(val);
}
}
}
 
return res;
};
}
};
 
$.extend($.fn.bootstrapTable.defaults, {
reorderableColumns: false,
maxMovingRows: 10,
onReorderColumn: function (headerFields) {
return false;
},
dragaccept: null
});
 
$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
'reorder-column.bs.table': 'onReorderColumn'
});
 
var BootstrapTable = $.fn.bootstrapTable.Constructor,
_initHeader = BootstrapTable.prototype.initHeader,
_toggleColumn = BootstrapTable.prototype.toggleColumn,
_toggleView = BootstrapTable.prototype.toggleView,
_resetView = BootstrapTable.prototype.resetView;
 
BootstrapTable.prototype.initHeader = function () {
_initHeader.apply(this, Array.prototype.slice.apply(arguments));
 
if (!this.options.reorderableColumns) {
return;
}
 
this.makeRowsReorderable();
};
 
BootstrapTable.prototype.toggleColumn = function () {
_toggleColumn.apply(this, Array.prototype.slice.apply(arguments));
 
if (!this.options.reorderableColumns) {
return;
}
 
this.makeRowsReorderable();
};
 
BootstrapTable.prototype.toggleView = function () {
_toggleView.apply(this, Array.prototype.slice.apply(arguments));
 
if (!this.options.reorderableColumns) {
return;
}
 
if (this.options.cardView) {
return;
}
 
this.makeRowsReorderable();
};
 
BootstrapTable.prototype.resetView = function () {
_resetView.apply(this, Array.prototype.slice.apply(arguments));
 
if (!this.options.reorderableColumns) {
return;
}
 
this.makeRowsReorderable();
};
 
BootstrapTable.prototype.makeRowsReorderable = function () {
var that = this;
try {
$(this.$el).dragtable('destroy');
} catch (e) {}
$(this.$el).dragtable({
maxMovingRows: that.options.maxMovingRows,
dragaccept: that.options.dragaccept,
clickDelay:200,
beforeStop: function() {
var ths = [],
formatters = [],
columns = [],
columnsHidden = [],
columnIndex = -1,
optionsColumns = [];
that.$header.find('th').each(function (i) {
ths.push($(this).data('field'));
formatters.push($(this).data('formatter'));
});
 
//Exist columns not shown
if (ths.length < that.columns.length) {
columnsHidden = $.grep(that.columns, function (column) {
return !column.visible;
});
for (var i = 0; i < columnsHidden.length; i++) {
ths.push(columnsHidden[i].field);
formatters.push(columnsHidden[i].formatter);
}
}
 
for (var i = 0; i < ths.length; i++ ) {
columnIndex = $.fn.bootstrapTable.utils.getFieldIndex(that.columns, ths[i]);
if (columnIndex !== -1) {
that.columns[columnIndex].fieldIndex = i;
columns.push(that.columns[columnIndex]);
that.columns.splice(columnIndex, 1);
}
}
 
that.columns = that.columns.concat(columns);
 
filterFn(); //Support <IE9
$.each(that.columns, function(i, column) {
var found = false,
field = column.field;
that.options.columns[0].filter(function(item) {
if(!found && item["field"] == field) {
optionsColumns.push(item);
found = true;
return false;
} else
return true;
})
});
 
that.options.columns[0] = optionsColumns;
 
that.header.fields = ths;
that.header.formatters = formatters;
that.initHeader();
that.initToolbar();
that.initBody();
that.resetView();
that.trigger('reorder-column', ths);
}
});
};
}(jQuery);
/pack-rat/003_pack_rat/pack-rat/node_modules/bootstrap-table/dist/extensions/reorder-columns/bootstrap-table-reorder-columns.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(){Array.prototype.filter||(Array.prototype.filter=function(a){if(void 0===this||null===this)throw new TypeError;var b=Object(this),c=b.length>>>0;if("function"!=typeof a)throw new TypeError;for(var d=[],e=arguments.length>=2?arguments[1]:void 0,f=0;c>f;f++)if(f in b){var g=b[f];a.call(e,g,f,b)&&d.push(g)}return d})};a.extend(a.fn.bootstrapTable.defaults,{reorderableColumns:!1,maxMovingRows:10,onReorderColumn:function(){return!1},dragaccept:null}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"reorder-column.bs.table":"onReorderColumn"});var c=a.fn.bootstrapTable.Constructor,d=c.prototype.initHeader,e=c.prototype.toggleColumn,f=c.prototype.toggleView,g=c.prototype.resetView;c.prototype.initHeader=function(){d.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},c.prototype.toggleColumn=function(){e.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},c.prototype.toggleView=function(){f.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&(this.options.cardView||this.makeRowsReorderable())},c.prototype.resetView=function(){g.apply(this,Array.prototype.slice.apply(arguments)),this.options.reorderableColumns&&this.makeRowsReorderable()},c.prototype.makeRowsReorderable=function(){var c=this;try{a(this.$el).dragtable("destroy")}catch(d){}a(this.$el).dragtable({maxMovingRows:c.options.maxMovingRows,dragaccept:c.options.dragaccept,clickDelay:200,beforeStop:function(){var d=[],e=[],f=[],g=[],h=-1,i=[];if(c.$header.find("th").each(function(){d.push(a(this).data("field")),e.push(a(this).data("formatter"))}),d.length<c.columns.length){g=a.grep(c.columns,function(a){return!a.visible});for(var j=0;j<g.length;j++)d.push(g[j].field),e.push(g[j].formatter)}for(var j=0;j<d.length;j++)h=a.fn.bootstrapTable.utils.getFieldIndex(c.columns,d[j]),-1!==h&&(c.columns[h].fieldIndex=j,f.push(c.columns[h]),c.columns.splice(h,1));c.columns=c.columns.concat(f),b(),a.each(c.columns,function(a,b){var d=!1,e=b.field;c.options.columns[0].filter(function(a){return d||a.field!=e?!0:(i.push(a),d=!0,!1)})}),c.options.columns[0]=i,c.header.fields=d,c.header.formatters=e,c.initHeader(),c.initToolbar(),c.initBody(),c.resetView(),c.trigger("reorder-column",d)}})}}(jQuery);