Studio API reference

table of contents

Studio
studio.initializeListeners ⇒ Array.<function()>
studio.readyListeners ⇒ Array.<function()>
studio.previewListeners ⇒ Array.<function()>
studio.templateEditorModeResolvers ⇒ Array.<function()>
studio.entityTreeIconResolvers ⇒ Array.<function()>
studio.entityTreeFilterItemResolvers ⇒ Array.<function()>
studio.locationResolver
studio.toolbarVisibilityResolver
studio.referencesLoader
studio.shouldOpenStartupPage
studio.api ⇒ *
studio.entitySets ⇒ Array.<Object>
studio.extensions ⇒ Object
studio.rootUrl ⇒ string
studio.TextEditor ⇒ TextEditor
studio.SplitPane ⇒ SplitPane
studio.Popover ⇒ Popover
studio.EntityTree ⇒ EntityTree
studio.EntityTreeButton ⇒ EntityTreeButton
studio.addEntitySet(entitySet)
studio.addToolbarComponent(toolbarComponent, position)
studio.addEntityTreeWrapperComponent(entityTreeWrapperComponent)
studio.addEntityTreeToolbarComponent(entityTreeToolbarComponent)
studio.addEntityTreeItemComponent(entityTreeItemComponent, position)
studio.addTabTitleComponent(key, component)
studio.addEditorComponent(key, component)
studio.addPropertiesComponent(string, component, shouldDisplay)
studio.setRequestHeader(key, value)
studio.addApiSpec(obj)
studio.setPreviewFrameSrc(frameSrc)
studio.openModal(componentOrText, options)
studio.preview()
studio.collapseLeftPane()
studio.openTab(tab)
studio.loadEntity(id, force) ⇒ Promise
studio.unloadEntity(id)
studio.addEntity(entity)
studio.updateEntity(entity)
studio.saveEntity(id) ⇒ Promise
studio.addExistingEntity(entity)
studio.replaceEntity(oldId, entity)
studio.removeEntity(id)
studio.startProgress()
studio.stopProgress()
studio.updateHistory()
studio.getSettings() ⇒ Array.<Object>
studio.setSetting(key, value)
studio.getSettingValueByKey(key, shouldThrow)
studio.getEntityByShortid(shortid, shouldThrow) ⇒ Object | null
studio.getActiveEntity() ⇒ Object
studio.getLastActiveTemplate() ⇒ Object | null
studio.getAllEntities() ⇒ Array.<Object>
studio.getReferences() ⇒ Array.<Object>
studio.resolveUrl(path) ⇒ String
studio.relativizeUrl(path) ⇒ String

Studio

Main facade and API for extensions. Exposed as global variable Studio. It can be also imported from jsreport-studio when using extensions default webpack configuration

Kind: global class
Access: public

studio.initializeListeners ⇒ Array.<function()>

Array of async functions invoked in sequence during initialization

Kind: instance property of Studio

studio.readyListeners ⇒ Array.<function()>

Array of async functions invoked in sequence after the app has been rendered

Kind: instance property of Studio

studio.previewListeners ⇒ Array.<function()>

Array of async functions invoked in sequence when preview process starts.

Kind: instance property of Studio

studio.templateEditorModeResolvers ⇒ Array.<function()>

Array of functions used to resolve ace editor mode for template content. This is used by custom templating engines to add highlighting support for pug, ejs...

Kind: instance property of Studio

studio.entityTreeIconResolvers ⇒ Array.<function()>

Array of functions used to resolve entity icon in entity tree, function accepts entity and returns string like fa-cog

Kind: instance property of Studio

studio.entityTreeFilterItemResolvers ⇒ Array.<function()>

Array of functions used to resolve filtering in entity tree, function accepts entity, entitySets and filter info, should return boolean to determine if item should be skipped or not

Kind: instance property of Studio

studio.locationResolver

Sets the function returning the browser url path (defaultCalculatedPath, currentEntity) => String

Kind: instance property of Studio

Param Type
fn function

studio.toolbarVisibilityResolver

Set the function retunring the visibility flag for particular toolbar button ('Save All') => return true

Kind: instance property of Studio

Param Type
fn function

studio.referencesLoader

Override the default entities references loading with custom function (entitySet) => Promise([array])

Kind: instance property of Studio

Param Type
fn function

studio.shouldOpenStartupPage

Optionally you can avoid displaying default startup page

Kind: instance property of Studio

Param Type
trueOrFalse Boolean

studio.api ⇒ *

Provides methods get,patch,post,del for accessing jsreport server

Kind: instance property of Studio
Example

await Studio.api.patch('/odata/tasks', { data: { foo: '1' } })

studio.entitySets ⇒ Array.<Object>

Get registered entity sets, each one is object { visibleName: 'foo', nameAttribute: 'name' }

Kind: instance property of Studio

studio.extensions ⇒ Object

Object[name] with registered extensions and its options

Kind: instance property of Studio

studio.rootUrl ⇒ string

absolute root url to the server, like http://localhost/reporting

Kind: instance property of Studio

studio.TextEditor ⇒ TextEditor

Ace editor React wrapper

Kind: instance property of Studio
Example

export default class DataEditor extends TextEditor { ... }

studio.SplitPane ⇒ SplitPane

Component used to split content with sliders

Kind: instance property of Studio

studio.Popover ⇒ Popover

Component used to show content in a popover

Kind: instance property of Studio

studio.EntityTree ⇒ EntityTree

Component used to visualise entities

Kind: instance property of Studio

studio.EntityTreeButton ⇒ EntityTreeButton

Component used to add actions in EntityTree toolbar

Kind: instance property of Studio

studio.addEntitySet(entitySet)

Add new entity set, which will be automatically loaded through OData and displayed in the entity tree

