Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
565 changes: 187 additions & 378 deletions superset/assets/package-lock.json

Large diffs are not rendered by default.

63 changes: 32 additions & 31 deletions superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,38 @@
"homepage": "http://superset.apache.org/",
"dependencies": {
"@data-ui/sparkline": "^0.0.54",
"@superset-ui/chart": "^0.9.6",
"@superset-ui/color": "^0.9.5",
"@superset-ui/connection": "^0.9.5",
"@superset-ui/core": "^0.9.5",
"@superset-ui/legacy-plugin-chart-calendar": "^0.1.1",
"@superset-ui/legacy-plugin-chart-chord": "^0.1.1",
"@superset-ui/legacy-plugin-chart-country-map": "^0.1.1",
"@superset-ui/legacy-plugin-chart-event-flow": "^0.1.1",
"@superset-ui/legacy-plugin-chart-force-directed": "^0.1.1",
"@superset-ui/legacy-plugin-chart-heatmap": "^0.1.1",
"@superset-ui/legacy-plugin-chart-histogram": "^0.1.1",
"@superset-ui/legacy-plugin-chart-horizon": "^0.1.1",
"@superset-ui/legacy-plugin-chart-iframe": "^0.1.1",
"@superset-ui/legacy-plugin-chart-map-box": "^0.1.1",
"@superset-ui/legacy-plugin-chart-markup": "^0.1.1",
"@superset-ui/legacy-plugin-chart-paired-t-test": "^0.1.0",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.1.1",
"@superset-ui/legacy-plugin-chart-partition": "^0.1.1",
"@superset-ui/legacy-plugin-chart-pivot-table": "^0.1.1",
"@superset-ui/legacy-plugin-chart-rose": "^0.1.1",
"@superset-ui/legacy-plugin-chart-sankey": "^0.1.1",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.1.1",
"@superset-ui/legacy-plugin-chart-table": "^0.1.1",
"@superset-ui/legacy-plugin-chart-treemap": "^0.1.1",
"@superset-ui/legacy-plugin-chart-word-cloud": "^0.1.1",
"@superset-ui/legacy-plugin-chart-world-map": "^0.1.1",
"@superset-ui/legacy-preset-chart-big-number": "^0.1.1",
"@superset-ui/legacy-preset-chart-nvd3": "^0.1.1",
"@superset-ui/number-format": "^0.9.5",
"@superset-ui/time-format": "^0.9.5",
"@superset-ui/translation": "^0.9.5",
"@superset-ui/chart": "^0.10.2",
"@superset-ui/color": "^0.10.1",
"@superset-ui/connection": "^0.10.2",
"@superset-ui/core": "^0.10.0",
"@superset-ui/dimension": "^0.10.0",
"@superset-ui/legacy-plugin-chart-calendar": "^0.10.0",
"@superset-ui/legacy-plugin-chart-chord": "^0.10.0",
"@superset-ui/legacy-plugin-chart-country-map": "^0.10.0",
"@superset-ui/legacy-plugin-chart-event-flow": "^0.10.0",
"@superset-ui/legacy-plugin-chart-force-directed": "^0.10.0",
"@superset-ui/legacy-plugin-chart-heatmap": "^0.10.0",
"@superset-ui/legacy-plugin-chart-histogram": "^0.10.0",
"@superset-ui/legacy-plugin-chart-horizon": "^0.10.0",
"@superset-ui/legacy-plugin-chart-iframe": "^0.10.0",
"@superset-ui/legacy-plugin-chart-map-box": "^0.10.0",
"@superset-ui/legacy-plugin-chart-markup": "^0.10.0",
"@superset-ui/legacy-plugin-chart-paired-t-test": "^0.10.0",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.10.0",
"@superset-ui/legacy-plugin-chart-partition": "^0.10.0",
"@superset-ui/legacy-plugin-chart-pivot-table": "^0.10.0",
"@superset-ui/legacy-plugin-chart-rose": "^0.10.0",
"@superset-ui/legacy-plugin-chart-sankey": "^0.10.0",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.10.0",
"@superset-ui/legacy-plugin-chart-table": "^0.10.0",
"@superset-ui/legacy-plugin-chart-treemap": "^0.10.0",
"@superset-ui/legacy-plugin-chart-word-cloud": "^0.10.0",
"@superset-ui/legacy-plugin-chart-world-map": "^0.10.0",
"@superset-ui/legacy-preset-chart-big-number": "^0.10.0",
"@superset-ui/legacy-preset-chart-nvd3": "^0.10.0",
"@superset-ui/number-format": "^0.10.1",
"@superset-ui/time-format": "^0.10.1",
"@superset-ui/translation": "^0.10.0",
"@vx/responsive": "0.0.172",
"abortcontroller-polyfill": "^1.1.9",
"bignumber.js": "^8.1.1",
Expand Down
1 change: 1 addition & 0 deletions superset/assets/src/components/AsyncSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const propTypes = {
PropTypes.number,
PropTypes.arrayOf(PropTypes.number),
]),
valueRenderer: PropTypes.func,
placeholder: PropTypes.string,
autoSelect: PropTypes.bool,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ import {
SortDirection,
SortIndicator,
} from 'react-virtualized';
import { getTextWidth } from '../../modules/visUtils';
import { getTextDimension } from '@superset-ui/dimension';

