Some checks failed
📦 Build / build (push) Has been cancelled
🧪 CI Test / test shard (1/4) (push) Has been cancelled
🧪 CI Test / test shard (2/4) (push) Has been cancelled
🧪 CI Test / test shard (3/4) (push) Has been cancelled
🧪 CI Test / test shard (4/4) (push) Has been cancelled
🧪 CI Test / test (push) Has been cancelled
🧪 CI Test / eslint (push) Has been cancelled
🧪 CI Test / typecheck (push) Has been cancelled
🔫 Sync to Pro / dispatch-sync (push) Has been cancelled
🔮 Sync Mirror / sync (push) Has been cancelled
47 lines
1.5 KiB
Markdown
47 lines
1.5 KiB
Markdown
# @univerjs/data-validation
|
|
|
|
[](https://npmjs.com/package/@univerjs/data-validation)
|
|
[](https://npmjs.com/package/@univerjs/data-validation)
|
|
[](https://npmjs.com/package/@univerjs/data-validation)
|
|
|
|
`@univerjs/data-validation` provides the shared data validation model and rule services used by sheet data validation features.
|
|
|
|
## Package Overview
|
|
|
|
| Package | UMD global | CSS | Locales | Facade entry |
|
|
| --- | --- | :---: | :---: | :---: |
|
|
| `@univerjs/data-validation` | `UniverDataValidation` | No | Yes | No |
|
|
|
|
## Installation
|
|
|
|
```sh
|
|
pnpm add @univerjs/data-validation
|
|
# or
|
|
npm install @univerjs/data-validation
|
|
```
|
|
|
|
Keep all `@univerjs/*` packages on the same version.
|
|
|
|
## Usage
|
|
|
|
```ts
|
|
import { LocaleType, mergeLocales, Univer } from '@univerjs/core';
|
|
import { UniverDataValidationPlugin } from '@univerjs/data-validation';
|
|
import DataValidationEnUS from '@univerjs/data-validation/locale/en-US';
|
|
|
|
const univer = new Univer({
|
|
locale: LocaleType.EN_US,
|
|
locales: {
|
|
[LocaleType.EN_US]: mergeLocales(DataValidationEnUS),
|
|
},
|
|
});
|
|
|
|
univer.registerPlugin(UniverDataValidationPlugin);
|
|
```
|
|
|
|
## Resources
|
|
|
|
- [Documentation](https://docs.univer.ai)
|
|
- [NPM package](https://npmjs.com/package/@univerjs/data-validation)
|
|
- [GitHub repository](https://github.com/dream-num/univer)
|