Skip to content

Commit 3b1ebe3

Browse files
List(Base, Edit), Resizable, Toolbar, ScrollView: convert into ES6 class (DevExpress#29225) (DevExpress#29245)
1 parent 169913a commit 3b1ebe3

25 files changed

+1439
-1142
lines changed

packages/devextreme/js/__internal/ui/collection/collection_widget.base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export interface CollectionWidgetBaseProperties<
109109

110110
encodeNoDataText?: boolean;
111111

112-
_itemAttributes?: Record<string, string>;
112+
_itemAttributes?: Record<string, unknown>;
113113

114114
selectOnFocus?: boolean;
115115
}

packages/devextreme/js/__internal/ui/collection/m_collection_widget.edit.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { SingleMultipleOrNone } from '@js/common';
1+
import type { SingleMultipleAllOrNone, SingleMultipleOrNone } from '@js/common';
22
import type { ItemInfo } from '@js/common/core/events';
33
import eventsEngine from '@js/common/core/events/core/events_engine';
44
import { DataSource } from '@js/common/data/data_source/data_source';
@@ -28,6 +28,7 @@ import PlainEditStrategy from '@ts/ui/collection/m_collection_widget.edit.strate
2828
import Selection from '@ts/ui/selection/m_selection';
2929

3030
import type MenuBaseEditStrategy from '../context_menu/m_menu_base.edit.strategy';
31+
import type GroupedEditStrategy from '../list/m_list.edit.strategy.grouped';
3132

3233
const ITEM_DELETING_DATA_KEY = 'dxItemDeleting';
3334
const NOT_EXISTING_INDEX = -1;
@@ -42,7 +43,7 @@ export interface CollectionWidgetEditProperties<
4243
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4344
TKey = any,
4445
> extends CollectionWidgetBaseProperties<TComponent, TItem, TKey> {
45-
selectionMode?: SingleMultipleOrNone;
46+
selectionMode?: SingleMultipleOrNone | SingleMultipleAllOrNone;
4647
}
4748

4849
class CollectionWidget<
@@ -57,7 +58,7 @@ class CollectionWidget<
5758

5859
_selection!: Selection;
5960

60-
_editStrategy!: PlainEditStrategy<this> | MenuBaseEditStrategy;
61+
_editStrategy!: PlainEditStrategy<this> | MenuBaseEditStrategy | GroupedEditStrategy;
6162

6263
_actions!: Record<string, (args: Record<string, unknown>) => void>;
6364

@@ -492,7 +493,7 @@ class CollectionWidget<
492493

493494
_itemSelectHandler(
494495
e: DxEvent,
495-
shouldIgnoreSelectByClick?: boolean,
496+
shouldIgnoreSelectByClick?: boolean | number,
496497
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
497498
): DeferredObj<unknown> | void {
498499
if (!shouldIgnoreSelectByClick && !this.option('selectByClick')) {
@@ -585,7 +586,7 @@ class CollectionWidget<
585586
}
586587

587588
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
588-
_updateSelection(addedSelection: unknown[], removedSelection: unknown[]): void {}
589+
_updateSelection(addedSelection?: unknown[], removedSelection?: unknown[]): void {}
589590

590591
_setAriaSelectionAttribute(
591592
$target: dxElementWrapper,

packages/devextreme/js/__internal/ui/list/m_item.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import $ from '@js/core/renderer';
2+
import type { Item } from '@js/ui/list';
23
import CollectionWidgetItem from '@ts/ui/collection/m_item';
34

45
const LIST_ITEM_BADGE_CONTAINER_CLASS = 'dx-list-item-badge-container';
@@ -8,17 +9,15 @@ const BADGE_CLASS = 'dx-badge';
89
const LIST_ITEM_CHEVRON_CONTAINER_CLASS = 'dx-list-item-chevron-container';
910
const LIST_ITEM_CHEVRON_CLASS = 'dx-list-item-chevron';
1011

11-
// @ts-expect-error
12-
const ListItem = CollectionWidgetItem.inherit({
13-
14-
_renderWatchers() {
15-
this.callBase();
12+
class ListItem extends CollectionWidgetItem<Item> {
13+
_renderWatchers(): void {
14+
super._renderWatchers();
1615

1716
this._startWatcher('badge', this._renderBadge.bind(this));
1817
this._startWatcher('showChevron', this._renderShowChevron.bind(this));
19-
},
18+
}
2019

21-
_renderBadge(badge) {
20+
_renderBadge(badge): void {
2221
this._$element.children(`.${LIST_ITEM_BADGE_CONTAINER_CLASS}`).remove();
2322

2423
if (!badge) {
@@ -34,9 +33,9 @@ const ListItem = CollectionWidgetItem.inherit({
3433

3534
const $chevron = this._$element.children(`.${LIST_ITEM_CHEVRON_CONTAINER_CLASS}`).first();
3635
$chevron.length > 0 ? $badge.insertBefore($chevron) : $badge.appendTo(this._$element);
37-
},
36+
}
3837

39-
_renderShowChevron(showChevron) {
38+
_renderShowChevron(showChevron): void {
4039
this._$element.children(`.${LIST_ITEM_CHEVRON_CONTAINER_CLASS}`).remove();
4140

4241
if (!showChevron) {
@@ -47,8 +46,7 @@ const ListItem = CollectionWidgetItem.inherit({
4746
const $chevron = $('<div>').addClass(LIST_ITEM_CHEVRON_CLASS);
4847

4948
$chevronContainer.append($chevron).appendTo(this._$element);
50-
},
51-
52-
});
49+
}
50+
}
5351

5452
export default ListItem;

0 commit comments

Comments
 (0)