powerbi-visuals-tools 5.1.0 → 5.2.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/Changelog.md +3 -0
  2. package/bin/pbiviz.js +1 -1
  3. package/certs/PowerBICustomVisualTest_private.key +26 -26
  4. package/certs/PowerBICustomVisualTest_public.crt +17 -17
  5. package/lib/CommandManager.js +2 -0
  6. package/lib/FeatureManager.js +43 -0
  7. package/lib/Package.js +46 -0
  8. package/lib/Visual.js +34 -0
  9. package/lib/VisualManager.js +73 -0
  10. package/lib/features/APIVersion.js +16 -0
  11. package/lib/features/AdvancedEditMode.js +12 -0
  12. package/lib/features/AllowInteractions.js +12 -0
  13. package/lib/features/AnalyticsPane.js +17 -0
  14. package/lib/features/BaseFeature.js +9 -0
  15. package/lib/features/Bookmarks.js +12 -0
  16. package/lib/features/ColorPalette.js +12 -0
  17. package/lib/features/ConditionalFormatting.js +12 -0
  18. package/lib/features/ContextMenu.js +12 -0
  19. package/lib/features/DrillDown.js +16 -0
  20. package/lib/features/ESLint.js +12 -0
  21. package/lib/features/FeatureTypes.js +23 -0
  22. package/lib/features/FetchMoreData.js +22 -0
  23. package/lib/features/FileDownload.js +12 -0
  24. package/lib/features/FormatPane.js +12 -0
  25. package/lib/features/HighContrast.js +12 -0
  26. package/lib/features/HighlightData.js +12 -0
  27. package/lib/features/KeyboardNavigation.js +12 -0
  28. package/lib/features/LandingPage.js +12 -0
  29. package/lib/features/LaunchURL.js +12 -0
  30. package/lib/features/LocalStorage.js +12 -0
  31. package/lib/features/Localizations.js +12 -0
  32. package/lib/features/ModalDialog.js +12 -0
  33. package/lib/features/RenderingEvents.js +13 -0
  34. package/lib/features/SelectionAcrossVisuals.js +12 -0
  35. package/lib/features/SyncSlicer.js +12 -0
  36. package/lib/features/Tooltips.js +12 -0
  37. package/lib/features/TotalSubTotal.js +12 -0
  38. package/lib/features/VisualVersion.js +12 -0
  39. package/lib/features/WarningIcon.js +12 -0
  40. package/lib/features/index.js +29 -0
  41. package/package.json +2 -1
package/Changelog.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  This page contains information about changes to the PowerBI Visual Tools (pbiviz).
4
4
 
5
+ ## 5.2.0
6
+ * Integrated PAC validation
7
+
5
8
  ## 5.1.0
6
9
  * New flag `--skip-api` to skip verifying api version. It might produce different errors in visual, so use it only in some specific cases (ex. installing something during the build process brakes packages managed by monorepo managers).
7
10
  * New flag `--all-locales` to disable optimization using localization loader. It's recommended not to use this flag because all locales take a huge amount of package size. If you need just a few of them follow [this guide](https://learn.microsoft.com/en-us/power-bi/developer/visuals/localization?tabs=English#step-5---add-a-resources-file-for-each-language). In this case, only declared in stringResources locales will be added to your visual package.
package/bin/pbiviz.js CHANGED
@@ -97,4 +97,4 @@ pbiviz
97
97
  CommandManager.package(options, rootPath);
98
98
  });
99
99
 
100
- program.parse(process.argv);
100
+ program.parse(process.argv);
@@ -1,28 +1,28 @@
1
1
  -----BEGIN PRIVATE KEY-----
2
- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDEKuHsNka9n8H9
3
- 28W1ARv0lBkZYfQMxNK7IOSWopNp+l2w13ns3/Uz6IMB7iRqSCR8i8p0vQHatZP+
4
- 0o8QY2NkMgaRiXlSH48GxmaRfhdTaPv0r2WTB7jibl3c5xEunjL3cvO2F8qVh+8S
5
- SybpY2v4RCqHCAg2o2ZyAkXJk+Rkh/TIOcmQzbQk8SLkuFIPBAXObS8SxZ03/VXJ
6
- x+5iYYqC28TJAkHh8ZSknpkIRCDfV5RzRkwWXvP70aY0Mm1T7rETBh9yDlThZbg5
7
- 9WWYcyqZUn0PgNmM/VWwAYWD16/X832BFYFMbFrANv8CFchtZ58aLcAd9hXarpVT
8
- 2UxFQpOPAgMBAAECggEADMGTyA4jfX3frzKqYZcn3+NS2oFceF7C1qOl7wcKuk/V
9
- 5dkCjF0Sjy87IwCpt4uSFn3p9W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-18,6 +18,7 @@ export default class CommandManager {
18
18
  const visualManager = new VisualManager(rootPath);
19
19
  await visualManager
20
20
  .prepareVisual()
21
+ .validateVisual()
21
22
  .initializeWebpack(webpackOptions);
22
23
  visualManager.startWebpackServer(options.drop);
23
24
  }
