Skip to content

Commit

Permalink
fix: fix test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
xile611 committed Nov 24, 2023
1 parent 8e97374 commit 0f0a0d0
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
12 changes: 6 additions & 6 deletions packages/vgrammar-core/src/component/title.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isValid, merge } from '@visactor/vutils';
import type { IGraphic } from '@visactor/vrender-core';
import type { IGraphic, IRichTextCharacter } from '@visactor/vrender-core';
import type { TitleAttrs } from '@visactor/vrender-components';
// eslint-disable-next-line no-duplicate-imports
import { Title as TitleComponent } from '@visactor/vrender-components';
Expand All @@ -22,13 +22,13 @@ import { invokeFunctionType } from '../parse/util';
import { Factory } from '../core/factory';

export const generateTitleAttributes = (
title?: string | number | number[] | string[],
subTitle?: string | number | number[] | string[],
title?: string | number | number[] | string[] | IRichTextCharacter[],
subTitle?: string | number | number[] | string[] | IRichTextCharacter[],
theme?: ITheme,
addition?: RecursivePartial<TitleAttrs>
): TitleAttrs => {
const titleTheme = theme?.components?.title;
const attributes: RecursivePartial<TitleAttrs> = {};
const attributes: Partial<TitleAttrs> = {};
if (isValid(title)) {
attributes.text = title;
}
Expand All @@ -54,11 +54,11 @@ export class Title extends Component implements ITitle {
return this;
}

title(text: MarkFunctionType<string | number | number[] | string[]> | Nil) {
title(text: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]> | Nil) {
return this.setFunctionSpec(text, 'title');
}

subTitle(text: MarkFunctionType<string | number | number[] | string[]> | Nil) {
subTitle(text: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]> | Nil) {
return this.setFunctionSpec(text, 'subTitle');
}

Expand Down
4 changes: 2 additions & 2 deletions packages/vgrammar-core/src/semantic-marks/interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export class Interval extends Mark {
if (scales && scales.x && scales.x.type === ScaleEnum.Band) {
if (!isNil(scales.y)) {
const domain = scales.y.domain();
const min = minInArray(domain);
const max = maxInArray(domain);
const min = minInArray<number>(domain);
const max = maxInArray<number>(domain);
const baseValue = min > 0 ? min : max < 0 ? max : 0;

userEncodeRes.y1 = scales.y.scale(baseValue);
Expand Down
10 changes: 5 additions & 5 deletions packages/vgrammar-core/src/types/component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IGraphicAttribute, ITextAttribute } from '@visactor/vrender-core';
import type { IGraphicAttribute, IRichTextCharacter, ITextAttribute } from '@visactor/vrender-core';
import type {
AxisBaseAttributes,
BaseLabelAttrs,
Expand Down Expand Up @@ -201,14 +201,14 @@ export interface PlayerSpec extends ComponentSpec<Partial<PlayerAttributes>> {
// title component

export interface ITitle extends IComponent {
title: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;
subTitle: (text: MarkFunctionType<string | number | number[] | string[]> | Nil) => this;
title: (text: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]> | Nil) => this;
subTitle: (text: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]> | Nil) => this;
}

export interface TitleSpec extends ComponentSpec<Partial<TitleAttrs>> {
componentType: ComponentEnum.title;
title?: MarkFunctionType<string | number | number[] | string[]>;
subTitle?: MarkFunctionType<string | number | number[] | string[]>;
title?: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]>;
subTitle?: MarkFunctionType<string | number | number[] | string[] | IRichTextCharacter[]>;
}

// scrollbar component
Expand Down
6 changes: 3 additions & 3 deletions packages/vgrammar-plot/src/area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
import { SemanticMark } from './semantic-mark';
// eslint-disable-next-line no-duplicate-imports
import { GrammarMarkType } from '@visactor/vgrammar-core';
import { isArray } from '@visactor/vutils';
import { isArray, maxInArray, minInArray } from '@visactor/vutils';
import { PlotMakType } from './enums';

export class Area extends SemanticMark<PlotAreaEncoderSpec, AreaEncodeChannels> {
Expand Down Expand Up @@ -96,8 +96,8 @@ export class Area extends SemanticMark<PlotAreaEncoderSpec, AreaEncodeChannels>
y1: (datum: any, el: IElement, params: any) => {
const scale = params[scaleYId];
const domain = scale.domain();
const min = minInArray(domain);
const max = maxInArray(domain);
const min = minInArray<number>(domain);
const max = maxInArray<number>(domain);
const baseValue = min > 0 ? min : max < 0 ? max : 0;

return scale.scale(baseValue);
Expand Down
4 changes: 2 additions & 2 deletions packages/vgrammar-plot/src/interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ export class Interval extends SemanticMark<PlotIntervalEncoderSpec, IntervalEnco
return scale.scale(yVals[1]);
}
const domain = scale.domain();
const min = minInArray(domain);
const max = maxInArray(domain);
const min = minInArray<number>(domain);
const max = maxInArray<number>(domain);
const baseValue = min > 0 ? min : max < 0 ? max : 0;

return scale.scale(baseValue);
Expand Down
6 changes: 3 additions & 3 deletions packages/vgrammar-plot/src/rect-x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ export class RectXSemanticMark extends SemanticMark<PlotRectXEncoderSpec, RectXE
}

if (isContinuous(scale.type)) {
const domain = scale.domain();
const min = minInArray(domain);
const max = maxInArray(domain);
const domain = scale.domain() ?? [];
const min = minInArray<number>(domain);
const max = maxInArray<number>(domain);
const baseValue = min > 0 ? min : max < 0 ? max : 0;

return scale.scale(baseValue);
Expand Down
4 changes: 2 additions & 2 deletions packages/vgrammar-plot/src/rect-y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export class RectYSemanticMark extends SemanticMark<PlotRectYEncoderSpec, RectYE
}
if (isContinuous(scale.type)) {
const domain = scale.domain();
const min = minInArray(null, domain);
const max = maxInArray(null, domain);
const min = minInArray<number>(domain);
const max = maxInArray<number>(domain);
const baseValue = min > 0 ? min : max < 0 ? max : 0;

return scale.scale(baseValue);
Expand Down
10 changes: 5 additions & 5 deletions packages/vgrammar-plot/src/rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ export class RectSemanticMark extends SemanticMark<PlotRectEncoderSpec, RectEnco
}

if (isContinuous(scale.type)) {
const domain = scale.domain();
const min = minInArray(domain);
const max = maxInArray(domain);
const domain = scale.domain() ?? [];
const min = minInArray<number>(domain);
const max = maxInArray<number>(domain);
const baseValue = min > 0 ? min : max < 0 ? max : 0;

return scale.scale(baseValue);
Expand Down Expand Up @@ -118,8 +118,8 @@ export class RectSemanticMark extends SemanticMark<PlotRectEncoderSpec, RectEnco
}
if (isContinuous(scale.type)) {
const domain = scale.domain();
const min = minInArray(null, domain);
const max = maxInArray(null, domain);
const min = minInArray<number>(domain);
const max = maxInArray<number>(domain);
const baseValue = min > 0 ? min : max < 0 ? max : 0;

return scale.scale(baseValue);
Expand Down
2 changes: 1 addition & 1 deletion share/eslint-config/profile/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module.exports = function buildConfig(type) {

settings: settings,
rules: {
"spellcheck/spell-checker": ['error',
"spellcheck/spell-checker": ['warn',
{
"comments": true,
"strings": true,
Expand Down

0 comments on commit 0f0a0d0

Please sign in to comment.