Skip to content

Commit

Permalink
Fix primefaces#3397: SlideMenu expose navigate methods (primefaces#3399)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Oct 1, 2022
1 parent 7a34f8d commit 9ad20e3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
16 changes: 13 additions & 3 deletions components/doc/slidemenu/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { memo } from 'react';
import Link from 'next/link';
import { TabView, TabPanel } from '../../lib/tabview/TabView';
import { useLiveEditorTabs } from '../common/liveeditor';
import React, { memo } from 'react';
import { TabPanel, TabView } from '../../lib/tabview/TabView';
import { CodeHighlight } from '../common/codehighlight';
import { DevelopmentSection } from '../common/developmentsection';
import { useLiveEditorTabs } from '../common/liveeditor';

const SlideMenuDoc = memo(() => {
const sources = {
Expand Down Expand Up @@ -962,6 +962,16 @@ const items = [
<td>event: Browser event</td>
<td>Hides the popup menu.</td>
</tr>
<tr>
<td>navigateForward</td>
<td>void</td>
<td>Navigates the slide menu forward.</td>
</tr>
<tr>
<td>navigateBack</td>
<td>void</td>
<td>Navigates the slide menu backwards.</td>
</tr>
</tbody>
</table>
</div>
Expand Down
24 changes: 13 additions & 11 deletions components/lib/slidemenu/SlideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export const SlideMenu = React.memo(
toggle,
show,
hide,
navigateForward,
navigateBack,
getElement: () => menuRef.current
}));

Expand Down Expand Up @@ -157,20 +159,20 @@ export const SlideMenu = React.memo(
SlideMenu.displayName = 'SlideMenu';
SlideMenu.defaultProps = {
__TYPE: 'SlideMenu',
id: null,
model: null,
popup: false,
style: null,
appendTo: null,
autoZIndex: true,
backLabel: 'Back',
baseZIndex: 0,
className: null,
easing: 'ease-out',
effectDuration: 250,
backLabel: 'Back',
id: null,
menuWidth: 190,
viewportHeight: 175,
autoZIndex: true,
baseZIndex: 0,
appendTo: null,
transitionOptions: null,
model: null,
onHide: null,
onShow: null,
onHide: null
popup: false,
style: null,
transitionOptions: null,
viewportHeight: 175
};
20 changes: 11 additions & 9 deletions components/lib/slidemenu/slidemenu.d.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
import * as React from 'react';
import { MenuItem } from '../menuitem';
import { CSSTransitionProps } from '../csstransition';
import { MenuItem } from '../menuitem';

type SlideMenuAppendToType = 'self' | HTMLElement | undefined | null;

export interface SlideMenuProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'ref'> {
model?: MenuItem[];
popup?: boolean;
appendTo?: SlideMenuAppendToType;
autoZIndex?: boolean;
backLabel?: string;
baseZIndex?: number;
children?: React.ReactNode;
easing?: string;
effectDuration?: number;
backLabel?: string;
menuWidth?: number;
viewportHeight?: number;
autoZIndex?: boolean;
baseZIndex?: number;
appendTo?: SlideMenuAppendToType;
model?: MenuItem[];
popup?: boolean;
transitionOptions?: CSSTransitionProps;
viewportHeight?: number;
onShow?(e: React.SyntheticEvent): void;
onHide?(e: React.SyntheticEvent): void;
children?: React.ReactNode;
}

export declare class SlideMenu extends React.Component<SlideMenuProps, any> {
public show(event: React.SyntheticEvent): void;
public hide(event: React.SyntheticEvent): void;
public toggle(event: React.SyntheticEvent): void;
public navigateForward(): void;
public navigateBack(): void;
public getElement(): HTMLDivElement;
}

0 comments on commit 9ad20e3

Please sign in to comment.