UNPKG

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