From 80b1a7538bca08da3628743fb038c6a377844a43 Mon Sep 17 00:00:00 2001 From: Melloware Date: Fri, 8 Jul 2022 07:32:43 -0400 Subject: [PATCH] Fix #2893: Update imperativeHandle as it blocks access to ref (#3043) --- components/lib/autocomplete/AutoComplete.js | 3 ++- components/lib/blockui/BlockUI.js | 3 ++- components/lib/calendar/Calendar.js | 3 ++- components/lib/captcha/Captcha.js | 3 ++- components/lib/chart/Chart.js | 3 ++- components/lib/confirmdialog/ConfirmDialog.js | 3 ++- components/lib/confirmpopup/ConfirmPopup.js | 3 ++- components/lib/contextmenu/ContextMenu.js | 3 ++- components/lib/datascroller/DataScroller.js | 3 ++- components/lib/datatable/DataTable.js | 3 ++- components/lib/dialog/Dialog.js | 3 ++- components/lib/editor/Editor.js | 3 ++- components/lib/fileupload/FileUpload.js | 3 ++- components/lib/galleria/Galleria.js | 3 ++- components/lib/gmap/GMap.js | 3 ++- components/lib/inputnumber/InputNumber.js | 3 ++- components/lib/menu/Menu.js | 3 ++- components/lib/menubar/Menubar.js | 3 ++- components/lib/messages/Messages.js | 3 ++- components/lib/overlaypanel/OverlayPanel.js | 3 ++- components/lib/radiobutton/RadioButton.js | 3 ++- components/lib/scrollpanel/ScrollPanel.js | 3 ++- components/lib/slidemenu/SlideMenu.js | 3 ++- components/lib/speeddial/SpeedDial.js | 3 ++- components/lib/splitbutton/SplitButton.js | 3 ++- components/lib/tabview/TabView.js | 3 ++- components/lib/tieredmenu/TieredMenu.js | 3 ++- components/lib/toast/Toast.js | 3 ++- components/lib/tooltip/Tooltip.js | 3 ++- components/lib/tree/Tree.js | 3 ++- components/lib/treetable/TreeTable.js | 3 ++- components/lib/virtualscroller/VirtualScroller.js | 3 ++- package-lock.json | 4 ++-- 33 files changed, 66 insertions(+), 34 deletions(-) diff --git a/components/lib/autocomplete/AutoComplete.js b/components/lib/autocomplete/AutoComplete.js index fadf1b6803..c64ce2feac 100644 --- a/components/lib/autocomplete/AutoComplete.js +++ b/components/lib/autocomplete/AutoComplete.js @@ -454,7 +454,8 @@ export const AutoComplete = React.memo(React.forwardRef((props, ref) => { }); React.useImperativeHandle(ref, () => ({ - search + search, + ...props })); const createSimpleAutoComplete = () => { diff --git a/components/lib/blockui/BlockUI.js b/components/lib/blockui/BlockUI.js index b8c49ad833..7a4d1c9bf4 100644 --- a/components/lib/blockui/BlockUI.js +++ b/components/lib/blockui/BlockUI.js @@ -64,7 +64,8 @@ export const BlockUI = React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ block, - unblock + unblock, + ...props })); const createMask = () => { diff --git a/components/lib/calendar/Calendar.js b/components/lib/calendar/Calendar.js index 0e03e7f785..bcf018d293 100644 --- a/components/lib/calendar/Calendar.js +++ b/components/lib/calendar/Calendar.js @@ -2484,7 +2484,8 @@ export const Calendar = React.memo(React.forwardRef((props, ref) => { hide, getCurrentDateTime, getViewDate, - updateViewDate + updateViewDate, + ...props })); const createBackwardNavigator = (isVisible) => { diff --git a/components/lib/captcha/Captcha.js b/components/lib/captcha/Captcha.js index b3a9876f05..2c337083cc 100644 --- a/components/lib/captcha/Captcha.js +++ b/components/lib/captcha/Captcha.js @@ -82,7 +82,8 @@ export const Captcha = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ reset, - getResponse + getResponse, + ...props })); const otherProps = ObjectUtils.findDiffKeys(props, Captcha.defaultProps); diff --git a/components/lib/chart/Chart.js b/components/lib/chart/Chart.js index c61cddd646..2e70448bf6 100644 --- a/components/lib/chart/Chart.js +++ b/components/lib/chart/Chart.js @@ -35,7 +35,8 @@ export const Chart = React.memo(React.forwardRef((props, ref) => { getChart: () => chartRef.current, getBase64Image: () => chartRef.current.toBase64Image(), generateLegend: () => chartRef.current && chartRef.current.generateLegend(), - refresh: () => chartRef.current && chartRef.current.update() + refresh: () => chartRef.current && chartRef.current.update(), + ...props })); React.useEffect(() => { diff --git a/components/lib/confirmdialog/ConfirmDialog.js b/components/lib/confirmdialog/ConfirmDialog.js index 1ea2ac4599..57aa2713a4 100644 --- a/components/lib/confirmdialog/ConfirmDialog.js +++ b/components/lib/confirmdialog/ConfirmDialog.js @@ -94,7 +94,8 @@ export const ConfirmDialog = React.memo(React.forwardRef((props, ref) => { }); React.useImperativeHandle(ref, () => ({ - confirm + confirm, + ...props })); const createFooter = () => { diff --git a/components/lib/confirmpopup/ConfirmPopup.js b/components/lib/confirmpopup/ConfirmPopup.js index 2fa8940e9a..0e81842caf 100644 --- a/components/lib/confirmpopup/ConfirmPopup.js +++ b/components/lib/confirmpopup/ConfirmPopup.js @@ -179,7 +179,8 @@ export const ConfirmPopup = React.memo(React.forwardRef((props, ref) => { }); React.useImperativeHandle(ref, () => ({ - confirm + confirm, + ...props })); const createContent = () => { diff --git a/components/lib/contextmenu/ContextMenu.js b/components/lib/contextmenu/ContextMenu.js index ef94d158ba..4275d6a1e0 100644 --- a/components/lib/contextmenu/ContextMenu.js +++ b/components/lib/contextmenu/ContextMenu.js @@ -165,7 +165,8 @@ export const ContextMenu = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ show, - hide + hide, + ...props })); const createContextMenu = () => { diff --git a/components/lib/datascroller/DataScroller.js b/components/lib/datascroller/DataScroller.js index 19b868b1ea..1fb68f3114 100644 --- a/components/lib/datascroller/DataScroller.js +++ b/components/lib/datascroller/DataScroller.js @@ -142,7 +142,8 @@ export const DataScroller = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ load, - reset + reset, + ...props })); const createHeader = () => { diff --git a/components/lib/datatable/DataTable.js b/components/lib/datatable/DataTable.js index 11c53fdbfb..9370bcfdac 100644 --- a/components/lib/datatable/DataTable.js +++ b/components/lib/datatable/DataTable.js @@ -1324,7 +1324,8 @@ export const DataTable = React.forwardRef((props, ref) => { resetColumnOrder, closeEditingCell, restoreTableState, - clearState + clearState, + ...props })); const createLoader = () => { diff --git a/components/lib/dialog/Dialog.js b/components/lib/dialog/Dialog.js index 2adcf2ae07..5daf7933d7 100644 --- a/components/lib/dialog/Dialog.js +++ b/components/lib/dialog/Dialog.js @@ -399,7 +399,8 @@ export const Dialog = React.forwardRef((props, ref) => { }); React.useImperativeHandle(ref, () => ({ - resetPosition + resetPosition, + ...props })); const createCloseIcon = () => { diff --git a/components/lib/editor/Editor.js b/components/lib/editor/Editor.js index f8ad8f9393..96c56c7e8d 100644 --- a/components/lib/editor/Editor.js +++ b/components/lib/editor/Editor.js @@ -86,7 +86,8 @@ export const Editor = React.memo(React.forwardRef((props, ref) => { }, [props.value]); React.useImperativeHandle(ref, () => ({ - getQuill + getQuill, + ...props })); const createToolbarHeader = () => { diff --git a/components/lib/fileupload/FileUpload.js b/components/lib/fileupload/FileUpload.js index 8e5084dce4..85e2772765 100644 --- a/components/lib/fileupload/FileUpload.js +++ b/components/lib/fileupload/FileUpload.js @@ -315,7 +315,8 @@ export const FileUpload = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ upload, clear, - formatSize + formatSize, + ...props })); const createChooseButton = () => { diff --git a/components/lib/galleria/Galleria.js b/components/lib/galleria/Galleria.js index 979a601fad..9725328b97 100644 --- a/components/lib/galleria/Galleria.js +++ b/components/lib/galleria/Galleria.js @@ -106,7 +106,8 @@ export const Galleria = React.memo(React.forwardRef((props, ref) => { hide, isAutoPlayActive, startSlideShow, - stopSlideShow + stopSlideShow, + ...props })); const createHeader = () => { diff --git a/components/lib/gmap/GMap.js b/components/lib/gmap/GMap.js index 9bcfbd1895..0fa25f6411 100644 --- a/components/lib/gmap/GMap.js +++ b/components/lib/gmap/GMap.js @@ -111,7 +111,8 @@ export const GMap = React.memo(React.forwardRef((props, ref) => { }); React.useImperativeHandle(ref, () => ({ - getMap + getMap, + ...props })); const otherProps = ObjectUtils.findDiffKeys(props, GMap.defaultProps); diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index ba975b8ea7..d1b02b0d5f 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -934,7 +934,8 @@ export const InputNumber = React.memo(React.forwardRef((props, ref) => { } React.useImperativeHandle(ref, () => ({ - getFormatter + getFormatter, + ...props })); React.useEffect(() => { diff --git a/components/lib/menu/Menu.js b/components/lib/menu/Menu.js index 49755bba8b..e986fe0c69 100644 --- a/components/lib/menu/Menu.js +++ b/components/lib/menu/Menu.js @@ -124,7 +124,8 @@ export const Menu = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ toggle, show, - hide + hide, + ...props })); const createSubmenu = (submenu, index) => { diff --git a/components/lib/menubar/Menubar.js b/components/lib/menubar/Menubar.js index 7fe4c84156..9b237c6d67 100644 --- a/components/lib/menubar/Menubar.js +++ b/components/lib/menubar/Menubar.js @@ -49,7 +49,8 @@ export const Menubar = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ toggle, - useCustomContent + useCustomContent, + ...props })); const createStartContent = () => { diff --git a/components/lib/messages/Messages.js b/components/lib/messages/Messages.js index d0e0a567b0..f1cbec846e 100644 --- a/components/lib/messages/Messages.js +++ b/components/lib/messages/Messages.js @@ -45,7 +45,8 @@ export const Messages = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ show, replace, - clear + clear, + ...props })); const otherProps = ObjectUtils.findDiffKeys(props, Messages.defaultProps); diff --git a/components/lib/overlaypanel/OverlayPanel.js b/components/lib/overlaypanel/OverlayPanel.js index 4bb0e9ecf9..cc23328023 100644 --- a/components/lib/overlaypanel/OverlayPanel.js +++ b/components/lib/overlaypanel/OverlayPanel.js @@ -176,7 +176,8 @@ export const OverlayPanel = React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ toggle, show, - hide + hide, + ...props })); const createCloseIcon = () => { diff --git a/components/lib/radiobutton/RadioButton.js b/components/lib/radiobutton/RadioButton.js index 9d387118da..9e821d9976 100644 --- a/components/lib/radiobutton/RadioButton.js +++ b/components/lib/radiobutton/RadioButton.js @@ -52,7 +52,8 @@ export const RadioButton = React.memo(React.forwardRef((props, ref) => { }, [inputRef, props.inputRef]); React.useImperativeHandle(ref, () => ({ - select + select, + ...props })); const hasTooltip = ObjectUtils.isNotEmpty(props.tooltip); diff --git a/components/lib/scrollpanel/ScrollPanel.js b/components/lib/scrollpanel/ScrollPanel.js index 7bb8ca3dcf..b4e4458080 100644 --- a/components/lib/scrollpanel/ScrollPanel.js +++ b/components/lib/scrollpanel/ScrollPanel.js @@ -149,7 +149,8 @@ export const ScrollPanel = React.forwardRef((props, ref) => { }); React.useImperativeHandle(ref, () => ({ - refresh + refresh, + ...props })); const otherProps = ObjectUtils.findDiffKeys(props, ScrollPanel.defaultProps); diff --git a/components/lib/slidemenu/SlideMenu.js b/components/lib/slidemenu/SlideMenu.js index d273a75783..c263236ff0 100644 --- a/components/lib/slidemenu/SlideMenu.js +++ b/components/lib/slidemenu/SlideMenu.js @@ -88,7 +88,8 @@ export const SlideMenu = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ toggle, show, - hide + hide, + ...props })); const createBackward = () => { diff --git a/components/lib/speeddial/SpeedDial.js b/components/lib/speeddial/SpeedDial.js index 30e7fe3103..b326176885 100644 --- a/components/lib/speeddial/SpeedDial.js +++ b/components/lib/speeddial/SpeedDial.js @@ -147,7 +147,8 @@ export const SpeedDial = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ show, - hide + hide, + ...props })); const createItem = (item, index) => { diff --git a/components/lib/splitbutton/SplitButton.js b/components/lib/splitbutton/SplitButton.js index 963e5c1a82..bf716b157a 100644 --- a/components/lib/splitbutton/SplitButton.js +++ b/components/lib/splitbutton/SplitButton.js @@ -81,7 +81,8 @@ export const SplitButton = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ show, - hide + hide, + ...props })); const createItems = () => { diff --git a/components/lib/tabview/TabView.js b/components/lib/tabview/TabView.js index 98545f9c58..02329daab6 100644 --- a/components/lib/tabview/TabView.js +++ b/components/lib/tabview/TabView.js @@ -146,7 +146,8 @@ export const TabView = React.forwardRef((props, ref) => { }, [props.activeIndex]); React.useImperativeHandle(ref, () => ({ - reset + reset, + ...props })); const createTabHeader = (tab, index) => { diff --git a/components/lib/tieredmenu/TieredMenu.js b/components/lib/tieredmenu/TieredMenu.js index 1655c92136..c0bdd6ac65 100644 --- a/components/lib/tieredmenu/TieredMenu.js +++ b/components/lib/tieredmenu/TieredMenu.js @@ -73,7 +73,8 @@ export const TieredMenu = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ toggle, show, - hide + hide, + ...props })); const createElement = () => { diff --git a/components/lib/toast/Toast.js b/components/lib/toast/Toast.js index b0b1abb002..804ef44f73 100644 --- a/components/lib/toast/Toast.js +++ b/components/lib/toast/Toast.js @@ -68,7 +68,8 @@ export const Toast = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ show, replace, - clear + clear, + ...props })); const createElement = () => { diff --git a/components/lib/tooltip/Tooltip.js b/components/lib/tooltip/Tooltip.js index fab0888955..acf604ed1e 100644 --- a/components/lib/tooltip/Tooltip.js +++ b/components/lib/tooltip/Tooltip.js @@ -432,7 +432,8 @@ export const Tooltip = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ updateTargetEvents, loadTargetEvents, - unloadTargetEvents + unloadTargetEvents, + ...props })); const createElement = () => { diff --git a/components/lib/tree/Tree.js b/components/lib/tree/Tree.js index f1d042c7bc..ba1ced52f0 100644 --- a/components/lib/tree/Tree.js +++ b/components/lib/tree/Tree.js @@ -286,7 +286,8 @@ export const Tree = React.memo(React.forwardRef((props, ref) => { } React.useImperativeHandle(ref, () => ({ - filter + filter, + ...props })); const createRootChild = (node, index, last) => { diff --git a/components/lib/treetable/TreeTable.js b/components/lib/treetable/TreeTable.js index a629eac40c..0357a78d74 100644 --- a/components/lib/treetable/TreeTable.js +++ b/components/lib/treetable/TreeTable.js @@ -791,7 +791,8 @@ export const TreeTable = React.forwardRef((props, ref) => { } React.useImperativeHandle(ref, () => ({ - filter + filter, + ...props })); const createTableHeader = (columns, columnGroup) => { diff --git a/components/lib/virtualscroller/VirtualScroller.js b/components/lib/virtualscroller/VirtualScroller.js index 28d68f4b5d..6d6d0396d2 100644 --- a/components/lib/virtualscroller/VirtualScroller.js +++ b/components/lib/virtualscroller/VirtualScroller.js @@ -517,7 +517,8 @@ export const VirtualScroller = React.memo(React.forwardRef((props, ref) => { scrollTo, scrollToIndex, scrollInView, - getRenderedRange + getRenderedRange, + ...props })); const createLoaderItem = (index, extOptions = {}) => { diff --git a/package-lock.json b/package-lock.json index 272653a0a5..5fcad8cd06 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "primereact", - "version": "8.2.0-SNAPSHOT", + "version": "9.0.0-SNAPSHOT", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "primereact", - "version": "8.2.0-SNAPSHOT", + "version": "9.0.0-SNAPSHOT", "dependencies": { "chart.js": "3.3.2", "file-saver": "2.0.5",