|
1 | 1 | import { fx } from '@js/common/core/animation'; |
2 | 2 | import { name as clickEventName } from '@js/common/core/events/click'; |
| 3 | +import { name as contextMenuEventName } from '@js/common/core/events/contextmenu'; |
3 | 4 | import eventsEngine from '@js/common/core/events/core/events_engine'; |
4 | 5 | import { name as dblclickEvent } from '@js/common/core/events/double_click'; |
| 6 | +import holdEvent from '@js/common/core/events/hold'; |
5 | 7 | import pointerEvents from '@js/common/core/events/pointer'; |
6 | 8 | import { addNamespace } from '@js/common/core/events/utils/index'; |
7 | 9 | import messageLocalization from '@js/common/core/localization/message'; |
@@ -46,22 +48,22 @@ const CUSTOM_EXPANDER_ICON_ITEM_CONTAINER_CLASS = `${WIDGET_CLASS}-custom-expand |
46 | 48 | const ITEM_WITHOUT_CHECKBOX_CLASS = `${ITEM_CLASS}-without-checkbox`; |
47 | 49 | const ITEM_DATA_KEY = `${ITEM_CLASS}-data`; |
48 | 50 |
|
49 | | -const TOGGLE_ITEM_VISIBILITY_CLASS = `${WIDGET_CLASS}-toggle-item-visibility`; |
| 51 | +export const TOGGLE_ITEM_VISIBILITY_CLASS = `${WIDGET_CLASS}-toggle-item-visibility`; |
50 | 52 | const CUSTOM_COLLAPSE_ICON_CLASS = `${WIDGET_CLASS}-custom-collapse-icon`; |
51 | 53 | const CUSTOM_EXPAND_ICON_CLASS = `${WIDGET_CLASS}-custom-expand-icon`; |
52 | 54 |
|
53 | 55 | const LOAD_INDICATOR_CLASS = `${WIDGET_CLASS}-loadindicator`; |
54 | 56 | const LOAD_INDICATOR_WRAPPER_CLASS = `${WIDGET_CLASS}-loadindicator-wrapper`; |
55 | 57 | const TOGGLE_ITEM_VISIBILITY_OPENED_CLASS = `${WIDGET_CLASS}-toggle-item-visibility-opened`; |
56 | | -const SELECT_ALL_ITEM_CLASS = `${WIDGET_CLASS}-select-all-item`; |
| 58 | +export const SELECT_ALL_ITEM_CLASS = `${WIDGET_CLASS}-select-all-item`; |
57 | 59 |
|
58 | 60 | const INVISIBLE_STATE_CLASS = 'dx-state-invisible'; |
59 | 61 | const DISABLED_STATE_CLASS = 'dx-state-disabled'; |
60 | 62 | const SELECTED_ITEM_CLASS = 'dx-state-selected'; |
61 | 63 | const EXPAND_EVENT_NAMESPACE = 'dxTreeView_expand'; |
62 | 64 | const DATA_ITEM_ID = 'data-item-id'; |
63 | 65 | const ITEM_URL_CLASS = 'dx-item-url'; |
64 | | -const CHECK_BOX_CLASS = 'dx-checkbox'; |
| 66 | +export const CHECK_BOX_CLASS = 'dx-checkbox'; |
65 | 67 | const CHECK_BOX_ICON_CLASS = 'dx-checkbox-icon'; |
66 | 68 | const ROOT_NODE_CLASS = `${WIDGET_CLASS}-root-node`; |
67 | 69 | export const EXPANDER_ICON_STUB_CLASS = `${WIDGET_CLASS}-expander-icon-stub`; |
@@ -934,7 +936,23 @@ class TreeViewBase extends HierarchicalCollectionWidget<TreeViewBaseProperties> |
934 | 936 | eventsEngine.off(itemsContainer, `.${EXPAND_EVENT_NAMESPACE}`, this._itemSelector()); |
935 | 937 | } |
936 | 938 |
|
937 | | - _getEventNameByOption(name) { |
| 939 | + _detachHoldEvent(itemsContainer: dxElementWrapper): void { |
| 940 | + const itemSelector = this._itemSelector(); |
| 941 | + // @ts-expect-error ts-error |
| 942 | + const eventName = addNamespace(holdEvent.name, this.NAME); |
| 943 | + |
| 944 | + eventsEngine.off(itemsContainer, eventName, itemSelector); |
| 945 | + } |
| 946 | + |
| 947 | + _detachContextMenuEvent(itemsContainer: dxElementWrapper): void { |
| 948 | + const itemSelector = this._itemSelector(); |
| 949 | + // @ts-expect-error ts-error |
| 950 | + const eventName = addNamespace(contextMenuEventName, this.NAME); |
| 951 | + |
| 952 | + eventsEngine.off(itemsContainer, eventName, itemSelector); |
| 953 | + } |
| 954 | + |
| 955 | + _getEventNameByOption(name): string { |
938 | 956 | const event = name === 'click' ? clickEventName : dblclickEvent; |
939 | 957 | return addNamespace(event, EXPAND_EVENT_NAMESPACE); |
940 | 958 | } |
@@ -1570,7 +1588,10 @@ class TreeViewBase extends HierarchicalCollectionWidget<TreeViewBaseProperties> |
1570 | 1588 |
|
1571 | 1589 | _detachClickEvent(itemsContainer) { |
1572 | 1590 | const { |
1573 | | - clickEventNamespace, itemSelector, pointerDownEventNamespace, nodeSelector, |
| 1591 | + clickEventNamespace, |
| 1592 | + pointerDownEventNamespace, |
| 1593 | + nodeSelector, |
| 1594 | + itemSelector, |
1574 | 1595 | } = this._getItemClickEventData(); |
1575 | 1596 |
|
1576 | 1597 | eventsEngine.off(itemsContainer, clickEventNamespace, itemSelector); |
|
0 commit comments