Skip to content

Commit

Permalink
Fix primefaces#2893: Remove imperativeHandle as it blocks access to ref
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Jul 7, 2022
1 parent 23ad0fa commit 6b98461
Show file tree
Hide file tree
Showing 29 changed files with 0 additions and 154 deletions.
4 changes: 0 additions & 4 deletions components/lib/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,6 @@ export const AutoComplete = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(overlayRef.current);
});

React.useImperativeHandle(ref, () => ({
search
}));

const createSimpleAutoComplete = () => {
const value = formatValue(props.value);
const ariaControls = overlayVisibleState ? idState + '_list' : null;
Expand Down
5 changes: 0 additions & 5 deletions components/lib/blockui/BlockUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ export const BlockUI = React.forwardRef((props, ref) => {
ZIndexUtils.clear(maskRef.current);
});

React.useImperativeHandle(ref, () => ({
block,
unblock
}));

const createMask = () => {
if (visibleState) {
const appendTo = props.fullScreen ? document.body : 'self';
Expand Down
8 changes: 0 additions & 8 deletions components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2479,14 +2479,6 @@ export const Calendar = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(overlayRef.current);
});

React.useImperativeHandle(ref, () => ({
show,
hide,
getCurrentDateTime,
getViewDate,
updateViewDate
}));

const createBackwardNavigator = (isVisible) => {
const navigatorProps = isVisible ? { 'onClick': onPrevButtonClick, 'onKeyDown': e => onContainerButtonKeydown(e) } : { 'style': { visibility: 'hidden' } };
return (
Expand Down
5 changes: 0 additions & 5 deletions components/lib/captcha/Captcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ export const Captcha = React.memo(React.forwardRef((props, ref) => {
}
});

React.useImperativeHandle(ref, () => ({
reset,
getResponse
}));

const otherProps = ObjectUtils.findDiffKeys(props, Captcha.defaultProps);

return <div ref={elementRef} id={props.id} {...otherProps}></div>
Expand Down
4 changes: 0 additions & 4 deletions components/lib/confirmdialog/ConfirmDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ export const ConfirmDialog = React.memo(React.forwardRef((props, ref) => {
OverlayService.off('confirm-dialog', confirm);
});

React.useImperativeHandle(ref, () => ({
confirm
}));

const createFooter = () => {
const acceptClassName = classNames('p-confirm-dialog-accept', getPropValue('acceptClassName'));
const rejectClassName = classNames('p-confirm-dialog-reject', {
Expand Down
4 changes: 0 additions & 4 deletions components/lib/confirmpopup/ConfirmPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ export const ConfirmPopup = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(overlayRef.current);
});

React.useImperativeHandle(ref, () => ({
confirm
}));

const createContent = () => {
const currentProps = getCurrentProps();
const message = ObjectUtils.getJSXElement(getPropValue('message'), currentProps);
Expand Down
5 changes: 0 additions & 5 deletions components/lib/contextmenu/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,6 @@ export const ContextMenu = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(menuRef.current);
});

React.useImperativeHandle(ref, () => ({
show,
hide
}));

const createContextMenu = () => {
const otherProps = ObjectUtils.findDiffKeys(props, ContextMenu.defaultProps);
const className = classNames('p-contextmenu p-component', props.className);
Expand Down
5 changes: 0 additions & 5 deletions components/lib/datascroller/DataScroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ export const DataScroller = React.memo(React.forwardRef((props, ref) => {
}
});

React.useImperativeHandle(ref, () => ({
load,
reset
}));

const createHeader = () => {
if (props.header) {
return <div className="p-datascroller-header">{props.header}</div>
Expand Down
11 changes: 0 additions & 11 deletions components/lib/datatable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1316,17 +1316,6 @@ export const DataTable = React.forwardRef((props, ref) => {
destroyResponsiveStyle();
});

React.useImperativeHandle(ref, () => ({
reset,
resetScroll,
exportCSV,
filter,
resetColumnOrder,
closeEditingCell,
restoreTableState,
clearState
}));

const createLoader = () => {
if (props.loading) {
const iconClassName = classNames('p-datatable-loading-icon pi-spin', props.loadingIcon);
Expand Down
4 changes: 0 additions & 4 deletions components/lib/dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,6 @@ export const Dialog = React.forwardRef((props, ref) => {
ZIndexUtils.clear(maskRef.current);
});

React.useImperativeHandle(ref, () => ({
resetPosition
}));

const createCloseIcon = () => {
if (props.closable) {
return (
Expand Down
6 changes: 0 additions & 6 deletions components/lib/fileupload/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,6 @@ export const FileUpload = React.memo(React.forwardRef((props, ref) => {
!disabled && hasFiles ? upload() : fileInputRef.current.click();
}

React.useImperativeHandle(ref, () => ({
upload,
clear,
formatSize
}));

const createChooseButton = () => {
const { className, style, icon: _icon, iconOnly } = props.chooseOptions;
const chooseClassName = classNames('p-button p-fileupload-choose p-component', {
Expand Down
8 changes: 0 additions & 8 deletions components/lib/galleria/Galleria.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,6 @@ export const Galleria = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(maskRef.current);
});

React.useImperativeHandle(ref, () => ({
show,
hide,
isAutoPlayActive,
startSlideShow,
stopSlideShow
}));

const createHeader = () => {
if (props.header) {
return (
Expand Down
4 changes: 0 additions & 4 deletions components/lib/gmap/GMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ export const GMap = React.memo(React.forwardRef((props, ref) => {
}
});

React.useImperativeHandle(ref, () => ({
getMap
}));

const otherProps = ObjectUtils.findDiffKeys(props, GMap.defaultProps);

return <div ref={elementRef} style={props.style} className={props.className} {...otherProps}></div>
Expand Down
4 changes: 0 additions & 4 deletions components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,6 @@ export const InputNumber = React.memo(React.forwardRef((props, ref) => {
return numberFormat.current;
}

React.useImperativeHandle(ref, () => ({
getFormatter
}));

React.useEffect(() => {
ObjectUtils.combinedRefs(inputRef, props.inputRef);
}, [inputRef, props.inputRef]);
Expand Down
6 changes: 0 additions & 6 deletions components/lib/menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ export const Menu = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(menuRef.current);
});

React.useImperativeHandle(ref, () => ({
toggle,
show,
hide
}));

const createSubmenu = (submenu, index) => {
const key = submenu.label + '_' + index;
const className = classNames('p-submenu-header', {
Expand Down
5 changes: 0 additions & 5 deletions components/lib/menubar/Menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ export const Menubar = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(rootMenuRef.current);
});

React.useImperativeHandle(ref, () => ({
toggle,
useCustomContent
}));

const createStartContent = () => {
if (props.start) {
const start = ObjectUtils.getJSXElement(props.start, props);
Expand Down
6 changes: 0 additions & 6 deletions components/lib/messages/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ export const Messages = React.memo(React.forwardRef((props, ref) => {
props.onRemove && props.onRemove(message);
}

React.useImperativeHandle(ref, () => ({
show,
replace,
clear
}));

const otherProps = ObjectUtils.findDiffKeys(props, Messages.defaultProps);

return (
Expand Down
6 changes: 0 additions & 6 deletions components/lib/overlaypanel/OverlayPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,6 @@ export const OverlayPanel = React.forwardRef((props, ref) => {
ZIndexUtils.clear(overlayRef.current);
});

React.useImperativeHandle(ref, () => ({
toggle,
show,
hide
}));

const createCloseIcon = () => {
if (props.showCloseIcon) {
return (
Expand Down
4 changes: 0 additions & 4 deletions components/lib/radiobutton/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ export const RadioButton = React.memo(React.forwardRef((props, ref) => {
ObjectUtils.combinedRefs(inputRef, props.inputRef);
}, [inputRef, props.inputRef]);

React.useImperativeHandle(ref, () => ({
select
}));

const hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
const otherProps = ObjectUtils.findDiffKeys(props, RadioButton.defaultProps);
const className = classNames('p-radiobutton p-component', {
Expand Down
4 changes: 0 additions & 4 deletions components/lib/scrollpanel/ScrollPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ export const ScrollPanel = React.forwardRef((props, ref) => {
}
});

React.useImperativeHandle(ref, () => ({
refresh
}));

const otherProps = ObjectUtils.findDiffKeys(props, ScrollPanel.defaultProps);
const className = classNames('p-scrollpanel p-component', props.className);

Expand Down
6 changes: 0 additions & 6 deletions components/lib/slidemenu/SlideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ export const SlideMenu = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(menuRef.current);
});

React.useImperativeHandle(ref, () => ({
toggle,
show,
hide
}));

const createBackward = () => {
const className = classNames('p-slidemenu-backward', {
'p-hidden': levelState === 0
Expand Down
5 changes: 0 additions & 5 deletions components/lib/speeddial/SpeedDial.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ export const SpeedDial = React.memo(React.forwardRef((props, ref) => {
}
}, [visibleState]);

React.useImperativeHandle(ref, () => ({
show,
hide
}));

const createItem = (item, index) => {
const style = getItemStyle(index);
const { disabled, icon: _icon, label, template, url, target } = item;
Expand Down
5 changes: 0 additions & 5 deletions components/lib/splitbutton/SplitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ export const SplitButton = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(overlayRef.current);
});

React.useImperativeHandle(ref, () => ({
show,
hide
}));

const createItems = () => {
if (props.model) {
return props.model.map((menuitem, index) => {
Expand Down
4 changes: 0 additions & 4 deletions components/lib/tabview/TabView.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ export const TabView = React.forwardRef((props, ref) => {
updateScrollBar(props.activeIndex);
}, [props.activeIndex]);

React.useImperativeHandle(ref, () => ({
reset
}));

const createTabHeader = (tab, index) => {
const selected = isSelected(index);
const { headerStyle, headerClassName, style: _style, className: _className, disabled, leftIcon, rightIcon, header, headerTemplate, closable } = tab.props;
Expand Down
6 changes: 0 additions & 6 deletions components/lib/tieredmenu/TieredMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ export const TieredMenu = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(menuRef.current);
});

React.useImperativeHandle(ref, () => ({
toggle,
show,
hide
}));

const createElement = () => {
const otherProps = ObjectUtils.findDiffKeys(props, TieredMenu.defaultProps);
const className = classNames('p-tieredmenu p-component', {
Expand Down
6 changes: 0 additions & 6 deletions components/lib/toast/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ export const Toast = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(containerRef.current);
});

React.useImperativeHandle(ref, () => ({
show,
replace,
clear
}));

const createElement = () => {
const otherProps = ObjectUtils.findDiffKeys(props, Toast.defaultProps);
const className = classNames('p-toast p-component p-toast-' + props.position, props.className);
Expand Down
6 changes: 0 additions & 6 deletions components/lib/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,12 +429,6 @@ export const Tooltip = React.memo(React.forwardRef((props, ref) => {
ZIndexUtils.clear(elementRef.current);
});

React.useImperativeHandle(ref, () => ({
updateTargetEvents,
loadTargetEvents,
unloadTargetEvents
}));

const createElement = () => {
const otherProps = ObjectUtils.findDiffKeys(props, Tooltip.defaultProps);
const tooltipClassName = classNames('p-tooltip p-component', {
Expand Down
4 changes: 0 additions & 4 deletions components/lib/tree/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ export const Tree = React.memo(React.forwardRef((props, ref) => {
return matched;
}

React.useImperativeHandle(ref, () => ({
filter
}));

const createRootChild = (node, index, last) => {
return (
<UITreeNode key={node.key || node.label} node={node} index={index} last={last} path={String(index)} disabled={props.disabled} selectionMode={props.selectionMode}
Expand Down
4 changes: 0 additions & 4 deletions components/lib/treetable/TreeTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,6 @@ export const TreeTable = React.forwardRef((props, ref) => {
return data;
}

React.useImperativeHandle(ref, () => ({
filter
}));

const createTableHeader = (columns, columnGroup) => {
const sortField = getSortField();
const sortOrder = getSortOrder();
Expand Down

0 comments on commit 6b98461

Please sign in to comment.