feat(fe): upgrade superset-frontend to Typescript v5 (#31979)

Signed-off-by: hainenber <dotronghai96@gmail.com>
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
This commit is contained in:
Đỗ Trọng Hải
2025-01-29 18:40:33 +07:00
committed by GitHub
parent a21f184058
commit 19e8a7049b
141 changed files with 1095 additions and 572 deletions

View File

@@ -38,18 +38,37 @@ import { getPadding } from '../Timeseries/transformers';
import { convertInteger } from '../utils/convertInteger';
import { NULL_STRING } from '../constants';
const isIterable = (obj: any): obj is Iterable<any> =>
obj != null && typeof obj[Symbol.iterator] === 'function';
function normalizeSymbolSize(
nodes: ScatterSeriesOption[],
maxBubbleValue: number,
) {
const [bubbleMinValue, bubbleMaxValue] = extent(nodes, x => x.data?.[0]?.[2]);
const nodeSpread = bubbleMaxValue - bubbleMinValue;
nodes.forEach(node => {
// eslint-disable-next-line no-param-reassign
node.symbolSize =
(((node.data?.[0]?.[2] - bubbleMinValue) / nodeSpread) *
(maxBubbleValue * 2) || 0) + MINIMUM_BUBBLE_SIZE;
});
const [bubbleMinValue, bubbleMaxValue] = extent<ScatterSeriesOption, number>(
nodes,
x => {
const tmpValue = x.data?.[0];
const result = isIterable(tmpValue) ? tmpValue[2] : null;
if (typeof result === 'number') {
return result;
}
return null;
},
);
if (bubbleMinValue !== undefined && bubbleMaxValue !== undefined) {
const nodeSpread = bubbleMaxValue - bubbleMinValue;
nodes.forEach(node => {
const tmpValue = node.data?.[0];
const calculated = isIterable(tmpValue) ? tmpValue[2] : null;
if (typeof calculated === 'number') {
// eslint-disable-next-line no-param-reassign
node.symbolSize =
(((calculated - bubbleMinValue) / nodeSpread) *
(maxBubbleValue * 2) || 0) + MINIMUM_BUBBLE_SIZE;
}
});
}
}
export function formatTooltip(