@webiny/app-admin 0.0.0-unstable.d7f521b032 → 0.0.0-unstable.ecd8734205

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 (35) hide show
  1. package/components/AppInstaller/AppInstaller.js +2 -34
  2. package/components/AppInstaller/AppInstaller.js.map +1 -1
  3. package/components/AppInstaller/Sidebar.js +2 -12
  4. package/components/AppInstaller/Sidebar.js.map +1 -1
  5. package/components/AppInstaller/useInstaller.d.ts +1 -7
  6. package/components/AppInstaller/useInstaller.js +16 -71
  7. package/components/AppInstaller/useInstaller.js.map +1 -1
  8. package/components/FileManager/File.d.ts +2 -2
  9. package/components/FileManager/File.js.map +1 -1
  10. package/components/FileManager/FileDetails/Aliases.d.ts +3 -0
  11. package/components/FileManager/FileDetails/Aliases.js +244 -0
  12. package/components/FileManager/FileDetails/Aliases.js.map +1 -0
  13. package/components/FileManager/FileDetails/FileProvider.d.ts +15 -0
  14. package/components/FileManager/FileDetails/FileProvider.js +30 -0
  15. package/components/FileManager/FileDetails/FileProvider.js.map +1 -0
  16. package/components/FileManager/FileDetails/Name.js +50 -57
  17. package/components/FileManager/FileDetails/Name.js.map +1 -1
  18. package/components/FileManager/FileDetails/Tags.js +86 -101
  19. package/components/FileManager/FileDetails/Tags.js.map +1 -1
  20. package/components/FileManager/FileDetails/useUpdateFile.d.ts +8 -0
  21. package/components/FileManager/FileDetails/useUpdateFile.js +56 -0
  22. package/components/FileManager/FileDetails/useUpdateFile.js.map +1 -0
  23. package/components/FileManager/FileDetails.d.ts +1 -1
  24. package/components/FileManager/FileDetails.js +11 -13
  25. package/components/FileManager/FileDetails.js.map +1 -1
  26. package/components/FileManager/FileManagerView.js.map +1 -1
  27. package/components/FileManager/graphql.js +3 -3
  28. package/components/FileManager/graphql.js.map +1 -1
  29. package/components/FileManager/types.d.ts +1 -0
  30. package/components/FileManager/types.js.map +1 -1
  31. package/package.json +16 -16
  32. package/plugins/FileManagerFileTypePlugin.d.ts +2 -15
  33. package/plugins/FileManagerFileTypePlugin.js.map +1 -1
  34. package/types.d.ts +2 -27
  35. package/types.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["t","i18n","ns","fileDetailsSidebar","css","width","style","wrapper","height","overflowY","header","textAlign","marginBottom","paddingTop","textTransform","color","fontWeight","preview","boxSizing","display","justifyContent","alignItems","position","margin","img","objectFit","maxHeight","maxWidth","transform","backgroundColor","download","list","li","padding","lineHeight","minHeight","marginRight","flex","whiteSpace","overflow","textOverflow","drawerContent","isImage","file","fileType","mime","getType","name","includes","FileDetails","props","uploadFile","validateFiles","filePlugin","getFileTypePlugin","actions","get","useFileManager","hideFileDetails","queryParams","useState","darkImageBackground","setDarkImageBackground","useSecurity","identity","getPermission","fmFilePermission","useMemo","canDelete","useCallback","item","own","identityId","id","login","rwd","useHotkeys","zIndex","disabled","keys","esc","useMutation","DELETE_FILE","update","cache","data","cloneDeep","readQuery","query","LIST_FILES","variables","fileManager","listFiles","error","meta","hasMoreItems","cursor","totalItem","filteredList","filter","selectedFile","find","writeQuery","set","Array","isArray","tags","tagCountMap","forEach","tag","listTagsData","LIST_TAGS","where","getWhere","scope","filteredTags","listTags","deleteFile","useSnackbar","showSnackbar","renderDeleteImageAction","fileDeleteConfirmationProps","title","message","showConfirmation","fileTypeIcon","type","Boolean","classNames","dark","render","navigator","clipboard","writeText","src","map","Component","index","bytes","format","size","unitSeparator","dayjs","createdOn"],"sources":["FileDetails.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from \"react\";\nimport bytes from \"bytes\";\nimport classNames from \"classnames\";\nimport { css } from \"emotion\";\nimport { Drawer, DrawerContent } from \"@webiny/ui/Drawer\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport getFileTypePlugin from \"./getFileTypePlugin\";\nimport dayjs from \"dayjs\";\nimport get from \"lodash/get\";\nimport set from \"lodash/set\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport Tags from \"./FileDetails/Tags\";\nimport Name from \"./FileDetails/Name\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { Icon } from \"@webiny/ui/Icon\";\nimport { Typography } from \"@webiny/ui/Typography\";\n/**\n * Package react-hotkeyz has no types.\n */\n// @ts-ignore\nimport { useHotkeys } from \"react-hotkeyz\";\nimport { ReactComponent as CopyContentIcon } from \"./icons/content_copy-black-24px.svg\";\nimport { ReactComponent as DeleteIcon } from \"./icons/delete.svg\";\nimport { ReactComponent as ImageIcon } from \"../../assets/icons/insert_photo-24px.svg\";\nimport { ReactComponent as FileIcon } from \"../../assets/icons/insert_drive_file-24px.svg\";\nimport { ReactComponent as CalendarIcon } from \"../../assets/icons/today-24px.svg\";\nimport { ReactComponent as HighlightIcon } from \"../../assets/icons/highlight-24px.svg\";\nimport { getWhere, useFileManager } from \"./FileManagerContext\";\nimport { useMutation } from \"@apollo/react-hooks\";\nimport { useSnackbar } from \"~/hooks/useSnackbar\";\nimport { useSecurity } from \"@webiny/app-security\";\nimport { ConfirmationDialog } from \"@webiny/ui/ConfirmationDialog\";\nimport {\n DELETE_FILE,\n DeleteFileMutationResponse,\n DeleteFileMutationVariables,\n LIST_FILES,\n LIST_TAGS,\n ListFilesQueryResponse,\n ListFileTagsQueryResponse\n} from \"./graphql\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport mime from \"mime\";\nimport { FileItem, FileManagerSecurityPermission } from \"./types\";\nimport { FilesRenderChildren } from \"react-butterfiles\";\n\nconst t = i18n.ns(\"app-admin/file-manager/file-details\");\n\nconst fileDetailsSidebar = css({\n \"&.mdc-drawer\": {\n width: 360\n }\n});\n\ndeclare global {\n // eslint-disable-next-line\n namespace JSX {\n interface IntrinsicElements {\n \"li-title\": {\n children?: React.ReactNode;\n };\n\n \"li-content\": {\n children?: React.ReactNode;\n };\n }\n }\n}\n\nconst style: any = {\n wrapper: css({\n height: \"100vh\",\n overflowY: \"auto\"\n }),\n header: css({\n textAlign: \"center\",\n marginBottom: 24,\n paddingTop: 16,\n \"& span\": {\n textTransform: \"capitalize\",\n color: \"var(--mdc-theme-on-surface)\",\n fontWeight: 600\n }\n }),\n preview: css({\n boxSizing: \"border-box\",\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n position: \"relative\",\n width: \"100%\",\n height: 300,\n margin: \"0 auto 24px\",\n img: {\n objectFit: \"contain\",\n maxHeight: 300,\n maxWidth: 300,\n width: \"100%\",\n position: \"static\",\n transform: \"none\"\n },\n \"&.dark\": {\n backgroundColor: \"var(--mdc-theme-background)\"\n }\n }),\n download: css({\n textAlign: \"center\",\n margin: \"0 auto\",\n width: \"100%\",\n \"& .icon--active\": {\n \"&.mdc-icon-button\": {\n color: \"var(--mdc-theme-text-on-primary)\"\n }\n }\n }),\n list: css({\n textAlign: \"left\",\n color: \"var(--mdc-theme-on-surface)\",\n li: {\n padding: \"12px 16px\",\n lineHeight: \"22px\",\n \"li-title\": {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n minHeight: 48,\n \"& .list-item__title\": {\n fontWeight: 600\n },\n \"& .list-item__icon\": {\n marginRight: 24\n },\n \"& .list-item__content\": {\n flex: \"1 0 200px\"\n }\n },\n \"li-content\": {\n width: \"100%\",\n display: \"block\",\n \"& .list-item__truncate\": {\n display: \"block\",\n width: \"100%\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\"\n }\n }\n }\n }),\n drawerContent: css({\n \"&.mdc-drawer__content\": {\n height: \"auto\",\n overflowY: \"inherit\"\n }\n })\n};\ninterface FileDetailsProps {\n canEdit: (item: any) => boolean;\n file: FileItem;\n uploadFile: (files: FileItem[] | FileItem) => Promise<number | null>;\n validateFiles: FilesRenderChildren[\"validateFiles\"];\n [key: string]: any;\n}\n\nconst isImage = (file: FileItem) => {\n const fileType = mime.getType(file && file.name);\n\n if (fileType && typeof fileType === \"string\") {\n return fileType.includes(\"image\");\n }\n\n return false;\n};\n\nconst FileDetails: React.FC<FileDetailsProps> = props => {\n const { file, uploadFile, validateFiles } = props;\n\n const filePlugin = getFileTypePlugin(file);\n const actions: React.FC[] =\n get(filePlugin, \"fileDetails.actions\") || get(filePlugin, \"actions\") || [];\n\n const { hideFileDetails, queryParams } = useFileManager();\n const [darkImageBackground, setDarkImageBackground] = useState(false);\n\n const { identity, getPermission } = useSecurity();\n const fmFilePermission = useMemo((): FileManagerSecurityPermission | null => {\n return getPermission(\"fm.file\");\n }, [identity]);\n const canDelete = useCallback(\n item => {\n // Bail out early if no access\n if (!fmFilePermission) {\n return false;\n }\n if (fmFilePermission.own) {\n const identityId = identity ? identity.id || identity.login : null;\n if (!identityId) {\n return false;\n }\n return get(item, \"createdBy.id\") === identityId;\n }\n if (typeof fmFilePermission.rwd === \"string\") {\n return fmFilePermission.rwd.includes(\"d\");\n }\n return true;\n },\n [fmFilePermission]\n );\n\n useHotkeys({\n zIndex: 55,\n disabled: !file,\n keys: {\n esc: hideFileDetails\n }\n });\n\n const [deleteFile] = useMutation<DeleteFileMutationResponse, DeleteFileMutationVariables>(\n DELETE_FILE,\n {\n update: cache => {\n // 1. Update files list cache\n let data = cloneDeep(\n cache.readQuery<ListFilesQueryResponse>({\n query: LIST_FILES,\n variables: queryParams\n })\n );\n if (!data) {\n data = {\n fileManager: {\n listFiles: {\n data: [],\n error: null,\n meta: {\n hasMoreItems: false,\n cursor: null,\n totalItem: 0\n }\n }\n }\n };\n }\n const filteredList = data.fileManager.listFiles.data.filter(\n (item: FileItem) => item.id !== file.id\n );\n const selectedFile = data.fileManager.listFiles.data.find(\n (item: FileItem) => item.id === file.id\n );\n\n cache.writeQuery({\n query: LIST_FILES,\n variables: queryParams,\n data: set(data, \"fileManager.listFiles.data\", filteredList)\n });\n // 2. Update \"ListTags\" cache\n if (!selectedFile || Array.isArray(selectedFile.tags) === false) {\n return;\n }\n const tagCountMap: Record<string, number> = {};\n // Prepare \"tag\" count map\n data.fileManager.listFiles.data.forEach((file: FileItem) => {\n if (!Array.isArray(file.tags)) {\n return;\n }\n file.tags.forEach(tag => {\n if (tagCountMap[tag]) {\n tagCountMap[tag] += 1;\n } else {\n tagCountMap[tag] = 1;\n }\n });\n });\n\n // Get tags from cache\n const listTagsData = cloneDeep(\n cache.readQuery<ListFileTagsQueryResponse>({\n query: LIST_TAGS,\n variables: { where: getWhere(queryParams.scope) }\n })\n );\n // Remove selected file tags from list.\n const filteredTags = (listTagsData?.fileManager?.listTags || []).filter(\n (tag: string) => {\n if (!selectedFile.tags.includes(tag)) {\n return true;\n }\n return tagCountMap[tag] > 1;\n }\n );\n\n // Write it to cache\n cache.writeQuery({\n query: LIST_TAGS,\n variables: { where: getWhere(queryParams.scope) },\n data: set(data, \"fileManager.listTags\", filteredTags)\n });\n }\n }\n );\n const { showSnackbar } = useSnackbar();\n\n const renderDeleteImageAction = useCallback(file => {\n if (!canDelete(file)) {\n return null;\n }\n const fileDeleteConfirmationProps = {\n title: t`Delete file`,\n message: file && (\n <span>\n {t`You're about to delete file {name}. Are you sure you want to continue?`({\n name: file.name\n })}\n </span>\n )\n };\n return (\n <ConfirmationDialog\n {...fileDeleteConfirmationProps}\n data-testid={\"fm-delete-file-confirmation-dialog\"}\n style={{ zIndex: 100 }}\n >\n {({ showConfirmation }) => {\n return (\n <Tooltip\n content={\n isImage(file) ? (\n <span>{t`Delete image`}</span>\n ) : (\n <span>{t`Delete file`}</span>\n )\n }\n placement={\"bottom\"}\n >\n <IconButton\n data-testid={\"fm-delete-file-button\"}\n icon={<DeleteIcon style={{ margin: \"0 8px 0 0\" }} />}\n onClick={() =>\n showConfirmation(async () => {\n await deleteFile({\n variables: {\n id: file.id\n }\n });\n showSnackbar(t`File deleted successfully.`);\n })\n }\n />\n </Tooltip>\n );\n }}\n </ConfirmationDialog>\n );\n }, []);\n\n const fileTypeIcon = useMemo(() => {\n if (file && typeof file.type === \"string\") {\n return file.type.includes(\"image\") ? <ImageIcon /> : <FileIcon />;\n }\n return <ImageIcon />;\n }, [file]);\n\n return (\n <Drawer\n className={fileDetailsSidebar}\n dir=\"rtl\"\n modal\n open={Boolean(file)}\n onClose={hideFileDetails}\n data-testid={\"fm.file-details.drawer\"}\n >\n {file && (\n <div className={style.wrapper} dir=\"ltr\">\n <div className={style.header}>\n <Typography use={\"headline5\"}>{t`File details`}</Typography>\n </div>\n <div\n className={classNames(style.preview, {\n dark: darkImageBackground\n })}\n >\n {filePlugin &&\n filePlugin.render({\n /**\n * TODO: @ts-refactor\n * Figure out which type is the file\n */\n // @ts-ignore\n file,\n uploadFile,\n validateFiles\n })}\n </div>\n <div className={style.download}>\n <>\n <Tooltip content={<span>{t`Copy URL`}</span>} placement={\"bottom\"}>\n <IconButton\n onClick={() => {\n navigator.clipboard.writeText(file.src);\n showSnackbar(t`URL copied successfully.`);\n }}\n icon={<CopyContentIcon style={{ margin: \"0 8px 0 0\" }} />}\n />\n </Tooltip>\n\n {actions.map((Component: React.FC, index: number) => (\n <Component key={index} {...props} />\n ))}\n {renderDeleteImageAction(file)}\n {/* Render background switcher */}\n <Tooltip content={t`Toggle background`} placement={\"bottom\"}>\n <IconButton\n icon={<HighlightIcon />}\n onClick={() => setDarkImageBackground(!darkImageBackground)}\n className={classNames({ \"icon--active\": darkImageBackground })}\n />\n </Tooltip>\n </>\n </div>\n <DrawerContent dir=\"ltr\" className={style.drawerContent}>\n <ul className={style.list}>\n <li>\n <Name {...props} />\n </li>\n <li>\n <li-title>\n <Icon className={\"list-item__icon\"} icon={fileTypeIcon} />\n <div>\n <Typography use={\"subtitle1\"}>{file.type}</Typography>{\" \"}\n {\" - \"}\n <Typography use={\"subtitle1\"}>\n {bytes.format(file.size, { unitSeparator: \" \" })}\n </Typography>\n </div>\n </li-title>\n </li>\n <li>\n <li-title>\n <Icon className={\"list-item__icon\"} icon={<CalendarIcon />} />\n <div>\n <Typography use={\"subtitle1\"}>\n {dayjs(file.createdOn).format(\"DD MMM YYYY [at] HH:mm\")}\n </Typography>\n </div>\n </li-title>\n </li>\n <li>\n <Tags key={props.file.id} {...props} />\n </li>\n </ul>\n </DrawerContent>\n </div>\n )}\n </Drawer>\n );\n};\n\nexport default FileDetails;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AAAwB;AAIxB,IAAMA,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,qCAAqC,CAAC;AAExD,IAAMC,kBAAkB,gBAAG,IAAAC,YAAG,EAAC;EAC3B,cAAc,EAAE;IACZC,KAAK,EAAE;EACX;AACJ,CAAC,8BAAC;AAiBF,IAAMC,KAAU,GAAG;EACfC,OAAO,eAAE,IAAAH,YAAG,EAAC;IACTI,MAAM,EAAE,OAAO;IACfC,SAAS,EAAE;EACf,CAAC,mBAAC;EACFC,MAAM,eAAE,IAAAN,YAAG,EAAC;IACRO,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,UAAU,EAAE,EAAE;IACd,QAAQ,EAAE;MACNC,aAAa,EAAE,YAAY;MAC3BC,KAAK,EAAE,6BAA6B;MACpCC,UAAU,EAAE;IAChB;EACJ,CAAC,kBAAC;EACFC,OAAO,eAAE,IAAAb,YAAG,EAAC;IACTc,SAAS,EAAE,YAAY;IACvBC,OAAO,EAAE,MAAM;IACfC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,QAAQ,EAAE,UAAU;IACpBjB,KAAK,EAAE,MAAM;IACbG,MAAM,EAAE,GAAG;IACXe,MAAM,EAAE,aAAa;IACrBC,GAAG,EAAE;MACDC,SAAS,EAAE,SAAS;MACpBC,SAAS,EAAE,GAAG;MACdC,QAAQ,EAAE,GAAG;MACbtB,KAAK,EAAE,MAAM;MACbiB,QAAQ,EAAE,QAAQ;MAClBM,SAAS,EAAE;IACf,CAAC;IACD,QAAQ,EAAE;MACNC,eAAe,EAAE;IACrB;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sDACI,4DACI,6BAAC,UAAI;IAAC,SAAS,EAAE,iBAAkB;IAAC,IAAI,EAAE2E;EAAa,EAAG,eAC1D,uDACI,6BAAC,sBAAU;IAAC,GAAG,EAAE;EAAY,GAAElF,IAAI,CAACmF,IAAI,CAAc,EAAC,GAAG,EACzD,KAAK,eACN,6BAAC,sBAAU;IAAC,GAAG,EAAE;EAAY,GACxBY,cAAK,CAACC,MAAM,CAAChG,IAAI,CAACiG,IAAI,EAAE;IAAEC,aAAa,EAAE;EAAI,CAAC,CAAC,CACvC,CACX,CACC,CACV,eACL,sDACI,4DACI,6BAAC,UAAI;IAAC,SAAS,EAAE,iBAAkB;IAAC,IAAI,eAAE,6BAAC,yBAAY;EAAI,EAAG,eAC9D,uDACI,6BAAC,sBAAU;IAAC,GAAG,EAAE;EAAY,GACxB,IAAAC,cAAK,EAACnG,IAAI,CAACoG,SAAS,CAAC,CAACJ,MAAM,CAAC,wBAAwB,CAAC,CAC9C,CACX,CACC,CACV,eACL,sDACI,6BAAC,aAAI;IAAC,GAAG,EAAEzF,KAAK,CAACP,IAAI,CAAC8B;EAAG,GAAKvB,KAAK,EAAI,CACtC,CACJ,CACO,CAEvB,CACI;AAEjB,CAAC;AAAC,eAEaD,WAAW;AAAA"}
