new Flyout(options) → {Class}
Embeds an html flyout component to house off canvas content that overlays a container pain from either the right or the left.
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | The options for the flyout. Properties
|
- Since
- 1.0.5
- Source
The class instance.
- Type:
- Class
import Flyout from '@gravityforms/components/html/admin/modules/Flyout';
function Example() {
const flyoutInstance = new Flyout( {
id: 'example-flyout',
renderOnInit: false,
target: '#example-target',
targetPosition: 'beforeend',
theme: 'cosmos',
} );
// Some time later we can render it. This is only done if we set renderOnInit to false.
// If true it will render on initialization.
flyoutInstance.init();
}
Members
(static) closeFlyout
Closes the flyout and fires the onClose function that can be passed in. Can be used by external developers by firing the method on the instance. Also closes all instances if the event 'gform/flyout/close-all' is fired on the document.
- Since
- 1.0.5
- Source
(static) handleExpandable
Handles expanding the flyout on a trigger click if the option is enabled.
- Since
- 1.0.5
- Source
(static) handleKeyEvents
Handles accessibility focus looping on the flyout using the focusLoop util.
- Since
- 1.0.5
- Source
(static) handleResize
Handle window resize events for the flyout
- Since
- 1.0.5
- Source
(static) handleTriggerClick
Handles opening/closing the flyout on a trigger click.
- Since
- 1.0.5
- Source
(static) maybeCloseFlyout
Closes all instances except the one that gets passed the activeId when the event 'gform/flyout/close' is fired on the document.
- Since
- 1.0.5
- Source
Methods
(static) bindEvents() → {void}
Bind events to the component.
- Since
- 1.0.5
- Source
- Type:
- void
(static) expandFlyout() → {void}
Expands the flyout to the defined expandableWidth while removing the max-width setting.
- Since
- 1.0.5
- Source
- Type:
- void
(static) flyoutTemplate(options) → {string}
The template function that returns html for the flyout. Options below are passed from constructor and described there.
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | The options for the flyout. Properties
|
- Since
- 1.0.5
- Source
- Type:
- string
import { flyoutTemplate } from '@gravityforms/components/html/admin/modules/Flyout';
function Example() {
const flyoutTemplateHTML = flyoutTemplateTemplate( options );
document.body.insertAdjacentHTML( 'beforeend', flyoutTemplateHTML );
}
(static) init() → {void}
Initialize the component.
- Since
- 1.0.5
- Source
- Type:
- void
(static) render() → {void}
Renders the component into the dom.
- Since
- 1.0.5
- Source
- Type:
- void
(static) showFlyout() → {void}
Opens the flyout and fires the onOpen function that can be passed in.
- Since
- 1.0.5
- Source
- Type:
- void
(static) shrinkFlyout() → {void}
Returns the flyout to its natural width. The complexity comes from handling a mix of max-width (which doesn't animate) and % widths for responsive.
- Since
- 1.0.5
- Source
- Type:
- void
(static) storeElements() → {void}
Stores useful HTMLElements on the instance in the elements namespace after render.
- Since
- 1.0.5
- Source
- Type:
- void
(static) updateFlyoutWidth() → {void}
Hides the expander button if the flyout fills its available space.
- Since
- 1.0.5
- Source
- Type:
- void