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 cl
|