-
Notifications
You must be signed in to change notification settings - Fork 144
/
PowerBI-visuals.d.ts
1485 lines (1220 loc) · 49.1 KB
/
PowerBI-visuals.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare namespace powerbi {
enum VisualDataRoleKind {
/** Indicates that the role should be bound to something that evaluates to a grouping of values. */
Grouping = 0,
/** Indicates that the role should be bound to something that evaluates to a single value in a scope. */
Measure = 1,
/** Indicates that the role can be bound to either Grouping or Measure. */
GroupingOrMeasure = 2,
}
enum VisualDataChangeOperationKind {
Create = 0,
Append = 1,
}
enum VisualUpdateType {
Data = 2,
Resize = 4,
ViewMode = 8,
Style = 16,
ResizeEnd = 32,
All = 62,
}
enum VisualPermissions {
}
const enum CartesianRoleKind {
X = 0,
Y = 1,
}
const enum ViewMode {
View = 0,
Edit = 1,
InFocusEdit = 2,
}
const enum EditMode {
/** Default editing mode for the visual. */
Default = 0,
/** Indicates the user has asked the visual to display advanced editing controls. */
Advanced = 1,
}
const enum AdvancedEditModeSupport {
/** The visual doesn't support Advanced Edit mode. Do not display the 'Edit' button on this visual. */
NotSupported = 0,
/** The visual supports Advanced Edit mode, but doesn't require any further changes aside from setting EditMode=Advanced. */
SupportedNoAction = 1,
/** The visual supports Advanced Edit mode, and requires that the host pops out the visual when entering Advanced EditMode. */
SupportedInFocus = 2,
}
const enum ResizeMode {
Resizing = 1,
Resized = 2,
}
const enum JoinPredicateBehavior {
/** Prevent items in this role from acting as join predicates. */
None = 0,
}
const enum PromiseResultType {
Success = 0,
Failure = 1,
}
/**
* Defines actions to be taken by the visual in response to a selection.
*
* An undefined/null VisualInteractivityAction should be treated as Selection,
* as that is the default action.
*/
const enum VisualInteractivityAction {
/** Normal selection behavior which should call onSelect */
Selection = 0,
/** No additional action or feedback from the visual is needed */
None = 1,
}
/**
* Defines various events Visuals can notify the host on.
*/
const enum VisualEventType {
/** Should be used at the beginning of a visual's rendering operation. */
RenderStarted = 0,
/** Should be used at the end of a visual's rendering operation. */
RenderCompleted = 1,
/** Should be used by visuals to trace information in PBI telemetry. */
Trace = 2,
/** Should be used by visuals to trace errors in PBI telemetry. */
Error = 3,
}
const enum FilterAction {
/** Merging filter into existing filters. */
merge = 0,
/** removing existing filter. */
remove = 1,
}
}
declare module powerbi.visuals.plugins {
/** This IVisualPlugin interface is only used by the CLI tools when compiling */
export interface IVisualPlugin {
/** The name of the plugin. Must match the property name in powerbi.visuals. */
name: string;
/** Function to call to create the visual. */
create: (options?: extensibility.VisualConstructorOptions) => extensibility.IVisual;
/** The class of the plugin. At the moment it is only used to have a way to indicate the class name that a custom visual has. */
class: string;
/** Check if a visual is custom */
custom: boolean;
/** The version of the api that this plugin should be run against */
apiVersion: string;
/** Human readable plugin name displayed to users */
displayName: string;
}
}
declare module jsCommon {
export interface IStringResourceProvider {
get(id: string): string;
getOptional(id: string): string;
}
}
declare module powerbi {
/**
* An interface to promise/deferred,
* which abstracts away the underlying mechanism (e.g., Angular, jQuery, etc.).
*/
export interface IPromiseFactory {
/**
* Creates a Deferred object which represents a task which will finish in the future.
*/
defer<T>(): IDeferred<T>;
/**
* Creates a Deferred object which represents a task which will finish in the future.
*/
defer<TSuccess, TError>(): IDeferred2<TSuccess, TError>;
/**
* Creates a promise that is resolved as rejected with the specified reason.
* This api should be used to forward rejection in a chain of promises.
* If you are dealing with the last promise in a promise chain, you don't need to worry about it.
* When comparing deferreds/promises to the familiar behavior of try/catch/throw,
* think of reject as the throw keyword in JavaScript.
* This also means that if you "catch" an error via a promise error callback and you want
* to forward the error to the promise derived from the current promise,
* you have to "rethrow" the error by returning a rejection constructed via reject.
*
* @param reason Constant, message, exception or an object representing the rejection reason.
*/
reject<TError>(reason?: TError): IPromise2<any, TError>;
/**
* Creates a promise that is resolved with the specified value.
* This api should be used to forward rejection in a chain of promises.
* If you are dealing with the last promise in a promise chain, you don't need to worry about it.
*
* @param value Object representing the promise result.
*/
resolve<TSuccess>(value?: TSuccess): IPromise2<TSuccess, any>;
/**
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
* Rejects immediately if any of the promises fail
*/
all(promises: IPromise2<any, any>[]): IPromise<any[]>;
/**
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
* Does not resolve until all promises finish (success or failure).
*/
allSettled<T>(promises: IPromise2<any, any>[]): IPromise<IPromiseResult<T>[]>;
/**
* Wraps an object that might be a value or a then-able promise into a promise.
* This is useful when you are dealing with an object that might or might not be a promise
*/
when<T>(value: T | IPromise<T>): IPromise<T>;
}
/**
* Represents an operation, to be completed (resolve/rejected) in the future.
*/
export interface IPromise<T> extends IPromise2<T, T> {
}
/**
* Represents an operation, to be completed (resolve/rejected) in the future.
* Success and failure types can be set independently.
*/
export interface IPromise2<TSuccess, TError> {
/**
* Regardless of when the promise was or will be resolved or rejected,
* then calls one of the success or error callbacks asynchronously as soon as the result is available.
* The callbacks are called with a single argument: the result or rejection reason.
* Additionally, the notify callback may be called zero or more times to provide a progress indication,
* before the promise is resolved or rejected.
* This method returns a new promise which is resolved or rejected via
* the return value of the successCallback, errorCallback.
*/
then<TSuccessResult, TErrorResult>(successCallback: (promiseValue: TSuccess) => IPromise2<TSuccessResult, TErrorResult>, errorCallback?: (reason: TError) => TErrorResult): IPromise2<TSuccessResult, TErrorResult>;
/**
* Regardless of when the promise was or will be resolved or rejected,
* then calls one of the success or error callbacks asynchronously as soon as the result is available.
* The callbacks are called with a single argument: the result or rejection reason.
* Additionally, the notify callback may be called zero or more times to provide a progress indication,
* before the promise is resolved or rejected.
* This method returns a new promise which is resolved or rejected via
* the return value of the successCallback, errorCallback.
*/
then<TSuccessResult, TErrorResult>(successCallback: (promiseValue: TSuccess) => TSuccessResult, errorCallback?: (reason: TError) => TErrorResult): IPromise2<TSuccessResult, TErrorResult>;
/**
* Shorthand for promise.then(null, errorCallback).
*/
catch<TErrorResult>(onRejected: (reason: any) => IPromise2<TSuccess, TErrorResult>): IPromise2<TSuccess, TErrorResult>;
/**
* Shorthand for promise.then(null, errorCallback).
*/
catch<TErrorResult>(onRejected: (reason: any) => TErrorResult): IPromise2<TSuccess, TErrorResult>;
/**
* Allows you to observe either the fulfillment or rejection of a promise,
* but to do so without modifying the final value.
* This is useful to release resources or do some clean-up that needs to be done
* whether the promise was rejected or resolved.
* See the full specification for more information.
* Because finally is a reserved word in JavaScript and reserved keywords
* are not supported as property names by ES3, you'll need to invoke
* the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
*/
finally<T, U>(finallyCallback: () => any): IPromise2<T, U>;
}
export interface IDeferred<T> extends IDeferred2<T, T> {
}
export interface IDeferred2<TSuccess, TError> {
resolve(value: TSuccess): void;
reject(reason?: TError): void;
promise: IPromise2<TSuccess, TError>;
}
export interface RejectablePromise2<T, E> extends IPromise2<T, E> {
reject(reason?: E): void;
resolved(): boolean;
rejected(): boolean;
pending(): boolean;
}
export interface RejectablePromise<T> extends RejectablePromise2<T, T> {
}
export interface IResultCallback<T> {
(result: T, done: boolean): void;
}
export interface IPromiseResult<T> {
type: PromiseResultType;
value: T;
}
}
declare module powerbi.visuals {
import Selector = data.Selector;
import SelectorsByColumn = data.SelectorsByColumn;
export interface CustomVisualOpaqueIdentity { }
export interface ISelectionIdBuilder {
withCategory(categoryColumn: DataViewCategoryColumn, index: number): this;
withSeries(seriesColumn: DataViewValueColumns, valueColumn: DataViewValueColumn | DataViewValueColumnGroup): this;
withMeasure(measureId: string): this;
withMatrixNode(matrixNode: DataViewMatrixNode, levels: DataViewHierarchyLevel[]): this;
withTable(table: DataViewTable, rowIndex: number): this;
createSelectionId(): ISelectionId;
}
export interface ISelectionId {
equals(other: ISelectionId): boolean;
includes(other: ISelectionId, ignoreHighlight?: boolean): boolean;
getKey(): string;
getSelector(): Selector;
getSelectorsByColumn(): SelectorsByColumn;
hasIdentity(): boolean;
}
}
declare module powerbi {
export const enum SortDirection {
Ascending = 1,
Descending = 2,
}
}
declare module powerbi {
export interface QueryTransformTypeDescriptor {
}
}
declare module powerbi {
/** Represents views of a data set. */
export interface DataView {
metadata: DataViewMetadata;
categorical?: DataViewCategorical;
single?: DataViewSingle;
tree?: DataViewTree;
table?: DataViewTable;
matrix?: DataViewMatrix;
scriptResult?: DataViewScriptResultData;
}
export interface DataViewMetadata {
columns: DataViewMetadataColumn[];
/** The metadata repetition objects. */
objects?: DataViewObjects;
/** When defined, describes whether the DataView contains just a segment of the complete data set. */
segment?: DataViewSegmentMetadata;
/** Describes the data reduction applied to this data set when limits are exceeded. */
dataReduction?: DataViewReductionMetadata;
}
export interface DataViewMetadataColumn {
/** The user-facing display name of the column. */
displayName: string;
/** The query name the source column in the query. */
queryName?: string;
/** The format string of the column. */
format?: string; // TODO: Deprecate this, and populate format string through objects instead.
/** Data type information for the column. */
type?: ValueTypeDescriptor;
/** Indicates that this column is a measure (aggregate) value. */
isMeasure?: boolean;
/** The position of the column in the select statement. */
index?: number;
/** The properties that this column provides to the visualization. */
roles?: { [name: string]: boolean };
/** The metadata repetition objects. */
objects?: DataViewObjects;
/** The name of the containing group. */
groupName?: PrimitiveValue;
/** The sort direction of this column. */
sort?: SortDirection;
/** The order sorts are applied. Lower values are applied first. Undefined indicates no sort was done on this column. */
sortOrder?: number;
/** The KPI metadata to use to convert a numeric status value into its visual representation. */
kpi?: DataViewKpiColumnMetadata;
/** Indicates that aggregates should not be computed across groups with different values of this column. */
discourageAggregationAcrossGroups?: boolean;
/** The aggregates computed for this column, if any. */
aggregates?: DataViewColumnAggregates;
/** The SQExpr this column represents. */
expr?: data.ISQExpr;
/**
* The set of expressions that define the identity for instances of this grouping field.
* This must be a subset of the items in the DataViewScopeIdentity in the grouped items result.
* This property is undefined for measure fields, as well as for grouping fields in DSR generated prior to the CY16SU08 or SU09 timeframe.
*/
identityExprs?: data.ISQExpr[];
parameter?: DataViewParameterColumnMetadata;
}
export interface DataViewSegmentMetadata {
}
export interface DataViewReductionMetadata {
categorical?: DataViewCategoricalReductionMetadata;
}
export interface DataViewCategoricalReductionMetadata {
categories?: DataViewReductionAlgorithmMetadata;
values?: DataViewReductionAlgorithmMetadata;
metadata?: DataViewReductionAlgorithmMetadata;
}
export interface DataViewReductionAlgorithmMetadata {
binnedLineSample?: {};
}
export interface DataViewColumnAggregates {
subtotal?: PrimitiveValue;
max?: PrimitiveValue;
min?: PrimitiveValue;
average?: PrimitiveValue;
median?: PrimitiveValue;
count?: number;
percentiles?: DataViewColumnPercentileAggregate[];
/** Represents a single value evaluation, similar to a total. */
single?: PrimitiveValue;
/** Client-computed maximum value for a column. */
maxLocal?: PrimitiveValue;
/** Client-computed maximum value for a column. */
minLocal?: PrimitiveValue;
}
export interface DataViewColumnPercentileAggregate {
exclusive?: boolean;
k: number;
value: PrimitiveValue;
}
export interface DataViewCategorical {
categories?: DataViewCategoryColumn[];
values?: DataViewValueColumns;
}
export interface DataViewCategoricalColumn {
source: DataViewMetadataColumn;
/** The data repetition objects. */
objects?: DataViewObjects[];
}
export interface DataViewValueColumns extends Array<DataViewValueColumn> {
/** Returns an array that groups the columns in this group together. */
grouped(): DataViewValueColumnGroup[];
/** The set of expressions that define the identity for instances of the value group. This must match items in the DataViewScopeIdentity in the grouped items result. */
identityFields?: data.ISQExpr[];
source?: DataViewMetadataColumn;
}
export interface DataViewValueColumnGroup {
values: DataViewValueColumn[];
identity?: visuals.CustomVisualOpaqueIdentity;
/** The data repetition objects. */
objects?: DataViewObjects;
name?: PrimitiveValue;
}
export interface DataViewValueColumn extends DataViewCategoricalColumn {
values: PrimitiveValue[];
highlights?: PrimitiveValue[];
identity?: visuals.CustomVisualOpaqueIdentity;
}
// NOTE: The following is needed for backwards compatibility and should be deprecated. Callers should use
// DataViewMetadataColumn.aggregates instead.
export interface DataViewValueColumn extends DataViewColumnAggregates {
}
export interface DataViewCategoryColumn extends DataViewCategoricalColumn {
values: PrimitiveValue[];
identity?: visuals.CustomVisualOpaqueIdentity[];
/** The set of expressions that define the identity for instances of the category. This must match items in the DataViewScopeIdentity in the identity. */
identityFields?: data.ISQExpr[];
}
export interface DataViewSingle {
value: PrimitiveValue;
}
export interface DataViewTree {
root: DataViewTreeNode;
}
export interface DataViewTreeNode {
name?: PrimitiveValue;
/**
* When used under the context of DataView.tree, this value is one of the elements in the values property.
*
* When used under the context of DataView.matrix, this property is the value of the particular
* group instance represented by this node (e.g. In a grouping on Year, a node can have value == 2016).
*
* DEPRECATED for usage under the context of DataView.matrix: This property is deprecated for objects
* that conform to the DataViewMatrixNode interface (which extends DataViewTreeNode).
* New visuals code should consume the new property levelValues on DataViewMatrixNode instead.
* If this node represents a composite group node in matrix, this property will be undefined.
*/
value?: PrimitiveValue;
/**
* This property contains all the values in this node.
* The key of each of the key-value-pair in this dictionary is the position of the column in the
* select statement to which the value belongs.
*/
values?: { [id: number]: DataViewTreeNodeValue };
children?: DataViewTreeNode[];
identity?: visuals.CustomVisualOpaqueIdentity;
/** The data repetition objects. */
objects?: DataViewObjects;
/** The set of expressions that define the identity for the child nodes. This must match items in the DataViewScopeIdentity of those nodes. */
childIdentityFields?: data.ISQExpr[];
}
export interface DataViewTreeNodeValue {
value?: PrimitiveValue;
}
export interface DataViewTreeNodeMeasureValue extends DataViewTreeNodeValue, DataViewColumnAggregates {
highlight?: PrimitiveValue;
}
export interface DataViewTreeNodeGroupValue extends DataViewTreeNodeValue {
count?: PrimitiveValue;
}
export interface DataViewTable {
columns: DataViewMetadataColumn[];
identity?: visuals.CustomVisualOpaqueIdentity[];
/** The set of expressions that define the identity for rows of the table. This must match items in the DataViewScopeIdentity in the identity. */
identityFields?: data.ISQExpr[];
rows?: DataViewTableRow[];
totals?: PrimitiveValue[];
}
export interface DataViewTableRow extends Array<PrimitiveValue> {
/** The data repetition objects. */
objects?: DataViewObjects[];
}
export interface DataViewMatrix {
rows: DataViewHierarchy;
columns: DataViewHierarchy;
/**
* The metadata columns of the measure values.
* In visual DataView, this array is sorted in projection order.
*/
valueSources: DataViewMetadataColumn[];
}
export interface DataViewMatrixNode extends DataViewTreeNode {
/** Indicates the level this node is on. Zero indicates the outermost children (root node level is undefined). */
level?: number;
children?: DataViewMatrixNode[];
/* If this DataViewMatrixNode represents the inner-most dimension of row groups (i.e. a leaf node), then this property will contain the values at the
* matrix intersection under the group. The valueSourceIndex property will contain the position of the column in the select statement to which the
* value belongs.
*
* When this DataViewMatrixNode is used under the context of DataView.matrix.columns, this property is not used.
*/
values?: { [id: number]: DataViewMatrixNodeValue };
/**
* Indicates the source metadata index on the node's level. Its value is 0 if omitted.
*
* DEPRECATED: This property is deprecated and exists for backward-compatibility only.
* New visuals code should consume the new property levelSourceIndex on DataViewMatrixGroupValue instead.
*/
levelSourceIndex?: number;
/**
* The values of the particular group instance represented by this node.
* This array property would contain more than one element in a composite group
* (e.g. Year == 2016 and Month == 'January').
*/
levelValues?: DataViewMatrixGroupValue[];
/** Indicates whether or not the node is a subtotal node. Its value is false if omitted. */
isSubtotal?: boolean;
}
/**
* Represents a value at a particular level of a matrix's rows or columns hierarchy.
* In the hierarchy level node is an instance of a composite group, this object will
* be one of multiple values
*/
export interface DataViewMatrixGroupValue extends DataViewTreeNodeValue {
/**
* Indicates the index of the corresponding column for this group level value
* (held by DataViewHierarchyLevel.sources).
*
* @example
* // For example, to get the source column metadata of each level value at a particular row hierarchy node:
* let matrixRowsHierarchy: DataViewHierarchy = dataView.matrix.rows;
* let targetRowsHierarchyNode = <DataViewMatrixNode>matrixRowsHierarchy.root.children[0];
* // Use the DataViewMatrixNode.level property to get the corresponding DataViewHierarchyLevel...
* let targetRowsHierarchyLevel: DataViewHierarchyLevel = matrixRows.levels[targetRowsHierarchyNode.level];
* for (let levelValue in rowsRootNode.levelValues) {
* // columnMetadata is the source column for the particular levelValue.value in this loop iteration
* let columnMetadata: DataViewMetadataColumn =
* targetRowsHierarchyLevel.sources[levelValue.levelSourceIndex];
* }
*/
levelSourceIndex: number;
}
/** Represents a value at the matrix intersection, used in the values property on DataViewMatrixNode (inherited from DataViewTreeNode). */
export interface DataViewMatrixNodeValue extends DataViewTreeNodeValue {
highlight?: PrimitiveValue;
/** The data repetition objects. */
objects?: DataViewObjects;
/** Indicates the index of the corresponding measure (held by DataViewMatrix.valueSources). Its value is 0 if omitted. */
valueSourceIndex?: number;
}
export interface DataViewHierarchy {
root: DataViewMatrixNode;
levels: DataViewHierarchyLevel[];
}
export interface DataViewHierarchyLevel {
/**
* The metadata columns of this hierarchy level.
* In visual DataView, this array is sorted in projection order.
*/
sources: DataViewMetadataColumn[];
}
export interface DataViewKpiColumnMetadata {
graphic: string;
// When false, five state KPIs are in: { -2, -1, 0, 1, 2 }.
// When true, five state KPIs are in: { -1, -0.5, 0, 0.5, 1 }.
normalizedFiveStateKpiRange?: boolean;
}
/** Indicates the column is a what-if parameter */
export interface DataViewParameterColumnMetadata {
}
export interface DataViewScriptResultData {
payloadBase64: string;
}
export interface ValueRange<T> {
min?: T;
max?: T;
}
/** Defines the acceptable values of a number. */
export type NumberRange = ValueRange<number>;
/** Defines the PrimitiveValue range. */
export type PrimitiveValueRange = ValueRange<PrimitiveValue>;
}
declare module powerbi {
/** Represents evaluated, named, custom objects in a DataView. */
export interface DataViewObjects {
[name: string]: DataViewObject;
}
/** Represents an object (name-value pairs) in a DataView. */
export interface DataViewObject {
/** Map of property name to property value. */
[propertyName: string]: DataViewPropertyValue;
/** Instances of this object. When there are multiple instances with the same object name they will appear here. */
$instances?: DataViewObjectMap;
}
export interface DataViewObjectWithId {
id: string;
object: DataViewObject;
}
export interface DataViewObjectPropertyIdentifier {
objectName: string;
propertyName: string;
}
export type DataViewObjectMap = { [id: string]: DataViewObject };
export type DataViewPropertyValue = PrimitiveValue | StructuralObjectValue;
}
declare module powerbi.data {
/** Defines a match against all instances of given roles. */
export interface DataViewRoleWildcard {
kind: DataRepetitionKind.RoleWildcard;
roles: string[];
key: string;
}
}
declare module powerbi.data {
/** Defines a match against all instances of a given DataView scope. Does not match Subtotals. */
export interface DataViewScopeWildcard {
kind: DataRepetitionKind.ScopeWildcard;
exprs: ISQExpr[];
key: string;
}
}
declare module powerbi.data {
import IStringResourceProvider = jsCommon.IStringResourceProvider;
export type DisplayNameGetter = ((resourceProvider: IStringResourceProvider) => string) | string;
}
declare module powerbi.data {
//intentionally blank interfaces since this is not part of the public API
export interface Selector { }
export interface SelectorsByColumn { }
export interface ISemanticFilter { }
export interface ISQExpr { }
export interface ISQConstantExpr extends ISQExpr { }
}
declare namespace powerbi {
/** Kind of the Data Repetition Selector */
export const enum DataRepetitionKind {
RoleWildcard = 0,
ScopeIdentity = 1,
ScopeTotal = 2,
ScopeWildcard = 3,
}
}
declare module powerbi.data {
/** Defines a match against any Total within a given DataView scope. */
export interface DataViewScopeTotal {
kind: DataRepetitionKind.ScopeTotal;
/* The exprs defining the scope that this Total has been evaluated for
* It's an array to support expressing Total across a composite group
* Example: If this represents Total sales of USA across States, the Exprs wil refer to "States"
*/
exprs: ISQExpr[];
key: string;
}
}
declare module powerbi {
export interface DefaultValueDefinition {
value: data.ISQConstantExpr;
identityFieldsValues?: data.ISQConstantExpr[];
}
export interface DefaultValueTypeDescriptor {
defaultValue: boolean;
}
}
declare module powerbi {
import DisplayNameGetter = powerbi.data.DisplayNameGetter;
export type EnumMemberValue = string | number;
export interface IEnumMember {
value: EnumMemberValue;
displayName: DisplayNameGetter;
}
/** Defines a custom enumeration data type, and its values. */
export interface IEnumType {
/** Gets the members of the enumeration, limited to the validMembers, if appropriate. */
members(validMembers?: EnumMemberValue[]): IEnumMember[];
}
}
declare module powerbi {
export interface Fill {
solid?: {
color?: string;
};
gradient?: {
startColor?: string;
endColor?: string;
};
pattern?: {
patternKind?: string;
color?: string;
};
}
export interface FillTypeDescriptor {
solid?: {
color?: FillSolidColorTypeDescriptor;
};
gradient?: {
startColor?: boolean;
endColor?: boolean;
};
pattern?: {
patternKind?: boolean;
color?: boolean;
};
}
export type FillSolidColorTypeDescriptor = boolean | FillSolidColorAdvancedTypeDescriptor;
export interface FillSolidColorAdvancedTypeDescriptor {
/** Indicates whether the color value may be nullable, and a 'no fill' option is appropriate. */
nullable: boolean;
}
}
declare module powerbi {
export interface FillRule extends FillRuleGeneric<string, number, string> {
}
export interface FillRuleTypeDescriptor {
}
export interface FillRuleGeneric<TColor, TValue, TStrategy> {
linearGradient2?: LinearGradient2Generic<TColor, TValue, TStrategy>;
linearGradient3?: LinearGradient3Generic<TColor, TValue, TStrategy>;
// stepped2?
// ...
}
export interface LinearGradient2Generic<TColor, TValue, TStrategy> {
max: RuleColorStopGeneric<TColor, TValue>;
min: RuleColorStopGeneric<TColor, TValue>;
nullColoringStrategy?: NullColoringStrategyGeneric<TStrategy, TColor>;
}
export interface LinearGradient3Generic<TColor, TValue, TStrategy> {
max: RuleColorStopGeneric<TColor, TValue>;
mid: RuleColorStopGeneric<TColor, TValue>;
min: RuleColorStopGeneric<TColor, TValue>;
nullColoringStrategy?: NullColoringStrategyGeneric<TStrategy, TColor>;
}
export interface RuleColorStopGeneric<TColor, TValue> {
color: TColor;
value?: TValue;
}
export interface NullColoringStrategyGeneric<TStrategy, TColor> {
strategy: TStrategy;
/**
* Only used if strategy is specificColor
*/
color?: TColor;
}
}
declare module powerbi {
export interface FilterTypeDescriptor {
selfFilter?: boolean;
}
}
declare module powerbi {
export type GeoJson = GeoJsonDefinitionGeneric<string>;
export interface GeoJsonDefinitionGeneric<T> {
type: T;
name: T;
content: T;
}
export interface GeoJsonTypeDescriptor { }
}
declare module powerbi {
export type ImageValue = ImageDefinitionGeneric<string>;
export interface ImageDefinitionGeneric<T> {
name: T;
url: T;
scaling?: T;
}
export interface ImageTypeDescriptor { }
}
declare module powerbi {
import ISQExpr = powerbi.data.ISQExpr;
export type Paragraphs = Paragraph[];
export interface Paragraph {
horizontalTextAlignment?: string;
textRuns: TextRun[];
}
export interface ParagraphsTypeDescriptor {
}
export interface TextRunStyle {
fontFamily?: string;
fontSize?: string;
fontStyle?: string;
fontWeight?: string;
color?: string;
textDecoration?: string;
}
export interface TextRun {
textStyle?: TextRunStyle;
url?: string;
value: string;
valueExpr?: ISQExpr;
}
}
declare module powerbi {
import SemanticFilter = data.ISemanticFilter;
/** Defines instances of structural types. */
export type StructuralObjectValue =
Fill |
FillRule |
SemanticFilter |
DefaultValueDefinition |
ImageValue |
Paragraphs |
GeoJson |
DataBars;
/** Describes a structural type in the client type system. Leaf properties should use ValueType. */
export interface StructuralTypeDescriptor {
fill?: FillTypeDescriptor;
fillRule?: FillRuleTypeDescriptor;
filter?: FilterTypeDescriptor;
expression?: DefaultValueTypeDescriptor;
image?: ImageTypeDescriptor;
paragraphs?: ParagraphsTypeDescriptor;
geoJson?: GeoJsonTypeDescriptor;
queryTransform?: QueryTransformTypeDescriptor;
dataBars?: DataBarsTypeDescriptor;
//border?: BorderTypeDescriptor;
//etc.
}
}
declare module powerbi {
/** Describes a data value type in the client type system. Can be used to get a concrete ValueType instance. */
export interface ValueTypeDescriptor {
// Simplified primitive types
readonly text?: boolean;
readonly numeric?: boolean;
readonly integer?: boolean;
readonly bool?: boolean;
readonly dateTime?: boolean;
readonly duration?: boolean;
readonly binary?: boolean;
readonly none?: boolean; //TODO: 5005022 remove none type when we introduce property categories.
// Extended types
readonly temporal?: TemporalTypeDescriptor;
readonly geography?: GeographyTypeDescriptor;