@univerjscoreclassesObjectmatrix

@univerjs/core v0.5.0-beta.1Docs


Class: ObjectMatrix<T>

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>

Beta

Parameters

ParameterType
matrixIObjectMatrixPrimitiveType<T>

Returns

ObjectMatrix<T>

Defined in

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

Methods

clone()

clone(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Defined in

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


deleteValue()

deleteValue(row, column): void

Beta

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

Parameters

ParameterType
rownumber
columnnumber

Returns

void

Deprecated

use realDelete or splice

Defined in

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


forEach()

forEach(callback): ObjectMatrix<T>

Beta

Parameters

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

Returns

ObjectMatrix<T>

Defined in

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


forRow()

forRow(callback): ObjectMatrix<T>

Beta

Parameters

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

Returns

ObjectMatrix<T>

Defined in

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


forValue()

forValue(callback): ObjectMatrix<T>

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>

Defined in

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


getArrayData()

getArrayData(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Defined in

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


getData()

getData(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Deprecated

Use clone as a substitute.

Defined in

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


getDataRange()

getDataRange(): IRange

Beta

Returns

IRange

Defined in

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


getDiscreteRanges()

getDiscreteRanges(): IRange[]

Beta

Returns

IRange[]

Defined in

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


getFragment()

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

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>

Defined in

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


getLength()

getLength(): number

Beta

Returns

number

Defined in

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


getMatrix()

getMatrix(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Defined in

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


getRange()

getRange(): IRange

Beta

Returns

IRange

Defined in

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


getRow()

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

Beta

Parameters

ParameterType
rowIndexnumber

Returns

Nullable<IObjectArrayPrimitiveType<T>>

Defined in

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


getRowOrCreate()

getRowOrCreate(rowIndex): IObjectArrayPrimitiveType<T>

Beta

Parameters

ParameterType
rowIndexnumber

Returns

IObjectArrayPrimitiveType<T>

Defined in

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


getSizeOf()

getSizeOf(): number

Beta

Returns

number

Defined in

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


getSlice()

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

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>

Defined in

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


getStartEndScope()

getStartEndScope(): IRange

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

Defined in

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


getValue()

getValue(row, column): Nullable<T>

Beta

Parameters

ParameterType
rownumber
columnnumber

Returns

Nullable<T>

Defined in

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


hasValue()

hasValue(): boolean

Beta

Returns

boolean

Defined in

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


insertColumns()

insertColumns(start, count): void

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void

Defined in

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


insertRows()

insertRows(start, count): void

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void

Defined in

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


merge()

merge(newObject): void

Beta

Parameters

ParameterType
newObjectObjectMatrix<T>

Returns

void

Defined in

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


moveColumns()

moveColumns(
   start, 
   count, 
   target): void

Beta

Parameters

ParameterType
startnumber
countnumber
targetnumber

Returns

void

Defined in

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


moveRows()

moveRows(
   start, 
   count, 
   target): void

Beta

Parameters

ParameterType
startnumber
countnumber
targetnumber

Returns

void

Defined in

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


realDeleteValue()

realDeleteValue(row, column): void

Beta

Parameters

ParameterType
rownumber
columnnumber

Returns

void

Defined in

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


removeColumns()

removeColumns(start, count): void

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void

Defined in

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


removeRows()

removeRows(start, count): void

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void

Defined in

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


reset()

reset(): void

Beta

Returns

void

Defined in

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


setRow()

setRow(rowNumber, row): void

Beta

Parameters

ParameterType
rowNumbernumber
rowIObjectArrayPrimitiveType<T>

Returns

void

Defined in

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


setValue()

setValue(
   row, 
   column, 
   value): void

Beta

Parameters

ParameterType
rownumber
columnnumber
valueT

Returns

void

Defined in

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


swapRow()

swapRow(src, target): void

Beta

Parameters

ParameterType
srcnumber
targetnumber

Returns

void

Defined in

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


toArray()

toArray(): T[][]

Beta

Returns

T[][]

Defined in

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


toFullArray()

toFullArray(): T[][]

Beta

Returns

T[][]

Defined in

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


toJSON()

toJSON(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Deprecated

Use getMatrix as a substitute.

Defined in

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


toNativeArray()

toNativeArray(): T[]

Beta

Returns

T[]

Defined in

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


MakeObjectMatrixSize()

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

Beta

Type Parameters

Type Parameter
T

Parameters

ParameterType
sizenumber

Returns

ObjectMatrix<T>

Defined in

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