chore: bump superset to 0.18.6 (#16807)

This commit is contained in:
Ville Brofeldt 2021-09-23 14:03:03 +03:00 committed by GitHub
parent 84f7614e97
commit 4086bedb68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 359 additions and 382 deletions

File diff suppressed because it is too large Load Diff

View File

@ -68,35 +68,35 @@
"@emotion/cache": "^11.4.0",
"@emotion/react": "^11.4.1",
"@emotion/styled": "^11.3.0",
"@superset-ui/chart-controls": "^0.18.5",
"@superset-ui/core": "^0.18.5",
"@superset-ui/legacy-plugin-chart-calendar": "^0.18.5",
"@superset-ui/legacy-plugin-chart-chord": "^0.18.5",
"@superset-ui/legacy-plugin-chart-country-map": "^0.18.5",
"@superset-ui/legacy-plugin-chart-event-flow": "^0.18.5",
"@superset-ui/legacy-plugin-chart-force-directed": "^0.18.5",
"@superset-ui/legacy-plugin-chart-heatmap": "^0.18.5",
"@superset-ui/legacy-plugin-chart-histogram": "^0.18.5",
"@superset-ui/legacy-plugin-chart-horizon": "^0.18.5",
"@superset-ui/legacy-plugin-chart-map-box": "^0.18.5",
"@superset-ui/legacy-plugin-chart-paired-t-test": "^0.18.5",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.18.5",
"@superset-ui/legacy-plugin-chart-partition": "^0.18.5",
"@superset-ui/legacy-plugin-chart-pivot-table": "^0.18.5",
"@superset-ui/legacy-plugin-chart-rose": "^0.18.5",
"@superset-ui/legacy-plugin-chart-sankey": "^0.18.5",
"@superset-ui/legacy-plugin-chart-sankey-loop": "^0.18.5",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.18.5",
"@superset-ui/legacy-plugin-chart-treemap": "^0.18.5",
"@superset-ui/legacy-plugin-chart-world-map": "^0.18.5",
"@superset-ui/legacy-preset-chart-big-number": "^0.18.5",
"@superset-ui/chart-controls": "^0.18.6",
"@superset-ui/core": "^0.18.6",
"@superset-ui/legacy-plugin-chart-calendar": "^0.18.6",
"@superset-ui/legacy-plugin-chart-chord": "^0.18.6",
"@superset-ui/legacy-plugin-chart-country-map": "^0.18.6",
"@superset-ui/legacy-plugin-chart-event-flow": "^0.18.6",
"@superset-ui/legacy-plugin-chart-force-directed": "^0.18.6",
"@superset-ui/legacy-plugin-chart-heatmap": "^0.18.6",
"@superset-ui/legacy-plugin-chart-histogram": "^0.18.6",
"@superset-ui/legacy-plugin-chart-horizon": "^0.18.6",
"@superset-ui/legacy-plugin-chart-map-box": "^0.18.6",
"@superset-ui/legacy-plugin-chart-paired-t-test": "^0.18.6",
"@superset-ui/legacy-plugin-chart-parallel-coordinates": "^0.18.6",
"@superset-ui/legacy-plugin-chart-partition": "^0.18.6",
"@superset-ui/legacy-plugin-chart-pivot-table": "^0.18.6",
"@superset-ui/legacy-plugin-chart-rose": "^0.18.6",
"@superset-ui/legacy-plugin-chart-sankey": "^0.18.6",
"@superset-ui/legacy-plugin-chart-sankey-loop": "^0.18.6",
"@superset-ui/legacy-plugin-chart-sunburst": "^0.18.6",
"@superset-ui/legacy-plugin-chart-treemap": "^0.18.6",
"@superset-ui/legacy-plugin-chart-world-map": "^0.18.6",
"@superset-ui/legacy-preset-chart-big-number": "^0.18.6",
"@superset-ui/legacy-preset-chart-deckgl": "^0.4.12",
"@superset-ui/legacy-preset-chart-nvd3": "^0.18.5",
"@superset-ui/plugin-chart-echarts": "^0.18.5",
"@superset-ui/plugin-chart-pivot-table": "^0.18.5",
"@superset-ui/plugin-chart-table": "^0.18.5",
"@superset-ui/plugin-chart-word-cloud": "^0.18.5",
"@superset-ui/preset-chart-xy": "^0.18.5",
"@superset-ui/legacy-preset-chart-nvd3": "^0.18.6",
"@superset-ui/plugin-chart-echarts": "^0.18.6",
"@superset-ui/plugin-chart-pivot-table": "^0.18.6",
"@superset-ui/plugin-chart-table": "^0.18.6",
"@superset-ui/plugin-chart-word-cloud": "^0.18.6",
"@superset-ui/preset-chart-xy": "^0.18.6",
"@vx/responsive": "^0.0.195",
"abortcontroller-polyfill": "^1.1.9",
"antd": "^4.9.4",
@ -129,7 +129,6 @@
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"match-sorter": "^6.1.0",
"math-expression-evaluator": "^1.3.8",
"memoize-one": "^5.1.1",
"moment": "^2.26.0",
"moment-timezone": "^0.5.33",

View File

@ -20,13 +20,13 @@ import React from 'react';
import PropTypes from 'prop-types';
import { CompactPicker } from 'react-color';
import Button from 'src/components/Button';
import mexp from 'math-expression-evaluator';
import {
t,
SupersetClient,
getCategoricalSchemeRegistry,
getChartMetadataRegistry,
validateNonEmpty,
isValidExpression,
} from '@superset-ui/core';
import SelectControl from 'src/explore/components/controls/SelectControl';
@ -204,28 +204,9 @@ export default class AnnotationLayer extends React.PureComponent {
return sources;
}
isValidFormula(expression, annotationType) {
isValidFormulaAnnotation(expression, annotationType) {
if (annotationType === ANNOTATION_TYPES.FORMULA) {
try {
const token = {
type: 3,
token: 'x',
show: 'x',
value: 'x',
};
// handle input like "y = x+1" instead of just "x+1"
const subexpressions = expression.split('=');
if (
subexpressions.length > 2 ||
(subexpressions[1] && !subexpressions[0].match(/^\s*[a-zA-Z]\w*\s*$/))
) {
return false;
}
mexp.eval(subexpressions[1] ?? subexpressions[0], [token], { x: 0 });
} catch (err) {
return false;
}
return isValidExpression(expression);
}
return true;
}
@ -253,7 +234,7 @@ export default class AnnotationLayer extends React.PureComponent {
errors.push(validateNonEmpty(intervalEndColumn));
}
}
errors.push(!this.isValidFormula(value, annotationType));
errors.push(!this.isValidFormulaAnnotation(value, annotationType));
return !errors.filter(x => x).length;
}
@ -457,7 +438,9 @@ export default class AnnotationLayer extends React.PureComponent {
value={value}
onChange={this.handleValue}
validationErrors={
!this.isValidFormula(value, annotationType) ? ['Bad formula.'] : []
!this.isValidFormulaAnnotation(value, annotationType)
? ['Bad formula.']
: []
}
/>
);