{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport { useCallback, useMemo } from 'react';\nimport DownOutlined from \"@ant-design/icons/es/icons/DownOutlined\";\nimport classNames from 'classnames';\nimport { INTERNAL_COL_DEFINE } from 'rc-table';\nimport { arrAdd, arrDel } from \"rc-tree/es/util\";\nimport { conductCheck } from \"rc-tree/es/utils/conductUtil\";\nimport { convertDataToEntities } from \"rc-tree/es/utils/treeUtil\";\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport useMultipleSelect from '../../_util/hooks/useMultipleSelect';\nimport { devUseWarning } from '../../_util/warning';\nimport Checkbox from '../../checkbox';\nimport Dropdown from '../../dropdown';\nimport Radio from '../../radio';\n// TODO: warning if use ajax!!!\nexport const SELECTION_COLUMN = {};\nexport const SELECTION_ALL = 'SELECT_ALL';\nexport const SELECTION_INVERT = 'SELECT_INVERT';\nexport const SELECTION_NONE = 'SELECT_NONE';\nconst EMPTY_LIST = [];\nconst flattenData = (childrenColumnName, data) => {\n let list = [];\n (data || []).forEach(record => {\n list.push(record);\n if (record && typeof record === 'object' && childrenColumnName in record) {\n list = [].concat(_toConsumableArray(list), _toConsumableArray(flattenData(childrenColumnName, record[childrenColumnName])));\n }\n });\n return list;\n};\nconst useSelection = (config, rowSelection) => {\n const {\n preserveSelectedRowKeys,\n selectedRowKeys,\n defaultSelectedRowKeys,\n getCheckboxProps,\n onChange: onSelectionChange,\n onSelect,\n onSelectAll,\n onSelectInvert,\n onSelectNone,\n onSelectMultiple,\n columnWidth: selectionColWidth,\n type: selectionType,\n selections,\n fixed,\n renderCell: customizeRenderCell,\n hideSelectAll,\n checkStrictly = true\n } = rowSelection || {};\n const {\n prefixCls,\n data,\n pageData,\n getRecordByKey,\n getRowKey,\n expandType,\n childrenColumnName,\n locale: tableLocale,\n getPopupContainer\n } = config;\n const warning = devUseWarning('Table');\n // ========================= MultipleSelect =========================\n const [multipleSelect, updatePrevSelectedIndex] = useMultipleSelect(item => item);\n // ========================= Keys =========================\n const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState(selectedRowKeys || defaultSelectedRowKeys || EMPTY_LIST, {\n value: selectedRowKeys\n });\n // ======================== Caches ========================\n const preserveRecordsRef = React.useRef(new Map());\n const updatePreserveRecordsCache = useCallback(keys => {\n if (preserveSelectedRowKeys) {\n const newCache = new Map();\n // Keep key if mark as preserveSelectedRowKeys\n keys.forEach(key => {\n let record = getRecordByKey(key);\n if (!record && preserveRecordsRef.current.has(key)) {\n record = preserveRecordsRef.current.get(key);\n }\n newCache.set(key, record);\n });\n // Refresh to new cache\n preserveRecordsRef.current = newCache;\n }\n }, [getRecordByKey, preserveSelectedRowKeys]);\n // Update cache with selectedKeys\n React.useEffect(() => {\n updatePreserveRecordsCache(mergedSelectedKeys);\n }, [mergedSelectedKeys]);\n const {\n keyEntities\n } = useMemo(() => {\n if (checkStrictly) {\n return {\n keyEntities: null\n };\n }\n let convertData = data;\n if (preserveSelectedRowKeys) {\n const keysSet = new Set(data.map((record, index) => getRowKey(record, index)));\n // remove preserveRecords that duplicate data\n const preserveRecords = Array.from(preserveRecordsRef.current).reduce((total, _ref) => {\n let [key, value] = _ref;\n return keysSet.has(key) ? total : total.concat(value);\n }, []);\n convertData = [].concat(_toConsumableArray(convertData), _toConsumableArray(preserveRecords));\n }\n return convertDataToEntities(convertData, {\n externalGetKey: getRowKey,\n childrenPropName: childrenColumnName\n });\n }, [data, getRowKey, checkStrictly, childrenColumnName, preserveSelectedRowKeys]);\n // Get flatten data\n const flattedData = useMemo(() => flattenData(childrenColumnName, pageData), [childrenColumnName, pageData]);\n // Get all checkbox props\n const checkboxPropsMap = useMemo(() => {\n const map = new Map();\n flattedData.forEach((record, index) => {\n const key = getRowKey(record, index);\n const checkboxProps = (getCheckboxProps ? getCheckboxProps(record) : null) || {};\n map.set(key, checkboxProps);\n process.env.NODE_ENV !== \"production\" ? warning(!('checked' in checkboxProps || 'defaultChecked' in checkboxProps), 'usage', 'Do not set `checked` or `defaultChecked` in `getCheckboxProps`. Please use `selectedRowKeys` instead.') : void 0;\n });\n return map;\n }, [flattedData, getRowKey, getCheckboxProps]);\n const isCheckboxDisabled = useCallback(r => {\n var _a;\n return !!((_a = checkboxPropsMap.get(getRowKey(r))) === null || _a === void 0 ? void 0 : _a.disabled);\n }, [checkboxPropsMap, getRowKey]);\n const [derivedSelectedKeys, derivedHalfSelectedKeys] = useMemo(() => {\n if (checkStrictly) {\n return [mergedSelectedKeys || [], []];\n }\n const {\n checkedKeys,\n halfCheckedKeys\n } = conductCheck(mergedSelectedKeys, true, keyEntities, isCheckboxDisabled);\n return [checkedKeys || [], halfCheckedKeys];\n }, [mergedSelectedKeys, checkStrictly, keyEntities, isCheckboxDisabled]);\n const derivedSelectedKeySet = useMemo(() => {\n const keys = selectionType === 'radio' ? derivedSelectedKeys.slice(0, 1) : derivedSelectedKeys;\n return new Set(keys);\n }, [derivedSelectedKeys, selectionType]);\n const derivedHalfSelectedKeySet = useMemo(() => selectionType === 'radio' ? new Set() : new Set(derivedHalfSelectedKeys), [derivedHalfSelectedKeys, selectionType]);\n // Reset if rowSelection reset\n React.useEffect(() => {\n if (!rowSelection) {\n setMergedSelectedKeys(EMPTY_LIST);\n }\n }, [!!rowSelection]);\n const setSelectedKeys = useCallback((keys, method) => {\n let availableKeys;\n let records;\n updatePreserveRecordsCache(keys);\n if (preserveSelectedRowKeys) {\n availableKeys = keys;\n records = keys.map(key => preserveRecordsRef.current.get(key));\n } else {\n // Filter key which not exist in the `dataSource`\n availableKeys = [];\n records = [];\n keys.forEach(key => {\n const record = getRecordByKey(key);\n if (record !== undefined) {\n availableKeys.push(key);\n records.push(record);\n }\n });\n }\n setMergedSelectedKeys(availableKeys);\n onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(availableKeys, records, {\n type: method\n });\n }, [setMergedSelectedKeys, getRecordByKey, onSelectionChange, preserveSelectedRowKeys]);\n // ====================== Selections ======================\n // Trigger single `onSelect` event\n const triggerSingleSelection = useCallback((key, selected, keys, event) => {\n if (onSelect) {\n const rows = keys.map(k => getRecordByKey(k));\n onSelect(getRecordByKey(key), selected, rows, event);\n }\n setSelectedKeys(keys, 'single');\n }, [onSelect, getRecordByKey, setSelectedKeys]);\n const mergedSelections = useMemo(() => {\n if (!selections || hideSelectAll) {\n return null;\n }\n const selectionList = selections === true ? [SELECTION_ALL, SELECTION_INVERT, SELECTION_NONE] : selections;\n return selectionList.map(selection => {\n if (selection === SELECTION_ALL) {\n return {\n key: 'all',\n text: tableLocale.selectionAll,\n onSelect() {\n setSelectedKeys(data.map((record, index) => getRowKey(record, index)).filter(key => {\n const checkProps = checkboxPropsMap.get(key);\n return !(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled) || derivedSelectedKeySet.has(key);\n }), 'all');\n }\n };\n }\n if (selection === SELECTION_INVERT) {\n return {\n key: 'invert',\n text: tableLocale.selectInvert,\n onSelect() {\n const keySet = new Set(derivedSelectedKeySet);\n pageData.forEach((record, index) => {\n const key = getRowKey(record, index);\n const checkProps = checkboxPropsMap.get(key);\n if (!(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled)) {\n if (keySet.has(key)) {\n keySet.delete(key);\n } else {\n keySet.add(key);\n }\n }\n });\n const keys = Array.from(keySet);\n if (onSelectInvert) {\n warning.deprecated(false, 'onSelectInvert', 'onChange');\n onSelectInvert(keys);\n }\n setSelectedKeys(keys, 'invert');\n }\n };\n }\n if (selection === SELECTION_NONE) {\n return {\n key: 'none',\n text: tableLocale.selectNone,\n onSelect() {\n onSelectNone === null || onSelectNone === void 0 ? void 0 : onSelectNone();\n setSelectedKeys(Array.from(derivedSelectedKeySet).filter(key => {\n const checkProps = checkboxPropsMap.get(key);\n return checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled;\n }), 'none');\n }\n };\n }\n return selection;\n }).map(selection => Object.assign(Object.assign({}, selection), {\n onSelect: function () {\n var _a2;\n var _a;\n for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {\n rest[_key] = arguments[_key];\n }\n (_a = selection.onSelect) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [selection].concat(rest));\n updatePrevSelectedIndex(null);\n }\n }));\n }, [selections, derivedSelectedKeySet, pageData, getRowKey, onSelectInvert, setSelectedKeys]);\n // ======================= Columns ========================\n const transformColumns = useCallback(columns => {\n var _a;\n // >>>>>>>>>>> Skip if not exists `rowSelection`\n if (!rowSelection) {\n process.env.NODE_ENV !== \"production\" ? warning(!columns.includes(SELECTION_COLUMN), 'usage', '`rowSelection` is not config but `SELECTION_COLUMN` exists in the `columns`.') : void 0;\n return columns.filter(col => col !== SELECTION_COLUMN);\n }\n // >>>>>>>>>>> Support selection\n let cloneColumns = _toConsumableArray(columns);\n const keySet = new Set(derivedSelectedKeySet);\n // Record key only need check with enabled\n const recordKeys = flattedData.map(getRowKey).filter(key => !checkboxPropsMap.get(key).disabled);\n const checkedCurrentAll = recordKeys.every(key => keySet.has(key));\n const checkedCurrentSome = recordKeys.some(key => keySet.has(key));\n const onSelectAllChange = () => {\n const changeKeys = [];\n if (checkedCurrentAll) {\n recordKeys.forEach(key => {\n keySet.delete(key);\n changeKeys.push(key);\n });\n } else {\n recordKeys.forEach(key => {\n if (!keySet.has(key)) {\n keySet.add(key);\n changeKeys.push(key);\n }\n });\n }\n const keys = Array.from(keySet);\n onSelectAll === null || onSelectAll === void 0 ? void 0 : onSelectAll(!checkedCurrentAll, keys.map(k => getRecordByKey(k)), changeKeys.map(k => getRecordByKey(k)));\n setSelectedKeys(keys, 'all');\n updatePrevSelectedIndex(null);\n };\n // ===================== Render =====================\n // Title Cell\n let title;\n let columnTitleCheckbox;\n if (selectionType !== 'radio') {\n let customizeSelections;\n if (mergedSelections) {\n const menu = {\n getPopupContainer,\n items: mergedSelections.map((selection, index) => {\n const {\n key,\n text,\n onSelect: onSelectionClick\n } = selection;\n return {\n key: key !== null && key !== void 0 ? key : index,\n onClick: () => {\n onSelectionClick === null || onSelectionClick === void 0 ? void 0 : onSelectionClick(recordKeys);\n },\n label: text\n };\n })\n };\n customizeSelections = /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-selection-extra`\n }, /*#__PURE__*/React.createElement(Dropdown, {\n menu: menu,\n getPopupContainer: getPopupContainer\n }, /*#__PURE__*/React.createElement(\"span\", null, /*#__PURE__*/React.createElement(DownOutlined, null))));\n }\n const allDisabledData = flattedData.map((record, index) => {\n const key = getRowKey(record, index);\n const checkboxProps = checkboxPropsMap.get(key) || {};\n return Object.assign({\n checked: keySet.has(key)\n }, checkboxProps);\n }).filter(_ref2 => {\n let {\n disabled\n } = _ref2;\n return disabled;\n });\n const allDisabled = !!allDisabledData.length && allDisabledData.length === flattedData.length;\n const allDisabledAndChecked = allDisabled && allDisabledData.every(_ref3 => {\n let {\n checked\n } = _ref3;\n return checked;\n });\n const allDisabledSomeChecked = allDisabled && allDisabledData.some(_ref4 => {\n let {\n checked\n } = _ref4;\n return checked;\n });\n columnTitleCheckbox = /*#__PURE__*/React.createElement(Checkbox, {\n checked: !allDisabled ? !!flattedData.length && checkedCurrentAll : allDisabledAndChecked,\n indeterminate: !allDisabled ? !checkedCurrentAll && checkedCurrentSome : !allDisabledAndChecked && allDisabledSomeChecked,\n onChange: onSelectAllChange,\n disabled: flattedData.length === 0 || allDisabled,\n \"aria-label\": customizeSelections ? 'Custom selection' : 'Select all',\n skipGroup: true\n });\n title = !hideSelectAll && ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-selection`\n }, columnTitleCheckbox, customizeSelections));\n }\n // Body Cell\n let renderCell;\n if (selectionType === 'radio') {\n renderCell = (_, record, index) => {\n const key = getRowKey(record, index);\n const checked = keySet.has(key);\n return {\n node: ( /*#__PURE__*/React.createElement(Radio, Object.assign({}, checkboxPropsMap.get(key), {\n checked: checked,\n onClick: e => e.stopPropagation(),\n onChange: event => {\n if (!keySet.has(key)) {\n triggerSingleSelection(key, true, [key], event.nativeEvent);\n }\n }\n }))),\n checked\n };\n };\n } else {\n renderCell = (_, record, index) => {\n var _a;\n const key = getRowKey(record, index);\n const checked = keySet.has(key);\n const indeterminate = derivedHalfSelectedKeySet.has(key);\n const checkboxProps = checkboxPropsMap.get(key);\n let mergedIndeterminate;\n if (expandType === 'nest') {\n mergedIndeterminate = indeterminate;\n process.env.NODE_ENV !== \"production\" ? warning(typeof (checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.indeterminate) !== 'boolean', 'usage', 'set `indeterminate` using `rowSelection.getCheckboxProps` is not allowed with tree structured dataSource.') : void 0;\n } else {\n mergedIndeterminate = (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.indeterminate) !== null && _a !== void 0 ? _a : indeterminate;\n }\n // Record checked\n return {\n node: ( /*#__PURE__*/React.createElement(Checkbox, Object.assign({}, checkboxProps, {\n indeterminate: mergedIndeterminate,\n checked: checked,\n skipGroup: true,\n onClick: e => e.stopPropagation(),\n onChange: _ref5 => {\n let {\n nativeEvent\n } = _ref5;\n const {\n shiftKey\n } = nativeEvent;\n const currentSelectedIndex = recordKeys.findIndex(item => item === key);\n const isMultiple = derivedSelectedKeys.some(item => recordKeys.includes(item));\n if (shiftKey && checkStrictly && isMultiple) {\n const changedKeys = multipleSelect(currentSelectedIndex, recordKeys, keySet);\n const keys = Array.from(keySet);\n onSelectMultiple === null || onSelectMultiple === void 0 ? void 0 : onSelectMultiple(!checked, keys.map(recordKey => getRecordByKey(recordKey)), changedKeys.map(recordKey => getRecordByKey(recordKey)));\n setSelectedKeys(keys, 'multiple');\n } else {\n // Single record selected\n const originCheckedKeys = derivedSelectedKeys;\n if (checkStrictly) {\n const checkedKeys = checked ? arrDel(originCheckedKeys, key) : arrAdd(originCheckedKeys, key);\n triggerSingleSelection(key, !checked, checkedKeys, nativeEvent);\n } else {\n // Always fill first\n const result = conductCheck([].concat(_toConsumableArray(originCheckedKeys), [key]), true, keyEntities, isCheckboxDisabled);\n const {\n checkedKeys,\n halfCheckedKeys\n } = result;\n let nextCheckedKeys = checkedKeys;\n // If remove, we do it again to correction\n if (checked) {\n const tempKeySet = new Set(checkedKeys);\n tempKeySet.delete(key);\n nextCheckedKeys = conductCheck(Array.from(tempKeySet), {\n checked: false,\n halfCheckedKeys\n }, keyEntities, isCheckboxDisabled).checkedKeys;\n }\n triggerSingleSelection(key, !checked, nextCheckedKeys, nativeEvent);\n }\n }\n if (checked) {\n updatePrevSelectedIndex(null);\n } else {\n updatePrevSelectedIndex(currentSelectedIndex);\n }\n }\n }))),\n checked\n };\n };\n }\n const renderSelectionCell = (_, record, index) => {\n const {\n node,\n checked\n } = renderCell(_, record, index);\n if (customizeRenderCell) {\n return customizeRenderCell(checked, record, index, node);\n }\n return node;\n };\n // Insert selection column if not exist\n if (!cloneColumns.includes(SELECTION_COLUMN)) {\n // Always after expand icon\n if (cloneColumns.findIndex(col => {\n var _a;\n return ((_a = col[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === 'EXPAND_COLUMN';\n }) === 0) {\n const [expandColumn, ...restColumns] = cloneColumns;\n cloneColumns = [expandColumn, SELECTION_COLUMN].concat(_toConsumableArray(restColumns));\n } else {\n // Normal insert at first column\n cloneColumns = [SELECTION_COLUMN].concat(_toConsumableArray(cloneColumns));\n }\n }\n // Deduplicate selection column\n const selectionColumnIndex = cloneColumns.indexOf(SELECTION_COLUMN);\n process.env.NODE_ENV !== \"production\" ? warning(cloneColumns.filter(col => col === SELECTION_COLUMN).length <= 1, 'usage', 'Multiple `SELECTION_COLUMN` exist in `columns`.') : void 0;\n cloneColumns = cloneColumns.filter((column, index) => column !== SELECTION_COLUMN || index === selectionColumnIndex);\n // Fixed column logic\n const prevCol = cloneColumns[selectionColumnIndex - 1];\n const nextCol = cloneColumns[selectionColumnIndex + 1];\n let mergedFixed = fixed;\n if (mergedFixed === undefined) {\n if ((nextCol === null || nextCol === void 0 ? void 0 : nextCol.fixed) !== undefined) {\n mergedFixed = nextCol.fixed;\n } else if ((prevCol === null || prevCol === void 0 ? void 0 : prevCol.fixed) !== undefined) {\n mergedFixed = prevCol.fixed;\n }\n }\n if (mergedFixed && prevCol && ((_a = prevCol[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === 'EXPAND_COLUMN' && prevCol.fixed === undefined) {\n prevCol.fixed = mergedFixed;\n }\n const columnCls = classNames(`${prefixCls}-selection-col`, {\n [`${prefixCls}-selection-col-with-dropdown`]: selections && selectionType === 'checkbox'\n });\n const renderColumnTitle = () => {\n if (!(rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.columnTitle)) {\n return title;\n }\n if (typeof rowSelection.columnTitle === 'function') {\n return rowSelection.columnTitle(columnTitleCheckbox);\n }\n return rowSelection.columnTitle;\n };\n // Replace with real selection column\n const selectionColumn = {\n fixed: mergedFixed,\n width: selectionColWidth,\n className: `${prefixCls}-selection-column`,\n title: renderColumnTitle(),\n render: renderSelectionCell,\n onCell: rowSelection.onCell,\n [INTERNAL_COL_DEFINE]: {\n className: columnCls\n }\n };\n return cloneColumns.map(col => col === SELECTION_COLUMN ? selectionColumn : col);\n }, [getRowKey, flattedData, rowSelection, derivedSelectedKeys, derivedSelectedKeySet, derivedHalfSelectedKeySet, selectionColWidth, mergedSelections, expandType, checkboxPropsMap, onSelectMultiple, triggerSingleSelection, isCheckboxDisabled]);\n return [transformColumns, derivedSelectedKeySet];\n};\nexport default useSelection;","map":{"version":3,"names":["_toConsumableArray","React","useCallback","useMemo","DownOutlined","classNames","INTERNAL_COL_DEFINE","arrAdd","arrDel","conductCheck","convertDataToEntities","useMergedState","useMultipleSelect","devUseWarning","Checkbox","Dropdown","Radio","SELECTION_COLUMN","SELECTION_ALL","SELECTION_INVERT","SELECTION_NONE","EMPTY_LIST","flattenData","childrenColumnName","data","list","forEach","record","push","concat","useSelection","config","rowSelection","preserveSelectedRowKeys","selectedRowKeys","defaultSelectedRowKeys","getCheckboxProps","onChange","onSelectionChange","onSelect","onSelectAll","onSelectInvert","onSelectNone","onSelectMultiple","columnWidth","selectionColWidth","type","selectionType","selections","fixed","renderCell","customizeRenderCell","hideSelectAll","checkStrictly","prefixCls","pageData","getRecordByKey","getRowKey","expandType","locale","tableLocale","getPopupContainer","warning","multipleSelect","updatePrevSelectedIndex","item","mergedSelectedKeys","setMergedSelectedKeys","value","preserveRecordsRef","useRef","Map","updatePreserveRecordsCache","keys","newCache","key","current","has","get","set","useEffect","keyEntities","convertData","keysSet","Set","map","index","preserveRecords","Array","from","reduce","total","_ref","externalGetKey","childrenPropName","flattedData","checkboxPropsMap","checkboxProps","process","env","NODE_ENV","isCheckboxDisabled","r","_a","disabled","derivedSelectedKeys","derivedHalfSelectedKeys","checkedKeys","halfCheckedKeys","derivedSelectedKeySet","slice","derivedHalfSelectedKeySet","setSelectedKeys","method","availableKeys","records","undefined","triggerSingleSelection","selected","event","rows","k","mergedSelections","selectionList","selection","text","selectionAll","filter","checkProps","selectInvert","keySet","delete","add","deprecated","selectNone","Object","assign","_a2","_len","arguments","length","rest","_key","call","apply","transformColumns","columns","includes","col","cloneColumns","recordKeys","checkedCurrentAll","every","checkedCurrentSome","some","onSelectAllChange","changeKeys","title","columnTitleCheckbox","customizeSelections","menu","items","onSelectionClick","onClick","label","createElement","className","allDisabledData","checked","_ref2","allDisabled","allDisabledAndChecked","_ref3","allDisabledSomeChecked","_ref4","indeterminate","skipGroup","_","node","e","stopPropagation","nativeEvent","mergedIndeterminate","_ref5","shiftKey","currentSelectedIndex","findIndex","isMultiple","changedKeys","recordKey","originCheckedKeys","result","nextCheckedKeys","tempKeySet","renderSelectionCell","columnType","expandColumn","restColumns","selectionColumnIndex","indexOf","column","prevCol","nextCol","mergedFixed","columnCls","renderColumnTitle","columnTitle","selectionColumn","width","render","onCell"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/table/hooks/useSelection.js"],"sourcesContent":["\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport * as React from 'react';\nimport { useCallback, useMemo } from 'react';\nimport DownOutlined from \"@ant-design/icons/es/icons/DownOutlined\";\nimport classNames from 'classnames';\nimport { INTERNAL_COL_DEFINE } from 'rc-table';\nimport { arrAdd, arrDel } from \"rc-tree/es/util\";\nimport { conductCheck } from \"rc-tree/es/utils/conductUtil\";\nimport { convertDataToEntities } from \"rc-tree/es/utils/treeUtil\";\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport useMultipleSelect from '../../_util/hooks/useMultipleSelect';\nimport { devUseWarning } from '../../_util/warning';\nimport Checkbox from '../../checkbox';\nimport Dropdown from '../../dropdown';\nimport Radio from '../../radio';\n// TODO: warning if use ajax!!!\nexport const SELECTION_COLUMN = {};\nexport const SELECTION_ALL = 'SELECT_ALL';\nexport const SELECTION_INVERT = 'SELECT_INVERT';\nexport const SELECTION_NONE = 'SELECT_NONE';\nconst EMPTY_LIST = [];\nconst flattenData = (childrenColumnName, data) => {\n let list = [];\n (data || []).forEach(record => {\n list.push(record);\n if (record && typeof record === 'object' && childrenColumnName in record) {\n list = [].concat(_toConsumableArray(list), _toConsumableArray(flattenData(childrenColumnName, record[childrenColumnName])));\n }\n });\n return list;\n};\nconst useSelection = (config, rowSelection) => {\n const {\n preserveSelectedRowKeys,\n selectedRowKeys,\n defaultSelectedRowKeys,\n getCheckboxProps,\n onChange: onSelectionChange,\n onSelect,\n onSelectAll,\n onSelectInvert,\n onSelectNone,\n onSelectMultiple,\n columnWidth: selectionColWidth,\n type: selectionType,\n selections,\n fixed,\n renderCell: customizeRenderCell,\n hideSelectAll,\n checkStrictly = true\n } = rowSelection || {};\n const {\n prefixCls,\n data,\n pageData,\n getRecordByKey,\n getRowKey,\n expandType,\n childrenColumnName,\n locale: tableLocale,\n getPopupContainer\n } = config;\n const warning = devUseWarning('Table');\n // ========================= MultipleSelect =========================\n const [multipleSelect, updatePrevSelectedIndex] = useMultipleSelect(item => item);\n // ========================= Keys =========================\n const [mergedSelectedKeys, setMergedSelectedKeys] = useMergedState(selectedRowKeys || defaultSelectedRowKeys || EMPTY_LIST, {\n value: selectedRowKeys\n });\n // ======================== Caches ========================\n const preserveRecordsRef = React.useRef(new Map());\n const updatePreserveRecordsCache = useCallback(keys => {\n if (preserveSelectedRowKeys) {\n const newCache = new Map();\n // Keep key if mark as preserveSelectedRowKeys\n keys.forEach(key => {\n let record = getRecordByKey(key);\n if (!record && preserveRecordsRef.current.has(key)) {\n record = preserveRecordsRef.current.get(key);\n }\n newCache.set(key, record);\n });\n // Refresh to new cache\n preserveRecordsRef.current = newCache;\n }\n }, [getRecordByKey, preserveSelectedRowKeys]);\n // Update cache with selectedKeys\n React.useEffect(() => {\n updatePreserveRecordsCache(mergedSelectedKeys);\n }, [mergedSelectedKeys]);\n const {\n keyEntities\n } = useMemo(() => {\n if (checkStrictly) {\n return {\n keyEntities: null\n };\n }\n let convertData = data;\n if (preserveSelectedRowKeys) {\n const keysSet = new Set(data.map((record, index) => getRowKey(record, index)));\n // remove preserveRecords that duplicate data\n const preserveRecords = Array.from(preserveRecordsRef.current).reduce((total, _ref) => {\n let [key, value] = _ref;\n return keysSet.has(key) ? total : total.concat(value);\n }, []);\n convertData = [].concat(_toConsumableArray(convertData), _toConsumableArray(preserveRecords));\n }\n return convertDataToEntities(convertData, {\n externalGetKey: getRowKey,\n childrenPropName: childrenColumnName\n });\n }, [data, getRowKey, checkStrictly, childrenColumnName, preserveSelectedRowKeys]);\n // Get flatten data\n const flattedData = useMemo(() => flattenData(childrenColumnName, pageData), [childrenColumnName, pageData]);\n // Get all checkbox props\n const checkboxPropsMap = useMemo(() => {\n const map = new Map();\n flattedData.forEach((record, index) => {\n const key = getRowKey(record, index);\n const checkboxProps = (getCheckboxProps ? getCheckboxProps(record) : null) || {};\n map.set(key, checkboxProps);\n process.env.NODE_ENV !== \"production\" ? warning(!('checked' in checkboxProps || 'defaultChecked' in checkboxProps), 'usage', 'Do not set `checked` or `defaultChecked` in `getCheckboxProps`. Please use `selectedRowKeys` instead.') : void 0;\n });\n return map;\n }, [flattedData, getRowKey, getCheckboxProps]);\n const isCheckboxDisabled = useCallback(r => {\n var _a;\n return !!((_a = checkboxPropsMap.get(getRowKey(r))) === null || _a === void 0 ? void 0 : _a.disabled);\n }, [checkboxPropsMap, getRowKey]);\n const [derivedSelectedKeys, derivedHalfSelectedKeys] = useMemo(() => {\n if (checkStrictly) {\n return [mergedSelectedKeys || [], []];\n }\n const {\n checkedKeys,\n halfCheckedKeys\n } = conductCheck(mergedSelectedKeys, true, keyEntities, isCheckboxDisabled);\n return [checkedKeys || [], halfCheckedKeys];\n }, [mergedSelectedKeys, checkStrictly, keyEntities, isCheckboxDisabled]);\n const derivedSelectedKeySet = useMemo(() => {\n const keys = selectionType === 'radio' ? derivedSelectedKeys.slice(0, 1) : derivedSelectedKeys;\n return new Set(keys);\n }, [derivedSelectedKeys, selectionType]);\n const derivedHalfSelectedKeySet = useMemo(() => selectionType === 'radio' ? new Set() : new Set(derivedHalfSelectedKeys), [derivedHalfSelectedKeys, selectionType]);\n // Reset if rowSelection reset\n React.useEffect(() => {\n if (!rowSelection) {\n setMergedSelectedKeys(EMPTY_LIST);\n }\n }, [!!rowSelection]);\n const setSelectedKeys = useCallback((keys, method) => {\n let availableKeys;\n let records;\n updatePreserveRecordsCache(keys);\n if (preserveSelectedRowKeys) {\n availableKeys = keys;\n records = keys.map(key => preserveRecordsRef.current.get(key));\n } else {\n // Filter key which not exist in the `dataSource`\n availableKeys = [];\n records = [];\n keys.forEach(key => {\n const record = getRecordByKey(key);\n if (record !== undefined) {\n availableKeys.push(key);\n records.push(record);\n }\n });\n }\n setMergedSelectedKeys(availableKeys);\n onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(availableKeys, records, {\n type: method\n });\n }, [setMergedSelectedKeys, getRecordByKey, onSelectionChange, preserveSelectedRowKeys]);\n // ====================== Selections ======================\n // Trigger single `onSelect` event\n const triggerSingleSelection = useCallback((key, selected, keys, event) => {\n if (onSelect) {\n const rows = keys.map(k => getRecordByKey(k));\n onSelect(getRecordByKey(key), selected, rows, event);\n }\n setSelectedKeys(keys, 'single');\n }, [onSelect, getRecordByKey, setSelectedKeys]);\n const mergedSelections = useMemo(() => {\n if (!selections || hideSelectAll) {\n return null;\n }\n const selectionList = selections === true ? [SELECTION_ALL, SELECTION_INVERT, SELECTION_NONE] : selections;\n return selectionList.map(selection => {\n if (selection === SELECTION_ALL) {\n return {\n key: 'all',\n text: tableLocale.selectionAll,\n onSelect() {\n setSelectedKeys(data.map((record, index) => getRowKey(record, index)).filter(key => {\n const checkProps = checkboxPropsMap.get(key);\n return !(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled) || derivedSelectedKeySet.has(key);\n }), 'all');\n }\n };\n }\n if (selection === SELECTION_INVERT) {\n return {\n key: 'invert',\n text: tableLocale.selectInvert,\n onSelect() {\n const keySet = new Set(derivedSelectedKeySet);\n pageData.forEach((record, index) => {\n const key = getRowKey(record, index);\n const checkProps = checkboxPropsMap.get(key);\n if (!(checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled)) {\n if (keySet.has(key)) {\n keySet.delete(key);\n } else {\n keySet.add(key);\n }\n }\n });\n const keys = Array.from(keySet);\n if (onSelectInvert) {\n warning.deprecated(false, 'onSelectInvert', 'onChange');\n onSelectInvert(keys);\n }\n setSelectedKeys(keys, 'invert');\n }\n };\n }\n if (selection === SELECTION_NONE) {\n return {\n key: 'none',\n text: tableLocale.selectNone,\n onSelect() {\n onSelectNone === null || onSelectNone === void 0 ? void 0 : onSelectNone();\n setSelectedKeys(Array.from(derivedSelectedKeySet).filter(key => {\n const checkProps = checkboxPropsMap.get(key);\n return checkProps === null || checkProps === void 0 ? void 0 : checkProps.disabled;\n }), 'none');\n }\n };\n }\n return selection;\n }).map(selection => Object.assign(Object.assign({}, selection), {\n onSelect: function () {\n var _a2;\n var _a;\n for (var _len = arguments.length, rest = new Array(_len), _key = 0; _key < _len; _key++) {\n rest[_key] = arguments[_key];\n }\n (_a = selection.onSelect) === null || _a === void 0 ? void 0 : (_a2 = _a).call.apply(_a2, [selection].concat(rest));\n updatePrevSelectedIndex(null);\n }\n }));\n }, [selections, derivedSelectedKeySet, pageData, getRowKey, onSelectInvert, setSelectedKeys]);\n // ======================= Columns ========================\n const transformColumns = useCallback(columns => {\n var _a;\n // >>>>>>>>>>> Skip if not exists `rowSelection`\n if (!rowSelection) {\n process.env.NODE_ENV !== \"production\" ? warning(!columns.includes(SELECTION_COLUMN), 'usage', '`rowSelection` is not config but `SELECTION_COLUMN` exists in the `columns`.') : void 0;\n return columns.filter(col => col !== SELECTION_COLUMN);\n }\n // >>>>>>>>>>> Support selection\n let cloneColumns = _toConsumableArray(columns);\n const keySet = new Set(derivedSelectedKeySet);\n // Record key only need check with enabled\n const recordKeys = flattedData.map(getRowKey).filter(key => !checkboxPropsMap.get(key).disabled);\n const checkedCurrentAll = recordKeys.every(key => keySet.has(key));\n const checkedCurrentSome = recordKeys.some(key => keySet.has(key));\n const onSelectAllChange = () => {\n const changeKeys = [];\n if (checkedCurrentAll) {\n recordKeys.forEach(key => {\n keySet.delete(key);\n changeKeys.push(key);\n });\n } else {\n recordKeys.forEach(key => {\n if (!keySet.has(key)) {\n keySet.add(key);\n changeKeys.push(key);\n }\n });\n }\n const keys = Array.from(keySet);\n onSelectAll === null || onSelectAll === void 0 ? void 0 : onSelectAll(!checkedCurrentAll, keys.map(k => getRecordByKey(k)), changeKeys.map(k => getRecordByKey(k)));\n setSelectedKeys(keys, 'all');\n updatePrevSelectedIndex(null);\n };\n // ===================== Render =====================\n // Title Cell\n let title;\n let columnTitleCheckbox;\n if (selectionType !== 'radio') {\n let customizeSelections;\n if (mergedSelections) {\n const menu = {\n getPopupContainer,\n items: mergedSelections.map((selection, index) => {\n const {\n key,\n text,\n onSelect: onSelectionClick\n } = selection;\n return {\n key: key !== null && key !== void 0 ? key : index,\n onClick: () => {\n onSelectionClick === null || onSelectionClick === void 0 ? void 0 : onSelectionClick(recordKeys);\n },\n label: text\n };\n })\n };\n customizeSelections = /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-selection-extra`\n }, /*#__PURE__*/React.createElement(Dropdown, {\n menu: menu,\n getPopupContainer: getPopupContainer\n }, /*#__PURE__*/React.createElement(\"span\", null, /*#__PURE__*/React.createElement(DownOutlined, null))));\n }\n const allDisabledData = flattedData.map((record, index) => {\n const key = getRowKey(record, index);\n const checkboxProps = checkboxPropsMap.get(key) || {};\n return Object.assign({\n checked: keySet.has(key)\n }, checkboxProps);\n }).filter(_ref2 => {\n let {\n disabled\n } = _ref2;\n return disabled;\n });\n const allDisabled = !!allDisabledData.length && allDisabledData.length === flattedData.length;\n const allDisabledAndChecked = allDisabled && allDisabledData.every(_ref3 => {\n let {\n checked\n } = _ref3;\n return checked;\n });\n const allDisabledSomeChecked = allDisabled && allDisabledData.some(_ref4 => {\n let {\n checked\n } = _ref4;\n return checked;\n });\n columnTitleCheckbox = /*#__PURE__*/React.createElement(Checkbox, {\n checked: !allDisabled ? !!flattedData.length && checkedCurrentAll : allDisabledAndChecked,\n indeterminate: !allDisabled ? !checkedCurrentAll && checkedCurrentSome : !allDisabledAndChecked && allDisabledSomeChecked,\n onChange: onSelectAllChange,\n disabled: flattedData.length === 0 || allDisabled,\n \"aria-label\": customizeSelections ? 'Custom selection' : 'Select all',\n skipGroup: true\n });\n title = !hideSelectAll && ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-selection`\n }, columnTitleCheckbox, customizeSelections));\n }\n // Body Cell\n let renderCell;\n if (selectionType === 'radio') {\n renderCell = (_, record, index) => {\n const key = getRowKey(record, index);\n const checked = keySet.has(key);\n return {\n node: ( /*#__PURE__*/React.createElement(Radio, Object.assign({}, checkboxPropsMap.get(key), {\n checked: checked,\n onClick: e => e.stopPropagation(),\n onChange: event => {\n if (!keySet.has(key)) {\n triggerSingleSelection(key, true, [key], event.nativeEvent);\n }\n }\n }))),\n checked\n };\n };\n } else {\n renderCell = (_, record, index) => {\n var _a;\n const key = getRowKey(record, index);\n const checked = keySet.has(key);\n const indeterminate = derivedHalfSelectedKeySet.has(key);\n const checkboxProps = checkboxPropsMap.get(key);\n let mergedIndeterminate;\n if (expandType === 'nest') {\n mergedIndeterminate = indeterminate;\n process.env.NODE_ENV !== \"production\" ? warning(typeof (checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.indeterminate) !== 'boolean', 'usage', 'set `indeterminate` using `rowSelection.getCheckboxProps` is not allowed with tree structured dataSource.') : void 0;\n } else {\n mergedIndeterminate = (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.indeterminate) !== null && _a !== void 0 ? _a : indeterminate;\n }\n // Record checked\n return {\n node: ( /*#__PURE__*/React.createElement(Checkbox, Object.assign({}, checkboxProps, {\n indeterminate: mergedIndeterminate,\n checked: checked,\n skipGroup: true,\n onClick: e => e.stopPropagation(),\n onChange: _ref5 => {\n let {\n nativeEvent\n } = _ref5;\n const {\n shiftKey\n } = nativeEvent;\n const currentSelectedIndex = recordKeys.findIndex(item => item === key);\n const isMultiple = derivedSelectedKeys.some(item => recordKeys.includes(item));\n if (shiftKey && checkStrictly && isMultiple) {\n const changedKeys = multipleSelect(currentSelectedIndex, recordKeys, keySet);\n const keys = Array.from(keySet);\n onSelectMultiple === null || onSelectMultiple === void 0 ? void 0 : onSelectMultiple(!checked, keys.map(recordKey => getRecordByKey(recordKey)), changedKeys.map(recordKey => getRecordByKey(recordKey)));\n setSelectedKeys(keys, 'multiple');\n } else {\n // Single record selected\n const originCheckedKeys = derivedSelectedKeys;\n if (checkStrictly) {\n const checkedKeys = checked ? arrDel(originCheckedKeys, key) : arrAdd(originCheckedKeys, key);\n triggerSingleSelection(key, !checked, checkedKeys, nativeEvent);\n } else {\n // Always fill first\n const result = conductCheck([].concat(_toConsumableArray(originCheckedKeys), [key]), true, keyEntities, isCheckboxDisabled);\n const {\n checkedKeys,\n halfCheckedKeys\n } = result;\n let nextCheckedKeys = checkedKeys;\n // If remove, we do it again to correction\n if (checked) {\n const tempKeySet = new Set(checkedKeys);\n tempKeySet.delete(key);\n nextCheckedKeys = conductCheck(Array.from(tempKeySet), {\n checked: false,\n halfCheckedKeys\n }, keyEntities, isCheckboxDisabled).checkedKeys;\n }\n triggerSingleSelection(key, !checked, nextCheckedKeys, nativeEvent);\n }\n }\n if (checked) {\n updatePrevSelectedIndex(null);\n } else {\n updatePrevSelectedIndex(currentSelectedIndex);\n }\n }\n }))),\n checked\n };\n };\n }\n const renderSelectionCell = (_, record, index) => {\n const {\n node,\n checked\n } = renderCell(_, record, index);\n if (customizeRenderCell) {\n return customizeRenderCell(checked, record, index, node);\n }\n return node;\n };\n // Insert selection column if not exist\n if (!cloneColumns.includes(SELECTION_COLUMN)) {\n // Always after expand icon\n if (cloneColumns.findIndex(col => {\n var _a;\n return ((_a = col[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === 'EXPAND_COLUMN';\n }) === 0) {\n const [expandColumn, ...restColumns] = cloneColumns;\n cloneColumns = [expandColumn, SELECTION_COLUMN].concat(_toConsumableArray(restColumns));\n } else {\n // Normal insert at first column\n cloneColumns = [SELECTION_COLUMN].concat(_toConsumableArray(cloneColumns));\n }\n }\n // Deduplicate selection column\n const selectionColumnIndex = cloneColumns.indexOf(SELECTION_COLUMN);\n process.env.NODE_ENV !== \"production\" ? warning(cloneColumns.filter(col => col === SELECTION_COLUMN).length <= 1, 'usage', 'Multiple `SELECTION_COLUMN` exist in `columns`.') : void 0;\n cloneColumns = cloneColumns.filter((column, index) => column !== SELECTION_COLUMN || index === selectionColumnIndex);\n // Fixed column logic\n const prevCol = cloneColumns[selectionColumnIndex - 1];\n const nextCol = cloneColumns[selectionColumnIndex + 1];\n let mergedFixed = fixed;\n if (mergedFixed === undefined) {\n if ((nextCol === null || nextCol === void 0 ? void 0 : nextCol.fixed) !== undefined) {\n mergedFixed = nextCol.fixed;\n } else if ((prevCol === null || prevCol === void 0 ? void 0 : prevCol.fixed) !== undefined) {\n mergedFixed = prevCol.fixed;\n }\n }\n if (mergedFixed && prevCol && ((_a = prevCol[INTERNAL_COL_DEFINE]) === null || _a === void 0 ? void 0 : _a.columnType) === 'EXPAND_COLUMN' && prevCol.fixed === undefined) {\n prevCol.fixed = mergedFixed;\n }\n const columnCls = classNames(`${prefixCls}-selection-col`, {\n [`${prefixCls}-selection-col-with-dropdown`]: selections && selectionType === 'checkbox'\n });\n const renderColumnTitle = () => {\n if (!(rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.columnTitle)) {\n return title;\n }\n if (typeof rowSelection.columnTitle === 'function') {\n return rowSelection.columnTitle(columnTitleCheckbox);\n }\n return rowSelection.columnTitle;\n };\n // Replace with real selection column\n const selectionColumn = {\n fixed: mergedFixed,\n width: selectionColWidth,\n className: `${prefixCls}-selection-column`,\n title: renderColumnTitle(),\n render: renderSelectionCell,\n onCell: rowSelection.onCell,\n [INTERNAL_COL_DEFINE]: {\n className: columnCls\n }\n };\n return cloneColumns.map(col => col === SELECTION_COLUMN ? selectionColumn : col);\n }, [getRowKey, flattedData, rowSelection, derivedSelectedKeys, derivedSelectedKeySet, derivedHalfSelectedKeySet, selectionColWidth, mergedSelections, expandType, checkboxPropsMap, onSelectMultiple, triggerSingleSelection, isCheckboxDisabled]);\n return [transformColumns, derivedSelectedKeySet];\n};\nexport default useSelection;"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAC5C,OAAOC,YAAY,MAAM,yCAAyC;AAClE,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,mBAAmB,QAAQ,UAAU;AAC9C,SAASC,MAAM,EAAEC,MAAM,QAAQ,iBAAiB;AAChD,SAASC,YAAY,QAAQ,8BAA8B;AAC3D,SAASC,qBAAqB,QAAQ,2BAA2B;AACjE,OAAOC,cAAc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