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
@@ -5,19 +5,19 @@ import "antd/es/input/style";
5
5
  import _Input from "antd/es/input";
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
12
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
13
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
15
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
16
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
17
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
18
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
10
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
11
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
13
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
15
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
16
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
17
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
18
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
19
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
20
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
21
21
  /**
22
22
  * Created by S.C. on 2019/11/16.
23
23
  */
@@ -25,31 +25,18 @@ import React, { Component } from 'react';
25
25
  var TextArea = _Input.TextArea;
26
26
  var isIE = !!document.all;
27
27
  var VarTemplate = /*#__PURE__*/function (_Component) {
28
- _inherits(VarTemplate, _Component);
29
- var _super = _createSuper(VarTemplate);
30
- _createClass(VarTemplate, null, [{
31
- key: "getDerivedStateFromProps",
32
- value: function getDerivedStateFromProps(nextProps) {
33
- // console.log('执行getDerivedStateFromProps', nextProps)
34
- // Should be a controlled component.
35
- if ('value' in nextProps) {
36
- return _objectSpread({}, nextProps.value || {});
37
- }
38
- return null;
39
- }
40
- }]);
41
28
  function VarTemplate(props) {
42
29
  var _this;
43
30
  _classCallCheck(this, VarTemplate);
44
- _this = _super.call(this, props);
45
- _defineProperty(_assertThisInitialized(_this), "handleBlur", function (e) {
31
+ _this = _callSuper(this, VarTemplate, [props]);
32
+ _this.handleBlur = function (e) {
46
33
  _this.getCurrentCursor();
47
- });
48
- _defineProperty(_assertThisInitialized(_this), "handleFocus", function (e) {
34
+ };
35
+ _this.handleFocus = function (e) {
49
36
  // console.log('获取焦点')
50
37
  // this.$emit('focus', event)
51
- });
52
- _defineProperty(_assertThisInitialized(_this), "handleInputChange", function (e) {
38
+ };
39
+ _this.handleInputChange = function (e) {
53
40
  var onChange = _this.props.onChange;
54
41
  _this.getCurrentCursor();
55
42
  _this.setState({
@@ -59,8 +46,8 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
59
46
  wordCount: e.target.value.length
60
47
  });
61
48
  if (onChange) onChange(e.target.value);
62
- });
63
- _defineProperty(_assertThisInitialized(_this), "setTagWords", function (key) {
49
+ };
50
+ _this.setTagWords = function (key) {
64
51
  var onChange = _this.props.onChange;
65
52
  var _this$state = _this.state,
66
53
  currentContent = _this$state.currentContent,
@@ -78,8 +65,15 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
78
65
  setTimeout(function () {
79
66
  _this.moveToCursor(); // 重新定位光标
80
67
  });
81
- });
82
- _defineProperty(_assertThisInitialized(_this), "insertContent", function (str, insertStr, start, end) {
68
+ };
69
+ /**
70
+ * 指定位置插入标签占位符字符串,当光标有选中一段字符时,会将直接将其替换
71
+ * @param {str} 需要做插入的字符串
72
+ * @param {insertStr} 需要插入的字符串
73
+ * @param {start} 指定开始位置
74
+ * @param {end} 指定结束位置
75
+ * */
76
+ _this.insertContent = function (str, insertStr, start, end) {
83
77
  if (start !== end) {
84
78
  var _prevStr = str.substring(0, start);
85
79
  var _nextStr = str.substring(end, str.length);
@@ -88,8 +82,13 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
88
82
  var prevStr = str.substring(0, start);
89
83
  var nextStr = str.substring(start, str.length);
90
84
  return prevStr + insertStr + nextStr;
91
- });
92
- _defineProperty(_assertThisInitialized(_this), "getCurrentCursor", function () {
85
+ };
86
+ /**
87
+ * 获取当前(上一次)光标的位置
88
+ * @参考 http://blog.csdn.net/chadcao/article/details/6575927
89
+ * @TODO IE、火狐浏览器下未验证
90
+ */
91
+ _this.getCurrentCursor = function () {
93
92
  var start = 0;
94
93
  var end = 0;
95
94
  var oTextarea = _this.content.querySelector('textarea'); // 获取textarea标签
@@ -133,8 +132,13 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
133
132
  startNum: start,
134
133
  endNum: end
135
134
  });
136
- });
137
- _defineProperty(_assertThisInitialized(_this), "moveToCursor", function () {
135
+ };
136
+ /**
137
+ * 跳转到上一次光标的位置
138
+ * @参考 http://blog.csdn.net/chadcao/article/details/6575927
139
+ * @TODO IE、火狐浏览器下未验证
140
+ */
141
+ _this.moveToCursor = function () {
138
142
  var _this$state2 = _this.state,
139
143
  startNum = _this$state2.startNum,
140
144
  endNum = _this$state2.endNum;
@@ -173,7 +177,7 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
173
177
  oTextarea.selectionStart = startNum;
174
178
  oTextarea.selectionEnd = endNum;
175
179
  }
176
- });
180
+ };
177
181
  var _value = props.value || '';
