PromoCursed/node_modules/.cache/babel-loader/72ca0274e152903d388a5632df89bae5f11168c4cae269f39f378b5b650a86b8.json
2024-08-20 23:25:37 +04:00

1 line
5.6 KiB
JSON

{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\n\n/**\n * Size info need loop query for the `heights` which will has the perf issue.\n * Let cache result for each render phase.\n */\nexport function useGetSize(mergedData, getKey, heights, itemHeight) {\n var _React$useMemo = React.useMemo(function () {\n return [new Map(), []];\n }, [mergedData, heights.id, itemHeight]),\n _React$useMemo2 = _slicedToArray(_React$useMemo, 2),\n key2Index = _React$useMemo2[0],\n bottomList = _React$useMemo2[1];\n var getSize = function getSize(startKey) {\n var endKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startKey;\n // Get from cache first\n var startIndex = key2Index.get(startKey);\n var endIndex = key2Index.get(endKey);\n\n // Loop to fill the cache\n if (startIndex === undefined || endIndex === undefined) {\n var dataLen = mergedData.length;\n for (var i = bottomList.length; i < dataLen; i += 1) {\n var _heights$get;\n var item = mergedData[i];\n var key = getKey(item);\n key2Index.set(key, i);\n var cacheHeight = (_heights$get = heights.get(key)) !== null && _heights$get !== void 0 ? _heights$get : itemHeight;\n bottomList[i] = (bottomList[i - 1] || 0) + cacheHeight;\n if (key === startKey) {\n startIndex = i;\n }\n if (key === endKey) {\n endIndex = i;\n }\n if (startIndex !== undefined && endIndex !== undefined) {\n break;\n }\n }\n }\n return {\n top: bottomList[startIndex - 1] || 0,\n bottom: bottomList[endIndex]\n };\n };\n return getSize;\n}","map":{"version":3,"names":["_slicedToArray","React","useGetSize","mergedData","getKey","heights","itemHeight","_React$useMemo","useMemo","Map","id","_React$useMemo2","key2Index","bottomList","getSize","startKey","endKey","arguments","length","undefined","startIndex","get","endIndex","dataLen","i","_heights$get","item","key","set","cacheHeight","top","bottom"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-virtual-list/es/hooks/useGetSize.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\n\n/**\n * Size info need loop query for the `heights` which will has the perf issue.\n * Let cache result for each render phase.\n */\nexport function useGetSize(mergedData, getKey, heights, itemHeight) {\n var _React$useMemo = React.useMemo(function () {\n return [new Map(), []];\n }, [mergedData, heights.id, itemHeight]),\n _React$useMemo2 = _slicedToArray(_React$useMemo, 2),\n key2Index = _React$useMemo2[0],\n bottomList = _React$useMemo2[1];\n var getSize = function getSize(startKey) {\n var endKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startKey;\n // Get from cache first\n var startIndex = key2Index.get(startKey);\n var endIndex = key2Index.get(endKey);\n\n // Loop to fill the cache\n if (startIndex === undefined || endIndex === undefined) {\n var dataLen = mergedData.length;\n for (var i = bottomList.length; i < dataLen; i += 1) {\n var _heights$get;\n var item = mergedData[i];\n var key = getKey(item);\n key2Index.set(key, i);\n var cacheHeight = (_heights$get = heights.get(key)) !== null && _heights$get !== void 0 ? _heights$get : itemHeight;\n bottomList[i] = (bottomList[i - 1] || 0) + cacheHeight;\n if (key === startKey) {\n startIndex = i;\n }\n if (key === endKey) {\n endIndex = i;\n }\n if (startIndex !== undefined && endIndex !== undefined) {\n break;\n }\n }\n }\n return {\n top: bottomList[startIndex - 1] || 0,\n bottom: bottomList[endIndex]\n };\n };\n return getSize;\n}"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAO,KAAKC,KAAK,MAAM,OAAO;;AAE9B;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,UAAU,EAAEC,MAAM,EAAEC,OAAO,EAAEC,UAAU,EAAE;EAClE,IAAIC,cAAc,GAAGN,KAAK,CAACO,OAAO,CAAC,YAAY;MAC3C,OAAO,CAAC,IAAIC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;IACxB,CAAC,EAAE,CAACN,UAAU,EAAEE,OAAO,CAACK,EAAE,EAAEJ,UAAU,CAAC,CAAC;I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