Blame view

public/assets/libs/bootstrap-table/dist/extensions/resizable/bootstrap-table-resizable.js 2.14 KB
2db47680   hexiaodong   chore: 初始提交 php 遗...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  /**
   * @author: Dennis Hernández
   * @webSite: http://djhvscf.github.io/Blog
   * @version: v1.0.0
   */
  
  (function ($) {
      'use strict';
  
      var initResizable = function (that) {
          //Deletes the plugin to re-create it
          that.$el.colResizable({disable: true});
  
          //Creates the plugin
          that.$el.colResizable({
              liveDrag: that.options.liveDrag,
              fixed: that.options.fixed,
              headerOnly: that.options.headerOnly,
              minWidth: that.options.minWidth,
              hoverCursor: that.options.hoverCursor,
              dragCursor: that.options.dragCursor,
              onResize: that.onResize,
              onDrag: that.options.onResizableDrag
          });
      };
  
      $.extend($.fn.bootstrapTable.defaults, {
          resizable: false,
          liveDrag: false,
          fixed: true,
          headerOnly: false,
          minWidth: 15,
          hoverCursor: 'e-resize',
          dragCursor: 'e-resize',
          onResizableResize: function (e) {
              return false;
          },
          onResizableDrag: function (e) {
              return false;
          }
      });
  
      var BootstrapTable = $.fn.bootstrapTable.Constructor,
          _toggleView = BootstrapTable.prototype.toggleView,
          _resetView = BootstrapTable.prototype.resetView;
  
      BootstrapTable.prototype.toggleView = function () {
          _toggleView.apply(this, Array.prototype.slice.apply(arguments));
  
          if (this.options.resizable && this.options.cardView) {
              //Deletes the plugin
              $(this.$el).colResizable({disable: true});
          }
      };
  
      BootstrapTable.prototype.resetView = function () {
          var that = this;
  
          _resetView.apply(this, Array.prototype.slice.apply(arguments));
  
          if (this.options.resizable) {
              // because in fitHeader function, we use setTimeout(func, 100);
              setTimeout(function () {
                  initResizable(that);
              }, 100);
          }
      };
  
      BootstrapTable.prototype.onResize = function (e) {
          var that = $(e.currentTarget);
          that.bootstrapTable('resetView');
          that.data('bootstrap.table').options.onResizableResize.apply(e);
      }
  })(jQuery);