@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
package/src/index.js CHANGED
@@ -1,25 +1,28 @@
1
- import React from 'react';
2
1
  import FileUploadAdapter from './components/FileUploadAdapter';
3
2
  import EditorAdapter from './components/EditorAdapter';
4
3
  import { MediaLibraryIcon } from './icons';
5
4
  import pkg from '../package.json';
6
5
  import { PLUGIN_NAME } from './constants';
6
+ import FilePreviewReadOnly from './components/FilePreviewReadOnly';
7
+ import MediaListing from './components/MediaListing';
8
+ import EditMediaFilePage from './components/EditMediaFile/EditMediaFilePage';
7
9
 
8
- export const FilePreviewReadOnly = React.lazy(
9
- () =>
10
- import(/* webpackChunkName: 'MediaFilePreviewReadOnly' */ './components/FilePreviewReadOnly')
11
- );
10
+ // todo: renable lazy loading after bundler optimisations, currently they are too slow in dev mode
11
+ // export const FilePreviewReadOnly = React.lazy(
12
+ // () =>
13
+ // import(/* webpackChunkName: 'MediaFilePreviewReadOnly' */ './components/FilePreviewReadOnly')
14
+ // );
12
15
 
13
- const MediaListing = React.lazy(
14
- () => import(/* webpackChunkName: 'MediaListingContainer' */ './components/MediaListing')
15
- );
16
+ // const MediaListing = React.lazy(
17
+ // () => import(/* webpackChunkName: 'MediaListingContainer' */ './components/MediaListing')
18
+ // );
16
19
 
