{"version":3,"sources":["../../../src/components/ImagePreviewer/ImagePreviewer.jsx"],"names":["ImagePreviewer","props","setIndex","bind","onPrev","onNext","onOrigin","rotateLeft","rotateRight","onImgLoad","onImageError","state","cIndex","index","direction","loading","nextProps","prev","list","length","next","window","open","setState","onFold","large","transform","opacity","transition","map","item","wrapper","active","thumbnail","backgroundImage","small","React","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;AACA;;;;AAGA;;AACA;;;;;;;;;;IAEqBA,c;;;AACnB,0BAAYC,KAAZ,EAAmB;AAAA;;AAAA,gIACXA,KADW;;AAEjB,UAAKC,QAAL,GAAgB,MAAKA,QAAL,CAAcC,IAAd,OAAhB;AACA,UAAKC,MAAL,GAAc,MAAKA,MAAL,CAAYD,IAAZ,OAAd;AACA,UAAKE,MAAL,GAAc,MAAKA,MAAL,CAAYF,IAAZ,OAAd;AACA,UAAKG,QAAL,GAAgB,MAAKA,QAAL,CAAcH,IAAd,OAAhB;AACA,UAAKI,UAAL,GAAkB,MAAKA,UAAL,CAAgBJ,IAAhB,OAAlB;AACA,UAAKK,WAAL,GAAmB,MAAKA,WAAL,CAAiBL,IAAjB,OAAnB;AACA,UAAKM,SAAL,GAAiB,MAAKA,SAAL,CAAeN,IAAf,OAAjB;AACA,UAAKO,YAAL,GAAoB,MAAKA,YAAL,CAAkBP,IAAlB,OAApB;AACA,UAAKQ,KAAL,GAAa;AACXC,cAAQX,MAAMY,KADH;AAEXC,iBAAW,CAFA,EAEG;AACdC,eAAS;AAHE,KAAb;AAViB;AAelB;;;;8CAEyBC,S,EAAW;AACnC,UAAIA,UAAUH,KAAV,KAAoB,KAAKZ,KAAL,CAAWY,KAAnC,EAA0C;AACxC,aAAKX,QAAL,CAAcc,UAAUH,KAAxB;AACD;AACF;;;6BAEQ;AACP,UAAMI,OACJ,KAAKN,KAAL,CAAWC,MAAX,KAAsB,CAAtB,GACI,KAAKX,KAAL,CAAWiB,IAAX,CAAgBC,MAAhB,GAAyB,CAD7B,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AAA;AACE,2BAAW,0BAAW;AACpBkB,2BAAS,IADW;AAEpBC,0BAAQnB,UAAUD;AAFE,iBAAX,CADb;AAKE,qBAAKkB;AALP;AAOE;AACE,2BAAW,0BAAW;AACpBG,6BAAW;AADS,iBAAX,CADb;AAIE,uBAAO;AACLC,4CAAwB,6BAAgBJ,IAAhB,EAAsB;AAC5CK,2BAAO;AADqC,mBAAtB,CAAxB;AADK,iBAJT;AASE,yBAAS,mBAAM;AACb,yBAAKjC,QAAL,CAAcW,KAAd;AACD;AAXH;AAPF,aADQ;AAAA,WAAT;AADH;AA5DJ,OADF;AAyFD;;;;EApLyCuB,gBAAMC,S;;kBAA7BrC,c","file":"ImagePreviewer.js","sourcesContent":["import React from \"react\";\r\nimport classnames from \"classnames\";\r\nimport { Icon, Spin } from \"antd\";\r\n\r\nimport \"./ImagePreviewer.css\";\r\nimport { addImageProcess } from \"../../helper\";\r\n\r\nexport default class ImagePreviewer extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n this.setIndex = this.setIndex.bind(this);\r\n this.onPrev = this.onPrev.bind(this);\r\n this.onNext = this.onNext.bind(this);\r\n this.onOrigin = this.onOrigin.bind(this);\r\n this.rotateLeft = this.rotateLeft.bind(this);\r\n this.rotateRight = this.rotateRight.bind(this);\r\n this.onImgLoad = this.onImgLoad.bind(this);\r\n this.onImageError = this.onImageError.bind(this);\r\n this.state = {\r\n cIndex: props.index,\r\n direction: 0, // 0- 0deg 1- 90deg 2- 180deg 3- 270deg\r\n loading: false\r\n };\r\n }\r\n\r\n componentWillReceiveProps(nextProps) {\r\n if (nextProps.index !== this.props.index) {\r\n this.setIndex(nextProps.index);\r\n }\r\n }\r\n\r\n onPrev() {\r\n const prev =\r\n this.state.cIndex === 0\r\n ? this.props.list.length - 1\r\n : this.state.cIndex - 1;\r\n this.setIndex(prev);\r\n }\r\n\r\n onNext() {\r\n const next =\r\n this.state.cIndex === this.props.list.length - 1\r\n ? 0\r\n : this.state.cIndex + 1;\r\n this.setIndex(next);\r\n }\r\n\r\n onOrigin() {\r\n window.open(this.props.list[this.state.cIndex]);\r\n }\r\n\r\n onImgLoad() {\r\n this.setState({\r\n loading: false\r\n });\r\n }\r\n\r\n onImageError() {\r\n this.setState({\r\n loading: false\r\n });\r\n }\r\n\r\n setIndex(index) {\r\n this.setState({\r\n cIndex: index,\r\n direction: 0,\r\n loading: true\r\n });\r\n }\r\n\r\n rotateLeft() {\r\n let direction = this.state.direction - 1;\r\n if (direction === -1) {\r\n direction = 3;\r\n }\r\n this.setState({\r\n direction\r\n });\r\n }\r\n\r\n rotateRight() {\r\n let direction = this.state.direction + 1;\r\n if (direction === 4) {\r\n direction = 0;\r\n }\r\n this.setState({\r\n direction\r\n });\r\n }\r\n\r\n // calcHeight(node) {\r\n // const { naturalHeight, naturalWidth } = node;\r\n // }\r\n\r\n render() {\r\n const { list, onFold } = this.props;\r\n const { cIndex } = this.state;\r\n return (\r\n