Univer
Univer Sheet
Features
Data Validation

Data Validation

📊 Univer Sheet

Data validation is a feature that sets rules in cells to ensure that the data entered by users meets specific conditions. Currently supported data validation types:

  • number
  • integer
  • Text length
  • date
  • checkbox
  • Drop-down list (single/multiple)
  • Custom formula

Installation

pnpm add @univerjs/data-validation @univerjs/sheets-data-validation

Import

import '@univerjs/sheets-data-validation/lib/index.css';
 
import { UniverDataValidationPlugin } from '@univerjs/data-validation';
import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';

Internationalization

import { LocaleType, Tools } from '@univerjs/core';
import SheetsDataValidationEnUS from '@univerjs/sheets-data-validation/locale/en-US';
 
const univer = new Univer({
  theme: defaultTheme,
  locale: LocaleType.EN_US,
  locales: {
    [LocaleType.EN_US]: Tools.deepMerge(
      // ...other_locales,
      SheetsDataValidationEnUS
    ),
  },
});

Register

univer.registerPlugin(UniverDataValidationPlugin);
 
univer.registerPlugin(UniverSheetsDataValidationPlugin, {
  // Whether to show the edit button in the dropdown menu
  // version >= 0.2.16
  showEditOnDropdown: true
});

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