@epam/ai-dial-ui-kit 0.5.0-rc.30 → 0.5.0-rc.31
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/dist/dial-ui-kit.cjs.js +28 -28
- package/dist/dial-ui-kit.es.js +7329 -7201
- package/dist/src/components/FileManager/FileManager.d.ts +3 -2
- package/dist/src/components/FileManager/FileManagerContext.d.ts +7 -0
- package/dist/src/components/FileManager/constants.d.ts +1 -0
- package/dist/src/components/FileManager/hooks/use-folder-creation.d.ts +21 -0
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ import { FileManagerGridRow } from './FileManagerContext';
|
|
|
11
11
|
import { DestinationFolderPopupProps } from './components/DestinationFolderPopup/DestinationFolderPopup';
|
|
12
12
|
import { FileUploadValidationResult, FileUploadValidationMessages } from './hooks/use-file-upload';
|
|
13
13
|
import { DialFileManagerActions } from '../../types/file-manager';
|
|
14
|
+
import { FolderCreationValidationMessages } from './hooks/use-folder-creation';
|
|
14
15
|
type GridRow = FileManagerGridRow;
|
|
15
16
|
export type DialFileManagerDestinationFolderPopupOptions = Pick<DestinationFolderPopupProps, 'setDestinationFolderPath' | 'destinationFolderPath' | 'addFolderLabel' | 'copyLabel' | 'moveLabel' | 'hiddenFilesSwitcherLabel'>;
|
|
16
17
|
export interface FileTreeOptions extends Omit<DialFoldersTreeProps, 'items' | 'selectedPath' | 'onItemClick'> {
|
|
@@ -98,9 +99,9 @@ export interface DialFileManagerProps {
|
|
|
98
99
|
onRenameSave?: (value: string) => void;
|
|
99
100
|
onRenameCancel?: () => void;
|
|
100
101
|
onRenameValidate?: (value: string, item: DialFile) => string | null;
|
|
101
|
-
onCreateFolder?: (
|
|
102
|
+
onCreateFolder?: (file: DialUploadFileItem, folderPath: string, fileId: string) => void | Promise<void>;
|
|
102
103
|
onCreateFolderValidate?: (name: string, parentFolder: DialFile) => string | null;
|
|
103
|
-
|
|
104
|
+
folderCreationValidationMessages?: FolderCreationValidationMessages;
|
|
104
105
|
onUploadFiles?: (files: DialUploadFileItem[], destinationFolder: string) => void;
|
|
105
106
|
onValidateUpload?: (files: DialUploadFileItem[], existingFiles: DialFile[], destinationFolder: string) => FileUploadValidationResult | Promise<FileUploadValidationResult>;
|
|
106
107
|
maxFileSize?: number;
|
|
@@ -13,6 +13,7 @@ export interface FileManagerGridRow {
|
|
|
13
13
|
path: string;
|
|
14
14
|
nodeType: DialFileNodeType;
|
|
15
15
|
extension?: string;
|
|
16
|
+
isTemporary?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export interface FileManagerContextValue {
|
|
18
19
|
cssClass?: string;
|
|
@@ -84,5 +85,11 @@ export interface FileManagerContextValue {
|
|
|
84
85
|
isNewButtonVisible: boolean;
|
|
85
86
|
openFileDialog: () => void;
|
|
86
87
|
fileInputRef: RefObject<HTMLInputElement | null>;
|
|
88
|
+
isCreatingFolder: boolean;
|
|
89
|
+
newFolderTempId: string | null;
|
|
90
|
+
startFolderCreation: () => void;
|
|
91
|
+
cancelFolderCreation: () => void;
|
|
92
|
+
saveFolderCreation: (name: string) => Promise<void>;
|
|
93
|
+
validateFolderName: (name: string) => string | null;
|
|
87
94
|
}
|
|
88
95
|
export declare const FileManagerContext: import('react').Context<FileManagerContextValue | undefined>;
|
|
@@ -9,3 +9,4 @@ export declare const sidebarWidth = 280;
|
|
|
9
9
|
export declare const sidebarTitleDefault = "Files";
|
|
10
10
|
export declare const BASE_FILE_MANAGER_ICON_SIZE = 20;
|
|
11
11
|
export declare const FILES_DATA_TRANSFER_TYPE = "Files";
|
|
12
|
+
export declare const FOLDER_PLACEHOLDER_FILE_NAME = ".dial_folder";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DialFile } from '../../../models/file';
|
|
2
|
+
import { DialUploadFileItem } from '../../../models/file-manager';
|
|
3
|
+
export interface FolderCreationValidationMessages {
|
|
4
|
+
emptyName?: string;
|
|
5
|
+
duplicateName?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UseFolderCreationProps {
|
|
8
|
+
currentFolder?: DialFile;
|
|
9
|
+
onCreateFolder?: (file: DialUploadFileItem, folderPath: string, fileId: string) => void | Promise<void>;
|
|
10
|
+
onValidateFolderName?: (name: string, parentFolder: DialFile) => string | null;
|
|
11
|
+
validationMessages?: FolderCreationValidationMessages;
|
|
12
|
+
}
|
|
13
|
+
export interface UseFolderCreationResult {
|
|
14
|
+
isCreatingFolder: boolean;
|
|
15
|
+
newFolderTempId: string | null;
|
|
16
|
+
startFolderCreation: () => void;
|
|
17
|
+
cancelFolderCreation: () => void;
|
|
18
|
+
saveFolderCreation: (name: string) => Promise<void>;
|
|
19
|
+
validateFolderName: (name: string) => string | null;
|
|
20
|
+
}
|
|
21
|
+
export declare const useFolderCreation: ({ currentFolder, onCreateFolder, onValidateFolderName, validationMessages, }: UseFolderCreationProps) => UseFolderCreationResult;
|