排序

Facade API付费版本需要 Univer 服务端Univer on Node.jsPreset
---UniverSheetsSortPreset

排序插件提供了对指定区域内单元格的排序功能。

该功能包含以下插件包:

Presets 安装

import { createUniver, defaultTheme, LocaleType, Tools } from '@univerjs/presets';
import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core';
import UniverPresetSheetsCoreZhCN from '@univerjs/presets/preset-sheets-core/locales/zh-CN';
import { UniverSheetsSortPreset } from '@univerjs/presets/preset-sheets-sort';
import SheetsSortZhCN from '@univerjs/presets/preset-sheets-sort/locale/zh-CN';
 
const { univerAPI } = createUniver({
  locale: LocaleType.ZH_CN,
  locales: {
    zhCN: Tools.deepMerge(
      {},
      UniverPresetSheetsCoreZhCN,
      SheetsSortZhCN 
    ),
  },
  theme: defaultTheme,
  presets: [
    UniverSheetsCorePreset(),
    UniverSheetsSortPreset()
  ]
});

高级安装

npm install @univerjs/sheets-sort @univerjs/sheets-sort-ui
import { LocaleType, Tools } from '@univerjs/core';
import { UniverSheetsSortPlugin } from '@univerjs/sheets-sort';
import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';
import SheetsSortUIZhCN from '@univerjs/sheets-sort-ui/locale/zh-CN';
 
import '@univerjs/sheets-sort-ui/lib/index.css';
 
const univer = new Univer({
  theme: defaultTheme,
  locale: LocaleType.ZH_CN,
  locales: {
    [LocaleType.ZH_CN]: Tools.deepMerge(
      SheetsSortUIZhCN
    ),
  },
});
 
univer.registerPlugin(UniverSheetsSortPlugin);
univer.registerPlugin(UniverSheetsSortUIPlugin);