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,3 @@
1
+ import React from 'react';
2
+ declare const Thumbnail: (props: any) => React.JSX.Element;
3
+ export default Thumbnail;
@@ -0,0 +1,296 @@
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
+ import React, { useRef, useEffect, useState } from 'react';
8
+ import classNames from "classnames";
9
+ var isDragging = false;
10
+ var translateX = 0;
11
+ var thumbDragUtils = {
12
+ cords: {
13
+ startX: 0,
14
+ endX: 0
15
+ },
16
+ isMoved: false,
17
+ newTranslateX: 0,
18
+ startTime: new Date(),
19
+ endTime: new Date(),
20
+ touchMoveTime: 0
21
+ };
22
+ var thumbClickable = true;
23
+ var thumbnailSwipeThreshold = 10;
24
+ var Thumbnail = function Thumbnail(props) {
25
+ var _props$thumbWidth = props.thumbWidth,
26
+ thumbWidth = _props$thumbWidth === void 0 ? 100 : _props$thumbWidth,
27
+ _props$thumbMargin = props.thumbMargin,
28
+ thumbMargin = _props$thumbMargin === void 0 ? 5 : _props$thumbMargin,
29
+ thumbCurrent = props.thumbCurrent,
30
+ children = props.children,
31
+ galleryCount = props.galleryCount,
32
+ onClickThumbItem = props.onClickThumbItem,
33
+ _props$currentPagerPo = props.currentPagerPosition,
34
+ currentPagerPosition = _props$currentPagerPo === void 0 ? 'middle' : _props$currentPagerPo;
35
+ var $thumbOuter = useRef();
36
+ var $thumbGroup = useRef();
37
+ var _useState = useState(0),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ thumbOuterWidth = _useState2[0],
40
+ setThumbOuterWidth = _useState2[1];
41
+ var _useState3 = useState(0),
42
+ _useState4 = _slicedToArray(_useState3, 2),
43
+ thumbTotalWidth = _useState4[0],
44
+ setThumbTotalWidth = _useState4[1];
45
+ var init = function init() {
46
+ var _a;
47
+ setThumbOuterWidth((_a = $thumbOuter === null || $thumbOuter === void 0 ? void 0 : $thumbOuter.current) === null || _a === void 0 ? void 0 : _a.clientWidth);
48
+ setThumbTotalWidth(galleryCount * (thumbWidth + thumbMargin));
49
+ // Thumbnail animation value
50
+ translateX = 0;
51
+ };
52
+ var destroy = function destroy() {
53
+ thumbDragUtils = {
54
+ cords: {
55
+ startX: 0,
56
+ endX: 0
57
+ },
58
+ isMoved: false,
59
+ newTranslateX: 0,
60
+ startTime: new Date(),
61
+ endTime: new Date(),
62
+ touchMoveTime: 0
63
+ };
64
+ };
65
+ var onThumbMouseDown = function onThumbMouseDown(e) {
66
+ if (thumbTotalWidth > thumbOuterWidth) {
67
+ // execute only on .lg-object
68
+ e.preventDefault();
69
+ thumbDragUtils.cords.startX = e.pageX;
70
+ thumbDragUtils.startTime = new Date();
71
+ thumbClickable = false;
72
+ isDragging = true;
73
+ //
74
+ // // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723
75
+ // this.core.outer.get().scrollLeft += 1;
76
+ // this.core.outer.get().scrollLeft -= 1;
77
+ //
78
+ if ($thumbOuter.current) {
79
+ $thumbOuter.current.classList.remove('spec-image-preview-grab');
80
+ $thumbOuter.current.classList.add('spec-image-preview-grabbing');
81
+ }
82
+ }
83
+ };
84
+ var onThumbMouseMove = function onThumbMouseMove(e) {
85
+ if (isDragging) {
86
+ thumbDragUtils.cords.endX = e.pageX;
87
+ thumbDragUtils = onThumbTouchMove(thumbDragUtils);
88
+ }
89
+ };
90
+ var onThumbMouseUp = function onThumbMouseUp(e) {
91
+ var _a, _b;
92
+ if (thumbDragUtils.isMoved) {
93
+ thumbDragUtils = onThumbTouchEnd(thumbDragUtils);
94
+ } else {
95
+ thumbClickable = true;
96
+ }
97
+ if (isDragging) {
98
+ isDragging = false;
99
+ (_a = $thumbOuter === null || $thumbOuter === void 0 ? void 0 : $thumbOuter.current) === null || _a === void 0 ? void 0 : _a.classList.remove('spec-image-preview-grabbing');
100
+ (_b = $thumbOuter === null || $thumbOuter === void 0 ? void 0 : $thumbOuter.current) === null || _b === void 0 ? void 0 : _b.classList.add('spec-image-preview-grab');
101
+ }
102
+ };
103
+ var onThumbTouchMove = function onThumbTouchMove(thumbDragUtils) {
104
+ thumbDragUtils.newTranslateX = translateX;
105
+ thumbDragUtils.isMoved = true;
106
+ thumbDragUtils.touchMoveTime = new Date().valueOf();
107
+ thumbDragUtils.newTranslateX -= thumbDragUtils.cords.endX - thumbDragUtils.cords.startX;
108
+ thumbDragUtils.newTranslateX = getPossibleTransformX(thumbDragUtils.newTranslateX);
109
+ // move current slide
110
+ setTranslate(thumbDragUtils.newTranslateX);
111
+ $thumbOuter.current.classList.add('spec-image-preview-dragging');
112
+ return thumbDragUtils;
113
+ };
114
+ var onTouchStart = function onTouchStart(e) {
115
+ if (thumbTotalWidth > thumbOuterWidth) {
116
+ e.preventDefault();
117
+ thumbDragUtils.cords.startX = e.targetTouches[0].pageX;
118
+ thumbClickable = false;
119
+ thumbDragUtils.startTime = new Date();
120
+ }
121
+ };
122
+ var onTouchMove = function onTouchMove(e) {
123
+ if (thumbTotalWidth > thumbOuterWidth) {
124
+ e.preventDefault();
125
+ thumbDragUtils.cords.endX = e.targetTouches[0].pageX;
126
+ thumbDragUtils = onThumbTouchMove(thumbDragUtils);
127
+ }
128
+ };
129
+ var onTouchEnd = function onTouchEnd() {
130
+ if (thumbDragUtils.isMoved) {
131
+ thumbDragUtils = onThumbTouchEnd(thumbDragUtils);
132
+ } else {
133
+ thumbClickable = true;
134
+ }
135
+ };
136
+ var onThumbTouchEnd = function onThumbTouchEnd(thumbDragUtils) {
137
+ thumbDragUtils.isMoved = false;
138
+ thumbDragUtils.endTime = new Date();
139
+ $thumbOuter.current.classList.remove('spec-image-preview-dragging');
140
+ var touchDuration = thumbDragUtils.endTime.valueOf() - thumbDragUtils.startTime.valueOf();
141
+ var distanceXnew = thumbDragUtils.cords.endX - thumbDragUtils.cords.startX;
142
+ var speedX = Math.abs(distanceXnew) / touchDuration;
143
+ // Some magical numbers
144
+ // Can be improved
145
+ if (speedX > 0.15 && thumbDragUtils.endTime.valueOf() - thumbDragUtils.touchMoveTime < 30) {
146
+ speedX += 1;
147
+ if (speedX > 2) {
148
+ speedX += 1;
149
+ }
150
+ speedX = speedX + speedX * (Math.abs(distanceXnew) / thumbOuterWidth);
151
+ $thumbGroup.current.style.transitionDuration = Math.min(speedX - 1, 2) + 'settings';
152
+ distanceXnew = distanceXnew * speedX;
153
+ translateX = getPossibleTransformX(translateX - distanceXnew);
154
+ setTranslate(translateX);
155
+ } else {
156
+ translateX = thumbDragUtils.newTranslateX;
157
+ }
158
+ if (Math.abs(thumbDragUtils.cords.endX - thumbDragUtils.cords.startX) < thumbnailSwipeThreshold) {
159
+ thumbClickable = true;
160
+ }
161
+ return thumbDragUtils;
162
+ };
163
+ var getPossibleTransformX = function getPossibleTransformX(left) {
164
+ if (left > thumbTotalWidth - thumbOuterWidth) {
165
+ left = thumbTotalWidth - thumbOuterWidth;
166
+ }
167
+ if (left < 0) {
168
+ left = 0;
169
+ }
170
+ return left;
171
+ };
172
+ var setTranslate = function setTranslate(value) {
173
+ // console.log('偏移量', -value)
174
+ $thumbGroup.current.style.transform = 'translate3d(-' + value + 'px, 0px, 0px)';
175
+ };
176
+ var animateThumb = function animateThumb(index) {
177
+ // $thumbGroup.current.style.transitionDuration = '400ms'
178
+ var position = 0;
179
+ switch (currentPagerPosition) {
180
+ case 'left':
181
+ position = 0;
182
+ break;
183
+ case 'middle':
184
+ position = thumbOuterWidth / 2 - thumbWidth / 2;
185
+ break;
186
+ case 'right':
187
+ position = thumbOuterWidth - thumbWidth;
188
+ }
189
+ translateX = (thumbWidth + thumbMargin) * index - 1 - position;
190
+ if (translateX > thumbTotalWidth - thumbOuterWidth) {
191
+ translateX = thumbTotalWidth - thumbOuterWidth;
192
+ }
193
+ if (translateX < 0) {
194
+ translateX = 0;
195
+ }
196
+ setTranslate(translateX);
197
+ };
198
+ useEffect(function () {
199
+ init();
200
+ return function () {
201
+ destroy();
202
+ };
203
+ }, [$thumbOuter === null || $thumbOuter === void 0 ? void 0 : $thumbOuter.current, $thumbGroup === null || $thumbGroup === void 0 ? void 0 : $thumbGroup.current, thumbWidth, thumbMargin, galleryCount]);
204
+ // 计算转到中间位置
205
+ // const slideThumbToMiddle = () => {
206
+ // const order = thumbCurrent + 1
207
+ // // 当前图片块距离
208
+ // const halfWidth = (thumbWidth + thumbMargin) / 2
209
+ // const curDistance = order * (thumbWidth + thumbMargin) - halfWidth
210
+ // const pageNum = Math.ceil((order * (thumbWidth + thumbMargin) / thumbOuterWidth))
211
+ // const totalPage = Math.ceil(thumbTotalWidth / thumbOuterWidth)
212
+ // const centerPosition = thumbOuterWidth / 2 // 中心点
213
+ // if (isNaN(pageNum)) {
214
+ // return
215
+ // }
216
+ // if (curDistance < centerPosition) {
217
+ // console.log('Rule1,位置小于中心点,不设偏移量')
218
+ // thumbDragUtils.newTranslateX = 0
219
+ // } else {
220
+ // console.log('thumbTotalWidth - curDistance', thumbTotalWidth - curDistance)
221
+ // if ((thumbTotalWidth - curDistance) < centerPosition) {
222
+ // console.log('Rule3,已经不足空间转到中间点了')
223
+ // thumbDragUtils.newTranslateX = thumbTotalWidth - thumbOuterWidth
224
+ // } else {
225
+ // console.log('Rule2,直接跳转到中间点')
226
+ // thumbDragUtils.newTranslateX = curDistance - centerPosition
227
+ // }
228
+ // }
229
+ // setTranslate(thumbDragUtils.newTranslateX)
230
+ // }
231
+ useEffect(function () {
232
+ // 判断是不是在中间
233
+ animateThumb(thumbCurrent);
234
+ }, [thumbCurrent, thumbTotalWidth, thumbOuterWidth, thumbMargin]);
235
+ return /*#__PURE__*/React.createElement("div", {
236
+ className: 'spec-image-preview-thumb-outer spec-image-preview-thumb-align-middle spec-image-preview-grab spec-image-preview-animate-thumb',
237
+ ref: $thumbOuter
238
+ }, /*#__PURE__*/React.createElement("div", {
239
+ className: 'spec-image-preview-thumb spec-image-preview-thumb-group',
240
+ style: {
241
+ transitionDuration: '300ms',
242
+ width: galleryCount * (thumbWidth + thumbMargin) + 'px',
243
+ position: 'relative',
244
+ transform: 'translate3d(0px, 0px, 0px)'
245
+ },
246
+ ref: $thumbGroup,
247
+ onMouseDown: onThumbMouseDown,
248
+ onMouseUp: onThumbMouseUp,
249
+ onMouseMove: onThumbMouseMove,
250
+ onTouchStart: onTouchStart,
251
+ onTouchMove: onTouchMove,
252
+ onTouchEnd: onTouchEnd
253
+ }, React.Children.map(children, function (item, index) {
254
+ var imgNode; // = item.type !== 'img' ? item.props.children : item
255
+ if (item.type === 'img') {
256
+ imgNode = item;
257
+ } else if (item.props.children) {
258
+ if (Object.prototype.toString.call(item.props.children) === '[object Array]') {
259
+ // 多个子节点,只取img标签
260
+ imgNode = item.props.children.find(function (cItem) {
261
+ return cItem.type === 'img';
262
+ });
263
+ }
264
+ if (Object.prototype.toString.call(item.props.children) === '[object Object]') {
265
+ imgNode = item.props.children;
266
+ }
267
+ } else {
268
+ // 没有标签
269
+ imgNode = {};
270
+ }
271
+ // 单个子节点
272
+ // console.log('children=>item', item.props.children)
273
+ return /*#__PURE__*/React.createElement("div", {
274
+ className: classNames('spec-image-preview-thumb-item', thumbCurrent === index ? 'active' : ''),
275
+ "data-item-id": index,
276
+ style: {
277
+ width: thumbWidth + 'px',
278
+ height: '80px',
279
+ marginRight: '5px'
280
+ },
281
+ onClick: function onClick(e) {
282
+ if (thumbClickable) {
283
+ onClickThumbItem === null || onClickThumbItem === void 0 ? void 0 : onClickThumbItem('number', index);
284
+ }
285
+ }
286
+ }, /*#__PURE__*/React.createElement("img", Object.assign({
287
+ src: item.props['data-src' || 'src']
288
+ }, imgNode.props, {
289
+ "data-item-id": index,
290
+ onMouseDown: function onMouseDown(evt) {
291
+ return evt.preventDefault();
292
+ }
293
+ })));
294
+ })));
295
+ };
296
+ export default Thumbnail;
@@ -0,0 +1 @@
1
+ export declare const useUniqueId: (prefix?: string) => string;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ var uniqueId = 0;
3
+ export var useUniqueId = function useUniqueId() {
4
+ var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
5
+ var id = React.useRef("".concat(prefix, "-").concat(uniqueId++));
6
+ React.useEffect(function () {
7
+ uniqueId++;
8
+ }, []);
9
+ return id.current;
10
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './style/index.less';
3
+ declare const ImageGallery: (props: any) => React.JSX.Element;
4
+ export default ImageGallery;
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import ImagePreview from './ImagePreview';
3
+ import { useUniqueId } from "./hook/uniqueId";
4
+ import './style/index.less';
5
+ var ImageGallery = function ImageGallery(props) {
6
+ var children = props.children,
7
+ _props$hasThumbnail = props.hasThumbnail,
8
+ hasThumbnail = _props$hasThumbnail === void 0 ? true : _props$hasThumbnail,
9
+ items = props.items,
10
+ height = props.height;
11
+ var prefixCls = 'spec-image-gallery';
12
+ var coreId = useUniqueId(prefixCls);
13
+ // useEffect(() => {
14
+ // console.log(' document.getElementById(ImageGalleryId)', document.getElementById(ImageGalleryId))
15
+ // }, [])
16
+ return /*#__PURE__*/React.createElement("div", {
17
+ className: prefixCls,
18
+ style: {
19
+ height: height
20
+ },
21
+ id: coreId
22
+ }, /*#__PURE__*/React.createElement(ImagePreview, {
23
+ hasThumbnail: hasThumbnail,
24
+ mode: 'inline',
25
+ showToolbar: false,
26
+ galleryItems: items
27
+ }, children));
28
+ };
29
+ export default ImageGallery;
@@ -0,0 +1,5 @@
1
+ .spec-image-gallery {
2
+ position: relative;
3
+ height: 100%;
4
+ z-index: 1000;
5
+ }
@@ -0,0 +1,5 @@
1
+ export type SlideDirection = 'next' | 'prev';
2
+ export interface Coords {
3
+ pageX: number;
4
+ pageY: number;
5
+ }
@@ -0,0 +1 @@
1
+ export {};