Module UI.Common

Basic example
let validationContainer: ValidationContainer<Decimal | null, string> | null = null;

try {
const validationContainer = new ValidationContainer(
() => (!!value ? new Decimal(value) : null),
() => value
);

const validator: ValidationContainerValidator<Decimal | null, string> = context => {
if (!context.value?.greaterThan(0)) {
const error = 'The value must be greater than "0".';
context.validationResult.add(ValidationResult.fromText(error, ValidationResultType.Error));
context.handled = true; // To interrupt the chain of handlers, the value must be set to `true`.
}
};

validationContainer.add(validator, { id: 'Greater than zero' });

validationContainer.isEmpty: // false
validationContainer.size; // 1
validationContainer.has(validator) // true
validationContainer.result.hasErrors; // true
validationContainer.removeById('Greater than zero'); // true
validationContainer.remove(validator); // false (already removed)

} finally {
validationContainer?.dispose();
}
Modes example
validationContainer.isManual = false;
validationContainer.result; // some result

validationContainer.isManual = true;
validationContainer.result; // empty result
validationContainer.validate(value);
validationContainer.result; // some result

validationContainer.isManual = false;
validationContainer.addAsync(
async context => {
if (!(await checkValue(context.value))) {
const warning = 'Warnings occurred while checking a value.';
context.validationResult.add(
ValidationResult.fromText(warning, ValidationResultType.Warning)
);
}
},
{ order: 0 }
);

validationContainer.hasAsync; // true
const validationResult = await validationContainer.validateAsync(value);
validationContainer.result === validationResult; // true;
validationContainer.result.hasWarnings; // true
validationContainer.validate(value); // exception

Namespaces

ShadowPropsHelper
ValidationContainerConstants

Enumerations

ShadowPropsStage

Classes

AttributeList
ClassNameList
CommitChangesContext
CustomStyleList
DataAttributeList
Dimensions
FocusManager
OverlayManager
ShadowPropsContainer
ThemeManager
Tooltip
ValidationContainer

Interfaces

CSSObject
ICommitChangesContext
IFocusManageable
ITheme
IThemesConfig
IValidationContainerContext
IValidationContainerObject
IValidationContainerValidatorSettings
ShadowPropsContainerItem
ShadowPropsFinalFunc
ShadowPropsFunc
ShadowPropsOptions
UIHandlersContainer
ValidationContainerCreateOptions

Type Aliases

AttributeContainer
BorderNode
ControlBorderType
ControlType
ControlValue
CustomStyle
CustomStyleFunc
DimensionType
EventType
FlattenSimpleInterpolation
FontNode
IconNode
IconsetNode
ImageNode
ThemeFragment
ThemeIcon
ThemeIconset
ThemeIconsetSection
ThemeIconSize
ThemeImage
ThemeImagesSection
ThemeMetaSection
ThemeNode
ThemeResources
ThemeResourceSection
ThemeValue
UIHandlers
ValidationContainerResult
ValidationContainerResultDisplay
ValidationContainerResultInfo
ValidationContainerResultItem
ValidationContainerResultMode
ValidationContainerValidator

Variables

MaxInt32
ShadowPropsSymbol

Functions - Other

combineRef
createUIHandlersContainer
css
getUIId
styled
useCombinedRefs
useFocusManager
useForkRef
useLocalize
useVisibility

Functions - Type Guards

isIFocusManageable
MMNEPVFCICPMFPCPTTAAATR