@univerjs/engine-formula v0.2.11 • Docs
Class: CustomFunction
Extends
Constructors
new CustomFunction()
new CustomFunction(_name): CustomFunction
Parameters
Parameter | Type |
---|---|
_name | IFunctionNames |
Returns
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:66 (opens in a new tab)
Properties
Property | Modifier | Type | Default value | Description | Inherited from | Defined in |
---|---|---|---|---|---|---|
_disposed | protected | boolean | false | - | BaseFunction ._disposed | packages/core/src/shared/lifecycle.ts:93 (opens in a new tab) |
maxParams | public | number | -1 | Maximum number of parameters | BaseFunction .maxParams | packages/engine-formula/src/functions/base-function.ts:64 (opens in a new tab) |
minParams | public | number | -1 | Minimum number of parameters | BaseFunction .minParams | packages/engine-formula/src/functions/base-function.ts:59 (opens in a new tab) |
needsExpandParams | public | boolean | false | Whether the function needs to expand the parameters | BaseFunction .needsExpandParams | packages/engine-formula/src/functions/base-function.ts:49 (opens in a new tab) |
needsReferenceObject | public | boolean | false | Whether the function needs to pass in reference object | BaseFunction .needsReferenceObject | packages/engine-formula/src/functions/base-function.ts:54 (opens in a new tab) |
Accessors
column
get column(): number
Returns
number
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:86 (opens in a new tab)
name
get name(): IFunctionNames
Returns
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:70 (opens in a new tab)
row
get row(): number
Returns
number
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:82 (opens in a new tab)
subUnitId
get subUnitId(): Nullable<string>
Returns
Nullable
<string
>
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:78 (opens in a new tab)
unitId
get unitId(): Nullable<string>
Returns
Nullable
<string
>
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:74 (opens in a new tab)
Methods
binarySearch()
binarySearch(
value,
searchArray,
resultArray,
searchType?): BaseValueObject
Parameters
Parameter | Type |
---|---|
value | BaseValueObject |
searchArray | ArrayValueObject |
resultArray | ArrayValueObject |
searchType ? | ArrayBinarySearchType |
Returns
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:251 (opens in a new tab)
binarySearchExpand()
binarySearchExpand(
value,
searchArray,
resultArray,
axis,
searchType?): undefined | ErrorValueObject | ArrayValueObject
Parameters
Parameter | Type | Default value |
---|---|---|
value | BaseValueObject | undefined |
searchArray | ArrayValueObject | undefined |
resultArray | ArrayValueObject | undefined |
axis | number | 0 |
searchType ? | ArrayBinarySearchType | undefined |
Returns
undefined
| ErrorValueObject
| ArrayValueObject
Inherited from
BaseFunction
.binarySearchExpand
Defined in
packages/engine-formula/src/functions/base-function.ts:336 (opens in a new tab)
calculate()
calculate(...arg): NodeValueType
Parameters
Parameter | Type |
---|---|
...arg | BaseValueObject [] |
Returns
NodeValueType
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:135 (opens in a new tab)
calculateCustom()
calculateCustom(...arg): PrimitiveValueType | PrimitiveValueType[][]
Parameters
Parameter | Type |
---|---|
...arg | (PrimitiveValueType | PrimitiveValueType [][])[] |
Returns
PrimitiveValueType
| PrimitiveValueType
[][]
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:129 (opens in a new tab)
checkArrayType()
checkArrayType(variant): boolean
Parameters
Parameter | Type |
---|---|
variant | FunctionVariantType |
Returns
boolean
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:139 (opens in a new tab)
createReferenceObject()
createReferenceObject(reference, range): ErrorValueObject | BaseReferenceObject
Parameters
Parameter | Type |
---|---|
reference | BaseReferenceObject |
range | IRange |
Returns
ErrorValueObject
| BaseReferenceObject
Inherited from
BaseFunction
.createReferenceObject
Defined in
packages/engine-formula/src/functions/base-function.ts:494 (opens in a new tab)
dispose()
dispose(): void
Returns
void
Inherited from
Defined in
packages/core/src/shared/lifecycle.ts:106 (opens in a new tab)
disposeWithMe()
protected disposeWithMe(disposable): IDisposable
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
Defined in
packages/core/src/shared/lifecycle.ts:96 (opens in a new tab)
ensureNotDisposed()
protected ensureNotDisposed(): void
Returns
void
Inherited from
BaseFunction
.ensureNotDisposed
Defined in
packages/core/src/shared/lifecycle.ts:100 (opens in a new tab)
equalSearch()
equalSearch(
value,
searchArray,
resultArray,
isFirst): BaseValueObject
Parameters
Parameter | Type | Default value |
---|---|---|
value | BaseValueObject | undefined |
searchArray | ArrayValueObject | undefined |
resultArray | ArrayValueObject | undefined |
isFirst | boolean | true |
Returns
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:294 (opens in a new tab)
equalSearchExpand()
equalSearchExpand(
value,
searchArray,
resultArray,
isFirst,
axis): undefined | ErrorValueObject | ArrayValueObject
Parameters
Parameter | Type | Default value |
---|---|---|
value | BaseValueObject | undefined |
searchArray | ArrayValueObject | undefined |
resultArray | ArrayValueObject | undefined |
isFirst | boolean | true |
axis | number | 0 |
Returns
undefined
| ErrorValueObject
| ArrayValueObject
Inherited from
BaseFunction
.equalSearchExpand
Defined in
packages/engine-formula/src/functions/base-function.ts:355 (opens in a new tab)
flattenArray()
flattenArray(variants, ignoreLogicalValuesAndText): BaseValueObject | ArrayValueObject
Parameters
Parameter | Type | Default value |
---|---|---|
variants | BaseValueObject [] | undefined |
ignoreLogicalValuesAndText | boolean | true |
Returns
BaseValueObject
| ArrayValueObject
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:429 (opens in a new tab)
fuzzySearch()
fuzzySearch(
value,
searchArray,
resultArray,
isFirst): BaseValueObject
Parameters
Parameter | Type | Default value |
---|---|---|
value | BaseValueObject | undefined |
searchArray | ArrayValueObject | undefined |
resultArray | ArrayValueObject | undefined |
isFirst | boolean | true |
Returns
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:304 (opens in a new tab)
fuzzySearchExpand()
fuzzySearchExpand(
value,
searchArray,
resultArray,
isFirst,
axis): undefined | ErrorValueObject | ArrayValueObject
Parameters
Parameter | Type | Default value |
---|---|---|
value | BaseValueObject | undefined |
searchArray | ArrayValueObject | undefined |
resultArray | ArrayValueObject | undefined |
isFirst | boolean | true |
axis | number | 0 |
Returns
undefined
| ErrorValueObject
| ArrayValueObject
Inherited from
BaseFunction
.fuzzySearchExpand
Defined in
packages/engine-formula/src/functions/base-function.ts:382 (opens in a new tab)
getDefinedName()
getDefinedName(name): null | IDefinedNamesServiceParam
In Excel, to inject a defined name into a function that has positioning capabilities, such as using the INDIRECT function to reference a named range, you can write it as follows: =INDIRECT("DefinedName1")
Parameters
Parameter | Type |
---|---|
name | string |
Returns
null
| IDefinedNamesServiceParam
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:96 (opens in a new tab)
getIndexNumValue()
getIndexNumValue(indexNum, defaultValue): number | ErrorValueObject
Starting with 1 For instance, The column number (starting with 1 for the left-most column of table_array) that contains the return value. https://support.microsoft.com/en-us/office/vlookup-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1 (opens in a new tab)
Parameters
Parameter | Type | Default value |
---|---|---|
indexNum | BaseValueObject | undefined |
defaultValue | number | 1 |
Returns
number
| ErrorValueObject
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:149 (opens in a new tab)
getMatchTypeValue()
getMatchTypeValue(logicValueObject?): undefined | number
A logical value that specifies 1/TRUE , 0/FALSE, -1, default 1. The difference from getZeroOrOneByOneDefault is that we need to get -1
Parameters
Parameter | Type |
---|---|
logicValueObject ? | BaseValueObject |
Returns
undefined
| number
Inherited from
BaseFunction
.getMatchTypeValue
Defined in
packages/engine-formula/src/functions/base-function.ts:223 (opens in a new tab)
getZeroOrOneByOneDefault()
getZeroOrOneByOneDefault(logicValueObject?): undefined | number
A logical value that specifies 1/TRUE , 0/FALSE, default 1 For instance range_lookup, A logical value that specifies whether you want VLOOKUP to find an approximate or an exact match Approximate match - 1/TRUE Exact match - 0/FALSE https://support.microsoft.com/en-us/office/vlookup-function-0bbc8083-26fe-4963-8ab8-93a18ad188a1 (opens in a new tab) For instance A1, A logical value that specifies what type of reference is contained in the cell ref_text. If a1 is TRUE or omitted, ref_text is interpreted as an A1-style reference. If a1 is FALSE, ref_text is interpreted as an R1C1-style reference. https://support.microsoft.com/zh-cn/office/indirect-%E5%87%BD%E6%95%B0-474b3a3a-8a26-4f44-b491-92b6306fa261 (opens in a new tab)
Parameters
Parameter | Type |
---|---|
logicValueObject ? | BaseValueObject |
Returns
undefined
| number
Inherited from
BaseFunction
.getZeroOrOneByOneDefault
Defined in
packages/engine-formula/src/functions/base-function.ts:190 (opens in a new tab)
isAddress()
isAddress(): boolean
Returns
boolean
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:114 (opens in a new tab)
isAsync()
isAsync(): boolean
Returns
boolean
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:110 (opens in a new tab)
isCustom()
isCustom(): boolean
Returns
boolean
Overrides
Defined in
packages/engine-formula/src/functions/custom-function.ts:20 (opens in a new tab)
orderSearch()
orderSearch(
value,
searchArray,
resultArray,
searchType,
isDesc): BaseValueObject
Parameters
Parameter | Type | Default value |
---|---|---|
value | BaseValueObject | undefined |
searchArray | ArrayValueObject | undefined |
resultArray | ArrayValueObject | undefined |
searchType | ArrayOrderSearchType | ArrayOrderSearchType.MIN |
isDesc | boolean | false |
Returns
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:314 (opens in a new tab)
orderSearchExpand()
orderSearchExpand(
value,
searchArray,
resultArray,
searchType,
isDesc,
axis): undefined | ErrorValueObject | ArrayValueObject
Parameters
Parameter | Type | Default value |
---|---|---|
value | BaseValueObject | undefined |
searchArray | ArrayValueObject | undefined |
resultArray | ArrayValueObject | undefined |
searchType | ArrayOrderSearchType | ArrayOrderSearchType.MIN |
isDesc | boolean | false |
axis | number | 0 |
Returns
undefined
| ErrorValueObject
| ArrayValueObject
Inherited from
BaseFunction
.orderSearchExpand
Defined in
packages/engine-formula/src/functions/base-function.ts:409 (opens in a new tab)
setDefinedNames()
setDefinedNames(definedNames): void
Parameters
Parameter | Type |
---|---|
definedNames | IDefinedNameMapItem |
Returns
void
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:106 (opens in a new tab)
setRefInfo()
setRefInfo(
unitId,
subUnitId,
row,
column): void
Parameters
Parameter | Type |
---|---|
unitId | string |
subUnitId | string |
row | number |
column | number |
Returns
void
Inherited from
Defined in
packages/engine-formula/src/functions/base-function.ts:122 (opens in a new tab)