Merged PR 497159: [CustomVisuals] - HierarchyIdentityFilter

Exposing a hierarchy filter based on identities for CV.
PowerBIClients PR: !504068

Related work items: #1302425
This commit is contained in:
Roi Hochler 2024-01-28 13:31:55 +00:00
Родитель ac6300a92b
Коммит f24a873915
3 изменённых файлов: 44 добавлений и 4 удалений

4
package-lock.json сгенерированный
Просмотреть файл

@ -1,12 +1,12 @@
{
"name": "powerbi-models",
"version": "1.14.1",
"version": "1.15.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "powerbi-models",
"version": "1.14.1",
"version": "1.15.0",
"license": "MIT",
"devDependencies": {
"@types/jasmine": "^3.5.5",

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "powerbi-models",
"version": "1.14.1",
"version": "1.15.0",
"description": "Contains JavaScript & TypeScript object models for Microsoft Power BI JavaScript SDK. For each model there is a TypeScript interface, and a validation function to ensure and object is valid.",
"main": "dist/models.js",
"typings": "dist/models.d.ts",

Просмотреть файл

@ -313,6 +313,10 @@ export enum MenuLocation {
Top
}
export interface IQueryNameTarget {
queryName: string;
}
export interface IBaseTarget {
table: string;
$schema?: string;
@ -384,8 +388,9 @@ export declare type IFilterKeyTarget = (IFilterKeyColumnsTarget | IFilterKeyHier
export declare type IFilterTarget = (IFilterColumnTarget | IFilterHierarchyTarget | IFilterMeasureTarget | INotSupportedFilterTarget | IFilterColumnAggrTarget | IFilterHierarchyAggrTarget);
export type ITupleFilterTarget = IFilterTarget[];
export type IIdentityFilterTarget = number[];
export type IHierarchyIdentityFilterTarget = IQueryNameTarget[];
export type IIncludeExcludeFilterTarget = IFilterTarget | (IFilterTarget | IFilterKeyTarget)[][];
export type IFilterGeneralTarget = IFilterTarget | IFilterKeyTarget | ITupleFilterTarget | IIdentityFilterTarget | IIncludeExcludeFilterTarget;
export type IFilterGeneralTarget = IFilterTarget | IFilterKeyTarget | ITupleFilterTarget | IIdentityFilterTarget | IIncludeExcludeFilterTarget | IHierarchyIdentityFilterTarget;
export interface IFilter {
$schema: string;
target: IFilterGeneralTarget;
@ -534,6 +539,17 @@ export interface IHierarchyFilter extends IFilter {
hierarchyData: IHierarchyFilterNode[];
}
export interface IHierarchyIdentityFilterNode<IdentityType> {
identity: IdentityType;
children?: IHierarchyIdentityFilterNode<IdentityType>[];
operator: HierarchyFilterNodeOperators;
}
export interface IHierarchyIdentityFilter<IdentityType> extends IFilter {
target: IHierarchyIdentityFilterTarget;
hierarchyData: IHierarchyIdentityFilterNode<IdentityType>[];
}
export interface ISmartNarratives {
summaryText: string;
}
@ -549,6 +565,7 @@ export enum FilterType {
RelativeTime = 7,
Identity = 8,
Hierarchy = 9,
HierarchyIdentity = 10,
}
export enum RelativeDateFilterTimeUnit {
@ -954,6 +971,29 @@ export class HierarchyFilter extends Filter {
}
}
export class HierarchyIdentityFilter<IdentityType> extends Filter {
static schemaUrl: string = "http://powerbi.com/product/schema#hierarchyIdentity";
target: IHierarchyIdentityFilterTarget;
hierarchyData: IHierarchyIdentityFilterNode<IdentityType>[];
constructor(
target: IHierarchyIdentityFilterTarget,
hierarchyData: IHierarchyIdentityFilterNode<IdentityType>[]
) {
super(target, FilterType.HierarchyIdentity);
this.schemaUrl = HierarchyIdentityFilter.schemaUrl;
this.hierarchyData = hierarchyData;
}
toJSON(): IHierarchyIdentityFilter<IdentityType> {
const filter = super.toJSON() as IHierarchyIdentityFilter<IdentityType>;
filter.hierarchyData = this.hierarchyData;
filter.target = this.target;
return filter;
}
}
export interface IDataReference {
target: IFilterTarget;
}