adminizer 4.2.0-build.50 → 4.2.0-build.52

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 (523) hide show
  1. package/assets/{VanillaJSONEditor-XGIlS4LL.js → VanillaJSONEditor-x8tDbio1.js} +3 -3
  2. package/assets/add-DOaZgoTz.js +1 -0
  3. package/assets/add-form-BjackXJe.js +1 -0
  4. package/assets/add-group-Br44s2D6.js +1 -0
  5. package/assets/{add-group-form-_VEBFz_S.js → add-group-form-YI6KS37x.js} +1 -1
  6. package/assets/add-user-DWcH0s9-.js +1 -0
  7. package/assets/{add-user-form-BFAFyXuz.js → add-user-form-bv5BNX5A.js} +1 -1
  8. package/assets/{app-CXlohNEv.css → app-CVnUv8s_.css} +10 -2
  9. package/assets/{app-layout-NMKA6xAa.js → app-layout-DecN527i.js} +1 -1
  10. package/assets/{app-shell-Dd-kA5uc.js → app-shell-DHzMWA1L.js} +1 -1
  11. package/assets/{app-sidebar-C4Y6TSY3.js → app-sidebar-4JFP8UdU.js} +1 -1
  12. package/assets/app-sidebar-header-CIKLfLsF.js +1 -0
  13. package/assets/app.js +2 -2
  14. package/assets/breadcrumbs-Bo2z-LNC.js +1 -0
  15. package/assets/catalog-C71LuRag.css +1 -0
  16. package/assets/{catalog-CEVSwmj8.js → catalog-DVyrGTNR.js} +4 -4
  17. package/assets/{dashboard-jLbWzL7K.js → dashboard-Dy3pk9t7.js} +2 -2
  18. package/assets/date-picker-B2z-aeuv.js +1 -0
  19. package/assets/debounce-D6eaSoDg.js +1 -0
  20. package/assets/del-modal-l3LxJWCN.js +1 -0
  21. package/assets/{field-renderer-C7qCVvAC.js → field-renderer-BHo944Cn.js} +133 -133
  22. package/assets/{field-renderer-BlBZuSiD.css → field-renderer-CsBa_tMB.css} +1 -1
  23. package/assets/form-BXfnz6h5.js +1 -0
  24. package/assets/{form-CYsLdORv.js → form-hP8sjbND.js} +1 -1
  25. package/assets/{geo-json-XGenv_Sy.js → geo-json-CVaNUZbb.js} +1 -1
  26. package/assets/{handsontable-Dxb-hF7-.js → handsontable-CZQ5Ietj.js} +1 -1
  27. package/assets/home-BD4MWmm9.js +2 -0
  28. package/assets/{icon-DQL8h8HI.js → icon-C_X2cQ6W.js} +1 -1
  29. package/assets/index-C148XJoK.js +1 -0
  30. package/assets/{init-user-DZtnQ7VL.js → init-user-DgCD4ZN1.js} +1 -1
  31. package/assets/input-error-Bab-HPbn.js +1 -0
  32. package/assets/list-C-27EH39.js +1 -0
  33. package/assets/{list-table-Du8TTXit.js → list-table-_OiQmr2A.js} +3 -3
  34. package/assets/{login-2THGmUHc.js → login-jzvVXgAV.js} +1 -1
  35. package/assets/manifest.json +160 -112
  36. package/assets/{material-icon-CPvFwV5P.js → material-icon-DsiW0iQG.js} +1 -1
  37. package/assets/media-manager-BZPjl98I.css +1 -0
  38. package/assets/media-manager-CSB_XRcE.js +14 -0
  39. package/assets/module-Ceq6vuwa.js +1 -0
  40. package/assets/{monaco-editor-9fDiyfuW.js → monaco-editor-XX8Hz76f.js} +3 -3
  41. package/assets/multi-select-BbKSrMw2.js +1 -0
  42. package/assets/nav-footer-B8gMV6Wp.js +1 -0
  43. package/assets/nav-main-BUp9qA8R.js +1 -0
  44. package/assets/nav-user-DeF3SDRj.js +1 -0
  45. package/assets/{pagination-render-D6MBqi0B.js → pagination-render-B9U_hVbB.js} +1 -1
  46. package/assets/{register-Dks3YdiZ.js → register-C6acWsLe.js} +1 -1
  47. package/assets/theme-switcher-D8T9NgWG.js +1 -0
  48. package/assets/{toast-editor-1Pul3oMs.js → toast-editor-C0550yms.js} +1 -1
  49. package/assets/use-appearance-CXP5cHaQ.js +1 -0
  50. package/assets/{user-info-DTsggabP.js → user-info-CAgkqARx.js} +1 -1
  51. package/assets/{user-menu-content-Dnh2qpwQ.js → user-menu-content-BxL0QMC9.js} +1 -1
  52. package/assets/welcome-Dk7GoS5R.js +1 -0
  53. package/controllers/edit.js +4 -10
  54. package/controllers/media-manager/mediaManagerAdapter.d.ts +15 -1
  55. package/controllers/media-manager/mediaManagerAdapter.js +126 -85
  56. package/controllers/media-manager/mediaManagerApi.js +10 -4
  57. package/controllers/view.js +10 -0
  58. package/fileicons/3g2.svg +1 -0
  59. package/fileicons/3ga.svg +1 -0
  60. package/fileicons/3gp.svg +1 -0
  61. package/fileicons/7z.svg +1 -0
  62. package/fileicons/aa.svg +1 -0
  63. package/fileicons/aac.svg +1 -0
  64. package/fileicons/ac.svg +1 -0
  65. package/fileicons/accdb.svg +1 -0
  66. package/fileicons/accdt.svg +1 -0
  67. package/fileicons/ace.svg +1 -0
  68. package/fileicons/adn.svg +1 -0
  69. package/fileicons/ai.svg +1 -0
  70. package/fileicons/aif.svg +1 -0
  71. package/fileicons/aifc.svg +1 -0
  72. package/fileicons/aiff.svg +1 -0
  73. package/fileicons/ait.svg +1 -0
  74. package/fileicons/amr.svg +1 -0
  75. package/fileicons/ani.svg +1 -0
  76. package/fileicons/apk.svg +1 -0
  77. package/fileicons/app.svg +1 -0
  78. package/fileicons/applescript.svg +1 -0
  79. package/fileicons/asax.svg +1 -0
  80. package/fileicons/asc.svg +1 -0
  81. package/fileicons/ascx.svg +1 -0
  82. package/fileicons/asf.svg +1 -0
  83. package/fileicons/ash.svg +1 -0
  84. package/fileicons/ashx.svg +1 -0
  85. package/fileicons/asm.svg +1 -0
  86. package/fileicons/asmx.svg +1 -0
  87. package/fileicons/asp.svg +1 -0
  88. package/fileicons/aspx.svg +1 -0
  89. package/fileicons/asx.svg +1 -0
  90. package/fileicons/au.svg +1 -0
  91. package/fileicons/aup.svg +1 -0
  92. package/fileicons/avi.svg +1 -0
  93. package/fileicons/axd.svg +1 -0
  94. package/fileicons/aze.svg +1 -0
  95. package/fileicons/bak.svg +1 -0
  96. package/fileicons/bash.svg +1 -0
  97. package/fileicons/bat.svg +1 -0
  98. package/fileicons/bin.svg +1 -0
  99. package/fileicons/blank.svg +1 -0
  100. package/fileicons/bmp.svg +1 -0
  101. package/fileicons/bowerrc.svg +1 -0
  102. package/fileicons/bpg.svg +1 -0
  103. package/fileicons/browser.svg +1 -0
  104. package/fileicons/bz2.svg +1 -0
  105. package/fileicons/bzempty.svg +1 -0
  106. package/fileicons/c.svg +1 -0
  107. package/fileicons/cab.svg +1 -0
  108. package/fileicons/cad.svg +1 -0
  109. package/fileicons/caf.svg +1 -0
  110. package/fileicons/cal.svg +1 -0
  111. package/fileicons/catalog.json +1 -0
  112. package/fileicons/cd.svg +1 -0
  113. package/fileicons/cdda.svg +1 -0
  114. package/fileicons/cer.svg +1 -0
  115. package/fileicons/cfg.svg +1 -0
  116. package/fileicons/cfm.svg +1 -0
  117. package/fileicons/cfml.svg +1 -0
  118. package/fileicons/cgi.svg +1 -0
  119. package/fileicons/chm.svg +1 -0
  120. package/fileicons/class.svg +1 -0
  121. package/fileicons/cmd.svg +1 -0
  122. package/fileicons/code-workspace.svg +1 -0
  123. package/fileicons/codekit.svg +1 -0
  124. package/fileicons/coffee.svg +1 -0
  125. package/fileicons/coffeelintignore.svg +1 -0
  126. package/fileicons/com.svg +1 -0
  127. package/fileicons/compile.svg +1 -0
  128. package/fileicons/conf.svg +1 -0
  129. package/fileicons/config.svg +1 -0
  130. package/fileicons/cpp.svg +1 -0
  131. package/fileicons/cptx.svg +1 -0
  132. package/fileicons/cr2.svg +1 -0
  133. package/fileicons/crdownload.svg +1 -0
  134. package/fileicons/crt.svg +1 -0
  135. package/fileicons/crypt.svg +1 -0
  136. package/fileicons/cs.svg +1 -0
  137. package/fileicons/csh.svg +1 -0
  138. package/fileicons/cson.svg +1 -0
  139. package/fileicons/csproj.svg +1 -0
  140. package/fileicons/css.svg +1 -0
  141. package/fileicons/csv.svg +1 -0
  142. package/fileicons/cue.svg +1 -0
  143. package/fileicons/cur.svg +1 -0
  144. package/fileicons/dart.svg +1 -0
  145. package/fileicons/dat.svg +1 -0
  146. package/fileicons/data.svg +1 -0
  147. package/fileicons/db.svg +1 -0
  148. package/fileicons/dbf.svg +1 -0
  149. package/fileicons/deb.svg +1 -0
  150. package/fileicons/default.svg +1 -0
  151. package/fileicons/dgn.svg +1 -0
  152. package/fileicons/dist.svg +1 -0
  153. package/fileicons/diz.svg +1 -0
  154. package/fileicons/dll.svg +1 -0
  155. package/fileicons/dmg.svg +1 -0
  156. package/fileicons/dng.svg +1 -0
  157. package/fileicons/doc.svg +1 -0
  158. package/fileicons/docb.svg +1 -0
  159. package/fileicons/docm.svg +1 -0
  160. package/fileicons/docx.svg +1 -0
  161. package/fileicons/dot.svg +1 -0
  162. package/fileicons/dotm.svg +1 -0
  163. package/fileicons/dotx.svg +1 -0
  164. package/fileicons/download.svg +1 -0
  165. package/fileicons/dpj.svg +1 -0
  166. package/fileicons/ds_store.svg +1 -0
  167. package/fileicons/dsn.svg +1 -0
  168. package/fileicons/dtd.svg +1 -0
  169. package/fileicons/dwg.svg +1 -0
  170. package/fileicons/dxf.svg +1 -0
  171. package/fileicons/editorconfig.svg +1 -0
  172. package/fileicons/el.svg +1 -0
  173. package/fileicons/elf.svg +1 -0
  174. package/fileicons/eml.svg +1 -0
  175. package/fileicons/enc.svg +1 -0
  176. package/fileicons/eot.svg +1 -0
  177. package/fileicons/eps.svg +1 -0
  178. package/fileicons/epub.svg +1 -0
  179. package/fileicons/eslintignore.svg +1 -0
  180. package/fileicons/exe.svg +1 -0
  181. package/fileicons/f4v.svg +1 -0
  182. package/fileicons/fax.svg +1 -0
  183. package/fileicons/fb2.svg +1 -0
  184. package/fileicons/fla.svg +1 -0
  185. package/fileicons/flac.svg +1 -0
  186. package/fileicons/flv.svg +1 -0
  187. package/fileicons/fnt.svg +1 -0
  188. package/fileicons/folder.svg +1 -0
  189. package/fileicons/fon.svg +1 -0
  190. package/fileicons/gadget.svg +1 -0
  191. package/fileicons/gdp.svg +1 -0
  192. package/fileicons/gem.svg +1 -0
  193. package/fileicons/gif.svg +1 -0
  194. package/fileicons/gitattributes.svg +1 -0
  195. package/fileicons/gitignore.svg +1 -0
  196. package/fileicons/go.svg +1 -0
  197. package/fileicons/gpg.svg +1 -0
  198. package/fileicons/gpl.svg +1 -0
  199. package/fileicons/gradle.svg +1 -0
  200. package/fileicons/gz.svg +1 -0
  201. package/fileicons/h.svg +1 -0
  202. package/fileicons/handlebars.svg +1 -0
  203. package/fileicons/hbs.svg +1 -0
  204. package/fileicons/heic.svg +1 -0
  205. package/fileicons/hlp.svg +1 -0
  206. package/fileicons/hs.svg +1 -0
  207. package/fileicons/hsl.svg +1 -0
  208. package/fileicons/htm.svg +1 -0
  209. package/fileicons/html.svg +1 -0
  210. package/fileicons/ibooks.svg +1 -0
  211. package/fileicons/icns.svg +1 -0
  212. package/fileicons/ico.svg +1 -0
  213. package/fileicons/ics.svg +1 -0
  214. package/fileicons/idx.svg +1 -0
  215. package/fileicons/iff.svg +1 -0
  216. package/fileicons/ifo.svg +1 -0
  217. package/fileicons/image.svg +1 -0
  218. package/fileicons/img.svg +1 -0
  219. package/fileicons/iml.svg +1 -0
  220. package/fileicons/in.svg +1 -0
  221. package/fileicons/inc.svg +1 -0
  222. package/fileicons/indd.svg +1 -0
  223. package/fileicons/inf.svg +1 -0
  224. package/fileicons/info.svg +1 -0
  225. package/fileicons/ini.svg +1 -0
  226. package/fileicons/inv.svg +1 -0
  227. package/fileicons/iso.svg +1 -0
  228. package/fileicons/j2.svg +1 -0
  229. package/fileicons/jar.svg +1 -0
  230. package/fileicons/java.svg +1 -0
  231. package/fileicons/jpe.svg +1 -0
  232. package/fileicons/jpeg.svg +1 -0
  233. package/fileicons/jpg.svg +1 -0
  234. package/fileicons/js.svg +1 -0
  235. package/fileicons/json.svg +1 -0
  236. package/fileicons/jsp.svg +1 -0
  237. package/fileicons/jsx.svg +1 -0
  238. package/fileicons/key.svg +1 -0
  239. package/fileicons/kf8.svg +1 -0
  240. package/fileicons/kmk.svg +1 -0
  241. package/fileicons/ksh.svg +1 -0
  242. package/fileicons/kt.svg +1 -0
  243. package/fileicons/kts.svg +1 -0
  244. package/fileicons/kup.svg +1 -0
  245. package/fileicons/less.svg +1 -0
  246. package/fileicons/lex.svg +1 -0
  247. package/fileicons/licx.svg +1 -0
  248. package/fileicons/lisp.svg +1 -0
  249. package/fileicons/lit.svg +1 -0
  250. package/fileicons/lnk.svg +1 -0
  251. package/fileicons/lock.svg +1 -0
  252. package/fileicons/log.svg +1 -0
  253. package/fileicons/lua.svg +1 -0
  254. package/fileicons/m.svg +1 -0
  255. package/fileicons/m2v.svg +1 -0
  256. package/fileicons/m3u.svg +1 -0
  257. package/fileicons/m3u8.svg +1 -0
  258. package/fileicons/m4.svg +1 -0
  259. package/fileicons/m4a.svg +1 -0
  260. package/fileicons/m4r.svg +1 -0
  261. package/fileicons/m4v.svg +1 -0
  262. package/fileicons/map.svg +1 -0
  263. package/fileicons/master.svg +1 -0
  264. package/fileicons/mc.svg +1 -0
  265. package/fileicons/md.svg +1 -0
  266. package/fileicons/mdb.svg +1 -0
  267. package/fileicons/mdf.svg +1 -0
  268. package/fileicons/me.svg +1 -0
  269. package/fileicons/mi.svg +1 -0
  270. package/fileicons/mid.svg +1 -0
  271. package/fileicons/midi.svg +1 -0
  272. package/fileicons/mk.svg +1 -0
  273. package/fileicons/mkv.svg +1 -0
  274. package/fileicons/mm.svg +1 -0
  275. package/fileicons/mng.svg +1 -0
  276. package/fileicons/mo.svg +1 -0
  277. package/fileicons/mobi.svg +1 -0
  278. package/fileicons/mod.svg +1 -0
  279. package/fileicons/mov.svg +1 -0
  280. package/fileicons/mp2.svg +1 -0
  281. package/fileicons/mp3.svg +1 -0
  282. package/fileicons/mp4.svg +1 -0
  283. package/fileicons/mpa.svg +1 -0
  284. package/fileicons/mpd.svg +1 -0
  285. package/fileicons/mpe.svg +1 -0
  286. package/fileicons/mpeg.svg +1 -0
  287. package/fileicons/mpg.svg +1 -0
  288. package/fileicons/mpga.svg +1 -0
  289. package/fileicons/mpp.svg +1 -0
  290. package/fileicons/mpt.svg +1 -0
  291. package/fileicons/msg.svg +1 -0
  292. package/fileicons/msi.svg +1 -0
  293. package/fileicons/msu.svg +1 -0
  294. package/fileicons/nef.svg +1 -0
  295. package/fileicons/nes.svg +1 -0
  296. package/fileicons/nfo.svg +1 -0
  297. package/fileicons/nix.svg +1 -0
  298. package/fileicons/npmignore.svg +1 -0
  299. package/fileicons/ocx.svg +1 -0
  300. package/fileicons/odb.svg +1 -0
  301. package/fileicons/ods.svg +1 -0
  302. package/fileicons/odt.svg +1 -0
  303. package/fileicons/ogg.svg +1 -0
  304. package/fileicons/ogv.svg +1 -0
  305. package/fileicons/ost.svg +1 -0
  306. package/fileicons/otf.svg +1 -0
  307. package/fileicons/ott.svg +1 -0
  308. package/fileicons/ova.svg +1 -0
  309. package/fileicons/ovf.svg +1 -0
  310. package/fileicons/p12.svg +1 -0
  311. package/fileicons/p7b.svg +1 -0
  312. package/fileicons/pages.svg +1 -0
  313. package/fileicons/part.svg +1 -0
  314. package/fileicons/partial.svg +1 -0
  315. package/fileicons/pcd.svg +1 -0
  316. package/fileicons/pdb.svg +1 -0
  317. package/fileicons/pdf.svg +1 -0
  318. package/fileicons/pem.svg +1 -0
  319. package/fileicons/pfx.svg +1 -0
  320. package/fileicons/pgp.svg +1 -0
  321. package/fileicons/ph.svg +1 -0
  322. package/fileicons/phar.svg +1 -0
  323. package/fileicons/php.svg +1 -0
  324. package/fileicons/pid.svg +1 -0
  325. package/fileicons/pkg.svg +1 -0
  326. package/fileicons/pl.svg +1 -0
  327. package/fileicons/plist.svg +1 -0
  328. package/fileicons/pm.svg +1 -0
  329. package/fileicons/png.svg +1 -0
  330. package/fileicons/po.svg +1 -0
  331. package/fileicons/pom.svg +1 -0
  332. package/fileicons/pot.svg +1 -0
  333. package/fileicons/potx.svg +1 -0
  334. package/fileicons/pps.svg +1 -0
  335. package/fileicons/ppsx.svg +1 -0
  336. package/fileicons/ppt.svg +1 -0
  337. package/fileicons/pptm.svg +1 -0
  338. package/fileicons/pptx.svg +1 -0
  339. package/fileicons/prop.svg +1 -0
  340. package/fileicons/ps.svg +1 -0
  341. package/fileicons/ps1.svg +1 -0
  342. package/fileicons/psd.svg +1 -0
  343. package/fileicons/psp.svg +1 -0
  344. package/fileicons/pst.svg +1 -0
  345. package/fileicons/pub.svg +1 -0
  346. package/fileicons/py.svg +1 -0
  347. package/fileicons/pyc.svg +1 -0
  348. package/fileicons/qt.svg +1 -0
  349. package/fileicons/ra.svg +1 -0
  350. package/fileicons/ram.svg +1 -0
  351. package/fileicons/rar.svg +1 -0
  352. package/fileicons/raw.svg +1 -0
  353. package/fileicons/rb.svg +1 -0
  354. package/fileicons/rdf.svg +1 -0
  355. package/fileicons/rdl.svg +1 -0
  356. package/fileicons/reg.svg +1 -0
  357. package/fileicons/resx.svg +1 -0
  358. package/fileicons/retry.svg +1 -0
  359. package/fileicons/rm.svg +1 -0
  360. package/fileicons/rom.svg +1 -0
  361. package/fileicons/rpm.svg +1 -0
  362. package/fileicons/rpt.svg +1 -0
  363. package/fileicons/rsa.svg +1 -0
  364. package/fileicons/rss.svg +1 -0
  365. package/fileicons/rst.svg +1 -0
  366. package/fileicons/rtf.svg +1 -0
  367. package/fileicons/ru.svg +1 -0
  368. package/fileicons/rub.svg +1 -0
  369. package/fileicons/sass.svg +1 -0
  370. package/fileicons/scss.svg +1 -0
  371. package/fileicons/sdf.svg +1 -0
  372. package/fileicons/sed.svg +1 -0
  373. package/fileicons/sh.svg +1 -0
  374. package/fileicons/sit.svg +1 -0
  375. package/fileicons/sitemap.svg +1 -0
  376. package/fileicons/skin.svg +1 -0
  377. package/fileicons/sldm.svg +1 -0
  378. package/fileicons/sldx.svg +1 -0
  379. package/fileicons/sln.svg +1 -0
  380. package/fileicons/sol.svg +1 -0
  381. package/fileicons/sphinx.svg +1 -0
  382. package/fileicons/sql.svg +1 -0
  383. package/fileicons/sqlite.svg +1 -0
  384. package/fileicons/step.svg +1 -0
  385. package/fileicons/stl.svg +1 -0
  386. package/fileicons/svg.svg +1 -0
  387. package/fileicons/swd.svg +1 -0
  388. package/fileicons/swf.svg +1 -0
  389. package/fileicons/swift.svg +1 -0
  390. package/fileicons/swp.svg +1 -0
  391. package/fileicons/sys.svg +1 -0
  392. package/fileicons/tar.svg +1 -0
  393. package/fileicons/tax.svg +1 -0
  394. package/fileicons/tcsh.svg +1 -0
  395. package/fileicons/tex.svg +1 -0
  396. package/fileicons/tfignore.svg +1 -0
  397. package/fileicons/tga.svg +1 -0
  398. package/fileicons/tgz.svg +1 -0
  399. package/fileicons/tif.svg +1 -0
  400. package/fileicons/tiff.svg +1 -0
  401. package/fileicons/tmp.svg +1 -0
  402. package/fileicons/tmx.svg +1 -0
  403. package/fileicons/torrent.svg +1 -0
  404. package/fileicons/tpl.svg +1 -0
  405. package/fileicons/ts.svg +1 -0
  406. package/fileicons/tsv.svg +1 -0
  407. package/fileicons/ttf.svg +1 -0
  408. package/fileicons/twig.svg +1 -0
  409. package/fileicons/txt.svg +1 -0
  410. package/fileicons/udf.svg +1 -0
  411. package/fileicons/vb.svg +1 -0
  412. package/fileicons/vbproj.svg +1 -0
  413. package/fileicons/vbs.svg +1 -0
  414. package/fileicons/vcd.svg +1 -0
  415. package/fileicons/vcf.svg +1 -0
  416. package/fileicons/vcs.svg +1 -0
  417. package/fileicons/vdi.svg +1 -0
  418. package/fileicons/vdx.svg +1 -0
  419. package/fileicons/vmdk.svg +1 -0
  420. package/fileicons/vob.svg +1 -0
  421. package/fileicons/vox.svg +1 -0
  422. package/fileicons/vscodeignore.svg +1 -0
  423. package/fileicons/vsd.svg +1 -0
  424. package/fileicons/vss.svg +1 -0
  425. package/fileicons/vst.svg +1 -0
  426. package/fileicons/vsx.svg +1 -0
  427. package/fileicons/vtx.svg +1 -0
  428. package/fileicons/war.svg +1 -0
  429. package/fileicons/wav.svg +1 -0
  430. package/fileicons/wbk.svg +1 -0
  431. package/fileicons/webinfo.svg +1 -0
  432. package/fileicons/webm.svg +1 -0
  433. package/fileicons/webp.svg +1 -0
  434. package/fileicons/wma.svg +1 -0
  435. package/fileicons/wmf.svg +1 -0
  436. package/fileicons/wmv.svg +1 -0
  437. package/fileicons/woff.svg +1 -0
  438. package/fileicons/woff2.svg +1 -0
  439. package/fileicons/wps.svg +1 -0
  440. package/fileicons/wsf.svg +1 -0
  441. package/fileicons/xaml.svg +1 -0
  442. package/fileicons/xcf.svg +1 -0
  443. package/fileicons/xfl.svg +1 -0
  444. package/fileicons/xlm.svg +1 -0
  445. package/fileicons/xls.svg +1 -0
  446. package/fileicons/xlsm.svg +1 -0
  447. package/fileicons/xlsx.svg +1 -0
  448. package/fileicons/xlt.svg +1 -0
  449. package/fileicons/xltm.svg +1 -0
  450. package/fileicons/xltx.svg +1 -0
  451. package/fileicons/xml.svg +1 -0
  452. package/fileicons/xpi.svg +1 -0
  453. package/fileicons/xps.svg +1 -0
  454. package/fileicons/xrb.svg +1 -0
  455. package/fileicons/xsd.svg +1 -0
  456. package/fileicons/xsl.svg +1 -0
  457. package/fileicons/xspf.svg +1 -0
  458. package/fileicons/xz.svg +1 -0
  459. package/fileicons/yaml.svg +1 -0
  460. package/fileicons/yml.svg +1 -0
  461. package/fileicons/z.svg +1 -0
  462. package/fileicons/zip.svg +1 -0
  463. package/fileicons/zsh.svg +1 -0
  464. package/helpers/inertiaAddHelper.d.ts +1 -1
  465. package/helpers/inertiaAddHelper.js +4 -0
  466. package/interfaces/adminpanelConfig.d.ts +3 -0
  467. package/interfaces/global.d.ts +2 -0
  468. package/lib/Adminizer.js +2 -2
  469. package/lib/media-manager/AbstractMediaManager.d.ts +19 -19
  470. package/lib/media-manager/AbstractMediaManager.js +13 -11
  471. package/lib/media-manager/DefaultMediaManager.d.ts +17 -0
  472. package/lib/media-manager/DefaultMediaManager.js +98 -125
  473. package/lib/media-manager/Items.d.ts +45 -0
  474. package/lib/media-manager/Items.js +279 -334
  475. package/lib/media-manager/Thumb.js +1 -2
  476. package/lib/media-manager/helpers/MediaManagerHelper.js +4 -6
  477. package/lib/v4/DataAccessor.d.ts +1 -0
  478. package/lib/v4/DataAccessor.js +15 -8
  479. package/lib/v4/model/adapter/sequelize.js +56 -34
  480. package/lib/v4/model/adapter/waterline.js +12 -4
  481. package/lib/v4/widgets/abstractCustom.d.ts +1 -1
  482. package/models/MediaManagerAP.d.ts +62 -0
  483. package/models/MediaManagerAP.js +45 -0
  484. package/models/MediaManagerAssociationsAP.d.ts +38 -0
  485. package/models/MediaManagerAssociationsAP.js +27 -0
  486. package/models/MediaManagerMetaAP.d.ts +30 -0
  487. package/models/MediaManagerMetaAP.js +21 -0
  488. package/package.json +14 -5
  489. package/system/Router.js +4 -2
  490. package/system/bindExpressUtils.js +1 -1
  491. package/system/bindMediaManager.d.ts +2 -0
  492. package/system/bindMediaManager.js +19 -20
  493. package/system/bindModels.js +3 -3
  494. package/system/bindReqFunctions.js +15 -14
  495. package/translations/en.json +73 -3
  496. package/translations/ru.json +120 -71
  497. package/ui/components/ui/dialog-stack.js +3 -3
  498. package/ui/components/ui/dialog.js +1 -1
  499. package/ui/components/ui/table.d.ts +3 -1
  500. package/ui/components/ui/table.js +2 -2
  501. package/ui/components/ui/tabs.d.ts +7 -0
  502. package/ui/components/ui/tabs.js +16 -0
  503. package/assets/add-BzeOQ-DB.js +0 -1
  504. package/assets/add-form-BLdLojfl.js +0 -1
  505. package/assets/add-group-Bx2s4UXM.js +0 -1
  506. package/assets/add-user-C3BY-sey.js +0 -1
  507. package/assets/app-sidebar-header-DQnbMxfM.js +0 -1
  508. package/assets/breadcrumbs-D0gGjNVI.js +0 -1
  509. package/assets/catalog-Cc6Mk9sX.css +0 -1
  510. package/assets/date-picker-SAfAWPoh.js +0 -1
  511. package/assets/debounce-qdyXyOeG.js +0 -1
  512. package/assets/del-modal-Dj3n8iVJ.js +0 -1
  513. package/assets/form-DjAQC5zI.js +0 -1
  514. package/assets/home-DfUM0yKC.js +0 -2
  515. package/assets/input-error-BztTAmHq.js +0 -1
  516. package/assets/list-B1FodBkq.js +0 -1
  517. package/assets/module-D55s6p7N.js +0 -1
  518. package/assets/multi-select-e4PqgWYn.js +0 -1
  519. package/assets/nav-footer-B7wjmsPb.js +0 -1
  520. package/assets/nav-main-Cx1BkIzi.js +0 -1
  521. package/assets/nav-user-BWl2j-y-.js +0 -1
  522. package/assets/use-appearance-J8J2w43p.js +0 -1
  523. package/assets/welcome-HFROxPwP.js +0 -1
