Skip to content
This repository was archived by the owner on Jun 28, 2026. It is now read-only.

Commit 9cc35cd

Browse files
committed
cleanup
1 parent eb6224f commit 9cc35cd

2 files changed

Lines changed: 4 additions & 30 deletions

File tree

components/lib/datatable/BodyCell.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { ChevronDownIcon } from '../icons/chevrondown';
88
import { ChevronRightIcon } from '../icons/chevronright';
99
import { PencilIcon } from '../icons/pencil';
1010
import { TimesIcon } from '../icons/times';
11-
import { OverlayService } from '../overlayservice/OverlayService';
1211
import { Ripple } from '../ripple/Ripple';
1312
import { DomHandler, IconUtils, ObjectUtils, classNames } from '../utils/Utils';
1413
import { RowCheckbox } from './RowCheckbox';
@@ -21,8 +20,6 @@ export const Cell = (props) => {
2120
const [styleObjectState, setStyleObjectState] = React.useState({});
2221
const elementRef = React.useRef(null);
2322
const keyHelperRef = React.useRef(null);
24-
const overlayEventListener = React.useRef(null);
25-
const selfClick = React.useRef(false);
2623
const focusTimeout = React.useRef(null);
2724
const initFocusTimeout = React.useRef(null);
2825
const editingRowDataStateRef = React.useRef(null);
@@ -58,9 +55,9 @@ export const Cell = (props) => {
5855
};
5956

6057
const isIgnoredElement = (element) => {
61-
const isCellEditor = (el) => el.getAttribute && el.getAttribute('data-pr-is-overlay');
58+
const isOverlay = (el) => el.getAttribute && el.getAttribute('data-pr-is-overlay');
6259

63-
return isCellEditor(element) || DomHandler.getParents(element).find((el) => isCellEditor(el));
60+
return isOverlay(element) || DomHandler.getParents(element).find((el) => isOverlay(el));
6461
};
6562

6663
const [bindDocumentClickListener, unbindDocumentClickListener] = useEventListener({
@@ -69,8 +66,6 @@ export const Cell = (props) => {
6966
if (!isIgnoredElement(e.target) && isOutsideClicked(e.target)) {
7067
switchCellToViewMode(e, true);
7168
}
72-
73-
selfClick.current = false;
7469
},
7570
options: true,
7671
when: isEditable()
@@ -121,9 +116,6 @@ export const Cell = (props) => {
121116
setTimeout(() => {
122117
setEditingState(false);
123118
unbindDocumentClickListener();
124-
OverlayService.off('overlay-click', overlayEventListener.current);
125-
overlayEventListener.current = null;
126-
selfClick.current = false;
127119
}, 1);
128120
};
129121

@@ -176,7 +168,7 @@ export const Cell = (props) => {
176168
};
177169

178170
const onClick = (event) => {
179-
props.onClick(event, getCellCallbackParams(event), isEditable(), editingState, setEditingState, selfClick, props.column, bindDocumentClickListener, overlayEventListener, isOutsideClicked);
171+
props.onClick(event, getCellCallbackParams(event), isEditable(), editingState, setEditingState, props.column, bindDocumentClickListener);
180172
};
181173

182174
const onMouseDown = (event) => {
@@ -277,8 +269,6 @@ export const Cell = (props) => {
277269
};
278270

279271
const onBlur = (event) => {
280-
selfClick.current = false;
281-
282272
if (props.editMode !== 'row' && editingState && getColumnProp('cellEditValidatorEvent') === 'blur') {
283273
switchCellToViewMode(event, true);
284274
}
@@ -364,11 +354,6 @@ export const Cell = (props) => {
364354
}, [editingState]);
365355

366356
useUnmountEffect(() => {
367-
if (overlayEventListener.current) {
368-
OverlayService.off('overlay-click', overlayEventListener.current);
369-
overlayEventListener.current = null;
370-
}
371-
372357
if (editingRowDataStateRef.current) {
373358
editingRowDataStateRef.current = null;
374359
}

components/lib/datatable/BodyRow.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ColumnBase } from '../column/ColumnBase';
33
import { useMergeProps } from '../hooks/Hooks';
44
import { classNames, DomHandler, ObjectUtils } from '../utils/Utils';
55
import { BodyCell, RadioCheckCell } from './BodyCell';
6-
import { OverlayService } from '../overlayservice/OverlayService';
76
import { Fragment } from 'react';
87

98
export const BodyRow = React.memo((props) => {
@@ -534,10 +533,8 @@ export const BodyRow = React.memo((props) => {
534533
}
535534
}, []);
536535

537-
const onCellClick = (event, params, isEditable, editingState, setEditingState, selfClick, column, bindDocumentClickListener, overlayEventListener, isOutsideClicked) => {
536+
const onCellClick = (event, params, isEditable, editingState, setEditingState, column, bindDocumentClickListener) => {
538537
if (props.editMode !== 'row' && isEditable && !editingState && (props.selectOnEdit || (!props.selectOnEdit && props.isRowSelected))) {
539-
selfClick.current = true;
540-
541538
const onBeforeCellEditShow = getColumnProp(column, 'onBeforeCellEditShow');
542539
const onCellEditInit = getColumnProp(column, 'onCellEditInit');
543540
const cellEditValidatorEvent = getColumnProp(column, 'cellEditValidatorEvent');
@@ -571,14 +568,6 @@ export const BodyRow = React.memo((props) => {
571568

572569
if (cellEditValidatorEvent === 'click') {
573570
bindDocumentClickListener();
574-
575-
overlayEventListener.current = (e) => {
576-
if (!isOutsideClicked(e.target)) {
577-
selfClick.current = true;
578-
}
579-
};
580-
581-
OverlayService.on('overlay-click', overlayEventListener.current);
582571
}
583572
}, 1);
584573
}

0 commit comments

Comments
 (0)