178
182
  _this.state = {
179
183
  currentContent: _value,
@@ -183,31 +187,11 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
183
187
  // 光标结束位置(当选中文本时)
184
188
  wordCount: _value.length // 输入框内的字符数总和(包含占位符所需要的长度)
185
189
  };
186
-
187
190
  _this.content = /*#__PURE__*/React.createRef();
188
191
  return _this;
189
192
  }
190
-
191
- /**
192
- * 指定位置插入标签占位符字符串,当光标有选中一段字符时,会将直接将其替换
193
- * @param {str} 需要做插入的字符串
194
- * @param {insertStr} 需要插入的字符串
195
- * @param {start} 指定开始位置
196
- * @param {end} 指定结束位置
197
- * */
198
-
199
- /**
200
- * 获取当前(上一次)光标的位置
201
- * @参考 http://blog.csdn.net/chadcao/article/details/6575927
202
- * @TODO IE、火狐浏览器下未验证
203
- */
204
-
205
- /**
206
- * 跳转到上一次光标的位置
207
- * @参考 http://blog.csdn.net/chadcao/article/details/6575927
208
- * @TODO IE、火狐浏览器下未验证
209
- */
210
- _createClass(VarTemplate, [{
193
+ _inherits(VarTemplate, _Component);
194
+ return _createClass(VarTemplate, [{
211
195
  key: "render",
212
196
  value: function render() {
213
197
  var _this2 = this;
@@ -249,7 +233,16 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
249
233
  disabled: disabled
250
234
  })));
251
235
  }
236
+ }], [{
237
+ key: "getDerivedStateFromProps",
238
+ value: function getDerivedStateFromProps(nextProps) {
239
+ // console.log('执行getDerivedStateFromProps', nextProps)
240
+ // Should be a controlled component.
241
+ if ('value' in nextProps) {
242
+ return _objectSpread({}, nextProps.value || {});
243
+ }
244
+ return null;
245
+ }
252
246
  }]);
253
- return VarTemplate;
254
247
  }(Component);
255
248
  export default VarTemplate;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import './PreviewStyles/ImagePreview.less';