@@ -1,334 +1,279 @@
1
- "use strict";
2
- // import {File, MediaFileType, MediaManagerItem, SortCriteria, UploaderFile} from "./AbstractMediaManager";
3
- // import {populateVariants, randomFileName} from "./helpers/MediaManagerHelper";
4
- // import sizeOf from "image-size";
5
- // import sharp from "sharp";
6
- // import * as fs from 'fs';
7
- // import * as path from 'path';
8
- // import {Adminizer} from "../Adminizer";
9
- //
10
- // interface Meta {
11
- // [key: string]: string;
12
- // }
13
- //
14
- // export class ImageItem extends File<MediaManagerItem> {
15
- // public type: MediaFileType = "image";
16
- // public model: string = "mediamanagerap";
17
- // public metaModel: string = "mediamanagermetaap";
18
- // public imageSizes: any
19
- // protected readonly adminizer: Adminizer
20
- //
21
- // constructor(adminizer: Adminizer, urlPathPrefix: string, fileStoragePath: string) {
22
- // super(urlPathPrefix, fileStoragePath);
23
- // this.imageSizes = adminizer.config.mediamanager.imageSizes || {};
24
- // this.adminizer = adminizer;
25
- // }
26
- //
27
- // public async getItems(limit: number, skip: number, sort: SortCriteria, group: string): Promise<{
28
- // data: MediaManagerItem[];
29
- // next: boolean
30
- // }> {
31
- // // TODO refactor CRUD functions for DataAccessor usage
32
- // let data: MediaManagerItem[] = await this.adminizer.modelHandler.model.get(this.model)["_find"]({
33
- // where: {parent: null, mimeType: {contains: this.type}, group: group},
34
- // limit: limit,
35
- // skip: skip,
36
- // sort: sort,
37
- // }, {populate: [ ["variants", {sort: sort}], ["meta", {}] ]})
38
- //
39
- // let next = await this.adminizer.modelHandler.model.get(this.model).count({
40
- // where: {parent: null, mimeType: {contains: this.type}, group: group},
41
- // limit: limit,
42
- // skip: skip === 0 ? limit : skip + limit,
43
- // sort: sort,
44
- // })
45
- //
46
- // for (let elem of data) {
47
- // elem.variants = await populateVariants(this.adminizer, elem.variants, this.model)
48
- // }
49
- //
50
- // return {
51
- // data: data,
52
- // next: !!next,
53
- // };
54
- // }
55
- //
56
- // public async search(s: string, group: string): Promise<MediaManagerItem[]> {
57
- // // TODO refactor CRUD functions for DataAccessor usage
58
- // let data: MediaManagerItem[] = await this.adminizer.modelHandler.model.get(this.model)["_find"]({
59
- // where: {filename: {contains: s}, mimeType: {contains: this.type}, parent: null, group: group},
60
- // sort: "createdAt DESC",
61
- // }, {populate: [["variants", {sort: "createdAt DESC"}]]})
62
- // for (let elem of data) {
63
- // elem.variants = await populateVariants(this.adminizer, elem.variants, this.model)
64
- // }
65
- // return data
66
- // }
67
- //
68
- // public async upload(file: UploaderFile, filename: string, origFileName: string, group: string): Promise<MediaManagerItem[]> {
69
- // // TODO refactor CRUD functions for DataAccessor usage
70
- // let parent: MediaManagerItem = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
71
- // parent: null,
72
- // mimeType: file.mimetype,
73
- // size: file.size,
74
- // path: file.path,
75
- // group: group,
76
- // tag: "origin",
77
- // filename: origFileName,
78
- // url: `/${this.path}/${filename}`,
79
- // })
80
- //
81
- // await this.createMeta(parent.id);
82
- // await this.addFileMeta(file.path, parent.id)
83
- //
84
- // // create file variants
85
- // if (Object.keys(this.imageSizes).length) {
86
- // await this.createVariants(file, parent, filename, group);
87
- // }
88
- //
89
- // // TODO refactor CRUD functions for DataAccessor usage
90
- // const item: MediaManagerItem = await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({where: {id: parent.id}});
91
- // item.variants = await populateVariants(this.adminizer, item.variants, this.model)
92
- // return [item]
93
- // }
94
- //
95
- // public async getVariants(id: string): Promise<MediaManagerItem[]> {
96
- // // TODO refactor CRUD functions for DataAccessor usage
97
- // let items = ((await this.adminizer.modelHandler.model.get(this.model)["_find"]({
98
- // where: {id: id}
99
- // }, {populate: [["variants", {sort: "createdAt DESC"}]]}))[0]).variants
100
- // return (await populateVariants(this.adminizer, items, this.model))
101
- // }
102
- //
103
- // protected async createVariants(file: UploaderFile, parent: MediaManagerItem, filename: string, group: string): Promise<void> {
104
- // for (const sizeKey of Object.keys(this.imageSizes)) {
105
- // let sizeName = randomFileName(filename, sizeKey, false);
106
- //
107
- // let {width, height} = this.imageSizes[sizeKey];
108
- //
109
- // if (
110
- // sizeOf(file.path).width < width ||
111
- // sizeOf(file.path).height < height
112
- // )
113
- // continue;
114
- //
115
- // let newFile = await this.resizeImage(
116
- // file.path,
117
- // `${this.dir}${sizeName}`,
118
- // width,
119
- // height,
120
- // );
121
- //
122
- // // TODO refactor CRUD functions for DataAccessor usage
123
- // let newSize = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
124
- // parent: parent.id,
125
- // mimeType: parent.mimeType,
126
- // size: newFile.size,
127
- // filename: parent.filename,
128
- // group: group,
129
- // path: `${this.dir}${sizeName}`,
130
- // tag: `saze:${sizeKey}`,
131
- // url: `/${this.path}/${sizeName}`,
132
- // })
133
- //
134
- // await this.addFileMeta(`${this.dir}${sizeName}`, newSize.id)
135
- //
136
- // }
137
- // }
138
- //
139
- // public async getOrigin(id: string): Promise<string> {
140
- // // TODO refactor CRUD functions for DataAccessor usage
141
- // return (await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({where: {id: id}})).path;
142
- // }
143
- //
144
- // protected async createMeta(id: string): Promise<void> {
145
- // //create empty meta
146
- // let metaData: Meta = {
147
- // author: "",
148
- // description: "",
149
- // title: "",
150
- // };
151
- //
152
- // for (const key of Object.keys(metaData)) {
153
- // // TODO refactor CRUD functions for DataAccessor usage
154
- // await this.adminizer.modelHandler.model.get(this.metaModel)["_create"]({
155
- // key: key,
156
- // value: metaData[key],
157
- // parent: id,
158
- // isPublic: true
159
- // });
160
- // }
161
- //
162
- // }
163
- //
164
- // protected async addFileMeta(file: string, id: string): Promise<void> {
165
- // // TODO refactor CRUD functions for DataAccessor usage
166
- // await this.adminizer.modelHandler.model.get(this.metaModel)["_create"]({
167
- // key: 'imageSizes',
168
- // value: sizeOf(file),
169
- // parent: id,
170
- // isPublic: false
171
- // });
172
- // }
173
- //
174
- // public async getMeta(id: string,): Promise<{ key: string; value: string }[]> {
175
- // // TODO refactor CRUD functions for DataAccessor usage
176
- // return ((await this.adminizer.modelHandler.model.get(this.model)["_find"]({
177
- // id: id
178
- // }, {populate: [["meta", {where: {isPublic: true}}]]}))[0]).meta;
179
- // }
180
- //
181
- // async setMeta(id: string, data: { [p: string]: string },): Promise<void> {
182
- // for (const key of Object.keys(data)) {
183
- // // TODO refactor CRUD functions for DataAccessor usage
184
- // await this.adminizer.modelHandler.model.get(this.metaModel)["_update"](
185
- // {parent: id, key: key},
186
- // {value: data[key]},
187
- // );
188
- // }
189
- // }
190
- //
191
- // protected async resizeImage(input: string, output: string, width: number, height: number,) {
192
- // // Get the directory from the output path
193
- // const outputDir = path.dirname(output);
194
- //
195
- // // Check if the directory exists, and create it if it doesn't
196
- // if (!fs.existsSync(outputDir)) {
197
- // fs.mkdirSync(outputDir, {recursive: true});
198
- // }
199
- //
200
- // // Resize the image and save it to the output path
201
- // return await sharp(input)
202
- // .resize({width: width, height: height})
203
- // .toFile(output);
204
- // }
205
- //
206
- // public async uploadVariant(parent: MediaManagerItem, file: UploaderFile, filename: string, group: string, localeId: string): Promise<MediaManagerItem> {
207
- // let {width, height} = sizeOf(file.path)
208
- // // TODO refactor CRUD functions for DataAccessor usage
209
- // let item: MediaManagerItem = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
210
- // parent: parent.id,
211
- // mimeType: file.mimetype,
212
- // size: file.size,
213
- // path: file.path,
214
- // group: group,
215
- // tag: localeId ? `loc:${localeId}` : `size:${width}x${height}`,
216
- // filename: parent.filename,
217
- // url: `/${this.path}/${filename}`,
218
- // })
219
- //
220
- // await this.addFileMeta(file.path, item.id)
221
- //
222
- // // TODO refactor CRUD functions for DataAccessor usage
223
- // return (await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({where: {id: item.id}}))
224
- // }
225
- //
226
- // async delete(id: string): Promise<void> {
227
- // const criteria = {where: {id: id}};
228
- // // TODO refactor CRUD functions for DataAccessor usage
229
- // let record = await this.adminizer.modelHandler.model.get(this.model)["_findOne"](criteria);
230
- //
231
- // await beforeDestroy(this.adminizer, criteria);
232
- // // TODO refactor CRUD functions for DataAccessor usage
233
- // await this.adminizer.modelHandler.model.get(this.model)["_destroy"](criteria);
234
- // await deleteFile(record.path);
235
- // }
236
- // }
237
- //
238
- // /*
239
- // * Text item
240
- // */
241
- // export class TextItem extends ImageItem {
242
- // public type: MediaFileType = "text";
243
- //
244
- // public async upload(file: UploaderFile, filename: string, origFileName: string, group: string): Promise<MediaManagerItem[]> {
245
- // // TODO refactor CRUD functions for DataAccessor usage
246
- // let parent: MediaManagerItem = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
247
- // parent: null,
248
- // mimeType: file.mimetype,
249
- // size: file.size,
250
- // path: file.path,
251
- // group: group,
252
- // filename: origFileName,
253
- // tag: "origin",
254
- // url: `/${this.path}/${filename}`,
255
- // })
256
- //
257
- // await this.createMeta(parent.id);
258
- //
259
- // // TODO refactor CRUD functions for DataAccessor usage
260
- // const item: MediaManagerItem = await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({where: {id: parent.id}});
261
- // item.variants = await populateVariants(this.adminizer, item.variants, this.model)
262
- // return [item]
263
- // }
264
- //
265
- // getvariants(): Promise<MediaManagerItem[]> {
266
- // return Promise.resolve([]);
267
- // }
268
- //
269
- // public async uploadVariant(parent: MediaManagerItem, file: UploaderFile, filename: string, group: string, localeId: string): Promise<MediaManagerItem> {
270
- // let variants = parent.variants.filter(e => /^loc:/.test(e.tag) === false)
271
- // // TODO refactor CRUD functions for DataAccessor usage
272
- // let item: MediaManagerItem = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
273
- // parent: parent.id,
274
- // mimeType: file.mimetype,
275
- // size: file.size,
276
- // path: file.path,
277
- // group: group,
278
- // tag: localeId ? `loc:${localeId}` : `ver: ${variants.length + 1}`,
279
- // filename: parent.filename,
280
- // url: `/${this.path}/${filename}`,
281
- // })
282
- //
283
- // // TODO refactor CRUD functions for DataAccessor usage
284
- // return (await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({where: {id: item.id}}))
285
- // }
286
- //
287
- // public async getVariants(id: string): Promise<MediaManagerItem[]> {
288
- // // TODO refactor CRUD functions for DataAccessor usage
289
- // let items = ((await this.adminizer.modelHandler.model.get(this.model)["_find"]({
290
- // where: {id: id}
291
- // }, {populate: [["variants", {sort: "createdAt DESC"}]]}))[0]).variants
292
- // return (await populateVariants(this.adminizer, items, this.model))
293
- // }
294
- // }
295
- //
296
- // export class ApplicationItem extends TextItem {
297
- // public type: MediaFileType = "application";
298
- // }
299
- //
300
- // export class VideoItem extends TextItem {
301
- // public type: MediaFileType = "video";
302
- // }
303
- //
304
- //
305
- // async function beforeDestroy(adminizer: Adminizer, criteria: { where: object }) {
306
- // // TODO refactor CRUD functions for DataAccessor usage
307
- // let parent: ModelsAP["MediaManagerAP"] = (await adminizer.modelHandler.model.get("MediaManagerAP")?.["_find"](criteria))[0]
308
- // let meta = parent.meta
309
- // for (const metaElement of meta) {
310
- // // TODO refactor CRUD functions for DataAccessor usage
311
- // await adminizer.modelHandler.model.get("MediaManagerMetaAP")?.["_destroy"]({id: metaElement.id})
312
- // }
313
- //
314
- // // TODO refactor CRUD functions for DataAccessor usage
315
- // let variants: ModelsAP["MediaManagerAP"]["variants"] = (await adminizer.modelHandler.model.get("MediaManagerAP")?.["_find"](criteria))[0].variants
316
- // for (const child of variants) {
317
- // // TODO refactor CRUD functions for DataAccessor usage
318
- // await adminizer.modelHandler.model.get("MediaManagerAP")?.["_destroy"]({id: child.id})
319
- // }
320
- // }
321
- //
322
- //
323
- // async function deleteFile(file: string) {
324
- // try {
325
- // await fs.promises.access(file);
326
- // await fs.promises.unlink(file);
327
- // } catch (err) {
328
- // if (err.code === 'ENOENT') {
329
- // } else if (err.code === 'EPERM') {
330
- // } else {
331
- // console.error(`An error occurred: ${err}`);
332
- // }
333
- // }
334
- // }
1
+ import { File } from "./AbstractMediaManager";
2
+ import { populateVariants, randomFileName } from "./helpers/MediaManagerHelper";
3
+ import sizeOf from "image-size";
4
+ import sharp from "sharp";
5
+ import * as fs from 'fs';
6
+ import * as path from 'path';
7
+ export class ImageItem extends File {
8
+ type = "image";
9
+ model = "mediamanagerap";
10
+ metaModel = "mediamanagermetaap";
11
+ imageSizes;
12
+ adminizer;
13
+ constructor(adminizer, urlPathPrefix, fileStoragePath) {
14
+ super(urlPathPrefix, fileStoragePath);
15
+ this.imageSizes = adminizer.config.mediamanager.imageSizes || {};
16
+ this.adminizer = adminizer;
17
+ }
18
+ async getItems(limit, skip, sort, group) {
19
+ // TODO refactor CRUD functions for DataAccessor usage
20
+ let data = await this.adminizer.modelHandler.model.get(this.model)["_find"]({
21
+ where: { parent: null, mimeType: { contains: this.type }, group: group },
22
+ limit: limit,
23
+ skip: skip,
24
+ sort: sort,
25
+ }, { populate: [["variants", { sort: sort }], ["meta", {}]] });
26
+ let next = await this.adminizer.modelHandler.model.get(this.model)['_find']({
27
+ where: { parent: null, mimeType: { contains: this.type }, group: group },
28
+ limit: limit,
29
+ skip: skip === 0 ? limit : skip + limit,
30
+ sort: sort,
31
+ });
32
+ for (let elem of data) {
33
+ elem.variants = await populateVariants(this.adminizer, elem.variants, this.model);
34
+ }
35
+ return {
36
+ data: data,
37
+ next: !!next.length,
38
+ };
39
+ }
40
+ async search(s, group) {
41
+ // TODO refactor CRUD functions for DataAccessor usage
42
+ let data = await this.adminizer.modelHandler.model.get(this.model)["_find"]({
43
+ where: { filename: { contains: s }, mimeType: { contains: this.type }, parent: null, group: group },
44
+ sort: "createdAt DESC",
45
+ }, { populate: [["variants", { sort: "createdAt DESC" }]] });
46
+ for (let elem of data) {
47
+ elem.variants = await populateVariants(this.adminizer, elem.variants, this.model);
48
+ }
49
+ return data;
50
+ }
51
+ async upload(file, filename, origFileName, group) {
52
+ // TODO refactor CRUD functions for DataAccessor usage
53
+ let parent = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
54
+ parent: null,
55
+ mimeType: file.mimetype,
56
+ size: file.size,
57
+ path: file.path,
58
+ group: group,
59
+ tag: "origin",
60
+ filename: origFileName,
61
+ url: `/${this.urlPathPrefix}/${filename}`,
62
+ });
63
+ await this.createMeta(parent.id);
64
+ await this.addFileMeta(file.path, parent.id);
65
+ // create file variants
66
+ if (Object.keys(this.imageSizes).length) {
67
+ await this.createVariants(file, parent, filename, group);
68
+ }
69
+ // TODO refactor CRUD functions for DataAccessor usage
70
+ const item = await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({ where: { id: parent.id } });
71
+ item.variants = await populateVariants(this.adminizer, item.variants, this.model);
72
+ return [item];
73
+ }
74
+ async getVariants(id) {
75
+ // TODO refactor CRUD functions for DataAccessor usage
76
+ let items = ((await this.adminizer.modelHandler.model.get(this.model)["_find"]({
77
+ where: { id: id }
78
+ }, { populate: [["variants", { sort: "createdAt DESC" }]] }))[0]).variants;
79
+ return (await populateVariants(this.adminizer, items, this.model));
80
+ }
81
+ async createVariants(file, parent, filename, group) {
82
+ for (const sizeKey of Object.keys(this.imageSizes)) {
83
+ let sizeName = randomFileName(filename, sizeKey, false);
84
+ let { width, height } = this.imageSizes[sizeKey];
85
+ const buffer = fs.readFileSync(file.path);
86
+ const image = sizeOf(buffer);
87
+ if (image.width < width || image.height < height)
88
+ continue;
89
+ const output = `${this.fileStoragePath}/${this.urlPathPrefix}/${sizeName}`;
90
+ let newFile = await this.resizeImage(file.path, output, width, height);
91
+ // TODO refactor CRUD functions for DataAccessor usage
92
+ let newSize = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
93
+ parent: parent.id,
94
+ mimeType: parent.mimeType,
95
+ size: newFile.size,
96
+ filename: parent.filename,
97
+ group: group,
98
+ path: output,
99
+ tag: `saze:${sizeKey}`,
100
+ url: `/${this.urlPathPrefix}/${sizeName}`,
101
+ });
102
+ await this.addFileMeta(output, newSize.id);
103
+ }
104
+ }
105
+ async getOrigin(id) {
106
+ // TODO refactor CRUD functions for DataAccessor usage
107
+ return (await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({ where: { id: id } })).path;
108
+ }
109
+ async createMeta(id) {
110
+ //create empty meta
111
+ let metaData = {
112
+ author: "",
113
+ description: "",
114
+ title: "",
115
+ };
116
+ for (const key of Object.keys(metaData)) {
117
+ // TODO refactor CRUD functions for DataAccessor usage
118
+ await this.adminizer.modelHandler.model.get(this.metaModel)["_create"]({
119
+ key: key,
120
+ value: metaData[key],
121
+ parent: id,
122
+ isPublic: true
123
+ });
124
+ }
125
+ }
126
+ async addFileMeta(file, id) {
127
+ // TODO refactor CRUD functions for DataAccessor usage
128
+ const metaBuffer = fs.readFileSync(file);
129
+ await this.adminizer.modelHandler.model.get(this.metaModel)["_create"]({
130
+ key: 'imageSizes',
131
+ value: sizeOf(metaBuffer),
132
+ parent: id,
133
+ isPublic: false
134
+ });
135
+ }
136
+ async getMeta(id) {
137
+ // TODO refactor CRUD functions for DataAccessor usage
138
+ return ((await this.adminizer.modelHandler.model.get(this.model)["_find"]({
139
+ id: id
140
+ }, { populate: [["meta", { where: { isPublic: true } }]] }))[0]).meta;
141
+ }
142
+ async setMeta(id, data) {
143
+ for (const key of Object.keys(data)) {
144
+ // TODO refactor CRUD functions for DataAccessor usage
145
+ await this.adminizer.modelHandler.model.get(this.metaModel)["_update"]({ parent: id, key: key }, { value: data[key] });
146
+ }
147
+ }
148
+ async resizeImage(input, output, width, height) {
149
+ // Get the directory from the output path
150
+ const outputDir = path.dirname(output);
151
+ // Check if the directory exists, and create it if it doesn't
152
+ if (!fs.existsSync(outputDir)) {
153
+ fs.mkdirSync(outputDir, { recursive: true });
154
+ }
155
+ // Resize the image and save it to the output path
156
+ return await sharp(input)
157
+ .resize({ width: width, height: height })
158
+ .toFile(output);
159
+ }
160
+ async uploadVariant(parent, file, filename, group, localeId) {
161
+ const variantBuffer = fs.readFileSync(file.path);
162
+ const { width, height } = sizeOf(variantBuffer);
163
+ // TODO refactor CRUD functions for DataAccessor usage
164
+ let item = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
165
+ parent: parent.id,
166
+ mimeType: file.mimetype,
167
+ size: file.size,
168
+ path: file.path,
169
+ group: group,
170
+ tag: localeId ? `loc:${localeId}` : `size:${width}x${height}`,
171
+ filename: parent.filename,
172
+ url: `/${this.urlPathPrefix}/${filename}`,
173
+ });
174
+ await this.addFileMeta(file.path, item.id);
175
+ // TODO refactor CRUD functions for DataAccessor usage
176
+ return (await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({ where: { id: item.id } }));
177
+ }
178
+ async delete(id) {
179
+ const criteria = { where: { id: id } };
180
+ // TODO refactor CRUD functions for DataAccessor usage
181
+ let record = await this.adminizer.modelHandler.model.get(this.model)["_findOne"](criteria);
182
+ await beforeDestroy(this.adminizer, criteria);
183
+ // TODO refactor CRUD functions for DataAccessor usage
184
+ await this.adminizer.modelHandler.model.get(this.model)["_destroy"](criteria);
185
+ await deleteFile(record.path);
186
+ // Delete all variants
187
+ if (record.variants.length) {
188
+ for (const variant of record.variants) {
189
+ await deleteFile(variant.path);
190
+ }
191
+ }
192
+ }
193
+ }
194
+ /*
195
+ * Text item
196
+ */
197
+ export class TextItem extends ImageItem {
198
+ type = "text";
199
+ async upload(file, filename, origFileName, group) {
200
+ // TODO refactor CRUD functions for DataAccessor usage
201
+ let parent = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
202
+ parent: null,
203
+ mimeType: file.mimetype,
204
+ size: file.size,
205
+ path: file.path,
206
+ group: group,
207
+ filename: origFileName,
208
+ tag: "origin",
209
+ url: `/${this.urlPathPrefix}/${filename}`,
210
+ });
211
+ await this.createMeta(parent.id);
212
+ // TODO refactor CRUD functions for DataAccessor usage
213
+ const item = await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({ where: { id: parent.id } });
214
+ item.variants = await populateVariants(this.adminizer, item.variants, this.model);
215
+ return [item];
216
+ }
217
+ getvariants() {
218
+ return Promise.resolve([]);
219
+ }
220
+ async uploadVariant(parent, file, filename, group, localeId) {
221
+ let variants = parent.variants.filter(e => /^loc:/.test(e.tag) === false);
222
+ // TODO refactor CRUD functions for DataAccessor usage
223
+ let item = await this.adminizer.modelHandler.model.get(this.model)["_create"]({
224
+ parent: parent.id,
225
+ mimeType: file.mimetype,
226
+ size: file.size,
227
+ path: file.path,
228
+ group: group,
229
+ tag: localeId ? `loc:${localeId}` : `ver: ${variants.length + 1}`,
230
+ filename: parent.filename,
231
+ url: `/${this.urlPathPrefix}/${filename}`,
232
+ });
233
+ // TODO refactor CRUD functions for DataAccessor usage
234
+ return (await this.adminizer.modelHandler.model.get(this.model)["_findOne"]({ where: { id: item.id } }));
235
+ }
236
+ async getVariants(id) {
237
+ // TODO refactor CRUD functions for DataAccessor usage
238
+ let items = ((await this.adminizer.modelHandler.model.get(this.model)["_find"]({
239
+ where: { id: id }
240
+ }, { populate: [["variants", { sort: "createdAt DESC" }]] }))[0]).variants;
241
+ return (await populateVariants(this.adminizer, items, this.model));
242
+ }
243
+ }
244
+ export class ApplicationItem extends TextItem {
245
+ type = "application";
246
+ }
247
+ export class VideoItem extends TextItem {
248
+ type = "video";
249
+ }
250
+ async function beforeDestroy(adminizer, criteria) {
251
+ // TODO refactor CRUD functions for DataAccessor usage
252
+ let parent = (await adminizer.modelHandler.model.get("MediaManagerAP")?.["_find"](criteria))[0];
253
+ let meta = parent.meta;
254
+ for (const metaElement of meta) {
255
+ // TODO refactor CRUD functions for DataAccessor usage
256
+ await adminizer.modelHandler.model.get("MediaManagerMetaAP")?.["_destroy"]({ id: metaElement.id });
257
+ }
258
+ // TODO refactor CRUD functions for DataAccessor usage
259
+ let variants = (await adminizer.modelHandler.model.get("MediaManagerAP")?.["_find"](criteria))[0].variants;
260
+ for (const child of variants) {
261
+ // TODO refactor CRUD functions for DataAccessor usage
262
+ await adminizer.modelHandler.model.get("MediaManagerAP")?.["_destroy"]({ id: child.id });
263
+ }
264
+ }
265
+ async function deleteFile(file) {
266
+ try {
267
+ await fs.promises.access(file);
268
+ await fs.promises.unlink(file);
269
+ }
270
+ catch (err) {
271
+ if (err.code === 'ENOENT') {
272
+ }
273
+ else if (err.code === 'EPERM') {
274
+ }
275
+ else {
276
+ console.error(`An error occurred: ${err}`);
277
+ }
278
+ }
279
+ }