"use strict";

exports.__esModule = true;
exports.default = void 0;
var _dayjs = _interopRequireDefault(require("dayjs"));
var _monthPicker = _interopRequireDefault(require("./month-picker"));
var _utils = require("../../utils");
var _utils2 = require("../utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var EmbedDatePicker = /*#__PURE__*/function (_MonthPicker) {
  _inheritsLoose(EmbedDatePicker, _MonthPicker);
  function EmbedDatePicker() {
    return _MonthPicker.apply(this, arguments) || this;
  }
  var _proto = EmbedDatePicker.prototype;
  _proto.getStep = function getStep() {
    return 'day';
  };
  _proto.getDisableType = function getDisableType() {
    return 'day';
  };
  _proto.getRangeCheck = function getRangeCheck() {
    return {
      date: {
        hasYear: true,
        hasMonth: true,
        hasDay: true
      }
    };
  };
  _proto.getDataSource = function getDataSource(locale) {
    var result = _MonthPicker.prototype.getDataSource.call(this, locale);
    var dayLocale = (0, _utils.get)(locale, 'locale.DatePicker.day', '日');
    var month = this.value.getMonth();
    var year = this.value.getFullYear();
    var days = (0, _dayjs.default)(year + "-" + (month + 1) + "-01").daysInMonth();
    result.push(this.filterDataSource((0, _utils2.rangeOptions)(1, days, dayLocale), function (d, it) {
      (0, _utils2.resetTime)(d);
      d.setFullYear(year);
      d.setMonth(month, it.value);
    }, 'day'));
    return result;
  };
  _proto.toDate = function toDate(values) {
    var d = _MonthPicker.prototype.toDate.call(this, values);
    d.setDate(values[2]);
    return d;
  };
  _proto.toValues = function toValues(d) {
    var values = _MonthPicker.prototype.toValues.call(this, d);
    values.push(d.getDate());
    return values;
  };
  return EmbedDatePicker;
}(_monthPicker.default);
exports.default = EmbedDatePicker;