Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
feat: optimize the enableSyncSwitch configuration to support setting the default value of the switch (#6040)
wpxp1234569385d0406796
diff --git a/packages/sheets-filter/src/controllers/config.schema.ts b/packages/sheets-filter/src/controllers/config.schema.tsindex 86b15c2e2d..534d2adb11 100644--- a/packages/sheets-filter/src/controllers/config.schema.ts+++ b/packages/sheets-filter/src/controllers/config.schema.ts@@ -22,9 +22,10 @@ export interface IUniverSheetsFilterConfig {/*** Whether to display the filter sync switch in the filter panel.* This configuration can be used in a collaboration scenario to allow users to choose whether to enable filter synchronization.+ * If set to a defaultValue object, the filter sync switch will be displayed and its initial state will be determined by the defaultValue property.* @default false*/- enableSyncSwitch?: boolean;+ enableSyncSwitch?: boolean | { defaultValue: boolean };}export const defaultPluginConfig: IUniverSheetsFilterConfig = {};diff --git a/packages/sheets-filter/src/controllers/sheets-filter-sync.controller.ts b/packages/sheets-filter/src/controllers/sheets-filter-sync.controller.tsindex 9e35015ca7..2f40f10c6d 100644--- a/packages/sheets-filter/src/controllers/sheets-filter-sync.controller.ts+++ b/packages/sheets-filter/src/controllers/sheets-filter-sync.controller.ts@@ -55,6 +55,10 @@ export class SheetsFilterSyncController extends Disposable {const config = this._configService.getConfig<IUniverSheetsFilterConfig>(SHEETS_FILTER_PLUGIN_CONFIG_KEY);if (config?.enableSyncSwitch) {this._visible$.next(true);++ if (typeof config.enableSyncSwitch === 'object') {+ this.setEnabled(config.enableSyncSwitch.defaultValue ?? true);+ }}}