1 line
5.6 KiB
JSON
1 line
5.6 KiB
JSON
|
{"ast":null,"code":"import { useMemo } from 'react';\nvar DEFAULT_SIZE = {\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n right: 0\n};\nexport default function useVisibleRange(tabOffsets, visibleTabContentValue, transform, tabContentSizeValue, addNodeSizeValue, operationNodeSizeValue, _ref) {\n var tabs = _ref.tabs,\n tabPosition = _ref.tabPosition,\n rtl = _ref.rtl;\n var charUnit;\n var position;\n var transformSize;\n if (['top', 'bottom'].includes(tabPosition)) {\n charUnit = 'width';\n position = rtl ? 'right' : 'left';\n transformSize = Math.abs(transform);\n } else {\n charUnit = 'height';\n position = 'top';\n transformSize = -transform;\n }\n return useMemo(function () {\n if (!tabs.length) {\n return [0, 0];\n }\n var len = tabs.length;\n var endIndex = len;\n for (var i = 0; i < len; i += 1) {\n var offset = tabOffsets.get(tabs[i].key) || DEFAULT_SIZE;\n if (offset[position] + offset[charUnit] > transformSize + visibleTabContentValue) {\n endIndex = i - 1;\n break;\n }\n }\n var startIndex = 0;\n for (var _i = len - 1; _i >= 0; _i -= 1) {\n var _offset = tabOffsets.get(tabs[_i].key) || DEFAULT_SIZE;\n if (_offset[position] < transformSize) {\n startIndex = _i + 1;\n break;\n }\n }\n return startIndex >= endIndex ? [0, 0] : [startIndex, endIndex];\n }, [tabOffsets, visibleTabContentValue, tabContentSizeValue, addNodeSizeValue, operationNodeSizeValue, transformSize, tabPosition, tabs.map(function (tab) {\n return tab.key;\n }).join('_'), rtl]);\n}","map":{"version":3,"names":["useMemo","DEFAULT_SIZE","width","height","left","top","right","useVisibleRange","tabOffsets","visibleTabContentValue","transform","tabContentSizeValue","addNodeSizeValue","operationNodeSizeValue","_ref","tabs","tabPosition","rtl","charUnit","position","transformSize","includes","Math","abs","length","len","endIndex","i","offset","get","key","startIndex","_i","_offset","map","tab","join"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-tabs/es/hooks/useVisibleRange.js"],"sourcesContent":["import { useMemo } from 'react';\nvar DEFAULT_SIZE = {\n width: 0,\n height: 0,\n left: 0,\n top: 0,\n right: 0\n};\nexport default function useVisibleRange(tabOffsets, visibleTabContentValue, transform, tabContentSizeValue, addNodeSizeValue, operationNodeSizeValue, _ref) {\n var tabs = _ref.tabs,\n tabPosition = _ref.tabPosition,\n rtl = _ref.rtl;\n var charUnit;\n var position;\n var transformSize;\n if (['top', 'bottom'].includes(tabPosition)) {\n charUnit = 'width';\n position = rtl ? 'right' : 'left';\n transformSize = Math.abs(transform);\n } else {\n charUnit = 'height';\n position = 'top';\n transformSize = -transform;\n }\n return useMemo(function () {\n if (!tabs.length) {\n return [0, 0];\n }\n var len = tabs.length;\n var endIndex = len;\n for (var i = 0; i < len; i += 1) {\n var offset = tabOffsets.get(tabs[i].key) || DEFAULT_SIZE;\n if (offset[position] + offset[charUnit] > transformSize + visibleTabContentValue) {\n endIndex = i - 1;\n break;\n }\n }\n var startIndex = 0;\n for (var _i = len - 1; _i >= 0; _i -= 1) {\n var _offset = tabOffsets.get(tabs[_i].key) || DEFAULT_SIZE;\n if (_offset[position] < transformSize) {\n startIndex = _i + 1;\n break;\n }\n }\n return startIndex >= endIndex ? [0, 0] : [startIndex, endIndex];\n }, [tabOffsets, visibleTabContentValue, tabContentSizeValue, addNodeSizeValue, operationNodeSizeValue, transformSize, tabPosition, tabs.map(function (tab) {\n return tab.key;\n }).join('_'), rtl]);\n}"],"mappings":"AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,IAAIC,YAAY,GAAG;EACjBC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,IAAI,EAAE,CAAC;EACPC,GAAG,EAAE,CAAC;EACNC,KAAK,EAAE;AACT,CAAC;AACD,eAAe,SAASC,eAAeA,CAACC,UAAU,EAAEC,sBAAsB,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,gBAAgB,EAAEC,sBAAsB,EAAEC,IAAI,EAAE;EAC1J,IAAIC,IAAI,GAAGD,IAAI,CAACC,IAAI;IAClBC,WAAW,GAA
|