searchBuilder.bootstrap4.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. (function (factory) {
  2. if (typeof define === 'function' && define.amd) {
  3. // AMD
  4. define(['jquery', 'datatables.net-bs4', 'datatables.net-searchbuilder'], function ($) {
  5. return factory($);
  6. });
  7. }
  8. else if (typeof exports === 'object') {
  9. // CommonJS
  10. module.exports = function (root, $) {
  11. if (!root) {
  12. root = window;
  13. }
  14. if (!$ || !$.fn.dataTable) {
  15. // eslint-disable-next-line @typescript-eslint/no-var-requires
  16. $ = require('datatables.net-bs4')(root, $).$;
  17. }
  18. if (!$.fn.dataTable.searchBuilder) {
  19. // eslint-disable-next-line @typescript-eslint/no-var-requires
  20. require('datatables.net-searchbuilder')(root, $);
  21. }
  22. return factory($);
  23. };
  24. }
  25. else {
  26. // Browser
  27. factory(jQuery);
  28. }
  29. }(function ($) {
  30. 'use strict';
  31. var dataTable = $.fn.dataTable;
  32. $.extend(true, dataTable.SearchBuilder.classes, {
  33. clearAll: 'btn btn-light dtsb-clearAll'
  34. });
  35. $.extend(true, dataTable.Group.classes, {
  36. add: 'btn btn-light dtsb-add',
  37. clearGroup: 'btn btn-light dtsb-clearGroup',
  38. logic: 'btn btn-light dtsb-logic'
  39. });
  40. $.extend(true, dataTable.Criteria.classes, {
  41. condition: 'form-control dtsb-condition',
  42. data: 'form-control dtsb-data',
  43. "delete": 'btn btn-light dtsb-delete',
  44. left: 'btn btn-light dtsb-left',
  45. right: 'btn btn-light dtsb-right',
  46. value: 'form-control dtsb-value'
  47. });
  48. return dataTable.searchPanes;
  49. }));