ac87b249fe7de7c08d94641769ca6712.json 30.2 KB
{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\n\nvar __rest = this && this.__rest || function (s, e) {\n  var t = {};\n\n  for (var p in s) {\n    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n  }\n\n  if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n  }\n  return t;\n};\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport Spin from '../spin';\nimport useBreakpoint from '../grid/hooks/useBreakpoint';\nimport { responsiveArray } from '../_util/responsiveObserve';\nimport { ConfigContext } from '../config-provider';\nimport Pagination from '../pagination';\nimport { Row } from '../grid';\nimport Item from './Item';\nexport var ListContext = /*#__PURE__*/React.createContext({});\nexport var ListConsumer = ListContext.Consumer;\n\nfunction List(_a) {\n  var _classNames;\n\n  var _a$pagination = _a.pagination,\n      pagination = _a$pagination === void 0 ? false : _a$pagination,\n      customizePrefixCls = _a.prefixCls,\n      _a$bordered = _a.bordered,\n      bordered = _a$bordered === void 0 ? false : _a$bordered,\n      _a$split = _a.split,\n      split = _a$split === void 0 ? true : _a$split,\n      className = _a.className,\n      children = _a.children,\n      itemLayout = _a.itemLayout,\n      loadMore = _a.loadMore,\n      grid = _a.grid,\n      _a$dataSource = _a.dataSource,\n      dataSource = _a$dataSource === void 0 ? [] : _a$dataSource,\n      size = _a.size,\n      header = _a.header,\n      footer = _a.footer,\n      _a$loading = _a.loading,\n      loading = _a$loading === void 0 ? false : _a$loading,\n      rowKey = _a.rowKey,\n      renderItem = _a.renderItem,\n      locale = _a.locale,\n      rest = __rest(_a, [\"pagination\", \"prefixCls\", \"bordered\", \"split\", \"className\", \"children\", \"itemLayout\", \"loadMore\", \"grid\", \"dataSource\", \"size\", \"header\", \"footer\", \"loading\", \"rowKey\", \"renderItem\", \"locale\"]);\n\n  var paginationObj = pagination && _typeof(pagination) === 'object' ? pagination : {};\n\n  var _React$useState = React.useState(paginationObj.defaultCurrent || 1),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      paginationCurrent = _React$useState2[0],\n      setPaginationCurrent = _React$useState2[1];\n\n  var _React$useState3 = React.useState(paginationObj.defaultPageSize || 10),\n      _React$useState4 = _slicedToArray(_React$useState3, 2),\n      paginationSize = _React$useState4[0],\n      setPaginationSize = _React$useState4[1];\n\n  var _React$useContext = React.useContext(ConfigContext),\n      getPrefixCls = _React$useContext.getPrefixCls,\n      renderEmpty = _React$useContext.renderEmpty,\n      direction = _React$useContext.direction;\n\n  var defaultPaginationProps = {\n    current: 1,\n    total: 0\n  };\n  var keys = {};\n\n  var triggerPaginationEvent = function triggerPaginationEvent(eventName) {\n    return function (page, pageSize) {\n      setPaginationCurrent(page);\n      setPaginationSize(pageSize);\n\n      if (pagination && pagination[eventName]) {\n        pagination[eventName](page, pageSize);\n      }\n    };\n  };\n\n  var onPaginationChange = triggerPaginationEvent('onChange');\n  var onPaginationShowSizeChange = triggerPaginationEvent('onShowSizeChange');\n\n  var renderInnerItem = function renderInnerItem(item, index) {\n    if (!renderItem) return null;\n    var key;\n\n    if (typeof rowKey === 'function') {\n      key = rowKey(item);\n    } else if (typeof rowKey === 'string') {\n      key = item[rowKey];\n    } else {\n      key = item.key;\n    }\n\n    if (!key) {\n      key = \"list-item-\".concat(index);\n    }\n\n    keys[index] = key;\n    return renderItem(item, index);\n  };\n\n  var isSomethingAfterLastItem = function isSomethingAfterLastItem() {\n    return !!(loadMore || pagination || footer);\n  };\n\n  var renderEmptyFunc = function renderEmptyFunc(prefixCls, renderEmptyHandler) {\n    return /*#__PURE__*/React.createElement(\"div\", {\n      className: \"\".concat(prefixCls, \"-empty-text\")\n    }, locale && locale.emptyText || renderEmptyHandler('List'));\n  };\n\n  var prefixCls = getPrefixCls('list', customizePrefixCls);\n  var loadingProp = loading;\n\n  if (typeof loadingProp === 'boolean') {\n    loadingProp = {\n      spinning: loadingProp\n    };\n  }\n\n  var isLoading = loadingProp && loadingProp.spinning; // large => lg\n  // small => sm\n\n  var sizeCls = '';\n\n  switch (size) {\n    case 'large':\n      sizeCls = 'lg';\n      break;\n\n    case 'small':\n      sizeCls = 'sm';\n      break;\n\n    default:\n      break;\n  }\n\n  var classString = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-vertical\"), itemLayout === 'vertical'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(sizeCls), sizeCls), _defineProperty(_classNames, \"\".concat(prefixCls, \"-split\"), split), _defineProperty(_classNames, \"\".concat(prefixCls, \"-bordered\"), bordered), _defineProperty(_classNames, \"\".concat(prefixCls, \"-loading\"), isLoading), _defineProperty(_classNames, \"\".concat(prefixCls, \"-grid\"), grid), _defineProperty(_classNames, \"\".concat(prefixCls, \"-something-after-last-item\"), isSomethingAfterLastItem()), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames), className);\n\n  var paginationProps = _extends(_extends(_extends({}, defaultPaginationProps), {\n    total: dataSource.length,\n    current: paginationCurrent,\n    pageSize: paginationSize\n  }), pagination || {});\n\n  var largestPage = Math.ceil(paginationProps.total / paginationProps.pageSize);\n\n  if (paginationProps.current > largestPage) {\n    paginationProps.current = largestPage;\n  }\n\n  var paginationContent = pagination ? /*#__PURE__*/React.createElement(\"div\", {\n    className: \"\".concat(prefixCls, \"-pagination\")\n  }, /*#__PURE__*/React.createElement(Pagination, _extends({}, paginationProps, {\n    onChange: onPaginationChange,\n    onShowSizeChange: onPaginationShowSizeChange\n  }))) : null;\n\n  var splitDataSource = _toConsumableArray(dataSource);\n\n  if (pagination) {\n    if (dataSource.length > (paginationProps.current - 1) * paginationProps.pageSize) {\n      splitDataSource = _toConsumableArray(dataSource).splice((paginationProps.current - 1) * paginationProps.pageSize, paginationProps.pageSize);\n    }\n  }\n\n  var screens = useBreakpoint();\n  var currentBreakpoint = React.useMemo(function () {\n    for (var i = 0; i < responsiveArray.length; i += 1) {\n      var breakpoint = responsiveArray[i];\n\n      if (screens[breakpoint]) {\n        return breakpoint;\n      }\n    }\n\n    return undefined;\n  }, [screens]);\n  var colStyle = React.useMemo(function () {\n    if (!grid) {\n      return undefined;\n    }\n\n    var columnCount = currentBreakpoint && grid[currentBreakpoint] ? grid[currentBreakpoint] : grid.column;\n\n    if (columnCount) {\n      return {\n        width: \"\".concat(100 / columnCount, \"%\"),\n        maxWidth: \"\".concat(100 / columnCount, \"%\")\n      };\n    }\n  }, [grid === null || grid === void 0 ? void 0 : grid.column, currentBreakpoint]);\n  var childrenContent = isLoading && /*#__PURE__*/React.createElement(\"div\", {\n    style: {\n      minHeight: 53\n    }\n  });\n\n  if (splitDataSource.length > 0) {\n    var items = splitDataSource.map(function (item, index) {\n      return renderInnerItem(item, index);\n    });\n    var childrenList = React.Children.map(items, function (child, index) {\n      return /*#__PURE__*/React.createElement(\"div\", {\n        key: keys[index],\n        style: colStyle\n      }, child);\n    });\n    childrenContent = grid ? /*#__PURE__*/React.createElement(Row, {\n      gutter: grid.gutter\n    }, childrenList) : /*#__PURE__*/React.createElement(\"ul\", {\n      className: \"\".concat(prefixCls, \"-items\")\n    }, items);\n  } else if (!children && !isLoading) {\n    childrenContent = renderEmptyFunc(prefixCls, renderEmpty);\n  }\n\n  var paginationPosition = paginationProps.position || 'bottom';\n  return /*#__PURE__*/React.createElement(ListContext.Provider, {\n    value: {\n      grid: grid,\n      itemLayout: itemLayout\n    }\n  }, /*#__PURE__*/React.createElement(\"div\", _extends({\n    className: classString\n  }, rest), (paginationPosition === 'top' || paginationPosition === 'both') && paginationContent, header && /*#__PURE__*/React.createElement(\"div\", {\n    className: \"\".concat(prefixCls, \"-header\")\n  }, header), /*#__PURE__*/React.createElement(Spin, loadingProp, childrenContent, children), footer && /*#__PURE__*/React.createElement(\"div\", {\n    className: \"\".concat(prefixCls, \"-footer\")\n  }, footer), loadMore || (paginationPosition === 'bottom' || paginationPosition === 'both') && paginationContent));\n}\n\nList.Item = Item;\nexport default List;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/list/index.js"],"names":["_toConsumableArray","_extends","_defineProperty","_slicedToArray","_typeof","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","classNames","Spin","useBreakpoint","responsiveArray","ConfigContext","Pagination","Row","Item","ListContext","createContext","ListConsumer","Consumer","List","_a","_classNames","_a$pagination","pagination","customizePrefixCls","prefixCls","_a$bordered","bordered","_a$split","split","className","children","itemLayout","loadMore","grid","_a$dataSource","dataSource","size","header","footer","_a$loading","loading","rowKey","renderItem","locale","rest","paginationObj","_React$useState","useState","defaultCurrent","_React$useState2","paginationCurrent","setPaginationCurrent","_React$useState3","defaultPageSize","_React$useState4","paginationSize","setPaginationSize","_React$useContext","useContext","getPrefixCls","renderEmpty","direction","defaultPaginationProps","current","total","keys","triggerPaginationEvent","eventName","page","pageSize","onPaginationChange","onPaginationShowSizeChange","renderInnerItem","item","index","key","concat","isSomethingAfterLastItem","renderEmptyFunc","renderEmptyHandler","createElement","emptyText","loadingProp","spinning","isLoading","sizeCls","classString","paginationProps","largestPage","Math","ceil","paginationContent","onChange","onShowSizeChange","splitDataSource","splice","screens","currentBreakpoint","useMemo","breakpoint","undefined","colStyle","columnCount","column","width","maxWidth","childrenContent","style","minHeight","items","map","childrenList","Children","child","gutter","paginationPosition","position","Provider","value"],"mappings":"AAAA,OAAOA,kBAAP,MAA+B,0CAA/B;AACA,OAAOC,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP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AEhD1C,IAFgD,CAAnC,EAEN,CAACuE,kBAAkB,KAAK,KAAvB,IAAgCA,kBAAkB,KAAK,MAAxD,KAAmExB,iBAF7D,EAEgFtD,MAAM,IAAI,aAAahC,KAAK,CAAC2E,aAAN,CAAoB,KAApB,EAA2B;AAChJnD,IAAAA,SAAS,EAAE,GAAG+C,MAAH,CAAUpD,SAAV,EAAqB,SAArB;AADqI,GAA3B,EAEpHa,MAFoH,CAFvG,EAIJ,aAAahC,KAAK,CAAC2E,aAAN,CAAoBzE,IAApB,EAA0B2E,WAA1B,EAAuCwB,eAAvC,EAAwD5E,QAAxD,CAJT,EAI4EQ,MAAM,IAAI,aAAajC,KAAK,CAAC2E,aAAN,CAAoB,KAApB,EAA2B;AAC5InD,IAAAA,SAAS,EAAE,GAAG+C,MAAH,CAAUpD,SAAV,EAAqB,SAArB;AADiI,GAA3B,EAEhHc,MAFgH,CAJnG,EAMJN,QAAQ,IAAI,CAACmF,kBAAkB,KAAK,QAAvB,IAAmCA,kBAAkB,KAAK,MAA3D,KAAsExB,iBAN9E,CALI,CAApB;AAYD;;AAEDzE,IAAI,CAACL,IAAL,GAAYA,IAAZ;AACA,eAAeK,IAAf","sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\n\nvar __rest = this && this.__rest || function (s, e) {\n  var t = {};\n\n  for (var p in s) {\n    if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n  }\n\n  if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n  }\n  return t;\n};\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport Spin from '../spin';\nimport useBreakpoint from '../grid/hooks/useBreakpoint';\nimport { responsiveArray } from '../_util/responsiveObserve';\nimport { ConfigContext } from '../config-provider';\nimport Pagination from '../pagination';\nimport { Row } from '../grid';\nimport Item from './Item';\nexport var ListContext = /*#__PURE__*/React.createContext({});\nexport var ListConsumer = ListContext.Consumer;\n\nfunction List(_a) {\n  var _classNames;\n\n  var _a$pagination = _a.pagination,\n      pagination = _a$pagination === void 0 ? false : _a$pagination,\n      customizePrefixCls = _a.prefixCls,\n      _a$bordered = _a.bordered,\n      bordered = _a$bordered === void 0 ? false : _a$bordered,\n      _a$split = _a.split,\n      split = _a$split === void 0 ? true : _a$split,\n      className = _a.className,\n      children = _a.children,\n      itemLayout = _a.itemLayout,\n      loadMore = _a.loadMore,\n      grid = _a.grid,\n      _a$dataSource = _a.dataSource,\n      dataSource = _a$dataSource === void 0 ? [] : _a$dataSource,\n      size = _a.size,\n      header = _a.header,\n      footer = _a.footer,\n      _a$loading = _a.loading,\n      loading = _a$loading === void 0 ? false : _a$loading,\n      rowKey = _a.rowKey,\n      renderItem = _a.renderItem,\n      locale = _a.locale,\n      rest = __rest(_a, [\"pagination\", \"prefixCls\", \"bordered\", \"split\", \"className\", \"children\", \"itemLayout\", \"loadMore\", \"grid\", \"dataSource\", \"size\", \"header\", \"footer\", \"loading\", \"rowKey\", \"renderItem\", \"locale\"]);\n\n  var paginationObj = pagination && _typeof(pagination) === 'object' ? pagination : {};\n\n  var _React$useState = React.useState(paginationObj.defaultCurrent || 1),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      paginationCurrent = _React$useState2[0],\n      setPaginationCurrent = _React$useState2[1];\n\n  var _React$useState3 = React.useState(paginationObj.defaultPageSize || 10),\n      _React$useState4 = _slicedToArray(_React$useState3, 2),\n      paginationSize = _React$useState4[0],\n      setPaginationSize = _React$useState4[1];\n\n  var _React$useContext = React.useContext(ConfigContext),\n      getPrefixCls = _React$useContext.getPrefixCls,\n      renderEmpty = _React$useContext.renderEmpty,\n      direction = _React$useContext.direction;\n\n  var defaultPaginationProps = {\n    current: 1,\n    total: 0\n  };\n  var keys = {};\n\n  var triggerPaginationEvent = function triggerPaginationEvent(eventName) {\n    return function (page, pageSize) {\n      setPaginationCurrent(page);\n      setPaginationSize(pageSize);\n\n      if (pagination && pagination[eventName]) {\n        pagination[eventName](page, pageSize);\n      }\n    };\n  };\n\n  var onPaginationChange = triggerPaginationEvent('onChange');\n  var onPaginationShowSizeChange = triggerPaginationEvent('onShowSizeChange');\n\n  var renderInnerItem = function renderInnerItem(item, index) {\n    if (!renderItem) return null;\n    var key;\n\n    if (typeof rowKey === 'function') {\n      key = rowKey(item);\n    } else if (typeof rowKey === 'string') {\n      key = item[rowKey];\n    } else {\n      key = item.key;\n    }\n\n    if (!key) {\n      key = \"list-item-\".concat(index);\n    }\n\n    keys[index] = key;\n    return renderItem(item, index);\n  };\n\n  var isSomethingAfterLastItem = function isSomethingAfterLastItem() {\n    return !!(loadMore || pagination || footer);\n  };\n\n  var renderEmptyFunc = function renderEmptyFunc(prefixCls, renderEmptyHandler) {\n    return /*#__PURE__*/React.createElement(\"div\", {\n      className: \"\".concat(prefixCls, \"-empty-text\")\n    }, locale && locale.emptyText || renderEmptyHandler('List'));\n  };\n\n  var prefixCls = getPrefixCls('list', customizePrefixCls);\n  var loadingProp = loading;\n\n  if (typeof loadingProp === 'boolean') {\n    loadingProp = {\n      spinning: loadingProp\n    };\n  }\n\n  var isLoading = loadingProp && loadingProp.spinning; // large => lg\n  // small => sm\n\n  var sizeCls = '';\n\n  switch (size) {\n    case 'large':\n      sizeCls = 'lg';\n      break;\n\n    case 'small':\n      sizeCls = 'sm';\n      break;\n\n    default:\n      break;\n  }\n\n  var classString = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-vertical\"), itemLayout === 'vertical'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(sizeCls), sizeCls), _defineProperty(_classNames, \"\".concat(prefixCls, \"-split\"), split), _defineProperty(_classNames, \"\".concat(prefixCls, \"-bordered\"), bordered), _defineProperty(_classNames, \"\".concat(prefixCls, \"-loading\"), isLoading), _defineProperty(_classNames, \"\".concat(prefixCls, \"-grid\"), grid), _defineProperty(_classNames, \"\".concat(prefixCls, \"-something-after-last-item\"), isSomethingAfterLastItem()), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames), className);\n\n  var paginationProps = _extends(_extends(_extends({}, defaultPaginationProps), {\n    total: dataSource.length,\n    current: paginationCurrent,\n    pageSize: paginationSize\n  }), pagination || {});\n\n  var largestPage = Math.ceil(paginationProps.total / paginationProps.pageSize);\n\n  if (paginationProps.current > largestPage) {\n    paginationProps.current = largestPage;\n  }\n\n  var paginationContent = pagination ? /*#__PURE__*/React.createElement(\"div\", {\n    className: \"\".concat(prefixCls, \"-pagination\")\n  }, /*#__PURE__*/React.createElement(Pagination, _extends({}, paginationProps, {\n    onChange: onPaginationChange,\n    onShowSizeChange: onPaginationShowSizeChange\n  }))) : null;\n\n  var splitDataSource = _toConsumableArray(dataSource);\n\n  if (pagination) {\n    if (dataSource.length > (paginationProps.current - 1) * paginationProps.pageSize) {\n      splitDataSource = _toConsumableArray(dataSource).splice((paginationProps.current - 1) * paginationProps.pageSize, paginationProps.pageSize);\n    }\n  }\n\n  var screens = useBreakpoint();\n  var currentBreakpoint = React.useMemo(function () {\n    for (var i = 0; i < responsiveArray.length; i += 1) {\n      var breakpoint = responsiveArray[i];\n\n      if (screens[breakpoint]) {\n        return breakpoint;\n      }\n    }\n\n    return undefined;\n  }, [screens]);\n  var colStyle = React.useMemo(function () {\n    if (!grid) {\n      return undefined;\n    }\n\n    var columnCount = currentBreakpoint && grid[currentBreakpoint] ? grid[currentBreakpoint] : grid.column;\n\n    if (columnCount) {\n      return {\n        width: \"\".concat(100 / columnCount, \"%\"),\n        maxWidth: \"\".concat(100 / columnCount, \"%\")\n      };\n    }\n  }, [grid === null || grid === void 0 ? void 0 : grid.column, currentBreakpoint]);\n  var childrenContent = isLoading && /*#__PURE__*/React.createElement(\"div\", {\n    style: {\n      minHeight: 53\n    }\n  });\n\n  if (splitDataSource.length > 0) {\n    var items = splitDataSource.map(function (item, index) {\n      return renderInnerItem(item, index);\n    });\n    var childrenList = React.Children.map(items, function (child, index) {\n      return /*#__PURE__*/React.createElement(\"div\", {\n        key: keys[index],\n        style: colStyle\n      }, child);\n    });\n    childrenContent = grid ? /*#__PURE__*/React.createElement(Row, {\n      gutter: grid.gutter\n    }, childrenList) : /*#__PURE__*/React.createElement(\"ul\", {\n      className: \"\".concat(prefixCls, \"-items\")\n    }, items);\n  } else if (!children && !isLoading) {\n    childrenContent = renderEmptyFunc(prefixCls, renderEmpty);\n  }\n\n  var paginationPosition = paginationProps.position || 'bottom';\n  return /*#__PURE__*/React.createElement(ListContext.Provider, {\n    value: {\n      grid: grid,\n      itemLayout: itemLayout\n    }\n  }, /*#__PURE__*/React.createElement(\"div\", _extends({\n    className: classString\n  }, rest), (paginationPosition === 'top' || paginationPosition === 'both') && paginationContent, header && /*#__PURE__*/React.createElement(\"div\", {\n    className: \"\".concat(prefixCls, \"-header\")\n  }, header), /*#__PURE__*/React.createElement(Spin, loadingProp, childrenContent, children), footer && /*#__PURE__*/React.createElement(\"div\", {\n    className: \"\".concat(prefixCls, \"-footer\")\n  }, footer), loadMore || (paginationPosition === 'bottom' || paginationPosition === 'both') && paginationContent));\n}\n\nList.Item = Item;\nexport default List;"]},"metadata":{},"sourceType":"module"}