// 内库使用-start
import LocaleUtil from "./../../../../utils/LocaleUtil";
import DateUtil from "./../../../../utils/DateUtil";
// 内库使用-end

/* 测试使用-start
import { LocaleUtil, DateUtil } from 'seedsui-react'
测试使用-end */

// 数据
function getList(value, type, _ref) {
  var hourStep = _ref.hourStep,
    minuteStep = _ref.minuteStep;
  if (!hourStep || typeof hourStep !== 'number') {
    // eslint-disable-next-line
    hourStep = 1;
  }
  if (!minuteStep || typeof minuteStep !== 'number') {
    // eslint-disable-next-line
    minuteStep = 1;
  }

  // Year
  var years = [];
  for (var item = new Date().getFullYear() - 120; item <= new Date().getFullYear() + 120; item++) {
    years.push({
      id: item,
      name: LocaleUtil.locale("".concat(item, "\u5E74"), 'datepicker_unit_year', [String(item)])
    });
  }

  // Month
  var months = [];
  for (var _item = 1; _item <= 12; _item++) {
    months.push({
      id: _item,
      name: LocaleUtil.locale("".concat(_item, "\u6708"), 'datepicker_unit_month', [String(_item)])
    });
  }

  // Date
  var dates = [];
  for (var _item2 = 1; _item2 <= DateUtil.getDaysInMonth(value); _item2++) {
    dates.push({
      id: _item2,
      name: LocaleUtil.locale("".concat(_item2, "\u65E5"), 'datepicker_unit_date', [String(_item2)])
    });
  }

  // Hour
  var hours = [];
  for (var _item3 = 0; _item3 <= 23; _item3 += hourStep) {
    hours.push({
      id: _item3,
      name: LocaleUtil.locale("".concat(_item3, "\u65F6"), 'datepicker_unit_hour', [String(_item3)])
    });
  }

  // Minute
  var minutes = [];
  for (var _item4 = 0; _item4 <= 59; _item4 += minuteStep) {
    minutes.push({
      id: _item4,
      name: LocaleUtil.locale("".concat(_item4, "\u5206"), 'datepicker_unit_minute', [String(_item4)])
    });
  }

  // Quarter
  var quarters = [];
  for (var _item5 = 1; _item5 <= 4; _item5++) {
    quarters.push({
      id: _item5,
      name: 'Q' + _item5
    });
  }
  if (type === 'year') {
    return [years];
  }
  if (type === 'quarter') {
    return [years, quarters];
  }
  if (type === 'month') {
    return [years, months];
  }
  if (type === 'date') {
    return [years, months, dates];
  }
  if (type === 'datetime') {
    return [years, months, dates, hours, minutes];
  }
  if (type === 'time') {
    return [hours, minutes];
  }
  return null;
}
export default getList;