Skip to content

Commit

Permalink
fix: type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
lijinke666 committed Jul 29, 2021
1 parent 37e67f8 commit 6d3e7af
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/s2-core/src/common/interface/basic.ts
Expand Up @@ -349,7 +349,7 @@ export interface SpreadSheetFacetCfg {
// use in col header
collapsedCols: Record<string, boolean>;
// hierarchy' type
hierarchyType: 'grid' | 'tree';
hierarchyType: S2Options['hierarchyType'];
// check if hierarchy is collapse
hierarchyCollapse: boolean;
// field's meta info
Expand Down
2 changes: 1 addition & 1 deletion packages/s2-core/src/facet/base-facet.ts
Expand Up @@ -755,7 +755,7 @@ export abstract class BaseFacet {
}

if (this.shouldPreventWheelEvent(optimizedDeltaX, optimizedDeltaY)) {
event.preventDefault();
event?.preventDefault?.();
}

cancelAnimationFrame(this.scrollFrameId);
Expand Down
25 changes: 10 additions & 15 deletions packages/s2-core/src/facet/header/corner.ts
Expand Up @@ -17,14 +17,18 @@ import {
CornerCell,
KEY_TREE_ROWS_COLLAPSE_ALL,
} from '../../index';
import { LayoutResult, SpreadSheetFacetCfg } from '../../common/interface';
import {
LayoutResult,
S2Options,
SpreadSheetFacetCfg,
} from '../../common/interface';
import { BaseHeader, BaseHeaderConfig, HIT_AREA } from './base';
import { CornerData, ResizeInfo } from './interface';
import { translateGroup } from '../utils';

export interface CornerHeaderConfig extends BaseHeaderConfig {
// header's hierarchy type
hierarchyType: 'grid' | 'tree';
hierarchyType: S2Options['hierarchyType'];
// the hierarchy collapse or not
hierarchyCollapse: boolean;
// column fields
Expand Down Expand Up @@ -305,12 +309,8 @@ export class CornerHeader extends BaseHeader<CornerHeaderConfig> {
this.headerConfig.spreadsheet.isPivotMode()
) {
// 只有交叉表才有icon
const {
hierarchyCollapse,
position,
height,
spreadsheet,
} = this.headerConfig;
const { hierarchyCollapse, position, height, spreadsheet } =
this.headerConfig;
const colHeight = spreadsheet.options.style.colCfg.height;
const icon = new GuiIcon({
type: hierarchyCollapse ? 'plus' : 'MinusSquare',
Expand All @@ -337,13 +337,8 @@ export class CornerHeader extends BaseHeader<CornerHeaderConfig> {
}

private handleHotsSpotArea() {
const {
data,
position,
width,
height,
seriesNumberWidth,
} = this.headerConfig;
const { data, position, width, height, seriesNumberWidth } =
this.headerConfig;
const prevResizer = this.headerConfig.spreadsheet.foregroundGroup.findById(
KEY_GROUP_CORNER_RESIZER,
);
Expand Down
12 changes: 4 additions & 8 deletions packages/s2-core/src/facet/header/row.ts
Expand Up @@ -6,10 +6,11 @@ import { DetailRowCell } from '../../cell/detail-row-cell';
import { Node } from '@/facet/layout/node';
import { BaseHeader, BaseHeaderConfig } from './base';
import { translateGroup } from '../utils';
import { S2Options } from '../../common/interface';

export interface RowHeaderConfig extends BaseHeaderConfig {
// type of hierarchy
hierarchyType: 'tree' | 'grid';
hierarchyType: S2Options['hierarchyType'];
// field ids that click to navigate
linkFieldIds: string[];
// series number group's width, will be 0 when not exists
Expand Down Expand Up @@ -96,13 +97,8 @@ export class RowHeader extends BaseHeader<RowHeaderConfig> {
}

protected clip(): void {
const {
width,
height,
scrollX,
scrollY,
seriesNumberWidth,
} = this.headerConfig;
const { width, height, scrollX, scrollY, seriesNumberWidth } =
this.headerConfig;
this.setClip({
type: 'rect',
attrs: {
Expand Down
3 changes: 2 additions & 1 deletion packages/s2-core/src/sheet-type/index.ts
Expand Up @@ -27,6 +27,7 @@ import {
Total,
ShowProps,
SpreadsheetMountContainer,
ThemeType,
} from 'src/common/interface';
import { DataCell, BaseCell, RowCell, ColCell, CornerCell } from '../cell';
import {
Expand Down Expand Up @@ -235,7 +236,7 @@ export class SpreadSheet extends EE {
* @param type string
* @param theme
*/
public setTheme(theme: SpreadSheetTheme, type = 'default'): void {
public setTheme(theme: SpreadSheetTheme, type: ThemeType = 'default'): void {
if (!getTheme(type)) {
if (theme) {
this.theme = registerTheme(type, theme);
Expand Down

0 comments on commit 6d3e7af

Please sign in to comment.