@sisense/sdk-ui-angular 2.20.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm2020/lib/components/dashboard/dashboard.component.mjs +3 -3
- package/dist/esm2020/lib/components/widgets/widget.component.mjs +3 -3
- package/dist/esm2020/lib/helpers/chart-props-preact-translator.mjs +22 -0
- package/dist/esm2020/lib/helpers/dashboard-props-preact-translator.mjs +8 -8
- package/dist/esm2020/lib/helpers/widget-props-preact-translator.mjs +25 -5
- package/dist/esm2020/lib/services/angular-component-adapter.mjs +100 -0
- package/dist/esm2020/lib/services/custom-widgets.service.mjs +26 -6
- package/dist/esm2020/lib/services/dashboard.service.mjs +4 -4
- package/dist/esm2020/lib/services/formula.service.mjs +102 -0
- package/dist/esm2020/lib/services/index.mjs +2 -1
- package/dist/esm2020/lib/services/widget.service.mjs +4 -4
- package/dist/esm2020/lib/types/custom-widget-component-props.mjs +2 -0
- package/dist/esm2020/lib/types/index.mjs +2 -1
- package/dist/esm2020/lib/utilities/dashboard-helpers.mjs +9 -8
- package/dist/esm2020/lib/utilities/dashboard-model-translator.mjs +3 -2
- package/dist/esm2020/lib/utilities/widget-model-translator.mjs +10 -8
- package/dist/esm2020/version.mjs +2 -2
- package/dist/fesm2015/sisense-sdk-ui-angular.mjs +276 -36
- package/dist/fesm2015/sisense-sdk-ui-angular.mjs.map +1 -1
- package/dist/fesm2020/sisense-sdk-ui-angular.mjs +292 -38
- package/dist/fesm2020/sisense-sdk-ui-angular.mjs.map +1 -1
- package/dist/lib/helpers/chart-props-preact-translator.d.ts +5 -0
- package/dist/lib/helpers/dashboard-props-preact-translator.d.ts +2 -2
- package/dist/lib/helpers/widget-props-preact-translator.d.ts +7 -4
- package/dist/lib/services/angular-component-adapter.d.ts +55 -0
- package/dist/lib/services/custom-widgets.service.d.ts +2 -1
- package/dist/lib/services/formula.service.d.ts +73 -0
- package/dist/lib/services/index.d.ts +1 -0
- package/dist/lib/types/custom-widget-component-props.d.ts +73 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/package.json +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChartProps as ChartPropsPreact, PivotTableProps as PivotTablePropsPreact, TableProps as TablePropsPreact } from '@sisense/sdk-ui-preact';
|
|
2
|
+
import type { ChartProps, PivotTableProps, TableProps } from '../components';
|
|
3
|
+
export declare function toChartProps(preactProps: ChartPropsPreact): ChartProps;
|
|
4
|
+
export declare function toTableProps(preactProps: TablePropsPreact): TableProps;
|
|
5
|
+
export declare function toPivotTableProps(preactProps: PivotTablePropsPreact): PivotTableProps;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DashboardProps as DashboardPropsPreact } from '@sisense/sdk-ui-preact';
|
|
2
2
|
import type { DashboardProps } from '../components/dashboard';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function toPreactDashboardProps(angularProps: DashboardProps): DashboardPropsPreact;
|
|
4
|
+
export declare function toDashboardProps(preactProps: DashboardPropsPreact): DashboardProps;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { WidgetProps as WidgetPropsPreact } from '@sisense/sdk-ui-preact';
|
|
2
|
-
import type { WidgetProps } from '../components/widgets';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
1
|
+
import type { ChartWidgetProps as ChartWidgetPropsPreact, PivotTableWidgetProps as PivotTableWidgetPropsPreact, TextWidgetProps as TextWidgetPropsPreact, WidgetProps as WidgetPropsPreact } from '@sisense/sdk-ui-preact';
|
|
2
|
+
import type { ChartWidgetProps, PivotTableWidgetProps, TextWidgetProps, WidgetProps } from '../components/widgets';
|
|
3
|
+
export declare function toPreactWidgetProps(angularProps: WidgetProps): WidgetPropsPreact;
|
|
4
|
+
export declare function toWidgetProps(preactProps: WidgetPropsPreact): WidgetProps;
|
|
5
|
+
export declare function toChartWidgetProps(preactProps: ChartWidgetPropsPreact): ChartWidgetProps;
|
|
6
|
+
export declare function toPivotTableWidgetProps(preactProps: PivotTableWidgetPropsPreact): PivotTableWidgetProps;
|
|
7
|
+
export declare function toTextWidgetProps(preactProps: TextWidgetPropsPreact): TextWidgetProps;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Type } from '@angular/core';
|
|
2
|
+
import { type ExternalComponentAdapter } from '@sisense/sdk-ui-preact';
|
|
3
|
+
import { DynamicRenderer } from './dynamic-renderer.service';
|
|
4
|
+
/**
|
|
5
|
+
* Adapter class that manages the lifecycle of an Angular component
|
|
6
|
+
* rendered within a Preact context. This provides efficient updates
|
|
7
|
+
* by reusing the component instance instead of recreating it on every
|
|
8
|
+
* props change.
|
|
9
|
+
*
|
|
10
|
+
* This pattern mirrors how `ComponentAdapter` works for regular Preact
|
|
11
|
+
* components, ensuring consistent behavior between regular widgets
|
|
12
|
+
* and custom Angular widgets.
|
|
13
|
+
*
|
|
14
|
+
* Implements ExternalComponentAdapter interface to be compatible with
|
|
15
|
+
* the ExternalComponentAdapterElement in sdk-ui-preact.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export declare class AngularComponentAdapter<Props> implements ExternalComponentAdapter<Props> {
|
|
20
|
+
private dynamicRenderer;
|
|
21
|
+
private componentClass;
|
|
22
|
+
private componentRef;
|
|
23
|
+
private element;
|
|
24
|
+
private isDestroyed;
|
|
25
|
+
/** Set of property names declared as @Input() on the component */
|
|
26
|
+
private inputNames;
|
|
27
|
+
constructor(dynamicRenderer: DynamicRenderer, componentClass: Type<Props>);
|
|
28
|
+
/**
|
|
29
|
+
* Mounts the Angular component into the container element.
|
|
30
|
+
* This should only be called once when the Preact wrapper mounts.
|
|
31
|
+
*
|
|
32
|
+
* @param container - The DOM element to mount the Angular component into
|
|
33
|
+
* @param props - Initial props to pass to the component
|
|
34
|
+
*/
|
|
35
|
+
mount(container: HTMLElement, props: Props): void;
|
|
36
|
+
/**
|
|
37
|
+
* Updates the props on the existing Angular component instance.
|
|
38
|
+
* Uses ComponentRef.setInput() for @Input properties to ensure proper
|
|
39
|
+
* change detection, OnPush component marking, and ngOnChanges lifecycle
|
|
40
|
+
* hook execution. Uses direct assignment for non-input properties
|
|
41
|
+
* (e.g., event callbacks).
|
|
42
|
+
*
|
|
43
|
+
* @param props - New props to apply to the component
|
|
44
|
+
*/
|
|
45
|
+
update(props: Props): void;
|
|
46
|
+
/**
|
|
47
|
+
* Destroys the Angular component and cleans up resources.
|
|
48
|
+
* This should be called when the Preact wrapper unmounts.
|
|
49
|
+
*/
|
|
50
|
+
destroy(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Returns whether the adapter has an active component instance.
|
|
53
|
+
*/
|
|
54
|
+
isActive(): boolean;
|
|
55
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
|
-
import { type CustomWidgetComponent as CustomWidgetComponentPreact, type
|
|
2
|
+
import { type CustomWidgetComponent as CustomWidgetComponentPreact, type GenericDataOptions } from '@sisense/sdk-ui-preact';
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
|
+
import type { CustomWidgetComponentProps } from '../types';
|
|
4
5
|
import { DynamicRenderer } from './dynamic-renderer.service';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
/** Re-export related types */
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { CalculatedMeasure } from '@sisense/sdk-data';
|
|
2
|
+
import { type UseGetSharedFormulaParams as UseGetSharedFormulaParamsPreact } from '@sisense/sdk-ui-preact';
|
|
3
|
+
import { SisenseContextService } from './sisense-context.service';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for retrieving a shared formula.
|
|
7
|
+
*/
|
|
8
|
+
export interface GetSharedFormulaParams extends Omit<UseGetSharedFormulaParamsPreact, 'enabled'> {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Service for working with shared formulas.
|
|
12
|
+
*
|
|
13
|
+
* @group Fusion Assets
|
|
14
|
+
* @fusionEmbed
|
|
15
|
+
*/
|
|
16
|
+
export declare class FormulaService {
|
|
17
|
+
private sisenseContextService;
|
|
18
|
+
constructor(sisenseContextService: SisenseContextService);
|
|
19
|
+
/**
|
|
20
|
+
* Fetch a [shared formula](https://docs.sisense.com/main/SisenseLinux/shared-formulas.htm) from a Fusion instance.
|
|
21
|
+
*
|
|
22
|
+
* The formula can be identified either by `oid` or by `name` and `dataSource` pair.
|
|
23
|
+
*
|
|
24
|
+
* When the retrieval is successful but the shared formula is not found, the result is `null`. When the retrieval is not successful, the promise is rejected with an error.
|
|
25
|
+
*
|
|
26
|
+
* ## Example
|
|
27
|
+
*
|
|
28
|
+
* Retrieve a shared formula by oid:
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* try {
|
|
32
|
+
* const formula = await formulaService.getSharedFormula({
|
|
33
|
+
* oid: 'd61c337b-fabc-4e9e-b4cc-a30116857153',
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* if (formula) {
|
|
37
|
+
* console.log('Formula found:', formula);
|
|
38
|
+
* } else {
|
|
39
|
+
* console.log('Formula not found');
|
|
40
|
+
* }
|
|
41
|
+
* } catch (error) {
|
|
42
|
+
* console.error('Error:', error);
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* ## Example
|
|
47
|
+
*
|
|
48
|
+
* Retrieve a shared formula by name and data source:
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* try {
|
|
52
|
+
* const formula = await formulaService.getSharedFormula({
|
|
53
|
+
* name: 'My Shared Formula',
|
|
54
|
+
* dataSource: DM.DataSource,
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* if (formula) {
|
|
58
|
+
* console.log('Formula found:', formula);
|
|
59
|
+
* } else {
|
|
60
|
+
* console.log('Formula not found');
|
|
61
|
+
* }
|
|
62
|
+
* } catch (error) {
|
|
63
|
+
* console.error('Error:', error);
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param params - Parameters for retrieving the shared formula. Must include either `oid` or both `name` and `dataSource`.
|
|
68
|
+
* @returns Promise that resolves to the shared formula, or `null` if not found
|
|
69
|
+
*/
|
|
70
|
+
getSharedFormula(params: GetSharedFormulaParams): Promise<CalculatedMeasure | null>;
|
|
71
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormulaService, never>;
|
|
72
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FormulaService>;
|
|
73
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './custom-widgets.service';
|
|
2
2
|
export * from './dashboard.service';
|
|
3
3
|
export * from './filter.service';
|
|
4
|
+
export * from './formula.service';
|
|
4
5
|
export * from './hierarchy.service';
|
|
5
6
|
export * from './query.service';
|
|
6
7
|
export * from './sisense-context.service';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
|
|
2
|
+
import type { AbstractDataPointWithEntries, CustomWidgetEventProps, CustomWidgetStyleOptions, GenericDataOptions } from '@sisense/sdk-ui-preact';
|
|
3
|
+
/**
|
|
4
|
+
* Props passed to a user-defined custom widget component.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam DataOptions - The shape of data options for this custom widget
|
|
7
|
+
* @typeParam StyleOptions - The shape of style options for this custom widget
|
|
8
|
+
* @typeParam DataPoint - The shape of data points for event handlers
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { Component, Input } from '@angular/core';
|
|
13
|
+
* import {
|
|
14
|
+
* CustomWidgetComponentProps,
|
|
15
|
+
* CustomWidgetsService,
|
|
16
|
+
* GenericDataOptions,
|
|
17
|
+
* AbstractDataPointWithEntries,
|
|
18
|
+
* DataPointEntry,
|
|
19
|
+
* StyledColumn,
|
|
20
|
+
* StyledMeasureColumn,
|
|
21
|
+
* } from '@sisense/sdk-ui-angular';
|
|
22
|
+
* import type { DataSource, Filter, FilterRelations } from '@sisense/sdk-data';
|
|
23
|
+
*
|
|
24
|
+
* interface MyDataOptions extends GenericDataOptions {
|
|
25
|
+
* category: StyledColumn[];
|
|
26
|
+
* value: StyledMeasureColumn[];
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* interface MyDataPoint extends AbstractDataPointWithEntries {
|
|
30
|
+
* entries: {
|
|
31
|
+
* category: DataPointEntry[];
|
|
32
|
+
* value: DataPointEntry[];
|
|
33
|
+
* };
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* type MyWidgetProps = CustomWidgetComponentProps<MyDataOptions, object, MyDataPoint>;
|
|
37
|
+
*
|
|
38
|
+
* @Component({
|
|
39
|
+
* selector: 'app-my-widget',
|
|
40
|
+
* template: `<div>My Custom Widget</div>`,
|
|
41
|
+
* })
|
|
42
|
+
* export class MyWidgetComponent implements MyWidgetProps {
|
|
43
|
+
* @Input() dataOptions!: MyDataOptions;
|
|
44
|
+
* @Input() dataSource?: DataSource;
|
|
45
|
+
* @Input() styleOptions?: object;
|
|
46
|
+
* @Input() filters?: Filter[] | FilterRelations;
|
|
47
|
+
* @Input() highlights?: Filter[];
|
|
48
|
+
* @Input() description?: string;
|
|
49
|
+
* @Input() onDataPointClick?: (point: MyDataPoint, nativeEvent: MouseEvent) => void;
|
|
50
|
+
* @Input() onDataPointContextMenu?: (point: MyDataPoint, nativeEvent: MouseEvent) => void;
|
|
51
|
+
* @Input() onDataPointsSelected?: (points: MyDataPoint[], nativeEvent: MouseEvent) => void;
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* // In AppModule or a component, register the custom widget:
|
|
55
|
+
* constructor(private customWidgets: CustomWidgetsService) {
|
|
56
|
+
* this.customWidgets.registerCustomWidget('my-widget', MyWidgetComponent);
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export interface CustomWidgetComponentProps<DataOptions = GenericDataOptions, StyleOptions = CustomWidgetStyleOptions, DataPoint extends AbstractDataPointWithEntries = AbstractDataPointWithEntries> extends CustomWidgetEventProps<DataPoint> {
|
|
61
|
+
/** Data source for the custom widget */
|
|
62
|
+
dataSource?: DataSource;
|
|
63
|
+
/** Data options defining what data to display */
|
|
64
|
+
dataOptions: DataOptions;
|
|
65
|
+
/** Style options for customizing appearance */
|
|
66
|
+
styleOptions?: StyleOptions;
|
|
67
|
+
/** Filters to apply to the data */
|
|
68
|
+
filters?: Filter[] | FilterRelations;
|
|
69
|
+
/** Highlight filters for interactive highlighting */
|
|
70
|
+
highlights?: Filter[];
|
|
71
|
+
/** Description of the widget */
|
|
72
|
+
description?: string;
|
|
73
|
+
}
|
package/dist/package.json
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.
|
|
1
|
+
declare const _default: "2.22.0";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"Sisense",
|
|
12
12
|
"Compose SDK"
|
|
13
13
|
],
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.22.0",
|
|
15
15
|
"author": "Sisense",
|
|
16
16
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
17
17
|
"main": "dist",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@sisense/sdk-data": "2.
|
|
91
|
-
"@sisense/sdk-tracking": "2.
|
|
92
|
-
"@sisense/sdk-ui-preact": "2.
|
|
90
|
+
"@sisense/sdk-data": "2.22.0",
|
|
91
|
+
"@sisense/sdk-tracking": "2.22.0",
|
|
92
|
+
"@sisense/sdk-ui-preact": "2.22.0",
|
|
93
93
|
"rxjs": "^7.8.1",
|
|
94
94
|
"ts-deepmerge": "^6.2.0",
|
|
95
95
|
"tslib": "^2.3.0"
|