Blame view

src/components/table/mixin.js 1.53 KB
0d136465   梁灏   update Table
1
2
3
  export default {
      methods: {
          alignCls (column) {
5d0499ce   梁灏   update Table
4
5
6
7
8
              return [
                  {
                      [`${this.prefixCls}-column-${column.align}`]: column.align,
                      [`${this.prefixCls}-hidden`]: (this.fixed === 'left' && column.fixed !== 'left') || (this.fixed === 'right' && column.fixed !== 'right') || (!this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right'))
                  }
b0893113   jingsam   :art: add eslint
9
              ];
5d0499ce   梁灏   update Table
10
11
12
          },
          isPopperShow (column) {
              return column.filters && ((!this.fixed && !column.fixed) || (this.fixed === 'left' && column.fixed === 'left') || (this.fixed === 'right' && column.fixed === 'right'));
5e7a3b29   梁灏   publish 0.9.9-rc-2
13
          },
3d6fa54b   梁灏   update Table
14
          setCellWidth (column, index, top) {
224a3ae5   梁灏   publish 0.9.9-rc-3
15
16
17
18
              let width = '';
              if (column.width) {
                  width = column.width;
              } else if (this.columnsWidth[column._index]) {
b0893113   jingsam   :art: add eslint
19
                  width = this.columnsWidth[column._index].width;
224a3ae5   梁灏   publish 0.9.9-rc-3
20
              }
3d6fa54b   梁灏   update Table
21
              // when browser has scrollBar,set a width to resolve scroll position bug
a404bbae   梁灏   update Table #167
22
              if (this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0) {
3d6fa54b   梁灏   update Table
23
24
25
26
27
28
29
                  width += this.$parent.scrollBarWidth;
              }
              // when fixed type,reset first right fixed column's width
              if (this.fixed === 'right') {
                  const firstFixedIndex = this.columns.findIndex((col) => col.fixed === 'right');
                  if (firstFixedIndex === index) width += this.$parent.scrollBarWidth;
              }
224a3ae5   梁灏   publish 0.9.9-rc-3
30
              return width;
0d136465   梁灏   update Table
31
32
          }
      }
b0893113   jingsam   :art: add eslint
33
  };