1 line
9.8 KiB
JSON
1 line
9.8 KiB
JSON
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport classNames from 'classnames';\nimport { useEvent, warning } from 'rc-util';\nimport * as React from 'react';\nimport { INTERNAL_HOOKS } from \"../constant\";\nimport { makeImmutable } from \"../context/TableContext\";\nimport Table, { DEFAULT_PREFIX } from \"../Table\";\nimport Grid from \"./BodyGrid\";\nimport { StaticContext } from \"./context\";\nimport getValue from \"rc-util/es/utils/get\";\nvar renderBody = function renderBody(rawData, props) {\n var ref = props.ref,\n onScroll = props.onScroll;\n return /*#__PURE__*/React.createElement(Grid, {\n ref: ref,\n data: rawData,\n onScroll: onScroll\n });\n};\nfunction VirtualTable(props, ref) {\n var columns = props.columns,\n scroll = props.scroll,\n sticky = props.sticky,\n _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? DEFAULT_PREFIX : _props$prefixCls,\n className = props.className,\n listItemHeight = props.listItemHeight,\n components = props.components,\n onScroll = props.onScroll;\n var _ref = scroll || {},\n scrollX = _ref.x,\n scrollY = _ref.y;\n\n // Fill scrollX\n if (typeof scrollX !== 'number') {\n if (process.env.NODE_ENV !== 'production') {\n warning(!scrollX, '`scroll.x` in virtual table must be number.');\n }\n scrollX = 1;\n }\n\n // Fill scrollY\n if (typeof scrollY !== 'number') {\n scrollY = 500;\n if (process.env.NODE_ENV !== 'production') {\n warning(false, '`scroll.y` in virtual table must be number.');\n }\n }\n var getComponent = useEvent(function (path, defaultComponent) {\n return getValue(components, path) || defaultComponent;\n });\n\n // Memo this\n var onInternalScroll = useEvent(onScroll);\n\n // ========================= Context ==========================\n var context = React.useMemo(function () {\n return {\n sticky: sticky,\n scrollY: scrollY,\n listItemHeight: listItemHeight,\n getComponent: getComponent,\n onScroll: onInternalScroll\n };\n }, [sticky, scrollY, listItemHeight, getComponent, onInternalScroll]);\n\n // ========================== Render ==========================\n return /*#__PURE__*/React.createElement(StaticContext.Provider, {\n value: context\n }, /*#__PURE__*/React.createElement(Table, _extends({}, props, {\n className: classNames(className, \"\".concat(prefixCls, \"-virtual\")),\n scroll: _objectSpread(_objectSpread({}, scroll), {}, {\n x: scrollX\n }),\n components: _objectSpread(_objectSpread({}, components), {}, {\n body: renderBody\n }),\n columns: columns,\n internalHooks: INTERNAL_HOOKS,\n tailor: true,\n ref: ref\n })));\n}\nvar RefVirtualTable = /*#__PURE__*/React.forwardRef(VirtualTable);\nif (process.env.NODE_ENV !== 'production') {\n RefVirtualTable.displayName = 'VirtualTable';\n}\nexport function genVirtualTable(shouldTriggerRender) {\n return makeImmutable(RefVirtualTable, shouldTriggerRender);\n}\nexport default genVirtualTable();","map":{"version":3,"names":["_extends","_objectSpread","classNames","useEvent","warning","React","INTERNAL_HOOKS","makeImmutable","Table","DEFAULT_PREFIX","Grid","StaticContext","getValue","renderBody","rawData","props","ref","onScroll","createElement","data","VirtualTable","columns","scroll","sticky","_props$prefixCls","prefixCls","className","listItemHeight","components","_ref","scrollX","x","scrollY","y","process","env","NODE_ENV","getComponent","path","defaultComponent","onInternalScroll","context","useMemo","Provider","value","concat","body","internalHooks","tailor","RefVirtualTable","forwardRef","displayName","genVirtualTable","shouldTriggerRender"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-table/es/VirtualTable/index.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport classNames from 'classnames';\nimport { useEvent, warning } from 'rc-util';\nimport * as React from 'react';\nimport { INTERNAL_HOOKS } from \"../constant\";\nimport { makeImmutable } from \"../context/TableContext\";\nimport Table, { DEFAULT_PREFIX } from \"../Table\";\nimport Grid from \"./BodyGrid\";\nimport { StaticContext } from \"./context\";\nimport getValue from \"rc-util/es/utils/get\";\nvar renderBody = function renderBody(rawData, props) {\n var ref = props.ref,\n onScroll = props.onScroll;\n return /*#__PURE__*/React.createElement(Grid, {\n ref: ref,\n data: rawData,\n onScroll: onScroll\n });\n};\nfunction VirtualTable(props, ref) {\n var columns = props.columns,\n scroll = props.scroll,\n sticky = props.sticky,\n _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? DEFAULT_PREFIX : _props$prefixCls,\n className = props.className,\n listItemHeight = props.listItemHeight,\n components = props.components,\n onScroll = props.onScroll;\n var _ref = scroll || {},\n scrollX = _ref.x,\n scrollY = _ref.y;\n\n // Fill scrollX\n if (typeof scrollX !== 'number') {\n if (process.env.NODE_ENV !== 'production') {\n warning(!scrollX, '`scroll.x` in virtual table must be number.');\n }\n scrollX = 1;\n }\n\n // Fill scrollY\n if (typeof scrollY !== 'number') {\n scrollY = 500;\n if (process.env.NODE_ENV !== 'production') {\n warning(false, '`scroll.y` in virtual table must be number.');\n }\n }\n var getComponent = useEvent(function (path, defaultComponent) {\n return getValue(components, path) || defaultComponent;\n });\n\n // Memo this\n var onInternalScroll = useEvent(onScroll);\n\n // ========================= Context ==========================\n var context = React.useMemo(function () {\n return {\n sticky: sticky,\n scrollY: scrollY,\n listItemHeight: listItemHeight,\n getComponent: getComponent,\n onScroll: onInternalScroll\n };\n }, [sticky, scrollY, listItemHeight, getComponent, onInternalScroll]);\n\n // ========================== Render ==========================\n return /*#__PURE__*/React.createElement(StaticContext.Provider, {\n value: context\n }, /*#__PURE__*/React.createElement(Table, _extends({}, props, {\n className: classNames(className, \"\".concat(prefixCls, \"-virtual\")),\n scroll: _objectSpread(_objectSpread({}, scroll), {}, {\n x: scrollX\n }),\n components: _objectSpread(_objectSpread({}, components), {}, {\n body: renderBody\n }),\n columns: columns,\n internalHooks: INTERNAL_HOOKS,\n tailor: true,\n ref: ref\n })));\n}\nvar RefVirtualTable = /*#__PURE__*/React.forwardRef(VirtualTable);\nif (process.env.NODE_ENV !== 'production') {\n RefVirtualTable.displayName = 'VirtualTable';\n}\nexport function genVirtualTable(shouldTriggerRender) {\n return makeImmutable(RefVirtualTable, shou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