@univerjsdata-validationclassesBasedatavalidator

@univerjs/data-validation v0.5.0-beta.1 • Docs


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:77

Properties

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

Accessors

operatorNames

Get Signature

get operatorNames(): string[]
Returns

string[]

Defined in

data-validation/src/validators/base-data-validator.ts:84


titleStr

Get Signature

get titleStr(): string
Returns

string

Defined in

data-validation/src/validators/base-data-validator.ts:88

Methods

generateRuleErrorMessage()

generateRuleErrorMessage(rule, position): string

Parameters

ParameterType
ruleIDataValidationRuleBase
positionISheetLocationBase

Returns

string

Defined in

data-validation/src/validators/base-data-validator.ts:103


generateRuleName()

generateRuleName(rule): string

Parameters

ParameterType
ruleIDataValidationRuleBase

Returns

string

Defined in

data-validation/src/validators/base-data-validator.ts:94


getExtraStyle()

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

Parameters

ParameterType
ruleIDataValidationRuleBase
valueNullable<CellValue>
ctxobject
ctx.styleIStyleData
rownumber
columnnumber

Returns

Nullable<IStyleData>

Defined in

data-validation/src/validators/base-data-validator.ts:112


getRuleFinalError()

getRuleFinalError(rule, position): string

Parameters

ParameterType
ruleIDataValidationRule
positionISheetLocationBase

Returns

string

Defined in

data-validation/src/validators/base-data-validator.ts:114


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:122


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:141


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:136
formula2undefined | stringrule.formula2data-validation/src/validators/base-data-validator.ts:137

Defined in

data-validation/src/validators/base-data-validator.ts:134


parseFormula()

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

Parameters

ParameterType
ruleIDataValidationRule
unitIdstring
subUnitIdstring
rownumber
columnnumber

Returns

Promise<IFormulaResult<any>>

Defined in

data-validation/src/validators/base-data-validator.ts:130


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:145


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:181


validatorFormula()

abstract validatorFormula(
   rule, 
   unitId, 
   subUnitId): IFormulaValidResult

Parameters

ParameterType
ruleIDataValidationRule
unitIdstring
subUnitIdstring

Returns

IFormulaValidResult

Defined in

data-validation/src/validators/base-data-validator.ts:132


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:157


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:149


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:165


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:169


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:173


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:177


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:161


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:153