Namespace: SwipeToRevealUtils

Oracle® JavaScript Extension Toolkit (JET)
7.1.0

F18183-01

QuickNav


PREVIEW: This is a preview API. Preview APIs are production quality, but can be changed on a major version without a deprecation path.

SwipeToRevealUtils

Version:
  • 7.1.0
Since:
  • 1.2.0
Module:
  • ojswipetoreveal

Module usage

See JET Module Loading for an overview of module usage within JET.

Javascript Import Format
define(['ojs/ojswipetoreveal'], function(SwipeToRevealUtils) {
 // Application should call API on SwipeToRevealUtils 
})
Typescript Import Format
//This namespace exports multiple static methods or members. To import 
import * as SwipeToRevealUtils from "ojswipetoreveal";

//Now you can access the methods as SwipeToRevealUtils.methodName and so on

JET In Typescript

A detailed description of working with JET elements and classes in your typescript project can be found at: JET Typescript Usage.

Description

This class provides functions for setting up and handling swipe to reveal on an offcanvas element. The offcanvas element contains contextual actions that users can perform on the element that user perform the swipe gesture on. This is most commonly found in ListView where user swipes on an item to reveal contextual actions that can be done on the item.

Styling

The following CSS classes can be applied by the page author as needed.

Class Description
oj-swipetoreveal-more Designed for use with an action item that shows more available actions that users can perform.

Is applied to the element that represents the more action item inside the offcanvas element.

oj-swipetoreveal-flag Designed for use with an action item that tags the associated item in the host like listview item.

Is applied to the element that represents the flag action item inside the offcanvas element.

oj-swipetoreveal-alert Designed for use with an action item that performs an explicit action like deleting the associated listview item.

Is applied to the element that represents the alert action item inside the offcanvas element.

oj-swipetoreveal-default Designed for use with an action item that should get all the space when user swipes pass the threshold distance.

Is applied to the element that represents the default action item inside the offcanvas element.

Touch End User Information

Target Gesture Action
Offcanvas wrapper element Swipe Reveals the offcanvas element. Depending on the distance relative to the target is swiped, the offcanvas will either be closed (swipe distance too short), opened, or the default action is performed (swipe distance passed the specified threshold).
Offcanvas wrapper element Pan Reveals the offcanvas element. If a default action is specified, the default action will get the entire space of the offcanvas after the user panned past a specified distance threshold.

Accessibility

Application must ensure that the context menu is available and setup with the equivalent menu items so that keyboard-only users can perform all the swipe actions just by using the keyboard.

Methods

(static) setupSwipeActions(elem, options) → {void}

Setup listeners needed for swipe actions capability.
Parameters:
Name Type Argument Description
elem Element the DOM element (of the offcanvas) that hosts the swipe actions
options Object <optional>
the options to set for swipe actions
Properties
Name Type Argument Description
threshold number <optional>
the threshold that triggers default action. If no default action is found (no item with style "oj-swipetoreveal-default") then this value is ignored. If percentage value is specified it will be calculated based on the width of the element with class "oj-offcanvas-outer-wrapper". A default value is determined if not specified. An "ojdefaultaction" event will be fired when threshold is exceed upon release.
See:
Returns:
Type
void

(static) tearDownSwipeActions(elem) → {void}

Removes the listener that was added in setupSwipeActions. Page authors should call tearDownSwipeActions when the content container is no longer needed.
Parameters:
Name Type Description
elem Element the DOM element (of the offcanvas) that hosts the swipe actions
See:
Returns:
Type
void