UNPKG

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