Skip to content
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
14 changes: 8 additions & 6 deletions packages/devextreme/js/__internal/core/widget/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { extend } from '@js/core/utils/extend';
import { each } from '@js/core/utils/iterator';
import { isDefined, isPlainObject } from '@js/core/utils/type';
import { compare as compareVersions } from '@js/core/utils/version';
import type { DxEvent } from '@js/events';
import { focusable as focusableSelector } from '@js/ui/widget/selectors';
import type { WidgetOptions } from '@js/ui/widget/ui.widget';

Expand Down Expand Up @@ -47,14 +48,14 @@ export interface Properties<TComponent = any> extends WidgetOptions<TComponent>
class Widget<
TProperties extends Properties = Properties,
> extends DOMComponent<Widget<TProperties>, TProperties> {
private readonly _feedbackHideTimeout = 400;
public _activeStateUnit!: string;

public _feedbackHideTimeout = 400;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should it be public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because _feedbackHideTimeout overrides inside the children


private readonly _feedbackShowTimeout = 30;

private _contentReadyAction?: ((event?: Record<string, unknown>) => void) | null;

private readonly _activeStateUnit!: string;

private _keyboardListenerId?: string | null;

private _isReady?: boolean;
Expand Down Expand Up @@ -265,8 +266,9 @@ class Widget<
return this._getActiveElement();
}

_isFocusTarget(element: Element): boolean {
_isFocusTarget(element: Element | undefined): boolean {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: we can use shorter form

Suggested change
_isFocusTarget(element: Element | undefined): boolean {
_isFocusTarget(element?: Element): boolean {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll consider in the further PRs

const focusTargets = $(this._focusTarget()).toArray();
// @ts-expect-error ts-error
return focusTargets.includes(element);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fix error instead of muting

Suggested change
return focusTargets.includes(element);
return !!element && focusTargets.includes(element);

Copy link
Contributor Author

@EugeniyKiyashko EugeniyKiyashko Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll consider in the further PRs

}

Expand Down Expand Up @@ -306,7 +308,7 @@ class Widget<
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
_focusInHandler(event): void {
_focusInHandler(event: DxEvent): void {
if (!event.isDefaultPrevented()) {
this._createActionByOption('onFocusIn', {
beforeExecute: () => this._updateFocusState(event, true),
Expand All @@ -316,7 +318,7 @@ class Widget<
}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
_focusOutHandler(event): void {
_focusOutHandler(event: DxEvent): void {
if (!event.isDefaultPrevented()) {
this._createActionByOption('onFocusOut', {
beforeExecute: () => this._updateFocusState(event, false),
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme/js/__internal/ui/calendar/m_calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ const SELECTION_STRATEGIES = {

// @ts-expect-error
const Calendar = Editor.inherit({
_activeStateUnit: `.${CALENDAR_CELL_CLASS}`,

_getDefaultOptions() {
return extend(this.callBase(), {

Expand Down Expand Up @@ -442,6 +440,8 @@ const Calendar = Editor.inherit({

_init() {
this.callBase();

this._activeStateUnit = `.${CALENDAR_CELL_CLASS}`;
this._initSelectionStrategy();
this._correctZoomLevel();
this._initCurrentDate();
Expand Down
5 changes: 3 additions & 2 deletions packages/devextreme/js/__internal/ui/collection/async.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import CollectionWidgetAsync from '@js/ui/collection/ui.collection_widget.async';
import type { CollectionWidgetOptions, ItemLike } from '@js/ui/collection/ui.collection_widget.base';
import type { ItemLike } from '@js/ui/collection/ui.collection_widget.base';
import type { CollectionWidgetBaseProperties } from '@ts/ui/collection/m_collection_widget.base';

import CollectionWidgetEdit from './edit';

declare class Async<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TProperties extends CollectionWidgetOptions<any, TItem, TKey>,
TProperties extends CollectionWidgetBaseProperties<any, TItem, TKey>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TItem extends ItemLike = any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
97 changes: 0 additions & 97 deletions packages/devextreme/js/__internal/ui/collection/base.ts

This file was deleted.

8 changes: 4 additions & 4 deletions packages/devextreme/js/__internal/ui/collection/edit.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { dxElementWrapper } from '@js/core/renderer';
import type { CollectionWidgetOptions, ItemLike } from '@js/ui/collection/ui.collection_widget.base';
import type { ItemLike } from '@js/ui/collection/ui.collection_widget.base';
import CollectionWidgetEdit from '@js/ui/collection/ui.collection_widget.edit';

import CollectionWidgetBase from './base';
import type { CollectionWidgetBaseProperties } from '@ts/ui/collection/m_collection_widget.base';
import CollectionWidgetBase from '@ts/ui/collection/m_collection_widget.base';

declare class Edit<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TProperties extends CollectionWidgetOptions<any, TItem, TKey>,
TProperties extends CollectionWidgetBaseProperties<any, TItem, TKey>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TItem extends ItemLike = any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { CollectionWidgetOptions, ItemLike } from '@js/ui/collection/ui.collection_widget.base';
import type { ItemLike } from '@js/ui/collection/ui.collection_widget.base';
import CollectionWidgetLiveUpdate from '@js/ui/collection/ui.collection_widget.live_update';
import type { CollectionWidgetBaseProperties } from '@ts/ui/collection/m_collection_widget.base';

import CollectionWidgetAsync from './async';

declare class LiveUpdate<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TProperties extends CollectionWidgetOptions<any, TItem, TKey>,
TProperties extends CollectionWidgetBaseProperties<any, TItem, TKey>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TItem extends ItemLike = any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
Loading
Loading