var __assign = this && this.__assign || function () {
  __assign = Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];

      for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
    }

    return t;
  };

  return __assign.apply(this, arguments);
};

import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import find from 'lodash/find';
import { Dropmenu } from "../../dropdown";
import { FastTypeKeys } from "./constant";
import { prefixCls } from "../DateFilter";

var FastTypes = function FastTypes(_a) {
  var value = _a.value,
      locale = _a.locale,
      getPopupContainer = _a.getPopupContainer,
      labelFastType = _a.labelFastType,
      onClickMenuItem = _a.onClickMenuItem;
  var fastLocale = locale.fastTypeLocale;
  var fastTypeOpts = [{
    title: fastLocale.unlimited,
    key: FastTypeKeys.unlimited,
    divider: true
  }, {
    title: fastLocale.untilNow,
    key: FastTypeKeys.untilNow
  }, {
    title: fastLocale.today,
    key: FastTypeKeys.today
  }, {
    title: fastLocale.yesterday,
    key: FastTypeKeys.yesterday
  }, {
    title: fastLocale.last24Hours,
    key: FastTypeKeys.last24Hours
  }, {
    title: fastLocale.lastWeek,
    key: FastTypeKeys.lastWeek
  }, {
    title: fastLocale.lastMonth,
    key: FastTypeKeys.lastMonth
  }, {
    title: fastLocale.lastQuarter,
    key: FastTypeKeys.lastQuarter
  }, {
    title: fastLocale.lastYear,
    key: FastTypeKeys.lastYear
  }, {
    title: fastLocale.thisWeek,
    key: FastTypeKeys.thisWeek
  }, {
    title: fastLocale.thisMonth,
    key: FastTypeKeys.thisMonth
  }, {
    title: fastLocale.thisYear,
    key: FastTypeKeys.thisYear
  }, {
    title: fastLocale.tomorrow,
    key: FastTypeKeys.tomorrow
  }, {
    title: fastLocale.future24Hours,
    key: FastTypeKeys.future24Hours
  }, {
    title: fastLocale.nextWeek,
    key: FastTypeKeys.nextWeek,
    divider: true
  }, {
    title: fastLocale.customer,
    key: FastTypeKeys.customer
  }];
  var item = find(fastTypeOpts, function (t) {
    return t.key === value;
  }) || fastTypeOpts[0];
  return _jsxs("div", __assign({
    className: prefixCls + "-fast"
  }, {
    children: [_jsxs("div", __assign({
      className: prefixCls + "-fast-label"
    }, {
      children: [labelFastType, "\uFF1A"]
    }), void 0), _jsx(Dropmenu, __assign({
      dropNoBorder: true,
      values: [item.key],
      menus: fastTypeOpts,
      type: 'menu-bg',
      className: prefixCls + "-dropmenu",
      getPopupContainer: getPopupContainer,
      onClickMenuItem: onClickMenuItem
    }, {
      children: item.title
    }), void 0)]
  }), void 0);
};

FastTypes.displayName = 'FastTypes';
export default FastTypes;
var FastTypesMemo = /*#__PURE__*/React.memo(FastTypes);
FastTypesMemo.displayName = 'FastTypesMemo';
export { FastTypesMemo };

