UNPKG

4.75 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 = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.jQuery));
5}(this, (function ($) { 'use strict';
6
7 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
9 var $__default = /*#__PURE__*/_interopDefaultLegacy($);
10
11 function _classCallCheck(instance, Constructor) {
12 if (!(instance instanceof Constructor)) {
13 throw new TypeError("Cannot call a class as a function");
14 }
15 }
16
17 function _defineProperties(target, props) {
18 for (var i = 0; i < props.length; i++) {
19 var descriptor = props[i];
20 descriptor.enumerable = descriptor.enumerable || false;
21 descriptor.configurable = true;
22 if ("value" in descriptor) descriptor.writable = true;
23 Object.defineProperty(target, descriptor.key, descriptor);
24 }
25 }
26
27 function _createClass(Constructor, protoProps, staticProps) {
28 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
29 if (staticProps) _defineProperties(Constructor, staticProps);
30 return Constructor;
31 }
32
33 function _inherits(subClass, superClass) {
34 if (typeof superClass !== "function" && superClass !== null) {
35 throw new TypeError("Super expression must either be null or a function");
36 }
37
38 subClass.prototype = Object.create(superClass && superClass.prototype, {
39 constructor: {
40 value: subClass,
41 writable: true,
42 configurable: true
43 }
44 });
45 if (superClass) _setPrototypeOf(subClass, superClass);
46 }
47
48 function _getPrototypeOf(o) {
49 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
50 return o.__proto__ || Object.getPrototypeOf(o);
51 };
52 return _getPrototypeOf(o);
53 }
54
55 function _setPrototypeOf(o, p) {
56 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
57 o.__proto__ = p;
58 return o;
59 };
60
61 return _setPrototypeOf(o, p);
62 }
63
64 function _isNativeReflectConstruct() {
65 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
66 if (Reflect.construct.sham) return false;
67 if (typeof Proxy === "function") return true;
68
69 try {
70 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
71 return true;
72 } catch (e) {
73 return false;
74 }
75 }
76
77 function _assertThisInitialized(self) {
78 if (self === void 0) {
79 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
80 }
81
82 return self;
83 }
84
85 function _possibleConstructorReturn(self, call) {
86 if (call && (typeof call === "object" || typeof call === "function")) {
87 return call;
88 }
89
90 return _assertThisInitialized(self);
91 }
92
93 function _createSuper(Derived) {
94 var hasNativeReflectConstruct = _isNativeReflectConstruct();
95
96 return function _createSuperInternal() {
97 var Super = _getPrototypeOf(Derived),
98 result;
99
100 if (hasNativeReflectConstruct) {
101 var NewTarget = _getPrototypeOf(this).constructor;
102
103 result = Reflect.construct(Super, arguments, NewTarget);
104 } else {
105 result = Super.apply(this, arguments);
106 }
107
108 return _possibleConstructorReturn(this, result);
109 };
110 }
111
112 /**
113 * @author: Jewway
114 * @update zhixin wen <wenzhixin2010@gmail.com>
115 */
116
117 $__default['default'].fn.bootstrapTable.methods.push('changeTitle');
118 $__default['default'].fn.bootstrapTable.methods.push('changeLocale');
119
120 $__default['default'].BootstrapTable = /*#__PURE__*/function (_$$BootstrapTable) {
121 _inherits(_class, _$$BootstrapTable);
122
123 var _super = _createSuper(_class);
124
125 function _class() {
126 _classCallCheck(this, _class);
127
128 return _super.apply(this, arguments);
129 }
130
131 _createClass(_class, [{
132 key: "changeTitle",
133 value: function changeTitle(locale) {
134 $__default['default'].each(this.options.columns, function (idx, columnList) {
135 $__default['default'].each(columnList, function (idx, column) {
136 if (column.field) {
137 column.title = locale[column.field];
138 }
139 });
140 });
141 this.initHeader();
142 this.initBody();
143 this.initToolbar();
144 }
145 }, {
146 key: "changeLocale",
147 value: function changeLocale(localeId) {
148 this.options.locale = localeId;
149 this.initLocale();
150 this.initPagination();
151 this.initBody();
152 this.initToolbar();
153 }
154 }]);
155
156 return _class;
157 }($__default['default'].BootstrapTable);
158
159})));