Component
The Component class is the base class for all Digideck components. It provides access to a components base state, and behavior
Properties
id
Description
- Returns the components unique id.
Return Value: String
Code Example
let componentId = this.id;
parentEntityType
Description
- Returns the entity type of the parent element.
root-slide,slide, orchapter.
Return Value: String
Code Example
let entityType = this.parentEntityType;
parentEntityId
Description
- Returns the unique entity id of the parent element.
Return Value: String
Code Example
let entityType = this.parentEntityId;
isForegroundComponent
Description
- Returns a
trueorfalsevalue depending if the component is a foreground component.
Return Value: Boolean
Code Example
let isForegroundComponent = this.isForegroundComponent;
isBackgroundComponent
Description
- Returns a
trueorfalsevalue depending if the component is a Background Component.
Return Value: Boolean
Code Example
let isBackgroundComponent = this.isBackgroundComponent;
isDeckComponent
Description
- Returns a
trueorfalsevalue depending if the component is a Deck component. Deck Components are visible on every slide in the Deck or Presentation.
Return Value: Boolean
Code Example
let isDeckComponent = this.isDeckComponent;
isSlideComponent
Description
- Returns a
trueorfalsevalue depending if the component is a Slide component. Slide Components are only visible on the slide to which it was added.
Return Value: Boolean
Code Example
let isSlideComponent = this.isSlideComponent;
isRootSlideComponent
Description
- Returns a
trueorfalsevalue depending if the component is a Root Slide component.
Return Value: Boolean
Code Example
let isRootSlideComponent = this.isRootSlideComponent;
isChapterComponent
Description
- Returns a
trueorfalsevalue depending if the component is a Chapter component. Chapter components are visible on every slide in the chapter.
Return Value: Boolean
Code Example
let isChapterComponent = this.isChapterComponent;
positionType
Description
- Returns the positionType for the layout.
'grid','stack', or'anchor'. This is the setting for how components are positioned in the slide.
Return Value: String
Code Example
let positionType = this.positionType;
mobilePositionType
Description
- Returns the mobile position type for layout.
'grid','stack', or'anchor'.
Return Value: String
Code Example
let mobilePositionType = this.mobilePositionType;
defaultPositionType
Description
- Returns the default position type for desktop layout.
'grid','stack', or'anchor'.
Return Value: String
Code Example
let defaultPositionType = this.defaultPositionType;
isViewless
Description
- Returns true if component is set to viewless, meaning it does not have a visual front end and is only logic.
Return Value: Boolean
Code Example
let isViewless = this.isViewless;
isLockedInEditor
Description
- Returns true if component is locked in editor.
Return Value: Boolean
Code Example
let isLockedInEditor = this.isLockedInEditor;
isVisible
Description
- Returns true if component is visible. Meaning it is not hidden by visibility settings or slide is not in view.
Return Value: Boolean
Code Example
let isVisible = this.isVisible;
Methods
setComponentOption(attributeName, value)
Description
- Sets the attribute
attributeNamewith the valuevalueon the component node.
Return Value: null
Options:
attributeName: StringThe attribute name being set.value: StringThe value to which the attribute will be set.
Code Example
this.setComponentOption(attributeName, value);
setJsonComponentOption(attributeName, value)
Description
- Sets and encodes the attribute
attributeNamewith the valuevalueon the component node.
Return Value: null
Options:
attributeName: StringThe attribute name being set.value: ObjectThe value of which will be stringified and set as the attributes value.
Code Example
this.setJsonComponentOption(attributeName, value);
getComponentOptions()
Description
- Gets all the component attributes from the component node as key value pairs.
Return Value: Object
Code Example
this.componentOptions = this.getComponentOptions();
getStringComponentOption(attributeName)
Description
- Gets the component attribute's value cast as a string with
attributeNameargument.
Return Value: String
Options:
attributeName: StringThe attribute name used to get attribute value.
Code Example
this.componentOption = this.getStringComponentOption(attributeName);
this.getNumberComponentOption(attributeName)
Description
- Gets the component attribute's value cast as a number with
attributeNameargument.
Return Value: Number
Options:
attributeName: StringThe attribute name used to get attribute number value.
Code Example
this.componentOption = this.getNumberComponentOption(attributeName);
this.getBooleanComponentOption(attributeName, defaultValue)
Description
- Gets the component attribute's value cast as a boolean with
attributeNameargument. and returnsdefaultValueif no current value.
Return Value: Boolean
Options:
attributeName: StringThe attribute name used to get attribute number value.defaultValue: BooleanThe default value returned if no current value set.
Code Example
this.componentOption = this.getBooleanComponentOption(attributeName, false);
this.getJsonComponentOption(attributeName)
Description
- Gets the component attribute's value cast as an Object with
attributeNameargument.
Return Value: Object
Options:
attributeName: StringThe attribute name used to get the JSON attribute value.
Code Example
this.componentOption = this.getJsonComponentOption(attributeName);
this.setIsViewless(isViewless: Boolean)
Description
- Tells the Component Layout Editor app that the component is viewless and it should not select it visually in the digideck as there is no layout. See also: Config property: isViewless
Return Value: Object
Options:
attributeName: StringThe attribute name used to get the JSON attribute value.
Code Example
// in component-node-name.view.js
onInit() {
this.setIsViewless(true);
}