@syncfusion/ej2-filemanager 30.1.37 → 30.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +8 -3
- package/dist/es6/ej2-filemanager.es2015.js.map +1 -1
- package/dist/es6/ej2-filemanager.es5.js +7 -2
- 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/package.json +17 -52
- package/src/file-manager/common/utility.js +3 -0
- package/src/file-manager/layout/navigation-pane.js +4 -2
- package/styles/bds-lite.css +11 -12
- package/styles/bds.css +11 -12
- package/styles/bootstrap-dark-lite.css +11 -12
- package/styles/bootstrap-dark.css +11 -12
- package/styles/bootstrap-lite.css +11 -12
- package/styles/bootstrap.css +11 -12
- package/styles/bootstrap4-lite.css +11 -12
- package/styles/bootstrap4.css +11 -12
- package/styles/bootstrap5-dark-lite.css +11 -12
- package/styles/bootstrap5-dark.css +11 -12
- package/styles/bootstrap5-lite.css +11 -12
- package/styles/bootstrap5.3-lite.css +11 -12
- package/styles/bootstrap5.3.css +11 -12
- package/styles/bootstrap5.css +11 -12
- package/styles/fabric-dark-lite.css +11 -12
- package/styles/fabric-dark.css +11 -12
- package/styles/fabric-lite.css +11 -12
- package/styles/fabric.css +11 -12
- package/styles/file-manager/_layout.scss +7 -7
- package/styles/file-manager/bds.css +11 -12
- package/styles/file-manager/bootstrap-dark.css +11 -12
- package/styles/file-manager/bootstrap.css +11 -12
- package/styles/file-manager/bootstrap4.css +11 -12
- package/styles/file-manager/bootstrap5-dark.css +11 -12
- package/styles/file-manager/bootstrap5.3.css +11 -12
- package/styles/file-manager/bootstrap5.css +11 -12
- package/styles/file-manager/fabric-dark.css +11 -12
- package/styles/file-manager/fabric.css +11 -12
- package/styles/file-manager/fluent-dark.css +11 -12
- package/styles/file-manager/fluent.css +11 -12
- package/styles/file-manager/fluent2.css +11 -12
- package/styles/file-manager/highcontrast-light.css +11 -12
- package/styles/file-manager/highcontrast.css +11 -12
- package/styles/file-manager/material-dark.css +11 -12
- package/styles/file-manager/material.css +11 -12
- package/styles/file-manager/material3-dark.css +11 -12
- package/styles/file-manager/material3.css +11 -12
- package/styles/file-manager/tailwind-dark.css +11 -12
- package/styles/file-manager/tailwind.css +11 -12
- package/styles/file-manager/tailwind3.css +11 -12
- package/styles/fluent-dark-lite.css +11 -12
- package/styles/fluent-dark.css +11 -12
- package/styles/fluent-lite.css +11 -12
- package/styles/fluent.css +11 -12
- package/styles/fluent2-lite.css +11 -12
- package/styles/fluent2.css +11 -12
- package/styles/highcontrast-light-lite.css +11 -12
- package/styles/highcontrast-light.css +11 -12
- package/styles/highcontrast-lite.css +11 -12
- package/styles/highcontrast.css +11 -12
- package/styles/material-dark-lite.css +11 -12
- package/styles/material-dark.css +11 -12
- package/styles/material-lite.css +11 -12
- package/styles/material.css +11 -12
- package/styles/material3-dark-lite.css +11 -12
- package/styles/material3-dark.css +11 -12
- package/styles/material3-lite.css +11 -12
- package/styles/material3.css +11 -12
- package/styles/tailwind-dark-lite.css +11 -12
- package/styles/tailwind-dark.css +11 -12
- package/styles/tailwind-lite.css +11 -12
- package/styles/tailwind.css +11 -12
- package/styles/tailwind3-lite.css +11 -12
- package/styles/tailwind3.css +11 -12
- package/dist/ts/file-manager/actions/breadcrumb-bar.d.ts +0 -60
- package/dist/ts/file-manager/actions/breadcrumb-bar.ts +0 -423
- package/dist/ts/file-manager/actions/index.d.ts +0 -6
- package/dist/ts/file-manager/actions/index.ts +0 -6
- package/dist/ts/file-manager/actions/toolbar.d.ts +0 -54
- package/dist/ts/file-manager/actions/toolbar.ts +0 -609
- package/dist/ts/file-manager/actions/virtualization.d.ts +0 -93
- package/dist/ts/file-manager/actions/virtualization.ts +0 -324
- package/dist/ts/file-manager/base/classes.d.ts +0 -224
- package/dist/ts/file-manager/base/classes.ts +0 -225
- package/dist/ts/file-manager/base/constant.d.ts +0 -136
- package/dist/ts/file-manager/base/constant.ts +0 -137
- package/dist/ts/file-manager/base/file-manager-model.d.ts +0 -520
- package/dist/ts/file-manager/base/file-manager.d.ts +0 -867
- package/dist/ts/file-manager/base/file-manager.ts +0 -2061
- package/dist/ts/file-manager/base/index.d.ts +0 -8
- package/dist/ts/file-manager/base/index.ts +0 -8
- package/dist/ts/file-manager/base/interface.d.ts +0 -952
- package/dist/ts/file-manager/base/interface.ts +0 -931
- package/dist/ts/file-manager/common/index.d.ts +0 -5
- package/dist/ts/file-manager/common/index.ts +0 -5
- package/dist/ts/file-manager/common/operations.d.ts +0 -122
- package/dist/ts/file-manager/common/operations.ts +0 -1369
- package/dist/ts/file-manager/common/utility.d.ts +0 -644
- package/dist/ts/file-manager/common/utility.ts +0 -1728
- package/dist/ts/file-manager/index.d.ts +0 -9
- package/dist/ts/file-manager/index.ts +0 -9
- package/dist/ts/file-manager/layout/details-view.d.ts +0 -152
- package/dist/ts/file-manager/layout/details-view.ts +0 -1990
- package/dist/ts/file-manager/layout/index.d.ts +0 -6
- package/dist/ts/file-manager/layout/index.ts +0 -6
- package/dist/ts/file-manager/layout/large-icons-view.d.ts +0 -157
- package/dist/ts/file-manager/layout/large-icons-view.ts +0 -1684
- package/dist/ts/file-manager/layout/navigation-pane.d.ts +0 -104
- package/dist/ts/file-manager/layout/navigation-pane.ts +0 -919
- package/dist/ts/file-manager/models/ajax-settings-model.d.ts +0 -36
- package/dist/ts/file-manager/models/ajax-settings.d.ts +0 -30
- package/dist/ts/file-manager/models/ajax-settings.ts +0 -39
- package/dist/ts/file-manager/models/column-model.d.ts +0 -155
- package/dist/ts/file-manager/models/column.d.ts +0 -179
- package/dist/ts/file-manager/models/column.ts +0 -216
- package/dist/ts/file-manager/models/contextMenu-settings-model.d.ts +0 -36
- package/dist/ts/file-manager/models/contextMenu-settings.d.ts +0 -33
- package/dist/ts/file-manager/models/contextMenu-settings.ts +0 -44
- package/dist/ts/file-manager/models/default-locale.d.ts +0 -4
- package/dist/ts/file-manager/models/default-locale.ts +0 -101
- package/dist/ts/file-manager/models/details-view-settings-model.d.ts +0 -30
- package/dist/ts/file-manager/models/details-view-settings.d.ts +0 -31
- package/dist/ts/file-manager/models/details-view-settings.ts +0 -54
- package/dist/ts/file-manager/models/index.d.ts +0 -19
- package/dist/ts/file-manager/models/index.ts +0 -19
- package/dist/ts/file-manager/models/navigation-pane-settings-model.d.ts +0 -40
- package/dist/ts/file-manager/models/navigation-pane-settings.d.ts +0 -34
- package/dist/ts/file-manager/models/navigation-pane-settings.ts +0 -42
- package/dist/ts/file-manager/models/search-settings-model.d.ts +0 -42
- package/dist/ts/file-manager/models/search-settings.d.ts +0 -44
- package/dist/ts/file-manager/models/search-settings.ts +0 -53
- package/dist/ts/file-manager/models/toolbar-settings-model.d.ts +0 -197
- package/dist/ts/file-manager/models/toolbar-settings.d.ts +0 -174
- package/dist/ts/file-manager/models/toolbar-settings.ts +0 -198
- package/dist/ts/file-manager/models/upload-settings-model.d.ts +0 -70
- package/dist/ts/file-manager/models/upload-settings.d.ts +0 -61
- package/dist/ts/file-manager/models/upload-settings.ts +0 -75
- package/dist/ts/file-manager/pop-up/context-menu.d.ts +0 -64
- package/dist/ts/file-manager/pop-up/context-menu.ts +0 -693
- package/dist/ts/file-manager/pop-up/dialog.d.ts +0 -31
- package/dist/ts/file-manager/pop-up/dialog.ts +0 -1009
- package/dist/ts/file-manager/pop-up/index.d.ts +0 -5
- package/dist/ts/file-manager/pop-up/index.ts +0 -5
- package/dist/ts/index.d.ts +0 -4
- package/dist/ts/index.ts +0 -4
@@ -1,1990 +0,0 @@
|
|
1
|
-
import { Grid, Resize, ContextMenu, Sort, VirtualScroll, RowSelectEventArgs, RowDeselectEventArgs, Column, GridModel } from '@syncfusion/ej2-grids';
|
2
|
-
import { select, KeyboardEvents, EventHandler, KeyboardEventArgs, getValue, isNullOrUndefined } from '@syncfusion/ej2-base';
|
3
|
-
import { isNullOrUndefined as isNOU, Touch, TapEventArgs, setValue, addClass, removeClass } from '@syncfusion/ej2-base';
|
4
|
-
import { Internationalization, closest, DragEventArgs, Draggable, initializeCSPTemplate, extend, SanitizeHtmlHelper } from '@syncfusion/ej2-base';
|
5
|
-
import { FileManager } from '../base/file-manager';
|
6
|
-
import { DataManager, Query } from '@syncfusion/ej2-data';
|
7
|
-
import { hideSpinner, showSpinner } from '@syncfusion/ej2-popups';
|
8
|
-
import * as events from '../base/constant';
|
9
|
-
import * as CLS from '../base/classes';
|
10
|
-
import { ReadArgs, SearchArgs, FileDetails, NotifyArgs, SortOrder, BeforeImageLoadEventArgs } from '../base/interface';
|
11
|
-
import { FileSelectEventArgs, FileLoadEventArgs, FileSelectionEventArgs } from '../base/interface';
|
12
|
-
import { FileOpenEventArgs } from '../base/interface';
|
13
|
-
import { createDialog, createImageDialog } from '../pop-up/dialog';
|
14
|
-
import { removeBlur, openAction, getImageUrl, fileType, getSortedData, getLocaleText, updateLayout } from '../common/utility';
|
15
|
-
import { createEmptyElement } from '../common/utility';
|
16
|
-
import { read, Download, GetDetails, Delete } from '../common/operations';
|
17
|
-
import { cutFiles, addBlur, openSearchFolder, copyFiles, removeActive, pasteHandler, getPathObject, getName } from '../common/index';
|
18
|
-
import { hasReadAccess, hasEditAccess, hasDownloadAccess, doRename, getAccessClass, createDeniedDialog, rename } from '../common/index';
|
19
|
-
import { createVirtualDragElement, dragStopHandler, dragStartHandler, draggingHandler, getModule, getFullPath } from '../common/index';
|
20
|
-
import { getDirectoryPath, updateRenamingData, getItemName, doDeleteFiles, doDownloadFiles } from '../common/index';
|
21
|
-
import { RecordDoubleClickEventArgs, RowDataBoundEventArgs, SortEventArgs, HeaderCellInfoEventArgs } from '@syncfusion/ej2-grids';
|
22
|
-
import { BeforeDataBoundArgs, ColumnModel, SortDescriptorModel, BeforeCopyEventArgs, RowSelectingEventArgs, RowDeselectingEventArgs } from '@syncfusion/ej2-grids';
|
23
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
24
|
-
/**
|
25
|
-
* DetailsView module
|
26
|
-
*/
|
27
|
-
export class DetailsView {
|
28
|
-
|
29
|
-
/* Internal variables */
|
30
|
-
public element: HTMLElement;
|
31
|
-
private parent: FileManager;
|
32
|
-
private keyboardModule: KeyboardEvents;
|
33
|
-
private keyboardDownModule: KeyboardEvents;
|
34
|
-
private keyConfigs: { [key: string]: string };
|
35
|
-
private sortItem: boolean;
|
36
|
-
private isInteracted: boolean = true;
|
37
|
-
private interaction: boolean = true;
|
38
|
-
private isPasteOperation: boolean = false;
|
39
|
-
private isColumnRefresh: boolean = false;
|
40
|
-
private clickObj: Touch;
|
41
|
-
private sortSelectedNodes: string[];
|
42
|
-
private emptyArgs: ReadArgs | SearchArgs;
|
43
|
-
private dragObj: Draggable = null;
|
44
|
-
private startIndex: number = null;
|
45
|
-
private firstItemIndex: number = null;
|
46
|
-
private isSelectionUpdate: boolean = false;
|
47
|
-
private currentSelectedItem: string[] = [];
|
48
|
-
private count: number = 0;
|
49
|
-
private isRendered: boolean = true;
|
50
|
-
private isLoaded: boolean = false;
|
51
|
-
private isNameWidth: boolean = false;
|
52
|
-
private isMultiSelect: boolean = false;
|
53
|
-
|
54
|
-
/* public variable */
|
55
|
-
public gridObj: Grid;
|
56
|
-
public pasteOperation: boolean = false;
|
57
|
-
public uploadOperation: boolean = false;
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Constructor for the GridView module
|
61
|
-
*
|
62
|
-
* @param {FileManager} parent - specifies the parent.
|
63
|
-
* @hidden
|
64
|
-
*/
|
65
|
-
constructor(parent?: FileManager) {
|
66
|
-
Grid.Inject(Resize, ContextMenu, Sort, VirtualScroll);
|
67
|
-
this.parent = parent;
|
68
|
-
this.element = <HTMLElement>select('#' + this.parent.element.id + CLS.GRID_ID, this.parent.element);
|
69
|
-
this.addEventListener();
|
70
|
-
this.keyConfigs = {
|
71
|
-
altEnter: 'alt+enter',
|
72
|
-
esc: 'escape',
|
73
|
-
tab: 'tab',
|
74
|
-
moveDown: 'downarrow',
|
75
|
-
ctrlEnd: 'ctrl+end',
|
76
|
-
ctrlHome: 'ctrl+home',
|
77
|
-
ctrlDown: 'ctrl+downarrow',
|
78
|
-
ctrlLeft: 'ctrl+leftarrow',
|
79
|
-
ctrlRight: 'ctrl+rightarrow',
|
80
|
-
shiftEnd: 'shift+end',
|
81
|
-
shiftHome: 'shift+home',
|
82
|
-
shiftDown: 'shift+downarrow',
|
83
|
-
shiftUp: 'shift+uparrow',
|
84
|
-
ctrlUp: 'ctrl+uparrow',
|
85
|
-
csEnd: 'ctrl+shift+end',
|
86
|
-
csHome: 'ctrl+shift+home',
|
87
|
-
csDown: 'ctrl+shift+downarrow',
|
88
|
-
csUp: 'ctrl+shift+uparrow',
|
89
|
-
space: 'space',
|
90
|
-
ctrlSpace: 'ctrl+space',
|
91
|
-
shiftSpace: 'shift+space',
|
92
|
-
csSpace: 'ctrl+shift+space',
|
93
|
-
end: 'end',
|
94
|
-
home: 'home',
|
95
|
-
moveUp: 'uparrow',
|
96
|
-
del: 'delete',
|
97
|
-
ctrlX: this.parent.isMac ? 'cmd+x' : 'ctrl+x',
|
98
|
-
ctrlC: this.parent.isMac ? 'cmd+c' : 'ctrl+c',
|
99
|
-
ctrlV: this.parent.isMac ? 'cmd+v' : 'ctrl+v',
|
100
|
-
ctrlShiftN: 'ctrl+shift+n',
|
101
|
-
shiftdel: 'shift+delete',
|
102
|
-
ctrlD: 'ctrl+d',
|
103
|
-
f2: 'f2',
|
104
|
-
ctrlA: 'ctrl+a',
|
105
|
-
enter: 'enter',
|
106
|
-
back: 'backspace'
|
107
|
-
};
|
108
|
-
}
|
109
|
-
|
110
|
-
/* istanbul ignore next */
|
111
|
-
private render(args: ReadArgs | SearchArgs): void {
|
112
|
-
if (this.parent.enablePersistence) {
|
113
|
-
const gridPersistenceValue: string = window.localStorage.getItem('grid' + this.parent.element.id + '_grid');
|
114
|
-
if (!isNOU(gridPersistenceValue)) {
|
115
|
-
const model: GridModel = JSON.parse(gridPersistenceValue);
|
116
|
-
if (!isNOU(model) && Object.keys(model).length > 0 && 'sortSettings' in model) {
|
117
|
-
delete model.sortSettings;
|
118
|
-
window.localStorage.setItem('grid' + this.parent.element.id + '_grid', JSON.stringify(model));
|
119
|
-
}
|
120
|
-
}
|
121
|
-
}
|
122
|
-
showSpinner(this.parent.element);
|
123
|
-
if (this.parent.view === 'Details') {
|
124
|
-
removeClass([this.parent.element], CLS.MULTI_SELECT);
|
125
|
-
const items: Object[] = getSortedData(this.parent, args.files);
|
126
|
-
this.checkNameWidth();
|
127
|
-
const columns: ColumnModel[] = this.getColumns();
|
128
|
-
let sortSettings: SortDescriptorModel[];
|
129
|
-
const isValidSortField: boolean = !isNullOrUndefined(columns) &&
|
130
|
-
columns.findIndex((col: ColumnModel) => col.field === this.parent.sortBy) !== -1;
|
131
|
-
if (this.parent.isMobile || !isValidSortField) {
|
132
|
-
sortSettings = [];
|
133
|
-
} else {
|
134
|
-
if (this.parent.sortOrder !== 'None') {
|
135
|
-
sortSettings = [{ direction: this.parent.sortOrder, field: this.parent.sortBy }];
|
136
|
-
}
|
137
|
-
}
|
138
|
-
this.gridObj = new Grid({
|
139
|
-
dataSource: items,
|
140
|
-
allowSorting: true,
|
141
|
-
rowSelecting: this.onSelection.bind(this, 'select'),
|
142
|
-
rowDeselecting: this.onSelection.bind(this, 'unselect'),
|
143
|
-
rowSelected: this.onSelected.bind(this),
|
144
|
-
rowDeselected: this.onDeSelection.bind(this),
|
145
|
-
allowResizing: this.parent.detailsViewSettings.columnResizing,
|
146
|
-
selectionSettings: {
|
147
|
-
type: this.parent.allowMultiSelection ? 'Multiple' : 'Single',
|
148
|
-
checkboxMode: 'ResetOnRowClick'
|
149
|
-
},
|
150
|
-
enableRtl: this.parent.enableRtl,
|
151
|
-
pageSettings: { pageSize: 20 },
|
152
|
-
enableVirtualization: this.parent.enableVirtualization,
|
153
|
-
enablePersistence: this.parent.enablePersistence,
|
154
|
-
enableVirtualMaskRow: true,
|
155
|
-
sortSettings: { allowUnsort: false, columns: sortSettings },
|
156
|
-
columns: columns,
|
157
|
-
recordDoubleClick: this.DblClickEvents.bind(this),
|
158
|
-
beforeDataBound: this.onBeforeDataBound.bind(this),
|
159
|
-
dataBound: this.onDataBound.bind(this),
|
160
|
-
rowDataBound: this.onRowDataBound.bind(this),
|
161
|
-
actionBegin: this.onActionBegin.bind(this),
|
162
|
-
headerCellInfo: this.onHeaderCellInfo.bind(this),
|
163
|
-
width: '100%',
|
164
|
-
height: (this.parent.enableVirtualization) ? this.getGridHeight() : 'auto',
|
165
|
-
beforeCopy: (args: BeforeCopyEventArgs) => { args.cancel = true; },
|
166
|
-
load: function (): void {
|
167
|
-
this.focusModule.destroy();
|
168
|
-
},
|
169
|
-
locale: this.parent.locale
|
170
|
-
});
|
171
|
-
if ((this as any).parent.isReact) {
|
172
|
-
(<{ isReact?: boolean }>this.gridObj).isReact = true;
|
173
|
-
(<{ portals?: object[] }>this.gridObj).portals = [];
|
174
|
-
this.gridObj.on('reactTemplateRender', this.reactTemplateRender, this);
|
175
|
-
}
|
176
|
-
this.gridObj.isStringTemplate = true;
|
177
|
-
this.gridObj.appendTo('#' + this.parent.element.id + CLS.GRID_ID);
|
178
|
-
if (this.parent.selectedItems.length !== 0 && this.parent.enableVirtualization && this.parent.enablePersistence) {
|
179
|
-
this.isLoaded = true;
|
180
|
-
}
|
181
|
-
this.wireEvents();
|
182
|
-
this.adjustHeight();
|
183
|
-
this.emptyArgs = args;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
private reactTemplateRender(args: Object[]): void {
|
188
|
-
(this.parent as any)['portals'] = args;
|
189
|
-
if ((this.parent as any).portals && this.parent.toolbarModule && this.parent.toolbarModule.toolbarObj &&
|
190
|
-
(this.parent.toolbarModule.toolbarObj as any).portals) {
|
191
|
-
(this.parent as any)['portals'] = (this.parent as any)['portals'].concat((this.parent.toolbarModule.toolbarObj as any).portals);
|
192
|
-
}
|
193
|
-
this.parent.notify('renderReactTemplate', (this.parent as any)['portals']);
|
194
|
-
(this.parent as any)['renderReactTemplates']();
|
195
|
-
}
|
196
|
-
|
197
|
-
/**
|
198
|
-
* Gets the grid height.
|
199
|
-
*
|
200
|
-
* @returns {number} - The grid height.
|
201
|
-
* @private
|
202
|
-
*/
|
203
|
-
private getGridHeight(): number {
|
204
|
-
// Get the content pane and breadcrumb bar elements
|
205
|
-
const pane: HTMLElement = <HTMLElement>select('#' + this.parent.element.id + CLS.CONTENT_ID, this.parent.element);
|
206
|
-
const bar: HTMLElement = <HTMLElement>select('#' + this.parent.element.id + CLS.BREADCRUMBBAR_ID, this.parent.element);
|
207
|
-
// The maximum height of the header is 36
|
208
|
-
const headerMaxHeight: number = 36;
|
209
|
-
// Calculate and return the grid height
|
210
|
-
return (pane.offsetHeight - bar.offsetHeight - headerMaxHeight);
|
211
|
-
}
|
212
|
-
|
213
|
-
private checkNameWidth(): void {
|
214
|
-
const initialColumn: ColumnModel[] = this.parent.detailsViewSettings.columns;
|
215
|
-
this.isNameWidth = false;
|
216
|
-
for (let i: number = 0; i < initialColumn.length; i++) {
|
217
|
-
if (initialColumn[i as number].field === 'name') {
|
218
|
-
this.isNameWidth = !isNOU(initialColumn[i as number].width);
|
219
|
-
return;
|
220
|
-
}
|
221
|
-
}
|
222
|
-
}
|
223
|
-
|
224
|
-
private adjustWidth(columns: ColumnModel[], fieldName: string): void {
|
225
|
-
if (this.isNameWidth && (fieldName === 'name')) { return; }
|
226
|
-
for (let i: number = 0; i < columns.length; i++) {
|
227
|
-
if (columns[i as number].field === fieldName) {
|
228
|
-
let nameWidth: string;
|
229
|
-
if (this.parent.breadcrumbbarModule.searchObj.element.value === '' && !this.parent.isFiltered) {
|
230
|
-
nameWidth = (this.element.clientWidth <= 500) ? '120px' : 'auto';
|
231
|
-
} else {
|
232
|
-
nameWidth = (this.element.clientWidth <= 680) ? ((fieldName === 'name') ? '120px' : '180px') : 'auto';
|
233
|
-
}
|
234
|
-
columns[i as number].width = nameWidth;
|
235
|
-
}
|
236
|
-
}
|
237
|
-
}
|
238
|
-
|
239
|
-
private getColumns(): ColumnModel[] {
|
240
|
-
let columns: ColumnModel[];
|
241
|
-
const enableHtmlSanitizer: boolean = this.parent.enableHtmlSanitizer;
|
242
|
-
if (this.parent.isMobile) {
|
243
|
-
columns = [
|
244
|
-
{
|
245
|
-
field: 'name', headerText: getLocaleText(this.parent, 'Name'), width: 'auto', minWidth: 120, headerTextAlign: 'Left',
|
246
|
-
template: initializeCSPTemplate(function(data: any): string | Function {
|
247
|
-
const name: string = enableHtmlSanitizer ? SanitizeHtmlHelper.sanitize(data.name) : data.name;
|
248
|
-
return `<div class="e-fe-text">${name}</div><div class="e-fe-date">${data._fm_modified}</div><span class="e-fe-size">${data.size}</span>`;
|
249
|
-
}) as string | Function
|
250
|
-
}
|
251
|
-
];
|
252
|
-
} else {
|
253
|
-
columns = extend([], this.parent.detailsViewSettings.columns, null, true) as ColumnModel[];
|
254
|
-
this.adjustWidth(columns, 'name');
|
255
|
-
for (let i: number = 0, len: number = columns.length; i < len; i++) {
|
256
|
-
columns[i as number].headerText = getLocaleText(this.parent, columns[i as number].headerText);
|
257
|
-
if (columns[i as number].field === 'name' && !isNOU(columns[i as number].template) && !(typeof columns[i as number].template === 'function')) {
|
258
|
-
const template: string | Function = columns[i as number].template;
|
259
|
-
columns[i as number].template = initializeCSPTemplate(function (data: any): string | Function {
|
260
|
-
const name: string = enableHtmlSanitizer ? SanitizeHtmlHelper.sanitize(data.name) : data.name;
|
261
|
-
return (template as any).replace(/\${name}/g, name);
|
262
|
-
});
|
263
|
-
}
|
264
|
-
}
|
265
|
-
}
|
266
|
-
const iWidth: string = ((this.parent.isMobile || this.parent.isBigger) ? '54' : '46');
|
267
|
-
const icon: ColumnModel = {
|
268
|
-
field: 'type', width: iWidth, minWidth: iWidth,
|
269
|
-
template: initializeCSPTemplate(function(data: any): string | Function {
|
270
|
-
return `<span class="e-fe-icon ${data._fm_iconClass}"></span>`;
|
271
|
-
}) as string | Function, allowResizing: false, allowSorting: true, customAttributes: { class: 'e-fe-grid-icon' },
|
272
|
-
headerTemplate: initializeCSPTemplate(function(): string | Function {
|
273
|
-
return '<span class=\'e-fe-icon e-fe-folder\'></span>';
|
274
|
-
}) as string | Function
|
275
|
-
};
|
276
|
-
columns.unshift(icon);
|
277
|
-
if (this.parent.showItemCheckBoxes) {
|
278
|
-
const cWidth: string = (this.parent.isBigger ? '36' : '26');
|
279
|
-
const cBox: ColumnModel = {
|
280
|
-
type: 'checkbox', width: cWidth, minWidth: cWidth, customAttributes: { class: 'e-fe-checkbox' },
|
281
|
-
allowResizing: false, allowSorting: false
|
282
|
-
};
|
283
|
-
if (this.parent.isMobile) {
|
284
|
-
columns.push(cBox);
|
285
|
-
} else {
|
286
|
-
columns.unshift(cBox);
|
287
|
-
}
|
288
|
-
}
|
289
|
-
for (let i: number = 0, len: number = columns.length; i < len; i++) {
|
290
|
-
columns[i as number].disableHtmlEncode = !this.parent.enableHtmlSanitizer;
|
291
|
-
}
|
292
|
-
if (this.parent.enableRangeSelection) {
|
293
|
-
const HiddenName: ColumnModel = { field: 'name', visible: false, customAttributes: { class: 'e-drag-text' } };
|
294
|
-
columns.push(HiddenName);
|
295
|
-
}
|
296
|
-
return columns;
|
297
|
-
}
|
298
|
-
|
299
|
-
private adjustHeight(): void {
|
300
|
-
if (!this.gridObj) { return; }
|
301
|
-
const pane: HTMLElement = <HTMLElement>select('#' + this.parent.element.id + CLS.CONTENT_ID, this.parent.element);
|
302
|
-
const bar: HTMLElement = <HTMLElement>select('#' + this.parent.element.id + CLS.BREADCRUMBBAR_ID, this.parent.element);
|
303
|
-
const gridHeader: HTMLElement = <HTMLElement>select('.' + CLS.GRID_HEADER, this.parent.element);
|
304
|
-
const height: number = (pane.offsetHeight - bar.offsetHeight - gridHeader.offsetHeight);
|
305
|
-
this.gridObj.height = height;
|
306
|
-
this.gridObj.dataBind();
|
307
|
-
}
|
308
|
-
|
309
|
-
private renderCheckBox(): void {
|
310
|
-
this.gridObj.columns = this.getColumns();
|
311
|
-
this.isColumnRefresh = true;
|
312
|
-
this.gridObj.refreshColumns();
|
313
|
-
}
|
314
|
-
|
315
|
-
private onRowDataBound(args: RowDataBoundEventArgs): void {
|
316
|
-
let td: Element = select('.e-fe-grid-name', args.row);
|
317
|
-
if (!td) {
|
318
|
-
const columns: ColumnModel[] = this.parent.detailsViewSettings.columns;
|
319
|
-
for (let i: number = 0; i < columns.length; i++) {
|
320
|
-
if (columns[i as number].field === 'name') {
|
321
|
-
td = args.row.children[this.parent.allowMultiSelection ? (i + 2) : (i + 1)];
|
322
|
-
break;
|
323
|
-
}
|
324
|
-
}
|
325
|
-
}
|
326
|
-
if (td) {
|
327
|
-
td.setAttribute('title', getValue('name', args.data));
|
328
|
-
}
|
329
|
-
if (this.parent.isLayoutChange && this.parent.isCut && this.parent.fileAction === 'move' &&
|
330
|
-
this.parent.selectedNodes && this.parent.selectedNodes.length !== 0) {
|
331
|
-
if (this.parent.selectedNodes.indexOf(getValue('name', args.data)) !== -1) {
|
332
|
-
addBlur(args.row);
|
333
|
-
}
|
334
|
-
}
|
335
|
-
if (!this.parent.showFileExtension && getValue('isFile', args.data)) {
|
336
|
-
const text: string = getValue('name', args.data);
|
337
|
-
const textEle: Element = args.row.querySelector('[title= "' + text + '"]');
|
338
|
-
if (textEle) {
|
339
|
-
const name: string = getValue('name', args.data);
|
340
|
-
const type: string = getValue('type', args.data);
|
341
|
-
if (name.indexOf(type) !== -1) {
|
342
|
-
textEle.innerHTML = name.substr(0, name.length - type.length);
|
343
|
-
}
|
344
|
-
}
|
345
|
-
}
|
346
|
-
if (getValue('size', args.data) !== undefined && args.row.querySelector('.e-fe-size')) {
|
347
|
-
const sizeEle: Element = args.row.querySelector('.e-fe-size');
|
348
|
-
let modifiedSize: string;
|
349
|
-
if (!getValue('isFile', args.data)) {
|
350
|
-
modifiedSize = '';
|
351
|
-
} else {
|
352
|
-
const sizeValue: number = getValue('size', args.data);
|
353
|
-
const intl: Internationalization = new Internationalization(this.parent.locale);
|
354
|
-
let sizeFormat: string;
|
355
|
-
const columns: ColumnModel[] = this.parent.detailsViewSettings.columns;
|
356
|
-
for (let i: number = 0; i < columns.length; i++) {
|
357
|
-
if (columns[i as number].field === 'size') {
|
358
|
-
sizeFormat = !isNullOrUndefined(columns[i as number].format) ? columns[i as number].format.toString() : 'n';
|
359
|
-
break;
|
360
|
-
}
|
361
|
-
}
|
362
|
-
const value: string = intl.formatNumber((sizeValue / 1024), { format: sizeFormat });
|
363
|
-
modifiedSize = value + ' ' + getLocaleText(this.parent, 'KB');
|
364
|
-
}
|
365
|
-
sizeEle.innerHTML = modifiedSize;
|
366
|
-
}
|
367
|
-
if (this.parent.isMobile) {
|
368
|
-
if (getValue('_fm_modified', args.data) !== undefined && args.row.querySelector('.e-fe-date')) {
|
369
|
-
const dateEle: Element = args.row.querySelector('.e-fe-date');
|
370
|
-
const intl: Internationalization = new Internationalization(this.parent.locale);
|
371
|
-
const columns: ColumnModel[] = this.parent.detailsViewSettings.columns;
|
372
|
-
let format: Object;
|
373
|
-
for (let i: number = 0; i < columns.length; i++) {
|
374
|
-
if (columns[i as number].field === 'dateModified') {
|
375
|
-
format = columns[i as number].format;
|
376
|
-
break;
|
377
|
-
}
|
378
|
-
}
|
379
|
-
const formattedString: string = intl.formatDate(new Date(getValue('_fm_modified', args.data)), format);
|
380
|
-
dateEle.innerHTML = formattedString;
|
381
|
-
}
|
382
|
-
}
|
383
|
-
const checkWrap: Element = args.row.querySelector('.' + CLS.CB_WRAP);
|
384
|
-
if (checkWrap) {
|
385
|
-
checkWrap.classList.add('e-small');
|
386
|
-
}
|
387
|
-
if (!hasEditAccess(args.data)) {
|
388
|
-
args.row.className += ' ' + getAccessClass(args.data);
|
389
|
-
}
|
390
|
-
const eventArgs: FileLoadEventArgs = {
|
391
|
-
element: args.row as HTMLElement,
|
392
|
-
fileDetails: args.data,
|
393
|
-
module: 'DetailsView'
|
394
|
-
};
|
395
|
-
this.parent.trigger('fileLoad', eventArgs);
|
396
|
-
}
|
397
|
-
|
398
|
-
private onActionBegin(args: SortEventArgs): void {
|
399
|
-
if (args.requestType === 'sorting') {
|
400
|
-
this.parent.setProperties({ sortOrder: args.direction }, true);
|
401
|
-
this.parent.setProperties({ sortBy: args.columnName }, true);
|
402
|
-
if (this.parent.selectedItems.length !== 0) {
|
403
|
-
this.sortItem = true;
|
404
|
-
const rows: number[] = this.gridObj.getSelectedRowIndexes();
|
405
|
-
let len: number = rows.length;
|
406
|
-
this.sortSelectedNodes = [];
|
407
|
-
while (len > 0) {
|
408
|
-
const data: Object = this.gridObj.getRowsObject()[rows[len - 1]].data;
|
409
|
-
this.sortSelectedNodes.push(getValue(this.parent.hasId ? 'id' : 'name', data));
|
410
|
-
len--;
|
411
|
-
}
|
412
|
-
}
|
413
|
-
this.parent.notify(events.sortByChange, {});
|
414
|
-
}
|
415
|
-
}
|
416
|
-
|
417
|
-
private onHeaderCellInfo(args: HeaderCellInfoEventArgs): void {
|
418
|
-
const checkWrap: Element = args.node.querySelector('.' + CLS.CB_WRAP);
|
419
|
-
if (checkWrap) {
|
420
|
-
checkWrap.classList.add('e-small');
|
421
|
-
}
|
422
|
-
}
|
423
|
-
|
424
|
-
private onBeforeDataBound(args: BeforeDataBoundArgs): void {
|
425
|
-
showSpinner(this.parent.element);
|
426
|
-
const nameColumn: ColumnModel =
|
427
|
-
this.parent.detailsViewSettings.columns.find((column: ColumnModel) => column.field === this.parent.sortBy);
|
428
|
-
if (nameColumn && !('sortComparer' in nameColumn)) {
|
429
|
-
const items: Object[] = getSortedData(
|
430
|
-
this.parent, (this.parent.enableVirtualization)
|
431
|
-
? args.result
|
432
|
-
: this.gridObj.dataSource as Object[]
|
433
|
-
);
|
434
|
-
args.result = items;
|
435
|
-
}
|
436
|
-
}
|
437
|
-
/* istanbul ignore next */
|
438
|
-
private onDataBound(): void {
|
439
|
-
this.createDragObj();
|
440
|
-
if ((this.parent.selectedItems.length !== 0 && !this.parent.enableVirtualization) || this.isLoaded) {
|
441
|
-
this.selectRecords(this.parent.selectedItems);
|
442
|
-
}
|
443
|
-
if (this.isPasteOperation === true && (!isNullOrUndefined(this.gridObj.getDataRows()) && this.gridObj.getDataRows().length > 0)) {
|
444
|
-
if (!this.isColumnRefresh) {
|
445
|
-
this.selectRecords(this.parent.pasteNodes);
|
446
|
-
this.isPasteOperation = false;
|
447
|
-
} else {
|
448
|
-
this.isColumnRefresh = false;
|
449
|
-
}
|
450
|
-
}
|
451
|
-
if (this.parent.createdItem) {
|
452
|
-
this.selectRecords([getValue(this.parent.hasId ? 'id' : 'name', this.parent.createdItem)]);
|
453
|
-
this.parent.createdItem = null;
|
454
|
-
}
|
455
|
-
if (this.parent.layoutSelectedItems.length) {
|
456
|
-
this.selectRecords(this.parent.layoutSelectedItems);
|
457
|
-
}
|
458
|
-
if (this.parent.renamedItem && this.parent.selectedItems.length === 0) {
|
459
|
-
this.gridObj.clearSelection();
|
460
|
-
this.addSelection(this.parent.renamedItem);
|
461
|
-
this.parent.renamedItem = null;
|
462
|
-
}
|
463
|
-
if (this.sortItem === true) {
|
464
|
-
this.selectRecords(this.sortSelectedNodes);
|
465
|
-
this.sortItem = false;
|
466
|
-
}
|
467
|
-
if (this.isSelectionUpdate) {
|
468
|
-
if (!this.isColumnRefresh) {
|
469
|
-
this.selectRecords(this.currentSelectedItem);
|
470
|
-
this.isSelectionUpdate = false;
|
471
|
-
} else {
|
472
|
-
this.isColumnRefresh = false;
|
473
|
-
}
|
474
|
-
}
|
475
|
-
if (this.uploadOperation === true) {
|
476
|
-
this.count++;
|
477
|
-
this.selectRecords(this.parent.uploadItem);
|
478
|
-
if (this.count === this.parent.uploadItem.length) {
|
479
|
-
this.uploadOperation = false;
|
480
|
-
this.parent.uploadItem = [];
|
481
|
-
}
|
482
|
-
}
|
483
|
-
if (this.gridObj.currentViewData.length * this.gridObj.getRowHeight() < this.gridObj.height) {
|
484
|
-
const hdTable: HTMLElement = <HTMLElement>this.gridObj.getHeaderContent();
|
485
|
-
hdTable.style.paddingRight = '';
|
486
|
-
hdTable.style.paddingLeft = '';
|
487
|
-
const hdContent: HTMLElement = <HTMLElement>select('.e-headercontent', hdTable);
|
488
|
-
hdContent.style.borderRightWidth = '0';
|
489
|
-
const cnTable: HTMLElement = <HTMLElement>this.gridObj.getContent().querySelector('.e-content');
|
490
|
-
cnTable.style.overflowY = '';
|
491
|
-
cnTable.classList.add('e-scrollShow');
|
492
|
-
} else {
|
493
|
-
const hdTable: HTMLElement = <HTMLElement>this.gridObj.getHeaderContent();
|
494
|
-
if (!this.parent.enableRtl) {
|
495
|
-
hdTable.style.paddingRight = '16px';
|
496
|
-
} else {
|
497
|
-
hdTable.style.paddingLeft = '16px';
|
498
|
-
}
|
499
|
-
const cnTable: Element = this.gridObj.getContent().querySelector('.e-content');
|
500
|
-
cnTable.classList.remove('e-scrollShow');
|
501
|
-
}
|
502
|
-
this.isRendered = true;
|
503
|
-
this.parent.isLayoutChange = false;
|
504
|
-
hideSpinner(this.parent.element);
|
505
|
-
this.checkEmptyDiv(this.emptyArgs);
|
506
|
-
this.isInteracted = this.isLoaded ? true : this.isInteracted;
|
507
|
-
this.isLoaded = false;
|
508
|
-
}
|
509
|
-
|
510
|
-
private selectRecords(nodes: string[]): void {
|
511
|
-
const gridRecords: Object[] = this.gridObj.getCurrentViewRecords();
|
512
|
-
const sRecords: number[] = [];
|
513
|
-
for (let i: number = 0, len: number = gridRecords.length; i < len; i++) {
|
514
|
-
const node: string = this.parent.hasId ? getValue('id', gridRecords[i as number]) : getName(this.parent, gridRecords[i as number]);
|
515
|
-
if (nodes.indexOf(node) !== -1) {
|
516
|
-
sRecords.push(i);
|
517
|
-
}
|
518
|
-
else if (!this.parent.showFileExtension && !this.parent.hasId && node.includes('.')){
|
519
|
-
const Str2: string = node.split('.').slice(0, -1).join('.');
|
520
|
-
if (nodes.indexOf(Str2) !== -1) {
|
521
|
-
sRecords.push(i);
|
522
|
-
}
|
523
|
-
}
|
524
|
-
}
|
525
|
-
if (sRecords.length !== 0) {
|
526
|
-
this.gridObj.selectRows(sRecords);
|
527
|
-
this.addFocus(this.gridObj.selectedRowIndex);
|
528
|
-
}
|
529
|
-
}
|
530
|
-
|
531
|
-
private addSelection(data: Object): void {
|
532
|
-
const items: Object[] = this.gridObj.getCurrentViewRecords();
|
533
|
-
let rData: Object[] = [];
|
534
|
-
if (this.parent.hasId) {
|
535
|
-
rData = new DataManager(items).
|
536
|
-
executeLocal(new Query().where('id', 'equal', this.parent.renamedId, false));
|
537
|
-
} else {
|
538
|
-
const nData: Object[] = new DataManager(items).
|
539
|
-
executeLocal(new Query().where('name', 'equal', getValue('name', data), false));
|
540
|
-
if (nData.length > 0) {
|
541
|
-
rData = new DataManager(nData).
|
542
|
-
executeLocal(new Query().where('filterPath', 'equal', this.parent.filterPath, false));
|
543
|
-
}
|
544
|
-
}
|
545
|
-
if (rData.length > 0) {
|
546
|
-
const index: number = items.indexOf(rData[0]);
|
547
|
-
this.gridObj.selectRows([index]);
|
548
|
-
}
|
549
|
-
}
|
550
|
-
|
551
|
-
private onSortColumn(): void {
|
552
|
-
if (this.parent.sortOrder !== 'None') {
|
553
|
-
this.gridObj.sortModule.sortColumn(this.parent.sortBy, this.parent.sortOrder);
|
554
|
-
} else {
|
555
|
-
this.gridObj.dataSource = getSortedData(this.parent, this.gridObj.dataSource as Object[]);
|
556
|
-
}
|
557
|
-
if (this.element.querySelector('.e-content').scrollTop !== 0) {
|
558
|
-
this.gridObj.freezeRefresh();
|
559
|
-
}
|
560
|
-
}
|
561
|
-
|
562
|
-
private onPropertyChanged(e: NotifyArgs): void {
|
563
|
-
if (e.module !== this.getModuleName() && e.module !== 'common') {
|
564
|
-
/* istanbul ignore next */
|
565
|
-
return;
|
566
|
-
}
|
567
|
-
for (const prop of Object.keys(e.newProp)) {
|
568
|
-
switch (prop) {
|
569
|
-
case 'allowDragAndDrop':
|
570
|
-
this.createDragObj();
|
571
|
-
break;
|
572
|
-
case 'height':
|
573
|
-
this.adjustHeight();
|
574
|
-
break;
|
575
|
-
case 'detailsViewSettings':
|
576
|
-
if (!isNullOrUndefined(this.gridObj)) {
|
577
|
-
this.checkNameWidth();
|
578
|
-
const columns: ColumnModel[] = this.getColumns();
|
579
|
-
this.gridObj.columns = columns;
|
580
|
-
this.gridObj.allowResizing = this.parent.detailsViewSettings.columnResizing;
|
581
|
-
this.gridObj.dataBind();
|
582
|
-
this.gridObj.refreshColumns();
|
583
|
-
}
|
584
|
-
break;
|
585
|
-
case 'selectedItems':
|
586
|
-
this.interaction = false;
|
587
|
-
if (this.parent.selectedItems.length !== 0) {
|
588
|
-
if (!this.parent.allowMultiSelection) {
|
589
|
-
const slItems: string[] = this.parent.selectedItems.slice(this.parent.selectedItems.length - 1);
|
590
|
-
this.parent.setProperties({ selectedItems: slItems }, true);
|
591
|
-
}
|
592
|
-
this.selectRecords(this.parent.selectedItems);
|
593
|
-
this.parent.setProperties({ selectedItems: this.parent.selectedItems }, true);
|
594
|
-
} else if (!isNOU(this.gridObj)) {
|
595
|
-
this.gridObj.clearSelection();
|
596
|
-
this.interaction = true;
|
597
|
-
}
|
598
|
-
break;
|
599
|
-
case 'showFileExtension':
|
600
|
-
read(this.parent, events.pathChanged, this.parent.path);
|
601
|
-
break;
|
602
|
-
case 'showHiddenItems':
|
603
|
-
read(this.parent, events.pathChanged, this.parent.path);
|
604
|
-
break;
|
605
|
-
case 'showItemCheckBoxes':
|
606
|
-
case 'allowMultiSelection':
|
607
|
-
if (!isNullOrUndefined(this.gridObj)) {
|
608
|
-
this.currentSelectedItem = this.parent.selectedItems;
|
609
|
-
this.gridObj.selectionSettings.type = e.newProp.allowMultiSelection ? 'Multiple' : 'Single';
|
610
|
-
this.isSelectionUpdate = true;
|
611
|
-
this.renderCheckBox();
|
612
|
-
}
|
613
|
-
break;
|
614
|
-
case 'view':
|
615
|
-
updateLayout(this.parent, 'Details');
|
616
|
-
break;
|
617
|
-
case 'width':
|
618
|
-
this.onDetailsResize();
|
619
|
-
}
|
620
|
-
}
|
621
|
-
}
|
622
|
-
private onPathChanged(args: ReadArgs): void {
|
623
|
-
this.parent.isCut = false;
|
624
|
-
const pathField: ColumnModel = this.parent.detailsViewSettings.columns.find((column: ColumnModel) => column.field === 'filterPath');
|
625
|
-
if ((this.parent.breadcrumbbarModule.searchObj.element.value.trim() === '' && this.gridObj) ||
|
626
|
-
(!isNullOrUndefined(pathField) && !isNullOrUndefined(pathField.hideAtMedia) && pathField.hideAtMedia !== '')) {
|
627
|
-
this.parent.searchedItems = [];
|
628
|
-
if (!this.parent.isFiltered) {
|
629
|
-
this.removePathColumn(false);
|
630
|
-
} else {
|
631
|
-
this.updatePathColumn();
|
632
|
-
}
|
633
|
-
}
|
634
|
-
removeBlur(this.parent);
|
635
|
-
if (this.parent.view === 'Details') {
|
636
|
-
/* istanbul ignore next */
|
637
|
-
this.isInteracted = false;
|
638
|
-
showSpinner(this.parent.element);
|
639
|
-
this.parent.setProperties({ selectedItems: [] }, true);
|
640
|
-
this.gridObj.dataSource = getSortedData(this.parent, args.files);
|
641
|
-
this.gridObj.freezeRefresh();
|
642
|
-
if ((this as any).parent.isReact) {
|
643
|
-
this.gridObj.on('reactTemplateRender', this.reactTemplateRender, this);
|
644
|
-
}
|
645
|
-
this.wireClickEvent(true);
|
646
|
-
}
|
647
|
-
this.emptyArgs = args;
|
648
|
-
}
|
649
|
-
|
650
|
-
private updatePathColumn(): void {
|
651
|
-
const len: number = this.gridObj.columns.length;
|
652
|
-
const columnData: ColumnModel[] = JSON.parse(JSON.stringify(this.gridObj.columns));
|
653
|
-
if (columnData[len - 1].field && columnData[len - 1].field !== 'filterPath' && !this.parent.isMobile) {
|
654
|
-
const pathColumn: ColumnModel = {
|
655
|
-
field: 'filterPath', headerText: getLocaleText(this.parent, 'Path'), minWidth: 180, width: 'auto'
|
656
|
-
};
|
657
|
-
(<ColumnModel[]>this.gridObj.columns).push(pathColumn);
|
658
|
-
this.adjustWidth((<Column[]>this.gridObj.columns), 'filterPath');
|
659
|
-
this.adjustWidth((<Column[]>this.gridObj.columns), 'name');
|
660
|
-
this.isColumnRefresh = true;
|
661
|
-
this.gridObj.refreshColumns();
|
662
|
-
}
|
663
|
-
}
|
664
|
-
|
665
|
-
private checkEmptyDiv(args: ReadArgs | SearchArgs): void {
|
666
|
-
const items: Object[] = getSortedData(this.parent, args.files);
|
667
|
-
if (items.length === 0 && !isNOU(this.element.querySelector('.' + CLS.GRID_VIEW))) {
|
668
|
-
createEmptyElement(this.parent, this.element, args);
|
669
|
-
} else if (items.length !== 0 && this.element.querySelector('.' + CLS.EMPTY)) {
|
670
|
-
if (this.element.querySelector('.' + CLS.GRID_VIEW).querySelector('.' + CLS.EMPTY)) {
|
671
|
-
const emptyDiv: Element = this.element.querySelector('.' + CLS.GRID_VIEW).querySelector('.' + CLS.EMPTY);
|
672
|
-
this.element.querySelector('.' + CLS.GRID_VIEW).removeChild(emptyDiv);
|
673
|
-
} else {
|
674
|
-
this.element.removeChild(this.element.querySelector('.' + CLS.EMPTY));
|
675
|
-
}
|
676
|
-
}
|
677
|
-
}
|
678
|
-
|
679
|
-
private onOpenInit(): void {
|
680
|
-
if (this.parent.activeModule === 'detailsview') {
|
681
|
-
const data: Object = this.gridObj.getSelectedRecords()[0];
|
682
|
-
this.openContent(data);
|
683
|
-
}
|
684
|
-
}
|
685
|
-
|
686
|
-
public DblClickEvents(args: RecordDoubleClickEventArgs): void {
|
687
|
-
this.gridObj.selectRows([args.rowIndex]);
|
688
|
-
let data: Object;
|
689
|
-
if (args.rowData) {
|
690
|
-
data = JSON.parse(JSON.stringify(args.rowData));
|
691
|
-
this.openContent(data);
|
692
|
-
}
|
693
|
-
}
|
694
|
-
|
695
|
-
public openContent(data: Object): void {
|
696
|
-
if (!hasReadAccess(data)) {
|
697
|
-
createDeniedDialog(this.parent, data, events.permissionRead);
|
698
|
-
return;
|
699
|
-
}
|
700
|
-
const eventArgs: FileOpenEventArgs = { cancel: false, fileDetails: data, module: 'DetailsView' };
|
701
|
-
this.parent.trigger('fileOpen', eventArgs, (fileOpenArgs: FileOpenEventArgs) => {
|
702
|
-
if (!fileOpenArgs.cancel) {
|
703
|
-
const name: string = getValue('name', data);
|
704
|
-
if (getValue('isFile', data)) {
|
705
|
-
const icon: string = fileType(data);
|
706
|
-
if (icon === CLS.ICON_IMAGE) {
|
707
|
-
const imageData: BeforeImageLoadEventArgs = getImageUrl(this.parent, data);
|
708
|
-
createImageDialog(this.parent, name, imageData);
|
709
|
-
}
|
710
|
-
} else {
|
711
|
-
const val: string = this.parent.breadcrumbbarModule.searchObj.element.value;
|
712
|
-
if (val === '' && !this.parent.isFiltered) {
|
713
|
-
const id: string = getValue('id', data);
|
714
|
-
this.parent.oldPath = this.parent.path;
|
715
|
-
const newPath: string = this.parent.path + (isNOU(id) ? name : id) + '/';
|
716
|
-
this.parent.setProperties({ path: newPath }, true);
|
717
|
-
this.parent.pathNames.push(name);
|
718
|
-
this.parent.pathId.push(getValue('_fm_id', data));
|
719
|
-
this.parent.itemData = [data];
|
720
|
-
openAction(this.parent);
|
721
|
-
} else {
|
722
|
-
openSearchFolder(this.parent, data);
|
723
|
-
}
|
724
|
-
this.parent.isFiltered = false;
|
725
|
-
}
|
726
|
-
this.element.focus();
|
727
|
-
if (this.parent.enableVirtualization ) {
|
728
|
-
(this.parent.element.querySelector('#' + this.parent.element.id + CLS.IMG_DIALOG_ID) as HTMLElement).focus();
|
729
|
-
}
|
730
|
-
}
|
731
|
-
});
|
732
|
-
}
|
733
|
-
|
734
|
-
/* istanbul ignore next */
|
735
|
-
private onLayoutChange(args: ReadArgs): void {
|
736
|
-
if (this.parent.view === 'Details') {
|
737
|
-
if (this.parent.enableVirtualization) { this.parent.setProperties({ selectedItems: [] }, true); }
|
738
|
-
if (!this.gridObj) {
|
739
|
-
this.render(args);
|
740
|
-
} else {
|
741
|
-
this.isLoaded = true;
|
742
|
-
}
|
743
|
-
if (this.parent.isFiltered) {
|
744
|
-
this.updatePathColumn();
|
745
|
-
this.parent.setProperties({ selectedItems: [] }, true);
|
746
|
-
}
|
747
|
-
this.gridObj.dataSource = getSortedData(this.parent, args.files);
|
748
|
-
this.parent.notify(events.hideLayout, {});
|
749
|
-
this.gridObj.element.classList.remove(CLS.DISPLAY_NONE);
|
750
|
-
this.isInteracted = false;
|
751
|
-
this.gridObj.clearSelection();
|
752
|
-
if (this.parent.breadcrumbbarModule.searchObj.element.value.trim() !== '') {
|
753
|
-
this.onSearchFiles(args);
|
754
|
-
}
|
755
|
-
this.adjustHeight();
|
756
|
-
if (this.gridObj.sortSettings.columns.length > 0 && this.gridObj.sortSettings.columns[0].field !== this.parent.sortBy) {
|
757
|
-
if (this.parent.sortOrder !== 'None') {
|
758
|
-
this.gridObj.sortColumn(this.parent.sortBy, this.parent.sortOrder);
|
759
|
-
}
|
760
|
-
}
|
761
|
-
}
|
762
|
-
}
|
763
|
-
|
764
|
-
/* istanbul ignore next */
|
765
|
-
private onSearchFiles(args: SearchArgs | ReadArgs): void {
|
766
|
-
if (this.parent.view === 'Details') {
|
767
|
-
this.parent.setProperties({ selectedItems: [] }, true);
|
768
|
-
this.parent.notify(events.selectionChanged, {});
|
769
|
-
if (!this.parent.isLayoutChange) {
|
770
|
-
this.parent.layoutSelectedItems = [];
|
771
|
-
}
|
772
|
-
this.updatePathColumn();
|
773
|
-
this.parent.searchedItems = args.files;
|
774
|
-
this.onPathChanged(<ReadArgs>args);
|
775
|
-
}
|
776
|
-
}
|
777
|
-
|
778
|
-
private removePathColumn(isRefresh: boolean): void {
|
779
|
-
const len: number = this.gridObj.columns.length;
|
780
|
-
const columnData: ColumnModel[] = JSON.parse(JSON.stringify(this.gridObj.columns));
|
781
|
-
const filterPathInSettings: boolean = this.parent.detailsViewSettings.columns.some(
|
782
|
-
(col: ColumnModel) => col.field === 'filterPath'
|
783
|
-
);
|
784
|
-
if (columnData[len - 1].field && (columnData[len - 1].field === 'filterPath') && !filterPathInSettings) {
|
785
|
-
/* istanbul ignore next */
|
786
|
-
if (!isNullOrUndefined(this.gridObj.sortSettings.columns[0]) && this.gridObj.sortSettings.columns[0].field === 'filterPath') {
|
787
|
-
if (this.parent.sortOrder !== 'None') {
|
788
|
-
this.gridObj.sortColumn('name', this.parent.sortOrder);
|
789
|
-
} else {
|
790
|
-
this.gridObj.dataSource = getSortedData(this.parent, this.gridObj.dataSource as Object[]);
|
791
|
-
}
|
792
|
-
this.parent.notify(events.sortByChange, {});
|
793
|
-
}
|
794
|
-
this.gridObj.columns.pop();
|
795
|
-
if (!isRefresh) {
|
796
|
-
this.isColumnRefresh = true;
|
797
|
-
this.gridObj.refreshColumns();
|
798
|
-
}
|
799
|
-
}
|
800
|
-
}
|
801
|
-
|
802
|
-
private onFinalizeEnd(args: ReadArgs): void {
|
803
|
-
if (this.parent.view !== 'Details') { return; }
|
804
|
-
if (!this.gridObj) {
|
805
|
-
this.render(args);
|
806
|
-
} else {
|
807
|
-
this.onPathChanged(args);
|
808
|
-
}
|
809
|
-
}
|
810
|
-
|
811
|
-
private onCreateEnd(args: ReadArgs): void {
|
812
|
-
if (this.parent.view !== 'Details') { return; }
|
813
|
-
this.onPathChanged(args);
|
814
|
-
}
|
815
|
-
|
816
|
-
private onRenameInit(): void {
|
817
|
-
if (this.parent.activeModule === 'detailsview' && this.parent.selectedItems.length === 1) {
|
818
|
-
this.updateRenameData();
|
819
|
-
}
|
820
|
-
}
|
821
|
-
|
822
|
-
private onSelectedData(): void {
|
823
|
-
if (this.parent.activeModule === 'detailsview') {
|
824
|
-
this.parent.itemData = this.gridObj.getSelectedRecords();
|
825
|
-
}
|
826
|
-
}
|
827
|
-
|
828
|
-
private onDeleteInit(): void {
|
829
|
-
if (this.parent.activeModule === 'detailsview') {
|
830
|
-
Delete(this.parent, this.parent.selectedItems, this.parent.path, 'delete');
|
831
|
-
}
|
832
|
-
}
|
833
|
-
|
834
|
-
/* istanbul ignore next */
|
835
|
-
private onDeleteEnd(args: ReadArgs): void {
|
836
|
-
if (this.parent.view !== 'Details') { return; }
|
837
|
-
this.onPathChanged(args);
|
838
|
-
this.parent.setProperties({ selectedItems: [] }, true);
|
839
|
-
}
|
840
|
-
|
841
|
-
private onRefreshEnd(args: ReadArgs): void {
|
842
|
-
if (this.parent.view !== 'Details') { return; }
|
843
|
-
this.isInteracted = false;
|
844
|
-
this.removePathColumn(false);
|
845
|
-
this.gridObj.dataSource = getSortedData(this.parent, args.files);
|
846
|
-
this.emptyArgs = args;
|
847
|
-
}
|
848
|
-
|
849
|
-
private onHideLayout(): void {
|
850
|
-
if (this.parent.view !== 'Details' && this.gridObj) {
|
851
|
-
this.gridObj.element.classList.add(CLS.DISPLAY_NONE);
|
852
|
-
}
|
853
|
-
}
|
854
|
-
|
855
|
-
private onSelectAllInit(): void {
|
856
|
-
if (this.parent.view === 'Details') {
|
857
|
-
this.isInteracted = false;
|
858
|
-
if (this.parent.allowMultiSelection) {
|
859
|
-
this.gridObj.selectionModule.selectRowsByRange(0, this.gridObj.getRows().length);
|
860
|
-
} else {
|
861
|
-
this.gridObj.selectRow(this.gridObj.getRows().length - 1);
|
862
|
-
}
|
863
|
-
this.isInteracted = true;
|
864
|
-
this.interaction = true;
|
865
|
-
}
|
866
|
-
}
|
867
|
-
|
868
|
-
private onClearAllInit(): void {
|
869
|
-
if (this.parent.view === 'Details') {
|
870
|
-
this.removeSelection();
|
871
|
-
this.interaction = true;
|
872
|
-
}
|
873
|
-
}
|
874
|
-
|
875
|
-
/* istanbul ignore next */
|
876
|
-
private onSelectionChanged(): void {
|
877
|
-
removeClass([this.element], CLS.HEADER_CHECK);
|
878
|
-
if (this.parent.selectedItems.length > 0) {
|
879
|
-
addClass([this.element], CLS.HEADER_CHECK);
|
880
|
-
}
|
881
|
-
}
|
882
|
-
|
883
|
-
private onLayoutRefresh(): void {
|
884
|
-
if (this.parent.view !== 'Details') { return; }
|
885
|
-
this.adjustHeight();
|
886
|
-
}
|
887
|
-
|
888
|
-
private onBeforeRequest(): void {
|
889
|
-
this.isRendered = false;
|
890
|
-
}
|
891
|
-
|
892
|
-
private onAfterRequest(): void {
|
893
|
-
this.isRendered = true;
|
894
|
-
}
|
895
|
-
|
896
|
-
private onUpdateSelectionData(): void {
|
897
|
-
if (this.parent.view !== 'Details') { return; }
|
898
|
-
this.parent.itemData = this.gridObj.getSelectedRecords();
|
899
|
-
}
|
900
|
-
|
901
|
-
private addEventListener(): void {
|
902
|
-
this.parent.on(events.finalizeEnd, this.onFinalizeEnd, this);
|
903
|
-
this.parent.on(events.destroy, this.destroy, this);
|
904
|
-
this.parent.on(events.layoutChange, this.onLayoutChange, this);
|
905
|
-
this.parent.on(events.pathChanged, this.onPathChanged, this);
|
906
|
-
this.parent.on(events.createEnd, this.onCreateEnd, this);
|
907
|
-
this.parent.on(events.dropInit, this.onDropInit, this);
|
908
|
-
this.parent.on(events.detailsInit, this.onDetailsInit, this);
|
909
|
-
this.parent.on(events.refreshEnd, this.onRefreshEnd, this);
|
910
|
-
this.parent.on(events.search, this.onSearchFiles, this);
|
911
|
-
this.parent.on(events.methodCall, this.onMethodCall, this);
|
912
|
-
this.parent.on(events.actionFailure, this.onActionFailure, this);
|
913
|
-
this.parent.on(events.modelChanged, this.onPropertyChanged, this);
|
914
|
-
this.parent.on(events.deleteInit, this.onDeleteInit, this);
|
915
|
-
this.parent.on(events.deleteEnd, this.onDeleteEnd, this);
|
916
|
-
this.parent.on(events.selectedData, this.onSelectedData, this);
|
917
|
-
this.parent.on(events.renameInit, this.onRenameInit, this);
|
918
|
-
this.parent.on(events.renameEnd, this.onPathChanged, this);
|
919
|
-
this.parent.on(events.openInit, this.onOpenInit, this);
|
920
|
-
this.parent.on(events.sortColumn, this.onSortColumn, this);
|
921
|
-
this.parent.on(events.openEnd, this.onPathChanged, this);
|
922
|
-
this.parent.on(events.filterEnd, this.onPathChanged, this);
|
923
|
-
this.parent.on(events.pasteInit, this.onPasteInit, this);
|
924
|
-
this.parent.on(events.hideLayout, this.onHideLayout, this);
|
925
|
-
this.parent.on(events.selectAllInit, this.onSelectAllInit, this);
|
926
|
-
this.parent.on(events.clearAllInit, this.onClearAllInit, this);
|
927
|
-
this.parent.on(events.pathColumn, this.onPathColumn, this);
|
928
|
-
this.parent.on(events.selectionChanged, this.onSelectionChanged, this);
|
929
|
-
this.parent.on(events.beforeRequest, this.onBeforeRequest, this);
|
930
|
-
this.parent.on(events.afterRequest, this.onAfterRequest, this);
|
931
|
-
this.parent.on(events.pasteEnd, this.onpasteEnd, this);
|
932
|
-
this.parent.on(events.cutCopyInit, this.oncutCopyInit, this);
|
933
|
-
this.parent.on(events.menuItemData, this.onMenuItemData, this);
|
934
|
-
this.parent.on(events.resizeEnd, this.onDetailsResizeHandler, this);
|
935
|
-
this.parent.on(events.splitterResize, this.onDetailsResize, this);
|
936
|
-
this.parent.on(events.layoutRefresh, this.onLayoutRefresh, this);
|
937
|
-
this.parent.on(events.dropPath, this.onDropPath, this);
|
938
|
-
this.parent.on(events.updateSelectionData, this.onUpdateSelectionData, this);
|
939
|
-
}
|
940
|
-
|
941
|
-
private removeEventListener(): void {
|
942
|
-
this.parent.off(events.finalizeEnd, this.onFinalizeEnd);
|
943
|
-
this.parent.off(events.destroy, this.destroy);
|
944
|
-
this.parent.off(events.layoutChange, this.onLayoutChange);
|
945
|
-
this.parent.off(events.pathChanged, this.onPathChanged);
|
946
|
-
this.parent.off(events.pasteInit, this.onPasteInit);
|
947
|
-
this.parent.off(events.createEnd, this.onCreateEnd);
|
948
|
-
this.parent.off(events.refreshEnd, this.onRefreshEnd);
|
949
|
-
this.parent.off(events.search, this.onSearchFiles);
|
950
|
-
this.parent.off(events.methodCall, this.onMethodCall);
|
951
|
-
this.parent.off(events.actionFailure, this.onActionFailure);
|
952
|
-
this.parent.off(events.modelChanged, this.onPropertyChanged);
|
953
|
-
this.parent.off(events.renameInit, this.onRenameInit);
|
954
|
-
this.parent.off(events.renameEnd, this.onPathChanged);
|
955
|
-
this.parent.off(events.filterEnd, this.onPathChanged);
|
956
|
-
this.parent.off(events.openInit, this.onOpenInit);
|
957
|
-
this.parent.off(events.sortColumn, this.onSortColumn);
|
958
|
-
this.parent.off(events.openEnd, this.onPathChanged);
|
959
|
-
this.parent.off(events.hideLayout, this.onHideLayout);
|
960
|
-
this.parent.off(events.selectAllInit, this.onSelectAllInit);
|
961
|
-
this.parent.off(events.clearAllInit, this.onClearAllInit);
|
962
|
-
this.parent.off(events.deleteInit, this.onDeleteInit);
|
963
|
-
this.parent.off(events.deleteEnd, this.onDeleteEnd);
|
964
|
-
this.parent.off(events.pathColumn, this.onPathColumn);
|
965
|
-
this.parent.off(events.selectionChanged, this.onSelectionChanged);
|
966
|
-
this.parent.off(events.beforeRequest, this.onBeforeRequest);
|
967
|
-
this.parent.off(events.afterRequest, this.onAfterRequest);
|
968
|
-
this.parent.off(events.pasteEnd, this.onpasteEnd);
|
969
|
-
this.parent.off(events.cutCopyInit, this.oncutCopyInit);
|
970
|
-
this.parent.off(events.dropInit, this.onDropInit);
|
971
|
-
this.parent.off(events.selectedData, this.onSelectedData);
|
972
|
-
this.parent.off(events.detailsInit, this.onDetailsInit);
|
973
|
-
this.parent.off(events.menuItemData, this.onMenuItemData);
|
974
|
-
this.parent.off(events.resizeEnd, this.onDetailsResizeHandler);
|
975
|
-
this.parent.off(events.splitterResize, this.onDetailsResize);
|
976
|
-
this.parent.off(events.layoutRefresh, this.onLayoutRefresh);
|
977
|
-
this.parent.off(events.dropPath, this.onDropPath);
|
978
|
-
this.parent.off(events.updateSelectionData, this.onUpdateSelectionData);
|
979
|
-
}
|
980
|
-
|
981
|
-
private onActionFailure(): void { this.interaction = true; }
|
982
|
-
|
983
|
-
private onMenuItemData(args: { [key: string]: Object; }): void {
|
984
|
-
if (this.parent.activeModule === this.getModuleName()) {
|
985
|
-
this.parent.itemData = [this.gridObj.getRowInfo(<Element>args.target).rowData];
|
986
|
-
}
|
987
|
-
}
|
988
|
-
|
989
|
-
private onPasteInit(): void {
|
990
|
-
if (this.parent.activeModule === this.getModuleName()) {
|
991
|
-
this.parent.itemData = (this.parent.folderPath !== '') ? this.gridObj.getSelectedRecords() :
|
992
|
-
[getPathObject(this.parent)];
|
993
|
-
}
|
994
|
-
}
|
995
|
-
|
996
|
-
private onDetailsInit(): void {
|
997
|
-
if (this.parent.activeModule === this.getModuleName()) {
|
998
|
-
if (this.parent.selectedItems.length !== 0) {
|
999
|
-
this.parent.itemData = this.gridObj.getSelectedRecords();
|
1000
|
-
} else {
|
1001
|
-
this.parent.itemData = [getValue(this.parent.pathId[this.parent.pathId.length - 1], this.parent.feParent)];
|
1002
|
-
}
|
1003
|
-
}
|
1004
|
-
}
|
1005
|
-
|
1006
|
-
public dragHelper(args: { element: HTMLElement, sender: MouseEvent & TouchEvent }): HTMLElement {
|
1007
|
-
const dragTarget: Element = <Element>args.sender.target;
|
1008
|
-
const dragLi: Element = dragTarget.closest('tr.e-row');
|
1009
|
-
if (!dragLi) { return null; }
|
1010
|
-
let name: string;
|
1011
|
-
if (<HTMLElement>dragLi.getElementsByClassName('e-fe-text')[0]) {
|
1012
|
-
name = this.parent.hasId ? (this.gridObj.getRowInfo(dragLi).rowData as {[key: string]: Object}).id as string : (<HTMLElement>dragLi.getElementsByClassName('e-fe-text')[0]).innerText;
|
1013
|
-
}
|
1014
|
-
else if (<HTMLElement>dragLi.getElementsByClassName('e-rowcell e-templatecell')[0].nextElementSibling) {
|
1015
|
-
name = this.parent.hasId ? (this.gridObj.getRowInfo(dragLi).rowData as { [key: string]: Object }).id as string : (<HTMLElement>dragLi.getElementsByClassName('e-rowcell e-templatecell')[0].nextElementSibling).innerText;
|
1016
|
-
}
|
1017
|
-
if (dragLi && !dragLi.querySelector('.e-active')) {
|
1018
|
-
this.selectRecords([name]);
|
1019
|
-
}
|
1020
|
-
getModule(this.parent, dragLi);
|
1021
|
-
this.parent.activeElements = [];
|
1022
|
-
this.parent.dragData = [];
|
1023
|
-
this.parent.dragData = <{ [key: string]: Object; }[]>this.gridObj.getSelectedRecords();
|
1024
|
-
let dragRow: { [key: string]: Object; };
|
1025
|
-
if (this.parent.dragData.length === 0 && dragLi) {
|
1026
|
-
dragRow = this.gridObj.getRowInfo(dragLi) as { [key: string]: Object; };
|
1027
|
-
}
|
1028
|
-
if (dragRow)
|
1029
|
-
{
|
1030
|
-
this.parent.dragData.push(dragRow.rowData as { [key: string]: Object; });
|
1031
|
-
}
|
1032
|
-
this.parent.dragPath = this.parent.path;
|
1033
|
-
this.parent.activeElements = this.gridObj.getSelectedRows();
|
1034
|
-
createVirtualDragElement(this.parent);
|
1035
|
-
return this.parent.virtualDragElement;
|
1036
|
-
}
|
1037
|
-
|
1038
|
-
/* istanbul ignore next */
|
1039
|
-
private onDetailsResize(): void {
|
1040
|
-
if (this.parent.view === 'Details' && !this.parent.isMobile && !isNOU(this.gridObj)) {
|
1041
|
-
const gridHeader: HTMLElement = <HTMLElement>this.gridObj.getHeaderContent().querySelector('.e-headercontent');
|
1042
|
-
const gridHeaderColGroup: HTMLElement = <HTMLElement>gridHeader.firstChild.childNodes[0];
|
1043
|
-
const gridContentColGroup: HTMLElement =
|
1044
|
-
<HTMLElement>this.gridObj.getContent().querySelector('.e-content .e-table').children[0];
|
1045
|
-
const gridHeaderColNames: ColumnModel[] = this.gridObj.getColumns();
|
1046
|
-
for (let i: number = 0; i < gridHeaderColNames.length; i++) {
|
1047
|
-
if ((!this.isNameWidth && gridHeaderColNames[i as number].field === 'name') || gridHeaderColNames[i as number].field === 'filterPath') {
|
1048
|
-
if (this.parent.breadcrumbbarModule.searchObj.element.value === '' && !this.parent.isFiltered) {
|
1049
|
-
if (this.element.clientWidth <= 500) {
|
1050
|
-
(gridHeaderColGroup.children[i as number]as HTMLElement).style.width = '120px';
|
1051
|
-
(gridContentColGroup.children[i as number]as HTMLElement).style.width = '120px';
|
1052
|
-
} else if (this.element.clientWidth > 500) {
|
1053
|
-
(gridHeaderColGroup.children[i as number] as HTMLElement).style.width = 'auto';
|
1054
|
-
(gridContentColGroup.children[i as number] as HTMLElement).style.width = 'auto';
|
1055
|
-
}
|
1056
|
-
} else {
|
1057
|
-
if (this.element.clientWidth <= 680) {
|
1058
|
-
if (gridHeaderColNames[i as number].field === 'name') {
|
1059
|
-
(gridHeaderColGroup.children[i as number]as HTMLElement).style.width = '120px';
|
1060
|
-
(gridContentColGroup.children[i as number]as HTMLElement).style.width = '120px';
|
1061
|
-
} else {
|
1062
|
-
(gridHeaderColGroup.children[i as number]as HTMLElement).style.width = '180px';
|
1063
|
-
(gridContentColGroup.children[i as number]as HTMLElement).style.width = '180px';
|
1064
|
-
}
|
1065
|
-
} else if (this.element.clientWidth > 680) {
|
1066
|
-
(gridHeaderColGroup.children[i as number]as HTMLElement).style.width = 'auto';
|
1067
|
-
(gridContentColGroup.children[i as number]as HTMLElement).style.width = 'auto';
|
1068
|
-
}
|
1069
|
-
}
|
1070
|
-
}
|
1071
|
-
}
|
1072
|
-
}
|
1073
|
-
}
|
1074
|
-
|
1075
|
-
private onDetailsResizeHandler(): void {
|
1076
|
-
this.onDetailsResize();
|
1077
|
-
if (this.parent.view === 'Details' && !this.parent.isMobile && !isNOU(this.gridObj)) {
|
1078
|
-
this.adjustHeight();
|
1079
|
-
}
|
1080
|
-
}
|
1081
|
-
|
1082
|
-
private createDragObj(): void {
|
1083
|
-
if (this.gridObj) {
|
1084
|
-
if (this.parent.allowDragAndDrop && isNullOrUndefined(this.dragObj)) {
|
1085
|
-
this.dragObj = new Draggable(this.gridObj.element, {
|
1086
|
-
cursorAt: this.parent.dragCursorPosition,
|
1087
|
-
distance: 5,
|
1088
|
-
enableTailMode: true,
|
1089
|
-
dragArea: this.parent.element,
|
1090
|
-
dragTarget: '.' + CLS.ROW,
|
1091
|
-
drag: draggingHandler.bind(this, this.parent),
|
1092
|
-
dragStart: (args: DragEventArgs) => {
|
1093
|
-
dragStartHandler(this.parent, args, this.dragObj);
|
1094
|
-
},
|
1095
|
-
dragStop: dragStopHandler.bind(this, this.parent),
|
1096
|
-
enableAutoScroll: false,
|
1097
|
-
helper: this.dragHelper.bind(this)
|
1098
|
-
});
|
1099
|
-
} else if (!this.parent.allowDragAndDrop && this.dragObj) {
|
1100
|
-
this.dragObj.destroy();
|
1101
|
-
this.dragObj = null;
|
1102
|
-
}
|
1103
|
-
}
|
1104
|
-
}
|
1105
|
-
|
1106
|
-
private onDropInit(args: DragEventArgs): void {
|
1107
|
-
if (this.parent.targetModule === this.getModuleName()) {
|
1108
|
-
/* istanbul ignore next */
|
1109
|
-
const cwdData: Object = getValue(this.parent.pathId[this.parent.pathId.length - 1], this.parent.feParent);
|
1110
|
-
if (!args.target.closest('tr')) {
|
1111
|
-
this.parent.dropPath = this.parent.path;
|
1112
|
-
this.parent.dropData = cwdData;
|
1113
|
-
} else {
|
1114
|
-
let info: { [key: string]: Object; } = null;
|
1115
|
-
info = <{ [key: string]: Object; }>this.gridObj.getRowInfo(args.target).rowData;
|
1116
|
-
this.parent.dropPath = info.isFile ? this.parent.path : getFullPath(this.parent, info, this.parent.path);
|
1117
|
-
this.parent.dropData = info.isFile ? cwdData : info;
|
1118
|
-
}
|
1119
|
-
}
|
1120
|
-
}
|
1121
|
-
|
1122
|
-
private oncutCopyInit(): void {
|
1123
|
-
if (this.parent.activeModule === this.getModuleName()) {
|
1124
|
-
this.parent.activeRecords = this.gridObj.getSelectedRecords();
|
1125
|
-
this.parent.activeElements = this.gridObj.getSelectedRows();
|
1126
|
-
}
|
1127
|
-
}
|
1128
|
-
|
1129
|
-
private onpasteEnd(args: ReadArgs): void {
|
1130
|
-
if (this.parent.view === 'Details') {
|
1131
|
-
this.isPasteOperation = true;
|
1132
|
-
if (this.parent.path === this.parent.destinationPath ||
|
1133
|
-
this.parent.path === getDirectoryPath(this.parent, args) || this.parent.hasId) {
|
1134
|
-
this.onPathChanged(args);
|
1135
|
-
}
|
1136
|
-
}
|
1137
|
-
}
|
1138
|
-
|
1139
|
-
private onDropPath(args: ReadArgs): void {
|
1140
|
-
if (this.parent.view === 'Details') {
|
1141
|
-
this.isPasteOperation = true;
|
1142
|
-
this.onPathChanged(args);
|
1143
|
-
}
|
1144
|
-
}
|
1145
|
-
|
1146
|
-
/**
|
1147
|
-
* For internal use only - Get the module name.
|
1148
|
-
*
|
1149
|
-
* @returns {string} - returns modules name.
|
1150
|
-
* @private
|
1151
|
-
*/
|
1152
|
-
private getModuleName(): string {
|
1153
|
-
return 'detailsview';
|
1154
|
-
}
|
1155
|
-
|
1156
|
-
public destroy(): void {
|
1157
|
-
if (this.parent.isDestroyed) { return; }
|
1158
|
-
this.removeEventListener();
|
1159
|
-
if (this.gridObj) {
|
1160
|
-
if ((this as any).parent.isReact) {
|
1161
|
-
this.gridObj.off('reactTemplateRender', this.reactTemplateRender);
|
1162
|
-
}
|
1163
|
-
this.unWireEvents();
|
1164
|
-
this.gridObj.destroy();
|
1165
|
-
}
|
1166
|
-
}
|
1167
|
-
|
1168
|
-
private updateType(item: Element): void {
|
1169
|
-
const folder: Element = select('.' + CLS.FOLDER, item);
|
1170
|
-
this.parent.isFile = isNOU(folder) ? true : false;
|
1171
|
-
}
|
1172
|
-
|
1173
|
-
/* istanbul ignore next */
|
1174
|
-
private onSelection(action: string, args: RowSelectingEventArgs | RowDeselectingEventArgs ): void {
|
1175
|
-
const eventArgs: FileSelectionEventArgs = {
|
1176
|
-
action: action, fileDetails: args.data, isInteracted: this.interaction, cancel: false, target: args.target
|
1177
|
-
};
|
1178
|
-
this.parent.trigger('fileSelection', eventArgs);
|
1179
|
-
args.cancel = eventArgs.cancel;
|
1180
|
-
if (!this.isMultiSelect) {
|
1181
|
-
this.isMultiSelect = true;
|
1182
|
-
if (((args as RowSelectingEventArgs).isShiftPressed || (args as RowSelectingEventArgs).isCtrlPressed) && !this.parent.allowMultiSelection && (args.target && args.target.parentElement && !args.target.parentElement.classList.contains('e-checkbox-wrapper'))) {
|
1183
|
-
args.cancel = true;
|
1184
|
-
const rowIndex: number = ((args as RowSelectingEventArgs) && args.rowIndexes)
|
1185
|
-
? args.rowIndexes[args.rowIndexes.length - 1]
|
1186
|
-
: args.rowIndex;
|
1187
|
-
this.gridObj.selectRow(rowIndex);
|
1188
|
-
}
|
1189
|
-
this.isMultiSelect = false;
|
1190
|
-
}
|
1191
|
-
}
|
1192
|
-
|
1193
|
-
/* istanbul ignore next */
|
1194
|
-
private onSelected(args: RowSelectEventArgs): void {
|
1195
|
-
this.parent.activeModule = 'detailsview';
|
1196
|
-
if (!this.parent.isLayoutChange || this.parent.isFiltered) { this.selectedRecords(); }
|
1197
|
-
this.parent.notify(events.selectionChanged, {});
|
1198
|
-
if (this.gridObj.getSelectedRowIndexes().length === 1) {
|
1199
|
-
this.firstItemIndex = this.gridObj.selectedRowIndex;
|
1200
|
-
}
|
1201
|
-
this.gridObj.element.setAttribute('tabindex', '-1');
|
1202
|
-
this.triggerSelect('select', args);
|
1203
|
-
const item: Element = this.gridObj.getRowByIndex(this.gridObj.selectedRowIndex);
|
1204
|
-
this.updateType(item);
|
1205
|
-
if (!isNOU(item) && !isNOU(item.querySelector('.e-checkselect'))) {
|
1206
|
-
if (this.gridObj.getSelectedRowIndexes().length !== 1) {
|
1207
|
-
const lastItemIndex: number = this.gridObj.getSelectedRowIndexes()[this.gridObj.getSelectedRowIndexes().length - 2];
|
1208
|
-
const lastItem: Element = this.gridObj.getRowByIndex(lastItemIndex);
|
1209
|
-
if (!isNOU(lastItem)) {
|
1210
|
-
lastItem.querySelector('.e-checkselect').setAttribute('tabindex', '-1');
|
1211
|
-
}
|
1212
|
-
}
|
1213
|
-
item.querySelector('.e-rowcell.e-fe-checkbox').removeAttribute('tabindex');
|
1214
|
-
}
|
1215
|
-
if (!isNOU(this.gridObj) && !isNOU(this.gridObj.element.querySelector('.e-checkselectall'))) {
|
1216
|
-
this.gridObj.element.querySelector('.e-checkselectall').setAttribute('tabindex', '-1');
|
1217
|
-
}
|
1218
|
-
const rows: number[] = this.gridObj.getSelectedRowIndexes();
|
1219
|
-
if (!this.parent.allowMultiSelection) {
|
1220
|
-
for (let i: number = 0; i < rows.length; i++) {
|
1221
|
-
if (rows[i as number] === this.gridObj.selectedRowIndex) {
|
1222
|
-
this.gridObj.getRowByIndex(rows[i as number]).setAttribute('tabindex', '0');
|
1223
|
-
} else {
|
1224
|
-
this.gridObj.getRowByIndex(rows[i as number]).removeAttribute('tabindex');
|
1225
|
-
}
|
1226
|
-
}
|
1227
|
-
}
|
1228
|
-
const len: number = rows.length;
|
1229
|
-
if (this.parent.enableVirtualization) {
|
1230
|
-
this.parent.currentItemText = getValue('name', args.data);
|
1231
|
-
}
|
1232
|
-
else if (len > 0) {
|
1233
|
-
const data: Object = this.gridObj.getRowsObject()[rows[len - 1]].data;
|
1234
|
-
this.parent.currentItemText = getValue('name', data);
|
1235
|
-
}
|
1236
|
-
const indexes: number[] = getValue('rowIndexes', args);
|
1237
|
-
const multiSelect: boolean = getValue('enableSelectMultiTouch', this.gridObj.selectionModule);
|
1238
|
-
if (this.parent.isDevice && isNOU(indexes) && args.target && !multiSelect && !args.target.closest('.e-headercell')) {
|
1239
|
-
this.parent.isFile = getValue('isFile', args.data);
|
1240
|
-
if (!this.parent.isFile) {
|
1241
|
-
this.openContent(args.data);
|
1242
|
-
}
|
1243
|
-
}
|
1244
|
-
this.parent.visitedItem = <Element>args.row;
|
1245
|
-
if ((!this.parent.enableVirtualization) || (!args.isHeaderCheckboxClicked)) {
|
1246
|
-
this.addFocus(this.gridObj.selectedRowIndex);
|
1247
|
-
}
|
1248
|
-
if (!this.parent.isLayoutChange) {
|
1249
|
-
this.isInteracted = true;
|
1250
|
-
}
|
1251
|
-
}
|
1252
|
-
/* istanbul ignore next */
|
1253
|
-
private onPathColumn(): void {
|
1254
|
-
if (this.parent.view === 'Details' && !isNOU(this.gridObj)) {
|
1255
|
-
if (this.parent.breadcrumbbarModule.searchObj.element.value === '' && !this.parent.isFiltered) {
|
1256
|
-
this.removePathColumn(false);
|
1257
|
-
}
|
1258
|
-
}
|
1259
|
-
}
|
1260
|
-
|
1261
|
-
private selectedRecords(): void {
|
1262
|
-
this.parent.setProperties({ selectedItems: [] }, true);
|
1263
|
-
const selectedRecords: Object[] = this.gridSelectNodes();
|
1264
|
-
let selectSize: number = 0;
|
1265
|
-
while (selectSize < selectedRecords.length) {
|
1266
|
-
const record: FileDetails = <FileDetails>selectedRecords[selectSize as number];
|
1267
|
-
const name: string = getItemName(this.parent, record);
|
1268
|
-
this.parent.selectedItems.push(name);
|
1269
|
-
selectSize++;
|
1270
|
-
}
|
1271
|
-
this.parent.setProperties({ selectedItems: this.parent.selectedItems }, true);
|
1272
|
-
}
|
1273
|
-
|
1274
|
-
private onDeSelection(args: RowDeselectEventArgs): void {
|
1275
|
-
/* istanbul ignore next */
|
1276
|
-
if (!this.parent.allowMultiSelection && isNOU(args.data)) {
|
1277
|
-
const item: Element = this.gridObj.getRowByIndex(<number>args.rowIndex);
|
1278
|
-
if (!isNOU(item)) {
|
1279
|
-
item.removeAttribute('tabindex');
|
1280
|
-
}
|
1281
|
-
} else if (this.gridObj.getSelectedRowIndexes().length > 1) {
|
1282
|
-
const lastItemIndex: number = this.gridObj.getSelectedRowIndexes()[this.gridObj.getSelectedRowIndexes().length - 2];
|
1283
|
-
const lastItem: Element = this.gridObj.getRowByIndex(lastItemIndex);
|
1284
|
-
if (!isNOU(lastItem)) {
|
1285
|
-
lastItem.querySelector('.e-checkselect').removeAttribute('tabindex');
|
1286
|
-
}
|
1287
|
-
}
|
1288
|
-
if (this.gridObj.selectedRowIndex === -1) {
|
1289
|
-
this.gridObj.element.setAttribute('tabindex', '0');
|
1290
|
-
}
|
1291
|
-
if (!this.isInteracted) {
|
1292
|
-
this.isInteracted = true;
|
1293
|
-
return;
|
1294
|
-
}
|
1295
|
-
this.selectedRecords();
|
1296
|
-
if (this.parent.selectedItems.length === 0) {
|
1297
|
-
setValue('enableSelectMultiTouch', false, this.gridObj.selectionModule);
|
1298
|
-
removeClass([this.parent.element], CLS.MULTI_SELECT);
|
1299
|
-
}
|
1300
|
-
this.parent.notify(events.selectionChanged, {});
|
1301
|
-
this.triggerSelect('unselect', args);
|
1302
|
-
this.parent.visitedItem = null;
|
1303
|
-
}
|
1304
|
-
|
1305
|
-
private triggerSelect(action?: string, args?: RowSelectEventArgs): void {
|
1306
|
-
const eventArgs: FileSelectEventArgs = { action: action, fileDetails: args.data, isInteracted: this.interaction };
|
1307
|
-
this.parent.trigger('fileSelect', eventArgs);
|
1308
|
-
this.interaction = true;
|
1309
|
-
}
|
1310
|
-
private wireEvents(): void {
|
1311
|
-
this.wireClickEvent(true);
|
1312
|
-
this.keyboardModule = new KeyboardEvents(
|
1313
|
-
this.gridObj.element,
|
1314
|
-
{
|
1315
|
-
keyAction: this.keyupHandler.bind(this),
|
1316
|
-
keyConfigs: this.keyConfigs,
|
1317
|
-
eventName: 'keyup'
|
1318
|
-
}
|
1319
|
-
);
|
1320
|
-
this.keyboardDownModule = new KeyboardEvents(
|
1321
|
-
this.element,
|
1322
|
-
{
|
1323
|
-
keyAction: this.keydownHandler.bind(this),
|
1324
|
-
keyConfigs: this.keyConfigs,
|
1325
|
-
eventName: 'keydown'
|
1326
|
-
}
|
1327
|
-
);
|
1328
|
-
EventHandler.add(this.gridObj.element, 'blur', this.removeFocus, this);
|
1329
|
-
EventHandler.add(this.parent.element, 'focusout', this.onBlur, this);
|
1330
|
-
}
|
1331
|
-
|
1332
|
-
private unWireEvents(): void {
|
1333
|
-
this.wireClickEvent(false);
|
1334
|
-
this.keyboardModule.destroy();
|
1335
|
-
this.keyboardDownModule.destroy();
|
1336
|
-
EventHandler.remove(this.gridObj.element, 'blur', this.removeFocus);
|
1337
|
-
EventHandler.remove(this.parent.element, 'focusout', this.onBlur);
|
1338
|
-
}
|
1339
|
-
|
1340
|
-
private wireClickEvent(toBind: boolean): void {
|
1341
|
-
if (toBind) {
|
1342
|
-
const ele: HTMLElement = <HTMLElement>this.gridObj.getContent();
|
1343
|
-
this.clickObj = new Touch(ele, {
|
1344
|
-
tap: (eve: TapEventArgs) => {
|
1345
|
-
if (eve.tapCount === 1 && (<HTMLElement>eve.originalEvent.target).classList.contains('e-content')) {
|
1346
|
-
this.onClearAllInit();
|
1347
|
-
}
|
1348
|
-
},
|
1349
|
-
tapHold: (e: TapEventArgs) => {
|
1350
|
-
if (this.parent.isDevice) {
|
1351
|
-
e.originalEvent.preventDefault();
|
1352
|
-
if (this.parent.allowMultiSelection) {
|
1353
|
-
setValue('enableSelectMultiTouch', this.parent.allowMultiSelection, this.gridObj.selectionModule);
|
1354
|
-
addClass([this.parent.element], CLS.MULTI_SELECT);
|
1355
|
-
}
|
1356
|
-
const target: Element = <Element>e.originalEvent.target;
|
1357
|
-
if (target) {
|
1358
|
-
const row: Element = closest(target, '.' + CLS.ROW);
|
1359
|
-
const index: number = this.gridObj.getRows().indexOf(row);
|
1360
|
-
this.gridObj.selectRow(index);
|
1361
|
-
}
|
1362
|
-
}
|
1363
|
-
}
|
1364
|
-
});
|
1365
|
-
} else {
|
1366
|
-
if (this.clickObj) {
|
1367
|
-
this.clickObj.destroy();
|
1368
|
-
}
|
1369
|
-
}
|
1370
|
-
}
|
1371
|
-
|
1372
|
-
/* istanbul ignore next */
|
1373
|
-
private removeSelection(): void {
|
1374
|
-
removeClass([this.parent.element], CLS.MULTI_SELECT);
|
1375
|
-
this.gridObj.clearSelection();
|
1376
|
-
this.parent.setProperties({ selectedItems: [] }, true);
|
1377
|
-
this.parent.notify(events.selectionChanged, {});
|
1378
|
-
if (this.gridObj.selectedRowIndex === -1) {
|
1379
|
-
this.startIndex = null;
|
1380
|
-
}
|
1381
|
-
this.isInteracted = true;
|
1382
|
-
}
|
1383
|
-
|
1384
|
-
private removeFocus(): void {
|
1385
|
-
this.addFocus(null);
|
1386
|
-
}
|
1387
|
-
|
1388
|
-
private onBlur(e: KeyboardEventArgs): void {
|
1389
|
-
if (((e as any).relatedTarget !== null && closest((e as any).relatedTarget, '.e-grid') !== (e as any).relatedTarget)) {
|
1390
|
-
return;
|
1391
|
-
}
|
1392
|
-
if (!isNOU(this.gridObj.element)) {
|
1393
|
-
const thElements: NodeListOf<HTMLElement> = this.gridObj.element.querySelectorAll('th');
|
1394
|
-
for (let i: number = 0; i < thElements.length; i++) {
|
1395
|
-
if (thElements[i as number].classList.contains('e-focus')) {
|
1396
|
-
this.addFocus(null);
|
1397
|
-
}
|
1398
|
-
}
|
1399
|
-
}
|
1400
|
-
}
|
1401
|
-
|
1402
|
-
private getFocusedItemIndex(): number {
|
1403
|
-
return (!isNOU(this.getFocusedItem())) ?
|
1404
|
-
parseInt(this.getFocusedItem().getAttribute('aria-rowindex'), 10) - 1 : null;
|
1405
|
-
}
|
1406
|
-
|
1407
|
-
/* istanbul ignore next */
|
1408
|
-
private keydownHandler(e: KeyboardEventArgs): void {
|
1409
|
-
if (!this.isRendered) { return; }
|
1410
|
-
switch (e.action) {
|
1411
|
-
case 'end':
|
1412
|
-
case 'home':
|
1413
|
-
case 'space':
|
1414
|
-
case 'ctrlSpace':
|
1415
|
-
case 'shiftSpace':
|
1416
|
-
case 'csSpace':
|
1417
|
-
case 'ctrlA':
|
1418
|
-
case 'enter':
|
1419
|
-
case 'altEnter':
|
1420
|
-
case 'ctrlEnd':
|
1421
|
-
case 'shiftEnd':
|
1422
|
-
case 'csEnd':
|
1423
|
-
case 'ctrlHome':
|
1424
|
-
case 'shiftHome':
|
1425
|
-
case 'csHome':
|
1426
|
-
case 'ctrlDown':
|
1427
|
-
case 'shiftDown':
|
1428
|
-
case 'csDown':
|
1429
|
-
case 'ctrlLeft':
|
1430
|
-
case 'shiftLeft':
|
1431
|
-
case 'csLeft':
|
1432
|
-
case 'esc':
|
1433
|
-
case 'del':
|
1434
|
-
case 'shiftdel':
|
1435
|
-
case 'ctrlC':
|
1436
|
-
case 'ctrlV':
|
1437
|
-
case 'ctrlX':
|
1438
|
-
case 'f2':
|
1439
|
-
case 'moveDown':
|
1440
|
-
case 'moveUp':
|
1441
|
-
case 'ctrlD':
|
1442
|
-
e.preventDefault();
|
1443
|
-
break;
|
1444
|
-
default:
|
1445
|
-
break;
|
1446
|
-
}
|
1447
|
-
}
|
1448
|
-
|
1449
|
-
/* istanbul ignore next */
|
1450
|
-
private keyupHandler(e: KeyboardEventArgs): void {
|
1451
|
-
if (!this.isRendered) { return; }
|
1452
|
-
e.preventDefault();
|
1453
|
-
const action: string = e.action;
|
1454
|
-
const gridItems: object[] = getSortedData(this.parent, this.gridObj.dataSource as Object[]);
|
1455
|
-
const gridLength: number = gridItems.length;
|
1456
|
-
const focIndex: number = this.getFocusedItemIndex();
|
1457
|
-
const selIndex: number = this.gridObj.selectedRowIndex;
|
1458
|
-
const selRowIndeces: number[] = this.gridObj.getSelectedRowIndexes();
|
1459
|
-
let rowData: object;
|
1460
|
-
let firstItem: string[];
|
1461
|
-
let lastItem: string[];
|
1462
|
-
switch (action) {
|
1463
|
-
case 'altEnter':
|
1464
|
-
this.parent.notify(events.detailsInit, {});
|
1465
|
-
GetDetails(this.parent, this.parent.selectedItems, this.parent.path, 'details');
|
1466
|
-
break;
|
1467
|
-
case 'esc':
|
1468
|
-
removeActive(this.parent);
|
1469
|
-
break;
|
1470
|
-
case 'del':
|
1471
|
-
case 'shiftdel':
|
1472
|
-
this.performDelete();
|
1473
|
-
break;
|
1474
|
-
case 'enter':
|
1475
|
-
if (this.gridObj.selectedRowIndex === -1 && this.gridObj.allowSorting === true) {
|
1476
|
-
if (!(e.target as HTMLElement).classList.contains('e-fe-grid-icon')) {
|
1477
|
-
const direction: SortOrder = !(e.target as HTMLElement).getElementsByClassName('e-ascending').length ? 'Ascending' : 'Descending';
|
1478
|
-
const currentField: string = this.gridObj.getColumnByUid((e.target as HTMLElement).querySelector('.e-headercelldiv').getAttribute('e-mappinguid')).field;
|
1479
|
-
this.gridObj.sortColumn(currentField, direction);
|
1480
|
-
if (!isNOU(this.getFocusedItem().nextSibling)) {
|
1481
|
-
(this.getFocusedItem().nextSibling as HTMLElement).setAttribute('tabindex', '0');
|
1482
|
-
}
|
1483
|
-
}
|
1484
|
-
break;
|
1485
|
-
}
|
1486
|
-
rowData = this.gridObj.getRowsObject()[this.gridObj.selectedRowIndex].data;
|
1487
|
-
if (rowData) {
|
1488
|
-
const data: object = JSON.parse(JSON.stringify(rowData));
|
1489
|
-
this.openContent(data);
|
1490
|
-
}
|
1491
|
-
break;
|
1492
|
-
case 'ctrlC':
|
1493
|
-
copyFiles(this.parent);
|
1494
|
-
break;
|
1495
|
-
case 'ctrlV':
|
1496
|
-
this.parent.folderPath = '';
|
1497
|
-
pasteHandler(this.parent);
|
1498
|
-
break;
|
1499
|
-
case 'ctrlX':
|
1500
|
-
cutFiles(this.parent);
|
1501
|
-
break;
|
1502
|
-
case 'ctrlD':
|
1503
|
-
this.doDownload();
|
1504
|
-
break;
|
1505
|
-
case 'f2':
|
1506
|
-
this.performRename();
|
1507
|
-
break;
|
1508
|
-
case 'ctrlA':
|
1509
|
-
if (!isNOU(gridItems[0]) && this.parent.allowMultiSelection) {
|
1510
|
-
const cnTable: HTMLElement = <HTMLElement>this.gridObj.getContent().querySelector('.e-content');
|
1511
|
-
const crtSrlPos: number = cnTable.scrollTop;
|
1512
|
-
const crtFocusIndex: number = this.gridObj.selectedRowIndex;
|
1513
|
-
this.gridObj.selectionModule.selectRowsByRange(0, gridItems.length - 1);
|
1514
|
-
cnTable.scrollTop = crtSrlPos;
|
1515
|
-
if (crtFocusIndex !== -1) {
|
1516
|
-
this.addFocus(crtFocusIndex);
|
1517
|
-
}
|
1518
|
-
}
|
1519
|
-
break;
|
1520
|
-
case 'ctrlHome':
|
1521
|
-
case 'tab':
|
1522
|
-
if (!isNOU(gridItems[0])) {
|
1523
|
-
if (!this.parent.allowMultiSelection && e.action === 'ctrlHome') {
|
1524
|
-
this.gridObj.selectRow(0);
|
1525
|
-
} else if (this.gridObj.selectedRowIndex !== -1 && e.action === 'tab') {
|
1526
|
-
return;
|
1527
|
-
}
|
1528
|
-
else{
|
1529
|
-
this.addHeaderFocus(e);
|
1530
|
-
}
|
1531
|
-
}
|
1532
|
-
break;
|
1533
|
-
case 'ctrlEnd':
|
1534
|
-
if (!isNOU(gridItems[0])) {
|
1535
|
-
if (!this.parent.allowMultiSelection) {
|
1536
|
-
this.gridObj.selectRow(gridLength - 1);
|
1537
|
-
}
|
1538
|
-
else {
|
1539
|
-
this.addFocus(gridLength - 1);
|
1540
|
-
}
|
1541
|
-
}
|
1542
|
-
break;
|
1543
|
-
case 'shiftHome':
|
1544
|
-
case 'shiftEnd':
|
1545
|
-
case 'csHome':
|
1546
|
-
case 'csEnd':
|
1547
|
-
if (!this.parent.allowMultiSelection) {
|
1548
|
-
this.gridObj.selectRow((e.action === 'shiftHome' || e.action === 'csHome') ? 0 : gridItems.length - 1);
|
1549
|
-
} else {
|
1550
|
-
if (!isNOU(gridItems[0])) {
|
1551
|
-
if (!isNOU(selIndex) && selIndex !== -1) {
|
1552
|
-
this.checkRowsKey(gridItems, selIndex, null, e);
|
1553
|
-
} else {
|
1554
|
-
if (e.action === 'csHome' || e.action === 'shiftHome') {
|
1555
|
-
this.gridObj.selectRow(0);
|
1556
|
-
} else {
|
1557
|
-
this.gridObj.selectionModule.selectRowsByRange(0, gridItems.length - 1);
|
1558
|
-
}
|
1559
|
-
}
|
1560
|
-
}
|
1561
|
-
}
|
1562
|
-
break;
|
1563
|
-
case 'space':
|
1564
|
-
case 'csSpace':
|
1565
|
-
case 'shiftSpace':
|
1566
|
-
case 'ctrlSpace':
|
1567
|
-
this.spaceSelection(selRowIndeces, focIndex, selIndex, e);
|
1568
|
-
break;
|
1569
|
-
case 'csUp':
|
1570
|
-
case 'csDown':
|
1571
|
-
case 'shiftUp':
|
1572
|
-
case 'shiftDown':
|
1573
|
-
this.shiftMoveMethod(gridItems, selIndex, focIndex, selRowIndeces, e);
|
1574
|
-
break;
|
1575
|
-
case 'ctrlUp':
|
1576
|
-
case 'ctrlDown':
|
1577
|
-
if (!this.parent.allowMultiSelection) {
|
1578
|
-
this.moveFunction(gridItems, e, selIndex);
|
1579
|
-
} else {
|
1580
|
-
this.ctrlMoveFunction(gridItems, e, selIndex);
|
1581
|
-
}
|
1582
|
-
break;
|
1583
|
-
case 'home':
|
1584
|
-
firstItem = [getValue(this.parent.hasId ? 'id' : 'name', gridItems[0])];
|
1585
|
-
this.parent.setProperties({ selectedItems: firstItem }, true);
|
1586
|
-
this.selectRecords(firstItem);
|
1587
|
-
break;
|
1588
|
-
case 'moveUp':
|
1589
|
-
case 'moveDown':
|
1590
|
-
this.moveFunction(gridItems, e, selIndex);
|
1591
|
-
break;
|
1592
|
-
case 'end':
|
1593
|
-
lastItem = [getValue(this.parent.hasId ? 'id' : 'name', gridItems[gridLength - 1])];
|
1594
|
-
this.parent.setProperties({ selectedItems: lastItem }, true);
|
1595
|
-
this.selectRecords(lastItem);
|
1596
|
-
break;
|
1597
|
-
case 'back':
|
1598
|
-
this.parent.traverseBackward();
|
1599
|
-
break;
|
1600
|
-
}
|
1601
|
-
}
|
1602
|
-
|
1603
|
-
public gridSelectNodes(): Object[] {
|
1604
|
-
return this.gridObj.getSelectedRecords();
|
1605
|
-
}
|
1606
|
-
|
1607
|
-
private doDownload(): void {
|
1608
|
-
if (this.parent.selectedItems.length !== 0) {
|
1609
|
-
this.parent.itemData = this.gridObj.getSelectedRecords();
|
1610
|
-
const items: Object[] = this.parent.itemData;
|
1611
|
-
for (let i: number = 0; i < items.length; i++) {
|
1612
|
-
if (!hasDownloadAccess(items[i as number])) {
|
1613
|
-
createDeniedDialog(this.parent, items[i as number], events.permissionDownload);
|
1614
|
-
return;
|
1615
|
-
}
|
1616
|
-
}
|
1617
|
-
Download(this.parent, this.parent.path, this.parent.selectedItems);
|
1618
|
-
}
|
1619
|
-
}
|
1620
|
-
|
1621
|
-
private performDelete(): void {
|
1622
|
-
if (this.parent.selectedItems && this.parent.selectedItems.length > 0) {
|
1623
|
-
this.parent.itemData = this.gridObj.getSelectedRecords();
|
1624
|
-
const items: Object[] = this.parent.itemData;
|
1625
|
-
for (let i: number = 0; i < items.length; i++) {
|
1626
|
-
if (!hasEditAccess(items[i as number])) {
|
1627
|
-
createDeniedDialog(this.parent, items[i as number], events.permissionEdit);
|
1628
|
-
return;
|
1629
|
-
}
|
1630
|
-
}
|
1631
|
-
createDialog(this.parent, 'Delete');
|
1632
|
-
}
|
1633
|
-
}
|
1634
|
-
|
1635
|
-
private performRename(): void {
|
1636
|
-
if (this.parent.selectedItems.length === 1) {
|
1637
|
-
this.updateRenameData();
|
1638
|
-
doRename(this.parent);
|
1639
|
-
}
|
1640
|
-
}
|
1641
|
-
|
1642
|
-
private updateRenameData(): void {
|
1643
|
-
const data: Object = this.gridSelectNodes()[0];
|
1644
|
-
updateRenamingData(this.parent, data);
|
1645
|
-
}
|
1646
|
-
|
1647
|
-
private shiftMoveMethod(gridItems: object[], selIndex: number, focIndex: number, selRowIndeces: number[], e: KeyboardEventArgs): void {
|
1648
|
-
if (!this.parent.allowMultiSelection) {
|
1649
|
-
this.moveFunction(gridItems, e, selIndex);
|
1650
|
-
} else {
|
1651
|
-
if (selIndex === -1 && (e.action === 'csUp' || e.action === 'csDown')) {
|
1652
|
-
this.ctrlMoveFunction(gridItems, e, selIndex);
|
1653
|
-
} else if (selIndex !== -1 && focIndex !== selIndex &&
|
1654
|
-
!((e.action === 'csUp' || e.action === 'csDown') && this.isSelected(selRowIndeces, focIndex))) {
|
1655
|
-
this.shiftSelectFocusItem(selIndex, focIndex, selRowIndeces, e);
|
1656
|
-
} else {
|
1657
|
-
this.shiftSelectedItem(selIndex, selRowIndeces, gridItems, e);
|
1658
|
-
}
|
1659
|
-
}
|
1660
|
-
}
|
1661
|
-
|
1662
|
-
private moveFunction(selectedItems: object[], e: KeyboardEventArgs, rowIndex: number): void {
|
1663
|
-
if (!isNOU(this.getFocusedItem()) && this.parent.allowMultiSelection) {
|
1664
|
-
if (e.action === 'moveDown') {
|
1665
|
-
this.gridObj.selectRow(this.getFocusedItemIndex() + 1);
|
1666
|
-
} else {
|
1667
|
-
this.gridObj.selectRow(this.getFocusedItemIndex() - 1);
|
1668
|
-
}
|
1669
|
-
} else if (!isNOU(rowIndex) && rowIndex !== -1) {
|
1670
|
-
if (e.action === 'moveDown' || e.action === 'ctrlDown' || e.action === 'shiftDown' || e.action === 'csDown') {
|
1671
|
-
this.gridObj.selectRow(rowIndex + ((rowIndex !== selectedItems.length - 1) ? 1 : 0));
|
1672
|
-
} else {
|
1673
|
-
this.gridObj.selectRow(rowIndex - ((rowIndex !== 0) ? 1 : 0));
|
1674
|
-
}
|
1675
|
-
} else {
|
1676
|
-
if (!isNOU(selectedItems[0])) {
|
1677
|
-
this.gridObj.selectRow(0);
|
1678
|
-
}
|
1679
|
-
}
|
1680
|
-
}
|
1681
|
-
|
1682
|
-
private spaceSelection(selRowIndeces: number[], focIndex: number, selIndex: number, e: KeyboardEventArgs): void {
|
1683
|
-
if (!this.isSelected(selRowIndeces, focIndex) && selIndex !== -1 && (e.action === 'shiftSpace' || e.action === 'csSpace')) {
|
1684
|
-
if (focIndex < selIndex) {
|
1685
|
-
this.gridObj.selectionModule.selectRowsByRange(focIndex, selIndex);
|
1686
|
-
} else {
|
1687
|
-
this.gridObj.selectionModule.selectRowsByRange(selIndex, focIndex);
|
1688
|
-
}
|
1689
|
-
} else if (!isNOU(this.getFocusedItem()) && focIndex !== selIndex) {
|
1690
|
-
selRowIndeces.push(this.getFocusedItemIndex());
|
1691
|
-
this.gridObj.selectRows(selRowIndeces);
|
1692
|
-
} else if (selIndex !== -1 && e.action === 'ctrlSpace' && this.parent.allowMultiSelection) {
|
1693
|
-
const lItem: number = selIndex;
|
1694
|
-
selRowIndeces.pop();
|
1695
|
-
this.gridObj.selectRows(selRowIndeces);
|
1696
|
-
this.addFocus(lItem);
|
1697
|
-
} else if (e.action === 'shiftSpace') {
|
1698
|
-
this.gridObj.selectRow(selIndex);
|
1699
|
-
}
|
1700
|
-
}
|
1701
|
-
|
1702
|
-
private ctrlMoveFunction(items: object[], e: KeyboardEventArgs, rowIndex: number): void {
|
1703
|
-
let nextItem: number;
|
1704
|
-
if (!isNOU(this.getFocusedItem())) {
|
1705
|
-
const nextIndex: number = this.getFocusedItemIndex();
|
1706
|
-
nextItem = (e.action === 'ctrlDown' || e.action === 'csDown') ?
|
1707
|
-
nextIndex + ((nextIndex < items.length - 1) ? 1 : 0) : nextIndex - ((nextIndex < 1) ? 0 : 1);
|
1708
|
-
} else if (!isNOU(rowIndex) && rowIndex !== -1) {
|
1709
|
-
nextItem = (e.action === 'ctrlDown' || e.action === 'csDown') ?
|
1710
|
-
rowIndex + ((rowIndex < items.length) ? 1 : 0) : rowIndex - ((rowIndex < 1) ? 0 : 1);
|
1711
|
-
} else {
|
1712
|
-
if (!isNOU(items[0])) {
|
1713
|
-
nextItem = 0;
|
1714
|
-
}
|
1715
|
-
}
|
1716
|
-
this.addFocus(nextItem);
|
1717
|
-
}
|
1718
|
-
|
1719
|
-
private checkRowsKey(items: object[], indexValue: number, focIndex: (null | number), e: KeyboardEventArgs): void {
|
1720
|
-
if (this.gridObj.checkAllRows === 'Uncheck' || this.gridObj.checkAllRows === 'Intermediate') {
|
1721
|
-
if (e.action !== 'csHome' && e.action !== 'csEnd') {
|
1722
|
-
if (isNOU(this.startIndex) && this.firstItemIndex !== indexValue) {
|
1723
|
-
this.firstItemIndex = indexValue;
|
1724
|
-
}
|
1725
|
-
if (e.action === 'shiftEnd') {
|
1726
|
-
this.gridObj.selectionModule.selectRowsByRange(this.firstItemIndex, items.length - 1);
|
1727
|
-
} else {
|
1728
|
-
this.gridObj.selectionModule.selectRowsByRange(0, this.firstItemIndex);
|
1729
|
-
}
|
1730
|
-
this.startIndex = indexValue;
|
1731
|
-
} else {
|
1732
|
-
if (e.action === 'csEnd') {
|
1733
|
-
this.gridObj.
|
1734
|
-
selectRows(this.InnerItems(isNOU(indexValue) ? 0 : indexValue, isNOU(focIndex) ? items.length - 1 : focIndex, e));
|
1735
|
-
} else {
|
1736
|
-
if (isNOU(indexValue)) {
|
1737
|
-
this.gridObj.selectRow(0);
|
1738
|
-
} else {
|
1739
|
-
this.gridObj.selectRows(this.InnerItems(isNOU(focIndex) ? 0 : focIndex, indexValue, e));
|
1740
|
-
}
|
1741
|
-
}
|
1742
|
-
}
|
1743
|
-
} else {
|
1744
|
-
this.gridObj.selectionModule.selectRow(((e.action === 'shiftHome' || e.action === 'csHome') ? 0 : items.length - 1));
|
1745
|
-
}
|
1746
|
-
}
|
1747
|
-
|
1748
|
-
private InnerItems(fItem: number, lItem: number, e: KeyboardEventArgs): number[] {
|
1749
|
-
const itemArr: number[] = this.gridObj.getSelectedRowIndexes();
|
1750
|
-
if (e.action === 'csEnd') {
|
1751
|
-
for (let i: number = fItem + 1; i <= lItem; i++) {
|
1752
|
-
itemArr.push(i);
|
1753
|
-
}
|
1754
|
-
} else {
|
1755
|
-
for (let i: number = lItem - 1; fItem <= i; i--) {
|
1756
|
-
itemArr.push(i);
|
1757
|
-
}
|
1758
|
-
}
|
1759
|
-
return itemArr;
|
1760
|
-
}
|
1761
|
-
|
1762
|
-
private shiftSelectFocusItem(selIndex: number, fIndex: number, selRowIndexes: number[], e: KeyboardEventArgs): void {
|
1763
|
-
const lItem: number = fIndex + ((e.action === 'shiftDown' || e.action === 'csDown') ? 1 : -1);
|
1764
|
-
const fItem: number = isNOU(this.startIndex) ? selIndex : selRowIndexes[0];
|
1765
|
-
if (fItem === lItem) {
|
1766
|
-
this.gridObj.selectRow(fItem);
|
1767
|
-
} else {
|
1768
|
-
if (fItem < lItem) {
|
1769
|
-
if (e.action === 'shiftDown' || e.action === 'csDown') {
|
1770
|
-
this.gridObj.selectionModule.selectRowsByRange(fItem, lItem);
|
1771
|
-
} else {
|
1772
|
-
this.gridObj.selectionModule.selectRowsByRange(lItem, fItem);
|
1773
|
-
}
|
1774
|
-
} else if (e.action === 'shiftDown' || e.action === 'csDown'){
|
1775
|
-
this.gridObj.selectionModule.selectRowsByRange(lItem, fItem);
|
1776
|
-
} else{
|
1777
|
-
this.gridObj.selectionModule.selectRowsByRange(fItem, lItem);
|
1778
|
-
}
|
1779
|
-
}
|
1780
|
-
this.startIndex = this.gridObj.selectedRowIndex;
|
1781
|
-
}
|
1782
|
-
|
1783
|
-
private addFocus(item: number | null): void {
|
1784
|
-
const fItem: Element = this.getFocusedItem();
|
1785
|
-
const itemElement: HTMLElement = <HTMLElement>this.gridObj.getRowByIndex(item);
|
1786
|
-
if (fItem) {
|
1787
|
-
fItem.removeAttribute('tabindex');
|
1788
|
-
removeClass([fItem], [CLS.FOCUS, CLS.FOCUSED]);
|
1789
|
-
}
|
1790
|
-
if (!isNOU(itemElement)) {
|
1791
|
-
this.gridObj.element.setAttribute('tabindex', '-1');
|
1792
|
-
itemElement.setAttribute('tabindex', '0');
|
1793
|
-
itemElement.focus();
|
1794
|
-
addClass([itemElement], [CLS.FOCUS, CLS.FOCUSED]);
|
1795
|
-
}
|
1796
|
-
}
|
1797
|
-
|
1798
|
-
private addHeaderFocus(e: KeyboardEventArgs) : void {
|
1799
|
-
const treeFocus: HTMLElement = select('.e-row', this.element);
|
1800
|
-
this.gridObj.element.setAttribute('tabindex', '-1');
|
1801
|
-
let nameFocus: Element;
|
1802
|
-
if (!isNOU(e.target as HTMLElement) && (e.target as HTMLElement).classList.contains('e-defaultcursor')) {
|
1803
|
-
this.addFocus(0);
|
1804
|
-
nameFocus = (e.target as HTMLElement).nextElementSibling;
|
1805
|
-
}
|
1806
|
-
else if (!isNOU(this.gridObj.element.querySelector('.e-focus')) && (this.gridObj.element.querySelector('.e-focus').tagName === 'TH')) {
|
1807
|
-
nameFocus = this.gridObj.element.querySelector('.e-focus').nextElementSibling;
|
1808
|
-
this.addFocus(0);
|
1809
|
-
}
|
1810
|
-
else {
|
1811
|
-
nameFocus = select('th.e-fe-grid-icon', this.element);
|
1812
|
-
}
|
1813
|
-
if (!isNOU(nameFocus)) {
|
1814
|
-
nameFocus.setAttribute('tabindex', '0');
|
1815
|
-
(nameFocus as HTMLElement).focus();
|
1816
|
-
addClass([nameFocus], [CLS.FOCUS, CLS.FOCUSED]);
|
1817
|
-
treeFocus.setAttribute('tabindex', '0');
|
1818
|
-
if (treeFocus.tabIndex === 0 && (nameFocus as HTMLElement).tabIndex === 0) {
|
1819
|
-
removeClass([treeFocus], [CLS.FOCUS, CLS.FOCUSED]);
|
1820
|
-
}
|
1821
|
-
}
|
1822
|
-
}
|
1823
|
-
|
1824
|
-
private getFocusedItem(): Element {
|
1825
|
-
return select('.' + CLS.FOCUSED, this.element);
|
1826
|
-
}
|
1827
|
-
|
1828
|
-
private isSelected(selRowIndexes: number[], focIndex: number): boolean {
|
1829
|
-
let check: boolean = false;
|
1830
|
-
for (let i: number = 0; i <= selRowIndexes.length - 1; i++) {
|
1831
|
-
if (selRowIndexes[i as number] === focIndex) {
|
1832
|
-
check = true;
|
1833
|
-
break;
|
1834
|
-
}
|
1835
|
-
}
|
1836
|
-
return check;
|
1837
|
-
}
|
1838
|
-
|
1839
|
-
private shiftSelectedItem(selIndex: number, selRowIndexes: number[], gridItems: object[], e: KeyboardEventArgs): void {
|
1840
|
-
if (selIndex === -1) {
|
1841
|
-
this.gridObj.selectRow(0);
|
1842
|
-
} else {
|
1843
|
-
if (isNOU(this.startIndex) && e.shiftKey) {
|
1844
|
-
this.startIndex = this.gridObj.selectedRowIndex;
|
1845
|
-
this.gridObj.selectRows([selIndex, (e.action === 'shiftDown' || e.action === 'csDown') ?
|
1846
|
-
(selIndex + ((selIndex !== gridItems.length - 1) ? 1 : 0)) : (selIndex - ((selIndex !== 0) ? 1 : 0))]);
|
1847
|
-
} else {
|
1848
|
-
if (e.action === 'shiftDown' || e.action === 'shiftUp') {
|
1849
|
-
if (e.action === 'shiftDown' && selRowIndexes.indexOf(selIndex + 1) === -1) {
|
1850
|
-
if (selIndex !== gridItems.length - 1) { selRowIndexes.push(selIndex + 1); }
|
1851
|
-
} else if (e.action === 'shiftUp' && selRowIndexes.indexOf(selIndex - 1) === -1) {
|
1852
|
-
if (selIndex !== 0) { selRowIndexes.push(selIndex - 1); }
|
1853
|
-
} else {
|
1854
|
-
selRowIndexes.pop();
|
1855
|
-
}
|
1856
|
-
this.gridObj.selectRows(selRowIndexes);
|
1857
|
-
} else {
|
1858
|
-
if (e.action === 'csDown') {
|
1859
|
-
if (!this.isSelected(selRowIndexes, this.getFocusedItemIndex() + 1)) {
|
1860
|
-
selRowIndexes.push((this.getFocusedItemIndex() + 1));
|
1861
|
-
this.gridObj.selectRows(selRowIndexes);
|
1862
|
-
} else {
|
1863
|
-
this.addFocus(this.getFocusedItemIndex() + 1);
|
1864
|
-
}
|
1865
|
-
} else if (!this.isSelected(selRowIndexes, this.getFocusedItemIndex() - 1)) {
|
1866
|
-
selRowIndexes.push((this.getFocusedItemIndex() - 1));
|
1867
|
-
this.gridObj.selectRows(selRowIndexes);
|
1868
|
-
} else {
|
1869
|
-
this.addFocus(this.getFocusedItemIndex() - 1);
|
1870
|
-
}
|
1871
|
-
}
|
1872
|
-
}
|
1873
|
-
}
|
1874
|
-
}
|
1875
|
-
|
1876
|
-
private onMethodCall(e: Object): void {
|
1877
|
-
if (this.parent.view !== 'Details') { return; }
|
1878
|
-
const action: string = getValue('action', e);
|
1879
|
-
switch (action) {
|
1880
|
-
case 'deleteFiles':
|
1881
|
-
this.deleteFiles(getValue('ids', e));
|
1882
|
-
break;
|
1883
|
-
case 'downloadFiles':
|
1884
|
-
this.downloadFiles(getValue('ids', e));
|
1885
|
-
break;
|
1886
|
-
case 'openFile':
|
1887
|
-
this.openFile(getValue('id', e));
|
1888
|
-
break;
|
1889
|
-
case 'createFolder':
|
1890
|
-
this.interaction = false;
|
1891
|
-
break;
|
1892
|
-
case 'renameFile':
|
1893
|
-
this.interaction = false;
|
1894
|
-
this.renameFile(getValue('id', e), getValue('newName', e));
|
1895
|
-
break;
|
1896
|
-
case 'selectAll':
|
1897
|
-
this.interaction = false;
|
1898
|
-
this.onSelectAllInit();
|
1899
|
-
break;
|
1900
|
-
case 'clearSelection':
|
1901
|
-
this.interaction = false;
|
1902
|
-
this.onClearAllInit();
|
1903
|
-
break;
|
1904
|
-
}
|
1905
|
-
}
|
1906
|
-
|
1907
|
-
private getRecords(nodes: string[]): Object[] {
|
1908
|
-
const gridRecords: Object[] = this.gridObj.getCurrentViewRecords();
|
1909
|
-
const records: Object[] = [];
|
1910
|
-
const hasFilter: boolean = (this.parent.breadcrumbbarModule.searchObj.element.value !== '' || this.parent.isFiltered) ? true : false;
|
1911
|
-
const filter: string = this.parent.hasId ? 'id' : 'name';
|
1912
|
-
if (this.parent.hasId || !hasFilter) {
|
1913
|
-
for (let i: number = 0, len: number = gridRecords.length; i < len; i++) {
|
1914
|
-
if (nodes.indexOf(getValue(filter, gridRecords[i as number])) !== -1) {
|
1915
|
-
records.push(gridRecords[i as number]);
|
1916
|
-
}
|
1917
|
-
}
|
1918
|
-
} else {
|
1919
|
-
for (let i: number = 0, len: number = gridRecords.length; i < len; i++) {
|
1920
|
-
const name: string = getValue('filterPath', gridRecords[i as number]) + getValue('name', gridRecords[i as number]);
|
1921
|
-
if (nodes.indexOf(name) !== -1) {
|
1922
|
-
records.push(gridRecords[i as number]);
|
1923
|
-
}
|
1924
|
-
}
|
1925
|
-
}
|
1926
|
-
return records;
|
1927
|
-
}
|
1928
|
-
|
1929
|
-
private deleteFiles(ids: string[]): void {
|
1930
|
-
this.parent.activeModule = 'detailsview';
|
1931
|
-
if (isNOU(ids)) {
|
1932
|
-
this.performDelete();
|
1933
|
-
return;
|
1934
|
-
}
|
1935
|
-
const records: Object[] = this.getRecords(ids);
|
1936
|
-
if (records.length === 0) { return; }
|
1937
|
-
const data: Object[] = [];
|
1938
|
-
const newIds: string[] = [];
|
1939
|
-
for (let i: number = 0; i < records.length; i++) {
|
1940
|
-
data[i as number] = records[i as number];
|
1941
|
-
newIds[i as number] = getItemName(this.parent, data[i as number]);
|
1942
|
-
}
|
1943
|
-
doDeleteFiles(this.parent, data, newIds);
|
1944
|
-
}
|
1945
|
-
|
1946
|
-
private downloadFiles(ids: string[]): void {
|
1947
|
-
if (isNOU(ids)) {
|
1948
|
-
this.doDownload();
|
1949
|
-
return;
|
1950
|
-
}
|
1951
|
-
const dRecords: Object[] = this.getRecords(ids);
|
1952
|
-
if (dRecords.length === 0) { return; }
|
1953
|
-
const data: Object[] = [];
|
1954
|
-
const newIds: string[] = [];
|
1955
|
-
for (let i: number = 0; i < dRecords.length; i++) {
|
1956
|
-
data[i as number] = dRecords[i as number];
|
1957
|
-
newIds[i as number] = getItemName(this.parent, data[i as number]);
|
1958
|
-
}
|
1959
|
-
doDownloadFiles(this.parent, data, newIds);
|
1960
|
-
}
|
1961
|
-
|
1962
|
-
private openFile(id: string): void {
|
1963
|
-
if (isNOU(id)) { return; }
|
1964
|
-
const records: Object[] = this.getRecords([id]);
|
1965
|
-
if (records.length > 0) {
|
1966
|
-
this.openContent(records[0]);
|
1967
|
-
}
|
1968
|
-
}
|
1969
|
-
|
1970
|
-
private renameFile(id: string, name: string): void {
|
1971
|
-
this.parent.activeModule = 'detailsview';
|
1972
|
-
if (isNOU(id)) {
|
1973
|
-
this.performRename();
|
1974
|
-
return;
|
1975
|
-
}
|
1976
|
-
const records: Object[] = this.getRecords([id]);
|
1977
|
-
if (records.length > 0) {
|
1978
|
-
updateRenamingData(this.parent, records[0]);
|
1979
|
-
if (!isNOU(name)) {
|
1980
|
-
if (hasEditAccess(this.parent.itemData[0])) {
|
1981
|
-
rename(this.parent, this.parent.path, name);
|
1982
|
-
} else {
|
1983
|
-
createDeniedDialog(this.parent, this.parent.itemData[0], events.permissionEdit);
|
1984
|
-
}
|
1985
|
-
} else {
|
1986
|
-
doRename(this.parent);
|
1987
|
-
}
|
1988
|
-
}
|
1989
|
-
}
|
1990
|
-
}
|