Previous changeset 7:3e77e2cae956 (2017-10-13) Next changeset 9:0ee4dadfdca3 (2017-10-13) |
Commit message:
Uploaded |
added:
bin/js/bootstrap-table.js |
b |
diff -r 3e77e2cae956 -r c61e7cc135c2 bin/js/bootstrap-table.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/js/bootstrap-table.js Fri Oct 13 03:12:12 2017 -0400 |
[ |
b"@@ -0,0 +1,3094 @@\n+/**\n+ * @author zhixin wen <wenzhixin2010@gmail.com>\n+ * version: 1.11.1\n+ * https://github.com/wenzhixin/bootstrap-table/\n+ */\n+\n+(function ($) {\n+ 'use strict';\n+\n+ // TOOLS DEFINITION\n+ // ======================\n+\n+ var cachedWidth = null;\n+\n+ // it only does '%s', and return '' when arguments are undefined\n+ var sprintf = function (str) {\n+ var args = arguments,\n+ flag = true,\n+ i = 1;\n+\n+ str = str.replace(/%s/g, function () {\n+ var arg = args[i++];\n+\n+ if (typeof arg === 'undefined') {\n+ flag = false;\n+ return '';\n+ }\n+ return arg;\n+ });\n+ return flag ? str : '';\n+ };\n+\n+ var getPropertyFromOther = function (list, from, to, value) {\n+ var result = '';\n+ $.each(list, function (i, item) {\n+ if (item[from] === value) {\n+ result = item[to];\n+ return false;\n+ }\n+ return true;\n+ });\n+ return result;\n+ };\n+\n+ var getFieldIndex = function (columns, field) {\n+ var index = -1;\n+\n+ $.each(columns, function (i, column) {\n+ if (column.field === field) {\n+ index = i;\n+ return false;\n+ }\n+ return true;\n+ });\n+ return index;\n+ };\n+\n+ // http://jsfiddle.net/wenyi/47nz7ez9/3/\n+ var setFieldIndex = function (columns) {\n+ var i, j, k,\n+ totalCol = 0,\n+ flag = [];\n+\n+ for (i = 0; i < columns[0].length; i++) {\n+ totalCol += columns[0][i].colspan || 1;\n+ }\n+\n+ for (i = 0; i < columns.length; i++) {\n+ flag[i] = [];\n+ for (j = 0; j < totalCol; j++) {\n+ flag[i][j] = false;\n+ }\n+ }\n+\n+ for (i = 0; i < columns.length; i++) {\n+ for (j = 0; j < columns[i].length; j++) {\n+ var r = columns[i][j],\n+ rowspan = r.rowspan || 1,\n+ colspan = r.colspan || 1,\n+ index = $.inArray(false, flag[i]);\n+\n+ if (colspan === 1) {\n+ r.fieldIndex = index;\n+ // when field is undefined, use index instead\n+ if (typeof r.field === 'undefined') {\n+ r.field = index;\n+ }\n+ }\n+\n+ for (k = 0; k < rowspan; k++) {\n+ flag[i + k][index] = true;\n+ }\n+ for (k = 0; k < colspan; k++) {\n+ flag[i][index + k] = true;\n+ }\n+ }\n+ }\n+ };\n+\n+ var getScrollBarWidth = function () {\n+ if (cachedWidth === null) {\n+ var inner = $('<p/>').addClass('fixed-table-scroll-inner'),\n+ outer = $('<div/>').addClass('fixed-table-scroll-outer'),\n+ w1, w2;\n+\n+ outer.append(inner);\n+ $('body').append(outer);\n+\n+ w1 = inner[0].offsetWidth;\n+ outer.css('overflow', 'scroll');\n+ w2 = inner[0].offsetWidth;\n+\n+ if (w1 === w2) {\n+ w2 = outer[0].clientWidth;\n+ }\n+\n+ outer.remove();\n+ cachedWidth = w1 - w2;\n+ }\n+ return cachedWidth;\n+ };\n+\n+ var calculateObjectValue = function (self, name, args, defaultValue) {\n+ var func = name;\n+\n+ if (typeof name === 'string') {\n+ // support obj.func1.func2\n+ var names = name.split('.');\n+\n+ if (names.length > 1) {\n+ func = window;\n+ $.each(names, function (i, f) {\n+ func = func[f];\n+ });\n+ } else {\n+ func = window[name];\n+ }\n+ }\n+ if (typeof func === 'object') {\n+ return func;\n+ }\n+ if (typeof func === 'function') {\n+"..b' i < trs.length; i++) {\n+ this.expandRow_(true, $(trs[i]).data("index"));\n+ }\n+ }\n+ };\n+\n+ BootstrapTable.prototype.collapseAllRows = function (isSubTable) {\n+ if (isSubTable) {\n+ this.expandRow_(false, 0);\n+ } else {\n+ var trs = this.$body.children();\n+ for (var i = 0; i < trs.length; i++) {\n+ this.expandRow_(false, $(trs[i]).data("index"));\n+ }\n+ }\n+ };\n+\n+ BootstrapTable.prototype.updateFormatText = function (name, text) {\n+ if (this.options[sprintf(\'format%s\', name)]) {\n+ if (typeof text === \'string\') {\n+ this.options[sprintf(\'format%s\', name)] = function () {\n+ return text;\n+ };\n+ } else if (typeof text === \'function\') {\n+ this.options[sprintf(\'format%s\', name)] = text;\n+ }\n+ }\n+ this.initToolbar();\n+ this.initPagination();\n+ this.initBody();\n+ };\n+\n+ // BOOTSTRAP TABLE PLUGIN DEFINITION\n+ // =======================\n+\n+ var allowedMethods = [\n+ \'getOptions\',\n+ \'getSelections\', \'getAllSelections\', \'getData\',\n+ \'load\', \'append\', \'prepend\', \'remove\', \'removeAll\',\n+ \'insertRow\', \'updateRow\', \'updateCell\', \'updateByUniqueId\', \'removeByUniqueId\',\n+ \'getRowByUniqueId\', \'showRow\', \'hideRow\', \'getHiddenRows\',\n+ \'mergeCells\',\n+ \'checkAll\', \'uncheckAll\', \'checkInvert\',\n+ \'check\', \'uncheck\',\n+ \'checkBy\', \'uncheckBy\',\n+ \'refresh\',\n+ \'resetView\',\n+ \'resetWidth\',\n+ \'destroy\',\n+ \'showLoading\', \'hideLoading\',\n+ \'showColumn\', \'hideColumn\', \'getHiddenColumns\', \'getVisibleColumns\',\n+ \'showAllColumns\', \'hideAllColumns\',\n+ \'filterBy\',\n+ \'scrollTo\',\n+ \'getScrollPosition\',\n+ \'selectPage\', \'prevPage\', \'nextPage\',\n+ \'togglePagination\',\n+ \'toggleView\',\n+ \'refreshOptions\',\n+ \'resetSearch\',\n+ \'expandRow\', \'collapseRow\', \'expandAllRows\', \'collapseAllRows\',\n+ \'updateFormatText\'\n+ ];\n+\n+ $.fn.bootstrapTable = function (option) {\n+ var value,\n+ args = Array.prototype.slice.call(arguments, 1);\n+\n+ this.each(function () {\n+ var $this = $(this),\n+ data = $this.data(\'bootstrap.table\'),\n+ options = $.extend({}, BootstrapTable.DEFAULTS, $this.data(),\n+ typeof option === \'object\' && option);\n+\n+ if (typeof option === \'string\') {\n+ if ($.inArray(option, allowedMethods) < 0) {\n+ throw new Error("Unknown method: " + option);\n+ }\n+\n+ if (!data) {\n+ return;\n+ }\n+\n+ value = data[option].apply(data, args);\n+\n+ if (option === \'destroy\') {\n+ $this.removeData(\'bootstrap.table\');\n+ }\n+ }\n+\n+ if (!data) {\n+ $this.data(\'bootstrap.table\', (data = new BootstrapTable(this, options)));\n+ }\n+ });\n+\n+ return typeof value === \'undefined\' ? this : value;\n+ };\n+\n+ $.fn.bootstrapTable.Constructor = BootstrapTable;\n+ $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;\n+ $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;\n+ $.fn.bootstrapTable.locales = BootstrapTable.LOCALES;\n+ $.fn.bootstrapTable.methods = allowedMethods;\n+ $.fn.bootstrapTable.utils = {\n+ sprintf: sprintf,\n+ getFieldIndex: getFieldIndex,\n+ compareObjects: compareObjects,\n+ calculateObjectValue: calculateObjectValue,\n+ getItemField: getItemField,\n+ objectKeys: objectKeys,\n+ isIEBrowser: isIEBrowser\n+ };\n+\n+ // BOOTSTRAP TABLE INIT\n+ // =======================\n+\n+ $(function () {\n+ $(\'[data-toggle="table"]\').bootstrapTable();\n+ });\n+})(jQuery);\n' |