@syncfusion/ej2-filemanager 20.1.52-10460 → 20.1.52-10461

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