|
| 1 | +--- |
| 2 | +title: "Univer Weekly #7" |
| 3 | +author: 白熱 |
| 4 | +date: 2025-07-29 |
| 5 | +--- |
| 6 | + |
| 7 | +import { RainbowButton } from '@/components/magicui/rainbow-button' |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +<a href="https://github.com/dream-num/univer" target="_blank" rel="noopener noreferrer"> |
| 12 | + <RainbowButton variant="outline">⭐️ Star on GitHub</RainbowButton> |
| 13 | +</a> |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## Univer v0.10.0 |
| 18 | + |
| 19 | +### `mergeLocales`: Simplifying Locale Merging |
| 20 | + |
| 21 | +In Univer v0.10.0, we introduced the new [`mergeLocales`](/guides/getting-started/i18n#mergeLocales) method for merging multiple locale objects. This method simplifies the merging process, allowing you to focus on the locales you want to combine without worrying about the underlying details, significantly enhancing the convenience and readability of internationalization development. |
| 22 | + |
| 23 | +For projects that previously used the `merge` method, we recommend updating your code as follows: |
| 24 | + |
| 25 | +<Tabs items={['Preset Mode', 'Plugin Mode']}> |
| 26 | + <Tab> |
| 27 | + ```diff |
| 28 | + - import { merge } from '@univerjs/presets'; |
| 29 | + + import { mergeLocales } from '@univerjs/presets'; |
| 30 | + |
| 31 | + const univer = new Univer({ |
| 32 | + locale: LocaleType.EN_US, |
| 33 | + locales: { |
| 34 | + - [LocaleType.EN_US]: merge( |
| 35 | + - {}, |
| 36 | + + [LocaleType.EN_US]: mergeLocales( |
| 37 | + DesignEnUS, |
| 38 | + UIEnUS, |
| 39 | + DocsUIEnUS, |
| 40 | + SheetsEnUS, |
| 41 | + SheetsUIEnUS, |
| 42 | + SheetsFormulaUIEnUS, |
| 43 | + SheetsNumfmtUIEnUS, |
| 44 | + ), |
| 45 | + }, |
| 46 | + }) |
| 47 | + ``` |
| 48 | + </Tab> |
| 49 | + <Tab> |
| 50 | + ```diff |
| 51 | + - import { merge } from '@univerjs/core'; |
| 52 | + + import { mergeLocales } from '@univerjs/core'; |
| 53 | + |
| 54 | + const univer = new Univer({ |
| 55 | + locale: LocaleType.EN_US, |
| 56 | + locales: { |
| 57 | + - [LocaleType.EN_US]: merge( |
| 58 | + - {}, |
| 59 | + + [LocaleType.EN_US]: mergeLocales( |
| 60 | + DesignEnUS, |
| 61 | + UIEnUS, |
| 62 | + DocsUIEnUS, |
| 63 | + SheetsEnUS, |
| 64 | + SheetsUIEnUS, |
| 65 | + SheetsFormulaUIEnUS, |
| 66 | + SheetsNumfmtUIEnUS, |
| 67 | + ), |
| 68 | + }, |
| 69 | + }) |
| 70 | + ``` |
| 71 | + </Tab> |
| 72 | +</Tabs> |
| 73 | + |
| 74 | +This adjustment allows you to merge multiple locale objects more clearly, without needing to manually pass an empty object as the initial parameter. |
| 75 | + |
| 76 | +### `univer.registerPlugin`: Support for Batch Plugin Registration |
| 77 | + |
| 78 | +We have enhanced the [`univer.registerPlugin`](/guides/getting-started/installation#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: |
| 79 | + |
| 80 | +```typescript |
| 81 | +univer.registerPlugin([ |
| 82 | + UniverRenderEnginePlugin, |
| 83 | + UniverFormulaEnginePlugin, |
| 84 | + [UniverUIPlugin, { |
| 85 | + container: 'app', |
| 86 | + }], |
| 87 | + UniverDocsPlugin, |
| 88 | + UniverDocsUIPlugin, |
| 89 | + UniverSheetsPlugin, |
| 90 | + UniverSheetsUIPlugin, |
| 91 | + UniverSheetsFormulaPlugin, |
| 92 | + UniverSheetsFormulaUIPlugin, |
| 93 | + UniverSheetsNumfmtPlugin, |
| 94 | + UniverSheetsNumfmtUIPlugin, |
| 95 | +]) |
| 96 | +``` |
| 97 | + |
| 98 | +This allows you to manage and maintain plugin dependencies more intuitively by passing an array of plugins. |
| 99 | + |
| 100 | +### 💔 Breaking Change: Custom Permission Background and User Component Configuration Changes |
| 101 | + |
| 102 | +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`. |
| 103 | + |
| 104 | +If you previously used the `customComponents` property for custom permission backgrounds and user components, please refer to the following examples for migration: |
| 105 | + |
| 106 | +**Hide Permission Background Shadow** |
| 107 | + |
| 108 | +<Tabs items={['Preset Mode', 'Plugin Mode']}> |
| 109 | + <Tab> |
| 110 | + ```diff |
| 111 | + createUniver({ |
| 112 | + presets: [ |
| 113 | + UniverSheetsCorePreset({ |
| 114 | + - customComponents: new Set([UNIVER_SHEET_PERMISSION_BACKGROUND]), |
| 115 | + + protectedRangeShadow: false, |
| 116 | + }), |
| 117 | + ], |
| 118 | + }) |
| 119 | + ``` |
| 120 | + </Tab> |
| 121 | + <Tab> |
| 122 | + ```diff |
| 123 | + univer.registerPlugin(UniverSheetsUIPlugin, { |
| 124 | + - customComponents: new Set([UNIVER_SHEET_PERMISSION_BACKGROUND]), |
| 125 | + + protectedRangeShadow: false, |
| 126 | + }) |
| 127 | + ``` |
| 128 | + </Tab> |
| 129 | +</Tabs> |
| 130 | + |
| 131 | +**Custom User Component** |
| 132 | + |
| 133 | +<Tabs items={['Preset Mode', 'Plugin Mode']}> |
| 134 | + <Tab> |
| 135 | + ```diff |
| 136 | + - const injector = univer.__getInjector() |
| 137 | + - const uiPartsService = injector.get(IUIPartsService) |
| 138 | + - uiPartsService.registerComponent(UNIVER_SHEET_PERMISSION_USER_PART, () => connectInjector(CustomPermissionDetailUserPart, injector)) |
| 139 | + |
| 140 | + createUniver({ |
| 141 | + presets: [ |
| 142 | + UniverSheetsCorePreset({ |
| 143 | + - customComponents: new Set([UNIVER_SHEET_PERMISSION_USER_PART]), |
| 144 | + + protectedRangeUserSelector: { |
| 145 | + + component: CustomPermissionDetailUserPart, |
| 146 | + + framework: 'react', |
| 147 | + + }, |
| 148 | + }), |
| 149 | + ], |
| 150 | + }) |
| 151 | + ``` |
| 152 | + </Tab> |
| 153 | + <Tab> |
| 154 | + ```diff |
| 155 | + - const injector = univer.__getInjector() |
| 156 | + - const uiPartsService = injector.get(IUIPartsService) |
| 157 | + - uiPartsService.registerComponent(UNIVER_SHEET_PERMISSION_USER_PART, () => connectInjector(CustomPermissionDetailUserPart, injector)) |
| 158 | + |
| 159 | + univer.registerPlugin(UniverSheetsUIPlugin, { |
| 160 | + - customComponents: new Set([UNIVER_SHEET_PERMISSION_USER_PART]), |
| 161 | + + protectedRangeUserSelector: { |
| 162 | + + component: CustomPermissionDetailUserPart, |
| 163 | + + framework: 'react', |
| 164 | + + }, |
| 165 | + }) |
| 166 | + ``` |
| 167 | + </Tab> |
| 168 | +</Tabs> |
| 169 | + |
| 170 | +### Other Feature Enhancements and Bug Fixes |
| 171 | + |
| 172 | +- Univer Slides now supports inserting circles. Thanks to community contributor [@kenny-not-dead](https://github.com/kenny-not-dead) for this feature contribution (#[5602](https://github.com/dream-num/univer/pull/5602)). |
| 173 | +- Optimized the default popup position of the custom sorting dialog to enhance user experience. |
| 174 | +- The find and replace feature has been upgraded to allow jumping to the next match directly by pressing the Enter key in the input box. |
| 175 | +- Fixed some issues related to table filters. |
| 176 | + |
| 177 | +For a full list of updates and historical release information, please visit our [GitHub Releases page](https://github.com/dream-num/univer/releases/tag/v0.10.0). |
| 178 | + |
| 179 | +--- |
| 180 | + |
| 181 | +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! |
0 commit comments