<commit_before><script>
  module.exports = {
    name: 'el-tabs',

    props: {
      type: String,
      tabPosition: String,
      activeName: String,
      closable: false,
      tabWidth: 0
    },

    data() {
      return {
        children: null,
        activeTab: null,
        currentName: 0,
        panes: []
      };
    },

    watch: {
      activeName: {
        handler(val) {
          this.currentName = val;
        }
      }
    },

    methods: {
      handleTabRemove(tab, event) {
        event.stopPropagation();
        let tabs = this.$children;

        var index = tabs.indexOf(tab);
        tab.$destroy(true);

        if (tab.index === this.currentName) {
          let nextChild = tabs[index];
          let prevChild = tabs[index - 1];

          while (prevChild && prevChild.disabled) {
            prevChild = tabs[tabs.indexOf(prevChild) - 1];
          }

          this.currentName = nextChild
            ? nextChild.index
            : prevChild
            ? prevChild.index
            : '-1';
        }
        this.$emit('tab-remove', tab);
        this.$forceUpdate();
      },
      handleTabClick(tab, event) {
        if (tab.disabled) return;
        this.currentName = tab.index;
        this.$emit('tab-click', tab, event);
      },
      calcBarStyle() {
        if (this.type || !this.$refs.tabs) return {};
        var style = {};
        var offset = 0;
        var tabWidth = 0;

        this.$children.every((panel, index) => {
          let $el = this.$refs.tabs[index];
          if (!$el) { return false; }
          if (panel.index !== this.currentName) {
            offset += $el.clientWidth;
            return true;
          } else {
            tabWidth = $el.clientWidth;
            return false;
          }
        });

        style.width = tabWidth + 'px';
        style.transform = `translateX(${offset}px)`;

        return style;
      }
    },
    mounted() {
      this.currentName = this.activeName || this.$children[0].index || '1';
      this.$nextTick(() => {
        this.$forceUpdate();
      });
    },
    render(h) {
      let {
        type,
        panes, // eslint-disable-line
        handleTabRemove,
        handleTabClick,
        currentName
      } = this;

      const barStyle = this.calcBarStyle();
      const activeBar = !type
        ? <div class="el-tabs__active-bar" style={barStyle}></div>
        : null;
<commit_msg>Tabs: fix empty tab-pane issue, fixed #1608 (#1672)<commit_after><script>
  module.exports = {
    name: 'el-tabs',

    props: {
      type: String,
      tabPosition: String,
      activeName: String,
      closable: false,
      tabWidth: 0
    },

    data() {
      return {
        children: null,
        activeTab: null,
        currentName: 0,
        panes: []
      };
    },

    watch: {
      activeName: {
        handler(val) {
          this.currentName = val;
        }
      }
    },

    methods: {
      handleTabRemove(tab, event) {
        event.stopPropagation();
        let tabs = this.$children;

        var index = tabs.indexOf(tab);
        tab.$destroy(true);

        if (tab.index === this.currentName) {
          let nextChild = tabs[index];
          let prevChild = tabs[index - 1];

          while (prevChild && prevChild.disabled) {
            prevChild = tabs[tabs.indexOf(prevChild) - 1];
          }

          this.currentName = nextChild
            ? nextChild.index
            : prevChild
            ? prevChild.index
            : '-1';
        }
        this.$emit('tab-remove', tab);
        this.$forceUpdate();
      },
      handleTabClick(tab, event) {
        if (tab.disabled) return;
        this.currentName = tab.index;
        this.$emit('tab-click', tab, event);
      },
      calcBarStyle() {
        if (this.type || !this.$refs.tabs) return {};
        var style = {};
        var offset = 0;
        var tabWidth = 0;

        this.$children.every((panel, index) => {
          let $el = this.$refs.tabs[index];
          if (!$el) { return false; }
          if (panel.index !== this.currentName) {
            offset += $el.clientWidth;
            return true;
          } else {
            tabWidth = $el.clientWidth;
            return false;
          }
        });

        style.width = tabWidth + 'px';
        style.transform = `translateX(${offset}px)`;

        return style;
      }
    },
    mounted() {
      this.currentName = this.activeName || this.$children[0] && this.$children[0].index || '1';
      this.$nextTick(() => {
        this.$forceUpdate();
      });
    },
    render(h) {
      let {
        type,
        panes, // eslint-disable-line
        handleTabRemove,
        handleTabClick,
        currentName
      } = this;

      const barStyle = this.calcBarStyle();
      const activeBar = !type
        ? <div class="el-tabs__active-bar" style={barStyle}></div>
        : null;

{'fraction_non_alphanumeric': 0.1383173762477083, 'fraction_numerical': 0.005500101853738032, 'mean_word_length': 1.541407867494824, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '743443', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1430, 'n_words': 292}