Skip to content

Commit

Permalink
refactor: change workbook snapshot fields and names (#483)
Browse files Browse the repository at this point in the history
* refactor: rename some interfaces to make the semantic correct

* chore: remove empty files

* fix: remove deprecated properties
  • Loading branch information
wzhudev committed Nov 18, 2023
1 parent ea70bdc commit 909efe3
Show file tree
Hide file tree
Showing 49 changed files with 128 additions and 309 deletions.
6 changes: 3 additions & 3 deletions packages/base-render/src/components/sheets/sheet-skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
IStyleData,
ITextRotation,
ITextStyle,
IWorksheetConfig,
IWorksheetData,
LocaleService,
Nullable,
ObjectArrayType,
Expand Down Expand Up @@ -216,7 +216,7 @@ export class SpreadsheetSkeleton extends Skeleton {

constructor(
private _worksheet: Worksheet | undefined,
private _config: IWorksheetConfig,
private _config: IWorksheetData,
private _cellData: ObjectMatrix<ICellData>,
private _styles: Styles,
_localeService: LocaleService
Expand Down Expand Up @@ -297,7 +297,7 @@ export class SpreadsheetSkeleton extends Skeleton {
*/
static create(
worksheet: Worksheet | undefined,
config: IWorksheetConfig,
config: IWorksheetData,
cellData: ObjectMatrix<ICellData>,
styles: Styles,
LocaleService: LocaleService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
IColumnData,
IRange,
IRowData,
IWorksheetConfig,
IWorksheetData,
ObjectArray,
ObjectMatrixPrimitiveType,
} from '@univerjs/core';
Expand All @@ -18,7 +18,7 @@ export interface IRemoveSheetMutationParams {
/** Params of `InsertSheetMutation` */
export interface IInsertSheetMutationParams {
index: number;
sheet: IWorksheetConfig;
sheet: IWorksheetData;
workbookId: string;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ILogService,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
Plugin,
PluginType,
Expand All @@ -12,7 +12,7 @@ import { Dependency, Inject, Injector } from '@wendellhu/redi';
import { BorderStyleManagerService } from '../../../services/border-style-manager.service';
import { SelectionManagerService } from '../../../services/selection-manager.service';

const TEST_WORKBOOK_DATA_DEMO: IWorkbookConfig = {
const TEST_WORKBOOK_DATA_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand All @@ -30,18 +30,13 @@ const TEST_WORKBOOK_DATA_DEMO: IWorkbookConfig = {
},
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

export function createCommandTestBed(workbookConfig?: IWorkbookConfig, dependencies?: Dependency[]) {
export function createCommandTestBed(workbookConfig?: IWorkbookData, dependencies?: Dependency[]) {
const univer = new Univer();

let get: Injector['get'] | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
IRange,
IStyleData,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
Nullable,
RANGE_TYPE,
Expand Down Expand Up @@ -77,7 +77,7 @@ const mergeData = [
endColumn: 3,
},
];
const WORKBOOK_DATA_DEMO: IWorkbookConfig = {
const WORKBOOK_DATA_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand Down Expand Up @@ -134,15 +134,10 @@ const WORKBOOK_DATA_DEMO: IWorkbookConfig = {
mergeData,
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

describe('Test delete range commands', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
IRange,
IStyleData,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
Nullable,
RANGE_TYPE,
Expand Down Expand Up @@ -79,7 +79,7 @@ const mergeData = [
endColumn: 3,
},
];
const WORKBOOK_DATA_DEMO: IWorkbookConfig = {
const WORKBOOK_DATA_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand Down Expand Up @@ -136,15 +136,10 @@ const WORKBOOK_DATA_DEMO: IWorkbookConfig = {
mergeData,
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

describe('Test insert range commands', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
IRange,
IStyleData,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
Nullable,
RANGE_TYPE,
Expand Down Expand Up @@ -313,7 +313,7 @@ describe('Test insert and remove rows cols commands', () => {
});
});

const TEST_ROW_COL_INSERTION_DEMO: IWorkbookConfig = {
const TEST_ROW_COL_INSERTION_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand Down Expand Up @@ -372,15 +372,10 @@ const TEST_ROW_COL_INSERTION_DEMO: IWorkbookConfig = {
columnCount: 20,
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

function createInsertRowColTestBed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ICommandService,
IRange,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
Nullable,
Rectangle,
Expand Down Expand Up @@ -138,7 +138,7 @@ describe('Test move range commands', () => {
}
});

const TEST_ROW_COL_INSERTION_DEMO: IWorkbookConfig = {
const TEST_ROW_COL_INSERTION_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand Down Expand Up @@ -185,15 +185,10 @@ const TEST_ROW_COL_INSERTION_DEMO: IWorkbookConfig = {
columnCount: 20,
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

function createInsertRowColTestBed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ICommandService,
IRange,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
Nullable,
RANGE_TYPE,
Expand Down Expand Up @@ -322,7 +322,7 @@ describe('Test move rows cols', () => {
});
});

const TEST_ROWS_COLS_MOVE_DEMO: IWorkbookConfig = {
const TEST_ROWS_COLS_MOVE_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand Down Expand Up @@ -377,15 +377,10 @@ const TEST_ROWS_COLS_MOVE_DEMO: IWorkbookConfig = {
columnCount: 20,
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

function createMoveRowsColsTestBed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import {
ICommandService,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
RedoCommand,
UndoCommand,
Expand All @@ -15,7 +15,7 @@ import { SetFrozenMutation } from '../../mutations/set-frozen.mutation';
import { SetFrozenCommand } from '../set-frozen.command';
import { createCommandTestBed } from './create-command-test-bed';

const WORKBOOK_DATA_DEMO: IWorkbookConfig = {
const WORKBOOK_DATA_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand Down Expand Up @@ -72,15 +72,10 @@ const WORKBOOK_DATA_DEMO: IWorkbookConfig = {
mergeData: [],
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

describe('Test set frozen commands', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ICommandService,
IUndoRedoService,
IUniverInstanceService,
IWorksheetConfig,
IWorksheetData,
Tools,
} from '@univerjs/core';
import { IAccessor } from '@wendellhu/redi';
Expand All @@ -22,7 +22,7 @@ import {
export interface InsertSheetCommandParams {
workbookId?: string;
index?: number;
sheet?: IWorksheetConfig;
sheet?: IWorksheetData;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { CommandType, IMutation, IUniverInstanceService, IWorksheetConfig, Tools } from '@univerjs/core';
import { CommandType, IMutation, IUniverInstanceService, IWorksheetData, Tools } from '@univerjs/core';
import { IAccessor } from '@wendellhu/redi';

/** @deprecated */
export interface ISetWorksheetConfigMutationParams {
workbookId: string;
worksheetId: string;
config: IWorksheetConfig;
config: IWorksheetData;
}

/** @deprecated */
Expand Down
11 changes: 3 additions & 8 deletions packages/base-sheets/src/controllers/__tests__/util.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
ILogService,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
Plugin,
PluginType,
Univer,
} from '@univerjs/core';
import { Dependency, Inject, Injector } from '@wendellhu/redi';

const TEST_WORKBOOK_DATA_DEMO: IWorkbookConfig = {
const TEST_WORKBOOK_DATA_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand All @@ -27,18 +27,13 @@ const TEST_WORKBOOK_DATA_DEMO: IWorkbookConfig = {
},
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

export function createTestBase(workbookConfig?: IWorkbookConfig, dependencies?: Dependency[]) {
export function createTestBase(workbookConfig?: IWorkbookData, dependencies?: Dependency[]) {
const univer = new Univer();

let get: Injector['get'] | undefined;
Expand Down
11 changes: 3 additions & 8 deletions packages/base-sheets/src/services/__tests__/util.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
ILogService,
IUniverInstanceService,
IWorkbookConfig,
IWorkbookData,
LocaleType,
Plugin,
PluginType,
Univer,
} from '@univerjs/core';
import { Dependency, Inject, Injector } from '@wendellhu/redi';

export const TEST_WORKBOOK_DATA_DEMO: IWorkbookConfig = {
export const TEST_WORKBOOK_DATA_DEMO: IWorkbookData = {
id: 'test',
appVersion: '3.0.0-alpha',
sheets: {
Expand All @@ -27,18 +27,13 @@ export const TEST_WORKBOOK_DATA_DEMO: IWorkbookConfig = {
},
},
},
createdTime: '',
creator: '',
lastModifiedBy: '',
locale: LocaleType.EN_US,
modifiedTime: '',
name: '',
sheetOrder: [],
styles: {},
timeZone: '',
};

export function createTestBase(workbookConfig?: IWorkbookConfig, dependencies?: Dependency[]) {
export function createTestBase(workbookConfig?: IWorkbookData, dependencies?: Dependency[]) {
const univer = new Univer();

let get: Injector['get'] | undefined;
Expand Down
Loading

0 comments on commit 909efe3

Please sign in to comment.