{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport warning from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { INTERNAL_HOOKS } from \"../constant\";\nimport { findAllChildrenKeys, renderExpandIcon } from \"../utils/expandUtil\";\nimport { getExpandableProps } from \"../utils/legacyUtil\";\nexport default function useExpand(props, mergedData, getRowKey) {\n  var expandableConfig = getExpandableProps(props);\n  var expandIcon = expandableConfig.expandIcon,\n    expandedRowKeys = expandableConfig.expandedRowKeys,\n    defaultExpandedRowKeys = expandableConfig.defaultExpandedRowKeys,\n    defaultExpandAllRows = expandableConfig.defaultExpandAllRows,\n    expandedRowRender = expandableConfig.expandedRowRender,\n    onExpand = expandableConfig.onExpand,\n    onExpandedRowsChange = expandableConfig.onExpandedRowsChange,\n    childrenColumnName = expandableConfig.childrenColumnName;\n  var mergedExpandIcon = expandIcon || renderExpandIcon;\n  var mergedChildrenColumnName = childrenColumnName || 'children';\n  var expandableType = React.useMemo(function () {\n    if (expandedRowRender) {\n      return 'row';\n    }\n    /* eslint-disable no-underscore-dangle */\n    /**\n     * Fix https://github.com/ant-design/ant-design/issues/21154\n     * This is a workaround to not to break current behavior.\n     * We can remove follow code after final release.\n     *\n     * To other developer:\n     *  Do not use `__PARENT_RENDER_ICON__` in prod since we will remove this when refactor\n     */\n    if (props.expandable && props.internalHooks === INTERNAL_HOOKS && props.expandable.__PARENT_RENDER_ICON__ || mergedData.some(function (record) {\n      return record && _typeof(record) === 'object' && record[mergedChildrenColumnName];\n    })) {\n      return 'nest';\n    }\n    /* eslint-enable */\n    return false;\n  }, [!!expandedRowRender, mergedData]);\n  var _React$useState = React.useState(function () {\n      if (defaultExpandedRowKeys) {\n        return defaultExpandedRowKeys;\n      }\n      if (defaultExpandAllRows) {\n        return findAllChildrenKeys(mergedData, getRowKey, mergedChildrenColumnName);\n      }\n      return [];\n    }),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    innerExpandedKeys = _React$useState2[0],\n    setInnerExpandedKeys = _React$useState2[1];\n  var mergedExpandedKeys = React.useMemo(function () {\n    return new Set(expandedRowKeys || innerExpandedKeys || []);\n  }, [expandedRowKeys, innerExpandedKeys]);\n  var onTriggerExpand = React.useCallback(function (record) {\n    var key = getRowKey(record, mergedData.indexOf(record));\n    var newExpandedKeys;\n    var hasKey = mergedExpandedKeys.has(key);\n    if (hasKey) {\n      mergedExpandedKeys.delete(key);\n      newExpandedKeys = _toConsumableArray(mergedExpandedKeys);\n    } else {\n      newExpandedKeys = [].concat(_toConsumableArray(mergedExpandedKeys), [key]);\n    }\n    setInnerExpandedKeys(newExpandedKeys);\n    if (onExpand) {\n      onExpand(!hasKey, record);\n    }\n    if (onExpandedRowsChange) {\n      onExpandedRowsChange(newExpandedKeys);\n    }\n  }, [getRowKey, mergedExpandedKeys, mergedData, onExpand, onExpandedRowsChange]);\n\n  // Warning if use `expandedRowRender` and nest children in the same time\n  if (process.env.NODE_ENV !== 'production' && expandedRowRender && mergedData.some(function (record) {\n    return Array.isArray(record === null || record === void 0 ? void 0 : record[mergedChildrenColumnName]);\n  })) {\n    warning(false, '`expandedRowRender` should not use with nested Table');\n  }\n  return [expandableConfig, expandableType, mergedExpandedKeys, mergedExpandIcon, mergedChildrenColumnName, onTriggerExpand];\n}","map":{"version":3,"names":["_toConsumableArray","_slicedToArray","_typeof","warning","React","INTERNAL_HOOKS","findAllChildrenKeys","renderExpandIcon","getExpandableProps","useExpand","props","mergedData","getRowKey","expandableConfig","expandIcon","expandedRowKeys","defaultExpandedRowKeys","defaultExpandAllRows","expandedRowRender","onExpand","onExpandedRowsChange","childrenColumnName","mergedExpandIcon","mergedChildrenColumnName","expandableType","useMemo","expandable","internalHooks","__PARENT_RENDER_ICON__","some","record","_React$useState","useState","_React$useState2","innerExpandedKeys","setInnerExpandedKeys","mergedExpandedKeys","Set","onTriggerExpand","useCallback","key","indexOf","newExpandedKeys","hasKey","has","delete","concat","process","env","NODE_ENV","Array","isArray"],"sources":["D:/Project/UC_Trains_Voice/react-demo/node_modules/rc-table/es/hooks/useExpand.js"],"sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport warning from \"rc-util/es/warning\";\nimport * as React from 'react';\nimport { INTERNAL_HOOKS } from \"../constant\";\nimport { findAllChildrenKeys, renderExpandIcon } from \"../utils/expandUtil\";\nimport { getExpandableProps } from \"../utils/legacyUtil\";\nexport default function useExpand(props, mergedData, getRowKey) {\n  var expandableConfig = getExpandableProps(props);\n  var expandIcon = expandableConfig.expandIcon,\n    expandedRowKeys = expandableConfig.expandedRowKeys,\n    defaultExpandedRowKeys = expandableConfig.defaultExpandedRowKeys,\n    defaultExpandAllRows = expandableConfig.defaultExpandAllRows,\n    expandedRowRender = expandableConfig.expandedRowRender,\n    onExpand = expandableConfig.onExpand,\n    onExpandedRowsChange = expandableConfig.onExpandedRowsChange,\n    childrenColumnName = expandableConfig.childrenColumnName;\n  var mergedExpandIcon = expandIcon || renderExpandIcon;\n  var mergedChildrenColumnName = childrenColumnName || 'children';\n  var expandableType = React.useMemo(function () {\n    if (expandedRowRender) {\n      return 'row';\n    }\n    /* eslint-disable no-underscore-dangle */\n    /**\n     * Fix https://github.com/ant-design/ant-design/issues/21154\n     * This is a workaround to not to break current behavior.\n     * We can remove follow code after final release.\n     *\n     * To other developer:\n     *  Do not use `__PARENT_RENDER_ICON__` in prod since we will remove this when refactor\n     */\n    if (props.expandable && props.internalHooks === INTERNAL_HOOKS && props.expandable.__PARENT_RENDER_ICON__ || mergedData.some(function (record) {\n      return record && _typeof(record) === 'object' && record[mergedChildrenColumnName];\n    })) {\n      return 'nest';\n    }\n    /* eslint-enable */\n    return false;\n  }, [!!expandedRowRender, mergedData]);\n  var _React$useState = React.useState(function () {\n      if (defaultExpandedRowKeys) {\n        return defaultExpandedRowKeys;\n      }\n      if (defaultExpandAllRows) {\n        return findAllChildrenKeys(mergedData, getRowKey, mergedChildrenColumnName);\n      }\n      return [];\n    }),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    innerExpandedKeys = _React$useState2[0],\n    setInnerExpandedKeys = _React$useState2[1];\n  var mergedExpandedKeys = React.useMemo(function () {\n    return new Set(expandedRowKeys || innerExpandedKeys || []);\n  }, [expandedRowKeys, innerExpandedKeys]);\n  var onTriggerExpand = React.useCallback(function (record) {\n    var key = getRowKey(record, mergedData.indexOf(record));\n    var newExpandedKeys;\n    var hasKey = mergedExpandedKeys.has(key);\n    if (hasKey) {\n      mergedExpandedKeys.delete(key);\n      newExpandedKeys = _toConsumableArray(mergedExpandedKeys);\n    } else {\n      newExpandedKeys = [].concat(_toConsumableArray(mergedExpandedKeys), [key]);\n    }\n    setInnerExpandedKeys(newExpandedKeys);\n    if (onExpand) {\n      onExpand(!hasKey, record);\n    }\n    if (onExpandedRowsChange) {\n      onExpandedRowsChange(newExpandedKeys);\n    }\n  }, [getRowKey, mergedExpandedKeys, mergedData, onExpand, onExpandedRowsChange]);\n\n  // Warning if use `expandedRowRender` and nest children in the same time\n  if (process.env.NODE_ENV !== 'production' && expandedRowRender && mergedData.some(function (record) {\n    return Array.isArray(record === null || record === void 0 ? void 0 : record[mergedChildrenColumnName]);\n  })) {\n    warning(false, '`expandedRowRender` should not use with nested Table');\n  }\n  return [expandableConfig, expandableType, mergedExpandedKeys, mergedExpandIcon, mergedChildrenColumnName, onTriggerExpand];\n}"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,8CAA8C;AAC7E,OAAOC,cAAc,MAAM,0CAA0C;AACrE,OAAOC,OAAO,MAAM,mCAAmC;AACvD,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,cAAc,QAAQ,aAAa;AAC5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