Power BI fixes for MacOS/Safari (#84)

* display for blank values in tooltip
* use height: 100%
* remove absolute positioning
* show pbi cv version
* filter internal column names
* show legend when color column is mapped
This commit is contained in:
Dan Marshall 2019-09-04 22:56:16 -07:00 коммит произвёл GitHub
Родитель 32c5d7f7bd
Коммит 1e3e1f766b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 69 добавлений и 29 удалений

Просмотреть файл

@ -5,19 +5,20 @@
"pbiviz": "pbiviz",
"start": "pbiviz start",
"package": "pbiviz package",
"build": "npm run package"
"version": "node ./scripts/version.js",
"build": "npm run version && npm run package"
},
"dependencies": {
"@babel/polyfill": "^7.4.4",
"@babel/runtime": "^7.4.5",
"@babel/runtime-corejs2": "^7.4.5",
"@babel/runtime": "^7.5.5",
"@babel/runtime-corejs2": "^7.5.5",
"@deck.gl/core": "6.4",
"@deck.gl/layers": "6.4",
"@msrvida/sanddance-explorer": "*",
"core-js": "3.2.1",
"luma.gl": "6.4",
"office-ui-fabric-react": "^6.129.1",
"powerbi-visuals-api": "^2.6.1",
"powerbi-visuals-utils-dataviewutils": "~2.2.0",
"powerbi-visuals-api": "~2.6.1",
"powerbi-visuals-utils-dataviewutils": "^2.2.1",
"react": "16.8.6",
"react-dom": "16.8.6",
"vega-lib": "^4.3.0"

Просмотреть файл

@ -0,0 +1,20 @@
const fs = require('fs');
const path = require('path');
const cwd = process.cwd();
console.log(`versioning...`);
const pbivizJson = require(path.resolve(cwd, 'pbiviz.json'));
const ts = `// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
export const version: string = "${pbivizJson.visual.version}";
`;
const file = path.resolve(cwd, 'src', 'version.ts');
fs.writeFileSync(file, ts);
console.log(`versioning complete`);

Просмотреть файл

@ -18,6 +18,7 @@ import {
} from '@msrvida/sanddance-explorer';
import { Logo } from '@msrvida/sanddance-explorer/dist/es6/controls/logo';
import { strings } from './language';
import { version } from './version';
fabric.initializeIcons();
@ -122,7 +123,10 @@ export class App extends React.Component<Props, State> {
},
onSignalChanged: this.props.onViewChange,
onTooltipExclusionsChanged: tooltipExclusions => this.props.onViewChange(tooltipExclusions),
onView: this.props.onViewChange
onView: this.props.onViewChange,
systemInfoChildren: [
React.createElement("li", null, `${strings.powerBiCustomVisual}: ${version}`)
]
};
return React.createElement("div", { className },
React.createElement(Explorer, explorerProps),

Просмотреть файл

@ -1,5 +1,6 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
export const strings = {
powerBiCustomVisual: "Power BI custom visual version",
webglDisabled: "SandDance requires a WebGL enabled browser."
}

Просмотреть файл

@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
export const version: string = "1.2.1";

Просмотреть файл

@ -7,15 +7,12 @@
.sanddance-powerbi {
display: grid;
position: absolute;
bottom: 0;
top: 0;
left: 0;
right: 0;
height: 100%;
}
.sanddance-app {
display: grid;
height: 100%;
&.chromeless {
.sanddance-explorer {
grid-template-rows: auto;

Просмотреть файл

@ -17,7 +17,7 @@ export function ensureColumnsExist(insightColumns: SandDance.types.InsightColumn
export function ensureColumnsPopulated(chart: SandDance.types.Chart, insightColumns: SandDance.types.InsightColumns, actualColumns: SandDance.types.Column[]) {
//ensure columns are populated
const firstColumn = actualColumns[0];
const firstColumn = actualColumns.filter(c => !SandDance.util.isInternalFieldName(c.name))[0];
const firstColumnName = firstColumn && firstColumn.name;
const ensureColumn = (role: SandDance.types.InsightColumnRoles) => {
if (!insightColumns[role]) {

Просмотреть файл

@ -9,15 +9,12 @@
) {
.sanddance-sidebar {
background-color: $bg-color;
bottom: 0;
display: grid;
grid-template-areas: "stats stats"
"tabs bar";
grid-template-columns: $sidetab-width auto;
grid-template-rows: 0fr auto;
overflow: hidden;
position: absolute;
top: 0;
transition: width 350ms cubic-bezier(.4, 0, .2, 1); //TODO param
width: $toolbar-width;
z-index: 1; //appear over the canvas even though it is behind it in the dom.

Просмотреть файл

@ -317,6 +317,7 @@ export class Settings extends React.Component<Props, State> {
title={strings.labelSystemInfo}
>
<ul>
{this.props.children}
<li>
SandDanceExplorer version: {version}
</li>

Просмотреть файл

@ -67,6 +67,7 @@ export interface Props {
onView?: () => void;
onSignalChanged?: () => void;
onTooltipExclusionsChanged?: (tooltipExclusions: string[]) => void;
systemInfoChildren?: React.ReactNode;
}
export interface State extends SandDance.types.Insight {
@ -697,10 +698,6 @@ export class Explorer extends React.Component<Props, State> {
view
};
if (!insight.columns || !insight.columns.color) {
insight.hideLegend = true;
}
const loaded = !!(this.state.columns && this.state.dataContent);
const selectionState: SandDance.types.SelectionState = (this.viewer && this.viewer.getSelection()) || {};
@ -750,7 +747,7 @@ export class Explorer extends React.Component<Props, State> {
}}
onHomeClick={() => this.viewer.presenter.homeCamera()}
/>
<div className={util.classList("sanddance-main", this.state.sidebarPinned && "pinned", this.state.sidebarClosed && "closed", insight.hideLegend && "hide-legend")}>
<div className={util.classList("sanddance-main", this.state.sidebarPinned && "pinned", this.state.sidebarClosed && "closed", (insight.hideLegend || !(insight.columns && insight.columns.color)) && "hide-legend")}>
<div ref={div => { if (div && !this.layoutDivUnpinned) this.layoutDivUnpinned = div }} className="sanddance-layout-unpinned"></div>
<div ref={div => { if (div && !this.layoutDivPinned) this.layoutDivPinned = div }} className="sanddance-layout-pinned"></div>
{!loaded && (
@ -967,7 +964,9 @@ export class Explorer extends React.Component<Props, State> {
onToggleLegend={hideLegend => this.setState({ hideLegend, calculating: () => this._resize() })}
hideAxes={this.state.hideAxes}
onToggleAxes={hideAxes => this.setState({ calculating: () => this.setState({ hideAxes }) })}
/>
>
{this.props.systemInfoChildren}
</Settings>
);
}
})()}

Просмотреть файл

@ -5,10 +5,7 @@ import { GL_ORDINAL } from './vega-deck.gl/constants';
import { isInternalFieldName } from './util';
import { outerSize } from './vega-deck.gl/htmlHelpers';
import { Table, TableRow } from './vega-deck.gl/controls';
export interface TooltipOptions {
exclude: (columnName: string) => boolean;
}
import { TooltipOptions } from './types';
interface Props {
cssPrefix: string;
@ -87,10 +84,26 @@ function getRows(item: object, options: TooltipOptions) {
continue;
}
}
let value: any = item[columnName];
let content: string | JSX.Element;
if (options && options.displayValue) {
content = options.displayValue(value);
} else {
switch (value) {
case null:
content = <i>null</i>;
break;
case undefined:
content = <i>undefined</i>;
break;
default:
content = value.toString();
}
}
rows.push({
cells: [
{ content: columnName + ':' },
{ content: item[columnName] }
{ content }
]
});
}

Просмотреть файл

@ -15,12 +15,10 @@ import { DeckProps } from '@deck.gl/core/lib/deck';
import { Search, SearchExpressionGroup } from './searchExpression/types';
import { Spec } from 'vega-typings';
import { SpecResult } from './specs/interfaces';
import { TooltipOptions } from './tooltip';
import { TextLayerDatum } from '@deck.gl/layers/text-layer/text-layer';
export * from './searchExpression/types';
export * from './specs/types';
export { TooltipOptions };
/**
* Map of ordinals per unique Id.
@ -348,3 +346,8 @@ export interface SelectionState {
selectedData?: object[];
active?: object;
}
export interface TooltipOptions {
exclude?: (columnName: string) => boolean;
displayValue?: (value: any) => string;
}