function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
import React from "react";
import { Button, InputNumber, Space } from "antd";
// import { FilterFunnel01, FilterFunnel01Fill } from "@pisell/icon/es";
import FilterFunnel01 from "@pisell/icon/es/FilterFunnel01";
import FilterFunnel01Fill from "@pisell/icon/es/FilterFunnel01Fill";
import { getText } from "../../../locales";
import "./index.less";
var getColumnNumberProps = function getColumnNumberProps(_ref) {
  var dataIndex = _ref.dataIndex;
  return {
    filterDropdown: function filterDropdown(_ref2) {
      var _selectedKeys$, _selectedKeys$2;
      var setSelectedKeys = _ref2.setSelectedKeys,
        selectedKeys = _ref2.selectedKeys,
        confirm = _ref2.confirm,
        clearFilters = _ref2.clearFilters,
        close = _ref2.close;
      return /*#__PURE__*/React.createElement("div", {
        onKeyDown: function onKeyDown(e) {
          return e.stopPropagation();
        },
        className: "pisell-table-filter-dropdown"
      }, /*#__PURE__*/React.createElement(Space, {
        split: "-",
        className: "pisell-table-filter-dropdown-top"
      }, /*#__PURE__*/React.createElement(InputNumber, {
        value: selectedKeys === null || selectedKeys === void 0 || (_selectedKeys$ = selectedKeys[0]) === null || _selectedKeys$ === void 0 ? void 0 : _selectedKeys$.min,
        onChange: function onChange(value) {
          var newVal = _objectSpread(_objectSpread({}, (selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys[0]) || {}), {}, {
            min: value
          });
          setSelectedKeys([newVal]);
        },
        placeholder: getText("table-filter-min"),
        onPressEnter: function onPressEnter() {
          return confirm();
        },
        style: {
          width: 105
        }
      }), /*#__PURE__*/React.createElement(InputNumber, {
        value: selectedKeys === null || selectedKeys === void 0 || (_selectedKeys$2 = selectedKeys[0]) === null || _selectedKeys$2 === void 0 ? void 0 : _selectedKeys$2.max,
        placeholder: getText("table-filter-max"),
        onChange: function onChange(value) {
          var newVal = _objectSpread(_objectSpread({}, (selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys[0]) || {}), {}, {
            max: value
          });
          setSelectedKeys([newVal]);
        },
        onPressEnter: function onPressEnter() {
          return confirm();
        },
        style: {
          width: 105
        }
      })), /*#__PURE__*/React.createElement(Space, {
        className: "pisell-table-filter-dropdown-bottom",
        styles: {
          item: {
            flex: 1
          }
        }
      }, /*#__PURE__*/React.createElement(Button, {
        onClick: function onClick() {
          clearFilters && clearFilters();
          confirm();
        },
        block: true
      }, getText("table-filter-clear")), /*#__PURE__*/React.createElement(Button, {
        type: "primary",
        onClick: function onClick() {
          return confirm();
        },
        block: true
      }, getText("table-filter-filter"))));
    },
    filterIcon: function filterIcon(filtered) {
      return filtered ? /*#__PURE__*/React.createElement(FilterFunnel01Fill, {
        style: {
          color: "#7f56d9",
          fontSize: 14
        }
      }) : /*#__PURE__*/React.createElement(FilterFunnel01, {
        style: {
          color: "#98A2B3",
          fontSize: 14
        }
      });
    }
  };
};
export default getColumnNumberProps;