fan-standard-comp 3.2.1 → 3.2.3

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