function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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 ? 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 ? 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;