PromoCursed/node_modules/.cache/babel-loader/2cfd41a5fc829f879a47d45723805eeb7e4143f37139ea739f3c191b6d045842.json

1 line
40 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 React, { useCallback, useContext } from 'react';\nimport classNames from 'classnames';\nimport useMultipleSelect from '../_util/hooks/useMultipleSelect';\nimport { getMergedStatus, getStatusClassNames } from '../_util/statusUtils';\nimport { groupDisabledKeysMap, groupKeysMap } from '../_util/transKeys';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport DefaultRenderEmpty from '../config-provider/defaultRenderEmpty';\nimport { FormItemInputContext } from '../form/context';\nimport { useLocale } from '../locale';\nimport defaultLocale from '../locale/en_US';\nimport useData from './hooks/useData';\nimport useSelection from './hooks/useSelection';\nimport List from './list';\nimport Operation from './operation';\nimport Search from './search';\nimport useStyle from './style';\nconst Transfer = props => {\n const {\n dataSource,\n targetKeys = [],\n selectedKeys,\n selectAllLabels = [],\n operations = [],\n style = {},\n listStyle = {},\n locale = {},\n titles,\n disabled,\n showSearch = false,\n operationStyle,\n showSelectAll,\n oneWay,\n pagination,\n status: customStatus,\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n selectionsIcon,\n filterOption,\n render,\n footer,\n children,\n rowKey,\n onScroll,\n onChange,\n onSearch,\n onSelectChange\n } = props;\n const {\n getPrefixCls,\n renderEmpty,\n direction: dir,\n transfer\n } = useContext(ConfigContext);\n const prefixCls = getPrefixCls('transfer', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n // Fill record with `key`\n const [mergedDataSource, leftDataSource, rightDataSource] = useData(dataSource, rowKey, targetKeys);\n // Get direction selected keys\n const [\n // Keys\n sourceSelectedKeys, targetSelectedKeys,\n // Setters\n setSourceSelectedKeys, setTargetSelectedKeys] = useSelection(leftDataSource, rightDataSource, selectedKeys);\n const [leftMultipleSelect, updateLeftPrevSelectedIndex] = useMultipleSelect(item => item.key);\n const [rightMultipleSelect, updateRightPrevSelectedIndex] = useMultipleSelect(item => item.key);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Transfer');\n process.env.NODE_ENV !== \"production\" ? warning(!pagination || !children, 'usage', '`pagination` not support customize render list.') : void 0;\n }\n const setStateKeys = useCallback((direction, keys) => {\n if (direction === 'left') {\n const nextKeys = typeof keys === 'function' ? keys(sourceSelectedKeys || []) : keys;\n setSourceSelectedKeys(nextKeys);\n } else {\n const nextKeys = typeof keys === 'function' ? keys(targetSelectedKeys || []) : keys;\n setTargetSelectedKeys(nextKeys);\n }\n }, [sourceSelectedKeys, targetSelectedKeys]);\n const setPrevSelectedIndex = (direction, value) => {\n const isLeftDirection = direction === 'left';\n const updatePrevSelectedIndex = isLeftDirection ? updateLeftPrevSelectedIndex : updateRightPrevSelectedIndex;\n updatePrevSelectedIndex(value);\n };\n const handleSelectChange = useCallback((direction, holder) => {\n if (direction === 'left') {\n onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(holder, targetSelectedKeys);\n } else {\n onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(sourceSelectedKeys, holder);\n }\n }, [sourceSelectedKeys, targetSelectedKeys]);\n const getTitles = transferLocale => {\n var _a;\n return (_a = titles !== null && titles !== void 0 ? titles : transferLocale.titles) !== null && _a !== void 0 ? _a : [];\n };\n const handleLeftScroll = e => {\n onScroll === null || onScroll === void 0 ? void 0 : onScroll('left', e);\n };\n const handleRightScroll = e => {\n onScroll === null || onScrol