@@ -39,6 +40,7 @@ export default class CommandManager {
39
40
  };
40
41
  new VisualManager(rootPath)
41
42
  .prepareVisual()
43
+ .validateVisual()
42
44
  .initializeWebpack(webpackOptions)
43
45
  .then(visualManager => visualManager.generatePackage());
44
46
  }
@@ -0,0 +1,43 @@
1
+ import { Severity } from "./features/FeatureTypes.js";
2
+ import * as features from "./features/index.js";
3
+ export var Status;
4
+ (function (Status) {
5
+ Status[Status["Success"] = 0] = "Success";
6
+ Status[Status["Error"] = 1] = "Error";
7
+ })(Status || (Status = {}));
8
+ export class FeatureManager {
9
+ features = Object.keys(features).map(key => features[key]);
10
+ validate(stage, sourceInstance) {
11
+ const result = {
12
+ status: Status.Success,
13
+ logs: {
14
+ errors: [],
15
+ warnings: [],
16
+ info: [],
17
+ deprecation: []
18
+ }
19
+ };
20
+ this.features
21
+ .filter(feature => feature.stage == stage)
22
+ .filter(feature => feature.visualFeatureType & sourceInstance.visualFeatureType)
23
+ .filter(feature => !feature.isSupported(sourceInstance))
24
+ .forEach(({ errorMessage, severity }) => {
25
+ switch (severity) {
26
+ case Severity.Error:
27
+ result.status = Status.Error;
28
+ result.logs.errors.push(errorMessage);
29
+ break;
30
+ case Severity.Warning:
31
+ result.logs.warnings.push(errorMessage);
32
+ break;
33
+ case Severity.Info:
34
+ result.logs.info.push(errorMessage);
35
+ break;
36
+ case Severity.Deprecation:
37
+ result.logs.deprecation.push(errorMessage);
38
+ break;
39
+ }
40
+ });
41
+ return result;
42
+ }
43
+ }
package/lib/Package.js ADDED
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Power BI Visual CLI
3
+ *
4
+ * Copyright (c) Microsoft Corporation
5
+ * All rights reserved.
6
+ * MIT License
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the ""Software""), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in
16
+ * all copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ * THE SOFTWARE.
25
+ */
26
+ "use strict";
27
+ import isMatch from "lodash.ismatch";
28
+ /**
29
+ * Represents an instance of a visual package based on file path
30
+ */
31
+ export default class Package {
32
+ sourceCode;
33
+ capabilities;
34
+ visualFeatureType;
35
+ constructor(sourceCode, capabilities, visualFeatureType) {
36
+ this.sourceCode = sourceCode;
37
+ this.capabilities = capabilities;
38
+ this.visualFeatureType = visualFeatureType;
39
+ }
40
+ contain(keyword) {
41
+ return this.sourceCode.includes(keyword);
42
+ }
43
+ isCapabilityEnabled(expectedObject) {
44
+ return isMatch(this.capabilities, expectedObject);
45
+ }
46
+ }
package/lib/Visual.js ADDED
@@ -0,0 +1,34 @@
1
+ import { compareVersions } from "compare-versions";
2
+ import { VisualFeatureType } from "./features/FeatureTypes.js";
3
+ export class Visual {
4
+ visualFeatureType;
5
+ capabilities;
6
+ config;
7
+ packageJSON;
8
+ visualVersion;
9
+ constructor(capabilities, config, packageJson) {
10
+ this.capabilities = capabilities;
11
+ this.config = config;
12
+ this.visualFeatureType = this.getVisualFeatureType();
13
+ this.packageJSON = packageJson;
14
+ this.visualVersion = config.visual.version;
15
+ }
16
+ doesAPIVersionMatch(minAPIversion) {
17
+ return compareVersions(this.config.apiVersion ?? minAPIversion, minAPIversion) !== -1;
18
+ }
19
+ doesESLlintSupported() {
20
+ return Object.entries(this.packageJSON.scripts).some(([, value]) => value.includes("eslint"));
21
+ }
22
+ isVisualVersionValid(length) {
23
+ return this.visualVersion.split(".").length === length;
24
+ }
25
+ getVisualFeatureType() {
26
+ const isMatrixSupported = this.capabilities?.dataViewMappings?.some(dataView => dataView.matrix);
27
+ const isSlicer = Boolean(this.capabilities?.objects?.general?.properties?.filter?.type?.filter);
28
+ let type = isSlicer ? VisualFeatureType.Slicer : VisualFeatureType.NonSlicer;
29
+ if (isMatrixSupported) {
30
+ type = type | VisualFeatureType.Matrix;
31
+ }
32
+ return type;
33
+ }
34
+ }
@@ -33,7 +33,12 @@ import ConsoleWriter from './ConsoleWriter.js';
33
33
  import VisualGenerator from './VisualGenerator.js';
