@epam/ai-dial-react-file-manager 0.1.0-dev.13
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.
- package/LICENSE +201 -0
- package/README.md +144 -0
- package/dist/ai-dial-react-file-manager.es.js +5188 -0
- package/dist/index.css +1 -0
- package/dist/src/components/FileManager/FileManager.d.ts +319 -0
- package/dist/src/components/FileManager/FileManagerContext.d.ts +180 -0
- package/dist/src/components/FileManager/FileManagerProvider.d.ts +20 -0
- package/dist/src/components/FileManager/FileManagerTooltip.d.ts +12 -0
- package/dist/src/components/FileManager/components/ConflictResolutionPopup/ConflictResolutionPopup.d.ts +90 -0
- package/dist/src/components/FileManager/components/DestinationFolderPopup/DestinationFolderPopup.d.ts +68 -0
- package/dist/src/components/FileManager/components/DialFileManagerItemSummaryCell/DialFileManagerItemSummaryCell.d.ts +63 -0
- package/dist/src/components/FileManager/components/FileManagerBulkActionsToolbar/FileManagerBulkActionsToolbar.d.ts +56 -0
- package/dist/src/components/FileManager/components/FileManagerBulkActionsToolbar/constants.d.ts +3 -0
- package/dist/src/components/FileManager/components/FileManagerDeleteConfirmationPopup/FileManagerDeleteConfirmationPopup.d.ts +26 -0
- package/dist/src/components/FileManager/components/FileManagerItemIcon/FileManagerItemIcon.d.ts +50 -0
- package/dist/src/components/FileManager/components/FileManagerItemName/FileManagerItemName.d.ts +57 -0
- package/dist/src/components/FileManager/components/FileManagerItemNameInput/FileManagerItemNameInput.d.ts +71 -0
- package/dist/src/components/FileManager/components/FileManagerNavigationPanel/FileManagerNavigationPanel.d.ts +63 -0
- package/dist/src/components/FileManager/components/FileManagerNavigationPanel/constants.d.ts +3 -0
- package/dist/src/components/FileManager/components/FileManagerToolbar/DialFileManagerToolbar.d.ts +74 -0
- package/dist/src/components/FileManager/components/FileMetadataPopup/FileMetadataPopup.d.ts +50 -0
- package/dist/src/components/FileManager/components/FileMetadataPopup/constants.d.ts +6 -0
- package/dist/src/components/FileManager/components/FoldersTree/FoldersTree.d.ts +132 -0
- package/dist/src/components/FileManager/components/FoldersTree/constants.d.ts +6 -0
- package/dist/src/components/FileManager/components/FoldersTree/hooks/use-expanded-paths.d.ts +13 -0
- package/dist/src/components/FileManager/constants.d.ts +21 -0
- package/dist/src/components/FileManager/errors.d.ts +6 -0
- package/dist/src/components/FileManager/hooks/use-bulk-actions.d.ts +30 -0
- package/dist/src/components/FileManager/hooks/use-collapse-tree.d.ts +9 -0
- package/dist/src/components/FileManager/hooks/use-conflict-resolution.d.ts +27 -0
- package/dist/src/components/FileManager/hooks/use-current-path.d.ts +13 -0
- package/dist/src/components/FileManager/hooks/use-file-clipboard.d.ts +37 -0
- package/dist/src/components/FileManager/hooks/use-file-delete.d.ts +13 -0
- package/dist/src/components/FileManager/hooks/use-file-download.d.ts +9 -0
- package/dist/src/components/FileManager/hooks/use-file-manager-columns.d.ts +43 -0
- package/dist/src/components/FileManager/hooks/use-file-manager-context.d.ts +5 -0
- package/dist/src/components/FileManager/hooks/use-file-manager-tabs.d.ts +7 -0
- package/dist/src/components/FileManager/hooks/use-file-metadata.d.ts +10 -0
- package/dist/src/components/FileManager/hooks/use-file-search.d.ts +23 -0
- package/dist/src/components/FileManager/hooks/use-file-upload.d.ts +62 -0
- package/dist/src/components/FileManager/hooks/use-folder-creation.d.ts +30 -0
- package/dist/src/components/FileManager/hooks/use-grid-actions-column.d.ts +15 -0
- package/dist/src/components/FileManager/hooks/use-grid-context-menu.d.ts +43 -0
- package/dist/src/components/FileManager/hooks/use-item-renaming.d.ts +22 -0
- package/dist/src/components/FileManager/hooks/use-new-actions.d.ts +23 -0
- package/dist/src/components/FileManager/hooks/use-paths-selection.d.ts +13 -0
- package/dist/src/components/FileManager/hooks/use-show-hidden-files.d.ts +9 -0
- package/dist/src/components/FileManager/hooks/use-tree-additional-buttons.d.ts +22 -0
- package/dist/src/components/FileManager/hooks/use-trigger-view-create-folder.d.ts +26 -0
- package/dist/src/components/FileManager/hooks/use-trigger-view-rename.d.ts +20 -0
- package/dist/src/components/FileManager/utils.d.ts +58 -0
- package/dist/src/constants/file-grid-columns.d.ts +4 -0
- package/dist/src/hooks/use-flexible-actions.d.ts +88 -0
- package/dist/src/hooks/use-is-mobile-screen.d.ts +15 -0
- package/dist/src/hooks/use-width-breakpoint.d.ts +25 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/models/base-entity.d.ts +4 -0
- package/dist/src/models/file-manager.d.ts +19 -0
- package/dist/src/models/file.d.ts +39 -0
- package/dist/src/models/selection-mode.d.ts +4 -0
- package/dist/src/types/file-manager.d.ts +59 -0
- package/dist/src/types/screen.d.ts +6 -0
- package/dist/src/utils/mobile.d.ts +49 -0
- package/dist/src/utils/path.d.ts +10 -0
- package/package.json +141 -0
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.-bottom-0\.5{bottom:-.125rem}.-left-0\.5{left:-.125rem}.left-0{left:0}.right-0{right:0}.top-0{top:0}.z-0{z-index:0}.z-\[-1\]{z-index:-1}.mx-2{margin-left:.5rem;margin-right:.5rem}.my-2{margin-top:.5rem}.mb-2,.my-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-\[2px\]{margin-bottom:2px}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.contents{display:contents}.hidden{display:none}.size-9{width:2.25rem;height:2.25rem}.size-\[400px\]{width:400px;height:400px}.size-full{width:100%;height:100%}.\!h-10{height:2.5rem!important}.\!h-6{height:1.5rem!important}.\!h-9{height:2.25rem!important}.\!h-\[600px\]{height:600px!important}.h-6{height:1.5rem}.h-\[100px\]{height:100px}.h-\[26px\]{height:26px}.h-\[38px\]{height:38px}.h-\[640px\]{height:640px}.h-\[740px\]{height:740px}.h-full{height:100%}.min-h-0{min-height:0}.min-h-\[248px\]{min-height:248px}.w-\[1000px\]{width:1000px}.w-\[260px\]{width:260px}.w-\[40px\]{width:40px}.w-\[600px\]{width:600px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0}.max-w-\[300px\]{max-width:300px}.max-w-\[428px\]{max-width:428px}.flex-1{flex:1 1 0%}.flex-none{flex:none}.flex-shrink-0,.shrink-0{flex-shrink:0}.rotate-180{--tw-rotate:180deg}.rotate-180,.rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate:90deg}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.resize{resize:both}.list-none{list-style-type:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-rows-\[auto_1fr\]{grid-template-rows:auto 1fr}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.gap-\[2px\]{gap:2px}.gap-x-1{-moz-column-gap:.25rem;column-gap:.25rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem*var(--tw-space-x-reverse));margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem*var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis}.truncate,.whitespace-nowrap{white-space:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded,.rounded-\[4px\]{border-radius:4px}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-accent-primary{border-color:var(--stroke-accent-primary,#7da4ff)}.border-primary{border-color:var(--stroke-primary,#696e7c)}.border-tertiary{border-color:var(--stroke-tertiary,#0c101d)}.border-l-accent-primary{border-left-color:var(--stroke-accent-primary,#7da4ff)}.border-l-transparent{border-left-color:transparent}.\!bg-layer-2{background-color:var(--bg-layer-2,#161b2d)!important}.bg-accent-primary-alpha{background-color:var(--bg-accent-primary-alpha,#7da4ff26)}.bg-controls-disable-accent{background-color:var(--controls-bg-disable-accent,#696e7c)}.bg-layer-0{background-color:var(--bg-layer-0,#000)}.bg-layer-1{background-color:var(--bg-layer-1,#0c101d)}.bg-layer-2{background-color:var(--bg-layer-2,#161b2d)}.bg-layer-3{background-color:var(--bg-layer-3,#1d2439)}.bg-layer-4{background-color:var(--bg-layer-4,#242c42)}.bg-transparent{background-color:transparent}.\!p-\[9px\]{padding:9px!important}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-\[1px\]{padding-top:1px;padding-bottom:1px}.pl-1{padding-left:.25rem}.pl-2\.5{padding-left:.625rem}.pl-6{padding-left:1.5rem}.pl-\[7px\]{padding-left:7px}.pr-\[7px\]{padding-right:7px}.pt-0{padding-top:0}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-center{text-align:center}.align-middle{vertical-align:middle}.\!text-lg{font-size:1.125rem!important;line-height:1.75rem!important}.text-sm{font-size:.875rem;line-height:1.25rem}.italic{font-style:italic}.text-accent-primary{color:var(--text-accent-primary,#7da4ff)}.text-accent-secondary{color:var(--text-accent-secondary,#37babc)}.text-accent-tertiary{color:var(--text-accent-tertiary,#a972ff)}.text-error{color:var(--text-error,#f76464)}.text-primary{color:var(--text-primary,#eef1f7)}.text-secondary{color:var(--text-secondary,#9fa6bd)}.text-transparent{color:transparent}.text-warning-icon{color:var(--text-warning-icon,#eec840)}.opacity-0{opacity:0}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.hover\:bg-accent-primary-alpha:hover{background-color:var(--bg-accent-primary-alpha,#7da4ff26)}.hover\:text-accent-primary:hover{color:var(--text-accent-primary,#7da4ff)}.disabled\:hover\:cursor-default:hover:disabled{cursor:default}.group\/grid-row:hover .group-hover\/grid-row\:pointer-events-auto{pointer-events:auto}.group\/item:hover .group-hover\/item\:visible{visibility:visible}.group\/grid-row:hover .group-hover\/grid-row\:bg-accent-primary-alpha,.group\/item:hover .group-hover\/item\:bg-accent-primary-alpha{background-color:var(--bg-accent-primary-alpha,#7da4ff26)}.group\/grid-row:hover .group-hover\/grid-row\:opacity-100{opacity:1}@media (min-width:640px){.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:768px){.md\:\!h-\[800px\]{height:800px!important}.md\:min-h-\[266px\]{min-height:266px}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:px-6{padding-left:1.5rem;padding-right:1.5rem}}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { ColDef, GridApi } from '../../../node_modules/ag-grid-community';
|
|
2
|
+
import { FC, ReactNode, Ref, RefObject } from '../../../node_modules/react';
|
|
3
|
+
import { DialGridProps, DropdownItem } from '@epam/ai-dial-ui-kit';
|
|
4
|
+
import { ConflictResolutionPopupProps } from './components/ConflictResolutionPopup/ConflictResolutionPopup';
|
|
5
|
+
import { FileUploadValidationMessages, FileUploadValidationResult } from './hooks/use-file-upload';
|
|
6
|
+
import { RenameValidationMessages } from './hooks/use-item-renaming';
|
|
7
|
+
import { DialFile, DialRootFolder } from '../../models/file';
|
|
8
|
+
import { DialCopiedItem, DialDeletedItem, DialFileAcceptType, DialFileManagerActionsRef, DialUploadFileItem } from '../../models/file-manager';
|
|
9
|
+
import { GridSelectionMode } from '../../models/selection-mode.ts';
|
|
10
|
+
import { DialFileManagerActions, FileManagerColumnKey } from '../../types/file-manager';
|
|
11
|
+
import { FileManagerGridRow } from './FileManagerContext';
|
|
12
|
+
import { DestinationFolderPopupProps } from './components/DestinationFolderPopup/DestinationFolderPopup';
|
|
13
|
+
import { DialFileManagerBulkActionsToolbarProps } from './components/FileManagerBulkActionsToolbar/FileManagerBulkActionsToolbar';
|
|
14
|
+
import { DialFileManagerNavigationPanelProps } from './components/FileManagerNavigationPanel/FileManagerNavigationPanel';
|
|
15
|
+
import { DialFileManagerToolbarProps } from './components/FileManagerToolbar/DialFileManagerToolbar';
|
|
16
|
+
import { DialFoldersTreeProps } from './components/FoldersTree/FoldersTree';
|
|
17
|
+
type GridRow = FileManagerGridRow;
|
|
18
|
+
export type DialFileManagerConflictResolutionPopupOptions = Omit<ConflictResolutionPopupProps, 'open' | 'onClose' | 'onReplace' | 'onDuplicate' | 'conflictingFiles'>;
|
|
19
|
+
export type DialFileManagerDestinationFolderPopupOptions = Pick<DestinationFolderPopupProps, 'setDestinationFolderPath' | 'destinationFolderPath' | 'addFolderLabel' | 'copyLabel' | 'moveLabel' | 'hiddenFilesSwitcherLabel' | 'header' | 'onCreateFolder' | 'onCreateFolderValidate' | 'folderCreationValidationMessages' | 'disabledPathTooltip' | 'emptyStateTitle' | 'emptyStateDescription'> & {
|
|
20
|
+
getCopyHeader?: (itemsCount: number, itemName?: string) => string;
|
|
21
|
+
getMoveHeader?: (itemsCount: number, itemName?: string) => string;
|
|
22
|
+
processDestinationFolderPath?: (path: string) => string;
|
|
23
|
+
};
|
|
24
|
+
export interface FileMetadataPopupOptions {
|
|
25
|
+
fileMetadata?: DialFile;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
clearMetadata?: () => void;
|
|
28
|
+
header?: ReactNode;
|
|
29
|
+
nameLabel?: string;
|
|
30
|
+
pathLabel?: string;
|
|
31
|
+
modifiedDateLabel?: string;
|
|
32
|
+
sizeLabel?: string;
|
|
33
|
+
authorLabel?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface FileTreeOptions extends Omit<DialFoldersTreeProps, 'items' | 'selectedPath' | 'onItemClick'> {
|
|
36
|
+
width?: number;
|
|
37
|
+
header?: ReactNode;
|
|
38
|
+
containerClassName?: string;
|
|
39
|
+
additionalButtons?: ReactNode;
|
|
40
|
+
collapsed?: boolean;
|
|
41
|
+
onCollapseChange?: (collapsed: boolean) => void;
|
|
42
|
+
expandedPaths?: Set<string>;
|
|
43
|
+
loadedPaths?: Set<string>;
|
|
44
|
+
onExpandedPathsChange?: (expandedPaths: Set<string>) => void;
|
|
45
|
+
actionLabels?: {
|
|
46
|
+
[DialFileManagerActions.AddSibling]?: string;
|
|
47
|
+
[DialFileManagerActions.AddChild]?: string;
|
|
48
|
+
[DialFileManagerActions.Duplicate]?: string;
|
|
49
|
+
[DialFileManagerActions.Copy]?: string;
|
|
50
|
+
[DialFileManagerActions.Rename]?: string;
|
|
51
|
+
[DialFileManagerActions.Download]?: string;
|
|
52
|
+
[DialFileManagerActions.Delete]?: string;
|
|
53
|
+
[DialFileManagerActions.Move]?: string;
|
|
54
|
+
[DialFileManagerActions.Unshare]?: string;
|
|
55
|
+
[DialFileManagerActions.ManagePermissions]?: string;
|
|
56
|
+
[DialFileManagerActions.RemoveAccess]?: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface DeleteConfirmationOptions {
|
|
60
|
+
cancelLabel?: string;
|
|
61
|
+
titleRenderer?: (fileNames: string[]) => ReactNode;
|
|
62
|
+
confirmLabel?: string;
|
|
63
|
+
contentRenderer?: (fileNames: string[]) => ReactNode;
|
|
64
|
+
}
|
|
65
|
+
export type NavigationPanelOptions = Omit<DialFileManagerNavigationPanelProps, 'path' | 'makeHref' | 'onItemClick'>;
|
|
66
|
+
export interface GridOptions extends Omit<DialGridProps<GridRow>, 'rowData' | 'columnDefs'> {
|
|
67
|
+
columnDefs?: (ColDef<GridRow> | ((dateLocale: Intl.LocalesArgument, dateOptions: Intl.DateTimeFormatOptions | undefined, isCompactView: boolean) => ColDef<GridRow, unknown>))[];
|
|
68
|
+
filterable?: boolean;
|
|
69
|
+
dateLocale?: Intl.LocalesArgument;
|
|
70
|
+
dateOptions?: Intl.DateTimeFormatOptions;
|
|
71
|
+
showFiles?: boolean;
|
|
72
|
+
showFolders?: boolean;
|
|
73
|
+
visibleColumns?: FileManagerColumnKey[];
|
|
74
|
+
selectionMode?: GridSelectionMode;
|
|
75
|
+
wrapCustomCellRenderers?: boolean;
|
|
76
|
+
allowDisabledContextMenu?: boolean;
|
|
77
|
+
actionLabels?: {
|
|
78
|
+
[DialFileManagerActions.AddSibling]?: string;
|
|
79
|
+
[DialFileManagerActions.AddChild]?: string;
|
|
80
|
+
[DialFileManagerActions.Duplicate]?: string;
|
|
81
|
+
[DialFileManagerActions.Copy]?: string;
|
|
82
|
+
[DialFileManagerActions.Rename]?: string;
|
|
83
|
+
[DialFileManagerActions.Download]?: string;
|
|
84
|
+
[DialFileManagerActions.Delete]?: string;
|
|
85
|
+
[DialFileManagerActions.Move]?: string;
|
|
86
|
+
[DialFileManagerActions.Info]?: string;
|
|
87
|
+
[DialFileManagerActions.Unshare]?: string;
|
|
88
|
+
[DialFileManagerActions.ManagePermissions]?: string;
|
|
89
|
+
[DialFileManagerActions.Preview]?: string;
|
|
90
|
+
[DialFileManagerActions.RemoveAccess]?: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export type NewAction = Pick<DropdownItem, 'label' | 'icon'>;
|
|
94
|
+
export type ToolbarOptions = Omit<DialFileManagerToolbarProps, 'areHiddenFilesVisible' | 'onToggleHiddenFiles'> & {
|
|
95
|
+
newActions?: {
|
|
96
|
+
uploadFiles?: NewAction;
|
|
97
|
+
newFolder?: NewAction;
|
|
98
|
+
uploadArchive?: NewAction;
|
|
99
|
+
newItem?: NewAction;
|
|
100
|
+
};
|
|
101
|
+
showHiddenFilesToggle?: boolean;
|
|
102
|
+
};
|
|
103
|
+
export type BulkActionsToolbarOptions = Omit<DialFileManagerBulkActionsToolbarProps, 'onClearSelection' | 'actions' | 'selectedCount'> & {
|
|
104
|
+
actionLabels?: {
|
|
105
|
+
[DialFileManagerActions.Duplicate]?: string;
|
|
106
|
+
[DialFileManagerActions.Copy]?: string;
|
|
107
|
+
[DialFileManagerActions.Download]?: string;
|
|
108
|
+
[DialFileManagerActions.Delete]?: string;
|
|
109
|
+
[DialFileManagerActions.Move]?: string;
|
|
110
|
+
[DialFileManagerActions.Unshare]?: string;
|
|
111
|
+
[DialFileManagerActions.RemoveAccess]?: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export interface CreateFolderValidationMessages {
|
|
115
|
+
emptyName?: string;
|
|
116
|
+
duplicateName?: string;
|
|
117
|
+
forbiddenChars?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface DialFileManagerProps {
|
|
120
|
+
path?: string;
|
|
121
|
+
defaultPath?: string;
|
|
122
|
+
className?: string;
|
|
123
|
+
managerLabel?: ReactNode;
|
|
124
|
+
gridClassName?: string;
|
|
125
|
+
allowedFileTypes?: DialFileAcceptType[];
|
|
126
|
+
items?: DialFile[];
|
|
127
|
+
rootItem?: DialRootFolder;
|
|
128
|
+
filesLoading?: boolean;
|
|
129
|
+
sharedByMePaths?: Set<string>;
|
|
130
|
+
maxSelectableFileSize?: number;
|
|
131
|
+
selectedPaths?: Set<string>;
|
|
132
|
+
defaultSelectedPaths?: Set<string>;
|
|
133
|
+
onSelectedPathsChange?: (paths: Set<string>) => void;
|
|
134
|
+
showHiddenFiles?: boolean;
|
|
135
|
+
onShowHiddenFilesChange?: (value: boolean) => void;
|
|
136
|
+
treeOptions?: FileTreeOptions;
|
|
137
|
+
toolbarOptions?: ToolbarOptions;
|
|
138
|
+
showNavigationPanel?: boolean;
|
|
139
|
+
navigationPanelOptions?: NavigationPanelOptions;
|
|
140
|
+
gridOptions?: GridOptions;
|
|
141
|
+
bulkActionsToolbarOptions?: BulkActionsToolbarOptions;
|
|
142
|
+
deleteConfirmationOptions?: DeleteConfirmationOptions;
|
|
143
|
+
destinationFolderPopupOptions?: DialFileManagerDestinationFolderPopupOptions;
|
|
144
|
+
conflictResolutionPopupOptions?: DialFileManagerConflictResolutionPopupOptions;
|
|
145
|
+
compactViewWidthBreakpoint?: number;
|
|
146
|
+
customBreakpointRef?: RefObject<HTMLElement | null>;
|
|
147
|
+
onPathChange?: (nextPath?: string) => void;
|
|
148
|
+
onTableFileClick?: (file: GridRow) => void;
|
|
149
|
+
handleSelectionClick?: (file: GridRow[]) => void;
|
|
150
|
+
onGridApiChange?: (api: GridApi) => void;
|
|
151
|
+
onCopyFiles?: (items: DialCopiedItem[], destinationFolder: string) => void;
|
|
152
|
+
onMoveToFiles?: (items: DialCopiedItem[], sourceFolder: string, destinationFolder: string) => void;
|
|
153
|
+
onDeleteFiles?: (items: DialDeletedItem[], sourceFolder: string) => void;
|
|
154
|
+
onDownloadFiles?: (items: DialFile[]) => void;
|
|
155
|
+
onRenameValidate?: (value: string, item: DialFile) => string | null;
|
|
156
|
+
renameValidationMessages?: RenameValidationMessages;
|
|
157
|
+
forbiddenSymbolsRegExp?: RegExp;
|
|
158
|
+
forbiddenSymbolsTooltip?: ReactNode;
|
|
159
|
+
onCreateFolder?: (file: DialUploadFileItem, folderPath: string, fileId: string) => void | Promise<void>;
|
|
160
|
+
onCreateFolderValidate?: (name: string, parentFolder: DialFile) => string | null;
|
|
161
|
+
folderCreationValidationMessages?: CreateFolderValidationMessages;
|
|
162
|
+
getDisabledTooltip?: (row: FileManagerGridRow) => string | undefined;
|
|
163
|
+
fileTooLargeTooltip?: string;
|
|
164
|
+
unsupportedFileTypeTooltip?: string;
|
|
165
|
+
onUploadFiles?: (files: DialUploadFileItem[], destinationFolder: string) => void;
|
|
166
|
+
prepareUploadFileName?: (name: string) => string;
|
|
167
|
+
onValidateUpload?: (files: DialUploadFileItem[], existingFiles: DialFile[], destinationFolder: string) => FileUploadValidationResult | Promise<FileUploadValidationResult>;
|
|
168
|
+
maxFileSize?: number;
|
|
169
|
+
uploadValidationMessages?: FileUploadValidationMessages;
|
|
170
|
+
onUploadArchive?: (file: File, name: string, destinationFolder: string) => void;
|
|
171
|
+
uploadEnabled?: boolean;
|
|
172
|
+
fileMetadataPopupOptions?: FileMetadataPopupOptions;
|
|
173
|
+
onGetInfo?: (file: DialFile) => void | Promise<void>;
|
|
174
|
+
onUnshareFiles?: (files: DialFile[]) => void | Promise<void>;
|
|
175
|
+
onRemoveFilesAccess?: (files: DialFile[]) => void | Promise<void>;
|
|
176
|
+
actionsRef?: Ref<DialFileManagerActionsRef>;
|
|
177
|
+
onSearchFiles?: (folder: string, query: string) => void;
|
|
178
|
+
searchInProgress?: boolean;
|
|
179
|
+
searchResults?: DialFile[];
|
|
180
|
+
clearSearchResults?: () => void;
|
|
181
|
+
emptyStateIcon?: ReactNode;
|
|
182
|
+
emptyStateTitle?: string;
|
|
183
|
+
emptyStateDescription?: string;
|
|
184
|
+
sharedWithMeIds?: string[];
|
|
185
|
+
onFolderPopupPathChange?: (newPath?: string) => void;
|
|
186
|
+
onManagePermissions?: (path?: string) => void;
|
|
187
|
+
onPreview?: (path?: string) => void;
|
|
188
|
+
onOpenInNewTab?: (file: DialFile) => void;
|
|
189
|
+
previewExtensions?: string[];
|
|
190
|
+
isRenameFileAvailable?: boolean;
|
|
191
|
+
isDuplicateFolderAvailable?: boolean;
|
|
192
|
+
customUploadFileAction?: (currentPath?: string, currentFolder?: DialFile) => void;
|
|
193
|
+
customCreateNewItemAction?: (currentPath?: string, currentFolder?: DialFile) => void;
|
|
194
|
+
customDuplicateAction?: (items?: DialFile[]) => void;
|
|
195
|
+
customDeleteItemsAction?: (items: DialFile[], parentFolderPath: string) => void;
|
|
196
|
+
customDownloadItemsAction?: (items?: DialFile[]) => void;
|
|
197
|
+
nonClickableTableColumns?: FileManagerColumnKey[];
|
|
198
|
+
hideSearchPathItemName?: boolean;
|
|
199
|
+
showHiddenFileSwitcherInDestinationPopup?: boolean;
|
|
200
|
+
showCreateFolderButtonInDestinationPopup?: boolean;
|
|
201
|
+
autoSelectUploadedItems?: boolean;
|
|
202
|
+
maxNewFolderDepth?: number;
|
|
203
|
+
onNewFolderDepthExceeded?: () => void;
|
|
204
|
+
initialUploadFilesOpen?: boolean;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* File Manager layout with a collapsible folders tree, breadcrumb/search header, and a data grid.
|
|
208
|
+
* aliases: FileExplorer|FileBrowser
|
|
209
|
+
*
|
|
210
|
+
* Features:
|
|
211
|
+
* - Global `path` drives both the breadcrumb trail and the visible folder in the grid.
|
|
212
|
+
* - The grid shows children of the current folder. When a search query is present, it scans all nested descendants.
|
|
213
|
+
* - Pluggable tree, navigation panel, and grid behaviors via `treeOptions`, `navigationPanelOptions`, and `gridOptions`.
|
|
214
|
+
* - Optional filters toggle via `gridOptions.filterable` (default `true`).
|
|
215
|
+
* - Supports bulk actions toolbar when items are selected.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```tsx
|
|
219
|
+
* // Minimal usage
|
|
220
|
+
* <DialFileManager items={files} path="/All files" />
|
|
221
|
+
*
|
|
222
|
+
* // With loading state
|
|
223
|
+
* <DialFileManager items={files} path="/All files" filesLoading={true} />
|
|
224
|
+
*
|
|
225
|
+
* // With controlled search and disabled grid filters
|
|
226
|
+
* const [query, setQuery] = useState('');
|
|
227
|
+
* <DialFileManager
|
|
228
|
+
* items={files}
|
|
229
|
+
* path="/All files/Design"
|
|
230
|
+
* navigationPanelOptions={{
|
|
231
|
+
* searchable: true,
|
|
232
|
+
* value: query,
|
|
233
|
+
* onSearchChange: setQuery,
|
|
234
|
+
* }}
|
|
235
|
+
* gridOptions={{ filterable: false }}
|
|
236
|
+
* />
|
|
237
|
+
*
|
|
238
|
+
* // With custom tree width and title
|
|
239
|
+
* <DialFileManager
|
|
240
|
+
* items={files}
|
|
241
|
+
* treeOptions={{ width: 300, title: 'Explorer', showFiles: true }}
|
|
242
|
+
* />
|
|
243
|
+
*
|
|
244
|
+
* // With explicit provider (advanced apps)
|
|
245
|
+
* <FileManagerProvider items={files} path="/All files">
|
|
246
|
+
* <MyCustomHeader />
|
|
247
|
+
* <DialFileManagerView /> // internal view
|
|
248
|
+
* <MyCustomFooter />
|
|
249
|
+
* </FileManagerProvider>
|
|
250
|
+
* ```
|
|
251
|
+
*
|
|
252
|
+
* @param [path] - Absolute path of the current location (e.g. "/All files/Design/Icons")
|
|
253
|
+
* @param [defaultPath] - Initial path used in uncontrolled mode (applied only on first render)
|
|
254
|
+
* @param [className] - Additional classes for the root container
|
|
255
|
+
* @param [gridClassName] - Additional classes for the grid container
|
|
256
|
+
* @param [items] - Full hierarchical list of files and folders used by both tree and grid
|
|
257
|
+
* @param [rootItem] - Optional root folder item to represent the top-level container in the tree
|
|
258
|
+
* @param [filesLoading=false] - When true, shows skeleton loading state in the grid
|
|
259
|
+
* @param [selectedPaths] - Controlled set of selected item paths
|
|
260
|
+
* @param [defaultSelectedPaths] - Initial selected paths used in uncontrolled mode
|
|
261
|
+
*
|
|
262
|
+
* @param [treeOptions] - Options that configure the collapsible sidebar and folders tree
|
|
263
|
+
* @param [showNavigationPanel] - Determines whether to display the navigation panel.
|
|
264
|
+
* @param [navigationPanelOptions] - Options for the breadcrumb and search panel (value/onSearchChange for controlled search)
|
|
265
|
+
* @param [toolbarOptions] - Options for the file manager toolbar
|
|
266
|
+
* @param [gridOptions] - Options forwarded to `DialGrid`; supports `columnDefs` override and `filterable` flag and date locale/options
|
|
267
|
+
* @param [bulkActionsToolbarOptions] - Options for the bulk actions toolbar shown when items are selected
|
|
268
|
+
* @param [deleteConfirmationOptions] - Options for the delete confirmation popup
|
|
269
|
+
*
|
|
270
|
+
* @param [compactViewWidthBreakpoint=DEFAULT_COMPACT_VIEW_WIDTH_BREAKPOINT] - Width (px) below which the component switches to compact view.
|
|
271
|
+
*
|
|
272
|
+
* @param [onPathChange] - Callback fired when user navigates via tree or breadcrumb
|
|
273
|
+
* @param [onSelectedPathsChange] - Callback fired when the selected paths change
|
|
274
|
+
* @param [onTableFileClick] - Callback fired when a file row is clicked in the grid
|
|
275
|
+
*
|
|
276
|
+
* @param [onCopyFiles] - Callback fired when files copy-paste
|
|
277
|
+
* @param [onMoveToFiles] - Callback fired when files cut-paste or rename
|
|
278
|
+
* @param [onDeleteFiles] - Callback fired when files are deleted
|
|
279
|
+
*
|
|
280
|
+
* @param [onRenameValidate] - Optional callback to validate a file or folder name during renaming. Should return an error message string if the name is invalid, or null if it's valid.
|
|
281
|
+
* @param [renameValidationMessages] - Optional custom validation messages for renaming files and folders. Note that you need to add `${NotificationVariant.Warning}__` prefix to the `hiddenItemWarning` message to display it as a warning with the warning icon.
|
|
282
|
+
* @param [forbiddenSymbolsRegExp] - Optional RegExp will be used in the validation for the files and folders names. The "g" and "y" flags are not allowed in this RegExp and will be ignored.
|
|
283
|
+
* @param [forbiddenSymbolsTooltip] - Optional tooltip displayed when a file or folder name contains forbidden characters
|
|
284
|
+
*
|
|
285
|
+
* @param [onDownloadFiles] - Callback fired when files are downloaded
|
|
286
|
+
*
|
|
287
|
+
* @param [onUploadArchive] - Callback fired when archive files are uploaded
|
|
288
|
+
* @param [onUploadFiles] - Callback fired when files are uploaded
|
|
289
|
+
* @param [prepareUploadFileName] - Optional mapper applied to each uploaded item's name before conflict resolution runs and before `onUploadFiles`/`onUploadArchive` are called. Use it to sanitize or normalize names (e.g. stripping forbidden symbols). Conflict detection is performed against the mapped names, so renames take place before the conflict check.
|
|
290
|
+
* @param [onValidateUpload] - Callback to validate files before upload
|
|
291
|
+
* @param [maxFileSize] - Maximum allowed file size for uploads in bytes
|
|
292
|
+
* @param [uploadValidationMessages] - Custom validation messages for file uploads. Consumers can customize these strings for a11y and copy consistency.
|
|
293
|
+
* @param [uploadEnabled=true] - Whether files uploads are enabled
|
|
294
|
+
* @param [autoSelectUploadedItems=false] - When true, automatically selects newly uploaded or created items (files, archives, folders) after they appear in the current directory. Useful in attach flows where the user expects immediate selection feedback.
|
|
295
|
+
*
|
|
296
|
+
* @param [sharedByMePaths] - Set of items paths that the user has shared with others. Enables UI indicators (icons/badges) in the tree and grid.
|
|
297
|
+
*
|
|
298
|
+
* @param [actionsRef] - Ref exposing a limited set of imperative File Manager actions (e.g., creating a folder). Allows parent components to trigger internal behaviors programmatically. This ref is not a DOM ref and should be used only for invoking the component’s public actions API.
|
|
299
|
+
*
|
|
300
|
+
* @param [allowedFileTypes] - Allowed file types (same format as the HTML `<input accept>` attribute). Controls upload filtering and which items are disabled in the File Manager UI. Supports MIME types, wildcards (e.g. `image/*`), and extensions (e.g. `.svg`).
|
|
301
|
+
*
|
|
302
|
+
* @param [maxSelectableFileSize] - Maximum allowed file size for selection in bytes
|
|
303
|
+
*
|
|
304
|
+
* @param [emptyStateIcon] - Optional icon for empty state
|
|
305
|
+
* @param [emptyStateTitle] - Optional title text displayed when there are no files.
|
|
306
|
+
* @param [emptyStateDescription] - Optional description text displayed below the empty state title.
|
|
307
|
+
*
|
|
308
|
+
* @param [sharedWithMeIds] - Optional list of file IDs that are shared with the current user.
|
|
309
|
+
* @param [unsupportedFileTypeTooltip] - Optional tooltip text displayed when an unsupported file type is selected.
|
|
310
|
+
* @param [fileTooLargeTooltip] - Optional tooltip text displayed when a file is too large.
|
|
311
|
+
*/
|
|
312
|
+
export declare const DialFileManager: FC<DialFileManagerProps>;
|
|
313
|
+
/**
|
|
314
|
+
* Internal view-only component.
|
|
315
|
+
* Reads all data from FileManagerContext and renders the actual layout.
|
|
316
|
+
* This is what apps can reuse if they want to control the provider manually.
|
|
317
|
+
*/
|
|
318
|
+
export declare const DialFileManagerView: FC;
|
|
319
|
+
export {};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { DragEvent, ReactNode, Ref, RefObject } from '../../../node_modules/react';
|
|
2
|
+
import { DialFile, DialRootFolder, DialFileNodeType } from '../../models/file';
|
|
3
|
+
import { FileTreeOptions, NavigationPanelOptions, GridOptions, ToolbarOptions, BulkActionsToolbarOptions, DialFileManagerProps, DeleteConfirmationOptions, DialFileManagerDestinationFolderPopupOptions, DialFileManagerConflictResolutionPopupOptions, FileMetadataPopupOptions } from './FileManager';
|
|
4
|
+
import { FileUploadValidationMessages } from './hooks/use-file-upload';
|
|
5
|
+
import { DropdownItem } from '@epam/ai-dial-ui-kit';
|
|
6
|
+
import { FileConflictDecision } from './components/ConflictResolutionPopup/ConflictResolutionPopup';
|
|
7
|
+
import { DestinationFolderMode, FileManagerColumnKey } from '../../types/file-manager';
|
|
8
|
+
import { DialFileAcceptType, DialFileManagerActionsRef } from '../../models/file-manager';
|
|
9
|
+
import { GridApi } from '../../../node_modules/ag-grid-community';
|
|
10
|
+
export interface FileManagerGridRow {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
updatedAt?: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
author?: string;
|
|
16
|
+
path: string;
|
|
17
|
+
parentPath?: string | null;
|
|
18
|
+
nodeType: DialFileNodeType;
|
|
19
|
+
extension?: string;
|
|
20
|
+
isTemporary?: boolean;
|
|
21
|
+
owner?: string;
|
|
22
|
+
contentType?: string;
|
|
23
|
+
contentLength?: number;
|
|
24
|
+
folderId?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface FileManagerContextValue {
|
|
27
|
+
managerLabel?: ReactNode;
|
|
28
|
+
className?: string;
|
|
29
|
+
gridClassName?: string;
|
|
30
|
+
items: DialFile[];
|
|
31
|
+
rootItem?: DialRootFolder;
|
|
32
|
+
allowedFileTypes?: DialFileAcceptType[];
|
|
33
|
+
maxSelectableFileSize?: number;
|
|
34
|
+
filesLoading?: boolean;
|
|
35
|
+
treeOptions?: FileTreeOptions;
|
|
36
|
+
showNavigationPanel?: boolean;
|
|
37
|
+
navigationPanelOptions?: NavigationPanelOptions;
|
|
38
|
+
gridOptions?: GridOptions;
|
|
39
|
+
toolbarOptions?: ToolbarOptions;
|
|
40
|
+
bulkActionsToolbarOptions?: BulkActionsToolbarOptions;
|
|
41
|
+
deleteConfirmationOptions?: DeleteConfirmationOptions;
|
|
42
|
+
destinationFolderPopupOptions?: DialFileManagerDestinationFolderPopupOptions & {
|
|
43
|
+
sourceFolder?: string;
|
|
44
|
+
};
|
|
45
|
+
conflictResolutionPopupOptions?: DialFileManagerConflictResolutionPopupOptions;
|
|
46
|
+
fileMetadataPopupOptions?: FileMetadataPopupOptions;
|
|
47
|
+
compactViewWidthBreakpoint?: number;
|
|
48
|
+
customBreakpointRef?: RefObject<HTMLElement | null>;
|
|
49
|
+
currentPath?: string;
|
|
50
|
+
setCurrentPath: (p?: string) => void;
|
|
51
|
+
searchValue: string;
|
|
52
|
+
effectiveSearchValue: string;
|
|
53
|
+
setSearchValue: (v: string) => void;
|
|
54
|
+
areHiddenFilesVisible: boolean;
|
|
55
|
+
toggleHiddenFilesVisibility: () => void;
|
|
56
|
+
isTreeCollapsed: boolean;
|
|
57
|
+
toggleTreeCollapse: () => void;
|
|
58
|
+
setIsTreeCollapsed: (value: boolean) => void;
|
|
59
|
+
selectedPaths: Set<string>;
|
|
60
|
+
selectedFiles: Map<string, DialFile>;
|
|
61
|
+
setSelectedPaths: (paths: Set<string>) => void;
|
|
62
|
+
clearSelection: () => void;
|
|
63
|
+
currentFolder?: DialFile;
|
|
64
|
+
gridRows: FileManagerGridRow[];
|
|
65
|
+
handleCopyTo: (destinationFolder: string) => void;
|
|
66
|
+
handleMoveTo: (destinationFolder: string, sourceFolder?: string) => void;
|
|
67
|
+
handleDuplicate: (files: DialFile[]) => void;
|
|
68
|
+
handleOpenDestinationFolderPopup: (mode: DestinationFolderMode) => void;
|
|
69
|
+
handleCloseDestinationFolderPopup: () => void;
|
|
70
|
+
openDestinationFolderPopup: boolean;
|
|
71
|
+
destinationFolderMode: DestinationFolderMode;
|
|
72
|
+
handleSetCopiedFiles: (files: DialFile[]) => void;
|
|
73
|
+
handleSetMovedFiles: (files: DialFile[]) => void;
|
|
74
|
+
handleGridAddSibling?: (files: DialFile[]) => void;
|
|
75
|
+
handleGridAddChild?: (files: DialFile[]) => void;
|
|
76
|
+
handleTreeAddSibling?: (files: DialFile[]) => void;
|
|
77
|
+
handleTreeAddChild?: (files: DialFile[]) => void;
|
|
78
|
+
renamedPath?: string;
|
|
79
|
+
renamedItem?: DialFile;
|
|
80
|
+
createdFolderPath?: string | null;
|
|
81
|
+
onRename: (file: string) => void;
|
|
82
|
+
onRenameSave: (value: string) => void;
|
|
83
|
+
onRenameCancel: () => void;
|
|
84
|
+
onRenameValidate: (value: string, item: DialFile) => string | null;
|
|
85
|
+
getDisplayName: (item: DialFile) => string;
|
|
86
|
+
forbiddenSymbolsRegExp?: RegExp;
|
|
87
|
+
forbiddenSymbolsTooltip?: ReactNode;
|
|
88
|
+
openDeleteConfirmation: (items: DialFile[], parentFolderPath: string) => void;
|
|
89
|
+
closeDeleteConfirmation: () => void;
|
|
90
|
+
confirmDelete: () => void;
|
|
91
|
+
deleteConfirmationOpen: boolean;
|
|
92
|
+
itemsToDelete: DialFile[];
|
|
93
|
+
handlePathChange: (nextPath?: string) => void;
|
|
94
|
+
handleTreeItemClick: (item: DialFile) => void;
|
|
95
|
+
handleBreadcrumbItemClick: (href?: string) => void;
|
|
96
|
+
handleSearchChange: (value?: string) => void;
|
|
97
|
+
handleTableRowClick: (row: FileManagerGridRow) => void;
|
|
98
|
+
handleSelectionClick?: (row: FileManagerGridRow[]) => void;
|
|
99
|
+
onTableFileClick?: DialFileManagerProps['onTableFileClick'];
|
|
100
|
+
handleDownloadFiles: (items: DialFile[]) => void;
|
|
101
|
+
onGridApiChange?: (api: GridApi) => void;
|
|
102
|
+
isDragging: boolean;
|
|
103
|
+
isDraggingOverWindow: boolean;
|
|
104
|
+
uploadError?: string;
|
|
105
|
+
handleDragEnter: (e: DragEvent) => void;
|
|
106
|
+
handleDragLeave: (e: DragEvent) => void;
|
|
107
|
+
handleDragOver: (e: DragEvent) => void;
|
|
108
|
+
handleDrop: (e: DragEvent) => void;
|
|
109
|
+
clearUploadError: () => void;
|
|
110
|
+
onUploadFiles?: DialFileManagerProps['onUploadFiles'];
|
|
111
|
+
onValidateUpload?: DialFileManagerProps['onValidateUpload'];
|
|
112
|
+
maxFileSize?: number;
|
|
113
|
+
uploadValidationMessages?: FileUploadValidationMessages;
|
|
114
|
+
newActions: DropdownItem[];
|
|
115
|
+
isNewButtonVisible: boolean;
|
|
116
|
+
isNewButtonDisabled: boolean;
|
|
117
|
+
openFileDialog: () => void;
|
|
118
|
+
fileInputRef: RefObject<HTMLInputElement | null>;
|
|
119
|
+
isCreatingFolder: boolean;
|
|
120
|
+
newFolderTempId: string | null;
|
|
121
|
+
newFolderDefaultName: string;
|
|
122
|
+
startFolderCreation: () => void;
|
|
123
|
+
cancelFolderCreation: () => void;
|
|
124
|
+
saveFolderCreation: (name: string) => Promise<void>;
|
|
125
|
+
validateFolderName: (name: string) => string | null;
|
|
126
|
+
conflictingFiles: DialFile[];
|
|
127
|
+
conflictResolutionOpen: boolean;
|
|
128
|
+
closeConflictResolution: () => void;
|
|
129
|
+
handleConflictReplace: () => void;
|
|
130
|
+
handleConflictCancel: () => void;
|
|
131
|
+
handleConflictDuplicate: () => void;
|
|
132
|
+
handleConflictDecideForEach: (decisions: FileConflictDecision[]) => void;
|
|
133
|
+
uploadConflictingFiles: DialFile[];
|
|
134
|
+
uploadConflictResolutionOpen: boolean;
|
|
135
|
+
closeUploadConflictResolution: () => void;
|
|
136
|
+
handleUploadConflictReplace: () => void;
|
|
137
|
+
handleUploadConflictCancel: () => void;
|
|
138
|
+
handleUploadConflictDuplicate: () => void;
|
|
139
|
+
handleUploadConflictDecideForEach: (decisions: FileConflictDecision[]) => void;
|
|
140
|
+
isMetadataPopupOpen: boolean;
|
|
141
|
+
selectedFileForMetadata?: DialFile;
|
|
142
|
+
openMetadataPopup: (file: DialFile) => void;
|
|
143
|
+
closeMetadataPopup: () => void;
|
|
144
|
+
onGetInfo?: (file: DialFile) => void | Promise<void>;
|
|
145
|
+
onUnshareFiles?: (file: DialFile[]) => void;
|
|
146
|
+
onRemoveFilesAccess?: (file: DialFile[]) => void;
|
|
147
|
+
actionsRef?: Ref<DialFileManagerActionsRef>;
|
|
148
|
+
sharedByMePaths?: Set<string>;
|
|
149
|
+
onSearchFiles?: (folder: string, query: string) => void;
|
|
150
|
+
searchInProgress?: boolean;
|
|
151
|
+
searchResults?: DialFile[];
|
|
152
|
+
clearSearchResults?: () => void;
|
|
153
|
+
isSearchMode: boolean;
|
|
154
|
+
emptyStateIcon?: ReactNode;
|
|
155
|
+
emptyStateTitle?: string;
|
|
156
|
+
emptyStateDescription?: string;
|
|
157
|
+
sharedWithMeIds?: string[];
|
|
158
|
+
onFolderPopupPathChange?: (newPath?: string) => void;
|
|
159
|
+
onManagePermissions?: (path?: string) => void;
|
|
160
|
+
onPreview?: (path?: string) => void;
|
|
161
|
+
onOpenInNewTab?: (file: DialFile) => void;
|
|
162
|
+
previewExtensions?: string[];
|
|
163
|
+
isRenameFileAvailable?: boolean;
|
|
164
|
+
isDuplicateFolderAvailable?: boolean;
|
|
165
|
+
customUploadFileAction?: (currentPath?: string, currentFolder?: DialFile) => void;
|
|
166
|
+
customCreateNewItemAction?: (currentPath?: string, currentFolder?: DialFile) => void;
|
|
167
|
+
customDuplicateAction?: (items?: DialFile[]) => void;
|
|
168
|
+
customDeleteItemsAction?: (items: DialFile[], parentFolderPath: string) => void;
|
|
169
|
+
customDownloadItemsAction?: (items?: DialFile[]) => void;
|
|
170
|
+
nonClickableTableColumns?: FileManagerColumnKey[];
|
|
171
|
+
getDisabledTooltip?: (row: FileManagerGridRow) => string | undefined;
|
|
172
|
+
fileTooLargeTooltip?: string;
|
|
173
|
+
unsupportedFileTypeTooltip?: string;
|
|
174
|
+
hideSearchPathItemName?: boolean;
|
|
175
|
+
showHiddenFileSwitcherInDestinationPopup?: boolean;
|
|
176
|
+
showCreateFolderButtonInDestinationPopup?: boolean;
|
|
177
|
+
maxNewFolderDepth?: number;
|
|
178
|
+
onNewFolderDepthExceeded?: () => void;
|
|
179
|
+
}
|
|
180
|
+
export declare const FileManagerContext: import('../../../node_modules/react').Context<FileManagerContextValue | undefined>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC, ReactNode } from '../../../node_modules/react';
|
|
2
|
+
import { DialFileManagerProps } from './FileManager';
|
|
3
|
+
export interface FileManagerProviderProps extends Omit<DialFileManagerProps, 'children'> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
autoSelectUploadedItems?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Provider that encapsulates all File Manager business logic:
|
|
9
|
+
* - path & navigation
|
|
10
|
+
* - search (controlled + uncontrolled)
|
|
11
|
+
* - hidden files toggle
|
|
12
|
+
* - tree collapsed state
|
|
13
|
+
* - selection
|
|
14
|
+
* - clipboard (copy / cut / paste)
|
|
15
|
+
* - delete confirmation state
|
|
16
|
+
* - computed grid rows
|
|
17
|
+
* - new actions
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare const FileManagerProvider: FC<FileManagerProviderProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileManagerGridRow } from './FileManagerContext';
|
|
2
|
+
import { DialFileAcceptType } from '../../models/file-manager';
|
|
3
|
+
interface FileManagerTooltipProps {
|
|
4
|
+
disabledGridRowIds: Set<string>;
|
|
5
|
+
gridRows: FileManagerGridRow[];
|
|
6
|
+
getDisabledTooltip?: (row: FileManagerGridRow) => string | undefined;
|
|
7
|
+
getRowDisabledTooltip: (row: FileManagerGridRow, allowedFileTypes?: DialFileAcceptType[], maxSelectableFileSize?: number) => string | undefined;
|
|
8
|
+
allowedFileTypes?: DialFileAcceptType[];
|
|
9
|
+
maxSelectableFileSize?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const FileManagerTooltip: ({ disabledGridRowIds, gridRows, getDisabledTooltip, getRowDisabledTooltip, allowedFileTypes, maxSelectableFileSize, }: FileManagerTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { DialFile } from '../../../../models/file';
|
|
2
|
+
import { DialFileManagerConflictActions, DialFileManagerConflictStrategies } from '../../../../types/file-manager';
|
|
3
|
+
import { FC } from '../../../../../node_modules/react';
|
|
4
|
+
export interface FileConflictDecision {
|
|
5
|
+
file: DialFile;
|
|
6
|
+
action: DialFileManagerConflictActions;
|
|
7
|
+
}
|
|
8
|
+
export interface ConflictResolutionPopupProps {
|
|
9
|
+
open: boolean;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
onReplace: () => void;
|
|
12
|
+
onDuplicate: () => void;
|
|
13
|
+
onDecideForEach?: (decisions: FileConflictDecision[]) => void;
|
|
14
|
+
conflictingFiles: DialFile[];
|
|
15
|
+
singleFileTitle?: string;
|
|
16
|
+
multipleFilesTitle?: string;
|
|
17
|
+
message?: string;
|
|
18
|
+
actionLabels?: {
|
|
19
|
+
[DialFileManagerConflictActions.Replace]?: string;
|
|
20
|
+
[DialFileManagerConflictActions.Duplicate]?: string;
|
|
21
|
+
[DialFileManagerConflictActions.Cancel]?: string;
|
|
22
|
+
};
|
|
23
|
+
strategyLabels?: {
|
|
24
|
+
[DialFileManagerConflictStrategies.ReplaceAll]?: string;
|
|
25
|
+
[DialFileManagerConflictStrategies.DuplicateAll]?: string;
|
|
26
|
+
[DialFileManagerConflictStrategies.DecideForEach]?: string;
|
|
27
|
+
};
|
|
28
|
+
confirmLabel?: string;
|
|
29
|
+
cancelLabel?: string;
|
|
30
|
+
nameColumnLabel?: string;
|
|
31
|
+
actionColumnLabel?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* ConflictResolutionPopup
|
|
35
|
+
*
|
|
36
|
+
* A popup dialog for resolving file name conflicts during copy or move operations.
|
|
37
|
+
* Shows different UI based on number of conflicting files:
|
|
38
|
+
* - Single file: Simple Replace/Duplicate choice with radio buttons
|
|
39
|
+
* - Multiple files: Replace all / Duplicate all / Decide for each strategy with optional grid
|
|
40
|
+
*
|
|
41
|
+
* When "Decide for each" is selected, displays a grid with dropdown selectors for individual
|
|
42
|
+
* file resolution (Replace/Duplicate/Cancel).
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* // Single file conflict
|
|
47
|
+
* <ConflictResolutionPopup
|
|
48
|
+
* open={isOpen}
|
|
49
|
+
* onClose={handleClose}
|
|
50
|
+
* onReplace={handleReplace}
|
|
51
|
+
* onDuplicate={handleDuplicate}
|
|
52
|
+
* conflictingFiles={[file]}
|
|
53
|
+
* />
|
|
54
|
+
*
|
|
55
|
+
* // Multiple files with custom labels
|
|
56
|
+
* <ConflictResolutionPopup
|
|
57
|
+
* open={isOpen}
|
|
58
|
+
* onClose={handleClose}
|
|
59
|
+
* onReplace={handleReplaceAll}
|
|
60
|
+
* onDuplicate={handleDuplicateAll}
|
|
61
|
+
* onDecideForEach={handleDecisions}
|
|
62
|
+
* conflictingFiles={files}
|
|
63
|
+
* actionLabels={{
|
|
64
|
+
* [DialFileManagerConflictActions.Replace]: 'Overwrite',
|
|
65
|
+
* [DialFileManagerConflictActions.Duplicate]: 'Keep Both',
|
|
66
|
+
* }}
|
|
67
|
+
* strategyLabels={{
|
|
68
|
+
* [DialFileManagerConflictStrategies.ReplaceAll]: 'Overwrite All',
|
|
69
|
+
* [DialFileManagerConflictStrategies.DuplicateAll]: 'Keep All',
|
|
70
|
+
* }}
|
|
71
|
+
* />
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @param open - Whether the popup is visible
|
|
75
|
+
* @param onClose - Callback fired when the popup is closed
|
|
76
|
+
* @param onReplace - Callback fired when Replace/Replace All is confirmed
|
|
77
|
+
* @param onDuplicate - Callback fired when Duplicate/Duplicate All is confirmed
|
|
78
|
+
* @param [onDecideForEach] - Callback fired when individual decisions are confirmed; receives array of decisions
|
|
79
|
+
* @param conflictingFiles - Array of files with name conflicts
|
|
80
|
+
* @param [singleFileTitle="Replace Or Duplicate Item"] - Title for single file conflicts
|
|
81
|
+
* @param [multipleFilesTitle="Replace Or Duplicate Items"] - Title for multiple file conflicts
|
|
82
|
+
* @param [message] - Custom message (overrides default conflict description)
|
|
83
|
+
* @param [actionLabels] - Custom labels for conflict actions (Replace/Duplicate/Cancel)
|
|
84
|
+
* @param [strategyLabels] - Custom labels for conflict strategies (Replace all/Duplicate all/Decide for each)
|
|
85
|
+
* @param [confirmLabel="Confirm"] - Label for the confirm button
|
|
86
|
+
* @param [cancelLabel="Cancel"] - Label for the cancel button
|
|
87
|
+
* @param [nameColumnLabel="Name"] - Label for the file name column in the grid
|
|
88
|
+
* @param [actionColumnLabel="Action"] - Label for the action column in the grid
|
|
89
|
+
*/
|
|
90
|
+
export declare const ConflictResolutionPopup: FC<ConflictResolutionPopupProps>;
|