1
+ {"version":3,"names":["t","i18n","ns","fileDetailsSidebar","css","width","style","wrapper","height","overflowY","header","textAlign","marginBottom","paddingTop","textTransform","color","fontWeight","preview","boxSizing","display","justifyContent","alignItems","position","margin","img","objectFit","maxHeight","maxWidth","transform","backgroundColor","download","list","li","padding","lineHeight","minHeight","marginRight","flex","whiteSpace","overflow","textOverflow","drawerContent","isImage","file","fileType","mime","getType","name","includes","FileDetails","props","filePlugin","getFileTypePlugin","actions","get","useFileManager","hideFileDetails","queryParams","useState","darkImageBackground","setDarkImageBackground","useSecurity","identity","getPermission","fmFilePermission","useMemo","canDelete","useCallback","item","own","identityId","id","login","rwd","useHotkeys","zIndex","disabled","keys","esc","useMutation","DELETE_FILE","update","cache","data","cloneDeep","readQuery","query","LIST_FILES","variables","fileManager","listFiles","error","meta","hasMoreItems","cursor","totalItem","filteredList","filter","selectedFile","find","writeQuery","set","Array","isArray","tags","tagCountMap","forEach","tag","listTagsData","LIST_TAGS","where","getWhere","scope","filteredTags","listTags","deleteFile","useSnackbar","showSnackbar","renderDeleteImageAction","fileDeleteConfirmationProps","title","message","showConfirmation","fileTypeIcon","type","Boolean","canEdit","classNames","dark","render","navigator","clipboard","writeText","src","map","Component","index","bytes","format","size","unitSeparator","dayjs","createdOn"],"sources":["FileDetails.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from \"react\";\nimport bytes from \"bytes\";\nimport classNames from \"classnames\";\nimport { css } from \"emotion\";\nimport { Drawer, DrawerContent } from \"@webiny/ui/Drawer\";\nimport { IconButton } from \"@webiny/ui/Button\";\nimport getFileTypePlugin from \"./getFileTypePlugin\";\nimport dayjs from \"dayjs\";\nimport get from \"lodash/get\";\nimport set from \"lodash/set\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport Tags from \"./FileDetails/Tags\";\nimport Name from \"./FileDetails/Name\";\nimport { Aliases } from \"./FileDetails/Aliases\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { Icon } from \"@webiny/ui/Icon\";\nimport { Typography } from \"@webiny/ui/Typography\";\n/**\n * Package react-hotkeyz has no types.\n */\n// @ts-ignore\nimport { useHotkeys } from \"react-hotkeyz\";\nimport { ReactComponent as CopyContentIcon } from \"./icons/content_copy-black-24px.svg\";\nimport { ReactComponent as DeleteIcon } from \"./icons/delete.svg\";\nimport { ReactComponent as ImageIcon } from \"../../assets/icons/insert_photo-24px.svg\";\nimport { ReactComponent as FileIcon } from \"../../assets/icons/insert_drive_file-24px.svg\";\nimport { ReactComponent as CalendarIcon } from \"../../assets/icons/today-24px.svg\";\nimport { ReactComponent as HighlightIcon } from \"../../assets/icons/highlight-24px.svg\";\nimport { getWhere, useFileManager } from \"./FileManagerContext\";\nimport { useMutation } from \"@apollo/react-hooks\";\nimport { useSnackbar } from \"~/hooks/useSnackbar\";\nimport { useSecurity } from \"@webiny/app-security\";\nimport { ConfirmationDialog } from \"@webiny/ui/ConfirmationDialog\";\nimport {\n DELETE_FILE,\n DeleteFileMutationResponse,\n DeleteFileMutationVariables,\n LIST_FILES,\n LIST_TAGS,\n ListFilesQueryResponse,\n ListFileTagsQueryResponse\n} from \"./graphql\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport mime from \"mime\";\nimport { FileItem, FileManagerSecurityPermission } from \"./types\";\nimport { FilesRenderChildren } from \"react-butterfiles\";\nimport { FileProvider } from \"./FileDetails/FileProvider\";\n\nconst t = i18n.ns(\"app-admin/file-manager/file-details\");\n\nconst fileDetailsSidebar = css({\n \"&.mdc-drawer\": {\n width: 360\n }\n});\n\ndeclare global {\n // eslint-disable-next-line\n namespace JSX {\n interface IntrinsicElements {\n \"li-title\": {\n children?: React.ReactNode;\n };\n\n \"li-content\": {\n children?: React.ReactNode;\n };\n }\n }\n}\n\nconst style: any = {\n wrapper: css({\n height: \"100vh\",\n overflowY: \"auto\"\n }),\n header: css({\n textAlign: \"center\",\n marginBottom: 24,\n paddingTop: 16,\n \"& span\": {\n textTransform: \"capitalize\",\n color: \"var(--mdc-theme-on-surface)\",\n fontWeight: 600\n }\n }),\n preview: css({\n boxSizing: \"border-box\",\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n position: \"relative\",\n width: \"100%\",\n height: 300,\n margin: \"0 auto 24px\",\n img: {\n objectFit: \"contain\",\n maxHeight: 300,\n maxWidth: 300,\n width: \"100%\",\n position: \"static\",\n transform: \"none\"\n },\n \"&.dark\": {\n backgroundColor: \"var(--mdc-theme-background)\"\n }\n }),\n download: css({\n textAlign: \"center\",\n margin: \"0 auto\",\n width: \"100%\",\n \"& .icon--active\": {\n \"&.mdc-icon-button\": {\n color: \"var(--mdc-theme-text-on-primary)\"\n }\n }\n }),\n list: css({\n textAlign: \"left\",\n color: \"var(--mdc-theme-on-surface)\",\n li: {\n padding: \"12px 16px\",\n lineHeight: \"22px\",\n \"li-title\": {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n minHeight: 48,\n \"& .list-item__title\": {\n fontWeight: 600\n },\n \"& .list-item__icon\": {\n marginRight: 24\n },\n \"& .list-item__content\": {\n flex: \"1 0 200px\"\n }\n },\n \"li-content\": {\n width: \"100%\",\n display: \"block\",\n \"& .list-item__truncate\": {\n display: \"block\",\n width: \"100%\",\n whiteSpace: \"nowrap\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\"\n }\n }\n }\n }),\n drawerContent: css({\n \"&.mdc-drawer__content\": {\n height: \"auto\",\n overflowY: \"inherit\"\n }\n })\n};\nexport interface FileDetailsProps {\n canEdit: (item: any) => boolean;\n file: FileItem;\n uploadFile: (files: FileItem[] | FileItem) => Promise<number | null>;\n validateFiles: FilesRenderChildren[\"validateFiles\"];\n [key: string]: any;\n}\n\nconst isImage = (file: FileItem) => {\n const fileType = mime.getType(file && file.name);\n\n if (fileType && typeof fileType === \"string\") {\n return fileType.includes(\"image\");\n }\n\n return false;\n};\n\nconst FileDetails: React.FC<FileDetailsProps> = props => {\n const { file } = props;\n\n const filePlugin = getFileTypePlugin(file);\n const actions: React.FC[] =\n get(filePlugin, \"fileDetails.actions\") || get(filePlugin, \"actions\") || [];\n\n const { hideFileDetails, queryParams } = useFileManager();\n const [darkImageBackground, setDarkImageBackground] = useState(false);\n\n const { identity, getPermission } = useSecurity();\n const fmFilePermission = useMemo((): FileManagerSecurityPermission | null => {\n return getPermission(\"fm.file\");\n }, [identity]);\n const canDelete = useCallback(\n item => {\n // Bail out early if no access\n if (!fmFilePermission) {\n return false;\n }\n if (fmFilePermission.own) {\n const identityId = identity ? identity.id || identity.login : null;\n if (!identityId) {\n return false;\n }\n return get(item, \"createdBy.id\") === identityId;\n }\n if (typeof fmFilePermission.rwd === \"string\") {\n return fmFilePermission.rwd.includes(\"d\");\n }\n return true;\n },\n [fmFilePermission]\n );\n\n useHotkeys({\n zIndex: 55,\n disabled: !file,\n keys: {\n esc: hideFileDetails\n }\n });\n\n const [deleteFile] = useMutation<DeleteFileMutationResponse, DeleteFileMutationVariables>(\n DELETE_FILE,\n {\n update: cache => {\n // 1. Update files list cache\n let data = cloneDeep(\n cache.readQuery<ListFilesQueryResponse>({\n query: LIST_FILES,\n variables: queryParams\n })\n );\n if (!data) {\n data = {\n fileManager: {\n listFiles: {\n data: [],\n error: null,\n meta: {\n hasMoreItems: false,\n cursor: null,\n totalItem: 0\n }\n }\n }\n };\n }\n const filteredList = data.fileManager.listFiles.data.filter(\n (item: FileItem) => item.id !== file.id\n );\n const selectedFile = data.fileManager.listFiles.data.find(\n (item: FileItem) => item.id === file.id\n );\n\n cache.writeQuery({\n query: LIST_FILES,\n variables: queryParams,\n data: set(data, \"fileManager.listFiles.data\", filteredList)\n });\n // 2. Update \"ListTags\" cache\n if (!selectedFile || Array.isArray(selectedFile.tags) === false) {\n return;\n }\n const tagCountMap: Record<string, number> = {};\n // Prepare \"tag\" count map\n data.fileManager.listFiles.data.forEach((file: FileItem) => {\n if (!Array.isArray(file.tags)) {\n return;\n }\n file.tags.forEach(tag => {\n if (tagCountMap[tag]) {\n tagCountMap[tag] += 1;\n } else {\n tagCountMap[tag] = 1;\n }\n });\n });\n\n // Get tags from cache\n const listTagsData = cloneDeep(\n cache.readQuery<ListFileTagsQueryResponse>({\n query: LIST_TAGS,\n variables: { where: getWhere(queryParams.scope) }\n })\n );\n // Remove selected file tags from list.\n const filteredTags = (listTagsData?.fileManager?.listTags || []).filter(\n (tag: string) => {\n if (!selectedFile.tags.includes(tag)) {\n return true;\n }\n return tagCountMap[tag] > 1;\n }\n );\n\n // Write it to cache\n cache.writeQuery({\n query: LIST_TAGS,\n variables: { where: getWhere(queryParams.scope) },\n data: set(data, \"fileManager.listTags\", filteredTags)\n });\n }\n }\n );\n const { showSnackbar } = useSnackbar();\n\n const renderDeleteImageAction = useCallback(file => {\n if (!canDelete(file)) {\n return null;\n }\n const fileDeleteConfirmationProps = {\n title: t`Delete file`,\n message: file && (\n <span>\n {t`You're about to delete file {name}. Are you sure you want to continue?`({\n name: file.name\n })}\n </span>\n )\n };\n return (\n <ConfirmationDialog\n {...fileDeleteConfirmationProps}\n data-testid={\"fm-delete-file-confirmation-dialog\"}\n style={{ zIndex: 100 }}\n >\n {({ showConfirmation }) => {\n return (\n <Tooltip\n content={\n isImage(file) ? (\n <span>{t`Delete image`}</span>\n ) : (\n <span>{t`Delete file`}</span>\n )\n }\n placement={\"bottom\"}\n >\n <IconButton\n data-testid={\"fm-delete-file-button\"}\n icon={<DeleteIcon style={{ margin: \"0 8px 0 0\" }} />}\n onClick={() =>\n showConfirmation(async () => {\n await deleteFile({\n variables: {\n id: file.id\n }\n });\n showSnackbar(t`File deleted successfully.`);\n })\n }\n />\n </Tooltip>\n );\n }}\n </ConfirmationDialog>\n );\n }, []);\n\n const fileTypeIcon = useMemo(() => {\n if (file && typeof file.type === \"string\") {\n return file.type.includes(\"image\") ? <ImageIcon /> : <FileIcon />;\n }\n return <ImageIcon />;\n }, [file]);\n\n return (\n <Drawer\n className={fileDetailsSidebar}\n dir=\"rtl\"\n modal\n open={Boolean(file)}\n onClose={hideFileDetails}\n data-testid={\"fm.file-details.drawer\"}\n >\n {file && (\n <FileProvider file={file} canEdit={props.canEdit}>\n <div className={style.wrapper} dir=\"ltr\">\n <div className={style.header}>\n <Typography use={\"headline5\"}>{t`File details`}</Typography>\n </div>\n <div\n className={classNames(style.preview, {\n dark: darkImageBackground\n })}\n >\n {filePlugin && filePlugin.render({ file })}\n </div>\n <div className={style.download}>\n <>\n <Tooltip content={<span>{t`Copy URL`}</span>} placement={\"bottom\"}>\n <IconButton\n onClick={() => {\n navigator.clipboard.writeText(file.src);\n showSnackbar(t`URL copied successfully.`);\n }}\n icon={<CopyContentIcon style={{ margin: \"0 8px 0 0\" }} />}\n />\n </Tooltip>\n\n {actions.map((Component: React.FC, index: number) => (\n <Component key={index} {...props} />\n ))}\n {renderDeleteImageAction(file)}\n {/* Render background switcher */}\n <Tooltip content={t`Toggle background`} placement={\"bottom\"}>\n <IconButton\n icon={<HighlightIcon />}\n onClick={() => setDarkImageBackground(!darkImageBackground)}\n className={classNames({\n \"icon--active\": darkImageBackground\n })}\n />\n </Tooltip>\n </>\n </div>\n <DrawerContent dir=\"ltr\" className={style.drawerContent}>\n <ul className={style.list}>\n <li>\n <Name {...props} />\n </li>\n <li>\n <li-title>\n <Icon className={\"list-item__icon\"} icon={fileTypeIcon} />\n <div>\n <Typography use={\"subtitle1\"}>{file.type}</Typography>{\" \"}\n {\" - \"}\n <Typography use={\"subtitle1\"}>\n {bytes.format(file.size, { unitSeparator: \" \" })}\n </Typography>\n </div>\n </li-title>\n </li>\n <li>\n <li-title>\n <Icon\n className={\"list-item__icon\"}\n icon={<CalendarIcon />}\n />\n <div>\n <Typography use={\"subtitle1\"}>\n {dayjs(file.createdOn).format(\n \"DD MMM YYYY [at] HH:mm\"\n )}\n </Typography>\n </div>\n </li-title>\n </li>\n <li>\n <Tags key={props.file.id} {...props} />\n </li>\n <li>\n <Aliases key={props.file.id} {...props} />\n </li>\n </ul>\n </DrawerContent>\n </div>\n </FileProvider>\n )}\n </Drawer>\n );\n};\n\nexport default FileDetails;\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AAGA;AAA0D;AAE1D,IAAMA,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,qCAAqC,CAAC;AAExD,IAAMC,kBAAkB,gBAAG,IAAAC,YAAG,EAAC;EAC3B,cAAc,EAAE;IACZC,KAAK,EAAE;EACX;AACJ,CAAC,8BAAC;AAiBF,IAAMC,KAAU,GAAG;EACfC,OAAO,eAAE,IAAAH,YAAG,EAAC;IACTI,M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AAwB,CAC3B,CACQ,CACX,CACC,CACV,eACL,sDACI,6BAAC,aAAI;IAAC,GAAG,EAAExF,KAAK,CAACP,IAAI,CAAC4B;EAAG,GAAKrB,KAAK,EAAI,CACtC,eACL,sDACI,6BAAC,gBAAO;IAAC,GAAG,EAAEA,KAAK,CAACP,IAAI,CAAC4B;EAAG,GAAKrB,KAAK,EAAI,CACzC,CACJ,CACO,CACd,CAEb,CACI;AAEjB,CAAC;AAAC,eAEaD,WAAW;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["t","i18n","ns","style","draggingFeedback","css","position","top","left","width","height","opacity","background","zIndex","leftDrawer","header","textAlign","fontSize","padding","fontWeight","color","InputSearch","styled","backgroundColor","borderRadius","border","marginLeft","outline","searchIcon","FileListWrapper","float","display","FileList","gridTemplateColumns","marginBottom","renderFile","props","file","plugin","getFileTypePlugin","id","render","renderEmpty","hasPreviouslyUploadedFiles","browseFiles","fmFilePermission","FileManagerView","onClose","onChange","accept","multiple","maxSize","multipleMaxCount","multipleMaxSize","onUploadCompletion","useFileManager","selected","toggleSelected","dragging","setDragging","uploading","setUploading","showFileDetails","showingFileDetails","queryParams","setQueryParams","setHasPreviouslyUploadedFiles","useSnackbar","showSnackbar","useSecurity","identity","getPermission","useMemo","canCreate","own","rwd","includes","canEdit","useCallback","item","creatorId","get","identityId","login","searchOnChange","debounce","search","toggleTag","tag","finalTags","Array","isArray","tags","splice","indexOf","push","getFileUploadErrorMessage","e","match","message","updateCacheAfterCreateFile","cache","newFile","newFileData","data","readQuery","query","LIST_FILES","variables","writeQuery","fileManager","listFiles","getFileDetailsFile","src","list","find","useHotkeys","keys","esc","searchInput","useRef","apolloClient","useApolloClient","gqlQuery","useQuery","onCompleted","response","length","refreshOnScroll","scrollFrame","fetchMore","cursor","after","updateQuery","prev","result","fetchMoreResult","next","loading","useMutation","CREATE_FILE","update","createFile","uploadFile","files","errors","uploadedFiles","Promise","all","map","getFileUploader","scope","createFileResponse","setTimeout","name","renderUploadFileAction","settingsQuery","GET_FILE_SETTINGS","settings","uploadMaxFileSize","filter","Boolean","console","log","outputFileSelectionError","getDropZoneProps","validateFiles","onDragEnter","onExited","target","value","current","onSelect","defaultProps"],"sources":["FileManagerView.tsx"],"sourcesContent":["import React, { useRef, useCallback, useMemo } from \"react\";\nimport { css } from \"emotion\";\nimport styled from \"@emotion/styled\";\nimport Files, { FilesRenderChildren } from \"react-butterfiles\";\nimport { ButtonPrimary, ButtonIcon } from \"@webiny/ui/Button\";\nimport { Icon } from \"@webiny/ui/Icon\";\nimport File, { FileProps } from \"./File\";\nimport { useQuery, useMutation, useApolloClient } from \"@apollo/react-hooks\";\nimport { FilesRules } from \"react-butterfiles\";\nimport {\n LIST_FILES,\n CREATE_FILE,\n GET_FILE_SETTINGS,\n CreateFileMutationVariables,\n CreateFileMutationResponse,\n ListFilesQueryResponse,\n ListFilesQueryVariables\n} from \"./graphql\";\nimport getFileTypePlugin from \"./getFileTypePlugin\";\nimport get from \"lodash/get\";\nimport debounce from \"lodash/debounce\";\nimport getFileUploader from \"./getFileUploader\";\nimport { outputFileSelectionError } from \"./outputFileSelectionError\";\nimport DropFilesHere from \"./DropFilesHere\";\nimport NoResults from \"./NoResults\";\nimport FileDetails from \"./FileDetails\";\nimport LeftSidebar from \"./LeftSidebar\";\nimport BottomInfoBar from \"./BottomInfoBar\";\nimport { OverlayLayout } from \"../OverlayLayout\";\nimport { useSnackbar } from \"~/hooks/useSnackbar\";\nimport { Scrollbar } from \"@webiny/ui/Scrollbar\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { useSecurity } from \"@webiny/app-security\";\n/**\n * Package react-hotkeyz is missing types.\n */\n// @ts-ignore\nimport { useHotkeys } from \"react-hotkeyz\";\nimport { useFileManager } from \"./FileManagerContext\";\nimport { ReactComponent as SearchIcon } from \"./icons/round-search-24px.svg\";\nimport { ReactComponent as UploadIcon } from \"./icons/round-cloud_upload-24px.svg\";\nimport NoPermissionView from \"./NoPermissionView\";\nimport { FileItem, FileManagerSecurityPermission } from \"~/components/FileManager/types\";\nimport { MutationUpdaterFn } from \"apollo-client/core/watchQueryOptions\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\nimport { ObservableQueryFields } from \"@apollo/react-common/lib/types/types\";\n\nconst t = i18n.ns(\"app-admin/file-manager/file-manager-view\");\n\nconst style = {\n draggingFeedback: css({\n position: \"fixed\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n opacity: 0.5,\n background: \"white\",\n zIndex: 100\n }),\n leftDrawer: {\n header: css({\n textAlign: \"center\",\n fontSize: 18,\n padding: 10,\n fontWeight: 600,\n color: \"var(--mdc-theme-on-surface)\"\n })\n }\n};\n\nconst InputSearch = styled(\"div\")({\n backgroundColor: \"var(--mdc-theme-on-background)\",\n position: \"relative\",\n height: 32,\n padding: 3,\n width: \"100%\",\n borderRadius: 2,\n \"> input\": {\n border: \"none\",\n fontSize: 14,\n width: \"calc(100% - 10px)\",\n height: \"100%\",\n marginLeft: 50,\n backgroundColor: \"transparent\",\n outline: \"none\",\n color: \"var(--mdc-theme-text-primary-on-background)\"\n }\n});\n\nconst searchIcon = css({\n \"&.mdc-button__icon\": {\n color: \"var(--mdc-theme-text-secondary-on-background)\",\n position: \"absolute\",\n width: 24,\n height: 24,\n left: 15,\n top: 7\n }\n});\n\nconst FileListWrapper = styled(\"div\")({\n float: \"right\",\n display: \"inline-block\",\n width: \"calc(100vw - 270px)\",\n height: \"100%\"\n});\n\nconst FileList = styled(\"div\")({\n width: \"100%\",\n display: \"grid\",\n /* define the number of grid columns */\n gridTemplateColumns: \"repeat( auto-fill, minmax(220px, 1fr) )\",\n marginBottom: 95\n});\n\nexport interface FileManagerViewProps {\n onChange?: Function;\n onClose?: Function;\n files?: FilesRules;\n multiple?: boolean; // Does not affect <Files> component, it always allows multiple selection.\n accept: Array<string>;\n maxSize?: number | string;\n multipleMaxCount?: number;\n multipleMaxSize?: number | string;\n onUploadCompletion?: Function;\n tags?: string[];\n scope?: string;\n own?: boolean;\n}\n\ninterface RenderFileProps extends Omit<FileProps, \"children\"> {\n file: FileItem;\n children?: React.ReactNode;\n}\nconst renderFile: React.FC<RenderFileProps> = props => {\n const { file } = props;\n const plugin = getFileTypePlugin(file);\n if (!plugin) {\n return null;\n }\n return (\n <File {...props} key={file.id}>\n {plugin.render({\n /**\n * TODO @ts-refactor\n */\n // @ts-ignore\n file\n })}\n </File>\n );\n};\ninterface RenderEmptyProps {\n hasPreviouslyUploadedFiles: boolean;\n browseFiles: FilesRenderChildren[\"browseFiles\"];\n fmFilePermission: SecurityPermission | null;\n}\nconst renderEmpty: React.FC<RenderEmptyProps> = ({\n hasPreviouslyUploadedFiles,\n browseFiles,\n fmFilePermission\n}) => {\n if (!fmFilePermission) {\n return <NoPermissionView />;\n }\n if (hasPreviouslyUploadedFiles) {\n return <NoResults />;\n }\n return <DropFilesHere empty onClick={() => browseFiles()} />;\n};\n\ninterface RefreshOnScrollParams {\n fetchMore: ObservableQueryFields<ListFilesQueryResponse, ListFilesQueryVariables>[\"fetchMore\"];\n scrollFrame: {\n top: number;\n };\n}\n\ninterface FileError {\n file: FileItem;\n e: Error;\n}\n\ninterface GetFileDetailsFileParams {\n src: string;\n list: FileItem[];\n}\n\nconst FileManagerView: React.FC<FileManagerViewProps> = props => {\n const {\n onClose,\n onChange,\n accept,\n multiple = false,\n maxSize,\n multipleMaxCount,\n multipleMaxSize,\n onUploadCompletion\n } = props;\n\n const {\n selected,\n toggleSelected,\n dragging,\n setDragging,\n uploading,\n setUploading,\n showFileDetails,\n showingFileDetails,\n queryParams,\n setQueryParams,\n hasPreviouslyUploadedFiles,\n setHasPreviouslyUploadedFiles\n } = useFileManager();\n const { showSnackbar } = useSnackbar();\n\n const { identity, getPermission } = useSecurity();\n const fmFilePermission = useMemo((): FileManagerSecurityPermission | null => {\n return getPermission<FileManagerSecurityPermission>(\"fm.file\");\n }, [identity]);\n const canCreate = useMemo(() => {\n // Bail out early if no access\n if (!fmFilePermission) {\n return false;\n }\n\n if (fmFilePermission.own) {\n return true;\n }\n\n if (typeof fmFilePermission.rwd === \"string\") {\n return fmFilePermission.rwd.includes(\"w\");\n }\n\n return true;\n }, [fmFilePermission]);\n const canEdit = useCallback(\n item => {\n // Bail out early if no access\n if (!fmFilePermission) {\n return false;\n }\n const creatorId = get(item, \"createdBy.id\");\n\n if (fmFilePermission.own && creatorId) {\n const identityId = identity ? identity.id || identity.login : null;\n return creatorId === identityId;\n }\n\n if (typeof fmFilePermission.rwd === \"string\") {\n return fmFilePermission.rwd.includes(\"w\");\n }\n\n return true;\n },\n [fmFilePermission]\n );\n\n const searchOnChange = useCallback(\n // @ts-ignore\n debounce(search => setQueryParams({ search }), 500),\n []\n );\n\n const toggleTag = useCallback(async ({ tag, queryParams }) => {\n const finalTags = Array.isArray(queryParams.tags) ? [...queryParams.tags] : [];\n\n if (finalTags.includes(tag)) {\n finalTags.splice(finalTags.indexOf(tag), 1);\n } else {\n finalTags.push(tag);\n }\n\n setQueryParams({ ...queryParams, tags: finalTags });\n }, []);\n\n const getFileUploadErrorMessage = useCallback(e => {\n if (typeof e === \"string\") {\n const match = e.match(/Message>(.*?)<\\/Message/);\n if (match) {\n const [, message] = match;\n return message;\n }\n\n return e;\n }\n return e.message;\n }, []);\n\n const updateCacheAfterCreateFile: MutationUpdaterFn<CreateFileMutationResponse> = (\n cache,\n newFile\n ) => {\n const newFileData = get(newFile, \"data.fileManager.createFile.data\");\n\n const data = cache.readQuery<ListFilesQueryResponse>({\n query: LIST_FILES,\n variables: queryParams\n });\n\n cache.writeQuery({\n query: LIST_FILES,\n variables: queryParams,\n data: {\n fileManager: {\n ...(data?.fileManager || {}),\n listFiles: {\n ...(data?.fileManager || {}).listFiles,\n data: [newFileData, ...((data?.fileManager?.listFiles || {}).data || [])]\n }\n }\n }\n });\n };\n\n const getFileDetailsFile = useCallback(({ src, list }: GetFileDetailsFileParams): FileItem => {\n return list.find(item => item.src === src) as FileItem;\n }, []);\n\n useHotkeys({\n zIndex: 50,\n keys: {\n esc: onClose\n }\n });\n\n const searchInput = useRef<HTMLInputElement>(null);\n\n const apolloClient = useApolloClient();\n\n const gqlQuery = useQuery<ListFilesQueryResponse, ListFilesQueryVariables>(LIST_FILES, {\n variables: queryParams,\n onCompleted: response => {\n const list = get(response, \"fileManager.listFiles.data\") || [];\n if (hasPreviouslyUploadedFiles === null) {\n setHasPreviouslyUploadedFiles(list.length > 0);\n }\n }\n });\n\n const refreshOnScroll = useCallback(\n debounce(({ scrollFrame, fetchMore }: RefreshOnScrollParams) => {\n if (scrollFrame.top > 0.9) {\n const cursor = get(gqlQuery.data, \"fileManager.listFiles.meta.cursor\");\n if (cursor) {\n fetchMore({\n variables: { after: cursor },\n updateQuery: (\n prev: ListFilesQueryResponse,\n result: { fetchMoreResult?: ListFilesQueryResponse }\n ) => {\n const { fetchMoreResult } = result;\n if (!fetchMoreResult) {\n return prev;\n }\n\n const next = { ...fetchMoreResult };\n\n next.fileManager.listFiles.data = [\n ...prev.fileManager.listFiles.data,\n ...fetchMoreResult.fileManager.listFiles.data\n ];\n\n return next;\n }\n });\n }\n }\n }, 500),\n [gqlQuery]\n );\n\n const { data, fetchMore, loading } = gqlQuery;\n\n const list: FileItem[] = get(data, \"fileManager.listFiles.data\") || [];\n const [createFile] = useMutation<CreateFileMutationResponse, CreateFileMutationVariables>(\n CREATE_FILE,\n {\n update: updateCacheAfterCreateFile\n }\n );\n const uploadFile = async (files: FileItem[] | FileItem): Promise<number | null> => {\n setUploading(true);\n const list: FileItem[] = Array.isArray(files) ? files : [files];\n\n const errors: FileError[] = [];\n const uploadedFiles: FileItem[] = [];\n await Promise.all(\n list.map(async file => {\n try {\n const response = await getFileUploader()(file, { apolloClient });\n /**\n * Add \"tags\" while creating the new file.\n */\n const createFileResponse = await createFile({\n variables: {\n data: {\n ...response,\n tags: queryParams.scope ? [queryParams.scope] : []\n }\n }\n });\n // Save create file data for later\n uploadedFiles.push(\n get(\n createFileResponse,\n \"data.fileManager.createFile.data\"\n ) as unknown as FileItem\n );\n } catch (e) {\n errors.push({ file, e });\n }\n })\n );\n\n if (!hasPreviouslyUploadedFiles) {\n setHasPreviouslyUploadedFiles(true);\n }\n\n setUploading(false);\n\n if (errors.length > 0) {\n // We wait 750ms, just for everything to settle down a bit.\n return setTimeout(() => {\n showSnackbar(\n <>\n {t`One or more files were not uploaded successfully:`}\n <ol>\n {errors.map(({ file, e }) => (\n <li key={file.name}>\n <strong>{file.name}</strong>: {getFileUploadErrorMessage(e)}\n </li>\n ))}\n </ol>\n </>\n );\n // TODO @ts-refactor\n }, 750) as unknown as number;\n }\n\n // We wait 750ms, just for everything to settle down a bit.\n setTimeout(() => showSnackbar(t`File upload complete.`), 750);\n if (typeof onUploadCompletion === \"function\") {\n // We wait 750ms, just for everything to settle down a bit.\n return setTimeout(() => {\n onUploadCompletion(uploadedFiles);\n onClose && onClose();\n // TODO @ts-refactor\n }, 750) as unknown as number;\n }\n return null;\n };\n\n const renderUploadFileAction = useCallback(\n ({ browseFiles }) => {\n if (!canCreate) {\n return null;\n }\n return (\n <ButtonPrimary onClick={browseFiles} disabled={uploading}>\n <ButtonIcon icon={<UploadIcon />} />\n {t`Upload...`}\n </ButtonPrimary>\n );\n },\n [uploading, canCreate]\n );\n\n const settingsQuery = useQuery(GET_FILE_SETTINGS);\n const settings = get(settingsQuery.data, \"fileManager.getSettings.data\") || {};\n return (\n <Files\n multiple\n maxSize={settings.uploadMaxFileSize ? settings.uploadMaxFileSize + \"b\" : maxSize}\n multipleMaxSize={multipleMaxSize}\n multipleMaxCount={multipleMaxCount}\n accept={accept}\n onSuccess={files => {\n uploadFile(files.map(file => file.src.file as FileItem).filter(Boolean));\n }}\n onError={errors => {\n console.log(\"onError\", errors);\n /**\n * TODO @ts-refactor\n * Figure out if incoming errors var is wrong or the one in the outputFileSelectionError\n */\n // @ts-ignore\n const message = outputFileSelectionError(errors);\n showSnackbar(message);\n }}\n >\n {({ getDropZoneProps, browseFiles, validateFiles }) => (\n <OverlayLayout\n {...getDropZoneProps({\n onDragEnter: () => hasPreviouslyUploadedFiles && setDragging(true),\n onExited: onClose\n })}\n barLeft={\n <InputSearch>\n <Icon className={searchIcon} icon={<SearchIcon />} />\n <input\n ref={searchInput}\n onChange={e => searchOnChange(e.target.value)}\n placeholder={t`Search by filename or tags`}\n disabled={!fmFilePermission}\n data-testid={\"file-manager.search-input\"}\n />\n </InputSearch>\n }\n barRight={\n selected.length > 0 ? (\n <ButtonPrimary\n disabled={uploading}\n onClick={() => {\n (async () => {\n if (typeof onChange === \"function\") {\n await onChange(multiple ? selected : selected[0]);\n\n onClose && onClose();\n }\n })();\n }}\n >\n {t`Select`} {multiple && `(${selected.length})`}\n </ButtonPrimary>\n ) : (\n renderUploadFileAction({ browseFiles })\n )\n }\n >\n <>\n {dragging && hasPreviouslyUploadedFiles && (\n <DropFilesHere\n // @ts-ignore TODO: @adrian - className is never rendered?!\n className={style.draggingFeedback}\n onDragLeave={() => setDragging(false)}\n onDrop={() => setDragging(false)}\n />\n )}\n\n <FileDetails\n validateFiles={validateFiles}\n uploadFile={uploadFile}\n file={getFileDetailsFile({\n list,\n src: showingFileDetails\n })}\n canEdit={canEdit}\n />\n\n <LeftSidebar\n queryParams={queryParams}\n toggleTag={tag => toggleTag({ tag, queryParams })}\n />\n\n <FileListWrapper data-testid={\"fm-list-wrapper\"}>\n {loading && (\n <CircularProgress\n label={t`Loading Files...`}\n style={{ opacity: 1 }}\n />\n )}\n <Scrollbar\n onScrollFrame={scrollFrame =>\n refreshOnScroll({\n scrollFrame,\n fetchMore\n })\n }\n >\n <FileList>\n {list.length\n ? list.map(file =>\n renderFile({\n uploadFile,\n file,\n showFileDetails: () => showFileDetails(file.src),\n selected: selected.find(\n (current: FileItem) =>\n current.src === file.src\n ),\n onSelect: async () => {\n if (typeof onChange === \"function\") {\n if (multiple) {\n toggleSelected(file);\n return;\n }\n\n await onChange(file);\n onClose && onClose();\n }\n }\n })\n )\n : renderEmpty({\n hasPreviouslyUploadedFiles,\n browseFiles,\n fmFilePermission\n })}\n </FileList>\n </Scrollbar>\n <BottomInfoBar accept={accept} uploading={uploading} />\n </FileListWrapper>\n </>\n </OverlayLayout>\n )}\n </Files>\n );\n};\n\nFileManagerView.defaultProps = {\n multiple: false,\n maxSize: \"1000mb\",\n multipleMaxSize: \"1000mb\",\n multipleMaxCount: 100\n};\n\nexport default FileManagerView;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAAkD;AAMlD,IAAMA,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,0CAA0C,CAAC;AAE7D,IAAMC,KAAK,GAAG;EACVC,gBAAgB,eAAE,IAAAC,YAAG,EAAC;IAClBC,QAAQ,EAAE,OAAO;IACjBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE,GAAG;IACZC,UAAU,EAAE,OAAO;IACnBC,MAAM,EAAE;EACZ,CAAC,4BAAC;EACFC,UAAU,EAAE;IACRC,MAAM,eAAE,IAAAV,YAAG,EAAC;MACRW,SAAS,EAAE,QAAQ;MACnBC,QAAQ,EAAE,EAAE;MACZC,OAAO,EAAE,EAAE;MACXC,UAAU,EAAE,GAAG;MACfC,KAAK,EAAE;IACX,CAAC;EACL;AACJ,CAAC;AAED,IAAMC,WAAW,oBAAGC,eAAM,EAAC,KAAK;EAAA;EAAA;AAAA,GAAE;EAC9BC,eAAe,EAAE,gCAAgC;EACjDjB,QAAQ,EAAE,UAAU;EACpBI,MAAM,EAAE,EAAE;EACVQ,OAAO,EAAE,CAAC;EACVT,KAAK,EAAE,MAAM;EACbe,YAAY,EAAE,CAAC;EACf,SAAS,EAA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BAAA;kBAAA,KAC1BE,QAAQ;oBAAA;oBAAA;kBAAA;kBACRO,cAAc,CAACpB,IAAI,CAAC;kBAAC;gBAAA;kBAAA;kBAAA,OAInBW,QAAQ,CAACX,IAAI,CAAC;gBAAA;kBACpBU,OAAO,IAAIA,OAAO,EAAE;gBAAC;gBAAA;kBAAA;cAAA;YAAA;UAAA,CAE5B;UAAA;YAAA;UAAA;UAAA;QAAA;MACL,CAAC,CAAC;IAAA,EACL,GACDL,WAAW,CAAC;MACRC,0BAA0B,EAA1BA,0BAA0B;MAC1BC,WAAW,EAAXA,WAAW;MACXC,gBAAgB,EAAhBA;IACJ,CAAC,CAAC,CACD,CACH,eACZ,6BAAC,sBAAa;MAAC,MAAM,EAAEI,MAAO;MAAC,SAAS,EAAEW;IAAU,EAAG,CACzC,CACnB,CACS;EAAA,CACnB,CACG;AAEhB,CAAC;AAEDd,eAAe,CAAC+H,YAAY,GAAG;EAC3B3H,QAAQ,EAAE,KAAK;EACfC,OAAO,EAAE,QAAQ;EACjBE,eAAe,EAAE,QAAQ;EACzBD,gBAAgB,EAAE;AACtB,CAAC;AAAC,eAEaN,eAAe;AAAA"}
1
+ {"version":3,"names":["t","i18n","ns","style","draggingFeedback","css","position","top","left","width","height","opacity","background","zIndex","leftDrawer","header","textAlign","fontSize","padding","fontWeight","color","InputSearch","styled","backgroundColor","borderRadius","border","marginLeft","outline","searchIcon","FileListWrapper","float","display","FileList","gridTemplateColumns","marginBottom","renderFile","props","file","plugin","getFileTypePlugin","id","render","renderEmpty","hasPreviouslyUploadedFiles","browseFiles","fmFilePermission","FileManagerView","onClose","onChange","accept","multiple","maxSize","multipleMaxCount","multipleMaxSize","onUploadCompletion","useFileManager","selected","toggleSelected","dragging","setDragging","uploading","setUploading","showFileDetails","showingFileDetails","queryParams","setQueryParams","setHasPreviouslyUploadedFiles","useSnackbar","showSnackbar","useSecurity","identity","getPermission","useMemo","canCreate","own","rwd","includes","canEdit","useCallback","item","creatorId","get","identityId","login","searchOnChange","debounce","search","toggleTag","tag","finalTags","Array","isArray","tags","splice","indexOf","push","getFileUploadErrorMessage","e","match","message","updateCacheAfterCreateFile","cache","newFile","newFileData","data","readQuery","query","LIST_FILES","variables","writeQuery","fileManager","listFiles","getFileDetailsFile","src","list","find","useHotkeys","keys","esc","searchInput","useRef","apolloClient","useApolloClient","gqlQuery","useQuery","onCompleted","response","length","refreshOnScroll","scrollFrame","fetchMore","cursor","after","updateQuery","prev","result","fetchMoreResult","next","loading","useMutation","CREATE_FILE","update","createFile","uploadFile","files","errors","uploadedFiles","Promise","all","map","getFileUploader","scope","createFileResponse","setTimeout","name","renderUploadFileAction","settingsQuery","GET_FILE_SETTINGS","settings","uploadMaxFileSize","filter","Boolean","console","log","outputFileSelectionError","getDropZoneProps","validateFiles","onDragEnter","onExited","target","value","current","onSelect","defaultProps"],"sources":["FileManagerView.tsx"],"sourcesContent":["import React, { useRef, useCallback, useMemo } from \"react\";\nimport { css } from \"emotion\";\nimport styled from \"@emotion/styled\";\nimport Files, { FilesRenderChildren } from \"react-butterfiles\";\nimport { ButtonPrimary, ButtonIcon } from \"@webiny/ui/Button\";\nimport { Icon } from \"@webiny/ui/Icon\";\nimport File, { FileProps } from \"./File\";\nimport { useQuery, useMutation, useApolloClient } from \"@apollo/react-hooks\";\nimport { FilesRules } from \"react-butterfiles\";\nimport {\n LIST_FILES,\n CREATE_FILE,\n GET_FILE_SETTINGS,\n CreateFileMutationVariables,\n CreateFileMutationResponse,\n ListFilesQueryResponse,\n ListFilesQueryVariables\n} from \"./graphql\";\nimport getFileTypePlugin from \"./getFileTypePlugin\";\nimport get from \"lodash/get\";\nimport debounce from \"lodash/debounce\";\nimport getFileUploader from \"./getFileUploader\";\nimport { outputFileSelectionError } from \"./outputFileSelectionError\";\nimport DropFilesHere from \"./DropFilesHere\";\nimport NoResults from \"./NoResults\";\nimport FileDetails from \"./FileDetails\";\nimport LeftSidebar from \"./LeftSidebar\";\nimport BottomInfoBar from \"./BottomInfoBar\";\nimport { OverlayLayout } from \"../OverlayLayout\";\nimport { useSnackbar } from \"~/hooks/useSnackbar\";\nimport { Scrollbar } from \"@webiny/ui/Scrollbar\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { useSecurity } from \"@webiny/app-security\";\n/**\n * Package react-hotkeyz is missing types.\n */\n// @ts-ignore\nimport { useHotkeys } from \"react-hotkeyz\";\nimport { useFileManager } from \"./FileManagerContext\";\nimport { ReactComponent as SearchIcon } from \"./icons/round-search-24px.svg\";\nimport { ReactComponent as UploadIcon } from \"./icons/round-cloud_upload-24px.svg\";\nimport NoPermissionView from \"./NoPermissionView\";\nimport { FileItem, FileManagerSecurityPermission } from \"~/components/FileManager/types\";\nimport { MutationUpdaterFn } from \"apollo-client/core/watchQueryOptions\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\nimport { ObservableQueryFields } from \"@apollo/react-common/lib/types/types\";\n\nconst t = i18n.ns(\"app-admin/file-manager/file-manager-view\");\n\nconst style = {\n draggingFeedback: css({\n position: \"fixed\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n opacity: 0.5,\n background: \"white\",\n zIndex: 100\n }),\n leftDrawer: {\n header: css({\n textAlign: \"center\",\n fontSize: 18,\n padding: 10,\n fontWeight: 600,\n color: \"var(--mdc-theme-on-surface)\"\n })\n }\n};\n\nconst InputSearch = styled(\"div\")({\n backgroundColor: \"var(--mdc-theme-on-background)\",\n position: \"relative\",\n height: 32,\n padding: 3,\n width: \"100%\",\n borderRadius: 2,\n \"> input\": {\n border: \"none\",\n fontSize: 14,\n width: \"calc(100% - 10px)\",\n height: \"100%\",\n marginLeft: 50,\n backgroundColor: \"transparent\",\n outline: \"none\",\n color: \"var(--mdc-theme-text-primary-on-background)\"\n }\n});\n\nconst searchIcon = css({\n \"&.mdc-button__icon\": {\n color: \"var(--mdc-theme-text-secondary-on-background)\",\n position: \"absolute\",\n width: 24,\n height: 24,\n left: 15,\n top: 7\n }\n});\n\nconst FileListWrapper = styled(\"div\")({\n float: \"right\",\n display: \"inline-block\",\n width: \"calc(100vw - 270px)\",\n height: \"100%\"\n});\n\nconst FileList = styled(\"div\")({\n width: \"100%\",\n display: \"grid\",\n /* define the number of grid columns */\n gridTemplateColumns: \"repeat( auto-fill, minmax(220px, 1fr) )\",\n marginBottom: 95\n});\n\nexport interface FileManagerViewProps {\n onChange?: Function;\n onClose?: Function;\n files?: FilesRules;\n multiple?: boolean; // Does not affect <Files> component, it always allows multiple selection.\n accept: Array<string>;\n maxSize?: number | string;\n multipleMaxCount?: number;\n multipleMaxSize?: number | string;\n onUploadCompletion?: Function;\n tags?: string[];\n scope?: string;\n own?: boolean;\n}\n\ninterface RenderFileProps extends Omit<FileProps, \"children\"> {\n file: FileItem;\n children?: React.ReactNode;\n}\nconst renderFile: React.FC<RenderFileProps> = props => {\n const { file } = props;\n const plugin = getFileTypePlugin(file);\n if (!plugin) {\n return null;\n }\n return (\n <File {...props} key={file.id}>\n {plugin.render({\n /**\n * TODO @ts-refactor\n */\n // @ts-ignore\n file\n })}\n </File>\n );\n};\ninterface RenderEmptyProps {\n hasPreviouslyUploadedFiles: boolean;\n browseFiles: FilesRenderChildren[\"browseFiles\"];\n fmFilePermission: SecurityPermission | null;\n}\nconst renderEmpty: React.FC<RenderEmptyProps> = ({\n hasPreviouslyUploadedFiles,\n browseFiles,\n fmFilePermission\n}) => {\n if (!fmFilePermission) {\n return <NoPermissionView />;\n }\n if (hasPreviouslyUploadedFiles) {\n return <NoResults />;\n }\n return <DropFilesHere empty onClick={() => browseFiles()} />;\n};\n\ninterface RefreshOnScrollParams {\n fetchMore: ObservableQueryFields<ListFilesQueryResponse, ListFilesQueryVariables>[\"fetchMore\"];\n scrollFrame: {\n top: number;\n };\n}\n\ninterface FileError {\n file: FileItem;\n e: Error;\n}\n\ninterface GetFileDetailsFileParams {\n src: string;\n list: FileItem[];\n}\n\nconst FileManagerView: React.FC<FileManagerViewProps> = props => {\n const {\n onClose,\n onChange,\n accept,\n multiple = false,\n maxSize,\n multipleMaxCount,\n multipleMaxSize,\n onUploadCompletion\n } = props;\n\n const {\n selected,\n toggleSelected,\n dragging,\n setDragging,\n uploading,\n setUploading,\n showFileDetails,\n showingFileDetails,\n queryParams,\n setQueryParams,\n hasPreviouslyUploadedFiles,\n setHasPreviouslyUploadedFiles\n } = useFileManager();\n const { showSnackbar } = useSnackbar();\n\n const { identity, getPermission } = useSecurity();\n const fmFilePermission = useMemo((): FileManagerSecurityPermission | null => {\n return getPermission<FileManagerSecurityPermission>(\"fm.file\");\n }, [identity]);\n const canCreate = useMemo(() => {\n // Bail out early if no access\n if (!fmFilePermission) {\n return false;\n }\n\n if (fmFilePermission.own) {\n return true;\n }\n\n if (typeof fmFilePermission.rwd === \"string\") {\n return fmFilePermission.rwd.includes(\"w\");\n }\n\n return true;\n }, [fmFilePermission]);\n const canEdit = useCallback(\n item => {\n // Bail out early if no access\n if (!fmFilePermission) {\n return false;\n }\n const creatorId = get(item, \"createdBy.id\");\n\n if (fmFilePermission.own && creatorId) {\n const identityId = identity ? identity.id || identity.login : null;\n return creatorId === identityId;\n }\n\n if (typeof fmFilePermission.rwd === \"string\") {\n return fmFilePermission.rwd.includes(\"w\");\n }\n\n return true;\n },\n [fmFilePermission]\n );\n\n const searchOnChange = useCallback(\n // @ts-ignore\n debounce(search => setQueryParams({ search }), 500),\n []\n );\n\n const toggleTag = useCallback(async ({ tag, queryParams }) => {\n const finalTags = Array.isArray(queryParams.tags) ? [...queryParams.tags] : [];\n\n if (finalTags.includes(tag)) {\n finalTags.splice(finalTags.indexOf(tag), 1);\n } else {\n finalTags.push(tag);\n }\n\n setQueryParams({ ...queryParams, tags: finalTags });\n }, []);\n\n const getFileUploadErrorMessage = useCallback(e => {\n if (typeof e === \"string\") {\n const match = e.match(/Message>(.*?)<\\/Message/);\n if (match) {\n const [, message] = match;\n return message;\n }\n\n return e;\n }\n return e.message;\n }, []);\n\n const updateCacheAfterCreateFile: MutationUpdaterFn<CreateFileMutationResponse> = (\n cache,\n newFile\n ) => {\n const newFileData = get(newFile, \"data.fileManager.createFile.data\");\n\n const data = cache.readQuery<ListFilesQueryResponse>({\n query: LIST_FILES,\n variables: queryParams\n });\n\n cache.writeQuery({\n query: LIST_FILES,\n variables: queryParams,\n data: {\n fileManager: {\n ...(data?.fileManager || {}),\n listFiles: {\n ...(data?.fileManager || {}).listFiles,\n data: [newFileData, ...((data?.fileManager?.listFiles || {}).data || [])]\n }\n }\n }\n });\n };\n\n const getFileDetailsFile = useCallback(({ src, list }: GetFileDetailsFileParams): FileItem => {\n return list.find(item => item.src === src) as FileItem;\n }, []);\n\n useHotkeys({\n zIndex: 50,\n keys: {\n esc: onClose\n }\n });\n\n const searchInput = useRef<HTMLInputElement>(null);\n\n const apolloClient = useApolloClient();\n\n const gqlQuery = useQuery<ListFilesQueryResponse, ListFilesQueryVariables>(LIST_FILES, {\n variables: queryParams,\n onCompleted: response => {\n const list = get(response, \"fileManager.listFiles.data\") || [];\n if (hasPreviouslyUploadedFiles === null) {\n setHasPreviouslyUploadedFiles(list.length > 0);\n }\n }\n });\n\n const refreshOnScroll = useCallback(\n debounce(({ scrollFrame, fetchMore }: RefreshOnScrollParams) => {\n if (scrollFrame.top > 0.9) {\n const cursor = get(gqlQuery.data, \"fileManager.listFiles.meta.cursor\");\n if (cursor) {\n fetchMore({\n variables: { after: cursor },\n updateQuery: (\n prev: ListFilesQueryResponse,\n result: { fetchMoreResult?: ListFilesQueryResponse }\n ) => {\n const { fetchMoreResult } = result;\n if (!fetchMoreResult) {\n return prev;\n }\n\n const next = { ...fetchMoreResult };\n\n next.fileManager.listFiles.data = [\n ...prev.fileManager.listFiles.data,\n ...fetchMoreResult.fileManager.listFiles.data\n ];\n\n return next;\n }\n });\n }\n }\n }, 500),\n [gqlQuery]\n );\n\n const { data, fetchMore, loading } = gqlQuery;\n\n const list: FileItem[] = get(data, \"fileManager.listFiles.data\") || [];\n const [createFile] = useMutation<CreateFileMutationResponse, CreateFileMutationVariables>(\n CREATE_FILE,\n {\n update: updateCacheAfterCreateFile\n }\n );\n const uploadFile = async (files: FileItem | FileItem[]): Promise<number | null> => {\n setUploading(true);\n const list: FileItem[] = Array.isArray(files) ? files : [files];\n\n const errors: FileError[] = [];\n const uploadedFiles: FileItem[] = [];\n await Promise.all(\n list.map(async file => {\n try {\n const response = await getFileUploader()(file, { apolloClient });\n /**\n * Add \"tags\" while creating the new file.\n */\n const createFileResponse = await createFile({\n variables: {\n data: {\n ...response,\n tags: queryParams.scope ? [queryParams.scope] : []\n }\n }\n });\n // Save create file data for later\n uploadedFiles.push(\n get(\n createFileResponse,\n \"data.fileManager.createFile.data\"\n ) as unknown as FileItem\n );\n } catch (e) {\n errors.push({ file, e });\n }\n })\n );\n\n if (!hasPreviouslyUploadedFiles) {\n setHasPreviouslyUploadedFiles(true);\n }\n\n setUploading(false);\n\n if (errors.length > 0) {\n // We wait 750ms, just for everything to settle down a bit.\n return setTimeout(() => {\n showSnackbar(\n <>\n {t`One or more files were not uploaded successfully:`}\n <ol>\n {errors.map(({ file, e }) => (\n <li key={file.name}>\n <strong>{file.name}</strong>: {getFileUploadErrorMessage(e)}\n </li>\n ))}\n </ol>\n </>\n );\n // TODO @ts-refactor\n }, 750) as unknown as number;\n }\n\n // We wait 750ms, just for everything to settle down a bit.\n setTimeout(() => showSnackbar(t`File upload complete.`), 750);\n if (typeof onUploadCompletion === \"function\") {\n // We wait 750ms, just for everything to settle down a bit.\n return setTimeout(() => {\n onUploadCompletion(uploadedFiles);\n onClose && onClose();\n // TODO @ts-refactor\n }, 750) as unknown as number;\n }\n return null;\n };\n\n const renderUploadFileAction = useCallback(\n ({ browseFiles }) => {\n if (!canCreate) {\n return null;\n }\n return (\n <ButtonPrimary onClick={browseFiles} disabled={uploading}>\n <ButtonIcon icon={<UploadIcon />} />\n {t`Upload...`}\n </ButtonPrimary>\n );\n },\n [uploading, canCreate]\n );\n\n const settingsQuery = useQuery(GET_FILE_SETTINGS);\n const settings = get(settingsQuery.data, \"fileManager.getSettings.data\") || {};\n return (\n <Files\n multiple\n maxSize={settings.uploadMaxFileSize ? settings.uploadMaxFileSize + \"b\" : maxSize}\n multipleMaxSize={multipleMaxSize}\n multipleMaxCount={multipleMaxCount}\n accept={accept}\n onSuccess={files => {\n uploadFile(files.map(file => file.src.file as FileItem).filter(Boolean));\n }}\n onError={errors => {\n console.log(\"onError\", errors);\n /**\n * TODO @ts-refactor\n * Figure out if incoming errors var is wrong or the one in the outputFileSelectionError\n */\n // @ts-ignore\n const message = outputFileSelectionError(errors);\n showSnackbar(message);\n }}\n >\n {({ getDropZoneProps, browseFiles, validateFiles }) => (\n <OverlayLayout\n {...getDropZoneProps({\n onDragEnter: () => hasPreviouslyUploadedFiles && setDragging(true),\n onExited: onClose\n })}\n barLeft={\n <InputSearch>\n <Icon className={searchIcon} icon={<SearchIcon />} />\n <input\n ref={searchInput}\n onChange={e => searchOnChange(e.target.value)}\n placeholder={t`Search by filename or tags`}\n disabled={!fmFilePermission}\n data-testid={\"file-manager.search-input\"}\n />\n </InputSearch>\n }\n barRight={\n selected.length > 0 ? (\n <ButtonPrimary\n disabled={uploading}\n onClick={() => {\n (async () => {\n if (typeof onChange === \"function\") {\n await onChange(multiple ? selected : selected[0]);\n\n onClose && onClose();\n }\n })();\n }}\n >\n {t`Select`} {multiple && `(${selected.length})`}\n </ButtonPrimary>\n ) : (\n renderUploadFileAction({ browseFiles })\n )\n }\n >\n <>\n {dragging && hasPreviouslyUploadedFiles && (\n <DropFilesHere\n // @ts-ignore TODO: @adrian - className is never rendered?!\n className={style.draggingFeedback}\n onDragLeave={() => setDragging(false)}\n onDrop={() => setDragging(false)}\n />\n )}\n\n <FileDetails\n validateFiles={validateFiles}\n uploadFile={uploadFile}\n file={getFileDetailsFile({\n list,\n src: showingFileDetails\n })}\n canEdit={canEdit}\n />\n\n <LeftSidebar\n queryParams={queryParams}\n toggleTag={tag => toggleTag({ tag, queryParams })}\n />\n\n <FileListWrapper data-testid={\"fm-list-wrapper\"}>\n {loading && (\n <CircularProgress\n label={t`Loading Files...`}\n style={{ opacity: 1 }}\n />\n )}\n <Scrollbar\n onScrollFrame={scrollFrame =>\n refreshOnScroll({\n scrollFrame,\n fetchMore\n })\n }\n >\n <FileList>\n {list.length\n ? list.map(file =>\n renderFile({\n uploadFile,\n file,\n showFileDetails: () => showFileDetails(file.src),\n selected: selected.find(\n (current: FileItem) =>\n current.src === file.src\n ),\n onSelect: async () => {\n if (typeof onChange === \"function\") {\n if (multiple) {\n toggleSelected(file);\n return;\n }\n\n await onChange(file);\n onClose && onClose();\n }\n }\n })\n )\n : renderEmpty({\n hasPreviouslyUploadedFiles,\n browseFiles,\n fmFilePermission\n })}\n </FileList>\n </Scrollbar>\n <BottomInfoBar accept={accept} uploading={uploading} />\n </FileListWrapper>\n </>\n </OverlayLayout>\n )}\n </Files>\n );\n};\n\nFileManagerView.defaultProps = {\n multiple: false,\n maxSize: \"1000mb\",\n multipleMaxSize: \"1000mb\",\n multipleMaxCount: 100\n};\n\nexport default FileManagerView;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AAAkD;AAMlD,IAAMA,CAAC,GAAGC,UAAI,CAACC,EAAE,CAAC,0CAA0C,CAAC;AAE7D,IAAMC,KAAK,GAAG;EACVC,gBAAgB,eAAE,IAAAC,YAAG,EAAC;IAClBC,QAAQ,EAAE,OAAO;IACjBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE,GAAG;IACZC,UAAU,EAAE,OAAO;IACnBC,MAAM,EAAE;EACZ,CAAC,4BAAC;EACFC,UAAU,EAAE;IACRC,MAAM,eAAE,IAAAV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el/runtime/helpers/taggedTemplateLiteral"));
9
9
  var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
10
10
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
11
- var FILE_FIELDS = /* GraphQL */"\n {\n __typename\n id\n name\n key\n src\n size\n type\n tags\n createdOn\n createdBy {\n id\n }\n }\n";
11
+ var FILE_FIELDS = /* GraphQL */"\n {\n __typename\n id\n name\n key\n src\n size\n type\n tags\n aliases\n createdOn\n createdBy {\n id\n }\n }\n";
12
12
  var ERROR_FIELDS = /* GraphQL */"\n {\n code\n message\n data\n }\n";
13
13
 
14
14
  /**
@@ -28,13 +28,13 @@ var LIST_TAGS = (0, _graphqlTag.default)(_templateObject2 || (_templateObject2 =
28
28
  * Create File Mutation Response
29
29
  */
30
30
  exports.LIST_TAGS = LIST_TAGS;
31
- var CREATE_FILE = (0, _graphqlTag.default)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n mutation CreateFile($data: FileInput!) {\n fileManager {\n createFile(data: $data) {\n error ", "\n data ", "\n }\n }\n }\n"])), ERROR_FIELDS, FILE_FIELDS);
31
+ var CREATE_FILE = (0, _graphqlTag.default)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n mutation CreateFile($data: CreateFileInput!) {\n fileManager {\n createFile(data: $data) {\n error ", "\n data ", "\n }\n }\n }\n"])), ERROR_FIELDS, FILE_FIELDS);
32
32
  /**
33
33
  * ##################
34
34
  * Update File Mutation Response
35
35
  */
36
36
  exports.CREATE_FILE = CREATE_FILE;
37
- var UPDATE_FILE = (0, _graphqlTag.default)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n mutation UpdateFile($id: ID!, $data: FileInput!) {\n fileManager {\n updateFile(id: $id, data: $data) {\n data {\n id\n src\n name\n tags\n }\n error ", "\n }\n }\n }\n"])), ERROR_FIELDS);
37
+ var UPDATE_FILE = (0, _graphqlTag.default)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n mutation UpdateFile($id: ID!, $data: UpdateFileInput!) {\n fileManager {\n updateFile(id: $id, data: $data) {\n data {\n id\n src\n name\n tags\n }\n error ", "\n }\n }\n }\n"])), ERROR_FIELDS);
38
38
 
39
39
  /**
40
40
  * ##################
@@ -1 +1 @@
1
- {"version":3,"names":["FILE_FIELDS","ERROR_FIELDS","LIST_FILES","gql","LIST_TAGS","CREATE_FILE","UPDATE_FILE","DELETE_FILE","GET_FILE_SETTINGS"],"sources":["graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { FileItem } from \"~/components/FileManager/types\";\n\nconst FILE_FIELDS = /* GraphQL */ `\n {\n __typename\n id\n name\n key\n src\n size\n type\n tags\n createdOn\n createdBy {\n id\n }\n }\n`;\n\nconst ERROR_FIELDS = /* GraphQL */ `\n {\n code\n message\n data\n }\n`;\n\n/**\n * ##################\n * List Files Query Response\n */\nexport interface ListFilesListFilesResponse {\n data: FileItem[];\n error?: Error | null;\n meta: {\n hasMoreItems: boolean;\n totalItem: number;\n cursor: string | null;\n };\n}\nexport interface ListFilesQueryResponse {\n fileManager: {\n listFiles: ListFilesListFilesResponse;\n };\n}\nexport interface ListFilesQueryVariables {\n types?: string[];\n tags?: string[];\n limit?: number;\n search?: string;\n after?: string;\n}\nexport const LIST_FILES = gql`\n query ListFiles(\n $types: [String],\n $tags: [String],\n $limit: Int,\n $search: String,\n $after: String,\n $where: FileWhereInput\n ) {\n fileManager {\n listFiles(\n types: $types,\n limit: $limit,\n search: $search,\n tags: $tags,\n after: $after,\n where: $where\n ) {\n data ${FILE_FIELDS}\n meta {\n cursor\n totalCount\n }\n }\n }\n }\n`;\n/**\n * ##################\n * List File Tags Query Response\n */\nexport interface ListFileTagsQueryResponse {\n fileManager: {\n listTags: string[];\n error: Error | null;\n };\n}\nexport const LIST_TAGS = gql`\n query ListTags($where: TagWhereInput) {\n fileManager {\n listTags(where: $where)\n }\n }\n`;\n/**\n * ##################\n * Create File Mutation Response\n */\nexport interface CreateFileMutationResponse {\n fileManager: {\n createFile: {\n data: FileItem;\n error?: Error | null;\n };\n };\n}\nexport interface FileInput {\n key: string;\n name: string;\n size: number;\n type: string;\n tags: string;\n meta: Record<string, any>;\n}\nexport interface CreateFileMutationVariables {\n data: FileInput;\n}\nexport const CREATE_FILE = gql`\n mutation CreateFile($data: FileInput!) {\n fileManager {\n createFile(data: $data) {\n error ${ERROR_FIELDS}\n data ${FILE_FIELDS}\n }\n }\n }\n`;\n/**\n * ##################\n * Update File Mutation Response\n */\nexport interface UpdateFileMutationResponse {\n fileManager: {\n updateFile: {\n data: FileItem;\n error?: Error | null;\n };\n };\n}\nexport interface UpdateFileMutationVariables {\n id: string;\n data: Partial<FileInput>;\n}\nexport const UPDATE_FILE = gql`\n mutation UpdateFile($id: ID!, $data: FileInput!) {\n fileManager {\n updateFile(id: $id, data: $data) {\n data {\n id\n src\n name\n tags\n }\n error ${ERROR_FIELDS}\n }\n }\n }\n`;\n\n/**\n * ##################\n * Delete File Mutation Response\n */\nexport interface DeleteFileMutationResponse {\n fileManager: {\n updateFile: {\n data: boolean;\n error?: Error | null;\n };\n };\n}\nexport interface DeleteFileMutationVariables {\n id: string;\n}\nexport const DELETE_FILE = gql`\n mutation deleteFile($id: ID!) {\n fileManager {\n deleteFile(id: $id) {\n data\n error ${ERROR_FIELDS}\n }\n }\n }\n`;\n\nexport const GET_FILE_SETTINGS = gql`\n query getSettings {\n fileManager {\n getSettings {\n data {\n uploadMinFileSize\n uploadMaxFileSize\n }\n error ${ERROR_FIELDS}\n }\n }\n }\n`;\n"],"mappings":";;;;;;;;AAAA;AAA8B;AAG9B,IAAMA,WAAW,GAAG,oNAenB;AAED,IAAMC,YAAY,GAAG,4EAMpB;;AAED;AACA;AACA;AACA;;AAsBO,IAAMC,UAAU,OAAGC,mBAAG,srBAkBNH,WAAW,CAQjC;AACD;AACA;AACA;AACA;AAHA;AAUO,IAAMI,SAAS,OAAGD,mBAAG,mNAM3B;AACD;AACA;AACA;AACA;AAHA;AAuBO,IAAME,WAAW,OAAGF,mBAAG,6RAINF,YAAY,EACbD,WAAW,CAIjC;AACD;AACA;AACA;AACA;AAHA;AAgBO,IAAMM,WAAW,OAAGH,mBAAG,qaAUNF,YAAY,CAInC;;AAED;AACA;AACA;AACA;AAHA;AAeO,IAAMM,WAAW,OAAGJ,mBAAG,2QAKNF,YAAY,CAInC;AAAC;AAEK,IAAMO,iBAAiB,OAAGL,mBAAG,0VAQZF,YAAY,CAInC;AAAC"}
1
+ {"version":3,"names":["FILE_FIELDS","ERROR_FIELDS","LIST_FILES","gql","LIST_TAGS","CREATE_FILE","UPDATE_FILE","DELETE_FILE","GET_FILE_SETTINGS"],"sources":["graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { FileItem } from \"~/components/FileManager/types\";\n\nconst FILE_FIELDS = /* GraphQL */ `\n {\n __typename\n id\n name\n key\n src\n size\n type\n tags\n aliases\n createdOn\n createdBy {\n id\n }\n }\n`;\n\nconst ERROR_FIELDS = /* GraphQL */ `\n {\n code\n message\n data\n }\n`;\n\n/**\n * ##################\n * List Files Query Response\n */\nexport interface ListFilesListFilesResponse {\n data: FileItem[];\n error?: Error | null;\n meta: {\n hasMoreItems: boolean;\n totalItem: number;\n cursor: string | null;\n };\n}\nexport interface ListFilesQueryResponse {\n fileManager: {\n listFiles: ListFilesListFilesResponse;\n };\n}\nexport interface ListFilesQueryVariables {\n types?: string[];\n tags?: string[];\n limit?: number;\n search?: string;\n after?: string;\n}\nexport const LIST_FILES = gql`\n query ListFiles(\n $types: [String],\n $tags: [String],\n $limit: Int,\n $search: String,\n $after: String,\n $where: FileWhereInput\n ) {\n fileManager {\n listFiles(\n types: $types,\n limit: $limit,\n search: $search,\n tags: $tags,\n after: $after,\n where: $where\n ) {\n data ${FILE_FIELDS}\n meta {\n cursor\n totalCount\n }\n }\n }\n }\n`;\n/**\n * ##################\n * List File Tags Query Response\n */\nexport interface ListFileTagsQueryResponse {\n fileManager: {\n listTags: string[];\n error: Error | null;\n };\n}\nexport const LIST_TAGS = gql`\n query ListTags($where: TagWhereInput) {\n fileManager {\n listTags(where: $where)\n }\n }\n`;\n/**\n * ##################\n * Create File Mutation Response\n */\nexport interface CreateFileMutationResponse {\n fileManager: {\n createFile: {\n data: FileItem;\n error?: Error | null;\n };\n };\n}\nexport interface FileInput {\n key: string;\n name: string;\n size: number;\n type: string;\n tags: string;\n meta: Record<string, any>;\n}\nexport interface CreateFileMutationVariables {\n data: FileInput;\n}\nexport const CREATE_FILE = gql`\n mutation CreateFile($data: CreateFileInput!) {\n fileManager {\n createFile(data: $data) {\n error ${ERROR_FIELDS}\n data ${FILE_FIELDS}\n }\n }\n }\n`;\n/**\n * ##################\n * Update File Mutation Response\n */\nexport interface UpdateFileMutationResponse {\n fileManager: {\n updateFile: {\n data: FileItem;\n error?: Error | null;\n };\n };\n}\nexport interface UpdateFileMutationVariables {\n id: string;\n data: Partial<FileInput>;\n}\nexport const UPDATE_FILE = gql`\n mutation UpdateFile($id: ID!, $data: UpdateFileInput!) {\n fileManager {\n updateFile(id: $id, data: $data) {\n data {\n id\n src\n name\n tags\n }\n error ${ERROR_FIELDS}\n }\n }\n }\n`;\n\n/**\n * ##################\n * Delete File Mutation Response\n */\nexport interface DeleteFileMutationResponse {\n fileManager: {\n updateFile: {\n data: boolean;\n error?: Error | null;\n };\n };\n}\nexport interface DeleteFileMutationVariables {\n id: string;\n}\nexport const DELETE_FILE = gql`\n mutation deleteFile($id: ID!) {\n fileManager {\n deleteFile(id: $id) {\n data\n error ${ERROR_FIELDS}\n }\n }\n }\n`;\n\nexport const GET_FILE_SETTINGS = gql`\n query getSettings {\n fileManager {\n getSettings {\n data {\n uploadMinFileSize\n uploadMaxFileSize\n }\n error ${ERROR_FIELDS}\n }\n }\n }\n`;\n"],"mappings":";;;;;;;;AAAA;AAA8B;AAG9B,IAAMA,WAAW,GAAG,qOAgBnB;AAED,IAAMC,YAAY,GAAG,4EAMpB;;AAED;AACA;AACA;AACA;;AAsBO,IAAMC,UAAU,OAAGC,mBAAG,srBAkBNH,WAAW,CAQjC;AACD;AACA;AACA;AACA;AAHA;AAUO,IAAMI,SAAS,OAAGD,mBAAG,mNAM3B;AACD;AACA;AACA;AACA;AAHA;AAuBO,IAAME,WAAW,OAAGF,mBAAG,mSAINF,YAAY,EACbD,WAAW,CAIjC;AACD;AACA;AACA;AACA;AAHA;AAgBO,IAAMM,WAAW,OAAGH,mBAAG,2aAUNF,YAAY,CAInC;;AAED;AACA;AACA;AACA;AAHA;AAeO,IAAMM,WAAW,OAAGJ,mBAAG,2QAKNF,YAAY,CAInC;AAAC;AAEK,IAAMO,iBAAiB,OAAGL,mBAAG,0VAQZF,YAAY,CAInC;AAAC"}
@@ -10,6 +10,7 @@ export interface FileItem {
10
10
  size: number;
11
11
  type: string;
12
12
  tags: string[];
13
+ aliases: string[];
13
14
  createdOn: string;
14
15
  createdBy: {
15
16
  id: string;
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { SecurityPermission } from \"@webiny/app-security/types\";\n\n/**\n * Represents a file as we receive from the GraphQL API.\n */\nexport interface FileItem {\n id: string;\n name: string;\n key: string;\n src: string;\n size: number;\n type: string;\n tags: string[];\n createdOn: string;\n createdBy: {\n id: string;\n };\n}\n\nexport interface FileManagerSecurityPermission extends SecurityPermission {\n rwd?: string;\n own?: boolean;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { SecurityPermission } from \"@webiny/app-security/types\";\n\n/**\n * Represents a file as we receive from the GraphQL API.\n */\nexport interface FileItem {\n id: string;\n name: string;\n key: string;\n src: string;\n size: number;\n type: string;\n tags: string[];\n aliases: string[];\n createdOn: string;\n createdBy: {\n id: string;\n };\n}\n\nexport interface FileManagerSecurityPermission extends SecurityPermission {\n rwd?: string;\n own?: boolean;\n}\n"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-admin",
3
- "version": "0.0.0-unstable.d7f521b032",
3
+ "version": "0.0.0-unstable.ecd8734205",
4
4
  "main": "index.js",
5
5
  "description": "A collection of plugins that together form a complete admin interface, customizable and extensible with Webiny apps and plugins.",
6
6
  "repository": {
@@ -17,20 +17,21 @@
17
17
  "@editorjs/editorjs": "2.26.5",
18
18
  "@emotion/core": "10.3.1",
19
19
  "@emotion/styled": "10.3.0",
20
+ "@material-design-icons/svg": "0.14.3",
20
21
  "@svgr/webpack": "6.5.1",
21
22
  "@types/mime": "2.0.3",
22
23
  "@types/react": "17.0.39",
23
- "@webiny/app": "0.0.0-unstable.d7f521b032",
24
- "@webiny/app-security": "0.0.0-unstable.d7f521b032",
25
- "@webiny/app-wcp": "0.0.0-unstable.d7f521b032",
26
- "@webiny/form": "0.0.0-unstable.d7f521b032",
27
- "@webiny/plugins": "0.0.0-unstable.d7f521b032",
28
- "@webiny/react-composition": "0.0.0-unstable.d7f521b032",
29
- "@webiny/react-router": "0.0.0-unstable.d7f521b032",
30
- "@webiny/telemetry": "0.0.0-unstable.d7f521b032",
31
- "@webiny/ui": "0.0.0-unstable.d7f521b032",
32
- "@webiny/ui-composer": "0.0.0-unstable.d7f521b032",
33
- "@webiny/validation": "0.0.0-unstable.d7f521b032",
24
+ "@webiny/app": "0.0.0-unstable.ecd8734205",
25
+ "@webiny/app-security": "0.0.0-unstable.ecd8734205",
26
+ "@webiny/app-wcp": "0.0.0-unstable.ecd8734205",
27
+ "@webiny/form": "0.0.0-unstable.ecd8734205",
28
+ "@webiny/plugins": "0.0.0-unstable.ecd8734205",
29
+ "@webiny/react-composition": "0.0.0-unstable.ecd8734205",
30
+ "@webiny/react-router": "0.0.0-unstable.ecd8734205",
31
+ "@webiny/telemetry": "0.0.0-unstable.ecd8734205",
32
+ "@webiny/ui": "0.0.0-unstable.ecd8734205",
33
+ "@webiny/ui-composer": "0.0.0-unstable.ecd8734205",
34
+ "@webiny/validation": "0.0.0-unstable.ecd8734205",
34
35
  "apollo-cache": "1.3.5",
35
36
  "apollo-client": "2.6.10",
36
37
  "apollo-link": "1.2.14",
@@ -57,7 +58,6 @@
57
58
  "react-hotkeyz": "1.0.4",
58
59
  "react-lazy-load": "3.1.14",
59
60
  "react-transition-group": "4.4.5",
60
- "semver": "7.3.8",
61
61
  "store": "2.0.12"
62
62
  },
63
63
  "devDependencies": {
@@ -70,8 +70,8 @@
70
70
  "@types/bytes": "^3.1.1",
71
71
  "@types/graphlib": "^2.1.8",
72
72
  "@types/store": "^2.0.2",
73
- "@webiny/cli": "^0.0.0-unstable.d7f521b032",
74
- "@webiny/project-utils": "^0.0.0-unstable.d7f521b032",
73
+ "@webiny/cli": "^0.0.0-unstable.ecd8734205",
74
+ "@webiny/project-utils": "^0.0.0-unstable.ecd8734205",
75
75
  "babel-plugin-emotion": "^9.2.8",
76
76
  "babel-plugin-lodash": "^3.3.4",
77
77
  "rimraf": "^3.0.2",
@@ -98,5 +98,5 @@
98
98
  ]
99
99
  }
100
100
  },
101
- "gitHead": "d7f521b0325964664dbeb6d2d07e2b6518e53841"
101
+ "gitHead": "ecd8734205e0e21ae04076c28ff9806dad07a730"
102
102
  }
