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