Skip to content

Commit

Permalink
Fix primefaces#2893: Update 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 02221bf
Show file tree
Hide file tree
Showing 34 changed files with 67 additions and 35 deletions.
3 changes: 2 additions & 1 deletion components/lib/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,8 @@ export const AutoComplete = React.memo(React.forwardRef((props, ref) => {
});

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

const createSimpleAutoComplete = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/blockui/BlockUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const BlockUI = React.forwardRef((props, ref) => {

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

const createMask = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2484,7 +2484,8 @@ export const Calendar = React.memo(React.forwardRef((props, ref) => {
hide,
getCurrentDateTime,
getViewDate,
updateViewDate
updateViewDate,
...ref
}));

const createBackwardNavigator = (isVisible) => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/captcha/Captcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export const Captcha = React.memo(React.forwardRef((props, ref) => {

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

const otherProps = ObjectUtils.findDiffKeys(props, Captcha.defaultProps);
Expand Down
3 changes: 2 additions & 1 deletion components/lib/chart/Chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
...ref
}));

React.useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/confirmdialog/ConfirmDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export const ConfirmDialog = React.memo(React.forwardRef((props, ref) => {
});

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

const createFooter = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/confirmpopup/ConfirmPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ export const ConfirmPopup = React.memo(React.forwardRef((props, ref) => {
});

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

const createContent = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/contextmenu/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ export const ContextMenu = React.memo(React.forwardRef((props, ref) => {

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

const createContextMenu = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/datascroller/DataScroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ export const DataScroller = React.memo(React.forwardRef((props, ref) => {

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

const createHeader = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/datatable/DataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,8 @@ export const DataTable = React.forwardRef((props, ref) => {
resetColumnOrder,
closeEditingCell,
restoreTableState,
clearState
clearState,
...ref
}));

const createLoader = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ export const Dialog = React.forwardRef((props, ref) => {
});

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

const createCloseIcon = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export const Editor = React.memo(React.forwardRef((props, ref) => {
}, [props.value]);

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

const createToolbarHeader = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/fileupload/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ export const FileUpload = React.memo(React.forwardRef((props, ref) => {
React.useImperativeHandle(ref, () => ({
upload,
clear,
formatSize
formatSize,
...ref
}));

const createChooseButton = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/galleria/Galleria.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ export const Galleria = React.memo(React.forwardRef((props, ref) => {
hide,
isAutoPlayActive,
startSlideShow,
stopSlideShow
stopSlideShow,
...ref
}));

const createHeader = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/gmap/GMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export const GMap = React.memo(React.forwardRef((props, ref) => {
});

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

const otherProps = ObjectUtils.findDiffKeys(props, GMap.defaultProps);
Expand Down
3 changes: 2 additions & 1 deletion components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,8 @@ export const InputNumber = React.memo(React.forwardRef((props, ref) => {
}

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

React.useEffect(() => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ export const Menu = React.memo(React.forwardRef((props, ref) => {
React.useImperativeHandle(ref, () => ({
toggle,
show,
hide
hide,
...ref
}));

const createSubmenu = (submenu, index) => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/menubar/Menubar.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export const Menubar = React.memo(React.forwardRef((props, ref) => {

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

const createStartContent = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/messages/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const Messages = React.memo(React.forwardRef((props, ref) => {
React.useImperativeHandle(ref, () => ({
show,
replace,
clear
clear,
...ref
}));

const otherProps = ObjectUtils.findDiffKeys(props, Messages.defaultProps);
Expand Down
3 changes: 2 additions & 1 deletion components/lib/overlaypanel/OverlayPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ export const OverlayPanel = React.forwardRef((props, ref) => {
React.useImperativeHandle(ref, () => ({
toggle,
show,
hide
hide,
...ref
}));

const createCloseIcon = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/radiobutton/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export const RadioButton = React.memo(React.forwardRef((props, ref) => {
}, [inputRef, props.inputRef]);

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

const hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
Expand Down
3 changes: 2 additions & 1 deletion components/lib/scrollpanel/ScrollPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ export const ScrollPanel = React.forwardRef((props, ref) => {
});

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

const otherProps = ObjectUtils.findDiffKeys(props, ScrollPanel.defaultProps);
Expand Down
3 changes: 2 additions & 1 deletion components/lib/slidemenu/SlideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export const SlideMenu = React.memo(React.forwardRef((props, ref) => {
React.useImperativeHandle(ref, () => ({
toggle,
show,
hide
hide,
...ref
}));

const createBackward = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/speeddial/SpeedDial.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ export const SpeedDial = React.memo(React.forwardRef((props, ref) => {

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

const createItem = (item, index) => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/splitbutton/SplitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export const SplitButton = React.memo(React.forwardRef((props, ref) => {

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

const createItems = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/tabview/TabView.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ export const TabView = React.forwardRef((props, ref) => {
}, [props.activeIndex]);

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

const createTabHeader = (tab, index) => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/tieredmenu/TieredMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ export const TieredMenu = React.memo(React.forwardRef((props, ref) => {
React.useImperativeHandle(ref, () => ({
toggle,
show,
hide
hide,
...ref
}));

const createElement = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/toast/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ export const Toast = React.memo(React.forwardRef((props, ref) => {
React.useImperativeHandle(ref, () => ({
show,
replace,
clear
clear,
...ref
}));

const createElement = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ export const Tooltip = React.memo(React.forwardRef((props, ref) => {
React.useImperativeHandle(ref, () => ({
updateTargetEvents,
loadTargetEvents,
unloadTargetEvents
unloadTargetEvents,
...ref
}));

const createElement = () => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/tree/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ export const Tree = React.memo(React.forwardRef((props, ref) => {
}

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

const createRootChild = (node, index, last) => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/treetable/TreeTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,8 @@ export const TreeTable = React.forwardRef((props, ref) => {
}

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

const createTableHeader = (columns, columnGroup) => {
Expand Down
3 changes: 2 additions & 1 deletion components/lib/virtualscroller/VirtualScroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,8 @@ export const VirtualScroller = React.memo(React.forwardRef((props, ref) => {
scrollTo,
scrollToIndex,
scrollInView,
getRenderedRange
getRenderedRange,
...ref
}));

const createLoaderItem = (index, extOptions = {}) => {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pages/datatable/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const DataTableExportDemo = () => {
import('jspdf').then((jsPDF) => {
import('jspdf-autotable').then(() => {
const doc = new jsPDF.default(0, 0);
doc.autoTable(exportColumns, products);
doc.autoTable(exportColumns, dt.current.value);
doc.save('products.pdf');
});
});
Expand Down

0 comments on commit 02221bf

Please sign in to comment.