chore: fix `tsc` errors (#31965)
Signed-off-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
parent
fcd166149c
commit
6d117ffbb5
|
|
@ -22,11 +22,11 @@ export enum OverwritePolicy {
|
||||||
Warn = 'WARN',
|
Warn = 'WARN',
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ItemWithValue<T> {
|
export interface ItemWithValue<T> {
|
||||||
value: T;
|
value: T;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ItemWithLoader<T> {
|
export interface ItemWithLoader<T> {
|
||||||
loader: () => T;
|
loader: () => T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import { forwardRef, useState, ReactNode, MouseEvent } from 'react';
|
||||||
import Modal from 'src/components/Modal';
|
import Modal from 'src/components/Modal';
|
||||||
import Button from 'src/components/Button';
|
import Button from 'src/components/Button';
|
||||||
|
|
||||||
interface ModalTriggerProps {
|
export interface ModalTriggerProps {
|
||||||
dialogClassName?: string;
|
dialogClassName?: string;
|
||||||
triggerNode: ReactNode;
|
triggerNode: ReactNode;
|
||||||
modalTitle?: string;
|
modalTitle?: string;
|
||||||
|
|
|
||||||
|
|
@ -186,8 +186,10 @@ export const handleFilterOptionHelper = (
|
||||||
const searchValue = search.trim().toLowerCase();
|
const searchValue = search.trim().toLowerCase();
|
||||||
if (optionFilterProps?.length) {
|
if (optionFilterProps?.length) {
|
||||||
return optionFilterProps.some(prop => {
|
return optionFilterProps.some(prop => {
|
||||||
const optionProp = option?.[prop]
|
const optionProp = option?.[prop as keyof LabeledValue]
|
||||||
? String(option[prop]).trim().toLowerCase()
|
? String(option[prop as keyof LabeledValue])
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
: '';
|
: '';
|
||||||
return optionProp.includes(searchValue);
|
return optionProp.includes(searchValue);
|
||||||
});
|
});
|
||||||
|
|
@ -200,7 +202,9 @@ export const handleFilterOptionHelper = (
|
||||||
export const hasCustomLabels = (options: SelectOptionsType) =>
|
export const hasCustomLabels = (options: SelectOptionsType) =>
|
||||||
options?.some(opt => !!opt?.customLabel);
|
options?.some(opt => !!opt?.customLabel);
|
||||||
|
|
||||||
export const renderSelectOptions = (options: SelectOptionsType) =>
|
export const renderSelectOptions = (
|
||||||
|
options: SelectOptionsType,
|
||||||
|
): JSX.Element[] =>
|
||||||
options.map(opt => {
|
options.map(opt => {
|
||||||
const isOptObject = typeof opt === 'object';
|
const isOptObject = typeof opt === 'object';
|
||||||
const label = isOptObject ? opt?.label || opt.value : opt;
|
const label = isOptObject ? opt?.label || opt.value : opt;
|
||||||
|
|
@ -213,7 +217,10 @@ export const renderSelectOptions = (options: SelectOptionsType) =>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
export const mapValues = (values: SelectOptionsType, labelInValue: boolean) =>
|
export const mapValues = (
|
||||||
|
values: SelectOptionsType,
|
||||||
|
labelInValue: boolean,
|
||||||
|
): (Record<string, any> | any)[] =>
|
||||||
labelInValue
|
labelInValue
|
||||||
? values.map(opt => ({
|
? values.map(opt => ({
|
||||||
key: opt.value,
|
key: opt.value,
|
||||||
|
|
@ -222,7 +229,7 @@ export const mapValues = (values: SelectOptionsType, labelInValue: boolean) =>
|
||||||
}))
|
}))
|
||||||
: values.map(opt => opt.value);
|
: values.map(opt => opt.value);
|
||||||
|
|
||||||
export const mapOptions = (values: SelectOptionsType) =>
|
export const mapOptions = (values: SelectOptionsType): Record<string, any>[] =>
|
||||||
values.map(opt => ({
|
values.map(opt => ({
|
||||||
children: opt.label,
|
children: opt.label,
|
||||||
key: opt.value,
|
key: opt.value,
|
||||||
|
|
|
||||||
|
|
@ -33,15 +33,7 @@ import VizTypeGallery, {
|
||||||
MAX_ADVISABLE_VIZ_GALLERY_WIDTH,
|
MAX_ADVISABLE_VIZ_GALLERY_WIDTH,
|
||||||
} from './VizTypeGallery';
|
} from './VizTypeGallery';
|
||||||
import { FastVizSwitcher } from './FastVizSwitcher';
|
import { FastVizSwitcher } from './FastVizSwitcher';
|
||||||
|
import { VizTypeControlProps } from './types';
|
||||||
interface VizTypeControlProps {
|
|
||||||
description?: string;
|
|
||||||
label?: string;
|
|
||||||
name: string;
|
|
||||||
onChange: (vizType: string | null) => void;
|
|
||||||
value: string | null;
|
|
||||||
isModalOpenInit?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bootstrapData = getBootstrapData();
|
const bootstrapData = getBootstrapData();
|
||||||
const denyList: string[] = (
|
const denyList: string[] = (
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,19 @@ export interface FastVizSwitcherProps {
|
||||||
onChange: (vizName: string) => void;
|
onChange: (vizName: string) => void;
|
||||||
currentSelection: string | null;
|
currentSelection: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VizTileProps {
|
export interface VizTileProps {
|
||||||
vizMeta: VizMeta;
|
vizMeta: VizMeta;
|
||||||
isActive: boolean;
|
isActive: boolean;
|
||||||
isRendered: boolean;
|
isRendered: boolean;
|
||||||
onTileClick: (vizType: string) => void;
|
onTileClick: (vizType: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VizTypeControlProps {
|
||||||
|
description?: string;
|
||||||
|
label?: string;
|
||||||
|
name: string;
|
||||||
|
onChange: (vizType: string | null) => void;
|
||||||
|
value: string | null;
|
||||||
|
isModalOpenInit?: boolean;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ if (isFeatureEnabled(FeatureFlag.TaggingSystem)) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const frontEndRoutes = routes
|
const frontEndRoutes: Record<string, boolean> = routes
|
||||||
.map(r => r.path)
|
.map(r => r.path)
|
||||||
.reduce(
|
.reduce(
|
||||||
(acc, curr) => ({
|
(acc, curr) => ({
|
||||||
|
|
@ -248,10 +248,10 @@ const frontEndRoutes = routes
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
|
||||||
export function isFrontendRoute(path?: string) {
|
export const isFrontendRoute = (path?: string): boolean => {
|
||||||
if (path) {
|
if (path) {
|
||||||
const basePath = path.split(/[?#]/)[0]; // strip out query params and link bookmarks
|
const basePath = path.split(/[?#]/)[0]; // strip out query params and link bookmarks
|
||||||
return !!frontEndRoutes[basePath];
|
return !!frontEndRoutes[basePath];
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue