Skip to content

Commit

Permalink
update va-report-components v2.6.0 doc and changelog (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
brmorr authored Jan 18, 2024
1 parent 7158a6d commit d8bddba
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sdk/va-report-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 2.6.0 (January 18, 2024)

### Added
- SAS Viya 2024.01 support (Report Package version 42)
- `readyState` property on `ObjectHandle`
- `readyStateChanged` event type on `ObjectHandle`
- `hideLoadImage` attribute on `sas-report-object`

## 2.5.0 (December 14, 2023)

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
id: version-2.6.0-ObjectHandle
title: ObjectHandle
original_id: ObjectHandle
---

An `ObjectHandle` is used to perform actions on a single object in an open
report. An object's handle can be obtained using the `getObjectHandle` method
on a [`ReportHandle`](ReportHandle.md).

When a report element is assigned new attribute values or removed from the DOM,
any `ObjectHandles` obtained from that element are invalidated and should be
discarded.

## Properties

### readyState: string
The ready state of the report object. When this value changes, a `readyStateChanged` event is fired on the ObjectHandle.

This value can be one of the following:
- `"contentLoading"` when the report object is still loading its content.
- `"complete"` when the report object has finished loading.
- `"error"` when the report object encountered an error and could not load.

## Methods

### exportData(format: string, options?: ExportDataOptions): Promise\<string>
Exports a file that contains the object's data, and returns a URL to the file.

`format` defines the format of the data output file.
Supported formats:
- `"XLSX"`
- `"CSV"`
- `"TSV"`

`options` is an [`ExportDataOptions`](ExportDataOptions.md) bundle that modifies properties of the exported data file.

If no `options` parameter is supplied, the data will be exported using the default option values.

### exportPDF(options?: ExportPDFOptions): Promise\<string>

Exports a PDF of the report object and returns a URL to the PDF document.

`options` is an [`ExportPDFOptions`](ExportPDFOptions.md) that controls the format of the exported PDF document. The option `includedReportObjects` does not apply when exporting a report object.

If no `options` parameter is supplied, the report is exported using the default options values.

### refreshData(): void

Refreshes the data for the report object that is controlled by the
`ObjectHandle`.

### getData(options?: Object): ReportObjectResultData[]

Returns all of the data from the report object. This data matches what appears in the report object, including any filters that have been applied.

#### Arguments

`options` is an optional options bundle for customizing the returned data. The following options are supported:

- `formatData` specifies the format of the returned data.
- `true` returns all formatted data.
- `false` returns all unformatted data.
- `"datesOnly"` `default` returns SAS date values as formatted data and returns all other values as unformatted data.

#### Return value

Returns an array of [`ReportObjectResultData`](ReportObjectResultData.md) objects, where each object is associated with one data set.

### getSelectedData(options?: Object): ReportObjectResultData[]

Returns a user's selection data from the report object. Returns an empty array if the object has no selections.

#### Arguments

`options` is an optional options bundle for customizing the returned data. The following options are supported:

- `formatData` specifies the format of the returned data.
- `true` returns all formatted data.
- `false` returns all unformatted data.
- `"datesOnly"` `default` returns SAS date values as formatted data and returns all other values as unformatted data.

#### Return value

Returns an array of [`ReportObjectResultData`](ReportObjectResultData.md) objects, where each object is associated with one data set.

For user selection data, the ReportObjectResultData property `columns` will never include values for `usage`, `aggregation`, or `format`.

### addEventListener(eventType: string, listener: (event: Object) => void)

Adds an event listener to the `ObjectHandle` to call the supplied listener when the specified event occurs.

#### Arguments

`eventType` is a string that represents the event type to listen for. These event types are supported:
- `"selectionChanged"` for listening for selection changes in the object.
- `"readyStateChanged"` for listening to changes on the `readyState` property.

`listener` is an event listener callback function. When the event occurs, `listener` is called and passed an event object containing the following properties:
- `type` is a string that matches the event type.
- `target` refers to the ObjectHandle that the event occurred on.

### removeEventListener(eventType: string, listener: (event: Object) => void)

Removes the previously registered event listener from the `ObjectHandle`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
id: version-2.6.0-SASReportObjectElement
title: SASReportObjectElement
original_id: SASReportObjectElement
---

`SASReportObjectElement` is a custom HTML element that renders a report object. This could be a single object or a
container of multiple objects. This element extends <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement">`HTMLElement`</a>.

To find the correct values for `url`, `reportUri`, and `objectName`, see [the Getting Started page](getting-started.md#create-a-custom-html-tag).

## Custom Element Tag

```html
<sas-report-object
authenticationType="guest"
url="http://my-viya-server.com"
reportUri="/reports/reports/c3c6befb-3981-4c9e-b011-7dc11dec5e37"
objectName="ve27"
></sas-report-object>
```

## Attributes

### `authenticationType: string`

Choose the method to authenticate requests to the SAS Viya server.

- `'guest'` automatically signs in to the SAS Viya server as the guest user.
- `'credentials'` uses SAS Logon to establish an authenticated session.

default value: `'credentials'`

### `url: string`

Specify the URL of the SAS Viya server that hosts the report. This is the full context root, including the protocol,
optional port, and host.

### `reportUri: string`

Specify the report URI.

### `packageUri: string`

Specify the base location of the SAS report package that was exported from SAS Visual Analytics. This can be absolute or relative to the page. `authenticationType`, `url`, and `reportUri` are ignored when you set this property.

See [Export Report Package](guides/export-report-package.md)

### `objectName: string`

Specify the name of the object from the report to display.

### `restrictViewportGestures: boolean`

When `true`, report objects that support zooming require a modifier key be used in addition to the scroll wheel. Enable restrictViewportGestures when embedding elements in a layout that causes overflow. This reserves the scroll-wheel action for page scrolling.

default value: `true`

### `reportContextKey: string`

`reportContextKey` controls the sharing of report contexts between different `SASReportObjectElement` and `SASReportPageElement` elements that originate from the same report. A shared report context allows for report actions, like filtering and linked selections, to occur between objects. Objects that are a report context also have the same shared instance of a `ReportHandle` and all report parameters are shared. In contrast, unique report contexts do not allow for actions across elements and result in a unique `Report Handle`. Unique report contexts also allow for multiple instances of the same report object to be shown at one time, which is not possible when using a shared report context. By default, `SASReportObjectElement`s share a report context with other elements using the same `reportUri` or `packageUri`. Setting different `reportContextKey` values on elements from the same report will result in separate report contexts.

default value: `undefined`<br>
default behavior: use a shared report context per report

### `hideLoadImage: boolean`

When `false`, report objects display a placeholder static image of the report object while it is loading. `true` hides this placeholder and displays a loading indicator.

default value: `false`


## Properties

### `menuItemProvider: MenuItemProvider`

A [`MenuItemProvider`](MenuItemProvider.md) function that generates custom menu content for this element.

## Methods

### `getReportHandle(): Promise<ReportHandle>`

Get a [ReportHandle](ReportHandle.md) for controlling the state of the
current report.

If called before the element is added to the DOM, the promise will resolve
after the object begins to load.

The [ReportHandle](ReportHandle.md) is invalidated when attributes on the
`SASReportObjectElement` are changed and when the element is removed from the
DOM. To obtain another [ReportHandle](ReportHandle.md), discard the previous
result and call `getReportHandle` again.

[ReportHandles](ReportHandle.md) from `SASReportObjectElement` are shared
between objects from the same report.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"2.6.0",
"2.5.0",
"2.4.0",
"2.3.0",
Expand Down

0 comments on commit d8bddba

Please sign in to comment.