Skip to content

Sidepanel

Sidepanel — UI component for opening a side panel in the Аспро.Cloud platform interface

ts
import { Sidepanel } from '@aspro-cloud/miniapp-jssdk'

Constructor

Creates a Sidepanel instance with the given parameters

ts
constructor(params: SidepanelParams)
ParameterTypeDescription
paramsSidepanelParamsSide panel creation parameters

Properties

events

Object of type EventCallbacks<SidepanelEventName> with event handlers

ts
get events(): EventCallbacks
set events(value: EventCallbacks)

options

Side panel display options of type SidepanelOptions

ts
options: SidepanelOptions

title

Side panel title

ts
title: string

url

URL of the page to open

ts
url: string

Methods

destroy

Removes subscriptions and frees resources

ts
destroy(): void

hide

Closes the side panel programmatically

ts
async hide(): Promise<any>

show

Opens the side panel

ts
async show(): Promise<any>

show() method events:

EventParameterTypeDescription
'onShow'Side panel is shown
'onHide'Side panel is hidden
'onClose'Side panel is closed by user

Example

ts
import { App, Sidepanel } from '@aspro-cloud/miniapp-jssdk'

await App.initializeFrame()

const panel = new Sidepanel({
  title: 'User Profile',
  url: '/_module/company/view/member/433772?tab=contacts',
  options: {
    width: 'md'
  },
  events: {
    onShow: () => console.log('Side panel shown'),
    onHide: () => console.log('Side panel hidden'),
    onClose: () => console.log('Side panel closed by user')
  }
})

await panel.show()
js
const App = window.ACloudMiniApp;

await App.initializeFrame();

const panel = new App.Frame.Sidepanel({
  title: 'User Profile',
  url: '/_module/company/view/member/433772?tab=contacts',
  options: {
    width: 'md'
  },
  events: {
    onShow: () => console.log('Side panel shown'),
    onHide: () => console.log('Side panel hidden'),
    onClose: () => console.log('Side panel closed by user')
  }
});

await panel.show();

Published under the MIT license.