@univerjscoreclassesObjectmatrix

@univerjs/core v0.5.4


Class: ObjectMatrix<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:221

Beta

A two-dimensional array represented by a two-level deep object and provides an array-like API

Type Parameters

Type Parameter
T

Constructors

new ObjectMatrix()

new ObjectMatrix<T>(matrix): ObjectMatrix<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:224

Beta

Parameters

ParameterType
matrixIObjectMatrixPrimitiveType<T>

Returns

ObjectMatrix<T>

Methods

clone()

clone(): IObjectMatrixPrimitiveType<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:547

Beta

Returns

IObjectMatrixPrimitiveType<T>


deleteValue()

deleteValue(row, column): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:357

Beta

!! Please +1 ‘!’, who fell into this pit.

Parameters

ParameterType
rownumber
columnnumber

Returns

void

Deprecated

use realDelete or splice


forEach()

forEach(callback): ObjectMatrix<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:238

Beta

Parameters

ParameterType
callback(row, objectArray) => Nullable<boolean>

Returns

ObjectMatrix<T>


forRow()

forRow(callback): ObjectMatrix<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:253

Beta

Parameters

ParameterType
callback(row, cols) => Nullable<boolean>

Returns

ObjectMatrix<T>


forValue()

forValue(callback): ObjectMatrix<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:275

Beta

Iterate the object matrix with row priority, which means it scan the whole range row by row.

Parameters

ParameterType
callback(row, col, value) => Nullable<boolean>

Returns

ObjectMatrix<T>


getArrayData()

getArrayData(): IObjectMatrixPrimitiveType<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:560

Beta

Returns

IObjectMatrixPrimitiveType<T>


getData()

getData(): IObjectMatrixPrimitiveType<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:555

Beta

Returns

IObjectMatrixPrimitiveType<T>

Deprecated

Use clone as a substitute.


getDataRange()

getDataRange(): IRange

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:616

Beta

Returns

IRange


getDiscreteRanges()

getDiscreteRanges(): IRange[]

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:664

Beta

Returns

IRange[]


getFragment()

getFragment(
   startRow, 
   endRow, 
   startColumn, 
endColumn): ObjectMatrix<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:430

Beta

Return a fragment of the original data matrix. Note that the returned matrix’s row matrix would start from 0 not startRow. Neither does its column matrix. If you want to get the original matrix, use getSlice.

Parameters

ParameterType
startRownumber
endRownumber
startColumnnumber
endColumnnumber

Returns

ObjectMatrix<T>


getLength()

getLength(): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:476

Beta

Returns

number


getMatrix()

getMatrix(): IObjectMatrixPrimitiveType<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:234

Beta

Returns

IObjectMatrixPrimitiveType<T>


getRange()

getRange(): IRange

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:480

Beta

Returns

IRange


getRow()

getRow(rowIndex): Nullable<IObjectArrayPrimitiveType<T>>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:307

Beta

Parameters

ParameterType
rowIndexnumber

Returns

Nullable<IObjectArrayPrimitiveType<T>>


getRowOrCreate()

getRowOrCreate(rowIndex): IObjectArrayPrimitiveType<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:311

Beta

Parameters

ParameterType
rowIndexnumber

Returns

IObjectArrayPrimitiveType<T>


getSizeOf()

getSizeOf(): number

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:471

Beta

Returns

number


getSlice()

getSlice(
   startRow, 
   endRow, 
   startColumn, 
endColumn): ObjectMatrix<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:458

Beta

Return a slice of the original data matrix. Note that the returned matrix’s row matrix would start from startRow not 0, and the same does its column index. You may be looking for getFragment if you want both of the indexes start from 0.

Parameters

ParameterType
startRownumber
endRownumber
startColumnnumber
endColumnnumber

Returns

ObjectMatrix<T>


getStartEndScope()

getStartEndScope(): IRange

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:593

Beta

the function can only be used in all the row and column are positive integer

Returns

IRange

the start and end scope of the matrix

Description

the positive integer in V8 Object is stored in a fast memory space and it is sorted when we get the keys


getValue()

getValue(row, column): Nullable<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:343

Beta

Parameters

ParameterType
rownumber
columnnumber

Returns

Nullable<T>


hasValue()

hasValue(): boolean

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:325

Beta

Returns

boolean


insertColumns()

insertColumns(start, count): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:398

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void


insertRows()

insertRows(start, count): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:391

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void


merge()

merge(newObject): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:704

Beta

Parameters

ParameterType
newObjectObjectMatrix<T>

Returns

void


moveColumns()

moveColumns(
   start, 
   count, 
   target): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:384

Beta

Parameters

ParameterType
startnumber
countnumber
targetnumber

Returns

void


moveRows()

moveRows(
   start, 
   count, 
   target): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:380

Beta

Parameters

ParameterType
startnumber
countnumber
targetnumber

Returns

void


realDeleteValue()

realDeleteValue(row, column): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:361

Beta

Parameters

ParameterType
rownumber
columnnumber

Returns

void


removeColumns()

removeColumns(start, count): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:412

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void


removeRows()

removeRows(start, count): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:408

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void


reset()

reset(): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:321

Beta

Returns

void


setRow()

setRow(rowNumber, row): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:376

Beta

Parameters

ParameterType
rowNumbernumber
rowIObjectArrayPrimitiveType<T>

Returns

void


setValue()

setValue(
   row, 
   column, 
   value): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:347

Beta

Parameters

ParameterType
rownumber
columnnumber
valueT

Returns

void


swapRow()

swapRow(src, target): void

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:298

Beta

Parameters

ParameterType
srcnumber
targetnumber

Returns

void


toArray()

toArray(): T[][]

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:510

Beta

Returns

T[][]


toFullArray()

toFullArray(): T[][]

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:524

Beta

Returns

T[][]


toJSON()

toJSON(): IObjectMatrixPrimitiveType<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:543

Beta

Returns

IObjectMatrixPrimitiveType<T>

Deprecated

Use getMatrix as a substitute.


toNativeArray()

toNativeArray(): T[]

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:502

Beta

Returns

T[]


MakeObjectMatrixSize()

static MakeObjectMatrixSize<T>(size): ObjectMatrix<T>

Defined in: packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/object-matrix.ts:228

Beta

Type Parameters

Type Parameter
T

Parameters

ParameterType
sizenumber

Returns

ObjectMatrix<T>