{"size": 1496, "ext": "js", "max_stars_repo_path": "src/components/table/table-tr.js", "max_stars_repo_name": "sagenagata/heyui", "max_stars_repo_stars_event_min_datetime": "2019-04-25T00:50:18.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-24T09:42:35.000Z", "max_issues_repo_path": "src/components/table/table-tr.js", "max_issues_repo_name": "sagenagata/heyui", "max_issues_repo_issues_event_min_datetime": "2021-05-08T15:32:53.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-08T15:32:53.000Z", "max_forks_repo_path": "src/components/table/table-tr.js", "max_forks_repo_name": "sagenagata/heyui", "max_forks_repo_forks_event_min_datetime": "2019-09-22T02:02:30.000Z", "max_forks_repo_forks_event_max_datetime": "2019-09-22T02:02:30.000Z"}
{"max_stars_count": 16, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 26.2456140351, "max_line_length": 76, "alphanum_fraction": 0.5254010695}
import TableTd from './table-td';
import utils from '../../utils/utils';

export default {
  name: 'hTableTr',
  props: {
    datas: [Object, Array],
    index: Number
  },
  render(h) {
    let tds = [];
    if (this.$slots && this.$slots.default) {
      tds.push(...this.$slots.default);
    }
    if (this.$parent.$slots.default) {
      for (let td of this.$parent.$slots.default || []) {
        if (td.data) {
          let props = {};
          if (td.componentOptions.propsData) {
            Object.assign(props, td.componentOptions.propsData);
          }
          props.data = this.datas;
          props.index = this.index;
          let param = { props };
          if (td.data.scopedSlots) {
            param.scopedSlots = td.data.scopedSlots;
          }
          tds.push(h(TableTd, param));
        }
      }
    } else if (!this.$parent.$scopedSlots.default && this.$parent.columns) {
      for (let td of this.$parent.columns || []) {
        let param = utils.copy({ props: td });
        param.props.data = this.datas;
        param.props.index = this.index;
        tds.push(h(TableTd, param));
      }
    }
    return h(
      'tr', {
        on: {
          click: this.clickHandler,
          dblclick: this.dblclickHandler
        }
      }, tds
    );
  },
  methods: {
    clickHandler(event) {
      this.$emit('click', this.datas, this.index, event);
    },
    dblclickHandler(event) {
      this.$emit('dblclick', this.datas, this.index, event);
    }
  }
};