34
34
  import { readJsonFromRoot, readJsonFromVisual } from './utils.js';
35
35
  import WebpackWrap from './WebPackWrap.js';
36
+ import Package from './Package.js';
37
+ import { Visual } from "./Visual.js";
38
+ import { FeatureManager, Status } from "./FeatureManager.js";
39
+ import { Severity, Stage } from "./features/FeatureTypes.js";
36
40
  import TemplateFetcher from "./TemplateFetcher.js";
41
+ const globalConfig = readJsonFromRoot('config.json');
37
42
  const PBIVIZ_FILE = 'pbiviz.json';
38
43
  /**
39
44
  * Represents an instance of a visual package based on file path
@@ -41,7 +46,11 @@ const PBIVIZ_FILE = 'pbiviz.json';
41
46
  export default class VisualManager {
42
47
  basePath;
43
48
  pbivizConfig;
49
+ capabilities;
44
50
  webpackConfig;
51
+ visual;
52
+ package;
53
+ featureManager;
45
54
  compiler;
46
55
  webpackDevServer;
47
56
  constructor(rootPath) {
@@ -50,6 +59,7 @@ export default class VisualManager {
50
59
  prepareVisual() {
51
60
  if (this.doesPBIVIZExists()) {
52
61
  this.pbivizConfig = readJsonFromVisual(PBIVIZ_FILE, this.basePath);
62
+ this.createVisualInstance();
53
63
  }
54
64
  else {
55
65
  ConsoleWriter.error(PBIVIZ_FILE + ' not found. You must be in the root of a visual project to run this command.');
@@ -57,6 +67,11 @@ export default class VisualManager {
57
67
  }
58
68
  return this;
59
69
  }
70
+ createVisualInstance() {
71
+ this.capabilities = readJsonFromVisual("capabilities.json", this.basePath);
72
+ const packageJSON = readJsonFromVisual("package.json", this.basePath);
73
+ this.visual = new Visual(this.capabilities, this.pbivizConfig, packageJSON);
74
+ }
60
75
  async initializeWebpack(webpackOptions) {
61
76
  const webpackWrap = new WebpackWrap();
62
77
  this.webpackConfig = await webpackWrap.generateWebpackConfig(this, webpackOptions);
@@ -65,6 +80,9 @@ export default class VisualManager {
65
80
  }
66
81
  generatePackage() {
67
82
  const callback = (err, stats) => {
83
+ this.createPackageInstance();
84
+ const logs = this.validatePackage();
85
+ this.outputResults(logs);
68
86
  this.parseCompilationResults(err, stats);
69
87
  };
70
88
  this.compiler.run(callback);
@@ -96,6 +114,32 @@ export default class VisualManager {
96
114
  process.exit(1);
97
115
  }
98
116
  }
117
+ validateVisual() {
118
+ this.featureManager = new FeatureManager();
119
+ const { status, logs } = this.featureManager.validate(Stage.PreBuild, this.visual);
120
+ this.outputResults(logs);
121
+ if (status === Status.Error) {
122
+ process.exit(1);
123
+ }
124
+ return this;
125
+ }
126
+ validatePackage() {
127
+ const featureManager = new FeatureManager();
128
+ const { logs } = featureManager.validate(Stage.PostBuild, this.package);
129
+ return logs;
130
+ }
131
+ outputResults({ errors, deprecation, warnings, info }) {
132
+ const featuresTotalLog = {
133
+ errors: `Visual doesn't support some features required for all custom visuals:`,
134
+ deprecation: `Some features are going to be required soon, please update the visual:`,
135
+ warn: `Visual doesn't support some features recommended for all custom visuals:`,
136
+ info: `Visual can be improved by adding some features:`
137
+ };
138
+ this.outputLogsWithHeadMessage(featuresTotalLog.errors, errors, Severity.Error);
139
+ this.outputLogsWithHeadMessage(featuresTotalLog.deprecation, deprecation, Severity.Deprecation);
140
+ this.outputLogsWithHeadMessage(featuresTotalLog.warn, warnings, Severity.Warning);
141
+ this.outputLogsWithHeadMessage(featuresTotalLog.info, info, Severity.Info);
142
+ }
99
143
  displayInfo() {
100
144
  if (this.pbivizConfig) {
101
145
  ConsoleWriter.infoTable(this.pbivizConfig);
@@ -178,6 +222,11 @@ export default class VisualManager {
178
222
  this.webpackDevServer = null;
179
223
  }
180
224
  }
225
+ createPackageInstance() {
226
+ const pathToJSContent = path.join((this.pbivizConfig.build ?? globalConfig.build).dropFolder, "visual.js");
227
+ const sourceCode = fs.readFileSync(pathToJSContent, "utf8");
228
+ this.package = new Package(sourceCode, this.capabilities, this.visual.visualFeatureType);
229
+ }
181
230
  parseCompilationResults(err, stats) {
182
231
  ConsoleWriter.blank();
183
232
  if (err) {
@@ -191,4 +240,28 @@ export default class VisualManager {
191
240
  ConsoleWriter.done('Build completed successfully');
192
241
  }
193
242
  }
243
+ outputLogsWithHeadMessage(headMessage, logs, severity) {
244
+ if (!logs.length) {
245
+ return;
246
+ }
247
+ let outputLog;
248
+ switch (severity) {
249
+ case Severity.Deprecation:
250
+ case Severity.Error:
251
+ outputLog = ConsoleWriter.error;
252
+ break;
253
+ case Severity.Warning:
254
+ outputLog = ConsoleWriter.warning;
255
+ break;
256
+ default:
257
+ outputLog = ConsoleWriter.info;
258
+ break;
259
+ }
260
+ if (headMessage) {
261
+ outputLog(headMessage);
262
+ ConsoleWriter.blank();
263
+ }
264
+ logs.forEach(error => outputLog(error));
265
+ ConsoleWriter.blank();
266
+ }
194
267
  }
@@ -0,0 +1,16 @@
1
+ import { readJsonFromRoot } from "../utils.js";
2
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
3
+ export default class APIVersion {
4
+ static featureName = "Api";
5
+ static severity = Severity.Error;
6
+ static stage = Stage.PreBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer;
8
+ static minAPIversion;
9
+ static errorMessage;
10
+ static isSupported(visual) {
11
+ const globalConfig = readJsonFromRoot('config.json');
12
+ this.minAPIversion = globalConfig.constants.minAPIversion;
13
+ this.errorMessage = `API version must be at least ${this.minAPIversion}.`;
14
+ return visual.doesAPIVersionMatch(this.minAPIversion);
15
+ }
16
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class AdvancedEditMode {
3
+ static featureName = "Advanced Edit Mode";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/advanced-edit-mode";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return !packageInstance.isCapabilityEnabled({ advancedEditMode: 0 }); // 0 - Advanced edit mode is disabled
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class AllowInteractions {
3
+ static featureName = "Allow Interactions";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/visuals-interactions";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain('.allowInteractions');
11
+ }
12
+ }
@@ -0,0 +1,17 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class AnalyticsPane {
3
+ static featureName = "Analytics Pane";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/analytics-pane";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return (packageInstance.isCapabilityEnabled({
11
+ objects: {
12
+ objectCategory: 2
13
+ }
14
+ }) ||
15
+ packageInstance.contain("analyticsPane=true"));
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ export default class BaseFeature {
2
+ static severity;
3
+ static stage;
4
+ static visualFeatureType;
5
+ static featureName;
6
+ static documentationLink;
7
+ static errorMessage;
8
+ static isSupported() { }
9
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class Bookmarks {
3
+ static featureName = "Bookmarks";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/bookmarks-support";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain("applySelectionFromFilter") || packageInstance.contain("registerOnSelectCallback");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class ColorPalette {
3
+ static featureName = "Color Palette";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/add-colors-power-bi-visual";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".colorPalette");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class ConditionalFormatting {
3
+ static featureName = "Conditional Formatting";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/conditional-format";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".createDataViewWildcardSelector");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class ContextMenu {
3
+ static featureName = "Context Menu";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/context-menu";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".showContextMenu");
11
+ }
12
+ }
@@ -0,0 +1,16 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class DrillDown {
3
+ static featureName = "Drill Down";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/drill-down-support";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({
11
+ drilldown: {
12
+ roles: []
13
+ }
14
+ });
15
+ }
16
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class ESLint {
3
+ static featureName = "ESLint";
4
+ static documentationLink = "https://github.com/microsoft/eslint-plugin-powerbi-visuals";
5
+ static severity = Severity.Error;
6
+ static stage = Stage.PreBuild;
7
+ static visualFeatureType = VisualFeatureType.All;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(visual) {
10
+ return visual.doesESLlintSupported();
11
+ }
12
+ }
@@ -0,0 +1,23 @@
1
+ export var Severity;
2
+ (function (Severity) {
3
+ Severity["Error"] = "error";
4
+ Severity["Deprecation"] = "deprecation";
5
+ Severity["Warning"] = "warning";
6
+ Severity["Info"] = "info";
7
+ })(Severity || (Severity = {}));
8
+ export var Stage;
9
+ (function (Stage) {
10
+ Stage["PreBuild"] = "pre-build";
11
+ Stage["PostBuild"] = "post-build";
12
+ })(Stage || (Stage = {}));
13
+ export var VisualFeatureType;
14
+ (function (VisualFeatureType) {
15
+ VisualFeatureType[VisualFeatureType["NonSlicer"] = 2] = "NonSlicer";
16
+ VisualFeatureType[VisualFeatureType["Slicer"] = 4] = "Slicer";
17
+ VisualFeatureType[VisualFeatureType["Matrix"] = 8] = "Matrix";
18
+ VisualFeatureType[VisualFeatureType["All"] = 14] = "All";
19
+ })(VisualFeatureType || (VisualFeatureType = {}));
20
+ // Interaction types: Selection or filter (slicer)
21
+ // Slicer type: Basic, Advanced, Tuple filter, Identity filter
22
+ // Visual Type: TS/JS or R-Visual or RHTML
23
+ // Dataview Type: Single or Matrix or Table or Category or All
@@ -0,0 +1,22 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class FetchMoreData {
3
+ static featureName = "Fetch More Data";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/fetch-more-data";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({
11
+ dataViewMappings: [
12
+ {
13
+ table: {
14
+ rows: {
15
+ dataReductionAlgorithm: {}
16
+ }
17
+ }
18
+ }
19
+ ]
20
+ });
21
+ }
22
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class FileDownload {
3
+ static featureName = "File Download";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/file-download-api";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".downloadService") && packageInstance.contain(".exportVisualsContent");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class FormatPane {
3
+ static featureName = "Format Pane";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/format-pane";
5
+ static severity = Severity.Deprecation;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.All;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain("getFormattingModel");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class HighContrast {
3
+ static featureName = "High Contrast";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/high-contrast-support";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".isHighContrast");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class HighlightData {
3
+ static featureName = "Highlight Data";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/highlight";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({ supportsHighlight: true });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class KeyboardNavigation {
3
+ static featureName = "Keyboard Navigation";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/supportskeyboardfocus-feature";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({ supportsKeyboardFocus: true });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class LandingPage {
3
+ static featureName = "Landing Page";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/landing-page";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({ supportsLandingPage: true });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class LaunchURL {
3
+ static featureName = "Launch URL";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/launch-url";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".launchUrl");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class LocalStorage {
3
+ static featureName = "Local Storage";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/local-storage";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".storageService");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class Localizations {
3
+ static featureName = "Localizations";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/localization";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".createLocalizationManager");
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class ModalDialog {
3
+ static featureName = "Modal Dialog";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/create-display-dialog-box";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".openModalDialog");
11
+ }
12
+ }
@@ -0,0 +1,13 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class RenderingEvents {
3
+ static featureName = "Rendering Events";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/event-service";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.All;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ const keywords = [".eventService", ".renderingStarted", ".renderingFinished"];
11
+ return !keywords.some(keyword => !packageInstance.contain(keyword));
12
+ }
13
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class SelectionAcrossVisuals {
3
+ static featureName = "Selection Across Visuals";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/supportsmultivisualselection-feature";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({ supportsMultiVisualSelection: true });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class SyncSlicer {
3
+ static featureName = "Sync Slicer";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/enable-sync-slicers";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({ supportsSynchronizingFilterState: true });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class Tooltips {
3
+ static featureName = "Tooltips";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/add-tooltips";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain("tooltipService") && packageInstance.isCapabilityEnabled({ tooltips: {} });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class TotalSubTotal {
3
+ static featureName = "Total SubTotal";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/total-subtotal-api";
5
+ static severity = Severity.Warning;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.Matrix | VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.isCapabilityEnabled({ subtotals: true });
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class VisualVersion {
3
+ static featureName = "Visual version";
4
+ static expectedVersionLength = 4;
5
+ static errorMessage = `${this.featureName} should consist of ${this.expectedVersionLength} parts. Update the pbiviz.json file`;
6
+ static severity = Severity.Error;
7
+ static stage = Stage.PreBuild;
8
+ static visualFeatureType = VisualFeatureType.All;
9
+ static isSupported(visual) {
10
+ return visual.isVisualVersionValid(this.expectedVersionLength);
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ import { Severity, Stage, VisualFeatureType } from "./FeatureTypes.js";
2
+ export default class WarningIcon {
3
+ static featureName = "Warning Icon";
4
+ static documentationLink = "https://learn.microsoft.com/en-us/power-bi/developer/visuals/visual-display-warning-icon";
5
+ static severity = Severity.Info;
6
+ static stage = Stage.PostBuild;
7
+ static visualFeatureType = VisualFeatureType.NonSlicer | VisualFeatureType.Slicer;
8
+ static errorMessage = `${this.featureName} - ${this.documentationLink}`;
9
+ static isSupported(packageInstance) {
10
+ return packageInstance.contain(".displayWarningIcon");
11
+ }
12
+ }
@@ -0,0 +1,29 @@
1
+ import AdvancedEditMode from './AdvancedEditMode.js';
2
+ import AllowInteractions from './AllowInteractions.js';
3
+ import AnalyticsPane from './AnalyticsPane.js';
4
+ import Bookmarks from './Bookmarks.js';
5
+ import ColorPalette from './ColorPalette.js';
6
+ import ConditionalFormatting from './ConditionalFormatting.js';
7
+ import ContextMenu from './ContextMenu.js';
8
+ import DrillDown from './DrillDown.js';
9
+ import FetchMoreData from './FetchMoreData.js';
10
+ import FileDownload from './FileDownload.js';
11
+ import FormatPane from './FormatPane.js';
12
+ import HighContrast from './HighContrast.js';
13
+ import HighlightData from './HighlightData.js';
14
+ import KeyboardNavigation from './KeyboardNavigation.js';
15
+ import LandingPage from './LandingPage.js';
16
+ import LaunchURL from './LaunchURL.js';
17
+ import Localizations from './Localizations.js';
18
+ import LocalStorage from './LocalStorage.js';
19
+ import ModalDialog from './ModalDialog.js';
20
+ import RenderingEvents from './RenderingEvents.js';
21
+ import SelectionAcrossVisuals from './SelectionAcrossVisuals.js';
22
+ import SyncSlicer from './SyncSlicer.js';
23
+ import Tooltips from './Tooltips.js';
24
+ import TotalSubTotal from './TotalSubTotal.js';
25
+ import WarningIcon from './WarningIcon.js';
26
+ import APIVersion from './APIVersion.js';
27
+ import ESLint from './ESLint.js';
28
+ import VisualVersion from './VisualVersion.js';
29
+ export { AdvancedEditMode, AllowInteractions, AnalyticsPane, Bookmarks, ColorPalette, ConditionalFormatting, ContextMenu, DrillDown, FetchMoreData, FileDownload, FormatPane, HighContrast, HighlightData, KeyboardNavigation, LandingPage, LaunchURL, Localizations, LocalStorage, ModalDialog, RenderingEvents, SelectionAcrossVisuals, SyncSlicer, Tooltips, TotalSubTotal, WarningIcon, APIVersion, ESLint, VisualVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerbi-visuals-tools",
3
- "version": "5.1.0",
3
+ "version": "5.2.0-beta.2",
4
4
  "description": "Command line tool for creating and publishing visuals for Power BI",
5
5
  "main": "./bin/pbiviz.js",
6
6
  "type": "module",
@@ -54,6 +54,7 @@
54
54
  "lodash.clonedeep": "4.5.0",
55
55
  "lodash.defaults": "4.2.0",
56
56
  "lodash.isequal": "4.5.0",
57
+ "lodash.ismatch": "^4.4.0",
57
58
  "mini-css-extract-plugin": "^2.7.6",
58
59
  "os-browserify": "^0.3.0",
59
60
  "path-browserify": "^1.0.1",