UNPKG

290 kBJavaScriptView Raw
1/******/ (function(modules) { // webpackBootstrap
2/******/ // The module cache
3/******/ var installedModules = {};
4
5/******/ // The require function
6/******/ function __webpack_require__(moduleId) {
7
8/******/ // Check if module is in cache
9/******/ if(installedModules[moduleId])
10/******/ return installedModules[moduleId].exports;
11
12/******/ // Create a new module (and put it into the cache)
13/******/ var module = installedModules[moduleId] = {
14/******/ exports: {},
15/******/ id: moduleId,
16/******/ loaded: false
17/******/ };
18
19/******/ // Execute the module function
20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
22/******/ // Flag the module as loaded
23/******/ module.loaded = true;
24
25/******/ // Return the exports of the module
26/******/ return module.exports;
27/******/ }
28
29
30/******/ // expose the modules object (__webpack_modules__)
31/******/ __webpack_require__.m = modules;
32
33/******/ // expose the module cache
34/******/ __webpack_require__.c = installedModules;
35
36/******/ // __webpack_public_path__
37/******/ __webpack_require__.p = "";
38
39/******/ // Load entry module and return exports
40/******/ return __webpack_require__(0);
41/******/ })
42/************************************************************************/
43/******/ ({
44
45/***/ 0:
46/***/ function(module, exports, __webpack_require__) {
47
48 module.exports = __webpack_require__(263);
49
50
51/***/ },
52
53/***/ 263:
54/***/ function(module, exports, __webpack_require__) {
55
56 /*** IMPORTS FROM imports-loader ***/
57 var jsCommon = window.jsCommon;
58 var powerbi = window.powerbi;
59 var powerbitests = window.powerbitests;
60 var InJs = window.InJs;
61 var debug = window.debug;
62 var jasmine = window.jasmine;
63 var Microsoft = window.Microsoft;
64
65 /// <reference path="./_references.ts"/>
66 window.jsCommon = window.jsCommon || {};
67 window.powerbi = window.powerbi || {};
68 window.debug = window.debug || {};
69 window.InJs = window.InJs || {};
70 // Require all files from the `_references.ts`
71 __webpack_require__(264);
72
73
74
75/***/ },
76
77/***/ 264:
78/***/ function(module, exports, __webpack_require__) {
79
80 /*** IMPORTS FROM imports-loader ***/
81 var jsCommon = window.jsCommon;
82 var powerbi = window.powerbi;
83 var powerbitests = window.powerbitests;
84 var InJs = window.InJs;
85 var debug = window.debug;
86 var jasmine = window.jasmine;
87 var Microsoft = window.Microsoft;
88
89 __webpack_require__(265);
90 /// <reference path="../../../src/Clients/Typedefs/webpack/webpack-env.d.ts"/>
91 /// <reference path="../../../src/Clients/Typedefs/common/window.d.ts"/>
92 /// <reference path="../VisualsContracts/_references.ts"/>
93 __webpack_require__(266);
94 __webpack_require__(267);
95 __webpack_require__(268);
96 __webpack_require__(269);
97 __webpack_require__(270);
98 __webpack_require__(271);
99 __webpack_require__(272);
100 __webpack_require__(273);
101 __webpack_require__(274);
102 __webpack_require__(275);
103 __webpack_require__(276);
104 __webpack_require__(277);
105 __webpack_require__(278);
106 __webpack_require__(279);
107 __webpack_require__(280);
108 __webpack_require__(281);
109 __webpack_require__(282);
110 __webpack_require__(283);
111 __webpack_require__(284);
112 __webpack_require__(285);
113 __webpack_require__(286);
114 __webpack_require__(287);
115 __webpack_require__(288);
116 __webpack_require__(289);
117 __webpack_require__(290);
118 __webpack_require__(291);
119 __webpack_require__(292);
120 __webpack_require__(293);
121 __webpack_require__(294);
122 __webpack_require__(295);
123 __webpack_require__(296);
124 __webpack_require__(297);
125 __webpack_require__(298);
126 __webpack_require__(288);
127 __webpack_require__(299);
128 __webpack_require__(300);
129 __webpack_require__(301);
130 __webpack_require__(302);
131
132
133
134/***/ },
135
136/***/ 265:
137/***/ function(module, exports) {
138
139 /*** IMPORTS FROM imports-loader ***/
140 var jsCommon = window.jsCommon;
141 var powerbi = window.powerbi;
142 var powerbitests = window.powerbitests;
143 var InJs = window.InJs;
144 var debug = window.debug;
145 var jasmine = window.jasmine;
146 var Microsoft = window.Microsoft;
147
148 /*
149 * Power BI Visualizations
150 *
151 * Copyright (c) Microsoft Corporation
152 * All rights reserved.
153 * MIT License
154 *
155 * Permission is hereby granted, free of charge, to any person obtaining a copy
156 * of this software and associated documentation files (the ""Software""), to deal
157 * in the Software without restriction, including without limitation the rights
158 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
159 * copies of the Software, and to permit persons to whom the Software is
160 * furnished to do so, subject to the following conditions:
161 *
162 * The above copyright notice and this permission notice shall be included in
163 * all copies or substantial portions of the Software.
164 *
165 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
166 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
167 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
168 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
169 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
170 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
171 * THE SOFTWARE.
172 */
173 ///<reference path="../../Typedefs/jquery/jquery.d.ts"/>
174 ///<reference path="../../Typedefs/d3/d3.d.ts"/>
175 ///<reference path="../../Typedefs/lodash/lodash.d.ts"/>
176
177
178
179/***/ },
180
181/***/ 266:
182/***/ function(module, exports) {
183
184 /*** IMPORTS FROM imports-loader ***/
185 var jsCommon = window.jsCommon;
186 var powerbi = window.powerbi;
187 var powerbitests = window.powerbitests;
188 var InJs = window.InJs;
189 var debug = window.debug;
190 var jasmine = window.jasmine;
191 var Microsoft = window.Microsoft;
192
193 /*
194 * Power BI Visualizations
195 *
196 * Copyright (c) Microsoft Corporation
197 * All rights reserved.
198 * MIT License
199 *
200 * Permission is hereby granted, free of charge, to any person obtaining a copy
201 * of this software and associated documentation files (the ""Software""), to deal
202 * in the Software without restriction, including without limitation the rights
203 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
204 * copies of the Software, and to permit persons to whom the Software is
205 * furnished to do so, subject to the following conditions:
206 *
207 * The above copyright notice and this permission notice shall be included in
208 * all copies or substantial portions of the Software.
209 *
210 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
211 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
212 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
213 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
214 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
215 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
216 * THE SOFTWARE.
217 */
218 /// <reference path="./_references.ts"/>
219 var jsCommon;
220 (function (jsCommon) {
221 /**
222 * DOM constants.
223 */
224 var DOMConstants;
225 (function (DOMConstants) {
226 /**
227 * Integer codes corresponding to individual keys on the keyboard.
228 */
229 DOMConstants.escKeyCode = 27;
230 DOMConstants.enterKeyCode = 13;
231 DOMConstants.tabKeyCode = 9;
232 DOMConstants.upArrowKeyCode = 38;
233 DOMConstants.downArrowKeyCode = 40;
234 DOMConstants.leftArrowKeyCode = 37;
235 DOMConstants.rightArrowKeyCode = 39;
236 DOMConstants.homeKeyCode = 36;
237 DOMConstants.endKeyCode = 35;
238 DOMConstants.backSpaceKeyCode = 8;
239 DOMConstants.deleteKeyCode = 46;
240 DOMConstants.spaceKeyCode = 32;
241 DOMConstants.shiftKeyCode = 16;
242 DOMConstants.ctrlKeyCode = 17;
243 DOMConstants.altKeyCode = 18;
244 DOMConstants.aKeyCode = 65;
245 DOMConstants.cKeyCode = 67;
246 DOMConstants.sKeyCode = 83;
247 DOMConstants.vKeyCode = 86;
248 DOMConstants.wKeyCode = 87;
249 DOMConstants.xKeyCode = 88;
250 DOMConstants.yKeyCode = 89;
251 DOMConstants.zKeyCode = 90;
252 /**
253 * DOM Elements.
254 */
255 DOMConstants.DocumentBody = 'body';
256 DOMConstants.Anchor = 'a';
257 DOMConstants.EditableTextElements = ':text, textarea';
258 DOMConstants.EditableNumericElements = '[type="number"]';
259 /**
260 * DOM Attributes and values.
261 */
262 DOMConstants.disabledAttributeOrValue = 'disabled';
263 DOMConstants.readonlyAttributeOrValue = 'readonly';
264 DOMConstants.idAttribute = 'id';
265 DOMConstants.styleAttribute = 'style';
266 DOMConstants.hrefAttribute = 'href';
267 DOMConstants.targetAttribute = 'target';
268 DOMConstants.blankValue = '_blank';
269 DOMConstants.selfValue = '_self';
270 DOMConstants.classAttribute = 'class';
271 DOMConstants.titleAttribute = 'title';
272 DOMConstants.srcAttribute = 'src';
273 /**
274 * DOM event names.
275 */
276 DOMConstants.contextmenuEventName = 'contextmenu';
277 DOMConstants.blurEventName = 'blur';
278 DOMConstants.keyUpEventName = 'keyup';
279 DOMConstants.inputEventName = 'input';
280 DOMConstants.changeEventName = 'change';
281 DOMConstants.cutEventName = 'cut';
282 DOMConstants.keyDownEventName = 'keydown';
283 DOMConstants.mouseMoveEventName = 'mousemove';
284 DOMConstants.mouseDownEventName = 'mousedown';
285 DOMConstants.mouseEnterEventName = 'mouseenter';
286 DOMConstants.mouseLeaveEventName = 'mouseleave';
287 DOMConstants.mouseOverEventName = 'mouseover';
288 DOMConstants.mouseOutEventName = 'mouseout';
289 DOMConstants.mouseClickEventName = 'click';
290 DOMConstants.pasteEventName = 'paste';
291 DOMConstants.scrollEventName = 'scroll';
292 DOMConstants.dropEventName = 'drop';
293 DOMConstants.focusEventName = 'focus';
294 DOMConstants.focusInEventName = 'focusin';
295 DOMConstants.focusOutEventName = 'focusout';
296 DOMConstants.selectEventName = 'select';
297 DOMConstants.messageEventName = 'message';
298 DOMConstants.loadEventName = 'load';
299 DOMConstants.beforeUnload = 'beforeunload';
300 /**
301 * Common DOM event combination names.
302 */
303 DOMConstants.inputAndSelectEventNames = 'input, select';
304 })(DOMConstants = jsCommon.DOMConstants || (jsCommon.DOMConstants = {}));
305 })(jsCommon || (jsCommon = {}));
306
307
308
309/***/ },
310
311/***/ 267:
312/***/ function(module, exports) {
313
314 /*** IMPORTS FROM imports-loader ***/
315 var jsCommon = window.jsCommon;
316 var powerbi = window.powerbi;
317 var powerbitests = window.powerbitests;
318 var InJs = window.InJs;
319 var debug = window.debug;
320 var jasmine = window.jasmine;
321 var Microsoft = window.Microsoft;
322
323 /*
324 * Power BI Visualizations
325 *
326 * Copyright (c) Microsoft Corporation
327 * All rights reserved.
328 * MIT License
329 *
330 * Permission is hereby granted, free of charge, to any person obtaining a copy
331 * of this software and associated documentation files (the ""Software""), to deal
332 * in the Software without restriction, including without limitation the rights
333 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
334 * copies of the Software, and to permit persons to whom the Software is
335 * furnished to do so, subject to the following conditions:
336 *
337 * The above copyright notice and this permission notice shall be included in
338 * all copies or substantial portions of the Software.
339 *
340 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
341 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
342 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
343 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
344 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
345 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
346 * THE SOFTWARE.
347 */
348 /// <reference path="./_references.ts"/>
349 var powerbi;
350 (function (powerbi) {
351 powerbi.RS_AccessDeniedDueToRLSGroup = 'rsAccessDeniedDueToRLSGroup';
352 powerbi.RS_CannotRetrieveModel = 'rsCannotRetrieveModel';
353 (function (PowerBIErrorResourceType) {
354 PowerBIErrorResourceType[PowerBIErrorResourceType["ResourceCodeReference"] = 0] = "ResourceCodeReference";
355 PowerBIErrorResourceType[PowerBIErrorResourceType["EmbeddedString"] = 1] = "EmbeddedString";
356 })(powerbi.PowerBIErrorResourceType || (powerbi.PowerBIErrorResourceType = {}));
357 var PowerBIErrorResourceType = powerbi.PowerBIErrorResourceType;
358 var ServiceErrorToClientError = (function () {
359 function ServiceErrorToClientError(serviceError) {
360 this.m_serviceError = serviceError;
361 }
362 Object.defineProperty(ServiceErrorToClientError.prototype, "code", {
363 get: function () {
364 return ServiceErrorToClientError.codeName;
365 },
366 enumerable: true,
367 configurable: true
368 });
369 Object.defineProperty(ServiceErrorToClientError.prototype, "ignorable", {
370 get: function () {
371 return false;
372 },
373 enumerable: true,
374 configurable: true
375 });
376 Object.defineProperty(ServiceErrorToClientError.prototype, "requestId", {
377 get: function () {
378 return this.httpRequestId;
379 },
380 set: function (value) {
381 this.httpRequestId = value;
382 },
383 enumerable: true,
384 configurable: true
385 });
386 ServiceErrorToClientError.prototype.getDetails = function (resourceProvider) {
387 var errorDetails;
388 if (this.m_serviceError.statusCode === 6 /* ExecuteSemanticQueryTransformError */) {
389 errorDetails = PowerBIErrorDetailHelper.GetDetailsFromTransformError(resourceProvider, this.m_serviceError);
390 }
391 else {
392 errorDetails = PowerBIErrorDetailHelper.GetDetailsFromServerError(resourceProvider, this.m_serviceError);
393 }
394 PowerBIErrorDetailHelper.addAdditionalInfo(errorDetails, this.m_serviceError.errorDetails, resourceProvider);
395 PowerBIErrorDetailHelper.addDebugErrorInfo(errorDetails, this.code, this.m_serviceError.message || null, this.m_serviceError.stackTrace || null);
396 return errorDetails;
397 };
398 ServiceErrorToClientError.codeName = 'ServiceErrorToClientError';
399 return ServiceErrorToClientError;
400 }());
401 powerbi.ServiceErrorToClientError = ServiceErrorToClientError;
402 var PowerBIErrorDetailHelper = (function () {
403 function PowerBIErrorDetailHelper() {
404 }
405 PowerBIErrorDetailHelper.addAdditionalInfo = function (errorDetails, pbiErrorDetails, localize) {
406 if (pbiErrorDetails) {
407 for (var i = 0; i < pbiErrorDetails.length; i++) {
408 var element = pbiErrorDetails[i];
409 var localizedCode = localize.getOptional(PowerBIErrorDetailHelper.serverErrorPrefix + element.code);
410 var additionErrorInfoKeyValuePair = {
411 errorInfoKey: localizedCode ? localizedCode : element.code,
412 errorInfoValue: element.detail.type === PowerBIErrorResourceType.ResourceCodeReference ? localize.get(PowerBIErrorDetailHelper.serverErrorPrefix + element.detail.value) : element.detail.value
413 };
414 errorDetails.displayableErrorInfo.push(additionErrorInfoKeyValuePair);
415 }
416 }
417 return errorDetails;
418 };
419 PowerBIErrorDetailHelper.addDebugErrorInfo = function (errorDetails, errorCode, message, stackTrace) {
420 errorDetails.debugErrorInfo = errorDetails.debugErrorInfo || [];
421 if (errorCode) {
422 errorDetails.debugErrorInfo.push({ errorInfoKey: powerbi.ClientErrorStrings.ClientErrorCode, errorInfoValue: errorCode, });
423 }
424 if (message) {
425 errorDetails.debugErrorInfo.push({ errorInfoKey: powerbi.ClientErrorStrings.ErrorDetails, errorInfoValue: message, });
426 }
427 if (stackTrace) {
428 errorDetails.debugErrorInfo.push({ errorInfoKey: powerbi.ClientErrorStrings.StackTrace, errorInfoValue: stackTrace, });
429 }
430 return errorDetails;
431 };
432 PowerBIErrorDetailHelper.GetDetailsFromTransformError = function (localize, serviceError) {
433 var message = localize.get('ServiceError_CannotLoadVisual');
434 var key = localize.get('ServiceError_CannotLoadVisual');
435 var val = serviceError.message;
436 var additionalInfo = [];
437 additionalInfo.push({ errorInfoKey: key, errorInfoValue: val, });
438 var errorDetails = {
439 message: message,
440 displayableErrorInfo: additionalInfo,
441 };
442 return errorDetails;
443 };
444 PowerBIErrorDetailHelper.GetDetailsFromServerError = function (localize, serviceError) {
445 // TODO: Localize
446 var message = "";
447 var key = "";
448 var val = "";
449 var errorCodeHandled = false;
450 switch (serviceError.errorCode) {
451 case powerbi.RS_AccessDeniedDueToRLSGroup:
452 message = localize.get('ServiceError_ModelCannotLoad');
453 key = localize.get('ServiceError_ModelFetchingFailureKey');
454 val = localize.get('DsrError_NoPermissionDueToRLSGroupMessage');
455 errorCodeHandled = true;
456 break;
457 case powerbi.RS_CannotRetrieveModel:
458 message = localize.get('ServiceError_ModelCannotLoad');
459 key = localize.get('ServiceError_ModelFetchingFailureKey');
460 val = localize.get('DsrError_CanNotRetrieveModelMessage');
461 errorCodeHandled = true;
462 break;
463 }
464 if (!errorCodeHandled) {
465 switch (serviceError.statusCode) {
466 case 2 /* CsdlConvertXmlToConceptualSchema */:
467 message = localize.get('ServiceError_ModelCannotLoad');
468 key = localize.get('ServiceError_ModelConvertFailureKey');
469 val = localize.get('ServiceError_ModelConvertFailureValue');
470 break;
471 case 3 /* CsdlCreateClientSchema */:
472 message = localize.get('ServiceError_ModelCannotLoad');
473 key = localize.get('ServiceError_ModelCreationFailureKey');
474 val = localize.get('ServiceError_ModelCreationFailureValue');
475 break;
476 case 1 /* CsdlFetching */:
477 message = localize.get('ServiceError_ModelCannotLoad');
478 key = localize.get('ServiceError_ModelFetchingFailureKey');
479 val = localize.get('ServiceError_ModelFetchingFailureValue');
480 break;
481 case 4 /* ExecuteSemanticQueryError */:
482 message = localize.get('ServiceError_CannotLoadVisual');
483 key = localize.get('ServiceError_ExecuteSemanticQueryErrorKey');
484 val = localize.get('ServiceError_ExecuteSemanticQueryErrorValue');
485 break;
486 case 5 /* ExecuteSemanticQueryInvalidStreamFormat */:
487 message = localize.get('ServiceError_CannotLoadVisual');
488 key = localize.get('ServiceError_ExecuteSemanticQueryInvalidStreamFormatKey');
489 val = localize.get('ServiceError_ExecuteSemanticQueryInvalidStreamFormatValue');
490 break;
491 case 0 /* GeneralError */:
492 default:
493 message = localize.get('ServiceError_GeneralError');
494 key = localize.get('ServiceError_GeneralErrorKey');
495 val = localize.get('ServiceError_GeneralErrorValue');
496 break;
497 }
498 }
499 var additionalInfo = [];
500 additionalInfo.push({ errorInfoKey: key, errorInfoValue: val, });
501 var errorDetails = {
502 message: message,
503 displayableErrorInfo: additionalInfo,
504 };
505 return errorDetails;
506 };
507 PowerBIErrorDetailHelper.serverErrorPrefix = "ServerError_";
508 return PowerBIErrorDetailHelper;
509 }());
510 powerbi.PowerBIErrorDetailHelper = PowerBIErrorDetailHelper;
511 })(powerbi || (powerbi = {}));
512
513
514
515/***/ },
516
517/***/ 268:
518/***/ function(module, exports) {
519
520 /*** IMPORTS FROM imports-loader ***/
521 var jsCommon = window.jsCommon;
522 var powerbi = window.powerbi;
523 var powerbitests = window.powerbitests;
524 var InJs = window.InJs;
525 var debug = window.debug;
526 var jasmine = window.jasmine;
527 var Microsoft = window.Microsoft;
528
529 /*
530 * Power BI Visualizations
531 *
532 * Copyright (c) Microsoft Corporation
533 * All rights reserved.
534 * MIT License
535 *
536 * Permission is hereby granted, free of charge, to any person obtaining a copy
537 * of this software and associated documentation files (the ""Software""), to deal
538 * in the Software without restriction, including without limitation the rights
539 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
540 * copies of the Software, and to permit persons to whom the Software is
541 * furnished to do so, subject to the following conditions:
542 *
543 * The above copyright notice and this permission notice shall be included in
544 * all copies or substantial portions of the Software.
545 *
546 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
547 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
548 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
549 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
550 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
551 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
552 * THE SOFTWARE.
553 */
554 /// <reference path="../_references.ts"/>
555 var powerbi;
556 (function (powerbi) {
557 })(powerbi || (powerbi = {}));
558
559
560
561/***/ },
562
563/***/ 269:
564/***/ function(module, exports) {
565
566 /*** IMPORTS FROM imports-loader ***/
567 var jsCommon = window.jsCommon;
568 var powerbi = window.powerbi;
569 var powerbitests = window.powerbitests;
570 var InJs = window.InJs;
571 var debug = window.debug;
572 var jasmine = window.jasmine;
573 var Microsoft = window.Microsoft;
574
575 /*
576 * Power BI Visualizations
577 *
578 * Copyright (c) Microsoft Corporation
579 * All rights reserved.
580 * MIT License
581 *
582 * Permission is hereby granted, free of charge, to any person obtaining a copy
583 * of this software and associated documentation files (the ""Software""), to deal
584 * in the Software without restriction, including without limitation the rights
585 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
586 * copies of the Software, and to permit persons to whom the Software is
587 * furnished to do so, subject to the following conditions:
588 *
589 * The above copyright notice and this permission notice shall be included in
590 * all copies or substantial portions of the Software.
591 *
592 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
593 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
594 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
595 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
596 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
597 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
598 * THE SOFTWARE.
599 */
600 /// <reference path="../_references.ts"/>
601 var powerbi;
602 (function (powerbi) {
603 powerbi.CategoryTypes = {
604 Address: "Address",
605 City: "City",
606 Continent: "Continent",
607 CountryRegion: "Country",
608 County: "County",
609 Longitude: "Longitude",
610 Latitude: "Latitude",
611 Place: "Place",
612 PostalCode: "PostalCode",
613 StateOrProvince: "StateOrProvince"
614 };
615 function createGeoTaggingAnalyzerService(getLocalized) {
616 return new GeoTaggingAnalyzerService(getLocalized);
617 }
618 powerbi.createGeoTaggingAnalyzerService = createGeoTaggingAnalyzerService;
619 var EnglishBackup = {
620 GeotaggingString_Continent: "continent",
621 GeotaggingString_Continents: "continents",
622 GeotaggingString_Country: "country",
623 GeotaggingString_Countries: "countries",
624 GeotaggingString_State: "state",
625 GeotaggingString_States: "states",
626 GeotaggingString_City: "city",
627 GeotaggingString_Cities: "cities",
628 GeotaggingString_Town: "town",
629 GeotaggingString_Towns: "towns",
630 GeotaggingString_Province: "province",
631 GeotaggingString_Provinces: "provinces",
632 GeotaggingString_County: "county",
633 GeotaggingString_Counties: "counties",
634 GeotaggingString_Village: "village",
635 GeotaggingString_Villages: "villages",
636 GeotaggingString_Post: "post",
637 GeotaggingString_Zip: "zip",
638 GeotaggingString_Code: "code",
639 GeotaggingString_Place: "place",
640 GeotaggingString_Places: "places",
641 GeotaggingString_Address: "address",
642 GeotaggingString_Addresses: "addresses",
643 GeotaggingString_Street: "street",
644 GeotaggingString_Streets: "streets",
645 GeotaggingString_Longitude: "longitude",
646 GeotaggingString_Longitude_Short: "lon",
647 GeotaggingString_Longitude_Short2: "long",
648 GeotaggingString_Latitude: "latitude",
649 GeotaggingString_Latitude_Short: "lat",
650 GeotaggingString_PostalCode: "postal code",
651 GeotaggingString_PostalCodes: "postal codes",
652 GeotaggingString_ZipCode: "zip code",
653 GeotaggingString_ZipCodes: "zip codes",
654 GeotaggingString_Territory: "territory",
655 GeotaggingString_Territories: "territories",
656 GeotaggingString_VRMBackCompat_CountryRegion: "CountryRegion",
657 GeotaggingString_VRMBackCompat_StateOrProvince: "StateOrProvince",
658 };
659 var GeoTaggingAnalyzerService = (function () {
660 function GeoTaggingAnalyzerService(getLocalized) {
661 this.GeotaggingString_VRMBackCompat_CountryRegion = "CountryRegion";
662 this.GeotaggingString_VRMBackCompat_StateOrProvince = "StateOrProvince";
663 this.GeotaggingString_Continent = getLocalized("GeotaggingString_Continent").toLowerCase();
664 this.GeotaggingString_Continents = getLocalized("GeotaggingString_Continents").toLowerCase();
665 this.GeotaggingString_Country = getLocalized("GeotaggingString_Country").toLowerCase();
666 this.GeotaggingString_Countries = getLocalized("GeotaggingString_Countries").toLowerCase();
667 this.GeotaggingString_State = getLocalized("GeotaggingString_State").toLowerCase();
668 this.GeotaggingString_States = getLocalized("GeotaggingString_States").toLowerCase();
669 this.GeotaggingString_City = getLocalized("GeotaggingString_City").toLowerCase();
670 this.GeotaggingString_Cities = getLocalized("GeotaggingString_Cities").toLowerCase();
671 this.GeotaggingString_Town = getLocalized("GeotaggingString_Town").toLowerCase();
672 this.GeotaggingString_Towns = getLocalized("GeotaggingString_Towns").toLowerCase();
673 this.GeotaggingString_Province = getLocalized("GeotaggingString_Province").toLowerCase();
674 this.GeotaggingString_Provinces = getLocalized("GeotaggingString_Provinces").toLowerCase();
675 this.GeotaggingString_County = getLocalized("GeotaggingString_County").toLowerCase();
676 this.GeotaggingString_Counties = getLocalized("GeotaggingString_Counties").toLowerCase();
677 this.GeotaggingString_Village = getLocalized("GeotaggingString_Village").toLowerCase();
678 this.GeotaggingString_Villages = getLocalized("GeotaggingString_Villages").toLowerCase();
679 this.GeotaggingString_Post = getLocalized("GeotaggingString_Post").toLowerCase();
680 this.GeotaggingString_Zip = getLocalized("GeotaggingString_Zip").toLowerCase();
681 this.GeotaggingString_Code = getLocalized("GeotaggingString_Code").toLowerCase();
682 this.GeotaggingString_Place = getLocalized("GeotaggingString_Place").toLowerCase();
683 this.GeotaggingString_Places = getLocalized("GeotaggingString_Places").toLowerCase();
684 this.GeotaggingString_Address = getLocalized("GeotaggingString_Address").toLowerCase();
685 this.GeotaggingString_Addresses = getLocalized("GeotaggingString_Addresses").toLowerCase();
686 this.GeotaggingString_Street = getLocalized("GeotaggingString_Street").toLowerCase();
687 this.GeotaggingString_Streets = getLocalized("GeotaggingString_Streets").toLowerCase();
688 this.GeotaggingString_Longitude = getLocalized("GeotaggingString_Longitude").toLowerCase();
689 this.GeotaggingString_Longitude_Short = getLocalized("GeotaggingString_Longitude_Short").toLowerCase();
690 this.GeotaggingString_Longitude_Short2 = getLocalized("GeotaggingString_Longitude_Short2").toLowerCase();
691 this.GeotaggingString_Latitude = getLocalized("GeotaggingString_Latitude").toLowerCase();
692 this.GeotaggingString_Latitude_Short = getLocalized("GeotaggingString_Latitude_Short").toLowerCase();
693 this.GeotaggingString_PostalCode = getLocalized("GeotaggingString_PostalCode").toLowerCase();
694 this.GeotaggingString_PostalCodes = getLocalized("GeotaggingString_PostalCodes").toLowerCase();
695 this.GeotaggingString_ZipCode = getLocalized("GeotaggingString_ZipCode").toLowerCase();
696 this.GeotaggingString_ZipCodes = getLocalized("GeotaggingString_ZipCodes").toLowerCase();
697 this.GeotaggingString_Territory = getLocalized("GeotaggingString_Territory").toLowerCase();
698 this.GeotaggingString_Territories = getLocalized("GeotaggingString_Territories").toLowerCase();
699 }
700 GeoTaggingAnalyzerService.prototype.isLongitudeOrLatitude = function (fieldRefName) {
701 return this.isLongitude(fieldRefName) ||
702 this.isLatitude(fieldRefName);
703 };
704 GeoTaggingAnalyzerService.prototype.isGeographic = function (fieldRefName) {
705 return this.isLongitudeOrLatitude(fieldRefName) ||
706 this.isGeocodable(fieldRefName);
707 };
708 GeoTaggingAnalyzerService.prototype.isGeocodable = function (fieldRefName) {
709 return this.isAddress(fieldRefName) ||
710 this.isCity(fieldRefName) ||
711 this.isContinent(fieldRefName) ||
712 this.isCountry(fieldRefName) ||
713 this.isCounty(fieldRefName) ||
714 this.isStateOrProvince(fieldRefName) ||
715 this.isPlace(fieldRefName) ||
716 this.isPostalCode(fieldRefName) ||
717 this.isTerritory(fieldRefName);
718 };
719 GeoTaggingAnalyzerService.prototype.isGeoshapable = function (fieldRefName) {
720 return this.isCity(fieldRefName) ||
721 this.isCountry(fieldRefName) ||
722 this.isCounty(fieldRefName) ||
723 this.isStateOrProvince(fieldRefName) ||
724 this.isPostalCode(fieldRefName) ||
725 this.isTerritory(fieldRefName) ||
726 this.isGeoshapableEnglish(fieldRefName);
727 };
728 GeoTaggingAnalyzerService.prototype.isGeoshapableEnglish = function (fieldRefName) {
729 return this.isEnglishCity(fieldRefName) ||
730 this.isEnglishCountry(fieldRefName) ||
731 this.isEnglishCounty(fieldRefName) ||
732 this.isEnglishStateOrProvince(fieldRefName) ||
733 this.isEnglishPostalCode(fieldRefName) ||
734 this.isEnglishTerritory(fieldRefName);
735 };
736 GeoTaggingAnalyzerService.prototype.isAddress = function (fieldRefName) {
737 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
738 this.GeotaggingString_Address,
739 this.GeotaggingString_Addresses,
740 this.GeotaggingString_Street,
741 this.GeotaggingString_Streets
742 ]);
743 };
744 GeoTaggingAnalyzerService.prototype.isPlace = function (fieldRefName) {
745 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
746 this.GeotaggingString_Place,
747 this.GeotaggingString_Places
748 ]);
749 };
750 GeoTaggingAnalyzerService.prototype.isCity = function (fieldRefName) {
751 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
752 this.GeotaggingString_City,
753 this.GeotaggingString_Cities,
754 this.GeotaggingString_Town,
755 this.GeotaggingString_Towns,
756 this.GeotaggingString_Village,
757 this.GeotaggingString_Villages
758 ]);
759 };
760 GeoTaggingAnalyzerService.prototype.isStateOrProvince = function (fieldRefName) {
761 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
762 this.GeotaggingString_State,
763 this.GeotaggingString_States,
764 this.GeotaggingString_Province,
765 this.GeotaggingString_Provinces,
766 this.GeotaggingString_VRMBackCompat_StateOrProvince,
767 ]);
768 };
769 GeoTaggingAnalyzerService.prototype.isCountry = function (fieldRefName) {
770 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
771 this.GeotaggingString_Country,
772 this.GeotaggingString_Countries,
773 this.GeotaggingString_VRMBackCompat_CountryRegion
774 ]);
775 };
776 GeoTaggingAnalyzerService.prototype.isCounty = function (fieldRefName) {
777 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
778 this.GeotaggingString_County,
779 this.GeotaggingString_Counties
780 ]);
781 };
782 GeoTaggingAnalyzerService.prototype.isContinent = function (fieldRefName) {
783 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
784 this.GeotaggingString_Continent,
785 this.GeotaggingString_Continents
786 ]);
787 };
788 GeoTaggingAnalyzerService.prototype.isPostalCode = function (fieldRefName) {
789 var result = (GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
790 this.GeotaggingString_Post,
791 this.GeotaggingString_Zip])
792 && GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Code])) ||
793 GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
794 this.GeotaggingString_PostalCode,
795 this.GeotaggingString_PostalCodes,
796 this.GeotaggingString_ZipCode,
797 this.GeotaggingString_ZipCodes
798 ]);
799 //Check again for strings without whitespace
800 if (!result) {
801 var whiteSpaceRegex = /\s+/;
802 var fieldNameWithoutWhitespace = fieldRefName.replace(whiteSpaceRegex, "");
803 result = GeoTaggingAnalyzerService.hasMatches(fieldNameWithoutWhitespace, [
804 this.GeotaggingString_PostalCode.replace(whiteSpaceRegex, ''),
805 this.GeotaggingString_PostalCodes.replace(whiteSpaceRegex, ''),
806 this.GeotaggingString_ZipCode.replace(whiteSpaceRegex, ''),
807 this.GeotaggingString_ZipCodes.replace(whiteSpaceRegex, '')
808 ]);
809 }
810 return result;
811 };
812 GeoTaggingAnalyzerService.prototype.isLongitude = function (fieldRefName) {
813 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Longitude])
814 || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Longitude_Short], true /* useStrict */)
815 || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Longitude_Short2], true /* useStrict */);
816 };
817 GeoTaggingAnalyzerService.prototype.isLatitude = function (fieldRefName) {
818 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Latitude])
819 || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Latitude_Short], true /* useStrict */);
820 };
821 GeoTaggingAnalyzerService.prototype.isTerritory = function (fieldRefName) {
822 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
823 this.GeotaggingString_Territory,
824 this.GeotaggingString_Territories
825 ]);
826 };
827 GeoTaggingAnalyzerService.hasMatches = function (fieldName, possibleMatches, useStrict) {
828 var nonWordRegex = /\W/;
829 var value = fieldName.toLowerCase();
830 for (var i = 0, len = possibleMatches.length; i < len; i++) {
831 var possibleMatch = possibleMatches[i].toLowerCase();
832 if (!useStrict) {
833 if (value.indexOf(possibleMatch) > -1)
834 return true;
835 }
836 else {
837 var indexofpossibleMatch = value.indexOf(possibleMatch);
838 if (indexofpossibleMatch > -1) {
839 var wordEndFlag = void 0, wordBeginFlag = void 0;
840 wordEndFlag = wordBeginFlag = true;
841 if (indexofpossibleMatch - 1 > 0)
842 wordBeginFlag = nonWordRegex.test(value[indexofpossibleMatch - 1]);
843 if (indexofpossibleMatch + possibleMatch.length < value.length)
844 wordEndFlag = nonWordRegex.test(value[indexofpossibleMatch + possibleMatch.length]);
845 if (wordBeginFlag && wordEndFlag)
846 return true;
847 }
848 }
849 }
850 return false;
851 };
852 GeoTaggingAnalyzerService.prototype.getFieldType = function (fieldName) {
853 if (fieldName == null)
854 return undefined;
855 if (this.isLatitude(fieldName))
856 return powerbi.CategoryTypes.Latitude;
857 if (this.isLongitude(fieldName))
858 return powerbi.CategoryTypes.Longitude;
859 if (this.isPostalCode(fieldName))
860 return powerbi.CategoryTypes.PostalCode;
861 if (this.isAddress(fieldName))
862 return powerbi.CategoryTypes.Address;
863 if (this.isPlace(fieldName))
864 return powerbi.CategoryTypes.Place;
865 if (this.isCity(fieldName))
866 return powerbi.CategoryTypes.City;
867 if (this.isCountry(fieldName))
868 return powerbi.CategoryTypes.CountryRegion;
869 if (this.isCounty(fieldName))
870 return powerbi.CategoryTypes.County;
871 if (this.isStateOrProvince(fieldName))
872 return powerbi.CategoryTypes.StateOrProvince;
873 if (this.isContinent(fieldName))
874 return powerbi.CategoryTypes.Continent;
875 return this.getEnglishFieldType(fieldName);
876 };
877 GeoTaggingAnalyzerService.prototype.isEnglishAddress = function (fieldRefName) {
878 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
879 EnglishBackup.GeotaggingString_Address,
880 EnglishBackup.GeotaggingString_Addresses,
881 EnglishBackup.GeotaggingString_Street,
882 EnglishBackup.GeotaggingString_Streets
883 ]);
884 };
885 GeoTaggingAnalyzerService.prototype.isEnglishPlace = function (fieldRefName) {
886 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
887 EnglishBackup.GeotaggingString_Place,
888 EnglishBackup.GeotaggingString_Places
889 ]);
890 };
891 GeoTaggingAnalyzerService.prototype.isEnglishCity = function (fieldRefName) {
892 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
893 EnglishBackup.GeotaggingString_City,
894 EnglishBackup.GeotaggingString_Cities,
895 EnglishBackup.GeotaggingString_Town,
896 EnglishBackup.GeotaggingString_Towns,
897 EnglishBackup.GeotaggingString_Village,
898 EnglishBackup.GeotaggingString_Villages
899 ]);
900 };
901 GeoTaggingAnalyzerService.prototype.isEnglishStateOrProvince = function (fieldRefName) {
902 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
903 EnglishBackup.GeotaggingString_State,
904 EnglishBackup.GeotaggingString_States,
905 EnglishBackup.GeotaggingString_Province,
906 EnglishBackup.GeotaggingString_Provinces,
907 EnglishBackup.GeotaggingString_VRMBackCompat_StateOrProvince,
908 ]);
909 };
910 GeoTaggingAnalyzerService.prototype.isEnglishCountry = function (fieldRefName) {
911 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
912 EnglishBackup.GeotaggingString_Country,
913 EnglishBackup.GeotaggingString_Countries,
914 EnglishBackup.GeotaggingString_VRMBackCompat_CountryRegion
915 ]);
916 };
917 GeoTaggingAnalyzerService.prototype.isEnglishCounty = function (fieldRefName) {
918 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
919 EnglishBackup.GeotaggingString_County,
920 EnglishBackup.GeotaggingString_Counties
921 ]);
922 };
923 GeoTaggingAnalyzerService.prototype.isEnglishContinent = function (fieldRefName) {
924 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
925 EnglishBackup.GeotaggingString_Continent,
926 EnglishBackup.GeotaggingString_Continents
927 ]);
928 };
929 GeoTaggingAnalyzerService.prototype.isEnglishPostalCode = function (fieldRefName) {
930 var result = (GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
931 EnglishBackup.GeotaggingString_Post,
932 EnglishBackup.GeotaggingString_Zip])
933 && GeoTaggingAnalyzerService.hasMatches(fieldRefName, [this.GeotaggingString_Code])) ||
934 GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
935 EnglishBackup.GeotaggingString_PostalCode,
936 EnglishBackup.GeotaggingString_PostalCodes,
937 EnglishBackup.GeotaggingString_ZipCode,
938 EnglishBackup.GeotaggingString_ZipCodes
939 ]);
940 //Check again for strings without whitespace
941 if (!result) {
942 var whiteSpaceRegexPattern = new RegExp('\s');
943 result = GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
944 EnglishBackup.GeotaggingString_PostalCode.replace(whiteSpaceRegexPattern, ''),
945 EnglishBackup.GeotaggingString_PostalCodes.replace(whiteSpaceRegexPattern, ''),
946 EnglishBackup.GeotaggingString_ZipCode.replace(whiteSpaceRegexPattern, ''),
947 EnglishBackup.GeotaggingString_ZipCodes.replace(whiteSpaceRegexPattern, '')
948 ]);
949 }
950 return result;
951 };
952 GeoTaggingAnalyzerService.prototype.isEnglishLongitude = function (fieldRefName) {
953 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Longitude])
954 || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Longitude_Short], true /* useStrict */)
955 || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Longitude_Short2], true /* useStrict */);
956 };
957 GeoTaggingAnalyzerService.prototype.isEnglishLatitude = function (fieldRefName) {
958 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Latitude])
959 || GeoTaggingAnalyzerService.hasMatches(fieldRefName, [EnglishBackup.GeotaggingString_Latitude_Short], true /* useStrict */);
960 };
961 GeoTaggingAnalyzerService.prototype.isEnglishTerritory = function (fieldRefName) {
962 return GeoTaggingAnalyzerService.hasMatches(fieldRefName, [
963 EnglishBackup.GeotaggingString_Territory,
964 EnglishBackup.GeotaggingString_Territories
965 ]);
966 };
967 GeoTaggingAnalyzerService.prototype.getEnglishFieldType = function (fieldName) {
968 if (fieldName == null)
969 return undefined;
970 if (this.isEnglishLatitude(fieldName))
971 return powerbi.CategoryTypes.Latitude;
972 if (this.isEnglishLongitude(fieldName))
973 return powerbi.CategoryTypes.Longitude;
974 if (this.isEnglishPostalCode(fieldName))
975 return powerbi.CategoryTypes.PostalCode;
976 if (this.isEnglishAddress(fieldName))
977 return powerbi.CategoryTypes.Address;
978 if (this.isEnglishPlace(fieldName))
979 return powerbi.CategoryTypes.Place;
980 if (this.isEnglishCity(fieldName))
981 return powerbi.CategoryTypes.City;
982 if (this.isEnglishCountry(fieldName))
983 return powerbi.CategoryTypes.CountryRegion;
984 if (this.isEnglishCounty(fieldName))
985 return powerbi.CategoryTypes.County;
986 if (this.isEnglishStateOrProvince(fieldName))
987 return powerbi.CategoryTypes.StateOrProvince;
988 if (this.isEnglishContinent(fieldName))
989 return powerbi.CategoryTypes.Continent;
990 return undefined;
991 };
992 return GeoTaggingAnalyzerService;
993 }());
994 powerbi.GeoTaggingAnalyzerService = GeoTaggingAnalyzerService;
995 })(powerbi || (powerbi = {}));
996
997
998
999/***/ },
1000
1001/***/ 270:
1002/***/ function(module, exports, __webpack_require__) {
1003
1004 /*** IMPORTS FROM imports-loader ***/
1005 var jsCommon = window.jsCommon;
1006 var powerbi = window.powerbi;
1007 var powerbitests = window.powerbitests;
1008 var InJs = window.InJs;
1009 var debug = window.debug;
1010 var jasmine = window.jasmine;
1011 var Microsoft = window.Microsoft;
1012
1013 /*
1014 * Power BI Visualizations
1015 *
1016 * Copyright (c) Microsoft Corporation
1017 * All rights reserved.
1018 * MIT License
1019 *
1020 * Permission is hereby granted, free of charge, to any person obtaining a copy
1021 * of this software and associated documentation files (the ""Software""), to deal
1022 * in the Software without restriction, including without limitation the rights
1023 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1024 * copies of the Software, and to permit persons to whom the Software is
1025 * furnished to do so, subject to the following conditions:
1026 *
1027 * The above copyright notice and this permission notice shall be included in
1028 * all copies or substantial portions of the Software.
1029 *
1030 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1031 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1032 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1033 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1034 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1035 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1036 * THE SOFTWARE.
1037 */
1038 if (false)
1039 var DEBUG = true;
1040
1041
1042
1043/***/ },
1044
1045/***/ 271:
1046/***/ function(module, exports) {
1047
1048 /*** IMPORTS FROM imports-loader ***/
1049 var jsCommon = window.jsCommon;
1050 var powerbi = window.powerbi;
1051 var powerbitests = window.powerbitests;
1052 var InJs = window.InJs;
1053 var debug = window.debug;
1054 var jasmine = window.jasmine;
1055 var Microsoft = window.Microsoft;
1056
1057 /*
1058 * Power BI Visualizations
1059 *
1060 * Copyright (c) Microsoft Corporation
1061 * All rights reserved.
1062 * MIT License
1063 *
1064 * Permission is hereby granted, free of charge, to any person obtaining a copy
1065 * of this software and associated documentation files (the ""Software""), to deal
1066 * in the Software without restriction, including without limitation the rights
1067 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1068 * copies of the Software, and to permit persons to whom the Software is
1069 * furnished to do so, subject to the following conditions:
1070 *
1071 * The above copyright notice and this permission notice shall be included in
1072 * all copies or substantial portions of the Software.
1073 *
1074 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1075 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1076 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1077 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1078 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1079 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1080 * THE SOFTWARE.
1081 */
1082 /// <reference path="./_references.ts"/>
1083 var powerbi;
1084 (function (powerbi) {
1085 /**
1086 * Unlocalized strings to be used for error reporting.
1087 */
1088 var ClientErrorStrings;
1089 (function (ClientErrorStrings) {
1090 ClientErrorStrings.ClientErrorCode = 'Client Error Code';
1091 ClientErrorStrings.ErrorCode = 'Error Code';
1092 ClientErrorStrings.ErrorDetails = 'Error Details';
1093 ClientErrorStrings.HttpRequestId = 'HTTP Request Id';
1094 ClientErrorStrings.JobId = 'Job Id';
1095 ClientErrorStrings.ODataErrorMessage = 'OData Error Message';
1096 ClientErrorStrings.StackTrace = 'Stack Trace';
1097 })(ClientErrorStrings = powerbi.ClientErrorStrings || (powerbi.ClientErrorStrings = {}));
1098 /**
1099 this base class should be derived to give a generic error message but with a unique error code.
1100 */
1101 var UnknownClientError = (function () {
1102 function UnknownClientError(code) {
1103 debug.assertValue(code, 'code');
1104 this.errorCode = code;
1105 }
1106 Object.defineProperty(UnknownClientError.prototype, "code", {
1107 get: function () {
1108 return this.errorCode;
1109 },
1110 enumerable: true,
1111 configurable: true
1112 });
1113 Object.defineProperty(UnknownClientError.prototype, "ignorable", {
1114 get: function () {
1115 return false;
1116 },
1117 enumerable: true,
1118 configurable: true
1119 });
1120 UnknownClientError.prototype.getDetails = function (resourceProvider) {
1121 var details = {
1122 message: resourceProvider.get('ClientError_UnknownClientErrorValue'),
1123 displayableErrorInfo: [{ errorInfoKey: resourceProvider.get('ClientError_UnknownClientErrorKey'), errorInfoValue: resourceProvider.get('ClientError_UnknownClientErrorValue'), }],
1124 debugErrorInfo: [{ errorInfoKey: ClientErrorStrings.ClientErrorCode, errorInfoValue: this.code, }],
1125 };
1126 return details;
1127 };
1128 return UnknownClientError;
1129 }());
1130 powerbi.UnknownClientError = UnknownClientError;
1131 var HttpClientError = (function () {
1132 function HttpClientError(httpStatusCode, requestId) {
1133 debug.assertValue(httpStatusCode, 'httpStatusCode');
1134 debug.assertValue(requestId, 'requestId');
1135 this.httpStatusCode = httpStatusCode;
1136 this.httpRequestId = requestId;
1137 }
1138 Object.defineProperty(HttpClientError.prototype, "code", {
1139 get: function () {
1140 return 'HttpClientError';
1141 },
1142 enumerable: true,
1143 configurable: true
1144 });
1145 Object.defineProperty(HttpClientError.prototype, "ignorable", {
1146 get: function () {
1147 return false;
1148 },
1149 enumerable: true,
1150 configurable: true
1151 });
1152 Object.defineProperty(HttpClientError.prototype, "requestId", {
1153 get: function () {
1154 return this.httpRequestId;
1155 },
1156 enumerable: true,
1157 configurable: true
1158 });
1159 HttpClientError.prototype.getDetails = function (resourceProvider) {
1160 // Use a general error message for a HTTP request failure, since we currently do not know of any specifc error cases at this point in time.
1161 var details = {
1162 message: null,
1163 displayableErrorInfo: [
1164 { errorInfoKey: resourceProvider.get('DsrError_Key'), errorInfoValue: resourceProvider.get('DsrError_UnknownErrorValue') },
1165 { errorInfoKey: resourceProvider.get('ClientError_HttpResponseStatusCodeKey'), errorInfoValue: this.httpStatusCode.toString() }],
1166 debugErrorInfo: [
1167 { errorInfoKey: ClientErrorStrings.HttpRequestId, errorInfoValue: this.httpRequestId },
1168 { errorInfoKey: ClientErrorStrings.ClientErrorCode, errorInfoValue: this.code }
1169 ],
1170 };
1171 return details;
1172 };
1173 return HttpClientError;
1174 }());
1175 powerbi.HttpClientError = HttpClientError;
1176 var IgnorableClientError = (function () {
1177 function IgnorableClientError() {
1178 }
1179 Object.defineProperty(IgnorableClientError.prototype, "code", {
1180 get: function () {
1181 return 'IgnorableClientError';
1182 },
1183 enumerable: true,
1184 configurable: true
1185 });
1186 Object.defineProperty(IgnorableClientError.prototype, "ignorable", {
1187 get: function () {
1188 return true;
1189 },
1190 enumerable: true,
1191 configurable: true
1192 });
1193 IgnorableClientError.prototype.getDetails = function (resourceProvider) {
1194 var details = {
1195 message: '',
1196 displayableErrorInfo: [],
1197 };
1198 return details;
1199 };
1200 return IgnorableClientError;
1201 }());
1202 powerbi.IgnorableClientError = IgnorableClientError;
1203 })(powerbi || (powerbi = {}));
1204
1205
1206
1207/***/ },
1208
1209/***/ 272:
1210/***/ function(module, exports) {
1211
1212 /*** IMPORTS FROM imports-loader ***/
1213 var jsCommon = window.jsCommon;
1214 var powerbi = window.powerbi;
1215 var powerbitests = window.powerbitests;
1216 var InJs = window.InJs;
1217 var debug = window.debug;
1218 var jasmine = window.jasmine;
1219 var Microsoft = window.Microsoft;
1220
1221 /*
1222 * Power BI Visualizations
1223 *
1224 * Copyright (c) Microsoft Corporation
1225 * All rights reserved.
1226 * MIT License
1227 *
1228 * Permission is hereby granted, free of charge, to any person obtaining a copy
1229 * of this software and associated documentation files (the ""Software""), to deal
1230 * in the Software without restriction, including without limitation the rights
1231 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1232 * copies of the Software, and to permit persons to whom the Software is
1233 * furnished to do so, subject to the following conditions:
1234 *
1235 * The above copyright notice and this permission notice shall be included in
1236 * all copies or substantial portions of the Software.
1237 *
1238 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1239 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1240 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1241 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1242 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1243 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1244 * THE SOFTWARE.
1245 */
1246 /// <reference path="./_references.ts"/>
1247 var jsCommon;
1248 (function (jsCommon) {
1249 var ArrayExtensions;
1250 (function (ArrayExtensions) {
1251 /**
1252 * Returns items that exist in target and other.
1253 */
1254 function intersect(target, other) {
1255 var result = [];
1256 for (var i = target.length - 1; i >= 0; --i) {
1257 if (other.indexOf(target[i]) !== -1) {
1258 result.push(target[i]);
1259 }
1260 }
1261 return result;
1262 }
1263 ArrayExtensions.intersect = intersect;
1264 /**
1265 * Return elements exists in target but not exists in other.
1266 */
1267 function diff(target, other) {
1268 var result = [];
1269 for (var i = target.length - 1; i >= 0; --i) {
1270 var value = target[i];
1271 if (other.indexOf(value) === -1) {
1272 result.push(value);
1273 }
1274 }
1275 return result;
1276 }
1277 ArrayExtensions.diff = diff;
1278 /**
1279 * Return an array with only the distinct items in the source.
1280 */
1281 function distinct(source) {
1282 var result = [];
1283 for (var i = 0, len = source.length; i < len; i++) {
1284 var value = source[i];
1285 if (result.indexOf(value) === -1) {
1286 result.push(value);
1287 }
1288 }
1289 return result;
1290 }
1291 ArrayExtensions.distinct = distinct;
1292 /**
1293 * Pushes content of source onto target,
1294 * for parts of course that do not already exist in target.
1295 */
1296 function union(target, source) {
1297 for (var i = 0, len = source.length; i < len; ++i) {
1298 unionSingle(target, source[i]);
1299 }
1300 }
1301 ArrayExtensions.union = union;
1302 /**
1303 * Pushes value onto target, if value does not already exist in target.
1304 */
1305 function unionSingle(target, value) {
1306 if (target.indexOf(value) < 0) {
1307 target.push(value);
1308 }
1309 }
1310 ArrayExtensions.unionSingle = unionSingle;
1311 /**
1312 * Returns an array with a range of items from source,
1313 * including the startIndex & endIndex.
1314 */
1315 function range(source, startIndex, endIndex) {
1316 debug.assert(startIndex >= 0 && startIndex < source.length, 'startIndex is out of range.');
1317 debug.assert(endIndex >= 0 && endIndex < source.length, 'endIndex is out of range.');
1318 var result = [];
1319 for (var i = startIndex; i <= endIndex; ++i) {
1320 result.push(source[i]);
1321 }
1322 return result;
1323 }
1324 ArrayExtensions.range = range;
1325 /**
1326 * Returns an array that includes items from source, up to the specified count.
1327 */
1328 function take(source, count) {
1329 debug.assert(count >= 0, 'Count is negative.');
1330 debug.assert(count <= source.length, 'Count is too large.');
1331 var result = [];
1332 for (var i = 0; i < count; ++i) {
1333 result.push(source[i]);
1334 }
1335 return result;
1336 }
1337 ArrayExtensions.take = take;
1338 function copy(source) {
1339 debug.assertValue(source, 'source');
1340 return take(source, source.length);
1341 }
1342 ArrayExtensions.copy = copy;
1343 /**
1344 * Returns a value indicating whether the arrays have the same values in the same sequence.
1345 */
1346 function sequenceEqual(left, right, comparison) {
1347 debug.assertValue(comparison, 'comparison');
1348 // Normalize falsy to null
1349 if (!left) {
1350 left = null;
1351 }
1352 if (!right) {
1353 right = null;
1354 }
1355 if (left === right) {
1356 return true;
1357 }
1358 if (!!left !== !!right) {
1359 return false;
1360 }
1361 var len = left.length;
1362 if (len !== right.length) {
1363 return false;
1364 }
1365 var i = 0;
1366 while (i < len && comparison(left[i], right[i])) {
1367 ++i;
1368 }
1369 return i === len;
1370 }
1371 ArrayExtensions.sequenceEqual = sequenceEqual;
1372 /**
1373 * Returns null if the specified array is empty.
1374 * Otherwise returns the specified array.
1375 */
1376 function emptyToNull(array) {
1377 if (array && array.length === 0) {
1378 return null;
1379 }
1380 return array;
1381 }
1382 ArrayExtensions.emptyToNull = emptyToNull;
1383 function indexOf(array, predicate) {
1384 debug.assertValue(array, 'array');
1385 debug.assertValue(predicate, 'predicate');
1386 for (var i = 0, len = array.length; i < len; ++i) {
1387 if (predicate(array[i])) {
1388 return i;
1389 }
1390 }
1391 return -1;
1392 }
1393 ArrayExtensions.indexOf = indexOf;
1394 /**
1395 * Returns a copy of the array rotated by the specified offset.
1396 */
1397 function rotate(array, offset) {
1398 if (offset === 0)
1399 return array.slice();
1400 var rotated = array.slice(offset);
1401 Array.prototype.push.apply(rotated, array.slice(0, offset));
1402 return rotated;
1403 }
1404 ArrayExtensions.rotate = rotate;
1405 function createWithId() {
1406 return extendWithId([]);
1407 }
1408 ArrayExtensions.createWithId = createWithId;
1409 function extendWithId(array) {
1410 debug.assertValue(array, 'array');
1411 var extended = array;
1412 extended.withId = withId;
1413 return extended;
1414 }
1415 ArrayExtensions.extendWithId = extendWithId;
1416 /**
1417 * Finds and returns the first item with a matching ID.
1418 */
1419 function findWithId(array, id) {
1420 for (var i = 0, len = array.length; i < len; i++) {
1421 var item = array[i];
1422 if (item.id === id)
1423 return item;
1424 }
1425 }
1426 ArrayExtensions.findWithId = findWithId;
1427 function withId(id) {
1428 return ArrayExtensions.findWithId(this, id);
1429 }
1430 function createWithName() {
1431 return extendWithName([]);
1432 }
1433 ArrayExtensions.createWithName = createWithName;
1434 function extendWithName(array) {
1435 debug.assertValue(array, 'array');
1436 var extended = array;
1437 extended.withName = withName;
1438 return extended;
1439 }
1440 ArrayExtensions.extendWithName = extendWithName;
1441 function findItemWithName(array, name) {
1442 var index = indexWithName(array, name);
1443 if (index >= 0)
1444 return array[index];
1445 }
1446 ArrayExtensions.findItemWithName = findItemWithName;
1447 function indexWithName(array, name) {
1448 for (var i = 0, len = array.length; i < len; i++) {
1449 var item = array[i];
1450 if (item.name === name)
1451 return i;
1452 }
1453 return -1;
1454 }
1455 ArrayExtensions.indexWithName = indexWithName;
1456 /**
1457 * Inserts a number in sorted order into a list of numbers already in sorted order.
1458 * @returns True if the item was added, false if it already existed.
1459 */
1460 function insertSorted(list, value) {
1461 debug.assertValue(list, 'list');
1462 debug.assertValue(value, 'value');
1463 var len = list.length;
1464 // NOTE: iterate backwards because incoming values tend to be sorted already.
1465 for (var i = len - 1; i >= 0; i--) {
1466 var diff_1 = list[i] - value;
1467 if (diff_1 === 0)
1468 return false;
1469 if (diff_1 > 0)
1470 continue;
1471 // diff < 0
1472 list.splice(i + 1, 0, value);
1473 return true;
1474 }
1475 list.unshift(value);
1476 return true;
1477 }
1478 ArrayExtensions.insertSorted = insertSorted;
1479 /**
1480 * Removes the first occurrence of a value from a list if it exists.
1481 * @returns True if the value was removed, false if it did not exist in the list.
1482 */
1483 function removeFirst(list, value) {
1484 var index = list.indexOf(value);
1485 if (index < 0)
1486 return false;
1487 list.splice(index, 1);
1488 return true;
1489 }
1490 ArrayExtensions.removeFirst = removeFirst;
1491 /**
1492 * Finds and returns the first item with a matching name.
1493 */
1494 function withName(name) {
1495 var array = this;
1496 return findItemWithName(array, name);
1497 }
1498 /**
1499 * Deletes all items from the array.
1500 */
1501 function clear(array) {
1502 if (!array)
1503 return;
1504 while (array.length > 0)
1505 array.pop();
1506 }
1507 ArrayExtensions.clear = clear;
1508 function isUndefinedOrEmpty(array) {
1509 if (!array || array.length === 0) {
1510 return true;
1511 }
1512 return false;
1513 }
1514 ArrayExtensions.isUndefinedOrEmpty = isUndefinedOrEmpty;
1515 function swap(array, firstIndex, secondIndex) {
1516 var temp = array[firstIndex];
1517 array[firstIndex] = array[secondIndex];
1518 array[secondIndex] = temp;
1519 }
1520 ArrayExtensions.swap = swap;
1521 function isInArray(array, lookupItem, compareCallback) {
1522 return _.any(array, function (item) { return compareCallback(item, lookupItem); });
1523 }
1524 ArrayExtensions.isInArray = isInArray;
1525 /** Checks if the given object is an Array, and looking all the way up the prototype chain. */
1526 function isArrayOrInheritedArray(obj) {
1527 debug.assertValue(obj, 'obj');
1528 var nextPrototype = obj;
1529 while (nextPrototype != null) {
1530 if (_.isArray(nextPrototype))
1531 return true;
1532 nextPrototype = Object.getPrototypeOf(nextPrototype);
1533 }
1534 return false;
1535 }
1536 ArrayExtensions.isArrayOrInheritedArray = isArrayOrInheritedArray;
1537 /**
1538 * Returns true if the specified values array is sorted in an order as determined by the specified compareFunction.
1539 */
1540 function isSorted(values, compareFunction) {
1541 debug.assertValue(values, 'values');
1542 debug.assertValue(compareFunction, 'compareFunction');
1543 var ilen = values.length;
1544 if (ilen >= 2) {
1545 for (var i = 1; i < ilen; i++) {
1546 if (compareFunction(values[i - 1], values[i]) > 0) {
1547 return false;
1548 }
1549 }
1550 }
1551 return true;
1552 }
1553 ArrayExtensions.isSorted = isSorted;
1554 /**
1555 * Returns true if the specified number values array is sorted in ascending order
1556 * (or descending order if the specified descendingOrder is truthy).
1557 */
1558 function isSortedNumeric(values, descendingOrder) {
1559 debug.assertValue(values, 'values');
1560 debug.assertAnyValue(descendingOrder, 'descendingOrder');
1561 var compareFunction = descendingOrder ?
1562 function (a, b) { return b - a; } :
1563 function (a, b) { return a - b; };
1564 return isSorted(values, compareFunction);
1565 }
1566 ArrayExtensions.isSortedNumeric = isSortedNumeric;
1567 })(ArrayExtensions = jsCommon.ArrayExtensions || (jsCommon.ArrayExtensions = {}));
1568 })(jsCommon || (jsCommon = {}));
1569
1570
1571
1572/***/ },
1573
1574/***/ 273:
1575/***/ function(module, exports) {
1576
1577 /*** IMPORTS FROM imports-loader ***/
1578 var jsCommon = window.jsCommon;
1579 var powerbi = window.powerbi;
1580 var powerbitests = window.powerbitests;
1581 var InJs = window.InJs;
1582 var debug = window.debug;
1583 var jasmine = window.jasmine;
1584 var Microsoft = window.Microsoft;
1585
1586 /*
1587 * Power BI Visualizations
1588 *
1589 * Copyright (c) Microsoft Corporation
1590 * All rights reserved.
1591 * MIT License
1592 *
1593 * Permission is hereby granted, free of charge, to any person obtaining a copy
1594 * of this software and associated documentation files (the ""Software""), to deal
1595 * in the Software without restriction, including without limitation the rights
1596 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1597 * copies of the Software, and to permit persons to whom the Software is
1598 * furnished to do so, subject to the following conditions:
1599 *
1600 * The above copyright notice and this permission notice shall be included in
1601 * all copies or substantial portions of the Software.
1602 *
1603 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1604 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1605 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1606 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1607 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1608 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1609 * THE SOFTWARE.
1610 */
1611 /// <reference path="../_references.ts"/>
1612 var InJs;
1613 (function (InJs) {
1614 var DomFactory;
1615 (function (DomFactory) {
1616 function div() {
1617 return $('<div/>');
1618 }
1619 DomFactory.div = div;
1620 function span() {
1621 return $('<span/>');
1622 }
1623 DomFactory.span = span;
1624 function checkbox() {
1625 return $('<input type="checkbox"/>');
1626 }
1627 DomFactory.checkbox = checkbox;
1628 function ul() {
1629 return $('<ul/>');
1630 }
1631 DomFactory.ul = ul;
1632 function li() {
1633 return $('<li/>');
1634 }
1635 DomFactory.li = li;
1636 function button() {
1637 return $('<input type="button"/>');
1638 }
1639 DomFactory.button = button;
1640 function select() {
1641 return $('<select/>');
1642 }
1643 DomFactory.select = select;
1644 function textBox() {
1645 return $('<input type="text"/>');
1646 }
1647 DomFactory.textBox = textBox;
1648 function img() {
1649 return $('<img/>');
1650 }
1651 DomFactory.img = img;
1652 function iframe() {
1653 return $('<iframe/>');
1654 }
1655 DomFactory.iframe = iframe;
1656 })(DomFactory = InJs.DomFactory || (InJs.DomFactory = {}));
1657 })(InJs || (InJs = {}));
1658
1659
1660
1661/***/ },
1662
1663/***/ 274:
1664/***/ function(module, exports) {
1665
1666 /*** IMPORTS FROM imports-loader ***/
1667 var jsCommon = window.jsCommon;
1668 var powerbi = window.powerbi;
1669 var powerbitests = window.powerbitests;
1670 var InJs = window.InJs;
1671 var debug = window.debug;
1672 var jasmine = window.jasmine;
1673 var Microsoft = window.Microsoft;
1674
1675 /*
1676 * Power BI Visualizations
1677 *
1678 * Copyright (c) Microsoft Corporation
1679 * All rights reserved.
1680 * MIT License
1681 *
1682 * Permission is hereby granted, free of charge, to any person obtaining a copy
1683 * of this software and associated documentation files (the ""Software""), to deal
1684 * in the Software without restriction, including without limitation the rights
1685 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1686 * copies of the Software, and to permit persons to whom the Software is
1687 * furnished to do so, subject to the following conditions:
1688 *
1689 * The above copyright notice and this permission notice shall be included in
1690 * all copies or substantial portions of the Software.
1691 *
1692 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1693 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1694 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1695 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1696 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1697 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1698 * THE SOFTWARE.
1699 */
1700 /// <reference path="./_references.ts"/>
1701 var powerbi;
1702 (function (powerbi) {
1703 /**
1704 * Module Double contains a set of constants and precision based utility methods
1705 * for dealing with doubles and their decimal garbage in the javascript.
1706 */
1707 var Double;
1708 (function (Double) {
1709 // Constants.
1710 Double.MIN_VALUE = -Number.MAX_VALUE;
1711 Double.MAX_VALUE = Number.MAX_VALUE;
1712 Double.MIN_EXP = -308;
1713 Double.MAX_EXP = 308;
1714 Double.EPSILON = 1E-323;
1715 Double.DEFAULT_PRECISION = 0.0001;
1716 Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS = 12;
1717 Double.LOG_E_10 = Math.log(10);
1718 Double.POSITIVE_POWERS = [
1719 1E0, 1E1, 1E2, 1E3, 1E4, 1E5, 1E6, 1E7, 1E8, 1E9, 1E10, 1E11, 1E12, 1E13, 1E14, 1E15, 1E16, 1E17, 1E18, 1E19, 1E20, 1E21, 1E22, 1E23, 1E24, 1E25, 1E26, 1E27, 1E28, 1E29, 1E30, 1E31, 1E32, 1E33, 1E34, 1E35, 1E36, 1E37, 1E38, 1E39, 1E40, 1E41, 1E42, 1E43, 1E44, 1E45, 1E46, 1E47, 1E48, 1E49, 1E50, 1E51, 1E52, 1E53, 1E54, 1E55, 1E56, 1E57, 1E58, 1E59, 1E60, 1E61, 1E62, 1E63, 1E64, 1E65, 1E66, 1E67, 1E68, 1E69, 1E70, 1E71, 1E72, 1E73, 1E74, 1E75, 1E76, 1E77, 1E78, 1E79, 1E80, 1E81, 1E82, 1E83, 1E84, 1E85, 1E86, 1E87, 1E88, 1E89, 1E90, 1E91, 1E92, 1E93, 1E94, 1E95, 1E96, 1E97, 1E98, 1E99,
1720 1E100, 1E101, 1E102, 1E103, 1E104, 1E105, 1E106, 1E107, 1E108, 1E109, 1E110, 1E111, 1E112, 1E113, 1E114, 1E115, 1E116, 1E117, 1E118, 1E119, 1E120, 1E121, 1E122, 1E123, 1E124, 1E125, 1E126, 1E127, 1E128, 1E129, 1E130, 1E131, 1E132, 1E133, 1E134, 1E135, 1E136, 1E137, 1E138, 1E139, 1E140, 1E141, 1E142, 1E143, 1E144, 1E145, 1E146, 1E147, 1E148, 1E149, 1E150, 1E151, 1E152, 1E153, 1E154, 1E155, 1E156, 1E157, 1E158, 1E159, 1E160, 1E161, 1E162, 1E163, 1E164, 1E165, 1E166, 1E167, 1E168, 1E169, 1E170, 1E171, 1E172, 1E173, 1E174, 1E175, 1E176, 1E177, 1E178, 1E179, 1E180, 1E181, 1E182, 1E183, 1E184, 1E185, 1E186, 1E187, 1E188, 1E189, 1E190, 1E191, 1E192, 1E193, 1E194, 1E195, 1E196, 1E197, 1E198, 1E199,
1721 1E200, 1E201, 1E202, 1E203, 1E204, 1E205, 1E206, 1E207, 1E208, 1E209, 1E210, 1E211, 1E212, 1E213, 1E214, 1E215, 1E216, 1E217, 1E218, 1E219, 1E220, 1E221, 1E222, 1E223, 1E224, 1E225, 1E226, 1E227, 1E228, 1E229, 1E230, 1E231, 1E232, 1E233, 1E234, 1E235, 1E236, 1E237, 1E238, 1E239, 1E240, 1E241, 1E242, 1E243, 1E244, 1E245, 1E246, 1E247, 1E248, 1E249, 1E250, 1E251, 1E252, 1E253, 1E254, 1E255, 1E256, 1E257, 1E258, 1E259, 1E260, 1E261, 1E262, 1E263, 1E264, 1E265, 1E266, 1E267, 1E268, 1E269, 1E270, 1E271, 1E272, 1E273, 1E274, 1E275, 1E276, 1E277, 1E278, 1E279, 1E280, 1E281, 1E282, 1E283, 1E284, 1E285, 1E286, 1E287, 1E288, 1E289, 1E290, 1E291, 1E292, 1E293, 1E294, 1E295, 1E296, 1E297, 1E298, 1E299,
1722 1E300, 1E301, 1E302, 1E303, 1E304, 1E305, 1E306, 1E307, 1E308];
1723 Double.NEGATIVE_POWERS = [
1724 1E0, 1E-1, 1E-2, 1E-3, 1E-4, 1E-5, 1E-6, 1E-7, 1E-8, 1E-9, 1E-10, 1E-11, 1E-12, 1E-13, 1E-14, 1E-15, 1E-16, 1E-17, 1E-18, 1E-19, 1E-20, 1E-21, 1E-22, 1E-23, 1E-24, 1E-25, 1E-26, 1E-27, 1E-28, 1E-29, 1E-30, 1E-31, 1E-32, 1E-33, 1E-34, 1E-35, 1E-36, 1E-37, 1E-38, 1E-39, 1E-40, 1E-41, 1E-42, 1E-43, 1E-44, 1E-45, 1E-46, 1E-47, 1E-48, 1E-49, 1E-50, 1E-51, 1E-52, 1E-53, 1E-54, 1E-55, 1E-56, 1E-57, 1E-58, 1E-59, 1E-60, 1E-61, 1E-62, 1E-63, 1E-64, 1E-65, 1E-66, 1E-67, 1E-68, 1E-69, 1E-70, 1E-71, 1E-72, 1E-73, 1E-74, 1E-75, 1E-76, 1E-77, 1E-78, 1E-79, 1E-80, 1E-81, 1E-82, 1E-83, 1E-84, 1E-85, 1E-86, 1E-87, 1E-88, 1E-89, 1E-90, 1E-91, 1E-92, 1E-93, 1E-94, 1E-95, 1E-96, 1E-97, 1E-98, 1E-99,
1725 1E-100, 1E-101, 1E-102, 1E-103, 1E-104, 1E-105, 1E-106, 1E-107, 1E-108, 1E-109, 1E-110, 1E-111, 1E-112, 1E-113, 1E-114, 1E-115, 1E-116, 1E-117, 1E-118, 1E-119, 1E-120, 1E-121, 1E-122, 1E-123, 1E-124, 1E-125, 1E-126, 1E-127, 1E-128, 1E-129, 1E-130, 1E-131, 1E-132, 1E-133, 1E-134, 1E-135, 1E-136, 1E-137, 1E-138, 1E-139, 1E-140, 1E-141, 1E-142, 1E-143, 1E-144, 1E-145, 1E-146, 1E-147, 1E-148, 1E-149, 1E-150, 1E-151, 1E-152, 1E-153, 1E-154, 1E-155, 1E-156, 1E-157, 1E-158, 1E-159, 1E-160, 1E-161, 1E-162, 1E-163, 1E-164, 1E-165, 1E-166, 1E-167, 1E-168, 1E-169, 1E-170, 1E-171, 1E-172, 1E-173, 1E-174, 1E-175, 1E-176, 1E-177, 1E-178, 1E-179, 1E-180, 1E-181, 1E-182, 1E-183, 1E-184, 1E-185, 1E-186, 1E-187, 1E-188, 1E-189, 1E-190, 1E-191, 1E-192, 1E-193, 1E-194, 1E-195, 1E-196, 1E-197, 1E-198, 1E-199,
1726 1E-200, 1E-201, 1E-202, 1E-203, 1E-204, 1E-205, 1E-206, 1E-207, 1E-208, 1E-209, 1E-210, 1E-211, 1E-212, 1E-213, 1E-214, 1E-215, 1E-216, 1E-217, 1E-218, 1E-219, 1E-220, 1E-221, 1E-222, 1E-223, 1E-224, 1E-225, 1E-226, 1E-227, 1E-228, 1E-229, 1E-230, 1E-231, 1E-232, 1E-233, 1E-234, 1E-235, 1E-236, 1E-237, 1E-238, 1E-239, 1E-240, 1E-241, 1E-242, 1E-243, 1E-244, 1E-245, 1E-246, 1E-247, 1E-248, 1E-249, 1E-250, 1E-251, 1E-252, 1E-253, 1E-254, 1E-255, 1E-256, 1E-257, 1E-258, 1E-259, 1E-260, 1E-261, 1E-262, 1E-263, 1E-264, 1E-265, 1E-266, 1E-267, 1E-268, 1E-269, 1E-270, 1E-271, 1E-272, 1E-273, 1E-274, 1E-275, 1E-276, 1E-277, 1E-278, 1E-279, 1E-280, 1E-281, 1E-282, 1E-283, 1E-284, 1E-285, 1E-286, 1E-287, 1E-288, 1E-289, 1E-290, 1E-291, 1E-292, 1E-293, 1E-294, 1E-295, 1E-296, 1E-297, 1E-298, 1E-299,
1727 1E-300, 1E-301, 1E-302, 1E-303, 1E-304, 1E-305, 1E-306, 1E-307, 1E-308, 1E-309, 1E-310, 1E-311, 1E-312, 1E-313, 1E-314, 1E-315, 1E-316, 1E-317, 1E-318, 1E-319, 1E-320, 1E-321, 1E-322, 1E-323, 1E-324];
1728 /**
1729 * Returns powers of 10.
1730 * Unlike the Math.pow this function produces no decimal garbage.
1731 * @param exp Exponent.
1732 */
1733 function pow10(exp) {
1734 debug.assertValue(exp, "exp");
1735 // Positive & zero
1736 if (exp >= 0) {
1737 if (exp < Double.POSITIVE_POWERS.length) {
1738 return Double.POSITIVE_POWERS[exp];
1739 }
1740 else {
1741 return Infinity;
1742 }
1743 }
1744 // Negative
1745 exp = -exp;
1746 if (exp > 0 && exp < Double.NEGATIVE_POWERS.length) {
1747 return Double.NEGATIVE_POWERS[exp];
1748 }
1749 else {
1750 return 0;
1751 }
1752 }
1753 Double.pow10 = pow10;
1754 /**
1755 * Returns the 10 base logarithm of the number.
1756 * Unlike Math.log function this produces integer results with no decimal garbage.
1757 * @param val Positive value or zero.
1758 */
1759 function log10(val) {
1760 debug.assert(val >= 0, "val");
1761 // Fast Log10() algorithm
1762 if (val > 1 && val < 1E16) {
1763 if (val < 1E8) {
1764 if (val < 1E4) {
1765 if (val < 1E2) {
1766 if (val < 1E1) {
1767 return 0;
1768 }
1769 else {
1770 return 1;
1771 }
1772 }
1773 else {
1774 if (val < 1E3) {
1775 return 2;
1776 }
1777 else {
1778 return 3;
1779 }
1780 }
1781 }
1782 else {
1783 if (val < 1E6) {
1784 if (val < 1E5) {
1785 return 4;
1786 }
1787 else {
1788 return 5;
1789 }
1790 }
1791 else {
1792 if (val < 1E7) {
1793 return 6;
1794 }
1795 else {
1796 return 7;
1797 }
1798 }
1799 }
1800 }
1801 else {
1802 if (val < 1E12) {
1803 if (val < 1E10) {
1804 if (val < 1E9) {
1805 return 8;
1806 }
1807 else {
1808 return 9;
1809 }
1810 }
1811 else {
1812 if (val < 1E11) {
1813 return 10;
1814 }
1815 else {
1816 return 11;
1817 }
1818 }
1819 }
1820 else {
1821 if (val < 1E14) {
1822 if (val < 1E13) {
1823 return 12;
1824 }
1825 else {
1826 return 13;
1827 }
1828 }
1829 else {
1830 if (val < 1E15) {
1831 return 14;
1832 }
1833 else {
1834 return 15;
1835 }
1836 }
1837 }
1838 }
1839 }
1840 if (val > 1E-16 && val < 1) {
1841 if (val < 1E-8) {
1842 if (val < 1E-12) {
1843 if (val < 1E-14) {
1844 if (val < 1E-15) {
1845 return -16;
1846 }
1847 else {
1848 return -15;
1849 }
1850 }
1851 else {
1852 if (val < 1E-13) {
1853 return -14;
1854 }
1855 else {
1856 return -13;
1857 }
1858 }
1859 }
1860 else {
1861 if (val < 1E-10) {
1862 if (val < 1E-11) {
1863 return -12;
1864 }
1865 else {
1866 return -11;
1867 }
1868 }
1869 else {
1870 if (val < 1E-9) {
1871 return -10;
1872 }
1873 else {
1874 return -9;
1875 }
1876 }
1877 }
1878 }
1879 else {
1880 if (val < 1E-4) {
1881 if (val < 1E-6) {
1882 if (val < 1E-7) {
1883 return -8;
1884 }
1885 else {
1886 return -7;
1887 }
1888 }
1889 else {
1890 if (val < 1E-5) {
1891 return -6;
1892 }
1893 else {
1894 return -5;
1895 }
1896 }
1897 }
1898 else {
1899 if (val < 1E-2) {
1900 if (val < 1E-3) {
1901 return -4;
1902 }
1903 else {
1904 return -3;
1905 }
1906 }
1907 else {
1908 if (val < 1E-1) {
1909 return -2;
1910 }
1911 else {
1912 return -1;
1913 }
1914 }
1915 }
1916 }
1917 }
1918 // JS Math provides only natural log function so we need to calc the 10 base logarithm:
1919 // logb(x) = logk(x)/logk(b);
1920 var log10 = Math.log(val) / Double.LOG_E_10;
1921 return Double.floorWithPrecision(log10);
1922 }
1923 Double.log10 = log10;
1924 /**
1925 * Returns a power of 10 representing precision of the number based on the number of meaningful decimal digits.
1926 * For example the precision of 56,263.3767 with the 6 meaningful decimal digit is 0.1.
1927 * @param x Value.
1928 * @param decimalDigits How many decimal digits are meaningfull.
1929 */
1930 function getPrecision(x, decimalDigits) {
1931 if (decimalDigits === undefined) {
1932 decimalDigits = Double.DEFAULT_PRECISION_IN_DECIMAL_DIGITS;
1933 }
1934 else {
1935 debug.assert(decimalDigits >= 0, "decimalDigits");
1936 }
1937 if (!x) {
1938 return undefined;
1939 }
1940 var exp = Double.log10(Math.abs(x));
1941 if (exp < Double.MIN_EXP) {
1942 return 0;
1943 }
1944 var precisionExp = Math.max(exp - decimalDigits, -Double.NEGATIVE_POWERS.length + 1);
1945 return Double.pow10(precisionExp);
1946 }
1947 Double.getPrecision = getPrecision;
1948 /**
1949 * Checks if a delta between 2 numbers is less than provided precision.
1950 * @param x One value.
1951 * @param y Another value.
1952 * @param precision Precision value.
1953 */
1954 function equalWithPrecision(x, y, precision) {
1955 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
1956 debug.assert(precision >= 0, "precision");
1957 return x === y || Math.abs(x - y) < precision;
1958 }
1959 Double.equalWithPrecision = equalWithPrecision;
1960 /**
1961 * Checks if a first value is less than another taking
1962 * into account the loose precision based equality.
1963 * @param x One value.
1964 * @param y Another value.
1965 * @param precision Precision value.
1966 */
1967 function lessWithPrecision(x, y, precision) {
1968 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
1969 debug.assert(precision >= 0, "precision");
1970 return x < y && Math.abs(x - y) > precision;
1971 }
1972 Double.lessWithPrecision = lessWithPrecision;
1973 /**
1974 * Checks if a first value is less or equal than another taking
1975 * into account the loose precision based equality.
1976 * @param x One value.
1977 * @param y Another value.
1978 * @param precision Precision value.
1979 */
1980 function lessOrEqualWithPrecision(x, y, precision) {
1981 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
1982 debug.assert(precision >= 0, "precision");
1983 return x < y || Math.abs(x - y) < precision;
1984 }
1985 Double.lessOrEqualWithPrecision = lessOrEqualWithPrecision;
1986 /**
1987 * Checks if a first value is greater than another taking
1988 * into account the loose precision based equality.
1989 * @param x One value.
1990 * @param y Another value.
1991 * @param precision Precision value.
1992 */
1993 function greaterWithPrecision(x, y, precision) {
1994 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
1995 debug.assert(precision >= 0, "precision");
1996 return x > y && Math.abs(x - y) > precision;
1997 }
1998 Double.greaterWithPrecision = greaterWithPrecision;
1999 /**
2000 * Checks if a first value is greater or equal to another taking
2001 * into account the loose precision based equality.
2002 * @param x One value.
2003 * @param y Another value.
2004 * @param precision Precision value.
2005 */
2006 function greaterOrEqualWithPrecision(x, y, precision) {
2007 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
2008 debug.assert(precision >= 0, "precision");
2009 return x > y || Math.abs(x - y) < precision;
2010 }
2011 Double.greaterOrEqualWithPrecision = greaterOrEqualWithPrecision;
2012 /**
2013 * Floors the number unless it's withing the precision distance from the higher int.
2014 * @param x One value.
2015 * @param precision Precision value.
2016 */
2017 function floorWithPrecision(x, precision) {
2018 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
2019 debug.assert(precision >= 0, "precision");
2020 var roundX = Math.round(x);
2021 if (Math.abs(x - roundX) < precision) {
2022 return roundX;
2023 }
2024 else {
2025 return Math.floor(x);
2026 }
2027 }
2028 Double.floorWithPrecision = floorWithPrecision;
2029 /**
2030 * Ceils the number unless it's withing the precision distance from the lower int.
2031 * @param x One value.
2032 * @param precision Precision value.
2033 */
2034 function ceilWithPrecision(x, precision) {
2035 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
2036 debug.assert(precision >= 0, "precision");
2037 var roundX = Math.round(x);
2038 if (Math.abs(x - roundX) < precision) {
2039 return roundX;
2040 }
2041 else {
2042 return Math.ceil(x);
2043 }
2044 }
2045 Double.ceilWithPrecision = ceilWithPrecision;
2046 /**
2047 * Floors the number to the provided precision.
2048 * For example 234,578 floored to 1,000 precision is 234,000.
2049 * @param x One value.
2050 * @param precision Precision value.
2051 */
2052 function floorToPrecision(x, precision) {
2053 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
2054 debug.assert(precision >= 0, "precision");
2055 if (precision === 0 || x === 0) {
2056 return x;
2057 }
2058 //Precision must be a Power of 10
2059 return Math.floor(x / precision) * precision;
2060 }
2061 Double.floorToPrecision = floorToPrecision;
2062 /**
2063 * Ceils the number to the provided precision.
2064 * For example 234,578 floored to 1,000 precision is 235,000.
2065 * @param x One value.
2066 * @param precision Precision value.
2067 */
2068 function ceilToPrecision(x, precision) {
2069 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
2070 debug.assert(precision >= 0, "precision");
2071 if (precision === 0 || x === 0) {
2072 return x;
2073 }
2074 //Precision must be a Power of 10
2075 return Math.ceil(x / precision) * precision;
2076 }
2077 Double.ceilToPrecision = ceilToPrecision;
2078 /**
2079 * Rounds the number to the provided precision.
2080 * For example 234,578 floored to 1,000 precision is 235,000.
2081 * @param x One value.
2082 * @param precision Precision value.
2083 */
2084 function roundToPrecision(x, precision) {
2085 precision = applyDefault(precision, Double.DEFAULT_PRECISION);
2086 debug.assert(precision >= 0, "precision");
2087 if (precision === 0 || x === 0) {
2088 return x;
2089 }
2090 //Precision must be a Power of 10
2091 var result = Math.round(x / precision) * precision;
2092 var decimalDigits = Math.round(Double.log10(Math.abs(x)) - Double.log10(precision)) + 1;
2093 if (decimalDigits > 0 && decimalDigits < 16) {
2094 result = parseFloat(result.toPrecision(decimalDigits));
2095 }
2096 return result;
2097 }
2098 Double.roundToPrecision = roundToPrecision;
2099 /**
2100 * Returns the value making sure that it's restricted to the provided range.
2101 * @param x One value.
2102 * @param min Range min boundary.
2103 * @param max Range max boundary.
2104 */
2105 function ensureInRange(x, min, max) {
2106 debug.assert(min <= max, "min must be less or equal to max");
2107 if (x === undefined || x === null) {
2108 return x;
2109 }
2110 if (x < min) {
2111 return min;
2112 }
2113 if (x > max) {
2114 return max;
2115 }
2116 return x;
2117 }
2118 Double.ensureInRange = ensureInRange;
2119 /**
2120 * Rounds the value - this method is actually faster than Math.round - used in the graphics utils.
2121 * @param x Value to round.
2122 */
2123 function round(x) {
2124 debug.assert(x >= 0, "x must be greater or equal to 0");
2125 return (0.5 + x) << 0;
2126 }
2127 Double.round = round;
2128 /**
2129 * Projects the value from the source range into the target range.
2130 * @param value Value to project.
2131 * @param fromMin Minimum of the source range.
2132 * @param toMin Minimum of the target range.
2133 * @param toMax Maximum of the target range.
2134 */
2135 function project(value, fromMin, fromSize, toMin, toSize) {
2136 if (fromSize === 0 || toSize === 0) {
2137 if (fromMin <= value && value <= fromMin + fromSize) {
2138 return toMin;
2139 }
2140 else {
2141 return NaN;
2142 }
2143 }
2144 var relativeX = (value - fromMin) / fromSize;
2145 var projectedX = toMin + relativeX * toSize;
2146 return projectedX;
2147 }
2148 Double.project = project;
2149 /**
2150 * Removes decimal noise.
2151 * @param value Value to be processed.
2152 */
2153 function removeDecimalNoise(value) {
2154 return roundToPrecision(value, getPrecision(value));
2155 }
2156 Double.removeDecimalNoise = removeDecimalNoise;
2157 /**
2158 * Checks whether the number is integer.
2159 * @param value Value to be checked.
2160 */
2161 function isInteger(value) {
2162 return value !== null && value % 1 === 0;
2163 }
2164 Double.isInteger = isInteger;
2165 /**
2166 * Dividing by increment will give us count of increments
2167 * Round out the rough edges into even integer
2168 * Multiply back by increment to get rounded value
2169 * e.g. Rounder.toIncrement(0.647291, 0.05) => 0.65
2170 * @param value - value to round to nearest increment
2171 * @param increment - smallest increment to round toward
2172 */
2173 function toIncrement(value, increment) {
2174 return Math.round(value / increment) * increment;
2175 }
2176 Double.toIncrement = toIncrement;
2177 })(Double = powerbi.Double || (powerbi.Double = {}));
2178 function applyDefault(value, defaultValue) {
2179 return value !== undefined ? value : defaultValue;
2180 }
2181 })(powerbi || (powerbi = {}));
2182
2183
2184
2185/***/ },
2186
2187/***/ 275:
2188/***/ function(module, exports) {
2189
2190 /*** IMPORTS FROM imports-loader ***/
2191 var jsCommon = window.jsCommon;
2192 var powerbi = window.powerbi;
2193 var powerbitests = window.powerbitests;
2194 var InJs = window.InJs;
2195 var debug = window.debug;
2196 var jasmine = window.jasmine;
2197 var Microsoft = window.Microsoft;
2198
2199 /*
2200 * Power BI Visualizations
2201 *
2202 * Copyright (c) Microsoft Corporation
2203 * All rights reserved.
2204 * MIT License
2205 *
2206 * Permission is hereby granted, free of charge, to any person obtaining a copy
2207 * of this software and associated documentation files (the ""Software""), to deal
2208 * in the Software without restriction, including without limitation the rights
2209 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2210 * copies of the Software, and to permit persons to whom the Software is
2211 * furnished to do so, subject to the following conditions:
2212 *
2213 * The above copyright notice and this permission notice shall be included in
2214 * all copies or substantial portions of the Software.
2215 *
2216 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2217 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2218 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2219 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2220 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2221 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222 * THE SOFTWARE.
2223 */
2224 /// <reference path="./_references.ts"/>
2225 var jsCommon;
2226 (function (jsCommon) {
2227 var Double = powerbi.Double;
2228 var Color;
2229 (function (Color) {
2230 function rotate(rgbString, rotateFactor) {
2231 if (rotateFactor === 0)
2232 return rgbString;
2233 var originalRgb = parseColorString(rgbString);
2234 var originalHsv = rgbToHsv(originalRgb);
2235 var rotatedHsv = rotateHsv(originalHsv, rotateFactor);
2236 var rotatedRgb = hsvToRgb(rotatedHsv);
2237 return hexString(rotatedRgb);
2238 }
2239 Color.rotate = rotate;
2240 function normalizeToHexString(color) {
2241 var rgb = parseColorString(color);
2242 return hexString(rgb);
2243 }
2244 Color.normalizeToHexString = normalizeToHexString;
2245 function parseColorString(color) {
2246 debug.assertValue(color, 'color');
2247 if (color.indexOf('#') >= 0) {
2248 if (color.length === 7) {
2249 // #RRGGBB
2250 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(color);
2251 if (result == null || result.length < 4)
2252 return;
2253 return {
2254 R: parseInt(result[1], 16),
2255 G: parseInt(result[2], 16),
2256 B: parseInt(result[3], 16),
2257 };
2258 }
2259 else if (color.length === 4) {
2260 // #RGB
2261 var result = /^#?([a-f\d])([a-f\d])([a-f\d])$/i.exec(color);
2262 if (result == null || result.length < 4)
2263 return;
2264 return {
2265 R: parseInt(result[1] + result[1], 16),
2266 G: parseInt(result[2] + result[2], 16),
2267 B: parseInt(result[3] + result[3], 16),
2268 };
2269 }
2270 }
2271 else if (color.indexOf('rgb(') >= 0) {
2272 // rgb(R, G, B)
2273 var result = /^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/.exec(color);
2274 if (result == null || result.length < 4)
2275 return;
2276 return {
2277 R: parseInt(result[1], 10),
2278 G: parseInt(result[2], 10),
2279 B: parseInt(result[3], 10),
2280 };
2281 }
2282 else if (color.indexOf('rgba(') >= 0) {
2283 // rgba(R, G, B, A)
2284 var result = /^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d*(?:\.\d+)?)\)$/.exec(color);
2285 if (result == null || result.length < 5)
2286 return;
2287 return {
2288 R: parseInt(result[1], 10),
2289 G: parseInt(result[2], 10),
2290 B: parseInt(result[3], 10),
2291 A: parseFloat(result[4]),
2292 };
2293 }
2294 }
2295 Color.parseColorString = parseColorString;
2296 function rgbToHsv(rgbColor) {
2297 var s, h;
2298 var r = rgbColor.R / 255, g = rgbColor.G / 255, b = rgbColor.B / 255;
2299 var min = Math.min(r, Math.min(g, b));
2300 var max = Math.max(r, Math.max(g, b));
2301 var v = max;
2302 var delta = max - min;
2303 if (max === 0 || delta === 0) {
2304 // R, G, and B must be 0.0, or all the same.
2305 // In this case, S is 0.0, and H is undefined.
2306 // Using H = 0.0 is as good as any...
2307 s = 0;
2308 h = 0;
2309 }
2310 else {
2311 s = delta / max;
2312 if (r === max) {
2313 // Between Yellow and Magenta
2314 h = (g - b) / delta;
2315 }
2316 else if (g === max) {
2317 // Between Cyan and Yellow
2318 h = 2 + (b - r) / delta;
2319 }
2320 else {
2321 // Between Magenta and Cyan
2322 h = 4 + (r - g) / delta;
2323 }
2324 }
2325 // Scale h to be between 0.0 and 1.
2326 // This may require adding 1, if the value
2327 // is negative.
2328 h /= 6;
2329 if (h < 0) {
2330 h += 1;
2331 }
2332 return {
2333 H: h,
2334 S: s,
2335 V: v,
2336 };
2337 }
2338 function hsvToRgb(hsvColor) {
2339 var r, g, b;
2340 var h = hsvColor.H, s = hsvColor.S, v = hsvColor.V;
2341 if (s === 0) {
2342 // If s is 0, all colors are the same.
2343 // This is some flavor of gray.
2344 r = v;
2345 g = v;
2346 b = v;
2347 }
2348 else {
2349 var p = void 0, q = void 0, t = void 0, fractionalSector = void 0, sectorNumber = void 0, sectorPos = void 0;
2350 // The color wheel consists of 6 sectors.
2351 // Figure out which sector you//re in.
2352 sectorPos = h * 6;
2353 sectorNumber = Math.floor(sectorPos);
2354 // get the fractional part of the sector.
2355 // That is, how many degrees into the sector
2356 // are you?
2357 fractionalSector = sectorPos - sectorNumber;
2358 // Calculate values for the three axes
2359 // of the color.
2360 p = v * (1.0 - s);
2361 q = v * (1.0 - (s * fractionalSector));
2362 t = v * (1.0 - (s * (1 - fractionalSector)));
2363 // Assign the fractional colors to r, g, and b
2364 // based on the sector the angle is in.
2365 switch (sectorNumber) {
2366 case 0:
2367 r = v;
2368 g = t;
2369 b = p;
2370 break;
2371 case 1:
2372 r = q;
2373 g = v;
2374 b = p;
2375 break;
2376 case 2:
2377 r = p;
2378 g = v;
2379 b = t;
2380 break;
2381 case 3:
2382 r = p;
2383 g = q;
2384 b = v;
2385 break;
2386 case 4:
2387 r = t;
2388 g = p;
2389 b = v;
2390 break;
2391 case 5:
2392 r = v;
2393 g = p;
2394 b = q;
2395 break;
2396 }
2397 }
2398 return {
2399 R: Math.floor(r * 255),
2400 G: Math.floor(g * 255),
2401 B: Math.floor(b * 255),
2402 };
2403 }
2404 function rotateHsv(hsvColor, rotateFactor) {
2405 var newH = hsvColor.H + rotateFactor;
2406 return {
2407 H: newH > 1 ? newH - 1 : newH,
2408 S: hsvColor.S,
2409 V: hsvColor.V,
2410 };
2411 }
2412 function darken(color, diff) {
2413 var flooredNumber = Math.floor(diff);
2414 return {
2415 R: Math.max(0, color.R - flooredNumber),
2416 G: Math.max(0, color.G - flooredNumber),
2417 B: Math.max(0, color.B - flooredNumber),
2418 };
2419 }
2420 Color.darken = darken;
2421 function rgbString(color) {
2422 if (color.A == null)
2423 return "rgb(" + color.R + "," + color.G + "," + color.B + ")";
2424 return "rgba(" + color.R + "," + color.G + "," + color.B + "," + color.A + ")";
2425 }
2426 Color.rgbString = rgbString;
2427 function hexString(color) {
2428 return "#" + componentToHex(color.R) + componentToHex(color.G) + componentToHex(color.B);
2429 }
2430 Color.hexString = hexString;
2431 /**
2432 * Overlays a color with opacity over a background color
2433 * @param {string} foreColor Color to overlay
2434 * @param {number} opacity number between 0 (transparent) to 1 (opaque)
2435 * @param {string} backColor Background color
2436 * @returns Result color
2437 */
2438 function hexBlend(foreColor, opacity, backColor) {
2439 return hexString(rgbBlend(parseColorString(foreColor), opacity, parseColorString(backColor)));
2440 }
2441 Color.hexBlend = hexBlend;
2442 /**
2443 * Overlays a color with opacity over a background color. Any alpha-channel is ignored.
2444 * @param {RgbColor} foreColor Color to overlay
2445 * @param {number} opacity number between 0 (transparent) to 1 (opaque). Any value out of range will be corrected.
2446 * @param {RgbColor} backColor Background color
2447 * @returns
2448 */
2449 function rgbBlend(foreColor, opacity, backColor) {
2450 // correct opacity
2451 opacity = Double.ensureInRange(opacity, 0, 1);
2452 return {
2453 R: channelBlend(foreColor.R, opacity, backColor.R),
2454 G: channelBlend(foreColor.G, opacity, backColor.G),
2455 B: channelBlend(foreColor.B, opacity, backColor.B)
2456 };
2457 }
2458 Color.rgbBlend = rgbBlend;
2459 /**
2460 * Blend a single channel for two colors
2461 * @param {number} foreChannel Channel of foreground color. Will be enforced to be between 0 and 255.
2462 * @param {number} opacity opacity of the foreground color. Will be enforced to be between 0 and 1.
2463 * @param {number} backChannel channel of the background color. Will be enforced to be between 0 and 255.
2464 * @returns result channel value
2465 */
2466 function channelBlend(foreChannel, opacity, backChannel) {
2467 opacity = Double.ensureInRange(opacity, 0, 1);
2468 foreChannel = Double.ensureInRange(foreChannel, 0, 255);
2469 backChannel = Double.ensureInRange(backChannel, 0, 255);
2470 return Math.round((opacity * foreChannel) +
2471 ((1 - opacity) * backChannel));
2472 }
2473 Color.channelBlend = channelBlend;
2474 function componentToHex(hexComponent) {
2475 var clamped = Double.ensureInRange(hexComponent, 0, 255);
2476 var hex = clamped.toString(16).toUpperCase();
2477 return hex.length === 1 ? "0" + hex : hex;
2478 }
2479 })(Color = jsCommon.Color || (jsCommon.Color = {}));
2480 })(jsCommon || (jsCommon = {}));
2481
2482
2483
2484/***/ },
2485
2486/***/ 276:
2487/***/ function(module, exports) {
2488
2489 /*** IMPORTS FROM imports-loader ***/
2490 var jsCommon = window.jsCommon;
2491 var powerbi = window.powerbi;
2492 var powerbitests = window.powerbitests;
2493 var InJs = window.InJs;
2494 var debug = window.debug;
2495 var jasmine = window.jasmine;
2496 var Microsoft = window.Microsoft;
2497
2498 /*
2499 * Power BI Visualizations
2500 *
2501 * Copyright (c) Microsoft Corporation
2502 * All rights reserved.
2503 * MIT License
2504 *
2505 * Permission is hereby granted, free of charge, to any person obtaining a copy
2506 * of this software and associated documentation files (the ""Software""), to deal
2507 * in the Software without restriction, including without limitation the rights
2508 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2509 * copies of the Software, and to permit persons to whom the Software is
2510 * furnished to do so, subject to the following conditions:
2511 *
2512 * The above copyright notice and this permission notice shall be included in
2513 * all copies or substantial portions of the Software.
2514 *
2515 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2516 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2517 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2518 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2519 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2520 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2521 * THE SOFTWARE.
2522 */
2523 /// <reference path="./_references.ts"/>
2524 var jsCommon;
2525 (function (jsCommon) {
2526 /**
2527 * CSS constants.
2528 */
2529 var CssConstants;
2530 (function (CssConstants) {
2531 function createClassAndSelector(className) {
2532 return {
2533 class: className,
2534 selector: '.' + className,
2535 };
2536 }
2537 CssConstants.createClassAndSelector = createClassAndSelector;
2538 CssConstants.styleAttribute = 'style';
2539 CssConstants.pixelUnits = 'px';
2540 CssConstants.heightProperty = 'height';
2541 CssConstants.widthProperty = 'width';
2542 CssConstants.topProperty = 'top';
2543 CssConstants.bottomProperty = 'bottom';
2544 CssConstants.leftProperty = 'left';
2545 CssConstants.rightProperty = 'right';
2546 CssConstants.marginTopProperty = 'margin-top';
2547 CssConstants.marginLeftProperty = 'margin-left';
2548 CssConstants.displayProperty = 'display';
2549 CssConstants.backgroundProperty = 'background';
2550 CssConstants.backgroundColorProperty = 'background-color';
2551 CssConstants.backgroundRepeatProperty = 'background-repeat';
2552 CssConstants.backgroundSizeProperty = 'background-size';
2553 CssConstants.backgroundImageProperty = 'background-image';
2554 CssConstants.textShadowProperty = 'text-shadow';
2555 CssConstants.textAlignProperty = 'text-align';
2556 CssConstants.borderTopWidthProperty = 'border-top-width';
2557 CssConstants.borderBottomWidthProperty = 'border-bottom-width';
2558 CssConstants.borderLeftWidthProperty = 'border-left-width';
2559 CssConstants.borderRightWidthProperty = 'border-right-width';
2560 CssConstants.fontSizeProperty = 'font-size';
2561 CssConstants.fontWeightProperty = 'font-weight';
2562 CssConstants.colorProperty = 'color';
2563 CssConstants.opacityProperty = 'opacity';
2564 CssConstants.paddingLeftProperty = 'padding-left';
2565 CssConstants.paddingRightProperty = 'padding-right';
2566 CssConstants.positionProperty = 'position';
2567 CssConstants.maxWidthProperty = 'max-width';
2568 CssConstants.minWidthProperty = 'min-width';
2569 CssConstants.overflowProperty = 'overflow';
2570 CssConstants.overflowXProperty = 'overflow-x';
2571 CssConstants.overflowYProperty = 'overflow-y';
2572 CssConstants.transformProperty = 'transform';
2573 CssConstants.webkitTransformProperty = '-webkit-transform';
2574 CssConstants.cursorProperty = 'cursor';
2575 CssConstants.visibilityProperty = 'visibility';
2576 CssConstants.absoluteValue = 'absolute';
2577 CssConstants.zeroPixelValue = '0px';
2578 CssConstants.autoValue = 'auto';
2579 CssConstants.hiddenValue = 'hidden';
2580 CssConstants.noneValue = 'none';
2581 CssConstants.blockValue = 'block';
2582 CssConstants.inlineBlockValue = 'inline-block';
2583 CssConstants.transparentValue = 'transparent';
2584 CssConstants.boldValue = 'bold';
2585 CssConstants.visibleValue = 'visible';
2586 CssConstants.tableRowValue = 'table-row';
2587 CssConstants.coverValue = 'cover';
2588 CssConstants.pointerValue = 'pointer';
2589 CssConstants.scrollValue = 'scroll';
2590 })(CssConstants = jsCommon.CssConstants || (jsCommon.CssConstants = {}));
2591 })(jsCommon || (jsCommon = {}));
2592
2593
2594
2595/***/ },
2596
2597/***/ 277:
2598/***/ function(module, exports) {
2599
2600 /*** IMPORTS FROM imports-loader ***/
2601 var jsCommon = window.jsCommon;
2602 var powerbi = window.powerbi;
2603 var powerbitests = window.powerbitests;
2604 var InJs = window.InJs;
2605 var debug = window.debug;
2606 var jasmine = window.jasmine;
2607 var Microsoft = window.Microsoft;
2608
2609 /*
2610 * Power BI Visualizations
2611 *
2612 * Copyright (c) Microsoft Corporation
2613 * All rights reserved.
2614 * MIT License
2615 *
2616 * Permission is hereby granted, free of charge, to any person obtaining a copy
2617 * of this software and associated documentation files (the ""Software""), to deal
2618 * in the Software without restriction, including without limitation the rights
2619 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2620 * copies of the Software, and to permit persons to whom the Software is
2621 * furnished to do so, subject to the following conditions:
2622 *
2623 * The above copyright notice and this permission notice shall be included in
2624 * all copies or substantial portions of the Software.
2625 *
2626 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2627 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2628 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2629 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2630 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2631 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2632 * THE SOFTWARE.
2633 */
2634 /**
2635 * Defines a Debug object. Calls to any functions in this object removed by the minifier.
2636 * The functions within this class are not minified away, so we use the preprocessor-style
2637 * comments to have the minifier remove those as well.
2638 */
2639 ///#DEBUG
2640 /// <reference path="./_references.ts"/>
2641 var debug;
2642 (function (debug) {
2643 /**
2644 * Asserts that the condition is true, fails otherwise.
2645 */
2646 function assert(condition, message) {
2647 if (condition !== true) {
2648 assertFail(message || ('condition: ' + condition));
2649 }
2650 }
2651 debug.assert = assert;
2652 /**
2653 * Asserts that the value is neither null nor undefined, fails otherwise.
2654 */
2655 function assertValue(value, message) {
2656 if (value === null || value === undefined) {
2657 assertFail(message || ('condition: ' + value));
2658 }
2659 }
2660 debug.assertValue = assertValue;
2661 /**
2662 * Asserts that the value is neither null nor undefined, and has a length property that returns greater than zero, fails otherwise.
2663 */
2664 function assertNonEmpty(value, message) {
2665 if (!(value != null && value.length > 0)) {
2666 assertFail(message || ('condition: ' + value));
2667 }
2668 }
2669 debug.assertNonEmpty = assertNonEmpty;
2670 /**
2671 * Makes no assertion on the given value.
2672 * This is documentation/placeholder that a value is possibly null or undefined (unlike assertValue).
2673 */
2674 function assertAnyValue(value, message) {
2675 }
2676 debug.assertAnyValue = assertAnyValue;
2677 function assertFail(message) {
2678 (debug.assertFailFunction || alert)('Debug Assert failed: ' + message);
2679 }
2680 debug.assertFail = assertFail;
2681 })(debug || (debug = {}));
2682 ///#ENDDEBUG
2683
2684
2685
2686/***/ },
2687
2688/***/ 278:
2689/***/ function(module, exports) {
2690
2691 /*** IMPORTS FROM imports-loader ***/
2692 var jsCommon = window.jsCommon;
2693 var powerbi = window.powerbi;
2694 var powerbitests = window.powerbitests;
2695 var InJs = window.InJs;
2696 var debug = window.debug;
2697 var jasmine = window.jasmine;
2698 var Microsoft = window.Microsoft;
2699
2700 /*
2701 * Power BI Visualizations
2702 *
2703 * Copyright (c) Microsoft Corporation
2704 * All rights reserved.
2705 * MIT License
2706 *
2707 * Permission is hereby granted, free of charge, to any person obtaining a copy
2708 * of this software and associated documentation files (the ""Software""), to deal
2709 * in the Software without restriction, including without limitation the rights
2710 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2711 * copies of the Software, and to permit persons to whom the Software is
2712 * furnished to do so, subject to the following conditions:
2713 *
2714 * The above copyright notice and this permission notice shall be included in
2715 * all copies or substantial portions of the Software.
2716 *
2717 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2718 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2719 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2720 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2721 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2722 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2723 * THE SOFTWARE.
2724 */
2725 /// <reference path="./_references.ts"/>
2726 var jsCommon;
2727 (function (jsCommon) {
2728 var Errors;
2729 (function (Errors) {
2730 function infoNavAppAlreadyPresent() {
2731 return {
2732 name: 'infoNavAppAlreadyPresent',
2733 message: 'Cannot initialize embedded scenario when the InfoNav App is already present in this context',
2734 stack: getExceptionStackTrace()
2735 };
2736 }
2737 Errors.infoNavAppAlreadyPresent = infoNavAppAlreadyPresent;
2738 function invalidOperation(message) {
2739 return {
2740 name: 'invalidOperation',
2741 message: message,
2742 stack: getExceptionStackTrace()
2743 };
2744 }
2745 Errors.invalidOperation = invalidOperation;
2746 function argument(argumentName, message) {
2747 return {
2748 name: 'invalidArgumentError',
2749 argument: argumentName,
2750 message: message,
2751 stack: getExceptionStackTrace()
2752 };
2753 }
2754 Errors.argument = argument;
2755 function argumentNull(argumentName) {
2756 return {
2757 name: 'argumentNull',
2758 argument: argumentName,
2759 message: 'Argument was null',
2760 stack: getExceptionStackTrace()
2761 };
2762 }
2763 Errors.argumentNull = argumentNull;
2764 function argumentUndefined(argumentName) {
2765 return {
2766 name: 'argumentUndefined',
2767 argument: argumentName,
2768 message: 'Argument was undefined',
2769 stack: getExceptionStackTrace()
2770 };
2771 }
2772 Errors.argumentUndefined = argumentUndefined;
2773 function argumentOutOfRange(argumentName) {
2774 return {
2775 name: 'argumentOutOfRange',
2776 argument: argumentName,
2777 message: 'Argument was out of range',
2778 stack: getExceptionStackTrace()
2779 };
2780 }
2781 Errors.argumentOutOfRange = argumentOutOfRange;
2782 function pureVirtualMethodException(className, methodName) {
2783 return {
2784 name: 'pureVirtualMethodException',
2785 message: 'This method must be overriden by the derived class:' + className + '.' + methodName,
2786 stack: getExceptionStackTrace()
2787 };
2788 }
2789 Errors.pureVirtualMethodException = pureVirtualMethodException;
2790 function notImplementedException(message) {
2791 return {
2792 name: 'notImplementedException',
2793 message: message,
2794 stack: getExceptionStackTrace()
2795 };
2796 }
2797 Errors.notImplementedException = notImplementedException;
2798 function getExceptionStackTrace() {
2799 return getStackTrace(/*leadingFramesToRemove*/ 2);
2800 }
2801 })(Errors = jsCommon.Errors || (jsCommon.Errors = {}));
2802 /**
2803 * Captures the stack trace, if available.
2804 * It optionally takes the number of frames to remove from the stack trace.
2805 * By default, it removes the last frame to consider the calling type's
2806 * constructor and the temporary error used to capture the stack trace (below).
2807 * More levels can be requested as needed e..g. when an error is created
2808 * from a helper method. <Min requirement: IE10, Chrome, Firefox, Opera>.
2809 */
2810 function getStackTrace(leadingFramesToRemove) {
2811 if (leadingFramesToRemove === void 0) { leadingFramesToRemove = 1; }
2812 var stackTrace, stackSegments;
2813 try {
2814 // needs to throw for stack trace to work in IE
2815 throw new Error();
2816 }
2817 catch (error) {
2818 stackTrace = error.stack;
2819 if (stackTrace != null) {
2820 stackSegments = stackTrace.split('\n');
2821 stackSegments.splice(1, leadingFramesToRemove);
2822 // Finally
2823 stackTrace = stackSegments.join('\n');
2824 }
2825 }
2826 return stackTrace;
2827 }
2828 jsCommon.getStackTrace = getStackTrace;
2829 })(jsCommon || (jsCommon = {}));
2830
2831
2832
2833/***/ },
2834
2835/***/ 279:
2836/***/ function(module, exports) {
2837
2838 /*** IMPORTS FROM imports-loader ***/
2839 var jsCommon = window.jsCommon;
2840 var powerbi = window.powerbi;
2841 var powerbitests = window.powerbitests;
2842 var InJs = window.InJs;
2843 var debug = window.debug;
2844 var jasmine = window.jasmine;
2845 var Microsoft = window.Microsoft;
2846
2847 /*
2848 * Power BI Visualizations
2849 *
2850 * Copyright (c) Microsoft Corporation
2851 * All rights reserved.
2852 * MIT License
2853 *
2854 * Permission is hereby granted, free of charge, to any person obtaining a copy
2855 * of this software and associated documentation files (the ""Software""), to deal
2856 * in the Software without restriction, including without limitation the rights
2857 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2858 * copies of the Software, and to permit persons to whom the Software is
2859 * furnished to do so, subject to the following conditions:
2860 *
2861 * The above copyright notice and this permission notice shall be included in
2862 * all copies or substantial portions of the Software.
2863 *
2864 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2865 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2866 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2867 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2868 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2869 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2870 * THE SOFTWARE.
2871 */
2872 $.fn.multiline = function (text) {
2873 this.text(text);
2874 this.html(this.html().replace(/\n/g, '<br/>'));
2875 return this;
2876 };
2877 $.fn.togglePanelControl = function () {
2878 return this.each(function () {
2879 $(this).addClass("ui-accordion ui-accordion-icons ui-widget ui-helper-reset")
2880 .find(".accordionHeader")
2881 .addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom")
2882 .hover(function () {
2883 $(this).toggleClass("ui-state-hover");
2884 })
2885 .prepend('<span class="ui-icon ui-icon-triangle-1-e"></span>')
2886 .click(function () {
2887 $(this)
2888 .toggleClass("ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom")
2889 .find("> .ui-icon").toggleClass("ui-icon-triangle-1-e ui-icon-triangle-1-s").end()
2890 .next().slideToggle();
2891 return false;
2892 })
2893 .next()
2894 .addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom")
2895 .hide();
2896 });
2897 };
2898 /// <reference path="./_references.ts"/>
2899 var jsCommon;
2900 (function (jsCommon) {
2901 var JQueryConstants;
2902 (function (JQueryConstants) {
2903 JQueryConstants.VisibleSelector = ':visible';
2904 })(JQueryConstants = jsCommon.JQueryConstants || (jsCommon.JQueryConstants = {}));
2905 })(jsCommon || (jsCommon = {}));
2906
2907
2908
2909/***/ },
2910
2911/***/ 280:
2912/***/ function(module, exports) {
2913
2914 /*** IMPORTS FROM imports-loader ***/
2915 var jsCommon = window.jsCommon;
2916 var powerbi = window.powerbi;
2917 var powerbitests = window.powerbitests;
2918 var InJs = window.InJs;
2919 var debug = window.debug;
2920 var jasmine = window.jasmine;
2921 var Microsoft = window.Microsoft;
2922
2923 /*
2924 * Power BI Visualizations
2925 *
2926 * Copyright (c) Microsoft Corporation
2927 * All rights reserved.
2928 * MIT License
2929 *
2930 * Permission is hereby granted, free of charge, to any person obtaining a copy
2931 * of this software and associated documentation files (the ""Software""), to deal
2932 * in the Software without restriction, including without limitation the rights
2933 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2934 * copies of the Software, and to permit persons to whom the Software is
2935 * furnished to do so, subject to the following conditions:
2936 *
2937 * The above copyright notice and this permission notice shall be included in
2938 * all copies or substantial portions of the Software.
2939 *
2940 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2941 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2942 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2943 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2944 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2945 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2946 * THE SOFTWARE.
2947 */
2948 /// <reference path="./_references.ts"/>
2949 var jsCommon;
2950 (function (jsCommon) {
2951 /**
2952 * Represents a lazily instantiated value.
2953 */
2954 var Lazy = (function () {
2955 function Lazy(factoryMethod) {
2956 jsCommon.Utility.throwIfNullOrUndefined(factoryMethod, this, 'constructor', 'factoryMethod');
2957 this.factoryMethod = factoryMethod;
2958 }
2959 Lazy.prototype.getValue = function () {
2960 if (this.factoryMethod !== null) {
2961 this.value = this.factoryMethod();
2962 // Optimization: Release the factoryMethod, as it could be holding a large object graph.
2963 this.factoryMethod = null;
2964 }
2965 return this.value;
2966 };
2967 return Lazy;
2968 }());
2969 jsCommon.Lazy = Lazy;
2970 })(jsCommon || (jsCommon = {}));
2971
2972
2973
2974/***/ },
2975
2976/***/ 281:
2977/***/ function(module, exports) {
2978
2979 /*** IMPORTS FROM imports-loader ***/
2980 var jsCommon = window.jsCommon;
2981 var powerbi = window.powerbi;
2982 var powerbitests = window.powerbitests;
2983 var InJs = window.InJs;
2984 var debug = window.debug;
2985 var jasmine = window.jasmine;
2986 var Microsoft = window.Microsoft;
2987
2988 /*
2989 * Power BI Visualizations
2990 *
2991 * Copyright (c) Microsoft Corporation
2992 * All rights reserved.
2993 * MIT License
2994 *
2995 * Permission is hereby granted, free of charge, to any person obtaining a copy
2996 * of this software and associated documentation files (the ""Software""), to deal
2997 * in the Software without restriction, including without limitation the rights
2998 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2999 * copies of the Software, and to permit persons to whom the Software is
3000 * furnished to do so, subject to the following conditions:
3001 *
3002 * The above copyright notice and this permission notice shall be included in
3003 * all copies or substantial portions of the Software.
3004 *
3005 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3006 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3007 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3008 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3009 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3010 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3011 * THE SOFTWARE.
3012 */
3013 /// <reference path="./_references.ts"/>
3014 var powerbi;
3015 (function (powerbi) {
3016 var Prototype;
3017 (function (Prototype) {
3018 /**
3019 * Returns a new object with the provided obj as its prototype.
3020 */
3021 function inherit(obj, extension) {
3022 debug.assertValue(obj, 'obj');
3023 function wrapCtor() { }
3024 ;
3025 wrapCtor.prototype = obj;
3026 var inherited = new wrapCtor();
3027 if (extension)
3028 extension(inherited);
3029 return inherited;
3030 }
3031 Prototype.inherit = inherit;
3032 /**
3033 * Returns a new object with the provided obj as its prototype
3034 * if, and only if, the prototype has not been previously set
3035 */
3036 function inheritSingle(obj) {
3037 debug.assertValue(obj, 'obj');
3038 var proto = Object.getPrototypeOf(obj);
3039 if (proto === Object.prototype || proto === Array.prototype)
3040 obj = inherit(obj);
3041 return obj;
3042 }
3043 Prototype.inheritSingle = inheritSingle;
3044 /**
3045 * Uses the provided callback function to selectively replace contents in the provided array.
3046 * @return A new array with those values overriden
3047 * or undefined if no overrides are necessary.
3048 */
3049 function overrideArray(prototype, override) {
3050 if (!prototype)
3051 return;
3052 var overwritten;
3053 for (var i = 0, len = prototype.length; i < len; i++) {
3054 var value = override(prototype[i]);
3055 if (value) {
3056 if (!overwritten)
3057 overwritten = inherit(prototype);
3058 overwritten[i] = value;
3059 }
3060 }
3061 return overwritten;
3062 }
3063 Prototype.overrideArray = overrideArray;
3064 })(Prototype = powerbi.Prototype || (powerbi.Prototype = {}));
3065 })(powerbi || (powerbi = {}));
3066
3067
3068
3069/***/ },
3070
3071/***/ 282:
3072/***/ function(module, exports) {
3073
3074 /*** IMPORTS FROM imports-loader ***/
3075 var jsCommon = window.jsCommon;
3076 var powerbi = window.powerbi;
3077 var powerbitests = window.powerbitests;
3078 var InJs = window.InJs;
3079 var debug = window.debug;
3080 var jasmine = window.jasmine;
3081 var Microsoft = window.Microsoft;
3082
3083 /*
3084 * Power BI Visualizations
3085 *
3086 * Copyright (c) Microsoft Corporation
3087 * All rights reserved.
3088 * MIT License
3089 *
3090 * Permission is hereby granted, free of charge, to any person obtaining a copy
3091 * of this software and associated documentation files (the ""Software""), to deal
3092 * in the Software without restriction, including without limitation the rights
3093 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3094 * copies of the Software, and to permit persons to whom the Software is
3095 * furnished to do so, subject to the following conditions:
3096 *
3097 * The above copyright notice and this permission notice shall be included in
3098 * all copies or substantial portions of the Software.
3099 *
3100 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3101 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3102 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3103 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3104 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3105 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3106 * THE SOFTWARE.
3107 */
3108 /// <reference path="./_references.ts"/>
3109
3110
3111
3112/***/ },
3113
3114/***/ 283:
3115/***/ function(module, exports) {
3116
3117 /*** IMPORTS FROM imports-loader ***/
3118 var jsCommon = window.jsCommon;
3119 var powerbi = window.powerbi;
3120 var powerbitests = window.powerbitests;
3121 var InJs = window.InJs;
3122 var debug = window.debug;
3123 var jasmine = window.jasmine;
3124 var Microsoft = window.Microsoft;
3125
3126 /*
3127 * Power BI Visualizations
3128 *
3129 * Copyright (c) Microsoft Corporation
3130 * All rights reserved.
3131 * MIT License
3132 *
3133 * Permission is hereby granted, free of charge, to any person obtaining a copy
3134 * of this software and associated documentation files (the ""Software""), to deal
3135 * in the Software without restriction, including without limitation the rights
3136 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3137 * copies of the Software, and to permit persons to whom the Software is
3138 * furnished to do so, subject to the following conditions:
3139 *
3140 * The above copyright notice and this permission notice shall be included in
3141 * all copies or substantial portions of the Software.
3142 *
3143 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3144 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3145 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3146 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3147 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3148 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3149 * THE SOFTWARE.
3150 */
3151 /// <reference path="./_references.ts"/>
3152
3153
3154
3155/***/ },
3156
3157/***/ 284:
3158/***/ function(module, exports) {
3159
3160 /*** IMPORTS FROM imports-loader ***/
3161 var jsCommon = window.jsCommon;
3162 var powerbi = window.powerbi;
3163 var powerbitests = window.powerbitests;
3164 var InJs = window.InJs;
3165 var debug = window.debug;
3166 var jasmine = window.jasmine;
3167 var Microsoft = window.Microsoft;
3168
3169 /*
3170 * Power BI Visualizations
3171 *
3172 * Copyright (c) Microsoft Corporation
3173 * All rights reserved.
3174 * MIT License
3175 *
3176 * Permission is hereby granted, free of charge, to any person obtaining a copy
3177 * of this software and associated documentation files (the ""Software""), to deal
3178 * in the Software without restriction, including without limitation the rights
3179 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3180 * copies of the Software, and to permit persons to whom the Software is
3181 * furnished to do so, subject to the following conditions:
3182 *
3183 * The above copyright notice and this permission notice shall be included in
3184 * all copies or substantial portions of the Software.
3185 *
3186 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3187 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3188 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3189 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3190 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3191 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3192 * THE SOFTWARE.
3193 */
3194 /// <reference path="./_references.ts"/>
3195 var jsCommon;
3196 (function (jsCommon) {
3197 var Formatting;
3198 (function (Formatting) {
3199 var regexCache;
3200 /**
3201 * Translate .NET format into something supported by jQuery.Globalize.
3202 */
3203 function findDateFormat(value, format, cultureName) {
3204 switch (format) {
3205 case "m":
3206 // Month + day
3207 format = "M";
3208 break;
3209 case "O":
3210 case "o":
3211 // Roundtrip
3212 format = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'0000'";
3213 break;
3214 case "R":
3215 case "r":
3216 // RFC1123 pattern - - time must be converted to UTC before formatting
3217 value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());
3218 format = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
3219 break;
3220 case "s":
3221 // Sortable - should use invariant culture
3222 format = "S";
3223 break;
3224 case "u":
3225 // Universal sortable - should convert to UTC before applying the "yyyy'-'MM'-'dd HH':'mm':'ss'Z' format.
3226 value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());
3227 format = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
3228 break;
3229 case "U":
3230 // Universal full - the pattern is same as F but the time must be converted to UTC before formatting
3231 value = new Date(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds());
3232 format = "F";
3233 break;
3234 case "y":
3235 case "Y":
3236 // Year and month
3237 switch (cultureName) {
3238 case "default":
3239 case "en":
3240 case "en-US":
3241 format = "MMMM, yyyy"; // Fix the default year-month pattern for english
3242 break;
3243 default:
3244 format = "Y"; // For other cultures - use the localized pattern
3245 }
3246 break;
3247 }
3248 return { value: value, format: format };
3249 }
3250 Formatting.findDateFormat = findDateFormat;
3251 /**
3252 * Translates unsupported .NET custom format expressions to the custom expressions supported by JQuery.Globalize.
3253 */
3254 function fixDateTimeFormat(format) {
3255 // Fix for the "K" format (timezone):
3256 //The js dates don't have a kind property so we'll support only local kind which is equavalent to zzz format.
3257 format = format.replace(/%K/g, "zzz");
3258 format = format.replace(/K/g, "zzz");
3259 format = format.replace(/fffffff/g, "fff0000");
3260 format = format.replace(/ffffff/g, "fff000");
3261 format = format.replace(/fffff/g, "fff00");
3262 format = format.replace(/ffff/g, "fff0");
3263 // Fix for the 5 digit year: "yyyyy" format.
3264 //The Globalize doesn't support dates greater than 9999 so we replace the "yyyyy" with "0yyyy".
3265 format = format.replace(/yyyyy/g, "0yyyy");
3266 // Fix for the 3 digit year: "yyy" format.
3267 //The Globalize doesn't support this formatting so we need to replace it with the 4 digit year "yyyy" format.
3268 format = format.replace(/(^y|^)yyy(^y|$)/g, "yyyy");
3269 if (!regexCache) {
3270 // Creating Regexes for cases "Using single format specifier"
3271 //- http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx#UsingSingleSpecifiers
3272 // This is not supported from The Globalize.
3273 // The case covers all single "%" lead specifier (like "%d" but not %dd)
3274 // The cases as single "%d" are filtered in if the bellow.
3275 // (?!S) where S is the specifier make sure that we only one symbol for specifier.
3276 regexCache = ["d", "f", "F", "g", "h", "H", "K", "m", "M", "s", "t", "y", "z", ":", "/"].map(function (s) {
3277 return { r: new RegExp("\%" + s + "(?!" + s + ")", "g"), s: s };
3278 });
3279 }
3280 if (format.indexOf("%") !== -1 && format.length > 2) {
3281 for (var i = 0; i < regexCache.length; i++) {
3282 format = format.replace(regexCache[i].r, regexCache[i].s);
3283 }
3284 }
3285 return format;
3286 }
3287 Formatting.fixDateTimeFormat = fixDateTimeFormat;
3288 })(Formatting = jsCommon.Formatting || (jsCommon.Formatting = {}));
3289 })(jsCommon || (jsCommon = {}));
3290
3291
3292
3293/***/ },
3294
3295/***/ 285:
3296/***/ function(module, exports) {
3297
3298 /*** IMPORTS FROM imports-loader ***/
3299 var jsCommon = window.jsCommon;
3300 var powerbi = window.powerbi;
3301 var powerbitests = window.powerbitests;
3302 var InJs = window.InJs;
3303 var debug = window.debug;
3304 var jasmine = window.jasmine;
3305 var Microsoft = window.Microsoft;
3306
3307 /*
3308 * Power BI Visualizations
3309 *
3310 * Copyright (c) Microsoft Corporation
3311 * All rights reserved.
3312 * MIT License
3313 *
3314 * Permission is hereby granted, free of charge, to any person obtaining a copy
3315 * of this software and associated documentation files (the ""Software""), to deal
3316 * in the Software without restriction, including without limitation the rights
3317 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3318 * copies of the Software, and to permit persons to whom the Software is
3319 * furnished to do so, subject to the following conditions:
3320 *
3321 * The above copyright notice and this permission notice shall be included in
3322 * all copies or substantial portions of the Software.
3323 *
3324 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3325 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3326 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3327 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3328 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3329 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3330 * THE SOFTWARE.
3331 */
3332 /// <reference path="../_references.ts"/>
3333 var jsCommon;
3334 (function (jsCommon) {
3335 var doc = document, headElement = doc.head, firstScriptInHeadElement = headElement.getElementsByTagName('script')[0], linkElement = doc.createElement('link'), scriptElement = doc.createElement('script'), styleSheetLoaded = [], javaScriptFilesLoaded = [], javaScriptFilesLoading = [];
3336 linkElement.setAttribute('rel', 'stylesheet');
3337 function requires(dependency, to) {
3338 if (to === void 0) { to = $.noop; }
3339 loadStyleSheets(dependency.cssFiles || []);
3340 var scriptsToRun = dependency.javaScriptFilesWithCallback || [];
3341 if (dependency.javaScriptFiles) {
3342 for (var i = 0, len = dependency.javaScriptFiles.length; i < len; ++i) {
3343 scriptsToRun.push({ javascriptFile: dependency.javaScriptFiles[i] });
3344 }
3345 }
3346 loadJavaScriptFiles(scriptsToRun, to);
3347 }
3348 jsCommon.requires = requires;
3349 /**
3350 * Private Helpers.
3351 */
3352 function loadStyleSheets(hrefList) {
3353 hrefList.forEach(function (href) {
3354 if (styleSheetLoaded.indexOf(href) === -1) {
3355 styleSheetLoaded.push(href);
3356 loadStyleSheet(href);
3357 }
3358 });
3359 }
3360 function loadJavaScriptFiles(scripts, callback) {
3361 var loadingCount = scripts.length, parsingCount = loadingCount, sourceCodeList = [];
3362 function parseIfLoadingComplete() {
3363 if (!--loadingCount) {
3364 parseJavaScriptSourceCodes(scripts, sourceCodeList);
3365 }
3366 }
3367 function makeCallbackIfParsingComplete() {
3368 if (!--parsingCount) {
3369 callback();
3370 }
3371 }
3372 scripts.forEach(function (script, index) {
3373 var file = script.javascriptFile;
3374 if (javaScriptFilesLoaded.indexOf(file) === -1) {
3375 if (file in javaScriptFilesLoading) {
3376 javaScriptFilesLoading[file].push(function () {
3377 parseIfLoadingComplete();
3378 makeCallbackIfParsingComplete();
3379 });
3380 }
3381 else {
3382 javaScriptFilesLoading[file] = [function () {
3383 makeCallbackIfParsingComplete();
3384 }];
3385 if (isExternalUrl(file)) {
3386 sourceCodeList[index] = script;
3387 parseIfLoadingComplete();
3388 }
3389 else {
3390 loadJavaScriptSourceCode(file, function (sourceCode) {
3391 sourceCodeList[index] = { javascriptFile: sourceCode };
3392 parseIfLoadingComplete();
3393 });
3394 }
3395 }
3396 }
3397 else {
3398 parseIfLoadingComplete();
3399 makeCallbackIfParsingComplete();
3400 }
3401 });
3402 }
3403 function loadStyleSheet(href) {
3404 var link = linkElement.cloneNode();
3405 link.href = href;
3406 if (firstScriptInHeadElement) {
3407 headElement.insertBefore(link, firstScriptInHeadElement);
3408 }
3409 else {
3410 headElement.appendChild(link);
3411 }
3412 }
3413 function loadJavaScriptSourceCode(src, onload) {
3414 webGet(src, function () {
3415 onload(this.responseText);
3416 });
3417 }
3418 function parseJavaScript(script, onComplete) {
3419 if (onComplete === void 0) { onComplete = $.noop; }
3420 if (!script) {
3421 onComplete();
3422 return;
3423 }
3424 var sourceCodeOrFileName = script.javascriptFile;
3425 var targetCallback = onComplete;
3426 if (script.onLoadCallback) {
3427 var promiseAsCallback = function () {
3428 script.onLoadCallback().then(onComplete);
3429 };
3430 targetCallback = promiseAsCallback;
3431 }
3432 isExternalUrl(sourceCodeOrFileName)
3433 ? loadExternalJavaScriptFile(sourceCodeOrFileName, targetCallback)
3434 : parseInternalJavaScriptCode(sourceCodeOrFileName, targetCallback);
3435 }
3436 function parseInternalJavaScriptCode(sourceCode, onComplete) {
3437 if (onComplete === void 0) { onComplete = $.noop; }
3438 var script;
3439 if (sourceCode) {
3440 script = scriptElement.cloneNode();
3441 script.setAttribute('type', 'text/javascript');
3442 script.innerHTML = sourceCode;
3443 headElement.appendChild(script);
3444 }
3445 setTimeout(onComplete, 0);
3446 }
3447 function loadExternalJavaScriptFile(src, onload) {
3448 var script;
3449 if (src) {
3450 script = scriptElement.cloneNode();
3451 script.setAttribute('src', src);
3452 script.setAttribute('charset', 'utf-8');
3453 script.onload = onload;
3454 headElement.appendChild(script);
3455 }
3456 }
3457 function parseJavaScriptSourceCodes(scripts, sourceCodeList) {
3458 asyncLoop(sourceCodeList, parseJavaScript, /*on all files parsed*/ function () {
3459 scripts.forEach(function (script) {
3460 var file = script.javascriptFile;
3461 var listeners = javaScriptFilesLoading[file];
3462 if (listeners) {
3463 listeners.forEach(function (listener) {
3464 listener();
3465 });
3466 }
3467 delete javaScriptFilesLoading[file];
3468 if (javaScriptFilesLoaded.indexOf(file) === -1) {
3469 javaScriptFilesLoaded.push(file);
3470 }
3471 });
3472 });
3473 }
3474 function webGet(src, onload, onerror) {
3475 var xhr = new XMLHttpRequest();
3476 try {
3477 xhr.open('GET', src, true);
3478 xhr.onload = onload;
3479 xhr.onerror = onerror;
3480 xhr.send(null);
3481 }
3482 catch (e) {
3483 }
3484 }
3485 function isExternalUrl(url) {
3486 var origin = location.protocol + '//' + location.host + '/';
3487 return /^http[s]?:\/\/.+/i.test(url) && url.indexOf(origin) !== 0;
3488 }
3489 function _() {
3490 var args = [];
3491 for (var _i = 0; _i < arguments.length; _i++) {
3492 args[_i - 0] = arguments[_i];
3493 }
3494 }
3495 function asyncSteps() {
3496 var args = [];
3497 for (var _i = 0; _i < arguments.length; _i++) {
3498 args[_i - 0] = arguments[_i];
3499 }
3500 if (args.length === 0) {
3501 return;
3502 }
3503 var steps = [], i = args.length;
3504 while (i--) {
3505 (function (j) {
3506 steps[j] = function () {
3507 args[j](steps[j + 1] || _);
3508 };
3509 })(i);
3510 }
3511 steps[0]();
3512 }
3513 function asyncLoop(enumerable, func, callback) {
3514 var steps = [], i = 0, len = enumerable.length;
3515 for (; i < len - 1; i++) {
3516 (function (i) {
3517 steps[i] = function (next) {
3518 func(enumerable[i], next);
3519 };
3520 }(i));
3521 }
3522 steps[len - 1] = function (next) {
3523 func(enumerable[len - 1], callback);
3524 };
3525 asyncSteps.apply(null, steps);
3526 }
3527 })(jsCommon || (jsCommon = {}));
3528
3529
3530
3531/***/ },
3532
3533/***/ 286:
3534/***/ function(module, exports) {
3535
3536 /*** IMPORTS FROM imports-loader ***/
3537 var jsCommon = window.jsCommon;
3538 var powerbi = window.powerbi;
3539 var powerbitests = window.powerbitests;
3540 var InJs = window.InJs;
3541 var debug = window.debug;
3542 var jasmine = window.jasmine;
3543 var Microsoft = window.Microsoft;
3544
3545 /*
3546 * Power BI Visualizations
3547 *
3548 * Copyright (c) Microsoft Corporation
3549 * All rights reserved.
3550 * MIT License
3551 *
3552 * Permission is hereby granted, free of charge, to any person obtaining a copy
3553 * of this software and associated documentation files (the ""Software""), to deal
3554 * in the Software without restriction, including without limitation the rights
3555 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3556 * copies of the Software, and to permit persons to whom the Software is
3557 * furnished to do so, subject to the following conditions:
3558 *
3559 * The above copyright notice and this permission notice shall be included in
3560 * all copies or substantial portions of the Software.
3561 *
3562 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3563 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3564 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3565 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3566 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3567 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3568 * THE SOFTWARE.
3569 */
3570 /// <reference path="../_references.ts"/>
3571 var powerbi;
3572 (function (powerbi) {
3573 function createJQueryPromiseFactory() {
3574 return new JQueryPromiseFactory();
3575 }
3576 powerbi.createJQueryPromiseFactory = createJQueryPromiseFactory;
3577 /**
3578 * jQuery-based implementation of IPromiseFactory.
3579 * This is useful for cases when Angular is not present, or when immediate promise resolving (not tied to Angular digest cycle) is desired.
3580 */
3581 var JQueryPromiseFactory = (function () {
3582 function JQueryPromiseFactory() {
3583 }
3584 JQueryPromiseFactory.prototype.defer = function () {
3585 return new JQueryDeferredWrapper($.Deferred());
3586 };
3587 JQueryPromiseFactory.prototype.reject = function (reason) {
3588 var deferred = this.defer();
3589 deferred.reject(reason);
3590 return deferred.promise;
3591 };
3592 JQueryPromiseFactory.prototype.resolve = function (value) {
3593 var deferred = this.defer();
3594 deferred.resolve(value);
3595 return deferred.promise;
3596 };
3597 JQueryPromiseFactory.prototype.all = function (promises) {
3598 var unwrappedPromises = jQuery.map(promises, function (value) {
3599 return value && value.promise ? value.promise : value;
3600 });
3601 return new JQueryPromiseWrapper($.when.apply($, unwrappedPromises));
3602 };
3603 JQueryPromiseFactory.prototype.allSettled = function (promises) {
3604 var deferred = this.defer();
3605 var promiseCount = promises.length;
3606 if (promiseCount > 0) {
3607 var resolvedCount_1 = 0;
3608 var results_1 = [];
3609 var _loop_1 = function(i) {
3610 promises[i].then(function (result) {
3611 results_1[i] = {
3612 value: result,
3613 type: 0 /* Success */
3614 };
3615 }).catch(function (result) {
3616 results_1[i] = {
3617 value: result,
3618 type: 1 /* Failure */
3619 };
3620 }).finally(function () {
3621 resolvedCount_1++;
3622 if (resolvedCount_1 === promiseCount) {
3623 deferred.resolve(results_1);
3624 }
3625 });
3626 };
3627 for (var i = 0; i < promiseCount; i++) {
3628 _loop_1(i);
3629 }
3630 }
3631 else {
3632 deferred.resolve([]);
3633 }
3634 return deferred.promise;
3635 };
3636 JQueryPromiseFactory.prototype.when = function (value) {
3637 var unwrappedPromise = value && value.promise ? value.promise : value;
3638 return new JQueryPromiseWrapper($.when(unwrappedPromise));
3639 };
3640 return JQueryPromiseFactory;
3641 }());
3642 /**
3643 * Implements IDeferred via a wrapped a jQuery Deferred.
3644 */
3645 var JQueryDeferredWrapper = (function () {
3646 function JQueryDeferredWrapper(deferred) {
3647 debug.assertValue(deferred, 'deferred');
3648 this.deferred = deferred;
3649 this.promise = new JQueryPromiseWrapper(deferred.promise());
3650 }
3651 JQueryDeferredWrapper.prototype.resolve = function (value) {
3652 this.deferred.resolve(value);
3653 };
3654 JQueryDeferredWrapper.prototype.reject = function (reason) {
3655 this.deferred.reject(reason);
3656 };
3657 return JQueryDeferredWrapper;
3658 }());
3659 /**
3660 * Implements IDeferred via a wrapped a jQuery Promise.
3661 */
3662 var JQueryPromiseWrapper = (function () {
3663 function JQueryPromiseWrapper(promise) {
3664 debug.assertValue(promise, 'promise');
3665 this.promise = promise;
3666 }
3667 JQueryPromiseWrapper.prototype.then = function (a, b) {
3668 return new JQueryPromiseWrapper(this.promise.then(JQueryPromiseWrapper.wrapCallback(a), JQueryPromiseWrapper.wrapCallback(b)));
3669 };
3670 JQueryPromiseWrapper.prototype.catch = function (callback) {
3671 return this.then(null, callback);
3672 };
3673 JQueryPromiseWrapper.prototype.finally = function (callback) {
3674 this.promise.always(JQueryPromiseWrapper.wrapCallback(callback));
3675 return this;
3676 };
3677 /**
3678 * Wraps a callback, which may return a IPromise.
3679 */
3680 JQueryPromiseWrapper.wrapCallback = function (callback) {
3681 if (callback)
3682 return function (arg) {
3683 var value = callback(arg);
3684 // If the callback returns a Promise, unwrap that to allow jQuery to chain.
3685 if (value instanceof JQueryPromiseWrapper)
3686 return value.promise;
3687 return value;
3688 };
3689 return callback;
3690 };
3691 return JQueryPromiseWrapper;
3692 }());
3693 })(powerbi || (powerbi = {}));
3694
3695
3696
3697/***/ },
3698
3699/***/ 287:
3700/***/ function(module, exports) {
3701
3702 /*** IMPORTS FROM imports-loader ***/
3703 var jsCommon = window.jsCommon;
3704 var powerbi = window.powerbi;
3705 var powerbitests = window.powerbitests;
3706 var InJs = window.InJs;
3707 var debug = window.debug;
3708 var jasmine = window.jasmine;
3709 var Microsoft = window.Microsoft;
3710
3711 /*
3712 * Power BI Visualizations
3713 *
3714 * Copyright (c) Microsoft Corporation
3715 * All rights reserved.
3716 * MIT License
3717 *
3718 * Permission is hereby granted, free of charge, to any person obtaining a copy
3719 * of this software and associated documentation files (the ""Software""), to deal
3720 * in the Software without restriction, including without limitation the rights
3721 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3722 * copies of the Software, and to permit persons to whom the Software is
3723 * furnished to do so, subject to the following conditions:
3724 *
3725 * The above copyright notice and this permission notice shall be included in
3726 * all copies or substantial portions of the Software.
3727 *
3728 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3729 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3730 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3731 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3732 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3733 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3734 * THE SOFTWARE.
3735 */
3736 /// <reference path="../_references.ts"/>
3737 var powerbi;
3738 (function (powerbi) {
3739 var LocalStorageService = (function () {
3740 function LocalStorageService() {
3741 }
3742 LocalStorageService.prototype.getData = function (key) {
3743 try {
3744 if (localStorage) {
3745 var value = localStorage[key];
3746 if (value) {
3747 return JSON.parse(value);
3748 }
3749 }
3750 }
3751 catch (exception) { }
3752 return null;
3753 };
3754 LocalStorageService.prototype.setData = function (key, data) {
3755 try {
3756 if (localStorage) {
3757 localStorage[key] = JSON.stringify(data);
3758 }
3759 }
3760 catch (e) { }
3761 };
3762 return LocalStorageService;
3763 }());
3764 var EphemeralStorageService = (function () {
3765 function EphemeralStorageService(clearCacheInterval) {
3766 this.cache = {};
3767 this.clearCacheInterval = (clearCacheInterval != null)
3768 ? clearCacheInterval
3769 : EphemeralStorageService.defaultClearCacheInterval;
3770 this.clearCache();
3771 }
3772 EphemeralStorageService.prototype.getData = function (key) {
3773 return this.cache[key];
3774 };
3775 EphemeralStorageService.prototype.setData = function (key, data) {
3776 var _this = this;
3777 this.cache[key] = data;
3778 if (this.clearCacheTimerId == null) {
3779 this.clearCacheTimerId = setTimeout(function () { return _this.clearCache(); }, this.clearCacheInterval);
3780 }
3781 };
3782 EphemeralStorageService.prototype.clearCache = function () {
3783 this.cache = {};
3784 this.clearCacheTimerId = undefined;
3785 };
3786 EphemeralStorageService.defaultClearCacheInterval = (1000 * 60 * 60 * 24); // 1 day
3787 return EphemeralStorageService;
3788 }());
3789 powerbi.EphemeralStorageService = EphemeralStorageService;
3790 powerbi.localStorageService = new LocalStorageService();
3791 powerbi.ephemeralStorageService = new EphemeralStorageService();
3792 })(powerbi || (powerbi = {}));
3793
3794
3795
3796/***/ },
3797
3798/***/ 288:
3799/***/ function(module, exports) {
3800
3801 /*** IMPORTS FROM imports-loader ***/
3802 var jsCommon = window.jsCommon;
3803 var powerbi = window.powerbi;
3804 var powerbitests = window.powerbitests;
3805 var InJs = window.InJs;
3806 var debug = window.debug;
3807 var jasmine = window.jasmine;
3808 var Microsoft = window.Microsoft;
3809
3810 /*
3811 * Power BI Visualizations
3812 *
3813 * Copyright (c) Microsoft Corporation
3814 * All rights reserved.
3815 * MIT License
3816 *
3817 * Permission is hereby granted, free of charge, to any person obtaining a copy
3818 * of this software and associated documentation files (the ""Software""), to deal
3819 * in the Software without restriction, including without limitation the rights
3820 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3821 * copies of the Software, and to permit persons to whom the Software is
3822 * furnished to do so, subject to the following conditions:
3823 *
3824 * The above copyright notice and this permission notice shall be included in
3825 * all copies or substantial portions of the Software.
3826 *
3827 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3828 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3829 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3830 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3831 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3832 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3833 * THE SOFTWARE.
3834 */
3835 /// <reference path="../_references.ts"/>
3836 var jsCommon;
3837 (function (jsCommon) {
3838 var WordBreaker;
3839 (function (WordBreaker) {
3840 var SPACE = ' ';
3841 var BREAKERS_REGEX = /[\s\n]+/g;
3842 function search(index, content, backward) {
3843 if (backward) {
3844 for (var i = index - 1; i > -1; i--) {
3845 if (hasBreakers(content[i]))
3846 return i + 1;
3847 }
3848 }
3849 else {
3850 for (var i = index, ilen = content.length; i < ilen; i++) {
3851 if (hasBreakers(content[i]))
3852 return i;
3853 }
3854 }
3855 return backward ? 0 : content.length;
3856 }
3857 /**
3858 * Find the word nearest the cursor specified within content
3859 * @param index - point within content to search forward/backward from
3860 * @param content - string to search
3861 */
3862 function find(index, content) {
3863 debug.assert(index >= 0 && index <= content.length, 'index within content string bounds');
3864 var result = { start: 0, end: 0 };
3865 if (content.length === 0)
3866 return result;
3867 result.start = search(index, content, true);
3868 result.end = search(index, content, false);
3869 return result;
3870 }
3871 WordBreaker.find = find;
3872 /**
3873 * Test for presence of breakers within content
3874 * @param content - string to test
3875 */
3876 function hasBreakers(content) {
3877 BREAKERS_REGEX.lastIndex = 0;
3878 return BREAKERS_REGEX.test(content);
3879 }
3880 WordBreaker.hasBreakers = hasBreakers;
3881 /**
3882 * Count the number of pieces when broken by BREAKERS_REGEX
3883 * ~2.7x faster than WordBreaker.split(content).length
3884 * @param content - string to break and count
3885 */
3886 function wordCount(content) {
3887 var count = 1;
3888 BREAKERS_REGEX.lastIndex = 0;
3889 BREAKERS_REGEX.exec(content);
3890 while (BREAKERS_REGEX.lastIndex !== 0) {
3891 count++;
3892 BREAKERS_REGEX.exec(content);
3893 }
3894 return count;
3895 }
3896 WordBreaker.wordCount = wordCount;
3897 function getMaxWordWidth(content, textWidthMeasurer, properties) {
3898 var words = split(content);
3899 var maxWidth = 0;
3900 for (var _i = 0, words_1 = words; _i < words_1.length; _i++) {
3901 var w = words_1[_i];
3902 properties.text = w;
3903 maxWidth = Math.max(maxWidth, textWidthMeasurer(properties));
3904 }
3905 return maxWidth;
3906 }
3907 WordBreaker.getMaxWordWidth = getMaxWordWidth;
3908 function split(content) {
3909 return content.split(BREAKERS_REGEX);
3910 }
3911 function getWidth(content, properties, textWidthMeasurer) {
3912 properties.text = content;
3913 return textWidthMeasurer(properties);
3914 }
3915 function truncate(content, properties, truncator, maxWidth) {
3916 properties.text = content;
3917 return truncator(properties, maxWidth);
3918 }
3919 /**
3920 * Split content by breakers (words) and greedy fit as many words
3921 * into each index in the result based on max width and number of lines
3922 * e.g. Each index in result corresponds to a line of content
3923 * when used by AxisHelper.LabelLayoutStrategy.wordBreak
3924 * @param content - string to split
3925 * @param properties - text properties to be used by @param:textWidthMeasurer
3926 * @param textWidthMeasurer - function to calculate width of given text content
3927 * @param maxWidth - maximum allowed width of text content in each result
3928 * @param maxNumLines - maximum number of results we will allow, valid values must be greater than 0
3929 * @param truncator - (optional) if specified, used as a function to truncate content to a given width
3930 */
3931 function splitByWidth(content, properties, textWidthMeasurer, maxWidth, maxNumLines, truncator) {
3932 // Default truncator returns string as-is
3933 truncator = truncator ? truncator : function (properties, maxWidth) { return properties.text; };
3934 var result = [];
3935 var words = split(content);
3936 var usedWidth = 0;
3937 var wordsInLine = [];
3938 for (var _i = 0, words_2 = words; _i < words_2.length; _i++) {
3939 var word = words_2[_i];
3940 // Last line? Just add whatever is left
3941 if ((maxNumLines > 0) && (result.length >= maxNumLines - 1)) {
3942 wordsInLine.push(word);
3943 continue;
3944 }
3945 // Determine width if we add this word
3946 // Account for SPACE we will add when joining...
3947 var wordWidth = wordsInLine.length === 0
3948 ? getWidth(word, properties, textWidthMeasurer)
3949 : getWidth(SPACE + word, properties, textWidthMeasurer);
3950 // If width would exceed max width,
3951 // then push used words and start new split result
3952 if (usedWidth + wordWidth > maxWidth) {
3953 // Word alone exceeds max width, just add it.
3954 if (wordsInLine.length === 0) {
3955 result.push(truncate(word, properties, truncator, maxWidth));
3956 usedWidth = 0;
3957 wordsInLine = [];
3958 continue;
3959 }
3960 result.push(truncate(wordsInLine.join(SPACE), properties, truncator, maxWidth));
3961 usedWidth = 0;
3962 wordsInLine = [];
3963 }
3964 // ...otherwise, add word and continue
3965 wordsInLine.push(word);
3966 usedWidth += wordWidth;
3967 }
3968 // Push remaining words onto result (if any)
3969 if (!_.isEmpty(wordsInLine)) {
3970 result.push(truncate(wordsInLine.join(SPACE), properties, truncator, maxWidth));
3971 }
3972 return result;
3973 }
3974 WordBreaker.splitByWidth = splitByWidth;
3975 })(WordBreaker = jsCommon.WordBreaker || (jsCommon.WordBreaker = {}));
3976 })(jsCommon || (jsCommon = {}));
3977
3978
3979
3980/***/ },
3981
3982/***/ 289:
3983/***/ function(module, exports) {
3984
3985 /*** IMPORTS FROM imports-loader ***/
3986 var jsCommon = window.jsCommon;
3987 var powerbi = window.powerbi;
3988 var powerbitests = window.powerbitests;
3989 var InJs = window.InJs;
3990 var debug = window.debug;
3991 var jasmine = window.jasmine;
3992 var Microsoft = window.Microsoft;
3993
3994 /*
3995 * Power BI Visualizations
3996 *
3997 * Copyright (c) Microsoft Corporation
3998 * All rights reserved.
3999 * MIT License
4000 *
4001 * Permission is hereby granted, free of charge, to any person obtaining a copy
4002 * of this software and associated documentation files (the ""Software""), to deal
4003 * in the Software without restriction, including without limitation the rights
4004 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4005 * copies of the Software, and to permit persons to whom the Software is
4006 * furnished to do so, subject to the following conditions:
4007 *
4008 * The above copyright notice and this permission notice shall be included in
4009 * all copies or substantial portions of the Software.
4010 *
4011 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4012 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4013 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4014 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4015 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4017 * THE SOFTWARE.
4018 */
4019 /// <reference path="../_references.ts"/>
4020 var powerbi;
4021 (function (powerbi) {
4022 var TextMeasurementService;
4023 (function (TextMeasurementService) {
4024 var ellipsis = '…';
4025 var OverflowingText = jsCommon.CssConstants.createClassAndSelector('overflowingText');
4026 var spanElement;
4027 var svgTextElement;
4028 var canvasCtx;
4029 var fallbackFontFamily;
4030 /**
4031 * Idempotent function for adding the elements to the DOM.
4032 */
4033 function ensureDOM() {
4034 if (spanElement)
4035 return;
4036 spanElement = $('<span/>');
4037 $('body').append(spanElement);
4038 //The style hides the svg element from the canvas, preventing canvas from scrolling down to show svg black square.
4039 svgTextElement = d3.select($('body').get(0))
4040 .append('svg')
4041 .style({
4042 'height': '0px',
4043 'width': '0px',
4044 'position': 'absolute'
4045 })
4046 .append('text');
4047 canvasCtx = $('<canvas/>').get(0).getContext("2d");
4048 fallbackFontFamily = window.getComputedStyle(svgTextElement.node()).fontFamily;
4049 }
4050 /**
4051 * Removes spanElement from DOM.
4052 */
4053 function removeSpanElement() {
4054 if (spanElement && spanElement.remove) {
4055 spanElement.remove();
4056 }
4057 spanElement = null;
4058 }
4059 TextMeasurementService.removeSpanElement = removeSpanElement;
4060 /**
4061 * This method measures the width of the text with the given SVG text properties.
4062 * @param textProperties The text properties to use for text measurement.
4063 * @param text The text to measure.
4064 */
4065 function measureSvgTextWidth(textProperties, text) {
4066 debug.assertValue(textProperties, 'textProperties');
4067 debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf("px") !== -1, "TextProperties' text size should be in px.");
4068 ensureDOM();
4069 canvasCtx.font =
4070 (textProperties.fontStyle || "") + " " +
4071 (textProperties.fontVariant || "") + " " +
4072 (textProperties.fontWeight || "") + " " +
4073 textProperties.fontSize + " " +
4074 (textProperties.fontFamily || fallbackFontFamily);
4075 return canvasCtx.measureText(text || textProperties.text).width;
4076 }
4077 TextMeasurementService.measureSvgTextWidth = measureSvgTextWidth;
4078 /**
4079 * This method return the rect with the given SVG text properties.
4080 * @param textProperties The text properties to use for text measurement.
4081 * @param text The text to measure.
4082 */
4083 function measureSvgTextRect(textProperties, text) {
4084 debug.assertValue(textProperties, 'textProperties');
4085 debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf("px") !== -1, "TextProperties' text size should be in px.");
4086 ensureDOM();
4087 svgTextElement.style(null);
4088 svgTextElement
4089 .text(text || textProperties.text)
4090 .attr({
4091 'visibility': 'hidden',
4092 'font-family': textProperties.fontFamily || fallbackFontFamily,
4093 'font-variant': textProperties.fontVariant,
4094 'font-size': textProperties.fontSize,
4095 'font-weight': textProperties.fontWeight,
4096 'font-style': textProperties.fontStyle,
4097 'white-space': textProperties.whiteSpace || 'nowrap'
4098 });
4099 // We're expecting the browser to give a synchronous measurement here
4100 // We're using SVGTextElement because it works across all browsers
4101 return svgTextElement.node().getBBox();
4102 }
4103 TextMeasurementService.measureSvgTextRect = measureSvgTextRect;
4104 /**
4105 * This method measures the height of the text with the given SVG text properties.
4106 * @param textProperties The text properties to use for text measurement.
4107 * @param text The text to measure.
4108 */
4109 function measureSvgTextHeight(textProperties, text) {
4110 return measureSvgTextRect(textProperties, text).height;
4111 }
4112 TextMeasurementService.measureSvgTextHeight = measureSvgTextHeight;
4113 /**
4114 * This method returns the text Rect with the given SVG text properties.
4115 * Does NOT return text width; obliterates text value
4116 * @param {TextProperties} textProperties - The text properties to use for text measurement
4117 */
4118 function estimateSvgTextRect(textProperties) {
4119 debug.assertValue(textProperties, 'textProperties');
4120 debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf("px") !== -1, "TextProperties' text size should be in px.");
4121 var propertiesKey = textProperties.fontFamily + textProperties.fontSize;
4122 var rect = powerbi.ephemeralStorageService.getData(propertiesKey);
4123 if (rect == null) {
4124 // To estimate we check the height of a particular character, once it is cached, subsequent
4125 // calls should always get the height from the cache (regardless of the text).
4126 var estimatedTextProperties = {
4127 fontFamily: textProperties.fontFamily,
4128 fontSize: textProperties.fontSize,
4129 text: "M",
4130 };
4131 rect = TextMeasurementService.measureSvgTextRect(estimatedTextProperties);
4132 // NOTE: In some cases (disconnected/hidden DOM) we may provide incorrect measurement results (zero sized bounding-box), so
4133 // we only store values in the cache if we are confident they are correct.
4134 if (rect.height > 0)
4135 powerbi.ephemeralStorageService.setData(propertiesKey, rect);
4136 }
4137 return rect;
4138 }
4139 /**
4140 * This method returns the text Rect with the given SVG text properties.
4141 * @param {TextProperties} textProperties - The text properties to use for text measurement
4142 */
4143 function estimateSvgTextBaselineDelta(textProperties) {
4144 var rect = estimateSvgTextRect(textProperties);
4145 return rect.y + rect.height;
4146 }
4147 TextMeasurementService.estimateSvgTextBaselineDelta = estimateSvgTextBaselineDelta;
4148 /**
4149 * This method estimates the height of the text with the given SVG text properties.
4150 * @param {TextProperties} textProperties - The text properties to use for text measurement
4151 */
4152 function estimateSvgTextHeight(textProperties, tightFightForNumeric) {
4153 if (tightFightForNumeric === void 0) { tightFightForNumeric = false; }
4154 var height = estimateSvgTextRect(textProperties).height;
4155 //TODO: replace it with new baseline calculation
4156 if (tightFightForNumeric)
4157 height *= 0.7;
4158 return height;
4159 }
4160 TextMeasurementService.estimateSvgTextHeight = estimateSvgTextHeight;
4161 /**
4162 * This method measures the width of the svgElement.
4163 * @param svgElement The SVGTextElement to be measured.
4164 */
4165 function measureSvgTextElementWidth(svgElement) {
4166 debug.assertValue(svgElement, 'svgElement');
4167 return measureSvgTextWidth(getSvgMeasurementProperties(svgElement));
4168 }
4169 TextMeasurementService.measureSvgTextElementWidth = measureSvgTextElementWidth;
4170 /**
4171 * This method fetches the text measurement properties of the given DOM element.
4172 * @param element The selector for the DOM Element.
4173 */
4174 function getMeasurementProperties(element) {
4175 debug.assertValue(element, 'element');
4176 return {
4177 text: element.val() || element.text(),
4178 fontFamily: element.css('font-family'),
4179 fontSize: element.css('font-size'),
4180 fontWeight: element.css('font-weight'),
4181 fontStyle: element.css('font-style'),
4182 fontVariant: element.css('font-variant'),
4183 whiteSpace: element.css('white-space')
4184 };
4185 }
4186 TextMeasurementService.getMeasurementProperties = getMeasurementProperties;
4187 /**
4188 * This method fetches the text measurement properties of the given SVG text element.
4189 * @param svgElement The SVGTextElement to be measured.
4190 */
4191 function getSvgMeasurementProperties(svgElement) {
4192 debug.assertValue(svgElement, 'svgElement');
4193 var style = window.getComputedStyle(svgElement, null);
4194 return {
4195 text: svgElement.textContent,
4196 fontFamily: style.fontFamily,
4197 fontSize: style.fontSize,
4198 fontWeight: style.fontWeight,
4199 fontStyle: style.fontStyle,
4200 fontVariant: style.fontVariant,
4201 whiteSpace: style.whiteSpace
4202 };
4203 }
4204 TextMeasurementService.getSvgMeasurementProperties = getSvgMeasurementProperties;
4205 /**
4206 * This method returns the width of a div element.
4207 * @param element The div element.
4208 */
4209 function getDivElementWidth(element) {
4210 debug.assert(element.is('div'), 'Given element is not a div type. Cannot get width');
4211 return getComputedStyle(element[0]).width;
4212 }
4213 TextMeasurementService.getDivElementWidth = getDivElementWidth;
4214 /**
4215 * Compares labels text size to the available size and renders ellipses when the available size is smaller.
4216 * @param textProperties The text properties (including text content) to use for text measurement.
4217 * @param maxWidth The maximum width available for rendering the text.
4218 */
4219 function getTailoredTextOrDefault(textProperties, maxWidth) {
4220 debug.assertValue(textProperties, 'properties');
4221 debug.assertValue(textProperties.text, 'properties.text');
4222 debug.assert(_.isEmpty(textProperties.fontSize) || textProperties.fontSize.indexOf("px") !== -1, "TextProperties' text size should be in px.");
4223 ensureDOM();
4224 var strLength = textProperties.text.length;
4225 if (strLength === 0)
4226 return textProperties.text;
4227 var width = measureSvgTextWidth(textProperties);
4228 if (width < maxWidth)
4229 return textProperties.text;
4230 // Create a copy of the textProperties so we don't modify the one that's passed in.
4231 var copiedTextProperties = powerbi.Prototype.inherit(textProperties);
4232 // Take the properties and apply them to svgTextElement
4233 // Then, do the binary search to figure out the substring we want
4234 // Set the substring on textElement argument
4235 var text = copiedTextProperties.text = ellipsis + copiedTextProperties.text;
4236 var min = 1;
4237 var max = text.length;
4238 var i = ellipsis.length;
4239 while (min <= max) {
4240 // num | 0 prefered to Math.floor(num) for performance benefits
4241 i = (min + max) / 2 | 0;
4242 copiedTextProperties.text = text.substr(0, i);
4243 width = measureSvgTextWidth(copiedTextProperties);
4244 if (maxWidth > width)
4245 min = i + 1;
4246 else if (maxWidth < width)
4247 max = i - 1;
4248 else
4249 break;
4250 }
4251 // Since the search algorithm almost never finds an exact match,
4252 // it will pick one of the closest two, which could result in a
4253 // value bigger with than 'maxWidth' thus we need to go back by
4254 // one to guarantee a smaller width than 'maxWidth'.
4255 copiedTextProperties.text = text.substr(0, i);
4256 width = measureSvgTextWidth(copiedTextProperties);
4257 if (width > maxWidth)
4258 i--;
4259 return text.substr(ellipsis.length, i - ellipsis.length) + ellipsis;
4260 }
4261 TextMeasurementService.getTailoredTextOrDefault = getTailoredTextOrDefault;
4262 /**
4263 * Compares labels text size to the available size and renders ellipses when the available size is smaller.
4264 * @param textElement The SVGTextElement containing the text to render.
4265 * @param maxWidth The maximum width available for rendering the text.
4266 */
4267 function svgEllipsis(textElement, maxWidth) {
4268 debug.assertValue(textElement, 'textElement');
4269 var properties = getSvgMeasurementProperties(textElement);
4270 var originalText = properties.text;
4271 var tailoredText = getTailoredTextOrDefault(properties, maxWidth);
4272 if (originalText !== tailoredText) {
4273 textElement.textContent = tailoredText;
4274 }
4275 }
4276 TextMeasurementService.svgEllipsis = svgEllipsis;
4277 /**
4278 * Word break textContent of <text> SVG element into <tspan>s
4279 * Each tspan will be the height of a single line of text
4280 * @param textElement - the SVGTextElement containing the text to wrap
4281 * @param maxWidth - the maximum width available
4282 * @param maxHeight - the maximum height available (defaults to single line)
4283 * @param linePadding - (optional) padding to add to line height
4284 */
4285 function wordBreak(textElement, maxWidth, maxHeight, linePadding) {
4286 if (linePadding === void 0) { linePadding = 0; }
4287 debug.assertValue(textElement, 'textElement');
4288 var properties = getSvgMeasurementProperties(textElement);
4289 var height = estimateSvgTextHeight(properties) + linePadding;
4290 var maxNumLines = Math.max(1, Math.floor(maxHeight / height));
4291 var node = d3.select(textElement);
4292 // Save y of parent textElement to apply as first tspan dy
4293 var firstDY = node.attr('y');
4294 // Store and clear text content
4295 var labelText = textElement.textContent;
4296 textElement.textContent = null;
4297 // Append a tspan for each word broken section
4298 var words = jsCommon.WordBreaker.splitByWidth(labelText, properties, measureSvgTextWidth, maxWidth, maxNumLines);
4299 for (var i = 0, ilen = words.length; i < ilen; i++) {
4300 properties.text = words[i];
4301 node
4302 .append('tspan')
4303 .attr({
4304 'x': 0,
4305 'dy': i === 0 ? firstDY : height,
4306 })
4307 .text(getTailoredTextOrDefault(properties, maxWidth));
4308 }
4309 }
4310 TextMeasurementService.wordBreak = wordBreak;
4311 /**
4312 * Word break textContent of span element into <span>s
4313 * Each span will be the height of a single line of text
4314 * @param textElement - the element containing the text to wrap
4315 * @param maxWidth - the maximum width available
4316 * @param maxHeight - the maximum height available (defaults to single line)
4317 * @param linePadding - (optional) padding to add to line height
4318 */
4319 function wordBreakOverflowingText(textElement, maxWidth, maxHeight, linePadding) {
4320 if (linePadding === void 0) { linePadding = 0; }
4321 debug.assertValue(textElement, 'textElement');
4322 var properties = getSvgMeasurementProperties(textElement);
4323 var height = estimateSvgTextHeight(properties) + linePadding;
4324 var maxNumLines = Math.max(1, Math.floor(maxHeight / height));
4325 // Store and clear text content
4326 var labelText = textElement.textContent;
4327 textElement.textContent = null;
4328 // Append a span for each word broken section
4329 var words = jsCommon.WordBreaker.splitByWidth(labelText, properties, measureSvgTextWidth, maxWidth, maxNumLines);
4330 var spanItem = d3.select(textElement)
4331 .selectAll(OverflowingText.selector)
4332 .data(words, function (d) { return $.inArray(d, words); });
4333 spanItem
4334 .enter()
4335 .append("span")
4336 .classed(OverflowingText.class, true)
4337 .text(function (d) { return d; })
4338 .style("width", jsCommon.PixelConverter.toString(maxWidth));
4339 }
4340 TextMeasurementService.wordBreakOverflowingText = wordBreakOverflowingText;
4341 })(TextMeasurementService = powerbi.TextMeasurementService || (powerbi.TextMeasurementService = {}));
4342 })(powerbi || (powerbi = {}));
4343
4344
4345
4346/***/ },
4347
4348/***/ 290:
4349/***/ function(module, exports) {
4350
4351 /*** IMPORTS FROM imports-loader ***/
4352 var jsCommon = window.jsCommon;
4353 var powerbi = window.powerbi;
4354 var powerbitests = window.powerbitests;
4355 var InJs = window.InJs;
4356 var debug = window.debug;
4357 var jasmine = window.jasmine;
4358 var Microsoft = window.Microsoft;
4359
4360 /*
4361 * Power BI Visualizations
4362 *
4363 * Copyright (c) Microsoft Corporation
4364 * All rights reserved.
4365 * MIT License
4366 *
4367 * Permission is hereby granted, free of charge, to any person obtaining a copy
4368 * of this software and associated documentation files (the ""Software""), to deal
4369 * in the Software without restriction, including without limitation the rights
4370 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4371 * copies of the Software, and to permit persons to whom the Software is
4372 * furnished to do so, subject to the following conditions:
4373 *
4374 * The above copyright notice and this permission notice shall be included in
4375 * all copies or substantial portions of the Software.
4376 *
4377 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4378 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4379 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4380 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4381 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4382 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4383 * THE SOFTWARE.
4384 */
4385 /// <reference path="../_references.ts"/>
4386 var jsCommon;
4387 (function (jsCommon) {
4388 var DOMConstants = jsCommon.DOMConstants;
4389 var KeyUtils;
4390 (function (KeyUtils) {
4391 function isArrowKey(keyCode) {
4392 return keyCode === DOMConstants.downArrowKeyCode
4393 || keyCode === DOMConstants.upArrowKeyCode
4394 || keyCode === DOMConstants.leftArrowKeyCode
4395 || keyCode === DOMConstants.rightArrowKeyCode;
4396 }
4397 KeyUtils.isArrowKey = isArrowKey;
4398 function isCtrlDefaultKey(keyCode) {
4399 return keyCode === DOMConstants.aKeyCode
4400 || keyCode === DOMConstants.cKeyCode
4401 || keyCode === DOMConstants.xKeyCode
4402 || keyCode === DOMConstants.vKeyCode;
4403 }
4404 KeyUtils.isCtrlDefaultKey = isCtrlDefaultKey;
4405 function isNudgeModifierKey(keyCode) {
4406 return keyCode === DOMConstants.shiftKeyCode;
4407 }
4408 KeyUtils.isNudgeModifierKey = isNudgeModifierKey;
4409 })(KeyUtils = jsCommon.KeyUtils || (jsCommon.KeyUtils = {}));
4410 })(jsCommon || (jsCommon = {}));
4411
4412
4413
4414/***/ },
4415
4416/***/ 291:
4417/***/ function(module, exports) {
4418
4419 /*** IMPORTS FROM imports-loader ***/
4420 var jsCommon = window.jsCommon;
4421 var powerbi = window.powerbi;
4422 var powerbitests = window.powerbitests;
4423 var InJs = window.InJs;
4424 var debug = window.debug;
4425 var jasmine = window.jasmine;
4426 var Microsoft = window.Microsoft;
4427
4428 /*
4429 * Power BI Visualizations
4430 *
4431 * Copyright (c) Microsoft Corporation
4432 * All rights reserved.
4433 * MIT License
4434 *
4435 * Permission is hereby granted, free of charge, to any person obtaining a copy
4436 * of this software and associated documentation files (the ""Software""), to deal
4437 * in the Software without restriction, including without limitation the rights
4438 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4439 * copies of the Software, and to permit persons to whom the Software is
4440 * furnished to do so, subject to the following conditions:
4441 *
4442 * The above copyright notice and this permission notice shall be included in
4443 * all copies or substantial portions of the Software.
4444 *
4445 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4446 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4447 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4448 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4449 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4450 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4451 * THE SOFTWARE.
4452 */
4453 /// <reference path="../_references.ts"/>
4454 var jsCommon;
4455 (function (jsCommon) {
4456 /**
4457 * Responsible for throttling input function.
4458 */
4459 var ThrottleUtility = (function () {
4460 function ThrottleUtility(delay) {
4461 this.timerFactory = jsCommon.TimerPromiseFactory.instance;
4462 this.delay = 0;
4463 if (delay) {
4464 this.delay = delay;
4465 }
4466 }
4467 ThrottleUtility.prototype.run = function (fn) {
4468 var _this = this;
4469 if (!this.fn) {
4470 this.fn = fn;
4471 this.timerFactory.create(this.delay).done(function () { return _this.timerComplete(_this.fn); });
4472 }
4473 else {
4474 this.fn = fn;
4475 }
4476 };
4477 /**
4478 * Note: Public for testing purpose.
4479 */
4480 ThrottleUtility.prototype.timerComplete = function (fn) {
4481 // run fn
4482 fn();
4483 // clear fn
4484 this.fn = null;
4485 };
4486 return ThrottleUtility;
4487 }());
4488 jsCommon.ThrottleUtility = ThrottleUtility;
4489 })(jsCommon || (jsCommon = {}));
4490
4491
4492
4493/***/ },
4494
4495/***/ 292:
4496/***/ function(module, exports) {
4497
4498 /*** IMPORTS FROM imports-loader ***/
4499 var jsCommon = window.jsCommon;
4500 var powerbi = window.powerbi;
4501 var powerbitests = window.powerbitests;
4502 var InJs = window.InJs;
4503 var debug = window.debug;
4504 var jasmine = window.jasmine;
4505 var Microsoft = window.Microsoft;
4506
4507 /*
4508 * Power BI Visualizations
4509 *
4510 * Copyright (c) Microsoft Corporation
4511 * All rights reserved.
4512 * MIT License
4513 *
4514 * Permission is hereby granted, free of charge, to any person obtaining a copy
4515 * of this software and associated documentation files (the ""Software""), to deal
4516 * in the Software without restriction, including without limitation the rights
4517 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4518 * copies of the Software, and to permit persons to whom the Software is
4519 * furnished to do so, subject to the following conditions:
4520 *
4521 * The above copyright notice and this permission notice shall be included in
4522 * all copies or substantial portions of the Software.
4523 *
4524 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4525 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4526 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4527 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4528 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4529 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4530 * THE SOFTWARE.
4531 */
4532 /// <reference path="../_references.ts"/>
4533 var jsCommon;
4534 (function (jsCommon) {
4535 /**
4536 * Responsible for creating timer promises.
4537 */
4538 var TimerPromiseFactory = (function () {
4539 function TimerPromiseFactory() {
4540 }
4541 /**
4542 * {@inheritDoc}
4543 */
4544 TimerPromiseFactory.prototype.create = function (delayInMs) {
4545 debug.assertValue(delayInMs, 'delayInMs');
4546 debug.assert(delayInMs >= 0, 'delayInMs must be a positive value.');
4547 var deferred = $.Deferred();
4548 window.setTimeout(function () { return deferred.resolve(); }, delayInMs);
4549 return deferred;
4550 };
4551 TimerPromiseFactory.instance = new TimerPromiseFactory();
4552 return TimerPromiseFactory;
4553 }());
4554 jsCommon.TimerPromiseFactory = TimerPromiseFactory;
4555 })(jsCommon || (jsCommon = {}));
4556
4557
4558
4559/***/ },
4560
4561/***/ 293:
4562/***/ function(module, exports) {
4563
4564 /*** IMPORTS FROM imports-loader ***/
4565 var jsCommon = window.jsCommon;
4566 var powerbi = window.powerbi;
4567 var powerbitests = window.powerbitests;
4568 var InJs = window.InJs;
4569 var debug = window.debug;
4570 var jasmine = window.jasmine;
4571 var Microsoft = window.Microsoft;
4572
4573 /*
4574 * Power BI Visualizations
4575 *
4576 * Copyright (c) Microsoft Corporation
4577 * All rights reserved.
4578 * MIT License
4579 *
4580 * Permission is hereby granted, free of charge, to any person obtaining a copy
4581 * of this software and associated documentation files (the ""Software""), to deal
4582 * in the Software without restriction, including without limitation the rights
4583 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4584 * copies of the Software, and to permit persons to whom the Software is
4585 * furnished to do so, subject to the following conditions:
4586 *
4587 * The above copyright notice and this permission notice shall be included in
4588 * all copies or substantial portions of the Software.
4589 *
4590 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4591 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4592 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4593 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4594 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4595 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4596 * THE SOFTWARE.
4597 */
4598 /// <reference path="../_references.ts"/>
4599 var jsCommon;
4600 (function (jsCommon) {
4601 /**
4602 * Http Status code we are interested.
4603 */
4604 (function (HttpStatusCode) {
4605 HttpStatusCode[HttpStatusCode["OK"] = 200] = "OK";
4606 HttpStatusCode[HttpStatusCode["BadRequest"] = 400] = "BadRequest";
4607 HttpStatusCode[HttpStatusCode["Unauthorized"] = 401] = "Unauthorized";
4608 HttpStatusCode[HttpStatusCode["Forbidden"] = 403] = "Forbidden";
4609 HttpStatusCode[HttpStatusCode["RequestEntityTooLarge"] = 413] = "RequestEntityTooLarge";
4610 })(jsCommon.HttpStatusCode || (jsCommon.HttpStatusCode = {}));
4611 var HttpStatusCode = jsCommon.HttpStatusCode;
4612 /**
4613 * Other HTTP Constants.
4614 */
4615 var HttpConstants;
4616 (function (HttpConstants) {
4617 HttpConstants.ApplicationOctetStream = 'application/octet-stream';
4618 HttpConstants.MultiPartFormData = 'multipart/form-data';
4619 })(HttpConstants = jsCommon.HttpConstants || (jsCommon.HttpConstants = {}));
4620 /**
4621 * Extensions to String class.
4622 */
4623 var StringExtensions;
4624 (function (StringExtensions) {
4625 var HtmlTagRegex = new RegExp('[<>]', 'g');
4626 function format() {
4627 var args = [];
4628 for (var _i = 0; _i < arguments.length; _i++) {
4629 args[_i - 0] = arguments[_i];
4630 }
4631 var s = args[0];
4632 if (isNullOrUndefinedOrWhiteSpaceString(s))
4633 return s;
4634 for (var i = 0; i < args.length - 1; i++) {
4635 var reg = new RegExp("\\{" + i + "\\}", "gm");
4636 s = s.replace(reg, args[i + 1]);
4637 }
4638 return s;
4639 }
4640 StringExtensions.format = format;
4641 /**
4642 * Compares two strings for equality, ignoring case.
4643 */
4644 function equalIgnoreCase(a, b) {
4645 return StringExtensions.normalizeCase(a) === StringExtensions.normalizeCase(b);
4646 }
4647 StringExtensions.equalIgnoreCase = equalIgnoreCase;
4648 function startsWithIgnoreCase(a, b) {
4649 var normalizedSearchString = StringExtensions.normalizeCase(b);
4650 return StringExtensions.normalizeCase(a).indexOf(normalizedSearchString) === 0;
4651 }
4652 StringExtensions.startsWithIgnoreCase = startsWithIgnoreCase;
4653 function startsWith(a, b) {
4654 return a.indexOf(b) === 0;
4655 }
4656 StringExtensions.startsWith = startsWith;
4657 /** Determines whether a string contains a specified substring (by case-sensitive comparison). */
4658 function contains(source, substring) {
4659 if (source == null)
4660 return false;
4661 return source.indexOf(substring) !== -1;
4662 }
4663 StringExtensions.contains = contains;
4664 /** Determines whether a string contains a specified substring (while ignoring case). */
4665 function containsIgnoreCase(source, substring) {
4666 if (source == null)
4667 return false;
4668 return contains(normalizeCase(source), normalizeCase(substring));
4669 }
4670 StringExtensions.containsIgnoreCase = containsIgnoreCase;
4671 /**
4672 * Normalizes case for a string.
4673 * Used by equalIgnoreCase method.
4674 */
4675 function normalizeCase(value) {
4676 Utility.throwIfNullOrUndefined(value, StringExtensions, 'normalizeCase', 'value');
4677 return value.toUpperCase();
4678 }
4679 StringExtensions.normalizeCase = normalizeCase;
4680 /**
4681 * Is string null or empty or undefined?
4682 * @return True if the value is null or undefined or empty string,
4683 * otherwise false.
4684 */
4685 function isNullOrEmpty(value) {
4686 return (value == null) || (value.length === 0);
4687 }
4688 StringExtensions.isNullOrEmpty = isNullOrEmpty;
4689 /**
4690 * Returns true if the string is null, undefined, empty, or only includes white spaces.
4691 * @return True if the str is null, undefined, empty, or only includes white spaces,
4692 * otherwise false.
4693 */
4694 function isNullOrUndefinedOrWhiteSpaceString(str) {
4695 return StringExtensions.isNullOrEmpty(str) || StringExtensions.isNullOrEmpty(str.trim());
4696 }
4697 StringExtensions.isNullOrUndefinedOrWhiteSpaceString = isNullOrUndefinedOrWhiteSpaceString;
4698 /**
4699 * Returns a value indicating whether the str contains any whitespace.
4700 */
4701 function containsWhitespace(str) {
4702 Utility.throwIfNullOrUndefined(str, this, 'containsWhitespace', 'str');
4703 var expr = /\s/;
4704 return expr.test(str);
4705 }
4706 StringExtensions.containsWhitespace = containsWhitespace;
4707 /**
4708 * Returns a value indicating whether the str is a whitespace string.
4709 */
4710 function isWhitespace(str) {
4711 Utility.throwIfNullOrUndefined(str, this, 'isWhitespace', 'str');
4712 return str.trim() === '';
4713 }
4714 StringExtensions.isWhitespace = isWhitespace;
4715 /**
4716 * Returns the string with any trailing whitespace from str removed.
4717 */
4718 function trimTrailingWhitespace(str) {
4719 Utility.throwIfNullOrUndefined(str, this, 'trimTrailingWhitespace', 'str');
4720 return str.replace(/\s+$/, '');
4721 }
4722 StringExtensions.trimTrailingWhitespace = trimTrailingWhitespace;
4723 /**
4724 * Returns the string with any leading and trailing whitespace from str removed.
4725 */
4726 function trimWhitespace(str) {
4727 Utility.throwIfNullOrUndefined(str, this, 'trimWhitespace', 'str');
4728 return str.replace(/^\s+/, '').replace(/\s+$/, '');
4729 }
4730 StringExtensions.trimWhitespace = trimWhitespace;
4731 /**
4732 * Returns length difference between the two provided strings.
4733 */
4734 function getLengthDifference(left, right) {
4735 Utility.throwIfNullOrUndefined(left, this, 'getLengthDifference', 'left');
4736 Utility.throwIfNullOrUndefined(right, this, 'getLengthDifference', 'right');
4737 return Math.abs(left.length - right.length);
4738 }
4739 StringExtensions.getLengthDifference = getLengthDifference;
4740 /**
4741 * Repeat char or string several times.
4742 * @param char The string to repeat.
4743 * @param count How many times to repeat the string.
4744 */
4745 function repeat(char, count) {
4746 var result = "";
4747 for (var i = 0; i < count; i++) {
4748 result += char;
4749 }
4750 return result;
4751 }
4752 StringExtensions.repeat = repeat;
4753 /**
4754 * Replace all the occurrences of the textToFind in the text with the textToReplace.
4755 * @param text The original string.
4756 * @param textToFind Text to find in the original string.
4757 * @param textToReplace New text replacing the textToFind.
4758 */
4759 function replaceAll(text, textToFind, textToReplace) {
4760 if (!textToFind)
4761 return text;
4762 var pattern = escapeStringForRegex(textToFind);
4763 return text.replace(new RegExp(pattern, 'gi'), textToReplace);
4764 }
4765 StringExtensions.replaceAll = replaceAll;
4766 function ensureUniqueNames(names) {
4767 debug.assertValue(names, 'names');
4768 var usedNames = {};
4769 // Make sure we are giving fair chance for all columns to stay with their original name
4770 // First we fill the used names map to contain all the original unique names from the list.
4771 for (var _i = 0, names_1 = names; _i < names_1.length; _i++) {
4772 var name_1 = names_1[_i];
4773 usedNames[name_1] = false;
4774 }
4775 var uniqueNames = [];
4776 // Now we go over all names and find a unique name for each
4777 for (var _a = 0, names_2 = names; _a < names_2.length; _a++) {
4778 var name_2 = names_2[_a];
4779 var uniqueName = name_2;
4780 // If the (original) column name is already taken lets try to find another name
4781 if (usedNames[uniqueName]) {
4782 var counter = 0;
4783 // Find a name that is not already in the map
4784 while (usedNames[uniqueName] !== undefined) {
4785 uniqueName = name_2 + "." + (++counter);
4786 }
4787 }
4788 uniqueNames.push(uniqueName);
4789 usedNames[uniqueName] = true;
4790 }
4791 return uniqueNames;
4792 }
4793 StringExtensions.ensureUniqueNames = ensureUniqueNames;
4794 /**
4795 * Returns a name that is not specified in the values.
4796 */
4797 function findUniqueName(usedNames, baseName) {
4798 debug.assertValue(usedNames, 'usedNames');
4799 debug.assertValue(baseName, 'baseName');
4800 // Find a unique name
4801 var i = 0, uniqueName = baseName;
4802 while (usedNames[uniqueName]) {
4803 uniqueName = baseName + (++i);
4804 }
4805 return uniqueName;
4806 }
4807 StringExtensions.findUniqueName = findUniqueName;
4808 function constructCommaSeparatedList(list, resourceProvider, maxValue) {
4809 if (!list || list.length === 0)
4810 return '';
4811 if (maxValue === null || maxValue === undefined)
4812 maxValue = Number.MAX_VALUE;
4813 var length = Math.min(maxValue, list.length);
4814 var replacedList = [];
4815 // Only need to replace user entries of {0} and {1} since we build the list in pairs.
4816 for (var j = 0; j < 2; j++) {
4817 var targetValue = '{' + j + '}';
4818 var replaceValue = '_|_<' + j + '>_|_';
4819 for (var i = 0; i < length; i++) {
4820 if (list[i].indexOf(targetValue) > -1) {
4821 list[i] = list[i].replace(targetValue, replaceValue);
4822 replacedList.push({ targetValue: targetValue, replaceValue: replaceValue });
4823 }
4824 }
4825 }
4826 var commaSeparatedList = '';
4827 for (var i = 0; i < length; i++) {
4828 if (i === 0)
4829 commaSeparatedList = list[i];
4830 else
4831 commaSeparatedList = StringExtensions.format(resourceProvider.get('FilterRestatement_Comma'), commaSeparatedList, list[i]);
4832 }
4833 for (var i = 0; i < replacedList.length; i++) {
4834 commaSeparatedList = commaSeparatedList.replace(replacedList[i].replaceValue, replacedList[i].targetValue);
4835 }
4836 return commaSeparatedList;
4837 }
4838 StringExtensions.constructCommaSeparatedList = constructCommaSeparatedList;
4839 function escapeStringForRegex(s) {
4840 return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1');
4841 }
4842 StringExtensions.escapeStringForRegex = escapeStringForRegex;
4843 /**
4844 * Remove file name reserved characters <>:"/\|?* from input string.
4845 */
4846 function normalizeFileName(fileName) {
4847 debug.assertValue(fileName, 'fileName');
4848 return fileName.replace(/[\<\>\:"\/\\\|\?*]/g, '');
4849 }
4850 StringExtensions.normalizeFileName = normalizeFileName;
4851 /**
4852 * Similar to JSON.stringify, but strips away escape sequences so that the resulting
4853 * string is human-readable (and parsable by JSON formatting/validating tools).
4854 */
4855 function stringifyAsPrettyJSON(object) {
4856 //let specialCharacterRemover = (key: string, value: string) => value.replace(/[^\w\s]/gi, '');
4857 return JSON.stringify(object /*, specialCharacterRemover*/);
4858 }
4859 StringExtensions.stringifyAsPrettyJSON = stringifyAsPrettyJSON;
4860 /**
4861 * Derive a CLS-compliant name from a specified string. If no allowed characters are present, return a fallback string instead.
4862 * TODO (6708134): this should have a fully Unicode-aware implementation
4863 */
4864 function deriveClsCompliantName(input, fallback) {
4865 debug.assertValue(input, 'input');
4866 var result = input.replace(/^[^A-Za-z]*/g, '').replace(/[ :\.\/\\\-\u00a0\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]/g, '_').replace(/[\W]/g, '');
4867 return result.length > 0 ? result : fallback;
4868 }
4869 StringExtensions.deriveClsCompliantName = deriveClsCompliantName;
4870 /** Performs cheap sanitization by stripping away HTML tag (<>) characters. */
4871 function stripTagDelimiters(s) {
4872 return s.replace(HtmlTagRegex, '');
4873 }
4874 StringExtensions.stripTagDelimiters = stripTagDelimiters;
4875 })(StringExtensions = jsCommon.StringExtensions || (jsCommon.StringExtensions = {}));
4876 /**
4877 * The general utility class.
4878 */
4879 var Utility = (function () {
4880 function Utility() {
4881 }
4882 /**
4883 * Ensures the specified value is not null or undefined. Throws a relevent exception if it is.
4884 * @param value The value to check.
4885 * @param context The context from which the check originated.
4886 * @param methodName The name of the method that initiated the check.
4887 * @param parameterName The parameter name of the value to check.
4888 */
4889 Utility.throwIfNullOrUndefined = function (value, context, methodName, parameterName) {
4890 if (value === null) {
4891 Utility.throwException(jsCommon.Errors.argumentNull(Utility.getComponentName(context) + methodName + '.' + parameterName));
4892 }
4893 else if (typeof (value) === Utility.Undefined) {
4894 Utility.throwException(jsCommon.Errors.argumentUndefined(Utility.getComponentName(context) + methodName + '.' + parameterName));
4895 }
4896 };
4897 /**
4898 * Ensures the specified value is not null, undefined or empty. Throws a relevent exception if it is.
4899 * @param value The value to check.
4900 * @param context The context from which the check originated.
4901 * @param methodName The name of the method that initiated the check.
4902 * @param parameterName The parameter name of the value to check.
4903 */
4904 Utility.throwIfNullOrEmpty = function (value, context, methodName, parameterName) {
4905 Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);
4906 if (!value.length) {
4907 Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));
4908 }
4909 };
4910 /**
4911 * Ensures the specified string is not null, undefined or empty. Throws a relevent exception if it is.
4912 * @param value The value to check.
4913 * @param context The context from which the check originated.
4914 * @param methodName The name of the method that initiated the check.
4915 * @param parameterName The parameter name of the value to check.
4916 */
4917 Utility.throwIfNullOrEmptyString = function (value, context, methodName, parameterName) {
4918 Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);
4919 if (value.length < 1) {
4920 Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));
4921 }
4922 };
4923 /**
4924 * Ensures the specified value is not null, undefined, whitespace or empty. Throws a relevent exception if it is.
4925 * @param value The value to check.
4926 * @param context The context from which the check originated.
4927 * @param methodName The name of the method that initiated the check.
4928 * @param parameterName The parameter name of the value to check.
4929 */
4930 Utility.throwIfNullEmptyOrWhitespaceString = function (value, context, methodName, parameterName) {
4931 Utility.throwIfNullOrUndefined(value, context, methodName, parameterName);
4932 if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(value)) {
4933 Utility.throwException(jsCommon.Errors.argumentOutOfRange(Utility.getComponentName(context) + methodName + '.' + parameterName));
4934 }
4935 };
4936 /**
4937 * Ensures the specified condition is true. Throws relevant exception if it isn't.
4938 * @param condition The condition to check.
4939 * @param context The context from which the check originated.
4940 * @param methodName The name of the method that initiated the check.
4941 * @param parameterName The parameter name against which the condition is checked.
4942 */
4943 Utility.throwIfNotTrue = function (condition, context, methodName, parameterName) {
4944 if (!condition) {
4945 Utility.throwException(jsCommon.Errors.argument(parameterName, Utility.getComponentName(context) + methodName + '.' + parameterName));
4946 }
4947 };
4948 /**
4949 * Checks whether the provided value is a 'string'.
4950 * @param value The value to test.
4951 */
4952 Utility.isString = function (value) {
4953 return ((typeof value) === 'string');
4954 };
4955 /**
4956 * Checks whether the provided value is a 'boolean'.
4957 * @param value The value to test.
4958 */
4959 Utility.isBoolean = function (value) {
4960 return ((typeof value) === 'boolean');
4961 };
4962 /**
4963 * Checks whether the provided value is a 'number'.
4964 * @param value The value to test.
4965 */
4966 Utility.isNumber = function (value) {
4967 return ((typeof value) === 'number');
4968 };
4969 /**
4970 * Checks whether the provided value is a Date instance.
4971 * @param value The value to test.
4972 */
4973 Utility.isDate = function (value) {
4974 return Utility.isObject(value) && (value instanceof Date);
4975 };
4976 /**
4977 * Checks whether the provided value is an 'object'.
4978 * @param value The value to test.
4979 */
4980 Utility.isObject = function (value) {
4981 return (value != null) && ((typeof value) === 'object');
4982 };
4983 /**
4984 * Checks whether the provided value is null or undefined.
4985 * @param value The value to test.
4986 */
4987 Utility.isNullOrUndefined = function (value) {
4988 return (value === null) || (typeof (value) === Utility.Undefined);
4989 };
4990 /**
4991 * Checks if the value is defined and returns it, else, returns undefined
4992 * @param {T} value Value to check
4993 * @param {T} defaultValue Default value to return if value is undefined
4994 * @returns value if defined, else defaultValue
4995 */
4996 Utility.valueOrDefault = function (value, defaultValue) {
4997 if (value != null)
4998 return value;
4999 return defaultValue;
5000 };
5001 /**
5002 * Combine a base url and a path.
5003 * @param baseUrl The base url.
5004 * @param path The path to add on to the base url.
5005 * @returns The combined url.
5006 */
5007 Utility.urlCombine = function (baseUrl, path) {
5008 Utility.throwIfNullOrUndefined(baseUrl, null, "urlCombine", "baseUrl");
5009 Utility.throwIfNullOrUndefined(path, null, "urlCombine", "path");
5010 // should any of the components be empty, fail gracefuly - this is important when using the test page
5011 if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(path)) {
5012 return baseUrl;
5013 }
5014 if (StringExtensions.isNullOrUndefinedOrWhiteSpaceString(baseUrl)) {
5015 return path;
5016 }
5017 var finalUrl = baseUrl;
5018 if (finalUrl.charAt(finalUrl.length - 1) === '/') {
5019 if (path.charAt(0) === '/')
5020 path = path.slice(1);
5021 }
5022 else {
5023 if (path.charAt(0) !== '/')
5024 path = '/' + path;
5025 }
5026 return finalUrl + path;
5027 };
5028 Utility.getAbsoluteUri = function (path) {
5029 Utility.throwIfNullOrUndefined(path, null, "getAbsoluteUri", "path");
5030 var url = path;
5031 // Make absolute
5032 if (url && url.indexOf('http') === -1) {
5033 url = Utility.urlCombine(clusterUri, url);
5034 }
5035 return url;
5036 };
5037 Utility.getStaticResourceUri = function (path) {
5038 Utility.throwIfNullOrUndefined(path, null, "getStaticResourceUri", "path");
5039 var url = path;
5040 // Make absolute
5041 if (url && url.indexOf('http') === -1) {
5042 url = jsCommon.Utility.urlCombine(Utility.staticContentLocation, url);
5043 }
5044 return url;
5045 };
5046 Utility.getComponentName = function (context) {
5047 return !context ? '' : (typeof context).toString() + '.';
5048 };
5049 Utility.throwException = function (e) {
5050 jsCommon.Trace.error(StringExtensions.format("Throwing exception: {0}", JSON.stringify(e)),
5051 /*includeStackTrace*/ e.stack != null ? false : true);
5052 throw e;
5053 };
5054 Utility.createClassSelector = function (className) {
5055 Utility.throwIfNullOrEmptyString(className, null, 'CreateClassSelector', 'className');
5056 return '.' + className;
5057 };
5058 Utility.createIdSelector = function (id) {
5059 Utility.throwIfNullOrEmptyString(id, null, 'CreateIdSelector', 'id');
5060 return '#' + id;
5061 };
5062 /**
5063 * Creates a client-side Guid string.
5064 * @returns A string representation of a Guid.
5065 */
5066 Utility.generateGuid = function () {
5067 var guid = "", idx = 0;
5068 for (idx = 0; idx < 32; idx += 1) {
5069 var guidDigitsItem = Math.random() * 16 | 0;
5070 switch (idx) {
5071 case 8:
5072 case 12:
5073 case 16:
5074 case 20:
5075 guid += "-";
5076 break;
5077 }
5078 guid += guidDigitsItem.toString(16);
5079 }
5080 return guid;
5081 };
5082 /**
5083 * Try extract a cookie from {@link document.cookie} identified by key.
5084 */
5085 Utility.getCookieValue = function (key) {
5086 // the cookie is of the format <key1=value1>; <key2=value2>. Split by ';', then by '='
5087 // to search for the key
5088 var keyValuePairs = document.cookie.split(';');
5089 for (var i = 0; i < keyValuePairs.length; i++) {
5090 var keyValue = keyValuePairs[i];
5091 var split = keyValue.split('=');
5092 if (split.length > 0 && split[0].trim() === key) {
5093 return keyValue.substr(keyValue.indexOf('=') + 1);
5094 }
5095 }
5096 return null;
5097 };
5098 /**
5099 * Extracts the protocol://hostname section of a url.
5100 * @param url The URL from which to extract the section.
5101 * @returns The protocol://hostname portion of the given URL.
5102 */
5103 Utility.getDomainForUrl = function (url) {
5104 var hrefObject = Utility.getHrefObjectFromUrl(url);
5105 return hrefObject.prop('protocol') + '//' + hrefObject.prop('hostname');
5106 };
5107 /**
5108 * Extracts the hostname and absolute path sections of a url.
5109 * @param url The URL from which to extract the section.
5110 * @returns The hostname and absolute path portion of the given URL.
5111 */
5112 Utility.getHostNameForUrl = function (url) {
5113 var hrefObject = Utility.getHrefObjectFromUrl(url);
5114 return Utility.urlCombine(hrefObject.prop('hostname'), hrefObject.prop('pathname'));
5115 };
5116 /**
5117 * Return the original url with query string stripped.
5118 * @param url The URL from which to extract the section.
5119 * @returns the original url with query string stripped.
5120 */
5121 Utility.getUrlWithoutQueryString = function (url) {
5122 var hrefObject = Utility.getHrefObjectFromUrl(url);
5123 return hrefObject.prop('protocol') + '//' + Utility.urlCombine(hrefObject.prop('host'), hrefObject.prop('pathname'));
5124 };
5125 /**
5126 * Extracts the protocol section of a url.
5127 * @param url The URL from which to extract the section.
5128 * @returns The protocol for the current URL.
5129 */
5130 Utility.getProtocolFromUrl = function (url) {
5131 return Utility.getHrefObjectFromUrl(url).prop('protocol').replace(':', '');
5132 };
5133 /**
5134 * Returns a formatted href object from a URL.
5135 * @param url The URL used to generate the object.
5136 * @returns A jQuery object with the url.
5137 */
5138 Utility.getHrefObjectFromUrl = function (url) {
5139 var aObject = $('<a>');
5140 aObject = aObject.prop('href', url);
5141 return aObject;
5142 };
5143 /**
5144 * Converts a WCF representation of a dictionary to a JavaScript dictionary.
5145 * @param wcfDictionary The WCF dictionary to convert.
5146 * @returns The native JavaScript representation of this dictionary.
5147 */
5148 Utility.convertWcfToJsDictionary = function (wcfDictionary) {
5149 // convert the WCF JSON representation of a dictionary
5150 // to JS dictionary.
5151 // WCF representation: [{"Key": Key, "Value": Value}..]
5152 // JS representation: [Key: Value ..]
5153 var result = {};
5154 for (var i = 0; i < wcfDictionary.length; i++) {
5155 var keyValuePair = wcfDictionary[i];
5156 result[keyValuePair['Key']] = keyValuePair['Value'];
5157 }
5158 return result;
5159 };
5160 Utility.getDateFromWcfJsonString = function (jsonDate, fromUtcMilliseconds) {
5161 if (StringExtensions.isNullOrEmpty(jsonDate)) {
5162 return null;
5163 }
5164 var begIndex = jsonDate.indexOf('(');
5165 var endIndex = jsonDate.indexOf(')');
5166 if (begIndex !== -1 && endIndex !== -1) {
5167 var milliseconds = parseInt(jsonDate.substring(begIndex + 1, endIndex), 10);
5168 if (fromUtcMilliseconds) {
5169 return new Date(milliseconds);
5170 }
5171 else {
5172 var retValue = new Date(0);
5173 retValue.setUTCMilliseconds(milliseconds);
5174 return retValue;
5175 }
5176 }
5177 return null;
5178 };
5179 /**
5180 * Get the outer html of the given jquery object.
5181 * @param content The jquery object.
5182 * @returns The entire html representation of the object.
5183 */
5184 Utility.getOuterHtml = function (content) {
5185 return $('<div>').append(content).html();
5186 };
5187 /**
5188 * Comparison Method: Compares two integer numbers.
5189 * @param a An integer value.
5190 * @param b An integer value.
5191 * @returns The comparison result.
5192 */
5193 Utility.compareInt = function (a, b) {
5194 return a - b;
5195 };
5196 /**
5197 * Return the index of the smallest value in a numerical array.
5198 * @param a A numeric array.
5199 * @returns The index of the smallest value in the array.
5200 */
5201 Utility.getIndexOfMinValue = function (a) {
5202 var retValue = 0;
5203 var currentMinValue = a[0];
5204 for (var i = 0; i < a.length; i++) {
5205 if (a[i] < currentMinValue) {
5206 currentMinValue = a[i];
5207 retValue = i;
5208 }
5209 }
5210 return retValue;
5211 };
5212 /**
5213 * Extracts a url from a background image attribute in the format of: url('www.foobar.com/image.png').
5214 * @param input The value of the background-image attribute.
5215 * @returns The extracted url.
5216 */
5217 Utility.extractUrlFromCssBackgroundImage = function (input) {
5218 return input.replace(/"/g, "").replace(/url\(|\)$/ig, "");
5219 };
5220 /**
5221 * Verifies image data url of images.
5222 */
5223 Utility.isValidImageDataUrl = function (url) {
5224 var regex = new RegExp('data:(image\/(png|jpg|jpeg|gif|svg))');
5225 return regex.test(url);
5226 };
5227 Utility.isLocalUrl = function (url) {
5228 return _.startsWith(url, "data:") || _.startsWith(url, "blob:");
5229 };
5230 /**
5231 * Downloads a content string as a file.
5232 * @param content Content stream.
5233 * @param fileName File name to use.
5234 */
5235 Utility.saveAsFile = function (content, fileName) {
5236 var contentBlob = new Blob([content], { type: HttpConstants.ApplicationOctetStream });
5237 var url = window['webkitURL'] || URL;
5238 var urlLink = url.createObjectURL(contentBlob);
5239 var fileNameLink = fileName || urlLink;
5240 // IE support, use msSaveOrOpenBlob API
5241 if (window.navigator.msSaveOrOpenBlob) {
5242 window.navigator.msSaveOrOpenBlob(contentBlob, fileNameLink);
5243 return;
5244 }
5245 // WebKit-based browser support requires generating an anchor tag with
5246 // download attribute set to blob store and triggering a click event to invoke
5247 // a download to file action
5248 var hyperlink = document.createElement('a');
5249 hyperlink.href = urlLink;
5250 hyperlink.target = '_blank';
5251 hyperlink['download'] = fileNameLink;
5252 document.body.appendChild(hyperlink);
5253 hyperlink.click();
5254 document.body.removeChild(hyperlink);
5255 };
5256 /**
5257 * Helper method to get the simple type name from a typed object.
5258 * @param obj The typed object.
5259 * @returns The simple type name for the object.
5260 */
5261 Utility.getType = function (obj) {
5262 Utility.throwIfNullEmptyOrWhitespaceString(obj.__type, this, 'getType', 'obj');
5263 var parts = obj.__type.split(":");
5264 if (parts.length !== 2) {
5265 jsCommon.Errors.argument("obj.__type", "Type String not in expected format [Type]#[Namespace]: " + obj.__type);
5266 }
5267 if (parts[1] !== Utility.TypeNamespace) {
5268 jsCommon.Errors.argument("obj.__type", "Type Namespace not expected: " + parts[1]);
5269 }
5270 return parts[0];
5271 };
5272 /**
5273 * Check if an element supports a specific event type.
5274 * @param eventName The name of the event.
5275 * @param element The element to test for event support.
5276 * @returns Whether the even is supported on the provided element.
5277 */
5278 Utility.isEventSupported = function (eventName, element) {
5279 eventName = 'on' + eventName;
5280 var isSupported = (eventName in element);
5281 if (!isSupported) {
5282 // if we can't use setAttribute try a generic element
5283 if (!element.setAttribute) {
5284 element = document.createElement('div');
5285 }
5286 if (element.setAttribute && element.removeAttribute) {
5287 element.setAttribute(eventName, '');
5288 isSupported = typeof element[eventName] === 'function';
5289 // if the property was created - remove it
5290 if (typeof element[eventName] !== 'undefined') {
5291 element[eventName] = null;
5292 }
5293 element.removeAttribute(eventName);
5294 }
5295 }
5296 element = null;
5297 return isSupported;
5298 };
5299 Utility.toPixel = function (pixelAmount) {
5300 Utility.throwIfNullOrUndefined(pixelAmount, this, "toPixel", "pixelAmount");
5301 return pixelAmount.toString() + jsCommon.CssConstants.pixelUnits;
5302 };
5303 Utility.getPropertyCount = function (object) {
5304 Utility.throwIfNullOrUndefined(object, this, "getPropertyCount", "object");
5305 return Object.getOwnPropertyNames(object).length;
5306 };
5307 /**
5308 * Check if an element supports a specific event type.
5309 * @param filePath File path.
5310 * @returns File extension.
5311 */
5312 Utility.getFileExtension = function (filePath) {
5313 if (filePath) {
5314 var index = filePath.lastIndexOf('.');
5315 if (index >= 0)
5316 return filePath.substr(index + 1);
5317 }
5318 return '';
5319 };
5320 /**
5321 * Extract the filename out of a full path delimited by '\' or '/'.
5322 * @param filePath File path.
5323 * @returns filename File name.
5324 */
5325 Utility.extractFileNameFromPath = function (filePath) {
5326 return filePath.replace(/^.*[\\\/]/, '');
5327 };
5328 /**
5329 * This method indicates whether window.clipboardData is supported.
5330 * For example, clipboard support for Windows Store apps is currently disabled
5331 * since window.clipboardData is unsupported (it raises access denied error)
5332 * since clipboard in Windows Store is being
5333 * achieved through Windows.ApplicationModel.DataTransfer.Clipboard class.
5334 */
5335 Utility.canUseClipboard = function () {
5336 return (typeof MSApp === "undefined");
5337 };
5338 Utility.is64BitOperatingSystem = function () {
5339 return navigator.userAgent.indexOf("WOW64") !== -1 ||
5340 navigator.userAgent.indexOf("Win64") !== -1;
5341 };
5342 Utility.parseNumber = function (value, defaultValue) {
5343 if (value === null)
5344 return null;
5345 if (value === undefined)
5346 return defaultValue;
5347 var result = Number(value);
5348 if (isFinite(result))
5349 return result;
5350 if (isNaN(result) && !(typeof value === "number" || value === "NaN"))
5351 return defaultValue;
5352 return result;
5353 };
5354 Utility.getURLParamValue = function (name) {
5355 var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
5356 if (results == null) {
5357 return null;
5358 }
5359 else {
5360 return results[1] || 0;
5361 }
5362 };
5363 /**
5364 * Return local timezone.
5365 * This function uses summer and winter offset to determine local time zone.
5366 * The result localTimeZoneString must be a subset of the strings used by server,
5367 * as documented here: https://msdn.microsoft.com/en-us/library/gg154758.aspx (Dynamic Daylight Savings Time (Compact 2013)).
5368 * @return Local timezone string or UTC if timezone cannot be found.
5369 */
5370 Utility.getLocalTimeZoneString = function () {
5371 var timeSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0));
5372 var summerOffset = -1 * timeSummer.getTimezoneOffset();
5373 var timeWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0));
5374 var winterOffset = -1 * timeWinter.getTimezoneOffset();
5375 var localTimeZoneString;
5376 if (-720 === summerOffset && -720 === winterOffset) {
5377 localTimeZoneString = 'Dateline Standard Time';
5378 }
5379 else if (-660 === summerOffset && -660 === winterOffset) {
5380 localTimeZoneString = 'UTC-11';
5381 }
5382 else if (-660 === summerOffset && -660 === winterOffset) {
5383 localTimeZoneString = 'Samoa Standard Time';
5384 }
5385 else if (-600 === summerOffset && -600 === winterOffset) {
5386 localTimeZoneString = 'Hawaiian Standard Time';
5387 }
5388 else if (-480 === summerOffset && -540 === winterOffset) {
5389 localTimeZoneString = 'Alaskan Standard Time';
5390 }
5391 else if (-420 === summerOffset && -480 === winterOffset) {
5392 localTimeZoneString = 'Pacific Standard Time';
5393 }
5394 else if (-420 === summerOffset && -420 === winterOffset) {
5395 localTimeZoneString = 'US Mountain Standard Time';
5396 }
5397 else if (-360 === summerOffset && -420 === winterOffset) {
5398 localTimeZoneString = 'Mountain Standard Time';
5399 }
5400 else if (-360 === summerOffset && -360 === winterOffset) {
5401 localTimeZoneString = 'Central America Standard Time';
5402 }
5403 else if (-300 === summerOffset && -360 === winterOffset) {
5404 localTimeZoneString = 'Central Standard Time';
5405 }
5406 else if (-300 === summerOffset && -300 === winterOffset) {
5407 localTimeZoneString = 'SA Pacific Standard Time';
5408 }
5409 else if (-240 === summerOffset && -300 === winterOffset) {
5410 localTimeZoneString = 'Eastern Standard Time';
5411 }
5412 else if (-270 === summerOffset && -270 === winterOffset) {
5413 localTimeZoneString = 'Venezuela Standard Time';
5414 }
5415 else if (-240 === summerOffset && -240 === winterOffset) {
5416 localTimeZoneString = 'SA Western Standard Time';
5417 }
5418 else if (-240 === summerOffset && -180 === winterOffset) {
5419 localTimeZoneString = 'Central Brazilian Standard Time';
5420 }
5421 else if (-180 === summerOffset && -240 === winterOffset) {
5422 localTimeZoneString = 'Atlantic Standard Time';
5423 }
5424 else if (-180 === summerOffset && -180 === winterOffset) {
5425 localTimeZoneString = 'Montevideo Standard Time';
5426 }
5427 else if (-180 === summerOffset && -120 === winterOffset) {
5428 localTimeZoneString = 'E. South America Standard Time';
5429 }
5430 else if (-150 === summerOffset && -210 === winterOffset) {
5431 localTimeZoneString = 'Mid-Atlantic Standard Time';
5432 }
5433 else if (-120 === summerOffset && -120 === winterOffset) {
5434 localTimeZoneString = 'SA Eastern Standard Time';
5435 }
5436 else if (0 === summerOffset && 0 === winterOffset) {
5437 localTimeZoneString = 'UTC';
5438 }
5439 else if (60 === summerOffset && 0 === winterOffset) {
5440 localTimeZoneString = 'GMT Standard Time';
5441 }
5442 else if (60 === summerOffset && 120 === winterOffset) {
5443 localTimeZoneString = 'Namibia Standard Time';
5444 }
5445 else if (120 === summerOffset && 60 === winterOffset) {
5446 localTimeZoneString = 'Romance Standard Time';
5447 }
5448 else if (120 === summerOffset && 120 === winterOffset) {
5449 localTimeZoneString = 'South Africa Standard Time';
5450 }
5451 else if (180 === summerOffset && 120 === winterOffset) {
5452 localTimeZoneString = 'GTB Standard Time';
5453 }
5454 else if (180 === summerOffset && 180 === winterOffset) {
5455 localTimeZoneString = 'E. Africa Standard Time';
5456 }
5457 else if (240 === summerOffset && 180 === winterOffset) {
5458 localTimeZoneString = 'Russian Standard Time';
5459 }
5460 else if (240 === summerOffset && 240 === winterOffset) {
5461 localTimeZoneString = 'Arabian Standard Time';
5462 }
5463 else if (270 === summerOffset && 210 === winterOffset) {
5464 localTimeZoneString = 'Iran Standard Time';
5465 }
5466 else if (270 === summerOffset && 270 === winterOffset) {
5467 localTimeZoneString = 'Afghanistan Standard Time';
5468 }
5469 else if (300 === summerOffset && 240 === winterOffset) {
5470 localTimeZoneString = 'Pakistan Standard Time';
5471 }
5472 else if (300 === summerOffset && 300 === winterOffset) {
5473 localTimeZoneString = 'West Asia Standard Time';
5474 }
5475 else if (330 === summerOffset && 330 === winterOffset) {
5476 localTimeZoneString = 'India Standard Time';
5477 }
5478 else if (345 === summerOffset && 345 === winterOffset) {
5479 localTimeZoneString = 'Nepal Standard Time';
5480 }
5481 else if (360 === summerOffset && 300 === winterOffset) {
5482 localTimeZoneString = 'N. Central Asia Standard Time';
5483 }
5484 else if (360 === summerOffset && 360 === winterOffset) {
5485 localTimeZoneString = 'Central Asia Standard Time';
5486 }
5487 else if (390 === summerOffset && 390 === winterOffset) {
5488 localTimeZoneString = 'Myanmar Standard Time';
5489 }
5490 else if (420 === summerOffset && 360 === winterOffset) {
5491 localTimeZoneString = 'North Asia Standard Time';
5492 }
5493 else if (420 === summerOffset && 420 === winterOffset) {
5494 localTimeZoneString = 'SE Asia Standard Time';
5495 }
5496 else if (480 === summerOffset && 420 === winterOffset) {
5497 localTimeZoneString = 'North Asia East Standard Time';
5498 }
5499 else if (480 === summerOffset && 480 === winterOffset) {
5500 localTimeZoneString = 'China Standard Time';
5501 }
5502 else if (540 === summerOffset && 480 === winterOffset) {
5503 localTimeZoneString = 'Yakutsk Standard Time';
5504 }
5505 else if (540 === summerOffset && 540 === winterOffset) {
5506 localTimeZoneString = 'Tokyo Standard Time';
5507 }
5508 else if (570 === summerOffset && 570 === winterOffset) {
5509 localTimeZoneString = 'Cen. Australia Standard Time';
5510 }
5511 else if (600 === summerOffset && 600 === winterOffset) {
5512 localTimeZoneString = 'E. Australia Standard Time';
5513 }
5514 else if (600 === summerOffset && 660 === winterOffset) {
5515 localTimeZoneString = 'AUS Eastern Standard Time';
5516 }
5517 else if (660 === summerOffset && 600 === winterOffset) {
5518 localTimeZoneString = 'Tasmania Standard Time';
5519 }
5520 else if (660 === summerOffset && 660 === winterOffset) {
5521 localTimeZoneString = 'West Pacific Standard Time';
5522 }
5523 else if (690 === summerOffset && 690 === winterOffset) {
5524 localTimeZoneString = 'Central Pacific Standard Time';
5525 }
5526 else if (720 === summerOffset && 660 === winterOffset) {
5527 localTimeZoneString = 'Magadan Standard Time';
5528 }
5529 else if (720 === summerOffset && 720 === winterOffset) {
5530 localTimeZoneString = 'Fiji Standard Time';
5531 }
5532 else if (720 === summerOffset && 780 === winterOffset) {
5533 localTimeZoneString = 'New Zealand Standard Time';
5534 }
5535 else if (780 === summerOffset && 780 === winterOffset) {
5536 localTimeZoneString = 'Tonga Standard Time';
5537 }
5538 else {
5539 localTimeZoneString = 'UTC';
5540 }
5541 return localTimeZoneString;
5542 };
5543 Utility.TypeNamespace = 'http://schemas.microsoft.com/sqlbi/2013/01/NLRuntimeService';
5544 Utility.JsonContentType = 'application/json';
5545 Utility.JpegContentType = 'image/jpeg';
5546 Utility.XJavascriptContentType = 'application/x-javascript';
5547 Utility.JsonDataType = 'json';
5548 Utility.BlobDataType = 'blob';
5549 Utility.HttpGetMethod = 'GET';
5550 Utility.HttpPostMethod = 'POST';
5551 Utility.HttpPutMethod = 'PUT';
5552 Utility.HttpDeleteMethod = 'DELETE';
5553 Utility.HttpContentTypeHeader = 'Content-Type';
5554 Utility.HttpAcceptHeader = 'Accept';
5555 Utility.Undefined = 'undefined';
5556 Utility.staticContentLocation = window.location.protocol + '//' + window.location.host;
5557 return Utility;
5558 }());
5559 jsCommon.Utility = Utility;
5560 var VersionUtility = (function () {
5561 function VersionUtility() {
5562 }
5563 /**
5564 * Compares 2 version strings.
5565 * @param versionA The first version string.
5566 * @param versionB The second version string.
5567 * @returns A result for the comparison.
5568 */
5569 VersionUtility.compareVersions = function (versionA, versionB) {
5570 var a = versionA.split('.').map(parseFloat);
5571 var b = versionB.split('.').map(parseFloat);
5572 var versionParts = Math.max(a.length, b.length);
5573 for (var i = 0; i < versionParts; i++) {
5574 var partA = a[i] || 0;
5575 var partB = b[i] || 0;
5576 if (partA > partB)
5577 return 1;
5578 if (partA < partB)
5579 return -1;
5580 }
5581 return 0;
5582 };
5583 return VersionUtility;
5584 }());
5585 jsCommon.VersionUtility = VersionUtility;
5586 var PerformanceUtil;
5587 (function (PerformanceUtil) {
5588 var PerfMarker = (function () {
5589 function PerfMarker(name) {
5590 this._name = name;
5591 this._start = PerfMarker.begin(name);
5592 }
5593 PerfMarker.begin = function (name) {
5594 if (window.performance === undefined || performance.mark === undefined)
5595 return;
5596 if (console.time) {
5597 console.time(name);
5598 }
5599 name = 'Begin ' + name;
5600 performance.mark(name);
5601 return name;
5602 };
5603 PerfMarker.prototype.end = function () {
5604 if (window.performance === undefined || performance.mark === undefined || performance.measure === undefined)
5605 return;
5606 var name = this._name;
5607 var end = 'End ' + name;
5608 performance.mark(end);
5609 performance.measure(name, this._start, end);
5610 if (console.timeEnd) {
5611 console.timeEnd(name);
5612 }
5613 };
5614 return PerfMarker;
5615 }());
5616 PerformanceUtil.PerfMarker = PerfMarker;
5617 function create(name) {
5618 return new PerfMarker(name);
5619 }
5620 PerformanceUtil.create = create;
5621 })(PerformanceUtil = jsCommon.PerformanceUtil || (jsCommon.PerformanceUtil = {}));
5622 var DeferUtility;
5623 (function (DeferUtility) {
5624 /**
5625 * Wraps a callback and returns a new function.
5626 * The function can be called many times but the callback
5627 * will only be executed once on the next frame.
5628 * Use this to throttle big UI updates and access to DOM.
5629 */
5630 function deferUntilNextFrame(callback) {
5631 var isWaiting, args, context;
5632 if (!window.requestAnimationFrame) {
5633 window.requestAnimationFrame = function (func) { return setTimeout(func, 1000 / 50); };
5634 }
5635 return function () {
5636 if (!isWaiting) {
5637 isWaiting = true;
5638 args = arguments;
5639 context = this;
5640 window.requestAnimationFrame(function () {
5641 isWaiting = false;
5642 callback.apply(context, args);
5643 });
5644 }
5645 };
5646 }
5647 DeferUtility.deferUntilNextFrame = deferUntilNextFrame;
5648 })(DeferUtility = jsCommon.DeferUtility || (jsCommon.DeferUtility = {}));
5649 })(jsCommon || (jsCommon = {}));
5650
5651
5652
5653/***/ },
5654
5655/***/ 294:
5656/***/ function(module, exports) {
5657
5658 /*** IMPORTS FROM imports-loader ***/
5659 var jsCommon = window.jsCommon;
5660 var powerbi = window.powerbi;
5661 var powerbitests = window.powerbitests;
5662 var InJs = window.InJs;
5663 var debug = window.debug;
5664 var jasmine = window.jasmine;
5665 var Microsoft = window.Microsoft;
5666
5667 /*
5668 * Power BI Visualizations
5669 *
5670 * Copyright (c) Microsoft Corporation
5671 * All rights reserved.
5672 * MIT License
5673 *
5674 * Permission is hereby granted, free of charge, to any person obtaining a copy
5675 * of this software and associated documentation files (the ""Software""), to deal
5676 * in the Software without restriction, including without limitation the rights
5677 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5678 * copies of the Software, and to permit persons to whom the Software is
5679 * furnished to do so, subject to the following conditions:
5680 *
5681 * The above copyright notice and this permission notice shall be included in
5682 * all copies or substantial portions of the Software.
5683 *
5684 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5685 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5686 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5687 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5688 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5689 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5690 * THE SOFTWARE.
5691 */
5692 /// <reference path="../_references.ts"/>
5693 var jsCommon;
5694 (function (jsCommon) {
5695 var TraceItem = (function () {
5696 function TraceItem(text, type, sessionId, requestId) {
5697 this.text = text;
5698 this.type = type;
5699 this.sessionId = sessionId;
5700 this.requestId = requestId;
5701 this.timeStamp = new Date();
5702 }
5703 TraceItem.prototype.toString = function () {
5704 var resultString = '';
5705 resultString += (jsCommon.StringExtensions.format('{0} ({1}): {2}', TraceItem.traceTypeStrings[this.type], this.timeStamp.toUTCString(), this.text));
5706 if (this.requestId)
5707 resultString += ('\n(Request id: ' + this.requestId + ')');
5708 return resultString;
5709 };
5710 TraceItem.traceTypeStrings = [
5711 'INFORMATION',
5712 'VERBOSE',
5713 'WARNING',
5714 'ERROR',
5715 'EXPECTEDERROR',
5716 'UNEXPECTEDERROR',
5717 'FATAL',
5718 ];
5719 return TraceItem;
5720 }());
5721 jsCommon.TraceItem = TraceItem;
5722 })(jsCommon || (jsCommon = {}));
5723
5724
5725
5726/***/ },
5727
5728/***/ 295:
5729/***/ function(module, exports) {
5730
5731 /*** IMPORTS FROM imports-loader ***/
5732 var jsCommon = window.jsCommon;
5733 var powerbi = window.powerbi;
5734 var powerbitests = window.powerbitests;
5735 var InJs = window.InJs;
5736 var debug = window.debug;
5737 var jasmine = window.jasmine;
5738 var Microsoft = window.Microsoft;
5739
5740 /*
5741 * Power BI Visualizations
5742 *
5743 * Copyright (c) Microsoft Corporation
5744 * All rights reserved.
5745 * MIT License
5746 *
5747 * Permission is hereby granted, free of charge, to any person obtaining a copy
5748 * of this software and associated documentation files (the ""Software""), to deal
5749 * in the Software without restriction, including without limitation the rights
5750 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5751 * copies of the Software, and to permit persons to whom the Software is
5752 * furnished to do so, subject to the following conditions:
5753 *
5754 * The above copyright notice and this permission notice shall be included in
5755 * all copies or substantial portions of the Software.
5756 *
5757 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5758 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5759 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5760 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5761 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5762 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5763 * THE SOFTWARE.
5764 */
5765 /// <reference path="../_references.ts"/>
5766 var jsCommon;
5767 (function (jsCommon) {
5768 var UrlUtils;
5769 (function (UrlUtils) {
5770 var urlRegex = /http[s]?:\/\/(\S)+/gi;
5771 function isValidUrl(value) {
5772 if (jsCommon.StringExtensions.isNullOrEmpty(value))
5773 return false;
5774 var match = jsCommon.RegExpExtensions.run(urlRegex, value);
5775 if (!!match && match.index === 0)
5776 return true;
5777 return false;
5778 }
5779 UrlUtils.isValidUrl = isValidUrl;
5780 /* Tests whether a URL is valid.
5781 * @param url The url to be tested.
5782 * @returns Whether the provided url is valid.
5783 **/
5784 function isValidImageUrl(url) {
5785 // VSTS: 7252099 / 7112236
5786 // For now, passes for any valid Url
5787 return isValidUrl(url);
5788 }
5789 UrlUtils.isValidImageUrl = isValidImageUrl;
5790 function findAllValidUrls(text) {
5791 if (jsCommon.StringExtensions.isNullOrEmpty(text))
5792 return [];
5793 // Find all urls in the text.
5794 // TODO: This could potentially be expensive, maybe include a cap here for text with many urls?
5795 var urlRanges = [];
5796 var matches;
5797 var start = 0;
5798 while ((matches = jsCommon.RegExpExtensions.run(urlRegex, text, start)) !== null) {
5799 var url = matches[0];
5800 var end = matches.index + url.length;
5801 urlRanges.push({
5802 start: matches.index,
5803 end: end,
5804 text: url,
5805 });
5806 start = end;
5807 }
5808 return urlRanges;
5809 }
5810 UrlUtils.findAllValidUrls = findAllValidUrls;
5811 function getBase64ContentFromDataUri(uri) {
5812 if (uri.indexOf('data:') !== 0)
5813 throw new Error("Expected data uri");
5814 // Locate the base 64 content from the URL (e.g. "data:image/png;base64,xxxxx=")
5815 var base64Token = ";base64,";
5816 var indexBase64TokenStart = uri.indexOf(base64Token);
5817 if (indexBase64TokenStart < 0)
5818 throw new Error("Expected base 64 content in data url");
5819 var indexBase64Start = indexBase64TokenStart + base64Token.length;
5820 return uri.substr(indexBase64Start, uri.length - indexBase64Start);
5821 }
5822 UrlUtils.getBase64ContentFromDataUri = getBase64ContentFromDataUri;
5823 })(UrlUtils = jsCommon.UrlUtils || (jsCommon.UrlUtils = {}));
5824 })(jsCommon || (jsCommon = {}));
5825
5826
5827
5828/***/ },
5829
5830/***/ 296:
5831/***/ function(module, exports) {
5832
5833 /*** IMPORTS FROM imports-loader ***/
5834 var jsCommon = window.jsCommon;
5835 var powerbi = window.powerbi;
5836 var powerbitests = window.powerbitests;
5837 var InJs = window.InJs;
5838 var debug = window.debug;
5839 var jasmine = window.jasmine;
5840 var Microsoft = window.Microsoft;
5841
5842 /*
5843 * Power BI Visualizations
5844 *
5845 * Copyright (c) Microsoft Corporation
5846 * All rights reserved.
5847 * MIT License
5848 *
5849 * Permission is hereby granted, free of charge, to any person obtaining a copy
5850 * of this software and associated documentation files (the ""Software""), to deal
5851 * in the Software without restriction, including without limitation the rights
5852 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5853 * copies of the Software, and to permit persons to whom the Software is
5854 * furnished to do so, subject to the following conditions:
5855 *
5856 * The above copyright notice and this permission notice shall be included in
5857 * all copies or substantial portions of the Software.
5858 *
5859 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5860 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5861 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5862 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5863 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5864 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5865 * THE SOFTWARE.
5866 */
5867 /// <reference path="../_references.ts"/>
5868 var jsCommon;
5869 (function (jsCommon) {
5870 var BrowserUtils;
5871 (function (BrowserUtils) {
5872 function isChrome() {
5873 var vendorName = window.navigator.vendor || "";
5874 var userAgent = window.navigator.userAgent.toLowerCase();
5875 return vendorName.toLowerCase().indexOf('google') > -1 &&
5876 userAgent.indexOf('chrome') > -1 &&
5877 userAgent.indexOf('edge') === -1 &&
5878 userAgent.indexOf('opr') === -1;
5879 }
5880 BrowserUtils.isChrome = isChrome;
5881 function isInternetExplorerOrEdge() {
5882 var userAgent = window.navigator.userAgent.toLowerCase();
5883 return userAgent.indexOf('msie') > -1
5884 || userAgent.indexOf('trident') > -1
5885 || userAgent.indexOf('edge') > -1;
5886 }
5887 BrowserUtils.isInternetExplorerOrEdge = isInternetExplorerOrEdge;
5888 /**
5889 * Get the current version of IE
5890 * @returns The version of Internet Explorer or a 0 (indicating the use of another browser).
5891 */
5892 function getInternetExplorerVersion() {
5893 var retValue = 0;
5894 if (navigator.appName === 'Microsoft Internet Explorer' || window.navigator.userAgent.indexOf('MSIE') >= 0) {
5895 var re = new RegExp('MSIE ([0-9]{1,}[\\.0-9]{0,})');
5896 var result = re.exec(window.navigator.userAgent);
5897 if (result) {
5898 retValue = parseFloat(result[1]);
5899 }
5900 }
5901 return retValue;
5902 }
5903 BrowserUtils.getInternetExplorerVersion = getInternetExplorerVersion;
5904 function isFirefox() {
5905 return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
5906 }
5907 BrowserUtils.isFirefox = isFirefox;
5908 })(BrowserUtils = jsCommon.BrowserUtils || (jsCommon.BrowserUtils = {}));
5909 })(jsCommon || (jsCommon = {}));
5910
5911
5912
5913/***/ },
5914
5915/***/ 297:
5916/***/ function(module, exports) {
5917
5918 /*** IMPORTS FROM imports-loader ***/
5919 var jsCommon = window.jsCommon;
5920 var powerbi = window.powerbi;
5921 var powerbitests = window.powerbitests;
5922 var InJs = window.InJs;
5923 var debug = window.debug;
5924 var jasmine = window.jasmine;
5925 var Microsoft = window.Microsoft;
5926
5927 /*
5928 * Power BI Visualizations
5929 *
5930 * Copyright (c) Microsoft Corporation
5931 * All rights reserved.
5932 * MIT License
5933 *
5934 * Permission is hereby granted, free of charge, to any person obtaining a copy
5935 * of this software and associated documentation files (the ""Software""), to deal
5936 * in the Software without restriction, including without limitation the rights
5937 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5938 * copies of the Software, and to permit persons to whom the Software is
5939 * furnished to do so, subject to the following conditions:
5940 *
5941 * The above copyright notice and this permission notice shall be included in
5942 * all copies or substantial portions of the Software.
5943 *
5944 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5945 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5946 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5947 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5948 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5949 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5950 * THE SOFTWARE.
5951 */
5952 /// <reference path="../_references.ts"/>
5953 var jsCommon;
5954 (function (jsCommon) {
5955 /**
5956 * Extensions for Enumerations.
5957 */
5958 var EnumExtensions;
5959 (function (EnumExtensions) {
5960 /**
5961 * Gets a value indicating whether the value has the bit flags set.
5962 */
5963 function hasFlag(value, flag) {
5964 debug.assert(!!flag, 'flag must be specified and nonzero.');
5965 return (value & flag) === flag;
5966 }
5967 EnumExtensions.hasFlag = hasFlag;
5968 /**
5969 * Sets a value of a flag without modifying any other flags.
5970 */
5971 function setFlag(value, flag) {
5972 debug.assert(!!flag, "flag must be specified and nonzero.");
5973 return value |= flag;
5974 }
5975 EnumExtensions.setFlag = setFlag;
5976 /**
5977 * Resets a value of a flag without modifying any other flags.
5978 */
5979 function resetFlag(value, flag) {
5980 debug.assert(!!flag, "flag must be specified and nonzero.");
5981 return value &= ~flag;
5982 }
5983 EnumExtensions.resetFlag = resetFlag;
5984 /**
5985 * According to the TypeScript Handbook, this is safe to do.
5986 */
5987 function toString(enumType, value) {
5988 return enumType[value];
5989 }
5990 EnumExtensions.toString = toString;
5991 })(EnumExtensions = jsCommon.EnumExtensions || (jsCommon.EnumExtensions = {}));
5992 /**
5993 * Extensions to String class.
5994 */
5995 var StringExtensions;
5996 (function (StringExtensions) {
5997 /**
5998 * Checks if a string ends with a sub-string.
5999 */
6000 function endsWith(str, suffix) {
6001 debug.assertValue(str, 'str');
6002 debug.assertValue(suffix, 'suffix');
6003 return str.indexOf(suffix, str.length - suffix.length) !== -1;
6004 }
6005 StringExtensions.endsWith = endsWith;
6006 })(StringExtensions = jsCommon.StringExtensions || (jsCommon.StringExtensions = {}));
6007 var LogicExtensions;
6008 (function (LogicExtensions) {
6009 function XOR(a, b) {
6010 return (a || b) && !(a && b);
6011 }
6012 LogicExtensions.XOR = XOR;
6013 })(LogicExtensions = jsCommon.LogicExtensions || (jsCommon.LogicExtensions = {}));
6014 var JsonComparer;
6015 (function (JsonComparer) {
6016 /**
6017 * Performs JSON-style comparison of two objects.
6018 */
6019 function equals(x, y) {
6020 if (x === y)
6021 return true;
6022 return JSON.stringify(x) === JSON.stringify(y);
6023 }
6024 JsonComparer.equals = equals;
6025 })(JsonComparer = jsCommon.JsonComparer || (jsCommon.JsonComparer = {}));
6026 /**
6027 * Values are in terms of 'pt'
6028 * Convert to pixels using PixelConverter.fromPoint
6029 */
6030 var TextSizeDefaults;
6031 (function (TextSizeDefaults) {
6032 /**
6033 * Stored in terms of 'pt'
6034 * Convert to pixels using PixelConverter.fromPoint
6035 */
6036 TextSizeDefaults.TextSizeMin = 8;
6037 /**
6038 * Stored in terms of 'pt'
6039 * Convert to pixels using PixelConverter.fromPoint
6040 */
6041 TextSizeDefaults.TextSizeMax = 40;
6042 var TextSizeRange = TextSizeDefaults.TextSizeMax - TextSizeDefaults.TextSizeMin;
6043 /**
6044 * Returns the percentage of this value relative to the TextSizeMax
6045 * @param textSize - should be given in terms of 'pt'
6046 */
6047 function getScale(textSize) {
6048 return (textSize - TextSizeDefaults.TextSizeMin) / TextSizeRange;
6049 }
6050 TextSizeDefaults.getScale = getScale;
6051 })(TextSizeDefaults = jsCommon.TextSizeDefaults || (jsCommon.TextSizeDefaults = {}));
6052 var PixelConverter;
6053 (function (PixelConverter) {
6054 var PxPtRatio = 4 / 3;
6055 var PixelString = 'px';
6056 /**
6057 * Appends 'px' to the end of number value for use as pixel string in styles
6058 */
6059 function toString(px) {
6060 return px + PixelString;
6061 }
6062 PixelConverter.toString = toString;
6063 /**
6064 * Converts point value (pt) to pixels
6065 * Returns a string for font-size property
6066 * e.g. fromPoint(8) => '24px'
6067 */
6068 function fromPoint(pt) {
6069 return toString(fromPointToPixel(pt));
6070 }
6071 PixelConverter.fromPoint = fromPoint;
6072 /**
6073 * Converts point value (pt) to pixels
6074 * Returns a number for font-size property
6075 * e.g. fromPoint(8) => 24px
6076 */
6077 function fromPointToPixel(pt) {
6078 return (PxPtRatio * pt);
6079 }
6080 PixelConverter.fromPointToPixel = fromPointToPixel;
6081 /**
6082 * Converts pixel value (px) to pt
6083 * e.g. toPoint(24) => 8
6084 */
6085 function toPoint(px) {
6086 return px / PxPtRatio;
6087 }
6088 PixelConverter.toPoint = toPoint;
6089 })(PixelConverter = jsCommon.PixelConverter || (jsCommon.PixelConverter = {}));
6090 var RegExpExtensions;
6091 (function (RegExpExtensions) {
6092 /**
6093 * Runs exec on regex starting from 0 index
6094 * This is the expected behavior but RegExp actually remember
6095 * the last index they stopped at (found match at) and will
6096 * return unexpected results when run in sequence.
6097 * @param regex - regular expression object
6098 * @param value - string to search wiht regex
6099 * @param start - index within value to start regex
6100 */
6101 function run(regex, value, start) {
6102 debug.assertValue(regex, 'regex');
6103 regex.lastIndex = start || 0;
6104 return regex.exec(value);
6105 }
6106 RegExpExtensions.run = run;
6107 })(RegExpExtensions = jsCommon.RegExpExtensions || (jsCommon.RegExpExtensions = {}));
6108 })(jsCommon || (jsCommon = {}));
6109
6110
6111
6112/***/ },
6113
6114/***/ 298:
6115/***/ function(module, exports) {
6116
6117 /*** IMPORTS FROM imports-loader ***/
6118 var jsCommon = window.jsCommon;
6119 var powerbi = window.powerbi;
6120 var powerbitests = window.powerbitests;
6121 var InJs = window.InJs;
6122 var debug = window.debug;
6123 var jasmine = window.jasmine;
6124 var Microsoft = window.Microsoft;
6125
6126 /*
6127 * Power BI Visualizations
6128 *
6129 * Copyright (c) Microsoft Corporation
6130 * All rights reserved.
6131 * MIT License
6132 *
6133 * Permission is hereby granted, free of charge, to any person obtaining a copy
6134 * of this software and associated documentation files (the ""Software""), to deal
6135 * in the Software without restriction, including without limitation the rights
6136 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6137 * copies of the Software, and to permit persons to whom the Software is
6138 * furnished to do so, subject to the following conditions:
6139 *
6140 * The above copyright notice and this permission notice shall be included in
6141 * all copies or substantial portions of the Software.
6142 *
6143 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6144 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6145 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6146 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6147 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6148 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6149 * THE SOFTWARE.
6150 */
6151 /// <reference path="../_references.ts"/>
6152 var powerbi;
6153 (function (powerbi) {
6154 var visuals;
6155 (function (visuals) {
6156 var utility;
6157 (function (utility) {
6158 var StyleUtils;
6159 (function (StyleUtils) {
6160 function getRotateAngleFromElement(element) {
6161 var rawElemStyle = element.get(0).style;
6162 var transformString = rawElemStyle.transform || rawElemStyle.webkitTransform;
6163 if (transformString) {
6164 var transform = transformString.match(/rotate\((-?\d+(?:\.\d*)?)deg\)/);
6165 if (transform) {
6166 return parseFloat(transform[1]);
6167 }
6168 }
6169 return 0;
6170 }
6171 StyleUtils.getRotateAngleFromElement = getRotateAngleFromElement;
6172 function getTranslateTransformFromElement(element) {
6173 var rawElemStyle = element.get(0).style;
6174 // IE will recognize "webkitTransform" as "WebkitTransform" and set that as style property.
6175 // This means transform property is not read.
6176 // We put the "transform" before the "webkitTransform" to counteract the weirdness of IE.
6177 var transformString = rawElemStyle.transform || rawElemStyle.webkitTransform;
6178 var retValue = { x: 0, y: 0 };
6179 if (transformString && transformString.length > 0) {
6180 var transform = transformString.match(/translate\((-?\d+(?:\.\d*)?)px, (-?\d+(?:\.\d*)?)px\)/);
6181 if (transform) {
6182 retValue.x = parseFloat(transform[1]);
6183 retValue.y = parseFloat(transform[2]);
6184 }
6185 }
6186 return retValue;
6187 }
6188 StyleUtils.getTranslateTransformFromElement = getTranslateTransformFromElement;
6189 function getPadding(element) {
6190 if (!element)
6191 return;
6192 return {
6193 left: parseFloat(element.css('padding-left')) || 0,
6194 right: parseFloat(element.css('padding-right')) || 0,
6195 top: parseFloat(element.css('padding-top')) || 0,
6196 bottom: parseFloat(element.css('padding-bottom')) || 0,
6197 };
6198 }
6199 StyleUtils.getPadding = getPadding;
6200 })(StyleUtils = utility.StyleUtils || (utility.StyleUtils = {}));
6201 })(utility = visuals.utility || (visuals.utility = {}));
6202 })(visuals = powerbi.visuals || (powerbi.visuals = {}));
6203 })(powerbi || (powerbi = {}));
6204
6205
6206
6207/***/ },
6208
6209/***/ 299:
6210/***/ function(module, exports, __webpack_require__) {
6211
6212 /*** IMPORTS FROM imports-loader ***/
6213 var jsCommon = window.jsCommon;
6214 var powerbi = window.powerbi;
6215 var powerbitests = window.powerbitests;
6216 var InJs = window.InJs;
6217 var debug = window.debug;
6218 var jasmine = window.jasmine;
6219 var Microsoft = window.Microsoft;
6220
6221 /*
6222 * Power BI Visualizations
6223 *
6224 * Copyright (c) Microsoft Corporation
6225 * All rights reserved.
6226 * MIT License
6227 *
6228 * Permission is hereby granted, free of charge, to any person obtaining a copy
6229 * of this software and associated documentation files (the ""Software""), to deal
6230 * in the Software without restriction, including without limitation the rights
6231 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6232 * copies of the Software, and to permit persons to whom the Software is
6233 * furnished to do so, subject to the following conditions:
6234 *
6235 * The above copyright notice and this permission notice shall be included in
6236 * all copies or substantial portions of the Software.
6237 *
6238 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6239 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6240 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6241 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6242 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6243 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6244 * THE SOFTWARE.
6245 */
6246 /// <reference path="../_references.ts"/>
6247 var jsCommon;
6248 (function (jsCommon) {
6249 var ConsoleTracer = (function () {
6250 function ConsoleTracer() {
6251 }
6252 ConsoleTracer.prototype.logTrace = function (trace) {
6253 if (true) {
6254 switch (trace.type) {
6255 case jsCommon.TraceType.Information:
6256 console.info(trace.toString());
6257 break;
6258 case jsCommon.TraceType.UnexpectedError:
6259 case jsCommon.TraceType.Error:
6260 case jsCommon.TraceType.Fatal:
6261 console.error(trace.toString());
6262 break;
6263 case jsCommon.TraceType.ExpectedError:
6264 case jsCommon.TraceType.Warning:
6265 console.warn(trace.toString());
6266 break;
6267 case jsCommon.TraceType.Verbose:
6268 console.log(trace.toString());
6269 break;
6270 default:
6271 console.log(trace.toString());
6272 break;
6273 }
6274 }
6275 };
6276 return ConsoleTracer;
6277 }());
6278 jsCommon.ConsoleTracer = ConsoleTracer;
6279 var Trace;
6280 (function (Trace) {
6281 var traceMaxCount = 1000;
6282 var traces = new Array(traceMaxCount);
6283 var lastTraceIndex = -1;
6284 var defaultListener = new ConsoleTracer();
6285 var listeners = new Array(defaultListener);
6286 /**
6287 * Trace a warning. Please ensure that no PII is being logged.
6288 */
6289 function warning(text, requestId) {
6290 debug.assertValue(text, 'text');
6291 logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Warning, requestId));
6292 }
6293 Trace.warning = warning;
6294 /**
6295 * Trace an error. Please ensure that no PII is being logged.
6296 */
6297 function error(text, includeStackTrace, requestId) {
6298 debug.assertValue(text, 'text');
6299 if (includeStackTrace)
6300 text = jsCommon.StringExtensions.format("{0}.\nStack:\n{1}", text, jsCommon.getStackTrace());
6301 logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Error, requestId));
6302 }
6303 Trace.error = error;
6304 /**
6305 * Trace an information. Please ensure that no PII is being logged.
6306 */
6307 function verbose(text, requestId) {
6308 debug.assertValue(text, 'text');
6309 logTraceInternal(new jsCommon.TraceItem(text, jsCommon.TraceType.Verbose, requestId));
6310 }
6311 Trace.verbose = verbose;
6312 function addListener(listener) {
6313 debug.assertValue(listener, 'listener');
6314 listeners.push(listener);
6315 }
6316 Trace.addListener = addListener;
6317 function removeListener(listener) {
6318 debug.assertValue(listener, 'listener');
6319 var index = listeners.indexOf(listener);
6320 if (index >= 0)
6321 listeners.splice(index, 1);
6322 }
6323 Trace.removeListener = removeListener;
6324 function resetListeners() {
6325 listeners = new Array(defaultListener);
6326 }
6327 Trace.resetListeners = resetListeners;
6328 function reset() {
6329 lastTraceIndex = -1;
6330 }
6331 Trace.reset = reset;
6332 function getTraces() {
6333 if (lastTraceIndex < 0)
6334 return;
6335 var result = new Array(lastTraceIndex + 1);
6336 for (var i = 0; i <= lastTraceIndex; i++)
6337 result[i] = traces[i];
6338 return result;
6339 }
6340 Trace.getTraces = getTraces;
6341 /**
6342 * Note: Used for unit-test only.
6343 */
6344 function disableDefaultListener() {
6345 removeListener(defaultListener);
6346 }
6347 Trace.disableDefaultListener = disableDefaultListener;
6348 function enableDefaultListener() {
6349 addListener(defaultListener);
6350 }
6351 Trace.enableDefaultListener = enableDefaultListener;
6352 function logTraceInternal(trace) {
6353 if ((lastTraceIndex + 1) >= traceMaxCount)
6354 reset();
6355 traces[++lastTraceIndex] = trace;
6356 for (var i = 0, len = listeners.length; i < len; i++)
6357 listeners[i].logTrace(trace);
6358 }
6359 })(Trace = jsCommon.Trace || (jsCommon.Trace = {}));
6360 })(jsCommon || (jsCommon = {}));
6361
6362
6363
6364/***/ },
6365
6366/***/ 300:
6367/***/ function(module, exports) {
6368
6369 /*** IMPORTS FROM imports-loader ***/
6370 var jsCommon = window.jsCommon;
6371 var powerbi = window.powerbi;
6372 var powerbitests = window.powerbitests;
6373 var InJs = window.InJs;
6374 var debug = window.debug;
6375 var jasmine = window.jasmine;
6376 var Microsoft = window.Microsoft;
6377
6378 /*
6379 * Power BI Visualizations
6380 *
6381 * Copyright (c) Microsoft Corporation
6382 * All rights reserved.
6383 * MIT License
6384 *
6385 * Permission is hereby granted, free of charge, to any person obtaining a copy
6386 * of this software and associated documentation files (the ""Software""), to deal
6387 * in the Software without restriction, including without limitation the rights
6388 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6389 * copies of the Software, and to permit persons to whom the Software is
6390 * furnished to do so, subject to the following conditions:
6391 *
6392 * The above copyright notice and this permission notice shall be included in
6393 * all copies or substantial portions of the Software.
6394 *
6395 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6396 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6397 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6398 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6399 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6400 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6401 * THE SOFTWARE.
6402 */
6403 /// <reference path="../_references.ts"/>
6404 var jsCommon;
6405 (function (jsCommon) {
6406 /**
6407 * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.
6408 */
6409 (function (TraceType) {
6410 TraceType[TraceType["Information"] = 0] = "Information";
6411 TraceType[TraceType["Verbose"] = 1] = "Verbose";
6412 TraceType[TraceType["Warning"] = 2] = "Warning";
6413 TraceType[TraceType["Error"] = 3] = "Error";
6414 TraceType[TraceType["ExpectedError"] = 4] = "ExpectedError";
6415 TraceType[TraceType["UnexpectedError"] = 5] = "UnexpectedError";
6416 TraceType[TraceType["Fatal"] = 6] = "Fatal";
6417 })(jsCommon.TraceType || (jsCommon.TraceType = {}));
6418 var TraceType = jsCommon.TraceType;
6419 })(jsCommon || (jsCommon = {}));
6420
6421
6422
6423/***/ },
6424
6425/***/ 301:
6426/***/ function(module, exports) {
6427
6428 /*** IMPORTS FROM imports-loader ***/
6429 var jsCommon = window.jsCommon;
6430 var powerbi = window.powerbi;
6431 var powerbitests = window.powerbitests;
6432 var InJs = window.InJs;
6433 var debug = window.debug;
6434 var jasmine = window.jasmine;
6435 var Microsoft = window.Microsoft;
6436
6437 /*
6438 * Power BI Visualizations
6439 *
6440 * Copyright (c) Microsoft Corporation
6441 * All rights reserved.
6442 * MIT License
6443 *
6444 * Permission is hereby granted, free of charge, to any person obtaining a copy
6445 * of this software and associated documentation files (the ""Software""), to deal
6446 * in the Software without restriction, including without limitation the rights
6447 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6448 * copies of the Software, and to permit persons to whom the Software is
6449 * furnished to do so, subject to the following conditions:
6450 *
6451 * The above copyright notice and this permission notice shall be included in
6452 * all copies or substantial portions of the Software.
6453 *
6454 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6455 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6456 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6457 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6458 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6459 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6460 * THE SOFTWARE.
6461 */
6462 /// <reference path="../_references.ts"/>
6463 var jsCommon;
6464 (function (jsCommon) {
6465 /**
6466 * JavaScript files.
6467 */
6468 var MSMapcontrol = 'https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1&onscriptload=globalMapControlLoaded';
6469 /**
6470 * Map loading logic.
6471 */
6472 var MSMapcontrolLoaded = false;
6473 var WaitForMSMapLoad = null;
6474 var PowerViewPackage = {
6475 javaScriptFiles: [
6476 powerbi.build + '/externals/pv/webclient.js'
6477 ],
6478 cssFiles: [
6479 powerbi.build + '/externals/pv/Styles/_all.css'
6480 ],
6481 javaScriptFilesWithCallback: [
6482 { javascriptFile: MSMapcontrol, onLoadCallback: waitForMapControlLoaded }
6483 ]
6484 };
6485 function ensurePowerView(action) {
6486 if (action === void 0) { action = _.noop; }
6487 jsCommon.requires(PowerViewPackage, action);
6488 }
6489 jsCommon.ensurePowerView = ensurePowerView;
6490 var MapPackage = {
6491 javaScriptFilesWithCallback: [
6492 { javascriptFile: MSMapcontrol, onLoadCallback: waitForMapControlLoaded }
6493 ]
6494 };
6495 function ensureMap(locale, action) {
6496 var mapPackageWithLocale = powerbi.Prototype.inherit(MapPackage);
6497 if (!_.isEmpty(locale)) {
6498 var localeSplit = locale.split('-', 2);
6499 mapPackageWithLocale.javaScriptFilesWithCallback[0].javascriptFile = MSMapcontrol.concat('&mkt=' + locale + '&ur=' + (localeSplit.length > 1 ? localeSplit[1] : locale));
6500 }
6501 jsCommon.requires(mapPackageWithLocale, action);
6502 }
6503 jsCommon.ensureMap = ensureMap;
6504 function mapControlLoaded() {
6505 MSMapcontrolLoaded = true;
6506 if (WaitForMSMapLoad) {
6507 WaitForMSMapLoad.resolve();
6508 WaitForMSMapLoad = undefined;
6509 }
6510 }
6511 jsCommon.mapControlLoaded = mapControlLoaded;
6512 function waitForMapControlLoaded() {
6513 var task;
6514 if (!MSMapcontrolLoaded) {
6515 task = WaitForMSMapLoad = $.Deferred();
6516 }
6517 else {
6518 task = $.Deferred();
6519 task.resolve();
6520 }
6521 return task.promise();
6522 }
6523 jsCommon.waitForMapControlLoaded = waitForMapControlLoaded;
6524 })(jsCommon || (jsCommon = {}));
6525 /* tslint:disable:no-unused-variable */
6526 globalMapControlLoaded = function () {
6527 // Map requires a function in the global namespace to callback once loaded
6528 jsCommon.mapControlLoaded();
6529 };
6530 /* tslint:enable:no-unused-variable */
6531
6532
6533
6534/***/ },
6535
6536/***/ 302:
6537/***/ function(module, exports) {
6538
6539 /*** IMPORTS FROM imports-loader ***/
6540 var jsCommon = window.jsCommon;
6541 var powerbi = window.powerbi;
6542 var powerbitests = window.powerbitests;
6543 var InJs = window.InJs;
6544 var debug = window.debug;
6545 var jasmine = window.jasmine;
6546 var Microsoft = window.Microsoft;
6547
6548 /*
6549 * Power BI Visualizations
6550 *
6551 * Copyright (c) Microsoft Corporation
6552 * All rights reserved.
6553 * MIT License
6554 *
6555 * Permission is hereby granted, free of charge, to any person obtaining a copy
6556 * of this software and associated documentation files (the ""Software""), to deal
6557 * in the Software without restriction, including without limitation the rights
6558 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6559 * copies of the Software, and to permit persons to whom the Software is
6560 * furnished to do so, subject to the following conditions:
6561 *
6562 * The above copyright notice and this permission notice shall be included in
6563 * all copies or substantial portions of the Software.
6564 *
6565 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6566 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6567 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6568 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6569 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6570 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6571 * THE SOFTWARE.
6572 */
6573 /// <reference path="./_references.ts"/>
6574 var InJs;
6575 (function (InJs) {
6576 /**
6577 * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.
6578 */
6579 (function (TraceType) {
6580 TraceType[TraceType["information"] = 0] = "information";
6581 TraceType[TraceType["verbose"] = 1] = "verbose";
6582 TraceType[TraceType["warning"] = 2] = "warning";
6583 TraceType[TraceType["error"] = 3] = "error";
6584 TraceType[TraceType["expectedError"] = 4] = "expectedError";
6585 TraceType[TraceType["unexpectedError"] = 5] = "unexpectedError";
6586 TraceType[TraceType["fatal"] = 6] = "fatal";
6587 })(InJs.TraceType || (InJs.TraceType = {}));
6588 var TraceType = InJs.TraceType;
6589 })(InJs || (InJs = {}));
6590
6591
6592
6593/***/ }
6594
6595/******/ });
6596//# sourceMappingURL=VisualsCommon.js.map
\No newline at end of file