fan-standard-comp 3.2.1 → 3.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/Readme.md +1 -33
  2. package/dist/09cd8e9be7081f2166444cce393fe968.svg +54 -0
  3. package/dist/e3378c145b7db195ad068735e15fb28a.svg +165 -0
  4. package/dist/fan-standard-comp.umd.js +166 -444
  5. package/dist/fonts/iconfont.ttf +0 -0
  6. package/dist/fonts/iconfont.woff +0 -0
  7. package/dist/fonts/lg.ttf +0 -0
  8. package/dist/fonts/lg.woff +0 -0
  9. package/dist/fonts/lg.woff2 +0 -0
  10. package/es/ButtonGroup/ButtonList.d.ts +2 -1
  11. package/es/ButtonGroup/ButtonMenu.d.ts +2 -1
  12. package/es/ButtonGroup/PopConfirmTitle.js +5 -5
  13. package/es/ButtonGroup/index.d.ts +3 -1
  14. package/es/ButtonGroup/index.js +146 -180
  15. package/es/ButtonGroup/style/index.less +4 -1
  16. package/es/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
  17. package/es/CalendarCoordPicker/CalendarMonthPicker.js +26 -0
  18. package/es/CalendarCoordPicker/index.d.ts +8 -0
  19. package/es/CalendarCoordPicker/index.js +296 -0
  20. package/es/CalendarCoordPicker/index.less +31 -0
  21. package/es/ConfigContext/index.d.ts +7 -0
  22. package/es/ConfigContext/index.js +12 -0
  23. package/es/DragContent/index.d.ts +1 -1
  24. package/es/DragContent/index.js +5 -5
  25. package/es/FormComp/ChunkUploader/api.js +14 -14
  26. package/es/FormComp/ChunkUploader/index.js +132 -139
  27. package/es/FormComp/ChunkUploader/lib.js +21 -21
  28. package/es/FormComp/ChunkUploader/upload-queue.class.js +64 -66
  29. package/es/FormComp/EditButton/index.d.ts +1 -1
  30. package/es/FormComp/EditButton/index.js +15 -17
  31. package/es/FormComp/FieldComponent/ReUpload.d.ts +1 -1
  32. package/es/FormComp/FieldComponent/ReUpload.js +37 -23
  33. package/es/FormComp/FieldComponent/RefactorTextarea.js +32 -0
  34. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +72 -19
  35. package/es/FormComp/FieldComponent/TitleNode.d.ts +2 -1
  36. package/es/FormComp/FieldComponent/index.d.ts +1 -1
  37. package/es/FormComp/FieldComponent/index.js +33 -23
  38. package/es/FormComp/FieldComponent/setReadonlyValues.js +6 -6
  39. package/es/FormComp/RenderItemGroup/index.js +24 -8
  40. package/es/FormComp/Uploader/index.d.ts +3 -1
  41. package/es/FormComp/Uploader/index.js +243 -119
  42. package/es/FormComp/VarTemplate/index.js +57 -64
  43. package/es/ImageGallery/ImagePreview.d.ts +13 -0
  44. package/es/ImageGallery/ImagePreview.js +168 -0
  45. package/es/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
  46. package/es/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
  47. package/es/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
  48. package/es/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
  49. package/es/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
  50. package/es/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
  51. package/es/ImageGallery/PreviewStyles/lg-video.css +144 -0
  52. package/es/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
  53. package/es/ImageGallery/PreviewStyles/lightgallery.css +728 -0
  54. package/es/ImageGallery/SliderContent.d.ts +7 -0
  55. package/es/ImageGallery/SliderContent.js +699 -0
  56. package/es/ImageGallery/Thumbnail.d.ts +3 -0
  57. package/es/ImageGallery/Thumbnail.js +296 -0
  58. package/es/ImageGallery/hook/uniqueId.d.ts +1 -0
  59. package/es/ImageGallery/hook/uniqueId.js +10 -0
  60. package/es/ImageGallery/index.d.ts +4 -0
  61. package/es/ImageGallery/index.js +29 -0
  62. package/es/ImageGallery/style/index.less +5 -0
  63. package/es/ImageGallery/types.d.ts +5 -0
  64. package/es/ImageGallery/types.js +1 -0
  65. package/es/NavLeafScroll/index.js +94 -50
  66. package/es/RefactorTree/index.d.ts +1 -1
  67. package/es/RefactorTree/index.js +6 -6
  68. package/es/RefactorTree/indexTreeNode.d.ts +1 -1
  69. package/es/RefactorTree/indexTreeNode.js +19 -17
  70. package/es/RefactorTree/util.js +18 -18
  71. package/es/SpecIcon/fonts/demo_index.html +559 -5
  72. package/es/SpecIcon/fonts/iconfont.css +101 -3
  73. package/es/SpecIcon/fonts/iconfont.js +34 -27
  74. package/es/SpecIcon/fonts/iconfont.json +168 -0
  75. package/es/SpecIcon/fonts/iconfont.svg +163 -171
  76. package/es/SpecIcon/fonts/iconfont.ttf +0 -0
  77. package/es/SpecIcon/fonts/iconfont.woff +0 -0
  78. package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
  79. package/es/SpecIcon/style/iconfont.less +106 -11
  80. package/es/SplitterLayout/Pane.d.ts +1 -1
  81. package/es/SplitterLayout/index.js +25 -26
  82. package/es/StandardContent/SplitterLayout/Pane.js +3 -3
  83. package/es/StandardContent/SplitterLayout/index.js +25 -26
  84. package/es/StandardContent/SubfieldContent.d.ts +1 -1
  85. package/es/StandardContent/WrapperContent.d.ts +1 -1
  86. package/es/StandardDragModal/index.d.ts +11 -3
  87. package/es/StandardDragModal/index.js +25 -3
  88. package/es/StandardFilter/index.d.ts +5 -16
  89. package/es/StandardFilter/index.js +212 -200
  90. package/es/StandardFilter/indexClass.d.ts +37 -0
  91. package/es/StandardFilter/indexClass.js +217 -0
  92. package/es/StandardFilter/style/index.less +82 -9
  93. package/es/StandardForm/StepForm.d.ts +1 -1
  94. package/es/StandardForm/StepForm.js +28 -22
  95. package/es/StandardForm/TabForm.d.ts +1 -1
  96. package/es/StandardForm/TabForm.js +41 -43
  97. package/es/StandardForm/index.d.ts +1 -1
  98. package/es/StandardForm/index.js +5 -5
  99. package/es/StandardModal/UpdateFormRef.js +0 -1
  100. package/es/StandardModal/index.d.ts +2 -1
  101. package/es/StandardModal/index.js +25 -39
  102. package/es/StandardPanel/index.d.ts +1 -1
  103. package/es/StandardPanel/index.js +7 -7
  104. package/es/StandardTable/index.d.ts +1 -0
  105. package/es/StandardTable/index.js +44 -26
  106. package/es/components/IconNode/index.d.ts +1 -1
  107. package/es/components/IconNode/index.js +0 -1
  108. package/es/data/general.config.js +31 -0
  109. package/es/index.d.ts +3 -1
  110. package/es/index.js +6 -2
  111. package/es/utils/filterPermission.js +7 -10
  112. package/es/utils/getParentNodes.js +101 -26
  113. package/es/utils/index.js +2 -3
  114. package/es/utils/urlUtils.js +76 -0
  115. package/lib/ButtonGroup/ButtonList.d.ts +2 -1
  116. package/lib/ButtonGroup/ButtonList.js +2 -3
  117. package/lib/ButtonGroup/ButtonMenu.d.ts +2 -1
  118. package/lib/ButtonGroup/ButtonMenu.js +2 -3
  119. package/lib/ButtonGroup/PopConfirmTitle.js +7 -8
  120. package/lib/ButtonGroup/index.d.ts +3 -1
  121. package/lib/ButtonGroup/index.js +150 -185
  122. package/lib/ButtonGroup/style/index.less +4 -1
  123. package/lib/CalendarCoordPicker/CalendarMonthPicker.d.ts +5 -0
  124. package/lib/CalendarCoordPicker/CalendarMonthPicker.js +36 -0
  125. package/lib/CalendarCoordPicker/index.d.ts +8 -0
  126. package/lib/CalendarCoordPicker/index.js +305 -0
  127. package/lib/CalendarCoordPicker/index.less +31 -0
  128. package/lib/ConfigContext/index.d.ts +7 -0
  129. package/lib/ConfigContext/index.js +17 -0
  130. package/lib/DragContent/DragBar.js +2 -3
  131. package/lib/DragContent/index.d.ts +1 -1
  132. package/lib/DragContent/index.js +9 -10
  133. package/lib/FormComp/ChunkUploader/api.js +15 -15
  134. package/lib/FormComp/ChunkUploader/index.js +135 -142
  135. package/lib/FormComp/ChunkUploader/lib.js +22 -22
  136. package/lib/FormComp/ChunkUploader/upload-queue.class.js +66 -69
  137. package/lib/FormComp/ChunkUploader/worker.js +1 -1
  138. package/lib/FormComp/EditButton/index.d.ts +1 -1
  139. package/lib/FormComp/EditButton/index.js +19 -22
  140. package/lib/FormComp/FieldComponent/ReUpload.d.ts +1 -1
  141. package/lib/FormComp/FieldComponent/ReUpload.js +40 -28
  142. package/lib/FormComp/FieldComponent/RefactorTextarea.js +42 -0
  143. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +75 -23
  144. package/lib/FormComp/FieldComponent/TitleNode.d.ts +2 -1
  145. package/lib/FormComp/FieldComponent/TitleNode.js +2 -3
  146. package/lib/FormComp/FieldComponent/index.d.ts +1 -1
  147. package/lib/FormComp/FieldComponent/index.js +38 -26
  148. package/lib/FormComp/FieldComponent/setReadonlyValues.js +15 -20
  149. package/lib/FormComp/RenderItemGroup/index.js +26 -11
  150. package/lib/FormComp/Uploader/index.d.ts +3 -1
  151. package/lib/FormComp/Uploader/index.js +244 -123
  152. package/lib/FormComp/VarTemplate/index.js +63 -71
  153. package/lib/FormComp/index.js +1 -1
  154. package/lib/ImageGallery/ImagePreview.d.ts +13 -0
  155. package/lib/ImageGallery/ImagePreview.js +178 -0
  156. package/lib/ImageGallery/PreviewStyles/ImagePreview.less +730 -0
  157. package/lib/ImageGallery/PreviewStyles/fonts/lg.svg +54 -0
  158. package/lib/ImageGallery/PreviewStyles/fonts/lg.ttf +0 -0
  159. package/lib/ImageGallery/PreviewStyles/fonts/lg.woff +0 -0
  160. package/lib/ImageGallery/PreviewStyles/fonts/lg.woff2 +0 -0
  161. package/lib/ImageGallery/PreviewStyles/lg-thumbnail.css +108 -0
  162. package/lib/ImageGallery/PreviewStyles/lg-video.css +144 -0
  163. package/lib/ImageGallery/PreviewStyles/lg-zoom.css +116 -0
  164. package/lib/ImageGallery/PreviewStyles/lightgallery.css +728 -0
  165. package/lib/ImageGallery/SliderContent.d.ts +7 -0
  166. package/lib/ImageGallery/SliderContent.js +708 -0
  167. package/lib/ImageGallery/Thumbnail.d.ts +3 -0
  168. package/lib/ImageGallery/Thumbnail.js +306 -0
  169. package/lib/ImageGallery/hook/uniqueId.d.ts +1 -0
  170. package/lib/ImageGallery/hook/uniqueId.js +17 -0
  171. package/lib/ImageGallery/index.d.ts +4 -0
  172. package/lib/ImageGallery/index.js +36 -0
  173. package/lib/ImageGallery/style/index.less +5 -0
  174. package/lib/ImageGallery/types.d.ts +5 -0
  175. package/lib/ImageGallery/types.js +5 -0
  176. package/lib/NavLeafScroll/index.js +98 -55
  177. package/lib/RefactorTree/index.d.ts +1 -1
  178. package/lib/RefactorTree/index.js +10 -11
  179. package/lib/RefactorTree/indexTreeNode.d.ts +1 -1
  180. package/lib/RefactorTree/indexTreeNode.js +23 -22
  181. package/lib/RefactorTree/util.js +18 -18
  182. package/lib/SpecIcon/fonts/demo_index.html +559 -5
  183. package/lib/SpecIcon/fonts/iconfont.css +101 -3
  184. package/lib/SpecIcon/fonts/iconfont.js +34 -27
  185. package/lib/SpecIcon/fonts/iconfont.json +168 -0
  186. package/lib/SpecIcon/fonts/iconfont.svg +163 -171
  187. package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
  188. package/lib/SpecIcon/fonts/iconfont.woff +0 -0
  189. package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
  190. package/lib/SpecIcon/index.js +2 -3
  191. package/lib/SpecIcon/style/iconfont.less +106 -11
  192. package/lib/SplitterLayout/Pane.d.ts +1 -1
  193. package/lib/SplitterLayout/Pane.js +2 -3
  194. package/lib/SplitterLayout/index.js +27 -29
  195. package/lib/StandardContent/SplitterLayout/Pane.js +5 -6
  196. package/lib/StandardContent/SplitterLayout/index.js +27 -29
  197. package/lib/StandardContent/SubfieldContent.d.ts +1 -1
  198. package/lib/StandardContent/SubfieldContent.js +2 -3
  199. package/lib/StandardContent/WrapperContent.d.ts +1 -1
  200. package/lib/StandardContent/WrapperContent.js +2 -3
  201. package/lib/StandardDragModal/index.d.ts +11 -3
  202. package/lib/StandardDragModal/index.js +27 -33
  203. package/lib/StandardFilter/index.d.ts +5 -16
  204. package/lib/StandardFilter/index.js +215 -201
  205. package/lib/StandardFilter/indexClass.d.ts +37 -0
  206. package/lib/StandardFilter/indexClass.js +223 -0
  207. package/lib/StandardFilter/style/index.less +82 -9
  208. package/lib/StandardForm/ActionList.js +2 -3
  209. package/lib/StandardForm/StepForm.d.ts +1 -1
  210. package/lib/StandardForm/StepForm.js +32 -27
  211. package/lib/StandardForm/TabForm.d.ts +1 -1
  212. package/lib/StandardForm/TabForm.js +45 -48
  213. package/lib/StandardForm/index.d.ts +1 -1
  214. package/lib/StandardForm/index.js +9 -10
  215. package/lib/StandardModal/UpdateFormRef.js +3 -4
  216. package/lib/StandardModal/index.d.ts +2 -1
  217. package/lib/StandardModal/index.js +29 -43
  218. package/lib/StandardPanel/index.d.ts +1 -1
  219. package/lib/StandardPanel/index.js +11 -12
  220. package/lib/StandardTable/index.d.ts +1 -0
  221. package/lib/StandardTable/index.js +49 -29
  222. package/lib/components/IconNode/index.d.ts +1 -1
  223. package/lib/components/IconNode/index.js +2 -4
  224. package/lib/components/index.js +1 -1
  225. package/lib/data/func.code.js +2 -3
  226. package/lib/data/general.config.js +33 -3
  227. package/lib/data/index.js +1 -1
  228. package/lib/index.d.ts +3 -1
  229. package/lib/index.js +30 -10
  230. package/lib/utils/ValueFormat.js +1 -2
  231. package/lib/utils/filterPermission.js +11 -18
  232. package/lib/utils/getParentNodes.js +103 -29
  233. package/lib/utils/index.js +5 -27
  234. package/lib/utils/urlUtils.js +82 -0
  235. package/package.json +14 -9
  236. package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
  237. package/dist/fonts/iconfont.eot +0 -0
  238. package/es/StandardDragModal/ChangeStandardModal.d.ts +0 -44
  239. package/es/StandardDragModal/ChangeStandardModal.js +0 -493
  240. package/es/StandardDragModal/DraggableModal.d.ts +0 -7
  241. package/es/StandardDragModal/DraggableModal.js +0 -31
  242. package/es/StandardDragModal/DraggableModalContext.d.ts +0 -9
  243. package/es/StandardDragModal/DraggableModalContext.js +0 -5
  244. package/es/StandardDragModal/DraggableModalInner.d.ts +0 -16
  245. package/es/StandardDragModal/DraggableModalInner.js +0 -114
  246. package/es/StandardDragModal/DraggableModalProvider.d.ts +0 -4
  247. package/es/StandardDragModal/DraggableModalProvider.js +0 -40
  248. package/es/StandardDragModal/Modal.d.ts +0 -11
  249. package/es/StandardDragModal/Modal.js +0 -24
  250. package/es/StandardDragModal/ResizeHandle.d.ts +0 -2
  251. package/es/StandardDragModal/ResizeHandle.js +0 -8
  252. package/es/StandardDragModal/clamp.d.ts +0 -1
  253. package/es/StandardDragModal/clamp.js +0 -3
  254. package/es/StandardDragModal/draggableModalReducer.d.ts +0 -66
  255. package/es/StandardDragModal/draggableModalReducer.js +0 -157
  256. package/es/StandardDragModal/getWindowSize.d.ts +0 -4
  257. package/es/StandardDragModal/getWindowSize.js +0 -6
  258. package/es/StandardDragModal/index.less +0 -65
  259. package/es/StandardDragModal/useDrag.d.ts +0 -5
  260. package/es/StandardDragModal/useDrag.js +0 -66
  261. package/es/StandardDragModal/usePrevious.d.ts +0 -1
  262. package/es/StandardDragModal/usePrevious.js +0 -8
  263. package/es/StandardDragModal/useResize.d.ts +0 -7
  264. package/es/StandardDragModal/useResize.js +0 -74
  265. package/es/utils/dictSelectUtil.js +0 -153
  266. package/lib/StandardDragModal/ChangeStandardModal.d.ts +0 -44
  267. package/lib/StandardDragModal/ChangeStandardModal.js +0 -502
  268. package/lib/StandardDragModal/DraggableModal.d.ts +0 -7
  269. package/lib/StandardDragModal/DraggableModal.js +0 -40
  270. package/lib/StandardDragModal/DraggableModalContext.d.ts +0 -9
  271. package/lib/StandardDragModal/DraggableModalContext.js +0 -15
  272. package/lib/StandardDragModal/DraggableModalInner.d.ts +0 -16
  273. package/lib/StandardDragModal/DraggableModalInner.js +0 -124
  274. package/lib/StandardDragModal/DraggableModalProvider.d.ts +0 -4
  275. package/lib/StandardDragModal/DraggableModalProvider.js +0 -48
  276. package/lib/StandardDragModal/Modal.d.ts +0 -11
  277. package/lib/StandardDragModal/Modal.js +0 -32
  278. package/lib/StandardDragModal/ResizeHandle.d.ts +0 -2
  279. package/lib/StandardDragModal/ResizeHandle.js +0 -18
  280. package/lib/StandardDragModal/clamp.d.ts +0 -1
  281. package/lib/StandardDragModal/clamp.js +0 -10
  282. package/lib/StandardDragModal/draggableModalReducer.d.ts +0 -66
  283. package/lib/StandardDragModal/draggableModalReducer.js +0 -167
  284. package/lib/StandardDragModal/getWindowSize.d.ts +0 -4
  285. package/lib/StandardDragModal/getWindowSize.js +0 -13
  286. package/lib/StandardDragModal/index.less +0 -65
  287. package/lib/StandardDragModal/useDrag.d.ts +0 -5
  288. package/lib/StandardDragModal/useDrag.js +0 -73
  289. package/lib/StandardDragModal/usePrevious.d.ts +0 -1
  290. package/lib/StandardDragModal/usePrevious.js +0 -15
  291. package/lib/StandardDragModal/useResize.d.ts +0 -7
  292. package/lib/StandardDragModal/useResize.js +0 -81
  293. package/lib/utils/dictSelectUtil.js +0 -161