@@ -1,21 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { Plugin } from "@webiny/plugins";
3
- interface File {
4
- id: string;
5
- name: string;
6
- key: string;
7
- src: string;
8
- size: number;
9
- type: string;
10
- tags: string[];
11
- createdOn: string;
12
- createdBy: {
13
- id: string;
14
- };
15
- [key: string]: any;
16
- }
3
+ import { FileItem } from "../components/FileManager/types";
17
4
  export interface RenderParams {
18
- file: File;
5
+ file: FileItem;
19
6
  }
20
7
  interface Config {
21
8
  types: string[];
@@ -1 +1 @@
1
- {"version":3,"names":["FileManagerFileTypePlugin","config","types","actions","params","render","Plugin"],"sources":["FileManagerFileTypePlugin.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\n\ninterface File {\n id: string;\n name: string;\n key: string;\n src: string;\n size: number;\n type: string;\n tags: string[];\n createdOn: string;\n createdBy: {\n id: string;\n };\n [key: string]: any;\n}\n\nexport interface RenderParams {\n file: File;\n}\n\ninterface Config {\n types: string[];\n actions?: React.ComponentType<any>[];\n render(params: RenderParams): React.ReactNode;\n}\n\nexport class FileManagerFileTypePlugin extends Plugin {\n public static override readonly type: string = \"admin-file-manager-file-type\";\n private readonly config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this.config = config || {};\n }\n\n get types(): string[] {\n return this.config.types || [];\n }\n\n get actions(): React.ComponentType[] {\n return this.config.actions || [];\n }\n\n public render(params: RenderParams): React.ReactNode {\n if (!this.config.render) {\n return null;\n }\n return this.config.render(params);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;AAAyC,IA2B5BA,yBAAyB;EAAA;EAAA;EAIlC,mCAAmBC,MAAe,EAAE;IAAA;IAAA;IAChC;IAAQ;IACR,MAAKA,MAAM,GAAGA,MAAM,IAAI,CAAC,CAAC;IAAC;EAC/B;EAAC;IAAA;IAAA,KAED,eAAsB;MAClB,OAAO,IAAI,CAACA,MAAM,CAACC,KAAK,IAAI,EAAE;IAClC;EAAC;IAAA;IAAA,KAED,eAAqC;MACjC,OAAO,IAAI,CAACD,MAAM,CAACE,OAAO,IAAI,EAAE;IACpC;EAAC;IAAA;IAAA,OAED,gBAAcC,MAAoB,EAAmB;MACjD,IAAI,CAAC,IAAI,CAACH,MAAM,CAACI,MAAM,EAAE;QACrB,OAAO,IAAI;MACf;MACA,OAAO,IAAI,CAACJ,MAAM,CAACI,MAAM,CAACD,MAAM,CAAC;IACrC;EAAC;EAAA;AAAA,EAtB0CE,eAAM;AAAA;AAAA,8BAAxCN,yBAAyB,UACa,8BAA8B"}
1
+ {"version":3,"names":["FileManagerFileTypePlugin","config","types","actions","params","render","Plugin"],"sources":["FileManagerFileTypePlugin.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins\";\nimport { FileItem } from \"~/components/FileManager/types\";\n\nexport interface RenderParams {\n file: FileItem;\n}\n\ninterface Config {\n types: string[];\n actions?: React.ComponentType<any>[];\n render(params: RenderParams): React.ReactNode;\n}\n\nexport class FileManagerFileTypePlugin extends Plugin {\n public static override readonly type: string = \"admin-file-manager-file-type\";\n private readonly config: Partial<Config>;\n\n public constructor(config?: Config) {\n super();\n this.config = config || {};\n }\n\n get types(): string[] {\n return this.config.types || [];\n }\n\n get actions(): React.ComponentType[] {\n return this.config.actions || [];\n }\n\n public render(params: RenderParams): React.ReactNode {\n if (!this.config.render) {\n return null;\n }\n return this.config.render(params);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;AAAyC,IAa5BA,yBAAyB;EAAA;EAAA;EAIlC,mCAAmBC,MAAe,EAAE;IAAA;IAAA;IAChC;IAAQ;IACR,MAAKA,MAAM,GAAGA,MAAM,IAAI,CAAC,CAAC;IAAC;EAC/B;EAAC;IAAA;IAAA,KAED,eAAsB;MAClB,OAAO,IAAI,CAACA,MAAM,CAACC,KAAK,IAAI,EAAE;IAClC;EAAC;IAAA;IAAA,KAED,eAAqC;MACjC,OAAO,IAAI,CAACD,MAAM,CAACE,OAAO,IAAI,EAAE;IACpC;EAAC;IAAA;IAAA,OAED,gBAAcC,MAAoB,EAAmB;MACjD,IAAI,CAAC,IAAI,CAACH,MAAM,CAACI,MAAM,EAAE;QACrB,OAAO,IAAI;MACf;MACA,OAAO,IAAI,CAACJ,MAAM,CAACI,MAAM,CAACD,MAAM,CAAC;IACrC;EAAC;EAAA;AAAA,EAtB0CE,eAAM;AAAA;AAAA,8BAAxCN,yBAAyB,UACa,8BAA8B"}
package/types.d.ts CHANGED
@@ -2,9 +2,7 @@ import React, { ReactElement } from "react";
2
2
  import { Plugin } from "@webiny/plugins/types";
3
3
  import { ApolloClient } from "apollo-client";
4
4
  import { ItemProps, MenuProps, SectionProps } from "./plugins/MenuPlugin";
5
- declare type RenderParams = {
6
- content: React.ReactNode;
7
- };
5
+ import { FileItem } from "./components/FileManager/types";
8
6
  export declare type AdminGlobalSearchPlugin = Plugin & {
9
7
  type: "admin-global-search";
10
8
  label: string;
@@ -18,10 +16,6 @@ export declare type AdminGlobalSearchPreventHotkeyPlugin = Plugin & {
18
16
  type: "admin-global-search-prevent-hotkey";
19
17
  preventOpen(e: React.KeyboardEvent): boolean | void;
20
18
  };
21
- export declare type AdminDrawerFooterMenuPlugin = Plugin & {
22
- type: "admin-drawer-footer-menu";
23
- render(params: any): React.ReactElement;
24
- };
25
19
  /**
26
20
  * LEGACY TYPE. Only for backwards compatibility.
27
21
  */
@@ -30,10 +24,6 @@ export declare type AdminMenuLogoPlugin = Plugin & {
30
24
  type: "admin-menu-logo";
31
25
  render(): React.ReactElement;
32
26
  };
33
- export declare type AdminHeaderUserMenuPlugin = Plugin & {
34
- type: "admin-header-user-menu";
35
- render(): React.ReactElement;
36
- };
37
27
  /**
38
28
  * Enables adding custom menu sections and items in the main menu, located on the left side of the screen.
39
29
  * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#admin-menu
@@ -47,16 +37,8 @@ export declare type AdminMenuPlugin = Plugin & {
47
37
  }): React.ReactNode;
48
38
  order?: number;
49
39
  };
50
- /**
51
- * Enables adding custom header elements to the right side of the top bar.
52
- * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#admin-header-right
53
- */
54
- export declare type AdminHeaderRightPlugin = Plugin & {
55
- type: "admin-header-right";
56
- render(params: RenderParams): React.ReactNode;
57
- };
58
40
  export interface AdminFileManagerFileTypePluginRenderParams {
59
- file: string;
41
+ file: FileItem;
60
42
  }
61
43
  export declare type AdminFileManagerFileTypePlugin = Plugin & {
62
44
  type: "admin-file-manager-file-type";
@@ -78,16 +60,9 @@ export declare type AdminInstallationPlugin = Plugin & {
78
60
  dependencies?: string[];
79
61
  secure: boolean;
80
62
  render(params: AdminInstallationPluginRenderParams): React.ReactNode;
81
- upgrades?: {
82
- version: string;
83
- getComponent(): React.ComponentType<{
84
- onInstalled: () => void;
85
- }>;
86
- }[];
87
63
  };
88
64
  export declare type AdminAppPermissionRendererPlugin = Plugin & {
89
65
  type: "admin-app-permissions-renderer";
90
66
  system?: boolean;
91
67
  render(params: any): ReactElement;
92
68
  };
93
- export {};
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ApolloClient } from \"apollo-client\";\nimport { ItemProps, MenuProps, SectionProps } from \"~/plugins/MenuPlugin\";\n\ntype RenderParams = {\n content: React.ReactNode;\n};\n\nexport type AdminGlobalSearchPlugin = Plugin & {\n type: \"admin-global-search\";\n label: string;\n route: string;\n search?: {\n operator?: \"and\" | \"or\";\n fields?: Array<string>;\n };\n};\n\nexport type AdminGlobalSearchPreventHotkeyPlugin = Plugin & {\n type: \"admin-global-search-prevent-hotkey\";\n preventOpen(e: React.KeyboardEvent): boolean | void;\n};\n\nexport type AdminDrawerFooterMenuPlugin = Plugin & {\n type: \"admin-drawer-footer-menu\";\n render(params: any): React.ReactElement;\n};\n\n/**\n * LEGACY TYPE. Only for backwards compatibility.\n */\nexport type AdminMenuLogoPlugin = Plugin & {\n name: \"admin-menu-logo\";\n type: \"admin-menu-logo\";\n render(): React.ReactElement;\n};\n\nexport type AdminHeaderUserMenuPlugin = Plugin & {\n type: \"admin-header-user-menu\";\n render(): React.ReactElement;\n};\n\n/**\n * Enables adding custom menu sections and items in the main menu, located on the left side of the screen.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#admin-menu\n */\nexport type AdminMenuPlugin = Plugin & {\n type: \"admin-menu\";\n render(props: {\n Menu: React.ComponentType<MenuProps>;\n Section: React.ComponentType<SectionProps>;\n Item: React.ComponentType<ItemProps>;\n }): React.ReactNode;\n order?: number;\n};\n\n/**\n * Enables adding custom header elements to the right side of the top bar.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#admin-header-right\n */\nexport type AdminHeaderRightPlugin = Plugin & {\n type: \"admin-header-right\";\n render(params: RenderParams): React.ReactNode;\n};\n\nexport interface AdminFileManagerFileTypePluginRenderParams {\n file: string;\n}\nexport type AdminFileManagerFileTypePlugin = Plugin & {\n type: \"admin-file-manager-file-type\";\n types: string[];\n render(params: AdminFileManagerFileTypePluginRenderParams): React.ReactNode;\n fileDetails?: {\n actions: Array<React.FC | React.Component>;\n };\n};\n\nexport interface AdminInstallationPluginRenderParams {\n onInstalled: () => Promise<void>;\n}\nexport type AdminInstallationPlugin = Plugin & {\n type: \"admin-installation\";\n getInstalledVersion(params: { client: ApolloClient<object> }): Promise<string | null>;\n title: string;\n dependencies?: string[];\n secure: boolean;\n render(params: AdminInstallationPluginRenderParams): React.ReactNode;\n upgrades?: {\n version: string;\n getComponent(): React.ComponentType<{ onInstalled: () => void }>;\n }[];\n};\n\nexport type AdminAppPermissionRendererPlugin = Plugin & {\n type: \"admin-app-permissions-renderer\";\n system?: boolean;\n render(params: any): ReactElement;\n};\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import React, { ReactElement } from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ApolloClient } from \"apollo-client\";\nimport { ItemProps, MenuProps, SectionProps } from \"~/plugins/MenuPlugin\";\nimport { FileItem } from \"~/components/FileManager/types\";\n\nexport type AdminGlobalSearchPlugin = Plugin & {\n type: \"admin-global-search\";\n label: string;\n route: string;\n search?: {\n operator?: \"and\" | \"or\";\n fields?: Array<string>;\n };\n};\n\nexport type AdminGlobalSearchPreventHotkeyPlugin = Plugin & {\n type: \"admin-global-search-prevent-hotkey\";\n preventOpen(e: React.KeyboardEvent): boolean | void;\n};\n\n/**\n * LEGACY TYPE. Only for backwards compatibility.\n */\nexport type AdminMenuLogoPlugin = Plugin & {\n name: \"admin-menu-logo\";\n type: \"admin-menu-logo\";\n render(): React.ReactElement;\n};\n\n/**\n * Enables adding custom menu sections and items in the main menu, located on the left side of the screen.\n * @see https://docs.webiny.com/docs/webiny-apps/admin/development/plugins-reference/app#admin-menu\n */\nexport type AdminMenuPlugin = Plugin & {\n type: \"admin-menu\";\n render(props: {\n Menu: React.ComponentType<MenuProps>;\n Section: React.ComponentType<SectionProps>;\n Item: React.ComponentType<ItemProps>;\n }): React.ReactNode;\n order?: number;\n};\n\nexport interface AdminFileManagerFileTypePluginRenderParams {\n file: FileItem;\n}\nexport type AdminFileManagerFileTypePlugin = Plugin & {\n type: \"admin-file-manager-file-type\";\n types: string[];\n render(params: AdminFileManagerFileTypePluginRenderParams): React.ReactNode;\n fileDetails?: {\n actions: Array<React.FC | React.Component>;\n };\n};\n\nexport interface AdminInstallationPluginRenderParams {\n onInstalled: () => Promise<void>;\n}\nexport type AdminInstallationPlugin = Plugin & {\n type: \"admin-installation\";\n getInstalledVersion(params: { client: ApolloClient<object> }): Promise<string | null>;\n title: string;\n dependencies?: string[];\n secure: boolean;\n render(params: AdminInstallationPluginRenderParams): React.ReactNode;\n};\n\nexport type AdminAppPermissionRendererPlugin = Plugin & {\n type: \"admin-app-permissions-renderer\";\n system?: boolean;\n render(params: any): ReactElement;\n};\n"],"mappings":""}