@syncfusion/ej2-filemanager 29.2.4 → 30.1.37
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/.eslintrc.json +2 -0
- package/dist/ej2-filemanager.min.js +2 -2
- package/dist/ej2-filemanager.umd.min.js +2 -2
- package/dist/ej2-filemanager.umd.min.js.map +1 -1
- package/dist/es6/ej2-filemanager.es2015.js +181 -20
- package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
- package/dist/es6/ej2-filemanager.es5.js +182 -20
- package/dist/es6/ej2-filemanager.es5.js.map +1 -1
- package/dist/global/ej2-filemanager.min.js +2 -2
- package/dist/global/ej2-filemanager.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/dist/ts/file-manager/actions/breadcrumb-bar.d.ts +60 -0
- package/dist/ts/file-manager/actions/breadcrumb-bar.ts +423 -0
- package/dist/ts/file-manager/actions/index.d.ts +6 -0
- package/dist/ts/file-manager/actions/index.ts +6 -0
- package/dist/ts/file-manager/actions/toolbar.d.ts +54 -0
- package/dist/ts/file-manager/actions/toolbar.ts +609 -0
- package/dist/ts/file-manager/actions/virtualization.d.ts +93 -0
- package/dist/ts/file-manager/actions/virtualization.ts +324 -0
- package/dist/ts/file-manager/base/classes.d.ts +224 -0
- package/dist/ts/file-manager/base/classes.ts +225 -0
- package/dist/ts/file-manager/base/constant.d.ts +136 -0
- package/dist/ts/file-manager/base/constant.ts +137 -0
- package/dist/ts/file-manager/base/file-manager-model.d.ts +520 -0
- package/dist/ts/file-manager/base/file-manager.d.ts +867 -0
- package/dist/ts/file-manager/base/file-manager.ts +2061 -0
- package/dist/ts/file-manager/base/index.d.ts +8 -0
- package/dist/ts/file-manager/base/index.ts +8 -0
- package/dist/ts/file-manager/base/interface.d.ts +952 -0
- package/dist/ts/file-manager/base/interface.ts +931 -0
- package/dist/ts/file-manager/common/index.d.ts +5 -0
- package/dist/ts/file-manager/common/index.ts +5 -0
- package/dist/ts/file-manager/common/operations.d.ts +122 -0
- package/dist/ts/file-manager/common/operations.ts +1369 -0
- package/dist/ts/file-manager/common/utility.d.ts +644 -0
- package/dist/ts/file-manager/common/utility.ts +1728 -0
- package/dist/ts/file-manager/index.d.ts +9 -0
- package/dist/ts/file-manager/index.ts +9 -0
- package/dist/ts/file-manager/layout/details-view.d.ts +152 -0
- package/dist/ts/file-manager/layout/details-view.ts +1990 -0
- package/dist/ts/file-manager/layout/index.d.ts +6 -0
- package/dist/ts/file-manager/layout/index.ts +6 -0
- package/dist/ts/file-manager/layout/large-icons-view.d.ts +157 -0
- package/dist/ts/file-manager/layout/large-icons-view.ts +1684 -0
- package/dist/ts/file-manager/layout/navigation-pane.d.ts +104 -0
- package/dist/ts/file-manager/layout/navigation-pane.ts +919 -0
- package/dist/ts/file-manager/models/ajax-settings-model.d.ts +36 -0
- package/dist/ts/file-manager/models/ajax-settings.d.ts +30 -0
- package/dist/ts/file-manager/models/ajax-settings.ts +39 -0
- package/dist/ts/file-manager/models/column-model.d.ts +155 -0
- package/dist/ts/file-manager/models/column.d.ts +179 -0
- package/dist/ts/file-manager/models/column.ts +216 -0
- package/dist/ts/file-manager/models/contextMenu-settings-model.d.ts +36 -0
- package/dist/ts/file-manager/models/contextMenu-settings.d.ts +33 -0
- package/dist/ts/file-manager/models/contextMenu-settings.ts +44 -0
- package/dist/ts/file-manager/models/default-locale.d.ts +4 -0
- package/dist/ts/file-manager/models/default-locale.ts +101 -0
- package/dist/ts/file-manager/models/details-view-settings-model.d.ts +30 -0
- package/dist/ts/file-manager/models/details-view-settings.d.ts +31 -0
- package/dist/ts/file-manager/models/details-view-settings.ts +54 -0
- package/dist/ts/file-manager/models/index.d.ts +19 -0
- package/dist/ts/file-manager/models/index.ts +19 -0
- package/dist/ts/file-manager/models/navigation-pane-settings-model.d.ts +40 -0
- package/dist/ts/file-manager/models/navigation-pane-settings.d.ts +34 -0
- package/dist/ts/file-manager/models/navigation-pane-settings.ts +42 -0
- package/dist/ts/file-manager/models/search-settings-model.d.ts +42 -0
- package/dist/ts/file-manager/models/search-settings.d.ts +44 -0
- package/dist/ts/file-manager/models/search-settings.ts +53 -0
- package/dist/ts/file-manager/models/toolbar-settings-model.d.ts +197 -0
- package/dist/ts/file-manager/models/toolbar-settings.d.ts +174 -0
- package/dist/ts/file-manager/models/toolbar-settings.ts +198 -0
- package/dist/ts/file-manager/models/upload-settings-model.d.ts +70 -0
- package/dist/ts/file-manager/models/upload-settings.d.ts +61 -0
- package/dist/ts/file-manager/models/upload-settings.ts +75 -0
- package/dist/ts/file-manager/pop-up/context-menu.d.ts +64 -0
- package/dist/ts/file-manager/pop-up/context-menu.ts +693 -0
- package/dist/ts/file-manager/pop-up/dialog.d.ts +31 -0
- package/dist/ts/file-manager/pop-up/dialog.ts +1009 -0
- package/dist/ts/file-manager/pop-up/index.d.ts +5 -0
- package/dist/ts/file-manager/pop-up/index.ts +5 -0
- package/dist/ts/index.d.ts +4 -0
- package/dist/ts/index.ts +4 -0
- package/package.json +16 -17
- package/src/file-manager/base/interface.d.ts +10 -0
- package/src/file-manager/common/operations.d.ts +18 -1
- package/src/file-manager/common/operations.js +59 -0
- package/src/file-manager/common/utility.d.ts +3 -3
- package/src/file-manager/common/utility.js +20 -6
- package/src/file-manager/layout/details-view.js +4 -3
- package/src/file-manager/layout/large-icons-view.d.ts +3 -0
- package/src/file-manager/layout/large-icons-view.js +67 -9
- package/src/file-manager/layout/navigation-pane.js +2 -0
- package/src/file-manager/pop-up/dialog.d.ts +3 -3
- package/src/file-manager/pop-up/dialog.js +34 -6
- package/styles/bds-lite.css +51 -1
- package/styles/bds.css +51 -1
- package/styles/bootstrap-dark-lite.css +51 -0
- package/styles/bootstrap-dark.css +51 -0
- package/styles/bootstrap-lite.css +51 -0
- package/styles/bootstrap.css +51 -0
- package/styles/bootstrap4-lite.css +51 -0
- package/styles/bootstrap4.css +51 -0
- package/styles/bootstrap5-dark-lite.css +51 -1
- package/styles/bootstrap5-dark.css +51 -1
- package/styles/bootstrap5-lite.css +51 -1
- package/styles/bootstrap5.3-lite.css +51 -0
- package/styles/bootstrap5.3.css +51 -0
- package/styles/bootstrap5.css +51 -1
- package/styles/fabric-dark-lite.css +51 -0
- package/styles/fabric-dark.css +51 -0
- package/styles/fabric-lite.css +51 -0
- package/styles/fabric.css +51 -0
- package/styles/file-manager/_bds-definition.scss +1 -0
- package/styles/file-manager/_bootstrap5-definition.scss +1 -0
- package/styles/file-manager/_layout.scss +46 -4
- package/styles/file-manager/_material3-definition.scss +2 -2
- package/styles/file-manager/_tailwind-definition.scss +1 -0
- package/styles/file-manager/_tailwind3-definition.scss +1 -0
- package/styles/file-manager/bds.css +51 -1
- package/styles/file-manager/bootstrap-dark.css +51 -0
- package/styles/file-manager/bootstrap.css +51 -0
- package/styles/file-manager/bootstrap4.css +51 -0
- package/styles/file-manager/bootstrap5-dark.css +51 -1
- package/styles/file-manager/bootstrap5.3.css +51 -0
- package/styles/file-manager/bootstrap5.css +51 -1
- package/styles/file-manager/fabric-dark.css +51 -0
- package/styles/file-manager/fabric.css +51 -0
- package/styles/file-manager/fluent-dark.css +51 -0
- package/styles/file-manager/fluent.css +51 -0
- package/styles/file-manager/fluent2.css +51 -0
- package/styles/file-manager/highcontrast-light.css +51 -0
- package/styles/file-manager/highcontrast.css +51 -0
- package/styles/file-manager/material-dark.css +51 -0
- package/styles/file-manager/material.css +51 -0
- package/styles/file-manager/material3-dark.css +53 -2
- package/styles/file-manager/material3.css +53 -2
- package/styles/file-manager/tailwind-dark.css +51 -1
- package/styles/file-manager/tailwind.css +51 -1
- package/styles/file-manager/tailwind3.css +51 -0
- package/styles/fluent-dark-lite.css +51 -0
- package/styles/fluent-dark.css +51 -0
- package/styles/fluent-lite.css +51 -0
- package/styles/fluent.css +51 -0
- package/styles/fluent2-lite.css +51 -0
- package/styles/fluent2.css +51 -0
- package/styles/highcontrast-light-lite.css +51 -0
- package/styles/highcontrast-light.css +51 -0
- package/styles/highcontrast-lite.css +51 -0
- package/styles/highcontrast.css +51 -0
- package/styles/material-dark-lite.css +51 -0
- package/styles/material-dark.css +51 -0
- package/styles/material-lite.css +51 -0
- package/styles/material.css +51 -0
- package/styles/material3-dark-lite.css +51 -0
- package/styles/material3-dark.css +53 -2
- package/styles/material3-lite.css +51 -0
- package/styles/material3.css +53 -2
- package/styles/tailwind-dark-lite.css +51 -1
- package/styles/tailwind-dark.css +51 -1
- package/styles/tailwind-lite.css +51 -1
- package/styles/tailwind.css +51 -1
- package/styles/tailwind3-lite.css +51 -0
- package/styles/tailwind3.css +51 -0
@@ -0,0 +1,2061 @@
|
|
1
|
+
import { Component, EmitType, ModuleDeclaration, isNullOrUndefined, L10n, closest, Collection, detach, selectAll, setStyleAttribute } from '@syncfusion/ej2-base';
|
2
|
+
import { Property, INotifyPropertyChanged, NotifyPropertyChanges, Complex, select } from '@syncfusion/ej2-base';
|
3
|
+
import { createElement, addClass, removeClass, setStyleAttribute as setAttr, getUniqueID } from '@syncfusion/ej2-base';
|
4
|
+
import { isNullOrUndefined as isNOU, formatUnit, Browser, KeyboardEvents, KeyboardEventArgs } from '@syncfusion/ej2-base';
|
5
|
+
import { Event, EventHandler, getValue, setValue } from '@syncfusion/ej2-base';
|
6
|
+
import { Splitter, PanePropertiesModel } from '@syncfusion/ej2-layouts';
|
7
|
+
import { Dialog, createSpinner, hideSpinner, showSpinner, BeforeOpenEventArgs, BeforeCloseEventArgs } from '@syncfusion/ej2-popups';
|
8
|
+
import { createDialog, createExtDialog } from '../pop-up/dialog';
|
9
|
+
import { ToolbarSettings, ToolbarSettingsModel, AjaxSettings, NavigationPaneSettings, DetailsViewSettings } from '../models/index';
|
10
|
+
import { ToolbarItem, ToolbarItemModel } from'../models/index' ;
|
11
|
+
import { NavigationPaneSettingsModel, DetailsViewSettingsModel } from '../models/index';
|
12
|
+
import { AjaxSettingsModel, SearchSettings, SearchSettingsModel } from '../models/index';
|
13
|
+
import { Toolbar } from '../actions/toolbar';
|
14
|
+
import { DetailsView } from '../layout/details-view';
|
15
|
+
import { LargeIconsView } from '../layout/large-icons-view';
|
16
|
+
import { Uploader, UploadingEventArgs, SelectedEventArgs, FileInfo, CancelEventArgs } from '@syncfusion/ej2-inputs';
|
17
|
+
import { UploadSettingsModel } from '../models/upload-settings-model';
|
18
|
+
import { UploadSettings } from '../models/upload-settings';
|
19
|
+
import * as events from './constant';
|
20
|
+
import * as CLS from './classes';
|
21
|
+
import { read, filter, createFolder } from '../common/operations';
|
22
|
+
import { FileManagerModel } from './file-manager-model';
|
23
|
+
import { ITreeView, IContextMenu, ViewType, SortOrder, FileDragEventArgs, RetryArgs, ReadArgs, FileSelectionEventArgs } from './interface';
|
24
|
+
import { BeforeSendEventArgs, SuccessEventArgs, FailureEventArgs, FileLoadEventArgs, FolderCreateEventArgs, DeleteEventArgs, RenameEventArgs, MoveEventArgs, SearchEventArgs } from './interface';
|
25
|
+
import { FileOpenEventArgs, FileSelectEventArgs, MenuClickEventArgs, MenuOpenEventArgs, MenuCloseEventArgs } from './interface';
|
26
|
+
import { ToolbarClickEventArgs, ToolbarCreateEventArgs, UploadListCreateArgs } from './interface';
|
27
|
+
import { PopupOpenCloseEventArgs, BeforePopupOpenCloseEventArgs, BeforeDownloadEventArgs, BeforeImageLoadEventArgs } from './interface';
|
28
|
+
import { refresh, getPathObject, getLocaleText, setNextPath, createDeniedDialog, getCssClass } from '../common/utility';
|
29
|
+
import { hasContentAccess, hasUploadAccess, updateLayout, createNewFolder, uploadItem, closePopup } from '../common/utility';
|
30
|
+
import { TreeView as BaseTreeView } from '@syncfusion/ej2-navigations';
|
31
|
+
import { ColumnModel } from '@syncfusion/ej2-grids';
|
32
|
+
import { ContextMenuSettingsModel } from '../models/contextMenu-settings-model';
|
33
|
+
import { ContextMenuSettings } from '../models/contextMenu-settings';
|
34
|
+
import { BreadCrumbBar } from '../actions/breadcrumb-bar';
|
35
|
+
import { ContextMenu } from '../pop-up/context-menu';
|
36
|
+
import { defaultLocale } from '../models/default-locale';
|
37
|
+
import { PositionModel } from '@syncfusion/ej2-base/src/draggable-model';
|
38
|
+
import { Virtualization } from '../actions/virtualization';
|
39
|
+
import { SortComparer } from './interface';
|
40
|
+
|
41
|
+
/**
|
42
|
+
* The FileManager component allows users to access and manage the file system through the web browser. It can performs the
|
43
|
+
* functionalities like add, rename, search, sort, upload and delete files or folders. And also it
|
44
|
+
* provides an easy way of dynamic injectable modules like toolbar, navigationpane, detailsview, largeiconsview.
|
45
|
+
* ```html
|
46
|
+
* <div id="file"></div>
|
47
|
+
* ```
|
48
|
+
* ```typescript,
|
49
|
+
* let feObj: FileManager = new FileManager();
|
50
|
+
* feObj.appendTo('#file');
|
51
|
+
* ```
|
52
|
+
*/
|
53
|
+
|
54
|
+
@NotifyPropertyChanges
|
55
|
+
export class FileManager extends Component<HTMLElement> implements INotifyPropertyChanged {
|
56
|
+
|
57
|
+
/* Internal modules */
|
58
|
+
/** @hidden */
|
59
|
+
public toolbarModule: Toolbar;
|
60
|
+
/** @hidden */
|
61
|
+
public detailsviewModule: DetailsView;
|
62
|
+
/** @hidden */
|
63
|
+
public navigationpaneModule: ITreeView;
|
64
|
+
/** @hidden */
|
65
|
+
public largeiconsviewModule: LargeIconsView;
|
66
|
+
/** @hidden */
|
67
|
+
public contextmenuModule: IContextMenu;
|
68
|
+
/** @hidden */
|
69
|
+
public breadcrumbbarModule: BreadCrumbBar;
|
70
|
+
/** @hidden */
|
71
|
+
public virtualizationModule: Virtualization;
|
72
|
+
|
73
|
+
|
74
|
+
/* Internal variables */
|
75
|
+
private keyboardModule: KeyboardEvents;
|
76
|
+
private keyConfigs: { [key: string]: string };
|
77
|
+
public filterData: Object = null;
|
78
|
+
public originalPath: string;
|
79
|
+
public filterPath: string;
|
80
|
+
public filterId: string;
|
81
|
+
public hasId: boolean;
|
82
|
+
public pathNames: string[];
|
83
|
+
public pathId: string[];
|
84
|
+
public expandedId: string;
|
85
|
+
public itemData: Object[];
|
86
|
+
public visitedData: Object;
|
87
|
+
public visitedItem: Element;
|
88
|
+
public toolbarSelection: boolean;
|
89
|
+
// Specifies the parent path of the CWD(this.path).
|
90
|
+
public targetPath: string;
|
91
|
+
public feParent: Object[];
|
92
|
+
public feFiles: Object[];
|
93
|
+
public activeElements: Element[];
|
94
|
+
public activeModule: string;
|
95
|
+
public targetModule: string;
|
96
|
+
public treeObj: BaseTreeView;
|
97
|
+
public dialogObj: Dialog;
|
98
|
+
public viewerObj: Dialog;
|
99
|
+
public extDialogObj: Dialog;
|
100
|
+
public selectedNodes: string[] = [];
|
101
|
+
public duplicateItems: string[] = [];
|
102
|
+
public duplicateRecords: Object[] = [];
|
103
|
+
public previousPath: string[] = [];
|
104
|
+
public nextPath: string[] = [];
|
105
|
+
public fileAction: string;
|
106
|
+
public pasteNodes: string[];
|
107
|
+
// Specifies response data of the file or folder.
|
108
|
+
public responseData: { [key: string]: Object; };
|
109
|
+
public existingFileCount: number = 0;
|
110
|
+
public isLayoutChange: boolean = false;
|
111
|
+
public replaceItems: string[];
|
112
|
+
public createdItem: { [key: string]: Object; };
|
113
|
+
public layoutSelectedItems: string[] = [];
|
114
|
+
public renamedItem: { [key: string]: Object; };
|
115
|
+
public renamedId: string = null;
|
116
|
+
public uploadItem: string[] = [];
|
117
|
+
public fileLength: number;
|
118
|
+
public deleteRecords: string[] = [];
|
119
|
+
public fileView: string;
|
120
|
+
public isDevice: boolean;
|
121
|
+
public isMobile: boolean;
|
122
|
+
public isBigger: boolean;
|
123
|
+
public isFile: boolean = false;
|
124
|
+
public actionRecords: Object[];
|
125
|
+
public activeRecords: Object[];
|
126
|
+
public isCut: boolean = false;
|
127
|
+
public isSearchCut: boolean = false;
|
128
|
+
public isSearchDrag: boolean = false;
|
129
|
+
public isPasteError: boolean = false;
|
130
|
+
public folderPath: string = '';
|
131
|
+
public isSameAction: boolean = false;
|
132
|
+
public currentItemText: string;
|
133
|
+
public renameText: string;
|
134
|
+
public isFiltered: boolean = false;
|
135
|
+
// Specifies whether the sort by option is clicked or not.
|
136
|
+
public isSortByClicked: boolean = false;
|
137
|
+
public enablePaste: boolean = false;
|
138
|
+
public splitterObj: Splitter;
|
139
|
+
public persistData: boolean = false;
|
140
|
+
public breadCrumbBarNavigation: HTMLElement;
|
141
|
+
public localeObj: L10n;
|
142
|
+
public uploadObj: Uploader;
|
143
|
+
public uploadDialogObj: Dialog;
|
144
|
+
public retryArgs: RetryArgs[] = [];
|
145
|
+
private isOpened: boolean = false;
|
146
|
+
public isRetryOpened: boolean = false;
|
147
|
+
public isPathDrag: boolean = false;
|
148
|
+
public searchedItems: { [key: string]: Object; }[] = [];
|
149
|
+
public searchWord: string;
|
150
|
+
public retryFiles: FileInfo[] = [];
|
151
|
+
public isApplySame: boolean = false;
|
152
|
+
public uploadEventArgs: BeforeSendEventArgs;
|
153
|
+
public dragData: { [key: string]: Object; }[] = [];
|
154
|
+
public dragNodes: string[] = [];
|
155
|
+
public dragPath: string = '';
|
156
|
+
public dropPath: string = '';
|
157
|
+
public isDragDrop: boolean = false;
|
158
|
+
public virtualDragElement: HTMLElement;
|
159
|
+
public dropData: Object;
|
160
|
+
public treeExpandTimer: number = null;
|
161
|
+
public dragCursorPosition: PositionModel = { left: 44, top: 18 };
|
162
|
+
public isDropEnd: boolean = false;
|
163
|
+
public dragCount: number = 0;
|
164
|
+
public droppedObjects: Object[] = [];
|
165
|
+
public destinationPath: string;
|
166
|
+
public uploadingCount: number = 0;
|
167
|
+
public uploadedCount: number = 0;
|
168
|
+
//Specifies whether the operating system is MAC or not
|
169
|
+
public isMac : boolean = false;
|
170
|
+
public oldView: string;
|
171
|
+
public oldPath: string;
|
172
|
+
private viewElem: HTMLElement;
|
173
|
+
private dragSelectElement: HTMLElement;
|
174
|
+
private dragX: number;
|
175
|
+
private dragY: number;
|
176
|
+
private dragSelectedItems: string[] = [];
|
177
|
+
|
178
|
+
/**
|
179
|
+
* Specifies the AJAX settings of the file manager.
|
180
|
+
*
|
181
|
+
* @default {
|
182
|
+
* getImageUrl: null;
|
183
|
+
* url: null;
|
184
|
+
* uploadUrl: null;
|
185
|
+
* downloadUrl: null;
|
186
|
+
* }
|
187
|
+
*/
|
188
|
+
@Complex<AjaxSettingsModel>({}, AjaxSettings)
|
189
|
+
public ajaxSettings: AjaxSettingsModel;
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Specifies the array of data to populate folders/files in the File Manager.
|
193
|
+
* The mandatory fields to be included in the JSON data are defined in fileData interface.
|
194
|
+
* This interface can be extended to add additional fields as required.
|
195
|
+
*
|
196
|
+
* @default []
|
197
|
+
*/
|
198
|
+
@Property([])
|
199
|
+
public fileSystemData: { [key: string]: Object }[];
|
200
|
+
|
201
|
+
/**
|
202
|
+
* Enables or disables drag-and-drop of files.
|
203
|
+
*
|
204
|
+
* @default false
|
205
|
+
*/
|
206
|
+
@Property(false)
|
207
|
+
public allowDragAndDrop: boolean;
|
208
|
+
|
209
|
+
/**
|
210
|
+
* Enables or disables the multiple files selection of the file manager.
|
211
|
+
*
|
212
|
+
* @default true
|
213
|
+
*/
|
214
|
+
@Property(true)
|
215
|
+
public allowMultiSelection: boolean;
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Gets or sets a boolean value that determines whether to display checkboxes in the file manager. If enabled, checkboxes are shown for files or folders on hover.
|
219
|
+
*
|
220
|
+
* @default true
|
221
|
+
*/
|
222
|
+
@Property(true)
|
223
|
+
public showItemCheckBoxes: boolean;
|
224
|
+
|
225
|
+
/**
|
226
|
+
* Specifies the context menu settings of the file manager.
|
227
|
+
*
|
228
|
+
* @default {
|
229
|
+
* file: ['Open','|', 'Cut', 'Copy', '|', 'Delete', 'Rename', '|', 'Details'],
|
230
|
+
* folder: ['Open','|', 'Cut', 'Copy', 'Paste', '|', 'Delete', 'Rename', '|', 'Details'],
|
231
|
+
* layout: ['SortBy', 'View', 'Refresh', '|', 'Paste', '|', 'NewFolder', 'Upload', '|', 'Details', '|', 'SelectAll'],
|
232
|
+
* visible: true,
|
233
|
+
* }
|
234
|
+
*/
|
235
|
+
@Complex<ContextMenuSettingsModel>({}, ContextMenuSettings)
|
236
|
+
public contextMenuSettings: ContextMenuSettingsModel;
|
237
|
+
|
238
|
+
/**
|
239
|
+
* Specifies the root CSS class of the file manager that allows you to customize the appearance by overriding the styles.
|
240
|
+
*
|
241
|
+
* @default ''
|
242
|
+
*/
|
243
|
+
@Property('')
|
244
|
+
public cssClass: string;
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Specifies the details view settings of the file manager.
|
248
|
+
*
|
249
|
+
* @default {
|
250
|
+
* columns: [{
|
251
|
+
* field: 'name', headerText: 'Name', minWidth: 120, template: '<span class="e-fe-text">${name}</span>',
|
252
|
+
* customAttributes: { class: 'e-fe-grid-name'}}, { field: '_fm_modified', headerText: 'DateModified', type: 'dateTime',
|
253
|
+
* format: 'MMMM dd, yyyy HH:mm', minWidth: 120, width: '190' }, { field: 'size', headerText: 'Size', minWidth: 90, width: '110',
|
254
|
+
* template: '<span class="e-fe-size">${size}</span>' }
|
255
|
+
* ]
|
256
|
+
* }
|
257
|
+
*/
|
258
|
+
@Complex<DetailsViewSettingsModel>({}, DetailsViewSettings)
|
259
|
+
public detailsViewSettings: DetailsViewSettingsModel;
|
260
|
+
|
261
|
+
/**
|
262
|
+
* Defines whether to allow the cross-scripting site or not.
|
263
|
+
*
|
264
|
+
* @default true
|
265
|
+
*/
|
266
|
+
@Property(true)
|
267
|
+
public enableHtmlSanitizer: boolean;
|
268
|
+
|
269
|
+
/**
|
270
|
+
* Enables or disables persisting component's state between page reloads. If enabled, the following APIs will persist:
|
271
|
+
* 1. `view`: Represents the previous view of the file manager.
|
272
|
+
* 2. `path`: Represents the previous path of the file manager.
|
273
|
+
* 3. `selectedItems`: Represents the previous selected items in the file manager.
|
274
|
+
*
|
275
|
+
* @default false
|
276
|
+
*/
|
277
|
+
@Property(false)
|
278
|
+
public enablePersistence: boolean;
|
279
|
+
|
280
|
+
/**
|
281
|
+
* Gets or sets a value that enables/disables the virtualization feature of the File Manager.
|
282
|
+
* When enabled, the File Manager will only load a subset of files and folders based on the size of the view port, with the rest being loaded dynamically as the user scrolls vertically through the list.
|
283
|
+
* This can improve performance when dealing with a large number of files and folders, as it reduces the initial load time and memory usage.
|
284
|
+
*
|
285
|
+
* @default false
|
286
|
+
*/
|
287
|
+
@Property(false)
|
288
|
+
public enableVirtualization: boolean;
|
289
|
+
|
290
|
+
/**
|
291
|
+
* Specifies the height of the file manager.
|
292
|
+
*
|
293
|
+
* @default '400px'
|
294
|
+
*/
|
295
|
+
@Property('400px')
|
296
|
+
public height: string | number;
|
297
|
+
|
298
|
+
/**
|
299
|
+
* Specifies the initial view of the file manager.
|
300
|
+
* With the help of this property, initial view can be changed to details or largeicons view. The available views are:
|
301
|
+
* * `LargeIcons`
|
302
|
+
* * `Details`
|
303
|
+
*
|
304
|
+
* @default 'LargeIcons'
|
305
|
+
*/
|
306
|
+
@Property('LargeIcons')
|
307
|
+
public view: ViewType;
|
308
|
+
|
309
|
+
/**
|
310
|
+
* Specifies the navigationpane settings of the file manager.
|
311
|
+
*
|
312
|
+
* @default {
|
313
|
+
* maxWidth: '650px',
|
314
|
+
* minWidth: '240px',
|
315
|
+
* visible: true,
|
316
|
+
* sortOrder: 'None'
|
317
|
+
* }
|
318
|
+
*/
|
319
|
+
@Complex<NavigationPaneSettingsModel>({}, NavigationPaneSettings)
|
320
|
+
public navigationPaneSettings: NavigationPaneSettingsModel;
|
321
|
+
|
322
|
+
/**
|
323
|
+
* Specifies the current path of the file manager.
|
324
|
+
*
|
325
|
+
* @default '/'
|
326
|
+
*/
|
327
|
+
@Property('/')
|
328
|
+
public path: string;
|
329
|
+
|
330
|
+
/**
|
331
|
+
* Specifies the target element in which the File Manager’s dialog will be displayed.
|
332
|
+
* The default value is null, which refers to the File Manager element.
|
333
|
+
*
|
334
|
+
* @default null
|
335
|
+
*/
|
336
|
+
@Property(null)
|
337
|
+
public popupTarget: HTMLElement | string;
|
338
|
+
|
339
|
+
/**
|
340
|
+
* Specifies the search settings of the file manager.
|
341
|
+
*
|
342
|
+
* @default {
|
343
|
+
* allowSearchOnTyping: true,
|
344
|
+
* filterType: 'contains',
|
345
|
+
* ignoreCase: true
|
346
|
+
* }
|
347
|
+
*/
|
348
|
+
@Complex<SearchSettingsModel>({}, SearchSettings)
|
349
|
+
public searchSettings: SearchSettingsModel;
|
350
|
+
|
351
|
+
/**
|
352
|
+
* Specifies the selected folders and files name of the file manager.
|
353
|
+
*
|
354
|
+
* @default []
|
355
|
+
*/
|
356
|
+
@Property()
|
357
|
+
public selectedItems: string[];
|
358
|
+
|
359
|
+
/**
|
360
|
+
* Shows or hides the file extension in file manager.
|
361
|
+
*
|
362
|
+
* @default true
|
363
|
+
*/
|
364
|
+
@Property(true)
|
365
|
+
public showFileExtension: boolean;
|
366
|
+
|
367
|
+
/**
|
368
|
+
* Specifies the root folder alias name in file manager
|
369
|
+
*
|
370
|
+
* @default null
|
371
|
+
*/
|
372
|
+
@Property(null)
|
373
|
+
public rootAliasName: string;
|
374
|
+
|
375
|
+
/**
|
376
|
+
* Determines whether to show or hide hidden files and folders.
|
377
|
+
* This is applicable only for storage systems that support attributes for controlling the visibility of data, including physical file directories and custom flat data handlers.
|
378
|
+
*
|
379
|
+
* @default false
|
380
|
+
*/
|
381
|
+
@Property(false)
|
382
|
+
public showHiddenItems: boolean;
|
383
|
+
|
384
|
+
/**
|
385
|
+
* Shows or hides the thumbnail images in largeicons view.
|
386
|
+
*
|
387
|
+
* @default true
|
388
|
+
*/
|
389
|
+
@Property(true)
|
390
|
+
public showThumbnail: boolean;
|
391
|
+
|
392
|
+
/**
|
393
|
+
* Specifies a value that indicates whether the folders and files are sorted in the ascending or descending order,
|
394
|
+
* or they are not sorted at all. The available types of sort orders are,
|
395
|
+
* `None` - Indicates that the folders and files are not sorted.
|
396
|
+
* `Ascending` - Indicates that the folders and files are sorted in the ascending order.
|
397
|
+
* `Descending` - Indicates that the folders and files are sorted in the descending order.
|
398
|
+
*
|
399
|
+
* @default 'Ascending'
|
400
|
+
*/
|
401
|
+
@Property('Ascending')
|
402
|
+
public sortOrder: SortOrder;
|
403
|
+
|
404
|
+
/**
|
405
|
+
* Specifies the field name being used as the sorting criteria to sort the files of the file manager component.
|
406
|
+
*
|
407
|
+
* @default 'name'
|
408
|
+
*/
|
409
|
+
@Property('name')
|
410
|
+
public sortBy: string;
|
411
|
+
|
412
|
+
/**
|
413
|
+
* Defines the custom sorting function.
|
414
|
+
* The sort comparer function has the same functionality like
|
415
|
+
* [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) sort comparer.
|
416
|
+
* This can be used to customize the default sorting functionalities with required comparison values.
|
417
|
+
*
|
418
|
+
* @default null
|
419
|
+
* @aspType string
|
420
|
+
*/
|
421
|
+
@Property(null)
|
422
|
+
public sortComparer: SortComparer | string;
|
423
|
+
|
424
|
+
/**
|
425
|
+
* Gets or sets a value that indicates whether the File Manager allows multiple items selection with mouse dragging.
|
426
|
+
* Set this property to true to allow users to select multiple items with mouse drag as like file explorer. Hover over
|
427
|
+
* the files or folders and drag the mouse to select the required items.
|
428
|
+
*
|
429
|
+
* @default false
|
430
|
+
*/
|
431
|
+
@Property(false)
|
432
|
+
public enableRangeSelection: boolean;
|
433
|
+
|
434
|
+
/**
|
435
|
+
* Specifies the group of items aligned horizontally in the toolbar.
|
436
|
+
*
|
437
|
+
* @default {
|
438
|
+
* items: ['NewFolder', 'Upload', 'Cut', 'Copy', 'Paste', 'Delete',
|
439
|
+
* 'Download', 'Rename', 'SortBy', 'Refresh', 'Selection', 'View', 'Details'],
|
440
|
+
* visible: true
|
441
|
+
* }
|
442
|
+
*/
|
443
|
+
@Complex<ToolbarSettingsModel>({}, ToolbarSettings)
|
444
|
+
public toolbarSettings: ToolbarSettingsModel;
|
445
|
+
|
446
|
+
/**
|
447
|
+
* An array of items that are used to configure File Manager toolbar items.
|
448
|
+
*
|
449
|
+
* @remarks
|
450
|
+
* Use this property if you want to include custom toolbar items along with existing toolbar items. If both `toolbarSettings` and `toolbarItems` are defined, then items will be rendered based on toolbarItems.
|
451
|
+
*
|
452
|
+
* @default []
|
453
|
+
*
|
454
|
+
*/
|
455
|
+
@Collection<ToolbarItemModel>([], ToolbarItem)
|
456
|
+
public toolbarItems: ToolbarItemModel[];
|
457
|
+
|
458
|
+
/**
|
459
|
+
* Specifies the upload settings for the file manager.
|
460
|
+
*
|
461
|
+
* @default {
|
462
|
+
* autoUpload: true,
|
463
|
+
* minFileSize: 0,
|
464
|
+
* maxFileSize: 30000000,
|
465
|
+
* allowedExtensions: '',
|
466
|
+
* autoClose: false,
|
467
|
+
* directoryUpload: false
|
468
|
+
* }
|
469
|
+
*/
|
470
|
+
@Complex<UploadSettingsModel>({}, UploadSettings)
|
471
|
+
public uploadSettings: UploadSettingsModel;
|
472
|
+
|
473
|
+
/**
|
474
|
+
* Specifies the width of the file manager.
|
475
|
+
*
|
476
|
+
* @default '100%'
|
477
|
+
*/
|
478
|
+
@Property('100%')
|
479
|
+
public width: string | number;
|
480
|
+
|
481
|
+
/**
|
482
|
+
* Triggers before the file/folder is rendered.
|
483
|
+
*
|
484
|
+
* @event fileLoad
|
485
|
+
*/
|
486
|
+
@Event()
|
487
|
+
public fileLoad: EmitType<FileLoadEventArgs>;
|
488
|
+
|
489
|
+
/**
|
490
|
+
* Triggers before the file/folder is opened.
|
491
|
+
*
|
492
|
+
* @event fileOpen
|
493
|
+
*/
|
494
|
+
@Event()
|
495
|
+
public fileOpen: EmitType<FileOpenEventArgs>;
|
496
|
+
|
497
|
+
/**
|
498
|
+
* Triggers before sending the download request to the server.
|
499
|
+
*
|
500
|
+
* @event beforeDownload
|
501
|
+
*/
|
502
|
+
@Event()
|
503
|
+
public beforeDownload: EmitType<BeforeDownloadEventArgs>;
|
504
|
+
|
505
|
+
/**
|
506
|
+
* Triggers before sending the getImage request to the server.
|
507
|
+
*
|
508
|
+
* @event beforeImageLoad
|
509
|
+
*/
|
510
|
+
@Event()
|
511
|
+
public beforeImageLoad: EmitType<BeforeImageLoadEventArgs>;
|
512
|
+
|
513
|
+
/**
|
514
|
+
* Triggers before the dialog is closed.
|
515
|
+
*
|
516
|
+
* @event beforePopupClose
|
517
|
+
*/
|
518
|
+
@Event()
|
519
|
+
public beforePopupClose: EmitType<BeforePopupOpenCloseEventArgs>;
|
520
|
+
|
521
|
+
/**
|
522
|
+
* Triggers before the dialog is opened.
|
523
|
+
*
|
524
|
+
* @event beforePopupOpen
|
525
|
+
*/
|
526
|
+
@Event()
|
527
|
+
public beforePopupOpen: EmitType<BeforePopupOpenCloseEventArgs>;
|
528
|
+
|
529
|
+
/**
|
530
|
+
* Triggers before sending the AJAX request to the server.
|
531
|
+
*
|
532
|
+
* @event beforeSend
|
533
|
+
*/
|
534
|
+
@Event()
|
535
|
+
public beforeSend: EmitType<BeforeSendEventArgs>;
|
536
|
+
|
537
|
+
/**
|
538
|
+
* Triggers when the file manager component is created.
|
539
|
+
*
|
540
|
+
* @event created
|
541
|
+
*/
|
542
|
+
@Event()
|
543
|
+
public created: EmitType<Object>;
|
544
|
+
/**
|
545
|
+
* This event is triggered before a folder is created. It allows for the restriction of folder creation based on the application's use case.
|
546
|
+
*
|
547
|
+
* @event beforeFolderCreate
|
548
|
+
*/
|
549
|
+
@Event()
|
550
|
+
public beforeFolderCreate: EmitType<FolderCreateEventArgs>;
|
551
|
+
/**
|
552
|
+
* This event is triggered when a folder is successfully created. It provides an opportunity to retrieve details about the newly created folder.
|
553
|
+
*
|
554
|
+
* @event folderCreate
|
555
|
+
*/
|
556
|
+
@Event()
|
557
|
+
public folderCreate: EmitType<FolderCreateEventArgs>;
|
558
|
+
|
559
|
+
/**
|
560
|
+
* Triggers when the file manager component is destroyed.
|
561
|
+
*
|
562
|
+
* @event destroyed
|
563
|
+
*/
|
564
|
+
@Event()
|
565
|
+
public destroyed: EmitType<Object>;
|
566
|
+
/**
|
567
|
+
* This event is triggered before the deletion of a file or folder occurs. It can be utilized to prevent the deletion of specific files or folders. Any actions, such as displaying a spinner for deletion, can be implemented here.
|
568
|
+
*
|
569
|
+
* @event beforeDelete
|
570
|
+
*/
|
571
|
+
@Event()
|
572
|
+
public beforeDelete: EmitType<DeleteEventArgs>;
|
573
|
+
/**
|
574
|
+
* This event is triggered after the file or folder is deleted successfully. The deleted file or folder details can be retrieved here. Additionally, custom elements' visibility can be managed here based on the application's use case.
|
575
|
+
*
|
576
|
+
* @event delete
|
577
|
+
*/
|
578
|
+
@Event()
|
579
|
+
public delete: EmitType<DeleteEventArgs>;
|
580
|
+
/**
|
581
|
+
* This event is triggered when a file or folder is about to be renamed. It allows for the restriction of the rename action for specific folders or files by utilizing the cancel option.
|
582
|
+
*
|
583
|
+
* @event beforeRename
|
584
|
+
*/
|
585
|
+
@Event()
|
586
|
+
public beforeRename: EmitType<RenameEventArgs>;
|
587
|
+
/**
|
588
|
+
* This event is triggered when a file or folder is successfully renamed. It provides an opportunity to fetch details about the renamed file.
|
589
|
+
*
|
590
|
+
* @event rename
|
591
|
+
*/
|
592
|
+
@Event()
|
593
|
+
public rename: EmitType<RenameEventArgs>;
|
594
|
+
/**
|
595
|
+
* This event is triggered when a file or folder begins to move from its current path through a copy/cut and paste action.
|
596
|
+
*
|
597
|
+
* @event beforeMove
|
598
|
+
*/
|
599
|
+
@Event()
|
600
|
+
public beforeMove: EmitType<MoveEventArgs>;
|
601
|
+
/**
|
602
|
+
* This event is triggered when a file or folder is pasted into the destination path.
|
603
|
+
*
|
604
|
+
* @event move
|
605
|
+
*/
|
606
|
+
@Event()
|
607
|
+
public move: EmitType<MoveEventArgs>;
|
608
|
+
|
609
|
+
/**
|
610
|
+
* This event is triggered when a search action occurs in the search bar of the File Manager component. It triggers each character entered in the input during the search process.
|
611
|
+
*
|
612
|
+
* @event search
|
613
|
+
*/
|
614
|
+
@Event()
|
615
|
+
public search: EmitType<SearchEventArgs>;
|
616
|
+
|
617
|
+
|
618
|
+
/**
|
619
|
+
* Triggers when the file/folder dragging is started.
|
620
|
+
*
|
621
|
+
* @event fileDragStart
|
622
|
+
*/
|
623
|
+
@Event()
|
624
|
+
public fileDragStart: EmitType<FileDragEventArgs>;
|
625
|
+
|
626
|
+
/**
|
627
|
+
* Triggers while dragging the file/folder.
|
628
|
+
*
|
629
|
+
* @event fileDragging
|
630
|
+
*/
|
631
|
+
@Event()
|
632
|
+
public fileDragging: EmitType<FileDragEventArgs>;
|
633
|
+
|
634
|
+
/**
|
635
|
+
* Triggers when the file/folder is about to be dropped at the target.
|
636
|
+
*
|
637
|
+
* @event fileDragStop
|
638
|
+
*/
|
639
|
+
@Event()
|
640
|
+
public fileDragStop: EmitType<FileDragEventArgs>;
|
641
|
+
|
642
|
+
/**
|
643
|
+
* Triggers when the file/folder is dropped.
|
644
|
+
*
|
645
|
+
* @event fileDropped
|
646
|
+
*/
|
647
|
+
@Event()
|
648
|
+
public fileDropped: EmitType<FileDragEventArgs>;
|
649
|
+
|
650
|
+
/**
|
651
|
+
* Triggers before the file/folder is selected.
|
652
|
+
*
|
653
|
+
* @event fileSelection
|
654
|
+
*/
|
655
|
+
@Event()
|
656
|
+
public fileSelection: EmitType<FileSelectionEventArgs>;
|
657
|
+
|
658
|
+
/**
|
659
|
+
* Triggers when the file/folder is selected/unselected.
|
660
|
+
*
|
661
|
+
* @event fileSelect
|
662
|
+
*/
|
663
|
+
@Event()
|
664
|
+
public fileSelect: EmitType<FileSelectEventArgs>;
|
665
|
+
|
666
|
+
/**
|
667
|
+
* Triggers when the context menu item is clicked.
|
668
|
+
*
|
669
|
+
* @event menuClick
|
670
|
+
*/
|
671
|
+
@Event()
|
672
|
+
public menuClick: EmitType<MenuClickEventArgs>;
|
673
|
+
|
674
|
+
/**
|
675
|
+
* Triggers before the context menu is opened.
|
676
|
+
*
|
677
|
+
* @event menuOpen
|
678
|
+
*/
|
679
|
+
@Event()
|
680
|
+
public menuOpen: EmitType<MenuOpenEventArgs>;
|
681
|
+
|
682
|
+
/**
|
683
|
+
* Triggers before the context menu is closed.
|
684
|
+
*
|
685
|
+
* @event menuClose
|
686
|
+
*/
|
687
|
+
@Event()
|
688
|
+
public menuClose: EmitType<MenuCloseEventArgs>;
|
689
|
+
|
690
|
+
/**
|
691
|
+
* Triggers when the AJAX request is failed.
|
692
|
+
*
|
693
|
+
* @event failure
|
694
|
+
*/
|
695
|
+
@Event()
|
696
|
+
public failure: EmitType<FailureEventArgs>;
|
697
|
+
|
698
|
+
/**
|
699
|
+
* Triggers when the dialog is closed.
|
700
|
+
*
|
701
|
+
* @event popupClose
|
702
|
+
*/
|
703
|
+
@Event()
|
704
|
+
public popupClose: EmitType<PopupOpenCloseEventArgs>;
|
705
|
+
|
706
|
+
/**
|
707
|
+
* Triggers when the dialog is opened.
|
708
|
+
*
|
709
|
+
* @event popupOpen
|
710
|
+
*/
|
711
|
+
@Event()
|
712
|
+
public popupOpen: EmitType<PopupOpenCloseEventArgs>;
|
713
|
+
|
714
|
+
/**
|
715
|
+
* Triggers when the AJAX request is success.
|
716
|
+
*
|
717
|
+
* @event success
|
718
|
+
*/
|
719
|
+
@Event()
|
720
|
+
public success: EmitType<SuccessEventArgs>;
|
721
|
+
|
722
|
+
/**
|
723
|
+
* Triggers when the toolbar item is clicked.
|
724
|
+
*
|
725
|
+
* @event toolbarClick
|
726
|
+
*/
|
727
|
+
@Event()
|
728
|
+
public toolbarClick: EmitType<ToolbarClickEventArgs>;
|
729
|
+
|
730
|
+
/**
|
731
|
+
* Triggers before creating the toolbar.
|
732
|
+
*
|
733
|
+
* @event toolbarCreate
|
734
|
+
*/
|
735
|
+
@Event()
|
736
|
+
public toolbarCreate: EmitType<ToolbarCreateEventArgs>;
|
737
|
+
|
738
|
+
/**
|
739
|
+
* Triggers before rendering each file item in upload dialog box.
|
740
|
+
*
|
741
|
+
* @event uploadListCreate
|
742
|
+
*/
|
743
|
+
@Event()
|
744
|
+
public uploadListCreate: EmitType<UploadListCreateArgs>;
|
745
|
+
|
746
|
+
constructor(options?: FileManagerModel, element?: string | HTMLElement) {
|
747
|
+
super(options, <HTMLElement | string>element);
|
748
|
+
FileManager.Inject(BreadCrumbBar, LargeIconsView, ContextMenu);
|
749
|
+
}
|
750
|
+
|
751
|
+
/**
|
752
|
+
* Get component name.
|
753
|
+
*
|
754
|
+
* @returns {string} - returns module name.
|
755
|
+
* @private
|
756
|
+
*/
|
757
|
+
public getModuleName(): string {
|
758
|
+
return 'filemanager';
|
759
|
+
}
|
760
|
+
|
761
|
+
/**
|
762
|
+
* Initialize the event handler
|
763
|
+
*
|
764
|
+
* @returns {void}
|
765
|
+
*/
|
766
|
+
protected preRender(): void {
|
767
|
+
if (isNOU(this.element.id) || this.element.id === '') {
|
768
|
+
this.element.setAttribute('id', getUniqueID('filemanager'));
|
769
|
+
}
|
770
|
+
this.ensurePath();
|
771
|
+
this.feParent = [];
|
772
|
+
this.feFiles = [];
|
773
|
+
setAttr(this.element, { 'width': formatUnit(this.width), 'height': formatUnit(this.height) });
|
774
|
+
this.isDevice = Browser.isDevice as boolean;
|
775
|
+
this.isMobile = this.checkMobile();
|
776
|
+
if (this.isMobile) {
|
777
|
+
this.setProperties({ navigationPaneSettings: { visible: false } }, true);
|
778
|
+
}
|
779
|
+
const ele: Element = closest(this.element, '.e-bigger');
|
780
|
+
this.isBigger = ele ? true : false;
|
781
|
+
this.activeModule = (this.view === 'LargeIcons') ? 'largeiconsview' : 'detailsview';
|
782
|
+
createSpinner({ target: this.element }, createElement);
|
783
|
+
this.addWrapper();
|
784
|
+
this.keyConfigs = {
|
785
|
+
altN: 'alt+n',
|
786
|
+
f5: 'f5',
|
787
|
+
ctrlShift1: 'ctrl+shift+1',
|
788
|
+
ctrlShift2: 'ctrl+shift+2',
|
789
|
+
ctrlU: 'ctrl+u'
|
790
|
+
};
|
791
|
+
this.localeObj = new L10n(this.getModuleName(), defaultLocale, this.locale);
|
792
|
+
}
|
793
|
+
|
794
|
+
/**
|
795
|
+
* Gets the properties to be maintained upon browser refresh.
|
796
|
+
*
|
797
|
+
* @returns {string} - returns the persisted data.
|
798
|
+
* @hidden
|
799
|
+
*/
|
800
|
+
public getPersistData(): string {
|
801
|
+
const keyEntity: string[] = ['view', 'path', 'selectedItems'];
|
802
|
+
return this.addOnPersist(keyEntity);
|
803
|
+
}
|
804
|
+
|
805
|
+
/**
|
806
|
+
* To provide the array of modules needed for component rendering
|
807
|
+
*
|
808
|
+
* @returns {ModuleDeclaration[]} - returns module declaration.
|
809
|
+
* @hidden
|
810
|
+
*/
|
811
|
+
public requiredModules(): ModuleDeclaration[] {
|
812
|
+
const modules: ModuleDeclaration[] = [];
|
813
|
+
modules.push({
|
814
|
+
member: 'breadcrumbbar',
|
815
|
+
args: [this]
|
816
|
+
});
|
817
|
+
modules.push({
|
818
|
+
member: 'largeiconsview',
|
819
|
+
args: [this]
|
820
|
+
});
|
821
|
+
if (this.toolbarSettings.visible) {
|
822
|
+
modules.push({
|
823
|
+
member: 'toolbar',
|
824
|
+
args: [this],
|
825
|
+
name: 'Toolbar'
|
826
|
+
});
|
827
|
+
}
|
828
|
+
if (this.navigationPaneSettings.visible) {
|
829
|
+
modules.push({
|
830
|
+
member: 'navigationpane',
|
831
|
+
args: [this],
|
832
|
+
name: 'NavigationPane'
|
833
|
+
});
|
834
|
+
}
|
835
|
+
if (this.view) {
|
836
|
+
modules.push({
|
837
|
+
member: 'detailsview',
|
838
|
+
args: [this],
|
839
|
+
name: 'DetailsView'
|
840
|
+
});
|
841
|
+
}
|
842
|
+
if (this.contextMenuSettings.visible && !this.isDevice) {
|
843
|
+
modules.push({
|
844
|
+
member: 'contextmenu',
|
845
|
+
args: [this],
|
846
|
+
name: 'ContextMenu'
|
847
|
+
});
|
848
|
+
}
|
849
|
+
if (this.enableVirtualization) {
|
850
|
+
modules.push({
|
851
|
+
member: 'virtualization',
|
852
|
+
args: [this],
|
853
|
+
name: 'Virtualization'
|
854
|
+
});
|
855
|
+
}
|
856
|
+
return modules;
|
857
|
+
}
|
858
|
+
|
859
|
+
/**
|
860
|
+
* To Initialize the control rendering
|
861
|
+
*
|
862
|
+
* @private
|
863
|
+
* @returns {void}
|
864
|
+
*/
|
865
|
+
protected render(): void {
|
866
|
+
this.initialize();
|
867
|
+
const slItems: string[] = isNOU(this.selectedItems) ? [] :
|
868
|
+
this.allowMultiSelection ? this.selectedItems : this.selectedItems.slice(this.selectedItems.length - 1);
|
869
|
+
this.setProperties({ selectedItems: slItems }, true);
|
870
|
+
this.fileView = this.view;
|
871
|
+
this.isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
872
|
+
this.setRtl(this.enableRtl);
|
873
|
+
this.addEventListeners();
|
874
|
+
read(this, (this.path !== this.originalPath) ? events.initialEnd : events.finalizeEnd, this.path);
|
875
|
+
if (this.fileView === 'Details') {
|
876
|
+
this.largeiconsviewModule.element.classList.add(CLS.DISPLAY_NONE);
|
877
|
+
}
|
878
|
+
this.adjustHeight();
|
879
|
+
if (isNOU(this.navigationpaneModule)) {
|
880
|
+
this.splitterObj.collapse(this.enableRtl ? 1 : 0);
|
881
|
+
const bar: Element = select('.' + CLS.SPLIT_BAR, this.element);
|
882
|
+
bar.classList.add(CLS.DISPLAY_NONE);
|
883
|
+
}
|
884
|
+
this.wireEvents();
|
885
|
+
this.renderComplete();
|
886
|
+
}
|
887
|
+
|
888
|
+
private ensurePath(): void {
|
889
|
+
let currentPath: string = this.path;
|
890
|
+
if (isNOU(currentPath)) {
|
891
|
+
currentPath = '/';
|
892
|
+
}
|
893
|
+
if (currentPath.lastIndexOf('/') !== (currentPath.length - 1)) {
|
894
|
+
currentPath = currentPath + '/';
|
895
|
+
}
|
896
|
+
this.originalPath = currentPath;
|
897
|
+
const paths: string[] = currentPath.split('/');
|
898
|
+
this.setProperties({ path: paths[0] + '/' }, true);
|
899
|
+
this.pathNames = [];
|
900
|
+
this.pathId = ['fe_tree'];
|
901
|
+
this.itemData = [];
|
902
|
+
}
|
903
|
+
|
904
|
+
private initialize(): void {
|
905
|
+
if (this.isMobile) { addClass([this.element], CLS.MOBILE); }
|
906
|
+
if (this.allowMultiSelection) { addClass([this.element], CLS.CHECK_SELECT); }
|
907
|
+
this.addCssClass(null, this.cssClass);
|
908
|
+
this.renderFileUpload();
|
909
|
+
}
|
910
|
+
|
911
|
+
private addWrapper(): void {
|
912
|
+
const headerWrap: HTMLElement = this.createElement('div', { id: this.element.id + CLS.TOOLBAR_ID });
|
913
|
+
this.element.appendChild(headerWrap);
|
914
|
+
const layoutWrap: HTMLElement = this.createElement('div', {
|
915
|
+
id: this.element.id + CLS.LAYOUT_ID, className: CLS.LAYOUT
|
916
|
+
});
|
917
|
+
this.element.appendChild(layoutWrap);
|
918
|
+
const navigationWrap: HTMLElement = this.createElement('div', {
|
919
|
+
id: this.element.id + CLS.NAVIGATION_ID, className: CLS.NAVIGATION
|
920
|
+
});
|
921
|
+
const treeWrap: HTMLElement = this.createElement('div', {
|
922
|
+
id: this.element.id + CLS.TREE_ID
|
923
|
+
});
|
924
|
+
navigationWrap.appendChild(treeWrap);
|
925
|
+
const contentWrap: HTMLElement = this.createElement('div', {
|
926
|
+
id: this.element.id + CLS.CONTENT_ID, className: CLS.LAYOUT_CONTENT
|
927
|
+
});
|
928
|
+
this.breadCrumbBarNavigation = this.createElement('div', {
|
929
|
+
id: this.element.id + CLS.BREADCRUMBBAR_ID,
|
930
|
+
className: CLS.BREADCRUMBS
|
931
|
+
});
|
932
|
+
contentWrap.appendChild(this.breadCrumbBarNavigation);
|
933
|
+
const gridWrap: HTMLElement = this.createElement('div', {
|
934
|
+
id: this.element.id + CLS.GRID_ID
|
935
|
+
});
|
936
|
+
contentWrap.appendChild(gridWrap);
|
937
|
+
const largeiconWrap: HTMLElement = this.createElement('div', {
|
938
|
+
id: this.element.id + CLS.LARGEICON_ID,
|
939
|
+
className: CLS.LARGE_ICONS, attrs: { 'role': 'group' }
|
940
|
+
});
|
941
|
+
contentWrap.appendChild(largeiconWrap);
|
942
|
+
const overlay: HTMLElement = this.createElement('span', { className: CLS.OVERLAY });
|
943
|
+
contentWrap.appendChild(overlay);
|
944
|
+
let paneSettings: PanePropertiesModel[];
|
945
|
+
if (!this.enableRtl) {
|
946
|
+
layoutWrap.appendChild(navigationWrap);
|
947
|
+
layoutWrap.appendChild(contentWrap);
|
948
|
+
paneSettings = [
|
949
|
+
{
|
950
|
+
size: '25%', min: this.navigationPaneSettings.minWidth.toString(),
|
951
|
+
max: this.navigationPaneSettings.maxWidth.toString()
|
952
|
+
},
|
953
|
+
{ size: '75%', min: '270px' }
|
954
|
+
];
|
955
|
+
} else {
|
956
|
+
layoutWrap.appendChild(contentWrap);
|
957
|
+
layoutWrap.appendChild(navigationWrap);
|
958
|
+
paneSettings = [
|
959
|
+
{ size: '75%', min: '270px' },
|
960
|
+
{
|
961
|
+
size: '25%', min: this.navigationPaneSettings.minWidth.toString(),
|
962
|
+
max: this.navigationPaneSettings.maxWidth.toString()
|
963
|
+
}
|
964
|
+
];
|
965
|
+
}
|
966
|
+
this.splitterObj = new Splitter({
|
967
|
+
paneSettings: paneSettings,
|
968
|
+
width: '100%',
|
969
|
+
enableRtl: false,
|
970
|
+
enableHtmlSanitizer: this.enableHtmlSanitizer,
|
971
|
+
resizing: this.splitterResize.bind(this)
|
972
|
+
});
|
973
|
+
this.splitterObj.isStringTemplate = true;
|
974
|
+
this.splitterObj.appendTo(layoutWrap);
|
975
|
+
const dialogWrap: HTMLElement = this.createElement('div', { id: this.element.id + CLS.DIALOG_ID });
|
976
|
+
this.element.appendChild(dialogWrap);
|
977
|
+
const menuWrap: HTMLElement = this.createElement('ul', { id: this.element.id + CLS.CONTEXT_MENU_ID });
|
978
|
+
this.element.appendChild(menuWrap);
|
979
|
+
const dialogImgWrap: HTMLElement = this.createElement('div', { id: this.element.id + CLS.IMG_DIALOG_ID });
|
980
|
+
this.element.appendChild(dialogImgWrap);
|
981
|
+
const extnDialogWrap: HTMLElement = this.createElement('div', { id: this.element.id + CLS.EXTN_DIALOG_ID });
|
982
|
+
this.element.appendChild(extnDialogWrap);
|
983
|
+
const uploadDialogWrap: HTMLElement = this.createElement('div', { id: this.element.id + CLS.UPLOAD_DIALOG_ID });
|
984
|
+
this.element.appendChild(uploadDialogWrap);
|
985
|
+
}
|
986
|
+
|
987
|
+
private adjustHeight(): void {
|
988
|
+
const toolbar: HTMLElement = <HTMLElement>select('#' + this.element.id + CLS.TOOLBAR_ID, this.element);
|
989
|
+
const toolBarHeight: number = toolbar ? toolbar.offsetHeight : 0;
|
990
|
+
if (this.splitterObj) {
|
991
|
+
this.splitterObj.height = (this.element.clientHeight - toolBarHeight).toString();
|
992
|
+
this.splitterObj.dataBind();
|
993
|
+
}
|
994
|
+
}
|
995
|
+
/* istanbul ignore next */
|
996
|
+
private splitterResize(): void {
|
997
|
+
this.notify(events.splitterResize, {});
|
998
|
+
}
|
999
|
+
|
1000
|
+
private splitterAdjust(): void {
|
1001
|
+
const bar: Element = select('.' + CLS.SPLIT_BAR, this.element);
|
1002
|
+
if (this.navigationPaneSettings.visible) {
|
1003
|
+
this.splitterObj.expand(this.enableRtl ? 1 : 0);
|
1004
|
+
bar.classList.remove(CLS.DISPLAY_NONE);
|
1005
|
+
} else {
|
1006
|
+
this.splitterObj.collapse(this.enableRtl ? 1 : 0);
|
1007
|
+
bar.classList.add(CLS.DISPLAY_NONE);
|
1008
|
+
}
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
private addCssClass(oldOne: string, newOne: string): void {
|
1012
|
+
if (!isNOU(oldOne) && oldOne !== '') {
|
1013
|
+
removeClass([this.element], oldOne.split(' '));
|
1014
|
+
}
|
1015
|
+
if (!isNOU(newOne) && newOne !== '') {
|
1016
|
+
addClass([this.element], newOne.split(' '));
|
1017
|
+
}
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
private showSpinner(): void {
|
1021
|
+
showSpinner(this.element);
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
private hideSpinner(): void {
|
1025
|
+
hideSpinner(this.element);
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
private onContextMenu(e: MouseEvent): void {
|
1029
|
+
e.preventDefault();
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
private checkMobile(): boolean {
|
1033
|
+
return (/iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(Browser.userAgent.toLowerCase())
|
1034
|
+
&& /mobile/i.test(Browser.userAgent.toLowerCase()));
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
private renderFileUpload(): void {
|
1038
|
+
const id: string = this.element.id + CLS.UPLOAD_ID;
|
1039
|
+
const uploadEle: HTMLElement = this.createElement('input', { id: id, attrs: { name: 'uploadFiles', type: 'file' } });
|
1040
|
+
this.element.appendChild(uploadEle);
|
1041
|
+
this.uploadDialogObj = new Dialog({
|
1042
|
+
header: getLocaleText(this, 'Header-Upload'),
|
1043
|
+
content: uploadEle,
|
1044
|
+
animationSettings: { effect: 'None' },
|
1045
|
+
showCloseIcon: true,
|
1046
|
+
closeOnEscape: true,
|
1047
|
+
visible: false,
|
1048
|
+
isModal: true,
|
1049
|
+
width: '350px',
|
1050
|
+
target: this.popupTarget ? this.popupTarget : '#' + this.element.id,
|
1051
|
+
cssClass: getCssClass(this, this.isMobile ? CLS.MOB_POPUP : CLS.ROOT_POPUP),
|
1052
|
+
locale: this.locale,
|
1053
|
+
allowDragging: true,
|
1054
|
+
position: { X: 'center', Y: 'center' },
|
1055
|
+
enableRtl: this.enableRtl,
|
1056
|
+
enableHtmlSanitizer: this.enableHtmlSanitizer,
|
1057
|
+
open: this.onOpen.bind(this),
|
1058
|
+
close: this.onClose.bind(this),
|
1059
|
+
beforeOpen: this.onBeforeOpen.bind(this),
|
1060
|
+
beforeClose: this.onBeforeClose.bind(this)
|
1061
|
+
});
|
1062
|
+
this.uploadDialogObj.appendTo('#' + this.element.id + CLS.UPLOAD_DIALOG_ID);
|
1063
|
+
this.renderUploadBox();
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
private renderUploadBox(): void {
|
1067
|
+
const uploadUrl: string = this.ajaxSettings.uploadUrl ? this.ajaxSettings.uploadUrl : this.ajaxSettings.url;
|
1068
|
+
this.uploadObj = new Uploader({
|
1069
|
+
dropArea: <HTMLElement>select('#' + this.element.id + CLS.CONTENT_ID, this.element),
|
1070
|
+
asyncSettings: {
|
1071
|
+
saveUrl: uploadUrl,
|
1072
|
+
removeUrl: uploadUrl,
|
1073
|
+
chunkSize: this.uploadSettings.chunkSize,
|
1074
|
+
retryCount: 0
|
1075
|
+
},
|
1076
|
+
locale: this.locale,
|
1077
|
+
enableRtl: this.enableRtl,
|
1078
|
+
uploading: this.onUploading.bind(this),
|
1079
|
+
chunkUploading: this.onChunkUploading.bind(this),
|
1080
|
+
removing: this.onRemoving.bind(this),
|
1081
|
+
canceling: this.onCancel.bind(this),
|
1082
|
+
clearing: this.onClearing.bind(this),
|
1083
|
+
selected: this.onSelected.bind(this),
|
1084
|
+
success: this.onUploadSuccess.bind(this),
|
1085
|
+
failure: this.onUploadFailure.bind(this),
|
1086
|
+
autoUpload: this.uploadSettings.autoUpload,
|
1087
|
+
minFileSize: this.uploadSettings.minFileSize,
|
1088
|
+
maxFileSize: this.uploadSettings.maxFileSize,
|
1089
|
+
allowedExtensions: this.uploadSettings.allowedExtensions,
|
1090
|
+
directoryUpload: this.uploadSettings.directoryUpload,
|
1091
|
+
fileListRendering: this.onFileListRender.bind(this)
|
1092
|
+
});
|
1093
|
+
this.uploadObj.appendTo('#' + this.element.id + CLS.UPLOAD_ID);
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
private onFileListRender(args: UploadListCreateArgs): void {
|
1097
|
+
this.trigger('uploadListCreate', args);
|
1098
|
+
}
|
1099
|
+
|
1100
|
+
private updateUploader(): void {
|
1101
|
+
this.uploadObj.autoUpload = this.uploadSettings.autoUpload;
|
1102
|
+
this.uploadObj.minFileSize = this.uploadSettings.minFileSize;
|
1103
|
+
this.uploadObj.maxFileSize = this.uploadSettings.maxFileSize;
|
1104
|
+
this.uploadObj.allowedExtensions = this.uploadSettings.allowedExtensions;
|
1105
|
+
this.uploadObj.directoryUpload = this.uploadSettings.directoryUpload;
|
1106
|
+
this.uploadObj.dataBind();
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
private onBeforeOpen(args: BeforeOpenEventArgs): void {
|
1110
|
+
const eventArgs: BeforePopupOpenCloseEventArgs = {
|
1111
|
+
cancel: args.cancel, popupName: 'Upload', popupModule: this.uploadDialogObj
|
1112
|
+
};
|
1113
|
+
this.trigger('beforePopupOpen', eventArgs, (eventargs: BeforePopupOpenCloseEventArgs) => {
|
1114
|
+
args.cancel = eventargs.cancel;
|
1115
|
+
});
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
private onBeforeClose(args: BeforeCloseEventArgs): void {
|
1119
|
+
const eventArgs: BeforePopupOpenCloseEventArgs = {
|
1120
|
+
cancel: args.cancel, popupName: 'Upload', popupModule: this.uploadDialogObj
|
1121
|
+
};
|
1122
|
+
this.trigger('beforePopupClose', eventArgs, (eventargs: BeforePopupOpenCloseEventArgs) => {
|
1123
|
+
args.cancel = eventargs.cancel;
|
1124
|
+
});
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
private onOpen(): void {
|
1128
|
+
this.isOpened = true;
|
1129
|
+
this.uploadDialogObj.element.focus();
|
1130
|
+
const args: PopupOpenCloseEventArgs = {
|
1131
|
+
popupModule: this.uploadDialogObj, popupName: 'Upload',
|
1132
|
+
element: this.uploadDialogObj.element
|
1133
|
+
};
|
1134
|
+
this.trigger('popupOpen', args);
|
1135
|
+
}
|
1136
|
+
|
1137
|
+
private onClose(): void {
|
1138
|
+
this.isOpened = false;
|
1139
|
+
this.uploadObj.clearAll();
|
1140
|
+
const args: PopupOpenCloseEventArgs = {
|
1141
|
+
popupModule: this.uploadDialogObj, popupName: 'Upload',
|
1142
|
+
element: this.uploadDialogObj.element
|
1143
|
+
};
|
1144
|
+
this.trigger('popupClose', args);
|
1145
|
+
}
|
1146
|
+
/* istanbul ignore next */
|
1147
|
+
private onChunkUploading(args: UploadingEventArgs): void {
|
1148
|
+
let action: string = 'save';
|
1149
|
+
if ((this.retryArgs.length !== 0)) {
|
1150
|
+
for (let i: number = 0; i < this.retryArgs.length; i++) {
|
1151
|
+
if (args.fileData.name === this.retryArgs[i as number].file.name) {
|
1152
|
+
action = this.retryArgs[i as number].action;
|
1153
|
+
}
|
1154
|
+
}
|
1155
|
+
}
|
1156
|
+
const data: string = JSON.stringify(getValue(this.pathId[this.pathId.length - 1], this.feParent));
|
1157
|
+
args.customFormData = [{ 'path': this.path }, { 'size': args.fileData.size }, { 'action': action }, { 'data': data }, {'filename': args.fileData.name}];
|
1158
|
+
}
|
1159
|
+
/* istanbul ignore next */
|
1160
|
+
private onUploading(args: UploadingEventArgs): void {
|
1161
|
+
let action: string = 'save';
|
1162
|
+
if ((this.retryArgs.length !== 0)) {
|
1163
|
+
for (let i: number = 0; i < this.retryArgs.length; i++) {
|
1164
|
+
if (args.fileData.name === this.retryArgs[i as number].file.name) {
|
1165
|
+
action = this.retryArgs[i as number].action;
|
1166
|
+
if (this.uploadSettings.chunkSize === 0) {
|
1167
|
+
this.retryArgs.splice(i, 1);
|
1168
|
+
i = this.retryArgs.length;
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
}
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
const data: string = JSON.stringify(getValue(this.pathId[this.pathId.length - 1], this.feParent));
|
1175
|
+
args.customFormData = [{ 'path': this.path }, { 'size': args.fileData.size }, { 'action': action }, { 'data': data }, {'filename': args.fileData.name}];
|
1176
|
+
const uploadUrl: string = this.ajaxSettings.uploadUrl ? this.ajaxSettings.uploadUrl : this.ajaxSettings.url;
|
1177
|
+
const ajaxSettings: Object = {
|
1178
|
+
url: uploadUrl,
|
1179
|
+
type: 'POST',
|
1180
|
+
mode: true,
|
1181
|
+
dataType: null,
|
1182
|
+
contentType: null,
|
1183
|
+
data: JSON.stringify(args.customFormData),
|
1184
|
+
onSuccess: null,
|
1185
|
+
onFailure: null,
|
1186
|
+
beforeSend: null
|
1187
|
+
};
|
1188
|
+
this.uploadEventArgs = { action: 'Upload', ajaxSettings: ajaxSettings, cancel: false };
|
1189
|
+
this.trigger('beforeSend', this.uploadEventArgs, (uploadEventArgs: BeforeSendEventArgs) => {
|
1190
|
+
args.customFormData = JSON.parse(getValue('data', uploadEventArgs.ajaxSettings));
|
1191
|
+
args.cancel = uploadEventArgs.cancel;
|
1192
|
+
const eventArgs: Object = {
|
1193
|
+
cancel: false,
|
1194
|
+
httpRequest: args.currentRequest
|
1195
|
+
};
|
1196
|
+
if (typeof getValue('beforeSend', uploadEventArgs.ajaxSettings) === 'function') {
|
1197
|
+
getValue('beforeSend', uploadEventArgs.ajaxSettings)(eventArgs);
|
1198
|
+
if (getValue('cancel', eventArgs)) {
|
1199
|
+
args.cancel = getValue('cancel', eventArgs);
|
1200
|
+
}
|
1201
|
+
}
|
1202
|
+
});
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
private onRemoving(): void {
|
1206
|
+
this.onFileUploadSuccess({ count: 1 });
|
1207
|
+
if (this.uploadObj.getFilesData().length === 1) {
|
1208
|
+
this.uploadDialogObj.hide();
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
/* istanbul ignore next */
|
1213
|
+
private onCancel(args: CancelEventArgs): void {
|
1214
|
+
const data: string = JSON.stringify(getValue(this.pathId[this.pathId.length - 1], this.feParent));
|
1215
|
+
args.customFormData = [{ 'path': this.path }, { 'action': 'remove' }, { 'data': data }];
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
/* istanbul ignore next */
|
1219
|
+
private onClearing(): void {
|
1220
|
+
if (this.isOpened) {
|
1221
|
+
this.uploadDialogObj.hide();
|
1222
|
+
}
|
1223
|
+
}
|
1224
|
+
/* istanbul ignore next */
|
1225
|
+
private onSelected(args: SelectedEventArgs): void {
|
1226
|
+
if (args.filesData.length === 0) { return; }
|
1227
|
+
this.uploadingCount = args.filesData.length;
|
1228
|
+
this.uploadedCount = 0;
|
1229
|
+
const details: Object = getPathObject(this);
|
1230
|
+
if (!hasUploadAccess(details)) {
|
1231
|
+
args.cancel = true;
|
1232
|
+
createDeniedDialog(this, details, events.permissionUpload);
|
1233
|
+
return;
|
1234
|
+
}
|
1235
|
+
this.uploadDialogObj.show();
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
private onFileUploadSuccess(args: { [key: string]: Object; }): void {
|
1239
|
+
this.uploadedCount = this.uploadedCount + (<number>args.count) ;
|
1240
|
+
if (this.uploadSettings.autoClose && (this.uploadingCount === this.uploadedCount)) {
|
1241
|
+
this.uploadDialogObj.hide();
|
1242
|
+
}
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
private onChunkUploadComplete(files: Object): void {
|
1246
|
+
if ((this.retryArgs.length !== 0)) {
|
1247
|
+
for (let i: number = 0; i < this.retryArgs.length; i++) {
|
1248
|
+
const uploadFile: string = !isNullOrUndefined(files) ? getValue('file', files).name : '';
|
1249
|
+
if (uploadFile === this.retryArgs[i as number].file.name) {
|
1250
|
+
this.retryArgs.splice(i, 1);
|
1251
|
+
i = this.retryArgs.length;
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
}
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
/* istanbul ignore next */
|
1258
|
+
private onUploadSuccess(files: Object): void {
|
1259
|
+
if (this.uploadSettings.chunkSize > 0) {
|
1260
|
+
this.onChunkUploadComplete(files);
|
1261
|
+
}
|
1262
|
+
const args: SuccessEventArgs = { action: 'Upload', result: files };
|
1263
|
+
this.trigger('success', args);
|
1264
|
+
this.itemData = [getValue(this.pathId[this.pathId.length - 1], this.feParent)];
|
1265
|
+
read(this, events.pathChanged, this.path);
|
1266
|
+
this.onFileUploadSuccess({ count: 1 });
|
1267
|
+
if (typeof getValue('onSuccess', this.uploadEventArgs.ajaxSettings) === 'function') {
|
1268
|
+
getValue('onSuccess', this.uploadEventArgs.ajaxSettings)();
|
1269
|
+
}
|
1270
|
+
}
|
1271
|
+
/* istanbul ignore next */
|
1272
|
+
private onUploadFailure(files: Object): void {
|
1273
|
+
if (this.uploadSettings.chunkSize > 0) {
|
1274
|
+
this.onChunkUploadComplete(files);
|
1275
|
+
}
|
1276
|
+
const response: object = getValue('response', files);
|
1277
|
+
const statusText: string = getValue('statusText', response);
|
1278
|
+
if (statusText !== '') { setValue('statusText', statusText, files); }
|
1279
|
+
const args: FailureEventArgs = { action: 'Upload', error: files };
|
1280
|
+
this.trigger('failure', args);
|
1281
|
+
if (getValue('statusCode', response) === 400) {
|
1282
|
+
this.retryFiles.push(getValue('file', files));
|
1283
|
+
if (!this.isRetryOpened) { createExtDialog(this, 'UploadRetry'); }
|
1284
|
+
}
|
1285
|
+
if (typeof getValue('onFailure', this.uploadEventArgs.ajaxSettings) === 'function') {
|
1286
|
+
getValue('onFailure', this.uploadEventArgs.ajaxSettings)();
|
1287
|
+
}
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
private onInitialEnd(): void {
|
1291
|
+
setNextPath(this, this.path);
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
private addEventListeners(): void {
|
1295
|
+
this.on(events.beforeRequest, this.showSpinner, this);
|
1296
|
+
this.on(events.afterRequest, this.hideSpinner, this);
|
1297
|
+
this.on(events.initialEnd, this.onInitialEnd, this);
|
1298
|
+
this.on(events.detailsInit, this.onDetailsInit, this);
|
1299
|
+
this.on(events.skipUpload, this.onFileUploadSuccess, this);
|
1300
|
+
EventHandler.add(this.element, 'contextmenu', this.onContextMenu, this);
|
1301
|
+
}
|
1302
|
+
private removeEventListeners(): void {
|
1303
|
+
if (this.isDestroyed) { return; }
|
1304
|
+
this.off(events.beforeRequest, this.showSpinner);
|
1305
|
+
this.off(events.afterRequest, this.hideSpinner);
|
1306
|
+
this.off(events.initialEnd, this.onInitialEnd);
|
1307
|
+
this.off(events.detailsInit, this.onDetailsInit);
|
1308
|
+
this.off(events.skipUpload, this.onFileUploadSuccess);
|
1309
|
+
EventHandler.remove(this.element, 'contextmenu', this.onContextMenu);
|
1310
|
+
}
|
1311
|
+
|
1312
|
+
private onDetailsInit(): void {
|
1313
|
+
if (isNOU(this.activeModule)) {
|
1314
|
+
this.itemData = [getValue(this.pathId[this.pathId.length - 1], this.feParent)];
|
1315
|
+
}
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
private resizeHandler(): void {
|
1319
|
+
this.adjustHeight();
|
1320
|
+
this.notify(events.resizeEnd, {});
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
private keyActionHandler(e: KeyboardEventArgs): void {
|
1324
|
+
let uploadEle: HTMLElement;
|
1325
|
+
switch (e.action) {
|
1326
|
+
case 'altN':
|
1327
|
+
e.preventDefault();
|
1328
|
+
this.itemData = [getPathObject(this)];
|
1329
|
+
if (!hasContentAccess(this.itemData[0])) {
|
1330
|
+
createDeniedDialog(this, this.itemData[0], events.permissionEditContents);
|
1331
|
+
} else {
|
1332
|
+
createDialog(this, 'NewFolder');
|
1333
|
+
}
|
1334
|
+
break;
|
1335
|
+
case 'f5':
|
1336
|
+
e.preventDefault();
|
1337
|
+
refresh(this);
|
1338
|
+
break;
|
1339
|
+
/* istanbul ignore next */
|
1340
|
+
case 'ctrlShift1':
|
1341
|
+
e.preventDefault();
|
1342
|
+
this.fileView = 'Details';
|
1343
|
+
this.setProperties({ view: 'Details' }, true);
|
1344
|
+
showSpinner(this.element);
|
1345
|
+
updateLayout(this, 'Details');
|
1346
|
+
break;
|
1347
|
+
/* istanbul ignore next */
|
1348
|
+
case 'ctrlShift2':
|
1349
|
+
e.preventDefault();
|
1350
|
+
this.fileView = 'LargeIcons';
|
1351
|
+
this.setProperties({ view: 'LargeIcons' }, true);
|
1352
|
+
showSpinner(this.element);
|
1353
|
+
updateLayout(this, 'LargeIcons');
|
1354
|
+
break;
|
1355
|
+
case 'ctrlU':
|
1356
|
+
e.preventDefault();
|
1357
|
+
if (this.toolbarSettings.items.indexOf('Upload') !== -1){
|
1358
|
+
uploadEle = <HTMLElement>select('#' + this.element.id + CLS.UPLOAD_ID, this.element);
|
1359
|
+
uploadEle.click();
|
1360
|
+
}
|
1361
|
+
break;
|
1362
|
+
|
1363
|
+
}
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
private wireSelectOnDragEvent(isBind: boolean): void {
|
1367
|
+
if (isNOU(this.view)) {
|
1368
|
+
return;
|
1369
|
+
}
|
1370
|
+
if (isBind) {
|
1371
|
+
this.viewElem = this.view === 'LargeIcons' ? this.largeiconsviewModule.element : this.element.querySelector('.e-gridcontent');
|
1372
|
+
}
|
1373
|
+
if (isBind) {
|
1374
|
+
if (this.allowMultiSelection) {
|
1375
|
+
this.on(events.layoutChange, this.onLayoutChange, this);
|
1376
|
+
this.on(events.selectionChanged, this.onLayoutChange, this);
|
1377
|
+
}
|
1378
|
+
}
|
1379
|
+
else {
|
1380
|
+
this.off(events.layoutChange, this.onLayoutChange);
|
1381
|
+
this.off(events.selectionChanged, this.onLayoutChange);
|
1382
|
+
}
|
1383
|
+
if (this.viewElem) {
|
1384
|
+
if (isBind && this.allowMultiSelection) {
|
1385
|
+
EventHandler.add(this.viewElem, 'mousedown', this.onDragStart, this);
|
1386
|
+
} else {
|
1387
|
+
EventHandler.remove(this.viewElem, 'mousedown', this.onDragStart);
|
1388
|
+
}
|
1389
|
+
}
|
1390
|
+
}
|
1391
|
+
|
1392
|
+
private wireEvents(): void {
|
1393
|
+
if (this.enableRangeSelection) {
|
1394
|
+
this.wireSelectOnDragEvent(true);
|
1395
|
+
}
|
1396
|
+
EventHandler.add(<HTMLElement & Window><unknown>window, 'resize', this.resizeHandler, this);
|
1397
|
+
if (this.contextMenuSettings.visible) {
|
1398
|
+
this.element.addEventListener('scroll', this.onScrollHandler, true);
|
1399
|
+
}
|
1400
|
+
this.keyboardModule = new KeyboardEvents(
|
1401
|
+
this.element,
|
1402
|
+
{
|
1403
|
+
keyAction: this.keyActionHandler.bind(this),
|
1404
|
+
keyConfigs: this.keyConfigs,
|
1405
|
+
eventName: 'keydown'
|
1406
|
+
}
|
1407
|
+
);
|
1408
|
+
}
|
1409
|
+
|
1410
|
+
private unWireEvents(): void {
|
1411
|
+
this.wireSelectOnDragEvent(false);
|
1412
|
+
EventHandler.remove(<HTMLElement & Window><unknown>window, 'resize', this.resizeHandler);
|
1413
|
+
if (this.contextMenuSettings.visible) {
|
1414
|
+
this.element.removeEventListener('scroll', this.onScrollHandler, true);
|
1415
|
+
}
|
1416
|
+
this.keyboardModule.destroy();
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
private onScrollHandler = (): void => {
|
1420
|
+
if (!isNOU(this.contextmenuModule) && !isNOU(this.contextmenuModule.contextMenu)) {
|
1421
|
+
this.contextmenuModule.contextMenu.close();
|
1422
|
+
}
|
1423
|
+
};
|
1424
|
+
|
1425
|
+
private onDragStart(event: MouseEvent): void {
|
1426
|
+
if (this.viewElem) {
|
1427
|
+
if (this.allowDragAndDrop) {
|
1428
|
+
const targetElement: Element = closest(event.target as Element, this.viewElem.classList.contains('e-large-icons') ? '.e-list-item' : '.e-fe-text');
|
1429
|
+
if (targetElement) {
|
1430
|
+
return;
|
1431
|
+
}
|
1432
|
+
}
|
1433
|
+
event.preventDefault();
|
1434
|
+
this.dragX = event.pageX;
|
1435
|
+
this.dragY = event.pageY;
|
1436
|
+
if (!this.dragSelectElement) {
|
1437
|
+
this.dragSelectElement = createElement('div', {
|
1438
|
+
id: this.element.id + '_drag',
|
1439
|
+
className: 'e-filemanager e-drag-select',
|
1440
|
+
styles: 'left: ' + this.dragX + 'px;top: ' + this.dragY + 'px;'
|
1441
|
+
});
|
1442
|
+
document.body.append(this.dragSelectElement);
|
1443
|
+
}
|
1444
|
+
EventHandler.add(document, 'mouseup', this.onDragStop, this);
|
1445
|
+
EventHandler.add(this.viewElem, 'mousemove', this.onDrag, this);
|
1446
|
+
EventHandler.add(this.dragSelectElement, 'mousemove', this.onDrag, this);
|
1447
|
+
}
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
private onDrag(event: MouseEvent): void {
|
1451
|
+
event.stopPropagation();
|
1452
|
+
if (this.dragSelectElement) {
|
1453
|
+
const diffX: number = event.pageX - this.dragX;
|
1454
|
+
const diffY: number = event.pageY - this.dragY;
|
1455
|
+
setStyleAttribute(this.dragSelectElement, {
|
1456
|
+
'left': diffX < 0 ? this.dragX + diffX + 'px' : this.dragX + 'px', 'top': diffY < 0 ? this.dragY + diffY + 'px' : this.dragY + 'px',
|
1457
|
+
'height': Math.abs(diffY) + 'px', 'width': Math.abs(diffX) + 'px'
|
1458
|
+
});
|
1459
|
+
this.selectItems();
|
1460
|
+
}
|
1461
|
+
else {
|
1462
|
+
EventHandler.remove(this.viewElem, 'mousemove', this.onDrag);
|
1463
|
+
}
|
1464
|
+
}
|
1465
|
+
|
1466
|
+
private onDragStop(): void {
|
1467
|
+
if (this.viewElem) {
|
1468
|
+
EventHandler.remove(document, 'mouseup', this.onDragStop);
|
1469
|
+
EventHandler.remove(this.viewElem, 'mousemove', this.onDrag);
|
1470
|
+
}
|
1471
|
+
if (this.dragSelectElement) {
|
1472
|
+
EventHandler.remove(this.dragSelectElement, 'mousemove', this.onDrag);
|
1473
|
+
if (this.dragSelectElement.clientHeight > 0 && this.dragSelectElement.clientWidth > 0) {
|
1474
|
+
this.setProperties({ selectedItems: this.dragSelectedItems });
|
1475
|
+
}
|
1476
|
+
this.dragSelectedItems = [];
|
1477
|
+
detach(this.dragSelectElement);
|
1478
|
+
this.dragSelectElement = null;
|
1479
|
+
}
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
private selectItems(): void {
|
1483
|
+
const dragRect: DOMRect = this.dragSelectElement.getBoundingClientRect() as DOMRect;
|
1484
|
+
if (dragRect.height > 0 && dragRect.width > 0) {
|
1485
|
+
this.dragSelectedItems = [];
|
1486
|
+
removeClass(selectAll('.e-active', this.viewElem), ['e-active', 'e-focus']);
|
1487
|
+
removeClass(selectAll('.e-check', this.viewElem), ['e-check']);
|
1488
|
+
}
|
1489
|
+
const allItems: HTMLElement[] = selectAll(this.viewElem.classList.contains('e-large-icons') ? '.e-list-item' : '.e-row', this.viewElem);
|
1490
|
+
for (const item of allItems) {
|
1491
|
+
const itemRect: DOMRect = item.getBoundingClientRect() as DOMRect;
|
1492
|
+
if (!(dragRect.right < itemRect.left || dragRect.left > itemRect.right
|
1493
|
+
|| dragRect.bottom < itemRect.top || dragRect.top > itemRect.bottom)
|
1494
|
+
&& (dragRect.height > 0 && dragRect.width > 0)) {
|
1495
|
+
if (this.viewElem.classList.contains('e-large-icons')) {
|
1496
|
+
item.classList.add('e-active');
|
1497
|
+
this.dragSelectedItems.push(item.getAttribute('title'));
|
1498
|
+
}
|
1499
|
+
else {
|
1500
|
+
addClass(selectAll('.e-rowcell', item), ['e-active']);
|
1501
|
+
this.dragSelectedItems.push(item.querySelector('.e-drag-text').textContent);
|
1502
|
+
}
|
1503
|
+
if (this.showItemCheckBoxes) {
|
1504
|
+
item.querySelector('.e-frame').classList.add('e-check');
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
}
|
1508
|
+
}
|
1509
|
+
|
1510
|
+
private onLayoutChange(): void {
|
1511
|
+
if (this.enableRangeSelection) {
|
1512
|
+
this.unWireEvents();
|
1513
|
+
this.wireEvents();
|
1514
|
+
}
|
1515
|
+
}
|
1516
|
+
|
1517
|
+
private setPath(): void {
|
1518
|
+
this.setProperties({ selectedItems: [] }, true);
|
1519
|
+
this.ensurePath();
|
1520
|
+
this.notify(events.clearPathInit, { selectedNode: this.pathId[0] });
|
1521
|
+
read(this, (this.path !== this.originalPath) ? events.initialEnd : events.finalizeEnd, this.path);
|
1522
|
+
}
|
1523
|
+
|
1524
|
+
/**
|
1525
|
+
* Called internally if any of the property value changed.
|
1526
|
+
*
|
1527
|
+
* @param {FileManager} newProp
|
1528
|
+
* @param {FileManager} oldProp
|
1529
|
+
* @returns void
|
1530
|
+
* @private
|
1531
|
+
*/
|
1532
|
+
/* istanbul ignore next */
|
1533
|
+
public onPropertyChanged(newProp: FileManagerModel, oldProp: FileManagerModel): void {
|
1534
|
+
let height: string | number;
|
1535
|
+
let requiresRefresh: boolean = false;
|
1536
|
+
for (const prop of Object.keys(newProp)) {
|
1537
|
+
switch (prop) {
|
1538
|
+
case 'ajaxSettings':
|
1539
|
+
this.ajaxSettingSetModel(newProp);
|
1540
|
+
break;
|
1541
|
+
case 'allowDragAndDrop':
|
1542
|
+
this.allowDragAndDrop = newProp.allowDragAndDrop;
|
1543
|
+
this.notify(events.modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
1544
|
+
break;
|
1545
|
+
case 'showItemCheckBoxes':
|
1546
|
+
this.showItemCheckBoxes = newProp.showItemCheckBoxes;
|
1547
|
+
this.notify(events.modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
1548
|
+
break;
|
1549
|
+
case 'enableVirtualization':
|
1550
|
+
this.enableVirtualization = newProp.enableVirtualization;
|
1551
|
+
requiresRefresh = true;
|
1552
|
+
break;
|
1553
|
+
case 'allowMultiSelection':
|
1554
|
+
if (this.allowMultiSelection) {
|
1555
|
+
addClass([this.element], CLS.CHECK_SELECT);
|
1556
|
+
} else {
|
1557
|
+
if (this.selectedItems.length > 1) {
|
1558
|
+
this.setProperties({ selectedItems: this.selectedItems.slice(this.selectedItems.length - 1) }, true);
|
1559
|
+
}
|
1560
|
+
removeClass([this.element], CLS.CHECK_SELECT);
|
1561
|
+
}
|
1562
|
+
this.notify(events.modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
1563
|
+
break;
|
1564
|
+
case 'cssClass':
|
1565
|
+
this.addCssClass(oldProp.cssClass, newProp.cssClass);
|
1566
|
+
this.notify(events.modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
1567
|
+
break;
|
1568
|
+
case 'detailsViewSettings':
|
1569
|
+
this.notify(events.modelChanged, { module: 'detailsview', newProp: newProp, oldProp: oldProp });
|
1570
|
+
break;
|
1571
|
+
case 'enableRangeSelection':
|
1572
|
+
this.wireSelectOnDragEvent(false);
|
1573
|
+
if (newProp.enableRangeSelection) {
|
1574
|
+
this.wireSelectOnDragEvent(true);
|
1575
|
+
}
|
1576
|
+
break;
|
1577
|
+
case 'enableRtl':
|
1578
|
+
this.enableRtl = newProp.enableRtl;
|
1579
|
+
requiresRefresh = true;
|
1580
|
+
break;
|
1581
|
+
case 'rootAliasName':
|
1582
|
+
this.rootAliasName = newProp.rootAliasName;
|
1583
|
+
requiresRefresh = true;
|
1584
|
+
break;
|
1585
|
+
case 'height':
|
1586
|
+
height = !isNOU(newProp.height) ? formatUnit(newProp.height) : newProp.height;
|
1587
|
+
setAttr(this.element, { 'height': height });
|
1588
|
+
this.adjustHeight();
|
1589
|
+
this.notify(events.modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
1590
|
+
break;
|
1591
|
+
case 'locale':
|
1592
|
+
if (!isNOU(newProp.enableRtl)) {
|
1593
|
+
this.setProperties({ enableRtl: newProp.enableRtl }, true);
|
1594
|
+
}
|
1595
|
+
this.localeSetModelOption(newProp);
|
1596
|
+
break;
|
1597
|
+
case 'navigationPaneSettings':
|
1598
|
+
this.splitterAdjust();
|
1599
|
+
this.notify(events.modelChanged, { module: 'navigationpane', newProp: newProp, oldProp: oldProp });
|
1600
|
+
break;
|
1601
|
+
case 'path':
|
1602
|
+
this.oldPath = oldProp.path;
|
1603
|
+
this.setPath();
|
1604
|
+
break;
|
1605
|
+
case 'searchSettings':
|
1606
|
+
if (!isNullOrUndefined(newProp.searchSettings.allowSearchOnTyping)) {
|
1607
|
+
this.setProperties({ searchSettings: { allowSearchOnTyping: newProp.searchSettings.allowSearchOnTyping } }, true);
|
1608
|
+
}
|
1609
|
+
if (isNullOrUndefined(newProp.searchSettings.ignoreCase)) {
|
1610
|
+
this.setProperties({ searchSettings: { ignoreCase: newProp.searchSettings.ignoreCase } }, true);
|
1611
|
+
}
|
1612
|
+
if (isNullOrUndefined(newProp.searchSettings.filterType)) {
|
1613
|
+
this.setProperties({ searchSettings: { filterType: newProp.searchSettings.filterType } }, true);
|
1614
|
+
}
|
1615
|
+
this.notify(events.modelChanged, { module: 'breadcrumbbar', newProp: newProp, oldProp: oldProp });
|
1616
|
+
break;
|
1617
|
+
case 'selectedItems':
|
1618
|
+
if (this.view === 'Details') {
|
1619
|
+
this.notify(events.modelChanged, { module: 'detailsview', newProp: newProp, oldProp: oldProp });
|
1620
|
+
} else if (this.view === 'LargeIcons') {
|
1621
|
+
this.notify(events.modelChanged, { module: 'largeiconsview', newProp: newProp, oldProp: oldProp });
|
1622
|
+
}
|
1623
|
+
break;
|
1624
|
+
case 'showFileExtension':
|
1625
|
+
this.notify(events.modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
1626
|
+
break;
|
1627
|
+
case 'showHiddenItems':
|
1628
|
+
this.notify(events.modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
1629
|
+
break;
|
1630
|
+
case 'showThumbnail':
|
1631
|
+
this.notify(events.modelChanged, { module: 'largeiconsview', newProp: newProp, oldProp: oldProp });
|
1632
|
+
break;
|
1633
|
+
case 'toolbarSettings':
|
1634
|
+
case 'toolbarItems':
|
1635
|
+
this.adjustHeight();
|
1636
|
+
this.notify(events.modelChanged, { module: 'toolbar', newProp: newProp, oldProp: oldProp });
|
1637
|
+
break;
|
1638
|
+
case 'uploadSettings':
|
1639
|
+
this.updateUploader();
|
1640
|
+
break;
|
1641
|
+
case 'view':
|
1642
|
+
if (newProp.view === 'Details') {
|
1643
|
+
this.notify(events.modelChanged, { module: 'detailsview', newProp: newProp, oldProp: oldProp });
|
1644
|
+
} else if (newProp.view === 'LargeIcons') {
|
1645
|
+
this.notify(events.modelChanged, { module: 'largeiconsview', newProp: newProp, oldProp: oldProp });
|
1646
|
+
}
|
1647
|
+
break;
|
1648
|
+
case 'width':
|
1649
|
+
setAttr(this.element, { 'width': !isNOU(newProp.width) ? formatUnit(newProp.width) : newProp.width });
|
1650
|
+
this.notify(events.modelChanged, { module: 'common', newProp: newProp, oldProp: oldProp });
|
1651
|
+
break;
|
1652
|
+
case 'sortOrder':
|
1653
|
+
refresh(this);
|
1654
|
+
this.notify(events.sortByChange, {});
|
1655
|
+
break;
|
1656
|
+
case 'sortBy':
|
1657
|
+
if (this.view === 'Details') {
|
1658
|
+
const columns: ColumnModel[] = this.detailsViewSettings.columns;
|
1659
|
+
const isValidSortField: boolean = !isNullOrUndefined(columns) &&
|
1660
|
+
columns.findIndex((col: ColumnModel) => col.field === this.sortBy) !== -1;
|
1661
|
+
if (!isValidSortField) {
|
1662
|
+
return;
|
1663
|
+
}
|
1664
|
+
refresh(this);
|
1665
|
+
this.notify(events.sortByChange, {});
|
1666
|
+
this.notify(events.sortColumn, {});
|
1667
|
+
}
|
1668
|
+
else {
|
1669
|
+
refresh(this);
|
1670
|
+
this.notify(events.sortByChange, {});
|
1671
|
+
}
|
1672
|
+
break;
|
1673
|
+
case 'popupTarget':
|
1674
|
+
if (this.uploadDialogObj) {
|
1675
|
+
this.uploadDialogObj.target = newProp.popupTarget;
|
1676
|
+
}
|
1677
|
+
if (this.dialogObj) {
|
1678
|
+
this.dialogObj.target = newProp.popupTarget;
|
1679
|
+
}
|
1680
|
+
if (this.extDialogObj) {
|
1681
|
+
this.extDialogObj.target = newProp.popupTarget;
|
1682
|
+
}
|
1683
|
+
if (this.viewerObj) {
|
1684
|
+
this.viewerObj.target = newProp.popupTarget;
|
1685
|
+
}
|
1686
|
+
break;
|
1687
|
+
case 'fileSystemData':
|
1688
|
+
this.fileSystemData = newProp.fileSystemData;
|
1689
|
+
requiresRefresh = true;
|
1690
|
+
break;
|
1691
|
+
}
|
1692
|
+
}
|
1693
|
+
if (requiresRefresh) {
|
1694
|
+
this.refresh();
|
1695
|
+
}
|
1696
|
+
}
|
1697
|
+
/* istanbul ignore next */
|
1698
|
+
private ajaxSettingSetModel(newProp: FileManagerModel): void {
|
1699
|
+
if (!isNullOrUndefined(newProp.ajaxSettings.url)) {
|
1700
|
+
this.setProperties({ ajaxSettings: { url: newProp.ajaxSettings.url } }, true);
|
1701
|
+
}
|
1702
|
+
if (!isNullOrUndefined(newProp.ajaxSettings.uploadUrl)) {
|
1703
|
+
this.setProperties({ ajaxSettings: { uploadUrl: newProp.ajaxSettings.uploadUrl } }, true);
|
1704
|
+
}
|
1705
|
+
if (!isNullOrUndefined(newProp.ajaxSettings.downloadUrl)) {
|
1706
|
+
this.setProperties({ ajaxSettings: { downloadUrl: newProp.ajaxSettings.downloadUrl } }, true);
|
1707
|
+
}
|
1708
|
+
if (!isNullOrUndefined(newProp.ajaxSettings.getImageUrl)) {
|
1709
|
+
this.setProperties({ ajaxSettings: { getImageUrl: newProp.ajaxSettings.getImageUrl } }, true);
|
1710
|
+
}
|
1711
|
+
this.setProperties({ path: '/' }, true);
|
1712
|
+
this.setProperties({ selectedItems: [] }, true);
|
1713
|
+
super.refresh();
|
1714
|
+
}
|
1715
|
+
|
1716
|
+
/* istanbul ignore next */
|
1717
|
+
private localeSetModelOption(newProp: FileManagerModel): void {
|
1718
|
+
this.uploadObj.locale = newProp.locale;
|
1719
|
+
super.refresh();
|
1720
|
+
}
|
1721
|
+
|
1722
|
+
/**
|
1723
|
+
* Triggers when the component is destroyed.
|
1724
|
+
*
|
1725
|
+
* @returns {void}
|
1726
|
+
*/
|
1727
|
+
public destroy(): void {
|
1728
|
+
if (this.isDestroyed) { return; }
|
1729
|
+
if (!this.refreshing) {
|
1730
|
+
this.notify(events.destroy, {});
|
1731
|
+
}
|
1732
|
+
this.uploadObj.destroy();
|
1733
|
+
this.uploadObj = null;
|
1734
|
+
this.uploadDialogObj.destroy();
|
1735
|
+
this.uploadDialogObj = null;
|
1736
|
+
this.splitterObj.destroy();
|
1737
|
+
this.splitterObj = null;
|
1738
|
+
if (this.dialogObj) {
|
1739
|
+
this.dialogObj.destroy();
|
1740
|
+
this.dialogObj = null;
|
1741
|
+
}
|
1742
|
+
if (this.viewerObj) {
|
1743
|
+
this.viewerObj.destroy();
|
1744
|
+
this.viewerObj = null;
|
1745
|
+
}
|
1746
|
+
if (this.extDialogObj) {
|
1747
|
+
this.extDialogObj.destroy();
|
1748
|
+
this.extDialogObj = null;
|
1749
|
+
}
|
1750
|
+
this.element.removeAttribute('style');
|
1751
|
+
this.element.removeAttribute('tabindex');
|
1752
|
+
this.removeEventListeners();
|
1753
|
+
this.unWireEvents();
|
1754
|
+
this.addCssClass(this.cssClass, null);
|
1755
|
+
removeClass([this.element], [CLS.RTL, CLS.MOBILE, CLS.CHECK_SELECT]);
|
1756
|
+
this.element.innerHTML = '';
|
1757
|
+
this.breadCrumbBarNavigation = null;
|
1758
|
+
this.activeElements = null;
|
1759
|
+
this.virtualDragElement = null;
|
1760
|
+
this.visitedItem = null;
|
1761
|
+
super.destroy();
|
1762
|
+
this.virtualizationModule = null;
|
1763
|
+
this.navigationpaneModule = null;
|
1764
|
+
this.toolbarModule = null;
|
1765
|
+
this.contextmenuModule = null;
|
1766
|
+
this.largeiconsviewModule = null;
|
1767
|
+
this.detailsviewModule = null;
|
1768
|
+
this.breadcrumbbarModule = null;
|
1769
|
+
this.viewElem = null;
|
1770
|
+
this.dragSelectElement = null;
|
1771
|
+
this.dragSelectedItems = null;
|
1772
|
+
}
|
1773
|
+
|
1774
|
+
/**
|
1775
|
+
* Creates a new folder in file manager.
|
1776
|
+
*
|
1777
|
+
* @param {string} name – Specifies the name of new folder in current path.
|
1778
|
+
* If it is not specified, then the default new folder dialog will be opened.
|
1779
|
+
* @returns {void}
|
1780
|
+
*/
|
1781
|
+
public createFolder(name?: string): void {
|
1782
|
+
this.notify(events.methodCall, { action: 'createFolder' });
|
1783
|
+
const details: Object[] = [getPathObject(this)];
|
1784
|
+
this.itemData = details;
|
1785
|
+
if (name) {
|
1786
|
+
if (/[/\\|*?"<>:]/.test(name)) {
|
1787
|
+
const result: ReadArgs = {
|
1788
|
+
files: null,
|
1789
|
+
error: {
|
1790
|
+
code: '402',
|
1791
|
+
message: getLocaleText(this, 'Validation-Invalid').replace('{0}', '"' + name + '"'),
|
1792
|
+
fileExists: null
|
1793
|
+
}
|
1794
|
+
};
|
1795
|
+
createDialog(this, 'Error', result);
|
1796
|
+
} else {
|
1797
|
+
if (!hasContentAccess(details[0])) {
|
1798
|
+
createDeniedDialog(this, details[0], events.permissionEditContents);
|
1799
|
+
} else {
|
1800
|
+
createFolder(this, name);
|
1801
|
+
}
|
1802
|
+
}
|
1803
|
+
} else {
|
1804
|
+
createNewFolder(this);
|
1805
|
+
}
|
1806
|
+
}
|
1807
|
+
|
1808
|
+
/**
|
1809
|
+
* Deletes the folders or files from the given unique identifiers.
|
1810
|
+
*
|
1811
|
+
* @param {string} ids - Specifies the name of folders or files in current path. If you want to delete the nested level folders or
|
1812
|
+
* files, then specify the filter path along with name of the folders or files when performing the search or custom filtering.
|
1813
|
+
* For ID based file provider, specify the unique identifier of folders or files.
|
1814
|
+
* If it is not specified, then delete confirmation dialog will be opened for selected item.
|
1815
|
+
*
|
1816
|
+
* @returns {void}
|
1817
|
+
*/
|
1818
|
+
public deleteFiles(ids?: string[]): void {
|
1819
|
+
this.notify(events.methodCall, { action: 'deleteFiles', ids: ids });
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
/**
|
1823
|
+
* Disables the specified toolbar items of the file manager.
|
1824
|
+
*
|
1825
|
+
* @param {string[]} items - Specifies an array of items to be disabled.
|
1826
|
+
* @returns {void}
|
1827
|
+
*/
|
1828
|
+
public disableToolbarItems(items: string[]): void {
|
1829
|
+
if (!isNOU(items) && this.toolbarModule) {
|
1830
|
+
this.toolbarModule.enableItems(items, false);
|
1831
|
+
}
|
1832
|
+
}
|
1833
|
+
|
1834
|
+
/**
|
1835
|
+
* Downloads the folders or files from the given unique identifiers.
|
1836
|
+
*
|
1837
|
+
* @param {string} ids - Specifies the name of folders or files in current path. If you want to download the nested level folders
|
1838
|
+
* or files, then specify the filter path along with name of the folders or files when performing search or custom filtering.
|
1839
|
+
* For ID based file provider, specify the unique identifier of folders or files.
|
1840
|
+
* If it is not specified, then the selected items will be downloaded.
|
1841
|
+
*
|
1842
|
+
* @returns {void}
|
1843
|
+
*/
|
1844
|
+
public downloadFiles(ids?: string[]): void {
|
1845
|
+
this.notify(events.methodCall, { action: 'downloadFiles', ids: ids });
|
1846
|
+
}
|
1847
|
+
|
1848
|
+
/**
|
1849
|
+
* Enables the specified toolbar items of the file manager.
|
1850
|
+
*
|
1851
|
+
* @param {string[]} items - Specifies an array of items to be enabled.
|
1852
|
+
* @returns {void}
|
1853
|
+
*/
|
1854
|
+
public enableToolbarItems(items: string[]): void {
|
1855
|
+
if (!isNOU(items) && this.toolbarModule) {
|
1856
|
+
this.toolbarModule.enableItems(items, true);
|
1857
|
+
}
|
1858
|
+
}
|
1859
|
+
/**
|
1860
|
+
* Enables the specified menu items of the file manager.
|
1861
|
+
*
|
1862
|
+
* @param {string[]} items - Specifies an array of items to be enabled.
|
1863
|
+
* @returns {void}
|
1864
|
+
*/
|
1865
|
+
public enableMenuItems(items: string[]): void {
|
1866
|
+
if (!isNOU(items) && !isNOU(this.contextmenuModule) && !isNOU(this.contextmenuModule.contextMenu)) {
|
1867
|
+
this.contextmenuModule.enableItems(items, true, true);
|
1868
|
+
}
|
1869
|
+
}
|
1870
|
+
/**
|
1871
|
+
* Disables the specified context menu items in file manager. This method is used only in the menuOpen event.
|
1872
|
+
*
|
1873
|
+
* @param {string[]} items - Specifies an array of items to be disabled.
|
1874
|
+
* @returns {void}
|
1875
|
+
*/
|
1876
|
+
public disableMenuItems(items: string[]): void {
|
1877
|
+
if (!isNOU(items) && !isNOU(this.contextmenuModule) && !isNOU(this.contextmenuModule.contextMenu)) {
|
1878
|
+
this.contextmenuModule.disableItem(items);
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
|
1882
|
+
/**
|
1883
|
+
* Returns the index position of given current context menu item in file manager.
|
1884
|
+
*
|
1885
|
+
* @param {string} item - Specifies an item to get the index position.
|
1886
|
+
* @returns {number} - returns menu item index.
|
1887
|
+
*/
|
1888
|
+
public getMenuItemIndex(item: string): number {
|
1889
|
+
if (this.contextmenuModule) {
|
1890
|
+
return this.contextmenuModule.getItemIndex(item);
|
1891
|
+
} else {
|
1892
|
+
return -1;
|
1893
|
+
}
|
1894
|
+
}
|
1895
|
+
|
1896
|
+
/**
|
1897
|
+
* Returns the index position of given toolbar item in file manager.
|
1898
|
+
*
|
1899
|
+
* @param {string} item - Specifies an item to get the index position.
|
1900
|
+
* @returns {number} - returns toolbar item index.
|
1901
|
+
*/
|
1902
|
+
public getToolbarItemIndex(item: string): number {
|
1903
|
+
if (this.toolbarModule) {
|
1904
|
+
return this.toolbarModule.getItemIndex(item);
|
1905
|
+
} else {
|
1906
|
+
return -1;
|
1907
|
+
}
|
1908
|
+
}
|
1909
|
+
|
1910
|
+
/**
|
1911
|
+
* Display the custom filtering files in file manager.
|
1912
|
+
*
|
1913
|
+
* @param {Object} filterData - Specifies the custom filter details along with custom file action name,
|
1914
|
+
* which needs to be sent to the server side. If you do not specify the details, then default action name will be `filter`.
|
1915
|
+
*
|
1916
|
+
* @returns {void}
|
1917
|
+
*/
|
1918
|
+
public filterFiles(filterData?: Object): void {
|
1919
|
+
this.filterData = filterData ? filterData : null;
|
1920
|
+
this.setProperties({ selectedItems: [] }, true);
|
1921
|
+
this.notify(events.selectionChanged, {});
|
1922
|
+
this.isFiltered = true;
|
1923
|
+
if (this.breadcrumbbarModule.searchObj.element.value !== '') {
|
1924
|
+
this.breadcrumbbarModule.searchObj.element.value = '';
|
1925
|
+
}
|
1926
|
+
filter(this, events.filterEnd);
|
1927
|
+
}
|
1928
|
+
|
1929
|
+
/**
|
1930
|
+
* Gets the details of the selected files in the file manager.
|
1931
|
+
*
|
1932
|
+
* @returns {Object[]} - returns selected files.
|
1933
|
+
*/
|
1934
|
+
public getSelectedFiles(): Object[] {
|
1935
|
+
this.notify(events.updateSelectionData, {});
|
1936
|
+
return this.itemData;
|
1937
|
+
}
|
1938
|
+
|
1939
|
+
/**
|
1940
|
+
* Opens the corresponding file or folder from the given unique identifier.
|
1941
|
+
*
|
1942
|
+
* @param {string} id - Specifies the name of folder or file in current path. If you want to open the nested level folder or
|
1943
|
+
* file, then specify the filter path along with name of the folder or file when performing search or custom filtering. For ID based
|
1944
|
+
* file provider, specify the unique identifier of folder or file.
|
1945
|
+
*
|
1946
|
+
* @returns {void}
|
1947
|
+
*/
|
1948
|
+
public openFile(id: string): void {
|
1949
|
+
this.notify(events.methodCall, { action: 'openFile', id: id });
|
1950
|
+
}
|
1951
|
+
|
1952
|
+
/**
|
1953
|
+
* Refreshes the folder files of the file manager.
|
1954
|
+
*
|
1955
|
+
* @returns {void}
|
1956
|
+
*/
|
1957
|
+
public refreshFiles(): void {
|
1958
|
+
refresh(this);
|
1959
|
+
}
|
1960
|
+
|
1961
|
+
/**
|
1962
|
+
* Refreshes the layout of the file manager.
|
1963
|
+
*
|
1964
|
+
* @returns {void}
|
1965
|
+
*/
|
1966
|
+
public refreshLayout(): void {
|
1967
|
+
this.adjustHeight();
|
1968
|
+
this.notify(events.layoutRefresh, {});
|
1969
|
+
}
|
1970
|
+
|
1971
|
+
/**
|
1972
|
+
* Selects the entire folders and files in current path.
|
1973
|
+
*
|
1974
|
+
* @returns {void}
|
1975
|
+
*/
|
1976
|
+
public selectAll(): void {
|
1977
|
+
this.notify(events.methodCall, { action: 'selectAll' });
|
1978
|
+
}
|
1979
|
+
|
1980
|
+
/**
|
1981
|
+
* Specifies the method that must be invoked to traverse the path backwards in the file manager.
|
1982
|
+
*
|
1983
|
+
* @returns {void}
|
1984
|
+
*/
|
1985
|
+
public traverseBackward(): void {
|
1986
|
+
if (this.pathNames.length > 1 && this.breadcrumbbarModule.searchObj.element.value === '' && !this.isFiltered) {
|
1987
|
+
this.pathId.pop();
|
1988
|
+
this.pathNames.pop();
|
1989
|
+
let newPath: string = this.pathNames.slice(1).join('/');
|
1990
|
+
newPath = newPath === '' ? '/' : '/' + newPath + '/';
|
1991
|
+
this.setProperties({ path: newPath }, true);
|
1992
|
+
read(this, events.pathChanged, this.path);
|
1993
|
+
const treeNodeId: string = this.pathId[this.pathId.length - 1];
|
1994
|
+
this.notify(events.updateTreeSelection, { module: 'treeview', selectedNode: treeNodeId });
|
1995
|
+
}
|
1996
|
+
}
|
1997
|
+
|
1998
|
+
/**
|
1999
|
+
* Deselects the currently selected folders and files in current path.
|
2000
|
+
*
|
2001
|
+
* @returns {void}
|
2002
|
+
*/
|
2003
|
+
public clearSelection(): void {
|
2004
|
+
this.notify(events.methodCall, { action: 'clearSelection' });
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
/**
|
2008
|
+
* Renames the file or folder with given new name in file manager.
|
2009
|
+
*
|
2010
|
+
* @param {string} id - Specifies the name of folder or file in current path. If you want to rename the nested level folder or
|
2011
|
+
* file, then specify the filter path along with name of the folder or file when performing search or custom filtering. For ID based
|
2012
|
+
* file provider, specify the unique identifier of folder or file.
|
2013
|
+
* If it is not specified, then rename dialog will be opened for selected item.
|
2014
|
+
*
|
2015
|
+
* @param {string} name – Specifies the new name of the file or folder in current path. If it is not specified, then rename dialog
|
2016
|
+
* will be opened for given identifier.
|
2017
|
+
*
|
2018
|
+
* @returns {void}
|
2019
|
+
*/
|
2020
|
+
public renameFile(id?: string, name?: string): void {
|
2021
|
+
this.notify(events.methodCall, { action: 'renameFile', id: id, newName: name });
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
/**
|
2025
|
+
* Opens the upload dialog in file manager.
|
2026
|
+
*
|
2027
|
+
* @returns {void}
|
2028
|
+
*/
|
2029
|
+
public uploadFiles(): void {
|
2030
|
+
const details: Object[] = [getPathObject(this)];
|
2031
|
+
this.itemData = details;
|
2032
|
+
uploadItem(this);
|
2033
|
+
}
|
2034
|
+
|
2035
|
+
/**
|
2036
|
+
* Specifies the method which must be invoked to programmatically close the dialog popup in the file manager.
|
2037
|
+
*
|
2038
|
+
* @returns {void}
|
2039
|
+
*/
|
2040
|
+
public closeDialog(): void {
|
2041
|
+
closePopup(this);
|
2042
|
+
}
|
2043
|
+
|
2044
|
+
/**
|
2045
|
+
* Specifies the direction of FileManager
|
2046
|
+
*
|
2047
|
+
* @param {boolean} rtl - specifies rtl parameter.
|
2048
|
+
* @returns {void}
|
2049
|
+
*/
|
2050
|
+
private setRtl(rtl: boolean): void {
|
2051
|
+
if (rtl) {
|
2052
|
+
this.addCssClass(null, CLS.RTL);
|
2053
|
+
} else {
|
2054
|
+
this.addCssClass(CLS.RTL, null);
|
2055
|
+
}
|
2056
|
+
if (this.uploadObj) {
|
2057
|
+
this.uploadDialogObj.enableRtl = rtl;
|
2058
|
+
this.uploadObj.enableRtl = rtl;
|
2059
|
+
}
|
2060
|
+
}
|
2061
|
+
}
|