Browse Source

feat(nc-gui): convert to tree data format

pull/4931/head
Wing-Kam Wong 2 years ago
parent
commit
7fa2df4f6d
  1. 314
      packages/nc-gui/components/smartsheet/column/utils.ts

314
packages/nc-gui/components/smartsheet/column/utils.ts

@ -11,141 +11,181 @@ export function getRelationName(type: string) {
// supported mime types // supported mime types
// retrieved from https://github.com/sindresorhus/file-type/blob/main/supported.js#L146 // retrieved from https://github.com/sindresorhus/file-type/blob/main/supported.js#L146
export const fileMimeTypes = [ export const fileMimeTypes = [
'image/jpeg', {
'image/png', title: 'Application',
'image/gif', key: 'application',
'image/webp', children: [
'image/flif', { title: 'application/dicom', key: 'application/dicom' },
'image/x-xcf', { title: 'application/eps', key: 'application/eps' },
'image/x-canon-cr2', { title: 'application/epub+zip', key: 'application/epub+zip' },
'image/x-canon-cr3', { title: 'application/gzip', key: 'application/gzip' },
'image/tiff', { title: 'application/mxf', key: 'application/mxf' },
'image/bmp', { title: 'application/ogg', key: 'application/ogg' },
'image/vnd.ms-photo', { title: 'application/pdf', key: 'application/pdf' },
'image/vnd.adobe.photoshop', { title: 'application/pgp-encrypted', key: 'application/pgp-encrypted' },
'application/x-indesign', { title: 'application/postscript', key: 'application/postscript' },
'application/epub+zip', { title: 'application/rtf', key: 'application/rtf' },
'application/x-xpinstall', { title: 'application/vnd.ms-asf', key: 'application/vnd.ms-asf' },
'application/vnd.oasis.opendocument.text', { title: 'application/vnd.ms-cab-compressed', key: 'application/vnd.ms-cab-compressed' },
'application/vnd.oasis.opendocument.spreadsheet', { title: 'application/vnd.ms-fontobject', key: 'application/vnd.ms-fontobject' },
'application/vnd.oasis.opendocument.presentation', { title: 'application/vnd.ms-htmlhelp', key: 'application/vnd.ms-htmlhelp' },
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', { title: 'application/vnd.ms-outlook', key: 'application/vnd.ms-outlook' },
'application/vnd.openxmlformats-officedocument.presentationml.presentation', { title: 'application/vnd.oasis.opendocument.presentation', key: 'application/vnd.oasis.opendocument.presentation' },
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', { title: 'application/vnd.oasis.opendocument.spreadsheet', key: 'application/vnd.oasis.opendocument.spreadsheet' },
'application/zip', { title: 'application/vnd.oasis.opendocument.text', key: 'application/vnd.oasis.opendocument.text' },
'application/x-tar', {
'application/x-rar-compressed', title: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/gzip', key: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'application/x-bzip2', },
'application/x-7z-compressed', {
'application/x-apple-diskimage', title: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/x-apache-arrow', key: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'video/mp4', },
'audio/midi', {
'video/x-matroska', title: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'video/webm', key: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'video/quicktime', },
'video/vnd.avi', { title: 'application/vnd.sketchup.skp', key: 'application/vnd.sketchup.skp' },
'audio/vnd.wave', { title: 'application/vnd.tcpdump.pcap', key: 'application/vnd.tcpdump.pcap' },
'audio/qcelp', { title: 'application/wasm', key: 'application/wasm' },
'audio/x-ms-asf', { title: 'application/x-7z-compressed', key: 'application/x-7z-compressed' },
'video/x-ms-asf', { title: 'application/x-apache-arrow', key: 'application/x-apache-arrow' },
'application/vnd.ms-asf', { title: 'application/x-apple-diskimage', key: 'application/x-apple-diskimage' },
'video/mpeg', { title: 'application/x-asar', key: 'application/x-asar' },
'video/3gpp', { title: 'application/x-blender', key: 'application/x-blender' },
'audio/mpeg', { title: 'application/x-bzip2', key: 'application/x-bzip2' },
'audio/mp4', // RFC 4337 { title: 'application/x-cfb', key: 'application/x-cfb' },
'audio/opus', { title: 'application/x-compress', key: 'application/x-compress' },
'video/ogg', { title: 'application/x-deb', key: 'application/x-deb' },
'audio/ogg', { title: 'application/x-elf', key: 'application/x-elf' },
'application/ogg', { title: 'application/x-esri-shape', key: 'application/x-esri-shape' },
'audio/x-flac', { title: 'application/x-google-chrome-extension', key: 'application/x-google-chrome-extension' },
'audio/ape', { title: 'application/x-indesign', key: 'application/x-indesign' },
'audio/wavpack', { title: 'application/x-lzh-compressed', key: 'application/x-lzh-compressed' },
'audio/amr', { title: 'application/x-lzip', key: 'application/x-lzip' },
'application/pdf', { title: 'application/x-mie', key: 'application/x-mie' },
'application/x-elf', { title: 'application/x-mobipocket-ebook', key: 'application/x-mobipocket-ebook' },
'application/x-msdownload', { title: 'application/x-msdownload', key: 'application/x-msdownload' },
'application/x-shockwave-flash', { title: 'application/x-nintendo-nes-rom', key: 'application/x-nintendo-nes-rom' },
'application/rtf', { title: 'application/x-rar-compressed', key: 'application/x-rar-compressed' },
'application/wasm', { title: 'application/x-rpm', key: 'application/x-rpm' },
'font/woff', { title: 'application/x-shockwave-flash', key: 'application/x-shockwave-flash' },
'font/woff2', { title: 'application/x-sqlite3', key: 'application/x-sqlite3' },
'application/vnd.ms-fontobject', { title: 'application/x-tar', key: 'application/x-tar' },
'font/ttf', { title: 'application/x-unix-archive', key: 'application/x-unix-archive' },
'font/otf', { title: 'application/x-xpinstall', key: 'application/x-xpinstall' },
'image/x-icon', { title: 'application/x-xz', key: 'application/x-xz' },
'video/x-flv', { title: 'application/x.apple.alias', key: 'application/x.apple.alias' },
'application/postscript', { title: 'application/x.ms.shortcut', key: 'application/x.ms.shortcut' },
'application/eps', { title: 'application/xml', key: 'application/xml' },
'application/x-xz', { title: 'application/zip', key: 'application/zip' },
'application/x-sqlite3', { title: 'application/zstd', key: 'application/zstd' },
'application/x-nintendo-nes-rom', ],
'application/x-google-chrome-extension', },
'application/vnd.ms-cab-compressed', {
'application/x-deb', title: 'Audio',
'application/x-unix-archive', key: 'audio',
'application/x-rpm', children: [
'application/x-compress', { title: 'audio/aac', key: 'audio/aac' },
'application/x-lzip', { title: 'audio/aiff', key: 'audio/aiff' },
'application/x-cfb', { title: 'audio/amr', key: 'audio/amr' },
'application/x-mie', { title: 'audio/ape', key: 'audio/ape' },
'application/mxf', { title: 'audio/midi', key: 'audio/midi' },
'video/mp2t', { title: 'audio/mp4', key: 'audio/mp4' },
'application/x-blender', { title: 'audio/mpeg', key: 'audio/mpeg' },
'image/bpg', { title: 'audio/ogg', key: 'audio/ogg' },
'image/jp2', { title: 'audio/opus', key: 'audio/opus' },
'image/jpx', { title: 'audio/qcelp', key: 'audio/qcelp' },
'image/jpm', { title: 'audio/vnd.dolby.dd-raw', key: 'audio/vnd.dolby.dd-raw' },
'image/mj2', { title: 'audio/vnd.wave', key: 'audio/vnd.wave' },
'audio/aiff', { title: 'audio/wavpack', key: 'audio/wavpack' },
'application/xml', { title: 'audio/x-dsf', key: 'audio/x-dsf' },
'application/x-mobipocket-ebook', { title: 'audio/x-flac', key: 'audio/x-flac' },
'image/heif', { title: 'audio/x-it', key: 'audio/x-it' },
'image/heif-sequence', { title: 'audio/x-m4a', key: 'audio/x-m4a' },
'image/heic', { title: 'audio/x-ms-asf', key: 'audio/x-ms-asf' },
'image/heic-sequence', { title: 'audio/x-musepack', key: 'audio/x-musepack' },
'image/icns', { title: 'audio/x-s3m', key: 'audio/x-s3m' },
'image/ktx', { title: 'audio/x-voc', key: 'audio/x-voc' },
'application/dicom', { title: 'audio/x-xm', key: 'audio/x-xm' },
'audio/x-musepack', ],
'text/calendar', },
'text/vcard', {
'model/gltf-binary', title: 'Image',
'application/vnd.tcpdump.pcap', key: 'image',
'audio/x-dsf', // Non-standard children: [
'application/x.ms.shortcut', // Invented by us { title: 'image/apng', key: 'image/apng' },
'application/x.apple.alias', // Invented by us { title: 'image/avif', key: 'image/avif' },
'audio/x-voc', { title: 'image/bmp', key: 'image/bmp' },
'audio/vnd.dolby.dd-raw', { title: 'image/bpg', key: 'image/bpg' },
'audio/x-m4a', { title: 'image/flif', key: 'image/flif' },
'image/apng', { title: 'image/gif', key: 'image/gif' },
'image/x-olympus-orf', { title: 'image/heic', key: 'image/heic' },
'image/x-sony-arw', { title: 'image/heic-sequence', key: 'image/heic-sequence' },
'image/x-adobe-dng', { title: 'image/heif', key: 'image/heif' },
'image/x-nikon-nef', { title: 'image/heif-sequence', key: 'image/heif-sequence' },
'image/x-panasonic-rw2', { title: 'image/icns', key: 'image/icns' },
'image/x-fujifilm-raf', { title: 'image/jls', key: 'image/jls' },
'video/x-m4v', { title: 'image/jp2', key: 'image/jp2' },
'video/3gpp2', { title: 'image/jpeg', key: 'image/jpeg' },
'application/x-esri-shape', { title: 'image/jpm', key: 'image/jpm' },
'audio/aac', { title: 'image/jpx', key: 'image/jpx' },
'audio/x-it', { title: 'image/jxl', key: 'image/jxl' },
'audio/x-s3m', { title: 'image/ktx', key: 'image/ktx' },
'audio/x-xm', { title: 'image/mj2', key: 'image/mj2' },
'video/MP1S', { title: 'image/png', key: 'image/png' },
'video/MP2P', { title: 'image/tiff', key: 'image/tiff' },
'application/vnd.sketchup.skp', { title: 'image/vnd.adobe.photoshop', key: 'image/vnd.adobe.photoshop' },
'image/avif', { title: 'image/vnd.dwg', key: 'image/vnd.dwg' },
'application/x-lzh-compressed', { title: 'image/vnd.ms-photo', key: 'image/vnd.ms-photo' },
'application/pgp-encrypted', { title: 'image/webp', key: 'image/webp' },
'application/x-asar', { title: 'image/x-adobe-dng', key: 'image/x-adobe-dng' },
'model/stl', { title: 'image/x-canon-cr2', key: 'image/x-canon-cr2' },
'application/vnd.ms-htmlhelp', { title: 'image/x-canon-cr3', key: 'image/x-canon-cr3' },
'model/3mf', { title: 'image/x-fujifilm-raf', key: 'image/x-fujifilm-raf' },
'image/jxl', { title: 'image/x-icon', key: 'image/x-icon' },
'application/zstd', { title: 'image/x-nikon-nef', key: 'image/x-nikon-nef' },
'image/jls', { title: 'image/x-olympus-orf', key: 'image/x-olympus-orf' },
'application/vnd.ms-outlook', { title: 'image/x-panasonic-rw2', key: 'image/x-panasonic-rw2' },
'image/vnd.dwg', { title: 'image/x-sony-arw', key: 'image/x-sony-arw' },
{ title: 'image/x-xcf', key: 'image/x-xcf' },
],
},
{
title: 'Video',
key: 'video',
children: [
{ title: 'video/3gpp', key: 'video/3gpp' },
{ title: 'video/3gpp2', key: 'video/3gpp2' },
{ title: 'video/MP1S', key: 'video/MP1S' },
{ title: 'video/MP2P', key: 'video/MP2P' },
{ title: 'video/mp2t', key: 'video/mp2t' },
{ title: 'video/mp4', key: 'video/mp4' },
{ title: 'video/mpeg', key: 'video/mpeg' },
{ title: 'video/ogg', key: 'video/ogg' },
{ title: 'video/quicktime', key: 'video/quicktime' },
{ title: 'video/vnd.avi', key: 'video/vnd.avi' },
{ title: 'video/webm', key: 'video/webm' },
{ title: 'video/x-flv', key: 'video/x-flv' },
{ title: 'video/x-m4v', key: 'video/x-m4v' },
{ title: 'video/x-matroska', key: 'video/x-matroska' },
{ title: 'video/x-ms-asf', key: 'video/x-ms-asf' },
],
},
{
title: 'Misc',
key: 'misc',
children: [
{ title: 'model/3mf', key: 'model/3mf' },
{ title: 'model/gltf-binary', key: 'model/gltf-binary' },
{ title: 'model/stl', key: 'model/stl' },
{ title: 'text/calendar', key: 'text/calendar' },
{ title: 'text/vcard', key: 'text/vcard' },
{ title: 'font/otf', key: 'font/otf' },
{ title: 'font/ttf', key: 'font/ttf' },
{ title: 'font/woff', key: 'font/woff' },
{ title: 'font/woff2', key: 'font/woff2' },
],
},
] ]

Loading…
Cancel
Save