Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List, ListBase: move files to TS #27591

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable max-classes-per-file */
import '@js/ui/list/modules/search';
import '@js/ui/list/modules/selection';
import '@ts/ui/list/modules/m_search';
import '@ts/ui/list/modules/m_selection';

import $ from '@js/core/renderer';
import { extend } from '@js/core/utils/extend';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import $ from '@js/core/renderer';
import { FunctionTemplate } from '@js/core/templates/function_template';
import Button from '@js/ui/button';
import List from '@js/ui/list/ui.list.edit';
import { createPromise } from '@ts/core/utils/promise';
import List from '@ts/ui/list/m_list.edit';

const TOOLTIP_APPOINTMENT_ITEM = 'dx-tooltip-appointment-item';
const TOOLTIP_APPOINTMENT_ITEM_CONTENT = `${TOOLTIP_APPOINTMENT_ITEM}-content`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@js/ui/list/modules/selection';
import '@ts/ui/list/modules/m_selection';

import { ensureDefined, noop } from '@js/core/utils/common';
import dateSerialization from '@js/core/utils/date_serialization';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { addNamespace } from '@js/events/utils/index';
import messageLocalization from '@js/localization/message';
import DataExpressionMixin from '@js/ui/editor/ui.data_expression';
import List from '@js/ui/list_light';
import DataConverterMixin from '@js/ui/shared/grouped_data_converter_mixin';
import errors from '@js/ui/widget/ui.errors';
import DataConverterMixin from '@ts/ui/shared/m_grouped_data_converter_mixin';

import DropDownEditor from './m_drop_down_editor';

Expand Down
53 changes: 53 additions & 0 deletions packages/devextreme/js/__internal/ui/list/m_item.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import $ from '@js/core/renderer';
import CollectionWidgetItem from '@js/ui/collection/item';

const LIST_ITEM_BADGE_CONTAINER_CLASS = 'dx-list-item-badge-container';
const LIST_ITEM_BADGE_CLASS = 'dx-list-item-badge';
const BADGE_CLASS = 'dx-badge';

const LIST_ITEM_CHEVRON_CONTAINER_CLASS = 'dx-list-item-chevron-container';
const LIST_ITEM_CHEVRON_CLASS = 'dx-list-item-chevron';

const ListItem = CollectionWidgetItem.inherit({

_renderWatchers() {
this.callBase();

this._startWatcher('badge', this._renderBadge.bind(this));
this._startWatcher('showChevron', this._renderShowChevron.bind(this));
},

_renderBadge(badge) {
this._$element.children(`.${LIST_ITEM_BADGE_CONTAINER_CLASS}`).remove();

if (!badge) {
return;
}

const $badge = $('<div>')
.addClass(LIST_ITEM_BADGE_CONTAINER_CLASS)
.append($('<div>')
.addClass(LIST_ITEM_BADGE_CLASS)
.addClass(BADGE_CLASS)
.text(badge));

const $chevron = this._$element.children(`.${LIST_ITEM_CHEVRON_CONTAINER_CLASS}`).first();
$chevron.length > 0 ? $badge.insertBefore($chevron) : $badge.appendTo(this._$element);
},

_renderShowChevron(showChevron) {
this._$element.children(`.${LIST_ITEM_CHEVRON_CONTAINER_CLASS}`).remove();

if (!showChevron) {
return;
}

const $chevronContainer = $('<div>').addClass(LIST_ITEM_CHEVRON_CONTAINER_CLASS);
const $chevron = $('<div>').addClass(LIST_ITEM_CHEVRON_CLASS);

$chevronContainer.append($chevron).appendTo(this._$element);
},

});

export default ListItem;
Loading
Loading