UNPKG

3.59 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
3 typeof define === 'function' && define.amd ? define(['jquery'], factory) :
4 (global = global || self, factory(global.jQuery));
5}(this, (function ($) { 'use strict';
6
7 $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
8
9 function _classCallCheck(instance, Constructor) {
10 if (!(instance instanceof Constructor)) {
11 throw new TypeError("Cannot call a class as a function");
12 }
13 }
14
15 function _defineProperties(target, props) {
16 for (var i = 0; i < props.length; i++) {
17 var descriptor = props[i];
18 descriptor.enumerable = descriptor.enumerable || false;
19 descriptor.configurable = true;
20 if ("value" in descriptor) descriptor.writable = true;
21 Object.defineProperty(target, descriptor.key, descriptor);
22 }
23 }
24
25 function _createClass(Constructor, protoProps, staticProps) {
26 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27 if (staticProps) _defineProperties(Constructor, staticProps);
28 return Constructor;
29 }
30
31 function _inherits(subClass, superClass) {
32 if (typeof superClass !== "function" && superClass !== null) {
33 throw new TypeError("Super expression must either be null or a function");
34 }
35
36 subClass.prototype = Object.create(superClass && superClass.prototype, {
37 constructor: {
38 value: subClass,
39 writable: true,
40 configurable: true
41 }
42 });
43 if (superClass) _setPrototypeOf(subClass, superClass);
44 }
45
46 function _getPrototypeOf(o) {
47 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
48 return o.__proto__ || Object.getPrototypeOf(o);
49 };
50 return _getPrototypeOf(o);
51 }
52
53 function _setPrototypeOf(o, p) {
54 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
55 o.__proto__ = p;
56 return o;
57 };
58
59 return _setPrototypeOf(o, p);
60 }
61
62 function _assertThisInitialized(self) {
63 if (self === void 0) {
64 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
65 }
66
67 return self;
68 }
69
70 function _possibleConstructorReturn(self, call) {
71 if (call && (typeof call === "object" || typeof call === "function")) {
72 return call;
73 }
74
75 return _assertThisInitialized(self);
76 }
77
78 /**
79 * @author: Jewway
80 * @update zhixin wen <wenzhixin2010@gmail.com>
81 */
82
83 $.fn.bootstrapTable.methods.push('changeTitle');
84 $.fn.bootstrapTable.methods.push('changeLocale');
85
86 $.BootstrapTable =
87 /*#__PURE__*/
88 function (_$$BootstrapTable) {
89 _inherits(_class, _$$BootstrapTable);
90
91 function _class() {
92 _classCallCheck(this, _class);
93
94 return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
95 }
96
97 _createClass(_class, [{
98 key: "changeTitle",
99 value: function changeTitle(locale) {
100 $.each(this.options.columns, function (idx, columnList) {
101 $.each(columnList, function (idx, column) {
102 if (column.field) {
103 column.title = locale[column.field];
104 }
105 });
106 });
107 this.initHeader();
108 this.initBody();
109 this.initToolbar();
110 }
111 }, {
112 key: "changeLocale",
113 value: function changeLocale(localeId) {
114 this.options.locale = localeId;
115 this.initLocale();
116 this.initPagination();
117 this.initBody();
118 this.initToolbar();
119 }
120 }]);
121
122 return _class;
123 }($.BootstrapTable);
124
125})));