API Reference
@univerjs
@univerjs/core
classes
Objectmatrix

@univerjs/core v0.4.2Docs


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

submodules/univer/packages/core/src/shared/object-matrix.ts:224 (opens in a new tab)

Methods

clone()

clone(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:549 (opens in a new tab)


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

submodules/univer/packages/core/src/shared/object-matrix.ts:359 (opens in a new tab)


forEach()

forEach(callback): ObjectMatrix<T>

Beta

Parameters

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

Returns

ObjectMatrix<T>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:238 (opens in a new tab)


forRow()

forRow(callback): ObjectMatrix<T>

Beta

Parameters

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

Returns

ObjectMatrix<T>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:253 (opens in a new tab)


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

submodules/univer/packages/core/src/shared/object-matrix.ts:275 (opens in a new tab)


getArrayData()

getArrayData(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:562 (opens in a new tab)


getData()

getData(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Deprecated

Use clone as a substitute.

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:557 (opens in a new tab)


getDataRange()

getDataRange(): IRange

Beta

Returns

IRange

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:618 (opens in a new tab)


getDiscreteRanges()

getDiscreteRanges(): IRange[]

Beta

Returns

IRange[]

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:666 (opens in a new tab)


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

submodules/univer/packages/core/src/shared/object-matrix.ts:432 (opens in a new tab)


getLength()

getLength(): number

Beta

Returns

number

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:478 (opens in a new tab)


getMatrix()

getMatrix(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:234 (opens in a new tab)


getRange()

getRange(): IRange

Beta

Returns

IRange

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:482 (opens in a new tab)


getRow()

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

Beta

Parameters

ParameterType
rowIndexnumber

Returns

Nullable<IObjectArrayPrimitiveType<T>>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:309 (opens in a new tab)


getRowOrCreate()

getRowOrCreate(rowIndex): IObjectArrayPrimitiveType<T>

Beta

Parameters

ParameterType
rowIndexnumber

Returns

IObjectArrayPrimitiveType<T>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:313 (opens in a new tab)


getSizeOf()

getSizeOf(): number

Beta

Returns

number

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:473 (opens in a new tab)


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

submodules/univer/packages/core/src/shared/object-matrix.ts:460 (opens in a new tab)


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

submodules/univer/packages/core/src/shared/object-matrix.ts:595 (opens in a new tab)


getValue()

getValue(row, column): Nullable<T>

Beta

Parameters

ParameterType
rownumber
columnnumber

Returns

Nullable<T>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:345 (opens in a new tab)


hasValue()

hasValue(): boolean

Beta

Returns

boolean

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:327 (opens in a new tab)


insertColumns()

insertColumns(start, count): void

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:400 (opens in a new tab)


insertRows()

insertRows(start, count): void

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:393 (opens in a new tab)


merge()

merge(newObject): void

Beta

Parameters

ParameterType
newObjectObjectMatrix<T>

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:706 (opens in a new tab)


moveColumns()

moveColumns(
   start, 
   count, 
   target): void

Beta

Parameters

ParameterType
startnumber
countnumber
targetnumber

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:386 (opens in a new tab)


moveRows()

moveRows(
   start, 
   count, 
   target): void

Beta

Parameters

ParameterType
startnumber
countnumber
targetnumber

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:382 (opens in a new tab)


realDeleteValue()

realDeleteValue(row, column): void

Beta

Parameters

ParameterType
rownumber
columnnumber

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:363 (opens in a new tab)


removeColumns()

removeColumns(start, count): void

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:414 (opens in a new tab)


removeRows()

removeRows(start, count): void

Beta

Parameters

ParameterType
startnumber
countnumber

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:410 (opens in a new tab)


reset()

reset(): void

Beta

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:323 (opens in a new tab)


setRow()

setRow(rowNumber, row): void

Beta

Parameters

ParameterType
rowNumbernumber
rowIObjectArrayPrimitiveType<T>

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:378 (opens in a new tab)


setValue()

setValue(
   row, 
   column, 
   value): void

Beta

Parameters

ParameterType
rownumber
columnnumber
valueT

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:349 (opens in a new tab)


swapRow()

swapRow(src, target): void

Beta

Parameters

ParameterType
srcnumber
targetnumber

Returns

void

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:300 (opens in a new tab)


toArray()

toArray(): T[][]

Beta

Returns

T[][]

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:512 (opens in a new tab)


toFullArray()

toFullArray(): T[][]

Beta

Returns

T[][]

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:526 (opens in a new tab)


toJSON()

toJSON(): IObjectMatrixPrimitiveType<T>

Beta

Returns

IObjectMatrixPrimitiveType<T>

Deprecated

Use getMatrix as a substitute.

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:545 (opens in a new tab)


toNativeArray()

toNativeArray(): T[]

Beta

Returns

T[]

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:504 (opens in a new tab)


MakeObjectMatrixSize()

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

Beta

Type Parameters

Type Parameter
T

Parameters

ParameterType
sizenumber

Returns

ObjectMatrix<T>

Defined in

submodules/univer/packages/core/src/shared/object-matrix.ts:228 (opens in a new tab)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.