function getTextWidth(text, font = '12px Roboto') {
return getTextDimension({ text, style: { font } }).width;
}

const propTypes = {
orderedColumnKeys: PropTypes.array.isRequired,
Expand Down
3 changes: 3 additions & 0 deletions superset/assets/src/components/TableLoader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const propTypes = {
mutator: PropTypes.func,
columns: PropTypes.arrayOf(PropTypes.string),
addDangerToast: PropTypes.func.isRequired,
addInfoToast: PropTypes.func.isRequired,
addSuccessToast: PropTypes.func.isRequired,
addWarningToast: PropTypes.func.isRequired,
};

class TableLoader extends React.PureComponent {
Expand Down
48 changes: 0 additions & 48 deletions superset/assets/src/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,6 @@
*/
/* eslint camelcase: 0 */
import $ from 'jquery';
import { select as d3Select } from 'd3-selection';

/*
Utility function that takes a d3 svg:text selection and a max width, and splits the
text's text across multiple tspan lines such that any given line does not exceed max width

If text does not span multiple lines AND adjustedY is passed,
will set the text to the passed val
*/
export function wrapSvgText(text, width, adjustedY) {
const lineHeight = 1;
// ems
text.each(function () {
const d3Text = d3Select(this);
const words = d3Text.text().split(/\s+/);
let word;
let line = [];
let lineNumber = 0;
const x = d3Text.attr('x');
const y = d3Text.attr('y');
const dy = parseFloat(d3Text.attr('dy'));
let tspan =
d3Text.text(null).append('tspan').attr('x', x)
.attr('y', y)
.attr('dy', dy + 'em');

let didWrap = false;
for (let i = 0; i < words.length; i++) {
word = words[i];
line.push(word);
tspan.text(line.join(' '));
if (tspan.node().getComputedTextLength() > width) {
line.pop();
// remove word that pushes over the limit
tspan.text(line.join(' '));
line = [word];
tspan =
d3Text.append('tspan').attr('x', x).attr('y', y)
.attr('dy', ++lineNumber * lineHeight + dy + 'em')
.text(word);
didWrap = true;
}
}
if (!didWrap && typeof adjustedY !== 'undefined') {
tspan.attr('y', adjustedY);
}
});
}

/**
* Sets the body and title content of a modal, and shows it. Assumes HTML for modal exists and that
Expand Down
121 changes: 0 additions & 121 deletions superset/assets/src/modules/visUtils.js

This file was deleted.

8 changes: 2 additions & 6 deletions superset/assets/src/setup/setupFormatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
import { getNumberFormatter, getNumberFormatterRegistry, createSiAtMostNDigitFormatter, NumberFormats } from '@superset-ui/number-format';
import { getNumberFormatter, getNumberFormatterRegistry, NumberFormats } from '@superset-ui/number-format';
import { getTimeFormatterRegistry, smartDateFormatter, smartDateVerboseFormatter } from '@superset-ui/time-format';

export default function setupFormatters() {
const defaultNumberFormatter = createSiAtMostNDigitFormatter({ n: 3 });

getNumberFormatterRegistry()
.registerValue(defaultNumberFormatter.id, defaultNumberFormatter)
.setDefaultKey(defaultNumberFormatter.id)
// Add shims for format strings that are deprecated or common typos.
// Temporary solution until performing a db migration to fix this.
.registerValue(',0', getNumberFormatter(',.4~f'))
Expand All @@ -51,7 +47,7 @@ export default function setupFormatters() {
.registerValue(',0f', getNumberFormatter(',d'))
.registerValue('+,%', getNumberFormatter('+,.0%'))
.registerValue('$f', getNumberFormatter('$,d'))
.registerValue('+,', getNumberFormatter(NumberFormats.INTEGER_CHANGE))
.registerValue('+,', getNumberFormatter(NumberFormats.INTEGER_SIGNED))
.registerValue(',2f', getNumberFormatter(',.4~f'))
.registerValue(',g', getNumberFormatter(',.4~f'))
.registerValue('int', getNumberFormatter(NumberFormats.INTEGER))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Sparkline, LineSeries, PointSeries, HorizontalReferenceLine, VerticalReferenceLine, WithTooltip } from '@data-ui/sparkline';
import { formatNumber } from '@superset-ui/number-format';
import { getTextDimension } from '../../modules/visUtils';
import { getTextDimension } from '@superset-ui/dimension';

const propTypes = {
className: PropTypes.string,
Expand Down