<commit_before>/*
 * 列自适应
 * */
import utils from '../../src/utils/utils.js'

export  default {

    data(){
        return {
            resizeColumns: [], // 所有需要自适应的列集合
            initTotalColumnsWidth: 0, // 所有列初始化时的总宽度
            hasContainerWidth: false, // 容器是否有宽度（display：none 时没有）
            containerWidthCheckTimer:null
        }
    },

    methods: {
        // 获取所有自适应列的集合
        getResizeColumns(){

            var result = [];

            this.internalColumns.forEach(item => {

                if (item.isResize) {
                    result.push({width: item.width, field: item.field});
                }

            })

            this.resizeColumns = result;
        },

        // 初始化
        initResizeColumns(){

            this.initTotalColumnsWidth = this.totalColumnsWidth;
            this.getResizeColumns();
        },

        // 如果初始化时document上包含滚动条，渲染完document滚动条消失会造成表格宽度计算有误的问题
        containerWidthCheck(){

            this.containerWidthCheckTimer = setTimeout(x=>{

                let tableContainerWidth = this.$el.clientWidth;

                // 3为容错值
                if (tableContainerWidth - this.internalWidth > 3){

                    this.tableResize();
                }
            })
        },

        // 目前适用于有横向自适应功能的表格
        adjustHeight(hasScrollBar){

            if (!this.$el || this.isVerticalResize) {
                return false;
            }

            var totalColumnsHeight = this.getTotalColumnsHeight(),
                scrollbarWidth = this.scrollbarWidth;

            // 有footer 功能
            if (this.hasTableFooter) {

                if (hasScrollBar) {

                    if (this.footerTotalHeight === this.getFooterTotalRowHeight) {

                        this.footerTotalHeight += scrollbarWidth;

                        if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {
                            this.internalHeight += scrollbarWidth;
                        }
                    }
                } else if (!hasScrollBar) {

                    if (this.footerTotalHeight > this.getFooterTotalRowHeight) {

                        this.footerTotalHeight -= scrollbarWidth;

                        if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {

                            this.internalHeight -= scrollbarWidth;
                        }
                    }
                }
            }
            // 当没有设置高度时计算总高度 || 设置的高度大于所有列高度之和时
            else if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {

                if (hasScrollBar && this.internalHeight + 2 < totalColumnsHeight + scrollbarWidth) {

                    this.internalHeight += scrollbarWidth;

                } else if (!hasScrollBar) {

                    this.internalHeight = this.getTotalColumnsHeight();
                }
            }
        },

        // 随着窗口改变表格自适应
        tableResize(){

            if (!this.isHorizontalResize && !this.isVerticalResize) {
                return false;
            }

            var self = this,
                maxWidth = self.maxWidth,
                maxHeight = (self.height && self.height > 0) ? self.height : this.getTotalColumnsHeight(),
                minWidth = self.minWidth,
                minHeight = self.minHeight,
                view = this.$el,
                viewOffset = utils.getViewportOffset(view),
                currentWidth = view.getBoundingClientRect !== 'undefined' ? view.getBoundingClientRect().width : view.clientWidth,
                currentHeight = view.getBoundingClientRect !== 'undefined' ? view.getBoundingClientRect().height : view.clientHeight,
                right = window.document.documentElement.clientWidth - currentWidth - viewOffset.left,
                bottom = window.document.documentElement.clientHeight - currentHeight - viewOffset.top - 2; //


            if (self.isVerticalResize && currentHeight > 0) {
                // （窗口高度缩小 && 当前高度大于最小高度） || （窗口高度扩大 && 当前高度小于最大高度）
                bottom -= self.VerticalResizeOffset;
                if ((bottom < 0 && currentHeight > minHeight) || (bottom > 0 && currentHeight < maxHeight)) {
                    var currentHeight = currentHeight + bottom;// - self.VerticalResizeOffset;
                    currentHeight = currentHeight > maxHeight ? maxHeight : currentHeight;
                    currentHeight = currentHeight < minHeight ? minHeight : currentHeight;
                    self.internalHeight = currentHeight;
                }
            }
<commit_msg>变量名称修改<commit_after>/*
 * 列自适应
 * */
import utils from '../../src/utils/utils.js'

export  default {

    data(){
        return {
            resizeColumns: [], // 所有需要自适应的列集合
            initTotalColumnsWidth: 0, // 所有列初始化时的总宽度
            hasContainerWidth: false, // 容器是否有宽度（display：none 时没有）
            containerWidthCheckTimer:null
        }
    },

    methods: {
        // 获取所有自适应列的集合
        getResizeColumns(){

            var result = [];

            this.internalColumns.forEach(item => {

                if (item.isResize) {
                    result.push({width: item.width, field: item.field});
                }

            })

            this.resizeColumns = result;
        },

        // 初始化
        initResizeColumns(){

            this.initTotalColumnsWidth = this.totalColumnsWidth;
            this.getResizeColumns();
        },

        // 如果初始化时document上包含滚动条，渲染完document滚动条消失会造成表格宽度计算有误的问题
        containerWidthCheck(){

            this.containerWidthCheckTimer = setTimeout(x=>{

                let tableContainerWidth = this.$el.clientWidth;

                // 3为容错值
                if (tableContainerWidth - this.internalWidth > 3){

                    this.tableResize();
                }
            })
        },

        // 目前适用于有横向自适应功能的表格
        adjustHeight(hasScrollBar){

            if (!this.$el || this.isVerticalResize) {
                return false;
            }

            var totalColumnsHeight = this.getTotalColumnsHeight(),
                scrollbarWidth = this.scrollbarWidth;

            // 有footer 功能
            if (this.hasTableFooter) {

                if (hasScrollBar) {

                    if (this.footerTotalHeight === this.getFooterTotalRowHeight) {

                        this.footerTotalHeight += scrollbarWidth;

                        if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {
                            this.internalHeight += scrollbarWidth;
                        }
                    }
                } else if (!hasScrollBar) {

                    if (this.footerTotalHeight > this.getFooterTotalRowHeight) {

                        this.footerTotalHeight -= scrollbarWidth;

                        if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {

                            this.internalHeight -= scrollbarWidth;
                        }
                    }
                }
            }
            // 当没有设置高度时计算总高度 || 设置的高度大于所有列高度之和时
            else if (!(this.height && this.height > 0) || this.height > totalColumnsHeight) {

                if (hasScrollBar && this.internalHeight + 2 < totalColumnsHeight + scrollbarWidth) {

                    this.internalHeight += scrollbarWidth;

                } else if (!hasScrollBar) {

                    this.internalHeight = this.getTotalColumnsHeight();
                }
            }
        },

        // 随着窗口改变表格自适应
        tableResize(){

            if (!this.isHorizontalResize && !this.isVerticalResize) {
                return false;
            }

            var self = this,
                maxWidth = self.maxWidth,
                maxHeight = (self.height && self.height > 0) ? self.height : this.getTotalColumnsHeight(),
                minWidth = self.minWidth,
                minHeight = self.minHeight,
                view = this.$el,
                viewOffset = utils.getViewportOffset(view),
                currentWidth = view.getBoundingClientRect !== 'undefined' ? view.getBoundingClientRect().width : view.clientWidth,
                currentHeight = view.getBoundingClientRect !== 'undefined' ? view.getBoundingClientRect().height : view.clientHeight,
                right = window.document.documentElement.clientWidth - currentWidth - viewOffset.left,
                bottom = window.document.documentElement.clientHeight - currentHeight - viewOffset.top - 2; //


            if (self.isVerticalResize && currentHeight > 0) {
                // （窗口高度缩小 && 当前高度大于最小高度） || （窗口高度扩大 && 当前高度小于最大高度）
                bottom -= self.verticalResizeOffset;
                if ((bottom < 0 && currentHeight > minHeight) || (bottom > 0 && currentHeight < maxHeight)) {
                    var currentHeight = currentHeight + bottom;// - self.VerticalResizeOffset;
                    currentHeight = currentHeight > maxHeight ? maxHeight : currentHeight;
                    currentHeight = currentHeight < minHeight ? minHeight : currentHeight;
                    self.internalHeight = currentHeight;
                }
            }

{'fraction_non_alphanumeric': 0.09785332897461044, 'fraction_numerical': 0.002615233736515201, 'mean_word_length': 1.4572958500669344, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6876987', 'n_tokens_mistral': 2562, 'n_tokens_neox': 2485, 'n_words': 404}