Kind: instance method of Studio

Param Type
entitySet Object

Example

Studio.addEntitySet({ name: 'data', visibleName: 'sample data' })

studio.addToolbarComponent(toolbarComponent, position)

Add React component which will be displayed in toolbar

Kind: instance method of Studio

Param Type Default Description
toolbarComponent ReactComponent | function
position String left left, right, settings or settingsBottom

studio.addEntityTreeWrapperComponent(entityTreeWrapperComponent)

Add React component which will be displayed as a wrapper/container for entity tree

Kind: instance method of Studio

Param Type Default Description
entityTreeWrapperComponent ReactComponent | function

studio.addEntityTreeToolbarComponent(entityTreeToolbarComponent)

Add React component which will be displayed in toolbar of entity tree

Kind: instance method of Studio

Param Type Default Description
entityTreeToolbarComponent ReactComponent | function

studio.addEntityTreeItemComponent(entityTreeItemComponent, position)

Add React component which will be displayed when rendering an item of entity tree

Kind: instance method of Studio

Param Type Default Description
entityTreeItemComponent ReactComponent | function
position String left right, groupRight or container

studio.addTabTitleComponent(key, component)

Add React component which will be used as tab title

Kind: instance method of Studio

Param Type Description
key String used in openTab
component ReactComponent | function

studio.addEditorComponent(key, component)

Add component used in tab as content editor

Kind: instance method of Studio

Param Type Description
key String key used in openTab({ editorComponentKey: ... , use entity set name if the editor should represent the main entity editor
component ReactComponent | function

studio.addPropertiesComponent(string, component, shouldDisplay)

Add component used in the left Properties secion

Kind: instance method of Studio

Param Type Description
string function | String or title function used to render the section title
component ReactComponent | function
shouldDisplay function

studio.setRequestHeader(key, value)

Set additional custom header to all api calls

Kind: instance method of Studio

Param Type
key String
value String

studio.addApiSpec(obj)

Merges in the object defining the api which is used in api fialog

Kind: instance method of Studio

Param Type
obj Object

studio.setPreviewFrameSrc(frameSrc)

Override the right preview pane with additional content setPreviewFrameSrc('data:text/html;charset=utf-8,foooooooo')

Kind: instance method of Studio

Param Type
frameSrc String

studio.openModal(componentOrText, options)

Opens modal dialog.

Kind: instance method of Studio

Param Type Description
componentOrText ReacrComponent | String
options Object passed as props to the react component

studio.preview()

Invoke preview process for last active template

Kind: instance method of Studio

studio.collapseLeftPane()

Collapse left pane

Kind: instance method of Studio

studio.openTab(tab)

Open and activate new editor tab

Kind: instance method of Studio

Param Type
tab Object

Example

//open entity editor
Studio.openTab({ _id: 'myentityid' })
//open custom page
Studio.openTab({ key: 'StartupPage', editorComponentKey: 'startup', title: 'Statup' })

studio.loadEntity(id, force) ⇒ Promise

Loads entity, which reference is already present in the ui state, from the remote API

Kind: instance method of Studio

Param Type Default
id String
force Boolean false

studio.unloadEntity(id)

Remove the additional entity properties from the state, keep just meta and id

Kind: instance method of Studio

Param Type
id String

studio.addEntity(entity)

Add entity to the state

Kind: instance method of Studio

Param Type
entity Object

studio.updateEntity(entity)

Update entity in the state

Kind: instance method of Studio

Param Type
entity Object

studio.saveEntity(id) ⇒ Promise

Call remote API and persist (insert or update) entity

Kind: instance method of Studio

Param Type
id String

studio.addExistingEntity(entity)

Adds already existing (persisted) entity into the UI state

Kind: instance method of Studio

Param
entity

studio.replaceEntity(oldId, entity)

Replace the existing entity in the state

Kind: instance method of Studio

Param Type
oldId String
entity Object

studio.removeEntity(id)

Remove entity from the state

Kind: instance method of Studio

Param Type
id String

studio.startProgress()

Show ui signalization for running background operation

Kind: instance method of Studio

studio.stopProgress()

Hide ui signalization for running background operation

Kind: instance method of Studio

studio.updateHistory()

Synchronize the location with history

Kind: instance method of Studio

studio.getSettings() ⇒ Array.<Object>

Get all settings from state

Kind: instance method of Studio

studio.setSetting(key, value)

Save one setting in state and persist it on the server

Kind: instance method of Studio

Param Type
key String
value Object

studio.getSettingValueByKey(key, shouldThrow)

Get one setting value from the state

Kind: instance method of Studio

Param Type Default
key String
shouldThrow Boolean true

studio.getEntityByShortid(shortid, shouldThrow) ⇒ Object | null

Searches for the entity in the UI state based on specified the shortid

Kind: instance method of Studio

Param Type Default
shortid String
shouldThrow Boolean true

studio.getActiveEntity() ⇒ Object

Returns the currently selected entity or null

Kind: instance method of Studio

studio.getLastActiveTemplate() ⇒ Object | null

Returns last active entity

Kind: instance method of Studio

studio.getAllEntities() ⇒ Array.<Object>

Get all entities including meta attributes in array

Kind: instance method of Studio

studio.getReferences() ⇒ Array.<Object>

Get references to entities

Kind: instance method of Studio

studio.resolveUrl(path) ⇒ String

Get the path in absolute form like /api/images and make it working also for jsreport running on subpath like myserver.com/reporting/api/images

Kind: instance method of Studio

Param Type
path String

studio.relativizeUrl(path) ⇒ String

This method is deprecated, use .resolveUrl

Get the path in absolute form like /api/images and make it working also for jsreport running on subpath like myserver.com/reporting/api/images

Kind: instance method of Studio

Param Type
path String

jsreport version