Univer Weekly #7

If you find Univer useful, please consider supporting us by starring our project on GitHub. Your support helps us continue to improve and maintain Univer.


Univer v0.10.0 & v0.10.1 & v0.10.2

mergeLocales: Simplifying Locale Merging

In the latest version of Univer, we have introduced a new mergeLocales method for merging multiple locale objects. Compared to the previous manual merge method, mergeLocales allows you to focus solely on the locales you want to merge, significantly enhancing the convenience and readability of internationalization development.

For projects that previously used the merge method, we recommend updating your code as follows:

- import { merge } from '@univerjs/presets';
+ import { mergeLocales } from '@univerjs/presets';

const univer = new Univer({
  locale: LocaleType.EN_US,
  locales: {
-   [LocaleType.EN_US]: merge(
-   {},
+   [LocaleType.EN_US]: mergeLocales(
      DesignEnUS,
      UIEnUS,
      DocsUIEnUS,
      SheetsEnUS,
      SheetsUIEnUS,
      SheetsFormulaUIEnUS,
      SheetsNumfmtUIEnUS,
    ),
  },
})
- import { merge } from '@univerjs/core';
+ import { mergeLocales } from '@univerjs/core';

const univer = new Univer({
  locale: LocaleType.EN_US,
  locales: {
-   [LocaleType.EN_US]: merge(
-   {},
+   [LocaleType.EN_US]: mergeLocales(
      DesignEnUS,
      UIEnUS,
      DocsUIEnUS,
      SheetsEnUS,
      SheetsUIEnUS,
      SheetsFormulaUIEnUS,
      SheetsNumfmtUIEnUS,
    ),
  },
})

This adjustment allows you to merge multiple locale objects more clearly, without needing to manually pass an empty object as the initial parameter.

univer.registerPlugin: Support for Batch Plugin Registration

We have enhanced the univer.registerPlugin method to support batch registration of plugins, allowing you to register multiple plugins at once without the need for multiple calls, greatly improving flexibility and efficiency. For example:

univer.registerPlugin([
  UniverRenderEnginePlugin,
  UniverFormulaEnginePlugin,
  [UniverUIPlugin, {
    container: 'app',
  }],
  UniverDocsPlugin,
  UniverDocsUIPlugin,
  UniverSheetsPlugin,
  UniverSheetsUIPlugin,
  UniverSheetsFormulaPlugin,
  UniverSheetsFormulaUIPlugin,
  UniverSheetsNumfmtPlugin,
  UniverSheetsNumfmtUIPlugin,
])

This allows you to manage and maintain plugin dependencies more intuitively by passing an array of plugins.

Refactoring Date Components

In this week's update, we have refactored the date components, including DatePicker and DateRangePicker, to unify their UI style and fix issues with locale loading in preset mode.

💔 Breaking Change: Custom Permission Background and User Component Configuration Changes

In the past, developers used the customComponents property of UniverSheetsUIPlugin to implement custom permission backgrounds and user components. This approach was cumbersome and had a high learning curve. In version 0.10.0, we made a breaking change by removing customComponents and replacing it with more intuitive protectedRangeUserSelector and protectedRangeShadow.

If you previously used the customComponents property for custom permission backgrounds and user components, please refer to the following examples for migration:

Hide Permission Background Shadow

createUniver({
  presets: [
    UniverSheetsCorePreset({
-     customComponents: new Set([UNIVER_SHEET_PERMISSION_BACKGROUND]),
+     sheets: {
+       protectedRangeShadow: false,
+     },
    }),
  ],
})
univer.registerPlugin(UniverSheetsUIPlugin, {
-  customComponents: new Set([UNIVER_SHEET_PERMISSION_BACKGROUND]),
+  protectedRangeShadow: false,
})

Custom User Component

- const injector = univer.__getInjector()
- const uiPartsService = injector.get(IUIPartsService)
- uiPartsService.registerComponent(UNIVER_SHEET_PERMISSION_USER_PART, () => connectInjector(CustomPermissionDetailUserPart, injector))

createUniver({
  presets: [
    UniverSheetsCorePreset({
-     customComponents: new Set([UNIVER_SHEET_PERMISSION_USER_PART]),
+     sheets: {
+       protectedRangeUserSelector: {
+         component: CustomPermissionDetailUserPart,
+         framework: 'react',
+       },
+     },
    }),
  ],
})
- const injector = univer.__getInjector()
- const uiPartsService = injector.get(IUIPartsService)
- uiPartsService.registerComponent(UNIVER_SHEET_PERMISSION_USER_PART, () => connectInjector(CustomPermissionDetailUserPart, injector))

univer.registerPlugin(UniverSheetsUIPlugin, {
-  customComponents: new Set([UNIVER_SHEET_PERMISSION_USER_PART]),
+  protectedRangeUserSelector: {
+    component: CustomPermissionDetailUserPart,
+    framework: 'react',
+  },
})

Other Feature Enhancements and Bug Fixes

  • Univer Slides now supports inserting circles. Special thanks to community contributor @kenny-not-dead for this feature (#5602).
  • Optimized the default popup position of the custom sort dialog for a better user experience.
  • The find and replace feature has been upgraded; you can now jump to the next match in the input box by pressing Enter.
  • Fixed some issues related to table filters.
  • Developers are now allowed to create dialogs that exceed the width limit.
  • Fixed the issue where the global theme was not synchronized in the history record.
  • Fixed some style issues with pivot tables.
  • Improved the style of the permissions panel.
  • Added new permission points: WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookDeleteColumnPermission, and WorkbookDeleteRowPermission, allowing control over adding and deleting columns and rows in workbooks.
  • Illegal table names are now prohibited.
  • Refactored the scrollbar in the rendering area.
  • Fixed incorrect horizontal alignment when the cell type is Boolean.
  • Fixed some style issues in the filter panel.
  • Fixed the excessive memory usage issue when integrating Univer in Electron.
  • Fixed incorrect calculation for formulas like COUNTIFS when using the <> operator.
  • Fixed the issue where the cell editor's zoom ratio was not synchronized when the zoom ratio was not 100%.

For a full list of updates and historical release information, please visit our GitHub Releases page.


Thank you to every community developer and user for your attention and support! We will continue to optimize the product experience, and we welcome your valuable suggestions and contributions. Let's work together to make Univer even better!