Skip to content

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.

feat(facade): add `setOptions` on f-data-validation-builder (#3773)

zhangw4008c8605ba1
diff --git a/packages/facade/src/apis/sheets/f-data-validation-builder.ts b/packages/facade/src/apis/sheets/f-data-validation-builder.ts
index 8753469c19..7aa5db2fca 100644
--- a/packages/facade/src/apis/sheets/f-data-validation-builder.ts
+++ b/packages/facade/src/apis/sheets/f-data-validation-builder.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { IDataValidationRule } from '@univerjs/core';
+import type { IDataValidationRule, IDataValidationRuleOptions } from '@univerjs/core';
import type { FRange } from './f-range';
import { DataValidationErrorStyle, DataValidationOperator, DataValidationType, generateRandomId } from '@univerjs/core';
import { serializeRangeToRefString } from '@univerjs/engine-formula';
@@ -445,4 +445,16 @@ export class FDataValidationBuilder {
this._rule.formula2 = values[2];
return this;
}
+
+ /**
+ * Sets the options for the data validation rule.
+ * For details of options, please refer to https://univer.ai/typedoc/@univerjs/core/interfaces/IDataValidationRuleOptions
+ *
+ * @param options The options to set for the data validation rule.
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
+ */
+ setOptions(options: Partial<IDataValidationRuleOptions>): this {
+ Object.assign(this._rule, options);
+ return this;
+ }
}
diff --git a/packages/facade/src/apis/sheets/f-data-validation.ts b/packages/facade/src/apis/sheets/f-data-validation.ts
index 2c7ced8b64..eb5454db87 100644
--- a/packages/facade/src/apis/sheets/f-data-validation.ts
+++ b/packages/facade/src/apis/sheets/f-data-validation.ts
@@ -174,6 +174,7 @@ export class FDataValidation {
/**
* Set the options for the data validation rule.
+ * For details of options, please refer to https://univer.ai/typedoc/@univerjs/core/interfaces/IDataValidationRuleOptions
* @param options An object containing the options to set. `IDataValidationRuleOptions`
* @returns true if the options are set successfully, false otherwise.
*/