API Reference
@univerjs
@univerjs/data-validation
classes
Basedatavalidator

@univerjs/data-validation v0.4.2Docs


Class: abstract BaseDataValidator<DataType>

Extended by

Type Parameters

Type ParameterDefault type
DataTypeCellValue

Constructors

new BaseDataValidator()

new BaseDataValidator<DataType>(localeService, injector): BaseDataValidator<DataType>

Parameters

ParameterType
localeServiceLocaleService
injectorInjector

Returns

BaseDataValidator<DataType>

Defined in

data-validation/src/validators/base-data-validator.ts:76 (opens in a new tab)

Properties

PropertyModifierTypeDefault valueDefined in
canvasRenderpublicNullable<IBaseDataValidationWidget>nulldata-validation/src/validators/base-data-validator.ts:70 (opens in a new tab)
dropdownpublicundefined | stringundefineddata-validation/src/validators/base-data-validator.ts:71 (opens in a new tab)
formulaInputpublicundefined | stringundefineddata-validation/src/validators/base-data-validator.ts:69 (opens in a new tab)
idabstractstringundefineddata-validation/src/validators/base-data-validator.ts:62 (opens in a new tab)
injectorreadonlyInjectorundefineddata-validation/src/validators/base-data-validator.ts:78 (opens in a new tab)
localeServicereadonlyLocaleServiceundefineddata-validation/src/validators/base-data-validator.ts:77 (opens in a new tab)
operatorsabstractDataValidationOperator[]undefineddata-validation/src/validators/base-data-validator.ts:64 (opens in a new tab)
optionsInputpublicundefined | stringundefineddata-validation/src/validators/base-data-validator.ts:72 (opens in a new tab)
scopesabstractstring | string[]undefineddata-validation/src/validators/base-data-validator.ts:65 (opens in a new tab)
skipDefaultFontRenderpublicundefined | (rule, cellValue, pos) => booleanundefineddata-validation/src/validators/base-data-validator.ts:91 (opens in a new tab)
titleabstractstringundefineddata-validation/src/validators/base-data-validator.ts:63 (opens in a new tab)

Accessors

operatorNames

get operatorNames(): string[]

Returns

string[]

Defined in

data-validation/src/validators/base-data-validator.ts:83 (opens in a new tab)


titleStr

get titleStr(): string

Returns

string

Defined in

data-validation/src/validators/base-data-validator.ts:87 (opens in a new tab)

Methods

generateRuleErrorMessage()

generateRuleErrorMessage(rule): string

Parameters

ParameterType
ruleIDataValidationRuleBase

Returns

string

Defined in

data-validation/src/validators/base-data-validator.ts:102 (opens in a new tab)


generateRuleName()

generateRuleName(rule): string

Parameters

ParameterType
ruleIDataValidationRuleBase

Returns

string

Defined in

data-validation/src/validators/base-data-validator.ts:93 (opens in a new tab)


getExtraStyle()

getExtraStyle(
   rule, 
   value, 
ctx): Nullable<IStyleData>

Parameters

ParameterType
ruleIDataValidationRuleBase
valueNullable<CellValue>
ctxobject
ctx.styleIStyleData

Returns

Nullable<IStyleData>

Defined in

data-validation/src/validators/base-data-validator.ts:111 (opens in a new tab)


getRuleFinalError()

getRuleFinalError(rule): string

Parameters

ParameterType
ruleIDataValidationRule

Returns

string

Defined in

data-validation/src/validators/base-data-validator.ts:113 (opens in a new tab)


isEmptyCellValue()

isEmptyCellValue(cellValue): cellValue is undefined | null | void

Parameters

ParameterType
cellValueNullable<CellValue>

Returns

cellValue is undefined | null | void

Defined in

data-validation/src/validators/base-data-validator.ts:121 (opens in a new tab)


isValidType()

isValidType(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<Nullable<CellValue>>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:140 (opens in a new tab)


normalizeFormula()

normalizeFormula(
   rule, 
   unitId, 
   subUnitId): {
  formula1: rule.formula1;
  formula2: rule.formula2;
}

Parameters

ParameterType
ruleIDataValidationRule
unitIdstring
subUnitIdstring

Returns

{
  formula1: rule.formula1;
  formula2: rule.formula2;
}
NameTypeDefault valueDefined in
formula1undefined | stringrule.formula1data-validation/src/validators/base-data-validator.ts:135 (opens in a new tab)
formula2undefined | stringrule.formula2data-validation/src/validators/base-data-validator.ts:136 (opens in a new tab)

Defined in

data-validation/src/validators/base-data-validator.ts:133 (opens in a new tab)


parseFormula()

abstract parseFormula(
   rule, 
   unitId, 
subUnitId): Promise<IFormulaResult<any>>

Parameters

ParameterType
ruleIDataValidationRule
unitIdstring
subUnitIdstring

Returns

Promise<IFormulaResult<any>>

Defined in

data-validation/src/validators/base-data-validator.ts:129 (opens in a new tab)


transform()

transform(
   cellInfo, 
   formula, 
rule): IValidatorCellInfo<DataType>

Parameters

ParameterType
cellInfoIValidatorCellInfo<Nullable<CellValue>>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

IValidatorCellInfo<DataType>

Defined in

data-validation/src/validators/base-data-validator.ts:144 (opens in a new tab)


validator()

validator(cellInfo, rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<Nullable<CellValue>>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:180 (opens in a new tab)


validatorFormula()

abstract validatorFormula(
   rule, 
   unitId, 
   subUnitId): IFormulaValidResult

Parameters

ParameterType
ruleIDataValidationRule
unitIdstring
subUnitIdstring

Returns

IFormulaValidResult

Defined in

data-validation/src/validators/base-data-validator.ts:131 (opens in a new tab)


validatorIsBetween()

validatorIsBetween(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<DataType>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:156 (opens in a new tab)


validatorIsEqual()

validatorIsEqual(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<DataType>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:148 (opens in a new tab)


validatorIsGreaterThan()

validatorIsGreaterThan(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<DataType>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:164 (opens in a new tab)


validatorIsGreaterThanOrEqual()

validatorIsGreaterThanOrEqual(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<DataType>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:168 (opens in a new tab)


validatorIsLessThan()

validatorIsLessThan(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<DataType>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:172 (opens in a new tab)


validatorIsLessThanOrEqual()

validatorIsLessThanOrEqual(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<DataType>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:176 (opens in a new tab)


validatorIsNotBetween()

validatorIsNotBetween(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<DataType>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:160 (opens in a new tab)


validatorIsNotEqual()

validatorIsNotEqual(
   cellInfo, 
   formula, 
rule): Promise<boolean>

Parameters

ParameterType
cellInfoIValidatorCellInfo<DataType>
formulaIFormulaResult<any>
ruleIDataValidationRule

Returns

Promise<boolean>

Defined in

data-validation/src/validators/base-data-validator.ts:152 (opens in a new tab)


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