-
Notifications
You must be signed in to change notification settings - Fork 667
List: Allow selection/highlighting of text in an item [QW] \ Implementation #32840
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
base: 26_1
Are you sure you want to change the base?
Changes from all commits
b019702
f1ae953
f6f41ab
2b2c1d6
f547ea3
b029181
5434c61
2f7a9a5
71aaf77
0c843c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -110,8 +110,6 @@ export interface ListBaseProperties extends Properties<Item>, Omit< | |||
|
|
||||
| _onItemsRendered?: () => void; | ||||
|
|
||||
| _swipeEnabled?: boolean; | ||||
|
|
||||
| showChevronExpr?: (data: Item) => boolean | undefined; | ||||
|
|
||||
| badgeExpr?: (data: Item) => string | undefined; | ||||
|
|
@@ -134,16 +132,12 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> { | |||
|
|
||||
| _$nextButton!: dxElementWrapper | null; | ||||
|
|
||||
| // eslint-disable-next-line no-restricted-globals | ||||
| _holdTimer?: ReturnType<typeof setTimeout>; | ||||
|
|
||||
| // eslint-disable-next-line no-restricted-globals | ||||
| _loadNextPageTimer?: ReturnType<typeof setTimeout>; | ||||
|
|
||||
| // eslint-disable-next-line no-restricted-globals | ||||
| _showLoadingIndicatorTimer?: ReturnType<typeof setTimeout>; | ||||
|
|
||||
| // eslint-disable-next-line no-restricted-globals | ||||
| _inkRippleTimer?: ReturnType<typeof setTimeout>; | ||||
|
|
||||
| _isFirstLoadCompleted?: boolean; | ||||
|
|
@@ -301,7 +295,6 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> { | |||
| _itemAttributes: { role: 'option' }, | ||||
| useInkRipple: false, | ||||
| wrapItemText: false, | ||||
| _swipeEnabled: true, | ||||
| showChevronExpr(data: Item): boolean | undefined { | ||||
| return data?.showChevron; | ||||
| }, | ||||
|
|
@@ -1074,26 +1067,23 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> { | |||
| _postprocessRenderItem(args: PostprocessRenderItemInfo<Item>): void { | ||||
| this._refreshItemElements(); | ||||
| super._postprocessRenderItem(args); | ||||
|
|
||||
| // eslint-disable-next-line @typescript-eslint/naming-convention | ||||
| const { _swipeEnabled } = this.option(); | ||||
|
|
||||
| if (_swipeEnabled) { | ||||
| this._attachSwipeEvent($(args.itemElement)); | ||||
| } | ||||
| this._updateSwipeEventSubscription($(args.itemElement)); | ||||
| } | ||||
|
|
||||
| _getElementClassToSkipRefreshId(): string { | ||||
| return LIST_GROUP_HEADER_CLASS; | ||||
| } | ||||
|
|
||||
| _attachSwipeEvent($itemElement: dxElementWrapper): void { | ||||
| _updateSwipeEventSubscription($itemElement: dxElementWrapper = this._itemElements()): void { | ||||
| // @ts-expect-error ts-error | ||||
| const endEventName = addNamespace(swipeEventEnd, this.NAME); | ||||
| eventsEngine.off($itemElement, endEventName); | ||||
|
|
||||
| eventsEngine.on($itemElement, endEventName, (e) => { | ||||
| this._itemSwipeEndHandler(e); | ||||
| }); | ||||
| if (this.hasActionSubscription('onItemSwipe')) { | ||||
| eventsEngine.on($itemElement, endEventName, (e) => { | ||||
| this._itemSwipeEndHandler(e); | ||||
| }); | ||||
| } | ||||
| } | ||||
|
|
||||
| _itemSwipeEndHandler(e: DxEvent & { offset: number }): void { | ||||
|
|
@@ -1102,6 +1092,29 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> { | |||
| }); | ||||
| } | ||||
|
|
||||
| on(eventName: string | { [key: string]: Function }, eventHandler?: Function): this { | ||||
| const result = super.on(eventName, eventHandler); | ||||
|
|
||||
| const hasItemSwipeHandler = eventName === 'itemSwipe' | ||||
| || (isPlainObject(eventName) && Object.prototype.hasOwnProperty.call(eventName, 'itemSwipe')); | ||||
|
|
||||
| if (hasItemSwipeHandler) { | ||||
| this._updateSwipeEventSubscription(); | ||||
| } | ||||
|
|
||||
| return result; | ||||
| } | ||||
|
|
||||
| off(eventName: string, eventHandler?: Function): this { | ||||
| const result = super.off(eventName, eventHandler); | ||||
|
|
||||
| if (eventName === 'itemSwipe') { | ||||
| this._updateSwipeEventSubscription(); | ||||
| } | ||||
|
|
||||
| return result; | ||||
| } | ||||
|
|
||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are there any tests that checks resubscriptions in existing tests?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we have test which checks DevExtreme/packages/devextreme/testing/tests/DevExpress.ui.widgets/listParts/commonTests.js Line 1164 in f6f41ab
|
||||
| _nextButtonHandler(): void { | ||||
| const pageLoadingArgs = { | ||||
| component: this as unknown as dxList, | ||||
|
|
@@ -1408,7 +1421,6 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> { | |||
| case 'badgeExpr': | ||||
| this._invalidate(); | ||||
| break; | ||||
| case '_swipeEnabled': | ||||
| case '_onItemsRendered': | ||||
| case 'selectByClick': | ||||
| break; | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.