@blaze-cms/plugin-media-ui 0.146.0-node18.1 → 0.146.0-rc-eagle.0

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 (334) hide show
  1. package/CHANGELOG.md +10 -16
  2. package/lib/components/CardMedia/CardMedia.js +168 -221
  3. package/lib/components/CardMedia/CardMedia.js.map +1 -1
  4. package/lib/components/CardMedia/index.js +2 -3
  5. package/lib/components/CardMedia/index.js.map +1 -1
  6. package/lib/components/EditMediaFile/EditMediaFile.js +162 -113
  7. package/lib/components/EditMediaFile/EditMediaFile.js.map +1 -1
  8. package/lib/components/EditMediaFile/EditMediaFilePage.js +81 -97
  9. package/lib/components/EditMediaFile/EditMediaFilePage.js.map +1 -1
  10. package/lib/components/EditMediaFile/index.js +2 -3
  11. package/lib/components/EditMediaFile/index.js.map +1 -1
  12. package/lib/components/EditorAdapter/EditorAdapter.js +43 -22
  13. package/lib/components/EditorAdapter/EditorAdapter.js.map +1 -1
  14. package/lib/components/EditorAdapter/index.js +2 -3
  15. package/lib/components/EditorAdapter/index.js.map +1 -1
  16. package/lib/components/FileList/FilesListContext/index.js +3 -4
  17. package/lib/components/FileList/FilesListContext/index.js.map +1 -1
  18. package/lib/components/FileList/FilesListProvider/index.js +27 -29
  19. package/lib/components/FileList/FilesListProvider/index.js.map +1 -1
  20. package/lib/components/FileList/useFileList/index.js +3 -6
  21. package/lib/components/FileList/useFileList/index.js.map +1 -1
  22. package/lib/components/FileList/useGetFiles/getFiles.js +164 -185
  23. package/lib/components/FileList/useGetFiles/getFiles.js.map +1 -1
  24. package/lib/components/FileList/useGetFiles/index.js +2 -3
  25. package/lib/components/FileList/useGetFiles/index.js.map +1 -1
  26. package/lib/components/FileList/useGetFiles/useGetFiles.js +88 -133
  27. package/lib/components/FileList/useGetFiles/useGetFiles.js.map +1 -1
  28. package/lib/components/FileList/useGetFilesList/getCounters.js +10 -30
  29. package/lib/components/FileList/useGetFilesList/getCounters.js.map +1 -1
  30. package/lib/components/FileList/useGetFilesList/index.js +2 -3
  31. package/lib/components/FileList/useGetFilesList/index.js.map +1 -1
  32. package/lib/components/FileList/useGetFilesList/useGetFilesList.js +89 -110
  33. package/lib/components/FileList/useGetFilesList/useGetFilesList.js.map +1 -1
  34. package/lib/components/FilePreview/Actions/index.js +24 -38
  35. package/lib/components/FilePreview/Actions/index.js.map +1 -1
  36. package/lib/components/FilePreview/Image/Image.js +35 -24
  37. package/lib/components/FilePreview/Image/Image.js.map +1 -1
  38. package/lib/components/FilePreview/Image/RawImage.js +25 -27
  39. package/lib/components/FilePreview/Image/RawImage.js.map +1 -1
  40. package/lib/components/FilePreview/Image/imageSchema.js +2 -3
  41. package/lib/components/FilePreview/Image/imageSchema.js.map +1 -1
  42. package/lib/components/FilePreview/Image/index.js +1 -2
  43. package/lib/components/FilePreview/Image/index.js.map +1 -1
  44. package/lib/components/FilePreview/ModalContext.js +9 -0
  45. package/lib/components/FilePreview/ModalContext.js.map +1 -0
  46. package/lib/components/FilePreview/PDF/PDF.js +44 -31
  47. package/lib/components/FilePreview/PDF/PDF.js.map +1 -1
  48. package/lib/components/FilePreview/PDF/RawPDF.js +27 -29
  49. package/lib/components/FilePreview/PDF/RawPDF.js.map +1 -1
  50. package/lib/components/FilePreview/PDF/index.js +1 -2
  51. package/lib/components/FilePreview/PDF/index.js.map +1 -1
  52. package/lib/components/FilePreview/PDF/schema.js +1 -2
  53. package/lib/components/FilePreview/PDF/schema.js.map +1 -1
  54. package/lib/components/FilePreview/get-preview.js +12 -10
  55. package/lib/components/FilePreview/get-preview.js.map +1 -1
  56. package/lib/components/FilePreview/index.js +66 -57
  57. package/lib/components/FilePreview/index.js.map +1 -1
  58. package/lib/components/FilePreview/previewDefault/PreviewDefault.js +35 -23
  59. package/lib/components/FilePreview/previewDefault/PreviewDefault.js.map +1 -1
  60. package/lib/components/FilePreview/previewDefault/RawPreviewDefault.js +33 -27
  61. package/lib/components/FilePreview/previewDefault/RawPreviewDefault.js.map +1 -1
  62. package/lib/components/FilePreview/previewDefault/icons/DefaultIcon.js +120 -123
  63. package/lib/components/FilePreview/previewDefault/icons/DefaultIcon.js.map +1 -1
  64. package/lib/components/FilePreview/previewDefault/icons/index.js +2 -3
  65. package/lib/components/FilePreview/previewDefault/icons/index.js.map +1 -1
  66. package/lib/components/FilePreview/previewDefault/index.js +1 -2
  67. package/lib/components/FilePreview/previewDefault/index.js.map +1 -1
  68. package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js +1 -2
  69. package/lib/components/FilePreview/previewDefault/previewDefaultSchema.js.map +1 -1
  70. package/lib/components/FilePreviewReadOnly/FileList.js +10 -12
  71. package/lib/components/FilePreviewReadOnly/FileList.js.map +1 -1
  72. package/lib/components/FilePreviewReadOnly/FilePreviewList.js +14 -20
  73. package/lib/components/FilePreviewReadOnly/FilePreviewList.js.map +1 -1
  74. package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js +52 -98
  75. package/lib/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +1 -1
  76. package/lib/components/FilePreviewReadOnly/index.js +2 -3
  77. package/lib/components/FilePreviewReadOnly/index.js.map +1 -1
  78. package/lib/components/FilePreviewReadOnly/mappers/format-initial-value.js +7 -8
  79. package/lib/components/FilePreviewReadOnly/mappers/format-initial-value.js.map +1 -1
  80. package/lib/components/FilePreviewReadOnly/mappers/index.js +1 -2
  81. package/lib/components/FilePreviewReadOnly/mappers/index.js.map +1 -1
  82. package/lib/components/FileUploadAdapter/FileList.js +26 -39
  83. package/lib/components/FileUploadAdapter/FileList.js.map +1 -1
  84. package/lib/components/FileUploadAdapter/FilePreviewList.js +14 -20
  85. package/lib/components/FileUploadAdapter/FilePreviewList.js.map +1 -1
  86. package/lib/components/FileUploadAdapter/FileReorderList.js +18 -21
  87. package/lib/components/FileUploadAdapter/FileReorderList.js.map +1 -1
  88. package/lib/components/FileUploadAdapter/FileReorderListItem.js +20 -23
  89. package/lib/components/FileUploadAdapter/FileReorderListItem.js.map +1 -1
  90. package/lib/components/FileUploadAdapter/FileUploadAdapter.js +238 -338
  91. package/lib/components/FileUploadAdapter/FileUploadAdapter.js.map +1 -1
  92. package/lib/components/FileUploadAdapter/index.js +2 -3
  93. package/lib/components/FileUploadAdapter/index.js.map +1 -1
  94. package/lib/components/FileUploadAdapter/mappers/format-initial-value.js +7 -8
  95. package/lib/components/FileUploadAdapter/mappers/format-initial-value.js.map +1 -1
  96. package/lib/components/FileUploadAdapter/mappers/get-button-text.js +9 -6
  97. package/lib/components/FileUploadAdapter/mappers/get-button-text.js.map +1 -1
  98. package/lib/components/FileUploadAdapter/mappers/get-format.js +7 -13
  99. package/lib/components/FileUploadAdapter/mappers/get-format.js.map +1 -1
  100. package/lib/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +6 -5
  101. package/lib/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +1 -1
  102. package/lib/components/FileUploadAdapter/mappers/index.js +6 -7
  103. package/lib/components/FileUploadAdapter/mappers/index.js.map +1 -1
  104. package/lib/components/FileUploadAdapter/mappers/is-unselecting.js +2 -10
  105. package/lib/components/FileUploadAdapter/mappers/is-unselecting.js.map +1 -1
  106. package/lib/components/FileUploadAdapter/mappers/transform-to-array.js +2 -5
  107. package/lib/components/FileUploadAdapter/mappers/transform-to-array.js.map +1 -1
  108. package/lib/components/FileUploadAdapter/useLimit.js +4 -10
  109. package/lib/components/FileUploadAdapter/useLimit.js.map +1 -1
  110. package/lib/components/FileUploadModal/FileUploadModal.js +150 -145
  111. package/lib/components/FileUploadModal/FileUploadModal.js.map +1 -1
  112. package/lib/components/FileUploadModal/index.js +2 -3
  113. package/lib/components/FileUploadModal/index.js.map +1 -1
  114. package/lib/components/FilterPanel/FilterPanel.js +68 -88
  115. package/lib/components/FilterPanel/FilterPanel.js.map +1 -1
  116. package/lib/components/FilterPanel/index.js +2 -3
  117. package/lib/components/FilterPanel/index.js.map +1 -1
  118. package/lib/components/ListingContainer/Listing/Listing.js +58 -48
  119. package/lib/components/ListingContainer/Listing/Listing.js.map +1 -1
  120. package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +75 -92
  121. package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +1 -1
  122. package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js +2 -3
  123. package/lib/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js.map +1 -1
  124. package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js +22 -26
  125. package/lib/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +1 -1
  126. package/lib/components/ListingContainer/Listing/MediaListing/index.js +2 -3
  127. package/lib/components/ListingContainer/Listing/MediaListing/index.js.map +1 -1
  128. package/lib/components/ListingContainer/Listing/index.js +2 -3
  129. package/lib/components/ListingContainer/Listing/index.js.map +1 -1
  130. package/lib/components/ListingContainer/ListingContainer.js +69 -92
  131. package/lib/components/ListingContainer/ListingContainer.js.map +1 -1
  132. package/lib/components/ListingContainer/index.js +2 -3
  133. package/lib/components/ListingContainer/index.js.map +1 -1
  134. package/lib/components/ListingContainer/mappers/exist-previous.js +3 -10
  135. package/lib/components/ListingContainer/mappers/exist-previous.js.map +1 -1
  136. package/lib/components/ListingContainer/mappers/index.js +2 -3
  137. package/lib/components/ListingContainer/mappers/index.js.map +1 -1
  138. package/lib/components/MediaListing.js +14 -26
  139. package/lib/components/MediaListing.js.map +1 -1
  140. package/lib/constants.js +15 -16
  141. package/lib/constants.js.map +1 -1
  142. package/lib/icons/MediaLibraryIcon.js +17 -20
  143. package/lib/icons/MediaLibraryIcon.js.map +1 -1
  144. package/lib/icons/index.js +2 -3
  145. package/lib/icons/index.js.map +1 -1
  146. package/lib/index.js +67 -92
  147. package/lib/index.js.map +1 -1
  148. package/lib/utils/available-filters/available-filters.js +1 -2
  149. package/lib/utils/available-filters/available-filters.js.map +1 -1
  150. package/lib/utils/bustUrl.js +13 -0
  151. package/lib/utils/bustUrl.js.map +1 -0
  152. package/lib/utils/media-context/index.js +4 -5
  153. package/lib/utils/media-context/index.js.map +1 -1
  154. package/lib/utils/media-context/media-context.js +3 -4
  155. package/lib/utils/media-context/media-context.js.map +1 -1
  156. package/lib/utils/media-context/useMediaContext.js +2 -4
  157. package/lib/utils/media-context/useMediaContext.js.map +1 -1
  158. package/package.json +14 -14
  159. package/src/components/CardMedia/CardMedia.js +27 -8
  160. package/src/components/EditMediaFile/EditMediaFile.js +115 -37
  161. package/src/components/EditMediaFile/EditMediaFilePage.js +35 -9
  162. package/src/components/EditorAdapter/EditorAdapter.js +31 -4
  163. package/src/components/FilePreview/Actions/index.js +25 -27
  164. package/src/components/FilePreview/Image/Image.js +15 -2
  165. package/src/components/FilePreview/Image/imageSchema.js +1 -1
  166. package/src/components/FilePreview/ModalContext.js +3 -0
  167. package/src/components/FilePreview/PDF/PDF.js +17 -4
  168. package/src/components/FilePreview/index.js +35 -6
  169. package/src/components/FilePreview/previewDefault/PreviewDefault.js +16 -3
  170. package/src/components/FilePreview/previewDefault/RawPreviewDefault.js +17 -7
  171. package/src/components/FilePreviewReadOnly/FileList.js +1 -3
  172. package/src/components/FilePreviewReadOnly/FilePreviewReadOnly.js +17 -29
  173. package/src/components/FileUploadAdapter/FileUploadAdapter.js +42 -18
  174. package/src/components/FileUploadAdapter/mappers/get-button-text.js +4 -3
  175. package/src/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +6 -4
  176. package/src/components/FileUploadModal/FileUploadModal.js +88 -42
  177. package/src/components/ListingContainer/Listing/Listing.js +15 -5
  178. package/src/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +11 -5
  179. package/src/components/ListingContainer/Listing/MediaListing/MediaListing.js +10 -2
  180. package/src/components/ListingContainer/ListingContainer.js +13 -4
  181. package/src/index.js +17 -14
  182. package/src/utils/bustUrl.js +6 -0
  183. package/lib-es/components/CardMedia/CardMedia.js +0 -219
  184. package/lib-es/components/CardMedia/CardMedia.js.map +0 -1
  185. package/lib-es/components/CardMedia/index.js +0 -3
  186. package/lib-es/components/CardMedia/index.js.map +0 -1
  187. package/lib-es/components/EditMediaFile/EditMediaFile.js +0 -115
  188. package/lib-es/components/EditMediaFile/EditMediaFile.js.map +0 -1
  189. package/lib-es/components/EditMediaFile/EditMediaFilePage.js +0 -86
  190. package/lib-es/components/EditMediaFile/EditMediaFilePage.js.map +0 -1
  191. package/lib-es/components/EditMediaFile/index.js +0 -3
  192. package/lib-es/components/EditMediaFile/index.js.map +0 -1
  193. package/lib-es/components/EditorAdapter/EditorAdapter.js +0 -39
  194. package/lib-es/components/EditorAdapter/EditorAdapter.js.map +0 -1
  195. package/lib-es/components/EditorAdapter/index.js +0 -3
  196. package/lib-es/components/EditorAdapter/index.js.map +0 -1
  197. package/lib-es/components/FileList/FilesListContext/index.js +0 -4
  198. package/lib-es/components/FileList/FilesListContext/index.js.map +0 -1
  199. package/lib-es/components/FileList/FilesListProvider/index.js +0 -36
  200. package/lib-es/components/FileList/FilesListProvider/index.js.map +0 -1
  201. package/lib-es/components/FileList/useFileList/index.js +0 -5
  202. package/lib-es/components/FileList/useFileList/index.js.map +0 -1
  203. package/lib-es/components/FileList/useGetFiles/getFiles.js +0 -179
  204. package/lib-es/components/FileList/useGetFiles/getFiles.js.map +0 -1
  205. package/lib-es/components/FileList/useGetFiles/index.js +0 -3
  206. package/lib-es/components/FileList/useGetFiles/index.js.map +0 -1
  207. package/lib-es/components/FileList/useGetFiles/useGetFiles.js +0 -114
  208. package/lib-es/components/FileList/useGetFiles/useGetFiles.js.map +0 -1
  209. package/lib-es/components/FileList/useGetFilesList/getCounters.js +0 -11
  210. package/lib-es/components/FileList/useGetFilesList/getCounters.js.map +0 -1
  211. package/lib-es/components/FileList/useGetFilesList/index.js +0 -3
  212. package/lib-es/components/FileList/useGetFilesList/index.js.map +0 -1
  213. package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js +0 -172
  214. package/lib-es/components/FileList/useGetFilesList/useGetFilesList.js.map +0 -1
  215. package/lib-es/components/FilePreview/Actions/index.js +0 -38
  216. package/lib-es/components/FilePreview/Actions/index.js.map +0 -1
  217. package/lib-es/components/FilePreview/Image/Image.js +0 -27
  218. package/lib-es/components/FilePreview/Image/Image.js.map +0 -1
  219. package/lib-es/components/FilePreview/Image/RawImage.js +0 -31
  220. package/lib-es/components/FilePreview/Image/RawImage.js.map +0 -1
  221. package/lib-es/components/FilePreview/Image/imageSchema.js +0 -53
  222. package/lib-es/components/FilePreview/Image/imageSchema.js.map +0 -1
  223. package/lib-es/components/FilePreview/Image/index.js +0 -12
  224. package/lib-es/components/FilePreview/Image/index.js.map +0 -1
  225. package/lib-es/components/FilePreview/PDF/PDF.js +0 -34
  226. package/lib-es/components/FilePreview/PDF/PDF.js.map +0 -1
  227. package/lib-es/components/FilePreview/PDF/RawPDF.js +0 -33
  228. package/lib-es/components/FilePreview/PDF/RawPDF.js.map +0 -1
  229. package/lib-es/components/FilePreview/PDF/index.js +0 -12
  230. package/lib-es/components/FilePreview/PDF/index.js.map +0 -1
  231. package/lib-es/components/FilePreview/PDF/schema.js +0 -21
  232. package/lib-es/components/FilePreview/PDF/schema.js.map +0 -1
  233. package/lib-es/components/FilePreview/get-preview.js +0 -28
  234. package/lib-es/components/FilePreview/get-preview.js.map +0 -1
  235. package/lib-es/components/FilePreview/index.js +0 -85
  236. package/lib-es/components/FilePreview/index.js.map +0 -1
  237. package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js +0 -27
  238. package/lib-es/components/FilePreview/previewDefault/PreviewDefault.js.map +0 -1
  239. package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js +0 -31
  240. package/lib-es/components/FilePreview/previewDefault/RawPreviewDefault.js.map +0 -1
  241. package/lib-es/components/FilePreview/previewDefault/icons/DefaultIcon.js +0 -121
  242. package/lib-es/components/FilePreview/previewDefault/icons/DefaultIcon.js.map +0 -1
  243. package/lib-es/components/FilePreview/previewDefault/icons/index.js +0 -3
  244. package/lib-es/components/FilePreview/previewDefault/icons/index.js.map +0 -1
  245. package/lib-es/components/FilePreview/previewDefault/index.js +0 -12
  246. package/lib-es/components/FilePreview/previewDefault/index.js.map +0 -1
  247. package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js +0 -25
  248. package/lib-es/components/FilePreview/previewDefault/previewDefaultSchema.js.map +0 -1
  249. package/lib-es/components/FilePreviewReadOnly/FileList.js +0 -18
  250. package/lib-es/components/FilePreviewReadOnly/FileList.js.map +0 -1
  251. package/lib-es/components/FilePreviewReadOnly/FilePreviewList.js +0 -22
  252. package/lib-es/components/FilePreviewReadOnly/FilePreviewList.js.map +0 -1
  253. package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js +0 -66
  254. package/lib-es/components/FilePreviewReadOnly/FilePreviewReadOnly.js.map +0 -1
  255. package/lib-es/components/FilePreviewReadOnly/index.js +0 -3
  256. package/lib-es/components/FilePreviewReadOnly/index.js.map +0 -1
  257. package/lib-es/components/FilePreviewReadOnly/mappers/format-initial-value.js +0 -11
  258. package/lib-es/components/FilePreviewReadOnly/mappers/format-initial-value.js.map +0 -1
  259. package/lib-es/components/FilePreviewReadOnly/mappers/index.js +0 -3
  260. package/lib-es/components/FilePreviewReadOnly/mappers/index.js.map +0 -1
  261. package/lib-es/components/FileUploadAdapter/FileList.js +0 -52
  262. package/lib-es/components/FileUploadAdapter/FileList.js.map +0 -1
  263. package/lib-es/components/FileUploadAdapter/FilePreviewList.js +0 -22
  264. package/lib-es/components/FileUploadAdapter/FilePreviewList.js.map +0 -1
  265. package/lib-es/components/FileUploadAdapter/FileReorderList.js +0 -32
  266. package/lib-es/components/FileUploadAdapter/FileReorderList.js.map +0 -1
  267. package/lib-es/components/FileUploadAdapter/FileReorderListItem.js +0 -24
  268. package/lib-es/components/FileUploadAdapter/FileReorderListItem.js.map +0 -1
  269. package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js +0 -367
  270. package/lib-es/components/FileUploadAdapter/FileUploadAdapter.js.map +0 -1
  271. package/lib-es/components/FileUploadAdapter/index.js +0 -3
  272. package/lib-es/components/FileUploadAdapter/index.js.map +0 -1
  273. package/lib-es/components/FileUploadAdapter/mappers/format-initial-value.js +0 -11
  274. package/lib-es/components/FileUploadAdapter/mappers/format-initial-value.js.map +0 -1
  275. package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js +0 -9
  276. package/lib-es/components/FileUploadAdapter/mappers/get-button-text.js.map +0 -1
  277. package/lib-es/components/FileUploadAdapter/mappers/get-format.js +0 -12
  278. package/lib-es/components/FileUploadAdapter/mappers/get-format.js.map +0 -1
  279. package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js +0 -6
  280. package/lib-es/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js.map +0 -1
  281. package/lib-es/components/FileUploadAdapter/mappers/index.js +0 -8
  282. package/lib-es/components/FileUploadAdapter/mappers/index.js.map +0 -1
  283. package/lib-es/components/FileUploadAdapter/mappers/is-unselecting.js +0 -2
  284. package/lib-es/components/FileUploadAdapter/mappers/is-unselecting.js.map +0 -1
  285. package/lib-es/components/FileUploadAdapter/mappers/transform-to-array.js +0 -2
  286. package/lib-es/components/FileUploadAdapter/mappers/transform-to-array.js.map +0 -1
  287. package/lib-es/components/FileUploadAdapter/useLimit.js +0 -13
  288. package/lib-es/components/FileUploadAdapter/useLimit.js.map +0 -1
  289. package/lib-es/components/FileUploadModal/FileUploadModal.js +0 -113
  290. package/lib-es/components/FileUploadModal/FileUploadModal.js.map +0 -1
  291. package/lib-es/components/FileUploadModal/index.js +0 -3
  292. package/lib-es/components/FileUploadModal/index.js.map +0 -1
  293. package/lib-es/components/FilterPanel/FilterPanel.js +0 -135
  294. package/lib-es/components/FilterPanel/FilterPanel.js.map +0 -1
  295. package/lib-es/components/FilterPanel/index.js +0 -3
  296. package/lib-es/components/FilterPanel/index.js.map +0 -1
  297. package/lib-es/components/ListingContainer/Listing/Listing.js +0 -58
  298. package/lib-es/components/ListingContainer/Listing/Listing.js.map +0 -1
  299. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js +0 -145
  300. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/MediaFileList.js.map +0 -1
  301. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js +0 -3
  302. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaFileList/index.js.map +0 -1
  303. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js +0 -24
  304. package/lib-es/components/ListingContainer/Listing/MediaListing/MediaListing.js.map +0 -1
  305. package/lib-es/components/ListingContainer/Listing/MediaListing/index.js +0 -3
  306. package/lib-es/components/ListingContainer/Listing/MediaListing/index.js.map +0 -1
  307. package/lib-es/components/ListingContainer/Listing/index.js +0 -3
  308. package/lib-es/components/ListingContainer/Listing/index.js.map +0 -1
  309. package/lib-es/components/ListingContainer/ListingContainer.js +0 -106
  310. package/lib-es/components/ListingContainer/ListingContainer.js.map +0 -1
  311. package/lib-es/components/ListingContainer/index.js +0 -3
  312. package/lib-es/components/ListingContainer/index.js.map +0 -1
  313. package/lib-es/components/ListingContainer/mappers/exist-previous.js +0 -3
  314. package/lib-es/components/ListingContainer/mappers/exist-previous.js.map +0 -1
  315. package/lib-es/components/ListingContainer/mappers/index.js +0 -3
  316. package/lib-es/components/ListingContainer/mappers/index.js.map +0 -1
  317. package/lib-es/components/MediaListing.js +0 -29
  318. package/lib-es/components/MediaListing.js.map +0 -1
  319. package/lib-es/constants.js +0 -36
  320. package/lib-es/constants.js.map +0 -1
  321. package/lib-es/icons/MediaLibraryIcon.js +0 -70
  322. package/lib-es/icons/MediaLibraryIcon.js.map +0 -1
  323. package/lib-es/icons/index.js +0 -3
  324. package/lib-es/icons/index.js.map +0 -1
  325. package/lib-es/index.js +0 -61
  326. package/lib-es/index.js.map +0 -1
  327. package/lib-es/utils/available-filters/available-filters.js +0 -26
  328. package/lib-es/utils/available-filters/available-filters.js.map +0 -1
  329. package/lib-es/utils/media-context/index.js +0 -4
  330. package/lib-es/utils/media-context/index.js.map +0 -1
  331. package/lib-es/utils/media-context/media-context.js +0 -6
  332. package/lib-es/utils/media-context/media-context.js.map +0 -1
  333. package/lib-es/utils/media-context/useMediaContext.js +0 -4
  334. package/lib-es/utils/media-context/useMediaContext.js.map +0 -1
