Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Change Log - Power BI Custom Visuals API
## 5.12.0
* `pendingChanges`: New property which indicates that changes made on the visual are yet to be applied on the report.
## 5.11.0
* Removes storageService.
## 5.10.0
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "powerbi-visuals-api",
"version": "5.11.0",
"version": "5.12.0",
"description": "Power BI Custom Visuals API type definitions for typescript",
"types": "index",
"main": "index.js",
Expand Down
29 changes: 19 additions & 10 deletions src/visuals-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,14 @@ declare module powerbi {
export interface FilterTypeDescriptor {
selfFilter?: boolean;
}

export const enum PendingChangesType {
"Filters",
Copy link
Contributor

@Demonkratiy Demonkratiy Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I would prefer to receive some human meaningful value instead of type number. That could help a lot when debugging a visual.
    image

  2. Also, for this type, a single count naming or continuous action is better in my opinion. Filter = "FILTER" or Filtering = "FILTERING" (uppercase is up to you). While "Filters" might be considered as some set of multiple values.

}

export type PendingChanges = {
[key in PendingChangesType]?: boolean;
Copy link
Contributor

@Demonkratiy Demonkratiy Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, as we are working with Enum, key is a bad naming in a mapped type here. Someone could expect that a key of enum element is used, while in fact value is used here.
For example, in current realization, 0 value is used, and not the "Filters", while "Filters" would be considered as a key in terms of "key - value" concept.

export type PendingChanges = {
      [key in PendingChangesType]?: boolean;
};

Now the code above will create the following type structure:

export type PendingChanges = {
      0: boolean;
}

"0" is a result of PendingChangesType.Filters enumeration "value" - 0, not the enumeration "key" - Filters.

In other words, it would be better to call it something like: [enumValue in PendingChangesType]?: boolean;, if you want to use this sorting method and values from Enum.

};
}


Expand Down Expand Up @@ -1845,16 +1853,17 @@ declare module powerbi.extensibility.visual {
}

export interface VisualUpdateOptions extends extensibility.VisualUpdateOptions {
viewport: IViewport;
dataViews: DataView[];
type: VisualUpdateType;
viewMode?: ViewMode;
editMode?: EditMode;
operationKind?: VisualDataChangeOperationKind;
jsonFilters?: IFilter[];
isInFocus?: boolean;
subSelections?: powerbi.visuals.CustomVisualSubSelection[];
formatMode?: boolean;
viewport: IViewport;
dataViews: DataView[];
type: VisualUpdateType;
viewMode?: ViewMode;
editMode?: EditMode;
operationKind?: VisualDataChangeOperationKind;
jsonFilters?: IFilter[];
isInFocus?: boolean;
subSelections?: powerbi.visuals.CustomVisualSubSelection[];
formatMode?: boolean;
pendingChanges?: PendingChanges;
}

export interface VisualConstructorOptions extends extensibility.VisualConstructorOptions {
Expand Down