17
- const EditMediaFilePage = React.lazy(
18
- () =>
19
- import(
20
- /* webpackChunkName: 'EditMediaFilePage' */ './components/EditMediaFile/EditMediaFilePage'
21
- )
22
- );
20
+ // const EditMediaFilePage = React.lazy(
21
+ // () =>
22
+ // import(
23
+ // /* webpackChunkName: 'EditMediaFilePage' */ './components/EditMediaFile/EditMediaFilePage'
24
+ // )
25
+ // );
23
26
  export default async function load(app) {
24
27
  app.events.once('admin:menu:config:load', ({ addConfig }) => {
25
28
  addConfig({
@@ -0,0 +1,6 @@
1
+ export default function bustUrl(url, updated) {
2
+ if (!url) return url;
3
+ const separator = url.includes('?') ? '&' : '?';
4
+ const version = updated || Date.now();
5
+ return `${url}${separator}v=${version}`;
6
+ }
@@ -1,219 +0,0 @@
1
- import React, { useState } from 'react';
2
- import More from '@blaze-react/more';
3
- import Button from '@blaze-react/button';
4
- import { DeleteAction } from '@blaze-cms/admin';
5
- import PropTypes from 'prop-types';
6
- import { getQuery, getMutation } from '@blaze-cms/admin-ui-utils';
7
- import { useMutation, useApolloClient } from '@apollo/client';
8
- import classnames from 'classnames';
9
- import { useToasts } from '@blaze-react/toaster';
10
- import Modal from '@blaze-react/modal';
11
- import { createPortal } from 'react-dom';
12
- import { Link } from 'react-router-dom';
13
- import EditMediaFile from '../EditMediaFile';
14
- const CardMedia = ({
15
- onSelected,
16
- name,
17
- url,
18
- mimetype,
19
- id,
20
- selected,
21
- displayLayout,
22
- data,
23
- modalTargetRef,
24
- updateFile,
25
- removeFile,
26
- index
27
- }) => {
28
- const [displayDeleteModal, setDisplayDeleteModal] = useState(false);
29
- const [displayEditModal, setDisplayEditModal] = useState(false);
30
- const [enableSaveButton, setEnableSaveButton] = useState(false);
31
- const [fileData, setFileData] = useState(null);
32
- const {
33
- addToast
34
- } = useToasts();
35
- const [deleteFile] = useMutation(getMutation('DELETE_FILE_BY_ID'));
36
- const [type, extension] = mimetype.split('/');
37
- const client = useApolloClient();
38
- const deleteFileById = async () => {
39
- setDisplayDeleteModal(false);
40
- try {
41
- await deleteFile({
42
- variables: {
43
- input: {
44
- id
45
- }
46
- }
47
- });
48
- removeFile({
49
- index
50
- });
51
- addToast(`File: ${name} has been deleted`, {
52
- appearance: 'success',
53
- autoDismiss: true
54
- });
55
- } catch (error) {
56
- addToast(error.message, {
57
- appearance: 'error',
58
- autoDismiss: true
59
- });
60
- }
61
- };
62
- const handleClick = () => {
63
- onSelected({
64
- id,
65
- url,
66
- name,
67
- data
68
- });
69
- };
70
- const cardMediaClassNames = classnames('card card--media-list', {
71
- 'card--media-list--selected': selected,
72
- [`card--media-${displayLayout}`]: displayLayout
73
- });
74
- const handleCloseModal = () => {
75
- setDisplayEditModal(false);
76
- };
77
- const handleSaveButtonStatus = state => {
78
- setEnableSaveButton(state);
79
- };
80
- const modalActions = [{
81
- textButton: 'Cancel',
82
- callback: handleCloseModal,
83
- modifiers: ['cancel']
84
- }, {
85
- textButton: 'Save',
86
- callback: () => handleFormSave(),
87
- modifiers: enableSaveButton ? [] : ['disabled']
88
- }];
89
- const handleFileChange = file => {
90
- setFileData(file);
91
- };
92
- const handleFormSave = async () => {
93
- try {
94
- const {
95
- data: {
96
- updateFile: updatedFile
97
- }
98
- } = await client.mutate({
99
- mutation: getMutation('UPDATE_FILE'),
100
- variables: {
101
- input: fileData
102
- },
103
- update(cache, {
104
- data: {
105
- updateFile: fileUpdated
106
- }
107
- }) {
108
- cache.writeQuery({
109
- query: getQuery('GET_FILE_BY_ID'),
110
- variables: {
111
- id
112
- },
113
- data: {
114
- file: fileUpdated.result
115
- }
116
- });
117
- }
118
- });
119
- updateFile({
120
- file: updatedFile.result,
121
- index
122
- });
123
- addToast(`File: ${fileData.name} has been updated`, {
124
- appearance: 'success',
125
- autoDismiss: true
126
- });
127
- } catch (e) {
128
- addToast(`File: ${fileData.name} has not been updated`, {
129
- appearance: 'error',
130
- autoDismiss: true
131
- });
132
- console.error(e); //eslint-disable-line
133
- }
134
- handleCloseModal();
135
- setEnableSaveButton(false);
136
- };
137
- return /*#__PURE__*/React.createElement(React.Fragment, null, displayEditModal && createPortal(/*#__PURE__*/React.createElement(Modal, {
138
- title: "Edit",
139
- actions: modalActions,
140
- onClose: handleCloseModal
141
- }, /*#__PURE__*/React.createElement(EditMediaFile, {
142
- onChange: handleFileChange,
143
- fileId: id,
144
- handleSaveButtonStatus: handleSaveButtonStatus,
145
- handleFormSave: handleFormSave,
146
- enableSaveButton: enableSaveButton
147
- })), modalTargetRef.current), /*#__PURE__*/React.createElement("div", {
148
- className: cardMediaClassNames,
149
- role: "button",
150
- onClick: handleClick
151
- }, displayDeleteModal && createPortal(/*#__PURE__*/React.createElement(DeleteAction, {
152
- onClose: () => setDisplayDeleteModal(false),
153
- deleteAction: () => deleteFileById(),
154
- itemName: name
155
- }), modalTargetRef.current), type === 'image' ? /*#__PURE__*/React.createElement("div", {
156
- className: `card__image card__image--media-${displayLayout}`
157
- }, /*#__PURE__*/React.createElement("img", {
158
- src: url,
159
- alt: name
160
- })) : /*#__PURE__*/React.createElement("div", {
161
- className: "card__image card__image--media-list-document"
162
- }, /*#__PURE__*/React.createElement("svg", {
163
- xmlns: "http://www.w3.org/2000/svg",
164
- width: "100",
165
- height: "100",
166
- viewBox: "0 0 8 8"
167
- }, /*#__PURE__*/React.createElement("path", {
168
- d: "M0 0v8h7v-4h-4v-4h-3zm4 0v3h3l-3-3zm-3 2h1v1h-1v-1zm0 2h1v1h-1v-1zm0 2h4v1h-4v-1z"
169
- }))), /*#__PURE__*/React.createElement("footer", {
170
- className: `card__footer card__footer--media-${displayLayout}`
171
- }, /*#__PURE__*/React.createElement("div", {
172
- className: `card__details card__details--media-${displayLayout}`
173
- }, /*#__PURE__*/React.createElement("div", {
174
- className: `card__title card__title--media-${displayLayout}`
175
- }, /*#__PURE__*/React.createElement("h2", null, name)), /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement("span", null, "format: ", extension))), /*#__PURE__*/React.createElement("div", {
176
- className: `card__menu card__menu--${displayLayout}`
177
- }, /*#__PURE__*/React.createElement("div", {
178
- className: "more-menu__wrapper more-menu__wrapper--card"
179
- }, /*#__PURE__*/React.createElement(More, {
180
- displayBg: true
181
- }, /*#__PURE__*/React.createElement(More.Avatar, {
182
- isMoreMenu: true
183
- }, /*#__PURE__*/React.createElement("span", {
184
- className: "material-icons"
185
- }, "more_vert")), /*#__PURE__*/React.createElement(More.Content, {
186
- isMoreMenu: true
187
- }, /*#__PURE__*/React.createElement(Link, {
188
- to: `/media/edit/${id}`,
189
- className: "more-menu__link"
190
- }, "Edit"), /*#__PURE__*/React.createElement(Button, {
191
- onClick: event => {
192
- event.preventDefault();
193
- event.stopPropagation();
194
- setDisplayDeleteModal(true);
195
- },
196
- className: "more-menu__link"
197
- }, "Delete"))))))));
198
- };
199
- CardMedia.propTypes = {
200
- name: PropTypes.string.isRequired,
201
- url: PropTypes.string.isRequired,
202
- id: PropTypes.string.isRequired,
203
- mimetype: PropTypes.string.isRequired,
204
- displayLayout: PropTypes.string.isRequired,
205
- data: PropTypes.object,
206
- onSelected: PropTypes.func,
207
- updateFile: PropTypes.func.isRequired,
208
- removeFile: PropTypes.func.isRequired,
209
- selected: PropTypes.bool,
210
- modalTargetRef: PropTypes.object.isRequired,
211
- index: PropTypes.number.isRequired
212
- };
213
- CardMedia.defaultProps = {
214
- onSelected: () => {},
215
- selected: false,
216
- data: {}
217
- };
218
- export default CardMedia;
219
- //# sourceMappingURL=CardMedia.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CardMedia.js","names":["React","useState","More","Button","DeleteAction","PropTypes","getQuery","getMutation","useMutation","useApolloClient","classnames","useToasts","Modal","createPortal","Link","EditMediaFile","CardMedia","onSelected","name","url","mimetype","id","selected","displayLayout","data","modalTargetRef","updateFile","removeFile","index","displayDeleteModal","setDisplayDeleteModal","displayEditModal","setDisplayEditModal","enableSaveButton","setEnableSaveButton","fileData","setFileData","addToast","deleteFile","type","extension","split","client","deleteFileById","variables","input","appearance","autoDismiss","error","message","handleClick","cardMediaClassNames","handleCloseModal","handleSaveButtonStatus","state","modalActions","textButton","callback","modifiers","handleFormSave","handleFileChange","file","updatedFile","mutate","mutation","update","cache","fileUpdated","writeQuery","query","result","e","console","createElement","Fragment","title","actions","onClose","onChange","fileId","current","className","role","onClick","deleteAction","itemName","src","alt","xmlns","width","height","viewBox","d","displayBg","Avatar","isMoreMenu","Content","to","event","preventDefault","stopPropagation","propTypes","string","isRequired","object","func","bool","number","defaultProps"],"sources":["../../../src/components/CardMedia/CardMedia.js"],"sourcesContent":["import React, { useState } from 'react';\nimport More from '@blaze-react/more';\nimport Button from '@blaze-react/button';\nimport { DeleteAction } from '@blaze-cms/admin';\nimport PropTypes from 'prop-types';\nimport { getQuery, getMutation } from '@blaze-cms/admin-ui-utils';\nimport { useMutation, useApolloClient } from '@apollo/client';\nimport classnames from 'classnames';\nimport { useToasts } from '@blaze-react/toaster';\nimport Modal from '@blaze-react/modal';\nimport { createPortal } from 'react-dom';\nimport { Link } from 'react-router-dom';\nimport EditMediaFile from '../EditMediaFile';\n\nconst CardMedia = ({\n onSelected,\n name,\n url,\n mimetype,\n id,\n selected,\n displayLayout,\n data,\n modalTargetRef,\n updateFile,\n removeFile,\n index\n}) => {\n const [displayDeleteModal, setDisplayDeleteModal] = useState(false);\n const [displayEditModal, setDisplayEditModal] = useState(false);\n const [enableSaveButton, setEnableSaveButton] = useState(false);\n const [fileData, setFileData] = useState(null);\n const { addToast } = useToasts();\n const [deleteFile] = useMutation(getMutation('DELETE_FILE_BY_ID'));\n const [type, extension] = mimetype.split('/');\n const client = useApolloClient();\n\n const deleteFileById = async () => {\n setDisplayDeleteModal(false);\n try {\n await deleteFile({\n variables: { input: { id } }\n });\n\n removeFile({\n index\n });\n\n addToast(`File: ${name} has been deleted`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (error) {\n addToast(error.message, {\n appearance: 'error',\n autoDismiss: true\n });\n }\n };\n\n const handleClick = () => {\n onSelected({ id, url, name, data });\n };\n\n const cardMediaClassNames = classnames('card card--media-list', {\n 'card--media-list--selected': selected,\n [`card--media-${displayLayout}`]: displayLayout\n });\n\n const handleCloseModal = () => {\n setDisplayEditModal(false);\n };\n\n const handleSaveButtonStatus = state => {\n setEnableSaveButton(state);\n };\n\n const modalActions = [\n {\n textButton: 'Cancel',\n callback: handleCloseModal,\n modifiers: ['cancel']\n },\n {\n textButton: 'Save',\n callback: () => handleFormSave(),\n modifiers: enableSaveButton ? [] : ['disabled']\n }\n ];\n\n const handleFileChange = file => {\n setFileData(file);\n };\n\n const handleFormSave = async () => {\n try {\n const {\n data: { updateFile: updatedFile }\n } = await client.mutate({\n mutation: getMutation('UPDATE_FILE'),\n variables: { input: fileData },\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 updateFile({ file: updatedFile.result, index });\n addToast(`File: ${fileData.name} has been updated`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (e) {\n addToast(`File: ${fileData.name} has not been updated`, {\n appearance: 'error',\n autoDismiss: true\n });\n console.error(e); //eslint-disable-line\n }\n handleCloseModal();\n setEnableSaveButton(false);\n };\n\n return (\n <>\n {displayEditModal &&\n createPortal(\n <Modal title=\"Edit\" actions={modalActions} onClose={handleCloseModal}>\n <EditMediaFile\n onChange={handleFileChange}\n fileId={id}\n handleSaveButtonStatus={handleSaveButtonStatus}\n handleFormSave={handleFormSave}\n enableSaveButton={enableSaveButton}\n />\n </Modal>,\n modalTargetRef.current\n )}\n <div className={cardMediaClassNames} role=\"button\" onClick={handleClick}>\n {displayDeleteModal &&\n createPortal(\n <DeleteAction\n onClose={() => setDisplayDeleteModal(false)}\n deleteAction={() => deleteFileById()}\n itemName={name}\n />,\n modalTargetRef.current\n )}\n\n {type === 'image' ? (\n <div className={`card__image card__image--media-${displayLayout}`}>\n <img src={url} alt={name} />\n </div>\n ) : (\n <div className=\"card__image card__image--media-list-document\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100\" height=\"100\" viewBox=\"0 0 8 8\">\n <path d=\"M0 0v8h7v-4h-4v-4h-3zm4 0v3h3l-3-3zm-3 2h1v1h-1v-1zm0 2h1v1h-1v-1zm0 2h4v1h-4v-1z\" />\n </svg>\n </div>\n )}\n\n <footer className={`card__footer card__footer--media-${displayLayout}`}>\n <div className={`card__details card__details--media-${displayLayout}`}>\n <div className={`card__title card__title--media-${displayLayout}`}>\n <h2>{name}</h2>\n </div>\n <p>\n <span>format: {extension}</span>\n </p>\n </div>\n <div className={`card__menu card__menu--${displayLayout}`}>\n <div className=\"more-menu__wrapper more-menu__wrapper--card\">\n <More displayBg>\n <More.Avatar isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu>\n <Link to={`/media/edit/${id}`} className=\"more-menu__link\">\n Edit\n </Link>\n <Button\n onClick={event => {\n event.preventDefault();\n event.stopPropagation();\n setDisplayDeleteModal(true);\n }}\n className=\"more-menu__link\">\n Delete\n </Button>\n </More.Content>\n </More>\n </div>\n </div>\n </footer>\n </div>\n </>\n );\n};\n\nCardMedia.propTypes = {\n name: PropTypes.string.isRequired,\n url: PropTypes.string.isRequired,\n id: PropTypes.string.isRequired,\n mimetype: PropTypes.string.isRequired,\n displayLayout: PropTypes.string.isRequired,\n data: PropTypes.object,\n onSelected: PropTypes.func,\n updateFile: PropTypes.func.isRequired,\n removeFile: PropTypes.func.isRequired,\n selected: PropTypes.bool,\n modalTargetRef: PropTypes.object.isRequired,\n index: PropTypes.number.isRequired\n};\n\nCardMedia.defaultProps = {\n onSelected: () => {},\n selected: false,\n data: {}\n};\n\nexport default CardMedia;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,EAAEC,WAAW,QAAQ,2BAA2B;AACjE,SAASC,WAAW,EAAEC,eAAe,QAAQ,gBAAgB;AAC7D,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,KAAK,MAAM,oBAAoB;AACtC,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,aAAa,MAAM,kBAAkB;AAE5C,MAAM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SAAS,CAACoG,IAAI,CAACF,UAAU;EACrC5E,UAAU,EAAEtB,SAAS,CAACoG,IAAI,CAACF,UAAU;EACrCjF,QAAQ,EAAEjB,SAAS,CAACqG,IAAI;EACxBjF,cAAc,EAAEpB,SAAS,CAACmG,MAAM,CAACD,UAAU;EAC3C3E,KAAK,EAAEvB,SAAS,CAACsG,MAAM,CAACJ;AAC1B,CAAC;AAEDvF,SAAS,CAAC4F,YAAY,GAAG;EACvB3F,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBK,QAAQ,EAAE,KAAK;EACfE,IAAI,EAAE,CAAC;AACT,CAAC;AAED,eAAeR,SAAS","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import CardMedia from './CardMedia';
2
- export default CardMedia;
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["CardMedia"],"sources":["../../../src/components/CardMedia/index.js"],"sourcesContent":["import CardMedia from './CardMedia';\n\nexport default CardMedia;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AAEnC,eAAeA,SAAS","ignoreList":[]}
@@ -1,115 +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, useEffect } from 'react';
5
- import PropTypes from 'prop-types';
6
- import { getQuery } from '@blaze-cms/admin-ui-utils';
7
- import { useQuery } from '@apollo/client';
8
- import FilePreview from '../FilePreview';
9
- import { STORE_KEY, NAME } from '../../constants';
10
- const EditMediaFile = ({
11
- onChange,
12
- handleSaveButtonStatus,
13
- enableSaveButton,
14
- fileId
15
- }) => {
16
- const [formValues, setFormValues] = useState(null);
17
- const query = getQuery('GET_FILE_BY_ID');
18
- const {
19
- loading,
20
- data: {
21
- file
22
- } = {}
23
- } = useQuery(query, {
24
- variables: {
25
- id: fileId
26
- }
27
- });
28
- const fileStoresType = getQuery('GET_FILE_STORES');
29
- const {
30
- data: {
31
- getFileStores: storeType = []
32
- } = {}
33
- } = useQuery(fileStoresType, {
34
- variables: {
35
- visibleInAdmin: true
36
- }
37
- });
38
- useEffect(() => {
39
- if (!formValues && file) {
40
- setFormValues(file);
41
- }
42
- }, [file, formValues, storeType]);
43
- const handleFormChange = ({
44
- isValid,
45
- isNewValueSet,
46
- valuesChecked
47
- }) => {
48
- const valuesCheckedWithoutName = valuesChecked.filter(({
49
- id
50
- }) => {
51
- if (id === NAME || id === STORE_KEY) return false;
52
- return true;
53
- });
54
- const dataValues = valuesCheckedWithoutName.reduce((acc, {
55
- id,
56
- value
57
- }) => {
58
- acc[id] = value;
59
- return acc;
60
- }, {});
61
- const {
62
- value: newFileName
63
- } = valuesChecked.find(({
64
- id
65
- }) => id === NAME) || {};
66
- const {
67
- value: storeKey
68
- } = valuesChecked.find(({
69
- id
70
- }) => id === STORE_KEY) || {};
71
- const shouldEnableSaveButton = isNewValueSet && isValid;
72
- handleSaveButtonStatus(false);
73
- if (shouldEnableSaveButton && shouldEnableSaveButton !== enableSaveButton) {
74
- handleSaveButtonStatus(shouldEnableSaveButton);
75
- }
76
- const updatedFile = {
77
- id: file.id,
78
- name: newFileName,
79
- storeKey,
80
- data: dataValues
81
- };
82
- setFormValues(updatedFile);
83
- onChange(updatedFile);
84
- };
85
- const getFileWithStoreType = () => {
86
- if (storeType) {
87
- const storeOptions = storeType.map(type => [type.key, type.name]);
88
- const defaultStore = storeType.find(type => type.isDefault) || null;
89
- return _objectSpread(_objectSpread({}, file), {}, {
90
- store: {
91
- defaultStore,
92
- storeOptions
93
- }
94
- });
95
- }
96
- return file;
97
- };
98
- const fileWithStoreType = getFileWithStoreType();
99
- return /*#__PURE__*/React.createElement(React.Fragment, null, !loading ? /*#__PURE__*/React.createElement(React.Fragment, null, file ? /*#__PURE__*/React.createElement(FilePreview, {
100
- file: fileWithStoreType,
101
- handleFormChange: handleFormChange,
102
- displayForm: true
103
- }) : null) : /*#__PURE__*/React.createElement("div", null, "loading..."));
104
- };
105
- EditMediaFile.propTypes = {
106
- fileId: PropTypes.string.isRequired,
107
- onChange: PropTypes.func.isRequired,
108
- handleSaveButtonStatus: PropTypes.func.isRequired,
109
- enableSaveButton: PropTypes.bool
110
- };
111
- EditMediaFile.defaultProps = {
112
- enableSaveButton: false
113
- };
114
- export default EditMediaFile;
115
- //# sourceMappingURL=EditMediaFile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditMediaFile.js","names":["React","useState","useEffect","PropTypes","getQuery","useQuery","FilePreview","STORE_KEY","NAME","EditMediaFile","onChange","handleSaveButtonStatus","enableSaveButton","fileId","formValues","setFormValues","query","loading","data","file","variables","id","fileStoresType","getFileStores","storeType","visibleInAdmin","handleFormChange","isValid","isNewValueSet","valuesChecked","valuesCheckedWithoutName","filter","dataValues","reduce","acc","value","newFileName","find","storeKey","shouldEnableSaveButton","updatedFile","name","getFileWithStoreType","storeOptions","map","type","key","defaultStore","isDefault","_objectSpread","store","fileWithStoreType","createElement","Fragment","displayForm","propTypes","string","isRequired","func","bool","defaultProps"],"sources":["../../../src/components/EditMediaFile/EditMediaFile.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { useQuery } from '@apollo/client';\nimport FilePreview from '../FilePreview';\nimport { STORE_KEY, NAME } from '../../constants';\n\nconst EditMediaFile = ({ onChange, handleSaveButtonStatus, enableSaveButton, fileId }) => {\n const [formValues, setFormValues] = useState(null);\n const query = getQuery('GET_FILE_BY_ID');\n const { loading, data: { file } = {} } = useQuery(query, {\n variables: { id: fileId }\n });\n\n const fileStoresType = getQuery('GET_FILE_STORES');\n const { data: { getFileStores: storeType = [] } = {} } = useQuery(fileStoresType, {\n variables: { visibleInAdmin: true }\n });\n\n useEffect(() => {\n if (!formValues && file) {\n setFormValues(file);\n }\n }, [file, formValues, storeType]);\n\n const handleFormChange = ({ isValid, isNewValueSet, valuesChecked }) => {\n const valuesCheckedWithoutName = valuesChecked.filter(({ id }) => {\n if (id === NAME || id === STORE_KEY) return false;\n return true;\n });\n\n const dataValues = valuesCheckedWithoutName.reduce((acc, { id, value }) => {\n acc[id] = value;\n return acc;\n }, {});\n const { value: newFileName } = valuesChecked.find(({ id }) => id === NAME) || {};\n const { value: storeKey } = valuesChecked.find(({ id }) => id === STORE_KEY) || {};\n\n const shouldEnableSaveButton = isNewValueSet && isValid;\n handleSaveButtonStatus(false);\n\n if (shouldEnableSaveButton && shouldEnableSaveButton !== enableSaveButton) {\n handleSaveButtonStatus(shouldEnableSaveButton);\n }\n\n const updatedFile = {\n id: file.id,\n name: newFileName,\n storeKey,\n data: dataValues\n };\n setFormValues(updatedFile);\n onChange(updatedFile);\n };\n\n const getFileWithStoreType = () => {\n if (storeType) {\n const storeOptions = storeType.map(type => [type.key, type.name]);\n const defaultStore = storeType.find(type => type.isDefault) || null;\n return { ...file, store: { defaultStore, storeOptions } };\n }\n\n return file;\n };\n\n const fileWithStoreType = getFileWithStoreType();\n\n return (\n <>\n {!loading ? (\n <>\n {file ? (\n <FilePreview file={fileWithStoreType} handleFormChange={handleFormChange} displayForm />\n ) : null}\n </>\n ) : (\n <div>loading...</div>\n )}\n </>\n );\n};\n\nEditMediaFile.propTypes = {\n fileId: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n handleSaveButtonStatus: PropTypes.func.isRequired,\n enableS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,YAAY,GAAGnB,SAAS,CAACoB,GAAG,CAACC,IAAI,IAAI,CAACA,IAAI,CAACC,GAAG,EAAED,IAAI,CAACJ,IAAI,CAAC,CAAC;MACjE,MAAMM,YAAY,GAAGvB,SAAS,CAACa,IAAI,CAACQ,IAAI,IAAIA,IAAI,CAACG,SAAS,CAAC,IAAI,IAAI;MACnE,OAAAC,aAAA,CAAAA,aAAA,KAAY9B,IAAI;QAAE+B,KAAK,EAAE;UAAEH,YAAY;UAAEJ;QAAa;MAAC;IACzD;IAEA,OAAOxB,IAAI;EACb,CAAC;EAED,MAAMgC,iBAAiB,GAAGT,oBAAoB,CAAC,CAAC;EAEhD,oBACE1C,KAAA,CAAAoD,aAAA,CAAApD,KAAA,CAAAqD,QAAA,QACG,CAACpC,OAAO,gBACPjB,KAAA,CAAAoD,aAAA,CAAApD,KAAA,CAAAqD,QAAA,QACGlC,IAAI,gBACHnB,KAAA,CAAAoD,aAAA,CAAC9C,WAAW;IAACa,IAAI,EAAEgC,iBAAkB;IAACzB,gBAAgB,EAAEA,gBAAiB;IAAC4B,WAAW;EAAA,CAAE,CAAC,GACtF,IACJ,CAAC,gBAEHtD,KAAA,CAAAoD,aAAA,cAAK,YAAe,CAEtB,CAAC;AAEP,CAAC;AAED3C,aAAa,CAAC8C,SAAS,GAAG;EACxB1C,MAAM,EAAEV,SAAS,CAACqD,MAAM,CAACC,UAAU;EACnC/C,QAAQ,EAAEP,SAAS,CAACuD,IAAI,CAACD,UAAU;EACnC9C,sBAAsB,EAAER,SAAS,CAACuD,IAAI,CAACD,UAAU;EACjD7C,gBAAgB,EAAET,SAAS,CAACwD;AAC9B,CAAC;AAEDlD,aAAa,CAACmD,YAAY,GAAG;EAC3BhD,gBAAgB,EAAE;AACpB,CAAC;AAED,eAAeH,aAAa","ignoreList":[]}
@@ -1,86 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { withRouter } from 'react-router-dom';
3
- import PropTypes from 'prop-types';
4
- import Button from '@blaze-react/button';
5
- import { useApolloClient } from '@apollo/client';
6
- import { getQuery, getMutation } from '@blaze-cms/admin-ui-utils';
7
- import { useToasts } from '@blaze-react/toaster';
8
- import EditMediaFile from './EditMediaFile';
9
- const EditMediaFilePage = ({
10
- match,
11
- history
12
- }) => {
13
- const [shouldEnableSaveButton, setShouldEnableSaveButton] = useState(false);
14
- const [file, setFile] = useState(null);
15
- const client = useApolloClient();
16
- const {
17
- addToast
18
- } = useToasts();
19
- const handleFileChange = values => setFile(values);
20
- const handleSaveButtonStatus = value => {
21
- setShouldEnableSaveButton(value);
22
- };
23
- const handleFormSave = async () => {
24
- try {
25
- await client.mutate({
26
- mutation: getMutation('UPDATE_FILE'),
27
- variables: {
28
- input: file
29
- },
30
- update(cache, {
31
- data: {
32
- updateFile: fileUpdated
33
- }
34
- }) {
35
- cache.writeQuery({
36
- query: getQuery('GET_FILE_BY_ID'),
37
- variables: {
38
- id: match.params.fileId
39
- },
40
- data: {
41
- file: fileUpdated.result
42
- }
43
- });
44
- }
45
- });
46
- addToast(`File: ${file.name} has been updated`, {
47
- appearance: 'success',
48
- autoDismiss: true
49
- });
50
- } catch (e) {
51
- addToast(`File: ${file.name} has not been updated`, {
52
- appearance: 'error',
53
- autoDismiss: true
54
- });
55
- console.error(e); //eslint-disable-line
56
- }
57
- setShouldEnableSaveButton(false);
58
- };
59
- const pushBack = () => history.push('/media');
60
- const buttonModifiers = shouldEnableSaveButton ? [] : ['disabled'];
61
- return /*#__PURE__*/React.createElement("div", {
62
- className: "page"
63
- }, /*#__PURE__*/React.createElement("div", {
64
- className: "page__content"
65
- }, /*#__PURE__*/React.createElement("div", {
66
- className: "page__content__mediaWrapper"
67
- }, /*#__PURE__*/React.createElement(EditMediaFile, {
68
- onChange: handleFileChange,
69
- fileId: match.params.fileId,
70
- handleSaveButtonStatus: handleSaveButtonStatus,
71
- handleFormSave: handleFormSave
72
- }), /*#__PURE__*/React.createElement("div", {
73
- className: "page__content__mediaWrapperActions"
74
- }, /*#__PURE__*/React.createElement(Button, {
75
- onClick: pushBack
76
- }, "Cancel"), /*#__PURE__*/React.createElement(Button, {
77
- onClick: handleFormSave,
78
- modifiers: buttonModifiers
79
- }, "Save")))));
80
- };
81
- EditMediaFilePage.propTypes = {
82
- match: PropTypes.object.isRequired,
83
- history: PropTypes.object.isRequired
84
- };
85
- export default withRouter(EditMediaFilePage);
86
- //# sourceMappingURL=EditMediaFilePage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditMediaFilePage.js","names":["React","useState","withRouter","PropTypes","Button","useApolloClient","getQuery","getMutation","useToasts","EditMediaFile","EditMediaFilePage","match","history","shouldEnableSaveButton","setShouldEnableSaveButton","file","setFile","client","addToast","handleFileChange","values","handleSaveButtonStatus","value","handleFormSave","mutate","mutation","variables","input","update","cache","data","updateFile","fileUpdated","writeQuery","query","id","params","fileId","result","name","appearance","autoDismiss","e","console","error","pushBack","push","buttonModifiers","createElement","className","onChange","onClick","modifiers","propTypes","object","isRequired"],"sources":["../../../src/components/EditMediaFile/EditMediaFilePage.js"],"sourcesContent":["import React, { useState } from 'react';\nimport { withRouter } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport Button from '@blaze-react/button';\nimport { useApolloClient } from '@apollo/client';\nimport { getQuery, getMutation } from '@blaze-cms/admin-ui-utils';\nimport { useToasts } from '@blaze-react/toaster';\nimport EditMediaFile from './EditMediaFile';\n\nconst EditMediaFilePage = ({ match, history }) => {\n const [shouldEnableSaveButton, setShouldEnableSaveButton] = useState(false);\n const [file, setFile] = useState(null);\n const client = useApolloClient();\n const { addToast } = useToasts();\n\n const handleFileChange = values => setFile(values);\n\n const handleSaveButtonStatus = value => {\n setShouldEnableSaveButton(value);\n };\n\n const handleFormSave = async () => {\n try {\n await client.mutate({\n mutation: getMutation('UPDATE_FILE'),\n variables: { input: file },\n update(cache, { data: { updateFile: fileUpdated } }) {\n cache.writeQuery({\n query: getQuery('GET_FILE_BY_ID'),\n variables: { id: match.params.fileId },\n data: { file: fileUpdated.result }\n });\n }\n });\n\n addToast(`File: ${file.name} has been updated`, {\n appearance: 'success',\n autoDismiss: true\n });\n } catch (e) {\n addToast(`File: ${file.name} has not been updated`, {\n appearance: 'error',\n autoDismiss: true\n });\n console.error(e); //eslint-disable-line\n }\n setShouldEnableSaveButton(false);\n };\n\n const pushBack = () => history.push('/media');\n\n const buttonModifiers = shouldEnableSaveButton ? [] : ['disabled'];\n\n return (\n <div className=\"page\">\n <div className=\"page__content\">\n <div className=\"page__content__mediaWrapper\">\n <EditMediaFile\n onChange={handleFileChange}\n fileId={match.params.fileId}\n handleSaveButtonStatus={handleSaveButtonStatus}\n handleFormSave={handleFormSave}\n />\n <div className=\"page__content__mediaWrapperActions\">\n <Button onClick={pushBack}>Cancel</Button>\n <Button onClick={handleFormSave} modifiers={buttonModifiers}>\n Save\n </Button>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nEditMediaFilePage.propTypes = {\n match: PropTypes.object.isRequired,\n history: PropTypes.object.isRequired\n};\n\nexport default withRouter(EditMediaFilePage);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,QAAQ,EAAEC,WAAW,QAAQ,2BAA2B;AACjE,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,aAAa,MAAM,iBAAiB;AAE3C,MAAMC,iBAAiB,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAQ,CAAC,KAAK;EAChD,MAAM,CAACC,sBAAsB,EAAEC,yBAAyB,CAAC,GAAGb,QAAQ,CAAC,KAAK,CAAC;EAC3E,MAAM,CAACc,IAAI,EAAEC,OAAO,CAAC,GAAGf,QAAQ,CAAC,IAAI,CAAC;EACtC,MAAMgB,MAAM,GAAGZ,eAAe,CAAC,CAAC;EAChC,MA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C,eAAe,GAAGlC,sBAAsB,GAAG,EAAE,GAAG,CAAC,UAAU,CAAC;EAElE,oBACEb,KAAA,CAAAgD,aAAA;IAAKC,SAAS,EAAC;EAAM,gBACnBjD,KAAA,CAAAgD,aAAA;IAAKC,SAAS,EAAC;EAAe,gBAC5BjD,KAAA,CAAAgD,aAAA;IAAKC,SAAS,EAAC;EAA6B,gBAC1CjD,KAAA,CAAAgD,aAAA,CAACvC,aAAa;IACZyC,QAAQ,EAAE/B,gBAAiB;IAC3BkB,MAAM,EAAE1B,KAAK,CAACyB,MAAM,CAACC,MAAO;IAC5BhB,sBAAsB,EAAEA,sBAAuB;IAC/CE,cAAc,EAAEA;EAAe,CAChC,CAAC,eACFvB,KAAA,CAAAgD,aAAA;IAAKC,SAAS,EAAC;EAAoC,gBACjDjD,KAAA,CAAAgD,aAAA,CAAC5C,MAAM;IAAC+C,OAAO,EAAEN;EAAS,GAAC,QAAc,CAAC,eAC1C7C,KAAA,CAAAgD,aAAA,CAAC5C,MAAM;IAAC+C,OAAO,EAAE5B,cAAe;IAAC6B,SAAS,EAAEL;EAAgB,GAAC,MAErD,CACL,CACF,CACF,CACF,CAAC;AAEV,CAAC;AAEDrC,iBAAiB,CAAC2C,SAAS,GAAG;EAC5B1C,KAAK,EAAER,SAAS,CAACmD,MAAM,CAACC,UAAU;EAClC3C,OAAO,EAAET,SAAS,CAACmD,MAAM,CAACC;AAC5B,CAAC;AAED,eAAerD,UAAU,CAACQ,iBAAiB,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import EditMediaFile from './EditMediaFile';
2
- export default EditMediaFile;
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["EditMediaFile"],"sources":["../../../src/components/EditMediaFile/index.js"],"sourcesContent":["import EditMediaFile from './EditMediaFile';\n\nexport default EditMediaFile;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3C,eAAeA,aAAa","ignoreList":[]}
@@ -1,39 +0,0 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
- const _excluded = ["id", "value", "onChange", "error", "validationMessage", "label"];
3
- import React from 'react';
4
- import DraftEditor from '@blaze-react/drafteditor';
5
- import PropTypes from 'prop-types';
6
- const DraftEditorAdapter = _ref => {
7
- let {
8
- id,
9
- value,
10
- onChange,
11
- error,
12
- validationMessage,
13
- label
14
- } = _ref,
15
- props = _objectWithoutProperties(_ref, _excluded);
16
- return /*#__PURE__*/React.createElement("div", {
17
- className: "form-field form-field--full-width"
18
- }, /*#__PURE__*/React.createElement("label", null, label), /*#__PURE__*/React.createElement(DraftEditor, {
19
- name: id,
20
- value: value,
21
- onChange: onChange,
22
- error: error,
23
- validationMessage: validationMessage
24
- }));
25
- };
26
- DraftEditorAdapter.propTypes = {
27
- id: PropTypes.string.isRequired,
28
- value: PropTypes.string.isRequired,
29
- onChange: PropTypes.func.isRequired,
30
- error: PropTypes.bool,
31
- validationMessage: PropTypes.string,
32
- label: PropTypes.string.isRequired
33
- };
34
- DraftEditorAdapter.defaultProps = {
35
- error: false,
36
- validationMessage: undefined
37
- };
38
- export default DraftEditorAdapter;
39
- //# sourceMappingURL=EditorAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditorAdapter.js","names":["React","DraftEditor","PropTypes","DraftEditorAdapter","_ref","id","value","onChange","error","validationMessage","label","props","_objectWithoutProperties","_excluded","createElement","className","name","propTypes","string","isRequired","func","bool","defaultProps","undefined"],"sources":["../../../src/components/EditorAdapter/EditorAdapter.js"],"sourcesContent":["import React from 'react';\nimport DraftEditor from '@blaze-react/drafteditor';\nimport PropTypes from 'prop-types';\n\nconst DraftEditorAdapter = ({ id, value, onChange, error, validationMessage, label, ...props }) => (\n <div className=\"form-field form-field--full-width\">\n <label>{label}</label>\n <DraftEditor\n name={id}\n value={value}\n onChange={onChange}\n error={error}\n validationMessage={validationMessage}\n />\n </div>\n);\n\nDraftEditorAdapter.propTypes = {\n id: PropTypes.string.isRequired,\n value: PropTypes.string.isRequired,\n onChange: PropTypes.func.isRequired,\n error: PropTypes.bool,\n validationMessage: PropTypes.string,\n label: PropTypes.string.isRequired\n};\n\nDraftEditorAdapter.defaultProps = {\n error: false,\n validationMessage: undefined\n};\n\nexport default DraftEditorAdapter;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAM,0BAA0B;AAClD,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,kBAAkB,GAAGC,IAAA;EAAA,IAAC;MAAEC,EAAE;MAAEC,KAAK;MAAEC,QAAQ;MAAEC,KAAK;MAAEC,iBAAiB;MAAEC;IAAgB,CAAC,GAAAN,IAAA;IAAPO,KAAK,GAAAC,wBAAA,CAAAR,IAAA,EAAAS,SAAA;EAAA,oBAC1Fb,KAAA,CAAAc,aAAA;IAAKC,SAAS,EAAC;EAAmC,gBAChDf,KAAA,CAAAc,aAAA,gBAAQJ,KAAa,CAAC,eACtBV,KAAA,CAAAc,aAAA,CAACb,WAAW;IACVe,IAAI,EAAEX,EAAG;IACTC,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEA,QAAS;IACnBC,KAAK,EAAEA,KAAM;IACbC,iBAAiB,EAAEA;EAAkB,CACtC,CACE,CAAC;AAAA,CACP;AAEDN,kBAAkB,CAACc,SAAS,GAAG;EAC7BZ,EAAE,EAAEH,SAAS,CAACgB,MAAM,CAACC,UAAU;EAC/Bb,KAAK,EAAEJ,SAAS,CAACgB,MAAM,CAACC,UAAU;EAClCZ,QAAQ,EAAEL,SAAS,CAACkB,IAAI,CAACD,UAAU;EACnCX,KAAK,EAAEN,SAAS,CAACmB,IAAI;EACrBZ,iBAAiB,EAAEP,SAAS,CAACgB,MAAM;EACnCR,KAAK,EAAER,SAAS,CAACgB,MAAM,CAACC;AAC1B,CAAC;AAEDhB,kBAAkB,CAACmB,YAAY,GAAG;EAChCd,KAAK,EAAE,KAAK;EACZC,iBAAiB,EAAEc;AACrB,CAAC;AAED,eAAepB,kBAAkB","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import EditorAdapter from './EditorAdapter';
2
- export default EditorAdapter;
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["EditorAdapter"],"sources":["../../../src/components/EditorAdapter/index.js"],"sourcesContent":["import EditorAdapter from './EditorAdapter';\n\nexport default EditorAdapter;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3C,eAAeA,aAAa","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- const FilesListContext = React.createContext({});
3
- export default FilesListContext;
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["React","FilesListContext","createContext"],"sources":["../../../../src/components/FileList/FilesListContext/index.js"],"sourcesContent":["import React from 'react';\n\nconst FilesListContext = React.createContext({});\n\nexport default FilesListContext;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,gBAAgB,GAAGD,KAAK,CAACE,aAAa,CAAC,CAAC,CAAC,CAAC;AAEhD,eAAeD,gBAAgB","ignoreList":[]}