|
1 | | -import $ from '../../core/renderer'; |
2 | | -import { extend } from '../../core/utils/extend'; |
3 | | - |
4 | | -import messageLocalization from '../../common/core/localization/message'; |
5 | | - |
6 | | -import ScrollView from '../scroll_view'; |
7 | | -import FileManagerDialogBase from './ui.file_manager.dialog'; |
| 1 | +/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ |
| 2 | +import messageLocalization from '@js/common/core/localization/message'; |
| 3 | +import type { dxElementWrapper } from '@js/core/renderer'; |
| 4 | +import $ from '@js/core/renderer'; |
| 5 | +import ScrollView from '@js/ui/scroll_view'; |
| 6 | +import type { DialogOptions } from '@ts/ui/file_manager/ui.file_manager.dialog'; |
| 7 | +import FileManagerDialogBase from '@ts/ui/file_manager/ui.file_manager.dialog'; |
8 | 8 |
|
9 | 9 | const FILE_MANAGER_DIALOG_DELETE_ITEM = 'dx-filemanager-dialog-delete-item'; |
10 | 10 | const FILE_MANAGER_DIALOG_DELETE_ITEM_POPUP = 'dx-filemanager-dialog-delete-item-popup'; // TODO ensure needed |
11 | 11 |
|
12 | 12 | class FileManagerDeleteItemDialog extends FileManagerDialogBase { |
| 13 | + _$text?: dxElementWrapper; |
13 | 14 |
|
14 | | - show({ itemName, itemCount }) { |
15 | | - const text = itemCount === 1 |
16 | | - ? messageLocalization.format('dxFileManager-dialogDeleteItemSingleItemConfirmation', itemName) |
17 | | - : messageLocalization.format('dxFileManager-dialogDeleteItemMultipleItemsConfirmation', itemCount); |
| 15 | + _initialText?: string; |
18 | 16 |
|
19 | | - if(this._$text) { |
20 | | - this._$text.text(text); |
21 | | - } else { |
22 | | - this._initialText = text; |
23 | | - } |
| 17 | + // @ts-expect-error ts-error |
| 18 | + show({ itemName, itemCount }): void { |
| 19 | + const text = itemCount === 1 |
| 20 | + ? messageLocalization.format( |
| 21 | + 'dxFileManager-dialogDeleteItemSingleItemConfirmation', |
| 22 | + // @ts-expect-error ts-error |
| 23 | + itemName, |
| 24 | + ) |
| 25 | + : messageLocalization.format( |
| 26 | + 'dxFileManager-dialogDeleteItemMultipleItemsConfirmation', |
| 27 | + // @ts-expect-error ts-error |
| 28 | + itemCount, |
| 29 | + ); |
24 | 30 |
|
25 | | - super.show(); |
| 31 | + if (this._$text) { |
| 32 | + this._$text.text(text); |
| 33 | + } else { |
| 34 | + this._initialText = text; |
26 | 35 | } |
27 | 36 |
|
28 | | - _getDialogOptions() { |
29 | | - return extend(super._getDialogOptions(), { |
30 | | - title: messageLocalization.format('dxFileManager-dialogDeleteItemTitle'), |
31 | | - buttonText: messageLocalization.format('dxFileManager-dialogDeleteItemButtonText'), |
32 | | - contentCssClass: FILE_MANAGER_DIALOG_DELETE_ITEM, |
33 | | - popupCssClass: FILE_MANAGER_DIALOG_DELETE_ITEM_POPUP, |
34 | | - height: 'auto', |
35 | | - maxHeight: '80vh' |
36 | | - }); |
37 | | - } |
| 37 | + super.show(); |
| 38 | + } |
38 | 39 |
|
39 | | - _createContentTemplate(element) { |
40 | | - super._createContentTemplate(element); |
| 40 | + _getDialogOptions(): DialogOptions { |
| 41 | + return { |
| 42 | + ...super._getDialogOptions(), |
| 43 | + title: messageLocalization.format('dxFileManager-dialogDeleteItemTitle'), |
| 44 | + buttonText: messageLocalization.format( |
| 45 | + 'dxFileManager-dialogDeleteItemButtonText', |
| 46 | + ), |
| 47 | + contentCssClass: FILE_MANAGER_DIALOG_DELETE_ITEM, |
| 48 | + popupCssClass: FILE_MANAGER_DIALOG_DELETE_ITEM_POPUP, |
| 49 | + height: 'auto', |
| 50 | + maxHeight: '80vh', |
| 51 | + }; |
| 52 | + } |
41 | 53 |
|
42 | | - this._$text = $('<div>') |
43 | | - .text(this._initialText) |
44 | | - .appendTo(this._$contentElement); |
| 54 | + _createContentTemplate(element: dxElementWrapper): void { |
| 55 | + super._createContentTemplate(element); |
45 | 56 |
|
46 | | - this._createComponent(this._$contentElement, ScrollView, { |
47 | | - width: '100%', |
48 | | - height: '100%' |
49 | | - }); |
50 | | - } |
| 57 | + this._$text = $('<div>') |
| 58 | + // @ts-expect-error ts-error |
| 59 | + .text(this._initialText) |
| 60 | + .appendTo(this._$contentElement); |
51 | 61 |
|
52 | | - _getDialogResult() { |
53 | | - return {}; |
54 | | - } |
| 62 | + this._createComponent(this._$contentElement, ScrollView, { |
| 63 | + width: '100%', |
| 64 | + height: '100%', |
| 65 | + }); |
| 66 | + } |
| 67 | + |
| 68 | + // @ts-expect-error ts-error |
| 69 | + // eslint-disable-next-line @typescript-eslint/explicit-function-return-type |
| 70 | + _getDialogResult() { |
| 71 | + return {}; |
| 72 | + } |
55 | 73 | } |
56 | 74 |
|
57 | 75 | export default FileManagerDeleteItemDialog; |
0 commit comments