bootstrap-table-semantic.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. (function (global, factory) {
  2. if (typeof define === "function" && define.amd) {
  3. define([], factory);
  4. } else if (typeof exports !== "undefined") {
  5. factory();
  6. } else {
  7. var mod = {
  8. exports: {}
  9. };
  10. factory();
  11. global.bootstrapTableSemantic = mod.exports;
  12. }
  13. })(this, function () {
  14. 'use strict';
  15. function _classCallCheck(instance, Constructor) {
  16. if (!(instance instanceof Constructor)) {
  17. throw new TypeError("Cannot call a class as a function");
  18. }
  19. }
  20. var _createClass = function () {
  21. function defineProperties(target, props) {
  22. for (var i = 0; i < props.length; i++) {
  23. var descriptor = props[i];
  24. descriptor.enumerable = descriptor.enumerable || false;
  25. descriptor.configurable = true;
  26. if ("value" in descriptor) descriptor.writable = true;
  27. Object.defineProperty(target, descriptor.key, descriptor);
  28. }
  29. }
  30. return function (Constructor, protoProps, staticProps) {
  31. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  32. if (staticProps) defineProperties(Constructor, staticProps);
  33. return Constructor;
  34. };
  35. }();
  36. function _possibleConstructorReturn(self, call) {
  37. if (!self) {
  38. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  39. }
  40. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  41. }
  42. var _get = function get(object, property, receiver) {
  43. if (object === null) object = Function.prototype;
  44. var desc = Object.getOwnPropertyDescriptor(object, property);
  45. if (desc === undefined) {
  46. var parent = Object.getPrototypeOf(object);
  47. if (parent === null) {
  48. return undefined;
  49. } else {
  50. return get(parent, property, receiver);
  51. }
  52. } else if ("value" in desc) {
  53. return desc.value;
  54. } else {
  55. var getter = desc.get;
  56. if (getter === undefined) {
  57. return undefined;
  58. }
  59. return getter.call(receiver);
  60. }
  61. };
  62. function _inherits(subClass, superClass) {
  63. if (typeof superClass !== "function" && superClass !== null) {
  64. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  65. }
  66. subClass.prototype = Object.create(superClass && superClass.prototype, {
  67. constructor: {
  68. value: subClass,
  69. enumerable: false,
  70. writable: true,
  71. configurable: true
  72. }
  73. });
  74. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  75. }
  76. /**
  77. * @author zhixin wen <wenzhixin2010@gmail.com>
  78. * https://github.com/wenzhixin/bootstrap-table/
  79. * theme: https://github.com/Semantic-Org/Semantic-UI
  80. */
  81. (function ($) {
  82. $.extend($.fn.bootstrapTable.defaults, {
  83. classes: 'ui selectable celled table',
  84. buttonsPrefix: '',
  85. buttonsClass: 'ui button'
  86. });
  87. $.BootstrapTable = function (_$$BootstrapTable) {
  88. _inherits(_class, _$$BootstrapTable);
  89. function _class() {
  90. _classCallCheck(this, _class);
  91. return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
  92. }
  93. _createClass(_class, [{
  94. key: 'initConstants',
  95. value: function initConstants() {
  96. _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initConstants', this).call(this);
  97. this.constants.theme = 'semantic';
  98. this.constants.classes.buttonsGroup = 'ui buttons';
  99. this.constants.classes.buttonsDropdown = 'ui button dropdown';
  100. this.constants.classes.inputGroup = 'ui input';
  101. this.constants.classes.paginationDropdown = 'ui dropdown';
  102. this.constants.html.toobarDropdow = ['<div class="menu">', '</div>'];
  103. this.constants.html.toobarDropdowItem = '<label class="item">%s</label>';
  104. this.constants.html.pageDropdown = ['<div class="menu">', '</div>'];
  105. this.constants.html.pageDropdownItem = '<a class="item %s" href="#">%s</a>';
  106. this.constants.html.dropdownCaret = '<i class="dropdown icon"></i>';
  107. this.constants.html.pagination = ['<div class="ui pagination menu%s">', '</div>'], this.constants.html.paginationItem = '<a class="page-item item%s" href="#">%s</a>';
  108. }
  109. }, {
  110. key: 'initToolbar',
  111. value: function initToolbar() {
  112. _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initToolbar', this).call(this);
  113. if (this.options.showColumns) {
  114. this.$toolbar.find('.button.dropdown').dropdown();
  115. }
  116. }
  117. }, {
  118. key: 'initPagination',
  119. value: function initPagination() {
  120. _get(_class.prototype.__proto__ || Object.getPrototypeOf(_class.prototype), 'initPagination', this).call(this);
  121. if (this.options.pagination && !this.options.onlyInfoPagination) {
  122. this.$pagination.find('.dropdown').dropdown();
  123. }
  124. }
  125. }]);
  126. return _class;
  127. }($.BootstrapTable);
  128. })(jQuery);
  129. });