@ -1,12 +1,70 @@
"use strict" ;
( self [ "webpackChunk" ] = self [ "webpackChunk" ] || [ ] ) . push ( [ [ 20700 ] , {
/***/ 31917 :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / components / NoData / index . tsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/***/ ( function ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony import */ var _root _workspace _ppte5yg23 _local _v9 _node _modules _babel _runtime _7 _23 _2 _babel _runtime _helpers _objectSpread2 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ ( /*! ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js */ 26801 ) ;
/* harmony import */ var _root _workspace _ppte5yg23 _local _v9 _node _modules _babel _runtime _7 _23 _2 _babel _runtime _helpers _objectSpread2 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _root _workspace _ppte5yg23 _local _v9 _node _modules _babel _runtime _7 _23 _2 _babel _runtime _helpers _objectSpread2 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ ) ;
/* harmony import */ var react _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ ( /*! react */ 59301 ) ;
/* harmony import */ var _assets _images _icons _nodata _png _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ ( /*! @/assets/images/icons/nodata.png */ 4977 ) ;
/* harmony import */ var antd _ _WEBPACK _IMPORTED _MODULE _4 _ _ = _ _webpack _require _ _ ( /*! antd */ 3113 ) ;
/* harmony import */ var react _jsx _runtime _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ ( /*! react/jsx-runtime */ 37712 ) ;
var noData = function noData ( _ref ) {
var img = _ref . img ,
_ref$buttonProps = _ref . buttonProps ,
buttonProps = _ref$buttonProps === void 0 ? { } : _ref$buttonProps ,
_ref$styles = _ref . styles ,
styles = _ref$styles === void 0 ? { } : _ref$styles ,
customText = _ref . customText ,
ButtonText = _ref . ButtonText ,
ButtonClick = _ref . ButtonClick ,
Buttonclass = _ref . Buttonclass ,
ButtonTwo = _ref . ButtonTwo ,
imgStyles = _ref . imgStyles ,
_ref$loading = _ref . loading ,
loading = _ref$loading === void 0 ? false : _ref$loading ;
return /*#__PURE__*/ ( 0 , react _jsx _runtime _ _WEBPACK _IMPORTED _MODULE _3 _ _ . jsxs ) ( "section" , {
className : "tc animated fadeIn" ,
style : _root _workspace _ppte5yg23 _local _v9 _node _modules _babel _runtime _7 _23 _2 _babel _runtime _helpers _objectSpread2 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( _root _workspace _ppte5yg23 _local _v9 _node _modules _babel _runtime _7 _23 _2 _babel _runtime _helpers _objectSpread2 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( { } , {
color : '#999' ,
margin : '100px auto' ,
visibility : loading ? 'hidden' : 'visible'
} ) , styles ) ,
children : [ /*#__PURE__*/ ( 0 , react _jsx _runtime _ _WEBPACK _IMPORTED _MODULE _3 _ _ . jsx ) ( "img" , {
src : img || _assets _images _icons _nodata _png _ _WEBPACK _IMPORTED _MODULE _2 _ _ ,
style : _root _workspace _ppte5yg23 _local _v9 _node _modules _babel _runtime _7 _23 _2 _babel _runtime _helpers _objectSpread2 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( { } , imgStyles )
} ) , /*#__PURE__*/ ( 0 , react _jsx _runtime _ _WEBPACK _IMPORTED _MODULE _3 _ _ . jsx ) ( "p" , {
className : "mt20 font14" ,
children : customText || '暂时还没有相关数据哦!'
} ) , ButtonText && /*#__PURE__*/ ( 0 , react _jsx _runtime _ _WEBPACK _IMPORTED _MODULE _3 _ _ . jsx ) ( antd _ _WEBPACK _IMPORTED _MODULE _4 _ _ /* ["default"] */ . ZP , _root _workspace _ppte5yg23 _local _v9 _node _modules _babel _runtime _7 _23 _2 _babel _runtime _helpers _objectSpread2 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( _root _workspace _ppte5yg23 _local _v9 _node _modules _babel _runtime _7 _23 _2 _babel _runtime _helpers _objectSpread2 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ _default ( ) ( {
className : Buttonclass ,
onClick : ButtonClick
} , buttonProps ) , { } , {
children : ButtonText
} ) ) , ButtonTwo && ButtonTwo ]
} ) ;
} ;
/* harmony default export */ _ _webpack _exports _ _ . Z = ( noData ) ;
/***/ } ) ,
/***/ 89953 :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / components / modal . tsx * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/***/ ( function ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
/* harmony export */ Z : function ( ) { return /* binding */ Dialog ; }
/* harmony export */ } ) ;
@ -56,12 +114,13 @@ var Dialog = /*#__PURE__*/function (_React$Component) {
/***/ } ) ,
/***/ 85989 :
/***/ 7575 :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / src / pages / tasks / Jupyter / index . tsx + 1 3 modules * * * !
! * * * . / src / pages / tasks / Jupyter / index . tsx + 1 5 modules * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/***/ ( function ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
// ESM COMPAT FLAG
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
@ -73,6 +132,9 @@ __webpack_require__.d(__webpack_exports__, {
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/objectSpread2.js
var objectSpread2 = _ _webpack _require _ _ ( 26801 ) ;
var objectSpread2 _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( objectSpread2 ) ;
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/typeof.js
var helpers _typeof = _ _webpack _require _ _ ( 5773 ) ;
var typeof _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( helpers _typeof ) ;
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/regeneratorRuntime.js
var regeneratorRuntime = _ _webpack _require _ _ ( 10574 ) ;
var regeneratorRuntime _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( regeneratorRuntime ) ;
@ -105,6 +167,8 @@ var es_button = __webpack_require__(3113);
var es _checkbox = _ _webpack _require _ _ ( 24905 ) ;
// EXTERNAL MODULE: ./node_modules/_antd@5.9.0@antd/es/drawer/index.js + 9 modules
var drawer = _ _webpack _require _ _ ( 43428 ) ;
// EXTERNAL MODULE: ./src/pages/Classrooms/Lists/Exercise/components/Unlock.tsx
var Unlock = _ _webpack _require _ _ ( 96042 ) ;
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/PoweroffOutlined.js + 1 modules
var PoweroffOutlined = _ _webpack _require _ _ ( 22321 ) ;
; // CONCATENATED MODULE: ./src/pages/tasks/Jupyter/index.less?modules
@ -252,8 +316,31 @@ var DataSet = function DataSet(_ref2) {
var service = _ _webpack _require _ _ ( 60274 ) ;
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/CloseOutlined.js + 1 modules
var CloseOutlined = _ _webpack _require _ _ ( 99174 ) ;
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/FileTextOutlined.js + 1 modules
var FileTextOutlined = _ _webpack _require _ _ ( 88011 ) ;
// EXTERNAL MODULE: ./node_modules/_@babel_runtime@7.23.2@@babel/runtime/helpers/esm/extends.js
var esm _extends = _ _webpack _require _ _ ( 26508 ) ;
; // CONCATENATED MODULE: ./node_modules/_@ant-design_icons-svg@4.3.1@@ant-design/icons-svg/es/asn/FileTextOutlined.js
// This icon file is generated automatically.
var FileTextOutlined = { "icon" : { "tag" : "svg" , "attrs" : { "viewBox" : "64 64 896 896" , "focusable" : "false" } , "children" : [ { "tag" : "path" , "attrs" : { "d" : "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494zM504 618H320c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM312 490v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H320c-4.4 0-8 3.6-8 8z" } } ] } , "name" : "file-text" , "theme" : "outlined" } ;
/* harmony default export */ var asn _FileTextOutlined = ( FileTextOutlined ) ;
// EXTERNAL MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/components/AntdIcon.js + 3 modules
var AntdIcon = _ _webpack _require _ _ ( 91851 ) ;
; // CONCATENATED MODULE: ./node_modules/_@ant-design_icons@5.2.6@@ant-design/icons/es/icons/FileTextOutlined.js
// GENERATE BY ./scripts/generate.ts
// DON NOT EDIT IT MANUALLY
var FileTextOutlined _FileTextOutlined = function FileTextOutlined ( props , ref ) {
return /*#__PURE__*/ _react _17 _0 _2 _react . createElement ( AntdIcon /* default */ . Z , ( 0 , esm _extends /* default */ . Z ) ( { } , props , {
ref : ref ,
icon : asn _FileTextOutlined
} ) ) ;
} ;
if ( false ) { }
/* harmony default export */ var icons _FileTextOutlined = ( /*#__PURE__*/ _react _17 _0 _2 _react . forwardRef ( FileTextOutlined _FileTextOutlined ) ) ;
// EXTERNAL MODULE: ./node_modules/_react-infinite-scroller@1.2.4@react-infinite-scroller/index.js
var _react _infinite _scroller _1 _2 _4 _react _infinite _scroller = _ _webpack _require _ _ ( 26724 ) ;
var _react _infinite _scroller _1 _2 _4 _react _infinite _scroller _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( _react _infinite _scroller _1 _2 _4 _react _infinite _scroller ) ;
@ -401,7 +488,7 @@ var DataSet_DataSet = function DataSet(_ref) {
children : [ /*#__PURE__*/ ( 0 , jsx _runtime . jsxs ) ( "span" , {
className : DataSetmodules . itemText ,
title : item . title ,
children : [ /*#__PURE__*/ ( 0 , jsx _runtime . jsx ) ( FileTextOutlined/* default */ . Z , {
children : [ /*#__PURE__*/ ( 0 , jsx _runtime . jsx ) ( icons_ FileTextOutlined, {
style : {
color : '#28b887' ,
fontSize : 25
@ -966,6 +1053,7 @@ var exercise = __webpack_require__(65398);
var _excluded = [ "globalSetting" , "loading" , "dispatch" ] ;
@ -993,6 +1081,7 @@ var _excluded = ["globalSetting", "loading", "dispatch"];
var Countdown = statistic /* default */ . Z . Countdown ;
@ -1100,6 +1189,7 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
_useState34 = slicedToArray _default ( ) ( _useState33 , 2 ) ,
checkboxData = _useState34 [ 0 ] ,
setcheckboxData = _useState34 [ 1 ] ;
var exerciseDataRef = ( 0 , _react _17 _0 _2 _react . useRef ) ( ) ;
var countRef = ( 0 , _react _17 _0 _2 _react . useRef ) ( checkboxData ) ;
countRef . current = checkboxData ;
console . log ( "---------jupyterDat11111a" , jupyterData ) ;
@ -1108,6 +1198,9 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
type : 'globalSetting/headerFooterToggle' ,
payload : false
} ) ;
if ( searchParams . get ( "exercisesId" ) ) {
getExerciseData ( ) ;
}
return function ( ) {
dispatch ( {
type : 'globalSetting/headerFooterToggle' ,
@ -1149,7 +1242,7 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
while ( 1 ) switch ( _context . prev = _context . next ) {
case 0 :
_context . next = 2 ;
return getExerciseStartAnswer( {
return ( 0 , exercise/* getExerciseStartAnswer */. _B ) ( {
categoryId : searchParams . get ( "exercisesId" ) ,
login : searchParams . get ( "login" )
} ) ;
@ -1214,7 +1307,8 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
var handleSaveWithTPI = /*#__PURE__*/ function ( ) {
var _ref4 = asyncToGenerator _default ( ) ( /*#__PURE__*/ regeneratorRuntime _default ( ) ( ) . mark ( function _callee3 ( ) {
var res ;
var _urlRef$current ;
var res , _exerciseDataRef$curr , _exerciseDataRef$curr2 ;
return regeneratorRuntime _default ( ) ( ) . wrap ( function _callee3$ ( _context3 ) {
while ( 1 ) switch ( _context3 . prev = _context3 . next ) {
case 0 :
@ -1222,19 +1316,42 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
return ( 0 , task /* saveWithTPI */ . zE ) ( {
identifier : params . identifier ,
jupyter _port : port . current ,
token : token . current
token : token . current ,
jupyter _domain : ( _urlRef$current = urlRef . current ) === null || _urlRef$current === void 0 || ( _urlRef$current = _urlRef$current [ 0 ] ) === null || _urlRef$current === void 0 ? void 0 : _urlRef$current . domain ,
exercise _id : searchParams . get ( "exercisesId" ) //试卷id
} ) ;
case 2 :
res = _context3 . sent ;
if ( res . status === 0 ) {
if ( clickEvaluating . current ) {
// 点击评测的时候执行
getGame ( res === null || res === void 0 ? void 0 : res . data ) ;
} else {
message /* default */ . ZP . success ( '保存成功!' ) ;
}
if ( ! ( res . status === 0 ) ) {
_context3 . next = 7 ;
break ;
}
case 4 :
if ( clickEvaluating . current ) {
// 点击评测的时候执行
getGame ( res === null || res === void 0 ? void 0 : res . data ) ;
} else {
message /* default */ . ZP . success ( '保存成功!' ) ;
}
_context3 . next = 10 ;
break ;
case 7 :
if ( ! ( res . status === - 5 && typeof _default ( ) ( res === null || res === void 0 ? void 0 : res . message ) === "object" ) ) {
_context3 . next = 10 ;
break ;
}
( 0 , _umi _production _exports . getDvaApp ) ( ) . _store . dispatch ( {
type : 'exercise/setActionTabs' ,
payload : {
key : 'student-unlock' ,
exerciseParams : objectSpread2 _default ( ) ( objectSpread2 _default ( ) ( { } , ( ( _exerciseDataRef$curr = exerciseDataRef . current ) === null || _exerciseDataRef$curr === void 0 ? void 0 : _exerciseDataRef$curr . exercise ) || { } ) , { } , {
errorMessage : res === null || res === void 0 ? void 0 : res . message ,
exercise _user _id : ( _exerciseDataRef$curr2 = exerciseDataRef . current ) === null || _exerciseDataRef$curr2 === void 0 || ( _exerciseDataRef$curr2 = _exerciseDataRef$curr2 . exercise ) === null || _exerciseDataRef$curr2 === void 0 ? void 0 : _exerciseDataRef$curr2 . exercise _user _id ,
id : searchParams . get ( "exercisesId" )
} )
}
} ) ;
return _context3 . abrupt ( "return" ) ;
case 10 :
case "end" :
return _context3 . stop ( ) ;
}
@ -1252,6 +1369,14 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
while ( 1 ) switch ( _context5 . prev = _context5 . next ) {
case 0 :
_params = {
extras : {
exercise _id : searchParams . get ( "exercisesId" ) ,
//试卷id
question _id : searchParams . get ( "questionId" ) ,
// 题目id
challenge _id : jupyterData === null || jupyterData === void 0 ? void 0 : jupyterData . challenge _id // 关卡id
} ,
sec _key : re === null || re === void 0 ? void 0 : re . sec _key ,
resubmit : re === null || re === void 0 ? void 0 : re . resubmit ,
first : 1 ,
@ -1267,15 +1392,22 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
case 4 :
rs = _context5 . sent ;
if ( ! ( rs . status === - 1 ) ) {
_context5 . next = 11 ;
_context5 . next = 14 ;
break ;
}
if ( ! ( searchParams . get ( "type" ) === 'exercises' ) ) {
_context5 . next = 9 ;
break ;
}
window . parent . location . href = "/classrooms/" . concat ( searchParams . get ( "coursesId" ) , "/exercise/" ) . concat ( searchParams . get ( "exercisesId" ) , "/detail" ) ;
return _context5 . abrupt ( "return" ) ;
case 9 :
setBtnLoading ( false ) ;
setBtnTime ( 10 ) ;
clickEvaluating . current = false ;
jupyterMessageFlag . current = true ;
return _context5 . abrupt ( "return" ) ;
case 1 1 :
case 1 4 :
count = 1 ;
time _out = false ;
finalTime = ( ( _saveJupyterData$curr2 = saveJupyterData . current ) === null || _saveJupyterData$curr2 === void 0 ? void 0 : _saveJupyterData$curr2 . exec _time ) + 11 ;
@ -1333,7 +1465,7 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
} ;
} ( ) ;
fnc ( ) ;
case 1 6 :
case 1 9 :
case "end" :
return _context5 . stop ( ) ;
}
@ -2198,6 +2330,8 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
onClose : onHideToolBar ,
children : /*#__PURE__*/ ( 0 , jsx _runtime . jsx ) ( vnc _setting /* default */ . Z , objectSpread2 _default ( ) ( { } , vncSettingOption ) )
} )
} ) , /*#__PURE__*/ ( 0 , jsx _runtime . jsx ) ( Unlock /* default */ . Z , {
successCb : handleSaveWithTPI
} ) ]
} ) ;
} ;
@ -2218,6 +2352,7 @@ var TaskJupyterPage = function TaskJupyterPage(_ref) {
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/***/ ( function ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
/* harmony export */ Jd : function ( ) { return /* binding */ rebootEsc ; } ,
/* harmony export */ a$ : function ( ) { return /* binding */ getDataSets ; } ,
@ -2455,6 +2590,7 @@ function _getLatexFileTree() {
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/***/ ( function ( _ _unused _webpack _module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
/* harmony export */ BU : function ( ) { return /* binding */ exitFull ; } ,
/* harmony export */ Dj : function ( ) { return /* binding */ requestFullScreen ; } ,
@ -2551,6 +2687,322 @@ function IsFull() {
// }
// });
/***/ } ) ,
/***/ 51581 :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / node _modules / _react - infinite - scroller @ 1.2 . 4 @ react - infinite - scroller / dist / InfiniteScroll . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , ( {
value : true
} ) ) ;
var _createClass = function ( ) { function defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } } return function ( Constructor , protoProps , staticProps ) { if ( protoProps ) defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) defineProperties ( Constructor , staticProps ) ; return Constructor ; } ; } ( ) ;
var _react = _ _webpack _require _ _ ( /*! react */ 59301 ) ;
var _react2 = _interopRequireDefault ( _react ) ;
var _propTypes = _ _webpack _require _ _ ( /*! prop-types */ 12708 ) ;
var _propTypes2 = _interopRequireDefault ( _propTypes ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _objectWithoutProperties ( obj , keys ) { var target = { } ; for ( var i in obj ) { if ( keys . indexOf ( i ) >= 0 ) continue ; if ( ! Object . prototype . hasOwnProperty . call ( obj , i ) ) continue ; target [ i ] = obj [ i ] ; } return target ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _possibleConstructorReturn ( self , call ) { if ( ! self ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return call && ( typeof call === "object" || typeof call === "function" ) ? call : self ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function, not " + typeof superClass ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , enumerable : false , writable : true , configurable : true } } ) ; if ( superClass ) Object . setPrototypeOf ? Object . setPrototypeOf ( subClass , superClass ) : subClass . _ _proto _ _ = superClass ; }
var InfiniteScroll = function ( _Component ) {
_inherits ( InfiniteScroll , _Component ) ;
function InfiniteScroll ( props ) {
_classCallCheck ( this , InfiniteScroll ) ;
var _this = _possibleConstructorReturn ( this , ( InfiniteScroll . _ _proto _ _ || Object . getPrototypeOf ( InfiniteScroll ) ) . call ( this , props ) ) ;
_this . scrollListener = _this . scrollListener . bind ( _this ) ;
_this . eventListenerOptions = _this . eventListenerOptions . bind ( _this ) ;
_this . mousewheelListener = _this . mousewheelListener . bind ( _this ) ;
return _this ;
}
_createClass ( InfiniteScroll , [ {
key : 'componentDidMount' ,
value : function componentDidMount ( ) {
this . pageLoaded = this . props . pageStart ;
this . options = this . eventListenerOptions ( ) ;
this . attachScrollListener ( ) ;
}
} , {
key : 'componentDidUpdate' ,
value : function componentDidUpdate ( ) {
if ( this . props . isReverse && this . loadMore ) {
var parentElement = this . getParentElement ( this . scrollComponent ) ;
parentElement . scrollTop = parentElement . scrollHeight - this . beforeScrollHeight + this . beforeScrollTop ;
this . loadMore = false ;
}
this . attachScrollListener ( ) ;
}
} , {
key : 'componentWillUnmount' ,
value : function componentWillUnmount ( ) {
this . detachScrollListener ( ) ;
this . detachMousewheelListener ( ) ;
}
} , {
key : 'isPassiveSupported' ,
value : function isPassiveSupported ( ) {
var passive = false ;
var testOptions = {
get passive ( ) {
passive = true ;
}
} ;
try {
document . addEventListener ( 'test' , null , testOptions ) ;
document . removeEventListener ( 'test' , null , testOptions ) ;
} catch ( e ) {
// ignore
}
return passive ;
}
} , {
key : 'eventListenerOptions' ,
value : function eventListenerOptions ( ) {
var options = this . props . useCapture ;
if ( this . isPassiveSupported ( ) ) {
options = {
useCapture : this . props . useCapture ,
passive : true
} ;
}
return options ;
}
// Set a defaut loader for all your `InfiniteScroll` components
} , {
key : 'setDefaultLoader' ,
value : function setDefaultLoader ( loader ) {
this . defaultLoader = loader ;
}
} , {
key : 'detachMousewheelListener' ,
value : function detachMousewheelListener ( ) {
var scrollEl = window ;
if ( this . props . useWindow === false ) {
scrollEl = this . scrollComponent . parentNode ;
}
scrollEl . removeEventListener ( 'mousewheel' , this . mousewheelListener , this . options ? this . options : this . props . useCapture ) ;
}
} , {
key : 'detachScrollListener' ,
value : function detachScrollListener ( ) {
var scrollEl = window ;
if ( this . props . useWindow === false ) {
scrollEl = this . getParentElement ( this . scrollComponent ) ;
}
scrollEl . removeEventListener ( 'scroll' , this . scrollListener , this . options ? this . options : this . props . useCapture ) ;
scrollEl . removeEventListener ( 'resize' , this . scrollListener , this . options ? this . options : this . props . useCapture ) ;
}
} , {
key : 'getParentElement' ,
value : function getParentElement ( el ) {
var scrollParent = this . props . getScrollParent && this . props . getScrollParent ( ) ;
if ( scrollParent != null ) {
return scrollParent ;
}
return el && el . parentNode ;
}
} , {
key : 'filterProps' ,
value : function filterProps ( props ) {
return props ;
}
} , {
key : 'attachScrollListener' ,
value : function attachScrollListener ( ) {
var parentElement = this . getParentElement ( this . scrollComponent ) ;
if ( ! this . props . hasMore || ! parentElement ) {
return ;
}
var scrollEl = window ;
if ( this . props . useWindow === false ) {
scrollEl = parentElement ;
}
scrollEl . addEventListener ( 'mousewheel' , this . mousewheelListener , this . options ? this . options : this . props . useCapture ) ;
scrollEl . addEventListener ( 'scroll' , this . scrollListener , this . options ? this . options : this . props . useCapture ) ;
scrollEl . addEventListener ( 'resize' , this . scrollListener , this . options ? this . options : this . props . useCapture ) ;
if ( this . props . initialLoad ) {
this . scrollListener ( ) ;
}
}
} , {
key : 'mousewheelListener' ,
value : function mousewheelListener ( e ) {
// Prevents Chrome hangups
// See: https://stackoverflow.com/questions/47524205/random-high-content-download-time-in-chrome/47684257#47684257
if ( e . deltaY === 1 && ! this . isPassiveSupported ( ) ) {
e . preventDefault ( ) ;
}
}
} , {
key : 'scrollListener' ,
value : function scrollListener ( ) {
var el = this . scrollComponent ;
var scrollEl = window ;
var parentNode = this . getParentElement ( el ) ;
var offset = void 0 ;
if ( this . props . useWindow ) {
var doc = document . documentElement || document . body . parentNode || document . body ;
var scrollTop = scrollEl . pageYOffset !== undefined ? scrollEl . pageYOffset : doc . scrollTop ;
if ( this . props . isReverse ) {
offset = scrollTop ;
} else {
offset = this . calculateOffset ( el , scrollTop ) ;
}
} else if ( this . props . isReverse ) {
offset = parentNode . scrollTop ;
} else {
offset = el . scrollHeight - parentNode . scrollTop - parentNode . clientHeight ;
}
// Here we make sure the element is visible as well as checking the offset
if ( offset < Number ( this . props . threshold ) && el && el . offsetParent !== null ) {
this . detachScrollListener ( ) ;
this . beforeScrollHeight = parentNode . scrollHeight ;
this . beforeScrollTop = parentNode . scrollTop ;
// Call loadMore after detachScrollListener to allow for non-async loadMore functions
if ( typeof this . props . loadMore === 'function' ) {
this . props . loadMore ( this . pageLoaded += 1 ) ;
this . loadMore = true ;
}
}
}
} , {
key : 'calculateOffset' ,
value : function calculateOffset ( el , scrollTop ) {
if ( ! el ) {
return 0 ;
}
return this . calculateTopPosition ( el ) + ( el . offsetHeight - scrollTop - window . innerHeight ) ;
}
} , {
key : 'calculateTopPosition' ,
value : function calculateTopPosition ( el ) {
if ( ! el ) {
return 0 ;
}
return el . offsetTop + this . calculateTopPosition ( el . offsetParent ) ;
}
} , {
key : 'render' ,
value : function render ( ) {
var _this2 = this ;
var renderProps = this . filterProps ( this . props ) ;
var children = renderProps . children ,
element = renderProps . element ,
hasMore = renderProps . hasMore ,
initialLoad = renderProps . initialLoad ,
isReverse = renderProps . isReverse ,
loader = renderProps . loader ,
loadMore = renderProps . loadMore ,
pageStart = renderProps . pageStart ,
ref = renderProps . ref ,
threshold = renderProps . threshold ,
useCapture = renderProps . useCapture ,
useWindow = renderProps . useWindow ,
getScrollParent = renderProps . getScrollParent ,
props = _objectWithoutProperties ( renderProps , [ 'children' , 'element' , 'hasMore' , 'initialLoad' , 'isReverse' , 'loader' , 'loadMore' , 'pageStart' , 'ref' , 'threshold' , 'useCapture' , 'useWindow' , 'getScrollParent' ] ) ;
props . ref = function ( node ) {
_this2 . scrollComponent = node ;
if ( ref ) {
ref ( node ) ;
}
} ;
var childrenArray = [ children ] ;
if ( hasMore ) {
if ( loader ) {
isReverse ? childrenArray . unshift ( loader ) : childrenArray . push ( loader ) ;
} else if ( this . defaultLoader ) {
isReverse ? childrenArray . unshift ( this . defaultLoader ) : childrenArray . push ( this . defaultLoader ) ;
}
}
return _react2 . default . createElement ( element , props , childrenArray ) ;
}
} ] ) ;
return InfiniteScroll ;
} ( _react . Component ) ;
InfiniteScroll . propTypes = {
children : _propTypes2 . default . node . isRequired ,
element : _propTypes2 . default . node ,
hasMore : _propTypes2 . default . bool ,
initialLoad : _propTypes2 . default . bool ,
isReverse : _propTypes2 . default . bool ,
loader : _propTypes2 . default . node ,
loadMore : _propTypes2 . default . func . isRequired ,
pageStart : _propTypes2 . default . number ,
ref : _propTypes2 . default . func ,
getScrollParent : _propTypes2 . default . func ,
threshold : _propTypes2 . default . number ,
useCapture : _propTypes2 . default . bool ,
useWindow : _propTypes2 . default . bool
} ;
InfiniteScroll . defaultProps = {
element : 'div' ,
hasMore : false ,
initialLoad : true ,
pageStart : 0 ,
ref : null ,
threshold : 250 ,
useWindow : true ,
isReverse : false ,
useCapture : false ,
loader : null ,
getScrollParent : null
} ;
exports [ "default" ] = InfiniteScroll ;
module . exports = exports [ 'default' ] ;
/***/ } ) ,
/***/ 26724 :
/ * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! * \
! * * * . / node _modules / _react - infinite - scroller @ 1.2 . 4 @ react - infinite - scroller / index . js * * * !
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
/***/ ( function ( module , _ _unused _webpack _exports , _ _webpack _require _ _ ) {
module . exports = _ _webpack _require _ _ ( /*! ./dist/InfiniteScroll */ 51581 )
/***/ } )
} ] ) ;