3
+ interface ImagePreviewTypes {
4
+ open?: boolean;
5
+ current?: number;
6
+ hasThumbnail?: boolean;
7
+ galleryItems?: any[];
8
+ children?: any;
9
+ mode?: string;
10
+ [k: string]: any;
11
+ }
12
+ declare const ImagePreview: (props: ImagePreviewTypes) => React.JSX.Element;
13
+ export default ImagePreview;
@@ -0,0 +1,168 @@
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, { useMemo, useEffect, useState, useCallback, useRef } from 'react';
8
+ import classNames from 'classnames';
9
+ import './PreviewStyles/ImagePreview.less';
10
+ // @ts-ignore
11
+ import ReactHtmlParser from "react-html-parser"; // react16上使用,react18上不能使用否则会报警
12
+ // import HtmlReactParse from 'html-react-parser'; // react18上使用
13
+ import Thumbnail from './Thumbnail';
14
+ import SliderContent from "./SliderContent";
15
+ import { useUniqueId } from './hook/uniqueId';
16
+ var delay = 40;
17
+ var ImagePreview = function ImagePreview(props) {
18
+ var open = props.open,
19
+ children = props.children,
20
+ onClose = props.onClose,
21
+ current = props.current,
22
+ hasThumbnail = props.hasThumbnail,
23
+ mode = props.mode,
24
+ galleryItems = props.galleryItems;
25
+ var prefixCls = 'spec-image-preview';
26
+ var coreId = useUniqueId(prefixCls);
27
+ var $outer = useRef();
28
+ var _useState = useState(false),
29
+ _useState2 = _slicedToArray(_useState, 2),
30
+ showDelay = _useState2[0],
31
+ setShowDelay = _useState2[1];
32
+ var _useState3 = useState(0),
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ thumbCurrent = _useState4[0],
35
+ setThumbCurrent = _useState4[1];
36
+ var _useState5 = useState(0),
37
+ _useState6 = _slicedToArray(_useState5, 2),
38
+ thumbSlidePrev = _useState6[0],
39
+ setThumbSlidePrev = _useState6[1];
40
+ var _useState7 = useState(0),
41
+ _useState8 = _slicedToArray(_useState7, 2),
42
+ thumbSlideNext = _useState8[0],
43
+ setThumbSlideNext = _useState8[1];
44
+ var galleryCount = useMemo(function () {
45
+ if (galleryItems) {
46
+ return galleryItems.length;
47
+ }
48
+ return React.Children.count(children);
49
+ }, [children, galleryItems]);
50
+ var onClickClose = function onClickClose() {
51
+ if (mode !== 'inline') {
52
+ setShowDelay(false);
53
+ setTimeout(function () {
54
+ onClose === null || onClose === void 0 ? void 0 : onClose();
55
+ }, 300);
56
+ }
57
+ };
58
+ // 切换上下图片
59
+ var handleTurning = useCallback(function (key, index) {
60
+ setThumbSlidePrev(thumbCurrent);
61
+ var newCurrent = 0;
62
+ if (key === 'prev') {
63
+ newCurrent = thumbCurrent === 0 ? galleryCount - 1 : thumbCurrent - 1;
64
+ }
65
+ if (key === 'next') {
66
+ newCurrent = thumbCurrent === galleryCount - 1 ? 0 : thumbCurrent + 1;
67
+ }
68
+ if (key === 'number') {
69
+ newCurrent = index;
70
+ }
71
+ setThumbCurrent(newCurrent);
72
+ setTimeout(function () {
73
+ setThumbSlideNext(newCurrent);
74
+ }, 50);
75
+ }, [galleryCount, thumbCurrent]);
76
+ // const enableThumbDrag =()=> {
77
+ // let thumbDragUtils: ThumbDragUtils = {
78
+ // cords: {
79
+ // startX: 0,
80
+ // endX: 0,
81
+ // },
82
+ // isMoved: false,
83
+ // newTranslateX: 0,
84
+ // startTime: new Date(),
85
+ // endTime: new Date(),
86
+ // touchMoveTime: 0,
87
+ // };
88
+ // if (thumbOuter.current) {
89
+ // thumbOuter.current.classList.add('spec-image-preview-grab')
90
+ // }
91
+ // }
92
+ useEffect(function () {
93
+ if (mode === 'inline') {
94
+ setShowDelay(true);
95
+ } else {
96
+ if (open) {
97
+ setTimeout(function () {
98
+ setShowDelay(true);
99
+ }, delay);
100
+ }
101
+ }
102
+ return function () {};
103
+ }, [open, mode]);
104
+ useEffect(function () {
105
+ if (mode === 'inline') {
106
+ setThumbCurrent(current || 0);
107
+ } else {
108
+ if (open) {
109
+ setThumbCurrent(current || 0);
110
+ }
111
+ }
112
+ }, [open, current, mode]);
113
+ // const componentClassName = 'spec-image-preview';
114
+ // const [wrapSSR, hashId] = useStyle(componentClassName);
115
+ return /*#__PURE__*/React.createElement("div", {
116
+ id: coreId,
117
+ className: classNames('spec-image-preview-container', mode === 'inline' ? 'spec-image-preview-inline' : '', mode === 'inline' || open ? 'spec-image-preview-show' : '', showDelay ? 'spec-image-preview-show-in' : '')
118
+ }, /*#__PURE__*/React.createElement("div", {
119
+ className: classNames('spec-image-preview-backdrop', mode === 'inline' || showDelay ? 'in' : '')
120
+ }), /*#__PURE__*/React.createElement("div", {
121
+ className: classNames('spec-image-preview-outer spec-image-preview-use-css3 spec-image-preview-css3 spec-image-preview-fade spec-image-preview-grab spec-image-preview-animate-thumb', showDelay ? 'spec-image-preview-components-open' : '', showDelay ? 'spec-image-preview-zoom-from-image' : ''),
122
+ ref: $outer
123
+ }, /*#__PURE__*/React.createElement(SliderContent, {
124
+ hasThumbnail: hasThumbnail && galleryCount > 1,
125
+ thumbCurrent: thumbCurrent,
126
+ onTurning: handleTurning,
127
+ thumbSlidePrev: thumbSlidePrev,
128
+ thumbSlideNext: thumbSlideNext,
129
+ coreId: coreId,
130
+ galleryCount: galleryCount,
131
+ outerRef: $outer,
132
+ onUpdateTurning: function onUpdateTurning(index) {
133
+ return handleTurning('number', index);
134
+ },
135
+ onClose: onClickClose
136
+ }, children), /*#__PURE__*/React.createElement("div", {
137
+ className: 'spec-image-preview-toolbar'
138
+ }, /*#__PURE__*/React.createElement("div", {
139
+ className: 'spec-image-preview-counter'
140
+ }, /*#__PURE__*/React.createElement("span", {
141
+ className: 'spec-image-preview-counter-current'
142
+ }, thumbCurrent + 1), " /", /*#__PURE__*/React.createElement("span", {
143
+ className: 'spec-image-preview-counter-all'
144
+ }, galleryCount)), mode === 'inline' ? null : /*#__PURE__*/React.createElement("a", {
145
+ className: 'spec-image-preview-close spec-image-preview-icon',
146
+ onClick: onClickClose
147
+ })), /*#__PURE__*/React.createElement("div", {
148
+ className: classNames('spec-image-preview-components')
149
+ }, /*#__PURE__*/React.createElement("div", {
150
+ className: 'spec-image-preview-sub-html'
151
+ }, React.Children.map(children, function (item, index) {
152
+ if (thumbCurrent === index) {
153
+ // react16用法
154
+ return item.props['data-sub-html'] ? ReactHtmlParser(item.props['data-sub-html']) : null;
155
+ // react18用法
156
+ // return item.props['data-sub-html'] ? HtmlReactParse(item.props['data-sub-html']) : null
157
+ }
158
+ return null;
159
+ })), hasThumbnail && galleryCount > 1 && /*#__PURE__*/React.createElement(Thumbnail, {
160
+ galleryCount: galleryCount,
161
+ thumbCurrent: thumbCurrent,
162
+ coreId: coreId,
163
+ onClickThumbItem: function onClickThumbItem(key, index) {
164
+ return handleTurning(key, index);
165
+ }
166
+ }, children))));
167
+ };
168
+ export default ImagePreview;