1 | declare module jsCommon {
|
2 | /**
|
3 | * DOM constants.
|
4 | */
|
5 | module DOMConstants {
|
6 | /**
|
7 | * Integer codes corresponding to individual keys on the keyboard.
|
8 | */
|
9 | const escKeyCode: number;
|
10 | const enterKeyCode: number;
|
11 | const tabKeyCode: number;
|
12 | const upArrowKeyCode: number;
|
13 | const downArrowKeyCode: number;
|
14 | const leftArrowKeyCode: number;
|
15 | const rightArrowKeyCode: number;
|
16 | const homeKeyCode: number;
|
17 | const endKeyCode: number;
|
18 | const backSpaceKeyCode: number;
|
19 | const deleteKeyCode: number;
|
20 | const spaceKeyCode: number;
|
21 | const shiftKeyCode: number;
|
22 | const ctrlKeyCode: number;
|
23 | const altKeyCode: number;
|
24 | const aKeyCode: number;
|
25 | const cKeyCode: number;
|
26 | const sKeyCode: number;
|
27 | const vKeyCode: number;
|
28 | const wKeyCode: number;
|
29 | const xKeyCode: number;
|
30 | const yKeyCode: number;
|
31 | const zKeyCode: number;
|
32 | /**
|
33 | * DOM Elements.
|
34 | */
|
35 | const DocumentBody: string;
|
36 | const Anchor: string;
|
37 | const EditableTextElements: string;
|
38 | const EditableNumericElements: string;
|
39 | /**
|
40 | * DOM Attributes and values.
|
41 | */
|
42 | const disabledAttributeOrValue: string;
|
43 | const readonlyAttributeOrValue: string;
|
44 | const idAttribute: string;
|
45 | const styleAttribute: string;
|
46 | const hrefAttribute: string;
|
47 | const targetAttribute: string;
|
48 | const blankValue: string;
|
49 | const selfValue: string;
|
50 | const classAttribute: string;
|
51 | const titleAttribute: string;
|
52 | const srcAttribute: string;
|
53 | /**
|
54 | * DOM event names.
|
55 | */
|
56 | const contextmenuEventName: string;
|
57 | const blurEventName: string;
|
58 | const keyUpEventName: string;
|
59 | const inputEventName: string;
|
60 | const changeEventName: string;
|
61 | const cutEventName: string;
|
62 | const keyDownEventName: string;
|
63 | const mouseMoveEventName: string;
|
64 | const mouseDownEventName: string;
|
65 | const mouseEnterEventName: string;
|
66 | const mouseLeaveEventName: string;
|
67 | const mouseOverEventName: string;
|
68 | const mouseOutEventName: string;
|
69 | const mouseClickEventName: string;
|
70 | const pasteEventName: string;
|
71 | const scrollEventName: string;
|
72 | const dropEventName: string;
|
73 | const focusEventName: string;
|
74 | const focusInEventName: string;
|
75 | const focusOutEventName: string;
|
76 | const selectEventName: string;
|
77 | const messageEventName: string;
|
78 | const loadEventName: string;
|
79 | const beforeUnload: string;
|
80 | /**
|
81 | * Common DOM event combination names.
|
82 | */
|
83 | const inputAndSelectEventNames: string;
|
84 | }
|
85 | }
|
86 | declare module powerbi {
|
87 | import IStringResourceProvider = jsCommon.IStringResourceProvider;
|
88 | interface ServiceError {
|
89 | statusCode: number;
|
90 | /**
|
91 | * This error code corresponds with a PowerBIServiceException that happened on the server.
|
92 | */
|
93 | errorCode?: string;
|
94 | /**
|
95 | * Message and stack trace should only be sent in non-production environments.
|
96 | */
|
97 | message?: string;
|
98 | stackTrace?: string;
|
99 | errorDetails?: PowerBIErrorDetail[];
|
100 | parameters?: ErrorParameter[];
|
101 | }
|
102 | interface PowerBIErrorDetail {
|
103 | code: string;
|
104 | detail: PowerBIErrorDetailValue;
|
105 | }
|
106 | interface ErrorParameter {
|
107 | Key: string;
|
108 | Value: string;
|
109 | }
|
110 | interface PowerBIErrorDetailValue {
|
111 | type: PowerBIErrorResourceType;
|
112 | value: string;
|
113 | }
|
114 | enum PowerBIErrorResourceType {
|
115 | ResourceCodeReference = 0,
|
116 | EmbeddedString = 1,
|
117 | }
|
118 | const enum ServiceErrorStatusCode {
|
119 | GeneralError = 0,
|
120 | CsdlFetching = 1,
|
121 | CsdlConvertXmlToConceptualSchema = 2,
|
122 | CsdlCreateClientSchema = 3,
|
123 | ExecuteSemanticQueryError = 4,
|
124 | ExecuteSemanticQueryInvalidStreamFormat = 5,
|
125 | ExecuteSemanticQueryTransformError = 6,
|
126 | }
|
127 | class ServiceErrorToClientError implements IClientError {
|
128 | private m_serviceError;
|
129 | private httpRequestId;
|
130 | private static codeName;
|
131 | code: string;
|
132 | ignorable: boolean;
|
133 | requestId: string;
|
134 | constructor(serviceError: ServiceError);
|
135 | getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
|
136 | }
|
137 | class PowerBIErrorDetailHelper {
|
138 | private static serverErrorPrefix;
|
139 | static addAdditionalInfo(errorDetails: ErrorDetails, pbiErrorDetails: PowerBIErrorDetail[], localize: IStringResourceProvider): ErrorDetails;
|
140 | static addMessageAndStackTrace(errorDetails: ErrorDetails, message: string, stackTrace: string, localize: IStringResourceProvider): ErrorDetails;
|
141 | static GetDetailsFromTransformError(localize: IStringResourceProvider, serviceError: ServiceError): ErrorDetails;
|
142 | static GetDetailsFromServerErrorStatusCode(localize: IStringResourceProvider, statusCode: number): ErrorDetails;
|
143 | }
|
144 | }
|
145 | declare module powerbi {
|
146 | let build: any;
|
147 | }
|
148 | declare module powerbi {
|
149 | const CategoryTypes: {
|
150 | Address: string;
|
151 | City: string;
|
152 | Continent: string;
|
153 | CountryRegion: string;
|
154 | County: string;
|
155 | Longitude: string;
|
156 | Latitude: string;
|
157 | Place: string;
|
158 | PostalCode: string;
|
159 | StateOrProvince: string;
|
160 | };
|
161 | interface IGeoTaggingAnalyzerService {
|
162 | isLongitudeOrLatitude(fieldRefName: string): boolean;
|
163 | isGeographic(fieldRefName: string): boolean;
|
164 | isGeocodable(fieldRefName: string): boolean;
|
165 | getFieldType(fieldName: string): string;
|
166 | isGeoshapable(fieldRefName: string): boolean;
|
167 | }
|
168 | function createGeoTaggingAnalyzerService(getLocalized: (string) => string): IGeoTaggingAnalyzerService;
|
169 | class GeoTaggingAnalyzerService implements IGeoTaggingAnalyzerService {
|
170 | private GeotaggingString_Continent;
|
171 | private GeotaggingString_Continents;
|
172 | private GeotaggingString_Country;
|
173 | private GeotaggingString_Countries;
|
174 | private GeotaggingString_State;
|
175 | private GeotaggingString_States;
|
176 | private GeotaggingString_City;
|
177 | private GeotaggingString_Cities;
|
178 | private GeotaggingString_Town;
|
179 | private GeotaggingString_Towns;
|
180 | private GeotaggingString_Province;
|
181 | private GeotaggingString_Provinces;
|
182 | private GeotaggingString_County;
|
183 | private GeotaggingString_Counties;
|
184 | private GeotaggingString_Village;
|
185 | private GeotaggingString_Villages;
|
186 | private GeotaggingString_Post;
|
187 | private GeotaggingString_Zip;
|
188 | private GeotaggingString_Code;
|
189 | private GeotaggingString_Place;
|
190 | private GeotaggingString_Places;
|
191 | private GeotaggingString_Address;
|
192 | private GeotaggingString_Addresses;
|
193 | private GeotaggingString_Street;
|
194 | private GeotaggingString_Streets;
|
195 | private GeotaggingString_Longitude;
|
196 | private GeotaggingString_Longitude_Short;
|
197 | private GeotaggingString_Latitude;
|
198 | private GeotaggingString_Latitude_Short;
|
199 | private GeotaggingString_PostalCode;
|
200 | private GeotaggingString_PostalCodes;
|
201 | private GeotaggingString_ZipCode;
|
202 | private GeotaggingString_ZipCodes;
|
203 | private GeotaggingString_Territory;
|
204 | private GeotaggingString_Territories;
|
205 | private GeotaggingString_VRMBackCompat_CountryRegion;
|
206 | private GeotaggingString_VRMBackCompat_StateOrProvince;
|
207 | constructor(getLocalized: (string) => string);
|
208 | isLongitudeOrLatitude(fieldRefName: string): boolean;
|
209 | isGeographic(fieldRefName: string): boolean;
|
210 | isGeocodable(fieldRefName: string): boolean;
|
211 | isGeoshapable(fieldRefName: string): boolean;
|
212 | private isGeoshapableEnglish(fieldRefName);
|
213 | private isAddress(fieldRefName);
|
214 | private isPlace(fieldRefName);
|
215 | private isCity(fieldRefName);
|
216 | private isStateOrProvince(fieldRefName);
|
217 | private isCountry(fieldRefName);
|
218 | private isCounty(fieldRefName);
|
219 | private isContinent(fieldRefName);
|
220 | private isPostalCode(fieldRefName);
|
221 | private isLongitude(fieldRefName);
|
222 | private isLatitude(fieldRefName);
|
223 | private isTerritory(fieldRefName);
|
224 | private static hasMatches(fieldName, possibleMatches, useStrict?);
|
225 | getFieldType(fieldName: string): string;
|
226 | private isEnglishAddress(fieldRefName);
|
227 | private isEnglishPlace(fieldRefName);
|
228 | private isEnglishCity(fieldRefName);
|
229 | private isEnglishStateOrProvince(fieldRefName);
|
230 | private isEnglishCountry(fieldRefName);
|
231 | private isEnglishCounty(fieldRefName);
|
232 | private isEnglishContinent(fieldRefName);
|
233 | private isEnglishPostalCode(fieldRefName);
|
234 | private isEnglishLongitude(fieldRefName);
|
235 | private isEnglishLatitude(fieldRefName);
|
236 | protected isEnglishTerritory(fieldRefName: string): boolean;
|
237 | private getEnglishFieldType(fieldName);
|
238 | }
|
239 | }
|
240 | declare var DEBUG: boolean;
|
241 | declare module powerbi {
|
242 | import IStringResourceProvider = jsCommon.IStringResourceProvider;
|
243 | interface ILocalizableError {
|
244 | getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
|
245 | }
|
246 | interface IClientError extends ILocalizableError {
|
247 | code: string;
|
248 | debugInfo?: string;
|
249 | ignorable?: boolean;
|
250 | requestId?: string;
|
251 | }
|
252 | interface IClientWarning extends ILocalizableError {
|
253 | code: string;
|
254 | columnNameFromIndex: (index: number) => string;
|
255 | }
|
256 | /**
|
257 | this base class should be derived to give a generic error message but with a unique error code.
|
258 | */
|
259 | abstract class UnknownClientError implements IClientError {
|
260 | private errorCode;
|
261 | code: string;
|
262 | ignorable: boolean;
|
263 | constructor(code: string);
|
264 | getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
|
265 | }
|
266 | class HttpClientError implements IClientError {
|
267 | private httpRequestId;
|
268 | private httpStatusCode;
|
269 | constructor(httpStatusCode: number, requestId: string);
|
270 | code: string;
|
271 | ignorable: boolean;
|
272 | requestId: string;
|
273 | getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
|
274 | }
|
275 | class IgnorableClientError implements IClientError {
|
276 | code: string;
|
277 | ignorable: boolean;
|
278 | getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
|
279 | }
|
280 | }
|
281 | declare module jsCommon {
|
282 | interface ArrayIdItems<T> extends Array<T> {
|
283 | withId(id: number): T;
|
284 | }
|
285 | interface ArrayNamedItems<T> extends Array<T> {
|
286 | withName(name: string): T;
|
287 | }
|
288 | module ArrayExtensions {
|
289 | /**
|
290 | * Returns items that exist in target and other.
|
291 | */
|
292 | function intersect<T>(target: T[], other: T[]): T[];
|
293 | /**
|
294 | * Return elements exists in target but not exists in other.
|
295 | */
|
296 | function diff<T>(target: T[], other: T[]): T[];
|
297 | /**
|
298 | * Return an array with only the distinct items in the source.
|
299 | */
|
300 | function distinct<T>(source: T[]): T[];
|
301 | /**
|
302 | * Pushes content of source onto target,
|
303 | * for parts of course that do not already exist in target.
|
304 | */
|
305 | function union<T>(target: T[], source: T[]): void;
|
306 | /**
|
307 | * Pushes value onto target, if value does not already exist in target.
|
308 | */
|
309 | function unionSingle<T>(target: T[], value: T): void;
|
310 | /**
|
311 | * Returns an array with a range of items from source,
|
312 | * including the startIndex & endIndex.
|
313 | */
|
314 | function range<T>(source: T[], startIndex: number, endIndex: number): T[];
|
315 | /**
|
316 | * Returns an array that includes items from source, up to the specified count.
|
317 | */
|
318 | function take<T>(source: T[], count: number): T[];
|
319 | function copy<T>(source: T[]): T[];
|
320 | /**
|
321 | * Returns a value indicating whether the arrays have the same values in the same sequence.
|
322 | */
|
323 | function sequenceEqual<T>(left: T[], right: T[], comparison: (x: T, y: T) => boolean): boolean;
|
324 | /**
|
325 | * Returns null if the specified array is empty.
|
326 | * Otherwise returns the specified array.
|
327 | */
|
328 | function emptyToNull<T>(array: T[]): T[];
|
329 | function indexOf<T>(array: T[], predicate: (T) => boolean): number;
|
330 | /**
|
331 | * Returns a copy of the array rotated by the specified offset.
|
332 | */
|
333 | function rotate<T>(array: T[], offset: number): T[];
|
334 | function createWithId<T>(): ArrayIdItems<T>;
|
335 | function extendWithId<T>(array: {
|
336 | id: number;
|
337 | }[]): ArrayIdItems<T>;
|
338 | /**
|
339 | * Finds and returns the first item with a matching ID.
|
340 | */
|
341 | function findWithId<T>(array: T[], id: number): T;
|
342 | function createWithName<T>(): ArrayNamedItems<T>;
|
343 | function extendWithName<T>(array: {
|
344 | name: string;
|
345 | }[]): ArrayNamedItems<T>;
|
346 | function findItemWithName<T>(array: T[], name: string): T;
|
347 | function indexWithName<T>(array: T[], name: string): number;
|
348 | /**
|
349 | * Inserts a number in sorted order into a list of numbers already in sorted order.
|
350 | * @returns True if the item was added, false if it already existed.
|
351 | */
|
352 | function insertSorted(list: number[], value: number): boolean;
|
353 | /**
|
354 | * Removes the first occurrence of a value from a list if it exists.
|
355 | * @returns True if the value was removed, false if it did not exist in the list.
|
356 | */
|
357 | function removeFirst<T>(list: T[], value: T): boolean;
|
358 | /**
|
359 | * Deletes all items from the array.
|
360 | */
|
361 | function clear(array: any[]): void;
|
362 | function isUndefinedOrEmpty(array: any[]): boolean;
|
363 | function swap<T>(array: T[], firstIndex: number, secondIndex: number): void;
|
364 | function isInArray<T>(array: T[], lookupItem: T, compareCallback: (item1: T, item2: T) => boolean): boolean;
|
365 | /** Checks if the given object is an Array, and looking all the way up the prototype chain. */
|
366 | function isArrayOrInheritedArray(obj: {}): obj is Array<any>;
|
367 | }
|
368 | }
|
369 | declare module InJs {
|
370 | module DomFactory {
|
371 | function div(): JQuery;
|
372 | function span(): JQuery;
|
373 | function checkbox(): JQuery;
|
374 | function ul(): JQuery;
|
375 | function li(): JQuery;
|
376 | function button(): JQuery;
|
377 | function select(): JQuery;
|
378 | function textBox(): JQuery;
|
379 | function img(): JQuery;
|
380 | function iframe(): JQuery;
|
381 | }
|
382 | }
|
383 | declare module powerbi {
|
384 | /**
|
385 | * Module Double contains a set of constants and precision based utility methods
|
386 | * for dealing with doubles and their decimal garbage in the javascript.
|
387 | */
|
388 | module Double {
|
389 | const MIN_VALUE: number;
|
390 | const MAX_VALUE: number;
|
391 | const MIN_EXP: number;
|
392 | const MAX_EXP: number;
|
393 | const EPSILON: number;
|
394 | const DEFAULT_PRECISION: number;
|
395 | const DEFAULT_PRECISION_IN_DECIMAL_DIGITS: number;
|
396 | const LOG_E_10: number;
|
397 | const POSITIVE_POWERS: number[];
|
398 | const NEGATIVE_POWERS: number[];
|
399 | /**
|
400 | * Returns powers of 10.
|
401 | * Unlike the Math.pow this function produces no decimal garbage.
|
402 | * @param exp Exponent.
|
403 | */
|
404 | function pow10(exp: number): number;
|
405 | /**
|
406 | * Returns the 10 base logarithm of the number.
|
407 | * Unlike Math.log function this produces integer results with no decimal garbage.
|
408 | * @param val Positive value or zero.
|
409 | */
|
410 | function log10(val: number): number;
|
411 | /**
|
412 | * Returns a power of 10 representing precision of the number based on the number of meaningful decimal digits.
|
413 | * For example the precision of 56,263.3767 with the 6 meaningful decimal digit is 0.1.
|
414 | * @param x Value.
|
415 | * @param decimalDigits How many decimal digits are meaningfull.
|
416 | */
|
417 | function getPrecision(x: number, decimalDigits?: number): number;
|
418 | /**
|
419 | * Checks if a delta between 2 numbers is less than provided precision.
|
420 | * @param x One value.
|
421 | * @param y Another value.
|
422 | * @param precision Precision value.
|
423 | */
|
424 | function equalWithPrecision(x: number, y: number, precision?: number): boolean;
|
425 | /**
|
426 | * Checks if a first value is less than another taking
|
427 | * into account the loose precision based equality.
|
428 | * @param x One value.
|
429 | * @param y Another value.
|
430 | * @param precision Precision value.
|
431 | */
|
432 | function lessWithPrecision(x: number, y: number, precision?: number): boolean;
|
433 | /**
|
434 | * Checks if a first value is less or equal than another taking
|
435 | * into account the loose precision based equality.
|
436 | * @param x One value.
|
437 | * @param y Another value.
|
438 | * @param precision Precision value.
|
439 | */
|
440 | function lessOrEqualWithPrecision(x: number, y: number, precision?: number): boolean;
|
441 | /**
|
442 | * Checks if a first value is greater than another taking
|
443 | * into account the loose precision based equality.
|
444 | * @param x One value.
|
445 | * @param y Another value.
|
446 | * @param precision Precision value.
|
447 | */
|
448 | function greaterWithPrecision(x: number, y: number, precision?: number): boolean;
|
449 | /**
|
450 | * Checks if a first value is greater or equal to another taking
|
451 | * into account the loose precision based equality.
|
452 | * @param x One value.
|
453 | * @param y Another value.
|
454 | * @param precision Precision value.
|
455 | */
|
456 | function greaterOrEqualWithPrecision(x: number, y: number, precision?: number): boolean;
|
457 | /**
|
458 | * Floors the number unless it's withing the precision distance from the higher int.
|
459 | * @param x One value.
|
460 | * @param precision Precision value.
|
461 | */
|
462 | function floorWithPrecision(x: number, precision?: number): number;
|
463 | /**
|
464 | * Ceils the number unless it's withing the precision distance from the lower int.
|
465 | * @param x One value.
|
466 | * @param precision Precision value.
|
467 | */
|
468 | function ceilWithPrecision(x: number, precision?: number): number;
|
469 | /**
|
470 | * Floors the number to the provided precision.
|
471 | * For example 234,578 floored to 1,000 precision is 234,000.
|
472 | * @param x One value.
|
473 | * @param precision Precision value.
|
474 | */
|
475 | function floorToPrecision(x: number, precision?: number): number;
|
476 | /**
|
477 | * Ceils the number to the provided precision.
|
478 | * For example 234,578 floored to 1,000 precision is 235,000.
|
479 | * @param x One value.
|
480 | * @param precision Precision value.
|
481 | */
|
482 | function ceilToPrecision(x: number, precision?: number): number;
|
483 | /**
|
484 | * Rounds the number to the provided precision.
|
485 | * For example 234,578 floored to 1,000 precision is 235,000.
|
486 | * @param x One value.
|
487 | * @param precision Precision value.
|
488 | */
|
489 | function roundToPrecision(x: number, precision?: number): number;
|
490 | /**
|
491 | * Returns the value making sure that it's restricted to the provided range.
|
492 | * @param x One value.
|
493 | * @param min Range min boundary.
|
494 | * @param max Range max boundary.
|
495 | */
|
496 | function ensureInRange(x: number, min: number, max: number): number;
|
497 | /**
|
498 | * Rounds the value - this method is actually faster than Math.round - used in the graphics utils.
|
499 | * @param x Value to round.
|
500 | */
|
501 | function round(x: number): number;
|
502 | /**
|
503 | * Projects the value from the source range into the target range.
|
504 | * @param value Value to project.
|
505 | * @param fromMin Minimum of the source range.
|
506 | * @param toMin Minimum of the target range.
|
507 | * @param toMax Maximum of the target range.
|
508 | */
|
509 | function project(value: number, fromMin: number, fromSize: number, toMin: number, toSize: number): number;
|
510 | /**
|
511 | * Removes decimal noise.
|
512 | * @param value Value to be processed.
|
513 | */
|
514 | function removeDecimalNoise(value: number): number;
|
515 | /**
|
516 | * Checks whether the number is integer.
|
517 | * @param value Value to be checked.
|
518 | */
|
519 | function isInteger(value: number): boolean;
|
520 | /**
|
521 | * Dividing by increment will give us count of increments
|
522 | * Round out the rough edges into even integer
|
523 | * Multiply back by increment to get rounded value
|
524 | * e.g. Rounder.toIncrement(0.647291, 0.05) => 0.65
|
525 | * @param value - value to round to nearest increment
|
526 | * @param increment - smallest increment to round toward
|
527 | */
|
528 | function toIncrement(value: number, increment: number): number;
|
529 | }
|
530 | }
|
531 | declare module jsCommon {
|
532 | module Color {
|
533 | function rotate(rgbString: string, rotateFactor: number): string;
|
534 | function normalizeToHexString(color: string): string;
|
535 | function parseColorString(color: string): RgbColor;
|
536 | function darken(color: RgbColor, diff: number): RgbColor;
|
537 | function rgbString(color: RgbColor): string;
|
538 | function hexString(color: RgbColor): string;
|
539 | interface RgbColor {
|
540 | R: number;
|
541 | G: number;
|
542 | B: number;
|
543 | A?: number;
|
544 | }
|
545 | }
|
546 | }
|
547 | declare module jsCommon {
|
548 | /**
|
549 | * CSS constants.
|
550 | */
|
551 | module CssConstants {
|
552 | interface ClassAndSelector {
|
553 | class: string;
|
554 | selector: string;
|
555 | }
|
556 | function createClassAndSelector(className: string): ClassAndSelector;
|
557 | const styleAttribute: string;
|
558 | const pixelUnits: string;
|
559 | const heightProperty: string;
|
560 | const widthProperty: string;
|
561 | const topProperty: string;
|
562 | const bottomProperty: string;
|
563 | const leftProperty: string;
|
564 | const rightProperty: string;
|
565 | const marginTopProperty: string;
|
566 | const marginLeftProperty: string;
|
567 | const displayProperty: string;
|
568 | const backgroundProperty: string;
|
569 | const backgroundColorProperty: string;
|
570 | const backgroundRepeatProperty: string;
|
571 | const backgroundSizeProperty: string;
|
572 | const backgroundImageProperty: string;
|
573 | const textShadowProperty: string;
|
574 | const textAlignProperty: string;
|
575 | const borderTopWidthProperty: string;
|
576 | const borderBottomWidthProperty: string;
|
577 | const borderLeftWidthProperty: string;
|
578 | const borderRightWidthProperty: string;
|
579 | const fontSizeProperty: string;
|
580 | const fontWeightProperty: string;
|
581 | const colorProperty: string;
|
582 | const opacityProperty: string;
|
583 | const paddingLeftProperty: string;
|
584 | const paddingRightProperty: string;
|
585 | const positionProperty: string;
|
586 | const maxWidthProperty: string;
|
587 | const minWidthProperty: string;
|
588 | const overflowProperty: string;
|
589 | const overflowXProperty: string;
|
590 | const overflowYProperty: string;
|
591 | const transformProperty: string;
|
592 | const webkitTransformProperty: string;
|
593 | const cursorProperty: string;
|
594 | const visibilityProperty: string;
|
595 | const absoluteValue: string;
|
596 | const zeroPixelValue: string;
|
597 | const autoValue: string;
|
598 | const hiddenValue: string;
|
599 | const noneValue: string;
|
600 | const blockValue: string;
|
601 | const inlineBlockValue: string;
|
602 | const transparentValue: string;
|
603 | const boldValue: string;
|
604 | const visibleValue: string;
|
605 | const tableRowValue: string;
|
606 | const coverValue: string;
|
607 | const pointerValue: string;
|
608 | const scrollValue: string;
|
609 | }
|
610 | interface ExtendedCSSProperties extends CSSStyleDeclaration {
|
611 | scrollbarShadowColor: string;
|
612 | scrollbarHighlightColor: string;
|
613 | layoutGridChar: string;
|
614 | layoutGridType: string;
|
615 | textAutospace: string;
|
616 | textKashidaSpace: string;
|
617 | writingMode: string;
|
618 | scrollbarFaceColor: string;
|
619 | backgroundPositionY: string;
|
620 | lineBreak: string;
|
621 | imeMode: string;
|
622 | msBlockProgression: string;
|
623 | layoutGridLine: string;
|
624 | scrollbarBaseColor: string;
|
625 | layoutGrid: string;
|
626 | layoutFlow: string;
|
627 | textKashida: string;
|
628 | filter: string;
|
629 | zoom: string;
|
630 | scrollbarArrowColor: string;
|
631 | behavior: string;
|
632 | backgroundPositionX: string;
|
633 | accelerator: string;
|
634 | layoutGridMode: string;
|
635 | textJustifyTrim: string;
|
636 | scrollbar3dLightColor: string;
|
637 | msInterpolationMode: string;
|
638 | scrollbarTrackColor: string;
|
639 | scrollbarDarkShadowColor: string;
|
640 | styleFloat: string;
|
641 | getAttribute(attributeName: string, flags?: number): any;
|
642 | setAttribute(attributeName: string, AttributeValue: any, flags?: number): void;
|
643 | removeAttribute(attributeName: string, flags?: number): boolean;
|
644 | pixelWidth: number;
|
645 | posHeight: number;
|
646 | posLeft: number;
|
647 | pixelTop: number;
|
648 | pixelBottom: number;
|
649 | textDecorationNone: boolean;
|
650 | pixelLeft: number;
|
651 | posTop: number;
|
652 | posBottom: number;
|
653 | textDecorationOverline: boolean;
|
654 | posWidth: number;
|
655 | textDecorationLineThrough: boolean;
|
656 | pixelHeight: number;
|
657 | textDecorationBlink: boolean;
|
658 | posRight: number;
|
659 | pixelRight: number;
|
660 | textDecorationUnderline: boolean;
|
661 | webkitTransform: string;
|
662 | }
|
663 | }
|
664 | /**
|
665 | * Defines a Debug object. Calls to any functions in this object removed by the minifier.
|
666 | * The functions within this class are not minified away, so we use the preprocessor-style
|
667 | * comments to have the minifier remove those as well.
|
668 | */
|
669 | declare module debug {
|
670 | let assertFailFunction: {
|
671 | (message: string): void;
|
672 | };
|
673 | /**
|
674 | * Asserts that the condition is true, fails otherwise.
|
675 | */
|
676 | function assert(condition: boolean, message: string): void;
|
677 | /**
|
678 | * Asserts that the value is neither null nor undefined, fails otherwise.
|
679 | */
|
680 | function assertValue<T>(value: T, message: string): void;
|
681 | /**
|
682 | * Asserts that the value is neither null nor undefined, and has a length property that returns greater than zero, fails otherwise.
|
683 | */
|
684 | function assertNonEmpty<T>(value: T[], message: string): void;
|
685 | /**
|
686 | * Makes no assertion on the given value.
|
687 | * This is documentation/placeholder that a value is possibly null or undefined (unlike assertValue).
|
688 | */
|
689 | function assertAnyValue<T>(value: T, message: string): void;
|
690 | function assertFail(message: string): void;
|
691 | }
|
692 | declare module jsCommon {
|
693 | interface IError extends Error {
|
694 | stack?: string;
|
695 | argument?: string;
|
696 | }
|
697 | module Errors {
|
698 | function infoNavAppAlreadyPresent(): IError;
|
699 | function invalidOperation(message: string): IError;
|
700 | function argument(argumentName: string, message: string): IError;
|
701 | function argumentNull(argumentName: string): IError;
|
702 | function argumentUndefined(argumentName: string): IError;
|
703 | function argumentOutOfRange(argumentName: string): IError;
|
704 | function pureVirtualMethodException(className: string, methodName: string): IError;
|
705 | function notImplementedException(message: string): IError;
|
706 | }
|
707 | /**
|
708 | * Captures the stack trace, if available.
|
709 | * It optionally takes the number of frames to remove from the stack trace.
|
710 | * By default, it removes the last frame to consider the calling type's
|
711 | * constructor and the temporary error used to capture the stack trace (below).
|
712 | * More levels can be requested as needed e..g. when an error is created
|
713 | * from a helper method. <Min requirement: IE10, Chrome, Firefox, Opera>.
|
714 | */
|
715 | function getStackTrace(leadingFramesToRemove?: number): string;
|
716 | }
|
717 | declare module jsCommon {
|
718 | /**
|
719 | * Represents a promise that may be rejected by its consumer.
|
720 | */
|
721 | interface IRejectablePromise extends JQueryPromise<void> {
|
722 | reject(...args: any[]): void;
|
723 | }
|
724 | module JQueryConstants {
|
725 | const VisibleSelector: string;
|
726 | }
|
727 | }
|
728 | declare module jsCommon {
|
729 | /**
|
730 | * Represents a lazily instantiated value.
|
731 | */
|
732 | class Lazy<T> {
|
733 | private value;
|
734 | private factoryMethod;
|
735 | constructor(factoryMethod: () => T);
|
736 | getValue(): T;
|
737 | }
|
738 | }
|
739 | declare module powerbi {
|
740 | module Prototype {
|
741 | /**
|
742 | * Returns a new object with the provided obj as its prototype.
|
743 | */
|
744 | function inherit<T>(obj: T, extension?: (inherited: T) => void): T;
|
745 | /**
|
746 | * Returns a new object with the provided obj as its prototype
|
747 | * if, and only if, the prototype has not been previously set
|
748 | */
|
749 | function inheritSingle<T>(obj: T): T;
|
750 | /**
|
751 | * Uses the provided callback function to selectively replace contents in the provided array.
|
752 | * @return A new array with those values overriden
|
753 | * or undefined if no overrides are necessary.
|
754 | */
|
755 | function overrideArray<T, TArray>(prototype: TArray, override: (T) => T): TArray;
|
756 | }
|
757 | }
|
758 | interface ScriptErrorInfo {
|
759 | message: string;
|
760 | sourceUrl: string;
|
761 | lineNumber: number;
|
762 | columnNumber: number;
|
763 | stack: string;
|
764 | }
|
765 | interface ErrorInfoKeyValuePair {
|
766 | errorInfoKey: string;
|
767 | errorInfoValue: string;
|
768 | }
|
769 | declare const enum ErrorType {
|
770 | VisualNotSupported = 1,
|
771 | }
|
772 | interface ErrorDetails {
|
773 | message: string;
|
774 | additionalErrorInfo: ErrorInfoKeyValuePair[];
|
775 | helpLink?: string;
|
776 | errorType?: ErrorType;
|
777 | }
|
778 | declare module powerbi.visuals {
|
779 | module shapes {
|
780 | interface IPolygon {
|
781 | absoluteCentroid: IPoint;
|
782 | polygonPoints: IPoint[];
|
783 | }
|
784 | interface IPoint {
|
785 | x: number;
|
786 | y: number;
|
787 | }
|
788 | interface ISize {
|
789 | width: number;
|
790 | height: number;
|
791 | }
|
792 | interface IVector {
|
793 | x: number;
|
794 | y: number;
|
795 | }
|
796 | interface IThickness {
|
797 | top: number;
|
798 | left: number;
|
799 | right: number;
|
800 | bottom: number;
|
801 | }
|
802 | }
|
803 | }
|
804 | declare module jsCommon {
|
805 | module Formatting {
|
806 | /**
|
807 | * Translate .NET format into something supported by jQuery.Globalize.
|
808 | */
|
809 | function findDateFormat(value: Date, format: string, cultureName: string): {
|
810 | value: Date;
|
811 | format: string;
|
812 | };
|
813 | /**
|
814 | * Translates unsupported .NET custom format expressions to the custom expressions supported by JQuery.Globalize.
|
815 | */
|
816 | function fixDateTimeFormat(format: string): string;
|
817 | }
|
818 | }
|
819 | declare module jsCommon {
|
820 | /**
|
821 | * Public API.
|
822 | */
|
823 | interface IJavaScriptDependency {
|
824 | javascriptFile: string;
|
825 | onLoadCallback?: () => JQueryPromise<void>;
|
826 | }
|
827 | interface IDependency {
|
828 | javaScriptFiles?: string[];
|
829 | cssFiles?: string[];
|
830 | javaScriptFilesWithCallback?: IJavaScriptDependency[];
|
831 | }
|
832 | function requires(dependency: IDependency, to?: () => void): void;
|
833 | }
|
834 | declare module powerbi {
|
835 | function createJQueryPromiseFactory(): IPromiseFactory;
|
836 | }
|
837 | declare module powerbi {
|
838 | interface IStorageService {
|
839 | getData(key: string): any;
|
840 | setData(key: string, data: any): void;
|
841 | }
|
842 | class EphemeralStorageService implements IStorageService {
|
843 | private cache;
|
844 | private clearCacheTimerId;
|
845 | private clearCacheInterval;
|
846 | static defaultClearCacheInterval: number;
|
847 | constructor(clearCacheInterval?: number);
|
848 | getData(key: string): any;
|
849 | setData(key: string, data: any): void;
|
850 | private clearCache();
|
851 | }
|
852 | var localStorageService: IStorageService;
|
853 | const ephemeralStorageService: IStorageService;
|
854 | }
|
855 | declare module jsCommon {
|
856 | module WordBreaker {
|
857 | import TextProperties = powerbi.TextProperties;
|
858 | import ITextAsSVGMeasurer = powerbi.ITextAsSVGMeasurer;
|
859 | import ITextTruncator = powerbi.ITextTruncator;
|
860 | interface WordBreakerResult {
|
861 | start: number;
|
862 | end: number;
|
863 | }
|
864 | /**
|
865 | * Find the word nearest the cursor specified within content
|
866 | * @param index - point within content to search forward/backward from
|
867 | * @param content - string to search
|
868 | */
|
869 | function find(index: number, content: string): WordBreakerResult;
|
870 | /**
|
871 | * Test for presence of breakers within content
|
872 | * @param content - string to test
|
873 | */
|
874 | function hasBreakers(content: string): boolean;
|
875 | /**
|
876 | * Count the number of pieces when broken by BREAKERS_REGEX
|
877 | * ~2.7x faster than WordBreaker.split(content).length
|
878 | * @param content - string to break and count
|
879 | */
|
880 | function wordCount(content: string): number;
|
881 | function getMaxWordWidth(content: string, textWidthMeasurer: ITextAsSVGMeasurer, properties: TextProperties): number;
|
882 | /**
|
883 | * Split content by breakers (words) and greedy fit as many words
|
884 | * into each index in the result based on max width and number of lines
|
885 | * e.g. Each index in result corresponds to a line of content
|
886 | * when used by AxisHelper.LabelLayoutStrategy.wordBreak
|
887 | * @param content - string to split
|
888 | * @param properties - text properties to be used by @param:textWidthMeasurer
|
889 | * @param textWidthMeasurer - function to calculate width of given text content
|
890 | * @param maxWidth - maximum allowed width of text content in each result
|
891 | * @param maxNumLines - maximum number of results we will allow, valid values must be greater than 0
|
892 | * @param truncator - (optional) if specified, used as a function to truncate content to a given width
|
893 | */
|
894 | function splitByWidth(content: string, properties: TextProperties, textWidthMeasurer: ITextAsSVGMeasurer, maxWidth: number, maxNumLines: number, truncator?: ITextTruncator): string[];
|
895 | }
|
896 | }
|
897 | declare module powerbi {
|
898 | interface ITextMeasurer {
|
899 | (textElement: SVGTextElement): number;
|
900 | }
|
901 | interface ITextAsSVGMeasurer {
|
902 | (textProperties: TextProperties): number;
|
903 | }
|
904 | interface ITextTruncator {
|
905 | (properties: TextProperties, maxWidth: number): string;
|
906 | }
|
907 | interface TextProperties {
|
908 | text?: string;
|
909 | fontFamily: string;
|
910 | fontSize: string;
|
911 | fontWeight?: string;
|
912 | fontStyle?: string;
|
913 | fontVariant?: string;
|
914 | whiteSpace?: string;
|
915 | }
|
916 | module TextMeasurementService {
|
917 | /**
|
918 | * Removes spanElement from DOM.
|
919 | */
|
920 | function removeSpanElement(): void;
|
921 | /**
|
922 | * This method measures the width of the text with the given SVG text properties.
|
923 | * @param textProperties The text properties to use for text measurement.
|
924 | */
|
925 | function measureSvgTextWidth(textProperties: TextProperties): number;
|
926 | /**
|
927 | * This method return the rect with the given SVG text properties.
|
928 | * @param textProperties The text properties to use for text measurement.
|
929 | */
|
930 | function measureSvgTextRect(textProperties: TextProperties): SVGRect;
|
931 | /**
|
932 | * This method measures the height of the text with the given SVG text properties.
|
933 | * @param textProperties The text properties to use for text measurement.
|
934 | */
|
935 | function measureSvgTextHeight(textProperties: TextProperties): number;
|
936 | /**
|
937 | * This method returns the text Rect with the given SVG text properties.
|
938 | * @param {TextProperties} textProperties - The text properties to use for text measurement
|
939 | */
|
940 | function estimateSvgTextBaselineDelta(textProperties: TextProperties): number;
|
941 | /**
|
942 | * This method estimates the height of the text with the given SVG text properties.
|
943 | * @param {TextProperties} textProperties - The text properties to use for text measurement
|
944 | */
|
945 | function estimateSvgTextHeight(textProperties: TextProperties, tightFightForNumeric?: boolean): number;
|
946 | /**
|
947 | * This method measures the width of the svgElement.
|
948 | * @param svgElement The SVGTextElement to be measured.
|
949 | */
|
950 | function measureSvgTextElementWidth(svgElement: SVGTextElement): number;
|
951 | /**
|
952 | * This method fetches the text measurement properties of the given DOM element.
|
953 | * @param element The selector for the DOM Element.
|
954 | */
|
955 | function getMeasurementProperties(element: JQuery): TextProperties;
|
956 | /**
|
957 | * This method fetches the text measurement properties of the given SVG text element.
|
958 | * @param svgElement The SVGTextElement to be measured.
|
959 | */
|
960 | function getSvgMeasurementProperties(svgElement: SVGTextElement): TextProperties;
|
961 | /**
|
962 | * This method returns the width of a div element.
|
963 | * @param element The div element.
|
964 | */
|
965 | function getDivElementWidth(element: JQuery): string;
|
966 | /**
|
967 | * Compares labels text size to the available size and renders ellipses when the available size is smaller.
|
968 | * @param textProperties The text properties (including text content) to use for text measurement.
|
969 | * @param maxWidth The maximum width available for rendering the text.
|
970 | */
|
971 | function getTailoredTextOrDefault(textProperties: TextProperties, maxWidth: number): string;
|
972 | /**
|
973 | * Compares labels text size to the available size and renders ellipses when the available size is smaller.
|
974 | * @param textElement The SVGTextElement containing the text to render.
|
975 | * @param maxWidth The maximum width available for rendering the text.
|
976 | */
|
977 | function svgEllipsis(textElement: SVGTextElement, maxWidth: number): void;
|
978 | /**
|
979 | * Word break textContent of <text> SVG element into <tspan>s
|
980 | * Each tspan will be the height of a single line of text
|
981 | * @param textElement - the SVGTextElement containing the text to wrap
|
982 | * @param maxWidth - the maximum width available
|
983 | * @param maxHeight - the maximum height available (defaults to single line)
|
984 | * @param linePadding - (optional) padding to add to line height
|
985 | */
|
986 | function wordBreak(textElement: SVGTextElement, maxWidth: number, maxHeight: number, linePadding?: number): void;
|
987 | /**
|
988 | * Word break textContent of span element into <span>s
|
989 | * Each span will be the height of a single line of text
|
990 | * @param textElement - the element containing the text to wrap
|
991 | * @param maxWidth - the maximum width available
|
992 | * @param maxHeight - the maximum height available (defaults to single line)
|
993 | * @param linePadding - (optional) padding to add to line height
|
994 | */
|
995 | function wordBreakOverflowingText(textElement: any, maxWidth: number, maxHeight: number, linePadding?: number): void;
|
996 | }
|
997 | }
|
998 | declare module jsCommon {
|
999 | module KeyUtils {
|
1000 | function isArrowKey(keyCode: number): boolean;
|
1001 | }
|
1002 | }
|
1003 | declare module jsCommon {
|
1004 | /**
|
1005 | * Responsible for throttling input function.
|
1006 | */
|
1007 | class ThrottleUtility {
|
1008 | private fn;
|
1009 | private timerFactory;
|
1010 | private delay;
|
1011 | constructor(delay?: number);
|
1012 | run(fn: () => void): void;
|
1013 | /**
|
1014 | * Note: Public for testing purpose.
|
1015 | */
|
1016 | timerComplete(fn: () => void): void;
|
1017 | }
|
1018 | }
|
1019 | declare module jsCommon {
|
1020 | interface ITimerPromiseFactory {
|
1021 | /**
|
1022 | * Creates a promise that will be resolved after the specified delayInMs.
|
1023 | * @return Promise.
|
1024 | */
|
1025 | create(delayInMs: number): IRejectablePromise;
|
1026 | }
|
1027 | /**
|
1028 | * Responsible for creating timer promises.
|
1029 | */
|
1030 | class TimerPromiseFactory implements ITimerPromiseFactory {
|
1031 | static instance: TimerPromiseFactory;
|
1032 | /**
|
1033 | * {@inheritDoc}
|
1034 | */
|
1035 | create(delayInMs: number): IRejectablePromise;
|
1036 | }
|
1037 | }
|
1038 | /**
|
1039 | * Defined in host.
|
1040 | */
|
1041 | declare var clusterUri: string;
|
1042 | declare module jsCommon {
|
1043 | /**
|
1044 | * Http Status code we are interested.
|
1045 | */
|
1046 | enum HttpStatusCode {
|
1047 | OK = 200,
|
1048 | BadRequest = 400,
|
1049 | Unauthorized = 401,
|
1050 | Forbidden = 403,
|
1051 | RequestEntityTooLarge = 413,
|
1052 | }
|
1053 | /**
|
1054 | * Other HTTP Constants.
|
1055 | */
|
1056 | module HttpConstants {
|
1057 | const ApplicationOctetStream: string;
|
1058 | const MultiPartFormData: string;
|
1059 | }
|
1060 | /**
|
1061 | * Extensions to String class.
|
1062 | */
|
1063 | module StringExtensions {
|
1064 | function format(...args: string[]): string;
|
1065 | /**
|
1066 | * Compares two strings for equality, ignoring case.
|
1067 | */
|
1068 | function equalIgnoreCase(a: string, b: string): boolean;
|
1069 | function startsWithIgnoreCase(a: string, b: string): boolean;
|
1070 | function startsWith(a: string, b: string): boolean;
|
1071 | /** Determines whether a string contains a specified substring (while ignoring case). */
|
1072 | function containsIgnoreCase(source: string, substring: string): boolean;
|
1073 | /**
|
1074 | * Normalizes case for a string.
|
1075 | * Used by equalIgnoreCase method.
|
1076 | */
|
1077 | function normalizeCase(value: string): string;
|
1078 | /**
|
1079 | * Is string null or empty or undefined?
|
1080 | * @return True if the value is null or undefined or empty string,
|
1081 | * otherwise false.
|
1082 | */
|
1083 | function isNullOrEmpty(value: string): boolean;
|
1084 | /**
|
1085 | * Returns true if the string is null, undefined, empty, or only includes white spaces.
|
1086 | * @return True if the str is null, undefined, empty, or only includes white spaces,
|
1087 | * otherwise false.
|
1088 | */
|
1089 | function isNullOrUndefinedOrWhiteSpaceString(str: string): boolean;
|
1090 | /**
|
1091 | * Returns a value indicating whether the str contains any whitespace.
|
1092 | */
|
1093 | function containsWhitespace(str: string): boolean;
|
1094 | /**
|
1095 | * Returns a value indicating whether the str is a whitespace string.
|
1096 | */
|
1097 | function isWhitespace(str: string): boolean;
|
1098 | /**
|
1099 | * Returns the string with any trailing whitespace from str removed.
|
1100 | */
|
1101 | function trimTrailingWhitespace(str: string): string;
|
1102 | /**
|
1103 | * Returns the string with any leading and trailing whitespace from str removed.
|
1104 | */
|
1105 | function trimWhitespace(str: string): string;
|
1106 | /**
|
1107 | * Returns length difference between the two provided strings.
|
1108 | */
|
1109 | function getLengthDifference(left: string, right: string): number;
|
1110 | /**
|
1111 | * Repeat char or string several times.
|
1112 | * @param char The string to repeat.
|
1113 | * @param count How many times to repeat the string.
|
1114 | */
|
1115 | function repeat(char: string, count: number): string;
|
1116 | /**
|
1117 | * Replace all the occurrences of the textToFind in the text with the textToReplace.
|
1118 | * @param text The original string.
|
1119 | * @param textToFind Text to find in the original string.
|
1120 | * @param textToReplace New text replacing the textToFind.
|
1121 | */
|
1122 | function replaceAll(text: string, textToFind: string, textToReplace: string): string;
|
1123 | function ensureUniqueNames(names: string[]): string[];
|
1124 | /**
|
1125 | * Returns a name that is not specified in the values.
|
1126 | */
|
1127 | function findUniqueName(usedNames: {
|
1128 | [name: string]: boolean;
|
1129 | }, baseName: string): string;
|
1130 | function constructCommaSeparatedList(list: string[], resourceProvider: IStringResourceProvider, maxValue?: number): string;
|
1131 | function escapeStringForRegex(s: string): string;
|
1132 | /**
|
1133 | * Remove file name reserved characters <>:"/\|?* from input string.
|
1134 | */
|
1135 | function normalizeFileName(fileName: string): string;
|
1136 | /**
|
1137 | * Similar to JSON.stringify, but strips away escape sequences so that the resulting
|
1138 | * string is human-readable (and parsable by JSON formatting/validating tools).
|
1139 | */
|
1140 | function stringifyAsPrettyJSON(object: any): string;
|
1141 | /**
|
1142 | * Derive a CLS-compliant name from a specified string. If no allowed characters are present, return a fallback string instead.
|
1143 | * TODO (6708134): this should have a fully Unicode-aware implementation
|
1144 | */
|
1145 | function deriveClsCompliantName(input: string, fallback: string): string;
|
1146 | /** Performs cheap sanitization by stripping away HTML tag (<>) characters. */
|
1147 | function stripTagDelimiters(s: string): string;
|
1148 | }
|
1149 | /**
|
1150 | * Interface used for interacting with WCF typed objects.
|
1151 | */
|
1152 | interface TypedObject {
|
1153 | __type: string;
|
1154 | }
|
1155 | interface TextMatch {
|
1156 | start: number;
|
1157 | end: number;
|
1158 | text: string;
|
1159 | }
|
1160 | /**
|
1161 | * The general utility class.
|
1162 | */
|
1163 | class Utility {
|
1164 | private static TypeNamespace;
|
1165 | static JsonContentType: string;
|
1166 | static JpegContentType: string;
|
1167 | static XJavascriptContentType: string;
|
1168 | static JsonDataType: string;
|
1169 | static BlobDataType: string;
|
1170 | static HttpGetMethod: string;
|
1171 | static HttpPostMethod: string;
|
1172 | static HttpPutMethod: string;
|
1173 | static HttpDeleteMethod: string;
|
1174 | static HttpContentTypeHeader: string;
|
1175 | static HttpAcceptHeader: string;
|
1176 | static Undefined: string;
|
1177 | private static staticContentLocation;
|
1178 | /**
|
1179 | * Ensures the specified value is not null or undefined. Throws a relevent exception if it is.
|
1180 | * @param value The value to check.
|
1181 | * @param context The context from which the check originated.
|
1182 | * @param methodName The name of the method that initiated the check.
|
1183 | * @param parameterName The parameter name of the value to check.
|
1184 | */
|
1185 | static throwIfNullOrUndefined(value: any, context: any, methodName: any, parameterName: any): void;
|
1186 | /**
|
1187 | * Ensures the specified value is not null, undefined or empty. Throws a relevent exception if it is.
|
1188 | * @param value The value to check.
|
1189 | * @param context The context from which the check originated.
|
1190 | * @param methodName The name of the method that initiated the check.
|
1191 | * @param parameterName The parameter name of the value to check.
|
1192 | */
|
1193 | static throwIfNullOrEmpty(value: any, context: any, methodName: string, parameterName: string): void;
|
1194 | /**
|
1195 | * Ensures the specified string is not null, undefined or empty. Throws a relevent exception if it is.
|
1196 | * @param value The value to check.
|
1197 | * @param context The context from which the check originated.
|
1198 | * @param methodName The name of the method that initiated the check.
|
1199 | * @param parameterName The parameter name of the value to check.
|
1200 | */
|
1201 | static throwIfNullOrEmptyString(value: string, context: any, methodName: string, parameterName: string): void;
|
1202 | /**
|
1203 | * Ensures the specified value is not null, undefined, whitespace or empty. Throws a relevent exception if it is.
|
1204 | * @param value The value to check.
|
1205 | * @param context The context from which the check originated.
|
1206 | * @param methodName The name of the method that initiated the check.
|
1207 | * @param parameterName The parameter name of the value to check.
|
1208 | */
|
1209 | static throwIfNullEmptyOrWhitespaceString(value: string, context: any, methodName: string, parameterName: string): void;
|
1210 | /**
|
1211 | * Ensures the specified condition is true. Throws relevant exception if it isn't.
|
1212 | * @param condition The condition to check.
|
1213 | * @param context The context from which the check originated.
|
1214 | * @param methodName The name of the method that initiated the check.
|
1215 | * @param parameterName The parameter name against which the condition is checked.
|
1216 | */
|
1217 | static throwIfNotTrue(condition: boolean, context: any, methodName: string, parameterName: string): void;
|
1218 | /**
|
1219 | * Checks whether the provided value is a 'string'.
|
1220 | * @param value The value to test.
|
1221 | */
|
1222 | static isString(value: any): boolean;
|
1223 | /**
|
1224 | * Checks whether the provided value is a 'boolean'.
|
1225 | * @param value The value to test.
|
1226 | */
|
1227 | static isBoolean(value: any): boolean;
|
1228 | /**
|
1229 | * Checks whether the provided value is a 'number'.
|
1230 | * @param value The value to test.
|
1231 | */
|
1232 | static isNumber(value: any): boolean;
|
1233 | /**
|
1234 | * Checks whether the provided value is a Date instance.
|
1235 | * @param value The value to test.
|
1236 | */
|
1237 | static isDate(value: any): boolean;
|
1238 | /**
|
1239 | * Checks whether the provided value is an 'object'.
|
1240 | * @param value The value to test.
|
1241 | */
|
1242 | static isObject(value: any): boolean;
|
1243 | /**
|
1244 | * Checks whether the provided value is null or undefined.
|
1245 | * @param value The value to test.
|
1246 | */
|
1247 | static isNullOrUndefined(value: any): boolean;
|
1248 | /**
|
1249 | * Combine a base url and a path.
|
1250 | * @param baseUrl The base url.
|
1251 | * @param path The path to add on to the base url.
|
1252 | * @returns The combined url.
|
1253 | */
|
1254 | static urlCombine(baseUrl: string, path: string): string;
|
1255 | static getAbsoluteUri(path: string): string;
|
1256 | static getStaticResourceUri(path: string): string;
|
1257 | static getComponentName(context: any): string;
|
1258 | static throwException(e: any): void;
|
1259 | static createClassSelector(className: string): string;
|
1260 | static createIdSelector(id: string): string;
|
1261 | /**
|
1262 | * Creates a client-side Guid string.
|
1263 | * @returns A string representation of a Guid.
|
1264 | */
|
1265 | static generateGuid(): string;
|
1266 | /**
|
1267 | * Try extract a cookie from {@link document.cookie} identified by key.
|
1268 | */
|
1269 | static getCookieValue(key: string): string;
|
1270 | /**
|
1271 | * Extracts the protocol://hostname section of a url.
|
1272 | * @param url The URL from which to extract the section.
|
1273 | * @returns The protocol://hostname portion of the given URL.
|
1274 | */
|
1275 | static getDomainForUrl(url: string): string;
|
1276 | /**
|
1277 | * Extracts the hostname and absolute path sections of a url.
|
1278 | * @param url The URL from which to extract the section.
|
1279 | * @returns The hostname and absolute path portion of the given URL.
|
1280 | */
|
1281 | static getHostNameForUrl(url: string): string;
|
1282 | /**
|
1283 | * Return the original url with query string stripped.
|
1284 | * @param url The URL from which to extract the section.
|
1285 | * @returns the original url with query string stripped.
|
1286 | */
|
1287 | static getUrlWithoutQueryString(url: string): string;
|
1288 | /**
|
1289 | * Extracts the protocol section of a url.
|
1290 | * @param url The URL from which to extract the section.
|
1291 | * @returns The protocol for the current URL.
|
1292 | */
|
1293 | static getProtocolFromUrl(url: string): string;
|
1294 | /**
|
1295 | * Returns a formatted href object from a URL.
|
1296 | * @param url The URL used to generate the object.
|
1297 | * @returns A jQuery object with the url.
|
1298 | */
|
1299 | static getHrefObjectFromUrl(url: string): JQuery;
|
1300 | /**
|
1301 | * Converts a WCF representation of a dictionary to a JavaScript dictionary.
|
1302 | * @param wcfDictionary The WCF dictionary to convert.
|
1303 | * @returns The native JavaScript representation of this dictionary.
|
1304 | */
|
1305 | static convertWcfToJsDictionary(wcfDictionary: any[]): {
|
1306 | [index: string]: any;
|
1307 | };
|
1308 | static getDateFromWcfJsonString(jsonDate: string, fromUtcMilliseconds: boolean): Date;
|
1309 | /**
|
1310 | * Get the outer html of the given jquery object.
|
1311 | * @param content The jquery object.
|
1312 | * @returns The entire html representation of the object.
|
1313 | */
|
1314 | static getOuterHtml(content: JQuery): string;
|
1315 | /**
|
1316 | * Comparison Method: Compares two integer numbers.
|
1317 | * @param a An integer value.
|
1318 | * @param b An integer value.
|
1319 | * @returns The comparison result.
|
1320 | */
|
1321 | static compareInt(a: number, b: number): number;
|
1322 | /**
|
1323 | * Return the index of the smallest value in a numerical array.
|
1324 | * @param a A numeric array.
|
1325 | * @returns The index of the smallest value in the array.
|
1326 | */
|
1327 | static getIndexOfMinValue(a: number[]): number;
|
1328 | /**
|
1329 | * Extracts a url from a background image attribute in the format of: url('www.foobar.com/image.png').
|
1330 | * @param input The value of the background-image attribute.
|
1331 | * @returns The extracted url.
|
1332 | */
|
1333 | static extractUrlFromCssBackgroundImage(input: string): string;
|
1334 | /**
|
1335 | * Verifies image data url of images.
|
1336 | */
|
1337 | static isValidImageDataUrl(url: string): boolean;
|
1338 | static isLocalUrl(url: string): boolean;
|
1339 | /**
|
1340 | * Downloads a content string as a file.
|
1341 | * @param content Content stream.
|
1342 | * @param fileName File name to use.
|
1343 | */
|
1344 | static saveAsFile(content: any, fileName: string): void;
|
1345 | /**
|
1346 | * Helper method to get the simple type name from a typed object.
|
1347 | * @param obj The typed object.
|
1348 | * @returns The simple type name for the object.
|
1349 | */
|
1350 | static getType(obj: TypedObject): string;
|
1351 | /**
|
1352 | * Check if an element supports a specific event type.
|
1353 | * @param eventName The name of the event.
|
1354 | * @param element The element to test for event support.
|
1355 | * @returns Whether the even is supported on the provided element.
|
1356 | */
|
1357 | static isEventSupported(eventName: string, element: Element): boolean;
|
1358 | static toPixel(pixelAmount: number): string;
|
1359 | static getPropertyCount(object: any): number;
|
1360 | /**
|
1361 | * Check if an element supports a specific event type.
|
1362 | * @param filePath File path.
|
1363 | * @returns File extension.
|
1364 | */
|
1365 | static getFileExtension(filePath: string): string;
|
1366 | /**
|
1367 | * Extract the filename out of a full path delimited by '\' or '/'.
|
1368 | * @param filePath File path.
|
1369 | * @returns filename File name.
|
1370 | */
|
1371 | static extractFileNameFromPath(filePath: string): string;
|
1372 | /**
|
1373 | * This method indicates whether window.clipboardData is supported.
|
1374 | * For example, clipboard support for Windows Store apps is currently disabled
|
1375 | * since window.clipboardData is unsupported (it raises access denied error)
|
1376 | * since clipboard in Windows Store is being
|
1377 | * achieved through Windows.ApplicationModel.DataTransfer.Clipboard class.
|
1378 | */
|
1379 | static canUseClipboard(): boolean;
|
1380 | static is64BitOperatingSystem(): boolean;
|
1381 | static parseNumber(value: any, defaultValue?: number): number;
|
1382 | static getURLParamValue(name: string): string | number;
|
1383 | /**
|
1384 | * Return local timezone.
|
1385 | * This function uses summer and winter offset to determine local time zone.
|
1386 | * The result localTimeZoneString must be a subset of the strings used by server,
|
1387 | * as documented here: https://msdn.microsoft.com/en-us/library/gg154758.aspx (Dynamic Daylight Savings Time (Compact 2013)).
|
1388 | * @return Local timezone string or UTC if timezone cannot be found.
|
1389 | */
|
1390 | static getLocalTimeZoneString(): string;
|
1391 | }
|
1392 | class VersionUtility {
|
1393 | /**
|
1394 | * Compares 2 version strings.
|
1395 | * @param versionA The first version string.
|
1396 | * @param versionB The second version string.
|
1397 | * @returns A result for the comparison.
|
1398 | */
|
1399 | static compareVersions(versionA: string, versionB: string): number;
|
1400 | }
|
1401 | module PerformanceUtil {
|
1402 | class PerfMarker {
|
1403 | private _name;
|
1404 | private _start;
|
1405 | constructor(name: string);
|
1406 | private static begin(name);
|
1407 | end(): void;
|
1408 | }
|
1409 | function create(name: string): PerfMarker;
|
1410 | }
|
1411 | module DeferUtility {
|
1412 | /**
|
1413 | * Wraps a callback and returns a new function.
|
1414 | * The function can be called many times but the callback
|
1415 | * will only be executed once on the next frame.
|
1416 | * Use this to throttle big UI updates and access to DOM.
|
1417 | */
|
1418 | function deferUntilNextFrame(callback: Function): Function;
|
1419 | }
|
1420 | }
|
1421 | declare module jsCommon {
|
1422 | class TraceItem {
|
1423 | type: TraceType;
|
1424 | sessionId: string;
|
1425 | requestId: string;
|
1426 | text: string;
|
1427 | timeStamp: Date;
|
1428 | /**
|
1429 | * Note: DO NOT USE for backward compability only.
|
1430 | */
|
1431 | _activityId: string;
|
1432 | private static traceTypeStrings;
|
1433 | constructor(text: string, type: TraceType, sessionId: string, requestId?: string);
|
1434 | toString(): string;
|
1435 | }
|
1436 | }
|
1437 | declare module jsCommon {
|
1438 | module UrlUtils {
|
1439 | function isValidUrl(value: string): boolean;
|
1440 | function isValidImageUrl(url: string): boolean;
|
1441 | function findAllValidUrls(text: string): TextMatch[];
|
1442 | function getBase64ContentFromDataUri(uri: string): string;
|
1443 | }
|
1444 | }
|
1445 | declare module jsCommon {
|
1446 | module BrowserUtils {
|
1447 | function isChrome(): boolean;
|
1448 | function isInternetExplorerOrEdge(): boolean;
|
1449 | /**
|
1450 | * Get the current version of IE
|
1451 | * @returns The version of Internet Explorer or a 0 (indicating the use of another browser).
|
1452 | */
|
1453 | function getInternetExplorerVersion(): number;
|
1454 | }
|
1455 | }
|
1456 | declare module jsCommon {
|
1457 | /**
|
1458 | * Interface to help define objects indexed by number to a particular type.
|
1459 | */
|
1460 | interface INumberDictionary<T> {
|
1461 | [key: number]: T;
|
1462 | }
|
1463 | /**
|
1464 | * Interface to help define objects indexed by name to a particular type.
|
1465 | */
|
1466 | interface IStringDictionary<T> {
|
1467 | [key: string]: T;
|
1468 | }
|
1469 | /**
|
1470 | * Extensions for Enumerations.
|
1471 | */
|
1472 | module EnumExtensions {
|
1473 | /**
|
1474 | * Gets a value indicating whether the value has the bit flags set.
|
1475 | */
|
1476 | function hasFlag(value: number, flag: number): boolean;
|
1477 | /**
|
1478 | * Sets a value of a flag without modifying any other flags.
|
1479 | */
|
1480 | function setFlag(value: number, flag: number): number;
|
1481 | /**
|
1482 | * Resets a value of a flag without modifying any other flags.
|
1483 | */
|
1484 | function resetFlag(value: number, flag: number): number;
|
1485 | /**
|
1486 | * According to the TypeScript Handbook, this is safe to do.
|
1487 | */
|
1488 | function toString(enumType: any, value: number): string;
|
1489 | }
|
1490 | /**
|
1491 | * Extensions to String class.
|
1492 | */
|
1493 | module StringExtensions {
|
1494 | /**
|
1495 | * Checks if a string ends with a sub-string.
|
1496 | */
|
1497 | function endsWith(str: string, suffix: string): boolean;
|
1498 | }
|
1499 | module LogicExtensions {
|
1500 | function XOR(a: boolean, b: boolean): boolean;
|
1501 | }
|
1502 | module JsonComparer {
|
1503 | /**
|
1504 | * Performs JSON-style comparison of two objects.
|
1505 | */
|
1506 | function equals<T>(x: T, y: T): boolean;
|
1507 | }
|
1508 | /**
|
1509 | * Values are in terms of 'pt'
|
1510 | * Convert to pixels using PixelConverter.fromPoint
|
1511 | */
|
1512 | module TextSizeDefaults {
|
1513 | /**
|
1514 | * Stored in terms of 'pt'
|
1515 | * Convert to pixels using PixelConverter.fromPoint
|
1516 | */
|
1517 | const TextSizeMin: number;
|
1518 | /**
|
1519 | * Stored in terms of 'pt'
|
1520 | * Convert to pixels using PixelConverter.fromPoint
|
1521 | */
|
1522 | const TextSizeMax: number;
|
1523 | /**
|
1524 | * Returns the percentage of this value relative to the TextSizeMax
|
1525 | * @param textSize - should be given in terms of 'pt'
|
1526 | */
|
1527 | function getScale(textSize: number): number;
|
1528 | }
|
1529 | module PixelConverter {
|
1530 | /**
|
1531 | * Appends 'px' to the end of number value for use as pixel string in styles
|
1532 | */
|
1533 | function toString(px: number): string;
|
1534 | /**
|
1535 | * Converts point value (pt) to pixels
|
1536 | * Returns a string for font-size property
|
1537 | * e.g. fromPoint(8) => '24px'
|
1538 | */
|
1539 | function fromPoint(pt: number): string;
|
1540 | /**
|
1541 | * Converts point value (pt) to pixels
|
1542 | * Returns a number for font-size property
|
1543 | * e.g. fromPoint(8) => 24px
|
1544 | */
|
1545 | function fromPointToPixel(pt: number): number;
|
1546 | /**
|
1547 | * Converts pixel value (px) to pt
|
1548 | * e.g. toPoint(24) => 8
|
1549 | */
|
1550 | function toPoint(px: number): number;
|
1551 | }
|
1552 | module RegExpExtensions {
|
1553 | /**
|
1554 | * Runs exec on regex starting from 0 index
|
1555 | * This is the expected behavior but RegExp actually remember
|
1556 | * the last index they stopped at (found match at) and will
|
1557 | * return unexpected results when run in sequence.
|
1558 | * @param regex - regular expression object
|
1559 | * @param value - string to search wiht regex
|
1560 | * @param start - index within value to start regex
|
1561 | */
|
1562 | function run(regex: RegExp, value: string, start?: number): RegExpExecArray;
|
1563 | }
|
1564 | }
|
1565 | declare module powerbi.visuals.utility {
|
1566 | import IThickness = powerbi.visuals.shapes.IThickness;
|
1567 | module StyleUtils {
|
1568 | function getRotateAngleFromElement(element: JQuery): number;
|
1569 | function getTranslateTransformFromElement(element: JQuery): IPoint;
|
1570 | function getPadding(element: JQuery): IThickness;
|
1571 | }
|
1572 | }
|
1573 | declare module jsCommon {
|
1574 | interface ITraceListener {
|
1575 | logTrace(trace: TraceItem): void;
|
1576 | }
|
1577 | class ConsoleTracer implements ITraceListener {
|
1578 | logTrace(trace: TraceItem): void;
|
1579 | }
|
1580 | module Trace {
|
1581 | /**
|
1582 | * Trace a warning. Please ensure that no PII is being logged.
|
1583 | */
|
1584 | function warning(text: string, requestId?: string): void;
|
1585 | /**
|
1586 | * Trace an error. Please ensure that no PII is being logged.
|
1587 | */
|
1588 | function error(text: string, includeStackTrace?: boolean, requestId?: string): void;
|
1589 | /**
|
1590 | * Trace an information. Please ensure that no PII is being logged.
|
1591 | */
|
1592 | function verbose(text: string, requestId?: string): void;
|
1593 | function addListener(listener: ITraceListener): void;
|
1594 | function removeListener(listener: ITraceListener): void;
|
1595 | function resetListeners(): void;
|
1596 | function reset(): void;
|
1597 | function getTraces(): Array<TraceItem>;
|
1598 | /**
|
1599 | * Note: Used for unit-test only.
|
1600 | */
|
1601 | function disableDefaultListener(): void;
|
1602 | function enableDefaultListener(): void;
|
1603 | }
|
1604 | }
|
1605 | declare module jsCommon {
|
1606 | /**
|
1607 | * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.
|
1608 | */
|
1609 | enum TraceType {
|
1610 | Information = 0,
|
1611 | Verbose = 1,
|
1612 | Warning = 2,
|
1613 | Error = 3,
|
1614 | ExpectedError = 4,
|
1615 | UnexpectedError = 5,
|
1616 | Fatal = 6,
|
1617 | }
|
1618 | }
|
1619 | declare module jsCommon {
|
1620 | function ensurePowerView(action?: () => void): void;
|
1621 | function ensureMap(locale: string, action: () => void): void;
|
1622 | function mapControlLoaded(): void;
|
1623 | function waitForMapControlLoaded(): JQueryPromise<void>;
|
1624 | }
|
1625 | declare let globalMapControlLoaded: () => void;
|
1626 | declare module InJs {
|
1627 | /**
|
1628 | * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.
|
1629 | */
|
1630 | enum TraceType {
|
1631 | information = 0,
|
1632 | verbose = 1,
|
1633 | warning = 2,
|
1634 | error = 3,
|
1635 | expectedError = 4,
|
1636 | unexpectedError = 5,
|
1637 | fatal = 6,
|
1638 | }
|
1639 | }
|