@@ -1,367 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- 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; }
3
- 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; }
4
- import React, { useState, useContext, useEffect } from 'react';
5
- import FileUpload from '@blaze-react/file-upload';
6
- import PropTypes from 'prop-types';
7
- import { useApolloClient } from '@apollo/client';
8
- import { getQuery, getMutation, ModalAdapter as Modal } from '@blaze-cms/admin-ui-utils';
9
- import { parseFormValues } from '@blaze-cms/react-form-builder';
10
- import { useToasts } from '@blaze-react/toaster';
11
- import { MORE } from '../../constants';
12
- import ListingContainer from '../ListingContainer';
13
- import { MediaContextProvider } from '../../utils/media-context';
14
- import FileList from './FileList';
15
- import useLimit from './useLimit';
16
- import { getFormat, formatInitialValue, transformToArray, isUnselecting, getButtonText, getNumberFilesPendingToFetch } from './mappers';
17
- import FilePreview from '../FilePreview';
18
- const FileUploadAdapter = ({
19
- onChange,
20
- label,
21
- id,
22
- type,
23
- value,
24
- maxItems,
25
- shouldRenderInPreview,
26
- canDragAndDrop,
27
- simpleLayout,
28
- previewAllFiles
29
- }) => {
30
- const {
31
- InjectPreview
32
- } = useContext(FileUploadAdapter.FormContext);
33
- const [currentLimit] = useLimit(maxItems);
34
- const [displayModal, setDisplayModal] = useState(false);
35
- const [displayFileUploadModal, setDisplayFileUploadModal] = useState(false);
36
- const initialValue = formatInitialValue({
37
- value,
38
- type
39
- });
40
- const [currentValue, setCurrentValue] = useState(initialValue);
41
- const [currentOffset, setCurrentOffset] = useState(0);
42
- const [selectedFiles, setSelectedFiles] = useState([]);
43
- const [editFile, setEditFile] = useState(null);
44
- const client = useApolloClient();
45
- const {
46
- addToast
47
- } = useToasts();
48
- const getFiles = async (offset, ids, fetchAll = previewAllFiles) => {
49
- const {
50
- data: {
51
- files: newFiles
52
- }
53
- } = await client.query({
54
- query: getQuery('GET_FILES'),
55
- variables: {
56
- limit: fetchAll ? 0 : 4,
57
- offset,
58
- where: {
59
- id: {
60
- _in: ids
61
- }
62
- }
63
- },
64
- skip: !currentValue.length,
65
- fetchPolicy: 'network-only'
66
- });
67
- return newFiles;
68
- };
69
- useEffect(() => {
70
- (async () => {
71
- const initialFiles = !selectedFiles.length && !previewAllFiles ? currentValue.filter((_, i) => i <= 3) : currentValue;
72
- const files = await getFiles(0, initialFiles);
73
- const orderedFiles = orderFiles(files, currentValue);
74
- setCurrentOffset(0);
75
- setSelectedFiles(orderedFiles);
76
- })();
77
- }, [currentValue] //eslint-disable-line
78
- );
79
- const fetchMore = async shouldFetchAll => {
80
- if (selectedFiles.length === currentValue.length) return;
81
- const newOffset = currentOffset + 4;
82
- const updatedOffset = newOffset > currentValue.length ? currentValue.length : newOffset;
83
- const offsetToUse = shouldFetchAll ? 0 : updatedOffset;
84
- const files = await getFiles(offsetToUse, currentValue, shouldFetchAll);
85
- const newFiles = [...selectedFiles, ...files];
86
- const orderedFiles = orderFiles(newFiles, currentValue);
87
- setSelectedFiles(orderedFiles);
88
- setCurrentOffset(newOffset);
89
- };
90
- const handleSelectedFiles = (files, checkIsUnselecting = true) => {
91
- const isUnselectingFile = isUnselecting(value, checkIsUnselecting, files);
92
- if (isUnselectingFile) {
93
- const valueArray = transformToArray(value);
94
- const selectedFilesIds = valueArray.filter(valueId => !files.includes(valueId));
95
- const parsedValue = getFormat(type, {
96
- filesIds: selectedFilesIds
97
- });
98
- setCurrentValue(selectedFilesIds);
99
- return onChange({
100
- event: {
101
- target: {
102
- value: parsedValue,
103
- name: id,
104
- type,
105
- fileData: selectedFilesIds.length ? selectedFilesIds : null
106
- }
107
- },
108
- value: parsedValue
109
- });
110
- }
111
- setCurrentValue(files);
112
- };
113
- const handleReorderFiles = files => {
114
- const filesIds = files.map(({
115
- id: fileId
116
- }) => fileId);
117
- const parsedValue = getFormat(type, {
118
- filesIds
119
- });
120
- setSelectedFiles(files);
121
- return onChange({
122
- event: {
123
- target: {
124
- value: parsedValue,
125
- name: id,
126
- type,
127
- fileData: filesIds
128
- }
129
- },
130
- value: parsedValue
131
- });
132
- };
133
- const closeModalAndSetValue = (isSaving, values, toastMessage) => {
134
- if (toastMessage) {
135
- addToast(toastMessage, {
136
- appearance: 'success',
137
- autoDismiss: true
138
- });
139
- }
140
- if (isSaving) {
141
- const parsedValue = getFormat(type, {
142
- filesIds: simpleLayout ? values : currentValue
143
- });
144
- setDisplayModal(false);
145
- return onChange({
146
- event: {
147
- target: {
148
- value: parsedValue,
149
- name: id,
150
- type,
151
- currentValue
152
- }
153
- },
154
- value: parsedValue
155
- });
156
- }
157
- setCurrentValue(initialValue);
158
- setDisplayModal(false);
159
- };
160
- const fileUploadButtonText = getButtonText({
161
- maxItems,
162
- value: initialValue
163
- });
164
- const filesPending = previewAllFiles ? 0 : getNumberFilesPendingToFetch(currentOffset, currentValue);
165
- const onOpenLibrary = () => setDisplayModal(true);
166
- const handleEditModal = file => {
167
- const selectedEditFile = selectedFiles.find(({
168
- id: _id
169
- }) => _id === file.id);
170
- setEditFile(selectedEditFile);
171
- };
172
- const handleEditFileForm = editedFile => {
173
- const values = parseFormValues(editedFile.valuesChecked);
174
- const {
175
- altText,
176
- caption,
177
- credits,
178
- hrefUrl,
179
- name
180
- } = values;
181
- setEditFile(_objectSpread(_objectSpread({}, editFile), {}, {
182
- name,
183
- data: {
184
- altText,
185
- caption,
186
- credits,
187
- hrefUrl
188
- }
189
- }));
190
- };
191
- const orderFiles = (files, ids) => ids.map(currentId => files.find(({
192
- id: fileId
193
- }) => fileId === currentId)).filter(Boolean);
194
- const modalActions = [{
195
- textButton: 'Cancel',
196
- callback: () => {
197
- closeModalAndSetValue();
198
- },
199
- modifiers: ['cancel']
200
- }, {
201
- textButton: 'Save',
202
- callback: () => {
203
- closeModalAndSetValue(true);
204
- },
205
- modifiers: []
206
- }];
207
- const editModalActions = [{
208
- textButton: 'Cancel',
209
- callback: () => {
210
- setEditFile(null);
211
- },
212
- modifiers: ['cancel']
213
- }, {
214
- textButton: 'Save',
215
- callback: async () => {
216
- const {
217
- name,
218
- id: editedFileId,
219
- data
220
- } = editFile;
221
- const updatedSelectedFiles = selectedFiles.map(selectedFile => {
222
- if (selectedFile.id === editedFileId) {
223
- return _objectSpread(_objectSpread({}, selectedFile), {}, {
224
- name,
225
- data
226
- });
227
- }
228
- return selectedFile;
229
- });
230
- setSelectedFiles(updatedSelectedFiles);
231
- try {
232
- await client.mutate({
233
- mutation: getMutation('UPDATE_FILE'),
234
- variables: {
235
- input: {
236
- name,
237
- data,
238
- id: editedFileId
239
- }
240
- },
241
- update(cache, {
242
- data: {
243
- updateFile: fileUpdated
244
- }
245
- }) {
246
- cache.writeQuery({
247
- query: getQuery('GET_FILE_BY_ID'),
248
- variables: {
249
- id
250
- },
251
- data: {
252
- file: fileUpdated.result
253
- }
254
- });
255
- }
256
- });
257
- addToast(`File: ${editFile.name} has been updated`, {
258
- appearance: 'success',
259
- autoDismiss: true
260
- });
261
- closeModalAndSetValue(true);
262
- setEditFile(null);
263
- } catch (e) {
264
- addToast(`File: ${editFile.name} has not been updated`, {
265
- appearance: 'error',
266
- autoDismiss: true
267
- });
268
- console.error(e); //eslint-disable-line
269
- }
270
- },
271
- modifiers: []
272
- }];
273
- const filesPendingString = `${filesPending} ${MORE}`;
274
- const fileListSpan = filesPending ?
275
- /*#__PURE__*/
276
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
277
- React.createElement("span", {
278
- className: "FileUploadAdapter__preview-link button button--link",
279
- onClick: fetchMore
280
- }, "+ ", filesPendingString) : null;
281
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
282
- className: "form-field form-field--button"
283
- }, /*#__PURE__*/React.createElement("label", null, label), selectedFiles && /*#__PURE__*/React.createElement(MediaContextProvider, {
284
- value: {
285
- handleEditModal,
286
- onUnselectFile: handleSelectedFiles
287
- }
288
- }, shouldRenderInPreview ? /*#__PURE__*/React.createElement(InjectPreview, {
289
- selector: FileUploadAdapter.previewerId
290
- }, /*#__PURE__*/React.createElement(FileList, {
291
- selectedFiles: selectedFiles,
292
- allFiles: currentValue,
293
- handleReorderFiles: handleReorderFiles,
294
- canDragAndDrop: canDragAndDrop,
295
- fetchMore: fetchMore
296
- }, fileListSpan)) : /*#__PURE__*/React.createElement(FileList, {
297
- selectedFiles: selectedFiles,
298
- handleReorderFiles: handleReorderFiles,
299
- fetchMore: fetchMore
300
- })), /*#__PURE__*/React.createElement(FileUpload, {
301
- actionText: fileUploadButtonText,
302
- handleLibraryClick: () => {
303
- if (simpleLayout) {
304
- setDisplayFileUploadModal(true);
305
- } else {
306
- onOpenLibrary();
307
- }
308
- },
309
- enableDragAndDrop: false
310
- })), editFile && /*#__PURE__*/React.createElement(Modal, {
311
- actions: editModalActions,
312
- title: "Edit File",
313
- onClose: () => setEditFile(null)
314
- }, /*#__PURE__*/React.createElement(FilePreview, {
315
- file: editFile,
316
- fileName: editFile.fileName,
317
- handleFormChange: handleEditFileForm,
318
- displayForm: true,
319
- previewType: "card"
320
- })), displayFileUploadModal && simpleLayout && /*#__PURE__*/React.createElement("div", {
321
- className: "file-upload-modal-wrapper"
322
- }, /*#__PURE__*/React.createElement(ListingContainer, {
323
- displayFileUploadModal: displayFileUploadModal,
324
- closeModalAndSetValue: closeModalAndSetValue,
325
- setDisplayFileUploadModal: setDisplayFileUploadModal,
326
- handleSelectedFiles: handleSelectedFiles,
327
- maxItems: currentLimit,
328
- simpleLayout: simpleLayout,
329
- filesSelected: currentValue.length > 1 ? currentValue : []
330
- })), displayModal && !simpleLayout && /*#__PURE__*/React.createElement("div", {
331
- className: "file-upload-modal-wrapper"
332
- }, /*#__PURE__*/React.createElement(Modal, {
333
- actions: modalActions,
334
- className: "file-upload-modal",
335
- title: "Media library",
336
- onClose: () => closeModalAndSetValue()
337
- }, /*#__PURE__*/React.createElement(ListingContainer, {
338
- closeModalAndSetValue: closeModalAndSetValue,
339
- displayFileUploadModal: displayFileUploadModal,
340
- setDisplayFileUploadModal: setDisplayFileUploadModal,
341
- handleSelectedFiles: handleSelectedFiles,
342
- maxItems: currentLimit,
343
- filesSelected: currentValue.length > 1 ? currentValue : []
344
- }))));
345
- };
346
- FileUploadAdapter.propTypes = {
347
- onChange: PropTypes.func.isRequired,
348
- label: PropTypes.string.isRequired,
349
- id: PropTypes.string.isRequired,
350
- type: PropTypes.string.isRequired,
351
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
352
- maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
353
- shouldRenderInPreview: PropTypes.bool,
354
- canDragAndDrop: PropTypes.bool,
355
- simpleLayout: PropTypes.bool,
356
- previewAllFiles: PropTypes.bool
357
- };
358
- FileUploadAdapter.defaultProps = {
359
- value: '',
360
- maxItems: false,
361
- shouldRenderInPreview: false,
362
- canDragAndDrop: false,
363
- simpleLayout: false,
364
- previewAllFiles: false
365
- };
366
- export default FileUploadAdapter;
367
- //# sourceMappingURL=FileUploadAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileUploadAdapter.js","names":["React","useState","useContext","useEffect","FileUpload","PropTypes","useApolloClient","getQuery","getMutation","ModalAdapter","Modal","parseFormValues","useToasts","MORE","ListingContainer","MediaContextProvider","FileList","useLimit","getFormat","formatInitialValue","transformToArray","isUnselecting","getButtonText","getNumberFilesPendingToFetch","FilePreview","FileUploadAdapter","onChange","label","id","type","value","maxItems","shouldRenderInPreview","canDragAndDrop","simpleLayout","previewAllFiles","InjectPreview","FormContext","currentLimit","displayModal","setDisplayModal","displayFileUploadModal","setDisplayFileUploadModal","initialValue","currentValue","setCurrentValue","currentOffset","setCurrentOffset","selectedFiles","setSelectedFiles","editFile","setEditFile","client","addToast","getFiles","offset","ids","fetchAll","data","files","newFiles","query","variables","limit","where","_in","skip","length","fetchPolicy","initialFiles","filter","_","i","orderedFiles","orderFiles","fetchMore","shouldFetchAll","newOffset","updatedOffset","offsetToUse","handleSelectedFiles","checkIsUnselecting","isUnselectingFile","valueArray","selectedFilesIds","valueId","includes","parsedValue","filesIds","event","target","name","fileData","handleReorderFiles","map","fileId","closeModalAndSetValue","isSaving","values","toastMessage","appearance","autoDismiss","fileUploadButtonText","filesPending","onOpenLibrary","handleEditModal","file","selectedEditFile","find","_id","handleEditFileForm","editedFile","valuesChecked","altText","caption","credits","hrefUrl","_objectSpread","currentId","Boolean","modalActions","textButton","callback","modifiers","editModalActions","editedFileId","updatedSelectedFiles","selectedFile","mutate","mutation","input","update","cache","updateFile","fileUpdated","writeQuery","result","e","console","error","filesPendingString","fileListSpan","createElement","className","onClick","Fragment","onUnselectFile","selector","previewerId","allFiles","actionText","handleLibraryClick","enableDragAndDrop","actions","title","onClose","fileName","handleFormChange","displayForm","previewType","filesSelected","propTypes","func","isRequired","string","oneOfType","array","number","bool","defaultProps"],"sources":["../../../src/components/FileUploadAdapter/FileUploadAdapter.js"],"sourcesContent":["import React, { useState, useContext, useEffect } from 'react';\nimport FileUpload from '@blaze-react/file-upload';\nimport PropTypes from 'prop-types';\nimport { useApolloClient } from '@apollo/client';\nimport { getQuery, getMutation, ModalAdapter as Modal } from '@blaze-cms/admin-ui-utils';\nimport { parseFormValues } from '@blaze-cms/react-form-builder';\nimport { useToasts } from '@blaze-react/toaster';\nimport { MORE } from '../../constants';\nimport ListingContainer from '../ListingContainer';\nimport { MediaContextProvider } from '../../utils/media-context';\nimport FileList from './FileList';\nimport useLimit from './useLimit';\nimport {\n getFormat,\n formatInitialValue,\n transformToArray,\n isUnselecting,\n getButtonText,\n getNumberFilesPendingToFetch\n} from './mappers';\nimport FilePreview from '../FilePreview';\n\nconst FileUploadAdapter = ({\n onChange,\n label,\n id,\n type,\n value,\n maxItems,\n shouldRenderInPreview,\n canDragAndDrop,\n simpleLayout,\n previewAllFiles\n}) => {\n const { InjectPreview } = useContext(FileUploadAdapter.FormContext);\n const [currentLimit] = useLimit(maxItems);\n const [displayModal, setDisplayModal] = useState(false);\n const [displayFileUploadModal, setDisplayFileUploadModal] = useState(false);\n const initialValue = formatInitialValue({ value, type });\n const [currentValue, setCurrentValue] = useState(initialValue);\n const [currentOffset, setCurrentOffset] = useState(0);\n const [selectedFiles, setSelectedFiles] = useState([]);\n const [editFile, setEditFile] = useState(null);\n const client = useApolloClient();\n const { addToast } = useToasts();\n\n const getFiles = async (offset, ids, fetchAll = previewAllFiles) => {\n const {\n data: { files: newFiles }\n } = await client.query({\n query: getQuery('GET_FILES'),\n variables: {\n limit: fetchAll ? 0 : 4,\n offset,\n where: {\n id: {\n _in: ids\n }\n }\n },\n skip: !currentValue.length,\n fetchPolicy: 'network-only'\n });\n return newFiles;\n };\n\n useEffect(\n () => {\n (async () => {\n const initialFiles =\n !selectedFiles.length && !previewAllFiles\n ? currentValue.filter((_, i) => i <= 3)\n : currentValue;\n\n const files = await getFiles(0, initialFiles);\n const orderedFiles = orderFiles(files, currentValue);\n setCurrentOffset(0);\n setSelectedFiles(orderedFiles);\n })();\n },\n [currentValue] //eslint-disable-line\n );\n\n const fetchMore = async shouldFetchAll => {\n if (selectedFiles.length === currentValue.length) return;\n const newOffset = currentOffset + 4;\n const updatedOffset = newOffset > currentValue.length ? currentValue.length : newOffset;\n const offsetToUse = shouldFetchAll ? 0 : updatedOffset;\n const files = await getFiles(offsetToUse, currentValue, shouldFetchAll);\n const newFiles = [...selectedFiles, ...files];\n const orderedFiles = orderFiles(newFiles, currentValue);\n setSelectedFiles(orderedFiles);\n setCurrentOffset(newOffset);\n };\n\n const handleSelectedFiles = (files, checkIsUnselecting = true) => {\n const isUnselectingFile = isUnselecting(value, checkIsUnselecting, files);\n if (isUnselectingFile) {\n const valueArray = transformToArray(value);\n const selectedFilesIds = valueArray.filter(valueId => !files.includes(valueId));\n const parsedValue = getFormat(type, { filesIds: selectedFilesIds });\n setCurrentValue(selectedFilesIds);\n return onChange({\n event: {\n target: {\n value: parsedValue,\n name: id,\n type,\n fileData: selectedFilesIds.length ? selectedFilesIds : null\n }\n },\n value: parsedValue\n });\n }\n\n setCurrentValue(files);\n };\n\n const handleReorderFiles = files => {\n const filesIds = files.map(({ id: fileId }) => fileId);\n const parsedValue = getFormat(type, { filesIds });\n setSelectedFiles(files);\n\n return onChange({\n event: {\n target: {\n value: parsedValue,\n name: id,\n type,\n fileData: filesIds\n }\n },\n value: parsedValue\n });\n };\n\n const closeModalAndSetValue = (isSaving, values, toastMessage) => {\n if (toastMessage) {\n addToast(toastMessage, {\n appearance: 'success',\n autoDismiss: true\n });\n }\n\n if (isSaving) {\n const parsedValue = getFormat(type, { filesIds: simpleLayout ? values : currentValue });\n setDisplayModal(false);\n return onChange({\n event: { target: { value: parsedValue, name: id, type, currentValue } },\n value: parsedValue\n });\n }\n\n setCurrentValue(initialValue);\n setDisplayModal(false);\n };\n\n const fileUploadButtonText = getButtonText({ maxItems, value: initialValue });\n\n const filesPending = previewAllFiles\n ? 0\n : getNumberFilesPendingToFetch(currentOffset, currentValue);\n const onOpenLibrary = () => setDisplayModal(true);\n const handleEditModal = file => {\n const selectedEditFile = selectedFiles.find(({ id: _id }) => _id === file.id);\n setEditFile(selectedEditFile);\n };\n\n const handleEditFileForm = editedFile => {\n const values = parseFormValues(editedFile.valuesChecked);\n\n const { altText, caption, credits, hrefUrl, name } = values;\n setEditFile({\n ...editFile,\n name,\n data: {\n altText,\n caption,\n credits,\n hrefUrl\n }\n });\n };\n\n const orderFiles = (files, ids) =>\n ids.map(currentId => files.find(({ id: fileId }) => fileId === currentId)).filter(Boolean);\n\n const modalActions = [\n {\n textButton: 'Cancel',\n callback: () => {\n closeModalAndSetValue();\n },\n modifiers: ['cancel']\n },\n {\n textButton: 'Save',\n callback: () => {\n closeModalAndSetValue(true);\n },\n modifiers: []\n }\n ];\n\n const editModalActions = [\n {\n textButton: 'Cancel',\n callback: () => {\n setEditFile(null);\n },\n modifiers: ['cancel']\n },\n {\n textButton: 'Save',\n callback: async () => {\n const { name, id: editedFileId, data } = editFile;\n const updatedSelectedFiles = selectedFiles.map(selectedFile => {\n if (selectedFile.id === editedFileId) {\n return { ...selectedFile, name, data };\n }\n return selectedFile;\n });\n setSelectedFiles(updatedSelectedFiles);\n\n try {\n await client.mutate({\n mutation: getMutation('UPDATE_FILE'),\n variables: {\n input: {\n name,\n data,\n id: editedFileId\n }\n },\n update(cache, { data: { updateFile: fileUpdated } }) {\n cache.writeQuery({\n query: getQuery('GET_FILE_BY_ID'),\n variables: { id },\n data: { file: fileUpdated.result }\n });\n }\n });\n\n addToast(`File: ${editFile.name} has been updated`, {\n appearance: 'success',\n autoDismiss: true\n });\n closeModalAndSetValue(true);\n setEditFile(null);\n } catch (e) {\n addToast(`File: ${editFile.name} has not been updated`, {\n appearance: 'error',\n autoDismiss: true\n });\n console.error(e); //eslint-disable-line\n }\n },\n modifiers: []\n }\n ];\n const filesPendingString = `${filesPending} ${MORE}`;\n const fileListSpan = filesPending ? (\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <span className=\"FileUploadAdapter__preview-link button button--link\" onClick={fetchMore}>\n + {filesPendingString}\n </span>\n ) : null;\n\n return (\n <>\n <div className=\"form-field form-field--button\">\n <label>{label}</label>\n {selectedFiles && (\n <MediaContextProvider value={{ handleEditModal, onUnselectFile: handleSelectedFiles }}>\n {shouldRenderInPreview ? (\n <InjectPreview selector={FileUploadAdapter.previewerId}>\n <FileList\n selectedFiles={selectedFiles}\n allFiles={currentValue}\n handleReorderFiles={handleReorderFiles}\n canDragAndDrop={canDragAndDrop}\n fetchMore={fetchMore}>\n {fileListSpan}\n </FileList>\n </InjectPreview>\n ) : (\n <FileList\n selectedFiles={selectedFiles}\n handleReorderFiles={handleReorderFiles}\n fetchMore={fetchMore}\n />\n )}\n </MediaContextProvider>\n )}\n <FileUpload\n actionText={fileUploadButtonText}\n handleLibraryClick={() => {\n if (simpleLayout) {\n setDisplayFileUploadModal(true);\n } else {\n onOpenLibrary();\n }\n }}\n enableDragAndDrop={false}\n />\n </div>\n {editFile && (\n <Modal actions={editModalActions} title=\"Edit File\" onClose={() => setEditFile(null)}>\n <FilePreview\n file={editFile}\n fileName={editFile.fileName}\n handleFormChange={handleEditFileForm}\n displayForm\n previewType=\"card\"\n />\n </Modal>\n )}\n\n {displayFileUploadModal && simpleLayout && (\n <div className=\"file-upload-modal-wrapper\">\n <ListingContainer\n displayFileUploadModal={displayFileUploadModal}\n closeModalAndSetValue={closeModalAndSetValue}\n setDisplayFileUploadModal={setDisplayFileUploadModal}\n handleSelectedFiles={handleSelectedFiles}\n maxItems={currentLimit}\n simpleLayout={simpleLayout}\n filesSelected={currentValue.length > 1 ? currentValue : []}\n />\n </div>\n )}\n\n {displayModal && !simpleLayout && (\n <div className=\"file-upload-modal-wrapper\">\n <Modal\n actions={modalActions}\n className=\"file-upload-modal\"\n title=\"Media library\"\n onClose={() => closeModalAndSetValue()}>\n <ListingContainer\n closeModalAndSetValue={closeModalAndSetValue}\n displayFileUploadModal={displayFileUploadModal}\n setDisplayFileUploadModal={setDisplayFileUploadModal}\n handleSelectedFiles={handleSelectedFiles}\n maxItems={currentLimit}\n filesSelected={currentValue.length > 1 ? currentValue : []}\n />\n </Modal>\n </div>\n )}\n </>\n );\n};\n\nFileUploadAdapter.propTypes = {\n onChange: PropTypes.func.isRequired,\n label: PropTypes.string.isRequired,\n id: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),\n maxItems: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),\n shouldRenderInPreview: PropTypes.bool,\n canDragAndDrop: PropTypes.bool,\n simpleLayout: PropTypes.bool,\n previewAllFiles: PropTypes.bool\n};\n\nFileUploadAdapter.defaultProps = {\n value: '',\n maxItems: false,\n shouldRenderInPreview: false,\n canDragAndDrop: false,\n simpleLayout: false,\n previewAllFiles: false\n};\n\nexport default FileUploadAdapter;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,UAAU,EAAEC,SAAS,QAAQ,OAAO;AAC9D,OAAOC,UAAU,MAAM,0BAA0B;AACjD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,QAAQ,EAAEC,WAAW,EAAEC,YAAY,IAAIC,KAAK,QAAQ,2BAA2B;AACxF,SAASC,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,IAAI,QAAQ,iBAAiB;AACtC,OAAOC,gBAAgB,MAAM,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,OAAOC,QAAQ,MAAM,YAAY;AACjC,OAAOC,QAAQ,MAAM,YAAY;AACjC,SACEC,SAAS,EACTC,kBAAkB,EAClBC,gBAAgB,EAChBC,aAAa,EACbC,aAAa,EACbC,4BAA4B,QACvB,WAAW;AAClB,OAAOC,WAAW,MAAM,gBAAgB;AAExC,MAAMC,iBAAiB,GAAGA,CAAC;EACzBC,QAAQ;EACRC,KAAK;EACLC,EAAE;EACFC,IAAI;EACJC,KAAK;EACLC,QAAQ;EACRC,qBAAqB;EACrBC,cAAc;EACdC,YAAY;EACZC;AACF,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAc,CAAC,GAAGlC,UAAU,CAACuB,iBAAiB,CAACY,WAAW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C/CC,yBAAyB,EAAEA,yBAA0B;IACrDsC,mBAAmB,EAAEA,mBAAoB;IACzCjD,QAAQ,EAAEO,YAAa;IACvB0H,aAAa,EAAEpH,YAAY,CAACuB,MAAM,GAAG,CAAC,GAAGvB,YAAY,GAAG;EAAG,CAC5D,CACI,CACJ,CAEP,CAAC;AAEP,CAAC;AAEDnB,iBAAiB,CAACwI,SAAS,GAAG;EAC5BvI,QAAQ,EAAErB,SAAS,CAAC6J,IAAI,CAACC,UAAU;EACnCxI,KAAK,EAAEtB,SAAS,CAAC+J,MAAM,CAACD,UAAU;EAClCvI,EAAE,EAAEvB,SAAS,CAAC+J,MAAM,CAACD,UAAU;EAC/BtI,IAAI,EAAExB,SAAS,CAAC+J,MAAM,CAACD,UAAU;EACjCrI,KAAK,EAAEzB,SAAS,CAACgK,SAAS,CAAC,CAAChK,SAAS,CAAC+J,MAAM,EAAE/J,SAAS,CAACiK,KAAK,CAAC,CAAC;EAC/DvI,QAAQ,EAAE1B,SAAS,CAACgK,SAAS,CAAC,CAAChK,SAAS,CAACkK,MAAM,EAAElK,SAAS,CAACmK,IAAI,CAAC,CAAC;EACjExI,qBAAqB,EAAE3B,SAAS,CAACmK,IAAI;EACrCvI,cAAc,EAAE5B,SAAS,CAACmK,IAAI;EAC9BtI,YAAY,EAAE7B,SAAS,CAACmK,IAAI;EAC5BrI,eAAe,EAAE9B,SAAS,CAACmK;AAC7B,CAAC;AAED/I,iBAAiB,CAACgJ,YAAY,GAAG;EAC/B3I,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,KAAK;EACfC,qBAAqB,EAAE,KAAK;EAC5BC,cAAc,EAAE,KAAK;EACrBC,YAAY,EAAE,KAAK;EACnBC,eAAe,EAAE;AACnB,CAAC;AAED,eAAeV,iBAAiB","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import FileUploadAdapter from './FileUploadAdapter';
2
- export default FileUploadAdapter;
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["FileUploadAdapter"],"sources":["../../../src/components/FileUploadAdapter/index.js"],"sourcesContent":["import FileUploadAdapter from './FileUploadAdapter';\n\nexport default FileUploadAdapter;\n"],"mappings":"AAAA,OAAOA,iBAAiB,MAAM,qBAAqB;AAEnD,eAAeA,iBAAiB","ignoreList":[]}
@@ -1,11 +0,0 @@
1
- const formatInitialValue = ({
2
- value,
3
- type
4
- }) => {
5
- const parsedValue = value && type === 'array' ? value : [value];
6
- const existValue = parsedValue.filter(Boolean).length;
7
- if (!parsedValue || !existValue) return [];
8
- return parsedValue;
9
- };
10
- export { formatInitialValue };
11
- //# sourceMappingURL=format-initial-value.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-initial-value.js","names":["formatInitialValue","value","type","parsedValue","existValue","filter","Boolean","length"],"sources":["../../../../src/components/FileUploadAdapter/mappers/format-initial-value.js"],"sourcesContent":["const formatInitialValue = ({ value, type }) => {\n const parsedValue = value && type === 'array' ? value : [value];\n const existValue = parsedValue.filter(Boolean).length;\n if (!parsedValue || !existValue) return [];\n return parsedValue;\n};\n\nexport { formatInitialValue };\n"],"mappings":"AAAA,MAAMA,kBAAkB,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAK,CAAC,KAAK;EAC9C,MAAMC,WAAW,GAAGF,KAAK,IAAIC,IAAI,KAAK,OAAO,GAAGD,KAAK,GAAG,CAACA,KAAK,CAAC;EAC/D,MAAMG,UAAU,GAAGD,WAAW,CAACE,MAAM,CAACC,OAAO,CAAC,CAACC,MAAM;EACrD,IAAI,CAACJ,WAAW,IAAI,CAACC,UAAU,EAAE,OAAO,EAAE;EAC1C,OAAOD,WAAW;AACpB,CAAC;AAED,SAASH,kBAAkB","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- const getButtonText = ({
2
- maxItems,
3
- value
4
- }) => {
5
- const fileLabel = maxItems > 1 ? 'Add File/s' : 'Add file';
6
- return value && value.length ? 'Change file' : fileLabel;
7
- };
8
- export { getButtonText };
9
- //# sourceMappingURL=get-button-text.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-button-text.js","names":["getButtonText","maxItems","value","fileLabel","length"],"sources":["../../../../src/components/FileUploadAdapter/mappers/get-button-text.js"],"sourcesContent":["const getButtonText = ({ maxItems, value }) => {\n const fileLabel = maxItems > 1 ? 'Add File/s' : 'Add file';\n return value && value.length ? 'Change file' : fileLabel;\n};\n\nexport { getButtonText };\n"],"mappings":"AAAA,MAAMA,aAAa,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAM,CAAC,KAAK;EAC7C,MAAMC,SAAS,GAAGF,QAAQ,GAAG,CAAC,GAAG,YAAY,GAAG,UAAU;EAC1D,OAAOC,KAAK,IAAIA,KAAK,CAACE,MAAM,GAAG,aAAa,GAAGD,SAAS;AAC1D,CAAC;AAED,SAASH,aAAa","ignoreList":[]}
@@ -1,12 +0,0 @@
1
- const getFormat = (type, {
2
- filesIds
3
- } = {
4
- filesIds: []
5
- }) => {
6
- if (!filesIds || !filesIds.length) return null;
7
- const [primaryType] = Array.isArray(type) ? type : [type];
8
- if (primaryType === 'array') return filesIds || [];
9
- if (primaryType === 'string') return filesIds.join() || '';
10
- };
11
- export { getFormat };
12
- //# sourceMappingURL=get-format.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-format.js","names":["getFormat","type","filesIds","length","primaryType","Array","isArray","join"],"sources":["../../../../src/components/FileUploadAdapter/mappers/get-format.js"],"sourcesContent":["const getFormat = (type, { filesIds } = { filesIds: [] }) => {\n if (!filesIds || !filesIds.length) return null;\n\n const [primaryType] = Array.isArray(type) ? type : [type];\n if (primaryType === 'array') return filesIds || [];\n if (primaryType === 'string') return filesIds.join() || '';\n};\n\nexport { getFormat };\n"],"mappings":"AAAA,MAAMA,SAAS,GAAGA,CAACC,IAAI,EAAE;EAAEC;AAAS,CAAC,GAAG;EAAEA,QAAQ,EAAE;AAAG,CAAC,KAAK;EAC3D,IAAI,CAACA,QAAQ,IAAI,CAACA,QAAQ,CAACC,MAAM,EAAE,OAAO,IAAI;EAE9C,MAAM,CAACC,WAAW,CAAC,GAAGC,KAAK,CAACC,OAAO,CAACL,IAAI,CAAC,GAAGA,IAAI,GAAG,CAACA,IAAI,CAAC;EACzD,IAAIG,WAAW,KAAK,OAAO,EAAE,OAAOF,QAAQ,IAAI,EAAE;EAClD,IAAIE,WAAW,KAAK,QAAQ,EAAE,OAAOF,QAAQ,CAACK,IAAI,CAAC,CAAC,IAAI,EAAE;AAC5D,CAAC;AAED,SAASP,SAAS","ignoreList":[]}
@@ -1,6 +0,0 @@
1
- export const getNumberFilesPendingToFetch = (currentOffset, currentValue) => {
2
- const offsetSet = currentOffset + 4;
3
- const offset = currentValue.length < offsetSet ? currentValue.length : offsetSet;
4
- return currentValue.length - offset;
5
- };
6
- //# sourceMappingURL=get-number-files-pending-to-fetch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-number-files-pending-to-fetch.js","names":["getNumberFilesPendingToFetch","currentOffset","currentValue","offsetSet","offset","length"],"sources":["../../../../src/components/FileUploadAdapter/mappers/get-number-files-pending-to-fetch.js"],"sourcesContent":["export const getNumberFilesPendingToFetch = (currentOffset, currentValue) => {\n const offsetSet = currentOffset + 4;\n const offset = currentValue.length < offsetSet ? currentValue.length : offsetSet;\n return currentValue.length - offset;\n};\n"],"mappings":"AAAA,OAAO,MAAMA,4BAA4B,GAAGA,CAACC,aAAa,EAAEC,YAAY,KAAK;EAC3E,MAAMC,SAAS,GAAGF,aAAa,GAAG,CAAC;EACnC,MAAMG,MAAM,GAAGF,YAAY,CAACG,MAAM,GAAGF,SAAS,GAAGD,YAAY,CAACG,MAAM,GAAGF,SAAS;EAChF,OAAOD,YAAY,CAACG,MAAM,GAAGD,MAAM;AACrC,CAAC","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import { isUnselecting } from './is-unselecting';
2
- import { transformToArray } from './transform-to-array';
3
- import { getFormat } from './get-format';
4
- import { getButtonText } from './get-button-text';
5
- import { formatInitialValue } from './format-initial-value';
6
- import { getNumberFilesPendingToFetch } from './get-number-files-pending-to-fetch';
7
- export { isUnselecting, transformToArray, getFormat, getButtonText, formatInitialValue, getNumberFilesPendingToFetch };
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["isUnselecting","transformToArray","getFormat","getButtonText","formatInitialValue","getNumberFilesPendingToFetch"],"sources":["../../../../src/components/FileUploadAdapter/mappers/index.js"],"sourcesContent":["import { isUnselecting } from './is-unselecting';\nimport { transformToArray } from './transform-to-array';\nimport { getFormat } from './get-format';\nimport { getButtonText } from './get-button-text';\nimport { formatInitialValue } from './format-initial-value';\nimport { getNumberFilesPendingToFetch } from './get-number-files-pending-to-fetch';\n\nexport {\n isUnselecting,\n transformToArray,\n getFormat,\n getButtonText,\n formatInitialValue,\n getNumberFilesPendingToFetch\n};\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,kBAAkB;AAChD,SAASC,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,SAASC,4BAA4B,QAAQ,qCAAqC;AAElF,SACEL,aAAa,EACbC,gBAAgB,EAChBC,SAAS,EACTC,aAAa,EACbC,kBAAkB,EAClBC,4BAA4B","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export const isUnselecting = (value, checkIsUnselecting, files) => value && checkIsUnselecting && files.some(fileId => value.includes(fileId));
2
- //# sourceMappingURL=is-unselecting.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"is-unselecting.js","names":["isUnselecting","value","checkIsUnselecting","files","some","fileId","includes"],"sources":["../../../../src/components/FileUploadAdapter/mappers/is-unselecting.js"],"sourcesContent":["export const isUnselecting = (value, checkIsUnselecting, files) =>\n value && checkIsUnselecting && files.some(fileId => value.includes(fileId));\n"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAGA,CAACC,KAAK,EAAEC,kBAAkB,EAAEC,KAAK,KAC5DF,KAAK,IAAIC,kBAAkB,IAAIC,KAAK,CAACC,IAAI,CAACC,MAAM,IAAIJ,KAAK,CAACK,QAAQ,CAACD,MAAM,CAAC,CAAC","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export const transformToArray = value => Array.isArray(value) ? value : [value];
2
- //# sourceMappingURL=transform-to-array.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform-to-array.js","names":["transformToArray","value","Array","isArray"],"sources":["../../../../src/components/FileUploadAdapter/mappers/transform-to-array.js"],"sourcesContent":["export const transformToArray = value => (Array.isArray(value) ? value : [value]);\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAGC,KAAK,IAAKC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,GAAGA,KAAK,GAAG,CAACA,KAAK,CAAE","ignoreList":[]}
@@ -1,13 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { ONE_FILE_AS_LIMIT } from '../../constants';
3
- function useLimit(initialLimit) {
4
- const [currentLimit, setCurrentLimit] = useState(initialLimit);
5
- useEffect(() => {
6
- if (initialLimit && currentLimit !== ONE_FILE_AS_LIMIT) {
7
- setCurrentLimit(ONE_FILE_AS_LIMIT);
8
- }
9
- }, [currentLimit, initialLimit]);
10
- return [currentLimit, setCurrentLimit];
11
- }
12
- export default useLimit;
13
- //# sourceMappingURL=useLimit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useLimit.js","names":["useEffect","useState","ONE_FILE_AS_LIMIT","useLimit","initialLimit","currentLimit","setCurrentLimit"],"sources":["../../../src/components/FileUploadAdapter/useLimit.js"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { ONE_FILE_AS_LIMIT } from '../../constants';\n\nfunction useLimit(initialLimit) {\n const [currentLimit, setCurrentLimit] = useState(initialLimit);\n useEffect(() => {\n if (initialLimit && currentLimit !== ONE_FILE_AS_LIMIT) {\n setCurrentLimit(ONE_FILE_AS_LIMIT);\n }\n }, [currentLimit, initialLimit]);\n\n return [currentLimit, setCurrentLimit];\n}\n\nexport default useLimit;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,iBAAiB,QAAQ,iBAAiB;AAEnD,SAASC,QAAQA,CAACC,YAAY,EAAE;EAC9B,MAAM,CAACC,YAAY,EAAEC,eAAe,CAAC,GAAGL,QAAQ,CAACG,YAAY,CAAC;EAC9DJ,SAAS,CAAC,MAAM;IACd,IAAII,YAAY,IAAIC,YAAY,KAAKH,iBAAiB,EAAE;MACtDI,eAAe,CAACJ,iBAAiB,CAAC;IACpC;EACF,CAAC,EAAE,CAACG,YAAY,EAAED,YAAY,CAAC,CAAC;EAEhC,OAAO,CAACC,YAAY,EAAEC,eAAe,CAAC;AACxC;AAEA,eAAeH,QAAQ","ignoreList":[]}
@@ -1,113 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { ModalAdapter as Modal, getMutation, getQuery } from '@blaze-cms/admin-ui-utils';
3
- import FileUpload from '@blaze-react/file-upload';
4
- import PropTypes from 'prop-types';
5
- import { useToasts } from '@blaze-react/toaster';
6
- import { useApolloClient, useQuery } from '@apollo/client';
7
- import useFileList from '../FileList/useFileList';
8
- const FileUploadModal = ({
9
- onClose,
10
- getSelectedFiles,
11
- closeModalAndSetValue,
12
- simpleLayout
13
- }) => {
14
- const [files, setFiles] = useState([]);
15
- const {
16
- addToast
17
- } = useToasts();
18
- const client = useApolloClient();
19
- const {
20
- addNewFile
21
- } = useFileList();
22
- const fileStoresType = getQuery('GET_FILE_STORES');
23
- const {
24
- data: {
25
- getFileStores: storeType = []
26
- } = {}
27
- } = useQuery(fileStoresType, {
28
- variables: {
29
- visibleInAdmin: true
30
- }
31
- });
32
- const handleFiles = filesToUpload => {
33
- setFiles(filesToUpload);
34
- };
35
- const uploadFiles = async () => {
36
- const response = await Promise.all(files.map(({
37
- file,
38
- name,
39
- data: fileData,
40
- storeKey
41
- }) => client.mutate({
42
- mutation: getMutation('UPLOAD_FILE'),
43
- variables: {
44
- input: {
45
- file,
46
- name: name || file.filename,
47
- storeKey,
48
- data: fileData
49
- }
50
- }
51
- }))).catch(error => {
52
- addToast(error.message, {
53
- appearance: 'error',
54
- autoDismiss: true
55
- });
56
- });
57
- const parsedResponse = response.map(({
58
- data: {
59
- file
60
- }
61
- }) => file.result);
62
- const fileNames = files.map(({
63
- file
64
- }) => file.name);
65
- addNewFile(parsedResponse);
66
- const toastMessage = `Uploaded: ${fileNames.join(', ')}`;
67
- if (simpleLayout) {
68
- const filesToSelect = parsedResponse.map(file => file.id);
69
- getSelectedFiles(null, filesToSelect);
70
- closeModalAndSetValue(simpleLayout, filesToSelect, toastMessage);
71
- return;
72
- }
73
- addToast(toastMessage, {
74
- appearance: 'success',
75
- autoDismiss: true
76
- });
77
- };
78
- const handleOnSave = async () => {
79
- if (files.length) await uploadFiles();
80
- onClose();
81
- };
82
- const storeOptions = storeType.map(type => [type.key, type.name]);
83
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
84
- onClose: onClose,
85
- title: "Add media",
86
- actions: [{
87
- textButton: 'Cancel',
88
- callback: onClose,
89
- modifiers: ['cancel']
90
- }, {
91
- textButton: 'Save',
92
- callback: handleOnSave,
93
- modifiers: []
94
- }],
95
- upload: true
96
- }, /*#__PURE__*/React.createElement(FileUpload, {
97
- onChange: handleFiles,
98
- selectOptions: storeOptions
99
- })));
100
- };
101
- FileUploadModal.propTypes = {
102
- getSelectedFiles: PropTypes.func.isRequired,
103
- onClose: PropTypes.func,
104
- simpleLayout: PropTypes.bool,
105
- closeModalAndSetValue: PropTypes.func
106
- };
107
- FileUploadModal.defaultProps = {
108
- onClose: () => {},
109
- closeModalAndSetValue: () => {},
110
- simpleLayout: false
111
- };
112
- export default FileUploadModal;
113
- //# sourceMappingURL=FileUploadModal.js.map