|
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'; |
7 | 9 | import messageLocalization from '@js/common/core/localization/message'; |
@@ -63,22 +65,22 @@ const CUSTOM_EXPANDER_ICON_ITEM_CONTAINER_CLASS = `${WIDGET_CLASS}-custom-expand |
63 | 65 | const ITEM_WITHOUT_CHECKBOX_CLASS = `${ITEM_CLASS}-without-checkbox`; |
64 | 66 | const ITEM_DATA_KEY = `${ITEM_CLASS}-data`; |
65 | 67 |
|
66 | | -const TOGGLE_ITEM_VISIBILITY_CLASS = `${WIDGET_CLASS}-toggle-item-visibility`; |
| 68 | +export const TOGGLE_ITEM_VISIBILITY_CLASS = `${WIDGET_CLASS}-toggle-item-visibility`; |
67 | 69 | const CUSTOM_COLLAPSE_ICON_CLASS = `${WIDGET_CLASS}-custom-collapse-icon`; |
68 | 70 | const CUSTOM_EXPAND_ICON_CLASS = `${WIDGET_CLASS}-custom-expand-icon`; |
69 | 71 |
|
70 | 72 | const LOAD_INDICATOR_CLASS = `${WIDGET_CLASS}-loadindicator`; |
71 | 73 | const LOAD_INDICATOR_WRAPPER_CLASS = `${WIDGET_CLASS}-loadindicator-wrapper`; |
72 | 74 | const TOGGLE_ITEM_VISIBILITY_OPENED_CLASS = `${WIDGET_CLASS}-toggle-item-visibility-opened`; |
73 | | -const SELECT_ALL_ITEM_CLASS = `${WIDGET_CLASS}-select-all-item`; |
| 75 | +export const SELECT_ALL_ITEM_CLASS = `${WIDGET_CLASS}-select-all-item`; |
74 | 76 |
|
75 | 77 | const INVISIBLE_STATE_CLASS = 'dx-state-invisible'; |
76 | 78 | const DISABLED_STATE_CLASS = 'dx-state-disabled'; |
77 | 79 | const SELECTED_ITEM_CLASS = 'dx-state-selected'; |
78 | 80 | const EXPAND_EVENT_NAMESPACE = 'dxTreeView_expand'; |
79 | 81 | const DATA_ITEM_ID = 'data-item-id'; |
80 | 82 | const ITEM_URL_CLASS = 'dx-item-url'; |
81 | | -const CHECK_BOX_CLASS = 'dx-checkbox'; |
| 83 | +export const CHECK_BOX_CLASS = 'dx-checkbox'; |
82 | 84 | const CHECK_BOX_ICON_CLASS = 'dx-checkbox-icon'; |
83 | 85 | const ROOT_NODE_CLASS = `${WIDGET_CLASS}-root-node`; |
84 | 86 | export const EXPANDER_ICON_STUB_CLASS = `${WIDGET_CLASS}-expander-icon-stub`; |
@@ -1075,6 +1077,22 @@ class TreeViewBase extends HierarchicalCollectionWidget<TreeViewBaseProperties, |
1075 | 1077 | eventsEngine.off(itemsContainer, `.${EXPAND_EVENT_NAMESPACE}`, this._itemSelector()); |
1076 | 1078 | } |
1077 | 1079 |
|
| 1080 | + _detachHoldEvent(itemsContainer: dxElementWrapper): void { |
| 1081 | + const itemSelector = this._itemSelector(); |
| 1082 | + // @ts-expect-error ts-error |
| 1083 | + const eventName = addNamespace(holdEvent.name, this.NAME); |
| 1084 | + |
| 1085 | + eventsEngine.off(itemsContainer, eventName, itemSelector); |
| 1086 | + } |
| 1087 | + |
| 1088 | + _detachContextMenuEvent(itemsContainer: dxElementWrapper): void { |
| 1089 | + const itemSelector = this._itemSelector(); |
| 1090 | + // @ts-expect-error ts-error |
| 1091 | + const eventName = addNamespace(contextMenuEventName, this.NAME); |
| 1092 | + |
| 1093 | + eventsEngine.off(itemsContainer, eventName, itemSelector); |
| 1094 | + } |
| 1095 | + |
1078 | 1096 | _getEventNameByOption(name: TreeViewExpandEvent | undefined): string { |
1079 | 1097 | const event = name === 'click' ? clickEventName : dblclickEvent; |
1080 | 1098 | return addNamespace(event, EXPAND_EVENT_NAMESPACE); |
@@ -1817,7 +1835,10 @@ class TreeViewBase extends HierarchicalCollectionWidget<TreeViewBaseProperties, |
1817 | 1835 |
|
1818 | 1836 | _detachClickEvent(itemsContainer: dxElementWrapper): void { |
1819 | 1837 | const { |
1820 | | - clickEventNamespace, itemSelector, pointerDownEventNamespace, nodeSelector, |
| 1838 | + clickEventNamespace, |
| 1839 | + pointerDownEventNamespace, |
| 1840 | + nodeSelector, |
| 1841 | + itemSelector, |
1821 | 1842 | } = this._getItemClickEventData(); |
1822 | 1843 |
|
1823 | 1844 | eventsEngine.off(itemsContainer, clickEventNamespace, itemSelector); |
|
0 commit comments