Blame view

src/components/table/mixin.js 1.9 KB
0d136465   梁灏   update Table
1
2
  export default {
      methods: {
891700ae   梁灏   update Table
3
          alignCls (column, row = {}) {
c211f717   梁灏   Table data suppor...
4
5
6
7
              let cellClassName = '';
              if (row.cellClassName && column.key && row.cellClassName[column.key]) {
                  cellClassName = row.cellClassName[column.key];
              }
5d0499ce   梁灏   update Table
8
9
              return [
                  {
c211f717   梁灏   Table data suppor...
10
                      [`${cellClassName}`]: cellClassName,    // cell className
891700ae   梁灏   update Table
11
                      [`${column.className}`]: column.className,    // column className
5d0499ce   梁灏   update Table
12
13
14
                      [`${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
15
              ];
5d0499ce   梁灏   update Table
16
17
18
          },
          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
19
          },
3d6fa54b   梁灏   update Table
20
          setCellWidth (column, index, top) {
224a3ae5   梁灏   publish 0.9.9-rc-3
21
22
23
24
              let width = '';
              if (column.width) {
                  width = column.width;
              } else if (this.columnsWidth[column._index]) {
b0893113   jingsam   :art: add eslint
25
                  width = this.columnsWidth[column._index].width;
224a3ae5   梁灏   publish 0.9.9-rc-3
26
              }
3d6fa54b   梁灏   update Table
27
              // when browser has scrollBar,set a width to resolve scroll position bug
a404bbae   梁灏   update Table #167
28
              if (this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0) {
3d6fa54b   梁灏   update Table
29
30
31
32
33
34
35
                  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
36
              return width;
0d136465   梁灏   update Table
37
38
          }
      }
b0893113   jingsam   :art: add eslint
39
  };