PromoCursed/node_modules/.cache/babel-loader/bced2be299f6a7ad663f0f56bc8058cfe6a33f7a678ea530b8ce887ca2e5f362.json

1 line
48 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport FilterFilled from \"@ant-design/icons/es/icons/FilterFilled\";\nimport classNames from 'classnames';\nimport isEqual from \"rc-util/es/isEqual\";\nimport useSyncState from '../../../_util/hooks/useSyncState';\nimport { devUseWarning } from '../../../_util/warning';\nimport Button from '../../../button';\nimport Checkbox from '../../../checkbox';\nimport { ConfigContext } from '../../../config-provider/context';\nimport Dropdown from '../../../dropdown';\nimport Empty from '../../../empty';\nimport Menu from '../../../menu';\nimport { OverrideProvider } from '../../../menu/OverrideContext';\nimport Radio from '../../../radio';\nimport Tree from '../../../tree';\nimport FilterSearch from './FilterSearch';\nimport FilterDropdownMenuWrapper from './FilterWrapper';\nexport function flattenKeys(filters) {\n let keys = [];\n (filters || []).forEach(_ref => {\n let {\n value,\n children\n } = _ref;\n keys.push(value);\n if (children) {\n keys = [].concat(_toConsumableArray(keys), _toConsumableArray(flattenKeys(children)));\n }\n });\n return keys;\n}\nfunction hasSubMenu(filters) {\n return filters.some(_ref2 => {\n let {\n children\n } = _ref2;\n return children;\n });\n}\nfunction searchValueMatched(searchValue, text) {\n if (typeof text === 'string' || typeof text === 'number') {\n return text === null || text === void 0 ? void 0 : text.toString().toLowerCase().includes(searchValue.trim().toLowerCase());\n }\n return false;\n}\nfunction renderFilterItems(_ref3) {\n let {\n filters,\n prefixCls,\n filteredKeys,\n filterMultiple,\n searchValue,\n filterSearch\n } = _ref3;\n return filters.map((filter, index) => {\n const key = String(filter.value);\n if (filter.children) {\n return {\n key: key || index,\n label: filter.text,\n popupClassName: `${prefixCls}-dropdown-submenu`,\n children: renderFilterItems({\n filters: filter.children,\n prefixCls,\n filteredKeys,\n filterMultiple,\n searchValue,\n filterSearch\n })\n };\n }\n const Component = filterMultiple ? Checkbox : Radio;\n const item = {\n key: filter.value !== undefined ? key : index,\n label: ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Component, {\n checked: filteredKeys.includes(key)\n }), /*#__PURE__*/React.createElement(\"span\", null, filter.text)))\n };\n if (searchValue.trim()) {\n if (typeof filterSearch === 'function') {\n return filterSearch(searchValue, filter) ? item : null;\n }\n return searchValueMatched(searchValue, filter.text) ? item : null;\n }\n return item;\n });\n}\nfunction wrapStringListType(keys) {\n return keys || [];\n}\nconst FilterDropdown = props => {\n var _a, _b;\n const {\n tablePrefixCls,\n prefixCls,\n column,\n dropdownPrefixCls,\n columnKey,\n filterOnClose,\n filterMultiple,\n filterMode = 'menu',\n filterSearch = false,\n filterState,\n triggerFilter,\n locale,\n children,\n getPopupContainer,\n rootClassName\n } = props;\n const {\n filterDropdownOpen,\n onFilterDropdownOpenChange,\n filterResetToDefaultFilteredValue,\n defaultFilteredValue,\n // Deprecated\n filterDropdownVisible,\n onFilterDropdownVisibleChange\n } = column;\n const [visible, setVisible] = React.useState(false);\n const filtered = !!(filterState && (((_a = filterState.filteredKeys) === null || _a === void 0 ? void 0 : _a.length) || filterState.forceFiltered));\n const triggerVisible = newVisible => {\n setVisible(newVisible);\n onFilterDropdownOpenChange === null || onFilterDropdownOpenChange === void 0 ? void 0 : onFilterDropdownOpenChange(newVisible);\n onFilterDropdownVisibleChange === null || onFilterDropdownVisibleChange === vo