@univerjs/core v0.4.2 • Docs
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
Parameter | Type |
---|---|
matrix | IObjectMatrixPrimitiveType <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
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
Parameter | Type |
---|---|
row | number |
column | number |
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
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
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
Parameter | Type |
---|---|
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
Defined in
submodules/univer/packages/core/src/shared/object-matrix.ts:562 (opens in a new tab)
getData()
getData(): IObjectMatrixPrimitiveType<T>
Beta
Returns
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
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
Parameter | Type |
---|---|
startRow | number |
endRow | number |
startColumn | number |
endColumn | number |
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
Defined in
submodules/univer/packages/core/src/shared/object-matrix.ts:234 (opens in a new tab)
getRange()
getRange(): IRange
Beta
Returns
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
Parameter | Type |
---|---|
rowIndex | number |
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
Parameter | Type |
---|---|
rowIndex | number |
Returns
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
Parameter | Type |
---|---|
startRow | number |
endRow | number |
startColumn | number |
endColumn | number |
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
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
Parameter | Type |
---|---|
row | number |
column | number |
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
Parameter | Type |
---|---|
start | number |
count | number |
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
Parameter | Type |
---|---|
start | number |
count | number |
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
Parameter | Type |
---|---|
newObject | ObjectMatrix <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
Parameter | Type |
---|---|
start | number |
count | number |
target | number |
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
Parameter | Type |
---|---|
start | number |
count | number |
target | number |
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
Parameter | Type |
---|---|
row | number |
column | number |
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
Parameter | Type |
---|---|
start | number |
count | number |
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
Parameter | Type |
---|---|
start | number |
count | number |
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
Parameter | Type |
---|---|
rowNumber | number |
row | IObjectArrayPrimitiveType <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
Parameter | Type |
---|---|
row | number |
column | number |
value | T |
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
Parameter | Type |
---|---|
src | number |
target | number |
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
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
Parameter | Type |
---|---|
size | number |
Returns
ObjectMatrix
<T
>
Defined in
submodules/univer/packages/core/src/shared/object-matrix.ts:228 (opens in a new tab)