diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 00000000..6e7798f5
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,4 @@
+# Task 512388: Fix eslint warnings and errors in tests
+/node_modules/*
+/**/*.js
+dist/*
\ No newline at end of file
diff --git a/.eslintrc.js b/.eslintrc.js
index ebc8387a..4240ccee 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -21,14 +21,9 @@ module.exports = {
],
"rules": {
"@typescript-eslint/adjacent-overload-signatures": "warn",
- "@typescript-eslint/array-type": [
- "warn",
- {
- "default": "array-simple"
- }
- ],
+ "@typescript-eslint/array-type": "off",
"@typescript-eslint/await-thenable": "warn",
- "@typescript-eslint/ban-ts-comment": "warn",
+ "@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": [
"warn",
{
@@ -36,9 +31,8 @@ module.exports = {
"Object": {
"message": "Avoid using the `Object` type. Did you mean `object`?"
},
- "Function": {
- "message": "Avoid using the `Function` type. Prefer a specific function type, like `() => void`."
- },
+ "Function": false,
+ "object": false,
"Boolean": {
"message": "Avoid using the `Boolean` type. Did you mean `boolean`?"
},
@@ -54,16 +48,18 @@ module.exports = {
}
}
],
- "@typescript-eslint/consistent-type-assertions": "warn",
"@typescript-eslint/consistent-type-definitions": "warn",
- "@typescript-eslint/dot-notation": "warn",
+ "@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
- "@typescript-eslint/explicit-module-boundary-types": "warn",
+ "@typescript-eslint/explicit-module-boundary-types": [
+ "warn",
+ { "allowArgumentsExplicitlyTypedAsAny": true }
+ ],
"@typescript-eslint/indent": [
"warn",
2,
@@ -90,39 +86,50 @@ module.exports = {
}
}
],
- "@typescript-eslint/member-ordering": "warn",
- "@typescript-eslint/naming-convention": "warn",
+ "@typescript-eslint/explicit-function-return-type": [
+ "error",
+ {
+ "allowExpressions": true,
+ "allowDirectConstAssertionInArrowFunctions": true
+ }
+ ],
+ "@typescript-eslint/member-ordering": "off",
+ "@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-array-constructor": "warn",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/no-empty-interface": "warn",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extra-non-null-assertion": "warn",
"@typescript-eslint/no-extra-semi": "warn",
- "@typescript-eslint/no-floating-promises": "warn",
+ "@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-for-in-array": "warn",
"@typescript-eslint/no-implied-eval": "warn",
- "@typescript-eslint/no-inferrable-types": "warn",
+ "@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-misused-new": "warn",
- "@typescript-eslint/no-misused-promises": "warn",
+ "@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-this-alias": "warn",
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
- "@typescript-eslint/no-unsafe-assignment": "warn",
- "@typescript-eslint/no-unsafe-call": "warn",
- "@typescript-eslint/no-unsafe-member-access": "warn",
- "@typescript-eslint/no-unsafe-return": "warn",
+ "@typescript-eslint/no-unsafe-assignment": "off",
+ "@typescript-eslint/no-unsafe-call": "off",
+ "@typescript-eslint/no-unsafe-member-access": "off",
+ "@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-unused-expressions": "warn",
- "@typescript-eslint/no-unused-vars": "warn",
+ "@typescript-eslint/no-unused-vars": [
+ "warn",
+ {
+ "args": "after-used", "argsIgnorePattern": "^_"
+ }
+ ],
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-var-requires": "warn",
"@typescript-eslint/prefer-as-const": "warn",
"@typescript-eslint/prefer-for-of": "warn",
- "@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-namespace-keyword": "warn",
- "@typescript-eslint/prefer-regexp-exec": "warn",
+ "@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/quotes": [
"off",
{
@@ -131,10 +138,9 @@ module.exports = {
],
"@typescript-eslint/require-await": "warn",
"@typescript-eslint/restrict-plus-operands": "warn",
- "@typescript-eslint/restrict-template-expressions": "warn",
+ "@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/semi": [
- "warn",
- "always"
+ "error",
],
"@typescript-eslint/triple-slash-reference": [
"warn",
@@ -145,13 +151,9 @@ module.exports = {
}
],
"@typescript-eslint/type-annotation-spacing": "warn",
- "@typescript-eslint/unbound-method": "warn",
+ "@typescript-eslint/unbound-method": "off",
"@typescript-eslint/unified-signatures": "warn",
- "arrow-body-style": "warn",
- "arrow-parens": [
- "warn",
- "always"
- ],
+ "arrow-parens": "off",
"brace-style": [
"off",
"1tbs"
@@ -159,7 +161,6 @@ module.exports = {
"comma-dangle": "off",
"complexity": "off",
"constructor-super": "warn",
- "curly": "warn",
"eol-last": "warn",
"eqeqeq": [
"warn",
@@ -176,10 +177,9 @@ module.exports = {
"Boolean",
"boolean",
"Undefined",
- "undefined"
],
"id-match": "warn",
- "import/order": "warn",
+ "import/order": "off",
"jsdoc/check-alignment": "warn",
"jsdoc/check-indentation": "warn",
"jsdoc/newline-after-description": "warn",
@@ -190,7 +190,6 @@ module.exports = {
"max-len": "off",
"new-parens": "warn",
"no-array-constructor": "off",
- "no-bitwise": "warn",
"no-caller": "warn",
"no-cond-assign": "warn",
"no-console": "off",
@@ -202,29 +201,18 @@ module.exports = {
"no-fallthrough": "off",
"no-implied-eval": "off",
"no-invalid-this": "off",
- "no-multiple-empty-lines": "warn",
+ "no-multiple-empty-lines": ["error", { "max": 1 }],
"no-new-wrappers": "warn",
- "no-shadow": [
- "warn",
- {
- "hoist": "all"
- }
- ],
- "no-throw-literal": "warn",
+ "no-shadow": "off",
"no-trailing-spaces": "warn",
"no-undef-init": "warn",
- "no-underscore-dangle": "warn",
+ "no-underscore-dangle": "off",
"no-unsafe-finally": "warn",
"no-unused-labels": "warn",
- "no-unused-vars": "off",
"no-var": "warn",
- "object-shorthand": ["warn", "never"],
- "one-var": [
- "warn",
- "never"
- ],
- "prefer-arrow/prefer-arrow-functions": "warn",
- "prefer-const": "warn",
+ "object-shorthand": "off",
+ "one-var": "off",
+ "prefer-const": "off",
"prefer-rest-params": "warn",
"quote-props": [
"warn",
@@ -232,14 +220,7 @@ module.exports = {
],
"radix": "warn",
"require-await": "off",
- "space-before-function-paren": [
- "warn",
- {
- "anonymous": "never",
- "asyncArrow": "always",
- "named": "never"
- }
- ],
+ "space-before-function-paren": "off",
"spaced-comment": [
"warn",
"always",
diff --git a/.gitignore b/.gitignore
index 640fe628..d8bec088 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,7 @@ npm-debug.log*
dist/powerbi.js.map
*.js.map
package-lock.json
-demo/package-lock.json
+.vscode
+owners.txt
+test/util.spec.ts
+.config/tsaoptions.json
\ No newline at end of file
diff --git a/.pipelines/build.ps1 b/.pipelines/build.ps1
deleted file mode 100644
index a32fe43d..00000000
--- a/.pipelines/build.ps1
+++ /dev/null
@@ -1,13 +0,0 @@
-$exitCode = 0;
-
-Write-Host "start: npm run build"
-& npm run build
-Write-Host "done: npm run build"
-
-$exitCode += $LASTEXITCODE;
-
-Write-Host "start: Get dist folder files"
-& dir "dist"
-Write-Host "Done: Get dist folder files"
-
-exit $exitCode
\ No newline at end of file
diff --git a/.pipelines/cdpx_run_ps.cmd b/.pipelines/cdpx_run_ps.cmd
deleted file mode 100644
index 64ddad9f..00000000
--- a/.pipelines/cdpx_run_ps.cmd
+++ /dev/null
@@ -1,6 +0,0 @@
-setlocal enabledelayedexpansion
-pushd "%~dp0\.."
-powershell.exe -ExecutionPolicy Unrestricted -NoProfile -WindowStyle Hidden -NonInteractive -File "%~dp0%~1"
-endlocal
-popd
-exit /B %ERRORLEVEL%
diff --git a/.pipelines/nuget_pack.ps1 b/.pipelines/nuget_pack.ps1
deleted file mode 100644
index a77d18f7..00000000
--- a/.pipelines/nuget_pack.ps1
+++ /dev/null
@@ -1,11 +0,0 @@
-Write-Host "Start running nuget_pack.ps1"
-
-$versionNumber = [Environment]::GetEnvironmentVariable("CustomBuildNumber", "User");
-$exitCode = 0;
-
-Write-Host "Nuget Pack ..\PowerBI.JavaScript.nuspec -Version "$versionNumber
-& nuget pack "..\PowerBI.JavaScript.nuspec" -Version $versionNumber
-
-$exitCode += $LASTEXITCODE;
-
-exit $exitCode
\ No newline at end of file
diff --git a/.pipelines/package.ps1 b/.pipelines/package.ps1
deleted file mode 100644
index 54401656..00000000
--- a/.pipelines/package.ps1
+++ /dev/null
@@ -1,13 +0,0 @@
-$exitCode = 0;
-
-Write-Host "start: npm pack"
-& npm pack
-Write-Host "done: npm pack"
-
-$exitCode += $LASTEXITCODE;
-
-Write-Host "start: Get content of current folder"
-& dir
-Write-Host "done: Get content of current folder"
-
-exit $exitCode
\ No newline at end of file
diff --git a/.pipelines/pipeline.user.windows.yml b/.pipelines/pipeline.user.windows.yml
deleted file mode 100644
index 5ba3f0ae..00000000
--- a/.pipelines/pipeline.user.windows.yml
+++ /dev/null
@@ -1,125 +0,0 @@
-environment:
- host:
- os: 'windows'
- flavor: 'server'
- version: '2016'
- runtime:
- provider: 'appcontainer'
- image: 'cdpxwinrs5.azurecr.io/global/vse2019/16.3.7:latest'
- source_mode: 'map'
-
-artifact_publish_options:
- publish_to_legacy_artifacts: false
- publish_to_pipeline_artifacts: true
- publish_to_cloudvault_artifacts: false
-
-# Enable signing on all declared artifacts.
-signing_options:
- profile: 'external_distribution'
- codesign_validation_glob_pattern: 'regex|.+(?:exe|dll)$;-|*.nd.dll;-|.gdn\\**'
-
-static_analysis_options:
- moderncop_options:
- files_to_scan:
- - from: 'src\'
- include:
- - '**/*.*'
-
- policheck_options:
- files_to_scan:
- - exclude:
- - 'demo\**\*' # Exclude path 'Localize'.
- - 'test\**\*'
- - 'node_modules\**\*'
-
- binskim_options:
- files_to_scan:
- - exclude:
- - 'demo\**\*' # Exclude path 'Localize'.
- - 'test\**\*'
- - 'node_modules\**\*'
-
-package_sources:
- npm:
- feeds:
- registry: https://powerbi.pkgs.visualstudio.com/_packaging/SDK.Externals/npm/registry/
-
-version:
- major: 1 # <---- Required field but not being used for 'custom' scheme
- minor: 0 # <---- Required field but not being used for 'custom' scheme
- system: 'custom' # <---- Set this to 'custom'. we will build the version using package.json in versioning commands.
-
-versioning:
- commands:
- - !!defaultcommand
- name: 'Set Version'
- arguments: 'version.ps1'
- command: '.pipelines\cdpx_run_ps.cmd'
-
-restore:
- commands:
- - !!defaultcommand
- name: 'NPM Install'
- arguments: 'restore.ps1'
- command: '.pipelines\cdpx_run_ps.cmd'
-
-build:
- commands:
- - !!buildcommand
- name: 'Build'
- arguments: 'build.ps1'
- command: '.pipelines\cdpx_run_ps.cmd'
- artifacts:
- - to: 'build_artifacts'
- include:
- - 'dist/**/*'
- - 'LICENSE.txt'
- - 'package.json'
- - 'README.md'
-
- - to: 'source'
- include:
- - '**/*'
- exclude:
- - '**/.pipelines/**/*.*'
- - '**/.vscode/**/*.*'
- - '**/test/**/*.*'
- - '**/demo/**/*.*'
- - '**/dist/**/*.*'
- - '**/node_modules/**/*.*'
-
-# All build stage artifacts get signed right after the build stage
-# because the global signing profile is defined.
-
-package:
- commands:
- - !!buildcommand
- name: 'Package'
- arguments: 'package.ps1'
- command: '.pipelines\cdpx_run_ps.cmd'
- artifacts:
- - to: 'tgz-package'
- include:
- - "**/*.tgz"
-
- - !!buildcommand
- name: 'Nuget Pack'
- arguments: 'nuget_pack.ps1'
- command: '.pipelines\cdpx_run_ps.cmd'
- artifacts:
- - to: 'Release'
- include:
- - "**/Microsoft.PowerBI.JavaScript.*.nupkg"
-
-test:
- commands:
- - !!testcommand
- name: 'Test powerbi-javascript'
- arguments: 'test.ps1'
- command: '.pipelines\cdpx_run_ps.cmd'
- testresults:
- - title: 'powerbi-javascript test results'
- type: 'jasmine'
- from: 'reports'
- include:
- - "**coverage/**/index.html"
diff --git a/.pipelines/restore.ps1 b/.pipelines/restore.ps1
deleted file mode 100644
index 3aa88f61..00000000
--- a/.pipelines/restore.ps1
+++ /dev/null
@@ -1,25 +0,0 @@
-Write-Host "Start build ..."
-Write-Host "Global node/npm paths ..."
-& where.exe npm
-& where.exe node
-
-Write-Host "Global node version"
-& node -v
-
-Write-Host "Global npm version"
-& npm -v
-
-$exitCode = 0;
-
-Write-Host "start: try install latest npm version"
-& npm install npm@latest -g
-Write-Host "done: try install latest npm version"
-
-# Do not update $exitCode because we do not want to fail if install latest npm version fails.
-
-Write-Host "start: npm install"
-& npm install --no-audit --no-save
-Write-Host "done: npm install"
-$exitCode += $LASTEXITCODE;
-
-exit $exitCode
\ No newline at end of file
diff --git a/.pipelines/test.ps1 b/.pipelines/test.ps1
deleted file mode 100644
index 625ca890..00000000
--- a/.pipelines/test.ps1
+++ /dev/null
@@ -1,9 +0,0 @@
-$exitCode = 0;
-
-Write-Host "start: npm run test"
-& npm run test
-Write-Host "done: npm run test"
-
-$exitCode += $LASTEXITCODE;
-
-exit $exitCode;
\ No newline at end of file
diff --git a/.pipelines/version.ps1 b/.pipelines/version.ps1
deleted file mode 100644
index 6bcbae19..00000000
--- a/.pipelines/version.ps1
+++ /dev/null
@@ -1,14 +0,0 @@
-try {
- # package.json is in root folder, while version.ps1 runs in .pipelines folder.
- $version = (Get-Content "package.json") -join "`n" | ConvertFrom-Json | Select -ExpandProperty "version"
- $buildNumber = "$version"
-
- Write-Host "Build Number is" $buildNumber
-
- [Environment]::SetEnvironmentVariable("CustomBuildNumber", $buildNumber, "User") # This will allow you to use it from env var in later steps of the same phase
- Write-Host "##vso[build.updatebuildnumber]${buildNumber}" # This will update build number on your build
-}
-catch {
- Write-Error $_.Exception
- exit 1;
-}
diff --git a/.vscode/settings.json b/.vscode/settings.json
deleted file mode 100644
index 4479811e..00000000
--- a/.vscode/settings.json
+++ /dev/null
@@ -1,6 +0,0 @@
-// Place your settings in this file to overwrite default and user settings.
-{
- "editor.tabSize": 2,
- "editor.insertSpaces": true,
- "editor.detectIndentation": false
-}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
deleted file mode 100644
index a7b839de..00000000
--- a/.vscode/tasks.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- // See https://go.microsoft.com/fwlink/?LinkId=733558
- // for the documentation about the tasks.json format
- "version": "0.1.0",
- "command": "npm",
- "isShellCommand": true,
- "showOutput": "always",
- "suppressTaskName": true,
- "tasks": [
- {
- "taskName": "build",
- "args": [
- "run",
- "build"
- ],
- "isBuildCommand": true
- },
- {
- "taskName": "test",
- "args": [
- "run",
- "test",
- "--",
- "--chrome"
- ],
- "isTestCommand": true
- }
- ]
-}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 9e5bfa50..00000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,61 +0,0 @@
-# 2.0.0-beta.1 (GA candidate)
-
-## Breaking
-
-- DOMContentLoaded handler is now opt-in instead of the default behavior
- - Reasons:
- - The primary use case will be using the core library within another library which may not have the DOM ready even if DOMContentLoaded has fired.
- - Most developers using SPA applications will fetch embed data asynchronously and not know report data by the time the DOMContentLoaded has fired.
- - How to opt-in to DOMContentLoaded:
- - Call `enableAutoEmbed()` on an instance of the PowerBi service to add the event listener.
-
- Example:
- ```
-
-
- ```
-
- Alternately if you are creating an instance of the service you can pass a configuration parameter `autoEmbedOnContentLoaded`
-
- Example:
- ```
- var powerbiService = new Powerbi({ autoEmbedOnContentLoaded: true });
- ```
-- `powerbi.get(element: HTMLElement)` now only returns the instance of powerbi component associated with the element and does not implicitly emebed. Use `powerbi.embed(element: HTMLElement, config: IEmbedOptions = {})`.
- - Reasons:
- - powerbi.embed performed the same function and is more semantic.
- - Now that overwrite: true is the default behavior for .embed having a separate method (get) for only retrieving compnents is good separation of intents.
-- Embed urls must be provided by the server and will not be constructed by the components. This implies that the attributes `powerbi-report` will no longer be used.
- - Reasons:
-
- The construction of these urls was unreliable since it dependeded on assumptions about server configuration (target environment, component type, etc).
- Since url would be incorrect in some cases it could cause trouble for developers. Also, since the sever is already returning access tokens it's trival for the server to also provide embed urls and this reduces complexity.
-
- Previously you could supply the embed information in two ways:
-
- 1. Using report id:
-
- `
`
-
- This would implicitly construct the embed url to be something like: `https://embedded.powerbi.com/reports/5dac7a4a-4452-46b3-99f6-a25915e0fe55`
- However
-
- 2. Using embed url:
-
- `
`
-
- Now only the latter options (#2) is supported.
-
-- Embed url attribute changed from `powerbi-embed` to `powerbi-embed-url`
-- Component type is specified by attribute `powerbi-type`. Use `powerbi-type="report"` instead of applying the attribute `powerbi-report`
-- Configuration settings attributes all start with prefix `powerbi-settings-`.
-
-## Changes
-
-- Fix bug to prevent memory leak of holding references to iframe elements which had been removed from the DOM.
-- Detect overwriting container with new component and either throw error or properly cleanup and replace old component based on `config.overwrite` setting.
-- Fix bug with prematurely attempting to parse post message data until it is known that it originated from embedded iframe.
-
-# 1.0.0 (Preview)
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e0b39a81..3e7f6be3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -55,24 +55,6 @@ node node_modules/karma/bin/karma start --browsers=Firefox --single-run=false --
The build and tests use webpack to compile all the source modules into one bundled module that can execute in the browser.
-## Running the demo
-Navigate to `/demo` directory
-
-Install npm dependencies:
-```
-npm install
-```
-
-Serve the demo directory:
-```
-npm start
-```
-
-Open the address to view in the browser:
-```
-http://127.0.0.1:8080/
-```
-
## Updating the documentation (For those with push permissions only)
First run the command to build the docs and open it to verify the changes are as expected.
@@ -80,16 +62,3 @@ First run the command to build the docs and open it to verify the changes are as
npm run gulp -- build:docs
```
> There are errors during the TypeDoc compilation step due to some complication with modules however the documentation should still be generated. It's not clear if these are fixable by including more src files in the gulp task or if it's just the nature of TypeDoc lacking capabilities for this project structure.
-
-If the docs are correct then you may publish them to gh-pages using this command
-```
-npm run gulp -- ghpages
-```
-
-## Known issues
-Running demo fails with an error ERR_INVALID_REDIRECT
-This happens due to version 10 of http-server. To solve the problem, please install http-server@0.9.0 globally using:
-
-```
-npm install -g http-server@0.9.0
-```
diff --git a/README.md b/README.md
index 54b20c16..9fecd37e 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# powerbi-client
-JavaScript library for embedding Power BI into your apps.
+A client side library for embedding Power BI using JavaScript or TypeScript into your apps.
[](https://travis-ci.org/Microsoft/PowerBI-JavaScript)
[](https://www.npmjs.com/package/powerbi-client)
@@ -9,14 +9,17 @@ JavaScript library for embedding Power BI into your apps.
[](https://github.com/Microsoft/PowerBI-JavaScript/tags)
[](https://gitter.im/Microsoft/PowerBI-JavaScript)
-## Wiki
-See the [wiki](https://github.com/Microsoft/PowerBI-JavaScript/wiki) for more details about embedding, service configuration, setting a default page, page navigation, dynamically applying filters, and more.
+## Documentation
+See the [Power BI embedded analytics Client APIs documentation](https://docs.microsoft.com/javascript/api/overview/powerbi/) to learn how to embed a Power BI report in your application and how to use the client APIs.
## Code Docs
-See the [code docs](https://microsoft.github.io/PowerBI-JavaScript) for detailed information about classes, interfaces, types, etc.
+See the [code docs](https://learn.microsoft.com/en-us/javascript/api/powerbi/powerbi-client) for detailed information about classes, interfaces, types, etc.
-## Demo
-New [live demo](https://microsoft.github.io/PowerBI-JavaScript/demo) for a sample application using the `powerbi-client` library in scenarios such as page navigation, applying filters, updating settings, and more.
+## Sample Application
+For examples of applications utilizing the `powerbi-client` library, please refer to the available samples in the [PowerBI-Developer-Samples repository](https://github.com/microsoft/PowerBI-Developer-Samples).
+
+## Playground
+To explore and understand the capabilities of embedded analytics in your applications, please visit the [Power BI Embedded Analytics Playground](https://playground.powerbi.com).
## Installation
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 00000000..12fbd833
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,41 @@
+
+
+## Security
+
+Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
+
+If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below.
+
+## Reporting Security Issues
+
+**Please do not report security vulnerabilities through public GitHub issues.**
+
+Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report).
+
+If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc).
+
+You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
+
+Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
+
+ * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
+ * Full paths of source file(s) related to the manifestation of the issue
+ * The location of the affected source code (tag/branch/commit or direct URL)
+ * Any special configuration required to reproduce the issue
+ * Step-by-step instructions to reproduce the issue
+ * Proof-of-concept or exploit code (if possible)
+ * Impact of the issue, including how an attacker might exploit the issue
+
+This information will help us triage your report more quickly.
+
+If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs.
+
+## Preferred Languages
+
+We prefer all communications to be in English.
+
+## Policy
+
+Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd).
+
+
\ No newline at end of file
diff --git a/demo/LICENSE.txt b/demo/LICENSE.txt
deleted file mode 100644
index 736dfd1e..00000000
--- a/demo/LICENSE.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-Microsoft.PowerBI.JavaScript
-
-Copyright (c) Microsoft Corporation
-
-All rights reserved.
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/demo/NOTICE.txt b/demo/NOTICE.txt
deleted file mode 100644
index 93917b59..00000000
--- a/demo/NOTICE.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Microsoft.PowerBI.JavaScript
-
-THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
-Do Not Translate or Localize
-
-This project incorporates components from the projects listed below. The original copyright notices and the licenses under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
-
- 1. SyntaxHighlighter (https://github.com/syntaxhighlighter/syntaxhighlighter)
-
- Copyright (c) 2004-2013, Alex Gorbatchev
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/demo/app/dataselection.js b/demo/app/dataselection.js
deleted file mode 100644
index bd30f240..00000000
--- a/demo/app/dataselection.js
+++ /dev/null
@@ -1,39 +0,0 @@
-$(function () {
- var models = window['powerbi-client'].models;
-
- console.log('Scenario 7: Data Selection');
-
- var reportUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
- var $reportContainer = $('#reportContainer');
- var report;
- var $dataSelectedContainer = $("#dataSelectedContainer");
-
- // Init
- fetch(reportUrl)
- .then(function (response) {
- if (response.ok) {
- return response.json()
- .then(function (embedConfig) {
- report = powerbi.embed($reportContainer.get(0), embedConfig);
- initializeDataSelection(report, $dataSelectedContainer);
- return report;
- });
- }
- else {
- return response.json()
- .then(function (error) {
- throw new Error(error);
- });
- }
- });
-});
-
-function initializeDataSelection(report, $dataSelectedContainer) {
- report.on('dataSelected', function (event) {
- console.log('dataSelected: ', event);
-
- var data = event.detail;
-
- $dataSelectedContainer.text(JSON.stringify(data, null, ' '));
- });
-}
diff --git a/demo/app/defaults.js b/demo/app/defaults.js
deleted file mode 100644
index c6ecf136..00000000
--- a/demo/app/defaults.js
+++ /dev/null
@@ -1,52 +0,0 @@
-$(function () {
- var models = window['powerbi-client'].models;
-
- console.log('Scenario 5: Default Page and/or Filter');
-
- var staticReportUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
- var $defaultPageReportContainer = $('#reportdefaults');
- var defaultPageReport;
- var defaultPageName = 'ReportSection2';
- var defaultFilter = new models.AdvancedFilter({
- table: "Store",
- column: "Name"
- }, "Or", [
- {
- operator: "Contains",
- value: "Wash"
- },
- {
- operator: "Contains",
- value: "Park"
- }
- ]);
-
- var defaultFilters = [defaultFilter];
-
- // Init
- fetch(staticReportUrl)
- .then(function (response) {
- if (response.ok) {
- return response.json()
- .then(function (embedConfig) {
- var defaultsEmbedConfig = $.extend({}, embedConfig, {
- pageName: defaultPageName,
- filter: defaultFilters,
- settings: {
- filterPaneEnabled: true,
- navContentPaneEnabled: true
- }
- });
-
- defaultPageReport = powerbi.embed($defaultPageReportContainer.get(0), defaultsEmbedConfig);
- return defaultPageReport;
- });
- }
- else {
- return response.json()
- .then(function (error) {
- throw new Error(error);
- });
- }
- });
-});
diff --git a/demo/app/dynamic.js b/demo/app/dynamic.js
deleted file mode 100644
index 8812768d..00000000
--- a/demo/app/dynamic.js
+++ /dev/null
@@ -1,75 +0,0 @@
-$(function () {
- var models = window['powerbi-client'].models;
-
- console.log('Scenario 2: Dynamic Embed');
-
- // Declare Variables
- var allReportsUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports';
- var $reportsList = $('#reportslist');
- var $resetButton = $('#resetButton');
- var $dynamicReportContainer = $('#reportdynamic');
-
- // When report button is clicked embed the report
- $reportsList.on('click', 'button', function (event) {
- var button = event.target;
- var report = $(button).data('report');
- var url = allReportsUrl + '/' + report.id;
-
- fetch(url)
- .then(function (response) {
- if (response.ok) {
- return response.json()
- .then(function (embedConfig) {
- return powerbi.embed($dynamicReportContainer.get(0), embedConfig);
- });
- }
- else {
- return response.json()
- .then(function (error) {
- throw new Error(error);
- });
- }
- });
- });
-
- // When reset button is clicked reset container
- $resetButton.on('click', function (event) {
- powerbi.reset($dynamicReportContainer.get(0));
- });
-
- // Helper function to generate HTML for each report
- function generateReportListItem(report) {
- var button = $('')
- .attr({
- type: 'button'
- })
- .addClass('btn btn-success')
- .data('report', report)
- .text('Embed!');
-
- var reportName = $(' ')
- .addClass('report-name')
- .text(report.name)
-
- var element = $('')
- .append(reportName)
- .append(button);
-
- return element;
- }
-
- // Init
- fetch(allReportsUrl)
- .then(function (response) {
- if (response.ok) {
- return response.json()
- .then(function (reports) {
- reports
- .map(generateReportListItem)
- .forEach(function (element) {
- $reportsList.append(element);
- });
- });
- }
- });
-});
\ No newline at end of file
diff --git a/demo/app/filters.js b/demo/app/filters.js
deleted file mode 100644
index c4d07434..00000000
--- a/demo/app/filters.js
+++ /dev/null
@@ -1,437 +0,0 @@
-$(function () {
- var models = window['powerbi-client'].models;
-
- console.log('Scenario 4: Custom Filter Pane');
-
- var reportUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
- var $customFilterPaneContainer = $('#reportcustomfilter');
- var customFilterPaneReport;
- var customFilterPaneReportPages;
- var $customFilterForm = $('#customfilterform');
- var $filterType = $('#filtertype');
- var $typeFields = $('.filter-type');
- var $operatorTypeFields = $('input[type=radio][name=operatorType]');
- var $operatorFields = $('.filter-operators');
- var $targetTypeFields = $('input[type=radio][name=filterTarget]');
- var $targetFields = $('.filter-target');
- var $reloadButton = $('#reload');
-
- var $predefinedFilter1 = $('#predefinedFilter1');
- var predefinedFilter1 = new models.AdvancedFilter({
- table: "Store",
- column: "Name"
- }, "And", [
- {
- operator: "Contains",
- value: "Direct"
- }
- ]);
-
- var $predefinedFilter2 = $('#predefinedFilter2');
- var predefinedFilter2 = new models.AdvancedFilter({
- table: "Store",
- column: "Name"
- }, "Or", [
- {
- operator: "Contains",
- value: "Wash"
- },
- {
- operator: "Contains",
- value: "Park"
- }
- ]);
-
- var $predefinedFilter3 = $('#predefinedFilter3');
- var predefinedFilter3 = new models.AdvancedFilter({
- table: "Store",
- column: "Name"
- }, "Or", [
- {
- operator: "Contains",
- value: "Wash"
- },
- {
- operator: "Contains",
- value: "Park"
- }
- ]);
-
- $reloadButton.on('click', function (event) {
- event.preventDefault();
-
- console.log('reload');
- customFilterPaneReport.reload();
- });
-
- $customFilterForm.on('submit', function (event) {
- event.preventDefault();
- console.log('submit');
-
- var data = {
- target: getFilterTypeTarget(),
- operator: getFilterOperatorAndValues(),
- reportTarget: getReportTarget()
- };
-
- var filter;
- var values = Array.prototype.slice.call(data.operator.values);
-
- if (data.operator.type === "basic") {
- filter = new models.BasicFilter(data.target, data.operator.operator, values);
- }
- else if (data.operator.type === "advanced") {
- filter = new models.AdvancedFilter(data.target, data.operator.operator, values);
- }
-
- var filterTargetLevel = customFilterPaneReport;
- if (data.reportTarget.type === "page") {
- filterTargetLevel = customFilterPaneReport.page(data.reportTarget.name);
- }
- else if (data.reportTarget.type === "visual") {
- // Need to finalize how visuals report whichp age they are on in order to construct correct page object.
- filterTargetLevel = customFilterPaneReport.page('ReportSection1').visual(data.reportTarget.name);
- }
-
- var filterJson = filter.toJSON();
- filterTargetLevel.setFilters([filterJson]);
- });
-
- $filterType.on('change', function (event) {
- console.log('change');
- var value = $filterType.val().toLowerCase();
- updateFieldsForType(value);
- });
-
- $operatorTypeFields.on('change', function (event) {
- var checkedType = $('#customfilterform input[name=operatorType]:checked').val();
- console.log('operator change', checkedType);
-
- updateFieldsForOperator(checkedType.toLowerCase());
- });
-
- $targetTypeFields.on('change', function (event) {
- var checkedTarget = $('#customfilterform input[name=filterTarget]:checked').val();
- console.log('target change', checkedTarget);
-
- updateTargetFields(checkedTarget.toLowerCase());
- });
-
- $predefinedFilter1.on('click', function (event) {
- customFilterPaneReport.setFilters([predefinedFilter1.toJSON()]);
- updateFiltersPane();
- });
-
- $predefinedFilter2.on('click', function (event) {
- customFilterPaneReport.setFilters([predefinedFilter2.toJSON()]);
- updateFiltersPane();
- });
-
- $predefinedFilter3.on('click', function (event) {
- customFilterPaneReport.page('ReportSection2').setFilters([predefinedFilter3.toJSON()]);
- updateFiltersPane();
- });
-
- function getFilterTypeTarget() {
- var filterType = $filterType.val().toLowerCase();
- var filterTypeTarget = {};
- filterTypeTarget.table = $('#filtertable').val();
-
- if (filterType === "column") {
- filterTypeTarget.column = $('#filtercolumn').val();
- }
- else if (filterType === "hierarchy") {
- filterTypeTarget.hierarchy = $('#filterhierarchy').val();
- filterTypeTarget.hierarchyLevel = $('#filterhierarchylevel').val();
- }
- else if (filterType === "measure") {
- filterTypeTarget.measure = $('#filtermeasure').val();
- }
-
- return filterTypeTarget;
- }
-
- function getFilterOperatorAndValues() {
- var operatorType = $('#customfilterform input[name=operatorType]:checked').val();
- var operatorAndValues = {
- type: operatorType
- };
-
- if (operatorType === "basic") {
- operatorAndValues.operator = $('#filterbasicoperator').val();
- operatorAndValues.values = $('.basic-value').map(function (index, element) {
- return $(element).val();
- });
- }
- else if (operatorType === "advanced") {
- operatorAndValues.operator = $('#filterlogicaloperator').val();
- operatorAndValues.values = $('.advanced-value')
- .map(function (index, element) {
- return {
- value: $(element).find('.advanced-value-input').val(),
- operator: $(element).find('.advanced-logical-condition').val()
- };
- });
- }
-
- return operatorAndValues;
- }
-
- function getReportTarget() {
- var checkedTarget = $('#customfilterform input[name=filterTarget]:checked').val();
- var target = {
- type: checkedTarget
- };
-
- if (checkedTarget === "page") {
- target.name = $('#filtertargetpage').val();
- }
- else if (checkedTarget === "visual") {
- target.id = undefined; // Need way to populate visual ids
- }
-
- return target;
- }
-
- function updateFieldsForType(type) {
- $typeFields.hide();
- $('.filter-type--' + type).show();
- }
-
- function updateFieldsForOperator(type) {
- $operatorFields.hide();
- $('.filter-operators--' + type).show();
- }
-
- function updateTargetFields(target) {
- $targetFields.hide();
- $('.filter-target--' + target).show();
- }
-
- function updateFiltersPane() {
- const $filters = $('.filters');
-
- $.each($filters, function (index, element) {
- const $element = $(element);
- const filterable = $element.data('filterable');
-
- console.log($element, filterable);
-
- filterable.getFilters()
- .then(function (filters) {
- console.log(filterable.displayName, filters);
- $element.empty();
- filters
- .map(generateFilterElement)
- .forEach(function ($filter) {
- $element.append($filter);
- });
- });
- });
- }
-
- // Init
- updateFieldsForType("column");
- updateFieldsForOperator("basic");
- updateTargetFields("report");
-
- function generateFilterElement(filter) {
- var $removeButton = $('')
- .addClass('btn')
- .addClass('btn-danger')
- .addClass('filter__remove')
- .data('filter', filter)
- .html('×')
- ;
-
- var $filterText = $('')
- .addClass('filter__text')
- .text(JSON.stringify(filter, null, ' '))
- ;
-
- var $filter = $('
')
- .addClass('filter')
- .append($removeButton)
- .append($filterText)
- ;
-
- return $filter;
- }
-
- /**
- * Applied Filters Pane
- */
- function createAppliedFiltersPane($element, report) {
- var $appliedFiltersContainer = $('#appliedFilters');
- var $reportFilters = $('#reportFilters');
- var $pageFilters = $('#pageFilters');
- var $refreshAppliedFilters = $('#refreshAppliedFilters');
- let reportPages;
-
- var filtersTree = {
- filterable: report,
- filters: [],
- nodes: []
- };
-
- function generatePageFiltersContainer(page) {
- var $heading = $('
')
- .text(page.name)
- ;
-
- var $filters = $('')
- .addClass('filters')
- .data('filterable', page)
- ;
-
- var $filtersContainer = $('
')
- .append($heading)
- .append($filters)
- ;
-
- return $filtersContainer;
- }
-
-
- // Setup static report filterable on element;
- $reportFilters
- .data('filterable', report);
-
- // Setup page filters containers which have filterable
- report.getPages()
- .then(function (pages) {
- reportPages = pages;
-
- pages
- .map(generatePageFiltersContainer)
- .forEach(function ($pageFiltersContainer) {
- $pageFilters.append($pageFiltersContainer)
- });
- });
-
- $refreshAppliedFilters.on('click', function (event) {
- event.preventDefault();
-
- updateFiltersPane();
- });
-
- $appliedFiltersContainer.on('click', 'button.filter__remove', function (event) {
- event.preventDefault();
- const $element = $(event.target);
- const filterToRemove = $element.data('filter');
- const $filter = $element.closest('.filter');
- const $filtersContainer = $element.closest('.filters');
- const filterable = $filtersContainer.data('filterable');
-
- console.log('remove filter', $element, $filtersContainer, filterToRemove, filterable);
-
- filterable.getFilters()
- .then(function (filters) {
- let index = -1;
- filters.some(function (filter, i) {
- if (JSON.stringify(filter) === JSON.stringify(filterToRemove)) {
- index = i;
- return true;
- }
- });
-
- if (index !== -1) {
- filters.splice(index, 1);
- filterable.setFilters(filters);
- $filter.remove();
- }
- });
- });
- };
-
- /**
- * Remove Filters Buttons
- */
- var $removeFiltersReportForm = $('#removeFiltersReportForm');
- var $removeFiltersPageForm = $('#removeFiltersPageForm');
- var $removeFiltersVisualForm = $('#removeFiltersVisualForm');
- var $removeFiltersPagesList = $('#removeFiltersPagesList');
- var $removeFiltersVisualsList = $('#removeFiltersVisualsList');
-
- $removeFiltersReportForm.on('submit', function (event) {
- event.preventDefault();
-
- console.log('submit removeFiltersReportForm');
- customFilterPaneReport.removeFilters();
- updateFiltersPane();
- });
-
- $removeFiltersPageForm.on('submit', function (event) {
- event.preventDefault();
-
- var pageName = $removeFiltersPagesList.val();
- console.log('submit removeFiltersPageForm', pageName);
- customFilterPaneReport.page(pageName).removeFilters();
- updateFiltersPane();
- });
-
- $removeFiltersVisualForm.on('submit', function (event) {
- event.preventDefault();
-
- var visualName = $removeFiltersVisualsList.val();
- console.log('submit removeFiltersVisualForm', visualName);
- customFilterPaneReport.page('ReportSection2').visual(visualName).removeFilters();
- updateFiltersPane();
- });
-
- // Init
- fetch(reportUrl)
- .then(function (response) {
- if (response.ok) {
- return response.json()
- .then(function (embedConfig) {
- var customFilterPaneConfig = $.extend({}, embedConfig, {
- settings: {
- filterPaneEnabled: false,
- navContentPaneEnabled: true
- }
- });
-
- customFilterPaneReport = powerbi.embed($customFilterPaneContainer.get(0), customFilterPaneConfig);
- return customFilterPaneReport;
- });
- }
- else {
- return response.json()
- .then(function (error) {
- throw new Error(error);
- });
- }
- })
- .then(function (report) {
- report.on('loaded', function (event) {
- createAppliedFiltersPane(null, report);
-
- console.log('custom filter pane report loaded');
- report.getPages()
- .then(function (pages) {
- customFilterPaneReportPages = pages;
- var $pagesSelect = $('#filtertargetpage');
- var $removeFiltersPagesList = $('#removeFiltersPagesList');
-
- pages
- .forEach(function (page) {
- var $pageOption = $('
')
- .val(page.name)
- .text(page.displayName)
- .data(page);
-
- var $pageOption1 = $(' ')
- .val(page.name)
- .text(page.displayName)
- .data(page);
-
- $removeFiltersPagesList.append($pageOption);
- $pagesSelect.append($pageOption1);
- });
- });
- });
- })
- ;
-
-});
\ No newline at end of file
diff --git a/demo/app/index.js b/demo/app/index.js
deleted file mode 100644
index 0b50e45e..00000000
--- a/demo/app/index.js
+++ /dev/null
@@ -1,45 +0,0 @@
-$(function () {
- var models = window['powerbi-client'].models;
-
- // Scenario 1: Static Embed
- var staticReportUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
- var $staticReportContainer = $('#reportstatic');
- var staticReport;
-
- fetch(staticReportUrl)
- .then(function (response) {
- if (response.ok) {
- return response.json()
- .then(function (embedConfig) {
- staticReport = powerbi.embed($staticReportContainer.get(0), embedConfig);
- });
- }
- else {
- return response.json()
- .then(function (error) {
- throw new Error(error);
- });
- }
- });
-
- var $getId = $('#getId');
- $getId.on('click', function (event) {
- alert(staticReport.getId());
- });
-
- var $fullscreen = $('#fullscreen');
- $fullscreen.on('click', function (event) {
- staticReport.fullscreen();
- });
-
- var $reloadReport = $('#reloadReport');
- $reloadReport.on('click', function (event) {
- staticReport.reload()
- .catch(function(error) { alert(error); });
- });
-
- var $printReport = $('#printReport');
- $printReport.on('click', function (event) {
- staticReport.print();
- });
-});
diff --git a/demo/app/pagenavigation.js b/demo/app/pagenavigation.js
deleted file mode 100644
index 9a129562..00000000
--- a/demo/app/pagenavigation.js
+++ /dev/null
@@ -1,186 +0,0 @@
-$(function () {
- var models = window['powerbi-client'].models;
-
- console.log('Scenario 3: Custom Page Navigation');
-
- // Declare Variables
- var staticReportUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
- var $customPageNavContainer = $('#reportcustompagenav');
- var customPageNavReport;
- var $reportPagesList = $('#reportpagesbuttons');
- var $prevButton = $('#prevbutton');
- var $nextButton = $('#nextbutton');
- var $cycleButton = $('#cyclebutton');
- var cycleIntervalId;
-
- // Helper function to generate pages list
- function generateReportPage(page) {
- var $page = $('')
- .attr({
- type: 'button'
- })
- .addClass('btn btn-success')
- .data('page', page)
- .text(page.displayName);
-
- if (page.isActive) {
- $page.addClass('active');
- }
-
- return $page;
- }
-
- function updateActivePage(newPage) {
- // Remove active class
- var reportButtons = $reportPagesList.children('button');
-
- reportButtons
- .each(function (index, element) {
- var $element = $(element);
- var buttonPage = $element.data('page');
- if (buttonPage.isActive) {
- buttonPage.isActive = false;
- $element.removeClass('active');
- }
- });
-
- // Set active class
- reportButtons
- .each(function (index, element) {
- var $element = $(element);
- var buttonPage = $element.data('page');
- if (buttonPage.name === newPage.name) {
- buttonPage.isActive = true;
- $element.addClass('active');
- }
- });
- }
-
- function changePage(forwards) {
- // Remove active class
- var reportButtons = $reportPagesList.children('button');
- var $activeButtonIndex = -1;
-
- reportButtons
- .each(function (index, element) {
- var $element = $(element);
- var buttonPage = $element.data('page');
- if (buttonPage.isActive) {
- $activeButtonIndex = index;
- }
- });
-
- if (forwards) {
- $activeButtonIndex += 1;
- }
- else {
- $activeButtonIndex -= 1;
- }
-
- if ($activeButtonIndex > reportButtons.length - 1) {
- $activeButtonIndex = 0;
- }
- if ($activeButtonIndex < 0) {
- $activeButtonIndex = reportButtons.length - 1;
- }
-
- reportButtons
- .each(function (index, element) {
- if ($activeButtonIndex === index) {
- var $element = $(element);
- var buttonPage = $element.data('page');
-
- customPageNavReport.setPage(buttonPage.name);
- }
- });
- }
-
- $prevButton.on('click', function (event) {
- changePage(false);
- });
-
- $nextButton.on('click', function (event) {
- changePage(true);
- });
-
- $cycleButton.on('click', function (event) {
- $cycleButton.toggleClass('active');
- $cycleButton.data('cycle', !$cycleButton.data('cycle'));
-
- if ($cycleButton.data('cycle')) {
- cycleIntervalId = setInterval(function () {
- console.log('cycle page: ');
- changePage(true);
- }, 1000);
- }
- else {
- clearInterval(cycleIntervalId);
- }
- });
-
- $reportPagesList.on('click', 'button', function (event) {
- var button = event.target;
- var report = $(button).data('report');
- var page = $(button).data('page');
-
- console.log('Attempting to set page to: ', page.name);
- customPageNavReport.setPage(page.name)
- .then(function (response) {
- console.log('Page changed request accepted');
- });
- });
-
- // Init
- fetch(staticReportUrl)
- .then(function (response) {
- if (response.ok) {
- return response.json()
- .then(function (report) {
- var embedConfig = $.extend({
- settings: {
- filterPaneEnabled: false,
- navContentPaneEnabled: false
- }
- }, report);
- customPageNavReport = powerbi.embed($customPageNavContainer.get(0), embedConfig);
- return customPageNavReport;
- });
- }
- else {
- return response.json()
- .then(function (error) {
- throw new Error(error);
- });
- }
- })
- .then(function (report) {
- report.on('loaded', function (event) {
- console.log('custom page nav report loaded');
- report.getPages()
- .then(function (pages) {
- console.log('pages: ', pages);
- if (pages.length > 0) {
- const firstPage = pages[0];
- firstPage.isActive = true;
-
- pages
- .map(function (page) {
- return generateReportPage(page);
- })
- .forEach(function (element) {
- $reportPagesList.append(element);
- });
- }
- });
- });
-
- report.on('error', function (event) {
- console.log('customPageNavReport error', event);
- });
-
- report.on('pageChanged', function (event) {
- console.log('pageChanged event received', event);
- updateActivePage(event.detail.newPage);
- });
- });
-});
\ No newline at end of file
diff --git a/demo/app/settings.js b/demo/app/settings.js
deleted file mode 100644
index 0ff1a28d..00000000
--- a/demo/app/settings.js
+++ /dev/null
@@ -1,52 +0,0 @@
-$(function () {
- var models = window['powerbi-client'].models;
-
- console.log('Scenario 6: Update settings');
-
- var reportUrl = 'https://powerbi-embed-api.azurewebsites.net/api/reports/c52af8ab-0468-4165-92af-dc39858d66ad';
- var $updateSettingsReport = $('#updatesettingsreport');
- var updateSettingsReport;
- var updateSettingsReportFilterPaneEnabled = false;
- var updateSettingsReprotNavContentPaneEnabled = false;
- var $toggleFilterPaneButton = $('#toggleFilterPane');
- var $toggleNavContentPaneButton = $('#toggleNavContentPane');
-
- $toggleFilterPaneButton.on('click', function () {
- updateSettingsReportFilterPaneEnabled = !updateSettingsReportFilterPaneEnabled;
- updateSettingsReport.updateSettings({
- filterPaneEnabled: updateSettingsReportFilterPaneEnabled
- });
- });
-
- $toggleNavContentPaneButton.on('click', function () {
- updateSettingsReprotNavContentPaneEnabled = !updateSettingsReprotNavContentPaneEnabled;
- updateSettingsReport.updateSettings({
- navContentPaneEnabled: updateSettingsReprotNavContentPaneEnabled
- });
- });
-
- // Init
- fetch(reportUrl)
- .then(function (response) {
- if (response.ok) {
- return response.json()
- .then(function (embedConfig) {
- var updateSettingsEmbedConfig = $.extend({}, embedConfig, {
- settings: {
- filterPaneEnabled: updateSettingsReportFilterPaneEnabled,
- navContentPaneEnabled: updateSettingsReprotNavContentPaneEnabled
- }
- });
-
- updateSettingsReport = powerbi.embed($updateSettingsReport.get(0), updateSettingsEmbedConfig);
- return updateSettingsReport;
- });
- }
- else {
- return response.json()
- .then(function (error) {
- throw new Error(error);
- });
- }
- });
-});
\ No newline at end of file
diff --git a/demo/code-demo/anyReport.html b/demo/code-demo/anyReport.html
deleted file mode 100644
index 7704d929..00000000
--- a/demo/code-demo/anyReport.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
Embed your own report
- You can also embed your own report by following the instructions below.
-
-
-
-
-
-
-
Instructions to generate an Embed Token
- Once you have imported a report into Power BI workspace, you are ready to embed it.
-
- To embed a report, you need to get an Embed Token. You can create this token in multiple ways.
-
-
-
-
-
Enter embed details:
-
-
-
Next step - Embed
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/code-demo/code_area.html b/demo/code-demo/code_area.html
deleted file mode 100644
index b4d52067..00000000
--- a/demo/code-demo/code_area.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Code
-
-
- Run
-
-
- Copy
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/code-demo/docs.html b/demo/code-demo/docs.html
deleted file mode 100644
index 96cc05b6..00000000
--- a/demo/code-demo/docs.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
Getting Started
-
-
- Please visit our
-
documentation
- to start using Power BI Embedded.
-
-
-
-Videos
-
-
-
- 1. Learn how to Embed and Interact with Power BI Reports.
-
-
VIDEO
-
-
-
-
- 2. Learn how to Create, Edit and Save Power BI reports in Embedded view.
-
-
VIDEO
-
diff --git a/demo/code-demo/images/arrow.png b/demo/code-demo/images/arrow.png
deleted file mode 100644
index e1acaefe..00000000
Binary files a/demo/code-demo/images/arrow.png and /dev/null differ
diff --git a/demo/code-demo/images/arrow_flipped.png b/demo/code-demo/images/arrow_flipped.png
deleted file mode 100644
index 76c76eeb..00000000
Binary files a/demo/code-demo/images/arrow_flipped.png and /dev/null differ
diff --git a/demo/code-demo/images/clear.png b/demo/code-demo/images/clear.png
deleted file mode 100644
index d2d65ca3..00000000
Binary files a/demo/code-demo/images/clear.png and /dev/null differ
diff --git a/demo/code-demo/images/copy.png b/demo/code-demo/images/copy.png
deleted file mode 100644
index 37d7203f..00000000
Binary files a/demo/code-demo/images/copy.png and /dev/null differ
diff --git a/demo/code-demo/images/run.png b/demo/code-demo/images/run.png
deleted file mode 100644
index ebd98604..00000000
Binary files a/demo/code-demo/images/run.png and /dev/null differ
diff --git a/demo/code-demo/index.html b/demo/code-demo/index.html
deleted file mode 100644
index 20f53c13..00000000
--- a/demo/code-demo/index.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Microsoft Power BI – Report Embed Sample
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/code-demo/log_window.html b/demo/code-demo/log_window.html
deleted file mode 100644
index 76e3b643..00000000
--- a/demo/code-demo/log_window.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
Log Viewer
-
-
- Copy
-
-
- Clear
-
-
-
-
\ No newline at end of file
diff --git a/demo/code-demo/report.html b/demo/code-demo/report.html
deleted file mode 100644
index dcb527b9..00000000
--- a/demo/code-demo/report.html
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/code-demo/sample.html b/demo/code-demo/sample.html
deleted file mode 100644
index 9f064e68..00000000
--- a/demo/code-demo/sample.html
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/demo/code-demo/scripts/codesamples.js b/demo/code-demo/scripts/codesamples.js
deleted file mode 100644
index c340d526..00000000
--- a/demo/code-demo/scripts/codesamples.js
+++ /dev/null
@@ -1,765 +0,0 @@
-/*
- This file contains the code samples which will appear live in the web-page.
- Each sample method name starts with _Report_ or _Page or _Embed depends on which section it appears.
- Please keep this.
-*/
-
-// ---- Embed Code ----------------------------------------------------
-
-function _Embed_BasicEmbed() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read report Id from textbox
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // We give All permissions to demonstrate switching between View and Edit mode and saving report.
- var permissions = models.Permissions.All;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config= {
- type: 'report',
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- permissions: permissions,
- settings: {
- filterPaneEnabled: true,
- navContentPaneEnabled: true
- }
- };
-
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Embed the report and display it within the div container.
- var report = powerbi.embed(reportContainer, config);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function() {
- Log.logText("Loaded");
- });
-
- report.on("error", function(event) {
- Log.log(event.detail);
-
- report.off("error");
- });
-
- report.off("saved");
- report.on("saved", function(event) {
- Log.log(event.detail);
- if(event.detail.saveAs) {
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- }
- });
-}
-
-function _Mock_Embed_BasicEmbed(isEdit) {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read report Id from textbox
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
- var permissions = models.Permissions.Copy | models.Permissions.Read;
- var viewMode = isEdit ? models.ViewMode.Edit : models.ViewMode.View;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config= {
- type: 'report',
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- permissions: permissions,
- viewMode: viewMode,
- settings: {
- filterPaneEnabled: true,
- navContentPaneEnabled: true,
- useCustomSaveAsDialog: true
- }
- };
-
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Embed the report and display it within the div container.
- var report = powerbi.embed(reportContainer, config);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function() {
- Log.logText("Loaded");
- });
-
- report.on("saveAsTriggered", function() {
- Log.logText("Cannot save sample report");
- });
-
- report.off("error");
- report.on("error", function(event) {
- Log.log(event.detail);
- });
-
- report.off("saved");
- report.on("saved", function(event) {
- Log.log(event.detail);
- if(event.detail.saveAs) {
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- }
- });
-}
-
-function _Mock_Embed_BasicEmbed_EditMode() {
- _Mock_Embed_BasicEmbed(true);
-}
-
-function _Mock_Embed_BasicEmbed_ViewMode() {
- _Mock_Embed_BasicEmbed(false);
-}
-
-function _Embed_BasicEmbed_EditMode() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read report Id from textbox
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config= {
- type: 'report',
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- permissions: models.Permissions.All /*gives maximum permissions*/,
- viewMode: models.ViewMode.Edit,
- settings: {
- filterPaneEnabled: true,
- navContentPaneEnabled: true
- }
- };
-
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Embed the report and display it within the div container.
- var report = powerbi.embed(reportContainer, config);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function() {
- Log.logText("Loaded");
- });
-
- report.off("error");
- report.on("error", function(event) {
- Log.log(event.detail);
- });
-
- report.off("saved");
- report.on("saved", function(event) {
- Log.log(event.detail);
- if(event.detail.saveAs) {
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- }
- });
-}
-
-function _Embed_EmbedWithDefaultFilter() {
- var txtAccessToken = $('#txtAccessToken').val();
- var txtEmbedUrl = $('#txtReportEmbed').val();
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Store",
- column: "Chain"
- },
- operator: "In",
- values: ["Lindseys"]
- };
-
- var embedConfiguration = {
- type: 'report',
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- settings: {
- filterPaneEnabled: false,
- navContentPaneEnabled: false
- },
- filters: [filter]
- };
-
- var reportContainer = document.getElementById('reportContainer');
- powerbi.embed(reportContainer, embedConfiguration);
-}
-
-function _Embed_Create() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtCreateAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtCreateReportEmbed').val();
-
- // Read dataset Id from textbox
- var txtEmbedDatasetId = $('#txtEmbedDatasetId').val();
-
- // Embed create configuration used to describe the what and how to create report.
- // This object is used when calling powerbi.createReport.
- var embedCreateConfiguration = {
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- datasetId: txtEmbedDatasetId,
- };
-
- // Grab the reference to the div HTML element that will host the report
- var reportContainer = $('#reportContainer')[0];
-
- // Create report
- var report = powerbi.createReport(reportContainer, embedCreateConfiguration);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function() {
- Log.logText("Loaded");
- });
-
- report.off("error");
- report.on("error", function(event) {
- Log.log(event.detail);
- });
-
- // report.off removes a given event handler if it exists.
- report.off("saved");
- report.on("saved", function(event) {
- Log.log(event.detail);
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- });
-}
-
-function _Mock_Embed_Create() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtCreateAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtCreateReportEmbed').val();
-
- // Read dataset Id from textbox
- var txtEmbedDatasetId = $('#txtEmbedDatasetId').val();
-
- // Embed create configuration used to describe the what and how to create report.
- // This object is used when calling powerbi.createReport.
- var embedCreateConfiguration = {
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- datasetId: txtEmbedDatasetId,
- settings: {
- useCustomSaveAsDialog: true
- }
- };
-
- // Grab the reference to the div HTML element that will host the report
- var reportContainer = $('#reportContainer')[0];
-
- // Create report
- var report = powerbi.createReport(reportContainer, embedCreateConfiguration);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function() {
- Log.logText("Loaded");
- });
- report.on("saveAsTriggered", function() {
- Log.logText("Cannot save sample report");
- });
-
- report.off("error");
- report.on("error", function(event) {
- Log.log(event.detail);
- });
-}
-
-// ---- Report Operations ----------------------------------------------------
-
-function _Report_GetId() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Retrieve the report id.
- var reportId = report.getId();
-
- Log.logText(reportId);
-}
-
-function _Report_UpdateSettings() {
- // The new settings that you want to apply to the report.
- const newSettings = {
- navContentPaneEnabled: true,
- filterPaneEnabled: false
- };
-
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Update the settings by passing in the new settings you have configured.
- report.updateSettings(newSettings)
- .then(function (result) {
- $("#result").html(result);
- })
- .catch(function (error) {
- $("#result").html(error);
- });
-}
-
-function _Report_GetPages() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Retrieve the page collection and loop through to collect the
- // page name and display name of each page and display the value.
- report.getPages()
- .then(function (pages) {
- pages.forEach(function(page) {
- var log = page.name + " - " + page.displayName;
- Log.logText(log);
- });
- })
- .catch(function (error) {
- Log.log(error);
- });
-}
-
-function _Report_SetPage() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // setPage will change the selected view to the page you indicate.
- // This is the actual page name not the display name.
- report.setPage("ReportSection2")
- .then(function (result) {
- Log.log(result);
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-
- // Report.off removes a given event handler if it exists.
- report.off("pageChanged");
-
- // Report.on will add an event handler which prints page
- // name and display name to Log window.
- report.on("pageChanged", function(event) {
- var page = event.detail.newPage;
- Log.logText(page.name + " - " + page.displayName);
- });
-}
-
-function _Report_GetFilters() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Get the filters applied to the report.
- report.getFilters()
- .then(function (filters) {
- Log.log(filters);
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Report_SetFilters() {
- // Build the filter you want to use. For more information, See Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Store",
- column: "Chain"
- },
- operator: "In",
- values: ["Lindseys"]
- };
-
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Set the filter for the report.
- // Pay attention that setFilters receives an array.
- report.setFilters([filter])
- .then(function (result) {
- Log.log(result);
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Report_RemoveFilters() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Remove the filters currently applied to the report.
- report.removeFilters()
- .then(function (result) {
- Log.log(result);
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Report_PrintCurrentReport() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Trigger the print dialog for your browser.
- report.print()
- .then(function (result) {
- Log.log(result);
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Report_Reload() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Reload the displayed report
- report.reload()
- .then(function (result) {
- Log.logText("Reloaded");
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Report_Refresh() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Refresh the displayed report
- report.refresh()
- .then(function (result) {
- Log.logText("Refreshed");
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Report_FullScreen() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Displays the report in full screen mode.
- report.fullscreen();
-}
-
-function _Report_ExitFullScreen() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Exits full screen mode.
- report.exitFullscreen();
-}
-
-function _Report_switchModeEdit() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Switch to edit mode.
- report.switchMode("edit");
-}
-
-function _Report_switchModeView() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Switch to view mode.
- report.switchMode("view");
-}
-
-function _Report_save() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Save report
- report.save();
-}
-
-function _Mock_Report_save() {
- Log.logText('Cannot save sample report');
-}
-
-function _Report_saveAs() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- var saveAsParameters = {
- name: "newReport"
- };
-
- // SaveAs report
- report.saveAs(saveAsParameters);
-}
-
-// ---- Page Operations ----------------------------------------------------
-
-function _Page_SetActive() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Retrieve the page collection, and then set the second page to be active.
- report.getPages()
- .then(function (pages) {
- pages[1].setActive().then(function (result) {
- Log.log(result);
- });
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Page_GetFilters() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Retrieve the page collection and get the filters for the first page.
- report.getPages()
- .then(function (pages) {
- pages[0].getFilters()
- .then(function (filters) {
- Log.log(filters);
- })
- .catch(function (errors) {
- Log.log(errors);
- });
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Page_SetFilters() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Build the filter you want to use. For more information, see Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Store",
- column: "Chain"
- },
- operator: "In",
- values: ["Lindseys"]
- };
-
- // Retrieve the page collection and then set the filters for the first page.
- // Pay attention that setFilters receives an array.
- report.getPages()
- .then(function (pages) {
- pages[0].setFilters([filter])
- .then(function (result) {
- Log.log(result);
- })
- .catch(function (errors) {
- Log.log(errors);
- });
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-function _Page_RemoveFilters() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Retrieve the page collection and remove the filters for the first page.
- report.getPages()
- .then(function (pages) {
- pages[0].removeFilters()
- .then(function (result) {
- Log.log(result);
- })
- .catch(function (errors) {
- Log.log(errors);
- });
- })
- .catch(function (errors) {
- Log.log(errors);
- });
-}
-
-// ---- Event Listener ----------------------------------------------------
-
-function _Events_PageChanged() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Report.off removes a given event listener if it exists.
- report.off("pageChanged");
-
- // Report.on will add an event listener.
- report.on("pageChanged", function(event) {
- var page = event.detail.newPage;
- Log.logText("Page changed to: " + page.name + " - " + page.displayName);
- });
-
- // Select Run and change to a different page.
- // You should see an entry in the Log window.
-
- Log.logText("Select different page to see events in Log window.");
-}
-
-function _Events_DataSelected() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Report.off removes a given event listener if it exists.
- report.off("dataSelected");
-
- // Report.on will add an event listener.
- report.on("dataSelected", function(event) {
- var data = event.detail;
- Log.log(data);
- });
-
- // Select Run and select an element of a visualization.
- // For example, a bar in a bar chart. You should see an entry in the Log window.
-
- Log.logText("Select data to see events in Log window.");
-}
-
-function _Events_SaveAsTriggered() {
- // Get a reference to the embedded report HTML element
- var reportContainer = $('#reportContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(reportContainer);
-
- // Report.off removes a given event listener if it exists.
- report.off("saveAsTriggered");
-
- // Report.on will add an event listener.
- report.on("saveAsTriggered", function(event) {
- Log.log(event);
- });
-
- // Select Run and then select SaveAs.
- // You should see an entry in the Log window.
-
- Log.logText("Select SaveAs to see events in Log window.");
-}
diff --git a/demo/code-demo/scripts/function_mapping.js b/demo/code-demo/scripts/function_mapping.js
deleted file mode 100644
index bb2cf2eb..00000000
--- a/demo/code-demo/scripts/function_mapping.js
+++ /dev/null
@@ -1,75 +0,0 @@
-const mockDict = {
- _Report_GetPages: datasetNotSupported,
- _Report_SetPage: datasetNotSupported,
- _Report_SetFilters: datasetNotSupported,
- _Report_GetFilters: datasetNotSupported,
- _Report_RemoveFilters: datasetNotSupported,
- _Report_PrintCurrentReport: datasetNotSupported,
- _Report_UpdateSettings: datasetNotSupported,
- _Report_Reload: datasetNotSupported,
- _Page_SetActive: datasetNotSupported,
- _Page_SetFilters: datasetNotSupported,
- _Page_GetFilters: datasetNotSupported,
- _Page_RemoveFilters: datasetNotSupported,
- _Report_switchModeEdit: datasetNotSupported,
- _Report_switchModeView: datasetNotSupported,
- _Embed_BasicEmbed: _Mock_Embed_BasicEmbed_ViewMode,
- _Embed_BasicEmbed_EditMode: _Mock_Embed_BasicEmbed_EditMode,
- _Report_save: _Mock_Report_save,
- _Report_saveAs: _Mock_Report_save,
- _Embed_Create: _Mock_Embed_Create
-};
-
-function datasetNotSupported() {
- Log.logText('Operation not supported for dataset')
-}
-
-function IsSaveMock(funcName) {
- return ((funcName === '_Report_save' || funcName === '_Report_saveAs') && (
- _session.embedId === 'c52af8ab-0468-4165-92af-dc39858d66ad' /*Sample Report*/ ||
- _session.embedId === '1ee0b264-b280-43f1-bbb7-9d8bd2d03a78' /*Sample dataset*/ ));
-}
-
-function IsBasicMock(funcName) {
- return ((funcName === '_Embed_BasicEmbed' || funcName === '_Embed_BasicEmbed_EditMode') && _session.embedId === 'c52af8ab-0468-4165-92af-dc39858d66ad');
-}
-
-function IsCreateMock(funcName) {
- return (funcName === '_Embed_Create' && _session.embedId === '1ee0b264-b280-43f1-bbb7-9d8bd2d03a78');
-}
-
-function IsNotSupported(funcName) {
- if (powerbi.embeds.length === 0) {
- return false
- }
-
- // Get a reference to the embedded element
- var embed = powerbi.get($('#reportContainer')[0]);
- if (embed.config.type !== 'create') {
- return false;
- }
-
- var runFunc = mockDict[funcName];
- return (runFunc && runFunc === datasetNotSupported) ? true : false;
-}
-
-function IsMock(funcName) {
- return (IsBasicMock(funcName) || IsSaveMock(funcName) || IsCreateMock(funcName) || IsNotSupported(funcName));
-}
-
-function mapFunc(func) {
- var funcName = getFuncName(func);
- return IsMock(funcName) ? mockDict[funcName] : func;
-}
-
-function getFuncName(func) {
- var funcName = func.name;
-
- if (!funcName)
- {
- // in IE, func.name is invalid method. so, function name should be extracted manually.
- funcName = func.toString().match(/^function\s*([^\s(]+)/)[1];
- }
-
- return funcName;
-}
\ No newline at end of file
diff --git a/demo/code-demo/scripts/index.js b/demo/code-demo/scripts/index.js
deleted file mode 100644
index cb4115d0..00000000
--- a/demo/code-demo/scripts/index.js
+++ /dev/null
@@ -1,54 +0,0 @@
-var sampleContentLoaded = false;
-var documentationContentLoaded = false;
-var anyReportSectionLoaded = false;
-
-$(function() {
- OpenSampleSection();
-});
-
-function OpenSampleSection() {
- OpenEmbedWorkspace("#top-sample", "step_authorize.html");
-}
-
-function OpenAnyReportSection() {
- OpenEmbedWorkspace("#top-anyReport", "anyReport.html");
-}
-
-function OpenEmbedWorkspace(activeTabSelector, authStepHtml)
-{
- // Any report, uses the same settings as sample report. ony changes the auth step.
- if (!sampleContentLoaded)
- {
- // Open Report Sample.
- $("#sampleContent").load("sample.html", function() {
- $("#mainContent").load("report.html");
- sampleContentLoaded = true;
- });
- }
-
- $("#authorize-step-wrapper").load(authStepHtml);
- SetActiveStyle(activeTabSelector);
-
- $(".content").hide();
- $("#sampleContent").show();
- OpenAuthStep();
-}
-
-function OpenDocumentationSection() {
- if (!documentationContentLoaded)
- {
- $("#documentationContent").load("docs.html");
- documentationContentLoaded = true;
- }
-
- SetActiveStyle("#top-docs");
-
- $(".content").hide();
- $("#documentationContent").show();
-}
-
-function SetActiveStyle(id)
-{
- $("#top-ul li").removeClass("top-li-active");
- $(id).addClass("top-li-active");
-}
\ No newline at end of file
diff --git a/demo/code-demo/scripts/logger.js b/demo/code-demo/scripts/logger.js
deleted file mode 100644
index 52b9e454..00000000
--- a/demo/code-demo/scripts/logger.js
+++ /dev/null
@@ -1,23 +0,0 @@
-function InitLogger(divId) {
-
- var Logger = {};
-
- Logger.log = function name(event) {
- this.logText("Json Object\n" + JSON.stringify(event, null, " "));
- };
-
- Logger.logText = function name(text) {
- var textbox = document.getElementById(divId);
-
- if (!textbox.value)
- {
- textbox.value = "";
- }
-
- textbox.value += "> " + text + "\n";
-
- textbox.scrollTop = textbox.scrollHeight;
- };
-
- return Logger;
-}
diff --git a/demo/code-demo/scripts/report.js b/demo/code-demo/scripts/report.js
deleted file mode 100644
index ff0f1819..00000000
--- a/demo/code-demo/scripts/report.js
+++ /dev/null
@@ -1,132 +0,0 @@
-const active_class = 'active';
-const active_li = 'steps-li-active';
-
-const EmbedViewMode = "view";
-const EmbedEditMode = "edit";
-const EmbedCreateMode = "create";
-
-function OpenAuthStep() {
- $('#steps-ul a').removeClass(active_class);
- $(".steps-li-active").removeClass(active_li);
-
- $("#steps-auth a").addClass(active_class);
- $("#steps-auth").addClass(active_li);
-
- // Hide Embed view in authorization step.
- $("#authorize-step-wrapper").show();
- $("#embed-and-interact-steps-wrapper").hide();
-}
-
-function OpenEmbedStep(mode) {
- $('#steps-ul a').removeClass(active_class);
- $(".steps-li-active").removeClass(active_li);
-
- $('#steps-embed a').addClass(active_class);
- $('#steps-embed').addClass(active_li);
-
- // Hide Embed view in authorization step.
- $("#authorize-step-wrapper").hide();
- $("#embed-and-interact-steps-wrapper").show();
-
- $("#settings").load("settings_embed.html", function() {
- OpenEmbedMode(mode);
-
- // Fix report size ratio
- var reportContainer = $("#reportContainer");
- reportContainer.height(reportContainer.width() * 0.59);
- });
-}
-
-function OpenInteractStep() {
- $('#steps-ul a').removeClass(active_class);
- $(".steps-li-active").removeClass(active_li);
-
- $('#steps-interact a').addClass(active_class);
- $('#steps-interact').addClass(active_li);
-
- // Hide Embed view in authorization step.
- $("#authorize-step-wrapper").hide();
- $("#embed-and-interact-steps-wrapper").show();
-
- $("#settings").load("settings_interact.html", function() {
- SetToggleHandler("report-operations-div");
- SetToggleHandler("page-operations-div");
- SetToggleHandler("events-operations-div");
- SetToggleHandler("editandsave-operations-div");
- LoadCodeArea("#embedCodeDiv", _Report_GetId);
- });
-}
-
-function setCodeArea(mode)
-{
- if (mode === EmbedViewMode)
- {
- LoadCodeArea("#embedCodeDiv", _Embed_BasicEmbed);
- }
- else if (mode === EmbedEditMode)
- {
- LoadCodeArea("#embedCodeDiv", _Embed_BasicEmbed_EditMode);
- }
- else if (mode === EmbedCreateMode)
- {
- LoadCodeArea("#embedCodeDiv", _Embed_Create);
- }
-}
-
-function showEmbedSettings(mode)
-{
- var inputDivToShow = "#embedModeInput";
- var inputDivToHide = "#createModeInput";
-
- if (mode === EmbedCreateMode)
- {
- inputDivToShow = "#createModeInput";
- inputDivToHide = "#embedModeInput";
- }
-
- $(inputDivToShow).show();
- $(inputDivToHide).hide();
-
- var embedModeRadios = $('input:radio[name=embedMode]');
- embedModeRadios.filter('[value='+ mode + ']').prop('checked', true);
-}
-
-function OpenEmbedMode(mode)
-{
- if (mode == EmbedCreateMode)
- {
- if (IsEmbeddingSampleReport())
- {
- LoadSampleDatasetIntoSession();
- }
-
- SetTextBoxesFromSessionOrUrlParam("#txtCreateAccessToken", "#txtCreateReportEmbed", "#txtEmbedDatasetId");
- }
- else {
- if (IsEmbeddingSampleReport())
- {
- LoadSampleReportIntoSession();
- }
-
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- }
-
- setCodeArea(mode);
- showEmbedSettings(mode);
-}
-
-function OpenViewMode() {
- OpenEmbedMode(EmbedViewMode);
-}
-
-function OpenEditMode() {
- OpenEmbedMode(EmbedEditMode);
-}
-
-function OpenCreateMode() {
- OpenEmbedMode(EmbedCreateMode);
-}
-
-function IsEmbeddingSampleReport() {
- return GetSession(SessionKeys.IsSampleReport) == true;
-}
diff --git a/demo/code-demo/scripts/session_utils.js b/demo/code-demo/scripts/session_utils.js
deleted file mode 100644
index d95adc4b..00000000
--- a/demo/code-demo/scripts/session_utils.js
+++ /dev/null
@@ -1,76 +0,0 @@
-var _session = {};
-
-const SessionKeys = {
- AccessToken : "accessToken",
- EmbedUrl : "embedUrl",
- EmbedId : "embedId",
- GroupId : "groupId",
- IsSampleReport: "isSampleReport",
- QnaQuestion: "qnaQuestion",
- EntityIsAlreadyEmbedded: "EntityIsAlreadyEmbedded",
-};
-
-function GetParameterByName(name, url) {
- if (!url) {
- url = window.location.href;
- }
- name = name.replace(/[\[\]]/g, "\\$&");
- var regex = new RegExp("[?&]" + name + "(=([^]*)|&|#|$)"),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2].replace(/\+/g, " "));
-}
-
-function SetSession(key, value) {
- // This is a temporal solution for session (which is cleared on reload). Should be replaced with a real session.
- _session[key] = value;
-}
-
-function GetSession(key) {
- // This is a temporal solution for session (which is cleared on reload). Should be replaced with a real session.
- return _session[key];
-}
-
-function UpdateSession(button, sessionKey) {
- var value = $(button).val();
- if (value)
- {
- SetSession(sessionKey, value);
- }
-}
-
-function SetTextBoxesFromSessionOrUrlParam(accessTokenSelector, embedUrlSelector, embedIdSelector) {
- var accessToken = GetParameterByName(SessionKeys.AccessToken);
- if (!accessToken)
- {
- accessToken = GetSession(SessionKeys.AccessToken);
- }
-
- var embedUrl = GetParameterByName(SessionKeys.EmbedUrl);
- if (!embedUrl)
- {
- embedUrl = GetSession(SessionKeys.EmbedUrl);
- } else {
- var groupId = GetParameterByName(SessionKeys.GroupId);
- if(groupId)
- {
- if (embedUrl.indexOf("?") != -1)
- {
- embedUrl += "&groupId=" + groupId;
- } else {
- embedUrl += "?groupId=" + groupId;
- }
- }
- }
-
- var embedId = GetParameterByName(SessionKeys.EmbedId);
- if (!embedId)
- {
- embedId = GetSession(SessionKeys.EmbedId);
- }
-
- $(accessTokenSelector).val(accessToken);
- $(embedUrlSelector).val(embedUrl);
- $(embedIdSelector).val(embedId);
-}
diff --git a/demo/code-demo/scripts/step_authorize.js b/demo/code-demo/scripts/step_authorize.js
deleted file mode 100644
index 43e793f5..00000000
--- a/demo/code-demo/scripts/step_authorize.js
+++ /dev/null
@@ -1,41 +0,0 @@
-const SampleReport = {
- AccessToken : "",
- EmbedUrl : "https://embedded.powerbi.com/appTokenReportEmbed?reportId=c52af8ab-0468-4165-92af-dc39858d66ad",
- EmbedId : "c52af8ab-0468-4165-92af-dc39858d66ad"
-};
-
-const SampleDataset = {
- AccessToken : "",
- EmbedUrl : "https://embedded.powerbi.com/appTokenReportEmbed",
- EmbedId : "1ee0b264-b280-43f1-bbb7-9d8bd2d03a78"
-};
-
-function LoadSampleReportIntoSession() {
- setSession(SampleReport.AccessToken, SampleReport.EmbedUrl, SampleReport.EmbedId);
-}
-
-function LoadSampleDatasetIntoSession() {
- setSession(SampleDataset.AccessToken, SampleDataset.EmbedUrl, SampleDataset.EmbedId);
-}
-
-function OpenEmbedStepWithSample() {
- SetSession(SessionKeys.IsSampleReport, true);
- OpenEmbedStep(EmbedViewMode);
-}
-
-function OpenEmbedStepCreateWithSample() {
- SetSession(SessionKeys.IsSampleReport, true);
- OpenEmbedStep(EmbedCreateMode);
-}
-
-function OpenEmbedStepFromUserSettings() {
- SetSession(SessionKeys.IsSampleReport, false);
- OpenEmbedStep(EmbedViewMode);
-}
-
-function setSession(accessToken, embedUrl, embedId)
-{
- SetSession(SessionKeys.AccessToken, accessToken);
- SetSession(SessionKeys.EmbedUrl, embedUrl);
- SetSession(SessionKeys.EmbedId, embedId);
-}
\ No newline at end of file
diff --git a/demo/code-demo/scripts/step_embed.js b/demo/code-demo/scripts/step_embed.js
deleted file mode 100644
index af4cacef..00000000
--- a/demo/code-demo/scripts/step_embed.js
+++ /dev/null
@@ -1,98 +0,0 @@
-// ---- Report Operations ----------------------------------------------------
-function Report_GetId() {
- SetCode(_Report_GetId);
-}
-
-function Report_UpdateSettings() {
- SetCode(_Report_UpdateSettings);
-}
-
-function Report_GetPages() {
- SetCode(_Report_GetPages);
-}
-
-function Report_SetPage() {
- SetCode(_Report_SetPage);
-}
-
-function Report_GetFilters() {
- SetCode(_Report_GetFilters);
-}
-
-function Report_SetFilters() {
- SetCode(_Report_SetFilters);
-}
-
-function Report_RemoveFilters() {
- SetCode(_Report_RemoveFilters);
-}
-
-function Report_PrintCurrentReport() {
- SetCode(_Report_PrintCurrentReport);
-}
-
-function Report_Reload() {
- SetCode(_Report_Reload);
-}
-
-function Report_Refresh() {
- SetCode(_Report_Refresh);
-}
-
-function Report_FullScreen() {
- SetCode(_Report_FullScreen);
-}
-
-function Report_ExitFullScreen() {
- SetCode(_Report_ExitFullScreen);
-}
-
-// ---- Page Operations ----------------------------------------------------
-
-function Page_SetActive() {
- SetCode(_Page_SetActive);
-}
-
-function Page_GetFilters() {
- SetCode(_Page_GetFilters);
-}
-
-function Page_SetFilters() {
- SetCode(_Page_SetFilters);
-}
-
-function Page_RemoveFilters() {
- SetCode(_Page_RemoveFilters);
-}
-
-// ---- Event Listener ----------------------------------------------------
-
-function Events_PageChanged() {
- SetCode(_Events_PageChanged);
-}
-
-function Events_DataSelected() {
- SetCode(_Events_DataSelected);
-}
-
-function Events_SaveAsTriggered() {
- SetCode(_Events_SaveAsTriggered);
-}
-
-// ---- Edit and Save Operations ----------------------------------------------------
-
-function Report_switchModeEdit() {
- SetCode(_Report_switchModeEdit);
-}
-
-function Report_switchModeView() {
- SetCode(_Report_switchModeView);
-}
-
-function Report_save() {
- SetCode(_Report_save);
-}
-
-function Report_saveAs() {
- SetCode(_Report_saveAs);
-}
\ No newline at end of file
diff --git a/demo/code-demo/scripts/step_interact.js b/demo/code-demo/scripts/step_interact.js
deleted file mode 100644
index ea15a6fd..00000000
--- a/demo/code-demo/scripts/step_interact.js
+++ /dev/null
@@ -1,73 +0,0 @@
-function OpenReportOperations() {
- $("#report-operations-div").show();
- $("#page-operations-div").hide();
- $("#events-operations-div").hide();
- $("#editandsave-operations-div").hide();
-
- $("#report-operations-li").addClass('active');
- $('#page-operations-li').removeClass('active');
- $('#events-operations-li').removeClass('active');
- $('#editandsave-operations-li').removeClass('active');
-
- $("#report-operations-div .function-ul li.active").click()
-
- $("#selected-catogory-button").html("Report operations");
-}
-
-function OpenPageOperations() {
- $("#page-operations-div").show();
- $("#report-operations-div").hide();
- $("#events-operations-div").hide();
- $("#editandsave-operations-div").hide();
-
- $("#page-operations-li").addClass('active');
- $('#report-operations-li').removeClass('active');
- $('#events-operations-li').removeClass('active');
- $('#editandsave-operations-li').removeClass('active');
-
- $("#page-operations-div .function-ul li.active").click();
-
- $("#selected-catogory-button").html("Page operations");
-}
-
-function OpenEventOperations() {
- $("#page-operations-div").hide();
- $("#report-operations-div").hide();
- $("#events-operations-div").show();
- $("#editandsave-operations-div").hide();
-
- $("#page-operations-li").removeClass('active');
- $('#report-operations-li').removeClass('active');
- $('#events-operations-li').addClass('active');
- $('#editandsave-operations-li').removeClass('active');
-
- $("#events-operations-div .function-ul li.active").click();
-
- $("#selected-catogory-button").html("Events Listener");
-}
-
-function OpenEditAndSaveOperations() {
- $("#page-operations-div").hide();
- $("#report-operations-div").hide();
- $("#events-operations-div").hide();
- $("#editandsave-operations-div").show();
-
- $("#page-operations-li").removeClass('active');
- $('#report-operations-li').removeClass('active');
- $('#events-operations-li').removeClass('active');
- $('#editandsave-operations-li').addClass('active');
-
- $("#editandsave-operations-div .function-ul li.active").click();
-
- $("#selected-catogory-button").html("Edit and save operations");
-}
-
-function SetToggleHandler(devId) {
- var selector = "#" + devId + " .function-ul li";
- $(selector).each(function(index, li) {
- $(li).click(function() {
- $(selector).removeClass('active');
- $(li).addClass('active');
- });
- });
-}
diff --git a/demo/code-demo/scripts/utils.js b/demo/code-demo/scripts/utils.js
deleted file mode 100644
index 9a4c7bd6..00000000
--- a/demo/code-demo/scripts/utils.js
+++ /dev/null
@@ -1,82 +0,0 @@
-function ValidateEmbedUrl(embedUrl) {
- var embedUrl = $('#txtReportEmbed').val();
-
- if (!embedUrl)
- {
- alert("You must specify an embed url.");
- return false;
- }
- var id = null;
- var parts = embedUrl.split("reportId=");
- if (parts && parts.length > 0)
- {
- var guidParts = parts[parts.length -1].split("&");
- if (guidParts && guidParts.length > 0)
- {
- id = guidParts[0];
- }
- }
-
- if (!id)
- {
- alert("Could not find report ID in url");
- return false;
- }
-
- return true;
-}
-
-function BodyCodeOfFunction(func) {
- var lines = func.toString().split('\n');
- lines = lines.slice(1, lines.length-1);
-
- for (var i = 0; i < lines.length; ++i)
- {
- // remove trailing spaces.
- lines[i] = lines[i].substring(4);
- }
-
- return lines.join('\n');
-}
-
-function LoadCodeArea(divSelector, initialFunctionCode) {
- $(divSelector).load("code_area.html", function() {
- SetCode(initialFunctionCode);
- });
-}
-
-function LoadLogWindow(divSelector) {
- $(divSelector).load("log_window.html");
-}
-
-function SetCode(func) {
- var codeHtml = '';
- codeHtml = codeHtml + BodyCodeOfFunction(func) + ' ';
- $("#highlighter").html(codeHtml);
-
- var runFunc = mapFunc(func);
-
- $('#btnRunCode').off('click');
- $('#btnRunCode').click(runFunc);
-}
-
-function CopyCode() {
- CopyTextArea("#txtCode", "#btnRunCopyCode");
-}
-
-function CopyResponseWindow() {
- CopyTextArea("#txtResponse", "#btnCopyResponse");
-}
-
-function CopyTextArea(textAreaSelector, buttonSelector) {
- $(textAreaSelector).select();
- document.execCommand('copy');
- window.getSelection().removeAllRanges();
-
- // Set focus on copy button - this will deselect text in copied area.
- $(buttonSelector).focus();
-}
-
-function ClearTextArea(textAreaSelector) {
- $(textAreaSelector).val("");
-}
diff --git a/demo/code-demo/settings_embed.html b/demo/code-demo/settings_embed.html
deleted file mode 100644
index c850640a..00000000
--- a/demo/code-demo/settings_embed.html
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
Embed Report
-
-
-
Select mode to embed your report in:
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/code-demo/settings_interact.html b/demo/code-demo/settings_interact.html
deleted file mode 100644
index 1e37e084..00000000
--- a/demo/code-demo/settings_interact.html
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
- Get Id
- Get pages
- Set page
- Set filters
- Get filters
- Remove filters
- Print
- Update settings
- Reload
- Refresh
- Full screen
- Exit full screen
-
-
-
-
- Set Active
- Set Filters
- Get Filters
- Remove Filters
-
-
-
-
- Page Changed
- Data Selected
- SaveAs Triggered
-
-
-
-
- Enter edit mode
- Enter view mode
- Save report
- SaveAs report
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/code-demo/step_authorize.html b/demo/code-demo/step_authorize.html
deleted file mode 100644
index 5bdceab1..00000000
--- a/demo/code-demo/step_authorize.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
Deprecation Note
-
- This sample is deprecated. please use the new sample available
-
here .
-
-
-
- The new sample accommodates the changes announced in the embedded offering described in
-
Power BI Documentation page .
-
-
-
-
Sample Report
- You can embed a sample report and interact with Power BI Embedded firsthand by clicking below.
-
-
- Embed sample report
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/code-demo/style/layout.css b/demo/code-demo/style/layout.css
deleted file mode 100644
index 279231e7..00000000
--- a/demo/code-demo/style/layout.css
+++ /dev/null
@@ -1,359 +0,0 @@
-body {
- min-width: 300px;
-}
-
-header
-{
- padding: 20px 40px;
-}
-
-.logo-text-span {
- color: rgb(0, 174, 239);
- font-family: 'Segoe UI Web Light', 'Segoe UI Light', 'Segoe WP Light', 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif;
- font-weight: normal;
- font-size: 28px;
-}
-
-#mainContent {
- position: relative;
- color: #404040;
- /* margin: 15px 30px; */
- float: left;
- width: 100%;
-}
-
-.content {
- position: relative;
- color: #404040;
- margin: 15px 30px;
- height: 100%;
-}
-
-#settings {
- width: 270px;
- margin-right: 20px;
-}
-
-#embedCodeDiv {
- width: 400px;
- margin-right: 20px;
- max-height: 300px;
- float: left;
-}
-
-#embedArea {
- clear: both;
- width: 100%;
- padding-left: 290px;
-}
-
-#reportContainer {
- width: 100%;
- height: 450px;
- background-color: white;
- padding: 0px;
- clear: both;
-}
-
-#logWindow {
- width: 400px;
- float: left;
-}
-
-.topPanel {
- margin-bottom: 10px;
-}
-
-.bottomPanel {
- width: 100%;
- margin-bottom: 10px;
- max-width: 100%;
-}
-
-#steps-nav-bar {
- width: 100%;
- font-size: 90%;
- border-bottom: 1px solid #E5E5E5;
- margin-bottom: 20px;
- padding-right: 0;
- margin-right: 0;
-}
-
-#steps-ul li {
- width: 32%;
- display: inline-block;
-}
-
-@media screen and (max-width: 320px) {
- header
- {
- padding: 15px 30px;
- }
-
- .logo-text-span {
- font-size: 90%;
- line-height: 42px;
- min-width: 295px;
- }
-
- .topPanel {
- height: 430px;
- width: 100%;
- }
-
- #embedCodeDiv {
- width: 100%;
- margin-bottom: 30px;
- margin-right: 0px;
- }
-
- #logWindow {
- width: 100%;
- }
-
- #settings {
- width: 100%;
- float: left;
- margin-right: 0px;
- }
-
- #reportContainer {
- width: 100%;
- height: 360px;
- }
-
- #embedArea {
- padding-left: 0px;
- }
-}
-
-@media screen and (max-width: 500px) {
- .top-ul li {
- float: left;
- margin-right: 15px;
- text-align: center;
- line-height: 22px;
- font-size: 13px;
- }
-}
-
-@media screen and (min-width: 321px) {
- header
- {
- padding: 15px 30px;
- }
-
- .logo-text-span {
- font-size: 110%;
- line-height: 42px;
- min-width: 295px;
- }
-
- .topPanel {
- height: 430px;
- width: 100%;
- }
-
- #embedCodeDiv {
- width: 100%;
- margin-bottom: 30px;
- margin-right: 0px;
- }
-
- #logWindow {
- width: 100%;
- }
-
- #settings {
- width: 100%;
- float: left;
- margin-right: 0px;
- }
-
- #reportContainer {
- width: 100%;
- height: 360px;
- }
-
- #embedArea {
- padding-left: 0px;
- }
-}
-
-@media screen and (min-width: 551px) {
- header
- {
- padding: 15px 10px;
- }
-
- .logo-text-span {
- font-size: 90%;
- line-height: 42px;
- min-width: 295px;
- }
-
- .topPanel {
- height: 330px;
- width: 100%;
- }
-
- #embedCodeDiv {
- width: 100%;
- margin-bottom: 30px;
- margin-right: 0px;
- }
-
- #logWindow {
- width: 100%;
- }
-
- #settings {
- width: 100%;
- float: left;
- margin-right: 0px;
- }
-
- #reportContainer {
- width: 100%;
- height: 360px;
- }
-
- #embedArea {
- padding-left: 0px;
- }
-}
-
-@media screen and (min-width: 861px) and (max-width: 1023px) {
- header
- {
- padding: 20px 40px;
- }
-
- .logo-text-span {
- font-size: 28px;
- }
-
- #embedCodeDiv {
- width: 49%;
- font-size: 90%;
- margin-right: 2%;
- }
-
- #logWindow {
- width: 49%;
- }
-
- #settings {
- float: none;
- width: 380px;
- }
-
- #reportContainer {
- width: 100%;
- height: 360px;
- }
-
- #embedArea {
- padding-left: 0px;
- }
-}
-
-@media screen and (min-width: 1024px) {
- header
- {
- padding: 20px 40px;
- }
-
- .logo-text-span {
- font-size: 28px;
- }
-
- #mainContent {
- width: 86.7%;
- margin-left: 0.8%;
- }
-
- #embedCodeDiv {
- width: 34%;
- font-size: 90%;
- margin-right: 1%;
- }
-
- #logWindow {
- width: 34%;
- }
-
- #settings {
- float: left;
- width: 30%;
- margin-right: 1%;
- }
-
- #operations-ul li {
- margin: 0px 2px;
- }
-
- #reportContainer {
- width: 100%;
- height: 380px;
- }
-
- .bottomPanel {
- margin-left: 0;
- width: 100%;
- }
-
- #steps-nav-bar {
- width: 13.3%;
- font-size: 90%;
- padding-right: 0.8%;
- border-right: 1px solid #E5E5E5;
- border-bottom: none;
- margin-bottom: 0px;
- }
-
- #steps-ul li {
- width: 100%;
- display: block;
- }
-}
-
-@media screen and (min-width: 1280px) {
- .logo-text-span {
- font-size: 28px;
- }
-
- .content {
- margin: 15px 20px;
- }
-
- .bottomPanel {
- max-width: 100%;
- margin-left: 0px;
- }
-
- .steps-ul li {
- font-size: 17px;
- }
-}
-
-
-@media screen and (min-width: 1600px) {
- .logo-text-span {
- font-size: 28px;
- }
-
- .content {
- margin: 15px 40px;
- }
-}
-
-@media screen and (min-width: 1800px) {
- .logo-text-span {
- font-size: 28px;
- }
-
- #reportContainer {
- height: 450px;
- }
-}
\ No newline at end of file
diff --git a/demo/code-demo/style/style.css b/demo/code-demo/style/style.css
deleted file mode 100644
index 09ffbe1b..00000000
--- a/demo/code-demo/style/style.css
+++ /dev/null
@@ -1,628 +0,0 @@
-html {
- margin:0;
- padding:0;
- height:100%;
-}
-
-body {
- background-color: rgb(241, 241, 241);
- font-family: 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif;
- margin:0;
- padding:0;
- height:100%;
-}
-
-h3 {
- margin: 0;
-}
-
-hr {
- border-color: #DDDDDD;
-}
-
-header {
- display: block;
- width: 100%;
- top: 0px;
- z-index: 1030;
- color: rgb(8, 122, 165);
- background-color: rgb(24, 24, 25);
- height: 100px;
-}
-
-a:hover, a:visited, a:link, a:active
-{
- text-decoration: none;
-}
-
-#nextStep {
- float: right;
-}
-
-#result-wrap {
- margin-top: 10px;
-}
-
-#user-embed-details {
- width: 100%;
-}
-
-#user-embed-details tr {
- width: 100%;
-}
-
-#user-embed-details input[type="text"] {
- width: 100%;
- border: none;
- margin-bottom: 5px;
-}
-
-#report-embed-table {
- width: 100%;
-}
-
-#report-embed-table tr {
- width: 100%;
-}
-
-.inputLine > span {
- width: 30%;
-}
-
-#report-embed-table input[type="text"] {
- width: 73%;
- border: none;
- margin-bottom: 5px;
-}
-
-#report-embed-checkbox input {
- width: auto;
- border: none;
- margin-bottom: 5px;
-}
-
-#oldSample {
- display: block;
- float: right;
- margin-right: 30px;
-}
-
-#deprecationNote {
- margin-bottom: 30px;
-}
-
-#deprecationNote .pageTitle {
- margin-bottom: 15px;
- font-weight: normal;
- color: red;
-}
-
-#sampleReportImgDiv img {
- width: 265px;
- height: 180px;
-}
-
-#sampleReportImgDiv {
- margin-top: 17px;
- margin-right: 32px;
- float: left;
-}
-
-#sampleReportDescription {
- float: left;
- margin-top: 17px;
- max-width: 400px;
-}
-
-a {
- text-decoration: none;
-}
-
-.btn.btn-margin {
- margin-bottom: 5px;
-}
-
-.halfWidth.right {
- width: 750px;
- min-height: 100px;
- float: left;
- padding-top: 10px;
- padding-bottom: 10px;
-}
-
-.halfWidth.left {
- width: 750px;
- min-height: 100px;
- float: left;
- padding-top: 10px;
- padding-bottom: 10px;
- margin-right: 40px;
-}
-
-.break-float {
- clear: both;
- width: 100%;
-}
-
-.pbi-line {
- display: inline-block;
- width: 100%;
-}
-
-#top-nav-bar {
- margin-top: 10px;
-}
-
-#top-nav-bar a {
- color: white;
- display: inline-block;
-}
-
-#top-nav-bar a:hover {
- color: rgb(8, 122, 165);
-}
-
-#top-nav-bar .active {
- color: rgb(0, 174, 239);
-}
-
-#steps-nav-bar a {
- color: black;
- display: inline-block;
-}
-
-#steps-nav-bar a:hover {
- font-weight: bold;
-}
-
-#steps-nav-bar .active {
- color: white;
-}
-
-.main-ul {
- list-style-type: none;
- margin: 0px 30px;
- padding: 0;
- overflow: hidden;
- float: right;
-}
-
-.main-ul .active {
- background-color: rgb(245, 211, 65);
-}
-
-.main-li {
- float: left;
-}
-
-.main-li a {
- display: block;
- color: black;
- text-align: center;
- padding: 0px 16px;
- text-decoration: none;
-}
-
-.main-li a:visited {
- display: block;
- color: black;
- text-align: center;
- padding: 0px 16px;
- text-decoration: none;
- background-color: rgb(245, 211, 65);
-}
-
-.main-li a:hover {
- display: block;
- color: black;
- text-align: center;
- padding: 0px 16px;
- text-decoration: none;
- background-color: rgb(245, 211, 65);
-}
-
-.main-li a:active {
- display: block;
- color: black;
- text-align: center;
- padding: 0px 16px;
- text-decoration: none;
- background-color: rgb(245, 211, 65);
-}
-
-.main-title {
- font-family: 'Segoe UI Web Light', 'Segoe UI Light', 'Segoe WP Light', 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif;
- font-size: 28px;
- font-weight: bold;
-}
-
-#navbar {
- float: left;
- width: 100%;
-}
-
-#top-ul-dev {
- float: left;
-}
-
-.top-ul {
- list-style-type: none;
- margin: 0px;
- overflow: hidden;
- -webkit-margin-before: 0;
- -webkit-padding-start: 0;
- line-height: 30px;
-}
-
-.top-ul li {
- float: left;
- margin-right: 40px;
- text-align: center;
- line-height: 22px;
- font-size: 17px;
-}
-
-#top-docs {
- margin-right: 0px;
-}
-
-.top-li-active {
- color: white;
- border-bottom: 1px solid white;
- padding-bottom: 3px;
-}
-
-#steps-ul-dev {
- float: left;
- width: 100%;
-}
-
-.steps-ul {
- list-style-type: none;
- margin: 0px;
- overflow: hidden;
- -webkit-margin-before: 0;
- -webkit-padding-start: 0;
- line-height: 30px;
- width: 100%;
-}
-
-.steps-ul li {
- float: none;
- text-align: left;
- line-height: 22px;
- font-weight: 400;
- height: 40px;
- width: 100%;
- margin-bottom: 10px;
- vertical-align: middle;
-}
-
-#steps-interact {
- margin-right: 0px;
-}
-
-.steps-li-active {
- color: white;
- text-decoration: none;
- background-color: #666666;
-}
-
-.operations-div {
- height: 100%;
- width: 95%;
- background-color: rgb(231, 232, 233);
- text-align: center;
- overflow-y: scroll;
- position: relative;
-}
-
-#operations-ul a {
- text-decoration: none;
- color: rgb(27, 27, 27);
- width: 100%;
- text-align: center;
-}
-
-#operations-ul li:hover {
- border-bottom: 3px solid #444444;
-}
-
-#operations-ul {
- -webkit-margin-before: 0;
- -webkit-margin-after: 0;
- -webkit-padding-start: 0;
-}
-
-#operations-ul li {
- margin: 0px 30px 0px 0px;
- display: inline-block;
- /* font-size: 14px; */
- color: #444444;
-}
-
-#operations-ul > .active {
- border-bottom: 3px #444444 solid;
-}
-
-#wrapper-operations-div {
- padding: 10px 20px 15px 20px;
- background-color: rgb(231, 232, 233);
- width: 100%;
- height: 300px;
- overflow: hidden;
- display: inline-block;
-}
-
-#report-operations-div::-webkit-scrollbar-track, #page-operations-div::-webkit-scrollbar-track, #events-operations-div::-webkit-scrollbar-track
-{
- border-radius: 10px;
- background-color: transparent;
-}
-
-#report-operations-div::-webkit-scrollbar, #page-operations-div::-webkit-scrollbar, #events-operations-div::-webkit-scrollbar
-{
- width:10px;
- height:10px;
- background-color: transparent;
-}
-
-#report-operations-div::-webkit-scrollbar-thumb, page-operations-div::-webkit-scrollbar-thumb, #events-operations-div::-webkit-scrollbar-thumb
-{
- border-radius: 10px;
- background-color: #888888;
-}
-
-#operations-ul-wrapper img {
- width: 20px;
- position: relative;
- top: 3px;
-}
-
-#operation-categories {
- margin-bottom: 0px;
-}
-
-#selected-catogory-button {
- background-color: transparent;
- border: none;
- color: rgb(27, 27, 27);
- min-width: 120px;
- text-align: left;
-}
-
-.function-ul {
- width: 100%;
- clear: both;
- margin: 0;
- padding: 0px 20px 0px 0px;
-}
-
-.function-ul li {
- width: 100%;
- clear: both;
- cursor: default;
-}
-
-.function-ul a {
- text-decoration: none;
- color: rgb(27, 27, 27);
-}
-
-.function-ul .active {
- background-color: rgb(88, 88, 90);
- color: white;
-}
-
-.function-ul a:hover {
- background-color: #888888;
-}
-
-.function-ul li {
- list-style-type: none;
- margin: 0px;
- overflow: hidden;
- -webkit-margin-before: 0;
- -webkit-padding-start: 0;
- margin: 5px 0px;
- text-align: left;
- padding: 3px;
-}
-
-.td-field-name {
- width: 130px;
- text-align: right;
- color: #888888;
- padding-right: 5px;
-}
-
-.pageTitle {
- margin-bottom: 10px;
-}
-
-.pageTitle h3 {
- margin-bottom: 15px;
- font-weight: normal;
-}
-
-.editorTitle {
- margin-bottom: 5px;
-}
-
-#GoToInteractStep {
- display: inline-block;
- position: relative;
-}
-
-.textAreaControls {
- text-align: right;
- position: relative;
- z-index: 1;
- height: 30px;
- padding: 10px 20px;
- font-size: 14px;
-}
-
-.textAreaControl {
- color: rgb(127, 127, 127);
- background-color: transparent;
- border: none;
- margin-right: 5px;
-}
-
-.textAreaControl img {
- width: 16px;
- height: 16px;
- position: relative;
- top: -2px;
-}
-
-.responseTextArea {
- width: 100%;
- height: 300px;
- border: none;
- padding-top: 40px;
- position: relative;
- top: -30px;
- padding-left: 10px;
- margin-bottom: -30px;
-}
-
-.responseDiv {
- width: 100%;
- float: left;
-}
-
-.blueButton {
- background-color: rgb(36, 169, 225);
- border: none;
- color: white;
- padding: 5px 30px;
-}
-
-.spacer {
- height: 10px;
-}
-
-.scrollbar
-{
- margin-left: 30px;
- float: left;
- height: 300px;
- width: 65px;
- background: #F5F5F5;
- overflow-y: scroll;
- margin-bottom: 25px;
-}
-
-#txtCode {
- width: 100%;
- height: 300px;
- border: none;
- padding: 20px;
- position: relative;
- top: -30px;
- background: #FFFFFF;
- overflow: auto;
- white-space: pre-wrap;
-}
-
-#GoToEmbedStepButton {
- margin-top: 12px;
-}
-
-#authStepDiv {
- max-width: 500px;
-}
-
-#report-embed-table .inputLine {
- margin: 5px 0px;
-}
-
-.pageTitle h4 {
- font-size: 18px;
- font-weight: normal;
- margin: 0px 0px 5px 0px;
-}
-
-.top-div {
- border-radius: 50%;
- width: 10px;
- height: 10px;
- display: inline-block;
- background-color: white;
- border: solid black 1px;
-}
-
-.active-top {
- background-color: rgb(36, 169, 225);
-}
-
-.step-div {
- border-radius: 50%;
- width: 10px;
- height: 10px;
- display: inline-block;
- background-color: white;
- border: solid black 1px;
-}
-
-.active-step {
- background-color: rgb(36, 169, 225);
-}
-
-.editorTitleText {
- display: inline-block;
-}
-
-#selected-catogory-button-wrapper img {
- width: 20px;
- position: relative;
- top: -1px;
-}
-
-.checkbox.input {
- width: auto;
-}
-
-.stepsButton {
-
-height: 100%;
-
-padding: 10px 0px 0px 10px;
-
-line-height: 20px;
-}
-
-.video {
- width: 90%;
- height: 500px;
- max-width: 800px;
-}
-
-.title {
- font-size: 17px;
- font-weight: 400px;
-}
-
-#embedModeInput {
-
-}
-
-#createModeInput {
- display: none;
-}
-
-.inputLineTitle {
- width: 25%;
- display: inline-block;
-}
-
-#modeSelector {
- margin-bottom: 20px;
- cursor: default;
-}
-
-#reportContainer iframe {
- border: none;
-}
\ No newline at end of file
diff --git a/demo/code-demo/style/syntaxHighlighterOverride.css b/demo/code-demo/style/syntaxHighlighterOverride.css
deleted file mode 100644
index 1f789f8b..00000000
--- a/demo/code-demo/style/syntaxHighlighterOverride.css
+++ /dev/null
@@ -1,10 +0,0 @@
-.syntaxhighlighter {
- overflow: hidden !important;
- margin: 0em !important;
- padding: 0em !important;
- top: -85px !important;
-}
-
-.syntaxhighlighter .line {
- white-space: pre-wrap !important;
-}
\ No newline at end of file
diff --git a/demo/code-demo/syntaxHighlighter/syntaxhighlighter.js b/demo/code-demo/syntaxHighlighter/syntaxhighlighter.js
deleted file mode 100644
index 7d773ec8..00000000
--- a/demo/code-demo/syntaxHighlighter/syntaxhighlighter.js
+++ /dev/null
@@ -1,3768 +0,0 @@
-/*!
- * SyntaxHighlighter
- * https://github.com/syntaxhighlighter/syntaxhighlighter
- *
- * SyntaxHighlighter is donationware. If you are using it, please donate.
- * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
- *
- * @version
- * 4.0.1 (Tue, 07 Mar 2017 15:42:46 GMT)
- *
- * @copyright
- * Copyright (C) 2004-2016 Alex Gorbatchev.
- *
- * @license
- * Dual licensed under the MIT and GPL licenses.
- */
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-/******/
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _core = __webpack_require__(1);
-
- Object.keys(_core).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _core[key];
- }
- });
- });
-
- var _domready = __webpack_require__(24);
-
- var _domready2 = _interopRequireDefault(_domready);
-
- var _core2 = _interopRequireDefault(_core);
-
- var _dasherize = __webpack_require__(25);
-
- var dasherize = _interopRequireWildcard(_dasherize);
-
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- // configured through the `--compat` parameter.
- if (false) {
- require('./compatibility_layer_v3');
- }
-
- (0, _domready2.default)(function () {
- return _core2.default.highlight(dasherize.object(window.syntaxhighlighterConfig || {}));
- });
-
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var optsParser = __webpack_require__(2),
- match = __webpack_require__(5),
- Renderer = __webpack_require__(9).default,
- utils = __webpack_require__(10),
- transformers = __webpack_require__(11),
- dom = __webpack_require__(17),
- config = __webpack_require__(18),
- defaults = __webpack_require__(19),
- HtmlScript = __webpack_require__(20);
-
- var sh = {
- Match: match.Match,
- Highlighter: __webpack_require__(22),
-
- config: __webpack_require__(18),
- regexLib: __webpack_require__(3).commonRegExp,
-
- /** Internal 'global' variables. */
- vars: {
- discoveredBrushes: null,
- highlighters: {}
- },
-
- /** This object is populated by user included external brush files. */
- brushes: {},
-
- /**
- * Finds all elements on the page which should be processes by SyntaxHighlighter.
- *
- * @param {Object} globalParams Optional parameters which override element's
- * parameters. Only used if element is specified.
- *
- * @param {Object} element Optional element to highlight. If none is
- * provided, all elements in the current document
- * are returned which qualify.
- *
- * @return {Array} Returns list of { target: DOMElement, params: Object } objects.
- */
- findElements: function findElements(globalParams, element) {
- var elements = element ? [element] : utils.toArray(document.getElementsByTagName(sh.config.tagName)),
- conf = sh.config,
- result = [];
-
- // support for feature
- elements = elements.concat(dom.getSyntaxHighlighterScriptTags());
-
- if (elements.length === 0) return result;
-
- for (var i = 0, l = elements.length; i < l; i++) {
- var item = {
- target: elements[i],
- // local params take precedence over globals
- params: optsParser.defaults(optsParser.parse(elements[i].className), globalParams)
- };
-
- if (item.params['brush'] == null) continue;
-
- result.push(item);
- }
-
- return result;
- },
-
- /**
- * Shorthand to highlight all elements on the page that are marked as
- * SyntaxHighlighter source code.
- *
- * @param {Object} globalParams Optional parameters which override element's
- * parameters. Only used if element is specified.
- *
- * @param {Object} element Optional element to highlight. If none is
- * provided, all elements in the current document
- * are highlighted.
- */
- highlight: function highlight(globalParams, element) {
- var elements = sh.findElements(globalParams, element),
- propertyName = 'innerHTML',
- brush = null,
- renderer,
- conf = sh.config;
-
- if (elements.length === 0) return;
-
- for (var i = 0, l = elements.length; i < l; i++) {
- var element = elements[i],
- target = element.target,
- params = element.params,
- brushName = params.brush,
- brush,
- matches,
- code;
-
- if (brushName == null) continue;
-
- brush = findBrush(brushName);
-
- if (!brush) continue;
-
- // local params take precedence over defaults
- params = optsParser.defaults(params || {}, defaults);
- params = optsParser.defaults(params, config);
-
- // Instantiate a brush
- if (params['html-script'] == true || defaults['html-script'] == true) {
- brush = new HtmlScript(findBrush('xml'), brush);
- brushName = 'htmlscript';
- } else {
- brush = new brush();
- }
-
- code = target[propertyName];
-
- // remove CDATA from tags if it's present
- if (conf.useScriptTags) code = stripCData(code);
-
- // Inject title if the attribute is present
- if ((target.title || '') != '') params.title = target.title;
-
- params['brush'] = brushName;
-
- code = transformers(code, params);
- matches = match.applyRegexList(code, brush.regexList, params);
- renderer = new Renderer(code, matches, params);
-
- element = dom.create('div');
- element.innerHTML = renderer.getHtml();
-
- // id = utils.guid();
- // element.id = highlighters.id(id);
- // highlighters.set(id, element);
-
- if (params.quickCode) dom.attachEvent(dom.findElement(element, '.code'), 'dblclick', dom.quickCodeHandler);
-
- // carry over ID
- if ((target.id || '') != '') element.id = target.id;
-
- target.parentNode.replaceChild(element, target);
- }
- }
- }; // end of sh
-
- /**
- * Displays an alert.
- * @param {String} str String to display.
- */
- function alert(str) {
- window.alert('SyntaxHighlighter\n\n' + str);
- };
-
- /**
- * Finds a brush by its alias.
- *
- * @param {String} alias Brush alias.
- * @param {Boolean} showAlert Suppresses the alert if false.
- * @return {Brush} Returns bursh constructor if found, null otherwise.
- */
- function findBrush(alias, showAlert) {
- var brushes = sh.vars.discoveredBrushes,
- result = null;
-
- if (brushes == null) {
- brushes = {};
-
- // Find all brushes
- for (var brushName in sh.brushes) {
- var brush = sh.brushes[brushName],
- aliases = brush.aliases;
-
- if (aliases == null) {
- continue;
- }
-
- brush.className = brush.className || brush.aliases[0];
- brush.brushName = brush.className || brushName.toLowerCase();
-
- for (var i = 0, l = aliases.length; i < l; i++) {
- brushes[aliases[i]] = brushName;
- }
- }
-
- sh.vars.discoveredBrushes = brushes;
- }
-
- result = sh.brushes[brushes[alias]];
-
- if (result == null && showAlert) alert(sh.config.strings.noBrush + alias);
-
- return result;
- };
-
- /**
- * Strips from content because it should be used
- * there in most cases for XHTML compliance.
- * @param {String} original Input code.
- * @return {String} Returns code without leading tags.
- */
- function stripCData(original) {
- var left = '',
-
- // for some reason IE inserts some leading blanks here
- copy = utils.trim(original),
- changed = false,
- leftLength = left.length,
- rightLength = right.length;
-
- if (copy.indexOf(left) == 0) {
- copy = copy.substring(leftLength);
- changed = true;
- }
-
- var copyLength = copy.length;
-
- if (copy.indexOf(right) == copyLength - rightLength) {
- copy = copy.substring(0, copyLength - rightLength);
- changed = true;
- }
-
- return changed ? copy : original;
- };
-
- var brushCounter = 0;
-
- exports.default = sh;
- var registerBrush = exports.registerBrush = function registerBrush(brush) {
- return sh.brushes['brush' + brushCounter++] = brush.default || brush;
- };
- var clearRegisteredBrushes = exports.clearRegisteredBrushes = function clearRegisteredBrushes() {
- sh.brushes = {};
- brushCounter = 0;
- };
-
- /* an EJS hook for `gulp build --brushes` command
- * */
-
- registerBrush(__webpack_require__(23));
-
- /*
-
- */
-
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var XRegExp = __webpack_require__(3).XRegExp;
-
- var BOOLEANS = { 'true': true, 'false': false };
-
- function camelize(key) {
- return key.replace(/-(\w+)/g, function (match, word) {
- return word.charAt(0).toUpperCase() + word.substr(1);
- });
- }
-
- function process(value) {
- var result = BOOLEANS[value];
- return result == null ? value : result;
- }
-
- module.exports = {
- defaults: function defaults(target, source) {
- for (var key in source || {}) {
- if (!target.hasOwnProperty(key)) target[key] = target[camelize(key)] = source[key];
- }return target;
- },
-
- parse: function parse(str) {
- var match,
- key,
- result = {},
- arrayRegex = XRegExp("^\\[(?(.*?))\\]$"),
- pos = 0,
- regex = XRegExp("(?[\\w-]+)" + "\\s*:\\s*" + "(?" + "[\\w%#-]+|" + // word
- "\\[.*?\\]|" + // [] array
- '".*?"|' + // "" string
- "'.*?'" + // '' string
- ")\\s*;?", "g");
-
- while ((match = XRegExp.exec(str, regex, pos)) != null) {
- var value = match.value.replace(/^['"]|['"]$/g, '') // strip quotes from end of strings
- ;
-
- // try to parse array value
- if (value != null && arrayRegex.test(value)) {
- var m = XRegExp.exec(value, arrayRegex);
- value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : [];
- }
-
- value = process(value);
- result[match.name] = result[camelize(match.name)] = value;
- pos = match.index + match[0].length;
- }
-
- return result;
- }
- };
-
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.commonRegExp = exports.XRegExp = undefined;
-
- var _xregexp = __webpack_require__(4);
-
- var _xregexp2 = _interopRequireDefault(_xregexp);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- exports.XRegExp = _xregexp2.default;
- var commonRegExp = exports.commonRegExp = {
- multiLineCComments: (0, _xregexp2.default)('/\\*.*?\\*/', 'gs'),
- singleLineCComments: /\/\/.*$/gm,
- singleLinePerlComments: /#.*$/gm,
- doubleQuotedString: /"([^\\"\n]|\\.)*"/g,
- singleQuotedString: /'([^\\'\n]|\\.)*'/g,
- multiLineDoubleQuotedString: (0, _xregexp2.default)('"([^\\\\"]|\\\\.)*"', 'gs'),
- multiLineSingleQuotedString: (0, _xregexp2.default)("'([^\\\\']|\\\\.)*'", 'gs'),
- xmlComments: (0, _xregexp2.default)('(<|<)!--.*?--(>|>)', 'gs'),
- url: /\w+:\/\/[\w-.\/?%&=:@;#]*/g,
- phpScriptTags: { left: /(<|<)\?(?:=|php)?/g, right: /\?(>|>)/g, 'eof': true },
- aspScriptTags: { left: /(<|<)%=?/g, right: /%(>|>)/g },
- scriptScriptTags: { left: /(<|<)\s*script.*?(>|>)/gi, right: /(<|<)\/\s*script\s*(>|>)/gi }
- };
-
-/***/ },
-/* 4 */
-/***/ function(module, exports) {
-
- /*!
- * XRegExp 3.1.0-dev
- *
- * Steven Levithan (c) 2007-2015 MIT License
- */
-
- /**
- * XRegExp provides augmented, extensible regular expressions. You get additional regex syntax and
- * flags, beyond what browsers support natively. XRegExp is also a regex utility belt with tools to
- * make your client-side grepping simpler and more powerful, while freeing you from related
- * cross-browser inconsistencies.
- */
-
- 'use strict';
-
- /* ==============================
- * Private variables
- * ============================== */
-
- // Property name used for extended regex instance data
-
- var REGEX_DATA = 'xregexp';
- // Optional features that can be installed and uninstalled
- var features = {
- astral: false,
- natives: false
- };
- // Native methods to use and restore ('native' is an ES3 reserved keyword)
- var nativ = {
- exec: RegExp.prototype.exec,
- test: RegExp.prototype.test,
- match: String.prototype.match,
- replace: String.prototype.replace,
- split: String.prototype.split
- };
- // Storage for fixed/extended native methods
- var fixed = {};
- // Storage for regexes cached by `XRegExp.cache`
- var regexCache = {};
- // Storage for pattern details cached by the `XRegExp` constructor
- var patternCache = {};
- // Storage for regex syntax tokens added internally or by `XRegExp.addToken`
- var tokens = [];
- // Token scopes
- var defaultScope = 'default';
- var classScope = 'class';
- // Regexes that match native regex syntax, including octals
- var nativeTokens = {
- // Any native multicharacter token in default scope, or any single character
- 'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/,
- // Any native multicharacter token in character class scope, or any single character
- 'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/
- };
- // Any backreference or dollar-prefixed character in replacement strings
- var replacementToken = /\$(?:{([\w$]+)}|(\d\d?|[\s\S]))/g;
- // Check for correct `exec` handling of nonparticipating capturing groups
- var correctExecNpcg = nativ.exec.call(/()??/, '')[1] === undefined;
- // Check for ES6 `u` flag support
- var hasNativeU = function () {
- var isSupported = true;
- try {
- new RegExp('', 'u');
- } catch (exception) {
- isSupported = false;
- }
- return isSupported;
- }();
- // Check for ES6 `y` flag support
- var hasNativeY = function () {
- var isSupported = true;
- try {
- new RegExp('', 'y');
- } catch (exception) {
- isSupported = false;
- }
- return isSupported;
- }();
- // Check for ES6 `flags` prop support
- var hasFlagsProp = /a/.flags !== undefined;
- // Tracker for known flags, including addon flags
- var registeredFlags = {
- g: true,
- i: true,
- m: true,
- u: hasNativeU,
- y: hasNativeY
- };
- // Shortcut to `Object.prototype.toString`
- var toString = {}.toString;
-
- /* ==============================
- * Private functions
- * ============================== */
-
- /**
- * Attaches extended data and `XRegExp.prototype` properties to a regex object.
- *
- * @private
- * @param {RegExp} regex Regex to augment.
- * @param {Array} captureNames Array with capture names, or `null`.
- * @param {String} xSource XRegExp pattern used to generate `regex`, or `null` if N/A.
- * @param {String} xFlags XRegExp flags used to generate `regex`, or `null` if N/A.
- * @param {Boolean} [isInternalOnly=false] Whether the regex will be used only for internal
- * operations, and never exposed to users. For internal-only regexes, we can improve perf by
- * skipping some operations like attaching `XRegExp.prototype` properties.
- * @returns {RegExp} Augmented regex.
- */
- function augment(regex, captureNames, xSource, xFlags, isInternalOnly) {
- var p;
-
- regex[REGEX_DATA] = {
- captureNames: captureNames
- };
-
- if (isInternalOnly) {
- return regex;
- }
-
- // Can't auto-inherit these since the XRegExp constructor returns a nonprimitive value
- if (regex.__proto__) {
- regex.__proto__ = XRegExp.prototype;
- } else {
- for (p in XRegExp.prototype) {
- // An `XRegExp.prototype.hasOwnProperty(p)` check wouldn't be worth it here, since
- // this is performance sensitive, and enumerable `Object.prototype` or
- // `RegExp.prototype` extensions exist on `regex.prototype` anyway
- regex[p] = XRegExp.prototype[p];
- }
- }
-
- regex[REGEX_DATA].source = xSource;
- // Emulate the ES6 `flags` prop by ensuring flags are in alphabetical order
- regex[REGEX_DATA].flags = xFlags ? xFlags.split('').sort().join('') : xFlags;
-
- return regex;
- }
-
- /**
- * Removes any duplicate characters from the provided string.
- *
- * @private
- * @param {String} str String to remove duplicate characters from.
- * @returns {String} String with any duplicate characters removed.
- */
- function clipDuplicates(str) {
- return nativ.replace.call(str, /([\s\S])(?=[\s\S]*\1)/g, '');
- }
-
- /**
- * Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype`
- * properties. The copy has a fresh `lastIndex` property (set to zero). Allows adding and removing
- * flags g and y while copying the regex.
- *
- * @private
- * @param {RegExp} regex Regex to copy.
- * @param {Object} [options] Options object with optional properties:
- * `addG` {Boolean} Add flag g while copying the regex.
- * `addY` {Boolean} Add flag y while copying the regex.
- * `removeG` {Boolean} Remove flag g while copying the regex.
- * `removeY` {Boolean} Remove flag y while copying the regex.
- * `isInternalOnly` {Boolean} Whether the copied regex will be used only for internal
- * operations, and never exposed to users. For internal-only regexes, we can improve perf by
- * skipping some operations like attaching `XRegExp.prototype` properties.
- * @returns {RegExp} Copy of the provided regex, possibly with modified flags.
- */
- function copyRegex(regex, options) {
- if (!XRegExp.isRegExp(regex)) {
- throw new TypeError('Type RegExp expected');
- }
-
- var xData = regex[REGEX_DATA] || {},
- flags = getNativeFlags(regex),
- flagsToAdd = '',
- flagsToRemove = '',
- xregexpSource = null,
- xregexpFlags = null;
-
- options = options || {};
-
- if (options.removeG) {
- flagsToRemove += 'g';
- }
- if (options.removeY) {
- flagsToRemove += 'y';
- }
- if (flagsToRemove) {
- flags = nativ.replace.call(flags, new RegExp('[' + flagsToRemove + ']+', 'g'), '');
- }
-
- if (options.addG) {
- flagsToAdd += 'g';
- }
- if (options.addY) {
- flagsToAdd += 'y';
- }
- if (flagsToAdd) {
- flags = clipDuplicates(flags + flagsToAdd);
- }
-
- if (!options.isInternalOnly) {
- if (xData.source !== undefined) {
- xregexpSource = xData.source;
- }
- // null or undefined; don't want to add to `flags` if the previous value was null, since
- // that indicates we're not tracking original precompilation flags
- if (xData.flags != null) {
- // Flags are only added for non-internal regexes by `XRegExp.globalize`. Flags are
- // never removed for non-internal regexes, so don't need to handle it
- xregexpFlags = flagsToAdd ? clipDuplicates(xData.flags + flagsToAdd) : xData.flags;
- }
- }
-
- // Augment with `XRegExp.prototype` properties, but use the native `RegExp` constructor to
- // avoid searching for special tokens. That would be wrong for regexes constructed by
- // `RegExp`, and unnecessary for regexes constructed by `XRegExp` because the regex has
- // already undergone the translation to native regex syntax
- regex = augment(new RegExp(regex.source, flags), hasNamedCapture(regex) ? xData.captureNames.slice(0) : null, xregexpSource, xregexpFlags, options.isInternalOnly);
-
- return regex;
- }
-
- /**
- * Converts hexadecimal to decimal.
- *
- * @private
- * @param {String} hex
- * @returns {Number}
- */
- function dec(hex) {
- return parseInt(hex, 16);
- }
-
- /**
- * Returns native `RegExp` flags used by a regex object.
- *
- * @private
- * @param {RegExp} regex Regex to check.
- * @returns {String} Native flags in use.
- */
- function getNativeFlags(regex) {
- return hasFlagsProp ? regex.flags :
- // Explicitly using `RegExp.prototype.toString` (rather than e.g. `String` or
- // concatenation with an empty string) allows this to continue working predictably when
- // `XRegExp.proptotype.toString` is overriden
- nativ.exec.call(/\/([a-z]*)$/i, RegExp.prototype.toString.call(regex))[1];
- }
-
- /**
- * Determines whether a regex has extended instance data used to track capture names.
- *
- * @private
- * @param {RegExp} regex Regex to check.
- * @returns {Boolean} Whether the regex uses named capture.
- */
- function hasNamedCapture(regex) {
- return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames);
- }
-
- /**
- * Converts decimal to hexadecimal.
- *
- * @private
- * @param {Number|String} dec
- * @returns {String}
- */
- function hex(dec) {
- return parseInt(dec, 10).toString(16);
- }
-
- /**
- * Returns the first index at which a given value can be found in an array.
- *
- * @private
- * @param {Array} array Array to search.
- * @param {*} value Value to locate in the array.
- * @returns {Number} Zero-based index at which the item is found, or -1.
- */
- function indexOf(array, value) {
- var len = array.length,
- i;
-
- for (i = 0; i < len; ++i) {
- if (array[i] === value) {
- return i;
- }
- }
-
- return -1;
- }
-
- /**
- * Determines whether a value is of the specified type, by resolving its internal [[Class]].
- *
- * @private
- * @param {*} value Object to check.
- * @param {String} type Type to check for, in TitleCase.
- * @returns {Boolean} Whether the object matches the type.
- */
- function isType(value, type) {
- return toString.call(value) === '[object ' + type + ']';
- }
-
- /**
- * Checks whether the next nonignorable token after the specified position is a quantifier.
- *
- * @private
- * @param {String} pattern Pattern to search within.
- * @param {Number} pos Index in `pattern` to search at.
- * @param {String} flags Flags used by the pattern.
- * @returns {Boolean} Whether the next token is a quantifier.
- */
- function isQuantifierNext(pattern, pos, flags) {
- return nativ.test.call(flags.indexOf('x') > -1 ?
- // Ignore any leading whitespace, line comments, and inline comments
- /^(?:\s+|#.*|\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/ :
- // Ignore any leading inline comments
- /^(?:\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/, pattern.slice(pos));
- }
-
- /**
- * Pads the provided string with as many leading zeros as needed to get to length 4. Used to produce
- * fixed-length hexadecimal values.
- *
- * @private
- * @param {String} str
- * @returns {String}
- */
- function pad4(str) {
- while (str.length < 4) {
- str = '0' + str;
- }
- return str;
- }
-
- /**
- * Checks for flag-related errors, and strips/applies flags in a leading mode modifier. Offloads
- * the flag preparation logic from the `XRegExp` constructor.
- *
- * @private
- * @param {String} pattern Regex pattern, possibly with a leading mode modifier.
- * @param {String} flags Any combination of flags.
- * @returns {Object} Object with properties `pattern` and `flags`.
- */
- function prepareFlags(pattern, flags) {
- var i;
-
- // Recent browsers throw on duplicate flags, so copy this behavior for nonnative flags
- if (clipDuplicates(flags) !== flags) {
- throw new SyntaxError('Invalid duplicate regex flag ' + flags);
- }
-
- // Strip and apply a leading mode modifier with any combination of flags except g or y
- pattern = nativ.replace.call(pattern, /^\(\?([\w$]+)\)/, function ($0, $1) {
- if (nativ.test.call(/[gy]/, $1)) {
- throw new SyntaxError('Cannot use flag g or y in mode modifier ' + $0);
- }
- // Allow duplicate flags within the mode modifier
- flags = clipDuplicates(flags + $1);
- return '';
- });
-
- // Throw on unknown native or nonnative flags
- for (i = 0; i < flags.length; ++i) {
- if (!registeredFlags[flags.charAt(i)]) {
- throw new SyntaxError('Unknown regex flag ' + flags.charAt(i));
- }
- }
-
- return {
- pattern: pattern,
- flags: flags
- };
- }
-
- /**
- * Prepares an options object from the given value.
- *
- * @private
- * @param {String|Object} value Value to convert to an options object.
- * @returns {Object} Options object.
- */
- function prepareOptions(value) {
- var options = {};
-
- if (isType(value, 'String')) {
- XRegExp.forEach(value, /[^\s,]+/, function (match) {
- options[match] = true;
- });
-
- return options;
- }
-
- return value;
- }
-
- /**
- * Registers a flag so it doesn't throw an 'unknown flag' error.
- *
- * @private
- * @param {String} flag Single-character flag to register.
- */
- function registerFlag(flag) {
- if (!/^[\w$]$/.test(flag)) {
- throw new Error('Flag must be a single character A-Za-z0-9_$');
- }
-
- registeredFlags[flag] = true;
- }
-
- /**
- * Runs built-in and custom regex syntax tokens in reverse insertion order at the specified
- * position, until a match is found.
- *
- * @private
- * @param {String} pattern Original pattern from which an XRegExp object is being built.
- * @param {String} flags Flags being used to construct the regex.
- * @param {Number} pos Position to search for tokens within `pattern`.
- * @param {Number} scope Regex scope to apply: 'default' or 'class'.
- * @param {Object} context Context object to use for token handler functions.
- * @returns {Object} Object with properties `matchLength`, `output`, and `reparse`; or `null`.
- */
- function runTokens(pattern, flags, pos, scope, context) {
- var i = tokens.length,
- leadChar = pattern.charAt(pos),
- result = null,
- match,
- t;
-
- // Run in reverse insertion order
- while (i--) {
- t = tokens[i];
- if (t.leadChar && t.leadChar !== leadChar || t.scope !== scope && t.scope !== 'all' || t.flag && flags.indexOf(t.flag) === -1) {
- continue;
- }
-
- match = XRegExp.exec(pattern, t.regex, pos, 'sticky');
- if (match) {
- result = {
- matchLength: match[0].length,
- output: t.handler.call(context, match, scope, flags),
- reparse: t.reparse
- };
- // Finished with token tests
- break;
- }
- }
-
- return result;
- }
-
- /**
- * Enables or disables implicit astral mode opt-in. When enabled, flag A is automatically added to
- * all new regexes created by XRegExp. This causes an error to be thrown when creating regexes if
- * the Unicode Base addon is not available, since flag A is registered by that addon.
- *
- * @private
- * @param {Boolean} on `true` to enable; `false` to disable.
- */
- function setAstral(on) {
- features.astral = on;
- }
-
- /**
- * Enables or disables native method overrides.
- *
- * @private
- * @param {Boolean} on `true` to enable; `false` to disable.
- */
- function setNatives(on) {
- RegExp.prototype.exec = (on ? fixed : nativ).exec;
- RegExp.prototype.test = (on ? fixed : nativ).test;
- String.prototype.match = (on ? fixed : nativ).match;
- String.prototype.replace = (on ? fixed : nativ).replace;
- String.prototype.split = (on ? fixed : nativ).split;
-
- features.natives = on;
- }
-
- /**
- * Returns the object, or throws an error if it is `null` or `undefined`. This is used to follow
- * the ES5 abstract operation `ToObject`.
- *
- * @private
- * @param {*} value Object to check and return.
- * @returns {*} The provided object.
- */
- function toObject(value) {
- // null or undefined
- if (value == null) {
- throw new TypeError('Cannot convert null or undefined to object');
- }
-
- return value;
- }
-
- /* ==============================
- * Constructor
- * ============================== */
-
- /**
- * Creates an extended regular expression object for matching text with a pattern. Differs from a
- * native regular expression in that additional syntax and flags are supported. The returned object
- * is in fact a native `RegExp` and works with all native methods.
- *
- * @class XRegExp
- * @constructor
- * @param {String|RegExp} pattern Regex pattern string, or an existing regex object to copy.
- * @param {String} [flags] Any combination of flags.
- * Native flags:
- * `g` - global
- * `i` - ignore case
- * `m` - multiline anchors
- * `u` - unicode (ES6)
- * `y` - sticky (Firefox 3+, ES6)
- * Additional XRegExp flags:
- * `n` - explicit capture
- * `s` - dot matches all (aka singleline)
- * `x` - free-spacing and line comments (aka extended)
- * `A` - astral (requires the Unicode Base addon)
- * Flags cannot be provided when constructing one `RegExp` from another.
- * @returns {RegExp} Extended regular expression object.
- * @example
- *
- * // With named capture and flag x
- * XRegExp('(? [0-9]{4} ) -? # year \n\
- * (? [0-9]{2} ) -? # month \n\
- * (? [0-9]{2} ) # day ', 'x');
- *
- * // Providing a regex object copies it. Native regexes are recompiled using native (not XRegExp)
- * // syntax. Copies maintain extended data, are augmented with `XRegExp.prototype` properties, and
- * // have fresh `lastIndex` properties (set to zero).
- * XRegExp(/regex/);
- */
- function XRegExp(pattern, flags) {
- var context = {
- hasNamedCapture: false,
- captureNames: []
- },
- scope = defaultScope,
- output = '',
- pos = 0,
- result,
- token,
- generated,
- appliedPattern,
- appliedFlags;
-
- if (XRegExp.isRegExp(pattern)) {
- if (flags !== undefined) {
- throw new TypeError('Cannot supply flags when copying a RegExp');
- }
- return copyRegex(pattern);
- }
-
- // Copy the argument behavior of `RegExp`
- pattern = pattern === undefined ? '' : String(pattern);
- flags = flags === undefined ? '' : String(flags);
-
- if (XRegExp.isInstalled('astral') && flags.indexOf('A') === -1) {
- // This causes an error to be thrown if the Unicode Base addon is not available
- flags += 'A';
- }
-
- if (!patternCache[pattern]) {
- patternCache[pattern] = {};
- }
-
- if (!patternCache[pattern][flags]) {
- // Check for flag-related errors, and strip/apply flags in a leading mode modifier
- result = prepareFlags(pattern, flags);
- appliedPattern = result.pattern;
- appliedFlags = result.flags;
-
- // Use XRegExp's tokens to translate the pattern to a native regex pattern.
- // `appliedPattern.length` may change on each iteration if tokens use `reparse`
- while (pos < appliedPattern.length) {
- do {
- // Check for custom tokens at the current position
- result = runTokens(appliedPattern, appliedFlags, pos, scope, context);
- // If the matched token used the `reparse` option, splice its output into the
- // pattern before running tokens again at the same position
- if (result && result.reparse) {
- appliedPattern = appliedPattern.slice(0, pos) + result.output + appliedPattern.slice(pos + result.matchLength);
- }
- } while (result && result.reparse);
-
- if (result) {
- output += result.output;
- pos += result.matchLength || 1;
- } else {
- // Get the native token at the current position
- token = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky')[0];
- output += token;
- pos += token.length;
- if (token === '[' && scope === defaultScope) {
- scope = classScope;
- } else if (token === ']' && scope === classScope) {
- scope = defaultScope;
- }
- }
- }
-
- patternCache[pattern][flags] = {
- // Cleanup token cruft: repeated `(?:)(?:)` and leading/trailing `(?:)`
- pattern: nativ.replace.call(output, /\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??(?=\(\?:\))|^\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??|\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??$/g, ''),
- // Strip all but native flags
- flags: nativ.replace.call(appliedFlags, /[^gimuy]+/g, ''),
- // `context.captureNames` has an item for each capturing group, even if unnamed
- captures: context.hasNamedCapture ? context.captureNames : null
- };
- }
-
- generated = patternCache[pattern][flags];
- return augment(new RegExp(generated.pattern, generated.flags), generated.captures, pattern, flags);
- };
-
- // Add `RegExp.prototype` to the prototype chain
- XRegExp.prototype = new RegExp();
-
- /* ==============================
- * Public properties
- * ============================== */
-
- /**
- * The XRegExp version number as a string containing three dot-separated parts. For example,
- * '2.0.0-beta-3'.
- *
- * @static
- * @memberOf XRegExp
- * @type String
- */
- XRegExp.version = '3.1.0-dev';
-
- /* ==============================
- * Public methods
- * ============================== */
-
- /**
- * Extends XRegExp syntax and allows custom flags. This is used internally and can be used to
- * create XRegExp addons. If more than one token can match the same string, the last added wins.
- *
- * @memberOf XRegExp
- * @param {RegExp} regex Regex object that matches the new token.
- * @param {Function} handler Function that returns a new pattern string (using native regex syntax)
- * to replace the matched token within all future XRegExp regexes. Has access to persistent
- * properties of the regex being built, through `this`. Invoked with three arguments:
- * The match array, with named backreference properties.
- * The regex scope where the match was found: 'default' or 'class'.
- * The flags used by the regex, including any flags in a leading mode modifier.
- * The handler function becomes part of the XRegExp construction process, so be careful not to
- * construct XRegExps within the function or you will trigger infinite recursion.
- * @param {Object} [options] Options object with optional properties:
- * `scope` {String} Scope where the token applies: 'default', 'class', or 'all'.
- * `flag` {String} Single-character flag that triggers the token. This also registers the
- * flag, which prevents XRegExp from throwing an 'unknown flag' error when the flag is used.
- * `optionalFlags` {String} Any custom flags checked for within the token `handler` that are
- * not required to trigger the token. This registers the flags, to prevent XRegExp from
- * throwing an 'unknown flag' error when any of the flags are used.
- * `reparse` {Boolean} Whether the `handler` function's output should not be treated as
- * final, and instead be reparseable by other tokens (including the current token). Allows
- * token chaining or deferring.
- * `leadChar` {String} Single character that occurs at the beginning of any successful match
- * of the token (not always applicable). This doesn't change the behavior of the token unless
- * you provide an erroneous value. However, providing it can increase the token's performance
- * since the token can be skipped at any positions where this character doesn't appear.
- * @example
- *
- * // Basic usage: Add \a for the ALERT control code
- * XRegExp.addToken(
- * /\\a/,
- * function() {return '\\x07';},
- * {scope: 'all'}
- * );
- * XRegExp('\\a[\\a-\\n]+').test('\x07\n\x07'); // -> true
- *
- * // Add the U (ungreedy) flag from PCRE and RE2, which reverses greedy and lazy quantifiers.
- * // Since `scope` is not specified, it uses 'default' (i.e., transformations apply outside of
- * // character classes only)
- * XRegExp.addToken(
- * /([?*+]|{\d+(?:,\d*)?})(\??)/,
- * function(match) {return match[1] + (match[2] ? '' : '?');},
- * {flag: 'U'}
- * );
- * XRegExp('a+', 'U').exec('aaa')[0]; // -> 'a'
- * XRegExp('a+?', 'U').exec('aaa')[0]; // -> 'aaa'
- */
- XRegExp.addToken = function (regex, handler, options) {
- options = options || {};
- var optionalFlags = options.optionalFlags,
- i;
-
- if (options.flag) {
- registerFlag(options.flag);
- }
-
- if (optionalFlags) {
- optionalFlags = nativ.split.call(optionalFlags, '');
- for (i = 0; i < optionalFlags.length; ++i) {
- registerFlag(optionalFlags[i]);
- }
- }
-
- // Add to the private list of syntax tokens
- tokens.push({
- regex: copyRegex(regex, {
- addG: true,
- addY: hasNativeY,
- isInternalOnly: true
- }),
- handler: handler,
- scope: options.scope || defaultScope,
- flag: options.flag,
- reparse: options.reparse,
- leadChar: options.leadChar
- });
-
- // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and
- // flags might now produce different results
- XRegExp.cache.flush('patterns');
- };
-
- /**
- * Caches and returns the result of calling `XRegExp(pattern, flags)`. On any subsequent call with
- * the same pattern and flag combination, the cached copy of the regex is returned.
- *
- * @memberOf XRegExp
- * @param {String} pattern Regex pattern string.
- * @param {String} [flags] Any combination of XRegExp flags.
- * @returns {RegExp} Cached XRegExp object.
- * @example
- *
- * while (match = XRegExp.cache('.', 'gs').exec(str)) {
- * // The regex is compiled once only
- * }
- */
- XRegExp.cache = function (pattern, flags) {
- if (!regexCache[pattern]) {
- regexCache[pattern] = {};
- }
- return regexCache[pattern][flags] || (regexCache[pattern][flags] = XRegExp(pattern, flags));
- };
-
- // Intentionally undocumented
- XRegExp.cache.flush = function (cacheName) {
- if (cacheName === 'patterns') {
- // Flush the pattern cache used by the `XRegExp` constructor
- patternCache = {};
- } else {
- // Flush the regex cache populated by `XRegExp.cache`
- regexCache = {};
- }
- };
-
- /**
- * Escapes any regular expression metacharacters, for use when matching literal strings. The result
- * can safely be used at any point within a regex that uses any flags.
- *
- * @memberOf XRegExp
- * @param {String} str String to escape.
- * @returns {String} String with regex metacharacters escaped.
- * @example
- *
- * XRegExp.escape('Escaped? <.>');
- * // -> 'Escaped\?\ <\.>'
- */
- XRegExp.escape = function (str) {
- return nativ.replace.call(toObject(str), /[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
- };
-
- /**
- * Executes a regex search in a specified string. Returns a match array or `null`. If the provided
- * regex uses named capture, named backreference properties are included on the match array.
- * Optional `pos` and `sticky` arguments specify the search start position, and whether the match
- * must start at the specified position only. The `lastIndex` property of the provided regex is not
- * used, but is updated for compatibility. Also fixes browser bugs compared to the native
- * `RegExp.prototype.exec` and can be used reliably cross-browser.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp} regex Regex to search with.
- * @param {Number} [pos=0] Zero-based index at which to start the search.
- * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position
- * only. The string `'sticky'` is accepted as an alternative to `true`.
- * @returns {Array} Match array with named backreference properties, or `null`.
- * @example
- *
- * // Basic use, with named backreference
- * var match = XRegExp.exec('U+2620', XRegExp('U\\+(?[0-9A-F]{4})'));
- * match.hex; // -> '2620'
- *
- * // With pos and sticky, in a loop
- * var pos = 2, result = [], match;
- * while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
- * result.push(match[1]);
- * pos = match.index + match[0].length;
- * }
- * // result -> ['2', '3', '4']
- */
- XRegExp.exec = function (str, regex, pos, sticky) {
- var cacheKey = 'g',
- addY = false,
- match,
- r2;
-
- addY = hasNativeY && !!(sticky || regex.sticky && sticky !== false);
- if (addY) {
- cacheKey += 'y';
- }
-
- regex[REGEX_DATA] = regex[REGEX_DATA] || {};
-
- // Shares cached copies with `XRegExp.match`/`replace`
- r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
- addG: true,
- addY: addY,
- removeY: sticky === false,
- isInternalOnly: true
- }));
-
- r2.lastIndex = pos = pos || 0;
-
- // Fixed `exec` required for `lastIndex` fix, named backreferences, etc.
- match = fixed.exec.call(r2, str);
-
- if (sticky && match && match.index !== pos) {
- match = null;
- }
-
- if (regex.global) {
- regex.lastIndex = match ? r2.lastIndex : 0;
- }
-
- return match;
- };
-
- /**
- * Executes a provided function once per regex match. Searches always start at the beginning of the
- * string and continue until the end, regardless of the state of the regex's `global` property and
- * initial `lastIndex`.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp} regex Regex to search with.
- * @param {Function} callback Function to execute for each match. Invoked with four arguments:
- * The match array, with named backreference properties.
- * The zero-based match index.
- * The string being traversed.
- * The regex object being used to traverse the string.
- * @example
- *
- * // Extracts every other digit from a string
- * var evens = [];
- * XRegExp.forEach('1a2345', /\d/, function(match, i) {
- * if (i % 2) evens.push(+match[0]);
- * });
- * // evens -> [2, 4]
- */
- XRegExp.forEach = function (str, regex, callback) {
- var pos = 0,
- i = -1,
- match;
-
- while (match = XRegExp.exec(str, regex, pos)) {
- // Because `regex` is provided to `callback`, the function could use the deprecated/
- // nonstandard `RegExp.prototype.compile` to mutate the regex. However, since
- // `XRegExp.exec` doesn't use `lastIndex` to set the search position, this can't lead
- // to an infinite loop, at least. Actually, because of the way `XRegExp.exec` caches
- // globalized versions of regexes, mutating the regex will not have any effect on the
- // iteration or matched strings, which is a nice side effect that brings extra safety
- callback(match, ++i, str, regex);
-
- pos = match.index + (match[0].length || 1);
- }
- };
-
- /**
- * Copies a regex object and adds flag `g`. The copy maintains extended data, is augmented with
- * `XRegExp.prototype` properties, and has a fresh `lastIndex` property (set to zero). Native
- * regexes are not recompiled using XRegExp syntax.
- *
- * @memberOf XRegExp
- * @param {RegExp} regex Regex to globalize.
- * @returns {RegExp} Copy of the provided regex with flag `g` added.
- * @example
- *
- * var globalCopy = XRegExp.globalize(/regex/);
- * globalCopy.global; // -> true
- */
- XRegExp.globalize = function (regex) {
- return copyRegex(regex, { addG: true });
- };
-
- /**
- * Installs optional features according to the specified options. Can be undone using
- * {@link #XRegExp.uninstall}.
- *
- * @memberOf XRegExp
- * @param {Object|String} options Options object or string.
- * @example
- *
- * // With an options object
- * XRegExp.install({
- * // Enables support for astral code points in Unicode addons (implicitly sets flag A)
- * astral: true,
- *
- * // Overrides native regex methods with fixed/extended versions that support named
- * // backreferences and fix numerous cross-browser bugs
- * natives: true
- * });
- *
- * // With an options string
- * XRegExp.install('astral natives');
- */
- XRegExp.install = function (options) {
- options = prepareOptions(options);
-
- if (!features.astral && options.astral) {
- setAstral(true);
- }
-
- if (!features.natives && options.natives) {
- setNatives(true);
- }
- };
-
- /**
- * Checks whether an individual optional feature is installed.
- *
- * @memberOf XRegExp
- * @param {String} feature Name of the feature to check. One of:
- * `natives`
- * `astral`
- * @returns {Boolean} Whether the feature is installed.
- * @example
- *
- * XRegExp.isInstalled('natives');
- */
- XRegExp.isInstalled = function (feature) {
- return !!features[feature];
- };
-
- /**
- * Returns `true` if an object is a regex; `false` if it isn't. This works correctly for regexes
- * created in another frame, when `instanceof` and `constructor` checks would fail.
- *
- * @memberOf XRegExp
- * @param {*} value Object to check.
- * @returns {Boolean} Whether the object is a `RegExp` object.
- * @example
- *
- * XRegExp.isRegExp('string'); // -> false
- * XRegExp.isRegExp(/regex/i); // -> true
- * XRegExp.isRegExp(RegExp('^', 'm')); // -> true
- * XRegExp.isRegExp(XRegExp('(?s).')); // -> true
- */
- XRegExp.isRegExp = function (value) {
- return toString.call(value) === '[object RegExp]';
- //return isType(value, 'RegExp');
- };
-
- /**
- * Returns the first matched string, or in global mode, an array containing all matched strings.
- * This is essentially a more convenient re-implementation of `String.prototype.match` that gives
- * the result types you actually want (string instead of `exec`-style array in match-first mode,
- * and an empty array instead of `null` when no matches are found in match-all mode). It also lets
- * you override flag g and ignore `lastIndex`, and fixes browser bugs.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp} regex Regex to search with.
- * @param {String} [scope='one'] Use 'one' to return the first match as a string. Use 'all' to
- * return an array of all matched strings. If not explicitly specified and `regex` uses flag g,
- * `scope` is 'all'.
- * @returns {String|Array} In match-first mode: First match as a string, or `null`. In match-all
- * mode: Array of all matched strings, or an empty array.
- * @example
- *
- * // Match first
- * XRegExp.match('abc', /\w/); // -> 'a'
- * XRegExp.match('abc', /\w/g, 'one'); // -> 'a'
- * XRegExp.match('abc', /x/g, 'one'); // -> null
- *
- * // Match all
- * XRegExp.match('abc', /\w/g); // -> ['a', 'b', 'c']
- * XRegExp.match('abc', /\w/, 'all'); // -> ['a', 'b', 'c']
- * XRegExp.match('abc', /x/, 'all'); // -> []
- */
- XRegExp.match = function (str, regex, scope) {
- var global = regex.global && scope !== 'one' || scope === 'all',
- cacheKey = (global ? 'g' : '') + (regex.sticky ? 'y' : '') || 'noGY',
- result,
- r2;
-
- regex[REGEX_DATA] = regex[REGEX_DATA] || {};
-
- // Shares cached copies with `XRegExp.exec`/`replace`
- r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
- addG: !!global,
- addY: !!regex.sticky,
- removeG: scope === 'one',
- isInternalOnly: true
- }));
-
- result = nativ.match.call(toObject(str), r2);
-
- if (regex.global) {
- regex.lastIndex = scope === 'one' && result ?
- // Can't use `r2.lastIndex` since `r2` is nonglobal in this case
- result.index + result[0].length : 0;
- }
-
- return global ? result || [] : result && result[0];
- };
-
- /**
- * Retrieves the matches from searching a string using a chain of regexes that successively search
- * within previous matches. The provided `chain` array can contain regexes and or objects with
- * `regex` and `backref` properties. When a backreference is specified, the named or numbered
- * backreference is passed forward to the next regex or returned.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {Array} chain Regexes that each search for matches within preceding results.
- * @returns {Array} Matches by the last regex in the chain, or an empty array.
- * @example
- *
- * // Basic usage; matches numbers within tags
- * XRegExp.matchChain('1 2 3 4 a 56 ', [
- * XRegExp('(?is).*? '),
- * /\d+/
- * ]);
- * // -> ['2', '4', '56']
- *
- * // Passing forward and returning specific backreferences
- * html = 'XRegExp \
- * Google ';
- * XRegExp.matchChain(html, [
- * {regex: //i, backref: 1},
- * {regex: XRegExp('(?i)^https?://(?[^/?#]+)'), backref: 'domain'}
- * ]);
- * // -> ['xregexp.com', 'www.google.com']
- */
- XRegExp.matchChain = function (str, chain) {
- return function recurseChain(values, level) {
- var item = chain[level].regex ? chain[level] : { regex: chain[level] },
- matches = [],
- addMatch = function addMatch(match) {
- if (item.backref) {
- /* Safari 4.0.5 (but not 5.0.5+) inappropriately uses sparse arrays to hold
- * the `undefined`s for backreferences to nonparticipating capturing
- * groups. In such cases, a `hasOwnProperty` or `in` check on its own would
- * inappropriately throw the exception, so also check if the backreference
- * is a number that is within the bounds of the array.
- */
- if (!(match.hasOwnProperty(item.backref) || +item.backref < match.length)) {
- throw new ReferenceError('Backreference to undefined group: ' + item.backref);
- }
-
- matches.push(match[item.backref] || '');
- } else {
- matches.push(match[0]);
- }
- },
- i;
-
- for (i = 0; i < values.length; ++i) {
- XRegExp.forEach(values[i], item.regex, addMatch);
- }
-
- return level === chain.length - 1 || !matches.length ? matches : recurseChain(matches, level + 1);
- }([str], 0);
- };
-
- /**
- * Returns a new string with one or all matches of a pattern replaced. The pattern can be a string
- * or regex, and the replacement can be a string or a function to be called for each match. To
- * perform a global search and replace, use the optional `scope` argument or include flag g if using
- * a regex. Replacement strings can use `${n}` for named and numbered backreferences. Replacement
- * functions can use named backreferences via `arguments[0].name`. Also fixes browser bugs compared
- * to the native `String.prototype.replace` and can be used reliably cross-browser.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp|String} search Search pattern to be replaced.
- * @param {String|Function} replacement Replacement string or a function invoked to create it.
- * Replacement strings can include special replacement syntax:
- * $$ - Inserts a literal $ character.
- * $&, $0 - Inserts the matched substring.
- * $` - Inserts the string that precedes the matched substring (left context).
- * $' - Inserts the string that follows the matched substring (right context).
- * $n, $nn - Where n/nn are digits referencing an existent capturing group, inserts
- * backreference n/nn.
- * ${n} - Where n is a name or any number of digits that reference an existent capturing
- * group, inserts backreference n.
- * Replacement functions are invoked with three or more arguments:
- * The matched substring (corresponds to $& above). Named backreferences are accessible as
- * properties of this first argument.
- * 0..n arguments, one for each backreference (corresponding to $1, $2, etc. above).
- * The zero-based index of the match within the total search string.
- * The total string being searched.
- * @param {String} [scope='one'] Use 'one' to replace the first match only, or 'all'. If not
- * explicitly specified and using a regex with flag g, `scope` is 'all'.
- * @returns {String} New string with one or all matches replaced.
- * @example
- *
- * // Regex search, using named backreferences in replacement string
- * var name = XRegExp('(?\\w+) (?\\w+)');
- * XRegExp.replace('John Smith', name, '${last}, ${first}');
- * // -> 'Smith, John'
- *
- * // Regex search, using named backreferences in replacement function
- * XRegExp.replace('John Smith', name, function(match) {
- * return match.last + ', ' + match.first;
- * });
- * // -> 'Smith, John'
- *
- * // String search, with replace-all
- * XRegExp.replace('RegExp builds RegExps', 'RegExp', 'XRegExp', 'all');
- * // -> 'XRegExp builds XRegExps'
- */
- XRegExp.replace = function (str, search, replacement, scope) {
- var isRegex = XRegExp.isRegExp(search),
- global = search.global && scope !== 'one' || scope === 'all',
- cacheKey = (global ? 'g' : '') + (search.sticky ? 'y' : '') || 'noGY',
- s2 = search,
- result;
-
- if (isRegex) {
- search[REGEX_DATA] = search[REGEX_DATA] || {};
-
- // Shares cached copies with `XRegExp.exec`/`match`. Since a copy is used, `search`'s
- // `lastIndex` isn't updated *during* replacement iterations
- s2 = search[REGEX_DATA][cacheKey] || (search[REGEX_DATA][cacheKey] = copyRegex(search, {
- addG: !!global,
- addY: !!search.sticky,
- removeG: scope === 'one',
- isInternalOnly: true
- }));
- } else if (global) {
- s2 = new RegExp(XRegExp.escape(String(search)), 'g');
- }
-
- // Fixed `replace` required for named backreferences, etc.
- result = fixed.replace.call(toObject(str), s2, replacement);
-
- if (isRegex && search.global) {
- // Fixes IE, Safari bug (last tested IE 9, Safari 5.1)
- search.lastIndex = 0;
- }
-
- return result;
- };
-
- /**
- * Performs batch processing of string replacements. Used like {@link #XRegExp.replace}, but
- * accepts an array of replacement details. Later replacements operate on the output of earlier
- * replacements. Replacement details are accepted as an array with a regex or string to search for,
- * the replacement string or function, and an optional scope of 'one' or 'all'. Uses the XRegExp
- * replacement text syntax, which supports named backreference properties via `${name}`.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {Array} replacements Array of replacement detail arrays.
- * @returns {String} New string with all replacements.
- * @example
- *
- * str = XRegExp.replaceEach(str, [
- * [XRegExp('(?a)'), 'z${name}'],
- * [/b/gi, 'y'],
- * [/c/g, 'x', 'one'], // scope 'one' overrides /g
- * [/d/, 'w', 'all'], // scope 'all' overrides lack of /g
- * ['e', 'v', 'all'], // scope 'all' allows replace-all for strings
- * [/f/g, function($0) {
- * return $0.toUpperCase();
- * }]
- * ]);
- */
- XRegExp.replaceEach = function (str, replacements) {
- var i, r;
-
- for (i = 0; i < replacements.length; ++i) {
- r = replacements[i];
- str = XRegExp.replace(str, r[0], r[1], r[2]);
- }
-
- return str;
- };
-
- /**
- * Splits a string into an array of strings using a regex or string separator. Matches of the
- * separator are not included in the result array. However, if `separator` is a regex that contains
- * capturing groups, backreferences are spliced into the result each time `separator` is matched.
- * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably
- * cross-browser.
- *
- * @memberOf XRegExp
- * @param {String} str String to split.
- * @param {RegExp|String} separator Regex or string to use for separating the string.
- * @param {Number} [limit] Maximum number of items to include in the result array.
- * @returns {Array} Array of substrings.
- * @example
- *
- * // Basic use
- * XRegExp.split('a b c', ' ');
- * // -> ['a', 'b', 'c']
- *
- * // With limit
- * XRegExp.split('a b c', ' ', 2);
- * // -> ['a', 'b']
- *
- * // Backreferences in result array
- * XRegExp.split('..word1..', /([a-z]+)(\d+)/i);
- * // -> ['..', 'word', '1', '..']
- */
- XRegExp.split = function (str, separator, limit) {
- return fixed.split.call(toObject(str), separator, limit);
- };
-
- /**
- * Executes a regex search in a specified string. Returns `true` or `false`. Optional `pos` and
- * `sticky` arguments specify the search start position, and whether the match must start at the
- * specified position only. The `lastIndex` property of the provided regex is not used, but is
- * updated for compatibility. Also fixes browser bugs compared to the native
- * `RegExp.prototype.test` and can be used reliably cross-browser.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp} regex Regex to search with.
- * @param {Number} [pos=0] Zero-based index at which to start the search.
- * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position
- * only. The string `'sticky'` is accepted as an alternative to `true`.
- * @returns {Boolean} Whether the regex matched the provided value.
- * @example
- *
- * // Basic use
- * XRegExp.test('abc', /c/); // -> true
- *
- * // With pos and sticky
- * XRegExp.test('abc', /c/, 0, 'sticky'); // -> false
- * XRegExp.test('abc', /c/, 2, 'sticky'); // -> true
- */
- XRegExp.test = function (str, regex, pos, sticky) {
- // Do this the easy way :-)
- return !!XRegExp.exec(str, regex, pos, sticky);
- };
-
- /**
- * Uninstalls optional features according to the specified options. All optional features start out
- * uninstalled, so this is used to undo the actions of {@link #XRegExp.install}.
- *
- * @memberOf XRegExp
- * @param {Object|String} options Options object or string.
- * @example
- *
- * // With an options object
- * XRegExp.uninstall({
- * // Disables support for astral code points in Unicode addons
- * astral: true,
- *
- * // Restores native regex methods
- * natives: true
- * });
- *
- * // With an options string
- * XRegExp.uninstall('astral natives');
- */
- XRegExp.uninstall = function (options) {
- options = prepareOptions(options);
-
- if (features.astral && options.astral) {
- setAstral(false);
- }
-
- if (features.natives && options.natives) {
- setNatives(false);
- }
- };
-
- /**
- * Returns an XRegExp object that is the union of the given patterns. Patterns can be provided as
- * regex objects or strings. Metacharacters are escaped in patterns provided as strings.
- * Backreferences in provided regex objects are automatically renumbered to work correctly within
- * the larger combined pattern. Native flags used by provided regexes are ignored in favor of the
- * `flags` argument.
- *
- * @memberOf XRegExp
- * @param {Array} patterns Regexes and strings to combine.
- * @param {String} [flags] Any combination of XRegExp flags.
- * @returns {RegExp} Union of the provided regexes and strings.
- * @example
- *
- * XRegExp.union(['a+b*c', /(dogs)\1/, /(cats)\1/], 'i');
- * // -> /a\+b\*c|(dogs)\1|(cats)\2/i
- */
- XRegExp.union = function (patterns, flags) {
- var parts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*]/g,
- output = [],
- numCaptures = 0,
- numPriorCaptures,
- captureNames,
- pattern,
- rewrite = function rewrite(match, paren, backref) {
- var name = captureNames[numCaptures - numPriorCaptures];
-
- // Capturing group
- if (paren) {
- ++numCaptures;
- // If the current capture has a name, preserve the name
- if (name) {
- return '(?<' + name + '>';
- }
- // Backreference
- } else if (backref) {
- // Rewrite the backreference
- return '\\' + (+backref + numPriorCaptures);
- }
-
- return match;
- },
- i;
-
- if (!(isType(patterns, 'Array') && patterns.length)) {
- throw new TypeError('Must provide a nonempty array of patterns to merge');
- }
-
- for (i = 0; i < patterns.length; ++i) {
- pattern = patterns[i];
-
- if (XRegExp.isRegExp(pattern)) {
- numPriorCaptures = numCaptures;
- captureNames = pattern[REGEX_DATA] && pattern[REGEX_DATA].captureNames || [];
-
- // Rewrite backreferences. Passing to XRegExp dies on octals and ensures patterns
- // are independently valid; helps keep this simple. Named captures are put back
- output.push(nativ.replace.call(XRegExp(pattern.source).source, parts, rewrite));
- } else {
- output.push(XRegExp.escape(pattern));
- }
- }
-
- return XRegExp(output.join('|'), flags);
- };
-
- /* ==============================
- * Fixed/extended native methods
- * ============================== */
-
- /**
- * Adds named capture support (with backreferences returned as `result.name`), and fixes browser
- * bugs in the native `RegExp.prototype.exec`. Calling `XRegExp.install('natives')` uses this to
- * override the native method. Use via `XRegExp.exec` without overriding natives.
- *
- * @private
- * @param {String} str String to search.
- * @returns {Array} Match array with named backreference properties, or `null`.
- */
- fixed.exec = function (str) {
- var origLastIndex = this.lastIndex,
- match = nativ.exec.apply(this, arguments),
- name,
- r2,
- i;
-
- if (match) {
- // Fix browsers whose `exec` methods don't return `undefined` for nonparticipating
- // capturing groups. This fixes IE 5.5-8, but not IE 9's quirks mode or emulation of
- // older IEs. IE 9 in standards mode follows the spec
- if (!correctExecNpcg && match.length > 1 && indexOf(match, '') > -1) {
- r2 = copyRegex(this, {
- removeG: true,
- isInternalOnly: true
- });
- // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
- // matching due to characters outside the match
- nativ.replace.call(String(str).slice(match.index), r2, function () {
- var len = arguments.length,
- i;
- // Skip index 0 and the last 2
- for (i = 1; i < len - 2; ++i) {
- if (arguments[i] === undefined) {
- match[i] = undefined;
- }
- }
- });
- }
-
- // Attach named capture properties
- if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) {
- // Skip index 0
- for (i = 1; i < match.length; ++i) {
- name = this[REGEX_DATA].captureNames[i - 1];
- if (name) {
- match[name] = match[i];
- }
- }
- }
-
- // Fix browsers that increment `lastIndex` after zero-length matches
- if (this.global && !match[0].length && this.lastIndex > match.index) {
- this.lastIndex = match.index;
- }
- }
-
- if (!this.global) {
- // Fixes IE, Opera bug (last tested IE 9, Opera 11.6)
- this.lastIndex = origLastIndex;
- }
-
- return match;
- };
-
- /**
- * Fixes browser bugs in the native `RegExp.prototype.test`. Calling `XRegExp.install('natives')`
- * uses this to override the native method.
- *
- * @private
- * @param {String} str String to search.
- * @returns {Boolean} Whether the regex matched the provided value.
- */
- fixed.test = function (str) {
- // Do this the easy way :-)
- return !!fixed.exec.call(this, str);
- };
-
- /**
- * Adds named capture support (with backreferences returned as `result.name`), and fixes browser
- * bugs in the native `String.prototype.match`. Calling `XRegExp.install('natives')` uses this to
- * override the native method.
- *
- * @private
- * @param {RegExp|*} regex Regex to search with. If not a regex object, it is passed to `RegExp`.
- * @returns {Array} If `regex` uses flag g, an array of match strings or `null`. Without flag g,
- * the result of calling `regex.exec(this)`.
- */
- fixed.match = function (regex) {
- var result;
-
- if (!XRegExp.isRegExp(regex)) {
- // Use the native `RegExp` rather than `XRegExp`
- regex = new RegExp(regex);
- } else if (regex.global) {
- result = nativ.match.apply(this, arguments);
- // Fixes IE bug
- regex.lastIndex = 0;
-
- return result;
- }
-
- return fixed.exec.call(regex, toObject(this));
- };
-
- /**
- * Adds support for `${n}` tokens for named and numbered backreferences in replacement text, and
- * provides named backreferences to replacement functions as `arguments[0].name`. Also fixes browser
- * bugs in replacement text syntax when performing a replacement using a nonregex search value, and
- * the value of a replacement regex's `lastIndex` property during replacement iterations and upon
- * completion. Calling `XRegExp.install('natives')` uses this to override the native method. Note
- * that this doesn't support SpiderMonkey's proprietary third (`flags`) argument. Use via
- * `XRegExp.replace` without overriding natives.
- *
- * @private
- * @param {RegExp|String} search Search pattern to be replaced.
- * @param {String|Function} replacement Replacement string or a function invoked to create it.
- * @returns {String} New string with one or all matches replaced.
- */
- fixed.replace = function (search, replacement) {
- var isRegex = XRegExp.isRegExp(search),
- origLastIndex,
- captureNames,
- result;
-
- if (isRegex) {
- if (search[REGEX_DATA]) {
- captureNames = search[REGEX_DATA].captureNames;
- }
- // Only needed if `search` is nonglobal
- origLastIndex = search.lastIndex;
- } else {
- search += ''; // Type-convert
- }
-
- // Don't use `typeof`; some older browsers return 'function' for regex objects
- if (isType(replacement, 'Function')) {
- // Stringifying `this` fixes a bug in IE < 9 where the last argument in replacement
- // functions isn't type-converted to a string
- result = nativ.replace.call(String(this), search, function () {
- var args = arguments,
- i;
- if (captureNames) {
- // Change the `arguments[0]` string primitive to a `String` object that can
- // store properties. This really does need to use `String` as a constructor
- args[0] = new String(args[0]);
- // Store named backreferences on the first argument
- for (i = 0; i < captureNames.length; ++i) {
- if (captureNames[i]) {
- args[0][captureNames[i]] = args[i + 1];
- }
- }
- }
- // Update `lastIndex` before calling `replacement`. Fixes IE, Chrome, Firefox,
- // Safari bug (last tested IE 9, Chrome 17, Firefox 11, Safari 5.1)
- if (isRegex && search.global) {
- search.lastIndex = args[args.length - 2] + args[0].length;
- }
- // ES6 specs the context for replacement functions as `undefined`
- return replacement.apply(undefined, args);
- });
- } else {
- // Ensure that the last value of `args` will be a string when given nonstring `this`,
- // while still throwing on null or undefined context
- result = nativ.replace.call(this == null ? this : String(this), search, function () {
- // Keep this function's `arguments` available through closure
- var args = arguments;
- return nativ.replace.call(String(replacement), replacementToken, function ($0, $1, $2) {
- var n;
- // Named or numbered backreference with curly braces
- if ($1) {
- // XRegExp behavior for `${n}`:
- // 1. Backreference to numbered capture, if `n` is an integer. Use `0` for
- // for the entire match. Any number of leading zeros may be used.
- // 2. Backreference to named capture `n`, if it exists and is not an
- // integer overridden by numbered capture. In practice, this does not
- // overlap with numbered capture since XRegExp does not allow named
- // capture to use a bare integer as the name.
- // 3. If the name or number does not refer to an existing capturing group,
- // it's an error.
- n = +$1; // Type-convert; drop leading zeros
- if (n <= args.length - 3) {
- return args[n] || '';
- }
- // Groups with the same name is an error, else would need `lastIndexOf`
- n = captureNames ? indexOf(captureNames, $1) : -1;
- if (n < 0) {
- throw new SyntaxError('Backreference to undefined group ' + $0);
- }
- return args[n + 1] || '';
- }
- // Else, special variable or numbered backreference without curly braces
- if ($2 === '$') {
- // $$
- return '$';
- }
- if ($2 === '&' || +$2 === 0) {
- // $&, $0 (not followed by 1-9), $00
- return args[0];
- }
- if ($2 === '`') {
- // $` (left context)
- return args[args.length - 1].slice(0, args[args.length - 2]);
- }
- if ($2 === "'") {
- // $' (right context)
- return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
- }
- // Else, numbered backreference without curly braces
- $2 = +$2; // Type-convert; drop leading zero
- // XRegExp behavior for `$n` and `$nn`:
- // - Backrefs end after 1 or 2 digits. Use `${..}` for more digits.
- // - `$1` is an error if no capturing groups.
- // - `$10` is an error if less than 10 capturing groups. Use `${1}0` instead.
- // - `$01` is `$1` if at least one capturing group, else it's an error.
- // - `$0` (not followed by 1-9) and `$00` are the entire match.
- // Native behavior, for comparison:
- // - Backrefs end after 1 or 2 digits. Cannot reference capturing group 100+.
- // - `$1` is a literal `$1` if no capturing groups.
- // - `$10` is `$1` followed by a literal `0` if less than 10 capturing groups.
- // - `$01` is `$1` if at least one capturing group, else it's a literal `$01`.
- // - `$0` is a literal `$0`.
- if (!isNaN($2)) {
- if ($2 > args.length - 3) {
- throw new SyntaxError('Backreference to undefined group ' + $0);
- }
- return args[$2] || '';
- }
- // `$` followed by an unsupported char is an error, unlike native JS
- throw new SyntaxError('Invalid token ' + $0);
- });
- });
- }
-
- if (isRegex) {
- if (search.global) {
- // Fixes IE, Safari bug (last tested IE 9, Safari 5.1)
- search.lastIndex = 0;
- } else {
- // Fixes IE, Opera bug (last tested IE 9, Opera 11.6)
- search.lastIndex = origLastIndex;
- }
- }
-
- return result;
- };
-
- /**
- * Fixes browser bugs in the native `String.prototype.split`. Calling `XRegExp.install('natives')`
- * uses this to override the native method. Use via `XRegExp.split` without overriding natives.
- *
- * @private
- * @param {RegExp|String} separator Regex or string to use for separating the string.
- * @param {Number} [limit] Maximum number of items to include in the result array.
- * @returns {Array} Array of substrings.
- */
- fixed.split = function (separator, limit) {
- if (!XRegExp.isRegExp(separator)) {
- // Browsers handle nonregex split correctly, so use the faster native method
- return nativ.split.apply(this, arguments);
- }
-
- var str = String(this),
- output = [],
- origLastIndex = separator.lastIndex,
- lastLastIndex = 0,
- lastLength;
-
- // Values for `limit`, per the spec:
- // If undefined: pow(2,32) - 1
- // If 0, Infinity, or NaN: 0
- // If positive number: limit = floor(limit); if (limit >= pow(2,32)) limit -= pow(2,32);
- // If negative number: pow(2,32) - floor(abs(limit))
- // If other: Type-convert, then use the above rules
- // This line fails in very strange ways for some values of `limit` in Opera 10.5-10.63,
- // unless Opera Dragonfly is open (go figure). It works in at least Opera 9.5-10.1 and 11+
- limit = (limit === undefined ? -1 : limit) >>> 0;
-
- XRegExp.forEach(str, separator, function (match) {
- // This condition is not the same as `if (match[0].length)`
- if (match.index + match[0].length > lastLastIndex) {
- output.push(str.slice(lastLastIndex, match.index));
- if (match.length > 1 && match.index < str.length) {
- Array.prototype.push.apply(output, match.slice(1));
- }
- lastLength = match[0].length;
- lastLastIndex = match.index + lastLength;
- }
- });
-
- if (lastLastIndex === str.length) {
- if (!nativ.test.call(separator, '') || lastLength) {
- output.push('');
- }
- } else {
- output.push(str.slice(lastLastIndex));
- }
-
- separator.lastIndex = origLastIndex;
- return output.length > limit ? output.slice(0, limit) : output;
- };
-
- /* ==============================
- * Built-in syntax/flag tokens
- * ============================== */
-
- /*
- * Letter escapes that natively match literal characters: `\a`, `\A`, etc. These should be
- * SyntaxErrors but are allowed in web reality. XRegExp makes them errors for cross-browser
- * consistency and to reserve their syntax, but lets them be superseded by addons.
- */
- XRegExp.addToken(/\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4}|{[\dA-Fa-f]+})|x(?![\dA-Fa-f]{2}))/, function (match, scope) {
- // \B is allowed in default scope only
- if (match[1] === 'B' && scope === defaultScope) {
- return match[0];
- }
- throw new SyntaxError('Invalid escape ' + match[0]);
- }, {
- scope: 'all',
- leadChar: '\\'
- });
-
- /*
- * Unicode code point escape with curly braces: `\u{N..}`. `N..` is any one or more digit
- * hexadecimal number from 0-10FFFF, and can include leading zeros. Requires the native ES6 `u` flag
- * to support code points greater than U+FFFF. Avoids converting code points above U+FFFF to
- * surrogate pairs (which could be done without flag `u`), since that could lead to broken behavior
- * if you follow a `\u{N..}` token that references a code point above U+FFFF with a quantifier, or
- * if you use the same in a character class.
- */
- XRegExp.addToken(/\\u{([\dA-Fa-f]+)}/, function (match, scope, flags) {
- var code = dec(match[1]);
- if (code > 0x10FFFF) {
- throw new SyntaxError('Invalid Unicode code point ' + match[0]);
- }
- if (code <= 0xFFFF) {
- // Converting to \uNNNN avoids needing to escape the literal character and keep it
- // separate from preceding tokens
- return '\\u' + pad4(hex(code));
- }
- // If `code` is between 0xFFFF and 0x10FFFF, require and defer to native handling
- if (hasNativeU && flags.indexOf('u') > -1) {
- return match[0];
- }
- throw new SyntaxError('Cannot use Unicode code point above \\u{FFFF} without flag u');
- }, {
- scope: 'all',
- leadChar: '\\'
- });
-
- /*
- * Empty character class: `[]` or `[^]`. This fixes a critical cross-browser syntax inconsistency.
- * Unless this is standardized (per the ES spec), regex syntax can't be accurately parsed because
- * character class endings can't be determined.
- */
- XRegExp.addToken(/\[(\^?)]/, function (match) {
- // For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S].
- // (?!) should work like \b\B, but is unreliable in some versions of Firefox
- return match[1] ? '[\\s\\S]' : '\\b\\B';
- }, { leadChar: '[' });
-
- /*
- * Comment pattern: `(?# )`. Inline comments are an alternative to the line comments allowed in
- * free-spacing mode (flag x).
- */
- XRegExp.addToken(/\(\?#[^)]*\)/, function (match, scope, flags) {
- // Keep tokens separated unless the following token is a quantifier
- return isQuantifierNext(match.input, match.index + match[0].length, flags) ? '' : '(?:)';
- }, { leadChar: '(' });
-
- /*
- * Whitespace and line comments, in free-spacing mode (aka extended mode, flag x) only.
- */
- XRegExp.addToken(/\s+|#.*/, function (match, scope, flags) {
- // Keep tokens separated unless the following token is a quantifier
- return isQuantifierNext(match.input, match.index + match[0].length, flags) ? '' : '(?:)';
- }, { flag: 'x' });
-
- /*
- * Dot, in dotall mode (aka singleline mode, flag s) only.
- */
- XRegExp.addToken(/\./, function () {
- return '[\\s\\S]';
- }, {
- flag: 's',
- leadChar: '.'
- });
-
- /*
- * Named backreference: `\k`. Backreference names can use the characters A-Z, a-z, 0-9, _,
- * and $ only. Also allows numbered backreferences as `\k`.
- */
- XRegExp.addToken(/\\k<([\w$]+)>/, function (match) {
- // Groups with the same name is an error, else would need `lastIndexOf`
- var index = isNaN(match[1]) ? indexOf(this.captureNames, match[1]) + 1 : +match[1],
- endIndex = match.index + match[0].length;
- if (!index || index > this.captureNames.length) {
- throw new SyntaxError('Backreference to undefined group ' + match[0]);
- }
- // Keep backreferences separate from subsequent literal numbers
- return '\\' + index + (endIndex === match.input.length || isNaN(match.input.charAt(endIndex)) ? '' : '(?:)');
- }, { leadChar: '\\' });
-
- /*
- * Numbered backreference or octal, plus any following digits: `\0`, `\11`, etc. Octals except `\0`
- * not followed by 0-9 and backreferences to unopened capture groups throw an error. Other matches
- * are returned unaltered. IE < 9 doesn't support backreferences above `\99` in regex syntax.
- */
- XRegExp.addToken(/\\(\d+)/, function (match, scope) {
- if (!(scope === defaultScope && /^[1-9]/.test(match[1]) && +match[1] <= this.captureNames.length) && match[1] !== '0') {
- throw new SyntaxError('Cannot use octal escape or backreference to undefined group ' + match[0]);
- }
- return match[0];
- }, {
- scope: 'all',
- leadChar: '\\'
- });
-
- /*
- * Named capturing group; match the opening delimiter only: `(?`. Capture names can use the
- * characters A-Z, a-z, 0-9, _, and $ only. Names can't be integers. Supports Python-style
- * `(?P` as an alternate syntax to avoid issues in some older versions of Opera which natively
- * supported the Python-style syntax. Otherwise, XRegExp might treat numbered backreferences to
- * Python-style named capture as octals.
- */
- XRegExp.addToken(/\(\?P?<([\w$]+)>/, function (match) {
- // Disallow bare integers as names because named backreferences are added to match
- // arrays and therefore numeric properties may lead to incorrect lookups
- if (!isNaN(match[1])) {
- throw new SyntaxError('Cannot use integer as capture name ' + match[0]);
- }
- if (match[1] === 'length' || match[1] === '__proto__') {
- throw new SyntaxError('Cannot use reserved word as capture name ' + match[0]);
- }
- if (indexOf(this.captureNames, match[1]) > -1) {
- throw new SyntaxError('Cannot use same name for multiple groups ' + match[0]);
- }
- this.captureNames.push(match[1]);
- this.hasNamedCapture = true;
- return '(';
- }, { leadChar: '(' });
-
- /*
- * Capturing group; match the opening parenthesis only. Required for support of named capturing
- * groups. Also adds explicit capture mode (flag n).
- */
- XRegExp.addToken(/\((?!\?)/, function (match, scope, flags) {
- if (flags.indexOf('n') > -1) {
- return '(?:';
- }
- this.captureNames.push(null);
- return '(';
- }, {
- optionalFlags: 'n',
- leadChar: '('
- });
-
- /* ==============================
- * Expose XRegExp
- * ============================== */
-
- module.exports = XRegExp;
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _match = __webpack_require__(6);
-
- Object.keys(_match).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _match[key];
- }
- });
- });
-
- var _applyRegexList = __webpack_require__(7);
-
- Object.keys(_applyRegexList).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _applyRegexList[key];
- }
- });
- });
-
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
-
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- var Match = exports.Match = function () {
- function Match(value, index, css) {
- _classCallCheck(this, Match);
-
- this.value = value;
- this.index = index;
- this.length = value.length;
- this.css = css;
- this.brushName = null;
- }
-
- _createClass(Match, [{
- key: "toString",
- value: function toString() {
- return this.value;
- }
- }]);
-
- return Match;
- }();
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
- exports.applyRegexList = applyRegexList;
-
- var _matches = __webpack_require__(8);
-
- /**
- * Applies all regular expression to the code and stores all found
- * matches in the `this.matches` array.
- */
- function applyRegexList(code, regexList) {
- var result = [];
-
- regexList = regexList || [];
-
- for (var i = 0, l = regexList.length; i < l; i++) {
- // BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com)
- if (_typeof(regexList[i]) === 'object') result = result.concat((0, _matches.find)(code, regexList[i]));
- }
-
- result = (0, _matches.sort)(result);
- result = (0, _matches.removeNested)(result);
- result = (0, _matches.compact)(result);
-
- return result;
- }
-
-/***/ },
-/* 8 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.find = find;
- exports.sort = sort;
- exports.compact = compact;
- exports.removeNested = removeNested;
-
- var _match = __webpack_require__(6);
-
- var _syntaxhighlighterRegex = __webpack_require__(3);
-
- /**
- * Executes given regular expression on provided code and returns all matches that are found.
- *
- * @param {String} code Code to execute regular expression on.
- * @param {Object} regex Regular expression item info from `regexList` collection.
- * @return {Array} Returns a list of Match objects.
- */
- function find(code, regexInfo) {
- function defaultAdd(match, regexInfo) {
- return match[0];
- };
-
- var index = 0,
- match = null,
- matches = [],
- process = regexInfo.func ? regexInfo.func : defaultAdd,
- pos = 0;
-
- while (match = _syntaxhighlighterRegex.XRegExp.exec(code, regexInfo.regex, pos)) {
- var resultMatch = process(match, regexInfo);
-
- if (typeof resultMatch === 'string') resultMatch = [new _match.Match(resultMatch, match.index, regexInfo.css)];
-
- matches = matches.concat(resultMatch);
- pos = match.index + match[0].length;
- }
-
- return matches;
- };
-
- /**
- * Sorts matches by index position and then by length.
- */
- function sort(matches) {
- function sortMatchesCallback(m1, m2) {
- // sort matches by index first
- if (m1.index < m2.index) return -1;else if (m1.index > m2.index) return 1;else {
- // if index is the same, sort by length
- if (m1.length < m2.length) return -1;else if (m1.length > m2.length) return 1;
- }
-
- return 0;
- }
-
- return matches.sort(sortMatchesCallback);
- }
-
- function compact(matches) {
- var result = [],
- i,
- l;
-
- for (i = 0, l = matches.length; i < l; i++) {
- if (matches[i]) result.push(matches[i]);
- }return result;
- }
-
- /**
- * Checks to see if any of the matches are inside of other matches.
- * This process would get rid of highligted strings inside comments,
- * keywords inside strings and so on.
- */
- function removeNested(matches) {
- // Optimized by Jose Prado (http://joseprado.com)
- for (var i = 0, l = matches.length; i < l; i++) {
- if (matches[i] === null) continue;
-
- var itemI = matches[i],
- itemIEndPos = itemI.index + itemI.length;
-
- for (var j = i + 1, l = matches.length; j < l && matches[i] !== null; j++) {
- var itemJ = matches[j];
-
- if (itemJ === null) continue;else if (itemJ.index > itemIEndPos) break;else if (itemJ.index == itemI.index && itemJ.length > itemI.length) matches[i] = null;else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos) matches[j] = null;
- }
- }
-
- return matches;
- }
-
-/***/ },
-/* 9 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = Renderer;
- /**
- * Pads number with zeros until it's length is the same as given length.
- *
- * @param {Number} number Number to pad.
- * @param {Number} length Max string length with.
- * @return {String} Returns a string padded with proper amount of '0'.
- */
- function padNumber(number, length) {
- var result = number.toString();
-
- while (result.length < length) {
- result = '0' + result;
- }return result;
- };
-
- function getLines(str) {
- return str.split(/\r?\n/);
- }
-
- function getLinesToHighlight(opts) {
- var results = {},
- linesToHighlight,
- l,
- i;
-
- linesToHighlight = opts.highlight || [];
-
- if (typeof linesToHighlight.push !== 'function') linesToHighlight = [linesToHighlight];
-
- for (i = 0, l = linesToHighlight.length; i < l; i++) {
- results[linesToHighlight[i]] = true;
- }return results;
- }
-
- function Renderer(code, matches, opts) {
- var _this = this;
-
- _this.opts = opts;
- _this.code = code;
- _this.matches = matches;
- _this.lines = getLines(code);
- _this.linesToHighlight = getLinesToHighlight(opts);
- }
-
- Renderer.prototype = {
- /**
- * Wraps each line of the string into tag with given style applied to it.
- *
- * @param {String} str Input string.
- * @param {String} css Style name to apply to the string.
- * @return {String} Returns input string with each line surrounded by tag.
- */
- wrapLinesWithCode: function wrapLinesWithCode(str, css) {
- if (str == null || str.length == 0 || str == '\n' || css == null) return str;
-
- var _this = this,
- results = [],
- lines,
- line,
- spaces,
- i,
- l;
-
- str = str.replace(/... to them so that leading spaces aren't included.
- for (i = 0, l = lines.length; i < l; i++) {
- line = lines[i];
- spaces = '';
-
- if (line.length > 0) {
- line = line.replace(/^( | )+/, function (s) {
- spaces = s;
- return '';
- });
-
- line = line.length === 0 ? spaces : spaces + '' + line + '';
- }
-
- results.push(line);
- }
-
- return results.join('\n');
- },
-
- /**
- * Turns all URLs in the code into tags.
- * @param {String} code Input code.
- * @return {String} Returns code with tags.
- */
- processUrls: function processUrls(code) {
- var gt = /(.*)((>|<).*)/,
- url = /\w+:\/\/[\w-.\/?%&=:@;#]*/g;
-
- return code.replace(url, function (m) {
- var suffix = '',
- match = null;
-
- // We include < and > in the URL for the common cases like
- // The problem is that they get transformed into <http://google.com>
- // Where as > easily looks like part of the URL string.
-
- if (match = gt.exec(m)) {
- m = match[1];
- suffix = match[2];
- }
-
- return '' + m + ' ' + suffix;
- });
- },
-
- /**
- * Creates an array containing integer line numbers starting from the 'first-line' param.
- * @return {Array} Returns array of integers.
- */
- figureOutLineNumbers: function figureOutLineNumbers(code) {
- var lineNumbers = [],
- lines = this.lines,
- firstLine = parseInt(this.opts.firstLine || 1),
- i,
- l;
-
- for (i = 0, l = lines.length; i < l; i++) {
- lineNumbers.push(i + firstLine);
- }return lineNumbers;
- },
-
- /**
- * Generates HTML markup for a single line of code while determining alternating line style.
- * @param {Integer} lineNumber Line number.
- * @param {String} code Line HTML markup.
- * @return {String} Returns HTML markup.
- */
- wrapLine: function wrapLine(lineIndex, lineNumber, lineHtml) {
- var classes = ['line', 'number' + lineNumber, 'index' + lineIndex, 'alt' + (lineNumber % 2 == 0 ? 1 : 2).toString()];
-
- if (this.linesToHighlight[lineNumber]) classes.push('highlighted');
-
- if (lineNumber == 0) classes.push('break');
-
- return '' + lineHtml + '
';
- },
-
- /**
- * Generates HTML markup for line number column.
- * @param {String} code Complete code HTML markup.
- * @param {Array} lineNumbers Calculated line numbers.
- * @return {String} Returns HTML markup.
- */
- renderLineNumbers: function renderLineNumbers(code, lineNumbers) {
- var _this = this,
- opts = _this.opts,
- html = '',
- count = _this.lines.length,
- firstLine = parseInt(opts.firstLine || 1),
- pad = opts.padLineNumbers,
- lineNumber,
- i;
-
- if (pad == true) pad = (firstLine + count - 1).toString().length;else if (isNaN(pad) == true) pad = 0;
-
- for (i = 0; i < count; i++) {
- lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i;
- code = lineNumber == 0 ? opts.space : padNumber(lineNumber, pad);
- html += _this.wrapLine(i, lineNumber, code);
- }
-
- return html;
- },
-
- /**
- * Splits block of text into individual DIV lines.
- * @param {String} code Code to highlight.
- * @param {Array} lineNumbers Calculated line numbers.
- * @return {String} Returns highlighted code in HTML form.
- */
- getCodeLinesHtml: function getCodeLinesHtml(html, lineNumbers) {
- // html = utils.trim(html);
-
- var _this = this,
- opts = _this.opts,
- lines = getLines(html),
- padLength = opts.padLineNumbers,
- firstLine = parseInt(opts.firstLine || 1),
- brushName = opts.brush,
- html = '';
-
- for (var i = 0, l = lines.length; i < l; i++) {
- var line = lines[i],
- indent = /^( |\s)+/.exec(line),
- spaces = null,
- lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i;
- ;
-
- if (indent != null) {
- spaces = indent[0].toString();
- line = line.substr(spaces.length);
- spaces = spaces.replace(' ', opts.space);
- }
-
- // line = utils.trim(line);
-
- if (line.length == 0) line = opts.space;
-
- html += _this.wrapLine(i, lineNumber, (spaces != null ? '' + spaces + '' : '') + line);
- }
-
- return html;
- },
-
- /**
- * Returns HTML for the table title or empty string if title is null.
- */
- getTitleHtml: function getTitleHtml(title) {
- return title ? '' + title + ' ' : '';
- },
-
- /**
- * Finds all matches in the source code.
- * @param {String} code Source code to process matches in.
- * @param {Array} matches Discovered regex matches.
- * @return {String} Returns formatted HTML with processed mathes.
- */
- getMatchesHtml: function getMatchesHtml(code, matches) {
- function getBrushNameCss(match) {
- var result = match ? match.brushName || brushName : brushName;
- return result ? result + ' ' : '';
- };
-
- var _this = this,
- pos = 0,
- result = '',
- brushName = _this.opts.brush || '',
- match,
- matchBrushName,
- i,
- l;
-
- // Finally, go through the final list of matches and pull the all
- // together adding everything in between that isn't a match.
- for (i = 0, l = matches.length; i < l; i++) {
- match = matches[i];
-
- if (match === null || match.length === 0) continue;
-
- matchBrushName = getBrushNameCss(match);
-
- result += _this.wrapLinesWithCode(code.substr(pos, match.index - pos), matchBrushName + 'plain') + _this.wrapLinesWithCode(match.value, matchBrushName + match.css);
-
- pos = match.index + match.length + (match.offset || 0);
- }
-
- // don't forget to add whatever's remaining in the string
- result += _this.wrapLinesWithCode(code.substr(pos), getBrushNameCss() + 'plain');
-
- return result;
- },
-
- /**
- * Generates HTML markup for the whole syntax highlighter.
- * @param {String} code Source code.
- * @return {String} Returns HTML markup.
- */
- getHtml: function getHtml() {
- var _this = this,
- opts = _this.opts,
- code = _this.code,
- matches = _this.matches,
- classes = ['syntaxhighlighter'],
- lineNumbers,
- gutter,
- html;
-
- if (opts.collapse === true) classes.push('collapsed');
-
- gutter = opts.gutter !== false;
-
- if (!gutter) classes.push('nogutter');
-
- // add custom user style name
- classes.push(opts.className);
-
- // add brush alias to the class name for custom CSS
- classes.push(opts.brush);
-
- if (gutter) lineNumbers = _this.figureOutLineNumbers(code);
-
- // processes found matches into the html
- html = _this.getMatchesHtml(code, matches);
-
- // finally, split all lines so that they wrap well
- html = _this.getCodeLinesHtml(html, lineNumbers);
-
- // finally, process the links
- if (opts.autoLinks) html = _this.processUrls(html);
-
- html = '\n \n
\n ' + _this.getTitleHtml(opts.title) + '\n \n \n ' + (gutter ? '' + _this.renderLineNumbers(code) + ' ' : '') + '\n \n ' + html + '
\n \n \n \n
\n
\n ';
-
- return html;
- }
- };
-
-/***/ },
-/* 10 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- /**
- * Splits block of text into lines.
- * @param {String} block Block of text.
- * @return {Array} Returns array of lines.
- */
- function splitLines(block) {
- return block.split(/\r?\n/);
- }
-
- /**
- * Executes a callback on each line and replaces each line with result from the callback.
- * @param {Object} str Input string.
- * @param {Object} callback Callback function taking one string argument and returning a string.
- */
- function eachLine(str, callback) {
- var lines = splitLines(str);
-
- for (var i = 0, l = lines.length; i < l; i++) {
- lines[i] = callback(lines[i], i);
- }return lines.join('\n');
- }
-
- /**
- * Generates a unique element ID.
- */
- function guid(prefix) {
- return (prefix || '') + Math.round(Math.random() * 1000000).toString();
- }
-
- /**
- * Merges two objects. Values from obj2 override values in obj1.
- * Function is NOT recursive and works only for one dimensional objects.
- * @param {Object} obj1 First object.
- * @param {Object} obj2 Second object.
- * @return {Object} Returns combination of both objects.
- */
- function merge(obj1, obj2) {
- var result = {},
- name;
-
- for (name in obj1) {
- result[name] = obj1[name];
- }for (name in obj2) {
- result[name] = obj2[name];
- }return result;
- }
-
- /**
- * Removes all white space at the begining and end of a string.
- *
- * @param {String} str String to trim.
- * @return {String} Returns string without leading and following white space characters.
- */
- function trim(str) {
- return str.replace(/^\s+|\s+$/g, '');
- }
-
- /**
- * Converts the source to array object. Mostly used for function arguments and
- * lists returned by getElementsByTagName() which aren't Array objects.
- * @param {List} source Source list.
- * @return {Array} Returns array.
- */
- function toArray(source) {
- return Array.prototype.slice.apply(source);
- }
-
- /**
- * Attempts to convert string to boolean.
- * @param {String} value Input string.
- * @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise.
- */
- function toBoolean(value) {
- var result = { "true": true, "false": false }[value];
- return result == null ? value : result;
- }
-
- module.exports = {
- splitLines: splitLines,
- eachLine: eachLine,
- guid: guid,
- merge: merge,
- trim: trim,
- toArray: toArray,
- toBoolean: toBoolean
- };
-
-/***/ },
-/* 11 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var trim = __webpack_require__(12),
- bloggerMode = __webpack_require__(13),
- stripBrs = __webpack_require__(14),
- unindenter = __webpack_require__(15),
- retabber = __webpack_require__(16);
-
- module.exports = function (code, opts) {
- code = trim(code, opts);
- code = bloggerMode(code, opts);
- code = stripBrs(code, opts);
- code = unindenter.unindent(code, opts);
-
- var tabSize = opts['tab-size'];
- code = opts['smart-tabs'] === true ? retabber.smart(code, tabSize) : retabber.regular(code, tabSize);
-
- return code;
- };
-
-/***/ },
-/* 12 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = function (code, opts) {
- return code
- // This is a special trim which only removes first and last empty lines
- // and doesn't affect valid leading space on the first line.
- .replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, '')
-
- // IE lets these buggers through
- .replace(/\r/g, ' ');
- };
-
-/***/ },
-/* 13 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = function (code, opts) {
- var br = / |<br\s*\/?>/gi;
-
- if (opts['bloggerMode'] === true) code = code.replace(br, '\n');
-
- return code;
- };
-
-/***/ },
-/* 14 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = function (code, opts) {
- var br = / |<br\s*\/?>/gi;
-
- if (opts['stripBrs'] === true) code = code.replace(br, '');
-
- return code;
- };
-
-/***/ },
-/* 15 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- function isEmpty(str) {
- return (/^\s*$/.test(str)
- );
- }
-
- module.exports = {
- unindent: function unindent(code) {
- var lines = code.split(/\r?\n/),
- regex = /^\s*/,
- min = 1000,
- line,
- matches,
- i,
- l;
-
- // go through every line and check for common number of indents
- for (i = 0, l = lines.length; i < l && min > 0; i++) {
- line = lines[i];
-
- if (isEmpty(line)) continue;
-
- matches = regex.exec(line);
-
- // In the event that just one line doesn't have leading white space
- // we can't unindent anything, so bail completely.
- if (matches == null) return code;
-
- min = Math.min(matches[0].length, min);
- }
-
- // trim minimum common number of white space from the begining of every line
- if (min > 0) for (i = 0, l = lines.length; i < l; i++) {
- if (!isEmpty(lines[i])) lines[i] = lines[i].substr(min);
- }return lines.join('\n');
- }
- };
-
-/***/ },
-/* 16 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- var spaces = '';
-
- // Create a string with 1000 spaces to copy spaces from...
- // It's assumed that there would be no indentation longer than that.
- for (var i = 0; i < 50; i++) {
- spaces += ' ';
- } // 20 spaces * 50
-
- // This function inserts specified amount of spaces in the string
- // where a tab is while removing that given tab.
- function insertSpaces(line, pos, count) {
- return line.substr(0, pos) + spaces.substr(0, count) + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
- ;
- }
-
- module.exports = {
- smart: function smart(code, tabSize) {
- var lines = code.split(/\r?\n/),
- tab = '\t',
- line,
- pos,
- i,
- l;
-
- // Go through all the lines and do the 'smart tabs' magic.
- for (i = 0, l = lines.length; i < l; i++) {
- line = lines[i];
-
- if (line.indexOf(tab) === -1) continue;
-
- pos = 0;
-
- while ((pos = line.indexOf(tab)) !== -1) {
- // This is pretty much all there is to the 'smart tabs' logic.
- // Based on the position within the line and size of a tab,
- // calculate the amount of spaces we need to insert.
- line = insertSpaces(line, pos, tabSize - pos % tabSize);
- }
-
- lines[i] = line;
- }
-
- return lines.join('\n');
- },
-
- regular: function regular(code, tabSize) {
- return code.replace(/\t/g, spaces.substr(0, tabSize));
- }
- };
-
-/***/ },
-/* 17 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- /**
- * Finds all <SCRIPT TYPE="text/syntaxhighlighter" /> elementss.
- * Finds both "text/syntaxhighlighter" and "syntaxhighlighter"
- * ...in order to make W3C validator happy with subtype and backwardscompatible without subtype
- * @return {Array} Returns array of all found SyntaxHighlighter tags.
- */
- function getSyntaxHighlighterScriptTags() {
- var tags = document.getElementsByTagName('script'),
- result = [];
-
- for (var i = 0; i < tags.length; i++) {
- if (tags[i].type == 'text/syntaxhighlighter' || tags[i].type == 'syntaxhighlighter') result.push(tags[i]);
- }return result;
- };
-
- /**
- * Checks if target DOM elements has specified CSS class.
- * @param {DOMElement} target Target DOM element to check.
- * @param {String} className Name of the CSS class to check for.
- * @return {Boolean} Returns true if class name is present, false otherwise.
- */
- function hasClass(target, className) {
- return target.className.indexOf(className) != -1;
- }
-
- /**
- * Adds CSS class name to the target DOM element.
- * @param {DOMElement} target Target DOM element.
- * @param {String} className New CSS class to add.
- */
- function addClass(target, className) {
- if (!hasClass(target, className)) target.className += ' ' + className;
- }
-
- /**
- * Removes CSS class name from the target DOM element.
- * @param {DOMElement} target Target DOM element.
- * @param {String} className CSS class to remove.
- */
- function removeClass(target, className) {
- target.className = target.className.replace(className, '');
- }
-
- /**
- * Adds event handler to the target object.
- * @param {Object} obj Target object.
- * @param {String} type Name of the event.
- * @param {Function} func Handling function.
- */
- function attachEvent(obj, type, func, scope) {
- function handler(e) {
- e = e || window.event;
-
- if (!e.target) {
- e.target = e.srcElement;
- e.preventDefault = function () {
- this.returnValue = false;
- };
- }
-
- func.call(scope || window, e);
- };
-
- if (obj.attachEvent) {
- obj.attachEvent('on' + type, handler);
- } else {
- obj.addEventListener(type, handler, false);
- }
- }
-
- /**
- * Looks for a child or parent node which has specified classname.
- * Equivalent to jQuery's $(container).find(".className")
- * @param {Element} target Target element.
- * @param {String} search Class name or node name to look for.
- * @param {Boolean} reverse If set to true, will go up the node tree instead of down.
- * @return {Element} Returns found child or parent element on null.
- */
- function findElement(target, search, reverse /* optional */) {
- if (target == null) return null;
-
- var nodes = reverse != true ? target.childNodes : [target.parentNode],
- propertyToFind = { '#': 'id', '.': 'className' }[search.substr(0, 1)] || 'nodeName',
- expectedValue,
- found;
-
- expectedValue = propertyToFind != 'nodeName' ? search.substr(1) : search.toUpperCase();
-
- // main return of the found node
- if ((target[propertyToFind] || '').indexOf(expectedValue) != -1) return target;
-
- for (var i = 0, l = nodes.length; nodes && i < l && found == null; i++) {
- found = findElement(nodes[i], search, reverse);
- }return found;
- }
-
- /**
- * Looks for a parent node which has specified classname.
- * This is an alias to findElement(container, className, true).
- * @param {Element} target Target element.
- * @param {String} className Class name to look for.
- * @return {Element} Returns found parent element on null.
- */
- function findParentElement(target, className) {
- return findElement(target, className, true);
- }
-
- /**
- * Opens up a centered popup window.
- * @param {String} url URL to open in the window.
- * @param {String} name Popup name.
- * @param {int} width Popup width.
- * @param {int} height Popup height.
- * @param {String} options window.open() options.
- * @return {Window} Returns window instance.
- */
- function popup(url, name, width, height, options) {
- var x = (screen.width - width) / 2,
- y = (screen.height - height) / 2;
-
- options += ', left=' + x + ', top=' + y + ', width=' + width + ', height=' + height;
- options = options.replace(/^,/, '');
-
- var win = window.open(url, name, options);
- win.focus();
- return win;
- }
-
- function getElementsByTagName(name) {
- return document.getElementsByTagName(name);
- }
-
- /**
- * Finds all elements on the page which could be processes by SyntaxHighlighter.
- */
- function findElementsToHighlight(opts) {
- var elements = getElementsByTagName(opts['tagName']),
- scripts,
- i;
-
- // support for feature
- if (opts['useScriptTags']) {
- scripts = getElementsByTagName('script');
-
- for (i = 0; i < scripts.length; i++) {
- if (scripts[i].type.match(/^(text\/)?syntaxhighlighter$/)) elements.push(scripts[i]);
- }
- }
-
- return elements;
- }
-
- function create(name) {
- return document.createElement(name);
- }
-
- /**
- * Quick code mouse double click handler.
- */
- function quickCodeHandler(e) {
- var target = e.target,
- highlighterDiv = findParentElement(target, '.syntaxhighlighter'),
- container = findParentElement(target, '.container'),
- textarea = document.createElement('textarea'),
- highlighter;
-
- if (!container || !highlighterDiv || findElement(container, 'textarea')) return;
-
- //highlighter = highlighters.get(highlighterDiv.id);
-
- // add source class name
- addClass(highlighterDiv, 'source');
-
- // Have to go over each line and grab it's text, can't just do it on the
- // container because Firefox loses all \n where as Webkit doesn't.
- var lines = container.childNodes,
- code = [];
-
- for (var i = 0, l = lines.length; i < l; i++) {
- code.push(lines[i].innerText || lines[i].textContent);
- } // using \r instead of \r or \r\n makes this work equally well on IE, FF and Webkit
- code = code.join('\r');
-
- // For Webkit browsers, replace nbsp with a breaking space
- code = code.replace(/\u00a0/g, " ");
-
- // inject tag
- textarea.readOnly = true; // https://github.com/syntaxhighlighter/syntaxhighlighter/pull/329
- textarea.appendChild(document.createTextNode(code));
- container.appendChild(textarea);
-
- // preselect all text
- textarea.focus();
- textarea.select();
-
- // set up handler for lost focus
- attachEvent(textarea, 'blur', function (e) {
- textarea.parentNode.removeChild(textarea);
- removeClass(highlighterDiv, 'source');
- });
- };
-
- module.exports = {
- quickCodeHandler: quickCodeHandler,
- create: create,
- popup: popup,
- hasClass: hasClass,
- addClass: addClass,
- removeClass: removeClass,
- attachEvent: attachEvent,
- findElement: findElement,
- findParentElement: findParentElement,
- getSyntaxHighlighterScriptTags: getSyntaxHighlighterScriptTags,
- findElementsToHighlight: findElementsToHighlight
- };
-
-/***/ },
-/* 18 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = {
- space: ' ',
-
- /** Enables use of tags. */
- useScriptTags: true,
-
- /** Blogger mode flag. */
- bloggerMode: false,
-
- stripBrs: false,
-
- /** Name of the tag that SyntaxHighlighter will automatically look for. */
- tagName: 'pre'
- };
-
-/***/ },
-/* 19 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = {
- /** Additional CSS class names to be added to highlighter elements. */
- 'class-name': '',
-
- /** First line number. */
- 'first-line': 1,
-
- /**
- * Pads line numbers. Possible values are:
- *
- * false - don't pad line numbers.
- * true - automaticaly pad numbers with minimum required number of leading zeroes.
- * [int] - length up to which pad line numbers.
- */
- 'pad-line-numbers': false,
-
- /** Lines to highlight. */
- 'highlight': null,
-
- /** Title to be displayed above the code block. */
- 'title': null,
-
- /** Enables or disables smart tabs. */
- 'smart-tabs': true,
-
- /** Gets or sets tab size. */
- 'tab-size': 4,
-
- /** Enables or disables gutter. */
- 'gutter': true,
-
- /** Enables quick code copy and paste from double click. */
- 'quick-code': true,
-
- /** Forces code view to be collapsed. */
- 'collapse': false,
-
- /** Enables or disables automatic links. */
- 'auto-links': true,
-
- 'unindent': true,
-
- 'html-script': false
- };
-
-/***/ },
-/* 20 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(process) {'use strict';
-
- var applyRegexList = __webpack_require__(5).applyRegexList;
-
- function HtmlScript(BrushXML, brushClass) {
- var scriptBrush,
- xmlBrush = new BrushXML();
-
- if (brushClass == null) return;
-
- scriptBrush = new brushClass();
-
- if (scriptBrush.htmlScript == null) throw new Error('Brush wasn\'t configured for html-script option: ' + brushClass.brushName);
-
- xmlBrush.regexList.push({ regex: scriptBrush.htmlScript.code, func: process });
-
- this.regexList = xmlBrush.regexList;
-
- function offsetMatches(matches, offset) {
- for (var j = 0, l = matches.length; j < l; j++) {
- matches[j].index += offset;
- }
- }
-
- function process(match, info) {
- var code = match.code,
- results = [],
- regexList = scriptBrush.regexList,
- offset = match.index + match.left.length,
- htmlScript = scriptBrush.htmlScript,
- matches;
-
- function add(matches) {
- results = results.concat(matches);
- }
-
- matches = applyRegexList(code, regexList);
- offsetMatches(matches, offset);
- add(matches);
-
- // add left script bracket
- if (htmlScript.left != null && match.left != null) {
- matches = applyRegexList(match.left, [htmlScript.left]);
- offsetMatches(matches, match.index);
- add(matches);
- }
-
- // add right script bracket
- if (htmlScript.right != null && match.right != null) {
- matches = applyRegexList(match.right, [htmlScript.right]);
- offsetMatches(matches, match.index + match[0].lastIndexOf(match.right));
- add(matches);
- }
-
- for (var j = 0, l = results.length; j < l; j++) {
- results[j].brushName = brushClass.brushName;
- }return results;
- }
- };
-
- module.exports = HtmlScript;
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(21)))
-
-/***/ },
-/* 21 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- // shim for using process in browser
- var process = module.exports = {};
-
- // cached from whatever global is present so that test runners that stub it
- // don't break things. But we need to wrap it in a try catch in case it is
- // wrapped in strict mode code which doesn't define any globals. It's inside a
- // function because try/catches deoptimize in certain engines.
-
- var cachedSetTimeout;
- var cachedClearTimeout;
-
- function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
- }
- function defaultClearTimeout() {
- throw new Error('clearTimeout has not been defined');
- }
- (function () {
- try {
- if (typeof setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- } else {
- cachedSetTimeout = defaultSetTimout;
- }
- } catch (e) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- if (typeof clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- } else {
- cachedClearTimeout = defaultClearTimeout;
- }
- } catch (e) {
- cachedClearTimeout = defaultClearTimeout;
- }
- })();
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- }
- // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch (e) {
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- }
- // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e) {
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
-
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
-
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
-
- var len = queue.length;
- while (len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
-
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- };
-
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
-
- function noop() {}
-
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
-
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
-
- process.cwd = function () {
- return '/';
- };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function () {
- return 0;
- };
-
-/***/ },
-/* 22 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- var _syntaxhighlighterHtmlRenderer = __webpack_require__(9);
-
- var _syntaxhighlighterHtmlRenderer2 = _interopRequireDefault(_syntaxhighlighterHtmlRenderer);
-
- var _syntaxhighlighterRegex = __webpack_require__(3);
-
- var _syntaxhighlighterMatch = __webpack_require__(5);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- module.exports = function () {
- function BrushBase() {
- _classCallCheck(this, BrushBase);
- }
-
- _createClass(BrushBase, [{
- key: 'getKeywords',
-
- /**
- * Converts space separated list of keywords into a regular expression string.
- * @param {String} str Space separated keywords.
- * @return {String} Returns regular expression string.
- */
- value: function getKeywords(str) {
- var results = str.replace(/^\s+|\s+$/g, '').replace(/\s+/g, '|');
-
- return '\\b(?:' + results + ')\\b';
- }
-
- /**
- * Makes a brush compatible with the `html-script` functionality.
- * @param {Object} regexGroup Object containing `left` and `right` regular expressions.
- */
-
- }, {
- key: 'forHtmlScript',
- value: function forHtmlScript(regexGroup) {
- var regex = { 'end': regexGroup.right.source };
-
- if (regexGroup.eof) {
- regex.end = '(?:(?:' + regex.end + ')|$)';
- }
-
- this.htmlScript = {
- left: { regex: regexGroup.left, css: 'script' },
- right: { regex: regexGroup.right, css: 'script' },
- code: (0, _syntaxhighlighterRegex.XRegExp)("(?" + regexGroup.left.source + ")" + "(?.*?)" + "(?" + regex.end + ")", "sgi")
- };
- }
- }, {
- key: 'getHtml',
- value: function getHtml(code) {
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
-
- var matches = (0, _syntaxhighlighterMatch.applyRegexList)(code, this.regexList);
- var renderer = new _syntaxhighlighterHtmlRenderer2.default(code, matches, params);
- return renderer.getHtml();
- }
- }]);
-
- return BrushBase;
- }();
-
-/***/ },
-/* 23 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var BrushBase = __webpack_require__(22);
- var regexLib = __webpack_require__(3).commonRegExp;
-
- function Brush() {
- var keywords = 'break case catch class continue ' + 'default delete do else enum export extends false ' + 'for from as function if implements import in instanceof ' + 'interface let new null package private protected ' + 'static return super switch ' + 'this throw true try typeof var while with yield';
-
- this.regexList = [{
- regex: regexLib.multiLineDoubleQuotedString,
- css: 'string'
- }, {
- regex: regexLib.multiLineSingleQuotedString,
- css: 'string'
- }, {
- regex: regexLib.singleLineCComments,
- css: 'comments'
- }, {
- regex: regexLib.multiLineCComments,
- css: 'comments'
- }, {
- regex: /\s*#.*/gm,
- css: 'preprocessor'
- }, {
- regex: new RegExp(this.getKeywords(keywords), 'gm'),
- css: 'keyword'
- }];
-
- this.forHtmlScript(regexLib.scriptScriptTags);
- }
-
- Brush.prototype = new BrushBase();
- Brush.aliases = ['js', 'jscript', 'javascript', 'json'];
- module.exports = Brush;
-
-/***/ },
-/* 24 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
- /*!
- * domready (c) Dustin Diaz 2014 - License MIT
- */
- !function (name, definition) {
-
- if (true) module.exports = definition();else if (typeof define == 'function' && _typeof(define.amd) == 'object') define(definition);else this[name] = definition();
- }('domready', function () {
-
- var fns = [],
- _listener,
- doc = document,
- hack = doc.documentElement.doScroll,
- domContentLoaded = 'DOMContentLoaded',
- loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState);
-
- if (!loaded) doc.addEventListener(domContentLoaded, _listener = function listener() {
- doc.removeEventListener(domContentLoaded, _listener);
- loaded = 1;
- while (_listener = fns.shift()) {
- _listener();
- }
- });
-
- return function (fn) {
- loaded ? setTimeout(fn, 0) : fns.push(fn);
- };
- });
-
-/***/ },
-/* 25 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var string = exports.string = function string(value) {
- return value.replace(/^([A-Z])/g, function (_, character) {
- return character.toLowerCase();
- }).replace(/([A-Z])/g, function (_, character) {
- return '-' + character.toLowerCase();
- });
- };
-
- var object = exports.object = function object(value) {
- var result = {};
- Object.keys(value).forEach(function (key) {
- return result[string(key)] = value[key];
- });
- return result;
- };
-
-/***/ }
-/******/ ]);
-//# sourceMappingURL=syntaxhighlighter.js.map
\ No newline at end of file
diff --git a/demo/code-demo/syntaxHighlighter/theme.css b/demo/code-demo/syntaxHighlighter/theme.css
deleted file mode 100644
index bbd2546c..00000000
--- a/demo/code-demo/syntaxHighlighter/theme.css
+++ /dev/null
@@ -1,238 +0,0 @@
-.syntaxhighlighter a,
-.syntaxhighlighter div,
-.syntaxhighlighter code,
-.syntaxhighlighter table,
-.syntaxhighlighter table td,
-.syntaxhighlighter table tr,
-.syntaxhighlighter table tbody,
-.syntaxhighlighter table thead,
-.syntaxhighlighter table caption,
-.syntaxhighlighter textarea {
- -moz-border-radius: 0 0 0 0 !important;
- -webkit-border-radius: 0 0 0 0 !important;
- background: none !important;
- border: 0 !important;
- bottom: auto !important;
- float: none !important;
- height: auto !important;
- left: auto !important;
- line-height: 1.1em !important;
- margin: 0 !important;
- outline: 0 !important;
- overflow: visible !important;
- padding: 0 !important;
- position: static !important;
- right: auto !important;
- text-align: left !important;
- top: auto !important;
- vertical-align: baseline !important;
- width: auto !important;
- box-sizing: content-box !important;
- font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
- font-weight: normal !important;
- font-style: normal !important;
- font-size: 1em !important;
- min-height: inherit !important;
- min-height: auto !important; }
-
-.syntaxhighlighter {
- width: 100% !important;
- margin: 1em 0 1em 0 !important;
- position: relative !important;
- overflow: auto !important;
- font-size: 1em !important; }
- .syntaxhighlighter .container:before, .syntaxhighlighter .container:after {
- content: none !important; }
- .syntaxhighlighter.source {
- overflow: hidden !important; }
- .syntaxhighlighter .bold {
- font-weight: bold !important; }
- .syntaxhighlighter .italic {
- font-style: italic !important; }
- .syntaxhighlighter .line {
- white-space: pre !important; }
- .syntaxhighlighter table {
- width: 100% !important; }
- .syntaxhighlighter table caption {
- text-align: left !important;
- padding: .5em 0 0.5em 1em !important; }
- .syntaxhighlighter table td.code {
- width: 100% !important; }
- .syntaxhighlighter table td.code .container {
- position: relative !important; }
- .syntaxhighlighter table td.code .container textarea {
- box-sizing: border-box !important;
- position: absolute !important;
- left: 0 !important;
- top: 0 !important;
- width: 100% !important;
- height: 100% !important;
- border: none !important;
- background: white !important;
- padding-left: 1em !important;
- overflow: hidden !important;
- white-space: pre !important; }
- .syntaxhighlighter table td.gutter .line {
- text-align: right !important;
- padding: 0 0.5em 0 1em !important; }
- .syntaxhighlighter table td.code .line {
- padding: 0 1em !important; }
- .syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line {
- padding-left: 0em !important; }
- .syntaxhighlighter.show {
- display: block !important; }
- .syntaxhighlighter.collapsed table {
- display: none !important; }
- .syntaxhighlighter.collapsed .toolbar {
- padding: 0.1em 0.8em 0em 0.8em !important;
- font-size: 1em !important;
- position: static !important;
- width: auto !important;
- height: auto !important; }
- .syntaxhighlighter.collapsed .toolbar span {
- display: inline !important;
- margin-right: 1em !important; }
- .syntaxhighlighter.collapsed .toolbar span a {
- padding: 0 !important;
- display: none !important; }
- .syntaxhighlighter.collapsed .toolbar span a.expandSource {
- display: inline !important; }
- .syntaxhighlighter .toolbar {
- position: absolute !important;
- right: 1px !important;
- top: 1px !important;
- width: 11px !important;
- height: 11px !important;
- font-size: 10px !important;
- z-index: 10 !important; }
- .syntaxhighlighter .toolbar span.title {
- display: inline !important; }
- .syntaxhighlighter .toolbar a {
- display: block !important;
- text-align: center !important;
- text-decoration: none !important;
- padding-top: 1px !important; }
- .syntaxhighlighter .toolbar a.expandSource {
- display: none !important; }
- .syntaxhighlighter.ie {
- font-size: .9em !important;
- padding: 1px 0 1px 0 !important; }
- .syntaxhighlighter.ie .toolbar {
- line-height: 8px !important; }
- .syntaxhighlighter.ie .toolbar a {
- padding-top: 0px !important; }
- .syntaxhighlighter.printing .line.alt1 .content,
- .syntaxhighlighter.printing .line.alt2 .content,
- .syntaxhighlighter.printing .line.highlighted .number,
- .syntaxhighlighter.printing .line.highlighted.alt1 .content,
- .syntaxhighlighter.printing .line.highlighted.alt2 .content {
- background: none !important; }
- .syntaxhighlighter.printing .line .number {
- color: #bbbbbb !important; }
- .syntaxhighlighter.printing .line .content {
- color: black !important; }
- .syntaxhighlighter.printing .toolbar {
- display: none !important; }
- .syntaxhighlighter.printing a {
- text-decoration: none !important; }
- .syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a {
- color: black !important; }
- .syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a {
- color: #008200 !important; }
- .syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a {
- color: blue !important; }
- .syntaxhighlighter.printing .keyword {
- color: #006699 !important;
- font-weight: bold !important; }
- .syntaxhighlighter.printing .preprocessor {
- color: gray !important; }
- .syntaxhighlighter.printing .variable {
- color: #aa7700 !important; }
- .syntaxhighlighter.printing .value {
- color: #009900 !important; }
- .syntaxhighlighter.printing .functions {
- color: #ff1493 !important; }
- .syntaxhighlighter.printing .constants {
- color: #0066cc !important; }
- .syntaxhighlighter.printing .script {
- font-weight: bold !important; }
- .syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a {
- color: gray !important; }
- .syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a {
- color: #ff1493 !important; }
- .syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a {
- color: red !important; }
- .syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a {
- color: black !important; }
-
-.syntaxhighlighter {
- background-color: white !important; }
- .syntaxhighlighter .line.alt1 {
- background-color: white !important; }
- .syntaxhighlighter .line.alt2 {
- background-color: white !important; }
- .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 {
- background-color: #e0e0e0 !important; }
- .syntaxhighlighter .line.highlighted.number {
- color: black !important; }
- .syntaxhighlighter table caption {
- color: black !important; }
- .syntaxhighlighter table td.code .container textarea {
- background: white;
- color: black; }
- .syntaxhighlighter .gutter {
- color: #afafaf !important; }
- .syntaxhighlighter .gutter .line {
- border-right: 3px solid #6ce26c !important; }
- .syntaxhighlighter .gutter .line.highlighted {
- background-color: #6ce26c !important;
- color: white !important; }
- .syntaxhighlighter.printing .line .content {
- border: none !important; }
- .syntaxhighlighter.collapsed {
- overflow: visible !important; }
- .syntaxhighlighter.collapsed .toolbar {
- color: #00f !important;
- background: #fff !important;
- border: 1px solid #6ce26c !important; }
- .syntaxhighlighter.collapsed .toolbar a {
- color: #00f !important; }
- .syntaxhighlighter.collapsed .toolbar a:hover {
- color: #f00 !important; }
- .syntaxhighlighter .toolbar {
- color: #fff !important;
- background: #6ce26c !important;
- border: none !important; }
- .syntaxhighlighter .toolbar a {
- color: #fff !important; }
- .syntaxhighlighter .toolbar a:hover {
- color: #000 !important; }
- .syntaxhighlighter .plain, .syntaxhighlighter .plain a {
- color: black !important; }
- .syntaxhighlighter .comments, .syntaxhighlighter .comments a {
- color: #008200 !important; }
- .syntaxhighlighter .string, .syntaxhighlighter .string a {
- color: blue !important; }
- .syntaxhighlighter .keyword {
- font-weight: bold !important;
- color: #006699 !important; }
- .syntaxhighlighter .preprocessor {
- color: gray !important; }
- .syntaxhighlighter .variable {
- color: #aa7700 !important; }
- .syntaxhighlighter .value {
- color: #009900 !important; }
- .syntaxhighlighter .functions {
- color: #ff1493 !important; }
- .syntaxhighlighter .constants {
- color: #0066cc !important; }
- .syntaxhighlighter .script {
- font-weight: bold !important;
- color: #006699 !important;
- background-color: none !important; }
- .syntaxhighlighter .color1, .syntaxhighlighter .color1 a {
- color: gray !important; }
- .syntaxhighlighter .color2, .syntaxhighlighter .color2 a {
- color: #ff1493 !important; }
- .syntaxhighlighter .color3, .syntaxhighlighter .color3 a {
- color: red !important; }
diff --git a/demo/dataselection.html b/demo/dataselection.html
deleted file mode 100644
index 400cb49a..00000000
--- a/demo/dataselection.html
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
- Power BI - Sample - Client - JavaScript
-
-
-
-
-
-
-
-
Power BI - Sample - Client - Javascript
-
Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript
-
-
Scenarios:
-
-
-
Data Selection Events
-
Respond to user selecting data.
-
-
-
-
Data Selected Event Data:
-
Notice the event.detail contains information about the visual the user clicked and the page the visual is on. It also contains details about the data the user clicked such as identity, value, and regions if applicable.
-
Note: the values rendered in the tooltip are currently not returned in event but we hope to have this feature soon.
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/defaults.html b/demo/defaults.html
deleted file mode 100644
index aa511b2a..00000000
--- a/demo/defaults.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
- Power BI - Sample - Client - JavaScript
-
-
-
-
-
-
-
-
Power BI - Sample - Client - Javascript
-
Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript
-
-
Scenarios:
-
-
-
Default Page and/or Default Filter
-
Load a report at a specified page and/or report level filter.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/dynamic.html b/demo/dynamic.html
deleted file mode 100644
index b24c61a2..00000000
--- a/demo/dynamic.html
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
- Power BI - Sample - Client - JavaScript
-
-
-
-
-
-
-
-
Power BI - Sample - Client - Javascript
-
Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript
-
-
Scenarios:
-
-
-
Dynamic Embed
-
Report to embed is chosen by the user.
-
-
-
- Reset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/filters.html b/demo/filters.html
deleted file mode 100644
index dc036fb0..00000000
--- a/demo/filters.html
+++ /dev/null
@@ -1,293 +0,0 @@
-
-
-
-
-
-
- Power BI - Sample - Client - JavaScript
-
-
-
-
-
-
-
-
Power BI - Sample - Client - Javascript
-
Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript
-
-
Scenarios:
-
-
-
Custom Filter Pane
-
Filter pane is hidden in the embedded report and recreated by developer to allow custom branding or focused experience on filters specialized for the report.
-
-
-
-
-
-
-
Report
-
-
-
Page
-
-
-
Visual
-
-
-
-
-
-
- Not Implemented
-
-
-
-
-
-
Predefined Advanced Report Filter
-
Store > Name Contains 'Direct'
-
Predefined Advanced Report Filter
-
Store > Name contains 'Wash' or contains 'Park'
-
-
-
Predefined Advanced Page Filter
-
Store > Name contains 'Wash' or contains 'Park' (Page: District Monthly Sales)
-
-
- Not Implemented
-
-
-
-
-
-
-
-
-
Applied Filters
-
- Refresh
-
-
-
Report Level
-
-
-
-
Page Level
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/index.html b/demo/index.html
deleted file mode 100644
index 33939d94..00000000
--- a/demo/index.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
diff --git a/demo/package.json b/demo/package.json
deleted file mode 100644
index 8ad74a40..00000000
--- a/demo/package.json
+++ /dev/null
@@ -1,43 +0,0 @@
-{
- "name": "powerbi-client-demo",
- "version": "1.0.0",
- "description": "Demonstration of embedding Power BI using JavaScript library.",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1",
- "start": "http-server ."
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/Microsoft/PowerBI-JavaScript.git"
- },
- "keywords": [
- "microsoft",
- "powerbi",
- "embedded"
- ],
- "author": "Microsoft",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/Microsoft/PowerBI-JavaScript/issues"
- },
- "homepage": "https://github.com/Microsoft/PowerBI-JavaScript/demo",
- "ignore": [
- "**/.*",
- "node_modules",
- "test",
- "tests"
- ],
- "dependencies": {
- "bootstrap": "^4.1.2",
- "ecstatic": "^3.3.1",
- "es6-promise": "^3.2.2",
- "fetch": "^1.0.0",
- "http-server": "^0.9.0",
- "jquery": "^3.1.0",
- "powerbi-client": "file:..",
- "powerbi-report-authoring": "^1.1",
- "syntaxhighlighter": "4.0.1"
- },
- "devDependencies": {}
-}
diff --git a/demo/pagenavigation.html b/demo/pagenavigation.html
deleted file mode 100644
index af277a2c..00000000
--- a/demo/pagenavigation.html
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
- Power BI - Sample - Client - JavaScript
-
-
-
-
-
-
-
-
Power BI - Sample - Client - Javascript
-
Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript
-
-
Scenarios:
-
-
-
Custom Page Navigation
-
Page navigation is hidden in the embedded report and recreated by developer to allow custom branding or even automation to tell stories and navigate user.
-
-
-
-
-
< Prev
-
-
-
Cycle
-
Next >
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/settings.html b/demo/settings.html
deleted file mode 100644
index 8657c6b9..00000000
--- a/demo/settings.html
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
- Power BI - Sample - Client - JavaScript
-
-
-
-
-
-
-
-
Power BI - Sample - Client - Javascript
-
Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript
-
-
Scenarios:
-
-
-
Update Settings
-
Change visibility of filter pane or page navigation dynamically
-
-
-
-
-
- Toggle Filter Pane
- Toggle Page Navigation
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/static.html b/demo/static.html
deleted file mode 100644
index e007ad56..00000000
--- a/demo/static.html
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
- Power BI - Sample - Client - JavaScript
-
-
-
-
-
-
-
-
Power BI - Sample - Client - Javascript
-
Demonstrate how to embed reports and interact with them using the api provided by the core library. PowerBI-JavaScript
-
-
Scenarios:
-
-
-
Static Embed
-
Report to embed is known by the developer.
-
-
-
-
-
- Get Report ID
- Toggle Fullscreen
- Reload Report
- Print Report
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/styles/app.css b/demo/styles/app.css
deleted file mode 100644
index 30b0e98d..00000000
--- a/demo/styles/app.css
+++ /dev/null
@@ -1,68 +0,0 @@
-body {
- padding: 2em 0;
-}
-
-.powerbi-container {
- height: 600px;
-}
-.powerbi-container iframe {
- border: none;
-}
-
-#reportslist {
- margin: 0 0 1em 0;
-}
-#reportslist li {
- margin: 1em 0;
-}
-.reportslistdescription {
- margin: 1em 0 0 0;
- font-weight: bold;
-}
-.report-name {
- display: inline-block;
- margin: 0 1em;
- font-weight: bold;
-}
-.checkbox {
- margin-left: 1em;
-}
-
-.reportpageslist {
- display: flex;
- margin-top: 2em;
-}
-.reportpageslist__pages {
- flex: 1;
-}
-
-.reportpageslist__pages button {
- margin-left: 1em;
-}
-.reportpageslist__pages button.btn-success.active {
- background-color: red;
-}
-.reportpageslist__cycle {
- margin-right: 1em;
-}
-.reportpageslist__cycle.btn-warning.active {
- background-color: red;
-}
-
-.filters > * + * {
- margin-top: 1em;
-}
-.filter {
- padding: 0.5em;
- border: 1px solid #ddd;
- border-radius: 4px;
-}
-.filter__remove {
- float: right;
-}
-.filter__text {
- margin-right: 3em;
- word-break: break-all;
- font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
- font-size: 90%;
-}
\ No newline at end of file
diff --git a/demo/v2-demo/code_area.html b/demo/v2-demo/code_area.html
deleted file mode 100644
index 1e181566..00000000
--- a/demo/v2-demo/code_area.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Code
-
-
- Run
-
-
- Copy
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/docs.html b/demo/v2-demo/docs.html
deleted file mode 100644
index 1307a7cc..00000000
--- a/demo/v2-demo/docs.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
-
Videos
-
- What is Power BI Embedded
- VIDEO
-
-
- Microsoft Power BI Embedded update
- VIDEO
-
-
- Get an embed token & embed your analytics
- VIDEO
-
-
- Setting up and getting started
-
-
- Your browser does not support the video tag.
-
-
-
- Power BI Embedded JavaScript SDK
-
-
- Your browser does not support the video tag.
-
-
-
- Extend context menu feature
- VIDEO
-
-
-
-
diff --git a/demo/v2-demo/images/AlignCenter.svg b/demo/v2-demo/images/AlignCenter.svg
deleted file mode 100644
index bc78cb5e..00000000
--- a/demo/v2-demo/images/AlignCenter.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/AlignCenterGrey.svg b/demo/v2-demo/images/AlignCenterGrey.svg
deleted file mode 100644
index 76f28641..00000000
--- a/demo/v2-demo/images/AlignCenterGrey.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/AlignLeft.svg b/demo/v2-demo/images/AlignLeft.svg
deleted file mode 100644
index f47b6149..00000000
--- a/demo/v2-demo/images/AlignLeft.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/AlignLeftGrey.svg b/demo/v2-demo/images/AlignLeftGrey.svg
deleted file mode 100644
index 26f7fc84..00000000
--- a/demo/v2-demo/images/AlignLeftGrey.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/AlignRight.svg b/demo/v2-demo/images/AlignRight.svg
deleted file mode 100644
index f0d163e6..00000000
--- a/demo/v2-demo/images/AlignRight.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/AlignRightGrey.svg b/demo/v2-demo/images/AlignRightGrey.svg
deleted file mode 100644
index 80f8ee60..00000000
--- a/demo/v2-demo/images/AlignRightGrey.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/EraseTool.svg b/demo/v2-demo/images/EraseTool.svg
deleted file mode 100644
index d2d89534..00000000
--- a/demo/v2-demo/images/EraseTool.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/EraseToolGrey.svg b/demo/v2-demo/images/EraseToolGrey.svg
deleted file mode 100644
index 2e1d3827..00000000
--- a/demo/v2-demo/images/EraseToolGrey.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/add.svg b/demo/v2-demo/images/add.svg
deleted file mode 100644
index 6481c174..00000000
--- a/demo/v2-demo/images/add.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/demo/v2-demo/images/ajax-loader.gif b/demo/v2-demo/images/ajax-loader.gif
deleted file mode 100644
index f40db398..00000000
Binary files a/demo/v2-demo/images/ajax-loader.gif and /dev/null differ
diff --git a/demo/v2-demo/images/bookmarkIcon.svg b/demo/v2-demo/images/bookmarkIcon.svg
deleted file mode 100644
index e9ae9764..00000000
--- a/demo/v2-demo/images/bookmarkIcon.svg
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/clear.svg b/demo/v2-demo/images/clear.svg
deleted file mode 100644
index 86f2bcf4..00000000
--- a/demo/v2-demo/images/clear.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/close.png b/demo/v2-demo/images/close.png
deleted file mode 100644
index 0a1520af..00000000
Binary files a/demo/v2-demo/images/close.png and /dev/null differ
diff --git a/demo/v2-demo/images/closeWhite.png b/demo/v2-demo/images/closeWhite.png
deleted file mode 100644
index aa9cb92f..00000000
Binary files a/demo/v2-demo/images/closeWhite.png and /dev/null differ
diff --git a/demo/v2-demo/images/collapse.svg b/demo/v2-demo/images/collapse.svg
deleted file mode 100644
index 6e6d9d71..00000000
--- a/demo/v2-demo/images/collapse.svg
+++ /dev/null
@@ -1,45 +0,0 @@
-
-collapse
-Created using Figma
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/copy.svg b/demo/v2-demo/images/copy.svg
deleted file mode 100644
index 3d38c462..00000000
--- a/demo/v2-demo/images/copy.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/expand.svg b/demo/v2-demo/images/expand.svg
deleted file mode 100644
index 62e1debf..00000000
--- a/demo/v2-demo/images/expand.svg
+++ /dev/null
@@ -1,57 +0,0 @@
-
-expand
-Created using Figma
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/ic_1column.svg b/demo/v2-demo/images/ic_1column.svg
deleted file mode 100644
index 12ffa519..00000000
--- a/demo/v2-demo/images/ic_1column.svg
+++ /dev/null
@@ -1 +0,0 @@
-ic_1column
\ No newline at end of file
diff --git a/demo/v2-demo/images/ic_2columns.svg b/demo/v2-demo/images/ic_2columns.svg
deleted file mode 100644
index ffe6b2bd..00000000
--- a/demo/v2-demo/images/ic_2columns.svg
+++ /dev/null
@@ -1 +0,0 @@
-ic_2columns
\ No newline at end of file
diff --git a/demo/v2-demo/images/ic_3columns.svg b/demo/v2-demo/images/ic_3columns.svg
deleted file mode 100644
index dd4e737c..00000000
--- a/demo/v2-demo/images/ic_3columns.svg
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/info.svg b/demo/v2-demo/images/info.svg
deleted file mode 100644
index b663a35f..00000000
--- a/demo/v2-demo/images/info.svg
+++ /dev/null
@@ -1,29 +0,0 @@
-
-ic_info
-Created using Figma
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/insightToActionIcon.svg b/demo/v2-demo/images/insightToActionIcon.svg
deleted file mode 100644
index c678c87b..00000000
--- a/demo/v2-demo/images/insightToActionIcon.svg
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/layoutIcon.svg b/demo/v2-demo/images/layoutIcon.svg
deleted file mode 100644
index 1e647cbe..00000000
--- a/demo/v2-demo/images/layoutIcon.svg
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/new.svg b/demo/v2-demo/images/new.svg
deleted file mode 100644
index 19e1f464..00000000
--- a/demo/v2-demo/images/new.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/pc.svg b/demo/v2-demo/images/pc.svg
deleted file mode 100644
index f7d3bc8d..00000000
--- a/demo/v2-demo/images/pc.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/phone.svg b/demo/v2-demo/images/phone.svg
deleted file mode 100644
index 3fe20ed6..00000000
--- a/demo/v2-demo/images/phone.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/print.svg b/demo/v2-demo/images/print.svg
deleted file mode 100644
index 362dc528..00000000
--- a/demo/v2-demo/images/print.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/quickVisualCreatorIcon.svg b/demo/v2-demo/images/quickVisualCreatorIcon.svg
deleted file mode 100644
index a1600a87..00000000
--- a/demo/v2-demo/images/quickVisualCreatorIcon.svg
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/images/reset.svg b/demo/v2-demo/images/reset.svg
deleted file mode 100644
index 1987b5d8..00000000
--- a/demo/v2-demo/images/reset.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/run.svg b/demo/v2-demo/images/run.svg
deleted file mode 100644
index 7a68c85b..00000000
--- a/demo/v2-demo/images/run.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/demo/v2-demo/images/sampledashboard.png b/demo/v2-demo/images/sampledashboard.png
deleted file mode 100644
index f9539c7c..00000000
Binary files a/demo/v2-demo/images/sampledashboard.png and /dev/null differ
diff --git a/demo/v2-demo/images/sampleqna.png b/demo/v2-demo/images/sampleqna.png
deleted file mode 100644
index 3bfbfe22..00000000
Binary files a/demo/v2-demo/images/sampleqna.png and /dev/null differ
diff --git a/demo/v2-demo/images/samplerdlreport.png b/demo/v2-demo/images/samplerdlreport.png
deleted file mode 100644
index a4ff0af9..00000000
Binary files a/demo/v2-demo/images/samplerdlreport.png and /dev/null differ
diff --git a/demo/v2-demo/images/samplereport.png b/demo/v2-demo/images/samplereport.png
deleted file mode 100644
index 63e5239c..00000000
Binary files a/demo/v2-demo/images/samplereport.png and /dev/null differ
diff --git a/demo/v2-demo/images/sampletile.png b/demo/v2-demo/images/sampletile.png
deleted file mode 100644
index 40e53215..00000000
Binary files a/demo/v2-demo/images/sampletile.png and /dev/null differ
diff --git a/demo/v2-demo/images/samplevisual.png b/demo/v2-demo/images/samplevisual.png
deleted file mode 100644
index 9248945e..00000000
Binary files a/demo/v2-demo/images/samplevisual.png and /dev/null differ
diff --git a/demo/v2-demo/images/share.png b/demo/v2-demo/images/share.png
deleted file mode 100644
index e536f7f3..00000000
Binary files a/demo/v2-demo/images/share.png and /dev/null differ
diff --git a/demo/v2-demo/images/tab_out.svg b/demo/v2-demo/images/tab_out.svg
deleted file mode 100644
index 33de730c..00000000
--- a/demo/v2-demo/images/tab_out.svg
+++ /dev/null
@@ -1 +0,0 @@
-TAB OUT
\ No newline at end of file
diff --git a/demo/v2-demo/images/themesIcon.svg b/demo/v2-demo/images/themesIcon.svg
deleted file mode 100644
index ba3532ad..00000000
--- a/demo/v2-demo/images/themesIcon.svg
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/index.html b/demo/v2-demo/index.html
deleted file mode 100644
index 5f51cadb..00000000
--- a/demo/v2-demo/index.html
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- NEW
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.html b/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.html
deleted file mode 100644
index 4bdfa4c9..00000000
--- a/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.html
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
Capture & share bookmarks
-
-
- By using bookmarks in Power BI, you can capture the current configured view of a report page, including filtering and the state of visuals.
- Use this showcase to experience the capabilities of the bookmarks API, so your users can create and share their own bookmarks.
-
1. Choose and Apply pre-defined bookmarks
-
- The menu on the left displays the report's existing bookmarks. You can switch between available bookmarks by clicking on the desired bookmark's name
-
-
2. Capture new bookmarks
-
- After interacting with the report (filtering, clicking on visuals etc), click on 'Capture bookmark', the captured bookmark will be added to the menu.
-
-
3. Share bookmarks with others
-
- Select the bookmark you want to share and then click the 'share' icon. Copy and paste the given URL into a new browser tab to see the embedded report
- with the bookmark applied.
-
-
-
-
-
-
-
-
-
Embedded view
-
-
- Capture Bookmark
-
-
-
-
-
-
-
-
-
-
-
Link to ' ' created
-
Make sure you copy the link below.
-
-
Copy
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.js b/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.js
deleted file mode 100644
index d69c9199..00000000
--- a/demo/v2-demo/live_showcases/bookmarks/showcase_bookmarks.js
+++ /dev/null
@@ -1,303 +0,0 @@
-
-
-var BookmarkShowcaseState = {
- bookmarksArray: null,
- bookmarksReport: null,
-
- // Next bookmark ID counter
- nextBookmarkId: 1
-}
-
-const dialogTextSelectTimeout = 50;
-
-// Embed the report and retrieve the existing report bookmarks
-function embedBookmarksReport() {
-
- // Load sample report properties into session
- return LoadSampleReportIntoSession().then(function () {
-
- // Get models. models contains enums that can be used
- const models = window['powerbi-client'].models;
-
- // Get embed application token from session
- var accessToken = GetSession(SessionKeys.AccessToken);
-
- // Get embed URL from session
- var embedUrl = GetSession(SessionKeys.EmbedUrl);
-
- // Get report Id from session
- var embedReportId = GetSession(SessionKeys.EmbedId);
-
- // Use View permissions
- var permissions = models.Permissions.View;
-
- // Embed configuration used to describe the what and how to embed
- // This object is used when calling powerbi.embed
- // This also includes settings and options such as filters
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details
- var config= {
- type: 'report',
- tokenType: models.TokenType.Embed,
- accessToken: accessToken,
- embedUrl: embedUrl,
- id: embedReportId,
- permissions: permissions,
- settings: {
- filterPaneEnabled: true,
- navContentPaneEnabled: false,
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container
- BookmarkShowcaseState.bookmarksReport = powerbi.embed(embedContainer, config);
-
- // Report.on will add an event handler for report loaded event.
- BookmarkShowcaseState.bookmarksReport.on("loaded", function() {
-
- // Get report's existing bookmarks
- BookmarkShowcaseState.bookmarksReport.bookmarksManager.getBookmarks().then(function (bookmarks) {
-
- // Create bookmarks list from the existing report bookmarks
- createBookmarksList(bookmarks);
- });
- });
- });
-}
-
-// Embed shared report with bookmark on load
-function embedSharedBookmark(enableFilterPane, bookmarkState) {
-
- // Load sample report properties into session
- LoadSampleReportIntoSession().then(function () {
-
- // Get models. models contains enums that can be used
- const models = window['powerbi-client'].models;
-
- // Get embed application token from session
- var accessToken = GetSession(SessionKeys.AccessToken);
-
- // Get embed URL from session
- var embedUrl = GetSession(SessionKeys.EmbedUrl);
-
- // Get report Id from session
- var embedReportId = GetSession(SessionKeys.EmbedId);
-
- // Use View permissions
- var permissions = models.Permissions.View;
-
- // Get the bookmark name from url param
- var bookmarkName = GetBookmarkNameFromURL();
-
- // Get the bookmark state from local storage
- // any type of database can be used
- var bookmarkState = localStorage.getItem(bookmarkName);
-
- // Embed configuration used to describe the what and how to embed
- // This object is used when calling powerbi.embed
- // This also includes settings and options such as filters
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details
- var config= {
- type: 'report',
- tokenType: models.TokenType.Embed,
- accessToken: accessToken,
- embedUrl: embedUrl,
- id: embedReportId,
- permissions: permissions,
- settings: {
- filterPaneEnabled: false,
- navContentPaneEnabled: false,
- },
-
- // Adding bookmark attribute will apply the bookmark on load
- bookmark: {
- state: bookmarkState
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container
- BookmarkShowcaseState.bookmarksReport = powerbi.embed(embedContainer, config);
- });
-}
-
-// Create a bookmarks list from the existing report bookmarks and update the HTML
-function createBookmarksList(bookmarks) {
-
- // Reset next bookmark ID
- BookmarkShowcaseState.nextBookmarkId = 1;
-
- // Set bookmarks array to the report's fetched bookmarks
- BookmarkShowcaseState.bookmarksArray = bookmarks;
-
- // Build the bookmarks list HTML code
- var bookmarksList = $('#bookmarksList');
- for (let i = 0; i < BookmarkShowcaseState.bookmarksArray.length; i++) {
- bookmarksList.append(buildBookmarkElement(BookmarkShowcaseState.bookmarksArray[i]));
- }
-
- // Set first bookmark active
- if (bookmarksList.length) {
- let firstBookmark = $('#' + BookmarkShowcaseState.bookmarksArray[0].name);
-
- // Apply first bookmark state
- onBookmarkClicked(firstBookmark[0]);
- }
-}
-
-// Capture new bookmark of the current state and update the bookmarks list
-function onBookmarkCaptureClicked() {
-
- // Element clicked animation
- elementClicked('#btnCaptureBookmark');
-
- // Capture the report's current state
- BookmarkShowcaseState.bookmarksReport.bookmarksManager.capture().then(function (capturedBookmark) {
-
- // Build bookmark element
- let bookmark = {
- name: "bookmark_" + BookmarkShowcaseState.nextBookmarkId,
- displayName: "Bookmark " + BookmarkShowcaseState.nextBookmarkId,
- state: capturedBookmark.state
- }
-
- // Add the new bookmark to the HTML list
- $('#bookmarksList').append(buildBookmarkElement(bookmark));
-
- // Set the captured bookmark as active
- setBookmarkActive($('#bookmark_' + BookmarkShowcaseState.nextBookmarkId));
-
- // Add the bookmark to the bookmarks array and increase the bookmarks number counter
- BookmarkShowcaseState.bookmarksArray.push(bookmark);
- BookmarkShowcaseState.nextBookmarkId++;
- });
-}
-
-// Set the bookmark as the active bookmark on the list
-function setBookmarkActive(bookmarkSelector) {
-
- // Remove share boomark icon
- $('#bookmarkShare').remove();
-
- // Find bookmark parent node
- let parentNode = (bookmarkSelector[0]).parentNode;
-
- // Add share bookmark icon to bookmark's line
- $(parentNode).append(buildShareElement());
-
- // Set bookmark radio button to checked
- bookmarkSelector.attr('checked', true);
-}
-
-// Closes the dialog
-function onCloseDialogClicked() {
- $('#overlay').hide();
- $('#shareDialog').hide();
-}
-
-// Copy the dialog's input text
-function onDialogCopyClicked() {
- CopyTextArea('#dialogInput', '#btnDialogCopy');
- $('#dialogInput').select();
-}
-
-// Apply clicked bookmark state and set it as the active bookmark on the list
-function onBookmarkClicked(element) {
-
- // Set the clicked bookmark as active
- setBookmarkActive($(element));
-
- // Get bookmark Id from HTML
- const bookmarkId = $(element).attr('id');
-
- // Find the bookmark in the bookmarks array
- let currentBookmark = getBookmarkByID(bookmarkId);
-
- // Apply the bookmark state
- BookmarkShowcaseState.bookmarksReport.bookmarksManager.applyState(currentBookmark.state);
-}
-
-// Open bookmark share dialog
-function shareBookmark(element) {
-
- // Get bookmark Id from HTML
- const bookmarkId = $($(element).siblings('input')).attr('id');
-
- // Find the bookmark in the bookmarks array
- let currentBookmark = getBookmarkByID(bookmarkId);
-
- // Build the share bookmark URL
- let shareUrl = location.href.substring(0, location.href.lastIndexOf("/")) + '/shareBookmark.html' + '?name=' + currentBookmark.name;
-
- // Store bookmark state with name as a key on the local storage
- // any type of database can be used
- localStorage.setItem(currentBookmark.name, currentBookmark.state);
-
- // Set bookmark display name and share URL on dialog HTML code
- $('#dialogBookmarkName').empty();
- var displayNameElement = document.createTextNode(currentBookmark.displayName);
- $('#dialogBookmarkName').append(displayNameElement);
- $('#dialogInput').val(shareUrl);
-
- // Show overlay and share dialog
- $('#overlay').show();
- $('#shareDialog').show();
-
- // Select dialog input after the dialog is shown
- setTimeout(function() {
- $('#dialogInput').select();
- }, dialogTextSelectTimeout);
-}
-
-// Get the bookmark with bookmarkId name
-function getBookmarkByID(bookmarkId) {
- return jQuery.grep(BookmarkShowcaseState.bookmarksArray, function (bookmark) { return bookmark.name === bookmarkId })[0];
-}
-
-// Build bookmark radio button HTML element
-function buildBookmarkElement(bookmark) {
- var labelElement = document.createElement("label");
- labelElement.setAttribute("class", "showcaseRadioContainer");
-
- var inputElement = document.createElement("input");
- inputElement.setAttribute("type", "radio");
- inputElement.setAttribute("name", "bookmark");
- inputElement.setAttribute("id", bookmark.name);
- inputElement.setAttribute("onclick", "onBookmarkClicked(this);");
- labelElement.appendChild(inputElement);
-
- var spanElement = document.createElement("span");
- spanElement.setAttribute("class", "showcaseRadioCheckmark");
- labelElement.appendChild(spanElement);
-
- var secondSpanElement = document.createElement("span");
- secondSpanElement.setAttribute("class", "radioTitle");
- var radioTitleElement = document.createTextNode(bookmark.displayName);
- secondSpanElement.appendChild(radioTitleElement);
- labelElement.appendChild(secondSpanElement);
-
- return labelElement;
-}
-
-// Build share icon HTML element
-function buildShareElement() {
- var imgElement = document.createElement("img");
- imgElement.setAttribute("src","images/share.png");
- imgElement.setAttribute("id","bookmarkShare");
- imgElement.setAttribute("onclick","shareBookmark(this);");
- return imgElement;
-}
-
-// Get the bookmark name from url 'name' argument
-function GetBookmarkNameFromURL() {
- url = window.location.href;
- let regex = new RegExp("[?&]name(=([^]*)|&|#|$)"),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2]);
-}
diff --git a/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.html b/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.html
deleted file mode 100644
index aa82e8a4..00000000
--- a/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.html
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
Dynamic report layout
-
-
- Use this showcase to learn the custom layout API for dynamic embedding of visuals.
-
1. Select the visuals from the menu on the left
-
- The configuration of each visual changes between 'Hide'/'Show', and the app dynamically calculates the position of each visual (see code) for each layout. Default view has all visuals selected.
-
-
2. Change the layout to fit different screens
-
- By choosing different layouts, the application sets size and position of each visual (see code),
- In this showcase, we show options of 3 columns, 2 columns and 1 column to fit different screen sizes.
-
-
-
-
-
-
-
-
Report visuals (Hide/Show)
-
-
-
-
Embedded view
-
-
- 3 Columns
-
-
- 2 Columns
-
-
- 1 Column
-
-
-
-
-
-
-
diff --git a/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.js b/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.js
deleted file mode 100644
index f9660f83..00000000
--- a/demo/v2-demo/live_showcases/custom_layout/showcase_custom_layout.js
+++ /dev/null
@@ -1,283 +0,0 @@
-
-const ColumnsNumber = {
- One: 1,
- Two: 2,
- Three: 3
-}
-
-const LayoutShowcaseConsts = {
- margin: 15,
- minPageWidth: 270
-}
-
-var LayoutShowcaseState = {
- columns: ColumnsNumber.Three,
- layoutVisuals: null,
- layoutReport: null,
- layoutPageName: null
-}
-
-// Embed the report and retrieve all report visuals
-function embedCustomLayoutReport() {
- // Defualt columns value is three columns
- LayoutShowcaseState.columns = ColumnsNumber.Three;
-
- // Load custom layout report properties into session
- LoadLayoutShowcaseReportIntoSession().then(function () {
-
- // Get models. models contains enums that can be used
- const models = window['powerbi-client'].models;
-
- // Get embed application token from session
- var accessToken = GetSession(SessionKeys.AccessToken);
-
- // Get embed URL from session
- var embedUrl = GetSession(SessionKeys.EmbedUrl);
-
- // Get report Id from session
- var embedReportId = GetSession(SessionKeys.EmbedId);
-
- // Use View permissions
- var permissions = models.Permissions.View;
-
- // Embed configuration used to describe the what and how to embed
- // This object is used when calling powerbi.embed
- // This also includes settings and options such as filters
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details
- var config= {
- type: 'report',
- tokenType: models.TokenType.Embed,
- accessToken: accessToken,
- embedUrl: embedUrl,
- id: embedReportId,
- permissions: permissions,
- settings: {
- filterPaneEnabled: false,
- navContentPaneEnabled: false
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container
- LayoutShowcaseState.layoutReport = powerbi.embed(embedContainer, config);
-
- // Report.on will add an event handler for report loaded event
- LayoutShowcaseState.layoutReport.on("loaded", function() {
-
- // After report is loaded, we find the active page and get all the visuals on it
- // Retrieve the page collection
- LayoutShowcaseState.layoutReport.getPages().then(function (pages) {
-
- // Retrieve active page
- let activePage = jQuery.grep(pages, function (page) { return page.isActive })[0];
-
- // Set layoutPageName to active page name
- LayoutShowcaseState.layoutPageName = activePage.name;
-
- // Retrieve active page visuals.
- activePage.getVisuals().then(function (visuals) {
- var reportVisuals = visuals.map(function (visual) {
- return {
- name: visual.name,
- title: visual.title,
- checked: true
- };
- });
-
- // Create visuals array from the visuals of the active page
- createVisualsArray(reportVisuals);
- });
- });
- });
- });
-}
-
-// Create visuals array from the report visuals and update the HTML
-function createVisualsArray(reportVisuals) {
-
- // Remove all visuals without titles (i.e cards)
- LayoutShowcaseState.layoutVisuals = reportVisuals.filter(function (visual) {
- return visual.title !== undefined;
- });
-
- // Clear visuals list div
- $('#visualsList').empty();
-
- // Build checkbox html list and insert the html code to visualsList div
- for (let i = 0; i < LayoutShowcaseState.layoutVisuals.length; i++) {
- $('#visualsList').append(buildVisualElement(LayoutShowcaseState.layoutVisuals[i]));
- }
-
- // Render all visuals
- renderVisuals();
-}
-
-// Render all visuals with current configuration
-function renderVisuals() {
-
- // render only if report and visuals initialized
- if (!LayoutShowcaseState.layoutReport || !LayoutShowcaseState.layoutVisuals)
- return;
-
- // Get models. models contains enums that can be used
- const models = window['powerbi-client'].models;
-
- // Get embedContainer width and height
- let pageWidth = $('#embedContainer').width();
- let pageHeight = $('#embedContainer').height();
-
- // Calculating the overall width of the visuals in each row
- let visualsTotalWidth = pageWidth - (LayoutShowcaseConsts.margin * (LayoutShowcaseState.columns + 1));
-
- // Calculate the width of a single visual, according to the number of columns
- // For one and three columns visuals width will be a third of visuals total width
- let width = (LayoutShowcaseState.columns === ColumnsNumber.Two) ? (visualsTotalWidth / 2) : (visualsTotalWidth / 3);
-
- // For one column, set page width to visual's width with margins
- if (LayoutShowcaseState.columns === ColumnsNumber.One) {
- pageWidth = width + 2 * LayoutShowcaseConsts.margin;
-
- // Check if page width is smaller than minimum width and update accordingly
- if (pageWidth < LayoutShowcaseConsts.minPageWidth) {
- pageWidth = LayoutShowcaseConsts.minPageWidth;
-
- // Visuals width is set to fit minimum page width with margins on both sides
- width = LayoutShowcaseConsts.minPageWidth - 2 * LayoutShowcaseConsts.margin;
- }
- }
-
- // Set visuals height according to width - 9:16 ratio
- const height = width * (9 / 16);
-
- // Visuals starting point
- let x = LayoutShowcaseConsts.margin, y = LayoutShowcaseConsts.margin;
-
- // Filter the visuals list to display only the checked visuals
- let checkedVisuals = LayoutShowcaseState.layoutVisuals.filter(function (visual) { return visual.checked; });
-
- // Calculate the number of lines
- const lines = Math.ceil(checkedVisuals.length / LayoutShowcaseState.columns);
-
- // Calculate page height with margins
- pageHeight = Math.max(pageHeight, ((lines * height) + ((lines + 1) * LayoutShowcaseConsts.margin)));
-
- // Building visualsLayout object
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Custom-Layout
- let visualsLayout = {};
- for (let i = 0; i < checkedVisuals.length; i++) {
- visualsLayout[checkedVisuals[i].name] = {
- x: x,
- y: y,
- width: width,
- height: height,
- displayState: {
-
- // Change the selected visuals display mode to visible
- mode: models.VisualContainerDisplayMode.Visible
- }
- }
-
- // Calculating (x,y) position for the next visual
- x += width + LayoutShowcaseConsts.margin;
- if (x + width > pageWidth) {
- x = LayoutShowcaseConsts.margin;
- y += height + LayoutShowcaseConsts.margin;
- }
- }
-
- // Building pagesLayout object
- let pagesLayout = {};
- pagesLayout[LayoutShowcaseState.layoutPageName] = {
- defaultLayout: {
- displayState: {
-
- // Default display mode for visuals is hidden
- mode: models.VisualContainerDisplayMode.Hidden
- }
- },
- visualsLayout: visualsLayout
- };
-
- // Building settings object
- let settings = {
- layoutType: models.LayoutType.Custom,
- customLayout: {
- pageSize: {
- type: models.PageSizeType.Custom,
- width: pageWidth - 10,
- height: pageHeight - 20
- },
- displayOption: models.DisplayOption.FitToPage,
- pagesLayout: pagesLayout
- }
- };
-
- // If pageWidth or pageHeight is changed, change display option to actual size to add scroll bar
- if (pageWidth !== $('#embedContainer').width() || pageHeight !== $('#embedContainer').height()) {
- settings.customLayout.displayOption = models.DisplayOption.ActualSize;
- }
-
- // Change page background to transparent on Two / Three columns configuration
- settings.background = (LayoutShowcaseState.columns === ColumnsNumber.One) ? models.BackgroundType.Default : models.BackgroundType.Transparent;
-
- // Call updateSettings with the new settings object
- LayoutShowcaseState.layoutReport.updateSettings(settings);
-}
-
-// Update the visuals list with the change and rerender all visuals
-function onCheckboxClicked(checkbox) {
- let visual = jQuery.grep(LayoutShowcaseState.layoutVisuals, function (visual) { return visual.name === checkbox.value })[0];
- visual.checked = $(checkbox).is(':checked');
- renderVisuals();
-};
-
-// Update columns number and rerender the visuals
-function onColumnsClicked(num) {
- LayoutShowcaseState.columns = num;
- setColumnButtonActive(num);
- renderVisuals();
-}
-
-// Build visual checkbox HTML element
-function buildVisualElement(visual) {
- var labelElement = document.createElement("label");
- labelElement.setAttribute("class", "checkboxContainer checked");
-
- var inputElement = document.createElement("input");
- inputElement.setAttribute("type", "checkbox");
- inputElement.setAttribute("id", 'visual_' + visual.name);
- inputElement.setAttribute("value", visual.name);
- inputElement.setAttribute("onclick", "onCheckboxClicked(this);");
- inputElement.setAttribute("checked", "true");
- labelElement.appendChild(inputElement);
-
- var spanElement = document.createElement("span");
- spanElement.setAttribute("class", "checkboxCheckmark");
- labelElement.appendChild(spanElement);
-
- var secondSpanElement = document.createElement("span");
- secondSpanElement.setAttribute("class", "checkboxTitle");
- var checkboxTitleElement = document.createTextNode(visual.title);
- secondSpanElement.appendChild(checkboxTitleElement);
- labelElement.appendChild(secondSpanElement);
-
- return labelElement;
-}
-
-// Set clicked columns button active
-function setColumnButtonActive(num) {
- const active_btn_class = "active-columns-btn";
- $('#btnOneCol').removeClass(active_btn_class);
- $('#btnTwoCols').removeClass(active_btn_class);
- $('#btnThreeCols').removeClass(active_btn_class);
-
- if (num === ColumnsNumber.Three) {
- $('#btnThreeCols').addClass(active_btn_class);
- } else if (num === ColumnsNumber.Two) {
- $('#btnTwoCols').addClass(active_btn_class);
- } else {
- $('#btnOneCol').addClass(active_btn_class);
- }
-}
diff --git a/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.html b/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.html
deleted file mode 100644
index 9aa9384d..00000000
--- a/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.html
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
Insight to action
-
-
- This showcase demonstrates one example of how to leverage the
‘menu extensions’ and
‘export data’ APIs to give users the ability to take meaningful actions within seconds from analytics. The sample contains a basic customer relationship management module. The main table shows a list of customers who have not engaged with your service lately, and might not return. You can send these customers an offer to try and retain them.
-
1. Choose a list of customers
-
- The sales report shows a list of possible churning customers. Use the slicers to define the list of customers you want to engage with.
-
-
2. Take actions to get them engaged
-
- Follow the instructions on the tooltips to take actions straight from within the report.
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.js b/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.js
deleted file mode 100644
index 9b43fc5b..00000000
--- a/demo/v2-demo/live_showcases/insight_to_action/showcase_insight_to_action.js
+++ /dev/null
@@ -1,342 +0,0 @@
-let InsightToActionShowcaseState = {
- report: null,
- data: null,
- allChecked: false,
- tooltipNextPressed: false,
-}
-
-const dialogTooltipTimeout = 1500;
-const sentMessageTimeout = 3000;
-
-// Embed the report and retrieve the existing report bookmarks
-function embedInsightsToActionReport() {
- InsightToActionShowcaseState.tooltipNextPressed = false;
-
- // Load sample report properties into session
- return LoadInsightToActionShowcaseReportIntoSession().then(function () {
-
- // Get models. models contains enums that can be used
- const models = window['powerbi-client'].models;
-
- // Get embed application token from session
- let accessToken = GetSession(SessionKeys.AccessToken);
-
- // Get embed URL from session
- let embedUrl = GetSession(SessionKeys.EmbedUrl);
-
- // Get report Id from session
- let embedReportId = GetSession(SessionKeys.EmbedId);
-
- // Use View permissions
- let permissions = models.Permissions.View;
-
- // Icon for the custom extension
- const base64Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMQAAAC2CAMAAAHGleIFAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIHUExURQAAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoKCgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRcXFxkZGRwcHB0dHSEhISQkJCUlJSYmJikpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZGRkhISE1NTVFRUWlpaWxsbG1tbW5ubm9vb3BwcHFxcXJycnNzc3V1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4GBgYKCgoODg4SEhIWFhYaGhoiIiImJiYqKiouLi4yMjI6OjpCQkJKSkpSUlJaWlpeXl5iYmJqampubm5ycnJ2dnZ6enp+fn6CgoKGhoaOjo6SkpKWlpaampqenp6mpqaqqqqurq6ysrK2tra6urq+vr7CwsLOzs7S0tLW1tba2tre3t7i4uLm5ubq6uru7u7y8vL29vb6+vsDAwMTExMbGxsnJycrKyszMzM7Ozs/Pz9DQ0NHR0dLS0tPT09TU1NXV1dbW1tfX19jY2NnZ2dvb29zc3N3d3d7e3t/f3+Dg4OHh4eLi4uPj4+Tk5OXl5ebm5ufn5+jo6Onp6erq6uvr6+zs7O3t7e7u7s8u/7wAAAABdFJOUwBA5thmAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAJwklEQVR4Xu2diX8dRR3A329mdvZ4SZO2HCIIaigVTZtCUyAqHsWjglWkiOKFLWpbsVZFsdRbvKtoUSlpmkBBsVX/SH+/2d97b3ffHrNX0vqZbz7Jm2N3jt8xO7s78zLYSi4BB9JsiNDjYJINoeCLg6lTKPlL+LmQzhklI8nCNgDgyxweTAq7IjCdfhmZKOy4FrDBYSTgz5hk5lTTxpkwNPEUnJkubgRlThU34ri+kUOODII/04AHmoMJwFMwgA9ybIRJpU8TGzFKRRIlpexEjEoydqRiOzJwOhL4IhFLWlUq73C2G+M8Zf6miPP8VFkjKC9fJJTHAcfW8jLZyAGOVGCONbaVP24kGR37uIkVDydE+liDkPdzKEPOsYa7c9pkjgXwHuN4muk2PSXjE7B8mcNOmeMAxIn4vOgVjk/wYAeH8sg9T8A/OVRI5rxD5dKdMDlvWNquLOY8i3ZlOZEz7jkc/5fsg99wyIoHALSl2xJLGl1w3tbRqXTQGmce3m85pRRTOqi5weDbNo3i0uMjcWQwn8VMSo8BVdqoVOmG74HkUA7Z0g2YwqEs06XHFEiKSkc5znM0wdm8KkzpRZX7KiupxfGsPzH7TyDhZ3zkmBnOAuHxZSkFwKN8YBJzPPiLHE2hogLh+uas4G0cnbBeYiMFNQF8nkN55NUUFGqQmappveoMJFMTwCMcKiNZkx+UmGKScU2XLZo1Iq4JKZNWFlNTjUoM9c9A/Ic54HA4HI5+WL1nD4d64Oo+cwNdf/i3YXU3lkxXJA0B/IITu4JajmzDa6TAuS12w/LBhQ3jloMI6fOzdJH0ko9iW5BouU/Cf4LT3xmAr3/MkabktHzCaUxW7+dIA4pangCnqQ2tqbTlCZYEVv1rjthi0fIJP8Q+1LEm25YnsLcmbjkRoRvZFG7YC6ramlItn4AuJSSoCvAGIyy3pqNDgGGyYELo6qJHaIVtsXjU9BSXzdBwYMsQsIE3cTmVfJXu6EyPhK8k7Pozp5fzUdRb7r1YMdgjhXaKdZBDRe9Y5fRC5kF7cJEjNajRo1UpPL2dI7Wx69Eh9E75aY40o7JHkpzvHxxpQUmPLlH1N3OkNfk9+hQl1LOqKjI9uuPvQUOrqmLSI6SNVVUxGhlaW1UVpkf9zKPSnPwvBxwOh8PhcDgcju45pV/iUD98He/x+5w2nwBFd9+lD3za8DV6/qho7v8mp3TLqZvjxxl0Q9aHnJ4WWDzVQF2IppZStQbljwUrH8sXWEEI8irndEMsf5RPQAtVYds8SBFyXhdM5E8rBWDhj4ODFP0cZ7dmLH/UAHbglt9RIvYngDWT35aE/JHgzhfj5Mt0S7wzDrciI//bJg9BPkQVtranafkniDxPwOscaUZW/n/gdGYtRMeb4UgTCuSf4BOWz4zzKZZ/Ap8eub7GkXqUyn/C3zQe1WQxeIX8E3xcNhmfquWfQEHt8clK/hMugqw3PlnKP8FBuqJaj09G/gQ2Hzvw1nOcXooQQ9vxieVvqghhuPAnTq/gwgz22GZ8msjfVHH7Xzm9miPUoEp7ysgfUTBHkkKXQqcqx7xcKR+fjoXgCbKcJLG47PBAlz5ofm3JA1ooxmpmFEa5kZVgv+V9XFoRa/SaKt0ND4TilWiV0DuoqqWDyCv3wM648Bha1WgNGbrVW+h/r9AmC+y10UsEj9o+cT1DFrLCkSou3xvbE7ZKDFEZlo+nQeioxn6JSw9iFbFe8O82q/FzES958gWOWEF6UVi+EgIvyDNwhNML+Q45RsGq/kJq6gU74TWYMdfRC70+hV9ypBbWenkOW6KWOVIXS70IurngcANs9LJPKpBTC1jrUKmX52cxZz9HmlKhFxgOIW9HYE3K9LJEg/8ZjrSiUC/fJ33bjlNVFOjF07XGqSry9LKIkXrjVBVZvXzlJC25qDtOVZHWC3WiyThVRUIvMY3GqSoSemkxTlUxuu63G6eqGOvlp5zQC7Fe3suxviC9cLBHztnPth0Oh8PhcDgcDofD4XA4HA6HI8v50+cGg+t3y8ubx/dIAfKTHL3euPL0Xnq6T13QB3K/2O+aZv2bKwBRJCS9BfFCraNOXxf1zdrR+4e0hEQoIbWglxOgfT1r8w7/WsDYPq0loF+gN2oACg1JA9z4QLtVe5sB2r4fhvSyBuVObZeojKEfoC3RizsBN/T6nqgtY9ufC4SI1y7Rq0BP++TQEQZDCWHHG0i7I2P7WtO7Pxmi3D20Jf32Iy8+MwewgzaIyx6/IKMp+bZvFlqoEOSuJ+NV9a++GwT2EQLP7svZNos82w8CkL6k96Nq4ZHkMsSHzHo16tq1YkyFti887YFaPDy1xvOMWUqmUBMrW3+Zq7D9257IX3q5sYA9JYOD7V1/20otLG0/n0PUcVSGql5E1hO1bD+Xs7PG3pSU913ipM2jvu3ncmGPkD6dKOZ/zkmbQkPbzweNCRWIMhCd7deooJXt5/IjtEIaX2Hb3v6Nqb3t57K+hLcQWFzfc6aObD+fj6FV9jtn6tT2c/mB70PQ15ype9vP5eVlUkT3c6aU7ccoWpceRRCgMnYdtty6YMVHAGbib1npyphybD9GmHWZdz38Lz6wM54BPZS0/aKLOVOh7ceoMPQ8s42J1mdinWTDw2Gim00JJA0RbedM5bbPCBVnUSZIhU5tAmRk7UBZUOnN50xXj+1DScSCwJZhV8Y+kI9CZXWPDD3w9zfbqGZYPbq83UhVRMZ1KViEF1b0sRmh2Yh0S+vr3PlTu94iwYtiI8lFRdgDM+HvHoGagAe5LS25fHKZS50GPeLOx/tYRnoooClLiD91vkC5ije+saxix1ZRhP4S+woZEqpBwl1P/oUP7IaX7hZkADhg3PoTTuqM14/txZldMDv2lZDcReMfGp+GN3zh93xga56jB2Ye4JCx0s8m+fPPJnxFR9ps+WdwVLv1yPR/46jPh8maNPlbn3em5Cs0VZbaXEMYs0mT9uzd/tgFPrAZF9+DMzG6NMmben9G0J+vnDaapn2fH2hxsahBL76CBkVzAa2sduV1Rce+sv4uo2Ccus3+ipM2je585bsojSGEqI73XeGkzaUTX3mIJjwaC5Fb+Yqopa+s7SZzwp6LnZ1f8urS3FfOenixoH6rA29w0tbSyFcO0vMTunTLz3DKtUBNX3l1t3kKhL3ufg7VFntf+RbM0D7B/uZQban2lf/QYw9N0/Ke51BtKfMV7J6GOYpvyhyqLfm+Qs2P2cQ5VFumfIXZgjlUW1K+YtiyOVRb0vf2WzqHakvGV/L/U+T1wdhX1POcct1y/tl7d+zv5rvQHA6Hw+FwOBwOh8PhcDgcDisGg/8BZ7ROEYqjzQsAAAAASUVORK5CYII="
-
- // Table visual name
- const tableVisualName = "1149606f2a101953b4ba";
-
- // Embed configuration used to describe the what and how to embed
- // This object is used when calling powerbi.embed
- // This also includes settings and options such as filters
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details
- let config= {
- type: 'report',
- tokenType: models.TokenType.Embed,
- accessToken: accessToken,
- embedUrl: embedUrl,
- id: embedReportId,
- permissions: permissions,
- settings: {
- filterPaneEnabled: false,
- navContentPaneEnabled: false,
-
- // Adding the extension command to the options menu
- extensions: [
- {
- command: {
- name: "campaign",
- title: "Start campaign",
- icon: base64Icon,
- selector: {
- $schema: "http://powerbi.com/product/schema#visualSelector",
- visualName: tableVisualName
- },
- extend: {
- visualOptionsMenu: {
- title: "Start campaign",
- menuLocation: models.MenuLocation.Top,
- }
- }
- }
- },
- ],
-
- // Hiding built-in commands on the options menu
- commands: [
- {
- spotlight: {
- selector: {
- visualName: tableVisualName
- },
- displayOption: models.CommandDisplayOption.Hidden,
- },
- exportData: {
- selector: {
- visualName: tableVisualName
- },
- displayOption: models.CommandDisplayOption.Hidden,
- },
- seeData: {
- selector: {
- visualName: tableVisualName
- },
- displayOption: models.CommandDisplayOption.Hidden,
- },
- }
- ]
- },
- };
-
- // Get a reference to the embedded report HTML element
- let embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container
- InsightToActionShowcaseState.report = powerbi.embed(embedContainer, config);
- InsightToActionShowcaseState.report.on("rendered", function() {
- setTooltipPosition();
- $('#startTooltip').addClass("showTooltip");
-
- // Remove event handler, thus, the tooltip will appear only once
- InsightToActionShowcaseState.report.off("rendered");
- });
-
- // Report.on will add an event handler to commandTriggered event which prints to console window.
- InsightToActionShowcaseState.report.on("commandTriggered", function(event) {
- if (event.detail.command === "campaign") {
- InsightToActionShowcaseState.report.getPages()
- .then(function (pages) {
-
- // Retrieve active page.
- let activePage = pages.filter(function(page) {
- return page.isActive
- })[0];
-
- // Get page's visuals
- activePage.getVisuals()
- .then(function (visuals) {
-
- // Retrieve the wanted visual.
- let visual = visuals.filter(function(visual) {
- return visual.name === tableVisualName;
- })[0];
-
- // Exports visual data
- visual.exportData(models.ExportDataType.Underlying).then(handleExportData);
- });
- });
- }
- });
- });
-}
-
-// Handles the export data API result
-function handleExportData(result) {
-
- // Parse the recieved data from csv to 2d array
- let resultData = parseData(result.data);
-
- // Filter the unwanted columns
- InsightToActionShowcaseState.data = filterTable(["Latest purchase - Category", "Total spend", "Days since last purchase"], resultData);
-
- // Create a table from the 2d array
- let table = createTable(InsightToActionShowcaseState.data)
-
- // Clear the div
- $("#dialogTable").empty();
-
- // Add the table to the dialog
- $("#dialogTable").append(table)
-
- // Hide the tooltip
- $('#startTooltip').removeClass("showTooltip");
-
- // Show the dialog
- $('#dialogMask').show();
- $('#distributionDialog').show();
-
- // Shows dialog tooltip after a short delay
- setTimeout(function() {
- $('#dialogTooltip').addClass("showTooltip");
- }, dialogTooltipTimeout);
-}
-
-// Parse the data from the API
-function parseData(data) {
- let result = [];
- data.split("\n").forEach(function(row) {
- if (row !== "") {
- let rowArray = [];
- row.split(",").forEach(function(cell) {
- rowArray.push(cell);
- });
-
- result.push(rowArray);
- }
- });
-
- return result;
-}
-
-// Filter the table's data - removing the 'filterValues' columns
-function filterTable(filterValues, table) {
- for (let i = 0; i < filterValues.length; i++) {
- valueIndex = table[0].indexOf(
- table[0].filter(function(value) { return value === filterValues[i] })[0]
- );
-
- for (let j = 0; j < table.length; j++) {
- table[j].splice(valueIndex, 1);
- }
- }
-
- return table;
-}
-
-// Handles tooltip click action
-function onTootipClicked(tooltipId) {
- if ( tooltipId === "closeTooltip"){
- $('#startTooltip').hide();
- } else if (!InsightToActionShowcaseState.tooltipNextPressed && tooltipId === "startTooltip") {
- let newText = document.createTextNode("Then, click `Start campaign` menu command.");
- let startTooltipSubText = $('#startTooltip .showcaseTooltipSubText');
- const textOldHeight = startTooltipSubText[0].offsetHeight;
- startTooltipSubText.empty();
- startTooltipSubText.append(newText);
- startTooltipSubText[0].setAttribute("style", "height: " + textOldHeight + "px;");
-
- let newTooltipNumber = document.createTextNode("2 of 2");
- $('#startTooltip .tooltipNumber').empty();
- $('#startTooltip .tooltipNumber').append(newTooltipNumber);
-
- let newBtnText = document.createTextNode("Got it");
- $('#startTooltip .btnShowcaseTooltip').empty();
- $('#startTooltip .btnShowcaseTooltip').append(newBtnText);
-
- InsightToActionShowcaseState.tooltipNextPressed = true;
- } else {
- $('#' + tooltipId).hide();
- }
-}
-
-// Closes the dialog
-function onCloseDialog(id) {
- $('#dialogTooltip').hide();
- $('#dialogMask').hide();
- $('#' + id).hide();
-}
-
-// Open the send coupon/discount dialog
-function onSendClicked(name) {
- let headerText = document.createTextNode("Send " + name + " to distribution list");
- $('#sendDialog .dialogHeaderText').empty();
- $('#sendDialog .dialogHeaderText').append(headerText);
-
- const promotionToSend = name === "coupon" ? "30$ coupon" : "10% discount";
- let bodyText = "Hi , get your " + promotionToSend + " today!";
- $('#sendDialog textarea').val(bodyText);
-
- $('#dialogTooltip').hide();
- $('#distributionDialog').hide();
- $('#sendDialog').show();
-}
-
-// Closes the send dialog and shows the 'Sent' message
-function onSendDialogSendClicked() {
- $('#sendDialog').hide();
- $('#dialogMask').hide();
- $('#messageSent').addClass("show");
-
- setTimeout(function() {
- $('#messageSent').removeClass("show");
- }, sentMessageTimeout);
-}
-
-// Build the HTML table from the data
-function createTable(tableData) {
- let table = document.createElement('table');
- let tableBody = document.createElement('tbody');
- let rowIndex = 0;
-
- // Set all checked to true, for check all table button
- InsightToActionShowcaseState.allChecked = true;
-
- tableData.forEach(function(rowData) {
- let row = document.createElement('tr');
-
- // Add ✓ or checkbox
- if (rowIndex === 0) {
- let cell = document.createElement('th');
- cell.setAttribute("onclick","onCheckAllClicked();");
- cell.setAttribute("class", "checkAllBtn");
- cell.appendChild(document.createTextNode('✓'));
- row.appendChild(cell);
- } else {
- let cell = document.createElement('td');
- let checkboxElement = document.createElement("input");
- checkboxElement.setAttribute("type", "checkbox");
- checkboxElement.setAttribute("name", "tableRowCheckbox");
- checkboxElement.setAttribute("id", "row" + rowIndex);
- checkboxElement.checked = true;
- cell.appendChild(checkboxElement);
- row.appendChild(cell);
- }
-
- let isNameCell = true;
- rowData.forEach(function(cellData) {
- let cell;
- if (rowIndex !== 0) {
- cell = document.createElement('td');
- if (isNameCell) {
- cell.setAttribute("class", "nameCell");
- isNameCell = false;
- }
- } else {
- cell = document.createElement('th');
- }
-
- cell.appendChild(document.createTextNode(cellData));
- row.appendChild(cell);
- });
-
- tableBody.appendChild(row);
- rowIndex++;
- });
-
- table.appendChild(tableBody);
-
- return table;
-}
-
-// Check/Uncheck all the customers on the table
-function onCheckAllClicked() {
- let checkboxes = document.getElementsByName("tableRowCheckbox");
- for (let i = 0; i < checkboxes.length; i++) {
- checkboxes[i].checked = !InsightToActionShowcaseState.allChecked;
- }
-
- InsightToActionShowcaseState.allChecked = !InsightToActionShowcaseState.allChecked;
-}
-
-// Calculate and set the tooltip position
-function setTooltipPosition() {
- let startTooltip = document.getElementById("startTooltip");
- let embedContainer = document.getElementById('embedContainer');
- let textHeight = document.getElementById('showcases-text').offsetHeight;
- let containerHeight = embedContainer.offsetWidth * 0.56;
-
- // Calculate the tooltip position relatively
- const top = textHeight + 64 + ((embedContainer.offsetHeight - containerHeight) / 2) - startTooltip.offsetHeight + (0.05 * embedContainer.offsetHeight);
- const left = (embedContainer.offsetWidth - 10) * 0.971 - 125;
- startTooltip.setAttribute("style", "top: " + top + "px; left: " + left + "px;");
-}
\ No newline at end of file
diff --git a/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.html b/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.html
deleted file mode 100644
index b77b94f4..00000000
--- a/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.html
+++ /dev/null
@@ -1,192 +0,0 @@
-
-
Quick visual creator
-
-
- This showcase demonstrates one example of how you can leverage our visual APIs to quickly generate and personalize a visual.
- This is useful for quickly importing a visual into a presentation or email without having any prior Power BI experience,
- and for quick ad-hock analytics which can then be saved. Additionally, you can implement your own method for sharing or exporting the visual.
-
-
1. Choose the visual type from the dropdown list
-
Note: On this showcase we only provide a subset of the available visual types.
-
2. Select the fields to define the data for displaying in your visual
-
3. Use the 'Properties' to personalize your visual
-
4. You can use the 'Print' button to export the visual to PDF
-
-
-
-
-
-
-
-
Generator
-
-
-
-
Visual Type
-
-
-
- Select an option
- Option 1
- Option 2
- Option 3
- Option 4
-
-
-
-
-
-
Fields
-
-
-
Axis:
-
-
- Select an option
- Option 1
- Option 2
- Option 3
-
-
-
-
-
Legend:
-
-
- Select an option
- Option 1
- Option 2
- Option 3
-
-
-
-
-
Value:
-
-
- Select an option
- Option 1
- Option 2
- Option 3
-
-
-
-
-
-
-
-
-
Properties
-
-
- Legend:
-
-
-
-
-
-
- X Axis:
-
-
-
-
-
-
- Y Axis:
-
-
-
-
-
-
- Title:
-
-
-
-
-
-
-
-
Personalized Title:
-
-
-
-
-
-
-
-
-
-
-
Visual view
-
-
- Reset
-
-
- Print
-
-
-
-
-
-
- Loading showcase...
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.js b/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.js
deleted file mode 100644
index 4348b719..00000000
--- a/demo/v2-demo/live_showcases/quick_visual_creator/showcase_quick_visual_creator.js
+++ /dev/null
@@ -1,638 +0,0 @@
-let VisualCreatorShowcaseState = {
- report: null,
- page: null,
- visual: null,
- visualType: null,
- dataRoles: {
- Legend: null,
- Values: null,
- Value: null,
- Axis: null,
- Tooltips: null,
- 'Y Axis': null,
- Category: null,
- Breakdown: null,
- },
- dataFieldsCount: 0,
- properties: {
- legend: true,
- xAxis: true,
- yAxis: true,
- title: true,
- titleText: null,
- titleAlign: null
- },
-}
-
-// Define the available data roles for the visual types
-const visualTypeToDataRoles = [
- { name: 'pieChart', displayName: 'Pie chart', dataRoles: ['Legend', 'Values', 'Tooltips'] },
- { name: 'columnChart', displayName: 'Column chart', dataRoles: ['Axis', 'Values', 'Tooltips'] },
- { name: 'areaChart', displayName: 'Area chart', dataRoles: ['Axis', 'Legend', 'Values'] },
- { name: 'waterfallChart', displayName: 'Waterfall Chart', dataRoles: ['Category', 'Breakdown', 'Values'] },
-];
-
-// Define the available fields for each data role
-const dataRolesToFields = [
- { dataRole: 'Legend', Fields: ['State', 'Region', 'Manufacturer'] },
- { dataRole: 'Values', Fields: ['Total Units', 'Total Category Volume', 'Total Compete Volume'] },
- { dataRole: 'Axis', Fields: ['State', 'Region', 'Manufacturer'] },
- { dataRole: 'Value', Fields: ['Total Units', 'Total Category Volume', 'Total Compete Volume'] },
- { dataRole: 'Y Axis', Fields: ['Total Units', 'Total Category Volume', 'Total Compete Volume'] },
- { dataRole: 'Tooltips', Fields: ['Total Units', 'Total Category Volume', 'Total Compete Volume'] },
- { dataRole: 'Category', Fields: ['State', 'Region', 'Date'] },
- { dataRole: 'Breakdown', Fields: ['State', 'Region', 'Manufacturer'] },
-];
-
-// Define schemas for visuals API
-const schemas = {
- column: 'http://powerbi.com/product/schema#column',
- measure: 'http://powerbi.com/product/schema#measure',
- property: 'http://powerbi.com/product/schema#property',
-};
-
-// Define mapping from fields to target table and column/measure
-const dataFieldsTargets = {
- State: { column: 'State', table: 'Geo', schema: schemas.column },
- Region: { column: 'Region', table: 'Geo', schema: schemas.column },
- District: { column: 'District', table: 'Geo', schema: schemas.column },
- Manufacturer: { column: 'Manufacturer', table: 'Manufacturer', schema: schemas.column },
- TotalUnits: { measure: 'Total Units', table: 'SalesFact', schema: schemas.measure },
- TotalCategoryVolume: { measure: 'Total Category Volume', table: 'SalesFact', schema: schemas.measure },
- TotalCompeteVolume: { measure: 'Total Compete Volume', table: 'SalesFact', schema: schemas.measure },
- Date: { measure: 'Date', table: 'Date', schema: schemas.measure },
-};
-
-// Define the available
-const showcaseProperties = ['legend', 'xAxis', 'yAxis'];
-const visualTypeProperties = {
- pieChart: ['legend'],
- columnChart: ['xAxis', 'yAxis'],
- areaChart: ['legend', 'xAxis', 'yAxis'],
- waterfallChart: ['legend', 'xAxis', 'yAxis'],
-};
-
-const disabledClass = "generator-disabled";
-
-// Embed the report
-function embedQuickVisualCreatorReport() {
-
- // Load sample report properties into session
- return LoadQuickVisualCreatorShowcaseReportIntoSession().then(function () {
-
- // Starting spinner animation
- $("#spinner").show();
-
- // Get models. models contains enums that can be used
- let models = window['powerbi-client'].models;
-
- // Get embed application token from session
- let accessToken = GetSession(SessionKeys.AccessToken);
-
- // Get embed URL from session
- let embedUrl = GetSession(SessionKeys.EmbedUrl);
-
- // Get report Id from session
- let embedReportId = GetSession(SessionKeys.EmbedId);
-
- // Use View permissions
- let permissions = models.Permissions.View;
-
- // Embed configuration used to describe the what and how to embed
- // This object is used when calling powerbi.embed
- // This also includes settings and options such as filters
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details
- let config = {
- type: 'report',
- tokenType: models.TokenType.Embed,
- accessToken: accessToken,
- embedUrl: embedUrl,
- id: embedReportId,
- permissions: permissions,
- settings: {
- filterPaneEnabled: false,
- navContentPaneEnabled: false,
- layoutType: models.LayoutType.Custom,
- customLayout: {
- pageSize: {
- type: models.PageSizeType.Custom,
- width: $('#embedContainer').width(),
- height: $('#embedContainer').height()
- },
- displayOption: models.DisplayOption.ActualSize,
- }
- }
- };
-
- // Get a reference to the embedded report HTML element
- let embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container
- VisualCreatorShowcaseState.report = powerbi.embed(embedContainer, config);
-
- // Report.on will add an event handler for report rendered event
- VisualCreatorShowcaseState.report.on("rendered", function () {
-
- // Setting the first page as active
- VisualCreatorShowcaseState.report.getPages().then(function (pages) {
- pages[0].setActive();
- VisualCreatorShowcaseState.page = pages[0];
- });
-
- // Update html available visual types
- updateAvailableVisualTypes();
-
- // Enable choosing visual type
- $("#generator-type").removeClass(disabledClass);
-
- // Hiding the spinner animation
- $("#spinner").hide();
-
- // Covering the embeded view with instruction text
- $("#overlay-embed-container").addClass("overlay-text")
- $('#overlay-embed-container').text('Start by choosing the visual type');
- $("#overlay-embed-container").show();
-
- // Remove the event listener, thus, it will only be called once
- VisualCreatorShowcaseState.report.off("rendered");
- });
- });
-}
-
-// Initialize the custom dropdowns
-function initializeDropdowns() {
- let x, i, j, selElmnt, a, b, c;
-
- // Look for any elements with the class "styled-select"
- x = document.getElementsByClassName("styled-select");
- for (i = 0; i < x.length; i++) {
- selElmnt = x[i].getElementsByTagName("select")[0];
-
- // For each element, create a new DIV that will act as the selected item
- a = document.createElement("DIV");
- a.setAttribute("class", "select-selected");
- a.setAttribute("id", "selected-value-" + i);
- a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
- x[i].appendChild(a);
-
- // For each element, create a new DIV that will contain the option list
- b = document.createElement("DIV");
- b.setAttribute("class", "select-items select-hide");
- for (j = 1; j < selElmnt.length; j++) {
-
- // For each option in the original select element,
- // create a new DIV that will act as an option item
- c = document.createElement("DIV");
- c.innerHTML = selElmnt.options[j].innerHTML;
-
- // Adding new click event listener
- c.addEventListener("click", function (e) {
-
- // When an item is clicked, update the original select box, and the selected item
- let y, i, k, s, h;
- s = this.parentNode.parentNode.getElementsByTagName("select")[0];
- h = this.parentNode.previousSibling;
- for (i = 0; i < s.length; i++) {
- if (s.options[i].innerHTML == this.innerHTML) {
- s.selectedIndex = i;
- h.innerHTML = this.innerHTML;
- y = this.parentNode.getElementsByClassName("same-as-selected");
- for (k = 0; k < y.length; k++) {
- y[k].removeAttribute("class");
- }
-
- this.setAttribute("class", "same-as-selected");
- break;
- }
- }
-
- h.click();
-
- // Changing the visual type or updating the data role field, according to the dropdown id
- if (s.id == 'visual-type') {
- changeVisualType(h.innerHTML);
- } else {
- updateDataRoleField(s.parentNode.parentNode.children[0].id, h.innerHTML);
- }
- });
-
- b.appendChild(c);
- }
-
- x[i].appendChild(b);
-
- // Adding new click event listener for the select box
- a.addEventListener("click", function (e) {
- // When the select box is clicked, close any other select boxes,
- // and open/close the current select box
- e.stopPropagation();
- closeAllSelect(this);
- this.nextSibling.classList.toggle("select-hide");
- this.classList.toggle("select-arrow-active");
- });
- }
-}
-
-// Close all select boxes in the document, except the current select box
-function closeAllSelect(elmnt) {
-
- let x, y, i, arrNo = [];
- x = document.getElementsByClassName("select-items");
- y = document.getElementsByClassName("select-selected");
- for (i = 0; i < y.length; i++) {
- if (elmnt == y[i]) {
- arrNo.push(i)
- } else {
- y[i].classList.remove("select-arrow-active");
- }
- }
-
- for (i = 0; i < x.length; i++) {
- if (arrNo.indexOf(i)) {
- x[i].classList.add("select-hide");
- }
- }
-}
-
-// Changing the visual type
-function changeVisualType(visualTypeDisplayName) {
- // Get the visual type from the display name
- let visualTypeData = visualTypeToDataRoles.filter((function (e) { return e.displayName === visualTypeDisplayName }))[0];
- let visualTypeName = visualTypeData.name;
-
- // Retrieve the visual's capabilities
- VisualCreatorShowcaseState.report.getVisualCapabilities(visualTypeName).then(function (capabilities) {
-
- // Validating data roles existence on the given visual type
- if (!validateDataRoles(capabilities, visualTypeData.dataRoles)) {
- resetVisualGenerator();
- handleInvalidDataRoles();
- return;
- }
-
- // Enable the fields section
- $('#generator-fields').removeClass(disabledClass);
-
- // Disable the properties section, and reset all properties
- $('#generator-properties').addClass(disabledClass);
- resetGeneratorProperties();
-
- // Update the overlay text
- $('#overlay-embed-container').text('Use the dropdown menus to choose data fields');
- $('#overlay-embed-container').show();
-
- // Reset the data fields count
- VisualCreatorShowcaseState.dataFieldsCount = 0;
-
- // If the visual doesn't exist, create new visual, otherwise, delete the old visual and create new visual
- if (!VisualCreatorShowcaseState.visual) {
- VisualCreatorShowcaseState.page.createVisual(visualTypeName, getVisualLayout()).then(function () {
- updateShowCaseVisType(visualTypeName, visualTypeData.dataRoles);
- });
- }
- else if (visualTypeName != VisualCreatorShowcaseState.visualType) {
- VisualCreatorShowcaseState.page.deleteVisual(VisualCreatorShowcaseState.visual.name).then(function () {
- VisualCreatorShowcaseState.page.createVisual(visualTypeName, getVisualLayout()).then(function () {
- updateShowCaseVisType(visualTypeName, visualTypeData.dataRoles);
- });
- });
- }
- });
-}
-
-// Update showcase after visual type change
-function updateShowCaseVisType(visualTypeName, dataRoles) {
- updateCurrentVisualState(visualTypeName);
- resetGeneratorDataRoles();
- updateAvailableDataRoles(dataRoles);
- updateDropdownsVisibility();
-}
-
-// Update the visual state
-function updateCurrentVisualState(visualTypeName) {
- VisualCreatorShowcaseState.page.getVisuals().then(function (visuals) {
- // Update visual and visual type
- VisualCreatorShowcaseState.visual = visuals[0]
- VisualCreatorShowcaseState.visualType = visualTypeName;
-
- // Enabling the pie chart legend (disabled by default)
- if (visualTypeName === "pieChart") {
- VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('legend'), { schema: schemas.property, value: true });
- }
-
- // Formatting the title to be more accessible
- VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('titleSize'), { schema: schemas.property, value: 14 });
- VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('titleColor'), { schema: schemas.property, value: '#000000' });
-
- // Disabling unavailable properties for specific visual types
- $('.toggle-wrapper').removeClass("disabled");
- for (let i = 0; i < showcaseProperties.length; i++) {
- if (visualTypeProperties[visualTypeName].indexOf(showcaseProperties[i]) < 0) {
- $('#' + showcaseProperties[i] + '.toggle-wrapper').addClass("disabled");
- }
- }
- });
-}
-
-// Update the data roles and the data roles fields, on the dropdown menus
-function updateAvailableDataRoles(dataRoles) {
- let dataRolesNamesElements = document.querySelectorAll('.inline-select-text');
- for (let i = 0; i < dataRoles.length; i++) {
- dataRolesNamesElements[i].innerHTML = dataRoles[i] + ':';
- dataRolesNamesElements[i].id = dataRoles[i];
-
- let dataFields = dataRolesToFields.filter(function (e) { return e.dataRole === dataRoles[i] })[0].Fields;
- updateAvailableDataFields(dataRolesNamesElements[i].parentElement, dataFields);
- }
-}
-
-// Update the data fields on the dropdown menus
-function updateAvailableDataFields(dataRoleElement, dataFields) {
- let fieldDivElements = dataRoleElement.querySelector('.select-items').children;
- let fieldOptionElements = dataRoleElement.querySelectorAll('option');
- for (let i = 0; i < dataFields.length; i++) {
- fieldDivElements[i].innerHTML = dataFields[i];
- fieldOptionElements[i + 1].innerHTML = dataFields[i];
- }
-}
-
-// Update html visual types
-function updateAvailableVisualTypes() {
- let typesDivElements = $('.select-items')[0].children;
- let typesOptionElements = $('#visual-type')[0].children;
- for (let i = 0; i < visualTypeToDataRoles.length; i++) {
- typesDivElements[i].innerHTML = visualTypeToDataRoles[i].displayName;
- typesOptionElements[i + 1].innerHTML = visualTypeToDataRoles[i].displayName;
- }
-}
-
-// Print the report
-function printVisual() {
- if (!VisualCreatorShowcaseState.visual)
- return;
- VisualCreatorShowcaseState.report.print();
-}
-
-// Update data roles field on the visual
-function updateDataRoleField(dataRole, field) {
-
- // Check if the requested field is not the same as the selected field
- if (field != VisualCreatorShowcaseState.dataRoles[dataRole]) {
-
- // Getting the visual capabilites
- VisualCreatorShowcaseState.visual.getCapabilities().then(function (capabilities) {
-
- // Getting the data role name
- let dataRoleName = capabilities.dataRoles.filter(function (dr) { return dr.displayName === dataRole })[0].name;
-
- // Remove whitespaces from field
- let dataFieldKey = field.replace(/\s+/g, '');
-
- // Check if the data role already has a field
- if (VisualCreatorShowcaseState.dataRoles[dataRole]) {
-
- // If the data role has a field, remove it
- VisualCreatorShowcaseState.visual.removeDataField(dataRoleName, 0).then(function (res) {
- VisualCreatorShowcaseState.dataFieldsCount--;
-
- // If there are no more data fields, recreating the visual before adding the data field
- if (VisualCreatorShowcaseState.dataFieldsCount === 0) {
- VisualCreatorShowcaseState.page.createVisual(VisualCreatorShowcaseState.visualType, getVisualLayout()).then(function () {
- VisualCreatorShowcaseState.page.getVisuals().then(function (visuals) {
- VisualCreatorShowcaseState.visual = visuals[0];
- VisualCreatorShowcaseState.dataFieldsCount++;
- VisualCreatorShowcaseState.visual.addDataField(dataRoleName, dataFieldsTargets[dataFieldKey]).then(function () { disableSelectedDataFields(dataRole, field); });
- });
- });
- } else {
- VisualCreatorShowcaseState.dataFieldsCount++;
- VisualCreatorShowcaseState.visual.addDataField(dataRoleName, dataFieldsTargets[dataFieldKey]).then(function () { disableSelectedDataFields(dataRole, field); });
- }
- });
- } else {
-
- // Adding a new field
- VisualCreatorShowcaseState.visual.addDataField(dataRoleName, dataFieldsTargets[dataFieldKey]).then(function () {
- disableSelectedDataFields(dataRole, field);
- VisualCreatorShowcaseState.dataFieldsCount++;
-
- // Showing the visual if there are 2 or more data fields
- if (VisualCreatorShowcaseState.dataFieldsCount > 1) {
- $("#overlay-embed-container").hide();
- $('#generator-properties').removeClass(disabledClass);
- }
- });
- }
- });
- }
-}
-
-// Hiding the selected data field from the dropdown
-function disableSelectedDataFields(dataRole, field) {
- VisualCreatorShowcaseState.dataRoles[dataRole] = field;
- updateDropdownsVisibility();
-}
-
-// Update the visibility of the dropdowns
-function updateDropdownsVisibility() {
- $('.select-items div').show();
-
- let selected = $('.select-selected');
- selected.each(function () {
- let selectedValue = $(this).text();
- $('.select-items div:contains(' + selectedValue + ')').hide();
- });
-}
-
-// Return the visual layout
-function getVisualLayout() {
- // Get models. models contains enums that can be used
- let models = window['powerbi-client'].models;
-
- return {
- width: 0.9 * $('#embedContainer').width(),
- height: 0.85 * $('#embedContainer').height(),
- x: (0.1 * $('#embedContainer').width()) / 2,
- y: (0.1 * $('#embedContainer').height()) / 2,
- displayState: {
- // Change the selected visuals display mode to visible
- mode: models.VisualContainerDisplayMode.Visible
- }
- };
-}
-
-// Toggle a property value
-function toggleProperty(propertyName) {
- if (!VisualCreatorShowcaseState.visual)
- return;
-
- let newValue = $('#' + propertyName + '-toggle')[0].checked;
- VisualCreatorShowcaseState.properties[propertyName] = newValue;
-
- // Setting the property on the visual
- VisualCreatorShowcaseState.visual.setProperty(propertyToSelector(propertyName), { schema: schemas.property, value: newValue });
-}
-
-// Update the title alignment
-function onAlignClicked(direction) {
- if (!VisualCreatorShowcaseState.visual)
- return;
-
- $(".alignment-block").removeClass("selected");
- $("#align-" + direction).addClass("selected");
- VisualCreatorShowcaseState.properties['titleAlign'] = direction;
-
- // Setting the property on the visual
- VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('titleAlign'), { schema: schemas.property, value: direction });
-}
-
-// Convert property name to selector
-function propertyToSelector(propertyName) {
- switch (propertyName) {
- case 'title':
- return { objectName: "title", propertyName: "visible" };
- case 'xAxis':
- return { objectName: "categoryAxis", propertyName: "visible" };
- case 'yAxis':
- return { objectName: "valueAxis", propertyName: "visible" };
- case 'legend':
- return { objectName: "legend", propertyName: "visible" };
- case 'titleText':
- return { objectName: "title", propertyName: "titleText" };
- case 'titleAlign':
- return { objectName: "title", propertyName: "alignment" };
- case 'titleSize':
- return { objectName: "title", propertyName: "textSize" };
- case 'titleColor':
- return { objectName: "title", propertyName: "fontColor" };
- }
-}
-
-// Handles erase tool click
-function onEraseToolClicked() {
- if (!VisualCreatorShowcaseState.visual)
- return;
-
- document.getElementById("ptitle").value = "";
-
- // Reseting the title text to auto generated
- VisualCreatorShowcaseState.visual.resetProperty(propertyToSelector('titleText'));
-}
-
-// Update the title's text
-function updateTitleText() {
- if (!VisualCreatorShowcaseState.visual)
- return;
-
- let text = document.getElementById("ptitle").value;
-
- // If the title is blank, reseting the title to auto generated
- if (text === "") {
- onEraseToolClicked();
- return;
- }
-
- VisualCreatorShowcaseState.visual.setProperty(propertyToSelector('titleText'), { schema: schemas.property, value: text });
-}
-
-// Reset the data roles section
-function resetGeneratorDataRoles() {
- if (!VisualCreatorShowcaseState.visual)
- return;
-
- VisualCreatorShowcaseState.dataRoles = {
- Legend: null,
- Values: null,
- Value: null,
- Axis: null,
- Tooltips: null,
- 'Y Axis': null,
- Category: null,
- Breakdown: null,
- };
-
- VisualCreatorShowcaseState.dataFieldsCount = 0;
-
- let nodesToReset = $('.select-selected').slice(1); //all dropdowns except of visual type selection
- for (let i = 0; i < nodesToReset.length; i++) {
- nodesToReset[i].innerHTML = 'Select an option';
- }
-
- $('.field ~ .select-items').children().show();
- $('.field ~ .select-items').children().removeClass('same-as-selected');
-}
-
-// Reset the current visual
-function resetGeneratorVisual() {
- if (!VisualCreatorShowcaseState.visual)
- return;
-
- VisualCreatorShowcaseState.page.deleteVisual(VisualCreatorShowcaseState.visual.name);
- VisualCreatorShowcaseState.visual = null;
- VisualCreatorShowcaseState.visualType = null;
- $('.select-selected')[0].innerHTML = 'Select an option';
- $('#visual-type ~ .select-items > .same-as-selected').show();
- $('#visual-type ~ .select-items > .same-as-selected')[0].removeAttribute('class');
-}
-
-// Reset the properties section
-function resetGeneratorProperties() {
- if (!VisualCreatorShowcaseState.visual)
- return;
-
- VisualCreatorShowcaseState.properties = {
- legend: true,
- xAxis: true,
- yAxis: true,
- title: true,
- titleText: null,
- titleAlign: null
- };
-
- for (let i = 0; i < 4; i++) {
- $('input[type="checkbox"]')[i].checked = true;
- }
-
- $(".alignment-block").removeClass("selected");
- $("#align-left").addClass("selected");
-
- document.getElementById("ptitle").value = "";
-}
-
-// Reset the visual generator (data roles, properties and visual)
-function resetVisualGenerator() {
- if (!VisualCreatorShowcaseState.visual)
- return;
-
- $('#generator-fields').addClass(disabledClass);
- $('#generator-properties').addClass(disabledClass);
-
- $('#overlay-embed-container').text('Start by choosing the visual type');
- $("#overlay-embed-container").show();
-
- resetGeneratorDataRoles();
- resetGeneratorProperties();
- resetGeneratorVisual();
-}
-
-// Validate the existance of each dataRole on the visual's capabilities
-function validateDataRoles(capabilities, dataRolesDisplayNames) {
- for (let i = 0; i < dataRolesDisplayNames.length; i++) {
-
- // Filter the corrsponding dataRole in the visual's capabilities dataRoles
- if (capabilities.dataRoles.filter(function (dr) { return dr.displayName === dataRolesDisplayNames[i] }).length === 0) {
- return false;
- }
- }
-
- return true;
-}
-
-// Show an error message on dataRoles validation failure
-function handleInvalidDataRoles() {
-
- // Update the overlay text
- $('#overlay-embed-container').text("Failed to validate the visual's dataRoles. Please select a different visual type to continue.");
- $('#overlay-embed-container').show();
-}
-
diff --git a/demo/v2-demo/live_showcases/themes/showcase_themes.html b/demo/v2-demo/live_showcases/themes/showcase_themes.html
deleted file mode 100644
index 941bef94..00000000
--- a/demo/v2-demo/live_showcases/themes/showcase_themes.html
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
Personalize report design
-
-
- You can personalize the colors and styling of your embedded analytics using the themes API.
- Themes help define styling and colors so you can match them to your application or brand color palette, for example.
- With the themes API, you can apply a custom theme during the report load or during a session.
- In this showcase, we’ve provided a few example color palettes and styles so you can see how themes can be applied to user report views.
-
-
-
-
-
-
-
Data colors
-
-
Background
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/live_showcases/themes/showcase_themes.js b/demo/v2-demo/live_showcases/themes/showcase_themes.js
deleted file mode 100644
index f1c204ce..00000000
--- a/demo/v2-demo/live_showcases/themes/showcase_themes.js
+++ /dev/null
@@ -1,252 +0,0 @@
-
-
-let ThemesShowcaseState = {
- themesArray: null,
- themesReport: null,
- dataColorSize: 16,
- backgroundSize: 16,
-};
-
-// For report themes documentation please check https://docs.microsoft.com/en-us/power-bi/desktop-report-themes
-const jsonThemes = [
- {
- "name": "Apothecary",
- "dataColors": ["#93A299", "#CF543F", "#B5AE53", "#848058", "#E8B54D", "#786C71", "#93A2A0", "#CF9A3F", "#8CB553", "#728458", "#D0E84D", "#786D6C"],
- "background":"#FFFFFF",
- "foreground": "#CF543F",
- "tableAccent": "#93A299"
- },
- {
- "name": "Colorblind Safe",
- "dataColors": ["#074650", "#009292", "#fe6db6", "#feb5da", "#480091", "#b66dff", "#b5dafe", "#6db6ff", "#914800", "#23fd23"],
- "background":"#FFFFFF",
- "foreground": "#074650",
- "tableAccent": "#fe6db6"
- },
- {
- "name": "Valentine's Day",
- "dataColors": ["#990011", "#cc1144", "#ee7799", "#eebbcc", "#cc4477", "#cc5555", "#882222", "#A30E33"],
- "background":"#FFFFFF",
- "foreground": "#ee7799",
- "tableAccent": "#990011"
- },
- {
- "name": "Waveform",
- "dataColors": ["#31B6FD", "#4584D3", "#5BD078", "#A5D028", "#F5C040", "#05E0DB", "#3153FD", "#4C45D3", "#5BD0B0", "#54D028", "#D0F540", "#057BE0"],
- "background":"#FFFFFF",
- "foreground": "#4584D3",
- "tableAccent": "#31B6FD"
- },
-];
-
-const backgrounds = [
- {
- "background": "#FFFFFF",
- },
- {
- "background": "#323130",
- "foreground": "#FFFFFF",
- "tableAccent": "#FFFFFF",
- "visualStyles": {
- "*":{
- "*":{
- "*":[{
- "fontFamily":"Segoe UI",
- "color":{"solid":{"color":"#323130"}},
- "labelColor":{"solid":{"color":"#FFFFFF"}},
- "titleColor":{"solid":{"color":"#FFFFFF"}},
- }],
- "labels":[{
- "color":{"solid":{"color":"#FFFFFF"}}
- }],
- "categoryLabels":[{
- "color":{"solid":{"color":"#FFFFFF"}}
- }]
- }
- }
- }
- }
-]
-
-// Embed the report
-function embedThemesReport() {
-
- // Load sample report properties into session
- return LoadThemesShowcaseReportIntoSession().then(function () {
-
- // Get models. models contains enums that can be used
- const models = window['powerbi-client'].models;
-
- // Get embed application token from session
- let accessToken = GetSession(SessionKeys.AccessToken);
-
- // Get embed URL from session
- let embedUrl = GetSession(SessionKeys.EmbedUrl);
-
- // Get report Id from session
- let embedReportId = GetSession(SessionKeys.EmbedId);
-
- // Use View permissions
- let permissions = models.Permissions.View;
-
- // Embed configuration used to describe the what and how to embed
- // This object is used when calling powerbi.embed
- // This also includes settings and options such as filters
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details
- let config= {
- type: 'report',
- tokenType: models.TokenType.Embed,
- accessToken: accessToken,
- embedUrl: embedUrl,
- id: embedReportId,
- permissions: permissions,
- settings: {
- filterPaneEnabled: false,
- navContentPaneEnabled: false,
- },
-
- // Adding theme attribute to the config, will apply the theme on load
- theme: {themeJson: jsonThemes[0]},
- };
-
- // Get a reference to the embedded report HTML element
- let embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container
- ThemesShowcaseState.themesReport = powerbi.embed(embedContainer, config);
-
- // Report.on will add an event handler for report loaded event
- ThemesShowcaseState.themesReport.on("loaded", function() {
- let themesList = $('#themesList');
-
- // Set the first theme on the list as active
- themesList.find("#theme0").attr('checked', true);
-
- // Displaying the themes list and the backgrounds list
- themesList.show();
- $('#backgroundsList').show();
- $('#background0', '#backgroundsList').addClass("selected");
- });
- });
-}
-
-// Apply clicked theme and set it as the active theme on the list
-function onThemeClicked(element) {
-
- // Set the clicked theme as active
- $(element).attr('checked', true);
-
- applyTheme();
-}
-
-// Apply clicked background and set it as the active background on the list
-function setThemeBackgroundActive(id) {
-
- // Set the clicked background as active
- $('.themeBackgroundColor').removeClass("selected");
- $('#background' + id, '#backgroundsList').addClass("selected");
-
- applyTheme();
-}
-
-function applyTheme() {
- // Get active theme id
- activeThemeId = Number($('input[name=theme]:checked', '#themesList')[0].getAttribute("id").slice(-1));
- activeBackgroundId = Number($('.selected', '#backgroundsList')[0].getAttribute("id").slice(-1));
- theme = {}
- $.extend(theme, jsonThemes[activeThemeId], backgrounds[activeBackgroundId]);
-
- // Apply the theme
- let report = ThemesShowcaseState.themesReport;
- report.applyTheme({themeJson: theme});
-}
-
-// Create a themes list
-function createThemesList() {
-
- // Build the themes list HTML code
- let themesList = $('#themesList');
-
- // Hide the div until the report loads
- themesList.hide();
-
- // Building the themes list
- for (let i = 0; i < jsonThemes.length; i++) {
- themesList.append(buildThemeElement(i));
- }
-}
-
-// Create a backgrounds list
-function createBackgroundsList() {
-
- // Build the backgrounds list HTML code
- let backgroundsList = $('#backgroundsList');
-
- // Hide the div until the report loads
- backgroundsList.hide();
-
- // Building the themes list
- for (let i = 0; i < backgrounds.length; i++) {
- backgroundsList.append(buildBackgroundElement(i));
- }
-}
-
-// Build theme radio button HTML element
-function buildThemeElement(id) {
- let labelElement = document.createElement("label");
- labelElement.setAttribute("class", "showcaseRadioContainer themesRadioContainer");
-
- let inputElement = document.createElement("input");
- inputElement.setAttribute("type", "radio");
- inputElement.setAttribute("name", "theme");
- inputElement.setAttribute("id", 'theme' + id);
- inputElement.setAttribute("onclick", "onThemeClicked(this);");
- labelElement.appendChild(inputElement);
-
- let spanElement = document.createElement("span");
- spanElement.setAttribute("class", "showcaseRadioCheckmark");
- labelElement.appendChild(spanElement);
-
- let secondSpanElement = document.createElement("span");
- secondSpanElement.setAttribute("class", "radioTitle");
- let radioTitleElement = document.createTextNode(jsonThemes[id].name);
- secondSpanElement.appendChild(radioTitleElement);
- labelElement.appendChild(secondSpanElement);
-
- let colorsDivElement = document.createElement("div");
- colorsDivElement.setAttribute("class","themeColors");
-
- // Calculate the max width for displaying data colors
- const maxWidth = document.getElementById('themesDataColorsWrapper').offsetWidth - 48 /*padding*/;
- const dataColors = jsonThemes[id].dataColors;
- const singleDataColorWidth = ThemesShowcaseState.dataColorSize + 3 /*margin*/;
- let currentWidth = 0;
- for (let i = 0; i < dataColors.length; i++) {
-
- // Verify that the data colors will not overflow
- if (currentWidth + singleDataColorWidth > maxWidth)
- break;
-
- let dataColorElement = document.createElement("img");
- let url = "https://placehold.it/" + ThemesShowcaseState.dataColorSize + "/" + dataColors[i].substr(1) + "/000000?text=+";
- dataColorElement.setAttribute("src", url);
- dataColorElement.setAttribute("class", "themeDataColor");
- colorsDivElement.appendChild(dataColorElement);
- currentWidth += singleDataColorWidth;
- }
-
- labelElement.appendChild(colorsDivElement);
-
- return labelElement;
-}
-
-// Build background HTML element
-function buildBackgroundElement(id) {
- let backgroundElement = document.createElement("img");
- let url = "https://placehold.it/" + ThemesShowcaseState.backgroundSize + "/" + backgrounds[id].background.substr(1) + "/000000?text=+";
- backgroundElement.setAttribute("src", url);
- backgroundElement.setAttribute("class", "themeBackgroundColor");
- backgroundElement.setAttribute("id", 'background' + id);
- backgroundElement.setAttribute("onclick", "setThemeBackgroundActive(" + id + ");");
- return backgroundElement;
-}
diff --git a/demo/v2-demo/log_window.html b/demo/v2-demo/log_window.html
deleted file mode 100644
index 47837bc7..00000000
--- a/demo/v2-demo/log_window.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
Log
-
-
- Copy
-
-
- Clear
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/report.html b/demo/v2-demo/report.html
deleted file mode 100644
index 379792c8..00000000
--- a/demo/v2-demo/report.html
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- Desktop
-
-
- Phone
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/sample.html b/demo/v2-demo/sample.html
deleted file mode 100644
index a1cbd5b8..00000000
--- a/demo/v2-demo/sample.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
Welcome to the Power BI Embedded Playground
-
-
- While you are here, you can try many of our features without writing any code.
- Explore our APIs and see the results instantly so you know the options for your application.
- To get started, select the sample you want to explore, make any changes to get the results you want, and then click “Run”.
- You can check out our interactive feature showcase to experience embedded features for your application.
- We add the latest features into the Playground, so you can explore them before adding them to your implementation.
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/scripts/aisdk.js b/demo/v2-demo/scripts/aisdk.js
deleted file mode 100644
index 9b1ade4a..00000000
--- a/demo/v2-demo/scripts/aisdk.js
+++ /dev/null
@@ -1,29 +0,0 @@
-const appUrl = 'https://powerbiplaygroundbe.azurewebsites.net/App';
-const appUrlEnabled = false;
-const defaultInstrumentationKey = "ffe7093c-af96-4df9-8452-b9f4b35ccded";
-
-var appInsightsInstanceDeferred = $.Deferred();
-
-if (appUrlEnabled) {
- $.getJSON(appUrl, function (appConfig) {
- createAppInsightsInstance(appConfig.instrumentationKey);
- });
-}
-else {
- createAppInsightsInstance(defaultInstrumentationKey);
-}
-
-function createAppInsightsInstance(instrumentationKey) {
- // Application Insights setup
- var sdkInstance="appInsightsSDK";window[sdkInstance]="appInsights";var aiName=window[sdkInstance],aisdk=window[aiName]||function(e){function n(e){t[e]=function(){var n=arguments;t.queue.push(function(){t[e].apply(t,n)})}}var t={config:e};t.initialize=!0;var i=document,a=window;setTimeout(function(){var n=i.createElement("script");n.src=e.url||"https://az416426.vo.msecnd.net/scripts/b/ai.2.min.js",i.getElementsByTagName("script")[0].parentNode.appendChild(n)});try{t.cookie=i.cookie}catch(e){}t.queue=[],t.version=2;for(var r=["Event","PageView","Exception","Trace","DependencyData","Metric","PageViewPerformance"];r.length;)n("track"+r.pop());n("startTrackPage"),n("stopTrackPage");var s="Track"+r[0];if(n("start"+s),n("stop"+s),n("addTelemetryInitializer"),n("setAuthenticatedUserContext"),n("clearAuthenticatedUserContext"),n("flush"),!(!0===e.disableExceptionTracking||e.extensionConfig&&e.extensionConfig.ApplicationInsightsAnalytics&&!0===e.extensionConfig.ApplicationInsightsAnalytics.disableExceptionTracking)){n("_"+(r="onerror"));var o=a[r];a[r]=function(e,n,i,a,s){var c=o&&o(e,n,i,a,s);return!0!==c&&t["_"+r]({message:e,url:n,lineNumber:i,columnNumber:a,error:s}),c},e.autoExceptionInstrumented=!0}return t}(
- {
- instrumentationKey: instrumentationKey
- }
- );window[aiName]=aisdk,aisdk.queue&&0===aisdk.queue.length&&aisdk.trackPageView({});
-
- appInsightsInstanceDeferred.resolve(appInsights);
-}
-
-function getAppInsightsInstance() {
- return appInsightsInstanceDeferred;
-}
diff --git a/demo/v2-demo/scripts/assert.js b/demo/v2-demo/scripts/assert.js
deleted file mode 100644
index 049169e9..00000000
--- a/demo/v2-demo/scripts/assert.js
+++ /dev/null
@@ -1,5 +0,0 @@
-function assert(exp){
- if(console["assert"]){
- console.assert(exp);
- }
-}
\ No newline at end of file
diff --git a/demo/v2-demo/scripts/codesamples.js b/demo/v2-demo/scripts/codesamples.js
deleted file mode 100644
index 1838366e..00000000
--- a/demo/v2-demo/scripts/codesamples.js
+++ /dev/null
@@ -1,3026 +0,0 @@
-/*
- This file contains the code samples which will appear live in the web-page.
- Each sample method name starts with _Report_ or _Page or _Embed depends on which section it appears.
- Please keep this.
-*/
-
-// ---- Embed Code ----------------------------------------------------
-
-function _Embed_BasicEmbed() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read report Id from textbox
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // We give All permissions to demonstrate switching between View and Edit mode and saving report.
- var permissions = models.Permissions.All;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'report',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- permissions: permissions,
- settings: {
- panes: {
- filters: {
- visible: true
- },
- pageNavigation: {
- visible: true
- }
- }
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container.
- var report = powerbi.embed(embedContainer, config);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- // Report.off removes a given event handler if it exists.
- report.off("rendered");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("rendered", function () {
- Log.logText("Rendered");
- });
-
- report.on("error", function (event) {
- Log.log(event.detail);
-
- report.off("error");
- });
-
- report.off("saved");
- report.on("saved", function (event) {
- Log.log(event.detail);
- if (event.detail.saveAs) {
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- }
- });
-}
-
-function _Embed_BasicEmbed_Mobile() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read report Id from textbox
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // We give All permissions to demonstrate switching between View and Edit mode and saving report.
- var permissions = models.Permissions.All;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'report',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- permissions: permissions,
- pageName: "ReportSectioneb8c865100f8508cc533",
- settings: {
- panes: {
- filters: {
- visible: false
- }
- },
- layoutType: models.LayoutType.MobilePortrait
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container.
- var report = powerbi.embed(embedContainer, config);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- // Report.off removes a given event handler if it exists.
- report.off("rendered");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("rendered", function () {
- Log.logText("Rendered");
- });
-
- report.on("error", function (event) {
- Log.log(event.detail);
-
- report.off("error");
- });
-
- report.off("saved");
- report.on("saved", function (event) {
- Log.log(event.detail);
- if (event.detail.saveAs) {
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- }
- });
-}
-
-// ---- Paginated Embed Code ----------------------------------------------------
-function _Embed_PaginatedReportBasicEmbed() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read paginated report Id from textbox
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Se view permissions.
- var permissions = models.Permissions.View;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'report',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- permissions: permissions,
- };
-
- // Get a reference to the paginated embedded report HTML element
- var paginatedReportContainer = $('#paginatedReportContainer')[0];
-
- // Embed the paginated report and display it within the div container.
- var report = powerbi.embed(paginatedReportContainer, config);
-
- Log.logText("Loading Paginated Report.");
-}
-
-function _Embed_VisualEmbed() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read report Id from textbox
- var txtReportId = $('#txtEmbedReportId').val();
-
- // Read page name from textbox
- var txtPageName = $('#txtPageName').val();
-
- // Read visual name from textbox
- var txtVisualName = $('#txtVisualName').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'visual',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtReportId,
- pageName: txtPageName,
- visualName: txtVisualName
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container.
- var report = powerbi.embed(embedContainer, config);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- // Report.off removes a given event handler if it exists.
- report.off("rendered");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("rendered", function () {
- Log.logText("Rendered");
- });
-
- report.on("error", function (event) {
- Log.log(event.detail);
-
- report.off("error");
- });
-}
-
-function _Embed_DashboardEmbed() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtDashboardEmbed').val();
-
- // Read dashboard Id from textbox
- var txtEmbedDashboardId = $('#txtEmbedDashboardId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'dashboard',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedDashboardId,
- pageView: 'fitToWidth'
- };
-
- // Get a reference to the embedded dashboard HTML element
- var dashboardContainer = $('#dashboardContainer')[0];
-
- // Embed the dashboard and display it within the div container.
- var dashboard = powerbi.embed(dashboardContainer, config);
-
- // Dashboard.off removes a given event handler if it exists.
- dashboard.off("loaded");
-
- // Dashboard.on will add an event handler which prints to Log window.
- dashboard.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- dashboard.on("error", function (event) {
- Log.log(event.detail);
-
- dashboard.off("error");
- });
-
- dashboard.off("tileClicked");
- dashboard.on("tileClicked", function (event) {
- Log.log(event.detail);
- });
-}
-
-function _Embed_DashboardEmbed_Mobile() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtDashboardEmbed').val();
-
- // Read dashboard Id from textbox
- var txtEmbedDashboardId = $('#txtEmbedDashboardId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'dashboard',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedDashboardId,
- pageView: 'oneColumn'
- };
-
- // Get a reference to the embedded dashboard HTML element
- var dashboardContainer = $('#dashboardContainer')[0];
-
- // Embed the dashboard and display it within the div container.
- var dashboard = powerbi.embed(dashboardContainer, config);
-
- // Dashboard.off removes a given event handler if it exists.
- dashboard.off("loaded");
-
- // Dashboard.on will add an event handler which prints to Log window.
- dashboard.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- dashboard.on("error", function (event) {
- Log.log(event.detail);
-
- dashboard.off("error");
- });
-
- dashboard.off("tileClicked");
- dashboard.on("tileClicked", function (event) {
- Log.log(event.detail);
- });
-}
-
-function _Mock_Embed_BasicEmbed(isEdit) {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read report Id from textbox
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
- var permissions = models.Permissions.All;
- var viewMode = isEdit ? models.ViewMode.Edit : models.ViewMode.View;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'report',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- permissions: permissions,
- viewMode: viewMode,
- settings: {
- panes: {
- filters: {
- visible: true
- },
- pageNavigation: {
- visible: true
- }
- },
- useCustomSaveAsDialog: true
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container.
- var report = powerbi.embed(embedContainer, config);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- // Report.off removes a given event handler if it exists.
- report.off("rendered");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("rendered", function () {
- Log.logText("Rendered");
- });
-
- report.off("saveAsTriggered");
- report.on("saveAsTriggered", function () {
- Log.logText("Cannot save sample report");
- });
-
- report.off("error");
- report.on("error", function (event) {
- Log.log(event.detail);
- });
-
- report.off("saved");
- report.on("saved", function (event) {
- Log.log(event.detail);
- if (event.detail.saveAs) {
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- }
- });
-}
-
-function _Mock_Embed_BasicEmbed_EditMode() {
- _Mock_Embed_BasicEmbed(true);
-}
-
-function _Mock_Embed_BasicEmbed_ViewMode() {
- _Mock_Embed_BasicEmbed(false);
-}
-
-function _Embed_BasicEmbed_EditMode() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtReportEmbed').val();
-
- // Read report Id from textbox
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // This also includes settings and options such as filters.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'report',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- permissions: models.Permissions.All /*gives maximum permissions*/,
- viewMode: models.ViewMode.Edit,
- settings: {
- panes: {
- filters: {
- visible: true
- },
- pageNavigation: {
- visible: true
- }
- }
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Embed the report and display it within the div container.
- var report = powerbi.embed(embedContainer, config);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- // Report.off removes a given event handler if it exists.
- report.off("rendered");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("rendered", function () {
- Log.logText("Rendered");
- });
-
- report.off("error");
- report.on("error", function (event) {
- Log.log(event.detail);
- });
-
- report.off("saved");
- report.on("saved", function (event) {
- Log.log(event.detail);
- if (event.detail.saveAs) {
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- }
- });
-}
-
-function _Embed_MobileEditNotSupported() {
- // Edit mode is not supported on mobile.
-}
-
-function _Embed_MobileCreateNotSupported() {
- // Create mode is not supported on mobile.
-}
-
-function _Embed_EmbedWithDefaultFilter() {
- var txtAccessToken = $('#txtAccessToken').val();
- var txtEmbedUrl = $('#txtReportEmbed').val();
- var txtEmbedReportId = $('#txtEmbedReportId').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Geo",
- column: "Region"
- },
- operator: "In",
- values: ["West"]
- };
-
- var embedConfiguration = {
- type: 'report',
- tokenType: models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedReportId,
- settings: {
- panes: {
- filters: {
- visible: false
- },
- pageNavigation: {
- visible: false
- }
- }
- },
- filters: [filter]
- };
-
- var embedContainer = document.getElementById('embedContainer');
- powerbi.embed(embedContainer, embedConfiguration);
-}
-
-function _Embed_TileEmbed() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtTileEmbed').val();
-
- // Read dashboard Id from textbox
- var txtEmbedDashboardId = $('#txtEmbedDashboardId').val();
-
- // Read tile Id from textbox
- var txtEmbedTileId = $('#txtEmbedTileId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'tile',
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- id: txtEmbedTileId,
- dashboardId: txtEmbedDashboardId
- };
-
- // Get a reference to the embedded tile HTML element
- var tileContainer = $('#tileContainer')[0];
-
- // Embed the tile and display it within the div container.
- var tile = powerbi.embed(tileContainer, config);
-
- // Tile.off removes a given event handler if it exists.
- tile.off("tileLoaded");
-
- // Tile.on will add an event handler which prints to Log window.
- tile.on("tileLoaded", function (event) {
- Log.logText("Tile loaded event");
- });
-
- // Tile.off removes a given event handler if it exists.
- tile.off("tileClicked");
-
- // Tile.on will add an event handler which prints to Log window.
- tile.on("tileClicked", function (event) {
- Log.logText("Tile clicked event");
- Log.log(event.detail);
- });
-}
-
-function _Embed_Create() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtCreateAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtCreateReportEmbed').val();
-
- // Read dataset Id from textbox
- var txtEmbedDatasetId = $('#txtEmbedDatasetId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed create configuration used to describe the what and how to create report.
- // This object is used when calling powerbi.createReport.
- var embedCreateConfiguration = {
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- datasetId: txtEmbedDatasetId,
- };
-
- // Grab the reference to the div HTML element that will host the report
- var embedContainer = $('#embedContainer')[0];
-
- // Create report
- var report = powerbi.createReport(embedContainer, embedCreateConfiguration);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- // Report.off removes a given event handler if it exists.
- report.off("rendered");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("rendered", function () {
- Log.logText("Rendered");
- });
-
- report.off("error");
- report.on("error", function (event) {
- Log.log(event.detail);
- });
-
- // report.off removes a given event handler if it exists.
- report.off("saved");
- report.on("saved", function (event) {
- Log.log(event.detail);
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- });
-}
-
-function _Mock_Embed_Create() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtCreateAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtCreateReportEmbed').val();
-
- // Read dataset Id from textbox
- var txtEmbedDatasetId = $('#txtEmbedDatasetId').val();
-
- // Read embed type from radio
- var tokenType = $('input:radio[name=tokenType]:checked').val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed create configuration used to describe the what and how to create report.
- // This object is used when calling powerbi.createReport.
- var embedCreateConfiguration = {
- tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- datasetId: txtEmbedDatasetId,
- settings: {
- useCustomSaveAsDialog: true
- }
- };
-
- // Grab the reference to the div HTML element that will host the report
- var embedContainer = $('#embedContainer')[0];
-
- // Create report
- var report = powerbi.createReport(embedContainer, embedCreateConfiguration);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- // Report.off removes a given event handler if it exists.
- report.off("rendered");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("rendered", function () {
- Log.logText("Rendered");
- });
-
- report.off("saveAsTriggered");
- report.on("saveAsTriggered", function () {
- Log.logText("Cannot save sample report");
- });
-
- report.off("error");
- report.on("error", function (event) {
- Log.log(event.detail);
- });
-}
-
-function _Embed_QnaEmbed() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtQnaEmbed').val();
-
- // Read dataset Id from textbox
- var txtDatasetId = $('#txtDatasetId').val();
-
- // Read question from textbox
- var txtQuestion = $('#txtQuestion').val();
-
- // Read Q&A mode
- var qnaMode = $("input[name='qnaMode']:checked").val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'qna',
- tokenType: models.TokenType.Embed,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- datasetIds: [txtDatasetId],
- viewMode: models.QnaMode[qnaMode],
- question: txtQuestion
- };
-
- // Get a reference to the embedded Q&A HTML element
- var qnaContainer = $('#qnaContainer')[0];
-
- // Embed the Q&A and display it within the div container.
- powerbi.embed(qnaContainer, config);
-}
-
-function _Embed_QnaEmbed_Aad() {
- // Read embed application token from textbox
- var txtAccessToken = $('#txtAccessToken').val();
-
- // Read embed URL from textbox
- var txtEmbedUrl = $('#txtQnaEmbed').val();
-
- // Read dataset Id from textbox
- var txtDatasetId = $('#txtDatasetId').val();
-
- // Read question from textbox
- var txtQuestion = $('#txtQuestion').val();
-
- // Read Q&A mode
- var qnaMode = $("input[name='qnaMode']:checked").val();
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Embed configuration used to describe the what and how to embed.
- // This object is used when calling powerbi.embed.
- // You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
- var config = {
- type: 'qna',
- tokenType: models.TokenType.Aad,
- accessToken: txtAccessToken,
- embedUrl: txtEmbedUrl,
- datasetIds: [txtDatasetId],
- viewMode: models.QnaMode[qnaMode],
- question: txtQuestion
- };
-
- // Get a reference to the embedded Q&A HTML element
- var qnaContainer = $('#qnaContainer')[0];
-
- // Embed the Q&A and display it within the div container.
- powerbi.embed(qnaContainer, config);
-}
-
-// ---- Report Operations ----------------------------------------------------
-
-function _Report_GetId() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the report id.
- var reportId = report.getId();
-
- Log.logText("Report id: \"" + reportId + "\"");
-}
-
-async function _Report_UpdateSettings() {
- // The new settings that you want to apply to the report.
- const newSettings = {
- panes: {
- filters: {
- visible: false
- },
- pageNavigation: {
- visible: true
- }
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(newSettings);
- Log.logText("Filter pane was removed.");
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Report_GetPages() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and loop through to collect the
- // page name and display name of each page and display the value.
- try {
- const pages = await report.getPages();
- var log = "Report pages:";
- pages.forEach(function (page) {
- log += "\n" + page.name + " - " + page.displayName;
- });
- Log.logText(log);
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Report_SetPage() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // setPage will change the selected view to the page you indicate.
- // This is the actual page name not the display name.
- try {
- await report.setPage("ReportSectiona271643cba2213c935be");
- Log.logText("Page was set to: ReportSectiona271643cba2213c935be");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_GetFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Get the filters applied to the report.
- try {
- const filters = await report.getFilters();
- Log.log(filters);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_SetFilters() {
- // Build the filter you want to use. For more information, See Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Geo",
- column: "Region"
- },
- operator: "In",
- values: ["West"]
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Set the filter for the report.
- // Pay attention that setFilters receives an array.
- try {
- await report.setFilters([filter]);
- Log.logText("Report filter was set.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_RemoveFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Remove the filters currently applied to the report.
- try {
- await report.removeFilters();
- Log.logText("Report filters were removed.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Report_SetFilters() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Build the filter you want to use. For more information, See Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Date",
- column: "Months"
- },
- operator: "In",
- values: ["Oct", "Nov", "Dec"]
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- visual = powerbi.get(embedContainer);
-
- // Set the filter for the report.
- // Pay attention that setFilters receives an array.
- try {
- await visual.setFilters([filter], models.FiltersLevel.Report);
- Log.logText("Report filter was set.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Report_GetFilters() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- visual = powerbi.get(embedContainer);
-
- // Get the filters applied to the report.
- try {
- const filters = await visual.getFilters(models.FiltersLevel.Report);
- Log.log(filters);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Report_RemoveFilters() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Remove the filters currently applied to the report.
- try {
- await report.removeFilters(models.FiltersLevel.Report);
- Log.logText("Report filters were removed.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Page_SetFilters() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Build the filter you want to use. For more information, See Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Date",
- column: "Months"
- },
- operator: "In",
- values: ["Oct", "Nov", "Dec"]
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- visual = powerbi.get(embedContainer);
-
- // Set the filter for the report.
- // Pay attention that setFilters receives an array.
- try {
- await visual.setFilters([filter], models.FiltersLevel.Page);
- Log.logText("Page filter was set.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Page_GetFilters() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- visual = powerbi.get(embedContainer);
-
- // Get the filters applied to the report.
- try {
- const filters = await visual.getFilters(models.FiltersLevel.Page);
- Log.log(filters);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Page_RemoveFilters() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Remove the filters currently applied to the report.
- try {
- await report.removeFilters(models.FiltersLevel.Page);
- Log.logText("Page filters were removed.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Visual_SetFilters() {
- // Build the filter you want to use. For more information, See Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Date",
- column: "Months"
- },
- operator: "In",
- values: ["Oct", "Nov", "Dec"]
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- visual = powerbi.get(embedContainer);
-
- // Set the filter for the report.
- // Pay attention that setFilters receives an array.
- try {
- await visual.setFilters([filter]);
- Log.logText("Report filter was set.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Visual_GetFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- visual = powerbi.get(embedContainer);
-
- // Get the filters applied to the report.
- try {
- const filters = await visual.getFilters();
- Log.log(filters);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_Visual_RemoveFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Remove the filters currently applied to the report.
- try {
- await report.removeFilters();
- Log.logText("Report filters were removed.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_PrintCurrentReport() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Trigger the print dialog for your browser.
- try {
- await report.print();
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Reload() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Reload the displayed report
- try {
- await report.reload();
- Log.logText("Reloaded");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-function _PaginatedReport_Reload() {
- // Get a reference to the paginated report HTML element
- var paginatedReportContainer = $('#paginatedReportContainer')[0];
-
- // Get a reference to the embedded paginated report.
- paginatedReport = powerbi.get(paginatedReportContainer);
-
- // Reload the displayed paginated report
- paginatedReport.reload();
-
- Log.logText("Reload Paginated Report");
-}
-
-async function _Report_Refresh() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Refresh the displayed report
- try {
- await report.refresh();
- Log.logText("Refreshed");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_ApplyCustomLayout() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Define default visual layout: visible in 400x300.
- let defaultLayout = {
- width: 400,
- height: 250,
- displayState: {
- mode: models.VisualContainerDisplayMode.Hidden
- }
- };
-
- // Define page size as custom size: 1000x580.
- let pageSize = {
- type: models.PageSizeType.Custom,
- width: 1000,
- height: 580
- };
-
- // Page layout: two visible visuals in fixed position.
- let pageLayout = {
- defaultLayout: defaultLayout,
- visualsLayout: {
- "VisualContainer1": {
- x: 70,
- y: 100,
- displayState: {
- mode: models.VisualContainerDisplayMode.Visible
- }
- },
- "VisualContainer3": {
- x: 540,
- y: 100,
- displayState: {
- mode: models.VisualContainerDisplayMode.Visible
- }
- }
- }
- };
-
- let settings = {
- layoutType: models.LayoutType.Custom,
- customLayout: {
- pageSize: pageSize,
- displayOption: models.DisplayOption.FitToPage,
- pagesLayout: {
- "ReportSection600dd9293d71ade01765": pageLayout
- }
- },
- panes: {
- filters: {
- visible: false
- },
- pageNavigation: {
- visible: false
- }
- }
- }
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(settings);
- Log.logText("Custom layout applied, to remove custom layout, reload the report using 'Reload' API.");
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Report_HideAllVisualHeaders() {
-
- // New settings to hide all the visual headers in the report
- const newSettings = {
- visualSettings: {
- visualHeaders: [
- {
- settings: {
- visible: false
- }
- // No selector - Hide visual header for all the visuals in the report
- }
- ]
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(newSettings);
- Log.logText("Visual header was successfully hidden for all the visuals in the report.");
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Report_ShowAllVisualHeaders() {
- // New settings to show all the visual headers in the report
- const newSettings = {
- visualSettings: {
- visualHeaders: [
- {
- settings: {
- visible: true
- }
- // No selector - Show visual header for all the visuals in the report
- }
- ]
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(newSettings);
- Log.logText("Visual header was successfully shown for all the visuals in the report.");
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Report_HideSingleVisualHeader() {
-
- // Define settings to hide the header of a single visual
- var newSettings = {
- visualSettings: {
- visualHeaders: [
- {
- settings: {
- visible: true
- }
- // No selector - Show visual header for all the visuals in the report
- },
- {
- settings: {
- visible: false
- },
- selector: {
- $schema: "http://powerbi.com/product/schema#visualSelector",
- visualName: "VisualContainer4"
- // The visual name can be retrieved using getVisuals()
- // Hide visual header for a single visual only
- }
- }
- ]
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(newSettings);
- Log.logText("Visual header was successfully hidden for 'Category Breakdown' visual.");
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-function _Report_FullScreen() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Displays the report in full screen mode.
- report.fullscreen();
-}
-
-function _Report_ExitFullScreen() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Exits full screen mode.
- report.exitFullscreen();
-}
-
-// ---- PaginatedReport Operations ----------------------------------------------------
-
-function _PaginatedReport_GetId() {
- // Get a reference to the embedded report HTML element
- var paginatedReportContainer = $('#paginatedReportContainer')[0];
-
- // Get a reference to the embedded report.
- paginatedReport = powerbi.get(paginatedReportContainer);
-
- // Retrieve the report id.
- var reportId = paginatedReport.getId();
-
- Log.logText(reportId);
-}
-
-function _PaginatedReport_FullScreen() {
- // Get a reference to the paginated embedded report HTML element
- var paginatedReportContainer = $('#paginatedReportContainer')[0];
-
- // Get a reference to the paginated embedded report.
- paginatedReport = powerbi.get(paginatedReportContainer);
-
- // Displays the paginated report in full screen mode.
- paginatedReport.fullscreen();
-}
-
-function _PaginatedReport_ExitFullScreen() {
- // Get a reference to the paginated embedded report HTML element
- var paginatedReportContainer = $('#paginatedReportContainer')[0];
-
- // Get a reference to the paginated embedded report.
- paginatedReport = powerbi.get(paginatedReportContainer);
-
- // Exits full screen mode.
- paginatedReport.exitFullscreen();
-}
-
-function _Report_switchModeEdit() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Switch to edit mode.
- report.switchMode("edit");
-}
-
-function _Report_switchModeView() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Switch to view mode.
- report.switchMode("view");
-}
-
-function _Report_save() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Save report
- report.save();
-}
-
-function _Mock_Report_save() {
- Log.logText('Cannot save sample report');
-}
-
-function _Report_saveAs() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- var saveAsParameters = {
- name: "newReport"
- };
-
- // SaveAs report
- report.saveAs(saveAsParameters);
-}
-
-async function _Report_Extensions_OptionsMenu() {
- const base64Icon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAu9JREFUeJzt3U9OE2Ech/FnSiKsXbh340pg5Qk8gofAY3gGtBqWXsKNIR5BF0ZkQ9h6A2pC62LAEP5ITdv3R+f7fJJ3QUh4ZzpPmaaZmReGZxf4ABwDE2C24Jhc/K33wE7D/dB/2gIOgCmLH/S7xhQYA5uN9klz2gK+sLoDf30cXsypB+KAdgf/coyb7Jnutctq/+3/63Sw3WD/VmpUvQFL8BroCubtgL2CeXXNMe3f/ZfjqMH+rVTFO2fZJsCjwrnX+sPgEAKYFc+/1q/hED4DaAEGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCDcbQEs+3n7qx7Vqvf/vjH3egctnrfvqB13rnfQ+nn7jtrxd72DDXpj4BVK8RR4DHzq6M/5X1nzZ97qv82A3Q3gDfCidltUoAOmHf0nxGfFG6MaPztqn7evWpOO/lygUH4TGM4AwhlAOAMIZwDhDCCcAYQzgHAGEM4AwhlAOAMIZwDhDCCcAYQbAb+rN0JlJiPgtHorVOZkRH+NuDIddvS3C33Dy8LTTLm4LPwX8AQvDU/zDvh4+cMm/amg+pYlR5vxmVuuBN+iv0XMm0OHO86Bfa4c/NvO+9vAHvCS/h6yG3eSaq1MgBP6//AHwPervxzCB79Z8fxr/Rr6TWA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQzgDCGUA4AwhnAOEMIJwBhDOAcAYQbggBVK53MCmceymGEMBp4dwnhXMvxRACqFzvwLUWHoAdah5wfQ48b7B/msOY9gHsN9kzzaX1ege3Pm9ftVqsd3Djeft6eLbpl0M5As5Y/KCfAT+AtwzwnP8HNwiKJyPkCoYAAAAASUVORK5CYII=";
-
- // The new settings that you want to apply to the report.
- const newSettings = {
- extensions: [
- {
- command: {
- name: "extension command",
- title: "Extend commands",
- icon: base64Icon,
- extend: {
- // Define visualOptionsMenu to extend options menu
- visualOptionsMenu: {
- // Define title to override default title.
- // You can override default icon as well.
- title: "Extend options menu",
- }
- }
- }
- }
- ]
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(newSettings);
- }
- catch (error) {
- Log.log(error);
- }
-
- // Report.on will add an event handler to commandTriggered event which prints to console window.
- report.on("commandTriggered", function (event) {
- Log.logText("Event - commandTriggered:");
- var commandDetails = event.detail;
- Log.log(commandDetails);
- });
-
- // Select Run and open options menu to see new added items.
- // Click on menu items added and you should see an entry in the Log window.
-
- Log.logText("Open visual options menu by clicking the three dots icon and click on added items to see events in Log window.");
-}
-
-async function _Report_Extensions_ContextMenu() {
- // The new settings that you want to apply to the report.
- const newSettings = {
- extensions: [
- {
- command: {
- name: "extension command",
- title: "Extend command",
- extend: {
- // Define visualContextMenu to extend context menu.
- visualContextMenu: {
- // Define title to override default title.
- //You can override default icon as well.
- title: "Extend context menu",
- }
- }
- }
- }
- ]
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(newSettings);
- }
- catch (error) {
- Log.log(error);
- }
-
- // Report.on will add an event handler to commandTriggered event which prints to console window.
- report.on("commandTriggered", function (event) {
- Log.logText("Event - commandTriggered:");
- var commandDetails = event.detail;
- Log.log(commandDetails);
- });
-
- // Select Run and context menu (i.e. by right click on data points) to see new added items.
- // Click on menu items added and you should see an entry in the Log window.
-
- Log.logText("Open visual context menu by right click on data points and click on added items to see events in Log window.");
-}
-
-async function _Visual_Operations_SortVisualBy() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Build the sort request.
- // For more information, See https://github.com/Microsoft/PowerBI-JavaScript/wiki/Sort-Visual-By
- const sortByRequest = {
- orderBy: {
- table: "SalesFact",
- measure: "Total Category Volume"
- },
- direction: models.SortDirection.Descending
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
-
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- const visuals = await activePage.getVisuals();
-
- // Retrieve the target visual.
- var visual = visuals.filter(function (visual) {
- return visual.name === "VisualContainer6";
- })[0];
-
- // Sort the visual's data by direction and data field.
- await visual.sortBy(sortByRequest);
- Log.logText("\"Total Category Volume Over Time by Region\" visual was sorted according to the request.")
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-// ---- Page Operations ----------------------------------------------------
-
-async function _Page_SetActive() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve active page.
- try {
- const pages = await report.getPages();
- await pages[3].setActive();
- Log.logText("Active page was set to: \"" + pages[3].displayName + "\"");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Page_GetFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the filters for the first page.
- try {
- const pages = await report.getPages();
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- const filters = await activePage.getFilters();
- Log.log(filters);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Page_GetVisuals() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- const visuals = await activePage.getVisuals();
- Log.log(
- visuals.map(function (visual) {
- return {
- name: visual.name,
- type: visual.type,
- title: visual.title,
- layout: visual.layout
- };
- }));
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Page_SetFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Build the filter you want to use. For more information, see Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#basic",
- target: {
- table: "Geo",
- column: "Region"
- },
- operator: "In",
- values: ["West"]
- };
-
- // Retrieve the page collection and then set the filters for the first page.
- // Pay attention that setFilters receives an array.
- try {
- const pages = await report.getPages();
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- await activePage.setFilters([filter]);
- Log.logText("Page filter was set.");
-
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Page_RemoveFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and remove the filters for the first page.
- try {
- const pages = await report.getPages();
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- await activePage.removeFilters();
- Log.logText("Page filters were removed.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Page_HasLayout() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and check if the first page has a MobilePortrait layout.
- try {
- const pages = await report.getPages();
- const hasLayout = await pages[0].hasLayout(models.LayoutType.MobilePortrait);
-
- var hasLayoutText = hasLayout ? "has" : "doesn't have";
- Log.logText("Page \"" + pages[0].name + "\" " + hasLayoutText + " mobile portrait layout.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-// ---- Event Listener ----------------------------------------------------
-
-function _Events_PageChanged() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Report.off removes a given event listener if it exists.
- report.off("pageChanged");
-
- // Report.on will add an event listener.
- report.on("pageChanged", function (event) {
- Log.logText("Event - pageChanged:");
- var page = event.detail.newPage;
- Log.logText("Page changed to \"" + page.name + "\" - \"" + page.displayName + "\"");
- });
-
- // Select Run and change to a different page.
- // You should see an entry in the Log window.
-
- Log.logText("Select different page to see events in Log window.");
-}
-
-function _Events_DataSelected() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Report.off removes a given event listener if it exists.
- report.off("dataSelected");
-
- // Report.on will add an event listener.
- report.on("dataSelected", function (event) {
- Log.logText("Event - dataSelected:");
- var data = event.detail;
- Log.log(data);
- });
-
- // Select Run and select an element of a visualization.
- // For example, a bar in a bar chart. You should see an entry in the Log window.
-
- Log.logText("Select data to see events in Log window.");
-}
-
-function _Events_SaveAsTriggered() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Report.off removes a given event listener if it exists.
- report.off("saveAsTriggered");
-
- // Report.on will add an event listener.
- report.on("saveAsTriggered", function (event) {
- Log.log(event);
- });
-
- // Select Run and then select SaveAs.
- // You should see an entry in the Log window.
-
- Log.logText("Select SaveAs to see events in Log window.");
-}
-
-function _Events_BookmarkApplied() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Report.off removes a given event listener if it exists.
- report.off("bookmarkApplied");
-
- // Report.on will add an event listener.
- report.on("bookmarkApplied", function (event) {
- Log.logText("Event - bookmarkApplied:");
- Log.log(event.detail);
- });
-
- // Select Run and then go to bookmarks
- // and select 'Apply Bookmark by name'.
- // You should see an entry in the Log window.
- Log.logText("Apply a bookmark to see events in Log window.");
-}
-
-function _Events_ReportLoaded() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Report.off removes a given event handler if it exists.
- report.off("loaded");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("loaded", function () {
- Log.logText("Loaded");
- });
-
- Log.logText("Reload the report to see the loaded event.");
-}
-
-function _Events_ReportRendered() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Report.off removes a given event handler if it exists.
- report.off("rendered");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("rendered", function () {
- Log.logText("Rendered");
- });
-
- Log.logText("Reload the report to see the rendered event.");
-}
-
-function _Events_ReportSaved() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Report.off removes a given event handler if it exists.
- report.off("saved");
-
- // Report.on will add an event handler which prints to Log window.
- report.on("saved", function (event) {
- Log.log(event.detail);
- if (event.detail.saveAs) {
- Log.logText('In order to interact with the new report, create a new token and load the new report');
- }
- });
-
- Log.logText("Save/SaveAs the report to see the saved event.");
-}
-
-function _Events_TileLoaded() {
- // Get a reference to the embedded tile HTML element
- var tileContainer = $('#tileContainer')[0];
-
- // Get a reference to the embedded tile.
- var tile = powerbi.get(tileContainer);
-
- // Tile.off removes a given event handler if it exists.
- tile.off("tileLoaded");
-
- // Tile.on will add an event handler which prints to Log window.
- tile.on("tileLoaded", function (event) {
- Log.logText("Tile loaded event");
- });
-}
-
-function _Events_TileClicked() {
- // Get a reference to the embedded tile HTML element
- var tileContainer = $('#tileContainer')[0];
-
- // Get a reference to the embedded tile.
- var tile = powerbi.get(tileContainer);
-
- // Tile.off removes a given event handler if it exists.
- tile.off("tileClicked");
-
- // Tile.on will add an event handler which prints to Log window.
- tile.on("tileClicked", function (event) {
- Log.logText("Tile clicked event");
- Log.log(event.detail);
- });
-
- Log.logText("Click on the tile to see the tile clicked event.");
-}
-
-function _Events_ButtonClicked() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Report.off removes a given event listener if it exists.
- report.off("buttonClicked");
-
- // Report.on will add an event listener.
- report.on("buttonClicked", function (event) {
- Log.logText("Event - buttonClicked:");
- var data = event.detail;
- Log.log(data);
- });
-
- // Select Run and click on a button in the report
- // For example, a Qna button. You should see an entry in the Log window.
- Log.logText("Click button to see event in Log window.");
-}
-
-// ---- Dashboard Operations ----------------------------------------------------
-
-function _Dashboard_GetId() {
- // Get a reference to the embedded dashboard HTML element
- var dashboardContainer = $('#dashboardContainer')[0];
-
- // Get a reference to the embedded dashboard.
- dashboard = powerbi.get(dashboardContainer);
-
- // Retrieve the dashboard id.
- var dashboardId = dashboard.getId();
-
- Log.logText("Dashboard id: \"" + dashboardId + "\"");
-}
-
-function _Dashboard_FullScreen() {
- // Get a reference to the embedded dashboard HTML element
- var dashboardContainer = $('#dashboardContainer')[0];
-
- // Get a reference to the embedded dashboard.
- dashboard = powerbi.get(dashboardContainer);
-
- // Displays the dashboard in full screen mode.
- dashboard.fullscreen();
-}
-
-function _Dashboard_ExitFullScreen() {
- // Get a reference to the embedded dashboard HTML element
- var dashboardContainer = $('#dashboardContainer')[0];
-
- // Get a reference to the embedded dashboard.
- dashboard = powerbi.get(dashboardContainer);
-
- // Exits full screen mode.
- dashboard.exitFullscreen();
-}
-
-// ---- Dashboard Events Listener ----------------------------------------------------
-
-function _DashboardEvents_TileClicked() {
- // Get a reference to the embedded dashboard HTML element
- var dashboardContainer = $('#dashboardContainer')[0];
-
- // Get a reference to the embedded dashboard.
- dashboard = powerbi.get(dashboardContainer);
-
- // dashboard.off removes a given event listener if it exists.
- dashboard.off("tileClicked");
-
- // dashboard.on will add an event listener.
- dashboard.on("tileClicked", function (event) {
- Log.log(event.detail);
- });
-}
-
-// ---- Qna Events Listener ----------------------------------------------------
-
-async function _Qna_SetQuestion() {
- // Get a reference to the embedded Q&A HTML element
- var qnaContainer = $('#qnaContainer')[0];
-
- // Get a reference to the embedded Q&A.
- qna = powerbi.get(qnaContainer);
-
- try {
- const result = await qna.setQuestion("2014 total units YTD by manufacturer, region as treemap chart");
- Log.log(result);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-function _Qna_QuestionChanged() {
- // Get a reference to the embedded Q&A HTML element
- var qnaContainer = $('#qnaContainer')[0];
-
- // Get a reference to the embedded Q&A.
- qna = powerbi.get(qnaContainer);
-
- // qna.off removes a given event listener if it exists.
- qna.off("visualRendered");
-
- // qna.on will add an event listener.
- qna.on("visualRendered", function (event) {
- Log.log(event.detail);
- });
-
- Log.logText("Change the question to see events in Log window.");
-}
-
-// ---- Visual Events Listener ----------------------------------------------------
-
-function _Visual_DataSelected() {
- // Get a reference to the embedded visual HTML element
- var visualContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded visual.
- visual = powerbi.get(visualContainer);
-
- // Visual.off removes a given event listener if it exists.
- visual.off("dataSelected");
-
- // Visual.on will add an event listener.
- visual.on("dataSelected", function (event) {
- var data = event.detail;
- Log.log(data);
- });
-
- // Select Run and select an element of a visualization.
- // For example, a bar in a bar chart. You should see an entry in the Log window.
-
- Log.logText("Select data to see events in Log window.");
-}
-
-// ---- Bookmarks Operations ----------------------------------------------------
-async function _Bookmarks_Enable() {
- // The new settings that you want to apply to the report.
- const newSettings = {
- panes: {
- bookmarks: {
- visible: true
- }
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(newSettings);
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Bookmarks_Disable() {
- // The new settings that you want to apply to the report.
- const newSettings = {
- panes: {
- bookmarks: {
- visible: false
- }
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await report.updateSettings(newSettings);
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Bookmarks_Get() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the bookmark collection and loop through to print the
- // bookmarks' name and display name.
- try {
- const bookmarks = await report.bookmarksManager.getBookmarks();
- bookmarks.forEach(function (bookmark) {
- var log = bookmark.name + " - " + bookmark.displayName;
- Log.logText(log);
- });
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Bookmarks_Apply() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // bookmarksManager.apply will apply the bookmark with the
- // given name on the report.
- // This is the actual bookmark name not the display name.
- try {
- await report.bookmarksManager.apply("Bookmarkaf5fe203dc1e280a4822");
- Log.logText("Bookmark \"Q4 2014\" applied.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Bookmarks_Capture() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Capture the current bookmark and prints the bookmark's
- // state string to Log window.
- try {
- const capturedBookmark = await report.bookmarksManager.capture();
- var log = "Captured bookmark state: " + capturedBookmark.state;
- Log.logText(log);
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Bookmarks_ApplyState() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // bookmarksManager.applyState will apply the bookmark which
- // represented by the given state string.
- try {
- await report.bookmarksManager.applyState("H4sIAAAAAAAAA+1d62/bOBL/VwIfDvmSXQyfEvvp2qa9La7Z7iW9HIpDP/AxcrRrS4Yspw2K/u9HSbbrxJal+J3USRBEMjUcDofD3zyofOu4eDjo6bvfdR87Lzqv0vSvvs7+OiGkc9ZJ7t8MlNbaEMuIoxGllFMS+VbpII/TZNh58a2T66yL+XU8HOleQdHf/F8HeEggcIZKwQyRwoEQnc/fzzr4ddBLM108fZXrHAsKt5gN/bXvlfwKnri2eXyLV2jz6u4lDtIsH19LAOcUVcwFRDsEEkjhn4niXu7JFOTM3Zuvg8xz8W0ymLflh75Vfjcorl/7jrtpFlvdmz5aPHk9YYSedd5mab+kMZaS8y3fJHmc3/mL84Lz75/POv+9wQzLZq/TxMUVw98678rfBRs4HFaCKpv0Rv0HnxRXV+kos3iJ0Y+LssPvXl5/ZOkAs7LTT6gzf8/3eq17o1LOnuj72DPvx1GwX9z2DSkQ/r5o+fm7/1UJfaa7Vmw8GOpCTs46N+mX1xn6Fq7zgpRdDatZKieied58ozUmbp1h+dG4kc0fjuwKu31M8gWDO3vAFNkGV4uEfZEm+U0LhugOxRQPr3XyMhs67NXowW1pD/yiyHWcjOdXRCQALYghKL0iEGeZKu4P46Tbw8qClPag/OtjNRajh7G9utH+wpsd86fXpoLY96JbVCIMGBNADRBpCSLCWgSp1NxbPIYBD3jIIMRgPYJhGEobSaCWc0IF1Ua7RoI5fs1N+nWemoCA+G9NRejXuCICDFmLvQBQCEIjFxolDA3ACb06e1QoFkZgNIAXoSUMmFmLPW8wmHCRlx+nEoQRwjYrTC17VitqGHcuJBqscIrz5snVpfF6Ncpzv0zmp5c5wyURwmgBjBmtgK9JUkZGBwJsgDSQzijCrF2D5Nlksy+e6aeuaH0TO4dJp1pClHk5MAcSqQ4DqwSDerO8q/3zQ0nuPUZ5ZbL6A53Fw4kBm1z9K078YoKzmYZrbbCXoyTxUj6Zbm+XcfemJLxgkyXFDnuv0UGySSs2twQE5liZ26IOYUeCGUZeuludWHRzXFygHo4ybMvGle7h8K2eZ+RjmuveyX+S2K+/eUZKiLRsJdveaOgnEV0lldc3Ossfrug0c5i9uiuXzXmcTXCyX3RvdjCkYtkutylGUCRWWxOC9bYROZAVd5WmnkJghHoYEXCp0ITInW426Sv1RKmjjCERBJwJnHeINN+/ndyKn/FgUTf7G2SrzkZrG7P1pf33ag2cXHi/GPMTD1oy3K+xWcTRySWhF6uYHqOzgzA3NWJutjshCwWTEeEOVUiMsVywNdEYRetBMTM2pAyFx2MhROs5BA6874uBDiVYiiIAuYZDoELBheSRjDRHMNa7VM2Iu5aaA6o1eHdAIkAowyCiwerUru97gGT/1vKIKo+o8lmiyhaM/Bb7Oczszd17vMXePD/Tz+c/mrBx7RWvCtyOleiRMzxeslMynXsjnDab4aS8efLjRvHxmP/FMUhoqRzPThqLg4Q/p2ac67tteV5VZsLz9udMmHusaBVAenbSnKyzZzi0yaL53Oj9PcAybP9Y5uj5Haqf9SQd0me3to/wYFYa/x75zQyPAjnipc3hpZ7fCY8g6bFIAkISomUoEIAhaENlc2x89fSe0pQLIFZZKqWTwMMWIZ3lIbFIGxABUwGC4iEn1pF1SDaNwCkeKAdaoUXtQPBxgnLlCBy3Aoo8AUehADToQOJaBKVENJ4mOi/gACjTMlyLIPPKYbmIDAFDVUFa0UaCtXE4RgUGTAMBisY4Io2w9fi1XY1LO0AbzwLadx68Wp2nvsctw9p4rqgn1/lo2ArQnl6gi0f9003B2tlR1zDVVNfzYw5mtqR2EzCcnYAZFFkv/9bRxnYQdjonc8P/x1QyQJvDjeedmmDjppD0HDvbDznWq8a7vu4uwvGNW3J/1MvjS/+MztyCXIaxQWikJAGzTFlumMajIagzBO/TL0crcFBWgBytwAasAHdFtZrWwsMVh9y6SDXjqWEvtqUO/iDW6WPWLUXexaSaKq9Gg4r/GIc/LMv9vzYWAXuZlInTduk8urE82dQ1WKaqzjfK4z6eFqXYv4D8BchHgBflz+njMnxsn5wTMs95uQLH6Xid6wXTPsy9V3g+Lu7HckNZTUp+aSXu0YQI/MLIR+qpyBdc/aooGxOrvIullE5fYf4FMTmdmJr6+gfysP5h/YDn+F7VbeRoRDiw4scGRmhlw/rtenchx4knf1JoKnqXuC7suIah2kfRSe24qumg3llkwmnLnHKa01DoJYWyP9feTRrNCtvl3k1a4KmfENH+5udnz5D26cOnB5nAA6gBPcgCoXEd0yGVB7UT/WBW9NOqoHrp76SmbDC3xmaOqS2bhlPP6y0mMfpN55G4cw/MXnh8Vh0NnUGaOz3mV5MA2tZe/Xuazw9kZxt4VVM2hT3XhWCbHYRk1OvVz85m690W8bZK+nIjOjPNYO2Vi9nbe6s7WIq1dsrJ364G2uKCaE0rLl5mcX7T966jnTXim9XhaQHpTPXmdH1dWd/avbnVC5Kg22ej7N1bpdK/+TAobG/qrRw7hBnds14tjQS2AJGD+DbNP2rTw307tnWWtNiWFmbqPfR9hGvS3l59LtEHEcoYQqzz/rQAIsAJWY+hj270HhNhRzf6cDPET9+RDnkUSB4CJ1oHoYaiQqEgsXoeoiYa3Sbqe+6fcOmXmbDvAl9/iZ1a1S4dHf1N1/8+T1etKvS9X3786cOnk9c3Ouk2+2xwvn2PrQWL27di/8R0TomwWzyyVzT5eG/2kPI4T8qxfHalpWsVsm/r7VM77n+1N2msc4xrg2bnGevkRie48g85SCskDRhHamUIDPEgst6P2tyeXO67YXRVBjwIlaFUO+4E0wY4Z7Ak/fWzu4kHkG39uaInzQWEOy1CeLYFhIpFBGkoDePGUUIoZc3nP3bruEMEDFQUKAJcaYWasGOi/mn479vcvxsPyj7BXXvBa5IWhK6Co/b/xNrfNvzwpNS/Pq9VNJTFm/pMcbSPSMuUUs661d2Il91uhl09UeV1yn6XILk0qwb5dpSMhQe78bsfjS538DK5PYq80iChNNcq4NSYgJPQGS2bX4x71KCjBk01iBlwkikRAsiQUsXAHSvGW6e6d3ra65jqPtAzkE/fXV74n1DWcpc3d96uO6uTZRB7u8rYrY2St1DGN3qYz2jj0hNorU56FW9gmI0blF//B2OhSYYdZwAA");
- Log.logText("Bookmark applied from given state.");
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Bookmarks_EnterPresentation() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Enter bookmarks play mode
- try {
- await report.bookmarksManager.play(models.BookmarksPlayMode.Presentation);
- Log.logText("Bookmarks play mode is on, check the play bar at the bottom of the report.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Bookmarks_ExitPresentation() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Exit bookmarks play mode
- try {
- await report.bookmarksManager.play(models.BookmarksPlayMode.Off);
- Log.logText("Bookmarks play mode is off.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Visual_GetSlicer() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
-
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive;
- })[0];
-
- const visuals = await activePage.getVisuals();
-
- // Retrieve the target visual.
- var slicer = visuals.filter(function (visual) {
- return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90";
- })[0];
-
- // Get the slicer state which contains the slicer filter.
- const state = await slicer.getSlicerState();
- Log.log(state);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Visual_SetSlicer() {
- // Build the filter you want to use. For more information, See Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#advanced",
- target: {
- table: "Date",
- column: "Date"
- },
- filterType: 0,
- logicalOperator: "And",
- conditions: [
- {
- operator: "GreaterThanOrEqual",
- value: "2014-10-12T21:00:00.000Z"
- },
- {
- operator: "LessThan",
- value: "2014-11-28T22:00:00.000Z"
- }
- ]
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
-
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive;
- })[0];
-
- const visuals = await activePage.getVisuals();
-
- // Retrieve the target visual.
- var slicer = visuals.filter(function (visual) {
- return visual.type == "slicer" && visual.name == "4d55baaa5eddde4cdf90";
- })[0];
-
- // Set the slicer state which contains the slicer filters.
- await slicer.setSlicerState({ filters: [filter] });
- Log.logText("Date slicer was set.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Visual_SetFilters() {
- // Build the filter you want to use. For more information, See Constructing
- // Filters in https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters.
- const filter = {
- $schema: "http://powerbi.com/product/schema#advanced",
- target: {
- table: "SalesFact",
- measure: "Total Category Volume"
- },
- filterType: 0,
- logicalOperator: "And",
- conditions: [
- {
- operator: "LessThan",
- value: 500
- }
- ]
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
-
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- const visuals = await activePage.getVisuals();
-
- // Retrieve the target visual.
- var visual = visuals.filter(function (visual) {
- return visual.name == "VisualContainer4";
- })[0];
-
- // Set the filter for the visual.
- // Pay attention that setFilters receives an array.
- await visual.setFilters([filter]);
- Log.logText("Filter was set for \"Category Breakdown\" table.")
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Visual_GetFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
-
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- const visuals = await activePage.getVisuals();
-
- // Retrieve the target visual.
- var visual = visuals.filter(function (visual) {
- return visual.name == "VisualContainer4";
- })[0];
-
- const filters = await visual.getFilters();
- Log.log(filters);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Visual_RemoveFilters() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
-
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- const visuals = await activePage.getVisuals();
-
- // Retrieve the target visual.
- var visual = visuals.filter(function (visual) {
- return visual.name == "VisualContainer4";
- })[0];
-
- await visual.removeFilters();
- Log.logText("\"Sentiment by Year and Months\" visual filters were removed.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Visual_ExportData_Summarized() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
-
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- const visuals = await activePage.getVisuals();
-
- // Retrieve the target visual.
- var visual = visuals.filter(function (visual) {
- return visual.name == "VisualContainer4";
- })[0];
-
- const result = await visual.exportData(models.ExportDataType.Summarized);
- Log.logCsv(result.data);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Visual_ExportData_Underlying() {
- // Get models. models contains enums that can be used.
- var models = window['powerbi-client'].models;
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Retrieve the page collection and get the visuals for the first page.
- try {
- const pages = await report.getPages();
-
- // Retrieve active page.
- var activePage = pages.filter(function (page) {
- return page.isActive
- })[0];
-
- const visuals = await activePage.getVisuals();
-
- // Retrieve the target visual.
- var visual = visuals.filter(function (visual) {
- return visual.name == "VisualContainer4";
- })[0];
-
- // Exports visual data
- const result = await visual.exportData(models.ExportDataType.Underlying);
- Log.logCsv(result.data);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _ReportVisual_UpdateSettings() {
- // The new settings that you want to apply to the report.
- const newSettings = {
- panes: {
- filters: {
- visible: true
- }
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- visual = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await visual.updateSettings(newSettings);
- Log.logText("Filter pane was added.");
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _ReportVisual_HideSingleVisualHeader() {
-
- // Define settings to hide the header of a single visual
- var newSettings = {
- visualSettings: {
- visualHeaders: [
- {
- settings: {
- visible: true
- }
- // No selector - Show visual header for all the visuals in the report
- },
- {
- settings: {
- visible: false
- },
- selector: {
- $schema: "http://powerbi.com/product/schema#visualSelector",
- visualName: "47eb6c0240defd498d4b"
- // The visual name can be retrieved using getVisuals()
- // Hide visual header for a single visual only
- }
- }
- ]
- }
- };
-
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- visual = powerbi.get(embedContainer);
-
- // Update the settings by passing in the new settings you have configured.
- try {
- await visual.updateSettings(newSettings);
- Log.logText("Visual header was successfully hidden for 'Sentiment by Year and Months' visual.");
- }
- catch (error) {
- Log.log(error);
- }
-}
-
-async function _Report_Authoring_Create() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
-
- // Creating new visual
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization
- const response = await page.createVisual('clusteredColumnChart');
-
- let visual = response.visual;
-
- // Defining data fields
- const regionColumn = { column: 'Region', table: 'Geo', schema: 'http://powerbi.com/product/schema#column' };
- const totalUnitsMeasure = { measure: 'Total Units', table: 'SalesFact', schema: 'http://powerbi.com/product/schema#measure' };
- const totalVanArsdelUnitsMeasure = { measure: 'Total VanArsdel Units', table: 'SalesFact', schema: 'http://powerbi.com/product/schema#measure' };
-
- // Setting visual data fields
- visual.addDataField('Category', regionColumn);
- visual.addDataField('Y', totalUnitsMeasure);
- visual.addDataField('Y', totalVanArsdelUnitsMeasure);
-
- // Personalizing the visual
- visual.setProperty({ objectName: "title", propertyName: "textSize" }, { schema: 'http://powerbi.com/product/schema#property', value: 8 });
- visual.setProperty({ objectName: "title", propertyName: "fontColor" }, { schema: 'http://powerbi.com/product/schema#property', value: '#000000' });
-
- // Visit: https://github.com/microsoft/powerbi-report-authoring/wiki for full documentation
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_ChangeType() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
-
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization
- await visual.changeType('waterfallChart');
- Log.logText("Last visual type was changed.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_Remove() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
-
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Visualization
- await page.deleteVisual(visual.name);
- Log.logText("Last visual was deleted.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_Capabilities() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
-
- // Getting visual capabilities
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding
- const capabilities = await visual.getCapabilities();
- Log.logText("Visual capabilities:");
- Log.log(capabilities);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_AddDataField() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
-
- // Getting 'Y' role data fields
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding
- const dataFields = await visual.getDataFields('Y');
-
- // Removing the second data field of 'Y' role, in order to add Legend/Breakdown
- if (dataFields.length > 1)
- visual.removeDataField('Y', 1);
-
- // Adding Legend/Breakdown data role
- if (visual.type === 'clusteredColumnChart') {
- const quarterColumn = { column: 'Quarter', table: 'Date', schema: 'http://powerbi.com/product/schema#column' };
- await visual.addDataField('Series', quarterColumn);
- Log.logText("Data field was added to last visual.");
- }
- else {
- const categoryColumn = { column: 'Category', table: 'Product', schema: 'http://powerbi.com/product/schema#column' };
- await visual.addDataField('Breakdown', categoryColumn);
- Log.logText("Data field was added to last visual.");
- }
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_RemoveDataField() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
-
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
- let dataRole = visual.type === 'clusteredColumnChart' ? 'Series' : 'Breakdown';
-
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding
- const dataFields = await visual.getDataFields(dataRole);
-
- // Removing Legend/Breakdown data field
- if (dataFields.length > 0) {
- await visual.removeDataField(dataRole, 0);
- Log.logText("Data field was removed from last visual.");
- }
- else {
- Log.log("Please add additional data field first.");
- }
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_GetDataField() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
-
- // Getting 'Y' role data fields
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Data-binding
- const dataFields = await visual.getDataFields('Y');
- Log.logText("Visual 'Y' fields:");
- Log.log(dataFields);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_GetProperty() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
-
- // Get legend position property
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties
- const property = await visual.getProperty({ objectName: "legend", propertyName: "position" });
- Log.logText("Last visual - legend position property:");
- Log.log(property);
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_SetProperty() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
-
- // Set legend position to bottom center
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties
- await visual.setProperty({ objectName: "legend", propertyName: "position" }, { schema: 'http://powerbi.com/product/schema#property', value: 'BottomCenter' });
- Log.logText("Last visual legend position was set to bottom center.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
-
-async function _Report_Authoring_ResetProperty() {
- // Get a reference to the embedded report HTML element
- var embedContainer = $('#embedContainer')[0];
-
- // Get a reference to the embedded report.
- report = powerbi.get(embedContainer);
-
- // Util function - setting authoring page as active
- // For implementation please check 'Navigation > Page - Set active' code sample.
- try {
- const page = await SetAuthoringPageActive(report);
- const visuals = await page.getVisuals();
- if (visuals.length < 1) {
- Log.logText("No visuals on authoring page. Please run 'Create visual and personalize' first.");
- return;
- }
-
- // Getting the last visual that was added
- let visual = visuals[visuals.length - 1];
-
- // Reset visual legend position
- // Documentation link: https://github.com/microsoft/powerbi-report-authoring/wiki/Properties
- await visual.resetProperty({ objectName: "legend", propertyName: "position" });
- Log.logText("Last visual legend position property was reset to default value.");
- }
- catch (errors) {
- Log.log(errors);
- }
-}
diff --git a/demo/v2-demo/scripts/function_mapping.js b/demo/v2-demo/scripts/function_mapping.js
deleted file mode 100644
index c7dec2d4..00000000
--- a/demo/v2-demo/scripts/function_mapping.js
+++ /dev/null
@@ -1,86 +0,0 @@
-const mockDict = {
- _Report_GetPages: datasetNotSupported,
- _Report_SetPage: datasetNotSupported,
- _Report_SetFilters: datasetNotSupported,
- _Report_GetFilters: datasetNotSupported,
- _Report_RemoveFilters: datasetNotSupported,
- _Report_PrintCurrentReport: datasetNotSupported,
- _Report_UpdateSettings: datasetNotSupported,
- _Report_Reload: datasetNotSupported,
- _Page_SetActive: datasetNotSupported,
- _Page_SetFilters: datasetNotSupported,
- _Page_GetFilters: datasetNotSupported,
- _Page_RemoveFilters: datasetNotSupported,
- _Page_GetVisuals: datasetNotSupported,
- _Report_switchModeEdit: datasetNotSupported,
- _Report_switchModeView: datasetNotSupported,
- _Embed_BasicEmbed: _Mock_Embed_BasicEmbed_ViewMode,
- _Embed_BasicEmbed_EditMode: _Mock_Embed_BasicEmbed_EditMode,
- _Report_save: _Mock_Report_save,
- _Report_saveAs: _Mock_Report_save,
- _Embed_Create: _Mock_Embed_Create
-};
-
-function datasetNotSupported() {
- Log.logText('Operation not supported for dataset')
-}
-
-function IsSaveMock(funcName) {
- const sampleId = GetSession(SessionKeys.SampleId);
- const isSample = sampleId && (_session.embedId === sampleId);
- return ((funcName === '_Report_save' || funcName === '_Report_saveAs') && isSample);
-}
-
-function IsBasicMock(funcName) {
- const sampleId = GetSession(SessionKeys.SampleId);
- const isSample = sampleId && (_session.embedId === sampleId);
- return ((funcName === '_Embed_BasicEmbed' || funcName === '_Embed_BasicEmbed_EditMode') && isSample);
-}
-
-function IsCreateMock(funcName) {
- const sampleId = GetSession(SessionKeys.SampleId);
- const isSample = sampleId && (_session.embedId === sampleId);
- return (funcName === '_Embed_Create' && isSample);
-}
-
-function IsNotSupported(funcName) {
- if (powerbi.embeds.length === 0) {
- return false
- }
-
- const notReportMatch = funcName.match(/Dashboard|Tile|Qna|Visual|Mobile|PaginatedReport/);
- if (notReportMatch) {
- return false;
- }
-
- // Get a reference to the embedded element
- const container = '#embedContainer';
- let embed = powerbi.get($(container)[0]);
- if (embed.config.type !== 'create') {
- return false;
- }
-
- const runFunc = mockDict[funcName];
- return (runFunc && runFunc === datasetNotSupported) ? true : false;
-}
-
-function IsMock(funcName) {
- return (IsBasicMock(funcName) || IsSaveMock(funcName) || IsCreateMock(funcName) || IsNotSupported(funcName));
-}
-
-function mapFunc(func) {
- const funcName = getFuncName(func);
- return IsMock(funcName) ? mockDict[funcName] : func;
-}
-
-function getFuncName(func) {
- let funcName = func.name;
-
- if (!funcName)
- {
- // in IE, func.name is invalid method. so, function name should be extracted manually.
- funcName = func.toString().match(/^function\s*([^\s(]+)/)[1];
- }
-
- return funcName;
-}
\ No newline at end of file
diff --git a/demo/v2-demo/scripts/guid.js b/demo/v2-demo/scripts/guid.js
deleted file mode 100644
index f259a200..00000000
--- a/demo/v2-demo/scripts/guid.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/**
- * Generates a 20 character uuid.
- */
-function generateNewGuid() {
- let d = new Date().getTime();
- if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
- d += performance.now();
- }
- return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
-
- // Generate a random number, scaled from 0 to 15.
- const r = (getRandomValue() % 16);
-
- // Shift 4 times to divide by 16
- d >>= 4;
- return r.toString(16);
- });
-}
\ No newline at end of file
diff --git a/demo/v2-demo/scripts/index.js b/demo/v2-demo/scripts/index.js
deleted file mode 100644
index 1e5b6543..00000000
--- a/demo/v2-demo/scripts/index.js
+++ /dev/null
@@ -1,91 +0,0 @@
-var sampleContentLoaded = false;
-var documentationContentLoaded = false;
-var showcasesContentLoaded = false;
-
-$(function() {
- OpenSampleSection();
- WarmStartSampleReportEmbed();
-});
-
-function OpenSampleSection() {
- OpenEmbedWorkspace("#main-sample", "step_samples.html");
-}
-
-function OpenEmbedWorkspace(activeTabSelector, samplesStepHtml)
-{
- if (!sampleContentLoaded)
- {
- // Open Report Sample.
- $("#sampleContent").load("sample.html", function() {
- $("#mainContent").load("report.html");
- sampleContentLoaded = true;
- });
- }
-
- $("#samples-step-wrapper").load(samplesStepHtml);
- SetActiveStyle(activeTabSelector);
-
- $(".content").hide();
- $("#sampleContent").show();
-
- LayoutShowcaseState.layoutReport = null;
- BookmarkShowcaseState.bookmarksReport = null;
-}
-
-function OpenDocumentationSection() {
- if (!documentationContentLoaded)
- {
- $("#documentationContent").load("docs.html");
- documentationContentLoaded = true;
- }
-
- SetActiveStyle("#main-docs");
-
- $(".content").hide();
- $("#documentationContent").show();
- trackEvent(TelemetryEventName.SectionOpen, { section: TelemetrySectionName.Documentation, src: TelemetryEventSource.UserClick });
-}
-
-function OpenShowcasesSection() {
- if (!showcasesContentLoaded)
- {
- $('#embedContainer').removeAttr('id');
- $("#showcasesContent").load("showcases.html");
- showcasesContentLoaded = true;
- }
-
- SetActiveStyle("#main-showcases");
-
- $(".content").hide();
- $("#showcasesContent").show();
- trackEvent(TelemetryEventName.SectionOpen, { section: TelemetrySectionName.Showcase, src: TelemetryEventSource.UserClick });
-}
-
-function SetActiveStyle(id)
-{
- $("#main-ul li").removeClass("main-li-active");
- $(id).addClass("main-li-active");
-}
-
-const ShowcasesHtmls = {
- CustomLayout: "./live_showcases/custom_layout/showcase_custom_layout.html",
- Bookmarks: "./live_showcases/bookmarks/showcase_bookmarks.html",
- Themes: "./live_showcases/themes/showcase_themes.html",
- InsightToAction: "./live_showcases/insight_to_action/showcase_insight_to_action.html",
- QuickVisualCreator: "./live_showcases/quick_visual_creator/showcase_quick_visual_creator.html",
-};
-
-function OpenShowcase(showcaseType) {
- $("#showcasesContent").load(ShowcasesHtmls[showcaseType]);
- showcasesContentLoaded = false;
- trackEvent(TelemetrySectionName.Showcase, { showcaseType: showcaseType, src: TelemetryEventSource.UserClick });
-}
-
-function OpenShowcaseFromURL(showcase) {
- $("#showcasesContent").load(ShowcasesHtmls[showcase]);
- SetActiveStyle("#main-showcases");
-
- $(".content").hide();
- $("#showcasesContent").show();
- trackEvent(TelemetrySectionName.Showcase, { showcaseType: showcase, src: TelemetryEventSource.Url });
-}
\ No newline at end of file
diff --git a/demo/v2-demo/scripts/logger.js b/demo/v2-demo/scripts/logger.js
deleted file mode 100644
index 2de78f09..00000000
--- a/demo/v2-demo/scripts/logger.js
+++ /dev/null
@@ -1,99 +0,0 @@
-function InitLogger(divId) {
-
- var Logger = {};
-
- // Normal character takes ~1.5 width more than a space ' '.
- Logger.spaceWidthCorrection = 1.3;
-
- Logger.log = function (event) {
- this.logText("Json Object\n" + JSON.stringify(event, null, " "));
- };
-
- Logger.logText = function (text) {
- let textbox = document.getElementById(divId);
-
- if (!textbox.value)
- {
- textbox.value = "";
- }
-
- textbox.value += "> " + text + "\n";
-
- textbox.scrollTop = textbox.scrollHeight;
- };
-
- Logger.logCsv = function (text) {
- let textbox = document.getElementById(divId);
-
- if (!textbox.value)
- {
- textbox.value = "";
- }
-
- let maxLength = 0;
- let lines = text.split("\r\n");
- let valuesPerLine = [];
-
- let log = "> CSV result in table view: \n\n";
- if (!lines || lines.length === 0) {
- log += "No data";
- }
- else {
- // Calcualte values per line, and calculate max length for pretty print.
- for (let i = 0; i < lines.length; ++i) {
- valuesPerLine[i] = lines[i].split(",");
- valuesPerLine[i].forEach(function (val) {
- if (val.length > maxLength) {
- maxLength = val.length;
- }
- });
- }
-
- // Add 2 spaces before and after.
- maxLength += 4;
-
- // Print title line
- var title = this.getLineText(valuesPerLine[0], maxLength);
- log += title + "\n";
- log += this.repeatChar("-", title.length) + "\n";
-
- // Print all lines
- for (let i = 1; i < lines.length; ++i) {
- log += this.getLineText(valuesPerLine[i], maxLength) + "\n"
- }
- }
-
- textbox.value += log;
- textbox.scrollTop = textbox.scrollHeight;
- };
-
- Logger.getLineText = function (values, spacesPerWord) {
- var text = "";
- _this = this;
- values.forEach(function (val) {
- text += _this.getCenteredText(val, spacesPerWord);
- });
- return text;
- };
-
- Logger.getCenteredText = function (value, spaces) {
- var text = "";
-
- let spacesBefore = (spaces - value.length) / 2;
- let spacesAfter = spaces - value.length - spacesBefore;
- text += this.repeatChar(" ", spacesBefore * this.spaceWidthCorrection);
- text += value;
- text += this.repeatChar(" ", spacesAfter * this.spaceWidthCorrection);
- return text;
- };
-
- Logger.repeatChar = function (char, times) {
- let text = "";
- for (let i = 0; i < times; ++i) {
- text += char;
- }
- return text;
- };
-
- return Logger;
-}
diff --git a/demo/v2-demo/scripts/report.js b/demo/v2-demo/scripts/report.js
deleted file mode 100644
index 6eb488a9..00000000
--- a/demo/v2-demo/scripts/report.js
+++ /dev/null
@@ -1,742 +0,0 @@
-const active_class = 'active';
-const active_steps_li = 'steps-li-active';
-const active_tabs_li = 'tabs-li-active';
-const active_mode = 'active-mode'
-
-const EmbedViewMode = "view";
-const EmbedEditMode = "edit";
-const EmbedCreateMode = "create";
-
-const runEmbedCodeTimeout = 500;
-const interactTooltipTimeout = 2000;
-
-const defaultTokenType = 1;
-const defaultQnaQuestion = "2014 total units YTD var % by month, manufacturer as clustered column chart";
-const defaultQnaMode = "Interactive";
-const interactiveNoQuestionMode = "InteractiveNoQuestion";
-
-function OpenSamplesStep() {
- $('#steps-ul a').removeClass(active_class);
- $('.'+ active_steps_li).removeClass(active_steps_li);
-
- $("#steps-samples a").addClass(active_class);
- $("#steps-samples a").addClass(active_steps_li);
-
- $('#interact-tab').removeClass('enableTransition');
- $('#interact-tab').removeClass('changeColor');
-
- // Hide Embed view in samples step.
- $("#samples-step-wrapper").show();
- $("#embed-and-interact-steps-wrapper").hide();
-
- $("#welcome-text").show();
-
- trackEvent(TelemetryEventName.InnerSectionOpen, { section: TelemetryInnerSection.Sample, src: TelemetryEventSource.UserClick });
-}
-
-function OpenCodeStepFromNavPane()
-{
- const mode = GetSession(SessionKeys.EmbedMode);
- const entityType = GetSession(SessionKeys.EntityType);
- const tokenType = GetSession(SessionKeys.TokenType);
-
- OpenCodeStep(mode, entityType, tokenType);
-}
-
-function OpenCodeStep(mode, entityType, tokenType) {
- $('#steps-ul a').removeClass(active_class);
- $('.' + active_steps_li).removeClass(active_steps_li);
-
- $('#steps-code a').addClass(active_class);
- $('#steps-code a').addClass(active_steps_li);
-
- // Hide Embed view in samples step.
- $("#samples-step-wrapper").hide();
- $("#embed-and-interact-steps-wrapper").show();
-
- $("#welcome-text").hide();
- $("#playground-banner").hide();
-
- $("#highlighter").empty();
-
- let containers = $(".iframeContainer");
- containers.removeClass(active_class);
-
- const containerID = getEmbedContainerID(entityType);
- const classPrefix = getEmbedContainerClassPrefix(entityType);
-
- $(classPrefix + 'Container').removeAttr('id');
- $(classPrefix + 'MobileContainer').removeAttr('id');
-
- // remove ID if exists on any container
- $("#" + containerID).removeAttr('id');
-
- const activeContainer = classPrefix + ($(".desktop-view").hasClass(active_class) ? 'Container' : 'MobileContainer');
-
- $(activeContainer).attr('id', containerID);
- $(activeContainer).addClass(active_class);
-
- $('.' + active_tabs_li).removeClass(active_tabs_li);
-
- $('#embed-tab').addClass(active_tabs_li);
- $('#interact-tab').removeClass(active_tabs_li);
-
- LoadEmbedSettings(mode, entityType, tokenType);
-
- trackEvent(TelemetryEventName.InnerSectionOpen, { section: TelemetryInnerSection.Code, src: TelemetryEventSource.UserClick });
-}
-
-function bootstrapIframe(entityType) {
- const activeContainer = getActiveEmbedContainer();
-
- // To avoid multiple bootstrap when switching between Desktop view and Phone view
- // and also when changing the mode (view/edit/create).
- if (activeContainer.children.length > 0) {
- // entity is already embedded
- return;
- }
-
- // Bootstrap iframe - for better performance.
- let embedUrl = GetSession(SessionKeys.EmbedUrl);
- config = {
- type: entityType.toLowerCase(),
- embedUrl: embedUrl
- };
-
- const isMobile = $(".mobile-view").hasClass(active_class);
- if (isMobile) {
- config.settings = {
- layoutType: models.LayoutType.MobilePortrait
- };
- }
-
- // Hide the container in order to hide the spinner.
- $(activeContainer).css({"visibility":"hidden"});
- powerbi.bootstrap(activeContainer, config);
-}
-
-function LoadEmbedSettings(mode, entityType, tokenType) {
- if (entityType == EntityType.Report)
- {
- $("#settings").load("settings_embed_report.html", function() {
- OpenEmbedMode(mode, entityType, tokenType);
- });
- }
- else if (entityType == EntityType.Visual)
- {
- $("#settings").load("settings_embed_visual.html", function() {
- OpenEmbedMode(mode, entityType, tokenType);
- });
- }
- else if (entityType == EntityType.Dashboard)
- {
- $("#settings").load("settings_embed_dashboard.html", function() {
- OpenEmbedMode(mode, entityType, tokenType);
- });
- }
- else if (entityType == EntityType.Tile)
- {
- $("#settings").load("settings_embed_tile.html", function() {
- OpenEmbedMode(mode, entityType, tokenType);
- });
- }
- else if (entityType == EntityType.Qna)
- {
- $("#settings").load("settings_embed_qna.html", function() {
- OpenEmbedMode(mode, entityType,tokenType);
- });
- }
- else if (entityType == EntityType.PaginatedReport)
- {
- $("#settings").load("settings_embed_paginatedreport.html", function() {
- OpenEmbedMode(mode, entityType,tokenType);
- });
- }
-}
-
-function OpenEmbedTab() {
- if ($('#embed-tab').hasClass(active_tabs_li)) {
- return;
- }
-
- $('.' + active_tabs_li).removeClass(active_tabs_li);
-
- $('#embed-tab').addClass(active_tabs_li);
-
- const mode = GetSession(SessionKeys.EmbedMode);
- const entityType = GetSession(SessionKeys.EntityType);
- const tokenType = GetSession(SessionKeys.TokenType);
-
- LoadEmbedSettings(mode, entityType, tokenType);
-}
-
-function isInteractStepEnabled(entityType) {
- const classPrefix = getEmbedContainerClassPrefix(entityType);
- const activeContainer = classPrefix + ($(".desktop-view").hasClass(active_class) ? 'Container' : 'MobileContainer');
-
- // Check if active container has an iframe
- return $(activeContainer + " iframe").length > 0;
-}
-
-function OpenInteractTab() {
- const entityType = GetSession(SessionKeys.EntityType);
- // Interact step is disabled unless active container has an iframe
- if (!isInteractStepEnabled(entityType)) {
- $('.interactTooltip .tooltipText').addClass("showTooltip");
- setTimeout(function() {
- $('.interactTooltip .tooltipText').removeClass("showTooltip");
- }, interactTooltipTimeout);
- return;
- }
- $('#interact-tab').removeClass('enableTransition');
- $('#interact-tab').removeClass('changeColor');
-
- $('.' + active_tabs_li).removeClass(active_tabs_li);
- $('#interact-tab').addClass(active_tabs_li);
-
- if (entityType == EntityType.Tile)
- {
- $("#settings").load("settings_interact_tile.html", function() {
- SetToggleHandler("operation-categories");
- LoadCodeArea("#embedCodeDiv", "");
- });
- }
- else if (entityType == EntityType.Dashboard)
- {
- $("#settings").load("settings_interact_dashboard.html", function() {
- SetToggleHandler("operation-categories");
- LoadCodeArea("#embedCodeDiv", "");
- hideFeaturesOnMobile();
- });
- }
- else if (entityType == EntityType.Qna)
- {
- $("#settings").load("settings_interact_qna.html", function() {
- const isResultOnlyMode = GetSession(SessionKeys.QnaMode) === "ResultOnly";
- // Hide set question on interactive mode
- $('#qna-operations').toggle(isResultOnlyMode);
- SetToggleHandler("operation-categories");
- LoadCodeArea("#embedCodeDiv", "");
- });
- }
- else if (entityType == EntityType.Visual)
- {
- $("#settings").load("settings_interact_visual.html", function() {
- SetToggleHandler("operation-categories");
- LoadCodeArea("#embedCodeDiv", "");
- });
- }
- else if (entityType == EntityType.PaginatedReport)
- {
- $("#settings").load("settings_interact_paginatedreport.html", function() {
- SetToggleHandler("operation-categories");
- LoadCodeArea("#embedCodeDiv", "");
- });
- }
- else
- {
- $("#settings").load("settings_interact_report.html", function() {
- SetToggleHandler("operation-categories");
- LoadCodeArea("#embedCodeDiv", "");
- $('.hideOnReportCreate').toggle(GetSession(SessionKeys.EmbedMode) !== EmbedCreateMode);
- hideFeaturesOnMobile();
- });
- }
-}
-
-function setCodeArea(mode, entityType)
-{
- LoadCodeArea("#embedCodeDiv", getEmbedCode(mode, entityType));
-}
-
-function getEmbedCode(mode, entityType)
-{
- const isDesktop = $(".desktop-view").hasClass(active_class);
- let code = "";
- if (entityType == EntityType.Report)
- {
- if (mode === EmbedViewMode)
- {
- code = isDesktop ? _Embed_BasicEmbed : _Embed_BasicEmbed_Mobile;
- }
- else if (mode === EmbedEditMode)
- {
- code = isDesktop ? _Embed_BasicEmbed_EditMode : _Embed_MobileEditNotSupported;
- }
- else if (mode === EmbedCreateMode)
- {
- code = isDesktop ? _Embed_Create : _Embed_MobileCreateNotSupported;
- }
- }
- else if (entityType == EntityType.Visual) {
- code = _Embed_VisualEmbed;
- }
- else if (entityType == EntityType.Dashboard)
- {
- code = isDesktop ? _Embed_DashboardEmbed : _Embed_DashboardEmbed_Mobile;
- }
- else if (entityType == EntityType.Tile)
- {
- code = _Embed_TileEmbed;
- }
- else if (entityType == EntityType.Qna)
- {
- code = GetParameterByName(SessionKeys.TokenType) === '0' /* AAD Token */ ? _Embed_QnaEmbed_Aad : _Embed_QnaEmbed;
- }
- else if (entityType == EntityType.PaginatedReport)
- {
- code = _Embed_PaginatedReportBasicEmbed
- }
- return code;
-}
-
-function showEmbedSettings(mode, entityType, tokenType)
-{
- if (entityType == EntityType.Report)
- {
- let inputDivToShow = "#embedModeInput";
- let inputDivToHide = "#createModeInput";
-
- if (mode === EmbedCreateMode)
- {
- inputDivToShow = "#createModeInput";
- inputDivToHide = "#embedModeInput";
- }
-
- $(inputDivToShow).show();
- $(inputDivToHide).hide();
-
- let embedModeRadios = $('input:radio[name=embedMode]');
- embedModeRadios.filter('[value=' + mode + ']').prop('checked', true);
-
- let embedTypeRadios = $('input:radio[name=tokenType]');
- embedTypeRadios.filter('[value=' + tokenType + ']').prop('checked', true);
- }
- else if (entityType == EntityType.Visual) {
- $("#embedModeInput").show();
- let embedTypeRadios = $('input:radio[name=tokenType]');
- embedTypeRadios.filter('[value=' + tokenType + ']').prop('checked', true);
- }
- else if (entityType == EntityType.Dashboard)
- {
- // Do nothing.
- }
-}
-
-function OpenEmbedMode(mode, entityType, tokenType)
-{
- if (entityType == EntityType.Report)
- {
- if (mode == EmbedCreateMode)
- {
- if (IsEmbeddingSampleReport())
- {
- LoadSampleDatasetIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtCreateAccessToken", "#txtCreateReportEmbed", "#txtEmbedDatasetId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- });
- }
- else
- {
- SetTextBoxesFromSessionOrUrlParam("#txtCreateAccessToken", "#txtCreateReportEmbed", "#txtEmbedDatasetId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- }
- }
- else
- {
- if (IsEmbeddingSampleReport())
- {
- LoadSampleReportIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- });
- }
- else
- {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- }
- }
- }
- else if (entityType == EntityType.Visual)
- {
- LoadSettings = function() {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- SetTextboxFromSessionOrUrlParam(SessionKeys.PageName, "#txtPageName");
- SetTextboxFromSessionOrUrlParam(SessionKeys.VisualName, "#txtVisualName");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- };
-
- if (IsEmbeddingSampleReport())
- {
- LoadSampleVisualIntoSession().then(function (response) {
- LoadSettings();
- });
- }
- else
- {
- LoadSettings();
- }
- }
- else if (entityType == EntityType.Dashboard)
- {
- if (IsEmbeddingSampleDashboard())
- {
- LoadSampleDashboardIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtDashboardEmbed", "#txtEmbedDashboardId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- });
- }
- else
- {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtDashboardEmbed", "#txtEmbedDashboardId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- }
- }
- else if (entityType == EntityType.Tile)
- {
- if (IsEmbeddingSampleTile())
- {
- LoadSampleTileIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtTileEmbed", "#txtEmbedTileId", "#txtEmbedDashboardId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- });
- }
- else
- {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtTileEmbed", "#txtEmbedTileId", "#txtEmbedDashboardId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- }
- }
- else if (entityType == EntityType.Qna)
- {
- LoadSettings = function() {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtQnaEmbed", "#txtDatasetId");
- SetTextboxFromSessionOrUrlParam(SessionKeys.QnaQuestion, "#txtQuestion");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- let qnaMode = GetParameterByName(SessionKeys.QnaMode);
- if (qnaMode) {
- let modesRadios = $('input:radio[name=qnaMode]');
- modesRadios.filter('[id=' + qnaMode + ']').prop('checked', true);
- qnaMode = qnaMode !== interactiveNoQuestionMode ? qnaMode : defaultQnaMode;
- SetSession(SessionKeys.QnaMode, qnaMode);
- }
- };
-
- if (IsEmbeddingSampleQna())
- {
- LoadSampleQnaIntoSession().then(function (response) {
- if (!GetSession(SessionKeys.QnaQuestion)) {
- SetSession(SessionKeys.QnaQuestion, defaultQnaQuestion);
- }
-
- LoadSettings();
- });
- }
- else
- {
- LoadSettings();
- }
- }
- else if (entityType == EntityType.PaginatedReport) {
- if (IsEmbeddingSamplePaginatedReport()) {
- LoadSamplePaginatedReportIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- });
- }
- else {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- setCodeAndShowEmbedSettings(mode, entityType, tokenType);
- }
- }
-}
-
-function setCodeAndShowEmbedSettings(mode, entityType, tokenType) {
- setCodeArea(mode, entityType);
- showEmbedSettings(mode, entityType, tokenType);
- bootstrapIframe(entityType);
-}
-
-function OpenViewMode() {
- SetSession(SessionKeys.EmbedMode, EmbedViewMode);
- OpenEmbedMode(EmbedViewMode, EntityType.Report);
-}
-
-function OpenEditMode() {
- SetSession(SessionKeys.EmbedMode, EmbedEditMode);
- OpenEmbedMode(EmbedEditMode, EntityType.Report);
-}
-
-function OpenCreateMode() {
- SetSession(SessionKeys.EmbedMode, EmbedCreateMode);
- OpenEmbedMode(EmbedCreateMode, EntityType.Report);
-}
-
-function IsEmbeddingSampleReport() {
- return GetSession(SessionKeys.IsSampleReport) == true;
-}
-
-function IsEmbeddingSampleDashboard() {
- return GetSession(SessionKeys.IsSampleDashboard) == true;
-}
-
-function IsEmbeddingSampleTile() {
- return GetSession(SessionKeys.IsSampleTile) == true;
-}
-
-function IsEmbeddingSampleQna() {
- return GetSession(SessionKeys.IsSampleQna) == true;
-}
-
-function IsEmbeddingSamplePaginatedReport() {
- return GetSession(SessionKeys.IsSamplePaginatedReport) == true;
-}
-
-function ToggleQuestionBox(enabled) {
- UpdateSession("input[name='qnaMode']:checked", SessionKeys.QnaMode);
- let txtQuestion = $("#txtQuestion");
- if (enabled === true) {
- let question = GetSession(SessionKeys.QnaQuestion);
- question = question ? question : defaultQnaQuestion;
- txtQuestion.val(question);
- txtQuestion.prop('disabled', false);
- }
- else {
- txtQuestion.val("");
- txtQuestion.prop('disabled', true);
- }
-}
-
-function OnTokenTypeRadioClicked(tokenType) {
- SetSession(SessionKeys.TokenType, tokenType);
- const entityType = GetSession(SessionKeys.EntityType);
-
- if (tokenType == 0 /* AAD Token */) {
- $('.inputLine input').each(function () {
- $(this).val("");
- let onChangeFunc = $(this).attr("onchange");
- if (onChangeFunc) {
- // Change 'this' to button's identifier
- onChangeFunc = onChangeFunc.replace("this", "'input#" + $(this).attr('id') + "'");
- eval(onChangeFunc);
- }
- });
-
- } else {
- // Moving to embed token will reload the sample
- ReloadSample(entityType);
- }
-}
-
-function ReloadSample(entityType) {
- const mode = GetSession(SessionKeys.EmbedMode);
- SetIsSample(true);
-
- if (entityType == EntityType.Report)
- {
- if (mode == EmbedCreateMode)
- {
- LoadSampleDatasetIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtCreateAccessToken", "#txtCreateReportEmbed", "#txtEmbedDatasetId");
- });
- }
- else
- {
- LoadSampleReportIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- });
- }
- }
- else if (entityType == EntityType.Visual)
- {
- LoadSampleVisualIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- SetTextboxFromSessionOrUrlParam(SessionKeys.PageName, "#txtPageName");
- SetTextboxFromSessionOrUrlParam(SessionKeys.VisualName, "#txtVisualName");
- });
- }
- else if (entityType == EntityType.Dashboard)
- {
- LoadSampleDashboardIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtDashboardEmbed", "#txtEmbedDashboardId");
- });
- }
- else if (entityType == EntityType.Tile)
- {
- LoadSampleTileIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtTileEmbed", "#txtEmbedTileId", "#txtEmbedDashboardId");
- });
- }
- else if (entityType == EntityType.Qna)
- {
- LoadSampleQnaIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtQnaEmbed", "#txtDatasetId");
- });
- }
- else if (entityType == EntityType.PaginatedReport)
- {
- LoadSamplePaginatedReportIntoSession().then(function (response) {
- SetTextBoxesFromSessionOrUrlParam("#txtAccessToken", "#txtReportEmbed", "#txtEmbedReportId");
- });
- }
-}
-
-function EmbedAreaDesktopView() {
- if ($(".desktop-view").hasClass(active_class)) {
- return;
- }
-
- $("#btnPhoneView").removeClass(active_mode);
- $("#btnDesktopView").addClass(active_mode);
-
- const entityType = GetSession(SessionKeys.EntityType);
- const mode = GetSession(SessionKeys.EmbedMode);
-
- $(".desktop-view").show();
- $(".mobile-view").hide();
-
- $(".desktop-view").addClass(active_class);
- $(".mobile-view").removeClass(active_class);
-
- const containerID = getEmbedContainerID(entityType);
- const classPrefix = getEmbedContainerClassPrefix(entityType);
-
- $(classPrefix + 'MobileContainer').removeAttr('id');
- $(classPrefix + 'Container').attr('id', containerID);
-
- $(classPrefix + 'MobileContainer').removeClass(active_class);
- $(classPrefix + 'Container').addClass(active_class);
-
- if($('#embed-tab').hasClass(active_tabs_li)) {
- // Update embed code area
- setCodeArea(mode, entityType);
- }
-
- $('.hideOnMobile').show();
-
- // Check if run button was clicked in the other mode and wasn't clicked on the new mode
- if ($(classPrefix + "MobileContainer iframe").length && !$(classPrefix + "Container iframe").length) {
- let runFunc = getEmbedCode(mode, entityType);
- if ($('#interact-tab').hasClass(active_tabs_li)) {
- runFunc = updateRunFuncSessionParameters(runFunc);
- eval(runFunc);
- } else {
- runFunc();
- }
- }
- trackEvent(TelemetryEventName.DesktopModeOpen, {});
-}
-
-function EmbedAreaMobileView() {
- if ($(".mobile-view").hasClass(active_class)) {
- return;
- }
-
- $("#btnDesktopView").removeClass(active_mode);
- $("#btnPhoneView").addClass(active_mode);
-
- const entityType = GetSession(SessionKeys.EntityType);
- const mode = GetSession(SessionKeys.EmbedMode);
-
- $(".desktop-view").hide();
- $(".mobile-view").show();
-
- $(".desktop-view").removeClass(active_class);
- $(".mobile-view").addClass(active_class);
-
- const containerID = getEmbedContainerID(entityType);
- const classPrefix = getEmbedContainerClassPrefix(entityType);
-
- $(classPrefix + 'Container').removeAttr('id');
- $(classPrefix + 'MobileContainer').attr('id', containerID);
-
- $(classPrefix + 'Container').removeClass(active_class);
- $(classPrefix + 'MobileContainer').addClass(active_class);
-
- if($('#embed-tab').hasClass(active_tabs_li)) {
- // Update embed code area
- setCodeArea(mode, entityType);
- }
-
- $('.hideOnMobile').hide();
-
- // Remove active class and code if the feature should be hidden on mobile view
- if ($('#interact-tab').hasClass(active_tabs_li)) {
- let activeHideOnMobile = $('.function-ul .hideOnMobile.active');
- if (activeHideOnMobile.length) {
- activeHideOnMobile.removeClass(active_class);
- LoadCodeArea("#embedCodeDiv", "");
- }
- }
-
- // Check if run button was clicked in the other mode and wasn't clicked on the new mode
- if ($(classPrefix + "Container iframe").length && !$(classPrefix + "MobileContainer iframe").length) {
- // It's not enough to check the number of iframes because of the bootstrap feature.
- if (GetSession(SessionKeys.EntityIsAlreadyEmbedded)) {
- let runFunc = getEmbedCode(mode, entityType);
- if ($('#interact-tab').hasClass(active_tabs_li)) {
- runFunc = updateRunFuncSessionParameters(runFunc);
- eval(runFunc);
- } else {
- runFunc();
- }
- }
- }
- trackEvent(TelemetryEventName.MobileModeOpen, {});
-}
-
-function updateRunFuncSessionParameters(runFunc) {
- const entityType = GetSession(SessionKeys.EntityType);
- const accessToken = '"' + GetSession(SessionKeys.AccessToken) + '"';
- const embedUrl = '"' + GetSession(SessionKeys.EmbedUrl) + '"';
- const embedId = '"' + GetSession(SessionKeys.EmbedId) + '"';
- const dashboardId = '"' + GetSession(SessionKeys.DashboardId) + '"';
- const pageName = '"' + GetSession(SessionKeys.PageName) + '"';
- const visualName = '"' + GetSession(SessionKeys.VisualName) + '"';
-
- let code = BodyCodeOfFunction(runFunc);
- let tokenType = GetSession(SessionKeys.TokenType);
- tokenType = (tokenType != undefined)? tokenType : defaultTokenType;
- code = code.replace("$('#txtAccessToken').val()", accessToken)
- .replace("$('input:radio[name=tokenType]:checked').val()", tokenType);
-
- if (entityType == EntityType.Report) {
- code = code.replace("$('#txtReportEmbed').val()", embedUrl)
- .replace("$('#txtEmbedReportId').val()", embedId);
- } else if (entityType == EntityType.Dashboard) {
- code = code.replace("$('#txtDashboardEmbed').val()", embedUrl)
- .replace("$('#txtEmbedDashboardId').val()", embedId);
- } else if (entityType == EntityType.Tile) {
- code = code.replace("$('#txtTileEmbed').val()", embedUrl)
- .replace("$('#txtEmbedDashboardId').val()", dashboardId)
- .replace("$('#txtEmbedTileId').val()", embedId);
- } else if (entityType == EntityType.Visual) {
- code = code.replace("$('#txtReportEmbed').val()", embedUrl)
- .replace("$('#txtEmbedReportId').val()", embedId)
- .replace("$('#txtPageName').val()", pageName)
- .replace("$('#txtVisualName').val()", visualName);
- } else if (entityType == EntityType.Qna) {
- let question = GetSession(SessionKeys.QnaQuestion);
- question = question? question : defaultQnaQuestion;
- let mode = GetSession(SessionKeys.QnaMode);
- mode = mode? mode : defaultQnaMode;
- code = code.replace("$('#txtQnaEmbed').val()", embedUrl)
- .replace("$('#txtDatasetId').val()", embedId)
- .replace("$('#txtQuestion').val()", '"' + question + '"')
- .replace('$("input[name=' + "'qnaMode'" + ']:checked").val()', '"' + mode + '"');
- }
-
- return code;
-}
-
-function hideFeaturesOnMobile(){
- if ($(".mobile-view").hasClass(active_class))
- $('.hideOnMobile').hide();
-}
-
-function onShowcaseTryMeClicked(showcase) {
- let showcaseUrl = location.href.substring(0, location.href.lastIndexOf("/")) + '?showcase=' + showcase;
- trackEvent(TelemetrySectionName.Showcase, { showcaseType: showcase, src: TelemetryEventSource.Interact });
- window.open(showcaseUrl, '_blank');
-}
diff --git a/demo/v2-demo/scripts/session_utils.js b/demo/v2-demo/scripts/session_utils.js
deleted file mode 100644
index 43dbfcb2..00000000
--- a/demo/v2-demo/scripts/session_utils.js
+++ /dev/null
@@ -1,344 +0,0 @@
-const reportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/SampleReport';
-const datasetUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/SampleCreate';
-const dashboardUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Dashboards/SampleDashboard';
-const tileUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Tiles/SampleTile';
-const qnaUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Datasets/SampleQna';
-const paginatedReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/SampleRdlReport';
-const layoutShowcaseReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/LayoutDemoReport';
-const insightToActionShowcaseReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/InsightToActionReport';
-const themesShowcaseReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/ThemesReport';
-const quickVisualCreatorShowcaseReportUrl = 'https://playgroundbe-bck-1.azurewebsites.net/Reports/EmptyReport';
-
-var LastReportSampleUrl = null;
-var ReportRefreshTokenTimer = 0;
-var DashboardRefreshTokenTimer = 0;
-var TileRefreshTokenTimer = 0;
-var QnaRefreshTokenTimer = 0;
-
-const EntityType = {
- Report : "Report",
- Visual : "Visual",
- Dashboard : "Dashboard",
- Tile : "Tile",
- Qna: "Qna",
- PaginatedReport: "PaginatedReport"
-};
-
-const SessionKeys = {
- AccessToken : "accessToken",
- DashboardId : "dashboardId",
- EmbedUrl : "embedUrl",
- EmbedId : "embedId",
- EmbedMode: "embedMode",
- EntityType: "entityType",
- GroupId : "groupId",
- IsSampleReport: "isSampleReport",
- IsSampleDashboard: "IsSampleDashboard",
- IsSampleTile: "IsSampleTile",
- IsSampleQna: "IsSampleQna",
- IsSamplePaginatedReport: "IsSamplePaginatedReport",
- IsTelemetryEnabled: "isTelemetryEnabled",
- PageName: "PageName",
- QnaQuestion: "QnaQuestion",
- QnaMode: "QnaMode",
- SampleId: "SampleId",
- SessionId: "SessionId",
- TokenType: "tokenType",
- VisualName: "VisualName"
-};
-
-var _session = {};
-
-function initSession() {
- SetSession(SessionKeys.SessionId, generateNewGuid());
- if (GetParameterByName(SessionKeys.IsTelemetryEnabled) === "false") {
- SetSession(SessionKeys.IsTelemetryEnabled, false);
- } else {
- SetSession(SessionKeys.IsTelemetryEnabled, true);
- }
-}
-
-function GetParameterByName(name, url) {
- if (!url) {
- url = window.location.href;
- }
-
- name = name.replace(/[\[\]]/g, "\\$&");
- let regex = new RegExp("[?&]" + name + "(=([^]*)|&|#|$)"),
- results = regex.exec(url);
- if (!results) return null;
- if (!results[2]) return '';
- return decodeURIComponent(results[2].replace(/\+/g, " "));
-}
-
-function SetSession(key, value) {
- // This is a temporal solution for session (which is cleared on reload). Should be replaced with a real session.
- _session[key] = value;
-}
-
-function GetSession(key) {
- // This is a temporal solution for session (which is cleared on reload). Should be replaced with a real session.
- return _session[key];
-}
-
-function UpdateSession(button, sessionKey) {
- const value = $(button).val();
- if (value || value === "")
- {
- SetSession(sessionKey, value);
- SetIsSample(false);
- }
-}
-
-function SetIsSample(value) {
- const entityType = GetSession(SessionKeys.EntityType);
-
- if (entityType == EntityType.Report)
- {
- SetSession(SessionKeys.IsSampleReport, value);
- }
- else if (entityType == EntityType.Visual)
- {
- SetSession(SessionKeys.IsSampleReport, value);
- }
- else if (entityType == EntityType.Dashboard)
- {
- SetSession(SessionKeys.IsSampleDashboard, value);
- }
- else if (entityType == EntityType.Tile)
- {
- SetSession(SessionKeys.IsSampleTile, value);
- }
- else if (entityType == EntityType.Qna)
- {
- SetSession(SessionKeys.IsSampleQna, value);
- }
- else if (entityType == EntityType.PaginatedReport)
- {
- SetSession(SessionKeys.IsSamplePaginatedReport, value);
- }
-}
-
-function SetTextboxFromSessionOrUrlParam(sessionKey, textboxSelector) {
- let value = GetParameterByName(sessionKey);
- if (!value)
- {
- value = GetSession(sessionKey);
- } else {
- SetSession(sessionKey, value);
- }
- $(textboxSelector).val(value);
-}
-
-function SetTextBoxesFromSessionOrUrlParam(accessTokenSelector, embedUrlSelector, embedIdSelector, dashboardIdSelector) {
- let accessToken = GetParameterByName(SessionKeys.AccessToken);
- if (!accessToken)
- {
- accessToken = GetSession(SessionKeys.AccessToken);
- } else {
- SetSession(SessionKeys.AccessToken, accessToken);
- }
-
- let embedUrl = GetParameterByName(SessionKeys.EmbedUrl);
- if (!embedUrl)
- {
- embedUrl = GetSession(SessionKeys.EmbedUrl);
- } else {
- let groupId = GetParameterByName(SessionKeys.GroupId);
- if (groupId)
- {
- if (embedUrl.indexOf("?") != -1)
- {
- embedUrl += "&groupId=" + groupId;
- } else {
- embedUrl += "?groupId=" + groupId;
- }
- }
- SetSession(SessionKeys.EmbedUrl, embedUrl);
- }
-
- let embedId = GetParameterByName(SessionKeys.EmbedId);
- if (!embedId)
- {
- embedId = GetSession(SessionKeys.EmbedId);
- } else {
- SetSession(SessionKeys.EmbedId, embedId);
- }
-
- let tokenType = GetParameterByName(SessionKeys.TokenType);
- if (!tokenType)
- {
- tokenType = GetSession(SessionKeys.TokenType);
- } else {
- SetSession(SessionKeys.TokenType, tokenType);
- }
-
- let dashboardId = GetParameterByName(SessionKeys.DashboardId);
- if (!dashboardId) {
- dashboardId = GetSession(SessionKeys.DashboardId);
- } else {
- SetSession(SessionKeys.DashboardId, dashboardId);
- }
-
- $(accessTokenSelector).val(accessToken);
- $(embedUrlSelector).val(embedUrl);
- $(embedIdSelector).val(embedId);
- $(dashboardIdSelector).val(dashboardId);
-
- //
- // Set the embed type (Saas or Embed token)
- //
- let embedTypeRadios = $('input:radio[name=tokenType]');
- embedTypeRadios.filter('[value=' + tokenType + ']').prop('checked', true);
-}
-
-function FetchUrlIntoSession(url, updateCurrentToken) {
- return $.getJSON(url, function (embedConfig) {
- setSession(embedConfig.EmbedToken.Token, embedConfig.EmbedUrl, embedConfig.Id, embedConfig.DashboardId);
- SetSession(SessionKeys.SampleId, embedConfig.Id);
-
- if (updateCurrentToken)
- {
- let embedContainerId = getEmbedContainerID(capitalizeFirstLetter(embedConfig.Type));
-
- let embedContainer = powerbi.embeds.filter(function(embedElement) { return embedElement.element.id === embedContainerId; })[0];
- if (embedContainer)
- {
- embedContainer.setAccessToken(embedConfig.EmbedToken.Token);
- }
- }
-
- if (embedConfig.Type === "report" || embedConfig.Type === "visual")
- {
- // Set single visual embed sample details.
- SetSession(SessionKeys.PageName, "ReportSectioneb8c865100f8508cc533");
- SetSession(SessionKeys.VisualName, "47eb6c0240defd498d4b");
-
- LastReportSampleUrl = url;
- }
-
- TokenExpirationRefreshListener(embedConfig.MinutesToExpiration, capitalizeFirstLetter(embedConfig.Type));
- });
-}
-
-function capitalizeFirstLetter(string) {
- return string.charAt(0).toUpperCase() + string.slice(1);
-}
-
-function TokenExpirationRefreshListener(minutesToExpiration, entityType) {
- const updateAfterMilliSeconds = (minutesToExpiration - 2) * 60 * 1000;
-
- if (entityType == EntityType.Report || entityType == EntityType.Visual) {
- setTokenRefreshListener(updateAfterMilliSeconds, ReportRefreshTokenTimer, LastReportSampleUrl, entityType);
- } else if (entityType == EntityType.Dashboard) {
- setTokenRefreshListener(updateAfterMilliSeconds, DashboardRefreshTokenTimer, dashboardUrl, entityType);
- } else if (entityType == EntityType.Qna) {
- setTokenRefreshListener(updateAfterMilliSeconds, QnaRefreshTokenTimer, qnaUrl, entityType);
- } else {
- setTokenRefreshListener(updateAfterMilliSeconds, TileRefreshTokenTimer, tileUrl, entityType);
- }
-}
-
-function setTokenRefreshListener(updateAfterMilliSeconds, RefreshTokenTimer, url, entityType) {
- if (RefreshTokenTimer)
- {
- console.log("step current " + entityType + " Embed Token update threads.");
- clearTimeout(RefreshTokenTimer);
- }
-
- console.log(entityType + " Embed Token will be updated in " + updateAfterMilliSeconds + " milliseconds.");
- RefreshTokenTimer = setTimeout(function() {
- if (url)
- {
- FetchUrlIntoSession(url, true /* updateCurrentToken */);
- }
- }, updateAfterMilliSeconds);
-}
-
-function LoadSampleReportIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Report);
- return FetchUrlIntoSession(reportUrl, false /* updateCurrentToken */);
-}
-
-function LoadSampleVisualIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Visual);
- return FetchUrlIntoSession(reportUrl, false /* updateCurrentToken */);
-}
-
-function LoadSampleDatasetIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Report);
- return FetchUrlIntoSession(datasetUrl, false /* updateCurrentToken */);
-}
-
-function LoadSampleDashboardIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Dashboard);
- return FetchUrlIntoSession(dashboardUrl, false /* updateCurrentToken */);
-}
-
-function LoadSampleTileIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Tile);
- return FetchUrlIntoSession(tileUrl, false /* updateCurrentToken */);
-}
-
-function LoadSampleQnaIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Qna);
- return FetchUrlIntoSession(qnaUrl, false /* updateCurrentToken */);
-}
-
-function LoadSamplePaginatedReportIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.PaginatedReport);
- return FetchUrlIntoSession(paginatedReportUrl, false /* updateCurrentToken */);
-}
-
-function LoadLayoutShowcaseReportIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Report);
- return FetchUrlIntoSession(layoutShowcaseReportUrl, false /* updateCurrentToken */);
-}
-
-function LoadInsightToActionShowcaseReportIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Report);
- return FetchUrlIntoSession(insightToActionShowcaseReportUrl, false /* updateCurrentToken */);
-}
-
-function LoadThemesShowcaseReportIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Report);
- return FetchUrlIntoSession(themesShowcaseReportUrl, false /* updateCurrentToken */);
-}
-
-function LoadQuickVisualCreatorShowcaseReportIntoSession() {
- SetSession(SessionKeys.EntityType, EntityType.Report);
- return FetchUrlIntoSession(quickVisualCreatorShowcaseReportUrl, false /* updateCurrentToken */);
-}
-
-function WarmStartSampleReportEmbed() {
- let embedUrl = GetParameterByName(SessionKeys.EmbedUrl);
- if (embedUrl) {
- preload(embedUrl);
- return;
- }
-
- FetchUrlIntoSession(reportUrl, false /* updateCurrentToken */).then(function (response) {
- embedUrl = GetSession(SessionKeys.EmbedUrl);
- preload(embedUrl);
- });
-}
-
-function preload(embedUrl) {
- const config = {
- type: 'report',
- embedUrl: embedUrl
- };
-
- // Preload sample report
- powerbi.preload(config);
-}
-
-function setSession(accessToken, embedUrl, embedId, dashboardId)
-{
- SetSession(SessionKeys.AccessToken, accessToken);
- SetSession(SessionKeys.EmbedUrl, embedUrl);
- SetSession(SessionKeys.EmbedId, embedId);
- SetSession(SessionKeys.DashboardId, dashboardId);
-}
-
-initSession();
\ No newline at end of file
diff --git a/demo/v2-demo/scripts/step_embed.js b/demo/v2-demo/scripts/step_embed.js
deleted file mode 100644
index 48990476..00000000
--- a/demo/v2-demo/scripts/step_embed.js
+++ /dev/null
@@ -1,363 +0,0 @@
-// ---- Report Operations ----------------------------------------------------
-function Report_GetId() {
- SetCode(_Report_GetId);
-}
-
-function Report_UpdateSettings() {
- SetCode(_Report_UpdateSettings);
-}
-
-function Report_GetPages() {
- SetCode(_Report_GetPages);
-}
-
-function Report_SetPage() {
- SetCode(_Report_SetPage);
-}
-
-function Report_GetFilters() {
- SetCode(_Report_GetFilters);
-}
-
-function Report_SetFilters() {
- SetCode(_Report_SetFilters);
-}
-
-function Report_RemoveFilters() {
- SetCode(_Report_RemoveFilters);
-}
-
-function Report_PrintCurrentReport() {
- SetCode(_Report_PrintCurrentReport);
-}
-
-function Report_Reload() {
- SetCode(_Report_Reload);
-}
-
-function PaginatedReport_Reload() {
- SetCode(_PaginatedReport_Reload);
-}
-
-function PaginatedReport_GetId() {
- SetCode(_PaginatedReport_GetId);
-}
-
-function PaginatedReport_FullScreen() {
- SetCode(_PaginatedReport_FullScreen);
-}
-
-function PaginatedReport_ExitFullScreen() {
- SetCode(_PaginatedReport_ExitFullScreen);
-}
-
-function Report_Refresh() {
- SetCode(_Report_Refresh);
-}
-
-function Report_FullScreen() {
- SetCode(_Report_FullScreen);
-}
-
-function Report_ExitFullScreen() {
- SetCode(_Report_ExitFullScreen);
-}
-
-function Report_Extensions_ContextMenu() {
- SetCode(_Report_Extensions_ContextMenu);
-}
-
-function Report_Extensions_OptionsMenu() {
- SetCode(_Report_Extensions_OptionsMenu);
-}
-
-function Visual_Operations_SortVisualBy() {
- SetCode(_Visual_Operations_SortVisualBy);
-}
-
-function Report_ApplyCustomLayout() {
- SetCode(_Report_ApplyCustomLayout);
-}
-
-function Report_HideAllVisualHeaders() {
- SetCode(_Report_HideAllVisualHeaders);
-}
-
-function Report_ShowAllVisualHeaders() {
- SetCode(_Report_ShowAllVisualHeaders);
-}
-
-function Report_HideSingleVisualHeader() {
- SetCode(_Report_HideSingleVisualHeader);
-}
-
-// ---- Page Operations ----------------------------------------------------
-
-function Page_SetActive() {
- SetCode(_Page_SetActive);
-}
-
-function Page_GetFilters() {
- SetCode(_Page_GetFilters);
-}
-
-function Page_GetVisuals() {
- SetCode(_Page_GetVisuals);
-}
-
-function Page_SetFilters() {
- SetCode(_Page_SetFilters);
-}
-
-function Page_RemoveFilters() {
- SetCode(_Page_RemoveFilters);
-}
-
-function Page_HasLayout() {
- SetCode(_Page_HasLayout);
-}
-// ---- Event Listener ----------------------------------------------------
-
-function Events_PageChanged() {
- SetCode(_Events_PageChanged);
-}
-
-function Events_DataSelected() {
- SetCode(_Events_DataSelected);
-}
-
-function Events_SaveAsTriggered() {
- SetCode(_Events_SaveAsTriggered);
-}
-
-function Events_BookmarkApplied() {
- SetCode(_Events_BookmarkApplied);
-}
-
-function Events_ReportLoaded() {
- SetCode(_Events_ReportLoaded);
-}
-
-function Events_ReportRendered() {
- SetCode(_Events_ReportRendered);
-}
-
-function Events_ReportSaved() {
- SetCode(_Events_ReportSaved);
-}
-
-function Events_TileLoaded() {
- SetCode(_Events_TileLoaded);
-}
-
-function Events_TileClicked() {
- SetCode(_Events_TileClicked);
-}
-
-function Events_ButtonClicked() {
- SetCode(_Events_ButtonClicked)
-}
-
-// ---- Edit and Save Operations ----------------------------------------------------
-
-function Report_switchModeEdit() {
- SetCode(_Report_switchModeEdit);
-}
-
-function Report_switchModeView() {
- SetCode(_Report_switchModeView);
-}
-
-function Report_save() {
- SetCode(_Report_save);
-}
-
-function Report_saveAs() {
- SetCode(_Report_saveAs);
-}
-
-// ---- Bookmarks Operations ----------------------------------------------------
-function Bookmarks_Enable() {
- SetCode(_Bookmarks_Enable);
-}
-
-function Bookmarks_Disable() {
- SetCode(_Bookmarks_Disable);
-}
-
-function Bookmarks_Get() {
- SetCode(_Bookmarks_Get);
-}
-
-function Bookmarks_Apply() {
- SetCode(_Bookmarks_Apply);
-}
-
-function Bookmarks_Capture() {
- SetCode(_Bookmarks_Capture);
-}
-
-function Bookmarks_ApplyState() {
- SetCode(_Bookmarks_ApplyState);
-}
-
-function Bookmarks_EnterPresentation() {
- SetCode(_Bookmarks_EnterPresentation);
-}
-
-function Bookmarks_ExitPresentation() {
- SetCode(_Bookmarks_ExitPresentation);
-}
-
-// ---- Dashboard Operations ----------------------------------------------------
-
-function Dashboard_GetId() {
- SetCode(_Dashboard_GetId);
-}
-
-function Dashboard_FullScreen() {
- SetCode(_Dashboard_FullScreen);
-}
-
-function Dashboard_ExitFullScreen() {
- SetCode(_Dashboard_ExitFullScreen);
-}
-
-
-// ---- Dashboard Events Listener ----------------------------------------------------
-
-function DashboardEvents_TileClicked() {
- SetCode(_DashboardEvents_TileClicked);
-}
-
-// ---- Q&A Events Listener ----------------------------------------------------
-
-function Qna_SetQuestion() {
- SetCode(_Qna_SetQuestion);
-}
-
-function Qna_QuestionChanged() {
- SetCode(_Qna_QuestionChanged);
-}
-
-// ---- Visual Events Listener ----------------------------------------------------
-
-function Visual_DataSelected() {
- SetCode(_Visual_DataSelected);
-}
-
-// ---- Visuals -------------------------------------------------------------------
-
-function Visual_GetFilters() {
- SetCode(_Visual_GetFilters);
-}
-
-function Visual_SetFilters() {
- SetCode(_Visual_SetFilters);
-}
-
-function Visual_GetSlicer() {
- SetCode(_Visual_GetSlicer);
-}
-
-function Visual_SetSlicer() {
- SetCode(_Visual_SetSlicer);
-}
-
-function Visual_RemoveFilters() {
- SetCode(_Visual_RemoveFilters);
-}
-
-function Visual_ExportData_Summarized() {
- SetCode(_Visual_ExportData_Summarized);
-}
-
-function Visual_ExportData_Underlying() {
- SetCode(_Visual_ExportData_Underlying);
-}
-
-function ReportVisual_UpdateSettings() {
- SetCode(_ReportVisual_UpdateSettings);
-}
-
-function ReportVisual_Report_SetFilters() {
- SetCode(_ReportVisual_Report_SetFilters);
-}
-
-function ReportVisual_Report_GetFilters() {
- SetCode(_ReportVisual_Report_GetFilters);
-}
-
-function ReportVisual_Report_RemoveFilters() {
- SetCode(_ReportVisual_Report_RemoveFilters);
-}
-
-function ReportVisual_Page_SetFilters() {
- SetCode(_ReportVisual_Page_SetFilters);
-}
-
-function ReportVisual_Page_GetFilters() {
- SetCode(_ReportVisual_Page_GetFilters);
-}
-
-function ReportVisual_Page_RemoveFilters() {
- SetCode(_ReportVisual_Page_RemoveFilters);
-}
-
-function ReportVisual_Visual_SetFilters() {
- SetCode(_ReportVisual_Visual_SetFilters);
-}
-
-function ReportVisual_Visual_GetFilters() {
- SetCode(_ReportVisual_Visual_GetFilters);
-}
-
-function ReportVisual_Visual_RemoveFilters() {
- SetCode(_ReportVisual_Visual_RemoveFilters);
-}
-
-function ReportVisual_HideSingleVisualHeader() {
- SetCode(_ReportVisual_HideSingleVisualHeader);
-}
-
-// ---- Report Authoring ----------------------------------------------------
-
-function Report_Authoring_Create() {
- SetCode(_Report_Authoring_Create);
-}
-
-function Report_Authoring_ChangeType() {
- SetCode(_Report_Authoring_ChangeType);
-}
-
-function Report_Authoring_Remove() {
- SetCode(_Report_Authoring_Remove);
-}
-
-function Report_Authoring_Capabilities() {
- SetCode(_Report_Authoring_Capabilities);
-}
-
-function Report_Authoring_AddDataField() {
- SetCode(_Report_Authoring_AddDataField);
-}
-
-function Report_Authoring_RemoveDataField() {
- SetCode(_Report_Authoring_RemoveDataField);
-}
-
-function Report_Authoring_GetDataField() {
- SetCode(_Report_Authoring_GetDataField);
-}
-
-function Report_Authoring_GetProperty() {
- SetCode(_Report_Authoring_GetProperty);
-}
-
-function Report_Authoring_SetProperty() {
- SetCode(_Report_Authoring_SetProperty);
-}
-
-function Report_Authoring_ResetProperty() {
- SetCode(_Report_Authoring_ResetProperty);
-}
diff --git a/demo/v2-demo/scripts/step_interact.js b/demo/v2-demo/scripts/step_interact.js
deleted file mode 100644
index 2df577f8..00000000
--- a/demo/v2-demo/scripts/step_interact.js
+++ /dev/null
@@ -1,84 +0,0 @@
-function OpenBookmarksOperations() {
- $("#bookmarks-operations-ul").toggle();
- $("#bookmarks-operations").toggleClass("active");
-}
-
-function OpenEditSaveOperations() {
- $("#editsave-operations-ul").toggle();
- $("#editsave-operations").toggleClass("active");
-}
-
-function OpenDataOperations() {
- $("#data-operations-ul").toggle();
- $("#data-operations").toggleClass("active");
-}
-
-function OpenAuthoringOperations() {
- $("#authoring-operations-ul").toggle();
- $("#authoring-operations").toggleClass("active");
-}
-
-function OpenMenuOperations() {
- $("#menu-operations-ul").toggle();
- $("#menu-operations").toggleClass("active");
-}
-
-function OpenReportPropertiesOperations() {
- $("#reportproperties-operations-ul").toggle();
- $("#reportproperties-operations").toggleClass("active");
-}
-
-function OpenFiltersOperations() {
- $("#filters-operations-ul").toggle();
- $("#filters-operations").toggleClass("active");
-}
-
-function OpenGeneralOperations() {
- $("#general-operations-ul").toggle();
- $("#general-operations").toggleClass("active");
-}
-
-function OpenLayoutOperations() {
- $("#layout-operations-ul").toggle();
- $("#layout-operations").toggleClass("active");
-}
-
-function OpenNavigationOperations() {
- $("#navigation-operations-ul").toggle();
- $("#navigation-operations").toggleClass("active");
-}
-
-function OpenDashboardGeneralOperations() {
- $("#dashboard-general-operations-ul").toggle();
- $("#dashboard-general-operations").toggleClass("active");
-}
-
-function OpenDashboardPropertiesOperations() {
- $("#dashboard-properties-operations-ul").toggle();
- $("#dashboard-properties-operations").toggleClass("active");
-}
-
-function OpenDashboardEventsOperations() {
- $("#dashboard-events-operations-ul").toggle();
- $("#dashboard-events-operations").toggleClass("active");
-}
-
-function OpenQnaOperations() {
- $("#qna-operations-ul").toggle();
- $("#qna-operations").toggleClass("active");
-}
-
-function OpenQnaEventsOperations() {
- $("#qna-events-operations-ul").toggle();
- $("#qna-events-operations").toggleClass("active");
-}
-
-function SetToggleHandler(devId) {
- const selector = "#" + devId + " .function-ul li";
- $(selector).each(function(index, li) {
- $(li).click(function() {
- $(selector).removeClass('active');
- $(li).addClass('active');
- });
- });
-}
diff --git a/demo/v2-demo/scripts/step_samples.js b/demo/v2-demo/scripts/step_samples.js
deleted file mode 100644
index a2d4dd29..00000000
--- a/demo/v2-demo/scripts/step_samples.js
+++ /dev/null
@@ -1,46 +0,0 @@
-function OpenCodeStepWithSample(entityType) {
- $("html, body").animate({ scrollTop: 0 }, "slow");
-
- // Clear the log
- ClearTextArea('#txtResponse');
-
- SetSession(SessionKeys.EntityType, entityType);
- SetSession(SessionKeys.TokenType, defaultTokenType);
-
- if (entityType == EntityType.Report)
- {
- SetSession(SessionKeys.IsSampleReport, true);
- OpenCodeStep(EmbedViewMode, EntityType.Report);
- }
- else if (entityType == EntityType.Visual)
- {
- SetSession(SessionKeys.IsSampleReport, true);
- OpenCodeStep(EmbedViewMode, EntityType.Visual);
- }
- else if (entityType == EntityType.Dashboard)
- {
- SetSession(SessionKeys.IsSampleDashboard, true);
- OpenCodeStep(EmbedViewMode, EntityType.Dashboard);
- }
- else if (entityType == EntityType.Tile)
- {
- SetSession(SessionKeys.IsSampleTile, true);
- OpenCodeStep(EmbedViewMode, EntityType.Tile)
- }
- else if (entityType == EntityType.Qna)
- {
- SetSession(SessionKeys.IsSampleQna, true);
- OpenCodeStep(EmbedViewMode, EntityType.Qna)
- }
- else if (entityType == EntityType.PaginatedReport)
- {
- SetSession(SessionKeys.IsSamplePaginatedReport, true);
- OpenCodeStep(EmbedViewMode, EntityType.PaginatedReport)
- }
- else {
- assert(false);
- trackEvent(TelemetryEventName.CodeStepError, {});
- return;
- }
- trackEvent(TelemetrySectionName.SampleTool, { entityType: entityType, src: TelemetryEventSource.UserClick });
-}
diff --git a/demo/v2-demo/scripts/telemetry.js b/demo/v2-demo/scripts/telemetry.js
deleted file mode 100644
index 006046c1..00000000
--- a/demo/v2-demo/scripts/telemetry.js
+++ /dev/null
@@ -1,46 +0,0 @@
-const TelemetryEventName = {
- CodeStepError: "CodeStepError",
- CopyCode: "CopyCode",
- CopyLog: "CopyLog",
- DesktopModeOpen: "DesktopModeOpen",
- InnerSectionOpen: "InnerSectionOpen",
- Interact: "Interact",
- MobileModeOpen: "MobileModeOpen",
- RunClick: "RunClick",
- SectionOpen: "SectionOpen",
- SessionStart: "SessionStart"
-};
-const TelemetryEventSource = {
- Url: "Url",
- UserClick: "UserClick"
-};
-
-const TelemetryInnerSection = {
- Code: "Code",
- Sample: "Sample"
-};
-
-const TelemetrySectionName = {
- Documentation: "Documentation",
- SampleTool: "SampleTool",
- Showcase: "Showcase"
-};
-
-function trackEvent(name, properties, flush) {
- if (!_session[SessionKeys.IsTelemetryEnabled]) {
- return;
- }
- assert(name && properties);
- properties.sessionId = GetSession(SessionKeys.SessionId);
-
- getAppInsightsInstance().then(function(ai) {
- // Normally, the SDK sends data at fixed intervals (typically 30 secs) or whenever buffer is full (typically 500 items).
- // https://docs.microsoft.com/en-us/azure/azure-monitor/app/api-custom-events-metrics#flushing-data
- ai.trackEvent({ name: name, properties: properties });
- if (flush) {
- ai.flush();
- }
- });
-}
-
-trackEvent(TelemetryEventName.SessionStart, { referrer: document.referrer }, true);
\ No newline at end of file
diff --git a/demo/v2-demo/scripts/utils.js b/demo/v2-demo/scripts/utils.js
deleted file mode 100644
index 663645e3..00000000
--- a/demo/v2-demo/scripts/utils.js
+++ /dev/null
@@ -1,249 +0,0 @@
-var currentCode = "";
-const interactIndicationTimeout = 5000;
-const elementClickedTimeout = 250;
-const textCodeTimeout = 100;
-
-function BodyCodeOfFunction(func) {
- let lines = func.toString().split('\n');
- lines = lines.slice(1, lines.length-1);
-
- for (let i = 0; i < lines.length; ++i)
- {
- // remove trailing spaces.
- lines[i] = lines[i].substring(4);
- }
-
- return lines.join('\n');
-}
-
-function LoadCodeArea(divSelector, initialFunctionCode) {
- $(divSelector).load("code_area.html", function() {
- SetCode(initialFunctionCode);
- });
-}
-
-function LoadLogWindow(divSelector) {
- $(divSelector).load("log_window.html");
-}
-
-function SetCode(func) {
- currentCode = BodyCodeOfFunction(func);
-
- $("#highlighter").empty();
-
- var txtCodeElement = document.createElement("div");
- txtCodeElement.setAttribute("id", "txtCode");
- txtCodeElement.setAttribute("style", "display: none;");
-
- var preElement = document.createElement("pre");
- preElement.setAttribute("class", "brush: js; gutter: false;");
-
- var codeElement = document.createTextNode(currentCode);
- preElement.appendChild(codeElement);
- txtCodeElement.appendChild(preElement);
- $("#highlighter").append(txtCodeElement);
-
- var scriptElement = document.createElement("script");
- scriptElement.setAttribute("type", "text/javascript");
- scriptElement.setAttribute("src", "syntaxHighlighter/syntaxhighlighter.js");
- $("#highlighter").append(scriptElement);
-
- setTimeout(function() {
- $("#txtCode").show();
- }, textCodeTimeout);
-
- if (func != "") {
- let runFunc = mapFunc(func);
- let funcName = getFuncName(runFunc);
- if (funcName.match(/Embed/)) {
- let oldFunc = runFunc;
- runFunc = function() {
- oldFunc();
-
- SetSession(SessionKeys.EntityIsAlreadyEmbedded, true);
-
- $('#interact-tab').addClass('enableTransition');
- setTimeout(function() {
- $('#interact-tab').addClass('changeColor');
- }, interactIndicationTimeout);
- }
- }
-
- $('#btnRunCode').off('click');
- $('#btnRunCode').click(function() {
- showEmbedContainer();
- removeIframeIfUrlIsChanged();
- elementClicked('#btnRunCode');
- trackEvent(TelemetryEventName.RunClick, { EmbedType: GetSession(SessionKeys.EntityType), TokenType: GetSession(SessionKeys.TokenType), ApiUsed: funcName });
- runFunc();
- });
- // TODO: add indication to click Interact tab on first embedding
- }
-}
-
-function CopyCode() {
- const id = "clipboard-textarea";
- let textarea = document.getElementById(id);
-
- if (!textarea) {
- textarea = document.createElement("textarea");
- textarea.id = id;
- document.querySelector("body").appendChild(textarea);
- }
-
- textarea.value = currentCode;
- CopyTextArea('#' + id, "#btnRunCopyCode");
- trackEvent(TelemetryEventName.CopyCode, {});
-}
-
-function CopyResponseWindow() {
- CopyTextArea("#txtResponse", "#btnCopyResponse");
- trackEvent(TelemetryEventName.CopyLog, {});
-}
-
-function CopyTextArea(textAreaSelector, buttonSelector) {
- $(textAreaSelector).select();
- document.execCommand('copy');
- window.getSelection().removeAllRanges();
-
- // Set focus on copy button - this will deselect text in copied area.
- $(buttonSelector).focus();
-}
-
-function ClearTextArea(textAreaSelector) {
- $(textAreaSelector).val("");
-}
-
-function getEmbedContainerID(entityType) {
- switch (entityType) {
- case EntityType.Dashboard:
- return "dashboardContainer";
- case EntityType.Tile:
- return "tileContainer";
- case EntityType.Qna:
- return "qnaContainer";
- case EntityType.PaginatedReport:
- return "paginatedReportContainer";
- default:
- return "embedContainer";
- }
-}
-
-function getEmbedContainerClassPrefix(entityType) {
- switch (entityType) {
- case EntityType.Visual:
- return ".visual";
- case EntityType.Dashboard:
- return ".dashboard";
- case EntityType.Tile:
- return ".tile";
- case EntityType.Qna:
- return ".qna";
- case EntityType.PaginatedReport:
- return ".paginatedReport";
- default:
- return ".report";
- }
-}
-
-function getActiveEmbedContainer() {
- const entityType = GetSession(SessionKeys.EntityType);
- const classPrefix = getEmbedContainerClassPrefix(entityType);
- const activeContainer = classPrefix + ($(".desktop-view").hasClass(active_class) ? 'Container' : 'MobileContainer');
- return $(activeContainer)[0];
-}
-
-function getEntityTypeFromParameter(urlParam) {
- switch (urlParam) {
- case "visual":
- return EntityType.Visual;
- case "dashboard":
- return EntityType.Dashboard;
- case "tile":
- return EntityType.Tile;
- case "qna":
- return EntityType.Qna;
- case "rdl":
- return EntityType.PaginatedReport;
- default:
- return EntityType.Report;
- }
-}
-
-function elementClicked(element) {
- $(element).addClass('elementClicked');
- setTimeout(function() {
- $(element).removeClass('elementClicked');
- }, elementClickedTimeout);
-}
-
-function showEmbedContainer() {
- const activeContainer = getActiveEmbedContainer();
- $(activeContainer).css({"visibility":"visible"});
-}
-
-function removeIframeIfUrlIsChanged() {
- const activeContainer = getActiveEmbedContainer();
- if (!activeContainer || !activeContainer.powerBiEmbed || !activeContainer.powerBiEmbed.iframe) {
- return;
- }
-
- let existingIframeUrl = removeArgFromUrl(activeContainer.powerBiEmbed.iframe.src, "uid");
- existingIframeUrl = removeArgFromUrl(existingIframeUrl, "isMobile");
-
- let embedUrl = GetSession(SessionKeys.EmbedUrl);
-
- if (embedUrl !== existingIframeUrl) {
- // textbox has changed, delete the iframe and avoid the bootstrap.
- powerbi.reset(activeContainer);
- }
-}
-
-function SetAuthoringPageActive(report) {
- return new Promise(function(resolve, reject) {
-
- // Get all report pages
- report.getPages().then(function (pages) {
-
- // Find authoring page
- var authoringPage = pages.filter(function (page) {
- return page.name === "ReportSection6da8317ad6cbcae5b3bb";
- })[0];
-
- // If active page is not authoring page, navigate to authoring page
- if (authoringPage.isActive) {
- resolve(authoringPage);
- } else {
- authoringPage.setActive().then(function () {
- Log.logText("Page was set to authoring page.");
- resolve(authoringPage);
- }).catch(function (errors) {
- reject(errors);
- });
- }
- }).catch(function (errors) {
- reject(errors);
- });
- });
-}
-
-function removeArgFromUrl(url, arg) {
- const argRegEx = new RegExp(arg + '="?([^&]+)"?')
- const argMatch = url.match(argRegEx);
-
- if (argMatch) {
- return url.replace("&" + argMatch[0], "");
- }
-
- return url;
-}
-
-function getRandomValue() {
-
- // window.msCrypto for IE
- var cryptoObj = window.crypto || window.msCrypto;
- var randomValueArray = new Uint32Array(1);
- cryptoObj.getRandomValues(randomValueArray);
-
- return randomValueArray[0];
-}
\ No newline at end of file
diff --git a/demo/v2-demo/settings_embed_dashboard.html b/demo/v2-demo/settings_embed_dashboard.html
deleted file mode 100644
index 223706ee..00000000
--- a/demo/v2-demo/settings_embed_dashboard.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
Select token type:
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_embed_paginatedreport.html b/demo/v2-demo/settings_embed_paginatedreport.html
deleted file mode 100644
index 87531300..00000000
--- a/demo/v2-demo/settings_embed_paginatedreport.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
Select token type:
-
-
-
-
Fill in the fields below to get the code to embed your paginated report
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_embed_qna.html b/demo/v2-demo/settings_embed_qna.html
deleted file mode 100644
index 5318ecfa..00000000
--- a/demo/v2-demo/settings_embed_qna.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
Select mode to embed Q&A in:
-
-
-
-
-
Q&A input question
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_embed_report.html b/demo/v2-demo/settings_embed_report.html
deleted file mode 100644
index be75be21..00000000
--- a/demo/v2-demo/settings_embed_report.html
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
Select mode to embed your report in:
-
-
- View mode
-
-
-
-
- Edit mode
-
-
-
-
- Create mode
-
-
-
-
-
-
Select token type:
-
-
-
-
Fill in the fields below to get the code to embed your report
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_embed_tile.html b/demo/v2-demo/settings_embed_tile.html
deleted file mode 100644
index baf07ce9..00000000
--- a/demo/v2-demo/settings_embed_tile.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
Select token type:
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_embed_visual.html b/demo/v2-demo/settings_embed_visual.html
deleted file mode 100644
index 658628ce..00000000
--- a/demo/v2-demo/settings_embed_visual.html
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
Select token type:
-
-
-
-
-
Fill in the fields below to get the code to embed your visual
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_interact_dashboard.html b/demo/v2-demo/settings_interact_dashboard.html
deleted file mode 100644
index 7a4c90fc..00000000
--- a/demo/v2-demo/settings_interact_dashboard.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_interact_paginatedreport.html b/demo/v2-demo/settings_interact_paginatedreport.html
deleted file mode 100644
index ae51d78d..00000000
--- a/demo/v2-demo/settings_interact_paginatedreport.html
+++ /dev/null
@@ -1,22 +0,0 @@
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_interact_qna.html b/demo/v2-demo/settings_interact_qna.html
deleted file mode 100644
index 9bf9f227..00000000
--- a/demo/v2-demo/settings_interact_qna.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_interact_report.html b/demo/v2-demo/settings_interact_report.html
deleted file mode 100644
index 0c097ab7..00000000
--- a/demo/v2-demo/settings_interact_report.html
+++ /dev/null
@@ -1,122 +0,0 @@
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_interact_tile.html b/demo/v2-demo/settings_interact_tile.html
deleted file mode 100644
index 36616308..00000000
--- a/demo/v2-demo/settings_interact_tile.html
+++ /dev/null
@@ -1,17 +0,0 @@
-
\ No newline at end of file
diff --git a/demo/v2-demo/settings_interact_visual.html b/demo/v2-demo/settings_interact_visual.html
deleted file mode 100644
index 5fbdb307..00000000
--- a/demo/v2-demo/settings_interact_visual.html
+++ /dev/null
@@ -1,54 +0,0 @@
-
\ No newline at end of file
diff --git a/demo/v2-demo/shareBookmark.html b/demo/v2-demo/shareBookmark.html
deleted file mode 100644
index 7c307f1d..00000000
--- a/demo/v2-demo/shareBookmark.html
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/showcases.html b/demo/v2-demo/showcases.html
deleted file mode 100644
index 320ec827..00000000
--- a/demo/v2-demo/showcases.html
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
Interactive feature showcase
-
-
- Experience our new features.
- Select the showcase you want to explore to get started.
-
-
-
-
-
-
-
-
-
-
-
-
Dynamic report layout
- Use this showcase to learn the custom layout API for dynamic embedding of visuals.
-
-
- Start
-
-
-
-
-
-
-
-
-
-
-
Capture & share bookmarks
- Let your users create and share their own bookmarks.
-
-
- Start
-
-
-
-
-
-
-
-
NEW
-
-
-
-
Personalize report design
- Dynamically control the look & feel of your report with themes API.
-
-
- Start
-
-
-
-
-
-
-
-
NEW
-
-
-
-
Insight to action
- Let your users take actions driven straight from analytics, with minimal clicks!
-
-
- Start
-
-
-
-
-
-
-
-
NEW
-
-
-
-
Quick visual creator
- Leverage the visual APIs to quickly create and personalize a visual.
-
-
- Start
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/step_samples.html b/demo/v2-demo/step_samples.html
deleted file mode 100644
index 698f362f..00000000
--- a/demo/v2-demo/step_samples.html
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
Sample Report
- Embed a sample report and interact with Power BI Embedded firsthand.
-
-
- Try it
-
-
-
-
-
-
-
-
-
Sample Report Visual
- Embed a sample report visual and interact with Power BI Embedded firsthand.
-
-
- Try it
-
-
-
-
-
-
-
-
-
Sample Paginated Report
- Embed a sample paginated report and interact with Power BI Embedded firsthand. (Preview)
-
-
- Try it
-
-
-
-
-
-
-
-
-
Sample Q&A
- Embed a sample Q&A and interact with Power BI Embedded firsthand.
-
-
- Try it
-
-
-
-
-
-
-
-
-
Sample Dashboard
- Embed a sample dashboard and interact with Power BI Embedded firsthand.
-
-
- Try it
-
-
-
-
-
-
-
-
-
Sample Tile
- Embed a sample tile and interact with Power BI Embedded firsthand.
-
-
- Try it
-
-
-
-
-
-
\ No newline at end of file
diff --git a/demo/v2-demo/style/layout.css b/demo/v2-demo/style/layout.css
deleted file mode 100644
index dba478f1..00000000
--- a/demo/v2-demo/style/layout.css
+++ /dev/null
@@ -1,382 +0,0 @@
-html {
- overflow-x: hidden;
-}
-
-body {
- min-width: 300px;
- background-color: #212121;
-}
-
-header
-{
- position: relative;
- height: 60px;
- background: #121212;
-}
-
-label {
- display: initial;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-weight: normal;
-}
-
-#navbar {
- display: table-cell;
- width: 160px;
- background: #212121;
- vertical-align: top;
-}
-
-#main-ul-dev {
- position: relative;
- padding-top: 24px;
- padding-left: 0px;
-}
-
-.main-ul {
- position: absolute;
- width: 100%;
- list-style-type: none;
- margin: 0px;
- overflow: hidden;
- padding-left: 0;
- -webkit-margin-before: 0;
- -webkit-padding-start: 0;
- line-height: 30px;
-}
-
-#mainContent {
- padding: 0 8px 8px 8px;
- width: 100%;
- background: #F1F1F1;
-}
-
-#showcasesContent {
- position: relative;
-}
-
-#showcaseContent {
- display: table;
- padding: 32px 24px 24px 24px;
- width: 100%;
- background: #F1F1F1;
- overflow: hidden;
-}
-
-#samples-step-wrapper {
- max-width: 1250px;
-}
-
-#documentationContent {
- background: #F1F1F1;
- padding-left: 16px;
-}
-
-#contentWrapper {
- height: 100%;
- width: 100%;
- background-color: #F1F1F1;
- max-width: 100vw;
- width: calc(100% - 160px);
- display: table-cell;
-}
-
-.content {
- height: 100%;
- width: 100%;
-}
-
-#settings-wrapper {
- margin-right: 10px;
- max-height: 330px;
- float: left;
-}
-
-#embedCodeDiv {
- margin-right: 10px;
- max-height: 330px;
- float: left;
- overflow: hidden;
-}
-
-#embedArea {
- clear: both;
- width: 100%;
-}
-
-.iframeContainer {
- display: none;
- width: 100%;
- height: 100%;
- background-color: #FFFFFF;
- padding: 0px;
- clear: both;
-}
-
-.iframeContainer.active {
- display: block;
-}
-
-#logWindow {
- max-height: 330px;
- float: left;
- overflow: hidden;
-}
-
-.topFrame {
- display: table-cell;
- width: 32%;
- width: calc((100% - 20.1px)/3);
- height: 330px;
-}
-
-.topPanel {
- display: table;
- table-layout: fixed;
- width: 100%;
- height: 330px;
- margin: 15px 0 15px 0;
-}
-
-.bottomPanel {
- width: 100%;
- margin-bottom: 10px;
- max-width: 100%;
-}
-
-#steps-nav-bar {
- height: 48px;
- vertical-align: top;
- background: #FFFFFF;
-}
-
-#steps-ul {
- height: 100%;
-}
-
-#navbar-content {
- display: table;
- width: 100%;
- height: 100%;
-}
-
-#welcome-text, #showcases-text {
- margin-top: 2px;
- padding: 16px 24px 16px 24px;
- background: #FFFFFF;
-}
-
-#sample-tool-header {
- margin-bottom: 16px;
- font-size: 24px;
-}
-
-#sample-tool-description, #showcases-description {
- max-width: 1000px;
-}
-
-#showcase-embedded-view {
- background: #FFFFFF;
- height: calc(67vw*(9/16)*1.1);
- position: relative;
-}
-
-#bookmark-embedded-view {
- background: #FFFFFF;
- height: calc(61vw*(9/16)*1.1);
-}
-
-#themes-embedded-view {
- background: #FFFFFF;
- height: calc(64vw*(9/16)*1.1);
-}
-
-
-#leftShowcaseWindow {
- min-width: 20vw;
- max-width: 20vw;
- display: table-cell;
- padding-right: 16px;
-}
-
-#showcaseItemsWrapper, #bookmarksWrapper, #generatorWrapper {
- background: #FFFFFF;
- min-height: 350px;
-}
-
-#themesDataColorsWrapper {
- background: #FFFFFF;
- min-height: 236px;
- margin-bottom: 8px;
-}
-
-#themesBackgroundWrapper {
- background: #FFFFFF;
- min-height: 64px;
- padding: 22px 22px;
-}
-
-#bookmarksWrapper {
- min-height: 550px;
-}
-
-#showcaseEmbedArea {
- display: table-cell;
- width: 100%;
-}
-
-#insightToActionShowcaseEmbedArea {
- width: calc(100% - 20vw);
-}
-
-#showcasesSelectDiv {
- max-width: 1250px;
-}
-
-@media only screen and (max-width: 1280px) {
- #distributionDialog {
- width: 750px;
- height: 450px;
- }
-
- #dialogTable {
- height: 303px;
- }
-
- #dialogTooltip {
- top: 195px;
- }
-}
-
-
-@media only screen and (max-width: 1050px) {
- .textAreaControl {
- margin-right: 20px;
- }
-}
-
-@media only screen and (max-width: 950px) {
- #navbar-content {
- display: block;
- }
-
- .content {
- display: block;
- }
-
- #contentWrapper {
- display: block;
- width: 100%;
- }
-
- #main-ul-dev {
- padding-top: 0px;
- }
-
- #navbar {
- display: block;
- width: 100%;
- height: 48px;
- }
-
- .main-ul li {
- width: 160px;
- float: left;
- text-align: center;
- }
-
- #main-nav-bar a {
- padding-left: 0px;
- }
-
- #modeSelector {
- margin-bottom: 8px;
- }
-
- body {
- background-color: #F1F1F1;
- }
-
- .desktop-view {
- height: calc(100vw * 0.59);
- }
-}
-
-@media only screen and (max-width: 800px) {
- .topPanel {
- display: block;
- }
-
- .topFrame {
- width: 100%;
- }
-
- .customTooltip .tooltipText {
- top: -21px;
- left: -170px;
- }
-
- .customTooltip .tooltipText::after {
- top: 50%;
- left: 100%; /* To the right of the tooltip */
- margin-top: -5px;
- border-width: 5px;
- border-style: solid;
- border-color: transparent transparent transparent #000000;
- margin-left: 0px;
- }
-}
-
-@media only screen and (max-width: 750px) {
- #main-showcases {
- display: none !important;
- }
-
- .tryShowcase {
- display: none !important;
- }
-}
-
-@media only screen and (max-width: 500px) {
- .main-ul li {
- width: 33%;
- }
-
- body {
- font-size: 12px;
- }
-
- .interactTooltip .tooltipText {
- left: -105px;
- top: 35px;
- }
-
- .interactTooltip .tooltipText::after {
- display: none;
- }
-}
-
-@media only screen and (max-width: 460px) {
- .logo-text-span {
- font-size: 18px;
- text-align: center;
- left: 0px;
- font-weight: 600;
- }
-
- .logo-text-span {
- width: 100%;
- }
-}
-
-@media only screen and (max-width: 432px) {
- .pbi-line {
- width: calc(100% - 24px);
- }
-
- #sampleTileImg {
- background-position: left;
- }
-}
diff --git a/demo/v2-demo/style/style.css b/demo/v2-demo/style/style.css
deleted file mode 100644
index 48cfd283..00000000
--- a/demo/v2-demo/style/style.css
+++ /dev/null
@@ -1,1865 +0,0 @@
-html {
- margin:0;
- padding:0;
- height:100%;
-}
-
-body {
- background-color: #F1F1F1;
- font-family: 'Segoe UI', 'Segoe WP', Tahoma, Arial, sans-serif;
- margin:0;
- padding:0;
- height:100%;
- font-size: 14px;
- line-height: 1.42857143;
- color: #333;
-}
-
-h1 {
- margin-bottom: 15px;
-}
-
-h2 {
- margin-top: 20px;
- margin-bottom: 10px;
-}
-
-h3 {
- margin: 0;
- font-size: 24px;
- font-family: inherit;
- font-weight: 500;
- line-height: 1.1;
- color: inherit;
-}
-
-h8 {
- font-weight: 600;
-}
-
-button:focus {
- outline: none !important;
-}
-
-a {
- color: #337ab7;
- text-decoration: none;
-}
-
-a:hover, a:visited, a:link, a:active
-{
- text-decoration: none !important;
-}
-
-.logo-text-span {
- position: relative;
- width: 480px;
- left: 24px;
- padding-top: 12px;
-
- font-family: 'Segoe UI', sans-serif;
- line-height: normal;
- font-size: 24px;
- color: #FFFFFF;
-}
-
-.embed-table, #qna-embed-table {
- width: 100%;
-}
-
-.embed-table tr, #qna-embed-table tr {
- width: 100%;
-}
-
-#dashboard-embed-table {
- width: 100%;
-}
-
-#dashboard-embed-table tr {
- width: 100%;
-}
-
-#tile-embed-table {
- width: 100%;
-}
-
-#tile-embed-table tr {
- width: 100%;
-}
-
-.inputLine > span {
- width: 30%;
-}
-
-.embed-table input[type="text"], #qna-embed-table input[type="text"], #dashboard-embed-table input[type="text"], #tile-embed-table input[type="text"] {
- width: calc(100% - 95px);
- border: none;
- margin-bottom: 5px;
- background: #F1F1F1;
- padding-left: 4px;
-}
-
-#visual-embed-table input[type="text"] {
- width: calc(100% - 112px);
- border: none;
- margin-bottom: 5px;
- background: #F1F1F1;
- padding-left: 4px;
-}
-
-.pbi-line {
- float: left;
- width: 384px;
- margin: 12px;
- background: #FFFFFF;
- border: solid;
- border-color: white;
-}
-
-.pbi-line:hover {
- box-shadow: 0px 0px 48px rgba(0, 0, 0, 0.12);
-}
-
-#main-nav-bar a {
- color: #FFFFFF;
- display: inline-block;
- padding-left: 16px;
- font-weight: 600;
- font-size: 15px;
-}
-
-#steps-nav-bar a {
- color: #6E6E6E;
- font-family: 'Segoe UI', sans-serif;
- line-height: normal;
- font-size: 15px;
- font-weight: 600;
-}
-
-.main-ul .active {
- background-color: #F5D341;
-}
-
-.main-li {
- float: left;
-}
-
-.main-li a {
- display: block;
- color: #000000;
- text-align: center;
- padding: 0px 16px;
- text-decoration: none;
-}
-
-.main-li a:visited {
- display: block;
- color: #000000;
- text-align: center;
- padding: 0px 16px;
- text-decoration: none;
- background-color: #F5D341;
-}
-
-.main-li a:hover {
- display: block;
- color: #000000;
- text-align: center;
- padding: 0px 16px;
- text-decoration: none;
- background-color: #F5D341;
-}
-
-.main-li a:active {
- display: block;
- color: #000000;
- text-align: center;
- padding: 0px 16px;
- text-decoration: none;
- background-color: #F5D341;
-}
-
-.main-ul li {
- float: none;
- text-align: left;
- line-height: 22px;
- height: 48px;
- width: 100%;
- margin-bottom: 10px;
- padding-top: 12px;
-}
-
-#main-docs, #main-showcases {
- margin-right: 0px;
-}
-
-.main-li-active {
- color: #FFFFFF;
- text-decoration: none;
- background-color: #121212;
-}
-
-#steps-ul-dev {
- width: 100%;
- height: 100%;
-}
-
-.steps-ul {
- list-style-type: none;
- margin: 0px;
- overflow: hidden;
- padding-left: 0;
- -webkit-margin-before: 0;
- -webkit-padding-start: 0;
- line-height: 30px;
- width: 100%;
-}
-
-.steps-ul li {
- float: left;
- width: 100px;
- text-align: center;
- line-height: 18px;
- font-size: 15px;
- font-family: 'Segoe UI', sans-serif;
-}
-
-#steps-samples {
- margin-left: 6px;
-}
-
-#steps-interact {
- margin-right: 0px;
-}
-
-.steps-li-active {
- border-bottom: 2px solid #F2C811 !important;
- padding: 0 4px 6px;
-}
-
-.operations-div {
- height: 100%;
- width: 100%;
- text-align: center;
- overflow-y: scroll;
- position: relative;
-}
-
-#wrapper-operations-div {
- padding: 8px 8px 8px 12px;
- background-color: #FFFFFF;
- width: 100%;
- height: 298px;
- overflow: hidden;
- display: inline-block;
-}
-
-#wrapper-settings-div {
- padding: 10px 10px 15px 12px;
- background-color: #FFFFFF;
- width: 100%;
- height: 298px;
- display: inline-block;
-}
-
-#highlighter {
- padding: 10px 20px 15px 20px;
- background-color: #FFFFFF;
-}
-
-#operation-categories::-webkit-scrollbar-track
-{
- border-radius: 10px;
- background-color: transparent;
-}
-
-#operation-categories::-webkit-scrollbar
-{
- width: 6px;
- height: 10px;
- background-color: transparent;
-}
-
-#operation-categories::-webkit-scrollbar-thumb
-{
- border-radius: 10px;
- background-color: #E1E1E1;
-}
-
-#txtCode::-webkit-scrollbar-track, #txtResponse::-webkit-scrollbar-track {
- border-radius: 10px;
- background-color: transparent;
-}
-
-#txtCode::-webkit-scrollbar, #txtResponse::-webkit-scrollbar {
- width: 6px;
- height: 10px;
- background: transparent
-}
-
-#txtCode::-webkit-scrollbar-thumb, #txtResponse::-webkit-scrollbar-thumb {
- border-radius: 10px;
- background-color: #E1E1E1;
-}
-
-.function-ul {
- width: 100%;
- clear: both;
- margin: 0;
- padding: 0px 20px 0px 35px;
- font-size: 12px;
-}
-
-.operations-ul {
- width: 100%;
- clear: both;
- margin: 0;
- padding: 0;
-}
-
-.function-ul li, .operations-ul li {
- width: 100%;
- clear: both;
- cursor: default;
- overflow: hidden;
- padding-left: 0px;
- -webkit-margin-before: 0;
- -webkit-padding-start: 0;
- margin: 5px 0px;
- text-align: left;
- padding: 2px 3px 0 0;
-}
-
-.operations-ul > li:before {
- content: " ";
- background: url('http://github.com/images/expand.svg') center left;
- background-repeat: no-repeat;
- padding-right: 18px;
- cursor: pointer;
-}
-
-.operations-ul > li.active:before {
- background: url('http://github.com/images/collapse.svg') center left;
- background-repeat: no-repeat;
- cursor: pointer;
-}
-
-.operations-ul a {
- text-decoration: none;
- color: #1B1B1B;
-}
-
-.function-ul .active, .function-ul .active a {
- color: #3E65FF;
- font-weight: bold;
-}
-
-.td-field-name {
- width: 130px;
- text-align: right;
- color: #888888;
- padding-right: 5px;
-}
-
-.pageTitle {
- margin-bottom: 10px;
-}
-
-.pageTitle h3 {
- margin-bottom: 15px;
- font-weight: normal;
-}
-
-.newSample, .newShowcase {
- height: 16px;
- width: 40px;
- background-color: #F2C811;
- font-size: 10px;
- text-align: center;
- color: #000000;
- left: 16px;
- bottom: 0px;
- position: absolute;
- font-weight: 600;
- padding: 0.5px;
-}
-
-.newSection {
- height: 10px;
- width: 25px;
- background-color: #F2C811;
- font-size: 8px;
- text-align: center;
- color: #000000;
- left: 99px;
- bottom: 86px;
- position: absolute;
- font-weight: 600;
- line-height: 10px;
-}
-
-.newFeature {
- height: 16px;
- width: 40px;
- background-color: #F2C811;
- font-size: 10px;
- text-align: center;
- color: #000000;
- left: 6px;
- bottom: 1px;
- display: inline-block;
- position: relative;
- font-weight: 600;
- padding: 0.5px;
-}
-
-.highlightSection {
- height: 6px;
- width: 6px;
- border-radius: 50%;
- background-color: #F2C811;
- left: 12px;
- bottom: 1px;
- display: inline-block;
- position: relative;
-}
-
-.editorTitle {
- font-weight: 620;
- font-size: 15px;
- height: 32px;
- padding: 5px 0 0 8px;
- color: #000000;
-}
-
-#tabs-wrapper {
- height: 32px;
-}
-
-#tabs-ul {
- list-style-type: none;
- margin: 0px;
- padding-left: 0;
- -webkit-margin-before: 0;
- -webkit-padding-start: 0;
- line-height: 30px;
- width: 100%;
-}
-
-#tabs-ul a {
- color: #6E6E6E;
- font-family: 'Segoe UI', sans-serif;
- line-height: normal;
- font-size: 15px;
- font-weight: 620;
-}
-
-#tabs-ul li {
- height: 32px;
- width: 96px;
- background-color: #E1E1E1;
- text-align: center;
- float: left;
-}
-
-#tabs-ul li.tabs-li-active {
- color: #000000;
- background-color: #FFFFFF;
-}
-
-#tabs-ul .tabs-li-active a {
- color: #000000;
-}
-
-.textAreaControls {
- background-color: #FAFAFA;
- position: relative;
- z-index: 1;
- height: 40px;
- padding: 0 20px;
- font-size: 14px;
- font-weight: bold;
-}
-
-.textAreaControl:hover {
- background-color: #EAEAEA;
- border-top: 2px solid #EAEAEA;
- border-bottom: 2px solid #EAEAEA;
-}
-
-.textAreaControl {
- background-color: transparent;
- border: none;
- outline: none;
- margin-right: 40px;
- height: 40px;
- opacity: 1;
- min-width: 80px;
- font-weight: bold;
- cursor: pointer;
-}
-
-.textAreaControl img {
- position: relative;
- top: -2px;
- padding-right: 3px;
- right: 2px;
-}
-
-.textAreaControl.regular img {
- height: 18px;
-}
-
-.textAreaControl.wide {
- min-width: 100px;
-}
-
-.textAreaControl.wide img {
- height: 14px;
-}
-
-.textAreaControl.narrow img {
- width: 14px;
- height: 16px;
-}
-
-.responseTextAreaWrapper {
- padding: 10px 20px 15px 20px;
- background-color: #FFFFFF;
-}
-
-.responseTextArea {
- width: 100%;
- height: 240px;
- border: none;
- position: relative;
- overflow-y: auto;
- resize: none;
-}
-
-#highlighter {
- height: 265px;
-}
-
-.responseDiv {
- width: 100%;
- float: left;
-}
-
-.selectButton {
- border: none;
- color: #000000;
- background-color: #FFFFFF;
- border: solid;
- border-width: 1px;
- border-color: #6E6E6E;
- padding: 5px 30px;
- width: 160px;
- height: 32px;
- text-align: center;
- cursor: pointer;
-}
-
-.selectButton:hover {
- background-color: #3E65FF;
- color: #FFFFFF;
- border-color: transparent;
-}
-
-.blueButton {
- background-color: #24A9E1;
- border: none;
- color: #FFFFFF;
- padding: 5px 30px;
-}
-
-.spacer {
- height: 5px;
-}
-
-.scrollbar
-{
- margin-left: 30px;
- float: left;
- height: 300px;
- width: 65px;
- background: #F5F5F5;
- overflow-y: scroll;
- margin-bottom: 25px;
-}
-
-#txtCode {
- width: 100%;
- height: 240px;
- position: relative;
- background: #FFFFFF;
- overflow-y: auto;
-}
-
-.embed-table .inputLine, #dashboard-embed-table .inputLine, #tile-embed-table .inputLine, #qna-embed-table .inputLine, #visual-embed-table .inputLine {
- margin: 2px 0px;
-}
-
-.pageTitle h4 {
- font-size: 18px;
- font-weight: normal;
- margin: 0px 0px 5px 0px;
-}
-
-.main-div {
- border-radius: 50%;
- width: 10px;
- height: 10px;
- display: inline-block;
- background-color: #FFFFFF;
- border: solid black 1px;
-}
-
-.editorTitleText {
- display: inline-block;
-}
-
-.stepsButton {
- height: 100%;
- padding-top: 20px;
- line-height: 20px;
-}
-
-#createModeInput {
- display: none;
-}
-
-.inputLineTitle {
- width: 90px;
- display: inline-block;
- vertical-align: middle;
-}
-
-#modeSelector {
- margin-bottom: 8px;
- cursor: default;
-}
-
-.desktop-view iframe, .mobile-view iframe, #showcase-embedded-view iframe, #bookmark-embedded-view iframe, #share-bookmark iframe, #themes-embedded-view iframe {
- border: none;
-}
-
-#questionDiv {
- margin-bottom: 10px;
-}
-
-.infoImg {
- margin-bottom: 3px;
-}
-
-.customTooltip {
- position: relative;
- display: inline-block;
-}
-
-.customTooltip .tooltipText {
- visibility: hidden;
- width: 164px;
- background-color: #121212;
- color: #F1F1F1;
- text-align: left;
- padding: 4px 12px;
- font-size: 12px;
- left: -75px;
- top: 25px;
- position: absolute;
- z-index: 1;
-}
-
-.customTooltip:hover .tooltipText {
- visibility: visible;
-}
-
-.customTooltip .tooltipText::after {
- content: " ";
- position: absolute;
- bottom: 100%;
- left: 50%;
- margin-left: -5px;
- border-width: 5px;
- border-style: solid;
- border-color: transparent transparent black transparent;
-}
-
-.interactTooltip {
- position: relative;
- display: inline-block;
-}
-
-.interactTooltip .tooltipText {
- transition: opacity 0.5s ease-in-out;
- -webkit-transition: opacity 0.5s ease-in-out;
- opacity: 0;
- width: 290px;
- background-color: #121212;
- color: #F1F1F1;
- text-align: left;
- padding: 4px 12px;
- font-size: 12px;
- top: -5px;
- left: 145%;
- position: absolute;
- z-index: -1;
-}
-
-.interactTooltip .tooltipText.showTooltip {
- opacity: 1;
- z-index: 5;
-}
-
-.interactTooltip .tooltipText::after {
- content: " ";
- position: absolute;
- top: 50%;
- right: 100%;
- margin-top: -5px;
- border-width: 5px;
- border-style: solid;
- border-color: transparent black transparent transparent;
-}
-
-.mobile-view {
- display: none;
- background: #FFFFFF;
- padding: 16px;
-}
-
-.desktop-view {
- display: none;
- background: #FFFFFF;
- height: calc((100vw - 220px) * 0.59);
-}
-
-.mobile-view.active, .desktop-view.active {
- display: block;
-}
-
-.phone-frame {
- border-radius: 30px;
- background: #EAEAEA;
- width: 408px;
- width: 44vh;
- height: 787px;
- height: 85vh;
- margin: auto;
-}
-
-.phone-top {
- position: relative;
- width: 100%;
- height: 48px;
-}
-
-.phone-bottom {
- position: relative;
- width: 100%;
- height: 72px;
-}
-
-
-.phone-speaker{
- position: relative;
- width: 48px;
- height: 8px;
- background: #C4C4C4;
- border-radius: 4px;
- margin: auto;
- top: 21px;
-}
-
-.phone-screen {
- position: relative;
- width: 375px;
- height: 667px;
- width: calc(100% - 33px);
- height: calc(100% - 120px) !important;
- margin: auto;
- background: #FFFFFF;
- border-width: 1px;
- border-color: #C4C4C4;
- border-style: solid;
-}
-
-.phone-button {
- position: relative;
- width: 40px;
- height: 40px;
- background: #C4C4C4;
- border-radius: 50%;
- margin: auto;
- top: 16px;
-}
-
-.sampleImg, .showcaseImg {
- position: relative;
- height: 192px;
- background: #FFFFFF;
- background-repeat: no-repeat;
- background-size: 378px auto;
- background-position: top left;
- box-shadow: inset 0 -7px 35px -7px rgba(0,0,0,0.12);
-}
-
-.sampleTextButton, .showcaseTextButton {
- padding: 16px;
-}
-
-#sampleReportImg {
- background-image: url('http://github.com/images/samplereport.png');
-}
-
-#sampleVisualImg {
- background-image: url('http://github.com/images/samplevisual.png');
-}
-
-#sampleTileImg {
- background-image: url('http://github.com/images/sampletile.png');
- background-position: bottom;
-}
-
-#sampleQnaImg {
- background-image: url('http://github.com/images/sampleqna.png');
- background-position: left;
-}
-
-#sampleDashboardImg {
- background-image: url('http://github.com/images/sampledashboard.png');
-}
-
-#samplePaginatedReportImg {
- background-image: url('http://github.com/images/samplerdlreport.png');
- background-position: top;
-}
-
-.showcaseIcon {
- position: relative;
- left: 50%;
- top: 50%;
- -webkit-transform: translate(-50%,-50%);
- transform: translate(-50%,-50%);
-}
-
-#bookmarksIcon {
- top: 56%;
-}
-
-.radioContainer {
- display: block;
- position: relative;
- padding-left: 26px;
- margin: 4px 0;
- cursor: pointer;
- font-weight: normal;
-}
-
-.radioContainer input {
- position: absolute;
- opacity: 0;
- cursor: pointer;
-}
-
-.checkmark {
- position: absolute;
- top: 2px;
- left: 0px;
- height: 16px;
- width: 16px;
- border: none;
- border-radius: 50%;
- border-color: #6E6E6E;
- border-style: solid;
- border-width: 1px;
-}
-
-.radioContainer input:checked ~ .checkmark {
- border-color: #3E65FF;
-}
-
-.checkmark:after {
- content: "";
- position: absolute;
- display: none;
-}
-
-.radioContainer input:checked ~ .checkmark:after {
- display: block;
-}
-
-.radioContainer .checkmark:after {
- top: 3px;
- left: 3px;
- width: 8px;
- height: 8px;
- border-radius: 50%;
- background: #3E65FF;
-}
-
-#clipboard-textarea {
- position: fixed;
- top: 0px;
- left: 0px;
- width: 1px;
- height: 1px;
- padding: 0px;
- border: none;
- outline: none;
- box-shadow: none;
- background: transparent;
-}
-
-#docs-section {
- font-size: 16px;
- line-height: 2;
- background: #F1F1F1;
- height: 100%;
- width: 100%;
- align-items: center;
-}
-
-.docs-links {
- margin-right: 30px;
- float: left;
- width: 330px;
- height: 180px;
-}
-
-.docs-video {
- margin-right: 30px;
- float: left;
- font-weight: 600;
- line-height: 3;
- width: 330px;
-}
-
-.docs-line {
- display: block;
- clear: both;
-}
-
-#docs-content {
- max-width: 1080px;
-}
-
-#interact-tab.enableTransition {
- transition: all 1s ease 0s;
- -webkit-transition: all 1s ease 0s;
-}
-
-#interact-tab.changeColor {
- background-color: #F2C811;
-}
-
-#interact-tab.changeColor a {
- color: #000000;
-}
-
-.elementClicked {
- opacity: 0.7;
-}
-
-#visualsList, #bookmarksList, #themesList {
- padding: 8px 0 8px 0;
-}
-
-#generatorOptions {
- padding: 8px 16px;
-}
-
-.checkboxContainer {
- display: block;
- position: relative;
- margin-bottom: 0px;
- cursor: pointer;
- font-size: 16px;
- -webkit-user-select: none;
- user-select: none;
- height: 40px;
- padding: 8px 8px 8px 40px;
-}
-
-.checkboxContainer input {
- position: absolute;
- opacity: 0;
- cursor: pointer;
-}
-
-.checkboxCheckmark {
- position: absolute;
- top: 11px;
- left: 12px;
- height: 16px;
- width: 16px;
- background-color: #FFFFFF;
- border-color: #000000;
- border-style: solid;
- border-width: 1px;
- transition: background-color 100ms ease;
- -webkit-transition: background-color 100ms ease;
-}
-
-.checkboxContainer input:checked ~ .checkboxCheckmark {
- background-color: #3E65FF;
- border-color: #3E65FF;
-}
-
-.checkboxContainer input:checked {
- background: grey;
-}
-
-.checkboxCheckmark:after {
- content: "";
- position: absolute;
- display: none;
-}
-
-.checkboxContainer input:checked ~ .checkboxCheckmark:after {
- display: block;
-}
-
-.checkboxContainer .checkboxCheckmark:after {
- top: 1px;
- left: 4px;
- width: 6px;
- height: 9px;
- border: solid white;
- border-width: 0 1px 1px 0;
- -webkit-transform: rotate(45deg);
- transform: rotate(45deg);
-}
-
-.showcaseRadioContainer {
- display: block;
- position: relative;
- padding-left: 26px;
- margin: 4px 0;
- cursor: pointer;
- font-weight: normal;
- height: 40px;
- padding: 8px 8px 8px 40px;
-}
-
-.themesRadioContainer {
- height: 50px;
-}
-
-.showcaseRadioContainer input {
- position: absolute;
- opacity: 0;
- cursor: pointer;
-}
-
-.showcaseRadioCheckmark {
- position: absolute;
- top: 11px;
- left: 12px;
- height: 16px;
- width: 16px;
- border: none;
- border-radius: 50%;
- border-color: #6E6E6E;
- border-style: solid;
- border-width: 1px;
- transition: all 100ms ease;
- -webkit-transition: all 100ms ease;
-}
-
-.showcaseRadioContainer input:checked ~ .showcaseRadioCheckmark {
- border-color: #3E65FF;
-}
-
-.showcaseRadioCheckmark:after {
- content: "";
- position: absolute;
- display: none;
-}
-
-.showcaseRadioContainer input:checked ~ .showcaseRadioCheckmark:after {
- display: block;
-}
-
-.showcaseRadioContainer .showcaseRadioCheckmark:after {
- top: 3px;
- left: 3px;
- width: 8px;
- height: 8px;
- border-radius: 50%;
- background: #3E65FF;
-}
-
-#bookmarkShare {
- float: right;
- position: relative;
- top: 5px;
-}
-
-#overlay {
- display: none;
- background-color: rgba(0, 0, 0, 0.24);
- position: absolute;
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- top: 0;
- z-index: 11;
-}
-
-#overlay-embed-container {
- background-color:white;
- position: absolute;
- width: 100%;
- height: 100%;
- z-index: 11;
- text-align: center;
- font-family: Segoe UI;
- font-size: 20px;
-}
-
-#overlay-embed-container.overlay-text {
- padding-top: calc(30% - 20px);
-}
-
-#shareDialog {
- display: none;
- position: fixed;
- top: 50%;
- left: 50%;
- width: 320px;
- margin-left: -160px;
- height: 170px;
- margin-top: -75px;
- background-color: #FFFFFF;
- box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.25);
- z-index: 12;
-}
-
-#shareDialog .dialogHeader {
- height: 40px;
-}
-
-#btnCloseDialog {
- float: right;
- position: relative;
- margin: 15px 15px 0 0;
- cursor: pointer;
-}
-
-#btnCloseDialog img {
- width: 14px;
-}
-
-#dialogInput {
- float: left;
- height: 32px;
- border: solid;
- border-width: 2px 0 2px 2px;
- border-color: #3E65FF;
- width: calc(100% - 70px);
- padding: 8px 0 8px 8px;
- outline: none;
- margin-bottom: 32px;
-}
-
-#btnDialogCopy {
- float: left;
- cursor: pointer;
- text-align: center;
- width: 70px;
- height: 32px;
- background-color: #3E65FF;
- color: #FFFFFF;
- padding: 6px;
-}
-
-#btnDialogCopy:hover {
- background-color: #213BD1;
-}
-
-#shareDialog .dialogBody {
- padding: 8px 24px 0px 24px;
- text-align: center;
- font-family: Segoe UI;
- line-height: 18px;
- color: #212121;
-}
-
-.dialogText {
- font-size: 18px;
- line-height: 24px;
-}
-
-.dialogSubText {
- font-size: 12px;
- margin-bottom: 16px;
-}
-
-.floatButton {
- float: left;
- margin-right: 16px;
-}
-
-.showcases-buttons {
- height: 32px;
- margin-top: 16px;
-}
-
-.text-small-tab {
- padding-left: 1em;
-}
-
-.text-tab {
- padding-left: 1.4em;
-}
-
-.active-mode {
- border-bottom: 2px solid #F2C811 !important;
- border-top: 2px solid transparent;
-}
-
-.active-columns-btn {
- border-bottom: 2px solid #F2C811 !important;
- border-top: 2px solid transparent;
-}
-
-.tryShowcase {
- position: relative;
- cursor: pointer;
- font-weight: 500;
- font-size: 8pt;
- margin-left: 3px;
-}
-
-.tryMeText {
- color: #3E65FF;
- margin-left: 1px;
-}
-
-.tryShowcase img {
- width: 12px;
- height: 9px;
- margin: 0 1px;
- position: relative;
- bottom: 1px;
-}
-
-.modeTooltip {
- position: relative;
- float: right;
- bottom: 24px;
-}
-
-.modeTooltip.view {
- right: calc(100% - 115px);
-}
-
-.modeTooltip.edit {
- right: calc(100% - 108px);
-}
-
-.modeTooltip.create {
- right: calc(100% - 125px);
-}
-
-.modeTooltip .tooltipText {
- visibility: hidden;
- width: 246px;
- background-color: #121212;
- color: #F1F1F1;
- text-align: left;
- padding: 4px 12px;
- font-size: 12px;
- top: -2px;
- left: 145%;
- position: absolute;
- z-index: 10;
-}
-
-.modeTooltip .tooltipText.edit {
- width: 200px;
-}
-
-.modeTooltip .tooltipText.create {
- width: 230px;
-}
-
-.modeTooltip:hover .tooltipText {
- visibility: visible;
-}
-
-.modeTooltip .tooltipText::after {
- content: " ";
- position: absolute;
- top: 50%;
- right: 100%;
- margin-top: -5px;
- border-width: 5px;
- border-style: solid;
- border-color: transparent black transparent transparent;
-}
-
-.noOverflow {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
-
-.columnsIcon img {
- height: 24px;
-}
-
-.columnsIcon {
- padding-top: 6px;
- min-width: 95px;
-}
-
-.twoColumnsIcon {
- min-width: 107px;
-}
-
-.themeDataColor {
- margin-right: 3px;
-}
-
-.themeBackgroundColor {
- margin-right: 6px;
- outline: 1px solid #000000;
- cursor: pointer;
- vertical-align: sub;
-}
-
-.themeBackgroundColor.selected {
- outline: 2px solid #F2C811;
-}
-
-#startTooltip, #dialogTooltip {
- opacity: 0;
- transition: opacity 0.5s ease-in-out;
- -webkit-transition: opacity 0.5s ease-in-out;
- position: absolute;
- background-color: #3b3a39;
- width: 300px;
- box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.25);
- z-index: -1;
- padding: 16px 24px;
- top: 0px;
- left: 0px
-}
-
-#dialogTooltip {
- top: 320px;
- left: -12px;
-}
-
-#startTooltip.showTooltip, #dialogTooltip.showTooltip {
- opacity: 1;
- z-index: 15;
-}
-
-#startTooltip::after, #dialogTooltip::after {
- content: " ";
- position: absolute;
- right: calc(50% - 10px);
- top: 100%;
- border-width: 10px;
- border-style: solid;
- border-color: #3b3a39 transparent transparent transparent;
-}
-
-#startTooltip .tooltipNumber {
- float: left;
- margin-left: 16px;
- line-height: 20px;
- font-size: 14px;
- padding: 6px 0px;
- color: #FFFFFF;
-}
-
-.btnCloseTooltip {
- position: absolute;
- right: 16px;
- top: 8px;
-}
-
-.btnCloseTooltip img {
- height: 10px;
- width: 10px;
- cursor: pointer;
-}
-
-.showcaseTooltipText {
- font-weight: 600;
- line-height: 28px;
- font-size: 20px;
- color: #FFFFFF;
- margin-bottom: 8px;
-}
-
-.showcaseTooltipSubText {
- font-style: normal;
- font-weight: normal;
- line-height: 20px;
- font-size: 14px;
- color: #FFFFFF;
-}
-
-.tooltipFooter {
- margin-top: 52px;
- height: 32px;
-}
-
-.btnShowcaseTooltip {
- height: 32px;
- width: 84px;
- text-align: center;
- line-height: 30px;
- font-weight: 600;
- float: left;
- cursor: pointer;
- transition: background-color .2s;
- user-select: none;
- color: #000000;
-}
-
-.yellowBtn {
- background-color: #F2C811;
- border: none !important;
- border-radius: 2px;
-}
-
-.yellowBtn:hover {
- background-color: #ddb612;
-}
-
-.whiteBtn {
- background-color: #FFFFFF;
- border-radius: 2px;
-}
-
-.whiteBtn:hover {
- background-color: #F4F4F4;
-}
-
-#dialogMask {
- position: absolute;
- display: none;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
-}
-
-.insightToActionDialog {
- display: none;
- position: absolute;
- top: 50%;
- left: 50%;
- background-color: #FFFFFF;
- box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.25);
- z-index: 12;
- padding: 16px 24px;
- transform: translate(-50%, -50%);
-}
-
-#distributionDialog {
- width: 952px;
- height: 572px;
-}
-
-#sendDialog {
- width: 600px;
- height: 400px;
-}
-
-#distributionDialog .dialogHeader, #sendDialog .dialogHeader {
- height: 48px;
-}
-
-#distributionDialog .dialogFooter, #sendDialog .dialogFooter {
- position: absolute;
- bottom: 0px;
- left: 0px;
- right: 0px;
- height: 64px;
- padding: 16px 24px;
-}
-
-#distributionDialog .dialogFooter {
- border-top: solid;
- border-width: 1px;
- border-color: #EAEAEA;
-}
-
-#dialogTable {
- height: 425px;
- color: #212121;
- overflow-y: scroll;
- padding-right: 10px;
- margin-bottom: 5px;
-}
-
-#dialogTable::-webkit-scrollbar-track
-{
- border-radius: 10px;
- background-color: transparent;
-}
-
-#dialogTable::-webkit-scrollbar
-{
- width: 6px;
- height: 10px;
- background-color: transparent;
-}
-
-#dialogTable::-webkit-scrollbar-thumb
-{
- border-radius: 10px;
- background-color: #E1E1E1;
-}
-
-.dialogHeaderText {
- font-weight: 600;
- line-height: 28px;
- font-size: 20px;
-}
-
-#btnCloseDistributionDialog {
- float: right;
- position: relative;
- cursor: pointer;
- margin-top: 2px;
-}
-
-.insightToActionDialogBtn {
- float: left;
- width: 110px;
- height: 32px;
- text-align: center;
- line-height: 30px;
- font-weight: 600;
- cursor: pointer;
- transition: background-color .2s;
- user-select: none;
- border: solid;
- border-width: 1px;
- border-color: #6E6E6E;
- margin-right: 8px;
- color: #000000;
-}
-
-.sendBtn {
- float: right;
-}
-
-.cancelBtn {
- float: right;
- margin-right: 0px;
-}
-
-#dialogTable table {
- border-collapse: collapse;
- width: 100%;
-}
-
-#dialogTable th, #dialogTable td {
- padding: 8px;
- text-align: left;
- border-bottom: 1px solid #ddd;
-}
-
-#dialogTable td {
- font-size: 12px;
- color: #666666;
-}
-
-#dialogTable td.nameCell {
- font-size: 14px;
- color: #000000;
-}
-
-.checkAllBtn {
- user-select: none;
-}
-
-.sendDialogField {
- color: #000000;
- font-weight: 500;
- line-height: 20px;
- font-size: 16px;
- padding: 8px 0px;
-}
-
-#sendDialog input[type=text], #sendDialog textarea {
- width: 100%;
- padding: 12px;
- border: 1px solid #cccccc;
- border-radius: 4px;
- resize: none;
-}
-
-#sendDialog textarea {
- height: 130px;
-}
-
-#messageSent {
- transition: opacity 1.5s ease;
- -webkit-transition: opacity 1.5s ease;
- opacity: 0;
- position: absolute;
- z-index: -1;
- left: calc(50% - 34px);
- bottom: 8px;
- width: 68px;
- padding: 2px 6px;
- border: 1px solid #aaaaaa;
- background-color: #000000;
- text-align: center;
- color: #FFFFFF;
-}
-
-#messageSent.show {
- opacity: 1;
- z-index: 5;
-}
-
-#generator-fields, #generator-properties, .title-wrapper {
- margin-top: 8px;
-}
-
-input#ptitle[type="text"] {
- margin-top: 8px;
- border: 1px solid #A19F9D;
- border-radius: 2px;
- height: 32px;
- width: calc(100% - 30px);
- padding-left: 8px;
-}
-
-#btnEraseCustomTitle {
- margin-left: 5px;
- cursor: pointer;
-}
-
-#alignment-blocks-wrapper {
- height: 32px;
- margin-top: 8px;
-}
-
-.alignment-block {
- height: 25px;
- width: 25px;
- padding: 1px 4px;
- margin-right: 6px;
- float: left;
- cursor: pointer;
- user-select: none;
-}
-
-.alignment-block.selected {
- background-color: #F2C811;
-}
-
-.title-wrapper-big {
- margin-top: 12px;
-}
-
-/* Select Menu */
-
-.styled-select {
- position: relative;
- font-family: Segoe UI;
- font-size: 14px;
- line-height: 20px;
-}
-
-.styled-select select {
- display: none; /*hide original SELECT element: */
-}
-
-.inline-select-text, .inline-toggle-text {
- line-height: 32px;
-}
-
-.select-wrapper, .toggle-wrapper {
- height: 32px;
- margin-top: 8px;
-}
-
-.inline-select {
- float: right;
- width: calc(100% - 80px);
-}
-
-.select-selected {
- background-color: #FFFFFF;
-}
-
-/* Style the arrow inside the select element: */
-.select-selected:after {
- position: absolute;
- top: 9px;
- right: 5px;
- display: block;
- content: " ";
- background: url(http://github.com/images/collapse.svg) center left;
- background-repeat: no-repeat;
- height: 16px;
- width: 16px;
-}
-
-/* style the items (options), including the selected item: */
-.select-selected, .select-items div {
- color: #000000;
- padding: 5px 10px;
- border: 1px solid #A19F9D;
- cursor: pointer;
-}
-
-.select-selected {
- border-radius: 2px;
-}
-
-.select-items div {
- border-color: transparent #A19F9D #A19F9D #A19F9D;
-}
-
-.select-items {
- position: absolute;
- background-color: #FFFFFF;
- top: 100%;
- left: 0;
- right: 0;
- z-index: 99;
-}
-
-/* Hide the items when the select box is closed */
-.select-hide {
- display: none;
-}
-
-.select-items div:hover, .same-as-selected {
- background-color: rgba(0, 0, 0, 0.1);
-}
-
-/* Toggle Button */
-
-.inline-toggle-text {
- float: left;
- width: 54px;
-}
-
-/* The switch - the box around the slider */
-.switch {
- position: relative;
- float: left;
- width: 40px;
- height: 20px;
- margin: 7px 0 7px 16px;
-}
-
-/* Hide default HTML checkbox */
-.switch input {
- opacity: 0;
- width: 0;
- height: 0;
-}
-
-/* The slider */
-.slider {
- position: absolute;
- cursor: pointer;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #FFFFFF;
- -webkit-transition: .4s;
- transition: .4s;
-}
-
-.slider:before {
- position: absolute;
- content: "";
- height: 12px;
- width: 12px;
- left: 4px;
- bottom: 3px;
- background-color: #605E5C;
- -webkit-transition: .4s;
- transition: .4s;
-}
-
-input:checked + .slider {
- background-color: #F2C811;
-}
-
-input:checked + .slider:before {
- -webkit-transform: translateX(18px);
- -ms-transform: translateX(18px);
- transform: translateX(18px);
- background-color: #FFFFFF;
-}
-
-/* Rounded sliders */
-.slider.round {
- border-radius: 40px;
- border-color: #605E5C;
- border: 1px solid;
-}
-
-input:checked + .slider.round {
- border-color: #F2C811;
-}
-
-.slider.round:before {
- border-radius: 50%;
-}
-
-.generator-disabled {
- color: #A19F9D;
- pointer-events: none;
-}
-
-.generator-disabled .select-selected {
- color: #A19F9D;
-}
-
-.toggle-wrapper.disabled {
- pointer-events: none;
-}
-
-.generator-disabled .slider, .generator-disabled input:checked + .slider, .toggle-wrapper.disabled input:checked + .slider {
- background-color: #C8C6C4;
- border-color: #C8C6C4;
-}
-
-.generator-disabled .alignment-block.selected {
- background-color: #F3F2F1;
-}
-
-#aligns-disabled, #erase-tool-disabled {
- display: none;
-}
-
-#erase-tool-enabled {
- display: inherit;
-}
-
-.generator-disabled #aligns-enabled, .generator-disabled #erase-tool-enabled {
- display: none;
-}
-
-.generator-disabled #aligns-disabled, .generator-disabled #erase-tool-disabled {
- display: inherit;
-}
-
-#overlay-embed-container #spinner {
- top: calc(50% - 20px);
- right: calc(50% - 60px);
- position: absolute;
- font-size: 14px;
-}
diff --git a/demo/v2-demo/style/syntaxHighlighterOverride.css b/demo/v2-demo/style/syntaxHighlighterOverride.css
deleted file mode 100644
index 4964966e..00000000
--- a/demo/v2-demo/style/syntaxHighlighterOverride.css
+++ /dev/null
@@ -1,7 +0,0 @@
-.syntaxhighlighter {
- overflow: hidden !important;
-}
-
-.syntaxhighlighter .line {
- white-space: pre-wrap !important;
-}
\ No newline at end of file
diff --git a/demo/v2-demo/syntaxHighlighter/syntaxhighlighter.js b/demo/v2-demo/syntaxHighlighter/syntaxhighlighter.js
deleted file mode 100644
index d8f0e63f..00000000
--- a/demo/v2-demo/syntaxHighlighter/syntaxhighlighter.js
+++ /dev/null
@@ -1,3768 +0,0 @@
-/*!
- * SyntaxHighlighter
- * https://github.com/syntaxhighlighter/syntaxhighlighter
- *
- * SyntaxHighlighter is donationware. If you are using it, please donate.
- * http://alexgorbatchev.com/SyntaxHighlighter/donate.html
- *
- * @version
- * 4.0.1 (Tue, 07 Mar 2017 15:42:46 GMT)
- *
- * @copyright
- * Copyright (C) 2004-2016 Alex Gorbatchev.
- *
- * @license
- * Dual licensed under the MIT and GPL licenses.
- */
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-/******/
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _core = __webpack_require__(1);
-
- Object.keys(_core).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _core[key];
- }
- });
- });
-
- var _domready = __webpack_require__(24);
-
- var _domready2 = _interopRequireDefault(_domready);
-
- var _core2 = _interopRequireDefault(_core);
-
- var _dasherize = __webpack_require__(25);
-
- var dasherize = _interopRequireWildcard(_dasherize);
-
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- // configured through the `--compat` parameter.
- if (false) {
- require('./compatibility_layer_v3');
- }
-
- (0, _domready2.default)(function () {
- return _core2.default.highlight(dasherize.object(window.syntaxhighlighterConfig || {}));
- });
-
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var optsParser = __webpack_require__(2),
- match = __webpack_require__(5),
- Renderer = __webpack_require__(9).default,
- utils = __webpack_require__(10),
- transformers = __webpack_require__(11),
- dom = __webpack_require__(17),
- config = __webpack_require__(18),
- defaults = __webpack_require__(19),
- HtmlScript = __webpack_require__(20);
-
- var sh = {
- Match: match.Match,
- Highlighter: __webpack_require__(22),
-
- config: __webpack_require__(18),
- regexLib: __webpack_require__(3).commonRegExp,
-
- /** Internal 'global' variables. */
- vars: {
- discoveredBrushes: null,
- highlighters: {}
- },
-
- /** This object is populated by user included external brush files. */
- brushes: {},
-
- /**
- * Finds all elements on the page which should be processes by SyntaxHighlighter.
- *
- * @param {Object} globalParams Optional parameters which override element's
- * parameters. Only used if element is specified.
- *
- * @param {Object} element Optional element to highlight. If none is
- * provided, all elements in the current document
- * are returned which qualify.
- *
- * @return {Array} Returns list of { target: DOMElement, params: Object } objects.
- */
- findElements: function findElements(globalParams, element) {
- var elements = element ? [element] : utils.toArray(document.getElementsByTagName(sh.config.tagName)),
- conf = sh.config,
- result = [];
-
- // support for feature
- elements = elements.concat(dom.getSyntaxHighlighterScriptTags());
-
- if (elements.length === 0) return result;
-
- for (var i = 0, l = elements.length; i < l; i++) {
- var item = {
- target: elements[i],
- // local params take precedence over globals
- params: optsParser.defaults(optsParser.parse(elements[i].className), globalParams)
- };
-
- if (item.params['brush'] == null) continue;
-
- result.push(item);
- }
-
- return result;
- },
-
- /**
- * Shorthand to highlight all elements on the page that are marked as
- * SyntaxHighlighter source code.
- *
- * @param {Object} globalParams Optional parameters which override element's
- * parameters. Only used if element is specified.
- *
- * @param {Object} element Optional element to highlight. If none is
- * provided, all elements in the current document
- * are highlighted.
- */
- highlight: function highlight(globalParams, element) {
- var elements = sh.findElements(globalParams, element),
- propertyName = 'innerHTML',
- brush = null,
- renderer,
- conf = sh.config;
-
- if (elements.length === 0) return;
-
- for (var i = 0, l = elements.length; i < l; i++) {
- var element = elements[i],
- target = element.target,
- params = element.params,
- brushName = params.brush,
- brush,
- matches,
- code;
-
- if (brushName == null) continue;
-
- brush = findBrush(brushName);
-
- if (!brush) continue;
-
- // local params take precedence over defaults
- params = optsParser.defaults(params || {}, defaults);
- params = optsParser.defaults(params, config);
-
- // Instantiate a brush
- if (params['html-script'] == true || defaults['html-script'] == true) {
- brush = new HtmlScript(findBrush('xml'), brush);
- brushName = 'htmlscript';
- } else {
- brush = new brush();
- }
-
- code = target[propertyName];
-
- // remove CDATA from tags if it's present
- if (conf.useScriptTags) code = stripCData(code);
-
- // Inject title if the attribute is present
- if ((target.title || '') != '') params.title = target.title;
-
- params['brush'] = brushName;
-
- code = transformers(code, params);
- matches = match.applyRegexList(code, brush.regexList, params);
- renderer = new Renderer(code, matches, params);
-
- element = dom.create('div');
- element.innerHTML = renderer.getHtml();
-
- // id = utils.guid();
- // element.id = highlighters.id(id);
- // highlighters.set(id, element);
-
- if (params.quickCode) dom.attachEvent(dom.findElement(element, '.code'), 'dblclick', dom.quickCodeHandler);
-
- // carry over ID
- if ((target.id || '') != '') element.id = target.id;
-
- target.parentNode.replaceChild(element, target);
- }
- }
- }; // end of sh
-
- /**
- * Displays an alert.
- * @param {String} str String to display.
- */
- function alert(str) {
- window.alert('SyntaxHighlighter\n\n' + str);
- };
-
- /**
- * Finds a brush by its alias.
- *
- * @param {String} alias Brush alias.
- * @param {Boolean} showAlert Suppresses the alert if false.
- * @return {Brush} Returns bursh constructor if found, null otherwise.
- */
- function findBrush(alias, showAlert) {
- var brushes = sh.vars.discoveredBrushes,
- result = null;
-
- if (brushes == null) {
- brushes = {};
-
- // Find all brushes
- for (var brushName in sh.brushes) {
- var brush = sh.brushes[brushName],
- aliases = brush.aliases;
-
- if (aliases == null) {
- continue;
- }
-
- brush.className = brush.className || brush.aliases[0];
- brush.brushName = brush.className || brushName.toLowerCase();
-
- for (var i = 0, l = aliases.length; i < l; i++) {
- brushes[aliases[i]] = brushName;
- }
- }
-
- sh.vars.discoveredBrushes = brushes;
- }
-
- result = sh.brushes[brushes[alias]];
-
- if (result == null && showAlert) alert(sh.config.strings.noBrush + alias);
-
- return result;
- };
-
- /**
- * Strips from content because it should be used
- * there in most cases for XHTML compliance.
- * @param {String} original Input code.
- * @return {String} Returns code without leading tags.
- */
- function stripCData(original) {
- var left = '',
-
- // for some reason IE inserts some leading blanks here
- copy = utils.trim(original),
- changed = false,
- leftLength = left.length,
- rightLength = right.length;
-
- if (copy.indexOf(left) == 0) {
- copy = copy.substring(leftLength);
- changed = true;
- }
-
- var copyLength = copy.length;
-
- if (copy.indexOf(right) == copyLength - rightLength) {
- copy = copy.substring(0, copyLength - rightLength);
- changed = true;
- }
-
- return changed ? copy : original;
- };
-
- var brushCounter = 0;
-
- exports.default = sh;
- var registerBrush = exports.registerBrush = function registerBrush(brush) {
- return sh.brushes['brush' + brushCounter++] = brush.default || brush;
- };
- var clearRegisteredBrushes = exports.clearRegisteredBrushes = function clearRegisteredBrushes() {
- sh.brushes = {};
- brushCounter = 0;
- };
-
- /* an EJS hook for `gulp build --brushes` command
- * */
-
- registerBrush(__webpack_require__(23));
-
- /*
-
- */
-
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var XRegExp = __webpack_require__(3).XRegExp;
-
- var BOOLEANS = { 'true': true, 'false': false };
-
- function camelize(key) {
- return key.replace(/-(\w+)/g, function (match, word) {
- return word.charAt(0).toUpperCase() + word.substr(1);
- });
- }
-
- function process(value) {
- var result = BOOLEANS[value];
- return result == null ? value : result;
- }
-
- module.exports = {
- defaults: function defaults(target, source) {
- for (var key in source || {}) {
- if (!target.hasOwnProperty(key)) target[key] = target[camelize(key)] = source[key];
- }return target;
- },
-
- parse: function parse(str) {
- var match,
- key,
- result = {},
- arrayRegex = XRegExp("^\\[(?(.*?))\\]$"),
- pos = 0,
- regex = XRegExp("(?[\\w-]+)" + "\\s*:\\s*" + "(?" + "[\\w%#-]+|" + // word
- "\\[.*?\\]|" + // [] array
- '".*?"|' + // "" string
- "'.*?'" + // '' string
- ")\\s*;?", "g");
-
- while ((match = XRegExp.exec(str, regex, pos)) != null) {
- var value = match.value.replace(/^['"]|['"]$/g, '') // strip quotes from end of strings
- ;
-
- // try to parse array value
- if (value != null && arrayRegex.test(value)) {
- var m = XRegExp.exec(value, arrayRegex);
- value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : [];
- }
-
- value = process(value);
- result[match.name] = result[camelize(match.name)] = value;
- pos = match.index + match[0].length;
- }
-
- return result;
- }
- };
-
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.commonRegExp = exports.XRegExp = undefined;
-
- var _xregexp = __webpack_require__(4);
-
- var _xregexp2 = _interopRequireDefault(_xregexp);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- exports.XRegExp = _xregexp2.default;
- var commonRegExp = exports.commonRegExp = {
- multiLineCComments: (0, _xregexp2.default)('/\\*.*?\\*/', 'gs'),
- singleLineCComments: /\/\/.*$/gm,
- singleLinePerlComments: /#.*$/gm,
- doubleQuotedString: /"([^\\"\n]|\\.)*"/g,
- singleQuotedString: /'([^\\'\n]|\\.)*'/g,
- multiLineDoubleQuotedString: (0, _xregexp2.default)('"([^\\\\"]|\\\\.)*"', 'gs'),
- multiLineSingleQuotedString: (0, _xregexp2.default)("'([^\\\\']|\\\\.)*'", 'gs'),
- xmlComments: (0, _xregexp2.default)('(<|<)!--.*?--(>|>)', 'gs'),
- url: /\w+:\/\/[\w-.\/?%&=:@;#]*/g,
- phpScriptTags: { left: /(<|<)\?(?:=|php)?/g, right: /\?(>|>)/g, 'eof': true },
- aspScriptTags: { left: /(<|<)%=?/g, right: /%(>|>)/g },
- scriptScriptTags: { left: /(<|<)\s*script.*?(>|>)/gi, right: /(<|<)\/\s*script\s*(>|>)/gi }
- };
-
-/***/ },
-/* 4 */
-/***/ function(module, exports) {
-
- /*!
- * XRegExp 3.1.0-dev
- *
- * Steven Levithan (c) 2007-2015 MIT License
- */
-
- /**
- * XRegExp provides augmented, extensible regular expressions. You get additional regex syntax and
- * flags, beyond what browsers support natively. XRegExp is also a regex utility belt with tools to
- * make your client-side grepping simpler and more powerful, while freeing you from related
- * cross-browser inconsistencies.
- */
-
- 'use strict';
-
- /* ==============================
- * Private variables
- * ============================== */
-
- // Property name used for extended regex instance data
-
- var REGEX_DATA = 'xregexp';
- // Optional features that can be installed and uninstalled
- var features = {
- astral: false,
- natives: false
- };
- // Native methods to use and restore ('native' is an ES3 reserved keyword)
- var nativ = {
- exec: RegExp.prototype.exec,
- test: RegExp.prototype.test,
- match: String.prototype.match,
- replace: String.prototype.replace,
- split: String.prototype.split
- };
- // Storage for fixed/extended native methods
- var fixed = {};
- // Storage for regexes cached by `XRegExp.cache`
- var regexCache = {};
- // Storage for pattern details cached by the `XRegExp` constructor
- var patternCache = {};
- // Storage for regex syntax tokens added internally or by `XRegExp.addToken`
- var tokens = [];
- // Token scopes
- var defaultScope = 'default';
- var classScope = 'class';
- // Regexes that match native regex syntax, including octals
- var nativeTokens = {
- // Any native multicharacter token in default scope, or any single character
- 'default': /\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9]\d*|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|\(\?[:=!]|[?*+]\?|{\d+(?:,\d*)?}\??|[\s\S]/,
- // Any native multicharacter token in character class scope, or any single character
- 'class': /\\(?:[0-3][0-7]{0,2}|[4-7][0-7]?|x[\dA-Fa-f]{2}|u(?:[\dA-Fa-f]{4}|{[\dA-Fa-f]+})|c[A-Za-z]|[\s\S])|[\s\S]/
- };
- // Any backreference or dollar-prefixed character in replacement strings
- var replacementToken = /\$(?:{([\w$]+)}|(\d\d?|[\s\S]))/g;
- // Check for correct `exec` handling of nonparticipating capturing groups
- var correctExecNpcg = nativ.exec.call(/()??/, '')[1] === undefined;
- // Check for ES6 `u` flag support
- var hasNativeU = function () {
- var isSupported = true;
- try {
- new RegExp('', 'u');
- } catch (exception) {
- isSupported = false;
- }
- return isSupported;
- }();
- // Check for ES6 `y` flag support
- var hasNativeY = function () {
- var isSupported = true;
- try {
- new RegExp('', 'y');
- } catch (exception) {
- isSupported = false;
- }
- return isSupported;
- }();
- // Check for ES6 `flags` prop support
- var hasFlagsProp = /a/.flags !== undefined;
- // Tracker for known flags, including addon flags
- var registeredFlags = {
- g: true,
- i: true,
- m: true,
- u: hasNativeU,
- y: hasNativeY
- };
- // Shortcut to `Object.prototype.toString`
- var toString = {}.toString;
-
- /* ==============================
- * Private functions
- * ============================== */
-
- /**
- * Attaches extended data and `XRegExp.prototype` properties to a regex object.
- *
- * @private
- * @param {RegExp} regex Regex to augment.
- * @param {Array} captureNames Array with capture names, or `null`.
- * @param {String} xSource XRegExp pattern used to generate `regex`, or `null` if N/A.
- * @param {String} xFlags XRegExp flags used to generate `regex`, or `null` if N/A.
- * @param {Boolean} [isInternalOnly=false] Whether the regex will be used only for internal
- * operations, and never exposed to users. For internal-only regexes, we can improve perf by
- * skipping some operations like attaching `XRegExp.prototype` properties.
- * @returns {RegExp} Augmented regex.
- */
- function augment(regex, captureNames, xSource, xFlags, isInternalOnly) {
- var p;
-
- regex[REGEX_DATA] = {
- captureNames: captureNames
- };
-
- if (isInternalOnly) {
- return regex;
- }
-
- // Can't auto-inherit these since the XRegExp constructor returns a nonprimitive value
- if (regex.__proto__) {
- regex.__proto__ = XRegExp.prototype;
- } else {
- for (p in XRegExp.prototype) {
- // An `XRegExp.prototype.hasOwnProperty(p)` check wouldn't be worth it here, since
- // this is performance sensitive, and enumerable `Object.prototype` or
- // `RegExp.prototype` extensions exist on `regex.prototype` anyway
- regex[p] = XRegExp.prototype[p];
- }
- }
-
- regex[REGEX_DATA].source = xSource;
- // Emulate the ES6 `flags` prop by ensuring flags are in alphabetical order
- regex[REGEX_DATA].flags = xFlags ? xFlags.split('').sort().join('') : xFlags;
-
- return regex;
- }
-
- /**
- * Removes any duplicate characters from the provided string.
- *
- * @private
- * @param {String} str String to remove duplicate characters from.
- * @returns {String} String with any duplicate characters removed.
- */
- function clipDuplicates(str) {
- return nativ.replace.call(str, /([\s\S])(?=[\s\S]*\1)/g, '');
- }
-
- /**
- * Copies a regex object while preserving extended data and augmenting with `XRegExp.prototype`
- * properties. The copy has a fresh `lastIndex` property (set to zero). Allows adding and removing
- * flags g and y while copying the regex.
- *
- * @private
- * @param {RegExp} regex Regex to copy.
- * @param {Object} [options] Options object with optional properties:
- * `addG` {Boolean} Add flag g while copying the regex.
- * `addY` {Boolean} Add flag y while copying the regex.
- * `removeG` {Boolean} Remove flag g while copying the regex.
- * `removeY` {Boolean} Remove flag y while copying the regex.
- * `isInternalOnly` {Boolean} Whether the copied regex will be used only for internal
- * operations, and never exposed to users. For internal-only regexes, we can improve perf by
- * skipping some operations like attaching `XRegExp.prototype` properties.
- * @returns {RegExp} Copy of the provided regex, possibly with modified flags.
- */
- function copyRegex(regex, options) {
- if (!XRegExp.isRegExp(regex)) {
- throw new TypeError('Type RegExp expected');
- }
-
- var xData = regex[REGEX_DATA] || {},
- flags = getNativeFlags(regex),
- flagsToAdd = '',
- flagsToRemove = '',
- xregexpSource = null,
- xregexpFlags = null;
-
- options = options || {};
-
- if (options.removeG) {
- flagsToRemove += 'g';
- }
- if (options.removeY) {
- flagsToRemove += 'y';
- }
- if (flagsToRemove) {
- flags = nativ.replace.call(flags, new RegExp('[' + flagsToRemove + ']+', 'g'), '');
- }
-
- if (options.addG) {
- flagsToAdd += 'g';
- }
- if (options.addY) {
- flagsToAdd += 'y';
- }
- if (flagsToAdd) {
- flags = clipDuplicates(flags + flagsToAdd);
- }
-
- if (!options.isInternalOnly) {
- if (xData.source !== undefined) {
- xregexpSource = xData.source;
- }
- // null or undefined; don't want to add to `flags` if the previous value was null, since
- // that indicates we're not tracking original precompilation flags
- if (xData.flags != null) {
- // Flags are only added for non-internal regexes by `XRegExp.globalize`. Flags are
- // never removed for non-internal regexes, so don't need to handle it
- xregexpFlags = flagsToAdd ? clipDuplicates(xData.flags + flagsToAdd) : xData.flags;
- }
- }
-
- // Augment with `XRegExp.prototype` properties, but use the native `RegExp` constructor to
- // avoid searching for special tokens. That would be wrong for regexes constructed by
- // `RegExp`, and unnecessary for regexes constructed by `XRegExp` because the regex has
- // already undergone the translation to native regex syntax
- regex = augment(new RegExp(regex.source, flags), hasNamedCapture(regex) ? xData.captureNames.slice(0) : null, xregexpSource, xregexpFlags, options.isInternalOnly);
-
- return regex;
- }
-
- /**
- * Converts hexadecimal to decimal.
- *
- * @private
- * @param {String} hex
- * @returns {Number}
- */
- function dec(hex) {
- return parseInt(hex, 16);
- }
-
- /**
- * Returns native `RegExp` flags used by a regex object.
- *
- * @private
- * @param {RegExp} regex Regex to check.
- * @returns {String} Native flags in use.
- */
- function getNativeFlags(regex) {
- return hasFlagsProp ? regex.flags :
- // Explicitly using `RegExp.prototype.toString` (rather than e.g. `String` or
- // concatenation with an empty string) allows this to continue working predictably when
- // `XRegExp.proptotype.toString` is overriden
- nativ.exec.call(/\/([a-z]*)$/i, RegExp.prototype.toString.call(regex))[1];
- }
-
- /**
- * Determines whether a regex has extended instance data used to track capture names.
- *
- * @private
- * @param {RegExp} regex Regex to check.
- * @returns {Boolean} Whether the regex uses named capture.
- */
- function hasNamedCapture(regex) {
- return !!(regex[REGEX_DATA] && regex[REGEX_DATA].captureNames);
- }
-
- /**
- * Converts decimal to hexadecimal.
- *
- * @private
- * @param {Number|String} dec
- * @returns {String}
- */
- function hex(dec) {
- return parseInt(dec, 10).toString(16);
- }
-
- /**
- * Returns the first index at which a given value can be found in an array.
- *
- * @private
- * @param {Array} array Array to search.
- * @param {*} value Value to locate in the array.
- * @returns {Number} Zero-based index at which the item is found, or -1.
- */
- function indexOf(array, value) {
- var len = array.length,
- i;
-
- for (i = 0; i < len; ++i) {
- if (array[i] === value) {
- return i;
- }
- }
-
- return -1;
- }
-
- /**
- * Determines whether a value is of the specified type, by resolving its internal [[Class]].
- *
- * @private
- * @param {*} value Object to check.
- * @param {String} type Type to check for, in TitleCase.
- * @returns {Boolean} Whether the object matches the type.
- */
- function isType(value, type) {
- return toString.call(value) === '[object ' + type + ']';
- }
-
- /**
- * Checks whether the next nonignorable token after the specified position is a quantifier.
- *
- * @private
- * @param {String} pattern Pattern to search within.
- * @param {Number} pos Index in `pattern` to search at.
- * @param {String} flags Flags used by the pattern.
- * @returns {Boolean} Whether the next token is a quantifier.
- */
- function isQuantifierNext(pattern, pos, flags) {
- return nativ.test.call(flags.indexOf('x') > -1 ?
- // Ignore any leading whitespace, line comments, and inline comments
- /^(?:\s+|#.*|\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/ :
- // Ignore any leading inline comments
- /^(?:\(\?#[^)]*\))*(?:[?*+]|{\d+(?:,\d*)?})/, pattern.slice(pos));
- }
-
- /**
- * Pads the provided string with as many leading zeros as needed to get to length 4. Used to produce
- * fixed-length hexadecimal values.
- *
- * @private
- * @param {String} str
- * @returns {String}
- */
- function pad4(str) {
- while (str.length < 4) {
- str = '0' + str;
- }
- return str;
- }
-
- /**
- * Checks for flag-related errors, and strips/applies flags in a leading mode modifier. Offloads
- * the flag preparation logic from the `XRegExp` constructor.
- *
- * @private
- * @param {String} pattern Regex pattern, possibly with a leading mode modifier.
- * @param {String} flags Any combination of flags.
- * @returns {Object} Object with properties `pattern` and `flags`.
- */
- function prepareFlags(pattern, flags) {
- var i;
-
- // Recent browsers throw on duplicate flags, so copy this behavior for nonnative flags
- if (clipDuplicates(flags) !== flags) {
- throw new SyntaxError('Invalid duplicate regex flag ' + flags);
- }
-
- // Strip and apply a leading mode modifier with any combination of flags except g or y
- pattern = nativ.replace.call(pattern, /^\(\?([\w$]+)\)/, function ($0, $1) {
- if (nativ.test.call(/[gy]/, $1)) {
- throw new SyntaxError('Cannot use flag g or y in mode modifier ' + $0);
- }
- // Allow duplicate flags within the mode modifier
- flags = clipDuplicates(flags + $1);
- return '';
- });
-
- // Throw on unknown native or nonnative flags
- for (i = 0; i < flags.length; ++i) {
- if (!registeredFlags[flags.charAt(i)]) {
- throw new SyntaxError('Unknown regex flag ' + flags.charAt(i));
- }
- }
-
- return {
- pattern: pattern,
- flags: flags
- };
- }
-
- /**
- * Prepares an options object from the given value.
- *
- * @private
- * @param {String|Object} value Value to convert to an options object.
- * @returns {Object} Options object.
- */
- function prepareOptions(value) {
- var options = {};
-
- if (isType(value, 'String')) {
- XRegExp.forEach(value, /[^\s,]+/, function (match) {
- options[match] = true;
- });
-
- return options;
- }
-
- return value;
- }
-
- /**
- * Registers a flag so it doesn't throw an 'unknown flag' error.
- *
- * @private
- * @param {String} flag Single-character flag to register.
- */
- function registerFlag(flag) {
- if (!/^[\w$]$/.test(flag)) {
- throw new Error('Flag must be a single character A-Za-z0-9_$');
- }
-
- registeredFlags[flag] = true;
- }
-
- /**
- * Runs built-in and custom regex syntax tokens in reverse insertion order at the specified
- * position, until a match is found.
- *
- * @private
- * @param {String} pattern Original pattern from which an XRegExp object is being built.
- * @param {String} flags Flags being used to construct the regex.
- * @param {Number} pos Position to search for tokens within `pattern`.
- * @param {Number} scope Regex scope to apply: 'default' or 'class'.
- * @param {Object} context Context object to use for token handler functions.
- * @returns {Object} Object with properties `matchLength`, `output`, and `reparse`; or `null`.
- */
- function runTokens(pattern, flags, pos, scope, context) {
- var i = tokens.length,
- leadChar = pattern.charAt(pos),
- result = null,
- match,
- t;
-
- // Run in reverse insertion order
- while (i--) {
- t = tokens[i];
- if (t.leadChar && t.leadChar !== leadChar || t.scope !== scope && t.scope !== 'all' || t.flag && flags.indexOf(t.flag) === -1) {
- continue;
- }
-
- match = XRegExp.exec(pattern, t.regex, pos, 'sticky');
- if (match) {
- result = {
- matchLength: match[0].length,
- output: t.handler.call(context, match, scope, flags),
- reparse: t.reparse
- };
- // Finished with token tests
- break;
- }
- }
-
- return result;
- }
-
- /**
- * Enables or disables implicit astral mode opt-in. When enabled, flag A is automatically added to
- * all new regexes created by XRegExp. This causes an error to be thrown when creating regexes if
- * the Unicode Base addon is not available, since flag A is registered by that addon.
- *
- * @private
- * @param {Boolean} on `true` to enable; `false` to disable.
- */
- function setAstral(on) {
- features.astral = on;
- }
-
- /**
- * Enables or disables native method overrides.
- *
- * @private
- * @param {Boolean} on `true` to enable; `false` to disable.
- */
- function setNatives(on) {
- RegExp.prototype.exec = (on ? fixed : nativ).exec;
- RegExp.prototype.test = (on ? fixed : nativ).test;
- String.prototype.match = (on ? fixed : nativ).match;
- String.prototype.replace = (on ? fixed : nativ).replace;
- String.prototype.split = (on ? fixed : nativ).split;
-
- features.natives = on;
- }
-
- /**
- * Returns the object, or throws an error if it is `null` or `undefined`. This is used to follow
- * the ES5 abstract operation `ToObject`.
- *
- * @private
- * @param {*} value Object to check and return.
- * @returns {*} The provided object.
- */
- function toObject(value) {
- // null or undefined
- if (value == null) {
- throw new TypeError('Cannot convert null or undefined to object');
- }
-
- return value;
- }
-
- /* ==============================
- * Constructor
- * ============================== */
-
- /**
- * Creates an extended regular expression object for matching text with a pattern. Differs from a
- * native regular expression in that additional syntax and flags are supported. The returned object
- * is in fact a native `RegExp` and works with all native methods.
- *
- * @class XRegExp
- * @constructor
- * @param {String|RegExp} pattern Regex pattern string, or an existing regex object to copy.
- * @param {String} [flags] Any combination of flags.
- * Native flags:
- * `g` - global
- * `i` - ignore case
- * `m` - multiline anchors
- * `u` - unicode (ES6)
- * `y` - sticky (Firefox 3+, ES6)
- * Additional XRegExp flags:
- * `n` - explicit capture
- * `s` - dot matches all (aka singleline)
- * `x` - free-spacing and line comments (aka extended)
- * `A` - astral (requires the Unicode Base addon)
- * Flags cannot be provided when constructing one `RegExp` from another.
- * @returns {RegExp} Extended regular expression object.
- * @example
- *
- * // With named capture and flag x
- * XRegExp('(? [0-9]{4} ) -? # year \n\
- * (? [0-9]{2} ) -? # month \n\
- * (? [0-9]{2} ) # day ', 'x');
- *
- * // Providing a regex object copies it. Native regexes are recompiled using native (not XRegExp)
- * // syntax. Copies maintain extended data, are augmented with `XRegExp.prototype` properties, and
- * // have fresh `lastIndex` properties (set to zero).
- * XRegExp(/regex/);
- */
- function XRegExp(pattern, flags) {
- var context = {
- hasNamedCapture: false,
- captureNames: []
- },
- scope = defaultScope,
- output = '',
- pos = 0,
- result,
- token,
- generated,
- appliedPattern,
- appliedFlags;
-
- if (XRegExp.isRegExp(pattern)) {
- if (flags !== undefined) {
- throw new TypeError('Cannot supply flags when copying a RegExp');
- }
- return copyRegex(pattern);
- }
-
- // Copy the argument behavior of `RegExp`
- pattern = pattern === undefined ? '' : String(pattern);
- flags = flags === undefined ? '' : String(flags);
-
- if (XRegExp.isInstalled('astral') && flags.indexOf('A') === -1) {
- // This causes an error to be thrown if the Unicode Base addon is not available
- flags += 'A';
- }
-
- if (!patternCache[pattern]) {
- patternCache[pattern] = {};
- }
-
- if (!patternCache[pattern][flags]) {
- // Check for flag-related errors, and strip/apply flags in a leading mode modifier
- result = prepareFlags(pattern, flags);
- appliedPattern = result.pattern;
- appliedFlags = result.flags;
-
- // Use XRegExp's tokens to translate the pattern to a native regex pattern.
- // `appliedPattern.length` may change on each iteration if tokens use `reparse`
- while (pos < appliedPattern.length) {
- do {
- // Check for custom tokens at the current position
- result = runTokens(appliedPattern, appliedFlags, pos, scope, context);
- // If the matched token used the `reparse` option, splice its output into the
- // pattern before running tokens again at the same position
- if (result && result.reparse) {
- appliedPattern = appliedPattern.slice(0, pos) + result.output + appliedPattern.slice(pos + result.matchLength);
- }
- } while (result && result.reparse);
-
- if (result) {
- output += result.output;
- pos += result.matchLength || 1;
- } else {
- // Get the native token at the current position
- token = XRegExp.exec(appliedPattern, nativeTokens[scope], pos, 'sticky')[0];
- output += token;
- pos += token.length;
- if (token === '[' && scope === defaultScope) {
- scope = classScope;
- } else if (token === ']' && scope === classScope) {
- scope = defaultScope;
- }
- }
- }
-
- patternCache[pattern][flags] = {
- // Cleanup token cruft: repeated `(?:)(?:)` and leading/trailing `(?:)`
- pattern: nativ.replace.call(output, /\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??(?=\(\?:\))|^\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??|\(\?:\)(?:[*+?]|\{\d+(?:,\d*)?})?\??$/g, ''),
- // Strip all but native flags
- flags: nativ.replace.call(appliedFlags, /[^gimuy]+/g, ''),
- // `context.captureNames` has an item for each capturing group, even if unnamed
- captures: context.hasNamedCapture ? context.captureNames : null
- };
- }
-
- generated = patternCache[pattern][flags];
- return augment(new RegExp(generated.pattern, generated.flags), generated.captures, pattern, flags);
- };
-
- // Add `RegExp.prototype` to the prototype chain
- XRegExp.prototype = new RegExp();
-
- /* ==============================
- * Public properties
- * ============================== */
-
- /**
- * The XRegExp version number as a string containing three dot-separated parts. For example,
- * '2.0.0-beta-3'.
- *
- * @static
- * @memberOf XRegExp
- * @type String
- */
- XRegExp.version = '3.1.0-dev';
-
- /* ==============================
- * Public methods
- * ============================== */
-
- /**
- * Extends XRegExp syntax and allows custom flags. This is used internally and can be used to
- * create XRegExp addons. If more than one token can match the same string, the last added wins.
- *
- * @memberOf XRegExp
- * @param {RegExp} regex Regex object that matches the new token.
- * @param {Function} handler Function that returns a new pattern string (using native regex syntax)
- * to replace the matched token within all future XRegExp regexes. Has access to persistent
- * properties of the regex being built, through `this`. Invoked with three arguments:
- * The match array, with named backreference properties.
- * The regex scope where the match was found: 'default' or 'class'.
- * The flags used by the regex, including any flags in a leading mode modifier.
- * The handler function becomes part of the XRegExp construction process, so be careful not to
- * construct XRegExps within the function or you will trigger infinite recursion.
- * @param {Object} [options] Options object with optional properties:
- * `scope` {String} Scope where the token applies: 'default', 'class', or 'all'.
- * `flag` {String} Single-character flag that triggers the token. This also registers the
- * flag, which prevents XRegExp from throwing an 'unknown flag' error when the flag is used.
- * `optionalFlags` {String} Any custom flags checked for within the token `handler` that are
- * not required to trigger the token. This registers the flags, to prevent XRegExp from
- * throwing an 'unknown flag' error when any of the flags are used.
- * `reparse` {Boolean} Whether the `handler` function's output should not be treated as
- * final, and instead be reparseable by other tokens (including the current token). Allows
- * token chaining or deferring.
- * `leadChar` {String} Single character that occurs at the beginning of any successful match
- * of the token (not always applicable). This doesn't change the behavior of the token unless
- * you provide an erroneous value. However, providing it can increase the token's performance
- * since the token can be skipped at any positions where this character doesn't appear.
- * @example
- *
- * // Basic usage: Add \a for the ALERT control code
- * XRegExp.addToken(
- * /\\a/,
- * function() {return '\\x07';},
- * {scope: 'all'}
- * );
- * XRegExp('\\a[\\a-\\n]+').test('\x07\n\x07'); // -> true
- *
- * // Add the U (ungreedy) flag from PCRE and RE2, which reverses greedy and lazy quantifiers.
- * // Since `scope` is not specified, it uses 'default' (i.e., transformations apply outside of
- * // character classes only)
- * XRegExp.addToken(
- * /([?*+]|{\d+(?:,\d*)?})(\??)/,
- * function(match) {return match[1] + (match[2] ? '' : '?');},
- * {flag: 'U'}
- * );
- * XRegExp('a+', 'U').exec('aaa')[0]; // -> 'a'
- * XRegExp('a+?', 'U').exec('aaa')[0]; // -> 'aaa'
- */
- XRegExp.addToken = function (regex, handler, options) {
- options = options || {};
- var optionalFlags = options.optionalFlags,
- i;
-
- if (options.flag) {
- registerFlag(options.flag);
- }
-
- if (optionalFlags) {
- optionalFlags = nativ.split.call(optionalFlags, '');
- for (i = 0; i < optionalFlags.length; ++i) {
- registerFlag(optionalFlags[i]);
- }
- }
-
- // Add to the private list of syntax tokens
- tokens.push({
- regex: copyRegex(regex, {
- addG: true,
- addY: hasNativeY,
- isInternalOnly: true
- }),
- handler: handler,
- scope: options.scope || defaultScope,
- flag: options.flag,
- reparse: options.reparse,
- leadChar: options.leadChar
- });
-
- // Reset the pattern cache used by the `XRegExp` constructor, since the same pattern and
- // flags might now produce different results
- XRegExp.cache.flush('patterns');
- };
-
- /**
- * Caches and returns the result of calling `XRegExp(pattern, flags)`. On any subsequent call with
- * the same pattern and flag combination, the cached copy of the regex is returned.
- *
- * @memberOf XRegExp
- * @param {String} pattern Regex pattern string.
- * @param {String} [flags] Any combination of XRegExp flags.
- * @returns {RegExp} Cached XRegExp object.
- * @example
- *
- * while (match = XRegExp.cache('.', 'gs').exec(str)) {
- * // The regex is compiled once only
- * }
- */
- XRegExp.cache = function (pattern, flags) {
- if (!regexCache[pattern]) {
- regexCache[pattern] = {};
- }
- return regexCache[pattern][flags] || (regexCache[pattern][flags] = XRegExp(pattern, flags));
- };
-
- // Intentionally undocumented
- XRegExp.cache.flush = function (cacheName) {
- if (cacheName === 'patterns') {
- // Flush the pattern cache used by the `XRegExp` constructor
- patternCache = {};
- } else {
- // Flush the regex cache populated by `XRegExp.cache`
- regexCache = {};
- }
- };
-
- /**
- * Escapes any regular expression metacharacters, for use when matching literal strings. The result
- * can safely be used at any point within a regex that uses any flags.
- *
- * @memberOf XRegExp
- * @param {String} str String to escape.
- * @returns {String} String with regex metacharacters escaped.
- * @example
- *
- * XRegExp.escape('Escaped? <.>');
- * // -> 'Escaped\?\ <\.>'
- */
- XRegExp.escape = function (str) {
- return nativ.replace.call(toObject(str), /[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
- };
-
- /**
- * Executes a regex search in a specified string. Returns a match array or `null`. If the provided
- * regex uses named capture, named backreference properties are included on the match array.
- * Optional `pos` and `sticky` arguments specify the search start position, and whether the match
- * must start at the specified position only. The `lastIndex` property of the provided regex is not
- * used, but is updated for compatibility. Also fixes browser bugs compared to the native
- * `RegExp.prototype.exec` and can be used reliably cross-browser.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp} regex Regex to search with.
- * @param {Number} [pos=0] Zero-based index at which to start the search.
- * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position
- * only. The string `'sticky'` is accepted as an alternative to `true`.
- * @returns {Array} Match array with named backreference properties, or `null`.
- * @example
- *
- * // Basic use, with named backreference
- * var match = XRegExp.exec('U+2620', XRegExp('U\\+(?[0-9A-F]{4})'));
- * match.hex; // -> '2620'
- *
- * // With pos and sticky, in a loop
- * var pos = 2, result = [], match;
- * while (match = XRegExp.exec('<1><2><3><4>5<6>', /<(\d)>/, pos, 'sticky')) {
- * result.push(match[1]);
- * pos = match.index + match[0].length;
- * }
- * // result -> ['2', '3', '4']
- */
- XRegExp.exec = function (str, regex, pos, sticky) {
- var cacheKey = 'g',
- addY = false,
- match,
- r2;
-
- addY = hasNativeY && !!(sticky || regex.sticky && sticky !== false);
- if (addY) {
- cacheKey += 'y';
- }
-
- regex[REGEX_DATA] = regex[REGEX_DATA] || {};
-
- // Shares cached copies with `XRegExp.match`/`replace`
- r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
- addG: true,
- addY: addY,
- removeY: sticky === false,
- isInternalOnly: true
- }));
-
- r2.lastIndex = pos = pos || 0;
-
- // Fixed `exec` required for `lastIndex` fix, named backreferences, etc.
- match = fixed.exec.call(r2, str);
-
- if (sticky && match && match.index !== pos) {
- match = null;
- }
-
- if (regex.global) {
- regex.lastIndex = match ? r2.lastIndex : 0;
- }
-
- return match;
- };
-
- /**
- * Executes a provided function once per regex match. Searches always start at the beginning of the
- * string and continue until the end, regardless of the state of the regex's `global` property and
- * initial `lastIndex`.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp} regex Regex to search with.
- * @param {Function} callback Function to execute for each match. Invoked with four arguments:
- * The match array, with named backreference properties.
- * The zero-based match index.
- * The string being traversed.
- * The regex object being used to traverse the string.
- * @example
- *
- * // Extracts every other digit from a string
- * var evens = [];
- * XRegExp.forEach('1a2345', /\d/, function(match, i) {
- * if (i % 2) evens.push(+match[0]);
- * });
- * // evens -> [2, 4]
- */
- XRegExp.forEach = function (str, regex, callback) {
- var pos = 0,
- i = -1,
- match;
-
- while (match = XRegExp.exec(str, regex, pos)) {
- // Because `regex` is provided to `callback`, the function could use the deprecated/
- // nonstandard `RegExp.prototype.compile` to mutate the regex. However, since
- // `XRegExp.exec` doesn't use `lastIndex` to set the search position, this can't lead
- // to an infinite loop, at least. Actually, because of the way `XRegExp.exec` caches
- // globalized versions of regexes, mutating the regex will not have any effect on the
- // iteration or matched strings, which is a nice side effect that brings extra safety
- callback(match, ++i, str, regex);
-
- pos = match.index + (match[0].length || 1);
- }
- };
-
- /**
- * Copies a regex object and adds flag `g`. The copy maintains extended data, is augmented with
- * `XRegExp.prototype` properties, and has a fresh `lastIndex` property (set to zero). Native
- * regexes are not recompiled using XRegExp syntax.
- *
- * @memberOf XRegExp
- * @param {RegExp} regex Regex to globalize.
- * @returns {RegExp} Copy of the provided regex with flag `g` added.
- * @example
- *
- * var globalCopy = XRegExp.globalize(/regex/);
- * globalCopy.global; // -> true
- */
- XRegExp.globalize = function (regex) {
- return copyRegex(regex, { addG: true });
- };
-
- /**
- * Installs optional features according to the specified options. Can be undone using
- * {@link #XRegExp.uninstall}.
- *
- * @memberOf XRegExp
- * @param {Object|String} options Options object or string.
- * @example
- *
- * // With an options object
- * XRegExp.install({
- * // Enables support for astral code points in Unicode addons (implicitly sets flag A)
- * astral: true,
- *
- * // Overrides native regex methods with fixed/extended versions that support named
- * // backreferences and fix numerous cross-browser bugs
- * natives: true
- * });
- *
- * // With an options string
- * XRegExp.install('astral natives');
- */
- XRegExp.install = function (options) {
- options = prepareOptions(options);
-
- if (!features.astral && options.astral) {
- setAstral(true);
- }
-
- if (!features.natives && options.natives) {
- setNatives(true);
- }
- };
-
- /**
- * Checks whether an individual optional feature is installed.
- *
- * @memberOf XRegExp
- * @param {String} feature Name of the feature to check. One of:
- * `natives`
- * `astral`
- * @returns {Boolean} Whether the feature is installed.
- * @example
- *
- * XRegExp.isInstalled('natives');
- */
- XRegExp.isInstalled = function (feature) {
- return !!features[feature];
- };
-
- /**
- * Returns `true` if an object is a regex; `false` if it isn't. This works correctly for regexes
- * created in another frame, when `instanceof` and `constructor` checks would fail.
- *
- * @memberOf XRegExp
- * @param {*} value Object to check.
- * @returns {Boolean} Whether the object is a `RegExp` object.
- * @example
- *
- * XRegExp.isRegExp('string'); // -> false
- * XRegExp.isRegExp(/regex/i); // -> true
- * XRegExp.isRegExp(RegExp('^', 'm')); // -> true
- * XRegExp.isRegExp(XRegExp('(?s).')); // -> true
- */
- XRegExp.isRegExp = function (value) {
- return toString.call(value) === '[object RegExp]';
- //return isType(value, 'RegExp');
- };
-
- /**
- * Returns the first matched string, or in global mode, an array containing all matched strings.
- * This is essentially a more convenient re-implementation of `String.prototype.match` that gives
- * the result types you actually want (string instead of `exec`-style array in match-first mode,
- * and an empty array instead of `null` when no matches are found in match-all mode). It also lets
- * you override flag g and ignore `lastIndex`, and fixes browser bugs.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp} regex Regex to search with.
- * @param {String} [scope='one'] Use 'one' to return the first match as a string. Use 'all' to
- * return an array of all matched strings. If not explicitly specified and `regex` uses flag g,
- * `scope` is 'all'.
- * @returns {String|Array} In match-first mode: First match as a string, or `null`. In match-all
- * mode: Array of all matched strings, or an empty array.
- * @example
- *
- * // Match first
- * XRegExp.match('abc', /\w/); // -> 'a'
- * XRegExp.match('abc', /\w/g, 'one'); // -> 'a'
- * XRegExp.match('abc', /x/g, 'one'); // -> null
- *
- * // Match all
- * XRegExp.match('abc', /\w/g); // -> ['a', 'b', 'c']
- * XRegExp.match('abc', /\w/, 'all'); // -> ['a', 'b', 'c']
- * XRegExp.match('abc', /x/, 'all'); // -> []
- */
- XRegExp.match = function (str, regex, scope) {
- var global = regex.global && scope !== 'one' || scope === 'all',
- cacheKey = (global ? 'g' : '') + (regex.sticky ? 'y' : '') || 'noGY',
- result,
- r2;
-
- regex[REGEX_DATA] = regex[REGEX_DATA] || {};
-
- // Shares cached copies with `XRegExp.exec`/`replace`
- r2 = regex[REGEX_DATA][cacheKey] || (regex[REGEX_DATA][cacheKey] = copyRegex(regex, {
- addG: !!global,
- addY: !!regex.sticky,
- removeG: scope === 'one',
- isInternalOnly: true
- }));
-
- result = nativ.match.call(toObject(str), r2);
-
- if (regex.global) {
- regex.lastIndex = scope === 'one' && result ?
- // Can't use `r2.lastIndex` since `r2` is nonglobal in this case
- result.index + result[0].length : 0;
- }
-
- return global ? result || [] : result && result[0];
- };
-
- /**
- * Retrieves the matches from searching a string using a chain of regexes that successively search
- * within previous matches. The provided `chain` array can contain regexes and or objects with
- * `regex` and `backref` properties. When a backreference is specified, the named or numbered
- * backreference is passed forward to the next regex or returned.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {Array} chain Regexes that each search for matches within preceding results.
- * @returns {Array} Matches by the last regex in the chain, or an empty array.
- * @example
- *
- * // Basic usage; matches numbers within tags
- * XRegExp.matchChain('1 2 3 4 a 56 ', [
- * XRegExp('(?is).*? '),
- * /\d+/
- * ]);
- * // -> ['2', '4', '56']
- *
- * // Passing forward and returning specific backreferences
- * html = 'XRegExp \
- * Google ';
- * XRegExp.matchChain(html, [
- * {regex: //i, backref: 1},
- * {regex: XRegExp('(?i)^https?://(?[^/?#]+)'), backref: 'domain'}
- * ]);
- * // -> ['xregexp.com', 'www.google.com']
- */
- XRegExp.matchChain = function (str, chain) {
- return function recurseChain(values, level) {
- var item = chain[level].regex ? chain[level] : { regex: chain[level] },
- matches = [],
- addMatch = function addMatch(match) {
- if (item.backref) {
- /* Safari 4.0.5 (but not 5.0.5+) inappropriately uses sparse arrays to hold
- * the `undefined`s for backreferences to nonparticipating capturing
- * groups. In such cases, a `hasOwnProperty` or `in` check on its own would
- * inappropriately throw the exception, so also check if the backreference
- * is a number that is within the bounds of the array.
- */
- if (!(match.hasOwnProperty(item.backref) || +item.backref < match.length)) {
- throw new ReferenceError('Backreference to undefined group: ' + item.backref);
- }
-
- matches.push(match[item.backref] || '');
- } else {
- matches.push(match[0]);
- }
- },
- i;
-
- for (i = 0; i < values.length; ++i) {
- XRegExp.forEach(values[i], item.regex, addMatch);
- }
-
- return level === chain.length - 1 || !matches.length ? matches : recurseChain(matches, level + 1);
- }([str], 0);
- };
-
- /**
- * Returns a new string with one or all matches of a pattern replaced. The pattern can be a string
- * or regex, and the replacement can be a string or a function to be called for each match. To
- * perform a global search and replace, use the optional `scope` argument or include flag g if using
- * a regex. Replacement strings can use `${n}` for named and numbered backreferences. Replacement
- * functions can use named backreferences via `arguments[0].name`. Also fixes browser bugs compared
- * to the native `String.prototype.replace` and can be used reliably cross-browser.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp|String} search Search pattern to be replaced.
- * @param {String|Function} replacement Replacement string or a function invoked to create it.
- * Replacement strings can include special replacement syntax:
- * $$ - Inserts a literal $ character.
- * $&, $0 - Inserts the matched substring.
- * $` - Inserts the string that precedes the matched substring (left context).
- * $' - Inserts the string that follows the matched substring (right context).
- * $n, $nn - Where n/nn are digits referencing an existent capturing group, inserts
- * backreference n/nn.
- * ${n} - Where n is a name or any number of digits that reference an existent capturing
- * group, inserts backreference n.
- * Replacement functions are invoked with three or more arguments:
- * The matched substring (corresponds to $& above). Named backreferences are accessible as
- * properties of this first argument.
- * 0..n arguments, one for each backreference (corresponding to $1, $2, etc. above).
- * The zero-based index of the match within the total search string.
- * The total string being searched.
- * @param {String} [scope='one'] Use 'one' to replace the first match only, or 'all'. If not
- * explicitly specified and using a regex with flag g, `scope` is 'all'.
- * @returns {String} New string with one or all matches replaced.
- * @example
- *
- * // Regex search, using named backreferences in replacement string
- * var name = XRegExp('(?\\w+) (?\\w+)');
- * XRegExp.replace('John Smith', name, '${last}, ${first}');
- * // -> 'Smith, John'
- *
- * // Regex search, using named backreferences in replacement function
- * XRegExp.replace('John Smith', name, function(match) {
- * return match.last + ', ' + match.first;
- * });
- * // -> 'Smith, John'
- *
- * // String search, with replace-all
- * XRegExp.replace('RegExp builds RegExps', 'RegExp', 'XRegExp', 'all');
- * // -> 'XRegExp builds XRegExps'
- */
- XRegExp.replace = function (str, search, replacement, scope) {
- var isRegex = XRegExp.isRegExp(search),
- global = search.global && scope !== 'one' || scope === 'all',
- cacheKey = (global ? 'g' : '') + (search.sticky ? 'y' : '') || 'noGY',
- s2 = search,
- result;
-
- if (isRegex) {
- search[REGEX_DATA] = search[REGEX_DATA] || {};
-
- // Shares cached copies with `XRegExp.exec`/`match`. Since a copy is used, `search`'s
- // `lastIndex` isn't updated *during* replacement iterations
- s2 = search[REGEX_DATA][cacheKey] || (search[REGEX_DATA][cacheKey] = copyRegex(search, {
- addG: !!global,
- addY: !!search.sticky,
- removeG: scope === 'one',
- isInternalOnly: true
- }));
- } else if (global) {
- s2 = new RegExp(XRegExp.escape(String(search)), 'g');
- }
-
- // Fixed `replace` required for named backreferences, etc.
- result = fixed.replace.call(toObject(str), s2, replacement);
-
- if (isRegex && search.global) {
- // Fixes IE, Safari bug (last tested IE 9, Safari 5.1)
- search.lastIndex = 0;
- }
-
- return result;
- };
-
- /**
- * Performs batch processing of string replacements. Used like {@link #XRegExp.replace}, but
- * accepts an array of replacement details. Later replacements operate on the output of earlier
- * replacements. Replacement details are accepted as an array with a regex or string to search for,
- * the replacement string or function, and an optional scope of 'one' or 'all'. Uses the XRegExp
- * replacement text syntax, which supports named backreference properties via `${name}`.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {Array} replacements Array of replacement detail arrays.
- * @returns {String} New string with all replacements.
- * @example
- *
- * str = XRegExp.replaceEach(str, [
- * [XRegExp('(?a)'), 'z${name}'],
- * [/b/gi, 'y'],
- * [/c/g, 'x', 'one'], // scope 'one' overrides /g
- * [/d/, 'w', 'all'], // scope 'all' overrides lack of /g
- * ['e', 'v', 'all'], // scope 'all' allows replace-all for strings
- * [/f/g, function($0) {
- * return $0.toUpperCase();
- * }]
- * ]);
- */
- XRegExp.replaceEach = function (str, replacements) {
- var i, r;
-
- for (i = 0; i < replacements.length; ++i) {
- r = replacements[i];
- str = XRegExp.replace(str, r[0], r[1], r[2]);
- }
-
- return str;
- };
-
- /**
- * Splits a string into an array of strings using a regex or string separator. Matches of the
- * separator are not included in the result array. However, if `separator` is a regex that contains
- * capturing groups, backreferences are spliced into the result each time `separator` is matched.
- * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably
- * cross-browser.
- *
- * @memberOf XRegExp
- * @param {String} str String to split.
- * @param {RegExp|String} separator Regex or string to use for separating the string.
- * @param {Number} [limit] Maximum number of items to include in the result array.
- * @returns {Array} Array of substrings.
- * @example
- *
- * // Basic use
- * XRegExp.split('a b c', ' ');
- * // -> ['a', 'b', 'c']
- *
- * // With limit
- * XRegExp.split('a b c', ' ', 2);
- * // -> ['a', 'b']
- *
- * // Backreferences in result array
- * XRegExp.split('..word1..', /([a-z]+)(\d+)/i);
- * // -> ['..', 'word', '1', '..']
- */
- XRegExp.split = function (str, separator, limit) {
- return fixed.split.call(toObject(str), separator, limit);
- };
-
- /**
- * Executes a regex search in a specified string. Returns `true` or `false`. Optional `pos` and
- * `sticky` arguments specify the search start position, and whether the match must start at the
- * specified position only. The `lastIndex` property of the provided regex is not used, but is
- * updated for compatibility. Also fixes browser bugs compared to the native
- * `RegExp.prototype.test` and can be used reliably cross-browser.
- *
- * @memberOf XRegExp
- * @param {String} str String to search.
- * @param {RegExp} regex Regex to search with.
- * @param {Number} [pos=0] Zero-based index at which to start the search.
- * @param {Boolean|String} [sticky=false] Whether the match must start at the specified position
- * only. The string `'sticky'` is accepted as an alternative to `true`.
- * @returns {Boolean} Whether the regex matched the provided value.
- * @example
- *
- * // Basic use
- * XRegExp.test('abc', /c/); // -> true
- *
- * // With pos and sticky
- * XRegExp.test('abc', /c/, 0, 'sticky'); // -> false
- * XRegExp.test('abc', /c/, 2, 'sticky'); // -> true
- */
- XRegExp.test = function (str, regex, pos, sticky) {
- // Do this the easy way :-)
- return !!XRegExp.exec(str, regex, pos, sticky);
- };
-
- /**
- * Uninstalls optional features according to the specified options. All optional features start out
- * uninstalled, so this is used to undo the actions of {@link #XRegExp.install}.
- *
- * @memberOf XRegExp
- * @param {Object|String} options Options object or string.
- * @example
- *
- * // With an options object
- * XRegExp.uninstall({
- * // Disables support for astral code points in Unicode addons
- * astral: true,
- *
- * // Restores native regex methods
- * natives: true
- * });
- *
- * // With an options string
- * XRegExp.uninstall('astral natives');
- */
- XRegExp.uninstall = function (options) {
- options = prepareOptions(options);
-
- if (features.astral && options.astral) {
- setAstral(false);
- }
-
- if (features.natives && options.natives) {
- setNatives(false);
- }
- };
-
- /**
- * Returns an XRegExp object that is the union of the given patterns. Patterns can be provided as
- * regex objects or strings. Metacharacters are escaped in patterns provided as strings.
- * Backreferences in provided regex objects are automatically renumbered to work correctly within
- * the larger combined pattern. Native flags used by provided regexes are ignored in favor of the
- * `flags` argument.
- *
- * @memberOf XRegExp
- * @param {Array} patterns Regexes and strings to combine.
- * @param {String} [flags] Any combination of XRegExp flags.
- * @returns {RegExp} Union of the provided regexes and strings.
- * @example
- *
- * XRegExp.union(['a+b*c', /(dogs)\1/, /(cats)\1/], 'i');
- * // -> /a\+b\*c|(dogs)\1|(cats)\2/i
- */
- XRegExp.union = function (patterns, flags) {
- var parts = /(\()(?!\?)|\\([1-9]\d*)|\\[\s\S]|\[(?:[^\\\]]|\\[\s\S])*]/g,
- output = [],
- numCaptures = 0,
- numPriorCaptures,
- captureNames,
- pattern,
- rewrite = function rewrite(match, paren, backref) {
- var name = captureNames[numCaptures - numPriorCaptures];
-
- // Capturing group
- if (paren) {
- ++numCaptures;
- // If the current capture has a name, preserve the name
- if (name) {
- return '(?<' + name + '>';
- }
- // Backreference
- } else if (backref) {
- // Rewrite the backreference
- return '\\' + (+backref + numPriorCaptures);
- }
-
- return match;
- },
- i;
-
- if (!(isType(patterns, 'Array') && patterns.length)) {
- throw new TypeError('Must provide a nonempty array of patterns to merge');
- }
-
- for (i = 0; i < patterns.length; ++i) {
- pattern = patterns[i];
-
- if (XRegExp.isRegExp(pattern)) {
- numPriorCaptures = numCaptures;
- captureNames = pattern[REGEX_DATA] && pattern[REGEX_DATA].captureNames || [];
-
- // Rewrite backreferences. Passing to XRegExp dies on octals and ensures patterns
- // are independently valid; helps keep this simple. Named captures are put back
- output.push(nativ.replace.call(XRegExp(pattern.source).source, parts, rewrite));
- } else {
- output.push(XRegExp.escape(pattern));
- }
- }
-
- return XRegExp(output.join('|'), flags);
- };
-
- /* ==============================
- * Fixed/extended native methods
- * ============================== */
-
- /**
- * Adds named capture support (with backreferences returned as `result.name`), and fixes browser
- * bugs in the native `RegExp.prototype.exec`. Calling `XRegExp.install('natives')` uses this to
- * override the native method. Use via `XRegExp.exec` without overriding natives.
- *
- * @private
- * @param {String} str String to search.
- * @returns {Array} Match array with named backreference properties, or `null`.
- */
- fixed.exec = function (str) {
- var origLastIndex = this.lastIndex,
- match = nativ.exec.apply(this, arguments),
- name,
- r2,
- i;
-
- if (match) {
- // Fix browsers whose `exec` methods don't return `undefined` for nonparticipating
- // capturing groups. This fixes IE 5.5-8, but not IE 9's quirks mode or emulation of
- // older IEs. IE 9 in standards mode follows the spec
- if (!correctExecNpcg && match.length > 1 && indexOf(match, '') > -1) {
- r2 = copyRegex(this, {
- removeG: true,
- isInternalOnly: true
- });
- // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
- // matching due to characters outside the match
- nativ.replace.call(String(str).slice(match.index), r2, function () {
- var len = arguments.length,
- i;
- // Skip index 0 and the last 2
- for (i = 1; i < len - 2; ++i) {
- if (arguments[i] === undefined) {
- match[i] = undefined;
- }
- }
- });
- }
-
- // Attach named capture properties
- if (this[REGEX_DATA] && this[REGEX_DATA].captureNames) {
- // Skip index 0
- for (i = 1; i < match.length; ++i) {
- name = this[REGEX_DATA].captureNames[i - 1];
- if (name) {
- match[name] = match[i];
- }
- }
- }
-
- // Fix browsers that increment `lastIndex` after zero-length matches
- if (this.global && !match[0].length && this.lastIndex > match.index) {
- this.lastIndex = match.index;
- }
- }
-
- if (!this.global) {
- // Fixes IE, Opera bug (last tested IE 9, Opera 11.6)
- this.lastIndex = origLastIndex;
- }
-
- return match;
- };
-
- /**
- * Fixes browser bugs in the native `RegExp.prototype.test`. Calling `XRegExp.install('natives')`
- * uses this to override the native method.
- *
- * @private
- * @param {String} str String to search.
- * @returns {Boolean} Whether the regex matched the provided value.
- */
- fixed.test = function (str) {
- // Do this the easy way :-)
- return !!fixed.exec.call(this, str);
- };
-
- /**
- * Adds named capture support (with backreferences returned as `result.name`), and fixes browser
- * bugs in the native `String.prototype.match`. Calling `XRegExp.install('natives')` uses this to
- * override the native method.
- *
- * @private
- * @param {RegExp|*} regex Regex to search with. If not a regex object, it is passed to `RegExp`.
- * @returns {Array} If `regex` uses flag g, an array of match strings or `null`. Without flag g,
- * the result of calling `regex.exec(this)`.
- */
- fixed.match = function (regex) {
- var result;
-
- if (!XRegExp.isRegExp(regex)) {
- // Use the native `RegExp` rather than `XRegExp`
- regex = new RegExp(regex);
- } else if (regex.global) {
- result = nativ.match.apply(this, arguments);
- // Fixes IE bug
- regex.lastIndex = 0;
-
- return result;
- }
-
- return fixed.exec.call(regex, toObject(this));
- };
-
- /**
- * Adds support for `${n}` tokens for named and numbered backreferences in replacement text, and
- * provides named backreferences to replacement functions as `arguments[0].name`. Also fixes browser
- * bugs in replacement text syntax when performing a replacement using a nonregex search value, and
- * the value of a replacement regex's `lastIndex` property during replacement iterations and upon
- * completion. Calling `XRegExp.install('natives')` uses this to override the native method. Note
- * that this doesn't support SpiderMonkey's proprietary third (`flags`) argument. Use via
- * `XRegExp.replace` without overriding natives.
- *
- * @private
- * @param {RegExp|String} search Search pattern to be replaced.
- * @param {String|Function} replacement Replacement string or a function invoked to create it.
- * @returns {String} New string with one or all matches replaced.
- */
- fixed.replace = function (search, replacement) {
- var isRegex = XRegExp.isRegExp(search),
- origLastIndex,
- captureNames,
- result;
-
- if (isRegex) {
- if (search[REGEX_DATA]) {
- captureNames = search[REGEX_DATA].captureNames;
- }
- // Only needed if `search` is nonglobal
- origLastIndex = search.lastIndex;
- } else {
- search += ''; // Type-convert
- }
-
- // Don't use `typeof`; some older browsers return 'function' for regex objects
- if (isType(replacement, 'Function')) {
- // Stringifying `this` fixes a bug in IE < 9 where the last argument in replacement
- // functions isn't type-converted to a string
- result = nativ.replace.call(String(this), search, function () {
- var args = arguments,
- i;
- if (captureNames) {
- // Change the `arguments[0]` string primitive to a `String` object that can
- // store properties. This really does need to use `String` as a constructor
- args[0] = new String(args[0]);
- // Store named backreferences on the first argument
- for (i = 0; i < captureNames.length; ++i) {
- if (captureNames[i]) {
- args[0][captureNames[i]] = args[i + 1];
- }
- }
- }
- // Update `lastIndex` before calling `replacement`. Fixes IE, Chrome, Firefox,
- // Safari bug (last tested IE 9, Chrome 17, Firefox 11, Safari 5.1)
- if (isRegex && search.global) {
- search.lastIndex = args[args.length - 2] + args[0].length;
- }
- // ES6 specs the context for replacement functions as `undefined`
- return replacement.apply(undefined, args);
- });
- } else {
- // Ensure that the last value of `args` will be a string when given nonstring `this`,
- // while still throwing on null or undefined context
- result = nativ.replace.call(this == null ? this : String(this), search, function () {
- // Keep this function's `arguments` available through closure
- var args = arguments;
- return nativ.replace.call(String(replacement), replacementToken, function ($0, $1, $2) {
- var n;
- // Named or numbered backreference with curly braces
- if ($1) {
- // XRegExp behavior for `${n}`:
- // 1. Backreference to numbered capture, if `n` is an integer. Use `0` for
- // for the entire match. Any number of leading zeros may be used.
- // 2. Backreference to named capture `n`, if it exists and is not an
- // integer overridden by numbered capture. In practice, this does not
- // overlap with numbered capture since XRegExp does not allow named
- // capture to use a bare integer as the name.
- // 3. If the name or number does not refer to an existing capturing group,
- // it's an error.
- n = +$1; // Type-convert; drop leading zeros
- if (n <= args.length - 3) {
- return args[n] || '';
- }
- // Groups with the same name is an error, else would need `lastIndexOf`
- n = captureNames ? indexOf(captureNames, $1) : -1;
- if (n < 0) {
- throw new SyntaxError('Backreference to undefined group ' + $0);
- }
- return args[n + 1] || '';
- }
- // Else, special variable or numbered backreference without curly braces
- if ($2 === '$') {
- // $$
- return '$';
- }
- if ($2 === '&' || +$2 === 0) {
- // $&, $0 (not followed by 1-9), $00
- return args[0];
- }
- if ($2 === '`') {
- // $` (left context)
- return args[args.length - 1].slice(0, args[args.length - 2]);
- }
- if ($2 === "'") {
- // $' (right context)
- return args[args.length - 1].slice(args[args.length - 2] + args[0].length);
- }
- // Else, numbered backreference without curly braces
- $2 = +$2; // Type-convert; drop leading zero
- // XRegExp behavior for `$n` and `$nn`:
- // - Backrefs end after 1 or 2 digits. Use `${..}` for more digits.
- // - `$1` is an error if no capturing groups.
- // - `$10` is an error if less than 10 capturing groups. Use `${1}0` instead.
- // - `$01` is `$1` if at least one capturing group, else it's an error.
- // - `$0` (not followed by 1-9) and `$00` are the entire match.
- // Native behavior, for comparison:
- // - Backrefs end after 1 or 2 digits. Cannot reference capturing group 100+.
- // - `$1` is a literal `$1` if no capturing groups.
- // - `$10` is `$1` followed by a literal `0` if less than 10 capturing groups.
- // - `$01` is `$1` if at least one capturing group, else it's a literal `$01`.
- // - `$0` is a literal `$0`.
- if (!isNaN($2)) {
- if ($2 > args.length - 3) {
- throw new SyntaxError('Backreference to undefined group ' + $0);
- }
- return args[$2] || '';
- }
- // `$` followed by an unsupported char is an error, unlike native JS
- throw new SyntaxError('Invalid token ' + $0);
- });
- });
- }
-
- if (isRegex) {
- if (search.global) {
- // Fixes IE, Safari bug (last tested IE 9, Safari 5.1)
- search.lastIndex = 0;
- } else {
- // Fixes IE, Opera bug (last tested IE 9, Opera 11.6)
- search.lastIndex = origLastIndex;
- }
- }
-
- return result;
- };
-
- /**
- * Fixes browser bugs in the native `String.prototype.split`. Calling `XRegExp.install('natives')`
- * uses this to override the native method. Use via `XRegExp.split` without overriding natives.
- *
- * @private
- * @param {RegExp|String} separator Regex or string to use for separating the string.
- * @param {Number} [limit] Maximum number of items to include in the result array.
- * @returns {Array} Array of substrings.
- */
- fixed.split = function (separator, limit) {
- if (!XRegExp.isRegExp(separator)) {
- // Browsers handle nonregex split correctly, so use the faster native method
- return nativ.split.apply(this, arguments);
- }
-
- var str = String(this),
- output = [],
- origLastIndex = separator.lastIndex,
- lastLastIndex = 0,
- lastLength;
-
- // Values for `limit`, per the spec:
- // If undefined: pow(2,32) - 1
- // If 0, Infinity, or NaN: 0
- // If positive number: limit = floor(limit); if (limit >= pow(2,32)) limit -= pow(2,32);
- // If negative number: pow(2,32) - floor(abs(limit))
- // If other: Type-convert, then use the above rules
- // This line fails in very strange ways for some values of `limit` in Opera 10.5-10.63,
- // unless Opera Dragonfly is open (go figure). It works in at least Opera 9.5-10.1 and 11+
- limit = (limit === undefined ? -1 : limit) >>> 0;
-
- XRegExp.forEach(str, separator, function (match) {
- // This condition is not the same as `if (match[0].length)`
- if (match.index + match[0].length > lastLastIndex) {
- output.push(str.slice(lastLastIndex, match.index));
- if (match.length > 1 && match.index < str.length) {
- Array.prototype.push.apply(output, match.slice(1));
- }
- lastLength = match[0].length;
- lastLastIndex = match.index + lastLength;
- }
- });
-
- if (lastLastIndex === str.length) {
- if (!nativ.test.call(separator, '') || lastLength) {
- output.push('');
- }
- } else {
- output.push(str.slice(lastLastIndex));
- }
-
- separator.lastIndex = origLastIndex;
- return output.length > limit ? output.slice(0, limit) : output;
- };
-
- /* ==============================
- * Built-in syntax/flag tokens
- * ============================== */
-
- /*
- * Letter escapes that natively match literal characters: `\a`, `\A`, etc. These should be
- * SyntaxErrors but are allowed in web reality. XRegExp makes them errors for cross-browser
- * consistency and to reserve their syntax, but lets them be superseded by addons.
- */
- XRegExp.addToken(/\\([ABCE-RTUVXYZaeg-mopqyz]|c(?![A-Za-z])|u(?![\dA-Fa-f]{4}|{[\dA-Fa-f]+})|x(?![\dA-Fa-f]{2}))/, function (match, scope) {
- // \B is allowed in default scope only
- if (match[1] === 'B' && scope === defaultScope) {
- return match[0];
- }
- throw new SyntaxError('Invalid escape ' + match[0]);
- }, {
- scope: 'all',
- leadChar: '\\'
- });
-
- /*
- * Unicode code point escape with curly braces: `\u{N..}`. `N..` is any one or more digit
- * hexadecimal number from 0-10FFFF, and can include leading zeros. Requires the native ES6 `u` flag
- * to support code points greater than U+FFFF. Avoids converting code points above U+FFFF to
- * surrogate pairs (which could be done without flag `u`), since that could lead to broken behavior
- * if you follow a `\u{N..}` token that references a code point above U+FFFF with a quantifier, or
- * if you use the same in a character class.
- */
- XRegExp.addToken(/\\u{([\dA-Fa-f]+)}/, function (match, scope, flags) {
- var code = dec(match[1]);
- if (code > 0x10FFFF) {
- throw new SyntaxError('Invalid Unicode code point ' + match[0]);
- }
- if (code <= 0xFFFF) {
- // Converting to \uNNNN avoids needing to escape the literal character and keep it
- // separate from preceding tokens
- return '\\u' + pad4(hex(code));
- }
- // If `code` is between 0xFFFF and 0x10FFFF, require and defer to native handling
- if (hasNativeU && flags.indexOf('u') > -1) {
- return match[0];
- }
- throw new SyntaxError('Cannot use Unicode code point above \\u{FFFF} without flag u');
- }, {
- scope: 'all',
- leadChar: '\\'
- });
-
- /*
- * Empty character class: `[]` or `[^]`. This fixes a critical cross-browser syntax inconsistency.
- * Unless this is standardized (per the ES spec), regex syntax can't be accurately parsed because
- * character class endings can't be determined.
- */
- XRegExp.addToken(/\[(\^?)]/, function (match) {
- // For cross-browser compatibility with ES3, convert [] to \b\B and [^] to [\s\S].
- // (?!) should work like \b\B, but is unreliable in some versions of Firefox
- return match[1] ? '[\\s\\S]' : '\\b\\B';
- }, { leadChar: '[' });
-
- /*
- * Comment pattern: `(?# )`. Inline comments are an alternative to the line comments allowed in
- * free-spacing mode (flag x).
- */
- XRegExp.addToken(/\(\?#[^)]*\)/, function (match, scope, flags) {
- // Keep tokens separated unless the following token is a quantifier
- return isQuantifierNext(match.input, match.index + match[0].length, flags) ? '' : '(?:)';
- }, { leadChar: '(' });
-
- /*
- * Whitespace and line comments, in free-spacing mode (aka extended mode, flag x) only.
- */
- XRegExp.addToken(/\s+|#.*/, function (match, scope, flags) {
- // Keep tokens separated unless the following token is a quantifier
- return isQuantifierNext(match.input, match.index + match[0].length, flags) ? '' : '(?:)';
- }, { flag: 'x' });
-
- /*
- * Dot, in dotall mode (aka singleline mode, flag s) only.
- */
- XRegExp.addToken(/\./, function () {
- return '[\\s\\S]';
- }, {
- flag: 's',
- leadChar: '.'
- });
-
- /*
- * Named backreference: `\k`. Backreference names can use the characters A-Z, a-z, 0-9, _,
- * and $ only. Also allows numbered backreferences as `\k`.
- */
- XRegExp.addToken(/\\k<([\w$]+)>/, function (match) {
- // Groups with the same name is an error, else would need `lastIndexOf`
- var index = isNaN(match[1]) ? indexOf(this.captureNames, match[1]) + 1 : +match[1],
- endIndex = match.index + match[0].length;
- if (!index || index > this.captureNames.length) {
- throw new SyntaxError('Backreference to undefined group ' + match[0]);
- }
- // Keep backreferences separate from subsequent literal numbers
- return '\\' + index + (endIndex === match.input.length || isNaN(match.input.charAt(endIndex)) ? '' : '(?:)');
- }, { leadChar: '\\' });
-
- /*
- * Numbered backreference or octal, plus any following digits: `\0`, `\11`, etc. Octals except `\0`
- * not followed by 0-9 and backreferences to unopened capture groups throw an error. Other matches
- * are returned unaltered. IE < 9 doesn't support backreferences above `\99` in regex syntax.
- */
- XRegExp.addToken(/\\(\d+)/, function (match, scope) {
- if (!(scope === defaultScope && /^[1-9]/.test(match[1]) && +match[1] <= this.captureNames.length) && match[1] !== '0') {
- throw new SyntaxError('Cannot use octal escape or backreference to undefined group ' + match[0]);
- }
- return match[0];
- }, {
- scope: 'all',
- leadChar: '\\'
- });
-
- /*
- * Named capturing group; match the opening delimiter only: `(?`. Capture names can use the
- * characters A-Z, a-z, 0-9, _, and $ only. Names can't be integers. Supports Python-style
- * `(?P` as an alternate syntax to avoid issues in some older versions of Opera which natively
- * supported the Python-style syntax. Otherwise, XRegExp might treat numbered backreferences to
- * Python-style named capture as octals.
- */
- XRegExp.addToken(/\(\?P?<([\w$]+)>/, function (match) {
- // Disallow bare integers as names because named backreferences are added to match
- // arrays and therefore numeric properties may lead to incorrect lookups
- if (!isNaN(match[1])) {
- throw new SyntaxError('Cannot use integer as capture name ' + match[0]);
- }
- if (match[1] === 'length' || match[1] === '__proto__') {
- throw new SyntaxError('Cannot use reserved word as capture name ' + match[0]);
- }
- if (indexOf(this.captureNames, match[1]) > -1) {
- throw new SyntaxError('Cannot use same name for multiple groups ' + match[0]);
- }
- this.captureNames.push(match[1]);
- this.hasNamedCapture = true;
- return '(';
- }, { leadChar: '(' });
-
- /*
- * Capturing group; match the opening parenthesis only. Required for support of named capturing
- * groups. Also adds explicit capture mode (flag n).
- */
- XRegExp.addToken(/\((?!\?)/, function (match, scope, flags) {
- if (flags.indexOf('n') > -1) {
- return '(?:';
- }
- this.captureNames.push(null);
- return '(';
- }, {
- optionalFlags: 'n',
- leadChar: '('
- });
-
- /* ==============================
- * Expose XRegExp
- * ============================== */
-
- module.exports = XRegExp;
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _match = __webpack_require__(6);
-
- Object.keys(_match).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _match[key];
- }
- });
- });
-
- var _applyRegexList = __webpack_require__(7);
-
- Object.keys(_applyRegexList).forEach(function (key) {
- if (key === "default" || key === "__esModule") return;
- Object.defineProperty(exports, key, {
- enumerable: true,
- get: function get() {
- return _applyRegexList[key];
- }
- });
- });
-
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
-
- "use strict";
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- var Match = exports.Match = function () {
- function Match(value, index, css) {
- _classCallCheck(this, Match);
-
- this.value = value;
- this.index = index;
- this.length = value.length;
- this.css = css;
- this.brushName = null;
- }
-
- _createClass(Match, [{
- key: "toString",
- value: function toString() {
- return this.value;
- }
- }]);
-
- return Match;
- }();
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
- exports.applyRegexList = applyRegexList;
-
- var _matches = __webpack_require__(8);
-
- /**
- * Applies all regular expression to the code and stores all found
- * matches in the `this.matches` array.
- */
- function applyRegexList(code, regexList) {
- var result = [];
-
- regexList = regexList || [];
-
- for (var i = 0, l = regexList.length; i < l; i++) {
- // BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com)
- if (_typeof(regexList[i]) === 'object') result = result.concat((0, _matches.find)(code, regexList[i]));
- }
-
- result = (0, _matches.sort)(result);
- result = (0, _matches.removeNested)(result);
- result = (0, _matches.compact)(result);
-
- return result;
- }
-
-/***/ },
-/* 8 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.find = find;
- exports.sort = sort;
- exports.compact = compact;
- exports.removeNested = removeNested;
-
- var _match = __webpack_require__(6);
-
- var _syntaxhighlighterRegex = __webpack_require__(3);
-
- /**
- * Executes given regular expression on provided code and returns all matches that are found.
- *
- * @param {String} code Code to execute regular expression on.
- * @param {Object} regex Regular expression item info from `regexList` collection.
- * @return {Array} Returns a list of Match objects.
- */
- function find(code, regexInfo) {
- function defaultAdd(match, regexInfo) {
- return match[0];
- };
-
- var index = 0,
- match = null,
- matches = [],
- process = regexInfo.func ? regexInfo.func : defaultAdd,
- pos = 0;
-
- while (match = _syntaxhighlighterRegex.XRegExp.exec(code, regexInfo.regex, pos)) {
- var resultMatch = process(match, regexInfo);
-
- if (typeof resultMatch === 'string') resultMatch = [new _match.Match(resultMatch, match.index, regexInfo.css)];
-
- matches = matches.concat(resultMatch);
- pos = match.index + match[0].length;
- }
-
- return matches;
- };
-
- /**
- * Sorts matches by index position and then by length.
- */
- function sort(matches) {
- function sortMatchesCallback(m1, m2) {
- // sort matches by index first
- if (m1.index < m2.index) return -1;else if (m1.index > m2.index) return 1;else {
- // if index is the same, sort by length
- if (m1.length < m2.length) return -1;else if (m1.length > m2.length) return 1;
- }
-
- return 0;
- }
-
- return matches.sort(sortMatchesCallback);
- }
-
- function compact(matches) {
- var result = [],
- i,
- l;
-
- for (i = 0, l = matches.length; i < l; i++) {
- if (matches[i]) result.push(matches[i]);
- }return result;
- }
-
- /**
- * Checks to see if any of the matches are inside of other matches.
- * This process would get rid of highligted strings inside comments,
- * keywords inside strings and so on.
- */
- function removeNested(matches) {
- // Optimized by Jose Prado (http://joseprado.com)
- for (var i = 0, l = matches.length; i < l; i++) {
- if (matches[i] === null) continue;
-
- var itemI = matches[i],
- itemIEndPos = itemI.index + itemI.length;
-
- for (var j = i + 1, l = matches.length; j < l && matches[i] !== null; j++) {
- var itemJ = matches[j];
-
- if (itemJ === null) continue;else if (itemJ.index > itemIEndPos) break;else if (itemJ.index == itemI.index && itemJ.length > itemI.length) matches[i] = null;else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos) matches[j] = null;
- }
- }
-
- return matches;
- }
-
-/***/ },
-/* 9 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = Renderer;
- /**
- * Pads number with zeros until it's length is the same as given length.
- *
- * @param {Number} number Number to pad.
- * @param {Number} length Max string length with.
- * @return {String} Returns a string padded with proper amount of '0'.
- */
- function padNumber(number, length) {
- var result = number.toString();
-
- while (result.length < length) {
- result = '0' + result;
- }return result;
- };
-
- function getLines(str) {
- return str.split(/\r?\n/);
- }
-
- function getLinesToHighlight(opts) {
- var results = {},
- linesToHighlight,
- l,
- i;
-
- linesToHighlight = opts.highlight || [];
-
- if (typeof linesToHighlight.push !== 'function') linesToHighlight = [linesToHighlight];
-
- for (i = 0, l = linesToHighlight.length; i < l; i++) {
- results[linesToHighlight[i]] = true;
- }return results;
- }
-
- function Renderer(code, matches, opts) {
- var _this = this;
-
- _this.opts = opts;
- _this.code = code;
- _this.matches = matches;
- _this.lines = getLines(code);
- _this.linesToHighlight = getLinesToHighlight(opts);
- }
-
- Renderer.prototype = {
- /**
- * Wraps each line of the string into tag with given style applied to it.
- *
- * @param {String} str Input string.
- * @param {String} css Style name to apply to the string.
- * @return {String} Returns input string with each line surrounded by tag.
- */
- wrapLinesWithCode: function wrapLinesWithCode(str, css) {
- if (str == null || str.length == 0 || str == '\n' || css == null) return str;
-
- var _this = this,
- results = [],
- lines,
- line,
- spaces,
- i,
- l;
-
- str = str.replace(/... to them so that leading spaces aren't included.
- for (i = 0, l = lines.length; i < l; i++) {
- line = lines[i];
- spaces = '';
-
- if (line.length > 0) {
- line = line.replace(/^( | )+/, function (s) {
- spaces = s;
- return '';
- });
-
- line = line.length === 0 ? spaces : spaces + '' + line + '';
- }
-
- results.push(line);
- }
-
- return results.join('\n');
- },
-
- /**
- * Turns all URLs in the code into tags.
- * @param {String} code Input code.
- * @return {String} Returns code with tags.
- */
- processUrls: function processUrls(code) {
- var gt = /(.*)((>|<).*)/,
- url = /\w+:\/\/[\w-.\/?%&=:@;#]*/g;
-
- return code.replace(url, function (m) {
- var suffix = '',
- match = null;
-
- // We include < and > in the URL for the common cases like
- // The problem is that they get transformed into <http://google.com>
- // Where as > easily looks like part of the URL string.
-
- if (match = gt.exec(m)) {
- m = match[1];
- suffix = match[2];
- }
-
- return '' + m + ' ' + suffix;
- });
- },
-
- /**
- * Creates an array containing integer line numbers starting from the 'first-line' param.
- * @return {Array} Returns array of integers.
- */
- figureOutLineNumbers: function figureOutLineNumbers(code) {
- var lineNumbers = [],
- lines = this.lines,
- firstLine = parseInt(this.opts.firstLine || 1),
- i,
- l;
-
- for (i = 0, l = lines.length; i < l; i++) {
- lineNumbers.push(i + firstLine);
- }return lineNumbers;
- },
-
- /**
- * Generates HTML markup for a single line of code while determining alternating line style.
- * @param {Integer} lineNumber Line number.
- * @param {String} code Line HTML markup.
- * @return {String} Returns HTML markup.
- */
- wrapLine: function wrapLine(lineIndex, lineNumber, lineHtml) {
- var classes = ['line', 'number' + lineNumber, 'index' + lineIndex, 'alt' + (lineNumber % 2 == 0 ? 1 : 2).toString()];
-
- if (this.linesToHighlight[lineNumber]) classes.push('highlighted');
-
- if (lineNumber == 0) classes.push('break');
-
- return '' + lineHtml + '
';
- },
-
- /**
- * Generates HTML markup for line number column.
- * @param {String} code Complete code HTML markup.
- * @param {Array} lineNumbers Calculated line numbers.
- * @return {String} Returns HTML markup.
- */
- renderLineNumbers: function renderLineNumbers(code, lineNumbers) {
- var _this = this,
- opts = _this.opts,
- html = '',
- count = _this.lines.length,
- firstLine = parseInt(opts.firstLine || 1),
- pad = opts.padLineNumbers,
- lineNumber,
- i;
-
- if (pad == true) pad = (firstLine + count - 1).toString().length;else if (isNaN(pad) == true) pad = 0;
-
- for (i = 0; i < count; i++) {
- lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i;
- code = lineNumber == 0 ? opts.space : padNumber(lineNumber, pad);
- html += _this.wrapLine(i, lineNumber, code);
- }
-
- return html;
- },
-
- /**
- * Splits block of text into individual DIV lines.
- * @param {String} code Code to highlight.
- * @param {Array} lineNumbers Calculated line numbers.
- * @return {String} Returns highlighted code in HTML form.
- */
- getCodeLinesHtml: function getCodeLinesHtml(html, lineNumbers) {
- // html = utils.trim(html);
-
- var _this = this,
- opts = _this.opts,
- lines = getLines(html),
- padLength = opts.padLineNumbers,
- firstLine = parseInt(opts.firstLine || 1),
- brushName = opts.brush,
- html = '';
-
- for (var i = 0, l = lines.length; i < l; i++) {
- var line = lines[i],
- indent = /^( |\s)+/.exec(line),
- spaces = null,
- lineNumber = lineNumbers ? lineNumbers[i] : firstLine + i;
- ;
-
- if (indent != null) {
- spaces = indent[0].toString();
- line = line.substr(spaces.length);
- spaces = spaces.replace(' ', opts.space);
- }
-
- // line = utils.trim(line);
-
- if (line.length == 0) line = opts.space;
-
- html += _this.wrapLine(i, lineNumber, (spaces != null ? '' + spaces + '' : '') + line);
- }
-
- return html;
- },
-
- /**
- * Returns HTML for the table title or empty string if title is null.
- */
- getTitleHtml: function getTitleHtml(title) {
- return title ? '' + title + ' ' : '';
- },
-
- /**
- * Finds all matches in the source code.
- * @param {String} code Source code to process matches in.
- * @param {Array} matches Discovered regex matches.
- * @return {String} Returns formatted HTML with processed mathes.
- */
- getMatchesHtml: function getMatchesHtml(code, matches) {
- function getBrushNameCss(match) {
- var result = match ? match.brushName || brushName : brushName;
- return result ? result + ' ' : '';
- };
-
- var _this = this,
- pos = 0,
- result = '',
- brushName = _this.opts.brush || '',
- match,
- matchBrushName,
- i,
- l;
-
- // Finally, go through the final list of matches and pull the all
- // together adding everything in between that isn't a match.
- for (i = 0, l = matches.length; i < l; i++) {
- match = matches[i];
-
- if (match === null || match.length === 0) continue;
-
- matchBrushName = getBrushNameCss(match);
-
- result += _this.wrapLinesWithCode(code.substr(pos, match.index - pos), matchBrushName + 'plain') + _this.wrapLinesWithCode(match.value, matchBrushName + match.css);
-
- pos = match.index + match.length + (match.offset || 0);
- }
-
- // don't forget to add whatever's remaining in the string
- result += _this.wrapLinesWithCode(code.substr(pos), getBrushNameCss() + 'plain');
-
- return result;
- },
-
- /**
- * Generates HTML markup for the whole syntax highlighter.
- * @param {String} code Source code.
- * @return {String} Returns HTML markup.
- */
- getHtml: function getHtml() {
- var _this = this,
- opts = _this.opts,
- code = _this.code,
- matches = _this.matches,
- classes = ['syntaxhighlighter'],
- lineNumbers,
- gutter,
- html;
-
- if (opts.collapse === true) classes.push('collapsed');
-
- gutter = opts.gutter !== false;
-
- if (!gutter) classes.push('nogutter');
-
- // add custom user style name
- classes.push(opts.className);
-
- // add brush alias to the class name for custom CSS
- classes.push(opts.brush);
-
- if (gutter) lineNumbers = _this.figureOutLineNumbers(code);
-
- // processes found matches into the html
- html = _this.getMatchesHtml(code, matches);
-
- // finally, split all lines so that they wrap well
- html = _this.getCodeLinesHtml(html, lineNumbers);
-
- // finally, process the links
- if (opts.autoLinks) html = _this.processUrls(html);
-
- html = '\n \n
\n ' + _this.getTitleHtml(opts.title) + '\n \n \n ' + (gutter ? '' + _this.renderLineNumbers(code) + ' ' : '') + '\n \n ' + html + '
\n \n \n \n
\n
\n ';
-
- return html;
- }
- };
-
-/***/ },
-/* 10 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- /**
- * Splits block of text into lines.
- * @param {String} block Block of text.
- * @return {Array} Returns array of lines.
- */
- function splitLines(block) {
- return block.split(/\r?\n/);
- }
-
- /**
- * Executes a callback on each line and replaces each line with result from the callback.
- * @param {Object} str Input string.
- * @param {Object} callback Callback function taking one string argument and returning a string.
- */
- function eachLine(str, callback) {
- var lines = splitLines(str);
-
- for (var i = 0, l = lines.length; i < l; i++) {
- lines[i] = callback(lines[i], i);
- }return lines.join('\n');
- }
-
- /**
- * Generates a unique element ID.
- */
- function guid(prefix) {
- return (prefix || '') + Math.round(getRandomValue() % 1000000).toString();
- }
-
- /**
- * Merges two objects. Values from obj2 override values in obj1.
- * Function is NOT recursive and works only for one dimensional objects.
- * @param {Object} obj1 First object.
- * @param {Object} obj2 Second object.
- * @return {Object} Returns combination of both objects.
- */
- function merge(obj1, obj2) {
- var result = {},
- name;
-
- for (name in obj1) {
- result[name] = obj1[name];
- }for (name in obj2) {
- result[name] = obj2[name];
- }return result;
- }
-
- /**
- * Removes all white space at the begining and end of a string.
- *
- * @param {String} str String to trim.
- * @return {String} Returns string without leading and following white space characters.
- */
- function trim(str) {
- return str.replace(/^\s+|\s+$/g, '');
- }
-
- /**
- * Converts the source to array object. Mostly used for function arguments and
- * lists returned by getElementsByTagName() which aren't Array objects.
- * @param {List} source Source list.
- * @return {Array} Returns array.
- */
- function toArray(source) {
- return Array.prototype.slice.apply(source);
- }
-
- /**
- * Attempts to convert string to boolean.
- * @param {String} value Input string.
- * @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise.
- */
- function toBoolean(value) {
- var result = { "true": true, "false": false }[value];
- return result == null ? value : result;
- }
-
- module.exports = {
- splitLines: splitLines,
- eachLine: eachLine,
- guid: guid,
- merge: merge,
- trim: trim,
- toArray: toArray,
- toBoolean: toBoolean
- };
-
-/***/ },
-/* 11 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var trim = __webpack_require__(12),
- bloggerMode = __webpack_require__(13),
- stripBrs = __webpack_require__(14),
- unindenter = __webpack_require__(15),
- retabber = __webpack_require__(16);
-
- module.exports = function (code, opts) {
- code = trim(code, opts);
- code = bloggerMode(code, opts);
- code = stripBrs(code, opts);
- code = unindenter.unindent(code, opts);
-
- var tabSize = opts['tab-size'];
- code = opts['smart-tabs'] === true ? retabber.smart(code, tabSize) : retabber.regular(code, tabSize);
-
- return code;
- };
-
-/***/ },
-/* 12 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = function (code, opts) {
- return code
- // This is a special trim which only removes first and last empty lines
- // and doesn't affect valid leading space on the first line.
- .replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, '')
-
- // IE lets these buggers through
- .replace(/\r/g, ' ');
- };
-
-/***/ },
-/* 13 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = function (code, opts) {
- var br = / |<br\s*\/?>/gi;
-
- if (opts['bloggerMode'] === true) code = code.replace(br, '\n');
-
- return code;
- };
-
-/***/ },
-/* 14 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = function (code, opts) {
- var br = / |<br\s*\/?>/gi;
-
- if (opts['stripBrs'] === true) code = code.replace(br, '');
-
- return code;
- };
-
-/***/ },
-/* 15 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- function isEmpty(str) {
- return (/^\s*$/.test(str)
- );
- }
-
- module.exports = {
- unindent: function unindent(code) {
- var lines = code.split(/\r?\n/),
- regex = /^\s*/,
- min = 1000,
- line,
- matches,
- i,
- l;
-
- // go through every line and check for common number of indents
- for (i = 0, l = lines.length; i < l && min > 0; i++) {
- line = lines[i];
-
- if (isEmpty(line)) continue;
-
- matches = regex.exec(line);
-
- // In the event that just one line doesn't have leading white space
- // we can't unindent anything, so bail completely.
- if (matches == null) return code;
-
- min = Math.min(matches[0].length, min);
- }
-
- // trim minimum common number of white space from the begining of every line
- if (min > 0) for (i = 0, l = lines.length; i < l; i++) {
- if (!isEmpty(lines[i])) lines[i] = lines[i].substr(min);
- }return lines.join('\n');
- }
- };
-
-/***/ },
-/* 16 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- var spaces = '';
-
- // Create a string with 1000 spaces to copy spaces from...
- // It's assumed that there would be no indentation longer than that.
- for (var i = 0; i < 50; i++) {
- spaces += ' ';
- } // 20 spaces * 50
-
- // This function inserts specified amount of spaces in the string
- // where a tab is while removing that given tab.
- function insertSpaces(line, pos, count) {
- return line.substr(0, pos) + spaces.substr(0, count) + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
- ;
- }
-
- module.exports = {
- smart: function smart(code, tabSize) {
- var lines = code.split(/\r?\n/),
- tab = '\t',
- line,
- pos,
- i,
- l;
-
- // Go through all the lines and do the 'smart tabs' magic.
- for (i = 0, l = lines.length; i < l; i++) {
- line = lines[i];
-
- if (line.indexOf(tab) === -1) continue;
-
- pos = 0;
-
- while ((pos = line.indexOf(tab)) !== -1) {
- // This is pretty much all there is to the 'smart tabs' logic.
- // Based on the position within the line and size of a tab,
- // calculate the amount of spaces we need to insert.
- line = insertSpaces(line, pos, tabSize - pos % tabSize);
- }
-
- lines[i] = line;
- }
-
- return lines.join('\n');
- },
-
- regular: function regular(code, tabSize) {
- return code.replace(/\t/g, spaces.substr(0, tabSize));
- }
- };
-
-/***/ },
-/* 17 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- /**
- * Finds all <SCRIPT TYPE="text/syntaxhighlighter" /> elementss.
- * Finds both "text/syntaxhighlighter" and "syntaxhighlighter"
- * ...in order to make W3C validator happy with subtype and backwardscompatible without subtype
- * @return {Array} Returns array of all found SyntaxHighlighter tags.
- */
- function getSyntaxHighlighterScriptTags() {
- var tags = document.getElementsByTagName('script'),
- result = [];
-
- for (var i = 0; i < tags.length; i++) {
- if (tags[i].type == 'text/syntaxhighlighter' || tags[i].type == 'syntaxhighlighter') result.push(tags[i]);
- }return result;
- };
-
- /**
- * Checks if target DOM elements has specified CSS class.
- * @param {DOMElement} target Target DOM element to check.
- * @param {String} className Name of the CSS class to check for.
- * @return {Boolean} Returns true if class name is present, false otherwise.
- */
- function hasClass(target, className) {
- return target.className.indexOf(className) != -1;
- }
-
- /**
- * Adds CSS class name to the target DOM element.
- * @param {DOMElement} target Target DOM element.
- * @param {String} className New CSS class to add.
- */
- function addClass(target, className) {
- if (!hasClass(target, className)) target.className += ' ' + className;
- }
-
- /**
- * Removes CSS class name from the target DOM element.
- * @param {DOMElement} target Target DOM element.
- * @param {String} className CSS class to remove.
- */
- function removeClass(target, className) {
- target.className = target.className.replace(className, '');
- }
-
- /**
- * Adds event handler to the target object.
- * @param {Object} obj Target object.
- * @param {String} type Name of the event.
- * @param {Function} func Handling function.
- */
- function attachEvent(obj, type, func, scope) {
- function handler(e) {
- e = e || window.event;
-
- if (!e.target) {
- e.target = e.srcElement;
- e.preventDefault = function () {
- this.returnValue = false;
- };
- }
-
- func.call(scope || window, e);
- };
-
- if (obj.attachEvent) {
- obj.attachEvent('on' + type, handler);
- } else {
- obj.addEventListener(type, handler, false);
- }
- }
-
- /**
- * Looks for a child or parent node which has specified classname.
- * Equivalent to jQuery's $(container).find(".className")
- * @param {Element} target Target element.
- * @param {String} search Class name or node name to look for.
- * @param {Boolean} reverse If set to true, will go up the node tree instead of down.
- * @return {Element} Returns found child or parent element on null.
- */
- function findElement(target, search, reverse /* optional */) {
- if (target == null) return null;
-
- var nodes = reverse != true ? target.childNodes : [target.parentNode],
- propertyToFind = { '#': 'id', '.': 'className' }[search.substr(0, 1)] || 'nodeName',
- expectedValue,
- found;
-
- expectedValue = propertyToFind != 'nodeName' ? search.substr(1) : search.toUpperCase();
-
- // main return of the found node
- if ((target[propertyToFind] || '').indexOf(expectedValue) != -1) return target;
-
- for (var i = 0, l = nodes.length; nodes && i < l && found == null; i++) {
- found = findElement(nodes[i], search, reverse);
- }return found;
- }
-
- /**
- * Looks for a parent node which has specified classname.
- * This is an alias to findElement(container, className, true).
- * @param {Element} target Target element.
- * @param {String} className Class name to look for.
- * @return {Element} Returns found parent element on null.
- */
- function findParentElement(target, className) {
- return findElement(target, className, true);
- }
-
- /**
- * Opens up a centered popup window.
- * @param {String} url URL to open in the window.
- * @param {String} name Popup name.
- * @param {int} width Popup width.
- * @param {int} height Popup height.
- * @param {String} options window.open() options.
- * @return {Window} Returns window instance.
- */
- function popup(url, name, width, height, options) {
- var x = (screen.width - width) / 2,
- y = (screen.height - height) / 2;
-
- options += ', left=' + x + ', top=' + y + ', width=' + width + ', height=' + height;
- options = options.replace(/^,/, '');
-
- var win = window.open(url, name, options);
- win.focus();
- return win;
- }
-
- function getElementsByTagName(name) {
- return document.getElementsByTagName(name);
- }
-
- /**
- * Finds all elements on the page which could be processes by SyntaxHighlighter.
- */
- function findElementsToHighlight(opts) {
- var elements = getElementsByTagName(opts['tagName']),
- scripts,
- i;
-
- // support for feature
- if (opts['useScriptTags']) {
- scripts = getElementsByTagName('script');
-
- for (i = 0; i < scripts.length; i++) {
- if (scripts[i].type.match(/^(text\/)?syntaxhighlighter$/)) elements.push(scripts[i]);
- }
- }
-
- return elements;
- }
-
- function create(name) {
- return document.createElement(name);
- }
-
- /**
- * Quick code mouse double click handler.
- */
- function quickCodeHandler(e) {
- var target = e.target,
- highlighterDiv = findParentElement(target, '.syntaxhighlighter'),
- container = findParentElement(target, '.container'),
- textarea = document.createElement('textarea'),
- highlighter;
-
- if (!container || !highlighterDiv || findElement(container, 'textarea')) return;
-
- //highlighter = highlighters.get(highlighterDiv.id);
-
- // add source class name
- addClass(highlighterDiv, 'source');
-
- // Have to go over each line and grab it's text, can't just do it on the
- // container because Firefox loses all \n where as Webkit doesn't.
- var lines = container.childNodes,
- code = [];
-
- for (var i = 0, l = lines.length; i < l; i++) {
- code.push(lines[i].innerText || lines[i].textContent);
- } // using \r instead of \r or \r\n makes this work equally well on IE, FF and Webkit
- code = code.join('\r');
-
- // For Webkit browsers, replace nbsp with a breaking space
- code = code.replace(/\u00a0/g, " ");
-
- // inject tag
- textarea.readOnly = true; // https://github.com/syntaxhighlighter/syntaxhighlighter/pull/329
- textarea.appendChild(document.createTextNode(code));
- container.appendChild(textarea);
-
- // preselect all text
- textarea.focus();
- textarea.select();
-
- // set up handler for lost focus
- attachEvent(textarea, 'blur', function (e) {
- textarea.parentNode.removeChild(textarea);
- removeClass(highlighterDiv, 'source');
- });
- };
-
- module.exports = {
- quickCodeHandler: quickCodeHandler,
- create: create,
- popup: popup,
- hasClass: hasClass,
- addClass: addClass,
- removeClass: removeClass,
- attachEvent: attachEvent,
- findElement: findElement,
- findParentElement: findParentElement,
- getSyntaxHighlighterScriptTags: getSyntaxHighlighterScriptTags,
- findElementsToHighlight: findElementsToHighlight
- };
-
-/***/ },
-/* 18 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = {
- space: ' ',
-
- /** Enables use of tags. */
- useScriptTags: true,
-
- /** Blogger mode flag. */
- bloggerMode: false,
-
- stripBrs: false,
-
- /** Name of the tag that SyntaxHighlighter will automatically look for. */
- tagName: 'pre'
- };
-
-/***/ },
-/* 19 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = {
- /** Additional CSS class names to be added to highlighter elements. */
- 'class-name': '',
-
- /** First line number. */
- 'first-line': 1,
-
- /**
- * Pads line numbers. Possible values are:
- *
- * false - don't pad line numbers.
- * true - automaticaly pad numbers with minimum required number of leading zeroes.
- * [int] - length up to which pad line numbers.
- */
- 'pad-line-numbers': false,
-
- /** Lines to highlight. */
- 'highlight': null,
-
- /** Title to be displayed above the code block. */
- 'title': null,
-
- /** Enables or disables smart tabs. */
- 'smart-tabs': true,
-
- /** Gets or sets tab size. */
- 'tab-size': 4,
-
- /** Enables or disables gutter. */
- 'gutter': true,
-
- /** Enables quick code copy and paste from double click. */
- 'quick-code': true,
-
- /** Forces code view to be collapsed. */
- 'collapse': false,
-
- /** Enables or disables automatic links. */
- 'auto-links': true,
-
- 'unindent': true,
-
- 'html-script': false
- };
-
-/***/ },
-/* 20 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(process) {'use strict';
-
- var applyRegexList = __webpack_require__(5).applyRegexList;
-
- function HtmlScript(BrushXML, brushClass) {
- var scriptBrush,
- xmlBrush = new BrushXML();
-
- if (brushClass == null) return;
-
- scriptBrush = new brushClass();
-
- if (scriptBrush.htmlScript == null) throw new Error('Brush wasn\'t configured for html-script option: ' + brushClass.brushName);
-
- xmlBrush.regexList.push({ regex: scriptBrush.htmlScript.code, func: process });
-
- this.regexList = xmlBrush.regexList;
-
- function offsetMatches(matches, offset) {
- for (var j = 0, l = matches.length; j < l; j++) {
- matches[j].index += offset;
- }
- }
-
- function process(match, info) {
- var code = match.code,
- results = [],
- regexList = scriptBrush.regexList,
- offset = match.index + match.left.length,
- htmlScript = scriptBrush.htmlScript,
- matches;
-
- function add(matches) {
- results = results.concat(matches);
- }
-
- matches = applyRegexList(code, regexList);
- offsetMatches(matches, offset);
- add(matches);
-
- // add left script bracket
- if (htmlScript.left != null && match.left != null) {
- matches = applyRegexList(match.left, [htmlScript.left]);
- offsetMatches(matches, match.index);
- add(matches);
- }
-
- // add right script bracket
- if (htmlScript.right != null && match.right != null) {
- matches = applyRegexList(match.right, [htmlScript.right]);
- offsetMatches(matches, match.index + match[0].lastIndexOf(match.right));
- add(matches);
- }
-
- for (var j = 0, l = results.length; j < l; j++) {
- results[j].brushName = brushClass.brushName;
- }return results;
- }
- };
-
- module.exports = HtmlScript;
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(21)))
-
-/***/ },
-/* 21 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- // shim for using process in browser
- var process = module.exports = {};
-
- // cached from whatever global is present so that test runners that stub it
- // don't break things. But we need to wrap it in a try catch in case it is
- // wrapped in strict mode code which doesn't define any globals. It's inside a
- // function because try/catches deoptimize in certain engines.
-
- var cachedSetTimeout;
- var cachedClearTimeout;
-
- function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
- }
- function defaultClearTimeout() {
- throw new Error('clearTimeout has not been defined');
- }
- (function () {
- try {
- if (typeof setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- } else {
- cachedSetTimeout = defaultSetTimout;
- }
- } catch (e) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- if (typeof clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- } else {
- cachedClearTimeout = defaultClearTimeout;
- }
- } catch (e) {
- cachedClearTimeout = defaultClearTimeout;
- }
- })();
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- }
- // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch (e) {
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- }
- // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e) {
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
-
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
-
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
-
- var len = queue.length;
- while (len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
-
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- };
-
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
-
- function noop() {}
-
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
-
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
-
- process.cwd = function () {
- return '/';
- };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function () {
- return 0;
- };
-
-/***/ },
-/* 22 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
- var _syntaxhighlighterHtmlRenderer = __webpack_require__(9);
-
- var _syntaxhighlighterHtmlRenderer2 = _interopRequireDefault(_syntaxhighlighterHtmlRenderer);
-
- var _syntaxhighlighterRegex = __webpack_require__(3);
-
- var _syntaxhighlighterMatch = __webpack_require__(5);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
- module.exports = function () {
- function BrushBase() {
- _classCallCheck(this, BrushBase);
- }
-
- _createClass(BrushBase, [{
- key: 'getKeywords',
-
- /**
- * Converts space separated list of keywords into a regular expression string.
- * @param {String} str Space separated keywords.
- * @return {String} Returns regular expression string.
- */
- value: function getKeywords(str) {
- var results = str.replace(/^\s+|\s+$/g, '').replace(/\s+/g, '|');
-
- return '\\b(?:' + results + ')\\b';
- }
-
- /**
- * Makes a brush compatible with the `html-script` functionality.
- * @param {Object} regexGroup Object containing `left` and `right` regular expressions.
- */
-
- }, {
- key: 'forHtmlScript',
- value: function forHtmlScript(regexGroup) {
- var regex = { 'end': regexGroup.right.source };
-
- if (regexGroup.eof) {
- regex.end = '(?:(?:' + regex.end + ')|$)';
- }
-
- this.htmlScript = {
- left: { regex: regexGroup.left, css: 'script' },
- right: { regex: regexGroup.right, css: 'script' },
- code: (0, _syntaxhighlighterRegex.XRegExp)("(?" + regexGroup.left.source + ")" + "(?.*?)" + "(?" + regex.end + ")", "sgi")
- };
- }
- }, {
- key: 'getHtml',
- value: function getHtml(code) {
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
-
- var matches = (0, _syntaxhighlighterMatch.applyRegexList)(code, this.regexList);
- var renderer = new _syntaxhighlighterHtmlRenderer2.default(code, matches, params);
- return renderer.getHtml();
- }
- }]);
-
- return BrushBase;
- }();
-
-/***/ },
-/* 23 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var BrushBase = __webpack_require__(22);
- var regexLib = __webpack_require__(3).commonRegExp;
-
- function Brush() {
- var keywords = 'break case catch class continue ' + 'default delete do else enum export extends false ' + 'for from as function if implements import in instanceof ' + 'interface let new null package private protected ' + 'static return super switch ' + 'this throw true try typeof var while with yield';
-
- this.regexList = [{
- regex: regexLib.multiLineDoubleQuotedString,
- css: 'string'
- }, {
- regex: regexLib.multiLineSingleQuotedString,
- css: 'string'
- }, {
- regex: regexLib.singleLineCComments,
- css: 'comments'
- }, {
- regex: regexLib.multiLineCComments,
- css: 'comments'
- }, {
- regex: /\s*#.*/gm,
- css: 'preprocessor'
- }, {
- regex: new RegExp(this.getKeywords(keywords), 'gm'),
- css: 'keyword'
- }];
-
- this.forHtmlScript(regexLib.scriptScriptTags);
- }
-
- Brush.prototype = new BrushBase();
- Brush.aliases = ['js', 'jscript', 'javascript', 'json'];
- module.exports = Brush;
-
-/***/ },
-/* 24 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
- /*!
- * domready (c) Dustin Diaz 2014 - License MIT
- */
- !function (name, definition) {
-
- if (true) module.exports = definition();else if (typeof define == 'function' && _typeof(define.amd) == 'object') define(definition);else this[name] = definition();
- }('domready', function () {
-
- var fns = [],
- _listener,
- doc = document,
- hack = doc.documentElement.doScroll,
- domContentLoaded = 'DOMContentLoaded',
- loaded = (hack ? /^loaded|^c/ : /^loaded|^i|^c/).test(doc.readyState);
-
- if (!loaded) doc.addEventListener(domContentLoaded, _listener = function listener() {
- doc.removeEventListener(domContentLoaded, _listener);
- loaded = 1;
- while (_listener = fns.shift()) {
- _listener();
- }
- });
-
- return function (fn) {
- loaded ? setTimeout(fn, 0) : fns.push(fn);
- };
- });
-
-/***/ },
-/* 25 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var string = exports.string = function string(value) {
- return value.replace(/^([A-Z])/g, function (_, character) {
- return character.toLowerCase();
- }).replace(/([A-Z])/g, function (_, character) {
- return '-' + character.toLowerCase();
- });
- };
-
- var object = exports.object = function object(value) {
- var result = {};
- Object.keys(value).forEach(function (key) {
- return result[string(key)] = value[key];
- });
- return result;
- };
-
-/***/ }
-/******/ ]);
-//# sourceMappingURL=syntaxhighlighter.js.map
\ No newline at end of file
diff --git a/demo/v2-demo/syntaxHighlighter/theme.css b/demo/v2-demo/syntaxHighlighter/theme.css
deleted file mode 100644
index bbd2546c..00000000
--- a/demo/v2-demo/syntaxHighlighter/theme.css
+++ /dev/null
@@ -1,238 +0,0 @@
-.syntaxhighlighter a,
-.syntaxhighlighter div,
-.syntaxhighlighter code,
-.syntaxhighlighter table,
-.syntaxhighlighter table td,
-.syntaxhighlighter table tr,
-.syntaxhighlighter table tbody,
-.syntaxhighlighter table thead,
-.syntaxhighlighter table caption,
-.syntaxhighlighter textarea {
- -moz-border-radius: 0 0 0 0 !important;
- -webkit-border-radius: 0 0 0 0 !important;
- background: none !important;
- border: 0 !important;
- bottom: auto !important;
- float: none !important;
- height: auto !important;
- left: auto !important;
- line-height: 1.1em !important;
- margin: 0 !important;
- outline: 0 !important;
- overflow: visible !important;
- padding: 0 !important;
- position: static !important;
- right: auto !important;
- text-align: left !important;
- top: auto !important;
- vertical-align: baseline !important;
- width: auto !important;
- box-sizing: content-box !important;
- font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
- font-weight: normal !important;
- font-style: normal !important;
- font-size: 1em !important;
- min-height: inherit !important;
- min-height: auto !important; }
-
-.syntaxhighlighter {
- width: 100% !important;
- margin: 1em 0 1em 0 !important;
- position: relative !important;
- overflow: auto !important;
- font-size: 1em !important; }
- .syntaxhighlighter .container:before, .syntaxhighlighter .container:after {
- content: none !important; }
- .syntaxhighlighter.source {
- overflow: hidden !important; }
- .syntaxhighlighter .bold {
- font-weight: bold !important; }
- .syntaxhighlighter .italic {
- font-style: italic !important; }
- .syntaxhighlighter .line {
- white-space: pre !important; }
- .syntaxhighlighter table {
- width: 100% !important; }
- .syntaxhighlighter table caption {
- text-align: left !important;
- padding: .5em 0 0.5em 1em !important; }
- .syntaxhighlighter table td.code {
- width: 100% !important; }
- .syntaxhighlighter table td.code .container {
- position: relative !important; }
- .syntaxhighlighter table td.code .container textarea {
- box-sizing: border-box !important;
- position: absolute !important;
- left: 0 !important;
- top: 0 !important;
- width: 100% !important;
- height: 100% !important;
- border: none !important;
- background: white !important;
- padding-left: 1em !important;
- overflow: hidden !important;
- white-space: pre !important; }
- .syntaxhighlighter table td.gutter .line {
- text-align: right !important;
- padding: 0 0.5em 0 1em !important; }
- .syntaxhighlighter table td.code .line {
- padding: 0 1em !important; }
- .syntaxhighlighter.nogutter td.code .container textarea, .syntaxhighlighter.nogutter td.code .line {
- padding-left: 0em !important; }
- .syntaxhighlighter.show {
- display: block !important; }
- .syntaxhighlighter.collapsed table {
- display: none !important; }
- .syntaxhighlighter.collapsed .toolbar {
- padding: 0.1em 0.8em 0em 0.8em !important;
- font-size: 1em !important;
- position: static !important;
- width: auto !important;
- height: auto !important; }
- .syntaxhighlighter.collapsed .toolbar span {
- display: inline !important;
- margin-right: 1em !important; }
- .syntaxhighlighter.collapsed .toolbar span a {
- padding: 0 !important;
- display: none !important; }
- .syntaxhighlighter.collapsed .toolbar span a.expandSource {
- display: inline !important; }
- .syntaxhighlighter .toolbar {
- position: absolute !important;
- right: 1px !important;
- top: 1px !important;
- width: 11px !important;
- height: 11px !important;
- font-size: 10px !important;
- z-index: 10 !important; }
- .syntaxhighlighter .toolbar span.title {
- display: inline !important; }
- .syntaxhighlighter .toolbar a {
- display: block !important;
- text-align: center !important;
- text-decoration: none !important;
- padding-top: 1px !important; }
- .syntaxhighlighter .toolbar a.expandSource {
- display: none !important; }
- .syntaxhighlighter.ie {
- font-size: .9em !important;
- padding: 1px 0 1px 0 !important; }
- .syntaxhighlighter.ie .toolbar {
- line-height: 8px !important; }
- .syntaxhighlighter.ie .toolbar a {
- padding-top: 0px !important; }
- .syntaxhighlighter.printing .line.alt1 .content,
- .syntaxhighlighter.printing .line.alt2 .content,
- .syntaxhighlighter.printing .line.highlighted .number,
- .syntaxhighlighter.printing .line.highlighted.alt1 .content,
- .syntaxhighlighter.printing .line.highlighted.alt2 .content {
- background: none !important; }
- .syntaxhighlighter.printing .line .number {
- color: #bbbbbb !important; }
- .syntaxhighlighter.printing .line .content {
- color: black !important; }
- .syntaxhighlighter.printing .toolbar {
- display: none !important; }
- .syntaxhighlighter.printing a {
- text-decoration: none !important; }
- .syntaxhighlighter.printing .plain, .syntaxhighlighter.printing .plain a {
- color: black !important; }
- .syntaxhighlighter.printing .comments, .syntaxhighlighter.printing .comments a {
- color: #008200 !important; }
- .syntaxhighlighter.printing .string, .syntaxhighlighter.printing .string a {
- color: blue !important; }
- .syntaxhighlighter.printing .keyword {
- color: #006699 !important;
- font-weight: bold !important; }
- .syntaxhighlighter.printing .preprocessor {
- color: gray !important; }
- .syntaxhighlighter.printing .variable {
- color: #aa7700 !important; }
- .syntaxhighlighter.printing .value {
- color: #009900 !important; }
- .syntaxhighlighter.printing .functions {
- color: #ff1493 !important; }
- .syntaxhighlighter.printing .constants {
- color: #0066cc !important; }
- .syntaxhighlighter.printing .script {
- font-weight: bold !important; }
- .syntaxhighlighter.printing .color1, .syntaxhighlighter.printing .color1 a {
- color: gray !important; }
- .syntaxhighlighter.printing .color2, .syntaxhighlighter.printing .color2 a {
- color: #ff1493 !important; }
- .syntaxhighlighter.printing .color3, .syntaxhighlighter.printing .color3 a {
- color: red !important; }
- .syntaxhighlighter.printing .break, .syntaxhighlighter.printing .break a {
- color: black !important; }
-
-.syntaxhighlighter {
- background-color: white !important; }
- .syntaxhighlighter .line.alt1 {
- background-color: white !important; }
- .syntaxhighlighter .line.alt2 {
- background-color: white !important; }
- .syntaxhighlighter .line.highlighted.alt1, .syntaxhighlighter .line.highlighted.alt2 {
- background-color: #e0e0e0 !important; }
- .syntaxhighlighter .line.highlighted.number {
- color: black !important; }
- .syntaxhighlighter table caption {
- color: black !important; }
- .syntaxhighlighter table td.code .container textarea {
- background: white;
- color: black; }
- .syntaxhighlighter .gutter {
- color: #afafaf !important; }
- .syntaxhighlighter .gutter .line {
- border-right: 3px solid #6ce26c !important; }
- .syntaxhighlighter .gutter .line.highlighted {
- background-color: #6ce26c !important;
- color: white !important; }
- .syntaxhighlighter.printing .line .content {
- border: none !important; }
- .syntaxhighlighter.collapsed {
- overflow: visible !important; }
- .syntaxhighlighter.collapsed .toolbar {
- color: #00f !important;
- background: #fff !important;
- border: 1px solid #6ce26c !important; }
- .syntaxhighlighter.collapsed .toolbar a {
- color: #00f !important; }
- .syntaxhighlighter.collapsed .toolbar a:hover {
- color: #f00 !important; }
- .syntaxhighlighter .toolbar {
- color: #fff !important;
- background: #6ce26c !important;
- border: none !important; }
- .syntaxhighlighter .toolbar a {
- color: #fff !important; }
- .syntaxhighlighter .toolbar a:hover {
- color: #000 !important; }
- .syntaxhighlighter .plain, .syntaxhighlighter .plain a {
- color: black !important; }
- .syntaxhighlighter .comments, .syntaxhighlighter .comments a {
- color: #008200 !important; }
- .syntaxhighlighter .string, .syntaxhighlighter .string a {
- color: blue !important; }
- .syntaxhighlighter .keyword {
- font-weight: bold !important;
- color: #006699 !important; }
- .syntaxhighlighter .preprocessor {
- color: gray !important; }
- .syntaxhighlighter .variable {
- color: #aa7700 !important; }
- .syntaxhighlighter .value {
- color: #009900 !important; }
- .syntaxhighlighter .functions {
- color: #ff1493 !important; }
- .syntaxhighlighter .constants {
- color: #0066cc !important; }
- .syntaxhighlighter .script {
- font-weight: bold !important;
- color: #006699 !important;
- background-color: none !important; }
- .syntaxhighlighter .color1, .syntaxhighlighter .color1 a {
- color: gray !important; }
- .syntaxhighlighter .color2, .syntaxhighlighter .color2 a {
- color: #ff1493 !important; }
- .syntaxhighlighter .color3, .syntaxhighlighter .color3 a {
- color: red !important; }
diff --git a/dist/powerbi-client.d.ts b/dist/powerbi-client.d.ts
index cd10f2e6..5431d0a9 100644
--- a/dist/powerbi-client.d.ts
+++ b/dist/powerbi-client.d.ts
@@ -1,4 +1,19 @@
-/*! powerbi-client v2.17.1 | (c) 2016 Microsoft Corporation MIT */
+// powerbi-client v2.23.1
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+declare module "config" {
+ /** @ignore */ /** */
+ const config: {
+ version: string;
+ type: string;
+ };
+ export default config;
+}
+declare module "errors" {
+ export const APINotSupportedForRDLError = "This API is currently not supported for RDL reports";
+ export const EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL";
+ export const invalidEmbedUrlErrorMessage: string;
+}
declare module "util" {
import { HttpPostMessage } from 'http-post-message';
/**
@@ -95,28 +110,30 @@ declare module "util" {
export function getRandomValue(): number;
/**
* Returns the time interval between two dates in milliseconds
+ *
* @export
* @param {Date} start
* @param {Date} end
* @returns {number}
*/
export function getTimeDiffInMilliseconds(start: Date, end: Date): number;
-}
-declare module "config" {
- /** @ignore */ /** */
- const config: {
- version: string;
- type: string;
- };
- export default config;
-}
-declare module "errors" {
- export let APINotSupportedForRDLError: string;
- export let EmbedUrlNotSupported: string;
+ /**
+ * Checks if the embed type is for create
+ *
+ * @export
+ * @param {string} embedType
+ * @returns {boolean}
+ */
+ export function isCreate(embedType: string): boolean;
+ /**
+ * Checks if the embedUrl has an allowed power BI domain
+ * @hidden
+ */
+ export function validateEmbedUrl(embedUrl: string): boolean;
}
declare module "embed" {
- import * as service from "service";
import * as models from 'powerbi-models';
+ import { ICustomEvent, IEvent, IEventHandler, Service } from "service";
global {
interface Document {
mozCancelFullScreen: any;
@@ -139,13 +156,23 @@ declare module "embed" {
export type IDashboardEmbedConfiguration = models.IDashboardEmbedConfiguration;
export type ITileEmbedConfiguration = models.ITileEmbedConfiguration;
export type IQnaEmbedConfiguration = models.IQnaEmbedConfiguration;
+ export type IQuickCreateConfiguration = models.IQuickCreateConfiguration;
+ export type IReportCreateConfiguration = models.IReportCreateConfiguration;
export type ILocaleSettings = models.ILocaleSettings;
export type IQnaSettings = models.IQnaSettings;
export type IEmbedSettings = models.ISettings;
/** @hidden */
export interface IInternalEventHandler {
- test(event: service.IEvent): boolean;
- handle(event: service.ICustomEvent): void;
+ test(event: IEvent): boolean;
+ handle(event: ICustomEvent): void;
+ }
+ /** @hidden */
+ export interface ISessionHeaders {
+ uid: string;
+ sdkSessionId: string;
+ tokenProviderSupplied?: boolean;
+ bootstrapped?: boolean;
+ sdkVersion?: string;
}
/**
* Base class for all Power BI embed components
@@ -173,7 +200,13 @@ declare module "embed" {
/** @hidden */
static maxFrontLoadTimes: number;
/** @hidden */
- allowedEvents: any[];
+ allowedEvents: string[];
+ /** @hidden */
+ protected commands: models.ICommandExtension[];
+ /** @hidden */
+ protected initialLayoutType: models.LayoutType;
+ /** @hidden */
+ groups: models.IMenuGroupExtension[];
/**
* Gets or sets the event handler registered for this embed component.
*
@@ -181,13 +214,20 @@ declare module "embed" {
* @hidden
*/
eventHandlers: IInternalEventHandler[];
+ /**
+ * Gets or sets the eventHooks.
+ *
+ * @type {models.EventHooks}
+ * @hidden
+ */
+ eventHooks: models.EventHooks;
/**
* Gets or sets the Power BI embed service.
*
* @type {service.Service}
* @hidden
*/
- service: service.Service;
+ service: Service;
/**
* Gets or sets the HTML element that contains the Power BI embed component.
*
@@ -225,35 +265,33 @@ declare module "embed" {
* @hidden
*/
bootstrapConfig: IBootstrapEmbedConfiguration;
- /**
- * Gets or sets the configuration settings for creating report.
- *
- * @type {models.IReportCreateConfiguration}
- * @hidden
- */
- createConfig: models.IReportCreateConfiguration;
/**
* Url used in the load request.
+ *
* @hidden
*/
loadPath: string;
/**
* Url used in the load request.
+ *
* @hidden
*/
phasedLoadPath: string;
/**
* Type of embed
+ *
* @hidden
*/
embedtype: string;
/**
* Handler function for the 'ready' event
+ *
* @hidden
*/
frontLoadHandler: () => any;
/**
* The time the last /load request was sent
+ *
* @hidden
*/
lastLoadRequest: Date;
@@ -268,20 +306,14 @@ declare module "embed" {
* @param {IEmbedConfigurationBase} config
* @hidden
*/
- constructor(service: service.Service, element: HTMLElement, config: IEmbedConfigurationBase, iframe?: HTMLIFrameElement, phasedRender?: boolean, isBootstrap?: boolean);
+ constructor(service: Service, element: HTMLElement, config: IEmbedConfigurationBase, iframe?: HTMLIFrameElement, phasedRender?: boolean, isBootstrap?: boolean);
/**
- * Sends createReport configuration data.
+ * Create is not supported by default
*
- * ```javascript
- * createReport({
- * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55',
- * accessToken: 'eyJ0eXA ... TaE2rTSbmg',
- * ```
* @hidden
- * @param {models.IReportCreateConfiguration} config
* @returns {Promise}
*/
- createReport(config: models.IReportCreateConfiguration): Promise;
+ create(): Promise;
/**
* Saves Report.
*
@@ -328,6 +360,7 @@ declare module "embed" {
* })
* .catch(error => { ... });
* ```
+ *
* @hidden
* @param {models.ILoadConfiguration} config
* @param {boolean} phasedRender
@@ -353,9 +386,9 @@ declare module "embed" {
*
* @template T
* @param {string} eventName
- * @param {service.IEventHandler} [handler]
+ * @param {IEventHandler} [handler]
*/
- off(eventName: string, handler?: service.IEventHandler): void;
+ off(eventName: string, handler?: IEventHandler): void;
/**
* Adds an event handler for a specific event.
*
@@ -369,7 +402,7 @@ declare module "embed" {
* @param {string} eventName
* @param {service.IEventHandler} handler
*/
- on(eventName: string, handler: service.IEventHandler): void;
+ on(eventName: string, handler: IEventHandler): void;
/**
* Reloads embed using existing configuration.
* E.g. For reports this effectively clears all filters and makes the first page active which simulates resetting a report back to loaded state.
@@ -402,6 +435,14 @@ declare module "embed" {
* @returns {void}
*/
populateConfig(config: IBootstrapEmbedConfiguration, isBootstrap: boolean): void;
+ /**
+ * Validate EventHooks
+ *
+ * @private
+ * @param {models.EventHooks} eventHooks
+ * @hidden
+ */
+ private validateEventHooks;
/**
* Adds locale parameters to embedUrl
*
@@ -488,6 +529,7 @@ declare module "embed" {
abstract validate(config: IEmbedConfigurationBase): models.IError[];
/**
* Sets Iframe for embed
+ *
* @hidden
*/
private setIframe;
@@ -502,7 +544,7 @@ declare module "embed" {
/**
* Removes element's tabindex attribute
*/
- removeComponentTabIndex(tabIndex?: number): void;
+ removeComponentTabIndex(_tabIndex?: number): void;
/**
* Adds the ability to get groupId from url.
* By extracting the ID we can ensure that the ID is always explicitly provided as part of the load configuration.
@@ -515,6 +557,7 @@ declare module "embed" {
static findGroupIdFromEmbedUrl(url: string): string;
/**
* Sends the config for front load calls, after 'ready' message is received from the iframe
+ *
* @hidden
*/
private frontLoadSendConfig;
@@ -561,7 +604,7 @@ declare module "ifilterable" {
}
}
declare module "visualDescriptor" {
- import { ExportDataType, FiltersOperations, ICloneVisualRequest, ICloneVisualResponse, IExportDataResult, IFilter, ISlicerState, ISortByVisualRequest, IVisualLayout } from 'powerbi-models';
+ import { ExportDataType, FiltersOperations, ICloneVisualRequest, ICloneVisualResponse, IExportDataResult, IFilter, ISlicerState, ISmartNarratives, ISortByVisualRequest, IVisualLayout, VisualContainerDisplayMode } from 'powerbi-models';
import { IHttpPostMessageResponse } from 'http-post-message';
import { IFilterable } from "ifilterable";
import { IPageNode } from "page";
@@ -668,6 +711,7 @@ declare module "visualDescriptor" {
/**
* Exports Visual data.
* Can export up to 30K rows.
+ *
* @param rows: Optional. Default value is 30K, maximum value is 30K as well.
* @param exportDataType: Optional. Default is ExportDataType.Summarized.
* ```javascript
@@ -681,6 +725,7 @@ declare module "visualDescriptor" {
/**
* Set slicer state.
* Works only for visuals of type slicer.
+ *
* @param state: A new state which contains the slicer filters.
* ```javascript
* visual.setSlicerState()
@@ -717,11 +762,60 @@ declare module "visualDescriptor" {
* ```
*/
sortBy(request: ISortByVisualRequest): Promise>;
+ /**
+ * Updates the position of a visual.
+ *
+ * ```javascript
+ * visual.moveVisual(x, y, z)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ * @returns {Promise>}
+ */
+ moveVisual(x: number, y: number, z?: number): Promise>;
+ /**
+ * Updates the display state of a visual.
+ *
+ * ```javascript
+ * visual.setVisualDisplayState(displayState)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {VisualContainerDisplayMode} displayState
+ * @returns {Promise>}
+ */
+ setVisualDisplayState(displayState: VisualContainerDisplayMode): Promise>;
+ /**
+ * Resize a visual.
+ *
+ * ```javascript
+ * visual.resizeVisual(width, height)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {number} width
+ * @param {number} height
+ * @returns {Promise>}
+ */
+ resizeVisual(width: number, height: number): Promise>;
+ /**
+ * Get insights for single visual
+ *
+ * ```javascript
+ * visual.getSmartNarrativeInsights();
+ * ```
+ *
+ * @returns {Promise}
+ */
+ getSmartNarrativeInsights(): Promise;
}
}
declare module "page" {
import { IHttpPostMessageResponse } from 'http-post-message';
- import { DisplayOption, FiltersOperations, ICustomPageSize, IFilter, SectionVisibility } from 'powerbi-models';
+ import { DisplayOption, FiltersOperations, ICustomPageSize, IFilter, IVisual, LayoutType, PageSizeType, SectionVisibility, VisualContainerDisplayMode, IPageBackground, IPageWallpaper, ISmartNarratives } from 'powerbi-models';
import { IFilterable } from "ifilterable";
import { IReportNode } from "report";
import { VisualDescriptor } from "visualDescriptor";
@@ -782,12 +876,30 @@ declare module "page" {
* @type {ICustomPageSize}
*/
defaultSize: ICustomPageSize;
+ /**
+ * Mobile view page size (if defined) as saved in the report.
+ *
+ * @type {ICustomPageSize}
+ */
+ mobileSize: ICustomPageSize;
/**
* Page display options as saved in the report.
*
* @type {ICustomPageSize}
*/
defaultDisplayOption: DisplayOption;
+ /**
+ * Page background color.
+ *
+ * @type {IPageBackground}
+ */
+ background: IPageBackground;
+ /**
+ * Page wallpaper color.
+ *
+ * @type {IPageWallpaper}
+ */
+ wallpaper: IPageWallpaper;
/**
* Creates an instance of a Power BI report page.
*
@@ -798,7 +910,17 @@ declare module "page" {
* @param {SectionVisibility} [visibility]
* @hidden
*/
- constructor(report: IReportNode, name: string, displayName?: string, isActivePage?: boolean, visibility?: SectionVisibility, defaultSize?: ICustomPageSize, defaultDisplayOption?: DisplayOption);
+ constructor(report: IReportNode, name: string, displayName?: string, isActivePage?: boolean, visibility?: SectionVisibility, defaultSize?: ICustomPageSize, defaultDisplayOption?: DisplayOption, mobileSize?: ICustomPageSize, background?: IPageBackground, wallpaper?: IPageWallpaper);
+ /**
+ * Get insights for report page
+ *
+ * ```javascript
+ * page.getSmartNarrativeInsights();
+ * ```
+ *
+ * @returns {Promise}
+ */
+ getSmartNarrativeInsights(): Promise;
/**
* Gets all page level filters within the report.
*
@@ -886,6 +1008,89 @@ declare module "page" {
* @returns {Promise}
*/
getVisuals(): Promise;
+ /**
+ * Gets a visual by name on the page.
+ *
+ * ```javascript
+ * page.getVisualByName(visualName: string)
+ * .then(visual => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {string} visualName
+ * @returns {Promise}
+ */
+ getVisualByName(visualName: string): Promise;
+ /**
+ * Updates the display state of a visual in a page.
+ *
+ * ```javascript
+ * page.setVisualDisplayState(visualName, displayState)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {string} visualName
+ * @param {VisualContainerDisplayMode} displayState
+ * @returns {Promise>}
+ */
+ setVisualDisplayState(visualName: string, displayState: VisualContainerDisplayMode): Promise>;
+ /**
+ * Updates the position of a visual in a page.
+ *
+ * ```javascript
+ * page.moveVisual(visualName, x, y, z)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {string} visualName
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ * @returns {Promise>}
+ */
+ moveVisual(visualName: string, x: number, y: number, z?: number): Promise>;
+ /**
+ * Resize a visual in a page.
+ *
+ * ```javascript
+ * page.resizeVisual(visualName, width, height)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {string} visualName
+ * @param {number} width
+ * @param {number} height
+ * @returns {Promise>}
+ */
+ resizeVisual(visualName: string, width: number, height: number): Promise>;
+ /**
+ * Updates the size of active page.
+ *
+ * ```javascript
+ * page.resizePage(pageSizeType, width, height)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {PageSizeType} pageSizeType
+ * @param {number} width
+ * @param {number} height
+ * @returns {Promise>}
+ */
+ resizePage(pageSizeType: PageSizeType, width?: number, height?: number): Promise>;
+ /**
+ * Gets the list of slicer visuals on the page.
+ *
+ * ```javascript
+ * page.getSlicers()
+ * .then(slicers => {
+ * ...
+ * });
+ * ```
+ *
+ * @returns {Promise}
+ */
+ getSlicers(): Promise;
/**
* Checks if page has layout.
*
@@ -896,11 +1101,11 @@ declare module "page" {
*
* @returns {(Promise)}
*/
- hasLayout(layoutType: any): Promise;
+ hasLayout(layoutType: LayoutType): Promise;
}
}
declare module "report" {
- import { IReportLoadConfiguration, IReportEmbedConfiguration, FiltersOperations, IError, IFilter, IReportTheme, ISettings, SectionVisibility, ViewMode, IEmbedConfiguration, IEmbedConfigurationBase } from 'powerbi-models';
+ import { IReportLoadConfiguration, IReportEmbedConfiguration, FiltersOperations, IError, IFilter, IReportTheme, ISettings, LayoutType, SectionVisibility, ViewMode, IEmbedConfiguration, IEmbedConfigurationBase, MenuLocation, PageSizeType, VisualContainerDisplayMode } from 'powerbi-models';
import { IHttpPostMessageResponse } from 'http-post-message';
import { IService, Service } from "service";
import { Embed } from "embed";
@@ -1084,6 +1289,33 @@ declare module "report" {
* @returns {Promise}
*/
getPages(): Promise;
+ /**
+ * Gets a report page by its name.
+ *
+ * ```javascript
+ * report.getPageByName(pageName)
+ * .then(page => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {string} pageName
+ * @returns {Promise}
+ */
+ getPageByName(pageName: string): Promise;
+ /**
+ * Gets the active report page.
+ *
+ * ```javascript
+ * report.getActivePage()
+ * .then(activePage => {
+ * ...
+ * });
+ * ```
+ *
+ * @returns {Promise}
+ */
+ getActivePage(): Promise;
/**
* Creates an instance of a Page.
*
@@ -1121,8 +1353,11 @@ declare module "report" {
*
* ```javascript
* const newSettings = {
- * navContentPaneEnabled: true,
- * filterPaneEnabled: false
+ * panes: {
+ * filters: {
+ * visible: false
+ * }
+ * }
* };
*
* report.updateSettings(newSettings)
@@ -1190,6 +1425,14 @@ declare module "report" {
* ```
*/
resetTheme(): Promise;
+ /**
+ * get the theme of the report
+ *
+ * ```javascript
+ * report.getTheme();
+ * ```
+ */
+ getTheme(): Promise;
/**
* Reset user's filters, slicers, and other data view changes to the default state of the report
*
@@ -1218,69 +1461,274 @@ declare module "report" {
*/
arePersistentFiltersApplied(): Promise;
/**
- * @hidden
- */
- private applyThemeInternal;
- /**
- * @hidden
- */
- private viewModeToString;
- /**
- * @hidden
- */
- private isMobileSettings;
- }
-}
-declare module "create" {
- import * as service from "service";
- import * as models from 'powerbi-models';
- import * as embed from "embed";
- /**
- * A Power BI Report creator component
- *
- * @export
- * @class Create
- * @extends {embed.Embed}
- */
- export class Create extends embed.Embed {
- constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfiguration | models.IReportCreateConfiguration, phasedRender?: boolean, isBootstrap?: boolean);
- /**
- * Gets the dataset ID from the first available location: createConfig or embed url.
+ * Remove context menu extension command.
*
- * @returns {string}
+ * ```javascript
+ * report.removeContextMenuCommand(commandName, contextMenuTitle)
+ * .catch(error => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {string} commandName
+ * @param {string} contextMenuTitle
+ * @returns {Promise>}
*/
- getId(): string;
+ removeContextMenuCommand(commandName: string, contextMenuTitle: string): Promise>;
/**
- * Validate create report configuration.
+ * Add context menu extension command.
+ *
+ * ```javascript
+ * report.addContextMenuCommand(commandName, commandTitle, contextMenuTitle, menuLocation, visualName, visualType, groupName)
+ * .catch(error => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {string} commandName
+ * @param {string} commandTitle
+ * @param {string} contextMenuTitle
+ * @param {MenuLocation} menuLocation
+ * @param {string} visualName
+ * @param {string} visualType
+ * @param {string} groupName
+ * @returns {Promise>}
*/
- validate(config: embed.IEmbedConfigurationBase): models.IError[];
+ addContextMenuCommand(commandName: string, commandTitle: string, contextMenuTitle: string, menuLocation: MenuLocation, visualName: string, visualType: string, groupName?: string): Promise>;
/**
- * Handle config changes.
+ * Remove options menu extension command.
*
- * @hidden
- * @returns {void}
+ * ```javascript
+ * report.removeOptionsMenuCommand(commandName, optionsMenuTitle)
+ * .then({
+ * ...
+ * });
+ * ```
+ *
+ * @param {string} commandName
+ * @param {string} optionsMenuTitle
+ * @returns {Promise>}
*/
- configChanged(isBootstrap: boolean): void;
+ removeOptionsMenuCommand(commandName: string, optionsMenuTitle: string): Promise>;
/**
- * @hidden
- * @returns {string}
+ * Add options menu extension command.
+ *
+ * ```javascript
+ * report.addOptionsMenuCommand(commandName, commandTitle, optionsMenuTitle, menuLocation, visualName, visualType, groupName, commandIcon)
+ * .catch(error => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {string} commandName
+ * @param {string} commandTitle
+ * @param {string} optionMenuTitle
+ * @param {MenuLocation} menuLocation
+ * @param {string} visualName
+ * @param {string} visualType
+ * @param {string} groupName
+ * @param {string} commandIcon
+ * @returns {Promise>}
*/
- getDefaultEmbedUrlEndpoint(): string;
+ addOptionsMenuCommand(commandName: string, commandTitle: string, optionsMenuTitle?: string, menuLocation?: MenuLocation, visualName?: string, visualType?: string, groupName?: string, commandIcon?: string): Promise>;
/**
- * checks if the report is saved.
+ * Updates the display state of a visual in a page.
*
* ```javascript
- * report.isSaved()
+ * report.setVisualDisplayState(pageName, visualName, displayState)
+ * .catch(error => { ... });
* ```
*
- * @returns {Promise}
+ * @param {string} pageName
+ * @param {string} visualName
+ * @param {VisualContainerDisplayMode} displayState
+ * @returns {Promise>}
*/
- isSaved(): Promise;
+ setVisualDisplayState(pageName: string, visualName: string, displayState: VisualContainerDisplayMode): Promise>;
/**
- * Adds the ability to get datasetId from url.
- * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
+ * Resize a visual in a page.
*
- * By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration.
+ * ```javascript
+ * report.resizeVisual(pageName, visualName, width, height)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {string} pageName
+ * @param {string} visualName
+ * @param {number} width
+ * @param {number} height
+ * @returns {Promise>}
+ */
+ resizeVisual(pageName: string, visualName: string, width: number, height: number): Promise>;
+ /**
+ * Updates the size of active page in report.
+ *
+ * ```javascript
+ * report.resizeActivePage(pageSizeType, width, height)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {PageSizeType} pageSizeType
+ * @param {number} width
+ * @param {number} height
+ * @returns {Promise>}
+ */
+ resizeActivePage(pageSizeType: PageSizeType, width?: number, height?: number): Promise>;
+ /**
+ * Updates the position of a visual in a page.
+ *
+ * ```javascript
+ * report.moveVisual(pageName, visualName, x, y, z)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {string} pageName
+ * @param {string} visualName
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ * @returns {Promise>}
+ */
+ moveVisual(pageName: string, visualName: string, x: number, y: number, z?: number): Promise>;
+ /**
+ * Updates the report layout
+ *
+ * ```javascript
+ * report.switchLayout(layoutType);
+ * ```
+ *
+ * @param {LayoutType} layoutType
+ * @returns {Promise>}
+ */
+ switchLayout(layoutType: LayoutType): Promise>;
+ /**
+ * @hidden
+ */
+ private createMenuCommand;
+ /**
+ * @hidden
+ */
+ private findCommandMenuIndex;
+ /**
+ * @hidden
+ */
+ private buildLayoutSettingsObject;
+ /**
+ * @hidden
+ */
+ private validateVisual;
+ /**
+ * @hidden
+ */
+ private applyThemeInternal;
+ /**
+ * @hidden
+ */
+ private viewModeToString;
+ /**
+ * @hidden
+ */
+ private isMobileSettings;
+ /**
+ * Return the current zoom level of the report.
+ *
+ * @returns {Promise}
+ */
+ getZoom(): Promise;
+ /**
+ * Sets the report's zoom level.
+ *
+ * @param zoomLevel zoom level to set
+ */
+ setZoom(zoomLevel: number): Promise;
+ /**
+ * Closes all open context menus and tooltips.
+ *
+ * ```javascript
+ * report.closeAllOverlays()
+ * .then(() => {
+ * ...
+ * });
+ * ```
+ *
+ * @returns {Promise}
+ */
+ closeAllOverlays(): Promise;
+ /**
+ * Clears selected not popped out visuals, if flag is passed, all visuals selections will be cleared.
+ *
+ * ```javascript
+ * report.clearSelectedVisuals()
+ * .then(() => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {Boolean} [clearPopOutState=false]
+ * If false / undefined visuals selection will not be cleared if one of visuals
+ * is in popped out state (in focus, show as table, spotlight...)
+ * @returns {Promise}
+ */
+ clearSelectedVisuals(clearPopOutState?: boolean): Promise;
+ }
+}
+declare module "create" {
+ import { IReportCreateConfiguration, IError } from 'powerbi-models';
+ import { Service } from "service";
+ import { Embed, IEmbedConfigurationBase, IEmbedConfiguration } from "embed";
+ /**
+ * A Power BI Report creator component
+ *
+ * @export
+ * @class Create
+ * @extends {Embed}
+ */
+ export class Create extends Embed {
+ /**
+ * Gets or sets the configuration settings for creating report.
+ *
+ * @type {IReportCreateConfiguration}
+ * @hidden
+ */
+ createConfig: IReportCreateConfiguration;
+ constructor(service: Service, element: HTMLElement, config: IEmbedConfiguration | IReportCreateConfiguration, phasedRender?: boolean, isBootstrap?: boolean);
+ /**
+ * Gets the dataset ID from the first available location: createConfig or embed url.
+ *
+ * @returns {string}
+ */
+ getId(): string;
+ /**
+ * Validate create report configuration.
+ */
+ validate(config: IEmbedConfigurationBase): IError[];
+ /**
+ * Handle config changes.
+ *
+ * @hidden
+ * @returns {void}
+ */
+ configChanged(isBootstrap: boolean): void;
+ /**
+ * @hidden
+ * @returns {string}
+ */
+ getDefaultEmbedUrlEndpoint(): string;
+ /**
+ * checks if the report is saved.
+ *
+ * ```javascript
+ * report.isSaved()
+ * ```
+ *
+ * @returns {Promise}
+ */
+ isSaved(): Promise;
+ /**
+ * Adds the ability to get datasetId from url.
+ * (e.g. http://embedded.powerbi.com/appTokenReportEmbed?datasetId=854846ed-2106-4dc2-bc58-eb77533bf2f1).
+ *
+ * By extracting the ID we can ensure that the ID is always explicitly provided as part of the create configuration.
*
* @static
* @param {string} url
@@ -1288,12 +1736,25 @@ declare module "create" {
* @hidden
*/
static findIdFromEmbedUrl(url: string): string;
+ /**
+ * Sends create configuration data.
+ *
+ * ```javascript
+ * create ({
+ * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55',
+ * accessToken: 'eyJ0eXA ... TaE2rTSbmg',
+ * ```
+ *
+ * @hidden
+ * @returns {Promise}
+ */
+ create(): Promise;
}
}
declare module "dashboard" {
- import * as service from "service";
- import * as embed from "embed";
- import * as models from 'powerbi-models';
+ import { IError } from 'powerbi-models';
+ import { Service, IService } from "service";
+ import { Embed, IEmbedConfigurationBase } from "embed";
/**
* A Dashboard node within a dashboard hierarchy
*
@@ -1302,18 +1763,18 @@ declare module "dashboard" {
*/
export interface IDashboardNode {
iframe: HTMLIFrameElement;
- service: service.IService;
- config: embed.IEmbedConfigurationBase;
+ service: IService;
+ config: IEmbedConfigurationBase;
}
/**
* A Power BI Dashboard embed component
*
* @export
* @class Dashboard
- * @extends {embed.Embed}
+ * @extends {Embed}
* @implements {IDashboardNode}
*/
- export class Dashboard extends embed.Embed implements IDashboardNode {
+ export class Dashboard extends Embed implements IDashboardNode {
/** @hidden */
static allowedEvents: string[];
/** @hidden */
@@ -1329,12 +1790,13 @@ declare module "dashboard" {
* @hidden
* @param {HTMLElement} element
*/
- constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
+ constructor(service: Service, element: HTMLElement, config: IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
/**
* This adds backwards compatibility for older config which used the dashboardId query param to specify dashboard id.
* E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e
*
* By extracting the id we can ensure id is always explicitly provided as part of the load configuration.
+ *
* @hidden
* @static
* @param {string} url
@@ -1352,9 +1814,10 @@ declare module "dashboard" {
*
* @hidden
*/
- validate(baseConfig: embed.IEmbedConfigurationBase): models.IError[];
+ validate(baseConfig: IEmbedConfigurationBase): IError[];
/**
* Handle config changes.
+ *
* @hidden
* @returns {void}
*/
@@ -1365,16 +1828,17 @@ declare module "dashboard" {
*/
getDefaultEmbedUrlEndpoint(): string;
/**
- * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView
+ * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in PageView
+ *
* @hidden
*/
- private ValidatePageView;
+ private validatePageView;
}
}
declare module "tile" {
- import * as service from "service";
- import * as models from 'powerbi-models';
- import * as embed from "embed";
+ import { IError } from 'powerbi-models';
+ import { Service } from "service";
+ import { Embed, IEmbedConfigurationBase } from "embed";
/**
* The Power BI tile embed component
*
@@ -1382,7 +1846,7 @@ declare module "tile" {
* @class Tile
* @extends {Embed}
*/
- export class Tile extends embed.Embed {
+ export class Tile extends Embed {
/** @hidden */
static type: string;
/** @hidden */
@@ -1390,7 +1854,7 @@ declare module "tile" {
/**
* @hidden
*/
- constructor(service: service.Service, element: HTMLElement, baseConfig: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
+ constructor(service: Service, element: HTMLElement, baseConfig: IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
/**
* The ID of the tile
*
@@ -1400,7 +1864,7 @@ declare module "tile" {
/**
* Validate load configuration.
*/
- validate(config: embed.IEmbedConfigurationBase): models.IError[];
+ validate(config: IEmbedConfigurationBase): IError[];
/**
* Handle config changes.
*
@@ -1425,10 +1889,10 @@ declare module "tile" {
}
}
declare module "qna" {
- import * as service from "service";
- import * as models from 'powerbi-models';
- import * as embed from "embed";
import { IHttpPostMessageResponse } from 'http-post-message';
+ import { IError } from 'powerbi-models';
+ import { Embed, IEmbedConfigurationBase } from "embed";
+ import { Service } from "service";
/**
* The Power BI Q&A embed component
*
@@ -1436,7 +1900,7 @@ declare module "qna" {
* @class Qna
* @extends {Embed}
*/
- export class Qna extends embed.Embed {
+ export class Qna extends Embed {
/** @hidden */
static type: string;
/** @hidden */
@@ -1444,7 +1908,7 @@ declare module "qna" {
/**
* @hidden
*/
- constructor(service: service.Service, element: HTMLElement, config: embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
+ constructor(service: Service, element: HTMLElement, config: IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean);
/**
* The ID of the Q&A embed component
*
@@ -1463,7 +1927,7 @@ declare module "qna" {
*
* @returns {void}
*/
- configChanged(isBootstrap: boolean): void;
+ configChanged(_isBootstrap: boolean): void;
/**
* @hidden
* @returns {string}
@@ -1472,7 +1936,7 @@ declare module "qna" {
/**
* Validate load configuration.
*/
- validate(config: embed.IEmbedConfigurationBase): models.IError[];
+ validate(config: IEmbedConfigurationBase): IError[];
}
}
declare module "visual" {
@@ -1522,14 +1986,14 @@ declare module "visual" {
* @param {string} pageName
* @returns {Promise>}
*/
- setPage(pageName: string): Promise>;
+ setPage(_pageName: string): Promise>;
/**
* Render a preloaded report, using phased embedding API
*
* @hidden
* @returns {Promise}
*/
- render(config?: IReportLoadConfiguration | IReportEmbedConfiguration): Promise;
+ render(_config?: IReportLoadConfiguration | IReportEmbedConfiguration): Promise;
/**
* Gets the embedded visual descriptor object that contains the visual name, type, etc.
*
@@ -1610,12 +2074,71 @@ declare module "visual" {
private getFiltersLevelUrl;
}
}
+declare module "quickCreate" {
+ import { IError, IQuickCreateConfiguration } from 'powerbi-models';
+ import { Service } from "service";
+ import { Embed, IEmbedConfigurationBase } from "embed";
+ /**
+ * A Power BI Quick Create component
+ *
+ * @export
+ * @class QuickCreate
+ * @extends {Embed}
+ */
+ export class QuickCreate extends Embed {
+ /**
+ * Gets or sets the configuration settings for creating report.
+ *
+ * @type {IQuickCreateConfiguration}
+ * @hidden
+ */
+ createConfig: IQuickCreateConfiguration;
+ constructor(service: Service, element: HTMLElement, config: IQuickCreateConfiguration, phasedRender?: boolean, isBootstrap?: boolean);
+ /**
+ * Override the getId abstract function
+ * QuickCreate does not need any ID
+ *
+ * @returns {string}
+ */
+ getId(): string;
+ /**
+ * Validate create report configuration.
+ */
+ validate(config: IEmbedConfigurationBase): IError[];
+ /**
+ * Handle config changes.
+ *
+ * @hidden
+ * @returns {void}
+ */
+ configChanged(isBootstrap: boolean): void;
+ /**
+ * @hidden
+ * @returns {string}
+ */
+ getDefaultEmbedUrlEndpoint(): string;
+ /**
+ * Sends quickCreate configuration data.
+ *
+ * ```javascript
+ * quickCreate({
+ * accessToken: 'eyJ0eXA ... TaE2rTSbmg',
+ * datasetCreateConfig: {}})
+ * ```
+ *
+ * @hidden
+ * @param {IQuickCreateConfiguration} createConfig
+ * @returns {Promise}
+ */
+ create(): Promise;
+ }
+}
declare module "service" {
- import * as embed from "embed";
- import * as wpmp from 'window-post-message-proxy';
- import * as hpm from 'http-post-message';
- import * as router from 'powerbi-router';
- import * as models from 'powerbi-models';
+ import { WindowPostMessageProxy } from 'window-post-message-proxy';
+ import { HttpPostMessage } from 'http-post-message';
+ import { Router, IExtendedRequest, Response as IExtendedResponse } from 'powerbi-router';
+ import { IQuickCreateConfiguration, IReportCreateConfiguration } from 'powerbi-models';
+ import { Embed, IBootstrapEmbedConfiguration, IDashboardEmbedConfiguration, IEmbedConfiguration, IEmbedConfigurationBase, IQnaEmbedConfiguration, IReportEmbedConfiguration, ITileEmbedConfiguration, IVisualEmbedConfiguration } from "embed";
export interface IEvent {
type: string;
id: string;
@@ -1638,22 +2161,22 @@ declare module "service" {
* @hidden
*/
export interface IHpmFactory {
- (wpmp: wpmp.WindowPostMessageProxy, targetWindow?: Window, version?: string, type?: string, origin?: string): hpm.HttpPostMessage;
+ (wpmp: WindowPostMessageProxy, targetWindow?: Window, version?: string, type?: string, origin?: string): HttpPostMessage;
}
/**
* @hidden
*/
export interface IWpmpFactory {
- (name?: string, logMessages?: boolean, eventSourceOverrideWindow?: Window): wpmp.WindowPostMessageProxy;
+ (name?: string, logMessages?: boolean, eventSourceOverrideWindow?: Window): WindowPostMessageProxy;
}
/**
* @hidden
*/
export interface IRouterFactory {
- (wpmp: wpmp.WindowPostMessageProxy): router.Router;
+ (wpmp: WindowPostMessageProxy): Router;
}
export interface IPowerBiElement extends HTMLElement {
- powerBiEmbed: embed.Embed;
+ powerBiEmbed: Embed;
}
export interface IDebugOptions {
logMessages?: boolean;
@@ -1664,11 +2187,16 @@ declare module "service" {
onError?: (error: any) => any;
version?: string;
type?: string;
+ sdkWrapperVersion?: string;
}
export interface IService {
- hpm: hpm.HttpPostMessage;
+ hpm: HttpPostMessage;
}
- export type IComponentEmbedConfiguration = embed.IReportEmbedConfiguration | embed.IDashboardEmbedConfiguration | embed.ITileEmbedConfiguration | embed.IVisualEmbedConfiguration | embed.IQnaEmbedConfiguration;
+ export type IComponentEmbedConfiguration = IReportEmbedConfiguration | IDashboardEmbedConfiguration | ITileEmbedConfiguration | IVisualEmbedConfiguration | IQnaEmbedConfiguration;
+ /**
+ * @hidden
+ */
+ export type EmbedComponentFactory = (service: Service, element: HTMLElement, config: IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean) => Embed;
/**
* The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application
*
@@ -1692,20 +2220,26 @@ declare module "service" {
* @hidden
*/
accessToken: string;
- /**The Configuration object for the service*/
+ /** The Configuration object for the service*/
private config;
- /** A list of Dashboard, Report and Tile components that have been embedded using this service instance. */
+ /** A list of Power BI components that have been embedded using this service instance. */
private embeds;
/** TODO: Look for way to make hpm private without sacrificing ease of maintenance. This should be private but in embed needs to call methods.
+ *
* @hidden
- */
- hpm: hpm.HttpPostMessage;
+ */
+ hpm: HttpPostMessage;
/** TODO: Look for way to make wpmp private. This is only public to allow stopping the wpmp in tests
+ *
* @hidden
- */
- wpmp: wpmp.WindowPostMessageProxy;
- private router;
+ */
+ wpmp: WindowPostMessageProxy;
+ router: Router;
private uniqueSessionId;
+ /**
+ * @hidden
+ */
+ private registeredComponents;
/**
* Creates an instance of a Power BI Service.
*
@@ -1718,30 +2252,39 @@ declare module "service" {
constructor(hpmFactory: IHpmFactory, wpmpFactory: IWpmpFactory, routerFactory: IRouterFactory, config?: IServiceConfiguration);
/**
* Creates new report
+ *
+ * @param {HTMLElement} element
+ * @param {IEmbedConfiguration} [config={}]
+ * @returns {Embed}
+ */
+ createReport(element: HTMLElement, config: IEmbedConfiguration | IReportCreateConfiguration): Embed;
+ /**
+ * Creates new dataset
+ *
* @param {HTMLElement} element
- * @param {embed.IEmbedConfiguration} [config={}]
- * @returns {embed.Embed}
+ * @param {IEmbedConfiguration} [config={}]
+ * @returns {Embed}
*/
- createReport(element: HTMLElement, config: embed.IEmbedConfiguration | models.IReportCreateConfiguration): embed.Embed;
+ quickCreate(element: HTMLElement, config: IQuickCreateConfiguration): Embed;
/**
* TODO: Add a description here
*
* @param {HTMLElement} [container]
- * @param {embed.IEmbedConfiguration} [config=undefined]
- * @returns {embed.Embed[]}
+ * @param {IEmbedConfiguration} [config=undefined]
+ * @returns {Embed[]}
* @hidden
*/
- init(container?: HTMLElement, config?: embed.IEmbedConfiguration): embed.Embed[];
+ init(container?: HTMLElement, config?: IEmbedConfiguration): Embed[];
/**
* Given a configuration based on an HTML element,
* if the component has already been created and attached to the element, reuses the component instance and existing iframe,
* otherwise creates a new component instance.
*
* @param {HTMLElement} element
- * @param {embed.IEmbedConfigurationBase} [config={}]
- * @returns {embed.Embed}
+ * @param {IEmbedConfigurationBase} [config={}]
+ * @returns {Embed}
*/
- embed(element: HTMLElement, config?: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase): embed.Embed;
+ embed(element: HTMLElement, config?: IComponentEmbedConfiguration | IEmbedConfigurationBase): Embed;
/**
* Given a configuration based on an HTML element,
* if the component has already been created and attached to the element, reuses the component instance and existing iframe,
@@ -1749,40 +2292,61 @@ declare module "service" {
* This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it.
*
* @param {HTMLElement} element
- * @param {embed.IEmbedConfigurationBase} [config={}]
- * @returns {embed.Embed}
+ * @param {IEmbedConfigurationBase} [config={}]
+ * @returns {Embed}
*/
- load(element: HTMLElement, config?: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase): embed.Embed;
+ load(element: HTMLElement, config?: IComponentEmbedConfiguration | IEmbedConfigurationBase): Embed;
/**
* Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding.
*
* @param {HTMLElement} element
- * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token.
+ * @param {IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token.
*/
- bootstrap(element: HTMLElement, config: IComponentEmbedConfiguration | embed.IBootstrapEmbedConfiguration): embed.Embed;
+ bootstrap(element: HTMLElement, config: IComponentEmbedConfiguration | IBootstrapEmbedConfiguration): Embed;
/** @hidden */
- embedInternal(element: HTMLElement, config?: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): embed.Embed;
+ embedInternal(element: HTMLElement, config?: IComponentEmbedConfiguration | IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): Embed;
/** @hidden */
getNumberOfComponents(): number;
/** @hidden */
getSdkSessionId(): string;
+ /**
+ * Returns the Power BI Client SDK version
+ *
+ * @hidden
+ */
+ getSDKVersion(): string;
/**
* Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup.
*
* @private
* @param {IPowerBiElement} element
- * @param {embed.IEmbedConfigurationBase} config
- * @returns {embed.Embed}
+ * @param {IEmbedConfigurationBase} config
+ * @param {boolean} phasedRender
+ * @param {boolean} isBootstrap
+ * @returns {Embed}
* @hidden
*/
private embedNew;
+ /**
+ * Given component type, creates embed component instance
+ *
+ * @private
+ * @param {string} componentType
+ * @param {HTMLElement} element
+ * @param {IEmbedConfigurationBase} config
+ * @param {boolean} phasedRender
+ * @param {boolean} isBootstrap
+ * @returns {Embed}
+ * @hidden
+ */
+ private createEmbedComponent;
/**
* Given an element that already contains an embed component, load with a new configuration.
*
* @private
* @param {IPowerBiElement} element
- * @param {embed.IEmbedConfigurationBase} config
- * @returns {embed.Embed}
+ * @param {IEmbedConfigurationBase} config
+ * @returns {Embed}
* @hidden
*/
private embedExisting;
@@ -1802,7 +2366,7 @@ declare module "service" {
* @param {HTMLElement} element
* @returns {(Report | Tile)}
*/
- get(element: HTMLElement): embed.Embed;
+ get(element: HTMLElement): Embed;
/**
* Finds an embed instance by the name or unique ID that is provided.
*
@@ -1810,7 +2374,7 @@ declare module "service" {
* @returns {(Report | Tile)}
* @hidden
*/
- find(uniqueId: string): embed.Embed;
+ find(uniqueId: string): Embed;
/**
* Removes embed components whose container element is same as the given element
*
@@ -1819,7 +2383,7 @@ declare module "service" {
* @returns {void}
* @hidden
*/
- addOrOverwriteEmbed(component: embed.Embed, element: HTMLElement): void;
+ addOrOverwriteEmbed(component: Embed, element: HTMLElement): void;
/**
* Given an HTML element that has a component embedded within it, removes the component from the list of embedded components, removes the association between the element and the component, and removes the iframe.
*
@@ -1834,6 +2398,7 @@ declare module "service" {
* @hidden
*/
handleTileEvents(event: IEvent): void;
+ invokeSDKHook(hook: Function, req: IExtendedRequest, res: IExtendedResponse): Promise;
/**
* Given an event object, finds the embed component with the matching type and ID, and invokes its handleEvent method with the event object.
*
@@ -1847,17 +2412,34 @@ declare module "service" {
* Use this API to preload Power BI Embedded in the background.
*
* @public
- * @param {embed.IEmbedConfigurationBase} [config={}]
+ * @param {IEmbedConfigurationBase} [config={}]
* @param {HTMLElement} [element=undefined]
*/
- preload(config: IComponentEmbedConfiguration | embed.IEmbedConfigurationBase, element?: HTMLElement): HTMLIFrameElement;
+ preload(config: IComponentEmbedConfiguration | IEmbedConfigurationBase, element?: HTMLElement): HTMLIFrameElement;
+ /**
+ * Use this API to set SDK info
+ *
+ * @hidden
+ * @param {string} type
+ * @returns {void}
+ */
+ setSdkInfo(type: string, version: string): void;
+ /**
+ * API for registering external components
+ *
+ * @hidden
+ * @param {string} componentType
+ * @param {EmbedComponentFactory} embedComponentFactory
+ * @param {string[]} routerEventUrls
+ */
+ register(componentType: string, embedComponentFactory: EmbedComponentFactory, routerEventUrls: string[]): void;
}
}
declare module "bookmarksManager" {
- import * as service from "service";
- import * as embed from "embed";
- import * as models from 'powerbi-models';
+ import { BookmarksPlayMode, ICaptureBookmarkOptions, IReportBookmark } from 'powerbi-models';
import { IHttpPostMessageResponse } from 'http-post-message';
+ import { Service } from "service";
+ import { IEmbedConfigurationBase } from "embed";
/**
* APIs for managing the report bookmarks.
*
@@ -1865,10 +2447,10 @@ declare module "bookmarksManager" {
* @interface IBookmarksManager
*/
export interface IBookmarksManager {
- getBookmarks(): Promise;
+ getBookmarks(): Promise;
apply(bookmarkName: string): Promise>;
- play(playMode: models.BookmarksPlayMode): Promise>;
- capture(options?: models.ICaptureBookmarkOptions): Promise;
+ play(playMode: BookmarksPlayMode): Promise>;
+ capture(options?: ICaptureBookmarkOptions): Promise;
applyState(state: string): Promise>;
}
/**
@@ -1885,7 +2467,7 @@ declare module "bookmarksManager" {
/**
* @hidden
*/
- constructor(service: service.Service, config: embed.IEmbedConfigurationBase, iframe?: HTMLIFrameElement);
+ constructor(service: Service, config: IEmbedConfigurationBase, iframe?: HTMLIFrameElement);
/**
* Gets bookmarks that are defined in the report.
*
@@ -1897,9 +2479,9 @@ declare module "bookmarksManager" {
* });
* ```
*
- * @returns {Promise}
+ * @returns {Promise}
*/
- getBookmarks(): Promise;
+ getBookmarks(): Promise;
/**
* Apply bookmark by name.
*
@@ -1916,13 +2498,13 @@ declare module "bookmarksManager" {
*
* ```javascript
* // Enter presentation mode.
- * bookmarksManager.play(models.BookmarksPlayMode.Presentation)
+ * bookmarksManager.play(BookmarksPlayMode.Presentation)
* ```
*
- * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off`
+ * @param {BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off`
* @returns {Promise>}
*/
- play(playMode: models.BookmarksPlayMode): Promise>;
+ play(playMode: BookmarksPlayMode): Promise>;
/**
* Capture bookmark from current state.
*
@@ -1930,10 +2512,10 @@ declare module "bookmarksManager" {
* bookmarksManager.capture(options)
* ```
*
- * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing
- * @returns {Promise}
+ * @param {ICaptureBookmarkOptions} [options] Options for bookmark capturing
+ * @returns {Promise}
*/
- capture(options?: models.ICaptureBookmarkOptions): Promise;
+ capture(options?: ICaptureBookmarkOptions): Promise;
/**
* Apply bookmark state.
*
@@ -1948,35 +2530,455 @@ declare module "bookmarksManager" {
}
}
declare module "factories" {
- /**
- * TODO: Need to find better place for these factory functions or refactor how we handle dependency injection
- */
import { IHpmFactory, IWpmpFactory, IRouterFactory } from "service";
export { IHpmFactory, IWpmpFactory, IRouterFactory };
export const hpmFactory: IHpmFactory;
export const wpmpFactory: IWpmpFactory;
export const routerFactory: IRouterFactory;
}
+declare module "FilterBuilders/filterBuilder" {
+ import { IFilterTarget } from "powerbi-models";
+ /**
+ * Generic filter builder for BasicFilter, AdvancedFilter, RelativeDate, RelativeTime and TopN
+ *
+ * @class
+ */
+ export class FilterBuilder {
+ target: IFilterTarget;
+ /**
+ * Sets target property for filter with target object
+ *
+ * ```javascript
+ * const target = {
+ * table: 'table1',
+ * column: 'column1'
+ * };
+ *
+ * const filterBuilder = new FilterBuilder().withTargetObject(target);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withTargetObject(target: IFilterTarget): this;
+ /**
+ * Sets target property for filter with column target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withColumnTarget(tableName, columnName);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withColumnTarget(tableName: string, columnName: string): this;
+ /**
+ * Sets target property for filter with measure target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withMeasureTarget(tableName, measure);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withMeasureTarget(tableName: string, measure: string): this;
+ /**
+ * Sets target property for filter with hierarchy level target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withHierarchyLevelTarget(tableName, hierarchy, hierarchyLevel);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withHierarchyLevelTarget(tableName: string, hierarchy: string, hierarchyLevel: string): this;
+ /**
+ * Sets target property for filter with column aggregation target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withColumnAggregation(tableName, columnName, aggregationFunction);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withColumnAggregation(tableName: string, columnName: string, aggregationFunction: string): this;
+ /**
+ * Sets target property for filter with hierarchy level aggregation target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withHierarchyLevelAggregationTarget(tableName, hierarchy, hierarchyLevel, aggregationFunction);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withHierarchyLevelAggregationTarget(tableName: string, hierarchy: string, hierarchyLevel: string, aggregationFunction: string): this;
+ }
+}
+declare module "FilterBuilders/basicFilterBuilder" {
+ import { BasicFilter } from "powerbi-models";
+ import { FilterBuilder } from "FilterBuilders/filterBuilder";
+ /**
+ * Power BI Basic filter builder component
+ *
+ * @export
+ * @class BasicFilterBuilder
+ * @extends {FilterBuilder}
+ */
+ export class BasicFilterBuilder extends FilterBuilder {
+ private values;
+ private operator;
+ private isRequireSingleSelection;
+ /**
+ * Sets In as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().in([values]);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ in(values: Array<(string | number | boolean)>): BasicFilterBuilder;
+ /**
+ * Sets NotIn as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().notIn([values]);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ notIn(values: Array<(string | number | boolean)>): BasicFilterBuilder;
+ /**
+ * Sets All as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().all();
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ all(): BasicFilterBuilder;
+ /**
+ * Sets required single selection property for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().requireSingleSelection(isRequireSingleSelection);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ requireSingleSelection(isRequireSingleSelection?: boolean): BasicFilterBuilder;
+ /**
+ * Creates Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().build();
+ * ```
+ *
+ * @returns {BasicFilter}
+ */
+ build(): BasicFilter;
+ }
+}
+declare module "FilterBuilders/advancedFilterBuilder" {
+ import { AdvancedFilter, AdvancedFilterConditionOperators } from "powerbi-models";
+ import { FilterBuilder } from "FilterBuilders/filterBuilder";
+ /**
+ * Power BI Advanced filter builder component
+ *
+ * @export
+ * @class AdvancedFilterBuilder
+ * @extends {FilterBuilder}
+ */
+ export class AdvancedFilterBuilder extends FilterBuilder {
+ private logicalOperator;
+ private conditions;
+ /**
+ * Sets And as logical operator for Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().and();
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ and(): AdvancedFilterBuilder;
+ /**
+ * Sets Or as logical operator for Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().or();
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ or(): AdvancedFilterBuilder;
+ /**
+ * Adds a condition in Advanced filter
+ *
+ * ```javascript
+ *
+ * // Add two conditions
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().addCondition("Contains", "Wash").addCondition("Contains", "Park");
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ addCondition(operator: AdvancedFilterConditionOperators, value?: (string | number | boolean | Date)): AdvancedFilterBuilder;
+ /**
+ * Creates Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().build();
+ * ```
+ *
+ * @returns {AdvancedFilter}
+ */
+ build(): AdvancedFilter;
+ }
+}
+declare module "FilterBuilders/topNFilterBuilder" {
+ import { ITarget, TopNFilter } from "powerbi-models";
+ import { FilterBuilder } from "FilterBuilders/filterBuilder";
+ /**
+ * Power BI Top N filter builder component
+ *
+ * @export
+ * @class TopNFilterBuilder
+ * @extends {FilterBuilder}
+ */
+ export class TopNFilterBuilder extends FilterBuilder {
+ private itemCount;
+ private operator;
+ private orderByTargetValue;
+ /**
+ * Sets Top as operator for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().top(itemCount);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ top(itemCount: number): TopNFilterBuilder;
+ /**
+ * Sets Bottom as operator for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().bottom(itemCount);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ bottom(itemCount: number): TopNFilterBuilder;
+ /**
+ * Sets order by for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().orderByTarget(target);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ orderByTarget(target: ITarget): TopNFilterBuilder;
+ /**
+ * Creates Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().build();
+ * ```
+ *
+ * @returns {TopNFilter}
+ */
+ build(): TopNFilter;
+ }
+}
+declare module "FilterBuilders/relativeDateFilterBuilder" {
+ import { RelativeDateFilter, RelativeDateFilterTimeUnit } from "powerbi-models";
+ import { FilterBuilder } from "FilterBuilders/filterBuilder";
+ /**
+ * Power BI Relative Date filter builder component
+ *
+ * @export
+ * @class RelativeDateFilterBuilder
+ * @extends {FilterBuilder}
+ */
+ export class RelativeDateFilterBuilder extends FilterBuilder {
+ private operator;
+ private timeUnitsCount;
+ private timeUnitType;
+ private isTodayIncluded;
+ /**
+ * Sets inLast as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inLast(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ inLast(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeDateFilterBuilder;
+ /**
+ * Sets inThis as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inThis(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ inThis(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeDateFilterBuilder;
+ /**
+ * Sets inNext as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inNext(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ inNext(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeDateFilterBuilder;
+ /**
+ * Sets includeToday for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().includeToday(includeToday);
+ * ```
+ *
+ * @param {boolean} includeToday - Denotes if today is included or not
+ * @returns {RelativeDateFilterBuilder}
+ */
+ includeToday(includeToday: boolean): RelativeDateFilterBuilder;
+ /**
+ * Creates Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().build();
+ * ```
+ *
+ * @returns {RelativeDateFilter}
+ */
+ build(): RelativeDateFilter;
+ }
+}
+declare module "FilterBuilders/relativeTimeFilterBuilder" {
+ import { RelativeTimeFilter, RelativeDateFilterTimeUnit } from "powerbi-models";
+ import { FilterBuilder } from "FilterBuilders/filterBuilder";
+ /**
+ * Power BI Relative Time filter builder component
+ *
+ * @export
+ * @class RelativeTimeFilterBuilder
+ * @extends {FilterBuilder}
+ */
+ export class RelativeTimeFilterBuilder extends FilterBuilder {
+ private operator;
+ private timeUnitsCount;
+ private timeUnitType;
+ /**
+ * Sets inLast as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inLast(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ inLast(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeTimeFilterBuilder;
+ /**
+ * Sets inThis as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inThis(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ inThis(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeTimeFilterBuilder;
+ /**
+ * Sets inNext as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inNext(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ inNext(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeTimeFilterBuilder;
+ /**
+ * Creates Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().build();
+ * ```
+ *
+ * @returns {RelativeTimeFilter}
+ */
+ build(): RelativeTimeFilter;
+ }
+}
+declare module "FilterBuilders/index" {
+ export { BasicFilterBuilder } from "FilterBuilders/basicFilterBuilder";
+ export { AdvancedFilterBuilder } from "FilterBuilders/advancedFilterBuilder";
+ export { TopNFilterBuilder } from "FilterBuilders/topNFilterBuilder";
+ export { RelativeDateFilterBuilder } from "FilterBuilders/relativeDateFilterBuilder";
+ export { RelativeTimeFilterBuilder } from "FilterBuilders/relativeTimeFilterBuilder";
+}
declare module "powerbi-client" {
/**
* @hidden
*/
+ import * as models from 'powerbi-models';
import * as service from "service";
import * as factories from "factories";
- import * as models from 'powerbi-models';
import { IFilterable } from "ifilterable";
export { IFilterable, service, factories, models };
export { Report } from "report";
export { Dashboard } from "dashboard";
export { Tile } from "tile";
- export { IEmbedConfiguration, IQnaEmbedConfiguration, IVisualEmbedConfiguration, IReportEmbedConfiguration, IDashboardEmbedConfiguration, ITileEmbedConfiguration, Embed, ILocaleSettings, IEmbedSettings, IQnaSettings, } from "embed";
+ export { IEmbedConfiguration, IQnaEmbedConfiguration, IVisualEmbedConfiguration, IReportEmbedConfiguration, IDashboardEmbedConfiguration, ITileEmbedConfiguration, IQuickCreateConfiguration, IReportCreateConfiguration, Embed, ILocaleSettings, IEmbedSettings, IQnaSettings, } from "embed";
export { Page } from "page";
export { Qna } from "qna";
export { Visual } from "visual";
export { VisualDescriptor } from "visualDescriptor";
+ export { QuickCreate } from "quickCreate";
+ export { Create } from "create";
+ export { BasicFilterBuilder, AdvancedFilterBuilder, TopNFilterBuilder, RelativeDateFilterBuilder, RelativeTimeFilterBuilder } from "FilterBuilders/index";
global {
interface Window {
powerbi: service.Service;
+ powerBISDKGlobalServiceInstanceName?: string;
}
}
}
diff --git a/dist/powerbi.js b/dist/powerbi.js
index 76f9d55a..29419eb8 100644
--- a/dist/powerbi.js
+++ b/dist/powerbi.js
@@ -1,4 +1,6 @@
-/*! powerbi-client v2.17.1 | (c) 2016 Microsoft Corporation MIT */
+// powerbi-client v2.23.1
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
@@ -8,101 +10,15 @@
exports["powerbi-client"] = factory();
else
root["powerbi-client"] = factory();
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // define getter function for harmony exports
-/******/ __webpack_require__.d = function(exports, name, getter) {
-/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
-/******/ }
-/******/ };
-/******/
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 8|1: behave like require
-/******/ __webpack_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = __webpack_require__(value);
-/******/ if(mode & 8) return value;
-/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
-/******/ var ns = Object.create(null);
-/******/ __webpack_require__.r(ns);
-/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
-/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
-/******/ return ns;
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __webpack_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = "./src/powerbi-client.ts");
-/******/ })
-/************************************************************************/
-/******/ ({
+})(this, () => {
+return /******/ (() => { // webpackBootstrap
+/******/ var __webpack_modules__ = ({
/***/ "./node_modules/http-post-message/dist/httpPostMessage.js":
/*!****************************************************************!*\
!*** ./node_modules/http-post-message/dist/httpPostMessage.js ***!
\****************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(module) {
/*! http-post-message v0.2.3 | (c) 2016 Microsoft Corporation MIT */
(function webpackUniversalModuleDefinition(root, factory) {
@@ -115,7 +31,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ var installedModules = {};
/******/
/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
+/******/ function __nested_webpack_require_626__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
@@ -129,7 +45,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ };
/******/
/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_626__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
@@ -140,16 +56,16 @@ return /******/ (function(modules) { // webpackBootstrap
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
+/******/ __nested_webpack_require_626__.m = modules;
/******/
/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
+/******/ __nested_webpack_require_626__.c = installedModules;
/******/
/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
+/******/ __nested_webpack_require_626__.p = "";
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
+/******/ return __nested_webpack_require_626__(0);
/******/ })
/************************************************************************/
/******/ ([
@@ -285,121 +201,43 @@ return /******/ (function(modules) { // webpackBootstrap
/*!****************************************************!*\
!*** ./node_modules/powerbi-models/dist/models.js ***!
\****************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(module) {
-/*! powerbi-models v1.8.0 | (c) 2016 Microsoft Corporation MIT */
+// powerbi-models v1.15.2
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
(function webpackUniversalModuleDefinition(root, factory) {
if(true)
module.exports = factory();
else {}
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId]) {
-/******/ return installedModules[moduleId].exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ i: moduleId,
-/******/ l: false,
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.l = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // define getter function for harmony exports
-/******/ __webpack_require__.d = function(exports, name, getter) {
-/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
-/******/ }
-/******/ };
-/******/
-/******/ // define __esModule on exports
-/******/ __webpack_require__.r = function(exports) {
-/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
-/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
-/******/ }
-/******/ Object.defineProperty(exports, '__esModule', { value: true });
-/******/ };
-/******/
-/******/ // create a fake namespace object
-/******/ // mode & 1: value is a module id, require it
-/******/ // mode & 2: merge all properties of value into the ns
-/******/ // mode & 4: return value when already ns object
-/******/ // mode & 8|1: behave like require
-/******/ __webpack_require__.t = function(value, mode) {
-/******/ if(mode & 1) value = __webpack_require__(value);
-/******/ if(mode & 8) return value;
-/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
-/******/ var ns = Object.create(null);
-/******/ __webpack_require__.r(ns);
-/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
-/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
-/******/ return ns;
-/******/ };
-/******/
-/******/ // getDefaultExport function for compatibility with non-harmony modules
-/******/ __webpack_require__.n = function(module) {
-/******/ var getter = module && module.__esModule ?
-/******/ function getDefault() { return module['default']; } :
-/******/ function getModuleExports() { return module; };
-/******/ __webpack_require__.d(getter, 'a', getter);
-/******/ return getter;
-/******/ };
-/******/
-/******/ // Object.prototype.hasOwnProperty.call
-/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 0);
-/******/ })
-/************************************************************************/
-/******/ ([
+})(this, () => {
+return /******/ (() => { // webpackBootstrap
+/******/ var __webpack_modules__ = ([
/* 0 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_612__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateUpdateFiltersRequest = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateCreateReport = exports.validateReportLoad = exports.validateMenuGroupExtension = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.isIExtensionArray = exports.isIExtensions = exports.isGroupedMenuExtension = exports.isFlatMenuExtension = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.AdvancedFilter = exports.TupleFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.FiltersOperations = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = void 0;
-var validator_1 = __webpack_require__(1);
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.CommonErrorCodes = exports.BookmarksPlayMode = exports.ExportDataType = exports.QnaMode = exports.PageNavigationPosition = exports.BrowserPrintAdjustmentsMode = exports.AggregateFunction = exports.DataCacheMode = exports.CredentialType = exports.isPercentOfGrandTotal = exports.isColumnAggr = exports.isHierarchyLevelAggr = exports.isHierarchyLevel = exports.isColumn = exports.isMeasure = exports.getFilterType = exports.isBasicFilterWithKeys = exports.isFilterKeyColumnsTarget = exports.HierarchyIdentityFilter = exports.HierarchyFilter = exports.AdvancedFilter = exports.TupleFilter = exports.IdentityFilter = exports.BasicFilterWithKeys = exports.BasicFilter = exports.RelativeTimeFilter = exports.RelativeDateFilter = exports.TopNFilter = exports.IncludeExcludeFilter = exports.NotSupportedFilter = exports.Filter = exports.RelativeDateOperators = exports.RelativeDateFilterTimeUnit = exports.FilterType = exports.FiltersLevel = exports.FiltersOperations = exports.MenuLocation = exports.ContrastMode = exports.TokenType = exports.ViewMode = exports.Permissions = exports.SectionVisibility = exports.ReportAlignment = exports.HyperlinkClickBehavior = exports.LayoutType = exports.VisualContainerDisplayMode = exports.BackgroundType = exports.DisplayOption = exports.PageSizeType = exports.TraceType = void 0;
+exports.validateExportDataRequest = exports.validateQnaInterpretInputData = exports.validateLoadQnaConfiguration = exports.validateSaveAsParameters = exports.validateUpdateFiltersRequest = exports.validateFilter = exports.validatePage = exports.validateTileLoad = exports.validateDashboardLoad = exports.validateQuickCreate = exports.validateCreateReport = exports.validatePaginatedReportLoad = exports.validateReportLoad = exports.validateMenuGroupExtension = exports.validateExtension = exports.validateCustomPageSize = exports.validateVisualizationsPane = exports.validateSyncSlicersPane = exports.validateSelectionPane = exports.validatePageNavigationPane = exports.validateFieldsPane = exports.validateFiltersPane = exports.validateBookmarksPane = exports.validatePanes = exports.validateSettings = exports.validateCaptureBookmarkRequest = exports.validateApplyBookmarkStateRequest = exports.validateApplyBookmarkByNameRequest = exports.validateAddBookmarkRequest = exports.validatePlayBookmarkRequest = exports.validateSlicerState = exports.validateSlicer = exports.validateVisualSelector = exports.isIExtensionArray = exports.isIExtensions = exports.isGroupedMenuExtension = exports.isFlatMenuExtension = exports.isReportFiltersArray = exports.isOnLoadFilters = exports.VisualDataRoleKindPreference = exports.VisualDataRoleKind = exports.CommandDisplayOption = exports.SlicerTargetSelector = exports.VisualTypeSelector = exports.VisualSelector = exports.PageSelector = exports.Selector = exports.SortDirection = exports.LegendPosition = exports.TextAlignment = void 0;
+exports.validatePrintSettings = exports.validateZoomLevel = exports.validateCustomTheme = exports.validateCommandsSettings = exports.validateVisualSettings = exports.validateVisualHeader = void 0;
+var validator_1 = __nested_webpack_require_612__(1);
var TraceType;
(function (TraceType) {
TraceType[TraceType["Information"] = 0] = "Information";
@@ -417,6 +255,7 @@ var PageSizeType;
PageSizeType[PageSizeType["Cortana"] = 2] = "Cortana";
PageSizeType[PageSizeType["Letter"] = 3] = "Letter";
PageSizeType[PageSizeType["Custom"] = 4] = "Custom";
+ PageSizeType[PageSizeType["Mobile"] = 5] = "Mobile";
})(PageSizeType = exports.PageSizeType || (exports.PageSizeType = {}));
var DisplayOption;
(function (DisplayOption) {
@@ -447,6 +286,13 @@ var HyperlinkClickBehavior;
HyperlinkClickBehavior[HyperlinkClickBehavior["NavigateAndRaiseEvent"] = 1] = "NavigateAndRaiseEvent";
HyperlinkClickBehavior[HyperlinkClickBehavior["RaiseEvent"] = 2] = "RaiseEvent";
})(HyperlinkClickBehavior = exports.HyperlinkClickBehavior || (exports.HyperlinkClickBehavior = {}));
+var ReportAlignment;
+(function (ReportAlignment) {
+ ReportAlignment[ReportAlignment["Left"] = 0] = "Left";
+ ReportAlignment[ReportAlignment["Center"] = 1] = "Center";
+ ReportAlignment[ReportAlignment["Right"] = 2] = "Right";
+ ReportAlignment[ReportAlignment["None"] = 3] = "None";
+})(ReportAlignment = exports.ReportAlignment || (exports.ReportAlignment = {}));
var SectionVisibility;
(function (SectionVisibility) {
SectionVisibility[SectionVisibility["AlwaysVisible"] = 0] = "AlwaysVisible";
@@ -506,6 +352,9 @@ var FilterType;
FilterType[FilterType["TopN"] = 5] = "TopN";
FilterType[FilterType["Tuple"] = 6] = "Tuple";
FilterType[FilterType["RelativeTime"] = 7] = "RelativeTime";
+ FilterType[FilterType["Identity"] = 8] = "Identity";
+ FilterType[FilterType["Hierarchy"] = 9] = "Hierarchy";
+ FilterType[FilterType["HierarchyIdentity"] = 10] = "HierarchyIdentity";
})(FilterType = exports.FilterType || (exports.FilterType = {}));
var RelativeDateFilterTimeUnit;
(function (RelativeDateFilterTimeUnit) {
@@ -568,6 +417,7 @@ var IncludeExcludeFilter = /** @class */ (function (_super) {
__extends(IncludeExcludeFilter, _super);
function IncludeExcludeFilter(target, isExclude, values) {
var _this = _super.call(this, target, FilterType.IncludeExclude) || this;
+ _this.target = target;
_this.values = values;
_this.isExclude = isExclude;
_this.schemaUrl = IncludeExcludeFilter.schemaUrl;
@@ -667,6 +517,7 @@ var BasicFilter = /** @class */ (function (_super) {
* new BasicFilter('a', 'b', [1,2]);
*/
if (Array.isArray(values[0])) {
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
_this.values = values[0];
}
else {
@@ -693,7 +544,7 @@ var BasicFilterWithKeys = /** @class */ (function (_super) {
_this.target = target;
var numberOfKeys = target.keys ? target.keys.length : 0;
if (numberOfKeys > 0 && !keyValues) {
- throw new Error("You should pass the values to be filtered for each key. You passed: no values and " + numberOfKeys + " keys");
+ throw new Error("You should pass the values to be filtered for each key. You passed: no values and ".concat(numberOfKeys, " keys"));
}
if (numberOfKeys === 0 && keyValues && keyValues.length > 0) {
throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");
@@ -703,7 +554,7 @@ var BasicFilterWithKeys = /** @class */ (function (_super) {
if (keyValue) {
var lengthOfArray = keyValue.length;
if (lengthOfArray !== numberOfKeys) {
- throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: " + lengthOfArray + " values and " + numberOfKeys + " keys");
+ throw new Error("Each tuple of key values should contain a value for each of the keys. You passed: ".concat(lengthOfArray, " values and ").concat(numberOfKeys, " keys"));
}
}
}
@@ -717,6 +568,24 @@ var BasicFilterWithKeys = /** @class */ (function (_super) {
return BasicFilterWithKeys;
}(BasicFilter));
exports.BasicFilterWithKeys = BasicFilterWithKeys;
+var IdentityFilter = /** @class */ (function (_super) {
+ __extends(IdentityFilter, _super);
+ function IdentityFilter(target, operator) {
+ var _this = _super.call(this, target, FilterType.Identity) || this;
+ _this.operator = operator;
+ _this.schemaUrl = IdentityFilter.schemaUrl;
+ return _this;
+ }
+ IdentityFilter.prototype.toJSON = function () {
+ var filter = _super.prototype.toJSON.call(this);
+ filter.operator = this.operator;
+ filter.target = this.target;
+ return filter;
+ };
+ IdentityFilter.schemaUrl = "http://powerbi.com/product/schema#identity";
+ return IdentityFilter;
+}(Filter));
+exports.IdentityFilter = IdentityFilter;
var TupleFilter = /** @class */ (function (_super) {
__extends(TupleFilter, _super);
function TupleFilter(target, operator, values) {
@@ -749,7 +618,7 @@ var AdvancedFilter = /** @class */ (function (_super) {
// Guard statements
if (typeof logicalOperator !== "string" || logicalOperator.length === 0) {
// TODO: It would be nicer to list out the possible logical operators.
- throw new Error("logicalOperator must be a valid operator, You passed: " + logicalOperator);
+ throw new Error("logicalOperator must be a valid operator, You passed: ".concat(logicalOperator));
}
_this.logicalOperator = logicalOperator;
var extractedConditions;
@@ -759,16 +628,14 @@ var AdvancedFilter = /** @class */ (function (_super) {
* new AdvancedFilter('a', 'b', "And", [{ value: 1, operator: "Equals" }, { value: 2, operator: "IsGreaterThan" }]);
*/
if (Array.isArray(conditions[0])) {
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
extractedConditions = conditions[0];
}
else {
extractedConditions = conditions;
}
- if (extractedConditions.length === 0) {
- throw new Error("conditions must be a non-empty array. You passed: " + conditions);
- }
if (extractedConditions.length > 2) {
- throw new Error("AdvancedFilters may not have more than two conditions. You passed: " + conditions.length);
+ throw new Error("AdvancedFilters may not have more than two conditions. You passed: ".concat(conditions.length));
}
if (extractedConditions.length === 1 && logicalOperator !== "And") {
throw new Error("Logical Operator must be \"And\" when there is only one condition provided");
@@ -786,6 +653,42 @@ var AdvancedFilter = /** @class */ (function (_super) {
return AdvancedFilter;
}(Filter));
exports.AdvancedFilter = AdvancedFilter;
+var HierarchyFilter = /** @class */ (function (_super) {
+ __extends(HierarchyFilter, _super);
+ function HierarchyFilter(target, hierarchyData) {
+ var _this = _super.call(this, target, FilterType.Hierarchy) || this;
+ _this.schemaUrl = HierarchyFilter.schemaUrl;
+ _this.hierarchyData = hierarchyData;
+ return _this;
+ }
+ HierarchyFilter.prototype.toJSON = function () {
+ var filter = _super.prototype.toJSON.call(this);
+ filter.hierarchyData = this.hierarchyData;
+ filter.target = this.target;
+ return filter;
+ };
+ HierarchyFilter.schemaUrl = "http://powerbi.com/product/schema#hierarchy";
+ return HierarchyFilter;
+}(Filter));
+exports.HierarchyFilter = HierarchyFilter;
+var HierarchyIdentityFilter = /** @class */ (function (_super) {
+ __extends(HierarchyIdentityFilter, _super);
+ function HierarchyIdentityFilter(target, hierarchyData) {
+ var _this = _super.call(this, target, FilterType.HierarchyIdentity) || this;
+ _this.schemaUrl = HierarchyIdentityFilter.schemaUrl;
+ _this.hierarchyData = hierarchyData;
+ return _this;
+ }
+ HierarchyIdentityFilter.prototype.toJSON = function () {
+ var filter = _super.prototype.toJSON.call(this);
+ filter.hierarchyData = this.hierarchyData;
+ filter.target = this.target;
+ return filter;
+ };
+ HierarchyIdentityFilter.schemaUrl = "http://powerbi.com/product/schema#hierarchyIdentity";
+ return HierarchyIdentityFilter;
+}(Filter));
+exports.HierarchyIdentityFilter = HierarchyIdentityFilter;
function isFilterKeyColumnsTarget(target) {
return isColumn(target) && !!target.keys;
}
@@ -833,6 +736,37 @@ function isColumnAggr(arg) {
return !!(arg.table && arg.column && arg.aggregationFunction);
}
exports.isColumnAggr = isColumnAggr;
+function isPercentOfGrandTotal(arg) {
+ return !!arg.percentOfGrandTotal;
+}
+exports.isPercentOfGrandTotal = isPercentOfGrandTotal;
+var CredentialType;
+(function (CredentialType) {
+ CredentialType[CredentialType["NoConnection"] = 0] = "NoConnection";
+ CredentialType[CredentialType["OnBehalfOf"] = 1] = "OnBehalfOf";
+ CredentialType[CredentialType["Anonymous"] = 2] = "Anonymous";
+})(CredentialType = exports.CredentialType || (exports.CredentialType = {}));
+var DataCacheMode;
+(function (DataCacheMode) {
+ DataCacheMode[DataCacheMode["Import"] = 0] = "Import";
+ DataCacheMode[DataCacheMode["DirectQuery"] = 1] = "DirectQuery";
+})(DataCacheMode = exports.DataCacheMode || (exports.DataCacheMode = {}));
+var AggregateFunction;
+(function (AggregateFunction) {
+ AggregateFunction[AggregateFunction["Default"] = 1] = "Default";
+ AggregateFunction[AggregateFunction["None"] = 2] = "None";
+ AggregateFunction[AggregateFunction["Sum"] = 3] = "Sum";
+ AggregateFunction[AggregateFunction["Min"] = 4] = "Min";
+ AggregateFunction[AggregateFunction["Max"] = 5] = "Max";
+ AggregateFunction[AggregateFunction["Count"] = 6] = "Count";
+ AggregateFunction[AggregateFunction["Average"] = 7] = "Average";
+ AggregateFunction[AggregateFunction["DistinctCount"] = 8] = "DistinctCount";
+})(AggregateFunction = exports.AggregateFunction || (exports.AggregateFunction = {}));
+var BrowserPrintAdjustmentsMode;
+(function (BrowserPrintAdjustmentsMode) {
+ BrowserPrintAdjustmentsMode[BrowserPrintAdjustmentsMode["Default"] = 0] = "Default";
+ BrowserPrintAdjustmentsMode[BrowserPrintAdjustmentsMode["NoAdjustments"] = 1] = "NoAdjustments";
+})(BrowserPrintAdjustmentsMode = exports.BrowserPrintAdjustmentsMode || (exports.BrowserPrintAdjustmentsMode = {}));
var PageNavigationPosition;
(function (PageNavigationPosition) {
PageNavigationPosition[PageNavigationPosition["Bottom"] = 0] = "Bottom";
@@ -983,6 +917,14 @@ var VisualDataRoleKindPreference;
VisualDataRoleKindPreference[VisualDataRoleKindPreference["Measure"] = 0] = "Measure";
VisualDataRoleKindPreference[VisualDataRoleKindPreference["Grouping"] = 1] = "Grouping";
})(VisualDataRoleKindPreference = exports.VisualDataRoleKindPreference || (exports.VisualDataRoleKindPreference = {}));
+function isOnLoadFilters(filters) {
+ return filters && !isReportFiltersArray(filters);
+}
+exports.isOnLoadFilters = isOnLoadFilters;
+function isReportFiltersArray(filters) {
+ return Array.isArray(filters);
+}
+exports.isReportFiltersArray = isReportFiltersArray;
function isFlatMenuExtension(menuExtension) {
return menuExtension && !isGroupedMenuExtension(menuExtension);
}
@@ -1002,7 +944,7 @@ exports.isIExtensionArray = isIExtensionArray;
function normalizeError(error) {
var message = error.message;
if (!message) {
- message = error.path + " is invalid. Not meeting " + error.keyword + " constraint";
+ message = "".concat(error.path, " is invalid. Not meeting ").concat(error.keyword, " constraint");
}
return {
message: message
@@ -1113,11 +1055,21 @@ function validateReportLoad(input) {
return errors ? errors.map(normalizeError) : undefined;
}
exports.validateReportLoad = validateReportLoad;
+function validatePaginatedReportLoad(input) {
+ var errors = validator_1.Validators.paginatedReportLoadValidator.validate(input);
+ return errors ? errors.map(normalizeError) : undefined;
+}
+exports.validatePaginatedReportLoad = validatePaginatedReportLoad;
function validateCreateReport(input) {
var errors = validator_1.Validators.reportCreateValidator.validate(input);
return errors ? errors.map(normalizeError) : undefined;
}
exports.validateCreateReport = validateCreateReport;
+function validateQuickCreate(input) {
+ var errors = validator_1.Validators.quickCreateValidator.validate(input);
+ return errors ? errors.map(normalizeError) : undefined;
+}
+exports.validateQuickCreate = validateQuickCreate;
function validateDashboardLoad(input) {
var errors = validator_1.Validators.dashboardLoadValidator.validate(input);
return errors ? errors.map(normalizeError) : undefined;
@@ -1183,48 +1135,67 @@ function validateCustomTheme(input) {
return errors ? errors.map(normalizeError) : undefined;
}
exports.validateCustomTheme = validateCustomTheme;
+function validateZoomLevel(input) {
+ var errors = validator_1.Validators.zoomLevelValidator.validate(input);
+ return errors ? errors.map(normalizeError) : undefined;
+}
+exports.validateZoomLevel = validateZoomLevel;
+function validatePrintSettings(input) {
+ var errors = validator_1.Validators.printSettingsValidator.validate(input);
+ return errors ? errors.map(normalizeError) : undefined;
+}
+exports.validatePrintSettings = validatePrintSettings;
/***/ }),
/* 1 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ ((__unused_webpack_module, exports, __nested_webpack_require_47160__) => {
-Object.defineProperty(exports, "__esModule", { value: true });
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Validators = void 0;
-var barsValidator_1 = __webpack_require__(2);
-var bookmarkValidator_1 = __webpack_require__(5);
-var commandsSettingsValidator_1 = __webpack_require__(6);
-var customThemeValidator_1 = __webpack_require__(7);
-var dashboardLoadValidator_1 = __webpack_require__(8);
-var datasetBindingValidator_1 = __webpack_require__(9);
-var exportDataValidator_1 = __webpack_require__(10);
-var extensionsValidator_1 = __webpack_require__(11);
-var filtersValidator_1 = __webpack_require__(12);
-var layoutValidator_1 = __webpack_require__(13);
-var pageValidator_1 = __webpack_require__(14);
-var panesValidator_1 = __webpack_require__(15);
-var qnaValidator_1 = __webpack_require__(16);
-var reportCreateValidator_1 = __webpack_require__(17);
-var reportLoadValidator_1 = __webpack_require__(18);
-var saveAsParametersValidator_1 = __webpack_require__(19);
-var selectorsValidator_1 = __webpack_require__(20);
-var settingsValidator_1 = __webpack_require__(21);
-var slicersValidator_1 = __webpack_require__(22);
-var tileLoadValidator_1 = __webpack_require__(23);
-var visualSettingsValidator_1 = __webpack_require__(24);
-var anyOfValidator_1 = __webpack_require__(25);
-var fieldForbiddenValidator_1 = __webpack_require__(26);
-var fieldRequiredValidator_1 = __webpack_require__(27);
-var mapValidator_1 = __webpack_require__(28);
-var typeValidator_1 = __webpack_require__(4);
+var barsValidator_1 = __nested_webpack_require_47160__(2);
+var bookmarkValidator_1 = __nested_webpack_require_47160__(5);
+var commandsSettingsValidator_1 = __nested_webpack_require_47160__(6);
+var customThemeValidator_1 = __nested_webpack_require_47160__(7);
+var dashboardLoadValidator_1 = __nested_webpack_require_47160__(8);
+var datasetBindingValidator_1 = __nested_webpack_require_47160__(9);
+var exportDataValidator_1 = __nested_webpack_require_47160__(10);
+var extensionsValidator_1 = __nested_webpack_require_47160__(11);
+var filtersValidator_1 = __nested_webpack_require_47160__(12);
+var layoutValidator_1 = __nested_webpack_require_47160__(13);
+var pageValidator_1 = __nested_webpack_require_47160__(14);
+var panesValidator_1 = __nested_webpack_require_47160__(15);
+var qnaValidator_1 = __nested_webpack_require_47160__(16);
+var reportCreateValidator_1 = __nested_webpack_require_47160__(17);
+var reportLoadValidator_1 = __nested_webpack_require_47160__(18);
+var paginatedReportLoadValidator_1 = __nested_webpack_require_47160__(19);
+var saveAsParametersValidator_1 = __nested_webpack_require_47160__(20);
+var selectorsValidator_1 = __nested_webpack_require_47160__(21);
+var settingsValidator_1 = __nested_webpack_require_47160__(22);
+var slicersValidator_1 = __nested_webpack_require_47160__(23);
+var tileLoadValidator_1 = __nested_webpack_require_47160__(24);
+var visualSettingsValidator_1 = __nested_webpack_require_47160__(25);
+var anyOfValidator_1 = __nested_webpack_require_47160__(26);
+var fieldForbiddenValidator_1 = __nested_webpack_require_47160__(27);
+var fieldRequiredValidator_1 = __nested_webpack_require_47160__(28);
+var mapValidator_1 = __nested_webpack_require_47160__(29);
+var typeValidator_1 = __nested_webpack_require_47160__(4);
+var parameterPanelValidator_1 = __nested_webpack_require_47160__(30);
+var datasetCreateConfigValidator_1 = __nested_webpack_require_47160__(31);
+var quickCreateValidator_1 = __nested_webpack_require_47160__(32);
+var printSettingsValidator_1 = __nested_webpack_require_47160__(33);
+var paginatedReportDatasetBindingValidator_1 = __nested_webpack_require_47160__(34);
exports.Validators = {
addBookmarkRequestValidator: new bookmarkValidator_1.AddBookmarkRequestValidator(),
advancedFilterTypeValidator: new typeValidator_1.EnumValidator([0]),
advancedFilterValidator: new filtersValidator_1.AdvancedFilterValidator(),
anyArrayValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()])]),
- anyFilterValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.IncludeExcludeFilterValidator(), new filtersValidator_1.NotSupportedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.TopNFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator()]),
+ anyFilterValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.BasicFilterValidator(), new filtersValidator_1.AdvancedFilterValidator(), new filtersValidator_1.IncludeExcludeFilterValidator(), new filtersValidator_1.NotSupportedFilterValidator(), new filtersValidator_1.RelativeDateFilterValidator(), new filtersValidator_1.TopNFilterValidator(), new filtersValidator_1.RelativeTimeFilterValidator(), new filtersValidator_1.HierarchyFilterValidator()]),
anyValueValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator()]),
actionBarValidator: new barsValidator_1.ActionBarValidator(),
+ statusBarValidator: new barsValidator_1.StatusBarValidator(),
applyBookmarkByNameRequestValidator: new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(),
applyBookmarkStateRequestValidator: new bookmarkValidator_1.ApplyBookmarkStateRequestValidator(),
applyBookmarkValidator: new anyOfValidator_1.AnyOfValidator([new bookmarkValidator_1.ApplyBookmarkByNameRequestValidator(), new bookmarkValidator_1.ApplyBookmarkStateRequestValidator()]),
@@ -1236,6 +1207,7 @@ exports.Validators = {
bookmarksPaneValidator: new panesValidator_1.BookmarksPaneValidator(),
captureBookmarkOptionsValidator: new bookmarkValidator_1.CaptureBookmarkOptionsValidator(),
captureBookmarkRequestValidator: new bookmarkValidator_1.CaptureBookmarkRequestValidator(),
+ columnSchemaArrayValidator: new typeValidator_1.ArrayValidator([new datasetCreateConfigValidator_1.ColumnSchemaValidator()]),
commandDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]),
commandExtensionSelectorValidator: new anyOfValidator_1.AnyOfValidator([new selectorsValidator_1.VisualSelectorValidator(), new selectorsValidator_1.VisualTypeSelectorValidator()]),
commandExtensionArrayValidator: new typeValidator_1.ArrayValidator([new extensionsValidator_1.CommandExtensionValidator()]),
@@ -1244,12 +1216,18 @@ exports.Validators = {
commandsSettingsValidator: new commandsSettingsValidator_1.CommandsSettingsValidator(),
conditionItemValidator: new filtersValidator_1.ConditionItemValidator(),
contrastModeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4]),
+ credentialDetailsValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new typeValidator_1.StringValidator()]),
+ credentialsValidator: new datasetCreateConfigValidator_1.CredentialsValidator(),
+ credentialTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2]),
customLayoutDisplayOptionValidator: new typeValidator_1.EnumValidator([0, 1, 2]),
customLayoutValidator: new layoutValidator_1.CustomLayoutValidator(),
customPageSizeValidator: new pageValidator_1.CustomPageSizeValidator(),
customThemeValidator: new customThemeValidator_1.CustomThemeValidator(),
dashboardLoadValidator: new dashboardLoadValidator_1.DashboardLoadValidator(),
+ dataCacheModeValidator: new typeValidator_1.EnumValidator([0, 1]),
datasetBindingValidator: new datasetBindingValidator_1.DatasetBindingValidator(),
+ datasetCreateConfigValidator: new datasetCreateConfigValidator_1.DatasetCreateConfigValidator(),
+ datasourceConnectionConfigValidator: new datasetCreateConfigValidator_1.DatasourceConnectionConfigValidator(),
displayStateModeValidator: new typeValidator_1.EnumValidator([0, 1]),
displayStateValidator: new layoutValidator_1.DisplayStateValidator(),
exportDataRequestValidator: new exportDataValidator_1.ExportDataRequestValidator(),
@@ -1265,9 +1243,9 @@ exports.Validators = {
filterConditionsValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.ConditionItemValidator()]),
filterHierarchyTargetValidator: new filtersValidator_1.FilterHierarchyTargetValidator(),
filterMeasureTargetValidator: new filtersValidator_1.FilterMeasureTargetValidator(),
- filterTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator()]),
+ filterTargetValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new filtersValidator_1.FilterKeyColumnsTargetValidator(), new filtersValidator_1.FilterKeyHierarchyTargetValidator(), new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.FilterColumnTargetValidator(), new filtersValidator_1.FilterHierarchyTargetValidator(), new filtersValidator_1.FilterMeasureTargetValidator(), new filtersValidator_1.FilterKeyColumnsTargetValidator(), new filtersValidator_1.FilterKeyHierarchyTargetValidator()])])])])]),
filterValidator: new filtersValidator_1.FilterValidator(),
- filterTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6, 7]),
+ filterTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6, 7, 9]),
filtersArrayValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.FilterValidator()]),
filtersOperationsUpdateValidator: new typeValidator_1.EnumValidator([1, 2, 3]),
filtersOperationsRemoveAllValidator: new typeValidator_1.EnumValidator([0]),
@@ -1275,6 +1253,9 @@ exports.Validators = {
hyperlinkClickBehaviorValidator: new typeValidator_1.EnumValidator([0, 1, 2]),
includeExcludeFilterValidator: new filtersValidator_1.IncludeExcludeFilterValidator(),
includeExludeFilterTypeValidator: new typeValidator_1.EnumValidator([3]),
+ includeExcludeFilterValuesValidator: new typeValidator_1.ArrayValidator([new anyOfValidator_1.AnyOfValidator([new typeValidator_1.StringValidator(), new typeValidator_1.NumberValidator(), new typeValidator_1.BooleanValidator(), new typeValidator_1.ArrayValidator([new typeValidator_1.ArrayValidator([new filtersValidator_1.IncludeExcludePointValueValidator()])])])]),
+ hierarchyFilterTypeValidator: new typeValidator_1.EnumValidator([9]),
+ hierarchyFilterValuesValidator: new typeValidator_1.ArrayValidator([new filtersValidator_1.HierarchyFilterNodeValidator()]),
layoutTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3]),
loadQnaValidator: new qnaValidator_1.LoadQnaValidator(),
menuExtensionValidator: new anyOfValidator_1.AnyOfValidator([new extensionsValidator_1.FlatMenuExtensionValidator(), new extensionsValidator_1.GroupedMenuExtensionValidator()]),
@@ -1285,6 +1266,7 @@ exports.Validators = {
notSupportedFilterValidator: new filtersValidator_1.NotSupportedFilterValidator(),
numberArrayValidator: new typeValidator_1.NumberArrayValidator(),
numberValidator: new typeValidator_1.NumberValidator(),
+ onLoadFiltersBaseValidator: new anyOfValidator_1.AnyOfValidator([new filtersValidator_1.OnLoadFiltersBaseValidator(), new filtersValidator_1.OnLoadFiltersBaseRemoveOperationValidator()]),
pageLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.VisualLayoutValidator()]),
pageNavigationPaneValidator: new panesValidator_1.PageNavigationPaneValidator(),
pageNavigationPositionValidator: new typeValidator_1.EnumValidator([0, 1]),
@@ -1293,21 +1275,34 @@ exports.Validators = {
pageValidator: new pageValidator_1.PageValidator(),
pageViewFieldValidator: new pageValidator_1.PageViewFieldValidator(),
pagesLayoutValidator: new mapValidator_1.MapValidator([new typeValidator_1.StringValidator()], [new layoutValidator_1.PageLayoutValidator()]),
- reportBarsValidator: new barsValidator_1.ReportBarsValidator(),
- reportPanesValidator: new panesValidator_1.ReportPanesValidator(),
+ paginatedReportCommandsValidator: new commandsSettingsValidator_1.PaginatedReportCommandsValidator(),
+ paginatedReportDatasetBindingArrayValidator: new typeValidator_1.ArrayValidator([new paginatedReportDatasetBindingValidator_1.PaginatedReportDatasetBindingValidator()]),
+ paginatedReportLoadValidator: new paginatedReportLoadValidator_1.PaginatedReportLoadValidator(),
+ paginatedReportsettingsValidator: new settingsValidator_1.PaginatedReportSettingsValidator(),
+ parameterValuesArrayValidator: new typeValidator_1.ArrayValidator([new paginatedReportLoadValidator_1.ReportParameterFieldsValidator()]),
+ parametersPanelValidator: new parameterPanelValidator_1.ParametersPanelValidator(),
permissionsValidator: new typeValidator_1.EnumValidator([0, 1, 2, 4, 7]),
playBookmarkRequestValidator: new bookmarkValidator_1.PlayBookmarkRequestValidator(),
+ printSettingsValidator: new printSettingsValidator_1.PrintSettingsValidator(),
qnaInterpretInputDataValidator: new qnaValidator_1.QnaInterpretInputDataValidator(),
+ qnaPanesValidator: new panesValidator_1.QnaPanesValidator(),
qnaSettingValidator: new qnaValidator_1.QnaSettingsValidator(),
+ quickCreateValidator: new quickCreateValidator_1.QuickCreateValidator(),
+ rawDataValidator: new typeValidator_1.ArrayValidator([new typeValidator_1.ArrayValidator([new typeValidator_1.StringValidator()])]),
relativeDateFilterOperatorValidator: new typeValidator_1.EnumValidator([0, 1, 2]),
relativeDateFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6]),
relativeDateFilterTypeValidator: new typeValidator_1.EnumValidator([4]),
relativeDateFilterValidator: new filtersValidator_1.RelativeDateFilterValidator(),
+ relativeDateTimeFilterTypeValidator: new typeValidator_1.EnumValidator([4, 7]),
+ relativeDateTimeFilterUnitTypeValidator: new typeValidator_1.EnumValidator([0, 1, 2, 3, 4, 5, 6, 7, 8]),
relativeTimeFilterTimeUnitTypeValidator: new typeValidator_1.EnumValidator([7, 8]),
relativeTimeFilterTypeValidator: new typeValidator_1.EnumValidator([7]),
relativeTimeFilterValidator: new filtersValidator_1.RelativeTimeFilterValidator(),
+ reportBarsValidator: new barsValidator_1.ReportBarsValidator(),
reportCreateValidator: new reportCreateValidator_1.ReportCreateValidator(),
+ reportLoadFiltersValidator: new anyOfValidator_1.AnyOfValidator([new typeValidator_1.ArrayValidator([new filtersValidator_1.FilterValidator()]), new filtersValidator_1.OnLoadFiltersValidator()]),
reportLoadValidator: new reportLoadValidator_1.ReportLoadValidator(),
+ reportPanesValidator: new panesValidator_1.ReportPanesValidator(),
saveAsParametersValidator: new saveAsParametersValidator_1.SaveAsParametersValidator(),
selectionPaneValidator: new panesValidator_1.SelectionPaneValidator(),
settingsValidator: new settingsValidator_1.SettingsValidator(),
@@ -1319,6 +1314,8 @@ exports.Validators = {
stringArrayValidator: new typeValidator_1.StringArrayValidator(),
stringValidator: new typeValidator_1.StringValidator(),
syncSlicersPaneValidator: new panesValidator_1.SyncSlicersPaneValidator(),
+ tableDataArrayValidator: new typeValidator_1.ArrayValidator([new datasetCreateConfigValidator_1.TableDataValidator()]),
+ tableSchemaListValidator: new typeValidator_1.ArrayValidator([new datasetCreateConfigValidator_1.TableSchemaValidator()]),
tileLoadValidator: new tileLoadValidator_1.TileLoadValidator(),
tokenTypeValidator: new typeValidator_1.EnumValidator([0, 1]),
topNFilterTypeValidator: new typeValidator_1.EnumValidator([5]),
@@ -1335,31 +1332,36 @@ exports.Validators = {
visualSelectorValidator: new selectorsValidator_1.VisualSelectorValidator(),
visualSettingsValidator: new visualSettingsValidator_1.VisualSettingsValidator(),
visualTypeSelectorValidator: new selectorsValidator_1.VisualTypeSelectorValidator(),
+ zoomLevelValidator: new typeValidator_1.RangeValidator(0.25, 4),
};
/***/ }),
/* 2 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_65027__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.ActionBarValidator = exports.ReportBarsValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.StatusBarValidator = exports.ActionBarValidator = exports.ReportBarsValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_65027__(3);
+var typeValidator_1 = __nested_webpack_require_65027__(4);
+var validator_1 = __nested_webpack_require_65027__(1);
var ReportBarsValidator = /** @class */ (function (_super) {
__extends(ReportBarsValidator, _super);
function ReportBarsValidator() {
@@ -1377,6 +1379,10 @@ var ReportBarsValidator = /** @class */ (function (_super) {
{
field: "actionBar",
validators: [validator_1.Validators.actionBarValidator]
+ },
+ {
+ field: "statusBar",
+ validators: [validator_1.Validators.statusBarValidator]
}
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
@@ -1410,13 +1416,40 @@ var ActionBarValidator = /** @class */ (function (_super) {
return ActionBarValidator;
}(typeValidator_1.ObjectValidator));
exports.ActionBarValidator = ActionBarValidator;
+var StatusBarValidator = /** @class */ (function (_super) {
+ __extends(StatusBarValidator, _super);
+ function StatusBarValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ StatusBarValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "visible",
+ validators: [validator_1.Validators.booleanValidator]
+ },
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return StatusBarValidator;
+}(typeValidator_1.ObjectValidator));
+exports.StatusBarValidator = StatusBarValidator;
/***/ }),
/* 3 */
-/***/ (function(module, exports) {
+/***/ ((__unused_webpack_module, exports) => {
-Object.defineProperty(exports, "__esModule", { value: true });
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MultipleFieldsValidator = void 0;
var MultipleFieldsValidator = /** @class */ (function () {
function MultipleFieldsValidator(fieldValidatorsPairs) {
@@ -1446,23 +1479,27 @@ exports.MultipleFieldsValidator = MultipleFieldsValidator;
/***/ }),
/* 4 */
-/***/ (function(module, exports) {
+/***/ (function(__unused_webpack_module, exports) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.NumberArrayValidator = exports.BooleanArrayValidator = exports.StringArrayValidator = exports.EnumValidator = exports.SchemaValidator = exports.ValueValidator = exports.NumberValidator = exports.BooleanValidator = exports.StringValidator = exports.TypeValidator = exports.ArrayValidator = exports.ObjectValidator = void 0;
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.RangeValidator = exports.NumberArrayValidator = exports.BooleanArrayValidator = exports.StringArrayValidator = exports.EnumValidator = exports.SchemaValidator = exports.ValueValidator = exports.NumberValidator = exports.BooleanValidator = exports.StringValidator = exports.TypeValidator = exports.ArrayValidator = exports.ObjectValidator = void 0;
var ObjectValidator = /** @class */ (function () {
function ObjectValidator() {
}
@@ -1498,7 +1535,7 @@ var ArrayValidator = /** @class */ (function () {
}];
}
for (var i = 0; i < input.length; i++) {
- var fieldsPath = (path ? path + "." : "") + field + "." + i;
+ var fieldsPath = (path ? path + "." : "") + field + "." + i.toString();
for (var _i = 0, _a = this.itemValidators; _i < _a.length; _i++) {
var validator = _a[_i];
var errors = validator.validate(input[i], fieldsPath, field);
@@ -1671,30 +1708,63 @@ var NumberArrayValidator = /** @class */ (function (_super) {
return NumberArrayValidator;
}(ArrayValidator));
exports.NumberArrayValidator = NumberArrayValidator;
+var RangeValidator = /** @class */ (function (_super) {
+ __extends(RangeValidator, _super);
+ function RangeValidator(minValue, maxValue) {
+ var _this = _super.call(this) || this;
+ _this.minValue = minValue;
+ _this.maxValue = maxValue;
+ return _this;
+ }
+ RangeValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ // input is a number, now check if it's in the given range
+ if (input > this.maxValue || input < this.minValue) {
+ return [{
+ message: field + " must be a number between " + this.minValue.toString() + " and " + this.maxValue.toString(),
+ path: (path ? path + "." : "") + field,
+ keyword: "range"
+ }];
+ }
+ return null;
+ };
+ return RangeValidator;
+}(NumberValidator));
+exports.RangeValidator = RangeValidator;
/***/ }),
/* 5 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_80906__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CaptureBookmarkRequestValidator = exports.CaptureBookmarkOptionsValidator = exports.ApplyBookmarkStateRequestValidator = exports.ApplyBookmarkByNameRequestValidator = exports.AddBookmarkRequestValidator = exports.PlayBookmarkRequestValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_80906__(3);
+var typeValidator_1 = __nested_webpack_require_80906__(4);
+var validator_1 = __nested_webpack_require_80906__(1);
var PlayBookmarkRequestValidator = /** @class */ (function (_super) {
__extends(PlayBookmarkRequestValidator, _super);
function PlayBookmarkRequestValidator() {
@@ -1820,6 +1890,10 @@ var CaptureBookmarkOptionsValidator = /** @class */ (function (_super) {
{
field: "personalizeVisuals",
validators: [validator_1.Validators.booleanValidator]
+ },
+ {
+ field: "allPages",
+ validators: [validator_1.Validators.booleanValidator]
}
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
@@ -1857,26 +1931,30 @@ exports.CaptureBookmarkRequestValidator = CaptureBookmarkRequestValidator;
/***/ }),
/* 6 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_89382__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.PaginatedReportCommandsValidator = exports.SingleCommandSettingsValidator = exports.CommandsSettingsValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_89382__(3);
+var typeValidator_1 = __nested_webpack_require_89382__(4);
+var validator_1 = __nested_webpack_require_89382__(1);
var CommandsSettingsValidator = /** @class */ (function (_super) {
__extends(CommandsSettingsValidator, _super);
function CommandsSettingsValidator() {
@@ -1935,6 +2013,26 @@ var CommandsSettingsValidator = /** @class */ (function (_super) {
field: "spotlight",
validators: [validator_1.Validators.singleCommandSettingsValidator]
},
+ {
+ field: "insightsAnalysis",
+ validators: [validator_1.Validators.singleCommandSettingsValidator]
+ },
+ {
+ field: "addComment",
+ validators: [validator_1.Validators.singleCommandSettingsValidator]
+ },
+ {
+ field: "groupVisualContainers",
+ validators: [validator_1.Validators.singleCommandSettingsValidator]
+ },
+ {
+ field: "summarize",
+ validators: [validator_1.Validators.singleCommandSettingsValidator]
+ },
+ {
+ field: "clearSelection",
+ validators: [validator_1.Validators.singleCommandSettingsValidator]
+ }
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
return multipleFieldsValidator.validate(input, path, field);
@@ -1971,29 +2069,58 @@ var SingleCommandSettingsValidator = /** @class */ (function (_super) {
return SingleCommandSettingsValidator;
}(typeValidator_1.ObjectValidator));
exports.SingleCommandSettingsValidator = SingleCommandSettingsValidator;
+var PaginatedReportCommandsValidator = /** @class */ (function (_super) {
+ __extends(PaginatedReportCommandsValidator, _super);
+ function PaginatedReportCommandsValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ PaginatedReportCommandsValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "parameterPanel",
+ validators: [validator_1.Validators.parametersPanelValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return PaginatedReportCommandsValidator;
+}(typeValidator_1.ObjectValidator));
+exports.PaginatedReportCommandsValidator = PaginatedReportCommandsValidator;
/***/ }),
/* 7 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_96415__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CustomThemeValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
+var multipleFieldsValidator_1 = __nested_webpack_require_96415__(3);
+var typeValidator_1 = __nested_webpack_require_96415__(4);
var CustomThemeValidator = /** @class */ (function (_super) {
__extends(CustomThemeValidator, _super);
function CustomThemeValidator() {
@@ -2023,26 +2150,30 @@ exports.CustomThemeValidator = CustomThemeValidator;
/***/ }),
/* 8 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_98569__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DashboardLoadValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_98569__(3);
+var typeValidator_1 = __nested_webpack_require_98569__(4);
+var validator_1 = __nested_webpack_require_98569__(1);
var DashboardLoadValidator = /** @class */ (function (_super) {
__extends(DashboardLoadValidator, _super);
function DashboardLoadValidator() {
@@ -2092,26 +2223,30 @@ exports.DashboardLoadValidator = DashboardLoadValidator;
/***/ }),
/* 9 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_101568__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DatasetBindingValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_101568__(3);
+var typeValidator_1 = __nested_webpack_require_101568__(4);
+var validator_1 = __nested_webpack_require_101568__(1);
var DatasetBindingValidator = /** @class */ (function (_super) {
__extends(DatasetBindingValidator, _super);
function DatasetBindingValidator() {
@@ -2125,10 +2260,21 @@ var DatasetBindingValidator = /** @class */ (function (_super) {
if (errors) {
return errors;
}
+ if (!input["datasetId"] && !input["paginatedReportBindings"]) {
+ return [{
+ message: "datasetBinding cannot be empty",
+ path: (path ? path + "." : "") + field,
+ keyword: "invalid"
+ }];
+ }
var fields = [
{
field: "datasetId",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ validators: [validator_1.Validators.stringValidator]
+ },
+ {
+ field: "paginatedReportBindings",
+ validators: [validator_1.Validators.paginatedReportDatasetBindingArrayValidator]
}
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
@@ -2141,25 +2287,29 @@ exports.DatasetBindingValidator = DatasetBindingValidator;
/***/ }),
/* 10 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_104264__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExportDataRequestValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
+var multipleFieldsValidator_1 = __nested_webpack_require_104264__(3);
+var typeValidator_1 = __nested_webpack_require_104264__(4);
var ExportDataRequestValidator = /** @class */ (function (_super) {
__extends(ExportDataRequestValidator, _super);
function ExportDataRequestValidator() {
@@ -2193,26 +2343,30 @@ exports.ExportDataRequestValidator = ExportDataRequestValidator;
/***/ }),
/* 11 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_106608__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ExtensionsValidator = exports.MenuGroupExtensionValidator = exports.ExtensionValidator = exports.CommandExtensionValidator = exports.ExtensionItemValidator = exports.ExtensionPointsValidator = exports.GroupedMenuExtensionValidator = exports.FlatMenuExtensionValidator = exports.MenuExtensionBaseValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_106608__(3);
+var typeValidator_1 = __nested_webpack_require_106608__(4);
+var validator_1 = __nested_webpack_require_106608__(1);
var MenuExtensionBaseValidator = /** @class */ (function (_super) {
__extends(MenuExtensionBaseValidator, _super);
function MenuExtensionBaseValidator() {
@@ -2482,26 +2636,30 @@ exports.ExtensionsValidator = ExtensionsValidator;
/***/ }),
/* 12 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_119099__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.ConditionItemValidator = exports.RemoveFiltersRequestValidator = exports.UpdateFiltersRequestValidator = exports.FilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterValidatorBase = exports.FilterDisplaySettingsValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.OnLoadFiltersValidator = exports.OnLoadFiltersBaseRemoveOperationValidator = exports.OnLoadFiltersBaseValidator = exports.ConditionItemValidator = exports.RemoveFiltersRequestValidator = exports.UpdateFiltersRequestValidator = exports.FilterValidator = exports.IncludeExcludePointValueValidator = exports.HierarchyFilterNodeValidator = exports.HierarchyFilterValidator = exports.IncludeExcludeFilterValidator = exports.NotSupportedFilterValidator = exports.TopNFilterValidator = exports.RelativeTimeFilterValidator = exports.RelativeDateFilterValidator = exports.RelativeDateTimeFilterValidator = exports.AdvancedFilterValidator = exports.BasicFilterValidator = exports.FilterValidatorBase = exports.FilterDisplaySettingsValidator = exports.FilterMeasureTargetValidator = exports.FilterKeyHierarchyTargetValidator = exports.FilterHierarchyTargetValidator = exports.FilterKeyColumnsTargetValidator = exports.FilterColumnTargetValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_119099__(3);
+var typeValidator_1 = __nested_webpack_require_119099__(4);
+var validator_1 = __nested_webpack_require_119099__(1);
var FilterColumnTargetValidator = /** @class */ (function (_super) {
__extends(FilterColumnTargetValidator, _super);
function FilterColumnTargetValidator() {
@@ -2770,7 +2928,7 @@ var AdvancedFilterValidator = /** @class */ (function (_super) {
},
{
field: "conditions",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filterConditionsValidator]
+ validators: [validator_1.Validators.filterConditionsValidator]
},
{
field: "filterType",
@@ -2783,12 +2941,12 @@ var AdvancedFilterValidator = /** @class */ (function (_super) {
return AdvancedFilterValidator;
}(FilterValidatorBase));
exports.AdvancedFilterValidator = AdvancedFilterValidator;
-var RelativeDateFilterValidator = /** @class */ (function (_super) {
- __extends(RelativeDateFilterValidator, _super);
- function RelativeDateFilterValidator() {
+var RelativeDateTimeFilterValidator = /** @class */ (function (_super) {
+ __extends(RelativeDateTimeFilterValidator, _super);
+ function RelativeDateTimeFilterValidator() {
return _super !== null && _super.apply(this, arguments) || this;
}
- RelativeDateFilterValidator.prototype.validate = function (input, path, field) {
+ RelativeDateTimeFilterValidator.prototype.validate = function (input, path, field) {
if (input == null) {
return null;
}
@@ -2803,33 +2961,29 @@ var RelativeDateFilterValidator = /** @class */ (function (_super) {
},
{
field: "timeUnitsCount",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator]
+ validators: [validator_1.Validators.numberValidator]
},
{
field: "timeUnitType",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator]
- },
- {
- field: "includeToday",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator]
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateTimeFilterUnitTypeValidator]
},
{
field: "filterType",
- validators: [validator_1.Validators.relativeDateFilterTypeValidator]
+ validators: [validator_1.Validators.relativeDateTimeFilterTypeValidator]
},
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
return multipleFieldsValidator.validate(input, path, field);
};
- return RelativeDateFilterValidator;
+ return RelativeDateTimeFilterValidator;
}(FilterValidatorBase));
-exports.RelativeDateFilterValidator = RelativeDateFilterValidator;
-var RelativeTimeFilterValidator = /** @class */ (function (_super) {
- __extends(RelativeTimeFilterValidator, _super);
- function RelativeTimeFilterValidator() {
+exports.RelativeDateTimeFilterValidator = RelativeDateTimeFilterValidator;
+var RelativeDateFilterValidator = /** @class */ (function (_super) {
+ __extends(RelativeDateFilterValidator, _super);
+ function RelativeDateFilterValidator() {
return _super !== null && _super.apply(this, arguments) || this;
}
- RelativeTimeFilterValidator.prototype.validate = function (input, path, field) {
+ RelativeDateFilterValidator.prototype.validate = function (input, path, field) {
if (input == null) {
return null;
}
@@ -2839,28 +2993,53 @@ var RelativeTimeFilterValidator = /** @class */ (function (_super) {
}
var fields = [
{
- field: "operator",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterOperatorValidator]
- },
- {
- field: "timeUnitsCount",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.numberValidator]
+ field: "includeToday",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.booleanValidator]
},
{
field: "timeUnitType",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator]
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeDateFilterTimeUnitTypeValidator]
},
{
field: "filterType",
- validators: [validator_1.Validators.relativeTimeFilterTypeValidator]
+ validators: [validator_1.Validators.relativeDateFilterTypeValidator]
},
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
return multipleFieldsValidator.validate(input, path, field);
};
- return RelativeTimeFilterValidator;
-}(FilterValidatorBase));
-exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator;
+ return RelativeDateFilterValidator;
+}(RelativeDateTimeFilterValidator));
+exports.RelativeDateFilterValidator = RelativeDateFilterValidator;
+var RelativeTimeFilterValidator = /** @class */ (function (_super) {
+ __extends(RelativeTimeFilterValidator, _super);
+ function RelativeTimeFilterValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ RelativeTimeFilterValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "timeUnitType",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.relativeTimeFilterTimeUnitTypeValidator]
+ },
+ {
+ field: "filterType",
+ validators: [validator_1.Validators.relativeTimeFilterTypeValidator]
+ },
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return RelativeTimeFilterValidator;
+}(RelativeDateTimeFilterValidator));
+exports.RelativeTimeFilterValidator = RelativeTimeFilterValidator;
var TopNFilterValidator = /** @class */ (function (_super) {
__extends(TopNFilterValidator, _super);
function TopNFilterValidator() {
@@ -2951,7 +3130,7 @@ var IncludeExcludeFilterValidator = /** @class */ (function (_super) {
},
{
field: "values",
- validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyArrayValidator]
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.includeExcludeFilterValuesValidator]
},
{
field: "filterType",
@@ -2964,6 +3143,101 @@ var IncludeExcludeFilterValidator = /** @class */ (function (_super) {
return IncludeExcludeFilterValidator;
}(FilterValidatorBase));
exports.IncludeExcludeFilterValidator = IncludeExcludeFilterValidator;
+var HierarchyFilterValidator = /** @class */ (function (_super) {
+ __extends(HierarchyFilterValidator, _super);
+ function HierarchyFilterValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ HierarchyFilterValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "hierarchyData",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.hierarchyFilterValuesValidator]
+ },
+ {
+ field: "filterType",
+ validators: [validator_1.Validators.hierarchyFilterTypeValidator]
+ },
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return HierarchyFilterValidator;
+}(FilterValidatorBase));
+exports.HierarchyFilterValidator = HierarchyFilterValidator;
+var HierarchyFilterNodeValidator = /** @class */ (function (_super) {
+ __extends(HierarchyFilterNodeValidator, _super);
+ function HierarchyFilterNodeValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ HierarchyFilterNodeValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "value",
+ validators: [validator_1.Validators.anyValueValidator]
+ },
+ {
+ field: "keyValues",
+ validators: [validator_1.Validators.anyArrayValidator]
+ },
+ {
+ field: "children",
+ validators: [validator_1.Validators.hierarchyFilterValuesValidator]
+ },
+ {
+ field: "operator",
+ validators: [validator_1.Validators.stringValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return HierarchyFilterNodeValidator;
+}(typeValidator_1.ObjectValidator));
+exports.HierarchyFilterNodeValidator = HierarchyFilterNodeValidator;
+var IncludeExcludePointValueValidator = /** @class */ (function (_super) {
+ __extends(IncludeExcludePointValueValidator, _super);
+ function IncludeExcludePointValueValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ IncludeExcludePointValueValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "value",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.anyValueValidator]
+ },
+ {
+ field: "keyValues",
+ validators: [validator_1.Validators.anyArrayValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return IncludeExcludePointValueValidator;
+}(typeValidator_1.ObjectValidator));
+exports.IncludeExcludePointValueValidator = IncludeExcludePointValueValidator;
var FilterValidator = /** @class */ (function (_super) {
__extends(FilterValidator, _super);
function FilterValidator() {
@@ -2973,6 +3247,10 @@ var FilterValidator = /** @class */ (function (_super) {
if (input == null) {
return null;
}
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
return validator_1.Validators.anyFilterValidator.validate(input, path, field);
};
return FilterValidator;
@@ -2987,6 +3265,10 @@ var UpdateFiltersRequestValidator = /** @class */ (function (_super) {
if (input == null) {
return null;
}
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
var fields = [
{
field: "filtersOperation",
@@ -3012,6 +3294,10 @@ var RemoveFiltersRequestValidator = /** @class */ (function (_super) {
if (input == null) {
return null;
}
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
var fields = [
{
field: "filtersOperation",
@@ -3057,30 +3343,121 @@ var ConditionItemValidator = /** @class */ (function (_super) {
return ConditionItemValidator;
}(typeValidator_1.ObjectValidator));
exports.ConditionItemValidator = ConditionItemValidator;
+var OnLoadFiltersBaseValidator = /** @class */ (function (_super) {
+ __extends(OnLoadFiltersBaseValidator, _super);
+ function OnLoadFiltersBaseValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ OnLoadFiltersBaseValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "operation",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filtersOperationsUpdateValidator]
+ },
+ {
+ field: "filters",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filtersArrayValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return OnLoadFiltersBaseValidator;
+}(typeValidator_1.ObjectValidator));
+exports.OnLoadFiltersBaseValidator = OnLoadFiltersBaseValidator;
+var OnLoadFiltersBaseRemoveOperationValidator = /** @class */ (function (_super) {
+ __extends(OnLoadFiltersBaseRemoveOperationValidator, _super);
+ function OnLoadFiltersBaseRemoveOperationValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ OnLoadFiltersBaseRemoveOperationValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "operation",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.filtersOperationsRemoveAllValidator]
+ },
+ {
+ field: "filters",
+ validators: [validator_1.Validators.fieldForbiddenValidator, validator_1.Validators.filtersArrayValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return OnLoadFiltersBaseRemoveOperationValidator;
+}(typeValidator_1.ObjectValidator));
+exports.OnLoadFiltersBaseRemoveOperationValidator = OnLoadFiltersBaseRemoveOperationValidator;
+var OnLoadFiltersValidator = /** @class */ (function (_super) {
+ __extends(OnLoadFiltersValidator, _super);
+ function OnLoadFiltersValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ OnLoadFiltersValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "allPages",
+ validators: [validator_1.Validators.onLoadFiltersBaseValidator]
+ },
+ {
+ field: "currentPage",
+ validators: [validator_1.Validators.onLoadFiltersBaseValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return OnLoadFiltersValidator;
+}(typeValidator_1.ObjectValidator));
+exports.OnLoadFiltersValidator = OnLoadFiltersValidator;
/***/ }),
/* 13 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_154405__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PageLayoutValidator = exports.DisplayStateValidator = exports.VisualLayoutValidator = exports.CustomLayoutValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_154405__(3);
+var typeValidator_1 = __nested_webpack_require_154405__(4);
+var validator_1 = __nested_webpack_require_154405__(1);
var CustomLayoutValidator = /** @class */ (function (_super) {
__extends(CustomLayoutValidator, _super);
function CustomLayoutValidator() {
@@ -3217,26 +3594,30 @@ exports.PageLayoutValidator = PageLayoutValidator;
/***/ }),
/* 14 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_160884__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PageViewFieldValidator = exports.PageValidator = exports.CustomPageSizeValidator = exports.PageSizeValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_160884__(3);
+var typeValidator_1 = __nested_webpack_require_160884__(4);
+var validator_1 = __nested_webpack_require_160884__(1);
var PageSizeValidator = /** @class */ (function (_super) {
__extends(PageSizeValidator, _super);
function PageSizeValidator() {
@@ -3344,26 +3725,30 @@ exports.PageViewFieldValidator = PageViewFieldValidator;
/***/ }),
/* 15 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_166324__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.ReportPanesValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.VisualizationsPaneValidator = exports.SyncSlicersPaneValidator = exports.SelectionPaneValidator = exports.PageNavigationPaneValidator = exports.FiltersPaneValidator = exports.FieldsPaneValidator = exports.BookmarksPaneValidator = exports.QnaPanesValidator = exports.ReportPanesValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_166324__(3);
+var typeValidator_1 = __nested_webpack_require_166324__(4);
+var validator_1 = __nested_webpack_require_166324__(1);
var ReportPanesValidator = /** @class */ (function (_super) {
__extends(ReportPanesValidator, _super);
function ReportPanesValidator() {
@@ -3413,6 +3798,31 @@ var ReportPanesValidator = /** @class */ (function (_super) {
return ReportPanesValidator;
}(typeValidator_1.ObjectValidator));
exports.ReportPanesValidator = ReportPanesValidator;
+var QnaPanesValidator = /** @class */ (function (_super) {
+ __extends(QnaPanesValidator, _super);
+ function QnaPanesValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ QnaPanesValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "filters",
+ validators: [validator_1.Validators.filtersPaneValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return QnaPanesValidator;
+}(typeValidator_1.ObjectValidator));
+exports.QnaPanesValidator = QnaPanesValidator;
var BookmarksPaneValidator = /** @class */ (function (_super) {
__extends(BookmarksPaneValidator, _super);
function BookmarksPaneValidator() {
@@ -3600,26 +4010,30 @@ exports.VisualizationsPaneValidator = VisualizationsPaneValidator;
/***/ }),
/* 16 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_178070__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.QnaInterpretInputDataValidator = exports.QnaSettingsValidator = exports.LoadQnaValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_178070__(3);
+var typeValidator_1 = __nested_webpack_require_178070__(4);
+var validator_1 = __nested_webpack_require_178070__(1);
var LoadQnaValidator = /** @class */ (function (_super) {
__extends(LoadQnaValidator, _super);
function LoadQnaValidator() {
@@ -3691,6 +4105,10 @@ var QnaSettingsValidator = /** @class */ (function (_super) {
field: "hideErrors",
validators: [validator_1.Validators.booleanValidator]
},
+ {
+ field: "panes",
+ validators: [validator_1.Validators.qnaPanesValidator]
+ }
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
return multipleFieldsValidator.validate(input, path, field);
@@ -3731,26 +4149,30 @@ exports.QnaInterpretInputDataValidator = QnaInterpretInputDataValidator;
/***/ }),
/* 17 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_183781__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ReportCreateValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_183781__(3);
+var typeValidator_1 = __nested_webpack_require_183781__(4);
+var validator_1 = __nested_webpack_require_183781__(1);
var ReportCreateValidator = /** @class */ (function (_super) {
__extends(ReportCreateValidator, _super);
function ReportCreateValidator() {
@@ -3796,26 +4218,30 @@ exports.ReportCreateValidator = ReportCreateValidator;
/***/ }),
/* 18 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_186639__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ReportLoadValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_186639__(3);
+var typeValidator_1 = __nested_webpack_require_186639__(4);
+var validator_1 = __nested_webpack_require_186639__(1);
var ReportLoadValidator = /** @class */ (function (_super) {
__extends(ReportLoadValidator, _super);
function ReportLoadValidator() {
@@ -3852,7 +4278,7 @@ var ReportLoadValidator = /** @class */ (function (_super) {
},
{
field: "filters",
- validators: [validator_1.Validators.filtersArrayValidator]
+ validators: [validator_1.Validators.reportLoadFiltersValidator]
},
{
field: "permissions",
@@ -3897,32 +4323,36 @@ exports.ReportLoadValidator = ReportLoadValidator;
/***/ }),
/* 19 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_190760__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.SaveAsParametersValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
-var SaveAsParametersValidator = /** @class */ (function (_super) {
- __extends(SaveAsParametersValidator, _super);
- function SaveAsParametersValidator() {
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ReportParameterFieldsValidator = exports.PaginatedReportLoadValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_190760__(3);
+var typeValidator_1 = __nested_webpack_require_190760__(4);
+var validator_1 = __nested_webpack_require_190760__(1);
+var PaginatedReportLoadValidator = /** @class */ (function (_super) {
+ __extends(PaginatedReportLoadValidator, _super);
+ function PaginatedReportLoadValidator() {
return _super !== null && _super.apply(this, arguments) || this;
}
- SaveAsParametersValidator.prototype.validate = function (input, path, field) {
+ PaginatedReportLoadValidator.prototype.validate = function (input, path, field) {
if (input == null) {
return null;
}
@@ -3932,41 +4362,153 @@ var SaveAsParametersValidator = /** @class */ (function (_super) {
}
var fields = [
{
- field: "name",
+ field: "accessToken",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "id",
validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "groupId",
+ validators: [validator_1.Validators.stringValidator]
+ },
+ {
+ field: "settings",
+ validators: [validator_1.Validators.paginatedReportsettingsValidator]
+ },
+ {
+ field: "tokenType",
+ validators: [validator_1.Validators.tokenTypeValidator]
+ },
+ {
+ field: "embedUrl",
+ validators: [validator_1.Validators.stringValidator]
+ },
+ {
+ field: "type",
+ validators: [validator_1.Validators.stringValidator]
+ },
+ {
+ field: "parameterValues",
+ validators: [validator_1.Validators.parameterValuesArrayValidator]
+ },
+ {
+ field: "datasetBindings",
+ validators: [validator_1.Validators.paginatedReportDatasetBindingArrayValidator]
}
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
return multipleFieldsValidator.validate(input, path, field);
};
- return SaveAsParametersValidator;
+ return PaginatedReportLoadValidator;
}(typeValidator_1.ObjectValidator));
-exports.SaveAsParametersValidator = SaveAsParametersValidator;
-
-
-/***/ }),
-/* 20 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var __extends = (this && this.__extends) || (function () {
- var extendStatics = function (d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
-})();
-Object.defineProperty(exports, "__esModule", { value: true });
+exports.PaginatedReportLoadValidator = PaginatedReportLoadValidator;
+var ReportParameterFieldsValidator = /** @class */ (function () {
+ function ReportParameterFieldsValidator() {
+ }
+ ReportParameterFieldsValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var fields = [
+ {
+ field: "name",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "value",
+ validators: [validator_1.Validators.stringValidator]
+ },
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return ReportParameterFieldsValidator;
+}());
+exports.ReportParameterFieldsValidator = ReportParameterFieldsValidator;
+
+
+/***/ }),
+/* 20 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_195256__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.SaveAsParametersValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_195256__(3);
+var typeValidator_1 = __nested_webpack_require_195256__(4);
+var validator_1 = __nested_webpack_require_195256__(1);
+var SaveAsParametersValidator = /** @class */ (function (_super) {
+ __extends(SaveAsParametersValidator, _super);
+ function SaveAsParametersValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ SaveAsParametersValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "name",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return SaveAsParametersValidator;
+}(typeValidator_1.ObjectValidator));
+exports.SaveAsParametersValidator = SaveAsParametersValidator;
+
+
+/***/ }),
+/* 21 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_197537__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SlicerTargetSelectorValidator = exports.VisualTypeSelectorValidator = exports.VisualSelectorValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var typeValidator_2 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_197537__(3);
+var typeValidator_1 = __nested_webpack_require_197537__(4);
+var typeValidator_2 = __nested_webpack_require_197537__(4);
+var validator_1 = __nested_webpack_require_197537__(1);
var VisualSelectorValidator = /** @class */ (function (_super) {
__extends(VisualSelectorValidator, _super);
function VisualSelectorValidator() {
@@ -4058,27 +4600,31 @@ exports.SlicerTargetSelectorValidator = SlicerTargetSelectorValidator;
/***/ }),
-/* 21 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 22 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_202995__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.SettingsValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.PaginatedReportSettingsValidator = exports.SettingsValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_202995__(3);
+var typeValidator_1 = __nested_webpack_require_202995__(4);
+var validator_1 = __nested_webpack_require_202995__(1);
var SettingsValidator = /** @class */ (function (_super) {
__extends(SettingsValidator, _super);
function SettingsValidator() {
@@ -4164,6 +4710,10 @@ var SettingsValidator = /** @class */ (function (_super) {
{
field: "authoringHintsEnabled",
validators: [validator_1.Validators.booleanValidator]
+ },
+ {
+ field: "printSettings",
+ validators: [validator_1.Validators.printSettingsValidator]
}
];
var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
@@ -4172,30 +4722,59 @@ var SettingsValidator = /** @class */ (function (_super) {
return SettingsValidator;
}(typeValidator_1.ObjectValidator));
exports.SettingsValidator = SettingsValidator;
+var PaginatedReportSettingsValidator = /** @class */ (function (_super) {
+ __extends(PaginatedReportSettingsValidator, _super);
+ function PaginatedReportSettingsValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ PaginatedReportSettingsValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "commands",
+ validators: [validator_1.Validators.paginatedReportCommandsValidator]
+ },
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return PaginatedReportSettingsValidator;
+}(typeValidator_1.ObjectValidator));
+exports.PaginatedReportSettingsValidator = PaginatedReportSettingsValidator;
/***/ }),
-/* 22 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 23 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_208991__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.SlicerStateValidator = exports.SlicerValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_208991__(3);
+var typeValidator_1 = __nested_webpack_require_208991__(4);
+var validator_1 = __nested_webpack_require_208991__(1);
var SlicerValidator = /** @class */ (function (_super) {
__extends(SlicerValidator, _super);
function SlicerValidator() {
@@ -4253,27 +4832,31 @@ exports.SlicerStateValidator = SlicerStateValidator;
/***/ }),
-/* 23 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 24 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_212421__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TileLoadValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_212421__(3);
+var typeValidator_1 = __nested_webpack_require_212421__(4);
+var validator_1 = __nested_webpack_require_212421__(1);
var TileLoadValidator = /** @class */ (function (_super) {
__extends(TileLoadValidator, _super);
function TileLoadValidator() {
@@ -4330,27 +4913,31 @@ exports.TileLoadValidator = TileLoadValidator;
/***/ }),
-/* 24 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 25 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_215693__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.VisualHeaderValidator = exports.VisualHeaderSettingsValidator = exports.VisualSettingsValidator = void 0;
-var multipleFieldsValidator_1 = __webpack_require__(3);
-var typeValidator_1 = __webpack_require__(4);
-var validator_1 = __webpack_require__(1);
+var multipleFieldsValidator_1 = __nested_webpack_require_215693__(3);
+var typeValidator_1 = __nested_webpack_require_215693__(4);
+var validator_1 = __nested_webpack_require_215693__(1);
var VisualSettingsValidator = /** @class */ (function (_super) {
__extends(VisualSettingsValidator, _super);
function VisualSettingsValidator() {
@@ -4433,10 +5020,12 @@ exports.VisualHeaderValidator = VisualHeaderValidator;
/***/ }),
-/* 25 */
-/***/ (function(module, exports) {
+/* 26 */
+/***/ ((__unused_webpack_module, exports) => {
-Object.defineProperty(exports, "__esModule", { value: true });
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.AnyOfValidator = void 0;
var AnyOfValidator = /** @class */ (function () {
function AnyOfValidator(validators) {
@@ -4470,10 +5059,12 @@ exports.AnyOfValidator = AnyOfValidator;
/***/ }),
-/* 26 */
-/***/ (function(module, exports) {
+/* 27 */
+/***/ ((__unused_webpack_module, exports) => {
-Object.defineProperty(exports, "__esModule", { value: true });
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.FieldForbiddenValidator = void 0;
var FieldForbiddenValidator = /** @class */ (function () {
function FieldForbiddenValidator() {
@@ -4494,10 +5085,12 @@ exports.FieldForbiddenValidator = FieldForbiddenValidator;
/***/ }),
-/* 27 */
-/***/ (function(module, exports) {
+/* 28 */
+/***/ ((__unused_webpack_module, exports) => {
-Object.defineProperty(exports, "__esModule", { value: true });
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.FieldRequiredValidator = void 0;
var FieldRequiredValidator = /** @class */ (function () {
function FieldRequiredValidator() {
@@ -4518,25 +5111,29 @@ exports.FieldRequiredValidator = FieldRequiredValidator;
/***/ }),
-/* 28 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 29 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_223102__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MapValidator = void 0;
-var typeValidator_1 = __webpack_require__(4);
+var typeValidator_1 = __nested_webpack_require_223102__(4);
var MapValidator = /** @class */ (function (_super) {
__extends(MapValidator, _super);
function MapValidator(keyValidators, valueValidators) {
@@ -4579,121 +5176,967 @@ var MapValidator = /** @class */ (function (_super) {
exports.MapValidator = MapValidator;
-/***/ })
-/******/ ]);
-});
-//# sourceMappingURL=models.js.map
-
/***/ }),
+/* 30 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_225786__) {
-/***/ "./node_modules/powerbi-router/dist/router.js":
-/*!****************************************************!*\
- !*** ./node_modules/powerbi-router/dist/router.js ***!
- \****************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ParametersPanelValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_225786__(3);
+var typeValidator_1 = __nested_webpack_require_225786__(4);
+var validator_1 = __nested_webpack_require_225786__(1);
+var ParametersPanelValidator = /** @class */ (function (_super) {
+ __extends(ParametersPanelValidator, _super);
+ function ParametersPanelValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ ParametersPanelValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "expanded",
+ validators: [validator_1.Validators.booleanValidator]
+ },
+ {
+ field: "enabled",
+ validators: [validator_1.Validators.booleanValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return ParametersPanelValidator;
+}(typeValidator_1.ObjectValidator));
+exports.ParametersPanelValidator = ParametersPanelValidator;
-/*! powerbi-router v0.1.5 | (c) 2016 Microsoft Corporation MIT */
-(function webpackUniversalModuleDefinition(root, factory) {
- if(true)
- module.exports = factory();
- else {}
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-/******/
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
- "use strict";
- var RouteRecognizer = __webpack_require__(1);
- var Router = (function () {
- function Router(handlers) {
- this.handlers = handlers;
- /**
- * TODO: look at generating the router dynamically based on list of supported http methods
- * instead of hardcoding the creation of these and the methods.
- */
- this.getRouteRecognizer = new RouteRecognizer();
- this.patchRouteRecognizer = new RouteRecognizer();
- this.postRouteRecognizer = new RouteRecognizer();
- this.putRouteRecognizer = new RouteRecognizer();
- this.deleteRouteRecognizer = new RouteRecognizer();
- }
- Router.prototype.get = function (url, handler) {
- this.registerHandler(this.getRouteRecognizer, "GET", url, handler);
- return this;
- };
- Router.prototype.patch = function (url, handler) {
- this.registerHandler(this.patchRouteRecognizer, "PATCH", url, handler);
- return this;
- };
- Router.prototype.post = function (url, handler) {
- this.registerHandler(this.postRouteRecognizer, "POST", url, handler);
- return this;
- };
- Router.prototype.put = function (url, handler) {
- this.registerHandler(this.putRouteRecognizer, "PUT", url, handler);
- return this;
- };
- Router.prototype.delete = function (url, handler) {
- this.registerHandler(this.deleteRouteRecognizer, "DELETE", url, handler);
- return this;
- };
- /**
- * TODO: This method could use some refactoring. There is conflict of interest between keeping clean separation of test and handle method
- * Test method only returns boolean indicating if request can be handled, and handle method has opportunity to modify response and return promise of it.
- * In the case of the router with route-recognizer where handlers are associated with routes, this already guarantees that only one handler is selected and makes the test method feel complicated
- * Will leave as is an investigate cleaner ways at later time.
- */
- Router.prototype.registerHandler = function (routeRecognizer, method, url, handler) {
- var routeRecognizerHandler = function (request) {
- var response = new Response();
- return Promise.resolve(handler(request, response))
- .then(function (x) { return response; });
- };
- routeRecognizer.add([
- { path: url, handler: routeRecognizerHandler }
+/***/ }),
+/* 31 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_228154__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.TableDataValidator = exports.TableSchemaValidator = exports.ColumnSchemaValidator = exports.CredentialsValidator = exports.DatasourceConnectionConfigValidator = exports.DatasetCreateConfigValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_228154__(3);
+var typeValidator_1 = __nested_webpack_require_228154__(4);
+var validator_1 = __nested_webpack_require_228154__(1);
+var DatasetCreateConfigValidator = /** @class */ (function (_super) {
+ __extends(DatasetCreateConfigValidator, _super);
+ function DatasetCreateConfigValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ DatasetCreateConfigValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "locale",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "mashupDocument",
+ validators: [validator_1.Validators.stringValidator]
+ },
+ {
+ field: "datasourceConnectionConfig",
+ validators: [validator_1.Validators.datasourceConnectionConfigValidator]
+ },
+ {
+ field: "tableSchemaList",
+ validators: [validator_1.Validators.tableSchemaListValidator]
+ },
+ {
+ field: "data",
+ validators: [validator_1.Validators.tableDataArrayValidator]
+ },
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ errors = multipleFieldsValidator.validate(input, path, field);
+ if (errors) {
+ return errors;
+ }
+ if (input["datasourceConnectionConfig"] && input["mashupDocument"] == null) {
+ return [{
+ message: "mashupDocument cannot be empty when datasourceConnectionConfig is presented"
+ }];
+ }
+ if (input["data"] && input["tableSchemaList"] == null) {
+ return [{
+ message: "tableSchemaList cannot be empty when data is provided"
+ }];
+ }
+ if (input["data"] == null && input["mashupDocument"] == null) {
+ return [{
+ message: "At least one of data or mashupDocument must be provided"
+ }];
+ }
+ };
+ return DatasetCreateConfigValidator;
+}(typeValidator_1.ObjectValidator));
+exports.DatasetCreateConfigValidator = DatasetCreateConfigValidator;
+var DatasourceConnectionConfigValidator = /** @class */ (function (_super) {
+ __extends(DatasourceConnectionConfigValidator, _super);
+ function DatasourceConnectionConfigValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ DatasourceConnectionConfigValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "dataCacheMode",
+ validators: [validator_1.Validators.dataCacheModeValidator]
+ },
+ {
+ field: "credentials",
+ validators: [validator_1.Validators.credentialsValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return DatasourceConnectionConfigValidator;
+}(typeValidator_1.ObjectValidator));
+exports.DatasourceConnectionConfigValidator = DatasourceConnectionConfigValidator;
+var CredentialsValidator = /** @class */ (function (_super) {
+ __extends(CredentialsValidator, _super);
+ function CredentialsValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ CredentialsValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "credentialType",
+ validators: [validator_1.Validators.credentialTypeValidator]
+ },
+ {
+ field: "credentialDetails",
+ validators: [validator_1.Validators.credentialDetailsValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return CredentialsValidator;
+}(typeValidator_1.ObjectValidator));
+exports.CredentialsValidator = CredentialsValidator;
+var ColumnSchemaValidator = /** @class */ (function (_super) {
+ __extends(ColumnSchemaValidator, _super);
+ function ColumnSchemaValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ ColumnSchemaValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "name",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "displayName",
+ validators: [validator_1.Validators.stringValidator]
+ },
+ {
+ field: "dataType",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return ColumnSchemaValidator;
+}(typeValidator_1.ObjectValidator));
+exports.ColumnSchemaValidator = ColumnSchemaValidator;
+var TableSchemaValidator = /** @class */ (function (_super) {
+ __extends(TableSchemaValidator, _super);
+ function TableSchemaValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TableSchemaValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "name",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "columns",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.columnSchemaArrayValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return TableSchemaValidator;
+}(typeValidator_1.ObjectValidator));
+exports.TableSchemaValidator = TableSchemaValidator;
+var TableDataValidator = /** @class */ (function (_super) {
+ __extends(TableDataValidator, _super);
+ function TableDataValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ TableDataValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "name",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "rows",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.rawDataValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return TableDataValidator;
+}(typeValidator_1.ObjectValidator));
+exports.TableDataValidator = TableDataValidator;
+
+
+/***/ }),
+/* 32 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_238209__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.QuickCreateValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_238209__(3);
+var typeValidator_1 = __nested_webpack_require_238209__(4);
+var validator_1 = __nested_webpack_require_238209__(1);
+var QuickCreateValidator = /** @class */ (function (_super) {
+ __extends(QuickCreateValidator, _super);
+ function QuickCreateValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ QuickCreateValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "accessToken",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "groupId",
+ validators: [validator_1.Validators.stringValidator]
+ },
+ {
+ field: "tokenType",
+ validators: [validator_1.Validators.tokenTypeValidator]
+ },
+ {
+ field: "theme",
+ validators: [validator_1.Validators.customThemeValidator]
+ },
+ {
+ field: "datasetCreateConfig",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.datasetCreateConfigValidator]
+ },
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return QuickCreateValidator;
+}(typeValidator_1.ObjectValidator));
+exports.QuickCreateValidator = QuickCreateValidator;
+
+
+/***/ }),
+/* 33 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_241082__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.PrintSettingsValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_241082__(3);
+var typeValidator_1 = __nested_webpack_require_241082__(4);
+var PrintSettingsValidator = /** @class */ (function (_super) {
+ __extends(PrintSettingsValidator, _super);
+ function PrintSettingsValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ PrintSettingsValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "browserPrintAdjustmentsMode",
+ validators: [new typeValidator_1.EnumValidator([0, 1])]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return PrintSettingsValidator;
+}(typeValidator_1.ObjectValidator));
+exports.PrintSettingsValidator = PrintSettingsValidator;
+
+
+/***/ }),
+/* 34 */
+/***/ (function(__unused_webpack_module, exports, __nested_webpack_require_243275__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.PaginatedReportDatasetBindingValidator = void 0;
+var multipleFieldsValidator_1 = __nested_webpack_require_243275__(3);
+var typeValidator_1 = __nested_webpack_require_243275__(4);
+var validator_1 = __nested_webpack_require_243275__(1);
+var PaginatedReportDatasetBindingValidator = /** @class */ (function (_super) {
+ __extends(PaginatedReportDatasetBindingValidator, _super);
+ function PaginatedReportDatasetBindingValidator() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ PaginatedReportDatasetBindingValidator.prototype.validate = function (input, path, field) {
+ if (input == null) {
+ return null;
+ }
+ var errors = _super.prototype.validate.call(this, input, path, field);
+ if (errors) {
+ return errors;
+ }
+ var fields = [
+ {
+ field: "sourceDatasetId",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ },
+ {
+ field: "targetDatasetId",
+ validators: [validator_1.Validators.fieldRequiredValidator, validator_1.Validators.stringValidator]
+ }
+ ];
+ var multipleFieldsValidator = new multipleFieldsValidator_1.MultipleFieldsValidator(fields);
+ return multipleFieldsValidator.validate(input, path, field);
+ };
+ return PaginatedReportDatasetBindingValidator;
+}(typeValidator_1.ObjectValidator));
+exports.PaginatedReportDatasetBindingValidator = PaginatedReportDatasetBindingValidator;
+
+
+/***/ })
+/******/ ]);
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __nested_webpack_require_246021__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_246021__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/************************************************************************/
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module is referenced by other modules so it can't be inlined
+/******/ var __nested_webpack_exports__ = __nested_webpack_require_246021__(0);
+/******/
+/******/ return __nested_webpack_exports__;
+/******/ })()
+;
+});
+//# sourceMappingURL=models.js.map
+// SIG // Begin signature block
+// SIG // MIIreAYJKoZIhvcNAQcCoIIraTCCK2UCAQExDzANBglg
+// SIG // hkgBZQMEAgEFADB3BgorBgEEAYI3AgEEoGkwZzAyBgor
+// SIG // BgEEAYI3AgEeMCQCAQEEEBDgyQbOONQRoqMAEEvTUJAC
+// SIG // AQACAQACAQACAQACAQAwMTANBglghkgBZQMEAgEFAAQg
+// SIG // MwL/tGu4f/dhr3gVOxM8t9Nr0kVsURXdWFmzt2Tv2Syg
+// SIG // ghFuMIIIfjCCB2agAwIBAgITNgAAAd9zgZcWvjL9DQAC
+// SIG // AAAB3zANBgkqhkiG9w0BAQsFADBBMRMwEQYKCZImiZPy
+// SIG // LGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRUw
+// SIG // EwYDVQQDEwxBTUUgQ1MgQ0EgMDEwHhcNMjQwMTIwMDEz
+// SIG // MzQ0WhcNMjUwMTE5MDEzMzQ0WjAkMSIwIAYDVQQDExlN
+// SIG // aWNyb3NvZnQgQXp1cmUgQ29kZSBTaWduMIIBIjANBgkq
+// SIG // hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1bnAJpGyFqbK
+// SIG // WMrMsnUMskYdi/KuYoGBXMtrw5PMRr1TEQYccGzrCSBH
+// SIG // dMGPDe1lP8YJGDJ0rDOL5nNgePQxnawI0iam7MdM3/gy
+// SIG // xY6wSE1HnHUYZatFShl/FG1TpINGiHxTS0bOA0qwmWId
+// SIG // us8gfKpC/41Jgew4XARIYYDpV0UOCx51L+6n/ol6g7sB
+// SIG // c/bVEwIfCRrIC0QStKErEX1AfhSRdislMc5nhVySohMp
+// SIG // 7Fs+JKqDPdWoNWMNFPHdHvkYACotxbdXFwPt6ijOiNR9
+// SIG // dXvzXSI4e6E4b6wbXxJ4MJcG0xdymTh3YSwRWdfFOL/F
+// SIG // Xk5W+K/eN+OgmNvkip0GuwIDAQABo4IFijCCBYYwKQYJ
+// SIG // KwYBBAGCNxUKBBwwGjAMBgorBgEEAYI3WwEBMAoGCCsG
+// SIG // AQUFBwMDMD0GCSsGAQQBgjcVBwQwMC4GJisGAQQBgjcV
+// SIG // CIaQ4w2E1bR4hPGLPoWb3RbOnRKBYIPdzWaGlIwyAgFk
+// SIG // AgEOMIICdgYIKwYBBQUHAQEEggJoMIICZDBiBggrBgEF
+// SIG // BQcwAoZWaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3Br
+// SIG // aWluZnJhL0NlcnRzL0JZMlBLSUNTQ0EwMS5BTUUuR0JM
+// SIG // X0FNRSUyMENTJTIwQ0ElMjAwMSgyKS5jcnQwUgYIKwYB
+// SIG // BQUHMAKGRmh0dHA6Ly9jcmwxLmFtZS5nYmwvYWlhL0JZ
+// SIG // MlBLSUNTQ0EwMS5BTUUuR0JMX0FNRSUyMENTJTIwQ0El
+// SIG // MjAwMSgyKS5jcnQwUgYIKwYBBQUHMAKGRmh0dHA6Ly9j
+// SIG // cmwyLmFtZS5nYmwvYWlhL0JZMlBLSUNTQ0EwMS5BTUUu
+// SIG // R0JMX0FNRSUyMENTJTIwQ0ElMjAwMSgyKS5jcnQwUgYI
+// SIG // KwYBBQUHMAKGRmh0dHA6Ly9jcmwzLmFtZS5nYmwvYWlh
+// SIG // L0JZMlBLSUNTQ0EwMS5BTUUuR0JMX0FNRSUyMENTJTIw
+// SIG // Q0ElMjAwMSgyKS5jcnQwUgYIKwYBBQUHMAKGRmh0dHA6
+// SIG // Ly9jcmw0LmFtZS5nYmwvYWlhL0JZMlBLSUNTQ0EwMS5B
+// SIG // TUUuR0JMX0FNRSUyMENTJTIwQ0ElMjAwMSgyKS5jcnQw
+// SIG // ga0GCCsGAQUFBzAChoGgbGRhcDovLy9DTj1BTUUlMjBD
+// SIG // UyUyMENBJTIwMDEsQ049QUlBLENOPVB1YmxpYyUyMEtl
+// SIG // eSUyMFNlcnZpY2VzLENOPVNlcnZpY2VzLENOPUNvbmZp
+// SIG // Z3VyYXRpb24sREM9QU1FLERDPUdCTD9jQUNlcnRpZmlj
+// SIG // YXRlP2Jhc2U/b2JqZWN0Q2xhc3M9Y2VydGlmaWNhdGlv
+// SIG // bkF1dGhvcml0eTAdBgNVHQ4EFgQUju4tKpnu7Y7YxY8r
+// SIG // iI5ZhjOnGwkwDgYDVR0PAQH/BAQDAgeAMEUGA1UdEQQ+
+// SIG // MDykOjA4MR4wHAYDVQQLExVNaWNyb3NvZnQgQ29ycG9y
+// SIG // YXRpb24xFjAUBgNVBAUTDTIzNjE2Nys1MDE5NzAwggHm
+// SIG // BgNVHR8EggHdMIIB2TCCAdWgggHRoIIBzYY/aHR0cDov
+// SIG // L2NybC5taWNyb3NvZnQuY29tL3BraWluZnJhL0NSTC9B
+// SIG // TUUlMjBDUyUyMENBJTIwMDEoMikuY3JshjFodHRwOi8v
+// SIG // Y3JsMS5hbWUuZ2JsL2NybC9BTUUlMjBDUyUyMENBJTIw
+// SIG // MDEoMikuY3JshjFodHRwOi8vY3JsMi5hbWUuZ2JsL2Ny
+// SIG // bC9BTUUlMjBDUyUyMENBJTIwMDEoMikuY3JshjFodHRw
+// SIG // Oi8vY3JsMy5hbWUuZ2JsL2NybC9BTUUlMjBDUyUyMENB
+// SIG // JTIwMDEoMikuY3JshjFodHRwOi8vY3JsNC5hbWUuZ2Js
+// SIG // L2NybC9BTUUlMjBDUyUyMENBJTIwMDEoMikuY3JshoG9
+// SIG // bGRhcDovLy9DTj1BTUUlMjBDUyUyMENBJTIwMDEoMiks
+// SIG // Q049QlkyUEtJQ1NDQTAxLENOPUNEUCxDTj1QdWJsaWMl
+// SIG // MjBLZXklMjBTZXJ2aWNlcyxDTj1TZXJ2aWNlcyxDTj1D
+// SIG // b25maWd1cmF0aW9uLERDPUFNRSxEQz1HQkw/Y2VydGlm
+// SIG // aWNhdGVSZXZvY2F0aW9uTGlzdD9iYXNlP29iamVjdENs
+// SIG // YXNzPWNSTERpc3RyaWJ1dGlvblBvaW50MB8GA1UdIwQY
+// SIG // MBaAFJZRhOBrb3v+2Aarw/KF5imuavnUMB8GA1UdJQQY
+// SIG // MBYGCisGAQQBgjdbAQEGCCsGAQUFBwMDMA0GCSqGSIb3
+// SIG // DQEBCwUAA4IBAQCXv2FzUgqF4rS3/1+aXyWaXqd3LI3a
+// SIG // pgYIPvCq/vvFzI1sHZuLYi2rCTFDwoJqeTWJ98AuBnnx
+// SIG // mMHxe15thTEkdoukFB44oBrugY3VkIeBMBmjaly5F5VD
+// SIG // O1sNmdCq0baQi9egwjkzWbghTwMrUhxbJD1q6+qtxAbo
+// SIG // jOj+VS4BUiogMXLp5XSaK26wa72UmYm9TiDcxRgELM1E
+// SIG // dMraL1uhTqfrqFYYkAqpzoXgtaaZ2T7LO7516KIMjtMY
+// SIG // EluNG0ZZbRn8J5TndyGf+N2To+V3nkoYOdks1RIsmK2Y
+// SIG // w9ezEjc0DNSSiNO/prQAuw/nmf/oNqTP/daB3Kw6vTau
+// SIG // EK0tMIII6DCCBtCgAwIBAgITHwAAAFHqj/accwyoOwAA
+// SIG // AAAAUTANBgkqhkiG9w0BAQsFADA8MRMwEQYKCZImiZPy
+// SIG // LGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRAw
+// SIG // DgYDVQQDEwdhbWVyb290MB4XDTIxMDUyMTE4NDQxNFoX
+// SIG // DTI2MDUyMTE4NTQxNFowQTETMBEGCgmSJomT8ixkARkW
+// SIG // A0dCTDETMBEGCgmSJomT8ixkARkWA0FNRTEVMBMGA1UE
+// SIG // AxMMQU1FIENTIENBIDAxMIIBIjANBgkqhkiG9w0BAQEF
+// SIG // AAOCAQ8AMIIBCgKCAQEAyZpSCX0Bno1W1yqXMhT6BUlJ
+// SIG // ZWpa4p3xFeiTHO4vm2Q6C/azR5xwxnyYHrkSGDtS2P9X
+// SIG // +KDE64V20mmEQkubxnPNeOVnE2RvdPGxgwlq+BhS3ONd
+// SIG // VsQPj79q7XgHM9HhzB9+qk0PC9KN1zm9p/seyiRS6JF1
+// SIG // dbOqRf1pUl7FAVxmgiCFgV8hHIb/rDPXig7FDi3S0yEx
+// SIG // 2CUDVpIq8jEhG8anUFE1WYxM+ni0S5KHwwKPKV4qyGDo
+// SIG // DO+9AmDoma3Chyu5WDlW5cdtqXTWsGPE3umtnX6Amlld
+// SIG // UFLms4OVR4guKf+n5LIBCC6bTiocfXPomqYjYTKx7AGM
+// SIG // faVLaaXmhQIDAQABo4IE3DCCBNgwEgYJKwYBBAGCNxUB
+// SIG // BAUCAwIAAjAjBgkrBgEEAYI3FQIEFgQUEmgkQiFHy9Rr
+// SIG // vjHPIKTACyN/P0cwHQYDVR0OBBYEFJZRhOBrb3v+2Aar
+// SIG // w/KF5imuavnUMIIBBAYDVR0lBIH8MIH5BgcrBgEFAgMF
+// SIG // BggrBgEFBQcDAQYIKwYBBQUHAwIGCisGAQQBgjcUAgEG
+// SIG // CSsGAQQBgjcVBgYKKwYBBAGCNwoDDAYJKwYBBAGCNxUG
+// SIG // BggrBgEFBQcDCQYIKwYBBQUIAgIGCisGAQQBgjdAAQEG
+// SIG // CysGAQQBgjcKAwQBBgorBgEEAYI3CgMEBgkrBgEEAYI3
+// SIG // FQUGCisGAQQBgjcUAgIGCisGAQQBgjcUAgMGCCsGAQUF
+// SIG // BwMDBgorBgEEAYI3WwEBBgorBgEEAYI3WwIBBgorBgEE
+// SIG // AYI3WwMBBgorBgEEAYI3WwUBBgorBgEEAYI3WwQBBgor
+// SIG // BgEEAYI3WwQCMBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIA
+// SIG // QwBBMAsGA1UdDwQEAwIBhjASBgNVHRMBAf8ECDAGAQH/
+// SIG // AgEAMB8GA1UdIwQYMBaAFCleUV5krjS566ycDaeMdQHR
+// SIG // CQsoMIIBaAYDVR0fBIIBXzCCAVswggFXoIIBU6CCAU+G
+// SIG // MWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2lpbmZy
+// SIG // YS9jcmwvYW1lcm9vdC5jcmyGI2h0dHA6Ly9jcmwyLmFt
+// SIG // ZS5nYmwvY3JsL2FtZXJvb3QuY3JshiNodHRwOi8vY3Js
+// SIG // My5hbWUuZ2JsL2NybC9hbWVyb290LmNybIYjaHR0cDov
+// SIG // L2NybDEuYW1lLmdibC9jcmwvYW1lcm9vdC5jcmyGgaps
+// SIG // ZGFwOi8vL0NOPWFtZXJvb3QsQ049QU1FUm9vdCxDTj1D
+// SIG // RFAsQ049UHVibGljJTIwS2V5JTIwU2VydmljZXMsQ049
+// SIG // U2VydmljZXMsQ049Q29uZmlndXJhdGlvbixEQz1BTUUs
+// SIG // REM9R0JMP2NlcnRpZmljYXRlUmV2b2NhdGlvbkxpc3Q/
+// SIG // YmFzZT9vYmplY3RDbGFzcz1jUkxEaXN0cmlidXRpb25Q
+// SIG // b2ludDCCAasGCCsGAQUFBwEBBIIBnTCCAZkwRwYIKwYB
+// SIG // BQUHMAKGO2h0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9w
+// SIG // a2lpbmZyYS9jZXJ0cy9BTUVSb290X2FtZXJvb3QuY3J0
+// SIG // MDcGCCsGAQUFBzAChitodHRwOi8vY3JsMi5hbWUuZ2Js
+// SIG // L2FpYS9BTUVSb290X2FtZXJvb3QuY3J0MDcGCCsGAQUF
+// SIG // BzAChitodHRwOi8vY3JsMy5hbWUuZ2JsL2FpYS9BTUVS
+// SIG // b290X2FtZXJvb3QuY3J0MDcGCCsGAQUFBzAChitodHRw
+// SIG // Oi8vY3JsMS5hbWUuZ2JsL2FpYS9BTUVSb290X2FtZXJv
+// SIG // b3QuY3J0MIGiBggrBgEFBQcwAoaBlWxkYXA6Ly8vQ049
+// SIG // YW1lcm9vdCxDTj1BSUEsQ049UHVibGljJTIwS2V5JTIw
+// SIG // U2VydmljZXMsQ049U2VydmljZXMsQ049Q29uZmlndXJh
+// SIG // dGlvbixEQz1BTUUsREM9R0JMP2NBQ2VydGlmaWNhdGU/
+// SIG // YmFzZT9vYmplY3RDbGFzcz1jZXJ0aWZpY2F0aW9uQXV0
+// SIG // aG9yaXR5MA0GCSqGSIb3DQEBCwUAA4ICAQBQECO3Tw/o
+// SIG // 317Rrd7yadqcswPx1LvIYymkaTN6KcmuRt6HKa0Xe73U
+// SIG // x2/AQ30TfgA9GBJngweRykKBusRzyOU17iIubJvy3gA2
+// SIG // 1dwtqtB0DsoEv1U/ptVu2v++doTCJ/i+GbssVXkgaX8H
+// SIG // +6EOGEmT4evp4GbwR4HwWlc+Dvf8HH8PdUA2Z04CvcwI
+// SIG // fckSipbNm84jxJ8XjmTFTWscldL9edj2NsY6iGnyJFIy
+// SIG // ur2PS7VRYyV3p1VAJp91gj1jRQtWEyCB8P5g9nE3z8u0
+// SIG // ANaU/hjwEQCrdGyravWgnf2JtG+bT26YAokbc8m+32zU
+// SIG // tXRO+NK3tAjhOu2FdsG3qNrF4sc7y37R/C+7Pcb/cFfh
+// SIG // ttqsirepZii4xStcjMODYuXzGm3IJs0b0owHG6oKd7ZO
+// SIG // GvHpmmh9K8/DLriD/sq8bURD10qi/wuW8zM7IpLg1vcR
+// SIG // 9dIK2mc0pj44pc6UX0XbttP/VEJgu3lT2eI9VjWtaKjx
+// SIG // 38xE9woSMyekPRtzTwgfuysF9DkJisr+yA4po/FPxpbB
+// SIG // w9c/hBf32DH/GFxteS2pmjgKIbMP8sDukmEq3lVvuWNJ
+// SIG // sybrZwQvQpvaM49fv+JKpLK5YWYEfwksYRR9wU8Hh/ID
+// SIG // 9hRCEkbUoQ2W7mMpsp2Nbp/kcn4ivfolUy3Q9Yf0scsQ
+// SIG // 6WTLYpm+AoCUJTGCGWIwghleAgEBMFgwQTETMBEGCgmS
+// SIG // JomT8ixkARkWA0dCTDETMBEGCgmSJomT8ixkARkWA0FN
+// SIG // RTEVMBMGA1UEAxMMQU1FIENTIENBIDAxAhM2AAAB33OB
+// SIG // lxa+Mv0NAAIAAAHfMA0GCWCGSAFlAwQCAQUAoIGuMBkG
+// SIG // CSqGSIb3DQEJAzEMBgorBgEEAYI3AgEEMBwGCisGAQQB
+// SIG // gjcCAQsxDjAMBgorBgEEAYI3AgEVMC8GCSqGSIb3DQEJ
+// SIG // BDEiBCC3oAvWj8W35XCGz6mfgvuaIDOaSXvP1W3rFrPd
+// SIG // AOh/bzBCBgorBgEEAYI3AgEMMTQwMqAUgBIATQBpAGMA
+// SIG // cgBvAHMAbwBmAHShGoAYaHR0cDovL3d3dy5taWNyb3Nv
+// SIG // ZnQuY29tMA0GCSqGSIb3DQEBAQUABIIBAH+QbSXUtg4a
+// SIG // 1DpnczlSYMWv9IBjG6D/if62zIqGmL0+uLeJryRfcW1I
+// SIG // AP8F/i8LvWbtodi6cANj2DSmm3tZQ4ynfUkdQTza1zEM
+// SIG // tbZuCZk9w3X+ToN1tfLiWxqWnRQl+RPJ83+OrlP55pAq
+// SIG // Ryg1Mfm6lVs9q3FmhPRyWEaPyH8BDBIDss80A+1Hv5mt
+// SIG // d2fhe8rR+/+bNhdrR9AcAU1eTP4R9x/IZL0ZlxqwMP8h
+// SIG // e/juk00nO5gkakd6+SuHBqNOh4Sak9eBvai/3kU/Pslx
+// SIG // qnn/f1vDjXxx554VyA/0WkKXh1G/4yf1v5JTqNC/etNK
+// SIG // X8AOamhT9a08WNVMC4XQMZmhghcqMIIXJgYKKwYBBAGC
+// SIG // NwMDATGCFxYwghcSBgkqhkiG9w0BBwKgghcDMIIW/wIB
+// SIG // AzEPMA0GCWCGSAFlAwQCAQUAMIIBWQYLKoZIhvcNAQkQ
+// SIG // AQSgggFIBIIBRDCCAUACAQEGCisGAQQBhFkKAwEwMTAN
+// SIG // BglghkgBZQMEAgEFAAQgiRIZEQCbpfMTea7mD6b6LEjM
+// SIG // OeXK5udPpePql6WE5/MCBmXxz4wKeRgTMjAyNDAzMjEx
+// SIG // NTA2MzEuMzEyWjAEgAIB9KCB2KSB1TCB0jELMAkGA1UE
+// SIG // BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNV
+// SIG // BAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBD
+// SIG // b3Jwb3JhdGlvbjEtMCsGA1UECxMkTWljcm9zb2Z0IEly
+// SIG // ZWxhbmQgT3BlcmF0aW9ucyBMaW1pdGVkMSYwJAYDVQQL
+// SIG // Ex1UaGFsZXMgVFNTIEVTTjo4RDQxLTRCRjctQjNCNzEl
+// SIG // MCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2Vy
+// SIG // dmljZaCCEXkwggcnMIIFD6ADAgECAhMzAAAB49+9m5oc
+// SIG // aIMiAAEAAAHjMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNV
+// SIG // BAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYD
+// SIG // VQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQg
+// SIG // Q29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBU
+// SIG // aW1lLVN0YW1wIFBDQSAyMDEwMB4XDTIzMTAxMjE5MDcy
+// SIG // OVoXDTI1MDExMDE5MDcyOVowgdIxCzAJBgNVBAYTAlVT
+// SIG // MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS
+// SIG // ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y
+// SIG // YXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5k
+// SIG // IE9wZXJhdGlvbnMgTGltaXRlZDEmMCQGA1UECxMdVGhh
+// SIG // bGVzIFRTUyBFU046OEQ0MS00QkY3LUIzQjcxJTAjBgNV
+// SIG // BAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2Uw
+// SIG // ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC+
+// SIG // pA1oHkafn8UgVA+jf8rhCaV4IMwXjRuSgfDPQGyFnhKJ
+// SIG // CYDoIZTIPCZqpDbAeFpdTRF0e3C+r5TwrFhizIcqprHE
+// SIG // Lt+v/Idm8ek1ODPHVWRHeleFPpfYKbXvlRfdZDiN+Xzq
+// SIG // ienkAzMEgUOXPRJTxVIo0wO81e2OT0WK0uBS/aePeE4n
+// SIG // QqQRB+TegDubvMDQP4yjveGZH44Lu7CxfElHa3NRkTRJ
+// SIG // NhfdS96cUft9hbLkE2YvIaraxaRDkcW8koIkAT93B+3z
+// SIG // 5XjdTcp4TEX+k+1wtS9D0cisvTGekwVq7th3lor5MSLn
+// SIG // tZy0G/zv59I9kFXeNmX9AK1wf1aueIEPCSL1B9HG78lj
+// SIG // PD6JoRYuqthe4XuN44a8cr59V4tacBzlbGx9umMQyk1s
+// SIG // ZdtIX0C3c8+EVU6PHBUTHUAsZSpEp6HD1qn1f+B+QD0j
+// SIG // 15NK/AnP3DJr2t4OBL7qReBK20jtFDZwkb+1A8ZUhosI
+// SIG // hpJp8ud5qrQGezS3j4RbcH8aegEyKI5fCV469/m50FlA
+// SIG // gwneTmqeeHxnhmFPCsTqIZs+tOAYE9eHt7EVgAaVvqF2
+// SIG // EgshUN0mUN/yzU1W8vRDbLhIdlCECllO5b+3Iawaxwg8
+// SIG // NIzPlsDo2FEu2MTAIWksjmoaW7nQC70VF6UIRCxaDurT
+// SIG // sf+uoc6oI0kzhGN6buOgRQIDAQABo4IBSTCCAUUwHQYD
+// SIG // VR0OBBYEFLGuDWa+NRW3oWfGPnqdptmImKkDMB8GA1Ud
+// SIG // IwQYMBaAFJ+nFV0AXmJdg/Tl0mWnG1M1GelyMF8GA1Ud
+// SIG // HwRYMFYwVKBSoFCGTmh0dHA6Ly93d3cubWljcm9zb2Z0
+// SIG // LmNvbS9wa2lvcHMvY3JsL01pY3Jvc29mdCUyMFRpbWUt
+// SIG // U3RhbXAlMjBQQ0ElMjAyMDEwKDEpLmNybDBsBggrBgEF
+// SIG // BQcBAQRgMF4wXAYIKwYBBQUHMAKGUGh0dHA6Ly93d3cu
+// SIG // bWljcm9zb2Z0LmNvbS9wa2lvcHMvY2VydHMvTWljcm9z
+// SIG // b2Z0JTIwVGltZS1TdGFtcCUyMFBDQSUyMDIwMTAoMSku
+// SIG // Y3J0MAwGA1UdEwEB/wQCMAAwFgYDVR0lAQH/BAwwCgYI
+// SIG // KwYBBQUHAwgwDgYDVR0PAQH/BAQDAgeAMA0GCSqGSIb3
+// SIG // DQEBCwUAA4ICAQC3vpsuqdTTzBFtbe9GvGNoRsY+rIg0
+// SIG // rpRgLOFMZpH88TAInOI9Phkz2x8ZNfd5kNBUT2vXbW0W
+// SIG // 2ns1dBi5BLFFkxhdrT+lrA3Zef5Q+MFEO+gKxTnp3AqS
+// SIG // ubLxNLDtBcoayR2cTCwjnJb3erwCDzpGQGIoQR/0V3Mc
+// SIG // 24pYjgq//98O0RJ7C7jqf+75VyQLBs5iXrAT/9BEasYy
+// SIG // rnT1rgRs/6nUZSbTpeZ7/TWZMi4oOA+YcvadhHNc2qLY
+// SIG // i4h5yfZpbCRHFA4WI/D52JyY47Asb/sic2qNmlB4iEMz
+// SIG // GxavjNPHPLgRH/rN+2G2UO1wBccHthFSQFMKVo5rSd29
+// SIG // 80lkzJhVrpxa9mi5Or1XktLtTMhHxL/tGw5Pjd45rAsG
+// SIG // y5DPRWg4u6th7VJ98+pOwJxE3NvHQLy3/4qKlK1WE8Aa
+// SIG // 20R+F1RRL2iEPou3rA0InFltXQgwPyd8TqAhAlevOtdY
+// SIG // 64mo33VYPKNFqfhQoOQgFLbJYDhbomFC4HMZ6s5Jj9ou
+// SIG // fGRGtK5uC2cphwc7CDFNMjJrlZgJGMW3RA4uV6pWSLqT
+// SIG // 6apg+v3y4w+Lm9EhBLbTqYNJ6dK2vzDQn7/7VYSbc+cI
+// SIG // IhCCl/rOGpGsC32PtesQweuDZtB6BrPxsvNt7pSJuBsq
+// SIG // 1HKTWcZ17xOjmTIyP1dQIEgIPFP4XjFrmU1lVDCCB3Ew
+// SIG // ggVZoAMCAQICEzMAAAAVxedrngKbSZkAAAAAABUwDQYJ
+// SIG // KoZIhvcNAQELBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYD
+// SIG // VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k
+// SIG // MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x
+// SIG // MjAwBgNVBAMTKU1pY3Jvc29mdCBSb290IENlcnRpZmlj
+// SIG // YXRlIEF1dGhvcml0eSAyMDEwMB4XDTIxMDkzMDE4MjIy
+// SIG // NVoXDTMwMDkzMDE4MzIyNVowfDELMAkGA1UEBhMCVVMx
+// SIG // EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl
+// SIG // ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh
+// SIG // dGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3Rh
+// SIG // bXAgUENBIDIwMTAwggIiMA0GCSqGSIb3DQEBAQUAA4IC
+// SIG // DwAwggIKAoICAQDk4aZM57RyIQt5osvXJHm9DtWC0/3u
+// SIG // nAcH0qlsTnXIyjVX9gF/bErg4r25PhdgM/9cT8dm95VT
+// SIG // cVrifkpa/rg2Z4VGIwy1jRPPdzLAEBjoYH1qUoNEt6aO
+// SIG // RmsHFPPFdvWGUNzBRMhxXFExN6AKOG6N7dcP2CZTfDlh
+// SIG // AnrEqv1yaa8dq6z2Nr41JmTamDu6GnszrYBbfowQHJ1S
+// SIG // /rboYiXcag/PXfT+jlPP1uyFVk3v3byNpOORj7I5LFGc
+// SIG // 6XBpDco2LXCOMcg1KL3jtIckw+DJj361VI/c+gVVmG1o
+// SIG // O5pGve2krnopN6zL64NF50ZuyjLVwIYwXE8s4mKyzbni
+// SIG // jYjklqwBSru+cakXW2dg3viSkR4dPf0gz3N9QZpGdc3E
+// SIG // XzTdEonW/aUgfX782Z5F37ZyL9t9X4C626p+Nuw2TPYr
+// SIG // bqgSUei/BQOj0XOmTTd0lBw0gg/wEPK3Rxjtp+iZfD9M
+// SIG // 269ewvPV2HM9Q07BMzlMjgK8QmguEOqEUUbi0b1qGFph
+// SIG // AXPKZ6Je1yh2AuIzGHLXpyDwwvoSCtdjbwzJNmSLW6Cm
+// SIG // gyFdXzB0kZSU2LlQ+QuJYfM2BjUYhEfb3BvR/bLUHMVr
+// SIG // 9lxSUV0S2yW6r1AFemzFER1y7435UsSFF5PAPBXbGjfH
+// SIG // CBUYP3irRbb1Hode2o+eFnJpxq57t7c+auIurQIDAQAB
+// SIG // o4IB3TCCAdkwEgYJKwYBBAGCNxUBBAUCAwEAATAjBgkr
+// SIG // BgEEAYI3FQIEFgQUKqdS/mTEmr6CkTxGNSnPEP8vBO4w
+// SIG // HQYDVR0OBBYEFJ+nFV0AXmJdg/Tl0mWnG1M1GelyMFwG
+// SIG // A1UdIARVMFMwUQYMKwYBBAGCN0yDfQEBMEEwPwYIKwYB
+// SIG // BQUHAgEWM2h0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9w
+// SIG // a2lvcHMvRG9jcy9SZXBvc2l0b3J5Lmh0bTATBgNVHSUE
+// SIG // DDAKBggrBgEFBQcDCDAZBgkrBgEEAYI3FAIEDB4KAFMA
+// SIG // dQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
+// SIG // AwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvX
+// SIG // zpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3Js
+// SIG // Lm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9N
+// SIG // aWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYIKwYB
+// SIG // BQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3
+// SIG // Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0Nl
+// SIG // ckF1dF8yMDEwLTA2LTIzLmNydDANBgkqhkiG9w0BAQsF
+// SIG // AAOCAgEAnVV9/Cqt4SwfZwExJFvhnnJL/Klv6lwUtj5O
+// SIG // R2R4sQaTlz0xM7U518JxNj/aZGx80HU5bbsPMeTCj/ts
+// SIG // 0aGUGCLu6WZnOlNN3Zi6th542DYunKmCVgADsAW+iehp
+// SIG // 4LoJ7nvfam++Kctu2D9IdQHZGN5tggz1bSNU5HhTdSRX
+// SIG // ud2f8449xvNo32X2pFaq95W2KFUn0CS9QKC/GbYSEhFd
+// SIG // PSfgQJY4rPf5KYnDvBewVIVCs/wMnosZiefwC2qBwoEZ
+// SIG // QhlSdYo2wh3DYXMuLGt7bj8sCXgU6ZGyqVvfSaN0DLzs
+// SIG // kYDSPeZKPmY7T7uG+jIa2Zb0j/aRAfbOxnT99kxybxCr
+// SIG // dTDFNLB62FD+CljdQDzHVG2dY3RILLFORy3BFARxv2T5
+// SIG // JL5zbcqOCb2zAVdJVGTZc9d/HltEAY5aGZFrDZ+kKNxn
+// SIG // GSgkujhLmm77IVRrakURR6nxt67I6IleT53S0Ex2tVdU
+// SIG // CbFpAUR+fKFhbHP+CrvsQWY9af3LwUFJfn6Tvsv4O+S3
+// SIG // Fb+0zj6lMVGEvL8CwYKiexcdFYmNcP7ntdAoGokLjzba
+// SIG // ukz5m/8K6TT4JDVnK+ANuOaMmdbhIurwJ0I9JZTmdHRb
+// SIG // atGePu1+oDEzfbzL6Xu/OHBE0ZDxyKs6ijoIYn/ZcGNT
+// SIG // TY3ugm2lBRDBcQZqELQdVTNYs6FwZvKhggLVMIICPgIB
+// SIG // ATCCAQChgdikgdUwgdIxCzAJBgNVBAYTAlVTMRMwEQYD
+// SIG // VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k
+// SIG // MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x
+// SIG // LTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJh
+// SIG // dGlvbnMgTGltaXRlZDEmMCQGA1UECxMdVGhhbGVzIFRT
+// SIG // UyBFU046OEQ0MS00QkY3LUIzQjcxJTAjBgNVBAMTHE1p
+// SIG // Y3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZpY2WiIwoBATAH
+// SIG // BgUrDgMCGgMVAD2Il7vDkUOIbynLhOxitAjoMVp6oIGD
+// SIG // MIGApH4wfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldh
+// SIG // c2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNV
+// SIG // BAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UE
+// SIG // AxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAw
+// SIG // DQYJKoZIhvcNAQEFBQACBQDppi9YMCIYDzIwMjQwMzIx
+// SIG // MTIwMDI0WhgPMjAyNDAzMjIxMjAwMjRaMHUwOwYKKwYB
+// SIG // BAGEWQoEATEtMCswCgIFAOmmL1gCAQAwCAIBAAIDAIr8
+// SIG // MAcCAQACAlsQMAoCBQDpp4DYAgEAMDYGCisGAQQBhFkK
+// SIG // BAIxKDAmMAwGCisGAQQBhFkKAwKgCjAIAgEAAgMHoSCh
+// SIG // CjAIAgEAAgMBhqAwDQYJKoZIhvcNAQEFBQADgYEAXxtC
+// SIG // QhsIs3i3cDZZ0AvijAZ7yDQhh2CWDwAvtI3D/b+TsXTS
+// SIG // gn5GiUcSBQnhgxmQPkW6B7Ad1D7f2x+pmWmlrgCZp7Jn
+// SIG // lvac0WwWSsdLaeVS1mCsVKobp8WZ3X/sto4bV8NQcSQQ
+// SIG // d67rqC2iRkbVM1PSFcT6VmHKRTfcOHatsHQxggQNMIIE
+// SIG // CQIBATCBkzB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMK
+// SIG // V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwG
+// SIG // A1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYD
+// SIG // VQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAx
+// SIG // MAITMwAAAePfvZuaHGiDIgABAAAB4zANBglghkgBZQME
+// SIG // AgEFAKCCAUowGgYJKoZIhvcNAQkDMQ0GCyqGSIb3DQEJ
+// SIG // EAEEMC8GCSqGSIb3DQEJBDEiBCAprdBPDwqal6VpAAOV
+// SIG // i+J92DiJe6lERu9UeZxt4Qn0QzCB+gYLKoZIhvcNAQkQ
+// SIG // Ai8xgeowgecwgeQwgb0EIDPUI6vlsP5k90SBCNa9wha4
+// SIG // MlxBt2Crw12PTHIy5iYqMIGYMIGApH4wfDELMAkGA1UE
+// SIG // BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNV
+// SIG // BAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBD
+// SIG // b3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRp
+// SIG // bWUtU3RhbXAgUENBIDIwMTACEzMAAAHj372bmhxogyIA
+// SIG // AQAAAeMwIgQgfAfgbQHUyCCwG8I1CtfFUY+J5pYJIHw3
+// SIG // 3qm3nzXXMpEwDQYJKoZIhvcNAQELBQAEggIAOQSUw4z9
+// SIG // Dc/eTPbnSMOKo4RhCpQ8rBBnu5MUon6DOIpHS5E+xv/N
+// SIG // /AtZ9HY/VhlH6MmAJgImbvqh9+KopJwEpfOfSyQNALTM
+// SIG // mjgYmGErF53TeYSDPDfN7l3r4Fd3Lu237/L4niMEOKNs
+// SIG // LbBouy6UUKCQ78iKwiKCGMAXq9cVKba7FLiuVKNMXoBB
+// SIG // +imsivm6pU92eg/+/iEzHrTSgWh6nRSWK74mSd9rza8o
+// SIG // Idp/DKUQPOpB+m4dQEB43+ixdXBZ3+yCSZvreiGwR8vR
+// SIG // PfonLWxkcE425RRTLTut4yXaOs5fhDZfY5ho13mgYWAD
+// SIG // KbqIij2ZuvLCMugRFbL2ypMk0xHpA9DSWLuJE25EBe0y
+// SIG // +WPMtjDDC4Vlv9Iao58tZPkFUh0i5br2bu9J+4YPOaI0
+// SIG // mIi/auJA7imf1pm2y6FrDYTbp+0bAR3ePZsKgQm8hgYW
+// SIG // XnJ/I1Mx1NeGTuC0VSMU9/0eFNWzOwdzzGCMxG8pOO34
+// SIG // K9UuDaRgNpoo+RXp1vNa7NnJ3ifiaeHx8V2mEhqX5gig
+// SIG // QTHdGpkqPoKBdu9aLxprB+DPzHkAbb+F0Xd9ElnFU/0Z
+// SIG // VlyVQ8rawejf7dtVFNV+jRX4ET/2qSauKAmweOlncur7
+// SIG // XufbM4VHBBnZyDqQAkK+kwjsQ/2ALvgxlQDYZVfQTsCT
+// SIG // sI4ez1LRm+bvHRs=
+// SIG // End signature block
+
+
+/***/ }),
+
+/***/ "./node_modules/powerbi-router/dist/router.js":
+/*!****************************************************!*\
+ !*** ./node_modules/powerbi-router/dist/router.js ***!
+ \****************************************************/
+/***/ (function(module) {
+
+/*! powerbi-router v0.1.5 | (c) 2016 Microsoft Corporation MIT */
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(true)
+ module.exports = factory();
+ else {}
+})(this, function() {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+/******/
+/******/ // The require function
+/******/ function __nested_webpack_require_617__(moduleId) {
+/******/
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+/******/
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_617__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __nested_webpack_require_617__.m = modules;
+/******/
+/******/ // expose the module cache
+/******/ __nested_webpack_require_617__.c = installedModules;
+/******/
+/******/ // __webpack_public_path__
+/******/ __nested_webpack_require_617__.p = "";
+/******/
+/******/ // Load entry module and return exports
+/******/ return __nested_webpack_require_617__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __nested_webpack_require_1897__) {
+
+ "use strict";
+ var RouteRecognizer = __nested_webpack_require_1897__(1);
+ var Router = (function () {
+ function Router(handlers) {
+ this.handlers = handlers;
+ /**
+ * TODO: look at generating the router dynamically based on list of supported http methods
+ * instead of hardcoding the creation of these and the methods.
+ */
+ this.getRouteRecognizer = new RouteRecognizer();
+ this.patchRouteRecognizer = new RouteRecognizer();
+ this.postRouteRecognizer = new RouteRecognizer();
+ this.putRouteRecognizer = new RouteRecognizer();
+ this.deleteRouteRecognizer = new RouteRecognizer();
+ }
+ Router.prototype.get = function (url, handler) {
+ this.registerHandler(this.getRouteRecognizer, "GET", url, handler);
+ return this;
+ };
+ Router.prototype.patch = function (url, handler) {
+ this.registerHandler(this.patchRouteRecognizer, "PATCH", url, handler);
+ return this;
+ };
+ Router.prototype.post = function (url, handler) {
+ this.registerHandler(this.postRouteRecognizer, "POST", url, handler);
+ return this;
+ };
+ Router.prototype.put = function (url, handler) {
+ this.registerHandler(this.putRouteRecognizer, "PUT", url, handler);
+ return this;
+ };
+ Router.prototype.delete = function (url, handler) {
+ this.registerHandler(this.deleteRouteRecognizer, "DELETE", url, handler);
+ return this;
+ };
+ /**
+ * TODO: This method could use some refactoring. There is conflict of interest between keeping clean separation of test and handle method
+ * Test method only returns boolean indicating if request can be handled, and handle method has opportunity to modify response and return promise of it.
+ * In the case of the router with route-recognizer where handlers are associated with routes, this already guarantees that only one handler is selected and makes the test method feel complicated
+ * Will leave as is an investigate cleaner ways at later time.
+ */
+ Router.prototype.registerHandler = function (routeRecognizer, method, url, handler) {
+ var routeRecognizerHandler = function (request) {
+ var response = new Response();
+ return Promise.resolve(handler(request, response))
+ .then(function (x) { return response; });
+ };
+ routeRecognizer.add([
+ { path: url, handler: routeRecognizerHandler }
]);
var internalHandler = {
test: function (request) {
@@ -4742,7 +6185,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ },
/* 1 */
-/***/ function(module, exports, __webpack_require__) {
+/***/ function(module, exports, __nested_webpack_require_6218__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {(function() {
"use strict";
@@ -5366,8 +6809,8 @@ return /******/ (function(modules) { // webpackBootstrap
var $$route$recognizer$$default = $$route$recognizer$$RouteRecognizer;
/* global define:true module:true window: true */
- if ( true && __webpack_require__(3)['amd']) {
- !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return $$route$recognizer$$default; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
+ if ( true && __nested_webpack_require_6218__(3)['amd']) {
+ !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return $$route$recognizer$$default; }.call(exports, __nested_webpack_require_6218__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof module !== 'undefined' && module['exports']) {
module['exports'] = $$route$recognizer$$default;
} else if (typeof this !== 'undefined') {
@@ -5376,340 +6819,749 @@ return /******/ (function(modules) { // webpackBootstrap
}).call(this);
//# sourceMappingURL=route-recognizer.js.map
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)(module)))
+ /* WEBPACK VAR INJECTION */}.call(exports, __nested_webpack_require_6218__(2)(module)))
+
+/***/ },
+/* 2 */
+/***/ function(module, exports) {
+
+ module.exports = function(module) {
+ if(!module.webpackPolyfill) {
+ module.deprecate = function() {};
+ module.paths = [];
+ // module.parent = undefined by default
+ module.children = [];
+ module.webpackPolyfill = 1;
+ }
+ return module;
+ }
+
+
+/***/ },
+/* 3 */
+/***/ function(module, exports) {
+
+ module.exports = function() { throw new Error("define cannot be used indirect"); };
+
+
+/***/ }
+/******/ ])
+});
+;
+//# sourceMappingURL=router.js.map
+
+/***/ }),
+
+/***/ "./src/FilterBuilders/advancedFilterBuilder.ts":
+/*!*****************************************************!*\
+ !*** ./src/FilterBuilders/advancedFilterBuilder.ts ***!
+ \*****************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.AdvancedFilterBuilder = void 0;
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var filterBuilder_1 = __webpack_require__(/*! ./filterBuilder */ "./src/FilterBuilders/filterBuilder.ts");
+/**
+ * Power BI Advanced filter builder component
+ *
+ * @export
+ * @class AdvancedFilterBuilder
+ * @extends {FilterBuilder}
+ */
+var AdvancedFilterBuilder = /** @class */ (function (_super) {
+ __extends(AdvancedFilterBuilder, _super);
+ function AdvancedFilterBuilder() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.conditions = [];
+ return _this;
+ }
+ /**
+ * Sets And as logical operator for Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().and();
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ AdvancedFilterBuilder.prototype.and = function () {
+ this.logicalOperator = "And";
+ return this;
+ };
+ /**
+ * Sets Or as logical operator for Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().or();
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ AdvancedFilterBuilder.prototype.or = function () {
+ this.logicalOperator = "Or";
+ return this;
+ };
+ /**
+ * Adds a condition in Advanced filter
+ *
+ * ```javascript
+ *
+ * // Add two conditions
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().addCondition("Contains", "Wash").addCondition("Contains", "Park");
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ AdvancedFilterBuilder.prototype.addCondition = function (operator, value) {
+ var condition = {
+ operator: operator,
+ value: value
+ };
+ this.conditions.push(condition);
+ return this;
+ };
+ /**
+ * Creates Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().build();
+ * ```
+ *
+ * @returns {AdvancedFilter}
+ */
+ AdvancedFilterBuilder.prototype.build = function () {
+ var advancedFilter = new powerbi_models_1.AdvancedFilter(this.target, this.logicalOperator, this.conditions);
+ return advancedFilter;
+ };
+ return AdvancedFilterBuilder;
+}(filterBuilder_1.FilterBuilder));
+exports.AdvancedFilterBuilder = AdvancedFilterBuilder;
+
+
+/***/ }),
+
+/***/ "./src/FilterBuilders/basicFilterBuilder.ts":
+/*!**************************************************!*\
+ !*** ./src/FilterBuilders/basicFilterBuilder.ts ***!
+ \**************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.BasicFilterBuilder = void 0;
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var filterBuilder_1 = __webpack_require__(/*! ./filterBuilder */ "./src/FilterBuilders/filterBuilder.ts");
+/**
+ * Power BI Basic filter builder component
+ *
+ * @export
+ * @class BasicFilterBuilder
+ * @extends {FilterBuilder}
+ */
+var BasicFilterBuilder = /** @class */ (function (_super) {
+ __extends(BasicFilterBuilder, _super);
+ function BasicFilterBuilder() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.isRequireSingleSelection = false;
+ return _this;
+ }
+ /**
+ * Sets In as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().in([values]);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ BasicFilterBuilder.prototype.in = function (values) {
+ this.operator = "In";
+ this.values = values;
+ return this;
+ };
+ /**
+ * Sets NotIn as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().notIn([values]);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ BasicFilterBuilder.prototype.notIn = function (values) {
+ this.operator = "NotIn";
+ this.values = values;
+ return this;
+ };
+ /**
+ * Sets All as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().all();
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ BasicFilterBuilder.prototype.all = function () {
+ this.operator = "All";
+ this.values = [];
+ return this;
+ };
+ /**
+ * Sets required single selection property for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().requireSingleSelection(isRequireSingleSelection);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ BasicFilterBuilder.prototype.requireSingleSelection = function (isRequireSingleSelection) {
+ if (isRequireSingleSelection === void 0) { isRequireSingleSelection = false; }
+ this.isRequireSingleSelection = isRequireSingleSelection;
+ return this;
+ };
+ /**
+ * Creates Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().build();
+ * ```
+ *
+ * @returns {BasicFilter}
+ */
+ BasicFilterBuilder.prototype.build = function () {
+ var basicFilter = new powerbi_models_1.BasicFilter(this.target, this.operator, this.values);
+ basicFilter.requireSingleSelection = this.isRequireSingleSelection;
+ return basicFilter;
+ };
+ return BasicFilterBuilder;
+}(filterBuilder_1.FilterBuilder));
+exports.BasicFilterBuilder = BasicFilterBuilder;
-/***/ },
-/* 2 */
-/***/ function(module, exports) {
- module.exports = function(module) {
- if(!module.webpackPolyfill) {
- module.deprecate = function() {};
- module.paths = [];
- // module.parent = undefined by default
- module.children = [];
- module.webpackPolyfill = 1;
- }
- return module;
- }
+/***/ }),
+/***/ "./src/FilterBuilders/filterBuilder.ts":
+/*!*********************************************!*\
+ !*** ./src/FilterBuilders/filterBuilder.ts ***!
+ \*********************************************/
+/***/ ((__unused_webpack_module, exports) => {
-/***/ },
-/* 3 */
-/***/ function(module, exports) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.FilterBuilder = void 0;
+/**
+ * Generic filter builder for BasicFilter, AdvancedFilter, RelativeDate, RelativeTime and TopN
+ *
+ * @class
+ */
+var FilterBuilder = /** @class */ (function () {
+ function FilterBuilder() {
+ }
+ /**
+ * Sets target property for filter with target object
+ *
+ * ```javascript
+ * const target = {
+ * table: 'table1',
+ * column: 'column1'
+ * };
+ *
+ * const filterBuilder = new FilterBuilder().withTargetObject(target);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ FilterBuilder.prototype.withTargetObject = function (target) {
+ this.target = target;
+ return this;
+ };
+ /**
+ * Sets target property for filter with column target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withColumnTarget(tableName, columnName);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ FilterBuilder.prototype.withColumnTarget = function (tableName, columnName) {
+ this.target = { table: tableName, column: columnName };
+ return this;
+ };
+ /**
+ * Sets target property for filter with measure target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withMeasureTarget(tableName, measure);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ FilterBuilder.prototype.withMeasureTarget = function (tableName, measure) {
+ this.target = { table: tableName, measure: measure };
+ return this;
+ };
+ /**
+ * Sets target property for filter with hierarchy level target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withHierarchyLevelTarget(tableName, hierarchy, hierarchyLevel);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ FilterBuilder.prototype.withHierarchyLevelTarget = function (tableName, hierarchy, hierarchyLevel) {
+ this.target = { table: tableName, hierarchy: hierarchy, hierarchyLevel: hierarchyLevel };
+ return this;
+ };
+ /**
+ * Sets target property for filter with column aggregation target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withColumnAggregation(tableName, columnName, aggregationFunction);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ FilterBuilder.prototype.withColumnAggregation = function (tableName, columnName, aggregationFunction) {
+ this.target = { table: tableName, column: columnName, aggregationFunction: aggregationFunction };
+ return this;
+ };
+ /**
+ * Sets target property for filter with hierarchy level aggregation target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withHierarchyLevelAggregationTarget(tableName, hierarchy, hierarchyLevel, aggregationFunction);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ FilterBuilder.prototype.withHierarchyLevelAggregationTarget = function (tableName, hierarchy, hierarchyLevel, aggregationFunction) {
+ this.target = { table: tableName, hierarchy: hierarchy, hierarchyLevel: hierarchyLevel, aggregationFunction: aggregationFunction };
+ return this;
+ };
+ return FilterBuilder;
+}());
+exports.FilterBuilder = FilterBuilder;
- module.exports = function() { throw new Error("define cannot be used indirect"); };
+/***/ }),
+
+/***/ "./src/FilterBuilders/index.ts":
+/*!*************************************!*\
+ !*** ./src/FilterBuilders/index.ts ***!
+ \*************************************/
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.RelativeTimeFilterBuilder = exports.RelativeDateFilterBuilder = exports.TopNFilterBuilder = exports.AdvancedFilterBuilder = exports.BasicFilterBuilder = void 0;
+var basicFilterBuilder_1 = __webpack_require__(/*! ./basicFilterBuilder */ "./src/FilterBuilders/basicFilterBuilder.ts");
+Object.defineProperty(exports, "BasicFilterBuilder", ({ enumerable: true, get: function () { return basicFilterBuilder_1.BasicFilterBuilder; } }));
+var advancedFilterBuilder_1 = __webpack_require__(/*! ./advancedFilterBuilder */ "./src/FilterBuilders/advancedFilterBuilder.ts");
+Object.defineProperty(exports, "AdvancedFilterBuilder", ({ enumerable: true, get: function () { return advancedFilterBuilder_1.AdvancedFilterBuilder; } }));
+var topNFilterBuilder_1 = __webpack_require__(/*! ./topNFilterBuilder */ "./src/FilterBuilders/topNFilterBuilder.ts");
+Object.defineProperty(exports, "TopNFilterBuilder", ({ enumerable: true, get: function () { return topNFilterBuilder_1.TopNFilterBuilder; } }));
+var relativeDateFilterBuilder_1 = __webpack_require__(/*! ./relativeDateFilterBuilder */ "./src/FilterBuilders/relativeDateFilterBuilder.ts");
+Object.defineProperty(exports, "RelativeDateFilterBuilder", ({ enumerable: true, get: function () { return relativeDateFilterBuilder_1.RelativeDateFilterBuilder; } }));
+var relativeTimeFilterBuilder_1 = __webpack_require__(/*! ./relativeTimeFilterBuilder */ "./src/FilterBuilders/relativeTimeFilterBuilder.ts");
+Object.defineProperty(exports, "RelativeTimeFilterBuilder", ({ enumerable: true, get: function () { return relativeTimeFilterBuilder_1.RelativeTimeFilterBuilder; } }));
-/***/ }
-/******/ ])
-});
-;
-//# sourceMappingURL=router.js.map
/***/ }),
-/***/ "./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js":
-/*!*******************************************************************************!*\
- !*** ./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js ***!
- \*******************************************************************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ "./src/FilterBuilders/relativeDateFilterBuilder.ts":
+/*!*********************************************************!*\
+ !*** ./src/FilterBuilders/relativeDateFilterBuilder.ts ***!
+ \*********************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-/*! window-post-message-proxy v0.2.6 | (c) 2016 Microsoft Corporation MIT */
-(function webpackUniversalModuleDefinition(root, factory) {
- if(true)
- module.exports = factory();
- else {}
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-/******/
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ (function(module, exports) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.RelativeDateFilterBuilder = void 0;
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var filterBuilder_1 = __webpack_require__(/*! ./filterBuilder */ "./src/FilterBuilders/filterBuilder.ts");
+/**
+ * Power BI Relative Date filter builder component
+ *
+ * @export
+ * @class RelativeDateFilterBuilder
+ * @extends {FilterBuilder}
+ */
+var RelativeDateFilterBuilder = /** @class */ (function (_super) {
+ __extends(RelativeDateFilterBuilder, _super);
+ function RelativeDateFilterBuilder() {
+ var _this = _super !== null && _super.apply(this, arguments) || this;
+ _this.isTodayIncluded = true;
+ return _this;
+ }
+ /**
+ * Sets inLast as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inLast(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ RelativeDateFilterBuilder.prototype.inLast = function (timeUnitsCount, timeUnitType) {
+ this.operator = powerbi_models_1.RelativeDateOperators.InLast;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ };
+ /**
+ * Sets inThis as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inThis(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ RelativeDateFilterBuilder.prototype.inThis = function (timeUnitsCount, timeUnitType) {
+ this.operator = powerbi_models_1.RelativeDateOperators.InThis;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ };
+ /**
+ * Sets inNext as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inNext(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ RelativeDateFilterBuilder.prototype.inNext = function (timeUnitsCount, timeUnitType) {
+ this.operator = powerbi_models_1.RelativeDateOperators.InNext;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ };
+ /**
+ * Sets includeToday for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().includeToday(includeToday);
+ * ```
+ *
+ * @param {boolean} includeToday - Denotes if today is included or not
+ * @returns {RelativeDateFilterBuilder}
+ */
+ RelativeDateFilterBuilder.prototype.includeToday = function (includeToday) {
+ this.isTodayIncluded = includeToday;
+ return this;
+ };
+ /**
+ * Creates Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().build();
+ * ```
+ *
+ * @returns {RelativeDateFilter}
+ */
+ RelativeDateFilterBuilder.prototype.build = function () {
+ var relativeDateFilter = new powerbi_models_1.RelativeDateFilter(this.target, this.operator, this.timeUnitsCount, this.timeUnitType, this.isTodayIncluded);
+ return relativeDateFilter;
+ };
+ return RelativeDateFilterBuilder;
+}(filterBuilder_1.FilterBuilder));
+exports.RelativeDateFilterBuilder = RelativeDateFilterBuilder;
+
+
+/***/ }),
+
+/***/ "./src/FilterBuilders/relativeTimeFilterBuilder.ts":
+/*!*********************************************************!*\
+ !*** ./src/FilterBuilders/relativeTimeFilterBuilder.ts ***!
+ \*********************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.RelativeTimeFilterBuilder = void 0;
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var filterBuilder_1 = __webpack_require__(/*! ./filterBuilder */ "./src/FilterBuilders/filterBuilder.ts");
+/**
+ * Power BI Relative Time filter builder component
+ *
+ * @export
+ * @class RelativeTimeFilterBuilder
+ * @extends {FilterBuilder}
+ */
+var RelativeTimeFilterBuilder = /** @class */ (function (_super) {
+ __extends(RelativeTimeFilterBuilder, _super);
+ function RelativeTimeFilterBuilder() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /**
+ * Sets inLast as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inLast(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ RelativeTimeFilterBuilder.prototype.inLast = function (timeUnitsCount, timeUnitType) {
+ this.operator = powerbi_models_1.RelativeDateOperators.InLast;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ };
+ /**
+ * Sets inThis as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inThis(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ RelativeTimeFilterBuilder.prototype.inThis = function (timeUnitsCount, timeUnitType) {
+ this.operator = powerbi_models_1.RelativeDateOperators.InThis;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ };
+ /**
+ * Sets inNext as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inNext(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ RelativeTimeFilterBuilder.prototype.inNext = function (timeUnitsCount, timeUnitType) {
+ this.operator = powerbi_models_1.RelativeDateOperators.InNext;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ };
+ /**
+ * Creates Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().build();
+ * ```
+ *
+ * @returns {RelativeTimeFilter}
+ */
+ RelativeTimeFilterBuilder.prototype.build = function () {
+ var relativeTimeFilter = new powerbi_models_1.RelativeTimeFilter(this.target, this.operator, this.timeUnitsCount, this.timeUnitType);
+ return relativeTimeFilter;
+ };
+ return RelativeTimeFilterBuilder;
+}(filterBuilder_1.FilterBuilder));
+exports.RelativeTimeFilterBuilder = RelativeTimeFilterBuilder;
- "use strict";
- var WindowPostMessageProxy = (function () {
- function WindowPostMessageProxy(options) {
- var _this = this;
- if (options === void 0) { options = {
- processTrackingProperties: {
- addTrackingProperties: WindowPostMessageProxy.defaultAddTrackingProperties,
- getTrackingProperties: WindowPostMessageProxy.defaultGetTrackingProperties
- },
- isErrorMessage: WindowPostMessageProxy.defaultIsErrorMessage,
- receiveWindow: window,
- name: WindowPostMessageProxy.createRandomString()
- }; }
- this.pendingRequestPromises = {};
- // save options with defaults
- this.addTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.addTrackingProperties) || WindowPostMessageProxy.defaultAddTrackingProperties;
- this.getTrackingProperties = (options.processTrackingProperties && options.processTrackingProperties.getTrackingProperties) || WindowPostMessageProxy.defaultGetTrackingProperties;
- this.isErrorMessage = options.isErrorMessage || WindowPostMessageProxy.defaultIsErrorMessage;
- this.receiveWindow = options.receiveWindow || window;
- this.name = options.name || WindowPostMessageProxy.createRandomString();
- this.logMessages = options.logMessages || false;
- this.eventSourceOverrideWindow = options.eventSourceOverrideWindow;
- this.suppressWarnings = options.suppressWarnings || false;
- if (this.logMessages) {
- console.log("new WindowPostMessageProxy created with name: " + this.name + " receiving on window: " + this.receiveWindow.document.title);
- }
- // Initialize
- this.handlers = [];
- this.windowMessageHandler = function (event) { return _this.onMessageReceived(event); };
- this.start();
- }
- // Static
- WindowPostMessageProxy.defaultAddTrackingProperties = function (message, trackingProperties) {
- message[WindowPostMessageProxy.messagePropertyName] = trackingProperties;
- return message;
- };
- WindowPostMessageProxy.defaultGetTrackingProperties = function (message) {
- return message[WindowPostMessageProxy.messagePropertyName];
- };
- WindowPostMessageProxy.defaultIsErrorMessage = function (message) {
- return !!message.error;
- };
- /**
- * Utility to create a deferred object.
- */
- // TODO: Look to use RSVP library instead of doing this manually.
- // From what I searched RSVP would work better because it has .finally and .deferred; however, it doesn't have Typings information.
- WindowPostMessageProxy.createDeferred = function () {
- var deferred = {
- resolve: null,
- reject: null,
- promise: null
- };
- var promise = new Promise(function (resolve, reject) {
- deferred.resolve = resolve;
- deferred.reject = reject;
- });
- deferred.promise = promise;
- return deferred;
- };
- /**
- * Utility to generate random sequence of characters used as tracking id for promises.
- */
- WindowPostMessageProxy.createRandomString = function () {
- // window.msCrypto for IE
- var cryptoObj = window.crypto || window.msCrypto;
- var randomValueArray = new Uint32Array(1);
- cryptoObj.getRandomValues(randomValueArray);
- return randomValueArray[0].toString(36).substring(1);
- };
- /**
- * Adds handler.
- * If the first handler whose test method returns true will handle the message and provide a response.
- */
- WindowPostMessageProxy.prototype.addHandler = function (handler) {
- this.handlers.push(handler);
- };
- /**
- * Removes handler.
- * The reference must match the original object that was provided when adding the handler.
- */
- WindowPostMessageProxy.prototype.removeHandler = function (handler) {
- var handlerIndex = this.handlers.indexOf(handler);
- if (handlerIndex === -1) {
- throw new Error("You attempted to remove a handler but no matching handler was found.");
- }
- this.handlers.splice(handlerIndex, 1);
- };
- /**
- * Start listening to message events.
- */
- WindowPostMessageProxy.prototype.start = function () {
- this.receiveWindow.addEventListener('message', this.windowMessageHandler);
- };
- /**
- * Stops listening to message events.
- */
- WindowPostMessageProxy.prototype.stop = function () {
- this.receiveWindow.removeEventListener('message', this.windowMessageHandler);
- };
- /**
- * Post message to target window with tracking properties added and save deferred object referenced by tracking id.
- */
- WindowPostMessageProxy.prototype.postMessage = function (targetWindow, message) {
- // Add tracking properties to indicate message came from this proxy
- var trackingProperties = { id: WindowPostMessageProxy.createRandomString() };
- this.addTrackingProperties(message, trackingProperties);
- if (this.logMessages) {
- console.log(this.name + " Posting message:");
- console.log(JSON.stringify(message, null, ' '));
- }
- targetWindow.postMessage(message, "*");
- var deferred = WindowPostMessageProxy.createDeferred();
- this.pendingRequestPromises[trackingProperties.id] = deferred;
- return deferred.promise;
- };
- /**
- * Send response message to target window.
- * Response messages re-use tracking properties from a previous request message.
- */
- WindowPostMessageProxy.prototype.sendResponse = function (targetWindow, message, trackingProperties) {
- this.addTrackingProperties(message, trackingProperties);
- if (this.logMessages) {
- console.log(this.name + " Sending response:");
- console.log(JSON.stringify(message, null, ' '));
- }
- targetWindow.postMessage(message, "*");
- };
- /**
- * Message handler.
- */
- WindowPostMessageProxy.prototype.onMessageReceived = function (event) {
- var _this = this;
- if (this.logMessages) {
- console.log(this.name + " Received message:");
- console.log("type: " + event.type);
- console.log(JSON.stringify(event.data, null, ' '));
- }
- var sendingWindow = this.eventSourceOverrideWindow || event.source;
- var message = event.data;
- if (typeof message !== "object") {
- if (!this.suppressWarnings) {
- console.warn("Proxy(" + this.name + "): Received message that was not an object. Discarding message");
- }
- return;
- }
- var trackingProperties;
- try {
- trackingProperties = this.getTrackingProperties(message);
- }
- catch (e) {
- if (!this.suppressWarnings) {
- console.warn("Proxy(" + this.name + "): Error occurred when attempting to get tracking properties from incoming message:", JSON.stringify(message, null, ' '), "Error: ", e);
- }
- }
- var deferred;
- if (trackingProperties) {
- deferred = this.pendingRequestPromises[trackingProperties.id];
- }
- // If message does not have a known ID, treat it as a request
- // Otherwise, treat message as response
- if (!deferred) {
- var handled = this.handlers.some(function (handler) {
- var canMessageBeHandled = false;
- try {
- canMessageBeHandled = handler.test(message);
- }
- catch (e) {
- if (!_this.suppressWarnings) {
- console.warn("Proxy(" + _this.name + "): Error occurred when handler was testing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e);
- }
- }
- if (canMessageBeHandled) {
- var responseMessagePromise = void 0;
- try {
- responseMessagePromise = Promise.resolve(handler.handle(message));
- }
- catch (e) {
- if (!_this.suppressWarnings) {
- console.warn("Proxy(" + _this.name + "): Error occurred when handler was processing incoming message:", JSON.stringify(message, null, ' '), "Error: ", e);
- }
- responseMessagePromise = Promise.resolve();
- }
- responseMessagePromise
- .then(function (responseMessage) {
- if (!responseMessage) {
- var warningMessage = "Handler for message: " + JSON.stringify(message, null, ' ') + " did not return a response message. The default response message will be returned instead.";
- if (!_this.suppressWarnings) {
- console.warn("Proxy(" + _this.name + "): " + warningMessage);
- }
- responseMessage = {
- warning: warningMessage
- };
- }
- _this.sendResponse(sendingWindow, responseMessage, trackingProperties);
- });
- return true;
- }
- });
- /**
- * TODO: Consider returning an error message if nothing handled the message.
- * In the case of the Report receiving messages all of them should be handled,
- * however, in the case of the SDK receiving messages it's likely it won't register handlers
- * for all events. Perhaps make this an option at construction time.
- */
- if (!handled && !this.suppressWarnings) {
- console.warn("Proxy(" + this.name + ") did not handle message. Handlers: " + this.handlers.length + " Message: " + JSON.stringify(message, null, '') + ".");
- }
- }
- else {
- /**
- * If error message reject promise,
- * Otherwise, resolve promise
- */
- var isErrorMessage = true;
- try {
- isErrorMessage = this.isErrorMessage(message);
- }
- catch (e) {
- console.warn("Proxy(" + this.name + ") Error occurred when trying to determine if message is consider an error response. Message: ", JSON.stringify(message, null, ''), 'Error: ', e);
- }
- if (isErrorMessage) {
- deferred.reject(message);
- }
- else {
- deferred.resolve(message);
- }
- // TODO: Move to .finally clause up where promise is created for better maitenance like original proxy code.
- delete this.pendingRequestPromises[trackingProperties.id];
- }
- };
- WindowPostMessageProxy.messagePropertyName = "windowPostMessageProxy";
- return WindowPostMessageProxy;
- }());
- exports.WindowPostMessageProxy = WindowPostMessageProxy;
+/***/ }),
+
+/***/ "./src/FilterBuilders/topNFilterBuilder.ts":
+/*!*************************************************!*\
+ !*** ./src/FilterBuilders/topNFilterBuilder.ts ***!
+ \*************************************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.TopNFilterBuilder = void 0;
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var filterBuilder_1 = __webpack_require__(/*! ./filterBuilder */ "./src/FilterBuilders/filterBuilder.ts");
+/**
+ * Power BI Top N filter builder component
+ *
+ * @export
+ * @class TopNFilterBuilder
+ * @extends {FilterBuilder}
+ */
+var TopNFilterBuilder = /** @class */ (function (_super) {
+ __extends(TopNFilterBuilder, _super);
+ function TopNFilterBuilder() {
+ return _super !== null && _super.apply(this, arguments) || this;
+ }
+ /**
+ * Sets Top as operator for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().top(itemCount);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ TopNFilterBuilder.prototype.top = function (itemCount) {
+ this.operator = "Top";
+ this.itemCount = itemCount;
+ return this;
+ };
+ /**
+ * Sets Bottom as operator for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().bottom(itemCount);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ TopNFilterBuilder.prototype.bottom = function (itemCount) {
+ this.operator = "Bottom";
+ this.itemCount = itemCount;
+ return this;
+ };
+ /**
+ * Sets order by for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().orderByTarget(target);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ TopNFilterBuilder.prototype.orderByTarget = function (target) {
+ this.orderByTargetValue = target;
+ return this;
+ };
+ /**
+ * Creates Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().build();
+ * ```
+ *
+ * @returns {TopNFilter}
+ */
+ TopNFilterBuilder.prototype.build = function () {
+ var topNFilter = new powerbi_models_1.TopNFilter(this.target, this.operator, this.itemCount, this.orderByTargetValue);
+ return topNFilter;
+ };
+ return TopNFilterBuilder;
+}(filterBuilder_1.FilterBuilder));
+exports.TopNFilterBuilder = TopNFilterBuilder;
-/***/ })
-/******/ ])
-});
-;
-//# sourceMappingURL=windowPostMessageProxy.js.map
/***/ }),
@@ -5717,9 +7569,10 @@ return /******/ (function(modules) { // webpackBootstrap
/*!*********************************!*\
!*** ./src/bookmarksManager.ts ***!
\*********************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -5756,10 +7609,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.BookmarksManager = void 0;
-var utils = __webpack_require__(/*! ./util */ "./src/util.ts");
-var errors = __webpack_require__(/*! ./errors */ "./src/errors.ts");
+var util_1 = __webpack_require__(/*! ./util */ "./src/util.ts");
+var errors_1 = __webpack_require__(/*! ./errors */ "./src/errors.ts");
/**
* Manages report bookmarks.
*
@@ -5787,7 +7640,7 @@ var BookmarksManager = /** @class */ (function () {
* });
* ```
*
- * @returns {Promise}
+ * @returns {Promise}
*/
BookmarksManager.prototype.getBookmarks = function () {
return __awaiter(this, void 0, void 0, function () {
@@ -5795,8 +7648,8 @@ var BookmarksManager = /** @class */ (function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (utils.isRDLEmbed(this.config.embedUrl)) {
- return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)];
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
_a.label = 1;
case 1:
@@ -5829,8 +7682,8 @@ var BookmarksManager = /** @class */ (function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (utils.isRDLEmbed(this.config.embedUrl)) {
- return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)];
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
request = {
name: bookmarkName
@@ -5853,10 +7706,10 @@ var BookmarksManager = /** @class */ (function () {
*
* ```javascript
* // Enter presentation mode.
- * bookmarksManager.play(models.BookmarksPlayMode.Presentation)
+ * bookmarksManager.play(BookmarksPlayMode.Presentation)
* ```
*
- * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off`
+ * @param {BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off`
* @returns {Promise>}
*/
BookmarksManager.prototype.play = function (playMode) {
@@ -5865,8 +7718,8 @@ var BookmarksManager = /** @class */ (function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (utils.isRDLEmbed(this.config.embedUrl)) {
- return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)];
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
playBookmarkRequest = {
playMode: playMode
@@ -5891,8 +7744,8 @@ var BookmarksManager = /** @class */ (function () {
* bookmarksManager.capture(options)
* ```
*
- * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing
- * @returns {Promise}
+ * @param {ICaptureBookmarkOptions} [options] Options for bookmark capturing
+ * @returns {Promise}
*/
BookmarksManager.prototype.capture = function (options) {
return __awaiter(this, void 0, void 0, function () {
@@ -5900,8 +7753,8 @@ var BookmarksManager = /** @class */ (function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (utils.isRDLEmbed(this.config.embedUrl)) {
- return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)];
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
request = {
options: options || {}
@@ -5937,8 +7790,8 @@ var BookmarksManager = /** @class */ (function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (utils.isRDLEmbed(this.config.embedUrl)) {
- return [2 /*return*/, Promise.reject(errors.APINotSupportedForRDLError)];
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
request = {
state: state
@@ -5967,16 +7820,17 @@ exports.BookmarksManager = BookmarksManager;
/*!***********************!*\
!*** ./src/config.ts ***!
\***********************/
-/*! no static exports found */
-/***/ (function(module, exports) {
+/***/ ((__unused_webpack_module, exports) => {
-Object.defineProperty(exports, "__esModule", { value: true });
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
/** @ignore */ /** */
var config = {
- version: '2.17.1',
+ version: '2.23.1',
type: 'js'
};
-exports.default = config;
+exports["default"] = config;
/***/ }),
@@ -5985,9 +7839,10 @@ exports.default = config;
/*!***********************!*\
!*** ./src/create.ts ***!
\***********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
@@ -5996,6 +7851,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -6037,17 +7894,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Create = void 0;
-var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
-var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts");
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
var utils = __webpack_require__(/*! ./util */ "./src/util.ts");
/**
* A Power BI Report creator component
*
* @export
* @class Create
- * @extends {embed.Embed}
+ * @extends {Embed}
*/
var Create = /** @class */ (function (_super) {
__extends(Create, _super);
@@ -6073,7 +7930,7 @@ var Create = /** @class */ (function (_super) {
* Validate create report configuration.
*/
Create.prototype.validate = function (config) {
- return models.validateCreateReport(config);
+ return (0, powerbi_models_1.validateCreateReport)(config);
};
/**
* Handle config changes.
@@ -6141,8 +7998,53 @@ var Create = /** @class */ (function (_super) {
}
return datasetId;
};
+ /**
+ * Sends create configuration data.
+ *
+ * ```javascript
+ * create ({
+ * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55',
+ * accessToken: 'eyJ0eXA ... TaE2rTSbmg',
+ * ```
+ *
+ * @hidden
+ * @returns {Promise}
+ */
+ Create.prototype.create = function () {
+ var _a;
+ return __awaiter(this, void 0, void 0, function () {
+ var errors, headers, response, response_1;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ errors = (0, powerbi_models_1.validateCreateReport)(this.createConfig);
+ if (errors) {
+ throw errors;
+ }
+ _b.label = 1;
+ case 1:
+ _b.trys.push([1, 3, , 4]);
+ headers = {
+ uid: this.config.uniqueId,
+ sdkSessionId: this.service.getSdkSessionId()
+ };
+ if (!!((_a = this.eventHooks) === null || _a === void 0 ? void 0 : _a.accessTokenProvider)) {
+ headers.tokenProviderSupplied = true;
+ }
+ return [4 /*yield*/, this.service.hpm.post("/report/create", this.createConfig, headers, this.iframe.contentWindow)];
+ case 2:
+ response = _b.sent();
+ return [2 /*return*/, response.body];
+ case 3:
+ response_1 = _b.sent();
+ throw response_1.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
return Create;
-}(embed.Embed));
+}(embed_1.Embed));
exports.Create = Create;
@@ -6152,9 +8054,10 @@ exports.Create = Create;
/*!**************************!*\
!*** ./src/dashboard.ts ***!
\**************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
@@ -6163,21 +8066,23 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Dashboard = void 0;
-var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts");
-var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
/**
* A Power BI Dashboard embed component
*
* @export
* @class Dashboard
- * @extends {embed.Embed}
+ * @extends {Embed}
* @implements {IDashboardNode}
*/
var Dashboard = /** @class */ (function (_super) {
@@ -6201,6 +8106,7 @@ var Dashboard = /** @class */ (function (_super) {
* E.g. https://powerbi-df.analysis-df.windows.net/dashboardEmbedHost?dashboardId=e9363c62-edb6-4eac-92d3-2199c5ca2a9e
*
* By extracting the id we can ensure id is always explicitly provided as part of the load configuration.
+ *
* @hidden
* @static
* @param {string} url
@@ -6224,7 +8130,7 @@ var Dashboard = /** @class */ (function (_super) {
var config = this.config;
var dashboardId = config.id || this.element.getAttribute(Dashboard.dashboardIdAttribute) || Dashboard.findIdFromEmbedUrl(config.embedUrl);
if (typeof dashboardId !== 'string' || dashboardId.length === 0) {
- throw new Error("Dashboard id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Dashboard.dashboardIdAttribute + "'.");
+ throw new Error("Dashboard id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '".concat(Dashboard.dashboardIdAttribute, "'."));
}
return dashboardId;
};
@@ -6235,11 +8141,12 @@ var Dashboard = /** @class */ (function (_super) {
*/
Dashboard.prototype.validate = function (baseConfig) {
var config = baseConfig;
- var error = models.validateDashboardLoad(config);
- return error ? error : this.ValidatePageView(config.pageView);
+ var error = (0, powerbi_models_1.validateDashboardLoad)(config);
+ return error ? error : this.validatePageView(config.pageView);
};
/**
* Handle config changes.
+ *
* @hidden
* @returns {void}
*/
@@ -6258,10 +8165,11 @@ var Dashboard = /** @class */ (function (_super) {
return "dashboardEmbed";
};
/**
- * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in models.PageView
+ * Validate that pageView has a legal value: if page view is defined it must have one of the values defined in PageView
+ *
* @hidden
*/
- Dashboard.prototype.ValidatePageView = function (pageView) {
+ Dashboard.prototype.validatePageView = function (pageView) {
if (pageView && pageView !== "fitToWidth" && pageView !== "oneColumn" && pageView !== "actualSize") {
return [{ message: "pageView must be one of the followings: fitToWidth, oneColumn, actualSize" }];
}
@@ -6275,7 +8183,7 @@ var Dashboard = /** @class */ (function (_super) {
/** @hidden */
Dashboard.type = "Dashboard";
return Dashboard;
-}(embed.Embed));
+}(embed_1.Embed));
exports.Dashboard = Dashboard;
@@ -6285,9 +8193,10 @@ exports.Dashboard = Dashboard;
/*!**********************!*\
!*** ./src/embed.ts ***!
\**********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -6324,12 +8233,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Embed = void 0;
-var utils = __webpack_require__(/*! ./util */ "./src/util.ts");
-var sdkConfig = __webpack_require__(/*! ./config */ "./src/config.ts");
var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var sdkConfig = __webpack_require__(/*! ./config */ "./src/config.ts");
var errors_1 = __webpack_require__(/*! ./errors */ "./src/errors.ts");
+var util_1 = __webpack_require__(/*! ./util */ "./src/util.ts");
/**
* Base class for all Power BI embed components
*
@@ -6353,7 +8262,7 @@ var Embed = /** @class */ (function () {
function Embed(service, element, config, iframe, phasedRender, isBootstrap) {
/** @hidden */
this.allowedEvents = [];
- if (utils.autoAuthInEmbedUrl(config.embedUrl)) {
+ if ((0, util_1.autoAuthInEmbedUrl)(config.embedUrl)) {
throw new Error(errors_1.EmbedUrlNotSupported);
}
Array.prototype.push.apply(this.allowedEvents, Embed.allowedEvents);
@@ -6363,50 +8272,24 @@ var Embed = /** @class */ (function () {
this.iframe = iframe;
this.iframeLoaded = false;
this.embedtype = config.type.toLowerCase();
+ this.commands = [];
+ this.groups = [];
this.populateConfig(config, isBootstrap);
- if (this.embedtype === 'create') {
- this.setIframe(false /*set EventListener to call create() on 'load' event*/, phasedRender, isBootstrap);
+ if ((0, util_1.isCreate)(this.embedtype)) {
+ this.setIframe(false /* set EventListener to call create() on 'load' event*/, phasedRender, isBootstrap);
}
else {
- this.setIframe(true /*set EventListener to call load() on 'load' event*/, phasedRender, isBootstrap);
+ this.setIframe(true /* set EventListener to call load() on 'load' event*/, phasedRender, isBootstrap);
}
}
/**
- * Sends createReport configuration data.
+ * Create is not supported by default
*
- * ```javascript
- * createReport({
- * datasetId: '5dac7a4a-4452-46b3-99f6-a25915e0fe55',
- * accessToken: 'eyJ0eXA ... TaE2rTSbmg',
- * ```
* @hidden
- * @param {models.IReportCreateConfiguration} config
* @returns {Promise}
*/
- Embed.prototype.createReport = function (config) {
- return __awaiter(this, void 0, void 0, function () {
- var errors, response, response_1;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- errors = models.validateCreateReport(config);
- if (errors) {
- throw errors;
- }
- _a.label = 1;
- case 1:
- _a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.service.hpm.post("/report/create", config, { uid: this.config.uniqueId, sdkSessionId: this.service.getSdkSessionId() }, this.iframe.contentWindow)];
- case 2:
- response = _a.sent();
- return [2 /*return*/, response.body];
- case 3:
- response_1 = _a.sent();
- throw response_1.body;
- case 4: return [2 /*return*/];
- }
- });
- });
+ Embed.prototype.create = function () {
+ throw new Error("no create support");
};
/**
* Saves Report.
@@ -6415,7 +8298,7 @@ var Embed = /** @class */ (function () {
*/
Embed.prototype.save = function () {
return __awaiter(this, void 0, void 0, function () {
- var response, response_2;
+ var response, response_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@@ -6425,8 +8308,8 @@ var Embed = /** @class */ (function () {
response = _a.sent();
return [2 /*return*/, response.body];
case 2:
- response_2 = _a.sent();
- throw response_2.body;
+ response_1 = _a.sent();
+ throw response_1.body;
case 3: return [2 /*return*/];
}
});
@@ -6439,7 +8322,7 @@ var Embed = /** @class */ (function () {
*/
Embed.prototype.saveAs = function (saveAsParameters) {
return __awaiter(this, void 0, void 0, function () {
- var response, response_3;
+ var response, response_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@@ -6449,8 +8332,8 @@ var Embed = /** @class */ (function () {
response = _a.sent();
return [2 /*return*/, response.body];
case 2:
- response_3 = _a.sent();
- throw response_3.body;
+ response_2 = _a.sent();
+ throw response_2.body;
case 3: return [2 /*return*/];
}
});
@@ -6471,7 +8354,7 @@ var Embed = /** @class */ (function () {
*/
Embed.prototype.getCorrelationId = function () {
return __awaiter(this, void 0, void 0, function () {
- var response, response_4;
+ var response, response_3;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@@ -6481,8 +8364,8 @@ var Embed = /** @class */ (function () {
response = _a.sent();
return [2 /*return*/, response.body];
case 2:
- response_4 = _a.sent();
- throw response_4.body;
+ response_3 = _a.sent();
+ throw response_3.body;
case 3: return [2 /*return*/];
}
});
@@ -6508,16 +8391,18 @@ var Embed = /** @class */ (function () {
* })
* .catch(error => { ... });
* ```
+ *
* @hidden
* @param {models.ILoadConfiguration} config
* @param {boolean} phasedRender
* @returns {Promise}
*/
Embed.prototype.load = function (phasedRender) {
- return __awaiter(this, void 0, void 0, function () {
- var path, headers, timeNow, response, response_5;
- return __generator(this, function (_a) {
- switch (_a.label) {
+ var _a;
+ return __awaiter(this, void 0, void 0, function () {
+ var path, headers, timeNow, response, response_4;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
case 0:
if (!this.config.accessToken) {
console.debug("Power BI SDK iframe is loaded but powerbi.embed is not called yet.");
@@ -6534,22 +8419,25 @@ var Embed = /** @class */ (function () {
bootstrapped: this.config.bootstrapped,
sdkVersion: sdkConfig.default.version
};
+ if (!!((_a = this.eventHooks) === null || _a === void 0 ? void 0 : _a.accessTokenProvider)) {
+ headers.tokenProviderSupplied = true;
+ }
timeNow = new Date();
- if (this.lastLoadRequest && utils.getTimeDiffInMilliseconds(this.lastLoadRequest, timeNow) < 100) {
+ if (this.lastLoadRequest && (0, util_1.getTimeDiffInMilliseconds)(this.lastLoadRequest, timeNow) < 100) {
console.debug("Power BI SDK sent more than two /report/load requests in the last 100ms interval.");
return [2 /*return*/];
}
this.lastLoadRequest = timeNow;
- _a.label = 1;
+ _b.label = 1;
case 1:
- _a.trys.push([1, 3, , 4]);
+ _b.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.service.hpm.post(path, this.config, headers, this.iframe.contentWindow)];
case 2:
- response = _a.sent();
+ response = _b.sent();
return [2 /*return*/, response.body];
case 3:
- response_5 = _a.sent();
- throw response_5.body;
+ response_4 = _b.sent();
+ throw response_4.body;
case 4: return [2 /*return*/];
}
});
@@ -6574,13 +8462,13 @@ var Embed = /** @class */ (function () {
*
* @template T
* @param {string} eventName
- * @param {service.IEventHandler} [handler]
+ * @param {IEventHandler} [handler]
*/
Embed.prototype.off = function (eventName, handler) {
var _this = this;
var fakeEvent = { name: eventName, type: null, id: null, value: null };
if (handler) {
- utils.remove(function (eventHandler) { return eventHandler.test(fakeEvent) && (eventHandler.handle === handler); }, this.eventHandlers);
+ (0, util_1.remove)(function (eventHandler) { return eventHandler.test(fakeEvent) && (eventHandler.handle === handler); }, this.eventHandlers);
this.element.removeEventListener(eventName, handler);
}
else {
@@ -6588,7 +8476,7 @@ var Embed = /** @class */ (function () {
.filter(function (eventHandler) { return eventHandler.test(fakeEvent); });
eventHandlersToRemove
.forEach(function (eventHandlerToRemove) {
- utils.remove(function (eventHandler) { return eventHandler === eventHandlerToRemove; }, _this.eventHandlers);
+ (0, util_1.remove)(function (eventHandler) { return eventHandler === eventHandlerToRemove; }, _this.eventHandlers);
_this.element.removeEventListener(eventName, eventHandlerToRemove.handle);
});
}
@@ -6608,7 +8496,7 @@ var Embed = /** @class */ (function () {
*/
Embed.prototype.on = function (eventName, handler) {
if (this.allowedEvents.indexOf(eventName) === -1) {
- throw new Error("eventName must be one of " + this.allowedEvents + ". You passed: " + eventName);
+ throw new Error("eventName must be one of ".concat(this.allowedEvents, ". You passed: ").concat(eventName));
}
this.eventHandlers.push({
test: function (event) { return event.name === eventName; },
@@ -6641,12 +8529,15 @@ var Embed = /** @class */ (function () {
*/
Embed.prototype.setAccessToken = function (accessToken) {
return __awaiter(this, void 0, void 0, function () {
- var embedType, response, response_6;
+ var embedType, response, response_5;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
+ if (!accessToken) {
+ throw new Error("Access token cannot be empty");
+ }
embedType = this.config.type;
- embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna') ? 'report' : embedType;
+ embedType = (embedType === 'create' || embedType === 'visual' || embedType === 'qna' || embedType === 'quickCreate') ? 'report' : embedType;
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
@@ -6658,8 +8549,8 @@ var Embed = /** @class */ (function () {
this.service.accessToken = accessToken;
return [2 /*return*/, response.body];
case 3:
- response_6 = _a.sent();
- throw response_6.body;
+ response_5 = _a.sent();
+ throw response_5.body;
case 4: return [2 /*return*/];
}
});
@@ -6676,7 +8567,7 @@ var Embed = /** @class */ (function () {
Embed.prototype.getAccessToken = function (globalAccessToken) {
var accessToken = this.config.accessToken || this.element.getAttribute(Embed.accessTokenAttribute) || globalAccessToken;
if (!accessToken) {
- throw new Error("No access token was found for element. You must specify an access token directly on the element using attribute '" + Embed.accessTokenAttribute + "' or specify a global token at: powerbi.accessToken.");
+ throw new Error("No access token was found for element. You must specify an access token directly on the element using attribute '".concat(Embed.accessTokenAttribute, "' or specify a global token at: powerbi.accessToken."));
}
return accessToken;
};
@@ -6688,20 +8579,34 @@ var Embed = /** @class */ (function () {
* @returns {void}
*/
Embed.prototype.populateConfig = function (config, isBootstrap) {
+ var _this = this;
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
if (this.bootstrapConfig) {
- this.config = utils.assign({}, this.bootstrapConfig, config);
+ this.config = (0, util_1.assign)({}, this.bootstrapConfig, config);
// reset bootstrapConfig because we do not want to merge it in re-embed scenario.
this.bootstrapConfig = null;
}
else {
// Copy config - important for multiple iframe scenario.
// Otherwise, if a user uses the same config twice, same unique Id which will be used in different iframes.
- this.config = utils.assign({}, config);
+ this.config = (0, util_1.assign)({}, config);
}
this.config.embedUrl = this.getEmbedUrl(isBootstrap);
this.config.groupId = this.getGroupId();
this.addLocaleToEmbedUrl(config);
this.config.uniqueId = this.getUniqueId();
+ var extensions = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? void 0 : _b.extensions;
+ this.commands = (_c = extensions === null || extensions === void 0 ? void 0 : extensions.commands) !== null && _c !== void 0 ? _c : [];
+ this.groups = (_d = extensions === null || extensions === void 0 ? void 0 : extensions.groups) !== null && _d !== void 0 ? _d : [];
+ this.initialLayoutType = (_g = (_f = (_e = this.config) === null || _e === void 0 ? void 0 : _e.settings) === null || _f === void 0 ? void 0 : _f.layoutType) !== null && _g !== void 0 ? _g : models.LayoutType.Master;
+ // Adding commands in extensions array to this.commands
+ var extensionsArray = (_j = (_h = this.config) === null || _h === void 0 ? void 0 : _h.settings) === null || _j === void 0 ? void 0 : _j.extensions;
+ if (Array.isArray(extensionsArray)) {
+ this.commands = [];
+ extensionsArray.map(function (extension) { if (extension === null || extension === void 0 ? void 0 : extension.command) {
+ _this.commands.push(extension.command);
+ } });
+ }
if (isBootstrap) {
// save current config in bootstrapConfig to be able to merge it on next call to powerbi.embed
this.bootstrapConfig = this.config;
@@ -6710,8 +8615,41 @@ var Embed = /** @class */ (function () {
else {
this.config.accessToken = this.getAccessToken(this.service.accessToken);
}
+ this.eventHooks = this.config.eventHooks;
+ this.validateEventHooks(this.eventHooks);
+ delete this.config.eventHooks;
this.configChanged(isBootstrap);
};
+ /**
+ * Validate EventHooks
+ *
+ * @private
+ * @param {models.EventHooks} eventHooks
+ * @hidden
+ */
+ Embed.prototype.validateEventHooks = function (eventHooks) {
+ if (!eventHooks) {
+ return;
+ }
+ for (var key in eventHooks) {
+ if (eventHooks.hasOwnProperty(key) && typeof eventHooks[key] !== 'function') {
+ throw new Error(key + " must be a function");
+ }
+ }
+ var applicationContextProvider = eventHooks.applicationContextProvider;
+ if (!!applicationContextProvider) {
+ if (this.embedtype.toLowerCase() !== "report") {
+ throw new Error("applicationContextProvider is only supported in report embed");
+ }
+ this.config.embedUrl = (0, util_1.addParamToUrl)(this.config.embedUrl, "registerQueryCallback", "true");
+ }
+ var accessTokenProvider = eventHooks.accessTokenProvider;
+ if (!!accessTokenProvider) {
+ if ((['create', 'quickcreate', 'report'].indexOf(this.embedtype.toLowerCase()) === -1) || this.config.tokenType !== models.TokenType.Aad) {
+ throw new Error("accessTokenProvider is only supported in report SaaS embed");
+ }
+ }
+ };
/**
* Adds locale parameters to embedUrl
*
@@ -6725,10 +8663,10 @@ var Embed = /** @class */ (function () {
}
var localeSettings = config.settings.localeSettings;
if (localeSettings && localeSettings.language) {
- this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'language', localeSettings.language);
+ this.config.embedUrl = (0, util_1.addParamToUrl)(this.config.embedUrl, 'language', localeSettings.language);
}
if (localeSettings && localeSettings.formatLocale) {
- this.config.embedUrl = utils.addParamToUrl(this.config.embedUrl, 'formatLocale', localeSettings.formatLocale);
+ this.config.embedUrl = (0, util_1.addParamToUrl)(this.config.embedUrl, 'formatLocale', localeSettings.formatLocale);
}
};
/**
@@ -6745,7 +8683,7 @@ var Embed = /** @class */ (function () {
embedUrl = this.getDefaultEmbedUrl(this.config.hostname);
}
if (typeof embedUrl !== 'string' || embedUrl.length === 0) {
- throw new Error("Embed Url is required, but it was not found. You must provide an embed url either as part of embed configuration or as attribute '" + Embed.embedUrlAttribute + "'.");
+ throw new Error("Embed Url is required, but it was not found. You must provide an embed url either as part of embed configuration or as attribute '".concat(Embed.embedUrlAttribute, "'."));
}
return embedUrl;
};
@@ -6759,13 +8697,10 @@ var Embed = /** @class */ (function () {
var endpoint = this.getDefaultEmbedUrlEndpoint();
// Trim spaces to fix user mistakes.
hostname = hostname.toLowerCase().trim();
- if (hostname.indexOf("http://") === 0) {
- throw new Error("HTTP is not allowed. HTTPS is required");
- }
if (hostname.indexOf("https://") === 0) {
- return hostname + "/" + endpoint;
+ return "".concat(hostname, "/").concat(endpoint);
}
- return "https://" + hostname + "/" + endpoint;
+ return "https://".concat(hostname, "/").concat(endpoint);
};
/**
* Gets a unique ID from the first available location: options, attribute.
@@ -6776,7 +8711,7 @@ var Embed = /** @class */ (function () {
* @hidden
*/
Embed.prototype.getUniqueId = function () {
- return this.config.uniqueId || this.element.getAttribute(Embed.nameAttribute) || utils.createRandomString();
+ return this.config.uniqueId || this.element.getAttribute(Embed.nameAttribute) || (0, util_1.createRandomString)();
};
/**
* Gets the group ID from the first available location: options, embeddedUrl.
@@ -6820,13 +8755,17 @@ var Embed = /** @class */ (function () {
};
/**
* Sets Iframe for embed
+ *
* @hidden
*/
Embed.prototype.setIframe = function (isLoad, phasedRender, isBootstrap) {
var _this = this;
if (!this.iframe) {
var iframeContent = document.createElement("iframe");
- var embedUrl = this.config.uniqueId ? utils.addParamToUrl(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl;
+ var embedUrl = this.config.uniqueId ? (0, util_1.addParamToUrl)(this.config.embedUrl, 'uid', this.config.uniqueId) : this.config.embedUrl;
+ if (!(0, util_1.validateEmbedUrl)(embedUrl)) {
+ throw new Error(errors_1.invalidEmbedUrlErrorMessage);
+ }
iframeContent.style.width = '100%';
iframeContent.style.height = '100%';
iframeContent.setAttribute("src", embedUrl);
@@ -6860,7 +8799,7 @@ var Embed = /** @class */ (function () {
}
}
else {
- this.iframe.addEventListener('load', function () { return _this.createReport(_this.createConfig); }, false);
+ this.iframe.addEventListener('load', function () { return _this.create(); }, false);
}
};
/**
@@ -6889,7 +8828,7 @@ var Embed = /** @class */ (function () {
/**
* Removes element's tabindex attribute
*/
- Embed.prototype.removeComponentTabIndex = function (tabIndex) {
+ Embed.prototype.removeComponentTabIndex = function (_tabIndex) {
if (!this.element) {
return;
}
@@ -6915,11 +8854,12 @@ var Embed = /** @class */ (function () {
};
/**
* Sends the config for front load calls, after 'ready' message is received from the iframe
+ *
* @hidden
*/
Embed.prototype.frontLoadSendConfig = function (config) {
return __awaiter(this, void 0, void 0, function () {
- var errors, response, response_7;
+ var errors, response, response_6;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@@ -6931,8 +8871,9 @@ var Embed = /** @class */ (function () {
throw errors;
}
// contentWindow must be initialized
- if (this.iframe.contentWindow == null)
+ if (this.iframe.contentWindow == null) {
return [2 /*return*/];
+ }
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
@@ -6941,15 +8882,15 @@ var Embed = /** @class */ (function () {
response = _a.sent();
return [2 /*return*/, response.body];
case 3:
- response_7 = _a.sent();
- throw response_7.body;
+ response_6 = _a.sent();
+ throw response_6.body;
case 4: return [2 /*return*/];
}
});
});
};
/** @hidden */
- Embed.allowedEvents = ["loaded", "saved", "rendered", "saveAsTriggered", "error", "dataSelected", "buttonClicked"];
+ Embed.allowedEvents = ["loaded", "saved", "rendered", "saveAsTriggered", "error", "dataSelected", "buttonClicked", "info"];
/** @hidden */
Embed.accessTokenAttribute = 'powerbi-access-token';
/** @hidden */
@@ -6973,13 +8914,15 @@ exports.Embed = Embed;
/*!***********************!*\
!*** ./src/errors.ts ***!
\***********************/
-/*! no static exports found */
-/***/ (function(module, exports) {
+/***/ ((__unused_webpack_module, exports) => {
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.EmbedUrlNotSupported = exports.APINotSupportedForRDLError = void 0;
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.invalidEmbedUrlErrorMessage = exports.EmbedUrlNotSupported = exports.APINotSupportedForRDLError = void 0;
exports.APINotSupportedForRDLError = "This API is currently not supported for RDL reports";
exports.EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL";
+exports.invalidEmbedUrlErrorMessage = "Invalid embed URL detected. Either URL hostname or protocol are invalid. Please use Power BI REST APIs to get the valid URL";
/***/ }),
@@ -6988,31 +8931,36 @@ exports.EmbedUrlNotSupported = "Embed URL is invalid for this scenario. Please u
/*!**************************!*\
!*** ./src/factories.ts ***!
\**************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-Object.defineProperty(exports, "__esModule", { value: true });
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.routerFactory = exports.wpmpFactory = exports.hpmFactory = void 0;
+/**
+ * TODO: Need to find better place for these factory functions or refactor how we handle dependency injection
+ */
+var window_post_message_proxy_1 = __webpack_require__(/*! window-post-message-proxy */ "./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js");
+var http_post_message_1 = __webpack_require__(/*! http-post-message */ "./node_modules/http-post-message/dist/httpPostMessage.js");
+var powerbi_router_1 = __webpack_require__(/*! powerbi-router */ "./node_modules/powerbi-router/dist/router.js");
var config_1 = __webpack_require__(/*! ./config */ "./src/config.ts");
-var wpmp = __webpack_require__(/*! window-post-message-proxy */ "./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js");
-var hpm = __webpack_require__(/*! http-post-message */ "./node_modules/http-post-message/dist/httpPostMessage.js");
-var router = __webpack_require__(/*! powerbi-router */ "./node_modules/powerbi-router/dist/router.js");
-var hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType) {
+var hpmFactory = function (wpmp, defaultTargetWindow, sdkVersion, sdkType, sdkWrapperVersion) {
if (sdkVersion === void 0) { sdkVersion = config_1.default.version; }
if (sdkType === void 0) { sdkType = config_1.default.type; }
- return new hpm.HttpPostMessage(wpmp, {
+ return new http_post_message_1.HttpPostMessage(wpmp, {
'x-sdk-type': sdkType,
- 'x-sdk-version': sdkVersion
+ 'x-sdk-version': sdkVersion,
+ 'x-sdk-wrapper-version': sdkWrapperVersion,
}, defaultTargetWindow);
};
exports.hpmFactory = hpmFactory;
var wpmpFactory = function (name, logMessages, eventSourceOverrideWindow) {
- return new wpmp.WindowPostMessageProxy({
+ return new window_post_message_proxy_1.WindowPostMessageProxy({
processTrackingProperties: {
- addTrackingProperties: hpm.HttpPostMessage.addTrackingProperties,
- getTrackingProperties: hpm.HttpPostMessage.getTrackingProperties,
+ addTrackingProperties: http_post_message_1.HttpPostMessage.addTrackingProperties,
+ getTrackingProperties: http_post_message_1.HttpPostMessage.getTrackingProperties,
},
- isErrorMessage: hpm.HttpPostMessage.isErrorMessage,
+ isErrorMessage: http_post_message_1.HttpPostMessage.isErrorMessage,
suppressWarnings: true,
name: name,
logMessages: logMessages,
@@ -7021,7 +8969,7 @@ var wpmpFactory = function (name, logMessages, eventSourceOverrideWindow) {
};
exports.wpmpFactory = wpmpFactory;
var routerFactory = function (wpmp) {
- return new router.Router(wpmp);
+ return new powerbi_router_1.Router(wpmp);
};
exports.routerFactory = routerFactory;
@@ -7032,9 +8980,10 @@ exports.routerFactory = routerFactory;
/*!*********************!*\
!*** ./src/page.ts ***!
\*********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -7071,7 +9020,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Page = void 0;
var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts");
@@ -7096,15 +9045,51 @@ var Page = /** @class */ (function () {
* @param {SectionVisibility} [visibility]
* @hidden
*/
- function Page(report, name, displayName, isActivePage, visibility, defaultSize, defaultDisplayOption) {
+ function Page(report, name, displayName, isActivePage, visibility, defaultSize, defaultDisplayOption, mobileSize, background, wallpaper) {
this.report = report;
this.name = name;
this.displayName = displayName;
this.isActive = isActivePage;
this.visibility = visibility;
this.defaultSize = defaultSize;
+ this.mobileSize = mobileSize;
this.defaultDisplayOption = defaultDisplayOption;
+ this.background = background;
+ this.wallpaper = wallpaper;
}
+ /**
+ * Get insights for report page
+ *
+ * ```javascript
+ * page.getSmartNarrativeInsights();
+ * ```
+ *
+ * @returns {Promise}
+ */
+ Page.prototype.getSmartNarrativeInsights = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, response_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.report.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.report.service.hpm.get("/report/pages/".concat(this.name, "/smartNarrativeInsights"), { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ return [2 /*return*/, response.body];
+ case 3:
+ response_1 = _a.sent();
+ throw response_1.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
/**
* Gets all page level filters within the report.
*
@@ -7117,18 +9102,18 @@ var Page = /** @class */ (function () {
*/
Page.prototype.getFilters = function () {
return __awaiter(this, void 0, void 0, function () {
- var response, response_1;
+ var response, response_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/filters", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.report.service.hpm.get("/report/pages/".concat(this.name, "/filters"), { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
case 1:
response = _a.sent();
return [2 /*return*/, response.body];
case 2:
- response_1 = _a.sent();
- throw response_1.body;
+ response_2 = _a.sent();
+ throw response_2.body;
case 3: return [2 /*return*/];
}
});
@@ -7147,7 +9132,7 @@ var Page = /** @class */ (function () {
*/
Page.prototype.updateFilters = function (operation, filters) {
return __awaiter(this, void 0, void 0, function () {
- var updateFiltersRequest, response_2;
+ var updateFiltersRequest, response_3;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@@ -7158,11 +9143,11 @@ var Page = /** @class */ (function () {
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.report.service.hpm.post("/report/pages/" + this.name + "/filters", updateFiltersRequest, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.report.service.hpm.post("/report/pages/".concat(this.name, "/filters"), updateFiltersRequest, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
case 2: return [2 /*return*/, _a.sent()];
case 3:
- response_2 = _a.sent();
- throw response_2.body;
+ response_3 = _a.sent();
+ throw response_3.body;
case 4: return [2 /*return*/];
}
});
@@ -7188,158 +9173,332 @@ var Page = /** @class */ (function () {
});
};
/**
- * Sets all filters on the current page.
+ * Sets all filters on the current page.
+ *
+ * ```javascript
+ * page.setFilters(filters)
+ * .catch(errors => { ... });
+ * ```
+ *
+ * @param {(IFilter[])} filters
+ * @returns {Promise>}
+ */
+ Page.prototype.setFilters = function (filters) {
+ return __awaiter(this, void 0, void 0, function () {
+ var response_4;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, 2, , 3]);
+ return [4 /*yield*/, this.report.service.hpm.put("/report/pages/".concat(this.name, "/filters"), filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ case 1: return [2 /*return*/, _a.sent()];
+ case 2:
+ response_4 = _a.sent();
+ throw response_4.body;
+ case 3: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Delete the page from the report
+ *
+ * ```javascript
+ * // Delete the page from the report
+ * page.delete();
+ * ```
+ *
+ * @returns {Promise}
+ */
+ Page.prototype.delete = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, response_5;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, 2, , 3]);
+ return [4 /*yield*/, this.report.service.hpm.delete("/report/pages/".concat(this.name), {}, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ case 1:
+ response = _a.sent();
+ return [2 /*return*/, response.body];
+ case 2:
+ response_5 = _a.sent();
+ throw response_5.body;
+ case 3: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Makes the current page the active page of the report.
+ *
+ * ```javascript
+ * page.setActive();
+ * ```
+ *
+ * @returns {Promise>}
+ */
+ Page.prototype.setActive = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var page, response_6;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ page = {
+ name: this.name,
+ displayName: null,
+ isActive: true
+ };
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ case 2: return [2 /*return*/, _a.sent()];
+ case 3:
+ response_6 = _a.sent();
+ throw response_6.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Set displayName to the current page.
+ *
+ * ```javascript
+ * page.setName(displayName);
+ * ```
+ *
+ * @returns {Promise>}
+ */
+ Page.prototype.setDisplayName = function (displayName) {
+ return __awaiter(this, void 0, void 0, function () {
+ var page, response_7;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ page = {
+ name: this.name,
+ displayName: displayName,
+ };
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.report.service.hpm.put("/report/pages/".concat(this.name, "/name"), page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ case 2: return [2 /*return*/, _a.sent()];
+ case 3:
+ response_7 = _a.sent();
+ throw response_7.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Gets all the visuals on the page.
+ *
+ * ```javascript
+ * page.getVisuals()
+ * .then(visuals => { ... });
+ * ```
+ *
+ * @returns {Promise}
+ */
+ Page.prototype.getVisuals = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, response_8;
+ var _this = this;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.report.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.report.service.hpm.get("/report/pages/".concat(this.name, "/visuals"), { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ return [2 /*return*/, response.body
+ .map(function (visual) { return new visualDescriptor_1.VisualDescriptor(_this, visual.name, visual.title, visual.type, visual.layout); })];
+ case 3:
+ response_8 = _a.sent();
+ throw response_8.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Gets a visual by name on the page.
+ *
+ * ```javascript
+ * page.getVisualByName(visualName: string)
+ * .then(visual => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {string} visualName
+ * @returns {Promise}
+ */
+ Page.prototype.getVisualByName = function (visualName) {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, visual, response_9;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.report.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.report.service.hpm.get("/report/pages/".concat(this.name, "/visuals"), { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ visual = response.body.find(function (v) { return v.name === visualName; });
+ if (!visual) {
+ return [2 /*return*/, Promise.reject(powerbi_models_1.CommonErrorCodes.NotFound)];
+ }
+ return [2 /*return*/, new visualDescriptor_1.VisualDescriptor(this, visual.name, visual.title, visual.type, visual.layout)];
+ case 3:
+ response_9 = _a.sent();
+ throw response_9.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Updates the display state of a visual in a page.
*
* ```javascript
- * page.setFilters(filters)
- * .catch(errors => { ... });
+ * page.setVisualDisplayState(visualName, displayState)
+ * .catch(error => { ... });
* ```
*
- * @param {(IFilter[])} filters
+ * @param {string} visualName
+ * @param {VisualContainerDisplayMode} displayState
* @returns {Promise>}
*/
- Page.prototype.setFilters = function (filters) {
+ Page.prototype.setVisualDisplayState = function (visualName, displayState) {
return __awaiter(this, void 0, void 0, function () {
- var response_3;
+ var pageName, report;
return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- _a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.report.service.hpm.put("/report/pages/" + this.name + "/filters", filters, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
- case 1: return [2 /*return*/, _a.sent()];
- case 2:
- response_3 = _a.sent();
- throw response_3.body;
- case 3: return [2 /*return*/];
- }
+ pageName = this.name;
+ report = this.report;
+ return [2 /*return*/, report.setVisualDisplayState(pageName, visualName, displayState)];
});
});
};
/**
- * Delete the page from the report
+ * Updates the position of a visual in a page.
*
* ```javascript
- * // Delete the page from the report
- * page.delete();
+ * page.moveVisual(visualName, x, y, z)
+ * .catch(error => { ... });
* ```
*
- * @returns {Promise}
+ * @param {string} visualName
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ * @returns {Promise>}
*/
- Page.prototype.delete = function () {
+ Page.prototype.moveVisual = function (visualName, x, y, z) {
return __awaiter(this, void 0, void 0, function () {
- var response, response_4;
+ var pageName, report;
return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- _a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.report.service.hpm.delete("/report/pages/" + this.name, {}, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
- case 1:
- response = _a.sent();
- return [2 /*return*/, response.body];
- case 2:
- response_4 = _a.sent();
- throw response_4.body;
- case 3: return [2 /*return*/];
- }
+ pageName = this.name;
+ report = this.report;
+ return [2 /*return*/, report.moveVisual(pageName, visualName, x, y, z)];
});
});
};
/**
- * Makes the current page the active page of the report.
+ * Resize a visual in a page.
*
* ```javascript
- * page.setActive();
+ * page.resizeVisual(visualName, width, height)
+ * .catch(error => { ... });
* ```
*
+ * @param {string} visualName
+ * @param {number} width
+ * @param {number} height
* @returns {Promise>}
*/
- Page.prototype.setActive = function () {
+ Page.prototype.resizeVisual = function (visualName, width, height) {
return __awaiter(this, void 0, void 0, function () {
- var page, response_5;
+ var pageName, report;
return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- page = {
- name: this.name,
- displayName: null,
- isActive: true
- };
- _a.label = 1;
- case 1:
- _a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.report.service.hpm.put('/report/pages/active', page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
- case 2: return [2 /*return*/, _a.sent()];
- case 3:
- response_5 = _a.sent();
- throw response_5.body;
- case 4: return [2 /*return*/];
- }
+ pageName = this.name;
+ report = this.report;
+ return [2 /*return*/, report.resizeVisual(pageName, visualName, width, height)];
});
});
};
/**
- * Set displayName to the current page.
+ * Updates the size of active page.
*
* ```javascript
- * page.setName(displayName);
+ * page.resizePage(pageSizeType, width, height)
+ * .catch(error => { ... });
* ```
*
+ * @param {PageSizeType} pageSizeType
+ * @param {number} width
+ * @param {number} height
* @returns {Promise>}
*/
- Page.prototype.setDisplayName = function (displayName) {
+ Page.prototype.resizePage = function (pageSizeType, width, height) {
return __awaiter(this, void 0, void 0, function () {
- var page, response_6;
+ var report;
return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- page = {
- name: this.name,
- displayName: displayName,
- };
- _a.label = 1;
- case 1:
- _a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.report.service.hpm.put("/report/pages/" + this.name + "/name", page, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
- case 2: return [2 /*return*/, _a.sent()];
- case 3:
- response_6 = _a.sent();
- throw response_6.body;
- case 4: return [2 /*return*/];
+ if (!this.isActive) {
+ return [2 /*return*/, Promise.reject('Cannot resize the page. Only the active page can be resized')];
}
+ report = this.report;
+ return [2 /*return*/, report.resizeActivePage(pageSizeType, width, height)];
});
});
};
/**
- * Gets all the visuals on the page.
+ * Gets the list of slicer visuals on the page.
*
* ```javascript
- * page.getVisuals()
- * .then(visuals => { ... });
+ * page.getSlicers()
+ * .then(slicers => {
+ * ...
+ * });
* ```
*
- * @returns {Promise}
+ * @returns {Promise}
*/
- Page.prototype.getVisuals = function () {
+ Page.prototype.getSlicers = function () {
return __awaiter(this, void 0, void 0, function () {
- var response, response_7;
+ var response, response_10;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.report.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.report.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/visuals", { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.report.service.hpm.get("/report/pages/".concat(this.name, "/visuals"), { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
case 2:
response = _a.sent();
return [2 /*return*/, response.body
+ .filter(function (visual) { return visual.type === 'slicer'; })
.map(function (visual) { return new visualDescriptor_1.VisualDescriptor(_this, visual.name, visual.title, visual.type, visual.layout); })];
case 3:
- response_7 = _a.sent();
- throw response_7.body;
+ response_10 = _a.sent();
+ throw response_10.body;
case 4: return [2 /*return*/];
}
});
@@ -7357,24 +9516,24 @@ var Page = /** @class */ (function () {
*/
Page.prototype.hasLayout = function (layoutType) {
return __awaiter(this, void 0, void 0, function () {
- var layoutTypeEnum, response, response_8;
+ var layoutTypeEnum, response, response_11;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.report.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.report.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
layoutTypeEnum = powerbi_models_1.LayoutType[layoutType];
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.report.service.hpm.get("/report/pages/" + this.name + "/layoutTypes/" + layoutTypeEnum, { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.report.service.hpm.get("/report/pages/".concat(this.name, "/layoutTypes/").concat(layoutTypeEnum), { uid: this.report.config.uniqueId }, this.report.iframe.contentWindow)];
case 2:
response = _a.sent();
return [2 /*return*/, response.body];
case 3:
- response_8 = _a.sent();
- throw response_8.body;
+ response_11 = _a.sent();
+ throw response_11.body;
case 4: return [2 /*return*/];
}
});
@@ -7385,60 +9544,16 @@ var Page = /** @class */ (function () {
exports.Page = Page;
-/***/ }),
-
-/***/ "./src/powerbi-client.ts":
-/*!*******************************!*\
- !*** ./src/powerbi-client.ts ***!
- \*******************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
-
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.VisualDescriptor = exports.Visual = exports.Qna = exports.Page = exports.Embed = exports.Tile = exports.Dashboard = exports.Report = exports.models = exports.factories = exports.service = void 0;
-/**
- * @hidden
- */
-var service = __webpack_require__(/*! ./service */ "./src/service.ts");
-exports.service = service;
-var factories = __webpack_require__(/*! ./factories */ "./src/factories.ts");
-exports.factories = factories;
-var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
-exports.models = models;
-var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts");
-Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } });
-var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts");
-Object.defineProperty(exports, "Dashboard", { enumerable: true, get: function () { return dashboard_1.Dashboard; } });
-var tile_1 = __webpack_require__(/*! ./tile */ "./src/tile.ts");
-Object.defineProperty(exports, "Tile", { enumerable: true, get: function () { return tile_1.Tile; } });
-var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
-Object.defineProperty(exports, "Embed", { enumerable: true, get: function () { return embed_1.Embed; } });
-var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts");
-Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return page_1.Page; } });
-var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts");
-Object.defineProperty(exports, "Qna", { enumerable: true, get: function () { return qna_1.Qna; } });
-var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts");
-Object.defineProperty(exports, "Visual", { enumerable: true, get: function () { return visual_1.Visual; } });
-var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts");
-Object.defineProperty(exports, "VisualDescriptor", { enumerable: true, get: function () { return visualDescriptor_1.VisualDescriptor; } });
-/**
- * Makes Power BI available to the global object for use in applications that don't have module loading support.
- *
- * Note: create an instance of the class with the default configuration for normal usage, or save the class so that you can create an instance of the service.
- */
-var powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory);
-window.powerbi = powerbi;
-
-
/***/ }),
/***/ "./src/qna.ts":
/*!********************!*\
!*** ./src/qna.ts ***!
\********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
@@ -7447,6 +9562,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -7488,10 +9605,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Qna = void 0;
-var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
-var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts");
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
/**
* The Power BI Q&A embed component
*
@@ -7552,7 +9669,7 @@ var Qna = /** @class */ (function (_super) {
*
* @returns {void}
*/
- Qna.prototype.configChanged = function (isBootstrap) {
+ Qna.prototype.configChanged = function (_isBootstrap) {
// Nothing to do in Q&A embed.
};
/**
@@ -7566,26 +9683,216 @@ var Qna = /** @class */ (function (_super) {
* Validate load configuration.
*/
Qna.prototype.validate = function (config) {
- return models.validateLoadQnaConfiguration(config);
+ return (0, powerbi_models_1.validateLoadQnaConfiguration)(config);
};
/** @hidden */
Qna.type = "Qna";
/** @hidden */
Qna.allowedEvents = ["loaded", "visualRendered"];
return Qna;
-}(embed.Embed));
+}(embed_1.Embed));
exports.Qna = Qna;
+/***/ }),
+
+/***/ "./src/quickCreate.ts":
+/*!****************************!*\
+ !*** ./src/quickCreate.ts ***!
+ \****************************/
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ };
+ return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.QuickCreate = void 0;
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
+/**
+ * A Power BI Quick Create component
+ *
+ * @export
+ * @class QuickCreate
+ * @extends {Embed}
+ */
+var QuickCreate = /** @class */ (function (_super) {
+ __extends(QuickCreate, _super);
+ /*
+ * @hidden
+ */
+ function QuickCreate(service, element, config, phasedRender, isBootstrap) {
+ var _this = _super.call(this, service, element, config, /* iframe */ undefined, phasedRender, isBootstrap) || this;
+ service.router.post("/reports/".concat(_this.config.uniqueId, "/eventHooks/:eventName"), function (req, _res) { return __awaiter(_this, void 0, void 0, function () {
+ var _a;
+ var _b;
+ return __generator(this, function (_c) {
+ switch (_c.label) {
+ case 0:
+ _a = req.params.eventName;
+ switch (_a) {
+ case "newAccessToken": return [3 /*break*/, 1];
+ }
+ return [3 /*break*/, 3];
+ case 1:
+ req.body = req.body || {};
+ req.body.report = this;
+ return [4 /*yield*/, service.invokeSDKHook((_b = this.eventHooks) === null || _b === void 0 ? void 0 : _b.accessTokenProvider, req, _res)];
+ case 2:
+ _c.sent();
+ return [3 /*break*/, 4];
+ case 3: return [3 /*break*/, 4];
+ case 4: return [2 /*return*/];
+ }
+ });
+ }); });
+ return _this;
+ }
+ /**
+ * Override the getId abstract function
+ * QuickCreate does not need any ID
+ *
+ * @returns {string}
+ */
+ QuickCreate.prototype.getId = function () {
+ return null;
+ };
+ /**
+ * Validate create report configuration.
+ */
+ QuickCreate.prototype.validate = function (config) {
+ return (0, powerbi_models_1.validateQuickCreate)(config);
+ };
+ /**
+ * Handle config changes.
+ *
+ * @hidden
+ * @returns {void}
+ */
+ QuickCreate.prototype.configChanged = function (isBootstrap) {
+ if (isBootstrap) {
+ return;
+ }
+ this.createConfig = this.config;
+ };
+ /**
+ * @hidden
+ * @returns {string}
+ */
+ QuickCreate.prototype.getDefaultEmbedUrlEndpoint = function () {
+ return "quickCreate";
+ };
+ /**
+ * Sends quickCreate configuration data.
+ *
+ * ```javascript
+ * quickCreate({
+ * accessToken: 'eyJ0eXA ... TaE2rTSbmg',
+ * datasetCreateConfig: {}})
+ * ```
+ *
+ * @hidden
+ * @param {IQuickCreateConfiguration} createConfig
+ * @returns {Promise}
+ */
+ QuickCreate.prototype.create = function () {
+ var _a;
+ return __awaiter(this, void 0, void 0, function () {
+ var errors, headers, response, response_1;
+ return __generator(this, function (_b) {
+ switch (_b.label) {
+ case 0:
+ errors = (0, powerbi_models_1.validateQuickCreate)(this.createConfig);
+ if (errors) {
+ throw errors;
+ }
+ _b.label = 1;
+ case 1:
+ _b.trys.push([1, 3, , 4]);
+ headers = {
+ uid: this.config.uniqueId,
+ sdkSessionId: this.service.getSdkSessionId()
+ };
+ if (!!((_a = this.eventHooks) === null || _a === void 0 ? void 0 : _a.accessTokenProvider)) {
+ headers.tokenProviderSupplied = true;
+ }
+ return [4 /*yield*/, this.service.hpm.post("/quickcreate", this.createConfig, headers, this.iframe.contentWindow)];
+ case 2:
+ response = _b.sent();
+ return [2 /*return*/, response.body];
+ case 3:
+ response_1 = _b.sent();
+ throw response_1.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ return QuickCreate;
+}(embed_1.Embed));
+exports.QuickCreate = QuickCreate;
+
+
/***/ }),
/***/ "./src/report.ts":
/*!***********************!*\
!*** ./src/report.ts ***!
\***********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
@@ -7594,6 +9901,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -7635,7 +9944,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
+var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
+ if (ar || !(i in from)) {
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
+ ar[i] = from[i];
+ }
+ }
+ return to.concat(ar || Array.prototype.slice.call(from));
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Report = void 0;
var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
@@ -7670,6 +9988,37 @@ var Report = /** @class */ (function (_super) {
_this.phasedLoadPath = "/report/prepare";
Array.prototype.push.apply(_this.allowedEvents, Report.allowedEvents);
_this.bookmarksManager = new bookmarksManager_1.BookmarksManager(service, config, _this.iframe);
+ service.router.post("/reports/".concat(_this.config.uniqueId, "/eventHooks/:eventName"), function (req, _res) { return __awaiter(_this, void 0, void 0, function () {
+ var _a;
+ var _b, _c;
+ return __generator(this, function (_d) {
+ switch (_d.label) {
+ case 0:
+ _a = req.params.eventName;
+ switch (_a) {
+ case "preQuery": return [3 /*break*/, 1];
+ case "newAccessToken": return [3 /*break*/, 3];
+ }
+ return [3 /*break*/, 5];
+ case 1:
+ req.body = req.body || {};
+ req.body.report = this;
+ return [4 /*yield*/, service.invokeSDKHook((_b = this.eventHooks) === null || _b === void 0 ? void 0 : _b.applicationContextProvider, req, _res)];
+ case 2:
+ _d.sent();
+ return [3 /*break*/, 6];
+ case 3:
+ req.body = req.body || {};
+ req.body.report = this;
+ return [4 /*yield*/, service.invokeSDKHook((_c = this.eventHooks) === null || _c === void 0 ? void 0 : _c.accessTokenProvider, req, _res)];
+ case 4:
+ _d.sent();
+ return [3 /*break*/, 6];
+ case 5: return [3 /*break*/, 6];
+ case 6: return [2 /*return*/];
+ }
+ });
+ }); });
return _this;
}
/**
@@ -7778,7 +10127,7 @@ var Report = /** @class */ (function (_super) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.service.hpm.delete("/report/pages/" + pageName, {}, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ return [4 /*yield*/, this.service.hpm.delete("/report/pages/".concat(pageName), {}, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
case 1:
response = _a.sent();
return [2 /*return*/, response.body];
@@ -7813,7 +10162,7 @@ var Report = /** @class */ (function (_super) {
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.service.hpm.put("/report/pages/" + pageName + "/name", page, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ return [4 /*yield*/, this.service.hpm.put("/report/pages/".concat(pageName, "/name"), page, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
case 2:
response = _a.sent();
return [2 /*return*/, response.body];
@@ -7844,7 +10193,7 @@ var Report = /** @class */ (function (_super) {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
_a.label = 1;
@@ -7908,7 +10257,7 @@ var Report = /** @class */ (function (_super) {
Report.prototype.removeFilters = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
return [2 /*return*/, this.updateFilters(powerbi_models_1.FiltersOperations.RemoveAll)];
@@ -7938,7 +10287,7 @@ var Report = /** @class */ (function (_super) {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
_a.label = 1;
@@ -7963,7 +10312,7 @@ var Report = /** @class */ (function (_super) {
var config = this.config;
var reportId = config.id || this.element.getAttribute(Report.reportIdAttribute) || Report.findIdFromEmbedUrl(config.embedUrl);
if (typeof reportId !== 'string' || reportId.length === 0) {
- throw new Error("Report id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '" + Report.reportIdAttribute + "'.");
+ throw new Error("Report id is required, but it was not found. You must provide an id either as part of embed configuration or as attribute '".concat(Report.reportIdAttribute, "'."));
}
return reportId;
};
@@ -7986,7 +10335,7 @@ var Report = /** @class */ (function (_super) {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
_a.label = 1;
@@ -7996,7 +10345,7 @@ var Report = /** @class */ (function (_super) {
case 2:
response = _a.sent();
return [2 /*return*/, response.body
- .map(function (page) { return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption); })];
+ .map(function (page) { return new page_1.Page(_this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption, page.mobileSize, page.background, page.wallpaper); })];
case 3:
response_8 = _a.sent();
throw response_8.body;
@@ -8005,6 +10354,84 @@ var Report = /** @class */ (function (_super) {
});
});
};
+ /**
+ * Gets a report page by its name.
+ *
+ * ```javascript
+ * report.getPageByName(pageName)
+ * .then(page => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {string} pageName
+ * @returns {Promise}
+ */
+ Report.prototype.getPageByName = function (pageName) {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, page, response_9;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.service.hpm.get("/report/pages", { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ page = response.body.find(function (p) { return p.name === pageName; });
+ if (!page) {
+ return [2 /*return*/, Promise.reject(powerbi_models_1.CommonErrorCodes.NotFound)];
+ }
+ return [2 /*return*/, new page_1.Page(this, page.name, page.displayName, page.isActive, page.visibility, page.defaultSize, page.defaultDisplayOption, page.mobileSize, page.background, page.wallpaper)];
+ case 3:
+ response_9 = _a.sent();
+ throw response_9.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Gets the active report page.
+ *
+ * ```javascript
+ * report.getActivePage()
+ * .then(activePage => {
+ * ...
+ * });
+ * ```
+ *
+ * @returns {Promise}
+ */
+ Report.prototype.getActivePage = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, activePage, response_10;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.service.hpm.get('/report/pages', { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ activePage = response.body.find(function (page) { return page.isActive; });
+ return [2 /*return*/, new page_1.Page(this, activePage.name, activePage.displayName, activePage.isActive, activePage.visibility, activePage.defaultSize, activePage.defaultDisplayOption, activePage.mobileSize, activePage.background, activePage.wallpaper)];
+ case 3:
+ response_10 = _a.sent();
+ throw response_10.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
/**
* Creates an instance of a Page.
*
@@ -8028,11 +10455,11 @@ var Report = /** @class */ (function (_super) {
*/
Report.prototype.print = function () {
return __awaiter(this, void 0, void 0, function () {
- var response, response_9;
+ var response, response_11;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
_a.label = 1;
@@ -8043,8 +10470,8 @@ var Report = /** @class */ (function (_super) {
response = _a.sent();
return [2 /*return*/, response.body];
case 3:
- response_9 = _a.sent();
- throw response_9.body;
+ response_11 = _a.sent();
+ throw response_11.body;
case 4: return [2 /*return*/];
}
});
@@ -8063,11 +10490,11 @@ var Report = /** @class */ (function (_super) {
*/
Report.prototype.setPage = function (pageName) {
return __awaiter(this, void 0, void 0, function () {
- var page, response_10;
+ var page, response_12;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
page = {
@@ -8081,8 +10508,8 @@ var Report = /** @class */ (function (_super) {
return [4 /*yield*/, this.service.hpm.put('/report/pages/active', page, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
case 2: return [2 /*return*/, _a.sent()];
case 3:
- response_10 = _a.sent();
- throw response_10.body;
+ response_12 = _a.sent();
+ throw response_12.body;
case 4: return [2 /*return*/];
}
});
@@ -8093,8 +10520,11 @@ var Report = /** @class */ (function (_super) {
*
* ```javascript
* const newSettings = {
- * navContentPaneEnabled: true,
- * filterPaneEnabled: false
+ * panes: {
+ * filters: {
+ * visible: false
+ * }
+ * }
* };
*
* report.updateSettings(newSettings)
@@ -8105,22 +10535,36 @@ var Report = /** @class */ (function (_super) {
* @returns {Promise>}
*/
Report.prototype.updateSettings = function (settings) {
+ var _a, _b;
return __awaiter(this, void 0, void 0, function () {
- var response_11;
- return __generator(this, function (_a) {
- switch (_a.label) {
+ var response, extension, extensionsArray, response_13;
+ var _this = this;
+ return __generator(this, function (_c) {
+ switch (_c.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl) && settings.customLayout != null) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl) && settings.customLayout != null) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
- _a.label = 1;
+ _c.label = 1;
case 1:
- _a.trys.push([1, 3, , 4]);
+ _c.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.service.hpm.patch('/report/settings', settings, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
- case 2: return [2 /*return*/, _a.sent()];
+ case 2:
+ response = _c.sent();
+ extension = settings === null || settings === void 0 ? void 0 : settings.extensions;
+ this.commands = (_a = extension === null || extension === void 0 ? void 0 : extension.commands) !== null && _a !== void 0 ? _a : this.commands;
+ this.groups = (_b = extension === null || extension === void 0 ? void 0 : extension.groups) !== null && _b !== void 0 ? _b : this.groups;
+ extensionsArray = settings === null || settings === void 0 ? void 0 : settings.extensions;
+ if (Array.isArray(extensionsArray)) {
+ this.commands = [];
+ extensionsArray.map(function (extensionElement) { if (extensionElement === null || extensionElement === void 0 ? void 0 : extensionElement.command) {
+ _this.commands.push(extensionElement.command);
+ } });
+ }
+ return [2 /*return*/, response];
case 3:
- response_11 = _a.sent();
- throw response_11.body;
+ response_13 = _c.sent();
+ throw response_13.body;
case 4: return [2 /*return*/];
}
});
@@ -8132,7 +10576,10 @@ var Report = /** @class */ (function (_super) {
* @hidden
*/
Report.prototype.validate = function (config) {
- return powerbi_models_1.validateReportLoad(config);
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return (0, powerbi_models_1.validatePaginatedReportLoad)(config);
+ }
+ return (0, powerbi_models_1.validateReportLoad)(config);
};
/**
* Handle config changes.
@@ -8142,7 +10589,7 @@ var Report = /** @class */ (function (_super) {
Report.prototype.configChanged = function (isBootstrap) {
var config = this.config;
if (this.isMobileSettings(config.settings)) {
- config.embedUrl = util_1.addParamToUrl(config.embedUrl, "isMobile", "true");
+ config.embedUrl = (0, util_1.addParamToUrl)(config.embedUrl, "isMobile", "true");
}
// Calculate settings from HTML element attributes if available.
var filterPaneEnabledAttribute = this.element.getAttribute(Report.filterPaneEnabledAttribute);
@@ -8152,7 +10599,7 @@ var Report = /** @class */ (function (_super) {
navContentPaneEnabled: (navContentPaneEnabledAttribute == null) ? undefined : (navContentPaneEnabledAttribute !== "false")
};
// Set the settings back into the config.
- this.config.settings = util_1.assign({}, elementAttrSettings, config.settings);
+ this.config.settings = (0, util_1.assign)({}, elementAttrSettings, config.settings);
if (isBootstrap) {
return;
}
@@ -8172,7 +10619,7 @@ var Report = /** @class */ (function (_super) {
*/
Report.prototype.switchMode = function (viewMode) {
return __awaiter(this, void 0, void 0, function () {
- var newMode, url, response, response_12;
+ var newMode, url, response, response_14;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@@ -8191,8 +10638,8 @@ var Report = /** @class */ (function (_super) {
response = _a.sent();
return [2 /*return*/, response.body];
case 3:
- response_12 = _a.sent();
- throw response_12.body;
+ response_14 = _a.sent();
+ throw response_14.body;
case 4: return [2 /*return*/];
}
});
@@ -8205,163 +10652,630 @@ var Report = /** @class */ (function (_super) {
* report.refresh();
* ```
*/
- Report.prototype.refresh = function () {
+ Report.prototype.refresh = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, response_15;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ return [2 /*return*/, response.body];
+ case 3:
+ response_15 = _a.sent();
+ throw response_15.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * checks if the report is saved.
+ *
+ * ```javascript
+ * report.isSaved()
+ * ```
+ *
+ * @returns {Promise}
+ */
+ Report.prototype.isSaved = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ return [4 /*yield*/, (0, util_1.isSavedInternal)(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow)];
+ case 1: return [2 /*return*/, _a.sent()];
+ }
+ });
+ });
+ };
+ /**
+ * Apply a theme to the report
+ *
+ * ```javascript
+ * report.applyTheme(theme);
+ * ```
+ */
+ Report.prototype.applyTheme = function (theme) {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ return [4 /*yield*/, this.applyThemeInternal(theme)];
+ case 1: return [2 /*return*/, _a.sent()];
+ }
+ });
+ });
+ };
+ /**
+ * Reset and apply the default theme of the report
+ *
+ * ```javascript
+ * report.resetTheme();
+ * ```
+ */
+ Report.prototype.resetTheme = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ return [4 /*yield*/, this.applyThemeInternal({})];
+ case 1: return [2 /*return*/, _a.sent()];
+ }
+ });
+ });
+ };
+ /**
+ * get the theme of the report
+ *
+ * ```javascript
+ * report.getTheme();
+ * ```
+ */
+ Report.prototype.getTheme = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, response_16;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.service.hpm.get("/report/theme", { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ return [2 /*return*/, response.body];
+ case 3:
+ response_16 = _a.sent();
+ throw response_16.body;
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Reset user's filters, slicers, and other data view changes to the default state of the report
+ *
+ * ```javascript
+ * report.resetPersistentFilters();
+ * ```
+ */
+ Report.prototype.resetPersistentFilters = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response_17;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, 2, , 3]);
+ return [4 /*yield*/, this.service.hpm.delete("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 1: return [2 /*return*/, _a.sent()];
+ case 2:
+ response_17 = _a.sent();
+ throw response_17.body;
+ case 3: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Save user's filters, slicers, and other data view changes of the report
+ *
+ * ```javascript
+ * report.savePersistentFilters();
+ * ```
+ */
+ Report.prototype.savePersistentFilters = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response_18;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, 2, , 3]);
+ return [4 /*yield*/, this.service.hpm.post("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 1: return [2 /*return*/, _a.sent()];
+ case 2:
+ response_18 = _a.sent();
+ throw response_18.body;
+ case 3: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Returns if there are user's filters, slicers, or other data view changes applied on the report.
+ * If persistent filters is disable, returns false.
+ *
+ * ```javascript
+ * report.arePersistentFiltersApplied();
+ * ```
+ *
+ * @returns {Promise}
+ */
+ Report.prototype.arePersistentFiltersApplied = function () {
return __awaiter(this, void 0, void 0, function () {
- var response, response_13;
+ var response, response_19;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.service.hpm.post('/report/refresh', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ return [4 /*yield*/, this.service.hpm.get("/report/isUserStateApplied", { uid: this.config.uniqueId }, this.iframe.contentWindow)];
case 1:
response = _a.sent();
return [2 /*return*/, response.body];
case 2:
- response_13 = _a.sent();
- throw response_13.body;
+ response_19 = _a.sent();
+ throw response_19.body;
case 3: return [2 /*return*/];
}
});
});
};
/**
- * checks if the report is saved.
+ * Remove context menu extension command.
*
* ```javascript
- * report.isSaved()
+ * report.removeContextMenuCommand(commandName, contextMenuTitle)
+ * .catch(error => {
+ * ...
+ * });
* ```
*
- * @returns {Promise}
+ * @param {string} commandName
+ * @param {string} contextMenuTitle
+ * @returns {Promise>}
*/
- Report.prototype.isSaved = function () {
+ Report.prototype.removeContextMenuCommand = function (commandName, contextMenuTitle) {
return __awaiter(this, void 0, void 0, function () {
+ var commandCopy, indexOfCommand, newSetting;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
- return [4 /*yield*/, util_1.isSavedInternal(this.service.hpm, this.config.uniqueId, this.iframe.contentWindow)];
+ commandCopy = JSON.parse(JSON.stringify(this.commands));
+ indexOfCommand = this.findCommandMenuIndex("visualContextMenu", commandCopy, commandName, contextMenuTitle);
+ if (indexOfCommand === -1) {
+ throw powerbi_models_1.CommonErrorCodes.NotFound;
+ }
+ // Delete the context menu and not the entire command, since command can have option menu as well.
+ delete commandCopy[indexOfCommand].extend.visualContextMenu;
+ newSetting = {
+ extensions: {
+ commands: commandCopy,
+ groups: this.groups
+ }
+ };
+ return [4 /*yield*/, this.updateSettings(newSetting)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
- * Apply a theme to the report
+ * Add context menu extension command.
*
* ```javascript
- * report.applyTheme(theme);
+ * report.addContextMenuCommand(commandName, commandTitle, contextMenuTitle, menuLocation, visualName, visualType, groupName)
+ * .catch(error => {
+ * ...
+ * });
* ```
+ *
+ * @param {string} commandName
+ * @param {string} commandTitle
+ * @param {string} contextMenuTitle
+ * @param {MenuLocation} menuLocation
+ * @param {string} visualName
+ * @param {string} visualType
+ * @param {string} groupName
+ * @returns {Promise>}
*/
- Report.prototype.applyTheme = function (theme) {
+ Report.prototype.addContextMenuCommand = function (commandName, commandTitle, contextMenuTitle, menuLocation, visualName, visualType, groupName) {
+ if (contextMenuTitle === void 0) { contextMenuTitle = commandTitle; }
+ if (menuLocation === void 0) { menuLocation = powerbi_models_1.MenuLocation.Bottom; }
+ if (visualName === void 0) { visualName = undefined; }
+ if (groupName === void 0) { groupName = undefined; }
return __awaiter(this, void 0, void 0, function () {
+ var newCommands, newSetting;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
- return [4 /*yield*/, this.applyThemeInternal(theme)];
+ newCommands = this.createMenuCommand("visualContextMenu", commandName, commandTitle, contextMenuTitle, menuLocation, visualName, visualType, groupName);
+ newSetting = {
+ extensions: {
+ commands: newCommands,
+ groups: this.groups
+ }
+ };
+ return [4 /*yield*/, this.updateSettings(newSetting)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
- * Reset and apply the default theme of the report
+ * Remove options menu extension command.
*
* ```javascript
- * report.resetTheme();
+ * report.removeOptionsMenuCommand(commandName, optionsMenuTitle)
+ * .then({
+ * ...
+ * });
* ```
+ *
+ * @param {string} commandName
+ * @param {string} optionsMenuTitle
+ * @returns {Promise>}
*/
- Report.prototype.resetTheme = function () {
+ Report.prototype.removeOptionsMenuCommand = function (commandName, optionsMenuTitle) {
return __awaiter(this, void 0, void 0, function () {
+ var commandCopy, indexOfCommand, newSetting;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- if (util_1.isRDLEmbed(this.config.embedUrl)) {
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
}
- return [4 /*yield*/, this.applyThemeInternal({})];
+ commandCopy = JSON.parse(JSON.stringify(this.commands));
+ indexOfCommand = this.findCommandMenuIndex("visualOptionsMenu", commandCopy, commandName, optionsMenuTitle);
+ if (indexOfCommand === -1) {
+ throw powerbi_models_1.CommonErrorCodes.NotFound;
+ }
+ // Delete the context options and not the entire command, since command can have context menu as well.
+ delete commandCopy[indexOfCommand].extend.visualOptionsMenu;
+ delete commandCopy[indexOfCommand].icon;
+ newSetting = {
+ extensions: {
+ commands: commandCopy,
+ groups: this.groups
+ }
+ };
+ return [4 /*yield*/, this.updateSettings(newSetting)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
- * Reset user's filters, slicers, and other data view changes to the default state of the report
+ * Add options menu extension command.
*
* ```javascript
- * report.resetPersistentFilters();
+ * report.addOptionsMenuCommand(commandName, commandTitle, optionsMenuTitle, menuLocation, visualName, visualType, groupName, commandIcon)
+ * .catch(error => {
+ * ...
+ * });
* ```
+ *
+ * @param {string} commandName
+ * @param {string} commandTitle
+ * @param {string} optionMenuTitle
+ * @param {MenuLocation} menuLocation
+ * @param {string} visualName
+ * @param {string} visualType
+ * @param {string} groupName
+ * @param {string} commandIcon
+ * @returns {Promise>}
*/
- Report.prototype.resetPersistentFilters = function () {
+ Report.prototype.addOptionsMenuCommand = function (commandName, commandTitle, optionsMenuTitle, menuLocation, visualName, visualType, groupName, commandIcon) {
+ if (optionsMenuTitle === void 0) { optionsMenuTitle = commandTitle; }
+ if (menuLocation === void 0) { menuLocation = powerbi_models_1.MenuLocation.Bottom; }
+ if (visualName === void 0) { visualName = undefined; }
+ if (visualType === void 0) { visualType = undefined; }
+ if (groupName === void 0) { groupName = undefined; }
+ if (commandIcon === void 0) { commandIcon = undefined; }
return __awaiter(this, void 0, void 0, function () {
- var response_14;
+ var newCommands, newSetting;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- _a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.service.hpm.delete("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ newCommands = this.createMenuCommand("visualOptionsMenu", commandName, commandTitle, optionsMenuTitle, menuLocation, visualName, visualType, groupName, commandIcon);
+ newSetting = {
+ extensions: {
+ commands: newCommands,
+ groups: this.groups
+ }
+ };
+ return [4 /*yield*/, this.updateSettings(newSetting)];
case 1: return [2 /*return*/, _a.sent()];
- case 2:
- response_14 = _a.sent();
- throw response_14.body;
- case 3: return [2 /*return*/];
}
});
});
};
/**
- * Save user's filters, slicers, and other data view changes of the report
+ * Updates the display state of a visual in a page.
*
* ```javascript
- * report.savePersistentFilters();
+ * report.setVisualDisplayState(pageName, visualName, displayState)
+ * .catch(error => { ... });
* ```
+ *
+ * @param {string} pageName
+ * @param {string} visualName
+ * @param {VisualContainerDisplayMode} displayState
+ * @returns {Promise>}
*/
- Report.prototype.savePersistentFilters = function () {
+ Report.prototype.setVisualDisplayState = function (pageName, visualName, displayState) {
return __awaiter(this, void 0, void 0, function () {
- var response_15;
+ var visualLayout, newSettings;
return __generator(this, function (_a) {
switch (_a.label) {
- case 0:
- _a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.service.hpm.post("/report/userState", null, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
- case 1: return [2 /*return*/, _a.sent()];
- case 2:
- response_15 = _a.sent();
- throw response_15.body;
- case 3: return [2 /*return*/];
+ case 0:
+ // Check if page name and visual name are valid
+ return [4 /*yield*/, this.validateVisual(pageName, visualName)];
+ case 1:
+ // Check if page name and visual name are valid
+ _a.sent();
+ visualLayout = {
+ displayState: {
+ mode: displayState
+ }
+ };
+ newSettings = this.buildLayoutSettingsObject(pageName, visualName, visualLayout);
+ return [2 /*return*/, this.updateSettings(newSettings)];
}
});
});
};
/**
- * Returns if there are user's filters, slicers, or other data view changes applied on the report.
- * If persistent filters is disable, returns false.
+ * Resize a visual in a page.
*
* ```javascript
- * report.arePersistentFiltersApplied();
+ * report.resizeVisual(pageName, visualName, width, height)
+ * .catch(error => { ... });
* ```
*
- * @returns {Promise}
+ * @param {string} pageName
+ * @param {string} visualName
+ * @param {number} width
+ * @param {number} height
+ * @returns {Promise>}
*/
- Report.prototype.arePersistentFiltersApplied = function () {
+ Report.prototype.resizeVisual = function (pageName, visualName, width, height) {
return __awaiter(this, void 0, void 0, function () {
- var response, response_16;
+ var visualLayout, newSettings;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ // Check if page name and visual name are valid
+ return [4 /*yield*/, this.validateVisual(pageName, visualName)];
+ case 1:
+ // Check if page name and visual name are valid
+ _a.sent();
+ visualLayout = {
+ width: width,
+ height: height,
+ };
+ newSettings = this.buildLayoutSettingsObject(pageName, visualName, visualLayout);
+ return [2 /*return*/, this.updateSettings(newSettings)];
+ }
+ });
+ });
+ };
+ /**
+ * Updates the size of active page in report.
+ *
+ * ```javascript
+ * report.resizeActivePage(pageSizeType, width, height)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {PageSizeType} pageSizeType
+ * @param {number} width
+ * @param {number} height
+ * @returns {Promise>}
+ */
+ Report.prototype.resizeActivePage = function (pageSizeType, width, height) {
+ return __awaiter(this, void 0, void 0, function () {
+ var pageSize, newSettings;
+ return __generator(this, function (_a) {
+ pageSize = {
+ type: pageSizeType,
+ width: width,
+ height: height
+ };
+ newSettings = {
+ layoutType: powerbi_models_1.LayoutType.Custom,
+ customLayout: {
+ pageSize: pageSize
+ }
+ };
+ return [2 /*return*/, this.updateSettings(newSettings)];
+ });
+ });
+ };
+ /**
+ * Updates the position of a visual in a page.
+ *
+ * ```javascript
+ * report.moveVisual(pageName, visualName, x, y, z)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {string} pageName
+ * @param {string} visualName
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ * @returns {Promise>}
+ */
+ Report.prototype.moveVisual = function (pageName, visualName, x, y, z) {
+ return __awaiter(this, void 0, void 0, function () {
+ var visualLayout, newSettings;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ // Check if page name and visual name are valid
+ return [4 /*yield*/, this.validateVisual(pageName, visualName)];
+ case 1:
+ // Check if page name and visual name are valid
+ _a.sent();
+ visualLayout = {
+ x: x,
+ y: y,
+ z: z
+ };
+ newSettings = this.buildLayoutSettingsObject(pageName, visualName, visualLayout);
+ return [2 /*return*/, this.updateSettings(newSettings)];
+ }
+ });
+ });
+ };
+ /**
+ * Updates the report layout
+ *
+ * ```javascript
+ * report.switchLayout(layoutType);
+ * ```
+ *
+ * @param {LayoutType} layoutType
+ * @returns {Promise>}
+ */
+ Report.prototype.switchLayout = function (layoutType) {
+ return __awaiter(this, void 0, void 0, function () {
+ var isInitialMobileSettings, isPassedMobileSettings, newSetting, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- _a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.service.hpm.get("/report/isUserStateApplied", { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ isInitialMobileSettings = this.isMobileSettings({ layoutType: this.initialLayoutType });
+ isPassedMobileSettings = this.isMobileSettings({ layoutType: layoutType });
+ // Check if both passed layout and initial layout are of same type.
+ if (isInitialMobileSettings !== isPassedMobileSettings) {
+ throw "Switching between mobile and desktop layouts is not supported. Please reset the embed container and re-embed with required layout.";
+ }
+ newSetting = {
+ layoutType: layoutType
+ };
+ return [4 /*yield*/, this.updateSettings(newSetting)];
case 1:
response = _a.sent();
- return [2 /*return*/, response.body];
- case 2:
- response_16 = _a.sent();
- throw response_16.body;
- case 3: return [2 /*return*/];
+ this.initialLayoutType = layoutType;
+ return [2 /*return*/, response];
+ }
+ });
+ });
+ };
+ /**
+ * @hidden
+ */
+ Report.prototype.createMenuCommand = function (type, commandName, commandTitle, menuTitle, menuLocation, visualName, visualType, groupName, icon) {
+ var newCommandObj = {
+ name: commandName,
+ title: commandTitle,
+ extend: {}
+ };
+ newCommandObj.extend[type] = {
+ title: menuTitle,
+ menuLocation: menuLocation,
+ };
+ if (type === "visualOptionsMenu") {
+ newCommandObj.icon = icon;
+ }
+ if (groupName) {
+ var extend = newCommandObj.extend[type];
+ delete extend.menuLocation;
+ var groupExtend = newCommandObj.extend[type];
+ groupExtend.groupName = groupName;
+ }
+ if (visualName) {
+ newCommandObj.selector = {
+ $schema: "http://powerbi.com/product/schema#visualSelector",
+ visualName: visualName
+ };
+ }
+ if (visualType) {
+ newCommandObj.selector = {
+ $schema: "http://powerbi.com/product/schema#visualTypeSelector",
+ visualType: visualType
+ };
+ }
+ return __spreadArray(__spreadArray([], this.commands, true), [newCommandObj], false);
+ };
+ /**
+ * @hidden
+ */
+ Report.prototype.findCommandMenuIndex = function (type, commands, commandName, menuTitle) {
+ var indexOfCommand = -1;
+ commands.some(function (activeMenuCommand, index) {
+ return (activeMenuCommand.name === commandName && activeMenuCommand.extend[type] && activeMenuCommand.extend[type].title === menuTitle) ? (indexOfCommand = index, true) : false;
+ });
+ return indexOfCommand;
+ };
+ /**
+ * @hidden
+ */
+ Report.prototype.buildLayoutSettingsObject = function (pageName, visualName, visualLayout) {
+ // Create new settings object with custom layout type
+ var newSettings = {
+ layoutType: powerbi_models_1.LayoutType.Custom,
+ customLayout: {
+ pagesLayout: {}
+ }
+ };
+ newSettings.customLayout.pagesLayout[pageName] = {
+ visualsLayout: {}
+ };
+ newSettings.customLayout.pagesLayout[pageName].visualsLayout[visualName] = visualLayout;
+ return newSettings;
+ };
+ /**
+ * @hidden
+ */
+ Report.prototype.validateVisual = function (pageName, visualName) {
+ return __awaiter(this, void 0, void 0, function () {
+ var page;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0: return [4 /*yield*/, this.getPageByName(pageName)];
+ case 1:
+ page = _a.sent();
+ return [4 /*yield*/, page.getVisualByName(visualName)];
+ case 2: return [2 /*return*/, _a.sent()];
}
});
});
@@ -8371,7 +11285,7 @@ var Report = /** @class */ (function (_super) {
*/
Report.prototype.applyThemeInternal = function (theme) {
return __awaiter(this, void 0, void 0, function () {
- var response, response_17;
+ var response, response_20;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@@ -8381,8 +11295,8 @@ var Report = /** @class */ (function (_super) {
response = _a.sent();
return [2 /*return*/, response.body];
case 2:
- response_17 = _a.sent();
- throw response_17.body;
+ response_20 = _a.sent();
+ throw response_20.body;
case 3: return [2 /*return*/];
}
});
@@ -8409,8 +11323,125 @@ var Report = /** @class */ (function (_super) {
Report.prototype.isMobileSettings = function (settings) {
return settings && (settings.layoutType === powerbi_models_1.LayoutType.MobileLandscape || settings.layoutType === powerbi_models_1.LayoutType.MobilePortrait);
};
+ /**
+ * Return the current zoom level of the report.
+ *
+ * @returns {Promise}
+ */
+ Report.prototype.getZoom = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, response_21;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, 2, , 3]);
+ return [4 /*yield*/, this.service.hpm.get("/report/zoom", { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 1:
+ response = _a.sent();
+ return [2 /*return*/, response.body];
+ case 2:
+ response_21 = _a.sent();
+ throw response_21.body;
+ case 3: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Sets the report's zoom level.
+ *
+ * @param zoomLevel zoom level to set
+ */
+ Report.prototype.setZoom = function (zoomLevel) {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0: return [4 /*yield*/, this.updateSettings({ zoomLevel: zoomLevel })];
+ case 1:
+ _a.sent();
+ return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Closes all open context menus and tooltips.
+ *
+ * ```javascript
+ * report.closeAllOverlays()
+ * .then(() => {
+ * ...
+ * });
+ * ```
+ *
+ * @returns {Promise}
+ */
+ Report.prototype.closeAllOverlays = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, error_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.service.hpm.post('/report/closeAllOverlays', null, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ return [2 /*return*/, response.body];
+ case 3:
+ error_1 = _a.sent();
+ return [2 /*return*/, Promise.reject(error_1)];
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /**
+ * Clears selected not popped out visuals, if flag is passed, all visuals selections will be cleared.
+ *
+ * ```javascript
+ * report.clearSelectedVisuals()
+ * .then(() => {
+ * ...
+ * });
+ * ```
+ *
+ * @param {Boolean} [clearPopOutState=false]
+ * If false / undefined visuals selection will not be cleared if one of visuals
+ * is in popped out state (in focus, show as table, spotlight...)
+ * @returns {Promise}
+ */
+ Report.prototype.clearSelectedVisuals = function (clearPopOutState) {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, error_2;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ clearPopOutState = clearPopOutState === true;
+ if ((0, util_1.isRDLEmbed)(this.config.embedUrl)) {
+ return [2 /*return*/, Promise.reject(errors_1.APINotSupportedForRDLError)];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.service.hpm.post("/report/clearSelectedVisuals/".concat(clearPopOutState.toString()), null, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ case 2:
+ response = _a.sent();
+ return [2 /*return*/, response.body];
+ case 3:
+ error_2 = _a.sent();
+ return [2 /*return*/, Promise.reject(error_2)];
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
/** @hidden */
- Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged"];
+ Report.allowedEvents = ["filtersApplied", "pageChanged", "commandTriggered", "swipeStart", "swipeEnd", "bookmarkApplied", "dataHyperlinkClicked", "visualRendered", "visualClicked", "selectionChanged", "renderingStarted", "blur"];
/** @hidden */
Report.reportIdAttribute = 'powerbi-report-id';
/** @hidden */
@@ -8432,12 +11463,60 @@ exports.Report = Report;
/*!************************!*\
!*** ./src/service.ts ***!
\************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
-Object.defineProperty(exports, "__esModule", { value: true });
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+var __assign = (this && this.__assign) || function () {
+ __assign = Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+ };
+ return __assign.apply(this, arguments);
+};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Service = void 0;
-var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts");
+var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts");
var create_1 = __webpack_require__(/*! ./create */ "./src/create.ts");
var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts");
@@ -8446,6 +11525,9 @@ var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts");
var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts");
var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts");
var utils = __webpack_require__(/*! ./util */ "./src/util.ts");
+var quickCreate_1 = __webpack_require__(/*! ./quickCreate */ "./src/quickCreate.ts");
+var sdkConfig = __webpack_require__(/*! ./config */ "./src/config.ts");
+var errors_1 = __webpack_require__(/*! ./errors */ "./src/errors.ts");
/**
* The Power BI Service embed component, which is the entry point to embed all other Power BI components into your application
*
@@ -8464,16 +11546,20 @@ var Service = /** @class */ (function () {
* @hidden
*/
function Service(hpmFactory, wpmpFactory, routerFactory, config) {
- var _this = this;
if (config === void 0) { config = {}; }
+ var _this = this;
+ /**
+ * @hidden
+ */
+ this.registeredComponents = {};
this.wpmp = wpmpFactory(config.wpmpName, config.logMessages);
- this.hpm = hpmFactory(this.wpmp, null, config.version, config.type);
+ this.hpm = hpmFactory(this.wpmp, null, config.version, config.type, config.sdkWrapperVersion);
this.router = routerFactory(this.wpmp);
this.uniqueSessionId = utils.generateUUID();
/**
* Adds handler for report events.
*/
- this.router.post("/reports/:uniqueId/events/:eventName", function (req, res) {
+ this.router.post("/reports/:uniqueId/events/:eventName", function (req, _res) {
var event = {
type: 'report',
id: req.params.uniqueId,
@@ -8482,7 +11568,7 @@ var Service = /** @class */ (function () {
};
_this.handleEvent(event);
});
- this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName", function (req, res) {
+ this.router.post("/reports/:uniqueId/pages/:pageName/events/:eventName", function (req, _res) {
var event = {
type: 'report',
id: req.params.uniqueId,
@@ -8491,7 +11577,7 @@ var Service = /** @class */ (function () {
};
_this.handleEvent(event);
});
- this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName", function (req, res) {
+ this.router.post("/reports/:uniqueId/pages/:pageName/visuals/:visualName/events/:eventName", function (req, _res) {
var event = {
type: 'report',
id: req.params.uniqueId,
@@ -8500,7 +11586,7 @@ var Service = /** @class */ (function () {
};
_this.handleEvent(event);
});
- this.router.post("/dashboards/:uniqueId/events/:eventName", function (req, res) {
+ this.router.post("/dashboards/:uniqueId/events/:eventName", function (req, _res) {
var event = {
type: 'dashboard',
id: req.params.uniqueId,
@@ -8509,7 +11595,7 @@ var Service = /** @class */ (function () {
};
_this.handleEvent(event);
});
- this.router.post("/tile/:uniqueId/events/:eventName", function (req, res) {
+ this.router.post("/tile/:uniqueId/events/:eventName", function (req, _res) {
var event = {
type: 'tile',
id: req.params.uniqueId,
@@ -8521,7 +11607,7 @@ var Service = /** @class */ (function () {
/**
* Adds handler for Q&A events.
*/
- this.router.post("/qna/:uniqueId/events/:eventName", function (req, res) {
+ this.router.post("/qna/:uniqueId/events/:eventName", function (req, _res) {
var event = {
type: 'qna',
id: req.params.uniqueId,
@@ -8533,7 +11619,7 @@ var Service = /** @class */ (function () {
/**
* Adds handler for front load 'ready' message.
*/
- this.router.post("/ready/:uniqueId", function (req, res) {
+ this.router.post("/ready/:uniqueId", function (req, _res) {
var event = {
type: 'report',
id: req.params.uniqueId,
@@ -8551,9 +11637,10 @@ var Service = /** @class */ (function () {
}
/**
* Creates new report
+ *
* @param {HTMLElement} element
- * @param {embed.IEmbedConfiguration} [config={}]
- * @returns {embed.Embed}
+ * @param {IEmbedConfiguration} [config={}]
+ * @returns {Embed}
*/
Service.prototype.createReport = function (element, config) {
config.type = 'create';
@@ -8563,19 +11650,34 @@ var Service = /** @class */ (function () {
this.addOrOverwriteEmbed(component, element);
return component;
};
+ /**
+ * Creates new dataset
+ *
+ * @param {HTMLElement} element
+ * @param {IEmbedConfiguration} [config={}]
+ * @returns {Embed}
+ */
+ Service.prototype.quickCreate = function (element, config) {
+ config.type = 'quickCreate';
+ var powerBiElement = element;
+ var component = new quickCreate_1.QuickCreate(this, powerBiElement, config);
+ powerBiElement.powerBiEmbed = component;
+ this.addOrOverwriteEmbed(component, element);
+ return component;
+ };
/**
* TODO: Add a description here
*
* @param {HTMLElement} [container]
- * @param {embed.IEmbedConfiguration} [config=undefined]
- * @returns {embed.Embed[]}
+ * @param {IEmbedConfiguration} [config=undefined]
+ * @returns {Embed[]}
* @hidden
*/
Service.prototype.init = function (container, config) {
var _this = this;
if (config === void 0) { config = undefined; }
container = (container && container instanceof HTMLElement) ? container : document.body;
- var elements = Array.prototype.slice.call(container.querySelectorAll("[" + embed.Embed.embedUrlAttribute + "]"));
+ var elements = Array.prototype.slice.call(container.querySelectorAll("[".concat(embed_1.Embed.embedUrlAttribute, "]")));
return elements.map(function (element) { return _this.embed(element, config); });
};
/**
@@ -8584,8 +11686,8 @@ var Service = /** @class */ (function () {
* otherwise creates a new component instance.
*
* @param {HTMLElement} element
- * @param {embed.IEmbedConfigurationBase} [config={}]
- * @returns {embed.Embed}
+ * @param {IEmbedConfigurationBase} [config={}]
+ * @returns {Embed}
*/
Service.prototype.embed = function (element, config) {
if (config === void 0) { config = {}; }
@@ -8598,8 +11700,8 @@ var Service = /** @class */ (function () {
* This is used for the phased embedding API, once element is loaded successfully, one can call 'render' on it.
*
* @param {HTMLElement} element
- * @param {embed.IEmbedConfigurationBase} [config={}]
- * @returns {embed.Embed}
+ * @param {IEmbedConfigurationBase} [config={}]
+ * @returns {Embed}
*/
Service.prototype.load = function (element, config) {
if (config === void 0) { config = {}; }
@@ -8609,7 +11711,7 @@ var Service = /** @class */ (function () {
* Given an HTML element and entityType, creates a new component instance, and bootstrap the iframe for embedding.
*
* @param {HTMLElement} element
- * @param {embed.IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token.
+ * @param {IBootstrapEmbedConfiguration} config: a bootstrap config which is an embed config without access token.
*/
Service.prototype.bootstrap = function (element, config) {
return this.embedInternal(element, config, /* phasedRender */ false, /* isBootstrap */ true);
@@ -8621,7 +11723,7 @@ var Service = /** @class */ (function () {
var powerBiElement = element;
if (powerBiElement.powerBiEmbed) {
if (isBootstrap) {
- throw new Error("Attempted to bootstrap element " + element.outerHTML + ", but the element is already a powerbi element.");
+ throw new Error("Attempted to bootstrap element ".concat(element.outerHTML, ", but the element is already a powerbi element."));
}
component = this.embedExisting(powerBiElement, config, phasedRender);
}
@@ -8641,44 +11743,76 @@ var Service = /** @class */ (function () {
Service.prototype.getSdkSessionId = function () {
return this.uniqueSessionId;
};
+ /**
+ * Returns the Power BI Client SDK version
+ *
+ * @hidden
+ */
+ Service.prototype.getSDKVersion = function () {
+ return sdkConfig.default.version;
+ };
/**
* Given a configuration based on a Power BI element, saves the component instance that reference the element for later lookup.
*
* @private
* @param {IPowerBiElement} element
- * @param {embed.IEmbedConfigurationBase} config
- * @returns {embed.Embed}
+ * @param {IEmbedConfigurationBase} config
+ * @param {boolean} phasedRender
+ * @param {boolean} isBootstrap
+ * @returns {Embed}
* @hidden
*/
Service.prototype.embedNew = function (element, config, phasedRender, isBootstrap) {
- var componentType = config.type || element.getAttribute(embed.Embed.typeAttribute);
+ var componentType = config.type || element.getAttribute(embed_1.Embed.typeAttribute);
if (!componentType) {
- throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '" + embed.Embed.typeAttribute + "=\"" + report_1.Report.type.toLowerCase() + "\"'.");
+ var scrubbedConfig = __assign(__assign({}, config), { accessToken: "" });
+ throw new Error("Attempted to embed using config ".concat(JSON.stringify(scrubbedConfig), " on element ").concat(element.outerHTML, ", but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '").concat(embed_1.Embed.typeAttribute, "=\"").concat(report_1.Report.type.toLowerCase(), "\"'."));
}
// Saves the type as part of the configuration so that it can be referenced later at a known location.
config.type = componentType;
- var Component = utils.find(function (component) { return componentType === component.type.toLowerCase(); }, Service.components);
- if (!Component) {
- throw new Error("Attempted to embed component of type: " + componentType + " but did not find any matching component. Please verify the type you specified is intended.");
- }
- var component = new Component(this, element, config, phasedRender, isBootstrap);
+ var component = this.createEmbedComponent(componentType, element, config, phasedRender, isBootstrap);
element.powerBiEmbed = component;
this.addOrOverwriteEmbed(component, element);
return component;
};
+ /**
+ * Given component type, creates embed component instance
+ *
+ * @private
+ * @param {string} componentType
+ * @param {HTMLElement} element
+ * @param {IEmbedConfigurationBase} config
+ * @param {boolean} phasedRender
+ * @param {boolean} isBootstrap
+ * @returns {Embed}
+ * @hidden
+ */
+ Service.prototype.createEmbedComponent = function (componentType, element, config, phasedRender, isBootstrap) {
+ var Component = utils.find(function (embedComponent) { return componentType === embedComponent.type.toLowerCase(); }, Service.components);
+ if (Component) {
+ return new Component(this, element, config, phasedRender, isBootstrap);
+ }
+ // If component type is not legacy, search in registered components
+ var registeredComponent = utils.find(function (registeredComponentType) { return componentType.toLowerCase() === registeredComponentType.toLowerCase(); }, Object.keys(this.registeredComponents));
+ if (!registeredComponent) {
+ throw new Error("Attempted to embed component of type: ".concat(componentType, " but did not find any matching component. Please verify the type you specified is intended."));
+ }
+ return this.registeredComponents[registeredComponent](this, element, config, phasedRender, isBootstrap);
+ };
/**
* Given an element that already contains an embed component, load with a new configuration.
*
* @private
* @param {IPowerBiElement} element
- * @param {embed.IEmbedConfigurationBase} config
- * @returns {embed.Embed}
+ * @param {IEmbedConfigurationBase} config
+ * @returns {Embed}
* @hidden
*/
Service.prototype.embedExisting = function (element, config, phasedRender) {
var component = utils.find(function (x) { return x.element === element; }, this.embeds);
if (!component) {
- throw new Error("Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + " which already has embedded component associated, but could not find the existing component in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element.");
+ var scrubbedConfig = __assign(__assign({}, config), { accessToken: "" });
+ throw new Error("Attempted to embed using config ".concat(JSON.stringify(scrubbedConfig), " on element ").concat(element.outerHTML, " which already has embedded component associated, but could not find the existing component in the list of active components. This could indicate the embeds list is out of sync with the DOM, or the component is referencing the incorrect HTML element."));
}
// TODO: Multiple embedding to the same iframe is not supported in QnA
if (config.type && config.type.toLowerCase() === "qna") {
@@ -8693,7 +11827,7 @@ var Service = /** @class */ (function () {
/**
* When loading report after create we want to use existing Iframe to optimize load period
*/
- if (config.type === "report" && component.config.type === "create") {
+ if (config.type === "report" && utils.isCreate(component.config.type)) {
var report = new report_1.Report(this, element, config, /* phasedRender */ false, /* isBootstrap */ false, element.powerBiEmbed.iframe);
component.populateConfig(config, /* isBootstrap */ false);
report.load();
@@ -8701,7 +11835,8 @@ var Service = /** @class */ (function () {
this.addOrOverwriteEmbed(component, element);
return report;
}
- throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config " + JSON.stringify(config) + " on element " + element.outerHTML + ", but the existing element contains an embed of type: " + this.config.type + " which does not match the new type: " + config.type);
+ var scrubbedConfig = __assign(__assign({}, config), { accessToken: "" });
+ throw new Error("Embedding on an existing element with a different type than the previous embed object is not supported. Attempted to embed using config ".concat(JSON.stringify(scrubbedConfig), " on element ").concat(element.outerHTML, ", but the existing element contains an embed of type: ").concat(this.config.type, " which does not match the new type: ").concat(config.type));
}
component.populateConfig(config, /* isBootstrap */ false);
component.load(phasedRender);
@@ -8718,7 +11853,7 @@ var Service = /** @class */ (function () {
*/
Service.prototype.enableAutoEmbed = function () {
var _this = this;
- window.addEventListener('DOMContentLoaded', function (event) { return _this.init(document.body); }, false);
+ window.addEventListener('DOMContentLoaded', function (_event) { return _this.init(document.body); }, false);
};
/**
* Returns an instance of the component associated with the element.
@@ -8729,7 +11864,7 @@ var Service = /** @class */ (function () {
Service.prototype.get = function (element) {
var powerBiElement = element;
if (!powerBiElement.powerBiEmbed) {
- throw new Error("You attempted to get an instance of powerbi component associated with element: " + element.outerHTML + " but there was no associated instance.");
+ throw new Error("You attempted to get an instance of powerbi component associated with element: ".concat(element.outerHTML, " but there was no associated instance."));
}
return powerBiElement.powerBiEmbed;
};
@@ -8805,6 +11940,34 @@ var Service = /** @class */ (function () {
this.handleEvent(event);
}
};
+ Service.prototype.invokeSDKHook = function (hook, req, res) {
+ return __awaiter(this, void 0, void 0, function () {
+ var result, error_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if (!hook) {
+ res.send(404, null);
+ return [2 /*return*/];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, hook(req.body)];
+ case 2:
+ result = _a.sent();
+ res.send(200, result);
+ return [3 /*break*/, 4];
+ case 3:
+ error_1 = _a.sent();
+ res.send(400, null);
+ console.error(error_1);
+ return [3 /*break*/, 4];
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
/**
* Given an event object, finds the embed component with the matching type and ID, and invokes its handleEvent method with the event object.
*
@@ -8822,7 +11985,7 @@ var Service = /** @class */ (function () {
var pageKey = 'newPage';
var page = value[pageKey];
if (!page) {
- throw new Error("Page model not found at 'event.value." + pageKey + "'.");
+ throw new Error("Page model not found at 'event.value.".concat(pageKey, "'."));
}
value[pageKey] = new page_1.Page(embed, page.name, page.displayName, true /* isActive */);
}
@@ -8834,10 +11997,13 @@ var Service = /** @class */ (function () {
* Use this API to preload Power BI Embedded in the background.
*
* @public
- * @param {embed.IEmbedConfigurationBase} [config={}]
+ * @param {IEmbedConfigurationBase} [config={}]
* @param {HTMLElement} [element=undefined]
*/
Service.prototype.preload = function (config, element) {
+ if (!utils.validateEmbedUrl(config.embedUrl)) {
+ throw new Error(errors_1.invalidEmbedUrlErrorMessage);
+ }
var iframeContent = document.createElement("iframe");
iframeContent.setAttribute("style", "display:none;");
iframeContent.setAttribute("src", config.embedUrl);
@@ -8853,6 +12019,49 @@ var Service = /** @class */ (function () {
};
return iframeContent;
};
+ /**
+ * Use this API to set SDK info
+ *
+ * @hidden
+ * @param {string} type
+ * @returns {void}
+ */
+ Service.prototype.setSdkInfo = function (type, version) {
+ this.hpm.defaultHeaders['x-sdk-type'] = type;
+ this.hpm.defaultHeaders['x-sdk-wrapper-version'] = version;
+ };
+ /**
+ * API for registering external components
+ *
+ * @hidden
+ * @param {string} componentType
+ * @param {EmbedComponentFactory} embedComponentFactory
+ * @param {string[]} routerEventUrls
+ */
+ Service.prototype.register = function (componentType, embedComponentFactory, routerEventUrls) {
+ var _this = this;
+ if (utils.find(function (embedComponent) { return componentType.toLowerCase() === embedComponent.type.toLowerCase(); }, Service.components)) {
+ throw new Error('The component name is reserved. Cannot register a component with this name.');
+ }
+ if (utils.find(function (registeredComponentType) { return componentType.toLowerCase() === registeredComponentType.toLowerCase(); }, Object.keys(this.registeredComponents))) {
+ throw new Error('A component with this type is already registered.');
+ }
+ this.registeredComponents[componentType] = embedComponentFactory;
+ routerEventUrls.forEach(function (url) {
+ if (!url.includes(':uniqueId') || !url.includes(':eventName')) {
+ throw new Error('Invalid router event URL');
+ }
+ _this.router.post(url, function (req, _res) {
+ var event = {
+ type: componentType,
+ id: req.params.uniqueId,
+ name: req.params.eventName,
+ value: req.body
+ };
+ _this.handleEvent(event);
+ });
+ });
+ };
/**
* A list of components that this service can embed
*/
@@ -8887,9 +12096,10 @@ exports.Service = Service;
/*!*********************!*\
!*** ./src/tile.ts ***!
\*********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
@@ -8898,15 +12108,17 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Tile = void 0;
-var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
-var embed = __webpack_require__(/*! ./embed */ "./src/embed.ts");
+var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
/**
* The Power BI tile embed component
*
@@ -8945,7 +12157,7 @@ var Tile = /** @class */ (function (_super) {
*/
Tile.prototype.validate = function (config) {
var embedConfig = config;
- return models.validateTileLoad(embedConfig);
+ return (0, powerbi_models_1.validateTileLoad)(embedConfig);
};
/**
* Handle config changes.
@@ -8989,7 +12201,7 @@ var Tile = /** @class */ (function (_super) {
/** @hidden */
Tile.allowedEvents = ["tileClicked", "tileLoaded"];
return Tile;
-}(embed.Embed));
+}(embed_1.Embed));
exports.Tile = Tile;
@@ -8999,9 +12211,10 @@ exports.Tile = Tile;
/*!*********************!*\
!*** ./src/util.ts ***!
\*********************/
-/*! no static exports found */
-/***/ (function(module, exports) {
+/***/ (function(__unused_webpack_module, exports) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -9038,8 +12251,20 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
-exports.getTimeDiffInMilliseconds = exports.getRandomValue = exports.autoAuthInEmbedUrl = exports.isRDLEmbed = exports.isSavedInternal = exports.addParamToUrl = exports.generateUUID = exports.createRandomString = exports.assign = exports.remove = exports.find = exports.findIndex = exports.raiseCustomEvent = void 0;
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.validateEmbedUrl = exports.isCreate = exports.getTimeDiffInMilliseconds = exports.getRandomValue = exports.autoAuthInEmbedUrl = exports.isRDLEmbed = exports.isSavedInternal = exports.addParamToUrl = exports.generateUUID = exports.createRandomString = exports.assign = exports.remove = exports.find = exports.findIndex = exports.raiseCustomEvent = void 0;
+/**
+ * @hidden
+ */
+var allowedPowerBiHostsRegex = new RegExp(/(.+\.powerbi\.com$)|(.+\.fabric\.microsoft\.com$)|(.+\.analysis\.windows-int\.net$)|(.+\.analysis-df\.windows\.net$)/);
+/**
+ * @hidden
+ */
+var allowedPowerBiHostsSovRegex = new RegExp(/^app\.powerbi\.cn$|^app(\.mil\.|\.high\.|\.)powerbigov\.us$|^app\.powerbi\.eaglex\.ic\.gov$|^app\.powerbi\.microsoft\.scloud$/);
+/**
+ * @hidden
+ */
+var expectedEmbedUrlProtocol = "https:";
/**
* Raises a custom event with event data on the specified HTML element.
*
@@ -9075,7 +12300,7 @@ exports.raiseCustomEvent = raiseCustomEvent;
*/
function findIndex(predicate, xs) {
if (!Array.isArray(xs)) {
- throw new Error("You attempted to call find with second parameter that was not an array. You passed: " + xs);
+ throw new Error("You attempted to call find with second parameter that was not an array. You passed: ".concat(xs));
}
var index;
xs.some(function (x, i) {
@@ -9160,7 +12385,7 @@ function generateUUID() {
if (typeof performance !== 'undefined' && typeof performance.now === 'function') {
d += performance.now();
}
- return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+ return 'xxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (_c) {
// Generate a random number, scaled from 0 to 15.
var r = (getRandomValue() % 16);
// Shift 4 times to divide by 16
@@ -9221,7 +12446,7 @@ exports.isSavedInternal = isSavedInternal;
* @returns {boolean}
*/
function isRDLEmbed(embedUrl) {
- return embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0;
+ return embedUrl && embedUrl.toLowerCase().indexOf("/rdlembed?") >= 0;
}
exports.isRDLEmbed = isRDLEmbed;
/**
@@ -9248,6 +12473,7 @@ function getRandomValue() {
exports.getRandomValue = getRandomValue;
/**
* Returns the time interval between two dates in milliseconds
+ *
* @export
* @param {Date} start
* @param {Date} end
@@ -9257,6 +12483,36 @@ function getTimeDiffInMilliseconds(start, end) {
return Math.abs(start.getTime() - end.getTime());
}
exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds;
+/**
+ * Checks if the embed type is for create
+ *
+ * @export
+ * @param {string} embedType
+ * @returns {boolean}
+ */
+function isCreate(embedType) {
+ return embedType === 'create' || embedType === 'quickcreate';
+}
+exports.isCreate = isCreate;
+/**
+ * Checks if the embedUrl has an allowed power BI domain
+ * @hidden
+ */
+function validateEmbedUrl(embedUrl) {
+ if (embedUrl) {
+ var url = void 0;
+ try {
+ url = new URL(embedUrl.toLowerCase());
+ }
+ catch (e) {
+ // invalid URL
+ return false;
+ }
+ return url.protocol === expectedEmbedUrlProtocol &&
+ (allowedPowerBiHostsRegex.test(url.hostname) || allowedPowerBiHostsSovRegex.test(url.hostname));
+ }
+}
+exports.validateEmbedUrl = validateEmbedUrl;
/***/ }),
@@ -9265,9 +12521,10 @@ exports.getTimeDiffInMilliseconds = getTimeDiffInMilliseconds;
/*!***********************!*\
!*** ./src/visual.ts ***!
\***********************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
@@ -9276,6 +12533,8 @@ var __extends = (this && this.__extends) || (function () {
return extendStatics(d, b);
};
return function (d, b) {
+ if (typeof b !== "function" && b !== null)
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -9317,7 +12576,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Visual = void 0;
var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts");
@@ -9409,7 +12668,7 @@ var Visual = /** @class */ (function (_super) {
* @param {string} pageName
* @returns {Promise>}
*/
- Visual.prototype.setPage = function (pageName) {
+ Visual.prototype.setPage = function (_pageName) {
throw Visual.SetPageNotSupportedError;
};
/**
@@ -9418,7 +12677,7 @@ var Visual = /** @class */ (function (_super) {
* @hidden
* @returns {Promise}
*/
- Visual.prototype.render = function (config) {
+ Visual.prototype.render = function (_config) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
throw Visual.RenderNotSupportedError;
@@ -9445,7 +12704,7 @@ var Visual = /** @class */ (function (_super) {
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.service.hpm.get("/report/pages/" + config.pageName + "/visuals", { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ return [4 /*yield*/, this.service.hpm.get("/report/pages/".concat(config.pageName, "/visuals"), { uid: this.config.uniqueId }, this.iframe.contentWindow)];
case 2:
response = _a.sent();
embeddedVisuals = response.body.filter(function (pageVisual) { return pageVisual.name === config.visualName; });
@@ -9534,7 +12793,7 @@ var Visual = /** @class */ (function (_super) {
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.service.hpm.put(url, updateFiltersRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
+ return [4 /*yield*/, this.service.hpm.post(url, updateFiltersRequest, { uid: this.config.uniqueId }, this.iframe.contentWindow)];
case 2: return [2 /*return*/, _a.sent()];
case 3:
response_3 = _a.sent();
@@ -9611,9 +12870,9 @@ var Visual = /** @class */ (function (_super) {
case powerbi_models_1.FiltersLevel.Report:
return "/report/filters";
case powerbi_models_1.FiltersLevel.Page:
- return "/report/pages/" + config.pageName + "/filters";
+ return "/report/pages/".concat(config.pageName, "/filters");
default:
- return "/report/pages/" + config.pageName + "/visuals/" + config.visualName + "/filters";
+ return "/report/pages/".concat(config.pageName, "/visuals/").concat(config.visualName, "/filters");
}
};
/** @hidden */
@@ -9635,9 +12894,10 @@ exports.Visual = Visual;
/*!*********************************!*\
!*** ./src/visualDescriptor.ts ***!
\*********************************/
-/*! no static exports found */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
@@ -9674,7 +12934,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
-Object.defineProperty(exports, "__esModule", { value: true });
+Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.VisualDescriptor = void 0;
var powerbi_models_1 = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
/**
@@ -9712,7 +12972,7 @@ var VisualDescriptor = /** @class */ (function () {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/filters"), { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
case 1:
response = _a.sent();
return [2 /*return*/, response.body];
@@ -9748,7 +13008,7 @@ var VisualDescriptor = /** @class */ (function () {
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", updateFiltersRequest, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/filters"), updateFiltersRequest, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
case 2: return [2 /*return*/, _a.sent()];
case 3:
response_2 = _a.sent();
@@ -9795,7 +13055,7 @@ var VisualDescriptor = /** @class */ (function () {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/filters", filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/filters"), filters, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
case 1: return [2 /*return*/, _a.sent()];
case 2:
response_3 = _a.sent();
@@ -9808,6 +13068,7 @@ var VisualDescriptor = /** @class */ (function () {
/**
* Exports Visual data.
* Can export up to 30K rows.
+ *
* @param rows: Optional. Default value is 30K, maximum value is 30K as well.
* @param exportDataType: Optional. Default is ExportDataType.Summarized.
* ```javascript
@@ -9830,7 +13091,7 @@ var VisualDescriptor = /** @class */ (function () {
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 4]);
- return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/exportData", exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/exportData"), exportDataRequestBody, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
case 2:
response = _a.sent();
return [2 /*return*/, response.body];
@@ -9845,6 +13106,7 @@ var VisualDescriptor = /** @class */ (function () {
/**
* Set slicer state.
* Works only for visuals of type slicer.
+ *
* @param state: A new state which contains the slicer filters.
* ```javascript
* visual.setSlicerState()
@@ -9858,7 +13120,7 @@ var VisualDescriptor = /** @class */ (function () {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/slicer"), state, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
case 1: return [2 /*return*/, _a.sent()];
case 2:
response_5 = _a.sent();
@@ -9886,7 +13148,7 @@ var VisualDescriptor = /** @class */ (function () {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/" + this.page.name + "/visuals/" + this.name + "/slicer", { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/slicer"), { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
case 1:
response = _a.sent();
return [2 /*return*/, response.body];
@@ -9911,7 +13173,7 @@ var VisualDescriptor = /** @class */ (function () {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/" + this.page.name + "/visuals/" + this.name + "/clone", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.page.report.service.hpm.post("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/clone"), request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
case 1:
response = _a.sent();
return [2 /*return*/, response.body];
@@ -9940,7 +13202,7 @@ var VisualDescriptor = /** @class */ (function () {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
- return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/" + this.page.name + "/visuals/" + this.name + "/sortBy", request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ return [4 /*yield*/, this.page.report.service.hpm.put("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/sortBy"), request, { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
case 1: return [2 /*return*/, _a.sent()];
case 2:
response_8 = _a.sent();
@@ -9950,13 +13212,214 @@ var VisualDescriptor = /** @class */ (function () {
});
});
};
+ /**
+ * Updates the position of a visual.
+ *
+ * ```javascript
+ * visual.moveVisual(x, y, z)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ * @returns {Promise>}
+ */
+ VisualDescriptor.prototype.moveVisual = function (x, y, z) {
+ return __awaiter(this, void 0, void 0, function () {
+ var pageName, visualName, report;
+ return __generator(this, function (_a) {
+ pageName = this.page.name;
+ visualName = this.name;
+ report = this.page.report;
+ return [2 /*return*/, report.moveVisual(pageName, visualName, x, y, z)];
+ });
+ });
+ };
+ /**
+ * Updates the display state of a visual.
+ *
+ * ```javascript
+ * visual.setVisualDisplayState(displayState)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {VisualContainerDisplayMode} displayState
+ * @returns {Promise>}
+ */
+ VisualDescriptor.prototype.setVisualDisplayState = function (displayState) {
+ return __awaiter(this, void 0, void 0, function () {
+ var pageName, visualName, report;
+ return __generator(this, function (_a) {
+ pageName = this.page.name;
+ visualName = this.name;
+ report = this.page.report;
+ return [2 /*return*/, report.setVisualDisplayState(pageName, visualName, displayState)];
+ });
+ });
+ };
+ /**
+ * Resize a visual.
+ *
+ * ```javascript
+ * visual.resizeVisual(width, height)
+ * .catch(error => { ... });
+ * ```
+ *
+ * @param {number} width
+ * @param {number} height
+ * @returns {Promise>}
+ */
+ VisualDescriptor.prototype.resizeVisual = function (width, height) {
+ return __awaiter(this, void 0, void 0, function () {
+ var pageName, visualName, report;
+ return __generator(this, function (_a) {
+ pageName = this.page.name;
+ visualName = this.name;
+ report = this.page.report;
+ return [2 /*return*/, report.resizeVisual(pageName, visualName, width, height)];
+ });
+ });
+ };
+ /**
+ * Get insights for single visual
+ *
+ * ```javascript
+ * visual.getSmartNarrativeInsights();
+ * ```
+ *
+ * @returns {Promise}
+ */
+ VisualDescriptor.prototype.getSmartNarrativeInsights = function () {
+ return __awaiter(this, void 0, void 0, function () {
+ var response, response_9;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, 2, , 3]);
+ return [4 /*yield*/, this.page.report.service.hpm.get("/report/pages/".concat(this.page.name, "/visuals/").concat(this.name, "/smartNarrativeInsights"), { uid: this.page.report.config.uniqueId }, this.page.report.iframe.contentWindow)];
+ case 1:
+ response = _a.sent();
+ return [2 /*return*/, response.body];
+ case 2:
+ response_9 = _a.sent();
+ throw response_9.body;
+ case 3: return [2 /*return*/];
+ }
+ });
+ });
+ };
return VisualDescriptor;
}());
exports.VisualDescriptor = VisualDescriptor;
+/***/ }),
+
+/***/ "./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js":
+/*!*******************************************************************************!*\
+ !*** ./node_modules/window-post-message-proxy/dist/windowPostMessageProxy.js ***!
+ \*******************************************************************************/
+/***/ ((module) => {
+
+/*! For license information please see windowPostMessageProxy.js.LICENSE.txt */
+!function(e,r){ true?module.exports=r():0}(self,(()=>(()=>{"use strict";var e={};return(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.WindowPostMessageProxy=void 0;var s=function(){function e(r){void 0===r&&(r={processTrackingProperties:{addTrackingProperties:e.defaultAddTrackingProperties,getTrackingProperties:e.defaultGetTrackingProperties},isErrorMessage:e.defaultIsErrorMessage,receiveWindow:window,name:e.createRandomString()});var s=this;this.pendingRequestPromises={},this.addTrackingProperties=r.processTrackingProperties&&r.processTrackingProperties.addTrackingProperties||e.defaultAddTrackingProperties,this.getTrackingProperties=r.processTrackingProperties&&r.processTrackingProperties.getTrackingProperties||e.defaultGetTrackingProperties,this.isErrorMessage=r.isErrorMessage||e.defaultIsErrorMessage,this.receiveWindow=r.receiveWindow||window,this.name=r.name||e.createRandomString(),this.logMessages=r.logMessages||!1,this.eventSourceOverrideWindow=r.eventSourceOverrideWindow,this.suppressWarnings=r.suppressWarnings||!1,this.logMessages&&console.log("new WindowPostMessageProxy created with name: ".concat(this.name," receiving on window: ").concat(this.receiveWindow.document.title)),this.handlers=[],this.windowMessageHandler=function(e){return s.onMessageReceived(e)},this.start()}return e.defaultAddTrackingProperties=function(r,s){return r[e.messagePropertyName]=s,r},e.defaultGetTrackingProperties=function(r){return r[e.messagePropertyName]},e.defaultIsErrorMessage=function(e){return!!e.error},e.createDeferred=function(){var e={resolve:null,reject:null,promise:null},r=new Promise((function(r,s){e.resolve=r,e.reject=s}));return e.promise=r,e},e.createRandomString=function(){var e=window.crypto||window.msCrypto,r=new Uint32Array(1);return e.getRandomValues(r),r[0].toString(36).substring(1)},e.prototype.addHandler=function(e){this.handlers.push(e)},e.prototype.removeHandler=function(e){var r=this.handlers.indexOf(e);if(-1===r)throw new Error("You attempted to remove a handler but no matching handler was found.");this.handlers.splice(r,1)},e.prototype.start=function(){this.receiveWindow.addEventListener("message",this.windowMessageHandler)},e.prototype.stop=function(){this.receiveWindow.removeEventListener("message",this.windowMessageHandler)},e.prototype.postMessage=function(r,s){var n={id:e.createRandomString()};this.addTrackingProperties(s,n),this.logMessages&&(console.log("".concat(this.name," Posting message:")),console.log(JSON.stringify(s,null," "))),r.postMessage(s,"*");var o=e.createDeferred();return this.pendingRequestPromises[n.id]=o,o.promise},e.prototype.sendResponse=function(e,r,s){this.addTrackingProperties(r,s),this.logMessages&&(console.log("".concat(this.name," Sending response:")),console.log(JSON.stringify(r,null," "))),e.postMessage(r,"*")},e.prototype.onMessageReceived=function(e){var r=this;this.logMessages&&(console.log("".concat(this.name," Received message:")),console.log("type: ".concat(e.type)),console.log(JSON.stringify(e.data,null," ")));var s=this.eventSourceOverrideWindow||e.source;if(s){var n=e.data;if("object"==typeof n){var o,t;try{o=this.getTrackingProperties(n)}catch(e){this.suppressWarnings||console.warn("Proxy(".concat(this.name,"): Error occurred when attempting to get tracking properties from incoming message:"),JSON.stringify(n,null," "),"Error: ",e)}if(o&&(t=this.pendingRequestPromises[o.id]),t){var i=!0;try{i=this.isErrorMessage(n)}catch(e){console.warn("Proxy(".concat(this.name,") Error occurred when trying to determine if message is consider an error response. Message: "),JSON.stringify(n,null,""),"Error: ",e)}i?t.reject(n):t.resolve(n),delete this.pendingRequestPromises[o.id]}else this.handlers.some((function(e){var t=!1;try{t=e.test(n)}catch(e){r.suppressWarnings||console.warn("Proxy(".concat(r.name,"): Error occurred when handler was testing incoming message:"),JSON.stringify(n,null," "),"Error: ",e)}if(t){var i=void 0;try{i=Promise.resolve(e.handle(n))}catch(e){r.suppressWarnings||console.warn("Proxy(".concat(r.name,"): Error occurred when handler was processing incoming message:"),JSON.stringify(n,null," "),"Error: ",e),i=Promise.resolve()}return i.then((function(e){if(!e){var t="Handler for message: ".concat(JSON.stringify(n,null," ")," did not return a response message. The default response message will be returned instead.");r.suppressWarnings||console.warn("Proxy(".concat(r.name,"): ").concat(t)),e={warning:t}}r.sendResponse(s,e,o)})),!0}}))||this.suppressWarnings||console.warn("Proxy(".concat(this.name,") did not handle message. Handlers: ").concat(this.handlers.length," Message: ").concat(JSON.stringify(n,null,""),"."))}else this.suppressWarnings||console.warn("Proxy(".concat(this.name,"): Received message that was not an object. Discarding message"))}},e.messagePropertyName="windowPostMessageProxy",e}();r.WindowPostMessageProxy=s})(),e})()));
+//# sourceMappingURL=windowPostMessageProxy.js.map
+
/***/ })
-/******/ });
+/******/ });
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/************************************************************************/
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it uses a non-standard name for the exports (exports).
+(() => {
+var exports = __webpack_exports__;
+/*!*******************************!*\
+ !*** ./src/powerbi-client.ts ***!
+ \*******************************/
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.RelativeTimeFilterBuilder = exports.RelativeDateFilterBuilder = exports.TopNFilterBuilder = exports.AdvancedFilterBuilder = exports.BasicFilterBuilder = exports.Create = exports.QuickCreate = exports.VisualDescriptor = exports.Visual = exports.Qna = exports.Page = exports.Embed = exports.Tile = exports.Dashboard = exports.Report = exports.models = exports.factories = exports.service = void 0;
+/**
+ * @hidden
+ */
+var models = __webpack_require__(/*! powerbi-models */ "./node_modules/powerbi-models/dist/models.js");
+exports.models = models;
+var service = __webpack_require__(/*! ./service */ "./src/service.ts");
+exports.service = service;
+var factories = __webpack_require__(/*! ./factories */ "./src/factories.ts");
+exports.factories = factories;
+var report_1 = __webpack_require__(/*! ./report */ "./src/report.ts");
+Object.defineProperty(exports, "Report", ({ enumerable: true, get: function () { return report_1.Report; } }));
+var dashboard_1 = __webpack_require__(/*! ./dashboard */ "./src/dashboard.ts");
+Object.defineProperty(exports, "Dashboard", ({ enumerable: true, get: function () { return dashboard_1.Dashboard; } }));
+var tile_1 = __webpack_require__(/*! ./tile */ "./src/tile.ts");
+Object.defineProperty(exports, "Tile", ({ enumerable: true, get: function () { return tile_1.Tile; } }));
+var embed_1 = __webpack_require__(/*! ./embed */ "./src/embed.ts");
+Object.defineProperty(exports, "Embed", ({ enumerable: true, get: function () { return embed_1.Embed; } }));
+var page_1 = __webpack_require__(/*! ./page */ "./src/page.ts");
+Object.defineProperty(exports, "Page", ({ enumerable: true, get: function () { return page_1.Page; } }));
+var qna_1 = __webpack_require__(/*! ./qna */ "./src/qna.ts");
+Object.defineProperty(exports, "Qna", ({ enumerable: true, get: function () { return qna_1.Qna; } }));
+var visual_1 = __webpack_require__(/*! ./visual */ "./src/visual.ts");
+Object.defineProperty(exports, "Visual", ({ enumerable: true, get: function () { return visual_1.Visual; } }));
+var visualDescriptor_1 = __webpack_require__(/*! ./visualDescriptor */ "./src/visualDescriptor.ts");
+Object.defineProperty(exports, "VisualDescriptor", ({ enumerable: true, get: function () { return visualDescriptor_1.VisualDescriptor; } }));
+var quickCreate_1 = __webpack_require__(/*! ./quickCreate */ "./src/quickCreate.ts");
+Object.defineProperty(exports, "QuickCreate", ({ enumerable: true, get: function () { return quickCreate_1.QuickCreate; } }));
+var create_1 = __webpack_require__(/*! ./create */ "./src/create.ts");
+Object.defineProperty(exports, "Create", ({ enumerable: true, get: function () { return create_1.Create; } }));
+var FilterBuilders_1 = __webpack_require__(/*! ./FilterBuilders */ "./src/FilterBuilders/index.ts");
+Object.defineProperty(exports, "BasicFilterBuilder", ({ enumerable: true, get: function () { return FilterBuilders_1.BasicFilterBuilder; } }));
+Object.defineProperty(exports, "AdvancedFilterBuilder", ({ enumerable: true, get: function () { return FilterBuilders_1.AdvancedFilterBuilder; } }));
+Object.defineProperty(exports, "TopNFilterBuilder", ({ enumerable: true, get: function () { return FilterBuilders_1.TopNFilterBuilder; } }));
+Object.defineProperty(exports, "RelativeDateFilterBuilder", ({ enumerable: true, get: function () { return FilterBuilders_1.RelativeDateFilterBuilder; } }));
+Object.defineProperty(exports, "RelativeTimeFilterBuilder", ({ enumerable: true, get: function () { return FilterBuilders_1.RelativeTimeFilterBuilder; } }));
+/**
+ * Makes Power BI available to the global object for use in applications that don't have module loading support.
+ *
+ * Note: create an instance of the class with the default configuration for normal usage, or save the class so that you can create an instance of the service.
+ */
+var powerbi = new service.Service(factories.hpmFactory, factories.wpmpFactory, factories.routerFactory);
+// powerBI SDK may use Power BI object under different key, in order to avoid name collisions
+if (window.powerbi && window.powerBISDKGlobalServiceInstanceName) {
+ window[window.powerBISDKGlobalServiceInstanceName] = powerbi;
+}
+else {
+ // Default to Power BI.
+ window.powerbi = powerbi;
+}
+
+})();
+
+/******/ return __webpack_exports__;
+/******/ })()
+;
});
//# sourceMappingURL=powerbi.js.map
\ No newline at end of file
diff --git a/dist/powerbi.min.js b/dist/powerbi.min.js
index 9d57b9c1..56b87200 100644
--- a/dist/powerbi.min.js
+++ b/dist/powerbi.min.js
@@ -1,10 +1,5 @@
-/*! powerbi-client v2.17.1 | (c) 2016 Microsoft Corporation MIT */
-!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["powerbi-client"]=e():t["powerbi-client"]=e()}(this,(function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=12)}([function(t,e,r){
-/*! powerbi-models v1.8.0 | (c) 2016 Microsoft Corporation MIT */
-var a;a=function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(a,i,function(e){return t[e]}.bind(null,i));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateUpdateFiltersRequest=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateCreateReport=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.AdvancedFilter=e.TupleFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.FiltersOperations=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0;var o,n=r(1);!function(t){t[t.Information=0]="Information",t[t.Verbose=1]="Verbose",t[t.Warning=2]="Warning",t[t.Error=3]="Error",t[t.ExpectedError=4]="ExpectedError",t[t.UnexpectedError=5]="UnexpectedError",t[t.Fatal=6]="Fatal"}(e.TraceType||(e.TraceType={})),function(t){t[t.Widescreen=0]="Widescreen",t[t.Standard=1]="Standard",t[t.Cortana=2]="Cortana",t[t.Letter=3]="Letter",t[t.Custom=4]="Custom"}(e.PageSizeType||(e.PageSizeType={})),function(t){t[t.FitToPage=0]="FitToPage",t[t.FitToWidth=1]="FitToWidth",t[t.ActualSize=2]="ActualSize"}(e.DisplayOption||(e.DisplayOption={})),function(t){t[t.Default=0]="Default",t[t.Transparent=1]="Transparent"}(e.BackgroundType||(e.BackgroundType={})),function(t){t[t.Visible=0]="Visible",t[t.Hidden=1]="Hidden"}(e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={})),function(t){t[t.Master=0]="Master",t[t.Custom=1]="Custom",t[t.MobilePortrait=2]="MobilePortrait",t[t.MobileLandscape=3]="MobileLandscape"}(e.LayoutType||(e.LayoutType={})),function(t){t[t.Navigate=0]="Navigate",t[t.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",t[t.RaiseEvent=2]="RaiseEvent"}(e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={})),function(t){t[t.AlwaysVisible=0]="AlwaysVisible",t[t.HiddenInViewMode=1]="HiddenInViewMode"}(e.SectionVisibility||(e.SectionVisibility={})),function(t){t[t.Read=0]="Read",t[t.ReadWrite=1]="ReadWrite",t[t.Copy=2]="Copy",t[t.Create=4]="Create",t[t.All=7]="All"}(e.Permissions||(e.Permissions={})),function(t){t[t.View=0]="View",t[t.Edit=1]="Edit"}(e.ViewMode||(e.ViewMode={})),function(t){t[t.Aad=0]="Aad",t[t.Embed=1]="Embed"}(e.TokenType||(e.TokenType={})),function(t){t[t.None=0]="None",t[t.HighContrast1=1]="HighContrast1",t[t.HighContrast2=2]="HighContrast2",t[t.HighContrastBlack=3]="HighContrastBlack",t[t.HighContrastWhite=4]="HighContrastWhite"}(e.ContrastMode||(e.ContrastMode={})),function(t){t[t.Bottom=0]="Bottom",t[t.Top=1]="Top"}(e.MenuLocation||(e.MenuLocation={})),function(t){t[t.RemoveAll=0]="RemoveAll",t[t.ReplaceAll=1]="ReplaceAll",t[t.Add=2]="Add",t[t.Replace=3]="Replace"}(e.FiltersOperations||(e.FiltersOperations={})),function(t){t[t.Report=0]="Report",t[t.Page=1]="Page",t[t.Visual=2]="Visual"}(e.FiltersLevel||(e.FiltersLevel={})),function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime"}(o=e.FilterType||(e.FilterType={})),function(t){t[t.Days=0]="Days",t[t.Weeks=1]="Weeks",t[t.CalendarWeeks=2]="CalendarWeeks",t[t.Months=3]="Months",t[t.CalendarMonths=4]="CalendarMonths",t[t.Years=5]="Years",t[t.CalendarYears=6]="CalendarYears",t[t.Minutes=7]="Minutes",t[t.Hours=8]="Hours"}(e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={})),function(t){t[t.InLast=0]="InLast",t[t.InThis=1]="InThis",t[t.InNext=2]="InNext"}(e.RelativeDateOperators||(e.RelativeDateOperators={}));var l=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=l;var s=function(t){function e(r,a,i){var n=t.call(this,r,o.Unknown)||this;return n.message=a,n.notSupportedTypeName=i,n.schemaUrl=e.schemaUrl,n}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(l);e.NotSupportedFilter=s;var d=function(t){function e(r,a,i){var n=t.call(this,r,o.IncludeExclude)||this;return n.values=i,n.isExclude=a,n.schemaUrl=e.schemaUrl,n}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(l);e.IncludeExcludeFilter=d;var u=function(t){function e(r,a,i,n){var l=t.call(this,r,o.TopN)||this;return l.operator=a,l.itemCount=i,l.schemaUrl=e.schemaUrl,l.orderBy=n,l}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(l);e.TopNFilter=u;var c=function(t){function e(r,a,i,n,l){var s=t.call(this,r,o.RelativeDate)||this;return s.operator=a,s.timeUnitsCount=i,s.timeUnitType=n,s.includeToday=l,s.schemaUrl=e.schemaUrl,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(l);e.RelativeDateFilter=c;var p=function(t){function e(r,a,i,n){var l=t.call(this,r,o.RelativeTime)||this;return l.operator=a,l.timeUnitsCount=i,l.timeUnitType=n,l.schemaUrl=e.schemaUrl,l}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(l);e.RelativeTimeFilter=p;var f=function(t){function e(r,a){for(var i=[],n=2;n0&&!i)throw new Error("You should pass the values to be filtered for each key. You passed: no values and "+n+" keys");if(0===n&&i&&i.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: "+i.length);if(1===l.length&&"And"!==a)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(l);function m(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function V(t){return!(!t.table||!t.column||t.aggregationFunction)}e.AdvancedFilter=y,e.isFilterKeyColumnsTarget=function(t){return V(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return m(t)===o.Basic&&!!t.keyValues},e.getFilterType=m,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=V,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},function(t){t[t.Bottom=0]="Bottom",t[t.Left=1]="Left"}(e.PageNavigationPosition||(e.PageNavigationPosition={})),function(t){t[t.Interactive=0]="Interactive",t[t.ResultOnly=1]="ResultOnly"}(e.QnaMode||(e.QnaMode={})),function(t){t[t.Summarized=0]="Summarized",t[t.Underlying=1]="Underlying"}(e.ExportDataType||(e.ExportDataType={})),function(t){t[t.Off=0]="Off",t[t.Presentation=1]="Presentation"}(e.BookmarksPlayMode||(e.BookmarksPlayMode={})),e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},function(t){t[t.Ascending=1]="Ascending",t[t.Descending=2]="Descending"}(e.SortDirection||(e.SortDirection={}));var g=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=g;var b=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.pageName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(g);e.PageSelector=b;var w=function(t){function e(r){var a=t.call(this,e.schemaUrl)||this;return a.visualName=r,a}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(g);e.VisualSelector=w;var P=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.visualType=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(g);e.VisualTypeSelector=P;var _=function(t){function e(e){var r=t.call(this,w.schemaUrl)||this;return r.target=e,r}return i(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(g);function S(t){return t&&!!t.groupName}function E(t){return Array.isArray(t)}function O(t){var e=t.message;return e||(e=t.path+" is invalid. Not meeting "+t.keyword+" constraint"),{message:e}}e.SlicerTargetSelector=_,function(t){t[t.Enabled=0]="Enabled",t[t.Disabled=1]="Disabled",t[t.Hidden=2]="Hidden"}(e.CommandDisplayOption||(e.CommandDisplayOption={})),function(t){t[t.Grouping=0]="Grouping",t[t.Measure=1]="Measure",t[t.GroupingOrMeasure=2]="GroupingOrMeasure"}(e.VisualDataRoleKind||(e.VisualDataRoleKind={})),function(t){t[t.Measure=0]="Measure",t[t.Grouping=1]="Grouping"}(e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={})),e.isFlatMenuExtension=function(t){return t&&!S(t)},e.isGroupedMenuExtension=S,e.isIExtensions=function(t){return t&&!E(t)},e.isIExtensionArray=E,e.validateVisualSelector=function(t){var e=n.Validators.visualSelectorValidator.validate(t);return e?e.map(O):void 0},e.validateSlicer=function(t){var e=n.Validators.slicerValidator.validate(t);return e?e.map(O):void 0},e.validateSlicerState=function(t){var e=n.Validators.slicerStateValidator.validate(t);return e?e.map(O):void 0},e.validatePlayBookmarkRequest=function(t){var e=n.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateAddBookmarkRequest=function(t){var e=n.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=n.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(O):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=n.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(O):void 0},e.validateCaptureBookmarkRequest=function(t){var e=n.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSettings=function(t){var e=n.Validators.settingsValidator.validate(t);return e?e.map(O):void 0},e.validatePanes=function(t){var e=n.Validators.reportPanesValidator.validate(t);return e?e.map(O):void 0},e.validateBookmarksPane=function(t){var e=n.Validators.bookmarksPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFiltersPane=function(t){var e=n.Validators.filtersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateFieldsPane=function(t){var e=n.Validators.fieldsPaneValidator.validate(t);return e?e.map(O):void 0},e.validatePageNavigationPane=function(t){var e=n.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSelectionPane=function(t){var e=n.Validators.selectionPaneValidator.validate(t);return e?e.map(O):void 0},e.validateSyncSlicersPane=function(t){var e=n.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(O):void 0},e.validateVisualizationsPane=function(t){var e=n.Validators.visualizationsPaneValidator.validate(t);return e?e.map(O):void 0},e.validateCustomPageSize=function(t){var e=n.Validators.customPageSizeValidator.validate(t);return e?e.map(O):void 0},e.validateExtension=function(t){var e=n.Validators.extensionValidator.validate(t);return e?e.map(O):void 0},e.validateMenuGroupExtension=function(t){var e=n.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(O):void 0},e.validateReportLoad=function(t){var e=n.Validators.reportLoadValidator.validate(t);return e?e.map(O):void 0},e.validateCreateReport=function(t){var e=n.Validators.reportCreateValidator.validate(t);return e?e.map(O):void 0},e.validateDashboardLoad=function(t){var e=n.Validators.dashboardLoadValidator.validate(t);return e?e.map(O):void 0},e.validateTileLoad=function(t){var e=n.Validators.tileLoadValidator.validate(t);return e?e.map(O):void 0},e.validatePage=function(t){var e=n.Validators.pageValidator.validate(t);return e?e.map(O):void 0},e.validateFilter=function(t){var e=n.Validators.filterValidator.validate(t);return e?e.map(O):void 0},e.validateUpdateFiltersRequest=function(t){var e=n.Validators.updateFiltersRequestValidator.validate(t);return e?e.map(O):void 0},e.validateSaveAsParameters=function(t){var e=n.Validators.saveAsParametersValidator.validate(t);return e?e.map(O):void 0},e.validateLoadQnaConfiguration=function(t){var e=n.Validators.loadQnaValidator.validate(t);return e?e.map(O):void 0},e.validateQnaInterpretInputData=function(t){var e=n.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(O):void 0},e.validateExportDataRequest=function(t){var e=n.Validators.exportDataRequestValidator.validate(t);return e?e.map(O):void 0},e.validateVisualHeader=function(t){var e=n.Validators.visualHeaderValidator.validate(t);return e?e.map(O):void 0},e.validateVisualSettings=function(t){var e=n.Validators.visualSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCommandsSettings=function(t){var e=n.Validators.commandsSettingsValidator.validate(t);return e?e.map(O):void 0},e.validateCustomTheme=function(t){var e=n.Validators.customThemeValidator.validate(t);return e?e.map(O):void 0}},function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var a=r(2),i=r(5),o=r(6),n=r(7),l=r(8),s=r(9),d=r(10),u=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),_=r(24),S=r(25),E=r(26),O=r(27),T=r(28),F=r(4);e.Validators={addBookmarkRequestValidator:new i.AddBookmarkRequestValidator,advancedFilterTypeValidator:new F.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new F.ArrayValidator([new S.AnyOfValidator([new F.StringValidator,new F.NumberValidator,new F.BooleanValidator])]),anyFilterValidator:new S.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator]),anyValueValidator:new S.AnyOfValidator([new F.StringValidator,new F.NumberValidator,new F.BooleanValidator]),actionBarValidator:new a.ActionBarValidator,applyBookmarkByNameRequestValidator:new i.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new i.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new S.AnyOfValidator([new i.ApplyBookmarkByNameRequestValidator,new i.ApplyBookmarkStateRequestValidator]),backgroundValidator:new F.EnumValidator([0,1]),basicFilterTypeValidator:new F.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new F.BooleanArrayValidator,booleanValidator:new F.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new i.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new i.CaptureBookmarkRequestValidator,commandDisplayOptionValidator:new F.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new F.ArrayValidator([new u.CommandExtensionValidator]),commandExtensionValidator:new u.CommandExtensionValidator,commandsSettingsArrayValidator:new F.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new F.EnumValidator([0,1,2,3,4]),customLayoutDisplayOptionValidator:new F.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,datasetBindingValidator:new s.DatasetBindingValidator,displayStateModeValidator:new F.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new d.ExportDataRequestValidator,extensionArrayValidator:new F.ArrayValidator([new u.ExtensionValidator]),extensionsValidator:new S.AnyOfValidator([new F.ArrayValidator([new u.ExtensionValidator]),new u.ExtensionsValidator]),extensionPointsValidator:new u.ExtensionPointsValidator,extensionValidator:new u.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new O.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterDisplaySettingsValidator:new c.FilterDisplaySettingsValidator,filterConditionsValidator:new F.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator]),filterValidator:new c.FilterValidator,filterTypeValidator:new F.EnumValidator([0,1,2,3,4,5,6,7]),filtersArrayValidator:new F.ArrayValidator([new c.FilterValidator]),filtersOperationsUpdateValidator:new F.EnumValidator([1,2,3]),filtersOperationsRemoveAllValidator:new F.EnumValidator([0]),filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new F.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new F.EnumValidator([3]),layoutTypeValidator:new F.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new S.AnyOfValidator([new u.FlatMenuExtensionValidator,new u.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new F.ArrayValidator([new u.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new u.MenuGroupExtensionValidator,menuLocationValidator:new F.EnumValidator([0,1]),notSupportedFilterTypeValidator:new F.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new F.NumberArrayValidator,numberValidator:new F.NumberValidator,pageLayoutValidator:new T.MapValidator([new F.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new F.EnumValidator([0,1]),pageSizeTypeValidator:new F.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new T.MapValidator([new F.StringValidator],[new p.PageLayoutValidator]),reportBarsValidator:new a.ReportBarsValidator,reportPanesValidator:new h.ReportPanesValidator,permissionsValidator:new F.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new i.PlayBookmarkRequestValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaSettingValidator:new v.QnaSettingsValidator,relativeDateFilterOperatorValidator:new F.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new F.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new F.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeTimeFilterTimeUnitTypeValidator:new F.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new F.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadValidator:new m.ReportLoadValidator,saveAsParametersValidator:new V.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new b.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.SlicerTargetSelectorValidator]),slicerStateValidator:new w.SlicerStateValidator,slicerTargetValidator:new S.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new w.SlicerValidator,stringArrayValidator:new F.StringArrayValidator,stringValidator:new F.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tileLoadValidator:new P.TileLoadValidator,tokenTypeValidator:new F.EnumValidator([0,1]),topNFilterTypeValidator:new F.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,updateFiltersRequestValidator:new S.AnyOfValidator([new c.UpdateFiltersRequestValidator,new c.RemoveFiltersRequestValidator]),viewModeValidator:new F.EnumValidator([0,1]),visualCommandSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new S.AnyOfValidator([new g.VisualSelectorValidator,new g.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new _.VisualHeaderSettingsValidator,visualHeaderValidator:new _.VisualHeaderValidator,visualHeadersValidator:new F.ArrayValidator([new _.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new g.VisualSelectorValidator,visualSettingsValidator:new _.VisualSettingsValidator,visualTypeSelectorValidator:new g.VisualTypeSelectorValidator}},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.validate=function(e,r,a){if(null==e)return null;var i=t.prototype.validate.call(this,e,r,a);if(i)return i;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,a)},e}(n.ObjectValidator);e.ActionBarValidator=d},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var a=e?e+"."+r:r,i=0,o=this.fieldValidatorsPairs;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?"&":"?";return t+=a+e+"="+r},e.isSavedInternal=function(t,e,i){return r(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},i)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=o,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())}},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL"},function(t,e,r){var a,i=this&&this.__extends||(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(i,o){function n(t){try{s(a.next(t))}catch(t){o(t)}}function l(t){try{s(a.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((a=a.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,a,i,o,n={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,a&&(i=2&o[0]?a.return:o[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;switch(a=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(i=n.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]2&&"[]"===n.slice(l-2)&&(s=!0,r[n=n.slice(0,l-2)]||(r[n]=[])),i=o[1]?V(o[1]):""),s?r[n].push(i):r[n]=i}return r},recognize:function(t){var e,r,a,i=[this.rootState],o={},n=!1;if(-1!==(a=t.indexOf("?"))){var l=t.substr(a+1,t.length);t=t.substr(0,a),o=this.parseQueryString(l)}for("/"!==(t=decodeURI(t)).charAt(0)&&(t="/"+t),(e=t.length)>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r(()=>{var t={428:function(t){var e;e=function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var a=e[i]={exports:{},id:i,loaded:!1};return t[i].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}return r.m=t,r.c=e,r.p="",r(0)}([function(t,e){"use strict";var r=function(){function t(t,e,r){void 0===e&&(e={}),this.defaultHeaders=e,this.defaultTargetWindow=r,this.windowPostMessageProxy=t}return t.addTrackingProperties=function(t,e){return t.headers=t.headers||{},e&&e.id&&(t.headers.id=e.id),t},t.getTrackingProperties=function(t){return{id:t.headers&&t.headers.id}},t.isErrorMessage=function(t){return"number"==typeof(t&&t.statusCode)&&!(200<=t.statusCode&&t.statusCode<300)},t.prototype.get=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r=this.defaultTargetWindow),this.send({method:"GET",url:t,headers:e},r)},t.prototype.post=function(t,e,r,i){return void 0===r&&(r={}),void 0===i&&(i=this.defaultTargetWindow),this.send({method:"POST",url:t,headers:r,body:e},i)},t.prototype.put=function(t,e,r,i){return void 0===r&&(r={}),void 0===i&&(i=this.defaultTargetWindow),this.send({method:"PUT",url:t,headers:r,body:e},i)},t.prototype.patch=function(t,e,r,i){return void 0===r&&(r={}),void 0===i&&(i=this.defaultTargetWindow),this.send({method:"PATCH",url:t,headers:r,body:e},i)},t.prototype.delete=function(t,e,r,i){return void 0===e&&(e=null),void 0===r&&(r={}),void 0===i&&(i=this.defaultTargetWindow),this.send({method:"DELETE",url:t,headers:r,body:e},i)},t.prototype.send=function(t,e){if(void 0===e&&(e=this.defaultTargetWindow),t.headers=this.assign({},this.defaultHeaders,t.headers),!e)throw new Error("target window is not provided. You must either provide the target window explicitly as argument to request, or specify default target window when constructing instance of this class.");return this.windowPostMessageProxy.postMessage(e,t)},t.prototype.assign=function(t){for(var e=[],r=1;r(()=>{var t=[function(t,e,r){var i,a=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonErrorCodes=e.BookmarksPlayMode=e.ExportDataType=e.QnaMode=e.PageNavigationPosition=e.BrowserPrintAdjustmentsMode=e.AggregateFunction=e.DataCacheMode=e.CredentialType=e.isPercentOfGrandTotal=e.isColumnAggr=e.isHierarchyLevelAggr=e.isHierarchyLevel=e.isColumn=e.isMeasure=e.getFilterType=e.isBasicFilterWithKeys=e.isFilterKeyColumnsTarget=e.HierarchyIdentityFilter=e.HierarchyFilter=e.AdvancedFilter=e.TupleFilter=e.IdentityFilter=e.BasicFilterWithKeys=e.BasicFilter=e.RelativeTimeFilter=e.RelativeDateFilter=e.TopNFilter=e.IncludeExcludeFilter=e.NotSupportedFilter=e.Filter=e.RelativeDateOperators=e.RelativeDateFilterTimeUnit=e.FilterType=e.FiltersLevel=e.FiltersOperations=e.MenuLocation=e.ContrastMode=e.TokenType=e.ViewMode=e.Permissions=e.SectionVisibility=e.ReportAlignment=e.HyperlinkClickBehavior=e.LayoutType=e.VisualContainerDisplayMode=e.BackgroundType=e.DisplayOption=e.PageSizeType=e.TraceType=void 0,e.validateExportDataRequest=e.validateQnaInterpretInputData=e.validateLoadQnaConfiguration=e.validateSaveAsParameters=e.validateUpdateFiltersRequest=e.validateFilter=e.validatePage=e.validateTileLoad=e.validateDashboardLoad=e.validateQuickCreate=e.validateCreateReport=e.validatePaginatedReportLoad=e.validateReportLoad=e.validateMenuGroupExtension=e.validateExtension=e.validateCustomPageSize=e.validateVisualizationsPane=e.validateSyncSlicersPane=e.validateSelectionPane=e.validatePageNavigationPane=e.validateFieldsPane=e.validateFiltersPane=e.validateBookmarksPane=e.validatePanes=e.validateSettings=e.validateCaptureBookmarkRequest=e.validateApplyBookmarkStateRequest=e.validateApplyBookmarkByNameRequest=e.validateAddBookmarkRequest=e.validatePlayBookmarkRequest=e.validateSlicerState=e.validateSlicer=e.validateVisualSelector=e.isIExtensionArray=e.isIExtensions=e.isGroupedMenuExtension=e.isFlatMenuExtension=e.isReportFiltersArray=e.isOnLoadFilters=e.VisualDataRoleKindPreference=e.VisualDataRoleKind=e.CommandDisplayOption=e.SlicerTargetSelector=e.VisualTypeSelector=e.VisualSelector=e.PageSelector=e.Selector=e.SortDirection=e.LegendPosition=e.TextAlignment=void 0,e.validatePrintSettings=e.validateZoomLevel=e.validateCustomTheme=e.validateCommandsSettings=e.validateVisualSettings=e.validateVisualHeader=void 0;var o,n,l,s,u,d,c,p,f,h,v,y,m,V,g,b,w,P,S,O=r(1);(S=e.TraceType||(e.TraceType={}))[S.Information=0]="Information",S[S.Verbose=1]="Verbose",S[S.Warning=2]="Warning",S[S.Error=3]="Error",S[S.ExpectedError=4]="ExpectedError",S[S.UnexpectedError=5]="UnexpectedError",S[S.Fatal=6]="Fatal",(P=e.PageSizeType||(e.PageSizeType={}))[P.Widescreen=0]="Widescreen",P[P.Standard=1]="Standard",P[P.Cortana=2]="Cortana",P[P.Letter=3]="Letter",P[P.Custom=4]="Custom",P[P.Mobile=5]="Mobile",(w=e.DisplayOption||(e.DisplayOption={}))[w.FitToPage=0]="FitToPage",w[w.FitToWidth=1]="FitToWidth",w[w.ActualSize=2]="ActualSize",(b=e.BackgroundType||(e.BackgroundType={}))[b.Default=0]="Default",b[b.Transparent=1]="Transparent",(g=e.VisualContainerDisplayMode||(e.VisualContainerDisplayMode={}))[g.Visible=0]="Visible",g[g.Hidden=1]="Hidden",(V=e.LayoutType||(e.LayoutType={}))[V.Master=0]="Master",V[V.Custom=1]="Custom",V[V.MobilePortrait=2]="MobilePortrait",V[V.MobileLandscape=3]="MobileLandscape",(m=e.HyperlinkClickBehavior||(e.HyperlinkClickBehavior={}))[m.Navigate=0]="Navigate",m[m.NavigateAndRaiseEvent=1]="NavigateAndRaiseEvent",m[m.RaiseEvent=2]="RaiseEvent",(y=e.ReportAlignment||(e.ReportAlignment={}))[y.Left=0]="Left",y[y.Center=1]="Center",y[y.Right=2]="Right",y[y.None=3]="None",(v=e.SectionVisibility||(e.SectionVisibility={}))[v.AlwaysVisible=0]="AlwaysVisible",v[v.HiddenInViewMode=1]="HiddenInViewMode",(h=e.Permissions||(e.Permissions={}))[h.Read=0]="Read",h[h.ReadWrite=1]="ReadWrite",h[h.Copy=2]="Copy",h[h.Create=4]="Create",h[h.All=7]="All",(f=e.ViewMode||(e.ViewMode={}))[f.View=0]="View",f[f.Edit=1]="Edit",(p=e.TokenType||(e.TokenType={}))[p.Aad=0]="Aad",p[p.Embed=1]="Embed",(c=e.ContrastMode||(e.ContrastMode={}))[c.None=0]="None",c[c.HighContrast1=1]="HighContrast1",c[c.HighContrast2=2]="HighContrast2",c[c.HighContrastBlack=3]="HighContrastBlack",c[c.HighContrastWhite=4]="HighContrastWhite",(d=e.MenuLocation||(e.MenuLocation={}))[d.Bottom=0]="Bottom",d[d.Top=1]="Top",(u=e.FiltersOperations||(e.FiltersOperations={}))[u.RemoveAll=0]="RemoveAll",u[u.ReplaceAll=1]="ReplaceAll",u[u.Add=2]="Add",u[u.Replace=3]="Replace",(s=e.FiltersLevel||(e.FiltersLevel={}))[s.Report=0]="Report",s[s.Page=1]="Page",s[s.Visual=2]="Visual",function(t){t[t.Advanced=0]="Advanced",t[t.Basic=1]="Basic",t[t.Unknown=2]="Unknown",t[t.IncludeExclude=3]="IncludeExclude",t[t.RelativeDate=4]="RelativeDate",t[t.TopN=5]="TopN",t[t.Tuple=6]="Tuple",t[t.RelativeTime=7]="RelativeTime",t[t.Identity=8]="Identity",t[t.Hierarchy=9]="Hierarchy",t[t.HierarchyIdentity=10]="HierarchyIdentity"}(o=e.FilterType||(e.FilterType={})),(l=e.RelativeDateFilterTimeUnit||(e.RelativeDateFilterTimeUnit={}))[l.Days=0]="Days",l[l.Weeks=1]="Weeks",l[l.CalendarWeeks=2]="CalendarWeeks",l[l.Months=3]="Months",l[l.CalendarMonths=4]="CalendarMonths",l[l.Years=5]="Years",l[l.CalendarYears=6]="CalendarYears",l[l.Minutes=7]="Minutes",l[l.Hours=8]="Hours",(n=e.RelativeDateOperators||(e.RelativeDateOperators={}))[n.InLast=0]="InLast",n[n.InThis=1]="InThis",n[n.InNext=2]="InNext";var _=function(){function t(t,e){this.target=t,this.filterType=e}return t.prototype.toJSON=function(){var t={$schema:this.schemaUrl,target:this.target,filterType:this.filterType};return void 0!==this.displaySettings&&(t.displaySettings=this.displaySettings),t},t}();e.Filter=_;var E=function(t){function e(r,i,a){var n=t.call(this,r,o.Unknown)||this;return n.message=i,n.notSupportedTypeName=a,n.schemaUrl=e.schemaUrl,n}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.message=this.message,e.notSupportedTypeName=this.notSupportedTypeName,e},e.schemaUrl="http://powerbi.com/product/schema#notSupported",e}(_);e.NotSupportedFilter=E;var T=function(t){function e(r,i,a){var n=t.call(this,r,o.IncludeExclude)||this;return n.target=r,n.values=a,n.isExclude=i,n.schemaUrl=e.schemaUrl,n}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.isExclude=this.isExclude,e.values=this.values,e},e.schemaUrl="http://powerbi.com/product/schema#includeExclude",e}(_);e.IncludeExcludeFilter=T;var F=function(t){function e(r,i,a,n){var l=t.call(this,r,o.TopN)||this;return l.operator=i,l.itemCount=a,l.schemaUrl=e.schemaUrl,l.orderBy=n,l}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.itemCount=this.itemCount,e.orderBy=this.orderBy,e},e.schemaUrl="http://powerbi.com/product/schema#topN",e}(_);e.TopNFilter=F;var C=function(t){function e(r,i,a,n,l){var s=t.call(this,r,o.RelativeDate)||this;return s.operator=i,s.timeUnitsCount=a,s.timeUnitType=n,s.includeToday=l,s.schemaUrl=e.schemaUrl,s}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e.includeToday=this.includeToday,e},e.schemaUrl="http://powerbi.com/product/schema#relativeDate",e}(_);e.RelativeDateFilter=C;var R=function(t){function e(r,i,a,n){var l=t.call(this,r,o.RelativeTime)||this;return l.operator=i,l.timeUnitsCount=a,l.timeUnitType=n,l.schemaUrl=e.schemaUrl,l}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.operator=this.operator,e.timeUnitsCount=this.timeUnitsCount,e.timeUnitType=this.timeUnitType,e},e.schemaUrl="http://powerbi.com/product/schema#relativeTime",e}(_);e.RelativeTimeFilter=R;var k=function(t){function e(r,i){for(var a=[],n=2;n0&&!a)throw new Error("You should pass the values to be filtered for each key. You passed: no values and ".concat(n," keys"));if(0===n&&a&&a.length>0)throw new Error("You passed key values but your target object doesn't contain the keys to be filtered");for(var l=0,s=o.keyValues;l2)throw new Error("AdvancedFilters may not have more than two conditions. You passed: ".concat(a.length));if(1===l.length&&"And"!==i)throw new Error('Logical Operator must be "And" when there is only one condition provided');return s.conditions=l,s}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.logicalOperator=this.logicalOperator,e.conditions=this.conditions,e},e.schemaUrl="http://powerbi.com/product/schema#advanced",e}(_);e.AdvancedFilter=M;var I=function(t){function e(r,i){var a=t.call(this,r,o.Hierarchy)||this;return a.schemaUrl=e.schemaUrl,a.hierarchyData=i,a}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.hierarchyData=this.hierarchyData,e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#hierarchy",e}(_);e.HierarchyFilter=I;var L,q,D,N,B,U,H,W,z,J=function(t){function e(r,i){var a=t.call(this,r,o.HierarchyIdentity)||this;return a.schemaUrl=e.schemaUrl,a.hierarchyData=i,a}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.hierarchyData=this.hierarchyData,e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#hierarchyIdentity",e}(_);function Q(t){if(t.filterType)return t.filterType;var e=t,r=t;return"string"==typeof e.operator&&Array.isArray(e.values)?o.Basic:"string"==typeof r.logicalOperator&&Array.isArray(r.conditions)?o.Advanced:o.Unknown}function G(t){return!(!t.table||!t.column||t.aggregationFunction)}e.HierarchyIdentityFilter=J,e.isFilterKeyColumnsTarget=function(t){return G(t)&&!!t.keys},e.isBasicFilterWithKeys=function(t){return Q(t)===o.Basic&&!!t.keyValues},e.getFilterType=Q,e.isMeasure=function(t){return void 0!==t.table&&void 0!==t.measure},e.isColumn=G,e.isHierarchyLevel=function(t){return!(!(t.table&&t.hierarchy&&t.hierarchyLevel)||t.aggregationFunction)},e.isHierarchyLevelAggr=function(t){return!!(t.table&&t.hierarchy&&t.hierarchyLevel&&t.aggregationFunction)},e.isColumnAggr=function(t){return!!(t.table&&t.column&&t.aggregationFunction)},e.isPercentOfGrandTotal=function(t){return!!t.percentOfGrandTotal},(z=e.CredentialType||(e.CredentialType={}))[z.NoConnection=0]="NoConnection",z[z.OnBehalfOf=1]="OnBehalfOf",z[z.Anonymous=2]="Anonymous",(W=e.DataCacheMode||(e.DataCacheMode={}))[W.Import=0]="Import",W[W.DirectQuery=1]="DirectQuery",(H=e.AggregateFunction||(e.AggregateFunction={}))[H.Default=1]="Default",H[H.None=2]="None",H[H.Sum=3]="Sum",H[H.Min=4]="Min",H[H.Max=5]="Max",H[H.Count=6]="Count",H[H.Average=7]="Average",H[H.DistinctCount=8]="DistinctCount",(U=e.BrowserPrintAdjustmentsMode||(e.BrowserPrintAdjustmentsMode={}))[U.Default=0]="Default",U[U.NoAdjustments=1]="NoAdjustments",(B=e.PageNavigationPosition||(e.PageNavigationPosition={}))[B.Bottom=0]="Bottom",B[B.Left=1]="Left",(N=e.QnaMode||(e.QnaMode={}))[N.Interactive=0]="Interactive",N[N.ResultOnly=1]="ResultOnly",(D=e.ExportDataType||(e.ExportDataType={}))[D.Summarized=0]="Summarized",D[D.Underlying=1]="Underlying",(q=e.BookmarksPlayMode||(e.BookmarksPlayMode={}))[q.Off=0]="Off",q[q.Presentation=1]="Presentation",e.CommonErrorCodes={TokenExpired:"TokenExpired",NotFound:"PowerBIEntityNotFound",InvalidParameters:"Invalid parameters",LoadReportFailed:"LoadReportFailed",NotAuthorized:"PowerBINotAuthorizedException",FailedToLoadModel:"ExplorationContainer_FailedToLoadModel_DefaultDetails"},e.TextAlignment={Left:"left",Center:"center",Right:"right"},e.LegendPosition={Top:"Top",Bottom:"Bottom",Right:"Right",Left:"Left",TopCenter:"TopCenter",BottomCenter:"BottomCenter",RightCenter:"RightCenter",LeftCenter:"LeftCenter"},(L=e.SortDirection||(e.SortDirection={}))[L.Ascending=1]="Ascending",L[L.Descending=2]="Descending";var K=function(){function t(t){this.$schema=t}return t.prototype.toJSON=function(){return{$schema:this.$schema}},t}();e.Selector=K;var Y=function(t){function e(r){var i=t.call(this,e.schemaUrl)||this;return i.pageName=r,i}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.pageName=this.pageName,e},e.schemaUrl="http://powerbi.com/product/schema#pageSelector",e}(K);e.PageSelector=Y;var $=function(t){function e(r){var i=t.call(this,e.schemaUrl)||this;return i.visualName=r,i}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualName=this.visualName,e},e.schemaUrl="http://powerbi.com/product/schema#visualSelector",e}(K);e.VisualSelector=$;var Z=function(t){function e(e){var r=t.call(this,$.schemaUrl)||this;return r.visualType=e,r}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.visualType=this.visualType,e},e.schemaUrl="http://powerbi.com/product/schema#visualTypeSelector",e}(K);e.VisualTypeSelector=Z;var X,tt,et,rt=function(t){function e(e){var r=t.call(this,$.schemaUrl)||this;return r.target=e,r}return a(e,t),e.prototype.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.target=this.target,e},e.schemaUrl="http://powerbi.com/product/schema#slicerTargetSelector",e}(K);function it(t){return Array.isArray(t)}function at(t){return t&&!!t.groupName}function ot(t){return Array.isArray(t)}function nt(t){var e=t.message;return e||(e="".concat(t.path," is invalid. Not meeting ").concat(t.keyword," constraint")),{message:e}}e.SlicerTargetSelector=rt,(et=e.CommandDisplayOption||(e.CommandDisplayOption={}))[et.Enabled=0]="Enabled",et[et.Disabled=1]="Disabled",et[et.Hidden=2]="Hidden",(tt=e.VisualDataRoleKind||(e.VisualDataRoleKind={}))[tt.Grouping=0]="Grouping",tt[tt.Measure=1]="Measure",tt[tt.GroupingOrMeasure=2]="GroupingOrMeasure",(X=e.VisualDataRoleKindPreference||(e.VisualDataRoleKindPreference={}))[X.Measure=0]="Measure",X[X.Grouping=1]="Grouping",e.isOnLoadFilters=function(t){return t&&!it(t)},e.isReportFiltersArray=it,e.isFlatMenuExtension=function(t){return t&&!at(t)},e.isGroupedMenuExtension=at,e.isIExtensions=function(t){return t&&!ot(t)},e.isIExtensionArray=ot,e.validateVisualSelector=function(t){var e=O.Validators.visualSelectorValidator.validate(t);return e?e.map(nt):void 0},e.validateSlicer=function(t){var e=O.Validators.slicerValidator.validate(t);return e?e.map(nt):void 0},e.validateSlicerState=function(t){var e=O.Validators.slicerStateValidator.validate(t);return e?e.map(nt):void 0},e.validatePlayBookmarkRequest=function(t){var e=O.Validators.playBookmarkRequestValidator.validate(t);return e?e.map(nt):void 0},e.validateAddBookmarkRequest=function(t){var e=O.Validators.addBookmarkRequestValidator.validate(t);return e?e.map(nt):void 0},e.validateApplyBookmarkByNameRequest=function(t){var e=O.Validators.applyBookmarkByNameRequestValidator.validate(t);return e?e.map(nt):void 0},e.validateApplyBookmarkStateRequest=function(t){var e=O.Validators.applyBookmarkStateRequestValidator.validate(t);return e?e.map(nt):void 0},e.validateCaptureBookmarkRequest=function(t){var e=O.Validators.captureBookmarkRequestValidator.validate(t);return e?e.map(nt):void 0},e.validateSettings=function(t){var e=O.Validators.settingsValidator.validate(t);return e?e.map(nt):void 0},e.validatePanes=function(t){var e=O.Validators.reportPanesValidator.validate(t);return e?e.map(nt):void 0},e.validateBookmarksPane=function(t){var e=O.Validators.bookmarksPaneValidator.validate(t);return e?e.map(nt):void 0},e.validateFiltersPane=function(t){var e=O.Validators.filtersPaneValidator.validate(t);return e?e.map(nt):void 0},e.validateFieldsPane=function(t){var e=O.Validators.fieldsPaneValidator.validate(t);return e?e.map(nt):void 0},e.validatePageNavigationPane=function(t){var e=O.Validators.pageNavigationPaneValidator.validate(t);return e?e.map(nt):void 0},e.validateSelectionPane=function(t){var e=O.Validators.selectionPaneValidator.validate(t);return e?e.map(nt):void 0},e.validateSyncSlicersPane=function(t){var e=O.Validators.syncSlicersPaneValidator.validate(t);return e?e.map(nt):void 0},e.validateVisualizationsPane=function(t){var e=O.Validators.visualizationsPaneValidator.validate(t);return e?e.map(nt):void 0},e.validateCustomPageSize=function(t){var e=O.Validators.customPageSizeValidator.validate(t);return e?e.map(nt):void 0},e.validateExtension=function(t){var e=O.Validators.extensionValidator.validate(t);return e?e.map(nt):void 0},e.validateMenuGroupExtension=function(t){var e=O.Validators.menuGroupExtensionValidator.validate(t);return e?e.map(nt):void 0},e.validateReportLoad=function(t){var e=O.Validators.reportLoadValidator.validate(t);return e?e.map(nt):void 0},e.validatePaginatedReportLoad=function(t){var e=O.Validators.paginatedReportLoadValidator.validate(t);return e?e.map(nt):void 0},e.validateCreateReport=function(t){var e=O.Validators.reportCreateValidator.validate(t);return e?e.map(nt):void 0},e.validateQuickCreate=function(t){var e=O.Validators.quickCreateValidator.validate(t);return e?e.map(nt):void 0},e.validateDashboardLoad=function(t){var e=O.Validators.dashboardLoadValidator.validate(t);return e?e.map(nt):void 0},e.validateTileLoad=function(t){var e=O.Validators.tileLoadValidator.validate(t);return e?e.map(nt):void 0},e.validatePage=function(t){var e=O.Validators.pageValidator.validate(t);return e?e.map(nt):void 0},e.validateFilter=function(t){var e=O.Validators.filterValidator.validate(t);return e?e.map(nt):void 0},e.validateUpdateFiltersRequest=function(t){var e=O.Validators.updateFiltersRequestValidator.validate(t);return e?e.map(nt):void 0},e.validateSaveAsParameters=function(t){var e=O.Validators.saveAsParametersValidator.validate(t);return e?e.map(nt):void 0},e.validateLoadQnaConfiguration=function(t){var e=O.Validators.loadQnaValidator.validate(t);return e?e.map(nt):void 0},e.validateQnaInterpretInputData=function(t){var e=O.Validators.qnaInterpretInputDataValidator.validate(t);return e?e.map(nt):void 0},e.validateExportDataRequest=function(t){var e=O.Validators.exportDataRequestValidator.validate(t);return e?e.map(nt):void 0},e.validateVisualHeader=function(t){var e=O.Validators.visualHeaderValidator.validate(t);return e?e.map(nt):void 0},e.validateVisualSettings=function(t){var e=O.Validators.visualSettingsValidator.validate(t);return e?e.map(nt):void 0},e.validateCommandsSettings=function(t){var e=O.Validators.commandsSettingsValidator.validate(t);return e?e.map(nt):void 0},e.validateCustomTheme=function(t){var e=O.Validators.customThemeValidator.validate(t);return e?e.map(nt):void 0},e.validateZoomLevel=function(t){var e=O.Validators.zoomLevelValidator.validate(t);return e?e.map(nt):void 0},e.validatePrintSettings=function(t){var e=O.Validators.printSettingsValidator.validate(t);return e?e.map(nt):void 0}},(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Validators=void 0;var i=r(2),a=r(5),o=r(6),n=r(7),l=r(8),s=r(9),u=r(10),d=r(11),c=r(12),p=r(13),f=r(14),h=r(15),v=r(16),y=r(17),m=r(18),V=r(19),g=r(20),b=r(21),w=r(22),P=r(23),S=r(24),O=r(25),_=r(26),E=r(27),T=r(28),F=r(29),C=r(4),R=r(30),k=r(31),x=r(32),A=r(33),j=r(34);e.Validators={addBookmarkRequestValidator:new a.AddBookmarkRequestValidator,advancedFilterTypeValidator:new C.EnumValidator([0]),advancedFilterValidator:new c.AdvancedFilterValidator,anyArrayValidator:new C.ArrayValidator([new _.AnyOfValidator([new C.StringValidator,new C.NumberValidator,new C.BooleanValidator])]),anyFilterValidator:new _.AnyOfValidator([new c.BasicFilterValidator,new c.AdvancedFilterValidator,new c.IncludeExcludeFilterValidator,new c.NotSupportedFilterValidator,new c.RelativeDateFilterValidator,new c.TopNFilterValidator,new c.RelativeTimeFilterValidator,new c.HierarchyFilterValidator]),anyValueValidator:new _.AnyOfValidator([new C.StringValidator,new C.NumberValidator,new C.BooleanValidator]),actionBarValidator:new i.ActionBarValidator,statusBarValidator:new i.StatusBarValidator,applyBookmarkByNameRequestValidator:new a.ApplyBookmarkByNameRequestValidator,applyBookmarkStateRequestValidator:new a.ApplyBookmarkStateRequestValidator,applyBookmarkValidator:new _.AnyOfValidator([new a.ApplyBookmarkByNameRequestValidator,new a.ApplyBookmarkStateRequestValidator]),backgroundValidator:new C.EnumValidator([0,1]),basicFilterTypeValidator:new C.EnumValidator([1]),basicFilterValidator:new c.BasicFilterValidator,booleanArrayValidator:new C.BooleanArrayValidator,booleanValidator:new C.BooleanValidator,bookmarksPaneValidator:new h.BookmarksPaneValidator,captureBookmarkOptionsValidator:new a.CaptureBookmarkOptionsValidator,captureBookmarkRequestValidator:new a.CaptureBookmarkRequestValidator,columnSchemaArrayValidator:new C.ArrayValidator([new k.ColumnSchemaValidator]),commandDisplayOptionValidator:new C.EnumValidator([0,1,2]),commandExtensionSelectorValidator:new _.AnyOfValidator([new b.VisualSelectorValidator,new b.VisualTypeSelectorValidator]),commandExtensionArrayValidator:new C.ArrayValidator([new d.CommandExtensionValidator]),commandExtensionValidator:new d.CommandExtensionValidator,commandsSettingsArrayValidator:new C.ArrayValidator([new o.CommandsSettingsValidator]),commandsSettingsValidator:new o.CommandsSettingsValidator,conditionItemValidator:new c.ConditionItemValidator,contrastModeValidator:new C.EnumValidator([0,1,2,3,4]),credentialDetailsValidator:new F.MapValidator([new C.StringValidator],[new C.StringValidator]),credentialsValidator:new k.CredentialsValidator,credentialTypeValidator:new C.EnumValidator([0,1,2]),customLayoutDisplayOptionValidator:new C.EnumValidator([0,1,2]),customLayoutValidator:new p.CustomLayoutValidator,customPageSizeValidator:new f.CustomPageSizeValidator,customThemeValidator:new n.CustomThemeValidator,dashboardLoadValidator:new l.DashboardLoadValidator,dataCacheModeValidator:new C.EnumValidator([0,1]),datasetBindingValidator:new s.DatasetBindingValidator,datasetCreateConfigValidator:new k.DatasetCreateConfigValidator,datasourceConnectionConfigValidator:new k.DatasourceConnectionConfigValidator,displayStateModeValidator:new C.EnumValidator([0,1]),displayStateValidator:new p.DisplayStateValidator,exportDataRequestValidator:new u.ExportDataRequestValidator,extensionArrayValidator:new C.ArrayValidator([new d.ExtensionValidator]),extensionsValidator:new _.AnyOfValidator([new C.ArrayValidator([new d.ExtensionValidator]),new d.ExtensionsValidator]),extensionPointsValidator:new d.ExtensionPointsValidator,extensionValidator:new d.ExtensionValidator,fieldForbiddenValidator:new E.FieldForbiddenValidator,fieldRequiredValidator:new T.FieldRequiredValidator,fieldsPaneValidator:new h.FieldsPaneValidator,filterColumnTargetValidator:new c.FilterColumnTargetValidator,filterDisplaySettingsValidator:new c.FilterDisplaySettingsValidator,filterConditionsValidator:new C.ArrayValidator([new c.ConditionItemValidator]),filterHierarchyTargetValidator:new c.FilterHierarchyTargetValidator,filterMeasureTargetValidator:new c.FilterMeasureTargetValidator,filterTargetValidator:new _.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new C.ArrayValidator([new _.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator,new C.ArrayValidator([new _.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator])])])])]),filterValidator:new c.FilterValidator,filterTypeValidator:new C.EnumValidator([0,1,2,3,4,5,6,7,9]),filtersArrayValidator:new C.ArrayValidator([new c.FilterValidator]),filtersOperationsUpdateValidator:new C.EnumValidator([1,2,3]),filtersOperationsRemoveAllValidator:new C.EnumValidator([0]),filtersPaneValidator:new h.FiltersPaneValidator,hyperlinkClickBehaviorValidator:new C.EnumValidator([0,1,2]),includeExcludeFilterValidator:new c.IncludeExcludeFilterValidator,includeExludeFilterTypeValidator:new C.EnumValidator([3]),includeExcludeFilterValuesValidator:new C.ArrayValidator([new _.AnyOfValidator([new C.StringValidator,new C.NumberValidator,new C.BooleanValidator,new C.ArrayValidator([new C.ArrayValidator([new c.IncludeExcludePointValueValidator])])])]),hierarchyFilterTypeValidator:new C.EnumValidator([9]),hierarchyFilterValuesValidator:new C.ArrayValidator([new c.HierarchyFilterNodeValidator]),layoutTypeValidator:new C.EnumValidator([0,1,2,3]),loadQnaValidator:new v.LoadQnaValidator,menuExtensionValidator:new _.AnyOfValidator([new d.FlatMenuExtensionValidator,new d.GroupedMenuExtensionValidator]),menuGroupExtensionArrayValidator:new C.ArrayValidator([new d.MenuGroupExtensionValidator]),menuGroupExtensionValidator:new d.MenuGroupExtensionValidator,menuLocationValidator:new C.EnumValidator([0,1]),notSupportedFilterTypeValidator:new C.EnumValidator([2]),notSupportedFilterValidator:new c.NotSupportedFilterValidator,numberArrayValidator:new C.NumberArrayValidator,numberValidator:new C.NumberValidator,onLoadFiltersBaseValidator:new _.AnyOfValidator([new c.OnLoadFiltersBaseValidator,new c.OnLoadFiltersBaseRemoveOperationValidator]),pageLayoutValidator:new F.MapValidator([new C.StringValidator],[new p.VisualLayoutValidator]),pageNavigationPaneValidator:new h.PageNavigationPaneValidator,pageNavigationPositionValidator:new C.EnumValidator([0,1]),pageSizeTypeValidator:new C.EnumValidator([0,1,2,3,4,5]),pageSizeValidator:new f.PageSizeValidator,pageValidator:new f.PageValidator,pageViewFieldValidator:new f.PageViewFieldValidator,pagesLayoutValidator:new F.MapValidator([new C.StringValidator],[new p.PageLayoutValidator]),paginatedReportCommandsValidator:new o.PaginatedReportCommandsValidator,paginatedReportDatasetBindingArrayValidator:new C.ArrayValidator([new j.PaginatedReportDatasetBindingValidator]),paginatedReportLoadValidator:new V.PaginatedReportLoadValidator,paginatedReportsettingsValidator:new w.PaginatedReportSettingsValidator,parameterValuesArrayValidator:new C.ArrayValidator([new V.ReportParameterFieldsValidator]),parametersPanelValidator:new R.ParametersPanelValidator,permissionsValidator:new C.EnumValidator([0,1,2,4,7]),playBookmarkRequestValidator:new a.PlayBookmarkRequestValidator,printSettingsValidator:new A.PrintSettingsValidator,qnaInterpretInputDataValidator:new v.QnaInterpretInputDataValidator,qnaPanesValidator:new h.QnaPanesValidator,qnaSettingValidator:new v.QnaSettingsValidator,quickCreateValidator:new x.QuickCreateValidator,rawDataValidator:new C.ArrayValidator([new C.ArrayValidator([new C.StringValidator])]),relativeDateFilterOperatorValidator:new C.EnumValidator([0,1,2]),relativeDateFilterTimeUnitTypeValidator:new C.EnumValidator([0,1,2,3,4,5,6]),relativeDateFilterTypeValidator:new C.EnumValidator([4]),relativeDateFilterValidator:new c.RelativeDateFilterValidator,relativeDateTimeFilterTypeValidator:new C.EnumValidator([4,7]),relativeDateTimeFilterUnitTypeValidator:new C.EnumValidator([0,1,2,3,4,5,6,7,8]),relativeTimeFilterTimeUnitTypeValidator:new C.EnumValidator([7,8]),relativeTimeFilterTypeValidator:new C.EnumValidator([7]),relativeTimeFilterValidator:new c.RelativeTimeFilterValidator,reportBarsValidator:new i.ReportBarsValidator,reportCreateValidator:new y.ReportCreateValidator,reportLoadFiltersValidator:new _.AnyOfValidator([new C.ArrayValidator([new c.FilterValidator]),new c.OnLoadFiltersValidator]),reportLoadValidator:new m.ReportLoadValidator,reportPanesValidator:new h.ReportPanesValidator,saveAsParametersValidator:new g.SaveAsParametersValidator,selectionPaneValidator:new h.SelectionPaneValidator,settingsValidator:new w.SettingsValidator,singleCommandSettingsValidator:new o.SingleCommandSettingsValidator,slicerSelectorValidator:new _.AnyOfValidator([new b.VisualSelectorValidator,new b.SlicerTargetSelectorValidator]),slicerStateValidator:new P.SlicerStateValidator,slicerTargetValidator:new _.AnyOfValidator([new c.FilterColumnTargetValidator,new c.FilterHierarchyTargetValidator,new c.FilterMeasureTargetValidator,new c.FilterKeyColumnsTargetValidator,new c.FilterKeyHierarchyTargetValidator]),slicerValidator:new P.SlicerValidator,stringArrayValidator:new C.StringArrayValidator,stringValidator:new C.StringValidator,syncSlicersPaneValidator:new h.SyncSlicersPaneValidator,tableDataArrayValidator:new C.ArrayValidator([new k.TableDataValidator]),tableSchemaListValidator:new C.ArrayValidator([new k.TableSchemaValidator]),tileLoadValidator:new S.TileLoadValidator,tokenTypeValidator:new C.EnumValidator([0,1]),topNFilterTypeValidator:new C.EnumValidator([5]),topNFilterValidator:new c.TopNFilterValidator,updateFiltersRequestValidator:new _.AnyOfValidator([new c.UpdateFiltersRequestValidator,new c.RemoveFiltersRequestValidator]),viewModeValidator:new C.EnumValidator([0,1]),visualCommandSelectorValidator:new _.AnyOfValidator([new b.VisualSelectorValidator,new b.VisualTypeSelectorValidator]),visualHeaderSelectorValidator:new _.AnyOfValidator([new b.VisualSelectorValidator,new b.VisualTypeSelectorValidator]),visualHeaderSettingsValidator:new O.VisualHeaderSettingsValidator,visualHeaderValidator:new O.VisualHeaderValidator,visualHeadersValidator:new C.ArrayValidator([new O.VisualHeaderValidator]),visualizationsPaneValidator:new h.VisualizationsPaneValidator,visualLayoutValidator:new p.VisualLayoutValidator,visualSelectorValidator:new b.VisualSelectorValidator,visualSettingsValidator:new O.VisualSettingsValidator,visualTypeSelectorValidator:new b.VisualTypeSelectorValidator,zoomLevelValidator:new C.RangeValidator(.25,4)}},function(t,e,r){var i,a=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.StatusBarValidator=e.ActionBarValidator=e.ReportBarsValidator=void 0;var o=r(3),n=r(4),l=r(1),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.validate=function(e,r,i){if(null==e)return null;var a=t.prototype.validate.call(this,e,r,i);if(a)return a;var n=[{field:"actionBar",validators:[l.Validators.actionBarValidator]},{field:"statusBar",validators:[l.Validators.statusBarValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,i)},e}(n.ObjectValidator);e.ReportBarsValidator=s;var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.validate=function(e,r,i){if(null==e)return null;var a=t.prototype.validate.call(this,e,r,i);if(a)return a;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,i)},e}(n.ObjectValidator);e.ActionBarValidator=u;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.validate=function(e,r,i){if(null==e)return null;var a=t.prototype.validate.call(this,e,r,i);if(a)return a;var n=[{field:"visible",validators:[l.Validators.booleanValidator]}];return new o.MultipleFieldsValidator(n).validate(e,r,i)},e}(n.ObjectValidator);e.StatusBarValidator=d},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MultipleFieldsValidator=void 0;var r=function(){function t(t){this.fieldValidatorsPairs=t}return t.prototype.validate=function(t,e,r){if(!this.fieldValidatorsPairs)return null;for(var i=e?e+"."+r:r,a=0,o=this.fieldValidatorsPairs;athis.maxValue||e{Object.defineProperty(e,"__esModule",{value:!0}),e.AnyOfValidator=void 0;var r=function(){function t(t){this.validators=t}return t.prototype.validate=function(t,e,r){if(null==t)return null;for(var i=!1,a=0,o=this.validators;a{Object.defineProperty(e,"__esModule",{value:!0}),e.FieldForbiddenValidator=void 0;var r=function(){function t(){}return t.prototype.validate=function(t,e,r){return void 0!==t?[{message:r+" is forbidden",path:(e?e+".":"")+r,keyword:"forbidden"}]:null},t}();e.FieldForbiddenValidator=r},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FieldRequiredValidator=void 0;var r=function(){function t(){}return t.prototype.validate=function(t,e,r){return null==t?[{message:r+" is required",path:(e?e+".":"")+r,keyword:"required"}]:null},t}();e.FieldRequiredValidator=r},function(t,e,r){var i,a=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.MapValidator=void 0;var o=function(t){function e(e,r){var i=t.call(this)||this;return i.keyValidators=e,i.valueValidators=r,i}return a(e,t),e.prototype.validate=function(e,r,i){if(null==e)return null;var a=t.prototype.validate.call(this,e,r,i);if(a)return a;for(var o in e)if(e.hasOwnProperty(o)){for(var n=(r?r+".":"")+i+"."+o,l=0,s=this.keyValidators;l2&&"[]"===n.slice(l-2)&&(s=!0,r[n=n.slice(0,l-2)]||(r[n]=[])),a=o[1]?g(o[1]):""),s?r[n].push(a):r[n]=a}return r},recognize:function(t){var e,r,i,a=[this.rootState],o={},n=!1;if(-1!==(i=t.indexOf("?"))){var l=t.substr(i+1,t.length);t=t.substr(0,i),o=this.parseQueryString(l)}for("/"!==(t=decodeURI(t)).charAt(0)&&(t="/"+t),(e=t.length)>1&&"/"===t.charAt(e-1)&&(t=t.substr(0,e-1),n=!0),r=0;r{Object.defineProperty(e,"__esModule",{value:!0}),e.FilterBuilder=void 0;var r=function(){function t(){}return t.prototype.withTargetObject=function(t){return this.target=t,this},t.prototype.withColumnTarget=function(t,e){return this.target={table:t,column:e},this},t.prototype.withMeasureTarget=function(t,e){return this.target={table:t,measure:e},this},t.prototype.withHierarchyLevelTarget=function(t,e,r){return this.target={table:t,hierarchy:e,hierarchyLevel:r},this},t.prototype.withColumnAggregation=function(t,e,r){return this.target={table:t,column:e,aggregationFunction:r},this},t.prototype.withHierarchyLevelAggregationTarget=function(t,e,r,i){return this.target={table:t,hierarchy:e,hierarchyLevel:r,aggregationFunction:i},this},t}();e.FilterBuilder=r},867:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RelativeTimeFilterBuilder=e.RelativeDateFilterBuilder=e.TopNFilterBuilder=e.AdvancedFilterBuilder=e.BasicFilterBuilder=void 0;var i=r(736);Object.defineProperty(e,"BasicFilterBuilder",{enumerable:!0,get:function(){return i.BasicFilterBuilder}});var a=r(904);Object.defineProperty(e,"AdvancedFilterBuilder",{enumerable:!0,get:function(){return a.AdvancedFilterBuilder}});var o=r(463);Object.defineProperty(e,"TopNFilterBuilder",{enumerable:!0,get:function(){return o.TopNFilterBuilder}});var n=r(778);Object.defineProperty(e,"RelativeDateFilterBuilder",{enumerable:!0,get:function(){return n.RelativeDateFilterBuilder}});var l=r(141);Object.defineProperty(e,"RelativeTimeFilterBuilder",{enumerable:!0,get:function(){return l.RelativeTimeFilterBuilder}})},778:function(t,e,r){var i,a=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.RelativeDateFilterBuilder=void 0;var o=r(419),n=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.isTodayIncluded=!0,e}return a(e,t),e.prototype.inLast=function(t,e){return this.operator=o.RelativeDateOperators.InLast,this.timeUnitsCount=t,this.timeUnitType=e,this},e.prototype.inThis=function(t,e){return this.operator=o.RelativeDateOperators.InThis,this.timeUnitsCount=t,this.timeUnitType=e,this},e.prototype.inNext=function(t,e){return this.operator=o.RelativeDateOperators.InNext,this.timeUnitsCount=t,this.timeUnitType=e,this},e.prototype.includeToday=function(t){return this.isTodayIncluded=t,this},e.prototype.build=function(){return new o.RelativeDateFilter(this.target,this.operator,this.timeUnitsCount,this.timeUnitType,this.isTodayIncluded)},e}(r(878).FilterBuilder);e.RelativeDateFilterBuilder=n},141:function(t,e,r){var i,a=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.RelativeTimeFilterBuilder=void 0;var o=r(419),n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.inLast=function(t,e){return this.operator=o.RelativeDateOperators.InLast,this.timeUnitsCount=t,this.timeUnitType=e,this},e.prototype.inThis=function(t,e){return this.operator=o.RelativeDateOperators.InThis,this.timeUnitsCount=t,this.timeUnitType=e,this},e.prototype.inNext=function(t,e){return this.operator=o.RelativeDateOperators.InNext,this.timeUnitsCount=t,this.timeUnitType=e,this},e.prototype.build=function(){return new o.RelativeTimeFilter(this.target,this.operator,this.timeUnitsCount,this.timeUnitType)},e}(r(878).FilterBuilder);e.RelativeTimeFilterBuilder=n},463:function(t,e,r){var i,a=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.TopNFilterBuilder=void 0;var o=r(419),n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.top=function(t){return this.operator="Top",this.itemCount=t,this},e.prototype.bottom=function(t){return this.operator="Bottom",this.itemCount=t,this},e.prototype.orderByTarget=function(t){return this.orderByTargetValue=t,this},e.prototype.build=function(){return new o.TopNFilter(this.target,this.operator,this.itemCount,this.orderByTargetValue)},e}(r(878).FilterBuilder);e.TopNFilterBuilder=n},294:function(t,e,r){var i=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(a,o){function n(t){try{s(i.next(t))}catch(t){o(t)}}function l(t){try{s(i.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?a(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((i=i.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,i,a,o,n={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=2&o[0]?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!((a=(a=n.trys).length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]{Object.defineProperty(e,"__esModule",{value:!0}),e.default={version:"2.23.1",type:"js"}},158:function(t,e,r){var i,a=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(a,o){function n(t){try{s(i.next(t))}catch(t){o(t)}}function l(t){try{s(i.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?a(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((i=i.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,i,a,o,n={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=2&o[0]?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!((a=(a=n.trys).length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] 0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] {Object.defineProperty(e,"__esModule",{value:!0}),e.invalidEmbedUrlErrorMessage=e.EmbedUrlNotSupported=e.APINotSupportedForRDLError=void 0,e.APINotSupportedForRDLError="This API is currently not supported for RDL reports",e.EmbedUrlNotSupported="Embed URL is invalid for this scenario. Please use Power BI REST APIs to get the valid URL",e.invalidEmbedUrlErrorMessage="Invalid embed URL detected. Either URL hostname or protocol are invalid. Please use Power BI REST APIs to get the valid URL"},882:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.routerFactory=e.wpmpFactory=e.hpmFactory=void 0;var i=r(439),a=r(428),o=r(51),n=r(28);e.hpmFactory=function(t,e,r,i,o){return void 0===r&&(r=n.default.version),void 0===i&&(i=n.default.type),new a.HttpPostMessage(t,{"x-sdk-type":i,"x-sdk-version":r,"x-sdk-wrapper-version":o},e)},e.wpmpFactory=function(t,e,r){return new i.WindowPostMessageProxy({processTrackingProperties:{addTrackingProperties:a.HttpPostMessage.addTrackingProperties,getTrackingProperties:a.HttpPostMessage.getTrackingProperties},isErrorMessage:a.HttpPostMessage.isErrorMessage,suppressWarnings:!0,name:t,logMessages:e,eventSourceOverrideWindow:r})},e.routerFactory=function(t){return new o.Router(t)}},869:function(t,e,r){var i=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(a,o){function n(t){try{s(i.next(t))}catch(t){o(t)}}function l(t){try{s(i.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?a(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((i=i.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var r,i,a,o,n={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=2&o[0]?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!((a=(a=n.trys).length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] 0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] 0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] 0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] 0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] 0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] 0?"&":"?";return t+(i+e+"=")+r},e.isSavedInternal=function(t,e,a){return r(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,t.get("/report/hasUnsavedChanges",{uid:e},a)];case 1:return[2,!r.sent().body];case 2:throw r.sent().body;case 3:return[2]}}))}))},e.isRDLEmbed=function(t){return t&&t.toLowerCase().indexOf("/rdlembed?")>=0},e.autoAuthInEmbedUrl=function(t){return t&&decodeURIComponent(t).toLowerCase().indexOf("autoauth=true")>=0},e.getRandomValue=l,e.getTimeDiffInMilliseconds=function(t,e){return Math.abs(t.getTime()-e.getTime())},e.isCreate=function(t){return"create"===t||"quickcreate"===t},e.validateEmbedUrl=function(t){if(t){var e=void 0;try{e=new URL(t.toLowerCase())}catch(t){return!1}return"https:"===e.protocol&&(a.test(e.hostname)||o.test(e.hostname))}}},122:function(t,e,r){var i,a=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))((function(a,o){function n(t){try{s(i.next(t))}catch(t){o(t)}}function l(t){try{s(i.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?a(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(n,l)}s((i=i.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,i,a,o,n={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(a=2&o[0]?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!((a=(a=n.trys).length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] 0&&a[a.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] {var e;self,e=()=>(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.WindowPostMessageProxy=void 0;var r=function(){function t(e){void 0===e&&(e={processTrackingProperties:{addTrackingProperties:t.defaultAddTrackingProperties,getTrackingProperties:t.defaultGetTrackingProperties},isErrorMessage:t.defaultIsErrorMessage,receiveWindow:window,name:t.createRandomString()});var r=this;this.pendingRequestPromises={},this.addTrackingProperties=e.processTrackingProperties&&e.processTrackingProperties.addTrackingProperties||t.defaultAddTrackingProperties,this.getTrackingProperties=e.processTrackingProperties&&e.processTrackingProperties.getTrackingProperties||t.defaultGetTrackingProperties,this.isErrorMessage=e.isErrorMessage||t.defaultIsErrorMessage,this.receiveWindow=e.receiveWindow||window,this.name=e.name||t.createRandomString(),this.logMessages=e.logMessages||!1,this.eventSourceOverrideWindow=e.eventSourceOverrideWindow,this.suppressWarnings=e.suppressWarnings||!1,this.logMessages&&console.log("new WindowPostMessageProxy created with name: ".concat(this.name," receiving on window: ").concat(this.receiveWindow.document.title)),this.handlers=[],this.windowMessageHandler=function(t){return r.onMessageReceived(t)},this.start()}return t.defaultAddTrackingProperties=function(e,r){return e[t.messagePropertyName]=r,e},t.defaultGetTrackingProperties=function(e){return e[t.messagePropertyName]},t.defaultIsErrorMessage=function(t){return!!t.error},t.createDeferred=function(){var t={resolve:null,reject:null,promise:null},e=new Promise((function(e,r){t.resolve=e,t.reject=r}));return t.promise=e,t},t.createRandomString=function(){var t=window.crypto||window.msCrypto,e=new Uint32Array(1);return t.getRandomValues(e),e[0].toString(36).substring(1)},t.prototype.addHandler=function(t){this.handlers.push(t)},t.prototype.removeHandler=function(t){var e=this.handlers.indexOf(t);if(-1===e)throw new Error("You attempted to remove a handler but no matching handler was found.");this.handlers.splice(e,1)},t.prototype.start=function(){this.receiveWindow.addEventListener("message",this.windowMessageHandler)},t.prototype.stop=function(){this.receiveWindow.removeEventListener("message",this.windowMessageHandler)},t.prototype.postMessage=function(e,r){var i={id:t.createRandomString()};this.addTrackingProperties(r,i),this.logMessages&&(console.log("".concat(this.name," Posting message:")),console.log(JSON.stringify(r,null," "))),e.postMessage(r,"*");var a=t.createDeferred();return this.pendingRequestPromises[i.id]=a,a.promise},t.prototype.sendResponse=function(t,e,r){this.addTrackingProperties(e,r),this.logMessages&&(console.log("".concat(this.name," Sending response:")),console.log(JSON.stringify(e,null," "))),t.postMessage(e,"*")},t.prototype.onMessageReceived=function(t){var e=this;this.logMessages&&(console.log("".concat(this.name," Received message:")),console.log("type: ".concat(t.type)),console.log(JSON.stringify(t.data,null," ")));var r=this.eventSourceOverrideWindow||t.source;if(r){var i=t.data;if("object"==typeof i){var a,o;try{a=this.getTrackingProperties(i)}catch(t){this.suppressWarnings||console.warn("Proxy(".concat(this.name,"): Error occurred when attempting to get tracking properties from incoming message:"),JSON.stringify(i,null," "),"Error: ",t)}if(a&&(o=this.pendingRequestPromises[a.id]),o){var n=!0;try{n=this.isErrorMessage(i)}catch(t){console.warn("Proxy(".concat(this.name,") Error occurred when trying to determine if message is consider an error response. Message: "),JSON.stringify(i,null,""),"Error: ",t)}n?o.reject(i):o.resolve(i),delete this.pendingRequestPromises[a.id]}else this.handlers.some((function(t){var o=!1;try{o=t.test(i)}catch(t){e.suppressWarnings||console.warn("Proxy(".concat(e.name,"): Error occurred when handler was testing incoming message:"),JSON.stringify(i,null," "),"Error: ",t)}if(o){var n=void 0;try{n=Promise.resolve(t.handle(i))}catch(t){e.suppressWarnings||console.warn("Proxy(".concat(e.name,"): Error occurred when handler was processing incoming message:"),JSON.stringify(i,null," "),"Error: ",t),n=Promise.resolve()}return n.then((function(t){if(!t){var o="Handler for message: ".concat(JSON.stringify(i,null," ")," did not return a response message. The default response message will be returned instead.");e.suppressWarnings||console.warn("Proxy(".concat(e.name,"): ").concat(o)),t={warning:o}}e.sendResponse(r,t,a)})),!0}}))||this.suppressWarnings||console.warn("Proxy(".concat(this.name,") did not handle message. Handlers: ").concat(this.handlers.length," Message: ").concat(JSON.stringify(i,null,""),"."))}else this.suppressWarnings||console.warn("Proxy(".concat(this.name,"): Received message that was not an object. Discarding message"))}},t.messagePropertyName="windowPostMessageProxy",t}();e.WindowPostMessageProxy=r})(),t})(),t.exports=e()}},e={};function r(i){var a=e[i];if(void 0!==a)return a.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,r),o.exports}var i={};return(()=>{var t=i;Object.defineProperty(t,"__esModule",{value:!0}),t.RelativeTimeFilterBuilder=t.RelativeDateFilterBuilder=t.TopNFilterBuilder=t.AdvancedFilterBuilder=t.BasicFilterBuilder=t.Create=t.QuickCreate=t.VisualDescriptor=t.Visual=t.Qna=t.Page=t.Embed=t.Tile=t.Dashboard=t.Report=t.models=t.factories=t.service=void 0;var e=r(419);t.models=e;var a=r(747);t.service=a;var o=r(882);t.factories=o;var n=r(80);Object.defineProperty(t,"Report",{enumerable:!0,get:function(){return n.Report}});var l=r(320);Object.defineProperty(t,"Dashboard",{enumerable:!0,get:function(){return l.Dashboard}});var s=r(274);Object.defineProperty(t,"Tile",{enumerable:!0,get:function(){return s.Tile}});var u=r(777);Object.defineProperty(t,"Embed",{enumerable:!0,get:function(){return u.Embed}});var d=r(869);Object.defineProperty(t,"Page",{enumerable:!0,get:function(){return d.Page}});var c=r(566);Object.defineProperty(t,"Qna",{enumerable:!0,get:function(){return c.Qna}});var p=r(122);Object.defineProperty(t,"Visual",{enumerable:!0,get:function(){return p.Visual}});var f=r(179);Object.defineProperty(t,"VisualDescriptor",{enumerable:!0,get:function(){return f.VisualDescriptor}});var h=r(103);Object.defineProperty(t,"QuickCreate",{enumerable:!0,get:function(){return h.QuickCreate}});var v=r(158);Object.defineProperty(t,"Create",{enumerable:!0,get:function(){return v.Create}});var y=r(867);Object.defineProperty(t,"BasicFilterBuilder",{enumerable:!0,get:function(){return y.BasicFilterBuilder}}),Object.defineProperty(t,"AdvancedFilterBuilder",{enumerable:!0,get:function(){return y.AdvancedFilterBuilder}}),Object.defineProperty(t,"TopNFilterBuilder",{enumerable:!0,get:function(){return y.TopNFilterBuilder}}),Object.defineProperty(t,"RelativeDateFilterBuilder",{enumerable:!0,get:function(){return y.RelativeDateFilterBuilder}}),Object.defineProperty(t,"RelativeTimeFilterBuilder",{enumerable:!0,get:function(){return y.RelativeTimeFilterBuilder}});var m=new a.Service(o.hpmFactory,o.wpmpFactory,o.routerFactory);window.powerbi&&window.powerBISDKGlobalServiceInstanceName?window[window.powerBISDKGlobalServiceInstanceName]=m:window.powerbi=m})(),i})()));
\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
index 113213eb..b3815bd0 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,40 +1,30 @@
-var gulp = require('gulp');
-var ghPages = require('gulp-gh-pages'),
- header = require('gulp-header'),
- help = require('gulp-help-four'),
- rename = require('gulp-rename'),
- replace = require('gulp-replace'),
- eslint = require("gulp-eslint"),
- ts = require('gulp-typescript'),
- flatten = require('gulp-flatten'),
- fs = require('fs'),
- del = require('del'),
- moment = require('moment'),
- karma = require('karma'),
- typedoc = require('gulp-typedoc'),
- webpack = require('webpack'),
- webpackStream = require('webpack-stream'),
- webpackConfig = require('./webpack.config'),
- webpackTestConfig = require('./webpack.test.config'),
- runSequence = require('gulp4-run-sequence'),
- argv = require('yargs').argv;
-;
+const fs = require('fs');
+const gulp = require('gulp');
+const prepend = require('gulp-prepend');
+const help = require('gulp-help-four');
+const rename = require('gulp-rename');
+const replace = require('gulp-replace');
+const eslint = require("gulp-eslint");
+const ts = require('gulp-typescript');
+const flatten = require('gulp-flatten');
+const del = require('del');
+const karma = require('karma');
+const typedoc = require('gulp-typedoc');
+const watch = require('gulp-watch');
+const webpack = require('webpack');
+const webpackStream = require('webpack-stream');
+const runSequence = require('gulp4-run-sequence');
+const webpackConfig = require('./webpack.config');
+const webpackTestConfig = require('./webpack.test.config');
+const argv = require('yargs').argv;
help(gulp, undefined);
-var package = require('./package.json');
-var webpackBanner = package.name + " v" + package.version + " | (c) 2016 Microsoft Corporation " + package.license;
-var gulpBanner = "/*! " + webpackBanner + " */\n";
-
-gulp.task('ghpages', 'Deploy documentation to gh-pages', ['nojekyll'], function () {
- return gulp.src(['./docs/**/*'], {
- dot: true
- })
- .pipe(ghPages({
- force: true,
- message: 'Update ' + moment().format('LLL')
- }));
-});
+const package = require('./package.json');
+const webpackBanner = "// " + package.name + " v" + package.version + "\n"
+ + "// Copyright (c) Microsoft Corporation.\n"
+ + "// Licensed under the MIT License.";
+const banner = webpackBanner + "\n";
gulp.task("docs", 'Compile documentation from src code', function () {
return gulp
@@ -57,111 +47,104 @@ gulp.task("docs", 'Compile documentation from src code', function () {
}));
});
-gulp.task('copydemotodocs', 'Copy the demo to the docs', function () {
- return gulp.src(["demo/**/*"])
- .pipe(gulp.dest("docs/demo"));
-});
-
gulp.task('nojekyll', 'Add .nojekyll file to docs directory', function (done) {
- fs.writeFile('./docs/.nojekyll', '', function (error) {
- if (error) {
- throw error;
- }
+ fs.writeFile('./docs/.nojekyll', '', function (error) {
+ if (error) {
+ throw error;
+ }
- done();
- });
-});
-
-gulp.task('watch', 'Watches for changes', ['lint'], function () {
- gulp.watch(['./src/**/*.ts', './test/**/*.ts'], ['lint:ts']);
- gulp.watch(['./test/**/*.ts'], ['test']);
+ done();
+ });
});
gulp.task('lint', 'Lints all files', function (done) {
- runSequence(
- 'lint:ts',
- done
- );
+ runSequence(
+ 'lint:ts',
+ done
+ );
});
gulp.task('test', 'Runs all tests', function (done) {
- runSequence(
- 'lint:ts',
- 'config',
- 'compile:spec',
- 'test:js',
- done
- );
+ runSequence(
+ 'lint:ts',
+ 'config',
+ 'compile:spec',
+ 'test:js',
+ done
+ );
});
gulp.task('build', 'Runs a full build', function (done) {
- runSequence(
- 'lint:ts',
- 'clean',
- 'config',
- ['compile:ts', 'compile:dts'],
- 'min:js',
- 'header',
- done
- );
+ runSequence(
+ 'lint:ts',
+ 'clean',
+ 'config',
+ ['compile:ts', 'compile:dts'],
+ 'min:js',
+ 'prepend',
+ done
+ );
});
gulp.task('build:docs', 'Build docs folder', function (done) {
- return runSequence(
- 'clean:docs',
- 'docs',
- 'nojekyll',
- 'copydemotodocs',
- done
- );
+ return runSequence(
+ 'clean:docs',
+ 'docs',
+ 'nojekyll',
+ done
+ );
});
gulp.task('config', 'Update config version with package version', function () {
- return gulp.src(['./src/config.ts'], { base: "./" })
- .pipe(replace(/version: '([^']+)'/, `version: '${package.version}'`))
- .pipe(gulp.dest('.'));
+ return gulp.src(['./src/config.ts'], { base: "./" })
+ .pipe(replace(/version: '([^']+)'/, `version: '${package.version}'`))
+ .pipe(gulp.dest('.'));
});
-gulp.task('header', 'Add header to distributed files', function () {
- return gulp.src(['./dist/*.d.ts'])
- .pipe(header(gulpBanner))
- .pipe(gulp.dest('./dist'));
+gulp.task('prepend', 'Add header to distributed files', function () {
+ return gulp.src(['./dist/*.d.ts'])
+ .pipe(prepend(banner))
+ .pipe(gulp.dest('./dist'));
});
gulp.task('clean', 'Cleans destination folder', function (done) {
- return del([
- './dist/**/*'
- ]);
+ return del([
+ './dist/**/*'
+ ]);
});
gulp.task('clean:docs', 'Clean docs directory', function () {
- return del([
- 'docs/**/*',
- 'docs'
- ]);
+ return del([
+ 'docs/**/*',
+ 'docs'
+ ]);
});
gulp.task('lint:ts', 'Lints all TypeScript', function () {
- return gulp.src(['./src/**/*.ts', './test/**/*.ts'])
- .pipe(eslint({
- formatter: "verbose"
- }))
- .pipe(eslint.format());
+ return gulp.src(['./src/**/*.ts', './test/**/*.ts'])
+ .pipe(eslint({
+ formatter: "verbose"
+ }))
+ .pipe(eslint.format());
});
gulp.task('min:js', 'Creates minified JavaScript file', function () {
webpackConfig.plugins = [
- new webpack.BannerPlugin(webpackBanner)
+ new webpack.BannerPlugin({
+ banner: webpackBanner,
+ raw: true
+ })
];
-
+
// Create minified bundle without source map
webpackConfig.mode = 'production';
- webpackConfig.devtool = 'none'
+ webpackConfig.devtool = false;
return gulp.src(['./src/powerbi-client.ts'])
.pipe(webpackStream({
config: webpackConfig
}))
+ .pipe(prepend(banner))
.pipe(rename({
suffix: '.min'
}))
@@ -170,46 +153,68 @@ gulp.task('min:js', 'Creates minified JavaScript file', function () {
gulp.task('compile:ts', 'Compile typescript for powerbi-client library', function () {
webpackConfig.plugins = [
- new webpack.BannerPlugin(webpackBanner)
+ new webpack.BannerPlugin({
+ banner: webpackBanner,
+ raw: true
+ })
];
webpackConfig.mode = "development";
- return gulp.src(['./src/powerbi-client.ts'])
- .pipe(webpackStream(webpackConfig))
- .pipe(gulp.dest('dist/'));
+ return gulp.src(['./src/powerbi-client.ts'])
+ .pipe(webpackStream(webpackConfig))
+ .pipe(gulp.dest('dist/'));
});
gulp.task('compile:dts', 'Generate one dts file from modules', function () {
- var tsProject = ts.createProject('tsconfig.json', {
- declaration: true,
- sourceMap: false
- });
+ const tsProject = ts.createProject('tsconfig.json', {
+ declaration: true,
+ sourceMap: false
+ });
- var settings = {
+ const settings = {
out: "powerbi-client.js",
declaration: true,
module: "system",
moduleResolution: "node"
};
- var tsResult = tsProject.src()
- .pipe(ts(settings));
+ const tsResult = tsProject.src()
+ .pipe(ts(settings));
- return tsResult.dts
- .pipe(flatten())
- .pipe(gulp.dest('./dist'));
+ return tsResult.dts
+ .pipe(flatten())
+ .pipe(gulp.dest('./dist'));
});
gulp.task('compile:spec', 'Compile spec tests', function () {
- return gulp.src(['./test/test.spec.ts'])
- .pipe(webpackStream(webpackTestConfig))
- .pipe(gulp.dest('./tmp'));
+ return gulp.src(['./test/**/*.ts'])
+ .pipe(webpackStream(webpackTestConfig))
+ .pipe(gulp.dest('./tmp'));
});
gulp.task('test:js', 'Run js tests', function (done) {
- new karma.Server({
- configFile: __dirname + '/karma.conf.js',
- singleRun: argv.watch ? false : true,
- captureTimeout: argv.timeout || 60000
- }, done).start();
-});
\ No newline at end of file
+ new karma.Server({
+ configFile: __dirname + '/karma.conf.js',
+ singleRun: argv.watch ? false : true,
+ captureTimeout: argv.timeout || 60000
+ }, function (exitStatus) {
+ done();
+ //process.exit(exitStatus); TODO: Return it back after migration from PhantomJS to chromeHeadless
+ })
+ .on('browser_register', (browser) => {
+ if (argv.chrome) {
+ browser.socket.on('disconnect', function (reason) {
+ if (reason === "transport close" || reason === "transport error") {
+ done(0);
+ process.exit(0);
+ }
+ });
+ }
+ })
+ .start();
+ if (argv.chrome) {
+ return watch(["src/**/*.ts", "test/**/*.ts"], function () {
+ runSequence('compile:spec');
+ });
+ }
+});
diff --git a/karma.conf.js b/karma.conf.js
index f495d005..c14bc720 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -1,13 +1,18 @@
var argv = require('yargs').argv;
-var browserName = 'PhantomJS';
+var browserName = 'Chrome_headless';
if (argv.chrome) {
- browserName = 'Chrome'
+ browserName = 'Chrome_headless'
}
else if (argv.firefox) {
browserName = 'Firefox'
}
-
+const flags = [
+ '--disable-extensions',
+ '--no-proxy-server',
+ '--js-flags="--max_old_space_size=6500"',
+ '--high-dpi-support=1',
+];
module.exports = function (config) {
config.set({
frameworks: ['jasmine'],
@@ -18,27 +23,33 @@ module.exports = function (config) {
{ pattern: './test/**/*.html', served: true, included: false }
],
exclude: [],
- reporters: argv.debug ? ['spec'] : ['spec', 'coverage'],
+ reporters: argv.chrome ? ['kjhtml'] : ['spec', 'junit'],
autoWatch: true,
browsers: [browserName],
+ browserNoActivityTimeout: 300000,
plugins: [
'karma-firefox-launcher',
'karma-chrome-launcher',
'karma-jasmine',
'karma-spec-reporter',
- 'karma-phantomjs-launcher',
- 'karma-coverage'
+ 'karma-jasmine-html-reporter',
+ 'karma-junit-reporter'
],
- preprocessors: { './tmp/**/*.js': ['coverage'] },
- coverageReporter: {
- reporters: [
- { type: 'html' },
- { type: 'text-summary' }
- ]
+ customLaunchers: {
+ 'Chrome_headless': {
+ base: 'Chrome',
+ flags: flags.concat("--no-sandbox", "--window-size=800,800"),
+ },
+ },
+ junitReporter: {
+ outputDir: 'tmp',
+ outputFile: 'testresults.xml',
+ useBrowserName: false
},
+ retryLimit: 0,
logLevel: argv.debug ? config.LOG_DEBUG : config.LOG_INFO,
client: {
- args: argv.logMessages ? ['logMessages'] : []
+ clearContext: false, // leave Jasmine Spec Runner output visible in browser
}
});
};
\ No newline at end of file
diff --git a/package.json b/package.json
index 3af84dc8..04795898 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "powerbi-client",
- "version": "2.17.1",
+ "version": "2.23.1",
"description": "JavaScript library for embedding Power BI into your apps. Provides service which makes it easy to embed different types of components and an object model which allows easy interaction with these components such as changing pages, applying filters, and responding to data selection.",
"main": "dist/powerbi.js",
"types": "dist/powerbi-client.d.ts",
@@ -12,10 +12,9 @@
},
"scripts": {
"build": "gulp build",
- "start": "http-server ./demo",
- "prestart": "cd demo && npm install",
"test": "gulp test",
- "gulp": "gulp"
+ "gulp": "gulp",
+ "tests": "npm test -- --chrome --watch"
},
"keywords": [
"microsoft",
@@ -46,43 +45,47 @@
"eslint-plugin-prefer-arrow": "^1.2.2",
"gulp": "^4.0.2",
"gulp-eslint": "^6.0.0",
- "gulp-flatten": "^0.2.0",
- "gulp-gh-pages": "^0.5.4",
- "gulp-header": "^1.8.7",
+ "gulp-flatten": "^0.4.0",
+ "gulp-prepend": "^0.3.0",
"gulp-help-four": "^0.2.3",
"gulp-rename": "^1.2.2",
"gulp-replace": "^0.5.4",
"gulp-typedoc": "^2.0.0",
- "gulp-typescript": "^4.0.1",
+ "gulp-typescript": "^6.0.0-alpha.1",
+ "gulp-watch": "^5.0.1",
"gulp4-run-sequence": "^1.0.0",
- "http-server": "^0.12.1",
+ "http-server": "^14.1.1",
"ignore-loader": "^0.1.1",
- "jasmine-core": "^2.99.1",
+ "jasmine-core": "3.10.1",
"jquery": "^3.3.1",
"json-loader": "^0.5.4",
- "karma": "^5.2.3",
+ "karma": "^6.3.5",
"karma-chrome-launcher": "^3.1.0",
- "karma-coverage": "^2.0.3",
"karma-firefox-launcher": "^1.2.0",
- "karma-jasmine": "^0.3.8",
- "karma-phantomjs-launcher": "^1.0.4",
+ "karma-jasmine": "4.0.1",
+ "karma-jasmine-html-reporter": "1.7.0",
+ "karma-junit-reporter": "^2.0.1",
"karma-spec-reporter": "0.0.32",
- "moment": "^2.14.1",
- "phantomjs-prebuilt": "^2.1.16",
"ts-loader": "^6.2.2",
- "typedoc": "^0.15.0",
- "typescript": "^4.1.3",
- "webpack": "^4.44.2",
- "webpack-stream": "^5.2.1",
+ "typedoc": "^0.23.23",
+ "typescript": "~4.6.0",
+ "webpack": "^5.75.0",
+ "webpack-stream": "^7.0.0",
"yargs": "^16.1.0"
},
"dependencies": {
"http-post-message": "^0.2",
- "powerbi-models": "^1.8",
+ "powerbi-models": "^1.14.0",
"powerbi-router": "^0.1",
- "window-post-message-proxy": "^0.2"
+ "window-post-message-proxy": "^0.2.7"
},
"publishConfig": {
"tag": "beta"
+ },
+ "overrides": {
+ "glob-parent": "^6.0.2",
+ "micromatch": "^4.0.5",
+ "braces": "3.0.3",
+ "ws": "8.17.1"
}
}
diff --git a/src/FilterBuilders/advancedFilterBuilder.ts b/src/FilterBuilders/advancedFilterBuilder.ts
new file mode 100644
index 00000000..e177213a
--- /dev/null
+++ b/src/FilterBuilders/advancedFilterBuilder.ts
@@ -0,0 +1,89 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import {
+ AdvancedFilter,
+ AdvancedFilterLogicalOperators,
+ IAdvancedFilterCondition,
+ AdvancedFilterConditionOperators
+} from "powerbi-models";
+
+import { FilterBuilder } from './filterBuilder';
+
+/**
+ * Power BI Advanced filter builder component
+ *
+ * @export
+ * @class AdvancedFilterBuilder
+ * @extends {FilterBuilder}
+ */
+export class AdvancedFilterBuilder extends FilterBuilder {
+
+ private logicalOperator: AdvancedFilterLogicalOperators;
+ private conditions: IAdvancedFilterCondition[] = [];
+
+ /**
+ * Sets And as logical operator for Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().and();
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ and(): AdvancedFilterBuilder {
+ this.logicalOperator = "And";
+ return this;
+ }
+
+ /**
+ * Sets Or as logical operator for Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().or();
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ or(): AdvancedFilterBuilder {
+ this.logicalOperator = "Or";
+ return this;
+ }
+
+ /**
+ * Adds a condition in Advanced filter
+ *
+ * ```javascript
+ *
+ * // Add two conditions
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().addCondition("Contains", "Wash").addCondition("Contains", "Park");
+ * ```
+ *
+ * @returns {AdvancedFilterBuilder}
+ */
+ addCondition(operator: AdvancedFilterConditionOperators, value?: (string | number | boolean | Date)): AdvancedFilterBuilder {
+ const condition: IAdvancedFilterCondition = {
+ operator: operator,
+ value: value
+ };
+ this.conditions.push(condition);
+ return this;
+ }
+
+ /**
+ * Creates Advanced filter
+ *
+ * ```javascript
+ *
+ * const advancedFilterBuilder = new AdvancedFilterBuilder().build();
+ * ```
+ *
+ * @returns {AdvancedFilter}
+ */
+ build(): AdvancedFilter {
+ const advancedFilter = new AdvancedFilter(this.target, this.logicalOperator, this.conditions);
+ return advancedFilter;
+ }
+}
diff --git a/src/FilterBuilders/basicFilterBuilder.ts b/src/FilterBuilders/basicFilterBuilder.ts
new file mode 100644
index 00000000..606ce9c6
--- /dev/null
+++ b/src/FilterBuilders/basicFilterBuilder.ts
@@ -0,0 +1,102 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import {
+ BasicFilter,
+ BasicFilterOperators
+} from "powerbi-models";
+
+import { FilterBuilder } from './filterBuilder';
+
+/**
+ * Power BI Basic filter builder component
+ *
+ * @export
+ * @class BasicFilterBuilder
+ * @extends {FilterBuilder}
+ */
+export class BasicFilterBuilder extends FilterBuilder {
+
+ private values: Array<(string | number | boolean)>;
+ private operator: BasicFilterOperators;
+ private isRequireSingleSelection = false;
+
+ /**
+ * Sets In as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().in([values]);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ in(values: Array<(string | number | boolean)>): BasicFilterBuilder {
+ this.operator = "In";
+ this.values = values;
+ return this;
+ }
+
+ /**
+ * Sets NotIn as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().notIn([values]);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ notIn(values: Array<(string | number | boolean)>): BasicFilterBuilder {
+ this.operator = "NotIn";
+ this.values = values;
+ return this;
+ }
+
+ /**
+ * Sets All as operator for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().all();
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ all(): BasicFilterBuilder {
+ this.operator = "All";
+ this.values = [];
+ return this;
+ }
+
+ /**
+ * Sets required single selection property for Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().requireSingleSelection(isRequireSingleSelection);
+ * ```
+ *
+ * @returns {BasicFilterBuilder}
+ */
+ requireSingleSelection(isRequireSingleSelection = false): BasicFilterBuilder {
+ this.isRequireSingleSelection = isRequireSingleSelection;
+ return this;
+ }
+
+ /**
+ * Creates Basic filter
+ *
+ * ```javascript
+ *
+ * const basicFilterBuilder = new BasicFilterBuilder().build();
+ * ```
+ *
+ * @returns {BasicFilter}
+ */
+ build(): BasicFilter {
+ const basicFilter = new BasicFilter(this.target, this.operator, this.values);
+ basicFilter.requireSingleSelection = this.isRequireSingleSelection;
+ return basicFilter;
+ }
+}
diff --git a/src/FilterBuilders/filterBuilder.ts b/src/FilterBuilders/filterBuilder.ts
new file mode 100644
index 00000000..3711593a
--- /dev/null
+++ b/src/FilterBuilders/filterBuilder.ts
@@ -0,0 +1,103 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import { IFilterTarget } from "powerbi-models";
+
+/**
+ * Generic filter builder for BasicFilter, AdvancedFilter, RelativeDate, RelativeTime and TopN
+ *
+ * @class
+ */
+export class FilterBuilder {
+
+ public target: IFilterTarget;
+
+ /**
+ * Sets target property for filter with target object
+ *
+ * ```javascript
+ * const target = {
+ * table: 'table1',
+ * column: 'column1'
+ * };
+ *
+ * const filterBuilder = new FilterBuilder().withTargetObject(target);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withTargetObject(target: IFilterTarget): this {
+ this.target = target;
+ return this;
+ }
+
+ /**
+ * Sets target property for filter with column target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withColumnTarget(tableName, columnName);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withColumnTarget(tableName: string, columnName: string): this {
+ this.target = { table: tableName, column: columnName };
+ return this;
+ }
+
+ /**
+ * Sets target property for filter with measure target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withMeasureTarget(tableName, measure);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withMeasureTarget(tableName: string, measure: string): this {
+ this.target = { table: tableName, measure: measure };
+ return this;
+ }
+
+ /**
+ * Sets target property for filter with hierarchy level target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withHierarchyLevelTarget(tableName, hierarchy, hierarchyLevel);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withHierarchyLevelTarget(tableName: string, hierarchy: string, hierarchyLevel: string): this {
+ this.target = { table: tableName, hierarchy: hierarchy, hierarchyLevel: hierarchyLevel };
+ return this;
+ }
+
+ /**
+ * Sets target property for filter with column aggregation target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withColumnAggregation(tableName, columnName, aggregationFunction);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withColumnAggregation(tableName: string, columnName: string, aggregationFunction: string): this {
+ this.target = { table: tableName, column: columnName, aggregationFunction: aggregationFunction };
+ return this;
+ }
+
+ /**
+ * Sets target property for filter with hierarchy level aggregation target object
+ *
+ * ```
+ * const filterBuilder = new FilterBuilder().withHierarchyLevelAggregationTarget(tableName, hierarchy, hierarchyLevel, aggregationFunction);
+ * ```
+ *
+ * @returns {FilterBuilder}
+ */
+ withHierarchyLevelAggregationTarget(tableName: string, hierarchy: string, hierarchyLevel: string, aggregationFunction: string): this {
+ this.target = { table: tableName, hierarchy: hierarchy, hierarchyLevel: hierarchyLevel, aggregationFunction: aggregationFunction };
+ return this;
+ }
+}
diff --git a/src/FilterBuilders/index.ts b/src/FilterBuilders/index.ts
new file mode 100644
index 00000000..d57029c4
--- /dev/null
+++ b/src/FilterBuilders/index.ts
@@ -0,0 +1,18 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+export {
+ BasicFilterBuilder
+} from "./basicFilterBuilder";
+export {
+ AdvancedFilterBuilder
+} from "./advancedFilterBuilder";
+export {
+ TopNFilterBuilder
+} from "./topNFilterBuilder";
+export {
+ RelativeDateFilterBuilder
+} from "./relativeDateFilterBuilder";
+export {
+ RelativeTimeFilterBuilder
+} from "./relativeTimeFilterBuilder";
diff --git a/src/FilterBuilders/relativeDateFilterBuilder.ts b/src/FilterBuilders/relativeDateFilterBuilder.ts
new file mode 100644
index 00000000..5f522e60
--- /dev/null
+++ b/src/FilterBuilders/relativeDateFilterBuilder.ts
@@ -0,0 +1,113 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import {
+ RelativeDateFilter,
+ RelativeDateOperators,
+ RelativeDateFilterTimeUnit
+} from "powerbi-models";
+
+import { FilterBuilder } from './filterBuilder';
+
+/**
+ * Power BI Relative Date filter builder component
+ *
+ * @export
+ * @class RelativeDateFilterBuilder
+ * @extends {FilterBuilder}
+ */
+export class RelativeDateFilterBuilder extends FilterBuilder {
+
+ private operator: RelativeDateOperators;
+ private timeUnitsCount: number;
+ private timeUnitType: RelativeDateFilterTimeUnit;
+ private isTodayIncluded = true;
+
+ /**
+ * Sets inLast as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inLast(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ inLast(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeDateFilterBuilder {
+ this.operator = RelativeDateOperators.InLast;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ }
+
+ /**
+ * Sets inThis as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inThis(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ inThis(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeDateFilterBuilder {
+ this.operator = RelativeDateOperators.InThis;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ }
+
+ /**
+ * Sets inNext as operator for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().inNext(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeDateFilterBuilder}
+ */
+ inNext(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeDateFilterBuilder {
+ this.operator = RelativeDateOperators.InNext;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ }
+
+ /**
+ * Sets includeToday for Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().includeToday(includeToday);
+ * ```
+ *
+ * @param {boolean} includeToday - Denotes if today is included or not
+ * @returns {RelativeDateFilterBuilder}
+ */
+ includeToday(includeToday: boolean): RelativeDateFilterBuilder {
+ this.isTodayIncluded = includeToday;
+ return this;
+ }
+
+ /**
+ * Creates Relative Date filter
+ *
+ * ```javascript
+ *
+ * const relativeDateFilterBuilder = new RelativeDateFilterBuilder().build();
+ * ```
+ *
+ * @returns {RelativeDateFilter}
+ */
+ build(): RelativeDateFilter {
+ const relativeDateFilter = new RelativeDateFilter(this.target, this.operator, this.timeUnitsCount, this.timeUnitType, this.isTodayIncluded);
+ return relativeDateFilter;
+ }
+}
diff --git a/src/FilterBuilders/relativeTimeFilterBuilder.ts b/src/FilterBuilders/relativeTimeFilterBuilder.ts
new file mode 100644
index 00000000..ac3b6084
--- /dev/null
+++ b/src/FilterBuilders/relativeTimeFilterBuilder.ts
@@ -0,0 +1,96 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import {
+ RelativeTimeFilter,
+ RelativeDateOperators,
+ RelativeDateFilterTimeUnit
+} from "powerbi-models";
+
+import { FilterBuilder } from './filterBuilder';
+
+/**
+ * Power BI Relative Time filter builder component
+ *
+ * @export
+ * @class RelativeTimeFilterBuilder
+ * @extends {FilterBuilder}
+ */
+export class RelativeTimeFilterBuilder extends FilterBuilder {
+
+ private operator: RelativeDateOperators;
+ private timeUnitsCount: number;
+ private timeUnitType: RelativeDateFilterTimeUnit;
+
+ /**
+ * Sets inLast as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inLast(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ inLast(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeTimeFilterBuilder {
+ this.operator = RelativeDateOperators.InLast;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ }
+
+ /**
+ * Sets inThis as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inThis(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ inThis(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeTimeFilterBuilder {
+ this.operator = RelativeDateOperators.InThis;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ }
+
+ /**
+ * Sets inNext as operator for Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().inNext(timeUnitsCount, timeUnitType);
+ * ```
+ *
+ * @param {number} timeUnitsCount - The amount of time units
+ * @param {RelativeDateFilterTimeUnit} timeUnitType - Defines the unit of time the filter is using
+ * @returns {RelativeTimeFilterBuilder}
+ */
+ inNext(timeUnitsCount: number, timeUnitType: RelativeDateFilterTimeUnit): RelativeTimeFilterBuilder {
+ this.operator = RelativeDateOperators.InNext;
+ this.timeUnitsCount = timeUnitsCount;
+ this.timeUnitType = timeUnitType;
+ return this;
+ }
+
+ /**
+ * Creates Relative Time filter
+ *
+ * ```javascript
+ *
+ * const relativeTimeFilterBuilder = new RelativeTimeFilterBuilder().build();
+ * ```
+ *
+ * @returns {RelativeTimeFilter}
+ */
+ build(): RelativeTimeFilter {
+ const relativeTimeFilter = new RelativeTimeFilter(this.target, this.operator, this.timeUnitsCount, this.timeUnitType);
+ return relativeTimeFilter;
+ }
+}
diff --git a/src/FilterBuilders/topNFilterBuilder.ts b/src/FilterBuilders/topNFilterBuilder.ts
new file mode 100644
index 00000000..7dae49be
--- /dev/null
+++ b/src/FilterBuilders/topNFilterBuilder.ts
@@ -0,0 +1,86 @@
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import {
+ ITarget,
+ TopNFilter,
+ TopNFilterOperators
+} from "powerbi-models";
+
+import { FilterBuilder } from './filterBuilder';
+
+/**
+ * Power BI Top N filter builder component
+ *
+ * @export
+ * @class TopNFilterBuilder
+ * @extends {FilterBuilder}
+ */
+export class TopNFilterBuilder extends FilterBuilder {
+
+ private itemCount: number;
+ private operator: TopNFilterOperators;
+ private orderByTargetValue: ITarget;
+
+ /**
+ * Sets Top as operator for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().top(itemCount);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ top(itemCount: number): TopNFilterBuilder {
+ this.operator = "Top";
+ this.itemCount = itemCount;
+ return this;
+ }
+
+ /**
+ * Sets Bottom as operator for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().bottom(itemCount);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ bottom(itemCount: number): TopNFilterBuilder {
+ this.operator = "Bottom";
+ this.itemCount = itemCount;
+ return this;
+ }
+
+ /**
+ * Sets order by for Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().orderByTarget(target);
+ * ```
+ *
+ * @returns {TopNFilterBuilder}
+ */
+ orderByTarget(target: ITarget): TopNFilterBuilder {
+ this.orderByTargetValue = target;
+ return this;
+ }
+
+ /**
+ * Creates Top N filter
+ *
+ * ```javascript
+ *
+ * const topNFilterBuilder = new TopNFilterBuilder().build();
+ * ```
+ *
+ * @returns {TopNFilter}
+ */
+ build(): TopNFilter {
+ const topNFilter = new TopNFilter(this.target, this.operator, this.itemCount, this.orderByTargetValue);
+ return topNFilter;
+ }
+}
diff --git a/src/bookmarksManager.ts b/src/bookmarksManager.ts
index cd2b2434..5d21c742 100644
--- a/src/bookmarksManager.ts
+++ b/src/bookmarksManager.ts
@@ -1,9 +1,21 @@
-import * as service from './service';
-import * as embed from './embed';
-import * as models from 'powerbi-models';
-import * as utils from './util';
-import * as errors from './errors';
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+import {
+ BookmarksPlayMode,
+ IApplyBookmarkByNameRequest,
+ IApplyBookmarkStateRequest,
+ ICaptureBookmarkOptions,
+ ICaptureBookmarkRequest,
+ IPlayBookmarkRequest,
+ IReportBookmark
+
+} from 'powerbi-models';
import { IHttpPostMessageResponse } from 'http-post-message';
+import { Service } from './service';
+import { IEmbedConfigurationBase } from './embed';
+import { isRDLEmbed } from './util';
+import { APINotSupportedForRDLError } from './errors';
/**
* APIs for managing the report bookmarks.
@@ -12,10 +24,10 @@ import { IHttpPostMessageResponse } from 'http-post-message';
* @interface IBookmarksManager
*/
export interface IBookmarksManager {
- getBookmarks(): Promise;
+ getBookmarks(): Promise;
apply(bookmarkName: string): Promise>;
- play(playMode: models.BookmarksPlayMode): Promise>;
- capture(options?: models.ICaptureBookmarkOptions): Promise;
+ play(playMode: BookmarksPlayMode): Promise>;
+ capture(options?: ICaptureBookmarkOptions): Promise;
applyState(state: string): Promise>;
}
@@ -30,7 +42,7 @@ export class BookmarksManager implements IBookmarksManager {
/**
* @hidden
*/
- constructor(private service: service.Service, private config: embed.IEmbedConfigurationBase, private iframe?: HTMLIFrameElement) {
+ constructor(private service: Service, private config: IEmbedConfigurationBase, private iframe?: HTMLIFrameElement) {
}
/**
@@ -44,15 +56,15 @@ export class BookmarksManager implements IBookmarksManager {
* });
* ```
*
- * @returns {Promise}
+ * @returns {Promise}
*/
- async getBookmarks(): Promise {
- if (utils.isRDLEmbed(this.config.embedUrl)) {
- return Promise.reject(errors.APINotSupportedForRDLError);
+ async getBookmarks(): Promise {
+ if (isRDLEmbed(this.config.embedUrl)) {
+ return Promise.reject(APINotSupportedForRDLError);
}
try {
- const response = await this.service.hpm.get(`/report/bookmarks`, { uid: this.config.uniqueId }, this.iframe.contentWindow);
+ const response = await this.service.hpm.get(`/report/bookmarks`, { uid: this.config.uniqueId }, this.iframe.contentWindow);
return response.body;
} catch (response) {
throw response.body;
@@ -70,11 +82,11 @@ export class BookmarksManager implements IBookmarksManager {
* @returns {Promise>}
*/
async apply(bookmarkName: string): Promise> {
- if (utils.isRDLEmbed(this.config.embedUrl)) {
- return Promise.reject(errors.APINotSupportedForRDLError);
+ if (isRDLEmbed(this.config.embedUrl)) {
+ return Promise.reject(APINotSupportedForRDLError);
}
- var request: models.IApplyBookmarkByNameRequest = {
+ const request: IApplyBookmarkByNameRequest = {
name: bookmarkName
};
@@ -90,18 +102,18 @@ export class BookmarksManager implements IBookmarksManager {
*
* ```javascript
* // Enter presentation mode.
- * bookmarksManager.play(models.BookmarksPlayMode.Presentation)
+ * bookmarksManager.play(BookmarksPlayMode.Presentation)
* ```
*
- * @param {models.BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off`
+ * @param {BookmarksPlayMode} playMode Play mode can be either `Presentation` or `Off`
* @returns {Promise>}
*/
- async play(playMode: models.BookmarksPlayMode): Promise> {
- if (utils.isRDLEmbed(this.config.embedUrl)) {
- return Promise.reject(errors.APINotSupportedForRDLError);
+ async play(playMode: BookmarksPlayMode): Promise> {
+ if (isRDLEmbed(this.config.embedUrl)) {
+ return Promise.reject(APINotSupportedForRDLError);
}
- var playBookmarkRequest: models.IPlayBookmarkRequest = {
+ const playBookmarkRequest: IPlayBookmarkRequest = {
playMode: playMode
};
@@ -119,20 +131,20 @@ export class BookmarksManager implements IBookmarksManager {
* bookmarksManager.capture(options)
* ```
*
- * @param {models.ICaptureBookmarkOptions} [options] Options for bookmark capturing
- * @returns {Promise}
+ * @param {ICaptureBookmarkOptions} [options] Options for bookmark capturing
+ * @returns {Promise