map.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /**
  2. * 存放一些静态变量、Map 等全局可用的变量
  3. * @author 小鲤鱼听听
  4. */
  5. /**
  6. * 未知文件类型图标
  7. */
  8. export const unknownImg = new URL('@/assets/images/myResource/file/file_unknown.png', import.meta.url).href
  9. /**
  10. * 文件类型图标 Map 映射
  11. */
  12. export const fileImgMap = new Map([
  13. ['avi', new URL('@/assets/images/myResource/file/file_avi.png', import.meta.url).href],
  14. ['bat', new URL('@/assets/images/myResource/file/file_powershell.png', import.meta.url).href],
  15. ['c', new URL('@/assets/images/myResource/file/file_c.png', import.meta.url).href],
  16. ['c++', new URL('@/assets/images/myResource/file/file_c++.png', import.meta.url).href],
  17. ['c#', new URL('@/assets/images/myResource/file/file_c#.png', import.meta.url).href],
  18. ['css', new URL('@/assets/images/myResource/file/file_css.png', import.meta.url).href],
  19. ['go', new URL('@/assets/images/myResource/file/file_go.png', import.meta.url).href],
  20. ['py', new URL('@/assets/images/myResource/file/file_python.png', import.meta.url).href],
  21. ['styl', new URL('@/assets/images/myResource/file/file_stylus.png', import.meta.url).href],
  22. ['less', new URL('@/assets/images/myResource/file/file_less.png', import.meta.url).href],
  23. ['conf', new URL('@/assets/images/myResource/file/file_nginx.png', import.meta.url).href],
  24. ['m', new URL('@/assets/images/myResource/file/file_objective_c.png', import.meta.url).href],
  25. ['scss', new URL('@/assets/images/myResource/file/file_scss.png', import.meta.url).href],
  26. ['sass', new URL('@/assets/images/myResource/file/file_sass.png', import.meta.url).href],
  27. ['csv', new URL('@/assets/images/myResource/file/file_csv.png', import.meta.url).href],
  28. ['dmg', new URL('@/assets/images/myResource/file/file_dmg.png', import.meta.url).href],
  29. ['dir', new URL('@/assets/images/myResource/file/dir.png', import.meta.url).href],
  30. ['doc', new URL('@/assets/images/myResource/file/file_word.svg', import.meta.url).href],
  31. ['docx', new URL('@/assets/images/myResource/file/file_word.svg', import.meta.url).href],
  32. ['exe', new URL('@/assets/images/myResource/file/file_exe.png', import.meta.url).href],
  33. ['html', new URL('@/assets/images/myResource/file/file_html.png', import.meta.url).href],
  34. ['jar', new URL('@/assets/images/myResource/file/file_jar.png', import.meta.url).href],
  35. ['java', new URL('@/assets/images/myResource/file/file_java.png', import.meta.url).href],
  36. ['js', new URL('@/assets/images/myResource/file/file_js.png', import.meta.url).href],
  37. ['json', new URL('@/assets/images/myResource/file/file_json.png', import.meta.url).href],
  38. ['jsp', new URL('@/assets/images/myResource/file/file_jsp.png', import.meta.url).href],
  39. ['kt', new URL('@/assets/images/myResource/file/file_kotlin.png', import.meta.url).href],
  40. ['mp3', new URL('@/assets/images/myResource/file/file_music.png', import.meta.url).href],
  41. ['flac', new URL('@/assets/images/myResource/file/file_flac.svg', import.meta.url).href],
  42. ['oa', new URL('@/assets/images/myResource/file/file_oa.png', import.meta.url).href],
  43. ['open', new URL('@/assets/images/myResource/file/file_open.png', import.meta.url).href],
  44. ['pdf', new URL('@/assets/images/myResource/file/file_pdf.png', import.meta.url).href],
  45. ['php', new URL('@/assets/images/myResource/file/file_php.png', import.meta.url).href],
  46. ['ppt', new URL('@/assets/images/myResource/file/file_ppt.svg', import.meta.url).href],
  47. ['pptx', new URL('@/assets/images/myResource/file/file_ppt.svg', import.meta.url).href],
  48. ['properties', new URL('@/assets/images/myResource/file/file_properties.png', import.meta.url).href],
  49. ['r', new URL('@/assets/images/myResource/file/file_r.png', import.meta.url).href],
  50. ['rar', new URL('@/assets/images/myResource/file/file_rar.png', import.meta.url).href],
  51. ['rs', new URL('@/assets/images/myResource/file/file_rust.png', import.meta.url).href],
  52. ['rtf', new URL('@/assets/images/myResource/file/file_rtf.png', import.meta.url).href],
  53. ['sh', new URL('@/assets/images/myResource/file/file_shell.png', import.meta.url).href],
  54. ['sql', new URL('@/assets/images/myResource/file/file_sql.png', import.meta.url).href],
  55. ['svg', new URL('@/assets/images/myResource/file/file_svg.png', import.meta.url).href],
  56. ['swift', new URL('@/assets/images/myResource/file/file_swift.png', import.meta.url).href],
  57. ['ts', new URL('@/assets/images/myResource/file/file_typescript.png', import.meta.url).href],
  58. ['txt', new URL('@/assets/images/myResource/file/file_txt.png', import.meta.url).href],
  59. ['vue', new URL('@/assets/images/myResource/file/file_vue.png', import.meta.url).href],
  60. ['xls', new URL('@/assets/images/myResource/file/file_excel.svg', import.meta.url).href],
  61. ['xlsx', new URL('@/assets/images/myResource/file/file_excel.svg', import.meta.url).href],
  62. ['xml', new URL('@/assets/images/myResource/file/file_xml.png', import.meta.url).href],
  63. ['zip', new URL('@/assets/images/myResource/file/file_zip.png', import.meta.url).href],
  64. ['7z', new URL('@/assets/images/myResource/file/file_7z.svg', import.meta.url).href],
  65. ['tar', new URL('@/assets/images/myResource/file/file_tar.svg', import.meta.url).href],
  66. ['md', new URL('@/assets/images/myResource/file/file_markdown.png', import.meta.url).href],
  67. ['markdown', new URL('@/assets/images/myResource/file/file_markdown.png', import.meta.url).href],
  68. ['yaml', new URL('@/assets/images/myResource/file/file_yaml.png', import.meta.url).href],
  69. ['yml', new URL('@/assets/images/myResource/file/file_yaml.png', import.meta.url).href]
  70. ])
  71. /**
  72. * 支持使用 onlyoffice 打开的文件格式
  73. */
  74. export const officeFileType = ['ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx']
  75. /**
  76. * markdown 文件后缀
  77. */
  78. export const markdownFileType = ['markdown', 'md']
  79. /**
  80. * 文件展示模式选择列表时,所有可供选择的表格列名
  81. */
  82. export const allColumnList = ['extendName', 'fileSize', 'uploadTime', 'deleteTime']
  83. /**
  84. * 可以用代码编辑器打开的文件后缀和 解析语言、 codemirror 解析模式 mode 映射关系
  85. * language:解析语言,
  86. * mime: codemirror 解析模式
  87. */
  88. export const fileSuffixCodeModeMap = new Map([
  89. ['c', { language: 'C', mime: 'text/x-csrc' }],
  90. ['c++', { language: 'C++', mime: 'text/x-c++src' }],
  91. ['c#', { language: 'C#', mime: 'text/x-csharp' }],
  92. ['m', { language: 'Objective-C', mime: 'text/x-objectivec' }],
  93. ['go', { language: 'GO', mime: 'text/x-go' }],
  94. ['kt', { language: 'Kotlin', mime: 'text/x-java' }],
  95. ['css', { language: 'CSS', mime: 'text/css' }],
  96. ['less', { language: 'Less', mime: 'text/x-less' }],
  97. ['php', { language: 'PHP', mime: 'text/x-php' }],
  98. ['bat', { language: 'PowerShell', mime: 'application/x-powershell' }],
  99. ['py', { language: 'Python', mime: 'text/x-python' }],
  100. ['properties', { language: 'Properties', mime: 'text/x-properties' }],
  101. ['R', { language: 'R', mime: 'text/x-rsrc' }],
  102. ['rs', { language: 'Rust', mime: 'text/x-rustsrc' }],
  103. ['scss', { language: 'Scss', mime: 'text/x-scss' }],
  104. ['sass', { language: 'Sass', mime: 'text/x-sass' }],
  105. ['sh', { language: 'Shell', mime: 'text/x-sh' }],
  106. ['styl', { language: 'stylus', mime: 'text/x-styl' }],
  107. ['xml', { language: 'XML', mime: 'text/xml' }],
  108. ['html', { language: 'HTML', mime: 'text/html' }],
  109. ['http', { language: 'HTTP', mime: 'text/http' }],
  110. ['conf', { language: 'Nginx', mime: 'text/x-nginx-conf' }],
  111. ['java', { language: 'Java', mime: 'text/x-java' }],
  112. ['js', { language: 'JavaScript', mime: 'text/javascript' }],
  113. ['ts', { language: 'Typescript', mime: 'text/typescript' }],
  114. ['json', { language: 'JSON', mime: 'application/json' }],
  115. ['jsp', { language: 'JSP', mime: 'application/x-jsp' }],
  116. // ['txt', { language: '', mime: '' }],
  117. ['vue', { language: 'HTML', mime: 'text/html' }],
  118. ['sql', { language: 'SQL', mime: 'text/x-sql' }],
  119. ['swift', { language: 'Swift', mime: 'text/x-swift' }],
  120. ['yml', { language: 'YAML', mime: 'text/x-yaml' }]
  121. ])
  122. /**
  123. * codemirror 编辑器代码高亮主题列表
  124. */
  125. export const codeMirrorThemeList = [
  126. '3024-day',
  127. '3024-night',
  128. 'abbott',
  129. 'abcdef',
  130. 'ambiance-mobile',
  131. 'ambiance',
  132. 'ayu-dark',
  133. 'ayu-mirage',
  134. 'base16-dark',
  135. 'base16-light',
  136. 'bespin',
  137. 'blackboard',
  138. 'cobalt',
  139. 'colorforth',
  140. 'darcula',
  141. 'dracula',
  142. 'duotone-dark',
  143. 'duotone-light',
  144. 'eclipse',
  145. 'elegant',
  146. 'erlang-dark',
  147. 'gruvbox-dark',
  148. 'hopscotch',
  149. 'icecoder',
  150. 'idea',
  151. 'isotope',
  152. 'juejin',
  153. 'lesser-dark',
  154. 'liquibyte',
  155. 'lucario',
  156. 'material-darker',
  157. 'material-ocean',
  158. 'material-palenight',
  159. 'material',
  160. 'mbo',
  161. 'mdn-like',
  162. 'midnight',
  163. 'monokai',
  164. 'moxer',
  165. 'neat',
  166. 'neo',
  167. 'night',
  168. 'nord',
  169. 'oceanic-next',
  170. 'panda-syntax',
  171. 'paraiso-dark',
  172. 'paraiso-light',
  173. 'pastel-on-dark',
  174. 'railscasts',
  175. 'rubyblue',
  176. 'seti',
  177. 'shadowfox',
  178. 'solarized',
  179. 'ssms',
  180. 'the-matrix',
  181. 'tomorrow-night',
  182. 'tomorrow-night-bright',
  183. 'tomorrow-night-eighties',
  184. 'ttcn',
  185. 'twilight',
  186. 'vibrant-ink',
  187. 'xq-dark',
  188. 'xq-light',
  189. 'yeti',
  190. 'yonce',
  191. 'zenburn'
  192. ]
  193. /**
  194. * codemirror 编辑器代码字体大小
  195. */
  196. export const fontSizeList = [12, 14, 16, 18, 20, 22, 24, 26, 28, 30]