@@ -0,0 +1,699 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ /* eslint-disable */
8
+ import React, { useRef, useEffect, useState, useCallback } from 'react';
9
+ import classNames from "classnames";
10
+ var isDraging = false;
11
+ var startCoords = {
12
+ pageX: 0,
13
+ pageY: 0
14
+ };
15
+ var endCoords = {
16
+ pageX: 0,
17
+ pageY: 0
18
+ };
19
+ var isMoved = false;
20
+ // @ts-ignore
21
+ var dragOrSwipeEnabled = false;
22
+ var isSwiping = false;
23
+ var settings = {
24
+ numberOfSlideItemsInDom: 10,
25
+ swipeThreshold: 50,
26
+ closable: true,
27
+ enableDrag: true,
28
+ swipeToClose: true,
29
+ speed: 400,
30
+ // mode: 'lg-slide',
31
+ slideDelay: 0,
32
+ loop: true,
33
+ slideEndAnimation: true,
34
+ counter: true
35
+ };
36
+ var touchAction = 'swipe'; // 'swipe' | 'zoomSwipe' | 'pinch'
37
+ var swipeDirection = 'horizontal';
38
+ var lgBusy = false;
39
+ // let eventTrigger = '' // 当前点击的类型
40
+ // let currentItemsInDom: any[]
41
+ var SliderContent = function SliderContent(props) {
42
+ var thumbCurrent = props.thumbCurrent,
43
+ hasThumbnail = props.hasThumbnail,
44
+ children = props.children,
45
+ galleryCount = props.galleryCount,
46
+ coreId = props.coreId,
47
+ outerRef = props.outerRef,
48
+ onUpdateTurning = props.onUpdateTurning,
49
+ onClose = props.onClose;
50
+ var $sliderOuter = useRef();
51
+ var $itemsRef = useRef([]);
52
+ var _useState = useState(-1),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ thisIndex = _useState2[0],
55
+ setThisIndex = _useState2[1];
56
+ var init = function init() {
57
+ setTimeout(function () {
58
+ enableDrag();
59
+ enableSwipe();
60
+ triggerPosterClick();
61
+ }, 50);
62
+ };
63
+ useEffect(function () {
64
+ init();
65
+ }, []);
66
+ useEffect(function () {
67
+ setThisIndex(thumbCurrent);
68
+ }, [thumbCurrent]);
69
+ var enableDrag = function enableDrag() {
70
+ startCoords = {
71
+ pageX: 0,
72
+ pageY: 0
73
+ };
74
+ endCoords = {
75
+ pageX: 0,
76
+ pageY: 0
77
+ };
78
+ isDraging = false;
79
+ isMoved = false;
80
+ };
81
+ var enableSwipe = function enableSwipe() {
82
+ startCoords = {
83
+ pageX: 0,
84
+ pageY: 0
85
+ };
86
+ endCoords = {
87
+ pageX: 0,
88
+ pageY: 0
89
+ };
90
+ isMoved = false;
91
+ isSwiping = false;
92
+ };
93
+ var triggerPosterClick = function triggerPosterClick() {
94
+ // 判断 视频点击
95
+ // this.$inner.on('click.lg', (event) => {
96
+ // if (
97
+ // !this.dragOrSwipeEnabled &&
98
+ // this.isPosterElement($LG(event.target))
99
+ // ) {
100
+ // this.LGel.trigger(lGEvents.posterClick);
101
+ // }
102
+ // });
103
+ };
104
+ var onPreviewClick = function onPreviewClick() {
105
+ if (!dragOrSwipeEnabled) {}
106
+ };
107
+ // @ts-ignore
108
+ var onPreviewMouseDown = function onPreviewMouseDown(e) {
109
+ var _a;
110
+ dragOrSwipeEnabled = true;
111
+ var $item = getSlideItem(thisIndex);
112
+ // @ts-ignore
113
+ if ((_a = $item === null || $item === void 0 ? void 0 : $item.contains) === null || _a === void 0 ? void 0 : _a.call($item, e.target)) {
114
+ e.preventDefault();
115
+ if (!lgBusy) {
116
+ manageSwipeClass();
117
+ startCoords = {
118
+ pageX: e.pageX,
119
+ pageY: e.pageY
120
+ };
121
+ isDraging = true;
122
+ // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
123
+ // this.outer.get().scrollLeft += 1;
124
+ // this.outer.get().scrollLeft -= 1;
125
+ outerRef === null || outerRef === void 0 ? void 0 : outerRef.current.classList.remove('spec-image-preview-grab');
126
+ outerRef === null || outerRef === void 0 ? void 0 : outerRef.current.classList.add('spec-image-preview-grabbing');
127
+ // *
128
+ }
129
+ }
130
+ };
131
+ // @ts-ignore
132
+ var onPreviewMouseMove = function onPreviewMouseMove(e) {
133
+ // console.log('判断鼠标往左还是往右', e)
134
+ if (isDraging) {
135
+ isMoved = true;
136
+ endCoords = {
137
+ pageX: e.pageX,
138
+ pageY: e.pageY
139
+ };
140
+ touchMove(startCoords, endCoords);
141
+ }
142
+ };
143
+ // @ts-ignore
144
+ var onPreviewMouseUp = function onPreviewMouseUp(event) {
145
+ if (isMoved) {
146
+ isMoved = false;
147
+ touchEnd(endCoords, startCoords, event);
148
+ } else {
149
+ // 没有移动且当前点击的不是img标签,则直接关闭
150
+ if (event.target.tagName !== 'IMG') {
151
+ onClose === null || onClose === void 0 ? void 0 : onClose();
152
+ }
153
+ }
154
+ // Prevent execution on click
155
+ if (isDraging) {
156
+ isDraging = false;
157
+ outerRef === null || outerRef === void 0 ? void 0 : outerRef.current.classList.remove('spec-image-preview-grabbing');
158
+ outerRef === null || outerRef === void 0 ? void 0 : outerRef.current.classList.add('spec-image-preview-grab');
159
+ }
160
+ };
161
+ var onMouseWheel = useCallback(function (e) {
162
+ if (!e.deltaY || galleryCount < 2) {
163
+ return;
164
+ }
165
+ e.preventDefault();
166
+ var lastCall = 0;
167
+ var now = new Date().getTime();
168
+ if (now - lastCall < 1000) {
169
+ return;
170
+ }
171
+ // @ts-ignore
172
+ lastCall = now;
173
+ if (e.deltaY > 0) {
174
+ goToNextSlide();
175
+ } else if (e.deltaY < 0) {
176
+ goToPrevSlide();
177
+ }
178
+ }, [thisIndex]);
179
+ var onTouchStart = function onTouchStart(e) {
180
+ var _a;
181
+ dragOrSwipeEnabled = true;
182
+ var $item = getSlideItem(thisIndex);
183
+ // @ts-ignore
184
+ if (((_a = $item === null || $item === void 0 ? void 0 : $item.contains) === null || _a === void 0 ? void 0 : _a.call($item, e.target)) && e.touches.length === 1) {
185
+ isSwiping = true;
186
+ touchAction = 'swipe';
187
+ manageSwipeClass();
188
+ startCoords = {
189
+ pageX: e.touches[0].pageX,
190
+ pageY: e.touches[0].pageY
191
+ };
192
+ }
193
+ };
194
+ // @ts-ignore
195
+ var onTouchMove = function onTouchMove(e) {
196
+ if (isSwiping && touchAction === 'swipe' && e.touches.length === 1) {
197
+ endCoords = {
198
+ pageX: e.touches[0].pageX,
199
+ pageY: e.touches[0].pageY
200
+ };
201
+ touchMove(startCoords, endCoords, e);
202
+ isMoved = true;
203
+ }
204
+ };
205
+ // @ts-ignore
206
+ var onTouchEnd = function onTouchEnd(event) {
207
+ if (touchAction === 'swipe') {
208
+ if (isMoved) {
209
+ isMoved = false;
210
+ touchEnd(endCoords, startCoords, event);
211
+ } else if (isSwiping) {
212
+ // const target = $LG(event.target);
213
+ // if (this.isPosterElement(target)) {
214
+ // this.LGel.trigger(lGEvents.posterClick);
215
+ // }
216
+ }
217
+ touchAction = undefined;
218
+ isSwiping = false;
219
+ }
220
+ };
221
+ var touchMove = function touchMove(startCoords, endCoords, e) {
222
+ var _a, _b, _c, _d;
223
+ var distanceX = endCoords.pageX - startCoords.pageX;
224
+ var distanceY = endCoords.pageY - startCoords.pageY;
225
+ var allowSwipe = false;
226
+ if (swipeDirection) {
227
+ allowSwipe = true;
228
+ } else {
229
+ if (Math.abs(distanceX) > 15) {
230
+ // 向水平左右
231
+ swipeDirection = 'horizontal';
232
+ allowSwipe = true;
233
+ } else if (Math.abs(distanceY) > 15) {
234
+ // 向垂直上下(功能未实现)
235
+ swipeDirection = 'vertical';
236
+ allowSwipe = true;
237
+ }
238
+ }
239
+ if (!allowSwipe) {
240
+ return;
241
+ }
242
+ var $currentSlide = getSlideItem(thisIndex);
243
+ if (swipeDirection === 'horizontal') {
244
+ e === null || e === void 0 ? void 0 : e.preventDefault();
245
+ // reset opacity and transition duration
246
+ outerRef.current.classList.add('spec-image-preview-dragging');
247
+ // move current slide
248
+ setTranslate($currentSlide, distanceX, 0);
249
+ // move next and prev slide with current slide
250
+ // @ts-ignore
251
+ var width = $currentSlide.offsetWidth;
252
+ var slideWidthAmount = width * 15 / 100;
253
+ var gutter = slideWidthAmount - Math.abs(distanceX * 10 / 100);
254
+ var queryFirstPrev = (_b = (_a = outerRef === null || outerRef === void 0 ? void 0 : outerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.spec-image-preview-prev-slide')) === null || _b === void 0 ? void 0 : _b[0];
255
+ var queryFirstNext = (_d = (_c = outerRef === null || outerRef === void 0 ? void 0 : outerRef.current) === null || _c === void 0 ? void 0 : _c.querySelectorAll('.spec-image-preview-next-slide')) === null || _d === void 0 ? void 0 : _d[0];
256
+ setTranslate(queryFirstPrev, -width + distanceX - gutter, 0);
257
+ setTranslate(queryFirstNext, width + distanceX + gutter, 0);
258
+ } else if (swipeDirection === 'vertical') {
259
+ // if (settings.swipeToClose) {
260
+ // e?.preventDefault();
261
+ // this.$container.addClass('lg-dragging-vertical');
262
+ //
263
+ // const opacity = 1 - Math.abs(distanceY) / window.innerHeight;
264
+ // this.$backdrop.css('opacity', opacity);
265
+ //
266
+ // const scale = 1 - Math.abs(distanceY) / (window.innerWidth * 2);
267
+ // this.setTranslate($currentSlide, 0, distanceY, scale, scale);
268
+ // if (Math.abs(distanceY) > 100) {
269
+ // this.outer
270
+ // .addClass('lg-hide-items')
271
+ // .removeClass('lg-components-open');
272
+ // }
273
+ // }
274
+ }
275
+ };
276
+ var touchEnd = function touchEnd(endCoords, startCoords, event) {
277
+ var distance;
278
+ // keep slide animation for any mode while dragg/swipe
279
+ outerRef.current.classList.add('spec-image-preview-slide');
280
+ // set transition duration
281
+ setTimeout(function () {
282
+ outerRef === null || outerRef === void 0 ? void 0 : outerRef.current.classList.remove('spec-image-preview-dragging-vertical');
283
+ outerRef === null || outerRef === void 0 ? void 0 : outerRef.current.classList.remove('spec-image-preview-dragging');
284
+ outerRef === null || outerRef === void 0 ? void 0 : outerRef.current.classList.remove('spec-image-preview-hide-items');
285
+ outerRef === null || outerRef === void 0 ? void 0 : outerRef.current.classList.add('spec-image-preview-components-open');
286
+ var triggerClick = true;
287
+ if (swipeDirection === 'horizontal') {
288
+ distance = endCoords.pageX - startCoords.pageX;
289
+ var distanceAbs = Math.abs(endCoords.pageX - startCoords.pageX);
290
+ if (distance < 0 && distanceAbs > settings.swipeThreshold) {
291
+ goToNextSlide(true);
292
+ triggerClick = false;
293
+ } else if (distance > 0 && distanceAbs > settings.swipeThreshold) {
294
+ goToPrevSlide(true);
295
+ triggerClick = false;
296
+ }
297
+ } else if (swipeDirection === 'vertical') {
298
+ // distance = Math.abs(endCoords.pageY - startCoords.pageY);
299
+ // if (
300
+ // settings.closable &&
301
+ // settings.swipeToClose &&
302
+ // distance > 100
303
+ // ) {
304
+ // closeGallery();
305
+ // return;
306
+ // } else {
307
+ // $backdrop.css('opacity', 1);
308
+ // }
309
+ }
310
+ // this.outer.find('.lg-item').removeAttr('style');
311
+ // outerRef?.current?.querySelectorAll('.spec-image-preview-item')
312
+ $itemsRef.current.forEach(function (item) {
313
+ // item?.classList?.remove('spec-image-preview-prev-slide')
314
+ // item?.classList?.remove('spec-image-preview-next-slide')
315
+ // console.log('移除行内样式', item)
316
+ item.style = '';
317
+ });
318
+ if (triggerClick && Math.abs(endCoords.pageX - startCoords.pageX) < 5) {
319
+ // console.log('Trigger click if distance is less than 5 pix')
320
+ // Trigger click if distance is less than 5 pix
321
+ // const target = $LG(event.target);
322
+ // if (this.isPosterElement(target)) {
323
+ // this.LGel.trigger(lGEvents.posterClick);
324
+ // }
325
+ }
326
+ swipeDirection = '';
327
+ });
328
+ // remove slide class once drag/swipe is completed if mode is not slide
329
+ setTimeout(function () {
330
+ var _a, _b;
331
+ if (!((_a = outerRef === null || outerRef === void 0 ? void 0 : outerRef.current) === null || _a === void 0 ? void 0 : _a.classList.contains('spec-image-preview-dragging'))) {
332
+ (_b = outerRef === null || outerRef === void 0 ? void 0 : outerRef.current) === null || _b === void 0 ? void 0 : _b.classList.remove('spec-image-preview-slide');
333
+ }
334
+ }, settings.speed + 100);
335
+ };
336
+ var setTranslate = function setTranslate($el, xValue, yValue) {
337
+ var scaleX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
338
+ var scaleY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
339
+ if (!$el) return;
340
+ $el.style.transform = 'translate3d(' + xValue + 'px, ' + yValue + 'px, 0px) scale3d(' + scaleX + ', ' + scaleY + ', 1)';
341
+ };
342
+ var makeSlideAnimation = function makeSlideAnimation(direction, currentSlideItem, previousSlideItem) {
343
+ previousSlideItem.classList.add('spec-image-preview-slide-progress');
344
+ setTimeout(function () {
345
+ // remove all transitions
346
+ outerRef.current.classList.add('spec-image-preview-no-trans');
347
+ $itemsRef.current.forEach(function (item) {
348
+ var _a, _b;
349
+ (_a = item === null || item === void 0 ? void 0 : item.classList) === null || _a === void 0 ? void 0 : _a.remove('spec-image-preview-prev-slide');
350
+ (_b = item === null || item === void 0 ? void 0 : item.classList) === null || _b === void 0 ? void 0 : _b.remove('spec-image-preview-next-slide');
351
+ });
352
+ if (direction === 'prev') {
353
+ // prev slide
354
+ currentSlideItem.classList.add('spec-image-preview-prev-slide');
355
+ previousSlideItem.classList.add('spec-image-preview-next-slide');
356
+ } else {
357
+ // next slide
358
+ currentSlideItem.classList.add('spec-image-preview-next-slide');
359
+ previousSlideItem.classList.add('spec-image-preview-prev-slide');
360
+ }
361
+ // give 50 ms for browser to add/remove class
362
+ setTimeout(function () {
363
+ $itemsRef.current.forEach(function (item) {
364
+ var _a;
365
+ (_a = item === null || item === void 0 ? void 0 : item.classList) === null || _a === void 0 ? void 0 : _a.remove('spec-image-preview-current');
366
+ });
367
+ currentSlideItem.classList.add('spec-image-preview-current');
368
+ // reset all transitions
369
+ outerRef.current.classList.remove('spec-image-preview-no-trans');
370
+ }, 50);
371
+ }, settings.slideDelay);
372
+ };
373
+ /**
374
+ * Get previous index of the slide
375
+ */
376
+ var getPreviousSlideIndex = function getPreviousSlideIndex() {
377
+ var _a;
378
+ var prevIndex = 0;
379
+ try {
380
+ var firstNode = (_a = outerRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.spec-image-preview-current')[0];
381
+ var currentItemId = firstNode === null || firstNode === void 0 ? void 0 : firstNode.getAttribute('id');
382
+ // console.log('currentItemId', currentItemId, currentItemId.split('-'))
383
+ var clsArr = currentItemId.split('-');
384
+ prevIndex = parseInt(clsArr[clsArr.length - 1]) || 0;
385
+ } catch (error) {
386
+ prevIndex = 0;
387
+ }
388
+ return prevIndex;
389
+ };
390
+ /**
391
+ * Go to next slide
392
+ * @param {Boolean} fromTouch - true if slide function called via touch event
393
+ * @category lGPublicMethods
394
+ * @example
395
+ * const plugin = lightGallery();
396
+ * plugin.goToNextSlide();
397
+ * @see <a href="/demos/methods/">Demo</a>
398
+ */
399
+ var goToNextSlide = function goToNextSlide(fromTouch) {
400
+ var _loop = settings.loop;
401
+ if (fromTouch && galleryCount < 3) {
402
+ _loop = false;
403
+ }
404
+ if (!lgBusy) {
405
+ if (thisIndex + 1 < galleryCount) {
406
+ thisIndex++;
407
+ // this.LGel.trigger(lGEvents.beforeNextSlide, {
408
+ // index: thisIndex,
409
+ // });
410
+ slide(thisIndex, !!fromTouch, false, 'next');
411
+ } else {
412
+ if (_loop) {
413
+ thisIndex = 0;
414
+ // this.LGel.trigger(lGEvents.beforeNextSlide, {
415
+ // index: thisIndex,
416
+ // });
417
+ slide(thisIndex, !!fromTouch, false, 'next');
418
+ } else if (settings.slideEndAnimation && !fromTouch) {
419
+ outerRef.current.classList.add('spec-image-preview-right-end');
420
+ setTimeout(function () {
421
+ outerRef.current.classList.remove('spec-image-preview-right-end');
422
+ }, 400);
423
+ }
424
+ }
425
+ }
426
+ };
427
+ /**
428
+ * Go to previous slides
429
+ * @param {Boolean} fromTouch - true if slide function called via touch event
430
+ * @category lGPublicMethods
431
+ * @example
432
+ * const plugin = lightGallery({});
433
+ * plugin.goToPrevSlide();
434
+ * @see <a href="/demos/methods/">Demo</a>
435
+ *
436
+ */
437
+ var goToPrevSlide = function goToPrevSlide(fromTouch) {
438
+ var _loop = settings.loop;
439
+ if (fromTouch && galleryCount < 3) {
440
+ _loop = false;
441
+ }
442
+ if (!lgBusy) {
443
+ if (thisIndex > 0) {
444
+ thisIndex--;
445
+ // this.LGel.trigger(lGEvents.beforePrevSlide, {
446
+ // index: thisIndex,
447
+ // fromTouch,
448
+ // });
449
+ slide(thisIndex, !!fromTouch, false, 'prev');
450
+ } else {
451
+ if (_loop) {
452
+ thisIndex = galleryCount - 1;
453
+ // this.LGel.trigger(lGEvents.beforePrevSlide, {
454
+ // index: thisIndex,
455
+ // fromTouch,
456
+ // });
457
+ slide(thisIndex, !!fromTouch, false, 'prev');
458
+ } else if (settings.slideEndAnimation && !fromTouch) {
459
+ outerRef.current.classList.add('spec-image-preview-left-end');
460
+ setTimeout(function () {
461
+ outerRef.current.classList.remove('spec-image-preview-left-end');
462
+ }, 400);
463
+ }
464
+ }
465
+ }
466
+ };
467
+ /**
468
+ * Goto a specific slide.
469
+ * @param {Number} index - index of the slide
470
+ * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag
471
+ * @param {Boolean} fromThumb - true if slide function called via thumbnail click
472
+ * @param {String} direction - Direction of the slide(next/prev)
473
+ * @category lGPublicMethods
474
+ * @example
475
+ * const plugin = lightGallery();
476
+ * // to go to 3rd slide
477
+ * plugin.slide(2);
478
+ *
479
+ */
480
+ var slide = function slide(index, fromTouch, fromThumb, direction) {
481
+ var _a;
482
+ var prevIndex = getPreviousSlideIndex();
483
+ // // Prevent multiple call, Required for hsh plugin
484
+ if (prevIndex === index) {
485
+ return;
486
+ }
487
+ //
488
+ var numberOfGalleryItems = galleryCount; // this.galleryItems.length;
489
+ if (!lgBusy) {
490
+ var currentSlideItem = getSlideItem(index);
491
+ var previousSlideItem = getSlideItem(prevIndex);
492
+ var currentGalleryItem = (_a = $itemsRef === null || $itemsRef === void 0 ? void 0 : $itemsRef.current) === null || _a === void 0 ? void 0 : _a[index]; // this.galleryItems[index];
493
+ // const videoInfo = currentGalleryItem.__slideVideoInfo;
494
+ // console.log('currentGalleryItem', currentGalleryItem)
495
+ // outerRef.current.setAttribute('data-lg-slide-type', getSlideType(currentGalleryItem)) // 设置当前播放的类型
496
+ outerRef.current.setAttribute('data-lg-slide-type', getSlideType(currentGalleryItem)); // TODO.暂时返回image
497
+ // this.outer.attr(
498
+ // 'data-lg-slide-type',
499
+ // this.getSlideType(currentGalleryItem),
500
+ // );
501
+ // this.setDownloadValue(index);
502
+ // 判断是否是视频
503
+ // if (videoInfo) {
504
+ // const { top, bottom } = this.mediaContainerPosition;
505
+ // const videoSize = utils.getSize(
506
+ // this.items[index],
507
+ // this.outer,
508
+ // top + bottom,
509
+ // videoInfo && this.settings.videoMaxSize,
510
+ // );
511
+ // this.resizeVideoSlide(index, videoSize);
512
+ // }
513
+ // this.LGel.trigger<BeforeSlideDetail>(lGEvents.beforeSlide, {
514
+ // prevIndex,
515
+ // index,
516
+ // fromTouch: !!fromTouch,
517
+ // fromThumb: !!fromThumb,
518
+ // });
519
+ lgBusy = true;
520
+ // clearTimeout(this.hideBarTimeout);
521
+ // this.arrowDisable(index);
522
+ if (!direction) {
523
+ if (index < prevIndex) {
524
+ direction = 'prev';
525
+ } else if (index > prevIndex) {
526
+ direction = 'next';
527
+ }
528
+ }
529
+ if (!fromTouch) {
530
+ makeSlideAnimation(direction, currentSlideItem, previousSlideItem);
531
+ } else {
532
+ // $itemsRef.current.forEach((item: any) => {
533
+ // item?.classList?.remove('spec-image-preview-prev-slide')
534
+ // item?.classList?.remove('spec-image-preview-next-slide')
535
+ // item?.classList?.remove('spec-image-preview-current')
536
+ // })
537
+ $itemsRef.current.forEach(function (item) {
538
+ var _a, _b, _c;
539
+ (_a = item === null || item === void 0 ? void 0 : item.classList) === null || _a === void 0 ? void 0 : _a.remove('spec-image-preview-prev-slide');
540
+ (_b = item === null || item === void 0 ? void 0 : item.classList) === null || _b === void 0 ? void 0 : _b.remove('spec-image-preview-next-slide');
541
+ (_c = item === null || item === void 0 ? void 0 : item.classList) === null || _c === void 0 ? void 0 : _c.remove('spec-image-preview-current');
542
+ });
543
+ var touchPrev;
544
+ var touchNext;
545
+ if (numberOfGalleryItems > 2) {
546
+ touchPrev = index - 1;
547
+ touchNext = index + 1;
548
+ if (index === 0 && prevIndex === numberOfGalleryItems - 1) {
549
+ // next slide
550
+ touchNext = 0;
551
+ touchPrev = numberOfGalleryItems - 1;
552
+ } else if (index === numberOfGalleryItems - 1 && prevIndex === 0) {
553
+ // prev slide
554
+ touchNext = 0;
555
+ touchPrev = numberOfGalleryItems - 1;
556
+ }
557
+ } else {
558
+ touchPrev = 0;
559
+ touchNext = 1;
560
+ }
561
+ if (direction === 'prev') {
562
+ // @ts-ignore
563
+ getSlideItem(touchNext).classList.add('spec-image-preview-next-slide');
564
+ } else {
565
+ // @ts-ignore
566
+ getSlideItem(touchPrev).classList.add('spec-image-preview-prev-slide');
567
+ }
568
+ // @ts-ignore
569
+ currentSlideItem.classList.add('spec-image-preview-current');
570
+ }
571
+ // // Do not put load content in set timeout as it needs to load immediately when the gallery is opened
572
+ setTimeout(function () {
573
+ lgBusy = false;
574
+ // @ts-ignore
575
+ previousSlideItem.classList.remove('spec-image-preview-slide-progress');
576
+ // this.LGel.trigger(lGEvents.afterSlide, {
577
+ // prevIndex: prevIndex,
578
+ // index,
579
+ // fromTouch,
580
+ // fromThumb,
581
+ // });
582
+ }, settings.speed + 100 + (fromTouch ? 0 : settings.slideDelay));
583
+ }
584
+ thisIndex = index;
585
+ // 更新最新的选中
586
+ onUpdateTurning === null || onUpdateTurning === void 0 ? void 0 : onUpdateTurning(index);
587
+ };
588
+ var getSlideItem = function getSlideItem(index) {
589
+ return $itemsRef === null || $itemsRef === void 0 ? void 0 : $itemsRef.current[index];
590
+ // return document.getElementById(getSlideItemId(index));
591
+ };
592
+ // const getSlideItemId = (index: number): string => {
593
+ // return `${coreId}-item-${index}`;
594
+ // }
595
+ // console.log('$itemsRef', $itemsRef)
596
+ var manageSwipeClass = function manageSwipeClass() {
597
+ var _a, _b;
598
+ var _touchNext = thisIndex + 1;
599
+ var _touchPrev = thisIndex - 1;
600
+ if (settings.loop && galleryCount > 2) {
601
+ if (thisIndex === 0) {
602
+ _touchPrev = galleryCount - 1;
603
+ } else if (thisIndex === galleryCount - 1) {
604
+ _touchNext = 0;
605
+ }
606
+ }
607
+ // this.outer.find('.lg-item').removeClass('lg-next-slide lg-prev-slide');
608
+ // $sliderOuter?.current?.querySelectorAll('.spec-image-preview-item').classList.remove('spec-image-preview-next-slide spec-image-preview-prev-slide')
609
+ $itemsRef.current.forEach(function (item) {
610
+ var _a, _b;
611
+ (_a = item === null || item === void 0 ? void 0 : item.classList) === null || _a === void 0 ? void 0 : _a.remove('spec-image-preview-prev-slide');
612
+ (_b = item === null || item === void 0 ? void 0 : item.classList) === null || _b === void 0 ? void 0 : _b.remove('spec-image-preview-next-slide');
613
+ });
614
+ if (_touchPrev > -1) {
615
+ // @ts-ignore
616
+ (_a = getSlideItem(_touchPrev)) === null || _a === void 0 ? void 0 : _a.classList.add('spec-image-preview-prev-slide');
617
+ }
618
+ // @ts-ignore
619
+ (_b = getSlideItem(_touchNext)) === null || _b === void 0 ? void 0 : _b.classList.add('spec-image-preview-next-slide');
620
+ };
621
+ // 判断是视频还是图片
622
+ var getSlideType = function getSlideType(item) {
623
+ return 'image';
624
+ if (item.__slideVideoInfo) {
625
+ return 'video';
626
+ } else if (item.iframe) {
627
+ return 'iframe';
628
+ } else {
629
+ return 'image';
630
+ }
631
+ };
632
+ useEffect(function () {
633
+ if ($sliderOuter === null || $sliderOuter === void 0 ? void 0 : $sliderOuter.current) {
634
+ $sliderOuter === null || $sliderOuter === void 0 ? void 0 : $sliderOuter.current.addEventListener('wheel', onMouseWheel, {
635
+ passive: false
636
+ });
637
+ }
638
+ return function () {
639
+ if ($sliderOuter === null || $sliderOuter === void 0 ? void 0 : $sliderOuter.current) $sliderOuter === null || $sliderOuter === void 0 ? void 0 : $sliderOuter.current.removeEventListener('wheel', onMouseWheel);
640
+ };
641
+ }, [$sliderOuter, thisIndex]);
642
+ return /*#__PURE__*/React.createElement("div", {
643
+ className: 'spec-image-preview-content',
644
+ style: {
645
+ top: '47px',
646
+ bottom: hasThumbnail ? '100px' : '10px' // 如果简介文本不显示在图片上面,可配置成154px
647
+ }
648
+ }, /*#__PURE__*/React.createElement("div", {
649
+ className: 'spec-image-preview-inner',
650
+ style: {
651
+ transitionTimingFunction: 'ease',
652
+ transitionDuration: '300ms'
653
+ },
654
+ ref: $sliderOuter
655
+ }, React.Children.map(children, function (item, index) {
656
+ // TODO 需要判断预览类型:图片img或者是视频video
657
+ // item.className = 'spec-image-preview-object spec-image-preview-image'
658
+ // item.props.className = 'spec-image-preview-object spec-image-preview-image'
659
+ return /*#__PURE__*/React.createElement("div", {
660
+ className: classNames('spec-image-preview-item spec-image-preview-loaded spec-image-preview-complete spec-image-preview-complete_ spec-image-preview-zoomable', thisIndex === index ? 'spec-image-preview-current' : ''),
661
+ key: index,
662
+ onClick: onPreviewClick,
663
+ onMouseDown: onPreviewMouseDown,
664
+ onMouseMove: onPreviewMouseMove,
665
+ onMouseUp: onPreviewMouseUp,
666
+ onTouchStart: onTouchStart,
667
+ onTouchMove: onTouchMove,
668
+ onTouchEnd: onTouchEnd,
669
+ id: coreId + '-item-' + index,
670
+ // @ts-ignore
671
+ ref: function ref(el) {
672
+ return $itemsRef.current[index] = el;
673
+ }
674
+ }, /*#__PURE__*/React.createElement("picture", {
675
+ className: 'spec-image-preview-img-wrap',
676
+ "data-index": index
677
+ }, /*#__PURE__*/React.createElement("img", {
678
+ className: 'spec-image-preview-object spec-image-preview-image',
679
+ src: item.props['data-src' || 'src'],
680
+ onMouseDown: function onMouseDown(evt) {
681
+ return evt.preventDefault();
682
+ }
683
+ })));
684
+ })), galleryCount > 1 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
685
+ className: classNames('spec-image-preview-prev spec-image-preview-icon', galleryCount === 2 && thumbCurrent === 0 ? 'disabled' : ''),
686
+ "aria-label": "Previous slide",
687
+ onClick: function onClick() {
688
+ return goToPrevSlide === null || goToPrevSlide === void 0 ? void 0 : goToPrevSlide();
689
+ }
690
+ }), /*#__PURE__*/React.createElement("div", {
691
+ className: classNames('spec-image-preview-next spec-image-preview-icon', galleryCount === 2 && thumbCurrent === 1 ? 'disabled' : ''),
692
+ "aria-label": "Next slide",
693
+ onClick: function onClick() {
694
+ return goToNextSlide === null || goToNextSlide === void 0 ? void 0 : goToNextSlide();
695
+ }
696
+ })));
697
+ };
698
+ export default SliderContent;
699
+ /* eslint-disable */