# @univerjs-pro/sheets-pivot

[![npm version](https://img.shields.io/npm/v/@univerjs-pro/sheets-pivot?style=flat-square)](https://npmjs.com/package/@univerjs-pro/sheets-pivot)
[![license](https://img.shields.io/npm/l/@univerjs-pro/sheets-pivot?style=flat-square)](https://npmjs.com/package/@univerjs-pro/sheets-pivot)
[![downloads](https://img.shields.io/npm/dm/@univerjs-pro/sheets-pivot?style=flat-square)](https://npmjs.com/package/@univerjs-pro/sheets-pivot)

`@univerjs-pro/sheets-pivot` is part of Univer Pro. Pivot table integration for Univer Sheets.

## Package Overview

| Package | UMD global | CSS | Locales | Facade entry | Worker entry |
| --- | --- | :---: | :---: | :---: | :---: |
| `@univerjs-pro/sheets-pivot` | `UniverProSheetsPivot` | No | Yes | Yes | Yes |

## Installation

```sh
pnpm add @univerjs-pro/sheets-pivot
# or
npm install @univerjs-pro/sheets-pivot
```

## Usage

Start with the [integration setup](https://docs.univer.ai/) for your document type, including its required plugins, styles, and locale resources. The snippet below assumes that setup is complete.

```ts
import EnUS from '@univerjs-pro/sheets-pivot/locale/en-US';
import { UniverSheetsPivotTablePlugin } from '@univerjs-pro/sheets-pivot';

univer.registerPlugin(UniverSheetsPivotTablePlugin);

// Merge EnUS into your Univer locale map when this package contributes UI text.
```

### Worker usage

On the main thread, import `UniverSheetsPivotTablePlugin` from `@univerjs-pro/sheets-pivot`. Set `notExecuteFormula: true` to delegate calculation to the worker.

In the worker entry, import `UniverSheetsPivotTablePlugin` from `@univerjs-pro/sheets-pivot/worker`:

```ts
import { UniverSheetsPivotTablePlugin } from '@univerjs-pro/sheets-pivot/worker';

univer.registerPlugin(UniverSheetsPivotTablePlugin, { notExecuteFormula: false });
```

## Integration Notes

- Import locale files only for the languages your application enables.
- Use the facade entry when integrating through Univer Facade APIs.

## Resources

- [Documentation](https://docs.univer.ai)
- [NPM package](https://npmjs.com/package/@univerjs-pro/sheets-pivot)
- [GitHub repository](https://github.com/dream-num/univer-pro)
